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

import java.math.BigDecimal;

public class MT752Test {
    /**
     * @author gaosheng
     * @date 2023/3/2
     */
    @Test
    public void mt752_Test() {

        MT752Creator mt752Creator = new MT752Creator("752");//报文类型

        //20
        mt752Creator.setDocumentaryCreditNumber("EXP98734");//16x
        //21
        mt752Creator.setPresentingBanksReference("DC.IMP 3410/3444");//16x
        //23
        mt752Creator.setFurtherIdentification("PD.IMP 3410/3444");//16x
        //30
        mt752Creator.setDateofAdviceofDiscrepancyorMailing("130517");//6!n
        //32B
        DcDateCurAmtTagXXX totalAmountAdvised = new DcDateCurAmtTagXXX("32");
        totalAmountAdvised.setCurrency("AOP");
        totalAmountAdvised.setAmount(new BigDecimal("123.22"));
        mt752Creator.setTotalAmountAdvised(totalAmountAdvised);//A or B
        //71D
        mt752Creator.setChargesDeducted("FOUR (3) COMMERCIAL INVOICES\n"+
                "NSTEAD OF FIVE (5) PRESENTED");//6*35z
        //33a
        DcDateCurAmtTagXXX netAmount = new DcDateCurAmtTagXXX("33");
        netAmount.setDate("202321");
        netAmount.setCurrency("AOP");
        netAmount.setAmount(new BigDecimal("123.22"));
        mt752Creator.setNetAmount(netAmount);//A or B
        //53a
        ActnoBicAdrTagXXX sendersCorrespondent = new ActnoBicAdrTagXXX("53");
        sendersCorrespondent.setPartyIdentifier("ppo888p");
        sendersCorrespondent.setCode("aaaa");
        sendersCorrespondent.setBic("TESTTE23");
        mt752Creator.setSendersCorrespondent(sendersCorrespondent);//A, B, or D
        //54a
        ActnoBicAdrTagXXX receiversCorrespondent = new ActnoBicAdrTagXXX("54");
        receiversCorrespondent.setPartyIdentifier("A");
        receiversCorrespondent.setCode("aaaa");
        receiversCorrespondent.setBic("TESTTE23");
        mt752Creator.setReceiversCorrespondent(receiversCorrespondent);//A, B, or D
        //72Z
        mt752Creator.setSendertoReceiverInformation("/COMM/USD36,");//6*35z
        //79Z
        mt752Creator.setNarrative("THREE (3) COMMERCIAL INVOICES\n" +
                " INSTEAD OF FIVE (5) PRESENTED");//35*50z
        MtResult mtResult= MtCreatorManager.packMT(mt752Creator);
    }
}