-- # 2023-09-2611:48
CALL MWCONFIG.MERGE_MAPPING('req-core.itm.0200.251010.001001001',NULL,'[itm][itsii]');
CALL MWCONFIG.MERGE_MAPPING('req-core.itm.0200.251020.001001001',NULL,'[itm][itsii]');
CALL MWCONFIG.MERGE_MAPPING('req-core.itm.0200.252010.001001001',NULL,'[itm][itsii]');
CALL MWCONFIG.MERGE_MAPPING('req-core.itm.0200.252020.001001001',NULL,'[itm][itsii]');

CALL MWCONFIG.MERGE_MAPPING_GROUP('req-core.itm.0200.251010.001001001',1,'/data/body','/data/body','req-core.itm',1);
CALL MWCONFIG.MERGE_MAPPING_GROUP('req-core.itm.0200.251020.001001001',1,'/data/body','/data/body','req-core.itm.0200.251010.001001001',1);
CALL MWCONFIG.MERGE_MAPPING_GROUP('req-core.itm.0200.252010.001001001',1,'/data/body','/data/body','req-core.itm.0200.251010.001001001',1);
CALL MWCONFIG.MERGE_MAPPING_GROUP('req-core.itm.0200.252020.001001001',1,'/data/body','/data/body','req-core.itm.0200.251010.001001001',1);

CALL MWCONFIG.MERGE_MAPPING_GROUP_LINE('req-core.itm.0200.251010.001001001',1,'!code','AXISSYSTEMSDNBHD.0000005011', NULL);
CALL MWCONFIG.MERGE_MAPPING_GROUP_LINE('req-core.itm.0200.251010.001001001',1,'dspTransactionCode','5011', NULL);
CALL MWCONFIG.MERGE_MAPPING_GROUP_LINE('req-core.itm.0200.251010.001001001',1,'TLBF01','${msg.fromAccount}', NULL);
CALL MWCONFIG.MERGE_MAPPING_GROUP_LINE('req-core.itm.0200.251010.001001001',1,'TLBF02','${msg.amountTransaction."!number"}', NULL);
CALL MWCONFIG.MERGE_MAPPING_GROUP_LINE('req-core.itm.0200.251010.001001001',1,'TLBF15','${msg.toAccount}', NULL);
CALL MWCONFIG.MERGE_MAPPING_GROUP_LINE('req-core.itm.0200.251010.001001001',1,'TLBTCD','5011', NULL);
CALL MWCONFIG.MERGE_MAPPING_GROUP_LINE('req-core.itm.0200.251010.001001001',1,'TLBTPN','KE ${msg.additionalDataPrivate?."!value".padRight(15," ").substring(0,15).trim()} BTN ${msg.toAccount?."!value"!=null?msg.toAccount."!value".padLeft(19,"0").substring(3,19):""}', NULL);
CALL MWCONFIG.MERGE_MAPPING_GROUP_LINE('req-core.itm.0200.251010.001001001',1,'TLBDS1','${msg.fromAccount?."!value"!=null?msg.fromAccount."!value".padLeft(19,"0").substring(3,19):""} ke ${msg.toAccount?."!value"!=null?msg.toAccount."!value".padLeft(19,"0").substring(3,19):""}', NULL);
CALL MWCONFIG.MERGE_MAPPING_GROUP_LINE('req-core.itm.0200.251010.001001001',1,'TLBDS2','${msg.track2Data."!value".padRight(16,"0").substring(0,16)} ATM ${msg.cardAcceptorTerminalIdentification}', NULL);
CALL MWCONFIG.MERGE_MAPPING_GROUP_LINE('req-core.itm.0200.251010.001001001',1,'TLXUFD','TRFATM', NULL);
CALL MWCONFIG.MERGE_MAPPING_GROUP_LINE('req-core.itm.0200.251010.001001001',1,'RMPYNM','DR ${msg.additionalDataPrivate?."!value".padRight(61," ").substring(46,61).trim()} BTN ${msg.fromAccount?."!value"!=null?msg.fromAccount."!value".padLeft(19,"0").substring(3,19):""}', NULL);
CALL MWCONFIG.MERGE_MAPPING_GROUP_LINE('req-core.itm.0200.251010.001001001',1,'RMNAME','DR ${msg.additionalDataPrivate?."!value".padRight(61," ").substring(46,61).trim()} ${msg.fromAccount?."!value"!=null?msg.fromAccount."!value".padLeft(19,"0").substring(3,19):""}', NULL);
CALL MWCONFIG.MERGE_MAPPING_GROUP_LINE('req-core.itm.0200.251010.001001001',1,'RMADD2','KE ${msg.additionalDataPrivate?."!value".padRight(15," ").substring(0,15).trim()} ${msg.toAccount?."!value"!=null?msg.toAccount."!value".padLeft(19,"0").substring(3,19):""}', NULL);
CALL MWCONFIG.MERGE_MAPPING_GROUP_LINE('req-core.itm.0200.251020.001001001',1,'!code','AXISSYSTEMSDNBHD.0000005012', NULL);
CALL MWCONFIG.MERGE_MAPPING_GROUP_LINE('req-core.itm.0200.251020.001001001',1,'dspTransactionCode','5012', NULL);
CALL MWCONFIG.MERGE_MAPPING_GROUP_LINE('req-core.itm.0200.251020.001001001',1,'TLBTCD','5012', NULL);
CALL MWCONFIG.MERGE_MAPPING_GROUP_LINE('req-core.itm.0200.252010.001001001',1,'!code','AXISSYSTEMSDNBHD.0000005013', NULL);
CALL MWCONFIG.MERGE_MAPPING_GROUP_LINE('req-core.itm.0200.252010.001001001',1,'dspTransactionCode','5013', NULL);
CALL MWCONFIG.MERGE_MAPPING_GROUP_LINE('req-core.itm.0200.252010.001001001',1,'TLBTCD','5013', NULL);
CALL MWCONFIG.MERGE_MAPPING_GROUP_LINE('req-core.itm.0200.252020.001001001',1,'!code','AXISSYSTEMSDNBHD.0000005014', NULL);
CALL MWCONFIG.MERGE_MAPPING_GROUP_LINE('req-core.itm.0200.252020.001001001',1,'dspTransactionCode','5014', NULL);
CALL MWCONFIG.MERGE_MAPPING_GROUP_LINE('req-core.itm.0200.252020.001001001',1,'TLBTCD','5014', NULL);



