diff --git a/src/app-gocardless/bank-factory.js b/src/app-gocardless/bank-factory.js index 0528a535b..f18d285e1 100644 --- a/src/app-gocardless/bank-factory.js +++ b/src/app-gocardless/bank-factory.js @@ -16,16 +16,17 @@ 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 SpkWormsAlzeyRiedMalade51wor from './banks/spk-worms-alzey-ried-malade51wor.js'; import VirginNrnbgb22 from './banks/virgin_nrnbgb22.js'; -import NbgEthngraaxxx from './banks/nbg_ethngraaxxx.js'; export const banks = [ AbancaCaglesmm, @@ -45,16 +46,17 @@ export const banks = [ KBCkredbebb, MbankRetailBrexplpw, NationwideNaiaGB21, + NbgEthngraaxxx, NorwegianXxNorwnok1, + RevolutRevolt21, + SandboxfinanceSfin0000, SEBKortBankAB, SEBPrivat, - SandboxfinanceSfin0000, SparNordSpNoDK22, SpkKarlsruhekarsde66, SpkMarburgBiedenkopfHeladef1mar, SpkWormsAlzeyRiedMalade51wor, VirginNrnbgb22, - NbgEthngraaxxx, ]; export default (institutionId) => @@ -62,47 +64,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', ]; 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); + }, +}; 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..40e8bef75 --- /dev/null +++ b/src/app-gocardless/banks/tests/revolut_revolt21.spec.js @@ -0,0 +1,46 @@ +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', + ], + bookingDate: '2024-09-21', + }; + + 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', + ], + bookingDate: '2024-09-21', + }; + + const normalizedTransaction = RevolutRevolt21.normalizeTransaction( + transaction, + true, + ); + + expect(normalizedTransaction.payeeName).toEqual('DEBTOR NAME'); + expect(normalizedTransaction.remittanceInformationUnstructured).toEqual( + 'Bizum description', + ); + }); +}); 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 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