Пример #1
0
 /**
  * Refund a capture transaction
  *
  * @param Varien_Object $payment
  * @param float $amount
  * @return $this
  * @throws Mage_Core_Exception
  */
 public function refund(Varien_Object $payment, $amount)
 {
     $transactionId = $this->getParentTransactionId($payment);
     try {
         Stripe\Charge::retrieve($transactionId)->refund();
     } catch (Exception $e) {
         $this->debugData($e->getMessage());
         Mage::throwException(Mage::helper('boolfly_stripe')->__('Payment refunding error.'));
     }
     $payment->setTransactionId($transactionId . '-' . Mage_Sales_Model_Order_Payment_Transaction::TYPE_REFUND)->setParentTransactionId($transactionId)->setIsTransactionClosed(1)->setShouldCloseParentTransaction(1);
     return $this;
 }