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
|
@@ -1,542 +0,0 @@
|
|
|
1
|
-
var _ = require('underscore');
|
|
2
|
-
var path = require('path');
|
|
3
|
-
var expect = require('chai').expect;
|
|
4
|
-
var api = require('../main');
|
|
5
|
-
|
|
6
|
-
describe('Disputes', function() {
|
|
7
|
-
var disputes;
|
|
8
|
-
|
|
9
|
-
before(function(done){
|
|
10
|
-
api.Disputes.getAll(function(data, response){
|
|
11
|
-
disputes = data;
|
|
12
|
-
done();
|
|
13
|
-
}, {
|
|
14
|
-
parameters: {
|
|
15
|
-
per_page: 100,
|
|
16
|
-
page: 2
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
it('should retrieve list', function(){
|
|
22
|
-
expect(disputes.length).to.be.above(0);
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
describe('Get', function() {
|
|
26
|
-
var dispute;
|
|
27
|
-
|
|
28
|
-
before(function(done){
|
|
29
|
-
api.Disputes.get(disputes[0].Id, function(data, response){
|
|
30
|
-
dispute = data;
|
|
31
|
-
done();
|
|
32
|
-
});
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
it('should be retrieved', function(){
|
|
36
|
-
expect(disputes).not.to.be.null;
|
|
37
|
-
expect(disputes[0].Id).to.equal(dispute.Id);
|
|
38
|
-
});
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
describe('Get Transactions', function() {
|
|
42
|
-
var dispute, transactions;
|
|
43
|
-
|
|
44
|
-
before(function(done){
|
|
45
|
-
dispute = _.findWhere(disputes, {DisputeType: 'NOT_CONTESTABLE'});
|
|
46
|
-
if (!dispute) {
|
|
47
|
-
console.warn('Cannot test getting transactions for dispute because there\'s no not costestable disputes in the disputes list.');
|
|
48
|
-
this.skip();
|
|
49
|
-
}
|
|
50
|
-
api.Disputes.getTransactions(dispute.Id, function(data, response){
|
|
51
|
-
transactions = data;
|
|
52
|
-
done();
|
|
53
|
-
});
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
it('should be retrieved', function(){
|
|
57
|
-
expect(transactions.length).to.be.above(0);
|
|
58
|
-
});
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
describe('Get Disputes for Wallet', function() {
|
|
62
|
-
var dispute, disputesForWallet, payIn;
|
|
63
|
-
|
|
64
|
-
before(function(done){
|
|
65
|
-
dispute = _.find(disputes, function(disputeItem) {
|
|
66
|
-
return disputeItem.InitialTransactionId;
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
if (!dispute) {
|
|
70
|
-
console.warn('Cannot test getting disputes for wallet because there\'s no disputes with transaction ID in the disputes list.');
|
|
71
|
-
this.skip();
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
payIn = api.PayIns.get(dispute.InitialTransactionId, function(data, response){
|
|
75
|
-
api.Disputes.getDisputesForWallet(data.CreditedWalletId, function(data, response){
|
|
76
|
-
disputesForWallet = data;
|
|
77
|
-
done();
|
|
78
|
-
});
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
it('should be retrieved', function(){
|
|
84
|
-
expect(disputesForWallet.length).to.be.above(0);
|
|
85
|
-
});
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
describe('Get Disputes for User', function() {
|
|
89
|
-
var dispute, disputesForUser;
|
|
90
|
-
|
|
91
|
-
before(function(done){
|
|
92
|
-
dispute = _.findWhere(disputes, {DisputeType: 'NOT_CONTESTABLE'});
|
|
93
|
-
|
|
94
|
-
if (!dispute) {
|
|
95
|
-
console.warn('Cannot test getting disputes for user because there\'s no not costestable disputes in the disputes list.');
|
|
96
|
-
this.skip();
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
api.Disputes.getTransactions(dispute.Id, function(data, response){
|
|
100
|
-
api.Disputes.getDisputesForUser(data[0].AuthorId, function(data, response){
|
|
101
|
-
disputesForUser = data;
|
|
102
|
-
done();
|
|
103
|
-
});
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
it('should be retrieved', function(){
|
|
109
|
-
expect(disputesForUser.length).to.be.above(0);
|
|
110
|
-
});
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
describe('Get Disputes for PayIn', function() {
|
|
114
|
-
var dispute, disputesForPayIn, payIn;
|
|
115
|
-
|
|
116
|
-
before(function(done){
|
|
117
|
-
dispute = _.find(disputes, function(disputeItem) {
|
|
118
|
-
return disputeItem.InitialTransactionId;
|
|
119
|
-
});
|
|
120
|
-
|
|
121
|
-
if (!dispute) {
|
|
122
|
-
console.warn('Cannot test getting disputes for wallet because there\'s no disputes with transaction ID in the disputes list.');
|
|
123
|
-
this.skip();
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
payIn = api.PayIns.get(dispute.InitialTransactionId, function(data, response){
|
|
127
|
-
api.Disputes.getDisputesForPayIn(data.Id, function(data, response){
|
|
128
|
-
disputesForPayIn = data;
|
|
129
|
-
done();
|
|
130
|
-
});
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
it('should be retrieved', function(){
|
|
136
|
-
expect(disputesForPayIn.length).to.be.above(0);
|
|
137
|
-
});
|
|
138
|
-
});
|
|
139
|
-
|
|
140
|
-
describe('Create Dispute Document', function() {
|
|
141
|
-
var dispute, document;
|
|
142
|
-
|
|
143
|
-
before(function(done){
|
|
144
|
-
dispute = _.find(disputes, function(disputeItem){
|
|
145
|
-
return _.contains(['PENDING_CLIENT_ACTION', 'REOPENED_PENDING_CLIENT_ACTION'], disputeItem.Status);
|
|
146
|
-
});
|
|
147
|
-
|
|
148
|
-
if (!dispute) {
|
|
149
|
-
console.warn('Cannot test creating dispute document because there\'s no dispute with expected status in the disputes list.');
|
|
150
|
-
this.skip();
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
api.Disputes.createDisputeDocument(dispute.Id, {
|
|
154
|
-
Type: 'DELIVERY_PROOF'
|
|
155
|
-
}, function(data, response){
|
|
156
|
-
document = data;
|
|
157
|
-
done();
|
|
158
|
-
});
|
|
159
|
-
|
|
160
|
-
});
|
|
161
|
-
|
|
162
|
-
it('should be created', function(){
|
|
163
|
-
expect(document.Type).to.equal('DELIVERY_PROOF');
|
|
164
|
-
});
|
|
165
|
-
});
|
|
166
|
-
|
|
167
|
-
describe('Create Dispute Document Page From File', function() {
|
|
168
|
-
var dispute, document, page, requestResponse;
|
|
169
|
-
|
|
170
|
-
before(function(done){
|
|
171
|
-
dispute = _.find(disputes, function(disputeItem){
|
|
172
|
-
return _.contains(['PENDING_CLIENT_ACTION', 'REOPENED_PENDING_CLIENT_ACTION'], disputeItem.Status);
|
|
173
|
-
});
|
|
174
|
-
|
|
175
|
-
if (!dispute) {
|
|
176
|
-
console.warn('Cannot test creating dispute document page because there\'s no dispute with expected status in the disputes list.');
|
|
177
|
-
this.skip();
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
api.Disputes.createDisputeDocument(dispute.Id, {
|
|
181
|
-
Type: 'DELIVERY_PROOF'
|
|
182
|
-
}, function(data, response){
|
|
183
|
-
document = data;
|
|
184
|
-
api.Disputes.createDisputeDocumentPageFromFile(dispute.Id, document.Id, path.resolve(__dirname + '/../TestKycPageFile.png'), function(data, response){
|
|
185
|
-
page = data;
|
|
186
|
-
requestResponse = response;
|
|
187
|
-
done();
|
|
188
|
-
});
|
|
189
|
-
});
|
|
190
|
-
|
|
191
|
-
});
|
|
192
|
-
|
|
193
|
-
it('should be created', function(){
|
|
194
|
-
expect(page).not.to.be.undefined;
|
|
195
|
-
expect(requestResponse.statusCode).to.equal(204);
|
|
196
|
-
});
|
|
197
|
-
|
|
198
|
-
describe('Create Dispute Document Consult', function () {
|
|
199
|
-
var consults;
|
|
200
|
-
|
|
201
|
-
before(function(done) {
|
|
202
|
-
if(!document) {
|
|
203
|
-
console.warn('Cannot test creating dispute document page consult because there\'s no dispute with expected status in the disputes list.');
|
|
204
|
-
this.skip();
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
api.Disputes.createDisputeDocumentConsult(document.Id, function(data, response) {
|
|
208
|
-
consults = data;
|
|
209
|
-
done();
|
|
210
|
-
});
|
|
211
|
-
});
|
|
212
|
-
|
|
213
|
-
it('should be created', function () {
|
|
214
|
-
expect(consults).not.to.be.undefined;
|
|
215
|
-
expect(consults).to.be.an('array');
|
|
216
|
-
});
|
|
217
|
-
});
|
|
218
|
-
});
|
|
219
|
-
|
|
220
|
-
describe('Contest Dispute', function() {
|
|
221
|
-
var dispute, contest;
|
|
222
|
-
|
|
223
|
-
before(function(done){
|
|
224
|
-
dispute = _.find(disputes, function(disputeItem){
|
|
225
|
-
return (_.contains(['CONTESTABLE', 'RETRIEVAL'], disputeItem.DisputeType) &&
|
|
226
|
-
_.contains(['PENDING_CLIENT_ACTION', 'REOPENED_PENDING_CLIENT_ACTION'], disputeItem.Status)
|
|
227
|
-
);
|
|
228
|
-
});
|
|
229
|
-
|
|
230
|
-
if (!dispute) {
|
|
231
|
-
console.warn('Cannot test contesting dispute because there\'s no disputes that can be contested in the disputes list.');
|
|
232
|
-
this.skip();
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
var contestedFunds = null;
|
|
236
|
-
|
|
237
|
-
if (dispute.Status === 'PENDING_CLIENT_ACTION') {
|
|
238
|
-
contestedFunds = {
|
|
239
|
-
Amount: '10',
|
|
240
|
-
Currency: 'EUR'
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
api.Disputes.contestDispute(dispute.Id, contestedFunds, function(data, response){
|
|
245
|
-
contest = data;
|
|
246
|
-
done();
|
|
247
|
-
});
|
|
248
|
-
|
|
249
|
-
});
|
|
250
|
-
|
|
251
|
-
it('should be created', function(){
|
|
252
|
-
expect(contest).not.to.be.undefined;
|
|
253
|
-
expect(contest.Id).to.equal(dispute.Id);
|
|
254
|
-
expect(contest.Status).to.equal('SUBMITTED');
|
|
255
|
-
});
|
|
256
|
-
});
|
|
257
|
-
|
|
258
|
-
describe('Resubmit Dispute', function() {
|
|
259
|
-
var dispute, resubmitted;
|
|
260
|
-
|
|
261
|
-
before(function(done){
|
|
262
|
-
dispute = _.find(disputes, function(disputeItem){
|
|
263
|
-
return (_.contains(['CONTESTABLE', 'RETRIEVAL'], disputeItem.DisputeType) &&
|
|
264
|
-
disputeItem.Status === 'REOPENED_PENDING_CLIENT_ACTION'
|
|
265
|
-
);
|
|
266
|
-
});
|
|
267
|
-
|
|
268
|
-
if (!dispute) {
|
|
269
|
-
console.warn('Cannot test contesting dispute because there\'s no disputes that can be resubmited in the disputes list.');
|
|
270
|
-
this.skip();
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
api.Disputes.resubmitDispute(dispute.Id, function(data, response){
|
|
274
|
-
resubmitted = data;
|
|
275
|
-
done();
|
|
276
|
-
});
|
|
277
|
-
|
|
278
|
-
});
|
|
279
|
-
|
|
280
|
-
it('should be resubmitted', function(){
|
|
281
|
-
expect(resubmitted).not.to.be.undefined;
|
|
282
|
-
expect(resubmitted.Id).to.equal(dispute.Id);
|
|
283
|
-
expect(resubmitted.Status).to.equal('SUBMITTED');
|
|
284
|
-
});
|
|
285
|
-
});
|
|
286
|
-
describe('Update', function() {
|
|
287
|
-
var dispute, updated;
|
|
288
|
-
|
|
289
|
-
before(function(done){
|
|
290
|
-
dispute = {
|
|
291
|
-
Id: disputes[0].Id,
|
|
292
|
-
Tag: 'New Tag ' + new Date().getTime()
|
|
293
|
-
};
|
|
294
|
-
|
|
295
|
-
api.Disputes.update(dispute, function(data, response){
|
|
296
|
-
updated = data;
|
|
297
|
-
done();
|
|
298
|
-
});
|
|
299
|
-
|
|
300
|
-
});
|
|
301
|
-
|
|
302
|
-
it('should be updated', function(){
|
|
303
|
-
expect(updated).not.to.be.undefined;
|
|
304
|
-
expect(updated.Tag).to.equal(dispute.Tag);
|
|
305
|
-
});
|
|
306
|
-
});
|
|
307
|
-
|
|
308
|
-
describe('Close Dispute', function() {
|
|
309
|
-
var dispute, closedDispute;
|
|
310
|
-
|
|
311
|
-
before(function(done){
|
|
312
|
-
dispute = _.find(disputes, function(disputeItem){
|
|
313
|
-
return _.contains(['PENDING_CLIENT_ACTION', 'REOPENED_PENDING_CLIENT_ACTION'], disputeItem.Status);
|
|
314
|
-
});
|
|
315
|
-
|
|
316
|
-
if (!dispute) {
|
|
317
|
-
console.warn('Cannot test closing dispute because there\'s no available disputes with expected status in the disputes list.');
|
|
318
|
-
this.skip();
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
api.Disputes.closeDispute(dispute.Id, function(data, response){
|
|
322
|
-
closedDispute = data;
|
|
323
|
-
done();
|
|
324
|
-
});
|
|
325
|
-
|
|
326
|
-
});
|
|
327
|
-
|
|
328
|
-
it('should be closed', function(){
|
|
329
|
-
expect(closedDispute).not.to.be.undefined;
|
|
330
|
-
expect(closedDispute.Status).to.equal('CLOSED');
|
|
331
|
-
});
|
|
332
|
-
});
|
|
333
|
-
|
|
334
|
-
describe('Get Document', function() {
|
|
335
|
-
var dispute, document, createdDoc;
|
|
336
|
-
|
|
337
|
-
before(function(done){
|
|
338
|
-
dispute = _.find(disputes, function(disputeItem){
|
|
339
|
-
return _.contains(['PENDING_CLIENT_ACTION', 'REOPENED_PENDING_CLIENT_ACTION'], disputeItem.Status);
|
|
340
|
-
});
|
|
341
|
-
|
|
342
|
-
if (!dispute) {
|
|
343
|
-
console.warn('Cannot test getting dispute\'s document because there\'s no dispute with expected status in the disputes list.');
|
|
344
|
-
this.skip();
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
api.Disputes.createDisputeDocument(dispute.Id, {
|
|
348
|
-
Type: 'OTHER'
|
|
349
|
-
}, function(data, response){
|
|
350
|
-
createdDoc = data;
|
|
351
|
-
api.DisputeDocuments.get(createdDoc.Id, function(data, response){
|
|
352
|
-
document = data;
|
|
353
|
-
done();
|
|
354
|
-
});
|
|
355
|
-
});
|
|
356
|
-
});
|
|
357
|
-
|
|
358
|
-
it('should be retrieved', function(){
|
|
359
|
-
expect(document).not.to.be.undefined;
|
|
360
|
-
expect(document).to.eql(createdDoc);
|
|
361
|
-
});
|
|
362
|
-
});
|
|
363
|
-
|
|
364
|
-
describe('Get Documents for Dispute', function() {
|
|
365
|
-
var dispute, documents;
|
|
366
|
-
|
|
367
|
-
before(function(done){
|
|
368
|
-
dispute = _.findWhere(disputes, {Status: 'SUBMITTED'});
|
|
369
|
-
|
|
370
|
-
if (!dispute) {
|
|
371
|
-
console.warn('Cannot test getting dispute\'s documents because there\'s no available disputes with SUBMITTED status in the disputes list.');
|
|
372
|
-
this.skip();
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
api.Disputes.getDocumentsForDispute(dispute.Id, function(data, response){
|
|
376
|
-
documents = data;
|
|
377
|
-
done();
|
|
378
|
-
});
|
|
379
|
-
});
|
|
380
|
-
|
|
381
|
-
it('should be retrieved', function(){
|
|
382
|
-
expect(documents.length).to.be.above(0);
|
|
383
|
-
});
|
|
384
|
-
});
|
|
385
|
-
describe('Get All Documents', function() {
|
|
386
|
-
var documents;
|
|
387
|
-
|
|
388
|
-
before(function(done){
|
|
389
|
-
api.DisputeDocuments.getAll(function(data, response){
|
|
390
|
-
documents = data;
|
|
391
|
-
done();
|
|
392
|
-
});
|
|
393
|
-
});
|
|
394
|
-
|
|
395
|
-
it('should be retrieved', function(){
|
|
396
|
-
expect(documents.length).to.be.above(0);
|
|
397
|
-
});
|
|
398
|
-
});
|
|
399
|
-
describe('Update Dispute Document', function() {
|
|
400
|
-
var dispute, document, updatedDoc;
|
|
401
|
-
|
|
402
|
-
before(function(done){
|
|
403
|
-
dispute = _.find(disputes, function(disputeItem){
|
|
404
|
-
return _.contains(['PENDING_CLIENT_ACTION', 'REOPENED_PENDING_CLIENT_ACTION'], disputeItem.Status);
|
|
405
|
-
});
|
|
406
|
-
|
|
407
|
-
if (!dispute) {
|
|
408
|
-
console.warn('Cannot test submitting dispute\'s documents because there\'s no dispute with expected status in the disputes list.');
|
|
409
|
-
this.skip();
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
api.Disputes.createDisputeDocument(dispute.Id, {
|
|
413
|
-
Type: 'DELIVERY_PROOF'
|
|
414
|
-
}, function(data, response){
|
|
415
|
-
document = data;
|
|
416
|
-
// api.Disputes.createDisputeDocumentPageFromFile(dispute.Id, document.Id, path.resolve(__dirname + '../TestKycPageFile.png'), function(){
|
|
417
|
-
// done();
|
|
418
|
-
// });
|
|
419
|
-
|
|
420
|
-
api.Disputes.updateDisputeDocument(dispute.Id, _.extend({}, document, {
|
|
421
|
-
Status: 'VALIDATION_ASKED'
|
|
422
|
-
}), function(data, response){
|
|
423
|
-
updatedDoc = data;
|
|
424
|
-
done();
|
|
425
|
-
});
|
|
426
|
-
});
|
|
427
|
-
});
|
|
428
|
-
|
|
429
|
-
it('should be updated', function(){
|
|
430
|
-
expect(updatedDoc).not.to.be.undefined;
|
|
431
|
-
expect(updatedDoc.Id).to.equal(document.Id);
|
|
432
|
-
expect(updatedDoc.Status).to.equal('VALIDATION_ASKED');
|
|
433
|
-
});
|
|
434
|
-
});
|
|
435
|
-
describe('Get Repudiation', function() {
|
|
436
|
-
var dispute, transactions, repudiation;
|
|
437
|
-
|
|
438
|
-
before(function(done){
|
|
439
|
-
var self = this;
|
|
440
|
-
|
|
441
|
-
dispute = _.find(disputes, function(disputeItem){
|
|
442
|
-
return (disputeItem.InitialTransactionId && disputeItem.DisputeType === 'NOT_CONTESTABLE');
|
|
443
|
-
});
|
|
444
|
-
|
|
445
|
-
if (!dispute) {
|
|
446
|
-
console.warn('Cannot test getting repudiation because there\'s no not costestable disputes with transaction ID in the disputes list.');
|
|
447
|
-
this.skip();
|
|
448
|
-
}
|
|
449
|
-
|
|
450
|
-
api.Disputes.getTransactions(dispute.Id, function(data, response){
|
|
451
|
-
transactions = data;
|
|
452
|
-
if (!transactions.length) {
|
|
453
|
-
console.warn('Cannot test getting repudiation because dispute has no transaction.');
|
|
454
|
-
self.skip();
|
|
455
|
-
}
|
|
456
|
-
api.Disputes.getRepudiation(dispute.RepudiationId, function(data, response){
|
|
457
|
-
repudiation = data;
|
|
458
|
-
done();
|
|
459
|
-
});
|
|
460
|
-
});
|
|
461
|
-
});
|
|
462
|
-
|
|
463
|
-
it('should be retrieved', function(){
|
|
464
|
-
expect(repudiation).not.to.be.undefined;
|
|
465
|
-
expect(repudiation.Id).to.equal(dispute.RepudiationId);
|
|
466
|
-
});
|
|
467
|
-
});
|
|
468
|
-
describe('Create Settlement Transfer', function() {
|
|
469
|
-
var dispute, transactions, repudiation, settlementTransfer;
|
|
470
|
-
|
|
471
|
-
before(function(done){
|
|
472
|
-
var self = this;
|
|
473
|
-
|
|
474
|
-
dispute = _.find(disputes, function(disputeItem){
|
|
475
|
-
return (disputeItem.Status === 'CLOSED' && disputeItem.DisputeType === 'NOT_CONTESTABLE');
|
|
476
|
-
});
|
|
477
|
-
|
|
478
|
-
if (!dispute) {
|
|
479
|
-
console.warn('Cannot test creating settlement transfer because there\'s no closed, not costestable disputes in the disputes list.');
|
|
480
|
-
this.skip();
|
|
481
|
-
}
|
|
482
|
-
|
|
483
|
-
api.Disputes.getTransactions(dispute.Id, function(data, response){
|
|
484
|
-
transactions = data;
|
|
485
|
-
api.Disputes.getRepudiation(dispute.RepudiationId, function(data, response){
|
|
486
|
-
repudiation = data;
|
|
487
|
-
api.Disputes.createSettlementTransfer({
|
|
488
|
-
AuthorId: repudiation.AuthorId,
|
|
489
|
-
DebitedFunds: {
|
|
490
|
-
Amount: '1',
|
|
491
|
-
Currency: 'EUR'
|
|
492
|
-
},
|
|
493
|
-
Fees: {
|
|
494
|
-
Amount: '0',
|
|
495
|
-
Currency: 'EUR'
|
|
496
|
-
}
|
|
497
|
-
}, repudiation.Id, function(data, response){
|
|
498
|
-
settlementTransfer = data;
|
|
499
|
-
done();
|
|
500
|
-
});
|
|
501
|
-
});
|
|
502
|
-
});
|
|
503
|
-
});
|
|
504
|
-
|
|
505
|
-
it('should be retrieved', function(){
|
|
506
|
-
expect(settlementTransfer).not.to.be.undefined;
|
|
507
|
-
expect(settlementTransfer.Type).to.equal('TRANSFER');
|
|
508
|
-
expect(settlementTransfer.Nature).to.equal('SETTLEMENT');
|
|
509
|
-
});
|
|
510
|
-
|
|
511
|
-
describe('Get', function(){
|
|
512
|
-
var getSettlementTransfer;
|
|
513
|
-
|
|
514
|
-
before(function(done){
|
|
515
|
-
api.Disputes.getSettlementTransfer(settlementTransfer.Id, function(data, response){
|
|
516
|
-
getSettlementTransfer = data;
|
|
517
|
-
done();
|
|
518
|
-
});
|
|
519
|
-
});
|
|
520
|
-
|
|
521
|
-
it('should be retrieved', function(){
|
|
522
|
-
expect(getSettlementTransfer).not.to.be.undefined;
|
|
523
|
-
expect(getSettlementTransfer).to.eql(settlementTransfer);
|
|
524
|
-
});
|
|
525
|
-
});
|
|
526
|
-
});
|
|
527
|
-
describe('Get Disputes Pending Settlement', function(){
|
|
528
|
-
var getPendingSettlement;
|
|
529
|
-
|
|
530
|
-
before(function(done){
|
|
531
|
-
api.Disputes.getPendingSettlement(function(data, response){
|
|
532
|
-
getPendingSettlement = data;
|
|
533
|
-
done();
|
|
534
|
-
})
|
|
535
|
-
});
|
|
536
|
-
|
|
537
|
-
it('should be retrieved', function(){
|
|
538
|
-
expect(getPendingSettlement).not.to.be.undefined;
|
|
539
|
-
expect(getPendingSettlement).to.be.an('array')
|
|
540
|
-
})
|
|
541
|
-
})
|
|
542
|
-
});
|
package/test/services/EMoney.js
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
var expect = require('chai').expect;
|
|
2
|
-
var helpers = require('../helpers');
|
|
3
|
-
var api = require('../main');
|
|
4
|
-
var UserLegal = require('../../lib/models/UserLegal');
|
|
5
|
-
|
|
6
|
-
describe('Get user emoney', function() {
|
|
7
|
-
var john = new UserLegal(helpers.data.getUserLegal());
|
|
8
|
-
var emoney;
|
|
9
|
-
var year = 2019;
|
|
10
|
-
var month = 4;
|
|
11
|
-
|
|
12
|
-
before(function(done){
|
|
13
|
-
api.Users.create(john).then(function (data, response) {
|
|
14
|
-
john = data;
|
|
15
|
-
done();
|
|
16
|
-
});
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
describe('For year', function () {
|
|
20
|
-
|
|
21
|
-
before(function (done) {
|
|
22
|
-
api.Users.getEMoney(john.Id, year).then(function (data) {
|
|
23
|
-
emoney = data;
|
|
24
|
-
done();
|
|
25
|
-
});
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
it('should be returned correctly', function () {
|
|
29
|
-
expect(emoney.UserId).to.equal(john.Id);
|
|
30
|
-
expect(emoney.CreditedEMoney.Amount).to.equal(0);
|
|
31
|
-
expect(emoney.CreditedEMoney.Currency).to.equal('EUR');
|
|
32
|
-
expect(emoney.DebitedEMoney.Amount).to.equal(0);
|
|
33
|
-
expect(emoney.DebitedEMoney.Currency).to.equal('EUR');
|
|
34
|
-
});
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
describe('For month', function () {
|
|
38
|
-
before(function (done) {
|
|
39
|
-
api.Users.getEMoney(john.Id, year, month).then(function (data) {
|
|
40
|
-
emoney = data;
|
|
41
|
-
done();
|
|
42
|
-
});
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
it('should be returned correctly', function () {
|
|
46
|
-
expect(emoney.UserId).to.equal(john.Id);
|
|
47
|
-
expect(emoney.CreditedEMoney.Amount).to.equal(0);
|
|
48
|
-
expect(emoney.CreditedEMoney.Currency).to.equal('EUR');
|
|
49
|
-
expect(emoney.DebitedEMoney.Amount).to.equal(0);
|
|
50
|
-
expect(emoney.DebitedEMoney.Currency).to.equal('EUR');
|
|
51
|
-
});
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
|