dodopayments 1.51.1__py3-none-any.whl → 1.56.5__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.
- dodopayments/__init__.py +5 -1
- dodopayments/_base_client.py +12 -12
- dodopayments/_client.py +52 -14
- dodopayments/_compat.py +48 -48
- dodopayments/_exceptions.py +4 -0
- dodopayments/_models.py +50 -44
- dodopayments/_qs.py +7 -7
- dodopayments/_streaming.py +4 -6
- dodopayments/_types.py +18 -11
- dodopayments/_utils/__init__.py +8 -2
- dodopayments/_utils/_compat.py +45 -0
- dodopayments/_utils/_datetime_parse.py +136 -0
- dodopayments/_utils/_transform.py +13 -3
- dodopayments/_utils/_typing.py +1 -1
- dodopayments/_utils/_utils.py +5 -6
- dodopayments/_version.py +1 -1
- dodopayments/resources/__init__.py +28 -0
- dodopayments/resources/addons.py +29 -29
- dodopayments/resources/brands.py +29 -29
- dodopayments/resources/checkout_sessions.py +110 -27
- dodopayments/resources/customers/__init__.py +14 -0
- dodopayments/resources/customers/customer_portal.py +5 -5
- dodopayments/resources/customers/customers.py +53 -21
- dodopayments/resources/customers/wallets/__init__.py +33 -0
- dodopayments/resources/customers/wallets/ledger_entries.py +318 -0
- dodopayments/resources/customers/wallets/wallets.py +191 -0
- dodopayments/resources/discounts.py +44 -44
- dodopayments/resources/disputes.py +19 -19
- dodopayments/resources/invoices/payments.py +83 -3
- dodopayments/resources/license_key_instances.py +13 -13
- dodopayments/resources/license_keys.py +23 -23
- dodopayments/resources/licenses.py +14 -14
- dodopayments/resources/meters.py +554 -0
- dodopayments/resources/misc.py +3 -3
- dodopayments/resources/payments.py +49 -41
- dodopayments/resources/payouts.py +26 -7
- dodopayments/resources/products/images.py +5 -5
- dodopayments/resources/products/products.py +82 -82
- dodopayments/resources/refunds.py +39 -30
- dodopayments/resources/subscriptions.py +316 -73
- dodopayments/resources/usage_events.py +597 -0
- dodopayments/resources/webhooks/headers.py +5 -5
- dodopayments/resources/webhooks/webhooks.py +119 -44
- dodopayments/types/__init__.py +48 -0
- dodopayments/types/add_meter_to_price.py +29 -0
- dodopayments/types/add_meter_to_price_param.py +30 -0
- dodopayments/types/checkout_session_create_params.py +6 -0
- dodopayments/types/checkout_session_status.py +35 -0
- dodopayments/types/customer_limited_details.py +5 -0
- dodopayments/types/customers/__init__.py +2 -0
- dodopayments/types/customers/customer_wallet.py +20 -0
- dodopayments/types/customers/wallet_list_response.py +15 -0
- dodopayments/types/customers/wallets/__init__.py +7 -0
- dodopayments/types/customers/wallets/customer_wallet_transaction.py +38 -0
- dodopayments/types/customers/wallets/ledger_entry_create_params.py +25 -0
- dodopayments/types/customers/wallets/ledger_entry_list_params.py +18 -0
- dodopayments/types/discount_create_params.py +3 -2
- dodopayments/types/discount_update_params.py +3 -2
- dodopayments/types/dispute_accepted_webhook_event.py +29 -0
- dodopayments/types/dispute_accepted_webhook_event1.py +29 -0
- dodopayments/types/dispute_cancelled_webhook_event.py +29 -0
- dodopayments/types/dispute_cancelled_webhook_event1.py +29 -0
- dodopayments/types/dispute_challenged_webhook_event.py +29 -0
- dodopayments/types/dispute_challenged_webhook_event1.py +29 -0
- dodopayments/types/dispute_expired_webhook_event.py +29 -0
- dodopayments/types/dispute_expired_webhook_event1.py +29 -0
- dodopayments/types/dispute_lost_webhook_event.py +29 -0
- dodopayments/types/dispute_lost_webhook_event1.py +29 -0
- dodopayments/types/dispute_opened_webhook_event.py +29 -0
- dodopayments/types/dispute_opened_webhook_event1.py +29 -0
- dodopayments/types/dispute_won_webhook_event.py +29 -0
- dodopayments/types/dispute_won_webhook_event1.py +29 -0
- dodopayments/types/event.py +26 -0
- dodopayments/types/event_input_param.py +38 -0
- dodopayments/types/license_activate_response.py +40 -0
- dodopayments/types/license_key_created_webhook_event.py +29 -0
- dodopayments/types/license_key_created_webhook_event1.py +29 -0
- dodopayments/types/meter.py +40 -0
- dodopayments/types/meter_aggregation.py +16 -0
- dodopayments/types/meter_aggregation_param.py +16 -0
- dodopayments/types/meter_create_params.py +31 -0
- dodopayments/types/meter_filter.py +131 -0
- dodopayments/types/meter_filter_param.py +143 -0
- dodopayments/types/meter_list_params.py +18 -0
- dodopayments/types/new_customer_param.py +7 -1
- dodopayments/types/payment.py +37 -2
- dodopayments/types/payment_cancelled_webhook_event.py +29 -0
- dodopayments/types/payment_cancelled_webhook_event1.py +29 -0
- dodopayments/types/payment_create_params.py +3 -0
- dodopayments/types/payment_failed_webhook_event.py +29 -0
- dodopayments/types/payment_failed_webhook_event1.py +29 -0
- dodopayments/types/payment_method_types.py +1 -0
- dodopayments/types/payment_processing_webhook_event.py +29 -0
- dodopayments/types/payment_processing_webhook_event1.py +29 -0
- dodopayments/types/payment_succeeded_webhook_event.py +29 -0
- dodopayments/types/payment_succeeded_webhook_event1.py +29 -0
- dodopayments/types/payout_list_params.py +11 -1
- dodopayments/types/price.py +52 -5
- dodopayments/types/price_param.py +52 -5
- dodopayments/types/product_create_params.py +3 -2
- dodopayments/types/product_update_params.py +4 -3
- dodopayments/types/refund.py +8 -1
- dodopayments/types/refund_create_params.py +4 -1
- dodopayments/types/refund_failed_webhook_event.py +29 -0
- dodopayments/types/refund_failed_webhook_event1.py +29 -0
- dodopayments/types/refund_list_response.py +39 -0
- dodopayments/types/refund_succeeded_webhook_event.py +29 -0
- dodopayments/types/refund_succeeded_webhook_event1.py +29 -0
- dodopayments/types/subscription.py +23 -1
- dodopayments/types/subscription_active_webhook_event.py +29 -0
- dodopayments/types/subscription_active_webhook_event1.py +29 -0
- dodopayments/types/subscription_cancelled_webhook_event.py +29 -0
- dodopayments/types/subscription_cancelled_webhook_event1.py +29 -0
- dodopayments/types/subscription_charge_params.py +12 -1
- dodopayments/types/subscription_create_params.py +3 -0
- dodopayments/types/subscription_expired_webhook_event.py +29 -0
- dodopayments/types/subscription_expired_webhook_event1.py +29 -0
- dodopayments/types/subscription_failed_webhook_event.py +29 -0
- dodopayments/types/subscription_failed_webhook_event1.py +29 -0
- dodopayments/types/subscription_list_response.py +3 -0
- dodopayments/types/subscription_on_hold_webhook_event.py +29 -0
- dodopayments/types/subscription_on_hold_webhook_event1.py +29 -0
- dodopayments/types/subscription_plan_changed_webhook_event.py +29 -0
- dodopayments/types/subscription_plan_changed_webhook_event1.py +29 -0
- dodopayments/types/subscription_renewed_webhook_event.py +29 -0
- dodopayments/types/subscription_renewed_webhook_event1.py +29 -0
- dodopayments/types/subscription_retrieve_usage_history_params.py +28 -0
- dodopayments/types/subscription_retrieve_usage_history_response.py +46 -0
- dodopayments/types/subscription_update_params.py +2 -0
- dodopayments/types/unsafe_unwrap_webhook_event.py +52 -0
- dodopayments/types/unwrap_webhook_event.py +52 -0
- dodopayments/types/usage_event_ingest_params.py +15 -0
- dodopayments/types/usage_event_ingest_response.py +9 -0
- dodopayments/types/usage_event_list_params.py +42 -0
- {dodopayments-1.51.1.dist-info → dodopayments-1.56.5.dist-info}/METADATA +6 -4
- dodopayments-1.56.5.dist-info/RECORD +239 -0
- dodopayments-1.51.1.dist-info/RECORD +0 -163
- {dodopayments-1.51.1.dist-info → dodopayments-1.56.5.dist-info}/WHEEL +0 -0
- {dodopayments-1.51.1.dist-info → dodopayments-1.56.5.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
|
+
from .wallets import (
|
|
4
|
+
WalletsResource,
|
|
5
|
+
AsyncWalletsResource,
|
|
6
|
+
WalletsResourceWithRawResponse,
|
|
7
|
+
AsyncWalletsResourceWithRawResponse,
|
|
8
|
+
WalletsResourceWithStreamingResponse,
|
|
9
|
+
AsyncWalletsResourceWithStreamingResponse,
|
|
10
|
+
)
|
|
3
11
|
from .customers import (
|
|
4
12
|
CustomersResource,
|
|
5
13
|
AsyncCustomersResource,
|
|
@@ -24,6 +32,12 @@ __all__ = [
|
|
|
24
32
|
"AsyncCustomerPortalResourceWithRawResponse",
|
|
25
33
|
"CustomerPortalResourceWithStreamingResponse",
|
|
26
34
|
"AsyncCustomerPortalResourceWithStreamingResponse",
|
|
35
|
+
"WalletsResource",
|
|
36
|
+
"AsyncWalletsResource",
|
|
37
|
+
"WalletsResourceWithRawResponse",
|
|
38
|
+
"AsyncWalletsResourceWithRawResponse",
|
|
39
|
+
"WalletsResourceWithStreamingResponse",
|
|
40
|
+
"AsyncWalletsResourceWithStreamingResponse",
|
|
27
41
|
"CustomersResource",
|
|
28
42
|
"AsyncCustomersResource",
|
|
29
43
|
"CustomersResourceWithRawResponse",
|
|
@@ -4,7 +4,7 @@ from __future__ import annotations
|
|
|
4
4
|
|
|
5
5
|
import httpx
|
|
6
6
|
|
|
7
|
-
from ..._types import
|
|
7
|
+
from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
|
|
8
8
|
from ..._utils import maybe_transform, async_maybe_transform
|
|
9
9
|
from ..._compat import cached_property
|
|
10
10
|
from ..._resource import SyncAPIResource, AsyncAPIResource
|
|
@@ -45,13 +45,13 @@ class CustomerPortalResource(SyncAPIResource):
|
|
|
45
45
|
self,
|
|
46
46
|
customer_id: str,
|
|
47
47
|
*,
|
|
48
|
-
send_email: bool |
|
|
48
|
+
send_email: bool | Omit = omit,
|
|
49
49
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
50
50
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
51
51
|
extra_headers: Headers | None = None,
|
|
52
52
|
extra_query: Query | None = None,
|
|
53
53
|
extra_body: Body | None = None,
|
|
54
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
54
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
55
55
|
) -> CustomerPortalSession:
|
|
56
56
|
"""
|
|
57
57
|
Args:
|
|
@@ -106,13 +106,13 @@ class AsyncCustomerPortalResource(AsyncAPIResource):
|
|
|
106
106
|
self,
|
|
107
107
|
customer_id: str,
|
|
108
108
|
*,
|
|
109
|
-
send_email: bool |
|
|
109
|
+
send_email: bool | Omit = omit,
|
|
110
110
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
111
111
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
112
112
|
extra_headers: Headers | None = None,
|
|
113
113
|
extra_query: Query | None = None,
|
|
114
114
|
extra_body: Body | None = None,
|
|
115
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
115
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
116
116
|
) -> CustomerPortalSession:
|
|
117
117
|
"""
|
|
118
118
|
Args:
|
|
@@ -7,7 +7,7 @@ from typing import Optional
|
|
|
7
7
|
import httpx
|
|
8
8
|
|
|
9
9
|
from ...types import customer_list_params, customer_create_params, customer_update_params
|
|
10
|
-
from ..._types import
|
|
10
|
+
from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
|
|
11
11
|
from ..._utils import maybe_transform, async_maybe_transform
|
|
12
12
|
from ..._compat import cached_property
|
|
13
13
|
from ..._resource import SyncAPIResource, AsyncAPIResource
|
|
@@ -27,6 +27,14 @@ from .customer_portal import (
|
|
|
27
27
|
CustomerPortalResourceWithStreamingResponse,
|
|
28
28
|
AsyncCustomerPortalResourceWithStreamingResponse,
|
|
29
29
|
)
|
|
30
|
+
from .wallets.wallets import (
|
|
31
|
+
WalletsResource,
|
|
32
|
+
AsyncWalletsResource,
|
|
33
|
+
WalletsResourceWithRawResponse,
|
|
34
|
+
AsyncWalletsResourceWithRawResponse,
|
|
35
|
+
WalletsResourceWithStreamingResponse,
|
|
36
|
+
AsyncWalletsResourceWithStreamingResponse,
|
|
37
|
+
)
|
|
30
38
|
from ...types.customer import Customer
|
|
31
39
|
|
|
32
40
|
__all__ = ["CustomersResource", "AsyncCustomersResource"]
|
|
@@ -37,6 +45,10 @@ class CustomersResource(SyncAPIResource):
|
|
|
37
45
|
def customer_portal(self) -> CustomerPortalResource:
|
|
38
46
|
return CustomerPortalResource(self._client)
|
|
39
47
|
|
|
48
|
+
@cached_property
|
|
49
|
+
def wallets(self) -> WalletsResource:
|
|
50
|
+
return WalletsResource(self._client)
|
|
51
|
+
|
|
40
52
|
@cached_property
|
|
41
53
|
def with_raw_response(self) -> CustomersResourceWithRawResponse:
|
|
42
54
|
"""
|
|
@@ -61,13 +73,13 @@ class CustomersResource(SyncAPIResource):
|
|
|
61
73
|
*,
|
|
62
74
|
email: str,
|
|
63
75
|
name: str,
|
|
64
|
-
phone_number: Optional[str] |
|
|
76
|
+
phone_number: Optional[str] | Omit = omit,
|
|
65
77
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
66
78
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
67
79
|
extra_headers: Headers | None = None,
|
|
68
80
|
extra_query: Query | None = None,
|
|
69
81
|
extra_body: Body | None = None,
|
|
70
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
82
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
71
83
|
) -> Customer:
|
|
72
84
|
"""
|
|
73
85
|
Args:
|
|
@@ -104,7 +116,7 @@ class CustomersResource(SyncAPIResource):
|
|
|
104
116
|
extra_headers: Headers | None = None,
|
|
105
117
|
extra_query: Query | None = None,
|
|
106
118
|
extra_body: Body | None = None,
|
|
107
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
119
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
108
120
|
) -> Customer:
|
|
109
121
|
"""
|
|
110
122
|
Args:
|
|
@@ -130,14 +142,14 @@ class CustomersResource(SyncAPIResource):
|
|
|
130
142
|
self,
|
|
131
143
|
customer_id: str,
|
|
132
144
|
*,
|
|
133
|
-
name: Optional[str] |
|
|
134
|
-
phone_number: Optional[str] |
|
|
145
|
+
name: Optional[str] | Omit = omit,
|
|
146
|
+
phone_number: Optional[str] | Omit = omit,
|
|
135
147
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
136
148
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
137
149
|
extra_headers: Headers | None = None,
|
|
138
150
|
extra_query: Query | None = None,
|
|
139
151
|
extra_body: Body | None = None,
|
|
140
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
152
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
141
153
|
) -> Customer:
|
|
142
154
|
"""
|
|
143
155
|
Args:
|
|
@@ -169,15 +181,15 @@ class CustomersResource(SyncAPIResource):
|
|
|
169
181
|
def list(
|
|
170
182
|
self,
|
|
171
183
|
*,
|
|
172
|
-
email: str |
|
|
173
|
-
page_number: int |
|
|
174
|
-
page_size: int |
|
|
184
|
+
email: str | Omit = omit,
|
|
185
|
+
page_number: int | Omit = omit,
|
|
186
|
+
page_size: int | Omit = omit,
|
|
175
187
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
176
188
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
177
189
|
extra_headers: Headers | None = None,
|
|
178
190
|
extra_query: Query | None = None,
|
|
179
191
|
extra_body: Body | None = None,
|
|
180
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
192
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
181
193
|
) -> SyncDefaultPageNumberPagination[Customer]:
|
|
182
194
|
"""
|
|
183
195
|
Args:
|
|
@@ -221,6 +233,10 @@ class AsyncCustomersResource(AsyncAPIResource):
|
|
|
221
233
|
def customer_portal(self) -> AsyncCustomerPortalResource:
|
|
222
234
|
return AsyncCustomerPortalResource(self._client)
|
|
223
235
|
|
|
236
|
+
@cached_property
|
|
237
|
+
def wallets(self) -> AsyncWalletsResource:
|
|
238
|
+
return AsyncWalletsResource(self._client)
|
|
239
|
+
|
|
224
240
|
@cached_property
|
|
225
241
|
def with_raw_response(self) -> AsyncCustomersResourceWithRawResponse:
|
|
226
242
|
"""
|
|
@@ -245,13 +261,13 @@ class AsyncCustomersResource(AsyncAPIResource):
|
|
|
245
261
|
*,
|
|
246
262
|
email: str,
|
|
247
263
|
name: str,
|
|
248
|
-
phone_number: Optional[str] |
|
|
264
|
+
phone_number: Optional[str] | Omit = omit,
|
|
249
265
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
250
266
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
251
267
|
extra_headers: Headers | None = None,
|
|
252
268
|
extra_query: Query | None = None,
|
|
253
269
|
extra_body: Body | None = None,
|
|
254
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
270
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
255
271
|
) -> Customer:
|
|
256
272
|
"""
|
|
257
273
|
Args:
|
|
@@ -288,7 +304,7 @@ class AsyncCustomersResource(AsyncAPIResource):
|
|
|
288
304
|
extra_headers: Headers | None = None,
|
|
289
305
|
extra_query: Query | None = None,
|
|
290
306
|
extra_body: Body | None = None,
|
|
291
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
307
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
292
308
|
) -> Customer:
|
|
293
309
|
"""
|
|
294
310
|
Args:
|
|
@@ -314,14 +330,14 @@ class AsyncCustomersResource(AsyncAPIResource):
|
|
|
314
330
|
self,
|
|
315
331
|
customer_id: str,
|
|
316
332
|
*,
|
|
317
|
-
name: Optional[str] |
|
|
318
|
-
phone_number: Optional[str] |
|
|
333
|
+
name: Optional[str] | Omit = omit,
|
|
334
|
+
phone_number: Optional[str] | Omit = omit,
|
|
319
335
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
320
336
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
321
337
|
extra_headers: Headers | None = None,
|
|
322
338
|
extra_query: Query | None = None,
|
|
323
339
|
extra_body: Body | None = None,
|
|
324
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
340
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
325
341
|
) -> Customer:
|
|
326
342
|
"""
|
|
327
343
|
Args:
|
|
@@ -353,15 +369,15 @@ class AsyncCustomersResource(AsyncAPIResource):
|
|
|
353
369
|
def list(
|
|
354
370
|
self,
|
|
355
371
|
*,
|
|
356
|
-
email: str |
|
|
357
|
-
page_number: int |
|
|
358
|
-
page_size: int |
|
|
372
|
+
email: str | Omit = omit,
|
|
373
|
+
page_number: int | Omit = omit,
|
|
374
|
+
page_size: int | Omit = omit,
|
|
359
375
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
360
376
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
361
377
|
extra_headers: Headers | None = None,
|
|
362
378
|
extra_query: Query | None = None,
|
|
363
379
|
extra_body: Body | None = None,
|
|
364
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
380
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
365
381
|
) -> AsyncPaginator[Customer, AsyncDefaultPageNumberPagination[Customer]]:
|
|
366
382
|
"""
|
|
367
383
|
Args:
|
|
@@ -421,6 +437,10 @@ class CustomersResourceWithRawResponse:
|
|
|
421
437
|
def customer_portal(self) -> CustomerPortalResourceWithRawResponse:
|
|
422
438
|
return CustomerPortalResourceWithRawResponse(self._customers.customer_portal)
|
|
423
439
|
|
|
440
|
+
@cached_property
|
|
441
|
+
def wallets(self) -> WalletsResourceWithRawResponse:
|
|
442
|
+
return WalletsResourceWithRawResponse(self._customers.wallets)
|
|
443
|
+
|
|
424
444
|
|
|
425
445
|
class AsyncCustomersResourceWithRawResponse:
|
|
426
446
|
def __init__(self, customers: AsyncCustomersResource) -> None:
|
|
@@ -443,6 +463,10 @@ class AsyncCustomersResourceWithRawResponse:
|
|
|
443
463
|
def customer_portal(self) -> AsyncCustomerPortalResourceWithRawResponse:
|
|
444
464
|
return AsyncCustomerPortalResourceWithRawResponse(self._customers.customer_portal)
|
|
445
465
|
|
|
466
|
+
@cached_property
|
|
467
|
+
def wallets(self) -> AsyncWalletsResourceWithRawResponse:
|
|
468
|
+
return AsyncWalletsResourceWithRawResponse(self._customers.wallets)
|
|
469
|
+
|
|
446
470
|
|
|
447
471
|
class CustomersResourceWithStreamingResponse:
|
|
448
472
|
def __init__(self, customers: CustomersResource) -> None:
|
|
@@ -465,6 +489,10 @@ class CustomersResourceWithStreamingResponse:
|
|
|
465
489
|
def customer_portal(self) -> CustomerPortalResourceWithStreamingResponse:
|
|
466
490
|
return CustomerPortalResourceWithStreamingResponse(self._customers.customer_portal)
|
|
467
491
|
|
|
492
|
+
@cached_property
|
|
493
|
+
def wallets(self) -> WalletsResourceWithStreamingResponse:
|
|
494
|
+
return WalletsResourceWithStreamingResponse(self._customers.wallets)
|
|
495
|
+
|
|
468
496
|
|
|
469
497
|
class AsyncCustomersResourceWithStreamingResponse:
|
|
470
498
|
def __init__(self, customers: AsyncCustomersResource) -> None:
|
|
@@ -486,3 +514,7 @@ class AsyncCustomersResourceWithStreamingResponse:
|
|
|
486
514
|
@cached_property
|
|
487
515
|
def customer_portal(self) -> AsyncCustomerPortalResourceWithStreamingResponse:
|
|
488
516
|
return AsyncCustomerPortalResourceWithStreamingResponse(self._customers.customer_portal)
|
|
517
|
+
|
|
518
|
+
@cached_property
|
|
519
|
+
def wallets(self) -> AsyncWalletsResourceWithStreamingResponse:
|
|
520
|
+
return AsyncWalletsResourceWithStreamingResponse(self._customers.wallets)
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from .wallets import (
|
|
4
|
+
WalletsResource,
|
|
5
|
+
AsyncWalletsResource,
|
|
6
|
+
WalletsResourceWithRawResponse,
|
|
7
|
+
AsyncWalletsResourceWithRawResponse,
|
|
8
|
+
WalletsResourceWithStreamingResponse,
|
|
9
|
+
AsyncWalletsResourceWithStreamingResponse,
|
|
10
|
+
)
|
|
11
|
+
from .ledger_entries import (
|
|
12
|
+
LedgerEntriesResource,
|
|
13
|
+
AsyncLedgerEntriesResource,
|
|
14
|
+
LedgerEntriesResourceWithRawResponse,
|
|
15
|
+
AsyncLedgerEntriesResourceWithRawResponse,
|
|
16
|
+
LedgerEntriesResourceWithStreamingResponse,
|
|
17
|
+
AsyncLedgerEntriesResourceWithStreamingResponse,
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
__all__ = [
|
|
21
|
+
"LedgerEntriesResource",
|
|
22
|
+
"AsyncLedgerEntriesResource",
|
|
23
|
+
"LedgerEntriesResourceWithRawResponse",
|
|
24
|
+
"AsyncLedgerEntriesResourceWithRawResponse",
|
|
25
|
+
"LedgerEntriesResourceWithStreamingResponse",
|
|
26
|
+
"AsyncLedgerEntriesResourceWithStreamingResponse",
|
|
27
|
+
"WalletsResource",
|
|
28
|
+
"AsyncWalletsResource",
|
|
29
|
+
"WalletsResourceWithRawResponse",
|
|
30
|
+
"AsyncWalletsResourceWithRawResponse",
|
|
31
|
+
"WalletsResourceWithStreamingResponse",
|
|
32
|
+
"AsyncWalletsResourceWithStreamingResponse",
|
|
33
|
+
]
|
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Optional
|
|
6
|
+
from typing_extensions import Literal
|
|
7
|
+
|
|
8
|
+
import httpx
|
|
9
|
+
|
|
10
|
+
from ....types import Currency
|
|
11
|
+
from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
|
|
12
|
+
from ...._utils import maybe_transform, async_maybe_transform
|
|
13
|
+
from ...._compat import cached_property
|
|
14
|
+
from ...._resource import SyncAPIResource, AsyncAPIResource
|
|
15
|
+
from ...._response import (
|
|
16
|
+
to_raw_response_wrapper,
|
|
17
|
+
to_streamed_response_wrapper,
|
|
18
|
+
async_to_raw_response_wrapper,
|
|
19
|
+
async_to_streamed_response_wrapper,
|
|
20
|
+
)
|
|
21
|
+
from ....pagination import SyncDefaultPageNumberPagination, AsyncDefaultPageNumberPagination
|
|
22
|
+
from ...._base_client import AsyncPaginator, make_request_options
|
|
23
|
+
from ....types.currency import Currency
|
|
24
|
+
from ....types.customers.wallets import ledger_entry_list_params, ledger_entry_create_params
|
|
25
|
+
from ....types.customers.customer_wallet import CustomerWallet
|
|
26
|
+
from ....types.customers.wallets.customer_wallet_transaction import CustomerWalletTransaction
|
|
27
|
+
|
|
28
|
+
__all__ = ["LedgerEntriesResource", "AsyncLedgerEntriesResource"]
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class LedgerEntriesResource(SyncAPIResource):
|
|
32
|
+
@cached_property
|
|
33
|
+
def with_raw_response(self) -> LedgerEntriesResourceWithRawResponse:
|
|
34
|
+
"""
|
|
35
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
36
|
+
the raw response object instead of the parsed content.
|
|
37
|
+
|
|
38
|
+
For more information, see https://www.github.com/dodopayments/dodopayments-python#accessing-raw-response-data-eg-headers
|
|
39
|
+
"""
|
|
40
|
+
return LedgerEntriesResourceWithRawResponse(self)
|
|
41
|
+
|
|
42
|
+
@cached_property
|
|
43
|
+
def with_streaming_response(self) -> LedgerEntriesResourceWithStreamingResponse:
|
|
44
|
+
"""
|
|
45
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
46
|
+
|
|
47
|
+
For more information, see https://www.github.com/dodopayments/dodopayments-python#with_streaming_response
|
|
48
|
+
"""
|
|
49
|
+
return LedgerEntriesResourceWithStreamingResponse(self)
|
|
50
|
+
|
|
51
|
+
def create(
|
|
52
|
+
self,
|
|
53
|
+
customer_id: str,
|
|
54
|
+
*,
|
|
55
|
+
amount: int,
|
|
56
|
+
currency: Currency,
|
|
57
|
+
entry_type: Literal["credit", "debit"],
|
|
58
|
+
idempotency_key: Optional[str] | Omit = omit,
|
|
59
|
+
reason: Optional[str] | Omit = omit,
|
|
60
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
61
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
62
|
+
extra_headers: Headers | None = None,
|
|
63
|
+
extra_query: Query | None = None,
|
|
64
|
+
extra_body: Body | None = None,
|
|
65
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
66
|
+
) -> CustomerWallet:
|
|
67
|
+
"""
|
|
68
|
+
Args:
|
|
69
|
+
currency: Currency of the wallet to adjust
|
|
70
|
+
|
|
71
|
+
entry_type: Type of ledger entry - credit or debit
|
|
72
|
+
|
|
73
|
+
idempotency_key: Optional idempotency key to prevent duplicate entries
|
|
74
|
+
|
|
75
|
+
extra_headers: Send extra headers
|
|
76
|
+
|
|
77
|
+
extra_query: Add additional query parameters to the request
|
|
78
|
+
|
|
79
|
+
extra_body: Add additional JSON properties to the request
|
|
80
|
+
|
|
81
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
82
|
+
"""
|
|
83
|
+
if not customer_id:
|
|
84
|
+
raise ValueError(f"Expected a non-empty value for `customer_id` but received {customer_id!r}")
|
|
85
|
+
return self._post(
|
|
86
|
+
f"/customers/{customer_id}/wallets/ledger-entries",
|
|
87
|
+
body=maybe_transform(
|
|
88
|
+
{
|
|
89
|
+
"amount": amount,
|
|
90
|
+
"currency": currency,
|
|
91
|
+
"entry_type": entry_type,
|
|
92
|
+
"idempotency_key": idempotency_key,
|
|
93
|
+
"reason": reason,
|
|
94
|
+
},
|
|
95
|
+
ledger_entry_create_params.LedgerEntryCreateParams,
|
|
96
|
+
),
|
|
97
|
+
options=make_request_options(
|
|
98
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
99
|
+
),
|
|
100
|
+
cast_to=CustomerWallet,
|
|
101
|
+
)
|
|
102
|
+
|
|
103
|
+
def list(
|
|
104
|
+
self,
|
|
105
|
+
customer_id: str,
|
|
106
|
+
*,
|
|
107
|
+
currency: Currency | Omit = omit,
|
|
108
|
+
page_number: int | Omit = omit,
|
|
109
|
+
page_size: int | Omit = omit,
|
|
110
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
111
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
112
|
+
extra_headers: Headers | None = None,
|
|
113
|
+
extra_query: Query | None = None,
|
|
114
|
+
extra_body: Body | None = None,
|
|
115
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
116
|
+
) -> SyncDefaultPageNumberPagination[CustomerWalletTransaction]:
|
|
117
|
+
"""
|
|
118
|
+
Args:
|
|
119
|
+
currency: Optional currency filter
|
|
120
|
+
|
|
121
|
+
extra_headers: Send extra headers
|
|
122
|
+
|
|
123
|
+
extra_query: Add additional query parameters to the request
|
|
124
|
+
|
|
125
|
+
extra_body: Add additional JSON properties to the request
|
|
126
|
+
|
|
127
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
128
|
+
"""
|
|
129
|
+
if not customer_id:
|
|
130
|
+
raise ValueError(f"Expected a non-empty value for `customer_id` but received {customer_id!r}")
|
|
131
|
+
return self._get_api_list(
|
|
132
|
+
f"/customers/{customer_id}/wallets/ledger-entries",
|
|
133
|
+
page=SyncDefaultPageNumberPagination[CustomerWalletTransaction],
|
|
134
|
+
options=make_request_options(
|
|
135
|
+
extra_headers=extra_headers,
|
|
136
|
+
extra_query=extra_query,
|
|
137
|
+
extra_body=extra_body,
|
|
138
|
+
timeout=timeout,
|
|
139
|
+
query=maybe_transform(
|
|
140
|
+
{
|
|
141
|
+
"currency": currency,
|
|
142
|
+
"page_number": page_number,
|
|
143
|
+
"page_size": page_size,
|
|
144
|
+
},
|
|
145
|
+
ledger_entry_list_params.LedgerEntryListParams,
|
|
146
|
+
),
|
|
147
|
+
),
|
|
148
|
+
model=CustomerWalletTransaction,
|
|
149
|
+
)
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
class AsyncLedgerEntriesResource(AsyncAPIResource):
|
|
153
|
+
@cached_property
|
|
154
|
+
def with_raw_response(self) -> AsyncLedgerEntriesResourceWithRawResponse:
|
|
155
|
+
"""
|
|
156
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
157
|
+
the raw response object instead of the parsed content.
|
|
158
|
+
|
|
159
|
+
For more information, see https://www.github.com/dodopayments/dodopayments-python#accessing-raw-response-data-eg-headers
|
|
160
|
+
"""
|
|
161
|
+
return AsyncLedgerEntriesResourceWithRawResponse(self)
|
|
162
|
+
|
|
163
|
+
@cached_property
|
|
164
|
+
def with_streaming_response(self) -> AsyncLedgerEntriesResourceWithStreamingResponse:
|
|
165
|
+
"""
|
|
166
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
167
|
+
|
|
168
|
+
For more information, see https://www.github.com/dodopayments/dodopayments-python#with_streaming_response
|
|
169
|
+
"""
|
|
170
|
+
return AsyncLedgerEntriesResourceWithStreamingResponse(self)
|
|
171
|
+
|
|
172
|
+
async def create(
|
|
173
|
+
self,
|
|
174
|
+
customer_id: str,
|
|
175
|
+
*,
|
|
176
|
+
amount: int,
|
|
177
|
+
currency: Currency,
|
|
178
|
+
entry_type: Literal["credit", "debit"],
|
|
179
|
+
idempotency_key: Optional[str] | Omit = omit,
|
|
180
|
+
reason: Optional[str] | Omit = omit,
|
|
181
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
182
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
183
|
+
extra_headers: Headers | None = None,
|
|
184
|
+
extra_query: Query | None = None,
|
|
185
|
+
extra_body: Body | None = None,
|
|
186
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
187
|
+
) -> CustomerWallet:
|
|
188
|
+
"""
|
|
189
|
+
Args:
|
|
190
|
+
currency: Currency of the wallet to adjust
|
|
191
|
+
|
|
192
|
+
entry_type: Type of ledger entry - credit or debit
|
|
193
|
+
|
|
194
|
+
idempotency_key: Optional idempotency key to prevent duplicate entries
|
|
195
|
+
|
|
196
|
+
extra_headers: Send extra headers
|
|
197
|
+
|
|
198
|
+
extra_query: Add additional query parameters to the request
|
|
199
|
+
|
|
200
|
+
extra_body: Add additional JSON properties to the request
|
|
201
|
+
|
|
202
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
203
|
+
"""
|
|
204
|
+
if not customer_id:
|
|
205
|
+
raise ValueError(f"Expected a non-empty value for `customer_id` but received {customer_id!r}")
|
|
206
|
+
return await self._post(
|
|
207
|
+
f"/customers/{customer_id}/wallets/ledger-entries",
|
|
208
|
+
body=await async_maybe_transform(
|
|
209
|
+
{
|
|
210
|
+
"amount": amount,
|
|
211
|
+
"currency": currency,
|
|
212
|
+
"entry_type": entry_type,
|
|
213
|
+
"idempotency_key": idempotency_key,
|
|
214
|
+
"reason": reason,
|
|
215
|
+
},
|
|
216
|
+
ledger_entry_create_params.LedgerEntryCreateParams,
|
|
217
|
+
),
|
|
218
|
+
options=make_request_options(
|
|
219
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
220
|
+
),
|
|
221
|
+
cast_to=CustomerWallet,
|
|
222
|
+
)
|
|
223
|
+
|
|
224
|
+
def list(
|
|
225
|
+
self,
|
|
226
|
+
customer_id: str,
|
|
227
|
+
*,
|
|
228
|
+
currency: Currency | Omit = omit,
|
|
229
|
+
page_number: int | Omit = omit,
|
|
230
|
+
page_size: int | Omit = omit,
|
|
231
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
232
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
233
|
+
extra_headers: Headers | None = None,
|
|
234
|
+
extra_query: Query | None = None,
|
|
235
|
+
extra_body: Body | None = None,
|
|
236
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
237
|
+
) -> AsyncPaginator[CustomerWalletTransaction, AsyncDefaultPageNumberPagination[CustomerWalletTransaction]]:
|
|
238
|
+
"""
|
|
239
|
+
Args:
|
|
240
|
+
currency: Optional currency filter
|
|
241
|
+
|
|
242
|
+
extra_headers: Send extra headers
|
|
243
|
+
|
|
244
|
+
extra_query: Add additional query parameters to the request
|
|
245
|
+
|
|
246
|
+
extra_body: Add additional JSON properties to the request
|
|
247
|
+
|
|
248
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
249
|
+
"""
|
|
250
|
+
if not customer_id:
|
|
251
|
+
raise ValueError(f"Expected a non-empty value for `customer_id` but received {customer_id!r}")
|
|
252
|
+
return self._get_api_list(
|
|
253
|
+
f"/customers/{customer_id}/wallets/ledger-entries",
|
|
254
|
+
page=AsyncDefaultPageNumberPagination[CustomerWalletTransaction],
|
|
255
|
+
options=make_request_options(
|
|
256
|
+
extra_headers=extra_headers,
|
|
257
|
+
extra_query=extra_query,
|
|
258
|
+
extra_body=extra_body,
|
|
259
|
+
timeout=timeout,
|
|
260
|
+
query=maybe_transform(
|
|
261
|
+
{
|
|
262
|
+
"currency": currency,
|
|
263
|
+
"page_number": page_number,
|
|
264
|
+
"page_size": page_size,
|
|
265
|
+
},
|
|
266
|
+
ledger_entry_list_params.LedgerEntryListParams,
|
|
267
|
+
),
|
|
268
|
+
),
|
|
269
|
+
model=CustomerWalletTransaction,
|
|
270
|
+
)
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
class LedgerEntriesResourceWithRawResponse:
|
|
274
|
+
def __init__(self, ledger_entries: LedgerEntriesResource) -> None:
|
|
275
|
+
self._ledger_entries = ledger_entries
|
|
276
|
+
|
|
277
|
+
self.create = to_raw_response_wrapper(
|
|
278
|
+
ledger_entries.create,
|
|
279
|
+
)
|
|
280
|
+
self.list = to_raw_response_wrapper(
|
|
281
|
+
ledger_entries.list,
|
|
282
|
+
)
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
class AsyncLedgerEntriesResourceWithRawResponse:
|
|
286
|
+
def __init__(self, ledger_entries: AsyncLedgerEntriesResource) -> None:
|
|
287
|
+
self._ledger_entries = ledger_entries
|
|
288
|
+
|
|
289
|
+
self.create = async_to_raw_response_wrapper(
|
|
290
|
+
ledger_entries.create,
|
|
291
|
+
)
|
|
292
|
+
self.list = async_to_raw_response_wrapper(
|
|
293
|
+
ledger_entries.list,
|
|
294
|
+
)
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
class LedgerEntriesResourceWithStreamingResponse:
|
|
298
|
+
def __init__(self, ledger_entries: LedgerEntriesResource) -> None:
|
|
299
|
+
self._ledger_entries = ledger_entries
|
|
300
|
+
|
|
301
|
+
self.create = to_streamed_response_wrapper(
|
|
302
|
+
ledger_entries.create,
|
|
303
|
+
)
|
|
304
|
+
self.list = to_streamed_response_wrapper(
|
|
305
|
+
ledger_entries.list,
|
|
306
|
+
)
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
class AsyncLedgerEntriesResourceWithStreamingResponse:
|
|
310
|
+
def __init__(self, ledger_entries: AsyncLedgerEntriesResource) -> None:
|
|
311
|
+
self._ledger_entries = ledger_entries
|
|
312
|
+
|
|
313
|
+
self.create = async_to_streamed_response_wrapper(
|
|
314
|
+
ledger_entries.create,
|
|
315
|
+
)
|
|
316
|
+
self.list = async_to_streamed_response_wrapper(
|
|
317
|
+
ledger_entries.list,
|
|
318
|
+
)
|