Skip to content

Commit

Permalink
feat: Added account balance to discount (#587)
Browse files Browse the repository at this point in the history
* Added account balance to discount scraper

* Added account balance to discount scraper

Co-authored-by: Shai Cohen <[email protected]>
  • Loading branch information
RebliNk17 and Shai Cohen authored Jul 10, 2021
1 parent a8343f5 commit df01263
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/scrapers/discount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ interface ScrapedTransaction {
OperationDescriptionToDisplay: string;
}

interface CurrentAccountInfo {
AccountBalance: number;
}

interface ScrapedAccountData {
UserAccountsData: {
DefaultAccountNumber: string;
Expand All @@ -34,6 +38,7 @@ interface ScrapedTransactionData {
Error?: { MsgText: string };
CurrentAccountLastTransactions?: {
OperationEntry: ScrapedTransaction[];
CurrentAccountInfo: CurrentAccountInfo;
};
}

Expand Down Expand Up @@ -99,6 +104,7 @@ async function fetchAccountData(page: Page, options: ScaperOptions): Promise<Sca
success: true,
accounts: [{
accountNumber,
balance: txnsResult.CurrentAccountLastTransactions.CurrentAccountInfo.AccountBalance,
txns: [...completedTxns, ...pendingTxns],
}],
};
Expand Down
1 change: 1 addition & 0 deletions src/tests/tests-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export function exportTransactions(fileName: string, accounts: TransactionsAccou
...account.txns.map((txn) => {
return {
account: account.accountNumber,
balance: account.balance,
...txn,
date: moment(txn.date).format('DD/MM/YYYY'),
processedDate: moment(txn.processedDate).format('DD/MM/YYYY'),
Expand Down

0 comments on commit df01263

Please sign in to comment.