done with kafka integration

This commit is contained in:
2025-04-14 18:02:30 +01:00
parent cc333ebff4
commit cf57e400d5
2 changed files with 17 additions and 27 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'])
+16 -26
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,
@@ -86,16 +76,16 @@ class SimbrellaClient:
@staticmethod @staticmethod
def verify_transaction(data): def verify_transaction(data):
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 data
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 +93,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 +112,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}")