package com.brilliance.isc.convert.mt1xx;


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.mt1xx.MT191Creator;
import com.brilliance.isc.swift.objmtconvert.model.mt1xx.MT198Creator;
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.lang.reflect.InvocationTargetException;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;

public class Mt191Test {
    @Test
    public void test_191()throws IllegalAccessException, NoSuchMethodException, InvocationTargetException {

        //52A
        ActnoBicAdrTagXXX actnoBicAdrTag52a=new ActnoBicAdrTagXXX("52");
        //actnoBicAdrTag52a.setInfo("A");
        actnoBicAdrTag52a.setAddress("WHYHCNHBXXX");
        //actnoBicAdrTag52a.setCode("");
        actnoBicAdrTag52a.setBic("ASDFQW11");
        //actnoBicAdrTag52a.setAcctno("6226TEST0001");
        //actnoBicAdrTag52a.setPartyIdentifier("1234-5678");
        //actnoBicAdrTag52a.setLocation("WHYHCNHBXXX");

        //57A
        ActnoBicAdrTagXXX actnoBicAdrTag57a=new ActnoBicAdrTagXXX("57");
        //actnoBicAdrTag57a.setInfo("A");
        //actnoBicAdrTag57a.setAddress("WHYHCNHBXXX");
        //actnoBicAdrTag57a.setCode("THISIS41A");
        actnoBicAdrTag57a.setBic("ASDFQW11");
        //actnoBicAdrTag57a.setAcctno("6226TEST0001");
        actnoBicAdrTag57a.setPartyIdentifier("1234-5678");
        //actnoBicAdrTag57a.setLocation("WHYHCNHBXXX");

        DcDateCurAmtTagXXX dcdatecuramt32B=new DcDateCurAmtTagXXX("32");
        //dcdatecuramt32B.setDate("990516");
        dcdatecuramt32B.setAmount(new BigDecimal("1000.00"));
        dcdatecuramt32B.setCurrency("USD");

        //构造参数传入MT报文类型
        MT191Creator mt191Creator=new MT191Creator("191");
        mt191Creator.setSendBic("PSBCCNBJXXX");
        mt191Creator.setRecvBic("CIPSCNSHXXX");
        mt191Creator.setTransactionReferenceNumber("RelatedReference");
        mt191Creator.setRelatedReference("RelatedReference");
        mt191Creator.setCurrencyCodeAmount32B(dcdatecuramt32B);
        mt191Creator.setDetailsofCharges("DetailsofCharges"+Constans.CRLF+"DetailsofCharges");
        mt191Creator.setSendertoReceiverInformation("SendertoReceiverInformation"+Constans.CRLF+"RelatedReference");
        mt191Creator.setAccountWithInstitution57a(actnoBicAdrTag57a);
        mt191Creator.setOrderingInstitution52a(actnoBicAdrTag52a);

        //String json = JsonUtil.toJson(map);

        /********以上为json参数**************/

//        MtResult mtResult = MtCreatorManager.pack(mt191Creator);
//        if (mtResult.isSuccess())
//            System.out.println(mtResult.getMessage());
//        else
//            System.out.println(mtResult.getDsp());
        MtCreatorManager.packMT(mt191Creator);
    }

