Skip to content
This repository has been archived by the owner on Feb 10, 2025. It is now read-only.

Commit

Permalink
Add support for LHV_LHVBEE22
Browse files Browse the repository at this point in the history
  • Loading branch information
lnagel committed Jan 8, 2025
1 parent 0637b1d commit cf8bbdd
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/app-gocardless/bank-factory.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import IngPlIngbplpw from './banks/ing-pl-ingbplpw.js';
import IntegrationBank from './banks/integration-bank.js';
import IsyBankItbbitmm from './banks/isybank-itbbitmm.js';
import KBCkredbebb from './banks/kbc_kredbebb.js';
import LhvLhvbee22 from './banks/lhv-lhvbee22.js';
import MbankRetailBrexplpw from './banks/mbank-retail-brexplpw.js';
import NationwideNaiaGB21 from './banks/nationwide-naiagb21.js';
import NbgEthngraaxxx from './banks/nbg_ethngraaxxx.js';
Expand Down Expand Up @@ -58,6 +59,7 @@ export const banks = [
IngPlIngbplpw,
IsyBankItbbitmm,
KBCkredbebb,
LhvLhvbee22,
MbankRetailBrexplpw,
NationwideNaiaGB21,
NbgEthngraaxxx,
Expand Down
29 changes: 29 additions & 0 deletions src/app-gocardless/banks/lhv-lhvbee22.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import Fallback from './integration-bank.js';

/** @type {import('./bank.interface.js').IBank} */
export default {
...Fallback,

institutionIds: ['LHV_LHVBEE22'],

accessValidForDays: 90,

normalizeTransaction(transaction, booked) {
// extract bookingDate and creditorName for card transactions, e.g.
// (..1234) 2025-01-02 09:32 CrustumOU\Poordi 3\Tallinn\10156 ESTEST
// bookingDate: 2025-01-02
// creditorName: CrustumOU
const cardTxRegex = /^\(\.\.(\d{4})\) (\d{4}\-\d{2}\-\d{2}) (\d{2}\:\d{2}) (.+)$/g;

Check failure on line 16 in src/app-gocardless/banks/lhv-lhvbee22.js

View workflow job for this annotation

GitHub Actions / lint

Insert `⏎·····`

Check failure on line 16 in src/app-gocardless/banks/lhv-lhvbee22.js

View workflow job for this annotation

GitHub Actions / lint

Unnecessary escape character: \-

Check failure on line 16 in src/app-gocardless/banks/lhv-lhvbee22.js

View workflow job for this annotation

GitHub Actions / lint

Unnecessary escape character: \-

Check failure on line 16 in src/app-gocardless/banks/lhv-lhvbee22.js

View workflow job for this annotation

GitHub Actions / lint

Unnecessary escape character: \:
const cardTxMatch = cardTxRegex.exec(transaction?.remittanceInformationUnstructured);

Check failure on line 17 in src/app-gocardless/banks/lhv-lhvbee22.js

View workflow job for this annotation

GitHub Actions / lint

Replace `transaction?.remittanceInformationUnstructured` with `⏎······transaction?.remittanceInformationUnstructured,⏎····`

if (cardTxMatch) {
transaction = {
...transaction,
bookingDate: cardTxMatch[2],
creditorName: cardTxMatch[4].split('\\')[0].trim(),
};
}

return Fallback.normalizeTransaction(transaction, booked);
},
};

0 comments on commit cf8bbdd

Please sign in to comment.