Creating the payment validation controller
The payment validation controller is set as the action target URL of our module payment option by using this code:
$cashOfflineOption->setAction($this->context->link->getModuleLink($this->name, 'validation', [], true))
We can now implement this validation controller responsible for creating a new order from the cart. As we already have seen how to create a module front controller, we can create the /modules/whcashpayment/controllers/front/validation.php
file containing the WHCashPaymentValidationModuleFrontController
class.
It can be implemented with the following code:
<?php class WHCashPaymentValidationModuleFrontController extends ModuleFrontController { public function postProcess() { if (!($this->module instanceof WHCashPayment)) { Tools::redirect('index.php?controller=order&step=1'); ...