dodopayments 1.19.0__py3-none-any.whl → 1.20.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.
Files changed (35) hide show
  1. dodopayments/_client.py +33 -24
  2. dodopayments/_version.py +1 -1
  3. dodopayments/resources/__init__.py +14 -0
  4. dodopayments/resources/addons.py +589 -0
  5. dodopayments/resources/payments.py +4 -301
  6. dodopayments/resources/products/products.py +11 -6
  7. dodopayments/resources/subscriptions.py +20 -307
  8. dodopayments/types/__init__.py +9 -0
  9. dodopayments/types/addon_cart_response_item.py +11 -0
  10. dodopayments/types/addon_create_params.py +30 -0
  11. dodopayments/types/addon_list_params.py +16 -0
  12. dodopayments/types/addon_response.py +44 -0
  13. dodopayments/types/addon_update_images_response.py +11 -0
  14. dodopayments/types/addon_update_params.py +33 -0
  15. dodopayments/types/currency.py +153 -0
  16. dodopayments/types/payment.py +3 -295
  17. dodopayments/types/payment_create_params.py +2 -149
  18. dodopayments/types/payment_list_response.py +2 -148
  19. dodopayments/types/payout_list_response.py +2 -147
  20. dodopayments/types/price.py +3 -294
  21. dodopayments/types/price_param.py +3 -298
  22. dodopayments/types/product.py +2 -2
  23. dodopayments/types/product_create_params.py +3 -2
  24. dodopayments/types/product_list_response.py +4 -151
  25. dodopayments/types/product_update_params.py +3 -2
  26. dodopayments/types/refund.py +2 -150
  27. dodopayments/types/subscription.py +7 -149
  28. dodopayments/types/subscription_create_params.py +13 -151
  29. dodopayments/types/subscription_create_response.py +5 -1
  30. dodopayments/types/subscription_list_response.py +77 -0
  31. dodopayments/types/tax_category.py +7 -0
  32. {dodopayments-1.19.0.dist-info → dodopayments-1.20.0.dist-info}/METADATA +6 -6
  33. {dodopayments-1.19.0.dist-info → dodopayments-1.20.0.dist-info}/RECORD +35 -25
  34. {dodopayments-1.19.0.dist-info → dodopayments-1.20.0.dist-info}/WHEEL +0 -0
  35. {dodopayments-1.19.0.dist-info → dodopayments-1.20.0.dist-info}/licenses/LICENSE +0 -0
@@ -2,13 +2,14 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- from typing import Dict, List, Union, Optional
5
+ from typing import Dict, List, Union, Iterable, Optional
6
6
  from datetime import datetime
7
7
  from typing_extensions import Literal
8
8
 
9
9
  import httpx
10
10
 
