From 932c93d280bdd43838d2bb8955407e3674d7a525 Mon Sep 17 00:00:00 2001 From: Jairo Llopis Date: Mon, 23 Nov 2015 13:30:33 +0100 Subject: [PATCH 1/2] Do not break system when upgrading, please. Document dependencies. --- payment_redsys/README.rst | 8 ++++++++ payment_redsys/__openerp__.py | 6 ++++++ payment_redsys/models/redsys.py | 6 +++++- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/payment_redsys/README.rst b/payment_redsys/README.rst index fcd82159ddc..989a2a79481 100644 --- a/payment_redsys/README.rst +++ b/payment_redsys/README.rst @@ -47,3 +47,11 @@ pasarela de pago envía el formulario a "/payment/redsys/return" odoo no sabe con que base de datos procesar esta información. Por lo que hay que establecer los parametros **dbfilter** y **dbname** en **openerp-server.conf**. + +Instalación +----------- + +Para utilizar este módulo, necesita la biblioteca `pycrypto +`_ instalada en su sistema:: + + pip install pycrypto diff --git a/payment_redsys/__openerp__.py b/payment_redsys/__openerp__.py index 3d91a9e550f..787579dc289 100644 --- a/payment_redsys/__openerp__.py +++ b/payment_redsys/__openerp__.py @@ -7,6 +7,12 @@ 'version': '8.0.1.0.0', 'author': "Incaser Informatica S.L.,Odoo Community Association (OCA)", 'depends': ['payment'], + "external_dependencies": { + "python": [ + "Crypto.Cipher.DES3", + ], + "bin": [], + }, 'data': [ 'views/redsys.xml', 'views/payment_acquirer.xml' diff --git a/payment_redsys/models/redsys.py b/payment_redsys/models/redsys.py index 33a388005e9..7ef468e6529 100644 --- a/payment_redsys/models/redsys.py +++ b/payment_redsys/models/redsys.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- -from Crypto.Cipher import DES3 import hashlib import hmac import base64 @@ -11,6 +10,11 @@ from openerp.tools.float_utils import float_compare _logger = logging.getLogger(__name__) +try: + from Crypto.Cipher import DES3 +except ImportError: + _logger.info("Missing dependency. See README.") + class AcquirerRedsys(models.Model): _inherit = 'payment.acquirer' From 439ddd73f33804fc24f0e0d62d2d567f2a3d537c Mon Sep 17 00:00:00 2001 From: Jairo Llopis Date: Mon, 23 Nov 2015 13:48:54 +0100 Subject: [PATCH 2/2] Tell dependency in log. --- payment_redsys/models/redsys.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/payment_redsys/models/redsys.py b/payment_redsys/models/redsys.py index 7ef468e6529..a912f975861 100644 --- a/payment_redsys/models/redsys.py +++ b/payment_redsys/models/redsys.py @@ -13,7 +13,7 @@ try: from Crypto.Cipher import DES3 except ImportError: - _logger.info("Missing dependency. See README.") + _logger.info("Missing dependency (pycrypto). See README.") class AcquirerRedsys(models.Model):