当前位置: 首页>>代码示例>>PHP>>正文


PHP Mage_Payment_Model_Method_Abstract::refund方法代码示例

本文整理汇总了PHP中Mage_Payment_Model_Method_Abstract::refund方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Payment_Model_Method_Abstract::refund方法的具体用法?PHP Mage_Payment_Model_Method_Abstract::refund怎么用?PHP Mage_Payment_Model_Method_Abstract::refund使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mage_Payment_Model_Method_Abstract的用法示例。


在下文中一共展示了Mage_Payment_Model_Method_Abstract::refund方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: refund

 /**
  * Refund specified amount for payment
  *
  * @param Mage_Sales_Model_Order_Payment $payment
  * @param float                          $amount
  *
  * @return $this
  */
 public function refund(Varien_Object $payment, $amount)
 {
     parent::refund($payment, $amount);
     /** @var Mage_Sales_Model_Order_Payment $payment */
     $order = $payment->getOrder();
     /** @var Rede_ClickPag_Model_Processor $processor */
     $processor = $this->_processor();
     $processor->setOrder($order);
     $validation = $this->_validateRefundParameters($processor->getRefundParams());
     if ($validation !== true) {
         Mage::throwException($validation);
     }
     /** @var Rede_ClickPag_Model_Payments $payments */
     $payments = Mage::getModel('rede_clickpag/payments')->loadByOrderId($order->getId());
     $transactionId = $payments->getTransactionId();
     if (!$transactionId) {
         Mage::throwException($this->_helper()->__('Transaction ID is empty for this order.'), 'adminhtml/session');
         return $this;
     }
     /** @var Rede_ClickPag_Model_Api $api */
     $api = Mage::getModel('rede_clickpag/api');
     $api->refund($transactionId);
     $this->_validateRefundResult($api);
     if ($api->getResult()->getStatus() === 202 && Mage::app()->getStore()->isAdmin()) {
         $message = $this->_helper()->__('Your order was successfully refunded.');
         $this->_getAdminSession()->addSuccess($message);
     }
     return $this;
 }
开发者ID:marcoescudeiro,项目名称:clickpag-magento,代码行数:37,代码来源:Standard.php

示例2: refund

 public function refund(Varien_Object $payment, $amount)
 {
     parent::refund($payment, $amount);
     $txn = $payment->getAuthorizationTransaction();
     if ($txn) {
         try {
             $billnumber = $txn->getParentTxnId() ? $txn->getParentTxnId() : $txn->getTxnId();
             $data = array('Merchant_ID' => urlencode($this->getConfigData('merchant')), 'Billnumber' => urlencode($billnumber), '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']) {
                 Mage::throwException('error in call');
             }
             if ('AS000' != (string) $xml->orders->order->responsecode) {
                 Mage::throwException($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)) {
                     Mage::throwException('Incorrect Signature.');
                 }
             }
             // success
             Mage::helper('assist')->debug($xml);
         } catch (Mage_Core_Exception $e) {
             Mage::helper('assist')->debug($e->getMessage());
             throw $e;
         }
     }
     Mage::helper('assist')->debug('refund');
     return $this;
 }
开发者ID:vuleticd,项目名称:vuleticd_assist,代码行数:32,代码来源:Payment.php

示例3: refund

 /**
  * Refunds a transaction
  * @param  Varien_Object $payment
  * @param  float $amount
  * @return Mage_Payment_Model_Method_Abstract
  */
 public function refund(Varien_Object $payment, $amount)
 {
     $hash = $payment->getData('ebanx_hash');
     Mage::log('Refund order ' . $hash);
     $response = \Ebanx\Ebanx::doRefund(array('hash' => $hash, 'operation' => 'request', 'amount' => $amount, 'description' => 'Order refunded'));
     return parent::refund($payment, $amount);
 }
开发者ID:jonathanweb,项目名称:ebanx-magento,代码行数:13,代码来源:Payment.php

