Forums / Bug Reports / [Done v1.3.9] Paypal / Gift Certificates and the eternal checkout loop

[Done v1.3.9] Paypal / Gift Certificates and the eternal checkout loop

Locked

Started by jimjim on 26 Oct 2008, 4:57 AM · Views: 3,324

Results 1 to 8 of 8
This thread is locked. New replies are disabled.
26 Oct 2008, 4:57 AM
#1
jimjim avatar

jimjim

New Zenner

Join Date:
Oct 2008
Posts:
1
Plugin Contributions:
0

[Done v1.3.9] Paypal / Gift Certificates and the eternal checkout loop

I have a customer who recently decided to sell gift certificates. I followed the instructions for setting up a gift certificate, and the tested a purchase. Everything tested fine until I confirmed the order in paypal. After confirming in paypal I get redirected back to step 2 of the checkout process on my clients website. After checking my bank, paypal has submitted a pre-authorization, but no emails were sent to the store manager email or the test customer email, and no new order shows up in the admin.

This only happens when I set the model number on the certificate to GIFT-XXX. All other products test out fine.

I am running version 1.3.8a on php 4.3.11. Paypal Website Payments Pro and Paypal Express Checkout are the only payment gateways that are enabled. The site is set up on a GoDaddy server, but I was told the problem occurred on another hosting server before I picked up the client and moved them to GoDaddy.

Thanks

10 Nov 2008, 9:37 PM
#2
tick avatar

tick

New Zenner

Join Date:
Jun 2007
Location:
Phoenix, AZ
Posts:
66
Plugin Contributions:
0

Re: [Done v1.3.9] Paypal / Gift Certificates and the eternal checkout loop

Hello all,

While enabling gift certificates today I ran into a strange issue while trying to pay for them with PayPal Website Payments Pro. For orders with a pure virtual cart (only gift certificates in my case -- we sell physical products) I was redirected back to checkout_payment after clicking "confirm order" on step 3.

Steps to reproduce:

  1. Start with a fresh session. Add a gift certificate (any amount) to your order.
  2. Proceed to checkout (log in, etc). checkout_shipping should be skipped for this cart as it contains no physical products.
  3. Select PayPal on checkout_payment.
  4. Click "confirm order" on checkout_confirmation.
  5. Log into PayPal. Verify the amount and click "continue."
    At this point you will be redirected to checkout_shipping. Zen Cart will then realize you have a virtual cart and redirect you to checkout_payment.
  6. At this point you are in a "special payment" so you can only enter comments, etc., not re-select your payment type. Proceed to checkout_confirmation.
  7. Click "confirm order."
  8. Run through the PayPal screens and your transaction will be successful.
    This looks to be an issue with Zen's handling of virtual carts. In paypalwpp.php line 1660 Zen checks for a virtual cart skips calling the paypalwpp->getOverrideAddress() function. Unfortunately, getOverrideAddress() is where the "markflow" GET variable is committed to a session variable. So, when we get to line 1732, $reviewOrder is left true and PayPal is told to display a "continue" button, rather than "confirm."

I added the following fix to my paypalwpp.php file starting at line 1659. I added the one line above "} else {":

    if ($_SESSION['cart']->get_content_type() == 'virtual' && isset($_SESSION['customer_id']) && $_SESSION['customer_id'] > 0) {
      $this->zcLog('ec-step1-addr_check', "cart contents is virtual and customer is logged in ... therefore options['NOSHIPPING']=1");
      $options['NOSHIPPING'] = 1;
      $_SESSION['paypal_ec_markflow']=(int)$_GET['markflow'];
    } else {
```For obvious reasons, I'm hesitant to tinker with the PayPal files. Can someone knowledgeable about Zen's PayPal system please take a look at this and verify that it's a valid fix?

Thanks!

Generations Crafting (Our Zen-Cart storefront)
"
And that's just it, Doc - my mind has always been my Achilles' heel!" -- The Tick

10 Nov 2008, 10:32 PM
#3
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,511
Plugin Contributions:
176

Re: [Done v1.3.9] Paypal / Gift Certificates and the eternal checkout loop

The system intentionally goes to the checkout_payment page if you have coupon or gift certificate support enabled on your site, so that the customer can enter a coupon or gift cert redemption code before confirming final payment amount.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

10 Nov 2008, 11:56 PM
#4
tick avatar

tick

New Zenner

Join Date:
Jun 2007
Location:
Phoenix, AZ
Posts:
66
Plugin Contributions:
0

Re: [Done v1.3.9] Paypal / Gift Certificates and the eternal checkout loop

DrByte:

The system intentionally goes to the checkout_payment page if you have coupon or gift certificate support enabled on your site, so that the customer can enter a coupon or gift cert redemption code before confirming final payment amount.
Hi Dr. Byte,

Yes, for an Express Checkout that is true. However, this isn't an express checkout, just a normal PayPal transaction. (I logged in using an existing account.) For virtual carts, the bug is displaying the checkout_payment page twice.

The behavior is also not duplicated for physical carts.

Also, it just occurred to me that I didn't post my version of Zen: 1.3.8a.

Generations Crafting (Our Zen-Cart storefront)
"
And that's just it, Doc - my mind has always been my Achilles' heel!" -- The Tick

11 Nov 2008, 7:48 AM
#5
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,511
Plugin Contributions:
176

Re: [Done v1.3.9] Paypal / Gift Certificates and the eternal checkout loop

Well, if you're editing the paypalwpp.php file, you're dealing with Express Checkout ... so, I'm uncertain whether there's really a problem here.
Website Payments Pro uses paypaldp.php.

And, no, don't complain about the nomenclature of the filenames ... we've heard it lots.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

11 Nov 2008, 2:26 PM
#6
tick avatar

tick

New Zenner

Join Date:
Jun 2007
Location:
Phoenix, AZ
Posts:
66
Plugin Contributions:
0

Re: [Done v1.3.9] Paypal / Gift Certificates and the eternal checkout loop

Ok, I just checked my Zen config and you are correct. The payment module is "PayPal Express Checkout." The file being called is paypalwpp.php. My apologies, I made an assumption based on the filename.

Now, to confuse the matter further... :smile:

This is not an express checkout per se. I'm logging into Zen with a pre-existing account. I am not redirected to PayPal until after (the first) checkout_confirmation.

Thanks for your help!

Generations Crafting (Our Zen-Cart storefront)
"
And that's just it, Doc - my mind has always been my Achilles' heel!" -- The Tick

12 Nov 2008, 7:38 AM
#7
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,511
Plugin Contributions:
176

Re: [Done v1.3.9] Paypal / Gift Certificates and the eternal checkout loop

So, you're just saying that it's looping through the checkout pages one extra time?

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

12 Nov 2008, 12:46 PM
#8
tick avatar

tick

New Zenner

Join Date:
Jun 2007
Location:
Phoenix, AZ
Posts:
66
Plugin Contributions:
0

Re: [Done v1.3.9] Paypal / Gift Certificates and the eternal checkout loop

DrByte:

So, you're just saying that it's looping through the checkout pages one extra time?
Yes, sir.

Generations Crafting (Our Zen-Cart storefront)
"
And that's just it, Doc - my mind has always been my Achilles' heel!" -- The Tick