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.MT200Creator;
import com.brilliance.isc.swift.objmtconvert.result.MtResult;
import com.brilliance.isc.swift.objmtconvert.util.Constans;
import com.brilliance.isc.swift.objmtconvert.util.JsonUtil;
import org.junit.Test;

import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;

/**
 * @author huangmengyuan
 * @create 2023/2/27
 */
public class MT200Test {
    @Test
    public void mt200_Test() {
        //53B
        ActnoBicAdrTagXXX actnoBicAdr53B = new ActnoBicAdrTagXXX("53");
        actnoBicAdr53B.setLocation("WJHGJGJ");
        actnoBicAdr53B.setPartyIdentifier("7777-4321");

        //56A 56D
        ActnoBicAdrTagXXX actnoBicAdr56a = new ActnoBicAdrTagXXX("56");
        actnoBicAdr56a.setBic("WJHGJGJB");
        actnoBicAdr56a.setPartyIdentifier("3842-4321");

        //57A 57B 57D
        ActnoBicAdrTagXXX actnoBicAdr57a = new ActnoBicAdrTagXXX("57");
        actnoBicAdr57a.setAddress("MBUIKPKMMK");
        actnoBicAdr57a.setPartyIdentifier("9862-3521");

        MT200Creator mt200Creator = new MT200Creator("200");
        //20
        mt200Creator.setTransactionReferenceNumber("NBJDFU");//16x
        //32A
        DcDateCurAmtTagXXX dcDateCurAmt32A = new DcDateCurAmtTagXXX("32");
        dcDateCurAmt32A.setDate("200306");
        dcDateCurAmt32A.setCurrency("CHN");
        dcDateCurAmt32A.setAmount(new BigDecimal("2222.00"));
        mt200Creator.setValueDateCurrencyAmount(dcDateCurAmt32A);//6!n3!a15d
        //53B
        mt200Creator.setSendersCorrespondent(actnoBicAdr53B);//[/1!a][/34x]<crlf>[35x]
        //56A 56D
        mt200Creator.setIntermediary(actnoBicAdr56a);//A,D
        //57A 57B 57D
        mt200Creator.setAccountWithInstitution(actnoBicAdr57a);//A,B,D
        //72
        mt200Creator.setSendertoReceiverInformation("NNSJNXLMK");//6*35x

        MtCreatorManager.packMT(mt200Creator);


    }

    @Test
    public void mt200_Test2() {
        //53B
        ActnoBicAdrTagXXX actnoBicAdr53B = new ActnoBicAdrTagXXX("53");
        actnoBicAdr53B.setLocation("WJHGJGJ");
        actnoBicAdr53B.setPartyIdentifier("7777-4321");

        //56A 56D
        ActnoBicAdrTagXXX actnoBicAdr56a = new ActnoBicAdrTagXXX("56");
        actnoBicAdr56a.setBic("WJHGJGJB");
        actnoBicAdr56a.setPartyIdentifier("3842-4321");

        //57A 57B 57D
        ActnoBicAdrTagXXX actnoBicAdr57a = new ActnoBicAdrTagXXX("57");
        actnoBicAdr57a.setAddress("MBUIKPKMMK");
        actnoBicAdr57a.setPartyIdentifier("9862-3521");

        MT200Creator mt200Creator = new MT200Creator("200");
        //20
        mt200Creator.setTransactionReferenceNumber("NBJDFUNBJDFUNBJDFUNBJDFUNBJDFUNBJDFUNBJDFU");//16x
        //32A
        DcDateCurAmtTagXXX dcDateCurAmt32A = new DcDateCurAmtTagXXX("32");
        dcDateCurAmt32A.setDate("200306");
        dcDateCurAmt32A.setCurrency("CHN");
        dcDateCurAmt32A.setAmount(new BigDecimal("2222.00"));
        mt200Creator.setValueDateCurrencyAmount(dcDateCurAmt32A);//6!n3!a15d

        //53B
        mt200Creator.setSendersCorrespondent(actnoBicAdr53B);//[/1!a][/34x]<crlf>[35x]
        //56A 56D
        mt200Creator.setIntermediary(actnoBicAdr56a);//A,D
        //57A 57B 57D
        mt200Creator.setAccountWithInstitution(actnoBicAdr57a);//A,B,D
        //72
//        mt200Creator.setSendertoReceiverInformation("NNSJNXLMK");//6*35x
        MtCreatorManager.packMT(mt200Creator);

    }
    @Test
    public void mt200_Test3() {
        //53B
        ActnoBicAdrTagXXX actnoBicAdr53B = new ActnoBicAdrTagXXX("53");
        actnoBicAdr53B.setLocation("WJHGJGJ");
        actnoBicAdr53B.setPartyIdentifier("7777-4321");

        //56A 56D
        ActnoBicAdrTagXXX actnoBicAdr56a = new ActnoBicAdrTagXXX("56");
        actnoBicAdr56a.setAddress("WJHGJGJB"+ Constans.CRLF+"OPUYRVBB");
        actnoBicAdr56a.setPartyIdentifier("3842-4321");

        //57A 57B 57D
        ActnoBicAdrTagXXX actnoBicAdr57a = new ActnoBicAdrTagXXX("57");
        actnoBicAdr57a.setAddress("MBUIKPKMMK\r\nPOUI");
        actnoBicAdr57a.setPartyIdentifier("9862-3521");

        MT200Creator mt200Creator = new MT200Creator("200");
        //20
        mt200Creator.setTransactionReferenceNumber("NBJDFU");//16x
        //32A
        DcDateCurAmtTagXXX dcDateCurAmt32A = new DcDateCurAmtTagXXX("32");
        dcDateCurAmt32A.setDate("200306");
        dcDateCurAmt32A.setCurrency("CHN");
        dcDateCurAmt32A.setAmount(new BigDecimal("2222.00"));
        mt200Creator.setValueDateCurrencyAmount(dcDateCurAmt32A);//6!n3!a15d
        //53B
        mt200Creator.setSendersCorrespondent(actnoBicAdr53B);//[/1!a][/34x]<crlf>[35x]
        //56A 56D
        mt200Creator.setIntermediary(actnoBicAdr56a);//A,D
        //57A 57B 57D
        mt200Creator.setAccountWithInstitution(actnoBicAdr57a);//A,B,D
        //72
        mt200Creator.setSendertoReceiverInformation("NNSJNXLMK");//6*35x

        MtCreatorManager.packMT(mt200Creator);


    }
}
