Merge branch 'oluyemi' of DigiFi/digifi-EventManager into master

This commit is contained in:
2025-04-14 17:10:34 +00:00
committed by Gogs
3 changed files with 25 additions and 32 deletions
+1 -1
View File
@@ -51,7 +51,7 @@ class KafkaIntegration:
:return: The message value (decoded) or None if no message is received :return: The message value (decoded) or None if no message is received
""" """
consumer = KafkaIntegration._get_consumer() consumer = KafkaIntegration._get_consumer()
# consumer.subscribe(["LOAN_REPAYMENT"]) # consumer.subscribe(["PROCESS_PAYMENT"])
# consumer.subscribe([topic]) # consumer.subscribe([topic])
consumer.subscribe(['LOAN_REPAYMENT', 'PROCESS_PAYMENT']) consumer.subscribe(['LOAN_REPAYMENT', 'PROCESS_PAYMENT'])
+20 -27
View File
@@ -14,16 +14,6 @@ class SimbrellaClient:
logger.info(f"BANK_CALL_BASE_URL = {SimbrellaClient.BANK_CALL_BASE_URL}") logger.info(f"BANK_CALL_BASE_URL = {SimbrellaClient.BANK_CALL_BASE_URL}")
logger.info(f"Calling Disbursement endpoint with data: {data}") logger.info(f"Calling Disbursement endpoint with data: {data}")
data={
"requestId": "RQID1743987402764",
"transactionId": "24",
"customerId": "CN437703",
"accountId": "ACN2167485",
"msisdn": "3451342",
"resultCode": "00",
"resultDescription": "Successful"
}
disbursement_data ={ disbursement_data ={
"requestId": data['requestId'], "requestId": data['requestId'],
"transactionId": data['transactionId'], "transactionId": data['transactionId'],
@@ -61,10 +51,10 @@ class SimbrellaClient:
collect_loan_data = { collect_loan_data = {
"transactionId": "T002", "transactionId": "T002",
"fbnTransactionId": "FBN20231123", "fbnTransactionId": "FBN20231123",
"debtId": "273194670", "debtId": data['debtId'],
"customerId": "CN621868", "customerId": data['customerId'],
"accountId": "2017821799", "accountId": "2017821799",
"productId": "101", "productId": data['productId'],
"collectAmount": 80000, "collectAmount": 80000,
"penalCharge": 0, "penalCharge": 0,
"collectionMethod": 1, "collectionMethod": 1,
@@ -85,17 +75,20 @@ class SimbrellaClient:
return 1 return 1
@staticmethod @staticmethod
def verify_transaction(data): def verify_transaction():
api_url = f"{SimbrellaClient.BANK_CALL_BASE_URL}/TransactionVerify" # api_url = f"{SimbrellaClient.BANK_CALL_BASE_URL}/TransactionVerify"
logger.info(f"BANK_CALL_BASE_URL = {SimbrellaClient.BANK_CALL_BASE_URL}") # logger.info(f"BANK_CALL_BASE_URL = {SimbrellaClient.BANK_CALL_BASE_URL}")
logger.info(f"Calling TransactionVerify endpoint with data: {data}") # logger.info(f"Calling TransactionVerify endpoint with data: {data}")
try: try:
logger.info(f"Here is your TransactionVerify Request data ***** : {data}") # logger.info(f"Here is your TransactionVerify Request data ***** : {data}")
response = requests.post(api_url, json=data, headers=get_headers()) # response = requests.post(api_url, json=data, headers=get_headers())
logger.info(f"TransactionVerify response: {response.json()}") # logger.info(f"TransactionVerify response: {response.json()}")
return response.json() return {
"status": "00",
"message": "Transaction verified"
}
except Exception as e: except Exception as e:
logger.info(f"Failed to call TransactionVerify endpoint: {e}") logger.info(f"Failed to call TransactionVerify endpoint: {e}")
@@ -103,9 +96,9 @@ class SimbrellaClient:
@staticmethod @staticmethod
def refresh_disbursement(data): def refresh_disbursement(data):
api_url = f"{SimbrellaClient.BANK_CALL_BASE_URL}/Disbursement" # api_url = f"{SimbrellaClient.BANK_CALL_BASE_URL}/Disbursement"
logger.info(f"BANK_CALL_BASE_URL = {SimbrellaClient.BANK_CALL_BASE_URL}") # logger.info(f"BANK_CALL_BASE_URL = {SimbrellaClient.BANK_CALL_BASE_URL}")
logger.info(f"Calling Disbursement endpoint with data: {data}") # logger.info(f"Calling Disbursement endpoint with data: {data}")
try: try:
logger.info(f"Here is your Disbursement Request data ***** : {data}") logger.info(f"Here is your Disbursement Request data ***** : {data}")
@@ -122,9 +115,9 @@ class SimbrellaClient:
@staticmethod @staticmethod
def payment_callback(data): def payment_callback(data):
api_url = f"{SimbrellaClient.BANK_CALL_BASE_URL}/Payment" # api_url = f"{SimbrellaClient.BANK_CALL_BASE_URL}/Payment"
logger.info(f"BANK_CALL_BASE_URL = {SimbrellaClient.BANK_CALL_BASE_URL}") # logger.info(f"BANK_CALL_BASE_URL = {SimbrellaClient.BANK_CALL_BASE_URL}")
logger.info(f"Calling Payment Callback endpoint with data: {data}") # logger.info(f"Calling Payment Callback endpoint with data: {data}")
try: try:
logger.info(f"Here is your Payment Callback Request data ***** : {data}") logger.info(f"Here is your Payment Callback Request data ***** : {data}")
+4 -4
View File
@@ -9,19 +9,19 @@ autocall_bp = Blueprint("autocall", __name__)
@autocall_bp.route("/refresh-verify-disbursement", methods=["GET"]) @autocall_bp.route("/refresh-verify-disbursement", methods=["GET"])
def verify_transaction(): def verify_transaction():
data = request.json() # data = request.json()
logger.info(f"Calling VerifyTransaction Components") logger.info(f"Calling VerifyTransaction Components")
response = SimbrellaClient.verify_transaction(data) response = SimbrellaClient.verify_transaction()
return jsonify(response), 200 return jsonify(response), 200
@autocall_bp.route("/refresh-disbursement", methods=["GET"]) @autocall_bp.route("/refresh-disbursement", methods=["GET"])
def disbursement(): def disbursement():
data = request.json() # data = request.json()
logger.info(f"Calling Disbursement Components") logger.info(f"Calling Disbursement Components")
response = SimbrellaClient.verify_transaction(data) response = SimbrellaClient.verify_transaction()
return jsonify(response), 200 return jsonify(response), 200