package com.brilliance.isc.convert.mt4xx;

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.mt4xx.MT420Creator;
import com.brilliance.isc.swift.objmtconvert.model.mt4xx.mt4XXAbsCreator.MT420AbsCreator;
import com.brilliance.isc.swift.objmtconvert.result.MtResult;
import com.brilliance.isc.swift.objmtconvert.util.Constans;
import org.junit.Test;

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

/**
 * @author gechengyang
 * @date 2023/2/27
 */
public class MT420Test {

    @Test
    public void test_420(){
        MT420Creator mt420Creator = new MT420Creator("420");
        mt420Creator.setRecvBic("CIPSCNSHXXX");//收报行
        mt420Creator.setSendBic("PSBCCNBJXXX");//发报行
        List<MT420AbsCreator> mt420AbsCreators = new ArrayList<>();
        MT420AbsCreator mt420AbsCreator = new MT420AbsCreator();
        //20
        mt420AbsCreator.setSendingBankTRN("COL456");
        //21
        mt420AbsCreator.setRelatedReference("REM432");
        //32 32K
        DcDateCurAmtTagXXX amountTraced32K = new DcDateCurAmtTagXXX("32");
        amountTraced32K.setDayMonth("D");
        amountTraced32K.setNumberOfDaysMonths("000");
        amountTraced32K.setCode("ST");
        amountTraced32K.setCurrency("EUR");
        amountTraced32K.setAmount(new BigDecimal("10000.00"));
        mt420AbsCreator.setAmountTraced(amountTraced32K);
        mt420AbsCreators.add(mt420AbsCreator);

        MT420AbsCreator mt420AbsCreator2 = new MT420AbsCreator();
        //20
        mt420AbsCreator2.setSendingBankTRN("COL456");
        //21
        mt420AbsCreator2.setRelatedReference("REM432");
        //32 32A
        DcDateCurAmtTagXXX amountTraced32A = new DcDateCurAmtTagXXX("32");
        amountTraced32A.setDate("220807");
        amountTraced32A.setCurrency("EUR");
        amountTraced32A.setAmount(new BigDecimal("10000.00"));
        mt420AbsCreator2.setAmountTraced(amountTraced32A);
        mt420AbsCreators.add(mt420AbsCreator2);

        MT420AbsCreator mt420AbsCreator3 = new MT420AbsCreator();
        //20
        mt420AbsCreator3.setSendingBankTRN("COL456");
        //21
        mt420AbsCreator3.setRelatedReference("REM432");
        //32 32B
        DcDateCurAmtTagXXX amountTraced32B = new DcDateCurAmtTagXXX("32");
        amountTraced32B.setCurrency("EUR");
        amountTraced32B.setAmount(new BigDecimal("10000.00"));
        mt420AbsCreator3.setAmountTraced(amountTraced32B);
        mt420AbsCreators.add(mt420AbsCreator3);
        mt420Creator.setMt420AbsCreators(mt420AbsCreators);
        //30
        mt420Creator.setDateOfCollectionInstruction("230107");
        //59
        ActnoBicAdrTagXXX drawee = new ActnoBicAdrTagXXX("59");
        drawee.setAcctno("3123123123");
        drawee.setAddress("wuhan");
        mt420Creator.setDrawee(drawee);
        //72
        mt420Creator.setSenderToReceiverInformation("/HOLDING/");
        MtResult mtResult= MtCreatorManager.packMT(mt420Creator);
    }
    @Test
    public void test_420_2(){
        MT420Creator mt420Creator = new MT420Creator("420");
        mt420Creator.setRecvBic("CIPSCNSHXXX");//收报行
        mt420Creator.setSendBic("PSBCCNBJXXX");//发报行
        List<MT420AbsCreator> mt420AbsCreators = new ArrayList<>();
        MT420AbsCreator mt420AbsCreator = new MT420AbsCreator();
        //20
        mt420AbsCreator.setSendingBankTRN("COL456");
        //21
        mt420AbsCreator.setRelatedReference("REM432");
        //32 32K
        DcDateCurAmtTagXXX amountTraced32K = new DcDateCurAmtTagXXX("32");
        amountTraced32K.setDayMonth("DAAA");
        amountTraced32K.setNumberOfDaysMonths("000");
        amountTraced32K.setCode("ST");
        amountTraced32K.setCurrency("EUR");
        amountTraced32K.setAmount(new BigDecimal("10000.00"));
        mt420AbsCreator.setAmountTraced(amountTraced32K);
        mt420AbsCreators.add(mt420AbsCreator);

        MT420AbsCreator mt420AbsCreator2 = new MT420AbsCreator();
        //20
        mt420AbsCreator2.setSendingBankTRN("COL456");
        //21
        mt420AbsCreator2.setRelatedReference("REM432");
        //32 32A
        DcDateCurAmtTagXXX amountTraced32A = new DcDateCurAmtTagXXX("32");
        amountTraced32A.setDate("220807");
        amountTraced32A.setCurrency("EUR");
        amountTraced32A.setAmount(new BigDecimal("10000.00"));
        mt420AbsCreator2.setAmountTraced(amountTraced32A);
        mt420AbsCreators.add(mt420AbsCreator2);

        MT420AbsCreator mt420AbsCreator3 = new MT420AbsCreator();
        //20
        mt420AbsCreator3.setSendingBankTRN("COL456");
        //21
        mt420AbsCreator3.setRelatedReference("REM432");
        //32 32B
        DcDateCurAmtTagXXX amountTraced32B = new DcDateCurAmtTagXXX("32");
        amountTraced32B.setCurrency("EUR");
        amountTraced32B.setAmount(new BigDecimal("10000.00"));
        mt420AbsCreator3.setAmountTraced(amountTraced32B);
        mt420AbsCreators.add(mt420AbsCreator3);
        mt420Creator.setMt420AbsCreators(mt420AbsCreators);
        //30
        mt420Creator.setDateOfCollectionInstruction("230107");
        //59
        ActnoBicAdrTagXXX drawee = new ActnoBicAdrTagXXX("59");
        drawee.setAcctno("3123123123AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA");
        drawee.setAddress("wuhan");
        mt420Creator.setDrawee(drawee);
        //72
        mt420Creator.setSenderToReceiverInformation("/HOLDING/");
        MtResult mtResult= MtCreatorManager.packMT(mt420Creator);
    }
    @Test
    public void test_420_3(){
        MT420Creator mt420Creator = new MT420Creator("420");
        mt420Creator.setRecvBic("CIPSCNSHXXX");//收报行
        mt420Creator.setSendBic("PSBCCNBJXXX");//发报行
        List<MT420AbsCreator> mt420AbsCreators = new ArrayList<>();
        MT420AbsCreator mt420AbsCreator = new MT420AbsCreator();
        //20
        mt420AbsCreator.setSendingBankTRN("COL456");
        //21
        mt420AbsCreator.setRelatedReference("REM432");
        //32 32K
        DcDateCurAmtTagXXX amountTraced32K = new DcDateCurAmtTagXXX("32");
        amountTraced32K.setDayMonth("D");
        amountTraced32K.setNumberOfDaysMonths("000");
        amountTraced32K.setCode("ST");
        amountTraced32K.setCurrency("EUR");
        amountTraced32K.setAmount(new BigDecimal("10000.00"));
        mt420AbsCreator.setAmountTraced(amountTraced32K);
        mt420AbsCreators.add(mt420AbsCreator);

        MT420AbsCreator mt420AbsCreator2 = new MT420AbsCreator();
        //20
        mt420AbsCreator2.setSendingBankTRN("COL456");
        //21
        mt420AbsCreator2.setRelatedReference("REM432");
        //32 32A
        DcDateCurAmtTagXXX amountTraced32A = new DcDateCurAmtTagXXX("32");
        amountTraced32A.setDate("220807");
        amountTraced32A.setCurrency("USD");
        amountTraced32A.setAmount(new BigDecimal("10000.00"));
        mt420AbsCreator2.setAmountTraced(amountTraced32A);
        mt420AbsCreators.add(mt420AbsCreator2);
        mt420AbsCreators.add(mt420AbsCreator2);
        mt420AbsCreators.add(mt420AbsCreator2);
        mt420AbsCreators.add(mt420AbsCreator2);
        mt420AbsCreators.add(mt420AbsCreator2);
        mt420AbsCreators.add(mt420AbsCreator2);
        mt420AbsCreators.add(mt420AbsCreator2);
        mt420AbsCreators.add(mt420AbsCreator2);
        mt420AbsCreators.add(mt420AbsCreator2);
        mt420AbsCreators.add(mt420AbsCreator2);
        mt420AbsCreators.add(mt420AbsCreator2);
        mt420AbsCreators.add(mt420AbsCreator2);
        mt420AbsCreators.add(mt420AbsCreator2);
        mt420AbsCreators.add(mt420AbsCreator2);
        mt420AbsCreators.add(mt420AbsCreator2);
        mt420AbsCreators.add(mt420AbsCreator2);
        mt420AbsCreators.add(mt420AbsCreator2);
        mt420AbsCreators.add(mt420AbsCreator2);
        mt420AbsCreators.add(mt420AbsCreator2);
        mt420AbsCreators.add(mt420AbsCreator2);

        MT420AbsCreator mt420AbsCreator3 = new MT420AbsCreator();
        //20
        mt420AbsCreator3.setSendingBankTRN("COL456");
        //21
        mt420AbsCreator3.setRelatedReference("REM432");
        //32 32B
        DcDateCurAmtTagXXX amountTraced32B = new DcDateCurAmtTagXXX("32");
        amountTraced32B.setCurrency("EUR");
        amountTraced32B.setAmount(new BigDecimal("10000.00"));
        mt420AbsCreator3.setAmountTraced(amountTraced32B);
        mt420AbsCreators.add(mt420AbsCreator3);
        mt420Creator.setMt420AbsCreators(mt420AbsCreators);
        //30
        mt420Creator.setDateOfCollectionInstruction("230107");
        //59
        ActnoBicAdrTagXXX drawee = new ActnoBicAdrTagXXX("59");
        drawee.setAcctno("3123123123");
        drawee.setAddress("wuhan");
        mt420Creator.setDrawee(drawee);
        //72
        mt420Creator.setSenderToReceiverInformation("/HOLDING/"+ Constans.NEW_LINE+"GOODS WAREHOUSED AND INSURED");
        MtResult mtResult= MtCreatorManager.packMT(mt420Creator);
    }


}
