gpt4 book ai didi

java - 如何使用 jpos 解析给定的行?

转载 作者:太空宇宙 更新时间:2023-11-04 09:15:26 24 4
gpt4 key购买 nike

我使用这个代码:

    import org.jpos.iso.ISOPackager;
import org.jpos.iso.packager.GenericPackager;
import org.jpos.iso.packager.ISO87BPackager;
import org.jpos.iso.ISOException;
import org.jpos.iso.ISOMsg;
import org.jpos.iso.ISOUtil;
import org.junit.Assert;

public class Utils {
public static ISOMsg ParseIsoMessage(String hexMsg) throws ISOException {
// convert hex string to byte array
byte[] bmsg =ISOUtil.hex2byte(hexMsg);
ISOMsg mes = new ISOMsg();
// set packager, change ISO87BPackager for the matching one.
mes.setPackager(new GenericPackager("resources\\packager.xml"));
//unpack the message using the packager
mes.unpack(bmsg);
//dump the message to standar output
mes.dump(System.out, "");
return mes;
}
}

102 字段

    packager.xml (
copy with iso87binary.xml with one change):
<isofield
id="102"
length="28"
name="ACCOUNT IDENTIFICATION 1"
class="org.jpos.iso.IFB_LLCHAR"/>



an error is issued:

org.jpos.iso.ISOException:org.jpos.iso.IFB_LLCHAR:解包字段 102 时出现问题(java.lang.ArrayIndexOutOfBoundsException:10187)解包字段=102,消耗=10187

at org.jpos.iso.ISOBasePackager.unpack(ISOBasePackager.java:340)
at org.jpos.iso.ISOMsg.unpack(ISOMsg.java:468)
at Utils.ParseIsoMessage(Utils.java:17)
at TestHostToHost.test0100(TestHostToHost.java:122)

请帮我看看问题出在哪里。也许另一个类需要在打包器中注册 55 字段?我尝试了不同的。如何解决这个问题?

用于解析的字符串:30313130F66032810EC3A20000000000070100001907013330040000000011000000000000001000123456789012121616112012345678182951022206 4300000006555444303739353633313830373739363937425A4E30305255343530303939323334323334353334202020202020003239303830303230353 9313930303133393536303131303030303030303030303800243831393030317A3835363031313030303030303030303038064306430042910A12073E49 A98826FD3030711C861A84DA0000158003770C060000271000000190A534793E8E0B5CF617464E5F4143434F554E545F4944454E543117464E5F4143434F55 4E545F4944454E543217464E5F5452414E535F4445534352495054000085F053C1024204E31DC11B54504F5254414C202020202020202020202020202020 2020202020E41381024401820513102800058306131028100454EA19FF0116D103543233D2024204D3034202D5D5024210D9025431

关于此数据存储在这一行中:

Message size 587
Message type 0100
P0002 PAN LEN=19 OFFS=21 '7013330040000000011'
P0003 Processing Code LEN=6 OFFS=31 '000000'
P0003-01 Transaction Type LEN=2 OFFS=31 '00'
P0003-02 Account Type (From) LEN=2 OFFS=32 '00'
P0003-03 Account Type (To) LEN=2 OFFS=33 '00'
P0004 Amount, Transaction LEN=12 OFFS=34 '000000001000'
P0006 Amount, Cardholder Billing LEN=12 OFFS=40 '123456789012'
P0007 Transmission Date and Time LEN=10 OFFS=46 '1127125301'
P0010 Conversion Rate, Cardholder Billing LEN=8 OFFS=51 '12345678'
P0011 Systems Trace Audit Number LEN=6 OFFS=55 '000082'
P0012 Time, Local Transaction LEN=6 OFFS=58 '125300'
P0013 Date, Local Transaction LEN=4 OFFS=61 '1127'
P0014 Date expiration LEN=4 OFFS=63 '2002'
P0018 Merchant Type LEN=4 OFFS=65 '1111'
P0019 Acq. Inst. Country Code LEN=3 OFFS=67 '222'
P0020 PAN Country Code LEN=3 OFFS=69 '643'
P0022 POS Entry Mode LEN=3 OFFS=71 '951'
P0023 Card Sequence Number LEN=3 OFFS=73 '000'
P0025 POS Condition Code LEN=2 OFFS=75 '00'
P0026 POS PIN Capture Code LEN=2 OFFS=76 '12'
P0028 Amount, Transaction Fee LEN=9 OFFS=77 '123456789'
P0032 Acquiring Inst. Ident Code LEN=6 OFFS=87 '555444'
P0033 Forwarding Inst. Ident. Code LEN=11 OFFS=91 '12345678901'
P0035 Track-2 Data LEN=37 OFFS=98 '7013330040000000011=70133300400000020'
P0037 Retrieval reference number LEN=12 OFFS=117 '511302068006'

