From 6465e03c85bfa125ad86cbcab5fa102b1feb3943 Mon Sep 17 00:00:00 2001 From: Iulian Masar Date: Fri, 22 Dec 2023 15:08:04 +0200 Subject: [PATCH] small changes --- lib/models/PayIn.js | 6 +---- lib/models/PayInPaymentDetailsCardDirect.js | 3 ++- test/services/CardPreAuthorizations.js | 3 ++- test/services/PayIns.js | 5 ++-- typings/models/card.d.ts | 27 +++++++++++++++++++-- typings/models/cardPreauthorization.d.ts | 2 +- typings/models/deposit.d.ts | 2 +- typings/models/payIn.d.ts | 15 ++++++++---- 8 files changed, 45 insertions(+), 18 deletions(-) diff --git a/lib/models/PayIn.js b/lib/models/PayIn.js index 8ffcc49..fb8f521 100644 --- a/lib/models/PayIn.js +++ b/lib/models/PayIn.js @@ -19,11 +19,7 @@ var PayIn = Transaction.extend({ /** * One of PayInExecutionDetails implementations, depending on ExecutionType */ - ExecutionDetails: null, - /** - * Information about the card - */ - CardInfo: null + ExecutionDetails: null }), getReadOnlyProperties: function() { diff --git a/lib/models/PayInPaymentDetailsCardDirect.js b/lib/models/PayInPaymentDetailsCardDirect.js index 389e80e..22e18a3 100644 --- a/lib/models/PayInPaymentDetailsCardDirect.js +++ b/lib/models/PayInPaymentDetailsCardDirect.js @@ -6,7 +6,8 @@ var PayInPaymentDetailsCardDirect = PayInPaymentDetailsCard.extend({ CardId: null, IpAddress: null, Shipping: null, - BrowserInfo: null + BrowserInfo: null, + CardInfo: null }) }); diff --git a/test/services/CardPreAuthorizations.js b/test/services/CardPreAuthorizations.js index 6740388..1d6d23e 100644 --- a/test/services/CardPreAuthorizations.js +++ b/test/services/CardPreAuthorizations.js @@ -1,5 +1,5 @@ var expect = require('chai').expect; - +var api = require('../main'); var helpers = require('../helpers'); describe('Card PreAuthorizations', function() { @@ -27,6 +27,7 @@ describe('Card PreAuthorizations', function() { expect(preAuthorization.ExecutionType).to.equal('DIRECT'); expect(preAuthorization.PayInId).to.be.null; expect(preAuthorization.RemainingFunds).to.exist; + expect(preAuthorization.CardInfo).to.not.be.null; }); }); diff --git a/test/services/PayIns.js b/test/services/PayIns.js index 745fe8f..ab8598e 100644 --- a/test/services/PayIns.js +++ b/test/services/PayIns.js @@ -74,7 +74,8 @@ describe('PayIns', function () { expect(payIn.AuthorId).to.equal(john.Id); expect(payIn.Status).to.equal('SUCCEEDED'); expect(payIn.Type).to.equal('PAYIN'); - expect(payIn.SecurityInfo.AVSResult).to.equal('NO_CHECK') + expect(payIn.SecurityInfo.AVSResult).to.equal('NO_CHECK'); + expect(payIn.CardInfo).not.to.be.undefined; }); }); @@ -728,7 +729,7 @@ describe('PayIns', function () { }) }) - describe('Create a Recurring Payment Check Card Data', function() { + describe('Create a Recurring Payment Check Card Info', function() { var recurring; before(function(done){ recurringPayin = { diff --git a/typings/models/card.d.ts b/typings/models/card.d.ts index 68e928f..b5c65b6 100644 --- a/typings/models/card.d.ts +++ b/typings/models/card.d.ts @@ -1,5 +1,5 @@ -import {CountryISO, CurrencyISO} from "../types"; -import {entityBase} from "./entityBase"; +import { CountryISO, CurrencyISO } from "../types"; +import { entityBase } from "./entityBase"; export namespace card { type CardType = "CB_VISA_MASTERCARD" | "DINERS" | "MASTERPASS" | "MAESTRO" | "P24" | "IDEAL" | "BCMC" | "PAYLIB"; @@ -74,11 +74,34 @@ export namespace card { } interface CardInfoData { + /** + * The 6-digit bank identification number (BIN) of the card issuer. + */ BIN: string; + + /** + * The name of the card issuer. + */ IssuingBank: string; + + /** + * The country where the card was issued. + */ IssuerCountryCode: CountryISO; + + /** + * The type of card product: DEBIT, CREDIT, CHARGE CARD. + */ Type: CardInfoType; + + /** + * The card brand. Examples include: AMERICAN EXPRESS, DISCOVER, JCB, MASTERCARD, VISA, etc. + */ Brand: string; + + /** + * The subtype of the card product. Examples include: CLASSIC, GOLD, PLATINUM, PREPAID, etc. + */ SubType: string; } } diff --git a/typings/models/cardPreauthorization.d.ts b/typings/models/cardPreauthorization.d.ts index 988d0e0..3f7181c 100644 --- a/typings/models/cardPreauthorization.d.ts +++ b/typings/models/cardPreauthorization.d.ts @@ -5,7 +5,7 @@ import { base } from "../base"; import { money } from "./money"; import { securityInfo } from "./securityInfo"; import { shipping } from "./shipping"; -import { card } from "mangopay2-nodejs-sdk"; +import { card } from "./card"; export namespace cardPreAuthorization { import BillingData = billing.BillingData; diff --git a/typings/models/deposit.d.ts b/typings/models/deposit.d.ts index 0c40610..22c271f 100644 --- a/typings/models/deposit.d.ts +++ b/typings/models/deposit.d.ts @@ -6,7 +6,7 @@ import { payIn } from "./payIn"; import { base } from "../base"; import { billing } from "./billing"; import { shipping } from "./shipping"; -import { card } from "mangopay2-nodejs-sdk"; +import { card } from "./card"; export namespace deposit { import MoneyData = money.MoneyData; diff --git a/typings/models/payIn.d.ts b/typings/models/payIn.d.ts index 73dbd30..28a8cc5 100644 --- a/typings/models/payIn.d.ts +++ b/typings/models/payIn.d.ts @@ -135,11 +135,6 @@ export namespace payIn { * The type of execution for the payin */ ExecutionType: PayInExecutionType; - - /** - * Information about the card - */ - CardInfo: CardInfoData; } interface CardWebPayInData extends BasePayInData { @@ -306,6 +301,11 @@ export namespace payIn { * This is the URL where to redirect users to proceed to 3D secure validation */ SecureModeRedirectURL: string; + + /** + * Information about the card + */ + CardInfo: CardInfoData; } interface MbwayWebPayInData extends BasePayInData { @@ -1265,6 +1265,11 @@ export namespace payIn { Applied3DSVersion: _3DSVersion; RecurringPayinRegistrationId: string; + + /** + * Information about the card + */ + CardInfo: CardInfoData; } interface CreateRecurringPayInCIT {