11
11
  from ..types import (
12
+ Currency,
12
13
  SubscriptionStatus,
13
14
  subscription_list_params,
14
15
  subscription_charge_params,
@@ -28,10 +29,12 @@ from .._response import (
28
29
  )
29
30
  from ..pagination import SyncDefaultPageNumberPagination, AsyncDefaultPageNumberPagination
30
31
  from .._base_client import AsyncPaginator, make_request_options
32
+ from ..types.currency import Currency
31
33
  from ..types.subscription import Subscription
32
34
  from ..types.subscription_status import SubscriptionStatus
33
35
  from ..types.billing_address_param import BillingAddressParam
34
36
  from ..types.customer_request_param import CustomerRequestParam
37
+ from ..types.subscription_list_response import SubscriptionListResponse
35
38
  from ..types.subscription_charge_response import SubscriptionChargeResponse
36
39
  from ..types.subscription_create_response import SubscriptionCreateResponse
37
40
 
@@ -65,6 +68,7 @@ class SubscriptionsResource(SyncAPIResource):
65
68
  customer: CustomerRequestParam,
66
69
  product_id: str,
67
70
  quantity: int,
71
+ addons: Optional[Iterable[subscription_create_params.Addon]] | NotGiven = NOT_GIVEN,
68
72
  allowed_payment_method_types: Optional[
69
73
  List[
70
74
  Literal[
@@ -90,156 +94,7 @@ class SubscriptionsResource(SyncAPIResource):
90
94
  ]
91
95
  ]
92
96
  | NotGiven = NOT_GIVEN,
93
- billing_currency: Optional[
94
- Literal[
95
- "AED",
96
- "ALL",
97
- "AMD",
98
- "ANG",
99
- "AOA",
100
- "ARS",
101
- "AUD",
102
- "AWG",
103
- "AZN",
104
- "BAM",
105
- "BBD",
106
- "BDT",
107
- "BGN",
108
- "BHD",
109
- "BIF",
110
- "BMD",
111
- "BND",
112
- "BOB",
113
- "BRL",
114
- "BSD",
115
- "BWP",
116
- "BYN",
117
- "BZD",
118
- "CAD",
119
- "CHF",
120
- "CLP",
121
- "CNY",
122
- "COP",
123
- "CRC",
124
- "CUP",
125
- "CVE",
126
- "CZK",
127
- "DJF",
128
- "DKK",
129
- "DOP",
130
- "DZD",
131
- "EGP",
132
- "ETB",
133
- "EUR",
134
- "FJD",
135
- "FKP",
136
- "GBP",
137
- "GEL",
138
- "GHS",
139
- "GIP",
140
- "GMD",
141
- "GNF",
142
- "GTQ",
143
- "GYD",
144
- "HKD",
145
- "HNL",
146
- "HRK",
147
- "HTG",
148
- "HUF",
149
- "IDR",
150
- "ILS",
151
- "INR",
152
- "IQD",
153
- "JMD",
154
- "JOD",
155
- "JPY",
156
- "KES",
157
- "KGS",
158
- "KHR",
159
- "KMF",
160
- "KRW",
161
- "KWD",
162
- "KYD",
163
- "KZT",
164
- "LAK",
165
- "LBP",
166
- "LKR",
167
- "LRD",
168
- "LSL",
169
- "LYD",
170
- "MAD",
171
- "MDL",
172
- "MGA",
173
- "MKD",
174
- "MMK",
175
- "MNT",
176
- "MOP",
177
- "MRU",
178
- "MUR",
179
- "MVR",
180
- "MWK",
181
- "MXN",
182
- "MYR",
183
- "MZN",
184
- "NAD",
185
- "NGN",
186
- "NIO",
187
- "NOK",
188
- "NPR",
189
- "NZD",
190
- "OMR",
191
- "PAB",
192
- "PEN",
193
- "PGK",
194
- "PHP",
195
- "PKR",
196
- "PLN",
197
- "PYG",
198
- "QAR",
199
- "RON",
200
- "RSD",
201
- "RUB",
202
- "RWF",
203
- "SAR",
204
- "SBD",
205
- "SCR",
206
- "SEK",
207
- "SGD",
208
- "SHP",
209
- "SLE",
210
- "SLL",
211
- "SOS",
212
- "SRD",
213
- "SSP",
214
- "STN",
215
- "SVC",
216
- "SZL",
217
- "THB",
218
- "TND",
219
- "TOP",
220
- "TRY",
221
- "TTD",
222
- "TWD",
223
- "TZS",
224
- "UAH",
225
- "UGX",
226
- "USD",
227
- "UYU",
228
- "UZS",
229
- "VES",
230
- "VND",
231
- "VUV",
232
- "WST",
233
- "XAF",
234
- "XCD",
235
- "XOF",
236
- "XPF",
237
- "YER",
238
- "ZAR",
239
- "ZMW",
240
- ]
241
- ]
242
- | NotGiven = NOT_GIVEN,
97
+ billing_currency: Optional[Currency] | NotGiven = NOT_GIVEN,
243
98
  discount_code: Optional[str] | NotGiven = NOT_GIVEN,
244
99
  metadata: Dict[str, str] | NotGiven = NOT_GIVEN,
245
100
  on_demand: Optional[subscription_create_params.OnDemand] | NotGiven = NOT_GIVEN,
@@ -261,6 +116,8 @@ class SubscriptionsResource(SyncAPIResource):
261
116
 
262
117
  quantity: Number of units to subscribe for. Must be at least 1.
263
118
 
119
+ addons: Attach addons to this subscription
120
+
264
121
  allowed_payment_method_types: List of payment methods allowed during checkout.
265
122
 
266
123
  Customers will **never** see payment methods that are **not** in this list.
@@ -298,6 +155,7 @@ class SubscriptionsResource(SyncAPIResource):
298
155
  "customer": customer,
299
156
  "product_id": product_id,
300
157
  "quantity": quantity,
158
+ "addons": addons,
301
159
  "allowed_payment_method_types": allowed_payment_method_types,
302
160
  "billing_currency": billing_currency,
303
161
  "discount_code": discount_code,
@@ -409,7 +267,7 @@ class SubscriptionsResource(SyncAPIResource):
409
267
  extra_query: Query | None = None,
410
268
  extra_body: Body | None = None,
411
269
  timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
412
- ) -> SyncDefaultPageNumberPagination[Subscription]:
270
+ ) -> SyncDefaultPageNumberPagination[SubscriptionListResponse]:
413
271
  """
414
272
  Args:
415
273
  created_at_gte: Get events after this created time
@@ -434,7 +292,7 @@ class SubscriptionsResource(SyncAPIResource):
434
292
  """
