feat: salvar data original da transação e data de vencimento no cartão
Ao importar fatura de cartão com PaymentDate configurado, a data efetiva da transação passa a ser o vencimento e a data de compra é preservada em original_date. Migration 013 adiciona a coluna original_date em transactions. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
This commit is contained in:
@@ -96,11 +96,20 @@ func ParseCSV(r io.Reader, m model.CSVMapping) ([]model.ImportRow, []string) {
|
||||
txType = "income"
|
||||
}
|
||||
|
||||
purchaseDate := t.Format("2006-01-02")
|
||||
effectiveDate := purchaseDate
|
||||
originalDate := ""
|
||||
if m.PaymentDate != "" {
|
||||
effectiveDate = m.PaymentDate
|
||||
originalDate = purchaseDate
|
||||
}
|
||||
|
||||
rows = append(rows, model.ImportRow{
|
||||
Date: t.Format("2006-01-02"),
|
||||
Amount: math.Abs(amt),
|
||||
Description: desc,
|
||||
Type: txType,
|
||||
Date: effectiveDate,
|
||||
OriginalDate: originalDate,
|
||||
Amount: math.Abs(amt),
|
||||
Description: desc,
|
||||
Type: txType,
|
||||
})
|
||||
}
|
||||
return rows, errs
|
||||
|
||||
Reference in New Issue
Block a user