From 3e1d951badb3c56e135907017f37b16ce13f74c9 Mon Sep 17 00:00:00 2001 From: Toon Willems Date: Fri, 30 Aug 2024 12:22:37 +0200 Subject: [PATCH] add applied_usage_thresholds to the api --- lago_python_client/models/invoice.py | 12 ++++++++++++ tests/fixtures/invoice.json | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/lago_python_client/models/invoice.py b/lago_python_client/models/invoice.py index 1f4ebad..a999efa 100644 --- a/lago_python_client/models/invoice.py +++ b/lago_python_client/models/invoice.py @@ -7,6 +7,7 @@ from .fee import FeesResponse from .subscription import SubscriptionsResponse from ..base_model import BaseResponseModel +from .usage_threshold import UsageThreshold # Deprecated: Will be removed in the future @@ -66,6 +67,16 @@ class InvoiceAppliedTaxes(BaseResponseModel): __root__: List[InvoiceAppliedTax] +class InvoiceAppliedUsageThreshold(BaseResponseModel): + lifetime_usage_amount_cents: Optional[int] + created_at: Optional[str] + usage_threshold: Optional[UsageThreshold] + + +class InvoiceAppliedUsageThresholds(BaseResponseModel): + __root__: List[InvoiceAppliedUsageThreshold] + + class InvoiceResponse(BaseResponseModel): lago_id: str sequential_id: Optional[int] @@ -97,3 +108,4 @@ class InvoiceResponse(BaseResponseModel): credits: Optional[CreditsResponse] metadata: Optional[InvoiceMetadataList] applied_taxes: Optional[InvoiceAppliedTaxes] + applied_usage_thresholds: Optional[InvoiceAppliedUsageThresholds] diff --git a/tests/fixtures/invoice.json b/tests/fixtures/invoice.json index 9db506a..68ea6af 100644 --- a/tests/fixtures/invoice.json +++ b/tests/fixtures/invoice.json @@ -28,6 +28,18 @@ "display_in_invoice": true } ], + "applied_usage_thresholds": [ + { + "lifetime_usage_amount_cents": 120, + "created_at": "2022-04-29T08:59:51Z", + "usage_threshold": { + "id": "7b6a2799-6db5-4f82-8362-1483b65f8f90", + "threshold_display_name": "Threshold 1", + "amount_cents": 100, + "recurring": false + } + } + ], "applied_taxes": [ { "lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",