Ejemplo n.º 1
0
/**
 * Validates the credit card info
 *
 * @access  private
 * @since   1.0
 * @return  array
 */
function give_purchase_form_validate_cc()
{
    $card_data = give_get_purchase_cc_info();
    // Validate the card zip
    if (!empty($card_data['card_zip'])) {
        if (!give_purchase_form_validate_cc_zip($card_data['card_zip'], $card_data['card_country'])) {
            give_set_error('invalid_cc_zip', esc_html__('The zip / postal code you entered for your billing address is invalid.', 'give'));
        }
    }
    //Ensure no spaces
    if (!empty($card_data['card_number'])) {
        $card_data['card_number'] = str_replace('+', '', $card_data['card_number']);
        //no "+" signs
        $card_data['card_number'] = str_replace(' ', '', $card_data['card_number']);
        // No spaces
    }
    // This should validate card numbers at some point too
    return $card_data;
}
Ejemplo n.º 2
0
/**
 * Validates the credit card info
 *
 * @access  private
 * @since   1.0
 * @return  array
 */
function give_purchase_form_validate_cc()
{
    $card_data = give_get_purchase_cc_info();
    // Validate the card zip
    if (!empty($card_data['card_zip'])) {
        if (!give_purchase_form_validate_cc_zip($card_data['card_zip'], $card_data['card_country'])) {
            give_set_error('invalid_cc_zip', __('The zip / postal code you entered for your billing address is invalid', 'give'));
        }
    }
    // This should validate card numbers at some point too
    return $card_data;
}