Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
cca0215
Changes generated by 7a3c6196f72a05753692607d269053508e0a834f
gocardless-ci-robot[bot] Sep 3, 2025
ea6af33
Changes generated by 46a2fc55d7a16685cf6f4286c58684020e6da1a0
gocardless-ci-robot[bot] Sep 4, 2025
0def537
Changes generated by a578593f69c31dc2479d0e5036fa014b4c7d1d5b
gocardless-ci-robot[bot] Sep 5, 2025
298a842
Changes generated by 5a3b0e105421bb577f79e9205908817fc3e908a8
gocardless-ci-robot[bot] Sep 9, 2025
ef9bb71
Changes generated by a37e6ab3c6cf0aeed42a9cd63619ac8b17d73602
gocardless-ci-robot[bot] Sep 10, 2025
9f19d96
Changes generated by 5888a1955dda5f201af0f45e0632e1052aa8f79c
gocardless-ci-robot[bot] Sep 10, 2025
9d4694a
Changes generated by 74059039941e32dbeae98e95a496a8998fadd508
gocardless-ci-robot[bot] Sep 23, 2025
af84c99
Changes generated by f6d6aae005bf7e4054c3269fbb0a063b0e1e4eac
gocardless-ci-robot[bot] Sep 23, 2025
3954073
Changes generated by 4fc976b2c73c1358efa7f19c3735a4d64a26f6c8
gocardless-ci-robot[bot] Sep 25, 2025
1f201c7
Changes generated by c6505ae5049fd7b7603f3f3a9809a8ac33ff81f0
gocardless-ci-robot[bot] Sep 25, 2025
8d9cd41
Changes generated by 52bcd7dd509808071026305a41fb672b4efa07e2
gocardless-ci-robot[bot] Sep 30, 2025
d51345e
Changes generated by 6fa135b118e826ae5f96cc5101cac171fb2857b3
gocardless-ci-robot[bot] Oct 1, 2025
0c1b37a
Changes generated by 1c6190ac597a8a41ed3705d976f1042eced17e93
gocardless-ci-robot[bot] Oct 7, 2025
6ae0acd
Changes generated by 90c6613e5617b656cb7d2d26be1acc4367a9c13d
gocardless-ci-robot[bot] Oct 10, 2025
25075e1
Changes generated by c11d0d526b5ae34ba1f81dc1ffe162629a3829c6
gocardless-ci-robot[bot] Oct 10, 2025
a67f6ef
Changes generated by a448897d40007d935027f2b7275579b3ba86beab
gocardless-ci-robot[bot] Oct 16, 2025
6b755f2
Changes generated by 523ecafbbd7b6fb53f4c4f261a83ae907ab89542
gocardless-ci-robot[bot] Oct 22, 2025
b777a8f
Changes generated by 41dc73dce2b23809e17d8a962cf20e744af77b2e
gocardless-ci-robot[bot] Oct 23, 2025
d55ac28
Changes generated by f8275772af26bb0a606610b1c1ecb4d84b6e3b09
gocardless-ci-robot[bot] Oct 30, 2025
a3e2fb9
Changes generated by 6a8a8779f084c6baf564442952977010f5447147
gocardless-ci-robot[bot] Nov 5, 2025
52da557
Changes generated by 31f300da6730458f79a945461b8e3c788913064b
gocardless-ci-robot[bot] Nov 10, 2025
0f01661
Changes generated by a314d2500b179e5a2c5758cf0be8d09707581442
gocardless-ci-robot[bot] Nov 11, 2025
6cba199
Changes generated by e49d7bc08a139a19dca30fbb21bf3a74b40a1e99
gocardless-ci-robot[bot] Nov 14, 2025
88ffd4b
Changes generated by 77c45b09add27990896e412d1df69d9abeac02a3
gocardless-ci-robot[bot] Nov 19, 2025
df4bf05
Changes generated by f0e171794427f0cb01694a6e2df658053a0041b9
gocardless-ci-robot[bot] Nov 20, 2025
aab6d65
Changes generated by b0907e14c329180a8bfb0ed94191da002e212873
gocardless-ci-robot[bot] Nov 21, 2025
61f8b13
Changes generated by 85522d22acacb4bf5efa45efec8e5bf68b3c3994
gocardless-ci-robot[bot] Nov 24, 2025
25f4fba
Changes generated by 6f974fe41b64e469077cdea28e9575eac4ec333c
gocardless-ci-robot[bot] Nov 25, 2025
e47c93e
Changes generated by 579a01387f0b880e93b4adc80c36397c1d6e8df6
gocardless-ci-robot[bot] Dec 12, 2025
3cf3e48
Changes generated by 5b9b1b3378a21e92c028419caed35f2917278f49
gocardless-ci-robot[bot] Dec 30, 2025
3065525
Changes generated by d03f8d9bdb8ad61b482182c657400f2c7c52a9b7
gocardless-ci-robot[bot] Dec 30, 2025
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ To initialise the client, you must provide:

