ps-ios20022.jar


/**
*解析ios20022相关xml报文
*/
String xml = "<message>"+
                "<AppHdr>.....</AppHdr>"+
                "<document>.....</document>"+
             "</message>";

AbstractMX msg = AbstractMX.parse(xml);
System.out.println(msg.getNamespace());
System.out.println(msg.getMxId());
System.out.println(msg.getFunctionality());
System.out.println(msg.getVariant());
System.out.println(msg.getVersion());
System.out.println(msg.getBusinessProcess());
System.out.println(msg.getAppHdr().from());


/**
*生成iOS20022相关xml报文
*/

/*
 * Initialize the MX object
 */
MXPacs00800108 mx = new MXPacs00800108();

/*
 * Initialize main message content main objects
 */
mx.setFIToFICstmrCdtTrf(new FIToFICustomerCreditTransferV08().setGrpHdr(new GroupHeader93()));

/*
 * General Information
 */
mx.getFIToFICstmrCdtTrf().getGrpHdr().setMsgId("11111");
//mx.getFIToFICstmrCdtTrf().getGrpHdr().setCreDtTm(OffsetDateTime.now(ZoneId.systemDefault()));
mx.getFIToFICstmrCdtTrf().getGrpHdr().setNbOfTxs("1");

/*
 * Settlement Information
 */
mx.getFIToFICstmrCdtTrf().getGrpHdr().setSttlmInf(new SettlementInstruction7());
mx.getFIToFICstmrCdtTrf().getGrpHdr().getSttlmInf().setSttlmMtd(SettlementMethod1Code.INDA);
mx.getFIToFICstmrCdtTrf().getGrpHdr().getSttlmInf().setSttlmAcct(
        (new CashAccount38()).setId(
                (new AccountIdentification4Choice()).setOthr(
                        (new GenericAccountIdentification1()).setId("2222222"))));

/*
 * Instructing Agent
 */
mx.getFIToFICstmrCdtTrf().getGrpHdr().setInstgAgt(
        (new BranchAndFinancialInstitutionIdentification6()).setFinInstnId(
                (new FinancialInstitutionIdentification18()).setBICFI("333333")));

/*
 * Instructed Agent
 */
mx.getFIToFICstmrCdtTrf().getGrpHdr().setInstdAgt(
        (new BranchAndFinancialInstitutionIdentification6()).setFinInstnId(
                (new FinancialInstitutionIdentification18()).setBICFI("4444444")));

/*
 * Payment Transaction Information
 */
CreditTransferTransaction39 cti = new CreditTransferTransaction39();

/*
 * Transaction Identification
 */
cti.setPmtId(new PaymentIdentification7());
cti.getPmtId().setInstrId("55555");
cti.getPmtId().setEndToEndId("666666");
cti.getPmtId().setTxId("777777");

/*
 * Transaction Amount
 */
ActiveCurrencyAndAmount amount = new ActiveCurrencyAndAmount();
amount.setCcy("XXX");
amount.setValue(new BigDecimal("88888"));
cti.setIntrBkSttlmAmt(amount);

/*
 * Transaction Value Date
 */


GregorianCalendar cal = new GregorianCalendar();
cal.setTime(date);
XMLGregorianCalendar gc = null;
try {
gc = DatatypeFactory.newInstance().newXMLGregorianCalendar(cal);
} catch (Exception e) {
logger.error("Date类型转换成XMLGregorianCalendar类型出错:"+e);
}


cti.setIntrBkSttlmDt(gc);

/*
 * Transaction Charges
 */
cti.setChrgBr(ChargeBearerType1Code.DEBT);

/*
 * Orderer Name & Address
 */
cti.setDbtr(new PartyIdentification135());
cti.getDbtr().setNm("XXXXXX");

/*
 * Orderer Account
 */
cti.setDbtrAcct(
        (new CashAccount38()).setId(
                (new AccountIdentification4Choice()).setOthr(
                        (new GenericAccountIdentification1()).setId("999999999"))));

/*
 * Order Financial Institution
 */
cti.setDbtrAgt(
        (new BranchAndFinancialInstitutionIdentification6()).setFinInstnId(
                (new FinancialInstitutionIdentification18()).setBICFI("aaaaaaaa")));

/*
 * Beneficiary Institution
 */
cti.setCdttrAgt((new BranchAndFinancialInstitutionIdentification6()).setFinInstnId(
        (new FinancialInstitutionIdentification18()).setBICFI("bbbbbbbbbb")));

/*
 * Beneficiary Name & Address
 */
cti.setCdttr(new PartyIdentification135());
cti.getCdttr().setNm("XXXXXXXX");

/*
 * Beneficiary Account
 */
cti.setCdttrAcct(
        (new CashAccount38()).setId(
                (new AccountIdentification4Choice()).setOthr(
                        (new GenericAccountIdentification1()).setId("a11111111"))));

mx.getFIToFICstmrCdtTrf().addCdtTrfTxInf(cti);

/*
 * Print the generated message in its XML format (without prefix)
 */
MxWriteConfiguration conf = new MxWriteConfiguration();
conf.documentPrefix = null;
System.out.println(mx.message(conf));

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值