From b89adbdc08ab1041db20adebd42e415afb2d5d41 Mon Sep 17 00:00:00 2001 From: Remi Jannel Date: Fri, 15 Mar 2019 22:07:20 -0700 Subject: [PATCH] Add support for Terminal Location and Reader deletion --- .travis.yml | 2 +- lib/Terminal/Location.php | 9 +++------ lib/Terminal/Reader.php | 9 +++++++-- tests/Stripe/Terminal/LocationTest.php | 11 +++++++++++ tests/Stripe/Terminal/ReaderTest.php | 11 +++++++++++ tests/bootstrap.php | 2 +- 6 files changed, 34 insertions(+), 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5270afd49..9e7a08055 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,7 +13,7 @@ php: env: global: - - STRIPE_MOCK_VERSION=0.44.0 + - STRIPE_MOCK_VERSION=0.49.0 matrix: - AUTOLOAD=1 - AUTOLOAD=0 diff --git a/lib/Terminal/Location.php b/lib/Terminal/Location.php index 37845dad3..8628b060b 100644 --- a/lib/Terminal/Location.php +++ b/lib/Terminal/Location.php @@ -7,13 +7,9 @@ * * @property string $id * @property string $object + * @property mixed $address + * @property bool $deleted * @property string $display_name - * @property string $address_city - * @property string $address_country - * @property string $address_line1 - * @property string $address_line2 - * @property string $address_state - * @property string $address_postal_code * * @package Stripe\Terminal */ @@ -23,6 +19,7 @@ class Location extends \Stripe\ApiResource use \Stripe\ApiOperations\All; use \Stripe\ApiOperations\Create; + use \Stripe\ApiOperations\Delete; use \Stripe\ApiOperations\Retrieve; use \Stripe\ApiOperations\Update; } diff --git a/lib/Terminal/Reader.php b/lib/Terminal/Reader.php index 3caf8f7d0..f11ccd564 100644 --- a/lib/Terminal/Reader.php +++ b/lib/Terminal/Reader.php @@ -7,10 +7,14 @@ * * @property string $id * @property string $object + * @property bool $deleted + * @property string $device_sw_version * @property string $device_type - * @property string $serial_number - * @property string $label * @property string $ip_address + * @property string $label + * @property string $location + * @property string $serial_number + * @property string $status * * @package Stripe\Terminal */ @@ -20,6 +24,7 @@ class Reader extends \Stripe\ApiResource use \Stripe\ApiOperations\All; use \Stripe\ApiOperations\Create; + use \Stripe\ApiOperations\Delete; use \Stripe\ApiOperations\Retrieve; use \Stripe\ApiOperations\Update; } diff --git a/tests/Stripe/Terminal/LocationTest.php b/tests/Stripe/Terminal/LocationTest.php index d14b0d3ac..232e45beb 100644 --- a/tests/Stripe/Terminal/LocationTest.php +++ b/tests/Stripe/Terminal/LocationTest.php @@ -81,4 +81,15 @@ public function testIsCreatable() ]); $this->assertInstanceOf("Stripe\\Terminal\\Location", $resource); } + + public function testIsDeletable() + { + $resource = Location::retrieve(self::TEST_RESOURCE_ID); + $this->expectsRequest( + 'delete', + '/v1/terminal/locations/' . self::TEST_RESOURCE_ID + ); + $resource->delete(); + $this->assertInstanceOf("Stripe\\Terminal\\Location", $resource); + } } diff --git a/tests/Stripe/Terminal/ReaderTest.php b/tests/Stripe/Terminal/ReaderTest.php index 190772840..43bbb8f3b 100644 --- a/tests/Stripe/Terminal/ReaderTest.php +++ b/tests/Stripe/Terminal/ReaderTest.php @@ -63,4 +63,15 @@ public function testIsCreatable() $resource = Reader::create(['registration_code' => 'a-b-c']); $this->assertInstanceOf("Stripe\\Terminal\\Reader", $resource); } + + public function testIsDeletable() + { + $resource = Reader::retrieve(self::TEST_RESOURCE_ID); + $this->expectsRequest( + 'delete', + '/v1/terminal/readers/' . self::TEST_RESOURCE_ID + ); + $resource->delete(); + $this->assertInstanceOf("Stripe\\Terminal\\Reader", $resource); + } } diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 84f567c8e..afa7e079b 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -2,7 +2,7 @@ require_once(__DIR__ . '/StripeMock.php'); -define("MOCK_MINIMUM_VERSION", "0.44.0"); +define("MOCK_MINIMUM_VERSION", "0.49.0"); if (\Stripe\StripeMock::start()) { register_shutdown_function('\Stripe\StripeMock::stop');