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-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-23 13:33:19 +00:00
|
|
|
const transactions = await paypal.PayPalTransaction.getTransactionFor30days(testPayPalInstance, smarttime.ExtendedDate.fromHyphedDate('2020-05-01').getTime());
|
|
|
|
console.log(transactions);
|
2020-08-21 15:40:04 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
tap.start();
|