Space padding to card number

26 views
Skip to first unread message

Kapilashantha Rajapaksha

unread,
May 18, 2023, 12:28:41 AM5/18/23
to jpos-...@googlegroups.com
Hi,

Let me know how to use xml file for padding space to card number (f-2)

Expected - 3032303037413338303639353238413138303030313635303138353535343232383131363037202020

My program generated - 3032303037413338303639353238413138303030313634383438313030303030383131363037

XML 

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

Andrés Alcarraz

unread,
May 18, 2023, 7:34:03 AM5/18/23
to jpos-...@googlegroups.com

Can you show the code that generated that?

It's weird to want to pad a variable length field. What was the PAN there? It seems different in the two fragments you pasted. Also, the bold part doesn't begin with a valid digit, so we don't know if you intended to include the previous 3 or not in both cases.

--
--
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 Google Groups "jPOS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jpos-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/CAKV%2BfV25cnzyjZ-p-i0ai8Jbhc%3DRsoqbWhSioUX9xiAe%2B3aAhw%40mail.gmail.com.

Alejandro Revilla

unread,
May 18, 2023, 7:42:14 AM5/18/23
to jpos-...@googlegroups.com
You can change the field packager to IFA_NUMERIC.

--

Andrés Alcarraz

unread,
May 18, 2023, 8:04:02 AM5/18/23
to jpos-...@googlegroups.com

Actually the 3136 seems to be the PAN length, and those 202020 don't seem to be part of the PAN.


3136: length 16 in ASCII

35303138353535343232383131363037: The 16 digits of PAN in ASCII

202020: three spaces that don't seem to be a part of the PAN

If that PAN is a production PAN, it should be considered compromised.

Best.

Andrés Alcarraz

murtuza chhil

unread,
May 18, 2023, 10:16:52 PM5/18/23
to jPOS Users
You cannot have pan length indicator to be 3136 i.e. 16 and then pad the pan with three spaces and make it 19. LL length must match the data.
313635303138353535343232383131363037202020

The parser needs to know when the current field ends and the next one begins. If I gave you this message with fields 2,3,4, how would you parse field 2 and get a padded pan ?

-chhil

Kapilashantha Rajapaksha

unread,
May 18, 2023, 11:31:16 PM5/18/23
to jpos-...@googlegroups.com
Host spec - 

image.png


image.png

This is same for 2, 32 and 37

So, I could able to manage this as below (may be not proper way)

<isofield

id="2"

length="21"

name="PAN - PRIMARY ACCOUNT NUMBER"

class="org.jpos.iso.IF_CHAR"/>

<isofield




chhil

unread,
May 19, 2023, 2:05:16 AM5/19/23
to jpos-...@googlegroups.com

You cannot use IF_CHAR if you need a length indicator prepended to it.
I would just pad the data to the max field length before setting it and make sure the length in the packager is at least that wide.
You possibly need to use IFA_LLCHAR

-chhil

You received this message because you are subscribed to a topic in the Google Groups "jPOS Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jpos-users/SsI_3yevm4c/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jpos-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/CAKV%2BfV0dfrpJ9dQ0Buvb74iecJnG40RgPqbZCsjtSBUexDBSiw%40mail.gmail.com.

chhil

unread,
May 19, 2023, 2:09:47 AM5/19/23
to jpos-...@googlegroups.com
Sorry , a correction, looking closer at the sample image, your IFA_CHAR field packager definition will work, just make sure to prepend the length of the pan to the pan (the leading 16 is the length followed by pan followed by padding to make it 21, the padding will be automatically taken care of.

-chhil

Mark Salter

unread,
May 19, 2023, 2:29:26 AM5/19/23
to jpos-...@googlegroups.com
Are you the issuer in this exchange?

Do you need to send both normal and special pans to this interface?
Is field 2 echoed back in responses?

That host spec owner needs some help though, what a terrible approach to use!
Their parser needs to check for padding after the length of pan indicated to then discard them and remember that the special case is in play - perhaps by leaving the dpaces to check later!

To handle this, you need a new field and I would expect you to need to write it too, unless someone has had to suffer this terrible approach before and can share!
The code is not too difficult, so I hope you are fine with this guidance.

Please do be careful sharing pictures of copyrighted documents here. You may be in breach of your licence or contract!

-- 
Mark
signature.asc

Mark Salter

unread,
May 19, 2023, 2:36:48 AM5/19/23
to jpos-...@googlegroups.com
I think fine Chhil,as long as the OP doesn't also need to send (and receive) normal pans too.

--
Mark
signature.asc

murtuza chhil

unread,
May 19, 2023, 9:58:49 AM5/19/23
to jPOS Users

Mark,

The attached spec snapshot states it clearly for DE2

This is a special fixed variable data-length field. The length indicator of this field must reflect the actual data length. However, the field must always be constructed and included in the message with its MAX field length. If the actual data length is less than the field maximum length, the data must be padded with trailing spaces
-chhil

Mark Salter

unread,
May 19, 2023, 11:08:46 AM5/19/23
to jpos-...@googlegroups.com
Agreed, I just wonder if this is a special case for the situation specified and potentially the same interface can also deal with normal cards.

I am presuming there is slightly more to it than currently has been shared.
If this host have created such a mess without need, then all hope is lost ;-) .


-- 
Mark


Sent from Proton Mail mobile



-------- Original Message --------
--
--
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 Google Groups "jPOS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jpos-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/d1c28f17-7c32-4e75-b934-b2fc49101606n%40googlegroups.com.
signature.asc

Alejandro Revilla

unread,
May 20, 2023, 10:59:30 AM5/20/23
to jpos-...@googlegroups.com
I would use the standard LL field and pad the field’s content from the application. Easier than prefixing it with the fixed length. There’s a handy ISOUtil.strpad for that.

--

chhil

unread,
May 20, 2023, 2:52:28 PM5/20/23
to jpos-...@googlegroups.com
Can't do that as length needs to be pan length  but field needs to be a fixed 21 done by padding. 

-chhil

You received this message because you are subscribed to a topic in the Google Groups "jPOS Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jpos-users/SsI_3yevm4c/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jpos-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/CAAgSK%3DkO1wMnUygA2i4gYdQZK6b5DHQ5M0zvMOR-Hf_NPf%3Dcxw%40mail.gmail.com.

Alejandro Revilla

unread,
May 20, 2023, 5:48:09 PM5/20/23
to jpos-...@googlegroups.com
Oh, time for an IFA_LLCRAZY field packager.

--

Andrés Alcarraz

unread,
May 20, 2023, 6:00:43 PM5/20/23
to jPOS Users

I would use an IF_CHAR of length 21 and fill it by hand.

Enviado desde mi móvil, disculpas por la brevedad

Reply all
Reply to author
Forward
0 new messages