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

import java.math.BigDecimal;

/**
 * @author huangmengyuan
 * @create 2023/2/28
 */
public class MT291Test {
    @Test
    public void mt291_Test(){
        MT291Creator mt291Creator = new MT291Creator("291");
        //20
        mt291Creator.setTransactionReferenceNumbe("OPLKBF");//16x
        //21
        mt291Creator.setRelatedReference("OKMN/LKIY");//16x
        //32B
        DcDateCurAmtTagXXX dcDateCurAmt32B = new DcDateCurAmtTagXXX("32");
        dcDateCurAmt32B.setCurrency("USD");
        dcDateCurAmt32B.setAmount(new BigDecimal("1000"));
        mt291Creator.setCurrencyCodeAmount(dcDateCurAmt32B);//3!a15d
        //52A 52D
        ActnoBicAdrTagXXX actnoBicAdr52a = new ActnoBicAdrTagXXX("52");
        actnoBicAdr52a.setBic("OLUNTFRD");
        mt291Creator.setOrderingInstitution(actnoBicAdr52a);//A,D
        //57A 57B 57D
        ActnoBicAdrTagXXX actnoBicAdr57a = new ActnoBicAdrTagXXX("57");
        actnoBicAdr57a.setLocation("PLIH/2561");
        mt291Creator.setAccountWithInstitution(actnoBicAdr57a);//A,B,D
        //71B
        mt291Creator.setDetailsofCharges("PLIULO\r\nOBRFD");//6*35x
        //72
        mt291Creator.setSendertoReceiverInformation("PLIULO\r\nOBPLOD");//6*35x
        MtCreatorManager.packMT(mt291Creator);
    }
    @Test
    public void mt291_Test2(){
        MT291Creator mt291Creator = new MT291Creator("291");
        //20
        mt291Creator.setTransactionReferenceNumbe("OPLKBF");//16x
        //21
        mt291Creator.setRelatedReference("OKMN/LKIY");//16x
        //32B
        DcDateCurAmtTagXXX dcDateCurAmt32B = new DcDateCurAmtTagXXX("32");
        dcDateCurAmt32B.setCurrency("USD");
        dcDateCurAmt32B.setAmount(new BigDecimal("1000"));
        mt291Creator.setCurrencyCodeAmount(dcDateCurAmt32B);//3!a15d
        //52A 52D
        ActnoBicAdrTagXXX actnoBicAdr52a = new ActnoBicAdrTagXXX("52");
        actnoBicAdr52a.setBic("OLUNTFRDKI");
        mt291Creator.setOrderingInstitution(actnoBicAdr52a);//A,D
        //57A 57B 57D
        ActnoBicAdrTagXXX actnoBicAdr57a = new ActnoBicAdrTagXXX("57");
        actnoBicAdr57a.setLocation("PLIH/2561\r\nKLKHKH");
        mt291Creator.setAccountWithInstitution(actnoBicAdr57a);//A,B,D
        //71B
        mt291Creator.setDetailsofCharges("PLIULO\r\nOBRFD");//6*35x
        //72
//        mt291Creator.setSendertoReceiverInformation("PLIULO\nOBPLOD");//6*35x
        MtCreatorManager.packMT(mt291Creator);
    }
}
