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.MT940Creator;
import com.brilliance.isc.swift.objmtconvert.model.mt9xx.mt9XXAbsCreator.MT940AbsCreator;
import com.brilliance.isc.swift.objmtconvert.result.MtResult;
import com.brilliance.isc.swift.objmtconvert.util.Constans;
import org.junit.Test;

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

/**
 * @author zh
 * @create 2023-02-27-10:27
 */
public class MT940Test {
    @Test
    public void test_940() {
        MT940Creator mt940Creator = new MT940Creator("940");
        //20
        mt940Creator.setTransactionReferenceNumber("654321");
        //21
        mt940Creator.setRelatedReference("1234567891");
        //25
        ActnoBicAdrTagXXX accountIdentification = new ActnoBicAdrTagXXX("25");
        accountIdentification.setAcctno("1234567891");
        mt940Creator.setAccountIdentification(accountIdentification);
        //28C
        mt940Creator.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"));
        mt940Creator.setOpeningBalance(openingBalance);
        //61,86
        List<MT940AbsCreator> mt940AbsCreators = new LinkedList<>();
        MT940AbsCreator mt940AbsCreator1 = new MT940AbsCreator();
        mt940AbsCreator1.setStatementLine("170929D546232,05S101PLTOL101-56//C11126A1378");
        mt940AbsCreators.add(mt940AbsCreator1);
        MT940AbsCreator mt940AbsCreator2 = new MT940AbsCreator();
        mt940AbsCreator2.setStatementLine("170929D546232,05S101PLTOL101-56//C11126A1378");
        mt940AbsCreator2.setInformationToAccountOwner("/ORDP/COMPUTERSYS INC." + Constans.NEW_LINE + "/REMI//INV/78541");
        mt940AbsCreators.add(mt940AbsCreator2);
        MT940AbsCreator mt940AbsCreator3 = new MT940AbsCreator();
        mt940AbsCreator3.setStatementLine("170929D100000,NFEXAAAAUS0369PLATUS//8954321");
        mt940AbsCreators.add(mt940AbsCreator3);
        MT940AbsCreator mt940AbsCreator4 = new MT940AbsCreator();
        mt940AbsCreator4.setStatementLine("170929C200000,NDIVNONREF//8846543");
        mt940AbsCreator4.setInformationToAccountOwner("DIVIDEND LORAL CORP" + Constans.NEW_LINE + "PREFERRED STOCK 3TH QUARTER 2017");
        mt940AbsCreators.add(mt940AbsCreator4);
        mt940Creator.setMt940AbsCreators(mt940AbsCreators);
        //62 62F
        DcDateCurAmtTagXXX closingBalance = new DcDateCurAmtTagXXX("62");
        closingBalance.setDcMark("C");
        closingBalance.setDate("170928");
        closingBalance.setCurrency("USD");
        closingBalance.setAmount(new BigDecimal("81767.95"));
        mt940Creator.setClosingBalance(closingBalance);
        //64
        DcDateCurAmtTagXXX closingAvailableBalance = new DcDateCurAmtTagXXX("64");
        closingAvailableBalance.setDcMark("C");
        closingAvailableBalance.setDate("170928");
        closingAvailableBalance.setCurrency("USD");
        closingAvailableBalance.setAmount(new BigDecimal("81767.95"));
        mt940Creator.setClosingAvailableBalance(closingAvailableBalance);
        //65
        List<DcDateCurAmtTagXXX> list65 = new ArrayList<>();
        DcDateCurAmtTagXXX forwardAvailableBalance = new DcDateCurAmtTagXXX("65");
        forwardAvailableBalance.setDcMark("C");
        forwardAvailableBalance.setDate("170928");
        forwardAvailableBalance.setCurrency("USD");
        forwardAvailableBalance.setAmount(new BigDecimal("81767.95"));
        list65.add(forwardAvailableBalance);
        list65.add(forwardAvailableBalance);
        mt940Creator.setForwardAvailableBalance(list65);
        mt940Creator.setInformationToAccountOwner("dsadad");

        MtResult mtResult = MtCreatorManager.packMT(mt940Creator);
    }
    @Test
    public void test_940_2() {
        MT940Creator mt940Creator = new MT940Creator("940");
        //20
        mt940Creator.setTransactionReferenceNumber("654321");
        //21
        mt940Creator.setRelatedReference("1234567891");
        //25
        ActnoBicAdrTagXXX accountIdentification = new ActnoBicAdrTagXXX("25");
        accountIdentification.setAcctno("1234567891");
        accountIdentification.setBic("PSBCCNBJ");
        mt940Creator.setAccountIdentification(accountIdentification);
        //28C
        mt940Creator.setStatementSequenceNumber("851");
        //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"));
        mt940Creator.setOpeningBalance(openingBalance);
        //61,86
        List<MT940AbsCreator> mt940AbsCreators = new LinkedList<>();
        MT940AbsCreator mt940AbsCreator1 = new MT940AbsCreator();
        mt940AbsCreator1.setStatementLine("170929D546232,05S101PLTOL101-56//C11126A1378");
        mt940AbsCreators.add(mt940AbsCreator1);
        mt940Creator.setMt940AbsCreators(mt940AbsCreators);
        //62 62M
        DcDateCurAmtTagXXX closingBalance = new DcDateCurAmtTagXXX("62");
        closingBalance.setSequenceNumber(4);
        closingBalance.setDcMark("C");
        closingBalance.setDate("170928");
        closingBalance.setCurrency("USD");
        closingBalance.setAmount(new BigDecimal("81767.95"));
        mt940Creator.setClosingBalance(closingBalance);
        //64
        DcDateCurAmtTagXXX closingAvailableBalance = new DcDateCurAmtTagXXX("64");
        closingAvailableBalance.setDcMark("C");
        closingAvailableBalance.setDate("170928");
        closingAvailableBalance.setCurrency("USD");
        closingAvailableBalance.setAmount(new BigDecimal("81767.95"));
        mt940Creator.setClosingAvailableBalance(closingAvailableBalance);
        //65
        List<DcDateCurAmtTagXXX> list65 = new ArrayList<>();
        DcDateCurAmtTagXXX forwardAvailableBalance = new DcDateCurAmtTagXXX("65");
        forwardAvailableBalance.setDcMark("C");
        forwardAvailableBalance.setDate("170928");
        forwardAvailableBalance.setCurrency("USD");
        forwardAvailableBalance.setAmount(new BigDecimal("81767.95"));
        list65.add(forwardAvailableBalance);
        list65.add(forwardAvailableBalance);
        mt940Creator.setForwardAvailableBalance(list65);
        mt940Creator.setInformationToAccountOwner("dsadad");

        MtResult mtResult = MtCreatorManager.packMT(mt940Creator);
    }
    @Test
    public void test_940_3() {
        MT940Creator mt940Creator = new MT940Creator("940");
        //20
        mt940Creator.setTransactionReferenceNumber("654321");
        //21
        mt940Creator.setRelatedReference("1234567891");
        //25
        ActnoBicAdrTagXXX accountIdentification = new ActnoBicAdrTagXXX("25");
        accountIdentification.setAcctno("1234567891");
        accountIdentification.setBic("PSBCCNBJ");
        mt940Creator.setAccountIdentification(accountIdentification);
        //28C
        mt940Creator.setStatementSequenceNumber("851");
        //60 60M
        DcDateCurAmtTagXXX openingBalance = new DcDateCurAmtTagXXX("60");
        openingBalance.setSequenceNumber(3);
        openingBalance.setDcMark("CDAD");
        openingBalance.setDate("170928AAA");
        openingBalance.setCurrency("USDDAD");
        openingBalance.setAmount(new BigDecimal("28000.00"));
        mt940Creator.setOpeningBalance(openingBalance);
        //61,86
        List<MT940AbsCreator> mt940AbsCreators = new LinkedList<>();
        MT940AbsCreator mt940AbsCreator1 = new MT940AbsCreator();
        mt940AbsCreator1.setStatementLine("170929D546232,05S101PLTOL101-56//C11126A1378");
        mt940AbsCreators.add(mt940AbsCreator1);
        mt940Creator.setMt940AbsCreators(mt940AbsCreators);
        //62 62M
        DcDateCurAmtTagXXX closingBalance = new DcDateCurAmtTagXXX("62");
        closingBalance.setSequenceNumber(4);
        closingBalance.setDcMark("C");
        closingBalance.setDate("170928");
        closingBalance.setCurrency("USD");
        closingBalance.setAmount(new BigDecimal("81767.95"));
        mt940Creator.setClosingBalance(closingBalance);
        //64
        DcDateCurAmtTagXXX closingAvailableBalance = new DcDateCurAmtTagXXX("64");
        closingAvailableBalance.setDcMark("C");
        closingAvailableBalance.setDate("170928");
        closingAvailableBalance.setCurrency("USD");
        closingAvailableBalance.setAmount(new BigDecimal("81767.95"));
        mt940Creator.setClosingAvailableBalance(closingAvailableBalance);
        //65
        List<DcDateCurAmtTagXXX> list65 = new ArrayList<>();
        DcDateCurAmtTagXXX forwardAvailableBalance = new DcDateCurAmtTagXXX("65");
        forwardAvailableBalance.setDcMark("C");
        forwardAvailableBalance.setDate("170928");
        forwardAvailableBalance.setCurrency("USD");
        forwardAvailableBalance.setAmount(new BigDecimal("81767.95"));
        list65.add(forwardAvailableBalance);
        list65.add(forwardAvailableBalance);
        mt940Creator.setForwardAvailableBalance(list65);
        mt940Creator.setInformationToAccountOwner("dsadad");

        MtResult mtResult = MtCreatorManager.packMT(mt940Creator);
    }
    @Test
    public void test_940_4() {
        MT940Creator mt940Creator = new MT940Creator("940");
        //20
        mt940Creator.setTransactionReferenceNumber("654321");
        //21
        mt940Creator.setRelatedReference("1234567891");
        //25
        ActnoBicAdrTagXXX accountIdentification = new ActnoBicAdrTagXXX("25");
        accountIdentification.setAcctno("1234567891");
        accountIdentification.setBic("PSBCCNBJ");
        mt940Creator.setAccountIdentification(accountIdentification);
        //28C
        mt940Creator.setStatementSequenceNumber("851");
        //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"));
        mt940Creator.setOpeningBalance(openingBalance);
        //61,86
        List<MT940AbsCreator> mt940AbsCreators = new LinkedList<>();
        MT940AbsCreator mt940AbsCreator1 = new MT940AbsCreator();
        mt940AbsCreator1.setStatementLine("170929D546232,05S101PLTOL101-56//C11126A1378");
        mt940AbsCreators.add(mt940AbsCreator1);
        mt940Creator.setMt940AbsCreators(mt940AbsCreators);
        //62 62M
        DcDateCurAmtTagXXX closingBalance = new DcDateCurAmtTagXXX("62");
        closingBalance.setSequenceNumber(4);
        closingBalance.setDcMark("C");
        closingBalance.setDate("170928");
        closingBalance.setCurrency("USD");
        closingBalance.setAmount(new BigDecimal("81767.95"));
        mt940Creator.setClosingBalance(closingBalance);
        //64
        DcDateCurAmtTagXXX closingAvailableBalance = new DcDateCurAmtTagXXX("64");
        closingAvailableBalance.setDcMark("C");
        closingAvailableBalance.setDate("170928");
        closingAvailableBalance.setCurrency("EUR");
        closingAvailableBalance.setAmount(new BigDecimal("81767.95"));
        mt940Creator.setClosingAvailableBalance(closingAvailableBalance);
        //65
        List<DcDateCurAmtTagXXX> list65 = new ArrayList<>();
        DcDateCurAmtTagXXX forwardAvailableBalance = new DcDateCurAmtTagXXX("65");
        forwardAvailableBalance.setDcMark("C");
        forwardAvailableBalance.setDate("170928");
        forwardAvailableBalance.setCurrency("USD");
        forwardAvailableBalance.setAmount(new BigDecimal("81767.95"));
        list65.add(forwardAvailableBalance);
        list65.add(forwardAvailableBalance);
        mt940Creator.setForwardAvailableBalance(list65);
        mt940Creator.setInformationToAccountOwner("dsadad");

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

