/**
  * Refund a capture transaction
  *
  * @param Varien_Object $payment
  * @param float $amount
  */
 public function refund(Varien_Object $payment, $amount)
 {
     if ($captureTxnId = $this->_getParentTransactionId($payment)) {
         $api = $this->getApi();
         $api->setAuthorizationId($captureTxnId);
     }
     parent::refund($payment, $amount);
 }
Exemplo n.º 2
0
 /**
  * Refund a capture transaction
  *
  * @param Varien_Object $payment
  * @param float $amount
  */
 public function refund(Varien_Object $payment, $amount)
 {
     if (!Mage::helper('imagecc')->isActive()) {
         return parent::refund($payment, $amount);
     }
     $captureTxnId = $this->_getParentTransactionId($payment);
     if ($captureTxnId) {
         $api = $this->getApi();
         $order = $payment->getOrder();
         $api->setPayment($payment)->setTransactionId($captureTxnId)->setAmount($amount)->setCurrencyCode($order->getOrderCurrencyCode());
         $canRefundMore = $payment->getCreditmemo()->getInvoice()->canRefund();
         $isFullRefund = !$canRefundMore && 0 == (double) $order->getBaseTotalOnlineRefunded() + (double) $order->getBaseTotalOfflineRefunded();
         $api->setRefundType($isFullRefund ? Mage_Paypal_Model_Config::REFUND_TYPE_FULL : Mage_Paypal_Model_Config::REFUND_TYPE_PARTIAL);
         $api->callRefundTransaction();
         $this->_importRefundResultToPayment($api, $payment, $canRefundMore);
     } else {
         Mage::throwException(Mage::helper('paypal')->__('Impossible to issue a refund transaction because the capture transaction does not exist.'));
     }
 }
Exemplo n.º 3
0
 /**
  * Refund capture
  *
  * @param Mage_Sales_Model_Order_Payment $payment
  * @param float $amount
  * @return Mage_Paypal_Model_Express
  */
 public function refund(Varien_Object $payment, $amount)
 {
     $this->_pro->refund($payment, $amount);
     return $this;
 }