From 1151d215a620b1a58e48adbef6b3a39196bc91e1 Mon Sep 17 00:00:00 2001 From: Shankar Singh C <83439957+ShankarSinghC@users.noreply.github.com> Date: Fri, 20 Sep 2024 01:45:20 +0530 Subject: [PATCH] refactor(router): add `phone` and `country_code` in dynamic fields (#5968) --- crates/router/src/configs/defaults.rs | 36 +++++++++++++++++++ .../router/src/core/payment_methods/cards.rs | 6 +++- 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/crates/router/src/configs/defaults.rs b/crates/router/src/configs/defaults.rs index 4fcb0785ea18..41efc6e4c384 100644 --- a/crates/router/src/configs/defaults.rs +++ b/crates/router/src/configs/defaults.rs @@ -12335,6 +12335,24 @@ pub fn get_billing_required_fields() -> HashMap { 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, + }, + ), ]) } @@ -12405,6 +12423,24 @@ pub fn get_shipping_required_fields() -> HashMap { 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, + }, + ), ]) } diff --git a/crates/router/src/core/payment_methods/cards.rs b/crates/router/src/core/payment_methods/cards.rs index d8ad8dbead46..efc9621d26d5 100644 --- a/crates/router/src/core/payment_methods/cards.rs +++ b/crates/router/src/core/payment_methods/cards.rs @@ -3840,7 +3840,11 @@ fn should_collect_shipping_or_billing_details_from_wallet_connector( mut required_fields_hs: HashMap, ) -> HashMap { 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 });