iugu / iugu-php

iugu - Biblioteca para PHP
MIT License
90 stars 66 forks source link

Test Configure #6

Closed yespbs closed 9 years ago

yespbs commented 9 years ago

There is no option specify a TEST account? In Iugu_APIRequest::request() I added forced $data['mode'] = 'TEST'; before requestWithCURL and it works

Please add support

yespbs commented 9 years ago

Its was aquick fix, I applied following changes, please merge

  1. Base.php

public static $test_mode = false; public static function setTestMode(){ self::$test_mode = true; }

public static function getTestMode() { return self::$test_mode; }

  1. APIRequest.php in request() method before requestWithCURL call

    // test mode if( Iugu::getTestMode() ){ $data['mode'] = 'TEST'; }

pnegri commented 9 years ago

Just use the TEST API TOKEN. There is no need to add a data['mode'] = 'TEST'.

yespbs commented 9 years ago

yes, I used that first, when it returned no data( tested plan list and customer fetch which resulted in not found error), I investigated further and found that the mode variable as instructed in API documentation is missing. Which when added started fetching the test account data.

So not only the test account token but also the mode variable is needed

pnegri commented 9 years ago

Here is working, just tested.

Check again. There is like 300 startups using this way and work.

yespbs commented 9 years ago

Not sure, should I send you the copy I have? the git was just downloaded today and tested?

I have attached the test screens, one without the mode and one with the mode

here is the print part in code https://gist.github.com/yespbs/5f0020d0d3ba7d13a87e

with_mode without_mode

yespbs commented 9 years ago

I can send you the api key but to email, where should I send?

pnegri commented 9 years ago

patrick@iugu.com

pnegri commented 9 years ago

Send me the account ID too.

yespbs commented 9 years ago

sure, sent

yespbs commented 9 years ago

may be this is an account level issue? I am not sure, this is my first work with Iugu

pnegri commented 9 years ago

Closing the issue since i am solving this by email.