summaryrefslogtreecommitdiffstats
path: root/vendor/paypal/paypal-checkout-sdk/samples/RefundOrder.php
diff options
context:
space:
mode:
authorAnton Luka Šijanec <anton@sijanec.eu>2024-05-27 13:08:29 +0200
committerAnton Luka Šijanec <anton@sijanec.eu>2024-05-27 13:08:29 +0200
commit75160b12821f7f4299cce7f0b69c83c1502ae071 (patch)
tree27e25e4ccaef45f0c58b22831164050d1af1d4db /vendor/paypal/paypal-checkout-sdk/samples/RefundOrder.php
parentprvi-commit (diff)
download1ka-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/RefundOrder.php120
1 files changed, 60 insertions, 60 deletions
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 @@
-<?php
-
-namespace Sample;
-
-require __DIR__ . '/../vendor/autoload.php';
-use Sample\PayPalClient;
-use PayPalCheckoutSdk\Payments\CapturesRefundRequest;
-
-class RefundOrder
-{
-
- /**
- * Function to create an refund capture request. Payload can be updated to issue partial refund.
- */
- public static function buildRequestBody()
- {
- return array(
- 'amount' =>
- 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);
-}
+<?php
+
+namespace Sample;
+
+require __DIR__ . '/../vendor/autoload.php';
+use Sample\PayPalClient;
+use PayPalCheckoutSdk\Payments\CapturesRefundRequest;
+
+class RefundOrder
+{
+
+ /**
+ * Function to create an refund capture request. Payload can be updated to issue partial refund.
+ */
+ public static function buildRequestBody()
+ {
+ return array(
+ 'amount' =>
+ 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);
+}