mirror of
https://github.com/actualbudget/actual.git
synced 2026-05-10 16:26:43 -05:00
fixed transaction date for MBANK_RETAIL_BREXPLPW
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { amountToInteger } from '../utils.js';
|
||||
import { amountToInteger, printIban } from '../utils.js';
|
||||
|
||||
import Fallback from './integration-bank.js';
|
||||
import { formatPayeeName } from '../../util/payee-name.js';
|
||||
|
||||
/** @type {import('./bank.interface.js').IBank} */
|
||||
export default {
|
||||
@@ -8,6 +9,31 @@ export default {
|
||||
|
||||
institutionIds: ['MBANK_RETAIL_BREXPLPW'],
|
||||
|
||||
|
||||
/**
|
||||
* When requesting transaction details for MBANK_RETAIL_BREXPLPW
|
||||
* using gocardless API, it seems that bookingDate and valueDate are swapped.
|
||||
* valueDate will always come before bookingDate, so as a simple fix,
|
||||
* I have overwritten integration-bank.normalizeTransaction() here,
|
||||
* swapped dates back (by giving valueDate higher priority) and
|
||||
* called parent method with edited transaction as argument
|
||||
*/
|
||||
normalizeTransaction(transaction, _booked, editedTransaction = null) {
|
||||
const trans = editedTransaction ?? transaction;
|
||||
|
||||
|
||||
const date =
|
||||
trans.date ||
|
||||
transaction.valueDate || // swapped this
|
||||
transaction.valueDateTime ||
|
||||
transaction.bookingDate || // with that
|
||||
transaction.bookingDateTime;
|
||||
|
||||
trans.date = date;
|
||||
|
||||
return Fallback.normalizeTransaction(transaction, _booked, trans);
|
||||
},
|
||||
|
||||
sortTransactions(transactions = []) {
|
||||
return transactions.sort(
|
||||
(a, b) => Number(b.transactionId) - Number(a.transactionId),
|
||||
|
||||
Reference in New Issue
Block a user