[FIX] payment_buckaroo: return url, payment validation

This revision is related to 6efc371291

The return URL parameter key has changed: The capital letters
are not the same than before.

Besides, send a dict in the `ADD_RETURNDATA` doesn't seem
to be supported by Buckaroo. We therefore no
longer uses a dict but a string to avoid problems.

opw-665697
This commit is contained in:
Denis Ledoux 2016-01-07 13:16:47 +01:00
parent 7f230a540e
commit 7473f4a3c7
2 changed files with 3 additions and 6 deletions

View File

@ -30,9 +30,6 @@ class BuckarooController(http.Controller):
""" Buckaroo."""
_logger.info('Buckaroo: entering form_feedback with post data %s', pprint.pformat(post)) # debug
request.registry['payment.transaction'].form_feedback(request.cr, SUPERUSER_ID, post, 'buckaroo', context=request.context)
return_url = post.pop('return_url', '')
if not return_url:
data ='' + post.pop('ADD_RETURNDATA', '{}').replace("'", "\"")
custom = json.loads(data)
return_url = custom.pop('return_url', '/')
post = dict((key.upper(), value) for key, value in post.items())
return_url = post.get('ADD_RETURNDATA') or '/'
return werkzeug.utils.redirect(return_url)

View File

@ -107,7 +107,7 @@ class AcquirerBuckaroo(osv.Model):
'Brq_culture': (partner_values.get('lang') or 'en_US').replace('_', '-'),
})
if buckaroo_tx_values.get('return_url'):
buckaroo_tx_values['add_returndata'] = {'return_url': '%s' % buckaroo_tx_values.pop('return_url')}
buckaroo_tx_values['add_returndata'] = buckaroo_tx_values.pop('return_url')
else:
buckaroo_tx_values['add_returndata'] = ''
buckaroo_tx_values['Brq_signature'] = self._buckaroo_generate_digital_sign(acquirer, 'in', buckaroo_tx_values)