Updates to Sample Code

- Updated UI Presentation on samples
- Fixed Bugs
This commit is contained in:
japatel
2014-11-02 17:06:58 -06:00
parent 4d481ad104
commit 3c02790138
97 changed files with 904 additions and 1249 deletions

View File

@@ -41,7 +41,9 @@ $webProfile->setName("YeowZa! T-Shirt Shop" . uniqid())
// Parameters for flow configuration.
->setFlowConfig($flowConfig)
// Parameters for style and presentation.
->setPresentation($presentation);
->setPresentation($presentation)
// Parameters for input field customization.
->setInputFields($inputFields);
// For Sample Purposes Only.
$request = clone $webProfile;
@@ -49,12 +51,8 @@ $request = clone $webProfile;
try {
// Use this call to create a profile.
$createProfileResponse = $webProfile->create($apiContext);
} catch (\Exception $ex) {
echo "Exception: " . $ex->getMessage() . PHP_EOL;
if (is_a($ex, '\PayPal\Exception\PPConnectionException')) {
/** @var $ex \PayPal\Exception\PPConnectionException */
var_dump($ex->getData());
}
} catch (\PayPal\Exception\PPConnectionException $ex) {
ResultPrinter::printError("Created Web Profile", "Web Profile", null, $request, $ex);
exit(1);
}

View File

@@ -18,12 +18,8 @@ $webProfile->setId($createProfileResponse->getId());
try {
// Execute the delete method
$webProfile->delete($apiContext);
} catch (\Exception $ex) {
echo "Exception: " . $ex->getMessage() . PHP_EOL;
if (is_a($ex, '\PayPal\Exception\PPConnectionException')) {
/** @var $ex \PayPal\Exception\PPConnectionException */
var_dump($ex->getData());
}
} catch (\PayPal\Exception\PPConnectionException $ex) {
ResultPrinter::printError("Deleted Web Profile", "Web Profile", $createProfileResponse->getId(), null, $ex);
exit(1);
}

View File

@@ -14,12 +14,8 @@ $createProfileResponse = require 'CreateWebProfile.php';
try {
// If your request is successful, the API returns a web_profile object response that contains the profile details.
$webProfile = \PayPal\Api\WebProfile::get($createProfileResponse->getId(), $apiContext);
} catch (\Exception $ex) {
echo "Exception: " . $ex->getMessage() . PHP_EOL;
if (is_a($ex, '\PayPal\Exception\PPConnectionException')) {
/** @var $ex \PayPal\Exception\PPConnectionException */
var_dump($ex->getData());
}
} catch (\PayPal\Exception\PPConnectionException $ex) {
ResultPrinter::printError("Get Web Profile", "Web Profile", $webProfile->getId(), null, $ex);
exit(1);
}

View File

@@ -10,12 +10,8 @@ $apiContext = require __DIR__ . '/../bootstrap.php';
// (See bootstrap.php for more on `ApiContext`)
try {
$list = \PayPal\Api\WebProfile::get_list($apiContext);
} catch (\Exception $ex) {
echo "Exception: " . $ex->getMessage() . PHP_EOL;
if (is_a($ex, '\PayPal\Exception\PPConnectionException')) {
/** @var $ex \PayPal\Exception\PPConnectionException */
var_dump($ex->getData());
}
} catch (\PayPal\Exception\PPConnectionException $ex) {
ResultPrinter::printError("Get List of All Web Profiles", "Web Profiles", null, null, $ex);
exit(1);
}
$result = '';

View File

@@ -37,11 +37,7 @@ try {
$webProfile = \PayPal\Api\WebProfile::get($webProfile->getId(), $apiContext);
}
} catch (\Exception $ex) {
echo "Exception: " . $ex->getMessage() . PHP_EOL;
if (is_a($ex, '\PayPal\Exception\PPConnectionException')) {
/** @var $ex \PayPal\Exception\PPConnectionException */
var_dump($ex->getData());
}
ResultPrinter::printError("Partially Updated Web Profile", "Web Profile", $webProfile->getId(), $patches, $ex);
exit(1);
}

View File

@@ -21,11 +21,7 @@ try {
$updatedWebProfile = \PayPal\Api\WebProfile::get($webProfile->getId(), $apiContext);
}
} catch (\Exception $ex) {
echo "Exception: " . $ex->getMessage() . PHP_EOL;
if (is_a($ex, '\PayPal\Exception\PPConnectionException')) {
/** @var $ex \PayPal\Exception\PPConnectionException */
var_dump($ex->getData());
}
ResultPrinter::printError("Updated Web Profile", "Web Profile", $webProfile->getId(), $webProfile, $ex);
exit(1);
}