From 75160b12821f7f4299cce7f0b69c83c1502ae071 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anton=20Luka=20=C5=A0ijanec?= Date: Mon, 27 May 2024 13:08:29 +0200 Subject: 2024-02-19 upstream --- .../AuthorizeIntentExamples/AuthorizeOrder.php | 120 +++--- .../AuthorizeIntentExamples/CaptureOrder.php | 108 ++--- .../AuthorizeIntentExamples/CreateOrder.php | 472 ++++++++++----------- .../samples/AuthorizeIntentExamples/RunAll.php | 164 +++---- .../samples/CaptureIntentExamples/CaptureOrder.php | 118 +++--- .../samples/CaptureIntentExamples/CreateOrder.php | 356 ++++++++-------- .../samples/CaptureIntentExamples/RunAll.php | 148 +++---- .../paypal-checkout-sdk/samples/ErrorSample.php | 188 ++++---- .../paypal-checkout-sdk/samples/GetOrder.php | 106 ++--- .../paypal-checkout-sdk/samples/PatchOrder.php | 162 +++---- .../paypal-checkout-sdk/samples/PayPalClient.php | 70 +-- .../paypal-checkout-sdk/samples/RefundOrder.php | 120 +++--- 12 files changed, 1066 insertions(+), 1066 deletions(-) (limited to 'vendor/paypal/paypal-checkout-sdk/samples') diff --git a/vendor/paypal/paypal-checkout-sdk/samples/AuthorizeIntentExamples/AuthorizeOrder.php b/vendor/paypal/paypal-checkout-sdk/samples/AuthorizeIntentExamples/AuthorizeOrder.php index 06cc775..a8b68c5 100644 --- a/vendor/paypal/paypal-checkout-sdk/samples/AuthorizeIntentExamples/AuthorizeOrder.php +++ b/vendor/paypal/paypal-checkout-sdk/samples/AuthorizeIntentExamples/AuthorizeOrder.php @@ -1,61 +1,61 @@ -body = self::buildRequestBody(); - - $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 "Authorization ID: {$response->result->purchase_units[0]->payments->authorizations[0]->id}\n"; - print "Links:\n"; - foreach($response->result->links as $link) - { - print "\t{$link->rel}: {$link->href}\tCall Type: {$link->method}\n"; - } - print "Authorization Links:\n"; - foreach($response->result->purchase_units[0]->payments->authorizations[0]->links as $link) - { - print "\t{$link->rel}: {$link->href}\tCall Type: {$link->method}\n"; - } - // To toggle printing the whole response body comment/uncomment below line - echo json_encode($response->result, JSON_PRETTY_PRINT), "\n"; - } - return $response; - } -} - -/** - * This is an driver function which invokes authorize order. - */ -if (!count(debug_backtrace())) -{ - AuthorizeOrder::authorizeOrder('1U242387CB956380X', true); +body = self::buildRequestBody(); + + $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 "Authorization ID: {$response->result->purchase_units[0]->payments->authorizations[0]->id}\n"; + print "Links:\n"; + foreach($response->result->links as $link) + { + print "\t{$link->rel}: {$link->href}\tCall Type: {$link->method}\n"; + } + print "Authorization Links:\n"; + foreach($response->result->purchase_units[0]->payments->authorizations[0]->links as $link) + { + print "\t{$link->rel}: {$link->href}\tCall Type: {$link->method}\n"; + } + // To toggle printing the whole response body comment/uncomment below line + echo json_encode($response->result, JSON_PRETTY_PRINT), "\n"; + } + return $response; + } +} + +/** + * This is an driver function which invokes authorize order. + */ +if (!count(debug_backtrace())) +{ + AuthorizeOrder::authorizeOrder('1U242387CB956380X', true); } \ No newline at end of file diff --git a/vendor/paypal/paypal-checkout-sdk/samples/AuthorizeIntentExamples/CaptureOrder.php b/vendor/paypal/paypal-checkout-sdk/samples/AuthorizeIntentExamples/CaptureOrder.php index 9dffd38..8917dc4 100644 --- a/vendor/paypal/paypal-checkout-sdk/samples/AuthorizeIntentExamples/CaptureOrder.php +++ b/vendor/paypal/paypal-checkout-sdk/samples/AuthorizeIntentExamples/CaptureOrder.php @@ -1,55 +1,55 @@ -body = self::buildRequestBody(); - $client = PayPalClient::client(); - $response = $client->execute($request); - - if ($debug) - { - print "Status Code: {$response->statusCode}\n"; - print "Status: {$response->result->status}\n"; - print "Capture 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"; - } - // To toggle printing the whole response body comment/uncomment below line - echo json_encode($response->result, JSON_PRETTY_PRINT), "\n"; - } - return $response; - } -} - -/** - * Driver function for invoking the capture flow. - */ -if (!count(debug_backtrace())) -{ - CaptureOrder::captureOrder('18A38324BV5456924', true); +body = self::buildRequestBody(); + $client = PayPalClient::client(); + $response = $client->execute($request); + + if ($debug) + { + print "Status Code: {$response->statusCode}\n"; + print "Status: {$response->result->status}\n"; + print "Capture 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"; + } + // To toggle printing the whole response body comment/uncomment below line + echo json_encode($response->result, JSON_PRETTY_PRINT), "\n"; + } + return $response; + } +} + +/** + * Driver function for invoking the capture flow. + */ +if (!count(debug_backtrace())) +{ + CaptureOrder::captureOrder('18A38324BV5456924', true); } \ No newline at end of file diff --git a/vendor/paypal/paypal-checkout-sdk/samples/AuthorizeIntentExamples/CreateOrder.php b/vendor/paypal/paypal-checkout-sdk/samples/AuthorizeIntentExamples/CreateOrder.php index e8f96ce..99b20e0 100644 --- a/vendor/paypal/paypal-checkout-sdk/samples/AuthorizeIntentExamples/CreateOrder.php +++ b/vendor/paypal/paypal-checkout-sdk/samples/AuthorizeIntentExamples/CreateOrder.php @@ -1,237 +1,237 @@ - 'AUTHORIZE', - 'application_context' => - array( - 'return_url' => 'https://example.com/return', - 'cancel_url' => 'https://example.com/cancel', - 'brand_name' => 'EXAMPLE INC', - 'locale' => 'en-US', - 'landing_page' => 'BILLING', - 'shipping_preference' => 'SET_PROVIDED_ADDRESS', - 'user_action' => 'PAY_NOW', - ), - 'purchase_units' => - array( - 0 => - array( - 'reference_id' => 'PUHF', - 'description' => 'Sporting Goods', - 'custom_id' => 'CUST-HighFashions', - 'soft_descriptor' => 'HighFashions', - 'amount' => - array( - 'currency_code' => 'USD', - 'value' => '220.00', - 'breakdown' => - array( - 'item_total' => - array( - 'currency_code' => 'USD', - 'value' => '180.00', - ), - 'shipping' => - array( - 'currency_code' => 'USD', - 'value' => '20.00', - ), - 'handling' => - array( - 'currency_code' => 'USD', - 'value' => '10.00', - ), - 'tax_total' => - array( - 'currency_code' => 'USD', - 'value' => '20.00', - ), - 'shipping_discount' => - array( - 'currency_code' => 'USD', - 'value' => '10.00', - ), - ), - ), - 'items' => - array( - 0 => - array( - 'name' => 'T-Shirt', - 'description' => 'Green XL', - 'sku' => 'sku01', - 'unit_amount' => - array( - 'currency_code' => 'USD', - 'value' => '90.00', - ), - 'tax' => - array( - 'currency_code' => 'USD', - 'value' => '10.00', - ), - 'quantity' => '1', - 'category' => 'PHYSICAL_GOODS', - ), - 1 => - array( - 'name' => 'Shoes', - 'description' => 'Running, Size 10.5', - 'sku' => 'sku02', - 'unit_amount' => - array( - 'currency_code' => 'USD', - 'value' => '45.00', - ), - 'tax' => - array( - 'currency_code' => 'USD', - 'value' => '5.00', - ), - 'quantity' => '2', - 'category' => 'PHYSICAL_GOODS', - ), - ), - 'shipping' => - array( - 'method' => 'United States Postal Service', - 'name' => - array( - 'full_name' => 'John Doe', - ), - 'address' => - array( - 'address_line_1' => '123 Townsend St', - 'address_line_2' => 'Floor 6', - 'admin_area_2' => 'San Francisco', - 'admin_area_1' => 'CA', - 'postal_code' => '94107', - 'country_code' => 'US', - ), - ), - ), - ), - ); - } - - /** - * Setting up the JSON request body for creating the Order with minimum request body. The Intent in the - * request body should be set as "AUTHORIZE" for authorize intent flow. - * - */ - private static function buildMinimumRequestBody() - { - return array( - 'intent' => 'AUTHORIZE', - 'application_context' => - array( - 'return_url' => 'https://example.com/return', - 'cancel_url' => 'https://example.com/cancel' - ), - 'purchase_units' => - array( - 0 => - array( - 'amount' => - array( - 'currency_code' => 'USD', - 'value' => '220.00' - ) - ) - ) - ); - } - - /** - * This is the sample function which can be used to create an order. It uses the - * JSON body returned by buildRequestBody() to create an new Order. - */ - public static function createOrder($debug=false) - { - $request = new OrdersCreateRequest(); - $request->headers["prefer"] = "return=representation"; - $request->body = CreateOrder::buildRequestBody(); - - $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 "Intent: {$response->result->intent}\n"; - print "Links:\n"; - foreach($response->result->links as $link) - { - print "\t{$link->rel}: {$link->href}\tCall Type: {$link->method}\n"; - } - - print "Gross Amount: {$response->result->purchase_units[0]->amount->currency_code} {$response->result->purchase_units[0]->amount->value}\n"; - - // 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 sample function which can be used to create an order. It uses the - * JSON body returned by buildMinimumRequestBody() to create an new Order. - */ - public static function createOrderWithMinimumBody($debug=false) - { - $request = new OrdersCreateRequest(); - $request->headers["prefer"] = "return=representation"; - $request->body = CreateOrder::buildMinimumRequestBody(); - - $client = PayPalClient::client(); - $response = $client->execute($request); - if ($debug) - { - print "Order With Minimum Body\n"; - print "Status Code: {$response->statusCode}\n"; - print "Status: {$response->result->status}\n"; - print "Order ID: {$response->result->id}\n"; - print "Intent: {$response->result->intent}\n"; - print "Links:\n"; - foreach($response->result->links as $link) - { - print "\t{$link->rel}: {$link->href}\tCall Type: {$link->method}\n"; - } - - print "Gross Amount: {$response->result->purchase_units[0]->amount->currency_code} {$response->result->purchase_units[0]->amount->value}\n"; - - // To toggle printing the whole response body comment/uncomment below line - echo json_encode($response->result, JSON_PRETTY_PRINT), "\n"; - } - - - return $response; - } -} - - - -if (!count(debug_backtrace())) -{ - CreateOrder::createOrder(true); - CreateOrder::createOrderWithMinimumBody(true); + 'AUTHORIZE', + 'application_context' => + array( + 'return_url' => 'https://example.com/return', + 'cancel_url' => 'https://example.com/cancel', + 'brand_name' => 'EXAMPLE INC', + 'locale' => 'en-US', + 'landing_page' => 'BILLING', + 'shipping_preference' => 'SET_PROVIDED_ADDRESS', + 'user_action' => 'PAY_NOW', + ), + 'purchase_units' => + array( + 0 => + array( + 'reference_id' => 'PUHF', + 'description' => 'Sporting Goods', + 'custom_id' => 'CUST-HighFashions', + 'soft_descriptor' => 'HighFashions', + 'amount' => + array( + 'currency_code' => 'USD', + 'value' => '220.00', + 'breakdown' => + array( + 'item_total' => + array( + 'currency_code' => 'USD', + 'value' => '180.00', + ), + 'shipping' => + array( + 'currency_code' => 'USD', + 'value' => '20.00', + ), + 'handling' => + array( + 'currency_code' => 'USD', + 'value' => '10.00', + ), + 'tax_total' => + array( + 'currency_code' => 'USD', + 'value' => '20.00', + ), + 'shipping_discount' => + array( + 'currency_code' => 'USD', + 'value' => '10.00', + ), + ), + ), + 'items' => + array( + 0 => + array( + 'name' => 'T-Shirt', + 'description' => 'Green XL', + 'sku' => 'sku01', + 'unit_amount' => + array( + 'currency_code' => 'USD', + 'value' => '90.00', + ), + 'tax' => + array( + 'currency_code' => 'USD', + 'value' => '10.00', + ), + 'quantity' => '1', + 'category' => 'PHYSICAL_GOODS', + ), + 1 => + array( + 'name' => 'Shoes', + 'description' => 'Running, Size 10.5', + 'sku' => 'sku02', + 'unit_amount' => + array( + 'currency_code' => 'USD', + 'value' => '45.00', + ), + 'tax' => + array( + 'currency_code' => 'USD', + 'value' => '5.00', + ), + 'quantity' => '2', + 'category' => 'PHYSICAL_GOODS', + ), + ), + 'shipping' => + array( + 'method' => 'United States Postal Service', + 'name' => + array( + 'full_name' => 'John Doe', + ), + 'address' => + array( + 'address_line_1' => '123 Townsend St', + 'address_line_2' => 'Floor 6', + 'admin_area_2' => 'San Francisco', + 'admin_area_1' => 'CA', + 'postal_code' => '94107', + 'country_code' => 'US', + ), + ), + ), + ), + ); + } + + /** + * Setting up the JSON request body for creating the Order with minimum request body. The Intent in the + * request body should be set as "AUTHORIZE" for authorize intent flow. + * + */ + private static function buildMinimumRequestBody() + { + return array( + 'intent' => 'AUTHORIZE', + 'application_context' => + array( + 'return_url' => 'https://example.com/return', + 'cancel_url' => 'https://example.com/cancel' + ), + 'purchase_units' => + array( + 0 => + array( + 'amount' => + array( + 'currency_code' => 'USD', + 'value' => '220.00' + ) + ) + ) + ); + } + + /** + * This is the sample function which can be used to create an order. It uses the + * JSON body returned by buildRequestBody() to create an new Order. + */ + public static function createOrder($debug=false) + { + $request = new OrdersCreateRequest(); + $request->headers["prefer"] = "return=representation"; + $request->body = CreateOrder::buildRequestBody(); + + $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 "Intent: {$response->result->intent}\n"; + print "Links:\n"; + foreach($response->result->links as $link) + { + print "\t{$link->rel}: {$link->href}\tCall Type: {$link->method}\n"; + } + + print "Gross Amount: {$response->result->purchase_units[0]->amount->currency_code} {$response->result->purchase_units[0]->amount->value}\n"; + + // 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 sample function which can be used to create an order. It uses the + * JSON body returned by buildMinimumRequestBody() to create an new Order. + */ + public static function createOrderWithMinimumBody($debug=false) + { + $request = new OrdersCreateRequest(); + $request->headers["prefer"] = "return=representation"; + $request->body = CreateOrder::buildMinimumRequestBody(); + + $client = PayPalClient::client(); + $response = $client->execute($request); + if ($debug) + { + print "Order With Minimum Body\n"; + print "Status Code: {$response->statusCode}\n"; + print "Status: {$response->result->status}\n"; + print "Order ID: {$response->result->id}\n"; + print "Intent: {$response->result->intent}\n"; + print "Links:\n"; + foreach($response->result->links as $link) + { + print "\t{$link->rel}: {$link->href}\tCall Type: {$link->method}\n"; + } + + print "Gross Amount: {$response->result->purchase_units[0]->amount->currency_code} {$response->result->purchase_units[0]->amount->value}\n"; + + // To toggle printing the whole response body comment/uncomment below line + echo json_encode($response->result, JSON_PRETTY_PRINT), "\n"; + } + + + return $response; + } +} + + + +if (!count(debug_backtrace())) +{ + CreateOrder::createOrder(true); + CreateOrder::createOrderWithMinimumBody(true); } \ No newline at end of file diff --git a/vendor/paypal/paypal-checkout-sdk/samples/AuthorizeIntentExamples/RunAll.php b/vendor/paypal/paypal-checkout-sdk/samples/AuthorizeIntentExamples/RunAll.php index 708be9d..002f4e2 100644 --- a/vendor/paypal/paypal-checkout-sdk/samples/AuthorizeIntentExamples/RunAll.php +++ b/vendor/paypal/paypal-checkout-sdk/samples/AuthorizeIntentExamples/RunAll.php @@ -1,82 +1,82 @@ -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 "Authorizing Order...\n"; -$response = AuthorizeOrder::authorizeOrder($orderId); -$authId = ""; - -if ($response->statusCode == 201) -{ - print "Authorized Successfully\n"; - $authId = $response->result->purchase_units[0]->payments->authorizations[0]->id; -} -else { - exit(1); -} - -print "\nCapturing Order...\n"; -$response = CaptureOrder::captureOrder($authId); -if ($response->statusCode == 201) -{ - print "Captured Successfully\n"; - print "Status Code: {$response->statusCode}\n"; - print "Status: {$response->result->status}\n"; - $captureId = $response->result->id; - print "Capture ID: {$captureId}\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); -} - -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); -} +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 "Authorizing Order...\n"; +$response = AuthorizeOrder::authorizeOrder($orderId); +$authId = ""; + +if ($response->statusCode == 201) +{ + print "Authorized Successfully\n"; + $authId = $response->result->purchase_units[0]->payments->authorizations[0]->id; +} +else { + exit(1); +} + +print "\nCapturing Order...\n"; +$response = CaptureOrder::captureOrder($authId); +if ($response->statusCode == 201) +{ + print "Captured Successfully\n"; + print "Status Code: {$response->statusCode}\n"; + print "Status: {$response->result->status}\n"; + $captureId = $response->result->id; + print "Capture ID: {$captureId}\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); +} + +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); +} 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 @@ -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 - * Approved Order Id to capture the order payment. - */ -if (!count(debug_backtrace())) -{ - CaptureOrder::captureOrder('0F105083N67049335', true); +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 + * Approved Order Id to capture the order payment. + */ +if (!count(debug_backtrace())) +{ + CaptureOrder::captureOrder('0F105083N67049335', true); } \ No newline at end of file diff --git a/vendor/paypal/paypal-checkout-sdk/samples/CaptureIntentExamples/CreateOrder.php b/vendor/paypal/paypal-checkout-sdk/samples/CaptureIntentExamples/CreateOrder.php index 37a8e63..0bb1764 100644 --- a/vendor/paypal/paypal-checkout-sdk/samples/CaptureIntentExamples/CreateOrder.php +++ b/vendor/paypal/paypal-checkout-sdk/samples/CaptureIntentExamples/CreateOrder.php @@ -1,178 +1,178 @@ - 'CAPTURE', - 'application_context' => - array( - 'return_url' => 'https://example.com/return', - 'cancel_url' => 'https://example.com/cancel', - 'brand_name' => 'EXAMPLE INC', - 'locale' => 'en-US', - 'landing_page' => 'BILLING', - 'shipping_preference' => 'SET_PROVIDED_ADDRESS', - 'user_action' => 'PAY_NOW', - ), - 'purchase_units' => - array( - 0 => - array( - 'reference_id' => 'PUHF', - 'description' => 'Sporting Goods', - 'custom_id' => 'CUST-HighFashions', - 'soft_descriptor' => 'HighFashions', - 'amount' => - array( - 'currency_code' => 'USD', - 'value' => '220.00', - 'breakdown' => - array( - 'item_total' => - array( - 'currency_code' => 'USD', - 'value' => '180.00', - ), - 'shipping' => - array( - 'currency_code' => 'USD', - 'value' => '20.00', - ), - 'handling' => - array( - 'currency_code' => 'USD', - 'value' => '10.00', - ), - 'tax_total' => - array( - 'currency_code' => 'USD', - 'value' => '20.00', - ), - 'shipping_discount' => - array( - 'currency_code' => 'USD', - 'value' => '10.00', - ), - ), - ), - 'items' => - array( - 0 => - array( - 'name' => 'T-Shirt', - 'description' => 'Green XL', - 'sku' => 'sku01', - 'unit_amount' => - array( - 'currency_code' => 'USD', - 'value' => '90.00', - ), - 'tax' => - array( - 'currency_code' => 'USD', - 'value' => '10.00', - ), - 'quantity' => '1', - 'category' => 'PHYSICAL_GOODS', - ), - 1 => - array( - 'name' => 'Shoes', - 'description' => 'Running, Size 10.5', - 'sku' => 'sku02', - 'unit_amount' => - array( - 'currency_code' => 'USD', - 'value' => '45.00', - ), - 'tax' => - array( - 'currency_code' => 'USD', - 'value' => '5.00', - ), - 'quantity' => '2', - 'category' => 'PHYSICAL_GOODS', - ), - ), - 'shipping' => - array( - 'method' => 'United States Postal Service', - 'name' => - array( - 'full_name' => 'John Doe', - ), - 'address' => - array( - 'address_line_1' => '123 Townsend St', - 'address_line_2' => 'Floor 6', - 'admin_area_2' => 'San Francisco', - 'admin_area_1' => 'CA', - 'postal_code' => '94107', - 'country_code' => 'US', - ), - ), - ), - ), - ); - } - - /** - * This is the sample function which can be sued to create an order. It uses the - * JSON body returned by buildRequestBody() to create an new Order. - */ - public static function createOrder($debug=false) - { - $request = new OrdersCreateRequest(); - $request->headers["prefer"] = "return=representation"; - $request->body = self::buildRequestBody(); - - $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 "Intent: {$response->result->intent}\n"; - print "Links:\n"; - foreach($response->result->links as $link) - { - print "\t{$link->rel}: {$link->href}\tCall Type: {$link->method}\n"; - } - // 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 createOrder function to create - * an sample order. - */ -if (!count(debug_backtrace())) -{ - CreateOrder::createOrder(true); -} - - - + 'CAPTURE', + 'application_context' => + array( + 'return_url' => 'https://example.com/return', + 'cancel_url' => 'https://example.com/cancel', + 'brand_name' => 'EXAMPLE INC', + 'locale' => 'en-US', + 'landing_page' => 'BILLING', + 'shipping_preference' => 'SET_PROVIDED_ADDRESS', + 'user_action' => 'PAY_NOW', + ), + 'purchase_units' => + array( + 0 => + array( + 'reference_id' => 'PUHF', + 'description' => 'Sporting Goods', + 'custom_id' => 'CUST-HighFashions', + 'soft_descriptor' => 'HighFashions', + 'amount' => + array( + 'currency_code' => 'USD', + 'value' => '220.00', + 'breakdown' => + array( + 'item_total' => + array( + 'currency_code' => 'USD', + 'value' => '180.00', + ), + 'shipping' => + array( + 'currency_code' => 'USD', + 'value' => '20.00', + ), + 'handling' => + array( + 'currency_code' => 'USD', + 'value' => '10.00', + ), + 'tax_total' => + array( + 'currency_code' => 'USD', + 'value' => '20.00', + ), + 'shipping_discount' => + array( + 'currency_code' => 'USD', + 'value' => '10.00', + ), + ), + ), + 'items' => + array( + 0 => + array( + 'name' => 'T-Shirt', + 'description' => 'Green XL', + 'sku' => 'sku01', + 'unit_amount' => + array( + 'currency_code' => 'USD', + 'value' => '90.00', + ), + 'tax' => + array( + 'currency_code' => 'USD', + 'value' => '10.00', + ), + 'quantity' => '1', + 'category' => 'PHYSICAL_GOODS', + ), + 1 => + array( + 'name' => 'Shoes', + 'description' => 'Running, Size 10.5', + 'sku' => 'sku02', + 'unit_amount' => + array( + 'currency_code' => 'USD', + 'value' => '45.00', + ), + 'tax' => + array( + 'currency_code' => 'USD', + 'value' => '5.00', + ), + 'quantity' => '2', + 'category' => 'PHYSICAL_GOODS', + ), + ), + 'shipping' => + array( + 'method' => 'United States Postal Service', + 'name' => + array( + 'full_name' => 'John Doe', + ), + 'address' => + array( + 'address_line_1' => '123 Townsend St', + 'address_line_2' => 'Floor 6', + 'admin_area_2' => 'San Francisco', + 'admin_area_1' => 'CA', + 'postal_code' => '94107', + 'country_code' => 'US', + ), + ), + ), + ), + ); + } + + /** + * This is the sample function which can be sued to create an order. It uses the + * JSON body returned by buildRequestBody() to create an new Order. + */ + public static function createOrder($debug=false) + { + $request = new OrdersCreateRequest(); + $request->headers["prefer"] = "return=representation"; + $request->body = self::buildRequestBody(); + + $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 "Intent: {$response->result->intent}\n"; + print "Links:\n"; + foreach($response->result->links as $link) + { + print "\t{$link->rel}: {$link->href}\tCall Type: {$link->method}\n"; + } + // 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 createOrder function to create + * an sample order. + */ +if (!count(debug_backtrace())) +{ + CreateOrder::createOrder(true); +} + + + 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 @@ -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); -} +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); +} diff --git a/vendor/paypal/paypal-checkout-sdk/samples/ErrorSample.php b/vendor/paypal/paypal-checkout-sdk/samples/ErrorSample.php index 8daf96b..ee6401b 100644 --- a/vendor/paypal/paypal-checkout-sdk/samples/ErrorSample.php +++ b/vendor/paypal/paypal-checkout-sdk/samples/ErrorSample.php @@ -1,94 +1,94 @@ - $val) - { - $pretty .= $pre . ucfirst($key) .": "; - if (strcmp(gettype($val), "array") == 0){ - $pretty .= "\n"; - $sno = 1; - foreach ($val as $value) - { - $pretty .= $pre . "\t" . $sno++ . ":\n"; - $pretty .= self::prettyPrint($value, $pre . "\t\t"); - } - } - else { - $pretty .= $val . "\n"; - } - } - return $pretty; - } - - /** - * Body has no required parameters (intent, purchase_units) - */ - public static function createError1() - { - $request = new OrdersCreateRequest(); - $request->body = "{}"; - print "Request Body: {}\n\n"; - - print "Response:\n"; - try{ - $client = PayPalClient::client(); - $response = $client->execute($request); - } - catch(HttpException $exception){ - $message = json_decode($exception->getMessage(), true); - print "Status Code: {$exception->statusCode}\n"; - print(self::prettyPrint($message)); - } - } - - /** - * Body has invalid parameter value for intent - */ - public static function createError2() - { - $request = new OrdersCreateRequest(); - $request->body = array ( - 'intent' => 'INVALID', - 'purchase_units' => - array ( - 0 => - array ( - 'amount' => - array ( - 'currency_code' => 'USD', - 'value' => '100.00', - ), - ), - ), - ); - print "Request Body:\n" . json_encode($request->body, JSON_PRETTY_PRINT) . "\n\n"; - - try{ - $client = PayPalClient::client(); - $response = $client->execute($request); - } - catch(HttpException $exception){ - print "Response:\n"; - $message = json_decode($exception->getMessage(), true); - print "Status Code: {$exception->statusCode}\n"; - print(self::prettyPrint($message)); - } - - } -} - -print "Calling createError1 (Body has no required parameters (intent, purchase_units))\n"; -ErrorSample::createError1(); - -print "\n\nCalling createError2 (Body has invalid parameter value for intent)\n"; -ErrorSample::createError2(); + $val) + { + $pretty .= $pre . ucfirst($key) .": "; + if (strcmp(gettype($val), "array") == 0){ + $pretty .= "\n"; + $sno = 1; + foreach ($val as $value) + { + $pretty .= $pre . "\t" . $sno++ . ":\n"; + $pretty .= self::prettyPrint($value, $pre . "\t\t"); + } + } + else { + $pretty .= $val . "\n"; + } + } + return $pretty; + } + + /** + * Body has no required parameters (intent, purchase_units) + */ + public static function createError1() + { + $request = new OrdersCreateRequest(); + $request->body = "{}"; + print "Request Body: {}\n\n"; + + print "Response:\n"; + try{ + $client = PayPalClient::client(); + $response = $client->execute($request); + } + catch(HttpException $exception){ + $message = json_decode($exception->getMessage(), true); + print "Status Code: {$exception->statusCode}\n"; + print(self::prettyPrint($message)); + } + } + + /** + * Body has invalid parameter value for intent + */ + public static function createError2() + { + $request = new OrdersCreateRequest(); + $request->body = array ( + 'intent' => 'INVALID', + 'purchase_units' => + array ( + 0 => + array ( + 'amount' => + array ( + 'currency_code' => 'USD', + 'value' => '100.00', + ), + ), + ), + ); + print "Request Body:\n" . json_encode($request->body, JSON_PRETTY_PRINT) . "\n\n"; + + try{ + $client = PayPalClient::client(); + $response = $client->execute($request); + } + catch(HttpException $exception){ + print "Response:\n"; + $message = json_decode($exception->getMessage(), true); + print "Status Code: {$exception->statusCode}\n"; + print(self::prettyPrint($message)); + } + + } +} + +print "Calling createError1 (Body has no required parameters (intent, purchase_units))\n"; +ErrorSample::createError1(); + +print "\n\nCalling createError2 (Body has invalid parameter value for intent)\n"; +ErrorSample::createError2(); diff --git a/vendor/paypal/paypal-checkout-sdk/samples/GetOrder.php b/vendor/paypal/paypal-checkout-sdk/samples/GetOrder.php index f89ac9d..7fefdbf 100644 --- a/vendor/paypal/paypal-checkout-sdk/samples/GetOrder.php +++ b/vendor/paypal/paypal-checkout-sdk/samples/GetOrder.php @@ -1,54 +1,54 @@ -execute(new OrdersGetRequest($orderId)); - /** - * Enable below line to print complete response as JSON. - */ - //print json_encode($response->result); - print "Status Code: {$response->statusCode}\n"; - print "Status: {$response->result->status}\n"; - print "Order ID: {$response->result->id}\n"; - print "Intent: {$response->result->intent}\n"; - print "Links:\n"; - foreach($response->result->links as $link) - { - print "\t{$link->rel}: {$link->href}\tCall Type: {$link->method}\n"; - } - - print "Gross Amount: {$response->result->purchase_units[0]->amount->currency_code} {$response->result->purchase_units[0]->amount->value}\n"; - - // To toggle printing the whole response body comment/uncomment below line - echo json_encode($response->result, JSON_PRETTY_PRINT), "\n"; - } -} - -/** - * This is the driver function which invokes the getOrder function to retrieve - * an sample order. - * - * To get the correct Order id, we are using the createOrder to create new order - * and then we are using the newly created order id. - */ -if (!count(debug_backtrace())) -{ - $createdOrder = CreateOrder::createOrder()->result; - GetOrder::getOrder($createdOrder ->id); +execute(new OrdersGetRequest($orderId)); + /** + * Enable below line to print complete response as JSON. + */ + //print json_encode($response->result); + print "Status Code: {$response->statusCode}\n"; + print "Status: {$response->result->status}\n"; + print "Order ID: {$response->result->id}\n"; + print "Intent: {$response->result->intent}\n"; + print "Links:\n"; + foreach($response->result->links as $link) + { + print "\t{$link->rel}: {$link->href}\tCall Type: {$link->method}\n"; + } + + print "Gross Amount: {$response->result->purchase_units[0]->amount->currency_code} {$response->result->purchase_units[0]->amount->value}\n"; + + // To toggle printing the whole response body comment/uncomment below line + echo json_encode($response->result, JSON_PRETTY_PRINT), "\n"; + } +} + +/** + * This is the driver function which invokes the getOrder function to retrieve + * an sample order. + * + * To get the correct Order id, we are using the createOrder to create new order + * and then we are using the newly created order id. + */ +if (!count(debug_backtrace())) +{ + $createdOrder = CreateOrder::createOrder()->result; + GetOrder::getOrder($createdOrder ->id); } \ No newline at end of file diff --git a/vendor/paypal/paypal-checkout-sdk/samples/PatchOrder.php b/vendor/paypal/paypal-checkout-sdk/samples/PatchOrder.php index cba8152..e8f45b1 100644 --- a/vendor/paypal/paypal-checkout-sdk/samples/PatchOrder.php +++ b/vendor/paypal/paypal-checkout-sdk/samples/PatchOrder.php @@ -1,82 +1,82 @@ - - array ( - 'op' => 'replace', - 'path' => '/intent', - 'value' => 'CAPTURE', - ), - 1 => - array ( - 'op' => 'replace', - 'path' => '/purchase_units/@reference_id==\'PUHF\'/amount', - 'value' => - array ( - 'currency_code' => 'USD', - 'value' => '200.00', - 'breakdown' => - array ( - 'item_total' => - array ( - 'currency_code' => 'USD', - 'value' => '180.00', - ), - 'tax_total' => - array ( - 'currency_code' => 'USD', - 'value' => '20.00', - ), - ), - ), - ), - ); - } - - public static function patchOrder($orderId) - { - - $client = PayPalClient::client(); - - $request = new OrdersPatchRequest($orderId); - $request->body = PatchOrder::buildRequestBody(); - $client->execute($request); - - $response = $client->execute(new OrdersGetRequest($orderId)); - - print "Status Code: {$response->statusCode}\n"; - print "Status: {$response->result->status}\n"; - print "Order ID: {$response->result->id}\n"; - print "Intent: {$response->result->intent}\n"; - print "Links:\n"; - foreach($response->result->links as $link) - { - print "\t{$link->rel}: {$link->href}\tCall Type: {$link->method}\n"; - } - - print "Gross Amount: {$response->result->purchase_units[0]->amount->currency_code} {$response->result->purchase_units[0]->amount->value}\n"; - - // To toggle printing the whole response body comment/uncomment below line - echo json_encode($response->result, JSON_PRETTY_PRINT), "\n"; - } -} - -if (!count(debug_backtrace())) -{ - print "Before PATCH:\n"; - $createdOrder = CreateOrder::createOrder(true)->result; - print "\nAfter PATCH (Changed Intent and Amount):\n"; - PatchOrder::patchOrder($createdOrder->id); + + array ( + 'op' => 'replace', + 'path' => '/intent', + 'value' => 'CAPTURE', + ), + 1 => + array ( + 'op' => 'replace', + 'path' => '/purchase_units/@reference_id==\'PUHF\'/amount', + 'value' => + array ( + 'currency_code' => 'USD', + 'value' => '200.00', + 'breakdown' => + array ( + 'item_total' => + array ( + 'currency_code' => 'USD', + 'value' => '180.00', + ), + 'tax_total' => + array ( + 'currency_code' => 'USD', + 'value' => '20.00', + ), + ), + ), + ), + ); + } + + public static function patchOrder($orderId) + { + + $client = PayPalClient::client(); + + $request = new OrdersPatchRequest($orderId); + $request->body = PatchOrder::buildRequestBody(); + $client->execute($request); + + $response = $client->execute(new OrdersGetRequest($orderId)); + + print "Status Code: {$response->statusCode}\n"; + print "Status: {$response->result->status}\n"; + print "Order ID: {$response->result->id}\n"; + print "Intent: {$response->result->intent}\n"; + print "Links:\n"; + foreach($response->result->links as $link) + { + print "\t{$link->rel}: {$link->href}\tCall Type: {$link->method}\n"; + } + + print "Gross Amount: {$response->result->purchase_units[0]->amount->currency_code} {$response->result->purchase_units[0]->amount->value}\n"; + + // To toggle printing the whole response body comment/uncomment below line + echo json_encode($response->result, JSON_PRETTY_PRINT), "\n"; + } +} + +if (!count(debug_backtrace())) +{ + print "Before PATCH:\n"; + $createdOrder = CreateOrder::createOrder(true)->result; + print "\nAfter PATCH (Changed Intent and Amount):\n"; + PatchOrder::patchOrder($createdOrder->id); } \ No newline at end of file diff --git a/vendor/paypal/paypal-checkout-sdk/samples/PayPalClient.php b/vendor/paypal/paypal-checkout-sdk/samples/PayPalClient.php index 397b8d2..c0bfebf 100644 --- a/vendor/paypal/paypal-checkout-sdk/samples/PayPalClient.php +++ b/vendor/paypal/paypal-checkout-sdk/samples/PayPalClient.php @@ -1,35 +1,35 @@ ->"; - $clientSecret = getenv("CLIENT_SECRET") ?: "<>"; - return new SandboxEnvironment($clientId, $clientSecret); - } -} +>"; + $clientSecret = getenv("CLIENT_SECRET") ?: "<>"; + return new SandboxEnvironment($clientId, $clientSecret); + } +} diff --git a/vendor/paypal/paypal-checkout-sdk/samples/RefundOrder.php b/vendor/paypal/paypal-checkout-sdk/samples/RefundOrder.php index fc9428f..2968189 100644 --- a/vendor/paypal/paypal-checkout-sdk/samples/RefundOrder.php +++ b/vendor/paypal/paypal-checkout-sdk/samples/RefundOrder.php @@ -1,60 +1,60 @@ - - array( - 'value' => '20.00', - 'currency_code' => 'USD' - ) - ); - } - - /** - * This function can be used to preform refund on the capture. - */ - public static function refundOrder($captureId, $debug=false) - { - $request = new CapturesRefundRequest($captureId); - $request->body = self::buildRequestBody(); - $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"; - } - // 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 refund capture function with - * Capture Id to perform refund on capture. - */ -if (!count(debug_backtrace())) -{ - RefundOrder::refundOrder('8XL09935J2224701N', true); -} + + array( + 'value' => '20.00', + 'currency_code' => 'USD' + ) + ); + } + + /** + * This function can be used to preform refund on the capture. + */ + public static function refundOrder($captureId, $debug=false) + { + $request = new CapturesRefundRequest($captureId); + $request->body = self::buildRequestBody(); + $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"; + } + // 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 refund capture function with + * Capture Id to perform refund on capture. + */ +if (!count(debug_backtrace())) +{ + RefundOrder::refundOrder('8XL09935J2224701N', true); +} -- cgit v1.2.3