Пример #1
0
 /**
  * This method takes two order context addresses and compares them.
  * The method returns true, when they match.
  *
  * @param Customweb_Payment_Authorization_OrderContext_IAddress $address1
  * @param Customweb_Payment_Authorization_OrderContext_IAddress $address2
  * @return boolean
  */
 public static function compareAddresses(Customweb_Payment_Authorization_OrderContext_IAddress $address1, Customweb_Payment_Authorization_OrderContext_IAddress $address2)
 {
     if ($address1->getCity() != $address2->getCity()) {
         return false;
     }
     if ($address1->getCompanyName() != $address2->getCompanyName()) {
         return false;
     }
     if ($address1->getCountryIsoCode() != $address2->getCountryIsoCode()) {
         return false;
     }
     if ($address1->getFirstName() != $address2->getFirstName()) {
         return false;
     }
     if ($address1->getLastName() != $address2->getLastName()) {
         return false;
     }
     if ($address1->getPostCode() != $address2->getPostCode()) {
         return false;
     }
     if ($address1->getStreet() != $address2->getStreet()) {
         return false;
     }
     return true;
 }
 protected final function checkAddress(Customweb_Payment_Authorization_OrderContext_IAddress $address)
 {
     Customweb_Core_Assert::hasLength($address->getFirstName(), "The address must contain a firstname.");
     Customweb_Core_Assert::hasLength($address->getLastName(), "The address must contain a lastname.");
     Customweb_Core_Assert::hasLength($address->getStreet(), "The address must contain a street.");
     Customweb_Core_Assert::hasLength($address->getPostCode(), "The address must contain a post code.");
     Customweb_Core_Assert::hasLength($address->getCountryIsoCode(), "The address must contain a country.");
     Customweb_Core_Assert::hasLength($address->getCity(), "The address must contain a city.");
 }
Пример #3
0
 private static function addressPartsToArray(Customweb_Payment_Authorization_OrderContext_IAddress $address)
 {
     $parts = array($address->getCity(), $address->getCommercialRegisterNumber(), $address->getCompanyName(), $address->getCountryIsoCode(), $address->getEMailAddress(), $address->getFirstName(), $address->getGender(), $address->getLastName(), $address->getMobilePhoneNumber(), $address->getPhoneNumber(), $address->getPostCode(), $address->getSalesTaxNumber(), $address->getSalutation(), $address->getSocialSecurityNumber(), $address->getState(), $address->getStreet());
     $dob = $address->getDateOfBirth();
     if ($dob instanceof DateTime) {
         $parts[] = $dob->format('Y-m-d');
     }
     return $parts;
 }
 private function updateAddress(Mage_Sales_Model_Quote_Address $target, Customweb_Payment_Authorization_OrderContext_IAddress $source)
 {
     $target->setEmail($source->getEMailAddress())->setFirstname($source->getFirstName())->setLastname($source->getLastName())->setCompany($source->getCompanyName())->setCity($source->getCity())->setPostcode($source->getPostCode())->setTelephone($source->getPhoneNumber())->setStreet($source->getStreet())->setCountryId($source->getCountryIsoCode())->setRegion($source->getState());
     $region = Mage::getModel('directory/region')->loadByCode($source->getState(), $source->getCountryIsoCode());
     if ($region != null && $region->getId()) {
         $target->setRegion($region->getName())->setRegionId($region->getId());
     }
 }
Пример #5
0
 public function __construct(Customweb_Payment_Authorization_OrderContext_IAddress $address = null)
 {
     if ($address !== null) {
         $this->city = $address->getCity();
         $this->commercialRegisterNumber = $address->getCommercialRegisterNumber();
         $this->companyName = $address->getCompanyName();
         $this->countryIsoCode = $address->getCountryIsoCode();
         $this->dateOfBirth = $address->getDateOfBirth();
         $this->emailAddress = $address->getEMailAddress();
         $this->firstName = $address->getFirstName();
         $this->gender = $address->getGender();
         $this->lastName = $address->getLastName();
         $this->mobilePhoneNumber = $address->getMobilePhoneNumber();
         $this->phoneNumber = $address->getPhoneNumber();
         $this->postCode = $address->getPostCode();
         $this->salesTaxNumber = $address->getSalesTaxNumber();
         $this->salutation = $address->getSalutation();
         $this->state = $address->getState();
         $this->street = $address->getStreet();
     }
 }