Skip to content
This repository has been archived by the owner on Oct 4, 2019. It is now read-only.

Commit

Permalink
SDK Version and Client version
Browse files Browse the repository at this point in the history
  • Loading branch information
alessiodionisi committed Jul 25, 2017
1 parent 2eee09e commit f92c3c7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
\SatispayOnline\Api::setSecurityBearer('yoursecuritybearer');

try {
\SatispayOnline\Bearer:check();
\SatispayOnline\Bearer::check();
echo 'OK';
} catch(\Exception $ex) {
echo 'Invalid Security Bearer';
Expand Down
14 changes: 13 additions & 1 deletion lib/Api.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
<?php
namespace SatispayOnline;

define('SDKVERSION', '1.3.0');

class Api {
public static $securityBearer;
public static $urlStaging = 'https://staging.authservices.satispay.com';
public static $url = 'https://authservices.satispay.com';
public static $staging = false;
public static $client = null;

public static function setSecurityBearer($securityBearer) {
self::$securityBearer = $securityBearer;
Expand All @@ -19,6 +22,10 @@ public static function setStaging($staging) {
self::$staging = $staging;
}

public static function setClient($client) {
self::$client = $client;
}

public static function request($url, $method = null, $params = null) {
$opts = [];
$curl = curl_init();
Expand All @@ -36,7 +43,12 @@ public static function request($url, $method = null, $params = null) {

$headers = [
'Authorization: Bearer '.self::$securityBearer,
'Content-Type: application/json'
'Content-Type: application/json',
'X-Satispay-Client: '.join(' ', [
self::$client,
'PHP/'.phpversion()
]),
'User-Agent: SatispayOnlineApi-PHPSDK/'.SDKVERSION
];
$opts[CURLOPT_HTTPHEADER] = $headers;

Expand Down

0 comments on commit f92c3c7

Please sign in to comment.