package com.brilliance.isc.convert.mt2xx;

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.mt2xx.MT210Creator;
import com.brilliance.isc.swift.objmtconvert.model.mt2xx.mt2XXAbsCreator.MT210AbsCreator;
import org.junit.Test;

import java.math.BigDecimal;
import java.util.LinkedList;

/**
 * @author huangmengyuan
 * @create 2023/2/28
 */
public class MT210Test {
    @Test
    public void mt210_Test() {
        MT210Creator mt210Creator = new MT210Creator("210");
        //20
        mt210Creator.setTransactionReferenceNumber("LKNGHB");//16x
        //25
        mt210Creator.setAccountIdentification("ONBFDX/2651");//35x
        //30
        mt210Creator.setValueDate("984302");//6!n
        //循环1
        LinkedList<MT210AbsCreator> list = new LinkedList<>();
        MT210AbsCreator MT210AbsCreator = new MT210AbsCreator();
        //21
        MT210AbsCreator.setRelatedReference("KLNGHYP");//16x
        //32B
        DcDateCurAmtTagXXX dcDateCurAmt32B = new DcDateCurAmtTagXXX("32");
        dcDateCurAmt32B.setCurrency("CHN");
        dcDateCurAmt32B.setAmount(new BigDecimal("1000"));
        MT210AbsCreator.setCurrencyCodeAmount(dcDateCurAmt32B);//3!a15d
        //50 50C 50F
        ActnoBicAdrTagXXX actnoBicAdr50a = new ActnoBicAdrTagXXX("50","210");
        actnoBicAdr50a.setPartyIdentifier("JHGJHBJHBJBJ");
        actnoBicAdr50a.setAddress("2/OPIUYT");
//        actnoBicAdr50a.setBic("POUIJKNY");
//        MT210AbsCreator.setOrderingCustomer(actnoBicAdr50a);
        //52A 52D
        ActnoBicAdrTagXXX actnoBicAdr52a = new ActnoBicAdrTagXXX("52");
        actnoBicAdr52a.setPartyIdentifier("2310-9851");
        actnoBicAdr52a.setBic("OIKJYGPL");
        MT210AbsCreator.setOrderingInstitution(actnoBicAdr52a);
        //56A 56D
        ActnoBicAdrTagXXX actnoBicAdr56a = new ActnoBicAdrTagXXX("56");
        actnoBicAdr56a.setPartyIdentifier("2310-2315");
        actnoBicAdr56a.setAddress("OIKJYGPL562");
        MT210AbsCreator.setIntermediary(actnoBicAdr56a);
        list.add(MT210AbsCreator);

        //循环2
        MT210AbsCreator MT210AbsCreator2 = new MT210AbsCreator();
        //21
        MT210AbsCreator2.setRelatedReference("KLNGHYP");//16x
        //32B
        DcDateCurAmtTagXXX dcDateCurAmt32B2 = new DcDateCurAmtTagXXX("32");
        dcDateCurAmt32B2.setCurrency("USD");
        dcDateCurAmt32B2.setAmount(new BigDecimal("1000.1"));
        MT210AbsCreator2.setCurrencyCodeAmount(dcDateCurAmt32B2);//3!a15d
        //50 50C 50F
        ActnoBicAdrTagXXX actnoBicAdr50a2 = new ActnoBicAdrTagXXX("50","210");
//        actnoBicAdr50a2.setPartyIdentifier("JHGJHBJHBJBJ");
        actnoBicAdr50a2.setAddress("2/OPIUYT");
        MT210AbsCreator2.setOrderingCustomer(actnoBicAdr50a2);
        //52A 52D
        ActnoBicAdrTagXXX actnoBicAdr52a2 = new ActnoBicAdrTagXXX("52");
        actnoBicAdr52a2.setPartyIdentifier("2310-9851");
        actnoBicAdr52a2.setBic("OIKJYGPL");
//        MT210AbsCreator2.setOrderingInstitution(actnoBicAdr52a2);
        //56A 56D
        ActnoBicAdrTagXXX actnoBicAdr56a2 = new ActnoBicAdrTagXXX("56");
        actnoBicAdr56a2.setPartyIdentifier("2310-2315");
        actnoBicAdr56a2.setAddress("OIKJYGPL562");
        MT210AbsCreator2.setIntermediary(actnoBicAdr56a2);
        list.add(MT210AbsCreator2);
        mt210Creator.setCycleDomain(list);

        MtCreatorManager.packMT(mt210Creator);
    }

