{"size": 1569, "ext": "js", "max_stars_repo_path": "public/scripts/payment.js", "max_stars_repo_name": "AyumiizZ/SoftengProject", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "public/scripts/payment.js", "max_issues_repo_name": "AyumiizZ/SoftengProject", "max_issues_repo_issues_event_min_datetime": "2018-11-14T14:42:52.000Z", "max_issues_repo_issues_event_max_datetime": "2019-06-17T01:25:27.000Z", "max_forks_repo_path": "public/scripts/payment.js", "max_forks_repo_name": "AyumiizZ/SoftengProject", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": 22, "max_forks_count": null, "avg_line_length": 27.0517241379, "max_line_length": 51, "alphanum_fraction": 0.5615041428}
var valid = require("card-validator");

$("#cardnumber").mask("0000 0000 0000 0000");
$("#cvc").mask("000", {
  placeholder: "000"
});
$("#expire").mask("00/00", {
  placeholder: "MM/YY"
});
$('[data-toggle="popover"]').popover();

$("#cardnumber").keyup(function() {
  var number = $("#cardnumber").cleanVal();
  var numberValidation = valid.number(number);
  $("#credit-card-icon").removeClass();
  if (numberValidation.card != null) {
    var cardType = numberValidation.card.type;
    if (cardType == "visa") {
      $("#credit-card-icon")
        .addClass("fab")
        .addClass("fa-cc-visa");
    } else if (cardType == "mastercard") {
      $("#credit-card-icon")
        .addClass("fab")
        .addClass("fa-cc-mastercard");
    } else if (cardType == "jcb") {
      $("#credit-card-icon")
        .addClass("fab")
        .addClass("fa-cc-jcb");
    } else {
      $("#credit-card-icon")
        .addClass("far")
        .addClass("fa-credit-card");
    }
  } else {
    $("#credit-card-icon")
      .addClass("far")
      .addClass("fa-credit-card");
  }
  $("#credit-card-icon").addClass("fa-2x");
});

$("#cardnumber").change(function() {
  var number = $("#cardnumber").cleanVal();
  var numberValidation = valid.number(number);
  if (numberValidation.isValid) {
    $("#card-form button").attr("disabled", false);
    $("#cardnumber")
      .removeClass("is-invalid")
      .addClass("is-valid");
  } else {
    $("#card-form button").attr("disabled", true);
    $("#cardnumber")
      .addClass("is-invalid")
      .removeClass("is-valid");
  }
});
