Debian Codegraph @

stripe/billing/_credit_balance_summary.py

raw
1 # -*- coding: utf-8 -*-
2 # File generated from our OpenAPI spec
3 from stripe._expandable_field import ExpandableField
4 from stripe._singleton_api_resource import SingletonAPIResource
5 from stripe._stripe_object import StripeObject
6 from typing import ClassVar, List, Optional
7 from typing_extensions import Literal, Unpack, TYPE_CHECKING
8
9 if TYPE_CHECKING:
10 from stripe._customer import Customer
11 from stripe.params.billing._credit_balance_summary_retrieve_params import (
12 CreditBalanceSummaryRetrieveParams,
13 )
14
15
16 class CreditBalanceSummary(SingletonAPIResource["CreditBalanceSummary"]):
17 """
18 Indicates the billing credit balance for billing credits granted to a customer.
19 """
20
21 OBJECT_NAME: ClassVar[Literal["billing.credit_balance_summary"]] = (
22 "billing.credit_balance_summary"
23 )
24
25 class Balance(StripeObject):
26 class AvailableBalance(StripeObject):
27 class Monetary(StripeObject):
28 currency: str
29 """
30 Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
31 """
32 value: int
33 """
34 A positive integer representing the amount.
35 """
36
37 monetary: Optional[Monetary]
38 """
39 The monetary amount.
40 """
41 type: Literal["monetary"]
42 """
43 The type of this amount. We currently only support `monetary` billing credits.
44 """
45 _inner_class_types = {"monetary": Monetary}
46
47 class LedgerBalance(StripeObject):
48 class Monetary(StripeObject):
49 currency: str
50 """
51 Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
52 """
53 value: int
54 """
55 A positive integer representing the amount.
56 """
57
58 monetary: Optional[Monetary]
59 """
60 The monetary amount.
61 """
62 type: Literal["monetary"]
63 """
64 The type of this amount. We currently only support `monetary` billing credits.
65 """
66 _inner_class_types = {"monetary": Monetary}
67
68 available_balance: AvailableBalance
69 ledger_balance: LedgerBalance
70 _inner_class_types = {
71 "available_balance": AvailableBalance,
72 "ledger_balance": LedgerBalance,
73 }
74
75 balances: List[Balance]
76 """
77 The billing credit balances. One entry per credit grant currency. If a customer only has credit grants in a single currency, then this will have a single balance entry.
78 """
79 customer: ExpandableField["Customer"]
80 """
81 The customer the balance is for.
82 """
83 customer_account: Optional[str]
84 """
85 The account the balance is for.
86 """
87 livemode: bool
88 """
89 Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
90 """
91 object: Literal["billing.credit_balance_summary"]
92 """
93 String representing the object's type. Objects of the same type share the same value.
94 """
95
96 @classmethod
97 def retrieve(
98 cls, **params: Unpack["CreditBalanceSummaryRetrieveParams"]
99 ) -> "CreditBalanceSummary":
100 """
101 Retrieves the credit balance summary for a customer.
102 """
103 instance = cls(None, **params)
104 instance.refresh()
105 return instance
106
107 @classmethod
108 async def retrieve_async(
109 cls, **params: Unpack["CreditBalanceSummaryRetrieveParams"]
110 ) -> "CreditBalanceSummary":
111 """
112 Retrieves the credit balance summary for a customer.
113 """
114 instance = cls(None, **params)
115 await instance.refresh_async()
116 return instance
117
118 @classmethod
119 def class_url(cls):
120 return "/v1/billing/credit_balance_summary"
121
122 _inner_class_types = {"balances": Balance}