From 26cdaef57834d1b1f49230bf6b93570a6d325b15 Mon Sep 17 00:00:00 2001 From: LovroColic Date: Tue, 25 Jun 2024 11:18:18 +0200 Subject: [PATCH] feat (integration-customers): update integration customer definition (#248) --- lago_python_client/models/__init__.py | 3 ++- lago_python_client/models/customer.py | 18 +++++++++++++++++- tests/fixtures/customer.json | 3 ++- tests/test_customer_client.py | 2 +- 4 files changed, 22 insertions(+), 4 deletions(-) diff --git a/lago_python_client/models/__init__.py b/lago_python_client/models/__init__.py index 074525d2..f865b846 100644 --- a/lago_python_client/models/__init__.py +++ b/lago_python_client/models/__init__.py @@ -10,7 +10,8 @@ from .event import Event, BatchEvent from .fee import Fee from .customer import Customer, CustomerBillingConfiguration, Metadata, MetadataList,\ - MetadataResponse, MetadataResponseList, IntegrationCustomer, IntegrationCustomersList + MetadataResponse, MetadataResponseList, IntegrationCustomer, IntegrationCustomerResponse,\ + IntegrationCustomersResponseList, IntegrationCustomersList from .invoice import InvoicePaymentStatusChange, Invoice, InvoiceMetadata, InvoiceMetadataList,\ OneOffInvoice, InvoiceFeesList, InvoiceFee from .invoice_item import InvoiceItemResponse diff --git a/lago_python_client/models/customer.py b/lago_python_client/models/customer.py index 2de88bc7..a6c24e9f 100644 --- a/lago_python_client/models/customer.py +++ b/lago_python_client/models/customer.py @@ -19,15 +19,31 @@ class CustomerBillingConfiguration(BaseModel): class IntegrationCustomer(BaseModel): + id: Optional[str] external_customer_id: Optional[str] integration_type: Optional[str] integration_code: Optional[str] subsidiary_id: Optional[str] sync_with_provider: Optional[bool] + +class IntegrationCustomerResponse(BaseModel): + lago_id: Optional[str] + external_customer_id: Optional[str] + type: Optional[str] + integration_code: Optional[str] + subsidiary_id: Optional[str] + sync_with_provider: Optional[bool] + + class IntegrationCustomersList(BaseModel): __root__: List[IntegrationCustomer] + +class IntegrationCustomersResponseList(BaseModel): + __root__: List[IntegrationCustomerResponse] + + class Metadata(BaseModel): id: Optional[str] key: Optional[str] @@ -100,5 +116,5 @@ class CustomerResponse(BaseResponseModel): zipcode: Optional[str] metadata: Optional[MetadataResponseList] billing_configuration: Optional[CustomerBillingConfiguration] - integration_customers: Optional[IntegrationCustomersList] + integration_customers: Optional[IntegrationCustomersResponseList] taxes: Optional[TaxesResponse] diff --git a/tests/fixtures/customer.json b/tests/fixtures/customer.json index 208df568..60b9c7c9 100644 --- a/tests/fixtures/customer.json +++ b/tests/fixtures/customer.json @@ -33,8 +33,9 @@ }, "integration_customers": [ { + "lago_id": "123456789", "external_customer_id": "test-12345", - "integration_type": "netsuite", + "type": "netsuite", "integration_code": "test", "subsidiary_id": "2", "sync_with_provider": true diff --git a/tests/test_customer_client.py b/tests/test_customer_client.py index 9c75beb6..4eb69447 100644 --- a/tests/test_customer_client.py +++ b/tests/test_customer_client.py @@ -72,7 +72,7 @@ def test_valid_create_customers_request(httpx_mock: HTTPXMock): assert response.billing_configuration.sync_with_provider == True assert response.billing_configuration.document_locale == "fr" assert response.integration_customers.__root__[0].external_customer_id == 'test-12345' - assert response.integration_customers.__root__[0].integration_type == "netsuite" + assert response.integration_customers.__root__[0].type == "netsuite" assert response.metadata.__root__[0].lago_id == '12345' assert response.metadata.__root__[0].key == 'key' assert response.metadata.__root__[0].value == 'value'