Skip to content

Commit 2692d87

Browse files
Merge pull request #1433 from stripe/latest-codegen-beta
Update generated code for beta
2 parents d09a4d1 + dc5e6b6 commit 2692d87

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+1354
-76
lines changed

.github/pull_request_template.md

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
### Why?
2+
<!-- 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. -->
3+
4+
### What?
5+
<!--
6+
List out the key changes made in this PR, e.g.
7+
- implements the antimatter particle trace in the nitronium microfilament drive
8+
- updated tests -->
9+
10+
### See Also
11+
<!-- Include any links or additional information that help explain this change. -->

CHANGELOG.md

+71
Large diffs are not rendered by default.

OPENAPI_VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v1406
1+
v1436

stripe/_account.py

+28
Original file line numberDiff line numberDiff line change
@@ -548,6 +548,20 @@ class AddressKanji(StripeObject):
548548
Town/cho-me.
549549
"""
550550

551+
class DirectorshipDeclaration(StripeObject):
552+
date: Optional[int]
553+
"""
554+
The Unix timestamp marking when the directorship declaration attestation was made.
555+
"""
556+
ip: Optional[str]
557+
"""
558+
The IP address from which the directorship declaration attestation was made.
559+
"""
560+
user_agent: Optional[str]
561+
"""
562+
The user-agent string from the browser where the directorship declaration attestation was made.
563+
"""
564+
551565
class OwnershipDeclaration(StripeObject):
552566
date: Optional[int]
553567
"""
@@ -597,6 +611,10 @@ class Document(StripeObject):
597611
"""
598612
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).
599613
"""
614+
directorship_declaration: Optional[DirectorshipDeclaration]
615+
"""
616+
This hash is used to attest that the director information provided to Stripe is both current and correct.
617+
"""
600618
executives_provided: Optional[bool]
601619
"""
602620
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.
@@ -629,6 +647,12 @@ class Document(StripeObject):
629647
"""
630648
This hash is used to attest that the beneficial owner information provided to Stripe is both current and correct.
631649
"""
650+
ownership_exemption_reason: Optional[
651+
Literal[
652+
"qualified_entity_exceeds_ownership_threshold",
653+
"qualifies_as_financial_institution",
654+
]
655+
]
632656
phone: Optional[str]
633657
"""
634658
The company's phone number (used for verification).
@@ -683,6 +707,7 @@ class Document(StripeObject):
683707
"address": Address,
684708
"address_kana": AddressKana,
685709
"address_kanji": AddressKanji,
710+
"directorship_declaration": DirectorshipDeclaration,
686711
"ownership_declaration": OwnershipDeclaration,
687712
"verification": Verification,
688713
}
@@ -2520,6 +2545,9 @@ class CreateParamsCompany(TypedDict):
25202545
"""
25212546
This hash is used to attest that the beneficial owner information provided to Stripe is both current and correct.
25222547
"""
2548+
ownership_exemption_reason: NotRequired[
2549+
"Literal['']|Literal['qualified_entity_exceeds_ownership_threshold', 'qualifies_as_financial_institution']"
2550+
]
25232551
phone: NotRequired[str]
25242552
"""
25252553
The company's phone number (used for verification).

stripe/_account_service.py

+6
Original file line numberDiff line numberDiff line change
@@ -1119,6 +1119,9 @@ class CreateParamsCompany(TypedDict):
11191119
"""
11201120
This hash is used to attest that the beneficial owner information provided to Stripe is both current and correct.
11211121
"""
1122+
ownership_exemption_reason: NotRequired[
1123+
"Literal['']|Literal['qualified_entity_exceeds_ownership_threshold', 'qualifies_as_financial_institution']"
1124+
]
11221125
phone: NotRequired[str]
11231126
"""
11241127
The company's phone number (used for verification).
@@ -3143,6 +3146,9 @@ class UpdateParamsCompany(TypedDict):
31433146
"""
31443147
This hash is used to attest that the beneficial owner information provided to Stripe is both current and correct.
31453148
"""
3149+
ownership_exemption_reason: NotRequired[
3150+
"Literal['']|Literal['qualified_entity_exceeds_ownership_threshold', 'qualifies_as_financial_institution']"
3151+
]
31463152
phone: NotRequired[str]
31473153
"""
31483154
The company's phone number (used for verification).

stripe/_api_requestor.py

+36-7
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
Unpack,
2121
)
2222
import uuid
23-
from urllib.parse import urlsplit, urlunsplit
23+
from urllib.parse import urlsplit, urlunsplit, parse_qs
2424

2525
# breaking circular dependency
2626
import stripe # noqa: IMP101
@@ -559,6 +559,35 @@ def _args_for_request_with_retries(
559559
url,
560560
)
561561

562+
params = params or {}
563+
if params and (method == "get" or method == "delete"):
564+
# if we're sending params in the querystring, then we have to make sure we're not
565+
# duplicating anything we got back from the server already (like in a list iterator)
566+
# so, we parse the querystring the server sends back so we can merge with what we (or the user) are trying to send
567+
existing_params = {}
568+
for k, v in parse_qs(urlsplit(url).query).items():
569+
# note: server sends back "expand[]" but users supply "expand", so we strip the brackets from the key name
570+
if k.endswith("[]"):
571+
existing_params[k[:-2]] = v
572+
else:
573+
# all querystrings are pulled out as lists.
574+
# We want to keep the querystrings that actually are lists, but flatten the ones that are single values
575+
existing_params[k] = v[0] if len(v) == 1 else v
576+
577+
# if a user is expanding something that wasn't expanded before, add (and deduplicate) it
578+
# this could theoretically work for other lists that we want to merge too, but that doesn't seem to be a use case
579+
# it never would have worked before, so I think we can start with `expand` and go from there
580+
if "expand" in existing_params and "expand" in params:
581+
params["expand"] = list( # type:ignore - this is a dict
582+
set([*existing_params["expand"], *params["expand"]])
583+
)
584+
585+
params = {
586+
**existing_params,
587+
# user_supplied params take precedence over server params
588+
**params,
589+
}
590+
562591
encoded_params = urlencode(list(_api_encode(params or {}, api_mode)))
563592

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

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

595-
if base_query:
596-
query = "%s&%s" % (base_query, query)
597-
598-
abs_url = urlunsplit((scheme, netloc, path, query, fragment))
625+
abs_url = urlunsplit(
626+
(scheme, netloc, path, encoded_params, fragment)
627+
)
599628
post_data = None
600629
elif method == "post":
601630
if (

stripe/_card.py

+4
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,10 @@ class DeleteParams(RequestOptions):
8484
"""
8585
Card brand. Can be `American Express`, `Diners Club`, `Discover`, `Eftpos Australia`, `Girocard`, `JCB`, `MasterCard`, `UnionPay`, `Visa`, or `Unknown`.
8686
"""
87+
brand_product: Optional[str]
88+
"""
89+
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.)
90+
"""
8791
country: Optional[str]
8892
"""
8993
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.

