refactor(router): add phone and country_code in dynamic fields (#5968)

This commit is contained in:
Shankar Singh C
2024-09-20 01:45:20 +05:30
committed by GitHub
parent 90949d94cf
commit 1151d215a6
2 changed files with 41 additions and 1 deletions

View File

@ -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,
},
),
])
}
@ -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,
},
),
])
}

View File

@ -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
});