Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix AccountNotLinedToRequisition Error typo #465

Merged
merged 2 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions src/app-gocardless/app-gocardless.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { inspect } from 'util';

import { goCardlessService } from './services/gocardless-service.js';
import {
AccountNotLinedToRequisition,
AccountNotLinkedToRequisition,
GenericGoCardlessError,
RateLimitError,
RequisitionNotLinked,
Expand Down Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion src/app-gocardless/errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
10 changes: 5 additions & 5 deletions src/app-gocardless/services/gocardless-service.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import BankFactory, { BANKS_WITH_LIMITED_HISTORY } from '../bank-factory.js';
import {
AccessDeniedError,
AccountNotLinedToRequisition,
AccountNotLinkedToRequisition,
GenericGoCardlessError,
InvalidInputDataError,
InvalidGoCardlessTokenError,
Expand Down Expand Up @@ -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}
Expand All @@ -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([
Expand Down Expand Up @@ -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}
Expand All @@ -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({
Expand Down
6 changes: 3 additions & 3 deletions src/app-gocardless/services/tests/gocardless-service.spec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { jest } from '@jest/globals';
import {
AccessDeniedError,
AccountNotLinedToRequisition,
AccountNotLinkedToRequisition,
GenericGoCardlessError,
InvalidInputDataError,
InvalidGoCardlessTokenError,
Expand Down Expand Up @@ -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);
Expand All @@ -227,7 +227,7 @@ describe('goCardlessService', () => {
startDate: undefined,
endDate: undefined,
}),
).rejects.toThrow(AccountNotLinedToRequisition);
).rejects.toThrow(AccountNotLinkedToRequisition);
});
});

Expand Down
6 changes: 6 additions & 0 deletions upcoming-release-notes/465.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
category: Maintenance
authors: [matt-fidd]
---

Fix typo in GoCardless Error type