Ejemplo n.º 1
0
 public function testconfig()
 {
     /** @var Wirecard_CheckoutSeamless_Helper_Data $helper */
     $helper = Mage::helper('wirecard_checkoutseamless');
     $returnUrl = Mage::getUrl('wirecard_checkoutseamless/processing/storereturn', array('_secure' => true, '_nosid' => true));
     $dataStorageInit = new WirecardCEE_QMore_DataStorageClient($helper->getConfigArray());
     $dataStorageInit->setReturnUrl($returnUrl);
     $dataStorageInit->setOrderIdent(session_id());
     try {
         $response = $dataStorageInit->initiate();
         if ($response->getStatus() != WirecardCEE_QMore_DataStorage_Response_Initiation::STATE_SUCCESS) {
             $msg = array();
             foreach ($response->getErrors() as $error) {
                 $msg[] = $error->getConsumerMessage();
             }
             Mage::getSingleton('core/session')->addError(implode("<br/>\n", $msg));
             return false;
         }
     } catch (Exception $e) {
         Mage::getSingleton('core/session')->addError($e->getMessage());
         return false;
     }
     Mage::getSingleton('core/session')->addSuccess($helper->__('Configuration test ok'));
     return true;
 }
Ejemplo n.º 2
0
 /**
  * @return bool|null|WirecardCEE_QMore_DataStorage_Response_Initiation
  */
 public function initDatastorage()
 {
     $dataStorageInit = new WirecardCEE_QMore_DataStorageClient($this->getConfigArray());
     $dataStorageInit->setReturnUrl(Mage::getUrl('wirecard_checkoutseamless/processing/storereturn', array('_secure' => true)));
     $dataStorageInit->setOrderIdent(Mage::getSingleton('checkout/session')->getQuote()->getId());
     $response = null;
     if ($this->getConfigData('ccard/pci3_dss_saq_a_enable')) {
         $dataStorageInit->setJavascriptScriptVersion('pci3');
         if (strlen(trim($this->getConfigData('ccard/iframe_css_url')))) {
             $dataStorageInit->setIframeCssUrl(trim($this->getConfigData('ccard/iframe_css_url')));
         }
         $dataStorageInit->setCreditCardCardholderNameField($this->getConfigData('ccard/showcardholder'));
         $dataStorageInit->setCreditCardShowCvcField($this->getConfigData('ccard/showcvc'));
         $dataStorageInit->setCreditCardShowIssueDateField($this->getConfigData('ccard/showissuedate'));
         $dataStorageInit->setCreditCardShowIssueNumberField($this->getConfigData('ccard/showissuenumber'));
     }
     $this->log(__METHOD__ . ':' . print_r($dataStorageInit->getRequestData(), true), Zend_Log::INFO);
     try {
         $response = $dataStorageInit->initiate();
         if ($response->getStatus() == WirecardCEE_QMore_DataStorage_Response_Initiation::STATE_SUCCESS) {
             Mage::getSingleton('checkout/session')->setWirecardCheckoutSeamlessStorageId($response->getStorageId());
             $this->log(__METHOD__ . ':storageid:' . $response->getStorageId(), Zend_Log::DEBUG);
             return $response;
         } else {
             $dsErrors = $response->getErrors();
             foreach ($dsErrors as $error) {
                 $this->log(__METHOD__ . ':' . $error->getMessage());
             }
             return false;
         }
     } catch (Exception $e) {
         //communication with dataStorage failed. we choose a none dataStorage fallback
         $this->log(__METHOD__ . ':' . $e->getMessage(), Zend_Log::ERR);
         return false;
     }
 }