forked from LiveCarta/PayPal-PHP-SDK
Sample ResultPrinter Not to be Used
- Comment everywhere the ResultPrinter is used to not use outside sample
This commit is contained in:
@@ -52,10 +52,12 @@ try {
|
||||
// Use this call to create a profile.
|
||||
$createProfileResponse = $webProfile->create($apiContext);
|
||||
} catch (\PayPal\Exception\PayPalConnectionException $ex) {
|
||||
ResultPrinter::printError("Created Web Profile", "Web Profile", null, $request, $ex);
|
||||
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
|
||||
ResultPrinter::printError("Created Web Profile", "Web Profile", null, $request, $ex);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
ResultPrinter::printResult("Created Web Profile", "Web Profile", $createProfileResponse->getId(), $request, $createProfileResponse);
|
||||
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
|
||||
ResultPrinter::printResult("Created Web Profile", "Web Profile", $createProfileResponse->getId(), $request, $createProfileResponse);
|
||||
|
||||
return $createProfileResponse;
|
||||
|
||||
@@ -19,8 +19,10 @@ try {
|
||||
// Execute the delete method
|
||||
$webProfile->delete($apiContext);
|
||||
} catch (\PayPal\Exception\PayPalConnectionException $ex) {
|
||||
ResultPrinter::printError("Deleted Web Profile", "Web Profile", $createProfileResponse->getId(), null, $ex);
|
||||
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
|
||||
ResultPrinter::printError("Deleted Web Profile", "Web Profile", $createProfileResponse->getId(), null, $ex);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
ResultPrinter::printResult("Deleted Web Profile", "Web Profile", $createProfileResponse->getId(), null, null);
|
||||
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
|
||||
ResultPrinter::printResult("Deleted Web Profile", "Web Profile", $createProfileResponse->getId(), null, null);
|
||||
|
||||
@@ -15,10 +15,12 @@ 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 (\PayPal\Exception\PayPalConnectionException $ex) {
|
||||
ResultPrinter::printError("Get Web Profile", "Web Profile", $webProfile->getId(), null, $ex);
|
||||
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
|
||||
ResultPrinter::printError("Get Web Profile", "Web Profile", $webProfile->getId(), null, $ex);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
ResultPrinter::printResult("Get Web Profile", "Web Profile", $webProfile->getId(), null, $webProfile);
|
||||
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
|
||||
ResultPrinter::printResult("Get Web Profile", "Web Profile", $webProfile->getId(), null, $webProfile);
|
||||
|
||||
return $webProfile;
|
||||
|
||||
@@ -11,7 +11,8 @@ $apiContext = require __DIR__ . '/../bootstrap.php';
|
||||
try {
|
||||
$list = \PayPal\Api\WebProfile::get_list($apiContext);
|
||||
} catch (\PayPal\Exception\PayPalConnectionException $ex) {
|
||||
ResultPrinter::printError("Get List of All Web Profiles", "Web Profiles", null, null, $ex);
|
||||
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
|
||||
ResultPrinter::printError("Get List of All Web Profiles", "Web Profiles", null, null, $ex);
|
||||
exit(1);
|
||||
}
|
||||
$result = '';
|
||||
@@ -19,6 +20,7 @@ foreach ($list as $object) {
|
||||
$result .= $object->toJSON(128) . PHP_EOL;
|
||||
}
|
||||
|
||||
ResultPrinter::printResult("Get List of All Web Profiles", "Web Profiles", null, null, $result);
|
||||
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
|
||||
ResultPrinter::printResult("Get List of All Web Profiles", "Web Profiles", null, null, $result);
|
||||
|
||||
return $list;
|
||||
|
||||
@@ -37,8 +37,10 @@ try {
|
||||
$webProfile = \PayPal\Api\WebProfile::get($webProfile->getId(), $apiContext);
|
||||
}
|
||||
} catch (\Exception $ex) {
|
||||
ResultPrinter::printError("Partially Updated Web Profile", "Web Profile", $webProfile->getId(), $patches, $ex);
|
||||
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
|
||||
ResultPrinter::printError("Partially Updated Web Profile", "Web Profile", $webProfile->getId(), $patches, $ex);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
ResultPrinter::printResult("Partially Updated Web Profile", "Web Profile", $webProfile->getId(), $patches, $webProfile);
|
||||
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
|
||||
ResultPrinter::printResult("Partially Updated Web Profile", "Web Profile", $webProfile->getId(), $patches, $webProfile);
|
||||
|
||||
@@ -21,8 +21,10 @@ try {
|
||||
$updatedWebProfile = \PayPal\Api\WebProfile::get($webProfile->getId(), $apiContext);
|
||||
}
|
||||
} catch (\Exception $ex) {
|
||||
ResultPrinter::printError("Updated Web Profile", "Web Profile", $webProfile->getId(), $webProfile, $ex);
|
||||
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
|
||||
ResultPrinter::printError("Updated Web Profile", "Web Profile", $webProfile->getId(), $webProfile, $ex);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
ResultPrinter::printResult("Updated Web Profile", "Web Profile", $updatedWebProfile->getId(), $webProfile, $updatedWebProfile);
|
||||
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
|
||||
ResultPrinter::printResult("Updated Web Profile", "Web Profile", $updatedWebProfile->getId(), $webProfile, $updatedWebProfile);
|
||||
|
||||
Reference in New Issue
Block a user