CALL MWCONFIG.MERGE_MAPPING('res-core.itm.0200.251010.001001001', NULL,'[itm][itsii]');
CALL MWCONFIG.MERGE_MAPPING('res-core.itm.0200.251020.001001001', NULL,'[itm][itsii]');
CALL MWCONFIG.MERGE_MAPPING('res-core.itm.0200.252010.001001001', NULL,'[itm][itsii]');
CALL MWCONFIG.MERGE_MAPPING('res-core.itm.0200.252020.001001001', NULL,'[itm][itsii]');

CALL MWCONFIG.MERGE_MAPPING_GROUP('res-core.itm.0200.251010.001001001',1,'/data/body','/data/body','res-core.itm.0200',1);
CALL MWCONFIG.MERGE_MAPPING_GROUP('res-core.itm.0200.251020.001001001',1,'/data/body','/data/body','res-core.itm.0200.251010.001001001',1);
CALL MWCONFIG.MERGE_MAPPING_GROUP('res-core.itm.0200.252010.001001001',1,'/data/body','/data/body','res-core.itm.0200.251010.001001001',1);
CALL MWCONFIG.MERGE_MAPPING_GROUP('res-core.itm.0200.252020.001001001',1,'/data/body','/data/body','res-core.itm.0200.251010.001001001',1);

