Mini Shell
'use strict';
$(document).ready(function() {
//credit card
var card = new Card({form: '.active form', container: '.card-wrapper'});
//debitcard
var owner = $('#owner');
var cardNumber = $('#cardNumber');
var cardNumberField = $('#card-number-field');
var CVV = $("#cvv");
var mastercard = $("#mastercard");
var confirmButton = $('#confirm-purchase');
var visa = $("#visa");
var amex = $("#amex");
// Use the payform library to format and validate
// the payment fields.
cardNumber.payform('formatCardNumber');
CVV.payform('formatCardCVC');
cardNumber.keyup(function() {
amex.removeClass('transparent');
visa.removeClass('transparent');
mastercard.removeClass('transparent');
if ($.payform.validateCardNumber(cardNumber.val()) == false) {
cardNumberField.addClass('has-error');
} else {
cardNumberField.removeClass('has-error');
cardNumberField.addClass('has-success');
}
if ($.payform.parseCardType(cardNumber.val()) == 'visa') {
mastercard.addClass('transparent');
amex.addClass('transparent');
} else if ($.payform.parseCardType(cardNumber.val()) == 'amex') {
mastercard.addClass('transparent');
visa.addClass('transparent');
} else if ($.payform.parseCardType(cardNumber.val()) == 'mastercard') {
amex.addClass('transparent');
visa.addClass('transparent');
}
});
confirmButton.on('click',function(e) {
e.preventDefault();
var isCardValid = $.payform.validateCardNumber(cardNumber.val());
var isCvvValid = $.payform.validateCardCVC(CVV.val());
});
});
Zerion Mini Shell 1.0