MambuPy 2.3.0__tar.gz → 2.3.2__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.
Files changed (96) hide show
  1. {mambupy-2.3.0 → mambupy-2.3.2}/MambuPy/__init__.py +1 -1
  2. {mambupy-2.3.0/mambupy → mambupy-2.3.2/MambuPy}/api/connector/rest.py +18 -5
  3. {mambupy-2.3.0/mambupy → mambupy-2.3.2/MambuPy}/api/entities.py +6 -0
  4. {mambupy-2.3.0 → mambupy-2.3.2}/MambuPy/api/mambuloan.py +28 -30
  5. {mambupy-2.3.0 → mambupy-2.3.2}/MambuPy.egg-info/PKG-INFO +1 -1
  6. {mambupy-2.3.0 → mambupy-2.3.2}/PKG-INFO +1 -1
  7. {mambupy-2.3.0 → mambupy-2.3.2}/mambupy/__init__.py +1 -1
  8. {mambupy-2.3.0/MambuPy → mambupy-2.3.2/mambupy}/api/connector/rest.py +18 -5
  9. {mambupy-2.3.0/MambuPy → mambupy-2.3.2/mambupy}/api/entities.py +6 -0
  10. {mambupy-2.3.0 → mambupy-2.3.2}/mambupy/api/mambuloan.py +28 -30
  11. {mambupy-2.3.0 → mambupy-2.3.2}/LICENSE +0 -0
  12. {mambupy-2.3.0 → mambupy-2.3.2}/MambuPy/api/__init__.py +0 -0
  13. {mambupy-2.3.0 → mambupy-2.3.2}/MambuPy/api/classes.py +0 -0
  14. {mambupy-2.3.0 → mambupy-2.3.2}/MambuPy/api/connector/__init__.py +0 -0
  15. {mambupy-2.3.0 → mambupy-2.3.2}/MambuPy/api/connector/mambuconnector.py +0 -0
  16. {mambupy-2.3.0 → mambupy-2.3.2}/MambuPy/api/interfaces.py +0 -0
  17. {mambupy-2.3.0 → mambupy-2.3.2}/MambuPy/api/mambubranch.py +0 -0
  18. {mambupy-2.3.0 → mambupy-2.3.2}/MambuPy/api/mambucentre.py +0 -0
  19. {mambupy-2.3.0 → mambupy-2.3.2}/MambuPy/api/mambuclient.py +0 -0
  20. {mambupy-2.3.0 → mambupy-2.3.2}/MambuPy/api/mambucustomfield.py +0 -0
  21. {mambupy-2.3.0 → mambupy-2.3.2}/MambuPy/api/mambugroup.py +0 -0
  22. {mambupy-2.3.0 → mambupy-2.3.2}/MambuPy/api/mambuproduct.py +0 -0
  23. {mambupy-2.3.0 → mambupy-2.3.2}/MambuPy/api/mamburole.py +0 -0
  24. {mambupy-2.3.0 → mambupy-2.3.2}/MambuPy/api/mambustruct.py +0 -0
  25. {mambupy-2.3.0 → mambupy-2.3.2}/MambuPy/api/mambutask.py +0 -0
  26. {mambupy-2.3.0 → mambupy-2.3.2}/MambuPy/api/mambutransaction.py +0 -0
  27. {mambupy-2.3.0 → mambupy-2.3.2}/MambuPy/api/mambuuser.py +0 -0
  28. {mambupy-2.3.0 → mambupy-2.3.2}/MambuPy/api/vos.py +0 -0
  29. {mambupy-2.3.0 → mambupy-2.3.2}/MambuPy/mambuconfig.py +0 -0
  30. {mambupy-2.3.0 → mambupy-2.3.2}/MambuPy/mambugeturl.py +0 -0
  31. {mambupy-2.3.0 → mambupy-2.3.2}/MambuPy/mambuutil.py +0 -0
  32. {mambupy-2.3.0 → mambupy-2.3.2}/MambuPy/orm/__init__.py +0 -0
  33. {mambupy-2.3.0 → mambupy-2.3.2}/MambuPy/orm/schema_activities.py +0 -0
  34. {mambupy-2.3.0 → mambupy-2.3.2}/MambuPy/orm/schema_addresses.py +0 -0
  35. {mambupy-2.3.0 → mambupy-2.3.2}/MambuPy/orm/schema_branches.py +0 -0
  36. {mambupy-2.3.0 → mambupy-2.3.2}/MambuPy/orm/schema_centres.py +0 -0
  37. {mambupy-2.3.0 → mambupy-2.3.2}/MambuPy/orm/schema_clients.py +0 -0
  38. {mambupy-2.3.0 → mambupy-2.3.2}/MambuPy/orm/schema_customfields.py +0 -0
  39. {mambupy-2.3.0 → mambupy-2.3.2}/MambuPy/orm/schema_dummies.py +0 -0
  40. {mambupy-2.3.0 → mambupy-2.3.2}/MambuPy/orm/schema_groups.py +0 -0
  41. {mambupy-2.3.0 → mambupy-2.3.2}/MambuPy/orm/schema_loans.py +0 -0
  42. {mambupy-2.3.0 → mambupy-2.3.2}/MambuPy/orm/schema_mambu.py +0 -0
  43. {mambupy-2.3.0 → mambupy-2.3.2}/MambuPy/orm/schema_orm.py +0 -0
  44. {mambupy-2.3.0 → mambupy-2.3.2}/MambuPy/orm/schema_tasks.py +0 -0
  45. {mambupy-2.3.0 → mambupy-2.3.2}/MambuPy/orm/schema_users.py +0 -0
  46. {mambupy-2.3.0 → mambupy-2.3.2}/MambuPy/rest/__init__.py +0 -0
  47. {mambupy-2.3.0 → mambupy-2.3.2}/MambuPy/rest/mambuactivity.py +0 -0
  48. {mambupy-2.3.0 → mambupy-2.3.2}/MambuPy/utils/__init__.py +0 -0
  49. {mambupy-2.3.0 → mambupy-2.3.2}/MambuPy/utils/update_user_roles.py +0 -0
  50. {mambupy-2.3.0 → mambupy-2.3.2}/MambuPy/utils/userdeactivate.py +0 -0
  51. {mambupy-2.3.0 → mambupy-2.3.2}/MambuPy.egg-info/SOURCES.txt +0 -0
  52. {mambupy-2.3.0 → mambupy-2.3.2}/MambuPy.egg-info/dependency_links.txt +0 -0
  53. {mambupy-2.3.0 → mambupy-2.3.2}/MambuPy.egg-info/requires.txt +0 -0
  54. {mambupy-2.3.0 → mambupy-2.3.2}/MambuPy.egg-info/top_level.txt +0 -0
  55. {mambupy-2.3.0 → mambupy-2.3.2}/README.md +0 -0
  56. {mambupy-2.3.0 → mambupy-2.3.2}/mambupy/api/__init__.py +0 -0
  57. {mambupy-2.3.0 → mambupy-2.3.2}/mambupy/api/classes.py +0 -0
  58. {mambupy-2.3.0 → mambupy-2.3.2}/mambupy/api/connector/__init__.py +0 -0
  59. {mambupy-2.3.0 → mambupy-2.3.2}/mambupy/api/connector/mambuconnector.py +0 -0
  60. {mambupy-2.3.0 → mambupy-2.3.2}/mambupy/api/interfaces.py +0 -0
  61. {mambupy-2.3.0 → mambupy-2.3.2}/mambupy/api/mambubranch.py +0 -0
  62. {mambupy-2.3.0 → mambupy-2.3.2}/mambupy/api/mambucentre.py +0 -0
  63. {mambupy-2.3.0 → mambupy-2.3.2}/mambupy/api/mambuclient.py +0 -0
  64. {mambupy-2.3.0 → mambupy-2.3.2}/mambupy/api/mambucustomfield.py +0 -0
  65. {mambupy-2.3.0 → mambupy-2.3.2}/mambupy/api/mambugroup.py +0 -0
  66. {mambupy-2.3.0 → mambupy-2.3.2}/mambupy/api/mambuproduct.py +0 -0
  67. {mambupy-2.3.0 → mambupy-2.3.2}/mambupy/api/mamburole.py +0 -0
  68. {mambupy-2.3.0 → mambupy-2.3.2}/mambupy/api/mambustruct.py +0 -0
  69. {mambupy-2.3.0 → mambupy-2.3.2}/mambupy/api/mambutask.py +0 -0
  70. {mambupy-2.3.0 → mambupy-2.3.2}/mambupy/api/mambutransaction.py +0 -0
  71. {mambupy-2.3.0 → mambupy-2.3.2}/mambupy/api/mambuuser.py +0 -0
  72. {mambupy-2.3.0 → mambupy-2.3.2}/mambupy/api/vos.py +0 -0
  73. {mambupy-2.3.0 → mambupy-2.3.2}/mambupy/mambuconfig.py +0 -0
  74. {mambupy-2.3.0 → mambupy-2.3.2}/mambupy/mambugeturl.py +0 -0
  75. {mambupy-2.3.0 → mambupy-2.3.2}/mambupy/mambuutil.py +0 -0
  76. {mambupy-2.3.0 → mambupy-2.3.2}/mambupy/orm/__init__.py +0 -0
  77. {mambupy-2.3.0 → mambupy-2.3.2}/mambupy/orm/schema_activities.py +0 -0
  78. {mambupy-2.3.0 → mambupy-2.3.2}/mambupy/orm/schema_addresses.py +0 -0
  79. {mambupy-2.3.0 → mambupy-2.3.2}/mambupy/orm/schema_branches.py +0 -0
  80. {mambupy-2.3.0 → mambupy-2.3.2}/mambupy/orm/schema_centres.py +0 -0
  81. {mambupy-2.3.0 → mambupy-2.3.2}/mambupy/orm/schema_clients.py +0 -0
  82. {mambupy-2.3.0 → mambupy-2.3.2}/mambupy/orm/schema_customfields.py +0 -0
  83. {mambupy-2.3.0 → mambupy-2.3.2}/mambupy/orm/schema_dummies.py +0 -0
  84. {mambupy-2.3.0 → mambupy-2.3.2}/mambupy/orm/schema_groups.py +0 -0
  85. {mambupy-2.3.0 → mambupy-2.3.2}/mambupy/orm/schema_loans.py +0 -0
  86. {mambupy-2.3.0 → mambupy-2.3.2}/mambupy/orm/schema_mambu.py +0 -0
  87. {mambupy-2.3.0 → mambupy-2.3.2}/mambupy/orm/schema_orm.py +0 -0
  88. {mambupy-2.3.0 → mambupy-2.3.2}/mambupy/orm/schema_tasks.py +0 -0
  89. {mambupy-2.3.0 → mambupy-2.3.2}/mambupy/orm/schema_users.py +0 -0
  90. {mambupy-2.3.0 → mambupy-2.3.2}/mambupy/rest/__init__.py +0 -0
  91. {mambupy-2.3.0 → mambupy-2.3.2}/mambupy/rest/mambuactivity.py +0 -0
  92. {mambupy-2.3.0 → mambupy-2.3.2}/mambupy/utils/__init__.py +0 -0
  93. {mambupy-2.3.0 → mambupy-2.3.2}/mambupy/utils/update_user_roles.py +0 -0
  94. {mambupy-2.3.0 → mambupy-2.3.2}/mambupy/utils/userdeactivate.py +0 -0
  95. {mambupy-2.3.0 → mambupy-2.3.2}/pyproject.toml +0 -0
  96. {mambupy-2.3.0 → mambupy-2.3.2}/setup.cfg +0 -0
