forked from CGM_Public/pretix_original
PayPal: Add missing payment.fail() statements
This commit is contained in:
@@ -607,6 +607,12 @@ class PaypalMethod(BasePaymentProvider):
|
|||||||
response = self.client.execute(req)
|
response = self.client.execute(req)
|
||||||
except IOError as e:
|
except IOError as e:
|
||||||
logger.exception('PayPal OrdersGetRequest: {}'.format(str(e)))
|
logger.exception('PayPal OrdersGetRequest: {}'.format(str(e)))
|
||||||
|
payment.fail(info={
|
||||||
|
"error": {
|
||||||
|
"name": "IOError",
|
||||||
|
"message": str(e),
|
||||||
|
}
|
||||||
|
})
|
||||||
raise PaymentException(_('We had trouble communicating with PayPal'))
|
raise PaymentException(_('We had trouble communicating with PayPal'))
|
||||||
else:
|
else:
|
||||||
pp_captured_order = response.result
|
pp_captured_order = response.result
|
||||||
@@ -618,6 +624,12 @@ class PaypalMethod(BasePaymentProvider):
|
|||||||
if Decimal(pp_captured_order.purchase_units[0].amount.value) != payment.amount or \
|
if Decimal(pp_captured_order.purchase_units[0].amount.value) != payment.amount or \
|
||||||
pp_captured_order.purchase_units[0].amount.currency_code != self.event.currency:
|
pp_captured_order.purchase_units[0].amount.currency_code != self.event.currency:
|
||||||
logger.error('Value mismatch: Payment %s vs paypal trans %s' % (payment.id, str(pp_captured_order.dict())))
|
logger.error('Value mismatch: Payment %s vs paypal trans %s' % (payment.id, str(pp_captured_order.dict())))
|
||||||
|
payment.fail(info={
|
||||||
|
"error": {
|
||||||
|
"name": "ValidationError",
|
||||||
|
"message": "Value mismatch",
|
||||||
|
}
|
||||||
|
})
|
||||||
raise PaymentException(_('We were unable to process your payment. See below for details on how to '
|
raise PaymentException(_('We were unable to process your payment. See below for details on how to '
|
||||||
'proceed.'))
|
'proceed.'))
|
||||||
|
|
||||||
@@ -660,6 +672,12 @@ class PaypalMethod(BasePaymentProvider):
|
|||||||
self.client.execute(patchreq)
|
self.client.execute(patchreq)
|
||||||
except IOError as e:
|
except IOError as e:
|
||||||
messages.error(request, _('We had trouble communicating with PayPal'))
|
messages.error(request, _('We had trouble communicating with PayPal'))
|
||||||
|
payment.fail(info={
|
||||||
|
"error": {
|
||||||
|
"name": "IOError",
|
||||||
|
"message": str(e),
|
||||||
|
}
|
||||||
|
})
|
||||||
logger.exception('PayPal OrdersPatchRequest: {}'.format(str(e)))
|
logger.exception('PayPal OrdersPatchRequest: {}'.format(str(e)))
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user