Implementation
981d1f/app/code/Magento/Sales/Model/Order/Payment.php#L808-L827
/**
* Order cancellation hook for payment method instance
* Adds void transaction if needed
*
* @return $this
*/
public function cancel()
{
$isOnline = true;
if (!$this->canVoid()) {
$isOnline = false;
}
if (!$this->hasMessage()) {
$this->setMessage($isOnline ? __('Canceled order online') : __('Canceled order offline'));
}
if ($isOnline) {
$this->_void($isOnline, null, 'cancel');
}
$this->_eventManager->dispatch('sales_order_payment_cancel', ['payment' => $this]);
return $this;
}
Details:
- How is
\Magento\Sales\Model\Order\Payment::canVoid()
implemented and used? - How is
\Magento\Sales\Model\Order\Payment::_void()
implemented and used?
The single usage
\Magento\Sales\Model\Order::cancel()
Details: How is \Magento\Sales\Model\Order::cancel()
implemented and used?