[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

@@ -11,7 +11,6 @@ use PayPal\Api\Amount;
use PayPal\Api\Authorization;
use PayPal\Api\Capture;
// ### Capture Payment
// You can capture and process a previously created authorization
// by invoking the $authorization->capture method
@@ -31,7 +30,7 @@ try {
$getCapture = $authorization->capture($capture, $apiContext);
} catch (Exception $ex) {
// 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);
}

View File

@@ -69,7 +69,7 @@ try {
$payment->create($apiContext);
} catch (Exception $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);
ResultPrinter::printError('Authorize a Payment', 'Authorized Payment', $payment->getId(), $request, $ex);
exit(1);
}

View File

@@ -101,7 +101,7 @@ try {
$payment->create($apiContext);
} catch (Exception $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);
ResultPrinter::printError("Created Payment Authorization Using PayPal. Please visit the URL to Authorize.", "Payment", null, $request, $ex);
exit(1);
}

View File

@@ -84,10 +84,9 @@ try {
// for payment approval
// Please note that currently future payments works only with PayPal as a funding instrument.
$payment->create($apiContext, $clientMetadataId);
} catch (Exception $ex) {
// 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);
}

View File

@@ -114,7 +114,7 @@ try {
$payment->create($apiContext);
} catch (Exception $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);
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);
}

View File

@@ -101,7 +101,7 @@ try {
$payment->create($apiContext);
} catch (Exception $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);
ResultPrinter::printError("Created Payment Using PayPal. Please visit the URL to Approve.", "Payment", null, $request, $ex);
exit(1);
}

View File

@@ -105,7 +105,7 @@ try {
$payment->create($apiContext);
} catch (Exception $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);
ResultPrinter::printError("Create Payment using Saved Card", "Payment", null, $request, $ex);
exit(1);
}

View File

@@ -69,12 +69,12 @@ if (isset($_GET['success']) && $_GET['success'] == 'true') {
$payment = Payment::get($paymentId, $apiContext);
} catch (Exception $ex) {
// 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);
}
} catch (Exception $ex) {
// 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);
}
@@ -82,8 +82,6 @@ if (isset($_GET['success']) && $_GET['success'] == 'true') {
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);

View File

@@ -20,7 +20,7 @@ try {
$result = Authorization::get($authorizationId, $apiContext);
} catch (Exception $ex) {
// 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);
}

View File

@@ -16,7 +16,7 @@ try {
$capture = Capture::get($request->getId(), $apiContext);
} catch (Exception $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);
ResultPrinter::printError("Get Captured Payment", "Capture", $request->getId(), null, $ex);
exit(1);
}

View File

@@ -24,7 +24,7 @@ try {
$payment = Payment::get($paymentId, $apiContext);
} catch (Exception $ex) {
// 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);
}

View File

@@ -12,7 +12,6 @@
require 'CreatePayment.php';
use PayPal\Api\Payment;
// ### Retrieve payment
// Retrieve the PaymentHistory object by calling the
// static `get` method on the Payment class,
@@ -21,13 +20,12 @@ use PayPal\Api\Payment;
// Refer the method doc for valid values for keys
// (See bootstrap.php for more on `ApiContext`)
try {
$params = array('count' => 10, 'start_index' => 5);
$payments = Payment::all($params, $apiContext);
} catch (Exception $ex) {
// 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);
}

View File

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

View File

@@ -98,7 +98,7 @@ try {
$payment->create($apiContext);
} catch (Exception $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);
ResultPrinter::printError("Created Payment Order Using PayPal. Please visit the URL to Approve.", "Payment", null, $request, $ex);
exit(1);
}

View File

@@ -98,7 +98,7 @@ try {
$payment->create($apiContext);
} catch (Exception $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);
ResultPrinter::printError("Created Payment Order Using PayPal. Please visit the URL to Approve.", "Payment", null, $request, $ex);
exit(1);
}

View File

@@ -98,7 +98,7 @@ try {
$payment->create($apiContext);
} catch (Exception $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);
ResultPrinter::printError("Created Payment Order Using PayPal. Please visit the URL to Approve.", "Payment", null, $request, $ex);
exit(1);
}

View File

@@ -98,7 +98,7 @@ try {
$payment->create($apiContext);
} catch (Exception $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);
ResultPrinter::printError("Created Payment Order Using PayPal. Please visit the URL to Approve.", "Payment", null, $request, $ex);
exit(1);
}

View File

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

View File

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

View File

@@ -17,7 +17,6 @@ use PayPal\Api\Authorization;
// has expired.
try {
$amount = new Amount();
$amount->setCurrency("USD");
$amount->setTotal(1);
@@ -28,7 +27,7 @@ try {
$reAuthorization = $authorization->reauthorize($apiContext);
} catch (Exception $ex) {
// 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);
}

View File

@@ -24,7 +24,7 @@ try {
$captureRefund = $capture->refund($refund, $apiContext);
} catch (Exception $ex) {
// 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);
}

View File

@@ -81,10 +81,9 @@ $patchRequest->setPatches(array($patchReplace, $patchAdd));
// (See bootstrap.php for more on `ApiContext`)
try {
$result = $createdPayment->update($patchRequest, $apiContext);
} catch (Exception $ex) {
// 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);
}

View File

@@ -10,7 +10,6 @@ $authorization = require 'AuthorizePayment.php';
$authorizationId = '1BF65516U6866543H'; // $authorization->getId();
use PayPal\Api\Authorization;
// ### VoidAuthorization
// You can void a previously authorized payment
// by invoking the $authorization->void method
@@ -24,7 +23,7 @@ try {
$voidedAuth = $authorization->void($apiContext);
} catch (Exception $ex) {
// 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);
}