package cz.moneta.test.regression.cvm.api.risk;


import cz.moneta.test.dsl.Harness;
import cz.moneta.test.harness.annotations.TestCase;
import cz.moneta.test.harness.annotations.TestScenario;

import static cz.moneta.test.harness.annotations.Environment.PPE;
import static cz.moneta.test.harness.annotations.Environment.TST1;

@TestScenario(name = "Call API GET_PRDCT_CAND_APP_026 to WSO2 and assert response parameters")
public class ApiGetPrdctCandApp026 {

    @TestCase(name = "Call API GET_PRDCT_CAND_APP_026 to WSO2", environments = {TST1, PPE})
    public void postGetPrdctCandApp026(Harness harness) {
        harness.tasks().wso2().restRequest().prepareRequestFromCvm("risk.cluster/NAS/GET_PRDCT_CAND_APP_026/001", true,
                "{\n" +
                        "    \"APP_KEY\": 62546575,\n" +
                        "    \"PRODUCT_CANDIDATE_TYPE_IN\": \"R\",\n" +
                        "    \"CONTEXT_TYPE\": \"\"\n" +
                        "}")
                .post()
                .andAssertStatus(200)
                .andAssertFieldValue("tifResponseStatus.resultCode", "0")
                .andAssertPresent("RS_DATA")
                .andAssertPresent("RS_DATA[0]")
                .andAssertPresent("RS_DATA[0].PC_INS_DT")
                .andAssertPresent("RS_DATA[0].INST_AMOUNT")
                .andAssertPresent("RS_DATA[0].LOAN_AMOUNT");
    }
}
