package com.brilliance.isc.convert.mt1xx; 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.mt1xx.MT103Creator; import org.junit.Test; import java.math.BigDecimal; import java.util.ArrayList; import java.util.LinkedList; import java.util.List; public class MT103Test { @Test public void MT103_Test() throws Exception { MT103Creator mt103Creator = new MT103Creator("103"); //20 mt103Creator.setSendersReference("MMfd4caqYp");//16x //13C LinkedList list13Ccov = new LinkedList<>(); list13Ccov.add("/1XCWP5XQ/6251-8905"); list13Ccov.add("/ZGHMS8QL/6892-8905"); mt103Creator.setTimeIndication(list13Ccov);///8c/4!n1!x4!n //23B mt103Creator.setBankOperationCode("SPRI");//4!c //23E LinkedList list23cov = new LinkedList<>(); list23cov.add("UUS0"); list23cov.add("UUS5"); list23cov.add("TELE"); mt103Creator.setInstructionCode(list23cov);//4!c[/30x] //26T mt103Creator.setTransactionTypeCode("JYY");//3!c //32A DcDateCurAmtTagXXX valDateCurAmt = new DcDateCurAmtTagXXX("32"); valDateCurAmt.setDate("731051"); valDateCurAmt.setCurrency("EQP"); valDateCurAmt.setAmount(new BigDecimal("883421.3")); mt103Creator.setValueDateCurrencyInterbankSettledAmount(valDateCurAmt); // mt103Creator.setValueDateCurrencyInterbankSettledAmount("731051EQP883421.3");//6!n3!a15d //33B DcDateCurAmtTagXXX currencyInstructedAmount = new DcDateCurAmtTagXXX("33"); currencyInstructedAmount.setCurrency("RJY"); currencyInstructedAmount.setAmount(new BigDecimal("100.00")); mt103Creator.setCurrencyInstructedAmount(currencyInstructedAmount);//3!a15d //36 mt103Creator.setExchangeRate("6339368999");//12d //50a ActnoBicAdrTagXXX actnoBicAdrTag50a = new ActnoBicAdrTagXXX("50"); actnoBicAdrTag50a.setPartyIdentifier("1234-4321"); actnoBicAdrTag50a.setCode("aaaa"); actnoBicAdrTag50a.setBic("IRVTUS3N"); mt103Creator.setOrderingCustomer(actnoBicAdrTag50a);//A, F, or K //51A // ActnoBicAdrTagXXX sendingInstitution = new ActnoBicAdrTagXXX("51"); // sendingInstitution.setPartyIdentifier("DKWUDMKOCP"); // //sendingInstitution.setInfo("D"); // sendingInstitution.setBic("DFSFFDE"); // mt103Creator.setSendingInstitution(sendingInstitution); // mt103Creator.setSendingInstitution("/R/DKWUDMKOCP\nADFSFFDE");// [/1!a][/34x]<crlf>4!a2!a2!c[3!c] //52a ActnoBicAdrTagXXX actnoBicAdrTag52a = new ActnoBicAdrTagXXX("52"); actnoBicAdrTag52a.setPartyIdentifier("1234-4321"); actnoBicAdrTag52a.setCode("aaaa"); actnoBicAdrTag52a.setBic("IRVTUS3N"); mt103Creator.setOrderingInstitution(actnoBicAdrTag52a);//A or D //53a ActnoBicAdrTagXXX actnoBicAdrTag53a = new ActnoBicAdrTagXXX("53"); actnoBicAdrTag53a.setPartyIdentifier("1234-4321"); // actnoBicAdrTag53a.setCode("aaaa"); // actnoBicAdrTag53a.setBic("IRVTUS3N"); actnoBicAdrTag53a.setInfo("C"); actnoBicAdrTag53a.setLocation("Location"); mt103Creator.setSendersCorrespondent(actnoBicAdrTag53a);//A, B, or D //54a ActnoBicAdrTagXXX actnoBicAdrTag54a = new ActnoBicAdrTagXXX("54"); actnoBicAdrTag54a.setPartyIdentifier("1234-4321"); actnoBicAdrTag54a.setCode("aaaa"); actnoBicAdrTag54a.setBic("IRVTUS3N"); actnoBicAdrTag54a.setAddress("1Country"); actnoBicAdrTag54a.setLocation("Location"); mt103Creator.setReceiversCorrespondent(actnoBicAdrTag54a);//A, B, or D //55a ActnoBicAdrTagXXX actnoBicAdrTag55a = new ActnoBicAdrTagXXX("55"); actnoBicAdrTag55a.setPartyIdentifier("1234-4321"); actnoBicAdrTag55a.setCode("aaaa"); actnoBicAdrTag55a.setBic("IRVTUS3N"); mt103Creator.setThirdReimbursementInstitution(actnoBicAdrTag55a);//A, B, or D //56a ActnoBicAdrTagXXX actnoBicAdrTag56a = new ActnoBicAdrTagXXX("56"); actnoBicAdrTag56a.setPartyIdentifier("1234-4321"); actnoBicAdrTag56a.setCode("aaaa"); actnoBicAdrTag56a.setBic("IRVTUS3N"); mt103Creator.setIntermediaryInstitution(actnoBicAdrTag56a);//A, C, or D //57a ActnoBicAdrTagXXX actnoBicAdrTag57a = new ActnoBicAdrTagXXX("57"); // actnoBicAdrTag57a.setPartyIdentifier("1234-4321"); // actnoBicAdrTag57a.setCode("aaaa"); // actnoBicAdrTag57a.setBic("IRVTUS3N"); // actnoBicAdrTag57a.setInfo("C"); actnoBicAdrTag57a.setAddress("Address1"); mt103Creator.setAccountWithInstitution(actnoBicAdrTag57a);//A, B, C, or D //59a ActnoBicAdrTagXXX actnoBicAdrTag59a = new ActnoBicAdrTagXXX("59"); // actnoBicAdrTag59a.setPartyIdentifier("1234-4321"); // actnoBicAdrTag59a.setCode("aaaa"); // actnoBicAdrTag59a.setBic("IRVTUS3N"); actnoBicAdrTag59a.setAcctno("Acctno"); actnoBicAdrTag59a.setAddress("1/Address"); mt103Creator.setBeneficiaryCustomer(actnoBicAdrTag59a);//No letter option, A, or F //70 mt103Creator.setRemittanceInformation("dsfsf");//4*35x //71A mt103Creator.setDetailsofCharges("BEN");//3!a //71F LinkedList list71Fcov = new LinkedList<>(); list71Fcov.add("OIK96315"); list71Fcov.add("OIK96315"); mt103Creator.setSendersCharges(list71Fcov);//3!a15d //71G // mt103Creator.setReceiversCharges("OIK96315");//3!a15d //72 mt103Creator.setSendertoReceiverInformation("sdfsf");//6*35x //77B mt103Creator.setRegulatoryReporting("dsff");//3*35x MtCreatorManager.packMT(mt103Creator); } //数据格式和业务逻辑均正确的测试方法。 @Test public void MT103_TEST_1() throws Exception { MT103Creator mt103Creator = new MT103Creator("103"); //20 mt103Creator.setSendersReference("SendersReference"); //13C List<String> timeIndications = new ArrayList<>(); timeIndications.add("/CLSTIME/0915+0100"); timeIndications.add("/RNCTIME/1030-0200"); mt103Creator.setTimeIndication(timeIndications); //23B mt103Creator.setBankOperationCode("CRED"); //23E List<String> instructionCodes = new ArrayList<>(); instructionCodes.add("CHQB"); instructionCodes.add("CORT"); mt103Creator.setInstructionCode(instructionCodes); //26T mt103Creator.setTransactionTypeCode("K90"); //32A DcDateCurAmtTagXXX valDateCurAmt = new DcDateCurAmtTagXXX("32"); valDateCurAmt.setDate("201231"); valDateCurAmt.setCurrency("CNY"); valDateCurAmt.setAmount(new BigDecimal("10000")); mt103Creator.setValueDateCurrencyInterbankSettledAmount(valDateCurAmt); //33B DcDateCurAmtTagXXX currencyInstructedAmount = new DcDateCurAmtTagXXX("33"); currencyInstructedAmount.setCurrency("EUR"); currencyInstructedAmount.setAmount(new BigDecimal("100.00")); mt103Creator.setCurrencyInstructedAmount(currencyInstructedAmount); //36 mt103Creator.setExchangeRate("7.00"); //50a A ActnoBicAdrTagXXX orderingCustomer = new ActnoBicAdrTagXXX("50", "103"); orderingCustomer.setBic("CHASUS33XXX"); orderingCustomer.setAcctno("50AAccount"); mt103Creator.setOrderingCustomer(orderingCustomer); //51A ActnoBicAdrTagXXX sendingInstitution = new ActnoBicAdrTagXXX("51"); sendingInstitution.setBic("BOFAUS3NXXX"); sendingInstitution.setPartyIdentifier("51A_PartyIdentifier"); mt103Creator.setSendingInstitution(sendingInstitution); //52a A ActnoBicAdrTagXXX orderingInstitution = new ActnoBicAdrTagXXX("52"); orderingInstitution.setPartyIdentifier("52A_PartyIdentifier"); orderingInstitution.setBic("IRVTUS3NXXX"); mt103Creator.setOrderingInstitution(orderingInstitution); //53a A ActnoBicAdrTagXXX sendersCorrespondent = new ActnoBicAdrTagXXX("53"); sendersCorrespondent.setBic("HSBCHKHHHKH"); sendersCorrespondent.setInfo("C"); sendersCorrespondent.setPartyIdentifier("53A_PartyIdentifier"); mt103Creator.setSendersCorrespondent(sendersCorrespondent); //54a A ActnoBicAdrTagXXX receiversCorrespondent = new ActnoBicAdrTagXXX("54"); receiversCorrespondent.setBic("CITIUS33XXX"); receiversCorrespondent.setInfo("C"); receiversCorrespondent.setPartyIdentifier("54A_PartyIdentifier"); mt103Creator.setReceiversCorrespondent(receiversCorrespondent); //55a A ActnoBicAdrTagXXX thirdReimbursementInstitution = new ActnoBicAdrTagXXX("55"); thirdReimbursementInstitution.setBic("BARCHKHHXXX"); thirdReimbursementInstitution.setInfo("D"); thirdReimbursementInstitution.setPartyIdentifier("55A_PartyIdentifier"); mt103Creator.setThirdReimbursementInstitution(thirdReimbursementInstitution); //56a A ActnoBicAdrTagXXX intermediaryInstitution = new ActnoBicAdrTagXXX("56"); intermediaryInstitution.setBic("DHBKHKHHXXX"); intermediaryInstitution.setInfo("C"); intermediaryInstitution.setPartyIdentifier("56A_PartyIdentifier"); mt103Creator.setIntermediaryInstitution(intermediaryInstitution); //57a A ActnoBicAdrTagXXX accountWithInstitution = new ActnoBicAdrTagXXX("57"); accountWithInstitution.setBic("BKTRUS33XXX"); accountWithInstitution.setInfo("D"); accountWithInstitution.setPartyIdentifier("57A_PartyIdentifier"); mt103Creator.setAccountWithInstitution(accountWithInstitution); //59a No Letter Option ActnoBicAdrTagXXX beneficiaryCustomer = new ActnoBicAdrTagXXX("59", "103"); beneficiaryCustomer.setAddress("59_Address"); mt103Creator.setBeneficiaryCustomer(beneficiaryCustomer); //70 mt103Creator.setRemittanceInformation("Remittance"); //71A mt103Creator.setDetailsofCharges("OUR"); //71F 71A为OUR时,此标签不能存在 /* List<DcDateCurAmtTagXXX> sendersChargeList = new ArrayList<>(); DcDateCurAmtTagXXX sendersCharge1 = new DcDateCurAmtTagXXX("71"); DcDateCurAmtTagXXX sendersCharge2 = new DcDateCurAmtTagXXX("71"); sendersCharge1.setCurrency("CNY"); sendersCharge1.setAmount(new BigDecimal("123.45")); sendersCharge2.setCurrency("USD"); sendersCharge2.setAmount(new BigDecimal("1000")); sendersChargeList.add(sendersCharge1); sendersChargeList.add(sendersCharge2); mt103Creator.setSendersCharges(sendersChargeList);*/ //71G mt103Creator.setReceiversCharges("CNY200,99"); /* DcDateCurAmtTagXXX receiversCharge = new DcDateCurAmtTagXXX("71"); receiversCharge.setCurrency("EUR"); receiversCharge.setAmount(new BigDecimal("200.99")); mt103Creator.setReceiversCharges(receiversCharge);*/ //72 mt103Creator.setSendertoReceiverInformation("/ACC/AddonInformation\r\n/INS/AddonInformation2"); //77B mt103Creator.setRegulatoryReporting("/ORDERRES/BE//MEILAAN 1, 9000 GENT"); MtCreatorManager.packMT(mt103Creator); } //数据格式和业务逻辑均正确的测试方法。 @Test public void MT103_TEST_2() throws Exception { MT103Creator mt103Creator = new MT103Creator("103"); //20 mt103Creator.setSendersReference("SendersReference"); //13C List<String> timeIndications = new ArrayList<>(); timeIndications.add("/CLSTIME/0915+0100"); timeIndications.add("/RNCTIME/1030-0200"); mt103Creator.setTimeIndication(timeIndications); //23B mt103Creator.setBankOperationCode("CRED"); //23E List<String> instructionCodes = new ArrayList<>(); instructionCodes.add("HOLD"); instructionCodes.add("CORT"); mt103Creator.setInstructionCode(instructionCodes); //26T mt103Creator.setTransactionTypeCode("K90"); //32A DcDateCurAmtTagXXX valDateCurAmt = new DcDateCurAmtTagXXX("32"); valDateCurAmt.setDate("201231"); valDateCurAmt.setCurrency("CNY"); valDateCurAmt.setAmount(new BigDecimal("10000")); mt103Creator.setValueDateCurrencyInterbankSettledAmount(valDateCurAmt); //33B DcDateCurAmtTagXXX currencyInstructedAmount = new DcDateCurAmtTagXXX("33"); currencyInstructedAmount.setCurrency("EUR"); currencyInstructedAmount.setAmount(new BigDecimal("100.00")); mt103Creator.setCurrencyInstructedAmount(currencyInstructedAmount); //36 mt103Creator.setExchangeRate("7.00"); //50a F ActnoBicAdrTagXXX orderingCustomer = new ActnoBicAdrTagXXX("50", "103"); orderingCustomer.setAddress("1/50F_Address1"); orderingCustomer.setPartyIdentifier("50F_PartyIdentifier"); orderingCustomer.setInfo("C"); mt103Creator.setOrderingCustomer(orderingCustomer); //51A ActnoBicAdrTagXXX sendingInstitution = new ActnoBicAdrTagXXX("51"); sendingInstitution.setBic("BOFAUS3NXXX"); sendingInstitution.setPartyIdentifier("51A_PartyIdentifier"); mt103Creator.setSendingInstitution(sendingInstitution); //52a D ActnoBicAdrTagXXX orderingInstitution = new ActnoBicAdrTagXXX("52"); orderingInstitution.setPartyIdentifier("52D_PartyIdentifier"); orderingInstitution.setAddress("52D_Address1"); mt103Creator.setOrderingInstitution(orderingInstitution); //53a B ActnoBicAdrTagXXX sendersCorrespondent = new ActnoBicAdrTagXXX("53"); sendersCorrespondent.setLocation("53B_Location"); sendersCorrespondent.setInfo("C"); sendersCorrespondent.setPartyIdentifier("53B_PartyIdentifier"); mt103Creator.setSendersCorrespondent(sendersCorrespondent); //54a B ActnoBicAdrTagXXX receiversCorrespondent = new ActnoBicAdrTagXXX("54"); receiversCorrespondent.setLocation("54B_Location"); receiversCorrespondent.setInfo("C"); receiversCorrespondent.setPartyIdentifier("54B_PartyIdentifier"); mt103Creator.setReceiversCorrespondent(receiversCorrespondent); //55a B ActnoBicAdrTagXXX thirdReimbursementInstitution = new ActnoBicAdrTagXXX("55"); thirdReimbursementInstitution.setLocation("55B_Location"); thirdReimbursementInstitution.setInfo("D"); thirdReimbursementInstitution.setPartyIdentifier("55B_PartyIdentifier"); mt103Creator.setThirdReimbursementInstitution(thirdReimbursementInstitution); //56a D ActnoBicAdrTagXXX intermediaryInstitution = new ActnoBicAdrTagXXX("56"); intermediaryInstitution.setInfo("D"); intermediaryInstitution.setPartyIdentifier("56D_PartyIdentifier"); intermediaryInstitution.setAddress("56D_Address"); mt103Creator.setIntermediaryInstitution(intermediaryInstitution); //57a B ActnoBicAdrTagXXX accountWithInstitution = new ActnoBicAdrTagXXX("57"); accountWithInstitution.setLocation("57B_Location"); accountWithInstitution.setInfo("D"); accountWithInstitution.setPartyIdentifier("57B_PartyIdentifier"); mt103Creator.setAccountWithInstitution(accountWithInstitution); //59a A ActnoBicAdrTagXXX beneficiaryCustomer = new ActnoBicAdrTagXXX("59", "103"); beneficiaryCustomer.setAcctno("59A_Account"); beneficiaryCustomer.setBic("CITIUS33XXX"); mt103Creator.setBeneficiaryCustomer(beneficiaryCustomer); //70 mt103Creator.setRemittanceInformation("Remittance"); //71A mt103Creator.setDetailsofCharges("SHA"); //71F List<String> sendersChargeList = new ArrayList<>(); sendersChargeList.add("CNY1000,"); sendersChargeList.add("EUR1000,50"); mt103Creator.setSendersCharges(sendersChargeList); /* List<DcDateCurAmtTagXXX> sendersChargeList = new ArrayList<>(); DcDateCurAmtTagXXX sendersCharge1 = new DcDateCurAmtTagXXX("71"); DcDateCurAmtTagXXX sendersCharge2 = new DcDateCurAmtTagXXX("71"); sendersCharge1.setCurrency("CNY"); sendersCharge1.setAmount(new BigDecimal("123.45")); sendersCharge2.setCurrency("USD"); sendersCharge2.setAmount(new BigDecimal("1000")); sendersChargeList.add(sendersCharge1); sendersChargeList.add(sendersCharge2); mt103Creator.setSendersCharges(sendersChargeList);*/ //71G 71A为SHA时,此标签不能存在。 /* DcDateCurAmtTagXXX receiversCharge = new DcDateCurAmtTagXXX("71"); receiversCharge.setCurrency("EUR"); receiversCharge.setAmount(new BigDecimal("200.99")); mt103Creator.setReceiversCharges(receiversCharge);*/ //72 mt103Creator.setSendertoReceiverInformation("/ACC/AddonInformation\r\n/INS/AddonInformation2"); //77B mt103Creator.setRegulatoryReporting("/ORDERRES/BE//MEILAAN 1, 9000 GENT"); MtCreatorManager.packMT(mt103Creator); } //数据格式和业务逻辑均正确的测试方法。 @Test public void MT103_TEST_3() throws Exception { MT103Creator mt103Creator = new MT103Creator("103"); //20 mt103Creator.setSendersReference("SendersReference"); //13C List<String> timeIndications = new ArrayList<>(); timeIndications.add("/CLSTIME/0915+0100"); timeIndications.add("/RNCTIME/1030-0200"); mt103Creator.setTimeIndication(timeIndications); //23B mt103Creator.setBankOperationCode("CRED"); //23E List<String> instructionCodes = new ArrayList<>(); instructionCodes.add("HOLD"); instructionCodes.add("CORT"); mt103Creator.setInstructionCode(instructionCodes); //26T mt103Creator.setTransactionTypeCode("K90"); //32A DcDateCurAmtTagXXX valDateCurAmt = new DcDateCurAmtTagXXX("32"); valDateCurAmt.setDate("201231"); valDateCurAmt.setCurrency("CNY"); valDateCurAmt.setAmount(new BigDecimal("10000")); mt103Creator.setValueDateCurrencyInterbankSettledAmount(valDateCurAmt); //33B DcDateCurAmtTagXXX currencyInstructedAmount = new DcDateCurAmtTagXXX("33"); currencyInstructedAmount.setCurrency("EUR"); currencyInstructedAmount.setAmount(new BigDecimal("100.00")); mt103Creator.setCurrencyInstructedAmount(currencyInstructedAmount); //36 mt103Creator.setExchangeRate("7.00"); //50a K ActnoBicAdrTagXXX orderingCustomer = new ActnoBicAdrTagXXX("50", "103"); orderingCustomer.setAddress("50K_Address1"); orderingCustomer.setAcctno("50K_Account"); mt103Creator.setOrderingCustomer(orderingCustomer); //51A ActnoBicAdrTagXXX sendingInstitution = new ActnoBicAdrTagXXX("51"); sendingInstitution.setBic("BOFAUS3NXXX"); sendingInstitution.setPartyIdentifier("51A_PartyIdentifier"); mt103Creator.setSendingInstitution(sendingInstitution); //52a D ActnoBicAdrTagXXX orderingInstitution = new ActnoBicAdrTagXXX("52"); orderingInstitution.setPartyIdentifier("52D_PartyIdentifier"); orderingInstitution.setAddress("52D_Address1"); mt103Creator.setOrderingInstitution(orderingInstitution); //53a D ActnoBicAdrTagXXX sendersCorrespondent = new ActnoBicAdrTagXXX("53"); sendersCorrespondent.setAddress("53D_Address"); sendersCorrespondent.setInfo("C"); sendersCorrespondent.setPartyIdentifier("53D_PartyIdentifier"); mt103Creator.setSendersCorrespondent(sendersCorrespondent); //54a D ActnoBicAdrTagXXX receiversCorrespondent = new ActnoBicAdrTagXXX("54"); receiversCorrespondent.setAddress("54D_Address"); receiversCorrespondent.setInfo("C"); receiversCorrespondent.setPartyIdentifier("54D_PartyIdentifier"); mt103Creator.setReceiversCorrespondent(receiversCorrespondent); //55a D ActnoBicAdrTagXXX thirdReimbursementInstitution = new ActnoBicAdrTagXXX("55"); thirdReimbursementInstitution.setAddress("55D_Address"); thirdReimbursementInstitution.setInfo("D"); thirdReimbursementInstitution.setPartyIdentifier("55D_PartyIdentifier"); mt103Creator.setThirdReimbursementInstitution(thirdReimbursementInstitution); //56a C //TODO 56C暂时不考虑,此处测试暂时搁置。 // ActnoBicAdrTagXXX intermediaryInstitution = new ActnoBicAdrTagXXX("56"); // intermediaryInstitution.setInfo("D"); // intermediaryInstitution.setPartyIdentifier("56C_PartyIdentifier"); // mt103Creator.setIntermediaryInstitution(intermediaryInstitution); //57a C //TODO 57C暂时不考虑,此处测试暂时搁置。 // ActnoBicAdrTagXXX accountWithInstitution = new ActnoBicAdrTagXXX("57"); // accountWithInstitution.setInfo("D"); // accountWithInstitution.setPartyIdentifier("57C_PartyIdentifier"); // mt103Creator.setAccountWithInstitution(accountWithInstitution); //59a F ActnoBicAdrTagXXX beneficiaryCustomer = new ActnoBicAdrTagXXX("59", "103"); beneficiaryCustomer.setAcctno("59F_Account"); beneficiaryCustomer.setAddress("1/59F_Address"); mt103Creator.setBeneficiaryCustomer(beneficiaryCustomer); //70 mt103Creator.setRemittanceInformation("Remittance"); //71A mt103Creator.setDetailsofCharges("BEN"); //71F 71A为BEN时,此标签必须存在。 List<String> sendersChargeList = new ArrayList<>(); sendersChargeList.add("CNY1000,"); sendersChargeList.add("EUR1000,50"); mt103Creator.setSendersCharges(sendersChargeList); /* List<DcDateCurAmtTagXXX> sendersChargeList = new ArrayList<>(); DcDateCurAmtTagXXX sendersCharge1 = new DcDateCurAmtTagXXX("71"); DcDateCurAmtTagXXX sendersCharge2 = new DcDateCurAmtTagXXX("71"); sendersCharge1.setCurrency("CNY"); sendersCharge1.setAmount(new BigDecimal("123.45")); sendersCharge2.setCurrency("USD"); sendersCharge2.setAmount(new BigDecimal("1000")); sendersChargeList.add(sendersCharge1); sendersChargeList.add(sendersCharge2); mt103Creator.setSendersCharges(sendersChargeList);*/ //71G 71A为BEN时,此标签不能存在。 /* DcDateCurAmtTagXXX receiversCharge = new DcDateCurAmtTagXXX("71"); receiversCharge.setCurrency("EUR"); receiversCharge.setAmount(new BigDecimal("200.99")); mt103Creator.setReceiversCharges(receiversCharge);*/ //72 mt103Creator.setSendertoReceiverInformation("/ACC/AddonInformation\r\n/INS/AddonInformation2"); //77B mt103Creator.setRegulatoryReporting("/ORDERRES/BE//MEILAAN 1, 9000 GENT"); MtCreatorManager.packMT(mt103Creator); } //数据格式不正确的测试方法。 @Test public void MT103_TEST_4() throws Exception { MT103Creator mt103Creator = new MT103Creator("103"); //20 字段过长 mt103Creator.setSendersReference("12345678901234567890"); //13C 字段过长 List<String> timeIndications = new ArrayList<>(); timeIndications.add("/CLSTIMETIME/0915+0100"); timeIndications.add("/RNCTIMETIME/1030-0200"); mt103Creator.setTimeIndication(timeIndications); //23B 字段过长 mt103Creator.setBankOperationCode("CREDA"); //23E 出现非数字、字母字符 List<String> instructionCodes = new ArrayList<>(); instructionCodes.add("/][-"); instructionCodes.add("!@#$"); mt103Creator.setInstructionCode(instructionCodes); //26T 出现非数字、字母字符 mt103Creator.setTransactionTypeCode(")(*"); //32A Date字段超长,Currency出现非字母字符 DcDateCurAmtTagXXX valDateCurAmt = new DcDateCurAmtTagXXX("32"); valDateCurAmt.setDate("20201231"); valDateCurAmt.setCurrency("123"); valDateCurAmt.setAmount(new BigDecimal("10000")); mt103Creator.setValueDateCurrencyInterbankSettledAmount(valDateCurAmt); //33B Currency出现非字母字符 DcDateCurAmtTagXXX currencyInstructedAmount = new DcDateCurAmtTagXXX("33"); currencyInstructedAmount.setCurrency("456"); currencyInstructedAmount.setAmount(new BigDecimal("100.00")); mt103Creator.setCurrencyInstructedAmount(currencyInstructedAmount); //36 出现非数字及小数点字符 mt103Creator.setExchangeRate("rate"); //50a A BIC格式错误 ActnoBicAdrTagXXX orderingCustomer = new ActnoBicAdrTagXXX("50", "103"); orderingCustomer.setBic("SWIFT123BCBIC"); orderingCustomer.setAcctno("50AAccount"); mt103Creator.setOrderingCustomer(orderingCustomer); //51A BIC格式错误 ActnoBicAdrTagXXX sendingInstitution = new ActnoBicAdrTagXXX("51"); sendingInstitution.setBic("SWIFT456BICBC"); sendingInstitution.setPartyIdentifier("51A_PartyIdentifier"); mt103Creator.setSendingInstitution(sendingInstitution); //52a D Address字段超长 ActnoBicAdrTagXXX orderingInstitution = new ActnoBicAdrTagXXX("52"); orderingInstitution.setPartyIdentifier("52A_PartyIdentifier"); orderingInstitution.setAddress("1234567890223456789032345678904234567890"); mt103Creator.setOrderingInstitution(orderingInstitution); //53a B Location字段超长 ActnoBicAdrTagXXX sendersCorrespondent = new ActnoBicAdrTagXXX("53"); sendersCorrespondent.setLocation("1234567890223456789032345678904234567890"); sendersCorrespondent.setInfo("C"); sendersCorrespondent.setPartyIdentifier("53A_PartyIdentifier"); mt103Creator.setSendersCorrespondent(sendersCorrespondent); //54a D Info格式错误 ActnoBicAdrTagXXX receiversCorrespondent = new ActnoBicAdrTagXXX("54"); receiversCorrespondent.setBic("CITIUS33XXX"); receiversCorrespondent.setInfo("A"); receiversCorrespondent.setPartyIdentifier("54A_PartyIdentifier"); mt103Creator.setReceiversCorrespondent(receiversCorrespondent); //55a A ActnoBicAdrTagXXX thirdReimbursementInstitution = new ActnoBicAdrTagXXX("55"); thirdReimbursementInstitution.setBic("BARCHKHHXXX"); thirdReimbursementInstitution.setInfo("D"); thirdReimbursementInstitution.setPartyIdentifier("55A_PartyIdentifier"); mt103Creator.setThirdReimbursementInstitution(thirdReimbursementInstitution); //56a A ActnoBicAdrTagXXX intermediaryInstitution = new ActnoBicAdrTagXXX("56"); intermediaryInstitution.setBic("DHBKHKHHXXX"); intermediaryInstitution.setInfo("C"); intermediaryInstitution.setPartyIdentifier("56A_PartyIdentifier"); mt103Creator.setIntermediaryInstitution(intermediaryInstitution); //57a A ActnoBicAdrTagXXX accountWithInstitution = new ActnoBicAdrTagXXX("57"); accountWithInstitution.setBic("BKTRUS33XXX"); accountWithInstitution.setInfo("D"); accountWithInstitution.setPartyIdentifier("57A_PartyIdentifier"); mt103Creator.setAccountWithInstitution(accountWithInstitution); //59a No Letter Option ActnoBicAdrTagXXX beneficiaryCustomer = new ActnoBicAdrTagXXX("59", "103"); beneficiaryCustomer.setAddress("59_Address"); mt103Creator.setBeneficiaryCustomer(beneficiaryCustomer); //70 字段超长 mt103Creator.setRemittanceInformation("1234567890223456789032345678904234567890"); //71A 出现非字母字符 mt103Creator.setDetailsofCharges("123"); //71F Amount字段超长 List<String> sendersChargeList = new ArrayList<>(); sendersChargeList.add("CNY10000000,0000000"); sendersChargeList.add("EUR1000,50"); mt103Creator.setSendersCharges(sendersChargeList); /* List<DcDateCurAmtTagXXX> sendersChargeList = new ArrayList<>(); DcDateCurAmtTagXXX sendersCharge1 = new DcDateCurAmtTagXXX("71"); DcDateCurAmtTagXXX sendersCharge2 = new DcDateCurAmtTagXXX("71"); sendersCharge1.setCurrency("CNY"); sendersCharge1.setAmount(new BigDecimal("123.45")); sendersCharge2.setCurrency("USD"); sendersCharge2.setAmount(new BigDecimal("1000")); sendersChargeList.add(sendersCharge1); sendersChargeList.add(sendersCharge2); mt103Creator.setSendersCharges(sendersChargeList);*/ //71G Cur出现非字母字符 mt103Creator.setReceiversCharges("】【、200,99"); /* DcDateCurAmtTagXXX receiversCharge = new DcDateCurAmtTagXXX("71"); receiversCharge.setCurrency("EUR"); receiversCharge.setAmount(new BigDecimal("200.99")); mt103Creator.setReceiversCharges(receiversCharge);*/ //72 字段超长 mt103Creator.setSendertoReceiverInformation("1234567890223456789032345678904234567890"); //77B 字段超长 mt103Creator.setRegulatoryReporting("1234567890223456789032345678904234567890"); MtCreatorManager.packMT(mt103Creator); } //不符合业务逻辑C1, C3, C4, C6, C8, C9, C10, C12, C14, C17, C18的测试方法。 @Test public void MT103_TEST_5() throws Exception { MT103Creator mt103Creator = new MT103Creator("103"); //20 mt103Creator.setSendersReference("SendersReference"); //13C List<String> timeIndications = new ArrayList<>(); timeIndications.add("/CLSTIME/0915+0100"); timeIndications.add("/RNCTIME/1030-0200"); mt103Creator.setTimeIndication(timeIndications); //23B mt103Creator.setBankOperationCode("SPRI"); //23E // C3.23B的值为SPRI时,23E中不能包含SDVA, TELB, PHOB, INTC之外的值。 // C17.当57a不存在时,23E不能包含TELE和PHON. List<String> instructionCodes = new ArrayList<>(); instructionCodes.add("TELE"); instructionCodes.add("CORT"); mt103Creator.setInstructionCode(instructionCodes); //26T mt103Creator.setTransactionTypeCode("K90"); //32A DcDateCurAmtTagXXX valDateCurAmt = new DcDateCurAmtTagXXX("32"); valDateCurAmt.setDate("201231"); valDateCurAmt.setCurrency("CNY"); valDateCurAmt.setAmount(new BigDecimal("10000")); mt103Creator.setValueDateCurrencyInterbankSettledAmount(valDateCurAmt); //33B C1.33B存在且2A和33B币种不同时,36必须存在。 DcDateCurAmtTagXXX currencyInstructedAmount = new DcDateCurAmtTagXXX("33"); currencyInstructedAmount.setCurrency("EUR"); currencyInstructedAmount.setAmount(new BigDecimal("100.00")); mt103Creator.setCurrencyInstructedAmount(currencyInstructedAmount); //36 // mt103Creator.setExchangeRate("7.00"); //50a A ActnoBicAdrTagXXX orderingCustomer = new ActnoBicAdrTagXXX("50", "103"); orderingCustomer.setBic("CHASUS33XXX"); orderingCustomer.setAcctno("50AAccount"); mt103Creator.setOrderingCustomer(orderingCustomer); //51A ActnoBicAdrTagXXX sendingInstitution = new ActnoBicAdrTagXXX("51"); sendingInstitution.setBic("BOFAUS3NXXX"); sendingInstitution.setPartyIdentifier("51A_PartyIdentifier"); mt103Creator.setSendingInstitution(sendingInstitution); //52a A ActnoBicAdrTagXXX orderingInstitution = new ActnoBicAdrTagXXX("52"); orderingInstitution.setPartyIdentifier("52A_PartyIdentifier"); orderingInstitution.setBic("IRVTUS3NXXX"); mt103Creator.setOrderingInstitution(orderingInstitution); //53a D // C4.当23B的值为SPRI, SSTD, SPAY的其中一个时,53a域不能选择53D. ActnoBicAdrTagXXX sendersCorrespondent = new ActnoBicAdrTagXXX("53"); sendersCorrespondent.setAddress("53D_Address"); mt103Creator.setSendersCorrespondent(sendersCorrespondent); //54a A // C6.23B的值为SPRI, SSTD, SPAY时,54a域必须选择54A. ActnoBicAdrTagXXX receiversCorrespondent = new ActnoBicAdrTagXXX("54"); receiversCorrespondent.setAddress("54D_Address"); receiversCorrespondent.setInfo("C"); receiversCorrespondent.setPartyIdentifier("54D_PartyIdentifier"); mt103Creator.setReceiversCorrespondent(receiversCorrespondent); //55a B // C8.23B的值为SPRI, SSTD, SPAY时,必须使用55A. ActnoBicAdrTagXXX thirdReimbursementInstitution = new ActnoBicAdrTagXXX("55"); thirdReimbursementInstitution.setLocation("55B_Location"); thirdReimbursementInstitution.setInfo("D"); thirdReimbursementInstitution.setPartyIdentifier("55B_PartyIdentifier"); mt103Creator.setThirdReimbursementInstitution(thirdReimbursementInstitution); //56a A // C10.23B的值为SPRI时,56a域不能存在。 ActnoBicAdrTagXXX intermediaryInstitution = new ActnoBicAdrTagXXX("56"); intermediaryInstitution.setBic("DHBKHKHHXXX"); intermediaryInstitution.setInfo("C"); intermediaryInstitution.setPartyIdentifier("56A_PartyIdentifier"); mt103Creator.setIntermediaryInstitution(intermediaryInstitution); //57a A // C9.56a存在时,57a不能为空。 // ActnoBicAdrTagXXX accountWithInstitution = new ActnoBicAdrTagXXX("57"); // accountWithInstitution.setBic("BKTRUS33XXX"); // accountWithInstitution.setInfo("D"); // accountWithInstitution.setPartyIdentifier("57A_PartyIdentifier"); // mt103Creator.setAccountWithInstitution(accountWithInstitution); //59a No Letter Option // C12.23B的值为SPRI, SSTD, SPAY时,59a必须填写Account. ActnoBicAdrTagXXX beneficiaryCustomer = new ActnoBicAdrTagXXX("59", "103"); beneficiaryCustomer.setAddress("59_Address"); mt103Creator.setBeneficiaryCustomer(beneficiaryCustomer); //70 mt103Creator.setRemittanceInformation("Remittance"); //71A mt103Creator.setDetailsofCharges("OUR"); //71F C14.当71A的值为OUR时,71F不能存在。 List<String> sendersChargeList = new ArrayList<>(); sendersChargeList.add("CNY1000,"); sendersChargeList.add("EUR1000,50"); mt103Creator.setSendersCharges(sendersChargeList); /* List<DcDateCurAmtTagXXX> sendersChargeList = new ArrayList<>(); DcDateCurAmtTagXXX sendersCharge1 = new DcDateCurAmtTagXXX("71"); DcDateCurAmtTagXXX sendersCharge2 = new DcDateCurAmtTagXXX("71"); sendersCharge1.setCurrency("CNY"); sendersCharge1.setAmount(new BigDecimal("123.45")); sendersCharge2.setCurrency("USD"); sendersCharge2.setAmount(new BigDecimal("1000")); sendersChargeList.add(sendersCharge1); sendersChargeList.add(sendersCharge2); mt103Creator.setSendersCharges(sendersChargeList);*/ //71G C18.71G和32A的币种必须相同。 mt103Creator.setReceiversCharges("EUR200,99"); /* DcDateCurAmtTagXXX receiversCharge = new DcDateCurAmtTagXXX("71"); receiversCharge.setCurrency("EUR"); receiversCharge.setAmount(new BigDecimal("200.99")); mt103Creator.setReceiversCharges(receiversCharge);*/ //72 mt103Creator.setSendertoReceiverInformation("/ACC/AddonInformation\r\n/INS/AddonInformation2"); //77B mt103Creator.setRegulatoryReporting("/ORDERRES/BE//MEILAAN 1, 9000 GENT"); MtCreatorManager.packMT(mt103Creator); } //不符合业务逻辑C1, C2, C3, C5, C6, C8, C10, C11, C12, C14, C15的测试方法。 @Test public void MT103_TEST_6() throws Exception { MT103Creator mt103Creator = new MT103Creator("103"); mt103Creator.setSendBic("BINAADB1XXX"); mt103Creator.setRecvBic("VALBADADXXX"); //20 mt103Creator.setSendersReference("SendersReference"); //13C List<String> timeIndications = new ArrayList<>(); timeIndications.add("/CLSTIME/0915+0100"); timeIndications.add("/RNCTIME/1030-0200"); mt103Creator.setTimeIndication(timeIndications); //23B mt103Creator.setBankOperationCode("SSTD"); //23E // C2.23B的值为SSTD或SPAY时,23E不能存在。 List<String> instructionCodes = new ArrayList<>(); instructionCodes.add("CHQB"); instructionCodes.add("CORT"); mt103Creator.setInstructionCode(instructionCodes); //26T mt103Creator.setTransactionTypeCode("K90"); //32A DcDateCurAmtTagXXX valDateCurAmt = new DcDateCurAmtTagXXX("32"); valDateCurAmt.setDate("201231"); valDateCurAmt.setCurrency("CNY"); valDateCurAmt.setAmount(new BigDecimal("10000")); mt103Creator.setValueDateCurrencyInterbankSettledAmount(valDateCurAmt); //33B // C2.发报行和收报行同时属于以下国家/地区时: // AD, AT, BE, BG, BV, CH, CY, CZ, DE, DK, ES, EE, FI, FR, GB, GF, GI, GP, GR, HU, IE, IS, IT, // LI, LT, LU, LV, MC, MQ, MT, NL, NO, PL, PM, PT, RE, RO, SE, SI, SJ, SK, SM, TF, VA. // 33B必须存在。 // C15.当71F或71G存在时,33B必须存在。 // DcDateCurAmtTagXXX currencyInstructedAmount = new DcDateCurAmtTagXXX("33"); // currencyInstructedAmount.setCurrency("EUR"); // currencyInstructedAmount.setAmount(new BigDecimal("100.00")); // mt103Creator.setCurrencyInstructedAmount(currencyInstructedAmount); //36 // C1.当33B不存在时,36不能存在。 mt103Creator.setExchangeRate("7.00"); //50a A ActnoBicAdrTagXXX orderingCustomer = new ActnoBicAdrTagXXX("50", "103"); orderingCustomer.setBic("CHASUS33XXX"); orderingCustomer.setAcctno("50AAccount"); mt103Creator.setOrderingCustomer(orderingCustomer); //51A ActnoBicAdrTagXXX sendingInstitution = new ActnoBicAdrTagXXX("51"); sendingInstitution.setBic("BOFAUS3NXXX"); sendingInstitution.setPartyIdentifier("51A_PartyIdentifier"); mt103Creator.setSendingInstitution(sendingInstitution); //52a A ActnoBicAdrTagXXX orderingInstitution = new ActnoBicAdrTagXXX("52"); orderingInstitution.setPartyIdentifier("52A_PartyIdentifier"); orderingInstitution.setBic("IRVTUS3NXXX"); mt103Creator.setOrderingInstitution(orderingInstitution); //53a B // C5.23B的值为SPRI, SSTD, SPAY时,53B必须填写Party Identifier. ActnoBicAdrTagXXX sendersCorrespondent = new ActnoBicAdrTagXXX("53"); sendersCorrespondent.setLocation("53B_Location"); // sendersCorrespondent.setInfo("C"); // sendersCorrespondent.setPartyIdentifier("53B_PartyIdentifier"); mt103Creator.setSendersCorrespondent(sendersCorrespondent); //54a D // C6.23B的值为SPRI, SSTD, SPAY时,不能使用54A和54D. ActnoBicAdrTagXXX receiversCorrespondent = new ActnoBicAdrTagXXX("54"); receiversCorrespondent.setInfo("C"); receiversCorrespondent.setPartyIdentifier("54D_PartyIdentifier"); receiversCorrespondent.setAddress("54D_Address"); mt103Creator.setReceiversCorrespondent(receiversCorrespondent); //55a D // C8.23B的值为SPRI, SSTD, SPAY时,必须使用55A. ActnoBicAdrTagXXX thirdReimbursementInstitution = new ActnoBicAdrTagXXX("55"); thirdReimbursementInstitution.setAddress("55D_Address"); thirdReimbursementInstitution.setInfo("D"); thirdReimbursementInstitution.setPartyIdentifier("55D_PartyIdentifier"); mt103Creator.setThirdReimbursementInstitution(thirdReimbursementInstitution); //56a D // C10.23B的值为SSTD或SPAY,56a域只能选择56A和56C. ActnoBicAdrTagXXX intermediaryInstitution = new ActnoBicAdrTagXXX("56"); intermediaryInstitution.setAddress("56D_Address"); intermediaryInstitution.setInfo("C"); intermediaryInstitution.setPartyIdentifier("56A_PartyIdentifier"); mt103Creator.setIntermediaryInstitution(intermediaryInstitution); //57a B //C11 23B的值为SPRI, SSTD, SPAY时,57a只能选择57A, 57C, 57D. ActnoBicAdrTagXXX accountWithInstitution = new ActnoBicAdrTagXXX("57"); accountWithInstitution.setLocation("57B_Location"); accountWithInstitution.setInfo("D"); accountWithInstitution.setPartyIdentifier("57B_PartyIdentifier"); mt103Creator.setAccountWithInstitution(accountWithInstitution); //59a No Letter Option // C12.23B的值为SPRI, SSTD, SPAY时,59a必须填写Account. ActnoBicAdrTagXXX beneficiaryCustomer = new ActnoBicAdrTagXXX("59", "103"); beneficiaryCustomer.setAddress("59_Address"); mt103Creator.setBeneficiaryCustomer(beneficiaryCustomer); //70 mt103Creator.setRemittanceInformation("Remittance"); //71A mt103Creator.setDetailsofCharges("SHA"); //71F List<String> sendersChargeList = new ArrayList<>(); sendersChargeList.add("CNY1000,"); sendersChargeList.add("EUR1000,50"); mt103Creator.setSendersCharges(sendersChargeList); /* List<DcDateCurAmtTagXXX> sendersChargeList = new ArrayList<>(); DcDateCurAmtTagXXX sendersCharge1 = new DcDateCurAmtTagXXX("71"); DcDateCurAmtTagXXX sendersCharge2 = new DcDateCurAmtTagXXX("71"); sendersCharge1.setCurrency("CNY"); sendersCharge1.setAmount(new BigDecimal("123.45")); sendersCharge2.setCurrency("USD"); sendersCharge2.setAmount(new BigDecimal("1000")); sendersChargeList.add(sendersCharge1); sendersChargeList.add(sendersCharge2); mt103Creator.setSendersCharges(sendersChargeList);*/ //71G // C14.当71A的值为SHA时,71G不能存在。 mt103Creator.setReceiversCharges("CNY200,99"); /* DcDateCurAmtTagXXX receiversCharge = new DcDateCurAmtTagXXX("71"); receiversCharge.setCurrency("EUR"); receiversCharge.setAmount(new BigDecimal("200.99")); mt103Creator.setReceiversCharges(receiversCharge);*/ //72 mt103Creator.setSendertoReceiverInformation("/ACC/AddonInformation\r\n/INS/AddonInformation2"); //77B mt103Creator.setRegulatoryReporting("/ORDERRES/BE//MEILAAN 1, 9000 GENT"); MtCreatorManager.packMT(mt103Creator); } //不符合业务逻辑C1, C3, C7, C10, C11, C13, C14的测试方法。 @Test public void MT103_TEST_7() throws Exception { MT103Creator mt103Creator = new MT103Creator("103"); //20 mt103Creator.setSendersReference("SendersReference"); //13C List<String> timeIndications = new ArrayList<>(); timeIndications.add("/CLSTIME/0915+0100"); timeIndications.add("/RNCTIME/1030-0200"); mt103Creator.setTimeIndication(timeIndications); //23B mt103Creator.setBankOperationCode("SPRI"); //23E List<String> instructionCodes = new ArrayList<>(); instructionCodes.add("CHQB"); instructionCodes.add("CORT"); mt103Creator.setInstructionCode(instructionCodes); //26T mt103Creator.setTransactionTypeCode("K90"); //32A DcDateCurAmtTagXXX valDateCurAmt = new DcDateCurAmtTagXXX("32"); valDateCurAmt.setDate("201231"); valDateCurAmt.setCurrency("CNY"); valDateCurAmt.setAmount(new BigDecimal("10000")); mt103Creator.setValueDateCurrencyInterbankSettledAmount(valDateCurAmt); //33B DcDateCurAmtTagXXX currencyInstructedAmount = new DcDateCurAmtTagXXX("33"); currencyInstructedAmount.setCurrency("CNY"); currencyInstructedAmount.setAmount(new BigDecimal("100.00")); mt103Creator.setCurrencyInstructedAmount(currencyInstructedAmount); //36 // C1.当32A和33B币种相同时,36不能存在, mt103Creator.setExchangeRate("7.00"); //50a A ActnoBicAdrTagXXX orderingCustomer = new ActnoBicAdrTagXXX("50", "103"); orderingCustomer.setBic("CHASUS33XXX"); orderingCustomer.setAcctno("50AAccount"); mt103Creator.setOrderingCustomer(orderingCustomer); //51A ActnoBicAdrTagXXX sendingInstitution = new ActnoBicAdrTagXXX("51"); sendingInstitution.setBic("BOFAUS3NXXX"); sendingInstitution.setPartyIdentifier("51A_PartyIdentifier"); mt103Creator.setSendingInstitution(sendingInstitution); //52a A ActnoBicAdrTagXXX orderingInstitution = new ActnoBicAdrTagXXX("52"); orderingInstitution.setPartyIdentifier("52A_PartyIdentifier"); orderingInstitution.setBic("IRVTUS3NXXX"); mt103Creator.setOrderingInstitution(orderingInstitution); // //53a A // //C7.55a存在时,53a和54a不能为空。 // ActnoBicAdrTagXXX sendersCorrespondent = new ActnoBicAdrTagXXX("53"); // sendersCorrespondent.setBic("HSBCHKHHHKH"); // sendersCorrespondent.setInfo("C"); // sendersCorrespondent.setPartyIdentifier("53A_PartyIdentifier"); // mt103Creator.setSendersCorrespondent(sendersCorrespondent); // //54a A // ActnoBicAdrTagXXX receiversCorrespondent = new ActnoBicAdrTagXXX("54"); // receiversCorrespondent.setBic("CITIUS33XXX"); // receiversCorrespondent.setInfo("C"); // receiversCorrespondent.setPartyIdentifier("54A_PartyIdentifier"); // mt103Creator.setReceiversCorrespondent(receiversCorrespondent); //55a A ActnoBicAdrTagXXX thirdReimbursementInstitution = new ActnoBicAdrTagXXX("55"); thirdReimbursementInstitution.setBic("BARCHKHHXXX"); thirdReimbursementInstitution.setInfo("D"); thirdReimbursementInstitution.setPartyIdentifier("55A_PartyIdentifier"); mt103Creator.setThirdReimbursementInstitution(thirdReimbursementInstitution); //56a B // C10.23B的值为SPRI时,56a域不能存在。 ActnoBicAdrTagXXX intermediaryInstitution = new ActnoBicAdrTagXXX("56"); intermediaryInstitution.setBic("DHBKHKHHXXX"); intermediaryInstitution.setInfo("C"); intermediaryInstitution.setPartyIdentifier("56A_PartyIdentifier"); mt103Creator.setIntermediaryInstitution(intermediaryInstitution); //57a D // 23B的值为SPRI, SSTD, SPAY时,57D必须使用Party Identifier. ActnoBicAdrTagXXX accountWithInstitution = new ActnoBicAdrTagXXX("57"); accountWithInstitution.setAddress("57D_Address"); // accountWithInstitution.setInfo("D"); // accountWithInstitution.setPartyIdentifier("57A_PartyIdentifier"); mt103Creator.setAccountWithInstitution(accountWithInstitution); //59a No Letter Option // C13.当有23E的值为CHQB时,59a不能填写Account. ActnoBicAdrTagXXX beneficiaryCustomer = new ActnoBicAdrTagXXX("59", "103"); beneficiaryCustomer.setAddress("59_Address"); beneficiaryCustomer.setAcctno("59_Account"); mt103Creator.setBeneficiaryCustomer(beneficiaryCustomer); //70 mt103Creator.setRemittanceInformation("Remittance"); //71A // C14.当71A的值为BEN时,71F必须存在,71G不能存在。 mt103Creator.setDetailsofCharges("BEN"); //71F 71A为OUR时,此标签不能存在 /* List<DcDateCurAmtTagXXX> sendersChargeList = new ArrayList<>(); DcDateCurAmtTagXXX sendersCharge1 = new DcDateCurAmtTagXXX("71"); DcDateCurAmtTagXXX sendersCharge2 = new DcDateCurAmtTagXXX("71"); sendersCharge1.setCurrency("CNY"); sendersCharge1.setAmount(new BigDecimal("123.45")); sendersCharge2.setCurrency("USD"); sendersCharge2.setAmount(new BigDecimal("1000")); sendersChargeList.add(sendersCharge1); sendersChargeList.add(sendersCharge2); mt103Creator.setSendersCharges(sendersChargeList);*/ //71G mt103Creator.setReceiversCharges("CNY200,99"); /* DcDateCurAmtTagXXX receiversCharge = new DcDateCurAmtTagXXX("71"); receiversCharge.setCurrency("EUR"); receiversCharge.setAmount(new BigDecimal("200.99")); mt103Creator.setReceiversCharges(receiversCharge);*/ //72 mt103Creator.setSendertoReceiverInformation("/ACC/AddonInformation\r\n/INS/AddonInformation2"); //77B mt103Creator.setRegulatoryReporting("/ORDERRES/BE//MEILAAN 1, 9000 GENT"); MtCreatorManager.packMT(mt103Creator); } //不符合业务逻辑C16的测试方法。 @Test public void MT103_TEST_8() throws Exception { MT103Creator mt103Creator = new MT103Creator("103"); //20 mt103Creator.setSendersReference("SendersReference"); //13C List<String> timeIndications = new ArrayList<>(); timeIndications.add("/CLSTIME/0915+0100"); timeIndications.add("/RNCTIME/1030-0200"); mt103Creator.setTimeIndication(timeIndications); //23B mt103Creator.setBankOperationCode("CRED"); //23E List<String> instructionCodes = new ArrayList<>(); instructionCodes.add("TELI"); instructionCodes.add("CORT"); mt103Creator.setInstructionCode(instructionCodes); //26T mt103Creator.setTransactionTypeCode("K90"); //32A DcDateCurAmtTagXXX valDateCurAmt = new DcDateCurAmtTagXXX("32"); valDateCurAmt.setDate("201231"); valDateCurAmt.setCurrency("CNY"); valDateCurAmt.setAmount(new BigDecimal("10000")); mt103Creator.setValueDateCurrencyInterbankSettledAmount(valDateCurAmt); //33B DcDateCurAmtTagXXX currencyInstructedAmount = new DcDateCurAmtTagXXX("33"); currencyInstructedAmount.setCurrency("EUR"); currencyInstructedAmount.setAmount(new BigDecimal("100.00")); mt103Creator.setCurrencyInstructedAmount(currencyInstructedAmount); //36 mt103Creator.setExchangeRate("7.00"); //50a A ActnoBicAdrTagXXX orderingCustomer = new ActnoBicAdrTagXXX("50", "103"); orderingCustomer.setBic("CHASUS33XXX"); orderingCustomer.setAcctno("50AAccount"); mt103Creator.setOrderingCustomer(orderingCustomer); //51A ActnoBicAdrTagXXX sendingInstitution = new ActnoBicAdrTagXXX("51"); sendingInstitution.setBic("BOFAUS3NXXX"); sendingInstitution.setPartyIdentifier("51A_PartyIdentifier"); mt103Creator.setSendingInstitution(sendingInstitution); //52a A ActnoBicAdrTagXXX orderingInstitution = new ActnoBicAdrTagXXX("52"); orderingInstitution.setPartyIdentifier("52A_PartyIdentifier"); orderingInstitution.setBic("IRVTUS3NXXX"); mt103Creator.setOrderingInstitution(orderingInstitution); //53a A ActnoBicAdrTagXXX sendersCorrespondent = new ActnoBicAdrTagXXX("53"); sendersCorrespondent.setBic("HSBCHKHHHKH"); sendersCorrespondent.setInfo("C"); sendersCorrespondent.setPartyIdentifier("53A_PartyIdentifier"); mt103Creator.setSendersCorrespondent(sendersCorrespondent); //54a A ActnoBicAdrTagXXX receiversCorrespondent = new ActnoBicAdrTagXXX("54"); receiversCorrespondent.setBic("CITIUS33XXX"); receiversCorrespondent.setInfo("C"); receiversCorrespondent.setPartyIdentifier("54A_PartyIdentifier"); mt103Creator.setReceiversCorrespondent(receiversCorrespondent); //55a A ActnoBicAdrTagXXX thirdReimbursementInstitution = new ActnoBicAdrTagXXX("55"); thirdReimbursementInstitution.setBic("BARCHKHHXXX"); thirdReimbursementInstitution.setInfo("D"); thirdReimbursementInstitution.setPartyIdentifier("55A_PartyIdentifier"); mt103Creator.setThirdReimbursementInstitution(thirdReimbursementInstitution); //56a A //C16.当56a不存在时,23E不能填写TELI或PHOI。不符合时报错E44. // ActnoBicAdrTagXXX intermediaryInstitution = new ActnoBicAdrTagXXX("56"); // intermediaryInstitution.setBic("DHBKHKHHXXX"); // intermediaryInstitution.setInfo("C"); // intermediaryInstitution.setPartyIdentifier("56A_PartyIdentifier"); // mt103Creator.setIntermediaryInstitution(intermediaryInstitution); //57a A ActnoBicAdrTagXXX accountWithInstitution = new ActnoBicAdrTagXXX("57"); accountWithInstitution.setBic("BKTRUS33XXX"); accountWithInstitution.setInfo("D"); accountWithInstitution.setPartyIdentifier("57A_PartyIdentifier"); mt103Creator.setAccountWithInstitution(accountWithInstitution); //59a No Letter Option ActnoBicAdrTagXXX beneficiaryCustomer = new ActnoBicAdrTagXXX("59", "103"); beneficiaryCustomer.setAddress("59_Address"); mt103Creator.setBeneficiaryCustomer(beneficiaryCustomer); //70 mt103Creator.setRemittanceInformation("Remittance"); //71A mt103Creator.setDetailsofCharges("OUR"); //71F 71A为OUR时,此标签不能存在 /* List<DcDateCurAmtTagXXX> sendersChargeList = new ArrayList<>(); DcDateCurAmtTagXXX sendersCharge1 = new DcDateCurAmtTagXXX("71"); DcDateCurAmtTagXXX sendersCharge2 = new DcDateCurAmtTagXXX("71"); sendersCharge1.setCurrency("CNY"); sendersCharge1.setAmount(new BigDecimal("123.45")); sendersCharge2.setCurrency("USD"); sendersCharge2.setAmount(new BigDecimal("1000")); sendersChargeList.add(sendersCharge1); sendersChargeList.add(sendersCharge2); mt103Creator.setSendersCharges(sendersChargeList);*/ //71G mt103Creator.setReceiversCharges("CNY200,99"); /* DcDateCurAmtTagXXX receiversCharge = new DcDateCurAmtTagXXX("71"); receiversCharge.setCurrency("EUR"); receiversCharge.setAmount(new BigDecimal("200.99")); mt103Creator.setReceiversCharges(receiversCharge);*/ //72 mt103Creator.setSendertoReceiverInformation("/ACC/AddonInformation\r\n/INS/AddonInformation2"); //77B mt103Creator.setRegulatoryReporting("/ORDERRES/BE//MEILAAN 1, 9000 GENT"); MtCreatorManager.packMT(mt103Creator); } }