Closed robrez closed 8 years ago
I would like to be able to incorporate 'allowable cardType(s)' into the validation routine.
My first instinct was to set card-type to a specific value. (I think card-type should be flagged as readOnly: true).
card-type
I was considering something like this...
var opts = { amex: true, visa: true }; or var opts = [ 'amex', 'visa' ]; ... <gold-cc-input card-types="[[opts]]">
And then patching the validate function..
var valid = result.valid && result.length_valid; this.cardType = valid ? result.card_type.name : ''; + if (valid && this.cardTypes !== null && this.cardTypes.length > 0) { + valid = this.cardTypes.indexOf(this.cardType) !== -1; //or .includes()? + }
Any thoughts? Edit: I'm thinking cardType should be empty if invalid.
I think this is a great idea! (I left a comment on your PR, but it's almost ready to merge)
This can be closed :)
Enhancement added via https://github.com/PolymerElements/gold-cc-input/pull/39
I would like to be able to incorporate 'allowable cardType(s)' into the validation routine.
My first instinct was to set
card-type
to a specific value. (I think card-type should be flagged as readOnly: true).I was considering something like this...
And then patching the validate function..
Any thoughts? Edit: I'm thinking cardType should be empty if invalid.