From b7c242b8f3edbe7217205fb55acc7cd7bea6a03a Mon Sep 17 00:00:00 2001 From: Thomas Hollstegge Date: Wed, 3 Apr 2019 15:38:03 +0200 Subject: [PATCH] Relative fees: Round fee to event currency decimal places --- pretix_servicefees/signals.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pretix_servicefees/signals.py b/pretix_servicefees/signals.py index ec6588d..cecbc6e 100644 --- a/pretix_servicefees/signals.py +++ b/pretix_servicefees/signals.py @@ -4,6 +4,7 @@ from django.urls import resolve, reverse from django.dispatch import receiver from django.http import HttpRequest from django.utils.translation import ugettext_lazy as _, ugettext, get_language +from pretix.base.decimal import round_decimal from pretix.base.models import Event, Order, TaxRule from pretix.base.models.orders import OrderFee from pretix.base.signals import order_fee_calculation @@ -35,7 +36,7 @@ def get_fees(event, total, invoice_address, mod=''): fee_percent = event.settings.get('service_fee_percent', as_type=Decimal) if fee_abs and fee_percent and total != Decimal('0.00'): - fee = fee_abs + total * (fee_percent / 100) + 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): tax = tax_rule.tax(fee)