package com.brilliance.isc.convert.mt9xx;

import com.brilliance.isc.swift.objmtconvert.manager.MtCreatorManager;
import com.brilliance.isc.swift.objmtconvert.model.commontag.ActnoBicAdrTagXXX;
import com.brilliance.isc.swift.objmtconvert.model.commontag.DcDateCurAmtTagXXX;
import com.brilliance.isc.swift.objmtconvert.model.mt9xx.MT942Creator;
import com.brilliance.isc.swift.objmtconvert.model.mt9xx.mt9XXAbsCreator.MT942AbsCreator;
import org.junit.Test;
import java.math.BigDecimal;
import java.util.LinkedList;
import java.util.List;

/**
 * @author hedonghao
 * @date 2023/2/24
 */
public class Mt942Test {
    @Test
    public void mt942_Test() {
        //构造参数传入MT报文类型
        MT942Creator mt942Creator=new MT942Creator("942");//报文类型
        mt942Creator.setSendBic("MRITFIHH");//发报行
        mt942Creator.setRecvBic("MIDLGB22");//收报行
        //20 16x
        mt942Creator.setTranReferenceNum("345678");
        //25a 25
        ActnoBicAdrTagXXX accountIdentification = new ActnoBicAdrTagXXX("25");
        accountIdentification.setAcctno("why null");//25 35x
        //accountIdentification.setBic("TESTTEST");//25P 4!a2!a2!c[3!c]
        mt942Creator.setAccountIdentification(accountIdentification);
        //28C 5n[/5n]
        mt942Creator.setStattNumSeqNum("79987");
        //34F(M) 3!a[1!a]15d
        DcDateCurAmtTagXXX debitDebitandCreditFloorLimitIndicator = new DcDateCurAmtTagXXX("34");
        debitDebitandCreditFloorLimitIndicator.setCurrency("AUG");//3!a
        debitDebitandCreditFloorLimitIndicator.setDcMark("C");//[1!a]
        debitDebitandCreditFloorLimitIndicator.setAmount(new BigDecimal("100000"));//15d
        mt942Creator.setDebitDebitandCreditFloorLimitIndicator(debitDebitandCreditFloorLimitIndicator);
        //13D 6!n4!n1!x4!n
        mt942Creator.setDateIndication("0906261200+0300");

        //非必选
        //21 16x
        mt942Creator.setRelatedReferen("5678");
        //34F(O) 3!a[1!a]15d
        DcDateCurAmtTagXXX creditFloorLimitIndicator = new DcDateCurAmtTagXXX("34");
        creditFloorLimitIndicator.setCurrency("EUR");
        creditFloorLimitIndicator.setDcMark("C");
        creditFloorLimitIndicator.setAmount(new BigDecimal("50000"));
        mt942Creator.setCreditFloorLimitIndicator(creditFloorLimitIndicator);
        //循环1
        List<MT942AbsCreator> list = new LinkedList<>();
        MT942AbsCreator mt942AbsCreator = new MT942AbsCreator();
        //86 6*65x
        mt942AbsCreator.setInfotoAccOwnr("WHJRRJYFB");
        //61 6!n[4!n]2a[1!a]15d1!a3!c16x[//16x]<crlf>[34x]
        mt942AbsCreator.setStatementLine("090626D120000,NCOLABCD//12345");
        list.add(mt942AbsCreator);
        //循环2
        MT942AbsCreator mt942AbsCreator2 = new MT942AbsCreator();
        //86 6*65x
        mt942AbsCreator2.setInfotoAccOwnr("WHJRRJYFB");
        //61 6!n[4!n]2a[1!a]15d1!a3!c16x[//16x]<crlf>[34x]
        mt942AbsCreator2.setStatementLine("090626C55000,NFEX99485//678922");
        list.add(mt942AbsCreator2);
        mt942Creator.setCycleDomain(list);

        //90D 5n3!a15d
        DcDateCurAmtTagXXX numberandSumofEntries90D = new DcDateCurAmtTagXXX("90D");
        numberandSumofEntries90D.setNumber(9);//5n
        numberandSumofEntries90D.setCurrency("EUR");//3!a
        numberandSumofEntries90D.setAmount(new BigDecimal("210000"));//15d
        mt942Creator.setNumberandSumofEntries90D(numberandSumofEntries90D);
        //90C 5n3!a15d
        DcDateCurAmtTagXXX numberandSumofEntries90C = new DcDateCurAmtTagXXX("90C");
        numberandSumofEntries90C.setNumber(87);//5n
        numberandSumofEntries90C.setCurrency("EUR");//3!a
        numberandSumofEntries90C.setAmount(new BigDecimal("385700"));//15d
        mt942Creator.setNumberandSumofEntries90C(numberandSumofEntries90C);
        //86 6*65x
        mt942Creator.setInfoAccontOwner("ABS");

        MtCreatorManager.packMT(mt942Creator);

    }

