forked from LiveCarta/PayPal-PHP-SDK
[PSR] Fixed Tests
- Using `php-cs-fixer` tool.
This commit is contained in:
@@ -99,7 +99,6 @@ $request = clone $agreement;
|
||||
try {
|
||||
// Please note that as the agreement has not yet activated, we wont be receiving the ID just yet.
|
||||
$agreement = $agreement->create($apiContext);
|
||||
|
||||
} catch (Exception $ex) {
|
||||
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
|
||||
ResultPrinter::printError("Created Billing Agreement.", "Agreement", $agreement->getId(), $request, $ex);
|
||||
|
||||
@@ -74,7 +74,6 @@ try {
|
||||
// the buyer to. Retrieve the url from the $agreement->getApprovalLink()
|
||||
// method
|
||||
$approvalUrl = $agreement->getApprovalLink();
|
||||
|
||||
} catch (Exception $ex) {
|
||||
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
|
||||
ResultPrinter::printError("Created Billing Agreement.", "Agreement", null, $request, $ex);
|
||||
|
||||
@@ -66,7 +66,7 @@ try {
|
||||
$output = $plan->create($apiContext);
|
||||
} catch (Exception $ex) {
|
||||
// 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);
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ try {
|
||||
$result = $createdPlan->delete($apiContext);
|
||||
} catch (Exception $ex) {
|
||||
// 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);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@ require __DIR__ . '/../bootstrap.php';
|
||||
// ## Approval Status
|
||||
// Determine if the user accepted or denied the request
|
||||
if (isset($_GET['success']) && $_GET['success'] == 'true') {
|
||||
|
||||
$token = $_GET['token'];
|
||||
$agreement = new \PayPal\Api\Agreement();
|
||||
try {
|
||||
@@ -17,7 +16,7 @@ if (isset($_GET['success']) && $_GET['success'] == 'true') {
|
||||
$agreement->execute($token, $apiContext);
|
||||
} catch (Exception $ex) {
|
||||
// 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);
|
||||
}
|
||||
|
||||
@@ -30,13 +29,12 @@ if (isset($_GET['success']) && $_GET['success'] == 'true') {
|
||||
$agreement = \PayPal\Api\Agreement::get($agreement->getId(), $apiContext);
|
||||
} catch (Exception $ex) {
|
||||
// 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);
|
||||
}
|
||||
|
||||
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
|
||||
ResultPrinter::printResult("Get Agreement", "Agreement", $agreement->getId(), null, $agreement);
|
||||
|
||||
} else {
|
||||
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
|
||||
ResultPrinter::printResult("User Cancelled the Approval", null);
|
||||
|
||||
@@ -16,7 +16,7 @@ try {
|
||||
$agreement = Agreement::get($createdAgreement->getId(), $apiContext);
|
||||
} catch (Exception $ex) {
|
||||
// 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);
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ try {
|
||||
$plan = Plan::get($createdPlan->getId(), $apiContext);
|
||||
} catch (Exception $ex) {
|
||||
// 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);
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ try {
|
||||
$planList = Plan::all($params, $apiContext);
|
||||
} catch (Exception $ex) {
|
||||
// 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);
|
||||
}
|
||||
|
||||
|
||||
@@ -18,12 +18,10 @@ $agreementStateDescriptor = new AgreementStateDescriptor();
|
||||
$agreementStateDescriptor->setNote("Reactivating the agreement");
|
||||
|
||||
try {
|
||||
|
||||
$suspendedAgreement->reActivate($agreementStateDescriptor, $apiContext);
|
||||
|
||||
// Lets get the updated Agreement Object
|
||||
$agreement = Agreement::get($suspendedAgreement->getId(), $apiContext);
|
||||
|
||||
} catch (Exception $ex) {
|
||||
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
|
||||
ResultPrinter::printResult("Reactivate the Agreement", "Agreement", $agreement->getId(), $suspendedAgreement, $ex);
|
||||
|
||||
@@ -22,7 +22,7 @@ try {
|
||||
$result = Agreement::searchTransactions($agreementId, $params, $apiContext);
|
||||
} catch (Exception $ex) {
|
||||
// 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);
|
||||
}
|
||||
|
||||
|
||||
@@ -18,15 +18,13 @@ $agreementStateDescriptor = new AgreementStateDescriptor();
|
||||
$agreementStateDescriptor->setNote("Suspending the agreement");
|
||||
|
||||
try {
|
||||
|
||||
$createdAgreement->suspend($agreementStateDescriptor, $apiContext);
|
||||
|
||||
// Lets get the updated Agreement Object
|
||||
$agreement = Agreement::get($createdAgreement->getId(), $apiContext);
|
||||
|
||||
} catch (Exception $ex) {
|
||||
// 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);
|
||||
}
|
||||
|
||||
|
||||
@@ -35,10 +35,9 @@ try {
|
||||
|
||||
// Lets get the updated Agreement Object
|
||||
$agreement = Agreement::get($createdAgreement->getId(), $apiContext);
|
||||
|
||||
} catch (Exception $ex) {
|
||||
// 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);
|
||||
}
|
||||
|
||||
|
||||
@@ -34,10 +34,9 @@ try {
|
||||
$createdPlan->update($patchRequest, $apiContext);
|
||||
|
||||
$plan = Plan::get($createdPlan->getId(), $apiContext);
|
||||
|
||||
} catch (Exception $ex) {
|
||||
// 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);
|
||||
}
|
||||
|
||||
|
||||
@@ -40,10 +40,9 @@ try {
|
||||
$createdPlan->update($patchRequest, $apiContext);
|
||||
|
||||
$plan = Plan::get($createdPlan->getId(), $apiContext);
|
||||
|
||||
} catch (Exception $ex) {
|
||||
// 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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user