Page 3 of 3 FirstFirst 123
Results 21 to 26 of 26
  1. #21
    Join Date
    Jul 2006
    Location
    Cardiff, Wales
    Posts
    305
    Plugin Contributions
    0

    Default Re: How does Zencart re-create the Session from zenid, say for a callback URL for pay

    I thought it worked, and then I had 2 orders, the first from the callback I thought, the second from when the customer returned to the site. Then it didn't work at all anymore. When I get back to the pc I think I'll post the callback file here.
    Posted via Mobile Device

  2. #22
    Join Date
    Jul 2006
    Location
    Cardiff, Wales
    Posts
    305
    Plugin Contributions
    0

    Default Re: How does Zencart re-create the Session from zenid, say for a callback URL for pay

    this is the main file without a couple of functions which work OK, like the IdentityCheck() and showError(). It passes the identity check because my writeStatus() function (also not shown) writes the value "1" to the file, used to determine the stage below. So I know it processes writeStatus($_POST, "1"); Then it does not do the CURL. I have also tried the original header Location redirect commented out instead of the CURL, which also fails. If I by pass the checks below straight to the header and go to the callback file in my browser, the header redirect does work. So this is why it seems the gateway fails at the header or CURL stage.

    As stated though... if I entered the index.php?main_page=checkout_process&zenid=xxxx on another computer, I get a "Whoops Session expired" message, but it works when entered on the computer I have logged into the store and made the order with. This is why I think maybe the header and CURL IS working, but the issue is the URL index.php?main_page=checkout_process&zenid=xxx is not working when called from another computer. Just a hunch.


    Code:
    if ($_POST['transStatus'])
    {
    	if($_POST['transStatus']=='Y')
    	{
    		$IdentityCheck = IdentityCheck();
    
    		if ( (strcmp ( $_POST ['IdentityCheck'], $IdentityCheck ) == 0))
    		{
    			writeStatus($_POST, "1");
    			//header('Location: index.php?main_page=checkout_process&zenid='.$_POST['donorref']);
    			$ch = curl_init();
    			curl_setopt($ch, CURLOPT_URL, 'http://www.mydomain.org.uk/index.php?main_page=checkout_process&zenid='.$_POST['donorref']);
    			curl_exec($ch);
    			curl_close($ch);
    		}
    		else
    		{
    			writeStatus($_POST, "2");
    			showError();
    		}
    	}
    	else
    	{
    		writeStatus($_POST, "3");
    		showError();
    	}
    }
    else
    {
    	writeStatus($_POST, "4");
    	showError();
    }

  3. #23
    Join Date
    Sep 2008
    Posts
    605
    Plugin Contributions
    6

    Default Re: How does Zencart re-create the Session from zenid, say for a callback URL for pay

    I don't think you are quite correct, I have just created the session

    http://www.kcm.org.uk/shop/index.php...d=xxxxxxxxxxxx

    ( where literally the zenid is xxxxxxxxxxxx ) in the UK and then logged onto the site as a guest from germany and the shopping cart is the same.

  4. #24
    Join Date
    Sep 2008
    Posts
    605
    Plugin Contributions
    6

    Default Re: How does Zencart re-create the Session from zenid, say for a callback URL for pay

    If you go to the above URL btw, I am refreshing the cart every so often, so you should see it pop up if you are not logged in.

    Philip.

  5. #25
    Join Date
    Jul 2006
    Location
    Cardiff, Wales
    Posts
    305
    Plugin Contributions
    0

    Default Re: How does Zencart re-create the Session from zenid, say for a callback URL for pay

    OMG I think I've done it.

    From your post of the following code I only just noticed the GET zenid will only be processed if its a SSL! I dont have a SSL so the session was not being recreated!

    Code:
    if (isset($_POST[zen_session_name()])) {
      zen_session_id($_POST[zen_session_name()]);
    } elseif ( ($request_type == 'SSL') && isset($_GET[zen_session_name()]) ) {
      zen_session_id($_GET[zen_session_name()]);
    }
    Oh such a simple thing that was overlooked!!!

    So I could not use header redirect anyway as this is GET not POST, and have now got the POST working OK via CURL.

    So the callback file will first run the checks to make sure its come back from the payment gateway, and then use CURL to post the zenid to checkout_process. There are then some variables passed to this that the before_process() uses to check that its come from the gateway so you cant use checkpout_process to override the order.

    Thanks a lot for your help. There are a couple of things I want to tidy up, but seems to work. The only thing is the $_SESSION['payment'] was not being set as the payment gateway on the Shopping Cart page, so if you went to checkout_process it would not call the before_process() as it didnt have a payment module loaded, so the order was processed anyway. I cannot see how to load the payment module in the session at the shopping cart stage (it does it as payment page) so in the meantime I have had to hard code the payment gateway to load into the session everytime. I dont suppose you know how the payment module gets loaded into the $_SESSION['payment'] on the main_page=shopping_cart do you so I dont have to hard code it? My code looks to be the same as all other gateways. V strange.

  6. #26
    Join Date
    Sep 2008
    Posts
    605
    Plugin Contributions
    6

    Default Re: How does Zencart re-create the Session from zenid, say for a callback URL for pay

    If you dump out the contents of $order and $_SESSION using print_r in the checkout_confirmation page, you'll find that there is payment_method_code or payment_module_code set when the person leaves the site, that should then recreate the module when they come back. Can't remember which at the moment, probably the order object thinking about it. Bit too early for me this morning

    Philip.

 

 
Page 3 of 3 FirstFirst 123

Similar Threads

  1. v151 Session Expires when returning from Payment Gateway for a second time
    By RickyDicky in forum Addon Payment Modules
    Replies: 9
    Last Post: 15 Nov 2014, 02:17 AM
  2. v1371 Callback URL needed for WorldPay gateway
    By Hardcase Int Ltd in forum Addon Payment Modules
    Replies: 2
    Last Post: 1 Nov 2013, 09:08 AM
  3. Replies: 3
    Last Post: 15 Jan 2012, 07:34 PM
  4. Callback Payment modules and session timeout
    By davew in forum Addon Payment Modules
    Replies: 1
    Last Post: 24 Nov 2011, 11:33 PM
  5. My final solution for removing the zenid from URL
    By whlustb in forum All Other Contributions/Addons
    Replies: 4
    Last Post: 14 Jul 2008, 06:46 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR