From ca191e090834d27d4ac6b6e76b51d21ea1c123b9 Mon Sep 17 00:00:00 2001 From: hostyn Date: Sat, 21 Sep 2024 09:54:50 +0200 Subject: [PATCH 1/6] fix: rename proprietaryBank to proprietaryBankTransactionCode --- src/app-gocardless/gocardless-node.types.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app-gocardless/gocardless-node.types.ts b/src/app-gocardless/gocardless-node.types.ts index a4c2bc7bb..539c91e4c 100644 --- a/src/app-gocardless/gocardless-node.types.ts +++ b/src/app-gocardless/gocardless-node.types.ts @@ -423,7 +423,7 @@ export type Transaction = { /** * Proprietary bank transaction code as used within a community or within an financial institution */ - proprietaryBank?: string; + proprietaryBankTransactionCode?: string; /** * Conditional From 8f7b506a221940f4524b5faad6a7c4f13c3f7675 Mon Sep 17 00:00:00 2001 From: hostyn Date: Sat, 21 Sep 2024 09:56:31 +0200 Subject: [PATCH 2/6] feat: Add support for RevolutRevolt21 Bizum transactions --- src/app-gocardless/bank-factory.js | 2 + src/app-gocardless/banks/revolut_revolt21.js | 60 ++++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 src/app-gocardless/banks/revolut_revolt21.js diff --git a/src/app-gocardless/bank-factory.js b/src/app-gocardless/bank-factory.js index ebbb58df7..fcb4c7aed 100644 --- a/src/app-gocardless/bank-factory.js +++ b/src/app-gocardless/bank-factory.js @@ -17,6 +17,7 @@ import KBCkredbebb from './banks/kbc_kredbebb.js'; import MbankRetailBrexplpw from './banks/mbank-retail-brexplpw.js'; import NationwideNaiaGB21 from './banks/nationwide-naiagb21.js'; import NorwegianXxNorwnok1 from './banks/norwegian-xx-norwnok1.js'; +import RevolutRevolt21 from './banks/revolut_revolt21.js'; import SEBKortBankAB from './banks/seb-kort-bank-ab.js'; import SEBPrivat from './banks/seb-privat.js'; import SandboxfinanceSfin0000 from './banks/sandboxfinance-sfin0000.js'; @@ -47,6 +48,7 @@ export const banks = [ NorwegianXxNorwnok1, SEBKortBankAB, SEBPrivat, + RevolutRevolt21, SandboxfinanceSfin0000, SparNordSpNoDK22, SpkKarlsruhekarsde66, diff --git a/src/app-gocardless/banks/revolut_revolt21.js b/src/app-gocardless/banks/revolut_revolt21.js new file mode 100644 index 000000000..9e660c465 --- /dev/null +++ b/src/app-gocardless/banks/revolut_revolt21.js @@ -0,0 +1,60 @@ +import { formatPayeeName } from '../../util/payee-name.js'; +import * as d from 'date-fns'; +import Fallback from './integration-bank.js'; + +/** @type {import('./bank.interface.js').IBank} */ +export default { + ...Fallback, + + institutionIds: ['REVOLUT_REVOLT21'], + + accessValidForDays: 90, + + normalizeTransaction(transaction, _booked) { + if ( + transaction.remittanceInformationUnstructuredArray[0].startsWith( + 'Bizum payment from: ', + ) + ) { + const date = + transaction.bookingDate || + transaction.bookingDateTime || + transaction.valueDate || + transaction.valueDateTime; + + return { + ...transaction, + payeeName: + transaction.remittanceInformationUnstructuredArray[0].replace( + 'Bizum payment from: ', + '', + ), + remittanceInformationUnstructured: + transaction.remittanceInformationUnstructuredArray[1], + date: d.format(d.parseISO(date), 'yyyy-MM-dd'), + }; + } + + if ( + transaction.remittanceInformationUnstructuredArray[0].startsWith( + 'Bizum payment to: ', + ) + ) { + const date = + transaction.bookingDate || + transaction.bookingDateTime || + transaction.valueDate || + transaction.valueDateTime; + + return { + ...transaction, + payeeName: formatPayeeName(transaction), + remittanceInformationUnstructured: + transaction.remittanceInformationUnstructuredArray[1], + date: d.format(d.parseISO(date), 'yyyy-MM-dd'), + }; + } + + return Fallback.normalizeTransaction(transaction, _booked); + }, +}; From 87631c57e38d1f9160331916f5d12d9f20a9cc36 Mon Sep 17 00:00:00 2001 From: hostyn Date: Sat, 21 Sep 2024 09:57:27 +0200 Subject: [PATCH 3/6] test: Add RevolutRevolt21 bizum transactions tests --- .../banks/tests/revolut_revolt21.spec.js | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 src/app-gocardless/banks/tests/revolut_revolt21.spec.js diff --git a/src/app-gocardless/banks/tests/revolut_revolt21.spec.js b/src/app-gocardless/banks/tests/revolut_revolt21.spec.js new file mode 100644 index 000000000..a1bd4779d --- /dev/null +++ b/src/app-gocardless/banks/tests/revolut_revolt21.spec.js @@ -0,0 +1,44 @@ +import RevolutRevolt21 from '../revolut_revolt21.js'; + +describe('RevolutRevolt21', () => { + describe('#normalizeTransaction', () => { + it('returns the expected remittanceInformationUnstructured from a bizum expense transfer', () => { + const transaction = { + transactionAmount: { amount: '-1.00', currency: 'EUR' }, + remittanceInformationUnstructuredArray: [ + 'Bizum payment to: CREDITOR NAME', + 'Bizum description', + ], + }; + + const normalizedTransaction = RevolutRevolt21.normalizeTransaction( + transaction, + true, + ); + + expect(normalizedTransaction.remittanceInformationUnstructured).toEqual( + 'Bizum description', + ); + }); + }); + + it('returns the expected payeeName and remittanceInformationUnstructured from a bizum income transfer', () => { + const transaction = { + transactionAmount: { amount: '1.00', currency: 'EUR' }, + remittanceInformationUnstructuredArray: [ + 'Bizum payment from: DEBTOR NAME', + 'Bizum description', + ], + }; + + const normalizedTransaction = RevolutRevolt21.normalizeTransaction( + transaction, + true, + ); + + expect(normalizedTransaction.payeeName).toEqual('DEBTOR NAME'); + expect(normalizedTransaction.remittanceInformationUnstructured).toEqual( + 'Bizum description', + ); + }); +}); From 1188b3c1d006126c4c0d7a7e5b680e77b844ffe5 Mon Sep 17 00:00:00 2001 From: hostyn Date: Sat, 21 Sep 2024 10:13:11 +0200 Subject: [PATCH 4/6] chore: Add upcoming release note --- upcoming-release-notes/459.md | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 upcoming-release-notes/459.md diff --git a/upcoming-release-notes/459.md b/upcoming-release-notes/459.md new file mode 100644 index 000000000..76b8171cf --- /dev/null +++ b/upcoming-release-notes/459.md @@ -0,0 +1,6 @@ +--- +category: Enhancements +authors: [hostyn] +--- + +Add support for Bizum transactions in Revolut From 268d3ac3372edf5f48efee7d1eb55af1e6aec683 Mon Sep 17 00:00:00 2001 From: hostyn Date: Sat, 21 Sep 2024 10:31:55 +0200 Subject: [PATCH 5/6] fix: Add missing bookingDate to tests --- src/app-gocardless/banks/tests/revolut_revolt21.spec.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/app-gocardless/banks/tests/revolut_revolt21.spec.js b/src/app-gocardless/banks/tests/revolut_revolt21.spec.js index a1bd4779d..40e8bef75 100644 --- a/src/app-gocardless/banks/tests/revolut_revolt21.spec.js +++ b/src/app-gocardless/banks/tests/revolut_revolt21.spec.js @@ -9,6 +9,7 @@ describe('RevolutRevolt21', () => { 'Bizum payment to: CREDITOR NAME', 'Bizum description', ], + bookingDate: '2024-09-21', }; const normalizedTransaction = RevolutRevolt21.normalizeTransaction( @@ -29,6 +30,7 @@ describe('RevolutRevolt21', () => { 'Bizum payment from: DEBTOR NAME', 'Bizum description', ], + bookingDate: '2024-09-21', }; const normalizedTransaction = RevolutRevolt21.normalizeTransaction( From 58d75c36d8fcb1f24499b33f9de4b7942521cc26 Mon Sep 17 00:00:00 2001 From: hostyn Date: Thu, 26 Sep 2024 10:36:47 +0200 Subject: [PATCH 6/6] fix: sort everything alphabetically --- src/app-gocardless/bank-factory.js | 70 +++++++++++++++--------------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/src/app-gocardless/bank-factory.js b/src/app-gocardless/bank-factory.js index fcb4c7aed..f1ac1a262 100644 --- a/src/app-gocardless/bank-factory.js +++ b/src/app-gocardless/bank-factory.js @@ -16,16 +16,16 @@ import IntegrationBank from './banks/integration-bank.js'; import KBCkredbebb from './banks/kbc_kredbebb.js'; import MbankRetailBrexplpw from './banks/mbank-retail-brexplpw.js'; import NationwideNaiaGB21 from './banks/nationwide-naiagb21.js'; +import NbgEthngraaxxx from './banks/nbg_ethngraaxxx.js'; import NorwegianXxNorwnok1 from './banks/norwegian-xx-norwnok1.js'; import RevolutRevolt21 from './banks/revolut_revolt21.js'; +import SandboxfinanceSfin0000 from './banks/sandboxfinance-sfin0000.js'; import SEBKortBankAB from './banks/seb-kort-bank-ab.js'; import SEBPrivat from './banks/seb-privat.js'; -import SandboxfinanceSfin0000 from './banks/sandboxfinance-sfin0000.js'; import SparNordSpNoDK22 from './banks/sparnord-spnodk22.js'; import SpkKarlsruhekarsde66 from './banks/spk-karlsruhe-karsde66.js'; import SpkMarburgBiedenkopfHeladef1mar from './banks/spk-marburg-biedenkopf-heladef1mar.js'; import VirginNrnbgb22 from './banks/virgin_nrnbgb22.js'; -import NbgEthngraaxxx from './banks/nbg_ethngraaxxx.js'; export const banks = [ AbancaCaglesmm, @@ -45,16 +45,16 @@ export const banks = [ KBCkredbebb, MbankRetailBrexplpw, NationwideNaiaGB21, + NbgEthngraaxxx, NorwegianXxNorwnok1, - SEBKortBankAB, - SEBPrivat, RevolutRevolt21, SandboxfinanceSfin0000, + SEBKortBankAB, + SEBPrivat, SparNordSpNoDK22, SpkKarlsruhekarsde66, SpkMarburgBiedenkopfHeladef1mar, VirginNrnbgb22, - NbgEthngraaxxx, ]; export default (institutionId) => @@ -62,47 +62,47 @@ export default (institutionId) => IntegrationBank; export const BANKS_WITH_LIMITED_HISTORY = [ + 'BANCA_AIDEXA_AIDXITMM', + 'BANCA_PATRIMONI_SENVITT1', + 'BANCA_SELLA_SELBIT2B', + 'BANKINTER_BKBKESMM', + 'BBVA_BBVAESMM', 'BRED_BREDFRPPXXX', - 'INDUSTRA_MULTLV2X', - 'MEDICINOSBANK_MDBALT22XXX', + 'CAIXABANK_CAIXESBB', + 'CARTALIS_CIMTITR1', 'CESKA_SPORITELNA_LONG_GIBACZPX', + 'COOP_EKRDEE22', + 'DOTS_HYEEIT22', + 'HYPE_BUSINESS_HYEEIT22', + 'HYPE_HYEEIT2', + 'ILLIMITY_ITTPIT2M', + 'INDUSTRA_MULTLV2X', + 'JEKYLL_JEYKLL002', + 'LABORALKUTXA_CLPEES2M', 'LHV_LHVBEE22', - 'LUMINOR_NDEALT2X', - 'LUMINOR_RIKOEE22', 'LUMINOR_AGBLLT2X', - 'LUMINOR_NDEALV2X', 'LUMINOR_NDEAEE2X', + 'LUMINOR_NDEALT2X', + 'LUMINOR_NDEALV2X', + 'LUMINOR_RIKOEE22', 'LUMINOR_RIKOLV2X', + 'MEDICINOSBANK_MDBALT22XXX', + 'NORDEA_NDEADKKK', + 'OPYN_BITAITRRB2B', + 'PAYTIPPER_PAYTITM1', + 'REVOLUT_REVOLT21', + 'SANTANDER_BSCHESMM', + 'SANTANDER_DE_SCFBDE33', + 'SEB_CBVILT2X', + 'SEB_EEUHEE2X', + 'SEB_UNLALV2X', + 'SELLA_PERSONAL_CREDIT_SELBIT22', + 'SMARTIKA_SELBIT22', 'SWEDBANK_HABAEE2X', 'SWEDBANK_HABALT22', 'SWEDBANK_HABALV22', 'SWEDBANK_SWEDSESS', - 'SEB_CBVILT2X', - 'SEB_UNLALV2X', - 'SEB_EEUHEE2X', - 'LABORALKUTXA_CLPEES2M', - 'BANKINTER_BKBKESMM', - 'CAIXABANK_CAIXESBB', - 'JEKYLL_JEYKLL002', - 'SANTANDER_DE_SCFBDE33', - 'BBVA_BBVAESMM', - 'COOP_EKRDEE22', - 'BANCA_AIDEXA_AIDXITMM', - 'BANCA_PATRIMONI_SENVITT1', - 'BANCA_SELLA_SELBIT2B', - 'CARTALIS_CIMTITR1', - 'DOTS_HYEEIT22', - 'HYPE_BUSINESS_HYEEIT22', - 'HYPE_HYEEIT2', - 'ILLIMITY_ITTPIT2M', - 'SMARTIKA_SELBIT22', 'TIM_HYEEIT22', 'TOT_SELBIT2B', - 'OPYN_BITAITRRB2B', - 'PAYTIPPER_PAYTITM1', - 'SELLA_PERSONAL_CREDIT_SELBIT22', - 'SANTANDER_BSCHESMM', - 'NORDEA_NDEADKKK', 'VUB_BANKA_SUBASKBX', - 'REVOLUT_REVOLT21', ];