示例4: refund

 /**
  * Refund capture
  * @param Varien_Object $payment
  * @param $amount
  * @return $this
  */
 public function refund(Varien_Object $payment, $amount)
 {
     Mage::helper('partpayment/tools')->addToDebug('Action: Refund');
     parent::refund($payment, $amount);
     if ($amount <= 0) {
         Mage::throwException(Mage::helper('paygate')->__('Invalid amount for refund.'));
     }
     if (!$payment->getLastTransId()) {
         Mage::throwException(Mage::helper('paygate')->__('Invalid transaction ID.'));
     }
     // Load transaction Data
     $transactionId = $payment->getLastTransId();
     $transaction = $payment->getTransaction($transactionId);
     if (!$transaction) {
         Mage::throwException(Mage::helper('partpayment')->__('Can\'t load last transaction.'));
     }
     // Get Transaction Details
     $details = $this->fetchTransactionInfo($payment, $transactionId);
     //$details = $transaction->getAdditionalInformation(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS);
     // Check for Capture and Authorize transaction only
     if ((int) $details['transactionStatus'] !== 6 && (int) $details['transactionStatus'] !== 0) {
         Mage::throwException(Mage::helper('partpayment')->__('This payment has not yet captured.'));
     }
     $transactionNumber = $details['transactionNumber'];
     $order_id = $details['orderId'];
     if (!$order_id) {
         $order_id = $payment->getOrder()->getId();
     }
     // Call PXOrder.PXOrder.Credit5
     $params = array('accountNumber' => '', 'transactionNumber' => $transactionNumber, 'amount' => round(100 * $amount), 'orderId' => $order_id, 'vatAmount' => 0, 'additionalValues' => '');
     $result = Mage::helper('partpayment/api')->getPx()->Credit5($params);
     Mage::helper('partpayment/tools')->addToDebug('PxOrder.Credit5:' . $result['description'], $order_id);
     // Check Results
     if ($result['code'] === 'OK' && $result['errorCode'] === 'OK' && $result['description'] === 'OK') {
         // Add Credit Transaction
         $payment->setAnetTransType(Mage_Sales_Model_Order_Payment_Transaction::TYPE_REFUND);
         $payment->setAmount($amount);
         $payment->setStatus(self::STATUS_APPROVED)->setTransactionId($result['transactionNumber'])->setIsTransactionClosed(0);
         // No-Closed
         // Add Transaction fields
         $payment->setAdditionalInformation(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS, $result);
         return $this;
     }
     // Show Error
     Mage::helper('partpayment/tools')->throwPayExException($result, 'PxOrder.Credit5');
     return $this;
 }
开发者ID:anziv,项目名称:Magento-modules,代码行数:53,代码来源:Payment.php

示例5: refund

 /**
  * Refund
  *
  * @param Varien_Object $payment
  * @param float $amount
  * @return \Mage_Payment_Model_Abstract|void
  */
 public function refund(Varien_Object $payment, $amount)
 {
     //If the refund will be created by OPS, Refund Create Method to nothing
     if (true === Mage::registry('ops_auto_creditmemo')) {
         Mage::unregister('ops_auto_creditmemo');
         return parent::refund($payment, $amount);
     }
     $refundHelper = Mage::helper('ops/order_refund')->setAmount($amount)->setPayment($payment);
     $arrInfo = $refundHelper->prepareOperation($payment, $amount);
     $storeId = $payment->getOrder()->getStoreId();
     $operation = $arrInfo['operation'];
     try {
         $requestParams = $this->getBackendOperationParameterModel()->getParameterFor(self::OPS_REFUND_TRANSACTION_TYPE, $this, $payment, $amount, $arrInfo);
         $response = Mage::getSingleton('ops/api_directlink')->performRequest($requestParams, Mage::getModel('ops/config')->getDirectLinkGatewayPath($storeId), $storeId);
         Mage::helper('ops/payment')->saveOpsStatusToPayment($payment, $response);
         if ($response['STATUS'] == self::OPS_REFUND_WAITING || $response['STATUS'] == self::OPS_REFUND_UNCERTAIN_STATUS) {
             Mage::helper('ops/payment')->saveOpsRefundOperationCodeToPayment($payment, $operation);
             $refundHelper->createRefundTransaction($response);
         } elseif ($response['STATUS'] == self::OPS_REFUNDED || $response['STATUS'] == self::OPS_REFUND_PROCESSED_MERCHANT) {
             //do refund directly if response is ok already
             Mage::helper('ops/payment')->saveOpsRefundOperationCodeToPayment($payment, $operation);
             $refundHelper->createRefundTransaction($response, 1);
             return parent::refund($payment, $amount);
         } else {
             Mage::throwException($this->getHelper()->__('The CreditMemo was not created. Barclaycard status: %s.', $response['STATUS']));
         }
         Mage::getSingleton('core/session')->addNotice($this->getHelper()->__('The Creditmemo will be created automatically as soon as Barclaycard sends an acknowledgement.'));
         $this->getHelper()->redirect(Mage::getUrl('*/sales_order/view', array('order_id' => $payment->getOrder()->getId())));
     } catch (Exception $e) {
         Mage::logException($e);
         Mage::getModel('ops/status_update')->updateStatusFor($payment->getOrder());
         Mage::throwException($e->getMessage());
     }
 }
