Implementation
ffea3cd/app/code/Magento/Sales/Model/Order/Payment.php#L882-L920
/**
* Accept order with payment method instance
*
* @param bool $isOnline
* @return $this
* @throws \Magento\Framework\Exception\LocalizedException
*/
public function deny($isOnline = true)
{
$transactionId = $isOnline ? $this->getLastTransId() : $this->getTransactionId();
if ($isOnline) {
/** @var \Magento\Payment\Model\Method\AbstractMethod $method */
$method = $this->getMethodInstance();
$method->setStore($this->getOrder()->getStoreId());
$result = $method->denyPayment($this);
} else {
$result = (bool)$this->getNotificationResult();
}
if ($result) {
$invoice = $this->_getInvoiceForTransactionId($transactionId);
$message = $this->_appendTransactionToMessage(
$transactionId,
$this->prependMessage(__('Denied the payment online'))
);
$this->cancelInvoiceAndRegisterCancellation($invoice, $message);
} else {
$txt = $isOnline ?
'There is no need to deny this payment.' : 'Registered notification about denied payment.';
$message = $this->_appendTransactionToMessage(
$transactionId,
$this->prependMessage(__($txt))
);
$this->setOrderStatePaymentReview($message, $transactionId);
}
return $this;
}
Details: How is \Magento\Sales\Model\Order\Payment::setOrderStatePaymentReview()
implemented and used?
The single usage
\Magento\Sales\Controller\Adminhtml\Order\ReviewPayment::execute()
Details: How does \Magento\Sales\Controller\Adminhtml\Order\ReviewPayment::execute()
work?