Giter Site home page Giter Site logo

Comments (8)

jessepollak avatar jessepollak commented on July 22, 2024

How do you envision this working? What would the function return?

from card.

Zakay avatar Zakay commented on July 22, 2024

Just a rough example on how this could work:

$('form').card({
    ...
    detection: function (card_number) {
       return card_number == '123' ? 'visa' : 'mastercard';
    }
    ...
});

Card will use given detection method when given otherwise using the built-in one.
This way developers could easily hook in other detection methods, in my case I would hook stripe's js lib here to return the correct card type.

from card.

jessepollak avatar jessepollak commented on July 22, 2024

It uses Stripe's jquery.payment library right now to do the detection. That said, if you'd like to submit a PR, I'd be happy to merge it in.

from card.

lipis avatar lipis commented on July 22, 2024

Totally worth reading and there is no need to use something that complicated like jquery.payment: http://creditcardjs.com/credit-card-type-detection

from card.

Zakay avatar Zakay commented on July 22, 2024

The suggestion was not to diss or praise any detection algorithm. Just simply to add the possibility to connect this "view" to whatever detection algorithm is used by the payment provider.

Because it uses Stripes jquery.payment I won't be needing it just now, but maybe in the future. Will see!

from card.

quedicesebas avatar quedicesebas commented on July 22, 2024

I'm with @lipis

from card.

Zakay avatar Zakay commented on July 22, 2024

With a detection callback a developer could go much further and detect issuing bank and display an even more correct view of that credit card. I already love that it shows Visa/AmEx etc, and the library shouldn't go much further, but adding an ability to override the detection method won't make the library more complex, it just adds a nice feature for those who want to go a step further and display local bank credit cards.

from card.

jessepollak avatar jessepollak commented on July 22, 2024

Hi all, thanks for your feedback! I like this idea, unfortunately, making the change requires a pretty big logic shift around how we do credit card detection. Right now, I don't have the bandwidth to make that change and there's not enough demand to motivate me to create that bandwidth.

I'm closing the issue for now. If you'd like to create a PR to make the change, I would love to support you in making that happen (especially if you've never contributed before). I'm always around to help answer questions.

from card.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.