Updated User Agent & More Samples for Billing Plans

- Fixed versioning in User Agent.
- Updated Billing Plan sample to update Payment definitions
- Docs & Tests
This commit is contained in:
japatel
2014-11-05 13:30:28 -06:00
parent d11533110b
commit f997f3277e
27 changed files with 611 additions and 439 deletions

View File

@@ -81,6 +81,6 @@ class PatchRequest extends PPModel
foreach ($this->getPatches() as $patch) {
$json[] = $patch->toArray();
}
return json_encode($json, $options);
return str_replace('\\/', '/', json_encode($json, $options));
}
}

View File

@@ -184,7 +184,7 @@ class OAuthTokenCredential extends ResourceModel
{
$base64ClientID = base64_encode($clientId . ":" . $clientSecret);
$headers = array(
"User-Agent" => PPUserAgent::getValue(RestHandler::$sdkName, RestHandler::$sdkVersion),
"User-Agent" => PPUserAgent::getValue(PPConstants::SDK_NAME, PPConstants::SDK_VERSION),
"Authorization" => "Basic " . $base64ClientID,
"Accept" => "*/*"
);

View File

@@ -12,7 +12,7 @@ class PPConstants
{
const SDK_NAME = 'PayPal-PHP-SDK';
const SDK_VERSION = '0.14.0';
const SDK_VERSION = '0.14.1';
const REST_SANDBOX_ENDPOINT = "https://api.sandbox.paypal.com/";
const OPENID_REDIRECT_SANDBOX_URL = "https://www.sandbox.paypal.com/webapps/auth/protocol/openidconnect";

View File

@@ -9,6 +9,7 @@ use PayPal\Auth\OAuthTokenCredential;
use PayPal\Common\PPUserAgent;
use PayPal\Core\PPConstants;
use PayPal\Core\PPCredentialManager;
use PayPal\Core\PPHttpConfig;
use PayPal\Exception\PPConfigurationException;
use PayPal\Exception\PPInvalidCredentialException;
use PayPal\Exception\PPMissingCredentialException;
@@ -26,20 +27,6 @@ class RestHandler implements IPPHandler
*/
private $apiContext;
/**
* Public Variable
*
* @var string $sdkName
*/
public static $sdkName = "rest-sdk-php";
/**
* Public Variable
*
* @var string $sdkVersion
*/
public static $sdkVersion = "0.13.2";
/**
* Construct
*
@@ -51,7 +38,7 @@ class RestHandler implements IPPHandler
}
/**
* @param \Paypal\Core\PPHttpConfig $httpConfig
* @param PPHttpConfig $httpConfig
* @param string $request
* @param mixed $options
* @return mixed|void
@@ -87,7 +74,7 @@ class RestHandler implements IPPHandler
);
if (!array_key_exists("User-Agent", $httpConfig->getHeaders())) {
$httpConfig->addHeader("User-Agent", PPUserAgent::getValue(self::$sdkName, self::$sdkVersion));
$httpConfig->addHeader("User-Agent", PPUserAgent::getValue(PPConstants::SDK_NAME, PPConstants::SDK_VERSION));
}
if (!is_null($credential) && $credential instanceof OAuthTokenCredential && is_null($httpConfig->getHeader('Authorization'))) {