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.MT205COVCreator;
import com.brilliance.isc.swift.objmtconvert.model.mt2xx.MT205Creator;
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.LinkedList;
import java.util.List;
import java.util.Map;

/**
 * @Description：
 * @Author：夏猛
 * @CreateTime：2023/2/27 17:33
 **/
public class MT205COVTest {
    @Test
    public void mt205cov_Test() {
        //52a
        ActnoBicAdrTagXXX actnoBicAdrTag52a=new ActnoBicAdrTagXXX("52");
        //actnoBicAdrTag52a.setInfo("A");
        //actnoBicAdrTag52a.setAddress("WHYHCNHBXXX");
        //actnoBicAdrTag52a.setCode("THISIS41A");
        actnoBicAdrTag52a.setBic("GCYXXXXXX52");
        //actnoBicAdrTag52a.setAcctno("01111001759234567890");
        actnoBicAdrTag52a.setPartyIdentifier("1234-5678");
        //actnoBicAdrTag52a.setLocation("WHYHCNHBXXX");
        //53a
        ActnoBicAdrTagXXX actnoBicAdrTag53a=new ActnoBicAdrTagXXX("53");
        //actnoBicAdrTag53a.setInfo("/P");
        //actnoBicAdrTag53a.setAddress("WHYHCNHBXXX");
        //actnoBicAdrTag53a.setCode("THISIS41A");
        actnoBicAdrTag53a.setBic("WERTYU12");
        //actnoBicAdrTag53a.setAcctno("6226TEST0001");
        actnoBicAdrTag53a.setPartyIdentifier("1234-5678");
        //actnoBicAdrTag53a.setLocation("WHYHCNHBXXX");
        //56a
        ActnoBicAdrTagXXX actnoBicAdrTag56a=new ActnoBicAdrTagXXX("56");
        //actnoBicAdrTag56a.setInfo("A");
        //actnoBicAdrTag56a.setAddress("WHYHCNHBXXX");
        //actnoBicAdrTag56a.setCode("THISIS41A");
        actnoBicAdrTag56a.setBic("GCYXXXXXX56");
        //actnoBicAdrTag56a.setAcctno("01111001759234567890");
        actnoBicAdrTag56a.setPartyIdentifier("1234-5678");
        //actnoBicAdrTag56a.setLocation("WHYHCNHBXXX");
        //57a
        ActnoBicAdrTagXXX actnoBicAdrTag57a=new ActnoBicAdrTagXXX("57");
        //actnoBicAdrTag57a.setInfo("A");
        //actnoBicAdrTag57a.setAddress("WHYHCNHBXXX");
        //actnoBicAdrTag57a.setCode("THISIS41A");
        actnoBicAdrTag57a.setBic("GCYXXXXXX57");
        //actnoBicAdrTag57a.setAcctno("01111001759234567890");
        actnoBicAdrTag57a.setPartyIdentifier("1234-5678");
        //actnoBicAdrTag57a.setLocation("WHYHCNHBXXX");
        //58a
        ActnoBicAdrTagXXX actnoBicAdrTag58a=new ActnoBicAdrTagXXX("58");
        actnoBicAdrTag58a.setAddress("58001");
        actnoBicAdrTag58a.setPartyIdentifier("1234-5678");
        //actnoBicAdrTag58a.setBic("GCYXXXXXX57");

        //tagB
        //50a
        ActnoBicAdrTagXXX actnoBicAdrTagB50a=new ActnoBicAdrTagXXX("50","205COV");
        actnoBicAdrTagB50a.setAddress("ABCDEFGVV");
        //actnoBicAdrTagB50a.setAddress("1/ABCDEFGVV");
        //actnoBicAdrTagB50a.setAcctno("6226TEST0001");
        actnoBicAdrTagB50a.setPartyIdentifier("1234-5678");
        //actnoBicAdrTagB50a.setBic("GCYXXXXXX12");
        //52a
        ActnoBicAdrTagXXX actnoBicAdrTagB52a=new ActnoBicAdrTagXXX("52");
        //actnoBicAdrTagB52a.setInfo("A");
        //actnoBicAdrTagB52a.setAddress("WHYHCNHBXXX");
        //actnoBicAdrTagB52a.setCode("THISIS41A");
        actnoBicAdrTagB52a.setBic("GCYXXXXXX52");
        //actnoBicAdrTagB52a.setAcctno("01111001759234567890");
        actnoBicAdrTagB52a.setPartyIdentifier("1234-5678");
        //actnoBicAdrTagB52a.setLocation("WHYHCNHBXXX");
        //56a
        ActnoBicAdrTagXXX actnoBicAdrTagB56a=new ActnoBicAdrTagXXX("56");
        //actnoBicAdrTagB56a.setInfo("A");
        //actnoBicAdrTagB56a.setAddress("WHYHCNHBXXX");
        //actnoBicAdrTagB56a.setCode("THISIS41A");
        actnoBicAdrTagB56a.setBic("GCYXXXXXX56");
        //actnoBicAdrTagB56a.setAcctno("01111001759234567890");
        actnoBicAdrTagB56a.setPartyIdentifier("1234-5678");
        //actnoBicAdrTagB56a.setLocation("WHYHCNHBXXX");
        //57a
        ActnoBicAdrTagXXX actnoBicAdrTagB57a=new ActnoBicAdrTagXXX("57");
        //actnoBicAdrTagB57a.setInfo("A");
        //actnoBicAdrTagB57a.setAddress("WHYHCNHBXXX");
        //actnoBicAdrTagB57a.setCode("THISIS41A");
        actnoBicAdrTagB57a.setBic("GCYXXXXXX57");
        //actnoBicAdrTagB57a.setAcctno("01111001759234567890");
        actnoBicAdrTagB57a.setPartyIdentifier("1234-5678");
        //actnoBicAdrTagB57a.setLocation("WHYHCNHBXXX");
        //59a
        ActnoBicAdrTagXXX actnoBicAdrTagB59a=new ActnoBicAdrTagXXX("59","205COV");
        //actnoBicAdrTagB59a.setAddress("ABCDEFGVV");
        actnoBicAdrTagB59a.setAcctno("6226TEST0001");
        //actnoBicAdrTagB59a.setBic("GCYXXXXXX12");
        actnoBicAdrTagB59a.setAddress("1/ABCDEFGVV");
        //32A 6!n3!a15d
        DcDateCurAmtTagXXX dcDateCurAmtTag32A = new DcDateCurAmtTagXXX("32");
        dcDateCurAmtTag32A.setCurrency("CON");//3!a
        dcDateCurAmtTag32A.setAmount(new BigDecimal("200"));//15d
        dcDateCurAmtTag32A.setDate("202302");//6!n

        //构造参数传入MT报文类型
        MT205COVCreator mt205COVCreator=new MT205COVCreator("205COV");
        mt205COVCreator.setSendBic("PSBCCNBJXXX");  //接收
        mt205COVCreator.setRecvBic("CIPSCNSHXXX");  //发送

        mt205COVCreator.setTransactionReferenceNumber("123456");  //20  16x
        mt205COVCreator.setRelatedReference("rr111111");          //21  16x

        LinkedList list205cov = new LinkedList<>();
        list205cov.add("/HGF/0352-5621");
        list205cov.add("/HGF/0352-5622");
        mt205COVCreator.setTimeIndication(list205cov);       //13C  /8c/4!n1!x4!n

        mt205COVCreator.setValueDateCurrencyCodeAmount(dcDateCurAmtTag32A);   //32A 6!n3!a15d
        mt205COVCreator.setOrderingInstitution(actnoBicAdrTag52a);           //52a
        mt205COVCreator.setSendersCorrespondent(actnoBicAdrTag53a);           //53a
        mt205COVCreator.setIntermediary(actnoBicAdrTag56a);           //56a
        mt205COVCreator.setAccountWithInstitution(actnoBicAdrTag57a);           //57a
        mt205COVCreator.setBeneficiaryInstitution(actnoBicAdrTag58a);           //58a
        mt205COVCreator.setSendertoReceiverInformation("info72");       //72 6*35x

        //tagB
        mt205COVCreator.setOrderingCustomer(actnoBicAdrTagB50a);     //50a
        mt205COVCreator.setOrderingInstitutionB(actnoBicAdrTagB52a);     //52a
        mt205COVCreator.setIntermediaryInstitution(actnoBicAdrTagB56a);     //56a
        mt205COVCreator.setAccountWithInstitutionB(actnoBicAdrTagB57a);     //57a
        mt205COVCreator.setBeneficiaryCustomer(actnoBicAdrTagB59a);     //59a
        mt205COVCreator.setRemittanceInformation("infoB70");   //70 4*35x
        mt205COVCreator.setSendertoReceiverInformationB("infoB72");   //72 6*35x

        //32B 3!a15d
        DcDateCurAmtTagXXX dcDateCurAmtTag32B = new DcDateCurAmtTagXXX("33");
        dcDateCurAmtTag32B.setCurrency("CON");//3!a
        dcDateCurAmtTag32B.setAmount(new BigDecimal("200"));//15d
        mt205COVCreator.setCurrencyInstructedAmount(dcDateCurAmtTag32B);


        MtResult mtResult= MtCreatorManager.packMT(mt205COVCreator);
    }


