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/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,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
|
-
});
|
|
@@ -1,239 +0,0 @@
|
|
|
1
|
-
var _ = require('underscore');
|
|
2
|
-
var expect = require('chai').expect;
|
|
3
|
-
var helpers = require('../helpers');
|
|
4
|
-
var api = require('../main');
|
|
5
|
-
|
|
6
|
-
describe('Card Registrations', function () {
|
|
7
|
-
var cardRegistration;
|
|
8
|
-
var john = helpers.data.getUserNatural();
|
|
9
|
-
|
|
10
|
-
before(function(done){
|
|
11
|
-
api.Users.create(john, function(){
|
|
12
|
-
done();
|
|
13
|
-
});
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
describe('Create', function () {
|
|
17
|
-
before(function (done) {
|
|
18
|
-
cardRegistration = {
|
|
19
|
-
UserId: john.Id,
|
|
20
|
-
Currency: 'EUR'
|
|
21
|
-
};
|
|
22
|
-
api.CardRegistrations.create(cardRegistration, function(data, response){
|
|
23
|
-
done();
|
|
24
|
-
});
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
it('should be created', function () {
|
|
28
|
-
expect(cardRegistration.Id).not.to.be.undefined;
|
|
29
|
-
expect(cardRegistration.AccessKey).not.to.be.undefined;
|
|
30
|
-
expect(cardRegistration.PreregistrationData).not.to.be.undefined;
|
|
31
|
-
expect(cardRegistration.CardRegistrationURL).not.to.be.undefined;
|
|
32
|
-
expect(cardRegistration.Status).to.equal('CREATED');
|
|
33
|
-
expect(cardRegistration.Currency).to.equal('EUR');
|
|
34
|
-
expect(cardRegistration.UserId).to.equal(john.Id);
|
|
35
|
-
});
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
describe('Get', function () {
|
|
39
|
-
var cardRegistrationGet;
|
|
40
|
-
|
|
41
|
-
before(function (done) {
|
|
42
|
-
api.CardRegistrations.get(cardRegistration.Id, function(data, response){
|
|
43
|
-
cardRegistrationGet = data;
|
|
44
|
-
done();
|
|
45
|
-
});
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
it('should be retrieved', function () {
|
|
49
|
-
expect(cardRegistrationGet.Id).to.equal(cardRegistration.Id);
|
|
50
|
-
expect(cardRegistrationGet.PreregistrationData).to.equal(cardRegistration.PreregistrationData);
|
|
51
|
-
});
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
describe('Update', function () {
|
|
55
|
-
var updatedCardRegistration, newRegistrationData;
|
|
56
|
-
|
|
57
|
-
before(function (done) {
|
|
58
|
-
var options = {
|
|
59
|
-
data: {
|
|
60
|
-
data: cardRegistration.PreregistrationData,
|
|
61
|
-
accessKeyRef: cardRegistration.AccessKey,
|
|
62
|
-
cardNumber: '4970107111111119',
|
|
63
|
-
cardExpirationDate: '1229',
|
|
64
|
-
cardCvx: '123'
|
|
65
|
-
},
|
|
66
|
-
url: cardRegistration.CardRegistrationURL,
|
|
67
|
-
headers: {
|
|
68
|
-
'Content-Type': 'application/x-www-form-urlencoded'
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
api.method('post', function (data, response) {
|
|
73
|
-
cardRegistration.RegistrationData = Buffer.from(data).toString();
|
|
74
|
-
newRegistrationData = cardRegistration.RegistrationData;
|
|
75
|
-
api.CardRegistrations.update(cardRegistration).then(function(data){
|
|
76
|
-
updatedCardRegistration = data;
|
|
77
|
-
done();
|
|
78
|
-
});
|
|
79
|
-
}, options);
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
it('should be updated', function () {
|
|
83
|
-
console.log(JSON.stringify(updatedCardRegistration));
|
|
84
|
-
expect(updatedCardRegistration.RegistrationData).to.equal(newRegistrationData);
|
|
85
|
-
expect(updatedCardRegistration.Status).to.equal('VALIDATED');
|
|
86
|
-
expect(updatedCardRegistration.ResultCode).to.equal('000000');
|
|
87
|
-
expect(updatedCardRegistration.CardId).to.not.be.undefined;
|
|
88
|
-
});
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
describe('Update Error', function () {
|
|
92
|
-
var newCardRegistration;
|
|
93
|
-
before(function (done) {
|
|
94
|
-
newCardRegistration = {
|
|
95
|
-
UserId: john.Id,
|
|
96
|
-
Currency: 'EUR'
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
api.CardRegistrations.create(newCardRegistration, function(data, response){
|
|
100
|
-
newCardRegistration.RegistrationData = 'Wrong-data';
|
|
101
|
-
api.CardRegistrations.update(newCardRegistration, function(data, response){
|
|
102
|
-
done();
|
|
103
|
-
});
|
|
104
|
-
});
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
it('should fail', function () {
|
|
108
|
-
expect(newCardRegistration.ResultCode).not.to.be.undefined;
|
|
109
|
-
expect(newCardRegistration.ResultMessage).not.to.be.undefined;
|
|
110
|
-
expect(newCardRegistration.Status).to.equal('ERROR');
|
|
111
|
-
});
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
describe('Cards', function () {
|
|
115
|
-
var card;
|
|
116
|
-
var validatedCard;
|
|
117
|
-
var fetchedCardValidation;
|
|
118
|
-
before(function(done) {
|
|
119
|
-
api.Cards.get(cardRegistration.CardId, function(data, response){
|
|
120
|
-
card = data;
|
|
121
|
-
done();
|
|
122
|
-
});
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
describe('Validate Card', function () {
|
|
126
|
-
before(function(done) {
|
|
127
|
-
var cardValidation = {
|
|
128
|
-
AuthorId: cardRegistration.UserId,
|
|
129
|
-
SecureModeReturnURL: "http://example.com",
|
|
130
|
-
IpAddress: "2001:0620:0000:0000:0211:24FF:FE80:C12C",
|
|
131
|
-
BrowserInfo: {
|
|
132
|
-
AcceptHeader: "text/html, application/xhtml+xml, application/xml;q=0.9, /;q=0.8",
|
|
133
|
-
ColorDepth: 4,
|
|
134
|
-
JavaEnabled: true,
|
|
135
|
-
JavascriptEnabled: true,
|
|
136
|
-
Language: 'FR-FR',
|
|
137
|
-
ScreenHeight: 1800,
|
|
138
|
-
ScreenWidth: 400,
|
|
139
|
-
TimeZoneOffset: "+60",
|
|
140
|
-
UserAgent: "Mozilla/5.0 (iPhone; CPU iPhone OS 13_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148"
|
|
141
|
-
}
|
|
142
|
-
};
|
|
143
|
-
|
|
144
|
-
api.Cards.validate(cardRegistration.CardId, cardValidation, function (data) {
|
|
145
|
-
validatedCard = data;
|
|
146
|
-
done();
|
|
147
|
-
});
|
|
148
|
-
});
|
|
149
|
-
|
|
150
|
-
it('should be validated', function () {
|
|
151
|
-
expect(validatedCard).to.not.be.undefined;
|
|
152
|
-
expect(validatedCard.Id).to.not.be.undefined;
|
|
153
|
-
expect(validatedCard.Type).to.equal("CARD_VALIDATION");
|
|
154
|
-
});
|
|
155
|
-
});
|
|
156
|
-
|
|
157
|
-
describe('Get Card Validation', function () {
|
|
158
|
-
before(function(done) {
|
|
159
|
-
api.Cards.getCardValidation(cardRegistration.CardId, validatedCard.Id, function(data) {
|
|
160
|
-
fetchedCardValidation = data;
|
|
161
|
-
done();
|
|
162
|
-
});
|
|
163
|
-
});
|
|
164
|
-
|
|
165
|
-
it('should fetch card validation', function () {
|
|
166
|
-
expect(fetchedCardValidation).to.not.be.undefined;
|
|
167
|
-
expect(fetchedCardValidation.Id).to.not.be.undefined;
|
|
168
|
-
expect(fetchedCardValidation.Id).to.equal(validatedCard.Id);
|
|
169
|
-
expect(fetchedCardValidation.Type).to.equal("CARD_VALIDATION");
|
|
170
|
-
});
|
|
171
|
-
});
|
|
172
|
-
|
|
173
|
-
describe('Check Card Existing', function () {
|
|
174
|
-
it('should be retrieved', function () {
|
|
175
|
-
expect(card.Id).to.not.be.undefined;
|
|
176
|
-
expect(card.Validity).to.equal('UNKNOWN');
|
|
177
|
-
});
|
|
178
|
-
});
|
|
179
|
-
|
|
180
|
-
describe('Get By Fingerprint', function() {
|
|
181
|
-
var cards;
|
|
182
|
-
|
|
183
|
-
before(function (done) {
|
|
184
|
-
api.Cards.getByFingerprint(card.Fingerprint, function(data, response) {
|
|
185
|
-
cards = data;
|
|
186
|
-
done();
|
|
187
|
-
});
|
|
188
|
-
});
|
|
189
|
-
|
|
190
|
-
it('should retrieve list', function () {
|
|
191
|
-
expect(cards).to.be.an('array');
|
|
192
|
-
cards.forEach(function (cardByFingerprint) {
|
|
193
|
-
expect(cardByFingerprint.Fingerprint).to.equal(card.Fingerprint);
|
|
194
|
-
});
|
|
195
|
-
});
|
|
196
|
-
});
|
|
197
|
-
|
|
198
|
-
// test card deactivated
|
|
199
|
-
//describe('Update', function () {
|
|
200
|
-
// var updatedCard;
|
|
201
|
-
|
|
202
|
-
// before(function(done) {
|
|
203
|
-
// updatedCard = {
|
|
204
|
-
// Id: card.Id,
|
|
205
|
-
// Validity: 'INVALID'
|
|
206
|
-
// };
|
|
207
|
-
// api.Cards.update(updatedCard, function(data, response){
|
|
208
|
-
// updatedCard = data;
|
|
209
|
-
// done();
|
|
210
|
-
// });
|
|
211
|
-
// });
|
|
212
|
-
|
|
213
|
-
// it('should be updated', function () {
|
|
214
|
-
// expect(updatedCard.Id).to.equal(card.Id);
|
|
215
|
-
// expect(updatedCard.Active).to.be.false;
|
|
216
|
-
// });
|
|
217
|
-
//});
|
|
218
|
-
});
|
|
219
|
-
|
|
220
|
-
describe('Creating Invalid user card registration', function () {
|
|
221
|
-
var newInvalidCardRegistration = {
|
|
222
|
-
UserId: '12345678',
|
|
223
|
-
Currency: 'EUR',
|
|
224
|
-
CardType: 'CB_VISA_MASTERCARD'
|
|
225
|
-
};
|
|
226
|
-
var failedResponse;
|
|
227
|
-
|
|
228
|
-
before(function(done) {
|
|
229
|
-
api.CardRegistrations.create(newInvalidCardRegistration, function (data) {
|
|
230
|
-
failedResponse = data;
|
|
231
|
-
done();
|
|
232
|
-
});
|
|
233
|
-
});
|
|
234
|
-
|
|
235
|
-
it('should fail', function () {
|
|
236
|
-
expect(failedResponse.Type).to.equal('ressource_not_found');
|
|
237
|
-
});
|
|
238
|
-
});
|
|
239
|
-
});
|
package/test/services/Cards.js
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
var _ = require('underscore');
|
|
2
|
-
var expect = require('chai').expect;
|
|
3
|
-
var helpers = require('../helpers');
|
|
4
|
-
var UserNatural = require('../../lib/models/UserNatural');
|
|
5
|
-
var api = require('../main');
|
|
6
|
-
|
|
7
|
-
describe('Cards', function () {
|
|
8
|
-
var john = new UserNatural(helpers.data.getUserNatural());
|
|
9
|
-
var cardId;
|
|
10
|
-
|
|
11
|
-
before(function (done) {
|
|
12
|
-
api.Users.create(john).then(function (data, response) {
|
|
13
|
-
john = data;
|
|
14
|
-
done();
|
|
15
|
-
});
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
describe('Get PreAuthorizations', function () {
|
|
19
|
-
var getPreAuthorizations;
|
|
20
|
-
|
|
21
|
-
before(function (done) {
|
|
22
|
-
helpers.getNewPayInCardDirect(api, john, async function (data) {
|
|
23
|
-
cardId = data.CardId;
|
|
24
|
-
const delay = ms => new Promise(resolve => setTimeout(resolve, ms));
|
|
25
|
-
await delay(5000);
|
|
26
|
-
api.Cards.getPreAuthorizations(cardId, function (data, response) {
|
|
27
|
-
getPreAuthorizations = data;
|
|
28
|
-
done();
|
|
29
|
-
});
|
|
30
|
-
});
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
it('should be retrieved', function () {
|
|
34
|
-
expect(getPreAuthorizations).not.to.be.undefined;
|
|
35
|
-
expect(getPreAuthorizations).to.be.an('array');
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
describe('Get Transactions for Card fingerprint', function(){
|
|
40
|
-
var getTransactions;
|
|
41
|
-
|
|
42
|
-
before(function(done){
|
|
43
|
-
api.Cards.get(cardId, function(data, response){
|
|
44
|
-
api.Cards.getTransactionsForFingerprint(data.Fingerprint, function(data, response){
|
|
45
|
-
getTransactions = data;
|
|
46
|
-
done();
|
|
47
|
-
});
|
|
48
|
-
});
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
it('should be retrieved', function(){
|
|
52
|
-
expect(getTransactions).not.to.be.undefined;
|
|
53
|
-
expect(getTransactions).to.be.an('array');
|
|
54
|
-
});
|
|
55
|
-
});
|
|
56
|
-
});
|