Jump to content
Denz

DPS not redirecting to checkout_success.php

Recommended Posts

Hi,

 

I hope someone out there can help me - even if you do not know DPS you may be able to help.

 

I have downloaded and installed the DPS_PxPay_v1.1 contribution - all works fine - things go in cart, order processed, off to DPS, payment made, success BUT THEN.... when you click continue on the dps page it takes you off to login.php instead of checkout_success.php. Of course then as you know no email is generated of the order and sent to the client.

 

I rang DPS and they said it is in the dps_pxpay_result_handler.php - which says:

 

<?php

/*

 

dps_pxaccess.php, v1.00 osCommerce 07/04/2008

http://www.createhosting.co.nz

Copyright © 2008 Create Hosting Limited

 

Payment module for osCommerce Open Source E-Commerce Solution

http://www.createhosting.co.nz/

See http://www.dps.co.nz/technical_resources/e...sted/pxpay.html

 

Released under the GNU General Public License

 

Based on the zen-cart DPS PXPAY module by mixedmatter Ltd

Rewritten for osCommerce by Quentin Nel, Create Hosting Ltd

*/

 

//Check for DPS PxPay type request parameter

if (isset($_GET['result'])) {

// zen-cart dies silently without this line!

//define('GZIP_LEVEL', false);

 

require('includes/application_top.php'); // assume this is an DPS PxPay callback or redirect

 

$language_page_directory = DIR_WS_LANGUAGES . $_SESSION['language'] . '/';

require(DIR_WS_CLASSES . 'payment.php');

$payment_modules = new payment($_SESSION['payment']); // this should load everything we need...

 

$dpspxpay = new dps_pxpay(); // create own instance

$dpspxpay->log("dps_pxpay_result_handler called: " . serialize($_GET));

 

$dpspxpay->before_process(); // this will actually delegate to _processPxPayResponse()

 

// complete checkout; this will create the order, do some validation and then display the confirmation page

tep_redirect(tep_href_link(FILENAME_CHECKOUT_PROCESS, 'dps_done=true&txnId='.$dpspxpay->getTxnId(), 'SSL'));

}

?>

 

 

I have looked everywhere for where it might be getting the login.php, tried a few things but nothing works. I even tried changing the tep_redirect(tep_href_link(FILENAME_CHECKOUT_PROCESS, 'dps_done=true&txnId='.$dpspxpay->getTxnId(), 'SSL')); to tep_redirect(tep_href_link(FILENAME_CHECKOUT_SUCCESS, 'dps_done=true&txnId='.$dpspxpay->getTxnId(), 'SSL')); thinking it might bypass this and work, but still get the same result!

 

Please can someone help!!!

 

Thanks

Denz

Share this post


Link to post
Share on other sites

I would look at sessions, somewhere u are loosing the session, causing the redirect to login


Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Share this post


Link to post
Share on other sites
I would look at sessions, somewhere u are loosing the session, causing the redirect to login

 

Hi Sam,

 

Where would I look for that? I am thinking .htaccess but could be way off there!

 

Thanks

Denz

Share this post


Link to post
Share on other sites
Hi,

 

I hope someone out there can help me - even if you do not know DPS you may be able to help.

 

I have downloaded and installed the DPS_PxPay_v1.1 contribution - all works fine - things go in cart, order processed, off to DPS, payment made, success BUT THEN.... when you click continue on the dps page it takes you off to login.php instead of checkout_success.php. Of course then as you know no email is generated of the order and sent to the client.

 

I rang DPS and they said it is in the dps_pxpay_result_handler.php - which says:

 

<?php

/*

 

dps_pxaccess.php, v1.00 osCommerce 07/04/2008

http://www.createhosting.co.nz

Copyright © 2008 Create Hosting Limited

 

Payment module for osCommerce Open Source E-Commerce Solution

http://www.createhosting.co.nz/

See http://www.dps.co.nz/technical_resources/e...sted/pxpay.html

 

Released under the GNU General Public License

 

Based on the zen-cart DPS PXPAY module by mixedmatter Ltd

Rewritten for osCommerce by Quentin Nel, Create Hosting Ltd

*/

 

