Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add custom handler for the German bank Rheinhessen Sparkasse to the GoCardless app #454

Merged
merged 12 commits into from
Sep 26, 2024
Merged
2 changes: 2 additions & 0 deletions src/app-gocardless/bank-factory.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
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';

Check failure on line 26 in src/app-gocardless/bank-factory.js

View workflow job for this annotation

GitHub Actions / build

Cannot find module './banks/spk-worms-alzey-ried-malade51wor.js' or its corresponding type declarations.
matt-fidd marked this conversation as resolved.
Show resolved Hide resolved
import VirginNrnbgb22 from './banks/virgin_nrnbgb22.js';
import NbgEthngraaxxx from './banks/nbg_ethngraaxxx.js';

Expand Down Expand Up @@ -51,6 +52,7 @@
SparNordSpNoDK22,
SpkKarlsruhekarsde66,
SpkMarburgBiedenkopfHeladef1mar,
SpkWormsAlzeyRiedMalade51wor,
VirginNrnbgb22,
NbgEthngraaxxx,
];
Expand Down
52 changes: 52 additions & 0 deletions src/app-gocardless/banks/spk_worms_alzey_ried_malade51wor.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import Fallback from './integration-bank.js';

import { printIban, amountToInteger } from '../utils.js';
import { formatPayeeName } from '../../util/payee-name.js';

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

institutionIds: ['SPK_WORMS_ALZEY_RIED_MALADE51WOR'],

accessValidForDays: 90,

normalizeAccount(account) {
return {
account_id: account.id,
institution: account.institution,
mask: account.iban.slice(-4),
iban: account.iban,
name: [account.name, printIban(account)].join(' '),
official_name: account.product,
type: 'checking',
};
},
DirgoSalga marked this conversation as resolved.
Show resolved Hide resolved

normalizeTransaction(transaction, _booked) {
const date = transaction.bookingDate || transaction.valueDate;
if (!date) {
return null;
}

transaction.remittanceInformationUnstructured =
transaction.remittanceInformationUnstructured ??
transaction.remittanceInformationStructured ??
transaction.remittanceInformationStructuredArray?.join(' ');
return {
...transaction,
payeeName: formatPayeeName(transaction),
date: transaction.bookingDate || transaction.valueDate,
};
},

calculateStartingBalance(sortedTransactions = [], balances = []) {
const currentBalance = balances.find(
(balance) => 'interimAvailable' === balance.balanceType,
);

return sortedTransactions.reduce((total, trans) => {
return total - amountToInteger(trans.transactionAmount.amount);
}, amountToInteger(currentBalance.balanceAmount.amount));
},
};
6 changes: 6 additions & 0 deletions upcoming-release-notes/454.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
category: Enhancements
authors: [DirgoSalga]
---

Add integration of Rheinhessen Sparkasse (`SPK_WORMS_ALZEY_RIED_MALADE51WOR`) to the GoCardless app
Loading