package cz.moneta.test.regression.channels.branch.archive;

import cz.moneta.test.dsl.Harness;
import cz.moneta.test.dsl.ufo.banka.tasks.BankaTasks;
import cz.moneta.test.dsl.util.credentials.Keys;
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.auth.Credentials;
import cz.moneta.test.harness.support.auth.Key;
import org.junit.jupiter.api.Disabled;

import static cz.moneta.test.dsl.ufo.banka.pages.products.current.account.ZPL_OBR001_SmoothPaymentInfo.SMOOTH_PAYMENT_ID_KEY;

@Disabled
@TestScenario(name = "Teller must be able to create new smooth (foreign) payment")
public class CancelSmoothPayment {

    @TestCase(name = "Creating new smooth payment and then cancel it")
    @JiraTestCase(id = "POB-T19528")
    public void cancelSmoothPayment(Harness harness, @Key(Keys.ufo.banka.banker) Credentials credentials) {

        BankaTasks bankaTasks = harness.tasks().ufo().banka();
        String accountNumberReceiver = "SK4409000000003001979752";
        String receiverName = "Auto Test";
        String receiverAddressStreet = "Kratka";
        String receiverAddressCity = "Bratislava";
        String receiverAddressCountryCode = "SK";
        String currency = "EUR";
        String rcClient = harness.getConfig("branch.squad.rc.client");

        harness.withUfo()
                .openLoginPage()
                .then(bankaTasks.login().withCredentials(credentials))
                .then(bankaTasks.search().findByRC(rcClient))
                .checkProductActive("Běžný účet")
                .getCurrentAccountNumberAndStore()
                .openCurrentAccountDetailPage()
                .openListOfForeignPaymentsPage()
                .then(bankaTasks.payment().createNewSmoothPayment(currency, accountNumberReceiver, receiverName, receiverAddressStreet, receiverAddressCity, receiverAddressCountryCode))
                .then(bankaTasks.payment().cancelSmoothPayment(harness.get(SMOOTH_PAYMENT_ID_KEY)));
    }
}
