-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(core): implement NameType
for name validation
#6734
base: main
Are you sure you want to change the base?
Conversation
@@ -710,6 +712,17 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsRequest> for Pa | |||
payment_method_data_billing.get_billing_address() | |||
}); | |||
|
|||
// validate billing name for card holder name | |||
helpers::validate_billing_name( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
create a domain type which will have these validations, use the domain type wherever validations are required
NameType
for name validation
NameType
for name validationNameType
for name validation
// pub struct NameTypeValidationErr(&'static str); | ||
|
||
#[derive(Clone, Default, Debug, Eq, PartialEq, Serialize)] | ||
pub struct NameType(Secret<LengthString<256, 1>>); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we move this to common_utils or common_types, since this is not specific to cards as you have used this in all the other payment methods as well
Type of Change
Description
for card holder name in cards, validation is added before creation of request to flag invalid data in case it is present.
Reference is taken from Visa Documetation
Additional Changes
Motivation and Context
How did you test it?
Checklist
cargo +nightly fmt --all
cargo clippy