diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index b87b42e0c..76d4091fa 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v217 \ No newline at end of file +v218 \ No newline at end of file diff --git a/init.php b/init.php index 23cc5f941..1a2784ae3 100644 --- a/init.php +++ b/init.php @@ -165,6 +165,7 @@ require __DIR__ . '/lib/SubscriptionItem.php'; require __DIR__ . '/lib/SubscriptionSchedule.php'; require __DIR__ . '/lib/Tax/Calculation.php'; +require __DIR__ . '/lib/Tax/Registration.php'; require __DIR__ . '/lib/Tax/Transaction.php'; require __DIR__ . '/lib/TaxCode.php'; require __DIR__ . '/lib/TaxId.php'; @@ -260,6 +261,7 @@ require __DIR__ . '/lib/Service/SubscriptionItemService.php'; require __DIR__ . '/lib/Service/SubscriptionScheduleService.php'; require __DIR__ . '/lib/Service/Tax/CalculationService.php'; +require __DIR__ . '/lib/Service/Tax/RegistrationService.php'; require __DIR__ . '/lib/Service/Tax/TransactionService.php'; require __DIR__ . '/lib/Service/TaxCodeService.php'; require __DIR__ . '/lib/Service/TaxRateService.php'; diff --git a/lib/Event.php b/lib/Event.php index 2807b37b6..54aa2a2d7 100644 --- a/lib/Event.php +++ b/lib/Event.php @@ -197,9 +197,12 @@ class Event extends ApiResource const PROMOTION_CODE_CREATED = 'promotion_code.created'; const PROMOTION_CODE_UPDATED = 'promotion_code.updated'; const QUOTE_ACCEPTED = 'quote.accepted'; + const QUOTE_ACCEPTING = 'quote.accepting'; const QUOTE_CANCELED = 'quote.canceled'; const QUOTE_CREATED = 'quote.created'; const QUOTE_FINALIZED = 'quote.finalized'; + const QUOTE_REESTIMATED = 'quote.reestimated'; + const QUOTE_STALE = 'quote.stale'; const RADAR_EARLY_FRAUD_WARNING_CREATED = 'radar.early_fraud_warning.created'; const RADAR_EARLY_FRAUD_WARNING_UPDATED = 'radar.early_fraud_warning.updated'; const RECIPIENT_CREATED = 'recipient.created'; diff --git a/lib/Quote.php b/lib/Quote.php index 868f7eecd..667ba37e3 100644 --- a/lib/Quote.php +++ b/lib/Quote.php @@ -130,7 +130,7 @@ public function cancel($params = null, $opts = null) */ public function draftQuote($params = null, $opts = null) { - $url = $this->instanceUrl() . '/draft'; + $url = $this->instanceUrl() . '/mark_draft'; list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); diff --git a/lib/Service/QuoteService.php b/lib/Service/QuoteService.php index 8158dce3d..1cfb457d3 100644 --- a/lib/Service/QuoteService.php +++ b/lib/Service/QuoteService.php @@ -139,7 +139,7 @@ public function create($params = null, $opts = null) */ public function draftQuote($id, $params = null, $opts = null) { - return $this->request('post', $this->buildPath('/v1/quotes/%s/draft', $id), $params, $opts); + return $this->request('post', $this->buildPath('/v1/quotes/%s/mark_draft', $id), $params, $opts); } /** diff --git a/lib/Service/Tax/RegistrationService.php b/lib/Service/Tax/RegistrationService.php new file mode 100644 index 000000000..99481020a --- /dev/null +++ b/lib/Service/Tax/RegistrationService.php @@ -0,0 +1,57 @@ +Registration objects. + * + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Collection<\Stripe\Tax\Registration> + */ + public function all($params = null, $opts = null) + { + return $this->requestCollection('get', '/v1/tax/registrations', $params, $opts); + } + + /** + * Creates a new Tax Registration object. + * + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Tax\Registration + */ + public function create($params = null, $opts = null) + { + return $this->request('post', '/v1/tax/registrations', $params, $opts); + } + + /** + * Updates an existing Tax Registration object. + * + * A registration cannot be deleted after it has been created. If you wish to end a + * registration you may do so by setting expires_at. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Tax\Registration + */ + public function update($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/tax/registrations/%s', $id), $params, $opts); + } +} diff --git a/lib/Service/Tax/TaxServiceFactory.php b/lib/Service/Tax/TaxServiceFactory.php index 6f645a17d..09f85ee5b 100644 --- a/lib/Service/Tax/TaxServiceFactory.php +++ b/lib/Service/Tax/TaxServiceFactory.php @@ -8,6 +8,7 @@ * Service factory class for API resources in the Tax namespace. * * @property CalculationService $calculations + * @property RegistrationService $registrations * @property TransactionService $transactions */ class TaxServiceFactory extends \Stripe\Service\AbstractServiceFactory @@ -17,6 +18,7 @@ class TaxServiceFactory extends \Stripe\Service\AbstractServiceFactory */ private static $classMap = [ 'calculations' => CalculationService::class, + 'registrations' => RegistrationService::class, 'transactions' => TransactionService::class, ]; diff --git a/lib/Tax/Registration.php b/lib/Tax/Registration.php new file mode 100644 index 000000000..3376895f8 --- /dev/null +++ b/lib/Tax/Registration.php @@ -0,0 +1,45 @@ +Registration lets us know that your business is registered to + * collect tax on payments within a region, enabling you to automatically collect tax. + * + * Stripe will not register on your behalf with the relevant authorities when you + * create a Tax Registration object. For more information on how to + * register to collect tax, see our guide. + * + * @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 (ISO 3166-1 alpha-2). + * @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 true if the object exists in live mode or the value false if the object exists in test mode. + * @property null|string $state State, county, province, or region. + * @property string $status The status of the registration. This field is present for convenience and can be deduced from active_from and expires_at. + * @property string $type The type of the registration. See our guide for more information about registration types. + */ +class Registration extends \Stripe\ApiResource +{ + const OBJECT_NAME = 'tax.registration'; + + use \Stripe\ApiOperations\All; + use \Stripe\ApiOperations\Create; + use \Stripe\ApiOperations\Update; + + const STATUS_ACTIVE = 'active'; + const STATUS_EXPIRED = 'expired'; + const STATUS_SCHEDULED = 'scheduled'; + + const TYPE_DOMESTIC_SMALL_SELLER = 'domestic_small_seller'; + const TYPE_SIMPLIFIED = 'simplified'; + const TYPE_STANDARD = 'standard'; + const TYPE_VAT_OSS_NON_UNION = 'vat_oss_non_union'; + const TYPE_VAT_OSS_UNION = 'vat_oss_union'; +} diff --git a/lib/Util/ObjectTypes.php b/lib/Util/ObjectTypes.php index 9bda05580..7741a5102 100644 --- a/lib/Util/ObjectTypes.php +++ b/lib/Util/ObjectTypes.php @@ -97,6 +97,7 @@ class ObjectTypes \Stripe\SubscriptionItem::OBJECT_NAME => \Stripe\SubscriptionItem::class, \Stripe\SubscriptionSchedule::OBJECT_NAME => \Stripe\SubscriptionSchedule::class, \Stripe\Tax\Calculation::OBJECT_NAME => \Stripe\Tax\Calculation::class, + \Stripe\Tax\Registration::OBJECT_NAME => \Stripe\Tax\Registration::class, \Stripe\Tax\Transaction::OBJECT_NAME => \Stripe\Tax\Transaction::class, \Stripe\TaxCode::OBJECT_NAME => \Stripe\TaxCode::class, \Stripe\TaxId::OBJECT_NAME => \Stripe\TaxId::class,