Skip to content

Commit

Permalink
Merge 8ee353f into e8078a3
Browse files Browse the repository at this point in the history
  • Loading branch information
stripe-openapi[bot] authored Mar 20, 2024
2 parents e8078a3 + 8ee353f commit 1c5e5ac
Show file tree
Hide file tree
Showing 16 changed files with 482 additions and 27 deletions.
2 changes: 1 addition & 1 deletion OPENAPI_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v879
v884
4 changes: 4 additions & 0 deletions stripe/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,10 @@ def __getattr__(name):
from stripe._price import Price as Price
from stripe._price_service import PriceService as PriceService
from stripe._product import Product as Product
from stripe._product_feature import ProductFeature as ProductFeature
from stripe._product_feature_service import (
ProductFeatureService as ProductFeatureService,
)
from stripe._product_service import ProductService as ProductService
from stripe._promotion_code import PromotionCode as PromotionCode
from stripe._promotion_code_service import (
Expand Down
16 changes: 16 additions & 0 deletions stripe/_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,10 @@ class Capabilities(StripeObject):
"""
The status of the link_payments capability of the account, or whether the account can directly process Link charges.
"""
mobilepay_payments: Optional[Literal["active", "inactive", "pending"]]
"""
The status of the MobilepPay capability of the account, or whether the account can directly process MobilePay charges.
"""
oxxo_payments: Optional[Literal["active", "inactive", "pending"]]
"""
The status of the OXXO payments capability of the account, or whether the account can directly process OXXO charges.
Expand Down Expand Up @@ -1534,6 +1538,12 @@ class CreateParamsCapabilities(TypedDict):
"""
The link_payments capability.
"""
mobilepay_payments: NotRequired[
"Account.CreateParamsCapabilitiesMobilepayPayments"
]
"""
The mobilepay_payments capability.
"""
oxxo_payments: NotRequired[
"Account.CreateParamsCapabilitiesOxxoPayments"
]
Expand Down Expand Up @@ -1777,6 +1787,12 @@ class CreateParamsCapabilitiesLinkPayments(TypedDict):
Passing true requests the capability for the account, if it is not already requested. A requested capability may not immediately become active. Any requirements to activate the capability are returned in the `requirements` arrays.
"""

class CreateParamsCapabilitiesMobilepayPayments(TypedDict):
requested: NotRequired["bool"]
"""
Passing true requests the capability for the account, if it is not already requested. A requested capability may not immediately become active. Any requirements to activate the capability are returned in the `requirements` arrays.
"""

class CreateParamsCapabilitiesOxxoPayments(TypedDict):
requested: NotRequired["bool"]
"""
Expand Down
24 changes: 24 additions & 0 deletions stripe/_account_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,12 @@ class CreateParamsCapabilities(TypedDict):
"""
The link_payments capability.
"""
mobilepay_payments: NotRequired[
"AccountService.CreateParamsCapabilitiesMobilepayPayments"
]
"""
The mobilepay_payments capability.
"""
oxxo_payments: NotRequired[
"AccountService.CreateParamsCapabilitiesOxxoPayments"
]
Expand Down Expand Up @@ -622,6 +628,12 @@ class CreateParamsCapabilitiesLinkPayments(TypedDict):
Passing true requests the capability for the account, if it is not already requested. A requested capability may not immediately become active. Any requirements to activate the capability are returned in the `requirements` arrays.
"""

class CreateParamsCapabilitiesMobilepayPayments(TypedDict):
requested: NotRequired["bool"]
"""
Passing true requests the capability for the account, if it is not already requested. A requested capability may not immediately become active. Any requirements to activate the capability are returned in the `requirements` arrays.
"""

class CreateParamsCapabilitiesOxxoPayments(TypedDict):
requested: NotRequired["bool"]
"""
Expand Down Expand Up @@ -1982,6 +1994,12 @@ class UpdateParamsCapabilities(TypedDict):
"""
The link_payments capability.
"""
mobilepay_payments: NotRequired[
"AccountService.UpdateParamsCapabilitiesMobilepayPayments"
]
"""
The mobilepay_payments capability.
"""
oxxo_payments: NotRequired[
"AccountService.UpdateParamsCapabilitiesOxxoPayments"
]
Expand Down Expand Up @@ -2229,6 +2247,12 @@ class UpdateParamsCapabilitiesLinkPayments(TypedDict):
Passing true requests the capability for the account, if it is not already requested. A requested capability may not immediately become active. Any requirements to activate the capability are returned in the `requirements` arrays.
"""

class UpdateParamsCapabilitiesMobilepayPayments(TypedDict):
requested: NotRequired["bool"]
"""
Passing true requests the capability for the account, if it is not already requested. A requested capability may not immediately become active. Any requirements to activate the capability are returned in the `requirements` arrays.
"""

class UpdateParamsCapabilitiesOxxoPayments(TypedDict):
requested: NotRequired["bool"]
"""
Expand Down
2 changes: 1 addition & 1 deletion stripe/_api_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
# File generated from our OpenAPI spec
class _ApiVersion:
CURRENT = "2023-10-16"
PREVIEW = "2024-02-15.preview-v2"
PREVIEW = "2024-03-15.preview-v2"
4 changes: 4 additions & 0 deletions stripe/_confirmation_token.py
Original file line number Diff line number Diff line change
Expand Up @@ -1897,6 +1897,10 @@ class RetrieveParams(RequestOptions):
"""
Shipping information collected on this ConfirmationToken.
"""
use_stripe_sdk: bool
"""
Indicates whether the Stripe SDK is used to handle confirmation flow. Defaults to `true` on ConfirmationToken.
"""

@classmethod
def retrieve(
Expand Down
1 change: 1 addition & 0 deletions stripe/_object_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@
stripe.PlatformTaxFee.OBJECT_NAME: stripe.PlatformTaxFee,
stripe.Price.OBJECT_NAME: stripe.Price,
stripe.Product.OBJECT_NAME: stripe.Product,
stripe.ProductFeature.OBJECT_NAME: stripe.ProductFeature,
stripe.PromotionCode.OBJECT_NAME: stripe.PromotionCode,
stripe.Quote.OBJECT_NAME: stripe.Quote,
stripe.QuoteLine.OBJECT_NAME: stripe.QuoteLine,
Expand Down
169 changes: 154 additions & 15 deletions stripe/_product.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from stripe._expandable_field import ExpandableField
from stripe._list_object import ListObject
from stripe._listable_api_resource import ListableAPIResource
from stripe._nested_resource_class_methods import nested_resource_class_methods
from stripe._request_options import RequestOptions
from stripe._search_result_object import SearchResultObject
from stripe._searchable_api_resource import SearchableAPIResource
Expand Down Expand Up @@ -32,12 +33,14 @@

if TYPE_CHECKING:
from stripe._price import Price
from stripe._product_feature import ProductFeature
from stripe._tax_code import TaxCode
from stripe.entitlements._feature import (
Feature as EntitlementsFeatureResource,
)


@nested_resource_class_methods("feature")
class Product(
CreateableAPIResource["Product"],
DeletableAPIResource["Product"],
Expand All @@ -60,12 +63,9 @@ class Product(

class Feature(StripeObject):
feature: Optional[ExpandableField["EntitlementsFeatureResource"]]
"""
The ID of the [Feature](docs/api/entitlements/feature) object. This property is mutually-exclusive with `name`; either one must be specified, but not both.
"""
name: Optional[str]
"""
The feature's name. Up to 80 characters long.
The marketing feature name. Up to 80 characters long.
"""

class PackageDimensions(StripeObject):
Expand Down Expand Up @@ -112,6 +112,16 @@ class FixedAmount(StripeObject):
"""
_inner_class_types = {"gift_card": GiftCard}

class CreateFeatureParams(RequestOptions):
entitlement_feature: str
"""
The ID of the [Feature](docs/api/entitlements/feature) object attached to this product.
"""
expand: NotRequired["List[str]"]
"""
Specifies which fields in the response should be expanded.
"""

class CreateParams(RequestOptions):
active: NotRequired["bool"]
"""
Expand All @@ -131,7 +141,7 @@ class CreateParams(RequestOptions):
"""
features: NotRequired["List[Product.CreateParamsFeature]"]
"""
A list of up to 15 features for this product. Entries using `name` are displayed in [pricing tables](https://stripe.com/docs/payments/checkout/pricing-table).
A list of up to 15 marketing features for this product. These are displayed in [pricing tables](https://stripe.com/docs/payments/checkout/pricing-table).
"""
id: NotRequired["str"]
"""
Expand Down Expand Up @@ -299,12 +309,9 @@ class CreateParamsDefaultPriceDataRecurring(TypedDict):

class CreateParamsFeature(TypedDict):
feature: NotRequired["str"]
"""
The ID of the [Feature](docs/api/entitlements/feature) object. This property is mutually-exclusive with `name`; either one must be specified, but not both.
"""
name: str
"""
The feature's name. Up to 80 characters long.
The marketing feature name. Up to 80 characters long.
"""

class CreateParamsPackageDimensions(TypedDict):
Expand Down Expand Up @@ -348,9 +355,30 @@ class CreateParamsProvisioningGiftCardFixedAmount(TypedDict):
"""
currency: str

class DeleteFeatureParams(RequestOptions):
pass

class DeleteParams(RequestOptions):
pass

class ListFeaturesParams(RequestOptions):
ending_before: NotRequired["str"]
"""
A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list.
"""
expand: NotRequired["List[str]"]
"""
Specifies which fields in the response should be expanded.
"""
limit: NotRequired["int"]
"""
A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
"""
starting_after: NotRequired["str"]
"""
A cursor for use in pagination. `starting_after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list.
"""

class ListParams(RequestOptions):
active: NotRequired["bool"]
"""
Expand Down Expand Up @@ -430,7 +458,7 @@ class ModifyParams(RequestOptions):
"""
features: NotRequired["Literal['']|List[Product.ModifyParamsFeature]"]
"""
A list of up to 15 features for this product. Entries using `name` are displayed in [pricing tables](https://stripe.com/docs/payments/checkout/pricing-table).
A list of up to 15 marketing features for this product. These are displayed in [pricing tables](https://stripe.com/docs/payments/checkout/pricing-table).
"""
images: NotRequired["Literal['']|List[str]"]
"""
Expand Down Expand Up @@ -476,12 +504,9 @@ class ModifyParams(RequestOptions):

class ModifyParamsFeature(TypedDict):
feature: NotRequired["str"]
"""
The ID of the [Feature](docs/api/entitlements/feature) object. This property is mutually-exclusive with `name`; either one must be specified, but not both.
"""
name: str
"""
The feature's name. Up to 80 characters long.
The marketing feature name. Up to 80 characters long.
"""

class ModifyParamsPackageDimensions(TypedDict):
Expand Down Expand Up @@ -544,7 +569,7 @@ class SearchParams(RequestOptions):
"""
features: List[Feature]
"""
A list of up to 15 features for this product. Entries using `name` are displayed in [pricing tables](https://stripe.com/docs/payments/checkout/pricing-table).
A list of up to 15 marketing features for this product. These are displayed in [pricing tables](https://stripe.com/docs/payments/checkout/pricing-table).
"""
id: str
"""
Expand Down Expand Up @@ -873,6 +898,120 @@ async def search_auto_paging_iter_async(
) -> AsyncIterator["Product"]:
return (await cls.search_async(*args, **kwargs)).auto_paging_iter()

@classmethod
def delete_feature(
cls,
product: str,
id: str,
**params: Unpack["Product.DeleteFeatureParams"]
) -> "ProductFeature":
"""
Deletes the feature attachment to a product
"""
return cast(
"ProductFeature",
cls._static_request(
"delete",
"/v1/products/{product}/features/{id}".format(
product=sanitize_id(product), id=sanitize_id(id)
),
params=params,
),
)

@classmethod
async def delete_feature_async(
cls,
product: str,
id: str,
**params: Unpack["Product.DeleteFeatureParams"]
) -> "ProductFeature":
"""
Deletes the feature attachment to a product
"""
return cast(
"ProductFeature",
await cls._static_request_async(
"delete",
"/v1/products/{product}/features/{id}".format(
product=sanitize_id(product), id=sanitize_id(id)
),
params=params,
),
)

@classmethod
def list_features(
cls, product: str, **params: Unpack["Product.ListFeaturesParams"]
) -> ListObject["ProductFeature"]:
"""
Retrieve a list of features for a product
"""
return cast(
ListObject["ProductFeature"],
cls._static_request(
"get",
"/v1/products/{product}/features".format(
product=sanitize_id(product)
),
params=params,
),
)

@classmethod
async def list_features_async(
cls, product: str, **params: Unpack["Product.ListFeaturesParams"]
) -> ListObject["ProductFeature"]:
"""
Retrieve a list of features for a product
"""
return cast(
ListObject["ProductFeature"],
await cls._static_request_async(
"get",
"/v1/products/{product}/features".format(
product=sanitize_id(product)
),
params=params,
),
)

@classmethod
def create_feature(
cls, product: str, **params: Unpack["Product.CreateFeatureParams"]
) -> "ProductFeature":
"""
Creates a product_feature, which represents a feature attachment to a product
"""
return cast(
"ProductFeature",
cls._static_request(
"post",
"/v1/products/{product}/features".format(
product=sanitize_id(product)
),
params=params,
),
)

@classmethod
async def create_feature_async(
cls, product: str, **params: Unpack["Product.CreateFeatureParams"]
) -> "ProductFeature":
"""
Creates a product_feature, which represents a feature attachment to a product
"""
return cast(
"ProductFeature",
await cls._static_request_async(
"post",
"/v1/products/{product}/features".format(
product=sanitize_id(product)
),
params=params,
),
)

_inner_class_types = {
"features": Feature,
"package_dimensions": PackageDimensions,
Expand Down
Loading

0 comments on commit 1c5e5ac

Please sign in to comment.