public function testSetBirthDate() { $birthDate = new DateTime(); $this->object->setBirthDate($birthDate); $data = $this->object->getData(); $this->assertArrayHasKey('consumerBirthDate', $data); $this->assertEquals($birthDate->format('Y-m-d'), $data['consumerBirthDate']); }
/** * @return WirecardCEE_Stdlib_ConsumerData * @throws Zend_Controller_Request_Exception */ protected function _getConsumerData() { $consumerData = new WirecardCEE_Stdlib_ConsumerData(); $consumerData->setIpAddress(Mage::app()->getRequest()->getServer('REMOTE_ADDR')); $consumerData->setUserAgent(Mage::app()->getRequest()->getHeader('User-Agent')); $deliveryAddress = $this->getOrder()->getShippingAddress(); $billingAddress = $this->getOrder()->getBillingAddress(); $dob = $this->getCustomerDob(); if ($this->_forceSendAdditionalData || $this->_getHelper()->getConfigData('options/sendadditionaldata')) { $consumerData->setEmail($this->getOrder()->getCustomerEmail()); if ($dob !== false) { $consumerData->setBirthDate($dob); } $consumerData->addAddressInformation($this->_getAddress($billingAddress, 'billing')); $consumerData->addAddressInformation($this->_getAddress($deliveryAddress, 'shipping')); } return $consumerData; }
/** * @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; }