package cz.moneta.test.system.messaging.imq;

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.endpoints.imq.ImqFirstVisionQueue;

/**
 * Unit tests for IBM MQ First Vision DSL methods.
 */
@TestScenario(name = "IBM MQ First Vision DSL Tests")
public class ImqPaymentNotificationTest {

	@TestCase(name = "Send and receive XML message")
	public void sendXmlMessage(Harness harness) {
		
        harness.withImqFirstVision().toQueue(ImqFirstVisionQueue.MF_REQUESTS).asXml()
				.withPayload("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + //
                                        "<VMX_ROOT>\n" + //
                                        "    <VMX_HEADER>\n" + //
                                        "        <MSGID>VMX.AUTH.NOTIFICATION</MSGID>\n" + //
                                        "        <VERSION>E8V7</VERSION>\n" + //
                                        "        <CLIENTID></CLIENTID>\n" + //
                                        "        <CORRELID></CORRELID>\n" + //
                                        "        <CONTEXT></CONTEXT>\n" + //
                                        "        <NAME></NAME>\n" + //
                                        "    </VMX_HEADER>\n" + //
                                        "    <VMX_MSGOUT>\n" + //
                                        "        <ORG>861</ORG>\n" + //
                                        "        <ACCOUNT>0008614010000001420</ACCOUNT>\n" + //
                                        "        <CARD>0004243360154676065</CARD>\n" + //
                                        "        <CH_NAME>XXXX XXXXX</CH_NAME>\n" + //
                                        "        <CH_LANG_CD>P</CH_LANG_CD>\n" + //
                                        "        <MOBILE>0000000000000000</MOBILE>\n" + //
                                        "        <LANG_IND></LANG_IND>\n" + //
                                        "        <AUTH_IND>D</AUTH_IND>\n" + //
                                        "        <AUTH_RSN_CD>670</AUTH_RSN_CD>\n" + //
                                        "        <AUTH_RSN>CARD USAGE NOT ALLOWED</AUTH_RSN>\n" + //
                                        "        <CH_BLNG_AMT>2000</CH_BLNG_AMT>\n" + //
                                        "        <TXN_AMT>2000</TXN_AMT>\n" + //
                                        "        <TXN_CURR>CZK</TXN_CURR>\n" + //
                                        "        <TXN_DATE>20240219</TXN_DATE>\n" + //
                                        "        <GMT_TIME>120947</GMT_TIME>\n" + //
                                        "        <CNTRY_CD>203</CNTRY_CD>\n" + //
                                        "        <MERCH_NAME>POS</MERCH_NAME>\n" + //
                                        "        <MERCH_CITY>Ameri</MERCH_CITY>\n" + //
                                        "        <MERCH_CNTRY>CZ</MERCH_CNTRY>\n" + //
                                        "        <MCC>5411</MCC>\n" + //
                                        "        <TRN_TYPE_CD>0</TRN_TYPE_CD>\n" + //
                                        "        <POS_ENTRY>0510</POS_ENTRY>\n" + //
                                        "        <AUTH_CD></AUTH_CD>\n" + //
                                        "        <CRLIM>25000000</CRLIM>\n" + //
                                        "        <OUTSDNG_BAL>0</OUTSDNG_BAL>\n" + //
                                        "        <AVAIL_CREDIT>25032050</AVAIL_CREDIT>\n" + //
                                        "        <AVAIL_CASH>25000000</AVAIL_CASH>\n" + //
                                        "        <CARD_OTB>9999700</CARD_OTB>\n" + //
                                        "        <STRATEGY_ID>20</STRATEGY_ID>\n" + //
                                        "        <PER_MARK_OVR_ECB></PER_MARK_OVR_ECB>\n" + //
                                        "        <MARKUP_AMT>0</MARKUP_AMT>\n" + //
                                        "    </VMX_MSGOUT>\n" + //
                                        "</VMX_ROOT>").send();
		/*
        harness.withImqFirstVision().fromQueue(ImqFirstVisionQueue.MF_RESPONSES).asXml()
				.receiveWhere(msg -> msg.extract("/request/accountId").equals("12345"))
				.withTimeout(15, TimeUnit.SECONDS).andAssertFieldValue("/request/balance", "50000");
        */

	}
}
