Right padding F to PAN

565 views
Skip to first unread message

kapilashantha rajapaksha

unread,
Nov 16, 2011, 10:56:55 PM11/16/11
to jpos-...@googlegroups.com
Dear ALL

I having problem with PAN.

The host (bank) wants to right pad "F" at the end of PAN

I'm sending packet to host as follow,

021040200080008000021912341234123412341230020011003232323232323232000431323334

But host is accepting packet should be

02104020008000800002191234123412341234123F020011003232323232323232000431323334

My PAN definition as bellow

 <isofield
      id="2"
      length="19"
      name="PAN - PRIMARY ACCOUNT NUMBER"
      pad="false"
      class="org.jpos.iso.IFB_LLNUM"
/>


Please can you tell me how to fix this issue ?


Thanks and regards

chhil

unread,
Nov 17, 2011, 1:14:36 AM11/17/11
to jpos-...@googlegroups.com
I am a bit confused (happens a lot of times :)) your example shows you are using LLNUM not sure why a delimiter is required.

[19] [1234123412341234123]
So length is 19, followed by 19 characters, there is no room for an additional character in this field so how does the pad character come into picture?

-chhil


--
jPOS is licensed under AGPL - free for community usage for your open-source project. Licenses are also available for commercial usage.
Please support jPOS, contact: sa...@jpos.org
 
You received this message because you are subscribed to the "jPOS Users" group.
Please see http://jpos.org/wiki/JPOS_Mailing_List_Readme_first
To post to this group, send email to jpos-...@googlegroups.com
To unsubscribe, send email to jpos-users+...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/jpos-users

kapilashantha rajapaksha

unread,
Nov 17, 2011, 1:42:33 AM11/17/11
to jpos-...@googlegroups.com
Dear Chhil,

As default, it will pad "0", But I also confused why requiring padding "F".  However, Bank host sends success approval if we use only F padding mechanism. if not (Zero padding) it will reject

Examples,

 For PAN = 123412341234123
 15 123412341234123  -> 15 123412341234123F

 For PAN = 1234123412341234
 16 1234123412341234 -> 16 1234123412341234

Any advice

Regards

Marno Roux

unread,
Nov 17, 2011, 2:01:48 AM11/17/11
to jpos-...@googlegroups.com
Just a guess, and I might be totally wrong here.'

Try IFA_LLNUM?

I have also had the kind of problems and it helps trying different classes in my experience.

Also a lot of clients/vendors have their own custom flavor of implementation which makes things tricky sometimes, I think this might be the case here.

In scenarios like yours I have always extended classes to fit custom implementations for certain clients/vendors if none of the default JPOS classes can do what I need.

Good luck dude.

chhil

unread,
Nov 17, 2011, 2:19:10 AM11/17/11
to jpos-...@googlegroups.com
The newer example provided is assuming max length of 16 and padding the a length of 15 with an one F.
So if I understand your problem correctly its an LLNUM but always has to be a fixed length of 19 based on your field formatter or 16 based on the second example. Irrespective you always want to pad upto the max length.
The problem is your length indicator is not including the pad characters which does not sound correct.
Something is amiss either in the understanding or the spec if  I go by your example.

Can you confirm my statements above?

-chhil

Mark Salter

unread,
Nov 17, 2011, 2:39:01 AM11/17/11
to jpos-...@googlegroups.com
On 17/11/2011 03:56, kapilashantha rajapaksha wrote:

> The host (bank) wants to right pad "F" at the end of PAN

This will be conditional on an *odd* number of digits in the PAN and
indicates to me that the field carrying the key will be binary.

>
> I'm sending packet to host as follow,
>
> 021040200080008000021912341234123412341230020011003232323232323232000431323334

What is the actual form please?

Is this a character representation of a binary message or is this the
message?

>
> But host is accepting packet should be
>
> 02104020008000800002 19 1234123412341234123F020011003232323232323232000431323334

Same question as above.

>
> My PAN definition as bellow
>
> <isofield
> id="2"
> length="19"
> name="PAN - PRIMARY ACCOUNT NUMBER"
> pad="false"
> class="org.jpos.iso.IFB_LLNUM"
> />

Are you sure you are using this definition?

Can you show the code that is setting this field please and indicate any
variable types that are not obvious

As Chhil says, something is odd here.


--
Mark

chhil

unread,
Nov 17, 2011, 2:41:18 AM11/17/11
to jpos-...@googlegroups.com
A fine observation Mark ->

This will be conditional on an *odd* number of digits in the PAN and
indicates to me that the field carrying the key will be binary.

"something is odd here." ...pun intended ??? :)

-chhil



kapilashantha rajapaksha

unread,
Nov 17, 2011, 2:52:21 AM11/17/11
to jpos-...@googlegroups.com
Hi Chhil,

