package cz.moneta.test.regression.channels.digital.ib.oldib.payment;

import cz.moneta.test.dsl.Harness;
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 cz.moneta.test.harness.annotations.JiraTestCase;
import org.junit.jupiter.api.Disabled;

@TestScenario(name = "Verify foreign payments")
public class ForeignPaymentOrderTest {

    @Disabled
    @TestCase(name = "Go to current account and make foreign payment")
    @JiraTestCase(id="IB-T8239")
    void userWithCurrentAccount_shouldCreateNewForeignPayment(Harness harness, @Key("ib.client") Credentials credentials) {
        harness.withIB()
                .openLoginPage()
                .then(harness.tasks().ib().loginWithDefaultMobileKeyAnd(credentials))
                .clickAccountsAndTransactions()
                .clickNewForeignPaymentOrder()
                .clickFromAccountSelect()
                .fillAmount("10")
                .clickCurrencySelect("EUR")
                .clickChargeSelect("BEN")
                .fillToAccountNumber("CR23015108410026012345")
                .fillRecipientName("Karl von Banhof")
                .fillRecipientAddress("Dircksenstr. 2")
                .fillRecipientCity("10179 Frankfurt")
                .fillNote("Note")
                .clickContinueButton()
                .clickSign()
                .typeSmsCode("12341234")
                .clickSend()
                .clickListPaymentOrders();
    }

    @Disabled
    @TestCase(name = "Go to current account and make foreign SEPA payment")
    @JiraTestCase(id="IB-T8240")
    void userWithCurrentAccount_shouldCreateNewForeignSEPAPayment(Harness harness, @Key("ib.client") Credentials credentials) {
            harness.withIB()
                    .openLoginPage()
                    .then(harness.tasks().ib().loginWithDefaultMobileKeyAnd(credentials))
                    .clickAccountsAndTransactions()
                    .clickNewForeignPaymentOrder()
                    .clickSEPAPayment()
                    .clickFromAccountSelect()
                    .fillAmount("1")
                    .clickCurrencySelect("EUR")
                    .clickChargeSelect("SHA")
                    .fillToSEPAAccountNumber("DE89370400440532013000")
                    .fillRecipientName("Karl von Banhof")
                    .fillRecipientAddress("Dircksenstr. 2")
                    .fillRecipientCity("10179 Frankfurt")
                    .fillNote("Note")
                    .clickContinueButton()
                    .clickSign()
                    .typeSmsCode("12341234")
                    .clickSend()
                    .clickListPaymentOrders();
        }

    @Disabled
    @TestCase(name = "Foreign currency order between own accounts")
    @JiraTestCase(id="IB-T8250")
    void userWithTwoCurrentAccount_shouldCreateNewForeignOrderBetweenOwnAccounts(Harness harness){
        String rcOfClientWithCZKandEURacc = harness.getConfig("IB.rc.user-with-CZK-and-EUR-account");

        Credentials udebsCredentials = harness.withUdebs()
                .ib()
                .usernameAndPassword()
                .getUsernameAndPasswordByRc(rcOfClientWithCZKandEURacc);

        harness.withIB()
                .openLoginPage()
                .then(harness.tasks().ib().loginWithDefaultMobileKeyAnd(udebsCredentials))
                .clickAccountsAndTransactions()
                .clickNewForeignPaymentOrder()
                .clickForeignPaymentBetweenOwnPayment()
                .clickFromFirstAccountSelect()
                .clickToOwnSecondAccountSelect()
                .fillAmount("1")
                .clickCurrencySelect("EUR")
                .clickContinueButton()
                .clickSign()
                .typeSmsCode("12341234")
                .clickSend()
                .clickListPaymentOrders();
    }

    @Disabled
    @TestCase(name = "Foreign currency order within MONETA Money Bank")
    @JiraTestCase(id="IB-T8255")
    void userWithCurrentAccount_shouldCreateNewForeignOrderBetweenMmbAccounts(Harness harness, @Key("ib.client") Credentials credentials){
        harness.withIB()
                .openLoginPage()
                .then(harness.tasks().ib().loginWithDefaultMobileKeyAnd(credentials))
                .clickAccountsAndTransactions()
                .clickNewForeignPaymentOrder()
                .clickForeignPaymentBetweenMMBAccountsPayment()
                .clickFromAccountSelect()
                .fillToMMBAccountNumber("123")
                .clickCheckRecipientsAccButton()
                .fillAmount("1")
                .clickCurrencySelect("CZK")
                .clickContinueButton()
                .clickSign()
                .typeSmsCode("12341234")
                .clickSend()
                .clickListPaymentOrders();
    }
}

