Exemplo n.º 1
0
 /**
  * @param Quote $quote
  *
  * @return \WirecardCEE_Stdlib_ConsumerData
  */
 protected function _getConsumerData($quote)
 {
     $consumerData = new \WirecardCEE_Stdlib_ConsumerData();
     $consumerData->setIpAddress($this->_dataHelper->getClientIp());
     $consumerData->setUserAgent($this->_dataHelper->getUserAgent());
     $deliveryAddress = $quote->getShippingAddress();
     $billingAddress = $quote->getBillingAddress();
     $dob = $this->getCustomerDob($quote);
     $consumerData->setEmail($quote->getCustomerEmail());
     if ($dob !== false) {
         $consumerData->setBirthDate($dob);
     }
     if (strlen($billingAddress->getCompany())) {
         $consumerData->setCompanyName($billingAddress->getCompany());
     }
     if (strlen($billingAddress->getVatId())) {
         $consumerData->setCompanyVatId($billingAddress->getVatId());
     }
     if ($this->_forceSendAdditionalData || $this->_dataHelper->getConfigData('options/sendbillingdata')) {
         $consumerData->addAddressInformation($this->_getAddress($billingAddress, 'billing'));
     }
     if ($this->_forceSendAdditionalData || $this->_dataHelper->getConfigData('options/sendshippingdata')) {
         $consumerData->addAddressInformation($this->_getAddress($deliveryAddress, 'shipping'));
     }
     return $consumerData;
 }