[PSR] Fixed Tests

- Using `php-cs-fixer` tool.
This commit is contained in:
Jay Patel
2016-07-14 13:08:18 -05:00
parent 1401d5563d
commit cffa2463b1
88 changed files with 94 additions and 131 deletions

View File

@@ -99,7 +99,6 @@ $request = clone $agreement;
try { try {
// Please note that as the agreement has not yet activated, we wont be receiving the ID just yet. // Please note that as the agreement has not yet activated, we wont be receiving the ID just yet.
$agreement = $agreement->create($apiContext); $agreement = $agreement->create($apiContext);
} catch (Exception $ex) { } catch (Exception $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Created Billing Agreement.", "Agreement", $agreement->getId(), $request, $ex); ResultPrinter::printError("Created Billing Agreement.", "Agreement", $agreement->getId(), $request, $ex);

View File

@@ -74,7 +74,6 @@ try {
// the buyer to. Retrieve the url from the $agreement->getApprovalLink() // the buyer to. Retrieve the url from the $agreement->getApprovalLink()
// method // method
$approvalUrl = $agreement->getApprovalLink(); $approvalUrl = $agreement->getApprovalLink();
} catch (Exception $ex) { } catch (Exception $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Created Billing Agreement.", "Agreement", null, $request, $ex); ResultPrinter::printError("Created Billing Agreement.", "Agreement", null, $request, $ex);

View File

@@ -66,7 +66,7 @@ try {
$output = $plan->create($apiContext); $output = $plan->create($apiContext);
} catch (Exception $ex) { } catch (Exception $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Created Plan", "Plan", null, $request, $ex); ResultPrinter::printError("Created Plan", "Plan", null, $request, $ex);
exit(1); exit(1);
} }

View File

@@ -16,7 +16,7 @@ try {
$result = $createdPlan->delete($apiContext); $result = $createdPlan->delete($apiContext);
} catch (Exception $ex) { } catch (Exception $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Deleted a Plan", "Plan", $createdPlan->getId(), null, $ex); ResultPrinter::printError("Deleted a Plan", "Plan", $createdPlan->getId(), null, $ex);
exit(1); exit(1);
} }

View File

@@ -8,7 +8,6 @@ require __DIR__ . '/../bootstrap.php';
// ## Approval Status // ## Approval Status
// Determine if the user accepted or denied the request // Determine if the user accepted or denied the request
if (isset($_GET['success']) && $_GET['success'] == 'true') { if (isset($_GET['success']) && $_GET['success'] == 'true') {
$token = $_GET['token']; $token = $_GET['token'];
$agreement = new \PayPal\Api\Agreement(); $agreement = new \PayPal\Api\Agreement();
try { try {
@@ -17,7 +16,7 @@ if (isset($_GET['success']) && $_GET['success'] == 'true') {
$agreement->execute($token, $apiContext); $agreement->execute($token, $apiContext);
} catch (Exception $ex) { } catch (Exception $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Executed an Agreement", "Agreement", $agreement->getId(), $_GET['token'], $ex); ResultPrinter::printError("Executed an Agreement", "Agreement", $agreement->getId(), $_GET['token'], $ex);
exit(1); exit(1);
} }
@@ -30,13 +29,12 @@ if (isset($_GET['success']) && $_GET['success'] == 'true') {
$agreement = \PayPal\Api\Agreement::get($agreement->getId(), $apiContext); $agreement = \PayPal\Api\Agreement::get($agreement->getId(), $apiContext);
} catch (Exception $ex) { } catch (Exception $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Get Agreement", "Agreement", null, null, $ex); ResultPrinter::printError("Get Agreement", "Agreement", null, null, $ex);
exit(1); exit(1);
} }
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printResult("Get Agreement", "Agreement", $agreement->getId(), null, $agreement); ResultPrinter::printResult("Get Agreement", "Agreement", $agreement->getId(), null, $agreement);
} else { } else {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printResult("User Cancelled the Approval", null); ResultPrinter::printResult("User Cancelled the Approval", null);

View File

@@ -16,7 +16,7 @@ try {
$agreement = Agreement::get($createdAgreement->getId(), $apiContext); $agreement = Agreement::get($createdAgreement->getId(), $apiContext);
} catch (Exception $ex) { } catch (Exception $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Retrieved an Agreement", "Agreement", $agreement->getId(), $createdAgreement->getId(), $ex); ResultPrinter::printError("Retrieved an Agreement", "Agreement", $agreement->getId(), $createdAgreement->getId(), $ex);
exit(1); exit(1);
} }

View File

@@ -16,7 +16,7 @@ try {
$plan = Plan::get($createdPlan->getId(), $apiContext); $plan = Plan::get($createdPlan->getId(), $apiContext);
} catch (Exception $ex) { } catch (Exception $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Retrieved a Plan", "Plan", $plan->getId(), null, $ex); ResultPrinter::printError("Retrieved a Plan", "Plan", $plan->getId(), null, $ex);
exit(1); exit(1);
} }

View File

@@ -21,7 +21,7 @@ try {
$planList = Plan::all($params, $apiContext); $planList = Plan::all($params, $apiContext);
} catch (Exception $ex) { } catch (Exception $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("List of Plans", "Plan", null, $params, $ex); ResultPrinter::printError("List of Plans", "Plan", null, $params, $ex);
exit(1); exit(1);
} }

View File