<!-- prettier-ignore -->
```js
const gocardless = require('gocardless-nodejs');
const gocardless = require('gocardless-nodejs/client');
const constants = require('gocardless-nodejs/constants');


Expand Down
2,631 changes: 1,744 additions & 887 deletions package-lock.json

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gocardless-nodejs",
"version": "6.0.0",
"version": "7.0.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 <client-libraries@gocardless.com>",
"repository": {
Expand All @@ -27,24 +27,24 @@
"dependencies": {
"got": "^11.8.6",
"lodash": "^4.17.21",
"uuid": "^9.0.0",
"uuid": "^11.1.0",
"buffer-equal-constant-time": "1.0.1",
"qs": "^6.11.1"
"qs": "^6.14.0"
},
"devDependencies": {
"@types/jest": "^29.5.0",
"@types/jest": "^30.0.0",
"@types/node": "^18.15.10",
"@typescript-eslint/eslint-plugin": "^5.57.0",
"@typescript-eslint/parser": "^5.57.0",
"eslint": "^8.37.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-prettier": "^4.2.1",
"jest": "^29.5.0",
"jest": "^30.1.3",
"nock": "^13.3.0",
"prettier": "^2.8.7",
"prettier-eslint": "^15.0.1",
"prettier-eslint-cli": "^7.1.0",
"ts-jest": "29.0.5",
"ts-jest": "29.4.1",
"typescript": "^5.0.2"
},
"main": "index.js",
Expand Down
33 changes: 0 additions & 33 deletions src/GoCardlessException.ts

This file was deleted.

6 changes: 3 additions & 3 deletions src/api/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import process = require('process');
import _ = require('lodash');
import { v4 as uuidv4 } from 'uuid';
import * as url from 'url';
import got, { OptionsOfJSONResponseBody } from 'got';
import got, { Agents, OptionsOfJSONResponseBody } from 'got';
import qs from 'qs';

import { Environments, CLIENT_VERSION, API_VERSION } from '../constants';
Expand All @@ -17,7 +17,7 @@ import {
} from '../apiRequestSigning';

export interface APIOptions {
proxy?: object;
proxy?: Agents;
raiseOnIdempotencyConflict?: boolean;
apiRequestSigningOptions?: ApiRequestSigningOptions;
}
Expand All @@ -42,7 +42,7 @@ export class Api {
private _token: string;
private _environment: Environments;
private _baseUrl: string;
private _agent: object;
private _agent: Agents | undefined;
private raiseOnIdempotencyConflict: boolean;
private apiRequestSigningOptions: ApiRequestSigningOptionsInternal | null = null;

Expand Down
33 changes: 33 additions & 0 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Environments } from './constants';
import { Api, APIOptions } from './api/api';
import { BalanceService } from './services/balanceService';
import { BankAccountDetailService } from './services/bankAccountDetailService';
import { BankAccountHolderVerificationService } from './services/bankAccountHolderVerificationService';
import { BankAuthorisationService } from './services/bankAuthorisationService';
import { BankDetailsLookupService } from './services/bankDetailsLookupService';
import { BillingRequestService } from './services/billingRequestService';
Expand Down Expand Up @@ -31,6 +32,8 @@ import { OutboundPaymentService } from './services/outboundPaymentService';
import { PayerAuthorisationService } from './services/payerAuthorisationService';
import { PayerThemeService } from './services/payerThemeService';
import { PaymentService } from './services/paymentService';
import { PaymentAccountService } from './services/paymentAccountService';
import { PaymentAccountTransactionService } from './services/paymentAccountTransactionService';
import { PayoutService } from './services/payoutService';
import { PayoutItemService } from './services/payoutItemService';
import { RedirectFlowService } from './services/redirectFlowService';
Expand All @@ -48,6 +51,7 @@ export class GoCardlessClient {

private _balances: BalanceService;
private _bankAccountDetails: BankAccountDetailService;
private _bankAccountHolderVerifications: BankAccountHolderVerificationService;
private _bankAuthorisations: BankAuthorisationService;
private _bankDetailsLookups: BankDetailsLookupService;
private _billingRequests: BillingRequestService;
Expand Down Expand Up @@ -75,6 +79,8 @@ export class GoCardlessClient {
private _payerAuthorisations: PayerAuthorisationService;
private _payerThemes: PayerThemeService;
private _payments: PaymentService;
private _paymentAccounts: PaymentAccountService;
private _paymentAccountTransactions: PaymentAccountTransactionService;
private _payouts: PayoutService;
private _payoutItems: PayoutItemService;
private _redirectFlows: RedirectFlowService;
Expand All @@ -92,6 +98,7 @@ export class GoCardlessClient {

this._balances = undefined;
this._bankAccountDetails = undefined;
this._bankAccountHolderVerifications = undefined;
this._bankAuthorisations = undefined;
this._bankDetailsLookups = undefined;
this._billingRequests = undefined;
Expand Down Expand Up @@ -119,6 +126,8 @@ export class GoCardlessClient {
this._payerAuthorisations = undefined;
this._payerThemes = undefined;
this._payments = undefined;
this._paymentAccounts = undefined;
this._paymentAccountTransactions = undefined;
this._payouts = undefined;
this._payoutItems = undefined;
this._redirectFlows = undefined;
Expand Down Expand Up @@ -148,6 +157,14 @@ export class GoCardlessClient {
return this._bankAccountDetails;
}

get bankAccountHolderVerifications(): BankAccountHolderVerificationService {
if (!this._bankAccountHolderVerifications) {
this._bankAccountHolderVerifications = new BankAccountHolderVerificationService(this._api);
}

return this._bankAccountHolderVerifications;
}

get bankAuthorisations(): BankAuthorisationService {
if (!this._bankAuthorisations) {
this._bankAuthorisations = new BankAuthorisationService(this._api);
Expand Down Expand Up @@ -364,6 +381,22 @@ export class GoCardlessClient {
return this._payments;
}

get paymentAccounts(): PaymentAccountService {
if (!this._paymentAccounts) {
this._paymentAccounts = new PaymentAccountService(this._api);
}

return this._paymentAccounts;
}

get paymentAccountTransactions(): PaymentAccountTransactionService {
if (!this._paymentAccountTransactions) {
this._paymentAccountTransactions = new PaymentAccountTransactionService(this._api);
}

return this._paymentAccountTransactions;
}

get payouts(): PayoutService {
if (!this._payouts) {
this._payouts = new PayoutService(this._api);
Expand Down
2 changes: 1 addition & 1 deletion src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ enum Environments {
Sandbox = 'SANDBOX',
}

const CLIENT_VERSION = '6.0.0';
const CLIENT_VERSION = '7.0.0';
const API_VERSION = '2015-07-06';

export { Environments, CLIENT_VERSION, API_VERSION };
80 changes: 80 additions & 0 deletions src/services/bankAccountHolderVerificationService.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
'use strict';

import { Api } from '../api/api';
import * as Types from '../types/Types';

interface BankAccountHolderVerificationResponse extends Types.BankAccountHolderVerification, Types.APIResponse {}

interface BankAccountHolderVerificationListResponse extends Types.APIResponse {
bank_account_holder_verifications: Array<Types.BankAccountHolderVerification>;
meta: Types.ListMeta;
}

interface BankAccountHolderVerificationCreateRequest {
// Resources linked to this BankAccountHolderVerification.
links: Types.BankAccountHolderVerificationCreateRequestLinks;

// Type of the verification that has been performed
// eg. [Confirmation of
// Payee](https://www.wearepay.uk/what-we-do/overlay-services/confirmation-of-payee/)

type: Types.BankAccountHolderVerificationType;
}

export class BankAccountHolderVerificationService {
private api: Api;

constructor(api) {
this.api = api;
}

public async create(
requestParameters: BankAccountHolderVerificationCreateRequest,
idempotencyKey = '',
customHeaders: Types.JsonMap = {},
): Promise<BankAccountHolderVerificationResponse> {
const urlParameters = [];
const requestParams = {
path: '/bank_account_holder_verifications',
method: 'post',
urlParameters,
requestParameters,
payloadKey: 'bank_account_holder_verifications',
idempotencyKey,
customHeaders,
fetch: async (identity) => await this.find(identity),
};

const response = await this.api.request(requestParams);
const formattedResponse: BankAccountHolderVerificationResponse = {
...(response.body?.['bank_account_holder_verifications'] ?? response),
__response__: response.__response__,
};

return formattedResponse;
}

public async find(
identity: string,
customHeaders: Types.JsonMap = {},
): Promise<BankAccountHolderVerificationResponse> {
const urlParameters = [{ key: 'identity', value: identity }];
const requestParams = {
path: '/bank_account_holder_verifications/:identity',
method: 'get',
urlParameters,

payloadKey: null,
fetch: null,
customHeaders,
};

const response = await this.api.request(requestParams);
const formattedResponse: BankAccountHolderVerificationResponse = {
...response.body['bank_account_holder_verifications'],
__response__: response.__response__,
};

return formattedResponse;
}
}
7 changes: 4 additions & 3 deletions src/services/billingRequestService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,10 @@ interface BillingRequestCollectCustomerDetailsRequest {
}

interface BillingRequestCollectBankAccountRequest {
// Name of the account holder, as known by the bank. This field will be
// transliterated, upcased and truncated to 18 characters. This field is
// required unless the request includes a [customer bank account
// Name of the account holder, as known by the bank. The full name provided when
// the customer is created is stored and is available via the API, but is
// transliterated, upcased, and truncated to 18 characters in bank submissions.
// This field is required unless the request includes a [customer bank account
// token](#javascript-flow-customer-bank-account-tokens).

account_holder_name?: string;
Expand Down
9 changes: 9 additions & 0 deletions src/services/billingRequestTemplateService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,15 @@ interface BillingRequestTemplateListRequest {
// Number of records to return.

limit?: string;

// (Optional) A scheme used for Open Banking payments. Currently
// `faster_payments` is supported in the UK (GBP) and `sepa_credit_transfer` and
// `sepa_instant_credit_transfer` are supported in supported Eurozone countries
// (EUR). For Eurozone countries, `sepa_credit_transfer` is used as the default.
// Please be aware that `sepa_instant_credit_transfer` may incur an additional
// fee for your customer.

payment_request_scheme?: string;
}

interface BillingRequestTemplateCreateRequest {
Expand Down
7 changes: 4 additions & 3 deletions src/services/customerBankAccountService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ interface CustomerBankAccountListResponse extends Types.APIResponse {
}

interface CustomerBankAccountCreateRequest {
// Name of the account holder, as known by the bank. This field will be
// transliterated, upcased and truncated to 18 characters. This field is
// required unless the request includes a [customer bank account
// Name of the account holder, as known by the bank. The full name provided when
// the customer is created is stored and is available via the API, but is
// transliterated, upcased, and truncated to 18 characters in bank submissions.
// This field is required unless the request includes a [customer bank account
// token](#javascript-flow-customer-bank-account-tokens).

account_holder_name?: string;
Expand Down
4 changes: 2 additions & 2 deletions src/services/instalmentScheduleService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ interface InstalmentScheduleCreateWithDatesRequest {
payment_reference?: string;

// On failure, automatically retry payments using [intelligent
// retries](#success-intelligent-retries). Default is `false`. <p
// retries](/success-plus/overview). Default is `false`. <p
// class="notice"><strong>Important</strong>: To be able to use intelligent
// retries, Success+ needs to be enabled in [GoCardless
// dashboard](https://manage.gocardless.com/success-plus). </p>
Expand Down Expand Up @@ -135,7 +135,7 @@ interface InstalmentScheduleCreateWithScheduleRequest {
payment_reference?: string;

// On failure, automatically retry payments using [intelligent
// retries](#success-intelligent-retries). Default is `false`. <p
// retries](/success-plus/overview). Default is `false`. <p
// class="notice"><strong>Important</strong>: To be able to use intelligent
// retries, Success+ needs to be enabled in [GoCardless
// dashboard](https://manage.gocardless.com/success-plus). </p>
Expand Down
2 changes: 1 addition & 1 deletion src/services/mandateService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ interface MandateListRequest {

scheme?: string[];

// At most four valid status values
// One or more valid statuses

status?: Types.MandateStatus[];
}
Expand Down
Loading