Skip to content

Commit

Permalink
Merge branch 'master' into feature/pluggy.ai
Browse files Browse the repository at this point in the history
  • Loading branch information
lelemm authored Jan 23, 2025
2 parents 1c8e24f + 5ada00c commit bf0a0bc
Show file tree
Hide file tree
Showing 64 changed files with 496 additions and 185 deletions.
7 changes: 7 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,11 @@ services:
# Change './actual-data' below to the path to the folder you want Actual to store its data in on your server.
# '/data' is the path Actual will look for its files in by default, so leave that as-is.
- ./actual-data:/data
healthcheck:
# Enable health check for the instance
test: ["CMD-SHELL", "node src/scripts/health-check.js"]
interval: 60s
timeout: 10s
retries: 3
start_period: 20s
restart: unless-stopped
10 changes: 7 additions & 3 deletions src/account-db.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,18 @@ export function getActiveLoginMethod() {
export function getLoginMethod(req) {
if (
typeof req !== 'undefined' &&
(req.body || { loginMethod: null }).loginMethod
(req.body || { loginMethod: null }).loginMethod &&
config.allowedLoginMethods.includes(req.body.loginMethod)
) {
return req.body.loginMethod;
}

const activeMethod = getActiveLoginMethod();
if (config.loginMethod) {
return config.loginMethod;
}

return config.loginMethod || activeMethod || 'password';
const activeMethod = getActiveLoginMethod();
return activeMethod || 'password';
}

export async function bootstrap(loginSettings) {
Expand Down
9 changes: 7 additions & 2 deletions src/app-gocardless/bank-factory.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,20 @@ import BelfiusGkccbebb from './banks/belfius_gkccbebb.js';
import BerlinerSparkasseBeladebexxx from './banks/berliner_sparkasse_beladebexxx.js';
import BnpBeGebabebb from './banks/bnp_be_gebabebb.js';
import CbcCregbebb from './banks/cbc_cregbebb.js';
import CommerzbankCobadeff from './banks/commerzbank_cobadeff.js';
import DanskebankDabno22 from './banks/danskebank_dabno22.js';
import DirektHeladef1822 from './banks/direkt_heladef1822.js';
import EasybankBawaatww from './banks/easybank_bawaatww.js';
import EntercardSwednokk from './banks/entercard_swednokk.js';
import FortuneoFtnofrp1xxx from './banks/fortuneo_ftnofrp1xxx.js';
import HanseaticHstbdehh from './banks/hanseatic_hstbdehh.js';
import HypeHyeeit22 from './banks/hype_hyeeit22.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';
import IsyBankItbbitmm from './banks/isybank_itbbitmm.js';
import KbcKredbebb from './banks/kbc_kredbebb.js';
import LhvLhvbee22 from './banks/lhv-lhvbee22.js';
import MbankRetailBrexplpw from './banks/mbank_retail_brexplpw.js';
import NationwideNaiagb21 from './banks/nationwide_naiagb21.js';
import NbgEthngraaxxx from './banks/nbg_ethngraaxxx.js';
Expand Down Expand Up @@ -47,17 +49,19 @@ export const banks = [
BerlinerSparkasseBeladebexxx,
BnpBeGebabebb,
CbcCregbebb,
CommerzbankCobadeff,
DanskebankDabno22,
DirektHeladef1822,
EasybankBawaatww,
EntercardSwednokk,
FortuneoFtnofrp1xxx,
HanseaticHstbdehh,
HypeHyeeit22,
IngIngbrobu,
IngIngddeff,
IngPlIngbplpw,
IsyBankItbbitmm,
KbcKredbebb,
LhvLhvbee22,
MbankRetailBrexplpw,
NationwideNaiagb21,
NbgEthngraaxxx,
Expand Down Expand Up @@ -86,6 +90,7 @@ export const BANKS_WITH_LIMITED_HISTORY = [
'BANKINTER_BKBKESMM',
'BBVA_BBVAESMM',
'BRED_BREDFRPPXXX',
'CAIXA_GERAL_DEPOSITOS_CGDIPTPL',
'CAIXABANK_CAIXESBB',
'CARTALIS_CIMTITR1',
'CESKA_SPORITELNA_LONG_GIBACZPX',
Expand Down
8 changes: 5 additions & 3 deletions src/app-gocardless/banks/abanca_caglesmm.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ import { formatPayeeName } from '../../util/payee-name.js';
export default {
...Fallback,

institutionIds: ['ABANCA_CAGLESMM', 'ABANCA_CAGLPTPL'],

accessValidForDays: 180,
institutionIds: [
'ABANCA_CAGLESMM',
'ABANCA_CAGLPTPL',
'ABANCA_CORP_CAGLPTPL',
],

// Abanca transactions doesn't get the creditorName/debtorName properly
normalizeTransaction(transaction, _booked) {
Expand Down
2 changes: 0 additions & 2 deletions src/app-gocardless/banks/abnamro_abnanl2a.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ export default {

institutionIds: ['ABNAMRO_ABNANL2A'],

accessValidForDays: 180,

normalizeTransaction(transaction, _booked) {
// There is no remittanceInformationUnstructured, so we'll make it
transaction.remittanceInformationUnstructured =
Expand Down
2 changes: 0 additions & 2 deletions src/app-gocardless/banks/american_express_aesudef1.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ export default {

institutionIds: ['AMERICAN_EXPRESS_AESUDEF1'],

accessValidForDays: 180,

normalizeAccount(account) {
return {
...Fallback.normalizeAccount(account),
Expand Down
2 changes: 0 additions & 2 deletions src/app-gocardless/banks/bancsabadell_bsabesbbb.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ export default {

institutionIds: ['BANCSABADELL_BSABESBB'],

accessValidForDays: 180,

// Sabadell transactions don't get the creditorName/debtorName properly
normalizeTransaction(transaction, _booked) {
const amount = transaction.transactionAmount.amount;
Expand Down
2 changes: 0 additions & 2 deletions src/app-gocardless/banks/bank.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import { Transaction, Balance } from '../gocardless-node.types.js';
export interface IBank {
institutionIds: string[];

accessValidForDays: number;

/**
* Returns normalized object with required data for the frontend
*/
Expand Down
2 changes: 0 additions & 2 deletions src/app-gocardless/banks/bank_of_ireland_b365_bofiie2d.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ export default {

institutionIds: ['BANK_OF_IRELAND_B365_BOFIIE2D'],

accessValidForDays: 180,

normalizeTransaction(transaction, booked) {
transaction.remittanceInformationUnstructured = fixupPayee(
transaction.remittanceInformationUnstructured,
Expand Down
2 changes: 0 additions & 2 deletions src/app-gocardless/banks/bankinter_bkbkesmm.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ export default {

institutionIds: ['BANKINTER_BKBKESMM'],

accessValidForDays: 180,

normalizeTransaction(transaction, _booked) {
transaction.remittanceInformationUnstructured =
transaction.remittanceInformationUnstructured
Expand Down
2 changes: 0 additions & 2 deletions src/app-gocardless/banks/belfius_gkccbebb.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ export default {

institutionIds: ['BELFIUS_GKCCBEBB'],

accessValidForDays: 180,

// The problem is that we have transaction with duplicated transaction ids.
// This is not expected and the nordigen api has a work-around for some backs
// They will set an internalTransactionId which is unique
Expand Down
2 changes: 0 additions & 2 deletions src/app-gocardless/banks/berliner_sparkasse_beladebexxx.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ export default {

institutionIds: ['BERLINER_SPARKASSE_BELADEBEXXX'],

accessValidForDays: 180,

/**
* Following the GoCardless documentation[0] we should prefer `bookingDate`
* here, though some of their bank integrations uses the date field
Expand Down
2 changes: 0 additions & 2 deletions src/app-gocardless/banks/bnp_be_gebabebb.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ export default {
'BNP_BE_GEBABEBB',
],

accessValidForDays: 180,

/** BNP_BE_GEBABEBB provides a lot of useful information via the 'additionalField'
* There does not seem to be a specification of this field, but the following information is contained in its subfields:
* - for pending transactions: the 'atmPosName'
Expand Down
2 changes: 0 additions & 2 deletions src/app-gocardless/banks/cbc_cregbebb.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ export default {

institutionIds: ['CBC_CREGBEBB'],

accessValidForDays: 180,

/**
* For negative amounts, the only payee information we have is returned in
* remittanceInformationUnstructured.
Expand Down
54 changes: 54 additions & 0 deletions src/app-gocardless/banks/commerzbank_cobadeff.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import Fallback from './integration-bank.js';
import { formatPayeeName } from '../../util/payee-name.js';

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

institutionIds: ['COMMERZBANK_COBADEFF'],

normalizeTransaction(transaction, _booked) {
// remittanceInformationUnstructured is limited to 140 chars thus ...
// ... missing information form remittanceInformationUnstructuredArray ...
// ... so we recreate it.
transaction.remittanceInformationUnstructured =
transaction.remittanceInformationUnstructuredArray.join(' ');

// The limitations of remittanceInformationUnstructuredArray ...
// ... can result in split keywords. We fix these. Other ...
// ... splits will need to be fixed by user with rules.
const keywords = [
'End-to-End-Ref.:',
'Mandatsref:',
'Gläubiger-ID:',
'SEPA-BASISLASTSCHRIFT',
'Kartenzahlung',
'Dauerauftrag',
];
keywords.forEach((keyword) => {
transaction.remittanceInformationUnstructured =
transaction.remittanceInformationUnstructured.replace(
// There can be spaces in keywords
RegExp(keyword.split('').join('\\s*'), 'gi'),
', ' + keyword + ' ',
);
});

// Clean up remittanceInformation, deduplicate payee (removing slashes ...
// ... that are added to the remittanceInformation field), and ...
// ... remove clutter like "End-to-End-Ref.: NOTPROVIDED"
const payee = transaction.creditorName || transaction.debtorName || '';
transaction.remittanceInformationUnstructured =
transaction.remittanceInformationUnstructured
.replace(/\s*(,)?\s+/g, '$1 ')
.replace(RegExp(payee.split(' ').join('(/*| )'), 'gi'), ' ')
.replace(', End-to-End-Ref.: NOTPROVIDED', '')
.trim();

return {
...transaction,
payeeName: formatPayeeName(transaction),
date: transaction.bookingDate,
};
},
};
2 changes: 0 additions & 2 deletions src/app-gocardless/banks/danskebank_dabno22.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ export default {

institutionIds: ['DANSKEBANK_DABANO22'],

accessValidForDays: 180,

normalizeTransaction(transaction, _booked) {
/**
* Danske Bank appends the EndToEndID: NOTPROVIDED to
Expand Down
2 changes: 0 additions & 2 deletions src/app-gocardless/banks/easybank_bawaatww.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ export default {

institutionIds: ['EASYBANK_BAWAATWW'],

accessValidForDays: 179,

// If date is same, sort by transactionId
sortTransactions: (transactions = []) =>
transactions.sort((a, b) => {
Expand Down
2 changes: 0 additions & 2 deletions src/app-gocardless/banks/entercard_swednokk.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ export default {

institutionIds: ['ENTERCARD_SWEDNOKK'],

accessValidForDays: 180,

normalizeTransaction(transaction, _booked) {
// GoCardless's Entercard integration returns forex transactions with the
// foreign amount in `transactionAmount`, but at least the amount actually
Expand Down
2 changes: 0 additions & 2 deletions src/app-gocardless/banks/fortuneo_ftnofrp1xxx.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ export default {

institutionIds: ['FORTUNEO_FTNOFRP1XXX'],

accessValidForDays: 180,

normalizeTransaction(transaction, _booked) {
const date =
transaction.bookingDate ||
Expand Down
10 changes: 0 additions & 10 deletions src/app-gocardless/banks/hanseatic_hstbdehh.js

This file was deleted.

2 changes: 0 additions & 2 deletions src/app-gocardless/banks/hype_hyeeit22.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ export default {

institutionIds: ['HYPE_HYEEIT22'],

accessValidForDays: 180,

normalizeTransaction(transaction, _booked) {
/** Online card payments - identified by "crd" transaction code
* always start with PAGAMENTO PRESSO + <payee name>
Expand Down
2 changes: 0 additions & 2 deletions src/app-gocardless/banks/ing_ingbrobu.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ export default {

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
Expand Down
2 changes: 0 additions & 2 deletions src/app-gocardless/banks/ing_ingddeff.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ export default {

institutionIds: ['ING_INGDDEFF'],

accessValidForDays: 180,

normalizeTransaction(transaction, _booked) {
const remittanceInformationMatch = /remittanceinformation:(.*)$/.exec(
transaction.remittanceInformationUnstructured,
Expand Down
2 changes: 0 additions & 2 deletions src/app-gocardless/banks/ing_pl_ingbplpw.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ export default {

institutionIds: ['ING_PL_INGBPLPW'],

accessValidForDays: 180,

normalizeTransaction(transaction, _booked) {
return {
...transaction,
Expand Down
7 changes: 0 additions & 7 deletions src/app-gocardless/banks/integration-bank.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,6 @@ const SORTED_BALANCE_TYPE_LIST = [
export default {
institutionIds: ['IntegrationBank'],

// EEA need to allow at least 180 days now but this doesn't apply to UK
// banks, and it's possible that there are EEA banks which still don't follow
// the new requirements. See:
// - https://nordigen.zendesk.com/hc/en-gb/articles/13239212055581-EEA-180-day-access
// - https://nordigen.zendesk.com/hc/en-gb/articles/6760902653085-Extended-history-and-continuous-access-edge-cases
accessValidForDays: 90,

normalizeAccount(account) {
console.debug(
'Available account properties for new institution integration',
Expand Down
2 changes: 0 additions & 2 deletions src/app-gocardless/banks/isybank_itbbitmm.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ export default {

institutionIds: ['ISYBANK_ITBBITMM'],

accessValidForDays: 180,

// It has been reported that valueDate is more accurate than booking date
// when it is provided
normalizeTransaction(transaction, booked) {
Expand Down
2 changes: 0 additions & 2 deletions src/app-gocardless/banks/kbc_kredbebb.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ export default {

institutionIds: ['KBC_KREDBEBB'],

accessValidForDays: 180,

/**
* For negative amounts, the only payee information we have is returned in
* remittanceInformationUnstructured.
Expand Down
Loading

0 comments on commit bf0a0bc

Please sign in to comment.