Skip to content

Commit

Permalink
feat (integration-customers): update integration customer definition (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
lovrocolic authored Jun 25, 2024
1 parent b98186f commit 26cdaef
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 4 deletions.
3 changes: 2 additions & 1 deletion lago_python_client/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 17 additions & 1 deletion lago_python_client/models/customer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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]
3 changes: 2 additions & 1 deletion tests/fixtures/customer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/test_customer_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down

0 comments on commit 26cdaef

Please sign in to comment.