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

feat(router): collect customer address details based on business profile config regardless of connector required fields (#5418)

Shankar Singh Cbda29cb1b5c8
diff --git a/api-reference-v2/openapi_spec.json b/api-reference-v2/openapi_spec.json
index e7a502be52..1dcc79c255 100644
--- a/api-reference-v2/openapi_spec.json
+++ b/api-reference-v2/openapi_spec.json
@@ -3060,16 +3060,30 @@
"description": "Whether to use the billing details passed when creating the intent as payment method billing",
"nullable": true
},
- "collect_shipping_details_from_wallet_connector": {
+ "collect_shipping_details_from_wallet_connector_if_required": {
"type": "boolean",
- "description": "A boolean value to indicate if customer shipping details needs to be collected from wallet connector (Eg. Apple Pay, Google Pay, etc.)",
+ "description": "A boolean value to indicate if customer shipping details needs to be collected from wallet\nconnector only if it is required field for connector (Eg. Apple Pay, Google Pay etc)",
"default": false,
"example": false,
"nullable": true
},
- "collect_billing_details_from_wallet_connector": {
+ "collect_billing_details_from_wallet_connector_if_required": {
"type": "boolean",
- "description": "A boolean value to indicate if customer billing details needs to be collected from wallet connector (Eg. Apple Pay, Google Pay, etc.)",
+ "description": "A boolean value to indicate if customer billing details needs to be collected from wallet\nconnector only if it is required field for connector (Eg. Apple Pay, Google Pay etc)",
+ "default": false,
+ "example": false,
+ "nullable": true
+ },
+ "always_collect_shipping_details_from_wallet_connector": {
+ "type": "boolean",
+ "description": "A boolean value to indicate if customer shipping details needs to be collected from wallet\nconnector irrespective of connector required fields (Eg. Apple pay, Google pay etc)",
+ "default": false,
+ "example": false,
+ "nullable": true
+ },
+ "always_collect_billing_details_from_wallet_connector": {
+ "type": "boolean",
+ "description": "A boolean value to indicate if customer billing details needs to be collected from wallet\nconnector irrespective of connector required fields (Eg. Apple pay, Google pay etc)",
"default": false,
"example": false,
"nullable": true
@@ -3202,16 +3216,30 @@
],
"nullable": true
},
- "collect_shipping_details_from_wallet_connector": {
+ "collect_shipping_details_from_wallet_connector_if_required": {
+ "type": "boolean",
+ "description": "A boolean value to indicate if customer shipping details needs to be collected from wallet\nconnector only if it is required field for connector (Eg. Apple Pay, Google Pay etc)",
+ "default": false,
+ "example": false,
+ "nullable": true
+ },
+ "collect_billing_details_from_wallet_connector_if_required": {
+ "type": "boolean",
+ "description": "A boolean value to indicate if customer billing details needs to be collected from wallet\nconnector only if it is required field for connector (Eg. Apple Pay, Google Pay etc)",
+ "default": false,
+ "example": false,
+ "nullable": true
+ },
+ "always_collect_shipping_details_from_wallet_connector": {
"type": "boolean",
- "description": "A boolean value to indicate if customer shipping details needs to be collected from wallet connector (Eg. Apple Pay, Google Pay, etc.)",
+ "description": "A boolean value to indicate if customer shipping details needs to be collected from wallet\nconnector irrespective of connector required fields (Eg. Apple pay, Google pay etc)",
"default": false,
"example": false,
"nullable": true
},
- "collect_billing_details_from_wallet_connector": {
+ "always_collect_billing_details_from_wallet_connector": {
"type": "boolean",
- "description": "A boolean value to indicate if customer billing details needs to be collected from wallet connector (Eg. Apple Pay, Google Pay, etc.)",
+ "description": "A boolean value to indicate if customer billing details needs to be collected from wallet\nconnector irrespective of connector required fields (Eg. Apple pay, Google pay etc)",
"default": false,
"example": false,
"nullable": true
diff --git a/api-reference/openapi_spec.json b/api-reference/openapi_spec.json
index d7f03d40c4..d556c09c6d 100644
--- a/api-reference/openapi_spec.json
+++ b/api-reference/openapi_spec.json
@@ -7291,14 +7291,28 @@
},
"collect_shipping_details_from_wallet_connector": {
"type": "boolean",
- "description": "A boolean value to indicate if customer shipping details needs to be collected from wallet connector (Eg. Apple Pay, Google Pay, etc.)",
+ "description": "A boolean value to indicate if customer shipping details needs to be collected from wallet\nconnector only if it is required field for connector (Eg. Apple Pay, Google Pay etc)",
"default": false,
"example": false,
"nullable": true
},
"collect_billing_details_from_wallet_connector": {
"type": "boolean",
- "description": "A boolean value to indicate if customer billing details needs to be collected from wallet connector (Eg. Apple Pay, Google Pay, etc.)",
+ "description": "A boolean value to indicate if customer billing details needs to be collected from wallet\nconnector only if it is required field for connector (Eg. Apple Pay, Google Pay etc)",
+ "default": false,
+ "example": false,
+ "nullable": true
+ },
+ "always_collect_shipping_details_from_wallet_connector": {
+ "type": "boolean",
+ "description": "A boolean value to indicate if customer shipping details needs to be collected from wallet\nconnector irrespective of connector required fields (Eg. Apple pay, Google pay etc)",
+ "default": false,
+ "example": false,
+ "nullable": true
+ },
+ "always_collect_billing_details_from_wallet_connector": {
+ "type": "boolean",
+ "description": "A boolean value to indicate if customer billing details needs to be collected from wallet\nconnector irrespective of connector required fields (Eg. Apple pay, Google pay etc)",
"default": false,
"example": false,
"nullable": true
@@ -7458,14 +7472,28 @@
},
"collect_shipping_details_from_wallet_connector": {
"type": "boolean",
- "description": "A boolean value to indicate if customer shipping details needs to be collected from wallet connector (Eg. Apple Pay, Google Pay, etc.)",
+ "description": "A boolean value to indicate if customer shipping details needs to be collected from wallet\nconnector only if it is required field for connector (Eg. Apple Pay, Google Pay etc)",
"default": false,
"example": false,
"nullable": true
},
"collect_billing_details_from_wallet_connector": {
"type": "boolean",
- "description": "A boolean value to indicate if customer billing details needs to be collected from wallet connector (Eg. Apple Pay, Google Pay, etc.)",
+ "description": "A boolean value to indicate if customer billing details needs to be collected from wallet\nconnector only if it is required field for connector (Eg. Apple Pay, Google Pay etc)",
+ "default": false,
+ "example": false,
+ "nullable": true
+ },
+ "always_collect_shipping_details_from_wallet_connector": {
+ "type": "boolean",
+ "description": "A boolean value to indicate if customer shipping details needs to be collected from wallet\nconnector irrespective of connector required fields (Eg. Apple pay, Google pay etc)",
+ "default": false,
+ "example": false,
+ "nullable": true
+ },
+ "always_collect_billing_details_from_wallet_connector": {
+ "type": "boolean",
+ "description": "A boolean value to indicate if customer billing details needs to be collected from wallet\nconnector irrespective of connector required fields (Eg. Apple pay, Google pay etc)",
"default": false,
"example": false,
"nullable": true
diff --git a/crates/api_models/src/admin.rs b/crates/api_models/src/admin.rs
index 081b0a1884..a606316b61 100644
--- a/crates/api_models/src/admin.rs
+++ b/crates/api_models/src/admin.rs
@@ -1920,14 +1920,26 @@ pub struct BusinessProfileCreate {
/// Whether to use the billing details passed when creating the intent as payment method billing
pub use_billing_as_payment_method_billing: Option<bool>,
- /// A boolean value to indicate if customer shipping details needs to be collected from wallet connector (Eg. Apple Pay, Google Pay, etc.)
+ /// A boolean value to indicate if customer shipping details needs to be collected from wallet
+ /// connector only if it is required field for connector (Eg. Apple Pay, Google Pay etc)
#[schema(default = false, example = false)]
pub collect_shipping_details_from_wallet_connector: Option<bool>,
- /// A boolean value to indicate if customer billing details needs to be collected from wallet connector (Eg. Apple Pay, Google Pay, etc.)
+ /// A boolean value to indicate if customer billing details needs to be collected from wallet
+ /// connector only if it is required field for connector (Eg. Apple Pay, Google Pay etc)
#[schema(default = false, example = false)]
pub collect_billing_details_from_wallet_connector: Option<bool>,
+ /// A boolean value to indicate if customer shipping details needs to be collected from wallet
+ /// connector irrespective of connector required fields (Eg. Apple pay, Google pay etc)
+ #[schema(default = false, example = false)]
+ pub always_collect_shipping_details_from_wallet_connector: Option<bool>,
+
+ /// A boolean value to indicate if customer billing details needs to be collected from wallet
+ /// connector irrespective of connector required fields (Eg. Apple pay, Google pay etc)
+ #[schema(default = false, example = false)]
+ pub always_collect_billing_details_from_wallet_connector: Option<bool>,
+
/// Indicates if the MIT (merchant initiated transaction) payments can be made connector
/// agnostic, i.e., MITs may be processed through different connector than CIT (customer
/// initiated transaction) based on the routing rules.
@@ -2003,13 +2015,25 @@ pub struct BusinessProfileCreate {
/// Whether to use the billing details passed when creating the intent as payment method billing
pub use_billing_as_payment_method_billing: Option<bool>,
- /// A boolean value to indicate if customer shipping details needs to be collected from wallet connector (Eg. Apple Pay, Google Pay, etc.)
+ /// A boolean value to indicate if customer shipping details needs to be collected from wallet
+ /// connector only if it is required field for connector (Eg. Apple Pay, Google Pay etc)
#[schema(default = false, example = false)]
- pub collect_shipping_details_from_wallet_connector: Option<bool>,
+ pub collect_shipping_details_from_wallet_connector_if_required: Option<bool>,
- /// A boolean value to indicate if customer billing details needs to be collected from wallet connector (Eg. Apple Pay, Google Pay, etc.)
+ /// A boolean value to indicate if customer billing details needs to be collected from wallet
+ /// connector only if it is required field for connector (Eg. Apple Pay, Google Pay etc)
#[schema(default = false, example = false)]
- pub collect_billing_details_from_wallet_connector: Option<bool>,
+ pub collect_billing_details_from_wallet_connector_if_required: Option<bool>,
+
+ /// A boolean value to indicate if customer shipping details needs to be collected from wallet
+ /// connector irrespective of connector required fields (Eg. Apple pay, Google pay etc)
+ #[schema(default = false, example = false)]
+ pub always_collect_shipping_details_from_wallet_connector: Option<bool>,
+
+ /// A boolean value to indicate if customer billing details needs to be collected from wallet
+ /// connector irrespective of connector required fields (Eg. Apple pay, Google pay etc)
+ #[schema(default = false, example = false)]
+ pub always_collect_billing_details_from_wallet_connector: Option<bool>,
/// Indicates if the MIT (merchant initiated transaction) payments can be made connector
/// agnostic, i.e., MITs may be processed through different connector than CIT (customer
@@ -2103,14 +2127,26 @@ pub struct BusinessProfileResponse {
/// Merchant's config to support extended card info feature
pub extended_card_info_config: Option<ExtendedCardInfoConfig>,
- /// A boolean value to indicate if customer shipping details needs to be collected from wallet connector (Eg. Apple Pay, Google Pay, etc.)
+ /// A boolean value to indicate if customer shipping details needs to be collected from wallet
+ /// connector only if it is required field for connector (Eg. Apple Pay, Google Pay etc)
#[schema(default = false, example = false)]
pub collect_shipping_details_from_wallet_connector: Option<bool>,
- /// A boolean value to indicate if customer billing details needs to be collected from wallet connector (Eg. Apple Pay, Google Pay, etc.)
+ /// A boolean value to indicate if customer billing details needs to be collected from wallet
+ /// connector only if it is required field for connector (Eg. Apple Pay, Google Pay etc)
#[schema(default = false, example = false)]
pub collect_billing_details_from_wallet_connector: Option<bool>,
+ /// A boolean value to indicate if customer shipping details needs to be collected from wallet
+ /// connector irrespective of connector required fields (Eg. Apple pay, Google pay etc)
+ #[schema(default = false, example = false)]
+ pub always_collect_shipping_details_from_wallet_connector: Option<bool>,
+
+ /// A boolean value to indicate if customer billing details needs to be collected from wallet
+ /// connector irrespective of connector required fields (Eg. Apple pay, Google pay etc)
+ #[schema(default = false, example = false)]
+ pub always_collect_billing_details_from_wallet_connector: Option<bool>,
+
/// Indicates if the MIT (merchant initiated transaction) payments can be made connector
/// agnostic, i.e., MITs may be processed through different connector than CIT (customer
/// initiated transaction) based on the routing rules.
@@ -2183,13 +2219,25 @@ pub struct BusinessProfileResponse {
/// Merchant's config to support extended card info feature
pub extended_card_info_config: Option<ExtendedCardInfoConfig>,
- /// A boolean value to indicate if customer shipping details needs to be collected from wallet connector (Eg. Apple Pay, Google Pay, etc.)
+ /// A boolean value to indicate if customer shipping details needs to be collected from wallet
+ /// connector only if it is required field for connector (Eg. Apple Pay, Google Pay etc)
#[schema(default = false, example = false)]
- pub collect_shipping_details_from_wallet_connector: Option<bool>,
+ pub collect_shipping_details_from_wallet_connector_if_required: Option<bool>,
- /// A boolean value to indicate if customer billing details needs to be collected from wallet connector (Eg. Apple Pay, Google Pay, etc.)
+ /// A boolean value to indicate if customer billing details needs to be collected from wallet
+ /// connector only if it is required field for connector (Eg. Apple Pay, Google Pay etc)
#[schema(default = false, example = false)]
- pub collect_billing_details_from_wallet_connector: Option<bool>,
+ pub collect_billing_details_from_wallet_connector_if_required: Option<bool>,
+
+ /// A boolean value to indicate if customer shipping details needs to be collected from wallet
+ /// connector irrespective of connector required fields (Eg. Apple pay, Google pay etc)
+ #[schema(default = false, example = false)]
+ pub always_collect_shipping_details_from_wallet_connector: Option<bool>,
+
+ /// A boolean value to indicate if customer billing details needs to be collected from wallet
+ /// connector irrespective of connector required fields (Eg. Apple pay, Google pay etc)
+ #[schema(default = false, example = false)]
+ pub always_collect_billing_details_from_wallet_connector: Option<bool>,
/// Indicates if the MIT (merchant initiated transaction) payments can be made connector
/// agnostic, i.e., MITs may be processed through different connector than CIT (customer
@@ -2283,14 +2331,26 @@ pub struct BusinessProfileUpdate {
// Whether to use the billing details passed when creating the intent as payment method billing
pub use_billing_as_payment_method_billing: Option<bool>,
- /// A boolean value to indicate if customer shipping details needs to be collected from wallet connector (Eg. Apple Pay, Google Pay, etc.)
+ /// A boolean value to indicate if customer shipping details needs to be collected from wallet
+ /// connector only if it is required field for connector (Eg. Apple Pay, Google Pay etc)
#[schema(default = false, example = false)]
pub collect_shipping_details_from_wallet_connector: Option<bool>,
- /// A boolean value to indicate if customer billing details needs to be collected from wallet connector (Eg. Apple Pay, Google Pay, etc.)
+ /// A boolean value to indicate if customer billing details needs to be collected from wallet
+ /// connector only if it is required field for connector (Eg. Apple Pay, Google Pay etc)
#[schema(default = false, example = false)]
pub collect_billing_details_from_wallet_connector: Option<bool>,
+ /// A boolean value to indicate if customer shipping details needs to be collected from wallet
+ /// connector irrespective of connector required fields (Eg. Apple pay, Google pay etc)
+ #[schema(default = false, example = false)]
+ pub always_collect_shipping_details_from_wallet_connector: Option<bool>,
+
+ /// A boolean value to indicate if customer billing details needs to be collected from wallet
+ /// connector irrespective of connector required fields (Eg. Apple pay, Google pay etc)
+ #[schema(default = false, example = false)]
+ pub always_collect_billing_details_from_wallet_connector: Option<bool>,
+
/// Indicates if the MIT (merchant initiated transaction) payments can be made connector
/// agnostic, i.e., MITs may be processed through different connector than CIT (customer
/// initiated transaction) based on the routing rules.
@@ -2363,13 +2423,25 @@ pub struct BusinessProfileUpdate {
// Whether to use the billing details passed when creating the intent as payment method billing
pub use_billing_as_payment_method_billing: Option<bool>,
- /// A boolean value to indicate if customer shipping details needs to be collected from wallet connector (Eg. Apple Pay, Google Pay, etc.)
+ /// A boolean value to indicate if customer shipping details needs to be collected from wallet
+ /// connector only if it is required field for connector (Eg. Apple Pay, Google Pay etc)
#[schema(default = false, example = false)]
- pub collect_shipping_details_from_wallet_connector: Option<bool>,
+ pub collect_shipping_details_from_wallet_connector_if_required: Option<bool>,
- /// A boolean value to indicate if customer billing details needs to be collected from wallet connector (Eg. Apple Pay, Google Pay, etc.)
+ /// A boolean value to indicate if customer billing details needs to be collected from wallet
+ /// connector only if it is required field for connector (Eg. Apple Pay, Google Pay etc)
#[schema(default = false, example = false)]
- pub collect_billing_details_from_wallet_connector: Option<bool>,
+ pub collect_billing_details_from_wallet_connector_if_required: Option<bool>,
+
+ /// A boolean value to indicate if customer shipping details needs to be collected from wallet
+ /// connector irrespective of connector required fields (Eg. Apple pay, Google pay etc)
+ #[schema(default = false, example = false)]
+ pub always_collect_shipping_details_from_wallet_connector: Option<bool>,
+
+ /// A boolean value to indicate if customer billing details needs to be collected from wallet
+ /// connector irrespective of connector required fields (Eg. Apple pay, Google pay etc)
+ #[schema(default = false, example = false)]
+ pub always_collect_billing_details_from_wallet_connector: Option<bool>,
/// Indicates if the MIT (merchant initiated transaction) payments can be made connector
/// agnostic, i.e., MITs may be processed through different connector than CIT (customer
diff --git a/crates/diesel_models/src/business_profile.rs b/crates/diesel_models/src/business_profile.rs
index 0877859737..23061c9e7a 100644
--- a/crates/diesel_models/src/business_profile.rs
+++ b/crates/diesel_models/src/business_profile.rs
@@ -54,6 +54,8 @@ pub struct BusinessProfile {
pub collect_shipping_details_from_wallet_connector: Option<bool>,
pub collect_billing_details_from_wallet_connector: Option<bool>,
pub outgoing_webhook_custom_http_headers: Option<Encryption>,
+ pub always_collect_billing_details_from_wallet_connector: Option<bool>,
+ pub always_collect_shipping_details_from_wallet_connector: Option<bool>,
}
#[cfg(all(
@@ -92,6 +94,8 @@ pub struct BusinessProfileNew {
pub collect_shipping_details_from_wallet_connector: Option<bool>,
pub collect_billing_details_from_wallet_connector: Option<bool>,
pub outgoing_webhook_custom_http_headers: Option<Encryption>,
+ pub always_collect_billing_details_from_wallet_connector: Option<bool>,
+ pub always_collect_shipping_details_from_wallet_connector: Option<bool>,
}
#[cfg(all(
@@ -127,6 +131,8 @@ pub struct BusinessProfileUpdateInternal {
pub collect_shipping_details_from_wallet_connector: Option<bool>,
pub collect_billing_details_from_wallet_connector: Option<bool>,
pub outgoing_webhook_custom_http_headers: Option<Encryption>,
+ pub always_collect_billing_details_from_wallet_connector: Option<bool>,
+ pub always_collect_shipping_details_from_wallet_connector: Option<bool>,
}
#[cfg(all(
@@ -161,6 +167,8 @@ impl BusinessProfileUpdateInternal {
collect_shipping_details_from_wallet_connector,
collect_billing_details_from_wallet_connector,
outgoing_webhook_custom_http_headers,
+ always_collect_billing_details_from_wallet_connector,
+ always_collect_shipping_details_from_wallet_connector,
} = self;
BusinessProfile {
profile_id: source.profile_id,
@@ -205,6 +213,12 @@ impl BusinessProfileUpdateInternal {
.or(source.collect_billing_details_from_wallet_connector),
outgoing_webhook_custom_http_headers: outgoing_webhook_custom_http_headers
.or(source.outgoing_webhook_custom_http_headers),
+ always_collect_billing_details_from_wallet_connector:
+ always_collect_billing_details_from_wallet_connector
+ .or(source.always_collect_billing_details_from_wallet_connector),
+ always_collect_shipping_details_from_wallet_connector:
+ always_collect_shipping_details_from_wallet_connector
+ .or(source.always_collect_shipping_details_from_wallet_connector),
}
}
}
@@ -243,6 +257,8 @@ pub struct BusinessProfile {
pub collect_shipping_details_from_wallet_connector: Option<bool>,
pub collect_billing_details_from_wallet_connector: Option<bool>,
pub outgoing_webhook_custom_http_headers: Option<Encryption>,
+ pub always_collect_billing_details_from_wallet_connector: Option<bool>,
+ pub always_collect_shipping_details_from_wallet_connector: Option<bool>,
pub routing_algorithm_id: Option<String>,
pub order_fulfillment_time: Option<i64>,
pub order_fulfillment_time_origin: Option<common_enums::OrderFulfillmentTimeOrigin>,
@@ -280,6 +296,8 @@ pub struct BusinessProfileNew {
pub collect_shipping_details_from_wallet_connector: Option<bool>,
pub collect_billing_details_from_wallet_connector: Option<bool>,
pub outgoing_webhook_custom_http_headers: Option<Encryption>,
+ pub always_collect_billing_details_from_wallet_connector: Option<bool>,
+ pub always_collect_shipping_details_from_wallet_connector: Option<bool>,
pub routing_algorithm_id: Option<String>,
pub order_fulfillment_time: Option<i64>,
pub order_fulfillment_time_origin: Option<common_enums::OrderFulfillmentTimeOrigin>,
@@ -314,6 +332,8 @@ pub struct BusinessProfileUpdateInternal {
pub collect_shipping_details_from_wallet_connector: Option<bool>,
pub collect_billing_details_from_wallet_connector: Option<bool>,
pub outgoing_webhook_custom_http_headers: Option<Encryption>,
+ pub always_collect_billing_details_from_wallet_connector: Option<bool>,
+ pub always_collect_shipping_details_from_wallet_connector: Option<bool>,
pub routing_algorithm_id: Option<String>,
pub order_fulfillment_time: Option<i64>,
pub order_fulfillment_time_origin: Option<common_enums::OrderFulfillmentTimeOrigin>,
@@ -347,6 +367,8 @@ impl BusinessProfileUpdateInternal {
collect_shipping_details_from_wallet_connector,
collect_billing_details_from_wallet_connector,
outgoing_webhook_custom_http_headers,
+ always_collect_billing_details_from_wallet_connector,
+ always_collect_shipping_details_from_wallet_connector,
routing_algorithm_id,
order_fulfillment_time,
order_fulfillment_time_origin,
@@ -393,6 +415,12 @@ impl BusinessProfileUpdateInternal {
.or(source.collect_billing_details_from_wallet_connector),
outgoing_webhook_custom_http_headers: outgoing_webhook_custom_http_headers
.or(source.outgoing_webhook_custom_http_headers),
+ always_collect_billing_details_from_wallet_connector:
+ always_collect_billing_details_from_wallet_connector
+ .or(always_collect_billing_details_from_wallet_connector),
+ always_collect_shipping_details_from_wallet_connector:
+ always_collect_shipping_details_from_wallet_connector
+ .or(always_collect_shipping_details_from_wallet_connector),
routing_algorithm_id: routing_algorithm_id.or(source.routing_algorithm_id),
order_fulfillment_time: order_fulfillment_time.or(source.order_fulfillment_time),
order_fulfillment_time_origin: order_fulfillment_time_origin
@@ -439,6 +467,10 @@ impl From<BusinessProfileNew> for BusinessProfile {
.collect_billing_details_from_wallet_connector,
outgoing_webhook_custom_http_headers: new.outgoing_webhook_custom_http_headers,
routing_algorithm_id: new.routing_algorithm_id,
+ always_collect_billing_details_from_wallet_connector: new
+ .always_collect_billing_details_from_wallet_connector,
+ always_collect_shipping_details_from_wallet_connector: new
+ .always_collect_shipping_details_from_wallet_connector,
order_fulfillment_time: new.order_fulfillment_time,
order_fulfillment_time_origin: new.order_fulfillment_time_origin,
frm_routing_algorithm_id: new.frm_routing_algorithm_id,
diff --git a/crates/diesel_models/src/schema.rs b/crates/diesel_models/src/schema.rs
index 9cada3e1b4..f751c8bcaf 100644
--- a/crates/diesel_models/src/schema.rs
+++ b/crates/diesel_models/src/schema.rs
@@ -203,6 +203,8 @@ diesel::table! {
collect_shipping_details_from_wallet_connector -> Nullable<Bool>,
collect_billing_details_from_wallet_connector -> Nullable<Bool>,
outgoing_webhook_custom_http_headers -> Nullable<Bytea>,
+ always_collect_billing_details_from_wallet_connector -> Nullable<Bool>,
+ always_collect_shipping_details_from_wallet_connector -> Nullable<Bool>,
}
}
diff --git a/crates/diesel_models/src/schema_v2.rs b/crates/diesel_models/src/schema_v2.rs
index 3b8c04e4ca..bf7341a10d 100644
--- a/crates/diesel_models/src/schema_v2.rs
+++ b/crates/diesel_models/src/schema_v2.rs
@@ -201,6 +201,8 @@ diesel::table! {
collect_shipping_details_from_wallet_connector -> Nullable<Bool>,
collect_billing_details_from_wallet_connector -> Nullable<Bool>,
outgoing_webhook_custom_http_headers -> Nullable<Bytea>,
+ always_collect_billing_details_from_wallet_connector -> Nullable<Bool>,
+ always_collect_shipping_details_from_wallet_connector -> Nullable<Bool>,
#[max_length = 64]
routing_algorithm_id -> Nullable<Varchar>,
order_fulfillment_time -> Nullable<Int8>,
diff --git a/crates/hyperswitch_domain_models/src/business_profile.rs b/crates/hyperswitch_domain_models/src/business_profile.rs
index b47dc19217..70f541391b 100644
--- a/crates/hyperswitch_domain_models/src/business_profile.rs
+++ b/crates/hyperswitch_domain_models/src/business_profile.rs
@@ -51,6 +51,8 @@ pub struct BusinessProfile {
pub collect_shipping_details_from_wallet_connector: Option<bool>,
pub collect_billing_details_from_wallet_connector: Option<bool>,
pub outgoing_webhook_custom_http_headers: OptionalEncryptableValue,
+ pub always_collect_billing_details_from_wallet_connector: Option<bool>,
+ pub always_collect_shipping_details_from_wallet_connector: Option<bool>,
}
#[cfg(all(
@@ -81,6 +83,8 @@ pub struct BusinessProfileGeneralUpdate {
pub collect_billing_details_from_wallet_connector: Option<bool>,
pub is_connector_agnostic_mit_enabled: Option<bool>,
pub outgoing_webhook_custom_http_headers: OptionalEncryptableValue,
+ pub always_collect_billing_details_from_wallet_connector: Option<bool>,
+ pub always_collect_shipping_details_from_wallet_connector: Option<bool>,
}
#[cfg(all(
@@ -135,6 +139,8 @@ impl From<BusinessProfileUpdate> for BusinessProfileUpdateInternal {
collect_billing_details_from_wallet_connector,
is_connector_agnostic_mit_enabled,
outgoing_webhook_custom_http_headers,
+ always_collect_billing_details_from_wallet_connector,
+ always_collect_shipping_details_from_wallet_connector,
} = *update;
Self {
@@ -164,6 +170,8 @@ impl From<BusinessProfileUpdate> for BusinessProfileUpdateInternal {
collect_billing_details_from_wallet_connector,
outgoing_webhook_custom_http_headers: outgoing_webhook_custom_http_headers
.map(Encryption::from),
+ always_collect_billing_details_from_wallet_connector,
+ always_collect_shipping_details_from_wallet_connector,
}
}
BusinessProfileUpdate::RoutingAlgorithmUpdate {
@@ -195,6 +203,8 @@ impl From<BusinessProfileUpdate> for BusinessProfileUpdateInternal {
collect_shipping_details_from_wallet_connector: None,
collect_billing_details_from_wallet_connector: None,
outgoing_webhook_custom_http_headers: None,
+ always_collect_billing_details_from_wallet_connector: None,
+ always_collect_shipping_details_from_wallet_connector: None,
},
BusinessProfileUpdate::ExtendedCardInfoUpdate {
is_extended_card_info_enabled,
@@ -224,6 +234,8 @@ impl From<BusinessProfileUpdate> for BusinessProfileUpdateInternal {
collect_shipping_details_from_wallet_connector: None,
collect_billing_details_from_wallet_connector: None,
outgoing_webhook_custom_http_headers: None,
+ always_collect_billing_details_from_wallet_connector: None,
+ always_collect_shipping_details_from_wallet_connector: None,
},
BusinessProfileUpdate::ConnectorAgnosticMitUpdate {
is_connector_agnostic_mit_enabled,
@@ -253,6 +265,8 @@ impl From<BusinessProfileUpdate> for BusinessProfileUpdateInternal {
collect_shipping_details_from_wallet_connector: None,
collect_billing_details_from_wallet_connector: None,
outgoing_webhook_custom_http_headers: None,
+ always_collect_billing_details_from_wallet_connector: None,
+ always_collect_shipping_details_from_wallet_connector: None,
},
}
}
@@ -301,6 +315,10 @@ impl super::behaviour::Conversion for BusinessProfile {
outgoing_webhook_custom_http_headers: self
.outgoing_webhook_custom_http_headers
.map(Encryption::from),
+ always_collect_billing_details_from_wallet_connector: self
+ .always_collect_billing_details_from_wallet_connector,
+ always_collect_shipping_details_from_wallet_connector: self
+ .always_collect_shipping_details_from_wallet_connector,
})
}
@@ -344,6 +362,10 @@ impl super::behaviour::Conversion for BusinessProfile {
.collect_shipping_details_from_wallet_connector,
collect_billing_details_from_wallet_connector: item
.collect_billing_details_from_wallet_connector,
+ always_collect_billing_details_from_wallet_connector: item
+ .always_collect_billing_details_from_wallet_connector,
+ always_collect_shipping_details_from_wallet_connector: item
+ .always_collect_shipping_details_from_wallet_connector,
outgoing_webhook_custom_http_headers: item
.outgoing_webhook_custom_http_headers
.async_lift(|inner| async {
@@ -400,6 +422,10 @@ impl super::behaviour::Conversion for BusinessProfile {
outgoing_webhook_custom_http_headers: self
.outgoing_webhook_custom_http_headers
.map(Encryption::from),
+ always_collect_billing_details_from_wallet_connector: self
+ .always_collect_billing_details_from_wallet_connector,
+ always_collect_shipping_details_from_wallet_connector: self
+ .always_collect_shipping_details_from_wallet_connector,
})
}
}
@@ -431,6 +457,8 @@ pub struct BusinessProfile {
pub collect_shipping_details_from_wallet_connector: Option<bool>,
pub collect_billing_details_from_wallet_connector: Option<bool>,
pub outgoing_webhook_custom_http_headers: OptionalEncryptableValue,
+ pub always_collect_billing_details_from_wallet_connector: Option<bool>,
+ pub always_collect_shipping_details_from_wallet_connector: Option<bool>,
pub routing_algorithm_id: Option<String>,
pub order_fulfillment_time: Option<i64>,
pub order_fulfillment_time_origin: Option<common_enums::OrderFulfillmentTimeOrigin>,
@@ -475,6 +503,8 @@ pub struct BusinessProfileGeneralUpdate {
pub collect_billing_details_from_wallet_connector: Option<bool>,
pub is_connector_agnostic_mit_enabled: Option<bool>,
pub outgoing_webhook_custom_http_headers: OptionalEncryptableValue,
+ pub always_collect_billing_details_from_wallet_connector: Option<bool>,
+ pub always_collect_shipping_details_from_wallet_connector: Option<bool>,
pub order_fulfillment_time: Option<i64>,
pub order_fulfillment_time_origin: Option<common_enums::OrderFulfillmentTimeOrigin>,
}
@@ -524,6 +554,8 @@ impl From<BusinessProfileUpdate> for BusinessProfileUpdateInternal {
collect_billing_details_from_wallet_connector,
is_connector_agnostic_mit_enabled,
outgoing_webhook_custom_http_headers,
+ always_collect_billing_details_from_wallet_connector,
+ always_collect_shipping_details_from_wallet_connector,
order_fulfillment_time,
order_fulfillment_time_origin,
} = *update;
@@ -551,6 +583,8 @@ impl From<BusinessProfileUpdate> for BusinessProfileUpdateInternal {
outgoing_webhook_custom_http_headers: outgoing_webhook_custom_http_headers
.map(Encryption::from),
routing_algorithm_id: None,
+ always_collect_billing_details_from_wallet_connector,
+ always_collect_shipping_details_from_wallet_connector,
order_fulfillment_time,
order_fulfillment_time_origin,
frm_routing_algorithm_id: None,
@@ -584,6 +618,8 @@ impl From<BusinessProfileUpdate> for BusinessProfileUpdateInternal {
collect_billing_details_from_wallet_connector: None,
outgoing_webhook_custom_http_headers: None,
routing_algorithm_id,
+ always_collect_billing_details_from_wallet_connector: None,
+ always_collect_shipping_details_from_wallet_connector: None,
order_fulfillment_time: None,
order_fulfillment_time_origin: None,
frm_routing_algorithm_id: None,
@@ -614,6 +650,8 @@ impl From<BusinessProfileUpdate> for BusinessProfileUpdateInternal {
collect_shipping_details_from_wallet_connector: None,
collect_billing_details_from_wallet_connector: None,
outgoing_webhook_custom_http_headers: None,
+ always_collect_billing_details_from_wallet_connector: None,
+ always_collect_shipping_details_from_wallet_connector: None,
routing_algorithm_id: None,
payout_routing_algorithm_id: None,
order_fulfillment_time: None,
@@ -645,6 +683,8 @@ impl From<BusinessProfileUpdate> for BusinessProfileUpdateInternal {
collect_shipping_details_from_wallet_connector: None,
collect_billing_details_from_wallet_connector: None,
outgoing_webhook_custom_http_headers: None,
+ always_collect_billing_details_from_wallet_connector: None,
+ always_collect_shipping_details_from_wallet_connector: None,
routing_algorithm_id: None,
payout_routing_algorithm_id: None,
order_fulfillment_time: None,
@@ -676,6 +716,8 @@ impl From<BusinessProfileUpdate> for BusinessProfileUpdateInternal {
collect_shipping_details_from_wallet_connector: None,
collect_billing_details_from_wallet_connector: None,
outgoing_webhook_custom_http_headers: None,
+ always_collect_billing_details_from_wallet_connector: None,
+ always_collect_shipping_details_from_wallet_connector: None,
routing_algorithm_id: None,
payout_routing_algorithm_id: None,
order_fulfillment_time: None,
@@ -724,6 +766,10 @@ impl super::behaviour::Conversion for BusinessProfile {
.outgoing_webhook_custom_http_headers
.map(Encryption::from),
routing_algorithm_id: self.routing_algorithm_id,
+ always_collect_billing_details_from_wallet_connector: self
+ .always_collect_billing_details_from_wallet_connector,
+ always_collect_shipping_details_from_wallet_connector: self
+ .always_collect_shipping_details_from_wallet_connector,
payout_routing_algorithm_id: self.payout_routing_algorithm_id,
order_fulfillment_time: self.order_fulfillment_time,
order_fulfillment_time_origin: self.order_fulfillment_time_origin,
@@ -783,6 +829,10 @@ impl super::behaviour::Conversion for BusinessProfile {
})
.await?,
routing_algorithm_id: item.routing_algorithm_id,
+ always_collect_billing_details_from_wallet_connector: item
+ .always_collect_billing_details_from_wallet_connector,
+ always_collect_shipping_details_from_wallet_connector: item
+ .always_collect_shipping_details_from_wallet_connector,
order_fulfillment_time: item.order_fulfillment_time,
order_fulfillment_time_origin: item.order_fulfillment_time_origin,
frm_routing_algorithm_id: item.frm_routing_algorithm_id,
@@ -827,6 +877,10 @@ impl super::behaviour::Conversion for BusinessProfile {
.outgoing_webhook_custom_http_headers
.map(Encryption::from),
routing_algorithm_id: self.routing_algorithm_id,
+ always_collect_billing_details_from_wallet_connector: self
+ .always_collect_billing_details_from_wallet_connector,
+ always_collect_shipping_details_from_wallet_connector: self
+ .always_collect_shipping_details_from_wallet_connector,
order_fulfillment_time: self.order_fulfillment_time,
order_fulfillment_time_origin: self.order_fulfillment_time_origin,
frm_routing_algorithm_id: self.frm_routing_algorithm_id,
diff --git a/crates/router/src/configs.rs b/crates/router/src/configs.rs
index f7514a312a..8c6dd28b52 100644
--- a/crates/router/src/configs.rs
+++ b/crates/router/src/configs.rs
@@ -1,6 +1,6 @@
use hyperswitch_interfaces::secrets_interface::secret_state::RawSecret;
-mod defaults;
+pub(crate) mod defaults;
pub mod secrets_transformers;
pub mod settings;
mod validations;
diff --git a/crates/router/src/configs/defaults.rs b/crates/router/src/configs/defaults.rs
index c34c00599a..b2d9707d0b 100644
--- a/crates/router/src/configs/defaults.rs
+++ b/crates/router/src/configs/defaults.rs
@@ -7343,74 +7343,7 @@ impl Default for super::settings::RequiredFields {
field_type: enums::FieldType::UserAddressLine1,
value: None,
}
- ),
- (
- "shipping.address.first_name".to_string(),
- RequiredFieldInfo {
- required_field: "shipping.address.first_name".to_string(),
- display_name: "shipping_first_name".to_string(),
- field_type: enums::FieldType::UserShippingName,
- value: None,
- }
- ),
- (
- "shipping.address.last_name".to_string(),
- RequiredFieldInfo {
- required_field: "shipping.address.last_name".to_string(),
- display_name: "shipping_last_name".to_string(),
- field_type: enums::FieldType::UserShippingName,
- value: None,
- }
- ),
- (
- "shipping.address.city".to_string(),
- RequiredFieldInfo {
- required_field: "shipping.address.city".to_string(),
- display_name: "city".to_string(),
- field_type: enums::FieldType::UserShippingAddressCity,
- value: None,
- }
- ),
- (
- "shipping.address.state".to_string(),
- RequiredFieldInfo {
- required_field: "shipping.address.state".to_string(),
- display_name: "state".to_string(),
- field_type: enums::FieldType::UserShippingAddressState,
- value: None,
- }
- ),
- (
- "shipping.address.zip".to_string(),
- RequiredFieldInfo {
- required_field: "shipping.address.zip".to_string(),
- display_name: "zip".to_string(),
- field_type: enums::FieldType::UserShippingAddressPincode,
- value: None,
- }
- ),
- (
- "shipping.address.country".to_string(),
- RequiredFieldInfo {
- required_field: "shipping.address.country".to_string(),
- display_name: "country".to_string(),
- field_type: enums::FieldType::UserShippingAddressCountry{
- options: vec![
- "ALL".to_string(),
- ]
- },
- value: None,
- }
- ),
- (
- "shipping.address.line1".to_string(),
- RequiredFieldInfo {
- required_field: "shipping.address.line1".to_string(),
- display_name: "line1".to_string(),
- field_type: enums::FieldType::UserShippingAddressLine1,
- value: None,
- }
- ),
+ )
]
),
common: HashMap::new(),
@@ -7497,74 +7430,7 @@ impl Default for super::settings::RequiredFields {
field_type: enums::FieldType::UserAddressLine1,
value: None,
}
- ),
- (
- "shipping.address.first_name".to_string(),
- RequiredFieldInfo {
- required_field: "shipping.address.first_name".to_string(),
- display_name: "shipping_first_name".to_string(),
- field_type: enums::FieldType::UserShippingName,
- value: None,
- }
- ),
- (
- "shipping.address.last_name".to_string(),
- RequiredFieldInfo {
- required_field: "shipping.address.last_name".to_string(),
- display_name: "shipping_last_name".to_string(),
- field_type: enums::FieldType::UserShippingName,
- value: None,
- }
- ),
- (
- "shipping.address.city".to_string(),
- RequiredFieldInfo {
- required_field: "shipping.address.city".to_string(),
- display_name: "city".to_string(),
- field_type: enums::FieldType::UserShippingAddressCity,
- value: None,
- }
- ),
- (
- "shipping.address.state".to_string(),
- RequiredFieldInfo {
- required_field: "shipping.address.state".to_string(),
- display_name: "state".to_string(),
- field_type: enums::FieldType::UserShippingAddressState,
- value: None,
- }
- ),
- (
- "shipping.address.zip".to_string(),
- RequiredFieldInfo {
- required_field: "shipping.address.zip".to_string(),
- display_name: "zip".to_string(),
- field_type: enums::FieldType::UserShippingAddressPincode,
- value: None,
- }
- ),
- (
- "shipping.address.country".to_string(),
- RequiredFieldInfo {
- required_field: "shipping.address.country".to_string(),
- display_name: "country".to_string(),
- field_type: enums::FieldType::UserShippingAddressCountry{
- options: vec![
- "ALL".to_string(),
- ]
- },
- value: None,
- }
- ),
- (
- "shipping.address.line1".to_string(),
- RequiredFieldInfo {
- required_field: "shipping.address.line1".to_string(),
- display_name: "line1".to_string(),
- field_type: enums::FieldType::UserShippingAddressLine1,
- value: None,
- }
- ),
+ )
]
),
common: HashMap::new(),
@@ -7820,74 +7686,7 @@ impl Default for super::settings::RequiredFields {
field_type: enums::FieldType::UserAddressLine1,
value: None,
}
- ),
- (
- "shipping.address.first_name".to_string(),
- RequiredFieldInfo {
- required_field: "shipping.address.first_name".to_string(),
- display_name: "shipping_first_name".to_string(),
- field_type: enums::FieldType::UserShippingName,
- value: None,
- }
- ),
- (
- "shipping.address.last_name".to_string(),
- RequiredFieldInfo {
- required_field: "shipping.address.last_name".to_string(),
- display_name: "shipping_last_name".to_string(),
- field_type: enums::FieldType::UserShippingName,
- value: None,
- }
- ),
- (
- "shipping.address.city".to_string(),
- RequiredFieldInfo {
- required_field: "shipping.address.city".to_string(),
- display_name: "city".to_string(),
- field_type: enums::FieldType::UserShippingAddressCity,
- value: None,
- }
- ),
- (
- "shipping.address.state".to_string(),
- RequiredFieldInfo {
- required_field: "shipping.address.state".to_string(),
- display_name: "state".to_string(),
- field_type: enums::FieldType::UserShippingAddressState,
- value: None,
- }
- ),
- (
- "shipping.address.zip".to_string(),
- RequiredFieldInfo {
- required_field: "shipping.address.zip".to_string(),
- display_name: "zip".to_string(),
- field_type: enums::FieldType::UserShippingAddressPincode,
- value: None,
- }
- ),
- (
- "shipping.address.country".to_string(),
- RequiredFieldInfo {
- required_field: "shipping.address.country".to_string(),
- display_name: "country".to_string(),
- field_type: enums::FieldType::UserShippingAddressCountry{
- options: vec![
- "ALL".to_string(),
- ]
- },
- value: None,
- }
- ),
- (
- "shipping.address.line1".to_string(),
- RequiredFieldInfo {
- required_field: "shipping.address.line1".to_string(),
- display_name: "line1".to_string(),
- field_type: enums::FieldType::UserShippingAddressLine1,
- value: None,
- }
- ),
+ )
]
),
common: HashMap::new(),
@@ -8097,187 +7896,50 @@ impl Default for super::settings::RequiredFields {
"billing.address.country".to_string(),
RequiredFieldInfo {
required_field: "payment_method_data.billing.address.country".to_string(),
- display_name: "country".to_string(),
- field_type: enums::FieldType::UserAddressCountry{
- options: vec![
- "ALL".to_string(),
- ]
- },
- value: None,
- }
- ),
- (
- "billing.address.line1".to_string(),
- RequiredFieldInfo {
- required_field: "payment_method_data.billing.address.line1".to_string(),
- display_name: "line1".to_string(),
- field_type: enums::FieldType::UserAddressLine1,
- value: None,
- }
- ),
- (
- "shipping.address.first_name".to_string(),
- RequiredFieldInfo {
- required_field: "shipping.address.first_name".to_string(),
- display_name: "shipping_first_name".to_string(),
- field_type: enums::FieldType::UserShippingName,
- value: None,
- }
- ),
- (
- "shipping.address.last_name".to_string(),
- RequiredFieldInfo {
- required_field: "shipping.address.last_name".to_string(),
- display_name: "shipping_last_name".to_string(),
- field_type: enums::FieldType::UserShippingName,
- value: None,
- }
- ),
- (
- "shipping.address.city".to_string(),
- RequiredFieldInfo {
- required_field: "shipping.address.city".to_string(),
- display_name: "city".to_string(),
- field_type: enums::FieldType::UserShippingAddressCity,
- value: None,
- }
- ),
- (
- "shipping.address.state".to_string(),
- RequiredFieldInfo {
- required_field: "shipping.address.state".to_string(),
- display_name: "state".to_string(),
- field_type: enums::FieldType::UserShippingAddressState,
- value: None,
- }
- ),
- (
- "shipping.address.zip".to_string(),
- RequiredFieldInfo {
- required_field: "shipping.address.zip".to_string(),
- display_name: "zip".to_string(),
- field_type: enums::FieldType::UserShippingAddressPincode,
- value: None,
- }
- ),
- (
- "shipping.address.country".to_string(),
- RequiredFieldInfo {
- required_field: "shipping.address.country".to_string(),
- display_name: "country".to_string(),
- field_type: enums::FieldType::UserShippingAddressCountry{
- options: vec![
- "ALL".to_string(),
- ]
- },
- value: None,
- }
- ),
- (
- "shipping.address.line1".to_string(),
- RequiredFieldInfo {
- required_field: "shipping.address.line1".to_string(),
- display_name: "line1".to_string(),
- field_type: enums::FieldType::UserShippingAddressLine1,
- value: None,
- }
- ),
- ]
- ),
- common: HashMap::new(),
- }
- ),
- (
- enums::Connector::Payu,
- RequiredFieldFinal {
- mandate: HashMap::new(),
- non_mandate: HashMap::new(),
- common: HashMap::new(),
- }
- ),
- (
- enums::Connector::Rapyd,
- RequiredFieldFinal {
- mandate: HashMap::new(),
- non_mandate: HashMap::new(),
- common: HashMap::new(),
- }
- ),
- (
- enums::Connector::Stripe,
- RequiredFieldFinal {
- mandate: HashMap::new(),
- non_mandate: HashMap::from(
- [
- (
- "shipping.address.first_name".to_string(),
- RequiredFieldInfo {
- required_field: "shipping.address.first_name".to_string(),
- display_name: "shipping_first_name".to_string(),
- field_type: enums::FieldType::UserShippingName,
- value: None,
- }
- ),
- (
- "shipping.address.last_name".to_string(),
- RequiredFieldInfo {
- required_field: "shipping.address.last_name".to_string(),
- display_name: "shipping_last_name".to_string(),
- field_type: enums::FieldType::UserShippingName,
- value: None,
- }
- ),
- (
- "shipping.address.city".to_string(),
- RequiredFieldInfo {
- required_field: "shipping.address.city".to_string(),
- display_name: "city".to_string(),
- field_type: enums::FieldType::UserShippingAddressCity,
- value: None,
- }
- ),
- (
- "shipping.address.state".to_string(),
- RequiredFieldInfo {
- required_field: "shipping.address.state".to_string(),
- display_name: "state".to_string(),
- field_type: enums::FieldType::UserShippingAddressState,
- value: None,
- }
- ),
- (
- "shipping.address.zip".to_string(),
- RequiredFieldInfo {
- required_field: "shipping.address.zip".to_string(),
- display_name: "zip".to_string(),
- field_type: enums::FieldType::UserShippingAddressPincode,
- value: None,
- }
- ),
- (
- "shipping.address.country".to_string(),
- RequiredFieldInfo {
- required_field: "shipping.address.country".to_string(),
- display_name: "country".to_string(),
- field_type: enums::FieldType::UserShippingAddressCountry{
- options: vec![
- "ALL".to_string(),
- ]
- },
- value: None,
- }
- ),
- (
- "shipping.address.line1".to_string(),
- RequiredFieldInfo {
- required_field: "shipping.address.line1".to_string(),
- display_name: "line1".to_string(),
- field_type: enums::FieldType::UserShippingAddressLine1,
- value: None,
- }
+ display_name: "country".to_string(),
+ field_type: enums::FieldType::UserAddressCountry{
+ options: vec![
+ "ALL".to_string(),
+ ]
+ },
+ value: None,
+ }
+ ),
+ (
+ "billing.address.line1".to_string(),
+ RequiredFieldInfo {
+ required_field: "payment_method_data.billing.address.line1".to_string(),
+ display_name: "line1".to_string(),
+ field_type: enums::FieldType::UserAddressLine1,
+ value: None,
+ }
+ )
+ ]
),
- ]
- ),
+ common: HashMap::new(),
+ }
+ ),
+ (
+ enums::Connector::Payu,
+ RequiredFieldFinal {
+ mandate: HashMap::new(),
+ non_mandate: HashMap::new(),
+ common: HashMap::new(),
+ }
+ ),
+ (
+ enums::Connector::Rapyd,
+ RequiredFieldFinal {
+ mandate: HashMap::new(),
+ non_mandate: HashMap::new(),
+ common: HashMap::new(),
+ }
+ ),
+ (
+ enums::Connector::Stripe,
+ RequiredFieldFinal {
+ mandate: HashMap::new(),
+ non_mandate: HashMap::new(),
common: HashMap::new(),
}
),
@@ -8487,75 +8149,7 @@ impl Default for super::settings::RequiredFields {
RequiredFieldFinal {
mandate: HashMap::new(),
non_mandate: HashMap::new(),
- common: HashMap::from([
- (
- "shipping.address.first_name".to_string(),
- RequiredFieldInfo {
- required_field: "shipping.address.first_name".to_string(),
- display_name: "shipping_first_name".to_string(),
- field_type: enums::FieldType::UserShippingName,
- value: None,
- }
- ),
- (
- "shipping.address.last_name".to_string(),
- RequiredFieldInfo {
- required_field: "shipping.address.last_name".to_string(),
- display_name: "shipping_last_name".to_string(),
- field_type: enums::FieldType::UserShippingName,
- value: None,
- }
- ),
- (
- "shipping.address.city".to_string(),
- RequiredFieldInfo {
- required_field: "shipping.address.city".to_string(),
- display_name: "city".to_string(),
- field_type: enums::FieldType::UserShippingAddressCity,
- value: None,
- }
- ),
- (
- "shipping.address.state".to_string(),
- RequiredFieldInfo {
- required_field: "shipping.address.state".to_string(),
- display_name: "state".to_string(),
- field_type: enums::FieldType::UserShippingAddressState,
- value: None,
- }
- ),
- (
- "shipping.address.zip".to_string(),
- RequiredFieldInfo {
- required_field: "shipping.address.zip".to_string(),
- display_name: "zip".to_string(),
- field_type: enums::FieldType::UserShippingAddressPincode,
- value: None,
- }
- ),
- (
- "shipping.address.country".to_string(),
- RequiredFieldInfo {
- required_field: "shipping.address.country".to_string(),
- display_name: "country".to_string(),
- field_type: enums::FieldType::UserShippingAddressCountry{
- options: vec![
- "ALL".to_string(),
- ]
- },
- value: None,
- }
- ),
- (
- "shipping.address.line1".to_string(),
- RequiredFieldInfo {
- required_field: "shipping.address.line1".to_string(),
- display_name: "line1".to_string(),
- field_type: enums::FieldType::UserShippingAddressLine1,
- value: None,
- }
- ),
- ]),
+ common: HashMap::new(),
}
),
(
@@ -8564,77 +8158,7 @@ impl Default for super::settings::RequiredFields {
mandate: HashMap::new(),
non_mandate: HashMap::new(
),
- common: HashMap::from(
- [
- (
- "shipping.address.first_name".to_string(),
- RequiredFieldInfo {
- required_field: "shipping.address.first_name".to_string(),
- display_name: "shipping_first_name".to_string(),
- field_type: enums::FieldType::UserShippingName,
- value: None,
- }
- ),
- (
- "shipping.address.last_name".to_string(),
- RequiredFieldInfo {
- required_field: "shipping.address.last_name".to_string(),
- display_name: "shipping_last_name".to_string(),
- field_type: enums::FieldType::UserShippingName,
- value: None,
- }
- ),
- (
- "shipping.address.city".to_string(),
- RequiredFieldInfo {
- required_field: "shipping.address.city".to_string(),
- display_name: "city".to_string(),
- field_type: enums::FieldType::UserShippingAddressCity,
- value: None,
- }
- ),
- (
- "shipping.address.state".to_string(),
- RequiredFieldInfo {
- required_field: "shipping.address.state".to_string(),
- display_name: "state".to_string(),
- field_type: enums::FieldType::UserShippingAddressState,
- value: None,
- }
- ),
- (
- "shipping.address.zip".to_string(),
- RequiredFieldInfo {
- required_field: "shipping.address.zip".to_string(),
- display_name: "zip".to_string(),
- field_type: enums::FieldType::UserShippingAddressPincode,
- value: None,
- }
- ),
- (
- "shipping.address.country".to_string(),
- RequiredFieldInfo {
- required_field: "shipping.address.country".to_string(),
- display_name: "country".to_string(),
- field_type: enums::FieldType::UserShippingAddressCountry{
- options: vec![
- "ALL".to_string(),
- ]
- },
- value: None,
- }
- ),
- (
- "shipping.address.line1".to_string(),
- RequiredFieldInfo {
- required_field: "shipping.address.line1".to_string(),
- display_name: "line1".to_string(),
- field_type: enums::FieldType::UserShippingAddressLine1,
- value: None,
- }
- ),
- ]
- ),
+ common: HashMap::new(),
}
),
]),
@@ -9002,130 +8526,6 @@ impl Default for super::settings::RequiredFields {
mandate: HashMap::new(),
non_mandate: HashMap::new(),
common: HashMap::from([
- (
- "shipping.address.first_name".to_string(),
- RequiredFieldInfo {
- required_field: "shipping.address.first_name".to_string(),
- display_name: "shipping_first_name".to_string(),
- field_type: enums::FieldType::UserShippingName,
- value: None,
- }
- ),
- (
- "shipping.address.last_name".to_string(),
- RequiredFieldInfo {
- required_field: "shipping.address.last_name".to_string(),
- display_name: "shipping_last_name".to_string(),
- field_type: enums::FieldType::UserShippingName,
- value: None,
- }
- ),
- (
- "shipping.address.city".to_string(),
- RequiredFieldInfo {
- required_field: "shipping.address.city".to_string(),
- display_name: "city".to_string(),
- field_type: enums::FieldType::UserShippingAddressCity,
- value: None,
- }
- ),
- (
- "shipping.address.line1".to_string(),
- RequiredFieldInfo {
- required_field: "shipping.address.line1".to_string(),
- display_name: "line1".to_string(),
- field_type: enums::FieldType::UserShippingAddressLine1,
- value: None,
- }
- ),
- (
- "shipping.address.line2".to_string(),
- RequiredFieldInfo {
- required_field: "shipping.address.line2".to_string(),
- display_name: "line2".to_string(),
- field_type: enums::FieldType::UserShippingAddressLine2,
- value: None,
- }
- ),
- (
- "shipping.address.zip".to_string(),
- RequiredFieldInfo {
- required_field: "shipping.address.zip".to_string(),
- display_name: "zip".to_string(),
- field_type: enums::FieldType::UserShippingAddressPincode,
- value: None,
- }
- ),
- (
- "shipping.address.state".to_string(),
- RequiredFieldInfo {
- required_field: "shipping.address.state".to_string(),
- display_name: "state".to_string(),
- field_type: enums::FieldType::UserShippingAddressState,
- value: None,
- }
- ),
- (
- "shipping.email".to_string(),
- RequiredFieldInfo {
- required_field: "shipping.email".to_string(),
- display_name: "email".to_string(),
- field_type: enums::FieldType::UserEmailAddress,
- 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: "phone_country_code".to_string(),
- field_type: enums::FieldType::UserPhoneNumberCountryCode,
- value: None,
- }
- ),
- (
- "shipping.address.country".to_string(),
- RequiredFieldInfo {
- required_field: "shipping.address.country".to_string(),
- display_name: "country".to_string(),
- field_type: enums::FieldType::UserShippingAddressCountry{
- options: vec![
- "AU".to_string(),
- "AT".to_string(),
- "BE".to_string(),
- "CA".to_string(),
- "CZ".to_string(),
- "DK".to_string(),
- "FI".to_string(),
- "FR".to_string(),
- "DE".to_string(),
- "GR".to_string(),
- "IE".to_string(),
- "IT".to_string(),
- "NL".to_string(),
- "NZ".to_string(),
- "NO".to_string(),
- "PL".to_string(),
- "PT".to_string(),
- "ES".to_string(),
- "SE".to_string(),
- "CH".to_string(),
- "GB".to_string(),
- "US".to_string(),
- ]
- },
- value: None,
- }
- ),
(
"billing.address.country".to_string(),
RequiredFieldInfo {
@@ -9497,6 +8897,155 @@ impl Default for super::settings::ApiKeys {
}
}
+pub fn get_billing_required_fields() -> HashMap<String, RequiredFieldInfo> {
+ HashMap::from([
+ (
+ "billing.address.first_name".to_string(),
+ RequiredFieldInfo {
+ required_field: "payment_method_data.billing.address.first_name".to_string(),
+ display_name: "billing_first_name".to_string(),
+ field_type: enums::FieldType::UserBillingName,
+ value: None,
+ },
+ ),
+ (
+ "billing.address.last_name".to_string(),
+ RequiredFieldInfo {
+ required_field: "payment_method_data.billing.address.last_name".to_string(),
+ display_name: "billing_last_name".to_string(),
+ field_type: enums::FieldType::UserBillingName,
+ value: None,
+ },
+ ),
+ (
+ "billing.address.city".to_string(),
+ RequiredFieldInfo {
+ required_field: "payment_method_data.billing.address.city".to_string(),
+ display_name: "city".to_string(),
+ field_type: enums::FieldType::UserAddressCity,
+ value: None,
+ },
+ ),
+ (
+ "billing.address.state".to_string(),
+ RequiredFieldInfo {
+ required_field: "payment_method_data.billing.address.state".to_string(),
+ display_name: "state".to_string(),
+ field_type: enums::FieldType::UserAddressState,
+ value: None,
+ },
+ ),
+ (
+ "billing.address.zip".to_string(),
+ RequiredFieldInfo {
+ required_field: "payment_method_data.billing.address.zip".to_string(),
+ display_name: "zip".to_string(),
+ field_type: enums::FieldType::UserAddressPincode,
+ value: None,
+ },
+ ),
+ (
+ "billing.address.country".to_string(),
+ RequiredFieldInfo {
+ required_field: "payment_method_data.billing.address.country".to_string(),
+ display_name: "country".to_string(),
+ field_type: enums::FieldType::UserAddressCountry {
+ options: vec!["ALL".to_string()],
+ },
+ value: None,
+ },
+ ),
+ (
+ "billing.address.line1".to_string(),
+ RequiredFieldInfo {
+ required_field: "payment_method_data.billing.address.line1".to_string(),
+ display_name: "line1".to_string(),
+ field_type: enums::FieldType::UserAddressLine1,
+ value: None,
+ },
+ ),
+ (
+ "billing.address.line2".to_string(),
+ RequiredFieldInfo {
+ required_field: "payment_method_data.billing.address.line2".to_string(),
+ display_name: "line2".to_string(),
+ field_type: enums::FieldType::UserAddressLine2,
+ value: None,
+ },
+ ),
+ ])
+}
+
+pub fn get_shipping_required_fields() -> HashMap<String, RequiredFieldInfo> {
+ HashMap::from([
+ (
+ "shipping.address.first_name".to_string(),
+ RequiredFieldInfo {
+ required_field: "shipping.address.first_name".to_string(),
+ display_name: "shipping_first_name".to_string(),
+ field_type: enums::FieldType::UserShippingName,
+ value: None,
+ },
+ ),
+ (
+ "shipping.address.last_name".to_string(),
+ RequiredFieldInfo {
+ required_field: "shipping.address.last_name".to_string(),
+ display_name: "shipping_last_name".to_string(),
+ field_type: enums::FieldType::UserShippingName,
+ value: None,
+ },
+ ),
+ (
+ "shipping.address.city".to_string(),
+ RequiredFieldInfo {
+ required_field: "shipping.address.city".to_string(),
+ display_name: "city".to_string(),
+ field_type: enums::FieldType::UserShippingAddressCity,
+ value: None,
+ },
+ ),
+ (
+ "shipping.address.state".to_string(),
+ RequiredFieldInfo {
+ required_field: "shipping.address.state".to_string(),
+ display_name: "state".to_string(),
+ field_type: enums::FieldType::UserShippingAddressState,
+ value: None,
+ },
+ ),
+ (
+ "shipping.address.zip".to_string(),
+ RequiredFieldInfo {
+ required_field: "shipping.address.zip".to_string(),
+ display_name: "zip".to_string(),
+ field_type: enums::FieldType::UserShippingAddressPincode,
+ value: None,
+ },
+ ),
+ (
+ "shipping.address.country".to_string(),
+ RequiredFieldInfo {
+ required_field: "shipping.address.country".to_string(),
+ display_name: "country".to_string(),
+ field_type: enums::FieldType::UserShippingAddressCountry {
+ options: vec!["ALL".to_string()],
+ },
+ value: None,
+ },
+ ),
+ (
+ "shipping.address.line1".to_string(),
+ RequiredFieldInfo {
+ required_field: "shipping.address.line1".to_string(),
+ display_name: "line1".to_string(),
+ field_type: enums::FieldType::UserShippingAddressLine1,
+ value: None,
+ },
+ ),
+ ])
+}
+
impl Default for super::settings::KeyManagerConfig {
fn default() -> Self {
Self {
diff --git a/crates/router/src/core/admin.rs b/crates/router/src/core/admin.rs
index 2a3ce4880e..e68b31ea43 100644
--- a/crates/router/src/core/admin.rs
+++ b/crates/router/src/core/admin.rs
@@ -3498,6 +3498,10 @@ impl BusinessProfileCreateBridge for api::BusinessProfileCreate {
.or(Some(false)),
outgoing_webhook_custom_http_headers: outgoing_webhook_custom_http_headers
.map(Into::into),
+ always_collect_billing_details_from_wallet_connector: self
+ .always_collect_billing_details_from_wallet_connector,
+ always_collect_shipping_details_from_wallet_connector: self
+ .always_collect_shipping_details_from_wallet_connector,
})
}
@@ -3578,13 +3582,17 @@ impl BusinessProfileCreateBridge for api::BusinessProfileCreate {
.use_billing_as_payment_method_billing
.or(Some(true)),
collect_shipping_details_from_wallet_connector: self
- .collect_shipping_details_from_wallet_connector
+ .collect_shipping_details_from_wallet_connector_if_required
.or(Some(false)),
collect_billing_details_from_wallet_connector: self
- .collect_billing_details_from_wallet_connector
+ .collect_billing_details_from_wallet_connector_if_required
.or(Some(false)),
outgoing_webhook_custom_http_headers: outgoing_webhook_custom_http_headers
.map(Into::into),
+ always_collect_billing_details_from_wallet_connector: self
+ .always_collect_billing_details_from_wallet_connector,
+ always_collect_shipping_details_from_wallet_connector: self
+ .always_collect_shipping_details_from_wallet_connector,
routing_algorithm_id: None,
frm_routing_algorithm_id: None,
payout_routing_algorithm_id: None,
@@ -3856,6 +3864,10 @@ impl BusinessProfileUpdateBridge for api::BusinessProfileUpdate {
is_connector_agnostic_mit_enabled: self.is_connector_agnostic_mit_enabled,
outgoing_webhook_custom_http_headers: outgoing_webhook_custom_http_headers
.map(Into::into),
+ always_collect_billing_details_from_wallet_connector: self
+ .always_collect_billing_details_from_wallet_connector,
+ always_collect_shipping_details_from_wallet_connector: self
+ .always_collect_shipping_details_from_wallet_connector,
},
)))
}
@@ -3934,9 +3946,9 @@ impl BusinessProfileUpdateBridge for api::BusinessProfileUpdate {
extended_card_info_config,
use_billing_as_payment_method_billing: self.use_billing_as_payment_method_billing,
collect_shipping_details_from_wallet_connector: self
- .collect_shipping_details_from_wallet_connector,
+ .collect_shipping_details_from_wallet_connector_if_required,
collect_billing_details_from_wallet_connector: self
- .collect_billing_details_from_wallet_connector,
+ .collect_billing_details_from_wallet_connector_if_required,
is_connector_agnostic_mit_enabled: self.is_connector_agnostic_mit_enabled,
outgoing_webhook_custom_http_headers: outgoing_webhook_custom_http_headers
.map(Into::into),
@@ -3944,6 +3956,10 @@ impl BusinessProfileUpdateBridge for api::BusinessProfileUpdate {
.order_fulfillment_time
.map(|order_fulfillment_time| order_fulfillment_time.into_inner()),
order_fulfillment_time_origin: self.order_fulfillment_time_origin,
+ always_collect_billing_details_from_wallet_connector: self
+ .always_collect_billing_details_from_wallet_connector,
+ always_collect_shipping_details_from_wallet_connector: self
+ .always_collect_shipping_details_from_wallet_connector,
},
)))
}
diff --git a/crates/router/src/core/payment_methods/cards.rs b/crates/router/src/core/payment_methods/cards.rs
index 402e5b4b0a..f305a0100a 100644
--- a/crates/router/src/core/payment_methods/cards.rs
+++ b/crates/router/src/core/payment_methods/cards.rs
@@ -60,7 +60,10 @@ use crate::types::domain::types::AsyncLift;
#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))]
use crate::utils::{self};
use crate::{
- configs::settings,
+ configs::{
+ defaults::{get_billing_required_fields, get_shipping_required_fields},
+ settings,
+ },
core::{
errors::{self, StorageErrorExt},
payment_methods::{
@@ -2898,29 +2901,12 @@ pub async fn list_payment_methods(
}
}
- let should_send_shipping_details =
- business_profile.clone().and_then(|business_profile| {
- business_profile
- .collect_shipping_details_from_wallet_connector
- });
-
- // Remove shipping fields from required fields based on business profile configuration
- if should_send_shipping_details != Some(true) {
- let shipping_variants =
- api_enums::FieldType::get_shipping_variants();
-
- let keys_to_be_removed = required_fields_hs
- .iter()
- .filter(|(_key, value)| {
- shipping_variants.contains(&value.field_type)
- })
- .map(|(key, _value)| key.to_string())
- .collect::<Vec<_>>();
-
- keys_to_be_removed.iter().for_each(|key_to_be_removed| {
- required_fields_hs.remove(key_to_be_removed);
- });
- }
+ required_fields_hs = should_collect_shipping_or_billing_details_from_wallet_connector(
+ &payment_method,
+ element.payment_experience.as_ref(),
+ business_profile.as_ref(),
+ required_fields_hs.clone(),
+ );
// get the config, check the enums while adding
{
@@ -3271,11 +3257,22 @@ pub async fn list_payment_methods(
let collect_shipping_details_from_wallets = business_profile
.as_ref()
- .and_then(|bp| bp.collect_shipping_details_from_wallet_connector);
+ .and_then(|business_profile| {
+ business_profile.always_collect_shipping_details_from_wallet_connector
+ })
+ .or(business_profile.as_ref().and_then(|business_profile| {
+ business_profile.collect_shipping_details_from_wallet_connector
+ }));
let collect_billing_details_from_wallets = business_profile
.as_ref()
- .and_then(|bp| bp.collect_billing_details_from_wallet_connector);
+ .and_then(|business_profile| {
+ business_profile.always_collect_billing_details_from_wallet_connector
+ })
+ .or(business_profile.as_ref().and_then(|business_profile| {
+ business_profile.collect_billing_details_from_wallet_connector
+ }));
+
Ok(services::ApplicationResponse::Json(
api::PaymentMethodListResponse {
redirect_url: business_profile
@@ -3320,6 +3317,37 @@ pub async fn list_payment_methods(
))
}
+fn should_collect_shipping_or_billing_details_from_wallet_connector(
+ payment_method: &api_enums::PaymentMethod,
+ payment_experience_optional: Option<&api_enums::PaymentExperience>,
+ business_profile: Option<&BusinessProfile>,
+ 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)) => {
+ let always_send_billing_details = business_profile.and_then(|business_profile| {
+ business_profile.always_collect_billing_details_from_wallet_connector
+ });
+
+ let always_send_shipping_details = business_profile.and_then(|business_profile| {
+ business_profile.always_collect_shipping_details_from_wallet_connector
+ });
+
+ if always_send_billing_details == Some(true) {
+ let billing_details = get_billing_required_fields();
+ required_fields_hs.extend(billing_details)
+ };
+ if always_send_shipping_details == Some(true) {
+ let shipping_details = get_shipping_required_fields();
+ required_fields_hs.extend(shipping_details)
+ };
+
+ required_fields_hs
+ }
+ _ => required_fields_hs,
+ }
+}
+
async fn validate_payment_method_and_client_secret(
cs: &String,
db: &dyn db::StorageInterface,
diff --git a/crates/router/src/core/payments/flows/session_flow.rs b/crates/router/src/core/payments/flows/session_flow.rs
index 4a1d57cda3..1dee684236 100644
--- a/crates/router/src/core/payments/flows/session_flow.rs
+++ b/crates/router/src/core/payments/flows/session_flow.rs
@@ -316,43 +316,61 @@ async fn create_applepay_session_token(
router_data.request.to_owned(),
)?;
- let required_billing_contact_fields = business_profile
+ let required_billing_contact_fields = if business_profile
+ .always_collect_billing_details_from_wallet_connector
+ .unwrap_or(false)
+ {
+ Some(payment_types::ApplePayBillingContactFields(vec![
+ payment_types::ApplePayAddressParameters::PostalAddress,
+ ]))
+ } else if business_profile
.collect_billing_details_from_wallet_connector
.unwrap_or(false)
- .then_some({
- let billing_variants = enums::FieldType::get_billing_variants();
- is_dynamic_fields_required(
- &state.conf.required_fields,
- enums::PaymentMethod::Wallet,
- enums::PaymentMethodType::ApplePay,
- &connector.connector_name,
- billing_variants,
- )
- .then_some(payment_types::ApplePayBillingContactFields(vec![
- payment_types::ApplePayAddressParameters::PostalAddress,
- ]))
- })
- .flatten();
+ {
+ let billing_variants = enums::FieldType::get_billing_variants();
+ is_dynamic_fields_required(
+ &state.conf.required_fields,
+ enums::PaymentMethod::Wallet,
+ enums::PaymentMethodType::ApplePay,
+ &connector.connector_name,
+ billing_variants,
+ )
+ .then_some(payment_types::ApplePayBillingContactFields(vec![
+ payment_types::ApplePayAddressParameters::PostalAddress,
+ ]))
+ } else {
+ None
+ };
- let required_shipping_contact_fields = business_profile
+ let required_shipping_contact_fields = if business_profile
+ .always_collect_shipping_details_from_wallet_connector
+ .unwrap_or(false)
+ {
+ Some(payment_types::ApplePayShippingContactFields(vec![
+ payment_types::ApplePayAddressParameters::PostalAddress,
+ payment_types::ApplePayAddressParameters::Phone,
+ payment_types::ApplePayAddressParameters::Email,
+ ]))
+ } else if business_profile
.collect_shipping_details_from_wallet_connector
.unwrap_or(false)
- .then_some({
- let shipping_variants = enums::FieldType::get_shipping_variants();
- is_dynamic_fields_required(
- &state.conf.required_fields,
- enums::PaymentMethod::Wallet,
- enums::PaymentMethodType::ApplePay,
- &connector.connector_name,
- shipping_variants,
- )
- .then_some(payment_types::ApplePayShippingContactFields(vec![
- payment_types::ApplePayAddressParameters::PostalAddress,
- payment_types::ApplePayAddressParameters::Phone,
- payment_types::ApplePayAddressParameters::Email,
- ]))
- })
- .flatten();
+ {
+ let shipping_variants = enums::FieldType::get_shipping_variants();
+ is_dynamic_fields_required(
+ &state.conf.required_fields,
+ enums::PaymentMethod::Wallet,
+ enums::PaymentMethodType::ApplePay,
+ &connector.connector_name,
+ shipping_variants,
+ )
+ .then_some(payment_types::ApplePayShippingContactFields(vec![
+ payment_types::ApplePayAddressParameters::PostalAddress,
+ payment_types::ApplePayAddressParameters::Phone,
+ payment_types::ApplePayAddressParameters::Email,
+ ]))
+ } else {
+ None
+ };
// If collect_shipping_details_from_wallet_connector is false, we check if
// collect_billing_details_from_wallet_connector is true. If it is, then we pass the Email and Phone in
@@ -655,20 +673,27 @@ fn create_gpay_session_token(
expected_format: "gpay_metadata_format".to_string(),
})?;
- let is_billing_details_required =
- if business_profile.collect_billing_details_from_wallet_connector == Some(true) {
- let billing_variants = enums::FieldType::get_billing_variants();
+ let always_collect_billing_details_from_wallet_connector = business_profile
+ .always_collect_billing_details_from_wallet_connector
+ .unwrap_or(false);
- is_dynamic_fields_required(
- &state.conf.required_fields,
- enums::PaymentMethod::Wallet,
- enums::PaymentMethodType::GooglePay,
- &connector.connector_name,
- billing_variants,
- )
- } else {
- false
- };
+ let is_billing_details_required = if always_collect_billing_details_from_wallet_connector {
+ always_collect_billing_details_from_wallet_connector
+ } else if business_profile
+ .collect_billing_details_from_wallet_connector
+ .unwrap_or(false)
+ {
+ let billing_variants = enums::FieldType::get_billing_variants();
+ is_dynamic_fields_required(
+ &state.conf.required_fields,
+ enums::PaymentMethod::Wallet,
+ enums::PaymentMethodType::GooglePay,
+ &connector.connector_name,
+ billing_variants,
+ )
+ } else {
+ false
+ };
let billing_address_parameters =
is_billing_details_required.then_some(payment_types::GpayBillingAddressParameters {
@@ -708,8 +733,17 @@ fn create_gpay_session_token(
total_price: google_pay_amount,
};
+ let always_collect_shipping_details_from_wallet_connector = business_profile
+ .always_collect_shipping_details_from_wallet_connector
+ .unwrap_or(false);
+
let required_shipping_contact_fields =
- if business_profile.collect_shipping_details_from_wallet_connector == Some(true) {
+ if always_collect_shipping_details_from_wallet_connector {
+ true
+ } else if business_profile
+ .collect_shipping_details_from_wallet_connector
+ .unwrap_or(false)
+ {
let shipping_variants = enums::FieldType::get_shipping_variants();
is_dynamic_fields_required(
diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rs
index 24f5ffdca9..df61b8809a 100644
--- a/crates/router/src/core/payments/transformers.rs
+++ b/crates/router/src/core/payments/transformers.rs
@@ -18,6 +18,7 @@ use crate::{
connector::{Helcim, Nexinets},
core::{
errors::{self, RouterResponse, RouterResult},
+ payment_methods::cards::decrypt_generic_data,
payments::{self, helpers},
utils as core_utils,
},
@@ -25,8 +26,8 @@ use crate::{
routes::{metrics, SessionState},
services::{self, RedirectForm},
types::{
- self, api,
- api::ConnectorTransactionId,
+ self,
+ api::{self, ConnectorTransactionId},
domain,
storage::{self, enums},
transformers::{ForeignFrom, ForeignInto, ForeignTryFrom},
@@ -137,14 +138,13 @@ where
let unified_address =
if let Some(payment_method_info) = payment_data.payment_method_info.clone() {
- let payment_method_billing =
- crate::core::payment_methods::cards::decrypt_generic_data::<Address>(
- state,
- payment_method_info.payment_method_billing_address,
- key_store,
- )
- .await
- .attach_printable("unable to decrypt payment method billing address details")?;
+ let payment_method_billing = decrypt_generic_data::<Address>(
+ state,
+ payment_method_info.payment_method_billing_address,
+ key_store,
+ )
+ .await
+ .attach_printable("unable to decrypt payment method billing address details")?;
payment_data
.address
.clone()
diff --git a/crates/router/src/types/api/admin.rs b/crates/router/src/types/api/admin.rs
index 11b27a583b..2d986d2c68 100644
--- a/crates/router/src/types/api/admin.rs
+++ b/crates/router/src/types/api/admin.rs
@@ -160,6 +160,10 @@ impl ForeignTryFrom<domain::BusinessProfile> for BusinessProfileResponse {
.collect_shipping_details_from_wallet_connector,
collect_billing_details_from_wallet_connector: item
.collect_billing_details_from_wallet_connector,
+ always_collect_billing_details_from_wallet_connector: item
+ .always_collect_billing_details_from_wallet_connector,
+ always_collect_shipping_details_from_wallet_connector: item
+ .always_collect_shipping_details_from_wallet_connector,
is_connector_agnostic_mit_enabled: item.is_connector_agnostic_mit_enabled,
outgoing_webhook_custom_http_headers,
})
@@ -211,10 +215,14 @@ impl ForeignTryFrom<domain::BusinessProfile> for BusinessProfileResponse {
.extended_card_info_config
.map(|config| config.expose().parse_value("ExtendedCardInfoConfig"))
.transpose()?,
- collect_shipping_details_from_wallet_connector: item
+ collect_shipping_details_from_wallet_connector_if_required: item
.collect_shipping_details_from_wallet_connector,
- collect_billing_details_from_wallet_connector: item
+ collect_billing_details_from_wallet_connector_if_required: item
.collect_billing_details_from_wallet_connector,
+ always_collect_shipping_details_from_wallet_connector: item
+ .always_collect_shipping_details_from_wallet_connector,
+ always_collect_billing_details_from_wallet_connector: item
+ .always_collect_billing_details_from_wallet_connector,
is_connector_agnostic_mit_enabled: item.is_connector_agnostic_mit_enabled,
outgoing_webhook_custom_http_headers,
order_fulfillment_time,
@@ -330,6 +338,12 @@ pub async fn create_business_profile_from_merchant_account(
collect_billing_details_from_wallet_connector: request
.collect_billing_details_from_wallet_connector
.or(Some(false)),
+ always_collect_billing_details_from_wallet_connector: request
+ .always_collect_billing_details_from_wallet_connector
+ .or(Some(false)),
+ always_collect_shipping_details_from_wallet_connector: request
+ .always_collect_shipping_details_from_wallet_connector
+ .or(Some(false)),
outgoing_webhook_custom_http_headers: outgoing_webhook_custom_http_headers.map(Into::into),
})
}
diff --git a/migrations/2024-07-23-060446_always_collect_billing_details_from_wallet_connector/down.sql b/migrations/2024-07-23-060446_always_collect_billing_details_from_wallet_connector/down.sql
new file mode 100644
index 0000000000..2cc1119dac
--- /dev/null
+++ b/migrations/2024-07-23-060446_always_collect_billing_details_from_wallet_connector/down.sql
@@ -0,0 +1,3 @@
+-- This file should undo anything in `up.sql`
+
+ALTER TABLE business_profile DROP COLUMN IF EXISTS always_collect_billing_details_from_wallet_connector;
\ No newline at end of file
diff --git a/migrations/2024-07-23-060446_always_collect_billing_details_from_wallet_connector/up.sql b/migrations/2024-07-23-060446_always_collect_billing_details_from_wallet_connector/up.sql
new file mode 100644
index 0000000000..ee94a6224d
--- /dev/null
+++ b/migrations/2024-07-23-060446_always_collect_billing_details_from_wallet_connector/up.sql
@@ -0,0 +1,3 @@
+-- Your SQL goes here
+
+ALTER TABLE business_profile ADD COLUMN IF NOT EXISTS always_collect_billing_details_from_wallet_connector BOOLEAN DEFAULT FALSE;
\ No newline at end of file
diff --git a/migrations/2024-07-23-060936_always_collect_shipping_details_from_wallet_connector/down.sql b/migrations/2024-07-23-060936_always_collect_shipping_details_from_wallet_connector/down.sql
new file mode 100644
index 0000000000..b277b3122f
--- /dev/null
+++ b/migrations/2024-07-23-060936_always_collect_shipping_details_from_wallet_connector/down.sql
@@ -0,0 +1,3 @@
+-- This file should undo anything in `up.sql`
+
+ALTER TABLE business_profile DROP COLUMN IF EXISTS always_collect_shipping_details_from_wallet_connector;
\ No newline at end of file
diff --git a/migrations/2024-07-23-060936_always_collect_shipping_details_from_wallet_connector/up.sql b/migrations/2024-07-23-060936_always_collect_shipping_details_from_wallet_connector/up.sql
new file mode 100644
index 0000000000..2ac4d7c28b
--- /dev/null
+++ b/migrations/2024-07-23-060936_always_collect_shipping_details_from_wallet_connector/up.sql
@@ -0,0 +1,3 @@
+-- Your SQL goes here
+
+ALTER TABLE business_profile ADD COLUMN IF NOT EXISTS always_collect_shipping_details_from_wallet_connector BOOLEAN DEFAULT FALSE;
\ No newline at end of file