/**
  * Build CMS customer addresses to API object.
  * 
  * @param mixed $mOrderInfo
  * @return object 
  */
 function helper_dibs_obj_addr($mOrderInfo)
 {
     $country_b = uc_get_country_data(array('country_id' => $mOrderInfo->billing_country));
     if ($country_b === FALSE) {
         $country_b = array(0 => array('country_iso_code_3' => 'USA'));
     }
     $country_d = uc_get_country_data(array('country_id' => $mOrderInfo->delivery_country));
     if ($country_d === FALSE) {
         $country_d = array(0 => array('country_iso_code_3' => 'USA'));
     }
     return (object) array('shippingfirstname' => $mOrderInfo->delivery_first_name, 'shippinglastname' => $mOrderInfo->delivery_last_name, 'shippingpostalcode' => $mOrderInfo->delivery_postal_code, 'shippingpostalplace' => $mOrderInfo->delivery_city, 'shippingaddress2' => $mOrderInfo->delivery_street1 . " " . $mOrderInfo->delivery_street2, 'shippingaddress' => $country_d[0]['country_iso_code_3'] . " " . uc_get_zone_code($mOrderInfo->delivery_zone), 'billingfirstname' => $mOrderInfo->billing_first_name, 'billinglastname' => $mOrderInfo->billing_last_name, 'billingpostalcode' => $mOrderInfo->billing_postal_code, 'billingpostalplace' => $mOrderInfo->billing_city, 'billingaddress2' => $mOrderInfo->billing_street1 . " " . $mOrderInfo->billing_street2, 'billingaddress' => $country_b[0]['country_iso_code_3'] . " " . uc_get_zone_code($mOrderInfo->billing_zone), 'billingmobile' => $mOrderInfo->billing_phone, 'billingemail' => $mOrderInfo->primary_email);
 }
 function dibsflex_helper_getAddressObj($mOrderInfo)
 {
     $country_b = uc_get_country_data(array('country_id' => $mOrderInfo->billing_country));
     if ($country_b === FALSE) {
         $country_b = array(0 => array('country_iso_code_3' => 'USA'));
     }
     $country_d = uc_get_country_data(array('country_id' => $mOrderInfo->delivery_country));
     if ($country_d === FALSE) {
         $country_d = array(0 => array('country_iso_code_3' => 'USA'));
     }
     return (object) array('billing' => (object) array('firstname' => $mOrderInfo->billing_first_name, 'lastname' => $mOrderInfo->billing_last_name, 'street' => $mOrderInfo->billing_street1 . " " . $mOrderInfo->billing_street2, 'postcode' => $mOrderInfo->billing_postal_code, 'city' => $mOrderInfo->billing_city, 'region' => uc_get_zone_code($mOrderInfo->billing_zone), 'country' => $country_b[0]['country_iso_code_3'], 'phone' => $mOrderInfo->billing_phone, 'email' => $mOrderInfo->primary_email), 'delivery' => (object) array('firstname' => $mOrderInfo->delivery_first_name, 'lastname' => $mOrderInfo->delivery_last_name, 'street' => $mOrderInfo->delivery_street1 . " " . $mOrderInfo->delivery_street2, 'postcode' => $mOrderInfo->delivery_postal_code, 'city' => $mOrderInfo->delivery_city, 'region' => uc_get_zone_code($mOrderInfo->delivery_zone), 'country' => $country_d[0]['country_iso_code_3'], 'phone' => $mOrderInfo->delivery_phone, 'email' => $mOrderInfo->primary_email));
 }