开发者ID:roshu1980,项目名称:add-computers,代码行数:41,代码来源:Abstract.php

示例6: refund

 public function refund(Varien_Object $payment, $amount)
 {
     parent::refund($payment, $amount);
     $this->cancel($payment, $amount);
     return $this;
 }
开发者ID:hsq,项目名称:Magento-1-1-ipayment,代码行数:6,代码来源:Abstract.php

示例7: refund

 /**
  * Refund money
  */
 public function refund(Varien_Object $payment, $amount)
 {
     $sendbaseamount = $this->getCommonConfigData('sendbaseamount');
     if (!$sendbaseamount) {
         // Multiple currencies, multiple channels fix
         $amount = $amount * $payment->getOrder()->getBaseToOrderRate();
     }
     parent::refund($payment, $amount);
     $params = $this->_initRequestParams();
     if ($sendbaseamount) {
         $amount = $amount >= $payment->getOrder()->getBaseGrandTotal() ? $payment->getOrder()->getBaseGrandTotal() : $amount;
         $params['PRESENTATION.CURRENCY'] = $payment->getOrder()->getBaseCurrencyCode();
     } else {
         $amount = $amount >= $payment->getOrder()->getGrandTotal() ? $payment->getOrder()->getGrandTotal() : $amount;
         // Multiple currencies, multiple channels fix
         $params['PRESENTATION.CURRENCY'] = $payment->getOrder()->getOrderCurrencyCode();
     }
     $params['PRESENTATION.AMOUNT'] = round($amount, 2);
     $params['PAYMENT.CODE'] = $this->_getPaymentCode(self::PAYMENT_TYPE_REFUND);
     $params['IDENTIFICATION.REFERENCEID'] = $payment->getLastTransId();
     $this->_getApi()->setStore($this->getStore());
     $response = $this->_getApi()->request($params);
     $this->_processResponse($params, $response, $payment);
     return $this;
 }
开发者ID:protechhelp,项目名称:gamamba,代码行数:28,代码来源:Abstract.php

示例8: refund

 /**
  *
  * @param Mage_Sales_Model_Order_Payment $payment
  * @param float $amount
  * @return @return Mage_Payment_Model_Abstract
  */
 public function refund(Varien_Object $payment, $amount)
 {
     parent::refund($payment, $amount);
     $transactionId = $payment->getLastTransId();
     $gatewayParams = array('operation' => 'refund', 'amount' => $amount);
     /* @var $request Allopass_Hipay_Model_Api_Request */
     $request = Mage::getModel('hipay/api_request', array($this));
     $action = Allopass_Hipay_Model_Api_Request::GATEWAY_ACTION_MAINTENANCE . $transactionId;
     $this->_debug($gatewayParams);
     $gatewayResponse = $request->gatewayRequest($action, $gatewayParams, $payment->getOrder()->getStoreId());
     $this->_debug($gatewayResponse->debug());
     switch ($gatewayResponse->getStatus()) {
         case "124":
         case "125":
         case "126":
             /* @var $creditmemo Mage_Sales_Model_Order_Creditmemo */
             $creditmemo = $payment->getCreditmemo();
             $creditmemo->setState(Mage_Sales_Model_Order_Creditmemo::STATE_OPEN);
             //State open = pending state
             break;
         default:
             Mage::throwException($gatewayResponse->getStatus() . " ==> " . $gatewayResponse->getMessage());
             break;
     }
     return $this;
 }
