public function refund(Varien_Object $payment, $amount) { $payment->setAmount($amount); $payment->setOpcode(self::OPCODE_REFUND); $this->setTransactionId($payment->getParentTransactionId()); $request = $this->_buildRequest($payment); $result = $this->_postRequest($request); $payment->setStatus(self::STATUS_APPROVED)->setTransactionId($result->getTransaction())->setIsTransactionClosed(1); return $this; }