INSERT INTO MWCONFIG.DTREE(GROUP, PATH, VALUE, MODIFIED_BY, TIMESTAMP, MODULE) 
VALUES 
    ('ITM-CODE', '0200.412000', '0200.412000.${msg.reservedPrivate2.substring(0, 6)}${msg.reservedPrivate2.substring(9, 12)}', CURRENT USER, CURRENT TIMESTAMP, '[itm]'),
    ('ITM-CODE', '0210.412000', '0210.412000.${msg.reservedPrivate2.substring(0, 6)}${msg.reservedPrivate2.substring(9, 12)}', CURRENT USER, CURRENT TIMESTAMP, '[itm]'),
    ('ITM-CODE', '0400.412000', '0400.412000.${msg.reservedPrivate2.substring(0, 6)}${msg.reservedPrivate2.substring(9, 12)}', CURRENT USER, CURRENT TIMESTAMP, '[itm]'),
    ('ITM-CODE', '0410.412000', '0410.412000.${msg.reservedPrivate2.substring(0, 6)}${msg.reservedPrivate2.substring(9, 12)}', CURRENT USER, CURRENT TIMESTAMP, '[itm]');
INSERT INTO MWCONFIG.DTREE("GROUP", "PATH", "VALUE", MODIFIED_BY, TIMESTAMP, MODULE) 
VALUES 
    ('CHARGES', 'itm'                   , 'itm|${msg.processingCode}'                                  , CURRENT USER, CURRENT TIMESTAMP, '[itm]'),
    ('CHARGES', 'itm|411000'            , 'itm|411000|${msg.reservedPrivate2."!value".substring(9,12)}', CURRENT USER, CURRENT TIMESTAMP, '[itm]'),
    ('CHARGES', 'itm|412000'            , 'itm|412000|${msg.reservedPrivate2."!value".substring(9,12)}', CURRENT USER, CURRENT TIMESTAMP, '[itm]'),
    ('CHARGES', 'itm|411000|BCA'        , 'itm prima withdrawal'                                       , CURRENT USER, CURRENT TIMESTAMP, '[itm]'),
    ('CHARGES', 'itm|412000|BCA'        , 'itm prima withdrawal'                                       , CURRENT USER, CURRENT TIMESTAMP, '[itm]'),
    ('CHARGES', 'itm prima withdrawal'  , '----'                                                       , CURRENT USER, CURRENT TIMESTAMP, '[itm]');

INSERT INTO MWCONFIG.ROUTING_TABLE(CODE_START, CODE_END, CHANNEL, START_DATE, END_DATE, QUEUE, CREATE_BY, CREATE_DATE, MODIFIED_BY, MODIFIED_DATE, STATUS, SUBCODEX, ADDITIONAL, REPLY_TO, REPLY_TO_QMGR) 
    VALUES 
        ('*'                    , '*'                    , 'vad', CURRENT TIMESTAMP, null, 'ITM_IN',          CURRENT USER, CURRENT TIMESTAMP, null, null, 'ACTIVE', null, null, 'ROUTER_OUT', 'ITMBROKER.QM'),
        ('0200.412000.VADBCABCA', '0200.412000.VADBCABCA', 'vad', CURRENT TIMESTAMP, null, 'GROUP_CHANGE_IN', CURRENT USER, CURRENT TIMESTAMP, null, null, 'ACTIVE', null, null, 'ROUTER_OUT', 'ITMBROKER.QM');

INSERT INTO MWCONFIG.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, MODIFIED_BY, TIMESTAMP) 
    VALUES 
        ('itm prima withdrawal', 6500.00, 'acquirer', null, null, 1000.00, 'switcher', null, null, 0.00, null, null, null, 475.00, 'acquirer btn', null, null, 0.00, null, null, null, CURRENT USER, CURRENT TIMESTAMP);

