From a3d5f8ce5756fea91d6139d6b4ea76d2eaf9b7f1 Mon Sep 17 00:00:00 2001 From: Silviana Ghita Date: Fri, 22 Sep 2023 15:45:23 +0300 Subject: [PATCH 1/6] Fixed : Error while creating a transaction report --- lib/apiMethods.js | 4 +- lib/models/Report.js | 2 +- lib/services/Reports.js | 2 +- test/services/Reports.js | 68 ++++++++++++++++++++++----- typings/mangopay2-nodejs-sdk-tests.ts | 2 +- typings/models/report.d.ts | 8 ++-- typings/types.d.ts | 4 +- 7 files changed, 68 insertions(+), 22 deletions(-) diff --git a/lib/apiMethods.js b/lib/apiMethods.js index 03e7264..74595cd 100644 --- a/lib/apiMethods.js +++ b/lib/apiMethods.js @@ -133,8 +133,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"], diff --git a/lib/models/Report.js b/lib/models/Report.js index e1a6c8c..bc3ae80 100644 --- a/lib/models/Report.js +++ b/lib/models/Report.js @@ -21,7 +21,7 @@ var Report = EntityBase.extend({ */ DownloadFormat: null, /** - * Report type {TRANSACTION} + * Report type {TRANSACTIONS, WALLETS} */ ReportType: null, /** diff --git a/lib/services/Reports.js b/lib/services/Reports.js index b49bab2..5c72f98 100644 --- a/lib/services/Reports.js +++ b/lib/services/Reports.js @@ -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(); diff --git a/test/services/Reports.js b/test/services/Reports.js index 6fb5a1f..0421235 100644 --- a/test/services/Reports.js +++ b/test/services/Reports.js @@ -1,14 +1,60 @@ var expect = require('chai').expect; var helpers = require('../helpers'); +var api = require('../main'); -describe('Reports - Transaction', function() { +describe('Reports - Transactions', function () { var report; - before(function(done) { + before(function (done) { report = { - ReportType: "TRANSACTION" + ReportType: "TRANSACTIONS", + Tag: 'Created with Mangopay NodeJs SDK', + DownloadFormat: 'CSV', + CallbackURL: 'https://mangopay.com/docs/please-ignore', + Sort: 'CreationDate:ASC', + Preview: false, + Filters: + { + BeforeDate: 1658838931, + AfterDate: 1658838931, + Type: ['PAYIN'], + ResultCode: ['000000'], + Status: ['SUCCEEDED'], + Nature: ['REGULAR'], + WalletId: null, + AuthorId: null, + MinDebitedFundsAmount: 10, + MinDebitedFundsCurrency: 'EUR', + MaxDebitedFundsAmount: 12000, + MaxDebitedFundsCurrency: 'EUR', + MinFeesAmount: 10, + MinFeesCurrency: 'EUR', + MaxFeesAmount: 150000, + MaxFeesCurrency: 'EUR', + }, + Columns: [ + 'Id', + 'Tag', + 'CreationDate', + 'ExecutionDate', + 'AuthorId', + 'CreditedUserId', + 'DebitedFundsAmount', + 'DebitedFundsCurrency', + 'CreditedFundsAmount', + 'CreditedFundsCurrency', + 'FeesAmount', + 'FeesCurrency', + 'Status', + 'ResultCode', + 'ResultMessage', + 'Type', + 'Nature', + 'CreditedWalletId', + 'DebitedWalletId', + ] }; - api.Reports.create(report).then(function () { + api.Reports.create(report).then(function (data) { done(); }); }); @@ -20,8 +66,8 @@ describe('Reports - Transaction', function() { describe('Getting created report', function () { var getReport; - before(function(done){ - api.Reports.get(report.Id).then(function(data){ + before(function (done) { + api.Reports.get(report.Id).then(function (data) { getReport = data; done(); }); @@ -34,12 +80,12 @@ describe('Reports - Transaction', function() { }); }); -describe('Reports - Wallet', function() { +describe('Reports - Wallets', function () { var report; - before(function(done) { + before(function (done) { report = { - ReportType: "WALLET" + ReportType: "WALLETS" }; api.Reports.create(report).then(function () { done(); @@ -53,8 +99,8 @@ describe('Reports - Wallet', function() { describe('Getting created report', function () { var getReport; - before(function(done){ - api.Reports.get(report.Id).then(function(data){ + before(function (done) { + api.Reports.get(report.Id).then(function (data) { getReport = data; done(); }); diff --git a/typings/mangopay2-nodejs-sdk-tests.ts b/typings/mangopay2-nodejs-sdk-tests.ts index 2bccd07..8ff8e6f 100644 --- a/typings/mangopay2-nodejs-sdk-tests.ts +++ b/typings/mangopay2-nodejs-sdk-tests.ts @@ -1222,7 +1222,7 @@ api.Hooks.getAll().then(data => { /* Reports */ -api.Reports.create({Columns: ["Alias", "AuthorId"], ReportType: "WALLET"}).then(data => { +api.Reports.create({Columns: ["Alias", "AuthorId"], ReportType: "WALLETS"}).then(data => { const d = data; // $ExpectType ReportData }); diff --git a/typings/models/report.d.ts b/typings/models/report.d.ts index 4a91a0c..70e11c4 100644 --- a/typings/models/report.d.ts +++ b/typings/models/report.d.ts @@ -1,6 +1,6 @@ -import { CurrencyISO, PickPartial, Timestamp } from "../types"; -import { transaction } from "./transaction"; -import { entityBase } from "./entityBase"; +import {CurrencyISO, PickPartial, Timestamp} from "../types"; +import {transaction} from "./transaction"; +import {entityBase} from "./entityBase"; export namespace report { type Column = @@ -141,7 +141,7 @@ export namespace report { /** * The type of report */ - ReportType: "TRANSACTION" | "WALLET"; + ReportType: "TRANSACTIONS" | "WALLETS"; /** * The column to sort against and direction separated by a `:` diff --git a/typings/types.d.ts b/typings/types.d.ts index c4ecf20..6afea25 100644 --- a/typings/types.d.ts +++ b/typings/types.d.ts @@ -127,8 +127,8 @@ export type ApiMethod = | "disputes_repudiation_create_settlement" | "disputes_repudiation_get_settlement" | "disputes_pending_settlement" - | "reports_transaction_create" - | "reports_wallet_create" + | "reports_transactions_create" + | "reports_wallets_create" | "reports_get" | "reports_all" | "mandates_directdebit-web_create" From 7c001672bc976210d6a1a8a7ce714554f6e4dce4 Mon Sep 17 00:00:00 2001 From: Silviana Ghita Date: Tue, 3 Oct 2023 10:19:02 +0300 Subject: [PATCH 2/6] Integrated ideal and giropay mops --- lib/apiMethods.js | 2 + lib/models/PayInPaymentDetailsGiropay.js | 15 +++ lib/models/PayInPaymentDetailsIdeal.js | 25 ++++ lib/models/PayInPaymentType.js | 4 +- lib/services/PayIns.js | 4 + test/helpers.js | 59 +++++++++ test/services/PayIns.js | 78 ++++++++++++ typings/enums.d.ts | 2 + typings/index.d.ts | 132 ++++++++++---------- typings/mangopay2-nodejs-sdk-tests.ts | 29 +++++ typings/models/instantConversion.d.ts | 2 +- typings/models/payIn.d.ts | 147 ++++++++++++++++++++++- typings/models/transaction.d.ts | 6 +- typings/services/InstantConversions.d.ts | 6 +- typings/services/PayIns.d.ts | 4 +- typings/types.d.ts | 4 +- 16 files changed, 442 insertions(+), 77 deletions(-) create mode 100644 lib/models/PayInPaymentDetailsGiropay.js create mode 100644 lib/models/PayInPaymentDetailsIdeal.js diff --git a/lib/apiMethods.js b/lib/apiMethods.js index 939ad67..a9d795d 100644 --- a/lib/apiMethods.js +++ b/lib/apiMethods.js @@ -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"], diff --git a/lib/models/PayInPaymentDetailsGiropay.js b/lib/models/PayInPaymentDetailsGiropay.js new file mode 100644 index 0000000..19de35b --- /dev/null +++ b/lib/models/PayInPaymentDetailsGiropay.js @@ -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; diff --git a/lib/models/PayInPaymentDetailsIdeal.js b/lib/models/PayInPaymentDetailsIdeal.js new file mode 100644 index 0000000..1cb280c --- /dev/null +++ b/lib/models/PayInPaymentDetailsIdeal.js @@ -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; \ No newline at end of file diff --git a/lib/models/PayInPaymentType.js b/lib/models/PayInPaymentType.js index 4f7903f..90dce22 100644 --- a/lib/models/PayInPaymentType.js +++ b/lib/models/PayInPaymentType.js @@ -11,5 +11,7 @@ module.exports = { Multibanco: 'MULTIBANCO', Satispay: 'SATISPAY', Blik: 'BLIK', - Klarna: 'KLARNA' + Klarna: 'KLARNA', + Ideal: 'IDEAL', + Giropay: 'GIROPAY' }; diff --git a/lib/services/PayIns.js b/lib/services/PayIns.js index a5601e1..e7e2f8f 100644 --- a/lib/services/PayIns.js +++ b/lib/services/PayIns.js @@ -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({ /** @@ -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'); }, diff --git a/test/helpers.js b/test/helpers.js index cc0fecb..3af66f8 100644 --- a/test/helpers.js +++ b/test/helpers.js @@ -878,5 +878,64 @@ module.exports = { }; 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); + }); } }; diff --git a/test/services/PayIns.js b/test/services/PayIns.js index 90454bd..41b1c21 100644 --- a/test/services/PayIns.js +++ b/test/services/PayIns.js @@ -1164,6 +1164,84 @@ describe('PayIns', 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; + }); + }); + }); + describe('GooglePay V2', function () { var googlePayIn, wallet; diff --git a/typings/enums.d.ts b/typings/enums.d.ts index 74854ac..5c981f0 100644 --- a/typings/enums.d.ts +++ b/typings/enums.d.ts @@ -17,6 +17,8 @@ export namespace enums { Blik: "BLIK"; GooglePay: "GOOGLE_PAY"; Klarna: "KLARNA"; + Ideal: "IDEAL"; + Giropay: "GIROPAY"; } interface IMandateStatus { diff --git a/typings/index.d.ts b/typings/index.d.ts index 92012bc..e685690 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -2,72 +2,72 @@ /// -import {ApiMethod, CountryISO, CurrencyISO, MakeKeysRequired, SecureMode, Timestamp} from "./types"; -import {base} from "./base"; -import {Users} from "./services/Users"; -import {BankAccounts} from "./services/BankAccounts"; -import {BankingAliases} from "./services/BankingAliases"; -import {DisputeDocuments} from "./services/DisputeDocuments"; -import {Wallets} from "./services/Wallets"; -import {KycDocuments} from "./services/KycDocuments"; -import {UboDeclarations} from "./services/UboDeclarations"; -import {Cards} from "./services/Cards"; -import {CardRegistrations} from "./services/CardRegistrations"; -import {CardPreAuthorizations} from "./services/CardPreauthorizations"; -import {PayIns} from "./services/PayIns"; -import {Transfers} from "./services/Transfers"; -import {PayOuts} from "./services/PayOuts"; -import {Refunds} from "./services/Refunds"; -import {Clients} from "./services/Clients"; -import {Disputes} from "./services/Disputes"; -import {Repudiations} from "./services/Repudiations"; -import {Events} from "./services/Events"; -import {Responses} from "./services/Responses"; -import {Mandates} from "./services/Mandates"; -import {Hooks} from "./services/Hooks"; -import {Reports} from "./services/Reports"; -import {Idempotency} from "./services/Idempotency"; -import {address} from "./models/address"; -import {enums} from "./enums"; -import {bankingAlias} from "./models/bankingAlias"; -import {bankAccount} from "./models/bankAccount"; -import {transaction} from "./models/transaction"; -import {wallet} from "./models/wallet"; -import {disputeDocument} from "./models/disputeDocument"; -import {uboDeclaration} from "./models/uboDeclaration"; -import {kycDocument} from "./models/kycDocument"; -import {money} from "./models/money"; -import {conversionRate} from "./models/conversionRate"; -import {instantConversion} from "./models/instantConversion"; -import {cardRegistration} from "./models/cardRegistration"; -import {card} from "./models/card"; -import {cardPreAuthorization} from "./models/cardPreauthorization"; -import {entityBase} from "./models/entityBase"; -import {user} from "./models/user"; -import {payIn} from "./models/payIn"; -import {refund} from "./models/refund"; -import {repudiation} from "./models/repudiation"; -import {client} from "./models/client"; -import {dispute} from "./models/dispute"; -import {settlementTransfer} from "./models/settlementTransfer"; -import {transfer} from "./models/transfer"; -import {shippingAddress} from "./models/shippingAddress"; -import {payOut} from "./models/payOut"; -import {mandate} from "./models/mandate"; -import {hook} from "./models/hook"; -import {report} from "./models/report"; -import {billing} from "./models/billing"; -import {deposit} from "./models/deposit"; -import {birthplace} from "./models/birthplace"; -import {event} from "./models/event"; -import {idempotency} from "./models/idempotency"; -import {securityInfo} from "./models/securityInfo"; -import {shipping} from "./models/shipping"; -import {countryAuthorization} from "./models/countryAuthorization"; -import {Regulatory} from "./services/Regulatory"; -import {Deposits} from "./services/Deposits"; -import {cardValidation} from "./models/cardValidation"; -import {InstantConversions} from "./services/InstantConversions"; +import { ApiMethod, CountryISO, CurrencyISO, MakeKeysRequired, SecureMode, Timestamp } from "./types"; +import { base } from "./base"; +import { Users } from "./services/Users"; +import { BankAccounts } from "./services/BankAccounts"; +import { BankingAliases } from "./services/BankingAliases"; +import { DisputeDocuments } from "./services/DisputeDocuments"; +import { Wallets } from "./services/Wallets"; +import { KycDocuments } from "./services/KycDocuments"; +import { UboDeclarations } from "./services/UboDeclarations"; +import { Cards } from "./services/Cards"; +import { CardRegistrations } from "./services/CardRegistrations"; +import { CardPreAuthorizations } from "./services/CardPreauthorizations"; +import { PayIns } from "./services/PayIns"; +import { Transfers } from "./services/Transfers"; +import { PayOuts } from "./services/PayOuts"; +import { Refunds } from "./services/Refunds"; +import { Clients } from "./services/Clients"; +import { Disputes } from "./services/Disputes"; +import { Repudiations } from "./services/Repudiations"; +import { Events } from "./services/Events"; +import { Responses } from "./services/Responses"; +import { Mandates } from "./services/Mandates"; +import { Hooks } from "./services/Hooks"; +import { Reports } from "./services/Reports"; +import { Idempotency } from "./services/Idempotency"; +import { address } from "./models/address"; +import { enums } from "./enums"; +import { bankingAlias } from "./models/bankingAlias"; +import { bankAccount } from "./models/bankAccount"; +import { transaction } from "./models/transaction"; +import { wallet } from "./models/wallet"; +import { disputeDocument } from "./models/disputeDocument"; +import { uboDeclaration } from "./models/uboDeclaration"; +import { kycDocument } from "./models/kycDocument"; +import { money } from "./models/money"; +import { conversionRate } from "./models/conversionRate"; +import { instantConversion } from "./models/instantConversion"; +import { cardRegistration } from "./models/cardRegistration"; +import { card } from "./models/card"; +import { cardPreAuthorization } from "./models/cardPreauthorization"; +import { entityBase } from "./models/entityBase"; +import { user } from "./models/user"; +import { payIn } from "./models/payIn"; +import { refund } from "./models/refund"; +import { repudiation } from "./models/repudiation"; +import { client } from "./models/client"; +import { dispute } from "./models/dispute"; +import { settlementTransfer } from "./models/settlementTransfer"; +import { transfer } from "./models/transfer"; +import { shippingAddress } from "./models/shippingAddress"; +import { payOut } from "./models/payOut"; +import { mandate } from "./models/mandate"; +import { hook } from "./models/hook"; +import { report } from "./models/report"; +import { billing } from "./models/billing"; +import { deposit } from "./models/deposit"; +import { birthplace } from "./models/birthplace"; +import { event } from "./models/event"; +import { idempotency } from "./models/idempotency"; +import { securityInfo } from "./models/securityInfo"; +import { shipping } from "./models/shipping"; +import { countryAuthorization } from "./models/countryAuthorization"; +import { Regulatory } from "./services/Regulatory"; +import { Deposits } from "./services/Deposits"; +import { cardValidation } from "./models/cardValidation"; +import { InstantConversions } from "./services/InstantConversions"; export = MangoPay; diff --git a/typings/mangopay2-nodejs-sdk-tests.ts b/typings/mangopay2-nodejs-sdk-tests.ts index 460afaf..30bb358 100644 --- a/typings/mangopay2-nodejs-sdk-tests.ts +++ b/typings/mangopay2-nodejs-sdk-tests.ts @@ -674,6 +674,35 @@ api.PayIns.create({ const d = data; // $ExpectType BlikWebPayInData }); +api.PayIns.create({ + PaymentType: "IDEAL", + ExecutionType: "WEB", + AuthorId: "user-id", + CreditedWalletId: "wallet-id", + Fees: {Amount: 100, Currency: "GBP"}, + DebitedFunds: {Amount: 2000, Currency: "GBP"}, + ReturnURL: "http://test.com", + StatementDescriptor: "Ideal", + Bic: "RBRBNL21", + Tag: "test" +}).then(data => { + const d = data; // $ExpectType IdealWebPayInData +}); + +api.PayIns.create({ + PaymentType: "GIROPAY", + ExecutionType: "WEB", + AuthorId: "user-id", + CreditedWalletId: "wallet-id", + Fees: {Amount: 100, Currency: "GBP"}, + DebitedFunds: {Amount: 2000, Currency: "GBP"}, + ReturnURL: "http://test.com", + StatementDescriptor: "Giropay", + Tag: "test" +}).then(data => { + const d = data; // $ExpectType GiropayWebPayInData +}); + api.PayIns.create({ PaymentType: "CARD", ExecutionType: "WEB", diff --git a/typings/models/instantConversion.d.ts b/typings/models/instantConversion.d.ts index 83c75c6..fe9152d 100644 --- a/typings/models/instantConversion.d.ts +++ b/typings/models/instantConversion.d.ts @@ -1,4 +1,4 @@ -import {entityBase, models, money, transaction} from "mangopay2-nodejs-sdk"; +import { entityBase, models, money, transaction } from "mangopay2-nodejs-sdk"; export namespace instantConversion { import ConversionRate = models.ConversionRate; diff --git a/typings/models/payIn.d.ts b/typings/models/payIn.d.ts index 2e79dd9..4380c3c 100644 --- a/typings/models/payIn.d.ts +++ b/typings/models/payIn.d.ts @@ -33,7 +33,9 @@ export namespace payIn { | SatispayWebPayInData | BlikWebPayInData | GooglePayDirectPayInData - | KlarnaWebPayInData; + | KlarnaWebPayInData + | IdealWebPayInData + | GiropayWebPayInData; type PayInPaymentType = ValueOf; @@ -1749,4 +1751,147 @@ export namespace payIn { */ StatementDescriptor?: string; } + + interface IdealWebPayInData extends BasePayInData { + ExecutionType: "WEB"; + + PaymentType: "IDEAL"; + + /** + * The URL to redirect to user to for them to proceed with the payment + */ + RedirectURL: string; + + /** + * This is the URL where users are automatically redirected after the payment is validated + */ + ReturnURL: string; + + /** + * Name of the end-user’s bank + */ + BankName: string; + + /** + * The BIC identifier of the end-user’s bank + */ + Bic: string; + + /** + * A custom description to appear on the user's bank statement. It can be up to 10 characters long, and can only include alphanumeric + * characters or spaces. See here for important info. Note that each bank handles this information differently, some show less or no information. + */ + StatementDescriptor: string; + } + + interface CreateIdealWebPayIn { + ExecutionType: "WEB"; + + PaymentType: "IDEAL"; + + /** + * A user's ID + */ + AuthorId: string; + + /** + * The ID of the wallet where money will be credited + */ + CreditedWalletId: string; + + /** + * Information about the debited funds + */ + DebitedFunds: MoneyData; + + /** + * Information about the fees taken by the platform for this transaction (and hence transferred to the Fees Wallet) + */ + Fees: MoneyData; + + /** + * This is the URL where users are automatically redirected after the payment is validated + */ + ReturnURL: string; + + /** + * The BIC identifier of the end-user’s bank + */ + Bic: string; + + /** + * A custom description to appear on the user's bank statement. It can be up to 10 characters long, and can only include alphanumeric + * characters or spaces. See here for important info. Note that each bank handles this information differently, some show less or no information. + */ + StatementDescriptor?: string; + + /** + * Custom data that you can add to this object + */ + Tag?: string; + } + + interface GiropayWebPayInData extends BasePayInData { + ExecutionType: "WEB"; + + PaymentType: "GIROPAY"; + + /** + * The URL to redirect to user to for them to proceed with the payment + */ + RedirectURL: string; + + /** + * This is the URL where users are automatically redirected after the payment is validated + */ + ReturnURL: string; + + /** + * A custom description to appear on the user's bank statement. It can be up to 10 characters long, and can only include alphanumeric + * characters or spaces. See here for important info. Note that each bank handles this information differently, some show less or no information. + */ + StatementDescriptor: string; + } + + interface CreateGiropayWebPayIn { + ExecutionType: "WEB"; + + PaymentType: "GIROPAY"; + + /** + * A user's ID + */ + AuthorId: string; + + /** + * The ID of the wallet where money will be credited + */ + CreditedWalletId: string; + + /** + * Information about the debited funds + */ + DebitedFunds: MoneyData; + + /** + * Information about the fees taken by the platform for this transaction (and hence transferred to the Fees Wallet) + */ + Fees: MoneyData; + + /** + * This is the URL where users are automatically redirected after the payment is validated + */ + ReturnURL: string; + + /** + * A custom description to appear on the user's bank statement. It can be up to 10 characters long, and can only include alphanumeric + * characters or spaces. See here for important info. Note that each bank handles this information differently, some show less or no information. + */ + StatementDescriptor?: string; + + /** + * Custom data that you can add to this object + */ + Tag?: string; + } } diff --git a/typings/models/transaction.d.ts b/typings/models/transaction.d.ts index 41a08bb..eebfb8f 100644 --- a/typings/models/transaction.d.ts +++ b/typings/models/transaction.d.ts @@ -1,6 +1,6 @@ -import {Timestamp} from "../types"; -import {entityBase} from "./entityBase"; -import {money} from "./money"; +import { Timestamp } from "../types"; +import { entityBase } from "./entityBase"; +import { money } from "./money"; export namespace transaction { import MoneyData = money.MoneyData; diff --git a/typings/services/InstantConversions.d.ts b/typings/services/InstantConversions.d.ts index 63d30ff..ef1108a 100644 --- a/typings/services/InstantConversions.d.ts +++ b/typings/services/InstantConversions.d.ts @@ -1,6 +1,6 @@ -import {base} from "mangopay2-nodejs-sdk"; -import {conversionRate} from "../models/conversionRate"; -import {instantConversion} from "../models/instantConversion"; +import { base } from "mangopay2-nodejs-sdk"; +import { conversionRate } from "../models/conversionRate"; +import { instantConversion } from "../models/instantConversion"; import MethodOverload = base.MethodOverload; import TwoArgsMethodOverload = base.TwoArgsMethodOverload; diff --git a/typings/services/PayIns.d.ts b/typings/services/PayIns.d.ts index 3ec1d81..633f128 100644 --- a/typings/services/PayIns.d.ts +++ b/typings/services/PayIns.d.ts @@ -23,7 +23,9 @@ export class PayIns { MethodOverload & MethodOverload & MethodOverload & - MethodOverload; + MethodOverload & + MethodOverload & + MethodOverload; /** * Get pay-in diff --git a/typings/types.d.ts b/typings/types.d.ts index c4ecf20..d5da3b4 100644 --- a/typings/types.d.ts +++ b/typings/types.d.ts @@ -165,7 +165,9 @@ export type ApiMethod = | "payins_satispay-web_create" | "payins_blik-web_create" | "payins_googlepay-direct_create_v2" - | "payins_klarna-web_create"; + | "payins_klarna-web_create" + | "payins_ideal-web_create" + | "payins_giropay-web_create"; export type CountryISO = | "AD" From 0fa8751a17ccc6510a723f6b23307b5984784e1b Mon Sep 17 00:00:00 2001 From: Iulian Masar Date: Tue, 10 Oct 2023 09:27:42 +0300 Subject: [PATCH 3/6] instant conversion typings fix --- typings/models/instantConversion.d.ts | 9 ++++++--- typings/services/InstantConversions.d.ts | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/typings/models/instantConversion.d.ts b/typings/models/instantConversion.d.ts index fe9152d..57e504a 100644 --- a/typings/models/instantConversion.d.ts +++ b/typings/models/instantConversion.d.ts @@ -1,11 +1,14 @@ -import { entityBase, models, money, transaction } from "mangopay2-nodejs-sdk"; +import { entityBase } from "./entityBase"; +import { money } from "./money"; +import { transaction } from "./transaction"; +import { conversionRate } from "./conversionRate"; export namespace instantConversion { - import ConversionRate = models.ConversionRate; import TransactionStatus = transaction.TransactionStatus; import TransactionType = transaction.TransactionType; import TransactionNature = transaction.TransactionNature; import MoneyData = money.MoneyData; + import ConversionRateData = conversionRate.ConversionRateData; interface InstantConversionData extends entityBase.EntityBaseData { /** @@ -36,7 +39,7 @@ export namespace instantConversion { /** * Real time indicative market rate of a specific currency pair */ - ConversionRate: ConversionRate; + ConversionRate: ConversionRateData; /** * The status of the transaction. diff --git a/typings/services/InstantConversions.d.ts b/typings/services/InstantConversions.d.ts index ef1108a..f2008d3 100644 --- a/typings/services/InstantConversions.d.ts +++ b/typings/services/InstantConversions.d.ts @@ -1,4 +1,4 @@ -import { base } from "mangopay2-nodejs-sdk"; +import { base } from "../base"; import { conversionRate } from "../models/conversionRate"; import { instantConversion } from "../models/instantConversion"; import MethodOverload = base.MethodOverload; From 67b9649c94f0aa78c3f1985395304c8104d5628b Mon Sep 17 00:00:00 2001 From: Silviana Ghita Date: Wed, 18 Oct 2023 11:31:51 +0300 Subject: [PATCH 4/6] Added reference to the new PayPal implementation --- lib/models/Refund.js | 5 +++-- test/helpers.js | 1 + typings/mangopay2-nodejs-sdk-tests.ts | 1 + typings/models/payIn.d.ts | 4 ++++ 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/models/Refund.js b/lib/models/Refund.js index 168c53a..60b9ed6 100644 --- a/lib/models/Refund.js +++ b/lib/models/Refund.js @@ -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 - } + }; } }); diff --git a/test/helpers.js b/test/helpers.js index cc0fecb..40f60b3 100644 --- a/test/helpers.js +++ b/test/helpers.js @@ -389,6 +389,7 @@ module.exports = { } ], ShippingPreference: "NO_SHIPPING", + Reference: "Reference", Tag: "tag", StatementDescriptor: "test" }; diff --git a/typings/mangopay2-nodejs-sdk-tests.ts b/typings/mangopay2-nodejs-sdk-tests.ts index 460afaf..0a07fd2 100644 --- a/typings/mangopay2-nodejs-sdk-tests.ts +++ b/typings/mangopay2-nodejs-sdk-tests.ts @@ -719,6 +719,7 @@ api.PayIns.createPayPal({ ReturnURL: "http://test.com", Tag: "test tag", StatementDescriptor: "test", + Reference: "Reference", Culture: "FR" }).then(data => { const d = data; // $ExpectType PayPalWebPayInData diff --git a/typings/models/payIn.d.ts b/typings/models/payIn.d.ts index 2e79dd9..8b24875 100644 --- a/typings/models/payIn.d.ts +++ b/typings/models/payIn.d.ts @@ -355,6 +355,8 @@ export namespace payIn { Culture: CountryISO; ShippingPreference: ShippingPreference; + + Reference?: string; } interface MultibancoWebPayInData extends BasePayInData { @@ -581,6 +583,8 @@ export namespace payIn { Culture?: CountryISO; ShippingPreference?: ShippingPreference; + + Reference?: string; } interface CreateMultibancoWebPayIn { From b56132ddef921d4cc132e543d9288cb080afab2b Mon Sep 17 00:00:00 2001 From: Iulian Masar Date: Thu, 2 Nov 2023 11:02:51 +0200 Subject: [PATCH 5/6] small update --- typings/models/payIn.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/typings/models/payIn.d.ts b/typings/models/payIn.d.ts index 8b24875..1877fda 100644 --- a/typings/models/payIn.d.ts +++ b/typings/models/payIn.d.ts @@ -356,7 +356,7 @@ export namespace payIn { ShippingPreference: ShippingPreference; - Reference?: string; + Reference: string; } interface MultibancoWebPayInData extends BasePayInData { From 5edc9a1529558567e59b171d2a779607448f0e4b Mon Sep 17 00:00:00 2001 From: Iulian Masar Date: Thu, 2 Nov 2023 11:39:12 +0200 Subject: [PATCH 6/6] fixed klarna --- lib/models/PayInPaymentDetailsKlarna.js | 2 +- test/helpers.js | 2 +- test/services/PayIns.js | 3 ++- typings/mangopay2-nodejs-sdk-tests.ts | 2 +- typings/models/payIn.d.ts | 4 ++-- typings/models/report.d.ts | 6 +++--- 6 files changed, 10 insertions(+), 9 deletions(-) diff --git a/lib/models/PayInPaymentDetailsKlarna.js b/lib/models/PayInPaymentDetailsKlarna.js index 92e83e7..00e5f7e 100644 --- a/lib/models/PayInPaymentDetailsKlarna.js +++ b/lib/models/PayInPaymentDetailsKlarna.js @@ -17,7 +17,7 @@ var PayInPaymentDetailsKlarna = PayInPaymentDetails.extend({ Email: null, - MerchantOrderId: null, + Reference: null, /** * Custom description to show on the user's bank statement. diff --git a/test/helpers.js b/test/helpers.js index 8852f28..ebee03f 100644 --- a/test/helpers.js +++ b/test/helpers.js @@ -873,7 +873,7 @@ module.exports = { "Country": "US" } }, - MerchantOrderId: "1234", + Reference: "1234", StatementDescriptor: "test", Tag: "test tag" }; diff --git a/test/services/PayIns.js b/test/services/PayIns.js index 41b1c21..cf59d49 100644 --- a/test/services/PayIns.js +++ b/test/services/PayIns.js @@ -1242,7 +1242,8 @@ describe('PayIns', function () { }); }); - describe('GooglePay V2', function () { + // skip because we cannot generate new paymentData in the tests + describe.skip('GooglePay V2', function () { var googlePayIn, wallet; before(function (done) { diff --git a/typings/mangopay2-nodejs-sdk-tests.ts b/typings/mangopay2-nodejs-sdk-tests.ts index 982707f..7467686 100644 --- a/typings/mangopay2-nodejs-sdk-tests.ts +++ b/typings/mangopay2-nodejs-sdk-tests.ts @@ -626,7 +626,7 @@ api.PayIns.create({ PostalCode: "68400" } }, - MerchantOrderId: "1234" + Reference: "1234" }).then(data => { const d = data; // $ExpectType KlarnaWebPayInData }); diff --git a/typings/models/payIn.d.ts b/typings/models/payIn.d.ts index 572ab7d..22dafdb 100644 --- a/typings/models/payIn.d.ts +++ b/typings/models/payIn.d.ts @@ -1659,7 +1659,7 @@ export namespace payIn { /** * The merchant order reference */ - MerchantOrderId: string; + Reference: string; /** * A custom description to appear on the user's bank statement. It can be up to 10 characters long, and can only include alphanumeric @@ -1732,7 +1732,7 @@ export namespace payIn { /** * The merchant order reference */ - MerchantOrderId: string; + Reference: string; /** * Custom data that you can add to this item diff --git a/typings/models/report.d.ts b/typings/models/report.d.ts index 70e11c4..e7d4d62 100644 --- a/typings/models/report.d.ts +++ b/typings/models/report.d.ts @@ -1,6 +1,6 @@ -import {CurrencyISO, PickPartial, Timestamp} from "../types"; -import {transaction} from "./transaction"; -import {entityBase} from "./entityBase"; +import { CurrencyISO, PickPartial, Timestamp } from "../types"; +import { transaction } from "./transaction"; +import { entityBase } from "./entityBase"; export namespace report { type Column =