You've already forked akaunting-py
Added create transfer
This commit is contained in:
@@ -116,8 +116,29 @@ class Client(object):
|
||||
reference=reference,
|
||||
currency_code=currency_code,
|
||||
currency_rate=currency_rate,
|
||||
amount=amount,
|
||||
amount=EnsurePositiveInteger(amount),
|
||||
description=description,
|
||||
**params
|
||||
)
|
||||
return data
|
||||
|
||||
|
||||
def create_transfer(self,
|
||||
from_account_id=None, # Account ID to create transfer from
|
||||
to_account_id=None, # Account ID to create transfer to
|
||||
transferred_at=None, # Date of expense/transfer or income
|
||||
payment_method="Bank Transfer", # Payment method
|
||||
amount=None, # Amount received/paid
|
||||
**params # Any additional parameters
|
||||
):
|
||||
|
||||
data = self.call(endpoint="transfers",
|
||||
method="POST",
|
||||
from_account_id=from_account_id,
|
||||
to_account_id=to_account_id,
|
||||
transferred_at=transferred_at,
|
||||
payment_method=payment_method,
|
||||
amount=EnsurePositiveInteger(amount),
|
||||
**params
|
||||
)
|
||||
return data
|
||||
@@ -6,4 +6,7 @@ def MergeDict(dict1, dict2):
|
||||
def RemoveFromString(items, string):
|
||||
for item in items:
|
||||
string = string.replace(item, '')
|
||||
return string
|
||||
return string
|
||||
|
||||
def EnsurePositiveInteger(number):
|
||||
return float(number) if float(number) > 0 else (float(number) * -1)
|
||||
Reference in New Issue
Block a user