Sample ResultPrinter Not to be Used

- Comment everywhere the ResultPrinter is used to not use outside sample
This commit is contained in:
Jay Patel
2015-04-23 23:34:24 -05:00
parent c1dbda1242
commit ab334918b0
167 changed files with 592 additions and 749 deletions

View File

@@ -30,10 +30,12 @@ try {
// Perform a capture
$getCapture = $authorization->capture($capture, $apiContext);
} catch (Exception $ex) {
ResultPrinter::printError("Capture Payment", "Authorization", null, $capture, $ex);
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Capture Payment", "Authorization", null, $capture, $ex);
exit(1);
}
ResultPrinter::printResult("Capture Payment", "Authorization", $getCapture->getId(), $capture, $getCapture);
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printResult("Capture Payment", "Authorization", $getCapture->getId(), $capture, $getCapture);
return $getCapture;

View File

@@ -68,11 +68,13 @@ $request = clone $payment;
try {
$payment->create($apiContext);
} catch (Exception $ex) {
ResultPrinter::printError('Authorize a Payment', 'Authorized Payment', $payment->getId(), $request, $ex);
// 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);
exit(1);
}
ResultPrinter::printResult('Authorize a Payment', 'Authorized Payment', $payment->getId(), $request, $payment);
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printResult('Authorize a Payment', 'Authorized Payment', $payment->getId(), $request, $payment);
$transactions = $payment->getTransactions();
$relatedResources = $transactions[0]->getRelatedResources();

View File

@@ -100,7 +100,8 @@ $request = clone $payment;
try {
$payment->create($apiContext);
} catch (Exception $ex) {
ResultPrinter::printError("Created Payment Authorization Using PayPal. Please visit the URL to Authorize.", "Payment", null, $request, $ex);
// 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);
exit(1);
}
@@ -110,6 +111,7 @@ try {
// method
$approvalUrl = $payment->getApprovalLink();
ResultPrinter::printResult("Created Payment Authorization Using PayPal. Please visit the URL to Authorize.", "Payment", "<a href='$approvalUrl' >$approvalUrl</a>", $request, $payment);
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printResult("Created Payment Authorization Using PayPal. Please visit the URL to Authorize.", "Payment", "<a href='$approvalUrl' >$approvalUrl</a>", $request, $payment);
return $payment;

View File

@@ -85,10 +85,12 @@ try {
$payment->create($apiContext, $clientMetadataId);
} catch (Exception $ex) {
ResultPrinter::printError("Future Payment", "Payment", null, $request, $ex);
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Future Payment", "Payment", null, $request, $ex);
exit(1);
}
ResultPrinter::printResult("Future Payment", "Payment", $payment->getId(), $request, $payment);
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printResult("Future Payment", "Payment", $payment->getId(), $request, $payment);
return $payment;

View File

@@ -113,10 +113,12 @@ $request = clone $payment;
try {
$payment->create($apiContext);
} catch (Exception $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);
// 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);
exit(1);
}
ResultPrinter::printResult('Create Payment Using Credit Card', 'Payment', $payment->getId(), $request, $payment);
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printResult('Create Payment Using Credit Card', 'Payment', $payment->getId(), $request, $payment);
return $payment;

View File

@@ -98,7 +98,8 @@ $request = clone $payment;
try {
$payment->create($apiContext);
} catch (Exception $ex) {
ResultPrinter::printError("Created Payment Using PayPal. Please visit the URL to Approve.", "Payment", null, $request, $ex);
// 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);
exit(1);
}
@@ -108,6 +109,7 @@ try {
// method
$approvalUrl = $payment->getApprovalLink();
ResultPrinter::printResult("Created Payment Using PayPal. Please visit the URL to Approve.", "Payment", "<a href='$approvalUrl' >$approvalUrl</a>", $request, $payment);
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printResult("Created Payment Using PayPal. Please visit the URL to Approve.", "Payment", "<a href='$approvalUrl' >$approvalUrl</a>", $request, $payment);
return $payment;

View File

@@ -104,10 +104,12 @@ $request = clone $payment;
try {
$payment->create($apiContext);
} catch (Exception $ex) {
ResultPrinter::printError("Create Payment using Saved Card", "Payment", null, $request, $ex);
// 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);
exit(1);
}
ResultPrinter::printResult("Create Payment using Saved Card", "Payment", $payment->getId(), $request, $payment);
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printResult("Create Payment using Saved Card", "Payment", $payment->getId(), $request, $payment);
return $card;

View File

@@ -38,25 +38,30 @@ if (isset($_GET['success']) && $_GET['success'] == 'true') {
// (See bootstrap.php for more on `ApiContext`)
$result = $payment->execute($execution, $apiContext);
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printResult("Executed Payment", "Payment", $payment->getId(), $execution, $result);
try {
$payment = Payment::get($paymentId, $apiContext);
} catch (Exception $ex) {
ResultPrinter::printError("Get Payment", "Payment", null, null, $ex);
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Get Payment", "Payment", null, null, $ex);
exit(1);
}
} catch (Exception $ex) {
ResultPrinter::printError("Executed Payment", "Payment", null, null, $ex);
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Executed Payment", "Payment", null, null, $ex);
exit(1);
}
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printResult("Get Payment", "Payment", $payment->getId(), null, $payment);
return $payment;
} else {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printResult("User Cancelled the Approval", null);
exit;
}

