offer analysis

This commit is contained in:
CHIEFSOFT\ameye
2025-06-05 23:06:09 -04:00
parent c400f1d69d
commit e8d930f9b8
4 changed files with 30 additions and 35 deletions
-30
View File
@@ -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",
+1 -1
View File
@@ -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,
+7 -4
View File
@@ -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
+22
View File
@@ -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()