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(business_profile): feature add a config to use `billing` as `payment_method_billing` (#4557)

Narayan Bhat3e1c7eba49de
diff --git a/crates/api_models/src/admin.rs b/crates/api_models/src/admin.rs
index 3beeb9071a..bf4eeb79fe 100644
--- a/crates/api_models/src/admin.rs
+++ b/crates/api_models/src/admin.rs
@@ -913,6 +913,9 @@ pub struct BusinessProfileCreate {
/// External 3DS authentication details
pub authentication_connector_details: Option<AuthenticationConnectorDetails>,
+
+ /// Whether to use the billing details passed when creating the intent as payment method billing
+ pub use_billing_as_payment_method_billing: Option<bool>,
}
#[derive(Clone, Debug, ToSchema, Serialize)]
@@ -982,6 +985,9 @@ pub struct BusinessProfileResponse {
/// External 3DS authentication details
pub authentication_connector_details: Option<AuthenticationConnectorDetails>,
+
+ // Whether to use the billing details passed when creating the intent as payment method billing
+ pub use_billing_as_payment_method_billing: Option<bool>,
}
#[derive(Clone, Debug, Deserialize, ToSchema, Serialize)]
@@ -1046,6 +1052,9 @@ pub struct BusinessProfileUpdate {
/// Merchant's config to support extended card info feature
pub extended_card_info_config: Option<ExtendedCardInfoConfig>,
+
+ // Whether to use the billing details passed when creating the intent as payment method billing
+ pub use_billing_as_payment_method_billing: Option<bool>,
}
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize, PartialEq, ToSchema)]
diff --git a/crates/diesel_models/src/business_profile.rs b/crates/diesel_models/src/business_profile.rs
index 1131e9ad67..41a938d83e 100644
--- a/crates/diesel_models/src/business_profile.rs
+++ b/crates/diesel_models/src/business_profile.rs
@@ -38,6 +38,7 @@ pub struct BusinessProfile {
pub is_extended_card_info_enabled: Option<bool>,
pub extended_card_info_config: Option<pii::SecretSerdeValue>,
pub is_connector_agnostic_mit_enabled: Option<bool>,
+ pub use_billing_as_payment_method_billing: Option<bool>,
}
#[derive(Clone, Debug, Insertable, router_derive::DebugAsDisplay)]
@@ -67,6 +68,7 @@ pub struct BusinessProfileNew {
pub is_extended_card_info_enabled: Option<bool>,
pub extended_card_info_config: Option<pii::SecretSerdeValue>,
pub is_connector_agnostic_mit_enabled: Option<bool>,
+ pub use_billing_as_payment_method_billing: Option<bool>,
}
#[derive(Clone, Debug, Default, AsChangeset, router_derive::DebugAsDisplay)]
@@ -93,6 +95,7 @@ pub struct BusinessProfileUpdateInternal {
pub is_extended_card_info_enabled: Option<bool>,
pub extended_card_info_config: Option<pii::SecretSerdeValue>,
pub is_connector_agnostic_mit_enabled: Option<bool>,
+ pub use_billing_as_payment_method_billing: Option<bool>,
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
@@ -116,6 +119,7 @@ pub enum BusinessProfileUpdate {
session_expiry: Option<i64>,
authentication_connector_details: Option<serde_json::Value>,
extended_card_info_config: Option<pii::SecretSerdeValue>,
+ use_billing_as_payment_method_billing: Option<bool>,
},
ExtendedCardInfoUpdate {
is_extended_card_info_enabled: Option<bool>,
@@ -147,6 +151,7 @@ impl From<BusinessProfileUpdate> for BusinessProfileUpdateInternal {
session_expiry,
authentication_connector_details,
extended_card_info_config,
+ use_billing_as_payment_method_billing,
} => Self {
profile_name,
modified_at,
@@ -166,6 +171,7 @@ impl From<BusinessProfileUpdate> for BusinessProfileUpdateInternal {
session_expiry,
authentication_connector_details,
extended_card_info_config,
+ use_billing_as_payment_method_billing,
..Default::default()
},
BusinessProfileUpdate::ExtendedCardInfoUpdate {
@@ -210,6 +216,7 @@ impl From<BusinessProfileNew> for BusinessProfile {
is_connector_agnostic_mit_enabled: new.is_connector_agnostic_mit_enabled,
is_extended_card_info_enabled: new.is_extended_card_info_enabled,
extended_card_info_config: new.extended_card_info_config,
+ use_billing_as_payment_method_billing: new.use_billing_as_payment_method_billing,
}
}
}
@@ -237,6 +244,7 @@ impl BusinessProfileUpdate {
is_extended_card_info_enabled,
extended_card_info_config,
is_connector_agnostic_mit_enabled,
+ use_billing_as_payment_method_billing,
} = self.into();
BusinessProfile {
profile_name: profile_name.unwrap_or(source.profile_name),
@@ -261,6 +269,7 @@ impl BusinessProfileUpdate {
is_extended_card_info_enabled,
is_connector_agnostic_mit_enabled,
extended_card_info_config,
+ use_billing_as_payment_method_billing,
..source
}
}
diff --git a/crates/diesel_models/src/schema.rs b/crates/diesel_models/src/schema.rs
index 810d82d321..70a227a310 100644
--- a/crates/diesel_models/src/schema.rs
+++ b/crates/diesel_models/src/schema.rs
@@ -195,6 +195,7 @@ diesel::table! {
is_extended_card_info_enabled -> Nullable<Bool>,
extended_card_info_config -> Nullable<Jsonb>,
is_connector_agnostic_mit_enabled -> Nullable<Bool>,
+ use_billing_as_payment_method_billing -> Nullable<Bool>,
}
}
diff --git a/crates/router/src/core/admin.rs b/crates/router/src/core/admin.rs
index e0cfe0dee8..6433a3819f 100644
--- a/crates/router/src/core/admin.rs
+++ b/crates/router/src/core/admin.rs
@@ -440,6 +440,7 @@ pub async fn update_business_profile_cascade(
session_expiry: None,
authentication_connector_details: None,
extended_card_info_config: None,
+ use_billing_as_payment_method_billing: None,
};
let update_futures = business_profiles.iter().map(|business_profile| async {
@@ -1691,6 +1692,7 @@ pub async fn update_business_profile(
field_name: "authentication_connector_details",
})?,
extended_card_info_config,
+ use_billing_as_payment_method_billing: request.use_billing_as_payment_method_billing,
};
let updated_business_profile = db
diff --git a/crates/router/src/core/payment_methods/cards.rs b/crates/router/src/core/payment_methods/cards.rs
index 9ae327269c..efde37b92a 100644
--- a/crates/router/src/core/payment_methods/cards.rs
+++ b/crates/router/src/core/payment_methods/cards.rs
@@ -2135,10 +2135,19 @@ pub async fn list_payment_methods(
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
}
+ // Check for `use_billing_as_payment_method_billing` config under business_profile
+ // If this is disabled, then the billing details in required fields will be empty and have to be collected by the customer
+ let billing_address_for_calculating_required_fields = business_profile
+ .as_ref()
+ .and_then(|business_profile| business_profile.use_billing_as_payment_method_billing)
+ .unwrap_or(true)
+ .then_some(billing_address.as_ref())
+ .flatten();
+
let req = api_models::payments::PaymentsRequest::foreign_from((
payment_attempt.as_ref(),
shipping_address.as_ref(),
- billing_address.as_ref(),
+ billing_address_for_calculating_required_fields,
customer.as_ref(),
));
let req_val = serde_json::to_value(req).ok();
diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs
index 0e10c2a541..578b8d8030 100644
--- a/crates/router/src/core/payments.rs
+++ b/crates/router/src/core/payments.rs
@@ -2426,23 +2426,28 @@ pub mod payment_address {
shipping: Option<api::Address>,
billing: Option<api::Address>,
payment_method_billing: Option<api::Address>,
+ should_unify_address: Option<bool>,
) -> Self {
// billing -> .billing, this is the billing details passed in the root of payments request
- // payment_method_billing -> .payment_method_data.billing
-
- // Merge the billing details field from both `payment.billing` and `payment.payment_method_data.billing`
- // The unified payment_method_billing will be used as billing address and passed to the connector module
- // This unification is required in order to provide backwards compatibility
- // so that if `payment.billing` is passed it should be sent to the connector module
- // Unify the billing details with `payment_method_data.billing`
- let unified_payment_method_billing = payment_method_billing
- .as_ref()
- .map(|payment_method_billing| {
- payment_method_billing
- .clone()
- .unify_address(billing.as_ref())
- })
- .or(billing.clone());
+ // payment_method_billing -> payment_method_data.billing
+
+ let unified_payment_method_billing = if should_unify_address.unwrap_or(true) {
+ // Merge the billing details field from both `payment.billing` and `payment.payment_method_data.billing`
+ // The unified payment_method_billing will be used as billing address and passed to the connector module
+ // This unification is required in order to provide backwards compatibility
+ // so that if `payment.billing` is passed it should be sent to the connector module
+ // Unify the billing details with `payment_method_data.billing`
+ payment_method_billing
+ .as_ref()
+ .map(|payment_method_billing| {
+ payment_method_billing
+ .clone()
+ .unify_address(billing.as_ref())
+ })
+ .or(billing.clone())
+ } else {
+ payment_method_billing.clone()
+ };
Self {
shipping,
diff --git a/crates/router/src/core/payments/operations/payment_approve.rs b/crates/router/src/core/payments/operations/payment_approve.rs
index 8dffd8eaec..bc60d8a358 100644
--- a/crates/router/src/core/payments/operations/payment_approve.rs
+++ b/crates/router/src/core/payments/operations/payment_approve.rs
@@ -150,6 +150,7 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
shipping_address.as_ref().map(From::from),
billing_address.as_ref().map(From::from),
payment_method_billing.as_ref().map(From::from),
+ business_profile.use_billing_as_payment_method_billing,
),
confirm: None,
payment_method_data: None,
diff --git a/crates/router/src/core/payments/operations/payment_cancel.rs b/crates/router/src/core/payments/operations/payment_cancel.rs
index 32035391fb..2d05fa2152 100644
--- a/crates/router/src/core/payments/operations/payment_cancel.rs
+++ b/crates/router/src/core/payments/operations/payment_cancel.rs
@@ -165,6 +165,7 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
shipping_address.as_ref().map(From::from),
billing_address.as_ref().map(From::from),
payment_method_billing.as_ref().map(From::from),
+ business_profile.use_billing_as_payment_method_billing,
),
confirm: None,
payment_method_data: None,
diff --git a/crates/router/src/core/payments/operations/payment_capture.rs b/crates/router/src/core/payments/operations/payment_capture.rs
index d4c3f0acad..71549a17c2 100644
--- a/crates/router/src/core/payments/operations/payment_capture.rs
+++ b/crates/router/src/core/payments/operations/payment_capture.rs
@@ -207,6 +207,7 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
shipping_address.as_ref().map(From::from),
billing_address.as_ref().map(From::from),
payment_method_billing.as_ref().map(From::from),
+ business_profile.use_billing_as_payment_method_billing,
),
confirm: None,
payment_method_data: None,
diff --git a/crates/router/src/core/payments/operations/payment_complete_authorize.rs b/crates/router/src/core/payments/operations/payment_complete_authorize.rs
index d31ec14a72..f1cb0fa92e 100644
--- a/crates/router/src/core/payments/operations/payment_complete_authorize.rs
+++ b/crates/router/src/core/payments/operations/payment_complete_authorize.rs
@@ -279,6 +279,7 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
shipping_address.as_ref().map(From::from),
billing_address.as_ref().map(From::from),
payment_method_billing.as_ref().map(From::from),
+ business_profile.use_billing_as_payment_method_billing,
),
confirm: request.confirm,
payment_method_data: request
diff --git a/crates/router/src/core/payments/operations/payment_confirm.rs b/crates/router/src/core/payments/operations/payment_confirm.rs
index 3d4f2a3cad..ee4f499d42 100644
--- a/crates/router/src/core/payments/operations/payment_confirm.rs
+++ b/crates/router/src/core/payments/operations/payment_confirm.rs
@@ -609,6 +609,7 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
shipping_address.as_ref().map(From::from),
billing_address.as_ref().map(From::from),
payment_method_billing.as_ref().map(From::from),
+ business_profile.use_billing_as_payment_method_billing,
),
token_data,
confirm: request.confirm,
diff --git a/crates/router/src/core/payments/operations/payment_create.rs b/crates/router/src/core/payments/operations/payment_create.rs
index 0d24120220..e90617f538 100644
--- a/crates/router/src/core/payments/operations/payment_create.rs
+++ b/crates/router/src/core/payments/operations/payment_create.rs
@@ -424,6 +424,7 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
shipping_address.as_ref().map(From::from),
billing_address.as_ref().map(From::from),
payment_method_billing_address.as_ref().map(From::from),
+ business_profile.use_billing_as_payment_method_billing,
),
token_data: None,
confirm: request.confirm,
diff --git a/crates/router/src/core/payments/operations/payment_reject.rs b/crates/router/src/core/payments/operations/payment_reject.rs
index 8845fe836e..8ba627dc56 100644
--- a/crates/router/src/core/payments/operations/payment_reject.rs
+++ b/crates/router/src/core/payments/operations/payment_reject.rs
@@ -148,6 +148,7 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
shipping_address.as_ref().map(From::from),
billing_address.as_ref().map(From::from),
payment_method_billing.as_ref().map(From::from),
+ business_profile.use_billing_as_payment_method_billing,
),
token_data: None,
confirm: None,
diff --git a/crates/router/src/core/payments/operations/payment_session.rs b/crates/router/src/core/payments/operations/payment_session.rs
index 808eb20eb1..485e25c2c9 100644
--- a/crates/router/src/core/payments/operations/payment_session.rs
+++ b/crates/router/src/core/payments/operations/payment_session.rs
@@ -174,6 +174,7 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
shipping_address.as_ref().map(From::from),
billing_address.as_ref().map(From::from),
payment_method_billing.as_ref().map(From::from),
+ business_profile.use_billing_as_payment_method_billing,
),
confirm: None,
payment_method_data: None,
diff --git a/crates/router/src/core/payments/operations/payment_start.rs b/crates/router/src/core/payments/operations/payment_start.rs
index c7042908b6..01ab858635 100644
--- a/crates/router/src/core/payments/operations/payment_start.rs
+++ b/crates/router/src/core/payments/operations/payment_start.rs
@@ -159,6 +159,7 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
shipping_address.as_ref().map(From::from),
billing_address.as_ref().map(From::from),
payment_method_billing.as_ref().map(From::from),
+ business_profile.use_billing_as_payment_method_billing,
),
token_data,
confirm: Some(payment_attempt.confirm),
diff --git a/crates/router/src/core/payments/operations/payment_status.rs b/crates/router/src/core/payments/operations/payment_status.rs
index 06ad57346f..85e7fa2bf5 100644
--- a/crates/router/src/core/payments/operations/payment_status.rs
+++ b/crates/router/src/core/payments/operations/payment_status.rs
@@ -459,6 +459,7 @@ async fn get_tracker_for_sync<
shipping_address.as_ref().map(From::from),
billing_address.as_ref().map(From::from),
payment_method_billing.as_ref().map(From::from),
+ business_profile.use_billing_as_payment_method_billing,
),
token_data: None,
confirm: Some(request.force_sync),
diff --git a/crates/router/src/core/payments/operations/payment_update.rs b/crates/router/src/core/payments/operations/payment_update.rs
index de83b935ff..c7479672c7 100644
--- a/crates/router/src/core/payments/operations/payment_update.rs
+++ b/crates/router/src/core/payments/operations/payment_update.rs
@@ -425,6 +425,7 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
shipping_address.as_ref().map(From::from),
billing_address.as_ref().map(From::from),
payment_method_billing.as_ref().map(From::from),
+ business_profile.use_billing_as_payment_method_billing,
),
confirm: request.confirm,
payment_method_data: request
diff --git a/crates/router/src/core/payments/operations/payments_incremental_authorization.rs b/crates/router/src/core/payments/operations/payments_incremental_authorization.rs
index ddba82fc04..c28e6b35d5 100644
--- a/crates/router/src/core/payments/operations/payments_incremental_authorization.rs
+++ b/crates/router/src/core/payments/operations/payments_incremental_authorization.rs
@@ -125,7 +125,7 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
customer_acceptance: None,
token: None,
token_data: None,
- address: PaymentAddress::new(None, None, None),
+ address: PaymentAddress::new(None, None, None, None),
confirm: None,
payment_method_data: None,
payment_method_info: None,
diff --git a/crates/router/src/core/routing/helpers.rs b/crates/router/src/core/routing/helpers.rs
index 3702498767..3449838164 100644
--- a/crates/router/src/core/routing/helpers.rs
+++ b/crates/router/src/core/routing/helpers.rs
@@ -264,7 +264,9 @@ pub async fn update_business_profile_active_algorithm_ref(
session_expiry: None,
authentication_connector_details: None,
extended_card_info_config: None,
+ use_billing_as_payment_method_billing: None,
};
+
db.update_business_profile_by_profile_id(current_business_profile, business_profile_update)
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
diff --git a/crates/router/src/core/utils.rs b/crates/router/src/core/utils.rs
index ac546ef5e4..ae6dc0e86f 100644
--- a/crates/router/src/core/utils.rs
+++ b/crates/router/src/core/utils.rs
@@ -117,7 +117,7 @@ pub async fn construct_payout_router_data<'a, F>(
}
});
- let address = PaymentAddress::new(None, billing_address, None);
+ let address = PaymentAddress::new(None, billing_address, None, None);
let test_mode: Option<bool> = merchant_connector_account.is_test_mode_on();
let payouts = &payout_data.payouts;
diff --git a/crates/router/src/types/api/admin.rs b/crates/router/src/types/api/admin.rs
index 793d042ea4..262999af94 100644
--- a/crates/router/src/types/api/admin.rs
+++ b/crates/router/src/types/api/admin.rs
@@ -79,6 +79,7 @@ impl ForeignTryFrom<storage::business_profile::BusinessProfile> for BusinessProf
authentication_connector_details.parse_value("AuthenticationDetails")
})
.transpose()?,
+ use_billing_as_payment_method_billing: item.use_billing_as_payment_method_billing,
})
}
}
@@ -178,6 +179,9 @@ impl ForeignTryFrom<(domain::MerchantAccount, BusinessProfileCreate)>
is_connector_agnostic_mit_enabled: None,
is_extended_card_info_enabled: None,
extended_card_info_config: None,
+ use_billing_as_payment_method_billing: request
+ .use_billing_as_payment_method_billing
+ .or(Some(true)),
})
}
}
diff --git a/crates/router/src/types/api/verify_connector.rs b/crates/router/src/types/api/verify_connector.rs
index af7cb9160b..d35abd233f 100644
--- a/crates/router/src/types/api/verify_connector.rs
+++ b/crates/router/src/types/api/verify_connector.rs
@@ -89,7 +89,7 @@ impl VerifyConnectorData {
recurring_mandate_payment_data: None,
payment_method_status: None,
connector_request_reference_id: attempt_id,
- address: types::PaymentAddress::new(None, None, None),
+ address: types::PaymentAddress::new(None, None, None, None),
payment_id: common_utils::generate_id_with_default_len(
consts::VERIFY_CONNECTOR_ID_PREFIX,
),
diff --git a/crates/router/tests/connectors/aci.rs b/crates/router/tests/connectors/aci.rs
index 2e5e8748f4..3548bc5e5b 100644
--- a/crates/router/tests/connectors/aci.rs
+++ b/crates/router/tests/connectors/aci.rs
@@ -92,6 +92,7 @@ fn construct_payment_router_data() -> types::PaymentsAuthorizeRouterData {
}),
email: None,
}),
+ None,
),
connector_meta_data: None,
amount_captured: None,
diff --git a/crates/router/tests/connectors/adyen.rs b/crates/router/tests/connectors/adyen.rs
index d19fff2900..4d4318064e 100644
--- a/crates/router/tests/connectors/adyen.rs
+++ b/crates/router/tests/connectors/adyen.rs
@@ -72,6 +72,7 @@ impl AdyenTest {
email: None,
}),
None,
+ None,
)),
..Default::default()
})
@@ -100,6 +101,7 @@ impl AdyenTest {
email: None,
}),
None,
+ None,
)),
payout_method_data: match payout_type {
enums::PayoutType::Card => Some(types::api::PayoutMethodData::Card(
diff --git a/crates/router/tests/connectors/airwallex.rs b/crates/router/tests/connectors/airwallex.rs
index 2ef61099ca..d976aca7ce 100644
--- a/crates/router/tests/connectors/airwallex.rs
+++ b/crates/router/tests/connectors/airwallex.rs
@@ -64,6 +64,7 @@ fn get_default_payment_info() -> Option<utils::PaymentInfo> {
phone: None,
email: None,
}),
+ None,
)),
..Default::default()
})
diff --git a/crates/router/tests/connectors/bitpay.rs b/crates/router/tests/connectors/bitpay.rs
index 85b388f2fd..2dd90e704b 100644
--- a/crates/router/tests/connectors/bitpay.rs
+++ b/crates/router/tests/connectors/bitpay.rs
@@ -58,6 +58,7 @@ fn get_default_payment_info() -> Option<utils::PaymentInfo> {
email: None,
}),
None,
+ None,
)),
..Default::default()
})
diff --git a/crates/router/tests/connectors/bluesnap.rs b/crates/router/tests/connectors/bluesnap.rs
index 3a654eda83..88b6fbec24 100644
--- a/crates/router/tests/connectors/bluesnap.rs
+++ b/crates/router/tests/connectors/bluesnap.rs
@@ -58,6 +58,7 @@ fn get_payment_info() -> Option<PaymentInfo> {
email: None,
}),
None,
+ None,
)),
..Default::default()
})
diff --git a/crates/router/tests/connectors/cashtocode.rs b/crates/router/tests/connectors/cashtocode.rs
index 025d9cdac6..60620d1b4c 100644
--- a/crates/router/tests/connectors/cashtocode.rs
+++ b/crates/router/tests/connectors/cashtocode.rs
@@ -88,6 +88,7 @@ impl CashtocodeTest {
email: None,
}),
None,
+ None,
)),
return_url: Some("https://google.com".to_owned()),
..Default::default()
diff --git a/crates/router/tests/connectors/coinbase.rs b/crates/router/tests/connectors/coinbase.rs
index 0bcb3c705a..5dd42a2c97 100644
--- a/crates/router/tests/connectors/coinbase.rs
+++ b/crates/router/tests/connectors/coinbase.rs
@@ -59,6 +59,7 @@ fn get_default_payment_info() -> Option<utils::PaymentInfo> {
email: None,
}),
None,
+ None,
)),
connector_meta_data: Some(json!({"pricing_type": "fixed_price"})),
..Default::default()
diff --git a/crates/router/tests/connectors/cryptopay.rs b/crates/router/tests/connectors/cryptopay.rs
index 626c05fe11..c26bad8c56 100644
--- a/crates/router/tests/connectors/cryptopay.rs
+++ b/crates/router/tests/connectors/cryptopay.rs
@@ -58,6 +58,7 @@ fn get_default_payment_info() -> Option<utils::PaymentInfo> {
email: None,
}),
None,
+ None,
)),
return_url: Some(String::from("https://google.com")),
..Default::default()
diff --git a/crates/router/tests/connectors/cybersource.rs b/crates/router/tests/connectors/cybersource.rs
index 700e9a2d94..bb74e805c3 100644
--- a/crates/router/tests/connectors/cybersource.rs
+++ b/crates/router/tests/connectors/cybersource.rs
@@ -55,6 +55,7 @@ fn get_default_payment_info() -> Option<utils::PaymentInfo> {
email: None,
}),
None,
+ None,
)),
..Default::default()
})
diff --git a/crates/router/tests/connectors/dlocal.rs b/crates/router/tests/connectors/dlocal.rs
index b715e20fec..2f04904d7b 100644
--- a/crates/router/tests/connectors/dlocal.rs
+++ b/crates/router/tests/connectors/dlocal.rs
@@ -438,6 +438,7 @@ pub fn get_payment_info() -> PaymentInfo {
email: None,
}),
None,
+ None,
)),
auth_type: None,
access_token: None,
diff --git a/crates/router/tests/connectors/forte.rs b/crates/router/tests/connectors/forte.rs
index 1c99c2ff7b..d690524bd1 100644
--- a/crates/router/tests/connectors/forte.rs
+++ b/crates/router/tests/connectors/forte.rs
@@ -71,6 +71,7 @@ fn get_default_payment_info() -> Option<utils::PaymentInfo> {
email: None,
}),
None,
+ None,
)),
..Default::default()
})
diff --git a/crates/router/tests/connectors/globalpay.rs b/crates/router/tests/connectors/globalpay.rs
index 8ca4d6f1ae..9472b600a5 100644
--- a/crates/router/tests/connectors/globalpay.rs
+++ b/crates/router/tests/connectors/globalpay.rs
@@ -68,6 +68,7 @@ impl Globalpay {
..Default::default()
}),
None,
+ None,
)),
access_token: get_access_token(),
connector_meta_data: CONNECTOR.get_connector_meta(),
diff --git a/crates/router/tests/connectors/iatapay.rs b/crates/router/tests/connectors/iatapay.rs
index dfb8e097be..4d3904a0c2 100644
--- a/crates/router/tests/connectors/iatapay.rs
+++ b/crates/router/tests/connectors/iatapay.rs
@@ -75,6 +75,7 @@ fn get_default_payment_info() -> Option<utils::PaymentInfo> {
email: None,
}),
None,
+ None,
)),
access_token: get_access_token(),
return_url: Some(String::from("https://hyperswitch.io")),
diff --git a/crates/router/tests/connectors/multisafepay.rs b/crates/router/tests/connectors/multisafepay.rs
index 606b60b249..ba852ea2eb 100644
--- a/crates/router/tests/connectors/multisafepay.rs
+++ b/crates/router/tests/connectors/multisafepay.rs
@@ -56,6 +56,7 @@ fn get_default_payment_info() -> Option<PaymentInfo> {
email: None,
}),
None,
+ None,
));
Some(PaymentInfo {
address,
diff --git a/crates/router/tests/connectors/opennode.rs b/crates/router/tests/connectors/opennode.rs
index c91126953d..1e2cea554e 100644
--- a/crates/router/tests/connectors/opennode.rs
+++ b/crates/router/tests/connectors/opennode.rs
@@ -58,6 +58,7 @@ fn get_default_payment_info() -> Option<utils::PaymentInfo> {
email: None,
}),
None,
+ None,
)),
return_url: Some(String::from("https://google.com")),
..Default::default()
diff --git a/crates/router/tests/connectors/payeezy.rs b/crates/router/tests/connectors/payeezy.rs
index bfc0cb1365..334b26f000 100644
--- a/crates/router/tests/connectors/payeezy.rs
+++ b/crates/router/tests/connectors/payeezy.rs
@@ -66,6 +66,7 @@ impl PayeezyTest {
email: None,
}),
None,
+ None,
)),
..Default::default()
})
diff --git a/crates/router/tests/connectors/payme.rs b/crates/router/tests/connectors/payme.rs
index 234f3a0eeb..6554ddbefb 100644
--- a/crates/router/tests/connectors/payme.rs
+++ b/crates/router/tests/connectors/payme.rs
@@ -60,6 +60,7 @@ fn get_default_payment_info() -> Option<utils::PaymentInfo> {
email: None,
}),
None,
+ None,
)),
auth_type: None,
access_token: None,
diff --git a/crates/router/tests/connectors/trustpay.rs b/crates/router/tests/connectors/trustpay.rs
index fba612863b..b8aeefce49 100644
--- a/crates/router/tests/connectors/trustpay.rs
+++ b/crates/router/tests/connectors/trustpay.rs
@@ -84,6 +84,7 @@ fn get_default_payment_info() -> Option<utils::PaymentInfo> {
email: None,
}),
None,
+ None,
)),
..Default::default()
})
diff --git a/crates/router/tests/connectors/utils.rs b/crates/router/tests/connectors/utils.rs
index 3196c4c763..c19fdb26ad 100644
--- a/crates/router/tests/connectors/utils.rs
+++ b/crates/router/tests/connectors/utils.rs
@@ -69,6 +69,7 @@ impl PaymentInfo {
phone: None,
email: None,
}),
+ None,
)),
..Default::default()
}
diff --git a/crates/router/tests/connectors/wise.rs b/crates/router/tests/connectors/wise.rs
index fd5bbc109d..36a16635e0 100644
--- a/crates/router/tests/connectors/wise.rs
+++ b/crates/router/tests/connectors/wise.rs
@@ -68,6 +68,7 @@ impl WiseTest {
email: None,
}),
None,
+ None,
)),
payout_method_data: Some(api::PayoutMethodData::Bank(api::payouts::BankPayout::Bacs(
api::BacsBankTransfer {
diff --git a/crates/router/tests/connectors/worldline.rs b/crates/router/tests/connectors/worldline.rs
index 4f8119bfc5..36d0bba6c4 100644
--- a/crates/router/tests/connectors/worldline.rs
+++ b/crates/router/tests/connectors/worldline.rs
@@ -56,6 +56,7 @@ impl WorldlineTest {
email: None,
}),
None,
+ None,
)),
..Default::default()
})
@@ -179,7 +180,7 @@ async fn should_throw_missing_required_field_for_country() {
.make_payment(
authorize_data,
Some(PaymentInfo {
- address: Some(PaymentAddress::new(None, None, None)),
+ address: Some(PaymentAddress::new(None, None, None, None)),
..Default::default()
}),
)
diff --git a/migrations/2024-05-06-065226_add_billing_config_to_business_profile/down.sql b/migrations/2024-05-06-065226_add_billing_config_to_business_profile/down.sql
new file mode 100644
index 0000000000..9fc70d18d4
--- /dev/null
+++ b/migrations/2024-05-06-065226_add_billing_config_to_business_profile/down.sql
@@ -0,0 +1,2 @@
+-- This file should undo anything in `up.sql`
+ALTER TABLE business_profile DROP COLUMN IF EXISTS use_billing_as_payment_method_billing;
diff --git a/migrations/2024-05-06-065226_add_billing_config_to_business_profile/up.sql b/migrations/2024-05-06-065226_add_billing_config_to_business_profile/up.sql
new file mode 100644
index 0000000000..de841e4f5e
--- /dev/null
+++ b/migrations/2024-05-06-065226_add_billing_config_to_business_profile/up.sql
@@ -0,0 +1,3 @@
+-- Your SQL goes here
+ALTER TABLE business_profile
+ADD COLUMN IF NOT EXISTS use_billing_as_payment_method_billing BOOLEAN DEFAULT TRUE;
diff --git a/openapi/openapi_spec.json b/openapi/openapi_spec.json
index 201f6582dd..c330816cea 100644
--- a/openapi/openapi_spec.json
+++ b/openapi/openapi_spec.json
@@ -6668,6 +6668,11 @@
}
],
"nullable": true
+ },
+ "use_billing_as_payment_method_billing": {
+ "type": "boolean",
+ "description": "Whether to use the billing details passed when creating the intent as payment method billing",
+ "nullable": true
}
},
"additionalProperties": false
@@ -6787,6 +6792,10 @@
}
],
"nullable": true
+ },
+ "use_billing_as_payment_method_billing": {
+ "type": "boolean",
+ "nullable": true
}
}
},