You've already forked akaunting-py
Added default currency_code and currency_rate
This commit is contained in:
@@ -18,7 +18,9 @@ class Client(object):
|
||||
url,
|
||||
username,
|
||||
password,
|
||||
company_id):
|
||||
company_id,
|
||||
currency_code="NZD",
|
||||
currency_rate="1.0"):
|
||||
"""
|
||||
Create a new instance.
|
||||
Args:
|
||||
@@ -33,6 +35,8 @@ class Client(object):
|
||||
}
|
||||
self.company_id = company_id
|
||||
self.default_params = {'company_id': company_id}
|
||||
self.currency_code = currency_code
|
||||
self.currency_rate = currency_rate
|
||||
|
||||
def call(self, method="get", endpoint=None,
|
||||
**params) -> dict():
|
||||
@@ -69,7 +73,7 @@ class Client(object):
|
||||
return data
|
||||
|
||||
def get_accounts(self, **params):
|
||||
data = self.call(endpoint="accounts")
|
||||
data = self.call(endpoint="accounts", **params)
|
||||
|
||||
return data['data']
|
||||
|
||||
@@ -83,11 +87,17 @@ class Client(object):
|
||||
reference=None, # Reference for the payment
|
||||
payment_method=None, # Payment method
|
||||
currency_code=None, # Currency code
|
||||
currency_rate=None, # Currency rate
|
||||
currency_rate=None,# Currency rate
|
||||
amount=None, # Amount received/paid
|
||||
**params # Any additional parameters
|
||||
):
|
||||
|
||||
if currency_code is None:
|
||||
# Set default value from class
|
||||
currency_code = self.currency_code
|
||||
if currency_rate is None:
|
||||
# Set default value from class
|
||||
currency_rate = self.currency_rate
|
||||
|
||||
data = self.call(endpoint="transactions",
|
||||
method="POST",
|
||||
|
||||
Reference in New Issue
Block a user