From 9786f96fe58d2884405a775c97ceedbb6b02d0ea Mon Sep 17 00:00:00 2001 From: MaysWind Date: Thu, 27 Feb 2025 22:11:19 +0800 Subject: [PATCH] trim trailing zero in transaction amount when importing OFX file (#73) --- pkg/converters/ofx/ofx_transaction_table.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/converters/ofx/ofx_transaction_table.go b/pkg/converters/ofx/ofx_transaction_table.go index d8e0db85..05e0794e 100644 --- a/pkg/converters/ofx/ofx_transaction_table.go +++ b/pkg/converters/ofx/ofx_transaction_table.go @@ -152,9 +152,10 @@ func (t *ofxTransactionDataRowIterator) parseTransaction(ctx core.Context, user return nil, errs.ErrAmountInvalid } - amount, err := utils.ParseAmount(strings.ReplaceAll(ofxTransaction.Amount, ",", ".")) // ofx supports decimal point or comma to indicate the start of the fractional amount + amount, err := utils.ParseAmount(utils.TrimTrailingZerosInDecimal(strings.ReplaceAll(ofxTransaction.Amount, ",", "."))) // ofx supports decimal point or comma to indicate the start of the fractional amount if err != nil { + log.Errorf(ctx, "[ofx_transaction_table.parseTransaction] cannot parsing transaction amount \"%s\", because %s", ofxTransaction.Amount, err.Error()) return nil, errs.ErrAmountInvalid }