package com.brilliance.isc.json2mx.pacs00900108;

import com.brilliance.isc.swift.objmtconvert.ext.XmlDate;
import com.brilliance.isc.swift.objmtconvert.manager.CreatorManager;
import com.brilliance.isc.swift.objmtconvert.model.mx.common.*;
import com.brilliance.isc.swift.objmtconvert.model.mx.pacs00900108.MXPacs00900108Creator;
import com.brilliance.isc.swift.objmtconvert.result.MxResult;
import org.junit.Test;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * @author zh
 * @create 2023-04-20-9:48
 * pacs00900108(MT202，MT202COV)
 */
public class Pacs00900108Test {

    @Test
    public void test_Pacs009_COV() {
        MXPacs00900108Creator mxPacs00900108Creator = new MXPacs00900108Creator("pacs.009.001.08");

        mxPacs00900108Creator.setSenderBic("PSBCCNBJ");

        mxPacs00900108Creator.setSenderNm("zs");

        mxPacs00900108Creator.setReceiverBic("PSBCCNBJ");

        mxPacs00900108Creator.setReceiverNm("lisi");

//        bizMsgIdr为系统自动生成，如果需要手动给值也可
//        String bizMsgIdr = "1111111";
//        mxPacs00900108COVCreator.setBizMsgIdr(bizMsgIdr);
        mxPacs00900108Creator.setMsgDefIdr("sadasdd");

        mxPacs00900108Creator.setNbOfTxs("1");

        mxPacs00900108Creator.setEndToEndId("sadasdasd");

        mxPacs00900108Creator.setBizSvc("swift.cbprplus.02");

        mxPacs00900108Creator.setCreDt(new XmlDate());

        SttlmInf2 sttlmInf2 = new SttlmInf2();
        mxPacs00900108Creator.setSttlmInf(sttlmInf2);
        sttlmInf2.setSttlmMtd("INDA");
        Account sttlmAcct = new Account();
        sttlmInf2.setSttlmAcct(sttlmAcct);
        sttlmAcct.setNm("wangwu");
        sttlmAcct.setCcy("USD");
        IdentificationAcc identificationAcc = new IdentificationAcc();
        sttlmAcct.setId(identificationAcc);
        Othr othr = new Othr();
        identificationAcc.setOthr(othr);
        SchmeNm schmeNm = new SchmeNm();
        schmeNm.setCd("BBAN");
        othr.setSchmeNm(schmeNm);
        othr.setId("adadsds");
        Tp tp = new Tp();
        sttlmAcct.setTp(tp);
        tp.setCd("CACC");

        mxPacs00900108Creator.setClrChanl("BOOK");

        List<SvcLvl> svcLvlList = new ArrayList<>();
        SvcLvl svcLvl = new SvcLvl();
        svcLvl.setCd("SEPA");
        svcLvlList.add(svcLvl);
        svcLvlList.add(svcLvl);
        svcLvlList.add(svcLvl);
        mxPacs00900108Creator.setSvcLvl(svcLvlList);

        LclInstrm lclInstrm = new LclInstrm();
        lclInstrm.setCd("DDMC");
        mxPacs00900108Creator.setLclInstrm(lclInstrm);

        CtgyPurp ctgyPurp = new CtgyPurp();
        ctgyPurp.setCd("CORT");
        mxPacs00900108Creator.setCtgyPurp(ctgyPurp);

        Amt intrBkSttlmAmt = new Amt();
        intrBkSttlmAmt.setValue(new BigDecimal("111.1"));
        intrBkSttlmAmt.setCcy("USD");
        mxPacs00900108Creator.setIntrBkSttlmAmt(intrBkSttlmAmt);

        mxPacs00900108Creator.setIntrBkSttlmDt(new Date());

        Agent prvsInstgAgt1 = new Agent();
        FinInstnId finInstnId = new FinInstnId();
        PstlAdr pstlAdr = new PstlAdr();
        finInstnId.setBicfi("PSBCCNBJ");
        finInstnId.setNm("zhaoliu");
        finInstnId.setLei("11111111111111111111");
        List<String> list = new ArrayList<>();
        list.add("BIODATA GMBH");
        list.add("HOCHSTRASSE, 27");
        pstlAdr.setCtry("CN");
        pstlAdr.setAdrLine(list);
        finInstnId.setPstlAdr(pstlAdr);
        prvsInstgAgt1.setFinInstnId(finInstnId);

        mxPacs00900108Creator.setPrvsInstgAgt1(prvsInstgAgt1);
        mxPacs00900108Creator.setPrvsInstgAgt1Acct(sttlmAcct);
        mxPacs00900108Creator.setPrvsInstgAgt2(prvsInstgAgt1);
        mxPacs00900108Creator.setPrvsInstgAgt2Acct(sttlmAcct);
        mxPacs00900108Creator.setPrvsInstgAgt3(prvsInstgAgt1);
        mxPacs00900108Creator.setPrvsInstgAgt3Acct(sttlmAcct);

        mxPacs00900108Creator.setIntrmyAgt1(prvsInstgAgt1);
        mxPacs00900108Creator.setIntrmyAgt1Acct(sttlmAcct);
        mxPacs00900108Creator.setIntrmyAgt2(prvsInstgAgt1);
        mxPacs00900108Creator.setIntrmyAgt2Acct(sttlmAcct);
        mxPacs00900108Creator.setIntrmyAgt3(prvsInstgAgt1);
        mxPacs00900108Creator.setIntrmyAgt3Acct(sttlmAcct);

        mxPacs00900108Creator.setDbtr(prvsInstgAgt1);
        mxPacs00900108Creator.setDbtrAcct(sttlmAcct);
        mxPacs00900108Creator.setCdtr(prvsInstgAgt1);
        mxPacs00900108Creator.setCdtrAcct(sttlmAcct);
        mxPacs00900108Creator.setCdtrAgt(prvsInstgAgt1);
        mxPacs00900108Creator.setCdtrAgtAcct(sttlmAcct);

        List<InstrForCdtrAgt> instrForCdtrAgtList = new ArrayList<>();
        InstrForCdtrAgt instrForCdtrAgt = new InstrForCdtrAgt();
        instrForCdtrAgt.setInstrInf("ccc");
        instrForCdtrAgtList.add(instrForCdtrAgt);
        instrForCdtrAgtList.add(instrForCdtrAgt);
        mxPacs00900108Creator.setInstrForCdtrAgt(instrForCdtrAgtList);

        List<InstrForNxtAgt> instrForNxtAgtList1 = new ArrayList<>();
        InstrForNxtAgt instrForNxtAgt1 = new InstrForNxtAgt();
        instrForNxtAgt1.setInstrInf("111");
        mxPacs00900108Creator.setInstrForNxtAgt(instrForNxtAgtList1);

        RmtInf rmtInf = new RmtInf();
        List<String> ustrdList = new ArrayList<>();
        ustrdList.add("/1111/111/222");
        rmtInf.setUstrd(ustrdList);
        mxPacs00900108Creator.setRmtInf(rmtInf);

        UndrlygCstmrCdtTrf undrlygCstmrCdtTrf = new UndrlygCstmrCdtTrf();
        mxPacs00900108Creator.setUndrlygCstmrCdtTrf(undrlygCstmrCdtTrf);
        Party dbtr = new Party();
        dbtr.setNm("tianqi");
        dbtr.setPstlAdr(pstlAdr);
        IdentificationPty identificationPty = new IdentificationPty();
        OrgId orgId = new OrgId();
        identificationPty.setOrgId(orgId);
        orgId.setLei("11111111111111111111");
        orgId.setAnyBIC("PSBCCNBJ");
        List<Othr> othrList = new ArrayList<>();
        othrList.add(othr);
        orgId.setOthr(othrList);
        dbtr.setId(identificationPty);
        undrlygCstmrCdtTrf.setDbtr(dbtr);

        undrlygCstmrCdtTrf.setDbtrAcct(sttlmAcct);
        undrlygCstmrCdtTrf.setDbtrAgt(prvsInstgAgt1);
        undrlygCstmrCdtTrf.setDbtrAgtAcct(sttlmAcct);
        undrlygCstmrCdtTrf.setCdtr(dbtr);
        undrlygCstmrCdtTrf.setCdtrAcct(sttlmAcct);
        undrlygCstmrCdtTrf.setCdtrAgt(prvsInstgAgt1);
        undrlygCstmrCdtTrf.setCdtrAgtAcct(sttlmAcct);

        undrlygCstmrCdtTrf.setPrvsInstgAgt1(prvsInstgAgt1);
        undrlygCstmrCdtTrf.setPrvsInstgAgt1Acct(sttlmAcct);
        undrlygCstmrCdtTrf.setPrvsInstgAgt2(prvsInstgAgt1);
        undrlygCstmrCdtTrf.setPrvsInstgAgt2Acct(sttlmAcct);
        undrlygCstmrCdtTrf.setPrvsInstgAgt3(prvsInstgAgt1);
        undrlygCstmrCdtTrf.setPrvsInstgAgt3Acct(sttlmAcct);

        undrlygCstmrCdtTrf.setIntrmyAgt1(prvsInstgAgt1);
        undrlygCstmrCdtTrf.setIntrmyAgt1Acct(sttlmAcct);
        undrlygCstmrCdtTrf.setIntrmyAgt2(prvsInstgAgt1);
        undrlygCstmrCdtTrf.setIntrmyAgt2Acct(sttlmAcct);
        undrlygCstmrCdtTrf.setIntrmyAgt3(prvsInstgAgt1);
        undrlygCstmrCdtTrf.setIntrmyAgt3Acct(sttlmAcct);

        undrlygCstmrCdtTrf.setInstrForCdtrAgt(instrForCdtrAgtList);

        List<InstrForNxtAgt> instrForNxtAgtList = new ArrayList<>();
        InstrForNxtAgt instrForNxtAgt = new InstrForNxtAgt();
        instrForNxtAgt.setInstrInf("ddd");
        instrForNxtAgtList.add(instrForNxtAgt);
        instrForNxtAgtList.add(instrForNxtAgt);
        instrForNxtAgtList.add(instrForNxtAgt);
        instrForNxtAgtList.add(instrForNxtAgt);
        undrlygCstmrCdtTrf.setInstrForNxtAgt(instrForNxtAgtList);

        RmtInf rmtInf2 = new RmtInf();
        rmtInf2.setUstrd(ustrdList);
        undrlygCstmrCdtTrf.setRmtInf(rmtInf2);

        undrlygCstmrCdtTrf.setInstdAmt(intrBkSttlmAmt);

        mxPacs00900108Creator.setUndrlygCstmrCdtTrf(undrlygCstmrCdtTrf);
        mxPacs00900108Creator.setType("MX");
        MxResult result = (MxResult) CreatorManager.pack(mxPacs00900108Creator);
        if (result.isSuccess())
            System.out.println(result.getMessage());
        else {
            System.out.println(result.getErrorInf());
        }
    }