//Check for DPS PxPay type request parameter

if (isset($_GET['result'])) {

// zen-cart dies silently without this line!

//define('GZIP_LEVEL', false);

 

require('includes/application_top.php'); // assume this is an DPS PxPay callback or redirect

 

$language_page_directory = DIR_WS_LANGUAGES . $_SESSION['language'] . '/';

require(DIR_WS_CLASSES . 'payment.php');

$payment_modules = new payment($_SESSION['payment']); // this should load everything we need...

 

$dpspxpay = new dps_pxpay(); // create own instance

$dpspxpay->log("dps_pxpay_result_handler called: " . serialize($_GET));

 

$dpspxpay->before_process(); // this will actually delegate to _processPxPayResponse()

 

// complete checkout; this will create the order, do some validation and then display the confirmation page

tep_redirect(tep_href_link(FILENAME_CHECKOUT_PROCESS, 'dps_done=true&txnId='.$dpspxpay->getTxnId(), 'SSL'));

}

?>

 

 

I have looked everywhere for where it might be getting the login.php, tried a few things but nothing works. I even tried changing the tep_redirect(tep_href_link(FILENAME_CHECKOUT_PROCESS, 'dps_done=true&txnId='.$dpspxpay->getTxnId(), 'SSL')); to tep_redirect(tep_href_link(FILENAME_CHECKOUT_SUCCESS, 'dps_done=true&txnId='.$dpspxpay->getTxnId(), 'SSL')); thinking it might bypass this and work, but still get the same result!

 

Please can someone help!!!

 

Thanks

Denz

 

Hi Denise,

 

Did you manage to find a solution for this? I am having the same problem with my shop.

 

Brad

Share this post


Link to post
Share on other sites
Hi Denise,

 

Did you manage to find a solution for this? I am having the same problem with my shop.

 

Brad

 

 

Yes, it was a SID issue. I turned off the secure server and it all went fine!!

 

Took me hours to find this... hope it works for you!

 

Denise

Share this post


Link to post
Share on other sites
Yes, it was a SID issue. I turned off the secure server and it all went fine!!

 

Took me hours to find this... hope it works for you!

 

Denise

 

Where exactly did you do that? Was it it in the configure.php file? The SSL in my configure.php file is switched to false.

 

Brad

Share this post


Link to post
Share on other sites
Where exactly did you do that? Was it it in the configure.php file? The SSL in my configure.php file is switched to false.

 

Brad

 

 

Hi Brad,

 

Yeah that is where I did it.. worked for me! Have you done it on both admin and catalog directory config files?

 

All I know is that I searched for days and days - in the end I turned off the secure server and it went fine. I figured the secure server was scrambling the sessionID so when directed back from DPS to your shop it gave a new ID - hence your shop not knowing who left. Does this make sence?

 

Denise

Share this post


Link to post
Share on other sites

Where exactly did you do that? Was it it in the configure.php file? The SSL in my configure.php file is switched to false.

 

Brad

 

Did this work for you? I see in the log that the fail safe response is being redirected to the login page rather than order complete. Any Ideas?

Share this post


Link to post
Share on other sites

Looking at the logic flow here in the access logs...

 

