个人贷款服务API

一个轻量级的后端API,用于个人贷款资格检查、贷款申请管理、文件验证和EMI计算。

  • by PulkitAg13
  • Python
  • 本地部署
  • 更新于
在 GitHub 查看 PulkitAg13/MCP-SERVER-TATA-CAPITAL

使用说明

MCP-SERVER-TATA-CAPITAL

🚀 贷款销售机构API

用于个人贷款资格、优惠、文件验证和申请管理的轻量级后端API。


📌 基本URL

http://127.0.0.1:8000/docs

📂 API端点概述

端点 方法 描述
/health GET 服务器状态检查
/loan/personal/check-eligibility POST 检查客户贷款资格
/loan/personal/apply POST 提交个人贷款申请
/loan/personal/status POST 跟踪贷款申请状态
/loan/personal/offer POST 生成贷款报价
/loan/personal/verify-pan POST PAN验证
/loan/personal/verify-salary-slip POST 工资单验证
/loan/personal/cibil-score POST 获取CIBIL分数
/loan/personal/calculate-emi POST 计算电磁干扰

🟢 1. GET/健康

✔ 检查服务器是否处于活动状态

回应

{
  "status": "ok",
  "message": "Server is running"
}

🟦 2. 邮政/贷款/个人/支票资格

根据收入、CIBIL、年龄和现有负债检查贷款资格。

示例请求

{
  "customer_id": "CUST001",
  "age": 28,
  "monthly_income": 45000,
  "existing_emis": 5000,
  "cibil_score": 735,
  "employment_type": "salaried"
}

✔ 成功

{
  "eligible": true,
  "approved_amount": 250000,
  "interest_rate": 12.5,
  "message": "Customer is eligible for the loan"
}

❌ 低收入

{
  "eligible": false,
  "message": "Minimum income requirement not met"
}

❌ 低CIBIL

{
  "eligible": false,
  "message": "CIBIL score too low for personal loan"
}

🟦 3. 邮政/贷款/个人/申请

创建贷款申请条目。

示例请求

{
  "customer_id": "CUST001",
  "loan_amount": 200000,
  "tenure_months": 36,
  "income": 45000,
  "employment_type": "salaried",
  "address": "Mumbai"
}

✔ 成功

{
  "application_id": "APP10235",
  "status": "submitted",
  "message": "Loan application submitted successfully"
}

❌ 缺少字段

{
  "error": "customer_id and loan_amount are required"
}

🟦 4. 邮政/贷款/个人/身份

检索贷款申请的状态。

示例请求

{
  "application_id": "APP10235"
}

✔ 成功

{
  "application_id": "APP10235",
  "status": "under_review"
}

❌ 无效ID

{
  "error": "Application ID not found"
}

🟦 5. 邮政/贷款/个人/报价

生成个性化贷款报价。

示例请求

{
  "customer_id": "CUST001",
  "income": 45000,
  "cibil_score": 730
}

✔ 成功

{
  "customer_id": "CUST001",
  "offers": [
    {
      "loan_amount": 200000,
      "interest_rate": 12.4,
      "tenure_months": 36
    },
    {
      "loan_amount": 300000,
      "interest_rate": 13.5,
      "tenure_months": 48
    }
  ]
}

🟦 6. 邮政/贷款/个人/验证潘

验证PAN号码格式和映射。

示例请求

{
  "customer_id": "CUST001",
  "pan_number": "ABCDE1234F"
}

✔ 成功

{
  "valid": true,
  "message": "PAN verification successful"
}

❌ PAN无效

{
  "valid": false,
  "message": "Invalid PAN format or not found"
}

🟦 7. 邮寄/贷款/个人/核实工资单

验证客户的工资单是否在后端数据文件夹中可用。

示例请求

{
  "customer_id": "CUST001"
}

✔ 成功

{
  "verified": true,
  "file": "salary_slip_CUST001.pdf"
}

❌ 未找到

{
  "verified": false,
  "message": "Salary slip not found"
}

🟦 8. POST/贷款/个人/cibil评分

返回客户存储的CIBIL分数。

示例请求

{
  "customer_id": "CUST001"
}

✔ 成功

{
  "customer_id": "CUST001",
  "cibil_score": 742
}

❌ 未找到

{
  "error": "Customer not found"
}

🟦 9. 邮政/贷款/个人/计算emi

使用递减余额利息公式计算EMI。

示例请求

{
  "loan_amount": 200000,
  "interest_rate": 12.5,
  "tenure_months": 36
}

✔ 成功

{
  "emi": 6681.23
}

❌ 缺少字段

{
  "error": "loan_amount, interest_rate and tenure_months are required"
}

📌 文件夹结构示例

project/
│── main.py
│── requirements.txt
│── data/
│    ├── salary_slips/
│    │    ├── salary_slip_CUST001.pdf
│    │    ├── salary_slip_CUST002.pdf
│    │    └── ...
│    └── cibil_scores.json

🚀 运行服务器

uvicorn main:app --reload