INSERT INTO MWCONFIG.ADAPTOR (ID, DESCRIPTION, ASYNCHRONOUS, MODIFIED_BY, TIMESTAMP)
	VALUES ('dic-30801', 'Dummy IST Conn', 1, CURRENT USER, CURRENT TIMESTAMP);

INSERT INTO MWCONFIG.CODEX (ID, ALLOW_PARTIAL, XML, MODIFIED_BY, TIMESTAMP)
	VALUES ('iso-8583-cws', NULL, '<codex id="iso-8583-cws" escape="true">
	<field id="packetLength" type="groupLength" length="4"/>
	<field id="messageType" type="string" length="4" padding-mode="right" padding-char=" " />
	<field id="bitmap" type="bitmap">
		<field id="primaryAccountNumber" bit="2" type="string" length="19" format="llvar" />
		<field id="processingCode" bit="3" type="string" length="6" />
		<field id="amountTransaction" bit="4" type="string" length="12" padding-mode="left" padding-char="0" />
		<field id="amountSettlement" bit="5" type="string" length="12" padding-mode="left" padding-char="0" />
		<field id="amountCardholderBilling" bit="6" type="string" length="12" padding-mode="left" padding-char="0" />
		<field id="transmissionDateTime" bit="7" type="string" length="10" />
		<field id="amountCardholderBillingFee" bit="8" type="string" length="8" padding-mode="left" padding-char="0" />
		<field id="conversionRateSettlement" bit="9" type="string" length="8" padding-mode="left" padding-char="0" />
		<field id="conversionRateCardholderBilling" bit="10" type="string" length="8" padding-mode="left" padding-char="0" />
		<field id="systemsTraceAuditNumber" bit="11" type="string" length="6" />
		<field id="timeLocalTransaction" bit="12" type="string" length="6" />
		<field id="dateLocalTransaction" bit="13" type="string" length="4" />
		<field id="dateExpiration" bit="14" type="string" length="4" />
		<field id="dateSettlement" bit="15" type="string" length="4" />
		<field id="dateConversion" bit="16" type="string" length="4" />
		<field id="dateCapture" bit="17" type="string" length="4" />
		<field id="merchantType" bit="18" type="string" length="4" padding-mode="left" padding-char="0" />
		<field id="acquiringInstitutionCountryCode" bit="19" type="string" length="3" padding-mode="left" padding-char="0" />
		<field id="panExtendedCountryCode" bit="20" type="string" length="3" padding-mode="left" padding-char="0" />
		<field id="forwardingInstitutionCountryCode" bit="21" type="string" length="3" padding-mode="left" padding-char="0" />
		<field id="pointOfServiceEntryMode" bit="22" type="string" length="3" padding-mode="left" padding-char="0" />
		<field id="applicationPanNumber" bit="23" type="string" length="3" padding-mode="left" padding-char="0" />
		<field id="networkInternationalIdentifier" bit="24" type="string" length="3" padding-mode="left" padding-char="0" />
		<field id="pointOfServiceConditionCode" bit="25" type="string" length="2" padding-mode="left" padding-char="0" />
		<field id="pointOfServiceCaptureCode" bit="26" type="string" length="2" padding-mode="left" padding-char="0" />
		<field id="authorisingIdentificationResponseLength" bit="27" type="string" length="1" padding-mode="left" padding-char="0" />
		<field id="amountTransactionFee" bit="28" type="string" length="9" padding-mode="left" padding-char="0" />
		<field id="amountSettlementFee" bit="29" type="string" length="9" padding-mode="left" padding-char="0" />
		<field id="amountTransactionProcessingFee" bit="30" type="string" length="9" padding-mode="left" padding-char="0" />
		<field id="amountSettlementProcessingFee" bit="31" type="string" length="9" padding-mode="left" padding-char="0" />
		<field id="acquiringInstitutionIdentificationCode" bit="32" type="string" length="11" format="llvar" />
		<field id="forwardingInstitutionIdentificationCode" bit="33" type="string" length="11" format="llvar" />
		<field id="primaryAccountNumberExtended" bit="34" type="string" length="28" format="llvar" />
		<field id="track2Data" bit="35" type="string" length="37" format="llvar" />
		<field id="track3Data" bit="36" type="string" length="104" format="lllvar" />
		<field id="retrievalReferenceNumber" bit="37" type="string" length="12" />
		<field id="authorisationIdentificationResponse" bit="38" type="string" length="6" />  
		<field id="responseCode" bit="39" type="string" length="2" padding-mode="left" />
		<field id="serviceRestrictionCode" bit="40" type="string" length="3" />
		<field id="cardAcceptorTerminalIdentification" bit="41" type="string" length="8" />
		<field id="cardAcceptorIdentificationCode" bit="42" type="string" length="15" />
		<field id="cardAcceptorName" bit="43" type="string" length="40" />
		<field id="additionalResponseData" bit="44" type="string" length="25" format="llvar" />
		<field id="track1Data" bit="45" type="string" length="76" format="llvar" />
		<field id="additionalDataIso" bit="46" type="string" length="999" format="lllvar" />
		<field id="additionalDataNational" bit="47" type="string" length="999" format="lllvar" />
		<field id="additionalDataPrivate" bit="48" type="string" length="999" format="lllvar" />
		<field id="currencyCodeTransaction" bit="49" type="string" length="3" />
		<field id="currencyCodeSettlement" bit="50" type="string" length="3" />
		<field id="currencyCodeCardholderBilling" bit="51" type="string" length="3" />
		<field id="personalIdentificationNumberData" bit="52" type="string" length="16" />
		<field id="securityRelatedControlInformation" bit="53" type="string" length="18" padding-mode="left" padding-char="0" />
		<field id="additionalAmounts" bit="54" type="string" length="999" format="lllvar" />
		<field id="reservedIso1" bit="55" type="string" length="999" format="lllvar" />
		<field id="reservedIso2" bit="56" type="string" length="999" format="lllvar" />
		<field id="reservedNational1" bit="57" type="string" length="999" format="lllvar" />
		<field id="reservedNational2" bit="58" type="string" length="999" format="lllvar" />
		<field id="reservedNational3" bit="59" type="string" length="999" format="lllvar" />
		<field id="reasonCode" bit="60" type="string" length="999" format="lllvar" />
		<field id="reservedPrivate1" bit="61" type="string" length="999" format="lllvar" />
		<field id="reservedPrivate2" bit="62" type="string" length="999" format="lllvar" />
		<field id="reservedPrivate3" bit="63" type="string" length="999" format="lllvar" />
		<field id="messageAuthenticationCode" bit="64" type="string" length="16" />
		<field id="bitMapTertiary" bit="65" type="string" length="16" />
		<field id="settlementCode" bit="66" type="string" length="1" padding-mode="left" padding-char="0" />
		<field id="extendedPaymentCode" bit="67" type="string" length="2" padding-mode="left" padding-char="0" />
		<field id="receivingInstitutionCountryCode" bit="68" type="string" length="3" />
		<field id="settlementInstitutionCountyCode" bit="69" type="string" length="3" />
		<field id="networkManagementInformationCode" bit="70" type="string" length="3" />
		<field id="messageNumber" bit="71" type="string" length="4" padding-mode="left" padding-char="0" />
		<field id="messageNumberLast" bit="72" type="string" length="4" padding-mode="left" padding-char="0" />
		<field id="dateAction" bit="73" type="string" length="6" />
		<field id="creditsNumber" bit="74" type="string" length="10" padding-mode="left" padding-char="0" />
		<field id="creditsReversalNumber" bit="75" type="string" length="10" padding-mode="left" padding-char="0" />
		<field id="debitsNumber" bit="76" type="string" length="10" padding-mode="left" padding-char="0" />
		<field id="debitsReversalNumber" bit="77" type="string" length="10" padding-mode="left" padding-char="0" />
		<field id="transferNumber" bit="78" type="string" length="10" padding-mode="left" padding-char="0" />
		<field id="transferReversalNumber" bit="79" type="string" length="10" padding-mode="left" padding-char="0" />
		<field id="inquiriesNumber" bit="80" type="string" length="10" padding-mode="left" padding-char="0" />
		<field id="authorisationsNumber" bit="81" type="string" length="10" padding-mode="left" padding-char="0" />
		<field id="creditsProcesssingFeeAmount" bit="82" type="string" length="14" padding-mode="left" padding-char="0" />
		<field id="creditsTransactionFeeAmount" bit="83" type="string" length="14" padding-mode="left" padding-char="0" />
		<field id="debitsProcessingFeeAmount" bit="84" type="string" length="14" padding-mode="left" padding-char="0" />
		<field id="debitsTransactionFeeAmount" bit="85" type="string" length="14" padding-mode="left" padding-char="0" />
		<field id="creditsAmount" bit="86" type="string" length="15" padding-mode="left" padding-char="0" />
		<field id="creditsReversalAmount" bit="87" type="string" length="15" padding-mode="left" padding-char="0" />
		<field id="debitsAmount" bit="88" type="string" length="15" padding-mode="left" padding-char="0" />
		<field id="debitsReversalAmount" bit="89" type="string" length="15" padding-mode="left" padding-char="0" />
		<field id="originalDataElements" bit="90" type="string" length="42" padding-mode="left" />
		<field id="fileUpdateCode" bit="91" type="string" length="1" />
		<field id="fileSecurityCode" bit="92" type="string" length="2" padding-mode="left" padding-char="0" />
		<field id="responseIndicator" bit="93" type="string" length="5" padding-mode="left" padding-char="0" />
		<field id="serviceIndicator" bit="94" type="string" length="7" />
		<field id="replacementAmounts" bit="95" type="string" length="42" />
		<field id="messageSecurityCode" bit="96" type="string" length="8" />
		<field id="amountNetSettlement" bit="97" type="string" length="16" padding-mode="left" padding-char="0" />
		<field id="payee" bit="98" type="string" length="25" />
		<field id="settlementInstitutionIdentificationCode" bit="99" type="string" length="11" format="llvar" />
		<field id="receivingInstitutionIdentificationCode" bit="100" type="string" length="11" format="llvar" />
		<field id="slipNumber" bit="101" type="string" length="11" format="llvar" />
		<field id="fromAccount" bit="102" type="string" length="19" format="llvar" />
		<field id="toAccount" bit="103" type="string" length="28" format="llvar" />
		<field id="transactionDescription" bit="104" type="string" length="100" format="lllvar" />
		<field id="reservedForIsoUse1" bit="105" type="string" length="999" format="lllvar" />
		<field id="reservedForIsoUse2" bit="106" type="string" length="999" format="lllvar" />
		<field id="reservedForIsoUse3" bit="107" type="string" length="999" format="lllvar" />
		<field id="reservedForIsoUse4" bit="108" type="string" length="999" format="lllvar" />
		<field id="reservedForIsoUse5" bit="109" type="string" length="999" format="lllvar" />
		<field id="reservedForIsoUse6" bit="110" type="string" length="999" format="lllvar" />
		<field id="reservedForIsoUse7" bit="111" type="string" length="999" format="lllvar" />
		<field id="reservedForNationalUse" bit="112" type="string" length="999" format="lllvar" />
		<field id="authorisingAgentInstitutionIdCode" bit="113" type="string" length="11" format="llvar" />
		<field id="reservedForNationalUse1" bit="114" type="string" length="999" format="lllvar" />
		<field id="reservedForNationalUse2" bit="115" type="string" length="999" format="lllvar" />
		<field id="reservedForNationalUse3" bit="116" type="string" length="999" format="lllvar" />
		<field id="reservedForNationalUse4" bit="117" type="string" length="999" format="lllvar" />
		<field id="reservedForNationalUse5" bit="118" type="string" length="999" format="lllvar" />
		<field id="reservedForNationalUse6" bit="119" type="string" length="999" format="lllvar" />
		<field id="reservedForPrivateUse1" bit="120" type="string" length="999" format="lllvar" />
		<field id="reservedForPrivateUse2" bit="121" type="string" length="999" format="lllvar" />
		<field id="reservedForPrivateUse3" bit="122" type="string" length="999" format="lllvar" />
		<field id="reservedForPrivateUse4" bit="123" type="string" length="999" format="lllvar" />
		<field id="infoText" bit="124" type="string" length="255" format="lllvar" />
		<field id="networkManagementInformation" bit="125" type="string" length="50" format="lllvar" />
		<field id="issuerTraceId" bit="126" type="string" length="6" format="lllvar" />
		<field id="reservedForPrivateUse" bit="127" type="string" length="11" format="lllvar" />
		<field id="messageAuthenticationCode2" bit="128" type="string" length="16" />
	</field>
	<field id="!type" type="script" encode="true">iso-8583-cws</field>
	<field id="!mid" type="script" encode="true">${msg.transmissionDateTime}.${msg.systemsTraceAuditNumber}</field>
	<field id="!code" type="script" encode="true">${msg.messageType}.${msg.messageType.startsWith("08") ? msg.networkManagementInformationCode?.padLeft(6, "0") : msg.processingCode?.trim().substring(0,6)}</field>
</codex>', CURRENT USER, CURRENT TIMESTAMP);

INSERT INTO MWCONFIG.ADAPTOR_CODEX (ADAPTOR_ID, ID, CODEX_ID)
	VALUES ('dic-30801', 'incoming', 'iso-8583-cws');
INSERT INTO MWCONFIG.ADAPTOR_CODEX (ADAPTOR_ID, ID, CODEX_ID)
	VALUES ('dic-30801', 'outgoing', 'iso-8583-cws');

INSERT INTO MWCONFIG.ADAPTOR_PARAM (ADAPTOR_ID, NAME, VALUE)
	VALUES ('dic-30801', 'maxConnection', '1');

INSERT INTO MWCONFIG.SERVER_PORT (ADAPTOR_ID, PORT, SERVER, GROUP)
	VALUES ('dic-30801', 30801, 'dummy-server', 'dic');

INSERT INTO MWCONFIG.MAPPING (ID, DESCRIPTION, MODULE, MODIFIED_BY ,TIMESTAMP) VALUES ('dummy-res.dic.default-mapping', NULL, '[dic]', CURRENT USER, CURRENT TIMESTAMP);
INSERT INTO MWCONFIG.MAPPING_GROUP (MAPPING_ID, ID, SOURCE, TARGET, INCLUDE_MAPPING_ID, INCLUDE_ID)
	VALUES 
		('dummy-res.dic.default-mapping', 1, '/data', '/data', NULL, NULL),
		('dummy-res.dic.default-mapping', 2, '/data/body', '/data/body', NULL, NULL);
INSERT INTO MWCONFIG.MAPPING_GROUP_LINE (MAPPING_ID, MAPPING_GROUP_ID, NAME, TEXT, SEQ)
	VALUES 
		('dummy-res.dic.default-mapping', 1, '@', 'copyMessage();', NULL),
		('dummy-res.dic.default-mapping', 2, 'messageType', '${msg.messageType.''!value''.substring(0,2).concat("10")}', NULL),
		('dummy-res.dic.default-mapping', 2, 'responseCode', '00', NULL);

INSERT INTO MWCONFIG.MAPPING (ID, DESCRIPTION, MODULE, MODIFIED_BY ,TIMESTAMP) VALUES ('dummy-res.dic.default-transaction-mapping', NULL, '[dic]', CURRENT USER, CURRENT TIMESTAMP);
INSERT INTO MWCONFIG.MAPPING_GROUP (MAPPING_ID, ID, SOURCE, TARGET, INCLUDE_MAPPING_ID, INCLUDE_ID)
	VALUES ('dummy-res.dic.default-transaction-mapping', 3, '/data/body', '/data/body', NULL, NULL);
INSERT INTO MWCONFIG.MAPPING_GROUP_LINE (MAPPING_ID, MAPPING_GROUP_ID, NAME, TEXT, SEQ)
	VALUES 
		('dummy-res.dic.default-transaction-mapping', 3, 'dateCapture', '${msg.dateLocalTransaction}', NULL),
		('dummy-res.dic.default-transaction-mapping', 3, 'reservedPrivate1', 'BTN4PRO100000000000', NULL),
		('dummy-res.dic.default-transaction-mapping', 3, 'receivingInstitutionIdentificationCode', '20000000001', NULL);

INSERT INTO MWCONFIG.MAPPING (ID, DESCRIPTION, MODULE, MODIFIED_BY ,TIMESTAMP) VALUES ('dummy-res.dic.0800.000001', 'SIGN ON', '[dic]', CURRENT USER, CURRENT TIMESTAMP);
INSERT INTO MWCONFIG.MAPPING_GROUP (MAPPING_ID, ID, SOURCE, TARGET, INCLUDE_MAPPING_ID, INCLUDE_ID)
	VALUES 
		('dummy-res.dic.0800.000001', 1, '/data', '/data', 'dummy-res.dic.default-mapping', 1),
		('dummy-res.dic.0800.000001', 2, '/data/body', '/data/body', 'dummy-res.dic.default-mapping', 2);

INSERT INTO MWCONFIG.MAPPING (ID, DESCRIPTION, MODULE, MODIFIED_BY ,TIMESTAMP) VALUES ('dummy-res.dic.0800.000301', 'ECHO TEST', '[dic]', CURRENT USER, CURRENT TIMESTAMP);
INSERT INTO MWCONFIG.MAPPING_GROUP (MAPPING_ID, ID, SOURCE, TARGET, INCLUDE_MAPPING_ID, INCLUDE_ID)
	VALUES 
		('dummy-res.dic.0800.000301', 1, '/data', '/data', 'dummy-res.dic.default-mapping', 1),
		('dummy-res.dic.0800.000301', 2, '/data/body', '/data/body', 'dummy-res.dic.default-mapping', 2);

INSERT INTO MWCONFIG.MAPPING (ID, DESCRIPTION, MODULE, MODIFIED_BY ,TIMESTAMP) VALUES ('dummy-res.dic.0200.022000', NULL, '[dic]', CURRENT USER, CURRENT TIMESTAMP);
INSERT INTO MWCONFIG.MAPPING_GROUP (MAPPING_ID, ID, SOURCE, TARGET, INCLUDE_MAPPING_ID, INCLUDE_ID)
	VALUES 
		('dummy-res.dic.0200.022000', 1, '/data', '/data', 'dummy-res.dic.default-mapping', 1),
		('dummy-res.dic.0200.022000', 2, '/data/body', '/data/body', 'dummy-res.dic.default-mapping', 2),
		('dummy-res.dic.0200.022000', 3, '/data/body', '/data/body', 'dummy-res.dic.default-transaction-mapping', 3);
INSERT INTO MWCONFIG.MAPPING_GROUP_LINE (MAPPING_ID, MAPPING_GROUP_ID, NAME, TEXT, SEQ)
	VALUES 
		('dummy-res.dic.0200.022000', 2, 'responseCode', '00', 10);


INSERT INTO MWCONFIG.MAPPING (ID, DESCRIPTION, MODULE, MODIFIED_BY ,TIMESTAMP) VALUES ('dummy-res.dic.0200.940000', NULL, '[dic]', CURRENT USER, CURRENT TIMESTAMP);
INSERT INTO MWCONFIG.MAPPING_GROUP (MAPPING_ID, ID, SOURCE, TARGET, INCLUDE_MAPPING_ID, INCLUDE_ID)
	VALUES 
		('dummy-res.dic.0200.940000', 1, '/data', '/data', 'dummy-res.dic.default-mapping', 1),
		('dummy-res.dic.0200.940000', 2, '/data/body', '/data/body', 'dummy-res.dic.default-mapping', 2),
		('dummy-res.dic.0200.940000', 3, '/data/body', '/data/body', 'dummy-res.dic.default-transaction-mapping', 3);
INSERT INTO MWCONFIG.MAPPING_GROUP_LINE (MAPPING_ID, MAPPING_GROUP_ID, NAME, TEXT, SEQ)
	VALUES 
		('dummy-res.dic.0200.940000', 2, 'responseCode', '00', 10);

-- CLIENT TARGET

INSERT INTO MWCONFIG.ADAPTOR (ID, DESCRIPTION, ASYNCHRONOUS, MODIFIED_BY, TIMESTAMP)
    VALUES ('ist-conn', NULL, 1, CURRENT USER, CURRENT TIMESTAMP);
INSERT INTO MWCONFIG.ADAPTOR_CODEX (ADAPTOR_ID, ID, CODEX_ID)
    VALUES 
        ('ist-conn', 'incoming', 'iso-8583-cws'),
        ('ist-conn', 'outgoing', 'iso-8583-cws');
INSERT INTO MWCONFIG.ADAPTOR_PARAM (ADAPTOR_ID, NAME, VALUE)
    VALUES
        ('ist-conn', 'echo', '60000'),
        ('ist-conn', 'needSignOn', 'true'),
        ('ist-conn', 'timeout', '60000');

INSERT INTO MWCONFIG.CLIENT (ADAPTOR_ID, IDLE_WAIT, TIMEOUT, CLOSE_QUEUE, CONTROL_QUEUE, KEEP_CONN, REUSE_DELAY, NODE)
    VALUES('ist-conn', 0, 0, NULL, NULL, 1, 0, 'backend-iso');
INSERT INTO MWCONFIG.CLIENT_TARGET (CLIENT_ID, ID, HOST, WEIGHT, SEQ)
    VALUES ('ist-conn', 'ist-conn', 'DUMMY:30801', 0, 1);

INSERT INTO MWCONFIG.MAPPING (ID, MODULE, MODIFIED_BY, TIMESTAMP) VALUES ('ist-conn.SIGN-ON', null, CURRENT USER, CURRENT TIMESTAMP);
INSERT INTO MWCONFIG.MAPPING_GROUP (MAPPING_ID, ID, SOURCE, TARGET, INCLUDE_MAPPING_ID, INCLUDE_ID) 
    VALUES ('ist-conn.SIGN-ON', 1, '/data', '/data/body', NULL, NULL);
INSERT INTO MWCONFIG.MAPPING_GROUP_LINE (MAPPING_ID, MAPPING_GROUP_ID, NAME, TEXT, SEQ) 
    VALUES 
        ('ist-conn.SIGN-ON', 1, 'systemsTraceAuditNumber', '${counter("ist-conn", 5, 1, "ddMMyy")} ', 10),
        ('ist-conn.SIGN-ON', 1, 'transmissionDateTime', '${getTimeZoneFormat("MMddHHmmss","GMT")}', 10),
        ('ist-conn.SIGN-ON', 1, '!mid', '${tar.transmissionDateTime."!value"+"."+tar.systemsTraceAuditNumber."!value"}', 20),
        ('ist-conn.SIGN-ON', 1, '!destination', '${msg.source}', null),
        ('ist-conn.SIGN-ON', 1, '!nosignon', 'true', null),
        ('ist-conn.SIGN-ON', 1, '!reqtimestamp', '${head.reqtimestamp}', null),
        ('ist-conn.SIGN-ON', 1, '!sid', '${msg.sid}', null),
        ('ist-conn.SIGN-ON', 1, 'dateLocalTransaction', '${getTimeZoneFormat("MMdd","GMT")}', null),
        ('ist-conn.SIGN-ON', 1, 'messageType', '0800', null),
        ('ist-conn.SIGN-ON', 1, 'networkManagementInformationCode', '001', null),
        ('ist-conn.SIGN-ON', 1, 'timeLocalTransaction', '${getTimeZoneFormat("HHmmss","GMT")}', null);

INSERT INTO MWCONFIG.MAPPING (ID, MODULE, MODIFIED_BY, TIMESTAMP) VALUES ('ist-conn.ECHO-TEST', null, CURRENT USER, CURRENT TIMESTAMP);
INSERT INTO MWCONFIG.MAPPING_GROUP (MAPPING_ID, ID, SOURCE, TARGET, INCLUDE_MAPPING_ID, INCLUDE_ID) 
    VALUES 
	('ist-conn.ECHO-TEST', 1, '/data', '/data/body', 'ist-conn.SIGN-ON', '1');
INSERT INTO MWCONFIG.MAPPING_GROUP_LINE (MAPPING_ID, MAPPING_GROUP_ID, NAME, TEXT, SEQ) 
    VALUES 
	('ist-conn.ECHO-TEST', 1, 'networkManagementInformationCode', '301', null);


