Skip to content

Commit

Permalink
🧹 remove unused accountMetadata GoCardless API call on sync (actualbu…
Browse files Browse the repository at this point in the history
  • Loading branch information
matt-fidd authored Aug 19, 2024
1 parent b8d2797 commit 8d4dbbf
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
2 changes: 0 additions & 2 deletions src/app-gocardless/app-gocardless.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ app.post(

try {
const {
iban,
balances,
institutionId,
startingBalance,
Expand All @@ -155,7 +154,6 @@ app.post(
res.send({
status: 'ok',
data: {
iban: iban ? await sha256String(iban) : null,
balances,
institutionId,
startingBalance,
Expand Down
6 changes: 2 additions & 4 deletions src/app-gocardless/services/gocardless-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ export const goCardlessService = {
* @throws {RateLimitError}
* @throws {UnknownError}
* @throws {ServiceError}
* @returns {Promise<{iban: string, balances: Array<import('../gocardless-node.types.js').Balance>, institutionId: string, transactions: {booked: Array<import('../gocardless-node.types.js').Transaction>, pending: Array<import('../gocardless-node.types.js').Transaction>, all: Array<import('../gocardless.types.js').TransactionWithBookedStatus>}, startingBalance: number}>}
* @returns {Promise<{balances: Array<import('../gocardless-node.types.js').Balance>, institutionId: string, transactions: {booked: Array<import('../gocardless-node.types.js').Transaction>, pending: Array<import('../gocardless-node.types.js').Transaction>, all: Array<import('../gocardless.types.js').TransactionWithBookedStatus>}, startingBalance: number}>}
*/
getTransactionsWithBalance: async (
requisitionId,
Expand All @@ -200,8 +200,7 @@ export const goCardlessService = {
throw new AccountNotLinedToRequisition(accountId, requisitionId);
}

const [accountMetadata, transactions, accountBalance] = await Promise.all([
goCardlessService.getAccountMetadata(accountId),
const [transactions, accountBalance] = await Promise.all([
goCardlessService.getTransactions({
institutionId: institution_id,
accountId,
Expand Down Expand Up @@ -232,7 +231,6 @@ export const goCardlessService = {
);

return {
iban: accountMetadata.iban,
balances: accountBalance.balances,
institutionId: institution_id,
startingBalance,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@ describe('goCardlessService', () => {
),
).toEqual(
expect.objectContaining({
iban: mockAccountMetaData.iban,
balances: mockedBalances.balances,
institutionId: mockRequisition.institution_id,
startingBalance: expect.any(Number),
Expand Down
6 changes: 6 additions & 0 deletions upcoming-release-notes/435.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
category: Maintenance
authors: [matt-fidd]
---

Optimise GoCardless sync to reduce API usage by removing accountMetadata call

0 comments on commit 8d4dbbf

Please sign in to comment.