Enabled Billing Plans and Agreements APIs

- Added API Classes, Samples, and Tests
- Updated Functional Tests
- Updated Documentation with new SDK Name
- Updated Few Samples to use newer nicer result page
This commit is contained in:
japatel
2014-10-31 10:16:13 -05:00
parent f55fd3d984
commit 4d481ad104
192 changed files with 13310 additions and 1045 deletions

View File

@@ -41,7 +41,9 @@ class PPConfigManager
$configFile = implode(DIRECTORY_SEPARATOR,
array(dirname(__FILE__), "..", "config", "sdk_config.ini"));
}
$this->addConfigFromIni($configFile);
if (file_exists($configFile)) {
$this->addConfigFromIni($configFile);
}
}
/**
@@ -65,7 +67,7 @@ class PPConfigManager
*/
public function addConfigFromIni($fileName)
{
if ($configs = @parse_ini_file($fileName)) {
if ($configs = parse_ini_file($fileName)) {
$this->addConfigs($configs);
}
return $this;

View File

@@ -11,8 +11,8 @@ namespace PayPal\Core;
class PPConstants
{
const SDK_NAME = 'rest-api-sdk-php';
const SDK_VERSION = '0.11.0';
const SDK_NAME = 'PayPal-PHP-SDK';
const SDK_VERSION = '0.14.0';
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

@@ -144,7 +144,7 @@ class PPCredentialManager
*/
public function getCredentialObject($userId = null)
{
if ($userId == null) {
if ($userId == null && array_key_exists($this->defaultAccountName, $this->credentialHashmap)) {
$credObj = $this->credentialHashmap[$this->defaultAccountName];
} else if (array_key_exists($userId, $this->credentialHashmap)) {
$credObj = $this->credentialHashmap[$userId];

View File

@@ -107,7 +107,7 @@ class PPHttpConnection
$this->logger->fine($header);
}
$this->logger->fine("Payload : " . $data . "\n");
$this->logger->fine(($data && $data != '' ? "Payload : " . $data : "No Request Payload") . "\n");
//Execute Curl Request
$result = curl_exec($ch);
@@ -144,6 +144,8 @@ class PPHttpConnection
}
//Close the curl request
curl_close($ch);
$this->logger->fine(($result && $result != '' ? "Response : " . $result : "No Response Body") . "\n\n");
//More Exceptions based on HttpStatus Code
if (in_array($httpStatus, self::$retryCodes)) {
$ex = new PPConnectionException(
@@ -151,7 +153,6 @@ class PPHttpConnection
"Got Http response code $httpStatus when accessing {$this->httpConfig->getUrl()}. " .
"Retried $retries times."
);
$this->logger->fine("Response : " . $result . "\n\n");
$ex->setData($result);
throw $ex;
} else if ($httpStatus < 200 || $httpStatus >= 300) {
@@ -160,12 +161,10 @@ class PPHttpConnection
"Got Http response code $httpStatus when accessing {$this->httpConfig->getUrl()}.",
$httpStatus
);
$this->logger->fine("Response : " . $result . "\n\n");
$ex->setData($result);
throw $ex;
}
$this->logger->fine("Response : " . $result . "\n\n");
//Return result object
return $result;