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

@@ -32,8 +32,10 @@ try {
// (See bootstrap.php for more on `ApiContext`)
$cancelStatus = $invoice->cancel($notify, $apiContext);
} catch (Exception $ex) {
ResultPrinter::printError("Cancel Invoice", "Invoice", null, $notify, $ex);
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Cancel Invoice", "Invoice", null, $notify, $ex);
exit(1);
}
ResultPrinter::printResult("Cancel Invoice", "Invoice", $invoice->getId(), $notify, null);
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printResult("Cancel Invoice", "Invoice", $invoice->getId(), $notify, null);

View File

@@ -143,10 +143,12 @@ try {
// with a valid ApiContext (See bootstrap.php for more on `ApiContext`)
$invoice->create($apiContext);
} catch (Exception $ex) {
ResultPrinter::printError("Create Invoice", "Invoice", null, $request, $ex);
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Create Invoice", "Invoice", null, $request, $ex);
exit(1);
}
ResultPrinter::printResult("Create Invoice", "Invoice", $invoice->getId(), $request, $invoice);
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printResult("Create Invoice", "Invoice", $invoice->getId(), $request, $invoice);
return $invoice;

View File

@@ -20,8 +20,10 @@ try {
// (See bootstrap.php for more on `ApiContext`)
$deleteStatus = $invoice->delete($apiContext);
} catch (Exception $ex) {
ResultPrinter::printError("Delete Invoice", "Invoice", null, $deleteStatus, $ex);
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Delete Invoice", "Invoice", null, $deleteStatus, $ex);
exit(1);
}
ResultPrinter::printResult("Delete Invoice", "Invoice", $invoice->getId(), null, null);
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printResult("Delete Invoice", "Invoice", $invoice->getId(), null, null);

View File

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

View File

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

View File

