envylabs/vaulted_billing — Issue #4: Extracting PAN number from zero padded masked credit card
Author: pivotal-evo
Created: 2011-11-15 15:01:16+00:00
State: open

In the [code](https://github.com/envylabs/vaulted_billing/blob/develop/lib/vaulted_billing/gateways/ipcommerce.rb#L345), 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"
```