-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.js
148 lines (136 loc) · 3.96 KB
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
/**
* Modules from the community: package.json
*/
var expect = require('chai').expect;
var integrity = require('./integritypays.js');
var Integrity = new integrity(
{
merchant: _merchant_id_,
username: 'star4100',
password: 'Partner1',
environment: 'sandbox'
});
var customerForeignId, cardForeignId, transactionForeignId;
describe('Customer Methods', function ()
{
it('should create a customer on integrity', function (done)
{
Integrity.Customer.Create(
{
info:
{
id: 1,
businessName: 'MI6',
firstName: 'James',
lastName: 'Bond',
phone: '(007) 007-0007',
email: '[email protected]'
},
address:
{
street: '1 Secret Avenue',
unit: '0',
city: 'London'
}
}).then(function (foreignId)
{
expect(foreignId).to.be.above(0);
customerForeignId = foreignId;
console.log(customerForeignId);
done();
}).catch(done);
});
// it('should update a customer on integrity', function (done)
// {
// Integrity.Customer.Update(
// {
// foreignKey: customerForeignId,
// info:
// {
// id: 1,
// businessName: 'MI6',
// firstName: 'James',
// lastName: 'Bond',
// phone: '(007) 007-0007',
// email: '[email protected]'
// }
// }).then(function (foreignId)
// {
// expect(foreignId).to.be.above(0);
// done();
// }).catch(done);
// });
});
describe('Card Methods', function ()
{
it('should create a credit card on integrity', function (done)
{
Integrity.Card.Create(
{
foreignKey: customerForeignId,
nameOnCard: 'Q',
cardNumber: '5454545454545454',
exp: '1219'
}).then(function (cardData)
{
expect(cardData).to.exist; // jshint ignore:line
expect(cardData.foreignId).to.be.above(0);
cardForeignId = cardData.foreignId;
done();
}).catch(done);
});
// it('should get a credit card from integrity', function (done)
// {
// Integrity.Customer.GetCards(
// {
// foreignKey: customerForeignId
// }).then(function (res)
// {
// expect(res.length).to.be.above(0);
// done();
// }).catch(done);
// });
// it('should bill a credit card on integrity', function (done)
// {
// Integrity.Card.Sale(
// {
// foreignKey: cardForeignId,
// amount: 1
// }).then(function (saleData)
// {
// expect(saleData).to.exist;
// expect(saleData.foreignId).to.be.above(0);
//
// transactionForeignId = saleData.foreignId;
//
// done();
// }).catch(done);
// });
// it('should refund a credit card on integrity', function (done)
// {
// Integrity.Card.Refund(
// {
// foreignKey: cardForeignId,
// transactionForeignKey: transactionForeignId,
// amount: 0.5
// }).then(function (refundData)
// {
// expect(refundData).to.exist;
// expect(refundData.foreignId).to.be.above(0);
// done();
// }).catch(done);
// });
// it('should void a credit card on integrity', function (done)
// {
// Integrity.Card.Void(
// {
// foreignKey: cardForeignId,
// transactionForeignKey: transactionForeignId
// }).then(function (voidData)
// {
// expect(voidData).to.exist;
// expect(voidData.foreignId).to.be.above(0);
// done();
// }).catch(done);
// });
});