mangopay4-nodejs-sdk 1.64.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/.github/workflows/node.js.yml +32 -0
- package/.github/workflows/npm-publish.yml +26 -0
- package/.jshintrc +16 -0
- package/CHANGELOG.md +946 -0
- package/LICENSE +21 -0
- package/README.md +179 -0
- package/docs/BankAccounts.md +35 -0
- package/docs/BankingAliases.md +108 -0
- package/docs/CardPreAuthorizations.md +55 -0
- package/docs/CardRegistrations.md +55 -0
- package/docs/Cards.md +82 -0
- package/docs/Clients.md +142 -0
- package/docs/DisputeDocuments.md +53 -0
- package/docs/Disputes.md +292 -0
- package/docs/Events.md +23 -0
- package/docs/Hooks.md +68 -0
- package/docs/Idempotency.md +11 -0
- package/docs/KycDocuments.md +52 -0
- package/docs/Mandates.md +125 -0
- package/docs/OptionsHelper.md +32 -0
- package/docs/PayIns.md +72 -0
- package/docs/PayOuts.md +55 -0
- package/docs/README.md +131 -0
- package/docs/Refunds.md +25 -0
- package/docs/Reports.md +63 -0
- package/docs/Repudiations.md +25 -0
- package/docs/Responses.md +33 -0
- package/docs/Transfers.md +72 -0
- package/docs/UboDeclarations.md +70 -0
- package/docs/Users.md +322 -0
- package/docs/Wallets.md +70 -0
- package/docs/templates/class.mustache +11 -0
- package/docs/templates/file.mustache +53 -0
- package/docs/templates/function.mustache +33 -0
- package/docs/templates/index.mustache +26 -0
- package/docs/templates/overview.mustache +1 -0
- package/examples/createUsers.js +112 -0
- package/examples/createWallet.js +28 -0
- package/examples/failedRequest.js +20 -0
- package/examples/getBankAccounts.js +29 -0
- package/examples/getUserEmoney.js +16 -0
- package/examples/getUsers.js +32 -0
- package/examples/readResponseHeaders.js +42 -0
- package/index.js +1 -0
- package/lib/Model.js +58 -0
- package/lib/api.js +467 -0
- package/lib/apiMethods.js +270 -0
- package/lib/config.js +57 -0
- package/lib/log.js +9 -0
- package/lib/mangopay.js +8 -0
- package/lib/models/Address.js +32 -0
- package/lib/models/BankAccount.js +45 -0
- package/lib/models/BankAccountDetails.js +7 -0
- package/lib/models/BankAccountDetailsCA.js +12 -0
- package/lib/models/BankAccountDetailsGB.js +10 -0
- package/lib/models/BankAccountDetailsIBAN.js +10 -0
- package/lib/models/BankAccountDetailsOTHER.js +16 -0
- package/lib/models/BankAccountDetailsUS.js +14 -0
- package/lib/models/BankAccountType.js +8 -0
- package/lib/models/BankingAlias.js +37 -0
- package/lib/models/BankingAliasIBAN.js +27 -0
- package/lib/models/Billing.js +14 -0
- package/lib/models/BinData.js +16 -0
- package/lib/models/Birthplace.js +10 -0
- package/lib/models/BrowserInfo.js +15 -0
- package/lib/models/Card.js +19 -0
- package/lib/models/CardInfo.js +32 -0
- package/lib/models/CardPreAuthorization.js +144 -0
- package/lib/models/CardRegistration.js +29 -0
- package/lib/models/CardValidation.js +19 -0
- package/lib/models/CategorizeUserLegal.js +15 -0
- package/lib/models/CategorizeUserNatural.js +18 -0
- package/lib/models/Check.js +13 -0
- package/lib/models/CheckData.js +8 -0
- package/lib/models/Client.js +62 -0
- package/lib/models/ClientWallet.js +28 -0
- package/lib/models/Conversion.js +19 -0
- package/lib/models/ConversionRate.js +10 -0
- package/lib/models/CountryAuthorization.js +12 -0
- package/lib/models/DebitedBankAccount.js +15 -0
- package/lib/models/DeclaredUbo.js +29 -0
- package/lib/models/DeclaredUboStatus.js +17 -0
- package/lib/models/Deposit.js +29 -0
- package/lib/models/Dispute.js +46 -0
- package/lib/models/DisputeDocument.js +10 -0
- package/lib/models/DisputeDocumentPage.js +12 -0
- package/lib/models/DisputeReason.js +11 -0
- package/lib/models/Document.js +12 -0
- package/lib/models/DocumentPageConsult.js +17 -0
- package/lib/models/EMoney.js +30 -0
- package/lib/models/EntityBase.js +70 -0
- package/lib/models/Hook.js +19 -0
- package/lib/models/IdempotencyResponse.js +11 -0
- package/lib/models/IdentityVerification.js +12 -0
- package/lib/models/KycDocument.js +11 -0
- package/lib/models/KycDocumentStatus.js +7 -0
- package/lib/models/KycDocumentType.js +7 -0
- package/lib/models/KycPage.js +12 -0
- package/lib/models/LegalPersonType.js +7 -0
- package/lib/models/LegalRepresentative.js +16 -0
- package/lib/models/Mandate.js +69 -0
- package/lib/models/MandateStatus.js +7 -0
- package/lib/models/Money.js +16 -0
- package/lib/models/PayByBankSupportedBank.js +7 -0
- package/lib/models/PayIn.js +36 -0
- package/lib/models/PayInExecutionDetails.js +7 -0
- package/lib/models/PayInExecutionDetailsBankingAlias.js +19 -0
- package/lib/models/PayInExecutionDetailsDirect.js +29 -0
- package/lib/models/PayInExecutionDetailsWeb.js +40 -0
- package/lib/models/PayInExecutionType.js +5 -0
- package/lib/models/PayInIntent.js +20 -0
- package/lib/models/PayInIntentSplit.js +14 -0
- package/lib/models/PayInIntentSplits.js +7 -0
- package/lib/models/PayInPaymentDetails.js +7 -0
- package/lib/models/PayInPaymentDetailsApplePay.js +19 -0
- package/lib/models/PayInPaymentDetailsBancontact.js +13 -0
- package/lib/models/PayInPaymentDetailsBankWire.js +23 -0
- package/lib/models/PayInPaymentDetailsBankingAlias.js +18 -0
- package/lib/models/PayInPaymentDetailsBizum.js +23 -0
- package/lib/models/PayInPaymentDetailsBlik.js +17 -0
- package/lib/models/PayInPaymentDetailsCard.js +10 -0
- package/lib/models/PayInPaymentDetailsCardDirect.js +14 -0
- package/lib/models/PayInPaymentDetailsCardWeb.js +28 -0
- package/lib/models/PayInPaymentDetailsDirectDebitDirect.js +22 -0
- package/lib/models/PayInPaymentDetailsDirectDebitWeb.js +13 -0
- package/lib/models/PayInPaymentDetailsGiropay.js +15 -0
- package/lib/models/PayInPaymentDetailsGooglePay.js +35 -0
- package/lib/models/PayInPaymentDetailsIdeal.js +25 -0
- package/lib/models/PayInPaymentDetailsKlarna.js +36 -0
- package/lib/models/PayInPaymentDetailsMbway.js +20 -0
- package/lib/models/PayInPaymentDetailsMultibanco.js +14 -0
- package/lib/models/PayInPaymentDetailsPayByBank.js +71 -0
- package/lib/models/PayInPaymentDetailsPayPal.js +63 -0
- package/lib/models/PayInPaymentDetailsPayconiq.js +23 -0
- package/lib/models/PayInPaymentDetailsPreAuthorized.js +10 -0
- package/lib/models/PayInPaymentDetailsSatispay.js +19 -0
- package/lib/models/PayInPaymentDetailsSwish.js +35 -0
- package/lib/models/PayInPaymentDetailsTwint.js +15 -0
- package/lib/models/PayInPaymentType.js +21 -0
- package/lib/models/PayInRecurringRegistration.js +64 -0
- package/lib/models/PayInTemplateURLOptions.js +10 -0
- package/lib/models/PayOut.js +24 -0
- package/lib/models/PayOutPaymentDetails.js +7 -0
- package/lib/models/PayOutPaymentDetailsBankWire.js +32 -0
- package/lib/models/PayOutPaymentType.js +3 -0
- package/lib/models/PaymentData.js +20 -0
- package/lib/models/PaymentMethodMetadata.js +38 -0
- package/lib/models/PayoutMethods.js +7 -0
- package/lib/models/PendingUserAction.js +16 -0
- package/lib/models/PersonType.js +5 -0
- package/lib/models/PlatformCategorization.js +16 -0
- package/lib/models/PlatformType.js +10 -0
- package/lib/models/Quote.js +11 -0
- package/lib/models/Recipient.js +20 -0
- package/lib/models/RecipientSchema.js +17 -0
- package/lib/models/RecurringPayIn.js +10 -0
- package/lib/models/RecurringPayInCIT.js +32 -0
- package/lib/models/RecurringPayInCurrentState.js +24 -0
- package/lib/models/RecurringPayInMIT.js +27 -0
- package/lib/models/RecurringPayInPut.js +24 -0
- package/lib/models/Refund.js +26 -0
- package/lib/models/RefundReasonDetails.js +10 -0
- package/lib/models/Report.js +54 -0
- package/lib/models/ReportFilter.js +52 -0
- package/lib/models/ReportFilterV2.js +11 -0
- package/lib/models/ReportV2.js +28 -0
- package/lib/models/Repudiation.js +51 -0
- package/lib/models/SecurityInfo.js +12 -0
- package/lib/models/Settlement.js +16 -0
- package/lib/models/SettlementTransfer.js +37 -0
- package/lib/models/Shipping.js +14 -0
- package/lib/models/ShippingAddress.js +25 -0
- package/lib/models/ShippingPreference.js +5 -0
- package/lib/models/Transaction.js +50 -0
- package/lib/models/Transfer.js +13 -0
- package/lib/models/Ubo.js +19 -0
- package/lib/models/UboDeclaration.js +42 -0
- package/lib/models/UboDeclarationRefusedReasonType.js +23 -0
- package/lib/models/UboDeclarationStatus.js +26 -0
- package/lib/models/UboRefusedReasonType.js +14 -0
- package/lib/models/User.js +66 -0
- package/lib/models/UserCategory.js +5 -0
- package/lib/models/UserConsent.js +7 -0
- package/lib/models/UserDataFormatValidation.js +7 -0
- package/lib/models/UserEnrollmentResult.js +7 -0
- package/lib/models/UserLegal.js +65 -0
- package/lib/models/UserLegalOwner.js +66 -0
- package/lib/models/UserLegalPayer.js +66 -0
- package/lib/models/UserLegalSca.js +57 -0
- package/lib/models/UserNatural.js +51 -0
- package/lib/models/UserNaturalCapacity.js +13 -0
- package/lib/models/UserNaturalOwner.js +55 -0
- package/lib/models/UserNaturalPayer.js +55 -0
- package/lib/models/UserNaturalPut.js +49 -0
- package/lib/models/UserNaturalSca.js +56 -0
- package/lib/models/VirtualAccount.js +22 -0
- package/lib/models/Wallet.js +32 -0
- package/lib/models/index.js +102 -0
- package/lib/service.js +14 -0
- package/lib/services/BankAccounts.js +31 -0
- package/lib/services/BankingAliases.js +137 -0
- package/lib/services/CardPreAuthorizations.js +75 -0
- package/lib/services/CardRegistrations.js +64 -0
- package/lib/services/Cards.js +168 -0
- package/lib/services/Clients.js +196 -0
- package/lib/services/Conversions.js +155 -0
- package/lib/services/Deposits.js +109 -0
- package/lib/services/DisputeDocuments.js +65 -0
- package/lib/services/Disputes.js +409 -0
- package/lib/services/Events.js +24 -0
- package/lib/services/Hooks.js +81 -0
- package/lib/services/Idempotency.js +17 -0
- package/lib/services/IdentityVerifications.js +48 -0
- package/lib/services/KycDocuments.js +66 -0
- package/lib/services/Mandates.js +161 -0
- package/lib/services/OptionsHelper.js +20 -0
- package/lib/services/PayIns.js +690 -0
- package/lib/services/PayOuts.js +110 -0
- package/lib/services/Recipients.js +117 -0
- package/lib/services/Refunds.js +29 -0
- package/lib/services/Regulatory.js +29 -0
- package/lib/services/Reports.js +61 -0
- package/lib/services/ReportsV2.js +55 -0
- package/lib/services/Repudiations.js +33 -0
- package/lib/services/Responses.js +23 -0
- package/lib/services/Settlements.js +74 -0
- package/lib/services/Transfers.js +87 -0
- package/lib/services/UboDeclarations.js +135 -0
- package/lib/services/Users.js +831 -0
- package/lib/services/VirtualAccounts.js +99 -0
- package/lib/services/Wallets.js +85 -0
- package/lib/services/index.js +34 -0
- package/lib/utils.js +36 -0
- package/package.json +40 -0
- package/test/TestKycPageFile.png +0 -0
- package/test/helpers.js +1431 -0
- package/test/main.js +10 -0
- package/test/mocha.opts +3 -0
- package/test/services/BankAccounts.js +46 -0
- package/test/services/BankingAliases.js +89 -0
- package/test/services/CardPreAuthorizations.js +70 -0
- package/test/services/CardRegistrations.js +239 -0
- package/test/services/Cards.js +54 -0
- package/test/services/Clients.js +235 -0
- package/test/services/Conversions.js +308 -0
- package/test/services/Deposits.js +148 -0
- package/test/services/Disputes.js +542 -0
- package/test/services/EMoney.js +54 -0
- package/test/services/Events.js +143 -0
- package/test/services/Hooks.js +109 -0
- package/test/services/Idempotency.js +46 -0
- package/test/services/IdentityVerifications.js +68 -0
- package/test/services/KycDocuments.js +73 -0
- package/test/services/Mandates.js +256 -0
- package/test/services/PayIns.js +2553 -0
- package/test/services/PayOuts.js +106 -0
- package/test/services/RateLimit.js +48 -0
- package/test/services/Recipients.js +234 -0
- package/test/services/Refunds.js +123 -0
- package/test/services/Regulatory.js +45 -0
- package/test/services/Reports.js +114 -0
- package/test/services/ReportsV2.js +306 -0
- package/test/services/Repudiations.js +22 -0
- package/test/services/Settlements.js +58 -0
- package/test/services/Tokens.js +55 -0
- package/test/services/Transfers.js +137 -0
- package/test/services/UboDeclarations.js +135 -0
- package/test/services/Users.js +1303 -0
- package/test/services/VirtualAccounts.js +105 -0
- package/test/services/Wallets.js +132 -0
- package/test/settlement_sample.csv +8 -0
- package/typings/base.d.ts +308 -0
- package/typings/enums.d.ts +204 -0
- package/typings/index.d.ts +885 -0
- package/typings/index.test-d.ts +1535 -0
- package/typings/models/address.d.ts +70 -0
- package/typings/models/bankAccount.d.ts +235 -0
- package/typings/models/bankingAlias.d.ts +97 -0
- package/typings/models/billing.d.ts +42 -0
- package/typings/models/birthplace.d.ts +9 -0
- package/typings/models/card.d.ts +119 -0
- package/typings/models/cardPreauthorization.d.ts +157 -0
- package/typings/models/cardRegistration.d.ts +83 -0
- package/typings/models/cardValidation.d.ts +125 -0
- package/typings/models/client.d.ts +208 -0
- package/typings/models/conversion.d.ts +225 -0
- package/typings/models/conversionRate.d.ts +29 -0
- package/typings/models/countryAuthorization.d.ts +16 -0
- package/typings/models/deposit.d.ts +104 -0
- package/typings/models/dispute.d.ts +116 -0
- package/typings/models/disputeDocument.d.ts +119 -0
- package/typings/models/entityBase.d.ts +9 -0
- package/typings/models/event.d.ts +142 -0
- package/typings/models/hook.d.ts +39 -0
- package/typings/models/idempotency.d.ts +36 -0
- package/typings/models/identityVerification.d.ts +98 -0
- package/typings/models/kycDocument.d.ts +114 -0
- package/typings/models/mandate.d.ts +93 -0
- package/typings/models/money.d.ts +45 -0
- package/typings/models/payIn.d.ts +3742 -0
- package/typings/models/payOut.d.ts +144 -0
- package/typings/models/recipient.d.ts +242 -0
- package/typings/models/refund.d.ts +92 -0
- package/typings/models/report.d.ts +234 -0
- package/typings/models/reportV2.d.ts +145 -0
- package/typings/models/repudiation.d.ts +26 -0
- package/typings/models/securityInfo.d.ts +12 -0
- package/typings/models/settlement.d.ts +50 -0
- package/typings/models/settlementTransfer.d.ts +37 -0
- package/typings/models/shipping.d.ts +37 -0
- package/typings/models/shippingAddress.d.ts +15 -0
- package/typings/models/transaction.d.ts +85 -0
- package/typings/models/transfer.d.ts +119 -0
- package/typings/models/uboDeclaration.d.ts +100 -0
- package/typings/models/user.d.ts +1001 -0
- package/typings/models/virtualAccount.d.ts +182 -0
- package/typings/models/wallet.d.ts +46 -0
- package/typings/models.d.ts +74 -0
- package/typings/services/BankAccounts.d.ts +12 -0
- package/typings/services/BankingAliases.d.ts +51 -0
- package/typings/services/CardPreauthorizations.d.ts +44 -0
- package/typings/services/CardRegistrations.d.ts +43 -0
- package/typings/services/Cards.d.ts +80 -0
- package/typings/services/Clients.d.ts +77 -0
- package/typings/services/Conversions.d.ts +23 -0
- package/typings/services/Deposits.d.ts +20 -0
- package/typings/services/DisputeDocuments.d.ts +27 -0
- package/typings/services/Disputes.d.ts +169 -0
- package/typings/services/Events.d.ts +11 -0
- package/typings/services/Hooks.d.ts +33 -0
- package/typings/services/Idempotency.d.ts +7 -0
- package/typings/services/IdentityVerifications.d.ts +29 -0
- package/typings/services/KycDocuments.d.ts +38 -0
- package/typings/services/Mandates.d.ts +59 -0
- package/typings/services/OptionsHelper.d.ts +11 -0
- package/typings/services/PayIns.d.ts +319 -0
- package/typings/services/PayOuts.d.ts +34 -0
- package/typings/services/Recipients.d.ts +55 -0
- package/typings/services/Refunds.d.ts +12 -0
- package/typings/services/Regulatory.d.ts +17 -0
- package/typings/services/Reports.d.ts +26 -0
- package/typings/services/ReportsV2.d.ts +26 -0
- package/typings/services/Repudiations.d.ts +12 -0
- package/typings/services/Responses.d.ts +10 -0
- package/typings/services/Settlements.d.ts +28 -0
- package/typings/services/Transfers.d.ts +38 -0
- package/typings/services/UboDeclarations.d.ts +81 -0
- package/typings/services/Users.d.ts +308 -0
- package/typings/services/VirtualAccounts.d.ts +42 -0
- package/typings/services/Wallets.d.ts +36 -0
- package/typings/tsconfig.json +20 -0
- package/typings/tslint.json +11 -0
- package/typings/types.d.ts +652 -0
|
@@ -0,0 +1,542 @@
|
|
|
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
|
+
});
|
|
@@ -0,0 +1,54 @@
|
|
|
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
|
+
|