Example #1
0
 /**
  * Return ISO-Code for Magento address
  *
  * @param Varien_Object $address
  *
  * @return null|string
  */
 public function getIsoStateByMagentoRegion(Varien_Object $address)
 {
     $map = $this->_getIsoToMagentoMapping();
     $sIsoCode = null;
     if ($address->getCountryId() && $address->getRegionCode()) {
         $sIsoCode = $address->getCountryId() . "-" . $address->getRegionCode();
     }
     if (isset($map[$address->getCountryId()])) {
         foreach ($map[$address->getCountryId()] as $isoCode => $mageCode) {
             if ($mageCode === $address->getRegionCode()) {
                 $sIsoCode = $address->getCountryId() . "-" . $isoCode;
                 break;
             }
         }
     }
     return $sIsoCode;
 }
Example #2
0
 /**
  * Get billing address request data
  *
  * @param Varien_Object $address
  * @return array
  */
 protected function _getBillingAddress(Varien_Object $address)
 {
     $request = array('billing_first_name' => $address->getFirstname(), 'billing_last_name' => $address->getLastname(), 'billing_city' => $address->getCity(), 'billing_state' => $address->getRegionCode() ? $address->getRegionCode() : $address->getCity(), 'billing_zip' => $address->getPostcode(), 'billing_country' => $address->getCountry());
     // convert streets to tow lines format
     $street = Mage::helper('customer/address')->convertStreetLines($address->getStreet(), 2);
     $request['billing_address1'] = isset($street[0]) ? $street[0] : '';
     $request['billing_address2'] = isset($street[1]) ? $street[1] : '';
     return $request;
 }