Skip to content

Commit

Permalink
Update generated code (#1255)
Browse files Browse the repository at this point in the history
* Update generated code for v841

* Update generated code for v845

* Update generated code for v849

* Update generated code for v850

* Update generated code for v851

* Update generated code for v852

* Update generated code for v853

* Update generated code for v855

* Update generated code for v857

---------

Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
Co-authored-by: anniel-stripe <97691964+anniel-stripe@users.noreply.github.com>
  • Loading branch information
stripe-openapi[bot] and anniel-stripe committed Feb 29, 2024
1 parent 26d940f commit dc8b811
Show file tree
Hide file tree
Showing 16 changed files with 216 additions and 34 deletions.
2 changes: 1 addition & 1 deletion OPENAPI_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v840
v857
2 changes: 1 addition & 1 deletion stripe/_bank_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ class DeleteParams(RequestOptions):
"""
For bank accounts, possible values are `new`, `validated`, `verified`, `verification_failed`, or `errored`. A bank account that hasn't had any activity or validation performed is `new`. If Stripe can determine that the bank account exists, its status will be `validated`. Note that there often isn't enough information to know (e.g., for smaller credit unions), and the validation is not always run. If customer bank account verification has succeeded, the bank account status will be `verified`. If the verification failed for any reason, such as microdeposit failure, the status will be `verification_failed`. If a payout sent to this bank account fails, we'll set the status to `errored` and will not continue to send [scheduled payouts](https://stripe.com/docs/payouts#payout-schedule) until the bank details are updated.
For external accounts, possible values are `new`, `errored` and `verification_failed`. If a payouts fails, the status is set to `errored` and scheduled payouts are stopped until account details are updated. In India, if we can't [verify the owner of the bank account](https://support.stripe.com/questions/bank-account-ownership-verification), we'll set the status to `verification_failed`. Other validations aren't run against external accounts because they're only used for payouts. This means the other statuses don't apply.
For external accounts, possible values are `new`, `errored` and `verification_failed`. If a payout fails, the status is set to `errored` and scheduled payouts are stopped until account details are updated. In the US and India, if we can't [verify the owner of the bank account](https://support.stripe.com/questions/bank-account-ownership-verification), we'll set the status to `verification_failed`. Other validations aren't run against external accounts because they're only used for payouts. This means the other statuses don't apply.
"""
deleted: Optional[Literal[True]]
"""
Expand Down
65 changes: 65 additions & 0 deletions stripe/_charge.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,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 @@ -46,6 +47,7 @@
from stripe._transfer import Transfer


@nested_resource_class_methods("refund")
class Charge(
CreateableAPIResource["Charge"],
ListableAPIResource["Charge"],
Expand Down Expand Up @@ -1927,6 +1929,24 @@ class ListParamsCreated(TypedDict):
Maximum value to filter by (inclusive)
"""

class ListRefundsParams(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 ModifyParams(RequestOptions):
customer: NotRequired["str"]
"""
Expand Down Expand Up @@ -2021,6 +2041,12 @@ class RetrieveParams(RequestOptions):
Specifies which fields in the response should be expanded.
"""

class RetrieveRefundParams(RequestOptions):
expand: NotRequired["List[str]"]
"""
Specifies which fields in the response should be expanded.
"""

class SearchParams(RequestOptions):
expand: NotRequired["List[str]"]
"""
Expand Down Expand Up @@ -2398,6 +2424,45 @@ def mark_as_safe(self, idempotency_key=None) -> "Charge":
self._request_and_refresh("post", url, params)
return self

@classmethod
def retrieve_refund(
cls,
charge: str,
refund: str,
**params: Unpack["Charge.RetrieveRefundParams"]
) -> "Refund":
"""
Retrieves the details of an existing refund.
"""
return cast(
"Refund",
cls._static_request(
"get",
"/v1/charges/{charge}/refunds/{refund}".format(
charge=sanitize_id(charge), refund=sanitize_id(refund)
),
params=params,
),
)

@classmethod
def list_refunds(
cls, charge: str, **params: Unpack["Charge.ListRefundsParams"]
) -> ListObject["Refund"]:
"""
You can see a list of the refunds belonging to a specific charge. Note that the 10 most recent refunds are always available by default on the charge object. If you need more than those 10, you can use this API method and the limit and starting_after parameters to page through additional refunds.
"""
return cast(
ListObject["Refund"],
cls._static_request(
"get",
"/v1/charges/{charge}/refunds".format(
charge=sanitize_id(charge)
),
params=params,
),
)

_inner_class_types = {
"billing_details": BillingDetails,
"fraud_details": FraudDetails,
Expand Down
8 changes: 8 additions & 0 deletions stripe/_invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -1059,6 +1059,10 @@ class CreateParams(RequestOptions):
"""
Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`.
"""
number: NotRequired["str"]
"""
Set the number for this invoice. If no number is present then a number will be assigned automatically when the invoice is finalized. In many markets, regulations require invoices to be unique, sequential and / or gapless. You are responsible for ensuring this is true across all your different invoicing systems in the event that you edit the invoice number using our API. If you use only Stripe for your invoices and do not change invoice numbers, Stripe handles this aspect of compliance for you automatically.
"""
on_behalf_of: NotRequired["str"]
"""
The account (if any) for which the funds of the invoice payment are intended. If set, the invoice will be presented with the branding and support information of the specified account. See the [Invoices with Connect](https://stripe.com/docs/billing/invoices/connect) documentation for details.
Expand Down Expand Up @@ -1736,6 +1740,10 @@ class ModifyParams(RequestOptions):
"""
Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`.
"""
number: NotRequired["Literal['']|str"]
"""
Set the number for this invoice. If no number is present then a number will be assigned automatically when the invoice is finalized. In many markets, regulations require invoices to be unique, sequential and / or gapless. You are responsible for ensuring this is true across all your different invoicing systems in the event that you edit the invoice number using our API. If you use only Stripe for your invoices and do not change invoice numbers, Stripe handles this aspect of compliance for you automatically.
"""
on_behalf_of: NotRequired["Literal['']|str"]
"""
The account (if any) for which the funds of the invoice payment are intended. If set, the invoice will be presented with the branding and support information of the specified account. See the [Invoices with Connect](https://stripe.com/docs/billing/invoices/connect) documentation for details.
Expand Down
8 changes: 8 additions & 0 deletions stripe/_invoice_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ class CreateParams(TypedDict):
"""
Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`.
"""
number: NotRequired["str"]
"""
Set the number for this invoice. If no number is present then a number will be assigned automatically when the invoice is finalized. In many markets, regulations require invoices to be unique, sequential and / or gapless. You are responsible for ensuring this is true across all your different invoicing systems in the event that you edit the invoice number using our API. If you use only Stripe for your invoices and do not change invoice numbers, Stripe handles this aspect of compliance for you automatically.
"""
on_behalf_of: NotRequired["str"]
"""
The account (if any) for which the funds of the invoice payment are intended. If set, the invoice will be presented with the branding and support information of the specified account. See the [Invoices with Connect](https://stripe.com/docs/billing/invoices/connect) documentation for details.
Expand Down Expand Up @@ -1400,6 +1404,10 @@ class UpdateParams(TypedDict):
"""
Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`.
"""
number: NotRequired["Literal['']|str"]
"""
Set the number for this invoice. If no number is present then a number will be assigned automatically when the invoice is finalized. In many markets, regulations require invoices to be unique, sequential and / or gapless. You are responsible for ensuring this is true across all your different invoicing systems in the event that you edit the invoice number using our API. If you use only Stripe for your invoices and do not change invoice numbers, Stripe handles this aspect of compliance for you automatically.
"""
on_behalf_of: NotRequired["Literal['']|str"]
"""
The account (if any) for which the funds of the invoice payment are intended. If set, the invoice will be presented with the branding and support information of the specified account. See the [Invoices with Connect](https://stripe.com/docs/billing/invoices/connect) documentation for details.
Expand Down
12 changes: 6 additions & 6 deletions stripe/_payment_link.py
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,7 @@ class CreateParams(RequestOptions):
"""
billing_address_collection: NotRequired["Literal['auto', 'required']"]
"""
Configuration for collecting the customer's billing address.
Configuration for collecting the customer's billing address. Defaults to `auto`.
"""
consent_collection: NotRequired[
"PaymentLink.CreateParamsConsentCollection"
Expand Down Expand Up @@ -764,7 +764,7 @@ class CreateParams(RequestOptions):
"""
Specify whether Checkout should collect a payment method. When set to `if_required`, Checkout will not collect a payment method when the total due for the session is 0.This may occur if the Checkout Session includes a free trial or a discount.
Can only be set in `subscription` mode.
Can only be set in `subscription` mode. Defaults to `always`.
If you'd like information on how to collect a payment method outside of Checkout, read the guide on [configuring subscriptions with a free trial](https://stripe.com/docs/payments/checkout/free-trials).
"""
Expand Down Expand Up @@ -1576,7 +1576,7 @@ class ModifyParams(RequestOptions):
"""
billing_address_collection: NotRequired["Literal['auto', 'required']"]
"""
Configuration for collecting the customer's billing address.
Configuration for collecting the customer's billing address. Defaults to `auto`.
"""
custom_fields: NotRequired[
"Literal['']|List[PaymentLink.ModifyParamsCustomField]"
Expand Down Expand Up @@ -1626,7 +1626,7 @@ class ModifyParams(RequestOptions):
"""
Specify whether Checkout should collect a payment method. When set to `if_required`, Checkout will not collect a payment method when the total due for the session is 0.This may occur if the Checkout Session includes a free trial or a discount.
Can only be set in `subscription` mode.
Can only be set in `subscription` mode. Defaults to `always`.
If you'd like information on how to collect a payment method outside of Checkout, read the guide on [configuring subscriptions with a free trial](https://stripe.com/docs/payments/checkout/free-trials).
"""
Expand Down Expand Up @@ -2296,7 +2296,7 @@ class RetrieveParams(RequestOptions):
automatic_tax: AutomaticTax
billing_address_collection: Literal["auto", "required"]
"""
Configuration for collecting the customer's billing address.
Configuration for collecting the customer's billing address. Defaults to `auto`.
"""
consent_collection: Optional[ConsentCollection]
"""
Expand Down Expand Up @@ -2353,7 +2353,7 @@ class RetrieveParams(RequestOptions):
"""
payment_method_collection: Literal["always", "if_required"]
"""
Configuration for collecting a payment method during checkout.
Configuration for collecting a payment method during checkout. Defaults to `always`.
"""
payment_method_types: Optional[
List[
Expand Down
8 changes: 4 additions & 4 deletions stripe/_payment_link_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class CreateParams(TypedDict):
"""
billing_address_collection: NotRequired["Literal['auto', 'required']"]
"""
Configuration for collecting the customer's billing address.
Configuration for collecting the customer's billing address. Defaults to `auto`.
"""
consent_collection: NotRequired[
"PaymentLinkService.CreateParamsConsentCollection"
Expand Down Expand Up @@ -106,7 +106,7 @@ class CreateParams(TypedDict):
"""
Specify whether Checkout should collect a payment method. When set to `if_required`, Checkout will not collect a payment method when the total due for the session is 0.This may occur if the Checkout Session includes a free trial or a discount.
Can only be set in `subscription` mode.
Can only be set in `subscription` mode. Defaults to `always`.
If you'd like information on how to collect a payment method outside of Checkout, read the guide on [configuring subscriptions with a free trial](https://stripe.com/docs/payments/checkout/free-trials).
"""
Expand Down Expand Up @@ -920,7 +920,7 @@ class UpdateParams(TypedDict):
"""
billing_address_collection: NotRequired["Literal['auto', 'required']"]
"""
Configuration for collecting the customer's billing address.
Configuration for collecting the customer's billing address. Defaults to `auto`.
"""
custom_fields: NotRequired[
"Literal['']|List[PaymentLinkService.UpdateParamsCustomField]"
Expand Down Expand Up @@ -972,7 +972,7 @@ class UpdateParams(TypedDict):
"""
Specify whether Checkout should collect a payment method. When set to `if_required`, Checkout will not collect a payment method when the total due for the session is 0.This may occur if the Checkout Session includes a free trial or a discount.
Can only be set in `subscription` mode.
Can only be set in `subscription` mode. Defaults to `always`.
If you'd like information on how to collect a payment method outside of Checkout, read the guide on [configuring subscriptions with a free trial](https://stripe.com/docs/payments/checkout/free-trials).
"""
Expand Down
41 changes: 39 additions & 2 deletions stripe/_refund.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,14 @@
from stripe._updateable_api_resource import UpdateableAPIResource
from stripe._util import class_method_variant, sanitize_id
from typing import ClassVar, Dict, List, Optional, cast, overload
from typing_extensions import Literal, NotRequired, Type, Unpack, TYPE_CHECKING
from typing_extensions import (
Literal,
NotRequired,
Type,
TypedDict,
Unpack,
TYPE_CHECKING,
)

if TYPE_CHECKING:
from stripe._balance_transaction import BalanceTransaction
Expand Down Expand Up @@ -360,6 +367,14 @@ class ExpireParams(RequestOptions):
"""

class ListParams(RequestOptions):
charge: NotRequired["str"]
"""
Only return refunds for the charge specified by this charge ID.
"""
created: NotRequired["Refund.ListParamsCreated|int"]
"""
Only return refunds that were created during the given date interval.
"""
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 All @@ -372,11 +387,33 @@ class ListParams(RequestOptions):
"""
A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
"""
payment_intent: NotRequired["str"]
"""
Only return refunds for the PaymentIntent specified by this ID.
"""
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 ListParamsCreated(TypedDict):
gt: NotRequired["int"]
"""
Minimum value to filter by (exclusive)
"""
gte: NotRequired["int"]
"""
Minimum value to filter by (inclusive)
"""
lt: NotRequired["int"]
"""
Maximum value to filter by (exclusive)
"""
lte: NotRequired["int"]
"""
Maximum value to filter by (inclusive)
"""

class ModifyParams(RequestOptions):
expand: NotRequired["List[str]"]
"""
Expand Down Expand Up @@ -567,7 +604,7 @@ def list(
cls, **params: Unpack["Refund.ListParams"]
) -> ListObject["Refund"]:
"""
You can see a list of the refunds belonging to a specific charge. Note that the 10 most recent refunds are always available by default on the charge object. If you need more than those 10, you can use this API method and the limit and starting_after parameters to page through additional refunds.
Returns a list of all refunds you created. We return the refunds in sorted order, with the most recent refunds appearing first The 10 most recent refunds are always available by default on the Charge object.
"""
result = cls._static_request(
"get",
Expand Down

0 comments on commit dc8b811

Please sign in to comment.