Rack analysis
This commit is contained in:
@@ -81,6 +81,8 @@ class EligibilityCheckService(BaseService):
|
|||||||
if not rac_check:
|
if not rac_check:
|
||||||
logger.error(f"Failed to save RACCheck")
|
logger.error(f"Failed to save RACCheck")
|
||||||
return ResponseHelper.error(result_description="Failed to save RACCheck.")
|
return ResponseHelper.error(result_description="Failed to save RACCheck.")
|
||||||
|
|
||||||
|
rack_checks_response = response['racResponse']
|
||||||
# -----------------TIME FOR ANALYSIS TO REGISTER OFFER ----------------------
|
# -----------------TIME FOR ANALYSIS TO REGISTER OFFER ----------------------
|
||||||
# eligible_offers = []
|
# eligible_offers = []
|
||||||
try:
|
try:
|
||||||
@@ -88,7 +90,8 @@ class EligibilityCheckService(BaseService):
|
|||||||
transaction_id=transactionId,
|
transaction_id=transactionId,
|
||||||
rac_check=rac_check,
|
rac_check=rac_check,
|
||||||
validated_data=validated_data,
|
validated_data=validated_data,
|
||||||
customer_id=customer_id
|
customer_id=customer_id,
|
||||||
|
rack_checks_response =rack_checks_response
|
||||||
)
|
)
|
||||||
except ValueError as ve:
|
except ValueError as ve:
|
||||||
logger.error(str(ve))
|
logger.error(str(ve))
|
||||||
|
|||||||
@@ -32,12 +32,32 @@ class OfferAnalysis:
|
|||||||
original_transaction = transaction_id
|
original_transaction = transaction_id
|
||||||
|
|
||||||
return transaction_offer, offer, eligible_amount, original_transaction
|
return transaction_offer, offer, eligible_amount, original_transaction
|
||||||
|
@staticmethod
|
||||||
|
def _analyze_rack_checks(rack_response):
|
||||||
|
|
||||||
|
# "racResponse": {
|
||||||
|
# "accountStatus": true,
|
||||||
|
# "bvnValidated": true,
|
||||||
|
# "creditBureauCheck": false,
|
||||||
|
# "crmsCheck": true,
|
||||||
|
# "hasLien": false,
|
||||||
|
# "hasPastDueLoan": false,
|
||||||
|
# "hasSalaryAccount": true,
|
||||||
|
# "isWhitelisted": true,
|
||||||
|
# "noBouncedCheck": true
|
||||||
|
# },
|
||||||
|
#
|
||||||
|
|
||||||
|
return 0
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def decide_offer(transaction_id, rac_check, validated_data, customer_id):
|
def decide_offer(transaction_id, rac_check, validated_data, customer_id, rack_checks_response):
|
||||||
eligible_offers = []
|
eligible_offers = []
|
||||||
# if we have active offers - we have to feed off it
|
# if we have active offers - we have to feed off it
|
||||||
logger.info(f"LOOOOOOOOOOOOOOOOOO** {customer_id}")
|
logger.info(f"**RACK ANALYSIS** {customer_id}")
|
||||||
|
# Analyze Rack Checks
|
||||||
|
self._analyze_rack_checks(rack_checks_response)
|
||||||
|
|
||||||
|
|
||||||
# we can now find the origin transactions
|
# we can now find the origin transactions
|
||||||
# Find the last loan - it will have original_transaction
|
# Find the last loan - it will have original_transaction
|
||||||
|
|||||||
+13
-3
@@ -1,7 +1,6 @@
|
|||||||
import os
|
import os
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
|
|
||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
"""Base configuration for Flask app"""
|
"""Base configuration for Flask app"""
|
||||||
|
|
||||||
@@ -12,17 +11,18 @@ class Config:
|
|||||||
BASIC_AUTH_USERNAME = os.environ.get("BASIC_AUTH_USERNAME", "user")
|
BASIC_AUTH_USERNAME = os.environ.get("BASIC_AUTH_USERNAME", "user")
|
||||||
BASIC_AUTH_PASSWORD = os.environ.get("BASIC_AUTH_PASSWORD", "password")
|
BASIC_AUTH_PASSWORD = os.environ.get("BASIC_AUTH_PASSWORD", "password")
|
||||||
|
|
||||||
|
# Database Configuration
|
||||||
DATABASE_USER = os.environ.get("DATABASE_USER")
|
DATABASE_USER = os.environ.get("DATABASE_USER")
|
||||||
DATABASE_PASSWORD = os.environ.get("DATABASE_PASSWORD")
|
DATABASE_PASSWORD = os.environ.get("DATABASE_PASSWORD")
|
||||||
DATABASE_HOST = os.environ.get("DATABASE_HOST")
|
DATABASE_HOST = os.environ.get("DATABASE_HOST")
|
||||||
DATABASE_PORT = os.environ.get("DATABASE_PORT", 10532)
|
DATABASE_PORT = os.environ.get("DATABASE_PORT", 10532)
|
||||||
DATABASE_NAME = os.environ.get("DATABASE_NAME")
|
DATABASE_NAME = os.environ.get("DATABASE_NAME")
|
||||||
|
|
||||||
|
# Database Connection
|
||||||
SQLALCHEMY_DATABASE_URI = f"postgresql+psycopg2://{DATABASE_USER}:{DATABASE_PASSWORD}@{DATABASE_HOST}:{DATABASE_PORT}/{DATABASE_NAME}"
|
SQLALCHEMY_DATABASE_URI = f"postgresql+psycopg2://{DATABASE_USER}:{DATABASE_PASSWORD}@{DATABASE_HOST}:{DATABASE_PORT}/{DATABASE_NAME}"
|
||||||
SQLALCHEMY_TRACK_MODIFICATIONS = False
|
SQLALCHEMY_TRACK_MODIFICATIONS = False
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
JWT_SECRET_KEY = os.getenv("JWT_SECRET_KEY", "secret-key")
|
JWT_SECRET_KEY = os.getenv("JWT_SECRET_KEY", "secret-key")
|
||||||
JWT_ACCESS_TOKEN_EXPIRES = os.getenv("JWT_ACCESS_TOKEN_EXPIRES", timedelta(hours=1))
|
JWT_ACCESS_TOKEN_EXPIRES = os.getenv("JWT_ACCESS_TOKEN_EXPIRES", timedelta(hours=1))
|
||||||
JWT_REFRESH_TOKEN_EXPIRES = os.getenv(
|
JWT_REFRESH_TOKEN_EXPIRES = os.getenv(
|
||||||
@@ -34,9 +34,19 @@ class Config:
|
|||||||
|
|
||||||
# SIMBRELLA_ENDPOINT_RAC_CHECKS = os.getenv("SIMBRELLA_ENDPOINT_RAC_CHECKS", "RACCheck")
|
# SIMBRELLA_ENDPOINT_RAC_CHECKS = os.getenv("SIMBRELLA_ENDPOINT_RAC_CHECKS", "RACCheck")
|
||||||
VALID_APP_ID = os.getenv("SIMBRELLA_APP_ID", "app1")
|
VALID_APP_ID = os.getenv("SIMBRELLA_APP_ID", "app1")
|
||||||
VALID_API_KEY = os.getenv("SIMBRELLA_API_KEY", "test-api-key-12345")
|
VALID_API_KEY = os.getenv("SIMBRELLA_API_KEY", "testtest-api-key-12345")
|
||||||
SIMBRELLA_BASE_URL = os.getenv("SIMBRELLA_BASE_URL", "http://127.0.0.1:6337")
|
SIMBRELLA_BASE_URL = os.getenv("SIMBRELLA_BASE_URL", "http://127.0.0.1:6337")
|
||||||
SIMBRELLA_ENDPOINT_RAC_CHECKS = os.getenv("SIMBRELLA_ENDPOINT_RAC_CHECKS","api/rac-check")
|
SIMBRELLA_ENDPOINT_RAC_CHECKS = os.getenv("SIMBRELLA_ENDPOINT_RAC_CHECKS","api/rac-check")
|
||||||
|
|
||||||
|
|
||||||
|
RAC_RESULT_accountStatus = os.environ.get("RAC_RESULT_accountStatus", true)
|
||||||
|
RAC_RESULT_bvnValidated = os.environ.get("RAC_RESULT_bvnValidated", true)
|
||||||
|
RAC_RESULT_creditBureauCheck = os.environ.get("RAC_RESULT_creditBureauCheck", false)
|
||||||
|
RAC_RESULT_crmsCheck = os.environ.get("RAC_RESULT_crmsCheck", true)
|
||||||
|
RAC_RESULT_hasLien = os.environ.get("RAC_RESULT_hasLien", false)
|
||||||
|
RAC_RESULT_hasPastDueLoan = os.environ.get("RAC_RESULT_hasPastDueLoan", false)
|
||||||
|
RAC_RESULT_hasSalaryAccount = os.environ.get("RAC_RESULT_hasSalaryAccount", true)
|
||||||
|
RAC_RESULT_isWhitelisted = os.environ.get("RAC_RESULT_isWhitelisted", true)
|
||||||
|
RAC_RESULT_noBouncedCheck = os.environ.get("RAC_RESULT_noBouncedCheck", true)
|
||||||
|
|
||||||
settings = Config()
|
settings = Config()
|
||||||
|
|||||||
Reference in New Issue
Block a user