Relative fees: Round fee to event currency decimal places

This commit is contained in:
Thomas Hollstegge 2019-04-03 15:38:03 +02:00
parent dc6f8ee299
commit b7c242b8f3

View file

@ -4,6 +4,7 @@ from django.urls import resolve, reverse
from django.dispatch import receiver from django.dispatch import receiver
from django.http import HttpRequest from django.http import HttpRequest
from django.utils.translation import ugettext_lazy as _, ugettext, get_language 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 import Event, Order, TaxRule
from pretix.base.models.orders import OrderFee from pretix.base.models.orders import OrderFee
from pretix.base.signals import order_fee_calculation 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) fee_percent = event.settings.get('service_fee_percent', as_type=Decimal)
if fee_abs and fee_percent and total != Decimal('0.00'): 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() tax_rule = event.settings.tax_rate_default or TaxRule.zero()
if tax_rule.tax_applicable(invoice_address): if tax_rule.tax_applicable(invoice_address):
tax = tax_rule.tax(fee) tax = tax_rule.tax(fee)