View File

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

View File

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

View File

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

View File

@@ -26,8 +26,10 @@ try {
$payments = Payment::all($params, $apiContext);
} catch (Exception $ex) {
ResultPrinter::printError("List Payments", "Payment", null, $params, $ex);
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("List Payments", "Payment", null, $params, $ex);
exit(1);
}
ResultPrinter::printResult("List Payments", "Payment", null, $params, $payments);
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printResult("List Payments", "Payment", null, $params, $payments);

View File

@@ -37,15 +37,18 @@ if (isset($_GET['success']) && $_GET['success'] == 'true') {
// Authorize the order by passing authorization object we created.
// We will get a new authorization object back.
$result = $order->authorize($authorization, $apiContext);
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printResult("Authorized Order", "Authorization", $result->getId(), $authorization, $result);
} catch (Exception $ex) {
ResultPrinter::printError("Authorized Order", "Authorization", null, $authorization, $ex);
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Authorized Order", "Authorization", null, $authorization, $ex);
exit(1);
}
return $result;
} else {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printResult("User Cancelled the Approval", null);
exit;
}

View File

@@ -37,15 +37,18 @@ if (isset($_GET['success']) && $_GET['success'] == 'true') {
// Capture the order by passing capture object we created.
// We will get a new capture object back.
$result = $order->capture($capture, $apiContext);
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printResult("Captured Order", "Capture", $result->getId(), $capture, $result);
} catch (Exception $ex) {
ResultPrinter::printError("Captured Order", "Capture", null, $capture, $ex);
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Captured Order", "Capture", null, $capture, $ex);
exit(1);
}
return $result;
} else {
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printResult("User Cancelled the Approval", null);
exit;
}

View File

