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

public class MT742Test {
    /**
     * @author wuzhe
     * @date 2023/3/1
     */
    @Test
    public void mt742_Test() {
        MT742Creator mt742Creator=new MT742Creator("742");
        mt742Creator.setRecvBic("CHEMDEFF");//收报行
        mt742Creator.setSendBic("DEUTDEMMA");//发报行
        //20 16x
        mt742Creator.setClaimingBankReference("CL934372");
        //21 16x
        mt742Creator.setDocumentaryCreditNumber("IMP 693/70224");
        //52a 52A
        ActnoBicAdrTagXXX issuingBank = new ActnoBicAdrTagXXX("52");
        issuingBank.setPartyIdentifier("A");//[/1!a][/34x]
        issuingBank.setBic("CHEMUS33");//52A 4!a2!a2!c[3!c]
        //issuingBank.setAddress("DSFGBES");//52D 4*35x
        mt742Creator.setIssuingBank(issuingBank);
        //32B 3!a15d
        DcDateCurAmtTagXXX principalAmountClaimed = new DcDateCurAmtTagXXX("32");
        principalAmountClaimed.setCurrency("EUR");//3!a
        principalAmountClaimed.setAmount(new BigDecimal("95000"));//15d
        mt742Creator.setPrincipalAmountClaimed(principalAmountClaimed);
        //34a 34A
        DcDateCurAmtTagXXX totalAmountClaimed = new DcDateCurAmtTagXXX("34","742");
        totalAmountClaimed.setCurrency("EUR");//3!a
        totalAmountClaimed.setDate("230301");//6!n
        totalAmountClaimed.setAmount(new BigDecimal("111.1"));//15d
        //34B
        //totalAmountClaimed.setCurrency("EUR");//3!a
        //totalAmountClaimed.setAmount(new BigDecimal("95200"));//15d
        mt742Creator.setTotalAmountClaimed(totalAmountClaimed);//34a

        //非必选项
        //31C 6!n
        mt742Creator.setDateofIssue("130607");
        //33B 3!a15d
        DcDateCurAmtTagXXX additionalAmountClaimed = new DcDateCurAmtTagXXX("33");
        additionalAmountClaimed.setCurrency("CUA");//3!a
        additionalAmountClaimed.setAmount(new BigDecimal("2321.09"));//15d
        mt742Creator.setAdditionalAmountClaimed(additionalAmountClaimed);//33B
        //71D 6*35z
        ActnoBicAdrTagXXX charges = new ActnoBicAdrTagXXX("71");
        charges.setNarrative("/COMM/EUR200");//6*35z
        mt742Creator.setCharges(charges);//71D
        //57a 57A
        ActnoBicAdrTagXXX accountWithBank = new ActnoBicAdrTagXXX("57");
        accountWithBank.setPartyIdentifier("A");//[/1!a][/34x]
        accountWithBank.setBic("DEUTDEFF");//57A 4!a2!a2!c[3!c]
        //accountWithBank.setLocation("MT74257B");//57B [35x]
        //accountWithBank.setAddress("MT742\r\n57D");//57D 4*35x
        mt742Creator.setAccountWithBank(accountWithBank);//57a
        //58a 58A
        ActnoBicAdrTagXXX beneficiaryBank = new ActnoBicAdrTagXXX("58");
        beneficiaryBank.setPartyIdentifier("/700-373473");//[/1!a][/34x]
        beneficiaryBank.setBic("DEUTDEMM");//58A 4!a2!a2!c[3!c]
        //beneficiaryBank.setAddress("MTRTDV\r\nMT742\r\n58D");//58D 4*35x
        mt742Creator.setBeneficiaryBank(beneficiaryBank);//58a
        //72Z 6*35z
        ActnoBicAdrTagXXX sendertoReceiverInformation = new ActnoBicAdrTagXXX("72");
        sendertoReceiverInformation.setNarrative("MT742\r\n72Z");//6*35z
        mt742Creator.setSendertoReceiverInformation(sendertoReceiverInformation);//72Z 6*35z

        MtResult mtResult = MtCreatorManager.packMT(mt742Creator);

    }

