Skip to content

Paypal issue with region on 2.3.4 #26698

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
kerlama opened this issue Feb 4, 2020 · 54 comments
Closed

Paypal issue with region on 2.3.4 #26698

kerlama opened this issue Feb 4, 2020 · 54 comments
Labels
Component: Paypal Fixed in 2.3.x The issue has been fixed in 2.3 release line Fixed in 2.4.x The issue has been fixed in 2.4-develop branch good first issue Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Reported on 2.3.3 Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch

Comments

@kerlama
Copy link

kerlama commented Feb 4, 2020

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
Copy link

Thanks for opening this issue!

@m2-assistant
Copy link

m2-assistant bot commented Feb 4, 2020

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

  • Summary of the issue
  • Information on your environment
  • Steps to reproduce
  • Expected and actual results

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?

  • yes
  • no

@magento-engcom-team magento-engcom-team added the Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed label Feb 4, 2020
@justStanislav
Copy link

Same problem

@medigeek
Copy link
Member

medigeek commented Feb 6, 2020

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

@kerlama
Copy link
Author

kerlama commented Feb 6, 2020

@medigeek no, I am on open source one.

@justStanislav
Copy link

@medigeek no, community.

@medigeek
Copy link
Member

medigeek commented Feb 6, 2020

@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 ( 42c2672 ) 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
Copy link
Author

kerlama commented Feb 6, 2020

@medigeek composer upgrade from 2.3.3.

@justStanislav
Copy link

@medigeek same way like @kerlama

@medigeek
Copy link
Member

medigeek commented Feb 6, 2020

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
Copy link
Author

kerlama commented Feb 6, 2020

@magento give me 2.4-develop instance

@magento-engcom-team
Copy link
Contributor

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

@noeli-eshopguru
Copy link

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
Copy link
Contributor

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
Copy link
Author

kerlama commented Feb 6, 2020

@magento give me 2.3.4 instance

@magento-engcom-team
Copy link
Contributor

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

@magento-engcom-team
Copy link
Contributor

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
Copy link

noeli-eshopguru commented Feb 6, 2020

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
Copy link
Author

kerlama commented Feb 6, 2020

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

@kerlama
Copy link
Author

kerlama commented Feb 6, 2020

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

Screenshot_15

@noeli-eshopguru
Copy link

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
Copy link
Author

kerlama commented Feb 6, 2020

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

@noeli-eshopguru
Copy link

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

@kerlama
Copy link
Author

kerlama commented Feb 6, 2020

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

@engcom-Hotel engcom-Hotel self-assigned this Feb 6, 2020
@m2-assistant
Copy link

m2-assistant bot commented Feb 6, 2020

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: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • 4. Verify that the issue is reproducible on 2.4-develop branch

    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • 5. Add label Issue: Confirmed once verification is complete.

  • 6. Make sure that automatic system confirms that report has been added to the backlog.

@magento-deployment-service
Copy link

Thanks for opening this issue!

@jackrevate
Copy link

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
Copy link
Author

kerlama commented Feb 12, 2020

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
Copy link

stu583 commented Feb 12, 2020

@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
Copy link
Member

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

@stu583
Copy link

stu583 commented Feb 12, 2020

@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
Copy link

ajwalks commented Feb 12, 2020

Yes @joridos fix works for us also. Thank you

@maxxeh1
Copy link

maxxeh1 commented Feb 13, 2020

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
Copy link
Contributor

hostep commented Feb 13, 2020

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?

@magento-engcom-team magento-engcom-team added the Fixed in 2.3.x The issue has been fixed in 2.3 release line label Feb 13, 2020
@magento magento deleted a comment from magento-engcom-team Feb 13, 2020
@Emilietrepanier
Copy link

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
Copy link

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

@Emilietrepanier
Copy link

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

@Grumag
Copy link

Grumag commented Feb 19, 2020

@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
Copy link

@Grumag For us it was Blue Jalapeno Tier Pricing

@magento-engcom-team
Copy link
Contributor

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
Copy link
Contributor

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

@achleitner
Copy link

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
Copy link
Contributor

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.

@magento-engcom-team magento-engcom-team added the Fixed in 2.4.x The issue has been fixed in 2.4-develop branch label Mar 16, 2020
@johnorourke
Copy link
Contributor

@Grumag For us it was Blue Jalapeno Tier Pricing

Did you find a fix? I use this module.

@aymansabi
Copy link

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
Copy link

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?

@Jeeva-Rathinam
Copy link

@noeli-eshopguru Are you directly update code or using any model or preference to achieve this edit?

FYI - I am using multi-website, website 1 for USA website 2 for Australia i am using Paypal for my MultiWebsite, here website 1(USA) working good, website 2(Australia) getting error.

Error: If my website 2 customer tries to pay PayPal getting the following error, but website 1 PayPal working well.

Fatal error: Uncaught Error: Call to a member function getId() on null in /var/www/html/test/app/code/Magento/Paypal/Model/Api/Nvp.php:1524

The Conclusion, shall i go with patch or edit code (What is the recommended way to edit the file)?

@Jeeva-Rathinam
Copy link

Does anyone have a solution?

@magento-engcom-team magento-engcom-team added the Reported on 2.3.3 Indicates original Magento version for the Issue report. label Nov 13, 2020
@chatlourd
Copy link

@magento-engcom-team I'm getting the same error in 2.4.1 can anyone else confirm?

I get the error below when trying to apply the patch PayPal_Express_Checkout_issue_fix_2.3.4_composer-2020-02-13-12-34-09.patch probably because it's a 2.3.4 patch and I'm on 2.4.1 - can anyone #help?

patching file vendor/magento/module-paypal/Model/Api/Nvp.php Hunk #1 FAILED at 1512. Hunk #2 FAILED at 1624. Hunk #3 FAILED at 1653. Hunk #4 FAILED at 1694. Hunk #5 FAILED at 1712. 5 out of 5 hunks FAILED -- saving rejects to file vendor/magento/module-paypal/Model/Api/Nvp.php.rej

@gianisimone
Copy link

The error is still there with Magento Community Edition 2.3.7. Unbelievable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Paypal Fixed in 2.3.x The issue has been fixed in 2.3 release line Fixed in 2.4.x The issue has been fixed in 2.4-develop branch good first issue Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Reported on 2.3.3 Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch
Projects
None yet
Development

No branches or pull requests