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

Commit 09700e4

Browse files
Merge branch 'release/1.3.0'
2 parents 2eee09e + aaba011 commit 09700e4

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
\SatispayOnline\Api::setSecurityBearer('yoursecuritybearer');
77

88
try {
9-
\SatispayOnline\Bearer:check();
9+
\SatispayOnline\Bearer::check();
1010
echo 'OK';
1111
} catch(\Exception $ex) {
1212
echo 'Invalid Security Bearer';

lib/Api.php

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
<?php
22
namespace SatispayOnline;
33

4+
define('SDKVERSION', '1.3.0');
5+
46
class Api {
57
public static $securityBearer;
68
public static $urlStaging = 'https://staging.authservices.satispay.com';
79
public static $url = 'https://authservices.satispay.com';
810
public static $staging = false;
11+
public static $client = null;
912

1013
public static function setSecurityBearer($securityBearer) {
1114
self::$securityBearer = $securityBearer;
@@ -19,6 +22,10 @@ public static function setStaging($staging) {
1922
self::$staging = $staging;
2023
}
2124

25+
public static function setClient($client) {
26+
self::$client = $client;
27+
}
28+
2229
public static function request($url, $method = null, $params = null) {
2330
$opts = [];
2431
$curl = curl_init();
@@ -34,10 +41,15 @@ public static function request($url, $method = null, $params = null) {
3441
$opts[CURLOPT_URL] = $api.$url;
3542
$opts[CURLOPT_RETURNTRANSFER] = true;
3643

37-
$headers = [
44+
$headers = array(
3845
'Authorization: Bearer '.self::$securityBearer,
39-
'Content-Type: application/json'
40-
];
46+
'Content-Type: application/json',
47+
'X-Satispay-Client: '.join(' ', array(
48+
self::$client,
49+
'PHP/'.phpversion()
50+
)),
51+
'User-Agent: SatispayOnlineApi-PHPSDK/'.SDKVERSION
52+
);
4153
$opts[CURLOPT_HTTPHEADER] = $headers;
4254

4355
if ($method == 'post') {
@@ -67,10 +79,10 @@ public static function request($url, $method = null, $params = null) {
6779
curl_close($curl);
6880
}
6981

70-
return [
82+
return array(
7183
'body' => json_decode($rbody),
7284
'code' => $rcode,
7385
'error' => $error
74-
];
86+
);
7587
}
7688
}

0 commit comments

Comments
 (0)