Trust My Travel: Legacy API SDK
This is an unofficial node SDK for the Trust My Travel legacy API.
All types correspond to the official docs, with the exception of Booleans which are
given as strings for the most part in the API (i.e. "true"
rather than TRUE
), but have been typecast to Booleans
in this module.
Quickstart
Core functionality works as follows:
import TrustMyTravel from 'trust-my-travel-legacy';
async function example() {
const client = new TrustMyTravel({
username: 'username',
password: 'password',
live: true,
});
const testResult = await client.testConnection();
const paymentInput: PaymentParameters = {
firstname: 'Donald',
};
const paymentResult = await client.takePayment(paymentInput);
const refundInput: RefundParameters = {
booking_id: 123,
};
const refundResult = await client.refund(refund);
}
Testing
Integration tests are run using pupeteer to get tokens from Spreedly. To run locally you must set the following
environmental variables:
export TRUST_MY_TRAVEL_STAGING_USERNAME="your_staging_username"
export TRUST_MY_TRAVEL_STAGING_PASSWORD="your_staging_password"
Checklist
CD Feature | Provided |
---|
✅ | Typescript |
✅ | Linting (AirBnB + Prettier) |
✅ | Unit & Integration tests (Jest) |
✅ | 100% Coverage check |
✅ | Github Continuous Deployment |
Built by Skyhook
This module is contributed by the team at Skyhook.