Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rel/1.40.0 #377

Merged
merged 9 commits into from
Nov 2, 2023
6 changes: 4 additions & 2 deletions lib/apiMethods.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ module.exports = {
"payins_satispay-web_create": ["/${apiVersion}/${clientId}/payins/payment-methods/satispay", "POST"],
"payins_blik-web_create": ["/${apiVersion}/${clientId}/payins/payment-methods/blik", "POST"],
"payins_klarna-web_create": ["/${apiVersion}/${clientId}/payins/payment-methods/klarna", "POST"],
"payins_ideal-web_create": ["/${apiVersion}/${clientId}/payins/payment-methods/ideal", "POST"],
"payins_giropay-web_create": ["/${apiVersion}/${clientId}/payins/payment-methods/giropay", "POST"],

"payouts_bankwire_create": ["/${apiVersion}/${clientId}/payouts/bankwire/", "POST"],
"payouts_bankwire_get": ["/${apiVersion}/${clientId}/payouts/bankwire/${id}", "GET"],
Expand Down Expand Up @@ -133,8 +135,8 @@ module.exports = {
"disputes_repudiation_get_settlement": ["/${apiVersion}/${clientId}/settlements/${id}", "GET"],
"disputes_pending_settlement": ["/${apiVersion}/${clientId}/disputes/pendingsettlement", "GET"],

"reports_transaction_create": ["/${apiVersion}/${clientId}/reports/transactions/", "POST"],
"reports_wallet_create": ["/${apiVersion}/${clientId}/reports/wallets/", "POST"],
"reports_transactions_create": ["/${apiVersion}/${clientId}/reports/transactions/", "POST"],
"reports_wallets_create": ["/${apiVersion}/${clientId}/reports/wallets/", "POST"],
"reports_get": ["/${apiVersion}/${clientId}/reports/${id}", "GET"],
"reports_all": ["/${apiVersion}/${clientId}/reports", "GET"],

Expand Down
15 changes: 15 additions & 0 deletions lib/models/PayInPaymentDetailsGiropay.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
var _ = require('underscore');
var PayInPaymentDetails = require('./PayInPaymentDetails');

var PayInPaymentDetailsGiropay = PayInPaymentDetails.extend({
defaults: {

/**
* Custom description to show on the user's bank statement.
* It can be up to 10 char alpha-numeric and space.
*/
StatementDescriptor: null
}
});

module.exports = PayInPaymentDetailsGiropay;
25 changes: 25 additions & 0 deletions lib/models/PayInPaymentDetailsIdeal.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
var _ = require('underscore');
var PayInPaymentDetails = require('./PayInPaymentDetails');

var PayInPaymentDetailsIdeal = PayInPaymentDetails.extend({
defaults: {

/**
* The BIC identifier of the end-user’s bank
*/
Bic: null,

/**
* Name of the end-user’s bank
*/
BankName: null,

/**
* Custom description to show on the user's bank statement.
* It can be up to 10 char alpha-numeric and space.
*/
StatementDescriptor: null
}
});

module.exports = PayInPaymentDetailsIdeal;
2 changes: 1 addition & 1 deletion lib/models/PayInPaymentDetailsKlarna.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ var PayInPaymentDetailsKlarna = PayInPaymentDetails.extend({

Email: null,

MerchantOrderId: null,
Reference: null,

/**
* Custom description to show on the user's bank statement.
Expand Down
4 changes: 3 additions & 1 deletion lib/models/PayInPaymentType.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,7 @@ module.exports = {
Multibanco: 'MULTIBANCO',
Satispay: 'SATISPAY',
Blik: 'BLIK',
Klarna: 'KLARNA'
Klarna: 'KLARNA',
Ideal: 'IDEAL',
Giropay: 'GIROPAY'
};
5 changes: 3 additions & 2 deletions lib/models/Refund.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@ var Refund = Transaction.extend({
InitialTransactionType: null,
DebitedWalletId: null,
CreditedWalletId: null,
RefundReason: null
RefundReason: null,
Reference: null
}),

getSubObjects: function() {
return {
'RefundReason': RefundReasonDetails
}
};
}
});

Expand Down
2 changes: 1 addition & 1 deletion lib/models/Report.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ var Report = EntityBase.extend({
*/
DownloadFormat: null,
/**
* Report type {TRANSACTION}
* Report type {TRANSACTIONS, WALLETS}
*/
ReportType: null,
/**
Expand Down
4 changes: 4 additions & 0 deletions lib/services/PayIns.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ const PayInPaymentDetailsMultibanco = require("../models/PayInPaymentDetailsMult
const PayInPaymentDetailsSatispay = require("../models/PayInPaymentDetailsSatispay");
const PayInPaymentDetailsBlik = require("../models/PayInPaymentDetailsBlik");
const PayInPaymentDetailsKlarna = require("../models/PayInPaymentDetailsKlarna");
const PayInPaymentDetailsIdeal = require("../models/PayInPaymentDetailsIdeal");
const PayInPaymentDetailsGiropay = require("../models/PayInPaymentDetailsGiropay");

var PayIns = Service.extend({
/**
Expand Down Expand Up @@ -249,6 +251,8 @@ var PayIns = Service.extend({
if (payIn.PaymentDetails instanceof PayInPaymentDetailsSatispay) return 'satispay';
if (payIn.PaymentDetails instanceof PayInPaymentDetailsBlik) return 'blik';
if (payIn.PaymentDetails instanceof PayInPaymentDetailsKlarna) return 'klarna';
if (payIn.PaymentDetails instanceof PayInPaymentDetailsIdeal) return 'ideal';
if (payIn.PaymentDetails instanceof PayInPaymentDetailsGiropay) return 'giropay';

throw new Error('PayIn needs a PaymentType');
},
Expand Down
2 changes: 1 addition & 1 deletion lib/services/Reports.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ var Reports = Service.extend({
});

if (!report.ReportType) {
throw new Error('Please specify ReportType in the report data (ex: "TRANSACTION", "WALLET")')
throw new Error('Please specify ReportType in the report data (ex: "TRANSACTIONS", "WALLETS")')
}

var reportType = report.ReportType.toLowerCase();
Expand Down
62 changes: 61 additions & 1 deletion test/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,7 @@ module.exports = {
}
],
ShippingPreference: "NO_SHIPPING",
Reference: "Reference",
Tag: "tag",
StatementDescriptor: "test"
};
Expand Down Expand Up @@ -872,11 +873,70 @@ module.exports = {
"Country": "US"
}
},
MerchantOrderId: "1234",
Reference: "1234",
StatementDescriptor: "test",
Tag: "test tag"
};
api.PayIns.create(payIn, callback);
});
},

getNewPayInIdealWeb: function (api, user, callback) {
var wallet = {
Owners: [user.Id],
Currency: 'EUR',
Description: 'WALLET IN EUR'
};

api.Wallets.create(wallet).then(function () {
var payIn = {
PaymentType: 'IDEAL',
ExecutionType: 'WEB',
AuthorId: user.Id,
CreditedWalletId: wallet.Id,
DebitedFunds: {
Amount: 1000,
Currency: 'EUR'
},
Fees: {
Amount: 0,
Currency: 'EUR'
},
ReturnURL: 'http://test.com',
Bic: 'SNSBNL2A',
StatementDescriptor: "ideal",
Tag: "test tag"
};
api.PayIns.create(payIn, callback);
});
},

getNewPayInGiropayWeb: function (api, user, callback) {
var wallet = {
Owners: [user.Id],
Currency: 'EUR',
Description: 'WALLET IN EUR'
};

api.Wallets.create(wallet).then(function () {
var payIn = {
PaymentType: 'GIROPAY',
ExecutionType: 'WEB',
AuthorId: user.Id,
CreditedWalletId: wallet.Id,
DebitedFunds: {
Amount: 1000,
Currency: 'EUR'
},
Fees: {
Amount: 0,
Currency: 'EUR'
},
ReturnURL: 'http://test.com',
StatementDescriptor: "giropay",
Tag: "test tag"
};
api.PayIns.create(payIn, callback);
});
}
};
81 changes: 80 additions & 1 deletion test/services/PayIns.js
Original file line number Diff line number Diff line change
Expand Up @@ -1164,7 +1164,86 @@ describe('PayIns', function () {
});
});

describe('GooglePay V2', function () {
describe('Ideal Web', function () {
var payIn;

before(function (done) {
helpers.getNewPayInIdealWeb(api, john, function (data) {
payIn = data;
done();
});
});

describe('Create', function () {
it('should create the PayIn', function () {
expect(payIn.Id).not.to.be.undefined;
expect(payIn.PaymentType).to.equal('IDEAL');
expect(payIn.ExecutionType).to.equal('WEB');
expect(payIn.AuthorId).to.equal(john.Id);
expect(payIn.Type).to.equal('PAYIN');
expect(payIn.Phone).not.to.be.null;
});
});

describe('Get', function () {
var getPayIn;
before(function (done) {
api.PayIns.get(payIn.Id, function (data, response) {
getPayIn = data;
done()
});
});

it('should get the PayIn', function () {
expect(getPayIn.Id).to.equal(payIn.Id);
expect(getPayIn.PaymentType).to.equal('IDEAL');
expect(getPayIn.ExecutionType).to.equal('WEB');
expect(getPayIn.Phone).not.to.be.null;
});
});
});

describe('Giropay Web', function () {
var payIn;

before(function (done) {
helpers.getNewPayInGiropayWeb(api, john, function (data) {
payIn = data;
done();
});
});

describe('Create', function () {
it('should create the PayIn', function () {
expect(payIn.Id).not.to.be.undefined;
expect(payIn.PaymentType).to.equal('GIROPAY');
expect(payIn.ExecutionType).to.equal('WEB');
expect(payIn.AuthorId).to.equal(john.Id);
expect(payIn.Type).to.equal('PAYIN');
expect(payIn.Phone).not.to.be.null;
});
});

describe('Get', function () {
var getPayIn;
before(function (done) {
api.PayIns.get(payIn.Id, function (data, response) {
getPayIn = data;
done()
});
});

it('should get the PayIn', function () {
expect(getPayIn.Id).to.equal(payIn.Id);
expect(getPayIn.PaymentType).to.equal('GIROPAY');
expect(getPayIn.ExecutionType).to.equal('WEB');
expect(getPayIn.Phone).not.to.be.null;
});
});
});

// skip because we cannot generate new paymentData in the tests
describe.skip('GooglePay V2', function () {
var googlePayIn, wallet;

before(function (done) {
Expand Down
Loading
Loading