M parser/amex/interface.go => parser/amex/interface.go +2 -1
@@ 11,7 11,8 @@ func (tx Transaction) Date() time.Time {
}
func (tx Transaction) Amount() float64 {
- return tx.Raw.Amount
+ // amex is inverted, positive is debit, negative is credit
+ return -tx.Raw.Amount
}
func (tx Transaction) Name() string {
M parser/capitalone/interface.go => parser/capitalone/interface.go +3 -3
@@ 13,17 13,17 @@ func (tx Transaction) Date() time.Time {
func (tx Transaction) Amount() float64 {
if tx.Debit != 0 {
- return tx.Debit
+ return -tx.Debit
}
if tx.Credit != 0 {
- return -tx.Credit
+ return tx.Credit
}
// TODO
panic("both credit and debit are zero: " + fmt.Sprintln(tx))
- return tx.Debit
+ return -tx.Debit
}
func (tx Transaction) Name() string {
M parser/personal/interface.go => parser/personal/interface.go +1 -0
@@ 11,6 11,7 @@ func (tx Transaction) Date() time.Time {
}
func (tx Transaction) Amount() float64 {
+ // TODO: should it be negative?
return tx.Raw.Amount
}
M transaction.go => transaction.go +1 -1
@@ 6,7 6,7 @@ import (
type Transaction interface {
Date() time.Time
- Amount() float64
+ Amount() float64 // positive for credit, negative for debit
Name() string
Category() string