@@ -97,7 +97,8 @@ $request = clone $payment;
try {
$payment->create($apiContext);
} catch (Exception $ex) {
ResultPrinter::printError("Created Payment Order Using PayPal. Please visit the URL to Approve.", "Payment", null, $request, $ex);
// 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);
exit(1);
}
@@ -107,6 +108,7 @@ try {
// method
$approvalUrl = $payment->getApprovalLink();
ResultPrinter::printResult("Created Payment Order Using PayPal. Please visit the URL to Approve.", "Payment", "<a href='$approvalUrl' >$approvalUrl</a>", $request, $payment);
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printResult("Created Payment Order Using PayPal. Please visit the URL to Approve.", "Payment", "<a href='$approvalUrl' >$approvalUrl</a>", $request, $payment);
return $payment;

View File

@@ -97,7 +97,8 @@ $request = clone $payment;
try {
$payment->create($apiContext);
} catch (Exception $ex) {
ResultPrinter::printError("Created Payment Order Using PayPal. Please visit the URL to Approve.", "Payment", null, $request, $ex);
// 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);
exit(1);
}
@@ -107,6 +108,7 @@ try {
// method
$approvalUrl = $payment->getApprovalLink();
ResultPrinter::printResult("Created Payment Order Using PayPal. Please visit the URL to Approve.", "Payment", "<a href='$approvalUrl' >$approvalUrl</a>", $request, $payment);
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printResult("Created Payment Order Using PayPal. Please visit the URL to Approve.", "Payment", "<a href='$approvalUrl' >$approvalUrl</a>", $request, $payment);
return $payment;

View File

@@ -97,7 +97,8 @@ $request = clone $payment;
try {
$payment->create($apiContext);
} catch (Exception $ex) {
ResultPrinter::printError("Created Payment Order Using PayPal. Please visit the URL to Approve.", "Payment", null, $request, $ex);
// 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);
exit(1);
}
@@ -107,6 +108,7 @@ try {
// method
$approvalUrl = $payment->getApprovalLink();
ResultPrinter::printResult("Created Payment Order Using PayPal. Please visit the URL to Approve.", "Payment", "<a href='$approvalUrl' >$approvalUrl</a>", $request, $payment);
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printResult("Created Payment Order Using PayPal. Please visit the URL to Approve.", "Payment", "<a href='$approvalUrl' >$approvalUrl</a>", $request, $payment);
return $payment;

View File

@@ -97,7 +97,8 @@ $request = clone $payment;
try {
$payment->create($apiContext);
} catch (Exception $ex) {
ResultPrinter::printError("Created Payment Order Using PayPal. Please visit the URL to Approve.", "Payment", null, $request, $ex);
// 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);
exit(1);
}
@@ -107,6 +108,7 @@ try {
// method
$approvalUrl = $payment->getApprovalLink();
ResultPrinter::printResult("Created Payment Order Using PayPal. Please visit the URL to Approve.", "Payment", "<a href='$approvalUrl' >$approvalUrl</a>", $request, $payment);
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printResult("Created Payment Order Using PayPal. Please visit the URL to Approve.", "Payment", "<a href='$approvalUrl' >$approvalUrl</a>", $request, $payment);
return $payment;

View File

@@ -26,15 +26,18 @@ if (isset($_GET['success']) && $_GET['success'] == 'true') {
// ### Void Order
// Call void method on order object. You will get an Order Object back
$result = $order->void($apiContext);
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printResult("Voided Order", "Order", $result->getId(), null, $result);
} catch (Exception $ex) {
ResultPrinter::printError("Voided Order", "Order", null, null, $ex);
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Voided Order", "Order", null, null, $ex);
exit(1);
}
return $result;
} else {
ResultPrinter::printResult("User Cancelled the Approval", null);
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printResult("User Cancelled the Approval", null);
exit;
}

View File

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

View File

@@ -27,8 +27,10 @@ try {
$reAuthorization = $authorization->reauthorize($apiContext);
} catch (Exception $ex) {
ResultPrinter::printError("Reauthorize Payment", "Payment", null, null, $ex);
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Reauthorize Payment", "Payment", null, null, $ex);
exit(1);
}
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printResult("Reauthorize Payment", "Payment", $authorization->getId(), null, $reAuthorization);

View File

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

View File

@@ -83,16 +83,19 @@ try {
$result = $createdPayment->update($patchRequest, $apiContext);
} catch (Exception $ex) {
ResultPrinter::printError("Update Payment", "PatchRequest", null, $patchRequest, $ex);
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Update Payment", "PatchRequest", null, $patchRequest, $ex);
exit(1);
}
ResultPrinter::printResult("Update Payment", "PatchRequest", $payment->getId(), $patchRequest, null);
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printResult("Update Payment", "PatchRequest", $payment->getId(), $patchRequest, null);
// ### Getting Updated Payment Object
if ($result == true) {
$result = Payment::get($createdPayment->getId(), $apiContext);
ResultPrinter::printResult("Get Payment", "Payment", $result->getId(), null, $result);
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printResult("Get Payment", "Payment", $result->getId(), null, $result);
// ### Get redirect url
@@ -106,7 +109,8 @@ foreach ($result->getLinks() as $link) {
}
}
ResultPrinter::printResult("Created Payment Using PayPal. Please visit the URL to Approve.", "Payment", "<a href='$approvalUrl' >$approvalUrl</a>", $request, $result);
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printResult("Created Payment Using PayPal. Please visit the URL to Approve.", "Payment", "<a href='$approvalUrl' >$approvalUrl</a>", $request, $result);
}
return $result;

View File

@@ -23,10 +23,12 @@ try {
// Void the authorization
$voidedAuth = $authorization->void($apiContext);
} catch (Exception $ex) {
ResultPrinter::printError("Void Authorization", "Authorization", null, null, $ex);
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Void Authorization", "Authorization", null, null, $ex);
exit(1);
}
ResultPrinter::printResult("Void Authorization", "Authorization", $voidedAuth->getId(), null, $voidedAuth);
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printResult("Void Authorization", "Authorization", $voidedAuth->getId(), null, $voidedAuth);
return $voidedAuth;