diff options
Diffstat (limited to 'vendor/paypal/paypal-checkout-sdk/tests')
6 files changed, 266 insertions, 266 deletions
diff --git a/vendor/paypal/paypal-checkout-sdk/tests/Orders/OrdersAuthorizeTest.php b/vendor/paypal/paypal-checkout-sdk/tests/Orders/OrdersAuthorizeTest.php index 981ce26..3814853 100644 --- a/vendor/paypal/paypal-checkout-sdk/tests/Orders/OrdersAuthorizeTest.php +++ b/vendor/paypal/paypal-checkout-sdk/tests/Orders/OrdersAuthorizeTest.php @@ -1,26 +1,26 @@ -<?php - - - -namespace Test\Orders; - -use PHPUnit\Framework\TestCase; - -use PayPalCheckoutSdk\Orders\OrdersAuthorizeRequest; -use Test\TestHarness; - - -class OrdersAuthorizeTest extends TestCase -{ - public function testOrdersAuthorizeRequest() - { - $this->markTestSkipped("Need an approved Order ID to execute this test."); - $request = new OrdersAuthorizeRequest('ORDER-ID'); - $request->body = $this->buildRequestBody(); - - $client = TestHarness::client(); - $response = $client->execute($request); - $this->assertEquals(201, $response->statusCode); - $this->assertNotNull($response->result); - } -} +<?php
+
+
+
+namespace Test\Orders;
+
+use PHPUnit\Framework\TestCase;
+
+use PayPalCheckoutSdk\Orders\OrdersAuthorizeRequest;
+use Test\TestHarness;
+
+
+class OrdersAuthorizeTest extends TestCase
+{
+ public function testOrdersAuthorizeRequest()
+ {
+ $this->markTestSkipped("Need an approved Order ID to execute this test.");
+ $request = new OrdersAuthorizeRequest('ORDER-ID');
+ $request->body = $this->buildRequestBody();
+
+ $client = TestHarness::client();
+ $response = $client->execute($request);
+ $this->assertEquals(201, $response->statusCode);
+ $this->assertNotNull($response->result);
+ }
+}
diff --git a/vendor/paypal/paypal-checkout-sdk/tests/Orders/OrdersCaptureTest.php b/vendor/paypal/paypal-checkout-sdk/tests/Orders/OrdersCaptureTest.php index 683f70c..3e6f364 100644 --- a/vendor/paypal/paypal-checkout-sdk/tests/Orders/OrdersCaptureTest.php +++ b/vendor/paypal/paypal-checkout-sdk/tests/Orders/OrdersCaptureTest.php @@ -1,26 +1,26 @@ -<?php - - - -namespace Test\Orders; - -use PHPUnit\Framework\TestCase; - -use PayPalCheckoutSdk\Orders\OrdersCaptureRequest; -use Test\TestHarness; - - -class OrdersCaptureTest extends TestCase -{ - - public function testOrdersCaptureRequest() - { - $this->markTestSkipped("Need an approved Order ID to execute this test."); - $request = new OrdersCaptureRequest('ORDER-ID'); - - $client = TestHarness::client(); - $response = $client->execute($request); - $this->assertEquals(201, $response->statusCode); - $this->assertNotNull($response->result); - } -} +<?php
+
+
+
+namespace Test\Orders;
+
+use PHPUnit\Framework\TestCase;
+
+use PayPalCheckoutSdk\Orders\OrdersCaptureRequest;
+use Test\TestHarness;
+
+
+class OrdersCaptureTest extends TestCase
+{
+
+ public function testOrdersCaptureRequest()
+ {
+ $this->markTestSkipped("Need an approved Order ID to execute this test.");
+ $request = new OrdersCaptureRequest('ORDER-ID');
+
+ $client = TestHarness::client();
+ $response = $client->execute($request);
+ $this->assertEquals(201, $response->statusCode);
+ $this->assertNotNull($response->result);
+ }
+}
diff --git a/vendor/paypal/paypal-checkout-sdk/tests/Orders/OrdersCreateTest.php b/vendor/paypal/paypal-checkout-sdk/tests/Orders/OrdersCreateTest.php index d2d6dad..a53a10f 100644 --- a/vendor/paypal/paypal-checkout-sdk/tests/Orders/OrdersCreateTest.php +++ b/vendor/paypal/paypal-checkout-sdk/tests/Orders/OrdersCreateTest.php @@ -1,69 +1,69 @@ -<?php - - - -namespace Test\Orders; - -use PHPUnit\Framework\TestCase; - -use PayPalCheckoutSdk\Orders\OrdersCreateRequest; -use Test\TestHarness; - - -class OrdersCreateTest extends TestCase -{ - private static function buildRequestBody() - { - return [ - "intent" => "CAPTURE", - "purchase_units" => [[ - "reference_id" => "test_ref_id1", - "amount" => [ - "value" => "100.00", - "currency_code" => "USD" - ] - ]], - "redirect_urls" => [ - "cancel_url" => "https://example.com/cancel", - "return_url" => "https://example.com/return" - ] - ]; - } - - public static function create($client) { - $request = new OrdersCreateRequest(); - $request->prefer("return=representation"); - $request->body = self::buildRequestBody(); - return $client->execute($request); - } - - public function testOrdersCreateRequest() - { - $client = TestHarness::client(); - $response = self::create($client); - $this->assertEquals(201, $response->statusCode); - $this->assertNotNull($response->result); - - $createdOrder = $response->result; - $this->assertNotNull($createdOrder->id); - $this->assertNotNull($createdOrder->purchase_units); - $this->assertEquals(1, count($createdOrder->purchase_units)); - $firstPurchaseUnit = $createdOrder->purchase_units[0]; - $this->assertEquals("test_ref_id1", $firstPurchaseUnit->reference_id); - $this->assertEquals("USD", $firstPurchaseUnit->amount->currency_code); - $this->assertEquals("100.00", $firstPurchaseUnit->amount->value); - - $this->assertNotNull($createdOrder->create_time); - $this->assertNotNull($createdOrder->links); - $foundApproveUrl = false; - foreach ($createdOrder->links as $link) { - if ("approve" === $link->rel) { - $foundApproveUrl = true; - $this->assertNotNull($link->href); - $this->assertEquals("GET", $link->method); - } - } - $this->assertTrue($foundApproveUrl); - $this->assertEquals("CREATED", $createdOrder->status); - } -} +<?php
+
+
+
+namespace Test\Orders;
+
+use PHPUnit\Framework\TestCase;
+
+use PayPalCheckoutSdk\Orders\OrdersCreateRequest;
+use Test\TestHarness;
+
+
+class OrdersCreateTest extends TestCase
+{
+ private static function buildRequestBody()
+ {
+ return [
+ "intent" => "CAPTURE",
+ "purchase_units" => [[
+ "reference_id" => "test_ref_id1",
+ "amount" => [
+ "value" => "100.00",
+ "currency_code" => "USD"
+ ]
+ ]],
+ "redirect_urls" => [
+ "cancel_url" => "https://example.com/cancel",
+ "return_url" => "https://example.com/return"
+ ]
+ ];
+ }
+
+ public static function create($client) {
+ $request = new OrdersCreateRequest();
+ $request->prefer("return=representation");
+ $request->body = self::buildRequestBody();
+ return $client->execute($request);
+ }
+
+ public function testOrdersCreateRequest()
+ {
+ $client = TestHarness::client();
+ $response = self::create($client);
+ $this->assertEquals(201, $response->statusCode);
+ $this->assertNotNull($response->result);
+
+ $createdOrder = $response->result;
+ $this->assertNotNull($createdOrder->id);
+ $this->assertNotNull($createdOrder->purchase_units);
+ $this->assertEquals(1, count($createdOrder->purchase_units));
+ $firstPurchaseUnit = $createdOrder->purchase_units[0];
+ $this->assertEquals("test_ref_id1", $firstPurchaseUnit->reference_id);
+ $this->assertEquals("USD", $firstPurchaseUnit->amount->currency_code);
+ $this->assertEquals("100.00", $firstPurchaseUnit->amount->value);
+
+ $this->assertNotNull($createdOrder->create_time);
+ $this->assertNotNull($createdOrder->links);
+ $foundApproveUrl = false;
+ foreach ($createdOrder->links as $link) {
+ if ("approve" === $link->rel) {
+ $foundApproveUrl = true;
+ $this->assertNotNull($link->href);
+ $this->assertEquals("GET", $link->method);
+ }
+ }
+ $this->assertTrue($foundApproveUrl);
+ $this->assertEquals("CREATED", $createdOrder->status);
+ }
+}
diff --git a/vendor/paypal/paypal-checkout-sdk/tests/Orders/OrdersGetTest.php b/vendor/paypal/paypal-checkout-sdk/tests/Orders/OrdersGetTest.php index 12fb9b0..dd20521 100644 --- a/vendor/paypal/paypal-checkout-sdk/tests/Orders/OrdersGetTest.php +++ b/vendor/paypal/paypal-checkout-sdk/tests/Orders/OrdersGetTest.php @@ -1,48 +1,48 @@ -<?php - - - -namespace Test\Orders; - -use PHPUnit\Framework\TestCase; - -use PayPalCheckoutSdk\Orders\OrdersGetRequest; -use Test\TestHarness; - - -class OrdersGetTest extends TestCase -{ - - public function testOrdersGetRequest() - { - $client = TestHarness::client(); - $createdOrder = OrdersCreateTest::create($client); - - $request = new OrdersGetRequest($createdOrder->result->id); - $response = $client->execute($request); - $this->assertEquals(200, $response->statusCode); - $this->assertNotNull($response->result); - - $createdOrder = $response->result; - $this->assertNotNull($createdOrder->id); - $this->assertNotNull($createdOrder->purchase_units); - $this->assertEquals(1, count($createdOrder->purchase_units)); - $firstPurchaseUnit = $createdOrder->purchase_units[0]; - $this->assertEquals("test_ref_id1", $firstPurchaseUnit->reference_id); - $this->assertEquals("USD", $firstPurchaseUnit->amount->currency_code); - $this->assertEquals("100.00", $firstPurchaseUnit->amount->value); - - $this->assertNotNull($createdOrder->create_time); - $this->assertNotNull($createdOrder->links); - $foundApproveUrl = false; - foreach ($createdOrder->links as $link) { - if ("approve" === $link->rel) { - $foundApproveUrl = true; - $this->assertNotNull($link->href); - $this->assertEquals("GET", $link->method); - } - } - $this->assertTrue($foundApproveUrl); - $this->assertEquals("CREATED", $createdOrder->status); - } -} +<?php
+
+
+
+namespace Test\Orders;
+
+use PHPUnit\Framework\TestCase;
+
+use PayPalCheckoutSdk\Orders\OrdersGetRequest;
+use Test\TestHarness;
+
+
+class OrdersGetTest extends TestCase
+{
+
+ public function testOrdersGetRequest()
+ {
+ $client = TestHarness::client();
+ $createdOrder = OrdersCreateTest::create($client);
+
+ $request = new OrdersGetRequest($createdOrder->result->id);
+ $response = $client->execute($request);
+ $this->assertEquals(200, $response->statusCode);
+ $this->assertNotNull($response->result);
+
+ $createdOrder = $response->result;
+ $this->assertNotNull($createdOrder->id);
+ $this->assertNotNull($createdOrder->purchase_units);
+ $this->assertEquals(1, count($createdOrder->purchase_units));
+ $firstPurchaseUnit = $createdOrder->purchase_units[0];
+ $this->assertEquals("test_ref_id1", $firstPurchaseUnit->reference_id);
+ $this->assertEquals("USD", $firstPurchaseUnit->amount->currency_code);
+ $this->assertEquals("100.00", $firstPurchaseUnit->amount->value);
+
+ $this->assertNotNull($createdOrder->create_time);
+ $this->assertNotNull($createdOrder->links);
+ $foundApproveUrl = false;
+ foreach ($createdOrder->links as $link) {
+ if ("approve" === $link->rel) {
+ $foundApproveUrl = true;
+ $this->assertNotNull($link->href);
+ $this->assertEquals("GET", $link->method);
+ }
+ }
+ $this->assertTrue($foundApproveUrl);
+ $this->assertEquals("CREATED", $createdOrder->status);
+ }
+}
diff --git a/vendor/paypal/paypal-checkout-sdk/tests/Orders/OrdersPatchTest.php b/vendor/paypal/paypal-checkout-sdk/tests/Orders/OrdersPatchTest.php index 1eaa307..1b3e18c 100644 --- a/vendor/paypal/paypal-checkout-sdk/tests/Orders/OrdersPatchTest.php +++ b/vendor/paypal/paypal-checkout-sdk/tests/Orders/OrdersPatchTest.php @@ -1,73 +1,73 @@ -<?php - - - -namespace Test\Orders; - -use PHPUnit\Framework\TestCase; - -use PayPalCheckoutSdk\Orders\OrdersPatchRequest; -use PayPalCheckoutSdk\Orders\OrdersGetRequest; -use Test\TestHarness; - - -class OrdersPatchTest extends TestCase -{ - private function buildRequestBody() - { - return [ - [ - "op" => "add", - "path" => "/purchase_units/@reference_id=='test_ref_id1'/description", - "value" => "added_description" - ], - [ - "op" => "replace", - "path" => "/purchase_units/@reference_id=='test_ref_id1'/amount", - "value" => [ - "currency_code" => "USD", - "value" => "200.00" - ] - ] - ]; - } - - public function testOrdersPatchRequest() - { - $client = TestHarness::client(); - $createdOrder = OrdersCreateTest::create($client); - - $request = new OrdersPatchRequest($createdOrder->result->id); - $request->body = $this->buildRequestBody(); - $response = $client->execute($request); - $this->assertEquals(204, $response->statusCode); - - $request = new OrdersGetRequest($createdOrder->result->id); - $response = $client->execute($request); - $this->assertEquals(200, $response->statusCode); - $this->assertNotNull($response->result); - - $createdOrder = $response->result; - $this->assertNotNull($createdOrder->id); - $this->assertNotNull($createdOrder->purchase_units); - $this->assertEquals(1, count($createdOrder->purchase_units)); - $firstPurchaseUnit = $createdOrder->purchase_units[0]; - $this->assertEquals("test_ref_id1", $firstPurchaseUnit->reference_id); - $this->assertEquals("USD", $firstPurchaseUnit->amount->currency_code); - $this->assertEquals("200.00", $firstPurchaseUnit->amount->value); - $this->assertEquals("added_description", $firstPurchaseUnit->description); - - $this->assertNotNull($createdOrder->create_time); - $this->assertNotNull($createdOrder->links); - $foundApproveUrl = false; - foreach ($createdOrder->links as $link) { - if ("approve" === $link->rel) { - $foundApproveUrl = true; - $this->assertNotNull($link->href); - $this->assertEquals("GET", $link->method); - } - } - $this->assertTrue($foundApproveUrl); - $this->assertEquals("CREATED", $createdOrder->status); - } -} +<?php
+
+
+
+namespace Test\Orders;
+
+use PHPUnit\Framework\TestCase;
+
+use PayPalCheckoutSdk\Orders\OrdersPatchRequest;
+use PayPalCheckoutSdk\Orders\OrdersGetRequest;
+use Test\TestHarness;
+
+
+class OrdersPatchTest extends TestCase
+{
+ private function buildRequestBody()
+ {
+ return [
+ [
+ "op" => "add",
+ "path" => "/purchase_units/@reference_id=='test_ref_id1'/description",
+ "value" => "added_description"
+ ],
+ [
+ "op" => "replace",
+ "path" => "/purchase_units/@reference_id=='test_ref_id1'/amount",
+ "value" => [
+ "currency_code" => "USD",
+ "value" => "200.00"
+ ]
+ ]
+ ];
+ }
+
+ public function testOrdersPatchRequest()
+ {
+ $client = TestHarness::client();
+ $createdOrder = OrdersCreateTest::create($client);
+
+ $request = new OrdersPatchRequest($createdOrder->result->id);
+ $request->body = $this->buildRequestBody();
+ $response = $client->execute($request);
+ $this->assertEquals(204, $response->statusCode);
+
+ $request = new OrdersGetRequest($createdOrder->result->id);
+ $response = $client->execute($request);
+ $this->assertEquals(200, $response->statusCode);
+ $this->assertNotNull($response->result);
+
+ $createdOrder = $response->result;
+ $this->assertNotNull($createdOrder->id);
+ $this->assertNotNull($createdOrder->purchase_units);
+ $this->assertEquals(1, count($createdOrder->purchase_units));
+ $firstPurchaseUnit = $createdOrder->purchase_units[0];
+ $this->assertEquals("test_ref_id1", $firstPurchaseUnit->reference_id);
+ $this->assertEquals("USD", $firstPurchaseUnit->amount->currency_code);
+ $this->assertEquals("200.00", $firstPurchaseUnit->amount->value);
+ $this->assertEquals("added_description", $firstPurchaseUnit->description);
+
+ $this->assertNotNull($createdOrder->create_time);
+ $this->assertNotNull($createdOrder->links);
+ $foundApproveUrl = false;
+ foreach ($createdOrder->links as $link) {
+ if ("approve" === $link->rel) {
+ $foundApproveUrl = true;
+ $this->assertNotNull($link->href);
+ $this->assertEquals("GET", $link->method);
+ }
+ }
+ $this->assertTrue($foundApproveUrl);
+ $this->assertEquals("CREATED", $createdOrder->status);
+ }
+}
diff --git a/vendor/paypal/paypal-checkout-sdk/tests/TestHarness.php b/vendor/paypal/paypal-checkout-sdk/tests/TestHarness.php index 66b4abe..32596e1 100644 --- a/vendor/paypal/paypal-checkout-sdk/tests/TestHarness.php +++ b/vendor/paypal/paypal-checkout-sdk/tests/TestHarness.php @@ -1,24 +1,24 @@ -<?php - -namespace Test; - -use PayPalCheckoutSdk\Core\PayPalHttpClient; -use PayPalCheckoutSdk\Core\SandboxEnvironment; - -ini_set('error_reporting', E_ALL); // or error_reporting(E_ALL); -ini_set('display_errors', '1'); -ini_set('display_startup_errors', '1'); - -class TestHarness -{ - public static function client() - { - return new PayPalHttpClient(self::environment()); - } - public static function environment() - { - $clientId = getenv("CLIENT_ID") ?: "<<PAYPAL-CLIENT-ID>>"; - $clientSecret = getenv("CLIENT_SECRET") ?: "<<PAYPAL-CLIENT-SECRET>>"; - return new SandboxEnvironment($clientId, $clientSecret); - } -} +<?php
+
+namespace Test;
+
+use PayPalCheckoutSdk\Core\PayPalHttpClient;
+use PayPalCheckoutSdk\Core\SandboxEnvironment;
+
+ini_set('error_reporting', E_ALL); // or error_reporting(E_ALL);
+ini_set('display_errors', '1');
+ini_set('display_startup_errors', '1');
+
+class TestHarness
+{
+ public static function client()
+ {
+ return new PayPalHttpClient(self::environment());
+ }
+ public static function environment()
+ {
+ $clientId = getenv("CLIENT_ID") ?: "<<PAYPAL-CLIENT-ID>>";
+ $clientSecret = getenv("CLIENT_SECRET") ?: "<<PAYPAL-CLIENT-SECRET>>";
+ return new SandboxEnvironment($clientId, $clientSecret);
+ }
+}
|