Skip to content
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

404s are not handled correctly by the client. #74

Open
patrickyan opened this issue Jan 8, 2014 · 12 comments
Open

404s are not handled correctly by the client. #74

patrickyan opened this issue Jan 8, 2014 · 12 comments
Labels

Comments

@patrickyan
Copy link

The only thing I’m doing is \Balanced\Debit::get($debit_uri);. Everything works perfectly on my local machine through MAMP.

An error occurred in /var/app/current/extensions/balanced/lib/balanced/balanced/src/Balanced/Resource.php around line 27

22 {
23 if (property_exists($response->body, 'category_code') &&
24 array_key_exists($response->body->category_code, Error::$codes))
25 $error = new Error::$codes[$response->body->category_code]($response);
26 else
27 $error = new HTTPError($response);
28 return $error;
29 }
30
31 public static function getClient()

Backtrace
[:0]
    Balanced\Resource::convertError();
[/var/app/current/extensions/balanced/lib/bninja/restful/src/RESTful/Client.php:69]
    call_user_func();
[/var/app/current/extensions/balanced/lib/bninja/restful/src/RESTful/Client.php:24]
    RESTful\Client->_op();
[/var/app/current/extensions/balanced/lib/bninja/restful/src/RESTful/Resource.php:158]
    RESTful\Client->get();
[/var/app/current/workspace/events/event.reservations_cron_expired.php:145]
    RESTful\Resource::get();
@mjallday
Copy link
Contributor

mjallday commented Jan 8, 2014

Which version of balanced-php?
Can you re-create via a script with a test marketplace?

@patrickyan
Copy link
Author

I was on 0.7.3.1. I just updated to 0.7.5.0 and the error changed (still works on local machine, only broken on AWS)

An error occurred in /var/app/current/extensions/balanced/lib/balanced/balanced/src/Balanced/Errors/Error.php around line 39

34 if (isset(self::$codes[$code]))
35 $cn = self::$codes[$code];
36 else
37 $cn = get_class();
38
39 return new $cn($response);
40 }
41 }
Backtrace
[/var/app/current/extensions/balanced/lib/balanced/balanced/src/Balanced/Resource.php:24]
    Balanced\Errors\Error::createFromResponse();
[:0]
    Balanced\Resource::convertError();
[/var/app/current/extensions/balanced/lib/bninja/restful/src/RESTful/Client.php:69]
    call_user_func();
[/var/app/current/extensions/balanced/lib/bninja/restful/src/RESTful/Client.php:24]
    RESTful\Client->_op();
[/var/app/current/extensions/balanced/lib/bninja/restful/src/RESTful/Resource.php:160]
    RESTful\Client->get();
[/var/app/current/workspace/events/event.reservations_cron_expired.php:145]
    RESTful\Resource::get();

Will create an example and upload soon

@mjallday
Copy link
Contributor

mjallday commented Jan 8, 2014

To clarify - the error was occurring for you on both 0.7.3.1 and 0.7.5.0?

@patrickyan
Copy link
Author

The errors are different as shown above.

@mjallday
Copy link
Contributor

mjallday commented Jan 8, 2014

Target of the stack trace - https://github.com/balanced/balanced-php/blob/master/src/Balanced/Errors/Error.php#L39

What's the marketplace URI @patrickyan ?

@patrickyan
Copy link
Author

Marketplace URI (live site on AWS exhibiting errors) - /v1/marketplaces/MP71FEa3io3xyZLug5Wd53Mr

Marketplace URI (test local machine no errors) - /v1/marketplaces/TEST-MP5aEqhbBt14ePPxZT8vX0Lw

@mjallday
Copy link
Contributor

mjallday commented Jan 8, 2014

What does the debit uri look like?

@patrickyan
Copy link
Author

Ah, that might have been the cause of the error. The URI being checked was /v1/debits/WD39GdSrdvQBygmJFQgzoO8O but I just checked and the URI on my test machine was /v1/marketplaces/TEST-MP5aEqhbBt14ePPxZT8vX0Lw/debits/WD34aL5ec2gLgX55zVSpCR3W. We had to refund and re-charge a customer through the Dashboard, but there was no URI in Dashboard, so we just pasted over the ID.

I assume that a Balanced error should display though.

@mjallday
Copy link
Contributor

mjallday commented Jan 8, 2014

yep, it looks like it's generating a 404.

obviously a 404 should be surfaced to you correctly so we'll get that fixed. thanks for bringing this to our attention.

rserna2010 pushed a commit to rserna2010/balanced-php that referenced this issue May 8, 2014
@steveklabnik
Copy link

had another customer see this today: https://botbot.me/freenode/balanced/2014-06-01/?msg=15484633&page=1

@NorthMcCormick
Copy link

I am ^^^ That customer.

I got my href through the balanced.js process, which Steve verified is correct and a valid href. When I try and pass it through my get function so I can add it to my market place it throws that error at me. If I use a predetermined href for a card already in my market place, it works fine.

@mjallday
Copy link
Contributor

mjallday commented Jun 2, 2014

@NorthMcCormick was that an old href for a card? they expire after a couple of hours. if you want to jump on irc (freenode #balanced) we can help you troubleshoot it and resolve this quickly.

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

No branches or pull requests

4 participants