Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vuetify-credit-card

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vuetify-credit-card - npm Package Compare versions

Comparing version 1.0.0-beta.1 to 1.0.0-beta.2

src/components/DefaultOptionsHelper.js

2

package.json
{
"name": "vuetify-credit-card",
"version": "1.0.0-beta.1",
"version": "1.0.0-beta.2",
"description": "Vue.js wrapper for credit card https://github.com/jessepollak/card with vuetify example and pugjs and stylus.",

@@ -5,0 +5,0 @@ "author": "Ilio Adriano de Oliveira Junior <ilioadriano@live.com>",

import Payment from 'payment/lib'
import DefaultOptionsHelper from './DefaultOptionsHelper'
const options = {
formatting: false,
monthYear: 'month/year',
validDate: 'valid\nthru',
cardTypes: [
'amex',
'dankort',
'dinersclub',
'discover',
'jcb',
'laser',
'maestro',
'mastercard',
'unionpay',
'visa',
'visaelectron',
'elo'
],
inputTypes: [
'number',
'name',
'expiry',
'cvc'
],
placeholders: {
number: '•••• •••• •••• ••••',
cvc: '•••',
expiry: '••/••',
name: 'Full Name'
}
}
class CardService {
constructor () {
this.options = DefaultOptionsHelper.options
this.emptyCreditCardData = DefaultOptionsHelper.emptyCreditCardData
const defaultClassDisplay = {
'jp-card-focused': false,
'jp-card-valid': false,
'jp-card-invalid': false
}
this.rules = {
number: val => Payment.fns.validateCardNumber(val),
name: val => !!val,
cvc: (val, cardType) => Payment.fns.validateCardCVC(val, cardType),
expiry: val => {
const valueObject = Payment
.fns
.cardExpiryVal(val)
const clone = (value) => {
return {...value}
}
return Payment.fns.validateCardExpiry(valueObject.month, valueObject.year)
},
validate: (type, value, cardType) => {
const rule = this.rules[type]
return rule(value, cardType)
}
}
const classDisplay = {
number: clone(defaultClassDisplay),
name: clone(defaultClassDisplay),
expiry: clone(defaultClassDisplay),
cvc: clone(defaultClassDisplay),
this.classDisplay = {
number: this.clone(DefaultOptionsHelper.classDisplay),
name: this.clone(DefaultOptionsHelper.classDisplay),
expiry: this.clone(DefaultOptionsHelper.classDisplay),
cvc: this.clone(DefaultOptionsHelper.classDisplay),
setClass: (type, className, value) => {
const classDisplayType = classDisplay[type]
classDisplayType[className] = value
setClass: (type, className, value) => {
const classDisplayType = this.classDisplay[type]
classDisplayType[className] = value
}
}
}
}
options
.inputTypes
.forEach(type => {
classDisplay[type] = {
'jp-card-focused': false,
'jp-card-valid': false,
'jp-card-invalid': false
}
})
const rules = {
number: val => Payment.fns.validateCardNumber(val),
name: val => !!val,
cvc: (val, cardType) => Payment.fns.validateCardCVC(val, cardType),
expiry: val => {
const valueObject = Payment
.fns
.cardExpiryVal(val)
return Payment.fns.validateCardExpiry(valueObject.month, valueObject.year)
},
validate: (type, value, cardType) => {
const rule = rules[type]
return rule(value, cardType)
clone (objectSource) {
return Object.assign({}, objectSource)
}
}
export default {
options,
rules,
classDisplay
}
export default new CardService()

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc