diff --git a/app/api/integrations/simbrella.py b/app/api/integrations/simbrella.py index 5ed0d0b..b9c3e75 100644 --- a/app/api/integrations/simbrella.py +++ b/app/api/integrations/simbrella.py @@ -17,35 +17,6 @@ class SimbrellaIntegration: url = f"{SimbrellaIntegration.BASE_URL}/{SimbrellaIntegration.ENDPOINT_RAC_CHECKS}" logger.info(f"Contacting Rack Checks EndPoint: {str(url)}", exc_info=True) - # { - # "transactionId": "T001", - # "fbnTransactionId": "Tr201712RK9232P115", - # "customerId": "CN621868", - # "accountId": "2017821799", - # "channel": "USSD", - # "countryCode": "NG" - # } - # - payload_old = { - "customerId": customer_id, - "accountId": account_id, - "transactionId": str(transaction_id), - "fbnTransactionId": f"FBN{transaction_id}", - "RAC_Array": [ - "SalaryAccount", - "BVN", - "BVNAttachedtoAccount", - "CRC", - "CRMS", - "AccountStatus", - "Lien", - "NoBouncedCheck", - "Whitelist", - "NoPastDueSalaryLoan", - "NoPastDueOtherLoan", - ], - } - payload = { "customerId": customer_id, "accountId": account_id, @@ -54,7 +25,6 @@ class SimbrellaIntegration: "countryCode": "NG", "channel": "USSD" } - # logger.info(f"This is PayLoad: {str(payload)}", exc_info=True) headers = { "Content-Type": "application/json", diff --git a/app/api/services/eligibility_check.py b/app/api/services/eligibility_check.py index 5670e1c..5b8c57e 100644 --- a/app/api/services/eligibility_check.py +++ b/app/api/services/eligibility_check.py @@ -81,7 +81,7 @@ class EligibilityCheckService(BaseService): return ResponseHelper.error(result_description=f"RACCheck failed") - rack_checks_response = response['data']['racResponse'] + rack_checks_response = response['racResponse'] rac_check = RACCheck.add_rac_check( customer_id = customer_id, diff --git a/app/api/services/offer_analysis.py b/app/api/services/offer_analysis.py index a30c7ae..21f2f87 100644 --- a/app/api/services/offer_analysis.py +++ b/app/api/services/offer_analysis.py @@ -2,6 +2,10 @@ from app.models import Offer, TransactionOffer from app.models.loan import Loan import random import logging + +from app.config import Config + +RAC_CHECK_RULES = Config.rac_true_rules logger = logging.getLogger(__name__) class OfferAnalysis: @@ -34,8 +38,8 @@ class OfferAnalysis: return transaction_offer, offer, eligible_amount, original_transaction @staticmethod def _analyze_rack_checks(rack_response): - - + logger.info(f"This is PayLoad for ANALYSYS ***** : {str(rack_response)}", exc_info=True) + logger.info(f"RACk RUKES {str(RAC_CHECK_RULES)}", exc_info=True) # "racResponse": { # "accountStatus": true, # "bvnValidated": true, @@ -68,8 +72,7 @@ class OfferAnalysis: # if we have active offers - we have to feed off it logger.info(f"**RACK ANALYSIS** {customer_id}") # Analyze Rack Checks - # _analyze_rack_checks(rack_checks_response) --> We need detail analysis - + OfferAnalysis._analyze_rack_checks(rack_checks_response) #--> We need detail analysis # we can now find the origin transactions # Find the last loan - it will have original_transaction diff --git a/app/config.py b/app/config.py index b4fa912..651ea2b 100644 --- a/app/config.py +++ b/app/config.py @@ -48,4 +48,26 @@ class Config: RAC_RESULT_isWhitelisted = os.environ.get("RAC_RESULT_isWhitelisted", "true") RAC_RESULT_noBouncedCheck = os.environ.get("RAC_RESULT_noBouncedCheck", "true") + rac_true_rules = [ + "rule1-45day-sal", + "rule2-2m-sal", + "rule3-no-bounced-check", + "rule4-current-loan-payments", + "rule5-no-past-due-fadv-loan", + "rule6--no-past-due-other-loan", + "rule7-consistent-salary-amount", + "rule8-whitelisted", + "rule9-regular-account", + "rule10-bvn-validation", + "rule11-CRC-no-delinquency", + "rule12-CRMS-no-delinquency", + "rule13-BVN-ignore", + "rule14-no-lien", + "rule15-null-ignore" + ] + + + + + settings = Config()