paddle-python-sdk 1.3.0__py3-none-any.whl → 1.4.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.
paddle_billing/Client.py CHANGED
@@ -204,7 +204,7 @@ class Client:
204
204
  "Authorization": f"Bearer {self.__api_key}",
205
205
  "Content-Type": "application/json",
206
206
  "Paddle-Version": str(self.use_api_version),
207
- "User-Agent": "PaddleSDK/python 1.3.0",
207
+ "User-Agent": "PaddleSDK/python 1.4.0",
208
208
  }
209
209
  )
210
210
 
@@ -53,5 +53,5 @@ class Adjustment(Entity):
53
53
  ),
54
54
  updated_at=datetime.fromisoformat(data["updated_at"]) if data.get("updated_at") else None,
55
55
  tax_rates_used=[AdjustmentTaxRatesUsed.from_dict(item) for item in data["tax_rates_used"]],
56
- type=AdjustmentStatus(data["type"]),
56
+ type=AdjustmentActionType(data["type"]),
57
57
  )
@@ -0,0 +1,6 @@
1
+ from paddle_billing.PaddleStrEnum import PaddleStrEnum, PaddleStrEnumMeta
2
+
3
+
4
+ class SubscriptionOnResume(PaddleStrEnum, metaclass=PaddleStrEnumMeta):
5
+ ContinueExistingBillingPeriod: "SubscriptionOnResume" = "continue_existing_billing_period"
6
+ StartNewBillingPeriod: "SubscriptionOnResume" = "start_new_billing_period"
@@ -9,6 +9,7 @@ from paddle_billing.Entities.Subscriptions.SubscriptionItemStatus import Subscri
9
9
  from paddle_billing.Entities.Subscriptions.SubscriptionManagementUrls import SubscriptionManagementUrls
10
10
  from paddle_billing.Entities.Subscriptions.SubscriptionNextTransaction import SubscriptionNextTransaction
11
11
  from paddle_billing.Entities.Subscriptions.SubscriptionOnPaymentFailure import SubscriptionOnPaymentFailure
12
+ from paddle_billing.Entities.Subscriptions.SubscriptionOnResume import SubscriptionOnResume
12
13
  from paddle_billing.Entities.Subscriptions.SubscriptionPreviewSubscriptionUpdateSummary import (
13
14
  SubscriptionPreviewSubscriptionUpdateSummary,
14
15
  )
@@ -2,10 +2,12 @@ from dataclasses import dataclass
2
2
 
3
3
  from paddle_billing.Operation import Operation
4
4
  from paddle_billing.Entities.DateTime import DateTime
5
- from paddle_billing.Entities.Subscriptions import SubscriptionEffectiveFrom
5
+ from paddle_billing.Entities.Subscriptions import SubscriptionEffectiveFrom, SubscriptionOnResume
6
+ from paddle_billing.Undefined import Undefined
6
7
 
7
8
 
8
9
  @dataclass
9
10
  class PauseSubscription(Operation):
10
11
  effective_from: SubscriptionEffectiveFrom | None = None
11
12
  resume_at: DateTime | None = None
13
+ on_resume: SubscriptionOnResume | Undefined = Undefined()
@@ -2,9 +2,11 @@ from dataclasses import dataclass
2
2
 
3
3
  from paddle_billing.Operation import Operation
4
4
  from paddle_billing.Entities.DateTime import DateTime
5
- from paddle_billing.Entities.Subscriptions import SubscriptionResumeEffectiveFrom
5
+ from paddle_billing.Entities.Subscriptions import SubscriptionResumeEffectiveFrom, SubscriptionOnResume
6
+ from paddle_billing.Undefined import Undefined
6
7
 
7
8
 
8
9
  @dataclass
9
10
  class ResumeSubscription(Operation):
10
11
  effective_from: SubscriptionResumeEffectiveFrom | DateTime | None = None
12
+ on_resume: SubscriptionOnResume | Undefined = Undefined()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: paddle-python-sdk
3
- Version: 1.3.0
3
+ Version: 1.4.0
4
4
  Summary: Paddle's Python SDK for Paddle Billing
5
5
  Home-page: https://developer.paddle.com/api-reference/overview
6
6
  Author: Paddle and contributors
@@ -5,7 +5,7 @@ examples/event_polling.py,sha256=580dg_8CFrSCA89Mr1ny4V1gtB3-hk-LfePTbI7DT5w,217
5
5
  examples/get_products.py,sha256=4V7ZG1SH6Oxojufbtzm_TMySw4cOBMQ99mgQK_hlwFQ,1875
