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:
@@ -56,26 +56,31 @@ try {
|
||||
// ^ Ignore workflow code segment
|
||||
if ($ex instanceof \PayPal\Exception\PayPalConnectionException) {
|
||||
$data = $ex->getData();
|
||||
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
|
||||
ResultPrinter::printError("Created Webhook Failed. Checking if it is Webhook Number Limit Exceeded. Trying to delete all existing webhooks", "Webhook", "Please Use <a style='color: red;' href='DeleteAllWebhooks.php' >Delete All Webhooks</a> Sample to delete all existing webhooks in sample", $request, $ex);
|
||||
if (strpos($data,'WEBHOOK_NUMBER_LIMIT_EXCEEDED') !== false) {
|
||||
require 'DeleteAllWebhooks.php';
|
||||
try {
|
||||
$output = $webhook->create($apiContext);
|
||||
} catch (Exception $ex) {
|
||||
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
|
||||
ResultPrinter::printError("Created Webhook", "Webhook", null, $request, $ex);
|
||||
exit(1);
|
||||
}
|
||||
} else {
|
||||
ResultPrinter::printError("Created Webhook", "Webhook", null, $request, $ex);
|
||||
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
|
||||
ResultPrinter::printError("Created Webhook", "Webhook", null, $request, $ex);
|
||||
exit(1);
|
||||
}
|
||||
} else {
|
||||
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
|
||||
ResultPrinter::printError("Created Webhook", "Webhook", null, $request, $ex);
|
||||
exit(1);
|
||||
}
|
||||
// Print Success Result
|
||||
}
|
||||
|
||||
ResultPrinter::printResult("Created Webhook", "Webhook", $output->getId(), $request, $output);
|
||||
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
|
||||
ResultPrinter::printResult("Created Webhook", "Webhook", $output->getId(), $request, $output);
|
||||
|
||||
return $output;
|
||||
|
||||
@@ -15,10 +15,12 @@ try {
|
||||
$webhook->delete($apiContext);
|
||||
}
|
||||
} catch (Exception $ex) {
|
||||
ResultPrinter::printError("Deleted all Webhooks", "WebhookList", null, null, $ex);
|
||||
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
|
||||
ResultPrinter::printError("Deleted all Webhooks", "WebhookList", null, null, $ex);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
ResultPrinter::printResult("Delete all Webhook, as it may have exceed the maximum count.", "WebhookList", null, null, null);
|
||||
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
|
||||
ResultPrinter::printResult("Delete all Webhook, as it may have exceed the maximum count.", "WebhookList", null, null, null);
|
||||
|
||||
return $output;
|
||||
|
||||
@@ -16,10 +16,12 @@ $webhook = require 'CreateWebhook.php';
|
||||
try {
|
||||
$output = $webhook->delete($apiContext);
|
||||
} catch (Exception $ex) {
|
||||
ResultPrinter::printError("Delete a Webhook", "Webhook", null, $webhookId, $ex);
|
||||
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
|
||||
ResultPrinter::printError("Delete a Webhook", "Webhook", null, $webhookId, $ex);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
ResultPrinter::printResult("Delete a Webhook", "Webhook", $webhook->getId(), null, null);
|
||||
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
|
||||
ResultPrinter::printResult("Delete a Webhook", "Webhook", $webhook->getId(), null, null);
|
||||
|
||||
return $output;
|
||||
|
||||
@@ -17,10 +17,12 @@ $webhookId = $webhook->getId();
|
||||
try {
|
||||
$output = \PayPal\Api\Webhook::get($webhookId, $apiContext);
|
||||
} catch (Exception $ex) {
|
||||
ResultPrinter::printError("Get a Webhook", "Webhook", null, $webhookId, $ex);
|
||||
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
|
||||
ResultPrinter::printError("Get a Webhook", "Webhook", null, $webhookId, $ex);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
ResultPrinter::printResult("Get a Webhook", "Webhook", $output->getId(), null, $output);
|
||||
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
|
||||
ResultPrinter::printResult("Get a Webhook", "Webhook", $output->getId(), null, $output);
|
||||
|
||||
return $output;
|
||||
|
||||
@@ -17,10 +17,12 @@ $webhookId = $webhook->getId();
|
||||
try {
|
||||
$output = \PayPal\Api\WebhookEventType::subscribedEventTypes($webhookId, $apiContext);
|
||||
} catch (Exception $ex) {
|
||||
ResultPrinter::printError("List subscribed webhook event types", "WebhookEventTypeList", null, $webhookId, $ex);
|
||||
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
|
||||
ResultPrinter::printError("List subscribed webhook event types", "WebhookEventTypeList", null, $webhookId, $ex);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
ResultPrinter::printResult("List subscribed webhook event types", "WebhookEventTypeList",null, null, $output);
|
||||
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
|
||||
ResultPrinter::printResult("List subscribed webhook event types", "WebhookEventTypeList",null, null, $output);
|
||||
|
||||
return $output;
|
||||
|
||||
@@ -18,10 +18,12 @@ $webhook = require_once __DIR__ . '/../bootstrap.php';
|
||||
try {
|
||||
$output = \PayPal\Api\Webhook::getAll($apiContext);
|
||||
} catch (Exception $ex) {
|
||||
ResultPrinter::printError("List all webhooks", "WebhookList", null, $webhookId, $ex);
|
||||
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
|
||||
ResultPrinter::printError("List all webhooks", "WebhookList", null, $webhookId, $ex);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
ResultPrinter::printResult("List all webhooks", "WebhookList",null, null, $output);
|
||||
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
|
||||
ResultPrinter::printResult("List all webhooks", "WebhookList",null, null, $output);
|
||||
|
||||
return $output;
|
||||
|
||||
@@ -23,11 +23,13 @@ $params = array(
|
||||
try {
|
||||
$output = \PayPal\Api\WebhookEvent::all($params, $apiContext);
|
||||
} catch (Exception $ex) {
|
||||
ResultPrinter::printError("Search Webhook events", "WebhookEventList", null, null, $ex);
|
||||
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
|
||||
ResultPrinter::printError("Search Webhook events", "WebhookEventList", null, null, $ex);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
ResultPrinter::printResult("Search Webhook events", "WebhookEventList", null, $params, $output);
|
||||
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
|
||||
ResultPrinter::printResult("Search Webhook events", "WebhookEventList", null, $params, $output);
|
||||
|
||||
|
||||
return $output;
|
||||
|
||||
@@ -46,10 +46,12 @@ $patchRequest->addPatch($patch)->addPatch($patch2);
|
||||
try {
|
||||
$output = $webhook->update($patchRequest, $apiContext);
|
||||
} catch (Exception $ex) {
|
||||
ResultPrinter::printError("Updated a Webhook", "Webhook", null, $patchRequest, $ex);
|
||||
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
|
||||
ResultPrinter::printError("Updated a Webhook", "Webhook", null, $patchRequest, $ex);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
ResultPrinter::printResult("Updated a Webhook", "Webhook", $output->getId(), $patchRequest, $output);
|
||||
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
|
||||
ResultPrinter::printResult("Updated a Webhook", "Webhook", $output->getId(), $patchRequest, $output);
|
||||
|
||||
return $output;
|
||||
|
||||
@@ -12,10 +12,12 @@ $apiContext = require __DIR__ . '/../bootstrap.php';
|
||||
try {
|
||||
$output = \PayPal\Api\WebhookEventType::availableEventTypes($apiContext);
|
||||
} catch (Exception $ex) {
|
||||
ResultPrinter::printError("Get List of All Webhook Event Types", "WebhookEventTypeList", null, null, $ex);
|
||||
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
|
||||
ResultPrinter::printError("Get List of All Webhook Event Types", "WebhookEventTypeList", null, null, $ex);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
ResultPrinter::printResult("Get List of All Webhook Event Types", "WebhookEventTypeList", null, null, $output);
|
||||
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
|
||||
ResultPrinter::printResult("Get List of All Webhook Event Types", "WebhookEventTypeList", null, null, $output);
|
||||
|
||||
return $output;
|
||||
|
||||
Reference in New Issue
Block a user