From c19cc56c5503f521e540e8157e845c40fcc6f792 Mon Sep 17 00:00:00 2001 From: spideraxal Date: Thu, 18 Jul 2024 22:40:03 +0300 Subject: [PATCH] Added GoCardless Integration for ING (Romania) (#401) --- src/app-gocardless/bank-factory.js | 4 +- src/app-gocardless/banks/ing-ingbrobu.js | 48 ++++++++++++++++++++++++ upcoming-release-notes/401.md | 6 +++ 3 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 src/app-gocardless/banks/ing-ingbrobu.js create mode 100644 upcoming-release-notes/401.md diff --git a/src/app-gocardless/bank-factory.js b/src/app-gocardless/bank-factory.js index 41515af3b..15c09c73a 100644 --- a/src/app-gocardless/bank-factory.js +++ b/src/app-gocardless/bank-factory.js @@ -4,7 +4,9 @@ import BankinterBkbkesmm from './banks/bankinter-bkbkesmm.js'; import Belfius from './banks/belfius_gkccbebb.js'; import BnpBeGebabebb from './banks/bnp-be-gebabebb.js'; import DanskeBankDabNO22 from './banks/danskebank-dabno22.js'; +import EasybankBawaatww from './banks/easybank-bawaatww.js'; import Fortuneo from './banks/FORTUNEO_FTNOFRP1XXX.js'; +import IngIngbrobu from './banks/ing-ingbrobu.js'; import IngIngddeff from './banks/ing-ingddeff.js'; import IngPlIngbplpw from './banks/ing-pl-ingbplpw.js'; import IntegrationBank from './banks/integration-bank.js'; @@ -18,7 +20,6 @@ import SparNordSpNoDK22 from './banks/sparnord-spnodk22.js'; import SpkMarburgBiedenkopfHeladef1mar from './banks/spk-marburg-biedenkopf-heladef1mar.js'; import SpkKarlsruhekarsde66 from './banks/spk-karlsruhe-karsde66.js'; import VirginNrnbgb22 from './banks/virgin_nrnbgb22.js'; -import EasybankBawaatww from './banks/easybank-bawaatww.js'; export const banks = [ AbancaCaglesmm, @@ -31,6 +32,7 @@ export const banks = [ Fortuneo, IngIngddeff, IngPlIngbplpw, + IngIngbrobu, MbankRetailBrexplpw, NationwideNaiaGB21, NorwegianXxNorwnok1, diff --git a/src/app-gocardless/banks/ing-ingbrobu.js b/src/app-gocardless/banks/ing-ingbrobu.js new file mode 100644 index 000000000..9b99c0939 --- /dev/null +++ b/src/app-gocardless/banks/ing-ingbrobu.js @@ -0,0 +1,48 @@ +import Fallback from './integration-bank.js'; + +/** @type {import('./bank.interface.js').IBank} */ +export default { + ...Fallback, + + institutionIds: ['ING_INGBROBU'], + + accessValidForDays: 180, + + normalizeTransaction(transaction, booked) { + //Merchant transactions all have the same transactionId of 'NOTPROVIDED'. + //For booked transactions, this can be set to the internalTransactionId + //For pending transactions, this needs to be removed for them to show up in Actual + + //For deduplication to work, payeeName needs to be standardized. + //And converted from a pending transaction form ("payeeName":"Card no: xxxxxxxxxxxx1111"') to a booked transaction form ("payeeName":"Card no: Xxxx Xxxx Xxxx 1111") + if (transaction.transactionId === 'NOTPROVIDED') { + if (booked) { + transaction.transactionId = transaction.internalTransactionId; + + if ( + transaction.remittanceInformationUnstructured + .toLowerCase() + .includes('card no:') + ) { + transaction.creditorName = + transaction.remittanceInformationUnstructured.split(',')[0]; + } + } else { + transaction.transactionId = null; + if ( + transaction.remittanceInformationUnstructured + .toLowerCase() + .includes('card no:') + ) { + transaction.creditorName = + transaction.remittanceInformationUnstructured.replace( + /x{4}/g, + 'Xxxx ', + ); + } + } + } + + return Fallback.normalizeTransaction(transaction, booked); + }, +}; diff --git a/upcoming-release-notes/401.md b/upcoming-release-notes/401.md new file mode 100644 index 000000000..0ccaebba2 --- /dev/null +++ b/upcoming-release-notes/401.md @@ -0,0 +1,6 @@ +--- +category: Enhancements +authors: [spideraxal] +--- + +Added GoCardless Integration for ING (Romania) \ No newline at end of file