mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-03 21:37:41 +08:00
chore: resolve v2 warnings in api_models (#7353)
Co-authored-by: Aishwariyaa Anand <aishwariyaa.anand@Aishwariyaa-Anand-C3PGW02T6Y.local> Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
0250f16958
commit
8bca14e960
@ -14,7 +14,6 @@ use common_utils::{crypto::OptionalEncryptableName, ext_traits::ValueExt};
|
|||||||
use masking::ExposeInterface;
|
use masking::ExposeInterface;
|
||||||
use masking::{PeekInterface, Secret};
|
use masking::{PeekInterface, Secret};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use url;
|
|
||||||
use utoipa::ToSchema;
|
use utoipa::ToSchema;
|
||||||
|
|
||||||
use super::payments::AddressDetails;
|
use super::payments::AddressDetails;
|
||||||
|
|||||||
@ -5,34 +5,28 @@ use super::{
|
|||||||
PaymentStartRedirectionRequest, PaymentsCreateIntentRequest, PaymentsGetIntentRequest,
|
PaymentStartRedirectionRequest, PaymentsCreateIntentRequest, PaymentsGetIntentRequest,
|
||||||
PaymentsIntentResponse, PaymentsRequest,
|
PaymentsIntentResponse, PaymentsRequest,
|
||||||
};
|
};
|
||||||
#[cfg(all(
|
|
||||||
any(feature = "v2", feature = "v1"),
|
|
||||||
not(feature = "payment_methods_v2")
|
|
||||||
))]
|
|
||||||
use crate::payment_methods::CustomerPaymentMethodsListResponse;
|
|
||||||
#[cfg(feature = "v1")]
|
#[cfg(feature = "v1")]
|
||||||
use crate::payments::{PaymentListFilterConstraints, PaymentListResponseV2};
|
use crate::payments::{
|
||||||
#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
|
ExtendedCardInfoResponse, PaymentIdType, PaymentListFilterConstraints, PaymentListResponseV2,
|
||||||
use crate::{events, payment_methods::CustomerPaymentMethodsListResponse};
|
PaymentsApproveRequest, PaymentsCancelRequest, PaymentsCaptureRequest,
|
||||||
|
PaymentsCompleteAuthorizeRequest, PaymentsDynamicTaxCalculationRequest,
|
||||||
|
PaymentsDynamicTaxCalculationResponse, PaymentsExternalAuthenticationRequest,
|
||||||
|
PaymentsExternalAuthenticationResponse, PaymentsIncrementalAuthorizationRequest,
|
||||||
|
PaymentsManualUpdateRequest, PaymentsManualUpdateResponse, PaymentsPostSessionTokensRequest,
|
||||||
|
PaymentsPostSessionTokensResponse, PaymentsRejectRequest, PaymentsRetrieveRequest,
|
||||||
|
PaymentsStartRequest, PaymentsUpdateMetadataRequest, PaymentsUpdateMetadataResponse,
|
||||||
|
};
|
||||||
use crate::{
|
use crate::{
|
||||||
payment_methods::{
|
payment_methods::{
|
||||||
self, ListCountriesCurrenciesRequest, ListCountriesCurrenciesResponse,
|
self, ListCountriesCurrenciesRequest, ListCountriesCurrenciesResponse,
|
||||||
PaymentMethodCollectLinkRenderRequest, PaymentMethodCollectLinkRequest,
|
PaymentMethodCollectLinkRenderRequest, PaymentMethodCollectLinkRequest,
|
||||||
PaymentMethodCollectLinkResponse, PaymentMethodDeleteResponse, PaymentMethodListRequest,
|
PaymentMethodCollectLinkResponse, PaymentMethodListRequest, PaymentMethodListResponse,
|
||||||
PaymentMethodListResponse, PaymentMethodMigrateResponse, PaymentMethodResponse,
|
PaymentMethodMigrateResponse, PaymentMethodResponse, PaymentMethodUpdate,
|
||||||
PaymentMethodUpdate,
|
|
||||||
},
|
},
|
||||||
payments::{
|
payments::{
|
||||||
self, ExtendedCardInfoResponse, PaymentIdType, PaymentListConstraints, PaymentListFilters,
|
self, PaymentListConstraints, PaymentListFilters, PaymentListFiltersV2,
|
||||||
PaymentListFiltersV2, PaymentListResponse, PaymentsAggregateResponse,
|
PaymentListResponse, PaymentsAggregateResponse, PaymentsSessionResponse,
|
||||||
PaymentsApproveRequest, PaymentsCancelRequest, PaymentsCaptureRequest,
|
RedirectionResponse,
|
||||||
PaymentsCompleteAuthorizeRequest, PaymentsDynamicTaxCalculationRequest,
|
|
||||||
PaymentsDynamicTaxCalculationResponse, PaymentsExternalAuthenticationRequest,
|
|
||||||
PaymentsExternalAuthenticationResponse, PaymentsIncrementalAuthorizationRequest,
|
|
||||||
PaymentsManualUpdateRequest, PaymentsManualUpdateResponse,
|
|
||||||
PaymentsPostSessionTokensRequest, PaymentsPostSessionTokensResponse, PaymentsRejectRequest,
|
|
||||||
PaymentsRetrieveRequest, PaymentsSessionResponse, PaymentsStartRequest,
|
|
||||||
PaymentsUpdateMetadataRequest, PaymentsUpdateMetadataResponse, RedirectionResponse,
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -272,7 +266,7 @@ impl ApiEventMetric for payment_methods::DefaultPaymentMethod {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "v2")]
|
#[cfg(feature = "v2")]
|
||||||
impl ApiEventMetric for PaymentMethodDeleteResponse {
|
impl ApiEventMetric for payment_methods::PaymentMethodDeleteResponse {
|
||||||
fn get_api_event_type(&self) -> Option<ApiEventsType> {
|
fn get_api_event_type(&self) -> Option<ApiEventsType> {
|
||||||
Some(ApiEventsType::PaymentMethod {
|
Some(ApiEventsType::PaymentMethod {
|
||||||
payment_method_id: self.id.clone(),
|
payment_method_id: self.id.clone(),
|
||||||
@ -283,7 +277,7 @@ impl ApiEventMetric for PaymentMethodDeleteResponse {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "v1")]
|
#[cfg(feature = "v1")]
|
||||||
impl ApiEventMetric for PaymentMethodDeleteResponse {
|
impl ApiEventMetric for payment_methods::PaymentMethodDeleteResponse {
|
||||||
fn get_api_event_type(&self) -> Option<ApiEventsType> {
|
fn get_api_event_type(&self) -> Option<ApiEventsType> {
|
||||||
Some(ApiEventsType::PaymentMethod {
|
Some(ApiEventsType::PaymentMethod {
|
||||||
payment_method_id: self.payment_method_id.clone(),
|
payment_method_id: self.payment_method_id.clone(),
|
||||||
@ -293,7 +287,7 @@ impl ApiEventMetric for PaymentMethodDeleteResponse {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ApiEventMetric for CustomerPaymentMethodsListResponse {}
|
impl ApiEventMetric for payment_methods::CustomerPaymentMethodsListResponse {}
|
||||||
|
|
||||||
impl ApiEventMetric for PaymentMethodListRequest {
|
impl ApiEventMetric for PaymentMethodListRequest {
|
||||||
fn get_api_event_type(&self) -> Option<ApiEventsType> {
|
fn get_api_event_type(&self) -> Option<ApiEventsType> {
|
||||||
|
|||||||
@ -1,13 +1,12 @@
|
|||||||
use common_utils::events::{ApiEventMetric, ApiEventsType};
|
use common_utils::events::{ApiEventMetric, ApiEventsType};
|
||||||
|
|
||||||
#[cfg(feature = "v1")]
|
|
||||||
use crate::refunds::RefundRequest;
|
|
||||||
#[cfg(feature = "v2")]
|
|
||||||
use crate::refunds::RefundsCreateRequest;
|
|
||||||
use crate::refunds::{
|
use crate::refunds::{
|
||||||
RefundAggregateResponse, RefundListFilters, RefundListMetaData, RefundListRequest,
|
self, RefundAggregateResponse, RefundListFilters, RefundListMetaData, RefundListRequest,
|
||||||
RefundListResponse, RefundManualUpdateRequest, RefundResponse, RefundUpdateRequest,
|
RefundListResponse,
|
||||||
RefundsRetrieveRequest,
|
};
|
||||||
|
#[cfg(feature = "v1")]
|
||||||
|
use crate::refunds::{
|
||||||
|
RefundManualUpdateRequest, RefundRequest, RefundUpdateRequest, RefundsRetrieveRequest,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[cfg(feature = "v1")]
|
#[cfg(feature = "v1")]
|
||||||
@ -24,14 +23,14 @@ impl ApiEventMetric for RefundRequest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "v2")]
|
#[cfg(feature = "v2")]
|
||||||
impl ApiEventMetric for RefundsCreateRequest {
|
impl ApiEventMetric for refunds::RefundsCreateRequest {
|
||||||
fn get_api_event_type(&self) -> Option<ApiEventsType> {
|
fn get_api_event_type(&self) -> Option<ApiEventsType> {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "v1")]
|
#[cfg(feature = "v1")]
|
||||||
impl ApiEventMetric for RefundResponse {
|
impl ApiEventMetric for refunds::RefundResponse {
|
||||||
fn get_api_event_type(&self) -> Option<ApiEventsType> {
|
fn get_api_event_type(&self) -> Option<ApiEventsType> {
|
||||||
Some(ApiEventsType::Refund {
|
Some(ApiEventsType::Refund {
|
||||||
payment_id: Some(self.payment_id.clone()),
|
payment_id: Some(self.payment_id.clone()),
|
||||||
@ -41,7 +40,7 @@ impl ApiEventMetric for RefundResponse {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "v2")]
|
#[cfg(feature = "v2")]
|
||||||
impl ApiEventMetric for RefundResponse {
|
impl ApiEventMetric for refunds::RefundResponse {
|
||||||
fn get_api_event_type(&self) -> Option<ApiEventsType> {
|
fn get_api_event_type(&self) -> Option<ApiEventsType> {
|
||||||
Some(ApiEventsType::Refund {
|
Some(ApiEventsType::Refund {
|
||||||
payment_id: self.payment_id.clone(),
|
payment_id: self.payment_id.clone(),
|
||||||
|
|||||||
@ -3,18 +3,16 @@ use std::collections::{HashMap, HashSet};
|
|||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
||||||
use cards::CardNumber;
|
use cards::CardNumber;
|
||||||
|
#[cfg(feature = "v1")]
|
||||||
|
use common_utils::crypto::OptionalEncryptableName;
|
||||||
use common_utils::{
|
use common_utils::{
|
||||||
consts::SURCHARGE_PERCENTAGE_PRECISION_LENGTH,
|
consts::SURCHARGE_PERCENTAGE_PRECISION_LENGTH,
|
||||||
crypto::OptionalEncryptableName,
|
|
||||||
errors,
|
errors,
|
||||||
ext_traits::OptionExt,
|
ext_traits::OptionExt,
|
||||||
id_type, link_utils, pii,
|
id_type, link_utils, pii,
|
||||||
types::{MinorUnit, Percentage, Surcharge},
|
types::{MinorUnit, Percentage, Surcharge},
|
||||||
};
|
};
|
||||||
#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))]
|
|
||||||
use masking::PeekInterface;
|
use masking::PeekInterface;
|
||||||
#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
|
|
||||||
use masking::{ExposeInterface, PeekInterface};
|
|
||||||
use serde::de;
|
use serde::de;
|
||||||
use utoipa::{schema, ToSchema};
|
use utoipa::{schema, ToSchema};
|
||||||
|
|
||||||
@ -2430,6 +2428,10 @@ pub enum MigrationStatus {
|
|||||||
Failed,
|
Failed,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(all(
|
||||||
|
any(feature = "v2", feature = "v1"),
|
||||||
|
not(feature = "payment_methods_v2")
|
||||||
|
))]
|
||||||
type PaymentMethodMigrationResponseType = (
|
type PaymentMethodMigrationResponseType = (
|
||||||
Result<PaymentMethodMigrateResponse, String>,
|
Result<PaymentMethodMigrateResponse, String>,
|
||||||
PaymentMethodRecord,
|
PaymentMethodRecord,
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
|
#[cfg(feature = "v1")]
|
||||||
|
use std::fmt;
|
||||||
use std::{
|
use std::{
|
||||||
collections::{HashMap, HashSet},
|
collections::{HashMap, HashSet},
|
||||||
fmt,
|
|
||||||
num::NonZeroI64,
|
num::NonZeroI64,
|
||||||
};
|
};
|
||||||
pub mod additional_info;
|
pub mod additional_info;
|
||||||
@ -9,6 +10,7 @@ use cards::CardNumber;
|
|||||||
#[cfg(feature = "v2")]
|
#[cfg(feature = "v2")]
|
||||||
use common_enums::enums::PaymentConnectorTransmission;
|
use common_enums::enums::PaymentConnectorTransmission;
|
||||||
use common_enums::ProductType;
|
use common_enums::ProductType;
|
||||||
|
#[cfg(feature = "v1")]
|
||||||
use common_types::primitive_wrappers::{
|
use common_types::primitive_wrappers::{
|
||||||
ExtendedAuthorizationAppliedBool, RequestExtendedAuthorizationBool,
|
ExtendedAuthorizationAppliedBool, RequestExtendedAuthorizationBool,
|
||||||
};
|
};
|
||||||
@ -26,24 +28,25 @@ use common_utils::{
|
|||||||
use error_stack::ResultExt;
|
use error_stack::ResultExt;
|
||||||
use masking::{PeekInterface, Secret, WithType};
|
use masking::{PeekInterface, Secret, WithType};
|
||||||
use router_derive::Setter;
|
use router_derive::Setter;
|
||||||
use serde::{de, ser::Serializer, Deserialize, Deserializer, Serialize};
|
#[cfg(feature = "v1")]
|
||||||
|
use serde::{de, Deserializer};
|
||||||
|
use serde::{ser::Serializer, Deserialize, Serialize};
|
||||||
use strum::Display;
|
use strum::Display;
|
||||||
use time::{Date, PrimitiveDateTime};
|
use time::{Date, PrimitiveDateTime};
|
||||||
use url::Url;
|
use url::Url;
|
||||||
use utoipa::ToSchema;
|
use utoipa::ToSchema;
|
||||||
|
|
||||||
#[cfg(feature = "v1")]
|
|
||||||
use crate::ephemeral_key::EphemeralKeyCreateResponse;
|
|
||||||
#[cfg(feature = "v2")]
|
#[cfg(feature = "v2")]
|
||||||
use crate::mandates::ProcessorPaymentToken;
|
use crate::mandates;
|
||||||
#[cfg(feature = "v2")]
|
#[cfg(feature = "v2")]
|
||||||
use crate::payment_methods;
|
use crate::payment_methods;
|
||||||
use crate::{
|
use crate::{
|
||||||
admin::{self, MerchantConnectorInfo},
|
admin::{self, MerchantConnectorInfo},
|
||||||
disputes, enums as api_enums,
|
enums as api_enums,
|
||||||
mandates::RecurringDetails,
|
mandates::RecurringDetails,
|
||||||
refunds, ValidateFieldAndGet,
|
|
||||||
};
|
};
|
||||||
|
#[cfg(feature = "v1")]
|
||||||
|
use crate::{disputes, ephemeral_key::EphemeralKeyCreateResponse, refunds, ValidateFieldAndGet};
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
||||||
pub enum PaymentOp {
|
pub enum PaymentOp {
|
||||||
@ -5313,7 +5316,7 @@ pub struct ProxyPaymentsRequest {
|
|||||||
|
|
||||||
pub amount: AmountDetails,
|
pub amount: AmountDetails,
|
||||||
|
|
||||||
pub recurring_details: ProcessorPaymentToken,
|
pub recurring_details: mandates::ProcessorPaymentToken,
|
||||||
|
|
||||||
pub shipping: Option<Address>,
|
pub shipping: Option<Address>,
|
||||||
|
|
||||||
@ -7801,6 +7804,7 @@ mod payment_id_type {
|
|||||||
deserializer.deserialize_any(PaymentIdVisitor)
|
deserializer.deserialize_any(PaymentIdVisitor)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(dead_code)]
|
||||||
pub(crate) fn deserialize_option<'a, D>(
|
pub(crate) fn deserialize_option<'a, D>(
|
||||||
deserializer: D,
|
deserializer: D,
|
||||||
) -> Result<Option<PaymentIdType>, D::Error>
|
) -> Result<Option<PaymentIdType>, D::Error>
|
||||||
@ -8604,8 +8608,8 @@ impl PaymentRevenueRecoveryMetadata {
|
|||||||
) {
|
) {
|
||||||
self.payment_connector_transmission = Some(payment_connector_transmission);
|
self.payment_connector_transmission = Some(payment_connector_transmission);
|
||||||
}
|
}
|
||||||
pub fn get_payment_token_for_api_request(&self) -> ProcessorPaymentToken {
|
pub fn get_payment_token_for_api_request(&self) -> mandates::ProcessorPaymentToken {
|
||||||
ProcessorPaymentToken {
|
mandates::ProcessorPaymentToken {
|
||||||
processor_payment_token: self
|
processor_payment_token: self
|
||||||
.billing_connector_payment_details
|
.billing_connector_payment_details
|
||||||
.payment_processor_token
|
.payment_processor_token
|
||||||
|
|||||||
Reference in New Issue
Block a user