package com.brilliance.isc.convert.mt9xx;

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

import java.math.BigDecimal;
import java.util.*;

/**
 * @author zh
 * @create 2023-02-27-10:27
 */
public class MT950Test {
    @Test
    public void test_950(){
        MT950Creator mt950Creator = new MT950Creator("950");
        mt950Creator.setRecvBic("CIPSCNSHXXX");//收报行
        mt950Creator.setSendBic("PSBCCNBJXXX");//发报行
        //20
        mt950Creator.setTransactionReferenceNumber("6543216");
        //21
        mt950Creator.setRelatedReference("1234567891");
        //25
        ActnoBicAdrTagXXX accountIdentification=new ActnoBicAdrTagXXX("25");
        accountIdentification.setAcctno("1234567891");
        mt950Creator.setAccountIdentification(accountIdentification);
        //28C
        mt950Creator.setStatementSequenceNumber("851/1");
        //60 60F
        DcDateCurAmtTagXXX openingBalance = new DcDateCurAmtTagXXX("60");
        openingBalance.setDcMark("C");
        openingBalance.setDate("170928");
        openingBalance.setCurrency("USD");
        openingBalance.setAmount(new BigDecimal("28000.00"));
        mt950Creator.setOpeningBalance(openingBalance);

        //61
        List<String> list61 = new LinkedList<>();
        list61.add("1901300130C17,93NTRFCBBA A/C DATE   ");
        list61.add("1901300130C17,93NTRFCBBA A/C DATE   ");
        mt950Creator.setStatementLine(list61);
        //62 62F
        DcDateCurAmtTagXXX closingBalance = new DcDateCurAmtTagXXX("62");
        closingBalance.setDcMark("C");
        closingBalance.setDate("170928");
        closingBalance.setCurrency("USD");
        closingBalance.setAmount(new BigDecimal("81767.95"));
        mt950Creator.setClosingBalance(closingBalance);
        //64
        DcDateCurAmtTagXXX closingAvailableBalance = new DcDateCurAmtTagXXX("64");
        closingAvailableBalance.setDcMark("C");
        closingAvailableBalance.setDate("170928");
        closingAvailableBalance.setCurrency("USD");
        closingAvailableBalance.setAmount(new BigDecimal("81767.95"));
        mt950Creator.setClosingAvailableBalance(closingAvailableBalance);

        MtResult mtResult= MtCreatorManager.packMT(mt950Creator);
    }
    @Test
    public void test_950_2(){
        MT950Creator mt950Creator = new MT950Creator("950");
        mt950Creator.setRecvBic("CIPSCNSHXXX");//收报行
        mt950Creator.setSendBic("PSBCCNBJXXX");//发报行
        //20
        mt950Creator.setTransactionReferenceNumber("6543216");
        //21
        mt950Creator.setRelatedReference("1234567891");
        //25
        ActnoBicAdrTagXXX accountIdentification=new ActnoBicAdrTagXXX("25");
        accountIdentification.setAcctno("1234567891");
        accountIdentification.setBic("PSBCCNBJ");
        mt950Creator.setAccountIdentification(accountIdentification);
        //28C
        mt950Creator.setStatementSequenceNumber("851/1");
        //60 60M
        DcDateCurAmtTagXXX openingBalance = new DcDateCurAmtTagXXX("60");
        openingBalance.setSequenceNumber(3);
        openingBalance.setDcMark("C");
        openingBalance.setDate("170928");
        openingBalance.setCurrency("USD");
        openingBalance.setAmount(new BigDecimal("28000.00"));
        mt950Creator.setOpeningBalance(openingBalance);

        //61
        List<String> list61 = new LinkedList<>();
        list61.add("1901300130C17,93NTRFCBBA A/C DATE   ");
        list61.add("1901300130C17,93NTRFCBBA A/C DATE   ");
        mt950Creator.setStatementLine(list61);
        //62 62M
        DcDateCurAmtTagXXX closingBalance = new DcDateCurAmtTagXXX("62");
        closingBalance.setSequenceNumber(3);
        closingBalance.setDcMark("C");
        closingBalance.setDate("170928");
        closingBalance.setCurrency("USD");
        closingBalance.setAmount(new BigDecimal("81767.95"));
        mt950Creator.setClosingBalance(closingBalance);
        //64
        DcDateCurAmtTagXXX closingAvailableBalance = new DcDateCurAmtTagXXX("64");
        closingAvailableBalance.setDcMark("C");
        closingAvailableBalance.setDate("170928");
        closingAvailableBalance.setCurrency("USD");
        closingAvailableBalance.setAmount(new BigDecimal("81767.95"));
        mt950Creator.setClosingAvailableBalance(closingAvailableBalance);

        MtResult mtResult= MtCreatorManager.packMT(mt950Creator);
    }
    @Test
    public void test_950_3(){
        MT950Creator mt950Creator = new MT950Creator("950");
        mt950Creator.setRecvBic("CIPSCNSHXXX");//收报行
        mt950Creator.setSendBic("PSBCCNBJXXX");//发报行
        //20
        mt950Creator.setTransactionReferenceNumber("6543216");
        //21
        mt950Creator.setRelatedReference("1234567891");
        //25
        ActnoBicAdrTagXXX accountIdentification=new ActnoBicAdrTagXXX("25");
        accountIdentification.setAcctno("1234567891");
        mt950Creator.setAccountIdentification(accountIdentification);
        //28C
        mt950Creator.setStatementSequenceNumber("851/1");
        //60 60F
        DcDateCurAmtTagXXX openingBalance = new DcDateCurAmtTagXXX("60");
        openingBalance.setDcMark("CSADAS");
        openingBalance.setDate("170928");
        openingBalance.setCurrency("USDDAS");
        openingBalance.setAmount(new BigDecimal("28000.00"));
        mt950Creator.setOpeningBalance(openingBalance);

        //61
        List<String> list61 = new LinkedList<>();
        list61.add("1901300130C17,93NTRFCBBA A/C DATE   ");
        list61.add("1901300130C17,93NTRFCBBA A/C DATE   ");
        mt950Creator.setStatementLine(list61);
        //62 62F
        DcDateCurAmtTagXXX closingBalance = new DcDateCurAmtTagXXX("62");
        closingBalance.setDcMark("C");
        closingBalance.setDate("170928");
        closingBalance.setCurrency("USD");
        closingBalance.setAmount(new BigDecimal("81767.95"));
        mt950Creator.setClosingBalance(closingBalance);
        //64
        DcDateCurAmtTagXXX closingAvailableBalance = new DcDateCurAmtTagXXX("64");
        closingAvailableBalance.setDcMark("C");
        closingAvailableBalance.setDate("170928");
        closingAvailableBalance.setCurrency("USD");
        closingAvailableBalance.setAmount(new BigDecimal("81767.95"));
        mt950Creator.setClosingAvailableBalance(closingAvailableBalance);

        MtResult mtResult= MtCreatorManager.packMT(mt950Creator);
    }
    @Test
    public void test_950_4(){
        MT950Creator mt950Creator = new MT950Creator("950");
        mt950Creator.setRecvBic("CIPSCNSHXXX");//收报行
        mt950Creator.setSendBic("PSBCCNBJXXX");//发报行
        //20
        mt950Creator.setTransactionReferenceNumber("6543216");
        //21
        mt950Creator.setRelatedReference("1234567891");
        //25
        ActnoBicAdrTagXXX accountIdentification=new ActnoBicAdrTagXXX("25");
        accountIdentification.setAcctno("1234567891");
        mt950Creator.setAccountIdentification(accountIdentification);
        //28C
        mt950Creator.setStatementSequenceNumber("851/1");
        //60 60F
        DcDateCurAmtTagXXX openingBalance = new DcDateCurAmtTagXXX("60");
        openingBalance.setDcMark("C");
        openingBalance.setDate("170928");
        openingBalance.setCurrency("EUR");
        openingBalance.setAmount(new BigDecimal("28000.00"));
        mt950Creator.setOpeningBalance(openingBalance);

        //61
        List<String> list61 = new LinkedList<>();
        list61.add("1901300130C17,93NTRFCBBA A/C DATE   ");
        list61.add("1901300130C17,93NTRFCBBA A/C DATE   ");
        mt950Creator.setStatementLine(list61);
        //62 62F
        DcDateCurAmtTagXXX closingBalance = new DcDateCurAmtTagXXX("62");
        closingBalance.setDcMark("C");
        closingBalance.setDate("170928");
        closingBalance.setCurrency("USD");
        closingBalance.setAmount(new BigDecimal("81767.95"));
        mt950Creator.setClosingBalance(closingBalance);
        //64
        DcDateCurAmtTagXXX closingAvailableBalance = new DcDateCurAmtTagXXX("64");
        closingAvailableBalance.setDcMark("C");
        closingAvailableBalance.setDate("170928");
        closingAvailableBalance.setCurrency("EUR");
        closingAvailableBalance.setAmount(new BigDecimal("81767.95"));
        mt950Creator.setClosingAvailableBalance(closingAvailableBalance);

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