How is \Magento\Sales\Model\Order\Payment::accept() implemented and used?

Implementation

ffea3cd/app/code/Magento/Sales/Model/Order/Payment.php#L852-L880

/**
 * Accept online a payment that is in review state
 *
 * @return $this
 */
public function accept()
{
	$transactionId = $this->getLastTransId();

	/** @var \Magento\Payment\Model\Method\AbstractMethod $method */
	$method = $this->getMethodInstance();
	$method->setStore($this->getOrder()->getStoreId());
	if ($method->acceptPayment($this)) {
		$invoice = $this->_getInvoiceForTransactionId($transactionId);
		$message = $this->_appendTransactionToMessage(
			$transactionId,
			$this->prependMessage(__('Approved the payment online.'))
		);
		$this->updateBaseAmountPaidOnlineTotal($invoice);
		$this->setOrderStateProcessing($message);
	} else {
		$message = $this->_appendTransactionToMessage(
			$transactionId,
			$this->prependMessage(__('There is no need to approve this payment.'))
		);
		$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?

See also: