Skip to content

Commit

Permalink
Merge remote-tracking branch 'org/master' into feature/pluggy.ai
Browse files Browse the repository at this point in the history
  • Loading branch information
lelemm committed Jan 8, 2025
2 parents 70e9257 + 0637b1d commit 4b4dc01
Show file tree
Hide file tree
Showing 28 changed files with 165 additions and 95 deletions.
4 changes: 2 additions & 2 deletions docker/edge-alpine.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM alpine:3.18 as base
FROM alpine:3.18 AS base
RUN apk add --no-cache nodejs yarn npm python3 openssl build-base jq curl
WORKDIR /app
COPY .yarn ./.yarn
Expand All @@ -15,7 +15,7 @@ ARG GITHUB_TOKEN
RUN curl -L -o /tmp/desktop-client.zip --header "Authorization: Bearer ${GITHUB_TOKEN}" $(jq -r '.archive_download_url' /tmp/latest-build.json)
RUN unzip /tmp/desktop-client.zip -d /public

FROM alpine:3.18 as prod
FROM alpine:3.18 AS prod
RUN apk add --no-cache nodejs tini

ARG USERNAME=actual
Expand Down
4 changes: 2 additions & 2 deletions docker/edge-ubuntu.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:18-bookworm as base
FROM node:18-bookworm AS base
RUN apt-get update && apt-get install -y openssl jq
WORKDIR /app
COPY .yarn ./.yarn
Expand All @@ -14,7 +14,7 @@ ARG GITHUB_TOKEN
RUN curl -L -o /tmp/desktop-client.zip --header "Authorization: Bearer ${GITHUB_TOKEN}" $(jq -r '.archive_download_url' /tmp/latest-build.json)
RUN unzip /tmp/desktop-client.zip -d /public

FROM node:18-bookworm-slim as prod
FROM node:18-bookworm-slim AS prod
RUN apt-get update && apt-get install tini && apt-get clean -y && rm -rf /var/lib/apt/lists/*

ARG USERNAME=actual
Expand Down
4 changes: 2 additions & 2 deletions docker/stable-alpine.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM alpine:3.18 as base
FROM alpine:3.18 AS base
RUN apk add --no-cache nodejs yarn npm python3 openssl build-base
WORKDIR /app
COPY .yarn ./.yarn
Expand All @@ -7,7 +7,7 @@ RUN if [ "$(uname -m)" = "armv7l" ]; then yarn config set taskPoolConcurrency 2;
RUN yarn workspaces focus --all --production
RUN if [ "$(uname -m)" = "armv7l" ]; then npm install bcrypt better-sqlite3 --build-from-source; fi

FROM alpine:3.18 as prod
FROM alpine:3.18 AS prod
RUN apk add --no-cache nodejs tini

ARG USERNAME=actual
Expand Down
4 changes: 2 additions & 2 deletions docker/stable-ubuntu.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
FROM node:18-bookworm as base
FROM node:18-bookworm AS base
RUN apt-get update && apt-get install -y openssl
WORKDIR /app
COPY .yarn ./.yarn
COPY yarn.lock package.json .yarnrc.yml ./
RUN if [ "$(uname -m)" = "armv7l" ]; then yarn config set taskPoolConcurrency 2; yarn config set networkConcurrency 5; fi
RUN yarn workspaces focus --all --production

FROM node:18-bookworm-slim as prod
FROM node:18-bookworm-slim AS prod
RUN apt-get update && apt-get install tini && apt-get clean -y && rm -rf /var/lib/apt/lists/*

ARG USERNAME=actual
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "actual-sync",
"version": "24.12.0",
"version": "25.1.0",
"license": "MIT",
"description": "actual syncing server",
"type": "module",
Expand All @@ -23,7 +23,7 @@
},
"dependencies": {
"@actual-app/crdt": "2.1.0",
"@actual-app/web": "24.12.0",
"@actual-app/web": "25.1.0",
"bcrypt": "^5.1.1",
"better-sqlite3": "^11.7.0",
"body-parser": "^1.20.3",
Expand Down
4 changes: 4 additions & 0 deletions src/app-gocardless/bank-factory.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import AbnamroAbnanl2a from './banks/abnamro_abnanl2a.js';
import AmericanExpressAesudef1 from './banks/american-express-aesudef1.js';
import BancsabadellBsabesbb from './banks/bancsabadell-bsabesbbb.js';
import BankinterBkbkesmm from './banks/bankinter-bkbkesmm.js';
import BankOfIrelandB365 from './banks/bank_of_ireland_b365_bofiie2d.js';
import Belfius from './banks/belfius_gkccbebb.js';
import Berliner_Sparkasse_beladebexxx from './banks/berliner_sparkasse_beladebexxx.js';
import BnpBeGebabebb from './banks/bnp-be-gebabebb.js';
Expand Down Expand Up @@ -31,6 +32,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';
import SskDusseldorfDussdeddxxx from './banks/ssk-dusseldorf-dussdeddxxx.js';
import SwedbankHabaLV22 from './banks/swedbank-habalv22.js';
import VirginNrnbgb22 from './banks/virgin_nrnbgb22.js';

Expand All @@ -40,6 +42,7 @@ export const banks = [
AmericanExpressAesudef1,
BancsabadellBsabesbb,
BankinterBkbkesmm,
BankOfIrelandB365,
Belfius,
Berliner_Sparkasse_beladebexxx,
BnpBeGebabebb,
Expand Down Expand Up @@ -67,6 +70,7 @@ export const banks = [
SpkKarlsruhekarsde66,
SpkMarburgBiedenkopfHeladef1mar,
SpkWormsAlzeyRiedMalade51wor,
SskDusseldorfDussdeddxxx,
SwedbankHabaLV22,
VirginNrnbgb22,
];
Expand Down
19 changes: 5 additions & 14 deletions src/app-gocardless/banks/abnamro_abnanl2a.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,26 +24,17 @@ export default {

normalizeTransaction(transaction, _booked) {
// There is no remittanceInformationUnstructured, so we'll make it
let remittanceInformationUnstructured =
transaction.remittanceInformationUnstructuredArray.join(' ');
transaction.remittanceInformationUnstructured =
transaction.remittanceInformationUnstructuredArray.join(', ');

// Remove clutter to extract the payee from remittanceInformationUnstructured ...
// ... when not otherwise provided.
const matches =
remittanceInformationUnstructured.match(/Betaalpas(.+),PAS/);
const payeeName = matches
? matches[1].replace(/.+\*/, '').trim()
: undefined;
const payeeName = transaction.remittanceInformationUnstructuredArray
.map((el) => el.match(/^(?:.*\*)?(.+),PAS\d+$/))
.find((match) => match)?.[1];
transaction.debtorName = transaction.debtorName || payeeName;
transaction.creditorName = transaction.creditorName || payeeName;

