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

import java.math.BigDecimal;

public class MT769Test {
    /**
     * @author gaosheng
     * @date 2023/3/2
     */
    @Test
    public void mt769_Test() {
        MT769Creator mt769Creator = new MT769Creator("769");//报文类型

        //33B
        DcDateCurAmtTagXXX amountReducedOrReleased = new DcDateCurAmtTagXXX("33");
        amountReducedOrReleased.setAmount(new BigDecimal("1000.00"));
        amountReducedOrReleased.setCurrency("USD");
        //34B
        DcDateCurAmtTagXXX amountOutstanding = new DcDateCurAmtTagXXX("34");
        amountOutstanding.setAmount(new BigDecimal("1000.00"));
        amountOutstanding.setCurrency("USD");

        //20
        mt769Creator.setTransactionReferenceNumber("2PG8761234");//16x
        //21
        mt769Creator.setRelatedReference("PG8761234");//16x
        //25
      //  mt769Creator.setAccountIdentification("wessswe");//16x
        //30
        mt769Creator.setDateOfReductionOrRelease("130112");
        //33B
        mt769Creator.setAmountReducedOrReleased(amountReducedOrReleased);
        //34B
        mt769Creator.setAmountOutstanding(amountOutstanding);//6*35z
        //39C
      //  mt769Creator.setAmountSpecification("sdafff");
        //33a
//        ActnoBicAdrTagXXX actnoBicAdrTag33a = new ActnoBicAdrTagXXX("33");
//        actnoBicAdrTag33a.setPartyIdentifier("ppo888p");
//        actnoBicAdrTag33a.setCode("aaaa");
//        actnoBicAdrTag33a.setBic("eeeee");
        DcDateCurAmtTagXXX amountOfCharges = new DcDateCurAmtTagXXX("32","769");
        amountOfCharges.setDate("150202");
        amountOfCharges.setAmount(new BigDecimal("1000.00"));
        amountOfCharges.setCurrency("USD");
        mt769Creator.setAmountOfCharges(amountOfCharges);//A or B
        //57a
        ActnoBicAdrTagXXX accountWithBank = new ActnoBicAdrTagXXX("57");
        accountWithBank.setPartyIdentifier("ppo888p");
        accountWithBank.setCode("aaaa");
        accountWithBank.setBic("TESTTE23");
        mt769Creator.setAccountWithBank(accountWithBank);//A, B, or D
        //71D
        mt769Creator.setDetailsOfCharges("/TELECHAR/USD21,\n" +
                " /COMM/USD14,");//6*35z
        //72Z
        mt769Creator.setSenderToReceiverInformation("/PHONEDOUBLE/USD21,\n" +
                " /COMM/USD14,\n" +
                "/TELECHAR/USD21,\n" +
                "/COMM/USD14,");//35*50z
        //23X
        mt769Creator.setFileIdentification("ASFD/,");

        MtResult mtResult = MtCreatorManager.packMT(mt769Creator);

    }
}