stripe/_charge.py

+10
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,12 @@ class Rule(StripeObject):
151151
The predicate to evaluate the payment against.
152152
"""
153153

154+
advice_code: Optional[
155+
Literal["confirm_card_data", "do_not_try_again", "try_again_later"]
156+
]
157+
"""
158+
An enumerated value providing a more detailed explanation on [how to proceed with an error](https://stripe.com/docs/declines#retrying-issuer-declines).
159+
"""
154160
network_advice_code: Optional[str]
155161
"""
156162
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.
@@ -1664,6 +1670,10 @@ class VerifiedAddress(StripeObject):
16641670
State, county, province, or region.
16651671
"""
16661672

1673+
country: Optional[str]
1674+
"""
1675+
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.
1676+
"""
16671677
payer_email: Optional[str]
16681678
"""
16691679
Owner's email. Values are provided by PayPal directly

stripe/_confirmation_token.py

+4
Original file line numberDiff line numberDiff line change
@@ -1174,6 +1174,10 @@ class Paynow(StripeObject):
11741174
pass
11751175

11761176
class Paypal(StripeObject):
1177+
country: Optional[str]
1178+
"""
1179+
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.
1180+
"""
11771181
fingerprint: Optional[str]
11781182
"""
11791183
Uniquely identifies this particular PayPal account. You can use this attribute to check whether two PayPal accounts are the same.

stripe/_credit_note.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -788,7 +788,7 @@ class VoidCreditNoteParams(RequestOptions):
788788
"""
789789
post_payment_amount: Optional[int]
790790
pre_payment_amount: Optional[int]
791-
pretax_credit_amounts: Optional[List[PretaxCreditAmount]]
791+
pretax_credit_amounts: List[PretaxCreditAmount]
792792
"""
793793
The pretax credit amounts (ex: discount, credit grants, etc) for all line items.
794794
"""

stripe/_credit_note_line_item.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ class TaxAmount(StripeObject):
128128
"""
129129
String representing the object's type. Objects of the same type share the same value.
130130
"""
131-
pretax_credit_amounts: Optional[List[PretaxCreditAmount]]
131+
pretax_credit_amounts: List[PretaxCreditAmount]
132132
"""
133133
The pretax credit amounts (ex: discount, credit grants, etc) for this line item.
134134
"""

stripe/_customer.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,7 @@ class CreateParamsTaxIdDatum(TypedDict):
514514
type: Literal[
515515
"ad_nrt",
516516
"ae_trn",
517+
"al_tin",
517518
"am_tin",
518519
"ao_tin",
519520
"ar_cuit",
@@ -613,7 +614,7 @@ class CreateParamsTaxIdDatum(TypedDict):
613614
"zw_tin",
614615
]
615616
"""
616-
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`
617+
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`
617618
"""
618619
value: str
619620
"""
@@ -643,6 +644,7 @@ class CreateTaxIdParams(RequestOptions):
643644
type: Literal[
644645
"ad_nrt",
645646
"ae_trn",
647+
"al_tin",
646648
"am_tin",
647649
"ao_tin",
648650
"ar_cuit",
@@ -742,7 +744,7 @@ class CreateTaxIdParams(RequestOptions):
742744
"zw_tin",
743745
]
744746
"""
745-
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`
747+
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`
746748
"""
747749
value: str
748750
"""

stripe/_customer_service.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,7 @@ class CreateParamsTaxIdDatum(TypedDict):
276276
type: Literal[
277277
"ad_nrt",
278278
"ae_trn",
279+
"al_tin",
279280
"am_tin",
280281
"ao_tin",
281282
"ar_cuit",
@@ -375,7 +376,7 @@ class CreateParamsTaxIdDatum(TypedDict):
375376
"zw_tin",
376377
]
377378
"""
378-
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`
379+
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`
379380
"""
380381
value: str
381382
"""

0 commit comments

Comments
 (0)