mangopay4-nodejs-sdk 1.66.1 → 1.68.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 +15 -0
- package/README.md +78 -1
- package/lib/api.js +31 -2
- package/lib/apiMethods.js +10 -3
- package/lib/config.js +14 -1
- 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 +1 -1
- package/test/helpers.js +3 -2
- package/test/services/Acquiring.js +338 -0
- package/test/services/Conversions.js +1 -1
- package/test/services/Idempotency.js +1 -6
- package/test/services/PayIns.js +2 -123
- package/test/services/RateLimit.js +1 -6
- package/test/services/UboDeclarations.js +1 -6
- package/typings/base.d.ts +41 -0
- package/typings/enums.d.ts +0 -1
- package/typings/index.d.ts +5 -5
- package/typings/index.test-d.ts +19 -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/lib/models/PayInPaymentDetailsPayconiq.js +0 -23
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
const expect = require('chai').expect;
|
|
2
|
+
|
|
3
|
+
const mangopay = require('../../index');
|
|
4
|
+
|
|
5
|
+
// const api = global.api = new mangopay({
|
|
6
|
+
// clientId: 'placeholder',
|
|
7
|
+
// clientApiKey: 'placeholder'
|
|
8
|
+
// });
|
|
9
|
+
|
|
10
|
+
const cardId = 'placeholder';
|
|
11
|
+
|
|
12
|
+
describe.skip('Acquiring', function () {
|
|
13
|
+
describe('PayIn Card Direct', function () {
|
|
14
|
+
let payIn;
|
|
15
|
+
|
|
16
|
+
before(function (done) {
|
|
17
|
+
const dto = {
|
|
18
|
+
DebitedFunds: {
|
|
19
|
+
Amount: 100,
|
|
20
|
+
Currency: 'EUR'
|
|
21
|
+
},
|
|
22
|
+
IpAddress: '2001:0620:0000:0000:0211:24FF:FE80:C12C',
|
|
23
|
+
BrowserInfo: {
|
|
24
|
+
AcceptHeader: "text/html, application/xhtml+xml, application/xml;q=0.9, /;q=0.8",
|
|
25
|
+
JavaEnabled: true,
|
|
26
|
+
Language: "FR-FR",
|
|
27
|
+
ColorDepth: 4,
|
|
28
|
+
ScreenHeight: 1800,
|
|
29
|
+
ScreenWidth: 400,
|
|
30
|
+
JavascriptEnabled: true,
|
|
31
|
+
TimeZoneOffset: "+60",
|
|
32
|
+
UserAgent: "Mozilla/5.0 (iPhone; CPU iPhone OS 13_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148"
|
|
33
|
+
},
|
|
34
|
+
CardId: cardId,
|
|
35
|
+
SecureMode: 'DEFAULT',
|
|
36
|
+
SecureModeReturnURL: 'http://test.com',
|
|
37
|
+
PaymentType: 'CARD',
|
|
38
|
+
ExecutionType: 'DIRECT'
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
api.Acquiring.createPayIn(dto, function (response) {
|
|
42
|
+
payIn = response;
|
|
43
|
+
done();
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it('should create the PayIn', function () {
|
|
48
|
+
expect(payIn).not.to.be.undefined;
|
|
49
|
+
expect(payIn.PaymentType).to.equal('CARD');
|
|
50
|
+
expect(payIn.ExecutionType).to.equal('DIRECT');
|
|
51
|
+
expect(payIn.Status).to.equal('SUCCEEDED');
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
describe('PayIn Ideal Web', function () {
|
|
56
|
+
let payIn;
|
|
57
|
+
|
|
58
|
+
before(function (done) {
|
|
59
|
+
const dto = {
|
|
60
|
+
DebitedFunds: {
|
|
61
|
+
Amount: 100,
|
|
62
|
+
Currency: 'EUR'
|
|
63
|
+
},
|
|
64
|
+
ReturnURL: 'http://test.com',
|
|
65
|
+
PaymentType: 'IDEAL',
|
|
66
|
+
ExecutionType: 'WEB'
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
api.Acquiring.createPayIn(dto, function (response) {
|
|
70
|
+
payIn = response;
|
|
71
|
+
done();
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
it('should create the PayIn', function () {
|
|
76
|
+
expect(payIn).not.to.be.undefined;
|
|
77
|
+
expect(payIn.PaymentType).to.equal('IDEAL');
|
|
78
|
+
expect(payIn.ExecutionType).to.equal('WEB');
|
|
79
|
+
expect(payIn.Status).to.equal('CREATED');
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
describe('PayIn ApplePay Direct', function () {
|
|
84
|
+
let payIn;
|
|
85
|
+
|
|
86
|
+
before(function (done) {
|
|
87
|
+
const dto = {
|
|
88
|
+
DebitedFunds: {
|
|
89
|
+
Amount: 100,
|
|
90
|
+
Currency: 'EUR'
|
|
91
|
+
},
|
|
92
|
+
PaymentData: {},
|
|
93
|
+
PaymentType: 'APPLEPAY',
|
|
94
|
+
ExecutionType: 'DIRECT'
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
api.Acquiring.createPayIn(dto, function (response) {
|
|
98
|
+
payIn = response;
|
|
99
|
+
done();
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
it('should create the PayIn', function () {
|
|
104
|
+
expect(payIn).not.to.be.undefined;
|
|
105
|
+
expect(payIn.PaymentType).to.equal('APPLEPAY');
|
|
106
|
+
expect(payIn.ExecutionType).to.equal('DIRECT');
|
|
107
|
+
expect(payIn.Status).to.equal('CREATED');
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
describe('PayIn GooglePay Direct', function () {
|
|
112
|
+
let payIn;
|
|
113
|
+
|
|
114
|
+
before(function (done) {
|
|
115
|
+
const dto = {
|
|
116
|
+
DebitedFunds: {
|
|
117
|
+
Amount: 100,
|
|
118
|
+
Currency: 'EUR'
|
|
119
|
+
},
|
|
120
|
+
IpAddress: '2001:0620:0000:0000:0211:24FF:FE80:C12C',
|
|
121
|
+
BrowserInfo: {
|
|
122
|
+
AcceptHeader: "text/html, application/xhtml+xml, application/xml;q=0.9, /;q=0.8",
|
|
123
|
+
JavaEnabled: true,
|
|
124
|
+
Language: "FR-FR",
|
|
125
|
+
ColorDepth: 4,
|
|
126
|
+
ScreenHeight: 1800,
|
|
127
|
+
ScreenWidth: 400,
|
|
128
|
+
JavascriptEnabled: true,
|
|
129
|
+
TimeZoneOffset: "+60",
|
|
130
|
+
UserAgent: "Mozilla/5.0 (iPhone; CPU iPhone OS 13_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148"
|
|
131
|
+
},
|
|
132
|
+
SecureModeReturnURL: 'http://test.com',
|
|
133
|
+
PaymentData: "",
|
|
134
|
+
PaymentType: 'GOOGLE_PAY',
|
|
135
|
+
ExecutionType: 'DIRECT'
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
api.Acquiring.createPayIn(dto, function (response) {
|
|
139
|
+
payIn = response;
|
|
140
|
+
done();
|
|
141
|
+
});
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
it('should create the PayIn', function () {
|
|
145
|
+
expect(payIn).not.to.be.undefined;
|
|
146
|
+
expect(payIn.PaymentType).to.equal('GOOGLE_PAY');
|
|
147
|
+
expect(payIn.ExecutionType).to.equal('DIRECT');
|
|
148
|
+
expect(payIn.Status).to.equal('CREATED');
|
|
149
|
+
});
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
describe('PayIn PayPal Web', function () {
|
|
153
|
+
let payIn;
|
|
154
|
+
|
|
155
|
+
before(function (done) {
|
|
156
|
+
const dto = {
|
|
157
|
+
DebitedFunds: {
|
|
158
|
+
Amount: 100,
|
|
159
|
+
Currency: 'EUR'
|
|
160
|
+
},
|
|
161
|
+
LineItems: [
|
|
162
|
+
{
|
|
163
|
+
Name: "running shoes",
|
|
164
|
+
Quantity: 1,
|
|
165
|
+
UnitAmount: 100,
|
|
166
|
+
TaxAmount: 0,
|
|
167
|
+
Description: "seller1 ID"
|
|
168
|
+
}
|
|
169
|
+
],
|
|
170
|
+
ReturnURL: 'https://mangopay.com',
|
|
171
|
+
PaymentType: 'PAYPAL',
|
|
172
|
+
ExecutionType: 'WEB'
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
api.Acquiring.createPayIn(dto, function (response) {
|
|
176
|
+
payIn = response;
|
|
177
|
+
done();
|
|
178
|
+
});
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
it('should create the PayIn', function () {
|
|
182
|
+
expect(payIn).not.to.be.undefined;
|
|
183
|
+
expect(payIn.PaymentType).to.equal('PAYPAL');
|
|
184
|
+
expect(payIn.ExecutionType).to.equal('WEB');
|
|
185
|
+
expect(payIn.Status).to.equal('CREATED');
|
|
186
|
+
});
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
describe('PayPal DataCollection', function () {
|
|
190
|
+
let dataCollection;
|
|
191
|
+
|
|
192
|
+
before(function (done) {
|
|
193
|
+
const dto = {
|
|
194
|
+
"sender_account_id" : "A12345N343",
|
|
195
|
+
"sender_first_name" : "Jane",
|
|
196
|
+
"sender_last_name" : "Doe",
|
|
197
|
+
"sender_email" : "jane.doe@sample.com",
|
|
198
|
+
"sender_phone" : "(042) 1123 4567",
|
|
199
|
+
"sender_address_zip" : "75009",
|
|
200
|
+
"sender_country_code" : "FR",
|
|
201
|
+
"sender_create_date" : "2012-12-09T19:14:55.277-0:00",
|
|
202
|
+
"sender_signup_ip" : "10.220.90.20",
|
|
203
|
+
"sender_popularity_score" : "high",
|
|
204
|
+
"receiver_account_id" : "A12345N344",
|
|
205
|
+
"receiver_create_date" : "2012-12-09T19:14:55.277-0:00",
|
|
206
|
+
"receiver_email" : "jane@sample.com",
|
|
207
|
+
"receiver_address_country_code" : "FR",
|
|
208
|
+
"business_name" : "Jane Ltd",
|
|
209
|
+
"recipient_popularity_score" : "high",
|
|
210
|
+
"first_interaction_date" : "2012-12-09T19:14:55.277-0:00",
|
|
211
|
+
"txn_count_total" : "34",
|
|
212
|
+
"vertical" : "Household goods",
|
|
213
|
+
"transaction_is_tangible" : "0"
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
api.Acquiring.createPayPalDataCollection(dto, function (response) {
|
|
217
|
+
dataCollection = response;
|
|
218
|
+
done();
|
|
219
|
+
});
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
it('should create the PayIn', function () {
|
|
223
|
+
expect(dataCollection).not.to.be.undefined;
|
|
224
|
+
expect(dataCollection.dataCollectionId).not.to.be.undefined;
|
|
225
|
+
});
|
|
226
|
+
});
|
|
227
|
+
|
|
228
|
+
describe('PayIn Refund', function () {
|
|
229
|
+
let refund;
|
|
230
|
+
|
|
231
|
+
before(function (done) {
|
|
232
|
+
const payInDto = {
|
|
233
|
+
DebitedFunds: {
|
|
234
|
+
Amount: 100,
|
|
235
|
+
Currency: 'EUR'
|
|
236
|
+
},
|
|
237
|
+
IpAddress: '2001:0620:0000:0000:0211:24FF:FE80:C12C',
|
|
238
|
+
BrowserInfo: {
|
|
239
|
+
AcceptHeader: "text/html, application/xhtml+xml, application/xml;q=0.9, /;q=0.8",
|
|
240
|
+
JavaEnabled: true,
|
|
241
|
+
Language: "FR-FR",
|
|
242
|
+
ColorDepth: 4,
|
|
243
|
+
ScreenHeight: 1800,
|
|
244
|
+
ScreenWidth: 400,
|
|
245
|
+
JavascriptEnabled: true,
|
|
246
|
+
TimeZoneOffset: "+60",
|
|
247
|
+
UserAgent: "Mozilla/5.0 (iPhone; CPU iPhone OS 13_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148"
|
|
248
|
+
},
|
|
249
|
+
CardId: cardId,
|
|
250
|
+
SecureMode: 'DEFAULT',
|
|
251
|
+
SecureModeReturnURL: 'http://test.com',
|
|
252
|
+
PaymentType: 'CARD',
|
|
253
|
+
ExecutionType: 'DIRECT'
|
|
254
|
+
};
|
|
255
|
+
|
|
256
|
+
api.Acquiring.createPayIn(payInDto, function (createdPayIn) {
|
|
257
|
+
const refundDto = {
|
|
258
|
+
DebitedFunds: {
|
|
259
|
+
Amount: 100,
|
|
260
|
+
Currency: 'EUR'
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
api.Acquiring.createPayInRefund(createdPayIn.Id, refundDto, function (response) {
|
|
264
|
+
refund = response;
|
|
265
|
+
done();
|
|
266
|
+
});
|
|
267
|
+
});
|
|
268
|
+
});
|
|
269
|
+
|
|
270
|
+
it('should create the PayIn', function () {
|
|
271
|
+
expect(refund).not.to.be.undefined;
|
|
272
|
+
expect(refund.Type).to.equal('PAYOUT');
|
|
273
|
+
expect(refund.Nature).to.equal('REFUND');
|
|
274
|
+
expect(refund.Status).to.equal('SUCCEEDED');
|
|
275
|
+
});
|
|
276
|
+
});
|
|
277
|
+
|
|
278
|
+
describe('Card Validation', function () {
|
|
279
|
+
let cardValidation;
|
|
280
|
+
|
|
281
|
+
before(function (done) {
|
|
282
|
+
const dto = {
|
|
283
|
+
SecureModeReturnURL: "http://example.com",
|
|
284
|
+
IpAddress: "2001:0620:0000:0000:0211:24FF:FE80:C12C",
|
|
285
|
+
BrowserInfo: {
|
|
286
|
+
AcceptHeader: "text/html, application/xhtml+xml, application/xml;q=0.9, /;q=0.8",
|
|
287
|
+
ColorDepth: 4,
|
|
288
|
+
JavaEnabled: true,
|
|
289
|
+
JavascriptEnabled: true,
|
|
290
|
+
Language: 'FR-FR',
|
|
291
|
+
ScreenHeight: 1800,
|
|
292
|
+
ScreenWidth: 400,
|
|
293
|
+
TimeZoneOffset: "+60",
|
|
294
|
+
UserAgent: "Mozilla/5.0 (iPhone; CPU iPhone OS 13_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148"
|
|
295
|
+
}
|
|
296
|
+
};
|
|
297
|
+
|
|
298
|
+
api.Acquiring.createCardValidation(cardId, dto, function (response) {
|
|
299
|
+
cardValidation = response;
|
|
300
|
+
done();
|
|
301
|
+
});
|
|
302
|
+
});
|
|
303
|
+
|
|
304
|
+
it('should create the PayIn', function () {
|
|
305
|
+
expect(cardValidation).to.not.be.undefined;
|
|
306
|
+
expect(cardValidation.Id).to.not.be.undefined;
|
|
307
|
+
expect(cardValidation.Type).to.equal("CARD_VALIDATION");
|
|
308
|
+
});
|
|
309
|
+
});
|
|
310
|
+
|
|
311
|
+
describe('Settlement Report', function () {
|
|
312
|
+
let report;
|
|
313
|
+
|
|
314
|
+
before(function (done) {
|
|
315
|
+
const dto = {
|
|
316
|
+
DownloadFormat: "CSV",
|
|
317
|
+
ReportType: "ACQUIRING_SETTLEMENT",
|
|
318
|
+
AfterDate: 1740787200,
|
|
319
|
+
BeforeDate: 1743544740,
|
|
320
|
+
Filters: {
|
|
321
|
+
SettlementId: "placeholder"
|
|
322
|
+
}
|
|
323
|
+
};
|
|
324
|
+
|
|
325
|
+
api.ReportsV2.create(dto, function (response) {
|
|
326
|
+
report = response;
|
|
327
|
+
done();
|
|
328
|
+
});
|
|
329
|
+
});
|
|
330
|
+
|
|
331
|
+
it('should create the PayIn', function () {
|
|
332
|
+
expect(report.Id).to.exist;
|
|
333
|
+
expect(report.ReportType).to.equal("ACQUIRING_SETTLEMENT");
|
|
334
|
+
expect(report.DownloadFormat).to.equal("CSV");
|
|
335
|
+
expect(report.Status).to.equal("PENDING");
|
|
336
|
+
});
|
|
337
|
+
});
|
|
338
|
+
});
|
|
@@ -2,12 +2,7 @@ var expect = require('chai').expect;
|
|
|
2
2
|
var api = require('../main');
|
|
3
3
|
|
|
4
4
|
var helpers = require('../helpers');
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
var api = global.api = new mangopay({
|
|
8
|
-
clientId: 'sdk-unit-tests',
|
|
9
|
-
clientApiKey: 'cqFfFrWfCcb7UadHNxx2C9Lo6Djw8ZduLi7J9USTmu8bhxxpju'
|
|
10
|
-
});
|
|
5
|
+
var api = require('../main');
|
|
11
6
|
|
|
12
7
|
describe('Idempotency', function () {
|
|
13
8
|
var idempotencyKey = helpers.generateRandomString();
|
package/test/services/PayIns.js
CHANGED
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
var expect = require('chai').expect;
|
|
2
2
|
|
|
3
3
|
var helpers = require('../helpers');
|
|
4
|
-
var
|
|
5
|
-
|
|
6
|
-
var api = global.api = new mangopay({
|
|
7
|
-
clientId: 'sdk-unit-tests',
|
|
8
|
-
clientApiKey: 'cqFfFrWfCcb7UadHNxx2C9Lo6Djw8ZduLi7J9USTmu8bhxxpju'
|
|
9
|
-
});
|
|
4
|
+
var api = require('../main');
|
|
10
5
|
|
|
11
6
|
describe('PayIns', function () {
|
|
12
7
|
var payIn;
|
|
@@ -1082,123 +1077,6 @@ describe('PayIns', function () {
|
|
|
1082
1077
|
});
|
|
1083
1078
|
});
|
|
1084
1079
|
|
|
1085
|
-
// endpoint removed
|
|
1086
|
-
describe.skip('Payconiq Web', function () {
|
|
1087
|
-
var payIn, wallet;
|
|
1088
|
-
|
|
1089
|
-
before(function (done) {
|
|
1090
|
-
wallet = {
|
|
1091
|
-
Owners: [john.Id],
|
|
1092
|
-
Currency: 'EUR',
|
|
1093
|
-
Description: 'WALLET IN EUR'
|
|
1094
|
-
};
|
|
1095
|
-
|
|
1096
|
-
api.Wallets.create(wallet).then(function () {
|
|
1097
|
-
payIn = {
|
|
1098
|
-
Tag: 'custom meta',
|
|
1099
|
-
CreditedWalletId: wallet.Id,
|
|
1100
|
-
AuthorId: john.Id,
|
|
1101
|
-
DebitedFunds: {
|
|
1102
|
-
Amount: 1000,
|
|
1103
|
-
Currency: 'EUR'
|
|
1104
|
-
},
|
|
1105
|
-
Fees: {
|
|
1106
|
-
Amount: 0,
|
|
1107
|
-
Currency: 'EUR'
|
|
1108
|
-
},
|
|
1109
|
-
PaymentType: 'PAYCONIQ',
|
|
1110
|
-
ExecutionType: 'WEB',
|
|
1111
|
-
ReturnURL: 'http://www.my-site.com/returnURL',
|
|
1112
|
-
Country: 'BE'
|
|
1113
|
-
};
|
|
1114
|
-
|
|
1115
|
-
api.PayIns.create(payIn, function (data, response) {
|
|
1116
|
-
payIn = data;
|
|
1117
|
-
done();
|
|
1118
|
-
});
|
|
1119
|
-
});
|
|
1120
|
-
});
|
|
1121
|
-
|
|
1122
|
-
describe('Create', function () {
|
|
1123
|
-
it('should create the PayIn', function () {
|
|
1124
|
-
expect(payIn.Id).not.to.be.undefined;
|
|
1125
|
-
expect(payIn.PaymentType).to.equal('PAYCONIQ');
|
|
1126
|
-
expect(payIn.ExecutionType).to.equal('WEB');
|
|
1127
|
-
expect(payIn.Status).to.equal('CREATED');
|
|
1128
|
-
expect(payIn.RedirectURL).not.to.be.undefined;
|
|
1129
|
-
expect(payIn.DeepLinkURL).not.to.be.undefined;
|
|
1130
|
-
});
|
|
1131
|
-
});
|
|
1132
|
-
|
|
1133
|
-
describe('Get', function () {
|
|
1134
|
-
var getPayIn;
|
|
1135
|
-
before(function (done) {
|
|
1136
|
-
api.PayIns.get(payIn.Id, function (data, response) {
|
|
1137
|
-
getPayIn = data;
|
|
1138
|
-
done()
|
|
1139
|
-
});
|
|
1140
|
-
});
|
|
1141
|
-
|
|
1142
|
-
it('should get the PayIn', function () {
|
|
1143
|
-
expect(getPayIn.Id).not.to.be.undefined;
|
|
1144
|
-
expect(getPayIn.PaymentType).to.equal('PAYCONIQ');
|
|
1145
|
-
expect(getPayIn.ExecutionType).to.equal('WEB');
|
|
1146
|
-
expect(getPayIn.Status).to.equal('CREATED');
|
|
1147
|
-
expect(payIn.RedirectURL).not.to.be.undefined;
|
|
1148
|
-
expect(payIn.DeepLinkURL).not.to.be.undefined;
|
|
1149
|
-
});
|
|
1150
|
-
});
|
|
1151
|
-
});
|
|
1152
|
-
|
|
1153
|
-
describe('Payconiq Web V2', function () {
|
|
1154
|
-
var payIn, wallet;
|
|
1155
|
-
|
|
1156
|
-
before(function (done) {
|
|
1157
|
-
wallet = {
|
|
1158
|
-
Owners: [john.Id],
|
|
1159
|
-
Currency: 'EUR',
|
|
1160
|
-
Description: 'WALLET IN EUR'
|
|
1161
|
-
};
|
|
1162
|
-
|
|
1163
|
-
api.Wallets.create(wallet).then(function () {
|
|
1164
|
-
payIn = {
|
|
1165
|
-
Tag: 'custom meta',
|
|
1166
|
-
CreditedWalletId: wallet.Id,
|
|
1167
|
-
AuthorId: john.Id,
|
|
1168
|
-
DebitedFunds: {
|
|
1169
|
-
Amount: 100,
|
|
1170
|
-
Currency: 'EUR'
|
|
1171
|
-
},
|
|
1172
|
-
Fees: {
|
|
1173
|
-
Amount: 0,
|
|
1174
|
-
Currency: 'EUR'
|
|
1175
|
-
},
|
|
1176
|
-
PaymentType: 'PAYCONIQ',
|
|
1177
|
-
ExecutionType: 'WEB',
|
|
1178
|
-
ReturnURL: 'http://www.my-site.com/returnURL',
|
|
1179
|
-
Country: 'BE'
|
|
1180
|
-
};
|
|
1181
|
-
|
|
1182
|
-
api.PayIns.createPayconiq(payIn, function (data, response) {
|
|
1183
|
-
payIn = data;
|
|
1184
|
-
done();
|
|
1185
|
-
});
|
|
1186
|
-
});
|
|
1187
|
-
});
|
|
1188
|
-
|
|
1189
|
-
describe('Create', function () {
|
|
1190
|
-
it('should create the PayIn', function () {
|
|
1191
|
-
expect(payIn.Id).not.to.be.undefined;
|
|
1192
|
-
expect(payIn.PaymentType).to.equal('PAYCONIQ');
|
|
1193
|
-
expect(payIn.ExecutionType).to.equal('WEB');
|
|
1194
|
-
expect(payIn.Status).to.equal('CREATED');
|
|
1195
|
-
expect(payIn.RedirectURL).not.to.be.undefined;
|
|
1196
|
-
expect(payIn.DeepLinkURL).not.to.be.undefined;
|
|
1197
|
-
expect(payIn.QRCodeURL).not.to.be.undefined;
|
|
1198
|
-
});
|
|
1199
|
-
});
|
|
1200
|
-
});
|
|
1201
|
-
|
|
1202
1080
|
describe('Mbway Web', function () {
|
|
1203
1081
|
var payIn;
|
|
1204
1082
|
|
|
@@ -1541,6 +1419,7 @@ describe('PayIns', function () {
|
|
|
1541
1419
|
expect(payIn.AuthorId).to.equal(john.Id);
|
|
1542
1420
|
expect(payIn.Type).to.equal('PAYIN');
|
|
1543
1421
|
expect(payIn.Phone).not.to.be.null;
|
|
1422
|
+
expect(payIn.LineItems[1].Discount).to.equal(10);
|
|
1544
1423
|
});
|
|
1545
1424
|
});
|
|
1546
1425
|
|
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
var expect = require('chai').expect;
|
|
2
2
|
var helpers = require('../helpers');
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var api = global.api = new mangopay({
|
|
6
|
-
clientId: 'sdk-unit-tests',
|
|
7
|
-
clientApiKey: 'cqFfFrWfCcb7UadHNxx2C9Lo6Djw8ZduLi7J9USTmu8bhxxpju'
|
|
8
|
-
});
|
|
3
|
+
var api = require('../main');
|
|
9
4
|
|
|
10
5
|
describe('Rate Limits', function () {
|
|
11
6
|
expect(api.rateLimits).to.be.empty;
|
|
@@ -6,12 +6,7 @@ var Ubo = require('../../lib/models/Ubo');
|
|
|
6
6
|
var UboDeclarationStatus = require('../../lib/models/UboDeclarationStatus');
|
|
7
7
|
var UserNatural = require('../../lib/models/UserNatural');
|
|
8
8
|
var UserLegal = require('../../lib/models/UserLegal');
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
var api = global.api = new mangopay({
|
|
12
|
-
clientId: 'sdk-unit-tests',
|
|
13
|
-
clientApiKey: 'cqFfFrWfCcb7UadHNxx2C9Lo6Djw8ZduLi7J9USTmu8bhxxpju'
|
|
14
|
-
});
|
|
9
|
+
var api = require('../main');
|
|
15
10
|
|
|
16
11
|
describe('UBO Declarations', function () {
|
|
17
12
|
var user = new UserLegal(helpers.data.getUserLegal());
|
package/typings/base.d.ts
CHANGED
|
@@ -64,6 +64,47 @@ export namespace base {
|
|
|
64
64
|
* @default `console.error`
|
|
65
65
|
*/
|
|
66
66
|
errorHandler?(options: any, err: any): void;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Client certificate for mTLS (PEM string or Buffer).
|
|
70
|
+
* Use either this or `certFilePath`.
|
|
71
|
+
*/
|
|
72
|
+
cert?: string | Buffer;
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Client private key for mTLS (PEM string or Buffer).
|
|
76
|
+
* Use either this or `keyFilePath`.
|
|
77
|
+
*/
|
|
78
|
+
key?: string | Buffer;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* CA certificate for mTLS (PEM string or Buffer).
|
|
82
|
+
* Use either this or `caFilePath`.
|
|
83
|
+
*/
|
|
84
|
+
ca?: string | Buffer;
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Path to client certificate file for mTLS.
|
|
88
|
+
* Read at initialization time. Ignored if `cert` is set.
|
|
89
|
+
*/
|
|
90
|
+
certFilePath?: string;
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Path to client private key file for mTLS.
|
|
94
|
+
* Read at initialization time. Ignored if `key` is set.
|
|
95
|
+
*/
|
|
96
|
+
keyFilePath?: string;
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Path to CA certificate file for mTLS.
|
|
100
|
+
* Read at initialization time. Ignored if `ca` is set.
|
|
101
|
+
*/
|
|
102
|
+
caFilePath?: string;
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Passphrase for an encrypted private key (`key` or `keyFilePath`).
|
|
106
|
+
*/
|
|
107
|
+
passphrase?: string;
|
|
67
108
|
}
|
|
68
109
|
|
|
69
110
|
interface RequestOptions {
|
package/typings/enums.d.ts
CHANGED
package/typings/index.d.ts
CHANGED
|
@@ -46,6 +46,7 @@ import { cardPreAuthorization } from "./models/cardPreauthorization";
|
|
|
46
46
|
import { entityBase } from "./models/entityBase";
|
|
47
47
|
import { user } from "./models/user";
|
|
48
48
|
import { payIn } from "./models/payIn";
|
|
49
|
+
import { acquiring } from "./models/acquiring";
|
|
49
50
|
import { refund } from "./models/refund";
|
|
50
51
|
import { repudiation } from "./models/repudiation";
|
|
51
52
|
import { client } from "./models/client";
|
|
@@ -76,6 +77,7 @@ import { identityVerification } from "./models/identityVerification";
|
|
|
76
77
|
import { recipient } from "./models/recipient";
|
|
77
78
|
import { Recipients } from "./services/Recipients";
|
|
78
79
|
import { Settlements } from "./services/Settlements";
|
|
80
|
+
import { Acquiring } from "./services/Acquiring";
|
|
79
81
|
import { OptionsHelper } from "./services/OptionsHelper";
|
|
80
82
|
|
|
81
83
|
export = MangoPay;
|
|
@@ -116,6 +118,7 @@ declare class MangoPay {
|
|
|
116
118
|
IdentityVerifications: IdentityVerifications;
|
|
117
119
|
Recipients: Recipients;
|
|
118
120
|
Settlements: Settlements;
|
|
121
|
+
Acquiring: Acquiring;
|
|
119
122
|
OptionsHelper: OptionsHelper;
|
|
120
123
|
|
|
121
124
|
models: typeof MangoPay.models;
|
|
@@ -666,10 +669,6 @@ declare namespace MangoPay {
|
|
|
666
669
|
constructor(data: any);
|
|
667
670
|
}
|
|
668
671
|
|
|
669
|
-
class PayInPaymentDetailsPayconiq extends PayInPaymentDetails {
|
|
670
|
-
constructor(data: any);
|
|
671
|
-
}
|
|
672
|
-
|
|
673
672
|
class PayInPaymentDetailsCardDirect extends PayInPaymentDetails {
|
|
674
673
|
constructor(data: any);
|
|
675
674
|
}
|
|
@@ -880,6 +879,7 @@ declare namespace MangoPay {
|
|
|
880
879
|
conversion,
|
|
881
880
|
virtualAccount,
|
|
882
881
|
identityVerification,
|
|
883
|
-
recipient
|
|
882
|
+
recipient,
|
|
883
|
+
acquiring
|
|
884
884
|
};
|
|
885
885
|
}
|
package/typings/index.test-d.ts
CHANGED
|
@@ -12,6 +12,25 @@ const validConfig: Mangopay.base.Config = {
|
|
|
12
12
|
baseUrl: "https://api.mangopay.com"
|
|
13
13
|
};
|
|
14
14
|
|
|
15
|
+
// mTLS config — file paths
|
|
16
|
+
const mtlsConfigPaths: Mangopay.base.Config = {
|
|
17
|
+
clientId: "your_client_id",
|
|
18
|
+
clientApiKey: "your_client_api_key",
|
|
19
|
+
certFilePath: "/path/to/cert.pem",
|
|
20
|
+
keyFilePath: "/path/to/key.pem",
|
|
21
|
+
caFilePath: "/path/to/ca.pem",
|
|
22
|
+
passphrase: "secret"
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
// mTLS config — raw content
|
|
26
|
+
const mtlsConfigRaw: Mangopay.base.Config = {
|
|
27
|
+
clientId: "your_client_id",
|
|
28
|
+
clientApiKey: "your_client_api_key",
|
|
29
|
+
cert: "base64_string",
|
|
30
|
+
key: "base64_string",
|
|
31
|
+
passphrase: "secret"
|
|
32
|
+
};
|
|
33
|
+
|
|
15
34
|
// API instance tests
|
|
16
35
|
const api = new Mangopay(validConfig);
|
|
17
36
|
expectType<Mangopay>(api);
|
|
@@ -793,21 +812,6 @@ api.PayIns.create({
|
|
|
793
812
|
expectType<Mangopay.payIn.BankWireDirectPayInData>(data);
|
|
794
813
|
});
|
|
795
814
|
|
|
796
|
-
// create Payconiq PayIn
|
|
797
|
-
api.PayIns.create({
|
|
798
|
-
PaymentType: "PAYCONIQ",
|
|
799
|
-
ExecutionType: "WEB",
|
|
800
|
-
Tag: "custom meta",
|
|
801
|
-
AuthorId: "user-id",
|
|
802
|
-
CreditedWalletId: "wallet-id",
|
|
803
|
-
DebitedFunds: {Amount: 500, Currency: "GBP"},
|
|
804
|
-
Fees: {Amount: 500, Currency: "GBP"},
|
|
805
|
-
ReturnURL: "http://www.my-site.com/returnURL",
|
|
806
|
-
Country: "BE"
|
|
807
|
-
}).then(data => {
|
|
808
|
-
expectType<Mangopay.payIn.PayconiqWebPayInData>(data);
|
|
809
|
-
});
|
|
810
|
-
|
|
811
815
|
api.PayIns.create({
|
|
812
816
|
PaymentType: "DIRECT_DEBIT",
|
|
813
817
|
ExecutionType: "DIRECT",
|