package com.brilliance.isc.convert.mt7xx;

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.mt7xx.MT768Creator;
import com.brilliance.isc.swift.objmtconvert.result.MtResult;
import org.junit.Test;
import java.math.BigDecimal;

public class MT768Test {
    /**
     * @author wuzhe
     * @date 2023/3/2
     */
    @Test
    public void mt768_Test() {
        //构造参数传入MT报文类型
        MT768Creator mt768Creator=new MT768Creator("768");//报文类型
        mt768Creator.setRecvBic("NWBKGB2L");//收报行
        mt768Creator.setSendBic("SBCOUS66");//发报行
        //20 16x
        mt768Creator.setTransactionReferenceNumber("1PG8761234");
        //21 16x
        mt768Creator.setRelatedReference("AG5559823");
        //30 6!n
        mt768Creator.setDateofMessageBeingAcknowledged("120515");

        //非必选项
        //25 35x
        mt768Creator.setAccountIdentification("EWRGTEF");
        //32a 32B
        DcDateCurAmtTagXXX amountofCharges = new DcDateCurAmtTagXXX("32","730");
        amountofCharges.setCurrency("EUR");//3!a
        amountofCharges.setAmount(new BigDecimal("111.1"));//15d
        //32D
        //amountofCharges.setCurrency("EUR");//3!a
        //amountofCharges.setAmount(new BigDecimal("111.1"));//15d
        //amountofCharges.setDate("230312");//6!n
        mt768Creator.setAmountofCharges(amountofCharges);//32a
        //57a 57A
        ActnoBicAdrTagXXX accountWithBank = new ActnoBicAdrTagXXX("57");
        accountWithBank.setPartyIdentifier("A");//[/1!a][/34x]
        accountWithBank.setBic("GEGSVVBJXXX");//57A 4!a2!a2!c[3!c]
        //accountWithBank.setLocation("EGHTRBD");//57B [35x]
        //accountWithBank.setAddress("MT760\r\n57D");//57D 4*35x
        //mt768Creator.setAccountWithBank(accountWithBank);//57a
        //71D 6*35z
        ActnoBicAdrTagXXX detailsofCharges = new ActnoBicAdrTagXXX("71");
        detailsofCharges.setNarrative("BTNRHGSF");//6*35z
        mt768Creator.setDetailsofCharges(detailsofCharges);
        //72Z 6*35z
        ActnoBicAdrTagXXX sendertoReceiverInformation = new ActnoBicAdrTagXXX("72");
        sendertoReceiverInformation.setNarrative("AMENDMENTS HAVE BEEN\r\nACCEPTED BY BENEFICIARY");//6*35z
        mt768Creator.setSendertoReceiverInformation(sendertoReceiverInformation);
        //23X 4!c/65x
        mt768Creator.setFileIdentification("ERET/454");


        MtResult mtResult = MtCreatorManager.packMT(mt768Creator);
    }

