Skip to content

Commit

Permalink
fix: Subscription IDs can be omitted when creating customer portal se…
Browse files Browse the repository at this point in the history
…ssions
  • Loading branch information
davidgrayston-paddle committed Dec 3, 2024
1 parent 38aff5b commit ae40e4b
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ 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.

## 1.2.1 - 2024-12-04

### Fixed

- Subscription IDs can be omitted when creating customer portal sessions

## 1.2.0 - 2024-12-03

### Added
Expand Down
2 changes: 1 addition & 1 deletion paddle_billing/Client.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,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.2.0",
"User-Agent": "PaddleSDK/python 1.2.1",
}
)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from dataclasses import dataclass

from paddle_billing.Operation import Operation
from paddle_billing.Undefined import Undefined


@dataclass
class CreateCustomerPortalSession(Operation):
subscription_ids: list[str] = (None,)
subscription_ids: list[str] | Undefined = Undefined()
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


setup(
version="1.2.0",
version="1.2.1",
author="Paddle and contributors",
author_email="[email protected]",
description="Paddle's Python SDK for Paddle Billing",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"subscription_ids": []
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"data": {
"id": "cpls_01h4ge9r64c22exjsx0fy8b48b",
"customer_id": "ctm_01gysfvfy7vqhpzkq8rjmrq7an",
"urls": {
"general": {
"overview": "https://customer-portal.paddle.com/cpl_01j7zbyqs3vah3aafp4jf62qaw?action=overview&token=pga_eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJjdG1fMDFncm5uNHp0YTVhMW1mMDJqanplN3kyeXMiLCJuYW1lIjoiSm9obiBEb2UiLCJpYXQiOjE3Mjc2NzkyMzh9._oO12IejzdKmyKTwb7BLjmiILkx4_cSyGjXraOBUI_g"
},
"subscriptions": []
},
"created_at": "2024-10-25T06:53:58Z"
},
"meta": {
"request_id": "fa176777-4bca-49ec-aa1e-f53885333cb7"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,26 @@ class TestAddressesClient:
ReadsFixtures.read_raw_json_fixture("response/full_entity_multiple"),
"/customers/ctm_01gysfvfy7vqhpzkq8rjmrq7an/portal-sessions",
),
(
"ctm_01gysfvfy7vqhpzkq8rjmrq7an",
CreateCustomerPortalSession([]),
ReadsFixtures.read_raw_json_fixture("request/create_empty"),
ReadsFixtures.read_raw_json_fixture("response/full_entity_empty"),
"/customers/ctm_01gysfvfy7vqhpzkq8rjmrq7an/portal-sessions",
),
(
"ctm_01gysfvfy7vqhpzkq8rjmrq7an",
CreateCustomerPortalSession(),
"{}",
ReadsFixtures.read_raw_json_fixture("response/full_entity_empty"),
"/customers/ctm_01gysfvfy7vqhpzkq8rjmrq7an/portal-sessions",
),
],
ids=[
"Create portal session with single subscription ID",
"Create portal session with multiple subscription IDs",
"Create portal session with empty subscription IDs",
"Create portal session with ommitted subscription IDs",
],
)
def test_create_uses_expected_payload(
Expand Down

0 comments on commit ae40e4b

Please sign in to comment.