mirror of
https://github.com/actualbudget/actual.git
synced 2026-03-11 12:43:09 -05:00
Add BANKS_WITH_LIMITED_HISTORY constant and Implement BANKINTER_BKBKESMM Bank Adapter (#355)
This commit is contained in:
committed by
GitHub
parent
3a486ed973
commit
c51e636637
@@ -1,4 +1,5 @@
|
||||
import AmericanExpressAesudef1 from './banks/american-express-aesudef1.js';
|
||||
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';
|
||||
@@ -16,6 +17,7 @@ import SpkKarlsruhekarsde66 from './banks/spk-karlsruhe-karsde66.js';
|
||||
|
||||
const banks = [
|
||||
AmericanExpressAesudef1,
|
||||
BankinterBkbkesmm,
|
||||
Belfius,
|
||||
BnpBeGebabebb,
|
||||
DanskeBankDabNO22,
|
||||
@@ -34,3 +36,45 @@ const banks = [
|
||||
export default (institutionId) =>
|
||||
banks.find((b) => b.institutionIds.includes(institutionId)) ||
|
||||
IntegrationBank;
|
||||
|
||||
export const BANKS_WITH_LIMITED_HISTORY = [
|
||||
'BRED_BREDFRPPXXX',
|
||||
'INDUSTRA_MULTLV2X',
|
||||
'MEDICINOSBANK_MDBALT22XXX',
|
||||
'CESKA_SPORITELNA_LONG_GIBACZPX',
|
||||
'LHV_LHVBEE22',
|
||||
'LUMINOR_NDEALT2X',
|
||||
'LUMINOR_RIKOEE22',
|
||||
'LUMINOR_AGBLLT2X',
|
||||
'LUMINOR_NDEALV2X',
|
||||
'LUMINOR_NDEAEE2X',
|
||||
'LUMINOR_RIKOLV2X',
|
||||
'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',
|
||||
];
|
||||
|
||||
64
src/app-gocardless/banks/bankinter-bkbkesmm.js
Normal file
64
src/app-gocardless/banks/bankinter-bkbkesmm.js
Normal file
@@ -0,0 +1,64 @@
|
||||
import {
|
||||
printIban,
|
||||
amountToInteger,
|
||||
sortByBookingDateOrValueDate,
|
||||
} from '../utils.js';
|
||||
|
||||
const SORTED_BALANCE_TYPE_LIST = [
|
||||
'closingBooked',
|
||||
'expected',
|
||||
'forwardAvailable',
|
||||
'interimAvailable',
|
||||
'interimBooked',
|
||||
'nonInvoiced',
|
||||
'openingBooked',
|
||||
];
|
||||
|
||||
/** @type {import('./bank.interface.js').IBank} */
|
||||
export default {
|
||||
institutionIds: ['BANKINTER_BKBKESMM'],
|
||||
|
||||
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',
|
||||
};
|
||||
},
|
||||
|
||||
normalizeTransaction(transaction, _booked) {
|
||||
return {
|
||||
...transaction,
|
||||
debtorName: transaction.debtorName?.replaceAll(';', ' '),
|
||||
creditorName: transaction.creditorName?.replaceAll(';', ' '),
|
||||
remittanceInformationUnstructured:
|
||||
transaction.remittanceInformationUnstructured
|
||||
.replaceAll(/\/Txt\/(\w\|)?/gi, '')
|
||||
.replaceAll(';', ' '),
|
||||
date: transaction.bookingDate || transaction.valueDate,
|
||||
};
|
||||
},
|
||||
|
||||
sortTransactions(transactions = []) {
|
||||
return sortByBookingDateOrValueDate(transactions);
|
||||
},
|
||||
|
||||
calculateStartingBalance(sortedTransactions = [], balances = []) {
|
||||
const currentBalance = balances
|
||||
.filter((item) => SORTED_BALANCE_TYPE_LIST.includes(item.balanceType))
|
||||
.sort(
|
||||
(a, b) =>
|
||||
SORTED_BALANCE_TYPE_LIST.indexOf(a.balanceType) -
|
||||
SORTED_BALANCE_TYPE_LIST.indexOf(b.balanceType),
|
||||
)[0];
|
||||
return sortedTransactions.reduce((total, trans) => {
|
||||
return total - amountToInteger(trans.transactionAmount.amount);
|
||||
}, amountToInteger(currentBalance?.balanceAmount?.amount || 0));
|
||||
},
|
||||
};
|
||||
@@ -1,4 +1,4 @@
|
||||
import BankFactory from '../bank-factory.js';
|
||||
import BankFactory, { BANKS_WITH_LIMITED_HISTORY } from '../bank-factory.js';
|
||||
import {
|
||||
RequisitionNotLinked,
|
||||
AccountNotLinedToRequisition,
|
||||
@@ -268,7 +268,11 @@ export const goCardlessService = {
|
||||
institutionId,
|
||||
referenceId: uuid.v4(),
|
||||
accessValidForDays: bank.accessValidForDays,
|
||||
maxHistoricalDays: institution.transaction_total_days,
|
||||
maxHistoricalDays: BANKS_WITH_LIMITED_HISTORY.includes(institutionId)
|
||||
? Number(institution.transaction_total_days) >= 90
|
||||
? '89'
|
||||
: institution.transaction_total_days
|
||||
: institution.transaction_total_days,
|
||||
userLanguage: 'en',
|
||||
ssn: null,
|
||||
redirectImmediate: false,
|
||||
|
||||
6
upcoming-release-notes/355.md
Normal file
6
upcoming-release-notes/355.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
category: Enhancements
|
||||
authors: [hostyn]
|
||||
---
|
||||
|
||||
Add BANKS_WITH_LIMITED_HISTORY constant and Implement BANKINTER_BKBKESMM Bank Adapter
|
||||
Reference in New Issue
Block a user