magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.54k stars 9.31k forks source link

Paypal issue with region on 2.3.4 #26698

Closed kerlama closed 4 years ago

kerlama commented 4 years ago

Preconditions (*)

  1. Magento 2.3.4 & 2.4-develop
  2. Clean version, vanilla, with sample data only
  3. PHP 7.2.26
  4. Paypal Express Checkout

Steps to reproduce (*)

  1. Enable paypal w/o review (haven't tried with review)
  2. Add product to cart as guest or logged in (doesn't matter)
  3. Go to checkout
  4. Enter your shipping address to be in UK for example and enter some state, I used Nottinghamshire
  5. Place order, confirm from paypal side
  6. You will get error 500

Expected result (*)

  1. Successfully placed order

Actual result (*)

  1. Error 500: NOTICE: PHP message: PHP Fatal error: Uncaught Error: Call to a member function getId() on null in httpdocs/vendor/magento/module-paypal/Model/Api/Nvp.php:1527

When I ported back code from 2.3.3 for _applyStreetAndRegionWorkarounds function, it worked.

$regions->getItems() in _applyStreetAndRegionWorkarounds is empty.

magento-deployment-service[bot] commented 4 years ago

Thanks for opening this issue!

m2-assistant[bot] commented 4 years ago

Hi @kerlama. Thank you for your report. To help us process this issue please make sure that you provided the following information:

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento give me 2.4-develop instance - upcoming 2.4.x release

For more details, please, review the Magento Contributor Assistant documentation.

@kerlama do you confirm that you were able to reproduce the issue on vanilla Magento instance following steps to reproduce?


justStanislav commented 4 years ago

Same problem

medigeek commented 4 years ago

happens to us too after a manual upgrade of enterprise edition. @kerlama @justStanislav are you using enterprise edition of magento2?

kerlama commented 4 years ago

@medigeek no, I am on open source one.

justStanislav commented 4 years ago

@medigeek no, community.

medigeek commented 4 years ago

@kerlama @justStanislav did you use manual upgrade or composer upgrade? @fascinosum could you have a look at this please? some changes were introduced in Nvp.php ( https://github.com/magento/magento2/commit/42c26724382bcafe0ccdc84cc9fe53427891aadd ) that affect the paypal module, instead of a success page we end up with http error 500 and the error kerlama mentioned in the logs.

kerlama commented 4 years ago

@medigeek composer upgrade from 2.3.3.

justStanislav commented 4 years ago

@medigeek same way like @kerlama

medigeek commented 4 years ago

Thank you both. :) @kerlama I see you have already tested this on a vanilla installation as you have originally posted. I'm not sure if you can reply to the @magento bot "yes" or tick it, don't know how this github bots work heh. Let's wait on @fascinosum or someone else to check this out.

kerlama commented 4 years ago

@magento give me 2.4-develop instance

magento-engcom-team commented 4 years ago

Hi @kerlama. Thank you for your request. I'm working on Magento 2.4-develop instance for you

noeli-eshopguru commented 4 years ago

Hello I upgraded Enterprise Edition 2.3.3 to 2.3.4 manually. Then I got the same error. HTTP Error 500 Also I can see an error in Nvp.php:1524.

magento-engcom-team commented 4 years ago

Hi @kerlama, here is your Magento instance. Admin access: https://i-26698-2-4-develop.instances.magento-community.engineering/admin_8452 Login: 5d6faf61 Password: c38757c25a07 Instance will be terminated in up to 3 hours.

kerlama commented 4 years ago

@magento give me 2.3.4 instance

magento-engcom-team commented 4 years ago

Hi @kerlama. Thank you for your request. I'm working on Magento 2.3.4 instance for you

magento-engcom-team commented 4 years ago

Hi @kerlama, here is your Magento instance. Admin access: https://i-26698-2-3-4.instances.magento-community.engineering/admin_352b Login: 45be4a03 Password: 9a705053948c Instance will be terminated in up to 3 hours.

noeli-eshopguru commented 4 years ago

Hi, I replaced some codes in function _applyStreetAndRegionWorkarounds(DataObject $address) to ones of 2.3.3.

        - $regionItems = $regions->getItems();
        - $region = array_shift($regionItems);
        - $address->setRegionId($region->getId());
        - $address->setExportedKeys(array_merge($address->getExportedKeys(), ['region_id']));

        + foreach ($regions as $region) {
           + $address->setRegionId($region->getId());
           + $address->setExportedKeys(array_merge($address->getExportedKeys(), ['region_id']));
           + break;
       + }

Then tested again. So it worked, but it was redirected to the order review page. I can see the error message on the page and can't place the order. image

Any idea?

kerlama commented 4 years ago

@noeli-eshopguru code from 2.3.3 works fine for me (_applyStreetAndRegionWorkarounds).

kerlama commented 4 years ago

@magento-engcom-team I was able to reproduce the issue on clean instance you gave me.

Screenshot_15

noeli-eshopguru commented 4 years ago

Hi @kerlama but why am I getting the error on the order review page? And I have already enabled the review page skip option on the paypal settings. Are you moving to the order success page correctly?

kerlama commented 4 years ago

@noeli-eshopguru yes, for me its working fine, payment is charged and I am redirected to success page.

noeli-eshopguru commented 4 years ago

Hi @kerlama, do you have any idea with my error?

kerlama commented 4 years ago

@noeli-eshopguru not sure, there are few places where this exception is thrown, see at which one it fails and then check if you have any custom observer which might affect on it.

m2-assistant[bot] commented 4 years ago

Hi @engcom-Hotel. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

magento-deployment-service[bot] commented 4 years ago

Thanks for opening this issue!

magento-engcom-team commented 4 years ago

:white_check_mark: Confirmed by @engcom-Hotel Thank you for verifying the issue. Based on the provided information internal tickets MC-31196 were created

Issue Available: @engcom-Hotel, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

fascinosum commented 4 years ago

@kerlama, @medigeek, thank you @odubovyk, you may have more information as the author of these changes. Could you have a look at this issue?

stu583 commented 4 years ago

Also experiencing on 2.3.4 CE. Composer upgrade from 2.3.3 on 10 Feb.

Order success as expected when using Safari, IE, Edge. However we are receiving a 500 Error when using the chrome browser across Windows/OSX/IOS platforms. Browser history’s/cookies cleared, Magento cache cleared/flushed but bug persists.

Debug currently switched on and will continue looking tomorrow and will update if I find anything.

ajwalks commented 4 years ago

Upgraded from CE 2.3.3 > 2.3.4 via composer and similar issue. At first I thought it was JS Bundling that I had enabled. Im using Paypal Standard. When returning from Paypal to site get blank page with url of /paypal/express/return/?token=XXXXXXXXXX&PayerID=XXXXXXXXXX

Error log shows: `[11-Feb-2020 16:36:10 UTC] PHP Fatal error: Uncaught Error: Call to a member function getId() on null in /home/public_html/vendor/magento/module-paypal/Model/Api/Nvp.php:1524 Stack trace:

0 /home/public_html/vendor/magento/module-paypal/Model/Api/Nvp.php(1493): Magento\Paypal\Model\Api\Nvp->_applyStreetAndRegionWorkarounds(Object(Magento\Framework\DataObject))

1 /home/public_html/vendor/magento/module-paypal/Model/Api/Nvp.php(849): Magento\Paypal\Model\Api\Nvp->_exportAddresses(Array)

2 /home/public_html/vendor/magento/module-paypal/Model/Express/Checkout.php(621): Magento\Paypal\Model\Api\Nvp->callGetExpressCheckoutDetails()

3 /home/public_html/vendor/magento/module-paypal/Controller/Express/AbstractExpress/ReturnAction.php(32): Magento\Paypal\Model\Express\Checkout->returnFromPaypal('EC-9JN953126P91...')

4 /home/public_html/vendor/magento/framework/App/Action/Action.php(108): Magento\Paypal\Controller\Express\AbstractExpress\ReturnAction->execute()

5 /home/ in /home/public_html/vendor/magento/module-paypal/Model/Api/Nvp.php on line 1524`

Order does not get logged in admin.

jackrevate commented 4 years ago

Having the same issue, causing a lot of website sales to go!

Anyone found a fix? need it asap!

I don't get how Magento release something that's so dam buggy!

kerlama commented 4 years ago

Having the same issue, causing a lot of website sales to go!

Anyone found a fix? need it asap!

I don't get how Magento release something that's so dam buggy!

Revert back the function _applyStreetAndRegionWorkarounds from 2.3.3 in vendor/magento/module-paypal/Model/Api/Nvp.php

stu583 commented 4 years ago

@jackrevate

I can confirm that @joridos fix is working for us.

He has been unable to merge due to an error but it appears the error is at line 1618 which was already part of 3.2.4 core and he hasn't even touched! All checks for CE and EE passed.

jonatanrdsantos commented 4 years ago

@stu583 yes, the only one error is on a method that I haven't changed

stu583 commented 4 years ago

@joridos

Yes I had a look and its very odd. I agree that it's not anywhere near the the method you edited. Maybe already buggy, shouldn't have passed previously and never have made the 2.3.4? I don't know.

Like I said its working perfectly for us. We are taking PayPal payments, in production, with no problems since applying your fix. Thanks for the contribution. 🙂

ajwalks commented 4 years ago

Yes @joridos fix works for us also. Thank you

maxxeh1 commented 4 years ago

Personally I am getting very tired of issues arising in patch versions of Magento. 2.3.4 has introduced two major payment bugs - one for Paypal which should NOT have happened and one for certain third party vendor payment methods, such as Magenticity SagePay, see here: 2.3.4 Checkout Infinite Loop. How does this happen?!

hostep commented 4 years ago

It looks like Magento has released a hotfix for this problem on: https://magento.com/tech-resources/download#download2353

Maybe somebody running into this issue can test and report back if this fixes it for them?

Emilietrepanier commented 4 years ago

The patch did not fix it for me. before I had an: internal Error..... Report ID: webapi and now the an: Infiniteloo detected, review the trace for the looping path

jackrevate commented 4 years ago

Infinite loop detected appeared due to a third party extension 'Stripe' - they have released a newer version.

Emilietrepanier commented 4 years ago

We do not have stripe either and found that 1 third party tier pricing module was responsible.

Grumag commented 4 years ago

@Emilietrepanier Is it maybe from MageWorx, as we do have their extension installed, to add fees.

Yes it was MageWorx extension. We updated it and it's all good now.

Emilietrepanier commented 4 years ago

@Grumag For us it was Blue Jalapeno Tier Pricing

magento-engcom-team commented 4 years ago

Hi @kerlama.

Thank you for your report and collaboration!

The issue was fixed by Magento team. The fix was delivered into magento/magento2:2.3-develop branch(es). Related commit(s):

The fix will be available with the upcoming 2.3.5 release.

diazwatson commented 4 years ago

I have tested applying the patch @hostep mentioned in 2.3.4 Cloud instance and it works

achleitner commented 4 years ago

Anyone has a fix for this that actually works. Getting a http error instead of the magento success page with paypal express and braintree/paypal module. Nothing in this thread actually works. Thanks

magento-engcom-team commented 4 years ago

Hi @kerlama.

Thank you for your report and collaboration!

The issue was fixed by Magento team. The fix was delivered into magento/magento2:2.4-develop branch(es). Related commit(s):

The fix will be available with the upcoming 2.4.0 release.

johnorourke commented 4 years ago

@Grumag For us it was Blue Jalapeno Tier Pricing

Did you find a fix? I use this module.

aymansabi commented 4 years ago

Any solution>?

Failed to connect to 127.0.0.1 port 808: Connection refused at /home/luckyeyesinc/public_html/vendor/magento/module-paypal/Model/Api/Nvp.php:1215)"} []

Jeeva-Rathinam commented 3 years ago

Hello I upgraded Enterprise Edition 2.3.3 to 2.3.4 manually. Then I got the same error. HTTP Error 500 Also I can see an error in Nvp.php:1524.

Did you find any solution?