Improve semantic around signed_result in dummy and spplus backends

This commit is contained in:
Benjamin Dauvergne 2012-02-17 18:11:58 +01:00
parent f0c3442560
commit 61efa74383
2 changed files with 12 additions and 9 deletions

View File

@ -87,13 +87,17 @@ class Payment(PaymentCommon):
transaction_id = form.get('transaction_id',[''])[0]
form[self.BANK_ID] = transaction_id
if 'signed' in form:
signed = 'signed' in form
if signed:
content = 'signature ok'
else:
content = None
signed = signed and self.consider_all_response_signed
result = 'ok' in form
signed_result = result if signed else None
response = PaymentResponse(result='ok' in form,
signed_result='ok' in form and 'signed' in form,
response = PaymentResponse(result=result,
signed_result=signed_result,
bank_data=form,
return_content=content,
order_id=transaction_id,

View File

@ -133,13 +133,12 @@ next_url=%s' % (montant, email, next_url))
LOGGER.debug('got signature %s' % hmac)
computed_hmac = sign_ntkey_query(self.cle, signed_data)
LOGGER.debug('computed signature %s' % hmac)
result = signed_result = hmac==computed_hmac \
and form.get(ETAT) == ETAT_PAIEMENT_ACCEPTE
if not signed_result:
result = False
bank_status = 'invalid signature'
if hmac == computed_hmac:
signed_result = result
else:
bank_status += 'invalid signature'
except ValueError:
result = signed_result = False
bank_status += 'invalid signature'
response = PaymentResponse(
result=result,