(Wed Nov 27 2019 18:14:10.959000)
P0041 Card Acceptor Terminal Id LEN=8 OFFS=129 'RU450099'
P0042 Card Acceptor Ident. Code LEN=15 OFFS=137 '234234534 '
P0043 Card Acceptor Name/Location LEN=40 OFFS=152 'GPN >Arhagelsk RU'
P0045 Track-1 Data LEN=54 OFFS=193 'B4000001234567890^IVANOV/ABRAM^03101011123400567000000'
P0047 Proprietary Field 47 LEN=41 OFFS=249 '90800205918003101919001395601100000000008'
P0048 Proprietary Field 48 LEN=24 OFFS=292 '819001z85601100000000008'
P0049 Currency Code, Transaction LEN=3 OFFS=316 '643'
P0051 Currency Code, Cardholder Billing LEN=3 OFFS=318 '643'
P0055 Smart Card Specific Data LEN=99 OFFS=322 '9F3303E0F0C8950528000080009F37047EB5DF209F3602000182023C009C01009F1A0206439A031911279F02060000000010005F2A0206439F2701809F34034103029F101306010A03A430000B000000000003E0F34C860D9F2608B35C4C87CF835226'
P0055-9F33 Terminal Capabilities LEN=3 OFFS=325 'E0F0C8'
P0055-0095 TVR LEN=5 OFFS=330 '2800008000'
P0055-9F37 Unpredictable number LEN=4 OFFS=338 '7EB5DF20'
P0055-9F36 Application transaction counter LEN=2 OFFS=345 '0001'
P0055-0082 App interchange profile LEN=2 OFFS=349 '3C00'
P0055-009C Transaction Type LEN=1 OFFS=353 '00'
P0055-9F1A Terminal Country Code LEN=2 OFFS=357 '0643'
P0055-009A Transaction Date LEN=3 OFFS=361 '191127'
P0055-9F02 Amount, Authorised LEN=6 OFFS=367 '000000001000'
P0055-5F2A Transaction Currency Code LEN=2 OFFS=376 '0643'
P0055-9F27 Cryptogram info LEN=1 OFFS=381 '80'
P0055-9F34 CVM results LEN=3 OFFS=385 '410302'
P0055-9F10 Issuer application data LEN=19 OFFS=391 '06010A03A430000B000000000003E0F34C860D'
P0055-9F26 ARQC LEN=8 OFFS=413 'B35C4C87CF835226'
P0102 Account Identification-1 LEN=17 OFFS=429 'FN_ACCOUNT_IDENT1'
P0103 Account Identification-2 LEN=17 OFFS=447 'FN_ACCOUNT_IDENT2'
P0104 Transaction Description LEN=17 OFFS=465 'FN_TRANS_DESCRIPT'
P0112 Proprietary Field 112 LEN=88 OFFS=485 'F056C1024204E31DC11B54504F5254414C2020202020202020202020202020202020202020E41381024401820513102800058306131028100454EA1CFF0119D103543233D2034204D0D3034202D5D50442010D00D9025431'
F0 Local fleet data LEN=86 OFFS=487 'C1024204E31DC11B54504F5254414C2020202020202020202020202020202020202020E41381024401820513102800058306131028100454EA1CFF0119D103543233D2034204D0D3034202D5D50442010D00D9025431'
C1 Protocol Version LEN=2 OFFS=489 '4204'
E3 Vehicle And Driver info LEN=29 OFFS=493 'C11B54504F5254414C2020202020202020202020202020202020202020'
E4 POS Additional Info LEN=19 OFFS=524 '81024401820513102800058306131028100454'
EA Commodity Info LEN=28 OFFS=545 'FF0119D103543233D2034204D0D3034202D5D50442010D00D9025431'
FF01 LEN=25 OFFS=548
D1 Commodity Code LEN=3 OFFS=550 'T23'
D2 Quantity LEN=3 OFFS=555 '4204D0 (40000)'
D3 Price LEN=3 OFFS=560 '4202D5 (25000)'
D5 Cost LEN=4 OFFS=565 '42010D00 (100000)'
D9 Additional Data LEN=2 OFFS=571 'T1'

最佳答案

显示的数据和打印的原始消息不匹配原始消息不遵循打包程序定义的格式。该问题可能发生在字段 102 之前。

为了手动调试,您可以检查位图位置并查看位置是否符合规范。

关于java - 如何使用 jpos 解析给定的行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59089591/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com