Jump to content

Problems With PayPal Payment After Upgrade


tdr170

Recommended Posts

I have been trying to upgrade to 1.6 from 1.4 but no matter what I do after placing test order with PayPal you are redirected back to the site and all products are still in cart as if you did not place an order.

My PayPal test account does show the order PayPal just does not seem to communicate this back to my shop.

With a clean install PayPal seems to work fine so something is happening during the upgrade.

 

So I tried to use the Upgraded sites database to load the categories and products into the clean install and the tables do load just nothing shows in the back office.

 

So after a little investigating it looks as though the Table headers are different between the two installs, in the clean install for example row 6 is `id_tax_rules_group` int(11) unsigned NOT NULL, in the upgrade this row is the last row and looks like this `id_tax_rules_group` int(10) unsigned NOT NULL,.

 

 

Now in the clean install row 6 shows the number 9 for FL tax in the upgrade there is no tax rule # at all I wonder if this and other table difs is the issue with PayPal not talking back to the shop.

 

 

Are others out there having this issue with an upgraded site.

Link to comment
Share on other sites

If an order is not being created, this likely means the PayPal IPN is not being received, or the IPN is being received but is failing to be processed.

 

Is your upgraded site accessible to Paypal?  (do you maintenance mode turned on? are you testing on a local pc using WAMP?)

Link to comment
Share on other sites

Site is live and not in maintanence mode I have it in a sub directory for testing before moving to root and removing the 1.4 site.

I have another test site also in a sub directory that is a fresh install and that one will receive orders.

I ahve tried everything I can think of done both a manual upgrade and a auto upgrade same result.

Any help you can offer is appreciated.

Link to comment
Share on other sites

You need to determine if that IPN is being received or not.  I always tell people to start by looking at the access log.  You can usually find this in your control panel (cpanel). 

 

What Paypal module (Europe or USA) and version of it are you using?  That will help determine if the IPN would be received and what you need to search for in the access log

Link to comment
Share on other sites

Currently PayPal USA & Canada 1.3.3. I have also tried 1.3.8 with same result.

I have the access log I will look through it for entries from PayPal and will post here what I find.

I looked through and found PayPal IPN from my working site so I am going do some orders and see if the IPN shows.

Thanks for the TIP.

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

These are the entries when searching the access lod that relate to the two sites that I have for testing /shop1606/ is a fresh install and works, /shop166/ is an upgrade and does not show order in BO

interesting that I do seem to be receiving the ipn from both but as you can see only the /shop166/ has the two addition entries showing where it tried order_confirmation but then went to order_history 

or at least to me that is the way it looks.

 

 

 

PayPal entries from upgrade that does not show order on BO

 

Line 606: xxx.x.xx.xxx - - [16/Feb/2015:09:54:40 -0500] "POST /shop166/module/paypalusa/validation?pps=1 HTTP/1.1" 200 87 "-" "PayPal IPN ( https://www.paypal.com/ipn )"

Line 606: xxx.x.xx.xxx - - [16/Feb/2015:09:54:40 -0500] "POST /shop166/module/paypalusa/validation?pps=1 HTTP/1.1" 200 87 "-" "PayPal IPN ( https://www.paypal.com/ipn )"

Line 606: xxx.x.xx.xxx - - [16/Feb/2015:09:54:40 -0500] "POST /shop166/module/paypalusa/validation?pps=1 HTTP/1.1" 200 87 "-" "PayPal IPN ( https://www.paypal.com/ipn )"

Line 607: xx.xxx.xx.xx - - [16/Feb/2015:09:55:11 -0500] "GET /shop166/order-confirmation?id_cart=508&id_module=149&key=137bebe4d294c1c07a7ba6884d499821 HTTP/1.1" 302 26 "https://www.sandbox.paypal.com/us/cgi-bin/webscr?cmd=_flow&SESSION=xnLl8XjJj2C3Yew3xjMP1gOWE89_2ibnEfAcE0C3m3con_utZIe_Xi3oC60&dispatch=50a222a57771920b6a3d7b606239e4d529b525e0b7e69bf0224adecfb0124e9b61f737ba21b081987669d951670e57a34adba9dd19029ce5" "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.111 Safari/537.36"