6
6
  examples/logger.py,sha256=AxmQmMrsM0ZqMIUnh6iARiczL4S4F9OqQcOu-67owNg,1042
7
7
  examples/webhook_verification.py,sha256=qkNscNdNZUAgxEIk83tCiljN2VmfePZ_k8zTliKz2QY,1205
8
- paddle_billing/Client.py,sha256=gnIKpgFX6ZJovgAqnjh9a91Tw3Cpt-6NgFm3I5xExLE,8787
8
+ paddle_billing/Client.py,sha256=s41MahuyVwWk82lkbMuPSxo0PASfoyIC5cNzqjFYdpg,8787
9
9
  paddle_billing/EnumStringify.py,sha256=iDvKULZat3jx9A-_PhvoN6CbFGf2pyxrQeYZxqX9n8M,48
10
10
  paddle_billing/Environment.py,sha256=sY4nrJUwlTugsZKncieAnvfCojqCcKWi4X7rFzjFeSQ,417
11
11
  paddle_billing/FiltersNone.py,sha256=HxjE6RJb7sy6txphpZSrCTQZt1Ua0XpIz8NDLHC43zo,268
@@ -19,7 +19,7 @@ paddle_billing/ResponseParser.py,sha256=DbbEnVLflzzKiulbtb56Rx7FLEx9Vxe08p1RQRXa
19
19
  paddle_billing/Undefined.py,sha256=NJKVAEGbTBDfnfaAS6Vn_pSHmHDGbIS277gVScuB2A8,26
20
20
  paddle_billing/__init__.py,sha256=x-mRXflhzomHZamB-g1HflsqW2WSYDo-PpPkhyPlAWA,178
21
21
  paddle_billing/Entities/Address.py,sha256=KPnvFIN9S-DX-Y72x9WZScLV-s5vur1Wn1QT2YsS3KI,1500
22
- paddle_billing/Entities/Adjustment.py,sha256=OtYk2iukRx1S1D_P_IBB5XwW-LjYUI1bmTghVz-gG44,2096
22
+ paddle_billing/Entities/Adjustment.py,sha256=5d9DXhyahb8tlRe5ywMI0ueq5kfGkfbpO__mVemlcp8,2100
23
23
  paddle_billing/Entities/AdjustmentCreditNote.py,sha256=nMXkYk4hDyxv4Oaw0iFgslmgMksGwFyoH2wQXiVchOs,305
24
24
  paddle_billing/Entities/Business.py,sha256=wlnAd_lC0Fuw7_BHKZGHt8q-aeLYO6MjO92EYedRnmo,1331
25
25
  paddle_billing/Entities/CreditBalance.py,sha256=aGCsfSf-qZl6kVTfHd41_1raiNuI29picji-bj7-lvg,673
@@ -179,6 +179,7 @@ paddle_billing/Entities/Subscriptions/SubscriptionItemStatus.py,sha256=vzrvLhi_g
179
179
  paddle_billing/Entities/Subscriptions/SubscriptionManagementUrls.py,sha256=7HtoU9nfuPBvShggLTqaJeI7Fi3pMow9DZA81yxI6GQ,407
180
180
  paddle_billing/Entities/Subscriptions/SubscriptionNextTransaction.py,sha256=493Wyw4A9CxPQy3S1HnQMY6WkfU8QLQyhVyaZFZCRnI,905
181
181
  paddle_billing/Entities/Subscriptions/SubscriptionOnPaymentFailure.py,sha256=RH18bZ_n4HZQBeY6I14ZOJ41iaFCEk54SCqKlQ6r8bY,290
182
+ paddle_billing/Entities/Subscriptions/SubscriptionOnResume.py,sha256=4eBwsExVsRyLSb7Fx72ZAz1jScBdba0ZkRb7wwFV8Qs,322
182
183
  paddle_billing/Entities/Subscriptions/SubscriptionPreviewSubscriptionUpdateSummary.py,sha256=GYtBaDUco68X7TfjLczbJ-SFQgYUx9POtCv_Z4tWAEQ,856
183
184
  paddle_billing/Entities/Subscriptions/SubscriptionProrationBillingMode.py,sha256=KO2a9asbDMLS5B_WhK237OUGhtzzw1ZXRrBvgSuEtok,578
184
185
  paddle_billing/Entities/Subscriptions/SubscriptionResult.py,sha256=UF4dY0xd4FooSMXOAcl4fB1CDDFIp_ExptlRMbLzCOc,627
