robosystems-client 0.2.10__py3-none-any.whl → 0.2.11__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- robosystems_client/api/billing/__init__.py +1 -0
- robosystems_client/api/billing/cancel_subscription.py +173 -0
- robosystems_client/api/billing/create_checkout_session.py +230 -0
- robosystems_client/api/billing/get_billing_customer.py +143 -0
- robosystems_client/api/billing/get_checkout_status.py +221 -0
- robosystems_client/api/billing/get_subscription.py +165 -0
- robosystems_client/api/billing/get_upcoming_invoice.py +157 -0
- robosystems_client/api/billing/list_invoices.py +181 -0
- robosystems_client/api/billing/list_subscriptions.py +152 -0
- robosystems_client/api/billing/update_payment_method.py +182 -0
- robosystems_client/models/__init__.py +24 -0
- robosystems_client/models/billing_customer.py +128 -0
- robosystems_client/models/checkout_response.py +87 -0
- robosystems_client/models/checkout_status_response.py +130 -0
- robosystems_client/models/create_checkout_request.py +88 -0
- robosystems_client/models/create_checkout_request_resource_config.py +44 -0
- robosystems_client/models/invoice.py +244 -0
- robosystems_client/models/invoice_line_item.py +118 -0
- robosystems_client/models/invoices_response.py +90 -0
- robosystems_client/models/payment_method.py +158 -0
- robosystems_client/models/upcoming_invoice.py +128 -0
- robosystems_client/models/update_payment_method_request.py +60 -0
- robosystems_client/models/update_payment_method_response.py +74 -0
- {robosystems_client-0.2.10.dist-info → robosystems_client-0.2.11.dist-info}/METADATA +1 -1
- {robosystems_client-0.2.10.dist-info → robosystems_client-0.2.11.dist-info}/RECORD +27 -5
- {robosystems_client-0.2.10.dist-info → robosystems_client-0.2.11.dist-info}/WHEEL +0 -0
- {robosystems_client-0.2.10.dist-info → robosystems_client-0.2.11.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
from collections.abc import Mapping
|
|
2
|
+
from typing import TYPE_CHECKING, Any, TypeVar, Union, cast
|
|
3
|
+
|
|
4
|
+
from attrs import define as _attrs_define
|
|
5
|
+
from attrs import field as _attrs_field
|
|
6
|
+
|
|
7
|
+
from ..types import UNSET, Unset
|
|
8
|
+
|
|
9
|
+
if TYPE_CHECKING:
|
|
10
|
+
from ..models.invoice_line_item import InvoiceLineItem
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
T = TypeVar("T", bound="Invoice")
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@_attrs_define
|
|
17
|
+
class Invoice:
|
|
18
|
+
"""Invoice information.
|
|
19
|
+
|
|
20
|
+
Attributes:
|
|
21
|
+
id (str): Invoice ID
|
|
22
|
+
status (str): Invoice status (paid, open, void, uncollectible)
|
|
23
|
+
amount_due (int): Amount due in cents
|
|
24
|
+
amount_paid (int): Amount paid in cents
|
|
25
|
+
currency (str): Currency code (usd)
|
|
26
|
+
created (str): Invoice creation date (ISO format)
|
|
27
|
+
line_items (list['InvoiceLineItem']): Invoice line items
|
|
28
|
+
number (Union[None, Unset, str]): Invoice number
|
|
29
|
+
due_date (Union[None, Unset, str]): Invoice due date (ISO format)
|
|
30
|
+
paid_at (Union[None, Unset, str]): Payment date (ISO format)
|
|
31
|
+
invoice_pdf (Union[None, Unset, str]): PDF download URL
|
|
32
|
+
hosted_invoice_url (Union[None, Unset, str]): Hosted invoice URL
|
|
33
|
+
subscription_id (Union[None, Unset, str]): Associated subscription ID
|
|
34
|
+
"""
|
|
35
|
+
|
|
36
|
+
id: str
|
|
37
|
+
status: str
|
|
38
|
+
amount_due: int
|
|
39
|
+
amount_paid: int
|
|
40
|
+
currency: str
|
|
41
|
+
created: str
|
|
42
|
+
line_items: list["InvoiceLineItem"]
|
|
43
|
+
number: Union[None, Unset, str] = UNSET
|
|
44
|
+
due_date: Union[None, Unset, str] = UNSET
|
|
45
|
+
paid_at: Union[None, Unset, str] = UNSET
|
|
46
|
+
invoice_pdf: Union[None, Unset, str] = UNSET
|
|
47
|
+
hosted_invoice_url: Union[None, Unset, str] = UNSET
|
|
48
|
+
subscription_id: Union[None, Unset, str] = UNSET
|
|
49
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
50
|
+
|
|
51
|
+
def to_dict(self) -> dict[str, Any]:
|
|
52
|
+
id = self.id
|
|
53
|
+
|
|
54
|
+
status = self.status
|
|
55
|
+
|
|
56
|
+
amount_due = self.amount_due
|
|
57
|
+
|
|
58
|
+
amount_paid = self.amount_paid
|
|
59
|
+
|
|
60
|
+
currency = self.currency
|
|
61
|
+
|
|
62
|
+
created = self.created
|
|
63
|
+
|
|
64
|
+
line_items = []
|
|
65
|
+
for line_items_item_data in self.line_items:
|
|
66
|
+
line_items_item = line_items_item_data.to_dict()
|
|
67
|
+
line_items.append(line_items_item)
|
|
68
|
+
|
|
69
|
+
number: Union[None, Unset, str]
|
|
70
|
+
if isinstance(self.number, Unset):
|
|
71
|
+
number = UNSET
|
|
72
|
+
else:
|
|
73
|
+
number = self.number
|
|
74
|
+
|
|
75
|
+
due_date: Union[None, Unset, str]
|
|
76
|
+
if isinstance(self.due_date, Unset):
|
|
77
|
+
due_date = UNSET
|
|
78
|
+
else:
|
|
79
|
+
due_date = self.due_date
|
|
80
|
+
|
|
81
|
+
paid_at: Union[None, Unset, str]
|
|
82
|
+
if isinstance(self.paid_at, Unset):
|
|
83
|
+
paid_at = UNSET
|
|
84
|
+
else:
|
|
85
|
+
paid_at = self.paid_at
|
|
86
|
+
|
|
87
|
+
invoice_pdf: Union[None, Unset, str]
|
|
88
|
+
if isinstance(self.invoice_pdf, Unset):
|
|
89
|
+
invoice_pdf = UNSET
|
|
90
|
+
else:
|
|
91
|
+
invoice_pdf = self.invoice_pdf
|
|
92
|
+
|
|
93
|
+
hosted_invoice_url: Union[None, Unset, str]
|
|
94
|
+
if isinstance(self.hosted_invoice_url, Unset):
|
|
95
|
+
hosted_invoice_url = UNSET
|
|
96
|
+
else:
|
|
97
|
+
hosted_invoice_url = self.hosted_invoice_url
|
|
98
|
+
|
|
99
|
+
subscription_id: Union[None, Unset, str]
|
|
100
|
+
if isinstance(self.subscription_id, Unset):
|
|
101
|
+
subscription_id = UNSET
|
|
102
|
+
else:
|
|
103
|
+
subscription_id = self.subscription_id
|
|
104
|
+
|
|
105
|
+
field_dict: dict[str, Any] = {}
|
|
106
|
+
field_dict.update(self.additional_properties)
|
|
107
|
+
field_dict.update(
|
|
108
|
+
{
|
|
109
|
+
"id": id,
|
|
110
|
+
"status": status,
|
|
111
|
+
"amount_due": amount_due,
|
|
112
|
+
"amount_paid": amount_paid,
|
|
113
|
+
"currency": currency,
|
|
114
|
+
"created": created,
|
|
115
|
+
"line_items": line_items,
|
|
116
|
+
}
|
|
117
|
+
)
|
|
118
|
+
if number is not UNSET:
|
|
119
|
+
field_dict["number"] = number
|
|
120
|
+
if due_date is not UNSET:
|
|
121
|
+
field_dict["due_date"] = due_date
|
|
122
|
+
if paid_at is not UNSET:
|
|
123
|
+
field_dict["paid_at"] = paid_at
|
|
124
|
+
if invoice_pdf is not UNSET:
|
|
125
|
+
field_dict["invoice_pdf"] = invoice_pdf
|
|
126
|
+
if hosted_invoice_url is not UNSET:
|
|
127
|
+
field_dict["hosted_invoice_url"] = hosted_invoice_url
|
|
128
|
+
if subscription_id is not UNSET:
|
|
129
|
+
field_dict["subscription_id"] = subscription_id
|
|
130
|
+
|
|
131
|
+
return field_dict
|
|
132
|
+
|
|
133
|
+
@classmethod
|
|
134
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
135
|
+
from ..models.invoice_line_item import InvoiceLineItem
|
|
136
|
+
|
|
137
|
+
d = dict(src_dict)
|
|
138
|
+
id = d.pop("id")
|
|
139
|
+
|
|
140
|
+
status = d.pop("status")
|
|
141
|
+
|
|
142
|
+
amount_due = d.pop("amount_due")
|
|
143
|
+
|
|
144
|
+
amount_paid = d.pop("amount_paid")
|
|
145
|
+
|
|
146
|
+
currency = d.pop("currency")
|
|
147
|
+
|
|
148
|
+
created = d.pop("created")
|
|
149
|
+
|
|
150
|
+
line_items = []
|
|
151
|
+
_line_items = d.pop("line_items")
|
|
152
|
+
for line_items_item_data in _line_items:
|
|
153
|
+
line_items_item = InvoiceLineItem.from_dict(line_items_item_data)
|
|
154
|
+
|
|
155
|
+
line_items.append(line_items_item)
|
|
156
|
+
|
|
157
|
+
def _parse_number(data: object) -> Union[None, Unset, str]:
|
|
158
|
+
if data is None:
|
|
159
|
+
return data
|
|
160
|
+
if isinstance(data, Unset):
|
|
161
|
+
return data
|
|
162
|
+
return cast(Union[None, Unset, str], data)
|
|
163
|
+
|
|
164
|
+
number = _parse_number(d.pop("number", UNSET))
|
|
165
|
+
|
|
166
|
+
def _parse_due_date(data: object) -> Union[None, Unset, str]:
|
|
167
|
+
if data is None:
|
|
168
|
+
return data
|
|
169
|
+
if isinstance(data, Unset):
|
|
170
|
+
return data
|
|
171
|
+
return cast(Union[None, Unset, str], data)
|
|
172
|
+
|
|
173
|
+
due_date = _parse_due_date(d.pop("due_date", UNSET))
|
|
174
|
+
|
|
175
|
+
def _parse_paid_at(data: object) -> Union[None, Unset, str]:
|
|
176
|
+
if data is None:
|
|
177
|
+
return data
|
|
178
|
+
if isinstance(data, Unset):
|
|
179
|
+
return data
|
|
180
|
+
return cast(Union[None, Unset, str], data)
|
|
181
|
+
|
|
182
|
+
paid_at = _parse_paid_at(d.pop("paid_at", UNSET))
|
|
183
|
+
|
|
184
|
+
def _parse_invoice_pdf(data: object) -> Union[None, Unset, str]:
|
|
185
|
+
if data is None:
|
|
186
|
+
return data
|
|
187
|
+
if isinstance(data, Unset):
|
|
188
|
+
return data
|
|
189
|
+
return cast(Union[None, Unset, str], data)
|
|
190
|
+
|
|
191
|
+
invoice_pdf = _parse_invoice_pdf(d.pop("invoice_pdf", UNSET))
|
|
192
|
+
|
|
193
|
+
def _parse_hosted_invoice_url(data: object) -> Union[None, Unset, str]:
|
|
194
|
+
if data is None:
|
|
195
|
+
return data
|
|
196
|
+
if isinstance(data, Unset):
|
|
197
|
+
return data
|
|
198
|
+
return cast(Union[None, Unset, str], data)
|
|
199
|
+
|
|
200
|
+
hosted_invoice_url = _parse_hosted_invoice_url(d.pop("hosted_invoice_url", UNSET))
|
|
201
|
+
|
|
202
|
+
def _parse_subscription_id(data: object) -> Union[None, Unset, str]:
|
|
203
|
+
if data is None:
|
|
204
|
+
return data
|
|
205
|
+
if isinstance(data, Unset):
|
|
206
|
+
return data
|
|
207
|
+
return cast(Union[None, Unset, str], data)
|
|
208
|
+
|
|
209
|
+
subscription_id = _parse_subscription_id(d.pop("subscription_id", UNSET))
|
|
210
|
+
|
|
211
|
+
invoice = cls(
|
|
212
|
+
id=id,
|
|
213
|
+
status=status,
|
|
214
|
+
amount_due=amount_due,
|
|
215
|
+
amount_paid=amount_paid,
|
|
216
|
+
currency=currency,
|
|
217
|
+
created=created,
|
|
218
|
+
line_items=line_items,
|
|
219
|
+
number=number,
|
|
220
|
+
due_date=due_date,
|
|
221
|
+
paid_at=paid_at,
|
|
222
|
+
invoice_pdf=invoice_pdf,
|
|
223
|
+
hosted_invoice_url=hosted_invoice_url,
|
|
224
|
+
subscription_id=subscription_id,
|
|
225
|
+
)
|
|
226
|
+
|
|
227
|
+
invoice.additional_properties = d
|
|
228
|
+
return invoice
|
|
229
|
+
|
|
230
|
+
@property
|
|
231
|
+
def additional_keys(self) -> list[str]:
|
|
232
|
+
return list(self.additional_properties.keys())
|
|
233
|
+
|
|
234
|
+
def __getitem__(self, key: str) -> Any:
|
|
235
|
+
return self.additional_properties[key]
|
|
236
|
+
|
|
237
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
238
|
+
self.additional_properties[key] = value
|
|
239
|
+
|
|
240
|
+
def __delitem__(self, key: str) -> None:
|
|
241
|
+
del self.additional_properties[key]
|
|
242
|
+
|
|
243
|
+
def __contains__(self, key: str) -> bool:
|
|
244
|
+
return key in self.additional_properties
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
from collections.abc import Mapping
|
|
2
|
+
from typing import Any, TypeVar, Union, cast
|
|
3
|
+
|
|
4
|
+
from attrs import define as _attrs_define
|
|
5
|
+
from attrs import field as _attrs_field
|
|
6
|
+
|
|
7
|
+
from ..types import UNSET, Unset
|
|
8
|
+
|
|
9
|
+
T = TypeVar("T", bound="InvoiceLineItem")
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
@_attrs_define
|
|
13
|
+
class InvoiceLineItem:
|
|
14
|
+
"""Invoice line item.
|
|
15
|
+
|
|
16
|
+
Attributes:
|
|
17
|
+
description (str): Line item description
|
|
18
|
+
amount (int): Amount in cents
|
|
19
|
+
quantity (int): Quantity
|
|
20
|
+
period_start (Union[None, Unset, str]): Billing period start
|
|
21
|
+
period_end (Union[None, Unset, str]): Billing period end
|
|
22
|
+
"""
|
|
23
|
+
|
|
24
|
+
description: str
|
|
25
|
+
amount: int
|
|
26
|
+
quantity: int
|
|
27
|
+
period_start: Union[None, Unset, str] = UNSET
|
|
28
|
+
period_end: Union[None, Unset, str] = UNSET
|
|
29
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
30
|
+
|
|
31
|
+
def to_dict(self) -> dict[str, Any]:
|
|
32
|
+
description = self.description
|
|
33
|
+
|
|
34
|
+
amount = self.amount
|
|
35
|
+
|
|
36
|
+
quantity = self.quantity
|
|
37
|
+
|
|
38
|
+
period_start: Union[None, Unset, str]
|
|
39
|
+
if isinstance(self.period_start, Unset):
|
|
40
|
+
period_start = UNSET
|
|
41
|
+
else:
|
|
42
|
+
period_start = self.period_start
|
|
43
|
+
|
|
44
|
+
period_end: Union[None, Unset, str]
|
|
45
|
+
if isinstance(self.period_end, Unset):
|
|
46
|
+
period_end = UNSET
|
|
47
|
+
else:
|
|
48
|
+
period_end = self.period_end
|
|
49
|
+
|
|
50
|
+
field_dict: dict[str, Any] = {}
|
|
51
|
+
field_dict.update(self.additional_properties)
|
|
52
|
+
field_dict.update(
|
|
53
|
+
{
|
|
54
|
+
"description": description,
|
|
55
|
+
"amount": amount,
|
|
56
|
+
"quantity": quantity,
|
|
57
|
+
}
|
|
58
|
+
)
|
|
59
|
+
if period_start is not UNSET:
|
|
60
|
+
field_dict["period_start"] = period_start
|
|
61
|
+
if period_end is not UNSET:
|
|
62
|
+
field_dict["period_end"] = period_end
|
|
63
|
+
|
|
64
|
+
return field_dict
|
|
65
|
+
|
|
66
|
+
@classmethod
|
|
67
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
68
|
+
d = dict(src_dict)
|
|
69
|
+
description = d.pop("description")
|
|
70
|
+
|
|
71
|
+
amount = d.pop("amount")
|
|
72
|
+
|
|
73
|
+
quantity = d.pop("quantity")
|
|
74
|
+
|
|
75
|
+
def _parse_period_start(data: object) -> Union[None, Unset, str]:
|
|
76
|
+
if data is None:
|
|
77
|
+
return data
|
|
78
|
+
if isinstance(data, Unset):
|
|
79
|
+
return data
|
|
80
|
+
return cast(Union[None, Unset, str], data)
|
|
81
|
+
|
|
82
|
+
period_start = _parse_period_start(d.pop("period_start", UNSET))
|
|
83
|
+
|
|
84
|
+
def _parse_period_end(data: object) -> Union[None, Unset, str]:
|
|
85
|
+
if data is None:
|
|
86
|
+
return data
|
|
87
|
+
if isinstance(data, Unset):
|
|
88
|
+
return data
|
|
89
|
+
return cast(Union[None, Unset, str], data)
|
|
90
|
+
|
|
91
|
+
period_end = _parse_period_end(d.pop("period_end", UNSET))
|
|
92
|
+
|
|
93
|
+
invoice_line_item = cls(
|
|
94
|
+
description=description,
|
|
95
|
+
amount=amount,
|
|
96
|
+
quantity=quantity,
|
|
97
|
+
period_start=period_start,
|
|
98
|
+
period_end=period_end,
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
invoice_line_item.additional_properties = d
|
|
102
|
+
return invoice_line_item
|
|
103
|
+
|
|
104
|
+
@property
|
|
105
|
+
def additional_keys(self) -> list[str]:
|
|
106
|
+
return list(self.additional_properties.keys())
|
|
107
|
+
|
|
108
|
+
def __getitem__(self, key: str) -> Any:
|
|
109
|
+
return self.additional_properties[key]
|
|
110
|
+
|
|
111
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
112
|
+
self.additional_properties[key] = value
|
|
113
|
+
|
|
114
|
+
def __delitem__(self, key: str) -> None:
|
|
115
|
+
del self.additional_properties[key]
|
|
116
|
+
|
|
117
|
+
def __contains__(self, key: str) -> bool:
|
|
118
|
+
return key in self.additional_properties
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
from collections.abc import Mapping
|
|
2
|
+
from typing import TYPE_CHECKING, Any, TypeVar
|
|
3
|
+
|
|
4
|
+
from attrs import define as _attrs_define
|
|
5
|
+
from attrs import field as _attrs_field
|
|
6
|
+
|
|
7
|
+
if TYPE_CHECKING:
|
|
8
|
+
from ..models.invoice import Invoice
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
T = TypeVar("T", bound="InvoicesResponse")
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@_attrs_define
|
|
15
|
+
class InvoicesResponse:
|
|
16
|
+
"""Response for invoice list.
|
|
17
|
+
|
|
18
|
+
Attributes:
|
|
19
|
+
invoices (list['Invoice']): List of invoices
|
|
20
|
+
total_count (int): Total number of invoices
|
|
21
|
+
has_more (bool): Whether more invoices are available
|
|
22
|
+
"""
|
|
23
|
+
|
|
24
|
+
invoices: list["Invoice"]
|
|
25
|
+
total_count: int
|
|
26
|
+
has_more: bool
|
|
27
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
28
|
+
|
|
29
|
+
def to_dict(self) -> dict[str, Any]:
|
|
30
|
+
invoices = []
|
|
31
|
+
for invoices_item_data in self.invoices:
|
|
32
|
+
invoices_item = invoices_item_data.to_dict()
|
|
33
|
+
invoices.append(invoices_item)
|
|
34
|
+
|
|
35
|
+
total_count = self.total_count
|
|
36
|
+
|
|
37
|
+
has_more = self.has_more
|
|
38
|
+
|
|
39
|
+
field_dict: dict[str, Any] = {}
|
|
40
|
+
field_dict.update(self.additional_properties)
|
|
41
|
+
field_dict.update(
|
|
42
|
+
{
|
|
43
|
+
"invoices": invoices,
|
|
44
|
+
"total_count": total_count,
|
|
45
|
+
"has_more": has_more,
|
|
46
|
+
}
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
return field_dict
|
|
50
|
+
|
|
51
|
+
@classmethod
|
|
52
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
53
|
+
from ..models.invoice import Invoice
|
|
54
|
+
|
|
55
|
+
d = dict(src_dict)
|
|
56
|
+
invoices = []
|
|
57
|
+
_invoices = d.pop("invoices")
|
|
58
|
+
for invoices_item_data in _invoices:
|
|
59
|
+
invoices_item = Invoice.from_dict(invoices_item_data)
|
|
60
|
+
|
|
61
|
+
invoices.append(invoices_item)
|
|
62
|
+
|
|
63
|
+
total_count = d.pop("total_count")
|
|
64
|
+
|
|
65
|
+
has_more = d.pop("has_more")
|
|
66
|
+
|
|
67
|
+
invoices_response = cls(
|
|
68
|
+
invoices=invoices,
|
|
69
|
+
total_count=total_count,
|
|
70
|
+
has_more=has_more,
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
invoices_response.additional_properties = d
|
|
74
|
+
return invoices_response
|
|
75
|
+
|
|
76
|
+
@property
|
|
77
|
+
def additional_keys(self) -> list[str]:
|
|
78
|
+
return list(self.additional_properties.keys())
|
|
79
|
+
|
|
80
|
+
def __getitem__(self, key: str) -> Any:
|
|
81
|
+
return self.additional_properties[key]
|
|
82
|
+
|
|
83
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
84
|
+
self.additional_properties[key] = value
|
|
85
|
+
|
|
86
|
+
def __delitem__(self, key: str) -> None:
|
|
87
|
+
del self.additional_properties[key]
|
|
88
|
+
|
|
89
|
+
def __contains__(self, key: str) -> bool:
|
|
90
|
+
return key in self.additional_properties
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
from collections.abc import Mapping
|
|
2
|
+
from typing import Any, TypeVar, Union, cast
|
|
3
|
+
|
|
4
|
+
from attrs import define as _attrs_define
|
|
5
|
+
from attrs import field as _attrs_field
|
|
6
|
+
|
|
7
|
+
from ..types import UNSET, Unset
|
|
8
|
+
|
|
9
|
+
T = TypeVar("T", bound="PaymentMethod")
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
@_attrs_define
|
|
13
|
+
class PaymentMethod:
|
|
14
|
+
"""Payment method information.
|
|
15
|
+
|
|
16
|
+
Attributes:
|
|
17
|
+
id (str): Payment method ID
|
|
18
|
+
type_ (str): Payment method type (card, bank_account, etc.)
|
|
19
|
+
is_default (bool): Whether this is the default payment method
|
|
20
|
+
brand (Union[None, Unset, str]): Card brand (visa, mastercard, etc.)
|
|
21
|
+
last4 (Union[None, Unset, str]): Last 4 digits
|
|
22
|
+
exp_month (Union[None, Unset, int]): Expiration month
|
|
23
|
+
exp_year (Union[None, Unset, int]): Expiration year
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
id: str
|
|
27
|
+
type_: str
|
|
28
|
+
is_default: bool
|
|
29
|
+
brand: Union[None, Unset, str] = UNSET
|
|
30
|
+
last4: Union[None, Unset, str] = UNSET
|
|
31
|
+
exp_month: Union[None, Unset, int] = UNSET
|
|
32
|
+
exp_year: Union[None, Unset, int] = UNSET
|
|
33
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
34
|
+
|
|
35
|
+
def to_dict(self) -> dict[str, Any]:
|
|
36
|
+
id = self.id
|
|
37
|
+
|
|
38
|
+
type_ = self.type_
|
|
39
|
+
|
|
40
|
+
is_default = self.is_default
|
|
41
|
+
|
|
42
|
+
brand: Union[None, Unset, str]
|
|
43
|
+
if isinstance(self.brand, Unset):
|
|
44
|
+
brand = UNSET
|
|
45
|
+
else:
|
|
46
|
+
brand = self.brand
|
|
47
|
+
|
|
48
|
+
last4: Union[None, Unset, str]
|
|
49
|
+
if isinstance(self.last4, Unset):
|
|
50
|
+
last4 = UNSET
|
|
51
|
+
else:
|
|
52
|
+
last4 = self.last4
|
|
53
|
+
|
|
54
|
+
exp_month: Union[None, Unset, int]
|
|
55
|
+
if isinstance(self.exp_month, Unset):
|
|
56
|
+
exp_month = UNSET
|
|
57
|
+
else:
|
|
58
|
+
exp_month = self.exp_month
|
|
59
|
+
|
|
60
|
+
exp_year: Union[None, Unset, int]
|
|
61
|
+
if isinstance(self.exp_year, Unset):
|
|
62
|
+
exp_year = UNSET
|
|
63
|
+
else:
|
|
64
|
+
exp_year = self.exp_year
|
|
65
|
+
|
|
66
|
+
field_dict: dict[str, Any] = {}
|
|
67
|
+
field_dict.update(self.additional_properties)
|
|
68
|
+
field_dict.update(
|
|
69
|
+
{
|
|
70
|
+
"id": id,
|
|
71
|
+
"type": type_,
|
|
72
|
+
"is_default": is_default,
|
|
73
|
+
}
|
|
74
|
+
)
|
|
75
|
+
if brand is not UNSET:
|
|
76
|
+
field_dict["brand"] = brand
|
|
77
|
+
if last4 is not UNSET:
|
|
78
|
+
field_dict["last4"] = last4
|
|
79
|
+
if exp_month is not UNSET:
|
|
80
|
+
field_dict["exp_month"] = exp_month
|
|
81
|
+
if exp_year is not UNSET:
|
|
82
|
+
field_dict["exp_year"] = exp_year
|
|
83
|
+
|
|
84
|
+
return field_dict
|
|
85
|
+
|
|
86
|
+
@classmethod
|
|
87
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
88
|
+
d = dict(src_dict)
|
|
89
|
+
id = d.pop("id")
|
|
90
|
+
|
|
91
|
+
type_ = d.pop("type")
|
|
92
|
+
|
|
93
|
+
is_default = d.pop("is_default")
|
|
94
|
+
|
|
95
|
+
def _parse_brand(data: object) -> Union[None, Unset, str]:
|
|
96
|
+
if data is None:
|
|
97
|
+
return data
|
|
98
|
+
if isinstance(data, Unset):
|
|
99
|
+
return data
|
|
100
|
+
return cast(Union[None, Unset, str], data)
|
|
101
|
+
|
|
102
|
+
brand = _parse_brand(d.pop("brand", UNSET))
|
|
103
|
+
|
|
104
|
+
def _parse_last4(data: object) -> Union[None, Unset, str]:
|
|
105
|
+
if data is None:
|
|
106
|
+
return data
|
|
107
|
+
if isinstance(data, Unset):
|
|
108
|
+
return data
|
|
109
|
+
return cast(Union[None, Unset, str], data)
|
|
110
|
+
|
|
111
|
+
last4 = _parse_last4(d.pop("last4", UNSET))
|
|
112
|
+
|
|
113
|
+
def _parse_exp_month(data: object) -> Union[None, Unset, int]:
|
|
114
|
+
if data is None:
|
|
115
|
+
return data
|
|
116
|
+
if isinstance(data, Unset):
|
|
117
|
+
return data
|
|
118
|
+
return cast(Union[None, Unset, int], data)
|
|
119
|
+
|
|
120
|
+
exp_month = _parse_exp_month(d.pop("exp_month", UNSET))
|
|
121
|
+
|
|
122
|
+
def _parse_exp_year(data: object) -> Union[None, Unset, int]:
|
|
123
|
+
if data is None:
|
|
124
|
+
return data
|
|
125
|
+
if isinstance(data, Unset):
|
|
126
|
+
return data
|
|
127
|
+
return cast(Union[None, Unset, int], data)
|
|
128
|
+
|
|
129
|
+
exp_year = _parse_exp_year(d.pop("exp_year", UNSET))
|
|
130
|
+
|
|
131
|
+
payment_method = cls(
|
|
132
|
+
id=id,
|
|
133
|
+
type_=type_,
|
|
134
|
+
is_default=is_default,
|
|
135
|
+
brand=brand,
|
|
136
|
+
last4=last4,
|
|
137
|
+
exp_month=exp_month,
|
|
138
|
+
exp_year=exp_year,
|
|
139
|
+
)
|
|
140
|
+
|
|
141
|
+
payment_method.additional_properties = d
|
|
142
|
+
return payment_method
|
|
143
|
+
|
|
144
|
+
@property
|
|
145
|
+
def additional_keys(self) -> list[str]:
|
|
146
|
+
return list(self.additional_properties.keys())
|
|
147
|
+
|
|
148
|
+
def __getitem__(self, key: str) -> Any:
|
|
149
|
+
return self.additional_properties[key]
|
|
150
|
+
|
|
151
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
152
|
+
self.additional_properties[key] = value
|
|
153
|
+
|
|
154
|
+
def __delitem__(self, key: str) -> None:
|
|
155
|
+
del self.additional_properties[key]
|
|
156
|
+
|
|
157
|
+
def __contains__(self, key: str) -> bool:
|
|
158
|
+
return key in self.additional_properties
|