From 0a42b53b2d7522f620deefcd4dfe1fe5d5a32bdf Mon Sep 17 00:00:00 2001 From: andig Date: Sun, 23 Jun 2024 17:05:54 +0200 Subject: [PATCH] Tariffs: add tax only on positive prices (#14527) --- tariff/embed.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tariff/embed.go b/tariff/embed.go index 5b171e220..9072a19c8 100644 --- a/tariff/embed.go +++ b/tariff/embed.go @@ -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 }