开发者ID:hipay,项目名称:hipay-fullservice-sdk-magento1,代码行数:32,代码来源:Abstract.php

示例9: refund

 /**
  * Refund
  * 
  * @param Varien_Object $payment 
  * @param float $amount 
  * @return 
  */
 public function refund(Varien_Object $payment, $amount)
 {
     //If the refund will be created by PostFinance, Refund Create Method to nothing
     if (true === Mage::registry('postfinance_auto_creditmemo')) {
         Mage::unregister('postfinance_auto_creditmemo');
         return parent::refund($payment, $amount);
     }
     /** @var $refundHelper PostFinance_Payment_Helper_Order_Refund */
     $refundHelper = Mage::helper('postfinance/order_refund');
     $refundHelper->setPayment($payment)->setAmount($amount);
     $operation = $refundHelper->getRefundOperation($payment, $amount);
     $requestParams = array('AMOUNT' => round($amount * 100), 'ORDERID' => $this->getConfig()->getConfigData('devprefix') . $payment->getOrder()->getQuoteId(), 'OPERATION' => $operation);
     try {
         $url = Mage::getModel('postfinance/config')->getDirectLinkGatewayPath();
         $response = Mage::getModel('postfinance/api_directlink')->performRequest($requestParams, $url);
         Mage::helper('postfinance/payment')->savePostFinanceStatusToPayment($payment, $response);
         if ($response['STATUS'] == self::POSTFINANCE_REFUND_WAITING || $response['STATUS'] == self::POSTFINANCE_REFUND_UNCERTAIN_STATUS) {
             $refundHelper->createRefundTransaction($response);
         } elseif ($response['STATUS'] == self::POSTFINANCE_REFUNDED || $response['STATUS'] == self::POSTFINANCE_REFUND_PROCESSED_MERCHANT) {
             //do refund directly if response is ok already
             $refundHelper->createRefundTransaction($response, 1);
             return parent::refund($payment, $amount);
         } else {
             Mage::throwException($this->getHelper()->__('The CreditMemo was not created. PostFinance status: %s.', $response['status']));
         }
         Mage::getSingleton('core/session')->addNotice($this->getHelper()->__('The Creditmemo will be created automatically as soon as PostFinance sends an acknowledgement.'));
         $this->getHelper()->redirect(Mage::getUrl('*/sales_order/view', array('order_id' => $payment->getOrder()->getId())));
     } catch (Exception $e) {
         Mage::throwException($e->getMessage());
     }
 }
开发者ID:nomade-it,项目名称:MagentoPostFinance,代码行数:38,代码来源:Abstract.php

示例10: refund

 /**
  * @param Varien_Object $payment
  * @param unknown_type $amount
  */
 public function refund(Varien_Object $payment, $amount)
 {
     if ($this->_getConfigData('debug') === '1') {
         $this->writeLog('refund fx called');
     }
     parent::refund($payment, $amount);
     return $this;
 }
开发者ID:AmineCherrai,项目名称:rostanvo,代码行数:12,代码来源:Abstract.php

示例11: refund

 /**
  * @param Mage_Sales_Model_Order_Payment|Varien_Object $payment
  * @param float $amount
  * @return $this
  */
 public function refund(Varien_Object $payment, $amount)
 {
     parent::refund($payment, $amount);
     $order = $payment->getOrder();
     if ($order) {
         $this->_callPostOrder($order);
     }
     return $this;
 }
开发者ID:payin7-payments,项目名称:payin7-magento,代码行数:14,代码来源:Payin7daysPaymentMethod.php


注:本文中的Mage_Payment_Model_Method_Abstract::refund方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。