Skip to content
This repository was archived by the owner on Feb 10, 2025. It is now read-only.

Commit 33c204d

Browse files
authored
Extend bank adapter for SEB Kort (#350)
1 parent 41a34d0 commit 33c204d

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

src/app-gocardless/banks/seb-kort-bank-ab.js

+8-4
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66

77
/** @type {import('./bank.interface.js').IBank} */
88
export default {
9-
institutionIds: ['SEB_KORT_AB_SE_SKHSFI21'],
9+
institutionIds: ['SEB_KORT_AB_NO_SKHSFI21', 'SEB_KORT_AB_SE_SKHSFI21'],
1010

1111
accessValidForDays: 180,
1212

@@ -44,11 +44,11 @@ export default {
4444
},
4545

4646
/**
47-
* For SEB_KORT_AB_SE_SKHSFI21 we don't know what balance was
47+
* For SEB_KORT_AB_NO_SKHSFI21 and SEB_KORT_AB_SE_SKHSFI21 we don't know what balance was
4848
* after each transaction so we have to calculate it by getting
4949
* current balance from the account and subtract all the transactions
5050
*
51-
* As a current balance we use `expected` balance type because it
51+
* As a current balance we use `expected` and `nonInvoiced` balance types because it
5252
* corresponds to the current running balance, whereas `interimAvailable`
5353
* holds the remaining credit limit.
5454
*/
@@ -57,8 +57,12 @@ export default {
5757
(balance) => 'expected' === balance.balanceType,
5858
);
5959

60+
const nonInvoiced = balances.find(
61+
(balance) => 'nonInvoiced' === balance.balanceType,
62+
);
63+
6064
return sortedTransactions.reduce((total, trans) => {
6165
return total - amountToInteger(trans.transactionAmount.amount);
62-
}, -amountToInteger(currentBalance.balanceAmount.amount));
66+
}, -amountToInteger(currentBalance.balanceAmount.amount) + amountToInteger(nonInvoiced.balanceAmount.amount));
6367
},
6468
};

upcoming-release-notes/350.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
category: Enhancements
3+
authors: [jakoblover]
4+
---
5+
6+
Extended bank adapter for SEB to support SEB_KORT_AB_NO_SKHSFI21

0 commit comments

Comments
 (0)