@@ -187,7 +188,7 @@ paddle_billing/Entities/Subscriptions/SubscriptionResumeEffectiveFrom.py,sha256=
187
188
  paddle_billing/Entities/Subscriptions/SubscriptionScheduledChange.py,sha256=tYcsIw7YX-x8CypKeg8d40twc2HqofgTaRMJfLwOWFA,746
188
189
  paddle_billing/Entities/Subscriptions/SubscriptionScheduledChangeAction.py,sha256=Ds4S96Bgw-1hH3WAroX2JE_RM1JBEb0YEfJMtl9Umwo,336
189
190
  paddle_billing/Entities/Subscriptions/SubscriptionStatus.py,sha256=IC3auB11tT5CZ8_QZbvFTcCDUjhKysDofz_yUMfLUbA,425
190
- paddle_billing/Entities/Subscriptions/__init__.py,sha256=C0Fv8z9Xrl97KJdYsdr6eI8_2OIh6kK5w-a4ePMkxfY,1961
191
+ paddle_billing/Entities/Subscriptions/__init__.py,sha256=wExUC55cS8KftnoCQokEJ1Tt3pb1MmHNJQqLx9oyc5w,2053
191
192
  paddle_billing/Entities/Transactions/TransactionAdjustmentsTotals.py,sha256=lM_3SKojGmcOVBiCRFMC7iHEBKEhlzFH58RHrZ7UlPA,867
192
193
  paddle_billing/Entities/Transactions/TransactionBreakdown.py,sha256=TNLicqHrtFqG1V8EqqUT2ekxLBxf0wqdMWLhKbwlg0g,396
193
194
  paddle_billing/Entities/Transactions/TransactionCardType.py,sha256=BMSDuiSXSovrtQ7Rq5oYGbE3JueLuow0kD8UgEYJbPc,632
@@ -492,10 +493,10 @@ paddle_billing/Resources/Subscriptions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JC
492
493
  paddle_billing/Resources/Subscriptions/Operations/CancelSubscription.py,sha256=wELZweZ54xSzXis6OUjgzPumsqrW5I9F8uAEP2_37KY,261
493
494
  paddle_billing/Resources/Subscriptions/Operations/CreateOneTimeCharge.py,sha256=vbzsE2IxfE_NlxRysppfL9Srseb8flWWXq_KVJNud3o,638
494
495
  paddle_billing/Resources/Subscriptions/Operations/ListSubscriptions.py,sha256=MZWegWXn55sg-S8ANcT62c5YEN9LxGq9KifrBCJWn6Q,2882
495
- paddle_billing/Resources/Subscriptions/Operations/PauseSubscription.py,sha256=kLqua4o_Ub5v9ND6kqtfSd6XTYe0FpO9qitDWup-8UY,359
496
+ paddle_billing/Resources/Subscriptions/Operations/PauseSubscription.py,sha256=AZTjFBo7DtqYMCDl55YSfZ8atfqF9yfYgy_SCgUX1rg,490
496
497
  paddle_billing/Resources/Subscriptions/Operations/PreviewOneTimeCharge.py,sha256=6VK7z1afrr0clTzXbNLWczn0eSbD7WlcVosD8QVck2g,639
497
498
  paddle_billing/Resources/Subscriptions/Operations/PreviewUpdateSubscription.py,sha256=NGxJyetafIorxQUgjbH78Bd46QiFsZqs3TjWfDw1wZc,1487
498
- paddle_billing/Resources/Subscriptions/Operations/ResumeSubscription.py,sha256=zbF4Tg9salUb-_CnJyRWCz8vy0_IwJ52i-zern0SgU0,345
499
+ paddle_billing/Resources/Subscriptions/Operations/ResumeSubscription.py,sha256=jGpbhmQn-dxhELKaxeNiX_h4v7HfenhONWm2T6zsm5Q,476
499
500
  paddle_billing/Resources/Subscriptions/Operations/UpdateSubscription.py,sha256=fT1hmyOOBHMcT5lBMBt-RCcvjZoZygwIONWC4xSthBA,1480
500
501
  paddle_billing/Resources/Subscriptions/Operations/__init__.py,sha256=BBatMoIegcdt7q5fnY-ldXeDhZul9PpjlOuOqgf3MFg,1035
501
502
  paddle_billing/Resources/Subscriptions/Operations/Charge/SubscriptionChargeItem.py,sha256=YX6HoDJsMFkejOonfiCxR6jkt0UWr-n4364T7NEeRUY,148
@@ -549,7 +550,7 @@ tests/Functional/Resources/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJ
549
550
  tests/Functional/Resources/Addresses/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
