/**
  * @param Mage_Sales_Model_Quote|null $quote
  * @return bool
  * @see Mage_Payment_Model_Method_Abstract::isAvailable()
  */
 public function isAvailable($quote = null)
 {
     //NOTE: NEVER return true in here. the parent check should do this!
     if ($quote == null) {
         $quote = $this->_getQuote();
     }
     if ($quote->hasVirtualItems()) {
         return false;
     }
     $billingAddress = $quote->getBillingAddress();
     $shippingAddress = $quote->getShippingAddress();
     if (!$shippingAddress->getSameAsBilling()) {
         if ($billingAddress->getCustomerAddressId() == null || $billingAddress->getCustomerAddressId() != $shippingAddress->getCustomerAddressId()) {
             if ($billingAddress->getName() != $shippingAddress->getName() || $billingAddress->getCompany() != $shippingAddress->getCompany() || $billingAddress->getCity() != $shippingAddress->getCity() || $billingAddress->getPostcode() != $shippingAddress->getPostcode() || $billingAddress->getCountryId() != $shippingAddress->getCountryId() || $billingAddress->getTelephone() != $shippingAddress->getTelephone() || $billingAddress->getFax() != $shippingAddress->getFax() || $billingAddress->getEmail() != $shippingAddress->getEmail() || $billingAddress->getCountry() != $shippingAddress->getCountry() || $billingAddress->getRegion() != $shippingAddress->getRegion() || $billingAddress->getStreet() != $shippingAddress->getStreet()) {
                 return false;
             }
         }
     }
     if ($quote->getQuoteCurrencyCode() != 'EUR') {
         return false;
     }
     if (strlen($billingAddress->getCompany())) {
         return parent::isAvailable($quote);
     }
     $vat_id = $billingAddress->getData('vat_id');
     if (!strlen($vat_id)) {
         return false;
     }
     return parent::isAvailable($quote);
 }
 /**
  * @param Mage_Sales_Model_Quote|null $quote
  * @return bool
  * @see Mage_Payment_Model_Method_Abstract::isAvailable()
  */
 public function isAvailable($quote = null)
 {
     //NOTE: NEVER return true in here. the parent check should do this!
     if ($quote == null) {
         $quote = $this->_getQuote();
     }
     $dob = $quote->getCustomerDob();
     //we only need to check the dob if it's set. Else we ask for dob on payment selection page.
     if ($dob) {
         $dobObject = new DateTime($dob);
         $currentYear = date('Y');
         $currentMonth = date('m');
         $currentDay = date('d');
         $ageCheckDate = $currentYear - 17 . '-' . $currentMonth . '-' . $currentDay;
         $ageCheckObject = new DateTime($ageCheckDate);
         if ($ageCheckObject < $dobObject) {
             //customer is younger than 18 years. Invoice not available
             return false;
         }
     }
     if ($quote->hasVirtualItems()) {
         return false;
     }
     $shippingAddress = $quote->getShippingAddress();
     if (!$shippingAddress->getSameAsBilling()) {
         $billingAddress = $quote->getBillingAddress();
         if ($billingAddress->getCustomerAddressId() == null || $billingAddress->getCustomerAddressId() != $shippingAddress->getCustomerAddressId()) {
             if ($billingAddress->getName() != $shippingAddress->getName() || $billingAddress->getCompany() != $shippingAddress->getCompany() || $billingAddress->getCity() != $shippingAddress->getCity() || $billingAddress->getPostcode() != $shippingAddress->getPostcode() || $billingAddress->getCountryId() != $shippingAddress->getCountryId() || $billingAddress->getTelephone() != $shippingAddress->getTelephone() || $billingAddress->getFax() != $shippingAddress->getFax() || $billingAddress->getEmail() != $shippingAddress->getEmail() || $billingAddress->getCountry() != $shippingAddress->getCountry() || $billingAddress->getRegion() != $shippingAddress->getRegion() || $billingAddress->getStreet() != $shippingAddress->getStreet()) {
                 return false;
             }
         }
     }
     if ($quote->getQuoteCurrencyCode() != 'EUR') {
         return false;
     }
     return parent::isAvailable($quote);
 }