lingo: check response signature later (#36876)
This commit is contained in:
parent
fb8c07a106
commit
266b37db6f
|
@ -455,7 +455,10 @@ class PaymentException(Exception):
|
|||
|
||||
|
||||
class UnsignedPaymentException(PaymentException):
|
||||
pass
|
||||
|
||||
def __init__(self, transaction, *args, **kwargs):
|
||||
super(UnsignedPaymentException, self).__init__(*args, **kwargs)
|
||||
self.transaction = transaction
|
||||
|
||||
|
||||
class UnknownPaymentException(PaymentException):
|
||||
|
@ -487,13 +490,6 @@ class PaymentView(View):
|
|||
}
|
||||
for k, v in payment_response.bank_data.items():
|
||||
extra_info['eopayment_bank_data_' + k] = smart_text(v)
|
||||
if not payment_response.signed and not payment_response.result == eopayment.CANCELLED:
|
||||
# we accept unsigned cancellation requests as some platforms do
|
||||
# that :/
|
||||
logger.warning(u'received unsigned payment response with id %s',
|
||||
smart_text(payment_response.order_id), extra=extra_info)
|
||||
raise UnsignedPaymentException('Received unsigned payment response')
|
||||
|
||||
try:
|
||||
transaction = Transaction.objects.get(order_id=payment_response.order_id)
|
||||
except Transaction.DoesNotExist:
|
||||
|
@ -526,6 +522,13 @@ class PaymentView(View):
|
|||
transaction.regie.payment_backend, payment_backend))
|
||||
raise PaymentException('Invalid payment regie')
|
||||
|
||||
if not payment_response.signed and not payment_response.result == eopayment.CANCELLED:
|
||||
# we accept unsigned cancellation requests as some platforms do
|
||||
# that :/
|
||||
logger.warning(u'received unsigned payment response with id %s',
|
||||
smart_text(payment_response.order_id), extra=extra_info)
|
||||
raise UnsignedPaymentException(transaction, 'Received unsigned payment response')
|
||||
|
||||
transaction.status = payment_response.result
|
||||
transaction.bank_transaction_id = payment_response.transaction_id
|
||||
transaction.bank_data = payment_response.bank_data
|
||||
|
|
Loading…
Reference in New Issue