diff options
author | Anton Luka Šijanec <anton@sijanec.eu> | 2024-05-27 13:08:29 +0200 |
---|---|---|
committer | Anton Luka Šijanec <anton@sijanec.eu> | 2024-05-27 13:08:29 +0200 |
commit | 75160b12821f7f4299cce7f0b69c83c1502ae071 (patch) | |
tree | 27e25e4ccaef45f0c58b22831164050d1af1d4db /vendor/paypal/paypal-checkout-sdk/samples/CaptureIntentExamples/CaptureOrder.php | |
parent | prvi-commit (diff) | |
download | 1ka-75160b12821f7f4299cce7f0b69c83c1502ae071.tar 1ka-75160b12821f7f4299cce7f0b69c83c1502ae071.tar.gz 1ka-75160b12821f7f4299cce7f0b69c83c1502ae071.tar.bz2 1ka-75160b12821f7f4299cce7f0b69c83c1502ae071.tar.lz 1ka-75160b12821f7f4299cce7f0b69c83c1502ae071.tar.xz 1ka-75160b12821f7f4299cce7f0b69c83c1502ae071.tar.zst 1ka-75160b12821f7f4299cce7f0b69c83c1502ae071.zip |
Diffstat (limited to '')
-rw-r--r-- | vendor/paypal/paypal-checkout-sdk/samples/CaptureIntentExamples/CaptureOrder.php | 118 |
1 files changed, 59 insertions, 59 deletions
diff --git a/vendor/paypal/paypal-checkout-sdk/samples/CaptureIntentExamples/CaptureOrder.php b/vendor/paypal/paypal-checkout-sdk/samples/CaptureIntentExamples/CaptureOrder.php index 931d5d9..6a0bacb 100644 --- a/vendor/paypal/paypal-checkout-sdk/samples/CaptureIntentExamples/CaptureOrder.php +++ b/vendor/paypal/paypal-checkout-sdk/samples/CaptureIntentExamples/CaptureOrder.php @@ -1,60 +1,60 @@ -<?php - - -namespace Sample\CaptureIntentExamples; - -require __DIR__ . '/../../vendor/autoload.php'; -use Sample\PayPalClient; -use PayPalCheckoutSdk\Orders\OrdersCaptureRequest; - -class CaptureOrder -{ - - /** - * This function can be used to capture an order payment by passing the approved - * order id as argument. - * - * @param orderId - * @param debug - * @returns - */ - public static function captureOrder($orderId, $debug=false) - { - $request = new OrdersCaptureRequest($orderId); - - $client = PayPalClient::client(); - $response = $client->execute($request); - if ($debug) - { - print "Status Code: {$response->statusCode}\n"; - print "Status: {$response->result->status}\n"; - print "Order ID: {$response->result->id}\n"; - print "Links:\n"; - foreach($response->result->links as $link) - { - print "\t{$link->rel}: {$link->href}\tCall Type: {$link->method}\n"; - } - print "Capture Ids:\n"; - foreach($response->result->purchase_units as $purchase_unit) - { - foreach($purchase_unit->payments->captures as $capture) - { - print "\t{$capture->id}"; - } - } - // To toggle printing the whole response body comment/uncomment below line - echo json_encode($response->result, JSON_PRETTY_PRINT), "\n"; - } - - return $response; - } -} - -/** - * This is the driver function which invokes the captureOrder function with - * <b>Approved</b> Order Id to capture the order payment. - */ -if (!count(debug_backtrace())) -{ - CaptureOrder::captureOrder('0F105083N67049335', true); +<?php
+
+
+namespace Sample\CaptureIntentExamples;
+
+require __DIR__ . '/../../vendor/autoload.php';
+use Sample\PayPalClient;
+use PayPalCheckoutSdk\Orders\OrdersCaptureRequest;
+
+class CaptureOrder
+{
+
+ /**
+ * This function can be used to capture an order payment by passing the approved
+ * order id as argument.
+ *
+ * @param orderId
+ * @param debug
+ * @returns
+ */
+ public static function captureOrder($orderId, $debug=false)
+ {
+ $request = new OrdersCaptureRequest($orderId);
+
+ $client = PayPalClient::client();
+ $response = $client->execute($request);
+ if ($debug)
+ {
+ print "Status Code: {$response->statusCode}\n";
+ print "Status: {$response->result->status}\n";
+ print "Order ID: {$response->result->id}\n";
+ print "Links:\n";
+ foreach($response->result->links as $link)
+ {
+ print "\t{$link->rel}: {$link->href}\tCall Type: {$link->method}\n";
+ }
+ print "Capture Ids:\n";
+ foreach($response->result->purchase_units as $purchase_unit)
+ {
+ foreach($purchase_unit->payments->captures as $capture)
+ {
+ print "\t{$capture->id}";
+ }
+ }
+ // To toggle printing the whole response body comment/uncomment below line
+ echo json_encode($response->result, JSON_PRETTY_PRINT), "\n";
+ }
+
+ return $response;
+ }
+}
+
+/**
+ * This is the driver function which invokes the captureOrder function with
+ * <b>Approved</b> Order Id to capture the order payment.
+ */
+if (!count(debug_backtrace()))
+{
+ CaptureOrder::captureOrder('0F105083N67049335', true);
}
\ No newline at end of file |