From c11162025d5d92349be7b7ce57820b13b04eeb25 Mon Sep 17 00:00:00 2001 From: Mario Diniz Date: Mon, 22 Jun 2026 10:26:46 -0300 Subject: [PATCH] feat(multi-entity): expose billing_entity_code on subscription, wallet, invoice, and credit-note models ## Context The Lago API lets callers pin a subscription, wallet, or one-off invoice to a specific billing entity within a multi-entity organization, and returns the resolved entity on every resource response (subscription, wallet, invoice, credit note). The Python client's models did not carry the field, so callers couldn't set it on create/update or read it back from the parsed responses. ## Description Adds `billing_entity_code: Optional[str]` to the `Subscription` and `Wallet` request models (POST + PUT) and to their response models, to the `OneOffInvoice` and `InvoicePreview` request models for `POST /invoices` and `POST /invoices/preview`, and to `CreditNoteResponse` so the field is parsed from credit-note payloads. No changes are needed for the list endpoints: the `find_all` mixin already takes a generic `options: QueryPairs` dict that natively carries `billing_entity_codes[]` as a list value. --- lago_python_client/models/credit_note.py | 1 + lago_python_client/models/invoice.py | 2 ++ lago_python_client/models/subscription.py | 2 ++ lago_python_client/models/wallet.py | 2 ++ 4 files changed, 7 insertions(+) diff --git a/lago_python_client/models/credit_note.py b/lago_python_client/models/credit_note.py index bb4e6b2..6d630c1 100644 --- a/lago_python_client/models/credit_note.py +++ b/lago_python_client/models/credit_note.py @@ -39,6 +39,7 @@ class CreditNoteAppliedTaxes(BaseResponseModel): class CreditNoteResponse(BaseResponseModel): lago_id: Optional[str] sequential_id: Optional[int] + billing_entity_code: Optional[str] number: Optional[str] lago_invoice_id: Optional[str] invoice_number: Optional[str] diff --git a/lago_python_client/models/invoice.py b/lago_python_client/models/invoice.py index 98463bb..78cc040 100644 --- a/lago_python_client/models/invoice.py +++ b/lago_python_client/models/invoice.py @@ -57,6 +57,7 @@ class OneOffInvoice(BaseModel): error_details: Optional[ErrorDetailsResponse] payment_method: Optional[PaymentMethod] invoice_custom_section: Optional[InvoiceCustomSectionInput] + billing_entity_code: Optional[str] class InvoicePreview(BaseModel): @@ -66,6 +67,7 @@ class InvoicePreview(BaseModel): coupons: Optional[CouponsList] customer: Optional[Customer] subscriptions: Optional[Subscriptions] + billing_entity_code: Optional[str] class InvoiceAppliedTax(BaseResponseModel): diff --git a/lago_python_client/models/subscription.py b/lago_python_client/models/subscription.py index 408ec60..1e2fdad 100644 --- a/lago_python_client/models/subscription.py +++ b/lago_python_client/models/subscription.py @@ -20,6 +20,7 @@ class Subscription(BaseModel): payment_method: Optional[PaymentMethod] invoice_custom_section: Optional[InvoiceCustomSectionInput] consolidate_invoice: Optional[bool] + billing_entity_code: Optional[str] class Subscriptions(BaseModel): @@ -57,6 +58,7 @@ class SubscriptionResponse(BaseResponseModel): payment_method: Optional[PaymentMethod] applied_invoice_custom_sections: Optional[AppliedInvoiceCustomSections] consolidate_invoice: Optional[bool] + billing_entity_code: Optional[str] class SubscriptionsResponse(BaseResponseModel): diff --git a/lago_python_client/models/wallet.py b/lago_python_client/models/wallet.py index d01ea24..f5480f0 100644 --- a/lago_python_client/models/wallet.py +++ b/lago_python_client/models/wallet.py @@ -79,6 +79,7 @@ class Wallet(BaseModel): metadata: Optional[Dict[str, Optional[str]]] payment_method: Optional[PaymentMethod] invoice_custom_section: Optional[InvoiceCustomSectionInput] + billing_entity_code: Optional[str] class WalletResponse(BaseResponseModel): @@ -111,3 +112,4 @@ class WalletResponse(BaseResponseModel): metadata: Optional[Dict[str, Optional[str]]] payment_method: Optional[PaymentMethod] applied_invoice_custom_sections: Optional[AppliedInvoiceCustomSections] + billing_entity_code: Optional[str]