Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat (subscriptions): add support for subscription ending at #197

Merged
merged 1 commit into from
Sep 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lago_python_client/models/subscription.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class Subscription(BaseModel):
external_id: Optional[str]
subscription_date: Optional[str]
billing_time: Optional[str]
ending_at: Optional[str]


class SubscriptionResponse(BaseResponseModel):
Expand All @@ -27,6 +28,7 @@ class SubscriptionResponse(BaseResponseModel):
external_id: Optional[str]
billing_time: Optional[str]
terminated_at: Optional[str]
ending_at: Optional[str]
subscription_date: Optional[str]
previous_plan_code: Optional[str]
next_plan_code: Optional[str]
Expand Down
1 change: 1 addition & 0 deletions tests/fixtures/subscription.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"created_at": "2022-04-29T08:59:51Z",
"plan_code": "eartha lynch",
"started_at": "2022-04-29T08:59:51Z",
"ending_at": "2022-08-29T08:59:51Z",
"status": "active",
"billing_time": "anniversary",
"terminated_at": null,
Expand Down
1 change: 1 addition & 0 deletions tests/fixtures/subscription_index.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"created_at": "2022-04-29T08:59:51Z",
"plan_code": "eartha lynch",
"started_at": "2022-04-29T08:59:51Z",
"ending_at": "2022-08-29T08:59:51Z",
"status": "active",
"terminated_at": null
}
Expand Down
4 changes: 3 additions & 1 deletion tests/test_subscription_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@

def create_subscription():
return Subscription(external_customer_id='5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba', plan_code='eartha lynch',
external_id='code', billing_time='anniversary', subscription_date='2022-04-29')
external_id='code', billing_time='anniversary', subscription_date='2022-04-29',
ending_at='2022-08-29T08:59:51Z')


def mock_response():
Expand Down Expand Up @@ -46,6 +47,7 @@ def test_valid_create_subscriptions_request(httpx_mock: HTTPXMock):
assert response.plan_code == 'eartha lynch'
assert response.billing_time == 'anniversary'
assert response.subscription_date == '2022-04-29'
assert response.ending_at == '2022-08-29T08:59:51Z'


def test_invalid_create_subscriptions_request(httpx_mock: HTTPXMock):
Expand Down