    @Test
    public void mt205cov02_Test() {
        //52a
        ActnoBicAdrTagXXX actnoBicAdrTag52a=new ActnoBicAdrTagXXX("52");
        //actnoBicAdrTag52a.setInfo("A");
        actnoBicAdrTag52a.setAddress("WHYHCNHBXXX");
        //actnoBicAdrTag52a.setCode("THISIS41A");
        //actnoBicAdrTag52a.setBic("GCYXXXXXX52");
        //actnoBicAdrTag52a.setAcctno("01111001759234567890");
        actnoBicAdrTag52a.setPartyIdentifier("1234-5678");
        //actnoBicAdrTag52a.setLocation("WHYHCNHBXXX");
        //53a
        ActnoBicAdrTagXXX actnoBicAdrTag53a=new ActnoBicAdrTagXXX("53");
        //actnoBicAdrTag53a.setInfo("/P");
        //actnoBicAdrTag53a.setAddress("WHYHCNHBXXX");
        //actnoBicAdrTag53a.setCode("THISIS41A");
        //actnoBicAdrTag53a.setBic("WERTYU12");
        //actnoBicAdrTag53a.setAcctno("6226TEST0001");
        actnoBicAdrTag53a.setPartyIdentifier("1234-5678");
        actnoBicAdrTag53a.setLocation("WHYHCNHBXXX");
        //56a
        ActnoBicAdrTagXXX actnoBicAdrTag56a=new ActnoBicAdrTagXXX("56");
        //actnoBicAdrTag56a.setInfo("A");
        actnoBicAdrTag56a.setAddress("WHYHCNHBXXX");
        //actnoBicAdrTag56a.setCode("THISIS41A");
        //actnoBicAdrTag56a.setBic("GCYXXXXXX56");
        //actnoBicAdrTag56a.setAcctno("01111001759234567890");
        actnoBicAdrTag56a.setPartyIdentifier("1234-5678");
        //actnoBicAdrTag56a.setLocation("WHYHCNHBXXX");
        //57a
        ActnoBicAdrTagXXX actnoBicAdrTag57a=new ActnoBicAdrTagXXX("57");
        //actnoBicAdrTag57a.setInfo("A");
        //actnoBicAdrTag57a.setAddress("WHYHCNHBXXX");
        //actnoBicAdrTag57a.setCode("THISIS41A");
        //actnoBicAdrTag57a.setBic("GCYXXXXXX57");
        //actnoBicAdrTag57a.setAcctno("01111001759234567890");
        actnoBicAdrTag57a.setPartyIdentifier("1234-5678");
        actnoBicAdrTag57a.setLocation("WHYHCNHBXXX");
        //58a
        ActnoBicAdrTagXXX actnoBicAdrTag58a=new ActnoBicAdrTagXXX("58");
        //actnoBicAdrTag58a.setAddress("58001");
        actnoBicAdrTag58a.setPartyIdentifier("1234-5678");
        actnoBicAdrTag58a.setBic("GCYXXXXXX57");

        //tagB
        //50a
        ActnoBicAdrTagXXX actnoBicAdrTagB50a=new ActnoBicAdrTagXXX("50","205COV");
        actnoBicAdrTagB50a.setAddress("ABCDEFGVV");
        //actnoBicAdrTagB50a.setAddress("1/ABCDEFGVV");
        //actnoBicAdrTagB50a.setAcctno("6226TEST0001");
        actnoBicAdrTagB50a.setPartyIdentifier("1234-5678");
        //actnoBicAdrTagB50a.setBic("GCYXXXXXX12");
        //52a
        ActnoBicAdrTagXXX actnoBicAdrTagB52a=new ActnoBicAdrTagXXX("52");
        //actnoBicAdrTagB52a.setInfo("A");
        actnoBicAdrTagB52a.setAddress("WHYHCNHBXXX");
        //actnoBicAdrTagB52a.setCode("THISIS41A");
        //actnoBicAdrTagB52a.setBic("GCYXXXXXX52");
        //actnoBicAdrTagB52a.setAcctno("01111001759234567890");
        actnoBicAdrTagB52a.setPartyIdentifier("1234-5678");
        //actnoBicAdrTagB52a.setLocation("WHYHCNHBXXX");
        //56a
        ActnoBicAdrTagXXX actnoBicAdrTagB56a=new ActnoBicAdrTagXXX("56");
        //actnoBicAdrTagB56a.setInfo("A");
        actnoBicAdrTagB56a.setAddress("WHYHCNHBXXX");
        //actnoBicAdrTagB56a.setCode("THISIS41A");
        //actnoBicAdrTagB56a.setBic("GCYXXXXXX56");
        //actnoBicAdrTagB56a.setAcctno("01111001759234567890");
        actnoBicAdrTagB56a.setPartyIdentifier("1234-5678");
        //actnoBicAdrTagB56a.setLocation("WHYHCNHBXXX");
        //57a
        ActnoBicAdrTagXXX actnoBicAdrTagB57a=new ActnoBicAdrTagXXX("57");
        //actnoBicAdrTagB57a.setInfo("A");
        //actnoBicAdrTagB57a.setAddress("WHYHCNHBXXX");
        //actnoBicAdrTagB57a.setCode("THISIS41A");
        //actnoBicAdrTagB57a.setBic("GCYXXXXXX57");
        //actnoBicAdrTagB57a.setAcctno("01111001759234567890");
        actnoBicAdrTagB57a.setPartyIdentifier("1234-5678");
        actnoBicAdrTagB57a.setLocation("WHYHCNHBXXX");
        //59a
        ActnoBicAdrTagXXX actnoBicAdrTagB59a=new ActnoBicAdrTagXXX("59","205COV");
        //actnoBicAdrTagB59a.setAddress("ABCDEFGVV");
        actnoBicAdrTagB59a.setAcctno("6226TEST0001");
        //actnoBicAdrTagB59a.setBic("GCYXXXXXX12");
        actnoBicAdrTagB59a.setAddress("1/ABCDEFGVV");
        //32A 6!n3!a15d
        DcDateCurAmtTagXXX dcDateCurAmtTag32A = new DcDateCurAmtTagXXX("32");
        dcDateCurAmtTag32A.setCurrency("CON");//3!a
        dcDateCurAmtTag32A.setAmount(new BigDecimal("200"));//15d
        dcDateCurAmtTag32A.setDate("202302");//6!n

        //构造参数传入MT报文类型
        MT205COVCreator mt205COVCreator=new MT205COVCreator("205COV");
        mt205COVCreator.setSendBic("PSBCCNBJXXX");  //接收
        mt205COVCreator.setRecvBic("CIPSCNSHXXX");  //发送

        mt205COVCreator.setTransactionReferenceNumber("123456");  //20  16x
        mt205COVCreator.setRelatedReference("rr111111");          //21  16x

        LinkedList list205cov = new LinkedList<>();
        list205cov.add("/HGF/0352-5621");
        list205cov.add("/HGF/0352-5622");
        mt205COVCreator.setTimeIndication(list205cov);       //13C  /8c/4!n1!x4!n

        mt205COVCreator.setValueDateCurrencyCodeAmount(dcDateCurAmtTag32A);   //32A 6!n3!a15d
        mt205COVCreator.setOrderingInstitution(actnoBicAdrTag52a);           //52a
        mt205COVCreator.setSendersCorrespondent(actnoBicAdrTag53a);           //53a
        mt205COVCreator.setIntermediary(actnoBicAdrTag56a);           //56a
//        mt205COVCreator.setAccountWithInstitution(actnoBicAdrTag57a);           //57a
        mt205COVCreator.setBeneficiaryInstitution(actnoBicAdrTag58a);           //58a
        mt205COVCreator.setSendertoReceiverInformation("info72");       //72 6*35x

        //tagB
        mt205COVCreator.setOrderingCustomer(actnoBicAdrTagB50a);     //50a
        mt205COVCreator.setOrderingInstitutionB(actnoBicAdrTagB52a);     //52a
        mt205COVCreator.setIntermediaryInstitution(actnoBicAdrTagB56a);     //56a
        mt205COVCreator.setAccountWithInstitutionB(actnoBicAdrTagB57a);     //57a
        mt205COVCreator.setBeneficiaryCustomer(actnoBicAdrTagB59a);     //59a
        mt205COVCreator.setRemittanceInformation("infoB70"+ Constans.CRLF+"RemittanceInformation");   //70 4*35x
        mt205COVCreator.setSendertoReceiverInformationB("infoB72"+ Constans.CRLF+"RemittanceInformation");   //72 6*35x

        //32B 3!a15d
        DcDateCurAmtTagXXX dcDateCurAmtTag32B = new DcDateCurAmtTagXXX("33");
        dcDateCurAmtTag32B.setCurrency("CON");//3!a
        dcDateCurAmtTag32B.setAmount(new BigDecimal("200"));//15d
        mt205COVCreator.setCurrencyInstructedAmount(dcDateCurAmtTag32B);


        MtResult mtResult= MtCreatorManager.packMT(mt205COVCreator);
    }

}