Skip to content

Commit

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

* Update generated code for v1268

---------

Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
  • Loading branch information
stripe-openapi[bot] committed Sep 26, 2024
1 parent 3587026 commit 791fc11
Show file tree
Hide file tree
Showing 44 changed files with 2,045 additions and 203 deletions.
2 changes: 1 addition & 1 deletion OPENAPI_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v1267
v1268
1 change: 1 addition & 0 deletions stripe/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,7 @@ def __getattr__(name):
from stripe._login_link import LoginLink as LoginLink
from stripe._mandate import Mandate as Mandate
from stripe._mandate_service import MandateService as MandateService
from stripe._margin import Margin as Margin
from stripe._payment_intent import PaymentIntent as PaymentIntent
from stripe._payment_intent_service import (
PaymentIntentService as PaymentIntentService,
Expand Down
2 changes: 1 addition & 1 deletion stripe/_api_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-
# File generated from our OpenAPI spec
class _ApiVersion:
CURRENT = "2024-06-20"
CURRENT = "2024-09-30.acacia"
14 changes: 14 additions & 0 deletions stripe/_billing_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
# File generated from our OpenAPI spec
from stripe._stripe_service import StripeService
from stripe.billing._alert_service import AlertService
from stripe.billing._credit_balance_summary_service import (
CreditBalanceSummaryService,
)
from stripe.billing._credit_balance_transaction_service import (
CreditBalanceTransactionService,
)
from stripe.billing._credit_grant_service import CreditGrantService
from stripe.billing._meter_event_adjustment_service import (
MeterEventAdjustmentService,
)
Expand All @@ -13,6 +20,13 @@ class BillingService(StripeService):
def __init__(self, requestor):
super().__init__(requestor)
self.alerts = AlertService(self._requestor)
self.credit_balance_summary = CreditBalanceSummaryService(
self._requestor,
)
self.credit_balance_transactions = CreditBalanceTransactionService(
self._requestor,
)
self.credit_grants = CreditGrantService(self._requestor)
self.meters = MeterService(self._requestor)
self.meter_events = MeterEventService(self._requestor)
self.meter_event_adjustments = MeterEventAdjustmentService(
Expand Down
2 changes: 1 addition & 1 deletion stripe/_capability.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ class Error(StripeObject):
requirements: Optional[Requirements]
status: Literal["active", "disabled", "inactive", "pending", "unrequested"]
"""
The status of the capability. Can be `active`, `inactive`, `pending`, or `unrequested`.
The status of the capability.
"""

def instance_url(self):
Expand Down
25 changes: 25 additions & 0 deletions stripe/_credit_note.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
from stripe._refund import Refund
from stripe._shipping_rate import ShippingRate
from stripe._tax_rate import TaxRate
from stripe.billing._credit_balance_transaction import (
CreditBalanceTransaction,
)


@nested_resource_class_methods("line")
Expand All @@ -53,6 +56,26 @@ class DiscountAmount(StripeObject):
The discount that was applied to get this discount amount.
"""

class PretaxCreditAmount(StripeObject):
amount: int
"""
The amount, in cents (or local equivalent), of the pretax credit amount.
"""
credit_balance_transaction: Optional[
ExpandableField["CreditBalanceTransaction"]
]
"""
The credit balance transaction that was applied to get this pretax credit amount.
"""
discount: Optional[ExpandableField["Discount"]]
"""
The discount that was applied to get this pretax credit amount.
"""
type: Literal["credit_balance_transaction", "discount"]
"""
Type of the pretax credit amount referenced.
"""

class ShippingCost(StripeObject):
class Tax(StripeObject):
amount: int
Expand Down Expand Up @@ -711,6 +734,7 @@ class VoidCreditNoteParams(RequestOptions):
"""
The link to download the PDF of the credit note.
"""
pretax_credit_amounts: Optional[List[PretaxCreditAmount]]
reason: Optional[
Literal[
"duplicate", "fraudulent", "order_change", "product_unsatisfactory"
Expand Down Expand Up @@ -1122,6 +1146,7 @@ async def list_lines_async(

_inner_class_types = {
"discount_amounts": DiscountAmount,
"pretax_credit_amounts": PretaxCreditAmount,
"shipping_cost": ShippingCost,
"tax_amounts": TaxAmount,
}
25 changes: 25 additions & 0 deletions stripe/_credit_note_line_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
if TYPE_CHECKING:
from stripe._discount import Discount
from stripe._tax_rate import TaxRate
from stripe.billing._credit_balance_transaction import (
CreditBalanceTransaction,
)


class CreditNoteLineItem(StripeObject):
Expand All @@ -29,6 +32,26 @@ class DiscountAmount(StripeObject):
The discount that was applied to get this discount amount.
"""

class PretaxCreditAmount(StripeObject):
amount: int
"""
The amount, in cents (or local equivalent), of the pretax credit amount.
"""
credit_balance_transaction: Optional[
ExpandableField["CreditBalanceTransaction"]
]
"""
The credit balance transaction that was applied to get this pretax credit amount.
"""
discount: Optional[ExpandableField["Discount"]]
"""
The discount that was applied to get this pretax credit amount.
"""
type: Literal["credit_balance_transaction", "discount"]
"""
Type of the pretax credit amount referenced.
"""

class TaxAmount(StripeObject):
amount: int
"""
Expand Down Expand Up @@ -105,6 +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]]
quantity: Optional[int]
"""
The number of units of product being credited.
Expand Down Expand Up @@ -135,5 +159,6 @@ class TaxAmount(StripeObject):
"""
_inner_class_types = {
"discount_amounts": DiscountAmount,
"pretax_credit_amounts": PretaxCreditAmount,
"tax_amounts": TaxAmount,
}
5 changes: 2 additions & 3 deletions stripe/_customer.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,8 @@ class Customer(
UpdateableAPIResource["Customer"],
):
"""
This object represents a customer of your business. Use it to create recurring charges and track payments that belong to the same customer.
Related guide: [Save a card during payment](https://stripe.com/docs/payments/save-during-payment)
This object represents a customer of your business. Use it to [create recurring charges](https://stripe.com/docs/invoicing/customer), [save payment](https://stripe.com/docs/payments/save-during-payment) and contact information,
and track payments that belong to the same customer.
"""

OBJECT_NAME: ClassVar[Literal["customer"]] = "customer"
Expand Down
30 changes: 30 additions & 0 deletions stripe/_invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
from stripe._customer import Customer
from stripe._discount import Discount
from stripe._invoice_line_item import InvoiceLineItem
from stripe._margin import Margin
from stripe._payment_intent import PaymentIntent
from stripe._payment_method import PaymentMethod
from stripe._quote import Quote
Expand All @@ -49,6 +50,9 @@
from stripe._subscription import Subscription
from stripe._tax_id import TaxId
from stripe._tax_rate import TaxRate
from stripe.billing._credit_balance_transaction import (
CreditBalanceTransaction,
)
from stripe.test_helpers._test_clock import TestClock


Expand Down Expand Up @@ -965,6 +969,30 @@ class TotalDiscountAmount(StripeObject):
The discount that was applied to get this discount amount.
"""

class TotalPretaxCreditAmount(StripeObject):
amount: int
"""
The amount, in cents (or local equivalent), of the pretax credit amount.
"""
credit_balance_transaction: Optional[
ExpandableField["CreditBalanceTransaction"]
]
"""
The credit balance transaction that was applied to get this pretax credit amount.
"""
discount: Optional[ExpandableField["Discount"]]
"""
The discount that was applied to get this pretax credit amount.
"""
margin: Optional[ExpandableField["Margin"]]
"""
The margin that was applied to get this pretax credit amount.
"""
type: Literal["credit_balance_transaction", "discount"]
"""
Type of the pretax credit amount referenced.
"""

class TotalTaxAmount(StripeObject):
amount: int
"""
Expand Down Expand Up @@ -6445,6 +6473,7 @@ class VoidInvoiceParams(RequestOptions):
"""
The integer amount in cents (or local equivalent) representing the total amount of the invoice including all discounts but excluding all tax.
"""
total_pretax_credit_amounts: Optional[List[TotalPretaxCreditAmount]]
total_tax_amounts: List[TotalTaxAmount]
"""
The aggregate amounts calculated per tax rate for all line items.
Expand Down Expand Up @@ -7811,6 +7840,7 @@ async def list_lines_async(
"subscription_details": SubscriptionDetails,
"threshold_reason": ThresholdReason,
"total_discount_amounts": TotalDiscountAmount,
"total_pretax_credit_amounts": TotalPretaxCreditAmount,
"total_tax_amounts": TotalTaxAmount,
"transfer_data": TransferData,
}
30 changes: 30 additions & 0 deletions stripe/_invoice_line_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,15 @@
if TYPE_CHECKING:
from stripe._discount import Discount
from stripe._invoice_item import InvoiceItem
from stripe._margin import Margin
from stripe._plan import Plan
from stripe._price import Price
from stripe._subscription import Subscription
from stripe._subscription_item import SubscriptionItem
from stripe._tax_rate import TaxRate
from stripe.billing._credit_balance_transaction import (
CreditBalanceTransaction,
)


class InvoiceLineItem(UpdateableAPIResource["InvoiceLineItem"]):
Expand Down Expand Up @@ -53,6 +57,30 @@ class Period(StripeObject):
The start of the period. This value is inclusive.
"""

class PretaxCreditAmount(StripeObject):
amount: int
"""
The amount, in cents (or local equivalent), of the pretax credit amount.
"""
credit_balance_transaction: Optional[
ExpandableField["CreditBalanceTransaction"]
]
"""
The credit balance transaction that was applied to get this pretax credit amount.
"""
discount: Optional[ExpandableField["Discount"]]
"""
The discount that was applied to get this pretax credit amount.
"""
margin: Optional[ExpandableField["Margin"]]
"""
The margin that was applied to get this pretax credit amount.
"""
type: Literal["credit_balance_transaction", "discount"]
"""
Type of the pretax credit amount referenced.
"""

class ProrationDetails(StripeObject):
class CreditedItems(StripeObject):
invoice: str
Expand Down Expand Up @@ -362,6 +390,7 @@ class ModifyParamsTaxAmountTaxRateData(TypedDict):
"""
The plan of the subscription, if the line item is a subscription or a proration.
"""
pretax_credit_amounts: Optional[List[PretaxCreditAmount]]
price: Optional["Price"]
"""
The price of the line item.
Expand Down Expand Up @@ -446,6 +475,7 @@ async def modify_async(
_inner_class_types = {
"discount_amounts": DiscountAmount,
"period": Period,
"pretax_credit_amounts": PretaxCreditAmount,
"proration_details": ProrationDetails,
"tax_amounts": TaxAmount,
}
50 changes: 50 additions & 0 deletions stripe/_margin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# -*- coding: utf-8 -*-
# File generated from our OpenAPI spec
from stripe._stripe_object import StripeObject
from typing import ClassVar, Dict, Optional
from typing_extensions import Literal


class Margin(StripeObject):
"""
A (partner) margin represents a specific discount distributed in partner reseller programs to business partners who
resell products and services and earn a discount (margin) for doing so.
"""

OBJECT_NAME: ClassVar[Literal["margin"]] = "margin"
active: bool
"""
Whether the margin can be applied to invoices, invoice items, or invoice line items. Defaults to `true`.
"""
created: int
"""
Time at which the object was created. Measured in seconds since the Unix epoch.
"""
id: str
"""
Unique identifier for the object.
"""
livemode: bool
"""
Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
"""
metadata: Optional[Dict[str, str]]
"""
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.
"""
name: Optional[str]
"""
Name of the margin that's displayed on, for example, invoices.
"""
object: Literal["margin"]
"""
String representing the object's type. Objects of the same type share the same value.
"""
percent_off: float
"""
Percent that will be taken off the subtotal before tax (after all other discounts and promotions) of any invoice to which the margin is applied.
"""
updated: int
"""
Time at which the object was last updated. Measured in seconds since the Unix epoch.
"""
4 changes: 4 additions & 0 deletions stripe/_object_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
stripe.billing_portal.Session.OBJECT_NAME: stripe.billing_portal.Session,
stripe.billing.Alert.OBJECT_NAME: stripe.billing.Alert,
stripe.billing.AlertTriggered.OBJECT_NAME: stripe.billing.AlertTriggered,
stripe.billing.CreditBalanceSummary.OBJECT_NAME: stripe.billing.CreditBalanceSummary,
stripe.billing.CreditBalanceTransaction.OBJECT_NAME: stripe.billing.CreditBalanceTransaction,
stripe.billing.CreditGrant.OBJECT_NAME: stripe.billing.CreditGrant,
stripe.billing.Meter.OBJECT_NAME: stripe.billing.Meter,
stripe.billing.MeterEvent.OBJECT_NAME: stripe.billing.MeterEvent,
stripe.billing.MeterEventAdjustment.OBJECT_NAME: stripe.billing.MeterEventAdjustment,
Expand Down Expand Up @@ -78,6 +81,7 @@
stripe.LineItem.OBJECT_NAME: stripe.LineItem,
stripe.LoginLink.OBJECT_NAME: stripe.LoginLink,
stripe.Mandate.OBJECT_NAME: stripe.Mandate,
stripe.Margin.OBJECT_NAME: stripe.Margin,
stripe.PaymentIntent.OBJECT_NAME: stripe.PaymentIntent,
stripe.PaymentLink.OBJECT_NAME: stripe.PaymentLink,
stripe.PaymentMethod.OBJECT_NAME: stripe.PaymentMethod,
Expand Down
Loading

0 comments on commit 791fc11

Please sign in to comment.