Jump to content

Get State name


Recommended Posts



I am creating a Sage payment Gateway module so in my file I need to Pass the State name also 'C_STATE' => Tools::safeOutput($invoiceAddress->id_state), but this is only providing me the ID of the value.


How to get the State Name so that I can pass it to Gateway. 


Also after successful transaction I am finding difficulties to capture values in prestashop.


I am using SOAP.


This is my code 


$params = array(
     'M_ID' => 'xxxxxxx',
            'M_KEY' => 'xxxxxxx',
            'C_NAME' => Tools::safeOutput($customer->firstname) . ' ' . Tools::safeOutput($customer->lastname),
            'C_ADDRESS' => Tools::safeOutput($invoiceAddress->address1.' '.$invoiceAddress->address2),
            'C_CITY' => Tools::safeOutput($invoiceAddress->city),
            'C_STATE' => Tools::safeOutput($invoiceAddress->id_state),
            'C_ZIP' => Tools::safeOutput($invoiceAddress->postcode),
            'C_COUNTRY' => 'USA',
            'C_EMAIL' => Tools::safeOutput($invoiceAddress->email),
            'C_CARDNUMBER' => Tools::safeOutput($_POST['x_card_num']),
            'C_EXP' => Tools::safeOutput($_POST['x_exp_date_m'].$_POST['x_exp_date_y']),
            'T_AMT' => number_format((float)$cart->getOrderTotal(true, 3), 2, '.', ''),
            'T_ORDERNUM' => time(),
    $response = $SOAP->BANKCARD_SALE($params);
    $result = $response->BANKCARD_SALEResult->any;
    $result = new SimpleXMLElement($result);
     $resultvalue = $result->NewDataSet->Table1->MESSAGE;
 $resultvalue1 = $result->NewDataSet->Table1->REFERENCE;
  $resultvalue2 = $result->NewDataSet->Table1->ORDER_NUMBER;
            $arr = explode(' ',trim($resultvalue));
$arr1 = explode(' ',trim($resultvalue1));
$arr2 = explode(' ',trim($resultvalue2));
After this I am stucked. Can any one please guide.


Link to comment
Share on other sites

  • 1 year later...

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...