jessepollak / card

:credit_card: make your credit card form better in one line of code
MIT License
11.67k stars 1.48k forks source link

Security code when American Express card #464

Closed kleyber-ribeiro closed 3 years ago

kleyber-ribeiro commented 4 years ago

Hi All,

I've included this fantastic job in my site. I just found that when is American Express card, the Security Code is a 4 digits way and when I try to put the Security Code, it does not make the effect of showing the side of the card to show the Security Code. I've done this way:

new Card({ form: $('form[name="F1"]')[0], container: '.card-wrapper', formSelectors: { numberInput: '#id_sc_field_numero_cartao', expiryInput: '#id_sc_field_validade_cartao', cvcInput: '#id_sc_field_codigo_cartao', nameInput: '#id_sc_field_nome_cartao' }, placeholders: { number: ' ', name: 'NOME NO CARTÃO', expiry: '/**', cvc: '****' }, masks: { cardNumber: '•' }, formatting: true });

See the image:

image

How can I solve this?

Thanks in advance,

melloware commented 3 years ago

Update to 2.5.0 release as you can see Amex is already set to 4 CVC see the code here:

https://github.com/jessepollak/payment/blob/fd591e08e31edbf1b70f00235da4ab6f0c460f31/dist/payment.js#L57-L62

        type: 'amex',
        pattern: /^3[47]/,
        format: /(\d{1,4})(\d{1,6})?(\d{1,5})?/,
        length: [15],
        cvcLength: [4],
        luhn: true