CALL MWCONFIG.MERGE_MAPPING_GROUP_LINE('res-core.itm.0200.251010.001001001',1,'additionalDataPrivate','${head.request.data.body.original.additionalDataPrivate}', NULL);
CALL MWCONFIG.MERGE_MAPPING_GROUP_LINE('res-core.itm.0200.251010.001001001',1,'additionalResponseData','${decimalFormat("0", (msg.AMT2_F1."!number"*100)).length()>12?"999999999999":decimalFormat("0", (msg.AMT2_F1."!number"*100)).padLeft(12, "0")}${decimalFormat("0", (msg.AMT1_F1."!number"*100)).length()>12?"999999999999":decimalFormat("0", (msg.AMT1_F1."!number"*100)).padLeft(12, "0")}', NULL);


---------- #TEST UPSERT SECTION

-- #TEST UPSERT SECTION

-- ADAPTOR
-- CALL MWCONFIG.MERGE_ADAPTOR(ID, DESCRIPTION, ASYNCHRONOUS)
CALL MWCONFIG.MERGE_ADAPTOR('core-sms', NULL, 0);

-- CODEX
-- CALL MWCONFIG.MERGE_CODEX(ID, ALLOW_PARTIAL, XML)
CALL MWCONFIG.MERGE_CODEX('iso-8583-sms', NULL, NULL);

-- ADAPTOR CODEX
-- CALL MWCONFIG.MERGE_ADAPTOR_CODEX(ADAPTOR_ID, ID, CODEX_ID)
CALL MWCONFIG.MERGE_ADAPTOR_CODEX('core-sms','incoming','iso-8583-sms');

-- ADAPTOR PARAM
-- CALL MWCONFIG.MERGE_ADAPTOR_PARAM(ADAPTOR_ID, NAME, VALUE)
CALL MWCONFIG.MERGE_ADAPTOR_PARAM('core-sms','maxConnection','1');

-- CHARGES
-- CALL MWCONFIG.MERGE_CHARGES(ID, C1_VALUE, C1_NAME, C1_SCRIPT, C1_ACCOUNT, C2_VALUE, C2_NAME, C2_SCRIPT, C2_ACCOUNT, C3_VALUE, C3_NAME, C3_SCRIPT, C3_ACCOUNT, C4_VALUE, C4_NAME, C4_SCRIPT, C4_ACCOUNT, C5_VALUE, C5_NAME, C5_SCRIPT, C5_ACCOUNT)
CALL MWCONFIG.MERGE_CHARGES('edc-amp-link-inquiry-LMP', 3500,'fee nasabah', NULL, NULL, 0,'fee switcher', NULL, NULL, 0,'fee acquirer', NULL, NULL, 0,'fee promosi', NULL, NULL, 0,'fee issuer', NULL, NULL);

-- CLIENT
-- CALL MWCONFIG.MERGE_CLIENT_TARGET(CLIENT_ID, ID, HOST, WEIGHT, SEQ)
CALL MWCONFIG.MERGE_CLIENT('core-sms', 30000, NULL, NULL, NULL, 0, NULL,'core-client');

-- CLIENT TARGET
-- CALL MWCONFIG.MERGE_CLIENT_TARGET(CLIENT_ID, ID, HOST, WEIGHT, SEQ)
CALL MWCONFIG.MERGE_CLIENT_TARGET('core-sms','core-sms','dumbroker-dummy:13001', NULL,1);

-- CONFIG_METADATA

-- DBCONN
-- CALL MWCONFIG.MERGE_DBCONN(ID,DRIVER,URL,USERNAME,PASSWORD,SCHEMA,TIMEOUT)
CALL MWCONFIG.MERGE_DBCONN('core-sms','com.ibm.db2.jcc.DB2Driver','jdbc:db2://wmbserver:50000/temp','usr_mdw','twcFKd9CNDCs8Sos21P+ltQFiIvtmOMGL79NQnexL0c=','temp', NULL);


-- DEV_TELLER_MAP
-- CALL MWCONFIG.MERGE_DEV_TELLER_MAP(DEV_ID, GROUP, DEVICE_ID, DEVICE_NAME, TERMINAL_ID, TERMINAL_IP, TELLER_ID, CTRL_UNIT_ID)
CALL MWCONFIG.MERGE_DEV_TELLER_MAP('edc','00001003','00001003','00001003','10.14.1.107','7200014','C15');