435
293
  return self._get_api_list(
436
294
  "/subscriptions",
437
- page=SyncDefaultPageNumberPagination[Subscription],
295
+ page=SyncDefaultPageNumberPagination[SubscriptionListResponse],
438
296
  options=make_request_options(
439
297
  extra_headers=extra_headers,
440
298
  extra_query=extra_query,
@@ -452,7 +310,7 @@ class SubscriptionsResource(SyncAPIResource):
452
310
  subscription_list_params.SubscriptionListParams,
453
311
  ),
454
312
  ),
455
- model=Subscription,
313
+ model=SubscriptionListResponse,
456
314
  )
457
315
 
458
316
  def change_plan(
@@ -567,6 +425,7 @@ class AsyncSubscriptionsResource(AsyncAPIResource):
567
425
  customer: CustomerRequestParam,
568
426
  product_id: str,
569
427
  quantity: int,
428
+ addons: Optional[Iterable[subscription_create_params.Addon]] | NotGiven = NOT_GIVEN,
570
429
  allowed_payment_method_types: Optional[
571
430
  List[
572
431
  Literal[
@@ -592,156 +451,7 @@ class AsyncSubscriptionsResource(AsyncAPIResource):
592
451
  ]
593
452
  ]
594
453
  | NotGiven = NOT_GIVEN,
595
- billing_currency: Optional[
596
- Literal[
597
- "AED",
598
- "ALL",
599
- "AMD",
600
- "ANG",
601
- "AOA",
602
- "ARS",
603
- "AUD",
604
- "AWG",
605
- "AZN",
606
- "BAM",
607
- "BBD",
608
- "BDT",
609
- "BGN",
610
- "BHD",
611
- "BIF",
612
- "BMD",
613
- "BND",
614
- "BOB",
615
- "BRL",
616
- "BSD",
617
- "BWP",
618
- "BYN",
619
- "BZD",
620
- "CAD",
621
- "CHF",
622
- "CLP",
623
- "CNY",
624
- "COP",
625
- "CRC",
626
- "CUP",
627
- "CVE",
628
- "CZK",
629
- "DJF",
630
- "DKK",
631
- "DOP",
632
- "DZD",
633
- "EGP",
634
- "ETB",
635
- "EUR",
636
- "FJD",
637
- "FKP",
638
- "GBP",
639
- "GEL",
640
- "GHS",
641
- "GIP",
642
- "GMD",
643
- "GNF",
644
- "GTQ",
645
- "GYD",
646
- "HKD",
647
- "HNL",
648
- "HRK",
649
- "HTG",
650
- "HUF",
651
- "IDR",
652
- "ILS",
653
- "INR",
654
- "IQD",
655
- "JMD",
656
- "JOD",
657
- "JPY",
658
- "KES",
659
- "KGS",
660
- "KHR",
661
- "KMF",
662
- "KRW",
663
- "KWD",
664
- "KYD",
665
- "KZT",
666
- "LAK",
667
- "LBP",
668
- "LKR",
669
- "LRD",
670
- "LSL",
671
- "LYD",
672
- "MAD",
673
- "MDL",
674
- "MGA",
675
- "MKD",
676
- "MMK",
677
- "MNT",
678
- "MOP",
679
- "MRU",
680
- "MUR",
681
- "MVR",
682
- "MWK",
683
- "MXN",
684
- "MYR",
685
- "MZN",
686
- "NAD",
687
- "NGN",
688
- "NIO",
689
- "NOK",
690
- "NPR",
691
- "NZD",
692
- "OMR",
693
- "PAB",
694
- "PEN",
695
- "PGK",
696
- "PHP",
697
- "PKR",
698
- "PLN",
699
- "PYG",
700
- "QAR",
701
- "RON",
702
- "RSD",
703
- "RUB",
704
- "RWF",
705
- "SAR",
706
- "SBD",
707
- "SCR",
708
- "SEK",
709
- "SGD",
710
- "SHP",
711
- "SLE",
712
- "SLL",
713
- "SOS",
714
- "SRD",
715
- "SSP",
716
- "STN",
717
- "SVC",
718
- "SZL",
719
- "THB",
720
- "TND",
721
- "TOP",
722
- "TRY",
723
- "TTD",
724
- "TWD",
725
- "TZS",
726
- "UAH",
727
- "UGX",
728
- "USD",
729
- "UYU",
730
- "UZS",
731
- "VES",
732
- "VND",
733
- "VUV",
734
- "WST",
735
- "XAF",
736
- "XCD",
737
- "XOF",
738
- "XPF",
739
- "YER",
740
- "ZAR",
741
- "ZMW",
742
- ]
743
- ]
744
- | NotGiven = NOT_GIVEN,
454
+ billing_currency: Optional[Currency] | NotGiven = NOT_GIVEN,
745
455
  discount_code: Optional[str] | NotGiven = NOT_GIVEN,
746
456
  metadata: Dict[str, str] | NotGiven = NOT_GIVEN,
747
457
  on_demand: Optional[subscription_create_params.OnDemand] | NotGiven = NOT_GIVEN,
@@ -763,6 +473,8 @@ class AsyncSubscriptionsResource(AsyncAPIResource):
763
473
 
764
474
  quantity: Number of units to subscribe for. Must be at least 1.
765
475
 
476
+ addons: Attach addons to this subscription
477
+
766
478
  allowed_payment_method_types: List of payment methods allowed during checkout.
767
479
 
768
480
  Customers will **never** see payment methods that are **not** in this list.
@@ -800,6 +512,7 @@ class AsyncSubscriptionsResource(AsyncAPIResource):
800
512
  "customer": customer,
801
513
  "product_id": product_id,
802
514
  "quantity": quantity,
515
+ "addons": addons,
803
516
  "allowed_payment_method_types": allowed_payment_method_types,
804
517
  "billing_currency": billing_currency,
805
518
  "discount_code": discount_code,
@@ -911,7 +624,7 @@ class AsyncSubscriptionsResource(AsyncAPIResource):
911
624
  extra_query: Query | None = None,
912
625
  extra_body: Body | None = None,
913
626
  timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
914
- ) -> AsyncPaginator[Subscription, AsyncDefaultPageNumberPagination[Subscription]]:
627
+ ) -> AsyncPaginator[SubscriptionListResponse, AsyncDefaultPageNumberPagination[SubscriptionListResponse]]:
915
628
  """
916
629
  Args:
917
630
  created_at_gte: Get events after this created time
@@ -936,7 +649,7 @@ class AsyncSubscriptionsResource(AsyncAPIResource):
936
649
  """
