Jump to content

Prestashop Payment module redirecting unconditionally to Payment failed page


utmishra

Recommended Posts

I'll try to be as specific as possible. I have been making a Payment Module, which is almost complete, leaving one critical issue. I had already asked on a related issue, which was solved thankfully.


My payment module receives response from the bank along with POST fields containing mandatory data related to the transaction (Transaction ID, Merchant Track ID, amount, etc.) On the page receiving response (response.php), under the module directory, I perform certain security measures like validating source IP address, validating received fields etc.


But, I have no idea how, whatever be the result of transaction (CAPTURED/SUCCESS/FAILED), mymodule always redirects the control to payment failed page (failed.php). A possible case would be an event/condition which I haven't thought of, during which control goes to failed page. But I have commented all the redirection to failed page in response file.


Is there any other way the redirection could occur ? Am I missing any Prestashop's module's or Order process step which would result the following.


I have also checked the access-log, the page flow goes directly from response.php to failed.php using GET method.


My response.php page starts like this-



include(dirname(__FILE__).'/../../config/config.inc.php');
include(dirname(__FILE__).'/hdfcpaymentgateway.php'); including the default module file

$obj=new HDFCPaymentGateway(); //Creating an Object of Payment module class.

After successful validations, I perform order confirmation/validation process:



$obj->confirmOrder($ResResult, $ResAuth, $ResRef, $ResTrackID, $ResTranID, $ResPostdate);

The confirmOrder function, present in the default module php file contains following code:



if($this->validateOrder((int)$this->context->cart->id, Configuration::get('PS_OS_PREPARATION'), $total, $this->displayName, null, array(), null, false, $customer->secure_key)==true)
//Rest of the code contains updates in database according to the return value

My plan was to redirect to Order confirmation page on successful validation, although I have commented the same to debug the issue. Redirect code would be:



Tools::redirectLink('http://'.htmlspecialchars($_SERVER['HTTP_HOST'], ENT_COMPAT, 'UTF-8').__PS_BASE_URI__.'order-confirmation.php?key='.$customer->secure_key.'&id_cart='.(int)$obj->context->cart->id.'&id_module='.(int)$obj->module->id.'&id_order='.(int)$obj->module->currentOrder);

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...