Skip to content

Commit

Permalink
fix: remove filtering from merge transactions
Browse files Browse the repository at this point in the history
  • Loading branch information
pavanjoshi914 committed Jan 15, 2025
1 parent 82c6078 commit 1784673
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/common/utils/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,19 +63,13 @@ export async function poll<T>({
return new Promise(executePoll);
}

function hasSettleDate(
transaction: ConnectorTransaction
): transaction is ConnectorTransaction & { settleDate: number } {
return transaction.settleDate !== null;
}

export function mergeTransactions(
invoices: ConnectorTransaction[],
payments: ConnectorTransaction[]
): ConnectorTransaction[] {
const mergedTransactions = [...invoices, ...payments]
.filter(hasSettleDate)
.sort((a, b) => b.settleDate - a.settleDate);
const mergedTransactions = [...invoices, ...payments].sort((a, b) => {
return (b.settleDate ?? 0) - (a.settleDate ?? 0);
});

return mergedTransactions;
}

0 comments on commit 1784673

Please sign in to comment.