package cz.moneta.test.sanity.transactional.cards.firstvision;

import cz.moneta.test.dsl.Harness;
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.sanity.transactional.SmokeData;

import static cz.moneta.test.sanity.transactional.cards.firstvision.MESSAGE.*;

@TestScenario(name = "blocking/unblocking card")
public class BlockUpdate {

    @TestCase(environments = {Environment.TST3, Environment.FVE, Environment.PPE})
    @JiraTestCase(id = "FVP-T1899")
    public void M_CMS_BLOCKCODE_UPD_EMEA(Harness harness) {
        String card = SmokeData.getInstance(harness).getCreditData().getCard();
        harness.withWso2()
                .prepareRequest()
                .withPath(FV)
                .withPojoPayload(new MESSAGE("M.CMS.BLOCKCODE.UPD.EMEA", "E8V1"))
                .addField(VMX_MSGIN, "CARD_NBR", card)
                .addField(VMX_MSGIN, "SVC_FUNC_CODE", "U")
                .addField(VMX_MSGIN, "BLOCK_CODE", "")  //unblock
                .addField(VMX_MSGIN, "RSN_BLOCK_CODE_1", "01")
                .postExtended()
                .andAssertFieldValue(SVC_RETURN, "P")
                .andAssertFieldValue(VMX_MSGOUT + ".RESV_DATE_1", "0");
    }
}
