working on amazon payments

This commit is contained in:
Victor Piousbox
2016-04-21 03:52:29 +00:00
parent 612e3b725f
commit 54a94db2de
5 changed files with 175 additions and 71 deletions
@@ -11,7 +11,7 @@ describe('payments : amazon', () => {
user = await generateUser();
});
it('verify access token', async () => {
it('verifies access token', async () => {
await expect(user.post(endpoint)).to.eventually.be.rejected.and.eql({
code: 400,
error: 'BadRequest',
+58 -4
View File
@@ -1,6 +1,7 @@
import * as amz from '../../../../../website/src/libs/api-v3/amazonPayments';
import * as amzLib from '../../../../../website/src/libs/api-v3/amazonPayments';
// import * as amzStub from 'amazon-payments';
import amazonPayments from 'amazon-payments';
var User = require('mongoose').model('User');
describe('amazonPayments', () => {
beforeEach(() => {
@@ -25,7 +26,7 @@ describe('amazonPayments', () => {
});
it('returns tokenInfo', async (done) => {
let result = await amz.getTokenInfo();
let result = await amzLib.getTokenInfo();
expect(result).to.eql(thisToken);
done();
});
@@ -34,7 +35,7 @@ describe('amazonPayments', () => {
describe('#getTokenInfo', () => {
it('validates access_token parameter', async (done) => {
try {
await amz.getTokenInfo();
await amzLib.getTokenInfo();
} catch (e) {
expect(e.type).to.eql('invalid_request');
done();
@@ -43,7 +44,60 @@ describe('amazonPayments', () => {
});
describe('#createOrderReferenceId', () => {
it('succeeds', () => {
it('verifies billingAgreementId', async (done) => {
try {
let inputSet = {};
delete inputSet.Id;
await amzLib.createOrderReferenceId(inputSet);
} catch (e) {
/* console.log('error!', e);
console.log('error keys!', Object.keys(e));
for (var key in e) {
console.log(e[key]);
} // */
expect(e.type).to.eql('InvalidParameterValue');
expect(e.body.ErrorResponse.Error.Message).to.eql('Parameter AWSAccessKeyId cannot be empty.');
done();
}
});
xit('succeeds', () => {
});
});
describe('#checkout', () => {
xit('succeeds');
});
describe('#setOrderReferenceDetails', () => {
xit('succeeds');
});
describe('#confirmOrderReference', () => {
xit('succeeds');
});
describe('#authorize', () => {
xit('succeeds');
xit('was declined');
xit('had an error');
});
describe('#closeOrderReference', () => {
xit('succeeds');
});
describe.only('#executePayment', () => {
it('succeeds', () => {
});
it('succeeds as a gift', () => {
});
});
});