diff --git a/src/app-gocardless/app-gocardless.js b/src/app-gocardless/app-gocardless.js index 44d92c132..cdba0dca6 100644 --- a/src/app-gocardless/app-gocardless.js +++ b/src/app-gocardless/app-gocardless.js @@ -5,7 +5,7 @@ import { inspect } from 'util'; import { goCardlessService } from './services/gocardless-service.js'; import { - AccountNotLinedToRequisition, + AccountNotLinkedToRequisition, GenericGoCardlessError, RateLimitError, RequisitionNotLinked, @@ -214,7 +214,7 @@ app.post( 'Access to account has expired as set in End User Agreement', }); break; - case error instanceof AccountNotLinedToRequisition: + case error instanceof AccountNotLinkedToRequisition: sendErrorResponse({ error_type: 'INVALID_INPUT', error_code: 'INVALID_ACCESS_TOKEN', diff --git a/src/app-gocardless/errors.js b/src/app-gocardless/errors.js index 820842511..3a77360bf 100644 --- a/src/app-gocardless/errors.js +++ b/src/app-gocardless/errors.js @@ -5,7 +5,7 @@ export class RequisitionNotLinked extends Error { } } -export class AccountNotLinedToRequisition extends Error { +export class AccountNotLinkedToRequisition extends Error { constructor(accountId, requisitionId) { super('Provided account id is not linked to given requisition'); this.details = { diff --git a/src/app-gocardless/services/gocardless-service.js b/src/app-gocardless/services/gocardless-service.js index 41e8f93fe..754e36d11 100644 --- a/src/app-gocardless/services/gocardless-service.js +++ b/src/app-gocardless/services/gocardless-service.js @@ -1,7 +1,7 @@ import BankFactory, { BANKS_WITH_LIMITED_HISTORY } from '../bank-factory.js'; import { AccessDeniedError, - AccountNotLinedToRequisition, + AccountNotLinkedToRequisition, GenericGoCardlessError, InvalidInputDataError, InvalidGoCardlessTokenError, @@ -181,7 +181,7 @@ export const goCardlessService = { * @param accountId * @param startDate * @param endDate - * @throws {AccountNotLinedToRequisition} Will throw an error if requisition not includes provided account id + * @throws {AccountNotLinkedToRequisition} Will throw an error if requisition not includes provided account id * @throws {RequisitionNotLinked} Will throw an error if requisition is not in Linked * @throws {InvalidInputDataError} * @throws {InvalidGoCardlessTokenError} @@ -203,7 +203,7 @@ export const goCardlessService = { await goCardlessService.getLinkedRequisition(requisitionId); if (!accountIds.includes(accountId)) { - throw new AccountNotLinedToRequisition(accountId, requisitionId); + throw new AccountNotLinkedToRequisition(accountId, requisitionId); } const [normalizedTransactions, accountBalance] = await Promise.all([ @@ -239,7 +239,7 @@ export const goCardlessService = { * @param accountId * @param startDate * @param endDate - * @throws {AccountNotLinedToRequisition} Will throw an error if requisition not includes provided account id + * @throws {AccountNotLinkedToRequisition} Will throw an error if requisition not includes provided account id * @throws {RequisitionNotLinked} Will throw an error if requisition is not in Linked * @throws {InvalidInputDataError} * @throws {InvalidGoCardlessTokenError} @@ -261,7 +261,7 @@ export const goCardlessService = { await goCardlessService.getLinkedRequisition(requisitionId); if (!accountIds.includes(accountId)) { - throw new AccountNotLinedToRequisition(accountId, requisitionId); + throw new AccountNotLinkedToRequisition(accountId, requisitionId); } const transactions = await goCardlessService.getTransactions({ diff --git a/src/app-gocardless/services/tests/gocardless-service.spec.js b/src/app-gocardless/services/tests/gocardless-service.spec.js index 043ab5057..40758ac85 100644 --- a/src/app-gocardless/services/tests/gocardless-service.spec.js +++ b/src/app-gocardless/services/tests/gocardless-service.spec.js @@ -1,7 +1,7 @@ import { jest } from '@jest/globals'; import { AccessDeniedError, - AccountNotLinedToRequisition, + AccountNotLinkedToRequisition, GenericGoCardlessError, InvalidInputDataError, InvalidGoCardlessTokenError, @@ -215,7 +215,7 @@ describe('goCardlessService', () => { ); }); - it('throws AccountNotLinedToRequisition error if requisition accounts not includes requested account', async () => { + it('throws AccountNotLinkedToRequisition error if requisition accounts not includes requested account', async () => { jest .spyOn(goCardlessService, 'getLinkedRequisition') .mockResolvedValue(mockRequisition); @@ -227,7 +227,7 @@ describe('goCardlessService', () => { startDate: undefined, endDate: undefined, }), - ).rejects.toThrow(AccountNotLinedToRequisition); + ).rejects.toThrow(AccountNotLinkedToRequisition); }); }); diff --git a/upcoming-release-notes/465.md b/upcoming-release-notes/465.md new file mode 100644 index 000000000..4f955f099 --- /dev/null +++ b/upcoming-release-notes/465.md @@ -0,0 +1,6 @@ +--- +category: Maintenance +authors: [matt-fidd] +--- + +Fix typo in GoCardless Error type