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 org.junit.jupiter.api.BeforeAll;

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

@TestScenario(name = "M.CMS.ACCT.USER.DATA.UPD R8V3A")
public class AccountUpdate {
    private String account;

    @BeforeAll
    public void getInfo(Harness harness) {
        account = SmokeData.getInstance(harness).getCreditData().getAccount();
    }

    @TestCase(environments = {Environment.TST3, Environment.FVE, Environment.PPE})
    @JiraTestCase(id = "FVP-T3137")
    public void AccountDataUpdate(Harness harness) {
        harness.withWso2()
                .prepareRequest()
                .withPath(FV)
                .withPojoPayload(new MESSAGE("M.CMS.ACCT.USER.DATA.UPD", "R8V3A"))
                .addField(VMX_MSGIN, "ACCT_NBR", account)
                .postExtended()
                .andAssertStatus(200)
                .andAssertFieldValue(SVC_RETURN, "P");
    }
}
