Fixed transaction dates in bank sync with MBANK_RETAIL_BREXPLPW (#4493)

* fixed transaction date for MBANK_RETAIL_BREXPLPW

* cleared up imports after previous commit (9251d3e1)

* added release notes

* linted code

* Update packages/sync-server/src/app-gocardless/banks/mbank_retail_brexplpw.js

Co-authored-by: Matt Fiddaman <github@m.fiddaman.uk>

---------

Co-authored-by: Matt Fiddaman <github@m.fiddaman.uk>
This commit is contained in:
Szymon Romanko
2025-03-04 13:34:01 +01:00
committed by GitHub
parent abb6e86f35
commit 9e82032595
2 changed files with 28 additions and 0 deletions

View File

@@ -8,6 +8,28 @@ 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) {
const editedTrans = { ...transaction };
const date =
transaction.valueDate ||
transaction.valueDateTime ||
transaction.bookingDate ||
transaction.bookingDateTime;
editedTrans.date = date;
return Fallback.normalizeTransaction(transaction, booked, editedTrans);
},
sortTransactions(transactions = []) {
return transactions.sort(
(a, b) => Number(b.transactionId) - Number(a.transactionId),

View File

@@ -0,0 +1,6 @@
---
category: Bugfix
authors: [szymon-romanko]
---
Fixed transaction dates for bank sync with mbank_retail_brexplpw