You are here

public function DummyRedirectController::post in Commerce Core 8.2

Callback method which accepts POST.

Throws

\Drupal\commerce\Response\NeedsRedirectException

1 string reference to 'DummyRedirectController::post'
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 46

Class

DummyRedirectController
This is a dummy controller for mocking an off-site gateway.

Namespace

Drupal\commerce_payment_example\Controller

Code

public function post() {
  $cancel = $this->currentRequest->request
    ->get('cancel');
  $return = $this->currentRequest->request
    ->get('return');
  $total = $this->currentRequest->request
    ->get('total');
  if ($total > 20) {
    return new TrustedRedirectResponse($return);
  }
  return new TrustedRedirectResponse($cancel);
}