Exemplo n.º 1
0
 /**
  * Return Sales Quote Address model
  *
  * @return \Magento\Quote\Model\Quote\Address
  */
 public function getAddress()
 {
     if ($this->_address === null) {
         if ($this->isCustomerLoggedIn()) {
             $this->_address = $this->getQuote()->getBillingAddress();
             if (!$this->_address->getFirstname()) {
                 $this->_address->setFirstname($this->getQuote()->getCustomer()->getFirstname());
             }
             if (!$this->_address->getLastname()) {
                 $this->_address->setLastname($this->getQuote()->getCustomer()->getLastname());
             }
         } else {
             $this->_address = $this->_addressFactory->create();
         }
     }
     return $this->_address;
 }
Exemplo n.º 2
0
 /**
  * @param \Magento\Quote\Model\Quote\Address $source
  * @param string $type
  *
  * @return \WirecardCEE_Stdlib_ConsumerData_Address
  */
 protected function _getAddress($source, $type = 'billing')
 {
     switch ($type) {
         case 'shipping':
             $address = new \WirecardCEE_Stdlib_ConsumerData_Address(\WirecardCEE_Stdlib_ConsumerData_Address::TYPE_SHIPPING);
             break;
         default:
             $address = new \WirecardCEE_Stdlib_ConsumerData_Address(\WirecardCEE_Stdlib_ConsumerData_Address::TYPE_BILLING);
             break;
     }
     $address->setFirstname($source->getFirstname());
     $address->setLastname($source->getLastname());
     $address->setAddress1($source->getStreetLine(1));
     $address->setAddress2($source->getStreetLine(2));
     $address->setZipCode($source->getPostcode());
     $address->setCity($source->getCity());
     $address->setCountry($source->getCountry());
     $address->setState($source->getRegionCode());
     $address->setPhone($source->getTelephone());
     $address->setFax($source->getFax());
     return $address;
 }