stripe-archive / jquery.payment

[DEPRECATED] A general purpose library for building credit card forms, validating inputs and formatting numbers.
MIT License
3.53k stars 686 forks source link

Externalize transformation and validation code #153

Closed bendrucker closed 9 years ago

bendrucker commented 9 years ago

Hey guys,

Wanted to open up a discussion on using a dependency to handle things like type detection, parsing, formatting, and validation. Ideally jquery.payment would be just that: jQuery bindings for a constant set of payment logic. There's no reason to have totally standalone implementations coupled to how you interact with the DOM (Ember, Angular, React, jQuery, raw, etc.).

I've written:

https://github.com/bendrucker/creditcards (32 unit tests) https://github.com/bendrucker/creditcards-types (45 unit tests)

The former is a user facing library for handling card numbers, expirations, and CVCs. The latter powers type detection, validation, and formatting for creditcards.

There's not 100% feature parity with jQuery.payments quite yet since I'm still working on the formatting implementation and adding support for a few European cards. I want to see if there's interest first, then we can talk about the build changes that would be required to support the use of dependencies.

jenanwise commented 9 years ago

Hi there! We definitely agree that jquery.payment is far too coupled, and separating these pieces is the right approach for new libraries. It looks like you've made some great progress on that front. jquery.payment itself will likely remain as-is for the time being, however.