Skip to content

Commit

Permalink
Merge pull request #1637 from stripe/latest-codegen-beta
Browse files Browse the repository at this point in the history
Update generated code for beta
  • Loading branch information
stripe-openapi[bot] authored Feb 2, 2024
2 parents 77d4cfb + 16c3d25 commit dfb6403
Show file tree
Hide file tree
Showing 24 changed files with 303 additions and 7 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Changelog

## 13.10.0 - 2024-02-01
* [#1636](https://github.com/stripe/stripe-php/pull/1636) Update generated code
* Add support for new value `swish` on enum `PaymentLink.payment_method_types[]`
* Add support for `swish` on `PaymentMethod`
* Add support for new value `swish` on enum `PaymentMethod.type`
* Add support for `jurisdiction_level` on `TaxRate`
* Change type of `Terminal.Reader.status` from `string` to `enum('offline'|'online')`
* [#1633](https://github.com/stripe/stripe-php/pull/1633) Update generated code
* Add support for `issuer` on `Invoice`
* Add support for `customer_balance` on `PaymentMethodConfiguration`
* [#1630](https://github.com/stripe/stripe-php/pull/1630) Add paginated requests helper function and use in Search and All

## 13.10.0-beta.3 - 2024-01-25
* [#1634](https://github.com/stripe/stripe-php/pull/1634) Update generated code for beta
* Add support for `create_preview` method on resource `Invoice`
Expand Down
2 changes: 1 addition & 1 deletion OPENAPI_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v796
v808
7 changes: 7 additions & 0 deletions init.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,13 @@
require __DIR__ . '/lib/Customer.php';
require __DIR__ . '/lib/CustomerBalanceTransaction.php';
require __DIR__ . '/lib/CustomerCashBalanceTransaction.php';
require __DIR__ . '/lib/CustomerEntitlement.php';
require __DIR__ . '/lib/CustomerEntitlementSummary.php';
require __DIR__ . '/lib/CustomerSession.php';
require __DIR__ . '/lib/Discount.php';
require __DIR__ . '/lib/Dispute.php';
require __DIR__ . '/lib/Entitlements/Event.php';
require __DIR__ . '/lib/Entitlements/Feature.php';
require __DIR__ . '/lib/EphemeralKey.php';
require __DIR__ . '/lib/Event.php';
require __DIR__ . '/lib/ExchangeRate.php';
Expand Down Expand Up @@ -206,6 +210,9 @@
require __DIR__ . '/lib/Service/CustomerService.php';
require __DIR__ . '/lib/Service/CustomerSessionService.php';
require __DIR__ . '/lib/Service/DisputeService.php';
require __DIR__ . '/lib/Service/Entitlements/EntitlementsServiceFactory.php';
require __DIR__ . '/lib/Service/Entitlements/EventService.php';
require __DIR__ . '/lib/Service/Entitlements/FeatureService.php';
require __DIR__ . '/lib/Service/EphemeralKeyService.php';
require __DIR__ . '/lib/Service/EventService.php';
require __DIR__ . '/lib/Service/ExchangeRateService.php';
Expand Down
2 changes: 1 addition & 1 deletion lib/Checkout/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
* @property null|\Stripe\StripeObject $shipping_details Shipping information for this Checkout Session.
* @property \Stripe\StripeObject[] $shipping_options The shipping rate options applied to this Session.
* @property null|string $status The status of the Checkout Session, one of <code>open</code>, <code>complete</code>, or <code>expired</code>.
* @property null|string $submit_type Describes the type of transaction being performed by Checkout in order to customize relevant text on the page, such as the submit button. <code>submit_type</code> can only be specified on Checkout Sessions in <code>payment</code> mode, but not Checkout Sessions in <code>subscription</code> or <code>setup</code> mode. Possible values are <code>auto</code>, <code>pay</code>, <code>book</code>, <code>donate</code>. If blank or <code>auto</code>, <code>pay</code> is used.
* @property null|string $submit_type Describes the type of transaction being performed by Checkout in order to customize relevant text on the page, such as the submit button. <code>submit_type</code> can only be specified on Checkout Sessions in <code>payment</code> mode. If blank or <code>auto</code>, <code>pay</code> is used.
* @property null|string|\Stripe\Subscription $subscription The ID of the subscription for Checkout Sessions in <code>subscription</code> mode.
* @property null|string $success_url The URL the customer will be directed to after the payment or subscription creation is successful.
* @property null|\Stripe\StripeObject $tax_id_collection
Expand Down
31 changes: 31 additions & 0 deletions lib/Customer.php
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,37 @@ public static function retrieveCashBalanceTransaction($id, $cashBalanceTransacti
{
return self::_retrieveNestedResource($id, static::PATH_CASH_BALANCE_TRANSACTIONS, $cashBalanceTransactionId, $params, $opts);
}
const PATH_ENTITLEMENTS = '/entitlements';

/**
* @param string $id the ID of the customer on which to retrieve the customer entitlements
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Collection<\Stripe\CustomerEntitlement> the list of customer entitlements
*/
public static function allEntitlements($id, $params = null, $opts = null)
{
return self::_allNestedResources($id, static::PATH_ENTITLEMENTS, $params, $opts);
}
const PATH_ENTITLEMENT_SUMMARY = '/entitlement_summary';

/**
* @param string $id the ID of the customer to which the customer entitlement summary belongs
* @param null|array $params
* @param null|array|string $opts
* @param mixed $entitlementSummaryId
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\CustomerEntitlementSummary
*/
public static function retrieveEntitlementSummary($id, $entitlementSummaryId, $params = null, $opts = null)
{
return self::_retrieveNestedResource($id, static::PATH_ENTITLEMENT_SUMMARY, $params, $opts);
}
const PATH_SOURCES = '/sources';

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

// File generated from our OpenAPI spec

namespace Stripe;

/**
* A entitlement for a customer describes access to a feature.
*
* @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 string $feature The feature that the customer is entitled to.
* @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 $lookup_key A unique key you provide as your own system identifier. This may be up to 80 characters.
* @property null|\Stripe\StripeObject $quantity Contains information about entitlements relating to features with type=quantity. Required when the feature has type=quantity.
* @property string $type The type of feature.
*/
class CustomerEntitlement extends ApiResource
{
const OBJECT_NAME = 'customer_entitlement';

use ApiOperations\All;

const TYPE_QUANTITY = 'quantity';
const TYPE_SWITCH = 'switch';
}
20 changes: 20 additions & 0 deletions lib/CustomerEntitlementSummary.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

// File generated from our OpenAPI spec

namespace Stripe;

/**
* A summary of a customer's entitlements.
*
* @property string $object String representing the object's type. Objects of the same type share the same value.
* @property string $customer The customer that is entitled to this feature.
* @property \Stripe\Collection<\Stripe\CustomerEntitlement> $entitlements The list of entitlements this customer has.
* @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.
*/
class CustomerEntitlementSummary extends ApiResource
{
const OBJECT_NAME = 'customer_entitlement_summary';

use ApiOperations\Retrieve;
}
28 changes: 28 additions & 0 deletions lib/Entitlements/Event.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

// File generated from our OpenAPI spec

namespace Stripe\Entitlements;

/**
* An entitlement event either grants or revokes an entitlement to a feature for a customer.
*
* @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 string $customer The customer that is being granted or revoked entitlement to/from a feature.
* @property string $feature The feature that the customer is being granted/revoked entitlement to/from.
* @property null|\Stripe\StripeObject $grant Contains information about type=grant entitlement event.
* @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|\Stripe\StripeObject $quantity Contains information about entitlement events relating to features with type=quantity. Required when the feature has type=quantity.
* @property null|\Stripe\StripeObject $revoke Contains information about type=revoke entitlement event.
* @property string $type Whether the event is a grant or revocation of the feature.
*/
class Event extends \Stripe\ApiResource
{
const OBJECT_NAME = 'entitlements.event';

use \Stripe\ApiOperations\Create;

const TYPE_GRANT = 'grant';
const TYPE_REVOKE = 'revoke';
}
28 changes: 28 additions & 0 deletions lib/Entitlements/Feature.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

// File generated from our OpenAPI spec

namespace Stripe\Entitlements;

/**
* A feature represents a monetizable ability or functionality in your system.
* Features can be assigned to products, and when those products are purchased, Stripe will create an entitlement to the feature for the purchasing customer.
*
* @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 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 $lookup_key A unique key you provide as your own system identifier. This may be up to 80 characters.
* @property string $name The feature's name, for your own purpose, not meant to be displayable to the customer.
* @property null|\Stripe\StripeObject $quantity Contains information about type=quantity features. This is required when type=quantity.
* @property string $type The type of feature.
*/
class Feature extends \Stripe\ApiResource
{
const OBJECT_NAME = 'entitlements.feature';

use \Stripe\ApiOperations\All;
use \Stripe\ApiOperations\Create;

const TYPE_QUANTITY = 'quantity';
const TYPE_SWITCH = 'switch';
}
2 changes: 2 additions & 0 deletions lib/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ class Event extends ApiResource
const CUSTOMER_DISCOUNT_CREATED = 'customer.discount.created';
const CUSTOMER_DISCOUNT_DELETED = 'customer.discount.deleted';
const CUSTOMER_DISCOUNT_UPDATED = 'customer.discount.updated';
const CUSTOMER_ENTITLEMENT_SUMMARY_UPDATED = 'customer.entitlement_summary.updated';
const CUSTOMER_SOURCE_CREATED = 'customer.source.created';
const CUSTOMER_SOURCE_DELETED = 'customer.source.deleted';
const CUSTOMER_SOURCE_EXPIRING = 'customer.source.expiring';
Expand Down Expand Up @@ -384,6 +385,7 @@ class Event extends ApiResource
const TYPE_CUSTOMER_DISCOUNT_CREATED = 'customer.discount.created';
const TYPE_CUSTOMER_DISCOUNT_DELETED = 'customer.discount.deleted';
const TYPE_CUSTOMER_DISCOUNT_UPDATED = 'customer.discount.updated';
const TYPE_CUSTOMER_ENTITLEMENT_SUMMARY_UPDATED = 'customer.entitlement_summary.updated';
const TYPE_CUSTOMER_SOURCE_CREATED = 'customer.source.created';
const TYPE_CUSTOMER_SOURCE_DELETED = 'customer.source.deleted';
const TYPE_CUSTOMER_SOURCE_EXPIRING = 'customer.source.expiring';
Expand Down
2 changes: 2 additions & 0 deletions lib/PaymentMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
* @property null|\Stripe\StripeObject $revolut_pay
* @property null|\Stripe\StripeObject $sepa_debit
* @property null|\Stripe\StripeObject $sofort
* @property null|\Stripe\StripeObject $swish
* @property string $type The type of the PaymentMethod. An additional hash is included on the PaymentMethod with a name matching this value. It contains additional information specific to the PaymentMethod type.
* @property null|\Stripe\StripeObject $us_bank_account
* @property null|\Stripe\StripeObject $wechat_pay
Expand Down Expand Up @@ -95,6 +96,7 @@ class PaymentMethod extends ApiResource
const TYPE_REVOLUT_PAY = 'revolut_pay';
const TYPE_SEPA_DEBIT = 'sepa_debit';
const TYPE_SOFORT = 'sofort';
const TYPE_SWISH = 'swish';
const TYPE_US_BANK_ACCOUNT = 'us_bank_account';
const TYPE_WECHAT_PAY = 'wechat_pay';
const TYPE_ZIP = 'zip';
Expand Down
2 changes: 1 addition & 1 deletion lib/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
* @property null|string|\Stripe\Price $default_price The ID of the <a href="https://stripe.com/docs/api/prices">Price</a> object that is the default price for this product.
* @property null|string $description The product's description, meant to be displayable to the customer. Use this field to optionally store a long form explanation of the product being sold for your own rendering purposes.
* @property \Stripe\StripeObject[] $features A list of up to 15 features for this product. These are displayed in <a href="https://stripe.com/docs/payments/checkout/pricing-table">pricing tables</a>.
* @property \Stripe\StripeObject[] $features A list of up to 15 features for this product. Entries using <code>name</code> are displayed in <a href="https://stripe.com/docs/payments/checkout/pricing-table">pricing tables</a>.
* @property string[] $images A list of up to 8 URLs of images for this product, meant to be displayable to the customer.
* @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
2 changes: 2 additions & 0 deletions lib/Service/CoreServiceFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
* @property CustomerService $customers
* @property CustomerSessionService $customerSessions
* @property DisputeService $disputes
* @property Entitlements\EntitlementsServiceFactory $entitlements
* @property EphemeralKeyService $ephemeralKeys
* @property EventService $events
* @property ExchangeRateService $exchangeRates
Expand Down Expand Up @@ -107,6 +108,7 @@ class CoreServiceFactory extends \Stripe\Service\AbstractServiceFactory
'customers' => CustomerService::class,
'customerSessions' => CustomerSessionService::class,
'disputes' => DisputeService::class,
'entitlements' => Entitlements\EntitlementsServiceFactory::class,
'ephemeralKeys' => EphemeralKeyService::class,
'events' => EventService::class,
'exchangeRates' => ExchangeRateService::class,
Expand Down
32 changes: 32 additions & 0 deletions lib/Service/CustomerService.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,22 @@ public function allCashBalanceTransactions($parentId, $params = null, $opts = nu
return $this->requestCollection('get', $this->buildPath('/v1/customers/%s/cash_balance_transactions', $parentId), $params, $opts);
}

/**
* Retrieve a list of entitlements for a customer.
*
* @param string $parentId
* @param null|array $params
* @param null|array|\Stripe\Util\RequestOptions $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Collection<\Stripe\CustomerEntitlement>
*/
public function allEntitlements($parentId, $params = null, $opts = null)
{
return $this->requestCollection('get', $this->buildPath('/v1/customers/%s/entitlements', $parentId), $params, $opts);
}

/**
* Returns a list of PaymentMethods for a given Customer.
*
Expand Down Expand Up @@ -329,6 +345,22 @@ public function retrieveCashBalanceTransaction($parentId, $id, $params = null, $
return $this->request('get', $this->buildPath('/v1/customers/%s/cash_balance_transactions/%s', $parentId, $id), $params, $opts);
}

/**
* Retrieve the entitlement summary for a customer.
*
* @param string $parentId
* @param null|array $params
* @param null|array|\Stripe\Util\RequestOptions $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\CustomerEntitlementSummary
*/
public function retrieveEntitlementSummary($parentId, $params = null, $opts = null)
{
return $this->request('get', $this->buildPath('/v1/customers/%s/entitlement_summary', $parentId), $params, $opts);
}

/**
* Retrieves a PaymentMethod object for a given Customer.
*
Expand Down
27 changes: 27 additions & 0 deletions lib/Service/Entitlements/EntitlementsServiceFactory.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

// File generated from our OpenAPI spec

namespace Stripe\Service\Entitlements;

/**
* Service factory class for API resources in the Entitlements namespace.
*
* @property EventService $events
* @property FeatureService $features
*/
class EntitlementsServiceFactory extends \Stripe\Service\AbstractServiceFactory
{
/**
* @var array<string, string>
*/
private static $classMap = [
'events' => EventService::class,
'features' => FeatureService::class,
];

protected function getServiceClass($name)
{
return \array_key_exists($name, self::$classMap) ? self::$classMap[$name] : null;
}
}
24 changes: 24 additions & 0 deletions lib/Service/Entitlements/EventService.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

// File generated from our OpenAPI spec

namespace Stripe\Service\Entitlements;

class EventService extends \Stripe\Service\AbstractService
{
/**
* Create an entitlement event manually, outside of the entitlement events
* automatically created by Stripe lifecycle events.
*
* @param null|array $params
* @param null|array|\Stripe\Util\RequestOptions $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Entitlements\Event
*/
public function create($params = null, $opts = null)
{
return $this->request('post', '/v1/entitlements/events', $params, $opts);
}
}
38 changes: 38 additions & 0 deletions lib/Service/Entitlements/FeatureService.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php

// File generated from our OpenAPI spec

namespace Stripe\Service\Entitlements;

class FeatureService extends \Stripe\Service\AbstractService
{
/**
* Retrieve a list of features.
*
* @param null|array $params
* @param null|array|\Stripe\Util\RequestOptions $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Collection<\Stripe\Entitlements\Feature>
*/
public function all($params = null, $opts = null)
{
return $this->requestCollection('get', '/v1/entitlements/features', $params, $opts);
}

/**
* Creates a feature.
*
* @param null|array $params
* @param null|array|\Stripe\Util\RequestOptions $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Entitlements\Feature
*/
public function create($params = null, $opts = null)
{
return $this->request('post', '/v1/entitlements/features', $params, $opts);
}
}
Loading

0 comments on commit dfb6403

Please sign in to comment.