Beispiel #1
0
 /**
  * Process a refund or a chargeback
  */
 protected function _registerPaymentRefund()
 {
     $this->_importPaymentInformation();
     $reason = $this->getRequestData('reason_code');
     $isRefundFinal = !$this->_info->isReversalDisputable($reason);
     $payment = $this->_order->getPayment()->setPreparedMessage($this->_createIpnComment($this->_info->explainReasonCode($reason)))->setTransactionId($this->getRequestData('txn_id'))->setParentTransactionId($this->getRequestData('parent_txn_id'))->setIsTransactionClosed($isRefundFinal)->registerRefundNotification(-1 * $this->getRequestData('mc_gross'));
     $this->_order->save();
     // TODO: there is no way to close a capture right now
     if ($creditmemo = $payment->getCreatedCreditmemo()) {
         $creditmemo->sendEmail();
         $comment = $this->_order->addStatusHistoryComment(Mage::helper('paypal')->__('Notified customer about creditmemo #%s.', $creditmemo->getIncrementId()))->setIsCustomerNotified(true)->save();
     }
 }