mangopay4-nodejs-sdk 1.67.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +39 -0
- package/README.md +0 -6
- package/docs/templates/class.mustache +0 -0
- package/docs/templates/file.mustache +0 -0
- package/docs/templates/function.mustache +0 -0
- package/docs/templates/index.mustache +0 -0
- package/docs/templates/overview.mustache +0 -0
- package/lib/apiMethods.js +10 -3
- package/lib/models/CardPreAuthorization.js +2 -2
- package/lib/models/PayInPaymentType.js +0 -1
- package/lib/models/ReportFilterV2.js +2 -1
- package/lib/services/Acquiring.js +152 -0
- package/lib/services/PayIns.js +0 -18
- package/lib/services/index.js +2 -1
- package/package.json +16 -24
- package/typings/enums.d.ts +0 -1
- package/typings/index.d.ts +5 -5
- package/typings/index.test-d.ts +0 -15
- package/typings/models/acquiring.d.ts +763 -0
- package/typings/models/payIn.d.ts +20 -80
- package/typings/models/refund.d.ts +1 -0
- package/typings/models/reportV2.d.ts +2 -0
- package/typings/services/Acquiring.d.ts +44 -0
- package/typings/services/PayIns.d.ts +0 -8
- package/typings/types.d.ts +0 -2
- package/.github/workflows/node.js.yml +0 -32
- package/.github/workflows/npm-publish.yml +0 -26
- package/.jshintrc +0 -16
- package/lib/models/PayInPaymentDetailsPayconiq.js +0 -23
- package/test/TestKycPageFile.png +0 -0
- package/test/helpers.js +0 -1536
- package/test/main.js +0 -10
- package/test/mocha.opts +0 -3
- package/test/services/BankAccounts.js +0 -46
- package/test/services/BankingAliases.js +0 -89
- package/test/services/CardPreAuthorizations.js +0 -70
- package/test/services/CardRegistrations.js +0 -239
- package/test/services/Cards.js +0 -56
- package/test/services/Clients.js +0 -235
- package/test/services/Conversions.js +0 -319
- package/test/services/Deposits.js +0 -148
- package/test/services/Disputes.js +0 -542
- package/test/services/EMoney.js +0 -54
- package/test/services/Events.js +0 -147
- package/test/services/Hooks.js +0 -109
- package/test/services/Idempotency.js +0 -41
- package/test/services/IdentityVerifications.js +0 -68
- package/test/services/KycDocuments.js +0 -73
- package/test/services/Mandates.js +0 -256
- package/test/services/PayIns.js +0 -2748
- package/test/services/PayOuts.js +0 -119
- package/test/services/RateLimit.js +0 -43
- package/test/services/Recipients.js +0 -234
- package/test/services/Refunds.js +0 -123
- package/test/services/Regulatory.js +0 -45
- package/test/services/Reports.js +0 -114
- package/test/services/ReportsV2.js +0 -306
- package/test/services/Repudiations.js +0 -22
- package/test/services/Settlements.js +0 -127
- package/test/services/Tokens.js +0 -55
- package/test/services/Transfers.js +0 -137
- package/test/services/UboDeclarations.js +0 -130
- package/test/services/Users.js +0 -1322
- package/test/services/VirtualAccounts.js +0 -105
- package/test/services/Wallets.js +0 -132
- package/test/settlement_sample.csv +0 -8
- package/test/settlement_sample_bad.csv +0 -8
package/test/services/PayOuts.js
DELETED
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
var expect = require('chai').expect;
|
|
2
|
-
var api = require('../main');
|
|
3
|
-
var helpers = require('../helpers');
|
|
4
|
-
|
|
5
|
-
describe('PayOuts', function() {
|
|
6
|
-
var john = helpers.data.getUserNatural();
|
|
7
|
-
var payOut;
|
|
8
|
-
|
|
9
|
-
before(function(done){
|
|
10
|
-
api.Users.create(john, function(){
|
|
11
|
-
helpers.getNewPayoutBankWire(api, john, function(data, response){
|
|
12
|
-
payOut = data;
|
|
13
|
-
done();
|
|
14
|
-
});
|
|
15
|
-
});
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
describe('Create', function() {
|
|
19
|
-
it('should be created', function(){
|
|
20
|
-
expect(payOut.Id).to.exist;
|
|
21
|
-
expect(payOut.PaymentType).to.equal('BANK_WIRE');
|
|
22
|
-
expect(payOut.ChargeBearer).to.not.be.undefined;
|
|
23
|
-
});
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
describe('Create with RecipientId', function() {
|
|
27
|
-
var payOut;
|
|
28
|
-
before(function(done){
|
|
29
|
-
helpers.getNewPayoutBankWireWithRecipientId(api, john, function(data, response){
|
|
30
|
-
payOut = data;
|
|
31
|
-
done();
|
|
32
|
-
});
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
it('should be created', function(){
|
|
36
|
-
expect(payOut.Id).to.exist;
|
|
37
|
-
expect(payOut.RecipientId).to.exist;
|
|
38
|
-
expect(payOut.PaymentType).to.equal('BANK_WIRE');
|
|
39
|
-
});
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
describe('Get', function() {
|
|
43
|
-
var getPayOut;
|
|
44
|
-
|
|
45
|
-
before(function(done){
|
|
46
|
-
api.PayOuts.get(payOut.Id, function(data, response){
|
|
47
|
-
getPayOut = data;
|
|
48
|
-
done();
|
|
49
|
-
});
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
it('should be fetched', function(){
|
|
53
|
-
expect(payOut.Id).to.equal(getPayOut.Id);
|
|
54
|
-
expect(payOut.Status).to.equal('CREATED');
|
|
55
|
-
expect(payOut.ExecutionDate).to.be.null;
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
describe('Get Bankwire', function() {
|
|
59
|
-
var getBankwire;
|
|
60
|
-
|
|
61
|
-
before(function(done){
|
|
62
|
-
api.PayOuts.getBankwire(payOut.Id, function(data, response){
|
|
63
|
-
getBankwire = data;
|
|
64
|
-
done();
|
|
65
|
-
});
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
it('should be fetched', function(){
|
|
69
|
-
expect(payOut.Id).to.equal(getPayOut.Id);
|
|
70
|
-
expect(payOut.Status).to.equal('CREATED');
|
|
71
|
-
expect(payOut.ExecutionDate).to.be.null;
|
|
72
|
-
expect(payOut.ModeRequested).to.equal('STANDARD');
|
|
73
|
-
});
|
|
74
|
-
});
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
describe('Get Refunds', function() {
|
|
78
|
-
var getRefunds;
|
|
79
|
-
|
|
80
|
-
before(function(done) {
|
|
81
|
-
api.PayOuts.getRefunds(payOut.Id, function(data, response) {
|
|
82
|
-
getRefunds = data;
|
|
83
|
-
done();
|
|
84
|
-
});
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
it('should be retrieved', function() {
|
|
88
|
-
expect(getRefunds).not.to.be.undefined;
|
|
89
|
-
expect(getRefunds).to.be.an('array');
|
|
90
|
-
})
|
|
91
|
-
})
|
|
92
|
-
|
|
93
|
-
describe('Check Eligibility', function() {
|
|
94
|
-
var eligibility;
|
|
95
|
-
|
|
96
|
-
before(function(done) {
|
|
97
|
-
helpers.getNewPayoutBankWire(api, john, function(data, response){
|
|
98
|
-
var eligibilityDto = {
|
|
99
|
-
AuthorId: data.AuthorId,
|
|
100
|
-
DebitedFunds: data.DebitedFunds,
|
|
101
|
-
BankAccountId: data.BankAccountId,
|
|
102
|
-
DebitedWalletId: data.DebitedWalletId,
|
|
103
|
-
PayoutModeRequested: "INSTANT_PAYMENT"
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
api.PayOuts.checkEligibility(eligibilityDto, function(data, response) {
|
|
107
|
-
eligibility = data;
|
|
108
|
-
done();
|
|
109
|
-
});
|
|
110
|
-
});
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
it('should be retrieved', function() {
|
|
114
|
-
expect(eligibility.InstantPayout).not.to.be.undefined;
|
|
115
|
-
expect(eligibility.InstantPayout.IsReachable).not.to.be.undefined;
|
|
116
|
-
expect(eligibility.InstantPayout.UnreachableReason).not.to.be.undefined; //will be undefined if IsReachable true
|
|
117
|
-
})
|
|
118
|
-
})
|
|
119
|
-
});
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
var expect = require('chai').expect;
|
|
2
|
-
var helpers = require('../helpers');
|
|
3
|
-
var api = require('../main');
|
|
4
|
-
|
|
5
|
-
describe('Rate Limits', function () {
|
|
6
|
-
expect(api.rateLimits).to.be.empty;
|
|
7
|
-
var john = helpers.data.getUserNatural();
|
|
8
|
-
|
|
9
|
-
before(function (done) {
|
|
10
|
-
api.Users.create(john).then(function () {
|
|
11
|
-
done();
|
|
12
|
-
});
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
describe('Exist', function () {
|
|
16
|
-
it('should exist', function () {
|
|
17
|
-
expect(john.Id).to.exist;
|
|
18
|
-
|
|
19
|
-
expect(api.rateLimits).not.to.be.empty;
|
|
20
|
-
expect(api.rateLimits.length).to.equal(4);
|
|
21
|
-
|
|
22
|
-
expect(api.rateLimits[0].minutesInterval).to.equal(15);
|
|
23
|
-
expect(api.rateLimits[1].minutesInterval).to.equal(30);
|
|
24
|
-
expect(api.rateLimits[2].minutesInterval).to.equal(60);
|
|
25
|
-
expect(api.rateLimits[3].minutesInterval).to.equal(60 * 24);
|
|
26
|
-
|
|
27
|
-
expect(api.rateLimits[0].callsMade).to.be.greaterThan(0);
|
|
28
|
-
expect(api.rateLimits[1].callsMade).to.be.greaterThan(0);
|
|
29
|
-
expect(api.rateLimits[2].callsMade).to.be.greaterThan(0);
|
|
30
|
-
expect(api.rateLimits[3].callsMade).to.be.greaterThan(0);
|
|
31
|
-
|
|
32
|
-
expect(api.rateLimits[0].callsRemaining).to.be.greaterThan(0);
|
|
33
|
-
expect(api.rateLimits[1].callsRemaining).to.be.greaterThan(0);
|
|
34
|
-
expect(api.rateLimits[2].callsRemaining).to.be.greaterThan(0);
|
|
35
|
-
expect(api.rateLimits[3].callsRemaining).to.be.greaterThan(0);
|
|
36
|
-
|
|
37
|
-
expect(api.rateLimits[0].resetTimeMillis).to.be.greaterThan(0);
|
|
38
|
-
expect(api.rateLimits[1].resetTimeMillis).to.be.greaterThan(0);
|
|
39
|
-
expect(api.rateLimits[2].resetTimeMillis).to.be.greaterThan(0);
|
|
40
|
-
expect(api.rateLimits[3].resetTimeMillis).to.be.greaterThan(0);
|
|
41
|
-
});
|
|
42
|
-
});
|
|
43
|
-
});
|
|
@@ -1,234 +0,0 @@
|
|
|
1
|
-
var expect = require('chai').expect;
|
|
2
|
-
var helpers = require('../helpers');
|
|
3
|
-
var api = require('../main');
|
|
4
|
-
|
|
5
|
-
describe('Recipients', function() {
|
|
6
|
-
var john = helpers.data.getUserNaturalScaOwner();
|
|
7
|
-
var recipient;
|
|
8
|
-
|
|
9
|
-
before(function(done){
|
|
10
|
-
api.Users.create(john).then(function(data){
|
|
11
|
-
john = data;
|
|
12
|
-
const createRecipient = {
|
|
13
|
-
DisplayName: "My EUR account",
|
|
14
|
-
PayoutMethodType: "LocalBankTransfer",
|
|
15
|
-
RecipientType: "Individual",
|
|
16
|
-
Currency: "EUR",
|
|
17
|
-
Country: "DE",
|
|
18
|
-
IndividualRecipient: {
|
|
19
|
-
FirstName: "John",
|
|
20
|
-
LastName: "Doe",
|
|
21
|
-
Address: {
|
|
22
|
-
AddressLine1: "10 Kingsway",
|
|
23
|
-
City: "London",
|
|
24
|
-
PostalCode: "WC2B 6LH",
|
|
25
|
-
Country: "DE"
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
LocalBankTransfer: {
|
|
29
|
-
EUR: {
|
|
30
|
-
IBAN: "DE75512108001245126199"
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
ScaContext: "USER_PRESENT"
|
|
34
|
-
};
|
|
35
|
-
api.Recipients.create(createRecipient, john.Id).then(function(data){
|
|
36
|
-
recipient = data;
|
|
37
|
-
done();
|
|
38
|
-
});
|
|
39
|
-
});
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
describe('Create', function () {
|
|
43
|
-
it('should be correctly created', function () {
|
|
44
|
-
expect(recipient.Id).to.not.be.null;
|
|
45
|
-
expect(recipient.Status).to.not.be.null;
|
|
46
|
-
expect(recipient.DisplayName).to.not.be.null;
|
|
47
|
-
expect(recipient.PayoutMethodType).to.not.be.null;
|
|
48
|
-
expect(recipient.RecipientType).to.not.be.null;
|
|
49
|
-
expect(recipient.IndividualRecipient).to.not.be.null;
|
|
50
|
-
expect(recipient.LocalBankTransfer).to.not.be.null;
|
|
51
|
-
expect(recipient.PendingUserAction).to.not.be.null;
|
|
52
|
-
expect(recipient.RecipientVerificationOfPayee).to.not.be.null;
|
|
53
|
-
});
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
describe('GET', function () {
|
|
57
|
-
var fetched;
|
|
58
|
-
before(function(done){
|
|
59
|
-
api.Recipients.get(recipient.Id).then(function(data){
|
|
60
|
-
fetched = data;
|
|
61
|
-
done();
|
|
62
|
-
});
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
it('should be correctly fetched', function () {
|
|
66
|
-
expect(fetched.Id).to.not.be.null;
|
|
67
|
-
expect(fetched.Id).to.be.eq(recipient.Id);
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
describe('GET User Recipients', function () {
|
|
72
|
-
var recipientsList;
|
|
73
|
-
before(function(done){
|
|
74
|
-
api.Recipients.getUserRecipients(john.Id, function(data){
|
|
75
|
-
recipientsList = data;
|
|
76
|
-
done();
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
parameters: {
|
|
80
|
-
RecipientScope: "PAYOUT"
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
);
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
it('should be correctly fetched', function () {
|
|
87
|
-
expect(recipientsList).to.not.be.null;
|
|
88
|
-
expect(recipientsList.length).to.be.gt(0);
|
|
89
|
-
});
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
describe('GET User Recipients PAYIN', function () {
|
|
93
|
-
var recipientsList;
|
|
94
|
-
before(function(done){
|
|
95
|
-
api.Recipients.getUserRecipients(john.Id, function(data){
|
|
96
|
-
recipientsList = data;
|
|
97
|
-
done();
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
parameters: {
|
|
101
|
-
RecipientScope: "PAYIN"
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
);
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
it('should be correctly fetched', function () {
|
|
108
|
-
expect(recipientsList).to.not.be.null;
|
|
109
|
-
expect(recipientsList.length).to.be.eq(0);
|
|
110
|
-
});
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
describe('GET Schema LocalBankTransfer Individual', function () {
|
|
114
|
-
var schema;
|
|
115
|
-
before(function(done){
|
|
116
|
-
api.Recipients.getSchema("LocalBankTransfer", "Individual", "GBP", "GB").then(function(data){
|
|
117
|
-
schema = data;
|
|
118
|
-
done();
|
|
119
|
-
});
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
it('should be correctly fetched', function () {
|
|
123
|
-
expect(schema).to.not.be.null;
|
|
124
|
-
expect(schema.DisplayName).to.not.be.null;
|
|
125
|
-
expect(schema.Currency).to.not.be.null;
|
|
126
|
-
expect(schema.RecipientType).to.not.be.null;
|
|
127
|
-
expect(schema.PayoutMethodType).to.not.be.null;
|
|
128
|
-
expect(schema.RecipientScope).to.not.be.null;
|
|
129
|
-
expect(schema.Tag).to.not.be.null;
|
|
130
|
-
expect(schema.LocalBankTransfer).to.not.be.null;
|
|
131
|
-
expect(schema.IndividualRecipient).to.not.be.null;
|
|
132
|
-
expect(schema.InternationalBankTransfer).to.be.undefined;
|
|
133
|
-
expect(schema.BusinessRecipient).to.be.undefined;
|
|
134
|
-
|
|
135
|
-
});
|
|
136
|
-
});
|
|
137
|
-
|
|
138
|
-
describe('GET Schema InternationalBankTransfer Business', function () {
|
|
139
|
-
var schema;
|
|
140
|
-
before(function(done){
|
|
141
|
-
api.Recipients.getSchema("InternationalBankTransfer", "Business", "GBP", "GB").then(function(data){
|
|
142
|
-
schema = data;
|
|
143
|
-
done();
|
|
144
|
-
});
|
|
145
|
-
});
|
|
146
|
-
|
|
147
|
-
it('should be correctly fetched', function () {
|
|
148
|
-
expect(schema).to.not.be.null;
|
|
149
|
-
expect(schema.DisplayName).to.not.be.null;
|
|
150
|
-
expect(schema.Currency).to.not.be.null;
|
|
151
|
-
expect(schema.RecipientType).to.not.be.null;
|
|
152
|
-
expect(schema.PayoutMethodType).to.not.be.null;
|
|
153
|
-
expect(schema.RecipientScope).to.not.be.null;
|
|
154
|
-
expect(schema.Tag).to.not.be.null;
|
|
155
|
-
expect(schema.InternationalBankTransfer).to.not.be.null;
|
|
156
|
-
expect(schema.BusinessRecipient).to.not.be.null;
|
|
157
|
-
expect(schema.LocalBankTransfer).to.be.undefined;
|
|
158
|
-
expect(schema.IndividualRecipient).to.be.undefined;
|
|
159
|
-
});
|
|
160
|
-
});
|
|
161
|
-
|
|
162
|
-
describe('GET Payout Methods', function () {
|
|
163
|
-
var payoutMethods;
|
|
164
|
-
before(function(done){
|
|
165
|
-
api.Recipients.getPayoutMethods("DE", "GBP").then(function(data){
|
|
166
|
-
payoutMethods = data;
|
|
167
|
-
done();
|
|
168
|
-
});
|
|
169
|
-
});
|
|
170
|
-
|
|
171
|
-
it('should be correctly fetched', function () {
|
|
172
|
-
expect(payoutMethods).to.not.be.null;
|
|
173
|
-
expect(payoutMethods.AvailablePayoutMethods.length).to.be.gt(0);
|
|
174
|
-
});
|
|
175
|
-
});
|
|
176
|
-
|
|
177
|
-
describe('Validate recipient passes', function () {
|
|
178
|
-
before(function(done){
|
|
179
|
-
api.Recipients.validate(recipient, john.Id).then(function(){
|
|
180
|
-
done();
|
|
181
|
-
});
|
|
182
|
-
});
|
|
183
|
-
|
|
184
|
-
it('should work', function () {
|
|
185
|
-
// dummy check (if the request doesn't work, it will throw error and not get here)
|
|
186
|
-
expect(true).to.eq(true);
|
|
187
|
-
});
|
|
188
|
-
});
|
|
189
|
-
|
|
190
|
-
describe('Validate Recipient fails', function () {
|
|
191
|
-
var errorResult;
|
|
192
|
-
|
|
193
|
-
before(function (done) {
|
|
194
|
-
const currency = recipient.Currency;
|
|
195
|
-
recipient.Currency = undefined;
|
|
196
|
-
api.Recipients.validate(recipient, john.Id).then(function (data) {
|
|
197
|
-
done();
|
|
198
|
-
})
|
|
199
|
-
.catch(function (error) {
|
|
200
|
-
errorResult = error;
|
|
201
|
-
// put back the currency
|
|
202
|
-
recipient.Currency = currency;
|
|
203
|
-
done();
|
|
204
|
-
});
|
|
205
|
-
});
|
|
206
|
-
|
|
207
|
-
it('Should return error for missing param', function(){
|
|
208
|
-
expect(errorResult.Message).to.contain("One or several required parameters are missing or incorrect");
|
|
209
|
-
});
|
|
210
|
-
});
|
|
211
|
-
|
|
212
|
-
describe.skip('Deactivate', function () {
|
|
213
|
-
console.warn("A recipient needs to be manually activated before running the test");
|
|
214
|
-
var fetched;
|
|
215
|
-
var deactivated;
|
|
216
|
-
before(function(done){
|
|
217
|
-
api.Recipients.deactivate(recipient.Id).then(function(data){
|
|
218
|
-
deactivated = data;
|
|
219
|
-
api.Recipients.get(recipient.Id).then(function(data){
|
|
220
|
-
fetched = data;
|
|
221
|
-
done();
|
|
222
|
-
});
|
|
223
|
-
});
|
|
224
|
-
});
|
|
225
|
-
|
|
226
|
-
it('should be deactivated', function () {
|
|
227
|
-
expect(deactivated.Id).to.not.be.null;
|
|
228
|
-
expect(fetched.Id).to.not.be.null;
|
|
229
|
-
expect(recipient.Status).to.eq("PENDING");
|
|
230
|
-
expect(deactivated.Status).to.eq("DEACTIVATED");
|
|
231
|
-
expect(fetched.Status).to.eq("DEACTIVATED");
|
|
232
|
-
});
|
|
233
|
-
});
|
|
234
|
-
});
|
package/test/services/Refunds.js
DELETED
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
var expect = require('chai').expect;
|
|
2
|
-
var helpers = require('../helpers');
|
|
3
|
-
var api = require('../main');
|
|
4
|
-
|
|
5
|
-
describe('Refunds', function() {
|
|
6
|
-
var john = helpers.data.getUserNatural();
|
|
7
|
-
var wallet, secondWallet, transfer, cardRegistration, card;
|
|
8
|
-
|
|
9
|
-
before('Create a wallet with money, one without money, and a transfer', 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
|
-
secondWallet = {
|
|
17
|
-
Owners: [john.Id],
|
|
18
|
-
Currency: 'EUR',
|
|
19
|
-
Description: 'WALLET IN EUR'
|
|
20
|
-
};
|
|
21
|
-
cardRegistration = {
|
|
22
|
-
UserId: john.Id,
|
|
23
|
-
Currency: 'EUR'
|
|
24
|
-
};
|
|
25
|
-
api.Wallets.create(wallet).then(function(){
|
|
26
|
-
api.CardRegistrations.create(cardRegistration, function(){
|
|
27
|
-
helpers.getPaylineCorrectRegistartionData(cardRegistration, function(data, response){
|
|
28
|
-
cardRegistration.RegistrationData = data;
|
|
29
|
-
api.CardRegistrations.update(cardRegistration).then(function(data){
|
|
30
|
-
cardRegistration = data;
|
|
31
|
-
api.Cards.get(cardRegistration.CardId, function(data, response){
|
|
32
|
-
card = data;
|
|
33
|
-
api.PayIns.create({
|
|
34
|
-
CreditedWalletId: wallet.Id,
|
|
35
|
-
AuthorId: john.Id,
|
|
36
|
-
DebitedFunds: {
|
|
37
|
-
Amount: 100,
|
|
38
|
-
Currency: 'EUR'
|
|
39
|
-
},
|
|
40
|
-
Fees: {
|
|
41
|
-
Amount: 0,
|
|
42
|
-
Currency: 'EUR'
|
|
43
|
-
},
|
|
44
|
-
CardId: card.Id,
|
|
45
|
-
SecureMode: 'DEFAULT',
|
|
46
|
-
SecureModeReturnURL: 'https://test.com',
|
|
47
|
-
PaymentType: 'CARD',
|
|
48
|
-
ExecutionType: 'DIRECT',
|
|
49
|
-
BrowserInfo: {
|
|
50
|
-
AcceptHeader: "text/html, application/xhtml+xml, application/xml;q=0.9, /;q=0.8",
|
|
51
|
-
JavaEnabled: true,
|
|
52
|
-
Language: "FR-FR",
|
|
53
|
-
ColorDepth: 4,
|
|
54
|
-
ScreenHeight: 1800,
|
|
55
|
-
ScreenWidth: 400,
|
|
56
|
-
JavascriptEnabled: true,
|
|
57
|
-
TimeZoneOffset: "+60",
|
|
58
|
-
UserAgent: "Mozilla/5.0 (iPhone; CPU iPhone OS 13_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148"
|
|
59
|
-
},
|
|
60
|
-
IpAddress: "2001:0620:0000:0000:0211:24FF:FE80:C12C"
|
|
61
|
-
}, function(data, response){
|
|
62
|
-
api.Wallets.create(secondWallet).then(function(){
|
|
63
|
-
api.Transfers.create({
|
|
64
|
-
AuthorId: john.Id,
|
|
65
|
-
Tag: 'DefaultTag',
|
|
66
|
-
CreditedUserId: john.Id,
|
|
67
|
-
DebitedFunds: {
|
|
68
|
-
Currency: 'EUR',
|
|
69
|
-
Amount: 1
|
|
70
|
-
},
|
|
71
|
-
Fees: {
|
|
72
|
-
Currency: 'EUR',
|
|
73
|
-
Amount: 0
|
|
74
|
-
},
|
|
75
|
-
DebitedWalletId: wallet.Id,
|
|
76
|
-
CreditedWalletId: secondWallet.Id
|
|
77
|
-
}, function(data, response){
|
|
78
|
-
transfer = data;
|
|
79
|
-
api.Wallets.get(wallet.Id).then(function (data) {
|
|
80
|
-
wallet = data;
|
|
81
|
-
done();
|
|
82
|
-
});
|
|
83
|
-
});
|
|
84
|
-
});
|
|
85
|
-
});
|
|
86
|
-
});
|
|
87
|
-
});
|
|
88
|
-
});
|
|
89
|
-
});
|
|
90
|
-
});
|
|
91
|
-
});
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
describe('Get for transfer', function () {
|
|
95
|
-
var refund;
|
|
96
|
-
before(function(done){
|
|
97
|
-
refund = {
|
|
98
|
-
DebitedWalletId: transfer.DebitedWalletId,
|
|
99
|
-
CreditedWalletId: transfer.CreditedWalletId,
|
|
100
|
-
AuthorId: john.Id,
|
|
101
|
-
DebitedFunds: {
|
|
102
|
-
Amount: transfer.DebitedFunds.Amount,
|
|
103
|
-
Currency: transfer.DebitedFunds.Currency
|
|
104
|
-
},
|
|
105
|
-
Fees: {
|
|
106
|
-
Amount: transfer.Fees.Amount,
|
|
107
|
-
Currency: transfer.DebitedFunds.Currency
|
|
108
|
-
}
|
|
109
|
-
};
|
|
110
|
-
api.Transfers.createRefund(transfer.Id, refund, function(data, response){
|
|
111
|
-
refund = data;
|
|
112
|
-
done();
|
|
113
|
-
});
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
it('should be refunded', function () {
|
|
117
|
-
expect(refund.InitialTransactionId).to.equal(transfer.Id);
|
|
118
|
-
expect(refund.AuthorId).to.equal(john.Id);
|
|
119
|
-
expect(refund.Type).to.equal('TRANSFER');
|
|
120
|
-
expect(refund.Nature).to.equal('REFUND');
|
|
121
|
-
});
|
|
122
|
-
});
|
|
123
|
-
});
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
var expect = require('chai').expect;
|
|
2
|
-
var api = require('../main');
|
|
3
|
-
|
|
4
|
-
describe('Regulatory', function() {
|
|
5
|
-
|
|
6
|
-
describe('Get Authorizations For One Country', function () {
|
|
7
|
-
var countryAuthorization;
|
|
8
|
-
|
|
9
|
-
before(function(done){
|
|
10
|
-
api.Regulatory.getCountryAuthorizations("FR", function(data, response){
|
|
11
|
-
countryAuthorization = data;
|
|
12
|
-
done();
|
|
13
|
-
});
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
it('should be returned', function () {
|
|
17
|
-
expect(countryAuthorization).not.to.be.undefined;
|
|
18
|
-
expect(countryAuthorization.CountryCode).not.to.be.undefined;
|
|
19
|
-
expect(countryAuthorization.CountryName).not.to.be.undefined;
|
|
20
|
-
expect(countryAuthorization.Authorization).not.to.be.undefined;
|
|
21
|
-
expect(countryAuthorization.LastUpdate).not.to.be.undefined;
|
|
22
|
-
});
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
describe('Get Authorizations For All Countries', function () {
|
|
26
|
-
var countryAuthorizations;
|
|
27
|
-
|
|
28
|
-
before(function(done){
|
|
29
|
-
api.Regulatory.getAllCountriesAuthorizations(function(data, response){
|
|
30
|
-
countryAuthorizations = data;
|
|
31
|
-
done();
|
|
32
|
-
});
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
it('should be returned', function () {
|
|
36
|
-
expect(countryAuthorizations).not.to.be.undefined;
|
|
37
|
-
expect(countryAuthorizations).not.to.be.empty;
|
|
38
|
-
|
|
39
|
-
expect(countryAuthorizations[0].CountryCode).not.to.be.undefined;
|
|
40
|
-
expect(countryAuthorizations[0].CountryName).not.to.be.undefined;
|
|
41
|
-
expect(countryAuthorizations[0].Authorization).not.to.be.undefined;
|
|
42
|
-
expect(countryAuthorizations[0].LastUpdate).not.to.be.undefined;
|
|
43
|
-
});
|
|
44
|
-
});
|
|
45
|
-
});
|
package/test/services/Reports.js
DELETED
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
var expect = require('chai').expect;
|
|
2
|
-
var helpers = require('../helpers');
|
|
3
|
-
var api = require('../main');
|
|
4
|
-
|
|
5
|
-
describe('Reports - Transactions', function () {
|
|
6
|
-
var report;
|
|
7
|
-
|
|
8
|
-
before(function (done) {
|
|
9
|
-
report = {
|
|
10
|
-
ReportType: "TRANSACTIONS",
|
|
11
|
-
Tag: 'Created with Mangopay NodeJs SDK',
|
|
12
|
-
DownloadFormat: 'CSV',
|
|
13
|
-
CallbackURL: 'https://mangopay.com/docs/please-ignore',
|
|
14
|
-
Sort: 'CreationDate:ASC',
|
|
15
|
-
Preview: false,
|
|
16
|
-
Filters:
|
|
17
|
-
{
|
|
18
|
-
BeforeDate: 1756293864,
|
|
19
|
-
AfterDate: 1753615463,
|
|
20
|
-
Type: ['PAYIN'],
|
|
21
|
-
ResultCode: ['000000'],
|
|
22
|
-
Status: ['SUCCEEDED'],
|
|
23
|
-
Nature: ['REGULAR'],
|
|
24
|
-
WalletId: null,
|
|
25
|
-
AuthorId: null,
|
|
26
|
-
MinDebitedFundsAmount: 10,
|
|
27
|
-
MinDebitedFundsCurrency: 'EUR',
|
|
28
|
-
MaxDebitedFundsAmount: 12000,
|
|
29
|
-
MaxDebitedFundsCurrency: 'EUR',
|
|
30
|
-
MinFeesAmount: 10,
|
|
31
|
-
MinFeesCurrency: 'EUR',
|
|
32
|
-
MaxFeesAmount: 150000,
|
|
33
|
-
MaxFeesCurrency: 'EUR',
|
|
34
|
-
},
|
|
35
|
-
Columns: [
|
|
36
|
-
'Id',
|
|
37
|
-
'Tag',
|
|
38
|
-
'CreationDate',
|
|
39
|
-
'ExecutionDate',
|
|
40
|
-
'AuthorId',
|
|
41
|
-
'CreditedUserId',
|
|
42
|
-
'DebitedFundsAmount',
|
|
43
|
-
'DebitedFundsCurrency',
|
|
44
|
-
'CreditedFundsAmount',
|
|
45
|
-
'CreditedFundsCurrency',
|
|
46
|
-
'FeesAmount',
|
|
47
|
-
'FeesCurrency',
|
|
48
|
-
'Status',
|
|
49
|
-
'ResultCode',
|
|
50
|
-
'ResultMessage',
|
|
51
|
-
'Type',
|
|
52
|
-
'Nature',
|
|
53
|
-
'CreditedWalletId',
|
|
54
|
-
'DebitedWalletId',
|
|
55
|
-
]
|
|
56
|
-
};
|
|
57
|
-
api.Reports.create(report).then(function (data) {
|
|
58
|
-
done();
|
|
59
|
-
});
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
it('should exist after creating it', function () {
|
|
63
|
-
expect(report.Id).to.exist;
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
describe('Getting created report', function () {
|
|
67
|
-
var getReport;
|
|
68
|
-
|
|
69
|
-
before(function (done) {
|
|
70
|
-
api.Reports.get(report.Id).then(function (data) {
|
|
71
|
-
getReport = data;
|
|
72
|
-
done();
|
|
73
|
-
});
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
it('should be correctly fetched', function () {
|
|
77
|
-
expect(report.Id).to.equal(getReport.Id);
|
|
78
|
-
expect(report.CreationDate).to.equal(getReport.CreationDate);
|
|
79
|
-
});
|
|
80
|
-
});
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
describe('Reports - Wallets', function () {
|
|
84
|
-
var report;
|
|
85
|
-
|
|
86
|
-
before(function (done) {
|
|
87
|
-
report = {
|
|
88
|
-
ReportType: "WALLETS"
|
|
89
|
-
};
|
|
90
|
-
api.Reports.create(report).then(function () {
|
|
91
|
-
done();
|
|
92
|
-
});
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
it('should exist after creting it', function () {
|
|
96
|
-
expect(report.Id).to.exist;
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
describe('Getting created report', function () {
|
|
100
|
-
var getReport;
|
|
101
|
-
|
|
102
|
-
before(function (done) {
|
|
103
|
-
api.Reports.get(report.Id).then(function (data) {
|
|
104
|
-
getReport = data;
|
|
105
|
-
done();
|
|
106
|
-
});
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
it('should be correctly fetched', function () {
|
|
110
|
-
expect(report.Id).to.equal(getReport.Id);
|
|
111
|
-
expect(report.CreationDate).to.equal(getReport.CreationDate);
|
|
112
|
-
});
|
|
113
|
-
});
|
|
114
|
-
});
|