mirror of
https://github.com/pretix/pretix.git
synced 2026-08-13 11:17:01 +00:00
Apply suggestions from code review
Co-authored-by: pajowu <pajowu@pajowu.de>
This commit is contained in:
co-authored by
pajowu
parent
d85a2c877e
commit
33d1b47c5a
@@ -1037,7 +1037,7 @@ class BasePaymentProvider:
|
||||
if payment.state == OrderPayment.PAYMENT_STATE_PENDING:
|
||||
if not self.payment_abort_pending_allowed(payment):
|
||||
raise PaymentException(_(
|
||||
"This payment is already being processed and can not be canceled any more."
|
||||
"This payment is already being processed and cannot be canceled any more."
|
||||
))
|
||||
|
||||
payment.state = OrderPayment.PAYMENT_STATE_CANCELED
|
||||
|
||||
@@ -199,7 +199,7 @@ class PaypalSettingsHolder(BasePaymentProvider):
|
||||
help_text=_(
|
||||
'PayPals fraud prevention might block processing of individual payments for a considerable amount '
|
||||
'of time. The payment is marked as "pending" during this time window. You can allow your customers to '
|
||||
'start another payment attempts during that window. This might result in overpayment of orders if the'
|
||||
'start another payment attempts during that window. This might result in them being charged twice if the'
|
||||
'original payment is approved.'
|
||||
),
|
||||
required=False
|
||||
@@ -893,11 +893,7 @@ class PaypalMethod(BasePaymentProvider):
|
||||
|
||||
def payment_pending_render(self, request, payment) -> str:
|
||||
stuck_in_compliance = False
|
||||
retry = True
|
||||
|
||||
if payment.state == OrderPayment.PAYMENT_STATE_PENDING:
|
||||
retry = self.abort_pending_payment_allowed(payment) and self.abort_pending_allowed
|
||||
|
||||
retry = self.payment_abort_pending_allowed(payment)
|
||||
try:
|
||||
if (
|
||||
payment.info
|
||||
@@ -908,7 +904,7 @@ class PaypalMethod(BasePaymentProvider):
|
||||
pass
|
||||
|
||||
try:
|
||||
if payment.info and payment.info_data['status'] == "APPROVED":
|
||||
if payment.info_data.get('status') == "APPROVED":
|
||||
stuck_in_compliance = True
|
||||
except (KeyError):
|
||||
pass
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
Your payment is being processed by PayPal. This takes longer than usual. You can wait until PayPal
|
||||
acknowledges the payment or you can try paying again with this or another payment method.
|
||||
This might result in you being charged twice in case PayPal allows your initial payment attempt.
|
||||
Please contact us, to resolve this case.
|
||||
Please contact us to resolve this case.
|
||||
{% endblocktrans %}</p>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
|
||||
@@ -493,9 +493,9 @@ def webhook(request, *args, **kwargs):
|
||||
prov.log_payment_duration(payment)
|
||||
except Quota.QuotaExceededException:
|
||||
pass
|
||||
if any_pending_review:
|
||||
if any_pending_review and payment.state != OrderPayment.PAYMENT_STATE_PENDING:
|
||||
payment.state = OrderPayment.PAYMENT_STATE_PENDING
|
||||
payment.save()
|
||||
payment.save(update_fields=['state'])
|
||||
elif sale['status'] == 'APPROVED':
|
||||
try:
|
||||
request.session['payment_paypal_oid'] = payment.info_data['id']
|
||||
|
||||
Reference in New Issue
Block a user