550
551
  tests/Functional/Resources/Addresses/test_AddressesClient.py,sha256=mxiSJgvegEpuqKeNMZeSlujih5XLVvRZ5Hw8J_J0Jhk,16204
551
552
  tests/Functional/Resources/Adjustments/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
552
- tests/Functional/Resources/Adjustments/test_AdjustmentsClient.py,sha256=6Z8NOEkRJBB4kc9oVYh9cfGs51a3Sc6Ls7jwX-9JCkE,17157
553
+ tests/Functional/Resources/Adjustments/test_AdjustmentsClient.py,sha256=5pfezgaaiz0fykofnXWFCZA4sTj7UIhfedj9b0n1fUQ,17332
553
554
  tests/Functional/Resources/Businesses/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
554
555
  tests/Functional/Resources/Businesses/test_BusinessesClient.py,sha256=uUAydFqmXq3snmu--gGVI5nNrpg6oySQM_Ulg9q-G1Q,12727
555
556
  tests/Functional/Resources/CustomerPortalSessions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -581,7 +582,7 @@ tests/Functional/Resources/Products/test_ProductsClient.py,sha256=FlYIjv09RM4rJt
581
582
  tests/Functional/Resources/Reports/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
582
583
  tests/Functional/Resources/Reports/test_ReportsClient.py,sha256=jIOHBQ3YSw0rXrOKxlhIUGtqptUZMBWsMJHBwlhjOxg,13438
583
584
  tests/Functional/Resources/Subscriptions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
584
- tests/Functional/Resources/Subscriptions/test_SubscriptionsClient.py,sha256=9TW7z378xzu-JBTuPkOGY_CThzwQC7P97XYl-PK48bg,61719
585
+ tests/Functional/Resources/Subscriptions/test_SubscriptionsClient.py,sha256=_QNeQ_5hk4sGQyAHpaD43t8z0zlkvZ9xYpdVlfyJanI,64187
585
586
  tests/Functional/Resources/Transactions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
586
587
  tests/Functional/Resources/Transactions/test_TransactionsClient.py,sha256=K3t47sr-HdqPosSXsERsjIGKhbxuWvP2pAdvBD_vLt4,59187
587
588
  tests/Unit/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -596,8 +597,8 @@ tests/Utils/ReadsFixture.py,sha256=M3Ot3xHXp_C7vwttna9deLPHBAO8ml2Jb4thhHOJJ38,1
596
597
  tests/Utils/TestClient.py,sha256=-wc7hJMuR6WC-ukw0c7I59b5-8hj_-nzq__-2M81elg,1453
597
598
  tests/Utils/TestLogger.py,sha256=pFO9x711buRmg-8DAqpzIJP_hr21JPty1_ZQRcwoGKk,554
598
599
  tests/Utils/__init__.py,sha256=JtqJNPKqbNZ9exlpXlF3yj_9cfylPGlvopjQYi7yYTA,37
599
- paddle_python_sdk-1.3.0.dist-info/LICENSE,sha256=e5Sn9mzCdpjnqCLxXpGHNKdYB6JlRSTLhN_CD4WSO6w,10770
600
- paddle_python_sdk-1.3.0.dist-info/METADATA,sha256=yK1BhTY6dJEFsWrr6EwLY8l2TbDn015N4-n2e1Q4RhQ,7376
601
- paddle_python_sdk-1.3.0.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
602
- paddle_python_sdk-1.3.0.dist-info/top_level.txt,sha256=9a07VPng7o5wK8VAXkl6NC30xrNbW9zff_02jHyHi4c,30
603
- paddle_python_sdk-1.3.0.dist-info/RECORD,,
600
+ paddle_python_sdk-1.4.0.dist-info/LICENSE,sha256=e5Sn9mzCdpjnqCLxXpGHNKdYB6JlRSTLhN_CD4WSO6w,10770
601
+ paddle_python_sdk-1.4.0.dist-info/METADATA,sha256=v5XdgkA3RwFqUu-nIBHqmC90ejpEwaarn__0BsMx0Qk,7376
602
+ paddle_python_sdk-1.4.0.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
603
+ paddle_python_sdk-1.4.0.dist-info/top_level.txt,sha256=9a07VPng7o5wK8VAXkl6NC30xrNbW9zff_02jHyHi4c,30
604
+ paddle_python_sdk-1.4.0.dist-info/RECORD,,
@@ -177,6 +177,9 @@ class TestAdjustmentsClient:
177
177
  )
178
178
 
179
179
  assert isinstance(response, Adjustment)
