Jump to content

Front controller doesn't redirect to api url.


Recommended Posts

Hi all, I'm working on a external type payment module in prestashop 1.7. I followed prestashop payment example module in github and replicated same for external payment type. But after clicking submit button on checkout, the front tpl shows all the params set in tpl file. I need it to redirect to the API url / payment page. What should I do further to  achieve this ? I tried going through paypal module code. I'm getting more confused as there are several controller overriding files & tpl files and also I'm new to this platform. 

some more doubts: 
->Where should i write request params? will it be in front controller or front tpl file?
->Where should I write response received from payment gateway?
->Do I have to make separate controller file overriding front controller or no need for that?

Below are some code img for reference. Please Help!! 


Thanks

payment_return.tpl.png

validation.tpl.png

 

 

Edited by pg_dev (see edit history)
Link to comment
Share on other sites

  • 2 weeks later...

Hi, thanks for the response. Yes, I have already gone through the link which you provided. Fortunately I have moved ahead and lot of doubts got clarified. Now the redirection works fine. Ongoing issue is -  even if the payment gets successful, the notifyurl is not working as expected and the response status code from gateway is not captured correctly which then doesn't takes the user to order confirmation page and order does not get placed. Can you help me with that? 

Link to comment
Share on other sites

notify url does not seem to work even if the payment status is success, orders are not creating in the back office. I'll share snippet from validationcontroller,payment-return.tpl. Pls help!

I've defined notifyurl like this:
 $notifyurl = $this->context->link->getModuleLink($this->name,'validation', array(),  true);

$this->context->smarty->assign([

      'Merchant_User_Id' => $Merchant_User_Id,

      'merchantpwd' => $merchantpwd,

      'Purchase_summary' => $Purchase_summary,

      'currencydesc' => $currencydesc,

      'merchant_ref_number' => $merchant_ref_number,

      'customer_ipaddress' => $customer_ipaddress,

      'amount' => $amount,
etc etc.........
]);
return $this->context->smarty->fetch('module:latpayredirect/views/templates/front/payment_options.tpl'); }

then hookPaymentReturn function continues....  (check image for code)
snippet2.png.94cd333cd9b9da24793256233aab0104.png

snippet3.png

snippet4.png

Edited by pg_dev (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...