@@ -18,12 +18,10 @@ $agreementStateDescriptor = new AgreementStateDescriptor();
$agreementStateDescriptor->setNote("Reactivating the agreement"); $agreementStateDescriptor->setNote("Reactivating the agreement");
try { try {
$suspendedAgreement->reActivate($agreementStateDescriptor, $apiContext); $suspendedAgreement->reActivate($agreementStateDescriptor, $apiContext);
// Lets get the updated Agreement Object // Lets get the updated Agreement Object
$agreement = Agreement::get($suspendedAgreement->getId(), $apiContext); $agreement = Agreement::get($suspendedAgreement->getId(), $apiContext);
} catch (Exception $ex) { } catch (Exception $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printResult("Reactivate the Agreement", "Agreement", $agreement->getId(), $suspendedAgreement, $ex); ResultPrinter::printResult("Reactivate the Agreement", "Agreement", $agreement->getId(), $suspendedAgreement, $ex);

View File

@@ -22,7 +22,7 @@ try {
$result = Agreement::searchTransactions($agreementId, $params, $apiContext); $result = Agreement::searchTransactions($agreementId, $params, $apiContext);
} catch (Exception $ex) { } catch (Exception $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Search for Transactions", "AgreementTransaction", $agreementId, null, $ex); ResultPrinter::printError("Search for Transactions", "AgreementTransaction", $agreementId, null, $ex);
exit(1); exit(1);
} }

View File

@@ -18,15 +18,13 @@ $agreementStateDescriptor = new AgreementStateDescriptor();
$agreementStateDescriptor->setNote("Suspending the agreement"); $agreementStateDescriptor->setNote("Suspending the agreement");
try { try {
$createdAgreement->suspend($agreementStateDescriptor, $apiContext); $createdAgreement->suspend($agreementStateDescriptor, $apiContext);
// Lets get the updated Agreement Object // Lets get the updated Agreement Object
$agreement = Agreement::get($createdAgreement->getId(), $apiContext); $agreement = Agreement::get($createdAgreement->getId(), $apiContext);
} catch (Exception $ex) { } catch (Exception $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Suspended the Agreement", "Agreement", null, $agreementStateDescriptor, $ex); ResultPrinter::printError("Suspended the Agreement", "Agreement", null, $agreementStateDescriptor, $ex);
exit(1); exit(1);
} }

View File

@@ -35,10 +35,9 @@ try {
// Lets get the updated Agreement Object // Lets get the updated Agreement Object
$agreement = Agreement::get($createdAgreement->getId(), $apiContext); $agreement = Agreement::get($createdAgreement->getId(), $apiContext);
} catch (Exception $ex) { } catch (Exception $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Updated the Agreement with new Description and Updated Shipping Address", "Agreement", null, $patchRequest, $ex); ResultPrinter::printError("Updated the Agreement with new Description and Updated Shipping Address", "Agreement", null, $patchRequest, $ex);
exit(1); exit(1);
} }

View File

@@ -34,10 +34,9 @@ try {
$createdPlan->update($patchRequest, $apiContext); $createdPlan->update($patchRequest, $apiContext);
$plan = Plan::get($createdPlan->getId(), $apiContext); $plan = Plan::get($createdPlan->getId(), $apiContext);
} catch (Exception $ex) { } catch (Exception $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Updated the Plan to Active State", "Plan", null, $patchRequest, $ex); ResultPrinter::printError("Updated the Plan to Active State", "Plan", null, $patchRequest, $ex);
exit(1); exit(1);
} }

View File

@@ -40,10 +40,9 @@ try {
$createdPlan->update($patchRequest, $apiContext); $createdPlan->update($patchRequest, $apiContext);
$plan = Plan::get($createdPlan->getId(), $apiContext); $plan = Plan::get($createdPlan->getId(), $apiContext);
} catch (Exception $ex) { } catch (Exception $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Updated the Plan Payment Definition", "Plan", null, $patchRequest, $ex); ResultPrinter::printError("Updated the Plan Payment Definition", "Plan", null, $patchRequest, $ex);
exit(1); exit(1);
} }

View File

