예제 #1
0
 public function void(\Magento\Payment\Model\InfoInterface $payment)
 {
     parent::void($payment);
     try {
         $data = array('Merchant_ID' => urlencode($this->getConfigData('merchant')), 'Billnumber' => urlencode($payment->getParentTransactionId()), 'Login' => urlencode($this->getConfigData('api_login')), 'Password' => urlencode($this->getConfigData('api_password')));
         $xml = $this->callAssist(self::CANCEL_URL, $data);
         if ((int) $xml['firstcode'] || (int) $xml['secondcode']) {
             throw new \Magento\Framework\Exception\LocalizedException(__('error in call'));
         }
         if ('AS000' != (string) $xml->orders->order->responsecode) {
             throw new \Magento\Framework\Exception\LocalizedException($this->getAssistErrors((string) $xml->orders->order->responsecode));
         }
         /*
         if (Mage::helper('assist')->isServiceSecured()) {
             $y = implode("", array(
                         $this->getConfigData('merchant'),
                         (string)$xml->orders->order->ordernumber,
                         (string)$xml->orders->order->orderamount,
                         (string)$xml->orders->order->ordercurrency,
                         (string)$xml->orders->order->orderstate,
                         (string)$xml->orders->order->packetdate
                     ));
             $keyFile = Mage::getBaseDir('var') . DS . self::PEM_DIR . DS . $this->getConfigData('assist_key');
             if ((string)$xml->orders->order->signature != $this->sign($y, $keyFile)) {
                 throw new \Magento\Framework\Exception\LocalizedException(__('Incorrect Signature.'));
             }
         }
         */
         // success
         $this->_debugger->debug(var_export($xml, true));
     } catch (\Magento\Framework\Exception\LocalizedException $e) {
         $this->_debugger->debug($e->getMessage());
         throw $e;
     }
     $this->_debugger->debug('void');
     return $this;
 }