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.

Jeeva-Rathinam commented 3 years ago

@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 commented 3 years ago

Does anyone have a solution?

chatlourd commented 3 years ago

@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 commented 3 years ago

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