Exemplo n.º 1
0
 public function Refund(Varien_Object $payment, $amount)
 {
     try {
         $oPayment = new AllInOne();
         $oPayment->ServiceURL = $this->_getConfigData('test_mode') ? 'http://payment-stage.allpay.com.tw/CreditDetail/DoAction' : 'https://payment.allpay.com.tw/CreditDetail/DoAction';
         $oPayment->HashKey = $this->_getConfigData('hash_key');
         $oPayment->HashIV = $this->_getConfigData('hash_iv');
         $oPayment->MerchantID = $this->_getConfigData('merchant_id');
         $oPayment->Action['MerchantTradeNo'] = ($this->_getConfigData('test_mode') ? $this->_getConfigData('test_order_prefix') : '') . $this->_getOrder()->getRealOrderId();
         $oPayment->Action['TradeNo'] = $payment->getLastTransId();
         $oPayment->Action['Action'] = ActionType::R;
         $oPayment->Action['TotalAmount'] = (int) $amount;
         $arFeedback = $oPayment->DoAction();
     } catch (Exception $e) {
         Mage::throwException($e->getMessage());
     }
     return $this;
 }