refactor(router): Remove payment_methods_v2 and customer_v2 feature flag (#8236)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
Prasunna Soppa
2025-06-12 00:07:24 +05:30
committed by GitHub
parent 6ea2e2a6f4
commit 000aa23c10
106 changed files with 896 additions and 1856 deletions

View File

@ -6,7 +6,7 @@ use utoipa::ToSchema;
use crate::payments;
/// The customer details
#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))]
#[cfg(feature = "v1")]
#[derive(Debug, Default, Clone, Deserialize, Serialize, ToSchema)]
pub struct CustomerRequest {
/// The identifier for the customer object. If not provided the customer ID will be autogenerated.
@ -51,7 +51,7 @@ pub struct CustomerListRequest {
pub limit: Option<u16>,
}
#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))]
#[cfg(feature = "v1")]
impl CustomerRequest {
pub fn get_merchant_reference_id(&self) -> Option<id_type::CustomerId> {
Some(
@ -69,7 +69,7 @@ impl CustomerRequest {
}
/// The customer details
#[cfg(all(feature = "v2", feature = "customer_v2"))]
#[cfg(feature = "v2")]
#[derive(Debug, Default, Clone, Deserialize, Serialize, ToSchema)]
#[serde(deny_unknown_fields)]
pub struct CustomerRequest {
@ -104,7 +104,7 @@ pub struct CustomerRequest {
pub metadata: Option<pii::SecretSerdeValue>,
}
#[cfg(all(feature = "v2", feature = "customer_v2"))]
#[cfg(feature = "v2")]
impl CustomerRequest {
pub fn get_merchant_reference_id(&self) -> Option<id_type::CustomerId> {
self.merchant_reference_id.clone()
@ -123,7 +123,7 @@ impl CustomerRequest {
}
}
#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))]
#[cfg(feature = "v1")]
#[derive(Debug, Clone, Serialize, ToSchema)]
pub struct CustomerResponse {
/// The identifier for the customer object
@ -161,14 +161,14 @@ pub struct CustomerResponse {
pub default_payment_method_id: Option<String>,
}
#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))]
#[cfg(feature = "v1")]
impl CustomerResponse {
pub fn get_merchant_reference_id(&self) -> Option<id_type::CustomerId> {
Some(self.customer_id.clone())
}
}
#[cfg(all(feature = "v2", feature = "customer_v2"))]
#[cfg(feature = "v2")]
#[derive(Debug, Clone, Serialize, ToSchema)]
pub struct CustomerResponse {
/// Unique identifier for the customer
@ -220,14 +220,14 @@ pub struct CustomerResponse {
pub default_payment_method_id: Option<id_type::GlobalPaymentMethodId>,
}
#[cfg(all(feature = "v2", feature = "customer_v2"))]
#[cfg(feature = "v2")]
impl CustomerResponse {
pub fn get_merchant_reference_id(&self) -> Option<id_type::CustomerId> {
self.merchant_reference_id.clone()
}
}
#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))]
#[cfg(feature = "v1")]
#[derive(Debug, Deserialize, Serialize, ToSchema)]
pub struct CustomerDeleteResponse {
/// The identifier for the customer object
@ -244,7 +244,7 @@ pub struct CustomerDeleteResponse {
pub payment_methods_deleted: bool,
}
#[cfg(all(feature = "v2", feature = "customer_v2"))]
#[cfg(feature = "v2")]
#[derive(Debug, Deserialize, Serialize, ToSchema)]
pub struct CustomerDeleteResponse {
/// Unique identifier for the customer
@ -270,7 +270,7 @@ pub struct CustomerDeleteResponse {
}
/// The identifier for the customer object. If not provided the customer ID will be autogenerated.
#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))]
#[cfg(feature = "v1")]
#[derive(Debug, Default, Clone, Deserialize, Serialize, ToSchema)]
pub struct CustomerUpdateRequest {
/// The identifier for the Merchant Account
@ -302,14 +302,14 @@ pub struct CustomerUpdateRequest {
pub metadata: Option<pii::SecretSerdeValue>,
}
#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))]
#[cfg(feature = "v1")]
impl CustomerUpdateRequest {
pub fn get_address(&self) -> Option<payments::AddressDetails> {
self.address.clone()
}
}
#[cfg(all(feature = "v2", feature = "customer_v2"))]
#[cfg(feature = "v2")]
#[derive(Debug, Default, Clone, Deserialize, Serialize, ToSchema)]
#[serde(deny_unknown_fields)]
pub struct CustomerUpdateRequest {
@ -344,7 +344,7 @@ pub struct CustomerUpdateRequest {
pub default_payment_method_id: Option<id_type::GlobalPaymentMethodId>,
}
#[cfg(all(feature = "v2", feature = "customer_v2"))]
#[cfg(feature = "v2")]
impl CustomerUpdateRequest {
pub fn get_default_customer_billing_address(&self) -> Option<payments::AddressDetails> {
self.default_billing_address.clone()
@ -355,14 +355,14 @@ impl CustomerUpdateRequest {
}
}
#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))]
#[cfg(feature = "v1")]
#[derive(Debug, Serialize)]
pub struct CustomerUpdateRequestInternal {
pub customer_id: id_type::CustomerId,
pub request: CustomerUpdateRequest,
}
#[cfg(all(feature = "v2", feature = "customer_v2"))]
#[cfg(feature = "v2")]
#[derive(Debug, Serialize)]
pub struct CustomerUpdateRequestInternal {
pub id: id_type::GlobalCustomerId,