From 2307761d97639b15f29333380d4b0824376f3c36 Mon Sep 17 00:00:00 2001 From: circle3451 <93911635+circle3451@users.noreply.github.com> Date: Tue, 23 Jan 2024 21:53:37 +0100 Subject: [PATCH 01/10] Add files via upload --- .../ANDELSKASSEN_FALLESKASSEN_FAELDKK1.js | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 src/app-gocardless/banks/ANDELSKASSEN_FALLESKASSEN_FAELDKK1.js diff --git a/src/app-gocardless/banks/ANDELSKASSEN_FALLESKASSEN_FAELDKK1.js b/src/app-gocardless/banks/ANDELSKASSEN_FALLESKASSEN_FAELDKK1.js new file mode 100644 index 00000000..79d263f3 --- /dev/null +++ b/src/app-gocardless/banks/ANDELSKASSEN_FALLESKASSEN_FAELDKK1.js @@ -0,0 +1,60 @@ +import { + printIban, + amountToInteger, + sortByBookingDateOrValueDate, + } from '../utils.js'; + + /** @type {import('./bank.interface.js').IBank} */ + export default { + institutionIds: ['ANDELSKASSEN_FALLESKASSEN_FAELDKK1'], + + normalizeAccount(account) { + return { + account_id: account.resourceId, + institution: account.institution, + mask: account.iban.slice(-4), + iban: account.iban, + name: [account.name, printIban(account)].join(' '), + official_name: account.product, + type: 'checking', + }; + }, + + /** + * Following the GoCardless documentation[0] we should prefer `bookingDate` + * here, though some of their bank integrations uses the date field + * differently from what's describen in their documentation and so it's + * sometimes necessary to use `valueDate` instead. + * + * [0]: https://nordigen.zendesk.com/hc/en-gb/articles/7899367372829-valueDate-and-bookingDate-for-transactions + */ + normalizeTransaction(transaction, _booked) { + return { + ...transaction, + date: transaction.bookingDate, + remittanceInformationUnstructured: transaction.additionalInformation, + }; + }, + + sortTransactions(transactions = []) { + return sortByBookingDateOrValueDate(transactions); + }, + + /** + * For SANDBOXFINANCE_SFIN0000 we don't know what balance was + * after each transaction so we have to calculate it by getting + * current balance from the account and subtract all the transactions + * + * As a current balance we use `interimBooked` balance type because + * it includes transaction placed during current day + */ + calculateStartingBalance(sortedTransactions = [], balances = []) { + const currentBalance = balances.find( + (balance) => 'closingBooked' === balance.balanceType, + ); + + return sortedTransactions.reduce((total, trans) => { + return total - amountToInteger(trans.transactionAmount.amount); + }, amountToInteger(currentBalance.balanceAmount.amount)); + }, + }; \ No newline at end of file From 643f91c67d859de26eaeaacb8f93187d987d2e3e Mon Sep 17 00:00:00 2001 From: circle3451 <93911635+circle3451@users.noreply.github.com> Date: Tue, 23 Jan 2024 21:56:52 +0100 Subject: [PATCH 02/10] Add release notes --- upcoming-release-notes/304.md | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 upcoming-release-notes/304.md diff --git a/upcoming-release-notes/304.md b/upcoming-release-notes/304.md new file mode 100644 index 00000000..55cbbadb --- /dev/null +++ b/upcoming-release-notes/304.md @@ -0,0 +1,6 @@ +--- +category: Enhancement +authors: [circle3451] +--- + +Add GoCardless integration for Andelskassen Fælleskassen From af492da44bb8f6d3db16cfdbc994461cdfbf9bbc Mon Sep 17 00:00:00 2001 From: circle3451 <93911635+circle3451@users.noreply.github.com> Date: Tue, 23 Jan 2024 22:00:39 +0100 Subject: [PATCH 03/10] Rename 304.md to 305.md --- upcoming-release-notes/{304.md => 305.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename upcoming-release-notes/{304.md => 305.md} (100%) diff --git a/upcoming-release-notes/304.md b/upcoming-release-notes/305.md similarity index 100% rename from upcoming-release-notes/304.md rename to upcoming-release-notes/305.md From 1088575793fd84fe0d9c36abca3245853e907141 Mon Sep 17 00:00:00 2001 From: circle3451 <93911635+circle3451@users.noreply.github.com> Date: Tue, 23 Jan 2024 22:01:49 +0100 Subject: [PATCH 04/10] typo fix --- upcoming-release-notes/305.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/upcoming-release-notes/305.md b/upcoming-release-notes/305.md index 55cbbadb..c1cb8dbd 100644 --- a/upcoming-release-notes/305.md +++ b/upcoming-release-notes/305.md @@ -1,5 +1,5 @@ --- -category: Enhancement +category: Enhancements authors: [circle3451] --- From 7d64c14e25e48917d40e0c70cea07c6937337af2 Mon Sep 17 00:00:00 2001 From: circle3451 <93911635+circle3451@users.noreply.github.com> Date: Tue, 23 Jan 2024 22:10:59 +0100 Subject: [PATCH 05/10] lint --- .../ANDELSKASSEN_FALLESKASSEN_FAELDKK1.js | 118 +++++++++--------- 1 file changed, 59 insertions(+), 59 deletions(-) diff --git a/src/app-gocardless/banks/ANDELSKASSEN_FALLESKASSEN_FAELDKK1.js b/src/app-gocardless/banks/ANDELSKASSEN_FALLESKASSEN_FAELDKK1.js index 79d263f3..2215f0cc 100644 --- a/src/app-gocardless/banks/ANDELSKASSEN_FALLESKASSEN_FAELDKK1.js +++ b/src/app-gocardless/banks/ANDELSKASSEN_FALLESKASSEN_FAELDKK1.js @@ -1,60 +1,60 @@ import { - printIban, - amountToInteger, - sortByBookingDateOrValueDate, - } from '../utils.js'; - - /** @type {import('./bank.interface.js').IBank} */ - export default { - institutionIds: ['ANDELSKASSEN_FALLESKASSEN_FAELDKK1'], - - normalizeAccount(account) { - return { - account_id: account.resourceId, - institution: account.institution, - mask: account.iban.slice(-4), - iban: account.iban, - name: [account.name, printIban(account)].join(' '), - official_name: account.product, - type: 'checking', - }; - }, - - /** - * Following the GoCardless documentation[0] we should prefer `bookingDate` - * here, though some of their bank integrations uses the date field - * differently from what's describen in their documentation and so it's - * sometimes necessary to use `valueDate` instead. - * - * [0]: https://nordigen.zendesk.com/hc/en-gb/articles/7899367372829-valueDate-and-bookingDate-for-transactions - */ - normalizeTransaction(transaction, _booked) { - return { - ...transaction, - date: transaction.bookingDate, - remittanceInformationUnstructured: transaction.additionalInformation, - }; - }, - - sortTransactions(transactions = []) { - return sortByBookingDateOrValueDate(transactions); - }, - - /** - * For SANDBOXFINANCE_SFIN0000 we don't know what balance was - * after each transaction so we have to calculate it by getting - * current balance from the account and subtract all the transactions - * - * As a current balance we use `interimBooked` balance type because - * it includes transaction placed during current day - */ - calculateStartingBalance(sortedTransactions = [], balances = []) { - const currentBalance = balances.find( - (balance) => 'closingBooked' === balance.balanceType, - ); - - return sortedTransactions.reduce((total, trans) => { - return total - amountToInteger(trans.transactionAmount.amount); - }, amountToInteger(currentBalance.balanceAmount.amount)); - }, - }; \ No newline at end of file + printIban, + amountToInteger, + sortByBookingDateOrValueDate +} from '../utils.js' + +/** @type {import('./bank.interface.js').IBank} */ +export default { + institutionIds: ['ANDELSKASSEN_FALLESKASSEN_FAELDKK1'], + + normalizeAccount (account) { + return { + account_id: account.resourceId, + institution: account.institution, + mask: account.iban.slice(-4), + iban: account.iban, + name: [account.name, printIban(account)].join(' '), + official_name: account.product, + type: 'checking' + } + }, + + /** + * Following the GoCardless documentation[0] we should prefer `bookingDate` + * here, though some of their bank integrations uses the date field + * differently from what's describen in their documentation and so it's + * sometimes necessary to use `valueDate` instead. + * + * [0]: https://nordigen.zendesk.com/hc/en-gb/articles/7899367372829-valueDate-and-bookingDate-for-transactions + */ + normalizeTransaction (transaction, _booked) { + return { + ...transaction, + date: transaction.bookingDate, + remittanceInformationUnstructured: transaction.additionalInformation + } + }, + + sortTransactions (transactions = []) { + return sortByBookingDateOrValueDate(transactions) + }, + + /** + * For SANDBOXFINANCE_SFIN0000 we don't know what balance was + * after each transaction so we have to calculate it by getting + * current balance from the account and subtract all the transactions + * + * As a current balance we use `interimBooked` balance type because + * it includes transaction placed during current day + */ + calculateStartingBalance (sortedTransactions = [], balances = []) { + const currentBalance = balances.find( + balance => 'closingBooked' === balance.balanceType + ) + + return sortedTransactions.reduce((total, trans) => { + return total - amountToInteger(trans.transactionAmount.amount) + }, amountToInteger(currentBalance.balanceAmount.amount)) + } +} From f4e327eaadeb00d4e3ff3d81428838ef76a34926 Mon Sep 17 00:00:00 2001 From: circle3451 <93911635+circle3451@users.noreply.github.com> Date: Tue, 23 Jan 2024 22:14:11 +0100 Subject: [PATCH 06/10] more linting --- .../ANDELSKASSEN_FALLESKASSEN_FAELDKK1.js | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/app-gocardless/banks/ANDELSKASSEN_FALLESKASSEN_FAELDKK1.js b/src/app-gocardless/banks/ANDELSKASSEN_FALLESKASSEN_FAELDKK1.js index 2215f0cc..b921663c 100644 --- a/src/app-gocardless/banks/ANDELSKASSEN_FALLESKASSEN_FAELDKK1.js +++ b/src/app-gocardless/banks/ANDELSKASSEN_FALLESKASSEN_FAELDKK1.js @@ -1,14 +1,14 @@ import { printIban, amountToInteger, - sortByBookingDateOrValueDate -} from '../utils.js' + sortByBookingDateOrValueDate, +} from '../utils.js'; /** @type {import('./bank.interface.js').IBank} */ export default { institutionIds: ['ANDELSKASSEN_FALLESKASSEN_FAELDKK1'], - normalizeAccount (account) { + normalizeAccount(account) { return { account_id: account.resourceId, institution: account.institution, @@ -16,8 +16,8 @@ export default { iban: account.iban, name: [account.name, printIban(account)].join(' '), official_name: account.product, - type: 'checking' - } + type: 'checking', + }; }, /** @@ -28,16 +28,16 @@ export default { * * [0]: https://nordigen.zendesk.com/hc/en-gb/articles/7899367372829-valueDate-and-bookingDate-for-transactions */ - normalizeTransaction (transaction, _booked) { + normalizeTransaction(transaction, _booked) { return { ...transaction, date: transaction.bookingDate, - remittanceInformationUnstructured: transaction.additionalInformation - } + remittanceInformationUnstructured: transaction.additionalInformation, + }; }, - sortTransactions (transactions = []) { - return sortByBookingDateOrValueDate(transactions) + sortTransactions(transactions = []) { + return sortByBookingDateOrValueDate(transactions); }, /** @@ -48,7 +48,7 @@ export default { * As a current balance we use `interimBooked` balance type because * it includes transaction placed during current day */ - calculateStartingBalance (sortedTransactions = [], balances = []) { + calculateStartingBalance(sortedTransactions = [], balances = []) { const currentBalance = balances.find( balance => 'closingBooked' === balance.balanceType ) From 7e47ff6601684b6a3e95bad731fbaed505676d0c Mon Sep 17 00:00:00 2001 From: circle3451 <93911635+circle3451@users.noreply.github.com> Date: Tue, 23 Jan 2024 22:18:05 +0100 Subject: [PATCH 07/10] more lint again --- .../banks/ANDELSKASSEN_FALLESKASSEN_FAELDKK1.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/app-gocardless/banks/ANDELSKASSEN_FALLESKASSEN_FAELDKK1.js b/src/app-gocardless/banks/ANDELSKASSEN_FALLESKASSEN_FAELDKK1.js index b921663c..f10210ff 100644 --- a/src/app-gocardless/banks/ANDELSKASSEN_FALLESKASSEN_FAELDKK1.js +++ b/src/app-gocardless/banks/ANDELSKASSEN_FALLESKASSEN_FAELDKK1.js @@ -50,11 +50,11 @@ export default { */ calculateStartingBalance(sortedTransactions = [], balances = []) { const currentBalance = balances.find( - balance => 'closingBooked' === balance.balanceType - ) + balance => 'closingBooked' === balance.balanceType, + ); return sortedTransactions.reduce((total, trans) => { - return total - amountToInteger(trans.transactionAmount.amount) - }, amountToInteger(currentBalance.balanceAmount.amount)) - } -} + return total - amountToInteger(trans.transactionAmount.amount); + }, amountToInteger(currentBalance.balanceAmount.amount)); + }, +}; From b2d8d04074397c195e3b9c37267060a0627127fa Mon Sep 17 00:00:00 2001 From: circle3451 <93911635+circle3451@users.noreply.github.com> Date: Tue, 23 Jan 2024 22:19:34 +0100 Subject: [PATCH 08/10] lint again --- src/app-gocardless/banks/ANDELSKASSEN_FALLESKASSEN_FAELDKK1.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app-gocardless/banks/ANDELSKASSEN_FALLESKASSEN_FAELDKK1.js b/src/app-gocardless/banks/ANDELSKASSEN_FALLESKASSEN_FAELDKK1.js index f10210ff..1a340b2e 100644 --- a/src/app-gocardless/banks/ANDELSKASSEN_FALLESKASSEN_FAELDKK1.js +++ b/src/app-gocardless/banks/ANDELSKASSEN_FALLESKASSEN_FAELDKK1.js @@ -50,7 +50,7 @@ export default { */ calculateStartingBalance(sortedTransactions = [], balances = []) { const currentBalance = balances.find( - balance => 'closingBooked' === balance.balanceType, + (balance) => 'closingBooked' === balance.balanceType, ); return sortedTransactions.reduce((total, trans) => { From 7e77cb973ec4d16934d9e1207c00b9957ed51196 Mon Sep 17 00:00:00 2001 From: lassegh Date: Tue, 23 Jan 2024 22:27:27 +0100 Subject: [PATCH 09/10] Added faelleskassen to sparnord config --- .../ANDELSKASSEN_FALLESKASSEN_FAELDKK1.js | 60 ------------------- src/app-gocardless/banks/sparnord-spnodk22.js | 2 +- 2 files changed, 1 insertion(+), 61 deletions(-) delete mode 100644 src/app-gocardless/banks/ANDELSKASSEN_FALLESKASSEN_FAELDKK1.js diff --git a/src/app-gocardless/banks/ANDELSKASSEN_FALLESKASSEN_FAELDKK1.js b/src/app-gocardless/banks/ANDELSKASSEN_FALLESKASSEN_FAELDKK1.js deleted file mode 100644 index 1a340b2e..00000000 --- a/src/app-gocardless/banks/ANDELSKASSEN_FALLESKASSEN_FAELDKK1.js +++ /dev/null @@ -1,60 +0,0 @@ -import { - printIban, - amountToInteger, - sortByBookingDateOrValueDate, -} from '../utils.js'; - -/** @type {import('./bank.interface.js').IBank} */ -export default { - institutionIds: ['ANDELSKASSEN_FALLESKASSEN_FAELDKK1'], - - normalizeAccount(account) { - return { - account_id: account.resourceId, - institution: account.institution, - mask: account.iban.slice(-4), - iban: account.iban, - name: [account.name, printIban(account)].join(' '), - official_name: account.product, - type: 'checking', - }; - }, - - /** - * Following the GoCardless documentation[0] we should prefer `bookingDate` - * here, though some of their bank integrations uses the date field - * differently from what's describen in their documentation and so it's - * sometimes necessary to use `valueDate` instead. - * - * [0]: https://nordigen.zendesk.com/hc/en-gb/articles/7899367372829-valueDate-and-bookingDate-for-transactions - */ - normalizeTransaction(transaction, _booked) { - return { - ...transaction, - date: transaction.bookingDate, - remittanceInformationUnstructured: transaction.additionalInformation, - }; - }, - - sortTransactions(transactions = []) { - return sortByBookingDateOrValueDate(transactions); - }, - - /** - * For SANDBOXFINANCE_SFIN0000 we don't know what balance was - * after each transaction so we have to calculate it by getting - * current balance from the account and subtract all the transactions - * - * As a current balance we use `interimBooked` balance type because - * it includes transaction placed during current day - */ - calculateStartingBalance(sortedTransactions = [], balances = []) { - const currentBalance = balances.find( - (balance) => 'closingBooked' === balance.balanceType, - ); - - return sortedTransactions.reduce((total, trans) => { - return total - amountToInteger(trans.transactionAmount.amount); - }, amountToInteger(currentBalance.balanceAmount.amount)); - }, -}; diff --git a/src/app-gocardless/banks/sparnord-spnodk22.js b/src/app-gocardless/banks/sparnord-spnodk22.js index 769bada8..d8271fd3 100644 --- a/src/app-gocardless/banks/sparnord-spnodk22.js +++ b/src/app-gocardless/banks/sparnord-spnodk22.js @@ -16,7 +16,7 @@ const SORTED_BALANCE_TYPE_LIST = [ /** @type {import('./bank.interface.js').IBank} */ export default { - institutionIds: ['SPARNORD_SPNODK22', 'LAGERNES_BANK_LAPNDKK1'], + institutionIds: ['SPARNORD_SPNODK22', 'LAGERNES_BANK_LAPNDKK1', 'ANDELSKASSEN_FALLESKASSEN_FAELDKK1'], normalizeAccount(account) { return { From 971b107ebcdd97773dc453a6433913face2ae2cf Mon Sep 17 00:00:00 2001 From: lassegh Date: Tue, 23 Jan 2024 22:44:47 +0100 Subject: [PATCH 10/10] lint --- src/app-gocardless/banks/sparnord-spnodk22.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/app-gocardless/banks/sparnord-spnodk22.js b/src/app-gocardless/banks/sparnord-spnodk22.js index d8271fd3..5596ba88 100644 --- a/src/app-gocardless/banks/sparnord-spnodk22.js +++ b/src/app-gocardless/banks/sparnord-spnodk22.js @@ -16,7 +16,11 @@ const SORTED_BALANCE_TYPE_LIST = [ /** @type {import('./bank.interface.js').IBank} */ export default { - institutionIds: ['SPARNORD_SPNODK22', 'LAGERNES_BANK_LAPNDKK1', 'ANDELSKASSEN_FALLESKASSEN_FAELDKK1'], + institutionIds: [ + 'SPARNORD_SPNODK22', + 'LAGERNES_BANK_LAPNDKK1', + 'ANDELSKASSEN_FALLESKASSEN_FAELDKK1', + ], normalizeAccount(account) { return {