Skip to content

Commit

Permalink
add support for subscription ending at (#197)
Browse files Browse the repository at this point in the history
  • Loading branch information
lovrocolic authored Sep 21, 2023
1 parent 6514944 commit a2ff21b
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 1 deletion.
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

0 comments on commit a2ff21b

Please sign in to comment.