Skip to content

Commit

Permalink
refactor(router): add phone and country_code in dynamic fields (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
ShankarSinghC authored Sep 19, 2024
1 parent 90949d9 commit 1151d21
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 1 deletion.
36 changes: 36 additions & 0 deletions crates/router/src/configs/defaults.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12335,6 +12335,24 @@ pub fn get_billing_required_fields() -> HashMap<String, RequiredFieldInfo> {
value: None,
},
),
(
"billing.phone.number".to_string(),
RequiredFieldInfo {
required_field: "payment_method_data.billing.phone.number".to_string(),
display_name: "phone_number".to_string(),
field_type: enums::FieldType::UserPhoneNumber,
value: None,
},
),
(
"billing.phone.country_code".to_string(),
RequiredFieldInfo {
required_field: "payment_method_data.billing.phone.country_code".to_string(),
display_name: "dialing_code".to_string(),
field_type: enums::FieldType::UserPhoneNumberCountryCode,
value: None,
},
),
])
}

Expand Down Expand Up @@ -12405,6 +12423,24 @@ pub fn get_shipping_required_fields() -> HashMap<String, RequiredFieldInfo> {
value: None,
},
),
(
"shipping.phone.number".to_string(),
RequiredFieldInfo {
required_field: "shipping.phone.number".to_string(),
display_name: "phone_number".to_string(),
field_type: enums::FieldType::UserPhoneNumber,
value: None,
},
),
(
"shipping.phone.country_code".to_string(),
RequiredFieldInfo {
required_field: "shipping.phone.country_code".to_string(),
display_name: "dialing_code".to_string(),
field_type: enums::FieldType::UserPhoneNumberCountryCode,
value: None,
},
),
])
}

Expand Down
6 changes: 5 additions & 1 deletion crates/router/src/core/payment_methods/cards.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3840,7 +3840,11 @@ fn should_collect_shipping_or_billing_details_from_wallet_connector(
mut required_fields_hs: HashMap<String, RequiredFieldInfo>,
) -> HashMap<String, RequiredFieldInfo> {
match (payment_method, payment_experience_optional) {
(api_enums::PaymentMethod::Wallet, Some(api_enums::PaymentExperience::InvokeSdkClient)) => {
(api_enums::PaymentMethod::Wallet, Some(api_enums::PaymentExperience::InvokeSdkClient))
| (
api_enums::PaymentMethod::PayLater,
Some(api_enums::PaymentExperience::InvokeSdkClient),
) => {
let always_send_billing_details = business_profile.and_then(|business_profile| {
business_profile.always_collect_billing_details_from_wallet_connector
});
Expand Down

0 comments on commit 1151d21

Please sign in to comment.