mangopay4-nodejs-sdk 1.67.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/CHANGELOG.md +39 -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/apiMethods.js +10 -3
  9. package/lib/models/CardPreAuthorization.js +2 -2
  10. package/lib/models/PayInPaymentType.js +0 -1
  11. package/lib/models/ReportFilterV2.js +2 -1
  12. package/lib/services/Acquiring.js +152 -0
  13. package/lib/services/PayIns.js +0 -18
  14. package/lib/services/index.js +2 -1
  15. package/package.json +16 -24
  16. package/typings/enums.d.ts +0 -1
  17. package/typings/index.d.ts +5 -5
  18. package/typings/index.test-d.ts +0 -15
  19. package/typings/models/acquiring.d.ts +763 -0
  20. package/typings/models/payIn.d.ts +20 -80
  21. package/typings/models/refund.d.ts +1 -0
  22. package/typings/models/reportV2.d.ts +2 -0
  23. package/typings/services/Acquiring.d.ts +44 -0
  24. package/typings/services/PayIns.d.ts +0 -8
  25. package/typings/types.d.ts +0 -2
  26. package/.github/workflows/node.js.yml +0 -32
  27. package/.github/workflows/npm-publish.yml +0 -26
  28. package/.jshintrc +0 -16
  29. package/lib/models/PayInPaymentDetailsPayconiq.js +0 -23
  30. package/test/TestKycPageFile.png +0 -0
  31. package/test/helpers.js +0 -1536
  32. package/test/main.js +0 -10
  33. package/test/mocha.opts +0 -3
  34. package/test/services/BankAccounts.js +0 -46
  35. package/test/services/BankingAliases.js +0 -89
  36. package/test/services/CardPreAuthorizations.js +0 -70
  37. package/test/services/CardRegistrations.js +0 -239
  38. package/test/services/Cards.js +0 -56
  39. package/test/services/Clients.js +0 -235
  40. package/test/services/Conversions.js +0 -319
  41. package/test/services/Deposits.js +0 -148
  42. package/test/services/Disputes.js +0 -542
  43. package/test/services/EMoney.js +0 -54
  44. package/test/services/Events.js +0 -147
  45. package/test/services/Hooks.js +0 -109
  46. package/test/services/Idempotency.js +0 -41
  47. package/test/services/IdentityVerifications.js +0 -68
  48. package/test/services/KycDocuments.js +0 -73
  49. package/test/services/Mandates.js +0 -256
  50. package/test/services/PayIns.js +0 -2748
  51. package/test/services/PayOuts.js +0 -119
  52. package/test/services/RateLimit.js +0 -43
  53. package/test/services/Recipients.js +0 -234
  54. package/test/services/Refunds.js +0 -123
  55. package/test/services/Regulatory.js +0 -45
  56. package/test/services/Reports.js +0 -114
  57. package/test/services/ReportsV2.js +0 -306
  58. package/test/services/Repudiations.js +0 -22
  59. package/test/services/Settlements.js +0 -127
  60. package/test/services/Tokens.js +0 -55
  61. package/test/services/Transfers.js +0 -137
  62. package/test/services/UboDeclarations.js +0 -130
  63. package/test/services/Users.js +0 -1322
  64. package/test/services/VirtualAccounts.js +0 -105
  65. package/test/services/Wallets.js +0 -132
  66. package/test/settlement_sample.csv +0 -8
  67. package/test/settlement_sample_bad.csv +0 -8
