From 6b961fd7318cc522ac12de83498c1e6c2316ac68 Mon Sep 17 00:00:00 2001 From: "Baruch Odem (Rothkoff)" Date: Tue, 2 May 2023 15:01:34 +0300 Subject: [PATCH] fix: visa Cal wrong day of transaction, and missing fields (#783) --- src/scrapers/visa-cal.ts | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/scrapers/visa-cal.ts b/src/scrapers/visa-cal.ts index 3db76b67..53a376fb 100644 --- a/src/scrapers/visa-cal.ts +++ b/src/scrapers/visa-cal.ts @@ -199,20 +199,21 @@ function convertParsedDataToTransactions(parsedData: CardTransactionDetails[]): } const result: Transaction = { - chargedAmount, identifier: transaction.trnIntId, - description: transaction.merchantName, - originalAmount, - originalCurrency: transaction.trnCurrencySymbol, - processedDate: transaction.debCrdDate, + type: [trnTypeCode.regular, trnTypeCode.standingOrder].includes(transaction.trnTypeCode) ? + TransactionTypes.Normal : + TransactionTypes.Installments, status: TransactionStatuses.Completed, date: installments ? date.add(installments.number - 1, 'month').toISOString() : date.toISOString(), - type: [trnTypeCode.regular, trnTypeCode.standingOrder].includes(transaction.trnTypeCode) ? - TransactionTypes.Normal : - TransactionTypes.Installments, - memo: transaction.transTypeCommentDetails.toString() || undefined, + processedDate: new Date(transaction.debCrdDate).toISOString(), + originalAmount, + originalCurrency: transaction.trnCurrencySymbol, + chargedAmount, + chargedCurrency: transaction.debCrdCurrencySymbol, + description: transaction.merchantName, + memo: transaction.transTypeCommentDetails.toString(), category: transaction.branchCodeDesc, };