118 lines
4.6 KiB
PHP
118 lines
4.6 KiB
PHP
<?php
|
|
|
|
// File generated from our OpenAPI spec
|
|
|
|
namespace Stripe\Tax;
|
|
|
|
/**
|
|
* A Tax <code>Registration</code> lets us know that your business is registered to collect tax on payments within a region, enabling you to <a href="https://stripe.com/docs/tax">automatically collect tax</a>.
|
|
*
|
|
* Stripe doesn't register on your behalf with the relevant authorities when you create a Tax <code>Registration</code> object. For more information on how to register to collect tax, see <a href="https://stripe.com/docs/tax/registering">our guide</a>.
|
|
*
|
|
* Related guide: <a href="https://stripe.com/docs/tax/registrations-api">Using the Registrations API</a>
|
|
*
|
|
* @property string $id Unique identifier for the object.
|
|
* @property string $object String representing the object's type. Objects of the same type share the same value.
|
|
* @property int $active_from Time at which the registration becomes active. Measured in seconds since the Unix epoch.
|
|
* @property string $country Two-letter country code (<a href="https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2">ISO 3166-1 alpha-2</a>).
|
|
* @property \Stripe\StripeObject $country_options
|
|
* @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
|
|
* @property null|int $expires_at If set, the registration stops being active at this time. If not set, the registration will be active indefinitely. Measured in seconds since the Unix epoch.
|
|
* @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
|
|
* @property string $status The status of the registration. This field is present for convenience and can be deduced from <code>active_from</code> and <code>expires_at</code>.
|
|
*/
|
|
class Registration extends \Stripe\ApiResource
|
|
{
|
|
const OBJECT_NAME = 'tax.registration';
|
|
|
|
use \Stripe\ApiOperations\Update;
|
|
|
|
const STATUS_ACTIVE = 'active';
|
|
const STATUS_EXPIRED = 'expired';
|
|
const STATUS_SCHEDULED = 'scheduled';
|
|
|
|
/**
|
|
* Creates a new Tax <code>Registration</code> object.
|
|
*
|
|
* @param null|array $params
|
|
* @param null|array|string $options
|
|
*
|
|
* @throws \Stripe\Exception\ApiErrorException if the request fails
|
|
*
|
|
* @return \Stripe\Tax\Registration the created resource
|
|
*/
|
|
public static function create($params = null, $options = null)
|
|
{
|
|
self::_validateParams($params);
|
|
$url = static::classUrl();
|
|
|
|
list($response, $opts) = static::_staticRequest('post', $url, $params, $options);
|
|
$obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
|
|
$obj->setLastResponse($response);
|
|
|
|
return $obj;
|
|
}
|
|
|
|
/**
|
|
* Returns a list of Tax <code>Registration</code> objects.
|
|
*
|
|
* @param null|array $params
|
|
* @param null|array|string $opts
|
|
*
|
|
* @throws \Stripe\Exception\ApiErrorException if the request fails
|
|
*
|
|
* @return \Stripe\Collection<\Stripe\Tax\Registration> of ApiResources
|
|
*/
|
|
public static function all($params = null, $opts = null)
|
|
{
|
|
$url = static::classUrl();
|
|
|
|
return static::_requestPage($url, \Stripe\Collection::class, $params, $opts);
|
|
}
|
|
|
|
/**
|
|
* Returns a Tax <code>Registration</code> object.
|
|
*
|
|
* @param array|string $id the ID of the API resource to retrieve, or an options array containing an `id` key
|
|
* @param null|array|string $opts
|
|
*
|
|
* @throws \Stripe\Exception\ApiErrorException if the request fails
|
|
*
|
|
* @return \Stripe\Tax\Registration
|
|
*/
|
|
public static function retrieve($id, $opts = null)
|
|
{
|
|
$opts = \Stripe\Util\RequestOptions::parse($opts);
|
|
$instance = new static($id, $opts);
|
|
$instance->refresh();
|
|
|
|
return $instance;
|
|
}
|
|
|
|
/**
|
|
* Updates an existing Tax <code>Registration</code> object.
|
|
*
|
|
* A registration cannot be deleted after it has been created. If you wish to end a
|
|
* registration you may do so by setting <code>expires_at</code>.
|
|
*
|
|
* @param string $id the ID of the resource to update
|
|
* @param null|array $params
|
|
* @param null|array|string $opts
|
|
*
|
|
* @throws \Stripe\Exception\ApiErrorException if the request fails
|
|
*
|
|
* @return \Stripe\Tax\Registration the updated resource
|
|
*/
|
|
public static function update($id, $params = null, $opts = null)
|
|
{
|
|
self::_validateParams($params);
|
|
$url = static::resourceUrl($id);
|
|
|
|
list($response, $opts) = static::_staticRequest('post', $url, $params, $opts);
|
|
$obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
|
|
$obj->setLastResponse($response);
|
|
|
|
return $obj;
|
|
}
|
|
}
|