class CreateTest(unittest.TestCase): def setUp(self): self.client = SFClient(LOGIN, APIKEY) def testCreateInvoice(self): client_params = { 'name': 'Janko Hrasko', 'ico': '12345678', 'dic': '12345678', 'ic_dph': 'SK12345678', 'email': '*****@*****.**', 'address': 'adresa', 'city': 'mesto', 'zip': 'psc', 'phone': 'telefon', } invoice_params = { 'name': 'nazov faktury', 'variable': '123456', 'constant': '0308', 'specific': '2013', 'already_paid': True, 'invoice_no_formatted': '2012001', 'created': '2013-05-28', 'delivery': '2013-05-28', 'due': '2013-06-28', 'comment': 'komentar', } item_params = { 'name': 'Superfaktura.sk', 'description': 'Clenstvo', 'quantity': 1, 'unit': 'ks', 'unit_price': 40.83, 'tax': 20 } client = SFInvoiceClient(client_params) item = SFInvoiceItem(item_params) invoice = SFInvoice(client, invoice_params, [item]) self.client.create_invoice(invoice)
class ListTest(unittest.TestCase): def setUp(self): self.client = SFClient(LOGIN, APIKEY) def testListAllInvoices(self): self.assertGreater(len(self.client.list_invoices()), 0) def testListClientsInvoices(self): self.assertGreater(len(self.client.list_invoices_by_client(90827)), 0) def testListDueInvoices(self): self.assertGreater(len(self.client.list_due_invoices()), 0) def testListUnpaidInvoices(self): self.assertGreater(len(self.client.list_unpaid_invoices()), 0) def testListPartiallyPaidInvoices(self): self.assertGreater(len(self.client.list_partially_paid_invoices()), 0) def testListPaidInvoices(self): self.assertGreater(len(self.client.list_paid_invoices()), 0)
def setUp(self): self.client = SFClient(LOGIN, APIKEY)
# -*- coding: utf-8 -*- from pysuperfaktura.SFClient import SFClient from pysuperfaktura.invoice import SFInvoiceClient, SFInvoice, SFInvoiceItem from pysuperfaktura.expense import SFExpenseClient, SFExpense, SFExpenseItem import datetime api_client = SFClient('<email>', '<api_key>') """ filtr: bezna, minuly mesic (hodnota 5) """ invfilter = {'created': '5', 'type': 'regular', 'per_page': '1000'} expfilter = {'created': '5', 'per_page': '1000'} invs = api_client.list_invoices(invfilter) exps = api_client.list_expenses(expfilter) total_amount = 0 total_vat = 0 kha5_amount = 0 kha5_vat = 0 kha4 = [] if (invs is not None): for inv in invs: item = inv.params.get("Invoice") item_name = item.get("name") item_invoiceno = item.get("invoice_no_formatted") item_amount = round(float(item.get("amount")), 2) item_vat = round(float(item.get("vat")), 2) item_dic = inv.params.get("Client").get("ic_dph") if (item_dic[:2] != "CZ"): print(u'Invalid DIC ({0})!'.format(item_dic)) item_delivery = item.get("delivery").split()[0] dictitem = {