Files
loan-pricing/test_api/test_personal_create.http

197 lines
6.3 KiB
Plaintext
Raw Normal View History

2026-02-02 15:25:38 +08:00
### ============================================================
### 个人客户利率定价流程接口测试脚本
### 用途:测试个人客户发起接口的各项场景
### ============================================================
### ============================================================
### 1. 获取测试 Token
### ============================================================
POST http://localhost:8080/login/test
Content-Type: application/json
{
"username": "admin",
"password": "admin123"
}
> {%
client.test("Request executed successfully", function () {
client.assert(response.status === 200, "Response status is 200");
client.assert(response.body.code === 200, "Response code is 200");
client.global.set("token", response.body.data.token);
});
%}
### ============================================================
### 2. 个人客户发起 - 成功场景(完整必填字段)
### ============================================================
POST http://localhost:8080/loanPricing/workflow/create/personal
Authorization: Bearer {{token}}
Content-Type: application/json
{
"custIsn": "TEST001",
"custName": "张三",
"idType": "身份证",
"idNum": "110101199001011234",
"guarType": "信用",
"applyAmt": "500000",
"bizProof": "true",
"loanLoop": "false"
}
> {%
client.test("Personal loan creation successful", function () {
client.assert(response.status === 200, "Response status is 200");
client.assert(response.body.code === 200, "Response code is 200");
client.assert(response.body.data.custType === "个人", "Customer type is 个人");
client.assert(response.body.data.serialNum !== null, "Serial number is generated");
});
%}
### ============================================================
### 3. 个人客户发起 - 缺少必填字段 custIsn
### ============================================================
POST http://localhost:8080/loanPricing/workflow/create/personal
Authorization: Bearer {{token}}
Content-Type: application/json
{
"custName": "张三",
"idType": "身份证",
"idNum": "110101199001011234",
"guarType": "信用",
"applyAmt": "500000"
}
> {%
client.test("Missing custIsn validation works", function () {
client.assert(response.status === 200, "Response status is 200");
client.assert(response.body.code === 500, "Response code indicates validation error");
});
%}
### ============================================================
### 4. 个人客户发起 - 缺少必填字段 guarType
### ============================================================
POST http://localhost:8080/loanPricing/workflow/create/personal
Authorization: Bearer {{token}}
Content-Type: application/json
{
"custIsn": "TEST002",
"custName": "李四",
"idType": "身份证",
"idNum": "110101199001011235",
"applyAmt": "300000"
}
> {%
client.test("Missing guarType validation works", function () {
client.assert(response.status === 200, "Response status is 200");
client.assert(response.body.code === 500, "Response code indicates validation error");
});
%}
### ============================================================
### 5. 个人客户发起 - 缺少必填字段 applyAmt
### ============================================================
POST http://localhost:8080/loanPricing/workflow/create/personal
Authorization: Bearer {{token}}
Content-Type: application/json
{
"custIsn": "TEST003",
"custName": "王五",
"guarType": "保证",
"idType": "身份证",
"idNum": "110101199001011236"
}
> {%
client.test("Missing applyAmt validation works", function () {
client.assert(response.status === 200, "Response status is 200");
client.assert(response.body.code === 500, "Response code indicates validation error");
});
%}
### ============================================================
### 6. 个人客户发起 - 担保方式枚举验证失败
### ============================================================
POST http://localhost:8080/loanPricing/workflow/create/personal
Authorization: Bearer {{token}}
Content-Type: application/json
{
"custIsn": "TEST004",
"custName": "赵六",
"idType": "身份证",
"idNum": "110101199001011237",
"guarType": "无效值",
"applyAmt": "200000"
}
> {%
client.test("Invalid guarType validation works", function () {
client.assert(response.status === 200, "Response status is 200");
client.assert(response.body.code === 500, "Response code indicates validation error");
});
%}
### ============================================================
### 7. 个人客户发起 - 包含抵质押信息
### ============================================================
POST http://localhost:8080/loanPricing/workflow/create/personal
Authorization: Bearer {{token}}
Content-Type: application/json
{
"custIsn": "TEST005",
"custName": "孙七",
"idType": "身份证",
"idNum": "110101199001011238",
"guarType": "抵押",
"applyAmt": "800000",
"bizProof": "true",
"loanLoop": "true",
"collType": "一类",
"collThirdParty": "false"
}
> {%
client.test("Personal loan with collateral info", function () {
client.assert(response.status === 200, "Response status is 200");
client.assert(response.body.code === 200, "Response code is 200");
client.assert(response.body.data.collType === "一类", "Collateral type is correct");
client.assert(response.body.data.loanLoop === "true", "Loan loop is set");
});
%}
### ============================================================
### 8. 个人客户发起 - 所有字段必填(质押贷款场景)
### ============================================================
POST http://localhost:8080/loanPricing/workflow/create/personal
Authorization: Bearer {{token}}
Content-Type: application/json
{
"custIsn": "TEST006",
"custName": "周八",
"idType": "身份证",
"idNum": "110101199001011239",
"guarType": "质押",
"applyAmt": "100000",
"bizProof": "false",
"loanLoop": "false",
"collType": "二类",
"collThirdParty": "true"
}
> {%
client.test("Personal loan with all required fields", function () {
client.assert(response.status === 200, "Response status is 200");
client.assert(response.body.code === 200, "Response code is 200");
client.assert(response.body.data.collThirdParty === "true", "Collateral third party is set");
});
%}