Line 608: xx.xxx.xx.xx - - [16/Feb/2015:09:55:11 -0500] "GET /shop166/order-history HTTP/1.1" 200 6670 "https://www.sandbox.paypal.com/us/cgi-bin/webscr?cmd=_flow&SESSION=xnLl8XjJj2C3Yew3xjMP1gOWE89_2ibnEfAcE0C3m3con_utZIe_Xi3oC60&dispatch=50a222a57771920b6a3d7b606239e4d529b525e0b7e69bf0224adecfb0124e9b61f737ba21b081987669d951670e57a34adba9dd19029ce5" "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.111 Safari/537.36"

 

 

 

 

PayPal entries from fresh install that does show order in BO

 

Line 532: xxx.x.xx.xxx - - [16/Feb/2015:09:50:33 -0500] "POST /shop1606/module/paypalusa/validation?pps=1 HTTP/1.1" 200 2 "-" "PayPal IPN ( https://www.paypal.com/ipn )"

Line 532: xxx.x.xx.xxx - - [16/Feb/2015:09:50:33 -0500] "POST /shop1606/module/paypalusa/validation?pps=1 HTTP/1.1" 200 2 "-" "PayPal IPN ( https://www.paypal.com/ipn )"

Line 532: xxx.x.xx.xxx - - [16/Feb/2015:09:50:33 -0500] "POST /shop1606/module/paypalusa/validation?pps=1 HTTP/1.1" 200 2 "-" "PayPal IPN ( https://www.paypal.com/ipn )"

Link to comment
Share on other sites

ok, so that is good.  you know you are receiving the IPN.  now the hard part.  you have to add tracing logic to the validation.php file and see where in the process it fails.

 

Any particular reason you are using v1.3.3 and not the latest v1.3.8?

 

on the upgraded site, have you tried to completely uninstall the module and re-install it?

 

lastly for now, is this standard checkout or advanced/payflow?

Link to comment
Share on other sites

While I am not bad at this Tracing Logic???

 

I was trying different modules to see if I could get it to work back when I had edited this module removing the .php from the order_confirmation to stop the 404 upon returning to the site. I had then found if I added a order_confirmation to the SEO & URL section that the module worked correctly, I actually posted the fix here for others.

 

I removed the added order_confirmation from SEO same result.

 

I have now gone back to 1.3.8 with the same result, yes I have tried uninstall and re-install but same result.

 

I am using PayPal Standard.

Link to comment
Share on other sites

Update:

 

I decided to give something else a try so I imported the database from the fresh install into the upgrade then pasted the employees, addresses & customer tables from the upgrade back into the database and tried an order as I had already enteredwith one product into the fresh install and the order went through and shows in the back office.

 

I did this because it was odd to me that the fresh install worked and the upgrade did not since the only real difference is the database.

 

Would this lead you to believe that the database is not being correctly formated in the upgrade.

 

Next I will try the categories and products and see what happens.

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

You are over thinking it.  Tracing through the code means adding debug statements at various points in the code and determining what is going on by looking at the debug statements.

 

This is normally easy because you can add echo statements and then just look at the output in the browser.  However the IPN from Paypal is not something you can see in the browser, so what I typically do is use the php error_log function to write the debug statements to a file.  it would look something like this

error_log('the message to write'.PHP_EOL, 3, 'ipn_debug.log');

This would create a file named ipn_debug.log with the contents 'the message to write'

 

Now a real example using v1.3.8.  Edit /modules/paypalusa/controllers/front/validation.php and locate line 59 which should have the start of the _paymentStandard function

 

You are going to add these 2 lines of code

$time = time();
error_log($time.': _paymentStandard called'.PHP_EOL, 3, dirname(__FILE__).'ipn_debug.log');

So it should look like this.

