202ecommerce / paypal

This repository is for developpers only. To install and upgrade the module in a production shop please install the package via PrestaShop Marketplace by following this link:
https://addons.prestashop.com/fr/paiement-carte-wallet/1748-paypal-officiel.html
Academic Free License v3.0
20 stars 31 forks source link

Handle Paypal Access Token errors that does not contain `error_description` #198

Closed MonsieurV closed 1 year ago

MonsieurV commented 1 year ago

Describe the bug and add screenshots

In https://github.com/202ecommerce/paypal/blob/develop/classes/API/Request/PaypalAccessTokenRequest.php#L57 when Paypal return JSON errors not containing the property error_description, the error handling code throw a notice:

Notice: Undefined property: stdClass::$error_description

After patching, here the JSON returned by Paypal:

{"name":"RATE_LIMIT_REACHED","debug_id":"XXXXXX","message":"Too many requests. Blocked due to rate limiting.","links":[]} 

Expected behavior

The handling code should handle errors without the property error_description

Steps to reproduce

  1. Try to rate-limit the Paypal API when associating a Paypal account
  2. See the PHP error in return

PrestaShop version(s) where the bug happened

1.7.6.8

PHP version(s) where the bug happened

7.2

clotairer commented 1 year ago

Thank you. It's a good suggestion. Not easy to plan during our tests !

kgleizes commented 1 year ago

Thank you @MonsieurV these changes are implemented on 6.0.0.