// There are anumber of superfluous keywords in the remittanceInformation.
// Remove them to aboid clutter in notes.
const keywordsToRemove = ['.EA, Betaalpas', ',PAS\\d{3}', 'NR:.+, '];
const regex = new RegExp(keywordsToRemove.join('|'), 'g');
transaction.remittanceInformationUnstructured =
remittanceInformationUnstructured.replace(regex, '').trim();

return {
...transaction,
payeeName: formatPayeeName(transaction),
Expand Down
37 changes: 37 additions & 0 deletions src/app-gocardless/banks/bank_of_ireland_b365_bofiie2d.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import Fallback from './integration-bank.js';

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

institutionIds: ['BANK_OF_IRELAND_B365_BOFIIE2D'],

normalizeTransaction(transaction, booked) {
transaction.remittanceInformationUnstructured = fixupPayee(
transaction.remittanceInformationUnstructured,
);

return Fallback.normalizeTransaction(transaction, booked);
},
};

function fixupPayee(/** @type {string} */ payee) {
let fixedPayee = payee;

// remove all duplicate whitespace
fixedPayee = fixedPayee.replace(/\s+/g, ' ').trim();

// remove date prefix
fixedPayee = fixedPayee.replace(/^(POS)?(C)?[0-9]{1,2}\w{3}/, '').trim();

// remove direct debit postfix
fixedPayee = fixedPayee.replace(/sepa dd$/i, '').trim();

// remove bank transfer prefix
fixedPayee = fixedPayee.replace(/^365 online/i, '').trim();

// remove curve card prefix
fixedPayee = fixedPayee.replace(/^CRV\*/, '').trim();

return fixedPayee;
}
12 changes: 12 additions & 0 deletions src/app-gocardless/banks/ing-ingbrobu.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,19 @@ export default {
//For deduplication to work better, payeeName needs to be standardized
//and converted from a pending transaction form ("payeeName":"Card no: xxxxxxxxxxxx1111"') to a booked transaction form ("payeeName":"Card no: Xxxx Xxxx Xxxx 1111")
if (transaction.transactionId === 'NOTPROVIDED') {
//Some corner case transactions only have the `proprietaryBankTransactionCode` field, this need to be copied to `remittanceInformationUnstructured`
if (
transaction.proprietaryBankTransactionCode &&
!transaction.remittanceInformationUnstructured
) {
transaction.remittanceInformationUnstructured =
transaction.proprietaryBankTransactionCode;
}

if (booked) {
transaction.transactionId = transaction.internalTransactionId;
if (
transaction.remittanceInformationUnstructured &&
transaction.remittanceInformationUnstructured
.toLowerCase()
.includes('card no:')
Expand All @@ -32,7 +42,9 @@ export default {
}
} else {
transaction.transactionId = null;

if (
transaction.remittanceInformationUnstructured &&
transaction.remittanceInformationUnstructured
.toLowerCase()
.includes('card no:')
Expand Down
33 changes: 33 additions & 0 deletions src/app-gocardless/banks/ssk-dusseldorf-dussdeddxxx.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import Fallback from './integration-bank.js';

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

institutionIds: ['SSK_DUSSELDORF_DUSSDEDDXXX'],

normalizeTransaction(transaction, _booked) {
// Prioritize unstructured information, falling back to structured formats
let remittanceInformationUnstructured =
transaction.remittanceInformationUnstructured ??
transaction.remittanceInformationStructured ??
transaction.remittanceInformationStructuredArray?.join(' ');

if (transaction.additionalInformation)
remittanceInformationUnstructured =
(remittanceInformationUnstructured ?? '') +
' ' +
transaction.additionalInformation;

const usefulCreditorName =
transaction.ultimateCreditor ||
transaction.creditorName ||
transaction.debtorName;

transaction.creditorName = usefulCreditorName;
transaction.remittanceInformationUnstructured =
remittanceInformationUnstructured;

return Fallback.normalizeTransaction(transaction, _booked);
},
};
30 changes: 29 additions & 1 deletion src/app-gocardless/banks/tests/abnamro_abnanl2a.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,37 @@ describe('AbnamroAbnanl2a', () => {
);

expect(normalizedTransaction.remittanceInformationUnstructured).toEqual(
'My Payee Name 09.12.23/15:43 CITY',
'BEA, Betaalpas, My Payee Name,PAS123, NR:123A4B, 09.12.23/15:43, CITY',
);
expect(normalizedTransaction.payeeName).toEqual('My Payee Name');
});

it('correctly extracts the payee for google pay', () => {
const transaction = {
transactionId: '0123456789012345',
bookingDate: '2023-12-11',
valueDateTime: '2023-12-09T15:43:37.950',
transactionAmount: {
amount: '-10.00',
currency: 'EUR',
},
remittanceInformationUnstructuredArray: [
'BEA, Google Pay',
'CCV*Other payee name,PAS123',
'NR:123A4B, 09.12.23/15:43',
'CITY',
],
};

const normalizedTransaction = AbnamroAbnanl2a.normalizeTransaction(
transaction,
false,
);

expect(normalizedTransaction.remittanceInformationUnstructured).toEqual(
'BEA, Google Pay, CCV*Other payee name,PAS123, NR:123A4B, 09.12.23/15:43, CITY',
);
expect(normalizedTransaction.payeeName).toEqual('Other Payee Name');
});
});
});
6 changes: 0 additions & 6 deletions upcoming-release-notes/506.md