    @Test
    public void mt742_Test2() {
        MT742Creator mt742Creator=new MT742Creator("742");
        mt742Creator.setRecvBic("CHEMDEFF");//收报行
        mt742Creator.setSendBic("DEUTDEMMA");//发报行
        //20 16x
        mt742Creator.setClaimingBankReference("CL934372");
        //21 16x
        mt742Creator.setDocumentaryCreditNumber("IMP 693/70224");
        //52a 52D
        ActnoBicAdrTagXXX issuingBank = new ActnoBicAdrTagXXX("52");
        issuingBank.setPartyIdentifier("D");//[/1!a][/34x]
        //issuingBank.setBic("CHEMUS33");//52A 4!a2!a2!c[3!c]
        issuingBank.setAddress("DSFGBES");//52D 4*35x
        mt742Creator.setIssuingBank(issuingBank);
        //32B 3!a15d
        DcDateCurAmtTagXXX principalAmountClaimed = new DcDateCurAmtTagXXX("32");
        principalAmountClaimed.setCurrency("EUR");//3!a
        principalAmountClaimed.setAmount(new BigDecimal("95000"));//15d
        mt742Creator.setPrincipalAmountClaimed(principalAmountClaimed);
        //34a 34B
        DcDateCurAmtTagXXX totalAmountClaimed = new DcDateCurAmtTagXXX("34","742");
        totalAmountClaimed.setCurrency("EUR");//3!a
        totalAmountClaimed.setAmount(new BigDecimal("95200"));//15d
        //34A
        //totalAmountClaimed.setCurrency("EUR");//3!a
        //totalAmountClaimed.setDate("230301");//6!n
        //totalAmountClaimed.setAmount(new BigDecimal("111.1"));//15d
        mt742Creator.setTotalAmountClaimed(totalAmountClaimed);//34a

        //非必选项
        //31C 6!n
        mt742Creator.setDateofIssue("130607");
        //33B 3!a15d
        DcDateCurAmtTagXXX additionalAmountClaimed = new DcDateCurAmtTagXXX("33");
        additionalAmountClaimed.setCurrency("CUA");//3!a
        additionalAmountClaimed.setAmount(new BigDecimal("2321.09"));//15d
        mt742Creator.setAdditionalAmountClaimed(additionalAmountClaimed);//33B
        //71D 6*35z
        ActnoBicAdrTagXXX charges = new ActnoBicAdrTagXXX("71");
        charges.setNarrative("/COMM/EUR200");//6*35z
        mt742Creator.setCharges(charges);//71D
        //57a 57D
        ActnoBicAdrTagXXX accountWithBank = new ActnoBicAdrTagXXX("57");
        accountWithBank.setPartyIdentifier("D");//[/1!a][/34x]
        //accountWithBank.setBic("DEUTDEFF");//57A 4!a2!a2!c[3!c]
        //accountWithBank.setLocation("MT74257B");//57B [35x]
        accountWithBank.setAddress("MT742\r\n57D");//57D 4*35x
        mt742Creator.setAccountWithBank(accountWithBank);//57a
        //58a 58D
        ActnoBicAdrTagXXX beneficiaryBank = new ActnoBicAdrTagXXX("58");
        beneficiaryBank.setPartyIdentifier("/700-373473");//[/1!a][/34x]
        //beneficiaryBank.setBic("DEUTDEMM");//58A 4!a2!a2!c[3!c]
        beneficiaryBank.setAddress("MTRTDV\r\nMT742\r\n58D");//58D 4*35x
        mt742Creator.setBeneficiaryBank(beneficiaryBank);//58a
        //72Z 6*35z
        ActnoBicAdrTagXXX sendertoReceiverInformation = new ActnoBicAdrTagXXX("72");
        sendertoReceiverInformation.setNarrative("MT742\r\n72Z");//6*35z
        mt742Creator.setSendertoReceiverInformation(sendertoReceiverInformation);//72Z 6*35z

        MtResult mtResult = MtCreatorManager.packMT(mt742Creator);

    }

