Skip to content

Commit

Permalink
chore: run formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
hyperswitch-bot[bot] committed Feb 3, 2025
1 parent c088d28 commit 9ddd2d7
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 54 deletions.
34 changes: 17 additions & 17 deletions crates/api_models/src/payments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::{
};
pub mod additional_info;
use cards::CardNumber;
use common_enums::{PaymentMethodType, ProductType,PaymentMethod};
use common_enums::{PaymentMethod, PaymentMethodType, ProductType};
#[cfg(feature = "v2")]
use common_utils::id_type::GlobalPaymentId;
use common_utils::{
Expand Down Expand Up @@ -6650,9 +6650,9 @@ pub struct FeatureMetadata {
#[schema(value_type = Option<Vec<String>>)]
pub search_tags: Option<Vec<HashedString<WithType>>>,
/// Recurring payment details required for apple pay Merchant Token
pub apple_pay_recurring_details: Option<ApplePayRecurringDetails>,
pub apple_pay_recurring_details: Option<ApplePayRecurringDetails>,
/// revenue recovery data for payment intent
#[cfg(feature= "v2" )]
#[cfg(feature = "v2")]
pub revenue_recovery_metadata: Option<RevenueRecoveryMetadata>,
}

Expand Down Expand Up @@ -7510,30 +7510,30 @@ mod billing_from_payment_method_data {
}
}

#[cfg(feature="v2")]
#[cfg(feature = "v2")]
#[derive(Debug, Clone, Eq, PartialEq, Serialize, Deserialize, ToSchema)]
pub struct RevenueRecoveryMetadata {
///Total number of billing connector + recovery retries for a payment intent.
#[schema(value_type = i32,example = "1")]
pub retry_count : i32,
pub retry_count: i32,
//if the payment_connector has been called or not
pub payment_connector_transmission : bool,
pub payment_connector_transmission: bool,
// Billing Connector Id to update the invoices
pub billing_connector_id : id_type::MerchantConnectorAccountId,
pub billing_connector_id: id_type::MerchantConnectorAccountId,
// Payment Connector Id to retry the payments
pub active_attempt_payment_connector_id : id_type::MerchantConnectorAccountId,
pub active_attempt_payment_connector_id: id_type::MerchantConnectorAccountId,
// Billing Connector Mit Token Details
pub billing_connector_mit_token_details : BillingConnectorMitTokenDetails,
pub billing_connector_mit_token_details: BillingConnectorMitTokenDetails,
//Payment Method Type
pub payment_method_type : PaymentMethod,
pub payment_method_type: PaymentMethod,
//PaymentMethod Subtype
pub payment_method_subtype : PaymentMethodType
pub payment_method_subtype: PaymentMethodType,
}
#[derive(Debug, Clone, Eq, PartialEq,Serialize, Deserialize, ToSchema)]
#[cfg(feature="v2")]
pub struct BillingConnectorMitTokenDetails{
#[derive(Debug, Clone, Eq, PartialEq, Serialize, Deserialize, ToSchema)]
#[cfg(feature = "v2")]
pub struct BillingConnectorMitTokenDetails {
//Payment Processor Token To process the retry payment
pub payment_processor_token : String,
pub payment_processor_token: String,
//Connector Customer Id to process the retry payment
pub connector_customer_id : String,
}
pub connector_customer_id: String,
}
33 changes: 15 additions & 18 deletions crates/diesel_models/src/types.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
use common_enums::{PaymentMethod, PaymentMethodType};
use common_utils::{hashing::HashedString, pii, types::MinorUnit};
use diesel::{
sql_types::{Json, Jsonb},
AsExpression, FromSqlRow,
};
use masking::{Secret, WithType};
use serde::{Deserialize, Serialize};
use common_enums::{
PaymentMethod,
PaymentMethodType
};
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, FromSqlRow, AsExpression)]
#[diesel(sql_type = Jsonb)]
pub struct OrderDetailsWithAmount {
Expand Down Expand Up @@ -113,37 +110,37 @@ pub struct RedirectResponse {
impl masking::SerializableSecret for RedirectResponse {}
common_utils::impl_to_sql_from_sql_json!(RedirectResponse);

#[cfg(feature="v2")]
#[cfg(feature = "v2")]
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, FromSqlRow, AsExpression)]
#[diesel(sql_type = Json)]
pub struct RevenueRecoveryMetadata {
///Total number of billing connector + recovery retries for a payment intent.
pub retry_count : i32,
pub retry_count: i32,
//if the payment_connector has been called or not
pub payment_connector_transmission : bool,
pub payment_connector_transmission: bool,
// Billing Connector Id to update the invoices
pub billing_connector_id : common_utils::id_type::MerchantConnectorAccountId,
pub billing_connector_id: common_utils::id_type::MerchantConnectorAccountId,
// Payment Connector Id to retry the payments
pub active_attempt_payment_connector_id : common_utils::id_type::MerchantConnectorAccountId,
pub active_attempt_payment_connector_id: common_utils::id_type::MerchantConnectorAccountId,
// Billing Connector Mit Token Details
pub billing_connector_mit_token_details : BillingConnectorMitTokenDetails,
pub billing_connector_mit_token_details: BillingConnectorMitTokenDetails,
//Payment Method Type
pub payment_method_type : PaymentMethod,
pub payment_method_type: PaymentMethod,
//PaymentMethod Subtype
pub payment_method_subtype : PaymentMethodType
pub payment_method_subtype: PaymentMethodType,
}

