diff --git a/lago_python_client/models/__init__.py b/lago_python_client/models/__init__.py index 13730de..ba2f4cb 100644 --- a/lago_python_client/models/__init__.py +++ b/lago_python_client/models/__init__.py @@ -7,6 +7,10 @@ BillableMetricEvaluateExpression as BillableMetricEvaluateExpression, BillableMetricEvaluateExpressionResponse as BillableMetricEvaluateExpressionResponse, ) +from .billing_period import ( + BillingPeriodResponse as BillingPeriodResponse, + BillingPeriodsResponse as BillingPeriodsResponse, +) from .charge import ( Charge as Charge, Charges as Charges, diff --git a/lago_python_client/models/billing_period.py b/lago_python_client/models/billing_period.py new file mode 100644 index 0000000..9be1974 --- /dev/null +++ b/lago_python_client/models/billing_period.py @@ -0,0 +1,18 @@ +from typing import List + +from lago_python_client.base_model import BaseResponseModel + + +class BillingPeriodResponse(BaseResponseModel): + lago_subscription_id: str + external_subscription_id: str + lago_plan_id: str + subscription_from_datetime: str + subscription_to_datetime: str + charges_from_datetime: str + charges_to_datetime: str + invoicing_reason: str + + +class BillingPeriodsResponse(BaseResponseModel): + __root__: List[BillingPeriodResponse] diff --git a/lago_python_client/models/invoice.py b/lago_python_client/models/invoice.py index 282079f..97d1796 100644 --- a/lago_python_client/models/invoice.py +++ b/lago_python_client/models/invoice.py @@ -2,6 +2,7 @@ from lago_python_client.base_model import BaseModel +from .billing_period import BillingPeriodsResponse from .credit import CreditsResponse from .customer import CustomerResponse from .fee import FeesResponse @@ -118,6 +119,7 @@ class InvoiceResponse(BaseResponseModel): file_url: Optional[str] customer: Optional[CustomerResponse] + billing_periods: Optional[BillingPeriodsResponse] subscriptions: Optional[SubscriptionsResponse] fees: Optional[FeesResponse] credits: Optional[CreditsResponse] diff --git a/tests/fixtures/invoice.json b/tests/fixtures/invoice.json index d12d359..dd253e8 100644 --- a/tests/fixtures/invoice.json +++ b/tests/fixtures/invoice.json @@ -97,6 +97,18 @@ } ] }, + "billing_periods": [ + { + "lago_subscription_id": "1a901a90-1a90-1a90-1a90-1a901a901a90", + "external_subscription_id": "LAG-EXT-1234", + "lago_plan_id": "1a901a90-1a90-1a90-1a90-1a901a901a90", + "subscription_from_datetime": "2025-02-00T00:00:00Z", + "subscription_to_datetime": "2025-02-28T23:59:59Z", + "charges_from_datetime": "2025-01-00T00:00:00Z", + "charges_to_datetime": "2025-01-31T23:59:59Z", + "invoicing_reason": "subscription_periodic" + } + ], "subscriptions": [ { "lago_id": "b7ab2926-1de8-4428-9bcd-779314ac129b",