eshaham / israeli-bank-scrapers

Provide scrapers for all major Israeli banks and credit card companies
MIT License
567 stars 152 forks source link

[Max] Add currency pocket support #832

Closed daniel-hauser closed 5 months ago

daniel-hauser commented 5 months ago

Problem

Max's new currency pocket / ארנק מטח feature added a new planType, causing the scraper to fail with the following message:

Unknown transaction type חיוב ארנק מטח

Solution

This PR adds the missing plan type to getTransactionType, as well as a fallback using the planTypeId field (for future new plans).

planTypeId

When looking on the transactions from my account we can see that plans 2 is Installment, and 5 is Normal

Array.from(new Set(rawTransactions.map(t => [t.planName, t.planTypeId].join(':'))))
[
    "רגילה:5",
    "חיוב עסקות מיידי:5",
    "תשלומים:2",
    "חיוב חודשי:5",
    "חיוב ארנק מטח:5"
]

Looking at the code in max, we can see that 2 and 3 are treated the same

<li *ngIf="
        (transaction.planTypeId === 2 || transaction.planTypeId === 3) &&
        transaction.dealData.amountLeft
    ">
    יתרה לתשלום:
    <span class="ltr-sum">
        {{
        transaction.dealData.amountLeft | maxCurrency: transaction.paymentCurrency
        }}
    </span>
</li>

Other changes

With this change, i also:

github-actions[bot] commented 3 months ago

:tada: This PR is included in version 4.3.0 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket: