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/RunAll.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 'vendor/paypal/paypal-checkout-sdk/samples/CaptureIntentExamples/RunAll.php')
-rw-r--r-- | vendor/paypal/paypal-checkout-sdk/samples/CaptureIntentExamples/RunAll.php | 148 |
1 files changed, 74 insertions, 74 deletions
diff --git a/vendor/paypal/paypal-checkout-sdk/samples/CaptureIntentExamples/RunAll.php b/vendor/paypal/paypal-checkout-sdk/samples/CaptureIntentExamples/RunAll.php index e576ff0..3c1390a 100644 --- a/vendor/paypal/paypal-checkout-sdk/samples/CaptureIntentExamples/RunAll.php +++ b/vendor/paypal/paypal-checkout-sdk/samples/CaptureIntentExamples/RunAll.php @@ -1,74 +1,74 @@ -<?php - -require __DIR__ . '/../../vendor/autoload.php'; - -use Sample\CaptureIntentExamples\CreateOrder; -use Sample\CaptureIntentExamples\CaptureOrder; -use Sample\RefundOrder; - -$order = CreateOrder::createOrder(); - -print "Creating Order...\n"; -$orderId = ""; -if ($order->statusCode == 201) -{ - $orderId = $order->result->id; - print "Links:\n"; - for ($i = 0; $i < count($order->result->links); ++$i) - { - $link = $order->result->links[$i]; - print "\t{$link->rel}: {$link->href}\tCall Type: {$link->method}\n"; - } - print "Created Successfully\n"; - print "Copy approve link and paste it in browser. Login with buyer account and follow the instructions.\nOnce approved hit enter...\n"; -} -else { - exit(1); -} - -$handle = fopen ("php://stdin","r"); -$line = fgets($handle); -fclose($handle); - -print "Capturing Order...\n"; -$response = CaptureOrder::captureOrder($orderId); -if ($response->statusCode == 201) -{ - print "Captured Successfully\n"; - print "Status Code: {$response->statusCode}\n"; - print "Status: {$response->result->status}\n"; - print "Order ID: {$response->result->id}\n"; - print "Links:\n"; - for ($i = 0; $i < count($response->result->links); ++$i){ - $link = $response->result->links[$i]; - print "\t{$link->rel}: {$link->href}\tCall Type: {$link->method}\n"; - } - foreach($response->result->purchase_units as $purchase_unit) - { - foreach($purchase_unit->payments->captures as $capture) - { - $captureId = $capture->id; - } - } -} -else { - exit(1); -} - -print "\nRefunding Order...\n"; -$response = RefundOrder::refundOrder($captureId); -if ($response->statusCode == 201) -{ - print "Refunded Successfully\n"; - print "Status Code: {$response->statusCode}\n"; - print "Status: {$response->result->status}\n"; - print "Refund ID: {$response->result->id}\n"; - print "Links:\n"; - for ($i = 0; $i < count($response->result->links); ++$i){ - $link = $response->result->links[$i]; - print "\t{$link->rel}: {$link->href}\tCall Type: {$link->method}\n"; - } -} -else { - exit(1); -} +<?php
+
+require __DIR__ . '/../../vendor/autoload.php';
+
+use Sample\CaptureIntentExamples\CreateOrder;
+use Sample\CaptureIntentExamples\CaptureOrder;
+use Sample\RefundOrder;
+
+$order = CreateOrder::createOrder();
+
+print "Creating Order...\n";
+$orderId = "";
+if ($order->statusCode == 201)
+{
+ $orderId = $order->result->id;
+ print "Links:\n";
+ for ($i = 0; $i < count($order->result->links); ++$i)
+ {
+ $link = $order->result->links[$i];
+ print "\t{$link->rel}: {$link->href}\tCall Type: {$link->method}\n";
+ }
+ print "Created Successfully\n";
+ print "Copy approve link and paste it in browser. Login with buyer account and follow the instructions.\nOnce approved hit enter...\n";
+}
+else {
+ exit(1);
+}
+
+$handle = fopen ("php://stdin","r");
+$line = fgets($handle);
+fclose($handle);
+
+print "Capturing Order...\n";
+$response = CaptureOrder::captureOrder($orderId);
+if ($response->statusCode == 201)
+{
+ print "Captured Successfully\n";
+ print "Status Code: {$response->statusCode}\n";
+ print "Status: {$response->result->status}\n";
+ print "Order ID: {$response->result->id}\n";
+ print "Links:\n";
+ for ($i = 0; $i < count($response->result->links); ++$i){
+ $link = $response->result->links[$i];
+ print "\t{$link->rel}: {$link->href}\tCall Type: {$link->method}\n";
+ }
+ foreach($response->result->purchase_units as $purchase_unit)
+ {
+ foreach($purchase_unit->payments->captures as $capture)
+ {
+ $captureId = $capture->id;
+ }
+ }
+}
+else {
+ exit(1);
+}
+
+print "\nRefunding Order...\n";
+$response = RefundOrder::refundOrder($captureId);
+if ($response->statusCode == 201)
+{
+ print "Refunded Successfully\n";
+ print "Status Code: {$response->statusCode}\n";
+ print "Status: {$response->result->status}\n";
+ print "Refund ID: {$response->result->id}\n";
+ print "Links:\n";
+ for ($i = 0; $i < count($response->result->links); ++$i){
+ $link = $response->result->links[$i];
+ print "\t{$link->rel}: {$link->href}\tCall Type: {$link->method}\n";
+ }
+}
+else {
+ exit(1);
+}
|