mangopay4-nodejs-sdk 1.67.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +39 -0
- package/README.md +0 -6
- package/docs/templates/class.mustache +0 -0
- package/docs/templates/file.mustache +0 -0
- package/docs/templates/function.mustache +0 -0
- package/docs/templates/index.mustache +0 -0
- package/docs/templates/overview.mustache +0 -0
- package/lib/apiMethods.js +10 -3
- package/lib/models/CardPreAuthorization.js +2 -2
- package/lib/models/PayInPaymentType.js +0 -1
- package/lib/models/ReportFilterV2.js +2 -1
- package/lib/services/Acquiring.js +152 -0
- package/lib/services/PayIns.js +0 -18
- package/lib/services/index.js +2 -1
- package/package.json +16 -24
- package/typings/enums.d.ts +0 -1
- package/typings/index.d.ts +5 -5
- package/typings/index.test-d.ts +0 -15
- package/typings/models/acquiring.d.ts +763 -0
- package/typings/models/payIn.d.ts +20 -80
- package/typings/models/refund.d.ts +1 -0
- package/typings/models/reportV2.d.ts +2 -0
- package/typings/services/Acquiring.d.ts +44 -0
- package/typings/services/PayIns.d.ts +0 -8
- package/typings/types.d.ts +0 -2
- package/.github/workflows/node.js.yml +0 -32
- package/.github/workflows/npm-publish.yml +0 -26
- package/.jshintrc +0 -16
- package/lib/models/PayInPaymentDetailsPayconiq.js +0 -23
- package/test/TestKycPageFile.png +0 -0
- package/test/helpers.js +0 -1536
- package/test/main.js +0 -10
- package/test/mocha.opts +0 -3
- package/test/services/BankAccounts.js +0 -46
- package/test/services/BankingAliases.js +0 -89
- package/test/services/CardPreAuthorizations.js +0 -70
- package/test/services/CardRegistrations.js +0 -239
- package/test/services/Cards.js +0 -56
- package/test/services/Clients.js +0 -235
- package/test/services/Conversions.js +0 -319
- package/test/services/Deposits.js +0 -148
- package/test/services/Disputes.js +0 -542
- package/test/services/EMoney.js +0 -54
- package/test/services/Events.js +0 -147
- package/test/services/Hooks.js +0 -109
- package/test/services/Idempotency.js +0 -41
- package/test/services/IdentityVerifications.js +0 -68
- package/test/services/KycDocuments.js +0 -73
- package/test/services/Mandates.js +0 -256
- package/test/services/PayIns.js +0 -2748
- package/test/services/PayOuts.js +0 -119
- package/test/services/RateLimit.js +0 -43
- package/test/services/Recipients.js +0 -234
- package/test/services/Refunds.js +0 -123
- package/test/services/Regulatory.js +0 -45
- package/test/services/Reports.js +0 -114
- package/test/services/ReportsV2.js +0 -306
- package/test/services/Repudiations.js +0 -22
- package/test/services/Settlements.js +0 -127
- package/test/services/Tokens.js +0 -55
- package/test/services/Transfers.js +0 -137
- package/test/services/UboDeclarations.js +0 -130
- package/test/services/Users.js +0 -1322
- package/test/services/VirtualAccounts.js +0 -105
- package/test/services/Wallets.js +0 -132
- package/test/settlement_sample.csv +0 -8
- package/test/settlement_sample_bad.csv +0 -8
package/test/services/Clients.js
DELETED
|
@@ -1,235 +0,0 @@
|
|
|
1
|
-
var _ = require('underscore');
|
|
2
|
-
var path = require('path');
|
|
3
|
-
var expect = require('chai').expect;
|
|
4
|
-
var api = require('../main');
|
|
5
|
-
|
|
6
|
-
var ClientWallet = require('../../lib/models/ClientWallet');
|
|
7
|
-
var BankAccount = require('../../lib/models/BankAccount');
|
|
8
|
-
var BankAccountDetailsIBAN = require('../../lib/models/BankAccountDetailsIBAN');
|
|
9
|
-
var PayOut = require('../../lib/models/PayOut');
|
|
10
|
-
var PayOutPaymentDetailsBankWire = require('../../lib/models/PayOutPaymentDetailsBankWire');
|
|
11
|
-
|
|
12
|
-
describe("Clients", function () {
|
|
13
|
-
var client;
|
|
14
|
-
var createdBankAccount;
|
|
15
|
-
|
|
16
|
-
before(function (done) {
|
|
17
|
-
api.Clients.get().then(function (data) {
|
|
18
|
-
client = data;
|
|
19
|
-
done();
|
|
20
|
-
});
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
it('Get Client', function () {
|
|
24
|
-
expect(client.ClientId).not.to.be.undefined;
|
|
25
|
-
expect(client.ClientId).to.equal(api.config.clientId);
|
|
26
|
-
expect(client.Licensor).not.to.be.undefined;
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
describe("Update client", function () {
|
|
30
|
-
var updatedClient;
|
|
31
|
-
var themeColor = '#123456';
|
|
32
|
-
var buttonColor = '#654321';
|
|
33
|
-
var phoneNumber = Math.floor(Math.random() * 100000).toString();
|
|
34
|
-
|
|
35
|
-
before(function (done) {
|
|
36
|
-
api.Clients.update({
|
|
37
|
-
PrimaryThemeColour: themeColor,
|
|
38
|
-
PrimaryButtonColour: buttonColor,
|
|
39
|
-
HeadquartersPhoneNumber: phoneNumber
|
|
40
|
-
})
|
|
41
|
-
.then(function (data) {
|
|
42
|
-
updatedClient = data;
|
|
43
|
-
done();
|
|
44
|
-
});
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
it("should have updated colors", function () {
|
|
48
|
-
expect(updatedClient.ClientId).not.to.be.undefined;
|
|
49
|
-
expect(updatedClient.PrimaryThemeColour).to.equal(themeColor);
|
|
50
|
-
expect(updatedClient.PrimaryButtonColour).to.equal(buttonColor);
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
it('should have update headquarters phone number', function () {
|
|
54
|
-
expect(updatedClient.HeadquartersPhoneNumber).to.equal(phoneNumber);
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
describe.skip("Upload Logo", function () {
|
|
60
|
-
var filePath = path.resolve(__dirname, '../TestKycPageFile.png');
|
|
61
|
-
var requestResponse;
|
|
62
|
-
before(function (done) {
|
|
63
|
-
api.Clients.uploadLogoFromFile(filePath, function (data, response) {
|
|
64
|
-
requestResponse = response;
|
|
65
|
-
done();
|
|
66
|
-
});
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
it('should be uploaded', function () {
|
|
70
|
-
expect(requestResponse.status).to.equal(204);
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
describe("Get client wallets by funds type", function () {
|
|
76
|
-
var feesWallets;
|
|
77
|
-
var creditWallets;
|
|
78
|
-
before(function (done) {
|
|
79
|
-
api.Clients.getClientWalletsByFundsType('FEES', function (data, response) {
|
|
80
|
-
feesWallets = data;
|
|
81
|
-
api.Clients.getClientWalletsByFundsType('CREDIT', function (data, response) {
|
|
82
|
-
creditWallets = data;
|
|
83
|
-
done();
|
|
84
|
-
});
|
|
85
|
-
});
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
it('should have wallets', function () {
|
|
89
|
-
expect(feesWallets).not.to.be.undefined;
|
|
90
|
-
expect(creditWallets).not.to.be.undefined;
|
|
91
|
-
})
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
describe("Get client wallet", function () {
|
|
95
|
-
var clientWallets;
|
|
96
|
-
var clientWallet;
|
|
97
|
-
before(function (done) {
|
|
98
|
-
api.Clients.getClientWallets(function (data, response) {
|
|
99
|
-
clientWallets = data;
|
|
100
|
-
api.Clients.getClientWallet(clientWallets[0].FundsType, clientWallets[0].Currency
|
|
101
|
-
, function (data, response) {
|
|
102
|
-
clientWallet = data;
|
|
103
|
-
done();
|
|
104
|
-
});
|
|
105
|
-
});
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
it('should get the same client wallet', function () {
|
|
109
|
-
expect(clientWallet).not.to.be.undefined;
|
|
110
|
-
expect(clientWallet.FundsType).to.equal(clientWallets[0].FundsType);
|
|
111
|
-
expect(clientWallet.Currency).to.equal(clientWallets[0].Currency);
|
|
112
|
-
});
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
describe("Get client wallet's transactions", function () {
|
|
116
|
-
var clientWallets;
|
|
117
|
-
var transactions;
|
|
118
|
-
before(function (done) {
|
|
119
|
-
api.Clients.getClientWallets(function (data, response) {
|
|
120
|
-
clientWallets = data;
|
|
121
|
-
api.Clients.getClientWalletTransactions(clientWallets[0].FundsType, clientWallets[0].Currency
|
|
122
|
-
, function (data, response) {
|
|
123
|
-
transactions = data;
|
|
124
|
-
done();
|
|
125
|
-
});
|
|
126
|
-
});
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
it('should get transactions', function () {
|
|
130
|
-
expect(transactions).not.to.be.undefined;
|
|
131
|
-
expect(transactions.length).to.be.greaterThan(0);
|
|
132
|
-
})
|
|
133
|
-
|
|
134
|
-
});
|
|
135
|
-
|
|
136
|
-
describe("Create BankAccountIBAN", function () {
|
|
137
|
-
var account = new BankAccount({
|
|
138
|
-
OwnerName: "Joe Blogs",
|
|
139
|
-
OwnerAddress: {
|
|
140
|
-
"AddressLine1": "1 Mangopay Street",
|
|
141
|
-
"AddressLine2": "The Loop",
|
|
142
|
-
"City": "Paris",
|
|
143
|
-
"Region": "Ile de France",
|
|
144
|
-
"PostalCode": "75001",
|
|
145
|
-
"Country": "FR"
|
|
146
|
-
},
|
|
147
|
-
Details: new BankAccountDetailsIBAN({
|
|
148
|
-
IBAN: "FR7630004000031234567890143",
|
|
149
|
-
BIC: "BNPAFRPP"
|
|
150
|
-
}),
|
|
151
|
-
Tag: "custom meta"
|
|
152
|
-
});
|
|
153
|
-
|
|
154
|
-
before(function (done) {
|
|
155
|
-
api.Clients.createBankAccountIBAN(account).then(function (data) {
|
|
156
|
-
createdBankAccount = data;
|
|
157
|
-
done();
|
|
158
|
-
});
|
|
159
|
-
});
|
|
160
|
-
|
|
161
|
-
it('should get the bank account', function () {
|
|
162
|
-
expect(createdBankAccount).not.to.be.undefined;
|
|
163
|
-
expect(createdBankAccount.Id).not.to.be.undefined;
|
|
164
|
-
});
|
|
165
|
-
});
|
|
166
|
-
|
|
167
|
-
describe("Create PayOut", function () {
|
|
168
|
-
var createdPayOut;
|
|
169
|
-
var clientWallets;
|
|
170
|
-
var clientWallet;
|
|
171
|
-
|
|
172
|
-
before(function (done) {
|
|
173
|
-
api.Clients.getClientWallets(function (data, response) {
|
|
174
|
-
clientWallets = data;
|
|
175
|
-
api.Clients.getClientWallet(clientWallets[0].FundsType, clientWallets[0].Currency
|
|
176
|
-
, function (data, response) {
|
|
177
|
-
clientWallet = data;
|
|
178
|
-
|
|
179
|
-
var payOut = new PayOut({
|
|
180
|
-
DebitedWalletId: clientWallet.Id,
|
|
181
|
-
PaymentType: 'BANK_WIRE',
|
|
182
|
-
MeanOfPaymentDetails: new PayOutPaymentDetailsBankWire({
|
|
183
|
-
BankAccountId: createdBankAccount.Id,
|
|
184
|
-
BankWireRef: 'invoice 7282',
|
|
185
|
-
PayoutModeRequested: 'STANDARD'
|
|
186
|
-
}),
|
|
187
|
-
DebitedFunds: {
|
|
188
|
-
"Currency": "EUR",
|
|
189
|
-
"Amount": 12
|
|
190
|
-
},
|
|
191
|
-
Tag: 'bla'
|
|
192
|
-
});
|
|
193
|
-
|
|
194
|
-
api.Clients.createPayOut(payOut).then(function (data) {
|
|
195
|
-
createdPayOut = data;
|
|
196
|
-
done();
|
|
197
|
-
});
|
|
198
|
-
});
|
|
199
|
-
});
|
|
200
|
-
});
|
|
201
|
-
|
|
202
|
-
it('should create the payout', function () {
|
|
203
|
-
console.log(createdPayOut);
|
|
204
|
-
expect(createdPayOut).not.to.be.undefined;
|
|
205
|
-
expect(createdPayOut.Id).not.to.be.undefined;
|
|
206
|
-
});
|
|
207
|
-
});
|
|
208
|
-
|
|
209
|
-
describe("Create PayIn BankWire Direct", function () {
|
|
210
|
-
var created;
|
|
211
|
-
|
|
212
|
-
before(function (done) {
|
|
213
|
-
const dto = {
|
|
214
|
-
"CreditedWalletId": "CREDIT_EUR",
|
|
215
|
-
"DeclaredDebitedFunds": {
|
|
216
|
-
"Currency": "EUR",
|
|
217
|
-
"Amount": 1000
|
|
218
|
-
}
|
|
219
|
-
};
|
|
220
|
-
api.Clients.createBankWireDirectPayIn(dto, function(data) {
|
|
221
|
-
created = data;
|
|
222
|
-
done();
|
|
223
|
-
});
|
|
224
|
-
});
|
|
225
|
-
|
|
226
|
-
it('should create the payin', function () {
|
|
227
|
-
expect(created).not.to.be.undefined;
|
|
228
|
-
expect(created.Id).not.to.be.undefined;
|
|
229
|
-
expect(created.Type).to.eq('PAYIN');
|
|
230
|
-
expect(created.Status).to.eq('CREATED');
|
|
231
|
-
expect(created.PaymentType).to.eq('BANK_WIRE');
|
|
232
|
-
expect(created.ExecutionType).to.eq('DIRECT');
|
|
233
|
-
});
|
|
234
|
-
});
|
|
235
|
-
});
|
|
@@ -1,319 +0,0 @@
|
|
|
1
|
-
var _ = require('underscore');
|
|
2
|
-
var expect = require('chai').expect;
|
|
3
|
-
var helpers = require('../helpers');
|
|
4
|
-
var api = require('../main');
|
|
5
|
-
const PayIn = require("../../lib/models/PayIn");
|
|
6
|
-
|
|
7
|
-
describe('Conversions', function () {
|
|
8
|
-
var john = helpers.data.getUserNatural();
|
|
9
|
-
var instantConversion;
|
|
10
|
-
var quotedConversion;
|
|
11
|
-
var quote;
|
|
12
|
-
|
|
13
|
-
before(function (done) {
|
|
14
|
-
api.Users.create(john, function () {
|
|
15
|
-
done();
|
|
16
|
-
});
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
describe('Create Quote', function () {
|
|
20
|
-
before(function (done) {
|
|
21
|
-
helpers.getNewQuote(api, function (data, response) {
|
|
22
|
-
quote = data;
|
|
23
|
-
done();
|
|
24
|
-
});
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
it('should be created', function () {
|
|
28
|
-
expect(quote.Id).not.to.be.null;
|
|
29
|
-
expect(quote.ExpirationDate).not.to.be.null;
|
|
30
|
-
expect(quote.Status).to.equal("ACTIVE");
|
|
31
|
-
expect(quote.MarginsResponse).not.to.be.null;
|
|
32
|
-
expect(quote.RequestedFees).not.to.be.null;
|
|
33
|
-
expect(quote.Fees.Amount).not.to.be.null;
|
|
34
|
-
});
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
describe('Get Quote', function () {
|
|
38
|
-
var fetchedQuote;
|
|
39
|
-
before(function (done) {
|
|
40
|
-
api.Conversions.getQuote(quote.Id, function (data, response) {
|
|
41
|
-
fetchedQuote = data;
|
|
42
|
-
done();
|
|
43
|
-
});
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
it('should be fetched', function () {
|
|
47
|
-
expect(fetchedQuote.Id).to.equal(quote.Id);
|
|
48
|
-
});
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
describe('Get Conversion Rate', function () {
|
|
52
|
-
var conversionRate;
|
|
53
|
-
|
|
54
|
-
before(function (done) {
|
|
55
|
-
api.Conversions.getConversionRate('EUR', 'GBP', function (data, response) {
|
|
56
|
-
conversionRate = data;
|
|
57
|
-
done();
|
|
58
|
-
});
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
it('should be retrieved', function () {
|
|
62
|
-
expect(conversionRate.ClientRate).not.to.be.null;
|
|
63
|
-
expect(conversionRate.MarketRate).not.to.be.null;
|
|
64
|
-
});
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
describe('Create Instant Conversion', function () {
|
|
68
|
-
before(function (done) {
|
|
69
|
-
var creditedWallet = {
|
|
70
|
-
Owners: [john.Id],
|
|
71
|
-
Currency: 'GBP',
|
|
72
|
-
Description: 'WALLET IN GBP'
|
|
73
|
-
};
|
|
74
|
-
var debitedWallet = {
|
|
75
|
-
Owners: [john.Id],
|
|
76
|
-
Currency: 'EUR',
|
|
77
|
-
Description: 'WALLET IN EUR'
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
api.Wallets.create(debitedWallet).then(function (data) {
|
|
81
|
-
api.Wallets.create(creditedWallet).then(function (data) {
|
|
82
|
-
helpers.getUserCardPreAuthorization(api, john, function(preauthorization, response){
|
|
83
|
-
var payIn = {
|
|
84
|
-
CreditedWalletId: debitedWallet.Id,
|
|
85
|
-
AuthorId: john.Id,
|
|
86
|
-
DebitedFunds: {
|
|
87
|
-
Amount: 1000,
|
|
88
|
-
Currency: 'EUR'
|
|
89
|
-
},
|
|
90
|
-
Fees: {
|
|
91
|
-
Amount: 0,
|
|
92
|
-
Currency: 'EUR'
|
|
93
|
-
},
|
|
94
|
-
CardId: preauthorization.CardId,
|
|
95
|
-
SecureModeReturnURL: 'http://test.com',
|
|
96
|
-
PaymentType: 'CARD',
|
|
97
|
-
ExecutionType: 'DIRECT',
|
|
98
|
-
Billing: {
|
|
99
|
-
FirstName: "John",
|
|
100
|
-
LastName: "Doe",
|
|
101
|
-
Address: {
|
|
102
|
-
"AddressLine1": "4101 Reservoir Rd NW",
|
|
103
|
-
"AddressLine2": "",
|
|
104
|
-
"City": "Washington",
|
|
105
|
-
"Region": "District of Columbia",
|
|
106
|
-
"PostalCode": "68400",
|
|
107
|
-
"Country": "US"
|
|
108
|
-
}
|
|
109
|
-
},
|
|
110
|
-
BrowserInfo: {
|
|
111
|
-
AcceptHeader: "text/html, application/xhtml+xml, application/xml;q=0.9, /;q=0.8",
|
|
112
|
-
JavaEnabled: true,
|
|
113
|
-
Language: "FR-FR",
|
|
114
|
-
ColorDepth: 4,
|
|
115
|
-
ScreenHeight: 1800,
|
|
116
|
-
ScreenWidth: 400,
|
|
117
|
-
JavascriptEnabled: true,
|
|
118
|
-
TimeZoneOffset: "+60",
|
|
119
|
-
UserAgent: "Mozilla/5.0 (iPhone; CPU iPhone OS 13_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148"
|
|
120
|
-
},
|
|
121
|
-
IpAddress: "2001:0620:0000:0000:0211:24FF:FE80:C12C",
|
|
122
|
-
};
|
|
123
|
-
api.PayIns.create(payIn, function () {
|
|
124
|
-
instantConversion = {
|
|
125
|
-
AuthorId: john.Id,
|
|
126
|
-
CreditedWalletId: creditedWallet.Id,
|
|
127
|
-
DebitedWalletId: debitedWallet.Id,
|
|
128
|
-
CreditedFunds: {
|
|
129
|
-
Currency: 'GBP'
|
|
130
|
-
},
|
|
131
|
-
DebitedFunds: {
|
|
132
|
-
Currency: 'EUR',
|
|
133
|
-
Amount: 79
|
|
134
|
-
},
|
|
135
|
-
Fees: {
|
|
136
|
-
Currency: 'EUR',
|
|
137
|
-
Type: 'PERCENTAGE',
|
|
138
|
-
Value: 0.01
|
|
139
|
-
},
|
|
140
|
-
Tag: 'Instant conversion test'
|
|
141
|
-
};
|
|
142
|
-
api.Conversions.createInstantConversion(instantConversion, function (data, response) {
|
|
143
|
-
instantConversion = data;
|
|
144
|
-
done();
|
|
145
|
-
});
|
|
146
|
-
});
|
|
147
|
-
});
|
|
148
|
-
});
|
|
149
|
-
});
|
|
150
|
-
});
|
|
151
|
-
|
|
152
|
-
it('should be created', function () {
|
|
153
|
-
expect(instantConversion.DebitedFunds.Amount).not.to.be.null;
|
|
154
|
-
expect(instantConversion.CreditedFunds.Amount).not.to.be.null;
|
|
155
|
-
expect(instantConversion.Status).to.equal('SUCCEEDED');
|
|
156
|
-
expect(instantConversion.MarginsResponse).not.to.be.null;
|
|
157
|
-
expect(instantConversion.RequestedFees).not.to.be.null;
|
|
158
|
-
expect(instantConversion.Fees.Amount).not.to.be.null;
|
|
159
|
-
});
|
|
160
|
-
});
|
|
161
|
-
|
|
162
|
-
describe('Create Quoted Conversion', function () {
|
|
163
|
-
before(function (done) {
|
|
164
|
-
var creditedWallet = {
|
|
165
|
-
Owners: [john.Id],
|
|
166
|
-
Currency: 'GBP',
|
|
167
|
-
Description: 'WALLET IN GBP'
|
|
168
|
-
};
|
|
169
|
-
var debitedWallet = {
|
|
170
|
-
Owners: [john.Id],
|
|
171
|
-
Currency: 'EUR',
|
|
172
|
-
Description: 'WALLET IN EUR'
|
|
173
|
-
};
|
|
174
|
-
|
|
175
|
-
api.Wallets.create(debitedWallet).then(function (data) {
|
|
176
|
-
api.Wallets.create(creditedWallet).then(function (data) {
|
|
177
|
-
helpers.getUserCardPreAuthorization(api, john, function(preauthorization, response){
|
|
178
|
-
var payIn = {
|
|
179
|
-
CreditedWalletId: debitedWallet.Id,
|
|
180
|
-
AuthorId: john.Id,
|
|
181
|
-
DebitedFunds: {
|
|
182
|
-
Amount: 1000,
|
|
183
|
-
Currency: 'EUR'
|
|
184
|
-
},
|
|
185
|
-
Fees: {
|
|
186
|
-
Amount: 0,
|
|
187
|
-
Currency: 'EUR'
|
|
188
|
-
},
|
|
189
|
-
CardId: preauthorization.CardId,
|
|
190
|
-
SecureModeReturnURL: 'http://test.com',
|
|
191
|
-
PaymentType: 'CARD',
|
|
192
|
-
ExecutionType: 'DIRECT',
|
|
193
|
-
Billing: {
|
|
194
|
-
FirstName: "John",
|
|
195
|
-
LastName: "Doe",
|
|
196
|
-
Address: {
|
|
197
|
-
"AddressLine1": "4101 Reservoir Rd NW",
|
|
198
|
-
"AddressLine2": "",
|
|
199
|
-
"City": "Washington",
|
|
200
|
-
"Region": "District of Columbia",
|
|
201
|
-
"PostalCode": "68400",
|
|
202
|
-
"Country": "US"
|
|
203
|
-
}
|
|
204
|
-
},
|
|
205
|
-
BrowserInfo: {
|
|
206
|
-
AcceptHeader: "text/html, application/xhtml+xml, application/xml;q=0.9, /;q=0.8",
|
|
207
|
-
JavaEnabled: true,
|
|
208
|
-
Language: "FR-FR",
|
|
209
|
-
ColorDepth: 4,
|
|
210
|
-
ScreenHeight: 1800,
|
|
211
|
-
ScreenWidth: 400,
|
|
212
|
-
JavascriptEnabled: true,
|
|
213
|
-
TimeZoneOffset: "+60",
|
|
214
|
-
UserAgent: "Mozilla/5.0 (iPhone; CPU iPhone OS 13_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148"
|
|
215
|
-
},
|
|
216
|
-
IpAddress: "2001:0620:0000:0000:0211:24FF:FE80:C12C",
|
|
217
|
-
};
|
|
218
|
-
api.PayIns.create(payIn, function () {
|
|
219
|
-
helpers.getNewQuote(api, function (data, response) {
|
|
220
|
-
quote = data;
|
|
221
|
-
|
|
222
|
-
var quotedConversionBody = {
|
|
223
|
-
QuoteId: quote.Id,
|
|
224
|
-
AuthorId: john.Id,
|
|
225
|
-
CreditedWalletId: creditedWallet.Id,
|
|
226
|
-
DebitedWalletId: debitedWallet.Id,
|
|
227
|
-
Tag: 'Quoted conversion test'
|
|
228
|
-
};
|
|
229
|
-
|
|
230
|
-
api.Conversions.createQuotedConversion(quotedConversionBody, function (data, response) {
|
|
231
|
-
quotedConversion = data;
|
|
232
|
-
done();
|
|
233
|
-
});
|
|
234
|
-
});
|
|
235
|
-
});
|
|
236
|
-
});
|
|
237
|
-
});
|
|
238
|
-
});
|
|
239
|
-
});
|
|
240
|
-
|
|
241
|
-
it('should be created', function () {
|
|
242
|
-
expect(quotedConversion.Id).not.to.be.null;
|
|
243
|
-
expect(quotedConversion.QuoteId).not.to.be.null;
|
|
244
|
-
expect(quotedConversion.Status).to.equal('SUCCEEDED');
|
|
245
|
-
});
|
|
246
|
-
});
|
|
247
|
-
|
|
248
|
-
describe('Create Client Wallets Quoted Conversion', function () {
|
|
249
|
-
var created;
|
|
250
|
-
before(function (done) {
|
|
251
|
-
helpers.getNewQuoteWithoutFees(api, function (data, response) {
|
|
252
|
-
quote = data;
|
|
253
|
-
|
|
254
|
-
var body = {
|
|
255
|
-
QuoteId: quote.Id,
|
|
256
|
-
CreditedWalletType: "CREDIT",
|
|
257
|
-
DebitedWalletType: "FEES"
|
|
258
|
-
};
|
|
259
|
-
|
|
260
|
-
api.Conversions.createClientWalletsQuotedConversion(body, function (data, response) {
|
|
261
|
-
created = data;
|
|
262
|
-
done();
|
|
263
|
-
});
|
|
264
|
-
});
|
|
265
|
-
});
|
|
266
|
-
|
|
267
|
-
it('should be created', function () {
|
|
268
|
-
expect(created.Id).not.to.be.null;
|
|
269
|
-
expect(created.QuoteId).not.to.be.null;
|
|
270
|
-
expect(created.Status).to.equal('SUCCEEDED');
|
|
271
|
-
});
|
|
272
|
-
});
|
|
273
|
-
|
|
274
|
-
describe('Create Client Wallets Instant Conversion', function () {
|
|
275
|
-
var created;
|
|
276
|
-
before(function (done) {
|
|
277
|
-
var body = {
|
|
278
|
-
CreditedWalletType: "FEES",
|
|
279
|
-
DebitedWalletType: "FEES",
|
|
280
|
-
CreditedFunds: {
|
|
281
|
-
Currency: 'GBP'
|
|
282
|
-
},
|
|
283
|
-
DebitedFunds: {
|
|
284
|
-
Currency: 'EUR',
|
|
285
|
-
Amount: 79
|
|
286
|
-
}
|
|
287
|
-
};
|
|
288
|
-
|
|
289
|
-
api.Conversions.createClientWalletsInstantConversion(body, function (data, response) {
|
|
290
|
-
created = data;
|
|
291
|
-
done();
|
|
292
|
-
});
|
|
293
|
-
});
|
|
294
|
-
|
|
295
|
-
it('should be created', function () {
|
|
296
|
-
expect(created.Id).not.to.be.null;
|
|
297
|
-
expect(created.Status).to.equal('SUCCEEDED');
|
|
298
|
-
});
|
|
299
|
-
});
|
|
300
|
-
|
|
301
|
-
describe('Get Conversion', function () {
|
|
302
|
-
var fetchedConversion;
|
|
303
|
-
|
|
304
|
-
before(function (done) {
|
|
305
|
-
api.Conversions.getConversion(instantConversion.Id, function (data, response) {
|
|
306
|
-
fetchedConversion = data;
|
|
307
|
-
done();
|
|
308
|
-
});
|
|
309
|
-
});
|
|
310
|
-
|
|
311
|
-
it('should be created', function () {
|
|
312
|
-
expect(fetchedConversion.DebitedFunds.Amount).not.to.be.null;
|
|
313
|
-
expect(fetchedConversion.CreditedFunds.Amount).not.to.be.null;
|
|
314
|
-
expect(fetchedConversion.Status).to.equal('SUCCEEDED');
|
|
315
|
-
expect(fetchedConversion.Id).to.equal(instantConversion.Id);
|
|
316
|
-
});
|
|
317
|
-
});
|
|
318
|
-
|
|
319
|
-
});
|
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
var _ = require('underscore');
|
|
2
|
-
var expect = require('chai').expect;
|
|
3
|
-
var helpers = require('../helpers');
|
|
4
|
-
var api = require('../main');
|
|
5
|
-
|
|
6
|
-
describe('Deposits', function () {
|
|
7
|
-
var deposit;
|
|
8
|
-
|
|
9
|
-
before(function (done) {
|
|
10
|
-
helpers.createNewDeposit(function (data, response) {
|
|
11
|
-
deposit = data;
|
|
12
|
-
done();
|
|
13
|
-
});
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
describe('Create', function () {
|
|
17
|
-
it('should be created', function () {
|
|
18
|
-
expect(deposit).not.to.be.undefined;
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
it('check card info', function () {
|
|
22
|
-
expect(deposit.CardInfo).not.to.be.undefined;
|
|
23
|
-
expect(deposit.CardInfo.Type).not.to.be.undefined;
|
|
24
|
-
expect(deposit.CardInfo.Brand).not.to.be.undefined;
|
|
25
|
-
expect(deposit.CardInfo.IssuerCountryCode).not.to.be.undefined;
|
|
26
|
-
expect(deposit.CardInfo.BIN).not.to.be.undefined;
|
|
27
|
-
});
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
describe('Get', function () {
|
|
31
|
-
var fetchedDeposit;
|
|
32
|
-
|
|
33
|
-
before(function (done) {
|
|
34
|
-
api.Deposits.get(deposit.Id, function (data, response) {
|
|
35
|
-
fetchedDeposit = data;
|
|
36
|
-
done();
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
it('should be fetched', function () {
|
|
41
|
-
expect(fetchedDeposit).not.to.be.undefined;
|
|
42
|
-
expect(fetchedDeposit.Id).to.equal(deposit.Id);
|
|
43
|
-
});
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
describe('Get all for card', function () {
|
|
47
|
-
var result;
|
|
48
|
-
|
|
49
|
-
before(function (done) {
|
|
50
|
-
api.Deposits.getAllForCard(deposit.CardId, function (data, response) {
|
|
51
|
-
result = data;
|
|
52
|
-
done();
|
|
53
|
-
});
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
it('should be fetched', function () {
|
|
57
|
-
expect(result).to.be.an('array');
|
|
58
|
-
expect(result.length).to.be.above(0);
|
|
59
|
-
});
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
describe('Get all for user', function () {
|
|
63
|
-
var result;
|
|
64
|
-
|
|
65
|
-
before(function (done) {
|
|
66
|
-
api.Deposits.getAllForUser(deposit.AuthorId, function (data, response) {
|
|
67
|
-
result = data;
|
|
68
|
-
done();
|
|
69
|
-
});
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
it('should be fetched', function () {
|
|
73
|
-
expect(result).to.be.an('array');
|
|
74
|
-
expect(result.length).to.be.above(0);
|
|
75
|
-
});
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
// describe('Cancel', function () {
|
|
79
|
-
// var deposit;
|
|
80
|
-
// var fetchedDeposit;
|
|
81
|
-
//
|
|
82
|
-
// before(function (done) {
|
|
83
|
-
// helpers.createNewDeposit(function (data, response) {
|
|
84
|
-
// deposit = data;
|
|
85
|
-
//
|
|
86
|
-
// api.Deposits.cancel(deposit.Id, function (data, response) {
|
|
87
|
-
// api.Deposits.get(deposit.Id, function (data, response) {
|
|
88
|
-
// fetchedDeposit = data;
|
|
89
|
-
// done();
|
|
90
|
-
// });
|
|
91
|
-
// });
|
|
92
|
-
// });
|
|
93
|
-
// });
|
|
94
|
-
//
|
|
95
|
-
// it('should be canceled', function () {
|
|
96
|
-
// console.log(fetchedDeposit);
|
|
97
|
-
// expect(fetchedDeposit).not.to.be.undefined;
|
|
98
|
-
// expect(fetchedDeposit.PaymentStatus).to.equal('CANCELED');
|
|
99
|
-
// });
|
|
100
|
-
// });
|
|
101
|
-
|
|
102
|
-
describe('Get Transactions', function () {
|
|
103
|
-
var result;
|
|
104
|
-
var deposit;
|
|
105
|
-
|
|
106
|
-
before(function (done) {
|
|
107
|
-
helpers.createNewDeposit(function (data, response) {
|
|
108
|
-
deposit = data;
|
|
109
|
-
var wallet = {
|
|
110
|
-
Owners: [deposit.AuthorId],
|
|
111
|
-
Currency: 'EUR',
|
|
112
|
-
Description: 'WALLET IN EUR'
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
api.Wallets.create(wallet).then(function(data) {
|
|
116
|
-
var payInDto = {
|
|
117
|
-
AuthorId: deposit.AuthorId,
|
|
118
|
-
CreditedWalletId: wallet.Id,
|
|
119
|
-
DebitedFunds: {
|
|
120
|
-
Currency: 'EUR',
|
|
121
|
-
Amount: 1000
|
|
122
|
-
},
|
|
123
|
-
Fees: {
|
|
124
|
-
Currency: 'EUR',
|
|
125
|
-
Amount: 0
|
|
126
|
-
},
|
|
127
|
-
DepositId: deposit.Id
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
api.PayIns.createDepositPreauthorizedPayInPriorToComplement(payInDto).then(async function (data) {
|
|
131
|
-
// wait 2 seconds for the transactions to be created by the API
|
|
132
|
-
const delay = ms => new Promise(resolve => setTimeout(resolve, ms));
|
|
133
|
-
await delay(2000);
|
|
134
|
-
api.Deposits.getTransactions(deposit.Id, function (data, response) {
|
|
135
|
-
result = data;
|
|
136
|
-
done();
|
|
137
|
-
});
|
|
138
|
-
});
|
|
139
|
-
});
|
|
140
|
-
});
|
|
141
|
-
});
|
|
142
|
-
|
|
143
|
-
it('should be fetched', function () {
|
|
144
|
-
expect(result).to.be.an('array');
|
|
145
|
-
expect(result.length).to.be.above(0);
|
|
146
|
-
});
|
|
147
|
-
});
|
|
148
|
-
});
|