Add Stripe terminal and department variables API endpoints
This update introduces new endpoints for managing Stripe terminal readers, locations, and department-specific configurations. It also adds support for creating, updating, and retrieving department variables along with enhanced validation, logging, and permission checks. These updates improve integration and expand functionality for Stripe and department-related operations.
This commit is contained in:
@@ -5,6 +5,8 @@ namespace stripe\endpoints;
|
||||
use Exception;
|
||||
use Stripe\Collection;
|
||||
use Stripe\Exception\ApiErrorException;
|
||||
use Stripe\Terminal\Location;
|
||||
use Stripe\Terminal\Reader;
|
||||
use traits\stripe_endpoint_t;
|
||||
|
||||
class stripe_endpoint_readers
|
||||
@@ -22,5 +24,135 @@ class stripe_endpoint_readers
|
||||
return self::getClient()->terminal->readers->all();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all readers for a location
|
||||
* @throws ApiErrorException If the location is not set
|
||||
* @throws Exception If the location is not set
|
||||
*/
|
||||
public function listLocation(string $location_id): Collection
|
||||
{
|
||||
return self::getClient()->terminal->readers->all([
|
||||
'location' => $location_id
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a reader
|
||||
* @param string $label
|
||||
* @param string $location
|
||||
* @return Reader
|
||||
* @throws ApiErrorException
|
||||
* @throws Exception
|
||||
*/
|
||||
public function register(string $label, string $location): Reader
|
||||
{
|
||||
return self::getClient()->terminal->readers->create([
|
||||
'label' => $label,
|
||||
'location' => $location
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all locations
|
||||
* @return Collection
|
||||
* @throws ApiErrorException
|
||||
* @throws Exception
|
||||
*/
|
||||
public function listLocations(): Collection
|
||||
{
|
||||
return self::getClient()->terminal->locations->all();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a location
|
||||
* @param string $location_id
|
||||
* @return Location
|
||||
* @throws ApiErrorException
|
||||
* @throws Exception
|
||||
*/
|
||||
public function retrieveLocation(string $location_id): Location
|
||||
{
|
||||
return self::getClient()->terminal->locations->retrieve($location_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a reader
|
||||
* @param string $reader_id
|
||||
* @return Reader
|
||||
* @throws ApiErrorException
|
||||
* @throws Exception
|
||||
*/
|
||||
public function retrieve(string $reader_id): Reader
|
||||
{
|
||||
return self::getClient()->terminal->readers->retrieve($reader_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a location
|
||||
* @param string $label
|
||||
* @return Location
|
||||
* @throws ApiErrorException
|
||||
* @throws Exception
|
||||
*/
|
||||
public function registerLocation(string $label): Location
|
||||
{
|
||||
return self::getClient()->terminal->locations->create([
|
||||
'label' => $label
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update a location
|
||||
* @param string $location_id
|
||||
* @param string $label
|
||||
* @return Location
|
||||
* @throws ApiErrorException
|
||||
* @throws Exception
|
||||
*/
|
||||
public function updateLocation(string $location_id, string $label): Location
|
||||
{
|
||||
return self::getClient()->terminal->locations->update($location_id, [
|
||||
'label' => $label
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update a reader
|
||||
* @param string $reader_id
|
||||
* @param string $label
|
||||
* @return Reader
|
||||
* @throws ApiErrorException
|
||||
* @throws Exception
|
||||
*/
|
||||
public function update(string $reader_id, string $label): Reader
|
||||
{
|
||||
return self::getClient()->terminal->readers->update($reader_id, [
|
||||
'label' => $label
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a location
|
||||
* @param string $location_id
|
||||
* @return Location
|
||||
* @throws ApiErrorException
|
||||
* @throws Exception
|
||||
*/
|
||||
public function deleteLocation(string $location_id): Location
|
||||
{
|
||||
return self::getClient()->terminal->locations->delete($location_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a reader
|
||||
* @param string $reader_id
|
||||
* @return Reader
|
||||
* @throws ApiErrorException
|
||||
* @throws Exception
|
||||
*/
|
||||
public function delete(string $reader_id): Reader
|
||||
{
|
||||
return self::getClient()->terminal->readers->delete($reader_id);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user