    @Test
    public void test_Pacs009() {
        MXPacs00900108Creator mxPacs00900108Creator = new MXPacs00900108Creator("pacs.009.001.08");

        mxPacs00900108Creator.setSenderBic("BKTRUS33XXX");

//        mxPacs00900108Creator.setSenderNm("zs");

        mxPacs00900108Creator.setReceiverBic("PSBCCNBJXXX");

//        mxPacs00900108Creator.setReceiverNm("lisi");

//        bizMsgIdr为系统自动生成，如果需要手动给值也可
//        String bizMsgIdr = "1111111";
//        mxPacs00900108COVCreator.setBizMsgIdr(bizMsgIdr);
        mxPacs00900108Creator.setMsgDefIdr("sadasdd");

        mxPacs00900108Creator.setEndToEndId("2023032900000001");

        mxPacs00900108Creator.setBizSvc("swift.cbprplus.cov.02");

        mxPacs00900108Creator.setNbOfTxs("1");

        mxPacs00900108Creator.setCreDt(new XmlDate());

        SttlmInf2 sttlmInf2 = new SttlmInf2();
        mxPacs00900108Creator.setSttlmInf(sttlmInf2);
        sttlmInf2.setSttlmMtd("INGA");
        Account sttlmAcct = new Account();
        sttlmInf2.setSttlmAcct(sttlmAcct);
        sttlmAcct.setNm("wangwu");
        sttlmAcct.setCcy("USD");
        IdentificationAcc identificationAcc = new IdentificationAcc();
        sttlmAcct.setId(identificationAcc);
        Othr othr = new Othr();
        identificationAcc.setOthr(othr);
        othr.setId("adadsds");
        Tp tp = new Tp();
        sttlmAcct.setTp(tp);
        tp.setCd("CACC");

        mxPacs00900108Creator.setClrChanl("BOOK");

        List<SvcLvl> svcLvlList = new ArrayList<>();
        SvcLvl svcLvl = new SvcLvl();
        svcLvl.setCd("SEPA");
        svcLvlList.add(svcLvl);
        svcLvlList.add(svcLvl);
        svcLvlList.add(svcLvl);
        mxPacs00900108Creator.setSvcLvl(svcLvlList);

        LclInstrm lclInstrm = new LclInstrm();
        lclInstrm.setCd("DDMC");
        mxPacs00900108Creator.setLclInstrm(lclInstrm);

        CtgyPurp ctgyPurp = new CtgyPurp();
        ctgyPurp.setCd("CORT");
        mxPacs00900108Creator.setCtgyPurp(ctgyPurp);

        Amt intrBkSttlmAmt = new Amt();
        intrBkSttlmAmt.setValue(new BigDecimal("111.1"));
        intrBkSttlmAmt.setCcy("USD");
        mxPacs00900108Creator.setIntrBkSttlmAmt(intrBkSttlmAmt);

        mxPacs00900108Creator.setIntrBkSttlmDt(new Date());

        Agent prvsInstgAgt1 = new Agent();
        FinInstnId finInstnId = new FinInstnId();
        PstlAdr pstlAdr = new PstlAdr();
        finInstnId.setBicfi("PSBCCNBJ");
        finInstnId.setNm("zhaoliu");
        finInstnId.setLei("11111111111111111111");
        List<String> list = new ArrayList<>();
        list.add("BIODATA GMBH");
        list.add("HOCHSTRASSE, 27");
        pstlAdr.setCtry("CN");
        pstlAdr.setAdrLine(list);
        finInstnId.setPstlAdr(pstlAdr);
        prvsInstgAgt1.setFinInstnId(finInstnId);

        mxPacs00900108Creator.setPrvsInstgAgt1(prvsInstgAgt1);
        mxPacs00900108Creator.setPrvsInstgAgt1Acct(sttlmAcct);
        mxPacs00900108Creator.setPrvsInstgAgt2(prvsInstgAgt1);
        mxPacs00900108Creator.setPrvsInstgAgt2Acct(sttlmAcct);
        mxPacs00900108Creator.setPrvsInstgAgt3(prvsInstgAgt1);
        mxPacs00900108Creator.setPrvsInstgAgt3Acct(sttlmAcct);

        mxPacs00900108Creator.setIntrmyAgt1(prvsInstgAgt1);
        mxPacs00900108Creator.setIntrmyAgt1Acct(sttlmAcct);
        mxPacs00900108Creator.setIntrmyAgt2(prvsInstgAgt1);
        mxPacs00900108Creator.setIntrmyAgt2Acct(sttlmAcct);
        mxPacs00900108Creator.setIntrmyAgt3(prvsInstgAgt1);
        mxPacs00900108Creator.setIntrmyAgt3Acct(sttlmAcct);

        mxPacs00900108Creator.setDbtr(prvsInstgAgt1);
        mxPacs00900108Creator.setDbtrAcct(sttlmAcct);
        mxPacs00900108Creator.setCdtr(prvsInstgAgt1);
        mxPacs00900108Creator.setCdtrAcct(sttlmAcct);
        mxPacs00900108Creator.setCdtrAgt(prvsInstgAgt1);
        mxPacs00900108Creator.setCdtrAgtAcct(sttlmAcct);

        List<InstrForCdtrAgt> instrForCdtrAgtList = new ArrayList<>();
        InstrForCdtrAgt instrForCdtrAgt = new InstrForCdtrAgt();
        instrForCdtrAgt.setCd("HOLD");
        instrForCdtrAgt.setInstrInf("ccc");
        instrForCdtrAgtList.add(instrForCdtrAgt);
        instrForCdtrAgtList.add(instrForCdtrAgt);
        mxPacs00900108Creator.setInstrForCdtrAgt(instrForCdtrAgtList);

        List<InstrForNxtAgt> instrForNxtAgtList = new ArrayList<>();
        InstrForNxtAgt instrForNxtAgt = new InstrForNxtAgt();
        instrForNxtAgt.setInstrInf("111");
        mxPacs00900108Creator.setInstrForNxtAgt(instrForNxtAgtList);

        RmtInf rmtInf = new RmtInf();
        List<String> ustrdList = new ArrayList<>();
        ustrdList.add("/1111/111/222");
        rmtInf.setUstrd(ustrdList);
        mxPacs00900108Creator.setRmtInf(rmtInf);

        MxResult result = (MxResult) CreatorManager.pack(mxPacs00900108Creator);
        if (result.isSuccess())
            System.out.println(result.getMessage());
        else {
            System.out.println(result.getErrorInf());
        }
    }