@@ -37,7 +37,7 @@ import sys
37
37
  from importlib.abc import MetaPathFinder
38
38
  from importlib.util import spec_from_file_location
39
39
 
40
- __version__ = "2.3.0"
40
+ __version__ = "2.3.2"
41
41
  """The version of this module."""
42
42
 
43
43
 
@@ -9,11 +9,14 @@ Currently supports REST.
9
9
 
10
10
  import base64
11
11
  import copy
12
+ import datetime
13
+ import enum
12
14
  import json
13
15
  import mimetypes
14
16
  import os
15
17
  import re
16
18
  import uuid
19
+ from decimal import Decimal
17
20
 
18
21
  import requests
19
22
  from requests_toolbelt.multipart.encoder import MultipartEncoder
@@ -43,6 +46,19 @@ from MambuPy.mambuutil import (
43
46
  logger = setup_logging(__name__)
44
47
 
45
48
 
49
+ class _MambuJSONEncoder(json.JSONEncoder):
50
+ """JSON encoder that handles Python types not natively serializable by json.dumps."""
51
+
52
+ def default(self, obj):
53
+ if isinstance(obj, (datetime.datetime, datetime.date)):
54
+ return obj.isoformat()
55
+ if isinstance(obj, enum.Enum):
56
+ return obj.value
57
+ if isinstance(obj, Decimal):
58
+ return float(obj)
59
+ return super().default(obj)
60
+
61
+
46
62
  def _configure_retry_strategy(session, retries=5):
47
63
  """Configure retry strategy for a session.
48
64
 
@@ -154,11 +170,8 @@ class MambuConnectorREST(MambuConnector, MambuConnectorReader, MambuConnectorWri
154
170
  return params
155
171
 
156
172
  def __request_data(self, data):
157
- if data is not None:
158
- try:
159
- data = json.dumps(data)
160
- except TypeError:
161
- data = data
173
+ if isinstance(data, (dict, list)):
174
+ data = json.dumps(data, cls=_MambuJSONEncoder)
162
175
  return data
163
176
 
164
177
  def __request(self, method, url, params=None, data=None, content_type=None):
@@ -6,6 +6,8 @@
6
6
  """
7
7
 
8
8
  import copy
9
+ import datetime
10
+ import enum
9
11
  from importlib import import_module
10
12
  import json
11
13
  import time
@@ -503,6 +505,10 @@ class MambuEntityWritable(MambuStruct, MambuWritable):
503
505
  val = attrs[field]["value"]
504
506
  except (TypeError, KeyError):
505
507
  val = attrs[field]
508
+ if isinstance(val, (datetime.datetime, datetime.date)):
509
+ val = val.isoformat()
510
+ elif isinstance(val, enum.Enum):
511
+ val = val.value
506
512
  return (operation, path, val)
507
513
 
508
514
  def __patch_field_op(self, field, original_attrs):
@@ -9,8 +9,6 @@ import copy
9
9
  import datetime
10
10
  import json
11
11
 
12
- from dateutil.tz import tzlocal
13
-
14
12
  from .entities import (
15
13
  MambuEntity,
16
14
  MambuEntityWritable,
@@ -184,32 +182,24 @@ class MambuLoan(
184
182
 
185
183
  if firstRepaymentDate:
186
184
  if not firstRepaymentDate.tzinfo:
187
- timezone_firstRepaymentDate = datetime.timezone(
188
- datetime.timedelta(
189
- hours=int(
190
- self.disbursementDetails._tzattrs["firstRepaymentDate"][-6:-3]
191
- )
192
- )
193
- )
194
- firstRepaymentDate = firstRepaymentDate.astimezone(
195
- timezone_firstRepaymentDate
196
- )
185
+ tzname = self.disbursementDetails._tzattrs["firstRepaymentDate"]
186
+ offset_str = tzname[3:] or "+00:00"
187
+ tz_info = datetime.datetime.fromisoformat(
188
+ "2000-01-01T00:00:00" + offset_str
189
+ ).tzinfo
190
+ firstRepaymentDate = firstRepaymentDate.astimezone(tz_info)
197
191
  firstRepaymentDate = firstRepaymentDate.isoformat()
198
192
  else:
199
193
  firstRepaymentDate = self.disbursementDetails.firstRepaymentDate
200
194
 
201
195
  if disbursementDate:
202
196
  if not disbursementDate.tzinfo:
203
- timezone_disbursementDate = datetime.timezone(
204
- datetime.timedelta(
205
- hours=int(
206
- self.disbursementDetails._tzattrs["expectedDisbursementDate"][
207
- -6:-3
208
- ]
209
- )
210
- )
211
- )
212
- disbursementDate = disbursementDate.astimezone(timezone_disbursementDate)
197
+ tzname = self.disbursementDetails._tzattrs["expectedDisbursementDate"]
198
+ offset_str = tzname[3:] or "+00:00"
199
+ tz_info = datetime.datetime.fromisoformat(
200
+ "2000-01-01T00:00:00" + offset_str
201
+ ).tzinfo
202
+ disbursementDate = disbursementDate.astimezone(tz_info)
213
203
  disbursementDate = disbursementDate.isoformat()
214
204
  else:
215
205
  disbursementDate = self.disbursementDetails.expectedDisbursementDate
@@ -265,10 +255,14 @@ class MambuLoan(
265
255
  structure defined at
266
256
  :py:obj:`MambuPy.api.vos.MambuLoanTransactionDetailsInput._schema_fields`.
267
257
  """
268
- valueDate = datetime.datetime.strptime(
269
- valueDate.strftime("%Y-%m-%d %H%M%S"), "%Y-%m-%d %H%M%S"
270
- )
271
- valueDate = valueDate.astimezone(tzlocal()).isoformat()
258
+ if not valueDate.tzinfo:
259
+ tzname = self.disbursementDetails._tzattrs["firstRepaymentDate"]
260
+ offset_str = tzname[3:] or "+00:00"
261
+ tz_info = datetime.datetime.fromisoformat(
262
+ "2000-01-01T00:00:00" + offset_str
263
+ ).tzinfo
264
+ valueDate = valueDate.astimezone(tz_info)
265
+ valueDate = valueDate.isoformat()
272
266
 
273
267
  self._connector.mambu_make_repayment(
274
268
  self.id,
@@ -312,10 +306,14 @@ class MambuLoan(
312
306
  request. :py:obj:`MambuPy.api.vos.MambuFeeLoanTransactionInput._schema_fields`
313
307
  has the allowed fields permitted for this operation
314
308
  """
315
- valueDate = datetime.datetime.strptime(
316
- valueDate.strftime("%Y-%m-%d %H%M%S"), "%Y-%m-%d %H%M%S"
317
- )
318
- valueDate = valueDate.astimezone(tzlocal()).isoformat()
309
+ if not valueDate.tzinfo:
310
+ tzname = self.disbursementDetails._tzattrs["firstRepaymentDate"]
311
+ offset_str = tzname[3:] or "+00:00"
312
+ tz_info = datetime.datetime.fromisoformat(
313
+ "2000-01-01T00:00:00" + offset_str
314
+ ).tzinfo
315
+ valueDate = valueDate.astimezone(tz_info)
316
+ valueDate = valueDate.isoformat()
319
317
 
320
318
  self._connector.mambu_make_fee(
321
319
  self.id,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: MambuPy
3
- Version: 2.3.0
3
+ Version: 2.3.2
4
4
  Summary: A python library for using Mambu APIs.
5
5
  Author-email: "Javier Novoa C." <jstitch@gmail.com>
6
6
  License: LICENSE
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: MambuPy
3
- Version: 2.3.0
3
+ Version: 2.3.2
4
4
  Summary: A python library for using Mambu APIs.
5
5
  Author-email: "Javier Novoa C." <jstitch@gmail.com>
6
6
  License: LICENSE
@@ -37,7 +37,7 @@ import sys
37
37
  from importlib.abc import MetaPathFinder
38
38
  from importlib.util import spec_from_file_location
39
39
 
40
- __version__ = "2.3.0"
40
+ __version__ = "2.3.2"
41
41
  """The version of this module."""
42
42
 
43
43
 
@@ -9,11 +9,14 @@ Currently supports REST.
9
9
 
10
10
  import base64
11
11
  import copy
12
+ import datetime
13
+ import enum
12
14
  import json
13
15
  import mimetypes
14
16
  import os
15
17
  import re
16
18
  import uuid
19
+ from decimal import Decimal
17
20
 
18
21
  import requests
19
22
  from requests_toolbelt.multipart.encoder import MultipartEncoder
@@ -43,6 +46,19 @@ from MambuPy.mambuutil import (
43
46
  logger = setup_logging(__name__)
44
47
 
45
48
 
49
+ class _MambuJSONEncoder(json.JSONEncoder):
50
+ """JSON encoder that handles Python types not natively serializable by json.dumps."""
51
+
52
+ def default(self, obj):
53
+ if isinstance(obj, (datetime.datetime, datetime.date)):
54
+ return obj.isoformat()
55
+ if isinstance(obj, enum.Enum):
56
+ return obj.value
57
+ if isinstance(obj, Decimal):
58
+ return float(obj)
59
+ return super().default(obj)
60
+
61
+
46
62
  def _configure_retry_strategy(session, retries=5):
47
63
  """Configure retry strategy for a session.
48
64
 
@@ -154,11 +170,8 @@ class MambuConnectorREST(MambuConnector, MambuConnectorReader, MambuConnectorWri
154
170
  return params
155
171
 
156
172
  def __request_data(self, data):
157
- if data is not None:
158
- try:
159
- data = json.dumps(data)
160
- except TypeError:
161
- data = data
173
+ if isinstance(data, (dict, list)):
174
+ data = json.dumps(data, cls=_MambuJSONEncoder)
162
175
  return data
163
176
 
164
177
  def __request(self, method, url, params=None, data=None, content_type=None):
@@ -6,6 +6,8 @@
6
6
  """
7
7
 
8
8
  import copy
9
+ import datetime
10
+ import enum
9
11
  from importlib import import_module
10
12
  import json
11
13
  import time
@@ -503,6 +505,10 @@ class MambuEntityWritable(MambuStruct, MambuWritable):
503
505
  val = attrs[field]["value"]
504
506
  except (TypeError, KeyError):
505
507
  val = attrs[field]
508
+ if isinstance(val, (datetime.datetime, datetime.date)):
509
+ val = val.isoformat()
510
+ elif isinstance(val, enum.Enum):
511
+ val = val.value
506
512
  return (operation, path, val)
507
513
 
508
514
  def __patch_field_op(self, field, original_attrs):
@@ -9,8 +9,6 @@ import copy
9
9
  import datetime
10
10
  import json
11
11
 
12
- from dateutil.tz import tzlocal
13
-
14
12
  from .entities import (
15
13
  MambuEntity,
16
14
  MambuEntityWritable,
@@ -184,32 +182,24 @@ class MambuLoan(
184
182
 
185
183
  if firstRepaymentDate:
186
184
  if not firstRepaymentDate.tzinfo:
187
- timezone_firstRepaymentDate = datetime.timezone(
188
- datetime.timedelta(
189
- hours=int(
190
- self.disbursementDetails._tzattrs["firstRepaymentDate"][-6:-3]
191
- )
192
- )
193
- )
194
- firstRepaymentDate = firstRepaymentDate.astimezone(
195
- timezone_firstRepaymentDate
196
- )
185
+ tzname = self.disbursementDetails._tzattrs["firstRepaymentDate"]
186
+ offset_str = tzname[3:] or "+00:00"
187
+ tz_info = datetime.datetime.fromisoformat(
188
+ "2000-01-01T00:00:00" + offset_str
189
+ ).tzinfo
190
+ firstRepaymentDate = firstRepaymentDate.astimezone(tz_info)
197
191
  firstRepaymentDate = firstRepaymentDate.isoformat()
198
192
  else:
199
193
  firstRepaymentDate = self.disbursementDetails.firstRepaymentDate
200
194
 
201
195
  if disbursementDate:
202
196
  if not disbursementDate.tzinfo:
203
- timezone_disbursementDate = datetime.timezone(
204
- datetime.timedelta(
205
- hours=int(
206
- self.disbursementDetails._tzattrs["expectedDisbursementDate"][
207
- -6:-3
208
- ]
209
- )
210
- )
211
- )
212
- disbursementDate = disbursementDate.astimezone(timezone_disbursementDate)
197
+ tzname = self.disbursementDetails._tzattrs["expectedDisbursementDate"]
198
+ offset_str = tzname[3:] or "+00:00"
199
+ tz_info = datetime.datetime.fromisoformat(
200
+ "2000-01-01T00:00:00" + offset_str
201
+ ).tzinfo
202
+ disbursementDate = disbursementDate.astimezone(tz_info)
213
203
  disbursementDate = disbursementDate.isoformat()
214
204
  else:
215
205
  disbursementDate = self.disbursementDetails.expectedDisbursementDate
@@ -265,10 +255,14 @@ class MambuLoan(
265
255
  structure defined at
266
256
  :py:obj:`MambuPy.api.vos.MambuLoanTransactionDetailsInput._schema_fields`.
267
257
  """
268
- valueDate = datetime.datetime.strptime(
269
- valueDate.strftime("%Y-%m-%d %H%M%S"), "%Y-%m-%d %H%M%S"
270
- )
271
- valueDate = valueDate.astimezone(tzlocal()).isoformat()
258
+ if not valueDate.tzinfo:
259
+ tzname = self.disbursementDetails._tzattrs["firstRepaymentDate"]
260
+ offset_str = tzname[3:] or "+00:00"
261
+ tz_info = datetime.datetime.fromisoformat(
262
+ "2000-01-01T00:00:00" + offset_str
263
+ ).tzinfo
264
+ valueDate = valueDate.astimezone(tz_info)
265
+ valueDate = valueDate.isoformat()
272
266
 
273
267
  self._connector.mambu_make_repayment(
274
268
  self.id,
@@ -312,10 +306,14 @@ class MambuLoan(
312
306
  request. :py:obj:`MambuPy.api.vos.MambuFeeLoanTransactionInput._schema_fields`
313
307
  has the allowed fields permitted for this operation
314
308
  """
315
- valueDate = datetime.datetime.strptime(
316
- valueDate.strftime("%Y-%m-%d %H%M%S"), "%Y-%m-%d %H%M%S"
317
- )
318
- valueDate = valueDate.astimezone(tzlocal()).isoformat()
309
+ if not valueDate.tzinfo:
310
+ tzname = self.disbursementDetails._tzattrs["firstRepaymentDate"]
311
+ offset_str = tzname[3:] or "+00:00"
312
+ tz_info = datetime.datetime.fromisoformat(
313
+ "2000-01-01T00:00:00" + offset_str
314
+ ).tzinfo
315
+ valueDate = valueDate.astimezone(tz_info)
316
+ valueDate = valueDate.isoformat()
319
317
 
320
318
  self._connector.mambu_make_fee(
321
319
  self.id,
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes