1 Commits

Author SHA1 Message Date
VivianDee 70876a48e2 Update autocall.py 2025-11-11 07:06:01 +01:00
2 changed files with 12 additions and 12 deletions
+1 -10
View File
@@ -2,7 +2,6 @@ import requests
from app.config import settings
from app.helpers.response_helper import ResponseHelper
# from app.routes.autocall import verify_transaction
from app.models.customer import Customer
from app.services.loan import LoanService
from app.services.loan_repayment_schedule import LoanRepaymentScheduleService
from app.utils.auth import get_headers
@@ -282,16 +281,8 @@ class SimbrellaClient:
logger.info(f"this is verify result, {result}")
LoanService.set_disburse_verify_result(loan_data['debtId'], result.get('responseCode', ''),
result.get('responseMessage', ''))
customer = Customer.get_customer(loan_data.get('customerId'))
if customer:
misisdn = customer.msisdn
else:
logger.info(f"Customer does not exist for customer id: {loan_data.get('customerId')}")
misisdn = settings.TEST_NO
sms_data = {
"dest": misisdn,
"dest": transaction_data.get('phone_number') or settings.TEST_NO,
"text": f"Transaction {loan_data.get('transactionId')} verified successfully",
"unicode": True
}
+11 -2
View File
@@ -1,3 +1,4 @@
from threading import Thread
from flask import Blueprint, request, jsonify, current_app
import requests
from app.extensions import db
@@ -194,8 +195,16 @@ def direct_loan():
"productId": str(loan_data.get('productId', "")),
"provideAmount": loan_data.get('currentLoanAmount'),
}
response = SimbrellaClient.disburse_loan(data_to_process)
return response
logger.info(f"Starting disbursement thread for {data_to_process['transactionId']}")
thread = Thread(target=SimbrellaClient.disburse_loan, args=(data_to_process,))
thread.start()
return jsonify({
"status": "success",
"message": f"Loan disbursement has been queued for processing."
}), 200
@autocall_bp.route("/direct/repayment", methods=["POST"])
def direct_repayment():