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 java.time.LocalDate;
import java.time.format.DateTimeFormatter;

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

@TestScenario(name = "R3 VMX.ACCTWAIVEFLG.UPD.EMEA.E8V4")
public class AccountWaiveFlg {

    @TestCase(environments = {Environment.TST3, Environment.FVE, Environment.PPE})
    @JiraTestCase(id = "FVP-T1916")
    public void VMX_ACCTWAIVEFLG_UPD_EMEA(Harness harness) {
        String accountInput = SmokeData.getInstance(harness).getCreditData().getAccount();
        String startDate = DateTimeFormatter.ofPattern("yyyy-MM-dd").format(LocalDate.now().plusDays(30));
        String expDate = DateTimeFormatter.ofPattern("yyyy-MM-dd").format(LocalDate.now().plusDays(90));
        harness.withWso2()
                .prepareRequestXml()
                .withPath(FV)
                .withPayloadFromFile("regression/transactional/cards/sme/R3-VMX.ACCTWAIVEFLG.UPD.EMEA.E8V4.xml")
                .addField(VMX_MSGIN, "ACCT_NBR", accountInput)
                .addField(VMX_MSGIN, "FOREX_FEE_WV_ST_DT", startDate)
                .addField(VMX_MSGIN, "FOREX_FEE_WV_EXP_DT", expDate)
                .postExtended()
                .andAssertStatus(200)
                .andAssertFieldValue(SVC_RETURN, "P");
    }
}
