/**
  * Check void availability
  *
  * @param   Varien_Object $payment
  * @return  bool
  */
 public function canVoid(Varien_Object $payment)
 {
     if ($payment instanceof Mage_Sales_Model_Order_Invoice || $payment instanceof Mage_Sales_Model_Order_Creditmemo) {
         return false;
     }
     if ($payment->getAmountPaid()) {
         $this->_canVoid = false;
     }
     return $this->_canVoid;
 }
Example #2
0
 public function refund(Varien_Object $payment, $amount)
 {
     $order = $payment->getOrder();
     $is_guest = $order->getCustomerIsGuest();
     if ($payment->getAmountPaid() != $amount) {
         throw new Exception($this->_getHelper()->__('OpenPay currently does not allow refunding partial or higher amounts.'));
     }
     if ($is_guest) {
         $this->_refundOrder($payment);
     } else {
         $this->_refundCustomer($payment);
     }
     return $this;
 }