Skip to content

Commit

Permalink
Bug Fixes and Improvements
Browse files Browse the repository at this point in the history
Changes
* Fetch contacts with query params
* Set defaults for optional fields in Invoice client
  • Loading branch information
Oluwafemi Adenuga committed Jun 10, 2024
2 parents 2424c90 + 99cbaa2 commit b90c05b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
8 changes: 4 additions & 4 deletions elorus/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ def __init__(self, client: Client):

class Contacts(SubClient):

def list(self):
return self.client._handle_request("GET", "contacts/")
def list(self, **params):
return self.client._handle_request("GET", "contacts/", params=params)

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

class Invoices(SubClient):

def list(self):
return self.client._handle_request("GET", "invoices/")
def list(self, **params):
return self.client._handle_request("GET", "invoices/", params=params)

def create(self, invoice: Invoice):
payload = invoice.clean_dict()
Expand Down
13 changes: 7 additions & 6 deletions elorus/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,15 @@ class BillingAddress(BaseDataClass):

@dataclass
class Item(BaseDataClass):
product: str
description: str
quantity: str
unit_measure: int
unit_value: str
unit_discount: str
unit_total: str
mydata_classification_category: str
mydata_classification_type: str
unit_value: Optional[str] = "0.00"
unit_discount: Optional[str] = "0.00"
unit_total: Optional[str] = "0.00"
product: Optional[str] = ""
quantity: Optional[int] = 1
unit_measure: Optional[int] = None
taxes: list = field(default_factory=list)
title: Optional[str] = ""

Expand All @@ -96,6 +96,7 @@ class Invoice(BaseDataClass):
currency_code: Optional[DefaultCurrencyCode]
date: Date
client: int
mydata_document_type: str
due_days: Optional[int]
billing_address: Optional[BillingAddress]
shipping_address: Optional[BillingAddress]
Expand Down

0 comments on commit b90c05b

Please sign in to comment.