Skip to content

Commit

Permalink
fix(mizrahi): repaired balance / account number reading (#803)
Browse files Browse the repository at this point in the history
  • Loading branch information
BackSlasher authored Aug 10, 2023
1 parent 2bb533d commit bc841a6
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/scrapers/mizrahi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ interface ScrapedTransactionsResult {
};
body: {
fields: {
AccountNumber: string;
YitraLeloChekim: string;
Yitra: string;
};
table: {
rows: ScrapedTransaction[];
Expand Down Expand Up @@ -212,6 +211,10 @@ class MizrahiScraper extends BaseScraperWithBrowser<ScraperSpecificCredentials>
await waitUntilElementFound(this.page, `a[href*="${TRANSACTIONS_PAGE}"]`);
await this.page.$eval(`a[href*="${TRANSACTIONS_PAGE}"]`, (el) => (el as HTMLElement).click());

const accountNumberElement = (await this.page.$$('#AccountPicker b'))[0];
const accountNumberHandle = await accountNumberElement.getProperty('title');
const accountNumber = ((await accountNumberHandle.jsonValue()) as string);

const response = await Promise.any(TRANSACTIONS_REQUEST_URLS.map(async (url) => {
const request = await this.page.waitForRequest(url);
const data = createDataFromRequest(request, this.options.startDate);
Expand All @@ -236,9 +239,9 @@ class MizrahiScraper extends BaseScraperWithBrowser<ScraperSpecificCredentials>
const allTxn = oshTxnAfterStartDate.concat(pendingTxn);

return {
accountNumber: response.body.fields.AccountNumber,
accountNumber,
txns: allTxn,
balance: +response.body.fields.YitraLeloChekim,
balance: +response.body.fields.Yitra,
};
}
}
Expand Down

0 comments on commit bc841a6

Please sign in to comment.