[chore]: Separated Simbrella to bank calls
This commit is contained in:
@@ -1,2 +1,3 @@
|
|||||||
# Byte-compiled / optimized / DLL files
|
# Byte-compiled / optimized / DLL files
|
||||||
__pycache__/
|
__pycache__/
|
||||||
|
.env
|
||||||
+3
-1
@@ -18,4 +18,6 @@ ENV FLASK_APP=app.py
|
|||||||
ENV FLASK_RUN_HOST=0.0.0.0
|
ENV FLASK_RUN_HOST=0.0.0.0
|
||||||
|
|
||||||
# Run the application
|
# Run the application
|
||||||
CMD ["flask", "run"]
|
CMD ["gunicorn", "-w", "4", "-b", "0.0.0.0:5000", "wsgi:wsgi_app"]
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,258 +1,127 @@
|
|||||||
2025-03-20 14:13:09,801 - INFO - [31m[1mWARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.[0m
|
2025-03-21 08:07:50,689 - INFO - [31m[1mWARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.[0m
|
||||||
* Running on all addresses (0.0.0.0)
|
* Running on all addresses (0.0.0.0)
|
||||||
* Running on http://127.0.0.1:5000
|
* Running on http://127.0.0.1:5000
|
||||||
* Running on http://192.168.43.192:5000
|
* Running on http://172.21.0.2:5000
|
||||||
2025-03-20 14:13:09,802 - INFO - [33mPress CTRL+C to quit[0m
|
2025-03-21 08:07:50,689 - INFO - [33mPress CTRL+C to quit[0m
|
||||||
2025-03-20 14:13:09,804 - INFO - * Restarting with stat
|
2025-03-21 08:25:00,902 - INFO - [31m[1mWARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.[0m
|
||||||
2025-03-20 14:13:10,513 - WARNING - * Debugger is active!
|
* Running on all addresses (0.0.0.0)
|
||||||
2025-03-20 14:13:10,534 - INFO - * Debugger PIN: 716-001-293
|
* Running on http://127.0.0.1:5000
|
||||||
2025-03-20 14:13:18,851 - INFO - 127.0.0.1 - - [20/Mar/2025 14:13:18] "[33mGET / HTTP/1.1[0m" 404 -
|
* Running on http://172.21.0.2:5000
|
||||||
2025-03-20 14:13:19,654 - INFO - 127.0.0.1 - - [20/Mar/2025 14:13:19] "[33mGET /favicon.ico HTTP/1.1[0m" 404 -
|
2025-03-21 08:25:00,903 - INFO - [33mPress CTRL+C to quit[0m
|
||||||
2025-03-20 14:14:03,987 - INFO - 127.0.0.1 - - [20/Mar/2025 14:14:03] "[31m[1mGET /EligibilityCheck HTTP/1.1[0m" 405 -
|
2025-03-21 08:27:59,768 - INFO - before_request middleware triggered
|
||||||
2025-03-20 14:14:14,898 - INFO - 127.0.0.1 - - [20/Mar/2025 14:14:14] "[31m[1mGET /EligibilityCheck HTTP/1.1[0m" 405 -
|
2025-03-21 08:27:59,772 - ERROR - Unauthorized access: Missing API key.
|
||||||
2025-03-20 14:14:21,063 - INFO - 127.0.0.1 - - [20/Mar/2025 14:14:21] "[31m[1mPOST /EligibilityCheck HTTP/1.1[0m" 415 -
|
2025-03-21 08:27:59,774 - INFO - 172.21.0.1 - - [21/Mar/2025 08:27:59] "GET /health HTTP/1.1" 200 -
|
||||||
2025-03-20 14:14:40,328 - INFO - 127.0.0.1 - - [20/Mar/2025 14:14:40] "[31m[1mPOST /EligibilityCheck HTTP/1.1[0m" 415 -
|
2025-03-21 08:27:59,921 - INFO - 172.21.0.1 - - [21/Mar/2025 08:27:59] "[33mGET /favicon.ico HTTP/1.1[0m" 404 -
|
||||||
2025-03-20 14:15:52,642 - INFO - EligibilityCheck request received: {'hi': 'bye'}
|
2025-03-21 08:28:47,107 - INFO - before_request middleware triggered
|
||||||
2025-03-20 14:15:52,643 - INFO - Processing EligibilityCheck request
|
2025-03-21 08:28:47,108 - ERROR - Unauthorized access: Missing API key.
|
||||||
2025-03-20 14:15:52,647 - ERROR - An error occurred during EligibilityCheck processing: {'income': ['Missing data for required field.'], 'user_id': ['Missing data for required field.'], 'credit_score': ['Missing data for required field.'], 'hi': ['Unknown field.']}
|
2025-03-21 08:28:47,111 - INFO - 172.21.0.1 - - [21/Mar/2025 08:28:47] "POST /Disbursement HTTP/1.1" 200 -
|
||||||
|
2025-03-21 08:30:01,346 - INFO - before_request middleware triggered
|
||||||
|
2025-03-21 08:30:01,350 - INFO - Processing Disbursement request
|
||||||
|
2025-03-21 08:30:01,352 - ERROR - Validation Error: {'countryId': ['Missing data for required field.'], 'collectAmountMgtFee': ['Missing data for required field.'], 'requestId': ['Missing data for required field.'], 'debtId': ['Missing data for required field.'], 'provideAmount': ['Missing data for required field.'], 'collectAmountVAT': ['Missing data for required field.'], 'collectAmountInsurance': ['Missing data for required field.'], 'productId': ['Missing data for required field.'], 'msisdn': ['Unknown field.'], 'channel': ['Unknown field.'], 'lienAmount': ['Unknown field.'], '$type': ['Unknown field.'], 'countryCode': ['Unknown field.']}
|
||||||
|
2025-03-21 08:30:01,353 - INFO - 172.21.0.1 - - [21/Mar/2025 08:30:01] "POST /Disbursement HTTP/1.1" 200 -
|
||||||
|
2025-03-21 08:34:16,957 - INFO - before_request middleware triggered
|
||||||
|
2025-03-21 08:34:16,960 - INFO - Processing Disbursement request
|
||||||
|
2025-03-21 08:34:16,970 - ERROR - Validation Error: {'countryId': ['Missing data for required field.'], 'collectAmountMgtFee': ['Missing data for required field.'], 'requestId': ['Missing data for required field.'], 'debtId': ['Missing data for required field.'], 'provideAmount': ['Missing data for required field.'], 'collectAmountVAT': ['Missing data for required field.'], 'collectAmountInsurance': ['Missing data for required field.'], 'productId': ['Missing data for required field.'], 'msisdn': ['Unknown field.'], 'channel': ['Unknown field.'], 'lienAmount': ['Unknown field.'], '$type': ['Unknown field.'], 'countryCode': ['Unknown field.']}
|
||||||
|
2025-03-21 08:34:16,973 - INFO - 172.21.0.1 - - [21/Mar/2025 08:34:16] "POST /Disbursement HTTP/1.1" 200 -
|
||||||
|
2025-03-21 08:38:52,829 - INFO - [31m[1mWARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.[0m
|
||||||
|
* Running on all addresses (0.0.0.0)
|
||||||
|
* Running on http://127.0.0.1:5000
|
||||||
|
* Running on http://172.21.0.2:5000
|
||||||
|
2025-03-21 08:38:52,829 - INFO - [33mPress CTRL+C to quit[0m
|
||||||
|
2025-03-21 08:44:44,426 - INFO - before_request middleware triggered
|
||||||
|
2025-03-21 08:44:44,430 - ERROR - Exception on /Disbursement [POST]
|
||||||
Traceback (most recent call last):
|
Traceback (most recent call last):
|
||||||
File "/Users/viviandagbue/Documents/livelinessCheckYOLO/app/blueprints/eligibility_check.py", line 23, in process_request
|
File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 2190, in wsgi_app
|
||||||
validated_data = schema.load(data) # Raises an error if invalid
|
response = self.full_dispatch_request()
|
||||||
File "/Users/viviandagbue/Documents/venv/lib/python3.9/site-packages/marshmallow/schema.py", line 722, in load
|
File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1486, in full_dispatch_request
|
||||||
return self._do_load(
|
rv = self.handle_user_exception(e)
|
||||||
File "/Users/viviandagbue/Documents/venv/lib/python3.9/site-packages/marshmallow/schema.py", line 909, in _do_load
|
File "/usr/local/lib/python3.9/site-packages/flask_cors/extension.py", line 165, in wrapped_function
|
||||||
raise exc
|
return cors_after_request(app.make_response(f(*args, **kwargs)))
|
||||||
marshmallow.exceptions.ValidationError: {'income': ['Missing data for required field.'], 'user_id': ['Missing data for required field.'], 'credit_score': ['Missing data for required field.'], 'hi': ['Unknown field.']}
|
File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1482, in full_dispatch_request
|
||||||
2025-03-20 14:15:52,683 - INFO - 127.0.0.1 - - [20/Mar/2025 14:15:52] "POST /EligibilityCheck HTTP/1.1" 200 -
|
rv = self.preprocess_request()
|
||||||
2025-03-20 14:27:54,479 - INFO - * Detected change in '/Users/viviandagbue/Documents/livelinessCheckYOLO/app/routes/main.py', reloading
|
File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1974, in preprocess_request
|
||||||
2025-03-20 14:27:54,721 - INFO - * Restarting with stat
|
rv = self.ensure_sync(before_func)()
|
||||||
2025-03-20 14:27:56,270 - WARNING - * Debugger is active!
|
File "/app/app/routes/routes.py", line 24, in require_api_key_middleware
|
||||||
2025-03-20 14:27:56,301 - INFO - * Debugger PIN: 716-001-293
|
return require_api_key()
|
||||||
2025-03-20 14:28:00,496 - INFO - * Detected change in '/Users/viviandagbue/Documents/livelinessCheckYOLO/app/routes/main.py', reloading
|
TypeError: require_api_key() missing 1 required positional argument: 'f'
|
||||||
2025-03-20 14:28:00,704 - INFO - * Restarting with stat
|
2025-03-21 08:44:44,446 - INFO - 172.21.0.1 - - [21/Mar/2025 08:44:44] "[35m[1mPOST /Disbursement HTTP/1.1[0m" 500 -
|
||||||
2025-03-20 14:28:01,613 - WARNING - * Debugger is active!
|
2025-03-21 09:02:19,681 - INFO - before_request middleware triggered
|
||||||
2025-03-20 14:28:01,691 - INFO - * Debugger PIN: 716-001-293
|
2025-03-21 09:02:19,683 - ERROR - Exception on /Disbursement [POST]
|
||||||
2025-03-20 14:28:03,809 - INFO - * Detected change in '/Users/viviandagbue/Documents/livelinessCheckYOLO/app/routes/main.py', reloading
|
|
||||||
2025-03-20 14:28:04,018 - INFO - * Restarting with stat
|
|
||||||
2025-03-20 14:28:04,870 - WARNING - * Debugger is active!
|
|
||||||
2025-03-20 14:28:04,886 - INFO - * Debugger PIN: 716-001-293
|
|
||||||
2025-03-20 14:28:07,012 - INFO - * Detected change in '/Users/viviandagbue/Documents/livelinessCheckYOLO/app/routes/main.py', reloading
|
|
||||||
2025-03-20 14:28:07,200 - INFO - * Restarting with stat
|
|
||||||
2025-03-20 14:28:08,193 - WARNING - * Debugger is active!
|
|
||||||
2025-03-20 14:28:08,206 - INFO - * Debugger PIN: 716-001-293
|
|
||||||
2025-03-20 14:28:10,289 - INFO - * Detected change in '/Users/viviandagbue/Documents/livelinessCheckYOLO/app/routes/main.py', reloading
|
|
||||||
2025-03-20 14:28:10,503 - INFO - * Restarting with stat
|
|
||||||
2025-03-20 14:28:11,437 - WARNING - * Debugger is active!
|
|
||||||
2025-03-20 14:28:11,456 - INFO - * Debugger PIN: 716-001-293
|
|
||||||
2025-03-20 14:28:13,532 - INFO - * Detected change in '/Users/viviandagbue/Documents/livelinessCheckYOLO/app/routes/main.py', reloading
|
|
||||||
2025-03-20 14:28:13,750 - INFO - * Restarting with stat
|
|
||||||
2025-03-20 14:28:14,774 - WARNING - * Debugger is active!
|
|
||||||
2025-03-20 14:28:14,815 - INFO - * Debugger PIN: 716-001-293
|
|
||||||
2025-03-20 14:28:17,101 - INFO - * Detected change in '/Users/viviandagbue/Documents/livelinessCheckYOLO/app/routes/main.py', reloading
|
|
||||||
2025-03-20 14:28:17,262 - INFO - * Restarting with stat
|
|
||||||
2025-03-20 14:28:18,410 - WARNING - * Debugger is active!
|
|
||||||
2025-03-20 14:28:18,428 - INFO - * Debugger PIN: 716-001-293
|
|
||||||
2025-03-20 14:28:19,512 - INFO - * Detected change in '/Users/viviandagbue/Documents/livelinessCheckYOLO/app/routes/main.py', reloading
|
|
||||||
2025-03-20 14:28:19,690 - INFO - * Restarting with stat
|
|
||||||
2025-03-20 14:28:20,801 - WARNING - * Debugger is active!
|
|
||||||
2025-03-20 14:28:20,936 - INFO - * Debugger PIN: 716-001-293
|
|
||||||
2025-03-20 14:28:41,355 - INFO - * Detected change in '/Users/viviandagbue/Documents/livelinessCheckYOLO/app/config.py', reloading
|
|
||||||
2025-03-20 14:28:41,499 - INFO - * Restarting with stat
|
|
||||||
2025-03-20 14:28:42,243 - WARNING - * Debugger is active!
|
|
||||||
2025-03-20 14:28:42,255 - INFO - * Debugger PIN: 716-001-293
|
|
||||||
2025-03-20 14:28:45,329 - INFO - * Detected change in '/Users/viviandagbue/Documents/livelinessCheckYOLO/app/config.py', reloading
|
|
||||||
2025-03-20 14:28:45,519 - INFO - * Restarting with stat
|
|
||||||
2025-03-20 14:28:46,382 - WARNING - * Debugger is active!
|
|
||||||
2025-03-20 14:28:46,403 - INFO - * Debugger PIN: 716-001-293
|
|
||||||
2025-03-20 14:28:51,552 - INFO - * Detected change in '/Users/viviandagbue/Documents/livelinessCheckYOLO/app/config.py', reloading
|
|
||||||
2025-03-20 14:28:51,712 - INFO - * Restarting with stat
|
|
||||||
2025-03-20 14:28:52,758 - WARNING - * Debugger is active!
|
|
||||||
2025-03-20 14:28:52,792 - INFO - * Debugger PIN: 716-001-293
|
|
||||||
2025-03-20 14:29:13,307 - INFO - * Detected change in '/Users/viviandagbue/Documents/livelinessCheckYOLO/app/routes/main.py', reloading
|
|
||||||
2025-03-20 14:29:13,443 - INFO - * Restarting with stat
|
|
||||||
2025-03-20 14:29:15,136 - WARNING - * Debugger is active!
|
|
||||||
2025-03-20 14:29:15,155 - INFO - * Debugger PIN: 716-001-293
|
|
||||||
2025-03-20 14:29:24,320 - INFO - * Detected change in '/Users/viviandagbue/Documents/livelinessCheckYOLO/app/routes/main.py', reloading
|
|
||||||
2025-03-20 14:29:24,462 - INFO - * Restarting with stat
|
|
||||||
2025-03-20 14:29:25,635 - WARNING - * Debugger is active!
|
|
||||||
2025-03-20 14:29:25,668 - INFO - * Debugger PIN: 716-001-293
|
|
||||||
2025-03-20 14:29:39,423 - INFO - 127.0.0.1 - - [20/Mar/2025 14:29:39] "[31m[1mPOST /health HTTP/1.1[0m" 405 -
|
|
||||||
2025-03-20 14:30:17,001 - INFO - * Detected change in '/Users/viviandagbue/Documents/livelinessCheckYOLO/app/routes/__init__.py', reloading
|
|
||||||
2025-03-20 14:30:17,444 - INFO - * Restarting with stat
|
|
||||||
2025-03-20 14:30:20,724 - WARNING - * Debugger is active!
|
|
||||||
2025-03-20 14:30:20,742 - INFO - * Debugger PIN: 716-001-293
|
|
||||||
2025-03-20 14:37:21,240 - INFO - * Detected change in '/Users/viviandagbue/Documents/livelinessCheckYOLO/app/middlewares/__init__.py', reloading
|
|
||||||
2025-03-20 14:37:21,737 - INFO - * Restarting with stat
|
|
||||||
2025-03-20 14:37:23,075 - WARNING - * Debugger is active!
|
|
||||||
2025-03-20 14:37:23,088 - INFO - * Debugger PIN: 716-001-293
|
|
||||||
2025-03-20 14:39:23,292 - INFO - * Detected change in '/Users/viviandagbue/Documents/livelinessCheckYOLO/app/middlewares/verify_api_key.py', reloading
|
|
||||||
2025-03-20 14:39:23,563 - INFO - * Restarting with stat
|
|
||||||
2025-03-20 14:39:25,229 - WARNING - * Debugger is active!
|
|
||||||
2025-03-20 14:39:25,254 - INFO - * Debugger PIN: 716-001-293
|
|
||||||
2025-03-20 14:39:26,355 - INFO - * Detected change in '/Users/viviandagbue/Documents/livelinessCheckYOLO/app/middlewares/verify_api_key.py', reloading
|
|
||||||
2025-03-20 14:39:26,517 - INFO - * Restarting with stat
|
|
||||||
2025-03-20 14:39:27,457 - WARNING - * Debugger is active!
|
|
||||||
2025-03-20 14:39:27,476 - INFO - * Debugger PIN: 716-001-293
|
|
||||||
2025-03-20 14:41:20,187 - INFO - * Detected change in '/Users/viviandagbue/Documents/livelinessCheckYOLO/app/middlewares/encryption.py', reloading
|
|
||||||
2025-03-20 14:41:20,429 - INFO - * Restarting with stat
|
|
||||||
2025-03-20 14:41:21,622 - WARNING - * Debugger is active!
|
|
||||||
2025-03-20 14:41:21,634 - INFO - * Debugger PIN: 716-001-293
|
|
||||||
2025-03-20 14:42:03,558 - INFO - * Detected change in '/Users/viviandagbue/Documents/livelinessCheckYOLO/app/middlewares/cors.py', reloading
|
|
||||||
2025-03-20 14:42:03,709 - INFO - * Restarting with stat
|
|
||||||
2025-03-20 14:42:05,112 - WARNING - * Debugger is active!
|
|
||||||
2025-03-20 14:42:05,137 - INFO - * Debugger PIN: 716-001-293
|
|
||||||
2025-03-20 14:42:30,565 - INFO - * Detected change in '/Users/viviandagbue/Documents/livelinessCheckYOLO/app/middlewares/cors.py', reloading
|
|
||||||
2025-03-20 14:42:30,976 - INFO - * Restarting with stat
|
|
||||||
2025-03-20 14:42:32,051 - WARNING - * Debugger is active!
|
|
||||||
2025-03-20 14:42:32,065 - INFO - * Debugger PIN: 716-001-293
|
|
||||||
2025-03-20 14:43:14,856 - INFO - * Detected change in '/Users/viviandagbue/Documents/livelinessCheckYOLO/app/middlewares/request_validator.py', reloading
|
|
||||||
2025-03-20 14:43:15,006 - INFO - * Restarting with stat
|
|
||||||
2025-03-20 14:43:16,050 - WARNING - * Debugger is active!
|
|
||||||
2025-03-20 14:43:16,062 - INFO - * Debugger PIN: 716-001-293
|
|
||||||
2025-03-20 14:44:03,834 - INFO - * Detected change in '/Users/viviandagbue/Documents/livelinessCheckYOLO/app/middlewares/request_validator.py', reloading
|
|
||||||
2025-03-20 14:44:04,003 - INFO - * Restarting with stat
|
|
||||||
2025-03-20 14:44:05,142 - WARNING - * Debugger is active!
|
|
||||||
2025-03-20 14:44:05,182 - INFO - * Debugger PIN: 716-001-293
|
|
||||||
2025-03-20 14:44:09,364 - INFO - * Detected change in '/Users/viviandagbue/Documents/livelinessCheckYOLO/app/middlewares/request_validator.py', reloading
|
|
||||||
2025-03-20 14:44:09,512 - INFO - * Restarting with stat
|
|
||||||
2025-03-20 14:44:10,512 - WARNING - * Debugger is active!
|
|
||||||
2025-03-20 14:44:10,548 - INFO - * Debugger PIN: 716-001-293
|
|
||||||
2025-03-20 14:44:11,658 - INFO - * Detected change in '/Users/viviandagbue/Documents/livelinessCheckYOLO/app/middlewares/request_validator.py', reloading
|
|
||||||
2025-03-20 14:44:11,834 - INFO - * Restarting with stat
|
|
||||||
2025-03-20 14:44:12,885 - WARNING - * Debugger is active!
|
|
||||||
2025-03-20 14:44:12,904 - INFO - * Debugger PIN: 716-001-293
|
|
||||||
2025-03-20 14:44:37,478 - INFO - * Detected change in '/Users/viviandagbue/Documents/livelinessCheckYOLO/app/middlewares/request_validator.py', reloading
|
|
||||||
2025-03-20 14:44:37,636 - INFO - * Restarting with stat
|
|
||||||
2025-03-20 14:44:38,872 - WARNING - * Debugger is active!
|
|
||||||
2025-03-20 14:44:38,889 - INFO - * Debugger PIN: 716-001-293
|
|
||||||
2025-03-20 14:44:52,116 - INFO - * Detected change in '/Users/viviandagbue/Documents/livelinessCheckYOLO/app/middlewares/request_validator.py', reloading
|
|
||||||
2025-03-20 14:44:52,260 - INFO - * Restarting with stat
|
|
||||||
2025-03-20 14:44:53,048 - WARNING - * Debugger is active!
|
|
||||||
2025-03-20 14:44:53,061 - INFO - * Debugger PIN: 716-001-293
|
|
||||||
2025-03-20 14:44:54,180 - INFO - * Detected change in '/Users/viviandagbue/Documents/livelinessCheckYOLO/app/middlewares/request_validator.py', reloading
|
|
||||||
2025-03-20 14:44:54,328 - INFO - * Restarting with stat
|
|
||||||
2025-03-20 14:44:55,536 - WARNING - * Debugger is active!
|
|
||||||
2025-03-20 14:44:55,549 - INFO - * Debugger PIN: 716-001-293
|
|
||||||
2025-03-20 14:44:56,596 - INFO - * Detected change in '/Users/viviandagbue/Documents/livelinessCheckYOLO/app/middlewares/request_validator.py', reloading
|
|
||||||
2025-03-20 14:44:56,745 - INFO - * Restarting with stat
|
|
||||||
2025-03-20 14:44:57,615 - WARNING - * Debugger is active!
|
|
||||||
2025-03-20 14:44:57,627 - INFO - * Debugger PIN: 716-001-293
|
|
||||||
2025-03-20 14:44:59,795 - INFO - * Detected change in '/Users/viviandagbue/Documents/livelinessCheckYOLO/app/middlewares/request_validator.py', reloading
|
|
||||||
2025-03-20 14:45:00,013 - INFO - * Restarting with stat
|
|
||||||
2025-03-20 14:45:00,839 - WARNING - * Debugger is active!
|
|
||||||
2025-03-20 14:45:00,854 - INFO - * Debugger PIN: 716-001-293
|
|
||||||
2025-03-20 14:45:05,953 - INFO - * Detected change in '/Users/viviandagbue/Documents/livelinessCheckYOLO/app/middlewares/request_validator.py', reloading
|
|
||||||
2025-03-20 14:45:06,143 - INFO - * Restarting with stat
|
|
||||||
2025-03-20 14:45:06,976 - WARNING - * Debugger is active!
|
|
||||||
2025-03-20 14:45:06,992 - INFO - * Debugger PIN: 716-001-293
|
|
||||||
2025-03-20 14:45:09,077 - INFO - * Detected change in '/Users/viviandagbue/Documents/livelinessCheckYOLO/app/middlewares/request_validator.py', reloading
|
|
||||||
2025-03-20 14:45:09,366 - INFO - * Restarting with stat
|
|
||||||
2025-03-20 14:45:10,260 - WARNING - * Debugger is active!
|
|
||||||
2025-03-20 14:45:10,491 - INFO - * Debugger PIN: 716-001-293
|
|
||||||
2025-03-20 14:45:11,571 - INFO - * Detected change in '/Users/viviandagbue/Documents/livelinessCheckYOLO/app/middlewares/request_validator.py', reloading
|
|
||||||
2025-03-20 14:45:11,748 - INFO - * Restarting with stat
|
|
||||||
2025-03-20 14:45:12,615 - WARNING - * Debugger is active!
|
|
||||||
2025-03-20 14:45:12,631 - INFO - * Debugger PIN: 716-001-293
|
|
||||||
2025-03-20 14:45:14,690 - INFO - * Detected change in '/Users/viviandagbue/Documents/livelinessCheckYOLO/app/middlewares/request_validator.py', reloading
|
|
||||||
2025-03-20 14:45:14,821 - INFO - * Restarting with stat
|
|
||||||
2025-03-20 14:45:15,576 - WARNING - * Debugger is active!
|
|
||||||
2025-03-20 14:45:15,597 - INFO - * Debugger PIN: 716-001-293
|
|
||||||
2025-03-20 14:47:55,793 - INFO - * Detected change in '/Users/viviandagbue/Documents/livelinessCheckYOLO/app/__init__.py', reloading
|
|
||||||
2025-03-20 14:47:56,010 - INFO - * Restarting with stat
|
|
||||||
2025-03-20 14:48:23,203 - INFO - [31m[1mWARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.[0m
|
|
||||||
* Running on all addresses (0.0.0.0)
|
|
||||||
* Running on http://127.0.0.1:5000
|
|
||||||
* Running on http://192.168.43.192:5000
|
|
||||||
2025-03-20 14:48:23,204 - INFO - [33mPress CTRL+C to quit[0m
|
|
||||||
2025-03-20 14:48:23,208 - INFO - * Restarting with stat
|
|
||||||
2025-03-20 14:48:25,258 - WARNING - * Debugger is active!
|
|
||||||
2025-03-20 14:48:25,331 - INFO - * Debugger PIN: 716-001-293
|
|
||||||
2025-03-20 14:48:30,183 - INFO - 127.0.0.1 - - [20/Mar/2025 14:48:30] "[31m[1mPOST /api/health HTTP/1.1[0m" 405 -
|
|
||||||
2025-03-20 14:48:35,969 - INFO - 127.0.0.1 - - [20/Mar/2025 14:48:35] "GET /api/health HTTP/1.1" 200 -
|
|
||||||
2025-03-20 14:53:13,504 - INFO - * Detected change in '/Users/viviandagbue/Documents/livelinessCheckYOLO/app/schemas/eligibility_check.py', reloading
|
|
||||||
2025-03-20 14:53:14,721 - INFO - * Restarting with stat
|
|
||||||
2025-03-20 14:53:20,279 - WARNING - * Debugger is active!
|
|
||||||
2025-03-20 14:53:20,384 - INFO - * Debugger PIN: 716-001-293
|
|
||||||
2025-03-20 14:54:16,579 - INFO - * Detected change in '/Users/viviandagbue/Documents/livelinessCheckYOLO/app/blueprints/eligibility_check.py', reloading
|
|
||||||
2025-03-20 14:54:17,245 - INFO - * Restarting with stat
|
|
||||||
2025-03-20 14:54:21,211 - WARNING - * Debugger is active!
|
|
||||||
2025-03-20 14:54:21,298 - INFO - * Debugger PIN: 716-001-293
|
|
||||||
2025-03-20 14:54:32,913 - INFO - * Detected change in '/Users/viviandagbue/Documents/livelinessCheckYOLO/app/blueprints/eligibility_check.py', reloading
|
|
||||||
2025-03-20 14:54:33,587 - INFO - * Restarting with stat
|
|
||||||
2025-03-20 14:54:36,684 - WARNING - * Debugger is active!
|
|
||||||
2025-03-20 14:54:36,850 - INFO - * Debugger PIN: 716-001-293
|
|
||||||
2025-03-20 14:54:38,191 - INFO - * Detected change in '/Users/viviandagbue/Documents/livelinessCheckYOLO/app/blueprints/eligibility_check.py', reloading
|
|
||||||
2025-03-20 14:54:38,906 - INFO - * Restarting with stat
|
|
||||||
2025-03-20 14:54:44,502 - WARNING - * Debugger is active!
|
|
||||||
2025-03-20 14:54:44,539 - INFO - * Debugger PIN: 716-001-293
|
|
||||||
2025-03-20 14:55:04,187 - INFO - 127.0.0.1 - - [20/Mar/2025 14:55:04] "[31m[1mGET /api/EligibilityCheck HTTP/1.1[0m" 405 -
|
|
||||||
2025-03-20 14:55:10,064 - INFO - Processing EligibilityCheck request
|
|
||||||
2025-03-20 14:55:10,073 - ERROR - An error occurred during EligibilityCheck processing: {'lien_amount': ['Missing data for required field.'], 'lienAmount': ['Unknown field.']}
|
|
||||||
Traceback (most recent call last):
|
Traceback (most recent call last):
|
||||||
File "/Users/viviandagbue/Documents/livelinessCheckYOLO/app/blueprints/eligibility_check.py", line 23, in process_request
|
File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 2190, in wsgi_app
|
||||||
validated_data = schema.load(data) # Raises an error if invalid
|
response = self.full_dispatch_request()
|
||||||
File "/Users/viviandagbue/Documents/venv/lib/python3.9/site-packages/marshmallow/schema.py", line 722, in load
|
File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1486, in full_dispatch_request
|
||||||
return self._do_load(
|
rv = self.handle_user_exception(e)
|
||||||
File "/Users/viviandagbue/Documents/venv/lib/python3.9/site-packages/marshmallow/schema.py", line 909, in _do_load
|
File "/usr/local/lib/python3.9/site-packages/flask_cors/extension.py", line 165, in wrapped_function
|
||||||
raise exc
|
return cors_after_request(app.make_response(f(*args, **kwargs)))
|
||||||
marshmallow.exceptions.ValidationError: {'lien_amount': ['Missing data for required field.'], 'lienAmount': ['Unknown field.']}
|
File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1482, in full_dispatch_request
|
||||||
2025-03-20 14:55:10,103 - INFO - 127.0.0.1 - - [20/Mar/2025 14:55:10] "POST /api/EligibilityCheck HTTP/1.1" 200 -
|
rv = self.preprocess_request()
|
||||||
2025-03-20 14:55:37,613 - INFO - * Detected change in '/Users/viviandagbue/Documents/livelinessCheckYOLO/app/schemas/eligibility_check.py', reloading
|
File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1974, in preprocess_request
|
||||||
2025-03-20 14:55:38,428 - INFO - * Restarting with stat
|
rv = self.ensure_sync(before_func)()
|
||||||
2025-03-20 14:55:47,297 - WARNING - * Debugger is active!
|
File "/app/app/routes/routes.py", line 24, in require_api_key_middleware
|
||||||
2025-03-20 14:55:47,413 - INFO - * Debugger PIN: 716-001-293
|
return require_api_key()
|
||||||
2025-03-20 14:55:51,943 - INFO - * Detected change in '/Users/viviandagbue/Documents/livelinessCheckYOLO/app/schemas/eligibility_check.py', reloading
|
TypeError: require_api_key() missing 1 required positional argument: 'f'
|
||||||
2025-03-20 14:55:52,455 - INFO - * Restarting with stat
|
2025-03-21 09:02:19,685 - INFO - 172.21.0.1 - - [21/Mar/2025 09:02:19] "[35m[1mPOST /Disbursement HTTP/1.1[0m" 500 -
|
||||||
2025-03-20 14:55:56,940 - WARNING - * Debugger is active!
|
2025-03-21 09:02:24,680 - INFO - before_request middleware triggered
|
||||||
2025-03-20 14:55:56,968 - INFO - * Debugger PIN: 716-001-293
|
2025-03-21 09:02:24,681 - ERROR - Exception on /Disbursement [POST]
|
||||||
2025-03-20 14:56:01,718 - INFO - Processing EligibilityCheck request
|
Traceback (most recent call last):
|
||||||
2025-03-20 14:56:01,737 - INFO - 127.0.0.1 - - [20/Mar/2025 14:56:01] "POST /api/EligibilityCheck HTTP/1.1" 200 -
|
File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 2190, in wsgi_app
|
||||||
2025-03-20 14:59:24,543 - INFO - * Detected change in '/Users/viviandagbue/Documents/livelinessCheckYOLO/app/schemas/select_offer.py', reloading
|
response = self.full_dispatch_request()
|
||||||
2025-03-20 14:59:25,271 - INFO - * Restarting with stat
|
File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1486, in full_dispatch_request
|
||||||
2025-03-20 14:59:31,688 - WARNING - * Debugger is active!
|
rv = self.handle_user_exception(e)
|
||||||
2025-03-20 14:59:31,738 - INFO - * Debugger PIN: 716-001-293
|
File "/usr/local/lib/python3.9/site-packages/flask_cors/extension.py", line 165, in wrapped_function
|
||||||
2025-03-20 15:00:44,032 - INFO - * Detected change in '/Users/viviandagbue/Documents/livelinessCheckYOLO/app/blueprints/select_offer.py', reloading
|
return cors_after_request(app.make_response(f(*args, **kwargs)))
|
||||||
2025-03-20 15:00:44,863 - INFO - * Restarting with stat
|
File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1482, in full_dispatch_request
|
||||||
2025-03-20 15:00:52,010 - WARNING - * Debugger is active!
|
rv = self.preprocess_request()
|
||||||
2025-03-20 15:00:52,134 - INFO - * Debugger PIN: 716-001-293
|
File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1974, in preprocess_request
|
||||||
2025-03-20 15:00:53,368 - INFO - * Detected change in '/Users/viviandagbue/Documents/livelinessCheckYOLO/app/blueprints/select_offer.py', reloading
|
rv = self.ensure_sync(before_func)()
|
||||||
2025-03-20 15:00:53,663 - INFO - * Restarting with stat
|
File "/app/app/routes/routes.py", line 24, in require_api_key_middleware
|
||||||
2025-03-20 17:05:48,612 - INFO - [31m[1mWARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.[0m
|
return require_api_key()
|
||||||
|
TypeError: require_api_key() missing 1 required positional argument: 'f'
|
||||||
|
2025-03-21 09:02:24,683 - INFO - 172.21.0.1 - - [21/Mar/2025 09:02:24] "[35m[1mPOST /Disbursement HTTP/1.1[0m" 500 -
|
||||||
|
2025-03-21 09:03:00,120 - INFO - before_request middleware triggered
|
||||||
|
2025-03-21 09:03:00,121 - ERROR - Exception on /Disbursement [POST]
|
||||||
|
Traceback (most recent call last):
|
||||||
|
File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 2190, in wsgi_app
|
||||||
|
response = self.full_dispatch_request()
|
||||||
|
File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1486, in full_dispatch_request
|
||||||
|
rv = self.handle_user_exception(e)
|
||||||
|
File "/usr/local/lib/python3.9/site-packages/flask_cors/extension.py", line 165, in wrapped_function
|
||||||
|
return cors_after_request(app.make_response(f(*args, **kwargs)))
|
||||||
|
File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1482, in full_dispatch_request
|
||||||
|
rv = self.preprocess_request()
|
||||||
|
File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1974, in preprocess_request
|
||||||
|
rv = self.ensure_sync(before_func)()
|
||||||
|
File "/app/app/routes/routes.py", line 24, in require_api_key_middleware
|
||||||
|
return require_api_key()
|
||||||
|
TypeError: require_api_key() missing 1 required positional argument: 'f'
|
||||||
|
2025-03-21 09:03:00,122 - INFO - 172.21.0.1 - - [21/Mar/2025 09:03:00] "[35m[1mPOST /Disbursement HTTP/1.1[0m" 500 -
|
||||||
|
2025-03-21 09:03:03,022 - INFO - before_request middleware triggered
|
||||||
|
2025-03-21 09:03:03,023 - ERROR - Exception on /Disbursement [POST]
|
||||||
|
Traceback (most recent call last):
|
||||||
|
File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 2190, in wsgi_app
|
||||||
|
response = self.full_dispatch_request()
|
||||||
|
File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1486, in full_dispatch_request
|
||||||
|
rv = self.handle_user_exception(e)
|
||||||
|
File "/usr/local/lib/python3.9/site-packages/flask_cors/extension.py", line 165, in wrapped_function
|
||||||
|
return cors_after_request(app.make_response(f(*args, **kwargs)))
|
||||||
|
File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1482, in full_dispatch_request
|
||||||
|
rv = self.preprocess_request()
|
||||||
|
File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1974, in preprocess_request
|
||||||
|
rv = self.ensure_sync(before_func)()
|
||||||
|
File "/app/app/routes/routes.py", line 24, in require_api_key_middleware
|
||||||
|
return require_api_key()
|
||||||
|
TypeError: require_api_key() missing 1 required positional argument: 'f'
|
||||||
|
2025-03-21 09:03:03,024 - INFO - 172.21.0.1 - - [21/Mar/2025 09:03:03] "[35m[1mPOST /Disbursement HTTP/1.1[0m" 500 -
|
||||||
|
2025-03-21 09:03:36,056 - INFO - [31m[1mWARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.[0m
|
||||||
* Running on all addresses (0.0.0.0)
|
* Running on all addresses (0.0.0.0)
|
||||||
* Running on http://127.0.0.1:5000
|
* Running on http://127.0.0.1:5000
|
||||||
* Running on http://192.168.43.192:5000
|
* Running on http://172.21.0.2:5000
|
||||||
2025-03-20 17:05:48,613 - INFO - [33mPress CTRL+C to quit[0m
|
2025-03-21 09:03:36,056 - INFO - [33mPress CTRL+C to quit[0m
|
||||||
2025-03-20 17:05:48,614 - INFO - * Restarting with stat
|
2025-03-21 09:03:43,372 - INFO - before_request middleware triggered
|
||||||
2025-03-20 17:05:49,355 - WARNING - * Debugger is active!
|
2025-03-21 09:03:43,373 - INFO - Processing Disbursement request
|
||||||
2025-03-20 17:05:49,373 - INFO - * Debugger PIN: 716-001-293
|
2025-03-21 09:03:43,374 - ERROR - Validation Error: {'collectAmountMgtFee': ['Missing data for required field.'], 'collectAmountVAT': ['Missing data for required field.'], 'collectAmountInsurance': ['Missing data for required field.'], 'productId': ['Missing data for required field.'], 'countryId': ['Missing data for required field.'], 'provideAmount': ['Missing data for required field.'], 'debtId': ['Missing data for required field.'], 'requestId': ['Missing data for required field.'], 'countryCode': ['Unknown field.'], 'lienAmount': ['Unknown field.'], 'msisdn': ['Unknown field.'], '$type': ['Unknown field.'], 'channel': ['Unknown field.']}
|
||||||
2025-03-20 17:05:52,329 - INFO - Processing EligibilityCheck request
|
2025-03-21 09:03:43,375 - INFO - 172.21.0.1 - - [21/Mar/2025 09:03:43] "POST /Disbursement HTTP/1.1" 200 -
|
||||||
2025-03-20 17:05:52,333 - INFO - 127.0.0.1 - - [20/Mar/2025 17:05:52] "POST /api/EligibilityCheck HTTP/1.1" 200 -
|
2025-03-21 09:16:24,496 - INFO - before_request middleware triggered
|
||||||
2025-03-20 17:16:19,388 - INFO - [31m[1mWARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.[0m
|
2025-03-21 09:16:24,496 - INFO - Processing Disbursement request
|
||||||
* Running on http://127.0.0.1:5000
|
2025-03-21 09:16:24,498 - ERROR - Validation Error: {'productId': ['Missing data for required field.'], 'debtId': ['Missing data for required field.'], 'collectAmountMgtFee': ['Missing data for required field.'], 'collectAmountVAT': ['Missing data for required field.'], 'provideAmount': ['Missing data for required field.'], 'requestId': ['Missing data for required field.'], 'collectAmountInsurance': ['Missing data for required field.'], 'countryId': ['Missing data for required field.'], 'channel': ['Unknown field.'], '$type': ['Unknown field.'], 'msisdn': ['Unknown field.'], 'countryCode': ['Unknown field.'], 'lienAmount': ['Unknown field.']}
|
||||||
2025-03-20 17:16:19,388 - INFO - [33mPress CTRL+C to quit[0m
|
|
||||||
2025-03-20 17:17:44,903 - INFO - Processing SelectOffer request
|
|
||||||
2025-03-20 17:17:44,908 - ERROR - Validation Error: {'productId': ['Missing data for required field.'], 'requestId': ['Missing data for required field.'], 'requestedAmount': ['Missing data for required field.'], 'countryCode': ['Unknown field.'], 'lienAmount': ['Unknown field.'], '$type': ['Unknown field.']}
|
|
||||||
2025-03-20 17:17:44,916 - INFO - 127.0.0.1 - - [20/Mar/2025 17:17:44] "POST /api/SelectOffer HTTP/1.1" 200 -
|
|
||||||
2025-03-20 17:45:41,511 - INFO - [31m[1mWARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.[0m
|
|
||||||
* Running on http://127.0.0.1:5000
|
|
||||||
2025-03-20 17:45:41,513 - INFO - [33mPress CTRL+C to quit[0m
|
|
||||||
2025-03-20 17:51:07,000 - INFO - [31m[1mWARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.[0m
|
|
||||||
* Running on all addresses (0.0.0.0)
|
|
||||||
* Running on http://127.0.0.1:5000
|
|
||||||
* Running on http://172.20.0.2:5000
|
|
||||||
2025-03-20 17:51:07,001 - INFO - [33mPress CTRL+C to quit[0m
|
|
||||||
2025-03-20 17:51:28,286 - INFO - 172.20.0.1 - - [20/Mar/2025 17:51:28] "[33mGET / HTTP/1.1[0m" 404 -
|
|
||||||
2025-03-20 17:51:28,603 - INFO - 172.20.0.1 - - [20/Mar/2025 17:51:28] "[33mGET /favicon.ico HTTP/1.1[0m" 404 -
|
|
||||||
2025-03-20 17:51:38,063 - INFO - 172.20.0.1 - - [20/Mar/2025 17:51:38] "GET /api/health HTTP/1.1" 200 -
|
|
||||||
2025-03-20 17:52:29,740 - INFO - 172.20.0.1 - - [20/Mar/2025 17:52:29] "[33mGET /health HTTP/1.1[0m" 404 -
|
|
||||||
2025-03-20 17:53:14,937 - INFO - [31m[1mWARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.[0m
|
|
||||||
* Running on all addresses (0.0.0.0)
|
|
||||||
* Running on http://127.0.0.1:5000
|
|
||||||
* Running on http://172.20.0.2:5000
|
|
||||||
2025-03-20 17:53:14,938 - INFO - [33mPress CTRL+C to quit[0m
|
|
||||||
2025-03-20 17:53:49,208 - INFO - 172.20.0.1 - - [20/Mar/2025 17:53:49] "GET /health HTTP/1.1" 200 -
|
|
||||||
2025-03-21 00:36:08,145 - INFO - [31m[1mWARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.[0m
|
|
||||||
* Running on all addresses (0.0.0.0)
|
|
||||||
* Running on http://127.0.0.1:5000
|
|
||||||
* Running on http://172.23.0.2:5000
|
|
||||||
2025-03-21 00:36:08,146 - INFO - [33mPress CTRL+C to quit[0m
|
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@@ -1,10 +1,3 @@
|
|||||||
from app.blueprints.eligibility_check import EligibilityCheckService
|
|
||||||
from app.blueprints.select_offer import SelectOfferService
|
|
||||||
from app.blueprints.provide_loan import ProvideLoanService
|
|
||||||
from app.blueprints.loan_information import LoanInformationService
|
|
||||||
from app.blueprints.repayment import RepaymentService
|
|
||||||
from app.blueprints.customer_consent import CustomerConsentService
|
|
||||||
from app.blueprints.notification_callback import NotificationCallbackService
|
|
||||||
from app.blueprints.rac_check import RACCheckService
|
from app.blueprints.rac_check import RACCheckService
|
||||||
from app.blueprints.disbursement import DisbursementService
|
from app.blueprints.disbursement import DisbursementService
|
||||||
from app.blueprints.collect_loan import CollectLoanService
|
from app.blueprints.collect_loan import CollectLoanService
|
||||||
@@ -14,5 +7,3 @@ from app.blueprints.revoke_enable_consent import RevokeEnableConsentService
|
|||||||
from app.blueprints.token_validation import TokenValidationService
|
from app.blueprints.token_validation import TokenValidationService
|
||||||
from app.blueprints.lien_check import LienCheckService
|
from app.blueprints.lien_check import LienCheckService
|
||||||
from app.blueprints.new_transaction_check import NewTransactionCheckService
|
from app.blueprints.new_transaction_check import NewTransactionCheckService
|
||||||
from app.blueprints.sms import SMSService
|
|
||||||
from app.blueprints.bulk_sms import BulkSMSService
|
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,55 +0,0 @@
|
|||||||
from marshmallow import ValidationError
|
|
||||||
from app.utils.logger import logger
|
|
||||||
from app.helpers.response_helper import ResponseHelper
|
|
||||||
from app.schemas.bulk_sms import BulkSMSSchema
|
|
||||||
|
|
||||||
class BulkSMSService:
|
|
||||||
@staticmethod
|
|
||||||
def process_request(data):
|
|
||||||
"""
|
|
||||||
Process the Bulk SMS request.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
data (dict): The request data.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
dict: A standardized response.
|
|
||||||
"""
|
|
||||||
try:
|
|
||||||
logger.info("Processing BulkSMS request")
|
|
||||||
|
|
||||||
# Validate input data using BulkSMSSchema
|
|
||||||
schema = BulkSMSSchema()
|
|
||||||
validated_data = schema.load(data) # Raises ValidationError if invalid
|
|
||||||
|
|
||||||
# Simulated Bulk SMS sending logic
|
|
||||||
response_data = {
|
|
||||||
"data": "",
|
|
||||||
"statusCode": 200,
|
|
||||||
"isSuccessful": True,
|
|
||||||
"errorMessage": None
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# return ResponseHelper.success(
|
|
||||||
# data=response_data,
|
|
||||||
# message="Bulk SMS sent successfully"
|
|
||||||
# )
|
|
||||||
|
|
||||||
return response_data
|
|
||||||
|
|
||||||
except ValidationError as err:
|
|
||||||
logger.error(f"Validation Error: {err.messages}")
|
|
||||||
return ResponseHelper.error(
|
|
||||||
message="Invalid input data",
|
|
||||||
status_code=400,
|
|
||||||
error=err.messages
|
|
||||||
)
|
|
||||||
|
|
||||||
except Exception as e:
|
|
||||||
logger.error(f"An error occurred: {str(e)}", exc_info=True)
|
|
||||||
return ResponseHelper.error(
|
|
||||||
message="An internal error occurred",
|
|
||||||
status_code=500,
|
|
||||||
error=str(e)
|
|
||||||
)
|
|
||||||
@@ -21,7 +21,7 @@ class CollectLoanService:
|
|||||||
|
|
||||||
# Validate input data using CollectLoanSchema
|
# Validate input data using CollectLoanSchema
|
||||||
schema = CollectLoanSchema()
|
schema = CollectLoanSchema()
|
||||||
validated_data = schema.load(data) # Raises ValidationError if invalid
|
validated_data = schema.load(data)
|
||||||
|
|
||||||
# Simulated processing logic
|
# Simulated processing logic
|
||||||
response_data = {
|
response_data = {
|
||||||
@@ -56,8 +56,6 @@ class CollectLoanService:
|
|||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"An error occurred: {str(e)}", exc_info=True)
|
logger.error(f"An error occurred: {str(e)}", exc_info=True)
|
||||||
return ResponseHelper.error(
|
return ResponseHelper.internal_server_error(
|
||||||
message="An internal error occurred",
|
|
||||||
status_code=500,
|
|
||||||
error=str(e)
|
error=str(e)
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -48,8 +48,6 @@ class CustomerConsentService:
|
|||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"An error occurred: {str(e)}", exc_info=True)
|
logger.error(f"An error occurred: {str(e)}", exc_info=True)
|
||||||
return ResponseHelper.error(
|
return ResponseHelper.internal_server_error(
|
||||||
message="An internal error occurred",
|
|
||||||
status_code=500,
|
|
||||||
error=str(e)
|
error=str(e)
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -59,8 +59,6 @@ class DisbursementService:
|
|||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"An error occurred: {str(e)}", exc_info=True)
|
logger.error(f"An error occurred: {str(e)}", exc_info=True)
|
||||||
return ResponseHelper.error(
|
return ResponseHelper.internal_server_error(
|
||||||
message="An internal error occurred",
|
|
||||||
status_code=500,
|
|
||||||
error=str(e)
|
error=str(e)
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,77 +0,0 @@
|
|||||||
from flask import session
|
|
||||||
from app.utils.logger import logger
|
|
||||||
from app.helpers.response_helper import ResponseHelper
|
|
||||||
from app.schemas.eligibility_check import EligibilityCheckSchema
|
|
||||||
from marshmallow import ValidationError
|
|
||||||
|
|
||||||
class EligibilityCheckService:
|
|
||||||
@staticmethod
|
|
||||||
def process_request(data):
|
|
||||||
"""
|
|
||||||
Process the EligibilityCheck request.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
data (dict): The request data.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
dict: A standardized response.
|
|
||||||
"""
|
|
||||||
try:
|
|
||||||
logger.info("Processing EligibilityCheck request")
|
|
||||||
|
|
||||||
# Validate input data using Schema
|
|
||||||
schema = EligibilityCheckSchema()
|
|
||||||
validated_data = schema.load(data) # Raises an error if invalid
|
|
||||||
|
|
||||||
# Example: Validate data, perform calculations, etc.
|
|
||||||
if not data:
|
|
||||||
return ResponseHelper.error("Invalid input data", status_code=400)
|
|
||||||
|
|
||||||
# Simulate processing
|
|
||||||
response_data = {
|
|
||||||
"customerId": "CN621868",
|
|
||||||
"transactionId": "Tr201712RK9232P115",
|
|
||||||
"msisdn": "3451342",
|
|
||||||
"eligibleOffers": [
|
|
||||||
{
|
|
||||||
"minamount": 5000,
|
|
||||||
"maxamount": 20000,
|
|
||||||
"productId": 101,
|
|
||||||
"offerid": 101,
|
|
||||||
"Tenor": 30
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"minamount": 20000,
|
|
||||||
"maxamount": 50000,
|
|
||||||
"productId": 102,
|
|
||||||
"offerid": 102,
|
|
||||||
"Tenor": 60
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"resultCode": "00",
|
|
||||||
"resultDescription": "Successful"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# Return a success response
|
|
||||||
# return ResponseHelper.success(
|
|
||||||
# data=response_data,
|
|
||||||
# message="Eligibility check completed successfully"
|
|
||||||
# )
|
|
||||||
|
|
||||||
return response_data
|
|
||||||
except ValidationError as err:
|
|
||||||
logger.error(f"Validation Error: {err.messages}")
|
|
||||||
return ResponseHelper.error(
|
|
||||||
message="Invalid input data",
|
|
||||||
status_code=400,
|
|
||||||
error=err.messages
|
|
||||||
)
|
|
||||||
|
|
||||||
except Exception as e:
|
|
||||||
logger.error(f"An error occurred during EligibilityCheck processing: {str(e)}", exc_info=True)
|
|
||||||
return ResponseHelper.error(
|
|
||||||
message="An internal error occurred",
|
|
||||||
status_code=500,
|
|
||||||
error=str(e)
|
|
||||||
)
|
|
||||||
@@ -47,8 +47,6 @@ class LienCheckService:
|
|||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"An error occurred: {str(e)}", exc_info=True)
|
logger.error(f"An error occurred: {str(e)}", exc_info=True)
|
||||||
return ResponseHelper.error(
|
return ResponseHelper.internal_server_error(
|
||||||
message="An internal error occurred",
|
|
||||||
status_code=500,
|
|
||||||
error=str(e)
|
error=str(e)
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,67 +0,0 @@
|
|||||||
from flask import request
|
|
||||||
from marshmallow import ValidationError
|
|
||||||
from app.utils.logger import logger
|
|
||||||
from app.helpers.response_helper import ResponseHelper
|
|
||||||
from app.schemas.loan_information import LoanInformationSchema
|
|
||||||
|
|
||||||
class LoanInformationService:
|
|
||||||
@staticmethod
|
|
||||||
def process_request(data):
|
|
||||||
"""
|
|
||||||
Process the Loan Information request.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
data (dict): The request data.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
dict: A standardized response.
|
|
||||||
"""
|
|
||||||
try:
|
|
||||||
logger.info("Processing LoanInformation request")
|
|
||||||
|
|
||||||
# Validate input data using the imported schema
|
|
||||||
schema = LoanInformationSchema()
|
|
||||||
validated_data = schema.load(data) # Raises ValidationError if invalid
|
|
||||||
|
|
||||||
# Simulated processing logic
|
|
||||||
response_data = {
|
|
||||||
"customerId": "CN621868",
|
|
||||||
"loans": [
|
|
||||||
{
|
|
||||||
"debtId": "123456789",
|
|
||||||
"loanDate": "2019-10-18 14:26:21.063",
|
|
||||||
"dueDate": "2019-11-20 14:26:21.063",
|
|
||||||
"currentLoanAmount": 8500.0,
|
|
||||||
"initialLoanAmount": 10000.0,
|
|
||||||
"defaultFee": 0.0,
|
|
||||||
"continuousFee": 0.0,
|
|
||||||
"productId": "101"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"resultCode": "00",
|
|
||||||
"resultDescription": "Successful"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# return ResponseHelper.success(
|
|
||||||
# data=response_data,
|
|
||||||
# message="Loan information retrieved successfully"
|
|
||||||
# )
|
|
||||||
|
|
||||||
return response_data
|
|
||||||
|
|
||||||
except ValidationError as err:
|
|
||||||
logger.error(f"Validation Error: {err.messages}")
|
|
||||||
return ResponseHelper.error(
|
|
||||||
message="Invalid input data",
|
|
||||||
status_code=400,
|
|
||||||
error=err.messages
|
|
||||||
)
|
|
||||||
|
|
||||||
except Exception as e:
|
|
||||||
logger.error(f"An error occurred: {str(e)}", exc_info=True)
|
|
||||||
return ResponseHelper.error(
|
|
||||||
message="An internal error occurred",
|
|
||||||
status_code=500,
|
|
||||||
error=str(e)
|
|
||||||
)
|
|
||||||
@@ -54,8 +54,6 @@ class NewTransactionCheckService:
|
|||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"An error occurred: {str(e)}", exc_info=True)
|
logger.error(f"An error occurred: {str(e)}", exc_info=True)
|
||||||
return ResponseHelper.error(
|
return ResponseHelper.internal_server_error(
|
||||||
message="An internal error occurred",
|
|
||||||
status_code=500,
|
|
||||||
error=str(e)
|
error=str(e)
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,54 +0,0 @@
|
|||||||
from flask import request
|
|
||||||
from marshmallow import ValidationError
|
|
||||||
from app.utils.logger import logger
|
|
||||||
from app.helpers.response_helper import ResponseHelper
|
|
||||||
from app.schemas.notification_callback import NotificationCallbackSchema
|
|
||||||
|
|
||||||
class NotificationCallbackService:
|
|
||||||
@staticmethod
|
|
||||||
def process_request(data):
|
|
||||||
"""
|
|
||||||
Process the NotificationCallback request.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
data (dict): The request data.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
dict: A standardized response.
|
|
||||||
"""
|
|
||||||
try:
|
|
||||||
logger.info("Processing NotificationCallback request")
|
|
||||||
|
|
||||||
# Validate input data using the NotificationCallback schema
|
|
||||||
schema = NotificationCallbackSchema()
|
|
||||||
validated_data = schema.load(data) # Raises ValidationError if invalid
|
|
||||||
|
|
||||||
# Simulated processing logic
|
|
||||||
response_data = {
|
|
||||||
"resultCode": "00",
|
|
||||||
"resultDescription": "Successful"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# return ResponseHelper.success(
|
|
||||||
# data=response_data,
|
|
||||||
# message="Notification callback processed successfully"
|
|
||||||
# )
|
|
||||||
|
|
||||||
return response_data
|
|
||||||
|
|
||||||
except ValidationError as err:
|
|
||||||
logger.error(f"Validation Error: {err.messages}")
|
|
||||||
return ResponseHelper.error(
|
|
||||||
message="Invalid input data",
|
|
||||||
status_code=400,
|
|
||||||
error=err.messages
|
|
||||||
)
|
|
||||||
|
|
||||||
except Exception as e:
|
|
||||||
logger.error(f"An error occurred: {str(e)}", exc_info=True)
|
|
||||||
return ResponseHelper.error(
|
|
||||||
message="An internal error occurred",
|
|
||||||
status_code=500,
|
|
||||||
error=str(e)
|
|
||||||
)
|
|
||||||
@@ -48,8 +48,6 @@ class PenalChargeService:
|
|||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"An error occurred: {str(e)}", exc_info=True)
|
logger.error(f"An error occurred: {str(e)}", exc_info=True)
|
||||||
return ResponseHelper.error(
|
return ResponseHelper.internal_server_error(
|
||||||
message="An internal error occurred",
|
|
||||||
status_code=500,
|
|
||||||
error=str(e)
|
error=str(e)
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,59 +0,0 @@
|
|||||||
from flask import request
|
|
||||||
from marshmallow import ValidationError
|
|
||||||
from app.utils.logger import logger
|
|
||||||
from app.helpers.response_helper import ResponseHelper
|
|
||||||
from app.schemas.provide_loan import ProvideLoanSchema
|
|
||||||
|
|
||||||
class ProvideLoanService:
|
|
||||||
@staticmethod
|
|
||||||
def process_request(data):
|
|
||||||
"""
|
|
||||||
Process the ProvideLoan request.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
data (dict): The request data.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
dict: A standardized response.
|
|
||||||
"""
|
|
||||||
try:
|
|
||||||
logger.info("Processing ProvideLoan request")
|
|
||||||
|
|
||||||
# Validate input data using the imported schema
|
|
||||||
schema = ProvideLoanSchema()
|
|
||||||
validated_data = schema.load(data) # Raises ValidationError if invalid
|
|
||||||
|
|
||||||
# Business logic - providing a loan
|
|
||||||
response_data ={
|
|
||||||
"requestId": "202111170001371256908",
|
|
||||||
"transactionId": "Tr201712RK9232P115",
|
|
||||||
"customerId": "CN621868",
|
|
||||||
"accountId": "ACN8263457",
|
|
||||||
"msisdn": "3451342",
|
|
||||||
"resultCode": "00",
|
|
||||||
"resultDescription": "Successful"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# return ResponseHelper.success(
|
|
||||||
# data=response_data,
|
|
||||||
# message="Loan successfully provided"
|
|
||||||
# )
|
|
||||||
|
|
||||||
return response_data
|
|
||||||
|
|
||||||
except ValidationError as err:
|
|
||||||
logger.error(f"Validation Error: {err.messages}")
|
|
||||||
return ResponseHelper.error(
|
|
||||||
message="Invalid input data",
|
|
||||||
status_code=400,
|
|
||||||
error=err.messages
|
|
||||||
)
|
|
||||||
|
|
||||||
except Exception as e:
|
|
||||||
logger.error(f"An error occurred: {str(e)}", exc_info=True)
|
|
||||||
return ResponseHelper.error(
|
|
||||||
message="An internal error occurred",
|
|
||||||
status_code=500,
|
|
||||||
error=str(e)
|
|
||||||
)
|
|
||||||
@@ -60,8 +60,6 @@ class RACCheckService:
|
|||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"An error occurred: {str(e)}", exc_info=True)
|
logger.error(f"An error occurred: {str(e)}", exc_info=True)
|
||||||
return ResponseHelper.error(
|
return ResponseHelper.internal_server_error(
|
||||||
message="An internal error occurred",
|
|
||||||
status_code=500,
|
|
||||||
error=str(e)
|
error=str(e)
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,54 +0,0 @@
|
|||||||
from flask import request
|
|
||||||
from marshmallow import ValidationError
|
|
||||||
from app.utils.logger import logger
|
|
||||||
from app.helpers.response_helper import ResponseHelper
|
|
||||||
from app.schemas.repayment import RepaymentSchema
|
|
||||||
|
|
||||||
class RepaymentService:
|
|
||||||
@staticmethod
|
|
||||||
def process_request(data):
|
|
||||||
"""
|
|
||||||
Process the Repayment request.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
data (dict): The request data.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
dict: A standardized response.
|
|
||||||
"""
|
|
||||||
try:
|
|
||||||
logger.info("Processing Repayment request")
|
|
||||||
|
|
||||||
# Validate input data using the Repayment schema
|
|
||||||
schema = RepaymentSchema()
|
|
||||||
validated_data = schema.load(data) # Raises ValidationError if invalid
|
|
||||||
|
|
||||||
# Simulated processing logic
|
|
||||||
response_data = {
|
|
||||||
"repayment_id": "67890",
|
|
||||||
"status": "Paid",
|
|
||||||
"amount": validated_data.get("amount", 0), # Example: Use validated field
|
|
||||||
}
|
|
||||||
|
|
||||||
# return ResponseHelper.success(
|
|
||||||
# data=response_data,
|
|
||||||
# message="Repayment processed successfully"
|
|
||||||
# )
|
|
||||||
|
|
||||||
return response_data
|
|
||||||
|
|
||||||
except ValidationError as err:
|
|
||||||
logger.error(f"Validation Error: {err.messages}")
|
|
||||||
return ResponseHelper.error(
|
|
||||||
message="Invalid input data",
|
|
||||||
status_code=400,
|
|
||||||
error=err.messages
|
|
||||||
)
|
|
||||||
|
|
||||||
except Exception as e:
|
|
||||||
logger.error(f"An error occurred: {str(e)}", exc_info=True)
|
|
||||||
return ResponseHelper.error(
|
|
||||||
message="An internal error occurred",
|
|
||||||
status_code=500,
|
|
||||||
error=str(e)
|
|
||||||
)
|
|
||||||
@@ -51,8 +51,6 @@ class RevokeEnableConsentService:
|
|||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"An error occurred: {str(e)}", exc_info=True)
|
logger.error(f"An error occurred: {str(e)}", exc_info=True)
|
||||||
return ResponseHelper.error(
|
return ResponseHelper.internal_server_error(
|
||||||
message="An internal error occurred",
|
|
||||||
status_code=500,
|
|
||||||
error=str(e)
|
error=str(e)
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,109 +0,0 @@
|
|||||||
from flask import request
|
|
||||||
from marshmallow import ValidationError
|
|
||||||
from app.utils.logger import logger
|
|
||||||
from app.helpers.response_helper import ResponseHelper
|
|
||||||
from app.schemas.select_offer import SelectOfferSchema
|
|
||||||
|
|
||||||
class SelectOfferService:
|
|
||||||
@staticmethod
|
|
||||||
def process_request(data):
|
|
||||||
"""
|
|
||||||
Process the SelectOffer request.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
data (dict): The request data.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
dict: A standardized response.
|
|
||||||
"""
|
|
||||||
try:
|
|
||||||
logger.info("Processing SelectOffer request")
|
|
||||||
|
|
||||||
# Validate input data using the imported schema
|
|
||||||
schema = SelectOfferSchema()
|
|
||||||
validated_data = schema.load(data) # Raises ValidationError if invalid
|
|
||||||
|
|
||||||
# Business logic - selecting an offer
|
|
||||||
response_data = {
|
|
||||||
"outstandingDebtAmount": 0,
|
|
||||||
"requestId": "202111170001371256908",
|
|
||||||
"transactionId": "1231231321232",
|
|
||||||
"customerId": "1256907",
|
|
||||||
"accountId": "5948306019",
|
|
||||||
"offers": [
|
|
||||||
{
|
|
||||||
"offerId": "14451",
|
|
||||||
"productId": "2030",
|
|
||||||
"amount": 10000.0,
|
|
||||||
"upfrontPayment": 1000.0,
|
|
||||||
"interestRate": 3.0,
|
|
||||||
"managementRate": 1.0,
|
|
||||||
"managementFee": 1.0,
|
|
||||||
"insuranceRate": 1.0,
|
|
||||||
"insuranceFee": 100.0,
|
|
||||||
"vatRate": 7.5,
|
|
||||||
"vatAmount": 100.0,
|
|
||||||
"recommendedRepaymentDates": ["2022-11-30"],
|
|
||||||
"installmentAmount": 11000.0,
|
|
||||||
"totalRepaymentAmount": 11000.0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"offerId": "16645",
|
|
||||||
"productId": "2060",
|
|
||||||
"amount": 10000.0,
|
|
||||||
"upfrontPayment": 0.0,
|
|
||||||
"interestRate": 3.0,
|
|
||||||
"managementRate": 1.0,
|
|
||||||
"managementFee": 1.0,
|
|
||||||
"insuranceRate": 1.0,
|
|
||||||
"insuranceFee": 100.0,
|
|
||||||
"vatRate": 7.5,
|
|
||||||
"vatAmount": 100.0,
|
|
||||||
"recommendedRepaymentDates": ["2022-11-30", "2023-12-30"],
|
|
||||||
"installmentAmount": 5761.9,
|
|
||||||
"totalRepaymentAmount": 11523.8
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"offerId": "122212",
|
|
||||||
"productId": "2090",
|
|
||||||
"amount": 10000.0,
|
|
||||||
"upfrontPayment": 0.0,
|
|
||||||
"interestRate": 10.0,
|
|
||||||
"managementRate": 1.0,
|
|
||||||
"managementFee": 1.0,
|
|
||||||
"insuranceRate": 1.0,
|
|
||||||
"insuranceFee": 100.0,
|
|
||||||
"vatRate": 7.5,
|
|
||||||
"vatAmount": 100.0,
|
|
||||||
"recommendedRepaymentDates": ["2022-11-30", "2022-12-30", "2023-01-29"],
|
|
||||||
"installmentAmount": 4021.15,
|
|
||||||
"totalRepaymentAmount": 12063.45
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"resultCode": "00",
|
|
||||||
"resultDescription": "Successful"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# return ResponseHelper.success(
|
|
||||||
# data=response_data,
|
|
||||||
# message="Offer selection completed successfully"
|
|
||||||
# )
|
|
||||||
|
|
||||||
return response_data
|
|
||||||
|
|
||||||
except ValidationError as err:
|
|
||||||
logger.error(f"Validation Error: {err.messages}")
|
|
||||||
return ResponseHelper.error(
|
|
||||||
message="Invalid input data",
|
|
||||||
status_code=400,
|
|
||||||
error=err.messages
|
|
||||||
)
|
|
||||||
|
|
||||||
except Exception as e:
|
|
||||||
logger.error(f"An error occurred: {str(e)}", exc_info=True)
|
|
||||||
return ResponseHelper.error(
|
|
||||||
message="An internal error occurred",
|
|
||||||
status_code=500,
|
|
||||||
error=str(e)
|
|
||||||
)
|
|
||||||
@@ -1,56 +0,0 @@
|
|||||||
from marshmallow import ValidationError
|
|
||||||
from app.utils.logger import logger
|
|
||||||
from app.helpers.response_helper import ResponseHelper
|
|
||||||
from app.schemas.sms import SMSSchema
|
|
||||||
|
|
||||||
|
|
||||||
class SMSService:
|
|
||||||
@staticmethod
|
|
||||||
def process_request(data):
|
|
||||||
"""
|
|
||||||
Process the SMS request.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
data (dict): The request data.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
dict: A standardized response.
|
|
||||||
"""
|
|
||||||
try:
|
|
||||||
logger.info("Processing SMS request")
|
|
||||||
|
|
||||||
# Validate input data using SMSSchema
|
|
||||||
schema = SMSSchema()
|
|
||||||
validated_data = schema.load(data) # Raises ValidationError if invalid
|
|
||||||
|
|
||||||
# Simulated SMS sending logic
|
|
||||||
response_data = {
|
|
||||||
"data": "",
|
|
||||||
"statusCode": 200,
|
|
||||||
"isSuccessful": True,
|
|
||||||
"errorMessage": None
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# return ResponseHelper.success(
|
|
||||||
# data=response_data,
|
|
||||||
# message="SMS sent successfully"
|
|
||||||
# )
|
|
||||||
|
|
||||||
return response_data
|
|
||||||
|
|
||||||
except ValidationError as err:
|
|
||||||
logger.error(f"Validation Error: {err.messages}")
|
|
||||||
return ResponseHelper.error(
|
|
||||||
message="Invalid input data",
|
|
||||||
status_code=400,
|
|
||||||
error=err.messages
|
|
||||||
)
|
|
||||||
|
|
||||||
except Exception as e:
|
|
||||||
logger.error(f"An error occurred: {str(e)}", exc_info=True)
|
|
||||||
return ResponseHelper.error(
|
|
||||||
message="An internal error occurred",
|
|
||||||
status_code=500,
|
|
||||||
error=str(e)
|
|
||||||
)
|
|
||||||
@@ -51,8 +51,6 @@ class TokenValidationService:
|
|||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"An error occurred: {str(e)}", exc_info=True)
|
logger.error(f"An error occurred: {str(e)}", exc_info=True)
|
||||||
return ResponseHelper.error(
|
return ResponseHelper.internal_server_error(
|
||||||
message="An internal error occurred",
|
|
||||||
status_code=500,
|
|
||||||
error=str(e)
|
error=str(e)
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -54,8 +54,6 @@ class TransactionVerifyService:
|
|||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"An error occurred: {str(e)}", exc_info=True)
|
logger.error(f"An error occurred: {str(e)}", exc_info=True)
|
||||||
return ResponseHelper.error(
|
return ResponseHelper.internal_server_error(
|
||||||
message="An internal error occurred",
|
|
||||||
status_code=500,
|
|
||||||
error=str(e)
|
error=str(e)
|
||||||
)
|
)
|
||||||
|
|||||||
Binary file not shown.
@@ -210,4 +210,6 @@ class ResponseHelper:
|
|||||||
Returns:
|
Returns:
|
||||||
Dict[str, Any]: A dictionary representing the JSON response.
|
Dict[str, Any]: A dictionary representing the JSON response.
|
||||||
"""
|
"""
|
||||||
return ResponseHelper.build_response(False, message, data, 422, error)
|
return ResponseHelper.build_response(False, message, data, 422, error)
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
from .verify_api_key import require_api_key
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
from flask import request
|
||||||
|
from app.helpers.response_helper import ResponseHelper
|
||||||
|
from app.utils.logger import logger
|
||||||
|
import os
|
||||||
|
|
||||||
|
VALID_APP_IDS = os.getenv("VALID_APP_ID", "")
|
||||||
|
|
||||||
|
def require_app_id():
|
||||||
|
"""Middleware to check if App-ID is present and valid."""
|
||||||
|
app_id = request.headers.get("App-ID")
|
||||||
|
|
||||||
|
if not app_id:
|
||||||
|
logger.error("Unauthorized access: Missing App-ID.")
|
||||||
|
return ResponseHelper.unauthorized("Missing App-ID")
|
||||||
|
|
||||||
|
if app_id not in VALID_APP_IDS:
|
||||||
|
logger.error(f"Unauthorized access: Invalid App-ID {app_id}.")
|
||||||
|
return ResponseHelper.unauthorized("Invalid App-ID")
|
||||||
|
|
||||||
|
return None
|
||||||
@@ -1,14 +1,14 @@
|
|||||||
# app/middlewares/encryption.py
|
# app/middlewares/encryption.py
|
||||||
from cryptography.fernet import Fernet
|
# from cryptography.fernet import Fernet
|
||||||
import os
|
# import os
|
||||||
|
|
||||||
ENCRYPTION_KEY = os.getenv("ENCRYPTION_KEY", Fernet.generate_key())
|
# ENCRYPTION_KEY = os.getenv("ENCRYPTION_KEY", Fernet.generate_key())
|
||||||
cipher = Fernet(ENCRYPTION_KEY)
|
# cipher = Fernet(ENCRYPTION_KEY)
|
||||||
|
|
||||||
def encrypt_data(data):
|
# def encryptdata(data):
|
||||||
"""Encrypt sensitive data"""
|
# """Encrypt sensitive data"""
|
||||||
return cipher.encrypt(data.encode()).decode()
|
# return cipher.encrypt(data.encode()).decode()
|
||||||
|
|
||||||
def decrypt_data(data):
|
# def decrypt_data(data):
|
||||||
"""Decrypt sensitive data"""
|
# """Decrypt sensitive data"""
|
||||||
return cipher.decrypt(data.encode()).decode()
|
# return cipher.decrypt(data.encode()).decode()
|
||||||
|
|||||||
@@ -1,8 +1,20 @@
|
|||||||
# app/middlewares/auth.py
|
from flask import request
|
||||||
from flask import request, jsonify
|
from app.helpers.response_helper import ResponseHelper
|
||||||
|
from app.utils.logger import logger
|
||||||
|
|
||||||
|
# Define a valid API key (store securely in environment variables)
|
||||||
|
VALID_API_KEY = "your-secure-api-key"
|
||||||
|
|
||||||
def require_api_key():
|
def require_api_key():
|
||||||
"""Middleware to check if API key is present"""
|
"""Middleware to check if API key is present and valid."""
|
||||||
api_key = request.headers.get("X-API-KEY")
|
api_key = request.headers.get("X-API-KEY")
|
||||||
|
|
||||||
if not api_key:
|
if not api_key:
|
||||||
return jsonify({"error": "Missing API key"}), 403
|
logger.error("Unauthorized access: Missing API key.")
|
||||||
|
return ResponseHelper.unauthorized("Missing API key")
|
||||||
|
|
||||||
|
if api_key != VALID_API_KEY:
|
||||||
|
logger.error("Unauthorized access: Invalid API key.")
|
||||||
|
return ResponseHelper.unauthorized("Invalid API key")
|
||||||
|
|
||||||
|
return None
|
||||||
Binary file not shown.
Binary file not shown.
+5
-78
@@ -1,12 +1,5 @@
|
|||||||
from flask import Blueprint, request, jsonify
|
from flask import Blueprint, request, jsonify
|
||||||
from app.blueprints import (
|
from app.blueprints import (
|
||||||
EligibilityCheckService,
|
|
||||||
SelectOfferService,
|
|
||||||
ProvideLoanService,
|
|
||||||
LoanInformationService,
|
|
||||||
RepaymentService,
|
|
||||||
CustomerConsentService,
|
|
||||||
NotificationCallbackService,
|
|
||||||
RACCheckService,
|
RACCheckService,
|
||||||
DisbursementService,
|
DisbursementService,
|
||||||
CollectLoanService,
|
CollectLoanService,
|
||||||
@@ -16,70 +9,20 @@ from app.blueprints import (
|
|||||||
TokenValidationService,
|
TokenValidationService,
|
||||||
LienCheckService,
|
LienCheckService,
|
||||||
NewTransactionCheckService,
|
NewTransactionCheckService,
|
||||||
SMSService,
|
|
||||||
BulkSMSService
|
|
||||||
)
|
)
|
||||||
from app.utils.logger import logger
|
from app.utils.logger import logger
|
||||||
|
from app.middlewares import require_api_key
|
||||||
|
|
||||||
|
|
||||||
api = Blueprint("api", __name__)
|
api = Blueprint("api", __name__)
|
||||||
|
|
||||||
|
|
||||||
# EligibilityCheck Endpoint
|
@api.before_request
|
||||||
@api.route('/EligibilityCheck', methods=['POST'])
|
def require_api_key_middleware():
|
||||||
def eligibility_check():
|
"""Middleware applied globally to all API routes in this blueprint"""
|
||||||
data = request.get_json()
|
return require_api_key()
|
||||||
# logger.info(f"EligibilityCheck request received: {data}")
|
|
||||||
response = EligibilityCheckService.process_request(data)
|
|
||||||
return jsonify(response)
|
|
||||||
|
|
||||||
# SelectOffer Endpoint
|
|
||||||
@api.route('/SelectOffer', methods=['POST'])
|
|
||||||
def select_offer():
|
|
||||||
data = request.get_json()
|
|
||||||
# logger.info(f"SelectOffer request received: {data}")
|
|
||||||
response = SelectOfferService.process_request(data)
|
|
||||||
return jsonify(response)
|
|
||||||
|
|
||||||
# ProvideLoan Endpoint
|
|
||||||
@api.route('/ProvideLoan', methods=['POST'])
|
|
||||||
def provide_loan():
|
|
||||||
data = request.get_json()
|
|
||||||
# logger.info(f"ProvideLoan request received: {data}")
|
|
||||||
response = ProvideLoanService.process_request(data)
|
|
||||||
return jsonify(response)
|
|
||||||
|
|
||||||
# LoanInformation Endpoint
|
|
||||||
@api.route('/LoanInformation', methods=['GET'])
|
|
||||||
def loan_information():
|
|
||||||
data = request.args.to_dict()
|
|
||||||
# logger.info(f"LoanInformation request received: {data}")
|
|
||||||
response = LoanInformationService.process_request(data)
|
|
||||||
return jsonify(response)
|
|
||||||
|
|
||||||
# Repayment Endpoint
|
|
||||||
@api.route('/Repayment', methods=['POST'])
|
|
||||||
def repayment():
|
|
||||||
data = request.get_json()
|
|
||||||
# logger.info(f"Repayment request received: {data}")
|
|
||||||
response = RepaymentService.process_request(data)
|
|
||||||
return jsonify(response)
|
|
||||||
|
|
||||||
# CustomerConsent Endpoint
|
|
||||||
@api.route('/CustomerConsent', methods=['POST'])
|
|
||||||
def customer_consent():
|
|
||||||
data = request.get_json()
|
|
||||||
# logger.info(f"CustomerConsent request received: {data}")
|
|
||||||
response = CustomerConsentService.process_request(data)
|
|
||||||
return jsonify(response)
|
|
||||||
|
|
||||||
# NotificationCallback Endpoint
|
|
||||||
@api.route('/NotificationCallback', methods=['POST'])
|
|
||||||
def notification_callback():
|
|
||||||
data = request.get_json()
|
|
||||||
# logger.info(f"NotificationCallback request received: {data}")
|
|
||||||
response = NotificationCallbackService.process_request(data)
|
|
||||||
return jsonify(response)
|
|
||||||
|
|
||||||
# RACCheck Endpoint
|
# RACCheck Endpoint
|
||||||
@api.route('/RACCheck', methods=['POST'])
|
@api.route('/RACCheck', methods=['POST'])
|
||||||
@@ -153,22 +96,6 @@ def new_transaction_check():
|
|||||||
response = NewTransactionCheckService.process_request(data)
|
response = NewTransactionCheckService.process_request(data)
|
||||||
return jsonify(response)
|
return jsonify(response)
|
||||||
|
|
||||||
# SMS Endpoint
|
|
||||||
@api.route('/SMS', methods=['POST'])
|
|
||||||
def sms():
|
|
||||||
data = request.get_json()
|
|
||||||
# logger.info(f"SMS request received: {data}")
|
|
||||||
response = SMSService.process_request(data)
|
|
||||||
return jsonify(response)
|
|
||||||
|
|
||||||
# BulkSMS Endpoint
|
|
||||||
@api.route('/BulkSMS', methods=['POST'])
|
|
||||||
def bulk_sms():
|
|
||||||
data = request.get_json()
|
|
||||||
# logger.info(f"BulkSMS request received: {data}")
|
|
||||||
response = BulkSMSService.process_request(data)
|
|
||||||
return jsonify(response)
|
|
||||||
|
|
||||||
# Health Check Endpoint
|
# Health Check Endpoint
|
||||||
@api.route('/health', methods=['GET'])
|
@api.route('/health', methods=['GET'])
|
||||||
def health_check():
|
def health_check():
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,6 +0,0 @@
|
|||||||
from marshmallow import Schema, fields
|
|
||||||
from .sms import SMSSchema
|
|
||||||
|
|
||||||
# Bulk SMS Schema
|
|
||||||
class BulkSMSSchema(Schema):
|
|
||||||
requests = fields.List(fields.Nested(SMSSchema), required=True)
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
from marshmallow import Schema, fields
|
|
||||||
|
|
||||||
class EligibilityCheckSchema(Schema):
|
|
||||||
type = fields.Str(required=True, description="Request type")
|
|
||||||
transactionId = fields.Str(data_key="transactionId", required=True, description="Transaction ID")
|
|
||||||
countryCode = fields.Str(data_key="countryCode", required=True, description="Country code (ISO)")
|
|
||||||
customerId = fields.Str(data_key="customerId", required=True, description="Customer ID")
|
|
||||||
accountId = fields.Str(data_key="accountId", required=True, description="Account ID")
|
|
||||||
msisdn = fields.Str(required=True, description="Mobile number")
|
|
||||||
lienAmount = fields.Float(required=True, description="Amount for lien")
|
|
||||||
channel = fields.Str(required=True, description="Transaction channel (USSD, Mobile, Web)")
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
from marshmallow import Schema, fields
|
|
||||||
|
|
||||||
# Loan Information Schema
|
|
||||||
class LoanInformationSchema(Schema):
|
|
||||||
loan_id = fields.Str(required=True)
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
from marshmallow import Schema, fields
|
|
||||||
|
|
||||||
# Notification Callback Schema
|
|
||||||
class NotificationCallbackSchema(Schema):
|
|
||||||
fbnTransactionId = fields.Str(required=True)
|
|
||||||
transactionId = fields.Str(required=True)
|
|
||||||
customerId = fields.Str(required=True)
|
|
||||||
accountId = fields.Str(required=True)
|
|
||||||
debtId = fields.Str(required=True)
|
|
||||||
transactionType = fields.Str(required=True)
|
|
||||||
amountProvided = fields.Float(required=True)
|
|
||||||
amountCollected = fields.Float(required=True)
|
|
||||||
responseCode = fields.Str(required=True)
|
|
||||||
responseDescription = fields.Str(required=True)
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
from marshmallow import Schema, fields
|
|
||||||
|
|
||||||
# Provide Loan Schema
|
|
||||||
class ProvideLoanSchema(Schema):
|
|
||||||
type = fields.Str(required=True)
|
|
||||||
requestId = fields.Str(required=True)
|
|
||||||
transactionId = fields.Str(required=True)
|
|
||||||
customerId = fields.Str(required=True)
|
|
||||||
accountId = fields.Str(required=True)
|
|
||||||
msisdn = fields.Str(required=False)
|
|
||||||
productId = fields.Str(required=True)
|
|
||||||
lienAmount = fields.Float(required=True)
|
|
||||||
requestedAmount = fields.Float(required=True)
|
|
||||||
collectionType = fields.Int(required=True)
|
|
||||||
loanType = fields.Int(required=True)
|
|
||||||
channel = fields.Str(required=True)
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
from marshmallow import Schema, fields
|
|
||||||
|
|
||||||
# Repayment Schema
|
|
||||||
class RepaymentSchema(Schema):
|
|
||||||
type = fields.Str(required=True)
|
|
||||||
msisdn = fields.Str(required=False) #optional
|
|
||||||
debtId = fields.Str(required=True)
|
|
||||||
productId = fields.Str(required=True)
|
|
||||||
transactionId = fields.Str(required=True)
|
|
||||||
customerId = fields.Str(required=True)
|
|
||||||
channel = fields.Str(required=True)
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
from marshmallow import Schema, fields
|
|
||||||
|
|
||||||
# Select Offer Schema
|
|
||||||
class SelectOfferSchema(Schema):
|
|
||||||
requestId = fields.Str(required=True, description="Unique request identifier")
|
|
||||||
transactionId = fields.Str(required=True, description="Transaction ID")
|
|
||||||
customerId = fields.Str(required=True, description="Customer ID")
|
|
||||||
accountId = fields.Str(required=True, description="Account ID")
|
|
||||||
msisdn = fields.Str(required=True, description="Mobile number")
|
|
||||||
requestedAmount = fields.Float(required=True, description="Amount requested")
|
|
||||||
productId = fields.Str(required=True, description="Product ID")
|
|
||||||
channel = fields.Str(required=True, description="Transaction channel (e.g., USSD)")
|
|
||||||
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
from marshmallow import Schema, fields
|
|
||||||
|
|
||||||
# SMS Schema
|
|
||||||
class SMSSchema(Schema):
|
|
||||||
text = fields.Str(required=True)
|
|
||||||
dest = fields.Str(required=True)
|
|
||||||
unicode = fields.Bool(required=True)
|
|
||||||
Binary file not shown.
+1
-1
@@ -5,7 +5,7 @@ logging.basicConfig(
|
|||||||
level=logging.INFO,
|
level=logging.INFO,
|
||||||
format="%(asctime)s - %(levelname)s - %(message)s",
|
format="%(asctime)s - %(levelname)s - %(message)s",
|
||||||
handlers=[
|
handlers=[
|
||||||
logging.StreamHandler(), # Log to console
|
# logging.StreamHandler(), # Log to console
|
||||||
logging.FileHandler("app.log", mode='a') # Log to file
|
logging.FileHandler("app.log", mode='a') # Log to file
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|||||||
+2
-3
@@ -1,11 +1,10 @@
|
|||||||
# Flask and Extensions
|
# Flask and Extensions
|
||||||
Flask==2.3.3
|
Flask==2.3.3
|
||||||
# Flask-SQLAlchemy==3.0.5
|
|
||||||
Flask-Marshmallow==0.15.0
|
Flask-Marshmallow==0.15.0
|
||||||
marshmallow==3.19.0
|
marshmallow==3.19.0
|
||||||
Flask-Cors==3.0.10
|
Flask-Cors==3.0.10
|
||||||
# marshmallow-sqlalchemy==0.29.0
|
gunicorn
|
||||||
# mysqlclient==2.2.0
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user