protected function PaymentCheckoutController::validateStepId in Commerce Core 8.2
Validates the requested step ID.
Redirects to the actual step ID if the requested one is no longer available. This can happen if payment was already cancelled, or if the payment "notify" endpoint created the payment and placed the order before the customer returned to the site.
Parameters
string $requested_step_id: The requested step ID, usually "payment".
\Drupal\commerce_order\Entity\OrderInterface $order: The order.
Throws
\Drupal\commerce\Response\NeedsRedirectException
2 calls to PaymentCheckoutController::validateStepId()
- PaymentCheckoutController::cancelPage in modules/
payment/ src/ Controller/ PaymentCheckoutController.php - Provides the "cancel" checkout payment page.
- PaymentCheckoutController::returnPage in modules/
payment/ src/ Controller/ PaymentCheckoutController.php - Provides the "return" checkout payment page.
File
- modules/
payment/ src/ Controller/ PaymentCheckoutController.php, line 154
Class
- PaymentCheckoutController
- Provides checkout endpoints for off-site payments.
Namespace
Drupal\commerce_payment\ControllerCode
protected function validateStepId($requested_step_id, OrderInterface $order) {
$step_id = $this->checkoutOrderManager
->getCheckoutStepId($order);
if ($requested_step_id != $step_id) {
throw new NeedsRedirectException(Url::fromRoute('commerce_checkout.form', [
'commerce_order' => $order
->id(),
'step' => $step_id,
])
->toString());
}
}