Skip to content

Commit b90c05b

Browse files
author
Oluwafemi Adenuga
authored
Bug Fixes and Improvements
Changes * Fetch contacts with query params * Set defaults for optional fields in Invoice client
2 parents 2424c90 + 99cbaa2 commit b90c05b

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

elorus/client.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,8 @@ def __init__(self, client: Client):
125125

126126
class Contacts(SubClient):
127127

128-
def list(self):
129-
return self.client._handle_request("GET", "contacts/")
128+
def list(self, **params):
129+
return self.client._handle_request("GET", "contacts/", params=params)
130130

131131
def create(self, contact: Contact):
132132
payload = asdict(contact)
@@ -147,8 +147,8 @@ def delete(self, contact_id: str):
147147

148148
class Invoices(SubClient):
149149

150-
def list(self):
151-
return self.client._handle_request("GET", "invoices/")
150+
def list(self, **params):
151+
return self.client._handle_request("GET", "invoices/", params=params)
152152

153153
def create(self, invoice: Invoice):
154154
payload = invoice.clean_dict()

elorus/models.py

+7-6
Original file line numberDiff line numberDiff line change
@@ -76,15 +76,15 @@ class BillingAddress(BaseDataClass):
7676

7777
@dataclass
7878
class Item(BaseDataClass):
79-
product: str
8079
description: str
81-
quantity: str
82-
unit_measure: int
83-
unit_value: str
84-
unit_discount: str
85-
unit_total: str
8680
mydata_classification_category: str
8781
mydata_classification_type: str
82+
unit_value: Optional[str] = "0.00"
83+
unit_discount: Optional[str] = "0.00"
84+
unit_total: Optional[str] = "0.00"
85+
product: Optional[str] = ""
86+
quantity: Optional[int] = 1
87+
unit_measure: Optional[int] = None
8888
taxes: list = field(default_factory=list)
8989
title: Optional[str] = ""
9090

@@ -96,6 +96,7 @@ class Invoice(BaseDataClass):
9696
currency_code: Optional[DefaultCurrencyCode]
9797
date: Date
9898
client: int
99+
mydata_document_type: str
99100
due_days: Optional[int]
100101
billing_address: Optional[BillingAddress]
101102
shipping_address: Optional[BillingAddress]

0 commit comments

Comments
 (0)