private function _paymentStandard()
{
    $time = time();
    error_log($time.': _paymentStandard called'.PHP_EOL, 3, dirname(__FILE__).'ipn_debug.log');

    /* Step 1 - Double-check that the order sent by PayPal is valid one */
    $ch = curl_init();

Now create a new order, wait for the IPN to be received, and once it is received you will find the ipn_debug.log in the '/modules/paypalusa/controllers/front' folder.  Now you just need to continue to add those error_log statements and determine where in the script it stops.

 

If this is going over your head, then its time to hire a developer.

Link to comment
Share on other sites

This is not above my ability to add code but knowing the code to add certainly was so I appreciate your help more then words can say.

 

I put the database back using a backup so back to normal.

 

Now I have added the code and the results are   1424180813: _paymentStandard called      and that all it says.

 

 

 

Link to comment
Share on other sites

Well while I can copy your code and apply to other public functions within PHP files I do not see any other functions within the validation.php that would apply to the issue.

 

So I do guess this type of debugging is beyond my ability and the cost for a developer is more then I think I would spend considering that we don't make that much from the site to begin with.

 

We have a working 1.4 site and want to upgrade but spending money for something that should work seems futile.

 

I do thank you for the help.

Link to comment
Share on other sites

Update:

 

So once again I tried something else, this time I installed a 1.4.0.11 version with no data (no demo products or installed modules).

Ithen installed only the shipping and PayPay 1.3.8 modules nothing else.

I then imported all the customers, addresses, products and image tables To populate the 1.4.0.11 version.

Now I upgraded the site to 1.6 and installed all the modules I use, went to front office added product to cart went through the check out logged in to my account placed the order and believe it or not it worked you are taken to the order confirmation page and the order shows in BO.

So far I ahve done 2 orders both worked fine, I will now export the modified theme from the other site and import into this one and make sure everything is working.

 

Ps: yes I did load the stock bootstrap theme to other site to make sure it was not something in the mods.

Link to comment
Share on other sites

So found the issue it is the specific price and group issue, If the product has a specific price applied to all groups all is ok but I have an added group called team for our team members.

If the product has a specific price applied to team then the payment will fail to confirm and you get the order history page.

 

So basically you can not add an addition group and apply customers to it if it has a specific price.

 

What the heck ???

Link to comment
Share on other sites

I don't see anything in validation.php of v1.3.8 dealing with customer groups or specific pricing.  Have you tried using a different module (like bankwire) and see if this is just a problem in general with Prestashop?  Or have you proven it is specifically related to the Paypal USA module?

Link to comment
Share on other sites

Well after some more testing I found that if the product only has 1 specific price applied order confirms regardless of the group your in.

If the product has a second specific price applied to team and you are in the team group the order will fail to confirm.

 

So now I took the old PayPal module 3.5.4 from 1.4.0.11 and edited the paypalconnect.php file changing the sslv3 to tls and installed that and the order confirms regardless of specific price or group.

 

3.5.4 is a little odd does not display configuration properly in BO and at the PayPal page instead of Pay Now It says Continue and after you click that you are automatically redirected back to the confirmation page which is different then that of 1.3.8.

 

( I also had to do the edit of PayPal 2.8.7 for 1.4 as I had the same issues with 1.3.8 in that install. )

 

So it would seem that the issue is with the module, I also believe that in the module it is considered discount not specific, here are the lines I found with discount.

 

I added all but I am using standard.

 

\PayPal 1.3.8\controllers\front\expresscheckout.php (1 hits)
Line 104: if ($cart_discount = $this->context->cart->getOrderTotal(false, Cart::ONLY_DISCOUNTS))
 
\PayPal 1.3.8\paypalusa.php (1 hits)
Line 400: if ($this->context->cart->getOrderTotal(true, Cart::ONLY_DISCOUNTS) == 0)
 
\PayPal 1.3.8\views\templates\hook\standard.tpl (3 hits)
Line 41: {assign var="paypal_usa_total_discounts" value=$cart->getOrderTotal(true, Cart::ONLY_DISCOUNTS)}
Line 41: {assign var="paypal_usa_total_discounts" value=$cart->getOrderTotal(true, Cart::ONLY_DISCOUNTS)}
Line 42: {if $paypal_usa_total_discounts == 0}
 
 
What do ya think.
Edited by tdr170 (see edit history)
Link to comment
Share on other sites

Payments have stopped working on my shop using the upgraded paypal module.  I have uninstalled it and set it up again and there is no difference.  What can I try now Please?  There is no error message at all, only that the payment was not processed.  I should say that I did get a message from Prestashop that the payment failed, but the reason from Paypal was not showing.

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

This is a little different then the issue I was Having as the payment went to paypal but was not showing in BO so if it were not for the email from PayPal I would not have known there was an order.

I have an older version that I have modified to work with the new TTL security and I could post it if you wanted to give it a try.

It is a little quirky in the BO as the configuration page does not properly display the layout, after setup if you close the configuration and reopen it displays fine.

Does work 100% all orders go through and display in BO.

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