diff --git a/app/config.py b/app/config.py index 843fde1..684aca4 100644 --- a/app/config.py +++ b/app/config.py @@ -19,7 +19,7 @@ class Config: ) BANK_CALL_APP_ID = os.getenv("BANK_CALL_APP_ID", "app1") - BANK_CALL_API_KEY = os.getenv("BANK_CALL_API_KEY", "test-api-key-12345") + BANK_CALL_API_KEY = os.getenv("BANK_CALL_API_KEY", "testtest-api-key-12345") BANK_CALL_BASIC_AUTH_USERNAME = os.environ.get( "BANK_CALL_BASIC_AUTH_USERNAME", "user" ) @@ -36,7 +36,7 @@ class Config: SQLALCHEMY_DATABASE_URI = f"postgresql+psycopg2://{DATABASE_USER}:{DATABASE_PASSWORD}@{DATABASE_HOST}:{DATABASE_PORT}/{DATABASE_NAME}" SQLALCHEMY_TRACK_MODIFICATIONS = False - BANK_CALL_BASE_URL = os.getenv("BANK_CALL_BASE_URL", "https://bank-emulator.dev.simbrellang.net") + BANK_CALL_BASE_URL = os.getenv("BANK_CALL_BASE_URL", "https://bank-emulator.dev.simbrellang.net/api") BANK_CALL_SMS_BASE_URL= os.getenv("BANK_CALL_SMS_BASE_URL","https://first-advance-middleware-develop.fbn-devops-dev-asenv.appserviceenvironment.net/SMS") BANK_CALL_DISBURSE_LOAN_ENDPOINT = os.getenv("BANK_CALL_DISBURSE_LOAN_ENDPOINT","/DisburseLoan") BANK_CALL_COLLECT_LOAN_ENDPOINT = os.getenv("BANK_CALL_COLLECT_LOAN_ENDPOINT","/CollectLoan") diff --git a/app/integrations/simbrella.py b/app/integrations/simbrella.py index 091b6d3..29d12e0 100644 --- a/app/integrations/simbrella.py +++ b/app/integrations/simbrella.py @@ -269,6 +269,7 @@ class SimbrellaClient: try: logger.info(f"Here is your CollectLoan Request data ***** : {collect_loan_data}") response = requests.post(api_url, json=collect_loan_data,timeout=30, headers=get_headers()) + logger.info(f"headers: {get_headers()}") logger.info(f"CollectLoan response: {response.json()}") RepaymentService.set_repay_result(repayment_data['Id'], response.json().get('responseCode', ''), response.json().get('responseMessage', '')) diff --git a/app/models/loan.py b/app/models/loan.py index 5a6c5ac..d40fe65 100644 --- a/app/models/loan.py +++ b/app/models/loan.py @@ -88,7 +88,10 @@ class Loan(db.Model): 'loanDate': self.created_at.isoformat() if self.created_at else None, 'disburseDate': self.disburse_date.isoformat() if self.disburse_date else None, 'disburseVerify': self.disburse_verify.isoformat() if self.disburse_verify else None, - 'reference': self.reference + 'reference': self.reference, + 'balance': self.balance, + 'tenor': self.tenor, + } @classmethod @@ -293,7 +296,7 @@ class Loan(db.Model): raise ValueError("Repayment amount exceeds current loan balance.") # Deduct the amount from the current balance - loan.balance -= amount_collected + loan.balance -= float(amount_collected) loan.updated_at = datetime.now(timezone.utc) db.session.commit()