public function DummyRedirectController::on302 in Commerce Core 8.2
Callback method which reacts to GET from a 302 redirect.
Throws
\Drupal\commerce\Response\NeedsRedirectException
1 string reference to 'DummyRedirectController::on302'
- commerce_payment_example.routing.yml in modules/
payment_example/ commerce_payment_example.routing.yml - modules/payment_example/commerce_payment_example.routing.yml
File
- modules/
payment_example/ src/ Controller/ DummyRedirectController.php, line 63
Class
- DummyRedirectController
- This is a dummy controller for mocking an off-site gateway.
Namespace
Drupal\commerce_payment_example\ControllerCode
public function on302() {
$cancel = $this->currentRequest->query
->get('cancel');
$return = $this->currentRequest->query
->get('return');
$total = $this->currentRequest->query
->get('total');
if ($total > 20) {
return new TrustedRedirectResponse($return);
}
return new TrustedRedirectResponse($cancel);
}