Skip to content
Snippets Groups Projects
Unverified Commit 17fd0689 authored by Matt Fiddaman's avatar Matt Fiddaman Committed by GitHub
Browse files

update synced account balance in db if available (#3452)

parent 4e6a3bba
No related branches found
No related tags found
No related merge requests found
......@@ -54,6 +54,13 @@ function getAccountBalance(account) {
}
}
async function updateAccountBalance(id, balance) {
await db.runQuery('UPDATE accounts SET balance_current = ? WHERE id = ?', [
amountToInteger(balance),
id,
]);
}
export async function getGoCardlessAccounts(userId, userKey, id) {
const userToken = await asyncStorage.getItem('user-token');
if (!userToken) return;
......@@ -694,7 +701,7 @@ export async function syncAccount(
);
}
const { transactions: originalTransactions } = download;
const { transactions: originalTransactions, accountBalance } = download;
if (originalTransactions.length === 0) {
return { added: [], updated: [] };
......@@ -713,6 +720,8 @@ export async function syncAccount(
useStrictIdChecking,
);
if (accountBalance) await updateAccountBalance(id, accountBalance);
return result;
});
} else {
......
---
category: Maintenance
authors: [matt-fidd]
---
Update synced account balance in db if available
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment