Skip to content

Commit

Permalink
Merge pull request #1433 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 Jan 9, 2025
2 parents d09a4d1 + dc5e6b6 commit 2692d87
Show file tree
Hide file tree
Showing 55 changed files with 1,354 additions and 76 deletions.
11 changes: 11 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
### Why?
<!-- Describe why this change is being made. Briefly include history and context, high-level what this PR does, and what the world looks like afterward. -->

### What?
<!--
List out the key changes made in this PR, e.g.
- implements the antimatter particle trace in the nitronium microfilament drive
- updated tests -->

### See Also
<!-- Include any links or additional information that help explain this change. -->
71 changes: 71 additions & 0 deletions CHANGELOG.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion OPENAPI_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v1406
v1436
28 changes: 28 additions & 0 deletions stripe/_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,20 @@ class AddressKanji(StripeObject):
Town/cho-me.
"""

class DirectorshipDeclaration(StripeObject):
date: Optional[int]
"""
The Unix timestamp marking when the directorship declaration attestation was made.
"""
ip: Optional[str]
"""
The IP address from which the directorship declaration attestation was made.
"""
user_agent: Optional[str]
"""
The user-agent string from the browser where the directorship declaration attestation was made.
"""

class OwnershipDeclaration(StripeObject):
date: Optional[int]
"""
Expand Down Expand Up @@ -597,6 +611,10 @@ class Document(StripeObject):
"""
Whether the company's directors have been provided. This Boolean will be `true` if you've manually indicated that all directors are provided via [the `directors_provided` parameter](https://stripe.com/docs/api/accounts/update#update_account-company-directors_provided).
"""
directorship_declaration: Optional[DirectorshipDeclaration]
"""
This hash is used to attest that the director information provided to Stripe is both current and correct.
"""
executives_provided: Optional[bool]
"""
Whether the company's executives have been provided. This Boolean will be `true` if you've manually indicated that all executives are provided via [the `executives_provided` parameter](https://stripe.com/docs/api/accounts/update#update_account-company-executives_provided), or if Stripe determined that sufficient executives were provided.
Expand Down Expand Up @@ -629,6 +647,12 @@ class Document(StripeObject):
"""
This hash is used to attest that the beneficial owner information provided to Stripe is both current and correct.
"""
ownership_exemption_reason: Optional[
Literal[
"qualified_entity_exceeds_ownership_threshold",
"qualifies_as_financial_institution",
]
]
phone: Optional[str]
"""
The company's phone number (used for verification).
Expand Down Expand Up @@ -683,6 +707,7 @@ class Document(StripeObject):
"address": Address,
"address_kana": AddressKana,
"address_kanji": AddressKanji,
"directorship_declaration": DirectorshipDeclaration,
"ownership_declaration": OwnershipDeclaration,
"verification": Verification,
}
Expand Down Expand Up @@ -2520,6 +2545,9 @@ class CreateParamsCompany(TypedDict):
"""
This hash is used to attest that the beneficial owner information provided to Stripe is both current and correct.
"""
ownership_exemption_reason: NotRequired[
"Literal['']|Literal['qualified_entity_exceeds_ownership_threshold', 'qualifies_as_financial_institution']"
]
phone: NotRequired[str]
"""
The company's phone number (used for verification).
Expand Down
6 changes: 6 additions & 0 deletions stripe/_account_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -1119,6 +1119,9 @@ class CreateParamsCompany(TypedDict):
"""
This hash is used to attest that the beneficial owner information provided to Stripe is both current and correct.
"""
ownership_exemption_reason: NotRequired[
"Literal['']|Literal['qualified_entity_exceeds_ownership_threshold', 'qualifies_as_financial_institution']"
]
phone: NotRequired[str]
"""
The company's phone number (used for verification).
Expand Down Expand Up @@ -3143,6 +3146,9 @@ class UpdateParamsCompany(TypedDict):
"""
This hash is used to attest that the beneficial owner information provided to Stripe is both current and correct.
"""
ownership_exemption_reason: NotRequired[
"Literal['']|Literal['qualified_entity_exceeds_ownership_threshold', 'qualifies_as_financial_institution']"
]
phone: NotRequired[str]
"""
The company's phone number (used for verification).
Expand Down
43 changes: 36 additions & 7 deletions stripe/_api_requestor.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
Unpack,
)
import uuid
from urllib.parse import urlsplit, urlunsplit
from urllib.parse import urlsplit, urlunsplit, parse_qs

# breaking circular dependency
import stripe # noqa: IMP101
Expand Down Expand Up @@ -559,6 +559,35 @@ def _args_for_request_with_retries(
url,
)

params = params or {}
if params and (method == "get" or method == "delete"):
# if we're sending params in the querystring, then we have to make sure we're not
# duplicating anything we got back from the server already (like in a list iterator)
# so, we parse the querystring the server sends back so we can merge with what we (or the user) are trying to send
existing_params = {}
for k, v in parse_qs(urlsplit(url).query).items():
# note: server sends back "expand[]" but users supply "expand", so we strip the brackets from the key name
if k.endswith("[]"):
existing_params[k[:-2]] = v
else:
# all querystrings are pulled out as lists.
# We want to keep the querystrings that actually are lists, but flatten the ones that are single values
existing_params[k] = v[0] if len(v) == 1 else v

# if a user is expanding something that wasn't expanded before, add (and deduplicate) it
# this could theoretically work for other lists that we want to merge too, but that doesn't seem to be a use case
# it never would have worked before, so I think we can start with `expand` and go from there
if "expand" in existing_params and "expand" in params:
params["expand"] = list( # type:ignore - this is a dict
set([*existing_params["expand"], *params["expand"]])
)

params = {
**existing_params,
# user_supplied params take precedence over server params
**params,
}

encoded_params = urlencode(list(_api_encode(params or {}, api_mode)))

# Don't use strict form encoding by changing the square bracket control
Expand Down Expand Up @@ -589,13 +618,13 @@ def _args_for_request_with_retries(

if method == "get" or method == "delete":
if params:
query = encoded_params
scheme, netloc, path, base_query, fragment = urlsplit(abs_url)
# if we're sending query params, we've already merged the incoming ones with the server's "url"
# so we can overwrite the whole thing
scheme, netloc, path, _, fragment = urlsplit(abs_url)

if base_query:
query = "%s&%s" % (base_query, query)

abs_url = urlunsplit((scheme, netloc, path, query, fragment))
abs_url = urlunsplit(
(scheme, netloc, path, encoded_params, fragment)
)
post_data = None
elif method == "post":
if (
Expand Down
4 changes: 4 additions & 0 deletions stripe/_card.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ class DeleteParams(RequestOptions):
"""
Card brand. Can be `American Express`, `Diners Club`, `Discover`, `Eftpos Australia`, `Girocard`, `JCB`, `MasterCard`, `UnionPay`, `Visa`, or `Unknown`.
"""
brand_product: Optional[str]
"""
The [product code](https://stripe.com/docs/card-product-codes) that identifies the specific program or product associated with a card. (For internal use only and not typically available in standard API requests.)
"""
country: Optional[str]
"""
Two-letter ISO code representing the country of the card. You could use this attribute to get a sense of the international breakdown of cards you've collected.
Expand Down
10 changes: 10 additions & 0 deletions stripe/_charge.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,12 @@ class Rule(StripeObject):
The predicate to evaluate the payment against.
"""

advice_code: Optional[
Literal["confirm_card_data", "do_not_try_again", "try_again_later"]
]
"""
An enumerated value providing a more detailed explanation on [how to proceed with an error](https://stripe.com/docs/declines#retrying-issuer-declines).
"""
network_advice_code: Optional[str]
"""
For charges declined by the network, a 2 digit code which indicates the advice returned by the network on how to proceed with an error.
Expand Down Expand Up @@ -1664,6 +1670,10 @@ class VerifiedAddress(StripeObject):
State, county, province, or region.
"""

country: Optional[str]
"""
Two-letter ISO code representing the buyer's country. Values are provided by PayPal directly (if supported) at the time of authorization or settlement. They cannot be set or mutated.
"""
payer_email: Optional[str]
"""
Owner's email. Values are provided by PayPal directly
Expand Down
4 changes: 4 additions & 0 deletions stripe/_confirmation_token.py
Original file line number Diff line number Diff line change
Expand Up @@ -1174,6 +1174,10 @@ class Paynow(StripeObject):
pass

class Paypal(StripeObject):
country: Optional[str]
"""
Two-letter ISO code representing the buyer's country. Values are provided by PayPal directly (if supported) at the time of authorization or settlement. They cannot be set or mutated.
"""
fingerprint: Optional[str]
"""
Uniquely identifies this particular PayPal account. You can use this attribute to check whether two PayPal accounts are the same.
Expand Down
2 changes: 1 addition & 1 deletion stripe/_credit_note.py
Original file line number Diff line number Diff line change
Expand Up @@ -788,7 +788,7 @@ class VoidCreditNoteParams(RequestOptions):
"""
post_payment_amount: Optional[int]
pre_payment_amount: Optional[int]
pretax_credit_amounts: Optional[List[PretaxCreditAmount]]
pretax_credit_amounts: List[PretaxCreditAmount]
"""
The pretax credit amounts (ex: discount, credit grants, etc) for all line items.
"""
Expand Down
2 changes: 1 addition & 1 deletion stripe/_credit_note_line_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ class TaxAmount(StripeObject):
"""
String representing the object's type. Objects of the same type share the same value.
"""
pretax_credit_amounts: Optional[List[PretaxCreditAmount]]
pretax_credit_amounts: List[PretaxCreditAmount]
"""
The pretax credit amounts (ex: discount, credit grants, etc) for this line item.
"""
Expand Down
6 changes: 4 additions & 2 deletions stripe/_customer.py
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,7 @@ class CreateParamsTaxIdDatum(TypedDict):
type: Literal[
"ad_nrt",
"ae_trn",
"al_tin",
"am_tin",
"ao_tin",
"ar_cuit",
Expand Down Expand Up @@ -613,7 +614,7 @@ class CreateParamsTaxIdDatum(TypedDict):
"zw_tin",
]
"""
Type of the tax ID, one of `ad_nrt`, `ae_trn`, `am_tin`, `ao_tin`, `ar_cuit`, `au_abn`, `au_arn`, `ba_tin`, `bb_tin`, `bg_uic`, `bh_vat`, `bo_tin`, `br_cnpj`, `br_cpf`, `bs_tin`, `by_tin`, `ca_bn`, `ca_gst_hst`, `ca_pst_bc`, `ca_pst_mb`, `ca_pst_sk`, `ca_qst`, `cd_nif`, `ch_uid`, `ch_vat`, `cl_tin`, `cn_tin`, `co_nit`, `cr_tin`, `de_stn`, `do_rcn`, `ec_ruc`, `eg_tin`, `es_cif`, `eu_oss_vat`, `eu_vat`, `gb_vat`, `ge_vat`, `gn_nif`, `hk_br`, `hr_oib`, `hu_tin`, `id_npwp`, `il_vat`, `in_gst`, `is_vat`, `jp_cn`, `jp_rn`, `jp_trn`, `ke_pin`, `kh_tin`, `kr_brn`, `kz_bin`, `li_uid`, `li_vat`, `ma_vat`, `md_vat`, `me_pib`, `mk_vat`, `mr_nif`, `mx_rfc`, `my_frp`, `my_itn`, `my_sst`, `ng_tin`, `no_vat`, `no_voec`, `np_pan`, `nz_gst`, `om_vat`, `pe_ruc`, `ph_tin`, `ro_tin`, `rs_pib`, `ru_inn`, `ru_kpp`, `sa_vat`, `sg_gst`, `sg_uen`, `si_tin`, `sn_ninea`, `sr_fin`, `sv_nit`, `th_vat`, `tj_tin`, `tr_tin`, `tw_vat`, `tz_vat`, `ua_vat`, `ug_tin`, `us_ein`, `uy_ruc`, `uz_tin`, `uz_vat`, `ve_rif`, `vn_tin`, `za_vat`, `zm_tin`, or `zw_tin`
Type of the tax ID, one of `ad_nrt`, `ae_trn`, `al_tin`, `am_tin`, `ao_tin`, `ar_cuit`, `au_abn`, `au_arn`, `ba_tin`, `bb_tin`, `bg_uic`, `bh_vat`, `bo_tin`, `br_cnpj`, `br_cpf`, `bs_tin`, `by_tin`, `ca_bn`, `ca_gst_hst`, `ca_pst_bc`, `ca_pst_mb`, `ca_pst_sk`, `ca_qst`, `cd_nif`, `ch_uid`, `ch_vat`, `cl_tin`, `cn_tin`, `co_nit`, `cr_tin`, `de_stn`, `do_rcn`, `ec_ruc`, `eg_tin`, `es_cif`, `eu_oss_vat`, `eu_vat`, `gb_vat`, `ge_vat`, `gn_nif`, `hk_br`, `hr_oib`, `hu_tin`, `id_npwp`, `il_vat`, `in_gst`, `is_vat`, `jp_cn`, `jp_rn`, `jp_trn`, `ke_pin`, `kh_tin`, `kr_brn`, `kz_bin`, `li_uid`, `li_vat`, `ma_vat`, `md_vat`, `me_pib`, `mk_vat`, `mr_nif`, `mx_rfc`, `my_frp`, `my_itn`, `my_sst`, `ng_tin`, `no_vat`, `no_voec`, `np_pan`, `nz_gst`, `om_vat`, `pe_ruc`, `ph_tin`, `ro_tin`, `rs_pib`, `ru_inn`, `ru_kpp`, `sa_vat`, `sg_gst`, `sg_uen`, `si_tin`, `sn_ninea`, `sr_fin`, `sv_nit`, `th_vat`, `tj_tin`, `tr_tin`, `tw_vat`, `tz_vat`, `ua_vat`, `ug_tin`, `us_ein`, `uy_ruc`, `uz_tin`, `uz_vat`, `ve_rif`, `vn_tin`, `za_vat`, `zm_tin`, or `zw_tin`
"""
value: str
"""
Expand Down Expand Up @@ -643,6 +644,7 @@ class CreateTaxIdParams(RequestOptions):
type: Literal[
"ad_nrt",
"ae_trn",
"al_tin",
"am_tin",
"ao_tin",
"ar_cuit",
Expand Down Expand Up @@ -742,7 +744,7 @@ class CreateTaxIdParams(RequestOptions):
"zw_tin",
]
"""
Type of the tax ID, one of `ad_nrt`, `ae_trn`, `am_tin`, `ao_tin`, `ar_cuit`, `au_abn`, `au_arn`, `ba_tin`, `bb_tin`, `bg_uic`, `bh_vat`, `bo_tin`, `br_cnpj`, `br_cpf`, `bs_tin`, `by_tin`, `ca_bn`, `ca_gst_hst`, `ca_pst_bc`, `ca_pst_mb`, `ca_pst_sk`, `ca_qst`, `cd_nif`, `ch_uid`, `ch_vat`, `cl_tin`, `cn_tin`, `co_nit`, `cr_tin`, `de_stn`, `do_rcn`, `ec_ruc`, `eg_tin`, `es_cif`, `eu_oss_vat`, `eu_vat`, `gb_vat`, `ge_vat`, `gn_nif`, `hk_br`, `hr_oib`, `hu_tin`, `id_npwp`, `il_vat`, `in_gst`, `is_vat`, `jp_cn`, `jp_rn`, `jp_trn`, `ke_pin`, `kh_tin`, `kr_brn`, `kz_bin`, `li_uid`, `li_vat`, `ma_vat`, `md_vat`, `me_pib`, `mk_vat`, `mr_nif`, `mx_rfc`, `my_frp`, `my_itn`, `my_sst`, `ng_tin`, `no_vat`, `no_voec`, `np_pan`, `nz_gst`, `om_vat`, `pe_ruc`, `ph_tin`, `ro_tin`, `rs_pib`, `ru_inn`, `ru_kpp`, `sa_vat`, `sg_gst`, `sg_uen`, `si_tin`, `sn_ninea`, `sr_fin`, `sv_nit`, `th_vat`, `tj_tin`, `tr_tin`, `tw_vat`, `tz_vat`, `ua_vat`, `ug_tin`, `us_ein`, `uy_ruc`, `uz_tin`, `uz_vat`, `ve_rif`, `vn_tin`, `za_vat`, `zm_tin`, or `zw_tin`
Type of the tax ID, one of `ad_nrt`, `ae_trn`, `al_tin`, `am_tin`, `ao_tin`, `ar_cuit`, `au_abn`, `au_arn`, `ba_tin`, `bb_tin`, `bg_uic`, `bh_vat`, `bo_tin`, `br_cnpj`, `br_cpf`, `bs_tin`, `by_tin`, `ca_bn`, `ca_gst_hst`, `ca_pst_bc`, `ca_pst_mb`, `ca_pst_sk`, `ca_qst`, `cd_nif`, `ch_uid`, `ch_vat`, `cl_tin`, `cn_tin`, `co_nit`, `cr_tin`, `de_stn`, `do_rcn`, `ec_ruc`, `eg_tin`, `es_cif`, `eu_oss_vat`, `eu_vat`, `gb_vat`, `ge_vat`, `gn_nif`, `hk_br`, `hr_oib`, `hu_tin`, `id_npwp`, `il_vat`, `in_gst`, `is_vat`, `jp_cn`, `jp_rn`, `jp_trn`, `ke_pin`, `kh_tin`, `kr_brn`, `kz_bin`, `li_uid`, `li_vat`, `ma_vat`, `md_vat`, `me_pib`, `mk_vat`, `mr_nif`, `mx_rfc`, `my_frp`, `my_itn`, `my_sst`, `ng_tin`, `no_vat`, `no_voec`, `np_pan`, `nz_gst`, `om_vat`, `pe_ruc`, `ph_tin`, `ro_tin`, `rs_pib`, `ru_inn`, `ru_kpp`, `sa_vat`, `sg_gst`, `sg_uen`, `si_tin`, `sn_ninea`, `sr_fin`, `sv_nit`, `th_vat`, `tj_tin`, `tr_tin`, `tw_vat`, `tz_vat`, `ua_vat`, `ug_tin`, `us_ein`, `uy_ruc`, `uz_tin`, `uz_vat`, `ve_rif`, `vn_tin`, `za_vat`, `zm_tin`, or `zw_tin`
"""
value: str
"""
Expand Down
3 changes: 2 additions & 1 deletion stripe/_customer_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ class CreateParamsTaxIdDatum(TypedDict):
type: Literal[
"ad_nrt",
"ae_trn",
"al_tin",
"am_tin",
"ao_tin",
"ar_cuit",
Expand Down Expand Up @@ -375,7 +376,7 @@ class CreateParamsTaxIdDatum(TypedDict):
"zw_tin",
]
"""
Type of the tax ID, one of `ad_nrt`, `ae_trn`, `am_tin`, `ao_tin`, `ar_cuit`, `au_abn`, `au_arn`, `ba_tin`, `bb_tin`, `bg_uic`, `bh_vat`, `bo_tin`, `br_cnpj`, `br_cpf`, `bs_tin`, `by_tin`, `ca_bn`, `ca_gst_hst`, `ca_pst_bc`, `ca_pst_mb`, `ca_pst_sk`, `ca_qst`, `cd_nif`, `ch_uid`, `ch_vat`, `cl_tin`, `cn_tin`, `co_nit`, `cr_tin`, `de_stn`, `do_rcn`, `ec_ruc`, `eg_tin`, `es_cif`, `eu_oss_vat`, `eu_vat`, `gb_vat`, `ge_vat`, `gn_nif`, `hk_br`, `hr_oib`, `hu_tin`, `id_npwp`, `il_vat`, `in_gst`, `is_vat`, `jp_cn`, `jp_rn`, `jp_trn`, `ke_pin`, `kh_tin`, `kr_brn`, `kz_bin`, `li_uid`, `li_vat`, `ma_vat`, `md_vat`, `me_pib`, `mk_vat`, `mr_nif`, `mx_rfc`, `my_frp`, `my_itn`, `my_sst`, `ng_tin`, `no_vat`, `no_voec`, `np_pan`, `nz_gst`, `om_vat`, `pe_ruc`, `ph_tin`, `ro_tin`, `rs_pib`, `ru_inn`, `ru_kpp`, `sa_vat`, `sg_gst`, `sg_uen`, `si_tin`, `sn_ninea`, `sr_fin`, `sv_nit`, `th_vat`, `tj_tin`, `tr_tin`, `tw_vat`, `tz_vat`, `ua_vat`, `ug_tin`, `us_ein`, `uy_ruc`, `uz_tin`, `uz_vat`, `ve_rif`, `vn_tin`, `za_vat`, `zm_tin`, or `zw_tin`
Type of the tax ID, one of `ad_nrt`, `ae_trn`, `al_tin`, `am_tin`, `ao_tin`, `ar_cuit`, `au_abn`, `au_arn`, `ba_tin`, `bb_tin`, `bg_uic`, `bh_vat`, `bo_tin`, `br_cnpj`, `br_cpf`, `bs_tin`, `by_tin`, `ca_bn`, `ca_gst_hst`, `ca_pst_bc`, `ca_pst_mb`, `ca_pst_sk`, `ca_qst`, `cd_nif`, `ch_uid`, `ch_vat`, `cl_tin`, `cn_tin`, `co_nit`, `cr_tin`, `de_stn`, `do_rcn`, `ec_ruc`, `eg_tin`, `es_cif`, `eu_oss_vat`, `eu_vat`, `gb_vat`, `ge_vat`, `gn_nif`, `hk_br`, `hr_oib`, `hu_tin`, `id_npwp`, `il_vat`, `in_gst`, `is_vat`, `jp_cn`, `jp_rn`, `jp_trn`, `ke_pin`, `kh_tin`, `kr_brn`, `kz_bin`, `li_uid`, `li_vat`, `ma_vat`, `md_vat`, `me_pib`, `mk_vat`, `mr_nif`, `mx_rfc`, `my_frp`, `my_itn`, `my_sst`, `ng_tin`, `no_vat`, `no_voec`, `np_pan`, `nz_gst`, `om_vat`, `pe_ruc`, `ph_tin`, `ro_tin`, `rs_pib`, `ru_inn`, `ru_kpp`, `sa_vat`, `sg_gst`, `sg_uen`, `si_tin`, `sn_ninea`, `sr_fin`, `sv_nit`, `th_vat`, `tj_tin`, `tr_tin`, `tw_vat`, `tz_vat`, `ua_vat`, `ug_tin`, `us_ein`, `uy_ruc`, `uz_tin`, `uz_vat`, `ve_rif`, `vn_tin`, `za_vat`, `zm_tin`, or `zw_tin`
"""
value: str
"""
Expand Down
Loading

0 comments on commit 2692d87

Please sign in to comment.