[FIX] payment_adyen: pspReference is not mandatory

Indeed, when canceling a transaction, pspReference
is not passed.

In such a case, the arg authResult is set to
`CANCELLED`, and in such a case, we should
just bypass the form_feedback, as done in
the payment_paypal module.

opw-634210
This commit is contained in:
Denis Ledoux 2015-04-30 14:24:22 +02:00
parent 238f1fa591
commit 338df8f492
1 changed files with 3 additions and 4 deletions

View File

@ -20,11 +20,10 @@ class AdyenController(http.Controller):
@http.route([
'/payment/adyen/return/',
], type='http', auth='none')
def adyen_return(self, pspReference, **post):
""" Paypal IPN."""
post["pspReference"] = pspReference
def adyen_return(self, **post):
_logger.info('Beginning Adyen form_feedback with post data %s', pprint.pformat(post)) # debug
request.registry['payment.transaction'].form_feedback(request.cr, SUPERUSER_ID, post, 'adyen', context=request.context)
if post.get('authResult') not in ['CANCELLED']:
request.registry['payment.transaction'].form_feedback(request.cr, SUPERUSER_ID, post, 'adyen', context=request.context)
return_url = post.pop('return_url', '')
if not return_url:
custom = json.loads(post.pop('merchantReturnData', '{}'))