1 Byte Bitmap where left most digit represents presence of data element

74 views
Skip to first unread message

Ritz C

unread,
Apr 8, 2022, 1:29:07 PM4/8/22
to jPOS Users
Hello,
We are processing Custom message processing with 1 Byte Bitmap where left most digit represents presence of data element.
We created this xml:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE isopackager SYSTEM "genericpackager.dtd">

<isopackager>
  <isofield
      id="0"
      length="4"
      name="MESSAGE TYPE INDICATOR"
      class="org.jpos.iso.IFA_NUMERIC"/>
  <isofield
      id="1"
      length="1"
      name="BIT MAP"
      class="org.jpos.iso.IFA_BITMAP"/>
  <isofield
      id="2"
      length="19"
      name="PAN"
      class="org.jpos.iso.IFA_LLCHAR"/>
 <isofield
      id="3"
      length="4"
      name="DATE, EXPIRATION"
      class="org.jpos.iso.IFA_NUMERIC"/>
  <isofield
      id="4"
      length="10"
      name="AMOUNT, TRANSACTION"
      pad="true"
      class="org.jpos.iso.IFA_NUMERIC"/>
  <isofield
      id="5"
      length="2"
      name="RESPONSE CODE"
      class="org.jpos.iso.IF_CHAR"/>
  <isofield
      id="6"
      length="80"
      name="CARD HOLDER NAME"
      class="org.jpos.iso.IFA_LLCHAR"/>
  <isofield
      id="7"
      length="5"
      name="ZIPCODE"
      class="org.jpos.iso.IFA_NUMERIC"/>
    </isopackager>

We used Generic Packager and It's not able to identify all the fields that are present in the message as left most bit is not used for data element presence with IFA_BITMAP.

Then we changed BITMAP class to this class org.jpos.iso.packager.Base1_BITMAP126
Now we get this parsing error:

Message = 0100e016567878911145111102260000001000
java.lang.Exception: org.jpos.iso.ISOException: org.jpos.iso.IFA_LLCHAR: Problem unpacking field 2 (org.jpos.iso.ISOException: Field length 78 too long. Max: 19) unpacking field=2, consumed=12
    at com.highnote.prompt.Checkjpos.parseISOMessage(Checkjpos.java:35)
    at com.highnote.prompt.Checkjpos.main(Checkjpos.java:13)
Caused by: org.jpos.iso.ISOException: org.jpos.iso.IFA_LLCHAR: Problem unpacking field 2 (org.jpos.iso.ISOException: Field length 78 too long. Max: 19) unpacking field=2, consumed=12
    at org.jpos.iso.ISOBasePackager.unpack(ISOBasePackager.java:341)
    at org.jpos.iso.ISOMsg.unpack(ISOMsg.java:479)
    at com.highnote.prompt.Checkjpos.parseISOMessage(Checkjpos.java:32)
    ... 1 more

This our parser method:
 private ISOMsg parseISOMessage() throws Exception {
        String message = "0100e016567878911145111102260000001000";
        //String message = "0100ec1651051051051051001225000001100011MASTER YODA90089";
        System.out.printf("Message = %s%n", message);
        try {
            // Load package from resources directory.
            InputStream is = getClass().getResourceAsStream("/simpleMessageFields.xml");
            GenericPackager packager = new GenericPackager(is);
            //Base1SubFieldPackager packager = new Base1SubFieldPackager();
             
            ISOMsg isoMsg = new ISOMsg();
            isoMsg.setPackager(packager);
            isoMsg.unpack(message.getBytes());
                        return isoMsg;
        } catch (ISOException e) {
            throw new Exception(e);
        }
    }

Any suggestions on what BitMap class to use an dwhat packager to use in this scenario

murtuza chhil

unread,
Apr 11, 2022, 11:03:21 PM4/11/22
to jPOS Users
JPOS bitmaps follow ISO8583. If the MSB has a 1 it indicates a presnce of a secondary bitmap.

I assume your bitmap is e0.  
hex E0 = Binary 1110 0000
As soon as the left most bit is 1, a secondary bitmap is assumed, and additional bytes get consumed. In your case you don't have a secondary bitmap, the field data follows the primary bitmap.


You can take a look at an example of writing a custom bitmap packager here 

You would need to remove checks for secondary and tertiary bitmap packagers which is normally done as in here

A similar question

-chhil

Ritz C

unread,
Apr 12, 2022, 5:21:36 PM4/12/22
to jPOS Users
Thank you chhil. I solved it using this custom packager:

package com.highnote.prompt;

import org.jpos.iso.IFA_BINARY;
import org.jpos.iso.IFA_BITMAP;
import org.jpos.iso.IFA_LLCHAR;
import org.jpos.iso.IFA_NUMERIC;
import org.jpos.iso.IF_CHAR;
import org.jpos.iso.ISOBasePackager;
import org.jpos.iso.ISOComponent;
import org.jpos.iso.ISOFieldPackager;
import org.jpos.iso.ISOPackager;


public class CustomPackager extends ISOBasePackager {
    protected ISOFieldPackager bitMapPackager =
        new IFA_BITMAP (1, "BIT MAP");


    protected ISOFieldPackager fld[] = {
            new IFA_NUMERIC(     4, "MESSAGE TYPE"                          ),
            new IFA_LLCHAR (    19, "PAN - PRIMARY ACCOUNT NUMBER"          ),
            new IFA_NUMERIC(     4, "EXPIRATION DATE"                       ),
            new IFA_NUMERIC(    10, "AMOUNT, TRANSACTION"                   ),
            new IF_CHAR(    2, "RESPONSE CODE"                    ),
            new IFA_LLCHAR(    80, "CARDHOLDER NAME"            ),
            new IFA_NUMERIC(     5, "ZIPCODE"    ),
            new IFA_BINARY(      0, "UNUSED"                                ),
            new IFA_BINARY(      0, "UNUSED"                                )            
        };

           
    public CustomPackager() {
        super();
        setFieldPackager(fld);
    }
    /**
     * @return suitable ISOFieldPackager for Bitmap
     */
    protected ISOFieldPackager getBitMapfieldPackager() {
        return bitMapPackager;
    }
    /**
     * Although field 1 is not a Bitmap ANSI X9.2 do have
     * a Bitmap field that have to be packed/unpacked
     * @return true
     */
    protected boolean emitBitMap () {
        return true;
    }

 
    protected int getMaxValidField() {
        return 8;
    }
}

I did it without xml. is there a way I can define this using xml?

murtuza chhil

unread,
Apr 13, 2022, 1:18:01 AM4/13/22
to jPOS Users
In your case , the way you are doing it, I don't think you can do it in xml .

If you want to use xml you can write your bitmap class for packing unpacking and use it in the xml.

-chhil

Reply all
Reply to author
Forward
0 new messages