Mangopay / mangopay2-ruby-sdk

Ruby Gem for MANGOPAY
https://rubygems.org/gems/mangopay
MIT License
42 stars 38 forks source link

different behavior in rails console and server #12

Closed AlexandreBernard closed 10 years ago

AlexandreBernard commented 10 years ago

Investigating an issue this morning. Sorry for still not being able to be precise but what i encounter is really weird.

I have a user model which has a mango_user method which fetches the mango_user with the SDK - version 3.0.9.

calling exactly the same method for exactly the same user raises different things on an http request and with the console.

http request raises a MangoPay::ResponseError with the following properties:

rails console simply works. i'm still investigating but I currently don't understand what's going on

AlexandreBernard commented 10 years ago

I confirm that I don't understand this bug at all but getting back to 3.0.8 solves it. now i have different issues but with something else that i'm still investigating

AlexandreBernard commented 10 years ago

actually i'm not so sure. the problem came back on 3.0.8. that seems to be completely random.

AlexandreBernard commented 10 years ago

now i guess it's a side effect of something in our code as it seems to work. but i don't understand still. consider it's on our side even if reality is: i don't know. closing.

terry90 commented 9 years ago

I also encounter this issue. Using Rails 4.2.3, MangoPay gem 3.0.18

I am writing my tests, I stub every request coming from api.sandbox.mangopay.com I monkey patched MangoPay.request to be sure that my stubbed responses are corrects and there is no difference in the JSON.

When testing legal user creation, MangoPay sdk throw me exactly the same error.

Have you found a solution ?

Edit: your issue being old, I'll open a new one

itkin commented 8 years ago

+1 rails vcr, got this exception a bit randomly when fetching data using MangoPay::LegalUser.fetch for example, i guess it has something to do with the oauth access token, but doesn't the ruby sdk gem handle to get a new token seemlessly ?

update : in my case this behavior seems to be caused by an old oauth token stored in the vcr cassette ; when a new query is necessary because the test has changed, this invalid token is used causing an API auth failure. Solution is just to remove the oauth query in the vcr cassette when in order to force getting a new one, when needed.

iammichiel commented 8 years ago

When using the php-sdk, this is caused by an old file in the "temp" folder of the MangopaySDK. You might want to clear it if you switch environments on the same machine.