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 DO_KO_005 to WSO2 and assert response parameters")
public class ApiDoKo005 {

    @TestCase(name = "Call API DO_KO_005 to WSO2", environments = {TST1, PPE})
    public void postDoKo005(Harness harness) {
        harness.tasks().wso2().restRequest().prepareRequestFromCvm("risk.cluster/NAS/DO_KO_005/001", true,
                "{\n" +
                        " \"RC\": \"461119444\",\n" +
                        " \"ONLINE_CHECK\":1\n" +
                        "}")
                .post()
                .andAssertStatus(200)
                .andAssertFieldValue("tifResponseStatus.resultCode", "0")
                .andAssertPresent("RS_DATA")
                .andAssertPresent("RS_DATA[0]")
                .andAssertPresent("RS_DATA[0].ID_BUSINESS")
                .andAssertPresent("RS_DATA[0].CUST_TYPE")
                .andAssertPresent("KO_FLAG");
    }
}
