Skip to content

Commit

Permalink
Codegen for openapi v222
Browse files Browse the repository at this point in the history
  • Loading branch information
richardm-stripe committed Feb 2, 2023
1 parent 87def89 commit 39eb175
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 17 deletions.
2 changes: 1 addition & 1 deletion OPENAPI_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v219
v222
2 changes: 2 additions & 0 deletions lib/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,10 @@ class Event extends ApiResource
const CUSTOMER_SOURCE_UPDATED = 'customer.source.updated';
const CUSTOMER_SUBSCRIPTION_CREATED = 'customer.subscription.created';
const CUSTOMER_SUBSCRIPTION_DELETED = 'customer.subscription.deleted';
const CUSTOMER_SUBSCRIPTION_PAUSED = 'customer.subscription.paused';
const CUSTOMER_SUBSCRIPTION_PENDING_UPDATE_APPLIED = 'customer.subscription.pending_update_applied';
const CUSTOMER_SUBSCRIPTION_PENDING_UPDATE_EXPIRED = 'customer.subscription.pending_update_expired';
const CUSTOMER_SUBSCRIPTION_RESUMED = 'customer.subscription.resumed';
const CUSTOMER_SUBSCRIPTION_TRIAL_WILL_END = 'customer.subscription.trial_will_end';
const CUSTOMER_SUBSCRIPTION_UPDATED = 'customer.subscription.updated';
const CUSTOMER_TAX_ID_CREATED = 'customer.tax_id.created';
Expand Down
1 change: 1 addition & 0 deletions lib/PaymentLink.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
* @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>.
* @property \Stripe\StripeObject $custom_text
* @property string $customer_creation Configuration for Customer creation during checkout.
* @property null|\Stripe\StripeObject $invoice_creation Configuration for creating invoice for payment mode payment links.
* @property \Stripe\Collection<\Stripe\LineItem> $line_items The line items representing what is being sold.
* @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 \Stripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
Expand Down
21 changes: 21 additions & 0 deletions lib/Service/SubscriptionService.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,27 @@ public function deleteDiscount($id, $params = null, $opts = null)
return $this->request('delete', $this->buildPath('/v1/subscriptions/%s/discount', $id), $params, $opts);
}

/**
* Initiates resumption of a paused subscription, optionally resetting the billing
* cycle anchor and creating prorations. If a resumption invoice is generated, it
* must be paid or marked uncollectible before the subscription will be unpaused.
* If payment succeeds the subscription will become <code>active</code>, and if
* payment fails the subscription will be <code>past_due</code>. The resumption
* invoice will void automatically if not paid by the expiration date.
*
* @param string $id
* @param null|array $params
* @param null|array|\Stripe\Util\RequestOptions $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Subscription
*/
public function resume($id, $params = null, $opts = null)
{
return $this->request('post', $this->buildPath('/v1/subscriptions/%s/resume', $id), $params, $opts);
}

/**
* Retrieves the subscription with the given ID.
*
Expand Down
17 changes: 1 addition & 16 deletions lib/StripeClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,27 +72,12 @@ class StripeClient extends BaseStripeClient
*/
private $coreServiceFactory;

/**
* @param $name
*
* @return null|Service\AbstractService|Service\AbstractServiceFactory
*/
public function __get($name)
{
return $this->getService($name);
}

/**
* @param $name
*
* @return null|Service\AbstractService|Service\AbstractServiceFactory
*/
public function getService($name)
{
if (null === $this->coreServiceFactory) {
$this->coreServiceFactory = new \Stripe\Service\CoreServiceFactory($this);
}

return $this->coreServiceFactory->getService($name);
return $this->coreServiceFactory->__get($name);
}
}
19 changes: 19 additions & 0 deletions lib/Subscription.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
* @property null|string|\Stripe\TestHelpers\TestClock $test_clock ID of the test clock this subscription belongs to.
* @property null|\Stripe\StripeObject $transfer_data The account (if any) the subscription's payments will be attributed to for tax reporting, and where funds from each payment will be transferred to for each of the subscription's invoices.
* @property null|int $trial_end If the subscription has a trial, the end of that trial.
* @property null|\Stripe\StripeObject $trial_settings Settings related to subscription trials.
* @property null|int $trial_start If the subscription has a trial, the beginning of that trial.
*/
class Subscription extends ApiResource
Expand All @@ -77,6 +78,7 @@ class Subscription extends ApiResource
const STATUS_INCOMPLETE = 'incomplete';
const STATUS_INCOMPLETE_EXPIRED = 'incomplete_expired';
const STATUS_PAST_DUE = 'past_due';
const STATUS_PAUSED = 'paused';
const STATUS_TRIALING = 'trialing';
const STATUS_UNPAID = 'unpaid';

Expand Down Expand Up @@ -130,6 +132,23 @@ public function cancel($params = null, $opts = null)
return $this;
}

/**
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Subscription the resumed subscription
*/
public function resume($params = null, $opts = null)
{
$url = $this->instanceUrl() . '/resume';
list($response, $opts) = $this->_request('post', $url, $params, $opts);
$this->refreshFrom($response, $opts);

return $this;
}

/**
* @param null|array $params
* @param null|array|string $opts
Expand Down

0 comments on commit 39eb175

Please sign in to comment.