From a064ee0f16109d615c6aa68f509be136009cca3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Semp=C3=A9?= Date: Thu, 2 Nov 2023 11:50:36 +0100 Subject: [PATCH] feat(unit-price): Add precise_unit_amount to Fee object --- lago_python_client/models/fee.py | 3 ++- tests/fixtures/one_off_invoice.json | 1 + tests/test_invoice_client.py | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lago_python_client/models/fee.py b/lago_python_client/models/fee.py index 31c5d884..6f6757c8 100644 --- a/lago_python_client/models/fee.py +++ b/lago_python_client/models/fee.py @@ -37,7 +37,8 @@ class FeeResponse(BaseResponseModel): taxes_amount_cents: Optional[int] taxes_rate: Optional[float] total_amount_cents: Optional[int] - unit_amount_cents: Optional[int] + unit_amount_cents: Optional[int] # deprecated + precise_unit_amount: Optional[float] total_amount_currency: Optional[str] units: Optional[float] events_count: Optional[int] diff --git a/tests/fixtures/one_off_invoice.json b/tests/fixtures/one_off_invoice.json index 578f43d7..cb143a2f 100644 --- a/tests/fixtures/one_off_invoice.json +++ b/tests/fixtures/one_off_invoice.json @@ -102,6 +102,7 @@ "total_amount_cents": 120, "total_amount_currency": "EUR", "units": 12.6, + "precise_unit_amount": 9.52, "events_count": 4 } ] diff --git a/tests/test_invoice_client.py b/tests/test_invoice_client.py index f541cefc..a1a1f902 100644 --- a/tests/test_invoice_client.py +++ b/tests/test_invoice_client.py @@ -53,6 +53,7 @@ def test_valid_create_invoice_request(httpx_mock: HTTPXMock): assert response.lago_id == '5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba' assert response.invoice_type == 'one_off' assert response.fees.__root__[0].invoice_display_name == 'fee_invoice_display_name' + assert response.fees.__root__[0].precise_unit_amount == 9.52 assert response.fees.__root__[0].item.invoice_display_name == 'one_off_invoice_display_name'