Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lago_python_client/invoices/clients.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ def preview(self, input_object: InvoicePreview) -> InvoiceResponse:
origin=self.base_url,
path_parts=(self.API_RESOURCE, "preview"),
),
content=to_json(input_object.dict()),
content=to_json(input_object.dict(exclude_none=True)),
headers=make_headers(api_key=self.api_key),
)

Expand Down
1 change: 1 addition & 0 deletions lago_python_client/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@
PaymentReceiptsResponse as PaymentReceiptsResponse,
)
from .payment_request import PaymentRequest as PaymentRequest
from .payment_term import PaymentTerm as PaymentTerm
from .payment_method import PaymentMethod as PaymentMethod, PaymentMethodResponse as PaymentMethodResponse
from .plan import Plan as Plan
from .quote import (
Expand Down
4 changes: 4 additions & 0 deletions lago_python_client/models/billing_entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

from ..base_model import BaseModel, BaseResponseModel
from .invoice_custom_section import InvoiceCustomSectionsResponseList
from .payment_term import PaymentTerm
from .tax import TaxesResponse


Expand Down Expand Up @@ -31,6 +32,7 @@ class BillingEntity(BaseModel):
document_number_prefix: Optional[str]
finalize_zero_amount_invoice: Optional[bool]
net_payment_term: Optional[int]
payment_term: Optional[PaymentTerm]
eu_tax_management: Optional[bool]
logo_url: Optional[str]
legal_name: Optional[str]
Expand All @@ -57,6 +59,7 @@ class BillingEntityUpdate(BaseModel):
document_number_prefix: Optional[str]
finalize_zero_amount_invoice: Optional[bool]
net_payment_term: Optional[int]
payment_term: Optional[PaymentTerm]
eu_tax_management: Optional[bool]
logo_url: Optional[str]
legal_name: Optional[str]
Expand Down Expand Up @@ -87,6 +90,7 @@ class BillingEntityResponse(BaseResponseModel):
document_number_prefix: Optional[str]
finalize_zero_amount_invoice: Optional[bool]
net_payment_term: Optional[int]
payment_term: Optional[PaymentTerm]
eu_tax_management: Optional[bool]
logo_url: Optional[str]
legal_name: Optional[str]
Expand Down
3 changes: 3 additions & 0 deletions lago_python_client/models/customer.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from ..base_model import BaseResponseModel
from .error_detail import ErrorDetailsResponse
from .invoice_custom_section import InvoiceCustomSectionsResponseList
from .payment_term import PaymentTerm
from .tax import TaxesResponse


Expand Down Expand Up @@ -94,6 +95,7 @@ class Customer(BaseModel):
legal_name: Optional[str]
legal_number: Optional[str]
net_payment_term: Optional[int]
payment_term: Optional[PaymentTerm]
external_salesforce_id: Optional[str]
tax_identification_number: Optional[str]
logo_url: Optional[str]
Expand Down Expand Up @@ -134,6 +136,7 @@ class CustomerResponse(BaseResponseModel):
legal_name: Optional[str]
legal_number: Optional[str]
net_payment_term: Optional[int]
payment_term: Optional[PaymentTerm]
external_salesforce_id: Optional[str]
tax_identification_number: Optional[str]
logo_url: Optional[str]
Expand Down
6 changes: 5 additions & 1 deletion lago_python_client/models/invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from .fee import FeesResponse
from .invoice_custom_section import InvoiceCustomSectionInput
from .payment_method import PaymentMethod
from .payment_term import PaymentTerm
from .subscription import Subscriptions, SubscriptionsResponse
from .usage_threshold import UsageThreshold

Expand Down Expand Up @@ -56,6 +57,7 @@ class OneOffInvoice(BaseModel):
fees: Optional[InvoiceFeesList]
error_details: Optional[ErrorDetailsResponse]
payment_method: Optional[PaymentMethod]
payment_term: Optional[PaymentTerm]
invoice_custom_section: Optional[InvoiceCustomSectionInput]
billing_entity_code: Optional[str]
purchase_order_number: Optional[str]
Expand All @@ -69,6 +71,7 @@ class InvoicePreview(BaseModel):
customer: Optional[Customer]
subscriptions: Optional[Subscriptions]
billing_entity_code: Optional[str]
payment_term: Optional[PaymentTerm]


class InvoiceAppliedTax(BaseResponseModel):
Expand Down Expand Up @@ -121,7 +124,8 @@ class InvoiceResponse(BaseResponseModel):
payment_dispute_lost_at: Optional[str]
payment_due_date: Optional[str]
payment_overdue: bool
net_payment_term: int
net_payment_term: Optional[int]
payment_term: Optional[PaymentTerm]
invoice_type: str
version_number: int
status: str
Expand Down
2 changes: 2 additions & 0 deletions lago_python_client/models/organization.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from lago_python_client.base_model import BaseModel

from ..base_model import BaseResponseModel
from .payment_term import PaymentTerm


class OrganizationBillingConfiguration(BaseModel):
Expand Down Expand Up @@ -51,6 +52,7 @@ class OrganizationResponse(BaseResponseModel):
legal_name: Optional[str]
legal_number: Optional[str]
net_payment_term: Optional[int]
payment_term: Optional[PaymentTerm]
document_numbering: Optional[str]
document_number_prefix: Optional[str]
tax_identification_number: Optional[str]
Expand Down
4 changes: 3 additions & 1 deletion lago_python_client/models/payment_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from ..base_model import BaseModel, BaseResponseModel
from .customer import CustomerResponse
from .payment_term import PaymentTerm


class PaymentRequest(BaseModel):
Expand All @@ -18,7 +19,8 @@ class PaymentRequestInvoiceResponse(BaseResponseModel):
payment_dispute_lost_at: Optional[str]
payment_due_date: Optional[str]
payment_overdue: bool
net_payment_term: int
net_payment_term: Optional[int]
payment_term: Optional[PaymentTerm]
invoice_type: str
version_number: int
status: str
Expand Down
10 changes: 10 additions & 0 deletions lago_python_client/models/payment_term.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from typing import Optional

from lago_python_client.base_model import BaseModel


class PaymentTerm(BaseModel):
term_type: str
days: Optional[int]
day_of_month: Optional[int]
month_offset: Optional[int]
3 changes: 3 additions & 0 deletions lago_python_client/models/subscription.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from .entitlement import SubscriptionEntitlementsResponse
from .invoice_custom_section import AppliedInvoiceCustomSections, InvoiceCustomSectionInput
from .payment_method import PaymentMethod
from .payment_term import PaymentTerm
from .plan import PlanOverrides
from .usage_threshold import ApplicableUsageThresholdsResponse, UsageThresholdsOverrides

Expand All @@ -25,6 +26,7 @@ class Subscription(BaseModel):
ending_at: Optional[str]
plan_overrides: Optional[PlanOverrides]
payment_method: Optional[PaymentMethod]
payment_term: Optional[PaymentTerm]
invoice_custom_section: Optional[InvoiceCustomSectionInput]
consolidate_invoice: Optional[bool]
billing_entity_code: Optional[str]
Expand Down Expand Up @@ -76,6 +78,7 @@ class SubscriptionResponse(BaseResponseModel):
on_termination_credit_note: Optional[str]
on_termination_invoice: Optional[str]
payment_method: Optional[PaymentMethod]
payment_term: Optional[PaymentTerm]
applied_invoice_custom_sections: Optional[AppliedInvoiceCustomSections]
consolidate_invoice: Optional[bool]
billing_entity_code: Optional[str]
Expand Down
3 changes: 3 additions & 0 deletions lago_python_client/models/wallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from ..base_model import BaseResponseModel
from .invoice_custom_section import AppliedInvoiceCustomSections, InvoiceCustomSectionInput
from .payment_method import PaymentMethod
from .payment_term import PaymentTerm


class RecurringTransactionRule(BaseModel):
Expand Down Expand Up @@ -83,6 +84,7 @@ class Wallet(BaseModel):
ignore_paid_top_up_limits_on_creation: Optional[bool]
metadata: Optional[Dict[str, Optional[str]]]
payment_method: Optional[PaymentMethod]
payment_term: Optional[PaymentTerm]
invoice_custom_section: Optional[InvoiceCustomSectionInput]
billing_entity_code: Optional[str]
purchase_order_number: Optional[str]
Expand Down Expand Up @@ -117,6 +119,7 @@ class WalletResponse(BaseResponseModel):
paid_top_up_min_amount_cents: Optional[int]
metadata: Optional[Dict[str, Optional[str]]]
payment_method: Optional[PaymentMethod]
payment_term: Optional[PaymentTerm]
applied_invoice_custom_sections: Optional[AppliedInvoiceCustomSections]
billing_entity_code: Optional[str]
purchase_order_number: Optional[str]
1 change: 1 addition & 0 deletions tests/fixtures/billing_entity.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"document_number_prefix": "TEST-",
"finalize_zero_amount_invoice": true,
"net_payment_term": 30,
"payment_term": {"term_type": "net", "days": 30},
"eu_tax_management": false,
"logo_url": "https://example.com/logo.png",
"legal_name": "Test Company Legal Name",
Expand Down
2 changes: 2 additions & 0 deletions tests/fixtures/billing_entity_index.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"document_number_prefix": "TEST1-",
"finalize_zero_amount_invoice": true,
"net_payment_term": 30,
"payment_term": {"term_type": "net", "days": 30},
"eu_tax_management": false,
"logo_url": "https://example.com/logo.png",
"legal_name": "Test Company 1 Legal Name",
Expand Down Expand Up @@ -55,6 +56,7 @@
"document_number_prefix": "TEST2-",
"finalize_zero_amount_invoice": true,
"net_payment_term": 30,
"payment_term": {"term_type": "net", "days": 30},
"eu_tax_management": true,
"logo_url": "https://example.com/logo_2.png",
"legal_name": "Test Company 2 Legal Name",
Expand Down
1 change: 1 addition & 0 deletions tests/fixtures/customer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"timezone": "Europe/Paris",
"applicable_timezone": "Europe/Paris",
"net_payment_term": null,
"payment_term": null,
"external_salesforce_id": "sf_001",
"finalize_zero_amount_invoice": "inherit",
"billing_configuration": {
Expand Down
1 change: 1 addition & 0 deletions tests/fixtures/invoice.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"payment_due_date": "2022-06-02",
"payment_overdue": false,
"net_payment_term": 0,
"payment_term": {"term_type": "due_on_receipt"},
"invoice_type": "type1",
"version_number": 2,
"status": "finalized",
Expand Down
2 changes: 2 additions & 0 deletions tests/fixtures/invoice_index.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"payment_due_date": "2022-06-02",
"payment_overdue": false,
"net_payment_term": 0,
"payment_term": {"term_type": "due_on_receipt"},
"invoice_type": "subscription",
"version_number": 2,
"status": "finalized",
Expand Down Expand Up @@ -53,6 +54,7 @@
"payment_due_date": "2022-06-02",
"payment_overdue": false,
"net_payment_term": 0,
"payment_term": {"term_type": "due_on_receipt"},
"invoice_type": "add_on",
"version_number": 2,
"status": "finalized",
Expand Down
1 change: 1 addition & 0 deletions tests/fixtures/one_off_invoice.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"payment_due_date": "2022-06-02",
"payment_overdue": false,
"net_payment_term": 0,
"payment_term": {"term_type": "due_on_receipt"},
"invoice_type": "one_off",
"version_number": 2,
"status": "finalized",
Expand Down
1 change: 1 addition & 0 deletions tests/fixtures/organization.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"document_numbering": "per_customer",
"document_number_prefix": "ORG-1234",
"net_payment_term": 0,
"payment_term": {"term_type": "due_on_receipt"},
"tax_identification_number": "EU123456789",
"timezone": "America/New_York",
"finalize_zero_amount_invoice": true,
Expand Down
3 changes: 3 additions & 0 deletions tests/fixtures/payment_request.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"timezone": "Europe/Paris",
"applicable_timezone": "Europe/Paris",
"net_payment_term": 30,
"payment_term": {"term_type": "net", "days": 30},
"tax_identification_number": "EU123456789",
"sequential_id": 101,
"slug": "customer_101_slug",
Expand Down Expand Up @@ -74,6 +75,7 @@
"payment_status": "pending",
"currency": "EUR",
"net_payment_term": 0,
"payment_term": {"term_type": "due_on_receipt"},
"fees_amount_cents": 10000,
"taxes_amount_cents": 2000,
"coupons_amount_cents": 0,
Expand Down Expand Up @@ -101,6 +103,7 @@
"payment_status": "failed",
"currency": "EUR",
"net_payment_term": 0,
"payment_term": {"term_type": "due_on_receipt"},
"fees_amount_cents": 7000,
"taxes_amount_cents": 955,
"coupons_amount_cents": 0,
Expand Down
1 change: 1 addition & 0 deletions tests/fixtures/payment_request_index.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"payment_status": "pending",
"currency": "EUR",
"net_payment_term": 0,
"payment_term": {"term_type": "due_on_receipt"},
"fees_amount_cents": 100,
"taxes_amount_cents": 20,
"coupons_amount_cents": 0,
Expand Down
1 change: 1 addition & 0 deletions tests/fixtures/pending_subscription.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"lago_id": "b7ab2926-1de8-4428-9bcd-779314ac129b",
"lago_customer_id": "99a6094e-199b-4101-896a-54e927ce7bd7",
"external_customer_id": "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba",
"payment_term": null,
"canceled_at": "2022-04-29T08:59:51Z",
"created_at": "2022-04-29T08:59:51Z",
"plan_code": "eartha lynch",
Expand Down
1 change: 1 addition & 0 deletions tests/fixtures/subscription.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"lago_id": "b7ab2926-1de8-4428-9bcd-779314ac129b",
"lago_customer_id": "99a6094e-199b-4101-896a-54e927ce7bd7",
"external_customer_id": "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba",
"payment_term": {"term_type": "day_of_month", "day_of_month": 15, "month_offset": 1},
"canceled_at": "2022-04-29T08:59:51Z",
"created_at": "2022-04-29T08:59:51Z",
"plan_code": "eartha lynch",
Expand Down
1 change: 1 addition & 0 deletions tests/fixtures/subscription_index.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"lago_id": "b7ab2926-1de8-4428-9bcd-779314ac129b",
"lago_customer_id": "99a6094e-199b-4101-896a-54e927ce7bd7",
"external_customer_id": "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba",
"payment_term": null,
"canceled_at": "2022-04-29T08:59:51Z",
"created_at": "2022-04-29T08:59:51Z",
"plan_code": "eartha lynch",
Expand Down
1 change: 1 addition & 0 deletions tests/fixtures/voided_invoice.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"payment_due_date": "2022-06-02",
"payment_overdue": false,
"net_payment_term": 0,
"payment_term": {"term_type": "due_on_receipt"},
"invoice_type": "type1",
"version_number": 2,
"status": "voided",
Expand Down
1 change: 1 addition & 0 deletions tests/fixtures/wallet.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"lago_id": "b7ab2926-1de8-4428-9bcd-779314ac129b",
"lago_customer_id": "12345",
"external_customer_id": "external-12345",
"payment_term": {"term_type": "net_end_of_month", "days": 10},
"status": "active",
"currency": "EUR",
"name": "name",
Expand Down
2 changes: 2 additions & 0 deletions tests/fixtures/wallet_index.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"lago_id": "b7ab2926-1de8-4428-9bcd-779314ac129b",
"lago_customer_id": "12345",
"external_customer_id": "external-12345",
"payment_term": null,
"status": "active",
"currency": "EUR",
"name": "name1",
Expand Down Expand Up @@ -43,6 +44,7 @@
"lago_id": "b7ab2926-1de8-4428-9bcd-779314ac1111",
"lago_customer_id": "12345",
"external_customer_id": "external-54321",
"payment_term": null,
"status": "active",
"currency": "EUR",
"name": "name2",
Expand Down
Loading
Loading