    @Test
    public void mt210_Test2() {
        MT210Creator mt210Creator = new MT210Creator("210");
        //20
        mt210Creator.setTransactionReferenceNumber("LKNGHB");//16x
        //25
        mt210Creator.setAccountIdentification("ONBFDXKHKJHKKJ");//35x
        //30
        mt210Creator.setValueDate("230202");//6!n
        //循环1
        LinkedList<MT210AbsCreator> list = new LinkedList<>();
        MT210AbsCreator MT210AbsCreator = new MT210AbsCreator();
        //21
        MT210AbsCreator.setRelatedReference("KLNGHYP");//16x
        //32B
        DcDateCurAmtTagXXX dcDateCurAmt32B = new DcDateCurAmtTagXXX("32");
        dcDateCurAmt32B.setCurrency("USD");
        dcDateCurAmt32B.setAmount(new BigDecimal("1000"));
        MT210AbsCreator.setCurrencyCodeAmount(dcDateCurAmt32B);//3!a15d
        //50 50C 50F
        ActnoBicAdrTagXXX actnoBicAdr50a = new ActnoBicAdrTagXXX("50","210");
//        actnoBicAdr50a.setPartyIdentifier("JHGJHBJHBJBJ");
        actnoBicAdr50a.setAddress("2/OPIUYT");
//        actnoBicAdr50a.setBic("OPIUTYRT");
        MT210AbsCreator.setOrderingCustomer(actnoBicAdr50a);
        //52A 52D
        ActnoBicAdrTagXXX actnoBicAdr52a = new ActnoBicAdrTagXXX("52");
        actnoBicAdr52a.setPartyIdentifier("2310-9851");
        actnoBicAdr52a.setBic("OIKJYGPL");
        MT210AbsCreator.setOrderingInstitution(actnoBicAdr52a);
        //56A 56D
        ActnoBicAdrTagXXX actnoBicAdr56a = new ActnoBicAdrTagXXX("56");
        actnoBicAdr56a.setPartyIdentifier("2310-2315");
        actnoBicAdr56a.setAddress("OIKJYGPL562");
        MT210AbsCreator.setIntermediary(actnoBicAdr56a);
        list.add(MT210AbsCreator);
        mt210Creator.setCycleDomain(list);

        MtCreatorManager.packMT(mt210Creator);
    }
    @Test
    public void mt210_Test3() {
        MT210Creator mt210Creator = new MT210Creator("210");
        //20
        mt210Creator.setTransactionReferenceNumber("LKNGHB");//16x
        //25
        mt210Creator.setAccountIdentification("ONBFDX/2651");//35x
        //30
        mt210Creator.setValueDate("984302");//6!n
        //循环1
        LinkedList<MT210AbsCreator> list = new LinkedList<>();
        MT210AbsCreator MT210AbsCreator = new MT210AbsCreator();
        //21
        MT210AbsCreator.setRelatedReference("KLNGHYP");//16x
        //32B
        DcDateCurAmtTagXXX dcDateCurAmt32B = new DcDateCurAmtTagXXX("32");
        dcDateCurAmt32B.setCurrency("USD");
        dcDateCurAmt32B.setAmount(new BigDecimal(1000));
        MT210AbsCreator.setCurrencyCodeAmount(dcDateCurAmt32B);//3!a15d
        //50 50C 50F
        ActnoBicAdrTagXXX actnoBicAdr50a = new ActnoBicAdrTagXXX("50","210");
        actnoBicAdr50a.setPartyIdentifier("JHGJHBJHBJBJ");
        actnoBicAdr50a.setAddress("OPIUYT");
        MT210AbsCreator.setOrderingCustomer(actnoBicAdr50a);
        //52A 52D
        ActnoBicAdrTagXXX actnoBicAdr52a = new ActnoBicAdrTagXXX("52");
        actnoBicAdr52a.setPartyIdentifier("2310-9851");
        actnoBicAdr52a.setBic("OIKJYGPL");
        MT210AbsCreator.setOrderingInstitution(actnoBicAdr52a);
        //56A 56D
        ActnoBicAdrTagXXX actnoBicAdr56a = new ActnoBicAdrTagXXX("56");
        actnoBicAdr56a.setPartyIdentifier("2310-2315");
        actnoBicAdr56a.setAddress("OIKJYGPL562");
        MT210AbsCreator.setIntermediary(actnoBicAdr56a);
        list.add(MT210AbsCreator);


        mt210Creator.setCycleDomain(list);

        MtCreatorManager.packMT(mt210Creator);
    }
}
