mirror of
https://github.com/pretix/pretix.git
synced 2026-08-16 11:46:27 +00:00
Consistently include other fees in percentual payment fee
This commit is contained in:
@@ -249,9 +249,7 @@ class BasePaymentProvider:
|
|||||||
('_fee_percent',
|
('_fee_percent',
|
||||||
forms.DecimalField(
|
forms.DecimalField(
|
||||||
label=_('Additional fee'),
|
label=_('Additional fee'),
|
||||||
help_text=_('Percentage of the order total. Note that this percentage will currently only '
|
help_text=_('Percentage of the order total.'),
|
||||||
'be calculated on the summed price of sold tickets, not on other fees like e.g. shipping '
|
|
||||||
'fees, if there are any.'),
|
|
||||||
localize=True,
|
localize=True,
|
||||||
required=False,
|
required=False,
|
||||||
)),
|
)),
|
||||||
|
|||||||
@@ -938,6 +938,11 @@ def update_tax_rates(event: Event, cart_id: str, invoice_address: InvoiceAddress
|
|||||||
def get_fees(event, request, total, invoice_address, provider):
|
def get_fees(event, request, total, invoice_address, provider):
|
||||||
fees = []
|
fees = []
|
||||||
|
|
||||||
|
for recv, resp in fee_calculation_for_cart.send(sender=event, request=request, invoice_address=invoice_address,
|
||||||
|
total=total):
|
||||||
|
fees += resp
|
||||||
|
|
||||||
|
total = total + sum(f.value for f in fees)
|
||||||
if provider and total != 0:
|
if provider and total != 0:
|
||||||
provider = event.get_payment_providers().get(provider)
|
provider = event.get_payment_providers().get(provider)
|
||||||
if provider:
|
if provider:
|
||||||
@@ -963,10 +968,6 @@ def get_fees(event, request, total, invoice_address, provider):
|
|||||||
tax_rule=payment_fee_tax_rule
|
tax_rule=payment_fee_tax_rule
|
||||||
))
|
))
|
||||||
|
|
||||||
for recv, resp in fee_calculation_for_cart.send(sender=event, request=request, invoice_address=invoice_address,
|
|
||||||
total=total):
|
|
||||||
fees += resp
|
|
||||||
|
|
||||||
return fees
|
return fees
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -591,6 +591,12 @@ def _get_fees(positions: List[CartPosition], payment_provider: BasePaymentProvid
|
|||||||
meta_info: dict, event: Event):
|
meta_info: dict, event: Event):
|
||||||
fees = []
|
fees = []
|
||||||
total = sum([c.price for c in positions])
|
total = sum([c.price for c in positions])
|
||||||
|
|
||||||
|
for recv, resp in order_fee_calculation.send(sender=event, invoice_address=address, total=total,
|
||||||
|
meta_info=meta_info, positions=positions):
|
||||||
|
fees += resp
|
||||||
|
|
||||||
|
total += sum(f.value for f in fees)
|
||||||
if payment_provider:
|
if payment_provider:
|
||||||
payment_fee = payment_provider.calculate_fee(total)
|
payment_fee = payment_provider.calculate_fee(total)
|
||||||
else:
|
else:
|
||||||
@@ -601,9 +607,6 @@ def _get_fees(positions: List[CartPosition], payment_provider: BasePaymentProvid
|
|||||||
internal_type=payment_provider.identifier)
|
internal_type=payment_provider.identifier)
|
||||||
fees.append(pf)
|
fees.append(pf)
|
||||||
|
|
||||||
for recv, resp in order_fee_calculation.send(sender=event, invoice_address=address, total=total,
|
|
||||||
meta_info=meta_info, positions=positions):
|
|
||||||
fees += resp
|
|
||||||
return fees, pf
|
return fees, pf
|
||||||
|
|
||||||
|
|
||||||
@@ -1377,6 +1380,14 @@ class OrderChangeManager:
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
split_order.total = sum([p.price for p in split_positions if not p.canceled])
|
split_order.total = sum([p.price for p in split_positions if not p.canceled])
|
||||||
|
|
||||||
|
for fee in self.order.fees.exclude(fee_type=OrderFee.FEE_TYPE_PAYMENT):
|
||||||
|
new_fee = modelcopy(fee)
|
||||||
|
new_fee.pk = None
|
||||||
|
new_fee.order = split_order
|
||||||
|
split_order.total += new_fee.value
|
||||||
|
new_fee.save()
|
||||||
|
|
||||||
if split_order.total != Decimal('0.00') and self.order.status != Order.STATUS_PAID:
|
if split_order.total != Decimal('0.00') and self.order.status != Order.STATUS_PAID:
|
||||||
pp = self._get_payment_provider()
|
pp = self._get_payment_provider()
|
||||||
if pp:
|
if pp:
|
||||||
@@ -1392,13 +1403,6 @@ class OrderChangeManager:
|
|||||||
fee.delete()
|
fee.delete()
|
||||||
split_order.total += fee.value
|
split_order.total += fee.value
|
||||||
|
|
||||||
for fee in self.order.fees.exclude(fee_type=OrderFee.FEE_TYPE_PAYMENT):
|
|
||||||
new_fee = modelcopy(fee)
|
|
||||||
new_fee.pk = None
|
|
||||||
new_fee.order = split_order
|
|
||||||
split_order.total += new_fee.value
|
|
||||||
new_fee.save()
|
|
||||||
|
|
||||||
split_order.save()
|
split_order.save()
|
||||||
|
|
||||||
if split_order.status == Order.STATUS_PAID:
|
if split_order.status == Order.STATUS_PAID:
|
||||||
|
|||||||
Reference in New Issue
Block a user