Implementation
ffea3cd/app/code/Magento/Sales/Model/Order/Payment/State/CaptureCommand.php#L14-L43
/**
* Run command
*
* @param OrderPaymentInterface $payment
* @param string|float|int $amount
* @param OrderInterface $order
* @return string
*/
public function execute(OrderPaymentInterface $payment, $amount, OrderInterface $order)
{
$state = SalesOrder::STATE_PROCESSING;
$status = false;
$formattedAmount = $order->getBaseCurrency()->formatTxt($amount);
if ($payment->getIsTransactionPending()) {
$message = __(
'An amount of %1 will be captured after being approved at the payment gateway.',
$formattedAmount
);
$state = SalesOrder::STATE_PAYMENT_REVIEW;
if ($payment->getIsFraudDetected()) {
$status = SalesOrder::STATUS_FRAUD;
}
} else {
// normal online capture: invoice is marked as "paid"
$message = __('Captured amount of %1 online', $formattedAmount);
}
$this->setOrderStateAndStatus($order, $status, $state);
return $message;
}
Details:
The single usage
https://github.com/magento/magento2/blob/ffea3cd/app/code/Magento/Sales/etc/di.xml#L876-L880