xxx.xxx.169.147 - - [22/Feb/2010:22:52:54 +1300] "POST /checkout_process.php HTTP/1.1" 302 941 "http://www.mysite.com/checkout_confirmation.php" "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; InfoPath.2; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)" 
xxx.xxx.103.101 - - [22/Feb/2010:22:53:10 +1300] "GET /dps_pxpay_result_handler.php?result=v5VnhkMCFPp5IT5C9B9nE7svYV6GqLp0gQiUCNH6X8fxuAnzn2dRkaif6xmVGcAgYpB7QyJj14oCixpYbz-JRTo40RopUyM-ycHQc0hIG22vyQOdz6JALStZjL9KVoB9Rsn_ikobiY3r7kE-CyKaCAWWLgXk4h-QShzTxX1btn4eCBgZYa3ZiMXtzQLAYF6VsItqQM0p-VzqUv7veb_2AIF_XqZWCEc-Aws6esXnFwZy0Jq9rDrr82Q-b-6Q2gMioYkBRUfusAfNAx3NIDmnYQVbtPVH2JyZY7KPn5uRy6M3ybfXlaIG23xXBbSkicm8MdTxpR0B2CkZpOZ9A_4XwwW-9EwmNauRO0d5aHXIGi2UlQL2sdbFXC4aqNlQKNXqjyyNhuzKgF0w8b7GorXHBJAj-s5wGVi4oV6BxWVN0HRxu5MV-lSnjtxfJYxWYD0BTa21SO3l2lAaOZxo6NUcqZrVRk8S3c29CkxScgclhlTztdQ5p9NcXntfDqJCDSinGjb1jEtCItf-nXIFGUDTY9m3-fuxeZQYE8&userid=PxPayUserAcc_dev HTTP/1.1" 302 542 "-" "PXHOST" 
xxx.xxx.103.101 - - [22/Feb/2010:22:53:10 +1300] "GET /checkout_process.php?dps_done=true&txnId=3054b8253f6b0bd1&osCsid=efba66172f96af673934cfc5d7b35b22 HTTP/1.1" 302 440 "-" "PXHOST" 
xxx.xxx.103.101 - - [22/Feb/2010:22:53:10 +1300] "GET /login.php?osCsid=efba66172f96af673934cfc5d7b35b22 HTTP/1.1" 200 32117 "-" "PXHOST" 

 

The Site checkout_process.php sends the user to the PxPay site. Once the user gets a success box but does NOT click the next button, the PxPay site calls the dps_pxpay_result_handler.php with the success string as it should. The dps_pxpay_result_handler.php then issues a redirect back to PxPay to the checkout_process.php with the osCsid of the original customers session. Since the PxPay is not signed in to the site, to redirects to the login.php.

 

How do you configure this to accept the PxPay with other customers osCid's? This is needed as if the customer does not click the next button in the PxPay site, we will never receive the order, but we do receive the money.

 

 

Advise and help appreciated...

Share this post


Link to post
Share on other sites

Looking at the logic flow here in the access logs...

 

xxx.xxx.169.147 - - [22/Feb/2010:22:52:54 +1300] "POST /checkout_process.php HTTP/1.1" 302 941 "http://www.mysite.com/checkout_confirmation.php" "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; InfoPath.2; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)" 
xxx.xxx.103.101 - - [22/Feb/2010:22:53:10 +1300] "GET /dps_pxpay_result_handler.php?result=v5VnhkMCFPp5IT5C9B9nE7svYV6GqLp0gQiUCNH6X8fxuAnzn2dRkaif6xmVGcAgYpB7QyJj14oCixpYbz-JRTo40RopUyM-ycHQc0hIG22vyQOdz6JALStZjL9KVoB9Rsn_ikobiY3r7kE-CyKaCAWWLgXk4h-QShzTxX1btn4eCBgZYa3ZiMXtzQLAYF6VsItqQM0p-VzqUv7veb_2AIF_XqZWCEc-Aws6esXnFwZy0Jq9rDrr82Q-b-6Q2gMioYkBRUfusAfNAx3NIDmnYQVbtPVH2JyZY7KPn5uRy6M3ybfXlaIG23xXBbSkicm8MdTxpR0B2CkZpOZ9A_4XwwW-9EwmNauRO0d5aHXIGi2UlQL2sdbFXC4aqNlQKNXqjyyNhuzKgF0w8b7GorXHBJAj-s5wGVi4oV6BxWVN0HRxu5MV-lSnjtxfJYxWYD0BTa21SO3l2lAaOZxo6NUcqZrVRk8S3c29CkxScgclhlTztdQ5p9NcXntfDqJCDSinGjb1jEtCItf-nXIFGUDTY9m3-fuxeZQYE8&userid=PxPayUserAcc_dev HTTP/1.1" 302 542 "-" "PXHOST" 
xxx.xxx.103.101 - - [22/Feb/2010:22:53:10 +1300] "GET /checkout_process.php?dps_done=true&txnId=3054b8253f6b0bd1&osCsid=efba66172f96af673934cfc5d7b35b22 HTTP/1.1" 302 440 "-" "PXHOST" 
xxx.xxx.103.101 - - [22/Feb/2010:22:53:10 +1300] "GET /login.php?osCsid=efba66172f96af673934cfc5d7b35b22 HTTP/1.1" 200 32117 "-" "PXHOST" 

 