937
650
  return self._get_api_list(
938
651
  "/subscriptions",
939
- page=AsyncDefaultPageNumberPagination[Subscription],
652
+ page=AsyncDefaultPageNumberPagination[SubscriptionListResponse],
940
653
  options=make_request_options(
941
654
  extra_headers=extra_headers,
942
655
  extra_query=extra_query,
@@ -954,7 +667,7 @@ class AsyncSubscriptionsResource(AsyncAPIResource):
954
667
  subscription_list_params.SubscriptionListParams,
955
668
  ),
956
669
  ),
957
- model=Subscription,
670
+ model=SubscriptionListResponse,
958
671
  )
959
672
 
960
673
  async def change_plan(
@@ -7,23 +7,29 @@ from .refund import Refund as Refund
7
7
  from .dispute import Dispute as Dispute
8
8
  from .payment import Payment as Payment
9
9
  from .product import Product as Product
10
+ from .currency import Currency as Currency
10
11
  from .customer import Customer as Customer
11
12
  from .discount import Discount as Discount
12
13
  from .license_key import LicenseKey as LicenseKey
13
14
  from .price_param import PriceParam as PriceParam
14
15
  from .country_code import CountryCode as CountryCode
15
16
  from .subscription import Subscription as Subscription
17
+ from .tax_category import TaxCategory as TaxCategory
16
18
  from .discount_type import DiscountType as DiscountType
17
19
  from .dispute_stage import DisputeStage as DisputeStage
18
20
  from .intent_status import IntentStatus as IntentStatus
19
21
  from .refund_status import RefundStatus as RefundStatus
20
22
  from .time_interval import TimeInterval as TimeInterval
21
23
  from .webhook_event import WebhookEvent as WebhookEvent
24
+ from .addon_response import AddonResponse as AddonResponse
22
25
  from .dispute_status import DisputeStatus as DisputeStatus
23
26
  from .billing_address import BillingAddress as BillingAddress
27
+ from .addon_list_params import AddonListParams as AddonListParams
24
28
  from .license_key_status import LicenseKeyStatus as LicenseKeyStatus
25
29
  from .payout_list_params import PayoutListParams as PayoutListParams
26
30
  from .refund_list_params import RefundListParams as RefundListParams
31
+ from .addon_create_params import AddonCreateParams as AddonCreateParams
32
+ from .addon_update_params import AddonUpdateParams as AddonUpdateParams
27
33
  from .dispute_list_params import DisputeListParams as DisputeListParams
28
34
  from .payment_list_params import PaymentListParams as PaymentListParams
29
35
  from .product_list_params import ProductListParams as ProductListParams
@@ -50,6 +56,7 @@ from .license_activate_params import LicenseActivateParams as LicenseActivatePar
50
56
  from .license_key_list_params import LicenseKeyListParams as LicenseKeyListParams
51
57
  from .license_validate_params import LicenseValidateParams as LicenseValidateParams
52
58
  from .payment_create_response import PaymentCreateResponse as PaymentCreateResponse
59
+ from .addon_cart_response_item import AddonCartResponseItem as AddonCartResponseItem
53
60
  from .customer_limited_details import CustomerLimitedDetails as CustomerLimitedDetails
54
61
  from .subscription_list_params import SubscriptionListParams as SubscriptionListParams
55
62
  from .create_new_customer_param import CreateNewCustomerParam as CreateNewCustomerParam
@@ -61,7 +68,9 @@ from .license_key_duration_param import LicenseKeyDurationParam as LicenseKeyDur
61
68
  from .one_time_product_cart_item import OneTimeProductCartItem as OneTimeProductCartItem
62
69
  from .subscription_charge_params import SubscriptionChargeParams as SubscriptionChargeParams
63
70
  from .subscription_create_params import SubscriptionCreateParams as SubscriptionCreateParams
71
+ from .subscription_list_response import SubscriptionListResponse as SubscriptionListResponse
64
72
  from .subscription_update_params import SubscriptionUpdateParams as SubscriptionUpdateParams
73
+ from .addon_update_images_response import AddonUpdateImagesResponse as AddonUpdateImagesResponse
65
74
  from .subscription_charge_response import SubscriptionChargeResponse as SubscriptionChargeResponse
66
75
  from .subscription_create_response import SubscriptionCreateResponse as SubscriptionCreateResponse
67
76
  from .attach_existing_customer_param import AttachExistingCustomerParam as AttachExistingCustomerParam
@@ -0,0 +1,11 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from .._models import BaseModel
4
+
5
+ __all__ = ["AddonCartResponseItem"]
6
+
7
+
8
+ class AddonCartResponseItem(BaseModel):
9
+ addon_id: str
10
+
11
+ quantity: int
@@ -0,0 +1,30 @@
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 Required, TypedDict
7
+
8
+ from .currency import Currency
9
+ from .tax_category import TaxCategory
10
+
11
+ __all__ = ["AddonCreateParams"]
12
+
13
+
14
+ class AddonCreateParams(TypedDict, total=False):
15
+ currency: Required[Currency]
16
+
17
+ name: Required[str]
18
+ """Name of the Addon"""
19
+
20
+ price: Required[int]
21
+ """Amount of the addon"""
22
+
23
+ tax_category: Required[TaxCategory]
24
+ """
25
+ Represents the different categories of taxation applicable to various products
26
+ and services.
27
+ """
28
+
29
+ description: Optional[str]
30
+ """Optional description of the Addon"""
@@ -0,0 +1,16 @@
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 TypedDict
7
+
8
+ __all__ = ["AddonListParams"]
9
+
10
+
11
+ class AddonListParams(TypedDict, total=False):
12
+ page_number: Optional[int]
13
+ """Page number default is 0"""
14
+
15
+ page_size: Optional[int]
16
+ """Page size default is 10 max is 100"""
@@ -0,0 +1,44 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from typing import Optional
4
+ from datetime import datetime
5
+
6
+ from .._models import BaseModel
7
+ from .currency import Currency
8
+ from .tax_category import TaxCategory
9
+
10
+ __all__ = ["AddonResponse"]
11
+
12
+
13
+ class AddonResponse(BaseModel):
14
+ id: str
15
+ """id of the Addon"""
16
+
17
+ business_id: str
18
+ """Unique identifier for the business to which the addon belongs."""
19
+
20
+ created_at: datetime
21
+ """Created time"""
22
+
23
+ currency: Currency
24
+
25
+ name: str
26
+ """Name of the Addon"""
27
+
28
+ price: int
29
+ """Amount of the addon"""
30
+
31
+ tax_category: TaxCategory
32
+ """
33
+ Represents the different categories of taxation applicable to various products
34
+ and services.
35
+ """
36
+
37
+ updated_at: datetime
38
+ """Updated time"""
39
+
40
+ description: Optional[str] = None
41
+ """Optional description of the Addon"""
42
+
43
+ image: Optional[str] = None
44
+ """Image of the Addon"""
@@ -0,0 +1,11 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from .._models import BaseModel
4
+
5
+ __all__ = ["AddonUpdateImagesResponse"]
6
+
7
+
8
+ class AddonUpdateImagesResponse(BaseModel):
9
+ image_id: str
10
+
11
+ url: str
@@ -0,0 +1,33 @@
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 TypedDict
7
+
8
+ from .currency import Currency
9
+ from .tax_category import TaxCategory
10
+
11
+ __all__ = ["AddonUpdateParams"]
12
+
13
+
14
+ class AddonUpdateParams(TypedDict, total=False):
15
+ currency: Optional[Currency]
16
+
17
+ description: Optional[str]
18
+ """Description of the Addon, optional and must be at most 1000 characters."""
19
+
20
+ image_id: Optional[str]
21
+ """Addon image id after its uploaded to S3"""
22
+
23
+ name: Optional[str]
24
+ """Name of the Addon, optional and must be at most 100 characters."""
25
+
26
+ price: Optional[int]
27
+ """Amount of the addon"""
28
+
29
+ tax_category: Optional[TaxCategory]
30
+ """
31
+ Represents the different categories of taxation applicable to various products
32
+ and services.
33
+ """