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

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
Shankar Singh C
2024-08-22 17:09:14 +05:30
committed by GitHub
parent d3521e7e76
commit bda29cb1b5
18 changed files with 597 additions and 726 deletions

View File

@ -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,

View File

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

View File

@ -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>,