MambuPy 2.0.0b33__tar.gz → 2.0.0b45__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/MambuPy/__init__.py +1 -1
- {MambuPy-2.0.0b33/mambupy → MambuPy-2.0.0b45/MambuPy}/api/connector/mambuconnector.py +32 -0
- {MambuPy-2.0.0b33/mambupy → MambuPy-2.0.0b45/MambuPy}/api/connector/rest.py +67 -2
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/MambuPy/api/entities.py +30 -0
- {MambuPy-2.0.0b33/mambupy → MambuPy-2.0.0b45/MambuPy}/api/mambuclient.py +8 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/MambuPy/api/mambuloan.py +54 -2
- {MambuPy-2.0.0b33/mambupy → MambuPy-2.0.0b45/MambuPy}/api/mambustruct.py +16 -7
- {MambuPy-2.0.0b33/mambupy → MambuPy-2.0.0b45/MambuPy}/api/mambutransaction.py +9 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/MambuPy/api/vos.py +27 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/MambuPy/mambugeturl.py +2 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/MambuPy/mambuutil.py +3 -4
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/MambuPy.egg-info/PKG-INFO +1 -5
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/PKG-INFO +1 -5
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/mambupy/__init__.py +1 -1
- {MambuPy-2.0.0b33/MambuPy → MambuPy-2.0.0b45/mambupy}/api/connector/mambuconnector.py +32 -0
- {MambuPy-2.0.0b33/MambuPy → MambuPy-2.0.0b45/mambupy}/api/connector/rest.py +67 -2
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/mambupy/api/entities.py +30 -0
- {MambuPy-2.0.0b33/MambuPy → MambuPy-2.0.0b45/mambupy}/api/mambuclient.py +8 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/mambupy/api/mambuloan.py +54 -2
- {MambuPy-2.0.0b33/MambuPy → MambuPy-2.0.0b45/mambupy}/api/mambustruct.py +16 -7
- {MambuPy-2.0.0b33/MambuPy → MambuPy-2.0.0b45/mambupy}/api/mambutransaction.py +9 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/mambupy/api/vos.py +27 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/mambupy/mambugeturl.py +2 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/mambupy/mambuutil.py +3 -4
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/LICENSE +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/MambuPy/api/__init__.py +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/MambuPy/api/classes.py +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/MambuPy/api/connector/__init__.py +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/MambuPy/api/interfaces.py +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/MambuPy/api/mambubranch.py +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/MambuPy/api/mambucentre.py +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/MambuPy/api/mambucustomfield.py +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/MambuPy/api/mambugroup.py +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/MambuPy/api/mambuproduct.py +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/MambuPy/api/mamburole.py +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/MambuPy/api/mambutask.py +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/MambuPy/api/mambuuser.py +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/MambuPy/mambuconfig.py +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/MambuPy/orm/__init__.py +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/MambuPy/orm/schema_activities.py +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/MambuPy/orm/schema_addresses.py +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/MambuPy/orm/schema_branches.py +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/MambuPy/orm/schema_centres.py +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/MambuPy/orm/schema_clients.py +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/MambuPy/orm/schema_customfields.py +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/MambuPy/orm/schema_dummies.py +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/MambuPy/orm/schema_groups.py +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/MambuPy/orm/schema_loans.py +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/MambuPy/orm/schema_mambu.py +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/MambuPy/orm/schema_orm.py +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/MambuPy/orm/schema_tasks.py +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/MambuPy/orm/schema_users.py +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/MambuPy/rest1to2/__init__.py +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/MambuPy/rest1to2/mambubranch.py +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/MambuPy/rest1to2/mambucentre.py +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/MambuPy/rest1to2/mambuclient.py +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/MambuPy/rest1to2/mambugroup.py +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/MambuPy/rest1to2/mambuloan.py +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/MambuPy/rest1to2/mambuproduct.py +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/MambuPy/rest1to2/mamburepayment.py +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/MambuPy/rest1to2/mambustruct.py +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/MambuPy/rest1to2/mambutask.py +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/MambuPy/rest1to2/mambutransaction.py +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/MambuPy/rest1to2/mambuuser.py +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/MambuPy/utils/__init__.py +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/MambuPy/utils/logging_config.py +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/MambuPy/utils/userdeactivate.py +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/MambuPy.egg-info/SOURCES.txt +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/MambuPy.egg-info/dependency_links.txt +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/MambuPy.egg-info/requires.txt +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/MambuPy.egg-info/top_level.txt +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/README.md +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/mambupy/api/__init__.py +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/mambupy/api/classes.py +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/mambupy/api/connector/__init__.py +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/mambupy/api/interfaces.py +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/mambupy/api/mambubranch.py +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/mambupy/api/mambucentre.py +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/mambupy/api/mambucustomfield.py +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/mambupy/api/mambugroup.py +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/mambupy/api/mambuproduct.py +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/mambupy/api/mamburole.py +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/mambupy/api/mambutask.py +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/mambupy/api/mambuuser.py +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/mambupy/mambuconfig.py +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/mambupy/orm/__init__.py +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/mambupy/orm/schema_activities.py +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/mambupy/orm/schema_addresses.py +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/mambupy/orm/schema_branches.py +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/mambupy/orm/schema_centres.py +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/mambupy/orm/schema_clients.py +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/mambupy/orm/schema_customfields.py +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/mambupy/orm/schema_dummies.py +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/mambupy/orm/schema_groups.py +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/mambupy/orm/schema_loans.py +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/mambupy/orm/schema_mambu.py +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/mambupy/orm/schema_orm.py +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/mambupy/orm/schema_tasks.py +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/mambupy/orm/schema_users.py +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/mambupy/rest1to2/__init__.py +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/mambupy/rest1to2/mambubranch.py +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/mambupy/rest1to2/mambucentre.py +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/mambupy/rest1to2/mambuclient.py +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/mambupy/rest1to2/mambugroup.py +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/mambupy/rest1to2/mambuloan.py +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/mambupy/rest1to2/mambuproduct.py +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/mambupy/rest1to2/mamburepayment.py +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/mambupy/rest1to2/mambustruct.py +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/mambupy/rest1to2/mambutask.py +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/mambupy/rest1to2/mambutransaction.py +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/mambupy/rest1to2/mambuuser.py +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/mambupy/utils/__init__.py +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/mambupy/utils/logging_config.py +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/mambupy/utils/userdeactivate.py +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/setup.cfg +0 -0
- {MambuPy-2.0.0b33 → MambuPy-2.0.0b45}/setup.py +0 -0
|
@@ -177,6 +177,11 @@ class MambuConnectorWriter(ABC):
|
|
|
177
177
|
"""patches certain parts of a mambu entity"""
|
|
178
178
|
raise NotImplementedError
|
|
179
179
|
|
|
180
|
+
@abstractmethod
|
|
181
|
+
def mambu_delete(self, entid, prefix):
|
|
182
|
+
"""deletes a mambu entity"""
|
|
183
|
+
raise NotImplementedError
|
|
184
|
+
|
|
180
185
|
@abstractmethod
|
|
181
186
|
def mambu_upload_document(self, owner_type, entid, filename, name, notes):
|
|
182
187
|
"""uploads an attachment to this entity
|
|
@@ -254,6 +259,23 @@ class MambuConnectorWriter(ABC):
|
|
|
254
259
|
"""
|
|
255
260
|
raise NotImplementedError
|
|
256
261
|
|
|
262
|
+
@abstractmethod
|
|
263
|
+
def mambu_make_fee(
|
|
264
|
+
self, loan_id, amount, installmentNumber, notes, valueDate, allowed_fields, **kwargs
|
|
265
|
+
):
|
|
266
|
+
"""Make a fee transaction on a loan account.
|
|
267
|
+
|
|
268
|
+
Args:
|
|
269
|
+
loan_id (str): loan account id to apply a fee
|
|
270
|
+
amount (float): the amount of the fee
|
|
271
|
+
installmentNumber (int): the installment number to apply the fee
|
|
272
|
+
notes (str): notes for the fee transaction
|
|
273
|
+
valueDate (str): entry date for the fee transaction
|
|
274
|
+
allowed_fields (list): extra fields allowed for the transaction
|
|
275
|
+
kwargs (dict): key-values of extra fields for the transaction
|
|
276
|
+
"""
|
|
277
|
+
raise NotImplementedError
|
|
278
|
+
|
|
257
279
|
@abstractmethod
|
|
258
280
|
def mambu_loanaccount_writeoff(self, loanid, notes):
|
|
259
281
|
"""Writesoff a loan account
|
|
@@ -263,3 +285,13 @@ class MambuConnectorWriter(ABC):
|
|
|
263
285
|
notes (str): notes to associate to the writeoff operation in Mambu
|
|
264
286
|
"""
|
|
265
287
|
raise NotImplementedError
|
|
288
|
+
|
|
289
|
+
@abstractmethod
|
|
290
|
+
def mambu_loantransaction_adjust(self, transactionid, notes):
|
|
291
|
+
"""Adjust a loan transaction
|
|
292
|
+
|
|
293
|
+
Args:
|
|
294
|
+
transactionid (str): the id or encoded key of the loan transaction
|
|
295
|
+
notes (str): notes to associate to the transaction adjustment in Mambu
|
|
296
|
+
"""
|
|
297
|
+
raise NotImplementedError
|
|
@@ -105,7 +105,7 @@ class MambuConnectorREST(MambuConnector, MambuConnectorReader, MambuConnectorWri
|
|
|
105
105
|
|
|
106
106
|
retry_strategy = Retry(
|
|
107
107
|
total=self._RETRIES,
|
|
108
|
-
status_forcelist=[429,
|
|
108
|
+
status_forcelist=[429, 502, 503, 504],
|
|
109
109
|
backoff_factor=1,
|
|
110
110
|
allowed_methods=[
|
|
111
111
|
"HEAD",
|
|
@@ -550,6 +550,12 @@ url %s, params %s, data %s, headers %s",
|
|
|
550
550
|
if patch_data:
|
|
551
551
|
return self.__request("PATCH", url, data=patch_data)
|
|
552
552
|
|
|
553
|
+
def mambu_delete(self, entid, prefix):
|
|
554
|
+
"""deletes a mambu entity"""
|
|
555
|
+
url = "https://{}/api/{}/{}".format(self._tenant, prefix, entid)
|
|
556
|
+
|
|
557
|
+
return self.__request("DELETE", url)
|
|
558
|
+
|
|
553
559
|
def mambu_upload_document(self, owner_type, entid, filename, name, notes):
|
|
554
560
|
"""uploads an attachment to this entity
|
|
555
561
|
|
|
@@ -774,7 +780,9 @@ url %s, params %s, data %s, headers %s",
|
|
|
774
780
|
return self.__request("POST", url, data=data)
|
|
775
781
|
|
|
776
782
|
def mambu_make_repayment(
|
|
777
|
-
self, loan_id, amount, notes, valueDate,
|
|
783
|
+
self, loan_id, amount, notes, valueDate,
|
|
784
|
+
allowed_fields, loantransaction_allowed_fields,
|
|
785
|
+
**kwargs
|
|
778
786
|
):
|
|
779
787
|
"""Make a repayment transaction on a loan account.
|
|
780
788
|
|
|
@@ -784,11 +792,25 @@ url %s, params %s, data %s, headers %s",
|
|
|
784
792
|
notes (str): notes for the repayment transaction
|
|
785
793
|
valueDate (str): date for the repayment transaction in ISO format
|
|
786
794
|
allowed_fields (list): extra fields allowed for the transaction
|
|
795
|
+
loantransaction_allowed_fields (list): extra fields allowed for the transaction details
|
|
787
796
|
kwargs (dict): key-values of extra fields for the transaction
|
|
797
|
+
allows custom fields in the transaction ONLY when prefixed with '_' and being a dict
|
|
788
798
|
"""
|
|
799
|
+
def _extract_valid_transactionDetails(transactionDetails_dict):
|
|
800
|
+
transactionDetails = {}
|
|
801
|
+
for k, v in transactionDetails_dict.items():
|
|
802
|
+
if k in loantransaction_allowed_fields:
|
|
803
|
+
transactionDetails[k] = v
|
|
804
|
+
return transactionDetails
|
|
805
|
+
|
|
789
806
|
data = {"amount": amount, "notes": notes, "valueDate": valueDate}
|
|
790
807
|
for k, v in kwargs.items():
|
|
791
808
|
if k in allowed_fields:
|
|
809
|
+
if k == "transactionDetails":
|
|
810
|
+
data[k] = _extract_valid_transactionDetails(v)
|
|
811
|
+
else:
|
|
812
|
+
data[k] = v
|
|
813
|
+
elif k[0] == "_" and isinstance(v, dict):
|
|
792
814
|
data[k] = v
|
|
793
815
|
|
|
794
816
|
url = "https://{}/api/loans/{}/repayment-transactions".format(
|
|
@@ -796,3 +818,46 @@ url %s, params %s, data %s, headers %s",
|
|
|
796
818
|
)
|
|
797
819
|
|
|
798
820
|
return self.__request("POST", url, data=data)
|
|
821
|
+
|
|
822
|
+
def mambu_make_fee(
|
|
823
|
+
self, loan_id, amount, installmentNumber, notes, valueDate, allowed_fields, **kwargs
|
|
824
|
+
):
|
|
825
|
+
"""Make a fee transaction on a loan account.
|
|
826
|
+
|
|
827
|
+
Args:
|
|
828
|
+
loan_id (str): loan account id to apply a fee
|
|
829
|
+
amount (float): the amount of the fee
|
|
830
|
+
installmentNumber (int): the installment number to apply the fee
|
|
831
|
+
notes (str): notes for the fee transaction
|
|
832
|
+
valueDate (str): entry date for the fee transaction
|
|
833
|
+
allowed_fields (list): extra fields allowed for the transaction
|
|
834
|
+
kwargs (dict): key-values of extra fields for the transaction
|
|
835
|
+
"""
|
|
836
|
+
data = {
|
|
837
|
+
"amount": amount,
|
|
838
|
+
"installmentNumber": installmentNumber,
|
|
839
|
+
"notes": notes,
|
|
840
|
+
"valueDate": valueDate,
|
|
841
|
+
}
|
|
842
|
+
for k, v in kwargs.items():
|
|
843
|
+
if k in allowed_fields:
|
|
844
|
+
data[k] = v
|
|
845
|
+
|
|
846
|
+
url = "https://{}/api/loans/{}/fee-transactions".format(self._tenant, loan_id)
|
|
847
|
+
|
|
848
|
+
return self.__request("POST", url, data=data)
|
|
849
|
+
|
|
850
|
+
def mambu_loantransaction_adjust(self, transactionid, notes):
|
|
851
|
+
"""Adjust a loan transaction
|
|
852
|
+
|
|
853
|
+
Args:
|
|
854
|
+
transactionid (str): the id or encoded key of the loan transaction
|
|
855
|
+
notes (str): notes to associate to the transaction adjustment in Mambu
|
|
856
|
+
"""
|
|
857
|
+
data = {
|
|
858
|
+
"notes": notes,
|
|
859
|
+
}
|
|
860
|
+
|
|
861
|
+
url = "https://{}/api/loans/transactions/{}:adjust".format(self._tenant, transactionid)
|
|
862
|
+
|
|
863
|
+
return self.__request("POST", url, data=data)
|
|
@@ -589,6 +589,36 @@ class MambuEntityWritable(MambuStruct, MambuWritable):
|
|
|
589
589
|
self._extractCustomFields()
|
|
590
590
|
self._extractVOs()
|
|
591
591
|
|
|
592
|
+
def _delete_for_creation(self):
|
|
593
|
+
"""Deletes extra fields from Mambu unusable for entity
|
|
594
|
+
creation.
|
|
595
|
+
|
|
596
|
+
Implement on entities which require further cleaning.
|
|
597
|
+
"""
|
|
598
|
+
|
|
599
|
+
def delete(self):
|
|
600
|
+
"""deletes a mambu entity.
|
|
601
|
+
|
|
602
|
+
Leaves the object in a supposedly state where you can create
|
|
603
|
+
it again. Depends on required custom fields to be present in
|
|
604
|
+
the entity at the moment of deletion.
|
|
605
|
+
|
|
606
|
+
TODO: implement some way to ensure schemas are accomplished to
|
|
607
|
+
make sure we can run creation after deletion.
|
|
608
|
+
"""
|
|
609
|
+
try:
|
|
610
|
+
self._connector.mambu_delete(self.id, self._prefix)
|
|
611
|
+
except MambuError:
|
|
612
|
+
raise
|
|
613
|
+
|
|
614
|
+
# cleaning...
|
|
615
|
+
for key in ["id", "encodedKey"]:
|
|
616
|
+
try:
|
|
617
|
+
del self._attrs[key]
|
|
618
|
+
except KeyError:
|
|
619
|
+
pass
|
|
620
|
+
self._delete_for_creation()
|
|
621
|
+
|
|
592
622
|
|
|
593
623
|
class MambuEntitySearchable(MambuStruct, MambuSearchable):
|
|
594
624
|
"""A Mambu object with searching capabilities."""
|
|
@@ -72,3 +72,11 @@ class MambuClient(
|
|
|
72
72
|
def __init__(self, **kwargs):
|
|
73
73
|
super().__init__(**kwargs)
|
|
74
74
|
self._attachments = {}
|
|
75
|
+
|
|
76
|
+
def _delete_for_creation(self):
|
|
77
|
+
"""Deletes extra fields from Mambu unusable for entity
|
|
78
|
+
creation."""
|
|
79
|
+
try:
|
|
80
|
+
del self._attrs["approvedDate"]
|
|
81
|
+
except KeyError:
|
|
82
|
+
pass
|
|
@@ -20,12 +20,15 @@ from .entities import (
|
|
|
20
20
|
MambuEntityOwnable,
|
|
21
21
|
MambuInstallment,
|
|
22
22
|
)
|
|
23
|
+
|
|
23
24
|
from MambuPy.api.vos import (
|
|
24
25
|
MambuDisbursementLoanTransactionInput,
|
|
26
|
+
MambuFeeLoanTransactionInput,
|
|
25
27
|
MambuRepaymentLoanTransactionInput,
|
|
28
|
+
MambuLoanTransactionDetailsInput,
|
|
26
29
|
)
|
|
27
30
|
from MambuPy.mambuutil import MambuPyError
|
|
28
|
-
|
|
31
|
+
from .mambutransaction import MambuTransaction
|
|
29
32
|
|
|
30
33
|
class MambuLoan(
|
|
31
34
|
MambuEntity,
|
|
@@ -101,6 +104,17 @@ class MambuLoan(
|
|
|
101
104
|
super().__init__(**kwargs)
|
|
102
105
|
self._attachments = {}
|
|
103
106
|
|
|
107
|
+
def _delete_for_creation(self):
|
|
108
|
+
"""Deletes extra fields from Mambu unusable for entity
|
|
109
|
+
creation."""
|
|
110
|
+
try:
|
|
111
|
+
del self._attrs["currency"]
|
|
112
|
+
del self._attrs["accountState"]
|
|
113
|
+
del self._attrs["scheduleSettings"]["hasCustomSchedule"]
|
|
114
|
+
del self._attrs["interestSettings"]["accrueLateInterest"]
|
|
115
|
+
except KeyError:
|
|
116
|
+
pass
|
|
117
|
+
|
|
104
118
|
def get_schedule(self):
|
|
105
119
|
"""Retrieves the installments schedule."""
|
|
106
120
|
resp = self._connector.mambu_loanaccount_getSchedule(self.id)
|
|
@@ -114,6 +128,10 @@ class MambuLoan(
|
|
|
114
128
|
installment_entity._convertDict2Attrs()
|
|
115
129
|
self.schedule.append(installment_entity)
|
|
116
130
|
|
|
131
|
+
def get_transactions(self):
|
|
132
|
+
"""Retrieves the transactions of the loan"""
|
|
133
|
+
self.transactions = MambuTransaction.get_all(self.id)
|
|
134
|
+
|
|
117
135
|
def set_state(self, action, notes):
|
|
118
136
|
"""Request to change status of a MambuLoan
|
|
119
137
|
|
|
@@ -242,7 +260,10 @@ class MambuLoan(
|
|
|
242
260
|
operation. If naive datetime, use TZ info from tzattrs.
|
|
243
261
|
kwargs (dict): allowed extra params for the repayment transaction
|
|
244
262
|
request. :py:obj:`MambuPy.api.vos.MambuRepaymentLoanTransactionInput._schema_fields`
|
|
245
|
-
has the allowed fields permitted for this operation
|
|
263
|
+
has the allowed fields permitted for this operation.
|
|
264
|
+
If transactionDetails is provided, it needs to have the
|
|
265
|
+
structure defined at
|
|
266
|
+
:py:obj:`MambuPy.api.vos.MambuLoanTransactionDetailsInput._schema_fields`.
|
|
246
267
|
"""
|
|
247
268
|
valueDate = datetime.datetime.strptime(
|
|
248
269
|
valueDate.strftime("%Y-%m-%d %H%M%S"), "%Y-%m-%d %H%M%S"
|
|
@@ -255,6 +276,37 @@ class MambuLoan(
|
|
|
255
276
|
notes,
|
|
256
277
|
valueDate,
|
|
257
278
|
MambuRepaymentLoanTransactionInput._schema_fields,
|
|
279
|
+
MambuLoanTransactionDetailsInput._schema_fields,
|
|
280
|
+
**kwargs
|
|
281
|
+
)
|
|
282
|
+
|
|
283
|
+
self.refresh()
|
|
284
|
+
|
|
285
|
+
def apply_fee(self, amount, installmentNumber, notes, valueDate, **kwargs):
|
|
286
|
+
"""Request to apply a fee to a loan account.
|
|
287
|
+
|
|
288
|
+
Args:
|
|
289
|
+
amount (float): the amount of the fee
|
|
290
|
+
installmentNumber (int): the installment number to apply the fee
|
|
291
|
+
notes (str): notes to attach to the fee transaction.
|
|
292
|
+
valueDate (:py:obj:`datetime`): value date for the fee
|
|
293
|
+
transaction. If naive datetime, use TZ info from tzattrs.
|
|
294
|
+
kwargs (dict): allowed extra params for the fee transaction
|
|
295
|
+
request. :py:obj:`MambuPy.api.vos.MambuFeeLoanTransactionInput._schema_fields`
|
|
296
|
+
has the allowed fields permitted for this operation
|
|
297
|
+
"""
|
|
298
|
+
valueDate = datetime.datetime.strptime(
|
|
299
|
+
valueDate.strftime("%Y-%m-%d %H%M%S"), "%Y-%m-%d %H%M%S"
|
|
300
|
+
)
|
|
301
|
+
valueDate = valueDate.astimezone(tzlocal()).isoformat()
|
|
302
|
+
|
|
303
|
+
self._connector.mambu_make_fee(
|
|
304
|
+
self.id,
|
|
305
|
+
amount,
|
|
306
|
+
installmentNumber,
|
|
307
|
+
notes,
|
|
308
|
+
valueDate,
|
|
309
|
+
MambuFeeLoanTransactionInput._schema_fields,
|
|
258
310
|
**kwargs
|
|
259
311
|
)
|
|
260
312
|
|
|
@@ -121,10 +121,10 @@ class MambuStruct(MambuMapObj):
|
|
|
121
121
|
raise attr_err
|
|
122
122
|
|
|
123
123
|
def __convert_from_dict_to_basic_types_non_constant_fields(
|
|
124
|
-
self, k, data_dict, data, tzdata
|
|
124
|
+
self, k, data_dict, data, tzdata, constantFields
|
|
125
125
|
):
|
|
126
126
|
try:
|
|
127
|
-
data_dict[k] = self.__convert_to_basic_types(data[k], tzdata[k])
|
|
127
|
+
data_dict[k] = self.__convert_to_basic_types(data[k], tzdata[k], constantFields)
|
|
128
128
|
if type(data_dict[k]) not in [dict, list, datetime]:
|
|
129
129
|
del tzdata[k]
|
|
130
130
|
elif isinstance(data_dict[k], datetime):
|
|
@@ -141,14 +141,14 @@ class MambuStruct(MambuMapObj):
|
|
|
141
141
|
del tzdata[k]
|
|
142
142
|
else:
|
|
143
143
|
self.__convert_from_dict_to_basic_types_non_constant_fields(
|
|
144
|
-
k, data_dict, data, tzdata
|
|
144
|
+
k, data_dict, data, tzdata, constantFields
|
|
145
145
|
)
|
|
146
146
|
return data_dict
|
|
147
147
|
|
|
148
148
|
def __convert_from_list_to_basic_types(self, it_list, data, tzdata, constantFields):
|
|
149
149
|
data_list = []
|
|
150
150
|
for num, (e, te) in enumerate(zip(it_list, tzdata)):
|
|
151
|
-
d = self.__convert_to_basic_types(e, te)
|
|
151
|
+
d = self.__convert_to_basic_types(e, te, constantFields)
|
|
152
152
|
if type(d) not in [dict, list, datetime]:
|
|
153
153
|
tzdata[num] = None
|
|
154
154
|
elif isinstance(d, datetime):
|
|
@@ -157,8 +157,13 @@ class MambuStruct(MambuMapObj):
|
|
|
157
157
|
return data_list
|
|
158
158
|
|
|
159
159
|
def __convert_to_basic_types_base_cases(self, data):
|
|
160
|
-
|
|
161
|
-
|
|
160
|
+
try:
|
|
161
|
+
if data in ["TRUE", "true", "FALSE", "false"]:
|
|
162
|
+
return data.lower() == "true"
|
|
163
|
+
except TypeError:
|
|
164
|
+
# some data types override __eq__ and may not be compared to str
|
|
165
|
+
# in such cases continue evaluating down under
|
|
166
|
+
pass
|
|
162
167
|
try:
|
|
163
168
|
i_data = int(data)
|
|
164
169
|
if (
|
|
@@ -211,6 +216,8 @@ class MambuStruct(MambuMapObj):
|
|
|
211
216
|
data = self.__convert_from_dict_to_basic_types(
|
|
212
217
|
it, data, tzdata, constantFields
|
|
213
218
|
)
|
|
219
|
+
if isinstance(it, MambuMapObj):
|
|
220
|
+
it._convertDict2Attrs()
|
|
214
221
|
if isinstance(it, list):
|
|
215
222
|
data = self.__convert_from_list_to_basic_types(
|
|
216
223
|
it, data, tzdata, constantFields
|
|
@@ -400,6 +407,8 @@ class MambuStruct(MambuMapObj):
|
|
|
400
407
|
cfs.append(key + "_" + str(ind))
|
|
401
408
|
except KeyError:
|
|
402
409
|
pass
|
|
410
|
+
except TypeError:
|
|
411
|
+
cfs.append(key + "_" + str(ind))
|
|
403
412
|
try:
|
|
404
413
|
self._attrs[attr] = copy.deepcopy(self[attr[1:]])
|
|
405
414
|
cfs.append(attr[1:])
|
|
@@ -698,7 +707,7 @@ class MambuStruct(MambuMapObj):
|
|
|
698
707
|
getattr(self, proprty)[int(index)][key] = ent_item
|
|
699
708
|
except ValueError:
|
|
700
709
|
pass
|
|
701
|
-
self["
|
|
710
|
+
self["" + new_property] = entity
|
|
702
711
|
self[new_property] = ent_item
|
|
703
712
|
except KeyError:
|
|
704
713
|
try:
|
|
@@ -50,3 +50,12 @@ class MambuTransaction(MambuEntity, MambuEntitySearchable):
|
|
|
50
50
|
sortBy=None,
|
|
51
51
|
**{"prefix": "loans/{}/transactions".format(loanAccountId)}
|
|
52
52
|
)
|
|
53
|
+
|
|
54
|
+
def adjust(self, notes):
|
|
55
|
+
"""Request to adjust a loan transaction.
|
|
56
|
+
|
|
57
|
+
Args:
|
|
58
|
+
notes (str): notes to attach to the adjusting transaction.
|
|
59
|
+
"""
|
|
60
|
+
self._connector.mambu_loantransaction_adjust(self.id, notes)
|
|
61
|
+
self.refresh()
|
|
@@ -82,5 +82,32 @@ class MambuRepaymentLoanTransactionInput(MambuValueObject):
|
|
|
82
82
|
"originalCurrencyCode",
|
|
83
83
|
"prepaymentRecalculationMethod",
|
|
84
84
|
"valueDate",
|
|
85
|
+
"transactionDetails",
|
|
85
86
|
]
|
|
86
87
|
"""List of schema fields for a loan repayment transaction."""
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
class MambuLoanTransactionDetailsInput(MambuValueObject):
|
|
91
|
+
"""Loan Transaction Details body"""
|
|
92
|
+
|
|
93
|
+
_schema_fields = [
|
|
94
|
+
"transactionChannelId",
|
|
95
|
+
"transactionChannelKey",
|
|
96
|
+
]
|
|
97
|
+
"""List of schema fields for a loan repayment transaction."""
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
class MambuFeeLoanTransactionInput(MambuValueObject):
|
|
101
|
+
"""Repayment Loan Transaction body"""
|
|
102
|
+
|
|
103
|
+
_schema_fields = [
|
|
104
|
+
"amount",
|
|
105
|
+
"bookingDate",
|
|
106
|
+
"externalId",
|
|
107
|
+
"fisrtRepaymentDate",
|
|
108
|
+
"installmentNumber",
|
|
109
|
+
"notes",
|
|
110
|
+
"predefinedFeeKey",
|
|
111
|
+
"valueDate",
|
|
112
|
+
]
|
|
113
|
+
"""List of schema fields for a loan fee transaction."""
|
|
@@ -344,8 +344,7 @@ def _backup_db_previous_prep(callback, kwargs):
|
|
|
344
344
|
headers = kwargs["headers"]
|
|
345
345
|
except KeyError:
|
|
346
346
|
headers = {
|
|
347
|
-
"
|
|
348
|
-
"Accept": "application/vnd.mambu.v1+zip",
|
|
347
|
+
"Accept": "application/vnd.mambu.v2+zip",
|
|
349
348
|
}
|
|
350
349
|
list_ret.append(headers)
|
|
351
350
|
|
|
@@ -382,7 +381,7 @@ def _backup_db_request(justbackup, data, user, pwd, verbose=None, log=None):
|
|
|
382
381
|
data=json.dumps(data),
|
|
383
382
|
headers={
|
|
384
383
|
"content-type": "application/json",
|
|
385
|
-
"Accept": "application/vnd.mambu.
|
|
384
|
+
"Accept": "application/vnd.mambu.v2+json",
|
|
386
385
|
},
|
|
387
386
|
auth=(user, pwd),
|
|
388
387
|
)
|
|
@@ -419,7 +418,7 @@ def _backup_db_request(justbackup, data, user, pwd, verbose=None, log=None):
|
|
|
419
418
|
log.close()
|
|
420
419
|
raise MambuError(mess)
|
|
421
420
|
|
|
422
|
-
if not justbackup and resp.status_code !=
|
|
421
|
+
if not justbackup and resp.status_code != 202:
|
|
423
422
|
mess = "Error posting request for backup: %s" % resp.content
|
|
424
423
|
if verbose:
|
|
425
424
|
log.write(mess + "\n")
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: MambuPy
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.0b45
|
|
4
4
|
Summary: A python lib for using Mambu APIs.
|
|
5
5
|
Home-page: https://mambupydocs.readthedocs.io
|
|
6
6
|
Author: Javier Novoa C.
|
|
@@ -10,10 +10,6 @@ Keywords: mambu
|
|
|
10
10
|
Requires-Python: >=2.7
|
|
11
11
|
Description-Content-Type: text/markdown
|
|
12
12
|
License-File: LICENSE
|
|
13
|
-
Requires-Dist: future
|
|
14
|
-
Requires-Dist: requests==2.31.0
|
|
15
|
-
Requires-Dist: requests_toolbelt==1.0.0
|
|
16
|
-
Requires-Dist: dateutils==0.6.12
|
|
17
13
|
|
|
18
14
|
|
|
19
15
|
MambuPy
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: MambuPy
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.0b45
|
|
4
4
|
Summary: A python lib for using Mambu APIs.
|
|
5
5
|
Home-page: https://mambupydocs.readthedocs.io
|
|
6
6
|
Author: Javier Novoa C.
|
|
@@ -10,10 +10,6 @@ Keywords: mambu
|
|
|
10
10
|
Requires-Python: >=2.7
|
|
11
11
|
Description-Content-Type: text/markdown
|
|
12
12
|
License-File: LICENSE
|
|
13
|
-
Requires-Dist: future
|
|
14
|
-
Requires-Dist: requests==2.31.0
|
|
15
|
-
Requires-Dist: requests_toolbelt==1.0.0
|
|
16
|
-
Requires-Dist: dateutils==0.6.12
|
|
17
13
|
|
|
18
14
|
|
|
19
15
|
MambuPy
|
|
@@ -177,6 +177,11 @@ class MambuConnectorWriter(ABC):
|
|
|
177
177
|
"""patches certain parts of a mambu entity"""
|
|
178
178
|
raise NotImplementedError
|
|
179
179
|
|
|
180
|
+
@abstractmethod
|
|
181
|
+
def mambu_delete(self, entid, prefix):
|
|
182
|
+
"""deletes a mambu entity"""
|
|
183
|
+
raise NotImplementedError
|
|
184
|
+
|
|
180
185
|
@abstractmethod
|
|
181
186
|
def mambu_upload_document(self, owner_type, entid, filename, name, notes):
|
|
182
187
|
"""uploads an attachment to this entity
|
|
@@ -254,6 +259,23 @@ class MambuConnectorWriter(ABC):
|
|
|
254
259
|
"""
|
|
255
260
|
raise NotImplementedError
|
|
256
261
|
|
|
262
|
+
@abstractmethod
|
|
263
|
+
def mambu_make_fee(
|
|
264
|
+
self, loan_id, amount, installmentNumber, notes, valueDate, allowed_fields, **kwargs
|
|
265
|
+
):
|
|
266
|
+
"""Make a fee transaction on a loan account.
|
|
267
|
+
|
|
268
|
+
Args:
|
|
269
|
+
loan_id (str): loan account id to apply a fee
|
|
270
|
+
amount (float): the amount of the fee
|
|
271
|
+
installmentNumber (int): the installment number to apply the fee
|
|
272
|
+
notes (str): notes for the fee transaction
|
|
273
|
+
valueDate (str): entry date for the fee transaction
|
|
274
|
+
allowed_fields (list): extra fields allowed for the transaction
|
|
275
|
+
kwargs (dict): key-values of extra fields for the transaction
|
|
276
|
+
"""
|
|
277
|
+
raise NotImplementedError
|
|
278
|
+
|
|
257
279
|
@abstractmethod
|
|
258
280
|
def mambu_loanaccount_writeoff(self, loanid, notes):
|
|
259
281
|
"""Writesoff a loan account
|
|
@@ -263,3 +285,13 @@ class MambuConnectorWriter(ABC):
|
|
|
263
285
|
notes (str): notes to associate to the writeoff operation in Mambu
|
|
264
286
|
"""
|
|
265
287
|
raise NotImplementedError
|
|
288
|
+
|
|
289
|
+
@abstractmethod
|
|
290
|
+
def mambu_loantransaction_adjust(self, transactionid, notes):
|
|
291
|
+
"""Adjust a loan transaction
|
|
292
|
+
|
|
293
|
+
Args:
|
|
294
|
+
transactionid (str): the id or encoded key of the loan transaction
|
|
295
|
+
notes (str): notes to associate to the transaction adjustment in Mambu
|
|
296
|
+
"""
|
|
297
|
+
raise NotImplementedError
|
|
@@ -105,7 +105,7 @@ class MambuConnectorREST(MambuConnector, MambuConnectorReader, MambuConnectorWri
|
|
|
105
105
|
|
|
106
106
|
retry_strategy = Retry(
|
|
107
107
|
total=self._RETRIES,
|
|
108
|
-
status_forcelist=[429,
|
|
108
|
+
status_forcelist=[429, 502, 503, 504],
|
|
109
109
|
backoff_factor=1,
|
|
110
110
|
allowed_methods=[
|
|
111
111
|
"HEAD",
|
|
@@ -550,6 +550,12 @@ url %s, params %s, data %s, headers %s",
|
|
|
550
550
|
if patch_data:
|
|
551
551
|
return self.__request("PATCH", url, data=patch_data)
|
|
552
552
|
|
|
553
|
+
def mambu_delete(self, entid, prefix):
|
|
554
|
+
"""deletes a mambu entity"""
|
|
555
|
+
url = "https://{}/api/{}/{}".format(self._tenant, prefix, entid)
|
|
556
|
+
|
|
557
|
+
return self.__request("DELETE", url)
|
|
558
|
+
|
|
553
559
|
def mambu_upload_document(self, owner_type, entid, filename, name, notes):
|
|
554
560
|
"""uploads an attachment to this entity
|
|
555
561
|
|
|
@@ -774,7 +780,9 @@ url %s, params %s, data %s, headers %s",
|
|
|
774
780
|
return self.__request("POST", url, data=data)
|
|
775
781
|
|
|
776
782
|
def mambu_make_repayment(
|
|
777
|
-
self, loan_id, amount, notes, valueDate,
|
|
783
|
+
self, loan_id, amount, notes, valueDate,
|
|
784
|
+
allowed_fields, loantransaction_allowed_fields,
|
|
785
|
+
**kwargs
|
|
778
786
|
):
|
|
779
787
|
"""Make a repayment transaction on a loan account.
|
|
780
788
|
|
|
@@ -784,11 +792,25 @@ url %s, params %s, data %s, headers %s",
|
|
|
784
792
|
notes (str): notes for the repayment transaction
|
|
785
793
|
valueDate (str): date for the repayment transaction in ISO format
|
|
786
794
|
allowed_fields (list): extra fields allowed for the transaction
|
|
795
|
+
loantransaction_allowed_fields (list): extra fields allowed for the transaction details
|
|
787
796
|
kwargs (dict): key-values of extra fields for the transaction
|
|
797
|
+
allows custom fields in the transaction ONLY when prefixed with '_' and being a dict
|
|
788
798
|
"""
|
|
799
|
+
def _extract_valid_transactionDetails(transactionDetails_dict):
|
|
800
|
+
transactionDetails = {}
|
|
801
|
+
for k, v in transactionDetails_dict.items():
|
|
802
|
+
if k in loantransaction_allowed_fields:
|
|
803
|
+
transactionDetails[k] = v
|
|
804
|
+
return transactionDetails
|
|
805
|
+
|
|
789
806
|
data = {"amount": amount, "notes": notes, "valueDate": valueDate}
|
|
790
807
|
for k, v in kwargs.items():
|
|
791
808
|
if k in allowed_fields:
|
|
809
|
+
if k == "transactionDetails":
|
|
810
|
+
data[k] = _extract_valid_transactionDetails(v)
|
|
811
|
+
else:
|
|
812
|
+
data[k] = v
|
|
813
|
+
elif k[0] == "_" and isinstance(v, dict):
|
|
792
814
|
data[k] = v
|
|
793
815
|
|
|
794
816
|
url = "https://{}/api/loans/{}/repayment-transactions".format(
|
|
@@ -796,3 +818,46 @@ url %s, params %s, data %s, headers %s",
|
|
|
796
818
|
)
|
|
797
819
|
|
|
798
820
|
return self.__request("POST", url, data=data)
|
|
821
|
+
|
|
822
|
+
def mambu_make_fee(
|
|
823
|
+
self, loan_id, amount, installmentNumber, notes, valueDate, allowed_fields, **kwargs
|
|
824
|
+
):
|
|
825
|
+
"""Make a fee transaction on a loan account.
|
|
826
|
+
|
|
827
|
+
Args:
|
|
828
|
+
loan_id (str): loan account id to apply a fee
|
|
829
|
+
amount (float): the amount of the fee
|
|
830
|
+
installmentNumber (int): the installment number to apply the fee
|
|
831
|
+
notes (str): notes for the fee transaction
|
|
832
|
+
valueDate (str): entry date for the fee transaction
|
|
833
|
+
allowed_fields (list): extra fields allowed for the transaction
|
|
834
|
+
kwargs (dict): key-values of extra fields for the transaction
|
|
835
|
+
"""
|
|
836
|
+
data = {
|
|
837
|
+
"amount": amount,
|
|
838
|
+
"installmentNumber": installmentNumber,
|
|
839
|
+
"notes": notes,
|
|
840
|
+
"valueDate": valueDate,
|
|
841
|
+
}
|
|
842
|
+
for k, v in kwargs.items():
|
|
843
|
+
if k in allowed_fields:
|
|
844
|
+
data[k] = v
|
|
845
|
+
|
|
846
|
+
url = "https://{}/api/loans/{}/fee-transactions".format(self._tenant, loan_id)
|
|
847
|
+
|
|
848
|
+
return self.__request("POST", url, data=data)
|
|
849
|
+
|
|
850
|
+
def mambu_loantransaction_adjust(self, transactionid, notes):
|
|
851
|
+
"""Adjust a loan transaction
|
|
852
|
+
|
|
853
|
+
Args:
|
|
854
|
+
transactionid (str): the id or encoded key of the loan transaction
|
|
855
|
+
notes (str): notes to associate to the transaction adjustment in Mambu
|
|
856
|
+
"""
|
|
857
|
+
data = {
|
|
858
|
+
"notes": notes,
|
|
859
|
+
}
|
|
860
|
+
|
|
861
|
+
url = "https://{}/api/loans/transactions/{}:adjust".format(self._tenant, transactionid)
|
|
862
|
+
|
|
863
|
+
return self.__request("POST", url, data=data)
|