From 53f86de70db63244a2fc19e7a0bd776528cadecc Mon Sep 17 00:00:00 2001
From: Nicolas Lempereur <nle@odoo.com>
Date: Thu, 12 May 2016 11:50:26 +0200
Subject: [PATCH] [FIX] payment_authorize: use state code instead of state name

The state given to authorize requests should be the state code and not
the state name.

source:
https://support.authorize.net/authkb/index?page=content&id=A1454&actp=RSS

opw-675634
---
 addons/payment_authorize/models/authorize.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/addons/payment_authorize/models/authorize.py b/addons/payment_authorize/models/authorize.py
index d4fc0ee9a9db..395759619694 100644
--- a/addons/payment_authorize/models/authorize.py
+++ b/addons/payment_authorize/models/authorize.py
@@ -69,7 +69,7 @@ class PaymentAcquirerAuthorize(models.Model):
             'first_name': values.get('partner_first_name'),
             'last_name': values.get('partner_last_name'),
             'phone': values.get('partner_phone'),
-            'state': values.get('partner_state') and values['partner_state'].name or '',
+            'state': values.get('partner_state') and values['partner_state'].code or '',
             'billing_address': values.get('billing_partner_address'),
             'billing_city': values.get('billing_partner_city'),
             'billing_country': values.get('billing_partner_country') and values.get('billing_partner_country').name or '',
@@ -78,7 +78,7 @@ class PaymentAcquirerAuthorize(models.Model):
             'billing_first_name': values.get('billing_partner_first_name'),
             'billing_last_name': values.get('billing_partner_last_name'),
             'billing_phone': values.get('billing_partner_phone'),
-            'billing_state': values.get('billing_partner_state') and values['billing_partner_state'].name or '',
+            'billing_state': values.get('billing_partner_state') and values['billing_partner_state'].code or '',
         }
         temp_authorize_tx_values['returndata'] = authorize_tx_values.pop('return_url', '')
         temp_authorize_tx_values['x_fp_hash'] = self._authorize_generate_hashing(temp_authorize_tx_values)
-- 
GitLab