diff --git a/packages/loot-core/src/server/accounts/sync.ts b/packages/loot-core/src/server/accounts/sync.ts index c7709c728de2913cec02e413e8a0719127712e00..494759b727880da9cb2e6910ebeb46e222c40411 100644 --- a/packages/loot-core/src/server/accounts/sync.ts +++ b/packages/loot-core/src/server/accounts/sync.ts @@ -185,6 +185,8 @@ async function downloadGoCardlessTransactions( const userToken = await asyncStorage.getItem('user-token'); if (!userToken) return; + console.log('Pulling transactions from GoCardless'); + const res = await post( getServer().GOCARDLESS_SERVER + '/transactions', { @@ -209,6 +211,8 @@ async function downloadGoCardlessTransactions( startingBalance, } = res; + console.log('Response:', res); + return { transactions: all, accountBalance: balances, @@ -220,6 +224,8 @@ async function downloadSimpleFinTransactions(acctId, since) { const userToken = await asyncStorage.getItem('user-token'); if (!userToken) return; + console.log('Pulling transactions from SimpleFin'); + const res = await post( getServer().SIMPLEFIN_SERVER + '/transactions', { @@ -241,6 +247,8 @@ async function downloadSimpleFinTransactions(acctId, since) { startingBalance, } = res; + console.log('Response:', res); + return { transactions: all, accountBalance: balances, @@ -430,6 +438,8 @@ async function createNewPayees(payeesToCreate, addsAndUpdates) { } export async function reconcileExternalTransactions(acctId, transactions) { + console.log('Performing transaction reconciliation'); + const hasMatched = new Set(); const updated = []; const added = []; @@ -606,6 +616,14 @@ export async function reconcileExternalTransactions(acctId, transactions) { await createNewPayees(payeesToCreate, [...added, ...updated]); await batchUpdateTransactions({ added, updated }); + console.log('Debug data for the operations:', { + transactionsStep1, + transactionsStep2, + transactionsStep3, + added, + updated, + }); + return { added: added.map(trans => trans.id), updated: updated.map(trans => trans.id), diff --git a/packages/loot-core/src/server/main.ts b/packages/loot-core/src/server/main.ts index b5e3c0d49ad19aa1c7143e6ae12d0bb3afec1c52..0cc70892db34d790951be35546b77f6ed26cb244 100644 --- a/packages/loot-core/src/server/main.ts +++ b/packages/loot-core/src/server/main.ts @@ -1287,6 +1287,7 @@ handlers['gocardless-accounts-sync'] = async function ({ id }) { const acct = accounts[i]; if (acct.bankId) { try { + console.group('Bank Sync operation'); const res = await bankSync.syncExternalAccount( userId, userKey, @@ -1294,6 +1295,8 @@ handlers['gocardless-accounts-sync'] = async function ({ id }) { acct.account_id, acct.bankId, ); + console.groupEnd(); + const { added, updated } = res; newTransactions = newTransactions.concat(added); diff --git a/upcoming-release-notes/2529.md b/upcoming-release-notes/2529.md new file mode 100644 index 0000000000000000000000000000000000000000..9672c40f220b9aeb3dab8773b4183609c57e3571 --- /dev/null +++ b/upcoming-release-notes/2529.md @@ -0,0 +1,6 @@ +--- +category: Maintenance +authors: [MatissJanis] +--- + +Adding extra `console.log` lines to the bank-sync operation to improve troubleshooting