In any fintech company in India, an important data point is the user's pan number which is used as primary identification.
A common strategy used in creating test users in such an application is generating a random pan number but one drawback with this approach is any newly generated pan should be checked against the database if it already exists to avoid a collision.
The better way is to serially generate the pan numbers to avoid a collision.
I believe it's an interesting problem of generating Pan Card numbers serially so I wrote an algorithm to do the same which would predictably generate a pan card number for a given number x.
Github: pan-number-generator
This could be used be imported in test cases to generate unique pan numbers and while masking pan data for production dumps.
The series would go as:
'AAAAA0000A', 'AAAAA0000B', 'AAAAA0000C', 'AAAAA0000D', 'AAAAA0000E', 'AAAAA0000F', 'AAAAA0000G', 'AAAAA0000H', 'AAAAA0000I', 'AAAAA0000J', 'AAAAA0000K', 'AAAAA0000L', 'AAAAA0000M', 'AAAAA0000N', 'AAAAA0000O', 'AAAAA0000P', 'AAAAA0000Q', 'AAAAA0000R', 'AAAAA0000S', 'AAAAA0000T', 'AAAAA0000U', 'AAAAA0000V', 'AAAAA0000W', 'AAAAA0000X', 'AAAAA0000Y', 'AAAAA0000Z', 'AAAAA0001A', 'AAAAA0001B', 'AAAAA0001C', 'AAAAA0001D', 'AAAAA0001E'
Top comments (0)