@@ -1,2748 +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
- // endpoint removed
1081
- describe.skip('Payconiq Web', function () {
1082
- var payIn, wallet;
1083
-
1084
- before(function (done) {
1085
- wallet = {
1086
- Owners: [john.Id],
1087
- Currency: 'EUR',
1088
- Description: 'WALLET IN EUR'
1089
- };
1090
-
1091
- api.Wallets.create(wallet).then(function () {
1092
- payIn = {
1093
- Tag: 'custom meta',
1094
- CreditedWalletId: wallet.Id,
1095
- AuthorId: john.Id,
1096
- DebitedFunds: {
1097
- Amount: 1000,
1098
- Currency: 'EUR'
1099
- },
1100
- Fees: {
1101
- Amount: 0,
1102
- Currency: 'EUR'
1103
- },
1104
- PaymentType: 'PAYCONIQ',
1105
- ExecutionType: 'WEB',
1106
- ReturnURL: 'http://www.my-site.com/returnURL',
1107
- Country: 'BE'
1108
- };
1109
-
1110
- api.PayIns.create(payIn, function (data, response) {
1111
- payIn = data;
1112
- done();
1113
- });
1114
- });
1115
- });
1116
-
1117
- describe('Create', function () {
1118
- it('should create the PayIn', function () {
1119
- expect(payIn.Id).not.to.be.undefined;
1120
- expect(payIn.PaymentType).to.equal('PAYCONIQ');
1121
- expect(payIn.ExecutionType).to.equal('WEB');
1122
- expect(payIn.Status).to.equal('CREATED');
1123
- expect(payIn.RedirectURL).not.to.be.undefined;
1124
- expect(payIn.DeepLinkURL).not.to.be.undefined;
1125
- });
1126
- });
1127
-
1128
- describe('Get', function () {
1129
- var getPayIn;
1130
- before(function (done) {
1131
- api.PayIns.get(payIn.Id, function (data, response) {
1132
- getPayIn = data;
1133
- done()
1134
- });
1135
- });
1136
-
1137
- it('should get the PayIn', function () {
1138
- expect(getPayIn.Id).not.to.be.undefined;
1139
- expect(getPayIn.PaymentType).to.equal('PAYCONIQ');
1140
- expect(getPayIn.ExecutionType).to.equal('WEB');
1141
- expect(getPayIn.Status).to.equal('CREATED');
1142
- expect(payIn.RedirectURL).not.to.be.undefined;
1143
- expect(payIn.DeepLinkURL).not.to.be.undefined;
1144
- });
1145
- });
1146
- });
1147
-
1148
- describe('Payconiq Web V2', function () {
1149
- var payIn, wallet;
1150
-
1151
- before(function (done) {
1152
- wallet = {
1153
- Owners: [john.Id],
1154
- Currency: 'EUR',
1155
- Description: 'WALLET IN EUR'
1156
- };
1157
-
1158
- api.Wallets.create(wallet).then(function () {
1159
- payIn = {
1160
- Tag: 'custom meta',
1161
- CreditedWalletId: wallet.Id,
1162
- AuthorId: john.Id,
1163
- DebitedFunds: {
1164
- Amount: 100,
1165
- Currency: 'EUR'
1166
- },
1167
- Fees: {
1168
- Amount: 0,
1169
- Currency: 'EUR'
1170
- },
1171
- PaymentType: 'PAYCONIQ',
1172
- ExecutionType: 'WEB',
1173
- ReturnURL: 'http://www.my-site.com/returnURL',
1174
- Country: 'BE'
1175
- };
1176
-
1177
- api.PayIns.createPayconiq(payIn, function (data, response) {
1178
- payIn = data;
1179
- done();
1180
- });
1181
- });
1182
- });
1183
-
1184
- describe('Create', function () {
1185
- it('should create the PayIn', function () {
1186
- expect(payIn.Id).not.to.be.undefined;
1187
- expect(payIn.PaymentType).to.equal('PAYCONIQ');
1188
- expect(payIn.ExecutionType).to.equal('WEB');
1189
- expect(payIn.Status).to.equal('CREATED');
1190
- expect(payIn.RedirectURL).not.to.be.undefined;
1191
- expect(payIn.DeepLinkURL).not.to.be.undefined;
1192
- expect(payIn.QRCodeURL).not.to.be.undefined;
1193
- });
1194
- });
1195
- });
1196
-
1197
- describe('Mbway Web', function () {
1198
- var payIn;
1199
-
1200
- before(function (done) {
1201
- helpers.getNewPayInMbwayWeb(api, john, function (data, response) {
1202
- payIn = data;
1203
- done();
1204
- });
1205
- });
1206
-
1207
- describe('Create', function () {
1208
- it('should create the PayIn', function () {
1209
- expect(payIn.Id).not.to.be.undefined;
1210
- expect(payIn.PaymentType).to.equal('MBWAY');
1211
- expect(payIn.ExecutionType).to.equal('WEB');
1212
- expect(payIn.AuthorId).to.equal(john.Id);
1213
- expect(payIn.Status).to.equal('CREATED');
1214
- expect(payIn.Type).to.equal('PAYIN');
1215
- expect(payIn.Phone).not.to.be.null;
1216
- });
1217
- });
1218
-
1219
- describe('Get', function () {
1220
- var getPayIn;
1221
- before(function (done) {
1222
- api.PayIns.get(payIn.Id, function (data, response) {
1223
- getPayIn = data;
1224
- done()
1225
- });
1226
- });
1227
-
1228
- it('should get the PayIn', function () {
1229
- expect(getPayIn.Id).to.equal(payIn.Id);
1230
- expect(getPayIn.PaymentType).to.equal('MBWAY');
1231
- expect(getPayIn.ExecutionType).to.equal('WEB');
1232
- expect(getPayIn.Phone).not.to.be.null;
1233
- });
1234
- });
1235
- });
1236
-
1237
- describe('Bancontact Web', function () {
1238
- var payIn;
1239
-
1240
- before(function (done) {
1241
- helpers.getNewPayInBancontactWeb(api, john, function (data, response) {
1242
- payIn = data;
1243
- done();
1244
- });
1245
- });
1246
-
1247
- describe('Create', function () {
1248
- it('should create the PayIn', function () {
1249
- expect(payIn.Id).not.to.be.undefined;
1250
- expect(payIn.PaymentType).to.equal('BCMC');
1251
- expect(payIn.ExecutionType).to.equal('WEB');
1252
- expect(payIn.AuthorId).to.equal(john.Id);
1253
- expect(payIn.Status).to.equal('CREATED');
1254
- expect(payIn.Type).to.equal('PAYIN');
1255
- expect(payIn.Recurring).not.to.be.null;
1256
- });
1257
- });
1258
-
1259
- describe('Get', function () {
1260
- var getPayIn;
1261
- before(function (done) {
1262
- api.PayIns.get(payIn.Id, function (data, response) {
1263
- getPayIn = data;
1264
- done()
1265
- });
1266
- });
1267
-
1268
- it('should get the PayIn', function () {
1269
- expect(getPayIn.Id).to.equal(payIn.Id);
1270
- expect(getPayIn.PaymentType).to.equal('BCMC');
1271
- expect(getPayIn.ExecutionType).to.equal('WEB');
1272
- expect(getPayIn.Phone).not.to.be.null;
1273
- });
1274
- });
1275
- });
1276
-
1277
- describe('Bizum Web', function () {
1278
- var payInWithPhone;
1279
- var payInWithReturnUrl;
1280
-
1281
- before(function (done) {
1282
- helpers.getNewPayInBizumWebWithPhone(api, john, function (data, response) {
1283
- payInWithPhone = data;
1284
- helpers.getNewPayInBizumWebWithReturnUrl(api, john, function (data) {
1285
- payInWithReturnUrl = data;
1286
- done();
1287
- });
1288
- });
1289
- });
1290
-
1291
- describe('Create', function () {
1292
- it('should create Bizum PayIn with Phone', function () {
1293
- expect(payInWithPhone.Id).not.to.be.undefined;
1294
- expect(payInWithPhone.PaymentType).to.equal('BIZUM');
1295
- expect(payInWithPhone.ExecutionType).to.equal('WEB');
1296
- expect(payInWithPhone.AuthorId).to.equal(john.Id);
1297
- expect(payInWithPhone.Status).to.equal('CREATED');
1298
- expect(payInWithPhone.Type).to.equal('PAYIN');
1299
- expect(payInWithPhone.Phone).not.to.be.null;
1300
- expect(payInWithPhone.ReturnURL).to.be.undefined;
1301
- });
1302
- it('should create Bizum PayIn with ReturnUrl', function () {
1303
- expect(payInWithReturnUrl.Id).not.to.be.undefined;
1304
- expect(payInWithReturnUrl.PaymentType).to.equal('BIZUM');
1305
- expect(payInWithReturnUrl.ExecutionType).to.equal('WEB');
1306
- expect(payInWithReturnUrl.AuthorId).to.equal(john.Id);
1307
- expect(payInWithReturnUrl.Status).to.equal('CREATED');
1308
- expect(payInWithReturnUrl.Type).to.equal('PAYIN');
1309
- expect(payInWithReturnUrl.Phone).to.be.null;
1310
- expect(payInWithReturnUrl.ReturnURL).not.to.be.null;
1311
- });
1312
- });
1313
-
1314
- describe('Get', function () {
1315
- var getPayInWithPhone;
1316
- var getPayInWithReturnUrl;
1317
-
1318
- before(function (done) {
1319
- api.PayIns.get(payInWithPhone.Id, function (data, response) {
1320
- getPayInWithPhone = data;
1321
- api.PayIns.get(payInWithReturnUrl.Id, function (data, response) {
1322
- getPayInWithReturnUrl = data;
1323
- done();
1324
- });
1325
- });
1326
- });
1327
-
1328
- it('should get Bizum PayIn with Phone', function () {
1329
- expect(getPayInWithPhone.Id).to.equal(payInWithPhone.Id);
1330
- expect(getPayInWithPhone.PaymentType).to.equal('BIZUM');
1331
- expect(getPayInWithPhone.ExecutionType).to.equal('WEB');
1332
- expect(getPayInWithPhone.Phone).not.to.be.null;
1333
- expect(getPayInWithPhone.Phone).to.equal(payInWithPhone.Phone);
1334
- expect(getPayInWithPhone.ReturnURL).to.equal(payInWithPhone.ReturnURL);
1335
- expect(getPayInWithPhone.ReturnURL).to.be.undefined;
1336
- });
1337
-
1338
- it('should get the Bizum with ReturnUrl', function () {
1339
- expect(getPayInWithReturnUrl.Id).to.equal(payInWithReturnUrl.Id);
1340
- expect(getPayInWithReturnUrl.PaymentType).to.equal('BIZUM');
1341
- expect(getPayInWithReturnUrl.ExecutionType).to.equal('WEB');
1342
- expect(getPayInWithReturnUrl.Phone).to.be.null;
1343
- expect(getPayInWithReturnUrl.ReturnURL).not.to.be.null;
1344
- expect(getPayInWithReturnUrl.ReturnURL).to.equal(payInWithReturnUrl.ReturnURL);
1345
- });
1346
- });
1347
- });
1348
-
1349
- describe('PayPal Web V2', function () {
1350
- var payIn;
1351
-
1352
- before(function (done) {
1353
- helpers.getNewPayInPayPalWeb(api, john, function (data, response) {
1354
- payIn = data;
1355
- done();
1356
- });
1357
- });
1358
-
1359
- describe('Create', function () {
1360
- it('should create the PayIn', function () {
1361
- expect(payIn.Id).not.to.be.undefined;
1362
- expect(payIn.PaymentType).to.equal('PAYPAL');
1363
- expect(payIn.ExecutionType).to.equal('WEB');
1364
- expect(payIn.AuthorId).to.equal(john.Id);
1365
- // expect(payIn.Status).to.equal('CREATED');
1366
- expect(payIn.Type).to.equal('PAYIN');
1367
- expect(payIn.LineItems).not.to.be.null;
1368
- });
1369
- });
1370
-
1371
- describe('Get', function () {
1372
- var getPayIn;
1373
- before(function (done) {
1374
- api.PayIns.get(payIn.Id, function (data, response) {
1375
- getPayIn = data;
1376
- done()
1377
- });
1378
- });
1379
-
1380
- it('should get the PayIn', function () {
1381
- expect(getPayIn.Id).to.equal(payIn.Id);
1382
- expect(getPayIn.PaymentType).to.equal('PAYPAL');
1383
- expect(getPayIn.ExecutionType).to.equal('WEB');
1384
- });
1385
- });
1386
- })
1387
-
1388
- describe('Multibanco Web', function () {
1389
- var payIn;
1390
-
1391
- before(function (done) {
1392
- helpers.getNewPayInMultibancoWeb(api, john, function (data) {
1393
- payIn = data;
1394
- done();
1395
- });
1396
- });
1397
-
1398
- describe('Create', function () {
1399
- it('should create the PayIn', function () {
1400
- expect(payIn.Id).not.to.be.undefined;
1401
- expect(payIn.PaymentType).to.equal('MULTIBANCO');
1402
- expect(payIn.ExecutionType).to.equal('WEB');
1403
- expect(payIn.AuthorId).to.equal(john.Id);
1404
- expect(payIn.Status).to.equal('CREATED');
1405
- expect(payIn.Type).to.equal('PAYIN');
1406
- expect(payIn.Phone).not.to.be.null;
1407
- });
1408
- });
1409
-
1410
- describe('Get', function () {
1411
- var getPayIn;
1412
- before(function (done) {
1413
- api.PayIns.get(payIn.Id, function (data, response) {
1414
- getPayIn = data;
1415
- done()
1416
- });
1417
- });
1418
-
1419
- it('should get the PayIn', function () {
1420
- expect(getPayIn.Id).to.equal(payIn.Id);
1421
- expect(getPayIn.PaymentType).to.equal('MULTIBANCO');
1422
- expect(getPayIn.ExecutionType).to.equal('WEB');
1423
- expect(getPayIn.Phone).not.to.be.null;
1424
- });
1425
- });
1426
- });
1427
-
1428
- describe('Satispay Web', function () {
1429
- var payIn;
1430
-
1431
- before(function (done) {
1432
- helpers.getNewPayInSatispayWeb(api, john, function (data) {
1433
- payIn = data;
1434
- done();
1435
- });
1436
- });
1437
-
1438
- describe('Create', function () {
1439
- it('should create the PayIn', function () {
1440
- expect(payIn.Id).not.to.be.undefined;
1441
- expect(payIn.PaymentType).to.equal('SATISPAY');
1442
- expect(payIn.ExecutionType).to.equal('WEB');
1443
- expect(payIn.AuthorId).to.equal(john.Id);
1444
- expect(payIn.Status).to.equal('CREATED');
1445
- expect(payIn.Type).to.equal('PAYIN');
1446
- expect(payIn.Phone).not.to.be.null;
1447
- });
1448
- });
1449
-
1450
- describe('Get', function () {
1451
- var getPayIn;
1452
- before(function (done) {
1453
- api.PayIns.get(payIn.Id, function (data, response) {
1454
- getPayIn = data;
1455
- done()
1456
- });
1457
- });
1458
-
1459
- it('should get the PayIn', function () {
1460
- expect(getPayIn.Id).to.equal(payIn.Id);
1461
- expect(getPayIn.PaymentType).to.equal('SATISPAY');
1462
- expect(getPayIn.ExecutionType).to.equal('WEB');
1463
- expect(getPayIn.Phone).not.to.be.null;
1464
- });
1465
- });
1466
- });
1467
-
1468
- describe('Blik Web', function () {
1469
- var payIn;
1470
- var payInWithCode;
1471
-
1472
- before(function (done) {
1473
- helpers.getNewPayInBlikWeb(api, john, function (data) {
1474
- payIn = data;
1475
- helpers.getNewPayInBlikWebWithCode(api, john, function (data) {
1476
- payInWithCode = data;
1477
- done();
1478
- });
1479
- });
1480
- });
1481
-
1482
- describe('Create', function () {
1483
- it('should create the PayIn', function () {
1484
- expect(payIn.Id).not.to.be.undefined;
1485
- expect(payIn.PaymentType).to.equal('BLIK');
1486
- expect(payIn.ExecutionType).to.equal('WEB');
1487
- expect(payIn.AuthorId).to.equal(john.Id);
1488
- expect(payIn.Status).to.equal('CREATED');
1489
- expect(payIn.Type).to.equal('PAYIN');
1490
- expect(payIn.Phone).not.to.be.null;
1491
- });
1492
-
1493
- it('should create the PayIn with code', function () {
1494
- expect(payIn.Id).not.to.be.undefined;
1495
- expect(payIn.PaymentType).to.equal('BLIK');
1496
- expect(payIn.ExecutionType).to.equal('WEB');
1497
- expect(payIn.Code).not.to.be.undefined;
1498
- expect(payIn.IpAddress).not.to.be.undefined;
1499
- expect(payIn.BrowserInfo).not.to.be.undefined;
1500
- });
1501
- });
1502
-
1503
- describe('Get', function () {
1504
- var getPayIn;
1505
- before(function (done) {
1506
- api.PayIns.get(payIn.Id, function (data, response) {
1507
- getPayIn = data;
1508
- done()
1509
- });
1510
- });
1511
-
1512
- it('should get the PayIn', function () {
1513
- expect(getPayIn.Id).to.equal(payIn.Id);
1514
- expect(getPayIn.PaymentType).to.equal('BLIK');
1515
- expect(getPayIn.ExecutionType).to.equal('WEB');
1516
- expect(getPayIn.Phone).not.to.be.null;
1517
- });
1518
- });
1519
- });
1520
-
1521
- describe('Klarna Web', function () {
1522
- var payIn;
1523
-
1524
- before(function (done) {
1525
- helpers.getNewPayInKlarnaWeb(api, john, function (data) {
1526
- payIn = data;
1527
- done();
1528
- });
1529
- });
1530
-
1531
- describe('Create', function () {
1532
- it('should create the PayIn', function () {
1533
- expect(payIn.Id).not.to.be.undefined;
1534
- expect(payIn.PaymentType).to.equal('KLARNA');
1535
- expect(payIn.ExecutionType).to.equal('WEB');
1536
- expect(payIn.AuthorId).to.equal(john.Id);
1537
- expect(payIn.Type).to.equal('PAYIN');
1538
- expect(payIn.Phone).not.to.be.null;
1539
- });
1540
- });
1541
-
1542
- describe('Get', function () {
1543
- var getPayIn;
1544
- before(function (done) {
1545
- api.PayIns.get(payIn.Id, function (data, response) {
1546
- getPayIn = data;
1547
- done()
1548
- });
1549
- });
1550
-
1551
- it('should get the PayIn', function () {
1552
- expect(getPayIn.Id).to.equal(payIn.Id);
1553
- expect(getPayIn.PaymentType).to.equal('KLARNA');
1554
- expect(getPayIn.ExecutionType).to.equal('WEB');
1555
- expect(getPayIn.Phone).not.to.be.null;
1556
- });
1557
- });
1558
- });
1559
-
1560
- describe('Ideal Web', function () {
1561
- var payIn;
1562
-
1563
- before(function (done) {
1564
- helpers.getNewPayInIdealWeb(api, john, function (data) {
1565
- payIn = data;
1566
- done();
1567
- });
1568
- });
1569
-
1570
- describe('Create', function () {
1571
- it('should create the PayIn', function () {
1572
- expect(payIn.Id).not.to.be.undefined;
1573
- expect(payIn.PaymentType).to.equal('IDEAL');
1574
- expect(payIn.ExecutionType).to.equal('WEB');
1575
- expect(payIn.AuthorId).to.equal(john.Id);
1576
- expect(payIn.Type).to.equal('PAYIN');
1577
- expect(payIn.Phone).not.to.be.null;
1578
- });
1579
- });
1580
-
1581
- describe('Get', function () {
1582
- var getPayIn;
1583
- before(function (done) {
1584
- api.PayIns.get(payIn.Id, function (data, response) {
1585
- getPayIn = data;
1586
- done()
1587
- });
1588
- });
1589
-
1590
- it('should get the PayIn', function () {
1591
- expect(getPayIn.Id).to.equal(payIn.Id);
1592
- expect(getPayIn.PaymentType).to.equal('IDEAL');
1593
- expect(getPayIn.ExecutionType).to.equal('WEB');
1594
- expect(getPayIn.Phone).not.to.be.null;
1595
- });
1596
- });
1597
- });
1598
-
1599
- describe('Giropay Web', function () {
1600
- var payIn;
1601
-
1602
- before(function (done) {
1603
- helpers.getNewPayInGiropayWeb(api, john, function (data) {
1604
- payIn = data;
1605
- done();
1606
- });
1607
- });
1608
-
1609
- describe('Create', function () {
1610
- it('should create the PayIn', function () {
1611
- expect(payIn.Id).not.to.be.undefined;
1612
- expect(payIn.PaymentType).to.equal('GIROPAY');
1613
- expect(payIn.ExecutionType).to.equal('WEB');
1614
- expect(payIn.AuthorId).to.equal(john.Id);
1615
- expect(payIn.Type).to.equal('PAYIN');
1616
- expect(payIn.Phone).not.to.be.null;
1617
- });
1618
- });
1619
-
1620
- describe('Get', function () {
1621
- var getPayIn;
1622
- before(function (done) {
1623
- api.PayIns.get(payIn.Id, function (data, response) {
1624
- getPayIn = data;
1625
- done();
1626
- });
1627
- });
1628
-
1629
- it('should get the PayIn', function () {
1630
- expect(getPayIn.Id).to.equal(payIn.Id);
1631
- expect(getPayIn.PaymentType).to.equal('GIROPAY');
1632
- expect(getPayIn.ExecutionType).to.equal('WEB');
1633
- expect(getPayIn.Phone).not.to.be.null;
1634
- });
1635
- });
1636
- });
1637
-
1638
- describe('Swish Web', function () {
1639
- var payIn;
1640
-
1641
- before(function (done) {
1642
- helpers.getNewPayInSwishWeb(api, john, function (data) {
1643
- payIn = data;
1644
- done();
1645
- });
1646
- });
1647
-
1648
- describe('Create', function () {
1649
- it('should create the PayIn', function () {
1650
- expect(payIn.Id).not.to.be.undefined;
1651
- expect(payIn.PaymentType).to.equal('SWISH');
1652
- expect(payIn.ExecutionType).to.equal('WEB');
1653
- expect(payIn.AuthorId).to.equal(john.Id);
1654
- expect(payIn.Type).to.equal('PAYIN');
1655
- expect(payIn.Phone).not.to.be.null;
1656
- });
1657
- });
1658
-
1659
- describe('Get', function () {
1660
- var getPayIn;
1661
- before(function (done) {
1662
- api.PayIns.get(payIn.Id, function (data, response) {
1663
- getPayIn = data;
1664
- done();
1665
- });
1666
- });
1667
-
1668
- it('should get the PayIn', function () {
1669
- expect(getPayIn.Id).to.equal(payIn.Id);
1670
- expect(getPayIn.PaymentType).to.equal('SWISH');
1671
- expect(getPayIn.ExecutionType).to.equal('WEB');
1672
- expect(getPayIn.Phone).not.to.be.null;
1673
- });
1674
- });
1675
- });
1676
-
1677
- describe('Twint Web', function () {
1678
- var payIn;
1679
-
1680
- before(function (done) {
1681
- helpers.getNewPayInTwintWeb(api, john, function (data) {
1682
- payIn = data;
1683
- done();
1684
- });
1685
- });
1686
-
1687
- describe('Create', function () {
1688
- it('should create the PayIn', function () {
1689
- expect(payIn.Id).not.to.be.undefined;
1690
- expect(payIn.PaymentType).to.equal('TWINT');
1691
- expect(payIn.ExecutionType).to.equal('WEB');
1692
- expect(payIn.AuthorId).to.equal(john.Id);
1693
- expect(payIn.Type).to.equal('PAYIN');
1694
- expect(payIn.Phone).not.to.be.null;
1695
- });
1696
- });
1697
-
1698
- describe('Get', function () {
1699
- var getPayIn;
1700
- before(function (done) {
1701
- api.PayIns.get(payIn.Id, function (data, response) {
1702
- getPayIn = data;
1703
- done();
1704
- });
1705
- });
1706
-
1707
- it('should get the PayIn', function () {
1708
- expect(getPayIn.Id).to.equal(payIn.Id);
1709
- expect(getPayIn.PaymentType).to.equal('TWINT');
1710
- expect(getPayIn.ExecutionType).to.equal('WEB');
1711
- expect(getPayIn.Phone).not.to.be.null;
1712
- });
1713
- });
1714
- });
1715
-
1716
- describe('Ideal Legacy Web', function () {
1717
- var payIn;
1718
-
1719
- before(function (done) {
1720
- helpers.getLegacyPayInIdealCardWeb(api, john, function (data) {
1721
- payIn = data;
1722
- done();
1723
- });
1724
- });
1725
-
1726
- describe('Create', function () {
1727
- it('should create the legacy PayIn', function () {
1728
- expect(payIn.Id).not.to.be.undefined;
1729
- expect(payIn.BankName).not.to.be.null;
1730
- expect(payIn.CardType).to.equal('IDEAL');
1731
- expect(payIn.PaymentType).to.equal('CARD');
1732
- expect(payIn.ExecutionType).to.equal('WEB');
1733
- expect(payIn.AuthorId).to.equal(john.Id);
1734
- expect(payIn.Type).to.equal('PAYIN');
1735
- expect(payIn.Phone).not.to.be.null;
1736
- });
1737
- });
1738
- });
1739
-
1740
- // skip because we cannot generate new paymentData in the tests
1741
- describe.skip('GooglePay V2', function () {
1742
- var googlePayIn, wallet;
1743
-
1744
- before(function (done) {
1745
- wallet = {
1746
- Owners: [john.Id],
1747
- Currency: 'EUR',
1748
- Description: 'WALLET IN EUR'
1749
- };
1750
-
1751
- api.Wallets.create(wallet).then(function () {
1752
- done();
1753
- });
1754
- });
1755
-
1756
- describe('Create', function () {
1757
-
1758
- var paymentData = "{\"signature\":\"MEUCIQCLXOan2Y9DobLVSOeD5V64Peayvz0ZAWisdz/1iTdthAIgVFb4Hve4EhtW81k46S" +
1759
- "iMlnXLIiCn1h2+vVQGjHe+sSo\\u003d\",\"intermediateSigningKey\":{\"signedKey\":\"{\\\"keyValue\\\":\\\"M" +
1760
- "FkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEDGRER6R6PH6K39YTIYX+CpDNej6gQgvi/Wx19SOPtiDnkjAl4/LF9pXlvZYe+aJH0Dy" +
1761
- "095I6BlfY8bNBB5gjPg\\\\u003d\\\\u003d\\\",\\\"keyExpiration\\\":\\\"1688521049102\\\"}\"," +
1762
- "\"signatures\":[\"MEYCIQDup1B+rkiPAWmpg7RmqY0NfgdGhmdyL8wvAX+6C1aOU2QIhAIZACSDQ/ZexIyEia5KrRlG2B+y3AnK" +
1763
- "NlhRzumRcnNOR\"]},\"protocolVersion\":\"ECv2\",\"signedMessage\":\"{\\\"encryptedMessage\\\":\\\"YSSG" +
1764
- "K9yFdKP+mJB5+wAjnOujnThPM1E/KbbJxd3MDzPVI66ip1DBESldvQXYjjeLq6Rf1tKE9oLwwaj6u0/gU7Z9t3g1MoW+9YoEE1bs1" +
1765
- "IxImif7IQGAosfYjjbBBfDkOaqEs2JJC5qt6xjKO9lQ/E6JPkPFGqF7+OJ1vzmD83Pi3sHWkVge5MhxXQ3yBNhrjus3kV7zUoYA+u" +
1766
- "qNrciWcWypc1NndF/tiwSkvUTzM6n4dS8X84fkJiSO7PZ65C0yw0mdybRRnyL2fFdWGssve1zZFAvYfzcpNamyuZGGlu/SCoayit" +
1767
- "ojmMsqe5Cu0efD9+WvvDr9PA+Vo1gzuz7LmiZe81SGvdFhRoq62FBAUiwSsi2A3pWinZxM2XbYNph+HJ5FCNspWhz4ur9JG4ZMLem" +
1768
- "CXuaybvL++W6PWywAtoiE0mQcBIX3vhOq5itv0RkaKVe6nbcAS2UryRz2u /nDCJLKpIv2Wi11NtCUT2mgD8F6qfcXhvVZHyeLqZ1O" +
1769
- "LgCudTTSdKirzezbgPTg4tQpW++KufeD7bgG+01XhCWt+7/ftqcSf8n//gSRINne8j2G6w+2\\\",\\" +
1770
- "\"ephemeralPublicKey\\\":\\\"BLY2+R8C0T+BSf/W3HEq305qH63IGmJxMVmbfJ6+x1V7GQg9W9v7eHc3j+8TeypVn+nRl" +
1771
- "Pu98tivuMXECg+rWZs\\\\u003d\\\",\\\"tag\\\":\\\"MmEjNdLfsDNfYd/FRUjoJ4/IfLypNRqx8zgHfa6Ftmo\\\\u003d\\\"}\"}"
1772
-
1773
- before(function (done) {
1774
- googlePayIn = {
1775
- AuthorId: john.Id,
1776
- CreditedWalletId: wallet.Id,
1777
- DebitedFunds: {
1778
- Amount: 199,
1779
- Currency: 'EUR'
1780
- },
1781
- Fees: {
1782
- Amount: 1,
1783
- Currency: 'EUR'
1784
- },
1785
- PaymentType: 'GOOGLE_PAY',
1786
- ExecutionType: 'DIRECT',
1787
- PaymentData: paymentData,
1788
- Tag: "Create an GooglePay card direct Payin",
1789
- StatementDescriptor: "php",
1790
- BrowserInfo: {
1791
- AcceptHeader: "text/html, application/xhtml+xml, application/xml;q=0.9, /;q=0.8",
1792
- JavaEnabled: true,
1793
- Language: "FR-FR",
1794
- ColorDepth: 4,
1795
- ScreenHeight: 1800,
1796
- ScreenWidth: 400,
1797
- JavascriptEnabled: true,
1798
- TimeZoneOffset: "+60",
1799
- UserAgent: "Mozilla/5.0 (iPhone; CPU iPhone OS 13_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148"
1800
- },
1801
- IpAddress: "2001:0620:0000:0000:0211:24FF:FE80:C12C",
1802
- SecureModeReturnURL: "http://www.my-site.com/returnurl",
1803
- SecureMode: "DEFAULT",
1804
- ReturnURL: "http://test.com",
1805
- Billing: {
1806
- FirstName: 'Joe',
1807
- LastName: 'Blogs',
1808
- Address: {
1809
- AddressLine1: '1 MangoPay Street',
1810
- AddressLine2: 'The Loop',
1811
- City: 'Paris',
1812
- Region: 'Ile de France',
1813
- PostalCode: '75001',
1814
- Country: 'FR'
1815
- }
1816
- },
1817
- Shipping: {
1818
- FirstName: 'Joe',
1819
- LastName: 'Blogs',
1820
- Address: {
1821
- AddressLine1: '1 MangoPay Street',
1822
- AddressLine2: 'The Loop',
1823
- City: 'Paris',
1824
- Region: 'Ile de France',
1825
- PostalCode: '75001',
1826
- Country: 'FR'
1827
- }
1828
- }
1829
- };
1830
-
1831
- api.PayIns.createGooglePay(googlePayIn, function (data, response) {
1832
- googlePayIn = data;
1833
- done();
1834
- });
1835
- });
1836
-
1837
- it('should be created', function () {
1838
- expect(googlePayIn.Id).not.to.be.undefined;
1839
- expect(googlePayIn.AuthorId).to.equal(john.Id);
1840
- expect(googlePayIn.PaymentType).to.equal('GOOGLE_PAY');
1841
- expect(googlePayIn.ExecutionType).to.equal('DIRECT');
1842
- expect(googlePayIn.Type).to.equal('PAYIN');
1843
- });
1844
- });
1845
- });
1846
-
1847
- describe('Payment Method Metadata', function () {
1848
- var metadata;
1849
- var payIn;
1850
-
1851
- before(function (done) {
1852
- helpers.getNewPayInCardDirect(api, john, function (createdPayIn) {
1853
- payIn = createdPayIn
1854
- var metadataPost = {
1855
- Type: "BIN",
1856
- Bin: payIn.CardInfo.BIN
1857
- }
1858
-
1859
- api.PayIns.getPaymentMethodMetadata(metadataPost, function (data) {
1860
- metadata = data;
1861
- done();
1862
- });
1863
- });
1864
- });
1865
-
1866
- describe('Fetch Metadata', function () {
1867
- it('should fetch the payment method metadata', function () {
1868
- expect(metadata.Type).to.equal('BIN')
1869
- expect(metadata.Bin).to.equal(payIn.CardInfo.BIN);
1870
- });
1871
- });
1872
-
1873
- });
1874
-
1875
- describe('Card PreAuthorized Deposit', function () {
1876
- var payIn;
1877
-
1878
- before(function (done) {
1879
- helpers.createNewCardPreAuthorizedDepositPayIn(function (data, response) {
1880
- payIn = data;
1881
- done();
1882
- });
1883
- });
1884
-
1885
- it('should be created', function () {
1886
- expect(payIn).not.to.be.undefined;
1887
- expect(payIn.Status).to.equal('SUCCEEDED');
1888
- expect(payIn.PaymentType).to.equal('PREAUTHORIZED');
1889
- expect(payIn.ExecutionType).to.equal('DIRECT');
1890
- expect(payIn.DepositId).not.to.be.undefined;
1891
- });
1892
- });
1893
-
1894
- describe('Card PreAuthorized Deposit prior to complement', function () {
1895
- var payIn;
1896
-
1897
- before(function (done) {
1898
- helpers.createNewDeposit(function (data, response) {
1899
- var deposit = data;
1900
- var wallet = {
1901
- Owners: [deposit.AuthorId],
1902
- Currency: 'EUR',
1903
- Description: 'WALLET IN EUR'
1904
- };
1905
-
1906
- api.Wallets.create(wallet).then(function(data) {
1907
- var payInDto = {
1908
- AuthorId: deposit.AuthorId,
1909
- CreditedWalletId: wallet.Id,
1910
- DebitedFunds: {
1911
- Currency: 'EUR',
1912
- Amount: 1000
1913
- },
1914
- Fees: {
1915
- Currency: 'EUR',
1916
- Amount: 0
1917
- },
1918
- DepositId: deposit.Id
1919
- };
1920
-
1921
- api.PayIns.createDepositPreauthorizedPayInPriorToComplement(payInDto).then(function(data) {
1922
- payIn = data;
1923
- done();
1924
- });
1925
- });
1926
- });
1927
- });
1928
-
1929
- it('should be created', function () {
1930
- expect(payIn).not.to.be.undefined;
1931
- expect(payIn.Status).to.equal('SUCCEEDED');
1932
- expect(payIn.PaymentType).to.equal('PREAUTHORIZED');
1933
- expect(payIn.ExecutionType).to.equal('DIRECT');
1934
- expect(payIn.DepositId).not.to.be.undefined;
1935
- });
1936
- });
1937
-
1938
- describe.skip('Card PreAuthorized Deposit complement', function () {
1939
- // skipped because of PSP configuration error
1940
- var payIn;
1941
-
1942
- before(function (done) {
1943
- helpers.createNewDeposit(function (data, response) {
1944
- var deposit = data;
1945
- var wallet = {
1946
- Owners: [deposit.AuthorId],
1947
- Currency: 'EUR',
1948
- Description: 'WALLET IN EUR'
1949
- };
1950
-
1951
- api.Wallets.create(wallet).then(function(data) {
1952
- var depositUpdate = {
1953
- Id: deposit.Id,
1954
- PaymentStatus: "NO_SHOW_REQUESTED"
1955
- };
1956
-
1957
- api.Deposits.update(depositUpdate).then(function(data) {
1958
- var payInDto = {
1959
- AuthorId: deposit.AuthorId,
1960
- CreditedWalletId: wallet.Id,
1961
- DebitedFunds: {
1962
- Currency: 'EUR',
1963
- Amount: 1000
1964
- },
1965
- Fees: {
1966
- Currency: 'EUR',
1967
- Amount: 0
1968
- },
1969
- DepositId: deposit.Id
1970
- };
1971
-
1972
- api.PayIns.createDepositPreauthorizedPayInComplement(payInDto).then(function(data) {
1973
- payIn = data;
1974
- done();
1975
- });
1976
- });
1977
- });
1978
- });
1979
- });
1980
-
1981
- it('should be created', function () {
1982
- expect(payIn).not.to.be.undefined;
1983
- expect(payIn.Status).to.equal('SUCCEEDED');
1984
- expect(payIn.PaymentType).to.equal('PREAUTHORIZED');
1985
- expect(payIn.ExecutionType).to.equal('DIRECT');
1986
- expect(payIn.DepositId).not.to.be.undefined;
1987
- });
1988
- });
1989
-
1990
- describe('Pay by Bank Web', function () {
1991
- var payIn;
1992
-
1993
- before(function (done) {
1994
- helpers.getNewPayInPayByBankWeb(api, john, function (data) {
1995
- payIn = data;
1996
- done();
1997
- });
1998
- });
1999
-
2000
- describe('Create', function () {
2001
- it('should create the PayIn', function () {
2002
- expect(payIn.Id).not.to.be.undefined;
2003
- expect(payIn.PaymentType).to.equal('PAY_BY_BANK');
2004
- expect(payIn.ExecutionType).to.equal('WEB');
2005
- expect(payIn.AuthorId).to.equal(john.Id);
2006
- expect(payIn.Type).to.equal('PAYIN');
2007
- expect(payIn.Country).not.to.be.null;
2008
- expect(payIn.RedirectURL).not.to.be.null;
2009
- expect(payIn.ReturnURL).not.to.be.null;
2010
- expect(payIn.IBAN).not.to.be.null;
2011
- expect(payIn.BIC).not.to.be.null;
2012
- expect(payIn.PaymentFlow).not.to.be.null;
2013
- expect(payIn.BankName).not.to.be.null;
2014
- expect(payIn.Culture).not.to.be.null;
2015
- expect(payIn.Scheme).not.to.be.null;
2016
- });
2017
- });
2018
-
2019
- describe('Get', function () {
2020
- var getPayIn;
2021
- before(function (done) {
2022
- api.PayIns.get(payIn.Id, function (data, response) {
2023
- getPayIn = data;
2024
- done();
2025
- });
2026
- });
2027
-
2028
- it('should get the PayIn', function () {
2029
- expect(getPayIn.Id).to.equal(payIn.Id);
2030
- expect(getPayIn.PaymentType).to.equal('PAY_BY_BANK');
2031
- expect(getPayIn.ExecutionType).to.equal('WEB');
2032
- });
2033
- });
2034
-
2035
- describe('Get supported banks', function () {
2036
- var withoutFilterAndPagination;
2037
- var withFilter;
2038
- var withPagination;
2039
- var withFilterAndPagination;
2040
-
2041
- before(function (done) {
2042
- api.PayIns.getPayByBankSupportedBanks(function (data, response) {
2043
- withoutFilterAndPagination = data;
2044
- done();
2045
- });
2046
- });
2047
-
2048
- before(function (done) {
2049
- api.PayIns.getPayByBankSupportedBanks(function (data, response) {
2050
- withFilter = data;
2051
- done();
2052
- }, {
2053
- CountryCodes: "DE"
2054
- });
2055
- });
2056
-
2057
- before(function (done) {
2058
- api.PayIns.getPayByBankSupportedBanks(function (data, response) {
2059
- withPagination = data;
2060
- done();
2061
- }, {
2062
- per_page: 2,
2063
- page: 1
2064
- });
2065
- });
2066
-
2067
- before(function (done) {
2068
- api.PayIns.getPayByBankSupportedBanks(function (data, response) {
2069
- withFilterAndPagination = data;
2070
- done();
2071
- }, {
2072
- per_page: 2,
2073
- page: 1,
2074
- CountryCodes: "DE"
2075
- });
2076
- });
2077
-
2078
- it('should get the supported banks', function () {
2079
- expect(withoutFilterAndPagination).not.to.be.undefined;
2080
- expect(withoutFilterAndPagination.SupportedBanks.Countries.length).to.be.above(0);
2081
-
2082
- expect(withoutFilterAndPagination.SupportedBanks.Countries.length)
2083
- .to.be.greaterThan(withFilter.SupportedBanks.Countries.length);
2084
- expect(withFilter.SupportedBanks.Countries[0].Banks.length).to.eq(5);
2085
-
2086
- expect(withPagination.SupportedBanks.Countries[0].Banks.length).to.eq(2);
2087
-
2088
- expect(withoutFilterAndPagination.SupportedBanks.Countries.length)
2089
- .to.be.greaterThan(withFilterAndPagination.SupportedBanks.Countries.length);
2090
- expect(withFilterAndPagination.SupportedBanks.Countries[0].Banks.length).to.eq(2);
2091
- });
2092
- });
2093
- });
2094
-
2095
- describe('PayIn Intent', function () {
2096
- describe('Create intent authorization', function () {
2097
- var payInIntent;
2098
-
2099
- before(function (done) {
2100
- helpers.getNewPayInIntentAuthorization(api, john, function (data) {
2101
- payInIntent = data;
2102
- done();
2103
- });
2104
- });
2105
-
2106
- it('should create the PayInIntent Authorization', function () {
2107
- expect(payInIntent.Id).not.to.be.undefined;
2108
- expect(payInIntent.Status).to.equal('AUTHORIZED');
2109
- });
2110
- });
2111
-
2112
- describe('Create full capture', function () {
2113
- var payInIntent;
2114
-
2115
- before(function (done) {
2116
- helpers.getNewPayInIntentFullCapture(api, john, function (data) {
2117
- payInIntent = data;
2118
- done();
2119
- });
2120
- });
2121
-
2122
- it('should create the PayInIntent Full Capture', function () {
2123
- expect(payInIntent.Id).not.to.be.undefined;
2124
- expect(payInIntent.Status).to.equal('CAPTURED');
2125
- });
2126
- });
2127
-
2128
- describe('Create partial capture', function () {
2129
- var payInIntent;
2130
-
2131
- before(function (done) {
2132
- helpers.getNewPayInIntentAuthorization(api, john, function (data) {
2133
- const toCreate = {
2134
- "Amount" : 1000,
2135
- "Currency" : "EUR",
2136
- "PlatformFeesAmount": 0,
2137
- "ExternalData" : {
2138
- "ExternalProcessingDate" : 1727788165,
2139
- "ExternalProviderReference" : Math.random().toString(),
2140
- "ExternalMerchantReference" : "Order-xyz-35e8490e-2ec9-4c82-978e-c712a3f5ba16",
2141
- "ExternalProviderName" : "Stripe",
2142
- "ExternalProviderPaymentMethod" : "PAYPAL"
2143
- },
2144
- "LineItems": [
2145
- {
2146
- "Amount": 1000,
2147
- "Id": data.LineItems[0].Id
2148
- }
2149
- ]
2150
- };
2151
- api.PayIns.createPayInIntentPartialCapture(data.Id, toCreate, function(data) {
2152
- payInIntent = data;
2153
- done();
2154
- });
2155
- });
2156
- });
2157
-
2158
- it('should create the PayInIntent Partial Capture', function () {
2159
- expect(payInIntent.Id).not.to.be.undefined;
2160
- expect(payInIntent.Status).to.equal('CAPTURED');
2161
- });
2162
- });
2163
-
2164
- describe('Get intent', function () {
2165
- var fetched;
2166
- var created;
2167
-
2168
- before(function (done) {
2169
- helpers.getNewPayInIntentAuthorization(api, john, function (data) {
2170
- created = data;
2171
- api.PayIns.getPayInIntent(created.Id, function(data) {
2172
- fetched = data;
2173
- done();
2174
- });
2175
- });
2176
- });
2177
-
2178
- it('should get the intent', function () {
2179
- expect(fetched.Id).to.equal(created.Id);
2180
- expect(fetched.Status).to.equal(created.Status);
2181
- });
2182
- });
2183
-
2184
- describe('Cancel intent', function () {
2185
- var canceled;
2186
- var created;
2187
-
2188
- before(function (done) {
2189
- helpers.getNewPayInIntentAuthorization(api, john, function (data) {
2190
- created = data;
2191
- const cancelDetails = {
2192
- "ExternalData" : {
2193
- "ExternalProcessingDate" : 1728133765,
2194
- "ExternalProviderReference" : Math.random().toString(),
2195
- }
2196
- };
2197
- api.PayIns.fullCancelPayInIntent(created.Id, cancelDetails, function(data) {
2198
- canceled = data;
2199
- done();
2200
- });
2201
- });
2202
- });
2203
-
2204
- it('should cancel the intent', function () {
2205
- expect(canceled.Status).to.equal('CANCELLED');
2206
- });
2207
- });
2208
-
2209
- describe('Create splits', function () {
2210
- var payInIntent;
2211
- var splitsResult;
2212
-
2213
- before(function (done) {
2214
- helpers.getNewPayInIntentAuthorization(api, john, function (data) {
2215
- payInIntent = data;
2216
- const fullCapture = {
2217
- "ExternalData" : {
2218
- "ExternalProcessingDate" : 1727788165,
2219
- "ExternalProviderReference" : Math.random().toString(),
2220
- "ExternalMerchantReference" : "Order-xyz-35e8490e-2ec9-4c82-978e-c712a3f5ba16",
2221
- "ExternalProviderName" : "Stripe",
2222
- "ExternalProviderPaymentMethod" : "PAYPAL"
2223
- }
2224
- };
2225
- api.PayIns.createPayInIntentFullCapture(payInIntent.Id, fullCapture, function(data) {
2226
- const splits = {
2227
- Splits: [
2228
- {
2229
- LineItemId: payInIntent.LineItems[0].Id,
2230
- SplitAmount: 10
2231
- }
2232
- ]
2233
- };
2234
- api.PayIns.createPayInIntentSplits(payInIntent.Id, splits, function(data) {
2235
- splitsResult = data;
2236
- done();
2237
- });
2238
- });
2239
- });
2240
- });
2241
-
2242
- it('should create the Splits', function () {
2243
- expect(splitsResult.Splits[0].Status).to.equal('CREATED');
2244
- });
2245
- });
2246
- });
2247
-
2248
- describe('PayIn Intent', function () {
2249
- describe('Create intent authorization', function () {
2250
- var payInIntent;
2251
-
2252
- before(function (done) {
2253
- helpers.getNewPayInIntentAuthorization(api, john, function (data) {
2254
- payInIntent = data;
2255
- done();
2256
- });
2257
- });
2258
-
2259
- it('should create the PayInIntent Authorization', function () {
2260
- expect(payInIntent.Id).not.to.be.undefined;
2261
- expect(payInIntent.Status).to.equal('AUTHORIZED');
2262
- });
2263
- });
2264
-
2265
- describe('Create full capture', function () {
2266
- var payInIntent;
2267
-
2268
- before(function (done) {
2269
- helpers.getNewPayInIntentAuthorization(api, john, function (data) {
2270
- const toCreate = {
2271
- "ExternalData" : {
2272
- "ExternalProcessingDate" : 1727788165,
2273
- "ExternalProviderReference" : Math.random().toString(),
2274
- "ExternalMerchantReference" : "Order-xyz-35e8490e-2ec9-4c82-978e-c712a3f5ba16",
2275
- "ExternalProviderName" : "Stripe",
2276
- "ExternalProviderPaymentMethod" : "PAYPAL"
2277
- }
2278
- };
2279
- api.PayIns.createPayInIntentFullCapture(data.Id, toCreate, function(data) {
2280
- payInIntent = data;
2281
- done();
2282
- });
2283
- });
2284
- });
2285
-
2286
- it('should create the PayInIntent Full Capture', function () {
2287
- expect(payInIntent.Id).not.to.be.undefined;
2288
- expect(payInIntent.Status).to.equal('CAPTURED');
2289
- });
2290
- });
2291
-
2292
- describe('Create partial capture', function () {
2293
- var payInIntent;
2294
-
2295
- before(function (done) {
2296
- helpers.getNewPayInIntentAuthorization(api, john, function (data) {
2297
- const toCreate = {
2298
- "Amount" : 1000,
2299
- "Currency" : "EUR",
2300
- "PlatformFeesAmount": 0,
2301
- "ExternalData" : {
2302
- "ExternalProcessingDate" : 1727788165,
2303
- "ExternalProviderReference" : Math.random().toString(),
2304
- "ExternalMerchantReference" : "Order-xyz-35e8490e-2ec9-4c82-978e-c712a3f5ba16",
2305
- "ExternalProviderName" : "Stripe",
2306
- "ExternalProviderPaymentMethod" : "PAYPAL"
2307
- },
2308
- "LineItems": [
2309
- {
2310
- "Amount": 1000,
2311
- "Id": data.LineItems[0].Id
2312
- }
2313
- ]
2314
- };
2315
- api.PayIns.createPayInIntentPartialCapture(data.Id, toCreate, function(data) {
2316
- payInIntent = data;
2317
- done();
2318
- });
2319
- });
2320
- });
2321
-
2322
- it('should create the PayInIntent Partial Capture', function () {
2323
- expect(payInIntent.Id).not.to.be.undefined;
2324
- expect(payInIntent.Status).to.equal('CAPTURED');
2325
- });
2326
- });
2327
-
2328
- describe('Get intent', function () {
2329
- var fetched;
2330
- var created;
2331
-
2332
- before(function (done) {
2333
- helpers.getNewPayInIntentAuthorization(api, john, function (data) {
2334
- created = data;
2335
- api.PayIns.getPayInIntent(created.Id, function(data) {
2336
- fetched = data;
2337
- done();
2338
- });
2339
- });
2340
- });
2341
-
2342
- it('should get the intent', function () {
2343
- expect(fetched.Id).to.equal(created.Id);
2344
- expect(fetched.Status).to.equal(created.Status);
2345
- });
2346
- });
2347
-
2348
- // describe('Cancel intent', function () {
2349
- // var canceled;
2350
- // var created;
2351
- //
2352
- // before(function (done) {
2353
- // helpers.getNewPayInIntentAuthorization(api, john, function (data) {
2354
- // created = data;
2355
- // const cancelDetails = {
2356
- // "ExternalData" : {
2357
- // "ExternalProcessingDate" : 1728133765,
2358
- // "ExternalProviderReference" : Math.random().toString(),
2359
- // }
2360
- // };
2361
- // api.PayIns.fullCancelPayInIntent(created.Id, cancelDetails, function(data) {
2362
- // canceled = data;
2363
- // done();
2364
- // });
2365
- // });
2366
- // });
2367
- //
2368
- // it('should cancel the intent', function () {
2369
- // expect(canceled.Status).to.equal('CANCELED');
2370
- // });
2371
- // });
2372
-
2373
- describe('Create splits', function () {
2374
- var payInIntent;
2375
- var splitsResult;
2376
-
2377
- before(function (done) {
2378
- helpers.getNewPayInIntentAuthorization(api, john, function (data) {
2379
- payInIntent = data;
2380
- helpers.getNewPayInIntentSplit(api, payInIntent, function(data) {
2381
- splitsResult = data;
2382
- done();
2383
- });
2384
- });
2385
- });
2386
-
2387
- it('should create the Splits', function () {
2388
- expect(splitsResult.Splits[0].Status).to.equal('CREATED');
2389
- });
2390
- });
2391
-
2392
- describe('Execute split', function () {
2393
- var payInIntent;
2394
- var error;
2395
-
2396
- before(function (done) {
2397
- helpers.getNewPayInIntentAuthorization(api, john, function (data) {
2398
- payInIntent = data;
2399
- helpers.getNewPayInIntentSplit(api, data, function (data) {
2400
- api.PayIns.executePayInIntentSplit(payInIntent.Id, data.Splits[0].Id, function (data) {
2401
- })
2402
- .catch(function (err) {
2403
- error = err;
2404
- done();
2405
- });
2406
- });
2407
- });
2408
- });
2409
-
2410
- it('should return error while trying to execute the Split', function () {
2411
- // expect error. A success use case cannot be automated because it needs a PayIn to be created manually
2412
- expect(error.Errors.Split).to.contain("Execute split requires a status in [AVAILABLE, REJECTED]");
2413
- });
2414
- });
2415
-
2416
- describe('Reverse split', function () {
2417
- var payInIntent;
2418
- var reversedSplit;
2419
-
2420
- before(function (done) {
2421
- helpers.getNewPayInIntentAuthorization(api, john, function (data) {
2422
- payInIntent = data;
2423
- helpers.getNewPayInIntentSplit(api, data, function (data) {
2424
- api.PayIns.reversePayInIntentSplit(payInIntent.Id, data.Splits[0].Id, function (data) {
2425
- reversedSplit = data;
2426
- done();
2427
- });
2428
- });
2429
- });
2430
- });
2431
-
2432
- it('should return error while trying to reverse the Split', function () {
2433
- // expect error. A success use case cannot be automated because it needs a PayIn to be created manually
2434
- expect(reversedSplit.Status).to.eq("REVERSED");
2435
- });
2436
- });
2437
-
2438
- describe('Get split', function () {
2439
- var payInIntent;
2440
- var fetched;
2441
-
2442
- before(function (done) {
2443
- helpers.getNewPayInIntentAuthorization(api, john, function (data) {
2444
- payInIntent = data;
2445
- helpers.getNewPayInIntentSplit(api, data, function (data) {
2446
- api.PayIns.getPayInIntentSplit(payInIntent.Id, data.Splits[0].Id, function (data) {
2447
- fetched = data;
2448
- done();
2449
- });
2450
- });
2451
- });
2452
- });
2453
-
2454
- it('should get the Split', function () {
2455
- expect(fetched.Status).to.equal('CREATED');
2456
- });
2457
- });
2458
-
2459
- describe('Update split', function () {
2460
- var payInIntent;
2461
- var updated;
2462
-
2463
- before(function (done) {
2464
- helpers.getNewPayInIntentAuthorization(api, john, function (data) {
2465
- payInIntent = data;
2466
- helpers.getNewPayInIntentSplit(api, data, function (data) {
2467
- const dto = {
2468
- LineItemId: data.Splits[0].LineItemId,
2469
- Description: "updated description"
2470
- };
2471
- api.PayIns.updatePayInIntentSplit(payInIntent.Id, data.Splits[0].Id, dto, function (data) {
2472
- updated = data;
2473
- done();
2474
- });
2475
- });
2476
- });
2477
- });
2478
-
2479
- it('should update the Split', function () {
2480
- expect(updated.Description).to.equal("updated description");
2481
- });
2482
- });
2483
-
2484
- describe('Create intent full refund', function () {
2485
- var intentRefund;
2486
-
2487
- before(function (done) {
2488
- helpers.getNewPayInIntentFullRefund(api, john, function (data) {
2489
- intentRefund = data;
2490
- done();
2491
- });
2492
- });
2493
-
2494
- it('should create the PayInIntent Full Refund', function () {
2495
- expect(intentRefund.Id).not.to.be.undefined;
2496
- expect(intentRefund.Status).to.equal('REFUNDED');
2497
- });
2498
- });
2499
-
2500
- describe('Create intent partial refund', function () {
2501
- var intentRefund;
2502
-
2503
- before(function (done) {
2504
- helpers.getNewPayInIntentFullCapture(api, john, function (data) {
2505
- const partialRefundDto = {
2506
- "Amount": 1000,
2507
- "LineItems": [
2508
- {
2509
- "Id": data.LineItems[0].Id,
2510
- "Amount": data.LineItems[0].TotalLineItemAmount
2511
- }
2512
- ],
2513
- "ExternalData" : {
2514
- "ExternalProcessingDate" : 1727788165,
2515
- "ExternalProviderReference" : Math.random().toString(),
2516
- "ExternalMerchantReference" : "Order-xyz-35e8490e-2ec9-4c82-978e-c712a3f5ba16",
2517
- "ExternalProviderName" : "Stripe",
2518
- "ExternalProviderPaymentMethod" : "PAYPAL"
2519
- }
2520
- };
2521
- api.PayIns.createPayInIntentRefund(data.Id, partialRefundDto, function(data) {
2522
- intentRefund = data;
2523
- done();
2524
- });
2525
- });
2526
- });
2527
-
2528
- it('should create the PayInIntent Full Refund', function () {
2529
- expect(intentRefund.Id).not.to.be.undefined;
2530
- expect(intentRefund.Status).to.equal('REFUNDED');
2531
- });
2532
- });
2533
-
2534
- describe('Fully reverse intent refund', function () {
2535
- var reversedIntentRefund;
2536
-
2537
- before(function (done) {
2538
- helpers.getNewPayInIntentFullRefund(api, john, function (data) {
2539
- const reverseDto = {
2540
- "ExternalData" : {
2541
- "ExternalProcessingDate" : 1727788165,
2542
- "ExternalProviderReference" : Math.random().toString(),
2543
- "ExternalMerchantReference" : "Order-xyz-35e8490e-2ec9-4c82-978e-c712a3f5ba16",
2544
- "ExternalProviderName" : "Stripe",
2545
- "ExternalProviderPaymentMethod" : "PAYPAL"
2546
- }
2547
- };
2548
- api.PayIns.reversePayInIntentRefund(data.Id, data.Refund.Id, reverseDto, function(data) {
2549
- reversedIntentRefund = data;
2550
- done();
2551
- });
2552
- });
2553
- });
2554
-
2555
- it('should reverse the PayInIntent Full Refund', function () {
2556
- expect(reversedIntentRefund.Id).not.to.be.undefined;
2557
- expect(reversedIntentRefund.Status).to.equal('REFUND_REVERSED');
2558
- });
2559
- });
2560
-
2561
- describe('Partially reverse intent refund', function () {
2562
- var reversedIntentRefund;
2563
-
2564
- before(function (done) {
2565
- helpers.getNewPayInIntentFullRefund(api, john, function (data) {
2566
- const reverseDto = {
2567
- "Amount": 1000,
2568
- "LineItems": [
2569
- {
2570
- "Id": data.LineItems[0].Id,
2571
- "Amount": data.LineItems[0].TotalLineItemAmount
2572
- }
2573
- ],
2574
- "ExternalData" : {
2575
- "ExternalProcessingDate" : 1727788165,
2576
- "ExternalProviderReference" : Math.random().toString(),
2577
- "ExternalMerchantReference" : "Order-xyz-35e8490e-2ec9-4c82-978e-c712a3f5ba16",
2578
- "ExternalProviderName" : "Stripe",
2579
- "ExternalProviderPaymentMethod" : "PAYPAL"
2580
- }
2581
- };
2582
- api.PayIns.reversePayInIntentRefund(data.Id, data.Refund.Id, reverseDto, function(data) {
2583
- reversedIntentRefund = data;
2584
- done();
2585
- });
2586
- });
2587
- });
2588
-
2589
- it('should reverse the PayInIntent Full Refund', function () {
2590
- expect(reversedIntentRefund.Id).not.to.be.undefined;
2591
- expect(reversedIntentRefund.Status).to.equal('REFUND_REVERSED');
2592
- });
2593
- });
2594
-
2595
- describe('Create full intent dispute', function () {
2596
- var dispute;
2597
-
2598
- before(function (done) {
2599
- helpers.getNewPayInIntentFullCapture(api, john, function (data) {
2600
- const disputeDto = {
2601
- "ExternalData" : {
2602
- "ExternalProcessingDate" : 1727788165,
2603
- "ExternalProviderReference" : Math.random().toString(),
2604
- "ExternalMerchantReference" : "Order-xyz-35e8490e-2ec9-4c82-978e-c712a3f5ba16",
2605
- "ExternalProviderName" : "Stripe",
2606
- "ExternalProviderPaymentMethod" : "PAYPAL"
2607
- }
2608
- };
2609
- api.PayIns.createPayInIntentDispute(data.Id, data.Capture.Id, disputeDto, function(data) {
2610
- dispute = data;
2611
- done();
2612
- });
2613
- });
2614
- });
2615
-
2616
- it('should reverse the PayInIntent Full Refund', function () {
2617
- expect(dispute.Id).not.to.be.undefined;
2618
- expect(dispute.Status).to.equal('DISPUTED');
2619
- });
2620
- });
2621
-
2622
- describe('Update intent dispute outcome', function () {
2623
- var intent;
2624
- var dispute;
2625
- var outcome;
2626
-
2627
- before(function (done) {
2628
- helpers.getNewPayInIntentFullCapture(api, john, function (data) {
2629
- intent = data;
2630
- const disputeDto = {
2631
- "ExternalData" : {
2632
- "ExternalProcessingDate" : 1727788165,
2633
- "ExternalProviderReference" : Math.random().toString(),
2634
- "ExternalMerchantReference" : "Order-xyz-35e8490e-2ec9-4c82-978e-c712a3f5ba16",
2635
- "ExternalProviderName" : "Stripe",
2636
- "ExternalProviderPaymentMethod" : "PAYPAL"
2637
- }
2638
- };
2639
- api.PayIns.createPayInIntentDispute(intent.Id, intent.Capture.Id, disputeDto, function(data) {
2640
- dispute = data;
2641
- const dto = {
2642
- Decision: 'DEFENDED'
2643
- };
2644
- api.PayIns.updatePayInIntentDisputeOutcome(intent.Id, intent.Capture.Id, dispute.Dispute.Id, dto, function (data) {
2645
- outcome = data;
2646
- done();
2647
- });
2648
- });
2649
- });
2650
- });
2651
-
2652
- it('should update the dispute outcome', function () {
2653
- expect(outcome.Id).not.to.be.undefined;
2654
- expect(outcome.Decision).to.equal('DEFENDED');
2655
- });
2656
- });
2657
-
2658
- describe('Create partial intent dispute', function () {
2659
- var dispute;
2660
-
2661
- before(function (done) {
2662
- helpers.getNewPayInIntentFullCapture(api, john, function (data) {
2663
- const disputeDto = {
2664
- "Amount": 1000,
2665
- "LineItems": [
2666
- {
2667
- "Id": data.LineItems[0].Id,
2668
- "Amount": data.LineItems[0].TotalLineItemAmount
2669
- }
2670
- ],
2671
- "ExternalData" : {
2672
- "ExternalProcessingDate" : 1727788165,
2673
- "ExternalProviderReference" : Math.random().toString(),
2674
- "ExternalMerchantReference" : "Order-xyz-35e8490e-2ec9-4c82-978e-c712a3f5ba16",
2675
- "ExternalProviderName" : "Stripe",
2676
- "ExternalProviderPaymentMethod" : "PAYPAL"
2677
- }
2678
- };
2679
- api.PayIns.createPayInIntentDispute(data.Id, data.Capture.Id, disputeDto, function(data) {
2680
- dispute = data;
2681
- done();
2682
- });
2683
- });
2684
- });
2685
-
2686
- it('should reverse the PayInIntent Full Refund', function () {
2687
- expect(dispute.Id).not.to.be.undefined;
2688
- expect(dispute.Status).to.equal('DISPUTED');
2689
- });
2690
- });
2691
- });
2692
-
2693
- describe('PayPal Data Collection', function () {
2694
- var dataCollection;
2695
-
2696
- before(function (done) {
2697
- const toCreate = {
2698
- "sender_account_id" : "A12345N343",
2699
- "sender_first_name" : "Jane",
2700
- "sender_last_name" : "Doe",
2701
- "sender_email" : "jane.doe@sample.com",
2702
- "sender_phone" : "(042) 1123 4567",
2703
- "sender_address_zip" : "75009",
2704
- "sender_country_code" : "FR",
2705
- "sender_create_date" : "2012-12-09T19:14:55.277-0:00",
2706
- "sender_signup_ip" : "10.220.90.20",
2707
- "sender_popularity_score" : "high",
2708
- "receiver_account_id" : "A12345N344",
2709
- "receiver_create_date" : "2012-12-09T19:14:55.277-0:00",
2710
- "receiver_email" : "jane@sample.com",
2711
- "receiver_address_country_code" : "FR",
2712
- "business_name" : "Jane Ltd",
2713
- "recipient_popularity_score" : "high",
2714
- "first_interaction_date" : "2012-12-09T19:14:55.277-0:00",
2715
- "txn_count_total" : "34",
2716
- "vertical" : "Household goods",
2717
- "transaction_is_tangible" : "0"
2718
- };
2719
- api.PayIns.createPayPalDataCollection(toCreate, function(data) {
2720
- dataCollection = data;
2721
- done();
2722
- });
2723
- });
2724
-
2725
- describe('Create', function () {
2726
- it('should create the data collection', function () {
2727
- expect(dataCollection).not.to.be.undefined;
2728
- expect(dataCollection.dataCollectionId).not.to.be.undefined;
2729
- });
2730
- });
2731
-
2732
- describe('Get', function () {
2733
- var getDataCollection;
2734
- before(function (done) {
2735
- api.PayIns.getPayPalDataCollection(dataCollection.dataCollectionId, function (data, response) {
2736
- getDataCollection = data;
2737
- done();
2738
- });
2739
- });
2740
-
2741
- it('should get the data collection', function () {
2742
- expect(getDataCollection.dataCollectionId).to.equal(dataCollection.dataCollectionId);
2743
- expect(getDataCollection.sender_first_name).to.equal("Jane");
2744
- expect(getDataCollection.sender_last_name).to.equal("Doe");
2745
- });
2746
- });
2747
- });
2748
- });