-- DTREE
-- CALL MWCONFIG.MERGE_DTREE(GROUP, PATH, VALUE, MODULE)
CALL MWCONFIG.MERGE_DTREE('SMS-CODE','0200','0200.${msg.processingCode?.padLeft(6, "0")}','[sms]');

-- DTREE_MAP

-- ERROR_MAP
-- CALL MWCONFIG.MERGE_ERROR_MAP(GROUP, ORIGINAL, TARGET, DETAIL)
CALL MWCONFIG.MERGE_ERROR_MAP('core-sms','00','00', NULL);

-- HOST
-- CALL MWCONFIG.MERGE_HOST(ID, HOST, USERNAME, PASSWORD, CONTEXT)
CALL MWCONFIG.MERGE_HOST('core-sms','127.0.0.1','temp','temp','temp');

-- MAPPING
-- CALL MWCONFIG.MERGE_MAPPING(ID, DESCRIPTION, MODULE)
CALL MWCONFIG.MERGE_MAPPING('req-core.sms', NULL,'[sms]');

-- MAPPING GROUP
-- CALL MWCONFIG.MERGE_MAPPING_GROUP(MAPPING_ID, ID, SOURCE, TARGET, INCLUDE_MAPPING_ID, INCLUDE_ID)
CALL MWCONFIG.MERGE_MAPPING_GROUP('req-core.sms',1,'/data/body','/data/body',NULL, NULL);

-- MAPPING GROUP LINE
-- CALL MWCONFIG.MERGE_MAPPING_GROUP_LINE(MAPPING_ID, MAPPING_GROUP_ID, NAME, TEXT, SEQ)
CALL MWCONFIG.MERGE_MAPPING_GROUP_LINE('req-core.sms',1,'messageType','0200', NULL);

-- PARAM MAP
-- CALL MWCONFIG.MERGE_PARAM_MAP(GROUP, NAME, VALUE, SEQ, DESCRIPTION)
CALL MWCONFIG.MERGE_PARAM_MAP('coa','gl-tagihan-edc-amp','187150491428', NULL, NULL);

-- PARSER
-- CALL MWCONFIG.MERGE_PARSER(ID)
CALL MWCONFIG.MERGE_PARSER('core-sms');

-- PARSER CODEX
-- CALL MWCONFIG.MERGE_PARSER_CODEX(PARSER_ID, ID, CODEX_ID)
-- #CALL MWCONFIG.MERGE_PARSER_CODEX('core-sms','iso-8583-itm','iso-8583-itm');

-- ROUTING TABLE
-- CALL MWCONFIG.MERGE_ROUTING_TABLE(ID, CODE_START, CODE_END, CHANNEL, START_DATE, END_DATE, QUEUE, STATUS, SUBCODEX, ADDITIONAL, REPLY_TO, REPLY_TO_QMGR)
CALL MWCONFIG.MERGE_ROUTING_TABLE('*','*','sms', CURRENT TIMESTAMP , NULL,'SMS_IN','ACTIVE', NULL, NULL, NULL, NULL);

-- RPG CALL
-- CALL MWCONFIG.MERGE_RPG_CALL(ID, CMD, HOST, TIMEOUT)
-- #CALL MWCONFIG.MERGE_RPG_CALL('core-sms','temp','temp', 60000);

-- RPG CALL ARG
-- CALL MWCONFIG.MERGE_RPG_CALL_ARG(RPG_CALL_ID, ID, NAME, TYPE, LENGTH)
-- #CALL MWCONFIG.MERGE_RPG_CALL_ARG('core-sms',1,'temp','temp',15);


-- SERVER_PORT
-- CALL MWCONFIG.MERGE_SERVER_PORT(ADAPTOR_ID, PORT, SERVER, GROUP)
CALL MWCONFIG.MERGE_SERVER_PORT('core-sms',10101,'server-1','core-sms');

