Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 46 additions & 35 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,36 +1,47 @@
{
"name": "boletosimples/boletosimples",
"type": "library",
"description": "A PHP client library for easily accessing Boleto Simples API.",
"keywords": ["boleto","simples","boletosimples","ecommerce"],
"homepage": "http://api.boletosimples.com.br",
"license": "MIT",
"authors": [
{
"name": "Rafael Lima",
"email": "contato@rafael.adm.br",
"homepage": "http://rafael.adm.br/"
}
],
"support": {
"email": "suporte@boletosimples.com.br",
"issues": "http://github.com/BoletoSimples/boletosimples-php/issues",
"sources": "https://github.com/BoletoSimples/boletosimples-php"
},
"require": {
"guzzlehttp/guzzle": "5.*",
"commerceguys/guzzle-oauth2-plugin": "2.*"
},
"require-dev": {
"phpunit/phpunit": "4.5.*",
"php-vcr/php-vcr": "~1.2",
"php-vcr/phpunit-testlistener-vcr": "*",
"ptrofimov/xpmock": "dev-master"
},
"autoload": {
"psr-4": {
"BoletoSimples\\": ["src/BoletoSimples","src/BoletoSimples/Resources"]
},
"files": ["src/BoletoSimples.php"]
}
}
"name": "dolalima/boletosimples",
"type": "library",
"version": "1.0.0",
"description": "A PHP client library for easily accessing Boleto Simples API.",
"keywords": [
"boleto",
"simples",
"boletosimples",
"ecommerce"
],
"homepage": "http://api.kobana.com.br",
"license": "MIT",
"authors": [
{
"name": "Rafael Lima",
"email": "contato@rafael.adm.br",
"homepage": "http://rafael.adm.br/"
}
],
"support": {
"email": "suporte@kobana.com.br",
"issues": "http://github.com/BoletoSimples/boletosimples-php/issues",
"sources": "https://github.com/BoletoSimples/boletosimples-php"
},
"require": {
"guzzlehttp/guzzle": "5.*",
"commerceguys/guzzle-oauth2-plugin": "2.*"
},
"require-dev": {
"phpunit/phpunit": "4.5.*",
"php-vcr/php-vcr": "~1.2",
"php-vcr/phpunit-testlistener-vcr": "*",
"ptrofimov/xpmock": "dev-master"
},
"autoload": {
"psr-4": {
"BoletoSimples\\": [
"src/BoletoSimples",
"src/BoletoSimples/Resources"
]
},
"files": [
"src/BoletoSimples.php"
]
}
}
22 changes: 13 additions & 9 deletions src/BoletoSimples/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@

namespace BoletoSimples;

class Configuration {
private $environments_uri = array('sandbox' => 'https://sandbox.boletosimples.com.br/api/v1/', 'production' => 'https://boletosimples.com.br/api/v1/');
class Configuration
{
private $environments_uri = array('sandbox' => 'https://api-sandbox.kobana.com.br/v1/', 'production' => 'https://api.kobana.com.br/v1/');
public $environment = null;
public $application_id = null;
public $application_secret = null;
public $access_token = null;

public function __construct($params = array()) {
public function __construct($params = array())
{
$default_environment = getenv('BOLETOSIMPLES_ENV') ? getenv('BOLETOSIMPLES_ENV') : 'sandbox';
$default_application_id = getenv('BOLETOSIMPLES_APP_ID') ? getenv('BOLETOSIMPLES_APP_ID') : null;
$default_application_secret = getenv('BOLETOSIMPLES_APP_SECRET') ? getenv('BOLETOSIMPLES_APP_SECRET') : null;
Expand All @@ -21,16 +23,18 @@ public function __construct($params = array()) {
$this->access_token = isset($params['access_token']) ? $params['access_token'] : $default_access_token;
}

public function userAgent() {
return "BoletoSimples PHP Client v".\BoletoSimples::VERSION." (contato@boletosimples.com.br)";
public function userAgent()
{
return "BoletoSimples PHP Client v" . \BoletoSimples::VERSION . " (contato@kobana.com.br)";
}

public function hasAccessToken() {
public function hasAccessToken()
{
return $this->access_token != null;
}

public function baseUri() {
public function baseUri()
{
return $this->environments_uri[$this->environment];
}

}
}