0

我正在使用万事达卡接口规范来打包字段 61,如下所示:

<isofieldpackager
    id="61"
    length="40"
    name="Point-of-Service (POS) Data"
    class="org.jpos.iso.IFB_LLBINARY"
    emitBitmap="false"
    packager="org.jpos.iso.packager.GenericSubFieldPackager">
    <isofield
        id="1"
        length="1"
        name="POS Terminal Attendance"
        class="org.jpos.iso.IF_CHAR"/>
    <isofield
        id="3"
        length="1"
        name="POS Terminal Location"
        class="org.jpos.iso.IF_CHAR"/>
    <isofield
        id="4"
        length="1"
        name="POS Cardholder Presence"
        class="org.jpos.iso.IF_CHAR"/>
    <isofield
        id="5"
        length="1"
        name="POS Card Presence"
        class="org.jpos.iso.IF_CHAR"/>
    <isofield
        id="6"
        length="1"
        name="POS Card Capture Capabilities"
        class="org.jpos.iso.IF_CHAR"/>
    <isofield
        id="7"
        length="1"
        name="POS Transaction Status"
        class="org.jpos.iso.IF_CHAR"/>
    <isofield
        id="8"
        length="1"
        name="POS Transaction Security"
        class="org.jpos.iso.IF_CHAR"/>
    <isofield
        id="10"
        length="1"
        name="Cardholder-Activated Terminal Level"
        class="org.jpos.iso.IF_CHAR"/>
    <isofield
        id="11"
        length="1"
        name="POS Card Data Terminal Input Capability Indicator"
        class="org.jpos.iso.IF_CHAR"/>
    <isofield
        id="12"
        length="2"
        name="POS Card Data Terminal Input Capability Indicator"
        class="org.jpos.iso.IF_CHAR"/>
    <isofield
        id="13"
        length="3"
        name="POS Country Code"
        class="org.jpos.iso.IF_CHAR"/>
</isofieldpackager>

然后我像这样调用打包程序:

ISOMsg message = new ISOMsg();
message.set("61.1", "1");       //Unattended terminal
    message.set("61.3", "2");       //Off premises of card acceptor facility
    message.set("61.4", "5");       //Electronic order (home PC, Internet, mobile phone, PDA)
    message.set("61.5", "1");       //Card not present
    message.set("61.6", "0");       //Terminal/operator has no card capture capability
    message.set("61.7", "0");       //Normal request (original presentment)
    message.set("61.8", "0");       //No security concern
    message.set("61.10", "6");      //Authorized Level 6 CAT: Electronic commerce
    message.set("61.11", "6");      //Key entry only
    message.set("61.12", "00");
    message.set("61.13", "716");    //country code Zimbabwe

但后来我得到了一个看起来像这样的异常:

    <log realm="channel/127.0.0.1:1234" at="2018-02-20T13:02:14.775" lifespan="31ms">
  <connect>
Exception in thread "main" org.jpos.iso.ISOException: error packing field 61 (org.jpos.iso.ISOException: java.lang.NullPointerException (java.lang.NullPointerException))
    at org.jpos.iso.ISOBasePackager.pack(ISOBasePackager.java:184)
    at org.jpos.iso.ISOMsg.pack(ISOMsg.java:456)
    at com.jpos.test.Test.main(Test.java:51)
Nested:org.jpos.iso.ISOException: java.lang.NullPointerException (java.lang.NullPointerException)
    at org.jpos.iso.packager.GenericSubFieldPackager.pack(GenericSubFieldPackager.java:167)
    at org.jpos.iso.ISOMsgFieldPackager.pack(ISOMsgFieldPackager.java:60)
    at org.jpos.iso.ISOBasePackager.pack(ISOBasePackager.java:175)
    at org.jpos.iso.ISOMsg.pack(ISOMsg.java:456)
    at com.jpos.test.Test.main(Test.java:51)
Nested:java.lang.NullPointerException
    at org.jpos.iso.packager.GenericSubFieldPackager.pack(GenericSubFieldPackager.java:136)
    at org.jpos.iso.ISOMsgFieldPackager.pack(ISOMsgFieldPackager.java:60)
    at org.jpos.iso.ISOBasePackager.pack(ISOBasePackager.java:175)
    at org.jpos.iso.ISOMsg.pack(ISOMsg.java:456)
    at com.jpos.test.Test.main(Test.java:51)
/home/terrence/.cache/netbeans/8.2/executor-snippets/run.xml:53: Java returned: 1
BUILD FAILED (total time: 1 second)

您能帮我理解为什么会出现此错误吗?我尝试更改打包程序上的数据类,并将通用子字段打包程序更改为使用 europay 子字段打包程序和相应的数据类,但我仍然得到相同的异常

4

1 回答 1

0

这是一个无位图字段。问题可能是字段 2 缺乏定义。另外,请注意该字段(我相信)IFB_LLLBINARY不是IFB_LLBINARY

于 2018-02-21T22:15:15.007 回答