From ade618a63e209907bdd65ed0bdcec0dfa05c7dd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Wed, 16 Apr 2014 14:10:55 +0200 Subject: [PATCH] [IMP] payment: renamed env field to environment, to avoid conflicts with the incoming new API. bzr revid: tde@openerp.com-20140416121055-01ygh1zer7cfv98a --- addons/payment/models/payment_acquirer.py | 6 +++--- addons/payment/views/payment_acquirer.xml | 4 ++-- addons/payment_adyen/data/adyen.xml | 2 +- addons/payment_adyen/models/adyen.py | 6 +++--- addons/payment_adyen/tests/test_adyen.py | 2 +- addons/payment_ogone/data/ogone.xml | 2 +- addons/payment_ogone/models/ogone.py | 14 +++++++------- addons/payment_ogone/tests/test_ogone.py | 6 +++--- addons/payment_paypal/data/paypal.xml | 2 +- addons/payment_paypal/models/paypal.py | 8 ++++---- addons/payment_paypal/tests/test_paypal.py | 8 ++++---- addons/payment_transfer/data/transfer.xml | 2 +- 12 files changed, 31 insertions(+), 31 deletions(-) diff --git a/addons/payment/models/payment_acquirer.py b/addons/payment/models/payment_acquirer.py index 464cb0c8f5c..2d466219140 100644 --- a/addons/payment/models/payment_acquirer.py +++ b/addons/payment/models/payment_acquirer.py @@ -69,9 +69,9 @@ class PaymentAcquirer(osv.Model): string='Process Method', help='Static payments are payments like transfer, that require manual steps.'), 'view_template_id': fields.many2one('ir.ui.view', 'Form Button Template', required=True), - 'env': fields.selection( + 'environment': fields.selection( [('test', 'Test'), ('prod', 'Production')], - string='Environment'), + string='Environment', oldname='env'), 'website_published': fields.boolean( 'Visible in Portal / Website', help="Make this payment acquirer available (Customer invoices, etc.)"), @@ -85,7 +85,7 @@ class PaymentAcquirer(osv.Model): _defaults = { 'company_id': lambda self, cr, uid, obj, ctx=None: self.pool['res.users'].browse(cr, uid, uid).company_id.id, - 'env': 'test', + 'environment': 'test', 'validation': 'automatic', 'website_published': True, } diff --git a/addons/payment/views/payment_acquirer.xml b/addons/payment/views/payment_acquirer.xml index 325bb774ee6..0228bd7d17d 100644 --- a/addons/payment/views/payment_acquirer.xml +++ b/addons/payment/views/payment_acquirer.xml @@ -19,7 +19,7 @@ - + @@ -70,7 +70,7 @@ - + diff --git a/addons/payment_adyen/data/adyen.xml b/addons/payment_adyen/data/adyen.xml index 5ca0f4d71e9..ec1808f5b7f 100644 --- a/addons/payment_adyen/data/adyen.xml +++ b/addons/payment_adyen/data/adyen.xml @@ -7,7 +7,7 @@ adyen - test + test You will be redirected to the Adyen website after cliking on the payment button.

]]>
dummy diff --git a/addons/payment_adyen/models/adyen.py b/addons/payment_adyen/models/adyen.py index 607d65738c5..ab210fed890 100644 --- a/addons/payment_adyen/models/adyen.py +++ b/addons/payment_adyen/models/adyen.py @@ -21,13 +21,13 @@ _logger = logging.getLogger(__name__) class AcquirerAdyen(osv.Model): _inherit = 'payment.acquirer' - def _get_adyen_urls(self, cr, uid, env, context=None): + def _get_adyen_urls(self, cr, uid, environment, context=None): """ Adyen URLs - yhpp: hosted payment page: pay.shtml for single, select.shtml for multiple """ return { - 'adyen_form_url': 'https://%s.adyen.com/hpp/pay.shtml' % env, + 'adyen_form_url': 'https://%s.adyen.com/hpp/pay.shtml' % environment, } def _get_providers(self, cr, uid, context=None): @@ -97,7 +97,7 @@ class AcquirerAdyen(osv.Model): def adyen_get_form_action_url(self, cr, uid, id, context=None): acquirer = self.browse(cr, uid, id, context=context) - return self._get_adyen_urls(cr, uid, acquirer.env, context=context)['adyen_form_url'] + return self._get_adyen_urls(cr, uid, acquirer.environment, context=context)['adyen_form_url'] class TxAdyen(osv.Model): diff --git a/addons/payment_adyen/tests/test_adyen.py b/addons/payment_adyen/tests/test_adyen.py index c071e682a3d..c4e9356136c 100644 --- a/addons/payment_adyen/tests/test_adyen.py +++ b/addons/payment_adyen/tests/test_adyen.py @@ -49,7 +49,7 @@ class AdyenForm(AdyenCommon): cr, uid, context = self.cr, self.uid, {} # be sure not to do stupid things adyen = self.payment_acquirer.browse(self.cr, self.uid, self.adyen_id, None) - self.assertEqual(adyen.env, 'test', 'test without test env') + self.assertEqual(adyen.environment, 'test', 'test without test environment') # ---------------------------------------- # Test: button direct rendering diff --git a/addons/payment_ogone/data/ogone.xml b/addons/payment_ogone/data/ogone.xml index ade39cfb79c..e24aace7ffd 100644 --- a/addons/payment_ogone/data/ogone.xml +++ b/addons/payment_ogone/data/ogone.xml @@ -7,7 +7,7 @@ ogone - test + test You will be redirected to the Ogone website after cliking on the payment button.

]]>
dummy diff --git a/addons/payment_ogone/models/ogone.py b/addons/payment_ogone/models/ogone.py index f6cab44f0b5..80b5e0d567e 100644 --- a/addons/payment_ogone/models/ogone.py +++ b/addons/payment_ogone/models/ogone.py @@ -22,7 +22,7 @@ _logger = logging.getLogger(__name__) class PaymentAcquirerOgone(osv.Model): _inherit = 'payment.acquirer' - def _get_ogone_urls(self, cr, uid, env, context=None): + def _get_ogone_urls(self, cr, uid, environment, context=None): """ Ogone URLS: - standard order: POST address for form-based @@ -30,10 +30,10 @@ class PaymentAcquirerOgone(osv.Model): @TDETODO: complete me """ return { - 'ogone_standard_order_url': 'https://secure.ogone.com/ncol/%s/orderstandard_utf8.asp' % (env,), - 'ogone_direct_order_url': 'https://secure.ogone.com/ncol/%s/orderdirect_utf8.asp' % (env,), - 'ogone_direct_query_url': 'https://secure.ogone.com/ncol/%s/querydirect_utf8.asp' % (env,), - 'ogone_afu_agree_url': 'https://secure.ogone.com/ncol/%s/AFU_agree.asp' % (env,), + 'ogone_standard_order_url': 'https://secure.ogone.com/ncol/%s/orderstandard_utf8.asp' % (environment,), + 'ogone_direct_order_url': 'https://secure.ogone.com/ncol/%s/orderdirect_utf8.asp' % (environment,), + 'ogone_direct_query_url': 'https://secure.ogone.com/ncol/%s/querydirect_utf8.asp' % (environment,), + 'ogone_afu_agree_url': 'https://secure.ogone.com/ncol/%s/AFU_agree.asp' % (environment,), } def _get_providers(self, cr, uid, context=None): @@ -110,7 +110,7 @@ class PaymentAcquirerOgone(osv.Model): def ogone_get_form_action_url(self, cr, uid, id, context=None): acquirer = self.browse(cr, uid, id, context=context) - return self._get_ogone_urls(cr, uid, acquirer.env, context=context)['ogone_standard_order_url'] + return self._get_ogone_urls(cr, uid, acquirer.environment, context=context)['ogone_standard_order_url'] class PaymentTxOgone(osv.Model): @@ -351,7 +351,7 @@ class PaymentTxOgone(osv.Model): PSWD=tx.acquirer_id.ogone_password, ID=payid, ) - query_direct_url = 'https://secure.ogone.com/ncol/%s/querydirect.asp' % (tx.acquirer_id.env,) + query_direct_url = 'https://secure.ogone.com/ncol/%s/querydirect.asp' % (tx.acquirer_id.environment,) tries = 2 tx_done = False diff --git a/addons/payment_ogone/tests/test_ogone.py b/addons/payment_ogone/tests/test_ogone.py index cc76dd4eed6..0db68214bd4 100644 --- a/addons/payment_ogone/tests/test_ogone.py +++ b/addons/payment_ogone/tests/test_ogone.py @@ -24,7 +24,7 @@ class OgonePayment(PaymentAcquirerCommon): cr, uid, context = self.cr, self.uid, {} # be sure not to do stupid thing ogone = self.payment_acquirer.browse(self.cr, self.uid, self.ogone_id, None) - self.assertEqual(ogone.env, 'test', 'test without test env') + self.assertEqual(ogone.environment, 'test', 'test without test environment') # ---------------------------------------- # Test: button direct rendering + shasign @@ -110,7 +110,7 @@ class OgonePayment(PaymentAcquirerCommon): cr, uid, context = self.cr, self.uid, {} # be sure not to do stupid thing ogone = self.payment_acquirer.browse(self.cr, self.uid, self.ogone_id, None) - self.assertEqual(ogone.env, 'test', 'test without test env') + self.assertEqual(ogone.environment, 'test', 'test without test environment') # typical data posted by ogone after client has successfully paid ogone_post_data = { @@ -174,7 +174,7 @@ class OgonePayment(PaymentAcquirerCommon): cr, uid, context = self.cr, self.uid, {} # be sure not to do stupid thing ogone = self.payment_acquirer.browse(self.cr, self.uid, self.ogone_id, None) - self.assertEqual(ogone.env, 'test', 'test without test env') + self.assertEqual(ogone.environment, 'test', 'test without test environment') # create a new draft tx tx_id = self.payment_transaction.create( diff --git a/addons/payment_paypal/data/paypal.xml b/addons/payment_paypal/data/paypal.xml index 0ea6cd5a848..d66dee8a3b3 100644 --- a/addons/payment_paypal/data/paypal.xml +++ b/addons/payment_paypal/data/paypal.xml @@ -7,7 +7,7 @@ paypal - test + test You will be redirected to the Paypal website after cliking on the payment button.

]]>
dummy diff --git a/addons/payment_paypal/models/paypal.py b/addons/payment_paypal/models/paypal.py index de852702880..d71e3d0620b 100644 --- a/addons/payment_paypal/models/paypal.py +++ b/addons/payment_paypal/models/paypal.py @@ -21,9 +21,9 @@ _logger = logging.getLogger(__name__) class AcquirerPaypal(osv.Model): _inherit = 'payment.acquirer' - def _get_paypal_urls(self, cr, uid, env, context=None): + def _get_paypal_urls(self, cr, uid, environment, context=None): """ Paypal URLS """ - if env == 'prod': + if environment == 'prod': return { 'paypal_form_url': 'https://www.paypal.com/cgi-bin/webscr', 'paypal_rest_url': 'https://api.paypal.com/v1/oauth2/token', @@ -131,7 +131,7 @@ class AcquirerPaypal(osv.Model): def paypal_get_form_action_url(self, cr, uid, id, context=None): acquirer = self.browse(cr, uid, id, context=context) - return self._get_paypal_urls(cr, uid, acquirer.env, context=context)['paypal_form_url'] + return self._get_paypal_urls(cr, uid, acquirer.environment, context=context)['paypal_form_url'] def _paypal_s2s_get_access_token(self, cr, uid, ids, context=None): """ @@ -143,7 +143,7 @@ class AcquirerPaypal(osv.Model): parameters = werkzeug.url_encode({'grant_type': 'client_credentials'}) for acquirer in self.browse(cr, uid, ids, context=context): - tx_url = self._get_paypal_urls(cr, uid, acquirer.env)['paypal_rest_url'] + tx_url = self._get_paypal_urls(cr, uid, acquirer.environment)['paypal_rest_url'] request = urllib2.Request(tx_url, parameters) # add other headers (https://developer.paypal.com/webapps/developer/docs/integration/direct/make-your-first-call/) diff --git a/addons/payment_paypal/tests/test_paypal.py b/addons/payment_paypal/tests/test_paypal.py index 01f40ddd094..ccac9b6fdef 100644 --- a/addons/payment_paypal/tests/test_paypal.py +++ b/addons/payment_paypal/tests/test_paypal.py @@ -39,7 +39,7 @@ class PaypalServer2Server(PaypalCommon): cr, uid, context = self.cr, self.uid, {} # be sure not to do stupid things paypal = self.payment_acquirer.browse(self.cr, self.uid, self.paypal_id, None) - self.assertEqual(paypal.env, 'test', 'test without test env') + self.assertEqual(paypal.environment, 'test', 'test without test environment') res = self.payment_acquirer._paypal_s2s_get_access_token(cr, uid, [self.paypal_id], context=context) self.assertTrue(res[self.paypal_id] is not False, 'paypal: did not generate access token') @@ -73,7 +73,7 @@ class PaypalForm(PaypalCommon): # be sure not to do stupid things self.payment_acquirer.write(cr, uid, self.paypal_id, {'fees_active': False}, context) paypal = self.payment_acquirer.browse(cr, uid, self.paypal_id, context) - self.assertEqual(paypal.env, 'test', 'test without test env') + self.assertEqual(paypal.environment, 'test', 'test without test environment') # ---------------------------------------- # Test: button direct rendering @@ -122,7 +122,7 @@ class PaypalForm(PaypalCommon): cr, uid, context = self.cr, self.uid, {} # be sure not to do stupid things paypal = self.payment_acquirer.browse(self.cr, self.uid, self.paypal_id, None) - self.assertEqual(paypal.env, 'test', 'test without test env') + self.assertEqual(paypal.environment, 'test', 'test without test environment') # update acquirer: compute fees self.payment_acquirer.write(cr, uid, self.paypal_id, { @@ -156,7 +156,7 @@ class PaypalForm(PaypalCommon): cr, uid, context = self.cr, self.uid, {} # be sure not to do stupid things paypal = self.payment_acquirer.browse(cr, uid, self.paypal_id, context) - self.assertEqual(paypal.env, 'test', 'test without test env') + self.assertEqual(paypal.environment, 'test', 'test without test environment') # typical data posted by paypal after client has successfully paid paypal_post_data = { diff --git a/addons/payment_transfer/data/transfer.xml b/addons/payment_transfer/data/transfer.xml index 5eabe29a17f..13dd1f241c7 100644 --- a/addons/payment_transfer/data/transfer.xml +++ b/addons/payment_transfer/data/transfer.xml @@ -8,7 +8,7 @@ manual - test + test Transfer information will be provided after choosing the payment mode.

]]>