180
+ assert isinstance(response.action, Action)
181
+ assert isinstance(response.status, AdjustmentStatus)
182
+ assert isinstance(response.type, AdjustmentActionType)
180
183
 
181
184
  tax_rates_used = response.tax_rates_used[0]
182
185
  assert isinstance(tax_rates_used, AdjustmentTaxRatesUsed)
@@ -26,6 +26,7 @@ from paddle_billing.Entities.Shared import (
26
26
  from paddle_billing.Entities.Subscriptions import (
27
27
  SubscriptionEffectiveFrom,
28
28
  SubscriptionOnPaymentFailure,
29
+ SubscriptionOnResume,
29
30
  SubscriptionProrationBillingMode,
30
31
  SubscriptionResumeEffectiveFrom,
31
32
  SubscriptionScheduledChangeAction,
@@ -516,11 +517,37 @@ class TestSubscriptionsClient:
516
517
  ReadsFixtures.read_raw_json_fixture("response/full_entity"),
517
518
  "/subscriptions/sub_01h8bx8fmywym11t6swgzba704/pause",
518
519
  ),
520
+ (
521
+ "sub_01h8bx8fmywym11t6swgzba704",
522
+ PauseSubscription(
523
+ SubscriptionEffectiveFrom.NextBillingPeriod,
524
+ DateTime("2023-10-09T16:30:00Z"),
525
+ SubscriptionOnResume.ContinueExistingBillingPeriod,
526
+ ),
527
+ ReadsFixtures.read_raw_json_fixture("request/pause_resume_existing_billing_period"),
528
+ 200,
529
+ ReadsFixtures.read_raw_json_fixture("response/full_entity"),
530
+ "/subscriptions/sub_01h8bx8fmywym11t6swgzba704/pause",
531
+ ),
532
+ (
533
+ "sub_01h8bx8fmywym11t6swgzba704",
534
+ PauseSubscription(
535
+ SubscriptionEffectiveFrom.NextBillingPeriod,
536
+ DateTime("2023-10-09T16:30:00Z"),
537
+ SubscriptionOnResume.StartNewBillingPeriod,
538
+ ),
539
+ ReadsFixtures.read_raw_json_fixture("request/pause_resume_new_billing_period"),
540
+ 200,
541
+ ReadsFixtures.read_raw_json_fixture("response/full_entity"),
542
+ "/subscriptions/sub_01h8bx8fmywym11t6swgzba704/pause",
543
+ ),
519
544
  ],
520
545
  ids=[
521
546
  "Pause subscription",
522
547
  "Pause subscription as of next billing period",
523
548
  "Pause subscription as of next billing period and resume at date",
549
+ "Pause subscription resume in existing billing period",
550
+ "Pause subscription resume in new billing period",
524
551
  ],
525
552
  )
526
553
  def test_pause_subscription_uses_expected_payload(
@@ -583,11 +610,33 @@ class TestSubscriptionsClient:
583
610
  ReadsFixtures.read_raw_json_fixture("response/full_entity"),
584
611
  "/subscriptions/sub_01h8bx8fmywym11t6swgzba704/resume",
585
612
  ),
613
+ (
614
+ "sub_01h8bx8fmywym11t6swgzba704",
615
+ ResumeSubscription(
616
+ SubscriptionResumeEffectiveFrom.Immediately, SubscriptionOnResume.ContinueExistingBillingPeriod
617
+ ),
618
+ ReadsFixtures.read_raw_json_fixture("request/resume_existing_billing_period"),
619
+ 200,
620
+ ReadsFixtures.read_raw_json_fixture("response/full_entity"),
621
+ "/subscriptions/sub_01h8bx8fmywym11t6swgzba704/resume",
622
+ ),
623
+ (
624
+ "sub_01h8bx8fmywym11t6swgzba704",
625
+ ResumeSubscription(
626
+ SubscriptionResumeEffectiveFrom.Immediately, SubscriptionOnResume.StartNewBillingPeriod
627
+ ),
628
+ ReadsFixtures.read_raw_json_fixture("request/resume_new_billing_period"),
629
+ 200,
630
+ ReadsFixtures.read_raw_json_fixture("response/full_entity"),
631
+ "/subscriptions/sub_01h8bx8fmywym11t6swgzba704/resume",
632
+ ),
586
633
  ],
587
634
  ids=[
588
635
  "Resume subscription",
589
636
  "Resume subscription with a billing period",
590
637
  "Resume subscription with a new date",
638
+ "Resume subscription in existing billing period",
639
+ "Resume subscription in new billing period",
591
640
  ],
592
641
  )
593
642
  def test_resume_subscription_uses_expected_payload(