Skip to content

#26698 Fix Fatal error region getId() on NULL collection in Paypal Nvp API #26744

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
wants to merge 2 commits into from
Closed

#26698 Fix Fatal error region getId() on NULL collection in Paypal Nvp API #26744

wants to merge 2 commits into from

Conversation

jonatanrdsantos
Copy link
Member

@jonatanrdsantos jonatanrdsantos commented Feb 7, 2020

Description (*)

To fix the problem PHP Fatal error: Uncaught Error: Call to a member function getId() I add a validation on region collection before using $region->getId()

Fixed Issues (if relevant)

  1. Paypal issue with region on 2.3.4 #26698: Paypal issue with region on 2.3.4

Manual testing scenarios (*)

  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 a success page

Questions or comments

N/A

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds are green)

@m2-assistant
Copy link

m2-assistant bot commented Feb 7, 2020

Hi @joridos. Thank you for your contribution
Here is some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento give me test instance - deploy test instance based on PR changes
  • @magento give me 2.4-develop instance - deploy vanilla Magento instance

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

@jonatanrdsantos
Copy link
Member Author

@magento give me test instance

@magento-engcom-team
Copy link
Contributor

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

@magento-engcom-team
Copy link
Contributor

Hi @joridos, here is your new Magento instance.
Admin access: https://pr-26744.instances.magento-community.engineering/admin_cd85
Login: 0fa0000a Password: dd5d9ccc38a2
Instance will be terminated in up to 3 hours.

@jonatanrdsantos
Copy link
Member Author

Tested on vanilla magento instance from this PR:

@jonatanrdsantos
Copy link
Member Author

Anyone can help me why the Static Tests is failing? I looked on the error but is on a method that I haven't changed.

@lenaorobei
Copy link
Contributor

@joridos here are test results https://public-results-storage-prod.magento-testing-service.engineering/reports/magento/magento2/pull/26744/8a94bd64877a19a1f398312d3e4f3fcc/Statics/allure-report-b2b/index.html#suites/51d3ab4d5d77a0bc6a7ea344e9e7e6be/180b0c904c912a21/

PHPStan detected violation(s):
 ------ ---------------------------------------------------------------------- 
  Line   app/code/Magento/Paypal/Model/Api/Nvp.php                             
 ------ ---------------------------------------------------------------------- 
  1618   Method Magento\Paypal\Model\Api\Nvp::_filterPeriodUnit() should       
         return string but return statement is missing.                        
  1653   Method Magento\Paypal\Model\Api\Nvp::_filterBillingAgreementStatus()  
         should return string but return statement is missing.                 
  1672   Method                                                                
         Magento\Paypal\Model\Api\Nvp::_filterPaymentStatusFromNvpToInfo()     
         should return string|null but return statement is missing.            
  1712   Method Magento\Paypal\Model\Api\Nvp::_filterPaymentReviewAction()     
         should return string|null but return statement is missing.            
 ------ ---------------------------------------------------------------------- 

 [ERROR] Found 4 errors                                                         

@viktym
Copy link
Contributor

viktym commented Feb 16, 2020

Hi @joridos
Please look at released patches for 2.3 #26698 (comment)
There you can find how to fix failed a static test and additional fix for region query using region collection (fixed filter by country)

@sidolov
Copy link
Contributor

sidolov commented Aug 17, 2020

@joridos looks like the issue was fixed in commits:

@sidolov sidolov closed this Aug 17, 2020
@m2-assistant
Copy link

m2-assistant bot commented Aug 17, 2020

Hi @joridos, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants