示例#1
0
 /**
  * Prepare invoice data for refund
  *
  * @param \Magento\Sales\Model\Order\Creditmemo $creditmemo
  * @return void
  */
 protected function prepareInvoice(\Magento\Sales\Model\Order\Creditmemo $creditmemo)
 {
     if ($creditmemo->getInvoice()) {
         $creditmemo->getInvoice()->setIsUsedForRefund(true);
         $creditmemo->getInvoice()->setBaseTotalRefunded($creditmemo->getInvoice()->getBaseTotalRefunded() + $creditmemo->getBaseGrandTotal());
         $creditmemo->setInvoiceId($creditmemo->getInvoice()->getId());
     }
 }