@@ -30,11 +30,13 @@ try {
// (See bootstrap.php for more on `ApiContext`)
$recordStatus = $invoice->recordPayment($record, $apiContext);
} catch (Exception $ex) {
ResultPrinter::printError("Payment for Invoice", "Invoice", null, null, $ex);
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Payment for Invoice", "Invoice", null, null, $ex);
exit(1);
}
ResultPrinter::printResult("Payment for Invoice", "Invoice", $invoice->getId(), $record, null);
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printResult("Payment for Invoice", "Invoice", $invoice->getId(), $record, null);
// ### Retrieve Invoice
// Retrieve the invoice object by calling the
@@ -45,10 +47,12 @@ ResultPrinter::printResult("Payment for Invoice", "Invoice", $invoice->getId(),
try {
$invoice = Invoice::get($invoice->getId(), $apiContext);
} catch (Exception $ex) {
ResultPrinter::printError("Get Invoice (Not Required - For Sample Only)", "Invoice", $invoice->getId(), $invoice->getId(), $ex);
// 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);
exit(1);
}
ResultPrinter::printResult("Get Invoice (Not Required - For Sample Only)", "Invoice", $invoice->getId(), $invoice->getId(), $invoice);
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printResult("Get Invoice (Not Required - For Sample Only)", "Invoice", $invoice->getId(), $invoice->getId(), $invoice);
return $invoice;

View File

@@ -29,11 +29,13 @@ try {
// (See bootstrap.php for more on `ApiContext`)
$refundStatus = $invoice->recordRefund($refund, $apiContext);
} catch (Exception $ex) {
ResultPrinter::printError("Refund for Invoice", "Invoice", null, null, $ex);
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Refund for Invoice", "Invoice", null, null, $ex);
exit(1);
}
ResultPrinter::printResult("Refund for Invoice", "Invoice", $invoice->getId(), $refund, null);
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printResult("Refund for Invoice", "Invoice", $invoice->getId(), $refund, null);
// ### Retrieve Invoice
// Retrieve the invoice object by calling the
@@ -44,10 +46,12 @@ ResultPrinter::printResult("Refund for Invoice", "Invoice", $invoice->getId(), $
try {
$invoice = Invoice::get($invoice->getId(), $apiContext);
} catch (Exception $ex) {
ResultPrinter::printError("Get Invoice (Not Required - For Sample Only)", "Invoice", $invoice->getId(), $invoice->getId(), $ex);
// 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);
exit(1);
}
ResultPrinter::printResult("Get Invoice (Not Required - For Sample Only)", "Invoice", $invoice->getId(), $invoice->getId(), $invoice);
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printResult("Get Invoice (Not Required - For Sample Only)", "Invoice", $invoice->getId(), $invoice->getId(), $invoice);
return $invoice;

View File

@@ -30,11 +30,13 @@ try {
// (See bootstrap.php for more on `ApiContext`)
$remindStatus = $invoice->remind($notify, $apiContext);
} catch (Exception $ex) {
ResultPrinter::printError("Remind Invoice", "Invoice", null, $notify, $ex);
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Remind Invoice", "Invoice", null, $notify, $ex);
exit(1);
}
ResultPrinter::printResult("Remind Invoice", "Invoice", null, $notify, null);
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printResult("Remind Invoice", "Invoice", null, $notify, null);
// ### Retrieve Invoice
// Retrieve the invoice object by calling the
@@ -45,10 +47,12 @@ ResultPrinter::printResult("Remind Invoice", "Invoice", null, $notify, null);
try {
$invoice = Invoice::get($invoice->getId(), $apiContext);
} catch (Exception $ex) {
ResultPrinter::printError("Get Invoice (Not Required - For Sample Only)", "Invoice", $invoice->getId(), $invoice->getId(), $ex);
// 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);
exit(1);
}
ResultPrinter::printResult("Get Invoice (Not Required - For Sample Only)", "Invoice", $invoice->getId(), $invoice->getId(), $invoice);
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printResult("Get Invoice (Not Required - For Sample Only)", "Invoice", $invoice->getId(), $invoice->getId(), $invoice);
return $invoice;

View File

@@ -27,11 +27,13 @@ try {
} catch (Exception $ex) {
ResultPrinter::printError("Retrieved QR Code for Invoice", "Invoice", $invoice->getId(), null, $ex);
// 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);
exit(1);
}
ResultPrinter::printResult("Retrieved QR Code for Invoice", "Invoice", $invoice->getId(), null, $image);
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printResult("Retrieved QR Code for Invoice", "Invoice", $invoice->getId(), null, $image);
// ### Show the Image
// In PHP, there are many ways to present an images.

View File

@@ -30,7 +30,9 @@ try {
// (See bootstrap.php for more on `ApiContext`)
$invoices = Invoice::search($search, $apiContext);
} catch (Exception $ex) {
ResultPrinter::printError("Search Invoice", "Invoice", null, null, $ex);
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Search Invoice", "Invoice", null, null, $ex);
exit(1);
}
ResultPrinter::printResult("Search Invoice", "Invoice", null, $search, $invoices);
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printResult("Search Invoice", "Invoice", null, $search, $invoices);

View File

@@ -16,11 +16,13 @@ try {
// with a valid ApiContext (See bootstrap.php for more on `ApiContext`)
$sendStatus = $invoice->send($apiContext);
} catch (Exception $ex) {
ResultPrinter::printResult("Send Invoice", "Invoice", null, null, $ex);
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Send Invoice", "Invoice", null, null, $ex);
exit(1);
}
ResultPrinter::printResult("Send Invoice", "Invoice", $invoice->getId(), null, null);
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printResult("Send Invoice", "Invoice", $invoice->getId(), null, null);
// ### Retrieve Invoice
// Retrieve the invoice object by calling the
@@ -31,10 +33,12 @@ ResultPrinter::printResult("Send Invoice", "Invoice", $invoice->getId(), null, n
try {
$invoice = Invoice::get($invoice->getId(), $apiContext);
} catch (Exception $ex) {
ResultPrinter::printError("Get Invoice (Not Required - For Sample Only)", "Invoice", $invoice->getId(), $invoice->getId(), $ex);
// 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);
exit(1);
}
ResultPrinter::printResult("Get Invoice (Not Required - For Sample Only)", "Invoice", $invoice->getId(), $invoice->getId(), $invoice);
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printResult("Get Invoice (Not Required - For Sample Only)", "Invoice", $invoice->getId(), $invoice->getId(), $invoice);
return $invoice;

View File

@@ -29,11 +29,13 @@ try {
// with a valid ApiContext (See bootstrap.php for more on `ApiContext`)
$invoice->update($apiContext);
} catch (Exception $ex) {
ResultPrinter::printError("Invoice Updated", "Invoice", null, $request, $ex);
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printError("Invoice Updated", "Invoice", null, $request, $ex);
exit(1);
}
ResultPrinter::printResult("Invoice Updated", "Invoice", $invoice->getId(), $request, $invoice);
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printResult("Invoice Updated", "Invoice", $invoice->getId(), $request, $invoice);
// ### Retrieve Invoice
// Retrieve the invoice object by calling the
@@ -44,10 +46,12 @@ ResultPrinter::printResult("Invoice Updated", "Invoice", $invoice->getId(), $req
try {
$invoice = Invoice::get($invoice->getId(), $apiContext);
} catch (Exception $ex) {
ResultPrinter::printError("Get Invoice (Not Required - For Sample Only)", "Invoice", $invoice->getId(), $invoice->getId(), $ex);
// 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);
exit(1);
}
ResultPrinter::printResult("Get Invoice (Not Required - For Sample Only)", "Invoice", $invoice->getId(), $invoice->getId(), $invoice);
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
ResultPrinter::printResult("Get Invoice (Not Required - For Sample Only)", "Invoice", $invoice->getId(), $invoice->getId(), $invoice);
return $invoice;