envylabs/vaulted_billing

Extracting PAN number from zero padded masked credit card

ticketevo opened this issue · 3 comments

In the code, it tries to extract a zero padded number from the credit card string. The last four digits could already be zero padded, so when using the 'sprintf' functionality can raise an exception..

For example,

>> "XX%04d" % ["0099"]
ArgumentError: invalid value for Integer(): "0099"

A possible fix:

>> "XX%04d" % ["0099".to_i]
"XX0099"

Hmm... thanks! Did you guys want to submit a pull request or should I go ahead and patch it up?

We are working off a vendored gem, our patch would not fit the current git repo.

Alright. Thanks for the heads up. I'll add some specs around the issue and get it resolved... or pawn it off on @adamfortuna. ;)