Skip to content

Commit

Permalink
Merge pull request #611 from stripe/remi-add-terminal-delete
Browse files Browse the repository at this point in the history
Add support for Terminal Location and Reader deletion
  • Loading branch information
remi-stripe authored Mar 18, 2019
2 parents 1ffc751 + b89adbd commit 6f8030b
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ php:

env:
global:
- STRIPE_MOCK_VERSION=0.44.0
- STRIPE_MOCK_VERSION=0.49.0
matrix:
- AUTOLOAD=1
- AUTOLOAD=0
Expand Down
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);
}
}
2 changes: 1 addition & 1 deletion tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down

0 comments on commit 6f8030b

Please sign in to comment.