dodopayments 1.38.1__py3-none-any.whl → 1.39.0__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.
Potentially problematic release.
This version of dodopayments might be problematic. Click here for more details.
- dodopayments/_base_client.py +9 -2
- dodopayments/_models.py +8 -5
- dodopayments/_version.py +1 -1
- dodopayments/resources/subscriptions.py +22 -0
- dodopayments/types/subscription_charge_params.py +15 -0
- dodopayments/types/subscription_create_params.py +13 -0
- {dodopayments-1.38.1.dist-info → dodopayments-1.39.0.dist-info}/METADATA +5 -7
- {dodopayments-1.38.1.dist-info → dodopayments-1.39.0.dist-info}/RECORD +10 -10
- {dodopayments-1.38.1.dist-info → dodopayments-1.39.0.dist-info}/WHEEL +0 -0
- {dodopayments-1.38.1.dist-info → dodopayments-1.39.0.dist-info}/licenses/LICENSE +0 -0
dodopayments/_base_client.py
CHANGED
|
@@ -529,6 +529,15 @@ class BaseClient(Generic[_HttpxClientT, _DefaultStreamT]):
|
|
|
529
529
|
# work around https://github.com/encode/httpx/discussions/2880
|
|
530
530
|
kwargs["extensions"] = {"sni_hostname": prepared_url.host.replace("_", "-")}
|
|
531
531
|
|
|
532
|
+
is_body_allowed = options.method.lower() != "get"
|
|
533
|
+
|
|
534
|
+
if is_body_allowed:
|
|
535
|
+
kwargs["json"] = json_data if is_given(json_data) else None
|
|
536
|
+
kwargs["files"] = files
|
|
537
|
+
else:
|
|
538
|
+
headers.pop("Content-Type", None)
|
|
539
|
+
kwargs.pop("data", None)
|
|
540
|
+
|
|
532
541
|
# TODO: report this error to httpx
|
|
533
542
|
return self._client.build_request( # pyright: ignore[reportUnknownMemberType]
|
|
534
543
|
headers=headers,
|
|
@@ -540,8 +549,6 @@ class BaseClient(Generic[_HttpxClientT, _DefaultStreamT]):
|
|
|
540
549
|
# so that passing a `TypedDict` doesn't cause an error.
|
|
541
550
|
# https://github.com/microsoft/pyright/issues/3526#event-6715453066
|
|
542
551
|
params=self.qs.stringify(cast(Mapping[str, Any], params)) if params else None,
|
|
543
|
-
json=json_data if is_given(json_data) else None,
|
|
544
|
-
files=files,
|
|
545
552
|
**kwargs,
|
|
546
553
|
)
|
|
547
554
|
|
dodopayments/_models.py
CHANGED
|
@@ -2,9 +2,10 @@ from __future__ import annotations
|
|
|
2
2
|
|
|
3
3
|
import os
|
|
4
4
|
import inspect
|
|
5
|
-
from typing import TYPE_CHECKING, Any, Type, Union, Generic, TypeVar, Callable, cast
|
|
5
|
+
from typing import TYPE_CHECKING, Any, Type, Union, Generic, TypeVar, Callable, Optional, cast
|
|
6
6
|
from datetime import date, datetime
|
|
7
7
|
from typing_extensions import (
|
|
8
|
+
List,
|
|
8
9
|
Unpack,
|
|
9
10
|
Literal,
|
|
10
11
|
ClassVar,
|
|
@@ -366,7 +367,7 @@ def _construct_field(value: object, field: FieldInfo, key: str) -> object:
|
|
|
366
367
|
if type_ is None:
|
|
367
368
|
raise RuntimeError(f"Unexpected field type is None for {key}")
|
|
368
369
|
|
|
369
|
-
return construct_type(value=value, type_=type_)
|
|
370
|
+
return construct_type(value=value, type_=type_, metadata=getattr(field, "metadata", None))
|
|
370
371
|
|
|
371
372
|
|
|
372
373
|
def is_basemodel(type_: type) -> bool:
|
|
@@ -420,7 +421,7 @@ def construct_type_unchecked(*, value: object, type_: type[_T]) -> _T:
|
|
|
420
421
|
return cast(_T, construct_type(value=value, type_=type_))
|
|
421
422
|
|
|
422
423
|
|
|
423
|
-
def construct_type(*, value: object, type_: object) -> object:
|
|
424
|
+
def construct_type(*, value: object, type_: object, metadata: Optional[List[Any]] = None) -> object:
|
|
424
425
|
"""Loose coercion to the expected type with construction of nested values.
|
|
425
426
|
|
|
426
427
|
If the given value does not match the expected type then it is returned as-is.
|
|
@@ -438,8 +439,10 @@ def construct_type(*, value: object, type_: object) -> object:
|
|
|
438
439
|
type_ = type_.__value__ # type: ignore[unreachable]
|
|
439
440
|
|
|
440
441
|
# unwrap `Annotated[T, ...]` -> `T`
|
|
441
|
-
if
|
|
442
|
-
meta: tuple[Any, ...] =
|
|
442
|
+
if metadata is not None:
|
|
443
|
+
meta: tuple[Any, ...] = tuple(metadata)
|
|
444
|
+
elif is_annotated_type(type_):
|
|
445
|
+
meta = get_args(type_)[1:]
|
|
443
446
|
type_ = extract_type_arg(type_, 0)
|
|
444
447
|
else:
|
|
445
448
|
meta = tuple()
|
dodopayments/_version.py
CHANGED
|
@@ -388,7 +388,9 @@ class SubscriptionsResource(SyncAPIResource):
|
|
|
388
388
|
subscription_id: str,
|
|
389
389
|
*,
|
|
390
390
|
product_price: int,
|
|
391
|
+
adaptive_currency_fees_inclusive: Optional[bool] | NotGiven = NOT_GIVEN,
|
|
391
392
|
metadata: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
|
|
393
|
+
product_currency: Optional[Currency] | NotGiven = NOT_GIVEN,
|
|
392
394
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
393
395
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
394
396
|
extra_headers: Headers | None = None,
|
|
@@ -402,9 +404,16 @@ class SubscriptionsResource(SyncAPIResource):
|
|
|
402
404
|
Represented in the lowest denomination of the currency (e.g.,
|
|
403
405
|
cents for USD). For example, to charge $1.00, pass `100`.
|
|
404
406
|
|
|
407
|
+
adaptive_currency_fees_inclusive: Whether adaptive currency fees should be included in the product_price (true) or
|
|
408
|
+
added on top (false). This field is ignored if adaptive pricing is not enabled
|
|
409
|
+
for the business.
|
|
410
|
+
|
|
405
411
|
metadata: Metadata for the payment. If not passed, the metadata of the subscription will
|
|
406
412
|
be taken
|
|
407
413
|
|
|
414
|
+
product_currency: Optional currency of the product price. If not specified, defaults to the
|
|
415
|
+
currency of the product.
|
|
416
|
+
|
|
408
417
|
extra_headers: Send extra headers
|
|
409
418
|
|
|
410
419
|
extra_query: Add additional query parameters to the request
|
|
@@ -420,7 +429,9 @@ class SubscriptionsResource(SyncAPIResource):
|
|
|
420
429
|
body=maybe_transform(
|
|
421
430
|
{
|
|
422
431
|
"product_price": product_price,
|
|
432
|
+
"adaptive_currency_fees_inclusive": adaptive_currency_fees_inclusive,
|
|
423
433
|
"metadata": metadata,
|
|
434
|
+
"product_currency": product_currency,
|
|
424
435
|
},
|
|
425
436
|
subscription_charge_params.SubscriptionChargeParams,
|
|
426
437
|
),
|
|
@@ -778,7 +789,9 @@ class AsyncSubscriptionsResource(AsyncAPIResource):
|
|
|
778
789
|
subscription_id: str,
|
|
779
790
|
*,
|
|
780
791
|
product_price: int,
|
|
792
|
+
adaptive_currency_fees_inclusive: Optional[bool] | NotGiven = NOT_GIVEN,
|
|
781
793
|
metadata: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
|
|
794
|
+
product_currency: Optional[Currency] | NotGiven = NOT_GIVEN,
|
|
782
795
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
783
796
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
784
797
|
extra_headers: Headers | None = None,
|
|
@@ -792,9 +805,16 @@ class AsyncSubscriptionsResource(AsyncAPIResource):
|
|
|
792
805
|
Represented in the lowest denomination of the currency (e.g.,
|
|
793
806
|
cents for USD). For example, to charge $1.00, pass `100`.
|
|
794
807
|
|
|
808
|
+
adaptive_currency_fees_inclusive: Whether adaptive currency fees should be included in the product_price (true) or
|
|
809
|
+
added on top (false). This field is ignored if adaptive pricing is not enabled
|
|
810
|
+
for the business.
|
|
811
|
+
|
|
795
812
|
metadata: Metadata for the payment. If not passed, the metadata of the subscription will
|
|
796
813
|
be taken
|
|
797
814
|
|
|
815
|
+
product_currency: Optional currency of the product price. If not specified, defaults to the
|
|
816
|
+
currency of the product.
|
|
817
|
+
|
|
798
818
|
extra_headers: Send extra headers
|
|
799
819
|
|
|
800
820
|
extra_query: Add additional query parameters to the request
|
|
@@ -810,7 +830,9 @@ class AsyncSubscriptionsResource(AsyncAPIResource):
|
|
|
810
830
|
body=await async_maybe_transform(
|
|
811
831
|
{
|
|
812
832
|
"product_price": product_price,
|
|
833
|
+
"adaptive_currency_fees_inclusive": adaptive_currency_fees_inclusive,
|
|
813
834
|
"metadata": metadata,
|
|
835
|
+
"product_currency": product_currency,
|
|
814
836
|
},
|
|
815
837
|
subscription_charge_params.SubscriptionChargeParams,
|
|
816
838
|
),
|
|
@@ -5,6 +5,8 @@ from __future__ import annotations
|
|
|
5
5
|
from typing import Dict, Optional
|
|
6
6
|
from typing_extensions import Required, TypedDict
|
|
7
7
|
|
|
8
|
+
from .currency import Currency
|
|
9
|
+
|
|
8
10
|
__all__ = ["SubscriptionChargeParams"]
|
|
9
11
|
|
|
10
12
|
|
|
@@ -16,8 +18,21 @@ class SubscriptionChargeParams(TypedDict, total=False):
|
|
|
16
18
|
For example, to charge $1.00, pass `100`.
|
|
17
19
|
"""
|
|
18
20
|
|
|
21
|
+
adaptive_currency_fees_inclusive: Optional[bool]
|
|
22
|
+
"""
|
|
23
|
+
Whether adaptive currency fees should be included in the product_price (true) or
|
|
24
|
+
added on top (false). This field is ignored if adaptive pricing is not enabled
|
|
25
|
+
for the business.
|
|
26
|
+
"""
|
|
27
|
+
|
|
19
28
|
metadata: Optional[Dict[str, str]]
|
|
20
29
|
"""Metadata for the payment.
|
|
21
30
|
|
|
22
31
|
If not passed, the metadata of the subscription will be taken
|
|
23
32
|
"""
|
|
33
|
+
|
|
34
|
+
product_currency: Optional[Currency]
|
|
35
|
+
"""Optional currency of the product price.
|
|
36
|
+
|
|
37
|
+
If not specified, defaults to the currency of the product.
|
|
38
|
+
"""
|
|
@@ -109,6 +109,19 @@ class OnDemand(TypedDict, total=False):
|
|
|
109
109
|
details for future use.
|
|
110
110
|
"""
|
|
111
111
|
|
|
112
|
+
adaptive_currency_fees_inclusive: Optional[bool]
|
|
113
|
+
"""
|
|
114
|
+
Whether adaptive currency fees should be included in the product_price (true) or
|
|
115
|
+
added on top (false). This field is ignored if adaptive pricing is not enabled
|
|
116
|
+
for the business.
|
|
117
|
+
"""
|
|
118
|
+
|
|
119
|
+
product_currency: Optional[Currency]
|
|
120
|
+
"""Optional currency of the product price.
|
|
121
|
+
|
|
122
|
+
If not specified, defaults to the currency of the product.
|
|
123
|
+
"""
|
|
124
|
+
|
|
112
125
|
product_price: Optional[int]
|
|
113
126
|
"""
|
|
114
127
|
Product price for the initial charge to customer If not specified the stored
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: dodopayments
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.39.0
|
|
4
4
|
Summary: The official Python library for the Dodo Payments API
|
|
5
5
|
Project-URL: Homepage, https://github.com/dodopayments/dodopayments-python
|
|
6
6
|
Project-URL: Repository, https://github.com/dodopayments/dodopayments-python
|
|
@@ -30,12 +30,13 @@ Requires-Dist: sniffio
|
|
|
30
30
|
Requires-Dist: typing-extensions<5,>=4.10
|
|
31
31
|
Provides-Extra: aiohttp
|
|
32
32
|
Requires-Dist: aiohttp; extra == 'aiohttp'
|
|
33
|
-
Requires-Dist: httpx-aiohttp>=0.1.
|
|
33
|
+
Requires-Dist: httpx-aiohttp>=0.1.8; extra == 'aiohttp'
|
|
34
34
|
Description-Content-Type: text/markdown
|
|
35
35
|
|
|
36
36
|
# Dodo Payments Python API library
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
<!-- prettier-ignore -->
|
|
39
|
+
[)](https://pypi.org/project/dodopayments/)
|
|
39
40
|
|
|
40
41
|
The [Dodo Payments](https://dodopayments.com) Python library provides convenient access to the Dodo Payments REST API from any Python 3.8+
|
|
41
42
|
application. The library includes type definitions for all request params and response fields,
|
|
@@ -147,7 +148,6 @@ pip install dodopayments[aiohttp]
|
|
|
147
148
|
Then you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`:
|
|
148
149
|
|
|
149
150
|
```python
|
|
150
|
-
import os
|
|
151
151
|
import asyncio
|
|
152
152
|
from dodopayments import DefaultAioHttpClient
|
|
153
153
|
from dodopayments import AsyncDodoPayments
|
|
@@ -155,9 +155,7 @@ from dodopayments import AsyncDodoPayments
|
|
|
155
155
|
|
|
156
156
|
async def main() -> None:
|
|
157
157
|
async with AsyncDodoPayments(
|
|
158
|
-
bearer_token=
|
|
159
|
-
"DODO_PAYMENTS_API_KEY"
|
|
160
|
-
), # This is the default and can be omitted
|
|
158
|
+
bearer_token="My Bearer Token",
|
|
161
159
|
http_client=DefaultAioHttpClient(),
|
|
162
160
|
) as client:
|
|
163
161
|
payment = await client.payments.create(
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
dodopayments/__init__.py,sha256=jLgJiqM7q7-wstUdqp2RuuWVjLPGor5q-vw3liQR5lw,2711
|
|
2
|
-
dodopayments/_base_client.py,sha256=
|
|
2
|
+
dodopayments/_base_client.py,sha256=ibIQuQPXHiiNAy9mFS01f4iuD8mgqeYXW40Hye6SFQ4,66928
|
|
3
3
|
dodopayments/_client.py,sha256=6gxmSa9iNmeNzmpy05mph0aAbrzFU8P0swS3oYc0dKY,27376
|
|
4
4
|
dodopayments/_compat.py,sha256=VWemUKbj6DDkQ-O4baSpHVLJafotzeXmCQGJugfVTIw,6580
|
|
5
5
|
dodopayments/_constants.py,sha256=S14PFzyN9-I31wiV7SmIlL5Ga0MLHxdvegInGdXH7tM,462
|
|
6
6
|
dodopayments/_exceptions.py,sha256=NgI0bxilB8xXOfjBWCzr-Y7t1aIJGMqCQRXvSyy29cM,3232
|
|
7
7
|
dodopayments/_files.py,sha256=mf4dOgL4b0ryyZlbqLhggD3GVgDf6XxdGFAgce01ugE,3549
|
|
8
|
-
dodopayments/_models.py,sha256=
|
|
8
|
+
dodopayments/_models.py,sha256=viD5E6aDMhxslcFHDYvkHaKzE8YLcNmsPsMe8STixvs,29294
|
|
9
9
|
dodopayments/_qs.py,sha256=AOkSz4rHtK4YI3ZU_kzea-zpwBUgEY8WniGmTPyEimc,4846
|
|
10
10
|
dodopayments/_resource.py,sha256=Jfh17Q3kKzAhO-dlfIwYlueN9t1edaaY_vmnC9vErpA,1136
|
|
11
11
|
dodopayments/_response.py,sha256=PDvrSN3E3IkXVw2GvyOCTNB8ch0Xn9yaWQz4w1nHZEQ,28854
|
|
12
12
|
dodopayments/_streaming.py,sha256=U4D6MhotaUaGaHz32lBt0XM98IOPIpPbKHUfbb0HGCk,10124
|
|
13
13
|
dodopayments/_types.py,sha256=gP0yR7AIegimhmZ6rYIjSHFCr9YWzvh-jZabbVcgtio,6203
|
|
14
|
-
dodopayments/_version.py,sha256=
|
|
14
|
+
dodopayments/_version.py,sha256=HUd-HpPpVlOZ71OaqZA-vSBvGh3k01m-Mx3NlyeGE6E,165
|
|
15
15
|
dodopayments/pagination.py,sha256=WYDrAWHvGL58Fe6X2yYZyYTAFvzWOR63JAsKURk2ti4,1308
|
|
16
16
|
dodopayments/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
17
17
|
dodopayments/_utils/__init__.py,sha256=PNZ_QJuzZEgyYXqkO1HVhGkj5IU9bglVUcw7H-Knjzw,2062
|
|
@@ -37,7 +37,7 @@ dodopayments/resources/misc.py,sha256=BRPUna3lLIrJ-gMGOOQL1-xYx_oMwVDzKL4d498C7p
|
|
|
37
37
|
dodopayments/resources/payments.py,sha256=avEt18R5HifFiI-xaNzYKBBiMsfxC_Px9PeRpq2lehY,25767
|
|
38
38
|
dodopayments/resources/payouts.py,sha256=llIbNwI3vQZYf2HsgYL5Irfl6BBoQc1g4aLPWwY09Uo,6926
|
|
39
39
|
dodopayments/resources/refunds.py,sha256=BS9PcxZhEmBZveZTRo4__WmgVwKpqEEHQDp7tuMh7tQ,15045
|
|
40
|
-
dodopayments/resources/subscriptions.py,sha256=
|
|
40
|
+
dodopayments/resources/subscriptions.py,sha256=DoOZK7asqgNqiuvbaX5Kc2sHwR7NnqIUub1BqSHl0Po,39036
|
|
41
41
|
dodopayments/resources/webhook_events.py,sha256=4pzAMk5TDzkMZv-9tGAevDpsh62XKqb5nOqwI27y6HQ,12803
|
|
42
42
|
dodopayments/resources/customers/__init__.py,sha256=RIP1WYqO_PIq9b57tDaJWf9zIRxG_iFeFkOVhe3apAo,1146
|
|
43
43
|
dodopayments/resources/customers/customer_portal.py,sha256=f74AYBYOb0yIffh4jLmIB3igrcfaHnCS0oAbACmGlyA,6961
|
|
@@ -126,9 +126,9 @@ dodopayments/types/refund_list_params.py,sha256=iz4MPgquP4K3AlYPV5_bbt5jHzGFT__R
|
|
|
126
126
|
dodopayments/types/refund_status.py,sha256=ftnBnLvslfMYcUg8t7nEvb6-m5NWyVVnNcgyVu9eZto,243
|
|
127
127
|
dodopayments/types/subscription.py,sha256=RvYAopmSsBmNAbTLpSFPHJitQGDQbrQQ6cfT0y4fzEk,2762
|
|
128
128
|
dodopayments/types/subscription_change_plan_params.py,sha256=7gm16ttHM7URMjTWQIv0CHrk_wuEY3TfsRc16sTrgig,884
|
|
129
|
-
dodopayments/types/subscription_charge_params.py,sha256
|
|
129
|
+
dodopayments/types/subscription_charge_params.py,sha256=4waxdE1jsE2PFCcMrR6x07-CRfUFpUOs2Vt7LxSZc34,1102
|
|
130
130
|
dodopayments/types/subscription_charge_response.py,sha256=aDFuOKqqQ-_v1szx9oUT89QaeM3nvwrlAExzZhF0O-Q,228
|
|
131
|
-
dodopayments/types/subscription_create_params.py,sha256=
|
|
131
|
+
dodopayments/types/subscription_create_params.py,sha256=AcXBbl_2jsNrf5sA7_SOh8PFYgkaiEKxYSlD7kEaKC4,4039
|
|
132
132
|
dodopayments/types/subscription_create_response.py,sha256=Equ-ycrO3A3mOVElW6BjoBH8sqc5wwKS8ED9fHvTza0,1372
|
|
133
133
|
dodopayments/types/subscription_list_params.py,sha256=nNOBUT4N2p6SpXODpuLw05_KU3dln8HkEMI6S6voy3k,975
|
|
134
134
|
dodopayments/types/subscription_list_response.py,sha256=bL-2inf-DRW7lfrHXxkJFPTIJlkzZFjuCq0bSjj98zc,2628
|
|
@@ -145,7 +145,7 @@ dodopayments/types/invoices/__init__.py,sha256=OKfJYcKb4NObdiRObqJV_dOyDQ8feXekD
|
|
|
145
145
|
dodopayments/types/products/__init__.py,sha256=-W2ETtkni8cZpsC4Eg1aRwuLg1plV1U429JFOR1U4Rw,273
|
|
146
146
|
dodopayments/types/products/image_update_params.py,sha256=xyF5fRudD8wct8KKx6wc8F7bbMzVBQPOMKnX5bTiRDQ,270
|
|
147
147
|
dodopayments/types/products/image_update_response.py,sha256=TcJyXjoJlONpwwR6yZdIuBTu2VNyLRZFELfstD9_V-o,273
|
|
148
|
-
dodopayments-1.
|
|
149
|
-
dodopayments-1.
|
|
150
|
-
dodopayments-1.
|
|
151
|
-
dodopayments-1.
|
|
148
|
+
dodopayments-1.39.0.dist-info/METADATA,sha256=LnGQmcnYtLr1H_YElIecpfJHwMbN84sIvGfQhTbo7xE,18832
|
|
149
|
+
dodopayments-1.39.0.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
|
|
150
|
+
dodopayments-1.39.0.dist-info/licenses/LICENSE,sha256=3_sqrBb5J3AT3FsjMKEOBRZhweWVsl_s_RjFlclm1vQ,11343
|
|
151
|
+
dodopayments-1.39.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|