From a61ffa3d10f6be8083665d2ff8559e4ab31b7c01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Wed, 4 Dec 2013 18:00:24 +0100 Subject: [PATCH] [FIX] [IMP] adyen: fixed controller (contacted with a GET request); added some data verification when processing the data coming back from adyen bzr revid: tde@openerp.com-20131204170024-j2czn5nm9p56oosj --- addons/payment_acquirer_adyen/controllers/main.py | 2 +- addons/payment_acquirer_adyen/models/adyen.py | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/addons/payment_acquirer_adyen/controllers/main.py b/addons/payment_acquirer_adyen/controllers/main.py index 706b26e163d..2ea9fb00c51 100644 --- a/addons/payment_acquirer_adyen/controllers/main.py +++ b/addons/payment_acquirer_adyen/controllers/main.py @@ -19,7 +19,7 @@ class AdyenController(http.Controller): @website.route([ '/payment/adyen/return/', - ], type='http', auth='public', methods=['POST']) + ], type='http', auth='public') def adyen_return(self, **post): """ Paypal IPN. """ _logger.info('Beginning Adyen form_feedback with post data %s', pprint.pformat(post)) # debug diff --git a/addons/payment_acquirer_adyen/models/adyen.py b/addons/payment_acquirer_adyen/models/adyen.py index d76419c30cb..761381d415c 100644 --- a/addons/payment_acquirer_adyen/models/adyen.py +++ b/addons/payment_acquirer_adyen/models/adyen.py @@ -140,12 +140,18 @@ class TxAdyen(osv.Model): return tx def _adyen_form_get_invalid_parameters(self, cr, uid, tx, data, context=None): - # TODO: txn_id: shoudl be false at draft, set afterwards, and verified with txn details invalid_parameters = [] + + # reference at acquirer: pspReference + if tx.acquirer_reference and data.get('pspReference') != tx.acquirer_reference: + invalid_parameters.append(('pspReference', data.get('pspReference'), tx.acquirer_reference)) + # seller if data.get('skinCode') != tx.acquirer_id.adyen_skin_code: invalid_parameters.append(('skinCode', data.get('skinCode'), tx.acquirer_id.adyen_skin_code)) + # result if not data.get('authResult'): invalid_parameters.append(('authResult', data.get('authResult'), 'something')) + return invalid_parameters def _adyen_form_validate(self, cr, uid, tx, data, context=None):