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.MT112Creator;
import com.brilliance.isc.swift.objmtconvert.model.mt1xx.MT191Creator;
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 Mt112Test {
    @Test
    public void mt112_Test()throws IllegalAccessException, NoSuchMethodException, InvocationTargetException {

        //32B
        DcDateCurAmtTagXXX dcdatecuramt32a=new DcDateCurAmtTagXXX("32");
        //dcdatecuramt32a.setDate("990516");
        dcdatecuramt32a.setAmount(new BigDecimal("1000.00"));
        dcdatecuramt32a.setCurrency("USD");
        //52D
        ActnoBicAdrTagXXX actnoBicAdrTag52a=new ActnoBicAdrTagXXX("52");
        //actnoBicAdrTag52a.setInfo("A");
        actnoBicAdrTag52a.setAddress("WHYHCNHBXXX");
        //actnoBicAdrTag52a.setCode("THISIS41A");
        //actnoBicAdrTag52a.setBic("ASDFQW11");
        //actnoBicAdrTag52a.setAcctno("6226TEST0001");
        actnoBicAdrTag52a.setPartyIdentifier("1234-5678");
        //actnoBicAdrTag52a.setLocation("WHYHCNHBXXX");

        ActnoBicAdrTagXXX actnoBicAdrTag59=new ActnoBicAdrTagXXX("59");
        //actnoBicAdrTag59.setInfo("A");
        actnoBicAdrTag59.setAddress("WHYHCNHBXXX"+ Constans.CRLF+"dawdsa456");
        //actnoBicAdrTag59.setCode("THISIS41A");
        //actnoBicAdrTag59.setBic("ASDFQW11");
        actnoBicAdrTag59.setAcctno("6226TEST0001");
        //actnoBicAdrTag59.setPartyIdentifier("1234-5678");
        //actnoBicAdrTag59.setLocation("WHYHCNHBXXX");


        //构造参数传入MT报文类型
        MT112Creator mt112Creator=new MT112Creator("112");
        mt112Creator.setSendBic("PSBCCNBJXXX");
        mt112Creator.setRecvBic("CIPSCNSHXXX");
        mt112Creator.setTransactionReferenceNumber("ChequeNumber");
        mt112Creator.setChequeNumber("ChequeNumber");
        mt112Creator.setDateofIssue("230310");
        mt112Creator.setPayee59(actnoBicAdrTag59);
        mt112Creator.setAnswers("Answers"+ Constans.CRLF+"ChequeNumberAnswers");
        mt112Creator.setAmount32a(dcdatecuramt32a);
        mt112Creator.setDrawerBank52a(actnoBicAdrTag52a);


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

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

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

        MtCreatorManager.packMT(mt112Creator);
    }

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

        //32A
        DcDateCurAmtTagXXX dcdatecuramt32a=new DcDateCurAmtTagXXX("32");
        dcdatecuramt32a.setDate("990516");
        dcdatecuramt32a.setAmount(new BigDecimal("1000.00"));
        dcdatecuramt32a.setCurrency("USD");
        //52A
        ActnoBicAdrTagXXX actnoBicAdrTag52a=new ActnoBicAdrTagXXX("52");
        //actnoBicAdrTag52a.setInfo("A");
        //actnoBicAdrTag52a.setAddress("WHYHCNHBXXX");
        //actnoBicAdrTag52a.setCode("THISIS41A");
        actnoBicAdrTag52a.setBic("ASDFQW11");
        //actnoBicAdrTag52a.setAcctno("6226TEST0001");
        actnoBicAdrTag52a.setPartyIdentifier("1234-5678");
        //actnoBicAdrTag52a.setLocation("WHYHCNHBXXX");

        ActnoBicAdrTagXXX actnoBicAdrTag59=new ActnoBicAdrTagXXX("59");
        //actnoBicAdrTag59.setInfo("A");
        actnoBicAdrTag59.setAddress("WHYHCNHBXXX"+ Constans.CRLF+"dawdsa456");
        //actnoBicAdrTag59.setCode("THISIS41A");
        //actnoBicAdrTag59.setBic("ASDFQW11");
        actnoBicAdrTag59.setAcctno("6226TEST0001");
        //actnoBicAdrTag59.setPartyIdentifier("1234-5678");
        //actnoBicAdrTag59.setLocation("WHYHCNHBXXX");


        //构造参数传入MT报文类型
        MT112Creator mt112Creator=new MT112Creator("112");
        mt112Creator.setSendBic("PSBCCNBJXXX");
        mt112Creator.setRecvBic("CIPSCNSHXXX");
        mt112Creator.setTransactionReferenceNumber("ChequeNumber");
        mt112Creator.setChequeNumber("ChequeNumber");
        mt112Creator.setDateofIssue("230310");
        mt112Creator.setPayee59(actnoBicAdrTag59);
        mt112Creator.setAnswers("Answers"+ Constans.CRLF+"ChequeNumberAnswers");
        mt112Creator.setAmount32a(dcdatecuramt32a);
        mt112Creator.setDrawerBank52a(actnoBicAdrTag52a);


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

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

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

        MtCreatorManager.packMT(mt112Creator);
    }

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

        //32A
        DcDateCurAmtTagXXX dcdatecuramt32a=new DcDateCurAmtTagXXX("32");
        dcdatecuramt32a.setDate("990516");
        dcdatecuramt32a.setAmount(new BigDecimal("1000.00"));
        dcdatecuramt32a.setCurrency("USD");
        //52B
        ActnoBicAdrTagXXX actnoBicAdrTag52a=new ActnoBicAdrTagXXX("52");
        //actnoBicAdrTag52a.setInfo("A");
        //actnoBicAdrTag52a.setAddress("WHYHCNHBXXX");
        //actnoBicAdrTag52a.setCode("THISIS41A");
        //actnoBicAdrTag52a.setBic("ASDFQW11");
        //actnoBicAdrTag52a.setAcctno("6226TEST0001");
        actnoBicAdrTag52a.setPartyIdentifier("1234-5678");
        actnoBicAdrTag52a.setLocation("WHYHCNHBXXX");

        ActnoBicAdrTagXXX actnoBicAdrTag59=new ActnoBicAdrTagXXX("59");
        //actnoBicAdrTag59.setInfo("A");
        actnoBicAdrTag59.setAddress("WHYHCNHBXXX"+ Constans.CRLF+"dawdsa456");
        //actnoBicAdrTag59.setCode("THISIS41A");
        //actnoBicAdrTag59.setBic("ASDFQW11");
        actnoBicAdrTag59.setAcctno("6226TEST0001");
        //actnoBicAdrTag59.setPartyIdentifier("1234-5678");
        //actnoBicAdrTag59.setLocation("WHYHCNHBXXX");


        //构造参数传入MT报文类型
        MT112Creator mt112Creator=new MT112Creator("112");
        mt112Creator.setSendBic("PSBCCNBJXXX");
        mt112Creator.setRecvBic("CIPSCNSHXXX");
        mt112Creator.setTransactionReferenceNumber("ChequeNumber");
        mt112Creator.setChequeNumber("ChequeNumber");
        mt112Creator.setDateofIssue("230310");
        mt112Creator.setPayee59(actnoBicAdrTag59);
        mt112Creator.setAnswers("Answers"+ Constans.CRLF+"ChequeNumberAnswers");
        mt112Creator.setAmount32a(dcdatecuramt32a);
        mt112Creator.setDrawerBank52a(actnoBicAdrTag52a);


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

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

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

        MtCreatorManager.packMT(mt112Creator);
    }





}
