Skip to content

Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation

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

Shankar Singh C1151d215a620
diff --git a/crates/router/src/configs/defaults.rs b/crates/router/src/configs/defaults.rs
index 4fcb0785ea..41efc6e4c3 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<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,
+ },
+ ),
])
}
diff --git a/crates/router/src/core/payment_methods/cards.rs b/crates/router/src/core/payment_methods/cards.rs
index d8ad8dbead..efc9621d26 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<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
});