Skip to content

Commit a2a9df8

Browse files
author
Anna Velentsevich
authored
add billing_entities support (#306)
1 parent 15bd85a commit a2a9df8

File tree

8 files changed

+17
-3
lines changed

8 files changed

+17
-3
lines changed

lago_python_client/models/customer.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ class Customer(BaseModel):
120120
tax_codes: Optional[List[str]]
121121
skip_invoice_custom_sections: Optional[bool]
122122
invoice_custom_section_codes: Optional[List[str]]
123+
billing_entity_code: Optional[str]
123124

124125

125126
class CustomerResponse(BaseResponseModel):
@@ -156,3 +157,4 @@ class CustomerResponse(BaseResponseModel):
156157
taxes: Optional[TaxesResponse]
157158
skip_invoice_custom_sections: Optional[bool]
158159
applicable_invoice_custom_sections: Optional[InvoiceCustomSectionsResponseList]
160+
billing_entity_code: Optional[str]

lago_python_client/models/fee.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ class FeeResponse(BaseResponseModel):
5959
from_date: Optional[str]
6060
to_date: Optional[str]
6161
amount_details: Optional[Dict[str, Any]]
62+
billing_entity_code: Optional[str]
6263

6364
item: Optional[InvoiceItemResponse]
6465
applied_taxes: Optional[FeeAppliedTaxes]

lago_python_client/models/invoice.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,3 +139,4 @@ class InvoiceResponse(BaseResponseModel):
139139
applied_invoice_custom_sections: Optional[InvoiceAppliedInvoiceCustomSections]
140140
applied_usage_thresholds: Optional[InvoiceAppliedUsageThresholds]
141141
error_details: Optional[ErrorDetailsResponse]
142+
billing_entity_code: Optional[str]

lago_python_client/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
LAGO_VERSION = "1.22.0"
1+
LAGO_VERSION = "1.23.0"

tests/fixtures/customer.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"customer": {
33
"lago_id": "99a6094e-199b-4101-896a-54e927ce7bd7",
44
"external_id": "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba",
5+
"billing_entity_code": "test-company",
56
"address_line1": "5230 Penfield Ave",
67
"address_line2": null,
78
"city": "Woodland Hills",
@@ -33,7 +34,10 @@
3334
"provider_customer_id": "cus_12345",
3435
"sync_with_provider": true,
3536
"document_locale": "fr",
36-
"provider_payment_methods": ["card", "sepa_debit"]
37+
"provider_payment_methods": [
38+
"card",
39+
"sepa_debit"
40+
]
3741
},
3842
"shipping_address": {
3943
"city": "Paris",

tests/fixtures/fee.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"fee": {
33
"lago_id": "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba",
4+
"billing_entity_code": "test-company",
45
"lago_charge_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
56
"lago_charge_filter_id": "1a2d9c8d-5875-4688-9854-5ccfd414bc5e",
67
"lago_invoice_id": "1a2d9c8d-5875-4688-9854-5ccfd414bc5e",

tests/fixtures/invoice.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"invoice": {
33
"lago_id": "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba",
4+
"billing_entity_code": "test-company",
45
"sequential_id": 15,
56
"number": "LAG-1234-001-002",
67
"issuing_date": "2022-06-02",
@@ -139,7 +140,9 @@
139140
"name": "User Seats",
140141
"invoice_display_name": "charge_invoice_display_name",
141142
"filters": {
142-
"region": ["us-east-1"]
143+
"region": [
144+
"us-east-1"
145+
]
143146
}
144147
},
145148
"amount_cents": 100,

tests/test_customer_client.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ def create_customer():
3030

3131
return Customer(
3232
external_id="5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba",
33+
billing_entity_code="test-company",
3334
name="Gavin Belson",
3435
currency="EUR",
3536
tax_identification_number="EU123456789",
@@ -74,6 +75,7 @@ def test_valid_create_customers_request(httpx_mock: HTTPXMock):
7475
response = client.customers.create(create_customer())
7576

7677
assert response.external_id == "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
78+
assert response.billing_entity_code == "test-company"
7779
assert response.name == "Gavin Belson"
7880
assert response.email == "[email protected]"
7981
assert response.currency == "EUR"

0 commit comments

Comments
 (0)