INSERT INTO MWCONFIG.PARAM_MAP("GROUP", NAME, "VALUE", SEQ, MODIFIED_BY, TIMESTAMP, DESCRIPTION) 
    VALUES 
        ('group-change', 'itm.VAD', 'vad', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('group-change', 'cms.VAD', 'cvd', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('group-change', 'VAD', 'vad', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('group-change', 'cms.VAS', 'cvs', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('group-change', 'itm.VAS', 'itm', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('group-check-code', 'itm.0200.24', 'true', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('group-check-code', 'cms.0200.24', 'true', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('group-check-code', 'itm.24', 'true', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('group-check-code', 'itm.0200.50', 'true', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('group-core', 'vad', 'vad', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('group-core', 'cvd', 'vad', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('group-core', 'cvs', 'vas', null, CURRENT USER, CURRENT TIMESTAMP, null);

INSERT INTO MWCONFIG.PARAM_MAP("GROUP", NAME, "VALUE", SEQ, MODIFIED_BY, TIMESTAMP, DESCRIPTION) 
    VALUES ('request-url', 'VaDebit', 'http://DUMMY:7080/vaccount/btn', null, CURRENT USER, CURRENT TIMESTAMP, null);

INSERT INTO MWCONFIG.PARAM_MAP("GROUP", NAME, "VALUE", SEQ, MODIFIED_BY, TIMESTAMP, DESCRIPTION) 
    VALUES 
        ('atm-vad-no-fee', '0200.612000.VADSAT', '7500', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('atm-vad-no-fee', '0200.632000.001SATVAD.2', '6500', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('atm-vad-no-fee', '0200.631000.001SATVAD.2', '6500', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('atm-vad-no-fee', '0200.831000.000ALTVAD', '3000', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('atm-vad-no-fee', '0200.532000.VADHBRVAD.2', '0', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('atm-vad-no-fee', '0200.532000.VADHBR001.2', '6500', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('atm-vad-no-fee', '0200.532000.001HBRVAD.2', '0', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('atm-vad-no-fee', '0200.531000.001HBRVAD.2', '6500', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('atm-vad-no-fee', '0200.532000.VADLMPVAD.2', '0', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('atm-vad-no-fee', '0200.532000.VADLMP001.2', '6500', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('atm-vad-no-fee', '0200.532000.001LMPVAD.2', '6500', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('atm-vad-no-fee', '0200.531000.001LMPVAD.2', '6500', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('atm-vad-no-fee', '0200.832000.VADALTVAD.2', '3000', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('atm-vad-no-fee', '0200.832000.VADALT001.2', '3000', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('atm-vad-no-fee', '0200.832000.001ALTVAD.2', '6500', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('atm-vad-no-fee', '0200.831000.001ALTVAD.2', '6500', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('atm-vad-no-fee', '0200.632000.VADSATVAD.2', '6500', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('atm-vad-no-fee', '0400.831000.000ALTVAD', '3000', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('atm-vad-no-fee', '0400.632000.VADSAT001.2', '6500', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('atm-vad-no-fee', '0400.632000.001SATVAD.2', '6500', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('atm-vad-no-fee', '0400.631000.001SATVAD.2', '6500', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('atm-vad-no-fee', '0400.532000.VADHBRVAD.2', '0', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('atm-vad-no-fee', '0400.532000.VADHBR001.2', '6500', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('atm-vad-no-fee', '0400.532000.001HBRVAD.2', '0', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('atm-vad-no-fee', '0400.531000.001HBRVAD.2', '6500', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('atm-vad-no-fee', '0400.532000.VADLMPVAD.2', '0', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('atm-vad-no-fee', '0400.532000.VADLMP001.2', '6500', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('atm-vad-no-fee', '0400.532000.001LMPVAD.2', '6500', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('atm-vad-no-fee', '0400.531000.001LMPVAD.2', '6500', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('atm-vad-no-fee', '0400.832000.VADALTVAD.2', '3000', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('atm-vad-no-fee', '0400.832000.VADALT001.2', '3000', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('atm-vad-no-fee', '0400.832000.001ALTVAD.2', '6500', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('atm-vad-no-fee', '0400.831000.001ALTVAD.2', '6500', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('atm-vad-no-fee', '0400.632000.VADSATVAD.2', '6500', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('atm-vad-no-fee', '0200.802000.VADALT', '4000', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('atm-vad-no-fee', '0400.802000.VADALT', '4000', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('atm-vad-no-fee', '0200.812000.VADALT', '7500', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('atm-vad-no-fee', '0400.812000.VADALT', '7500', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('atm-vad-no-fee', '0200.832000.VADALT000', '6500', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('atm-vad-no-fee', '0400.832000.VADALT000', '6500', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('atm-vad-no-fee', '0200.832000.VAD001ALT', '6500', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('atm-vad-no-fee', '0400.832000.VAD001ALT', '6500', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('atm-vad-no-fee', '0200.832000.VADALTVAD.1', '6500', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('atm-vad-no-fee', '0400.832000.VADALTVAD.1', '6500', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('atm-vad-no-fee', '0200.832000.VADALT001.1', '6500', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('atm-vad-no-fee', '0400.832000.VADALT001.1', '6500', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('atm-vad-no-fee', '0200.832000.001ALTVAD.1', '6500', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('atm-vad-no-fee', '0400.832000.001ALTVAD.1', '6500', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('atm-vad-no-fee', '0200.832000.000001VAD', '6500', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('atm-vad-no-fee', '0400.832000.000001VAD', '6500', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('atm-vad-no-fee', '0200.832000.000ALTVAD', '3000', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('atm-vad-no-fee', '0400.832000.000ALTVAD', '3000', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('atm-vad-no-fee', '0200.402000.VADBCA', '0', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('atm-vad-no-fee', '0400.402000.VADBCA', '0', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('atm-vad-no-fee', '0200.412000.VADBCA', '7500', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('atm-vad-no-fee', '0400.412000.VADBCA', '7500', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('atm-vad-no-fee', '0200.432000.VADBCA000', '6500', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('atm-vad-no-fee', '0400.432000.VADBCA000', '6500', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('atm-vad-no-fee', '0200.432000.VAD001BCA', '6500', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('atm-vad-no-fee', '0400.432000.VAD001BCA', '6500', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('atm-vad-no-fee', '0200.432000.VADBCAVAD', '6500', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('atm-vad-no-fee', '0400.432000.VADBCAVAD', '6500', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('atm-vad-no-fee', '0200.432000.VADBCA001', '6500', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('atm-vad-no-fee', '0400.432000.VADBCA001', '6500', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('atm-vad-no-fee', '0200.432000.001BCAVAD', '6500', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('atm-vad-no-fee', '0400.432000.001BCAVAD', '6500', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('atm-vad-no-fee', '0200.432000.000001VAD', '5350', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('atm-vad-no-fee', '0400.432000.000001VAD', '6500', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('atm-vad-no-fee', '0200.432000.000BCAVAD', '1500', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('atm-vad-no-fee', '0400.432000.000BCAVAD', '1500', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('atm-vad-no-fee', '0200.831000.001ALTVAD.1', '6500', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('atm-vad-no-fee', '0400.831000.001ALTVAD.1', '6500', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('atm-vad-no-fee', '0400.612000.VADSAT', '7500', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('atm-vad-no-fee', '0200.632000.VADSAT001.2', '6500', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('atm-vad-no-fee', '0200.532000.000001VAD', '0', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('atm-vad-no-fee', '0400.532000.000001VAD', '0', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('atm-vad-no-fee', '0200.531000.000001VAD', '0', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('atm-vad-no-fee', '0400.531000.000001VAD', '0', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('atm-vad-no-fee', '0200.531000.000HBRVAD', '0', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('atm-vad-no-fee', '0400.531000.000HBRVAD', '0', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('atm-vad-no-fee', '0200.532000.000HBRVAD', '0', null, CURRENT USER, CURRENT TIMESTAMP, null),
        ('atm-vad-no-fee', '0400.532000.000HBRVAD', '0', null, CURRENT USER, CURRENT TIMESTAMP, null);

INSERT INTO MWCONFIG.MAPPING(ID, DESCRIPTION, MODIFIED_BY, TIMESTAMP, MODULE) VALUES ('req-change-group.vad', null, CURRENT USER, CURRENT TIMESTAMP, '[vad]');
INSERT INTO MWCONFIG.MAPPING_GROUP(MAPPING_ID, ID, "SOURCE", TARGET, INCLUDE_MAPPING_ID, INCLUDE_ID) 
    VALUES 
        ('req-change-group.vad', 1, '/data/frontOriginal', '/data/body', null, null),
        ('req-change-group.vad', 2, '/data/frontOriginal/body', '/data/body', null, null);
INSERT INTO MWCONFIG.MAPPING_GROUP_LINE(MAPPING_ID, MAPPING_GROUP_ID, NAME, TEXT, SEQ) 
    VALUES 
        ('req-change-group.vad', 1, '@', 'copyMessage("..",".");', 10),
        ('req-change-group.vad', 1, '!dir', 'O', 20),
        ('req-change-group.vad', 1, '!destination', 'VaDebit', null),
        ('req-change-group.vad', 1, '!errorCodePath', 'body.response.data.Item.errCode', null),
        ('req-change-group.vad', 1, '!queueName', 'BACKEND_REST_IN', null),
        ('req-change-group.vad', 1, '!ReplyToQ', 'GROUP_CHANGE_REPLY.ITM', null),
        ('req-change-group.vad', 1, '!RequestURL', '${getParamValue("request-url","VaDebit","http://localhost:8094")}/service', null),
        ('req-change-group.vad', 1, 'accNoFrom', '${head.frontOriginal.body.fromAccount}', null),
        ('req-change-group.vad', 1, 'accNoTo', '${head.frontOriginal.body.toAccount}', null),
        ('req-change-group.vad', 1, 'cnl', 'OT', null),
        ('req-change-group.vad', 1, 'iat', '${new java.text.SimpleDateFormat("yyyy").format(new Date())}${head.frontOriginal.body.transmissionDateTime}', null),
        ('req-change-group.vad', 1, 'jti', '${head.frontOriginal.body.systemsTraceAuditNumber}${head.frontOriginal.body.retrievalReferenceNumber."!value".trim().padLeft(12,"0").substring(8,12)}', null),
        ('req-change-group.vad', 1, 'proCode', '${getParamValue("vad-change-code", head.code."!value", head.code."!value")}', null),
        ('req-change-group.vad', 1, 'tid', '${head.frontOriginal.body.cardAcceptorTerminalIdentification}', null),
        ('req-change-group.vad', 1, 'reffNoRev', '${head.frontOriginal.body.systemsTraceAuditNumber}${head.frontOriginal.body.retrievalReferenceNumber."!value".trim().padLeft(12,"0").substring(8,12)}', null),
        ('req-change-group.vad', 2, '@', 'dtree("CHARGES","!oldgroup");', 10),
        ('req-change-group.vad', 2, 'trxAmount', '${head.frontOriginal.body.amountTransaction."!value"==null?"0":decimalFormat("0",(head.frontOriginal.body.amountTransaction."!value".toBigDecimal()/100)-(getCharge(6)?getCharge(6).toBigDecimal():0))}', 20),
        ('req-change-group.vad', 2, 'bic', '${msg.reservedPrivate2."!value".substring(6,9) == "VAD"  ? msg.receivingInstitutionIdentificationCode."!value": msg.reservedForPrivateUse."!value"}', null),
        ('req-change-group.vad', 2, 'feeAmount', '${getParamValue("atm-vad-no-fee",head.code."!value",head.code."!value".contains("602000.VADSAT")||head.code."!value".contains("612000.VADSAT")?decimalFormat("0",(getCharge(1)?getCharge(1).toBigDecimal():0)+(getCharge(2)?getCharge(2).toBigDecimal():0)+(getCharge(4)?getCharge(4).toBigDecimal():0)):head.code."!value".contains("632000.VADSAT000")||head.code."!value".contains("632000.VAD001000")||head.code."!value".contains("632000.VADSATVAD.1")||head.code."!value".contains("632000.VADSAT001.1")||head.code."!value".contains("632000.001SATVAD.1")?decimalFormat("0",(getCharge(1)?getCharge(1).toBigDecimal():0)+(getCharge(2)?getCharge(2).toBigDecimal():0)+(getCharge(3)?getCharge(3).toBigDecimal():0)):decimalFormat("0",(getCharge(1)?getCharge(1).toBigDecimal():0)+(getCharge(2)?getCharge(2).toBigDecimal():0)+(getCharge(3)?getCharge(3).toBigDecimal():0)+(getCharge(4)?getCharge(4).toBigDecimal():0)+(getCharge(5)?getCharge(5).toBigDecimal():0)))}', 20),
        ('req-change-group.vad', 1, '!RouteToCore', '${getParamValue("route-to-core", head.code."!value" , "true")}', null),
        ('req-change-group.vad', 1, '!ReplyToQMgr', 'PAYBROKER.QM', null);

INSERT INTO MWCONFIG.MAPPING(ID, DESCRIPTION, MODIFIED_BY, TIMESTAMP, MODULE) VALUES ('req-enhance.vad', null, CURRENT USER, CURRENT TIMESTAMP, '[vad]');
INSERT INTO MWCONFIG.MAPPING_GROUP(MAPPING_ID, ID, "SOURCE", TARGET, INCLUDE_MAPPING_ID, INCLUDE_ID) 
    VALUES 
        ('req-enhance.vad', 1, '/data', '/data', null, null),
        ('req-enhance.vad', 2, '/data/body', '/data/body', null, null),
        ('req-enhance.vad', 3, '/data/body', '/data/backup', null, null);
INSERT INTO MWCONFIG.MAPPING_GROUP_LINE(MAPPING_ID, MAPPING_GROUP_ID, NAME, TEXT, SEQ) 
    VALUES 
        ('req-enhance.vad', 1, '@', 'copyMessage();', null),
        ('req-enhance.vad', 2, '!code', '${head.code."!value".replace("VAD", "001")}', null),
        ('req-enhance.vad', 2, 'fromAccount', '${head.coreResponse.response.data.accPoolingFrom==null?head.body.fromAccount:head.coreResponse.response.data.accPoolingFrom}', null),
        ('req-enhance.vad', 2, 'reservedPrivate2', '${head.body.reservedPrivate2."!value".replace("VAD", "001")}', null),
        ('req-enhance.vad', 2, 'toAccount', '${head.coreResponse.response.data.accPoolingTo==null?head.body.toAccount:head.coreResponse.response.data.accPoolingTo}', null),
        ('req-enhance.vad', 3, 'accNameFrom', '${head.coreResponse.response.data.accNameFrom}', null),
        ('req-enhance.vad', 3, 'accNameTo', '${head.coreResponse.response.data.accNameTo}', null),
        ('req-enhance.vad', 3, 'accNoFrom', '${head.coreResponse.response.data.accNoFrom}', null),
        ('req-enhance.vad', 3, 'accNoTo', '${head.coreResponse.response.data.accNoTo}', null),
        ('req-enhance.vad', 3, 'accPoolingFrom', '${head.coreResponse.response.data.accPoolingFrom}', null),
        ('req-enhance.vad', 3, 'accPoolingTo', '${head.coreResponse.response.data.accPoolingTo}', null),
        ('req-enhance.vad', 3, 'balanceFrom', '${head.coreResponse.response.data.balanceFrom}', null),
        ('req-enhance.vad', 3, 'bit62', '${head.body.reservedPrivate2}', null),
        ('req-enhance.vad', 3, 'msgId', '${head.oldgroup}.${head.CorrelId}', null),
        ('req-enhance.vad', 3, 'newgroup', '${head.group}', null),
        ('req-enhance.vad', 3, 'balanceTo', '${head.coreResponse.response.data.balanceTo}', null),
        ('req-enhance.vad', 3, 'proCode', '${head.coreResponse.request.procode}', null),
        ('req-enhance.vad', 2, '!ChangeExistingCode', '${getParamValue("vad-change-existing-code", head.code."!value" , head.code."!value".replace("VAD", "001") )}', null);


INSERT INTO MWCONFIG.MAPPING(ID, DESCRIPTION, MODIFIED_BY, TIMESTAMP, MODULE) VALUES ('req-change-group.vad.reverse', null, CURRENT USER, CURRENT TIMESTAMP, '[vad]');
INSERT INTO MWCONFIG.MAPPING_GROUP(MAPPING_ID, ID, "SOURCE", TARGET, INCLUDE_MAPPING_ID, INCLUDE_ID) 
    VALUES ('req-change-group.vad.reverse', 1, '/data/body', '/data/body', null, null);
INSERT INTO MWCONFIG.MAPPING_GROUP_LINE(MAPPING_ID, MAPPING_GROUP_ID, NAME, TEXT, SEQ) 
    VALUES 
        ('req-change-group.vad.reverse', 1, '@', 'dtree("CHARGES", "!oldgroup");', 10),
        ('req-change-group.vad.reverse', 1, '!CorrelId', '${head.CorrelId}', null),
        ('req-change-group.vad.reverse', 1, 'bic', '${head.backup.proCode."!value".substring(12,15)=="VAD"?msg.reservedForPrivateUse."!value":head.backup.proCode."!value".substring(18,21)=="VAD"?msg.receivingInstitutionIdentificationCode."!value":""}', null),
        ('req-change-group.vad.reverse', 1, '!ReplyToQMgr', 'PAYBROKER.QM', null),
        ('req-change-group.vad.reverse', 1, '!RequestURL', '${getParamValue("request-url","VaDebit","http://localhost:8094")}/service', null),
        ('req-change-group.vad.reverse', 1, '!destination', 'VaDebit', null),
        ('req-change-group.vad.reverse', 1, '!errorCodePath', 'body.response.data.Item.errCode', null),
        ('req-change-group.vad.reverse', 1, '!queueName', 'BACKEND_REST_IN', null),
        ('req-change-group.vad.reverse', 1, 'accNoFrom', '${head.backup.accNoFrom."!value"}', null),
        ('req-change-group.vad.reverse', 1, 'accNoTo', '${head.backup.accNoTo."!value"}', null),
        ('req-change-group.vad.reverse', 1, 'cnl', 'OT', null),
        ('req-change-group.vad.reverse', 1, 'iat', '${new java.text.SimpleDateFormat("yyyy").format(new Date())}${msg.transmissionDateTime}', null),
        ('req-change-group.vad.reverse', 1, 'jti', '${msg.systemsTraceAuditNumber}${msg.retrievalReferenceNumber."!value".trim().padLeft(12,"0").substring(8,12)}', null),
        ('req-change-group.vad.reverse', 1, 'proCode', '${head.backup.proCode."!value".replace("0200.", "0400.")}', null),
        ('req-change-group.vad.reverse', 1, 'reffNoRev', '${msg.systemsTraceAuditNumber}${msg.retrievalReferenceNumber."!value".trim().padLeft(12,"0").substring(8,12)}', null),
        ('req-change-group.vad.reverse', 1, 'tid', '${msg.cardAcceptorTerminalIdentification}', null),
        ('req-change-group.vad.reverse', 1, '!reqtimestamp', '${head.reqtimestamp}', null),
        ('req-change-group.vad.reverse', 1, 'feeAmount', '${getParamValue("atm-vad-no-fee",head.backup.proCode."!value".replace("0200.","0400."),head.backup.proCode."!value".replace("0200.","0400.").contains("602000.VADSAT")||head.backup.proCode."!value".replace("0200.","0400.").contains("612000.VADSAT")?decimalFormat("0",(getCharge(1)?getCharge(1).toBigDecimal():0)+(getCharge(2)?getCharge(2).toBigDecimal():0)+(getCharge(4)?getCharge(4).toBigDecimal():0)):head.backup.proCode."!value".replace("0200.","0400.").contains("632000.VADSAT000")||head.backup.proCode."!value".replace("0200.","0400.").contains("632000.VAD001000")||head.backup.proCode."!value".replace("0200.","0400.").contains("632000.VADSATVAD.1")||head.backup.proCode."!value".replace("0200.","0400.").contains("632000.VADSAT001.1")||head.backup.proCode."!value".replace("0200.","0400.").contains("632000.001SATVAD.1")?decimalFormat("0",(getCharge(1)?getCharge(1).toBigDecimal():0)+(getCharge(2)?getCharge(2).toBigDecimal():0)+(getCharge(3)?getCharge(3).toBigDecimal():0)):decimalFormat("0",(getCharge(1)?getCharge(1).toBigDecimal():0)+(getCharge(2)?getCharge(2).toBigDecimal():0)+(getCharge(3)?getCharge(3).toBigDecimal():0)+(getCharge(4)?getCharge(4).toBigDecimal():0)+(getCharge(5)?getCharge(5).toBigDecimal():0)))}', null),
        ('req-change-group.vad.reverse', 1, 'trxAmount', '${head.body.amountTransaction."!value"==null?"0":decimalFormat("0",(head.body.amountTransaction."!value".toBigDecimal()/100)-(getCharge(6)?getCharge(6).toBigDecimal():0))}', null),
        ('req-change-group.vad.reverse', 1, '!ReplyToQ', 'ITM_CORE_REVERSAL_REPLY', null);

INSERT INTO MWCONFIG.MAPPING(ID, DESCRIPTION, MODIFIED_BY, TIMESTAMP, MODULE) VALUES ('res-change-group.vad', null, CURRENT USER, CURRENT TIMESTAMP, '[vad]');
INSERT INTO MWCONFIG.MAPPING_GROUP(MAPPING_ID, ID, "SOURCE", TARGET, INCLUDE_MAPPING_ID, INCLUDE_ID) VALUES 
    ('res-change-group.vad', 1, '/data', '/data', null, null),
    ('res-change-group.vad', 2, '/data/body', '/data/body', null, null);
INSERT INTO MWCONFIG.MAPPING_GROUP_LINE(MAPPING_ID, MAPPING_GROUP_ID, NAME, TEXT, SEQ) 
    VALUES 
        ('res-change-group.vad', 1, '@', 'copyMessage();', 10),
        ('res-change-group.vad', 2, 'reservedPrivate2', '${head.backup==null?msg.reservedPrivate2:head.backup.bit62 }', 30),
        ('res-change-group.vad', 2, 'fromAccount', '${head.backup==null?head.body.fromAccount:head.backup.accNoFrom}', 30),
        ('res-change-group.vad', 2, 'toAccount', '${head.backup==null?head.body.toAccount:head.backup.accNoTo}', 30),
        ('res-change-group.vad', 2, 'additionalDataPrivate', '${head.backup!=null || head.coreResponse!=null? (["0200.422000.VAD","0200.522000.VAD","0200.622000.VAD","0200.822000.VAD"].contains(head.code."!value".replace("0210","0200"))? (head.backup!=null ? head.backup.accNameTo : head.coreResponse.response.data.accNameTo): (["0200.502000.VADHBR","0200.512000.VADHBR","0200.502000.VADLMP","0200.512000.VADLMP","0200.802000.VADALT","0200.812000.VADALT","0200.402000.VADBCA","0200.412000.VADBCA","0200.602000.VADSAT","0200.612000.VADSAT"].contains(head.backup.proCode."!value".replace("0210","0200"))? (head.backup!=null ? head.backup.accNameFrom : head.coreResponse.response.data.accNameFrom):head.body.additionalDataPrivate)):head.body.additionalDataPrivate}', 30),
        ('res-change-group.vad', 2, 'additionalResponseData', '${head.backup!=null? (["0200.502000.VADHBR","0200.512000.VADHBR","0200.532000.VADHBR000","0200.532000.VAD001000","0200.532000.VADHBRVAD.1","0200.532000.VADHBR001.1","0200.502000.VADLMP","0200.512000.VADLMP","0200.532000.VADLMPLMP","0200.532000.VADBMPLMP","0200.532000.VADLMPVAD.1","0200.532000.VADLMP001.1","0200.802000.VADALT","0200.812000.VADALT","0200.832000.VADALT000","0200.832000.VAD001ALT","0200.832000.VADALTVAD.1","0200.832000.VADALT001.1","0200.402000.VADBCA","0200.412000.VADBCA","0200.432000.VADBCA000","0200.432000.VAD001BCA","0200.432000.VADBCAVAD","0200.432000.VADBCA001","0200.602000.VADSAT","0200.612000.VADSAT","0200.632000.VADSAT000","0200.632000.VAD001000","0200.632000.VADSATVAD.1","0200.632000.VADSAT001.1"].contains(head.backup.proCode."!value")? (decimalFormat("0",head.backup.balanceFrom."!value".toBigDecimal()*100).padLeft(12,"0")+decimalFormat("0",head.backup.balanceFrom."!value".toBigDecimal()*100).padLeft(12,"0")): (["0200.532000.VADHBRVAD.2","0200.532000.001HBRVAD.2","0200.532000.VADLMPVAD.2","0200.532000.001LMPVAD.2","0200.832000.VADALTVAD.2","0200.832000.001ALTVAD.2","0200.632000.VADSATVAD.2","0200.632000.VADSAT001.2","0200.632000.001SATVAD.2","531000.001HBRVAD.2","531000.001LMPVAD.2","831000.001ALTVAD.2","631000.001SATVAD.2"].contains(head.backup.proCode."!value")? (decimalFormat("0",head.backup.balanceTo."!value".toBigDecimal()*100).padLeft(12,"0")+decimalFormat("0",head.backup.balanceTo."!value".toBigDecimal()*100).padLeft(12,"0")): (["0200.532000.VADHBR001.2","0200.532000.001HBRVAD.1","0200.532000.000001VAD","0200.532000.000HBRVAD","0200.532000.VADLMP001.2","0200.532000.001LMPVAD.1","0200.531000.LMPBMPVAD","0200.532000.LMPBMPVAD","0200.832000.VADALT001.2 ","0200.832000.001ALTVAD.1","0200.832000.000001VAD","0200.832000.000ALTVAD","0200.432000.001BCAVAD","0200.432000.000001VAD","0200.432000.000BCAVAD","0200.632000.001SATVAD.1","0200.632000.000001VAD","0200.632000.SATSATVAD","0200.531000.001HBRVAD.1","0200.531000.000001VAD","0200.531000.000HBRVAD","0200.531000.001LMPVAD.1","0200.831000.001ALTVAD.1","0200.831000.000001VAD","0200.831000.000ALTVAD","0200.431000.001BCAVAD","0200.431000.000001VAD","0200.431000.000BCAVAD","0200.631000.001SATVAD.1","0200.631000.000001VAD","0200.631000.SATSATVAD"].contains(head.backup.proCode."!value")? head.body.additionalResponseData: null))): null}', 30);


INSERT INTO MWCONFIG.MAPPING(ID, DESCRIPTION, MODIFIED_BY, TIMESTAMP, MODULE) VALUES ('res-change-group.vad.error', null, CURRENT USER, CURRENT TIMESTAMP, '[vad]');
INSERT INTO MWCONFIG.MAPPING_GROUP(MAPPING_ID, ID, "SOURCE", TARGET, INCLUDE_MAPPING_ID, INCLUDE_ID) 
    VALUES ('res-change-group.vad.error', 1, '/data', '/data', null, null),
           ('res-change-group.vad.error', 2, '/data/body', '/data/body', null, null);
INSERT INTO MWCONFIG.MAPPING_GROUP_LINE(MAPPING_ID, MAPPING_GROUP_ID, NAME, TEXT, SEQ) 
    VALUES ('res-change-group.vad.error', 1, '@', 'copyMessage();', 10),
           ('res-change-group.vad.error', 2, 'messageType', '${head.body.messageType."!value".substring(0,2)}${head.body.messageType."!value".substring(2,4).toBigDecimal()+10}', 20),
           ('res-change-group.vad.error', 2, 'responseCode', '${getParamValue("error_map|VaDebit", head.coreResponse.responseCode."!value","99")}', null);


