UNPKG

ngx-payment-inputs

Version:

A set of Angular Directives to validate and format credit card inputs.

59 lines (58 loc) 2.7 kB
export declare const EMPTY_CARD_NUMBER = "Enter a card number"; export declare const EMPTY_EXPIRY_DATE = "Enter an expiry date"; export declare const EMPTY_CVC = "Enter a CVC"; export declare const EMPTY_ZIP = "Enter a ZIP code"; export declare const INVALID_CARD_NUMBER = "Card number is invalid"; export declare const INVALID_EXPIRY_DATE = "Expiry date is invalid"; export declare const INVALID_CVC = "CVC is invalid"; export declare const MONTH_OUT_OF_RANGE = "Expiry month must be between 01 and 12"; export declare const YEAR_OUT_OF_RANGE = "Expiry year cannot be in the past"; export declare const DATE_OUT_OF_RANGE = "Expiry date cannot be in the past"; /** * Check if a input value has reached max value based on card BIN * @param currentValue - current card number value without spaces * @returns if card number has reached max lenght */ export declare const hasCardNumberReachedMaxLength: (currentValue: string) => boolean; /** * check if value is a numeric type * @param e {KeyboardEvent} - Event from input * @returns if a value is a numeric value */ export declare const isNumeric: (e: KeyboardEvent) => boolean; /** * Validate card number luhn * @param cardNumber - card number without spaces */ export declare const validateLuhn: (cardNumber: string) => boolean; /** * Get all error messages from card number * @param cardNumber - card number without spaces * @param cardNumberValidator - fn to validate a card number * @param errorMessageObject - object with all error messages * @returns returns error message for card number */ export declare const getCardNumberError: (cardNumber: string, cardNumberValidator: any, { errorMessages }?: Record<string, any>) => any; /** * get all error messages from card expire date * @param expiryDate - expire date * @param expiryValidator - fn to validade a card expire date * @param errorMessageObject - object with all error message * @returns error message for date validation */ export declare const getExpiryDateError: (expiryDate: any, expiryValidator: any, { errorMessages }?: Record<string, any>) => any; /** * get all error messages from card cvc * @param cvc - cvc number * @param cvcValidator - validator fn for cvc * @param errorMessageObject - object with all error message * @returns error message for cvc */ export declare const getCVCError: (cvc: string, cvcValidator: any, { cardType, errorMessages }?: Record<string, any>) => any; /** * get all error messages from card cvc * @param zip - zip code * @param errorMessageObject - object with all error message * @returns error message for zip code */ export declare const getZIPError: (zip: any, { errorMessages }?: Record<string, any>) => any;