prolificinteractive / Caishen

A Payment Card UI & Validator for iOS
MIT License
766 stars 119 forks source link

Custom card type that doesn't require expiration date and CVC #59

Closed ThibaultKlein closed 8 years ago

ThibaultKlein commented 8 years ago

Hi,

Would it be possible to handle card types that don't handle expiration date and CVC? So only the card number field displays and validates, the rest is ignored.

Thanks!

DannyVancura commented 8 years ago

Hey, It should be possible to just use NumberInputTextField for that. Another option might be to subclass CardTextField and override the moveCardNumberOut method (currently only available on branch chore/number_animation_access, PR pending) to call super. moveCardNumberOut only when a certain card type has been detected (or any other condition you might have for this). Also you'd have to handle the validation result accordingly (accept invalid expiration date and cvc).

ThibaultKlein commented 8 years ago

That makes sense but it seems a little bit "tricky", if possible that would be great to build this feature, or provide some documentation in the README on how to achieve this.

DannyVancura commented 8 years ago

I see that especially hiding the CVC might be useful to have. I just created PR #63 which tackles this issue by adding an option to make the expiry and/or cvc required.