Skip to content

Commit

Permalink
fix(connector): [novalnet] Remove first name, last name as required f…
Browse files Browse the repository at this point in the history
…ields for Applepay, Googlepay, Paypal (#7152)
  • Loading branch information
cookieg13 authored and Narayanbhat166 committed Feb 6, 2025
1 parent f225e86 commit 3e116b8
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 60 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ pub struct NovalnetPaymentsRequestBilling {

#[derive(Default, Debug, Serialize, Clone)]
pub struct NovalnetPaymentsRequestCustomer {
first_name: Secret<String>,
last_name: Secret<String>,
first_name: Option<Secret<String>>,
last_name: Option<Secret<String>>,
email: Email,
mobile: Option<Secret<String>>,
billing: Option<NovalnetPaymentsRequestBilling>,
Expand Down Expand Up @@ -215,8 +215,8 @@ impl TryFrom<&NovalnetRouterData<&PaymentsAuthorizeRouterData>> for NovalnetPaym
};

let customer = NovalnetPaymentsRequestCustomer {
first_name: item.router_data.get_billing_first_name()?,
last_name: item.router_data.get_billing_last_name()?,
first_name: item.router_data.get_optional_billing_first_name(),
last_name: item.router_data.get_optional_billing_last_name(),
email: item
.router_data
.get_billing_email()
Expand Down Expand Up @@ -1477,8 +1477,8 @@ impl TryFrom<&SetupMandateRouterData> for NovalnetPaymentsRequest {
};

let customer = NovalnetPaymentsRequestCustomer {
first_name: req_address.get_first_name()?.clone(),
last_name: req_address.get_last_name()?.clone(),
first_name: req_address.get_optional_first_name(),
last_name: req_address.get_optional_last_name(),
email: item.request.get_email()?.clone(),
mobile: item.get_optional_billing_phone_number(),
billing: Some(billing),
Expand Down
10 changes: 10 additions & 0 deletions crates/hyperswitch_connectors/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1188,6 +1188,8 @@ pub trait AddressDetailsData {
fn get_optional_city(&self) -> Option<String>;
fn get_optional_line1(&self) -> Option<Secret<String>>;
fn get_optional_line2(&self) -> Option<Secret<String>>;
fn get_optional_first_name(&self) -> Option<Secret<String>>;
fn get_optional_last_name(&self) -> Option<Secret<String>>;
}

impl AddressDetailsData for AddressDetails {
Expand Down Expand Up @@ -1296,6 +1298,14 @@ impl AddressDetailsData for AddressDetails {
fn get_optional_line2(&self) -> Option<Secret<String>> {
self.line2.clone()
}

fn get_optional_first_name(&self) -> Option<Secret<String>> {
self.first_name.clone()
}

fn get_optional_last_name(&self) -> Option<Secret<String>> {
self.last_name.clone()
}
}

pub trait PhoneDetailsData {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8706,24 +8706,6 @@ impl Default for settings::RequiredFields {
non_mandate: HashMap::new(),
common: HashMap::from(
[
(
"billing.address.first_name".to_string(),
RequiredFieldInfo {
required_field: "payment_method_data.billing.address.first_name".to_string(),
display_name: "first_name".to_string(),
field_type: enums::FieldType::UserFullName,
value: None,
}
),
(
"billing.address.last_name".to_string(),
RequiredFieldInfo {
required_field: "payment_method_data.billing.address.last_name".to_string(),
display_name: "last_name".to_string(),
field_type: enums::FieldType::UserFullName,
value: None,
}
),
(
"billing.email".to_string(),
RequiredFieldInfo {
Expand Down Expand Up @@ -9032,24 +9014,6 @@ impl Default for settings::RequiredFields {
non_mandate: HashMap::new(),
common: HashMap::from(
[
(
"billing.address.first_name".to_string(),
RequiredFieldInfo {
required_field: "payment_method_data.billing.address.first_name".to_string(),
display_name: "first_name".to_string(),
field_type: enums::FieldType::UserFullName,
value: None,
}
),
(
"billing.address.last_name".to_string(),
RequiredFieldInfo {
required_field: "payment_method_data.billing.address.last_name".to_string(),
display_name: "last_name".to_string(),
field_type: enums::FieldType::UserFullName,
value: None,
}
),
(
"billing.email".to_string(),
RequiredFieldInfo {
Expand Down Expand Up @@ -9733,24 +9697,6 @@ impl Default for settings::RequiredFields {
non_mandate: HashMap::new(),
common: HashMap::from(
[
(
"billing.address.first_name".to_string(),
RequiredFieldInfo {
required_field: "payment_method_data.billing.address.first_name".to_string(),
display_name: "first_name".to_string(),
field_type: enums::FieldType::UserFullName,
value: None,
}
),
(
"billing.address.last_name".to_string(),
RequiredFieldInfo {
required_field: "payment_method_data.billing.address.last_name".to_string(),
display_name: "last_name".to_string(),
field_type: enums::FieldType::UserFullName,
value: None,
}
),
(
"billing.email".to_string(),
RequiredFieldInfo {
Expand Down

0 comments on commit 3e116b8

Please sign in to comment.