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

improvement / Added new parameters to legacy IDEAL endpoint #382

Merged
merged 1 commit into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion lib/models/PayInPaymentDetailsCardWeb.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,17 @@ var PayInPaymentDetailsCardWeb = PayInPaymentDetailsCard.extend({
/*
* Shipping
*/
Shipping: null
Shipping: null,

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

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

Expand Down
38 changes: 37 additions & 1 deletion test/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -954,5 +954,41 @@ module.exports = {
};
api.PayIns.create(payIn, callback);
});
}
},

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

api.Wallets.create(wallet).then(function(){
var payIn = new api.models.PayIn({
CreditedWalletId: wallet.Id,
AuthorId: user.Id,
DebitedFunds: new api.models.Money({
Amount: 1000,
Currency: 'EUR'
}),
Fees: new api.models.Money({
Amount: 0,
Currency: 'EUR'
}),
PaymentType: 'CARD',
PaymentDetails: new api.models.PayInPaymentDetailsCard({
CardType: 'IDEAL',
Bic: 'REVOLT21'
}),
ExecutionType: 'WEB',
ExecutionDetails: new api.models.PayInPaymentDetailsCard({
ReturnURL: 'https://test.com',
TemplateURL: 'https://TemplateURL.com',
SecureMode: 'DEFAULT',
Culture: 'fr'
})
});
api.PayIns.create(payIn, callback);
});
},
};
24 changes: 24 additions & 0 deletions test/services/PayIns.js
Original file line number Diff line number Diff line change
Expand Up @@ -1259,6 +1259,30 @@ describe('PayIns', function () {
});
});

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

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

describe('Create', function () {
it('should create the legacy PayIn', function () {
expect(payIn.Id).not.to.be.undefined;
expect(payIn.BankName).not.to.be.null;
expect(payIn.CardType).to.equal('IDEAL');
expect(payIn.PaymentType).to.equal('CARD');
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;
});
});
});

// skip because we cannot generate new paymentData in the tests
describe.skip('GooglePay V2', function () {
var googlePayIn, wallet;
Expand Down
15 changes: 15 additions & 0 deletions typings/mangopay2-nodejs-sdk-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -703,6 +703,21 @@ api.PayIns.create({
const d = data; // $ExpectType GiropayWebPayInData
});

api.PayIns.create({
PaymentType: "CARD",
ExecutionType: "WEB",
AuthorId: "user-id",
CreditedWalletId: "wallet-id",
Fees: {Amount: 100, Currency: "GBP"},
DebitedFunds: {Amount: 2000, Currency: "GBP"},
ReturnURL: "https://secure-return.co",
Culture: "FR",
Bic: "RBRBNL21",
CardType: "IDEAL"
}).then(data => {
const d = data; // $ExpectType CardWebPayInData
});

api.PayIns.create({
PaymentType: "CARD",
ExecutionType: "WEB",
Expand Down
10 changes: 10 additions & 0 deletions typings/models/payIn.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,11 @@ export namespace payIn {
* The URL to redirect to user to for them to proceed with the payment
*/
RedirectURL: string;

/**
* Name of the end-user’s bank
*/
BankName: string;
}

interface CreateCardWebPayIn {
Expand Down Expand Up @@ -252,6 +257,11 @@ export namespace payIn {
* Contains every useful information's related to the user shipping
*/
Shipping?: ShippingData;

/**
* The BIC identifier of the end-user’s bank
*/
Bic?: string;
}

interface CardDirectPayInData extends BasePayInData {
Expand Down
Loading