Tariffs: add tax only on positive prices (#14527)

This commit is contained in:
andig 2024-06-23 17:05:54 +02:00 • committed by GitHub
parent 22540409c1
commit 0a42b53b2d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -6,5 +6,9 @@ type embed struct {
}
func (t *embed) totalPrice(price float64) float64 {
return (price + t.Charges) * (1 + t.Tax)
total := price + t.Charges
if total > 0 {
total *= 1 + t.Tax
}
return total
}