Jump to content

Want iso_code to appear in auth.net instead of id_state


Recommended Posts

Hi all:

 

Had problems getting auth.net to go through. Kept saying it needed a BILL TO CITY error. I fixed that by using this link

 

But now, when I go to the auth.net admin page, instead of the state appearing in the customer's order it shows the id_state from the ps_address table. So if the order is from Connecticut, a number "7" appears in the auth.net admin page for the state instead of CT or Connecticut.

 

I went to modules/authorizeaim/validate.php and added:

 

switch ($x_state){
 case ("7"):
  $x_state =  "Connecticut";
	  break;
}

 

right after the parameters array as a test to see of Connecticut would work but it didn't.

 

Any help on this appreciated!

Link to comment
Share on other sites

Not every country has states, so you will need to account for that somehow, but the iso code is already stored within Prestashop, you just need to use the correct code, do something like this after the entire $params = array(

 

 

$params = array(
'x_test_request' => (bool)Configuration::get('AUTHORIZE_AIM_DEMO'),
'x_invoice_num' => (int)$_POST['x_invoice_num'],
'x_amount' => number_format((float)$cart->getOrderTotal(true, 3), 2, '.', ''),
'x_exp_date' => Tools::safeOutput($_POST['x_exp_date_m'].$_POST['x_exp_date_y']),
'x_address' => Tools::safeOutput($invoiceAddress->address1.' '.$invoiceAddress->address2),
'x_zip' => Tools::safeOutput($invoiceAddress->postcode),
'x_first_name' => Tools::safeOutput($customer->firstname),
'x_last_name' => Tools::safeOutput($customer->lastname),
'x_version' => '3.1',
'x_delim_data' => true,
'x_delim_char' => '|',
'x_relay_response' => false,
'x_type' => 'AUTH_CAPTURE',
'x_method' => 'CC',
'x_solution_id' => 'A1000006',
'x_login' => Tools::safeOutput(Configuration::get('AUTHORIZE_AIM_LOGIN_ID')),
'x_tran_key' => Tools::safeOutput(Configuration::get('AUTHORIZE_AIM_KEY')),
'x_card_num' => Tools::safeOutput($_POST['x_card_num']),
'x_card_code' => Tools::safeOutput($_POST['x_card_code']),
);

$state=new State($invoiceAddress->id_state);
if (Validate::isLoadedObject($state))
 $params['x_state']=Tools::safeOutput($state->iso_code);

Link to comment
Share on other sites

Have you checked your Country setting to determine that the City is part of the Address format?

 

Just checked. Nothing seems strange. City is just not appearing on STEP 1

 

firstname lastname

company

address1 address2

city, State:name postcode

Country:name

phone

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...