function validateCardInputs (recurly, inputs) {
  const format = formatFieldValidationError;
  let errors = [];

  if (!cardNumber(inputs.number)) {
    errors.push(format('number', INVALID));
  }

  if (!expiry(inputs.month, inputs.year)) {
    errors.push(format('month', INVALID), format('year', INVALID));
  }

  if (!inputs.first_name) {
    errors.push(format('first_name', BLANK));
  }

  if (!inputs.last_name) {
    errors.push(format('last_name', BLANK));
  }

  if (~recurly.config.required.indexOf('cvv') && !inputs.cvv) {
    errors.push(format('cvv', BLANK));
  } else if ((~recurly.config.required.indexOf('cvv') || inputs.cvv) && !cvv(inputs.cvv)) {
    errors.push(format('cvv', INVALID));
  }

  each(recurly.config.required, function(field) {
    if (!inputs[field] && ~CARD_FIELDS.indexOf(field)) {
      errors.push(format(field, BLANK));
    }
  });

  debug('validate errors', errors);

  return errors;
}
/**
 * Checks user input on a card token call
 *
 * @param {Recurly} recurly
 * @param {Object} inputs
 * @return {Array} formatted array of invalid fields with descriptive messages
 */
Checks user input on a card token call
@param {Recurly} recurly
@param {Object} inputs
@return {Array} formatted array of invalid fields with descriptive messages
Checks user input on a card token call @param { Recurly } recurly @param { Object } inputs @return { Array } formatted array of invalid fields with descriptive messages
function validateCardInputs (recurly, inputs) {
  const format = formatFieldValidationError;
  let errors = [];
  if (!cardNumber(inputs.number)) {
    errors.push(format('number', INVALID));
  }
  if (!expiry(inputs.month, inputs.year)) {
    errors.push(format('month', INVALID), format('year', INVALID));
  }
  if (!inputs.first_name) {
    errors.push(format('first_name', BLANK));
  }
  if (!inputs.last_name) {
    errors.push(format('last_name', BLANK));
  }
  if (~recurly.config.required.indexOf('cvv') && !inputs.cvv) {
    errors.push(format('cvv', BLANK));
  } else if ((~recurly.config.required.indexOf('cvv') || inputs.cvv) && !cvv(inputs.cvv)) {
    errors.push(format('cvv', INVALID));
  }
  each(recurly.config.required, function(field) {
    if (!inputs[field] && ~CARD_FIELDS.indexOf(field)) {
      errors.push(format(field, BLANK));
    }
  });
  debug('validate errors', errors);
  return errors;
}
function validateCardInputs ( recurly , inputs ) { const format = formatFieldValidationError ; let errors = [ ] ; if ( ! cardNumber ( inputs . number ) ) { errors . push ( format ( 'number' , INVALID ) ) ; } if ( ! expiry ( inputs . month , inputs . year ) ) { errors . push ( format ( 'month' , INVALID ) , format ( 'year' , INVALID ) ) ; } if ( ! inputs . first_name ) { errors . push ( format ( 'first_name' , BLANK ) ) ; } if ( ! inputs . last_name ) { errors . push ( format ( 'last_name' , BLANK ) ) ; } if ( ~ recurly . config . required . indexOf ( 'cvv' ) && ! inputs . cvv ) { errors . push ( format ( 'cvv' , BLANK ) ) ; } else if ( ( ~ recurly . config . required . indexOf ( 'cvv' ) || inputs . cvv ) && ! cvv ( inputs . cvv ) ) { errors . push ( format ( 'cvv' , INVALID ) ) ; } each ( recurly . config . required , function ( field ) { if ( ! inputs [ field ] && ~ CARD_FIELDS . indexOf ( field ) ) { errors . push ( format ( field , BLANK ) ) ; } } ) ; debug ( 'validate errors' , errors ) ; return errors ; }
Checks user input on a card token call
 @param {Recurly} recurly
 @param {Object} inputs
 @return {Array} formatted array of invalid fields with descriptive messages
Checks user input on a card token call @param { Recurly } recurly @param { Object } inputs @return { Array } formatted array of invalid fields with descriptive messages