mirror of
https://github.com/pretix/pretix.git
synced 2026-05-05 15:14:04 +00:00
PPv2: Include other fees than payment fees into the XHR-calculation
This commit is contained in:
@@ -525,7 +525,7 @@ class PaypalMethod(BasePaymentProvider):
|
||||
)
|
||||
request.session['payment_paypal_payment'] = payment.pk
|
||||
elif cart and not payment:
|
||||
value = self.format_price(cart['total'] + cart['fee'])
|
||||
value = self.format_price(cart['cart_total'] + cart['cart_fees'] + cart['payment_fee'])
|
||||
currency = request.event.currency
|
||||
description = __('Event tickets for {event}').format(event=request.event.name)
|
||||
custom_id = '{prefix}{slug}{postfix}'.format(
|
||||
|
||||
@@ -57,6 +57,7 @@ from paypalcheckoutsdk import orders as pp_orders, payments as pp_payments
|
||||
|
||||
from pretix.base.models import Event, Order, OrderPayment, OrderRefund, Quota
|
||||
from pretix.base.payment import PaymentException
|
||||
from pretix.base.services.cart import get_fees
|
||||
from pretix.base.settings import GlobalSettingsObject
|
||||
from pretix.control.permissions import event_permission_required
|
||||
from pretix.multidomain.urlreverse import eventreverse
|
||||
@@ -142,14 +143,21 @@ class XHRView(View):
|
||||
|
||||
cart = {
|
||||
'positions': order.positions,
|
||||
'total': order.pending_sum,
|
||||
'fee': fee,
|
||||
'cart_total': order.pending_sum,
|
||||
'cart_fees': Decimal('0.00'),
|
||||
'payment_fee': fee,
|
||||
}
|
||||
else:
|
||||
cart_total = get_cart_total(request)
|
||||
cart_fees = Decimal('0.00')
|
||||
for fee in get_fees(request.event, request, get_cart_total(request), None, prov, get_cart(request)):
|
||||
cart_fees += fee.value
|
||||
|
||||
cart = {
|
||||
'positions': get_cart(request),
|
||||
'total': get_cart_total(request),
|
||||
'fee': prov.calculate_fee(get_cart_total(request)),
|
||||
'cart_total': cart_total,
|
||||
'cart_fees': cart_fees,
|
||||
'payment_fee': prov.calculate_fee(cart_total + cart_fees),
|
||||
}
|
||||
|
||||
paypal_order = prov._create_paypal_order(request, None, cart)
|
||||
|
||||
Reference in New Issue
Block a user