Example #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;
 }
 /**
  *
  * @expectedException WirecardCEE_QPay_Exception_InvalidArgumentException
  */
 public function testFailedInitiate()
 {
     $oResponse = $this->object->initiate();
 }