    @Test
    public void test_191_2()throws IllegalAccessException, NoSuchMethodException, InvocationTargetException {

        //52D
        ActnoBicAdrTagXXX actnoBicAdrTag52a=new ActnoBicAdrTagXXX("52");
        //actnoBicAdrTag52a.setInfo("A");
        actnoBicAdrTag52a.setAddress("WHYHCNHBXXX");
        //actnoBicAdrTag52a.setCode("");
        //actnoBicAdrTag52a.setBic("ASDFQW11");
        //actnoBicAdrTag52a.setAcctno("6226TEST0001");
        actnoBicAdrTag52a.setPartyIdentifier("1234-5678");
        //actnoBicAdrTag52a.setLocation("WHYHCNHBXXX");

        //57B
        ActnoBicAdrTagXXX actnoBicAdrTag57a=new ActnoBicAdrTagXXX("57");
        //actnoBicAdrTag57a.setInfo("A");
        //actnoBicAdrTag57a.setAddress("WHYHCNHBXXX");
        //actnoBicAdrTag57a.setCode("THISIS41A");
        //actnoBicAdrTag57a.setBic("ASDFQW11");
        //actnoBicAdrTag57a.setAcctno("6226TEST0001");
        actnoBicAdrTag57a.setPartyIdentifier("1234-5678");
        actnoBicAdrTag57a.setLocation("WHYHCNHBXXX");

        DcDateCurAmtTagXXX dcdatecuramt32B=new DcDateCurAmtTagXXX("32");
        //dcdatecuramt32B.setDate("990516");
        dcdatecuramt32B.setAmount(new BigDecimal("1000.00"));
        dcdatecuramt32B.setCurrency("USD");

        //构造参数传入MT报文类型
        MT191Creator mt191Creator=new MT191Creator("191");
        mt191Creator.setSendBic("PSBCCNBJXXX");
        mt191Creator.setRecvBic("CIPSCNSHXXX");
        mt191Creator.setTransactionReferenceNumber("RelatedReference");
        mt191Creator.setRelatedReference("RelatedReference");
        mt191Creator.setCurrencyCodeAmount32B(dcdatecuramt32B);
        mt191Creator.setDetailsofCharges("DetailsofCharges"+Constans.CRLF+"DetailsofCharges");
        mt191Creator.setSendertoReceiverInformation("SendertoReceiverInformation"+Constans.CRLF+"RelatedReference");
        mt191Creator.setAccountWithInstitution57a(actnoBicAdrTag57a);
        mt191Creator.setOrderingInstitution52a(actnoBicAdrTag52a);

        //String json = JsonUtil.toJson(map);

        /********以上为json参数**************/

//        MtResult mtResult = MtCreatorManager.pack(mt191Creator);
//        if (mtResult.isSuccess())
//            System.out.println(mtResult.getMessage());
//        else
//            System.out.println(mtResult.getDsp());
        MtCreatorManager.packMT(mt191Creator);
    }

    @Test
    public void test_191_3()throws IllegalAccessException, NoSuchMethodException, InvocationTargetException {

        //52D
        ActnoBicAdrTagXXX actnoBicAdrTag52a=new ActnoBicAdrTagXXX("52");
        //actnoBicAdrTag52a.setInfo("A");
        actnoBicAdrTag52a.setAddress("WHYHCNHBXXX");
        //actnoBicAdrTag52a.setCode("");
        //actnoBicAdrTag52a.setBic("ASDFQW11");
        //actnoBicAdrTag52a.setAcctno("6226TEST0001");
        actnoBicAdrTag52a.setPartyIdentifier("1234-5678");
        //actnoBicAdrTag52a.setLocation("WHYHCNHBXXX");

        //57D
        ActnoBicAdrTagXXX actnoBicAdrTag57a=new ActnoBicAdrTagXXX("57");
        //actnoBicAdrTag57a.setInfo("A");
        actnoBicAdrTag57a.setAddress("WHYHCNHBXXX");
        //actnoBicAdrTag57a.setCode("THISIS41A");
        //actnoBicAdrTag57a.setBic("ASDFQW11");
        //actnoBicAdrTag57a.setAcctno("6226TEST0001");
        actnoBicAdrTag57a.setPartyIdentifier("1234-5678");
        //actnoBicAdrTag57a.setLocation("WHYHCNHBXXX");

        DcDateCurAmtTagXXX dcdatecuramt32B=new DcDateCurAmtTagXXX("32");
        //dcdatecuramt32B.setDate("990516");
        dcdatecuramt32B.setAmount(new BigDecimal("1000.00"));
        dcdatecuramt32B.setCurrency("USD");

        //构造参数传入MT报文类型
        MT191Creator mt191Creator=new MT191Creator("191");
        mt191Creator.setSendBic("PSBCCNBJXXX");
        mt191Creator.setRecvBic("CIPSCNSHXXX");
        mt191Creator.setTransactionReferenceNumber("RelatedReference");
        mt191Creator.setRelatedReference("RelatedReference");
        mt191Creator.setCurrencyCodeAmount32B(dcdatecuramt32B);
        mt191Creator.setDetailsofCharges("DetailsofCharges"+Constans.CRLF+"DetailsofCharges");
        mt191Creator.setSendertoReceiverInformation("SendertoReceiverInformation"+Constans.CRLF+"RelatedReference");
        mt191Creator.setAccountWithInstitution57a(actnoBicAdrTag57a);
        mt191Creator.setOrderingInstitution52a(actnoBicAdrTag52a);

        //String json = JsonUtil.toJson(map);

        /********以上为json参数**************/

//        MtResult mtResult = MtCreatorManager.pack(mt191Creator);
//        if (mtResult.isSuccess())
//            System.out.println(mtResult.getMessage());
//        else
//            System.out.println(mtResult.getDsp());
        MtCreatorManager.packMT(mt191Creator);
    }
}