    @Test
    public void mt942_Test2() {
        //构造参数传入MT报文类型
        MT942Creator mt942Creator=new MT942Creator("942");//报文类型
        mt942Creator.setSendBic("MRITFIHH");//发报行
        mt942Creator.setRecvBic("MIDLGB22");//收报行
        //20 16x
        mt942Creator.setTranReferenceNum("345678");
        //25a 25P
        ActnoBicAdrTagXXX accountIdentification = new ActnoBicAdrTagXXX("25");
        //accountIdentification.setAcctno("why null");//25 35x
        accountIdentification.setBic("TESTTEST");//25P 4!a2!a2!c[3!c]
        mt942Creator.setAccountIdentification(accountIdentification);
        //28C 5n[/5n]
        mt942Creator.setStattNumSeqNum("79987");
        //34F(M) 3!a[1!a]15d
        DcDateCurAmtTagXXX debitDebitandCreditFloorLimitIndicator = new DcDateCurAmtTagXXX("34");
        debitDebitandCreditFloorLimitIndicator.setCurrency("EUR");//3!a
        debitDebitandCreditFloorLimitIndicator.setDcMark("D");//[1!a]
        debitDebitandCreditFloorLimitIndicator.setAmount(new BigDecimal("100000"));//15d
        mt942Creator.setDebitDebitandCreditFloorLimitIndicator(debitDebitandCreditFloorLimitIndicator);
        //13D 6!n4!n1!x4!n
        mt942Creator.setDateIndication("0906261200+0300");

        //非必选
        //21 16x
        mt942Creator.setRelatedReferen("5678");
        //34F(O) 3!a[1!a]15d
        DcDateCurAmtTagXXX creditFloorLimitIndicator = new DcDateCurAmtTagXXX("34");
        creditFloorLimitIndicator.setCurrency("EUR");
        creditFloorLimitIndicator.setDcMark("C");
        creditFloorLimitIndicator.setAmount(new BigDecimal("50000"));
        mt942Creator.setCreditFloorLimitIndicator(creditFloorLimitIndicator);
        //循环
        List<MT942AbsCreator> list = new LinkedList<>();
        MT942AbsCreator mt942AbsCreator = new MT942AbsCreator();
        //86 6*65x
        mt942AbsCreator.setInfotoAccOwnr("WHJRRJYFB");
        //61 6!n[4!n]2a[1!a]15d1!a3!c16x[//16x]<crlf>[34x]
        mt942AbsCreator.setStatementLine("090626D120000,NCOLABCD//12345");
        list.add(mt942AbsCreator);
        MT942AbsCreator mt942AbsCreator2 = new MT942AbsCreator();
        //86 6*65x
        mt942AbsCreator2.setInfotoAccOwnr("WHJRRJYFB");
        //61 6!n[4!n]2a[1!a]15d1!a3!c16x[//16x]<crlf>[34x]
        mt942AbsCreator2.setStatementLine("090626C55000,NFEX99485//678922");
        list.add(mt942AbsCreator2);
        mt942Creator.setCycleDomain(list);

        //90D 5n3!a15d
        DcDateCurAmtTagXXX numberandSumofEntries90D = new DcDateCurAmtTagXXX("90D");
        numberandSumofEntries90D.setNumber(9);//5n
        numberandSumofEntries90D.setCurrency("EUR");//3!a
        numberandSumofEntries90D.setAmount(new BigDecimal("210000"));//15d
        mt942Creator.setNumberandSumofEntries90D(numberandSumofEntries90D);
        //90C 5n3!a15d
        DcDateCurAmtTagXXX numberandSumofEntries90C = new DcDateCurAmtTagXXX("90C");
        numberandSumofEntries90C.setNumber(87);//5n
        numberandSumofEntries90C.setCurrency("EUR");//3!a
        numberandSumofEntries90C.setAmount(new BigDecimal("385700"));//15d
        mt942Creator.setNumberandSumofEntries90C(numberandSumofEntries90C);
        //86 6*65x
        mt942Creator.setInfoAccontOwner("ABS");

        MtCreatorManager.packMT(mt942Creator);

    }

}
