implement transaction.go:Transaction:isRefund
parent
98b1ddcbaf
commit
8a469d4735
|
|
@ -24,7 +24,7 @@ type Transaction struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (trn Transaction) String() string {
|
func (trn Transaction) String() string {
|
||||||
if trn.Amount < 0 {
|
if trn.isRefund() {
|
||||||
return trn.stringifyRefund()
|
return trn.stringifyRefund()
|
||||||
}
|
}
|
||||||
return trn.stringifyExpense()
|
return trn.stringifyExpense()
|
||||||
|
|
@ -43,6 +43,10 @@ func (trn Transaction) stringifyCardholder() string {
|
||||||
return fmt.Sprintf("%s. %s", trn.CardholderFirstInitial, trn.CardholderLastName)
|
return fmt.Sprintf("%s. %s", trn.CardholderFirstInitial, trn.CardholderLastName)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (trn Transaction) isRefund() bool {
|
||||||
|
return trn.Amount < 0
|
||||||
|
}
|
||||||
|
|
||||||
// Transactions represents a list of Transaction
|
// Transactions represents a list of Transaction
|
||||||
type Transactions []Transaction
|
type Transactions []Transaction
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue