package com.brilliance.isc.convert.mt1xx;

import com.brilliance.isc.swift.objmtconvert.manager.MtCreatorManager;
import com.brilliance.isc.swift.objmtconvert.model.mt1xx.MT198Creator;
import com.brilliance.isc.swift.objmtconvert.model.mt9xx.MT985Creator;
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.util.HashMap;
import java.util.Map;

public class Mt198Test {
    @Test
    public void mt198_Test()throws IllegalAccessException, NoSuchMethodException, InvocationTargetException {
//        Map map = new HashMap();
//        map.put("msgType", "198");//报文类型
//        map.put("recvBic","CIPSCNSHXXX");//收报行
//        map.put("sendBic","PSBCCNBJXXX");//发报行
//
//        //20
//        map.put("TransactionReferenceNumber","TransactionReferenceNumber");
//        //12
//        map.put("SubMessageType","123");
//        //77E
//        map.put("ProprietaryMessage","123"+ Constans.NEW_LINE+"456");
        //构造参数传入MT报文类型
        MT198Creator mt198Creator=new MT198Creator("198");
        mt198Creator.setSendBic("PSBCCNBJXXX");
        mt198Creator.setRecvBic("CIPSCNSHXXX");
        mt198Creator.setTransactionReferenceNumber("RelatedReference");
        mt198Creator.setSubMessageType("123");
        mt198Creator.setProprietaryMessage("123RelatedReference"+Constans.CRLF+"456RelatedReference");

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

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

        //MtResult mtResult = MtCreatorManager.packMt(json);
//        MtResult mtResult = MtCreatorManager.pack(mt198Creator);
//        if (mtResult.isSuccess())
//            System.out.println(mtResult.getMessage());
//        else
//            System.out.println(mtResult.getDsp());

        MtCreatorManager.packMT(mt198Creator);
    }
}
