mangopay4-nodejs-sdk 1.68.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.
Files changed (51) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/README.md +0 -6
  3. package/docs/templates/class.mustache +0 -0
  4. package/docs/templates/file.mustache +0 -0
  5. package/docs/templates/function.mustache +0 -0
  6. package/docs/templates/index.mustache +0 -0
  7. package/docs/templates/overview.mustache +0 -0
  8. package/lib/models/CardPreAuthorization.js +2 -2
  9. package/package.json +16 -24
  10. package/.github/workflows/node.js.yml +0 -32
  11. package/.github/workflows/npm-publish.yml +0 -26
  12. package/.jshintrc +0 -16
  13. package/test/TestKycPageFile.png +0 -0
  14. package/test/helpers.js +0 -1537
  15. package/test/main.js +0 -10
  16. package/test/mocha.opts +0 -3
  17. package/test/services/Acquiring.js +0 -338
  18. package/test/services/BankAccounts.js +0 -46
  19. package/test/services/BankingAliases.js +0 -89
  20. package/test/services/CardPreAuthorizations.js +0 -70
  21. package/test/services/CardRegistrations.js +0 -239
  22. package/test/services/Cards.js +0 -56
  23. package/test/services/Clients.js +0 -235
  24. package/test/services/Conversions.js +0 -319
  25. package/test/services/Deposits.js +0 -148
  26. package/test/services/Disputes.js +0 -542
  27. package/test/services/EMoney.js +0 -54
  28. package/test/services/Events.js +0 -147
  29. package/test/services/Hooks.js +0 -109
  30. package/test/services/Idempotency.js +0 -41
  31. package/test/services/IdentityVerifications.js +0 -68
  32. package/test/services/KycDocuments.js +0 -73
  33. package/test/services/Mandates.js +0 -256
  34. package/test/services/PayIns.js +0 -2632
  35. package/test/services/PayOuts.js +0 -119
  36. package/test/services/RateLimit.js +0 -43
  37. package/test/services/Recipients.js +0 -234
  38. package/test/services/Refunds.js +0 -123
  39. package/test/services/Regulatory.js +0 -45
  40. package/test/services/Reports.js +0 -114
  41. package/test/services/ReportsV2.js +0 -306
  42. package/test/services/Repudiations.js +0 -22
  43. package/test/services/Settlements.js +0 -127
  44. package/test/services/Tokens.js +0 -55
  45. package/test/services/Transfers.js +0 -137
  46. package/test/services/UboDeclarations.js +0 -130
  47. package/test/services/Users.js +0 -1322
  48. package/test/services/VirtualAccounts.js +0 -105
  49. package/test/services/Wallets.js +0 -132
  50. package/test/settlement_sample.csv +0 -8
  51. package/test/settlement_sample_bad.csv +0 -8
