From 0e87c1a5d6f184a75cd39ae2496eda2ea260d962 Mon Sep 17 00:00:00 2001 From: Robot Date: Wed, 10 Jan 2024 09:42:45 +0000 Subject: [PATCH] Changes generated by 0e9445b5f93a5cc201b59bf9fab14b79aac6c184 --- package-lock.json | 118 +++++++++++----------- package.json | 2 +- src/client.ts | 11 ++ src/constants.ts | 2 +- src/services/bankDetailsLookupService.ts | 6 ++ src/services/billingRequestFlowService.ts | 4 + src/services/billingRequestService.ts | 5 + src/services/paymentService.ts | 7 ++ src/services/transferredMandateService.ts | 41 ++++++++ src/types/Types.ts | 45 +++++++++ 10 files changed, 180 insertions(+), 61 deletions(-) create mode 100644 src/services/transferredMandateService.ts diff --git a/package-lock.json b/package-lock.json index f2b00d1..8011718 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "gocardless-nodejs", - "version": "3.19.0", + "version": "3.20.0", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -83,21 +83,21 @@ "dev": true }, "@babel/core": { - "version": "7.23.5", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.23.5.tgz", - "integrity": "sha512-Cwc2XjUrG4ilcfOw4wBAK+enbdgwAcAJCfGUItPBKR7Mjw4aEfAFYrLxeRp4jWgtNIKn3n2AlBOfwwafl+42/g==", + "version": "7.23.7", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.23.7.tgz", + "integrity": "sha512-+UpDgowcmqe36d4NwqvKsyPMlOLNGMsfMmQ5WGCu+siCe3t3dfe9njrzGfdN4qq+bcNUt0+Vw6haRxBOycs4dw==", "dev": true, "requires": { "@ampproject/remapping": "^2.2.0", "@babel/code-frame": "^7.23.5", - "@babel/generator": "^7.23.5", - "@babel/helper-compilation-targets": "^7.22.15", + "@babel/generator": "^7.23.6", + "@babel/helper-compilation-targets": "^7.23.6", "@babel/helper-module-transforms": "^7.23.3", - "@babel/helpers": "^7.23.5", - "@babel/parser": "^7.23.5", + "@babel/helpers": "^7.23.7", + "@babel/parser": "^7.23.6", "@babel/template": "^7.22.15", - "@babel/traverse": "^7.23.5", - "@babel/types": "^7.23.5", + "@babel/traverse": "^7.23.7", + "@babel/types": "^7.23.6", "convert-source-map": "^2.0.0", "debug": "^4.1.0", "gensync": "^1.0.0-beta.2", @@ -114,26 +114,26 @@ } }, "@babel/generator": { - "version": "7.23.5", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.23.5.tgz", - "integrity": "sha512-BPssCHrBD+0YrxviOa3QzpqwhNIXKEtOa2jQrm4FlmkC2apYgRnQcmPWiGZDlGxiNtltnUFolMe8497Esry+jA==", + "version": "7.23.6", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.23.6.tgz", + "integrity": "sha512-qrSfCYxYQB5owCmGLbl8XRpX1ytXlpueOb0N0UmQwA073KZxejgQTzAmJezxvpwQD9uGtK2shHdi55QT+MbjIw==", "dev": true, "requires": { - "@babel/types": "^7.23.5", + "@babel/types": "^7.23.6", "@jridgewell/gen-mapping": "^0.3.2", "@jridgewell/trace-mapping": "^0.3.17", "jsesc": "^2.5.1" } }, "@babel/helper-compilation-targets": { - "version": "7.22.15", - "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.22.15.tgz", - "integrity": "sha512-y6EEzULok0Qvz8yyLkCvVX+02ic+By2UdOhylwUOvOn9dvYc9mKICJuuU1n1XBI02YWsNsnrY1kc6DVbjcXbtw==", + "version": "7.23.6", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.23.6.tgz", + "integrity": "sha512-9JB548GZoQVmzrFgp8o7KxdgkTGm6xs9DW0o/Pim72UDjzr5ObUQ6ZzYPqA+g9OTS2bBQoctLJrky0RDCAWRgQ==", "dev": true, "requires": { - "@babel/compat-data": "^7.22.9", - "@babel/helper-validator-option": "^7.22.15", - "browserslist": "^4.21.9", + "@babel/compat-data": "^7.23.5", + "@babel/helper-validator-option": "^7.23.5", + "browserslist": "^4.22.2", "lru-cache": "^5.1.1", "semver": "^6.3.1" } @@ -228,14 +228,14 @@ "dev": true }, "@babel/helpers": { - "version": "7.23.5", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.23.5.tgz", - "integrity": "sha512-oO7us8FzTEsG3U6ag9MfdF1iA/7Z6dz+MtFhifZk8C8o453rGJFFWUP1t+ULM9TUIAzC9uxXEiXjOiVMyd7QPg==", + "version": "7.23.8", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.23.8.tgz", + "integrity": "sha512-KDqYz4PiOWvDFrdHLPhKtCThtIcKVy6avWD2oG4GEvyQ+XDZwHD4YQd+H2vNMnq2rkdxsDkU82T+Vk8U/WXHRQ==", "dev": true, "requires": { "@babel/template": "^7.22.15", - "@babel/traverse": "^7.23.5", - "@babel/types": "^7.23.5" + "@babel/traverse": "^7.23.7", + "@babel/types": "^7.23.6" } }, "@babel/highlight": { @@ -302,9 +302,9 @@ } }, "@babel/parser": { - "version": "7.23.5", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.23.5.tgz", - "integrity": "sha512-hOOqoiNXrmGdFbhgCzu6GiURxUgM27Xwd/aPuu8RfHEZPBzL1Z54okAHAQjXfcQNwvrlkAmAp4SlRTZ45vlthQ==", + "version": "7.23.6", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.23.6.tgz", + "integrity": "sha512-Z2uID7YJ7oNvAI20O9X0bblw7Qqs8Q2hFy0R9tAfnfLkp5MW0UH9eUvnDSnFwKZ0AvgS1ucqR4KzvVHgnke1VQ==", "dev": true }, "@babel/plugin-syntax-async-generators": { @@ -418,27 +418,27 @@ } }, "@babel/traverse": { - "version": "7.23.5", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.23.5.tgz", - "integrity": "sha512-czx7Xy5a6sapWWRx61m1Ke1Ra4vczu1mCTtJam5zRTBOonfdJ+S/B6HYmGYu3fJtr8GGET3si6IhgWVBhJ/m8w==", + "version": "7.23.7", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.23.7.tgz", + "integrity": "sha512-tY3mM8rH9jM0YHFGyfC0/xf+SB5eKUu7HPj7/k3fpi9dAlsMc5YbQvDi0Sh2QTPXqMhyaAtzAr807TIyfQrmyg==", "dev": true, "requires": { "@babel/code-frame": "^7.23.5", - "@babel/generator": "^7.23.5", + "@babel/generator": "^7.23.6", "@babel/helper-environment-visitor": "^7.22.20", "@babel/helper-function-name": "^7.23.0", "@babel/helper-hoist-variables": "^7.22.5", "@babel/helper-split-export-declaration": "^7.22.6", - "@babel/parser": "^7.23.5", - "@babel/types": "^7.23.5", - "debug": "^4.1.0", + "@babel/parser": "^7.23.6", + "@babel/types": "^7.23.6", + "debug": "^4.3.1", "globals": "^11.1.0" } }, "@babel/types": { - "version": "7.23.5", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.23.5.tgz", - "integrity": "sha512-ON5kSOJwVO6xXVRTvOI0eOnWe7VdUcIpsovGo9U/Br4Ie4UVFQTboO2cYnDhAGU6Fp+UxSiT+pMft0SMHfuq6w==", + "version": "7.23.6", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.23.6.tgz", + "integrity": "sha512-+uarb83brBzPKN38NX1MkB6vb6+mwvR6amUulqAE7ccQw1pEl+bCia9TbdG1lsnFP7lZySvUn37CHyXQdfTwzg==", "dev": true, "requires": { "@babel/helper-string-parser": "^7.23.4", @@ -745,9 +745,9 @@ } }, "@types/babel__generator": { - "version": "7.6.7", - "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.6.7.tgz", - "integrity": "sha512-6Sfsq+EaaLrw4RmdFWE9Onp63TOUue71AWb4Gpa6JxzgTYtimbM086WnYTy2U67AofR++QKCo08ZP6pwx8YFHQ==", + "version": "7.6.8", + "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.6.8.tgz", + "integrity": "sha512-ASsj+tpEDsEiFr1arWrlN6V3mdfjRMZt6LtK/Vp/kreFLnr5QH5+DhvD5nINYZXzwJvXeGq+05iUXcAzVrqWtw==", "dev": true, "requires": { "@babel/types": "^7.0.0" @@ -764,9 +764,9 @@ } }, "@types/babel__traverse": { - "version": "7.20.4", - "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.20.4.tgz", - "integrity": "sha512-mSM/iKUk5fDDrEV/e83qY+Cr3I1+Q3qqTuEn++HAWYjEa1+NxZr6CNrcJGf2ZTnq4HoFGC3zaTPZTobCzCFukA==", + "version": "7.20.5", + "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.20.5.tgz", + "integrity": "sha512-WXCyOcRtH37HAUkpXhUduaxdm82b4GSlyTqajXviN4EfiuPgNYR109xMCKvpl6zPIpua0DGlMEDCq+g8EdoheQ==", "dev": true, "requires": { "@babel/types": "^7.20.7" @@ -784,9 +784,9 @@ }, "dependencies": { "@types/node": { - "version": "20.10.4", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.4.tgz", - "integrity": "sha512-D08YG6rr8X90YB56tSIuBaddy/UXAA9RKJoFvrsnogAum/0pmjkgi4+2nx96A330FmioegBWmEYQ+syqCFaveg==", + "version": "20.10.8", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.8.tgz", + "integrity": "sha512-f8nQs3cLxbAFc00vEU59yf9UyGUftkPaLGfvbVOIDdx2i1b8epBqj2aNGyP19fiyXWvlmZ7qC1XLjAzw/OKIeA==", "requires": { "undici-types": "~5.26.4" } @@ -851,9 +851,9 @@ }, "dependencies": { "@types/node": { - "version": "20.10.4", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.4.tgz", - "integrity": "sha512-D08YG6rr8X90YB56tSIuBaddy/UXAA9RKJoFvrsnogAum/0pmjkgi4+2nx96A330FmioegBWmEYQ+syqCFaveg==", + "version": "20.10.8", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.8.tgz", + "integrity": "sha512-f8nQs3cLxbAFc00vEU59yf9UyGUftkPaLGfvbVOIDdx2i1b8epBqj2aNGyP19fiyXWvlmZ7qC1XLjAzw/OKIeA==", "requires": { "undici-types": "~5.26.4" } @@ -896,9 +896,9 @@ }, "dependencies": { "@types/node": { - "version": "20.10.4", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.4.tgz", - "integrity": "sha512-D08YG6rr8X90YB56tSIuBaddy/UXAA9RKJoFvrsnogAum/0pmjkgi4+2nx96A330FmioegBWmEYQ+syqCFaveg==", + "version": "20.10.8", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.8.tgz", + "integrity": "sha512-f8nQs3cLxbAFc00vEU59yf9UyGUftkPaLGfvbVOIDdx2i1b8epBqj2aNGyP19fiyXWvlmZ7qC1XLjAzw/OKIeA==", "requires": { "undici-types": "~5.26.4" } @@ -1383,9 +1383,9 @@ "dev": true }, "caniuse-lite": { - "version": "1.0.30001566", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001566.tgz", - "integrity": "sha512-ggIhCsTxmITBAMmK8yZjEhCO5/47jKXPu6Dha/wuCS4JePVL+3uiDEBuhu2aIoT+bqTOR8L76Ip1ARL9xYsEJA==", + "version": "1.0.30001576", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001576.tgz", + "integrity": "sha512-ff5BdakGe2P3SQsMsiqmt1Lc8221NR1VzHj5jXN5vBny9A6fpze94HiVV/n7XRosOlsShJcvMv5mdnpjOGCEgg==", "dev": true }, "capture-exit": { @@ -1738,9 +1738,9 @@ } }, "electron-to-chromium": { - "version": "1.4.608", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.608.tgz", - "integrity": "sha512-J2f/3iIIm3Mo0npneITZ2UPe4B1bg8fTNrFjD8715F/k1BvbviRuqYGkET1PgprrczXYTHFvotbBOmUp6KE0uA==", + "version": "1.4.626", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.626.tgz", + "integrity": "sha512-f7/be56VjRRQk+Ric6PmIrEtPcIqsn3tElyAu9Sh6egha2VLJ82qwkcOdcnT06W+Pb6RUulV1ckzrGbKzVcTHg==", "dev": true }, "emoji-regex": { diff --git a/package.json b/package.json index 348cb7b..3f1b624 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gocardless-nodejs", - "version": "3.19.0", + "version": "3.20.0", "description": "Node.js client for the GoCardless API - a powerful, simple solution for the collection of recurring bank-to-bank payments", "author": "GoCardless Ltd ", "repository": { diff --git a/src/client.ts b/src/client.ts index 45bc830..4091fbd 100644 --- a/src/client.ts +++ b/src/client.ts @@ -32,6 +32,7 @@ import { ScenarioSimulatorService } from './services/scenarioSimulatorService'; import { SchemeIdentifierService } from './services/schemeIdentifierService'; import { SubscriptionService } from './services/subscriptionService'; import { TaxRateService } from './services/taxRateService'; +import { TransferredMandateService } from './services/transferredMandateService'; import { VerificationDetailService } from './services/verificationDetailService'; import { WebhookService } from './services/webhookService'; @@ -68,6 +69,7 @@ export class GoCardlessClient { private _schemeIdentifiers: SchemeIdentifierService; private _subscriptions: SubscriptionService; private _taxRates: TaxRateService; + private _transferredMandates: TransferredMandateService; private _verificationDetails: VerificationDetailService; private _webhooks: WebhookService; @@ -104,6 +106,7 @@ export class GoCardlessClient { this._schemeIdentifiers = undefined; this._subscriptions = undefined; this._taxRates = undefined; + this._transferredMandates = undefined; this._verificationDetails = undefined; this._webhooks = undefined; } @@ -350,6 +353,14 @@ export class GoCardlessClient { return this._taxRates; } + get transferredMandates(): TransferredMandateService { + if (!this._transferredMandates) { + this._transferredMandates = new TransferredMandateService(this._api); + } + + return this._transferredMandates; + } + get verificationDetails(): VerificationDetailService { if (!this._verificationDetails) { this._verificationDetails = new VerificationDetailService(this._api); diff --git a/src/constants.ts b/src/constants.ts index 59ec73b..5f90866 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -5,7 +5,7 @@ enum Environments { Sandbox = 'SANDBOX', } -const CLIENT_VERSION = '3.19.0'; +const CLIENT_VERSION = '3.20.0'; const API_VERSION = '2015-07-06'; export { Environments, CLIENT_VERSION, API_VERSION }; diff --git a/src/services/bankDetailsLookupService.ts b/src/services/bankDetailsLookupService.ts index 7d1ceb1..f42cf8d 100644 --- a/src/services/bankDetailsLookupService.ts +++ b/src/services/bankDetailsLookupService.ts @@ -13,6 +13,12 @@ interface BankDetailsLookupListResponse extends Types.APIResponse { } interface BankDetailsLookupCreateRequest { + // The account holder name associated with the account number (if available). If + // provided and the country code is GB, a payer name verification will be + // performed. + + account_holder_name?: string; + // Bank account number - see [local details](#appendix-local-bank-details) for // more information. Alternatively you can provide an `iban`. diff --git a/src/services/billingRequestFlowService.ts b/src/services/billingRequestFlowService.ts index ebd7fdc..79bf289 100644 --- a/src/services/billingRequestFlowService.ts +++ b/src/services/billingRequestFlowService.ts @@ -18,6 +18,10 @@ interface BillingRequestFlowCreateRequest { auto_fulfil?: boolean; + // Identifies whether a Billing Request belongs to a specific customer + + customer_details_captured?: boolean; + // URL that the payer can be taken to if there isn't a way to progress ahead in // flow. diff --git a/src/services/billingRequestService.ts b/src/services/billingRequestService.ts index 800268e..a0b9667 100644 --- a/src/services/billingRequestService.ts +++ b/src/services/billingRequestService.ts @@ -113,6 +113,11 @@ interface BillingRequestCollectBankAccountRequest { // to 50 characters and values up to 500 characters. metadata?: Types.JsonMap; + + // A unique record such as an email address, mobile number or company number, + // that can be used to make and accept payments. + + pay_id?: string; } interface BillingRequestConfirmPayerDetailsRequest { diff --git a/src/services/paymentService.ts b/src/services/paymentService.ts index de9354c..4f95ec0 100644 --- a/src/services/paymentService.ts +++ b/src/services/paymentService.ts @@ -42,6 +42,13 @@ interface PaymentCreateRequest { description?: string; + // Set this to true or false in the request to create an ACH payment to + // explicitly choose whether the payment should be processed through Faster + // ACH or standard ACH, rather than relying on the presence or absence of the + // charge date to indicate that. + + faster_ach?: boolean; + // Resources linked to this Payment. links: Types.PaymentCreateRequestLinks; diff --git a/src/services/transferredMandateService.ts b/src/services/transferredMandateService.ts new file mode 100644 index 0000000..38d6c5c --- /dev/null +++ b/src/services/transferredMandateService.ts @@ -0,0 +1,41 @@ +'use strict'; + +import { Api } from '../api/api'; +import * as Types from '../types/Types'; + +interface TransferredMandateResponse + extends Types.TransferredMandate, + Types.APIResponse {} + +interface TransferredMandateListResponse extends Types.APIResponse { + transferred_mandates: Types.TransferredMandate[]; + meta: Types.ListMeta; +} + +export class TransferredMandateService { + private api: Api; + + constructor(api) { + this.api = api; + } + + async find(identity: string): Promise { + const urlParameters = [{ key: 'identity', value: identity }]; + const requestParams = { + path: '/transferred_mandates/:identity', + method: 'get', + urlParameters, + + payloadKey: null, + fetch: null, + }; + + const response = await this.api.request(requestParams); + const formattedResponse: TransferredMandateResponse = { + ...response.body['transferred_mandates'], + __response__: response.__response__, + }; + + return formattedResponse; + } +} diff --git a/src/types/Types.ts b/src/types/Types.ts index 7846671..5663dea 100644 --- a/src/types/Types.ts +++ b/src/types/Types.ts @@ -846,6 +846,9 @@ export interface BillingRequestFlow { // Timestamp when the flow was created created_at?: string; + // Identifies whether a Billing Request belongs to a specific customer + customer_details_captured?: boolean; + // URL that the payer can be taken to if there isn't a way to progress ahead // in flow. exit_uri?: string | null; @@ -2327,6 +2330,13 @@ export interface Mandate { // payment for this mandate. This value will change over time. next_possible_charge_date?: string | null; + // If this is an an ACH mandate, the earliest date that can be used as a + // `charge_date` on any newly created payment to be charged through standard + // ACH, rather than Faster ACH. This value will change over time. + // + // It is only present in the API response for ACH mandates. + next_possible_standard_ach_charge_date?: string | null; + // Boolean value showing whether payments and subscriptions under this mandate // require approval via an automated email before being processed. payments_require_approval?: boolean; @@ -3046,6 +3056,12 @@ export interface Payment { // requirements](#appendix-compliance-requirements)). description?: string | null; + // This field indicates whether the ACH payment is processed through Faster + // ACH or standard ACH. + // + // It is only present in the API response for ACH payments. + faster_ach?: boolean | null; + // fx?: PaymentFx; @@ -4319,6 +4335,35 @@ export interface TaxRate { type?: string; } +/** Type for a transferredmandate resource. */ +export interface TransferredMandate { + // Encrypted customer bank account details, containing: + // `iban`, `account_holder_name`, `swift_bank_code`, `swift_branch_code`, + // `swift_account_number` + encrypted_customer_bank_details?: string; + + // Random AES-256 key used to encrypt bank account details, itself encrypted + // with your public key. + encrypted_decryption_key?: string; + + // Resources linked to this TransferredMandate. + links?: TransferredMandateLinks; + + // The ID of an RSA-2048 public key, from your JWKS, used to encrypt the AES + // key. + public_key_id?: string; +} + +/** Type for a transferredmandatelinks resource. */ +export interface TransferredMandateLinks { + // The ID of the updated + // [customer_bank_account](#core-endpoints-customer-bank-accounts) + customer_bank_account?: string; + + // The ID of the transferred mandate + mandate?: string; +} + /** Type for a verificationdetail resource. */ export interface VerificationDetail { // The first line of the company's address.