woocommerce / woocommerce-paypal-payments

https://wordpress.org/plugins/woocommerce-paypal-payments/
GNU General Public License v2.0
62 stars 47 forks source link

Fix the package tracking integration throws error in 2.7.1 (3185) #2289

Closed Narek13 closed 4 months ago

Narek13 commented 4 months ago

PR Description

The problem described in the description happens on non - PayPal order pages, cause when we cannot find the PayPal order ID from order meta we return the 'PayPal order ID not found in meta.' exception. The PR will surround the integrations in try/catch blocks and will exit if error happens -> means not a PayPal order edit page. This is not possible to fix in more elegant way cause the request can come differently (Ajax, Rest)

Issue Description

After changing the behavior with transaction id/capture id for package tracking, we may have broken our tracking integrations as we have received couple of reports from customers.

Steps To Reproduce

It will stuck and if you check the log you will see the error. The other integrations will act the same

Wimmie commented 4 months ago

Is it not better to just put a try catch around the ppcp_get_paypal_order, catch the InvalidArgumentException and check that the order payment method is ppcp-gateway?

Narek13 commented 4 months ago

@Wimmie Thanks for the question. As this is 3rd party integrations and could be some more edge cases which we can't detect, I thought would be less risky to try/catch the whole integration to avoid breaking plugin if an unexpected error happens.