From 2b909b8107d4368c03f421a5e21521c47c965e68 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 --- lib/Terminal/Location.php | 9 +++------ lib/Terminal/Reader.php | 9 +++++++-- tests/Stripe/Terminal/LocationTest.php | 11 +++++++++++ tests/Stripe/Terminal/ReaderTest.php | 11 +++++++++++ 4 files changed, 32 insertions(+), 8 deletions(-) diff --git a/lib/Terminal/Location.php b/lib/Terminal/Location.php index 37845dad33..8628b060b6 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 3caf8f7d04..f11ccd564d 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 d14b0d3ac4..232e45beb9 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 1907728400..43bbb8f3bd 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); + } }