From d1341ee5bb5b13fa23723fe749a119d315df70a4 Mon Sep 17 00:00:00 2001 From: davidgrayston-paddle Date: Wed, 20 Nov 2024 15:20:17 +0000 Subject: [PATCH] fix: Subscription notification should always return billing period when set (#75) --- CHANGELOG.md | 6 +++--- paddle_billing/Client.py | 2 +- paddle_billing/Notifications/Entities/Subscription.py | 2 +- .../Notifications/Entities/SubscriptionCreated.py | 2 +- setup.py | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 276e283d..1c278bf4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,10 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), Check our main [developer changelog](https://developer.paddle.com/?utm_source=dx&utm_medium=paddle-python-sdk) for information about changes to the Paddle Billing platform, the Paddle API, and other developer tools. -## [Unreleased] +## 1.1.2 - 2024-11-20 -### Added -- Added `traffic_source` property to `paddle_billing.Entities.NotificationSetting` entity +### Fixed +- `paddle_billing.Notifications.Entities.Subscription` and `paddle_billing.Notifications.Entities.SubscriptionCreated` `current_billing_period` would return `None` if `billing_details` was `None`. `current_billing_period` will now return `TimePeriod` when set. ## 1.1.1 - 2024-11-14 diff --git a/paddle_billing/Client.py b/paddle_billing/Client.py index cff5fb8b..ed5fe673 100644 --- a/paddle_billing/Client.py +++ b/paddle_billing/Client.py @@ -202,7 +202,7 @@ def build_request_session(self) -> Session: "Authorization": f"Bearer {self.__api_key}", "Content-Type": "application/json", "Paddle-Version": str(self.use_api_version), - "User-Agent": "PaddleSDK/python 1.1.1", + "User-Agent": "PaddleSDK/python 1.1.2", } ) diff --git a/paddle_billing/Notifications/Entities/Subscription.py b/paddle_billing/Notifications/Entities/Subscription.py index b26308a4..0130ed72 100644 --- a/paddle_billing/Notifications/Entities/Subscription.py +++ b/paddle_billing/Notifications/Entities/Subscription.py @@ -69,7 +69,7 @@ def from_dict(data: dict) -> Subscription: paused_at=datetime.fromisoformat(data["paused_at"]) if data.get("paused_at") else None, started_at=datetime.fromisoformat(data["started_at"]) if data.get("started_at") else None, current_billing_period=( - TimePeriod.from_dict(data["current_billing_period"]) if data.get("billing_details") else None + TimePeriod.from_dict(data["current_billing_period"]) if data.get("current_billing_period") else None ), scheduled_change=( SubscriptionScheduledChange.from_dict(data["scheduled_change"]) diff --git a/paddle_billing/Notifications/Entities/SubscriptionCreated.py b/paddle_billing/Notifications/Entities/SubscriptionCreated.py index 63ea4493..1186d756 100644 --- a/paddle_billing/Notifications/Entities/SubscriptionCreated.py +++ b/paddle_billing/Notifications/Entities/SubscriptionCreated.py @@ -71,7 +71,7 @@ def from_dict(data: dict) -> SubscriptionCreated: paused_at=datetime.fromisoformat(data["paused_at"]) if data.get("paused_at") else None, started_at=datetime.fromisoformat(data["started_at"]) if data.get("started_at") else None, current_billing_period=( - TimePeriod.from_dict(data["current_billing_period"]) if data.get("billing_details") else None + TimePeriod.from_dict(data["current_billing_period"]) if data.get("current_billing_period") else None ), scheduled_change=( SubscriptionScheduledChange.from_dict(data["scheduled_change"]) diff --git a/setup.py b/setup.py index 9861e570..34df874d 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ setup( - version="1.1.1", + version="1.1.2", author="Paddle and contributors", author_email="team-dx@paddle.com", description="Paddle's Python SDK for Paddle Billing",