Skip to content

Commit

Permalink
fix get plans and plan me
Browse files Browse the repository at this point in the history
  • Loading branch information
jhowbhz authored Mar 1, 2024
1 parent 6b2b614 commit bc77cd7
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions src/Service.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,38 @@ public static function Auth(String $action = '', Array $data = []) {

}

public static function Plan(String $action = '', Array $data = []) {

try {

$base_uri = "https://gateway.apibrasil.io/api/v2/plans/";
$method = $data['method'] ?? 'POST';
$me = $action == "me" ? true : false;

if($me){
$base_uri = "https://gateway.apibrasil.io/api/v2/plan/";
}

$headers = [
"Content-Type" => "application/json",
"Accept" => "application/json",
"Authorization" => "Bearer ".$data['Bearer'],
];

$body = $data['body'] ?? [];

$response = self::defaultRequest($method, $base_uri, $action, $headers, $body);
return $response;

} catch (ClientException $e) {

$response = $e->getResponse();
return json_decode((string)($response->getBody()->getContents()));

}

}

public static function Profile(String $action = '', Array $data = []) {

try {
Expand Down

0 comments on commit bc77cd7

Please sign in to comment.