paypal / paypalhttp_ruby

MIT License
6 stars 38 forks source link

`Unable to deserialize response with Content-Type application/JSON` #5

Open swerling opened 3 years ago

swerling commented 3 years ago

General information

Issue description

As of yesterday, 2021-04-18, a little bit after 2021-04-18T18:31:55.528+00:00, you're backend started returning some responses with content type application/JSON (with all caps 'json').

This gem cannot handle the response, see: https://github.com/paypal/paypalhttp_ruby/blob/master/lib/paypalhttp/serializers/json.rb#L14

If I change

    def content_type
      /application\/json/
    end

..to a case insensitive regex, then payout submission works again:

    def content_type
      /application\/json/i
    end

This is a very serious bug, since it breaks in a way that prevents the calling code from getting the payout_batch_id, which is needed by clients to later check on the status of a payout.

edmundonm commented 3 years ago

Our teams are also encountering this very serious issue preventing us from processing successful Payout responses using the Ruby Payouts SDK Gem.

The full error message agrees with the issue and proposed solution above:

PayPalHttp::UnsupportedEncodingError: Unable to deserialize response with Content-Type application/JSON. Supported decodings are ["/application\\/json/", "/text\\/.*/", "/multipart\\/.*/", "/^application\\/x-www-form-urlencoded/"]
pathouse commented 3 years ago

Looks like paypal fixed their responses so this is no longer needed

nima855 commented 3 years ago

@pathouse this occurred again on April 30th from 4:30am to 9:30am (Pacific Time). It has stopped since then