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.MT201Creator;
import com.brilliance.isc.swift.objmtconvert.model.mt2xx.MT290Creator;
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;

/**
 * @Description：
 * @Author：夏猛
 * @CreateTime：2023/2/28 10:29
 **/
public class MT290Test {
    @Test
    public void mt290_Test() throws IllegalAccessException, NoSuchMethodException, InvocationTargetException {
        //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");

        //构造参数传入MT报文类型
        MT290Creator mt290Creator = new MT290Creator("290");
        mt290Creator.setSendBic("PSBCCNBJXXX");  //接收
        mt290Creator.setRecvBic("CIPSCNSHXXX");   //发送

        mt290Creator.setTransactionReferenceNumber("111111"); //20 16x
        mt290Creator.setRelatedReference("222222"); //21 16x
        mt290Creator.setAccountIdentification("111111"); //25 35x
        //32D 6!n3!a15d
        DcDateCurAmtTagXXX dcDateCurAmtTag32D = new DcDateCurAmtTagXXX("32","290");
        dcDateCurAmtTag32D.setCurrency("CON");//3!a
        dcDateCurAmtTag32D.setAmount(new BigDecimal("100"));//15d
        dcDateCurAmtTag32D.setDate("202302");
        mt290Creator.setValueDateCurrencyCodeAmount(dcDateCurAmtTag32D);

        mt290Creator.setOrderingInstitution(actnoBicAdrTag52a);  //52a
        mt290Creator.setDetailsofCharges("710001"+ Constans.CRLF+"RemittanceInformation"); //71B  6*35x
        mt290Creator.setSendertoReceiverInformation("720001"+ Constans.CRLF+"RemittanceInformation"); //72  6*35x

        MtCreatorManager.packMT(mt290Creator);
    }

    @Test
    public void mt29002_Test() throws IllegalAccessException, NoSuchMethodException, InvocationTargetException {
        //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");
        
        //构造参数传入MT报文类型
        MT290Creator mt290Creator = new MT290Creator("290");
        mt290Creator.setSendBic("PSBCCNBJXXX");  //接收
        mt290Creator.setRecvBic("CIPSCNSHXXX");   //发送

        mt290Creator.setTransactionReferenceNumber("info"); //20 16x
        mt290Creator.setRelatedReference("info"); //21 16x
        mt290Creator.setAccountIdentification("info"); //25 35x

        //32D 6!n3!a15d
        DcDateCurAmtTagXXX dcDateCurAmtTag32D = new DcDateCurAmtTagXXX("32","290");
        dcDateCurAmtTag32D.setCurrency("CON");//3!a
        dcDateCurAmtTag32D.setAmount(new BigDecimal("100"));//15d
        dcDateCurAmtTag32D.setDate("202302");
        mt290Creator.setValueDateCurrencyCodeAmount(dcDateCurAmtTag32D);

     //   mt290Creator.setValueDateCurrencyCodeAmount(new BigDecimal("100"));  //32D 	 6!n3!a15d

        mt290Creator.setOrderingInstitution(actnoBicAdrTag52a);  //52a
        mt290Creator.setDetailsofCharges("info"+ Constans.CRLF+"RemittanceInformation"); //71B  6*35x
        mt290Creator.setSendertoReceiverInformation("info"+ Constans.CRLF+"RemittanceInformation"); //72  6*35x

        MtCreatorManager.packMT(mt290Creator);
    }
}