This file was deleted.

6 changes: 0 additions & 6 deletions upcoming-release-notes/509.md

This file was deleted.

6 changes: 0 additions & 6 deletions upcoming-release-notes/510.md

This file was deleted.

6 changes: 0 additions & 6 deletions upcoming-release-notes/512.md

This file was deleted.

6 changes: 0 additions & 6 deletions upcoming-release-notes/513.md

This file was deleted.

6 changes: 0 additions & 6 deletions upcoming-release-notes/518.md

This file was deleted.

6 changes: 0 additions & 6 deletions upcoming-release-notes/523.md

This file was deleted.

6 changes: 0 additions & 6 deletions upcoming-release-notes/524.md

This file was deleted.

6 changes: 0 additions & 6 deletions upcoming-release-notes/526.md

This file was deleted.

6 changes: 0 additions & 6 deletions upcoming-release-notes/527.md

This file was deleted.

5 changes: 0 additions & 5 deletions upcoming-release-notes/528.md

This file was deleted.

6 changes: 6 additions & 0 deletions upcoming-release-notes/531.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
category: Enhancements
authors: [DennaGherlyn]
---

Add GoCardless formatter for `SSK_DUSSELDORF_DUSSDEDDXXX` Stadtsparkasse Düsseldorf (Germany)
6 changes: 6 additions & 0 deletions upcoming-release-notes/534.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
category: Enhancements
authors: [UnderKoen]
---

Make Google Pay transactions work for ABNAMRO_ABNANL2A
6 changes: 6 additions & 0 deletions upcoming-release-notes/535.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
category: Bugfix
authors: [spideraxal]
---

Add corner case transaction for ING Bank Romania
6 changes: 6 additions & 0 deletions upcoming-release-notes/538.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
category: Maintenance
authors: [lnagel]
---

Fix WARN: FromAsCasing: 'as' and 'FROM' keywords' casing do not match in Dockerfiles
6 changes: 6 additions & 0 deletions upcoming-release-notes/539.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
category: Enhancements
authors: [MatissJanis]
---

Add GoCardless formatter for `BANK_OF_IRELAND_B365_BOFIIE2D` Bank of Ireland.
Loading

0 comments on commit 4b4dc01

Please sign in to comment.