    @Test
    public void test_Pacs009_COV_2() {
        MXPacs00900108Creator mxPacs00900108Creator = new MXPacs00900108Creator("pacs.009.001.08");

        mxPacs00900108Creator.setSenderBic("NDEAFIHH");

        mxPacs00900108Creator.setReceiverBic("HELSFIHH");

        mxPacs00900108Creator.setBizMsgIdr("pacs9bizmsgidr02");

        mxPacs00900108Creator.setMsgDefIdr("pacs.009.001.08");

        mxPacs00900108Creator.setBizSvc("swift.cbprplus.cov.02");

        mxPacs00900108Creator.setCreDt(new XmlDate());

        mxPacs00900108Creator.setNbOfTxs("1");

        SttlmInf2 sttlmInf2 = new SttlmInf2();
        sttlmInf2.setSttlmMtd("INDA");
        mxPacs00900108Creator.setSttlmInf(sttlmInf2);

        mxPacs00900108Creator.setEndToEndId("pacs8bizmsgidr01");

        mxPacs00900108Creator.setUetr("8a562c67-ca16-48ba-b074-65581be6f001");

        Amt intrBkSttlmAmt = new Amt();
        intrBkSttlmAmt.setCcy("EUR");
        intrBkSttlmAmt.setValue(new BigDecimal("1500000"));
        mxPacs00900108Creator.setIntrBkSttlmAmt(intrBkSttlmAmt);

        mxPacs00900108Creator.setIntrBkSttlmDt(new Date());

        Agent dbtr = new Agent();
        FinInstnId finInstnId = new FinInstnId();
        finInstnId.setBicfi("RBOSGB2L");
        dbtr.setFinInstnId(finInstnId);
        mxPacs00900108Creator.setDbtr(dbtr);

        Agent cdtrAgt = new Agent();
        FinInstnId finInstnId1 = new FinInstnId();
        finInstnId1.setBicfi("HELSFIHH");
        cdtrAgt.setFinInstnId(finInstnId1);
        mxPacs00900108Creator.setCdtrAgt(cdtrAgt);

        Agent cdtr = new Agent();
        FinInstnId finInstnId2 = new FinInstnId();
        finInstnId2.setBicfi("OKOYFIHH");
        cdtr.setFinInstnId(finInstnId2);
        mxPacs00900108Creator.setCdtr(cdtr);

        List<InstrForCdtrAgt> instrForCdtrAgtList = new ArrayList<>();
        InstrForCdtrAgt instrForCdtrAgt = new InstrForCdtrAgt();
        instrForCdtrAgt.setInstrInf("/UDLC/1123");
        InstrForCdtrAgt instrForCdtrAgt2 = new InstrForCdtrAgt();
        instrForCdtrAgt2.setCd("PHOB");
        instrForCdtrAgt2.setInstrInf("78955");
        instrForCdtrAgtList.add(instrForCdtrAgt);
        instrForCdtrAgtList.add(instrForCdtrAgt2);
        mxPacs00900108Creator.setInstrForCdtrAgt(instrForCdtrAgtList);

        List<InstrForNxtAgt> instrForNxtAgtList = new ArrayList<>();
        InstrForNxtAgt instrForNxtAgt = new InstrForNxtAgt();
        instrForNxtAgt.setInstrInf("123456/FIN53/TDOMUS33/WER/132");
        InstrForNxtAgt instrForNxtAgt2 = new InstrForNxtAgt();
        instrForNxtAgt2.setInstrInf("123456789");
        instrForNxtAgtList.add(instrForNxtAgt);
        instrForNxtAgtList.add(instrForNxtAgt2);
        mxPacs00900108Creator.setInstrForNxtAgt(instrForNxtAgtList);

        RmtInf rmtInf = new RmtInf();
        List<String> ustrdList = new ArrayList<>();
        ustrdList.add("Invoice: 456-9663");
        rmtInf.setUstrd(ustrdList);
        mxPacs00900108Creator.setRmtInf(rmtInf);

        UndrlygCstmrCdtTrf undrlygCstmrCdtTrf = new UndrlygCstmrCdtTrf();

        Party dbtr2 = new Party();
        dbtr2.setNm("A Debiter");
        PstlAdr pstlAdr = new PstlAdr();
        pstlAdr.setStrtNm("280 Bishopsgate");
        pstlAdr.setTwnNm("London");
        pstlAdr.setCtry("GB");
        dbtr2.setPstlAdr(pstlAdr);
        undrlygCstmrCdtTrf.setDbtr(dbtr2);

        Agent dbtrAgt = new Agent();
        FinInstnId finInstnId3 = new FinInstnId();
        finInstnId3.setBicfi("RBOSGB2L");
        dbtrAgt.setFinInstnId(finInstnId3);
        undrlygCstmrCdtTrf.setDbtrAgt(dbtrAgt);

        Agent intrmyAgt1 = new Agent();
        FinInstnId finInstnId4 = new FinInstnId();
        finInstnId4.setBicfi("HELSFIHH");
        intrmyAgt1.setFinInstnId(finInstnId4);
        undrlygCstmrCdtTrf.setIntrmyAgt1(intrmyAgt1);

        Agent cdtrAgt2 = new Agent();
        FinInstnId finInstnId5 = new FinInstnId();
        finInstnId5.setBicfi("OKOYFIHH");
        cdtrAgt2.setFinInstnId(finInstnId5);
        undrlygCstmrCdtTrf.setCdtrAgt(cdtrAgt2);

        Party cdtr2 = new Party();
        cdtr2.setNm("Z Krediter");
        PstlAdr pstlAdr1 = new PstlAdr();
        pstlAdr1.setStrtNm("Antinkatu 11");
        pstlAdr1.setTwnNm("Pori");
        pstlAdr1.setCtry("FI");
        cdtr2.setPstlAdr(pstlAdr1);
        undrlygCstmrCdtTrf.setCdtr(cdtr2);

        List<InstrForCdtrAgt> instrForCdtrAgtList1 = new ArrayList<>();
        InstrForCdtrAgt instrForCdtrAgt3 = new InstrForCdtrAgt();
        instrForCdtrAgt3.setInstrInf("456456/PHOB//HOLD/789");
        InstrForCdtrAgt instrForCdtrAgt4 = new InstrForCdtrAgt();
        instrForCdtrAgt3.setInstrInf("78955/CHQB/ee/TELB/789");
        instrForCdtrAgtList1.add(instrForCdtrAgt3);
        instrForCdtrAgtList1.add(instrForCdtrAgt4);
        undrlygCstmrCdtTrf.setInstrForCdtrAgt(instrForCdtrAgtList1);

        List<InstrForNxtAgt> instrForNxtAgtList1 = new ArrayList<>();
        InstrForNxtAgt instrForNxtAgt3 = new InstrForNxtAgt();
        instrForNxtAgt3.setInstrInf("123456/FIN53/TDOMUS33");
        InstrForNxtAgt instrForNxtAgt4 = new InstrForNxtAgt();
        instrForNxtAgt4.setInstrInf("123456789");
        instrForNxtAgtList1.add(instrForNxtAgt3);
        instrForNxtAgtList1.add(instrForNxtAgt4);
        undrlygCstmrCdtTrf.setInstrForNxtAgt(instrForNxtAgtList1);

        mxPacs00900108Creator.setUndrlygCstmrCdtTrf(undrlygCstmrCdtTrf);

        MxResult result = (MxResult) CreatorManager.pack(mxPacs00900108Creator);
        if (result.isSuccess())
            System.out.println(result.getMessage());
        else {
            System.out.println(result.getErrorInf());
        }

    }

