diff --git a/bill/payment.go b/bill/payment.go index dec3d473..e643b91d 100644 --- a/bill/payment.go +++ b/bill/payment.go @@ -55,6 +55,7 @@ func (p *Payment) totalAdvance(zero num.Amount) *num.Amount { for _, a := range p.Advances { sum = sum.MatchPrecision(a.Amount) sum = sum.Add(a.Amount) + a.Amount = a.Amount.Rescale(zero.Exp()) } return &sum } diff --git a/bill/payment_test.go b/bill/payment_test.go index a9b27543..7e170e93 100644 --- a/bill/payment_test.go +++ b/bill/payment_test.go @@ -66,7 +66,7 @@ func TestPaymentCalculations(t *testing.T) { p.calculateAdvances(zero, total) a := p.totalAdvance(zero) + assert.Equal(t, "20.85", p.Advances[0].Amount.String()) assert.Equal(t, "20.845", a.String()) - }) }