Exemplo n.º 1
0
 public function config($urls)
 {
     //$returnUrl = $this->getUrl('wirecard_checkoutpage/processing/return', array('_secure' => true, '_nosid' => true));
     $returnUrl = $urls['return'];
     $init = new \WirecardCEE_QPay_FrontendClient($this->_dataHelper->getConfigArray());
     $init->setPluginVersion($this->_dataHelper->getPluginVersion());
     $init->setOrderReference('Configtest #' . uniqid());
     if ($this->_dataHelper->getConfigData('options/sendconfirmemail')) {
         $init->setConfirmMail($this->_dataHelper->getStoreConfigData('trans_email/ident_general/email'));
     }
     $consumerData = new \WirecardCEE_Stdlib_ConsumerData();
     $consumerData->setIpAddress($this->_dataHelper->getClientIp());
     $consumerData->setUserAgent($this->_dataHelper->getUserAgent());
     $init->setAmount(10)->setCurrency('EUR')->setPaymentType(\WirecardCEE_QPay_PaymentType::SELECT)->setOrderDescription('Configtest #' . uniqid())->setSuccessUrl($returnUrl)->setPendingUrl($returnUrl)->setCancelUrl($returnUrl)->setFailureUrl($returnUrl)->setConfirmUrl($urls['confirm'])->setServiceUrl($this->_dataHelper->getConfigData('options/service_url'))->setConsumerData($consumerData);
     if (strlen($this->_dataHelper->getConfigData('options/bgcolor'))) {
         $init->setBackgroundColor($this->_dataHelper->getConfigData('options/bgcolor'));
     }
     if (strlen($this->_dataHelper->getConfigData('options/displaytext'))) {
         $init->setDisplayText($this->_dataHelper->getConfigData('options/displaytext'));
     }
     if (strlen($this->_dataHelper->getConfigData('options/imageurl'))) {
         $init->setImageUrl($this->_dataHelper->getConfigData('options/imageurl'));
     }
     $initResponse = $init->initiate();
     if ($initResponse->getStatus() == \WirecardCEE_QPay_Response_Initiation::STATE_FAILURE) {
         $msg = $initResponse->getError()->getConsumerMessage();
         if (!strlen($msg)) {
             $msg = $initResponse->getError()->getMessage();
         }
         throw new \Exception($msg);
     }
     return true;
 }
 public function testSetUserAgent()
 {
     $consumerUserAgent = 'testing';
     $this->object->setUserAgent($consumerUserAgent);
     $data = $this->object->getData();
     $this->assertArrayHasKey('consumerUserAgent', $data);
     $this->assertEquals($consumerUserAgent, $data['consumerUserAgent']);
 }
Exemplo n.º 3
0
 /**
  * @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;
 }
 /**
  * Tests WirecardCEE_QMore_FrontendClient->getResponse()
  */
 public function testGetResponse()
 {
     $consumerData = new WirecardCEE_Stdlib_ConsumerData();
     $consumerData->setIpAddress('10.1.0.11');
     $consumerData->setUserAgent('phpUnit');
     $this->object->setAmount(100)->setCurrency('eur')->setPaymentType(WirecardCEE_QMore_PaymentType::PAYPAL)->setOrderDescription(__METHOD__)->setSuccessUrl('http://foo.bar.com/tests/confirm.php')->setCancelUrl('http://foo.bar.com/tests/confirm.php')->setFailureUrl('http://foo.bar.com/tests/confirm.php')->setServiceUrl('http://foo.bar.com/tests/confirm.php')->setConfirmUrl('http://foo.bar.com/tests/confirm.php')->setConsumerData($consumerData)->initiate();
     $oResponse = $this->object->getResponse();
     $this->assertInstanceOf('WirecardCEE_QMore_Response_Initiation', $oResponse);
     $this->assertEquals($oResponse->getStatus(), 0);
     $this->assertEmpty($oResponse->getErrors());
     $this->assertStringStartsWith('https://', $oResponse->getRedirectUrl());
 }
Exemplo n.º 5
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;
 }