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

public class MT730Test {
    /**
     * @author wuzhe
     * @date 2023/2/28
     */
    @Test
    public void mt730_Test() {

        //构造参数传入MT报文类型
        MT730Creator mt730Creator=new MT730Creator("730");//报文类型
        mt730Creator.setRecvBic("OELBATWW");//收报行
        mt730Creator.setSendBic("AMRONL2A");//发报行
        //20 16x
        mt730Creator.setSenderReference("745322IMP");
        //21 16x
        mt730Creator.setReceiverReference("12345");
        //30 6!n
        mt730Creator.setDateofMessageBeingAcknowledged("120518");

        //非必选项
        //25 35x
        //mt730Creator.setAccountIdentification("123");
        //32a 32B
        DcDateCurAmtTagXXX amountofCharges = new DcDateCurAmtTagXXX("32","730");
        amountofCharges.setCurrency("EUR");//3!a
        amountofCharges.setAmount(new BigDecimal("320"));//15d
        //32D
        //amountofCharges.setCurrency("EUR");//3!a
        //amountofCharges.setAmount(new BigDecimal("111.1"));//15d
        //amountofCharges.setDate("230228");//6!n
        mt730Creator.setAmountofCharges(amountofCharges);//32a
        //57a 57A
        ActnoBicAdrTagXXX accountWithBank = new ActnoBicAdrTagXXX("57");
        accountWithBank.setPartyIdentifier("A");//[/1!a][/34x]
        accountWithBank.setBic("CABVATWW");//57A 4!a2!a2!c[3!c]
        //accountWithBank.setAddress("76057D");//57D 4*35x
        mt730Creator.setAccountWithBank(accountWithBank);//57a
        //71D 6*35z
        ActnoBicAdrTagXXX charges = new ActnoBicAdrTagXXX("71");
        charges.setNarrative("/COMM/EUR300,\r\n/CABLE/EUR20,");//6*35z
        mt730Creator.setCharges(charges);
        //72Z 6*35z
        ActnoBicAdrTagXXX sendertoReceiverInformation = new ActnoBicAdrTagXXX("72");
        sendertoReceiverInformation.setNarrative("WE ADDED OUR CONFIRMATION PLEASE\r\nPAY FOR ACCOUNT NUMBER 75016375\r\nAT CABVATWW");//6*35z
        mt730Creator.setSendertoReceiverInformation(sendertoReceiverInformation);
        mt730Creator.setNarrative("IYUKJTHRGF");//79Z 35*50z

        MtResult mtResult = MtCreatorManager.packMT(mt730Creator);
    }

    @Test
    public void mt730_Test2() {

        //构造参数传入MT报文类型
        MT730Creator mt730Creator=new MT730Creator("730");//报文类型
        mt730Creator.setRecvBic("OELBATWW");//收报行
        mt730Creator.setSendBic("AMRONL2A");//发报行
        //20 16x
        mt730Creator.setSenderReference("745322IMP");
        //21 16x
        mt730Creator.setReceiverReference("12345");
        //30 6!n
        mt730Creator.setDateofMessageBeingAcknowledged("120518");

        //非必选项
        //25 35x
        mt730Creator.setAccountIdentification("123");
        //32a 32D
        DcDateCurAmtTagXXX amountofCharges = new DcDateCurAmtTagXXX("32","730");
        amountofCharges.setCurrency("EUR");//3!a
        amountofCharges.setAmount(new BigDecimal("111.1"));//15d
        amountofCharges.setDate("230228");//6!n
        //32B
        //amountofCharges.setCurrency("EUR");//3!a
        //amountofCharges.setAmount(new BigDecimal("320"));//15d
        mt730Creator.setAmountofCharges(amountofCharges);//32a
        //57a 57D
        ActnoBicAdrTagXXX accountWithBank = new ActnoBicAdrTagXXX("57");
        accountWithBank.setPartyIdentifier("D");//[/1!a][/34x]
        //accountWithBank.setBic("CABVATWW");//57A 4!a2!a2!c[3!c]
        accountWithBank.setAddress("MT760\r\n57D");//57D 4*35x
        mt730Creator.setAccountWithBank(accountWithBank);//57a
        //71D 6*35z
        ActnoBicAdrTagXXX charges = new ActnoBicAdrTagXXX("71");
        charges.setNarrative("/COMM/EUR300,\r\n/CABLE/EUR20,");//6*35z
        mt730Creator.setCharges(charges);
        //72Z 6*35z
        ActnoBicAdrTagXXX sendertoReceiverInformation = new ActnoBicAdrTagXXX("72");
        sendertoReceiverInformation.setNarrative("WE ADDED OUR CONFIRMATION PLEASE\r\nPAY FOR ACCOUNT NUMBER 75016375\r\nAT CABVATWW");//6*35z
        mt730Creator.setSendertoReceiverInformation(sendertoReceiverInformation);
        mt730Creator.setNarrative("IYUKJTHRGF\r\nBEBDFV");//79Z 35*50z

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