pub struct Validator;Available on crate feature
std only.Expand description
Validator for ISO 8583 messages and fields
Implementations§
Source§impl Validator
impl Validator
Sourcepub fn validate_pan(pan: &str) -> bool
pub fn validate_pan(pan: &str) -> bool
Validate Primary Account Number (PAN) using Luhn algorithm
The Luhn algorithm (mod-10 algorithm) is used to validate credit card numbers.
§Algorithm
- Starting from the rightmost digit (check digit), double every second digit
- If doubling results in a two-digit number, add the digits
- Sum all digits
- If sum is divisible by 10, the number is valid
§Example
use iso8583_core::validation::Validator;
assert!(Validator::validate_pan("4111111111111111")); // Valid test card
assert!(!Validator::validate_pan("4111111111111112")); // InvalidSourcepub fn validate_field_format(field: Field, value: &FieldValue) -> Result<()>
pub fn validate_field_format(field: Field, value: &FieldValue) -> Result<()>
Validate field format based on field type
Sourcepub fn validate_field_value(field: Field, value: &FieldValue) -> Result<()>
pub fn validate_field_value(field: Field, value: &FieldValue) -> Result<()>
Validate specific field values
Sourcepub fn validate_required_fields(msg: &ISO8583Message) -> Result<()>
pub fn validate_required_fields(msg: &ISO8583Message) -> Result<()>
Validate required fields for a message type
Sourcepub fn validate_date_mmdd(date: &str) -> bool
pub fn validate_date_mmdd(date: &str) -> bool
Validate date format (MMDD)
Sourcepub fn validate_time_hhmmss(time: &str) -> bool
pub fn validate_time_hhmmss(time: &str) -> bool
Validate time format (hhmmss)
Sourcepub fn validate_currency_code(code: &str) -> bool
pub fn validate_currency_code(code: &str) -> bool
Validate currency code (ISO 4217)
Auto Trait Implementations§
impl Freeze for Validator
impl RefUnwindSafe for Validator
impl Send for Validator
impl Sync for Validator
impl Unpin for Validator
impl UnsafeUnpin for Validator
impl UnwindSafe for Validator
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more