/**
  * Retrieve customer address (default billing or default shipping) ID on which tax calculation must be based
  *
  * @param Mage_Customer_Model_Customer $customer
  * @param Mage_Core_Model_Store|string|int|null $store
  * @return int|string
  */
 protected function _getVatRequiredCustomerAddress(Mage_Customer_Model_Customer $customer, $store = null)
 {
     $configAddressType = Mage::helper('customer/address')->getTaxCalculationAddressType($store);
     $requiredAddress = null;
     switch ($configAddressType) {
         case Mage_Customer_Model_Address_Abstract::TYPE_SHIPPING:
             $requiredAddress = $customer->getDefaultShipping();
             break;
         default:
             $requiredAddress = $customer->getDefaultBilling();
     }
     return $requiredAddress;
 }
 /**
  * Retrieve customer addresses list
  *
  * @param Mage_Customer_Model_Customer $customer
  *
  * @return array
  */
 protected function getAddressItems($customer)
 {
     $result = array();
     foreach ($customer->getAddresses() as $address) {
         $data = $address->toArray();
         $row = array();
         foreach ($this->_mapAddressAttributes as $attributeAlias => $attributeCode) {
             $row[$attributeAlias] = isset($data[$attributeCode]) ? $data[$attributeCode] : null;
         }
         foreach ($this->getAllowedAttributes($address) as $attributeCode => $attribute) {
             if (isset($data[$attributeCode])) {
                 $row[$attributeCode] = $data[$attributeCode];
             }
         }
         $row['is_default_billing'] = $customer->getDefaultBilling() == $address->getId();
         $row['is_default_shipping'] = $customer->getDefaultShipping() == $address->getId();
         $result[] = $row;
     }
     return $result;
 }