summaryrefslogtreecommitdiffstats
path: root/vendor/paypal/paypal-checkout-sdk/lib/PayPalCheckoutSdk/Core
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--vendor/paypal/paypal-checkout-sdk/lib/PayPalCheckoutSdk/Core/AccessToken.php48
-rw-r--r--vendor/paypal/paypal-checkout-sdk/lib/PayPalCheckoutSdk/Core/AccessTokenRequest.php54
-rw-r--r--vendor/paypal/paypal-checkout-sdk/lib/PayPalCheckoutSdk/Core/AuthorizationInjector.php102
-rw-r--r--vendor/paypal/paypal-checkout-sdk/lib/PayPalCheckoutSdk/Core/FPTIInstrumentationInjector.php32
-rw-r--r--vendor/paypal/paypal-checkout-sdk/lib/PayPalCheckoutSdk/Core/GzipInjector.php28
-rw-r--r--vendor/paypal/paypal-checkout-sdk/lib/PayPalCheckoutSdk/Core/PayPalEnvironment.php46
-rw-r--r--vendor/paypal/paypal-checkout-sdk/lib/PayPalCheckoutSdk/Core/PayPalHttpClient.php54
-rw-r--r--vendor/paypal/paypal-checkout-sdk/lib/PayPalCheckoutSdk/Core/ProductionEnvironment.php32
-rw-r--r--vendor/paypal/paypal-checkout-sdk/lib/PayPalCheckoutSdk/Core/RefreshTokenRequest.php38
-rw-r--r--vendor/paypal/paypal-checkout-sdk/lib/PayPalCheckoutSdk/Core/SandboxEnvironment.php32
-rw-r--r--vendor/paypal/paypal-checkout-sdk/lib/PayPalCheckoutSdk/Core/UserAgent.php104
-rw-r--r--vendor/paypal/paypal-checkout-sdk/lib/PayPalCheckoutSdk/Core/Version.php16
12 files changed, 293 insertions, 293 deletions
diff --git a/vendor/paypal/paypal-checkout-sdk/lib/PayPalCheckoutSdk/Core/AccessToken.php b/vendor/paypal/paypal-checkout-sdk/lib/PayPalCheckoutSdk/Core/AccessToken.php
index b6f1d2d..521429a 100644
--- a/vendor/paypal/paypal-checkout-sdk/lib/PayPalCheckoutSdk/Core/AccessToken.php
+++ b/vendor/paypal/paypal-checkout-sdk/lib/PayPalCheckoutSdk/Core/AccessToken.php
@@ -1,25 +1,25 @@
-<?php
-
-namespace PayPalCheckoutSdk\Core;
-
-
-class AccessToken
-{
- public $token;
- public $tokenType;
- public $expiresIn;
- private $createDate;
-
- public function __construct($token, $tokenType, $expiresIn)
- {
- $this->token = $token;
- $this->tokenType = $tokenType;
- $this->expiresIn = $expiresIn;
- $this->createDate = time();
- }
-
- public function isExpired()
- {
- return time() >= $this->createDate + $this->expiresIn;
- }
+<?php
+
+namespace PayPalCheckoutSdk\Core;
+
+
+class AccessToken
+{
+ public $token;
+ public $tokenType;
+ public $expiresIn;
+ private $createDate;
+
+ public function __construct($token, $tokenType, $expiresIn)
+ {
+ $this->token = $token;
+ $this->tokenType = $tokenType;
+ $this->expiresIn = $expiresIn;
+ $this->createDate = time();
+ }
+
+ public function isExpired()
+ {
+ return time() >= $this->createDate + $this->expiresIn;
+ }
} \ No newline at end of file
diff --git a/vendor/paypal/paypal-checkout-sdk/lib/PayPalCheckoutSdk/Core/AccessTokenRequest.php b/vendor/paypal/paypal-checkout-sdk/lib/PayPalCheckoutSdk/Core/AccessTokenRequest.php
index 5c3e26e..9205aae 100644
--- a/vendor/paypal/paypal-checkout-sdk/lib/PayPalCheckoutSdk/Core/AccessTokenRequest.php
+++ b/vendor/paypal/paypal-checkout-sdk/lib/PayPalCheckoutSdk/Core/AccessTokenRequest.php
@@ -1,27 +1,27 @@
-<?php
-
-namespace PayPalCheckoutSdk\Core;
-
-use PayPalHttp\HttpRequest;
-
-class AccessTokenRequest extends HttpRequest
-{
- public function __construct(PayPalEnvironment $environment, $refreshToken = NULL)
- {
- parent::__construct("/v1/oauth2/token", "POST");
- $this->headers["Authorization"] = "Basic " . $environment->authorizationString();
- $body = [
- "grant_type" => "client_credentials"
- ];
-
- if (!is_null($refreshToken))
- {
- $body["grant_type"] = "refresh_token";
- $body["refresh_token"] = $refreshToken;
- }
-
- $this->body = $body;
- $this->headers["Content-Type"] = "application/x-www-form-urlencoded";
- }
-}
-
+<?php
+
+namespace PayPalCheckoutSdk\Core;
+
+use PayPalHttp\HttpRequest;
+
+class AccessTokenRequest extends HttpRequest
+{
+ public function __construct(PayPalEnvironment $environment, $refreshToken = NULL)
+ {
+ parent::__construct("/v1/oauth2/token", "POST");
+ $this->headers["Authorization"] = "Basic " . $environment->authorizationString();
+ $body = [
+ "grant_type" => "client_credentials"
+ ];
+
+ if (!is_null($refreshToken))
+ {
+ $body["grant_type"] = "refresh_token";
+ $body["refresh_token"] = $refreshToken;
+ }
+
+ $this->body = $body;
+ $this->headers["Content-Type"] = "application/x-www-form-urlencoded";
+ }
+}
+
diff --git a/vendor/paypal/paypal-checkout-sdk/lib/PayPalCheckoutSdk/Core/AuthorizationInjector.php b/vendor/paypal/paypal-checkout-sdk/lib/PayPalCheckoutSdk/Core/AuthorizationInjector.php
index 0b38bba..5c966aa 100644
--- a/vendor/paypal/paypal-checkout-sdk/lib/PayPalCheckoutSdk/Core/AuthorizationInjector.php
+++ b/vendor/paypal/paypal-checkout-sdk/lib/PayPalCheckoutSdk/Core/AuthorizationInjector.php
@@ -1,51 +1,51 @@
-<?php
-
-namespace PayPalCheckoutSdk\Core;
-
-use PayPalHttp\HttpRequest;
-use PayPalHttp\Injector;
-use PayPalHttp\HttpClient;
-
-class AuthorizationInjector implements Injector
-{
- private $client;
- private $environment;
- private $refreshToken;
- public $accessToken;
-
- public function __construct(HttpClient $client, PayPalEnvironment $environment, $refreshToken)
- {
- $this->client = $client;
- $this->environment = $environment;
- $this->refreshToken = $refreshToken;
- }
-
- public function inject($request)
- {
- if (!$this->hasAuthHeader($request) && !$this->isAuthRequest($request))
- {
- if (is_null($this->accessToken) || $this->accessToken->isExpired())
- {
- $this->accessToken = $this->fetchAccessToken();
- }
- $request->headers['Authorization'] = 'Bearer ' . $this->accessToken->token;
- }
- }
-
- private function fetchAccessToken()
- {
- $accessTokenResponse = $this->client->execute(new AccessTokenRequest($this->environment, $this->refreshToken));
- $accessToken = $accessTokenResponse->result;
- return new AccessToken($accessToken->access_token, $accessToken->token_type, $accessToken->expires_in);
- }
-
- private function isAuthRequest($request)
- {
- return $request instanceof AccessTokenRequest || $request instanceof RefreshTokenRequest;
- }
-
- private function hasAuthHeader(HttpRequest $request)
- {
- return array_key_exists("Authorization", $request->headers);
- }
-}
+<?php
+
+namespace PayPalCheckoutSdk\Core;
+
+use PayPalHttp\HttpRequest;
+use PayPalHttp\Injector;
+use PayPalHttp\HttpClient;
+
+class AuthorizationInjector implements Injector
+{
+ private $client;
+ private $environment;
+ private $refreshToken;
+ public $accessToken;
+
+ public function __construct(HttpClient $client, PayPalEnvironment $environment, $refreshToken)
+ {
+ $this->client = $client;
+ $this->environment = $environment;
+ $this->refreshToken = $refreshToken;
+ }
+
+ public function inject($request)
+ {
+ if (!$this->hasAuthHeader($request) && !$this->isAuthRequest($request))
+ {
+ if (is_null($this->accessToken) || $this->accessToken->isExpired())
+ {
+ $this->accessToken = $this->fetchAccessToken();
+ }
+ $request->headers['Authorization'] = 'Bearer ' . $this->accessToken->token;
+ }
+ }
+
+ private function fetchAccessToken()
+ {
+ $accessTokenResponse = $this->client->execute(new AccessTokenRequest($this->environment, $this->refreshToken));
+ $accessToken = $accessTokenResponse->result;
+ return new AccessToken($accessToken->access_token, $accessToken->token_type, $accessToken->expires_in);
+ }
+
+ private function isAuthRequest($request)
+ {
+ return $request instanceof AccessTokenRequest || $request instanceof RefreshTokenRequest;
+ }
+
+ private function hasAuthHeader(HttpRequest $request)
+ {
+ return array_key_exists("Authorization", $request->headers);
+ }
+}
diff --git a/vendor/paypal/paypal-checkout-sdk/lib/PayPalCheckoutSdk/Core/FPTIInstrumentationInjector.php b/vendor/paypal/paypal-checkout-sdk/lib/PayPalCheckoutSdk/Core/FPTIInstrumentationInjector.php
index 898a750..bad8a35 100644
--- a/vendor/paypal/paypal-checkout-sdk/lib/PayPalCheckoutSdk/Core/FPTIInstrumentationInjector.php
+++ b/vendor/paypal/paypal-checkout-sdk/lib/PayPalCheckoutSdk/Core/FPTIInstrumentationInjector.php
@@ -1,16 +1,16 @@
-<?php
-
-namespace PayPalCheckoutSdk\Core;
-
-use PayPalHttp\Injector;
-
-class FPTIInstrumentationInjector implements Injector
-{
- public function inject($request)
- {
- $request->headers["sdk_name"] = "Checkout SDK";
- $request->headers["sdk_version"] = "1.0.1";
- $request->headers["sdk_tech_stack"] = "PHP " . PHP_VERSION;
- $request->headers["api_integration_type"] = "PAYPALSDK";
- }
-}
+<?php
+
+namespace PayPalCheckoutSdk\Core;
+
+use PayPalHttp\Injector;
+
+class FPTIInstrumentationInjector implements Injector
+{
+ public function inject($request)
+ {
+ $request->headers["sdk_name"] = "Checkout SDK";
+ $request->headers["sdk_version"] = "1.0.2";
+ $request->headers["sdk_tech_stack"] = "PHP " . PHP_VERSION;
+ $request->headers["api_integration_type"] = "PAYPALSDK";
+ }
+}
diff --git a/vendor/paypal/paypal-checkout-sdk/lib/PayPalCheckoutSdk/Core/GzipInjector.php b/vendor/paypal/paypal-checkout-sdk/lib/PayPalCheckoutSdk/Core/GzipInjector.php
index 202b6b1..f1d4339 100644
--- a/vendor/paypal/paypal-checkout-sdk/lib/PayPalCheckoutSdk/Core/GzipInjector.php
+++ b/vendor/paypal/paypal-checkout-sdk/lib/PayPalCheckoutSdk/Core/GzipInjector.php
@@ -1,14 +1,14 @@
-<?php
-
-namespace PayPalCheckoutSdk\Core;
-
-
-use PayPalHttp\Injector;
-
-class GzipInjector implements Injector
-{
- public function inject($httpRequest)
- {
- $httpRequest->headers["Accept-Encoding"] = "gzip";
- }
-}
+<?php
+
+namespace PayPalCheckoutSdk\Core;
+
+
+use PayPalHttp\Injector;
+
+class GzipInjector implements Injector
+{
+ public function inject($httpRequest)
+ {
+ $httpRequest->headers["Accept-Encoding"] = "gzip";
+ }
+}
diff --git a/vendor/paypal/paypal-checkout-sdk/lib/PayPalCheckoutSdk/Core/PayPalEnvironment.php b/vendor/paypal/paypal-checkout-sdk/lib/PayPalCheckoutSdk/Core/PayPalEnvironment.php
index 252864b..f9eff1c 100644
--- a/vendor/paypal/paypal-checkout-sdk/lib/PayPalCheckoutSdk/Core/PayPalEnvironment.php
+++ b/vendor/paypal/paypal-checkout-sdk/lib/PayPalCheckoutSdk/Core/PayPalEnvironment.php
@@ -1,23 +1,23 @@
-<?php
-
-namespace PayPalCheckoutSdk\Core;
-
-use PayPalHttp\Environment;
-
-abstract class PayPalEnvironment implements Environment
-{
- private $clientId;
- private $clientSecret;
-
- public function __construct($clientId, $clientSecret)
- {
- $this->clientId = $clientId;
- $this->clientSecret = $clientSecret;
- }
-
- public function authorizationString()
- {
- return base64_encode($this->clientId . ":" . $this->clientSecret);
- }
-}
-
+<?php
+
+namespace PayPalCheckoutSdk\Core;
+
+use PayPalHttp\Environment;
+
+abstract class PayPalEnvironment implements Environment
+{
+ private $clientId;
+ private $clientSecret;
+
+ public function __construct($clientId, $clientSecret)
+ {
+ $this->clientId = $clientId;
+ $this->clientSecret = $clientSecret;
+ }
+
+ public function authorizationString()
+ {
+ return base64_encode($this->clientId . ":" . $this->clientSecret);
+ }
+}
+
diff --git a/vendor/paypal/paypal-checkout-sdk/lib/PayPalCheckoutSdk/Core/PayPalHttpClient.php b/vendor/paypal/paypal-checkout-sdk/lib/PayPalCheckoutSdk/Core/PayPalHttpClient.php
index 3b3c205..699cc0e 100644
--- a/vendor/paypal/paypal-checkout-sdk/lib/PayPalCheckoutSdk/Core/PayPalHttpClient.php
+++ b/vendor/paypal/paypal-checkout-sdk/lib/PayPalCheckoutSdk/Core/PayPalHttpClient.php
@@ -1,27 +1,27 @@
-<?php
-
-namespace PayPalCheckoutSdk\Core;
-
-use PayPalHttp\HttpClient;
-
-class PayPalHttpClient extends HttpClient
-{
- private $refreshToken;
- public $authInjector;
-
- public function __construct(PayPalEnvironment $environment, $refreshToken = NULL)
- {
- parent::__construct($environment);
- $this->refreshToken = $refreshToken;
- $this->authInjector = new AuthorizationInjector($this, $environment, $refreshToken);
- $this->addInjector($this->authInjector);
- $this->addInjector(new GzipInjector());
- $this->addInjector(new FPTIInstrumentationInjector());
- }
-
- public function userAgent()
- {
- return UserAgent::getValue();
- }
-}
-
+<?php
+
+namespace PayPalCheckoutSdk\Core;
+
+use PayPalHttp\HttpClient;
+
+class PayPalHttpClient extends HttpClient
+{
+ private $refreshToken;
+ public $authInjector;
+
+ public function __construct(PayPalEnvironment $environment, $refreshToken = NULL)
+ {
+ parent::__construct($environment);
+ $this->refreshToken = $refreshToken;
+ $this->authInjector = new AuthorizationInjector($this, $environment, $refreshToken);
+ $this->addInjector($this->authInjector);
+ $this->addInjector(new GzipInjector());
+ $this->addInjector(new FPTIInstrumentationInjector());
+ }
+
+ public function userAgent()
+ {
+ return UserAgent::getValue();
+ }
+}
+
diff --git a/vendor/paypal/paypal-checkout-sdk/lib/PayPalCheckoutSdk/Core/ProductionEnvironment.php b/vendor/paypal/paypal-checkout-sdk/lib/PayPalCheckoutSdk/Core/ProductionEnvironment.php
index 20a47b2..e3635fc 100644
--- a/vendor/paypal/paypal-checkout-sdk/lib/PayPalCheckoutSdk/Core/ProductionEnvironment.php
+++ b/vendor/paypal/paypal-checkout-sdk/lib/PayPalCheckoutSdk/Core/ProductionEnvironment.php
@@ -1,16 +1,16 @@
-<?php
-
-namespace PayPalCheckoutSdk\Core;
-
-class ProductionEnvironment extends PayPalEnvironment
-{
- public function __construct($clientId, $clientSecret)
- {
- parent::__construct($clientId, $clientSecret);
- }
-
- public function baseUrl()
- {
- return "https://api.paypal.com";
- }
-}
+<?php
+
+namespace PayPalCheckoutSdk\Core;
+
+class ProductionEnvironment extends PayPalEnvironment
+{
+ public function __construct($clientId, $clientSecret)
+ {
+ parent::__construct($clientId, $clientSecret);
+ }
+
+ public function baseUrl()
+ {
+ return "https://api.paypal.com";
+ }
+}
diff --git a/vendor/paypal/paypal-checkout-sdk/lib/PayPalCheckoutSdk/Core/RefreshTokenRequest.php b/vendor/paypal/paypal-checkout-sdk/lib/PayPalCheckoutSdk/Core/RefreshTokenRequest.php
index c524ae9..d73458d 100644
--- a/vendor/paypal/paypal-checkout-sdk/lib/PayPalCheckoutSdk/Core/RefreshTokenRequest.php
+++ b/vendor/paypal/paypal-checkout-sdk/lib/PayPalCheckoutSdk/Core/RefreshTokenRequest.php
@@ -1,19 +1,19 @@
-<?php
-
-namespace PayPalCheckoutSdk\Core;
-
-use PayPalHttp\HttpRequest;
-
-class RefreshTokenRequest extends HttpRequest
-{
- public function __construct(PayPalEnvironment $environment, $authorizationCode)
- {
- parent::__construct("/v1/identity/openidconnect/tokenservice", "POST");
- $this->headers["Authorization"] = "Basic " . $environment->authorizationString();
- $this->headers["Content-Type"] = "application/x-www-form-urlencoded";
- $this->body = [
- "grant_type" => "authorization_code",
- "code" => $authorizationCode
- ];
- }
-}
+<?php
+
+namespace PayPalCheckoutSdk\Core;
+
+use PayPalHttp\HttpRequest;
+
+class RefreshTokenRequest extends HttpRequest
+{
+ public function __construct(PayPalEnvironment $environment, $authorizationCode)
+ {
+ parent::__construct("/v1/identity/openidconnect/tokenservice", "POST");
+ $this->headers["Authorization"] = "Basic " . $environment->authorizationString();
+ $this->headers["Content-Type"] = "application/x-www-form-urlencoded";
+ $this->body = [
+ "grant_type" => "authorization_code",
+ "code" => $authorizationCode
+ ];
+ }
+}
diff --git a/vendor/paypal/paypal-checkout-sdk/lib/PayPalCheckoutSdk/Core/SandboxEnvironment.php b/vendor/paypal/paypal-checkout-sdk/lib/PayPalCheckoutSdk/Core/SandboxEnvironment.php
index 92c1f7a..11fd346 100644
--- a/vendor/paypal/paypal-checkout-sdk/lib/PayPalCheckoutSdk/Core/SandboxEnvironment.php
+++ b/vendor/paypal/paypal-checkout-sdk/lib/PayPalCheckoutSdk/Core/SandboxEnvironment.php
@@ -1,16 +1,16 @@
-<?php
-
-namespace PayPalCheckoutSdk\Core;
-
-class SandboxEnvironment extends PayPalEnvironment
-{
- public function __construct($clientId, $clientSecret)
- {
- parent::__construct($clientId, $clientSecret);
- }
-
- public function baseUrl()
- {
- return "https://api.sandbox.paypal.com";
- }
-}
+<?php
+
+namespace PayPalCheckoutSdk\Core;
+
+class SandboxEnvironment extends PayPalEnvironment
+{
+ public function __construct($clientId, $clientSecret)
+ {
+ parent::__construct($clientId, $clientSecret);
+ }
+
+ public function baseUrl()
+ {
+ return "https://api.sandbox.paypal.com";
+ }
+}
diff --git a/vendor/paypal/paypal-checkout-sdk/lib/PayPalCheckoutSdk/Core/UserAgent.php b/vendor/paypal/paypal-checkout-sdk/lib/PayPalCheckoutSdk/Core/UserAgent.php
index 1d8d859..d99a00d 100644
--- a/vendor/paypal/paypal-checkout-sdk/lib/PayPalCheckoutSdk/Core/UserAgent.php
+++ b/vendor/paypal/paypal-checkout-sdk/lib/PayPalCheckoutSdk/Core/UserAgent.php
@@ -1,52 +1,52 @@
-<?php
-namespace PayPalCheckoutSdk\Core;
-
-/**
- * Class PayPalUserAgent
- * PayPalUserAgent generates User Agent for curl requests
- *
- * @package PayPal\Core
- */
-class UserAgent
-{
- /**
- * Returns the value of the User-Agent header
- * Add environment values and php version numbers
- *
- * @return string
- */
- public static function getValue()
- {
- $featureList = array(
- 'platform-ver=' . PHP_VERSION,
- 'bit=' . self::_getPHPBit(),
- 'os=' . str_replace(' ', '_', php_uname('s') . ' ' . php_uname('r')),
- 'machine=' . php_uname('m')
- );
- if (defined('OPENSSL_VERSION_TEXT')) {
- $opensslVersion = explode(' ', OPENSSL_VERSION_TEXT);
- $featureList[] = 'crypto-lib-ver=' . $opensslVersion[1];
- }
- if (function_exists('curl_version')) {
- $curlVersion = curl_version();
- $featureList[] = 'curl=' . $curlVersion['version'];
- }
- return sprintf("PayPalSDK/%s %s (%s)", "Checkout-PHP-SDK", Version::VERSION, implode('; ', $featureList));
- }
- /**
- * Gets PHP Bit version
- *
- * @return int|string
- */
- private static function _getPHPBit()
- {
- switch (PHP_INT_SIZE) {
- case 4:
- return '32';
- case 8:
- return '64';
- default:
- return PHP_INT_SIZE;
- }
- }
-}
+<?php
+namespace PayPalCheckoutSdk\Core;
+
+/**
+ * Class PayPalUserAgent
+ * PayPalUserAgent generates User Agent for curl requests
+ *
+ * @package PayPal\Core
+ */
+class UserAgent
+{
+ /**
+ * Returns the value of the User-Agent header
+ * Add environment values and php version numbers
+ *
+ * @return string
+ */
+ public static function getValue()
+ {
+ $featureList = array(
+ 'platform-ver=' . PHP_VERSION,
+ 'bit=' . self::_getPHPBit(),
+ 'os=' . str_replace(' ', '_', php_uname('s') . ' ' . php_uname('r')),
+ 'machine=' . php_uname('m')
+ );
+ if (defined('OPENSSL_VERSION_TEXT')) {
+ $opensslVersion = explode(' ', OPENSSL_VERSION_TEXT);
+ $featureList[] = 'crypto-lib-ver=' . $opensslVersion[1];
+ }
+ if (function_exists('curl_version')) {
+ $curlVersion = curl_version();
+ $featureList[] = 'curl=' . $curlVersion['version'];
+ }
+ return sprintf("PayPalSDK/%s %s (%s)", "Checkout-PHP-SDK", Version::VERSION, implode('; ', $featureList));
+ }
+ /**
+ * Gets PHP Bit version
+ *
+ * @return int|string
+ */
+ private static function _getPHPBit()
+ {
+ switch (PHP_INT_SIZE) {
+ case 4:
+ return '32';
+ case 8:
+ return '64';
+ default:
+ return PHP_INT_SIZE;
+ }
+ }
+}
diff --git a/vendor/paypal/paypal-checkout-sdk/lib/PayPalCheckoutSdk/Core/Version.php b/vendor/paypal/paypal-checkout-sdk/lib/PayPalCheckoutSdk/Core/Version.php
index e272868..dc65c3f 100644
--- a/vendor/paypal/paypal-checkout-sdk/lib/PayPalCheckoutSdk/Core/Version.php
+++ b/vendor/paypal/paypal-checkout-sdk/lib/PayPalCheckoutSdk/Core/Version.php
@@ -1,8 +1,8 @@
-<?php
-
-namespace PayPalCheckoutSdk\Core;
-
-class Version
-{
- const VERSION = "1.0.1";
-}
+<?php
+
+namespace PayPalCheckoutSdk\Core;
+
+class Version
+{
+ const VERSION = "1.0.2";
+}