### ============================================================ ### 企业客户利率定价流程接口测试脚本 ### 用途:测试企业客户发起接口的各项场景 ### ============================================================ ### ============================================================ ### 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/corporate Authorization: Bearer {{token}} Content-Type: application/json { "custIsn": "CORP001", "custName": "测试科技有限公司", "idType": "统一社会信用代码", "idNum": "91110000100000000X", "guarType": "抵押", "applyAmt": "1000000", "loanTerm": "36", "isAgriGuar": "false", "isGreenLoan": "true", "isTechEnt": "true" } > {% client.test("Corporate 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"); client.assert(response.body.data.loanTerm === "36", "Loan term is correct"); }); %} ### ============================================================ ### 3. 企业客户发起 - 缺少必填字段 custIsn ### ============================================================ POST http://localhost:8080/loanPricing/workflow/create/corporate Authorization: Bearer {{token}} Content-Type: application/json { "custName": "测试企业2", "idType": "统一社会信用代码", "idNum": "91110000100000001X", "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/corporate Authorization: Bearer {{token}} Content-Type: application/json { "custIsn": "CORP002", "custName": "测试企业3", "idType": "统一社会信用代码", "idNum": "91110000100000002X", "applyAmt": "800000" } > {% 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/corporate Authorization: Bearer {{token}} Content-Type: application/json { "custIsn": "CORP003", "custName": "测试企业4", "guarType": "保证", "idType": "统一社会信用代码", "idNum": "91110000100000003X" } > {% 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/corporate Authorization: Bearer {{token}} Content-Type: application/json { "custIsn": "CORP004", "custName": "测试企业5", "idType": "统一社会信用代码", "idNum": "91110000100000004X", "guarType": "无效值", "applyAmt": "600000" } > {% 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/corporate Authorization: Bearer {{token}} Content-Type: application/json { "custIsn": "CORP005", "custName": "农业科技有限公司", "idType": "统一社会信用代码", "idNum": "91110000100000005X", "guarType": "保证", "applyAmt": "2000000", "loanTerm": "60", "isAgriGuar": "true" } > {% client.test("Corporate loan with agricultural guarantee", 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.isAgriGuar === "true", "Agricultural guarantee is set"); }); %} ### ============================================================ ### 8. 企业客户发起 - 贸易和建筑业企业标识 ### ============================================================ POST http://localhost:8080/loanPricing/workflow/create/corporate Authorization: Bearer {{token}} Content-Type: application/json { "custIsn": "CORP006", "custName": "建筑工程有限公司", "idType": "统一社会信用代码", "idNum": "91110000100000006X", "guarType": "质押", "applyAmt": "1500000", "loanTerm": "24", "isTradeConstruction": "true" } > {% client.test("Corporate loan for trade/construction", 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.isTradeConstruction === "true", "Trade/construction flag is set"); }); %} ### ============================================================ ### 9. 企业客户发起 - 所有字段必填(信用贷款场景) ### ============================================================ POST http://localhost:8080/loanPricing/workflow/create/corporate Authorization: Bearer {{token}} Content-Type: application/json { "custIsn": "CORP007", "custName": "科技创新有限公司", "idType": "统一社会信用代码", "idNum": "91110000100000007X", "guarType": "信用", "applyAmt": "3000000", "loanTerm": "12", "isAgriGuar": "false", "isGreenLoan": "true", "isTechEnt": "true", "isTradeConstruction": "false", "collType": "一类", "collThirdParty": "false" } > {% client.test("Corporate 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"); }); %}