package com.brilliance.isc.convert.mt4xx;

import com.brilliance.isc.swift.objmtconvert.manager.MtCreatorManager;
import com.brilliance.isc.swift.objmtconvert.model.commontag.DcDateCurAmtTagXXX;
import com.brilliance.isc.swift.objmtconvert.model.mt4xx.MT410Creator;
import com.brilliance.isc.swift.objmtconvert.model.mt4xx.MT422Creator;
import com.brilliance.isc.swift.objmtconvert.model.mt4xx.mt4XXAbsCreator.MT410AbsCreator;
import com.brilliance.isc.swift.objmtconvert.model.mt4xx.mt4XXAbsCreator.MT422AbsCreator;
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 MT422Test {

    @Test
    public void test_422(){
        MT422Creator mt422Creator = new MT422Creator("422");
        mt422Creator.setRecvBic("CIPSCNSHXXX");//收报行
        mt422Creator.setSendBic("PSBCCNBJXXX");//发报行
        List<MT422AbsCreator> mt422AbsCreators = new ArrayList<>();
        MT422AbsCreator mt422AbsCreator = new MT422AbsCreator();
        //20
        mt422AbsCreator.setSendingBankTRN("COL456");
        //21
        mt422AbsCreator.setRelatedReference("REM432");
        //32 32K
        DcDateCurAmtTagXXX amountOfCollection32K = new DcDateCurAmtTagXXX("32");
        amountOfCollection32K.setDayMonth("D");
        amountOfCollection32K.setNumberOfDaysMonths("000");
        amountOfCollection32K.setCode("ST");
        amountOfCollection32K.setCurrency("EUR");
        amountOfCollection32K.setAmount(new BigDecimal("10000.00"));
        mt422AbsCreator.setAmountOfCollection(amountOfCollection32K);
        mt422AbsCreators.add(mt422AbsCreator);

        MT422AbsCreator mt422AbsCreator2 = new MT422AbsCreator();
        //20
        mt422AbsCreator2.setSendingBankTRN("COL456");
        //21
        mt422AbsCreator2.setRelatedReference("REM432");
        //32 32A
        DcDateCurAmtTagXXX amountOfCollection32A = new DcDateCurAmtTagXXX("32");
        amountOfCollection32A.setDate("220801");
        amountOfCollection32A.setCurrency("EUR");
        amountOfCollection32A.setAmount(new BigDecimal("10000.00"));
        mt422AbsCreator2.setAmountOfCollection(amountOfCollection32A);
        mt422AbsCreators.add(mt422AbsCreator2);

        MT422AbsCreator mt422AbsCreator3 = new MT422AbsCreator();
        //20
        mt422AbsCreator3.setSendingBankTRN("COL456");
        //21
        mt422AbsCreator3.setRelatedReference("REM432");
        //32 32B
        DcDateCurAmtTagXXX amountOfCollection32B = new DcDateCurAmtTagXXX("32");
        amountOfCollection32B.setCurrency("EUR");
        amountOfCollection32B.setAmount(new BigDecimal("10000.00"));
        mt422AbsCreator3.setAmountOfCollection(amountOfCollection32B);
        mt422AbsCreators.add(mt422AbsCreator3);

        mt422Creator.setMt422AbsCreators(mt422AbsCreators);
        //72
        mt422Creator.setSenderToReceiverInformation("GOODS WAREHOUSED AND INSURED");
        //75
        mt422Creator.setQueries("DRAWEE DISAGREES WITH CONDITIONS"+ Constans.NEW_LINE+"PLEASE VERIFY WITH DRAWER.");
        //76
        mt422Creator.setAnswers("DRAWEE DISAGREES WITH CONDITIONS"+ Constans.NEW_LINE+"PLEASE VERIFY WITH DRAWER.");
        MtResult mtResult= MtCreatorManager.packMT(mt422Creator);
    }
    @Test
    public void test_422_2(){
        MT422Creator mt422Creator = new MT422Creator("422");
        mt422Creator.setRecvBic("CIPSCNSHXXX");//收报行
        mt422Creator.setSendBic("PSBCCNBJXXX");//发报行
        List<MT422AbsCreator> mt422AbsCreators = new ArrayList<>();
        MT422AbsCreator mt422AbsCreator = new MT422AbsCreator();
        //20
        mt422AbsCreator.setSendingBankTRN("COL456SSSSSSSSSSSSSSSSSSS");
        //21
        mt422AbsCreator.setRelatedReference("REM432");
        //32 32K
        DcDateCurAmtTagXXX amountOfCollection32K = new DcDateCurAmtTagXXX("32");
        amountOfCollection32K.setDayMonth("DADAS");
        amountOfCollection32K.setNumberOfDaysMonths("000");
        amountOfCollection32K.setCode("ST");
        amountOfCollection32K.setCurrency("EURDAD");
        amountOfCollection32K.setAmount(new BigDecimal("10000.00"));
        mt422AbsCreator.setAmountOfCollection(amountOfCollection32K);
        mt422AbsCreators.add(mt422AbsCreator);

        MT422AbsCreator mt422AbsCreator2 = new MT422AbsCreator();
        //20
        mt422AbsCreator2.setSendingBankTRN("COL456");
        //21
        mt422AbsCreator2.setRelatedReference("REM432");
        //32 32A
        DcDateCurAmtTagXXX amountOfCollection32A = new DcDateCurAmtTagXXX("32");
        amountOfCollection32A.setDate("220801");
        amountOfCollection32A.setCurrency("EURDA");
        amountOfCollection32A.setAmount(new BigDecimal("10000.00"));
        mt422AbsCreator2.setAmountOfCollection(amountOfCollection32A);
        mt422AbsCreators.add(mt422AbsCreator2);

        MT422AbsCreator mt422AbsCreator3 = new MT422AbsCreator();
        //20
        mt422AbsCreator3.setSendingBankTRN("COL456");
        //21
        mt422AbsCreator3.setRelatedReference("REM432");
        //32 32B
        DcDateCurAmtTagXXX amountOfCollection32B = new DcDateCurAmtTagXXX("32");
        amountOfCollection32B.setCurrency("EUR");
        amountOfCollection32B.setAmount(new BigDecimal("10000.00"));
        mt422AbsCreator3.setAmountOfCollection(amountOfCollection32B);
        mt422AbsCreators.add(mt422AbsCreator3);

        mt422Creator.setMt422AbsCreators(mt422AbsCreators);
        //72
        mt422Creator.setSenderToReceiverInformation("GOODS WAREHOUSED AND INSURED");
        //75
        mt422Creator.setQueries("DRAWEE DISAGREES WITH CONDITIONS"+ Constans.NEW_LINE+"PLEASE VERIFY WITH DRAWER.");
        //76
        mt422Creator.setAnswers("DRAWEE DISAGREES WITH CONDITIONS"+ Constans.NEW_LINE+"PLEASE VERIFY WITH DRAWER.");
        MtResult mtResult= MtCreatorManager.packMT(mt422Creator);
    }
    @Test
    public void test_422_3(){
        MT422Creator mt422Creator = new MT422Creator("422");
        mt422Creator.setRecvBic("CIPSCNSHXXX");//收报行
        mt422Creator.setSendBic("PSBCCNBJXXX");//发报行
        List<MT422AbsCreator> mt422AbsCreators = new ArrayList<>();
        MT422AbsCreator mt422AbsCreator = new MT422AbsCreator();
        //20
        mt422AbsCreator.setSendingBankTRN("COL456");
        //21
        mt422AbsCreator.setRelatedReference("REM432");
        //32 32K
        DcDateCurAmtTagXXX amountOfCollection32K = new DcDateCurAmtTagXXX("32");
        amountOfCollection32K.setDayMonth("D");
        amountOfCollection32K.setNumberOfDaysMonths("000");
        amountOfCollection32K.setCode("ST");
        amountOfCollection32K.setCurrency("EUR");
        amountOfCollection32K.setAmount(new BigDecimal("10000.00"));
        mt422AbsCreator.setAmountOfCollection(amountOfCollection32K);
        mt422AbsCreators.add(mt422AbsCreator);

        MT422AbsCreator mt422AbsCreator2 = new MT422AbsCreator();
        //20
        mt422AbsCreator2.setSendingBankTRN("COL456");
        //21
        mt422AbsCreator2.setRelatedReference("REM432");
        //32 32A
        DcDateCurAmtTagXXX amountOfCollection32A = new DcDateCurAmtTagXXX("32");
        amountOfCollection32A.setDate("220801");
        amountOfCollection32A.setCurrency("EUR");
        amountOfCollection32A.setAmount(new BigDecimal("10000.00"));
        mt422AbsCreator2.setAmountOfCollection(amountOfCollection32A);
        mt422AbsCreators.add(mt422AbsCreator2);

        MT422AbsCreator mt422AbsCreator3 = new MT422AbsCreator();
        //20
        mt422AbsCreator3.setSendingBankTRN("COL456");
        //21
        mt422AbsCreator3.setRelatedReference("REM432");
        //32 32B
        DcDateCurAmtTagXXX amountOfCollection32B = new DcDateCurAmtTagXXX("32");
        amountOfCollection32B.setCurrency("USD");
        amountOfCollection32B.setAmount(new BigDecimal("10000.00"));
        mt422AbsCreator3.setAmountOfCollection(amountOfCollection32B);
        mt422AbsCreators.add(mt422AbsCreator3);
        mt422AbsCreators.add(mt422AbsCreator3);
        mt422AbsCreators.add(mt422AbsCreator3);
        mt422AbsCreators.add(mt422AbsCreator3);
        mt422AbsCreators.add(mt422AbsCreator3);
        mt422AbsCreators.add(mt422AbsCreator3);
        mt422AbsCreators.add(mt422AbsCreator3);
        mt422AbsCreators.add(mt422AbsCreator3);
        mt422AbsCreators.add(mt422AbsCreator3);
        mt422AbsCreators.add(mt422AbsCreator3);
        mt422AbsCreators.add(mt422AbsCreator3);

        mt422Creator.setMt422AbsCreators(mt422AbsCreators);
//        //72
//        mt422Creator.setSenderToReceiverInformation("GOODS WAREHOUSED AND INSURED");
//        //75
//        mt422Creator.setQueries("DRAWEE DISAGREES WITH CONDITIONS"+ Constans.NEW_LINE+"PLEASE VERIFY WITH DRAWER.");
//        //76
//        mt422Creator.setAnswers("DRAWEE DISAGREES WITH CONDITIONS"+ Constans.NEW_LINE+"PLEASE VERIFY WITH DRAWER.");
        MtResult mtResult= MtCreatorManager.packMT(mt422Creator);
    }


}
