From dc537e5bc0a6044926a4cbc51a5d72d2cd1dec15 Mon Sep 17 00:00:00 2001 From: Guglielmo Caprotti Date: Fri, 29 Nov 2024 10:06:54 +0000 Subject: [PATCH] fixed p2p/bon remittance info, moved transaction date setter --- src/app-gocardless/banks/hype_hyeeit22.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/app-gocardless/banks/hype_hyeeit22.js b/src/app-gocardless/banks/hype_hyeeit22.js index c975aa341..2d8b2412a 100644 --- a/src/app-gocardless/banks/hype_hyeeit22.js +++ b/src/app-gocardless/banks/hype_hyeeit22.js @@ -11,8 +11,6 @@ export default { accessValidForDays: 90, normalizeTransaction(transaction, _booked) { - // PREFER valueDate - transaction.bookingDate = transaction.valueDate ?? transaction.bookingDate; /** Online card payments - identified by "crd" transaction code * always start with PAGAMENTO PRESSO + @@ -36,9 +34,10 @@ export default { // keep only {payment_info} portion of remittance info // NOTE: if {payee_name} contains dashes (unlikely / impossible?), this probably gets bugged! let infoIdx = - transaction.remittanceInformationUnstructured.indexOf(' - ') + 1; + transaction.remittanceInformationUnstructured.indexOf(' - ') + 3; transaction.remittanceInformationUnstructured = - transaction.remittanceInformationUnstructured.slice(infoIdx).trim(); + infoIdx == -1 ? transaction.remittanceInformationUnstructured : + transaction.remittanceInformationUnstructured.slice(infoIdx).trim(); } /** * CONVERT ESCAPED UNICODE TO CODEPOINTS @@ -72,7 +71,7 @@ export default { return { ...transaction, payeeName: formatPayeeName(transaction), - date: transaction.bookingDate || transaction.valueDate, + date: transaction.valueDate || transaction.bookingDate, }; }, };