chagne account to vendor
This commit is contained in:
@@ -12,12 +12,12 @@ type Transaction struct {
|
||||
ID string
|
||||
Bank Bank
|
||||
Amount string
|
||||
Account 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 {
|
||||
@@ -28,7 +28,7 @@ func NewTransaction(amount, account, date string, bank Bank) *Transaction {
|
||||
regexp := regexp.MustCompile(`\s\s+`)
|
||||
t := &Transaction{
|
||||
Amount: regexp.ReplaceAllString(amount, " "),
|
||||
Account: regexp.ReplaceAllString(account, " "),
|
||||
Vendor: regexp.ReplaceAllString(account, " "),
|
||||
Bank: bank,
|
||||
Date: date,
|
||||
}
|
||||
|
||||
@@ -60,8 +60,8 @@ func uploadLedger(config Config, transaction *Transaction) error {
|
||||
if amount > 0 {
|
||||
remote = "Deposit:"
|
||||
}
|
||||
remote += strings.ReplaceAll(transaction.Account, " ", "")
|
||||
fmt.Fprintf(f, "%-50s%-s\n", formatGMailDate(transaction.Date), transaction.Account)
|
||||
remote += strings.ReplaceAll(transaction.Vendor, " ", "")
|
||||
fmt.Fprintf(f, "%-50s%-s\n", formatGMailDate(transaction.Date), transaction.Vendor)
|
||||
fmt.Fprintf(f, "%-50s%-50s$%.2f\n", "", "AssetAccount:"+transaction.Bank.String(), amount)
|
||||
fmt.Fprintf(f, "%-50s%-s\n", "", remote)
|
||||
return nil
|
||||
|
||||
@@ -18,7 +18,7 @@ func TestUploadLedger(t *testing.T) {
|
||||
ID: uuid.New().String(),
|
||||
Bank: Chase,
|
||||
Amount: "1.10",
|
||||
Account: "account",
|
||||
Vendor: "vendor",
|
||||
Date: "today",
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user