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

public class MT747Test {
    /**
     * @author wuzhe
     * @date 2023/2/28
     */
    @Test
    public void mt747_Test() {
        //构造参数传入MT报文类型
        MT747Creator mt747Creator=new MT747Creator("747");//报文类型
        mt747Creator.setRecvBic("MAHAUS33");//收报行
        mt747Creator.setSendBic("ESSESESS");//发报行
        //20 16X
        mt747Creator.setDocumentaryCreditNumber("DC.IMP 3410/3444");
        //30 6!n
        mt747Creator.setDateoftheOriginalAuthorisationtoReimburse("130517");

        //非必选项
        //21 16x
        mt747Creator.setReimbursingBankReference("NBVDSCE");
        //31E 6!n
        mt747Creator.setNewDateofExpiry("130930");
        //32B 3!a15d
        DcDateCurAmtTagXXX increaseofDocumentaryCreditAmount = new DcDateCurAmtTagXXX("32");
        increaseofDocumentaryCreditAmount.setCurrency("USD");//3!a
        increaseofDocumentaryCreditAmount.setAmount(new BigDecimal("3250"));//15d
        mt747Creator.setIncreaseofDocumentaryCreditAmount(increaseofDocumentaryCreditAmount);//32B 3!a15d
        //33B 3!a15d
        DcDateCurAmtTagXXX decreaseofDocumentaryCreditAmount = new DcDateCurAmtTagXXX("33");
        decreaseofDocumentaryCreditAmount.setCurrency("USD");//3!a
        decreaseofDocumentaryCreditAmount.setAmount(new BigDecimal("16754"));//15d
        mt747Creator.setDecreaseofDocumentaryCreditAmount(decreaseofDocumentaryCreditAmount);//33B 3!a15d
        //34B 3!a15d
        DcDateCurAmtTagXXX newDocumentaryCreditAmountAfterAmendment = new DcDateCurAmtTagXXX("34");
        newDocumentaryCreditAmountAfterAmendment.setCurrency("USD");//3!a
        newDocumentaryCreditAmountAfterAmendment.setAmount(new BigDecimal("34750"));//15d
        mt747Creator.setNewDocumentaryCreditAmountAfterAmendment(newDocumentaryCreditAmountAfterAmendment);//34B 3!a15d
        //39A 2n/2n
        mt747Creator.setPercentageCreditAmountTolerance("20/22");
        //39C 2n/2n
        mt747Creator.setAdditionalAmountsCovered("37/39");
        //72Z 6*35z
        ActnoBicAdrTagXXX sendertoReceiverInformation = new ActnoBicAdrTagXXX("72");
        sendertoReceiverInformation.setNarrative("REJGIOEE\r\nMNFBDV");
        mt747Creator.setSendertoReceiverInformation(sendertoReceiverInformation);//72Z 6*35z
        mt747Creator.setNarrative("BTRBD\r\nBRBDF\r\nVRGB\r\nVSSV");//77 6*35z

        MtResult mtResult = MtCreatorManager.packMT(mt747Creator);
    }

    @Test
    public void mt747_Test2() {
        //构造参数传入MT报文类型
        MT747Creator mt747Creator=new MT747Creator("747");//报文类型
        mt747Creator.setRecvBic("MAHAUS33");//收报行
        mt747Creator.setSendBic("ESSESESS");//发报行
        //20 16X
        mt747Creator.setDocumentaryCreditNumber("DC.IMP 3410/3444");
        //30 6!n
        mt747Creator.setDateoftheOriginalAuthorisationtoReimburse("130517");

        //非必选项
        //21 16x
        mt747Creator.setReimbursingBankReference("NBVDSCE");
        //31E 6!n
        mt747Creator.setNewDateofExpiry("130930");
        //32B 3!a15d
        DcDateCurAmtTagXXX increaseofDocumentaryCreditAmount = new DcDateCurAmtTagXXX("32");
        increaseofDocumentaryCreditAmount.setCurrency("USD");//3!a
        increaseofDocumentaryCreditAmount.setAmount(new BigDecimal("3250"));//15d
        mt747Creator.setIncreaseofDocumentaryCreditAmount(increaseofDocumentaryCreditAmount);//32B 3!a15d
        //33B 3!a15d
        DcDateCurAmtTagXXX decreaseofDocumentaryCreditAmount = new DcDateCurAmtTagXXX("33");
        decreaseofDocumentaryCreditAmount.setCurrency("EUR");//3!a
        decreaseofDocumentaryCreditAmount.setAmount(new BigDecimal("16754"));//15d
        mt747Creator.setDecreaseofDocumentaryCreditAmount(decreaseofDocumentaryCreditAmount);//33B 3!a15d
        //34B 3!a15d
        DcDateCurAmtTagXXX newDocumentaryCreditAmountAfterAmendment = new DcDateCurAmtTagXXX("34");
        newDocumentaryCreditAmountAfterAmendment.setCurrency("USD");//3!a
        newDocumentaryCreditAmountAfterAmendment.setAmount(new BigDecimal("34750"));//15d
        mt747Creator.setNewDocumentaryCreditAmountAfterAmendment(newDocumentaryCreditAmountAfterAmendment);//34B 3!a15d
        //39A 2n/2n
        mt747Creator.setPercentageCreditAmountTolerance("20/22");
        //39C 2n/2n
        mt747Creator.setAdditionalAmountsCovered("37/39");
        //72Z 6*35z
        ActnoBicAdrTagXXX sendertoReceiverInformation = new ActnoBicAdrTagXXX("72");
        sendertoReceiverInformation.setNarrative("REJGIOEE\r\nMNFBDV");//6*35z
        mt747Creator.setSendertoReceiverInformation(sendertoReceiverInformation);//72Z
        mt747Creator.setNarrative("BTRBD\r\nBRBDF\r\nVRGB\r\nVSSV");//77 6*35z

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