implement transaction.go:Transaction:isRefund
This commit is contained in:
@@ -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
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user