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
package/test/main.js DELETED
@@ -1,10 +0,0 @@
1
- var Promise = require('promise');
2
- var expect = require('chai').expect;
3
- var mangopay = require('../index');
4
-
5
- var api = global.api = new mangopay({
6
- clientId: 'sdk-unit-tests',
7
- clientApiKey: 'cqFfFrWfCcb7UadHNxx2C9Lo6Djw8ZduLi7J9USTmu8bhxxpju'
8
- });
9
-
10
- module.exports = api;
package/test/mocha.opts DELETED
@@ -1,3 +0,0 @@
1
- --recursive
2
- --timeout 15000
3
- --ui bdd
@@ -1,338 +0,0 @@
1
- const expect = require('chai').expect;
2
-
3
- const mangopay = require('../../index');
4
-
5
- // const api = global.api = new mangopay({
6
- // clientId: 'placeholder',
7
- // clientApiKey: 'placeholder'
8
- // });
9
-
10
- const cardId = 'placeholder';
11
-
12
- describe.skip('Acquiring', function () {
13
- describe('PayIn Card Direct', function () {
14
- let payIn;
15
-
16
- before(function (done) {
17
- const dto = {
18
- DebitedFunds: {
19
- Amount: 100,
20
- Currency: 'EUR'
21
- },
22
- IpAddress: '2001:0620:0000:0000:0211:24FF:FE80:C12C',
23
- BrowserInfo: {
24
- AcceptHeader: "text/html, application/xhtml+xml, application/xml;q=0.9, /;q=0.8",
25
- JavaEnabled: true,
26
- Language: "FR-FR",
27
- ColorDepth: 4,
28
- ScreenHeight: 1800,
29
- ScreenWidth: 400,
30
- JavascriptEnabled: true,
31
- TimeZoneOffset: "+60",
32
- UserAgent: "Mozilla/5.0 (iPhone; CPU iPhone OS 13_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148"
33
- },
34
- CardId: cardId,
35
- SecureMode: 'DEFAULT',
36
- SecureModeReturnURL: 'http://test.com',
37
- PaymentType: 'CARD',
38
- ExecutionType: 'DIRECT'
39
- };
40
-
41
- api.Acquiring.createPayIn(dto, function (response) {
42
- payIn = response;
43
- done();
44
- });
45
- });
46
-
47
- it('should create the PayIn', function () {
48
- expect(payIn).not.to.be.undefined;
49
- expect(payIn.PaymentType).to.equal('CARD');
50
- expect(payIn.ExecutionType).to.equal('DIRECT');
51
- expect(payIn.Status).to.equal('SUCCEEDED');
52
- });
53
- });
54
-
55
- describe('PayIn Ideal Web', function () {
56
- let payIn;
57
-
58
- before(function (done) {
59
- const dto = {
60
- DebitedFunds: {
61
- Amount: 100,
62
- Currency: 'EUR'
63
- },
64
- ReturnURL: 'http://test.com',
65
- PaymentType: 'IDEAL',
66
- ExecutionType: 'WEB'
67
- };
68
-
69
- api.Acquiring.createPayIn(dto, function (response) {
70
- payIn = response;
71
- done();
72
- });
73
- });
74
-
75
- it('should create the PayIn', function () {
76
- expect(payIn).not.to.be.undefined;
77
- expect(payIn.PaymentType).to.equal('IDEAL');
78
- expect(payIn.ExecutionType).to.equal('WEB');
79
- expect(payIn.Status).to.equal('CREATED');
80
- });
81
- });
82
-
83
- describe('PayIn ApplePay Direct', function () {
84
- let payIn;
85
-
86
- before(function (done) {
87
- const dto = {
88
- DebitedFunds: {
89
- Amount: 100,
90
- Currency: 'EUR'
91
- },
92
- PaymentData: {},
93
- PaymentType: 'APPLEPAY',
94
- ExecutionType: 'DIRECT'
95
- };
96
-
97
- api.Acquiring.createPayIn(dto, function (response) {
98
- payIn = response;
99
- done();
100
- });
101
- });
102
-
103
- it('should create the PayIn', function () {
104
- expect(payIn).not.to.be.undefined;
105
- expect(payIn.PaymentType).to.equal('APPLEPAY');
106
- expect(payIn.ExecutionType).to.equal('DIRECT');
107
- expect(payIn.Status).to.equal('CREATED');
108
- });
109
- });
110
-
111
- describe('PayIn GooglePay Direct', function () {
112
- let payIn;
113
-
114
- before(function (done) {
115
- const dto = {
116
- DebitedFunds: {
117
- Amount: 100,
118
- Currency: 'EUR'
119
- },
120
- IpAddress: '2001:0620:0000:0000:0211:24FF:FE80:C12C',
121
- BrowserInfo: {
122
- AcceptHeader: "text/html, application/xhtml+xml, application/xml;q=0.9, /;q=0.8",
123
- JavaEnabled: true,
124
- Language: "FR-FR",
125
- ColorDepth: 4,
126
- ScreenHeight: 1800,
127
- ScreenWidth: 400,
128
- JavascriptEnabled: true,
129
- TimeZoneOffset: "+60",
130
- UserAgent: "Mozilla/5.0 (iPhone; CPU iPhone OS 13_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148"
131
- },
132
- SecureModeReturnURL: 'http://test.com',
133
- PaymentData: "",
134
- PaymentType: 'GOOGLE_PAY',
135
- ExecutionType: 'DIRECT'
136
- };
137
-
138
- api.Acquiring.createPayIn(dto, function (response) {
139
- payIn = response;
140
- done();
141
- });
142
- });
143
-
144
- it('should create the PayIn', function () {
145
- expect(payIn).not.to.be.undefined;
146
- expect(payIn.PaymentType).to.equal('GOOGLE_PAY');
147
- expect(payIn.ExecutionType).to.equal('DIRECT');
148
- expect(payIn.Status).to.equal('CREATED');
149
- });
150
- });
151
-
152
- describe('PayIn PayPal Web', function () {
153
- let payIn;
154
-
155
- before(function (done) {
156
- const dto = {
157
- DebitedFunds: {
158
- Amount: 100,
159
- Currency: 'EUR'
160
- },
161
- LineItems: [
162
- {
163
- Name: "running shoes",
164
- Quantity: 1,
165
- UnitAmount: 100,
166
- TaxAmount: 0,
167
- Description: "seller1 ID"
168
- }
169
- ],
170
- ReturnURL: 'https://mangopay.com',
171
- PaymentType: 'PAYPAL',
172
- ExecutionType: 'WEB'
173
- };
174
-
175
- api.Acquiring.createPayIn(dto, function (response) {
176
- payIn = response;
177
- done();
178
- });
179
- });
180
-
181
- it('should create the PayIn', function () {
182
- expect(payIn).not.to.be.undefined;
183
- expect(payIn.PaymentType).to.equal('PAYPAL');
184
- expect(payIn.ExecutionType).to.equal('WEB');
185
- expect(payIn.Status).to.equal('CREATED');
186
- });
187
- });
188
-
189
- describe('PayPal DataCollection', function () {
190
- let dataCollection;
191
-
192
- before(function (done) {
193
- const dto = {
194
- "sender_account_id" : "A12345N343",
195
- "sender_first_name" : "Jane",
196
- "sender_last_name" : "Doe",
197
- "sender_email" : "jane.doe@sample.com",
198
- "sender_phone" : "(042) 1123 4567",
199
- "sender_address_zip" : "75009",
200
- "sender_country_code" : "FR",
201
- "sender_create_date" : "2012-12-09T19:14:55.277-0:00",
202
- "sender_signup_ip" : "10.220.90.20",
203
- "sender_popularity_score" : "high",
204
- "receiver_account_id" : "A12345N344",
205
- "receiver_create_date" : "2012-12-09T19:14:55.277-0:00",
206
- "receiver_email" : "jane@sample.com",
207
- "receiver_address_country_code" : "FR",
208
- "business_name" : "Jane Ltd",
209
- "recipient_popularity_score" : "high",
210
- "first_interaction_date" : "2012-12-09T19:14:55.277-0:00",
211
- "txn_count_total" : "34",
212
- "vertical" : "Household goods",
213
- "transaction_is_tangible" : "0"
214
- };
215
-
216
- api.Acquiring.createPayPalDataCollection(dto, function (response) {
217
- dataCollection = response;
218
- done();
219
- });
220
- });
221
-
222
- it('should create the PayIn', function () {
223
- expect(dataCollection).not.to.be.undefined;
224
- expect(dataCollection.dataCollectionId).not.to.be.undefined;
225
- });
226
- });
227
-
228
- describe('PayIn Refund', function () {
229
- let refund;
230
-
231
- before(function (done) {
232
- const payInDto = {
233
- DebitedFunds: {
234
- Amount: 100,
235
- Currency: 'EUR'
236
- },
237
- IpAddress: '2001:0620:0000:0000:0211:24FF:FE80:C12C',
238
- BrowserInfo: {
239
- AcceptHeader: "text/html, application/xhtml+xml, application/xml;q=0.9, /;q=0.8",
240
- JavaEnabled: true,
241
- Language: "FR-FR",
242
- ColorDepth: 4,
243
- ScreenHeight: 1800,
244
- ScreenWidth: 400,
245
- JavascriptEnabled: true,
246
- TimeZoneOffset: "+60",
247
- UserAgent: "Mozilla/5.0 (iPhone; CPU iPhone OS 13_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148"
248
- },
249
- CardId: cardId,
250
- SecureMode: 'DEFAULT',
251
- SecureModeReturnURL: 'http://test.com',
252
- PaymentType: 'CARD',
253
- ExecutionType: 'DIRECT'
254
- };
255
-
256
- api.Acquiring.createPayIn(payInDto, function (createdPayIn) {
257
- const refundDto = {
258
- DebitedFunds: {
259
- Amount: 100,
260
- Currency: 'EUR'
261
- }
262
- };
263
- api.Acquiring.createPayInRefund(createdPayIn.Id, refundDto, function (response) {
264
- refund = response;
265
- done();
266
- });
267
- });
268
- });
269
-
270
- it('should create the PayIn', function () {
271
- expect(refund).not.to.be.undefined;
272
- expect(refund.Type).to.equal('PAYOUT');
273
- expect(refund.Nature).to.equal('REFUND');
274
- expect(refund.Status).to.equal('SUCCEEDED');
275
- });
276
- });
277
-
278
- describe('Card Validation', function () {
279
- let cardValidation;
280
-
281
- before(function (done) {
282
- const dto = {
283
- SecureModeReturnURL: "http://example.com",
284
- IpAddress: "2001:0620:0000:0000:0211:24FF:FE80:C12C",
285
- BrowserInfo: {
286
- AcceptHeader: "text/html, application/xhtml+xml, application/xml;q=0.9, /;q=0.8",
287
- ColorDepth: 4,
288
- JavaEnabled: true,
289
- JavascriptEnabled: true,
290
- Language: 'FR-FR',
291
- ScreenHeight: 1800,
292
- ScreenWidth: 400,
293
- TimeZoneOffset: "+60",
294
- UserAgent: "Mozilla/5.0 (iPhone; CPU iPhone OS 13_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148"
295
- }
296
- };
297
-
298
- api.Acquiring.createCardValidation(cardId, dto, function (response) {
299
- cardValidation = response;
300
- done();
301
- });
302
- });
303
-
304
- it('should create the PayIn', function () {
305
- expect(cardValidation).to.not.be.undefined;
306
- expect(cardValidation.Id).to.not.be.undefined;
307
- expect(cardValidation.Type).to.equal("CARD_VALIDATION");
308
- });
309
- });
310
-
311
- describe('Settlement Report', function () {
312
- let report;
313
-
314
- before(function (done) {
315
- const dto = {
316
- DownloadFormat: "CSV",
317
- ReportType: "ACQUIRING_SETTLEMENT",
318
- AfterDate: 1740787200,
319
- BeforeDate: 1743544740,
320
- Filters: {
321
- SettlementId: "placeholder"
322
- }
323
- };
324
-
325
- api.ReportsV2.create(dto, function (response) {
326
- report = response;
327
- done();
328
- });
329
- });
330
-
331
- it('should create the PayIn', function () {
332
- expect(report.Id).to.exist;
333
- expect(report.ReportType).to.equal("ACQUIRING_SETTLEMENT");
334
- expect(report.DownloadFormat).to.equal("CSV");
335
- expect(report.Status).to.equal("PENDING");
336
- });
337
- });
338
- });
@@ -1,46 +0,0 @@
1
- var expect = require('chai').expect;
2
- var helpers = require('../helpers');
3
- var UserNatural = require('../../lib/models/UserNatural');
4
- var BankAccount = require('../../lib/models/BankAccount');
5
- var BankAccountDetailsIBAN = require('../../lib/models/BankAccountDetailsIBAN');
6
- var api = require('../main');
7
-
8
- describe('Bank Accounts', function () {
9
- var john = new UserNatural(helpers.data.getUserNatural());
10
- var bankAccount;
11
-
12
- before(function (done) {
13
- api.Users.create(john).then(function (data, response) {
14
- john = data;
15
-
16
- var account = new BankAccount({
17
- OwnerName: john.FirstName + ' ' + john.LastName,
18
- OwnerAddress: john.Address,
19
- Details: new BankAccountDetailsIBAN({
20
- IBAN: 'FR7630004000031234567890143',
21
- BIC: 'BNPAFRPP'
22
- })
23
- });
24
- api.Users.createBankAccount(john.Id, account).then(function (account) {
25
- bankAccount = account;
26
- done();
27
- });
28
- })
29
- });
30
-
31
- describe('Get Transactions for an Account', function () {
32
- var getTransactions;
33
-
34
- before(function (done) {
35
- api.BankAccounts.getTransactions(bankAccount.Id, function (data, response) {
36
- getTransactions = data;
37
- done();
38
- });
39
- });
40
-
41
- it('should be retrieved', function () {
42
- expect(getTransactions).not.to.be.undefined;
43
- expect(getTransactions).to.be.an('array');
44
- });
45
- });
46
- });
@@ -1,89 +0,0 @@
1
- var expect = require('chai').expect;
2
- var helpers = require('../helpers');
3
- var api = require('../main');
4
-
5
- describe('Banking Aliases', function() {
6
- var john = helpers.data.getUserNatural();
7
- var bankingAlias;
8
-
9
- before(function(done) {
10
- api.Users.create(john).then(function(){
11
- wallet = {
12
- Owners: [john.Id],
13
- Currency: 'EUR',
14
- Description: 'WALLET IN EUR'
15
- };
16
- api.Wallets.create(wallet).then(function(){
17
- bankingAlias = new api.models.BankingAliasIBAN({
18
- CreditedUserId: john.Id,
19
- WalletId: wallet.Id,
20
- OwnerName: john.FirstName,
21
- Country: 'LU'
22
- });
23
- api.BankingAliases.create(bankingAlias).then(function(data){
24
- bankingAlias = data;
25
- done();
26
- });
27
- });
28
- });
29
- });
30
-
31
- it('should exist after creating it', function () {
32
- expect(bankingAlias.Id).to.exist;
33
- expect(bankingAlias.VirtualAccountPurpose).to.exist;
34
- });
35
-
36
- describe('Getting created banking alias', function () {
37
- var getBankingAlias;
38
-
39
- before(function(done){
40
- api.BankingAliases.get(bankingAlias.Id).then(function(data){
41
- getBankingAlias = data;
42
- done();
43
- });
44
- });
45
-
46
- it('should be correctly fetched', function () {
47
- expect(bankingAlias.Id).to.equal(getBankingAlias.Id);
48
- expect(bankingAlias.WalletId).to.equal(getBankingAlias.WalletId);
49
- expect(bankingAlias.OwnerName).to.equal(getBankingAlias.OwnerName);
50
- expect(bankingAlias.CreditedUserId).to.equal(getBankingAlias.CreditedUserId);
51
- expect(bankingAlias.CreationDate).to.equal(getBankingAlias.CreationDate);
52
- });
53
- });
54
-
55
- describe('Getting created banking aliases', function () {
56
- var getBankingAlias;
57
-
58
- before(function(done){
59
- api.BankingAliases.getAll(bankingAlias.WalletId).then(function(data){
60
- getBankingAlias = data;
61
- done();
62
- });
63
- });
64
-
65
- it('should be ok', function () {
66
- expect(getBankingAlias).to.not.be.null;
67
- expect(getBankingAlias.length).to.equal(1);
68
- });
69
- });
70
-
71
- describe('Deactivate the Bank Alias', function () {
72
- var deactivatedBankingAlias;
73
-
74
- before(function(done){
75
- api.BankingAliases.deactivate(bankingAlias.Id).then(function(data){
76
- api.BankingAliases.get(bankingAlias.Id).then(function(data){
77
- deactivatedBankingAlias = data;
78
- done();
79
- });
80
- });
81
-
82
- });
83
-
84
- it('should have the right activated flag', function () {
85
- expect(deactivatedBankingAlias.Id).to.equal(bankingAlias.Id);
86
- expect(deactivatedBankingAlias.Active).to.equal(false);
87
- });
88
- });
89
- });
@@ -1,70 +0,0 @@
1
- var expect = require('chai').expect;
2
- var api = require('../main');
3
- var helpers = require('../helpers');
4
-
5
- describe('Card PreAuthorizations', function() {
6
- var john = helpers.data.getUserNatural();
7
- var preAuthorization;
8
-
9
- before(function(done){
10
- api.Users.create(john, function(){
11
- done();
12
- });
13
- });
14
-
15
- describe('Create', function() {
16
- before(function(done){
17
- helpers.getUserCardPreAuthorization(api, john, function(data, response){
18
- preAuthorization = data;
19
- done();
20
- });
21
- });
22
-
23
- it('should be created', function(){
24
- expect(preAuthorization.Id).to.exist;
25
- expect(preAuthorization.Status).to.equal('SUCCEEDED');
26
- expect(preAuthorization.PaymentStatus).to.equal('WAITING');
27
- expect(preAuthorization.ExecutionType).to.equal('DIRECT');
28
- expect(preAuthorization.PayInId).to.be.null;
29
- expect(preAuthorization.RemainingFunds).to.exist;
30
- expect(preAuthorization.CardInfo).to.not.be.null;
31
- });
32
- });
33
-
34
- describe('Get', function() {
35
- var getPreAuthorization;
36
-
37
- before(function(done){
38
- api.CardPreAuthorizations.get(preAuthorization.Id, function(data, response){
39
- getPreAuthorization = data;
40
- done();
41
- });
42
- });
43
-
44
- it('should be fetched', function(){
45
- expect(getPreAuthorization.Id).to.equal(preAuthorization.Id);
46
- expect(getPreAuthorization.ResultCode).to.equal('000000');
47
- expect(getPreAuthorization.RemainingFunds).to.exist;
48
- });
49
- });
50
-
51
- describe('Update', function() {
52
- var updatedPreAuthorization;
53
-
54
- before(function(done){
55
- preAuthorization.PaymentStatus = 'CANCELED';
56
-
57
- api.CardPreAuthorizations.update(preAuthorization, function(data, response){
58
- updatedPreAuthorization = data;
59
- done();
60
- });
61
- });
62
-
63
- it('should be updated', function(){
64
- expect(updatedPreAuthorization.Status).to.equal('SUCCEEDED');
65
- expect(updatedPreAuthorization.PaymentStatus).to.equal('CANCELED');
66
- expect(updatedPreAuthorization.SecurityInfo.AVSResult).to.equal('NO_CHECK');
67
- expect(updatedPreAuthorization.RemainingFunds).to.exist;
68
- });
69
- });
70
- });