Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API Updates for beta branch #1423

Merged
merged 4 commits into from
Jan 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion OPENAPI_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v217
v218
2 changes: 2 additions & 0 deletions init.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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';
Expand Down
3 changes: 3 additions & 0 deletions lib/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion lib/Quote.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion lib/Service/QuoteService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down
57 changes: 57 additions & 0 deletions lib/Service/Tax/RegistrationService.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?php

// File generated from our OpenAPI spec

namespace Stripe\Service\Tax;

class RegistrationService extends \Stripe\Service\AbstractService
{
/**
* Returns a list of Tax <code>Registration</code> 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 <code>Registration</code> 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 <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
* @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);
}
}
2 changes: 2 additions & 0 deletions lib/Service/Tax/TaxServiceFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -17,6 +18,7 @@ class TaxServiceFactory extends \Stripe\Service\AbstractServiceFactory
*/
private static $classMap = [
'calculations' => CalculationService::class,
'registrations' => RegistrationService::class,
'transactions' => TransactionService::class,
];

Expand Down
45 changes: 45 additions & 0 deletions lib/Tax/Registration.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?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 will not 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>.
*
* @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 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 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 <code>active_from</code> and <code>expires_at</code>.
* @property string $type The type of the registration. See <a href="https://stripe.com/docs/tax/registering">our guide</a> 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';
}
1 change: 1 addition & 0 deletions lib/Util/ObjectTypes.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down