    @Test
    public void mt742_Test3() {
        MT742Creator mt742Creator=new MT742Creator("742");
        mt742Creator.setRecvBic("CHEMDEFF");//收报行
        mt742Creator.setSendBic("DEUTDEMMA");//发报行
        //20 16x
        mt742Creator.setClaimingBankReference("CL934372");
        //21 16x
        mt742Creator.setDocumentaryCreditNumber("IMP 693/70224");
        //52a 52D
        ActnoBicAdrTagXXX issuingBank = new ActnoBicAdrTagXXX("52");
        issuingBank.setPartyIdentifier("D");//[/1!a][/34x]
        //issuingBank.setBic("CHEMUS33");//52A 4!a2!a2!c[3!c]
        issuingBank.setAddress("DSFGBES");//52D 4*35x
        mt742Creator.setIssuingBank(issuingBank);
        //32B 3!a15d
        DcDateCurAmtTagXXX principalAmountClaimed = new DcDateCurAmtTagXXX("32");
        principalAmountClaimed.setCurrency("EUR");//3!a
        principalAmountClaimed.setAmount(new BigDecimal("95000"));//15d
        mt742Creator.setPrincipalAmountClaimed(principalAmountClaimed);
        //34a 34B
        DcDateCurAmtTagXXX totalAmountClaimed = new DcDateCurAmtTagXXX("34","742");
        totalAmountClaimed.setCurrency("EUR");//3!a
        totalAmountClaimed.setAmount(new BigDecimal("95200"));//15d
        //34A
        //totalAmountClaimed.setCurrency("EUR");//3!a
        //totalAmountClaimed.setDate("230301");//6!n
        //totalAmountClaimed.setAmount(new BigDecimal("111.1"));//15d
        mt742Creator.setTotalAmountClaimed(totalAmountClaimed);//34a

        //非必选项
        //31C 6!n
        mt742Creator.setDateofIssue("130607");
        //33B 3!a15d
        DcDateCurAmtTagXXX additionalAmountClaimed = new DcDateCurAmtTagXXX("33");
        additionalAmountClaimed.setCurrency("CUA");//3!a
        additionalAmountClaimed.setAmount(new BigDecimal("2321.09"));//15d
        mt742Creator.setAdditionalAmountClaimed(additionalAmountClaimed);//33B
        //71D 6*35z
        ActnoBicAdrTagXXX charges = new ActnoBicAdrTagXXX("71");
        charges.setNarrative("/COMM/EUR200");//6*35z
        mt742Creator.setCharges(charges);//71D
        //57a 57B
        ActnoBicAdrTagXXX accountWithBank = new ActnoBicAdrTagXXX("57");
        accountWithBank.setPartyIdentifier("D");//[/1!a][/34x]
        //accountWithBank.setBic("DEUTDEFF");//57A 4!a2!a2!c[3!c]
        accountWithBank.setLocation("MT74257B");//57B [35x]
        //accountWithBank.setAddress("MT742\r\n57D");//57D 4*35x
        mt742Creator.setAccountWithBank(accountWithBank);//57a
        //58a 58D
        ActnoBicAdrTagXXX beneficiaryBank = new ActnoBicAdrTagXXX("58");
        beneficiaryBank.setPartyIdentifier("/700-373473");//[/1!a][/34x]
        //beneficiaryBank.setBic("DEUTDEMM");//58A 4!a2!a2!c[3!c]
        beneficiaryBank.setAddress("MTRTDV\r\nMT742\r\n58D");//58D 4*35x
        mt742Creator.setBeneficiaryBank(beneficiaryBank);//58a
        //72Z 6*35z
        ActnoBicAdrTagXXX sendertoReceiverInformation = new ActnoBicAdrTagXXX("72");
        sendertoReceiverInformation.setNarrative("MT742\r\n72Z");//6*35z
        mt742Creator.setSendertoReceiverInformation(sendertoReceiverInformation);//72Z 6*35z

        MtResult mtResult = MtCreatorManager.packMT(mt742Creator);

    }
}