forked from CGM_Public/pretix_original
Stripe: Allow failed payments to succeed
This commit is contained in:
@@ -258,15 +258,17 @@ def charge_webhook(event, event_json, charge_id, rso):
|
|||||||
amount=a,
|
amount=a,
|
||||||
info=str(charge['dispute'])
|
info=str(charge['dispute'])
|
||||||
)
|
)
|
||||||
elif payment.state in (OrderPayment.PAYMENT_STATE_PENDING, OrderPayment.PAYMENT_STATE_CREATED):
|
elif charge['status'] == 'succeeded' and payment.state in (OrderPayment.PAYMENT_STATE_PENDING,
|
||||||
if charge['status'] == 'succeeded':
|
OrderPayment.PAYMENT_STATE_CREATED,
|
||||||
try:
|
OrderPayment.PAYMENT_STATE_CANCELED,
|
||||||
payment.confirm()
|
OrderPayment.PAYMENT_STATE_FAILED):
|
||||||
except LockTimeoutException:
|
try:
|
||||||
return HttpResponse("Lock timeout, please try again.", status=503)
|
payment.confirm()
|
||||||
except Quota.QuotaExceededException:
|
except LockTimeoutException:
|
||||||
pass
|
return HttpResponse("Lock timeout, please try again.", status=503)
|
||||||
elif charge['status'] == 'failed':
|
except Quota.QuotaExceededException:
|
||||||
|
pass
|
||||||
|
elif charge['status'] == 'failed' and payment.state in (OrderPayment.PAYMENT_STATE_PENDING, OrderPayment.PAYMENT_STATE_CREATED):
|
||||||
payment.info = str(charge)
|
payment.info = str(charge)
|
||||||
payment.state = OrderPayment.PAYMENT_STATE_FAILED
|
payment.state = OrderPayment.PAYMENT_STATE_FAILED
|
||||||
payment.save()
|
payment.save()
|
||||||
|
|||||||
Reference in New Issue
Block a user