@@ -1,7 +1,7 @@
<?php <?php
/* /*
Common functions used across samples Common functions used across samples
*/ */
/** /**
@@ -41,7 +41,6 @@ class ResultPrinter
self::printConsoleObject($response, $errorMessage); self::printConsoleObject($response, $errorMessage);
printf("\n-------------------------------------------------------------\n\n"); printf("\n-------------------------------------------------------------\n\n");
} else { } else {
if (self::$printResultCounter == 0) { if (self::$printResultCounter == 0) {
include "header.html"; include "header.html";
echo ' echo '

View File

@@ -33,7 +33,7 @@ try {
$cancelStatus = $invoice->cancel($notify, $apiContext); $cancelStatus = $invoice->cancel($notify, $apiContext);
} catch (Exception $ex) { } catch (Exception $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Cancel Invoice", "Invoice", null, $notify, $ex); ResultPrinter::printError("Cancel Invoice", "Invoice", null, $notify, $ex);
exit(1); exit(1);
} }

View File

@@ -155,7 +155,7 @@ try {
$invoice->create($apiContext); $invoice->create($apiContext);
} catch (Exception $ex) { } catch (Exception $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Create Invoice", "Invoice", null, $request, $ex); ResultPrinter::printError("Create Invoice", "Invoice", null, $request, $ex);
exit(1); exit(1);
} }

View File

@@ -98,7 +98,7 @@ try {
$invoice->create($apiContext); $invoice->create($apiContext);
} catch (Exception $ex) { } catch (Exception $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Create Invoice", "Invoice", null, $request, $ex); ResultPrinter::printError("Create Invoice", "Invoice", null, $request, $ex);
exit(1); exit(1);
} }

View File

@@ -20,7 +20,7 @@ try {
$deleteStatus = $invoice->delete($apiContext); $deleteStatus = $invoice->delete($apiContext);
} catch (Exception $ex) { } catch (Exception $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Delete Invoice", "Invoice", null, $deleteStatus, $ex); ResultPrinter::printError("Delete Invoice", "Invoice", null, $deleteStatus, $ex);
exit(1); exit(1);
} }

View File

@@ -20,7 +20,7 @@ try {
$invoice = Invoice::get($invoiceId, $apiContext); $invoice = Invoice::get($invoiceId, $apiContext);
} catch (Exception $ex) { } catch (Exception $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Get Invoice", "Invoice", $invoice->getId(), $invoiceId, $ex); ResultPrinter::printError("Get Invoice", "Invoice", $invoice->getId(), $invoiceId, $ex);
exit(1); exit(1);
} }

View File

@@ -14,7 +14,7 @@ try {
$number = Invoice::generateNumber($apiContext); $number = Invoice::generateNumber($apiContext);
} catch (Exception $ex) { } catch (Exception $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Get Next Invoice Number", "InvoiceNumber", null, null, $ex); ResultPrinter::printError("Get Next Invoice Number", "InvoiceNumber", null, null, $ex);
exit(1); exit(1);
} }

View File

@@ -17,7 +17,7 @@ try {
$invoices = Invoice::getAll(array('page' => 0, 'page_size' => 4, 'total_count_required' => "true"), $apiContext); $invoices = Invoice::getAll(array('page' => 0, 'page_size' => 4, 'total_count_required' => "true"), $apiContext);
} catch (Exception $ex) { } catch (Exception $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Lookup Invoice History", "Invoice", null, null, $ex); ResultPrinter::printError("Lookup Invoice History", "Invoice", null, null, $ex);
exit(1); exit(1);
} }
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY

View File

@@ -31,7 +31,7 @@ try {
$recordStatus = $invoice->recordPayment($record, $apiContext); $recordStatus = $invoice->recordPayment($record, $apiContext);
} catch (Exception $ex) { } catch (Exception $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Payment for Invoice", "Invoice", null, null, $ex); ResultPrinter::printError("Payment for Invoice", "Invoice", null, null, $ex);
exit(1); exit(1);
} }
@@ -48,7 +48,7 @@ try {
$invoice = Invoice::get($invoice->getId(), $apiContext); $invoice = Invoice::get($invoice->getId(), $apiContext);
} catch (Exception $ex) { } catch (Exception $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Get Invoice (Not Required - For Sample Only)", "Invoice", $invoice->getId(), $invoice->getId(), $ex); ResultPrinter::printError("Get Invoice (Not Required - For Sample Only)", "Invoice", $invoice->getId(), $invoice->getId(), $ex);
exit(1); exit(1);
} }

View File

@@ -30,7 +30,7 @@ try {
$refundStatus = $invoice->recordRefund($refund, $apiContext); $refundStatus = $invoice->recordRefund($refund, $apiContext);
} catch (Exception $ex) { } catch (Exception $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Refund for Invoice", "Invoice", null, null, $ex); ResultPrinter::printError("Refund for Invoice", "Invoice", null, null, $ex);
exit(1); exit(1);
} }
@@ -47,7 +47,7 @@ try {
$invoice = Invoice::get($invoice->getId(), $apiContext); $invoice = Invoice::get($invoice->getId(), $apiContext);
} catch (Exception $ex) { } catch (Exception $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Get Invoice (Not Required - For Sample Only)", "Invoice", $invoice->getId(), $invoice->getId(), $ex); ResultPrinter::printError("Get Invoice (Not Required - For Sample Only)", "Invoice", $invoice->getId(), $invoice->getId(), $ex);
exit(1); exit(1);
} }

View File

@@ -31,7 +31,7 @@ try {
$remindStatus = $invoice->remind($notify, $apiContext); $remindStatus = $invoice->remind($notify, $apiContext);
} catch (Exception $ex) { } catch (Exception $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Remind Invoice", "Invoice", null, $notify, $ex); ResultPrinter::printError("Remind Invoice", "Invoice", null, $notify, $ex);
exit(1); exit(1);
} }
@@ -48,7 +48,7 @@ try {
$invoice = Invoice::get($invoice->getId(), $apiContext); $invoice = Invoice::get($invoice->getId(), $apiContext);
} catch (Exception $ex) { } catch (Exception $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Get Invoice (Not Required - For Sample Only)", "Invoice", $invoice->getId(), $invoice->getId(), $ex); ResultPrinter::printError("Get Invoice (Not Required - For Sample Only)", "Invoice", $invoice->getId(), $invoice->getId(), $ex);
exit(1); exit(1);
} }

View File

@@ -23,11 +23,9 @@ try {
// 'saveToFile' method with proper file name. // 'saveToFile' method with proper file name.
// This will save the image as /samples/invoice/images/sample.png // This will save the image as /samples/invoice/images/sample.png
$path = $image->saveToFile("images/sample.png"); $path = $image->saveToFile("images/sample.png");
} catch (Exception $ex) { } catch (Exception $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Retrieved QR Code for Invoice", "Invoice", $invoice->getId(), null, $ex); ResultPrinter::printError("Retrieved QR Code for Invoice", "Invoice", $invoice->getId(), null, $ex);
exit(1); exit(1);
} }
@@ -39,4 +37,3 @@ try {
// One of the ways, you could directly inject the base64-encoded string // One of the ways, you could directly inject the base64-encoded string
// with proper image information in front of it. // with proper image information in front of it.
echo '<img src="data:image/png;base64,'. $image->getImage() . '" alt="Invoice QR Code" />'; echo '<img src="data:image/png;base64,'. $image->getImage() . '" alt="Invoice QR Code" />';

View File

@@ -31,7 +31,7 @@ try {
$invoices = Invoice::search($search, $apiContext); $invoices = Invoice::search($search, $apiContext);
} catch (Exception $ex) { } catch (Exception $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Search Invoice", "Invoice", null, null, $ex); ResultPrinter::printError("Search Invoice", "Invoice", null, null, $ex);
exit(1); exit(1);
} }
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY

View File

@@ -34,7 +34,7 @@ try {
$invoice = Invoice::get($invoice->getId(), $apiContext); $invoice = Invoice::get($invoice->getId(), $apiContext);
} catch (Exception $ex) { } catch (Exception $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Get Invoice (Not Required - For Sample Only)", "Invoice", $invoice->getId(), $invoice->getId(), $ex); ResultPrinter::printError("Get Invoice (Not Required - For Sample Only)", "Invoice", $invoice->getId(), $invoice->getId(), $ex);
exit(1); exit(1);
} }

View File

@@ -30,7 +30,7 @@ try {
$invoice->update($apiContext); $invoice->update($apiContext);
} catch (Exception $ex) { } catch (Exception $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Invoice Updated", "Invoice", null, $request, $ex); ResultPrinter::printError("Invoice Updated", "Invoice", null, $request, $ex);
exit(1); exit(1);
} }
@@ -47,7 +47,7 @@ try {
$invoice = Invoice::get($invoice->getId(), $apiContext); $invoice = Invoice::get($invoice->getId(), $apiContext);
} catch (Exception $ex) { } catch (Exception $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Get Invoice (Not Required - For Sample Only)", "Invoice", $invoice->getId(), $invoice->getId(), $ex); ResultPrinter::printError("Get Invoice (Not Required - For Sample Only)", "Invoice", $invoice->getId(), $invoice->getId(), $ex);
exit(1); exit(1);
} }

View File

@@ -9,13 +9,11 @@ use PayPal\Api\OpenIdTokeninfo;
$refreshToken = 'yzX4AkmMyBKR4on7vB5he-tDu38s24Zy-kTibhSuqA8kTdy0Yinxj7NpAyULx0bxqC5G8dbXOt0aVMlMmtpiVmSzhcjVZhYDM7WUQLC9KpaXGBHyltJPkLLQkXE'; $refreshToken = 'yzX4AkmMyBKR4on7vB5he-tDu38s24Zy-kTibhSuqA8kTdy0Yinxj7NpAyULx0bxqC5G8dbXOt0aVMlMmtpiVmSzhcjVZhYDM7WUQLC9KpaXGBHyltJPkLLQkXE';
try { try {
$tokenInfo = new OpenIdTokeninfo(); $tokenInfo = new OpenIdTokeninfo();
$tokenInfo = $tokenInfo->createFromRefreshToken(array('refresh_token' => $refreshToken), $apiContext); $tokenInfo = $tokenInfo->createFromRefreshToken(array('refresh_token' => $refreshToken), $apiContext);
} catch (Exception $ex) { } catch (Exception $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Obtained Access Token From Refresh Token", "Access Token", null, null, $ex); ResultPrinter::printError("Obtained Access Token From Refresh Token", "Access Token", null, null, $ex);
exit(1); exit(1);
} }

View File

@@ -21,16 +21,14 @@ use PayPal\Api\OpenIdUserinfo;
$refreshToken = 'W1JmxG-Cogm-4aSc5Vlen37XaQTj74aQcQiTtXax5UgY7M_AJ--kLX8xNVk8LtCpmueFfcYlRK6UgQLJ-XHsxpw6kZzPpKKccRQeC4z2ldTMfXdIWajZ6CHuebs'; $refreshToken = 'W1JmxG-Cogm-4aSc5Vlen37XaQTj74aQcQiTtXax5UgY7M_AJ--kLX8xNVk8LtCpmueFfcYlRK6UgQLJ-XHsxpw6kZzPpKKccRQeC4z2ldTMfXdIWajZ6CHuebs';
try { try {
$tokenInfo = new OpenIdTokeninfo(); $tokenInfo = new OpenIdTokeninfo();
$tokenInfo = $tokenInfo->createFromRefreshToken(array('refresh_token' => $refreshToken), $apiContext); $tokenInfo = $tokenInfo->createFromRefreshToken(array('refresh_token' => $refreshToken), $apiContext);
$params = array('access_token' => $tokenInfo->getAccessToken()); $params = array('access_token' => $tokenInfo->getAccessToken());
$userInfo = OpenIdUserinfo::getUserinfo($params, $apiContext); $userInfo = OpenIdUserinfo::getUserinfo($params, $apiContext);
} catch (Exception $ex) { } catch (Exception $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("User Information", "User Info", null, $params, $ex); ResultPrinter::printError("User Information", "User Info", null, $params, $ex);
exit(1); exit(1);
} }

View File

@@ -11,7 +11,6 @@ session_start();
// PayPal would redirect the user to the redirect_uri mentioned when creating the consent URL. // PayPal would redirect the user to the redirect_uri mentioned when creating the consent URL.
// The user would then able to retrieve the access token by getting the code, which is returned as a GET parameter. // The user would then able to retrieve the access token by getting the code, which is returned as a GET parameter.
if (isset($_GET['success']) && $_GET['success'] == 'true') { if (isset($_GET['success']) && $_GET['success'] == 'true') {
$code = $_GET['code']; $code = $_GET['code'];
try { try {
@@ -19,11 +18,10 @@ if (isset($_GET['success']) && $_GET['success'] == 'true') {
$accessToken = OpenIdTokeninfo::createFromAuthorizationCode(array('code' => $code), null, null, $apiContext); $accessToken = OpenIdTokeninfo::createFromAuthorizationCode(array('code' => $code), null, null, $apiContext);
} catch (PayPalConnectionException $ex) { } catch (PayPalConnectionException $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Obtained Access Token", "Access Token", null, $_GET['code'], $ex); ResultPrinter::printError("Obtained Access Token", "Access Token", null, $_GET['code'], $ex);
exit(1); exit(1);
} }
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printResult("Obtained Access Token", "Access Token", $accessToken->getAccessToken(), $_GET['code'], $accessToken); ResultPrinter::printResult("Obtained Access Token", "Access Token", $accessToken->getAccessToken(), $_GET['code'], $accessToken);
} }

View File

@@ -58,7 +58,7 @@ try {
$data = $ex->getData(); $data = $ex->getData();
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // 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); 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) { if (strpos($data, 'WEBHOOK_NUMBER_LIMIT_EXCEEDED') !== false) {
require 'DeleteAllWebhooks.php'; require 'DeleteAllWebhooks.php';
try { try {
$output = $webhook->create($apiContext); $output = $webhook->create($apiContext);
@@ -69,7 +69,7 @@ try {
} }
} else { } else {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Created Webhook", "Webhook", null, $request, $ex); ResultPrinter::printError("Created Webhook", "Webhook", null, $request, $ex);
exit(1); exit(1);
} }
} else { } else {

View File

@@ -16,7 +16,7 @@ try {
} }
} catch (Exception $ex) { } catch (Exception $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Deleted all Webhooks", "WebhookList", null, null, $ex); ResultPrinter::printError("Deleted all Webhooks", "WebhookList", null, null, $ex);
exit(1); exit(1);
} }

View File

@@ -17,7 +17,7 @@ try {
$output = $webhook->delete($apiContext); $output = $webhook->delete($apiContext);
} catch (Exception $ex) { } catch (Exception $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Delete a Webhook", "Webhook", null, $webhookId, $ex); ResultPrinter::printError("Delete a Webhook", "Webhook", null, $webhookId, $ex);
exit(1); exit(1);
} }

View File

@@ -18,7 +18,7 @@ try {
$output = \PayPal\Api\Webhook::get($webhookId, $apiContext); $output = \PayPal\Api\Webhook::get($webhookId, $apiContext);
} catch (Exception $ex) { } catch (Exception $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Get a Webhook", "Webhook", null, $webhookId, $ex); ResultPrinter::printError("Get a Webhook", "Webhook", null, $webhookId, $ex);
exit(1); exit(1);
} }

View File

@@ -18,11 +18,11 @@ try {
$output = \PayPal\Api\WebhookEventType::subscribedEventTypes($webhookId, $apiContext); $output = \PayPal\Api\WebhookEventType::subscribedEventTypes($webhookId, $apiContext);
} catch (Exception $ex) { } catch (Exception $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // 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); ResultPrinter::printError("List subscribed webhook event types", "WebhookEventTypeList", null, $webhookId, $ex);
exit(1); exit(1);
} }
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // 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); ResultPrinter::printResult("List subscribed webhook event types", "WebhookEventTypeList", null, null, $output);
return $output; return $output;

View File

@@ -19,11 +19,11 @@ try {
$output = \PayPal\Api\Webhook::getAll($apiContext); $output = \PayPal\Api\Webhook::getAll($apiContext);
} catch (Exception $ex) { } catch (Exception $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("List all webhooks", "WebhookList", null, $webhookId, $ex); ResultPrinter::printError("List all webhooks", "WebhookList", null, $webhookId, $ex);
exit(1); exit(1);
} }
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printResult("List all webhooks", "WebhookList",null, null, $output); ResultPrinter::printResult("List all webhooks", "WebhookList", null, null, $output);
return $output; return $output;

View File

@@ -23,7 +23,7 @@ try {
$output = \PayPal\Api\WebhookEvent::all($params, $apiContext); $output = \PayPal\Api\WebhookEvent::all($params, $apiContext);
} catch (Exception $ex) { } catch (Exception $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Search Webhook events", "WebhookEventList", null, null, $ex); ResultPrinter::printError("Search Webhook events", "WebhookEventList", null, null, $ex);
exit(1); exit(1);
} }

View File

@@ -47,7 +47,7 @@ try {
$output = $webhook->update($patchRequest, $apiContext); $output = $webhook->update($patchRequest, $apiContext);
} catch (Exception $ex) { } catch (Exception $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Updated a Webhook", "Webhook", null, $patchRequest, $ex); ResultPrinter::printError("Updated a Webhook", "Webhook", null, $patchRequest, $ex);
exit(1); exit(1);
} }

View File

@@ -32,5 +32,3 @@ try {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printResult("Validate Received Webhook Event", "WebhookEvent", $output->getId(), $bodyReceived, $output); ResultPrinter::printResult("Validate Received Webhook Event", "WebhookEvent", $output->getId(), $bodyReceived, $output);

View File

@@ -13,7 +13,7 @@ try {
$output = \PayPal\Api\WebhookEventType::availableEventTypes($apiContext); $output = \PayPal\Api\WebhookEventType::availableEventTypes($apiContext);
} catch (Exception $ex) { } catch (Exception $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // 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); ResultPrinter::printError("Get List of All Webhook Event Types", "WebhookEventTypeList", null, null, $ex);
exit(1); exit(1);
} }

View File

@@ -53,7 +53,7 @@ try {
$createProfileResponse = $webProfile->create($apiContext); $createProfileResponse = $webProfile->create($apiContext);
} catch (\PayPal\Exception\PayPalConnectionException $ex) { } catch (\PayPal\Exception\PayPalConnectionException $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Created Web Profile", "Web Profile", null, $request, $ex); ResultPrinter::printError("Created Web Profile", "Web Profile", null, $request, $ex);
exit(1); exit(1);
} }

View File

@@ -20,7 +20,7 @@ try {
$webProfile->delete($apiContext); $webProfile->delete($apiContext);
} catch (\PayPal\Exception\PayPalConnectionException $ex) { } catch (\PayPal\Exception\PayPalConnectionException $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // 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); ResultPrinter::printError("Deleted Web Profile", "Web Profile", $createProfileResponse->getId(), null, $ex);
exit(1); exit(1);
} }

View File

@@ -16,7 +16,7 @@ try {
$webProfile = \PayPal\Api\WebProfile::get($createProfileResponse->getId(), $apiContext); $webProfile = \PayPal\Api\WebProfile::get($createProfileResponse->getId(), $apiContext);
} catch (\PayPal\Exception\PayPalConnectionException $ex) { } catch (\PayPal\Exception\PayPalConnectionException $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // 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); ResultPrinter::printError("Get Web Profile", "Web Profile", $webProfile->getId(), null, $ex);
exit(1); exit(1);
} }

View File

@@ -12,7 +12,7 @@ try {
$list = \PayPal\Api\WebProfile::get_list($apiContext); $list = \PayPal\Api\WebProfile::get_list($apiContext);
} catch (\PayPal\Exception\PayPalConnectionException $ex) { } catch (\PayPal\Exception\PayPalConnectionException $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // 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); ResultPrinter::printError("Get List of All Web Profiles", "Web Profiles", null, null, $ex);
exit(1); exit(1);
} }
$result = ''; $result = '';

View File

@@ -38,7 +38,7 @@ try {
} }
} catch (\Exception $ex) { } catch (\Exception $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // 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); ResultPrinter::printError("Partially Updated Web Profile", "Web Profile", $webProfile->getId(), $patches, $ex);
exit(1); exit(1);
} }

View File

@@ -22,7 +22,7 @@ try {
} }
} catch (\Exception $ex) { } catch (\Exception $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // 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); ResultPrinter::printError("Updated Web Profile", "Web Profile", $webProfile->getId(), $webProfile, $ex);
exit(1); exit(1);
} }

View File

@@ -11,7 +11,6 @@ use PayPal\Api\Amount;
use PayPal\Api\Authorization; use PayPal\Api\Authorization;
use PayPal\Api\Capture; use PayPal\Api\Capture;
// ### Capture Payment // ### Capture Payment
// You can capture and process a previously created authorization // You can capture and process a previously created authorization
// by invoking the $authorization->capture method // by invoking the $authorization->capture method
@@ -31,7 +30,7 @@ try {
$getCapture = $authorization->capture($capture, $apiContext); $getCapture = $authorization->capture($capture, $apiContext);
} catch (Exception $ex) { } catch (Exception $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Capture Payment", "Authorization", null, $capture, $ex); ResultPrinter::printError("Capture Payment", "Authorization", null, $capture, $ex);
exit(1); exit(1);
} }

View File

@@ -69,7 +69,7 @@ try {
$payment->create($apiContext); $payment->create($apiContext);
} catch (Exception $ex) { } catch (Exception $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError('Authorize a Payment', 'Authorized Payment', $payment->getId(), $request, $ex); ResultPrinter::printError('Authorize a Payment', 'Authorized Payment', $payment->getId(), $request, $ex);
exit(1); exit(1);
} }

View File

@@ -101,7 +101,7 @@ try {
$payment->create($apiContext); $payment->create($apiContext);
} catch (Exception $ex) { } catch (Exception $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Created Payment Authorization Using PayPal. Please visit the URL to Authorize.", "Payment", null, $request, $ex); ResultPrinter::printError("Created Payment Authorization Using PayPal. Please visit the URL to Authorize.", "Payment", null, $request, $ex);
exit(1); exit(1);
} }

View File

@@ -84,10 +84,9 @@ try {
// for payment approval // for payment approval
// Please note that currently future payments works only with PayPal as a funding instrument. // Please note that currently future payments works only with PayPal as a funding instrument.
$payment->create($apiContext, $clientMetadataId); $payment->create($apiContext, $clientMetadataId);
} catch (Exception $ex) { } catch (Exception $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Future Payment", "Payment", null, $payment, $ex); ResultPrinter::printError("Future Payment", "Payment", null, $payment, $ex);
exit(1); exit(1);
} }

View File

@@ -114,7 +114,7 @@ try {
$payment->create($apiContext); $payment->create($apiContext);
} catch (Exception $ex) { } catch (Exception $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError('Create Payment Using Credit Card. If 500 Exception, try creating a new Credit Card using <a href="https://ppmts.custhelp.com/app/answers/detail/a_id/750">Step 4, on this link</a>, and using it.', 'Payment', null, $request, $ex); ResultPrinter::printError('Create Payment Using Credit Card. If 500 Exception, try creating a new Credit Card using <a href="https://ppmts.custhelp.com/app/answers/detail/a_id/750">Step 4, on this link</a>, and using it.', 'Payment', null, $request, $ex);
exit(1); exit(1);
} }

View File

@@ -101,7 +101,7 @@ try {
$payment->create($apiContext); $payment->create($apiContext);
} catch (Exception $ex) { } catch (Exception $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Created Payment Using PayPal. Please visit the URL to Approve.", "Payment", null, $request, $ex); ResultPrinter::printError("Created Payment Using PayPal. Please visit the URL to Approve.", "Payment", null, $request, $ex);
exit(1); exit(1);
} }

View File

@@ -105,7 +105,7 @@ try {
$payment->create($apiContext); $payment->create($apiContext);
} catch (Exception $ex) { } catch (Exception $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Create Payment using Saved Card", "Payment", null, $request, $ex); ResultPrinter::printError("Create Payment using Saved Card", "Payment", null, $request, $ex);
exit(1); exit(1);
} }

View File

@@ -69,12 +69,12 @@ if (isset($_GET['success']) && $_GET['success'] == 'true') {
$payment = Payment::get($paymentId, $apiContext); $payment = Payment::get($paymentId, $apiContext);
} catch (Exception $ex) { } catch (Exception $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Get Payment", "Payment", null, null, $ex); ResultPrinter::printError("Get Payment", "Payment", null, null, $ex);
exit(1); exit(1);
} }
} catch (Exception $ex) { } catch (Exception $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Executed Payment", "Payment", null, null, $ex); ResultPrinter::printError("Executed Payment", "Payment", null, null, $ex);
exit(1); exit(1);
} }
@@ -82,8 +82,6 @@ if (isset($_GET['success']) && $_GET['success'] == 'true') {
ResultPrinter::printResult("Get Payment", "Payment", $payment->getId(), null, $payment); ResultPrinter::printResult("Get Payment", "Payment", $payment->getId(), null, $payment);
return $payment; return $payment;
} else { } else {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printResult("User Cancelled the Approval", null); ResultPrinter::printResult("User Cancelled the Approval", null);

View File

@@ -20,7 +20,7 @@ try {
$result = Authorization::get($authorizationId, $apiContext); $result = Authorization::get($authorizationId, $apiContext);
} catch (Exception $ex) { } catch (Exception $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Get Authorization", "Authorization", null, null, $ex); ResultPrinter::printError("Get Authorization", "Authorization", null, null, $ex);
exit(1); exit(1);
} }

View File

@@ -16,7 +16,7 @@ try {
$capture = Capture::get($request->getId(), $apiContext); $capture = Capture::get($request->getId(), $apiContext);
} catch (Exception $ex) { } catch (Exception $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Get Captured Payment", "Capture", $request->getId(), null, $ex); ResultPrinter::printError("Get Captured Payment", "Capture", $request->getId(), null, $ex);
exit(1); exit(1);
} }

View File

@@ -24,7 +24,7 @@ try {
$payment = Payment::get($paymentId, $apiContext); $payment = Payment::get($paymentId, $apiContext);
} catch (Exception $ex) { } catch (Exception $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Get Payment", "Payment", null, null, $ex); ResultPrinter::printError("Get Payment", "Payment", null, null, $ex);
exit(1); exit(1);
} }

View File

@@ -12,7 +12,6 @@
require 'CreatePayment.php'; require 'CreatePayment.php';
use PayPal\Api\Payment; use PayPal\Api\Payment;
// ### Retrieve payment // ### Retrieve payment
// Retrieve the PaymentHistory object by calling the // Retrieve the PaymentHistory object by calling the
// static `get` method on the Payment class, // static `get` method on the Payment class,
@@ -21,13 +20,12 @@ use PayPal\Api\Payment;
// Refer the method doc for valid values for keys // Refer the method doc for valid values for keys
// (See bootstrap.php for more on `ApiContext`) // (See bootstrap.php for more on `ApiContext`)
try { try {
$params = array('count' => 10, 'start_index' => 5); $params = array('count' => 10, 'start_index' => 5);
$payments = Payment::all($params, $apiContext); $payments = Payment::all($params, $apiContext);
} catch (Exception $ex) { } catch (Exception $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("List Payments", "Payment", null, $params, $ex); ResultPrinter::printError("List Payments", "Payment", null, $params, $ex);
exit(1); exit(1);
} }

View File

@@ -40,12 +40,11 @@ if (isset($_GET['success']) && $_GET['success'] == 'true') {
ResultPrinter::printResult("Authorized Order", "Authorization", $result->getId(), $authorization, $result); ResultPrinter::printResult("Authorized Order", "Authorization", $result->getId(), $authorization, $result);
} catch (Exception $ex) { } catch (Exception $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Authorized Order", "Authorization", null, $authorization, $ex); ResultPrinter::printError("Authorized Order", "Authorization", null, $authorization, $ex);
exit(1); exit(1);
} }
return $result; return $result;
} else { } else {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printResult("User Cancelled the Approval", null); ResultPrinter::printResult("User Cancelled the Approval", null);

View File

@@ -41,12 +41,11 @@ if (isset($_GET['success']) && $_GET['success'] == 'true') {
ResultPrinter::printResult("Captured Order", "Capture", $result->getId(), $capture, $result); ResultPrinter::printResult("Captured Order", "Capture", $result->getId(), $capture, $result);
} catch (Exception $ex) { } catch (Exception $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Captured Order", "Capture", null, $capture, $ex); ResultPrinter::printError("Captured Order", "Capture", null, $capture, $ex);
exit(1); exit(1);
} }
return $result; return $result;
} else { } else {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printResult("User Cancelled the Approval", null); ResultPrinter::printResult("User Cancelled the Approval", null);

View File

@@ -98,7 +98,7 @@ try {
$payment->create($apiContext); $payment->create($apiContext);
} catch (Exception $ex) { } catch (Exception $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Created Payment Order Using PayPal. Please visit the URL to Approve.", "Payment", null, $request, $ex); ResultPrinter::printError("Created Payment Order Using PayPal. Please visit the URL to Approve.", "Payment", null, $request, $ex);
exit(1); exit(1);
} }

View File

@@ -98,7 +98,7 @@ try {
$payment->create($apiContext); $payment->create($apiContext);
} catch (Exception $ex) { } catch (Exception $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Created Payment Order Using PayPal. Please visit the URL to Approve.", "Payment", null, $request, $ex); ResultPrinter::printError("Created Payment Order Using PayPal. Please visit the URL to Approve.", "Payment", null, $request, $ex);
exit(1); exit(1);
} }

View File

@@ -98,7 +98,7 @@ try {
$payment->create($apiContext); $payment->create($apiContext);
} catch (Exception $ex) { } catch (Exception $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Created Payment Order Using PayPal. Please visit the URL to Approve.", "Payment", null, $request, $ex); ResultPrinter::printError("Created Payment Order Using PayPal. Please visit the URL to Approve.", "Payment", null, $request, $ex);
exit(1); exit(1);
} }

View File

@@ -98,7 +98,7 @@ try {
$payment->create($apiContext); $payment->create($apiContext);
} catch (Exception $ex) { } catch (Exception $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Created Payment Order Using PayPal. Please visit the URL to Approve.", "Payment", null, $request, $ex); ResultPrinter::printError("Created Payment Order Using PayPal. Please visit the URL to Approve.", "Payment", null, $request, $ex);
exit(1); exit(1);
} }

View File

@@ -27,12 +27,11 @@ if (isset($_GET['success']) && $_GET['success'] == 'true') {
ResultPrinter::printResult("Voided Order", "Order", $result->getId(), null, $result); ResultPrinter::printResult("Voided Order", "Order", $result->getId(), null, $result);
} catch (Exception $ex) { } catch (Exception $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Voided Order", "Order", null, null, $ex); ResultPrinter::printError("Voided Order", "Order", null, null, $ex);
exit(1); exit(1);
} }
return $result; return $result;
} else { } else {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printResult("User Cancelled the Approval", null); ResultPrinter::printResult("User Cancelled the Approval", null);

View File

@@ -9,7 +9,6 @@ $payment = require __DIR__ . '/ExecutePayment.php';
// ### Approval Status // ### Approval Status
// Determine if the user approved the payment or not // Determine if the user approved the payment or not
if (isset($_GET['success']) && $_GET['success'] == 'true') { if (isset($_GET['success']) && $_GET['success'] == 'true') {
$transactions = $payment->getTransactions(); $transactions = $payment->getTransactions();
$transaction = $transactions[0]; $transaction = $transactions[0];
$relatedResources = $transaction->getRelatedResources(); $relatedResources = $transaction->getRelatedResources();
@@ -22,12 +21,11 @@ if (isset($_GET['success']) && $_GET['success'] == 'true') {
ResultPrinter::printResult("Get Order", "Order", $result->getId(), null, $result); ResultPrinter::printResult("Get Order", "Order", $result->getId(), null, $result);
} catch (Exception $ex) { } catch (Exception $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Get Order", "Order", null, null, $ex); ResultPrinter::printError("Get Order", "Order", null, null, $ex);
exit(1); exit(1);
} }
return $result; return $result;
} else { } else {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printResult("User Cancelled the Approval", null); ResultPrinter::printResult("User Cancelled the Approval", null);

View File

@@ -17,7 +17,6 @@ use PayPal\Api\Authorization;
// has expired. // has expired.
try { try {
$amount = new Amount(); $amount = new Amount();
$amount->setCurrency("USD"); $amount->setCurrency("USD");
$amount->setTotal(1); $amount->setTotal(1);
@@ -28,7 +27,7 @@ try {
$reAuthorization = $authorization->reauthorize($apiContext); $reAuthorization = $authorization->reauthorize($apiContext);
} catch (Exception $ex) { } catch (Exception $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Reauthorize Payment", "Payment", null, null, $ex); ResultPrinter::printError("Reauthorize Payment", "Payment", null, null, $ex);
exit(1); exit(1);
} }

View File

@@ -24,7 +24,7 @@ try {
$captureRefund = $capture->refund($refund, $apiContext); $captureRefund = $capture->refund($refund, $apiContext);
} catch (Exception $ex) { } catch (Exception $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Refund Capture", "Capture", null, $refund, $ex); ResultPrinter::printError("Refund Capture", "Capture", null, $refund, $ex);
exit(1); exit(1);
} }

View File

@@ -81,10 +81,9 @@ $patchRequest->setPatches(array($patchReplace, $patchAdd));
// (See bootstrap.php for more on `ApiContext`) // (See bootstrap.php for more on `ApiContext`)
try { try {
$result = $createdPayment->update($patchRequest, $apiContext); $result = $createdPayment->update($patchRequest, $apiContext);
} catch (Exception $ex) { } catch (Exception $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Update Payment", "PatchRequest", null, $patchRequest, $ex); ResultPrinter::printError("Update Payment", "PatchRequest", null, $patchRequest, $ex);
exit(1); exit(1);
} }

View File

@@ -10,7 +10,6 @@ $authorization = require 'AuthorizePayment.php';
$authorizationId = '1BF65516U6866543H'; // $authorization->getId(); $authorizationId = '1BF65516U6866543H'; // $authorization->getId();
use PayPal\Api\Authorization; use PayPal\Api\Authorization;
// ### VoidAuthorization // ### VoidAuthorization
// You can void a previously authorized payment // You can void a previously authorized payment
// by invoking the $authorization->void method // by invoking the $authorization->void method
@@ -24,7 +23,7 @@ try {
$voidedAuth = $authorization->void($apiContext); $voidedAuth = $authorization->void($apiContext);
} catch (Exception $ex) { } catch (Exception $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Void Authorization", "Authorization", null, null, $ex); ResultPrinter::printError("Void Authorization", "Authorization", null, null, $ex);
exit(1); exit(1);
} }

View File

@@ -26,11 +26,11 @@ try {
} else { } else {
// The item transaction status is not unclaimed. You can only cancel an unclaimed transaction. // The item transaction status is not unclaimed. You can only cancel an unclaimed transaction.
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Cancel Unclaimed Payout Item", "PayoutItem", null, $payoutItemId, new Exception("Payout Item Status is not UNCLAIMED")); ResultPrinter::printError("Cancel Unclaimed Payout Item", "PayoutItem", null, $payoutItemId, new Exception("Payout Item Status is not UNCLAIMED"));
} }
} catch (Exception $ex) { } catch (Exception $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Cancel Unclaimed Payout Item", "PayoutItem", null, $payoutItemId, $ex); ResultPrinter::printError("Cancel Unclaimed Payout Item", "PayoutItem", null, $payoutItemId, $ex);
exit(1); exit(1);
} }

View File

@@ -116,7 +116,7 @@ try {
$output = $payouts->create(null, $apiContext); $output = $payouts->create(null, $apiContext);
} catch (Exception $ex) { } catch (Exception $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Created Batch Payout", "Payout", null, $request, $ex); ResultPrinter::printError("Created Batch Payout", "Payout", null, $request, $ex);
exit(1); exit(1);
} }

View File

@@ -65,7 +65,7 @@ try {
$output = $payouts->createSynchronous($apiContext); $output = $payouts->createSynchronous($apiContext);
} catch (Exception $ex) { } catch (Exception $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Created Single Synchronous Payout", "Payout", null, $request, $ex); ResultPrinter::printError("Created Single Synchronous Payout", "Payout", null, $request, $ex);
exit(1); exit(1);
} }

View File

@@ -17,7 +17,7 @@ try {
$output = \PayPal\Api\Payout::get($payoutBatchId, $apiContext); $output = \PayPal\Api\Payout::get($payoutBatchId, $apiContext);
} catch (Exception $ex) { } catch (Exception $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Get Payout Batch Status", "PayoutBatch", null, $payoutBatchId, $ex); ResultPrinter::printError("Get Payout Batch Status", "PayoutBatch", null, $payoutBatchId, $ex);
exit(1); exit(1);
} }

View File

@@ -19,7 +19,7 @@ try {
$output = \PayPal\Api\PayoutItem::get($payoutItemId, $apiContext); $output = \PayPal\Api\PayoutItem::get($payoutItemId, $apiContext);
} catch (Exception $ex) { } catch (Exception $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Get Payout Item Status", "PayoutItem", null, $payoutItemId, $ex); ResultPrinter::printError("Get Payout Item Status", "PayoutItem", null, $payoutItemId, $ex);
exit(1); exit(1);
} }

View File

@@ -25,7 +25,7 @@ try {
$sale = Sale::get($saleId, $apiContext); $sale = Sale::get($saleId, $apiContext);
} catch (Exception $ex) { } catch (Exception $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Look Up A Sale", "Sale", $sale->getId(), null, $ex); ResultPrinter::printError("Look Up A Sale", "Sale", $sale->getId(), null, $ex);
exit(1); exit(1);
} }

View File

@@ -42,7 +42,7 @@ try {
$refundedSale = $sale->refund($refund, $apiContext); $refundedSale = $sale->refund($refund, $apiContext);
} catch (Exception $ex) { } catch (Exception $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Refund Sale", "Sale", $refundedSale->getId(), $refund, $ex); ResultPrinter::printError("Refund Sale", "Sale", $refundedSale->getId(), $refund, $ex);
exit(1); exit(1);
} }

View File

@@ -73,7 +73,7 @@ try {
$bankAccount->create($apiContext); $bankAccount->create($apiContext);
} catch (Exception $ex) { } catch (Exception $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Create Bank Account", "Bank Account", null, $request, $ex); ResultPrinter::printError("Create Bank Account", "Bank Account", null, $request, $ex);
exit(1); exit(1);
} }

View File

@@ -46,7 +46,7 @@ try {
$card->create($apiContext); $card->create($apiContext);
} catch (Exception $ex) { } catch (Exception $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Create Credit Card", "Credit Card", null, $request, $ex); ResultPrinter::printError("Create Credit Card", "Credit Card", null, $request, $ex);
exit(1); exit(1);
} }

View File

@@ -15,7 +15,7 @@ try {
$bankAccount->delete($apiContext); $bankAccount->delete($apiContext);
} catch (Exception $ex) { } catch (Exception $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Delete Bank Account", "Bank Account", null, null, $ex); ResultPrinter::printError("Delete Bank Account", "Bank Account", null, null, $ex);
exit(1); exit(1);
} }

View File

@@ -16,7 +16,7 @@ try {
$card->delete($apiContext); $card->delete($apiContext);
} catch (Exception $ex) { } catch (Exception $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Delete Credit Card", "Credit Card", null, null, $ex); ResultPrinter::printError("Delete Credit Card", "Credit Card", null, null, $ex);
exit(1); exit(1);
} }

View File

@@ -17,7 +17,7 @@ try {
$bankAccount = \PayPal\Api\BankAccount::get($bankAccount->getId(), $apiContext); $bankAccount = \PayPal\Api\BankAccount::get($bankAccount->getId(), $apiContext);
} catch (Exception $ex) { } catch (Exception $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Get Bank Account", "Bank Account", $bankAccount->getId(), null, $ex); ResultPrinter::printError("Get Bank Account", "Bank Account", $bankAccount->getId(), null, $ex);
exit(1); exit(1);
} }

View File

@@ -18,7 +18,7 @@ try {
$card = CreditCard::get($card->getId(), $apiContext); $card = CreditCard::get($card->getId(), $apiContext);
} catch (Exception $ex) { } catch (Exception $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Get Credit Card", "Credit Card", $card->getId(), null, $ex); ResultPrinter::printError("Get Credit Card", "Credit Card", $card->getId(), null, $ex);
exit(1); exit(1);
} }

View File

@@ -26,7 +26,7 @@ try {
$cards = CreditCard::all($params, $apiContext); $cards = CreditCard::all($params, $apiContext);
} catch (Exception $ex) { } catch (Exception $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("List All Credit Cards", "CreditCardList", null, $params, $ex); ResultPrinter::printError("List All Credit Cards", "CreditCardList", null, $params, $ex);
exit(1); exit(1);
} }

View File

@@ -43,7 +43,7 @@ try {
$card = $card->update($pathRequest, $apiContext); $card = $card->update($pathRequest, $apiContext);
} catch (Exception $ex) { } catch (Exception $ex) {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Updated Credit Card", "Credit Card", $card->getId(), $pathRequest, $ex); ResultPrinter::printError("Updated Credit Card", "Credit Card", $card->getId(), $pathRequest, $ex);
exit(1); exit(1);
} }