    @Test
    public void mt768_Test2() {
        //构造参数传入MT报文类型
        MT768Creator mt768Creator=new MT768Creator("768");//报文类型
        mt768Creator.setRecvBic("CIPSCNSHXXX");//收报行
        mt768Creator.setSendBic("PSBCCNBJXXX");//发报行
        //20 16x
        mt768Creator.setTransactionReferenceNumber("1PG8761234");
        //21 16x
        mt768Creator.setRelatedReference("AG5559823");
        //30 6!n
        mt768Creator.setDateofMessageBeingAcknowledged("120515");

        //非必选项
        //25 35x
        mt768Creator.setAccountIdentification("EWRGTEF");
        //32a 32D
        DcDateCurAmtTagXXX amountofCharges = new DcDateCurAmtTagXXX("32","730");
        amountofCharges.setCurrency("EUR");//3!a
        amountofCharges.setAmount(new BigDecimal("111.1"));//15d
        amountofCharges.setDate("230312");//6!n
        //32B
        //amountofCharges.setCurrency("EUR");//3!a
        //amountofCharges.setAmount(new BigDecimal("111.1"));//15d
        mt768Creator.setAmountofCharges(amountofCharges);//32a
        //57a 57B
        ActnoBicAdrTagXXX accountWithBank = new ActnoBicAdrTagXXX("57");
        accountWithBank.setPartyIdentifier("B");//[/1!a][/34x]
        //accountWithBank.setBic("GEGSVVBJXXX");//57A 4!a2!a2!c[3!c]
        accountWithBank.setLocation("EGHTRBD");//57B [35x]
        //accountWithBank.setAddress("MT760\r\n57D");//57D 4*35x
        mt768Creator.setAccountWithBank(accountWithBank);//57a
        //71D 6*35z
        ActnoBicAdrTagXXX detailsofCharges = new ActnoBicAdrTagXXX("71");
        detailsofCharges.setNarrative("BTNRHGSF");//6*35z
        mt768Creator.setDetailsofCharges(detailsofCharges);
        //72Z 6*35z
        ActnoBicAdrTagXXX sendertoReceiverInformation = new ActnoBicAdrTagXXX("72");
        sendertoReceiverInformation.setNarrative("AMENDMENTS HAVE BEEN\r\nACCEPTED BY BENEFICIARY");//6*35z
        mt768Creator.setSendertoReceiverInformation(sendertoReceiverInformation);
        //23X 4!c/65x
        mt768Creator.setFileIdentification("ERET/454");


        MtResult mtResult = MtCreatorManager.packMT(mt768Creator);
    }

    @Test
    public void mt768_Test3() {
        //构造参数传入MT报文类型
        MT768Creator mt768Creator=new MT768Creator("768");//报文类型
        mt768Creator.setRecvBic("CIPSCNSHXXX");//收报行
        mt768Creator.setSendBic("PSBCCNBJXXX");//发报行
        //20 16x
        mt768Creator.setTransactionReferenceNumber("1PG8761234");
        //21 16x
        mt768Creator.setRelatedReference("AG5559823");
        //30 6!n
        mt768Creator.setDateofMessageBeingAcknowledged("120515");

        //非必选项
        //25 35x
        mt768Creator.setAccountIdentification("EWRGTEF");
        //32a 32D
        DcDateCurAmtTagXXX amountofCharges = new DcDateCurAmtTagXXX("32","730");
        amountofCharges.setCurrency("EUR");//3!a
        amountofCharges.setAmount(new BigDecimal("111.1"));//15d
        amountofCharges.setDate("230312");//6!n
        //32B
        //amountofCharges.setCurrency("EUR");//3!a
        //amountofCharges.setAmount(new BigDecimal("111.1"));//15d
        mt768Creator.setAmountofCharges(amountofCharges);//32a
        //57a 57D
        ActnoBicAdrTagXXX accountWithBank = new ActnoBicAdrTagXXX("57");
        accountWithBank.setPartyIdentifier("B");//[/1!a][/34x]
        //accountWithBank.setBic("GEGSVVBJXXX");//57A 4!a2!a2!c[3!c]
        //accountWithBank.setLocation("EGHTRBD");//57B [35x]
        accountWithBank.setAddress("MT760\r\n57D");//57D 4*35x
        mt768Creator.setAccountWithBank(accountWithBank);//57a
        //71D 6*35z
        ActnoBicAdrTagXXX detailsofCharges = new ActnoBicAdrTagXXX("71");
        detailsofCharges.setNarrative("BTNRHGSF");//6*35z
        mt768Creator.setDetailsofCharges(detailsofCharges);
        //72Z 6*35z
        ActnoBicAdrTagXXX sendertoReceiverInformation = new ActnoBicAdrTagXXX("72");
        sendertoReceiverInformation.setNarrative("AMENDMENTS HAVE BEEN\r\nACCEPTED BY BENEFICIARY");//6*35z
        mt768Creator.setSendertoReceiverInformation(sendertoReceiverInformation);
        //23X 4!c/65x
        mt768Creator.setFileIdentification("ERET/454");


        MtResult mtResult = MtCreatorManager.packMT(mt768Creator);
    }
}