From 89536bcb83d975cbee1389d107abcf0577f5fa1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Richard=20Kub=C3=AD=C4=8Dek?= Date: Mon, 3 Mar 2025 20:44:33 +0100 Subject: [PATCH] invoice: update usages in docs --- superfaktura/invoice.py | 80 ++++++++++++++++++++--------------------- 1 file changed, 39 insertions(+), 41 deletions(-) diff --git a/superfaktura/invoice.py b/superfaktura/invoice.py index 56d4c79..da1caea 100644 --- a/superfaktura/invoice.py +++ b/superfaktura/invoice.py @@ -16,38 +16,35 @@ Functions: - (none) Usage: - import superfaktura.invoice - - # Create an instance of Invoice - invoice = superfaktura.invoice.Invoice() - - # Create an invoice - invoice.add( - invoice=superfaktura.invoice.InvoiceModel( - type=superfaktura.invoice.InvoiceType.PROFORMA, - name="Invoice 3", - due=superfaktura.invoice.Date("2025-02-01"), - invoice_currency=superfaktura.invoice.Currencies.CZK, + >>> import superfaktura.invoice + >>> # Create an instance of Invoice + >>> invoice = superfaktura.invoice.Invoice() + >>> # Create an invoice + >>> invoice.add( + invoice_model=InvoiceModel( + type=InvoiceType.INVOICE, + name="My First Invoice", + due=Date("2025-04-01"), + invoice_currency=Currencies.EUR, header_comment="We invoice you for services", bank_accounts=[bank.default().as_dict()], ), items=[ - superfaktura.invoice.InvoiceItem(name="Services", unit_price=100, quantity=1, - unit="ks", tax=21), - superfaktura.invoice.InvoiceItem(name="SIM card", unit_price=50, quantity=1, - tax=21, unit="ks"), - superfaktura.invoice.InvoiceItem( - name="SIM card 2", unit_price=75, quantity=1, tax=21, unit="ks" + InvoiceItem( + name="Website Development", unit_price=1000.0, quantity=1, tax=20 + ), + InvoiceItem( + name="Hosting Service (1 year)", unit_price=500.0, quantity=1, tax=20 ), ], - contact=superfaktura.client_contacts.ClientContactModel( - name="Richard Kubíček", - email="kubicekr@eledio.com", - phone="+420 123 456 789", - address="Jaroslava Foglara 861/1", - ico="123", + contact=ClientContactModel( + name="John Doe", + email="john.doe@examle.com", + phone="+1 555-1234", + address="123 Main Street, New York", + ico="987654321", update=True, - country_id=57, + country_id=225, ), ) """ @@ -217,31 +214,32 @@ class Invoice(SuperFakturaAPI): - update: Updates an existing invoice. Usage: - invoice = Invoice() - invoice.add( - invoice=InvoiceModel( - type=InvoiceType.PROFORMA, - name="Invoice 3", - due=Date("2025-02-01"), - invoice_currency=Currencies.CZK, + >>> invoice = Invoice() + >>> invoice.add( + invoice_model=InvoiceModel( + type=InvoiceType.INVOICE, + name="My First Invoice", + due=Date("2025-04-01"), + invoice_currency=Currencies.EUR, header_comment="We invoice you for services", bank_accounts=[bank.default().as_dict()], ), items=[ - InvoiceItem(name="Services", unit_price=100, quantity=1, unit="ks", tax=21), - InvoiceItem(name="SIM card", unit_price=50, quantity=1, tax=21, unit="ks"), InvoiceItem( - name="SIM card 2", unit_price=75, quantity=1, tax=21, unit="ks" + name="Website Development", unit_price=1000.0, quantity=1, tax=20 + ), + InvoiceItem( + name="Hosting Service (1 year)", unit_price=500.0, quantity=1, tax=20 ), ], contact=ClientContactModel( - name="Richard Kubíček", - email="kubicekr@eledio.com", - phone="+420 123 456 789", - address="Jaroslava Foglara 861/1", - ico="123", + name="John Doe", + email="john.doe@examle.com", + phone="+1 555-1234", + address="123 Main Street, New York", + ico="987654321", update=True, - country_id=57, + country_id=225, ), ) """