diff --git a/payfast/commerce_payfast.routing.yml b/payfast/commerce_payfast.routing.yml index 7f1f596..11b18b9 100644 --- a/payfast/commerce_payfast.routing.yml +++ b/payfast/commerce_payfast.routing.yml @@ -1,19 +1,3 @@ -commerce_payment_payfast.redirect_post: - path: 'https://www.payfast.co.za/eng/process' - defaults: - _controller: '\Drupal\commerce_payfast\Controller\PayfastRedirectController::post' - options: - no_cache: TRUE - requirements: - _access: 'TRUE' -commerce_payment_payfast.redirect_302: - path: 'https://www.payfast.co.za/eng/process' - defaults: - _controller: '\Drupal\commerce_payfast\Controller\PayfastRedirectController::on302' - options: - no_cache: TRUE - requirements: - _access: 'TRUE' commerce_payment_payfast.notify: path: '/payment/notify/{commerce_payment_gateway}' defaults: diff --git a/payfast/src/Controller/PayfastRedirectController.php b/payfast/src/Controller/PayfastRedirectController.php deleted file mode 100644 index b04d989..0000000 --- a/payfast/src/Controller/PayfastRedirectController.php +++ /dev/null @@ -1,79 +0,0 @@ -currentRequest = $request_stack->getCurrentRequest(); - } - - /** - * {@inheritdoc} - */ - public static function create(ContainerInterface $container) - { - return new static( - $container->get('request_stack') - ); - } - - /** - * Callback method which accepts POST. - * - */ - public function post(): TrustedRedirectResponse - { - $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); - } - - /** - * Callback method which reacts to GET from a 302 redirect. - * - */ - public function on302(): TrustedRedirectResponse - { - $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); - } - -}