Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
circle3451 authored Jan 23, 2024
1 parent 1088575 commit 7d64c14
Showing 1 changed file with 59 additions and 59 deletions.
118 changes: 59 additions & 59 deletions src/app-gocardless/banks/ANDELSKASSEN_FALLESKASSEN_FAELDKK1.js
Original file line number Diff line number Diff line change
@@ -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));
},
};
printIban,
amountToInteger,
sortByBookingDateOrValueDate

Check failure on line 4 in src/app-gocardless/banks/ANDELSKASSEN_FALLESKASSEN_FAELDKK1.js

View workflow job for this annotation

GitHub Actions / lint

Insert `,`
} from '../utils.js'

Check failure on line 5 in src/app-gocardless/banks/ANDELSKASSEN_FALLESKASSEN_FAELDKK1.js

View workflow job for this annotation

GitHub Actions / lint

Insert `;`

/** @type {import('./bank.interface.js').IBank} */
export default {
institutionIds: ['ANDELSKASSEN_FALLESKASSEN_FAELDKK1'],

normalizeAccount (account) {

Check failure on line 11 in src/app-gocardless/banks/ANDELSKASSEN_FALLESKASSEN_FAELDKK1.js

View workflow job for this annotation

GitHub Actions / lint

Delete `·`
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'

Check failure on line 19 in src/app-gocardless/banks/ANDELSKASSEN_FALLESKASSEN_FAELDKK1.js

View workflow job for this annotation

GitHub Actions / lint

Insert `,`
}

Check failure on line 20 in src/app-gocardless/banks/ANDELSKASSEN_FALLESKASSEN_FAELDKK1.js

View workflow job for this annotation

GitHub Actions / lint

Insert `;`
},

/**
* 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) {

Check failure on line 31 in src/app-gocardless/banks/ANDELSKASSEN_FALLESKASSEN_FAELDKK1.js

View workflow job for this annotation

GitHub Actions / lint

Delete `·`
return {
...transaction,
date: transaction.bookingDate,
remittanceInformationUnstructured: transaction.additionalInformation

Check failure on line 35 in src/app-gocardless/banks/ANDELSKASSEN_FALLESKASSEN_FAELDKK1.js

View workflow job for this annotation

GitHub Actions / lint

Insert `,`
}

Check failure on line 36 in src/app-gocardless/banks/ANDELSKASSEN_FALLESKASSEN_FAELDKK1.js

View workflow job for this annotation

GitHub Actions / lint

Insert `;`
},

sortTransactions (transactions = []) {

Check failure on line 39 in src/app-gocardless/banks/ANDELSKASSEN_FALLESKASSEN_FAELDKK1.js

View workflow job for this annotation

GitHub Actions / lint

Delete `·`
return sortByBookingDateOrValueDate(transactions)

Check failure on line 40 in src/app-gocardless/banks/ANDELSKASSEN_FALLESKASSEN_FAELDKK1.js

View workflow job for this annotation

GitHub Actions / lint

Insert `;`
},

/**
* 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))
}
}

0 comments on commit 7d64c14

Please sign in to comment.