Skip to content

Commit

Permalink
✨ add bank adapter for BOI (#539)
Browse files Browse the repository at this point in the history
* ✨ add bank adapter for BOI

* Remove console log
  • Loading branch information
MatissJanis authored Jan 7, 2025
1 parent e6ed450 commit 0637b1d
Show file tree
Hide file tree
Showing 3 changed files with 45 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 @@ -3,6 +3,7 @@ import AbnamroAbnanl2a from './banks/abnamro_abnanl2a.js';
import AmericanExpressAesudef1 from './banks/american-express-aesudef1.js';
import BancsabadellBsabesbb from './banks/bancsabadell-bsabesbbb.js';
import BankinterBkbkesmm from './banks/bankinter-bkbkesmm.js';
import BankOfIrelandB365 from './banks/bank_of_ireland_b365_bofiie2d.js';
import Belfius from './banks/belfius_gkccbebb.js';
import Berliner_Sparkasse_beladebexxx from './banks/berliner_sparkasse_beladebexxx.js';
import BnpBeGebabebb from './banks/bnp-be-gebabebb.js';
Expand Down Expand Up @@ -41,6 +42,7 @@ export const banks = [
AmericanExpressAesudef1,
BancsabadellBsabesbb,
BankinterBkbkesmm,
BankOfIrelandB365,
Belfius,
Berliner_Sparkasse_beladebexxx,
BnpBeGebabebb,
Expand Down
37 changes: 37 additions & 0 deletions src/app-gocardless/banks/bank_of_ireland_b365_bofiie2d.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import Fallback from './integration-bank.js';

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

institutionIds: ['BANK_OF_IRELAND_B365_BOFIIE2D'],

normalizeTransaction(transaction, booked) {
transaction.remittanceInformationUnstructured = fixupPayee(
transaction.remittanceInformationUnstructured,
);

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

function fixupPayee(/** @type {string} */ payee) {
let fixedPayee = payee;

// remove all duplicate whitespace
fixedPayee = fixedPayee.replace(/\s+/g, ' ').trim();

// remove date prefix
fixedPayee = fixedPayee.replace(/^(POS)?(C)?[0-9]{1,2}\w{3}/, '').trim();

// remove direct debit postfix
fixedPayee = fixedPayee.replace(/sepa dd$/i, '').trim();

// remove bank transfer prefix
fixedPayee = fixedPayee.replace(/^365 online/i, '').trim();

// remove curve card prefix
fixedPayee = fixedPayee.replace(/^CRV\*/, '').trim();

return fixedPayee;
}
6 changes: 6 additions & 0 deletions upcoming-release-notes/539.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
category: Enhancements
authors: [MatissJanis]
---

Add GoCardless formatter for `BANK_OF_IRELAND_B365_BOFIIE2D` Bank of Ireland.

0 comments on commit 0637b1d

Please sign in to comment.