The Site checkout_process.php sends the user to the PxPay site. Once the user gets a success box but does NOT click the next button, the PxPay site calls the dps_pxpay_result_handler.php with the success string as it should. The dps_pxpay_result_handler.php then issues a redirect back to PxPay to the checkout_process.php with the osCsid of the original customers session. Since the PxPay is not signed in to the site, to redirects to the login.php.

 

How do you configure this to accept the PxPay with other customers osCid's? This is needed as if the customer does not click the next button in the PxPay site, we will never receive the order, but we do receive the money.

 

 

Advise and help appreciated...

********

Did you sort this out, I have the same problem and cannot seem to work it out.

Share this post


Link to post
Share on other sites

Yes, have an unproven fix.

 

Has taken weeks off and on part-time to locate where this issue actually lay. Worked OK on my localhost site testing (substituted some locally written code for DPS side of the house), but failed miserably on client's live site when using trying to purchase item. Customer keeps getting logged off upon a successful purchase, but client website owner has no idea about a new order till a grumpy customers rings up. Or wonders about those extra dollars in his bank account.

 

Version 1.5 of addons (at http://addons.oscommerce.com/category?search=pxpay) still exhibits same issue. Customer proceeds to checkout, eventually gets to DPS and successfully completes card transaction. Customer gets sent email and is logged off. No order is ever created in the website database and the website owner is not emailed about the new order. Why was the burning question.

 

Followed through the process ins and out of the add on code, with error logging after each line of code, from checkout_process.php, but particularly in /includes/modules/payment/dps_pxpay.php. Found that the $_SESSION['customer_id'] was non-existent after the first request for access to DPS. So when it gets to the end of transacting with DPS, it checks 'are we still logged in?' and says since $_SESSION['customer_id'] was null, log in again. At this point the customer is mostly happy, he's had a successful card transaction with DPS, has been emailed, is eagerly awaiting arrival of the product, but has been logged off. Not good marketing for your products. The next step should have been create the order in the database, email the website owner and return the customer to a success page, but unfortunately the add on logs the customer off.

 

To me, the problem was in the _processPxPayresponse() function with it's lack of Customer ID. Where to get the Customer ID after all the DPS redirects? Those sessions have long gone. I found the Merchant Reference (available near the end of this function) contains a unique string made up of the Customer ID, a hyphen and a random number. The DPS transactions have had this Merchant Reference with Customer ID available since the first request for access to DPS in the _processPxPay() function.

 

Easy fix, right after building the message for the email to the customer, grab the Merchant Reference, strip everything to the left of the hyphen to use as the Customer ID and use it to re-populate the $_SESSION['customer_id']. Seems to work OK, customer finally gets to the checkout Success page without being logged off. Also owner gets an order entry in website db and the advisory email about the new order.

 

Code I used to follow hopefully later today, ideal will be to write a version 1.6 of the add on.

 

Hope this helps.

Share this post


Link to post
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

×