chagne account to vendor

This commit is contained in:
bel
2021-07-29 22:58:01 -06:00
parent c5c77a2b9b
commit cea7a30884
3 changed files with 17 additions and 17 deletions

View File

@@ -9,15 +9,15 @@ import (
)
type Transaction struct {
ID string
Bank Bank
Amount string
Account string
Date string
ID string
Bank Bank
Amount string
Vendor string
Date string
}
func (t *Transaction) Format() string {
return fmt.Sprintf("(%s) %v: %s @ %s", cleanDate(t.Date), t.Bank, t.Amount, t.Account)
return fmt.Sprintf("(%s) %v: %s @ %s", cleanDate(t.Date), t.Bank, t.Amount, t.Vendor)
}
func (t *Transaction) String() string {
@@ -27,10 +27,10 @@ func (t *Transaction) String() string {
func NewTransaction(amount, account, date string, bank Bank) *Transaction {
regexp := regexp.MustCompile(`\s\s+`)
t := &Transaction{
Amount: regexp.ReplaceAllString(amount, " "),
Account: regexp.ReplaceAllString(account, " "),
Bank: bank,
Date: date,
Amount: regexp.ReplaceAllString(amount, " "),
Vendor: regexp.ReplaceAllString(account, " "),
Bank: bank,
Date: date,
}
t.ID = fmt.Sprintf("%x", md5.Sum([]byte(fmt.Sprint(t))))
return t