paypal/test/test.ts

28 lines
944 B
TypeScript
Raw Permalink Normal View History

2020-08-21 15:40:04 +00:00
import { expect, tap } from '@pushrocks/tapbundle';
import * as paypal from '../ts/index';
2017-10-26 12:23:13 +00:00
2020-08-21 15:40:04 +00:00
import { Qenv } from '@pushrocks/qenv';
const testQenv = new Qenv('./', './.nogit/');
2020-08-23 13:33:19 +00:00
import * as smarttime from '@pushrocks/smarttime';
2017-10-26 12:23:13 +00:00
2020-08-23 15:36:07 +00:00
let testPayPalInstance: paypal.PayPalAccount;
2020-08-21 15:40:04 +00:00
tap.test('should create a valid paypal instance', async () => {
2020-08-23 15:36:07 +00:00
testPayPalInstance = new paypal.PayPalAccount({
2020-08-21 15:40:04 +00:00
clientId: testQenv.getEnvVarOnDemand('PAYPAL_CLIENT_ID'),
clientSecret: testQenv.getEnvVarOnDemand('PAYPAL_CLIENT_SECRET'),
2020-08-25 11:57:03 +00:00
accountOwner: 'sample corp'
2020-08-21 15:40:04 +00:00
});
2020-08-23 15:36:07 +00:00
expect(testPayPalInstance).to.be.instanceOf(paypal.PayPalAccount);
2020-08-21 15:40:04 +00:00
});
tap.test('should get an access token', async () => {
2020-08-24 01:55:50 +00:00
const transactions = await testPayPalInstance.getTransactionsFromTo(
smarttime.ExtendedDate.fromHyphedDate('2020-01-01').getTime(),
2020-08-25 11:57:03 +00:00
smarttime.ExtendedDate.fromHyphedDate('2020-08-01').getTime()
2020-08-24 01:55:50 +00:00
);
2020-08-23 13:33:19 +00:00
console.log(transactions);
2020-08-21 15:40:04 +00:00
});
tap.start();