package cz.moneta.test.sanity.transactional.cards.wso2.pilotwso2;

import cz.moneta.test.dsl.Harness;
import cz.moneta.test.dsl.wso2.Wso2Utils;
import cz.moneta.test.harness.annotations.Environment;
import cz.moneta.test.harness.annotations.JiraTestCase;
import cz.moneta.test.harness.annotations.TestCase;
import cz.moneta.test.harness.annotations.TestScenario;
import cz.moneta.test.harness.support.rest.RawRestRequest;
import cz.moneta.test.sanity.transactional.SmokeData;
import org.junit.jupiter.api.BeforeAll;

@TestScenario(name = "ProductTransfer")
public class ProductTransfer {
    private String contract;
    private SmokeData smokeData;

    @BeforeAll
    public void getInfo(Harness harness) {
        smokeData = SmokeData.getInstance(harness);
        contract = smokeData.getCreditData().getContract();
    }

    @TestCase(environments = {Environment.TST3, Environment.FVE, Environment.PPE})
    @JiraTestCase(id = "FVP-T2432")
    public void MWFJS5ProductTransferCheck(Harness harness) {
        RawRestRequest.Response response = harness.tasks().wso2().restRequest()
                .prepareEmptyRequestFromWps(smokeData.getPath("MWFJS5"))
                .addField("CisloSmlouvy", contract)
                .addField("CilovyProdukt", "29010")
                .postExtended();

        Wso2Utils.validateResponse(response,
                400,
                smokeData.isGw(),
                "tifResponseStatus.errorDesc",
                "MWFJS5: INACTIVE",
                "errorMessage",
                "INACTIVE");
    }
}
