summaryrefslogtreecommitdiff
path: root/addons/payment_authorize/models
diff options
context:
space:
mode:
authorVictor Feyens <vfe@odoo.com>2019-07-18 13:56:34 +0000
committerVictor Feyens <vfe@odoo.com>2019-08-12 08:45:50 +0000
commitf0e059e6010605b5cce2a3055ed3aaf7730534fa (patch)
treea90dce7fae7b1bb6f04cd48abcae06ff74b36f71 /addons/payment_authorize/models
parent611fde6c8828d7d89b8c7f90b60484c58debcf73 (diff)
[REF] payment* : state based publishing
Replace website_published and environment by a generic state on payment.acquirer Payment acquirers aren't enabled by default. When setting their state to 'enabled' or 'test', it is verified the required fields for the provider are set.
Diffstat (limited to 'addons/payment_authorize/models')
-rw-r--r--addons/payment_authorize/models/authorize_request.py6
-rw-r--r--addons/payment_authorize/models/payment.py3
2 files changed, 5 insertions, 4 deletions
diff --git a/addons/payment_authorize/models/authorize_request.py b/addons/payment_authorize/models/authorize_request.py
index 53f40bfb1af..80b9e4bdbf2 100644
--- a/addons/payment_authorize/models/authorize_request.py
+++ b/addons/payment_authorize/models/authorize_request.py
@@ -30,12 +30,12 @@ class AuthorizeAPI():
:param record acquirer: payment.acquirer account that will be contacted
"""
- if acquirer.environment == 'test':
+ if acquirer.state == 'test':
self.url = 'https://apitest.authorize.net/xml/v1/request.api'
else:
self.url = 'https://api.authorize.net/xml/v1/request.api'
- self.environment = acquirer.environment
+ self.state = acquirer.state
self.name = acquirer.authorize_login
self.transaction_key = acquirer.authorize_transaction_key
@@ -99,7 +99,7 @@ class AuthorizeAPI():
}
}
},
- 'validationMode': 'liveMode' if self.environment == 'prod' else 'testMode'
+ 'validationMode': 'liveMode' if self.state == 'enabled' else 'testMode'
}
}
diff --git a/addons/payment_authorize/models/payment.py b/addons/payment_authorize/models/payment.py
index fcc70e6682d..e7be116700d 100644
--- a/addons/payment_authorize/models/payment.py
+++ b/addons/payment_authorize/models/payment.py
@@ -125,7 +125,8 @@ class PaymentAcquirerAuthorize(models.Model):
def authorize_get_form_action_url(self):
self.ensure_one()
- return self._get_authorize_urls(self.environment)['authorize_form_url']
+ environment = 'prod' if self.state == 'enabled' else 'test'
+ return self._get_authorize_urls(environment)['authorize_form_url']
@api.model
def authorize_s2s_form_process(self, data):