@@ -1,2632 +0,0 @@
1
- var expect = require('chai').expect;
2
-
3
- var helpers = require('../helpers');
4
- var api = require('../main');
5
-
6
- describe('PayIns', function () {
7
- var payIn;
8
- var john = helpers.data.getUserNatural();
9
-
10
- before(function (done) {
11
- api.Users.create(john, function () {
12
- done();
13
- });
14
- });
15
-
16
- describe('Card Web', function () {
17
-
18
- before(function (done) {
19
- helpers.getNewPayInCardWeb(api, john, function (data, response) {
20
- payIn = data;
21
- done();
22
- });
23
- });
24
-
25
- describe('Create', function () {
26
- it('should create the PayIn', function () {
27
- expect(payIn.Id).not.to.be.undefined;
28
- expect(payIn.PaymentType).to.equal('CARD');
29
- expect(payIn.ExecutionType).to.equal('WEB');
30
- });
31
- });
32
-
33
- describe('Get', function () {
34
- var getPayIn;
35
- before(function (done) {
36
- api.PayIns.get(payIn.Id, function (data, response) {
37
- getPayIn = data;
38
- done()
39
- });
40
- });
41
-
42
- it('should get the PayIn', function () {
43
- expect(getPayIn.Id).not.to.be.undefined;
44
- expect(getPayIn.PaymentType).to.equal('CARD');
45
- expect(getPayIn.ExecutionType).to.equal('WEB');
46
- expect(getPayIn.Status).to.equal('CREATED');
47
- expect(getPayIn.ExecutionDate).to.be.null;
48
- expect(getPayIn.RedirectURL).not.to.be.undefined;
49
- expect(getPayIn.ReturnURL).not.to.be.undefined;
50
- });
51
- });
52
-
53
- describe.skip('Get extended details', function () {
54
- console.warn('Cannot be tested because a Succeeded Card Web PayIn cannot be generated from the tests');
55
- var extendedDetails;
56
- before(function (done) {
57
- api.PayIns.getCardWebPayInExtendedDetails(payIn.Id, function (data, response) {
58
- extendedDetails = data;
59
- done();
60
- });
61
- });
62
-
63
- it('should get the PayIn', function () {
64
- expect(extendedDetails.Id).not.to.be.undefined;
65
- expect(extendedDetails.PaymentType).to.equal('CARD');
66
- expect(extendedDetails.ExecutionType).to.equal('WEB');
67
- });
68
- });
69
- });
70
-
71
- describe('Card Direct', function () {
72
- var payIn;
73
-
74
- before(function (done) {
75
- helpers.getNewPayInCardDirect(api, john, function (data, response) {
76
- payIn = data;
77
- done();
78
- });
79
- });
80
-
81
- describe('Create', function () {
82
- it('should create the PayIn', function () {
83
- expect(payIn.Id).not.to.be.undefined;
84
- expect(payIn.PaymentType).to.equal('CARD');
85
- expect(payIn.ExecutionType).to.equal('DIRECT');
86
- expect(payIn.AuthorId).to.equal(john.Id);
87
- expect(payIn.Status).to.equal('SUCCEEDED');
88
- expect(payIn.Type).to.equal('PAYIN');
89
- expect(payIn.SecurityInfo.AVSResult).to.equal('NO_CHECK');
90
- expect(payIn.CardInfo).not.to.be.undefined;
91
- });
92
- });
93
-
94
- describe('Get', function () {
95
- var getPayIn;
96
- before(function (done) {
97
- api.PayIns.get(payIn.Id, function (data, response) {
98
- getPayIn = data;
99
- done()
100
- });
101
- });
102
-
103
- it('should get the PayIn', function () {
104
- expect(getPayIn.Id).to.equal(payIn.Id);
105
- expect(getPayIn.PaymentType).to.equal('CARD');
106
- expect(getPayIn.ExecutionType).to.equal('DIRECT');
107
- expect(getPayIn.CardId).not.to.be.null;
108
- });
109
- });
110
-
111
- describe('Create Refund', function () {
112
- var refund;
113
-
114
- before(function (done) {
115
- helpers.getNewRefundForPayIn(api, john, payIn, function (data, response) {
116
- refund = data;
117
- done();
118
- });
119
- });
120
-
121
- it('should succeed', function () {
122
- expect(refund.DebitedFunds).to.eql(payIn.DebitedFunds);
123
- expect(refund.Type).to.equal('PAYOUT');
124
- expect(refund.Nature).to.equal('REFUND');
125
- });
126
- });
127
-
128
- describe('Create Partial Refund', function () {
129
- var refund;
130
-
131
- before(function (done) {
132
- helpers.getPartialRefundForPayIn(api, john, payIn, function (data, response) {
133
- refund = data;
134
- done();
135
- });
136
- });
137
-
138
- it('should succeed', function () {
139
- expect(refund.Id).to.not.be.null;
140
- expect(refund.Type).to.equal('PAYOUT');
141
- expect(refund.Nature).to.equal('REFUND');
142
- });
143
- });
144
- });
145
-
146
- describe('PreAuthorizedDirect', function () {
147
- var preAuthorization, payIn, wallet;
148
- var transactionsData;
149
-
150
- before(function (done) {
151
- helpers.getUserCardPreAuthorization(api, john, function (data, response) {
152
- preAuthorization = data;
153
-
154
- wallet = {
155
- Owners: [john.Id],
156
- Currency: 'EUR',
157
- Description: 'WALLET IN EUR'
158
- };
159
-
160
- api.Wallets.create(wallet).then(function () {
161
- payIn = {
162
- CreditedWalletId: wallet.Id,
163
- AuthorId: john.Id,
164
- DebitedFunds: {
165
- Amount: 1000,
166
- Currency: 'EUR'
167
- },
168
- Fees: {
169
- Amount: 0,
170
- Currency: 'EUR'
171
- },
172
- CardId: preAuthorization.CardId,
173
- SecureModeReturnURL: 'http://test.com',
174
- PaymentType: 'PREAUTHORIZED',
175
- ExecutionType: 'DIRECT',
176
- PreauthorizationId: preAuthorization.Id
177
- };
178
-
179
- api.PayIns.create(payIn, async function (data, response) {
180
- // wait 2 seconds for the transactions to be created by the API
181
- const delay = ms => new Promise(resolve => setTimeout(resolve, ms));
182
- await delay(2000);
183
- done();
184
- });
185
- });
186
- });
187
- });
188
-
189
- it('should succeed', function () {
190
- expect(payIn.Id).not.to.be.undefined;
191
- expect(payIn.data.AuthorId).to.equal(john.Id);
192
- expect(payIn.data.PaymentType).to.equal('PREAUTHORIZED');
193
- expect(payIn.data.ExecutionType).to.equal('DIRECT');
194
- expect(payIn.data.CardId).not.to.be.null;
195
- expect(payIn.data.Type).to.equal('PAYIN');
196
- expect(payIn.data.Status).to.equal('SUCCEEDED');
197
- });
198
-
199
- before(function(done){
200
- api.CardPreAuthorizations.getTransactions(preAuthorization.Id, function(data, response){
201
- transactionsData = data;
202
- done();
203
- });
204
- });
205
-
206
- it('should get transactions', function () {
207
- expect(transactionsData[0].Status).to.not.equal('FAILED');
208
- });
209
- });
210
-
211
- describe('BankWireDirect', function () {
212
- var payIn, wallet;
213
-
214
- before(function (done) {
215
- wallet = {
216
- Owners: [john.Id],
217
- Currency: 'EUR',
218
- Description: 'WALLET IN EUR'
219
- };
220
-
221
- api.Wallets.create(wallet).then(function () {
222
- done();
223
- });
224
- });
225
-
226
- describe('Create', function () {
227
- before(function (done) {
228
- payIn = {
229
- CreditedWalletId: wallet.Id,
230
- AuthorId: john.Id,
231
- DeclaredDebitedFunds: {
232
- Amount: 10000,
233
- Currency: 'EUR'
234
- },
235
- DeclaredFees: {
236
- Amount: 0,
237
- Currency: 'EUR'
238
- },
239
- PaymentType: 'BANK_WIRE',
240
- ExecutionType: 'DIRECT'
241
- };
242
-
243
- api.PayIns.create(payIn, function (data, response) {
244
- done();
245
- });
246
- });
247
-
248
- it('should succeed', function () {
249
- expect(payIn.Id).not.to.be.undefined;
250
- expect(payIn.data.AuthorId).to.equal(john.Id);
251
- expect(payIn.data.PaymentType).to.equal('BANK_WIRE');
252
- expect(payIn.data.ExecutionType).to.equal('DIRECT');
253
- expect(payIn.data.Type).to.equal('PAYIN');
254
- expect(payIn.data.Status).to.equal('CREATED');
255
- });
256
- });
257
-
258
- describe('Get', function () {
259
- var getPayIn;
260
-
261
- before(function (done) {
262
- api.PayIns.get(payIn.Id, function (data, response) {
263
- getPayIn = data;
264
- done();
265
- });
266
- });
267
-
268
- it('should succeed', function () {
269
- expect(getPayIn.Id).to.equal(payIn.Id);
270
- expect(getPayIn.BankAccount.Type).to.equal('IBAN');
271
- expect(getPayIn.AuthorId).to.equal(john.Id);
272
- expect(getPayIn.ExecutionType).to.equal('DIRECT');
273
- expect(getPayIn.Type).to.equal('PAYIN');
274
- expect(getPayIn.Status).to.equal('CREATED');
275
- });
276
- });
277
- });
278
-
279
- describe('DirectDebitWeb', function () {
280
- var payIn, wallet;
281
-
282
- before(function (done) {
283
- wallet = {
284
- Owners: [john.Id],
285
- Currency: 'EUR',
286
- Description: 'WALLET IN EUR'
287
- };
288
-
289
- api.Wallets.create(wallet).then(function () {
290
- done();
291
- });
292
- });
293
-
294
- describe('Create', function () {
295
- before(function (done) {
296
- payIn = {
297
- CreditedWalletId: wallet.Id,
298
- AuthorId: john.Id,
299
- DebitedFunds: {
300
- Amount: 10000,
301
- Currency: 'EUR'
302
- },
303
- Fees: {
304
- Amount: 100,
305
- Currency: 'EUR'
306
- },
307
- PaymentType: 'DIRECT_DEBIT',
308
- ExecutionType: 'WEB',
309
- DirectDebitType: 'GIROPAY',
310
- ReturnURL: 'http://www.mysite.com/returnURL/',
311
- Culture: 'FR',
312
- PAYLINE: 'https://www.maysite.com/payline_template/'
313
- };
314
-
315
- api.PayIns.create(payIn, function (data, response) {
316
- done();
317
- });
318
- });
319
-
320
- it('should succeed', function () {
321
- expect(payIn.Id).not.to.be.undefined;
322
- expect(payIn.data.AuthorId).to.equal(john.Id);
323
- expect(payIn.data.PaymentType).to.equal('DIRECT_DEBIT');
324
- expect(payIn.data.ExecutionType).to.equal('WEB');
325
- expect(payIn.data.CardId).not.to.be.null;
326
- expect(payIn.data.Type).to.equal('PAYIN');
327
- expect(payIn.data.Status).to.equal('CREATED');
328
- });
329
- });
330
- });
331
-
332
- describe('PayPalWeb', function () {
333
- var payIn, wallet;
334
-
335
- before(function (done) {
336
- wallet = {
337
- Owners: [john.Id],
338
- Currency: 'EUR',
339
- Description: 'WALLET IN EUR'
340
- };
341
-
342
- api.Wallets.create(wallet).then(function () {
343
- done();
344
- });
345
- });
346
-
347
- describe('Create', function () {
348
- var shippingAddress = {
349
- RecipientName: "Mangopay Test",
350
- Address: {
351
- "AddressLine1": "4101 Reservoir Rd NW",
352
- "AddressLine2": "",
353
- "City": "Washington",
354
- "Region": "District of Columbia",
355
- "PostalCode": "20007",
356
- "Country": "US"
357
- }
358
- };
359
-
360
- before(function (done) {
361
- payIn = {
362
- CreditedWalletId: wallet.Id,
363
- AuthorId: john.Id,
364
- CreditedUserId: john.Id,
365
- DebitedFunds: {
366
- Amount: 10000,
367
- Currency: 'EUR'
368
- },
369
- Fees: {
370
- Amount: 100,
371
- Currency: 'EUR'
372
- },
373
- PaymentType: 'PAYPAL',
374
- ExecutionType: 'WEB',
375
- ReturnURL: 'http://www.mysite.com/returnURL/',
376
- ShippingAddress: shippingAddress
377
- };
378
-
379
- api.PayIns.create(payIn, function (data, response) {
380
- done();
381
- });
382
- });
383
-
384
- it('should be created', function () {
385
- expect(payIn.Id).not.to.be.undefined;
386
- expect(payIn.data.AuthorId).to.equal(john.Id);
387
- expect(payIn.data.PaymentType).to.equal('PAYPAL');
388
- expect(payIn.data.ExecutionType).to.equal('WEB');
389
- expect(payIn.data.CardId).not.to.be.null;
390
- expect(payIn.data.Type).to.equal('PAYIN');
391
- expect(payIn.data.Status).to.equal('CREATED');
392
- });
393
-
394
- describe('Get', function () {
395
- var getPayIn;
396
-
397
- before(function (done) {
398
- api.PayIns.get(payIn.Id, function (data, response) {
399
- getPayIn = data;
400
- done();
401
- });
402
- });
403
-
404
- it('should be retrieved', function () {
405
- expect(getPayIn.Id).not.to.be.undefined;
406
- expect(getPayIn.Id).to.equal(payIn.Id);
407
- expect(getPayIn.ShippingAddress).not.to.be.undefined;
408
- expect(getPayIn.ShippingAddress).to.deep.equal(shippingAddress);
409
- });
410
- });
411
- });
412
-
413
- describe.skip("Get with Email", function () {
414
- console.warn("Cannot be tested. PayIn ID expired.");
415
- var payInId = "54088959";
416
- var accountEmail = "paypal-buyer-user@mangopay.com";
417
- var payinWithEmail;
418
-
419
- before(function (done) {
420
- api.PayIns.get(payInId, function (data, response) {
421
- payinWithEmail = data;
422
- done();
423
- });
424
- });
425
-
426
- it("should contain buyer's email", function () {
427
- expect(payinWithEmail).not.to.be.undefined;
428
- expect(payinWithEmail.Id).to.equal(payInId);
429
- expect(payinWithEmail.PaypalBuyerAccountEmail).not.to.be.undefined;
430
- expect(payinWithEmail.PaypalBuyerAccountEmail).to.equal(accountEmail);
431
- });
432
- });
433
-
434
- });
435
-
436
- // describe('ApplePay', function () {
437
- // var applePayPayIn, wallet;
438
-
439
- // before(function (done) {
440
- // wallet = {
441
- // Owners: [john.Id],
442
- // Currency: 'EUR',
443
- // Description: 'WALLET IN EUR'
444
- // };
445
-
446
- // api.Wallets.create(wallet).then(function () {
447
- // done();
448
- // });
449
- // });
450
-
451
- // describe('Create', function () {
452
-
453
- // var paymentData = {
454
- // TransactionId: '061EB32181A2D9CA42AD16031B476EEBAA62A9A095AD660E2759FBA52B51A61',
455
- // Network: 'VISA',
456
- // TokenData: "{\"version\":\"EC_v1\",\"data\":\"w4HMBVqNC9ghPP4zncTA\/0oQAsduERfsx78oxgniynNjZLANTL6+0koEtkQnW\/K38Zew8qV1GLp+fLHo+qCBpiKCIwlz3eoFBTbZU+8pYcjaeIYBX9SOxcwxXsNGrGLk+kBUqnpiSIPaAG1E+WPT8R1kjOCnGvtdombvricwRTQkGjtovPfzZo8LzD3ZQJnHMsWJ8QYDLyr\/ZN9gtLAtsBAMvwManwiaG3pOIWpyeOQOb01YcEVO16EZBjaY4x4C\/oyFLWDuKGvhbJwZqWh1d1o9JT29QVmvy3Oq2JEjq3c3NutYut4rwDEP4owqI40Nb7mP2ebmdNgnYyWfPmkRfDCRHIWtbMC35IPg5313B1dgXZ2BmyZRXD5p+mr67vAk7iFfjEpu3GieFqwZrTl3\/pI5V8Sxe3SIYKgT5Hr7ow==\",\"signature\":\"MIAGCSqGSIb3DQEHAqCAMIACAQExDzANBglghkgBZQMEAgEFADCABgkqhkiG9w0BBwEAAKCAMIID5jCCA4ugAwIBAgIIaGD2mdnMpw8wCgYIKoZIzj0EAwIwejEuMCwGA1UEAwwlQXBwbGUgQXBwbGljYXRpb24gSW50ZWdyYXRpb24gQ0EgLSBHMzEmMCQGA1UECwwdQXBwbGUgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkxEzARBgNVBAoMCkFwcGxlIEluYy4xCzAJBgNVBAYTAlVTMB4XDTE2MDYwMzE4MTY0MFoXDTIxMDYwMjE4MTY0MFowYjEoMCYGA1UEAwwfZWNjLXNtcC1icm9rZXItc2lnbl9VQzQtU0FOREJPWDEUMBIGA1UECwwLaU9TIFN5c3RlbXMxEzARBgNVBAoMCkFwcGxlIEluYy4xCzAJBgNVBAYTAlVTMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEgjD9q8Oc914gLFDZm0US5jfiqQHdbLPgsc1LUmeY+M9OvegaJajCHkwz3c6OKpbC9q+hkwNFxOh6RCbOlRsSlaOCAhEwggINMEUGCCsGAQUFBwEBBDkwNzA1BggrBgEFBQcwAYYpaHR0cDovL29jc3AuYXBwbGUuY29tL29jc3AwNC1hcHBsZWFpY2EzMDIwHQYDVR0OBBYEFAIkMAua7u1GMZekplopnkJxghxFMAwGA1UdEwEB\/wQCMAAwHwYDVR0jBBgwFoAUI\/JJxE+T5O8n5sT2KGw\/orv9LkswggEdBgNVHSAEggEUMIIBEDCCAQwGCSqGSIb3Y2QFATCB\/jCBwwYIKwYBBQUHAgIwgbYMgbNSZWxpYW5jZSBvbiB0aGlzIGNlcnRpZmljYXRlIGJ5IGFueSBwYXJ0eSBhc3N1bWVzIGFjY2VwdGFuY2Ugb2YgdGhlIHRoZW4gYXBwbGljYWJsZSBzdGFuZGFyZCB0ZXJtcyBhbmQgY29uZGl0aW9ucyBvZiB1c2UsIGNlcnRpZmljYXRlIHBvbGljeSBhbmQgY2VydGlmaWNhdGlvbiBwcmFjdGljZSBzdGF0ZW1lbnRzLjA2BggrBgEFBQcCARYqaHR0cDovL3d3dy5hcHBsZS5jb20vY2VydGlmaWNhdGVhdXRob3JpdHkvMDQGA1UdHwQtMCswKaAnoCWGI2h0dHA6Ly9jcmwuYXBwbGUuY29tL2FwcGxlYWljYTMuY3JsMA4GA1UdDwEB\/wQEAwIHgDAPBgkqhkiG92NkBh0EAgUAMAoGCCqGSM49BAMCA0kAMEYCIQDaHGOui+X2T44R6GVpN7m2nEcr6T6sMjOhZ5NuSo1egwIhAL1a+\/hp88DKJ0sv3eT3FxWcs71xmbLKD\/QJ3mWagrJNMIIC7jCCAnWgAwIBAgIISW0vvzqY2pcwCgYIKoZIzj0EAwIwZzEbMBkGA1UEAwwSQXBwbGUgUm9vdCBDQSAtIEczMSYwJAYDVQQLDB1BcHBsZSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTETMBEGA1UECgwKQXBwbGUgSW5jLjELMAkGA1UEBhMCVVMwHhcNMTQwNTA2MjM0NjMwWhcNMjkwNTA2MjM0NjMwWjB6MS4wLAYDVQQDDCVBcHBsZSBBcHBsaWNhdGlvbiBJbnRlZ3JhdGlvbiBDQSAtIEczMSYwJAYDVQQLDB1BcHBsZSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTETMBEGA1UECgwKQXBwbGUgSW5jLjELMAkGA1UEBhMCVVMwWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAATwFxGEGddkhdUaXiWBB3bogKLv3nuuTeCN\/EuT4TNW1WZbNa4i0Jd2DSJOe7oI\/XYXzojLdrtmcL7I6CmE\/1RFo4H3MIH0MEYGCCsGAQUFBwEBBDowODA2BggrBgEFBQcwAYYqaHR0cDovL29jc3AuYXBwbGUuY29tL29jc3AwNC1hcHBsZXJvb3RjYWczMB0GA1UdDgQWBBQj8knET5Pk7yfmxPYobD+iu\/0uSzAPBgNVHRMBAf8EBTADAQH\/MB8GA1UdIwQYMBaAFLuw3qFYM4iapIqZ3r6966\/ayySrMDcGA1UdHwQwMC4wLKAqoCiGJmh0dHA6Ly9jcmwuYXBwbGUuY29tL2FwcGxlcm9vdGNhZzMuY3JsMA4GA1UdDwEB\/wQEAwIBBjAQBgoqhkiG92NkBgIOBAIFADAKBggqhkjOPQQDAgNnADBkAjA6z3KDURaZsYb7NcNWymK\/9Bft2Q91TaKOvvGcgV5Ct4n4mPebWZ+Y1UENj53pwv4CMDIt1UQhsKMFd2xd8zg7kGf9F3wsIW2WT8ZyaYISb1T4en0bmcubCYkhYQaZDwmSHQAAMYIBizCCAYcCAQEwgYYwejEuMCwGA1UEAwwlQXBwbGUgQXBwbGljYXRpb24gSW50ZWdyYXRpb24gQ0EgLSBHMzEmMCQGA1UECwwdQXBwbGUgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkxEzARBgNVBAoMCkFwcGxlIEluYy4xCzAJBgNVBAYTAlVTAghoYPaZ2cynDzANBglghkgBZQMEAgEFAKCBlTAYBgkqhkiG9w0BCQMxCwYJKoZIhvcNAQcBMBwGCSqGSIb3DQEJBTEPFw0xOTA1MjMxMTA1MDdaMCoGCSqGSIb3DQEJNDEdMBswDQYJYIZIAWUDBAIBBQChCgYIKoZIzj0EAwIwLwYJKoZIhvcNAQkEMSIEIIvfGVQYBeOilcB7GNI8m8+FBVZ28QfA6BIXaggBja2PMAoGCCqGSM49BAMCBEYwRAIgU01yYfjlx9bvGeC5CU2RS5KBEG+15HH9tz\/sg3qmQ14CID4F4ZJwAz+tXAUcAIzoMpYSnM8YBlnGJSTSp+LhspenAAAAAAAA\",\"header\":{\"ephemeralPublicKey\":\"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE0rs3wRpirXjPbFDQfPRdfEzRIZDWm0qn7Y0HB0PNzV1DDKfpYrnhRb4GEhBF\/oEXBOe452PxbCnN1qAlqcSUWw==\",\"publicKeyHash\":\"saPRAqS7TZ4bAYwzBj8ezDDC55ZolyH1FL+Xc8fd93o=\",\"transactionId\":\"b061eb32181a2d9ca42ad16031b476eebaa62a9a095ad660e2759fba52b51a61\"}}"
457
- // };
458
-
459
- // before(function (done) {
460
- // applePayPayIn = {
461
- // CreditedWalletId: wallet.Id,
462
- // AuthorId: john.Id,
463
- // CreditedUserId: john.Id,
464
- // DebitedFunds: {
465
- // Amount: 199,
466
- // Currency: 'EUR'
467
- // },
468
- // Fees: {
469
- // Amount: 1,
470
- // Currency: 'EUR'
471
- // },
472
- // PaymentType: 'APPLEPAY',
473
- // ExecutionType: 'DIRECT',
474
- // PaymentData: paymentData,
475
- // Tag: "Create an ApplePay card direct Payin",
476
- // StatementDescriptor: "php"
477
- // };
478
-
479
- // api.PayIns.create(applePayPayIn, function (data, response) {
480
- // done();
481
- // });
482
- // });
483
-
484
- // it('should be created', function () {
485
- // expect(applePayPayIn.Id).not.to.be.undefined;
486
- // expect(applePayPayIn.data.AuthorId).to.equal(john.Id);
487
- // expect(applePayPayIn.data.PaymentType).to.equal('APPLEPAY');
488
- // expect(applePayPayIn.data.ExecutionType).to.equal('DIRECT');
489
- // expect(applePayPayIn.data.Type).to.equal('PAYIN');
490
- // expect(applePayPayIn.data.Status).to.equal('SUCCEEDED');
491
- // });
492
- // });
493
- // });
494
-
495
- describe.skip('GooglePay', function () {
496
- var googlePayIn, wallet;
497
-
498
- before(function (done) {
499
- wallet = {
500
- Owners: [john.Id],
501
- Currency: 'EUR',
502
- Description: 'WALLET IN EUR'
503
- };
504
-
505
- api.Wallets.create(wallet).then(function () {
506
- done();
507
- });
508
- });
509
-
510
- describe('Create', function () {
511
-
512
- var paymentData = {
513
- TransactionId: 'placeholder',
514
- Network: 'placeholder',
515
- TokenData: "placeholder"
516
- };
517
-
518
- before(function (done) {
519
- googlePayIn = {
520
- CreditedWalletId: wallet.Id,
521
- AuthorId: john.Id,
522
- CreditedUserId: john.Id,
523
- DebitedFunds: {
524
- Amount: 199,
525
- Currency: 'EUR'
526
- },
527
- Fees: {
528
- Amount: 1,
529
- Currency: 'EUR'
530
- },
531
- PaymentType: 'GOOGLEPAY',
532
- ExecutionType: 'DIRECT',
533
- PaymentData: paymentData,
534
- Tag: "Create an GooglePay card direct Payin",
535
- StatementDescriptor: "php"
536
- };
537
-
538
- api.PayIns.create(googlePayIn, function (data, response) {
539
- done();
540
- });
541
- });
542
-
543
- it('should be created', function () {
544
- expect(googlePayIn.Id).not.to.be.undefined;
545
- expect(googlePayIn.data.AuthorId).to.equal(john.Id);
546
- expect(googlePayIn.data.PaymentType).to.equal('GOOGLEPAY');
547
- expect(googlePayIn.data.ExecutionType).to.equal('DIRECT');
548
- expect(googlePayIn.data.Type).to.equal('PAYIN');
549
- expect(googlePayIn.data.Status).to.equal('SUCCEEDED');
550
- });
551
- });
552
- });
553
-
554
- describe('Get Refunds', function () {
555
- var getRefunds;
556
-
557
- before(function (done) {
558
- api.PayIns.getRefunds(payIn.Id, function (data, response) {
559
- getRefunds = data;
560
- done();
561
- });
562
- });
563
-
564
- it('should be retrieved', function () {
565
- expect(getRefunds).not.to.be.undefined;
566
- expect(getRefunds).to.be.an('array');
567
- });
568
- });
569
-
570
- describe('ExetrnalInstructionIBAN', function () {
571
-
572
- describe('Get', function () {
573
- var getPayIn;
574
- before(function (done) {
575
- api.PayIns.get("payin_m_01JFA5CSPT3QBECGYDX6AKQ3QD", function (data, response) {
576
- getPayIn = data;
577
- done()
578
- });
579
- });
580
-
581
- it('should get the PayIn', function () {
582
- expect(getPayIn.PaymentType).to.equal('BANK_WIRE');
583
- expect(getPayIn.ExecutionType).to.equal('EXTERNAL_INSTRUCTION');
584
- expect(getPayIn.DebitedBankAccount.Type).to.equal('IBAN');
585
- expect(getPayIn.DebitedBankAccount.IBAN).not.to.be.null;
586
- expect(getPayIn.DebitedBankAccount.AccountNumber).to.be.null;
587
- });
588
- });
589
- });
590
-
591
- /*
592
- describe('ExetrnalInstructionAccountNumber', function () {
593
-
594
- describe('Get', function () {
595
- var getPayIn;
596
- before(function (done) {
597
- api.PayIns.get("74981216", function (data, response) {
598
- getPayIn = data;
599
- done()
600
- });
601
- });
602
-
603
- it('should get the PayIn', function () {
604
- expect(getPayIn.PaymentType).to.equal('BANK_WIRE');
605
- expect(getPayIn.ExecutionType).to.equal('EXTERNAL_INSTRUCTION');
606
- expect(getPayIn.DebitedBankAccount.Type).to.equal('OTHER');
607
- expect(getPayIn.DebitedBankAccount.IBAN).to.be.null;
608
- expect(getPayIn.DebitedBankAccount.AccountNumber).not.to.be.null;
609
- });
610
- });
611
- });
612
- */
613
-
614
- describe('Recurring Payments', function() {
615
- var cardId;
616
- var walletId;
617
- var createdPayPalCit;
618
- before('Create a wallet with money and a card', function(done){
619
- wallet = {
620
- Owners: [john.Id],
621
- Currency: 'EUR',
622
- Description: 'WALLET IN EUR'
623
- };
624
- cardRegistration = {
625
- UserId: john.Id,
626
- Currency: 'EUR'
627
- };
628
- api.Wallets.create(wallet).then(function(){
629
- api.CardRegistrations.create(cardRegistration, function() {
630
- helpers.getPaylineCorrectRegistartionData(cardRegistration, function(data, response){
631
- cardRegistration.RegistrationData = data;
632
- api.CardRegistrations.update(cardRegistration).then(function(data){
633
- updatedCardRegistration = data;
634
- cardId = updatedCardRegistration.CardId;
635
- walletId = wallet.Id;
636
- api.Cards.get(cardRegistration.CardId, function(data, response) {
637
- card = data;
638
- api.PayIns.create({
639
- CreditedWalletId: wallet.Id,
640
- AuthorId: john.Id,
641
- DebitedFunds: {
642
- Amount: 100,
643
- Currency: 'EUR'
644
- },
645
- Fees: {
646
- Amount: 0,
647
- Currency: 'EUR'
648
- },
649
- CardId: card.Id,
650
- SecureMode: 'DEFAULT',
651
- SecureModeReturnURL: 'https://test.com',
652
- PaymentType: 'CARD',
653
- ExecutionType: 'DIRECT',
654
- BrowserInfo: {
655
- AcceptHeader: "text/html, application/xhtml+xml, application/xml;q=0.9, /;q=0.8",
656
- JavaEnabled: true,
657
- Language: "FR-FR",
658
- ColorDepth: 4,
659
- ScreenHeight: 1800,
660
- ScreenWidth: 400,
661
- JavascriptEnabled: true,
662
- TimeZoneOffset: "+60",
663
- UserAgent: "Mozilla/5.0 (iPhone; CPU iPhone OS 13_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148"
664
- },
665
- IpAddress: "2001:0620:0000:0000:0211:24FF:FE80:C12C"
666
- }, function(data, response) {
667
- done();
668
- });
669
- });
670
- });
671
- });
672
- });
673
- });
674
- });
675
-
676
- describe('Create a Recurring Payment', function() {
677
- var recurring;
678
- var createdCit;
679
- before(function(done){
680
- const recurringPayin = {
681
- AuthorId: john.Id,
682
- CardId: cardId,
683
- CreditedUserId: john.Id,
684
- CreditedWalletId: walletId,
685
- FirstTransactionDebitedFunds: {
686
- Amount: 10,
687
- Currency: 'EUR'
688
- },
689
- FirstTransactionFees: {
690
- Amount: 1,
691
- Currency: 'EUR'
692
- },
693
- Billing: {
694
- FirstName: 'Joe',
695
- LastName: 'Blogs',
696
- Address: {
697
- AddressLine1: '1 MangoPay Street',
698
- AddressLine2: 'The Loop',
699
- City: 'Paris',
700
- Region: 'Ile de France',
701
- PostalCode: '75001',
702
- Country: 'FR'
703
- }
704
- },
705
- Shipping: {
706
- FirstName: 'Joe',
707
- LastName: 'Blogs',
708
- Address: {
709
- AddressLine1: '1 MangoPay Street',
710
- AddressLine2: 'The Loop',
711
- City: 'Paris',
712
- Region: 'Ile de France',
713
- PostalCode: '75001',
714
- Country: 'FR'
715
- }
716
- },
717
- FreeCycles: 0
718
- };
719
-
720
- api.PayIns.createRecurringPayment(recurringPayin, function(data, response){
721
- recurring = data;
722
- }).then(function(){
723
- const cit = {
724
- RecurringPayinRegistrationId: recurring.Id,
725
- BrowserInfo: {
726
- AcceptHeader: "text/html, application/xhtml+xml, application/xml;q=0.9, /;q=0.8",
727
- JavaEnabled: true,
728
- Language: "FR-FR",
729
- ColorDepth: 4,
730
- ScreenHeight: 1800,
731
- ScreenWidth: 400,
732
- JavascriptEnabled: true,
733
- TimeZoneOffset: "+60",
734
- UserAgent: "Mozilla/5.0 (iPhone; CPU iPhone OS 13_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148"
735
- },
736
- IpAddress: "2001:0620:0000:0000:0211:24FF:FE80:C12C",
737
- SecureModeReturnURL: "http://www.my-site.com/returnurl",
738
- StatementDescriptor: "lorem",
739
- Tag: "custom meta",
740
- DebitedFunds: {
741
- Amount: 10,
742
- Currency: 'EUR'
743
- },
744
- Fees: {
745
- Amount: 1,
746
- Currency: 'EUR'
747
- },
748
- };
749
-
750
- api.PayIns.createRecurringPayInRegistrationCIT(cit, function(data, response){
751
- createdCit = data;
752
- done();
753
- });
754
- });
755
- });
756
-
757
- it('should be created', function() {
758
- expect(recurring).to.not.be.null;
759
- expect(recurring.FreeCycles).to.not.be.null;
760
- expect(createdCit).to.not.be.null;
761
- expect(createdCit.PaymentCategory).to.not.be.null;
762
- });
763
- });
764
-
765
- describe('Create a PayPal Recurring Payment CIT', function() {
766
- var recurring;
767
- before(function(done){
768
- var recurringPayinRegistration = {
769
- AuthorId: john.Id,
770
- CreditedWalletId: walletId,
771
- FirstTransactionDebitedFunds: {
772
- Amount: 1000,
773
- Currency: 'EUR'
774
- },
775
- FirstTransactionFees: {
776
- Amount: 1,
777
- Currency: 'EUR'
778
- },
779
- Billing: {
780
- FirstName: 'Joe',
781
- LastName: 'Blogs',
782
- Address: {
783
- AddressLine1: '1 MangoPay Street',
784
- AddressLine2: 'The Loop',
785
- City: 'Paris',
786
- Region: 'Ile de France',
787
- PostalCode: '75001',
788
- Country: 'FR'
789
- }
790
- },
791
- Shipping: {
792
- FirstName: 'Joe',
793
- LastName: 'Blogs',
794
- Address: {
795
- AddressLine1: '1 MangoPay Street',
796
- AddressLine2: 'The Loop',
797
- City: 'Paris',
798
- Region: 'Ile de France',
799
- PostalCode: '75001',
800
- Country: 'FR'
801
- }
802
- },
803
- PaymentType: 'PAYPAL'
804
- };
805
-
806
- api.PayIns.createRecurringPayment(recurringPayinRegistration, function(data, response){
807
- recurringPayinRegistration = data;
808
- }).then(function(){
809
- var cit = {
810
- RecurringPayinRegistrationId: recurringPayinRegistration.Id,
811
- StatementDescriptor: "lorem",
812
- Tag: "custom meta",
813
- LineItems: [
814
- {
815
- Name: "running shoes",
816
- Quantity: 1,
817
- UnitAmount: 1000,
818
- TaxAmount: 0,
819
- Description: "seller1 ID"
820
- }
821
- ],
822
- ReturnURL: 'http://example.com',
823
- CancelURL: 'http://example.net',
824
- ShippingPreference: 'SET_PROVIDED_ADDRESS',
825
- Reference: 'abcd-efgh-ijkl'
826
- };
827
-
828
- api.PayIns.createRecurringPayPalPayInCIT(cit, function(data){
829
- createdPayPalCit = data;
830
- done();
831
- });
832
- });
833
- });
834
-
835
- it('should be created', function() {
836
- expect(createdPayPalCit).to.not.be.null;
837
- // expect(createdPayPalCit.Status).to.eq('CREATED');
838
- expect(createdPayPalCit.PaymentType).to.eq('PAYPAL');
839
- expect(createdPayPalCit.ExecutionType).to.eq('WEB');
840
- });
841
- });
842
-
843
- describe('Create a Recurring Payment Check Card Info', function() {
844
- var recurring;
845
- before(function(done){
846
- recurringPayin = {
847
- AuthorId: john.Id,
848
- CardId: cardId,
849
- CreditedUserId: john.Id,
850
- CreditedWalletId: walletId,
851
- FirstTransactionDebitedFunds: {
852
- Amount: 10,
853
- Currency: 'EUR'
854
- },
855
- FirstTransactionFees: {
856
- Amount: 1,
857
- Currency: 'EUR'
858
- },
859
- Billing: {
860
- FirstName: 'Joe',
861
- LastName: 'Blogs',
862
- Address: {
863
- AddressLine1: '1 MangoPay Street',
864
- AddressLine2: 'The Loop',
865
- City: 'Paris',
866
- Region: 'Ile de France',
867
- PostalCode: '75001',
868
- Country: 'FR'
869
- }
870
- },
871
- Shipping: {
872
- FirstName: 'Joe',
873
- LastName: 'Blogs',
874
- Address: {
875
- AddressLine1: '1 MangoPay Street',
876
- AddressLine2: 'The Loop',
877
- City: 'Paris',
878
- Region: 'Ile de France',
879
- PostalCode: '75001',
880
- Country: 'FR'
881
- }
882
- },
883
- FreeCycles: 0
884
- };
885
-
886
- api.PayIns.createRecurringPayment(recurringPayin, function(data, response){
887
- recurring = data;
888
- }).then(function(){
889
- cit = {
890
- RecurringPayinRegistrationId: recurring.Id,
891
- BrowserInfo: {
892
- AcceptHeader: "text/html, application/xhtml+xml, application/xml;q=0.9, /;q=0.8",
893
- JavaEnabled: true,
894
- Language: "FR-FR",
895
- ColorDepth: 4,
896
- ScreenHeight: 1800,
897
- ScreenWidth: 400,
898
- JavascriptEnabled: true,
899
- TimeZoneOffset: "+60",
900
- UserAgent: "Mozilla/5.0 (iPhone; CPU iPhone OS 13_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148"
901
- },
902
- IpAddress: "2001:0620:0000:0000:0211:24FF:FE80:C12C",
903
- SecureModeReturnURL: "http://www.my-site.com/returnurl",
904
- StatementDescriptor: "lorem",
905
- Tag: "custom meta",
906
- DebitedFunds: {
907
- Amount: 10,
908
- Currency: 'EUR'
909
- },
910
- Fees: {
911
- Amount: 1,
912
- Currency: 'EUR'
913
- },
914
- };
915
-
916
- api.PayIns.createRecurringPayInRegistrationCIT(cit, function(data, response){
917
- createCit = data;
918
- done();
919
- });
920
- });
921
- });
922
-
923
- it('should be created', function() {
924
- expect(createCit.CardInfo).to.not.be.null;
925
- // expect(createCit.CardInfo.Type).to.not.be.null;
926
- // expect(createCit.CardInfo.Brand).to.not.be.null;
927
- // expect(createCit.CardInfo.IssuingBank).to.not.be.null;
928
- // expect(createCit.CardInfo.BIN).to.not.be.null;
929
- });
930
- });
931
-
932
- describe('Get Recurring Payment', function () {
933
- var recurring;
934
- before(function(done){
935
- recurringPayin = {
936
- AuthorId: john.Id,
937
- CardId: cardId,
938
- CreditedUserId: john.Id,
939
- CreditedWalletId: walletId,
940
- FirstTransactionDebitedFunds: {
941
- Amount: 10,
942
- Currency: 'EUR'
943
- },
944
- FirstTransactionFees: {
945
- Amount: 1,
946
- Currency: 'EUR'
947
- },
948
- Billing: {
949
- FirstName: 'Joe',
950
- LastName: 'Blogs',
951
- Address: {
952
- AddressLine1: '1 MangoPay Street',
953
- AddressLine2: 'The Loop',
954
- City: 'Paris',
955
- Region: 'Ile de France',
956
- PostalCode: '75001',
957
- Country: 'FR'
958
- }
959
- },
960
- Shipping: {
961
- FirstName: 'Joe',
962
- LastName: 'Blogs',
963
- Address: {
964
- AddressLine1: '1 MangoPay Street',
965
- AddressLine2: 'The Loop',
966
- City: 'Paris',
967
- Region: 'Ile de France',
968
- PostalCode: '75001',
969
- Country: 'FR'
970
- }
971
- },
972
- FreeCycles: 0
973
- };
974
-
975
- api.PayIns.createRecurringPayment(recurringPayin, function(data, response){
976
- recurring = data;
977
- }).then(function(){
978
- api.PayIns.getRecurringPayin(recurring.Id, function (data, response) {
979
- getRecurring = data;
980
- done();
981
- });
982
- });
983
- });
984
-
985
- it('should get the RecurringPayin', function () {
986
- expect(getRecurring.Id).not.to.be.undefined;
987
- expect(getRecurring.Status).not.to.be.undefined;
988
- expect(getRecurring.FreeCycles).not.to.be.undefined;
989
- });
990
- });
991
-
992
- describe('Update Recurring Payment', function () {
993
- var recurring, updateRec;
994
- before(function(done){
995
- recurringPayin = {
996
- AuthorId: john.Id,
997
- CardId: cardId,
998
- CreditedUserId: john.Id,
999
- CreditedWalletId: walletId,
1000
- FirstTransactionDebitedFunds: {
1001
- Amount: 10,
1002
- Currency: 'EUR'
1003
- },
1004
- FirstTransactionFees: {
1005
- Amount: 1,
1006
- Currency: 'EUR'
1007
- },
1008
- Billing: {
1009
- FirstName: 'Joe',
1010
- LastName: 'Blogs',
1011
- Address: {
1012
- AddressLine1: '1 MangoPay Street',
1013
- AddressLine2: 'The Loop',
1014
- City: 'Paris',
1015
- Region: 'Ile de France',
1016
- PostalCode: '75001',
1017
- Country: 'FR'
1018
- }
1019
- },
1020
- Shipping: {
1021
- FirstName: 'Joe',
1022
- LastName: 'Blogs',
1023
- Address: {
1024
- AddressLine1: '1 MangoPay Street',
1025
- AddressLine2: 'The Loop',
1026
- City: 'Paris',
1027
- Region: 'Ile de France',
1028
- PostalCode: '75001',
1029
- Country: 'FR'
1030
- }
1031
- }
1032
- };
1033
-
1034
- api.PayIns.createRecurringPayment(recurringPayin, function (data, response) {
1035
- recurring = data;
1036
- }).then(function () {
1037
- updateObj = {
1038
- Billing: {
1039
- FirstName: 'TEST',
1040
- LastName: 'TEST',
1041
- Address: {
1042
- AddressLine1: '1 MangoPay Street',
1043
- AddressLine2: 'The Loop',
1044
- City: 'Paris',
1045
- Region: 'Ile de France',
1046
- PostalCode: '75001',
1047
- Country: 'FR'
1048
- }
1049
- },
1050
- Shipping: {
1051
- FirstName: 'TEST',
1052
- LastName: 'TEST',
1053
- Address: {
1054
- AddressLine1: '1 MangoPay Street',
1055
- AddressLine2: 'The Loop',
1056
- City: 'Paris',
1057
- Region: 'Ile de France',
1058
- PostalCode: '75001',
1059
- Country: 'FR'
1060
- }
1061
- },
1062
- Status: "ENDED"
1063
- };
1064
-
1065
- api.PayIns.updateRecurringPayin(recurring.Id, updateObj, function (data, response) {
1066
- updateRec = data;
1067
- done();
1068
- });
1069
- });
1070
- });
1071
-
1072
- it('should get the updated RecurringPayin', function () {
1073
- expect(updateRec.Id).not.to.be.undefined;
1074
- expect(updateRec.Status).not.to.be.undefined;
1075
- expect(updateRec.Status).to.equal("ENDED");
1076
- });
1077
- });
1078
- });
1079
-
1080
- describe('Mbway Web', function () {
1081
- var payIn;
1082
-
1083
- before(function (done) {
1084
- helpers.getNewPayInMbwayWeb(api, john, function (data, response) {
1085
- payIn = data;
1086
- done();
1087
- });
1088
- });
1089
-
1090
- describe('Create', function () {
1091
- it('should create the PayIn', function () {
1092
- expect(payIn.Id).not.to.be.undefined;
1093
- expect(payIn.PaymentType).to.equal('MBWAY');
1094
- expect(payIn.ExecutionType).to.equal('WEB');
1095
- expect(payIn.AuthorId).to.equal(john.Id);
1096
- expect(payIn.Status).to.equal('CREATED');
1097
- expect(payIn.Type).to.equal('PAYIN');
1098
- expect(payIn.Phone).not.to.be.null;
1099
- });
1100
- });
1101
-
1102
- describe('Get', function () {
1103
- var getPayIn;
1104
- before(function (done) {
1105
- api.PayIns.get(payIn.Id, function (data, response) {
1106
- getPayIn = data;
1107
- done()
1108
- });
1109
- });
1110
-
1111
- it('should get the PayIn', function () {
1112
- expect(getPayIn.Id).to.equal(payIn.Id);
1113
- expect(getPayIn.PaymentType).to.equal('MBWAY');
1114
- expect(getPayIn.ExecutionType).to.equal('WEB');
1115
- expect(getPayIn.Phone).not.to.be.null;
1116
- });
1117
- });
1118
- });
1119
-
1120
- describe('Bancontact Web', function () {
1121
- var payIn;
1122
-
1123
- before(function (done) {
1124
- helpers.getNewPayInBancontactWeb(api, john, function (data, response) {
1125
- payIn = data;
1126
- done();
1127
- });
1128
- });
1129
-
1130
- describe('Create', function () {
1131
- it('should create the PayIn', function () {
1132
- expect(payIn.Id).not.to.be.undefined;
1133
- expect(payIn.PaymentType).to.equal('BCMC');
1134
- expect(payIn.ExecutionType).to.equal('WEB');
1135
- expect(payIn.AuthorId).to.equal(john.Id);
1136
- expect(payIn.Status).to.equal('CREATED');
1137
- expect(payIn.Type).to.equal('PAYIN');
1138
- expect(payIn.Recurring).not.to.be.null;
1139
- });
1140
- });
1141
-
1142
- describe('Get', function () {
1143
- var getPayIn;
1144
- before(function (done) {
1145
- api.PayIns.get(payIn.Id, function (data, response) {
1146
- getPayIn = data;
1147
- done()
1148
- });
1149
- });
1150
-
1151
- it('should get the PayIn', function () {
1152
- expect(getPayIn.Id).to.equal(payIn.Id);
1153
- expect(getPayIn.PaymentType).to.equal('BCMC');
1154
- expect(getPayIn.ExecutionType).to.equal('WEB');
1155
- expect(getPayIn.Phone).not.to.be.null;
1156
- });
1157
- });
1158
- });
1159
-
1160
- describe('Bizum Web', function () {
1161
- var payInWithPhone;
1162
- var payInWithReturnUrl;
1163
-
1164
- before(function (done) {
1165
- helpers.getNewPayInBizumWebWithPhone(api, john, function (data, response) {
1166
- payInWithPhone = data;
1167
- helpers.getNewPayInBizumWebWithReturnUrl(api, john, function (data) {
1168
- payInWithReturnUrl = data;
1169
- done();
1170
- });
1171
- });
1172
- });
1173
-
1174
- describe('Create', function () {
1175
- it('should create Bizum PayIn with Phone', function () {
1176
- expect(payInWithPhone.Id).not.to.be.undefined;
1177
- expect(payInWithPhone.PaymentType).to.equal('BIZUM');
1178
- expect(payInWithPhone.ExecutionType).to.equal('WEB');
1179
- expect(payInWithPhone.AuthorId).to.equal(john.Id);
1180
- expect(payInWithPhone.Status).to.equal('CREATED');
1181
- expect(payInWithPhone.Type).to.equal('PAYIN');
1182
- expect(payInWithPhone.Phone).not.to.be.null;
1183
- expect(payInWithPhone.ReturnURL).to.be.undefined;
1184
- });
1185
- it('should create Bizum PayIn with ReturnUrl', function () {
1186
- expect(payInWithReturnUrl.Id).not.to.be.undefined;
1187
- expect(payInWithReturnUrl.PaymentType).to.equal('BIZUM');
1188
- expect(payInWithReturnUrl.ExecutionType).to.equal('WEB');
1189
- expect(payInWithReturnUrl.AuthorId).to.equal(john.Id);
1190
- expect(payInWithReturnUrl.Status).to.equal('CREATED');
1191
- expect(payInWithReturnUrl.Type).to.equal('PAYIN');
1192
- expect(payInWithReturnUrl.Phone).to.be.null;
1193
- expect(payInWithReturnUrl.ReturnURL).not.to.be.null;
1194
- });
1195
- });
1196
-
1197
- describe('Get', function () {
1198
- var getPayInWithPhone;
1199
- var getPayInWithReturnUrl;
1200
-
1201
- before(function (done) {
1202
- api.PayIns.get(payInWithPhone.Id, function (data, response) {
1203
- getPayInWithPhone = data;
1204
- api.PayIns.get(payInWithReturnUrl.Id, function (data, response) {
1205
- getPayInWithReturnUrl = data;
1206
- done();
1207
- });
1208
- });
1209
- });
1210
-
1211
- it('should get Bizum PayIn with Phone', function () {
1212
- expect(getPayInWithPhone.Id).to.equal(payInWithPhone.Id);
1213
- expect(getPayInWithPhone.PaymentType).to.equal('BIZUM');
1214
- expect(getPayInWithPhone.ExecutionType).to.equal('WEB');
1215
- expect(getPayInWithPhone.Phone).not.to.be.null;
1216
- expect(getPayInWithPhone.Phone).to.equal(payInWithPhone.Phone);
1217
- expect(getPayInWithPhone.ReturnURL).to.equal(payInWithPhone.ReturnURL);
1218
- expect(getPayInWithPhone.ReturnURL).to.be.undefined;
1219
- });
1220
-
1221
- it('should get the Bizum with ReturnUrl', function () {
1222
- expect(getPayInWithReturnUrl.Id).to.equal(payInWithReturnUrl.Id);
1223
- expect(getPayInWithReturnUrl.PaymentType).to.equal('BIZUM');
1224
- expect(getPayInWithReturnUrl.ExecutionType).to.equal('WEB');
1225
- expect(getPayInWithReturnUrl.Phone).to.be.null;
1226
- expect(getPayInWithReturnUrl.ReturnURL).not.to.be.null;
1227
- expect(getPayInWithReturnUrl.ReturnURL).to.equal(payInWithReturnUrl.ReturnURL);
1228
- });
1229
- });
1230
- });
1231
-
1232
- describe('PayPal Web V2', function () {
1233
- var payIn;
1234
-
1235
- before(function (done) {
1236
- helpers.getNewPayInPayPalWeb(api, john, function (data, response) {
1237
- payIn = data;
1238
- done();
1239
- });
1240
- });
1241
-
1242
- describe('Create', function () {
1243
- it('should create the PayIn', function () {
1244
- expect(payIn.Id).not.to.be.undefined;
1245
- expect(payIn.PaymentType).to.equal('PAYPAL');
1246
- expect(payIn.ExecutionType).to.equal('WEB');
1247
- expect(payIn.AuthorId).to.equal(john.Id);
1248
- // expect(payIn.Status).to.equal('CREATED');
1249
- expect(payIn.Type).to.equal('PAYIN');
1250
- expect(payIn.LineItems).not.to.be.null;
1251
- });
1252
- });
1253
-
1254
- describe('Get', function () {
1255
- var getPayIn;
1256
- before(function (done) {
1257
- api.PayIns.get(payIn.Id, function (data, response) {
1258
- getPayIn = data;
1259
- done()
1260
- });
1261
- });
1262
-
1263
- it('should get the PayIn', function () {
1264
- expect(getPayIn.Id).to.equal(payIn.Id);
1265
- expect(getPayIn.PaymentType).to.equal('PAYPAL');
1266
- expect(getPayIn.ExecutionType).to.equal('WEB');
1267
- });
1268
- });
1269
- })
1270
-
1271
- describe('Multibanco Web', function () {
1272
- var payIn;
1273
-
1274
- before(function (done) {
1275
- helpers.getNewPayInMultibancoWeb(api, john, function (data) {
1276
- payIn = data;
1277
- done();
1278
- });
1279
- });
1280
-
1281
- describe('Create', function () {
1282
- it('should create the PayIn', function () {
1283
- expect(payIn.Id).not.to.be.undefined;
1284
- expect(payIn.PaymentType).to.equal('MULTIBANCO');
1285
- expect(payIn.ExecutionType).to.equal('WEB');
1286
- expect(payIn.AuthorId).to.equal(john.Id);
1287
- expect(payIn.Status).to.equal('CREATED');
1288
- expect(payIn.Type).to.equal('PAYIN');
1289
- expect(payIn.Phone).not.to.be.null;
1290
- });
1291
- });
1292
-
1293
- describe('Get', function () {
1294
- var getPayIn;
1295
- before(function (done) {
1296
- api.PayIns.get(payIn.Id, function (data, response) {
1297
- getPayIn = data;
1298
- done()
1299
- });
1300
- });
1301
-
1302
- it('should get the PayIn', function () {
1303
- expect(getPayIn.Id).to.equal(payIn.Id);
1304
- expect(getPayIn.PaymentType).to.equal('MULTIBANCO');
1305
- expect(getPayIn.ExecutionType).to.equal('WEB');
1306
- expect(getPayIn.Phone).not.to.be.null;
1307
- });
1308
- });
1309
- });
1310
-
1311
- describe('Satispay Web', function () {
1312
- var payIn;
1313
-
1314
- before(function (done) {
1315
- helpers.getNewPayInSatispayWeb(api, john, function (data) {
1316
- payIn = data;
1317
- done();
1318
- });
1319
- });
1320
-
1321
- describe('Create', function () {
1322
- it('should create the PayIn', function () {
1323
- expect(payIn.Id).not.to.be.undefined;
1324
- expect(payIn.PaymentType).to.equal('SATISPAY');
1325
- expect(payIn.ExecutionType).to.equal('WEB');
1326
- expect(payIn.AuthorId).to.equal(john.Id);
1327
- expect(payIn.Status).to.equal('CREATED');
1328
- expect(payIn.Type).to.equal('PAYIN');
1329
- expect(payIn.Phone).not.to.be.null;
1330
- });
1331
- });
1332
-
1333
- describe('Get', function () {
1334
- var getPayIn;
1335
- before(function (done) {
1336
- api.PayIns.get(payIn.Id, function (data, response) {
1337
- getPayIn = data;
1338
- done()
1339
- });
1340
- });
1341
-
1342
- it('should get the PayIn', function () {
1343
- expect(getPayIn.Id).to.equal(payIn.Id);
1344
- expect(getPayIn.PaymentType).to.equal('SATISPAY');
1345
- expect(getPayIn.ExecutionType).to.equal('WEB');
1346
- expect(getPayIn.Phone).not.to.be.null;
1347
- });
1348
- });
1349
- });
1350
-
1351
- describe('Blik Web', function () {
1352
- var payIn;
1353
- var payInWithCode;
1354
-
1355
- before(function (done) {
1356
- helpers.getNewPayInBlikWeb(api, john, function (data) {
1357
- payIn = data;
1358
- helpers.getNewPayInBlikWebWithCode(api, john, function (data) {
1359
- payInWithCode = data;
1360
- done();
1361
- });
1362
- });
1363
- });
1364
-
1365
- describe('Create', function () {
1366
- it('should create the PayIn', function () {
1367
- expect(payIn.Id).not.to.be.undefined;
1368
- expect(payIn.PaymentType).to.equal('BLIK');
1369
- expect(payIn.ExecutionType).to.equal('WEB');
1370
- expect(payIn.AuthorId).to.equal(john.Id);
1371
- expect(payIn.Status).to.equal('CREATED');
1372
- expect(payIn.Type).to.equal('PAYIN');
1373
- expect(payIn.Phone).not.to.be.null;
1374
- });
1375
-
1376
- it('should create the PayIn with code', function () {
1377
- expect(payIn.Id).not.to.be.undefined;
1378
- expect(payIn.PaymentType).to.equal('BLIK');
1379
- expect(payIn.ExecutionType).to.equal('WEB');
1380
- expect(payIn.Code).not.to.be.undefined;
1381
- expect(payIn.IpAddress).not.to.be.undefined;
1382
- expect(payIn.BrowserInfo).not.to.be.undefined;
1383
- });
1384
- });
1385
-
1386
- describe('Get', function () {
1387
- var getPayIn;
1388
- before(function (done) {
1389
- api.PayIns.get(payIn.Id, function (data, response) {
1390
- getPayIn = data;
1391
- done()
1392
- });
1393
- });
1394
-
1395
- it('should get the PayIn', function () {
1396
- expect(getPayIn.Id).to.equal(payIn.Id);
1397
- expect(getPayIn.PaymentType).to.equal('BLIK');
1398
- expect(getPayIn.ExecutionType).to.equal('WEB');
1399
- expect(getPayIn.Phone).not.to.be.null;
1400
- });
1401
- });
1402
- });
1403
-
1404
- describe('Klarna Web', function () {
1405
- var payIn;
1406
-
1407
- before(function (done) {
1408
- helpers.getNewPayInKlarnaWeb(api, john, function (data) {
1409
- payIn = data;
1410
- done();
1411
- });
1412
- });
1413
-
1414
- describe('Create', function () {
1415
- it('should create the PayIn', function () {
1416
- expect(payIn.Id).not.to.be.undefined;
1417
- expect(payIn.PaymentType).to.equal('KLARNA');
1418
- expect(payIn.ExecutionType).to.equal('WEB');
1419
- expect(payIn.AuthorId).to.equal(john.Id);
1420
- expect(payIn.Type).to.equal('PAYIN');
1421
- expect(payIn.Phone).not.to.be.null;
1422
- expect(payIn.LineItems[1].Discount).to.equal(10);
1423
- });
1424
- });
1425
-
1426
- describe('Get', function () {
1427
- var getPayIn;
1428
- before(function (done) {
1429
- api.PayIns.get(payIn.Id, function (data, response) {
1430
- getPayIn = data;
1431
- done()
1432
- });
1433
- });
1434
-
1435
- it('should get the PayIn', function () {
1436
- expect(getPayIn.Id).to.equal(payIn.Id);
1437
- expect(getPayIn.PaymentType).to.equal('KLARNA');
1438
- expect(getPayIn.ExecutionType).to.equal('WEB');
1439
- expect(getPayIn.Phone).not.to.be.null;
1440
- });
1441
- });
1442
- });
1443
-
1444
- describe('Ideal Web', function () {
1445
- var payIn;
1446
-
1447
- before(function (done) {
1448
- helpers.getNewPayInIdealWeb(api, john, function (data) {
1449
- payIn = data;
1450
- done();
1451
- });
1452
- });
1453
-
1454
- describe('Create', function () {
1455
- it('should create the PayIn', function () {
1456
- expect(payIn.Id).not.to.be.undefined;
1457
- expect(payIn.PaymentType).to.equal('IDEAL');
1458
- expect(payIn.ExecutionType).to.equal('WEB');
1459
- expect(payIn.AuthorId).to.equal(john.Id);
1460
- expect(payIn.Type).to.equal('PAYIN');
1461
- expect(payIn.Phone).not.to.be.null;
1462
- });
1463
- });
1464
-
1465
- describe('Get', function () {
1466
- var getPayIn;
1467
- before(function (done) {
1468
- api.PayIns.get(payIn.Id, function (data, response) {
1469
- getPayIn = data;
1470
- done()
1471
- });
1472
- });
1473
-
1474
- it('should get the PayIn', function () {
1475
- expect(getPayIn.Id).to.equal(payIn.Id);
1476
- expect(getPayIn.PaymentType).to.equal('IDEAL');
1477
- expect(getPayIn.ExecutionType).to.equal('WEB');
1478
- expect(getPayIn.Phone).not.to.be.null;
1479
- });
1480
- });
1481
- });
1482
-
1483
- describe('Giropay Web', function () {
1484
- var payIn;
1485
-
1486
- before(function (done) {
1487
- helpers.getNewPayInGiropayWeb(api, john, function (data) {
1488
- payIn = data;
1489
- done();
1490
- });
1491
- });
1492
-
1493
- describe('Create', function () {
1494
- it('should create the PayIn', function () {
1495
- expect(payIn.Id).not.to.be.undefined;
1496
- expect(payIn.PaymentType).to.equal('GIROPAY');
1497
- expect(payIn.ExecutionType).to.equal('WEB');
1498
- expect(payIn.AuthorId).to.equal(john.Id);
1499
- expect(payIn.Type).to.equal('PAYIN');
1500
- expect(payIn.Phone).not.to.be.null;
1501
- });
1502
- });
1503
-
1504
- describe('Get', function () {
1505
- var getPayIn;
1506
- before(function (done) {
1507
- api.PayIns.get(payIn.Id, function (data, response) {
1508
- getPayIn = data;
1509
- done();
1510
- });
1511
- });
1512
-
1513
- it('should get the PayIn', function () {
1514
- expect(getPayIn.Id).to.equal(payIn.Id);
1515
- expect(getPayIn.PaymentType).to.equal('GIROPAY');
1516
- expect(getPayIn.ExecutionType).to.equal('WEB');
1517
- expect(getPayIn.Phone).not.to.be.null;
1518
- });
1519
- });
1520
- });
1521
-
1522
- describe('Swish Web', function () {
1523
- var payIn;
1524
-
1525
- before(function (done) {
1526
- helpers.getNewPayInSwishWeb(api, john, function (data) {
1527
- payIn = data;
1528
- done();
1529
- });
1530
- });
1531
-
1532
- describe('Create', function () {
1533
- it('should create the PayIn', function () {
1534
- expect(payIn.Id).not.to.be.undefined;
1535
- expect(payIn.PaymentType).to.equal('SWISH');
1536
- expect(payIn.ExecutionType).to.equal('WEB');
1537
- expect(payIn.AuthorId).to.equal(john.Id);
1538
- expect(payIn.Type).to.equal('PAYIN');
1539
- expect(payIn.Phone).not.to.be.null;
1540
- });
1541
- });
1542
-
1543
- describe('Get', function () {
1544
- var getPayIn;
1545
- before(function (done) {
1546
- api.PayIns.get(payIn.Id, function (data, response) {
1547
- getPayIn = data;
1548
- done();
1549
- });
1550
- });
1551
-
1552
- it('should get the PayIn', function () {
1553
- expect(getPayIn.Id).to.equal(payIn.Id);
1554
- expect(getPayIn.PaymentType).to.equal('SWISH');
1555
- expect(getPayIn.ExecutionType).to.equal('WEB');
1556
- expect(getPayIn.Phone).not.to.be.null;
1557
- });
1558
- });
1559
- });
1560
-
1561
- describe('Twint Web', function () {
1562
- var payIn;
1563
-
1564
- before(function (done) {
1565
- helpers.getNewPayInTwintWeb(api, john, function (data) {
1566
- payIn = data;
1567
- done();
1568
- });
1569
- });
1570
-
1571
- describe('Create', function () {
1572
- it('should create the PayIn', function () {
1573
- expect(payIn.Id).not.to.be.undefined;
1574
- expect(payIn.PaymentType).to.equal('TWINT');
1575
- expect(payIn.ExecutionType).to.equal('WEB');
1576
- expect(payIn.AuthorId).to.equal(john.Id);
1577
- expect(payIn.Type).to.equal('PAYIN');
1578
- expect(payIn.Phone).not.to.be.null;
1579
- });
1580
- });
1581
-
1582
- describe('Get', function () {
1583
- var getPayIn;
1584
- before(function (done) {
1585
- api.PayIns.get(payIn.Id, function (data, response) {
1586
- getPayIn = data;
1587
- done();
1588
- });
1589
- });
1590
-
1591
- it('should get the PayIn', function () {
1592
- expect(getPayIn.Id).to.equal(payIn.Id);
1593
- expect(getPayIn.PaymentType).to.equal('TWINT');
1594
- expect(getPayIn.ExecutionType).to.equal('WEB');
1595
- expect(getPayIn.Phone).not.to.be.null;
1596
- });
1597
- });
1598
- });
1599
-
1600
- describe('Ideal Legacy Web', function () {
1601
- var payIn;
1602
-
1603
- before(function (done) {
1604
- helpers.getLegacyPayInIdealCardWeb(api, john, function (data) {
1605
- payIn = data;
1606
- done();
1607
- });
1608
- });
1609
-
1610
- describe('Create', function () {
1611
- it('should create the legacy PayIn', function () {
1612
- expect(payIn.Id).not.to.be.undefined;
1613
- expect(payIn.BankName).not.to.be.null;
1614
- expect(payIn.CardType).to.equal('IDEAL');
1615
- expect(payIn.PaymentType).to.equal('CARD');
1616
- expect(payIn.ExecutionType).to.equal('WEB');
1617
- expect(payIn.AuthorId).to.equal(john.Id);
1618
- expect(payIn.Type).to.equal('PAYIN');
1619
- expect(payIn.Phone).not.to.be.null;
1620
- });
1621
- });
1622
- });
1623
-
1624
- // skip because we cannot generate new paymentData in the tests
1625
- describe.skip('GooglePay V2', function () {
1626
- var googlePayIn, wallet;
1627
-
1628
- before(function (done) {
1629
- wallet = {
1630
- Owners: [john.Id],
1631
- Currency: 'EUR',
1632
- Description: 'WALLET IN EUR'
1633
- };
1634
-
1635
- api.Wallets.create(wallet).then(function () {
1636
- done();
1637
- });
1638
- });
1639
-
1640
- describe('Create', function () {
1641
-
1642
- var paymentData = "{\"signature\":\"MEUCIQCLXOan2Y9DobLVSOeD5V64Peayvz0ZAWisdz/1iTdthAIgVFb4Hve4EhtW81k46S" +
1643
- "iMlnXLIiCn1h2+vVQGjHe+sSo\\u003d\",\"intermediateSigningKey\":{\"signedKey\":\"{\\\"keyValue\\\":\\\"M" +
1644
- "FkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEDGRER6R6PH6K39YTIYX+CpDNej6gQgvi/Wx19SOPtiDnkjAl4/LF9pXlvZYe+aJH0Dy" +
1645
- "095I6BlfY8bNBB5gjPg\\\\u003d\\\\u003d\\\",\\\"keyExpiration\\\":\\\"1688521049102\\\"}\"," +
1646
- "\"signatures\":[\"MEYCIQDup1B+rkiPAWmpg7RmqY0NfgdGhmdyL8wvAX+6C1aOU2QIhAIZACSDQ/ZexIyEia5KrRlG2B+y3AnK" +
1647
- "NlhRzumRcnNOR\"]},\"protocolVersion\":\"ECv2\",\"signedMessage\":\"{\\\"encryptedMessage\\\":\\\"YSSG" +
1648
- "K9yFdKP+mJB5+wAjnOujnThPM1E/KbbJxd3MDzPVI66ip1DBESldvQXYjjeLq6Rf1tKE9oLwwaj6u0/gU7Z9t3g1MoW+9YoEE1bs1" +
1649
- "IxImif7IQGAosfYjjbBBfDkOaqEs2JJC5qt6xjKO9lQ/E6JPkPFGqF7+OJ1vzmD83Pi3sHWkVge5MhxXQ3yBNhrjus3kV7zUoYA+u" +
1650
- "qNrciWcWypc1NndF/tiwSkvUTzM6n4dS8X84fkJiSO7PZ65C0yw0mdybRRnyL2fFdWGssve1zZFAvYfzcpNamyuZGGlu/SCoayit" +
1651
- "ojmMsqe5Cu0efD9+WvvDr9PA+Vo1gzuz7LmiZe81SGvdFhRoq62FBAUiwSsi2A3pWinZxM2XbYNph+HJ5FCNspWhz4ur9JG4ZMLem" +
1652
- "CXuaybvL++W6PWywAtoiE0mQcBIX3vhOq5itv0RkaKVe6nbcAS2UryRz2u /nDCJLKpIv2Wi11NtCUT2mgD8F6qfcXhvVZHyeLqZ1O" +
1653
- "LgCudTTSdKirzezbgPTg4tQpW++KufeD7bgG+01XhCWt+7/ftqcSf8n//gSRINne8j2G6w+2\\\",\\" +
1654
- "\"ephemeralPublicKey\\\":\\\"BLY2+R8C0T+BSf/W3HEq305qH63IGmJxMVmbfJ6+x1V7GQg9W9v7eHc3j+8TeypVn+nRl" +
1655
- "Pu98tivuMXECg+rWZs\\\\u003d\\\",\\\"tag\\\":\\\"MmEjNdLfsDNfYd/FRUjoJ4/IfLypNRqx8zgHfa6Ftmo\\\\u003d\\\"}\"}"
1656
-
1657
- before(function (done) {
1658
- googlePayIn = {
1659
- AuthorId: john.Id,
1660
- CreditedWalletId: wallet.Id,
1661
- DebitedFunds: {
1662
- Amount: 199,
1663
- Currency: 'EUR'
1664
- },
1665
- Fees: {
1666
- Amount: 1,
1667
- Currency: 'EUR'
1668
- },
1669
- PaymentType: 'GOOGLE_PAY',
1670
- ExecutionType: 'DIRECT',
1671
- PaymentData: paymentData,
1672
- Tag: "Create an GooglePay card direct Payin",
1673
- StatementDescriptor: "php",
1674
- BrowserInfo: {
1675
- AcceptHeader: "text/html, application/xhtml+xml, application/xml;q=0.9, /;q=0.8",
1676
- JavaEnabled: true,
1677
- Language: "FR-FR",
1678
- ColorDepth: 4,
1679
- ScreenHeight: 1800,
1680
- ScreenWidth: 400,
1681
- JavascriptEnabled: true,
1682
- TimeZoneOffset: "+60",
1683
- UserAgent: "Mozilla/5.0 (iPhone; CPU iPhone OS 13_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148"
1684
- },
1685
- IpAddress: "2001:0620:0000:0000:0211:24FF:FE80:C12C",
1686
- SecureModeReturnURL: "http://www.my-site.com/returnurl",
1687
- SecureMode: "DEFAULT",
1688
- ReturnURL: "http://test.com",
1689
- Billing: {
1690
- FirstName: 'Joe',
1691
- LastName: 'Blogs',
1692
- Address: {
1693
- AddressLine1: '1 MangoPay Street',
1694
- AddressLine2: 'The Loop',
1695
- City: 'Paris',
1696
- Region: 'Ile de France',
1697
- PostalCode: '75001',
1698
- Country: 'FR'
1699
- }
1700
- },
1701
- Shipping: {
1702
- FirstName: 'Joe',
1703
- LastName: 'Blogs',
1704
- Address: {
1705
- AddressLine1: '1 MangoPay Street',
1706
- AddressLine2: 'The Loop',
1707
- City: 'Paris',
1708
- Region: 'Ile de France',
1709
- PostalCode: '75001',
1710
- Country: 'FR'
1711
- }
1712
- }
1713
- };
1714
-
1715
- api.PayIns.createGooglePay(googlePayIn, function (data, response) {
1716
- googlePayIn = data;
1717
- done();
1718
- });
1719
- });
1720
-
1721
- it('should be created', function () {
1722
- expect(googlePayIn.Id).not.to.be.undefined;
1723
- expect(googlePayIn.AuthorId).to.equal(john.Id);
1724
- expect(googlePayIn.PaymentType).to.equal('GOOGLE_PAY');
1725
- expect(googlePayIn.ExecutionType).to.equal('DIRECT');
1726
- expect(googlePayIn.Type).to.equal('PAYIN');
1727
- });
1728
- });
1729
- });
1730
-
1731
- describe('Payment Method Metadata', function () {
1732
- var metadata;
1733
- var payIn;
1734
-
1735
- before(function (done) {
1736
- helpers.getNewPayInCardDirect(api, john, function (createdPayIn) {
1737
- payIn = createdPayIn
1738
- var metadataPost = {
1739
- Type: "BIN",
1740
- Bin: payIn.CardInfo.BIN
1741
- }
1742
-
1743
- api.PayIns.getPaymentMethodMetadata(metadataPost, function (data) {
1744
- metadata = data;
1745
- done();
1746
- });
1747
- });
1748
- });
1749
-
1750
- describe('Fetch Metadata', function () {
1751
- it('should fetch the payment method metadata', function () {
1752
- expect(metadata.Type).to.equal('BIN')
1753
- expect(metadata.Bin).to.equal(payIn.CardInfo.BIN);
1754
- });
1755
- });
1756
-
1757
- });
1758
-
1759
- describe('Card PreAuthorized Deposit', function () {
1760
- var payIn;
1761
-
1762
- before(function (done) {
1763
- helpers.createNewCardPreAuthorizedDepositPayIn(function (data, response) {
1764
- payIn = data;
1765
- done();
1766
- });
1767
- });
1768
-
1769
- it('should be created', function () {
1770
- expect(payIn).not.to.be.undefined;
1771
- expect(payIn.Status).to.equal('SUCCEEDED');
1772
- expect(payIn.PaymentType).to.equal('PREAUTHORIZED');
1773
- expect(payIn.ExecutionType).to.equal('DIRECT');
1774
- expect(payIn.DepositId).not.to.be.undefined;
1775
- });
1776
- });
1777
-
1778
- describe('Card PreAuthorized Deposit prior to complement', function () {
1779
- var payIn;
1780
-
1781
- before(function (done) {
1782
- helpers.createNewDeposit(function (data, response) {
1783
- var deposit = data;
1784
- var wallet = {
1785
- Owners: [deposit.AuthorId],
1786
- Currency: 'EUR',
1787
- Description: 'WALLET IN EUR'
1788
- };
1789
-
1790
- api.Wallets.create(wallet).then(function(data) {
1791
- var payInDto = {
1792
- AuthorId: deposit.AuthorId,
1793
- CreditedWalletId: wallet.Id,
1794
- DebitedFunds: {
1795
- Currency: 'EUR',
1796
- Amount: 1000
1797
- },
1798
- Fees: {
1799
- Currency: 'EUR',
1800
- Amount: 0
1801
- },
1802
- DepositId: deposit.Id
1803
- };
1804
-
1805
- api.PayIns.createDepositPreauthorizedPayInPriorToComplement(payInDto).then(function(data) {
1806
- payIn = data;
1807
- done();
1808
- });
1809
- });
1810
- });
1811
- });
1812
-
1813
- it('should be created', function () {
1814
- expect(payIn).not.to.be.undefined;
1815
- expect(payIn.Status).to.equal('SUCCEEDED');
1816
- expect(payIn.PaymentType).to.equal('PREAUTHORIZED');
1817
- expect(payIn.ExecutionType).to.equal('DIRECT');
1818
- expect(payIn.DepositId).not.to.be.undefined;
1819
- });
1820
- });
1821
-
1822
- describe.skip('Card PreAuthorized Deposit complement', function () {
1823
- // skipped because of PSP configuration error
1824
- var payIn;
1825
-
1826
- before(function (done) {
1827
- helpers.createNewDeposit(function (data, response) {
1828
- var deposit = data;
1829
- var wallet = {
1830
- Owners: [deposit.AuthorId],
1831
- Currency: 'EUR',
1832
- Description: 'WALLET IN EUR'
1833
- };
1834
-
1835
- api.Wallets.create(wallet).then(function(data) {
1836
- var depositUpdate = {
1837
- Id: deposit.Id,
1838
- PaymentStatus: "NO_SHOW_REQUESTED"
1839
- };
1840
-
1841
- api.Deposits.update(depositUpdate).then(function(data) {
1842
- var payInDto = {
1843
- AuthorId: deposit.AuthorId,
1844
- CreditedWalletId: wallet.Id,
1845
- DebitedFunds: {
1846
- Currency: 'EUR',
1847
- Amount: 1000
1848
- },
1849
- Fees: {
1850
- Currency: 'EUR',
1851
- Amount: 0
1852
- },
1853
- DepositId: deposit.Id
1854
- };
1855
-
1856
- api.PayIns.createDepositPreauthorizedPayInComplement(payInDto).then(function(data) {
1857
- payIn = data;
1858
- done();
1859
- });
1860
- });
1861
- });
1862
- });
1863
- });
1864
-
1865
- it('should be created', function () {
1866
- expect(payIn).not.to.be.undefined;
1867
- expect(payIn.Status).to.equal('SUCCEEDED');
1868
- expect(payIn.PaymentType).to.equal('PREAUTHORIZED');
1869
- expect(payIn.ExecutionType).to.equal('DIRECT');
1870
- expect(payIn.DepositId).not.to.be.undefined;
1871
- });
1872
- });
1873
-
1874
- describe('Pay by Bank Web', function () {
1875
- var payIn;
1876
-
1877
- before(function (done) {
1878
- helpers.getNewPayInPayByBankWeb(api, john, function (data) {
1879
- payIn = data;
1880
- done();
1881
- });
1882
- });
1883
-
1884
- describe('Create', function () {
1885
- it('should create the PayIn', function () {
1886
- expect(payIn.Id).not.to.be.undefined;
1887
- expect(payIn.PaymentType).to.equal('PAY_BY_BANK');
1888
- expect(payIn.ExecutionType).to.equal('WEB');
1889
- expect(payIn.AuthorId).to.equal(john.Id);
1890
- expect(payIn.Type).to.equal('PAYIN');
1891
- expect(payIn.Country).not.to.be.null;
1892
- expect(payIn.RedirectURL).not.to.be.null;
1893
- expect(payIn.ReturnURL).not.to.be.null;
1894
- expect(payIn.IBAN).not.to.be.null;
1895
- expect(payIn.BIC).not.to.be.null;
1896
- expect(payIn.PaymentFlow).not.to.be.null;
1897
- expect(payIn.BankName).not.to.be.null;
1898
- expect(payIn.Culture).not.to.be.null;
1899
- expect(payIn.Scheme).not.to.be.null;
1900
- });
1901
- });
1902
-
1903
- describe('Get', function () {
1904
- var getPayIn;
1905
- before(function (done) {
1906
- api.PayIns.get(payIn.Id, function (data, response) {
1907
- getPayIn = data;
1908
- done();
1909
- });
1910
- });
1911
-
1912
- it('should get the PayIn', function () {
1913
- expect(getPayIn.Id).to.equal(payIn.Id);
1914
- expect(getPayIn.PaymentType).to.equal('PAY_BY_BANK');
1915
- expect(getPayIn.ExecutionType).to.equal('WEB');
1916
- });
1917
- });
1918
-
1919
- describe('Get supported banks', function () {
1920
- var withoutFilterAndPagination;
1921
- var withFilter;
1922
- var withPagination;
1923
- var withFilterAndPagination;
1924
-
1925
- before(function (done) {
1926
- api.PayIns.getPayByBankSupportedBanks(function (data, response) {
1927
- withoutFilterAndPagination = data;
1928
- done();
1929
- });
1930
- });
1931
-
1932
- before(function (done) {
1933
- api.PayIns.getPayByBankSupportedBanks(function (data, response) {
1934
- withFilter = data;
1935
- done();
1936
- }, {
1937
- CountryCodes: "DE"
1938
- });
1939
- });
1940
-
1941
- before(function (done) {
1942
- api.PayIns.getPayByBankSupportedBanks(function (data, response) {
1943
- withPagination = data;
1944
- done();
1945
- }, {
1946
- per_page: 2,
1947
- page: 1
1948
- });
1949
- });
1950
-
1951
- before(function (done) {
1952
- api.PayIns.getPayByBankSupportedBanks(function (data, response) {
1953
- withFilterAndPagination = data;
1954
- done();
1955
- }, {
1956
- per_page: 2,
1957
- page: 1,
1958
- CountryCodes: "DE"
1959
- });
1960
- });
1961
-
1962
- it('should get the supported banks', function () {
1963
- expect(withoutFilterAndPagination).not.to.be.undefined;
1964
- expect(withoutFilterAndPagination.SupportedBanks.Countries.length).to.be.above(0);
1965
-
1966
- expect(withoutFilterAndPagination.SupportedBanks.Countries.length)
1967
- .to.be.greaterThan(withFilter.SupportedBanks.Countries.length);
1968
- expect(withFilter.SupportedBanks.Countries[0].Banks.length).to.eq(5);
1969
-
1970
- expect(withPagination.SupportedBanks.Countries[0].Banks.length).to.eq(2);
1971
-
1972
- expect(withoutFilterAndPagination.SupportedBanks.Countries.length)
1973
- .to.be.greaterThan(withFilterAndPagination.SupportedBanks.Countries.length);
1974
- expect(withFilterAndPagination.SupportedBanks.Countries[0].Banks.length).to.eq(2);
1975
- });
1976
- });
1977
- });
1978
-
1979
- describe('PayIn Intent', function () {
1980
- describe('Create intent authorization', function () {
1981
- var payInIntent;
1982
-
1983
- before(function (done) {
1984
- helpers.getNewPayInIntentAuthorization(api, john, function (data) {
1985
- payInIntent = data;
1986
- done();
1987
- });
1988
- });
1989
-
1990
- it('should create the PayInIntent Authorization', function () {
1991
- expect(payInIntent.Id).not.to.be.undefined;
1992
- expect(payInIntent.Status).to.equal('AUTHORIZED');
1993
- });
1994
- });
1995
-
1996
- describe('Create full capture', function () {
1997
- var payInIntent;
1998
-
1999
- before(function (done) {
2000
- helpers.getNewPayInIntentFullCapture(api, john, function (data) {
2001
- payInIntent = data;
2002
- done();
2003
- });
2004
- });
2005
-
2006
- it('should create the PayInIntent Full Capture', function () {
2007
- expect(payInIntent.Id).not.to.be.undefined;
2008
- expect(payInIntent.Status).to.equal('CAPTURED');
2009
- });
2010
- });
2011
-
2012
- describe('Create partial capture', function () {
2013
- var payInIntent;
2014
-
2015
- before(function (done) {
2016
- helpers.getNewPayInIntentAuthorization(api, john, function (data) {
2017
- const toCreate = {
2018
- "Amount" : 1000,
2019
- "Currency" : "EUR",
2020
- "PlatformFeesAmount": 0,
2021
- "ExternalData" : {
2022
- "ExternalProcessingDate" : 1727788165,
2023
- "ExternalProviderReference" : Math.random().toString(),
2024
- "ExternalMerchantReference" : "Order-xyz-35e8490e-2ec9-4c82-978e-c712a3f5ba16",
2025
- "ExternalProviderName" : "Stripe",
2026
- "ExternalProviderPaymentMethod" : "PAYPAL"
2027
- },
2028
- "LineItems": [
2029
- {
2030
- "Amount": 1000,
2031
- "Id": data.LineItems[0].Id
2032
- }
2033
- ]
2034
- };
2035
- api.PayIns.createPayInIntentPartialCapture(data.Id, toCreate, function(data) {
2036
- payInIntent = data;
2037
- done();
2038
- });
2039
- });
2040
- });
2041
-
2042
- it('should create the PayInIntent Partial Capture', function () {
2043
- expect(payInIntent.Id).not.to.be.undefined;
2044
- expect(payInIntent.Status).to.equal('CAPTURED');
2045
- });
2046
- });
2047
-
2048
- describe('Get intent', function () {
2049
- var fetched;
2050
- var created;
2051
-
2052
- before(function (done) {
2053
- helpers.getNewPayInIntentAuthorization(api, john, function (data) {
2054
- created = data;
2055
- api.PayIns.getPayInIntent(created.Id, function(data) {
2056
- fetched = data;
2057
- done();
2058
- });
2059
- });
2060
- });
2061
-
2062
- it('should get the intent', function () {
2063
- expect(fetched.Id).to.equal(created.Id);
2064
- expect(fetched.Status).to.equal(created.Status);
2065
- });
2066
- });
2067
-
2068
- describe('Cancel intent', function () {
2069
- var canceled;
2070
- var created;
2071
-
2072
- before(function (done) {
2073
- helpers.getNewPayInIntentAuthorization(api, john, function (data) {
2074
- created = data;
2075
- const cancelDetails = {
2076
- "ExternalData" : {
2077
- "ExternalProcessingDate" : 1728133765,
2078
- "ExternalProviderReference" : Math.random().toString(),
2079
- }
2080
- };
2081
- api.PayIns.fullCancelPayInIntent(created.Id, cancelDetails, function(data) {
2082
- canceled = data;
2083
- done();
2084
- });
2085
- });
2086
- });
2087
-
2088
- it('should cancel the intent', function () {
2089
- expect(canceled.Status).to.equal('CANCELLED');
2090
- });
2091
- });
2092
-
2093
- describe('Create splits', function () {
2094
- var payInIntent;
2095
- var splitsResult;
2096
-
2097
- before(function (done) {
2098
- helpers.getNewPayInIntentAuthorization(api, john, function (data) {
2099
- payInIntent = data;
2100
- const fullCapture = {
2101
- "ExternalData" : {
2102
- "ExternalProcessingDate" : 1727788165,
2103
- "ExternalProviderReference" : Math.random().toString(),
2104
- "ExternalMerchantReference" : "Order-xyz-35e8490e-2ec9-4c82-978e-c712a3f5ba16",
2105
- "ExternalProviderName" : "Stripe",
2106
- "ExternalProviderPaymentMethod" : "PAYPAL"
2107
- }
2108
- };
2109
- api.PayIns.createPayInIntentFullCapture(payInIntent.Id, fullCapture, function(data) {
2110
- const splits = {
2111
- Splits: [
2112
- {
2113
- LineItemId: payInIntent.LineItems[0].Id,
2114
- SplitAmount: 10
2115
- }
2116
- ]
2117
- };
2118
- api.PayIns.createPayInIntentSplits(payInIntent.Id, splits, function(data) {
2119
- splitsResult = data;
2120
- done();
2121
- });
2122
- });
2123
- });
2124
- });
2125
-
2126
- it('should create the Splits', function () {
2127
- expect(splitsResult.Splits[0].Status).to.equal('CREATED');
2128
- });
2129
- });
2130
- });
2131
-
2132
- describe('PayIn Intent', function () {
2133
- describe('Create intent authorization', function () {
2134
- var payInIntent;
2135
-
2136
- before(function (done) {
2137
- helpers.getNewPayInIntentAuthorization(api, john, function (data) {
2138
- payInIntent = data;
2139
- done();
2140
- });
2141
- });
2142
-
2143
- it('should create the PayInIntent Authorization', function () {
2144
- expect(payInIntent.Id).not.to.be.undefined;
2145
- expect(payInIntent.Status).to.equal('AUTHORIZED');
2146
- });
2147
- });
2148
-
2149
- describe('Create full capture', function () {
2150
- var payInIntent;
2151
-
2152
- before(function (done) {
2153
- helpers.getNewPayInIntentAuthorization(api, john, function (data) {
2154
- const toCreate = {
2155
- "ExternalData" : {
2156
- "ExternalProcessingDate" : 1727788165,
2157
- "ExternalProviderReference" : Math.random().toString(),
2158
- "ExternalMerchantReference" : "Order-xyz-35e8490e-2ec9-4c82-978e-c712a3f5ba16",
2159
- "ExternalProviderName" : "Stripe",
2160
- "ExternalProviderPaymentMethod" : "PAYPAL"
2161
- }
2162
- };
2163
- api.PayIns.createPayInIntentFullCapture(data.Id, toCreate, function(data) {
2164
- payInIntent = data;
2165
- done();
2166
- });
2167
- });
2168
- });
2169
-
2170
- it('should create the PayInIntent Full Capture', function () {
2171
- expect(payInIntent.Id).not.to.be.undefined;
2172
- expect(payInIntent.Status).to.equal('CAPTURED');
2173
- });
2174
- });
2175
-
2176
- describe('Create partial capture', function () {
2177
- var payInIntent;
2178
-
2179
- before(function (done) {
2180
- helpers.getNewPayInIntentAuthorization(api, john, function (data) {
2181
- const toCreate = {
2182
- "Amount" : 1000,
2183
- "Currency" : "EUR",
2184
- "PlatformFeesAmount": 0,
2185
- "ExternalData" : {
2186
- "ExternalProcessingDate" : 1727788165,
2187
- "ExternalProviderReference" : Math.random().toString(),
2188
- "ExternalMerchantReference" : "Order-xyz-35e8490e-2ec9-4c82-978e-c712a3f5ba16",
2189
- "ExternalProviderName" : "Stripe",
2190
- "ExternalProviderPaymentMethod" : "PAYPAL"
2191
- },
2192
- "LineItems": [
2193
- {
2194
- "Amount": 1000,
2195
- "Id": data.LineItems[0].Id
2196
- }
2197
- ]
2198
- };
2199
- api.PayIns.createPayInIntentPartialCapture(data.Id, toCreate, function(data) {
2200
- payInIntent = data;
2201
- done();
2202
- });
2203
- });
2204
- });
2205
-
2206
- it('should create the PayInIntent Partial Capture', function () {
2207
- expect(payInIntent.Id).not.to.be.undefined;
2208
- expect(payInIntent.Status).to.equal('CAPTURED');
2209
- });
2210
- });
2211
-
2212
- describe('Get intent', function () {
2213
- var fetched;
2214
- var created;
2215
-
2216
- before(function (done) {
2217
- helpers.getNewPayInIntentAuthorization(api, john, function (data) {
2218
- created = data;
2219
- api.PayIns.getPayInIntent(created.Id, function(data) {
2220
- fetched = data;
2221
- done();
2222
- });
2223
- });
2224
- });
2225
-
2226
- it('should get the intent', function () {
2227
- expect(fetched.Id).to.equal(created.Id);
2228
- expect(fetched.Status).to.equal(created.Status);
2229
- });
2230
- });
2231
-
2232
- // describe('Cancel intent', function () {
2233
- // var canceled;
2234
- // var created;
2235
- //
2236
- // before(function (done) {
2237
- // helpers.getNewPayInIntentAuthorization(api, john, function (data) {
2238
- // created = data;
2239
- // const cancelDetails = {
2240
- // "ExternalData" : {
2241
- // "ExternalProcessingDate" : 1728133765,
2242
- // "ExternalProviderReference" : Math.random().toString(),
2243
- // }
2244
- // };
2245
- // api.PayIns.fullCancelPayInIntent(created.Id, cancelDetails, function(data) {
2246
- // canceled = data;
2247
- // done();
2248
- // });
2249
- // });
2250
- // });
2251
- //
2252
- // it('should cancel the intent', function () {
2253
- // expect(canceled.Status).to.equal('CANCELED');
2254
- // });
2255
- // });
2256
-
2257
- describe('Create splits', function () {
2258
- var payInIntent;
2259
- var splitsResult;
2260
-
2261
- before(function (done) {
2262
- helpers.getNewPayInIntentAuthorization(api, john, function (data) {
2263
- payInIntent = data;
2264
- helpers.getNewPayInIntentSplit(api, payInIntent, function(data) {
2265
- splitsResult = data;
2266
- done();
2267
- });
2268
- });
2269
- });
2270
-
2271
- it('should create the Splits', function () {
2272
- expect(splitsResult.Splits[0].Status).to.equal('CREATED');
2273
- });
2274
- });
2275
-
2276
- describe('Execute split', function () {
2277
- var payInIntent;
2278
- var error;
2279
-
2280
- before(function (done) {
2281
- helpers.getNewPayInIntentAuthorization(api, john, function (data) {
2282
- payInIntent = data;
2283
- helpers.getNewPayInIntentSplit(api, data, function (data) {
2284
- api.PayIns.executePayInIntentSplit(payInIntent.Id, data.Splits[0].Id, function (data) {
2285
- })
2286
- .catch(function (err) {
2287
- error = err;
2288
- done();
2289
- });
2290
- });
2291
- });
2292
- });
2293
-
2294
- it('should return error while trying to execute the Split', function () {
2295
- // expect error. A success use case cannot be automated because it needs a PayIn to be created manually
2296
- expect(error.Errors.Split).to.contain("Execute split requires a status in [AVAILABLE, REJECTED]");
2297
- });
2298
- });
2299
-
2300
- describe('Reverse split', function () {
2301
- var payInIntent;
2302
- var reversedSplit;
2303
-
2304
- before(function (done) {
2305
- helpers.getNewPayInIntentAuthorization(api, john, function (data) {
2306
- payInIntent = data;
2307
- helpers.getNewPayInIntentSplit(api, data, function (data) {
2308
- api.PayIns.reversePayInIntentSplit(payInIntent.Id, data.Splits[0].Id, function (data) {
2309
- reversedSplit = data;
2310
- done();
2311
- });
2312
- });
2313
- });
2314
- });
2315
-
2316
- it('should return error while trying to reverse the Split', function () {
2317
- // expect error. A success use case cannot be automated because it needs a PayIn to be created manually
2318
- expect(reversedSplit.Status).to.eq("REVERSED");
2319
- });
2320
- });
2321
-
2322
- describe('Get split', function () {
2323
- var payInIntent;
2324
- var fetched;
2325
-
2326
- before(function (done) {
2327
- helpers.getNewPayInIntentAuthorization(api, john, function (data) {
2328
- payInIntent = data;
2329
- helpers.getNewPayInIntentSplit(api, data, function (data) {
2330
- api.PayIns.getPayInIntentSplit(payInIntent.Id, data.Splits[0].Id, function (data) {
2331
- fetched = data;
2332
- done();
2333
- });
2334
- });
2335
- });
2336
- });
2337
-
2338
- it('should get the Split', function () {
2339
- expect(fetched.Status).to.equal('CREATED');
2340
- });
2341
- });
2342
-
2343
- describe('Update split', function () {
2344
- var payInIntent;
2345
- var updated;
2346
-
2347
- before(function (done) {
2348
- helpers.getNewPayInIntentAuthorization(api, john, function (data) {
2349
- payInIntent = data;
2350
- helpers.getNewPayInIntentSplit(api, data, function (data) {
2351
- const dto = {
2352
- LineItemId: data.Splits[0].LineItemId,
2353
- Description: "updated description"
2354
- };
2355
- api.PayIns.updatePayInIntentSplit(payInIntent.Id, data.Splits[0].Id, dto, function (data) {
2356
- updated = data;
2357
- done();
2358
- });
2359
- });
2360
- });
2361
- });
2362
-
2363
- it('should update the Split', function () {
2364
- expect(updated.Description).to.equal("updated description");
2365
- });
2366
- });
2367
-
2368
- describe('Create intent full refund', function () {
2369
- var intentRefund;
2370
-
2371
- before(function (done) {
2372
- helpers.getNewPayInIntentFullRefund(api, john, function (data) {
2373
- intentRefund = data;
2374
- done();
2375
- });
2376
- });
2377
-
2378
- it('should create the PayInIntent Full Refund', function () {
2379
- expect(intentRefund.Id).not.to.be.undefined;
2380
- expect(intentRefund.Status).to.equal('REFUNDED');
2381
- });
2382
- });
2383
-
2384
- describe('Create intent partial refund', function () {
2385
- var intentRefund;
2386
-
2387
- before(function (done) {
2388
- helpers.getNewPayInIntentFullCapture(api, john, function (data) {
2389
- const partialRefundDto = {
2390
- "Amount": 1000,
2391
- "LineItems": [
2392
- {
2393
- "Id": data.LineItems[0].Id,
2394
- "Amount": data.LineItems[0].TotalLineItemAmount
2395
- }
2396
- ],
2397
- "ExternalData" : {
2398
- "ExternalProcessingDate" : 1727788165,
2399
- "ExternalProviderReference" : Math.random().toString(),
2400
- "ExternalMerchantReference" : "Order-xyz-35e8490e-2ec9-4c82-978e-c712a3f5ba16",
2401
- "ExternalProviderName" : "Stripe",
2402
- "ExternalProviderPaymentMethod" : "PAYPAL"
2403
- }
2404
- };
2405
- api.PayIns.createPayInIntentRefund(data.Id, partialRefundDto, function(data) {
2406
- intentRefund = data;
2407
- done();
2408
- });
2409
- });
2410
- });
2411
-
2412
- it('should create the PayInIntent Full Refund', function () {
2413
- expect(intentRefund.Id).not.to.be.undefined;
2414
- expect(intentRefund.Status).to.equal('REFUNDED');
2415
- });
2416
- });
2417
-
2418
- describe('Fully reverse intent refund', function () {
2419
- var reversedIntentRefund;
2420
-
2421
- before(function (done) {
2422
- helpers.getNewPayInIntentFullRefund(api, john, function (data) {
2423
- const reverseDto = {
2424
- "ExternalData" : {
2425
- "ExternalProcessingDate" : 1727788165,
2426
- "ExternalProviderReference" : Math.random().toString(),
2427
- "ExternalMerchantReference" : "Order-xyz-35e8490e-2ec9-4c82-978e-c712a3f5ba16",
2428
- "ExternalProviderName" : "Stripe",
2429
- "ExternalProviderPaymentMethod" : "PAYPAL"
2430
- }
2431
- };
2432
- api.PayIns.reversePayInIntentRefund(data.Id, data.Refund.Id, reverseDto, function(data) {
2433
- reversedIntentRefund = data;
2434
- done();
2435
- });
2436
- });
2437
- });
2438
-
2439
- it('should reverse the PayInIntent Full Refund', function () {
2440
- expect(reversedIntentRefund.Id).not.to.be.undefined;
2441
- expect(reversedIntentRefund.Status).to.equal('REFUND_REVERSED');
2442
- });
2443
- });
2444
-
2445
- describe('Partially reverse intent refund', function () {
2446
- var reversedIntentRefund;
2447
-
2448
- before(function (done) {
2449
- helpers.getNewPayInIntentFullRefund(api, john, function (data) {
2450
- const reverseDto = {
2451
- "Amount": 1000,
2452
- "LineItems": [
2453
- {
2454
- "Id": data.LineItems[0].Id,
2455
- "Amount": data.LineItems[0].TotalLineItemAmount
2456
- }
2457
- ],
2458
- "ExternalData" : {
2459
- "ExternalProcessingDate" : 1727788165,
2460
- "ExternalProviderReference" : Math.random().toString(),
2461
- "ExternalMerchantReference" : "Order-xyz-35e8490e-2ec9-4c82-978e-c712a3f5ba16",
2462
- "ExternalProviderName" : "Stripe",
2463
- "ExternalProviderPaymentMethod" : "PAYPAL"
2464
- }
2465
- };
2466
- api.PayIns.reversePayInIntentRefund(data.Id, data.Refund.Id, reverseDto, function(data) {
2467
- reversedIntentRefund = data;
2468
- done();
2469
- });
2470
- });
2471
- });
2472
-
2473
- it('should reverse the PayInIntent Full Refund', function () {
2474
- expect(reversedIntentRefund.Id).not.to.be.undefined;
2475
- expect(reversedIntentRefund.Status).to.equal('REFUND_REVERSED');
2476
- });
2477
- });
2478
-
2479
- describe('Create full intent dispute', function () {
2480
- var dispute;
2481
-
2482
- before(function (done) {
2483
- helpers.getNewPayInIntentFullCapture(api, john, function (data) {
2484
- const disputeDto = {
2485
- "ExternalData" : {
2486
- "ExternalProcessingDate" : 1727788165,
2487
- "ExternalProviderReference" : Math.random().toString(),
2488
- "ExternalMerchantReference" : "Order-xyz-35e8490e-2ec9-4c82-978e-c712a3f5ba16",
2489
- "ExternalProviderName" : "Stripe",
2490
- "ExternalProviderPaymentMethod" : "PAYPAL"
2491
- }
2492
- };
2493
- api.PayIns.createPayInIntentDispute(data.Id, data.Capture.Id, disputeDto, function(data) {
2494
- dispute = data;
2495
- done();
2496
- });
2497
- });
2498
- });
2499
-
2500
- it('should reverse the PayInIntent Full Refund', function () {
2501
- expect(dispute.Id).not.to.be.undefined;
2502
- expect(dispute.Status).to.equal('DISPUTED');
2503
- });
2504
- });
2505
-
2506
- describe('Update intent dispute outcome', function () {
2507
- var intent;
2508
- var dispute;
2509
- var outcome;
2510
-
2511
- before(function (done) {
2512
- helpers.getNewPayInIntentFullCapture(api, john, function (data) {
2513
- intent = data;
2514
- const disputeDto = {
2515
- "ExternalData" : {
2516
- "ExternalProcessingDate" : 1727788165,
2517
- "ExternalProviderReference" : Math.random().toString(),
2518
- "ExternalMerchantReference" : "Order-xyz-35e8490e-2ec9-4c82-978e-c712a3f5ba16",
2519
- "ExternalProviderName" : "Stripe",
2520
- "ExternalProviderPaymentMethod" : "PAYPAL"
2521
- }
2522
- };
2523
- api.PayIns.createPayInIntentDispute(intent.Id, intent.Capture.Id, disputeDto, function(data) {
2524
- dispute = data;
2525
- const dto = {
2526
- Decision: 'DEFENDED'
2527
- };
2528
- api.PayIns.updatePayInIntentDisputeOutcome(intent.Id, intent.Capture.Id, dispute.Dispute.Id, dto, function (data) {
2529
- outcome = data;
2530
- done();
2531
- });
2532
- });
2533
- });
2534
- });
2535
-
2536
- it('should update the dispute outcome', function () {
2537
- expect(outcome.Id).not.to.be.undefined;
2538
- expect(outcome.Decision).to.equal('DEFENDED');
2539
- });
2540
- });
2541
-
2542
- describe('Create partial intent dispute', function () {
2543
- var dispute;
2544
-
2545
- before(function (done) {
2546
- helpers.getNewPayInIntentFullCapture(api, john, function (data) {
2547
- const disputeDto = {
2548
- "Amount": 1000,
2549
- "LineItems": [
2550
- {
2551
- "Id": data.LineItems[0].Id,
2552
- "Amount": data.LineItems[0].TotalLineItemAmount
2553
- }
2554
- ],
2555
- "ExternalData" : {
2556
- "ExternalProcessingDate" : 1727788165,
2557
- "ExternalProviderReference" : Math.random().toString(),
2558
- "ExternalMerchantReference" : "Order-xyz-35e8490e-2ec9-4c82-978e-c712a3f5ba16",
2559
- "ExternalProviderName" : "Stripe",
2560
- "ExternalProviderPaymentMethod" : "PAYPAL"
2561
- }
2562
- };
2563
- api.PayIns.createPayInIntentDispute(data.Id, data.Capture.Id, disputeDto, function(data) {
2564
- dispute = data;
2565
- done();
2566
- });
2567
- });
2568
- });
2569
-
2570
- it('should reverse the PayInIntent Full Refund', function () {
2571
- expect(dispute.Id).not.to.be.undefined;
2572
- expect(dispute.Status).to.equal('DISPUTED');
2573
- });
2574
- });
2575
- });
2576
-
2577
- describe('PayPal Data Collection', function () {
2578
- var dataCollection;
2579
-
2580
- before(function (done) {
2581
- const toCreate = {
2582
- "sender_account_id" : "A12345N343",
2583
- "sender_first_name" : "Jane",
2584
- "sender_last_name" : "Doe",
2585
- "sender_email" : "jane.doe@sample.com",
2586
- "sender_phone" : "(042) 1123 4567",
2587
- "sender_address_zip" : "75009",
2588
- "sender_country_code" : "FR",
2589
- "sender_create_date" : "2012-12-09T19:14:55.277-0:00",
2590
- "sender_signup_ip" : "10.220.90.20",
2591
- "sender_popularity_score" : "high",
2592
- "receiver_account_id" : "A12345N344",
2593
- "receiver_create_date" : "2012-12-09T19:14:55.277-0:00",
2594
- "receiver_email" : "jane@sample.com",
2595
- "receiver_address_country_code" : "FR",
2596
- "business_name" : "Jane Ltd",
2597
- "recipient_popularity_score" : "high",
2598
- "first_interaction_date" : "2012-12-09T19:14:55.277-0:00",
2599
- "txn_count_total" : "34",
2600
- "vertical" : "Household goods",
2601
- "transaction_is_tangible" : "0"
2602
- };
2603
- api.PayIns.createPayPalDataCollection(toCreate, function(data) {
2604
- dataCollection = data;
2605
- done();
2606
- });
2607
- });
2608
-
2609
- describe('Create', function () {
2610
- it('should create the data collection', function () {
2611
- expect(dataCollection).not.to.be.undefined;
2612
- expect(dataCollection.dataCollectionId).not.to.be.undefined;
2613
- });
2614
- });
2615
-
2616
- describe('Get', function () {
2617
- var getDataCollection;
2618
- before(function (done) {
2619
- api.PayIns.getPayPalDataCollection(dataCollection.dataCollectionId, function (data, response) {
2620
- getDataCollection = data;
2621
- done();
2622
- });
2623
- });
2624
-
2625
- it('should get the data collection', function () {
2626
- expect(getDataCollection.dataCollectionId).to.equal(dataCollection.dataCollectionId);
2627
- expect(getDataCollection.sender_first_name).to.equal("Jane");
2628
- expect(getDataCollection.sender_last_name).to.equal("Doe");
2629
- });
2630
- });
2631
- });
2632
- });