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 {
|
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);
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
@@ -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 {
|
||||||
@@ -36,7 +35,6 @@ if (isset($_GET['success']) && $_GET['success'] == 'true') {
|
|||||||
|
|
||||||
// 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);
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
@@ -18,12 +18,10 @@ $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);
|
||||||
|
|||||||
@@ -35,7 +35,6 @@ 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);
|
||||||
|
|||||||
@@ -34,7 +34,6 @@ 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);
|
||||||
|
|||||||
@@ -40,7 +40,6 @@ 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);
|
||||||
|
|||||||
@@ -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 '
|
||||||
|
|||||||
@@ -23,8 +23,6 @@ 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);
|
||||||
@@ -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" />';
|
||||||
|
|
||||||
|
|||||||
@@ -9,10 +9,8 @@ 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);
|
||||||
|
|||||||
@@ -21,13 +21,11 @@ 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);
|
||||||
|
|||||||
@@ -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 {
|
||||||
@@ -25,5 +24,4 @@ if (isset($_GET['success']) && $_GET['success'] == 'true') {
|
|||||||
|
|
||||||
// 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);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
@@ -23,6 +23,6 @@ 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("List subscribed webhook event types", "WebhookEventTypeList",null, null, $output);
|
ResultPrinter::printResult("List subscribed webhook event types", "WebhookEventTypeList", null, null, $output);
|
||||||
|
|
||||||
return $output;
|
return $output;
|
||||||
|
|||||||
@@ -24,6 +24,6 @@ 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("List all webhooks", "WebhookList",null, null, $output);
|
ResultPrinter::printResult("List all webhooks", "WebhookList", null, null, $output);
|
||||||
|
|
||||||
return $output;
|
return $output;
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -84,7 +84,6 @@ 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);
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
@@ -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,7 +20,6 @@ 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);
|
||||||
|
|||||||
@@ -45,7 +45,6 @@ if (isset($_GET['success']) && $_GET['success'] == 'true') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
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);
|
||||||
|
|||||||
@@ -46,7 +46,6 @@ if (isset($_GET['success']) && $_GET['success'] == 'true') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
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);
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ if (isset($_GET['success']) && $_GET['success'] == 'true') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
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);
|
||||||
|
|||||||
@@ -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();
|
||||||
@@ -27,7 +26,6 @@ if (isset($_GET['success']) && $_GET['success'] == 'true') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
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);
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
@@ -81,7 +81,6 @@ $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);
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user