#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, FromSqlRow, AsExpression)]
#[diesel(sql_type = Json)]
#[cfg(feature="v2")]
pub struct BillingConnectorMitTokenDetails{
#[cfg(feature = "v2")]
pub struct BillingConnectorMitTokenDetails {
//Payment Processor Token To process the retry payment
pub payment_processor_token : String,
pub payment_processor_token: String,
//Connector Customer Id to process the retry payment
pub connector_customer_id : String,
pub connector_customer_id: String,
}

#[cfg(feature="v2")]
#[cfg(feature = "v2")]
common_utils::impl_to_sql_from_sql_json!(RevenueRecoveryMetadata);
#[cfg(feature="v2")]
#[cfg(feature = "v2")]
common_utils::impl_to_sql_from_sql_json!(BillingConnectorMitTokenDetails);
38 changes: 19 additions & 19 deletions crates/hyperswitch_domain_models/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,26 +39,18 @@ use api_models::payments::{
FeatureMetadata as ApiFeatureMetadata, OrderDetailsWithAmount as ApiOrderDetailsWithAmount,
RecurringPaymentIntervalUnit as ApiRecurringPaymentIntervalUnit,
RedirectResponse as ApiRedirectResponse,

};

#[cfg(feature = "v2")]
use api_models::payments::{
RevenueRecoveryMetadata as ApiRevenueRecoveryMetadata,
BillingConnectorMitTokenDetails as ApiBillingConnectorMitTokenDetails,
RevenueRecoveryMetadata as ApiRevenueRecoveryMetadata,
};

use diesel_models::types::{
ApplePayRecurringDetails, ApplePayRegularBillingDetails, FeatureMetadata,
OrderDetailsWithAmount, RecurringPaymentIntervalUnit, RedirectResponse,
};

#[cfg(feature = "v2")]
use diesel_models::types::{
BillingConnectorMitTokenDetails,
RevenueRecoveryMetadata,
};

use diesel_models::types::{BillingConnectorMitTokenDetails, RevenueRecoveryMetadata};

#[derive(Clone, Debug, Eq, PartialEq, serde::Serialize)]
pub enum RemoteStorageObject<T: ForeignIDRef> {
Expand Down Expand Up @@ -103,15 +95,17 @@ impl ApiModelToDieselModelConvertor<ApiFeatureMetadata> for FeatureMetadata {
#[cfg(feature = "v2")]
revenue_recovery_metadata,
} = from;

Self {
redirect_response: redirect_response.map(RedirectResponse::convert_from),
search_tags,
apple_pay_recurring_details: apple_pay_recurring_details.map(ApplePayRecurringDetails::convert_from),

apple_pay_recurring_details: apple_pay_recurring_details
.map(ApplePayRecurringDetails::convert_from),

#[cfg(feature = "v2")]
revenue_recovery_metadata: revenue_recovery_metadata.map(RevenueRecoveryMetadata::convert_from),
}
revenue_recovery_metadata: revenue_recovery_metadata
.map(RevenueRecoveryMetadata::convert_from),
}
}

fn convert_back(self) -> ApiFeatureMetadata {
Expand Down Expand Up @@ -238,7 +232,9 @@ impl ApiModelToDieselModelConvertor<ApiRevenueRecoveryMetadata> for RevenueRecov
payment_connector_transmission: from.payment_connector_transmission,
billing_connector_id: from.billing_connector_id,
active_attempt_payment_connector_id: from.active_attempt_payment_connector_id,
billing_connector_mit_token_details: BillingConnectorMitTokenDetails::convert_from(from.billing_connector_mit_token_details),
billing_connector_mit_token_details: BillingConnectorMitTokenDetails::convert_from(
from.billing_connector_mit_token_details,
),
payment_method_type: from.payment_method_type,
payment_method_subtype: from.payment_method_subtype,
}
Expand All @@ -250,15 +246,19 @@ impl ApiModelToDieselModelConvertor<ApiRevenueRecoveryMetadata> for RevenueRecov
payment_connector_transmission: self.payment_connector_transmission,
billing_connector_id: self.billing_connector_id,
active_attempt_payment_connector_id: self.active_attempt_payment_connector_id,
billing_connector_mit_token_details: self.billing_connector_mit_token_details.convert_back(),
billing_connector_mit_token_details: self
.billing_connector_mit_token_details
.convert_back(),
payment_method_type: self.payment_method_type,
payment_method_subtype: self.payment_method_subtype,
}
}
}
}

#[cfg(feature = "v2")]
impl ApiModelToDieselModelConvertor<ApiBillingConnectorMitTokenDetails> for BillingConnectorMitTokenDetails {
impl ApiModelToDieselModelConvertor<ApiBillingConnectorMitTokenDetails>
for BillingConnectorMitTokenDetails
{
fn convert_from(from: ApiBillingConnectorMitTokenDetails) -> Self {
Self {
payment_processor_token: from.payment_processor_token,
Expand Down

0 comments on commit 9ddd2d7

Please sign in to comment.