test new and old scrape for chase
This commit is contained in:
@@ -9,28 +9,30 @@ import (
|
||||
)
|
||||
|
||||
type Transaction struct {
|
||||
ID string
|
||||
Bank Bank
|
||||
Amount string
|
||||
Vendor string
|
||||
Date string
|
||||
ID string
|
||||
Bank Bank
|
||||
Amount string
|
||||
Vendor string
|
||||
Date string
|
||||
Account string
|
||||
}
|
||||
|
||||
func (t *Transaction) Format() string {
|
||||
return fmt.Sprintf("(%s) %v: %s @ %s", cleanDate(t.Date), t.Bank, t.Amount, t.Vendor)
|
||||
return fmt.Sprintf("(%s) %v/%v: %s @ %s", cleanDate(t.Date), t.Account, t.Bank, t.Amount, t.Vendor)
|
||||
}
|
||||
|
||||
func (t *Transaction) String() string {
|
||||
return fmt.Sprint(*t)
|
||||
}
|
||||
|
||||
func NewTransaction(amount, account, date string, bank Bank) *Transaction {
|
||||
func NewTransaction(account, amount, vendor, date string, bank Bank) *Transaction {
|
||||
regexp := regexp.MustCompile(`\s\s+`)
|
||||
t := &Transaction{
|
||||
Amount: regexp.ReplaceAllString(amount, " "),
|
||||
Vendor: regexp.ReplaceAllString(account, " "),
|
||||
Bank: bank,
|
||||
Date: date,
|
||||
Account: account,
|
||||
Amount: regexp.ReplaceAllString(amount, " "),
|
||||
Vendor: regexp.ReplaceAllString(vendor, " "),
|
||||
Bank: bank,
|
||||
Date: date,
|
||||
}
|
||||
t.ID = fmt.Sprintf("%x", md5.Sum([]byte(fmt.Sprint(t))))
|
||||
return t
|
||||
|
||||
Reference in New Issue
Block a user