From 17e418e8b8438689f8b0aa3e7ac0608ca8a7b6e5 Mon Sep 17 00:00:00 2001 From: Thomas Hollstegge Date: Wed, 3 Apr 2019 17:06:17 +0200 Subject: [PATCH] Correctly calculate fees if one of them is zero --- pretix_servicefees/signals.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pretix_servicefees/signals.py b/pretix_servicefees/signals.py index cecbc6e..974b2b4 100644 --- a/pretix_servicefees/signals.py +++ b/pretix_servicefees/signals.py @@ -35,7 +35,10 @@ def get_fees(event, total, invoice_address, mod=''): if mod and fee_percent is None: fee_percent = event.settings.get('service_fee_percent', as_type=Decimal) - if fee_abs and fee_percent and total != Decimal('0.00'): + fee_abs = Decimal("0") if fee_abs is None else fee_abs + fee_percent = Decimal("0") if fee_percent is None else fee_percent + + if (fee_abs or fee_percent) and total != Decimal('0.00'): fee = round_decimal(fee_abs + total * (fee_percent / 100), event.currency) tax_rule = event.settings.tax_rate_default or TaxRule.zero() if tax_rule.tax_applicable(invoice_address):