    @Test
    public void test_Pacs009_2(){
        MXPacs00900108Creator mxPacs00900108Creator = new MXPacs00900108Creator("pacs.009.001.08");

        mxPacs00900108Creator.setSenderBic("TDOMCATT");

        mxPacs00900108Creator.setReceiverBic("ROYCCAT2");

        mxPacs00900108Creator.setBizMsgIdr("pacs9bizmsgidr03");

        mxPacs00900108Creator.setMsgDefIdr("pacs.009.001.08");

        mxPacs00900108Creator.setBizSvc("swift.cbprplus.02");

        mxPacs00900108Creator.setCreDt(new XmlDate());

        mxPacs00900108Creator.setNbOfTxs("1");

        mxPacs00900108Creator.setEndToEndId("pacs9bizmsgidr01");

        mxPacs00900108Creator.setUetr("8a562c67-ca16-48ba-b074-65581be6f001");

        SttlmInf2 sttlmInf2 = new SttlmInf2();
        sttlmInf2.setSttlmMtd("INDA");
        mxPacs00900108Creator.setSttlmInf(sttlmInf2);

        Amt intrBkSttlmAmt = new Amt();
        intrBkSttlmAmt.setCcy("CAD");
        intrBkSttlmAmt.setValue(new BigDecimal("2565972"));
        mxPacs00900108Creator.setIntrBkSttlmAmt(intrBkSttlmAmt);

        mxPacs00900108Creator.setIntrBkSttlmDt(new Date());

        Agent dbtr = new Agent();
        FinInstnId finInstnId = new FinInstnId();
        finInstnId.setBicfi("TDOMUS33");
        dbtr.setFinInstnId(finInstnId);
        mxPacs00900108Creator.setDbtr(dbtr);

        Agent dbtrAgt = new Agent();
        FinInstnId finInstnId1 = new FinInstnId();
        finInstnId1.setBicfi("TDOMCATT");
        dbtrAgt.setFinInstnId(finInstnId1);
        mxPacs00900108Creator.setDbtrAgt(dbtrAgt);

        Agent cdtrAgt = new Agent();
        FinInstnId finInstnId2 = new FinInstnId();
        finInstnId2.setBicfi("TDOMCATT");
        cdtrAgt.setFinInstnId(finInstnId2);
        mxPacs00900108Creator.setCdtrAgt(cdtrAgt);

        Agent cdtr = new Agent();
        FinInstnId finInstnId3 = new FinInstnId();
        finInstnId3.setBicfi("NWBKGB2L");
        cdtr.setFinInstnId(finInstnId3);
        mxPacs00900108Creator.setCdtr(cdtr);

        MxResult result = (MxResult) CreatorManager.pack(mxPacs00900108Creator);
        if (result.isSuccess())
            System.out.println(result.getMessage());
        else {
            System.out.println(result.getErrorInf());
        }
    }
}
