Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update generated code for beta #1141

Merged
merged 17 commits into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Changelog

## 7.6.0 - 2023-11-21
* [#1138](https://github.com/stripe/stripe-python/pull/1138) Update generated code
* Add support for `electronic_commerce_indicator` on resource classes `Charge.PaymentMethodDetails.Card.ThreeDSecure` and `SetupAttempt.PaymentMethodDetails.Card.ThreeDSecure`
* Add support for `exemption_indicator` on resource class `Charge.PaymentMethodDetails.Card.ThreeDSecure`
* Add support for `transaction_id` on resource classes `Charge.PaymentMethodDetails.Card.ThreeDSecure`, `SetupAttempt.PaymentMethodDetails.Card.ThreeDSecure`, `issuing.Authorization.NetworkData`, and `issuing.Transaction.NetworkData`
* Add support for `offline` on resource class `Charge.PaymentMethodDetails.CardPresent`
* Add support for `transferred_to_balance` on resource `CustomerCashBalanceTransaction`
* Add support for `three_d_secure` on parameter classes `PaymentIntent.ConfirmParamsPaymentMethodOptionsCard`, `PaymentIntent.CreateParamsPaymentMethodOptionsCard`, `PaymentIntent.ModifyParamsPaymentMethodOptionsCard`, `SetupIntent.ConfirmParamsPaymentMethodOptionsCard`, `SetupIntent.CreateParamsPaymentMethodOptionsCard`, and `SetupIntent.ModifyParamsPaymentMethodOptionsCard`
* Add support for `system_trace_audit_number` on resource class `issuing.Authorization.NetworkData`
* Add support for `network_risk_score` on resource classes `issuing.Authorization.PendingRequest` and `issuing.Authorization.RequestHistory`
* Add support for `requested_at` on resource class `issuing.Authorization.RequestHistory`
* Add support for `authorization_code` on resource class `issuing.Transaction.NetworkData`

## 7.6.0b1 - 2023-11-16
* [#1128](https://github.com/stripe/stripe-python/pull/1128) Update generated code for beta
* Add support for `issuing_card` and `issuing_cards_list` on `AccountSession.CreateParamsComponents`
Expand All @@ -21,7 +34,7 @@
* [#1135](https://github.com/stripe/stripe-python/pull/1135) Add initial tests for exports and run them in mypy and pyright
* [#1130](https://github.com/stripe/stripe-python/pull/1130) Mention types in README.md
* [#1134](https://github.com/stripe/stripe-python/pull/1134) Run pyright via tox
* [#1131](https://github.com/stripe/stripe-python/pull/1131) Upgrade black dependency
* [#1131](https://github.com/stripe/stripe-python/pull/1131) Upgrade black dependency
* [#1132](https://github.com/stripe/stripe-python/pull/1132) Fix unnecessary casts from pyright 1.1.336
* [#1126](https://github.com/stripe/stripe-python/pull/1126) Suppress type errors from latest pyright
* [#1125](https://github.com/stripe/stripe-python/pull/1125) Add support for Python 3.11/3.12
Expand Down
2 changes: 1 addition & 1 deletion OPENAPI_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v669
v680
8 changes: 7 additions & 1 deletion stripe/api_resources/abstract/custom_method.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
from typing import Optional
from stripe import util
from urllib.parse import quote_plus


def custom_method(name, http_verb, http_path=None, is_streaming=False):
def custom_method(
name: str,
http_verb: str,
http_path: Optional[str] = None,
is_streaming=False,
):
if http_verb not in ["get", "post", "delete"]:
raise ValueError(
"Invalid http_verb: %s. Must be one of 'get', 'post' or 'delete'"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from typing import List, Optional
from urllib.parse import quote_plus

from stripe.api_resources.abstract import APIResource
Expand All @@ -6,7 +7,10 @@
# TODO(major): Remove this. It is no longer used except for "nested_resource_url" and "nested_resource_request",
# which are unnecessary ande deprecated.
def nested_resource_class_methods(
resource, path=None, operations=None, resource_plural=None
resource: str,
path: Optional[str] = None,
operations: Optional[List[str]] = None,
resource_plural: Optional[str] = None,
):
if resource_plural is None:
resource_plural = "%ss" % resource
Expand Down
81 changes: 56 additions & 25 deletions stripe/api_resources/charge.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,22 @@ class ThreeDSecure(StripeObject):
For authenticated transactions: how the customer was authenticated by
the issuing bank.
"""
electronic_commerce_indicator: Optional[
Literal["01", "02", "05", "06", "07"]
]
"""
The Electronic Commerce Indicator (ECI). A protocol-level field
indicating what degree of authentication was performed.
"""
exemption_indicator: Optional[Literal["low_risk", "none"]]
"""
The exemption requested via 3DS and accepted by the issuer at authentication time.
"""
exemption_indicator_applied: Optional[bool]
"""
Whether Stripe requested the value of `exemption_indicator` in the transaction. This will depend on
the outcome of Stripe's internal risk assessment.
"""
result: Optional[
Literal[
"attempt_acknowledged",
Expand Down Expand Up @@ -468,6 +484,11 @@ class ThreeDSecure(StripeObject):
Additional information about why 3D Secure succeeded or failed based
on the `result`.
"""
transaction_id: Optional[str]
"""
The 3D Secure 1 XID or 3D Secure 2 Directory Server Transaction ID
(dsTransId) for this payment.
"""
version: Optional[Literal["1.0.2", "2.1.0", "2.2.0"]]
"""
The version of 3D Secure that was used.
Expand Down Expand Up @@ -771,6 +792,12 @@ class ShippingAddress(StripeObject):
}

class CardPresent(StripeObject):
class Offline(StripeObject):
stored_at: Optional[int]
"""
Time at which the payment was collected while offline
"""

class Receipt(StripeObject):
account_type: Optional[
Literal["checking", "credit", "prepaid", "unknown"]
Expand Down Expand Up @@ -881,6 +908,10 @@ class Receipt(StripeObject):
"""
Identifies which network this charge was processed on. Can be `amex`, `cartes_bancaires`, `diners`, `discover`, `eftpos_au`, `interac`, `jcb`, `mastercard`, `unionpay`, `visa`, or `unknown`.
"""
offline: Optional[Offline]
"""
Details about payments collected offline.
"""
overcapture_supported: bool
"""
Defines whether the authorized amount can be over-captured or not
Expand All @@ -901,7 +932,7 @@ class Receipt(StripeObject):
"""
A collection of fields required to be displayed on receipts. Only required for EMV transactions.
"""
_inner_class_types = {"receipt": Receipt}
_inner_class_types = {"offline": Offline, "receipt": Receipt}

class Cashapp(StripeObject):
buyer_id: Optional[str]
Expand Down Expand Up @@ -1936,14 +1967,14 @@ class CaptureParamsPaymentDetailsLodgingDelivery(TypedDict):
"""
The delivery method for the payment
"""
receipient: NotRequired[
"Charge.CaptureParamsPaymentDetailsLodgingDeliveryReceipient"
recipient: NotRequired[
"Charge.CaptureParamsPaymentDetailsLodgingDeliveryRecipient"
]
"""
Details of the recipient.
"""

class CaptureParamsPaymentDetailsLodgingDeliveryReceipient(TypedDict):
class CaptureParamsPaymentDetailsLodgingDeliveryRecipient(TypedDict):
email: NotRequired["str"]
"""
The email of the recipient the ticket is delivered to.
Expand Down Expand Up @@ -2072,14 +2103,14 @@ class CaptureParamsPaymentDetailsFlightDelivery(TypedDict):
"""
The delivery method for the payment
"""
receipient: NotRequired[
"Charge.CaptureParamsPaymentDetailsFlightDeliveryReceipient"
recipient: NotRequired[
"Charge.CaptureParamsPaymentDetailsFlightDeliveryRecipient"
]
"""
Details of the recipient.
"""

class CaptureParamsPaymentDetailsFlightDeliveryReceipient(TypedDict):
class CaptureParamsPaymentDetailsFlightDeliveryRecipient(TypedDict):
email: NotRequired["str"]
"""
The email of the recipient the ticket is delivered to.
Expand Down Expand Up @@ -2148,14 +2179,14 @@ class CaptureParamsPaymentDetailsEventDetailsDelivery(TypedDict):
"""
The delivery method for the payment
"""
receipient: NotRequired[
"Charge.CaptureParamsPaymentDetailsEventDetailsDeliveryReceipient"
recipient: NotRequired[
"Charge.CaptureParamsPaymentDetailsEventDetailsDeliveryRecipient"
]
"""
Details of the recipient.
"""

class CaptureParamsPaymentDetailsEventDetailsDeliveryReceipient(TypedDict):
class CaptureParamsPaymentDetailsEventDetailsDeliveryRecipient(TypedDict):
email: NotRequired["str"]
"""
The email of the recipient the ticket is delivered to.
Expand Down Expand Up @@ -2358,14 +2389,14 @@ class CaptureParamsPaymentDetailsCarRentalDelivery(TypedDict):
"""
The delivery method for the payment
"""
receipient: NotRequired[
"Charge.CaptureParamsPaymentDetailsCarRentalDeliveryReceipient"
recipient: NotRequired[
"Charge.CaptureParamsPaymentDetailsCarRentalDeliveryRecipient"
]
"""
Details of the recipient.
"""

class CaptureParamsPaymentDetailsCarRentalDeliveryReceipient(TypedDict):
class CaptureParamsPaymentDetailsCarRentalDeliveryRecipient(TypedDict):
email: NotRequired["str"]
"""
The email of the recipient the ticket is delivered to.
Expand Down Expand Up @@ -2835,14 +2866,14 @@ class ModifyParamsPaymentDetailsLodgingDelivery(TypedDict):
"""
The delivery method for the payment
"""
receipient: NotRequired[
"Charge.ModifyParamsPaymentDetailsLodgingDeliveryReceipient"
recipient: NotRequired[
"Charge.ModifyParamsPaymentDetailsLodgingDeliveryRecipient"
]
"""
Details of the recipient.
"""

class ModifyParamsPaymentDetailsLodgingDeliveryReceipient(TypedDict):
class ModifyParamsPaymentDetailsLodgingDeliveryRecipient(TypedDict):
email: NotRequired["str"]
"""
The email of the recipient the ticket is delivered to.
Expand Down Expand Up @@ -2971,14 +3002,14 @@ class ModifyParamsPaymentDetailsFlightDelivery(TypedDict):
"""
The delivery method for the payment
"""
receipient: NotRequired[
"Charge.ModifyParamsPaymentDetailsFlightDeliveryReceipient"
recipient: NotRequired[
"Charge.ModifyParamsPaymentDetailsFlightDeliveryRecipient"
]
"""
Details of the recipient.
"""

class ModifyParamsPaymentDetailsFlightDeliveryReceipient(TypedDict):
class ModifyParamsPaymentDetailsFlightDeliveryRecipient(TypedDict):
email: NotRequired["str"]
"""
The email of the recipient the ticket is delivered to.
Expand Down Expand Up @@ -3047,14 +3078,14 @@ class ModifyParamsPaymentDetailsEventDetailsDelivery(TypedDict):
"""
The delivery method for the payment
"""
receipient: NotRequired[
"Charge.ModifyParamsPaymentDetailsEventDetailsDeliveryReceipient"
recipient: NotRequired[
"Charge.ModifyParamsPaymentDetailsEventDetailsDeliveryRecipient"
]
"""
Details of the recipient.
"""

class ModifyParamsPaymentDetailsEventDetailsDeliveryReceipient(TypedDict):
class ModifyParamsPaymentDetailsEventDetailsDeliveryRecipient(TypedDict):
email: NotRequired["str"]
"""
The email of the recipient the ticket is delivered to.
Expand Down Expand Up @@ -3257,14 +3288,14 @@ class ModifyParamsPaymentDetailsCarRentalDelivery(TypedDict):
"""
The delivery method for the payment
"""
receipient: NotRequired[
"Charge.ModifyParamsPaymentDetailsCarRentalDeliveryReceipient"
recipient: NotRequired[
"Charge.ModifyParamsPaymentDetailsCarRentalDeliveryRecipient"
]
"""
Details of the recipient.
"""

class ModifyParamsPaymentDetailsCarRentalDeliveryReceipient(TypedDict):
class ModifyParamsPaymentDetailsCarRentalDeliveryRecipient(TypedDict):
email: NotRequired["str"]
"""
The email of the recipient the ticket is delivered to.
Expand Down
8 changes: 8 additions & 0 deletions stripe/api_resources/customer_cash_balance_transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,12 @@ class RefundedFromPayment(StripeObject):
The [Refund](https://stripe.com/docs/api/refunds/object) that moved these funds into the customer's cash balance.
"""

class TransferredToBalance(StripeObject):
balance_transaction: ExpandableField["BalanceTransaction"]
"""
The [Balance Transaction](https://stripe.com/docs/api/balance_transactions/object) that corresponds to funds transferred to your Stripe balance.
"""

class UnappliedFromPayment(StripeObject):
payment_intent: ExpandableField["PaymentIntent"]
"""
Expand Down Expand Up @@ -199,6 +205,7 @@ class RetrieveParams(RequestOptions):
String representing the object's type. Objects of the same type share the same value.
"""
refunded_from_payment: Optional[RefundedFromPayment]
transferred_to_balance: Optional[TransferredToBalance]
type: Literal[
"adjusted_for_overdraft",
"applied_to_payment",
Expand Down Expand Up @@ -263,5 +270,6 @@ def retrieve(
"applied_to_payment": AppliedToPayment,
"funded": Funded,
"refunded_from_payment": RefundedFromPayment,
"transferred_to_balance": TransferredToBalance,
"unapplied_from_payment": UnappliedFromPayment,
}
Loading