Skip to content

Commit

Permalink
Add support for Terminal Location and Reader deletion
Browse files Browse the repository at this point in the history
  • Loading branch information
remi-stripe committed Mar 16, 2019
1 parent 1ffc751 commit 2b909b8
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 8 deletions.
9 changes: 3 additions & 6 deletions lib/Terminal/Location.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand All @@ -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;
}
9 changes: 7 additions & 2 deletions lib/Terminal/Reader.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand All @@ -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;
}
11 changes: 11 additions & 0 deletions tests/Stripe/Terminal/LocationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
11 changes: 11 additions & 0 deletions tests/Stripe/Terminal/ReaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

0 comments on commit 2b909b8

Please sign in to comment.