Skip to content

A local-first personal finance app

🧹 remove unused accountMetadata GoCardless API call on sync (#435)

Matt Fiddaman8d4dbbf5f2d1
diff --git a/src/app-gocardless/app-gocardless.js b/src/app-gocardless/app-gocardless.js
index d59b775c41..ce6f2081f2 100644
--- a/src/app-gocardless/app-gocardless.js
+++ b/src/app-gocardless/app-gocardless.js
@@ -140,7 +140,6 @@ app.post(
try {
const {
- iban,
balances,
institutionId,
startingBalance,
@@ -155,7 +154,6 @@ app.post(
res.send({
status: 'ok',
data: {
- iban: iban ? await sha256String(iban) : null,
balances,
institutionId,
startingBalance,
diff --git a/src/app-gocardless/services/gocardless-service.js b/src/app-gocardless/services/gocardless-service.js
index 7f32578b1f..600fc8ac71 100644
--- a/src/app-gocardless/services/gocardless-service.js
+++ b/src/app-gocardless/services/gocardless-service.js
@@ -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,
@@ -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,
@@ -232,7 +231,6 @@ export const goCardlessService = {
);
return {
- iban: accountMetadata.iban,
balances: accountBalance.balances,
institutionId: institution_id,
startingBalance,
diff --git a/src/app-gocardless/services/tests/gocardless-service.spec.js b/src/app-gocardless/services/tests/gocardless-service.spec.js
index b5293f4fbd..ed7b1b0631 100644
--- a/src/app-gocardless/services/tests/gocardless-service.spec.js
+++ b/src/app-gocardless/services/tests/gocardless-service.spec.js
@@ -168,7 +168,6 @@ describe('goCardlessService', () => {
),
).toEqual(
expect.objectContaining({
- iban: mockAccountMetaData.iban,
balances: mockedBalances.balances,
institutionId: mockRequisition.institution_id,
startingBalance: expect.any(Number),
diff --git a/upcoming-release-notes/435.md b/upcoming-release-notes/435.md
new file mode 100644
index 0000000000..b5a1ba1188
--- /dev/null
+++ b/upcoming-release-notes/435.md
@@ -0,0 +1,6 @@
+---
+category: Maintenance
+authors: [matt-fidd]
+---
+
+Optimise GoCardless sync to reduce API usage by removing accountMetadata call