newer example says how the specification (Element 2) of banks host.

When card number length 15,17 and 19 (odd value ), last digit pad to F inserted of "0"(BCD)

When card number length 16,18 (even) no need to pad

Best regards
-Kapila

Mark Salter

unread,
Nov 17, 2011, 2:59:27 AM11/17/11
to jpos-...@googlegroups.com
On 17/11/2011 07:52, kapilashantha rajapaksha wrote:

> newer example says how the specification (Element 2) of banks host.
>
> When card number length 15,17 and 19 (odd value ), last digit pad to
> F inserted of "0"(BCD)
>
> When card number length 16,18 (even) no need to pad
>

If this is for field 2, then I think you will have to determine this
padding yourself - or derive a new field class to do the padding you
need here.

Can you also check that they are not talking about the PAN detail in any
*track* fields that may be present in your message please?


--
Mark

vsal...@gmail.com

unread,
Nov 17, 2011, 3:04:15 AM11/17/11
to jpos-...@googlegroups.com
Hi:

This is a common scenario with a BCD encoded numeric when the numeric's size is odd. 

Please use IFB_LLNUM in your packager, using the signature:

public IFB_LLNUM(int len, String description, boolean isLeftPadded, boolean fPadded) 

such as

new IFB_LLNUM(19,"My PAN",false,true); 

/V

vsal...@gmail.com

unread,
Nov 17, 2011, 3:10:45 AM11/17/11
to jpos-...@googlegroups.com
And after a half-asleep quick peek through the source code, there's even a nice IFB_FLLNUM field packager which when set to pad='true' in the GenericPackager configuration will take care of all this automatically :)

Cheers,

/V

kapilashantha rajapaksha

unread,
Nov 17, 2011, 3:18:13 AM11/17/11
to jpos-...@googlegroups.com

Hi Mark,


I just try to follow
http://jpos.1045706.n5.nabble.com/Field-35-padding-error-td2249601.html

So,
I create my own class called IFB_LLNUMF

And now my field 2 definition as bellow,


  <isofield
      id="2"
      length="19"
      name="PAN - PRIMARY ACCOUNT NUMBER"
      pad="false"
      class="IFB_LLNUMF"/>

My IFB_LLNUMF class as bellow,

public class IFB_LLNUMF extends ISOStringFieldPackager {
    public IFB_LLNUMF() {
        super(NullPadder.INSTANCE, BCDInterpreter.RIGHT_PADDED_F, BcdPrefixer.LL);
    }
    /**
     * @param len - field len
     * @param description symbolic descrption
     */
    public IFB_LLNUMF(int len, String description, boolean isLeftPadded) {
       
       
        super(len, description, NullPadder.INSTANCE,
                isLeftPadded ? BCDInterpreter.LEFT_PADDED_F : BCDInterpreter.RIGHT_PADDED_F,
                BcdPrefixer.LL);
       
        checkLength(len, 99);
    }
   
    public IFB_LLNUMF(int len, String description, boolean isLeftPadded, boolean fPadded) {
        super(len, description, NullPadder.INSTANCE,
                isLeftPadded ? BCDInterpreter.LEFT_PADDED_F :
                    (fPadded ? BCDInterpreter.RIGHT_PADDED_F : BCDInterpreter.RIGHT_PADDED_F),
                BcdPrefixer.LL);
      
        checkLength(len, 99);
    }

    public void setLength(int len)
    {
        checkLength(len, 99);
        super.setLength(len);
    }

    /** Must override ISOFieldPackager method to set the Interpreter correctly */
    public void setPad (boolean pad)
    {
         
        setInterpreter(pad ? BCDInterpreter.LEFT_PADDED_F : BCDInterpreter.RIGHT_PADDED_F);
        this.pad = pad;
    }
}


Now I'm getting packet by padding F but it is not right location

021040200080008000021912341234123412341F30020011003232323232323232000431323334

            ISOMsg m = new ISOMsg();

            GenericValidatingPackager packager1 = new GenericValidatingPackager();
            packager1.readFile("iso87binary.xml");
            m.setPackager(packager1);
       
            m.set(0,"0210");
            m.set(2,"1234123412341234123");
            m.set(11,"020011");
            m.set(25,"00");
            m.set(41,"22222222");
            m.set(63,"1234");
          
           byte pack[] = m.pack();


Please advice me

Regards







chhil

unread,
Nov 17, 2011, 3:48:00 AM11/17/11
to jpos-...@googlegroups.com
Take Victors advice, its answered in the same thread.

kapilashantha rajapaksha

unread,
Nov 17, 2011, 10:39:20 PM11/17/11
to jpos-...@googlegroups.com
Thanks

It is success

Regards
Reply all
Reply to author
Forward
0 new messages