예제 #1
0
 /**
  * Cancel specified invoice: update self totals from it
  *
  * @param Invoice $invoice
  * @return $this
  */
 public function cancelInvoice($invoice)
 {
     $this->_updateTotals(['amount_paid' => -1 * $invoice->getGrandTotal(), 'base_amount_paid' => -1 * $invoice->getBaseGrandTotal(), 'shipping_captured' => -1 * $invoice->getShippingAmount(), 'base_shipping_captured' => -1 * $invoice->getBaseShippingAmount()]);
     $this->_eventManager->dispatch('sales_order_payment_cancel_invoice', ['payment' => $this, 'invoice' => $invoice]);
     return $this;
 }