text
stringlengths
70
351k
source
stringclasses
4 values
<|fim_prefix|> // file: hyperswitch/crates/common_utils/src/id_type/merchant.rs | crate: common_utils /// get_merchant_fingerprint_secret_key pub fn get_merchant_fingerprint_secret_key(&self) -> String { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
// file: hyperswitch/crates/common_utils/src/id_type/merchant.rs | crate: common_utils /// get_blocklist_enabled_key pub fn get_blocklist_guard_key(&self) -> String { format!("guard_blocklist_for_{}", self.get_string_repr()) }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/common_utils/src/id_type/merchant.rs | crate: common_utils /// get_pm_filters_cgraph_key pub fn get_pm_filters_cgraph_key(&self) -> String { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/common_utils/src/id_type/merchant.rs | crate: common_utils /// get_requires_cvv_key pub fn get_requires_cvv_key(&self) -> String { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/common_utils/src/id_type/merchant.rs | crate: common_utils /// get_max_auto_retries_enabled key pub fn get_max_auto_retries_enabled(&self) -> String { <|fim_suffix|> <|fim_middle|> }
ast_fragments
// file: hyperswitch/crates/common_utils/src/id_type/merchant.rs | crate: common_utils /// get step up enabled key pub fn get_step_up_enabled_key(&self) -> String { format!("step_up_enabled_{}", self.get_string_repr()) }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/common_utils/src/id_type/merchant.rs | crate: common_utils fn from(value: MerchantId) -> Self { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/common_utils/src/id_type/merchant.rs | crate: common_utils use std::fmt::Display; use crate::{ date_time, errors::{CustomResult, ValidationError}, generate_id_with_default_len, id_type::{AlphaNumericId, LengthId}, new_type::MerchantName, types::keymanager, }; /// Get a merchant id from String pub fn wrap(merchant_id: String) -> CustomResult<Self, ValidationError> { <|fim_suffix|> <|fim_middle|> }
ast_fragments
// file: hyperswitch/crates/common_utils/src/id_type/merchant.rs | crate: common_utils use crate::{ date_time, errors::{CustomResult, ValidationError}, generate_id_with_default_len, id_type::{AlphaNumericId, LengthId}, new_type::MerchantName, types::keymanager, }; /// Get a merchant id with a value of `irrelevant_merchant_id` pub fn get_irrelevant_merchant_id() -> Self { let alphanumeric_id = AlphaNumericId::new_unchecked("irrelevant_merchant_id".to_string()); let length_id = LengthId::new_unchecked(alphanumeric_id); Self(length_id) }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/common_utils/src/id_type/merchant.rs | crate: common_utils use crate::{ date_time, errors::{CustomResult, ValidationError}, generate_id_with_default_len, id_type::{AlphaNumericId, LengthId}, new_type::MerchantName, types::keymanager, }; /// Create a new merchant_id from unix timestamp, of the format `merchant_{ <|fim_suffix|> <|fim_middle|> }
ast_fragments
// file: hyperswitch/crates/common_utils/src/id_type/merchant.rs | crate: common_utils use crate::{ date_time, errors::{CustomResult, ValidationError}, generate_id_with_default_len, id_type::{AlphaNumericId, LengthId}, new_type::MerchantName, types::keymanager, }; /// Get a merchant id for internal use only pub fn get_internal_user_merchant_id(merchant_id: &str) -> Self { let alphanumeric_id = AlphaNumericId::new_unchecked(merchant_id.to_string()); let length_id = LengthId::new_unchecked(alphanumeric_id); Self(length_id) }
ast_fragments
// file: hyperswitch/crates/common_utils/src/id_type/merchant.rs | crate: common_utils use crate::{ date_time, errors::{CustomResult, ValidationError}, generate_id_with_default_len, id_type::{AlphaNumericId, LengthId}, new_type::MerchantName, types::keymanager, }; /// Get a merchant id with the const value of `MERCHANT_ID_NOT_FOUND` pub fn get_merchant_id_not_found() -> Self { let alphanumeric_id = AlphaNumericId::new_unchecked("MERCHANT_ID_NOT_FOUND".to_string()); let length_id = LengthId::new_unchecked(alphanumeric_id); Self(length_id) }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/common_utils/src/id_type/merchant.rs | crate: common_utils use crate::{ date_time, errors::{CustomResult, ValidationError}, generate_id_with_default_len, id_type::{AlphaNumericId, LengthId}, new_type::MerchantName, types::keymanager, }; /// Create a Merchant id from MerchantName pub fn from_merchant_name(merchant_name: MerchantName) -> Self { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/common_utils/src/id_type/merchant.rs | crate: common_utils fn from(val: MerchantId) -> Self { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/common_utils/src/id_type/global_id/payment.rs | crate: common_utils use crate::{errors, generate_id_with_default_len, generate_time_ordered_id_without_prefix, types}; /// Generate a new GlobalPaymentId from a cell id pub fn generate(cell_id: &crate::id_type::CellId) -> Self { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/common_utils/src/id_type/global_id/payment.rs | crate: common_utils use common_enums::enums; /// Generate the id for Revenue Recovery Psync PT workflow pub fn get_psync_revenue_recovery_id( &self, task: &str, runner: enums::ProcessTrackerRunner, ) -> String { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/common_utils/src/id_type/global_id/payment.rs | crate: common_utils /// Generate a new GlobalAttemptId from a cell id pub fn generate(cell_id: &super::CellId) -> Self { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/common_utils/src/id_type/global_id/payment.rs | crate: common_utils use common_enums::enums; /// Generate the id for revenue recovery Execute PT workflow pub fn get_execute_revenue_recovery_id( &self, task: &str, runner: enums::ProcessTrackerRunner, ) -> String { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/common_utils/src/id_type/global_id/payment.rs | crate: common_utils use crate::{errors, generate_id_with_default_len, generate_time_ordered_id_without_prefix, types}; /// Generate a new ClientId from self pub fn generate_client_secret(&self) -> types::ClientSecret { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
// file: hyperswitch/crates/common_utils/src/id_type/global_id/payment.rs | crate: common_utils use crate::{errors, generate_id_with_default_len, generate_time_ordered_id_without_prefix, types}; /// Generate a new GlobalPaymentId from a cell id pub fn generate(cell_id: &crate::id_type::CellId) -> Self { let global_id = super::GlobalId::generate(cell_id, super::GlobalEntity::Payment); Self(global_id) }
ast_fragments
// file: hyperswitch/crates/common_utils/src/id_type/global_id/payment.rs | crate: common_utils /// Get string representation of the id pub fn get_string_repr(&self) -> &str { self.0.get_string_repr() }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/common_utils/src/id_type/global_id/customer.rs | crate: common_utils fn try_from(value: GlobalCustomerId) -> Result<Self, Self::Error> { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
// file: hyperswitch/crates/common_utils/src/id_type/global_id/customer.rs | crate: common_utils fn try_from(value: GlobalCustomerId) -> Result<Self, Self::Error> { Self::try_from(std::borrow::Cow::from(value.get_string_repr().to_owned())) }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/common_utils/src/id_type/global_id/customer.rs | crate: common_utils use crate::{errors, generate_id_with_default_len, generate_time_ordered_id_without_prefix, types}; /// Generate a new GlobalCustomerId from a cell id pub fn generate(cell_id: &crate::id_type::CellId) -> Self { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/hyperswitch_domain_models/src/router_request_types.rs | crate: hyperswitch_domain_models use crate::{ address, errors::api_error_response::ApiErrorResponse, mandates, payments, router_data::{self, RouterData}, router_flow_types as flows, router_response_types as response_types, }; fn try_from(connector_auth: router_data::ConnectorAuthType) -> Result<Self, Self::Error> { { router_data::ConnectorAuthType::HeaderKey { api_key } => Ok(Self { app_id: api_key, id: None, }),<|fim_suffix|> <|fim_middle|> _ => Err(ApiErrorResponse::InvalidDataValue { field_name: "connector_account_details", }), } }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/hyperswitch_domain_models/src/router_request_types.rs | crate: hyperswitch_domain_models use super::payment_method_data::PaymentMethodData; use crate::{ address, errors::api_error_response::ApiErrorResponse, mandates, payments, router_data::{self, RouterData}, router_flow_types as flows, router_response_types as response_types, }; fn try_from( data: RouterData<F, PaymentsAuthorizeData, response_types::PaymentsResponseData>, ) -> Result<Self, Self::Error> { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/hyperswitch_domain_models/src/router_request_types.rs | crate: hyperswitch_domain_models use crate::{ address, errors::api_error_response::ApiErrorResponse, mandates, payments, router_data::{self, RouterData}, router_flow_types as flows, router_response_types as response_types, }; fn try_from(connector_auth: router_data::ConnectorAuthType) -> Result<Self, Self::Error> { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
// file: hyperswitch/crates/hyperswitch_domain_models/src/router_request_types.rs | crate: hyperswitch_domain_models use api_models::payments::{AdditionalPaymentData, RequestSurchargeDetails}; use crate::{ address, errors::api_error_response::ApiErrorResponse, mandates, payments, router_data::{self, RouterData}, router_flow_types as flows, router_response_types as response_types, }; fn from( (request_surcharge_details, payment_attempt): ( &RequestSurchargeDetails, &payments::payment_attempt::PaymentAttempt, ), ) -> Self { todo!() }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/hyperswitch_domain_models/src/router_request_types.rs | crate: hyperswitch_domain_models use api_models::payments::{AdditionalPaymentData, RequestSurchargeDetails}; use common_utils::{consts, errors, ext_traits::OptionExt, id_type, pii, types::MinorUnit}; use diesel_models::{enums as storage_enums, types::OrderDetailsWithAmount}; use crate::{ address, errors::api_error_response::ApiErrorResponse, mandates, payments, router_data::{self, RouterData}, router_flow_types as flows, router_response_types as response_types, }; fn from( (request_surcharge_details, payment_attempt): ( &RequestSurchargeDetails, &payments::payment_attempt::PaymentAttempt, ), ) -> Self { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/hyperswitch_domain_models/src/router_request_types.rs | crate: hyperswitch_domain_models use common_utils::{consts, errors, ext_traits::OptionExt, id_type, pii, types::MinorUnit}; use crate::{ address, errors::api_error_response::ApiErrorResponse, mandates, payments, router_data::{self, RouterData}, router_flow_types as flows, router_response_types as response_types, }; pub fn get_total_surcharge_amount(&self) -> MinorUnit { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/hyperswitch_domain_models/src/router_request_types.rs | crate: hyperswitch_domain_models use common_utils::{consts, errors, ext_traits::OptionExt, id_type, pii, types::MinorUnit}; use crate::{ address, errors::api_error_response::ApiErrorResponse, mandates, payments, router_data::{self, RouterData}, router_flow_types as flows, router_response_types as response_types, }; pub fn get_connector_transaction_id( &self, ) -> errors::CustomResult<String, errors::ValidationError> { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/hyperswitch_domain_models/src/router_request_types.rs | crate: hyperswitch_domain_models use common_utils::{consts, errors, ext_traits::OptionExt, id_type, pii, types::MinorUnit}; use diesel_models::{enums as storage_enums, types::OrderDetailsWithAmount}; fn from(value: common_utils::types::BrowserInformation) -> Self { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/hyperswitch_domain_models/src/router_request_types.rs | crate: hyperswitch_domain_models use super::payment_method_data::PaymentMethodData; use crate::{ address, errors::api_error_response::ApiErrorResponse, mandates, payments, router_data::{self, RouterData}, router_flow_types as flows, router_response_types as response_types, }; fn try_from( data: RouterData<F, PaymentsAuthorizeData, response_types::PaymentsResponseData>, ) -> Result<Self, Self::Error> { { Ok(response_types::PaymentsResponseData::TransactionResponse { resource_id: ResponseId::ConnectorTransactionId(id), .. }) => Some(id.clone()),<|fim_suffix|> <|fim_middle|> _ => None, } }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/hyperswitch_domain_models/src/router_request_types.rs | crate: hyperswitch_domain_models use masking::Secret; use super::payment_method_data::PaymentMethodData; fn try_from(data: CompleteAuthorizeData) -> Result<Self, Self::Error> { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
// file: hyperswitch/crates/hyperswitch_domain_models/src/router_request_types.rs | crate: hyperswitch_domain_models use masking::Secret; use super::payment_method_data::PaymentMethodData; fn try_from(data: PaymentsAuthorizeData) -> Result<Self, Self::Error> { Ok(Self { payment_method_data: Some(data.payment_method_data), amount: Some(data.amount), minor_amount: Some(data.minor_amount), email: data.email, currency: Some(data.currency), payment_method_type: data.payment_method_type, setup_mandate_details: data.setup_mandate_details, capture_method: data.capture_method, order_details: data.order_details, router_return_url: data.router_return_url, webhook_url: data.webhook_url, complete_authorize_url: data.complete_authorize_url, browser_info: data.browser_info, surcharge_details: data.surcharge_details, connector_transaction_id: None, mandate_id: data.mandate_id, related_transaction_id: data.related_transaction_id, redirect_response: None, enrolled_for_3ds: data.enrolled_for_3ds, split_payments: data.split_payments, metadata: data.metadata.map(Secret::new), }) }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/hyperswitch_domain_models/src/router_request_types.rs | crate: hyperswitch_domain_models use super::payment_method_data::PaymentMethodData; fn try_from(data: PaymentsAuthorizeData) -> Result<Self, Self::Error> { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/hyperswitch_domain_models/src/router_request_types.rs | crate: hyperswitch_domain_models use super::payment_method_data::PaymentMethodData; use crate::{ address, errors::api_error_response::ApiErrorResponse, mandates, payments, router_data::{self, RouterData}, router_flow_types as flows, router_response_types as response_types, }; fn from( data: &RouterData<F, PaymentsAuthorizeData, response_types::PaymentsResponseData>, ) -> Self { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/hyperswitch_domain_models/src/router_request_types.rs | crate: hyperswitch_domain_models use super::payment_method_data::PaymentMethodData; fn try_from(data: SetupMandateRequestData) -> Result<Self, Self::Error> { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/hyperswitch_domain_models/src/router_request_types.rs | crate: hyperswitch_domain_models use super::payment_method_data::PaymentMethodData; use crate::{ address, errors::api_error_response::ApiErrorResponse, mandates, payments, router_data::{self, RouterData}, router_flow_types as flows, router_response_types as response_types, }; fn try_from( data: &RouterData< flows::Authorize, PaymentsAuthorizeData, response_types::PaymentsResponseData, >, ) -> Result<Self, Self::Error> { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
// file: hyperswitch/crates/hyperswitch_domain_models/src/router_request_types.rs | crate: hyperswitch_domain_models use super::payment_method_data::PaymentMethodData; fn try_from(data: SetupMandateRequestData) -> Result<Self, Self::Error> { Ok(Self { email: data.email, payment_method_data: data.payment_method_data, description: None, phone: None, name: None, preprocessing_id: None, }) }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/hyperswitch_domain_models/src/payments.rs | crate: hyperswitch_domain_models use crate::{ address::Address, business_profile, customer, errors, merchant_account, merchant_connector_account, payment_address, payment_method_data, routing, ApiModelToDieselModelConvertor, }; use crate::{payment_method_data, RemoteStorageObject}; pub fn get_updated_vault_data( existing_vault_data: Option<&Self>, payment_method_data: &payment_method_data::PaymentMethodData, ) -> Option<Self> { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/hyperswitch_domain_models/src/payments.rs | crate: hyperswitch_domain_models use common_utils::{ self, crypto::Encryptable, encryption::Encryption, errors::CustomResult, ext_traits::ValueExt, id_type, pii, types::{keymanager::ToEncryptable, MinorUnit}, }; use diesel_models::payment_intent::TaxDetails; use payment_intent::PaymentIntentUpdate; use common_enums as storage_enums; use diesel_models::{ ephemeral_key, types::{FeatureMetadata, OrderDetailsWithAmount}, }; use self::payment_attempt::PaymentAttempt; use crate::{ address::Address, business_profile, customer, errors, merchant_account, merchant_connector_account, payment_address, payment_method_data, routing, ApiModelToDieselModelConvertor, }; pub fn get_updated_feature_metadata( &self, ) -> CustomResult<Option<FeatureMetadata>, errors::api_error_response::ApiErrorResponse> { { Some(connector) => Some(diesel_models::types::PaymentRevenueRecoveryMetadata { // Update retry count by one. total_retry_count: revenue_recovery .as_ref() .map_or(1, |data| (data.total_retry_count + 1)), // Since this is an external system call, marking this payment_connector_transmission to ConnectorCallSucceeded. payment_connector_transmission: common_enums::PaymentConnectorTransmission::ConnectorCallSucceeded, billing_connector_id: self.revenue_recovery_data.billing_connector_id.clone(), active_attempt_payment_connector_id: self .payment_attempt .get_attempt_merchant_connector_account_id()?, billing_connector_payment_details: diesel_models::types::BillingConnectorPaymentDetails { payment_processor_token: self .revenue_recovery_data .processor_payment_method_token .clone(), connector_customer_id: self .revenue_recovery_data .connector_customer_id .clone(), }, payment_method_type: self.payment_attempt.payment_method_type, payment_method_subtype: self.payment_attempt.payment_method_subtype, connector: connector.parse().map_err(|err| { router_env::logger::error!(?err, "Failed to parse connector string to enum"); errors::api_error_response::ApiErrorResponse::InternalServerError })?, }),<|fim_suffix|> <|fim_middle|> None => Err(errors::api_error_response::ApiErrorResponse::InternalServerError) .attach_printable("Connector not found in payment attempt")?, } }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/hyperswitch_domain_models/src/payments.rs | crate: hyperswitch_domain_models use api_models::payments::SessionToken; use common_utils::{ self, crypto::Encryptable, encryption::Encryption, errors::CustomResult, ext_traits::ValueExt, id_type, pii, types::{keymanager::ToEncryptable, MinorUnit}, }; use diesel_models::payment_intent::TaxDetails; use diesel_models::{ ephemeral_key, types::{FeatureMetadata, OrderDetailsWithAmount}, }; use self::payment_attempt::PaymentAttempt; pub fn update_from_request(self, req: &api_models::payments::AmountDetailsUpdate) -> Self { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/hyperswitch_domain_models/src/payments.rs | crate: hyperswitch_domain_models use api_models::payments::SessionToken; use common_utils::{ self, crypto::Encryptable, encryption::Encryption, errors::CustomResult, ext_traits::ValueExt, id_type, pii, types::{keymanager::ToEncryptable, MinorUnit}, }; use common_enums as storage_enums; use self::payment_attempt::PaymentAttempt; pub fn proxy_create_attempt_amount_details( &self, _confirm_intent_request: &api_models::payments::ProxyPaymentsRequest, ) -> payment_attempt::AttemptAmountDetails { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/hyperswitch_domain_models/src/payments.rs | crate: hyperswitch_domain_models use api_models::payments::SessionToken; use common_utils::{ self, crypto::Encryptable, encryption::Encryption, errors::CustomResult, ext_traits::ValueExt, id_type, pii, types::{keymanager::ToEncryptable, MinorUnit}, }; use common_enums as storage_enums; use self::payment_attempt::PaymentAttempt; pub fn create_attempt_amount_details( &self, confirm_intent_request: &api_models::payments::PaymentsConfirmIntentRequest, ) -> payment_attempt::AttemptAmountDetails { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/hyperswitch_domain_models/src/payments.rs | crate: hyperswitch_domain_models use std::marker::PhantomData; use api_models::payments::SessionToken; use common_types::primitive_wrappers::{ AlwaysRequestExtendedAuthorization, RequestExtendedAuthorizationBool, }; use common_utils::ext_traits::OptionExt; use common_utils::{ self, crypto::Encryptable, encryption::Encryption, errors::CustomResult, ext_traits::ValueExt, id_type, pii, types::{keymanager::ToEncryptable, MinorUnit}, }; use diesel_models::payment_intent::TaxDetails; use error_stack::ResultExt; use masking::Secret; use payment_intent::PaymentIntentUpdate; use router_derive::ToEncryption; use rustc_hash::FxHashMap; use serde_json::Value; use time::PrimitiveDateTime; use common_enums as storage_enums; use diesel_models::{ ephemeral_key, types::{FeatureMetadata, OrderDetailsWithAmount}, }; use self::payment_attempt::PaymentAttempt; use crate::{ address::Address, business_profile, customer, errors, merchant_account, merchant_connector_account, payment_address, payment_method_data, routing, ApiModelToDieselModelConvertor, }; use crate::{payment_method_data, RemoteStorageObject}; pub fn get_request_extended_authorization_bool_if_connector_supports( &self, connector: common_enums::connector_enums::Connector, always_request_extended_authorization_optional: Option<AlwaysRequestExtendedAuthorization>, payment_method_optional: Option<common_enums::PaymentMethod>, payment_method_type_optional: Option<common_enums::PaymentMethodType>, ) -> Option<RequestExtendedAuthorizationBool> { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/hyperswitch_domain_models/src/payments.rs | crate: hyperswitch_domain_models use common_utils::{ self, crypto::Encryptable, encryption::Encryption, errors::CustomResult, ext_traits::ValueExt, id_type, pii, types::{keymanager::ToEncryptable, MinorUnit}, }; use self::payment_attempt::PaymentAttempt; use crate::{ address::Address, business_profile, customer, errors, merchant_account, merchant_connector_account, payment_address, payment_method_data, routing, ApiModelToDieselModelConvertor, }; use crate::{payment_method_data, RemoteStorageObject}; pub fn get_network_token_data(&self) -> Option<payment_method_data::NetworkTokenData> { { Self::Card(_card_data) => None,<|fim_suffix|> <|fim_middle|> Self::CardAndNetworkToken(vault_data) => Some(vault_data.network_token_data.clone()), } }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/hyperswitch_domain_models/src/payments.rs | crate: hyperswitch_domain_models #[derive(Clone)] pub struct RevenueRecoveryData { pub billing_connector_id: id_type::MerchantConnectorAccountId, pub processor_payment_method_token: String, pub connector_customer_id: String, } #[cfg(feature = "v2")] impl<F> PaymentAttemptRecordData<F> where F: Clone, { pub fn get_updated_feature_metadata( &self, ) -> CustomResult<Option<FeatureMetadata>, errors::api_error_response::ApiErrorResponse> { let payment_intent_feature_metadata = self.payment_intent.get_feature_metadata(); let revenue_recovery = self.payment_intent.get_revenue_recovery_metadata(); let payment_attempt_connector = self.payment_attempt.connector.clone(); let payment_revenue_recovery_metadata = match payment_attempt_connector { Some(connector) => Some(diesel_models::types::PaymentRevenueRecoveryMetadata { // Update retry count by one. total_retry_count: revenue_recovery .as_ref() .map_or(1, |data| (data.total_retry_count + 1)), pub fn get_updated_feature_metadata( &self, ) -> CustomResult<Option<FeatureMetadata>, errors::api_error_response::ApiErrorResponse> { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/hyperswitch_domain_models/src/payments.rs | crate: hyperswitch_domain_models use common_utils::{ self, crypto::Encryptable, encryption::Encryption, errors::CustomResult, ext_traits::ValueExt, id_type, pii, types::{keymanager::ToEncryptable, MinorUnit}, }; use self::payment_attempt::PaymentAttempt; use crate::{ address::Address, business_profile, customer, errors, merchant_account, merchant_connector_account, payment_address, payment_method_data, routing, ApiModelToDieselModelConvertor, }; use crate::{payment_method_data, RemoteStorageObject}; pub fn get_network_token_data(&self) -> Option<payment_method_data::NetworkTokenData> { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/hyperswitch_domain_models/src/payments.rs | crate: hyperswitch_domain_models use common_utils::{ self, crypto::Encryptable, encryption::Encryption, errors::CustomResult, ext_traits::ValueExt, id_type, pii, types::{keymanager::ToEncryptable, MinorUnit}, }; use self::payment_attempt::PaymentAttempt; use crate::{ address::Address, business_profile, customer, errors, merchant_account, merchant_connector_account, payment_address, payment_method_data, routing, ApiModelToDieselModelConvertor, }; use crate::{payment_method_data, RemoteStorageObject}; pub fn get_card_vault_data(&self) -> Option<payment_method_data::Card> { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/hyperswitch_domain_models/src/payments.rs | crate: hyperswitch_domain_models use common_utils::{ self, crypto::Encryptable, encryption::Encryption, errors::CustomResult, ext_traits::ValueExt, id_type, pii, types::{keymanager::ToEncryptable, MinorUnit}, }; use diesel_models::payment_intent::TaxDetails; use payment_intent::PaymentIntentUpdate; use self::payment_attempt::PaymentAttempt; pub fn get_payment_id(&self) -> &id_type::GlobalPaymentId { <|fim_suffix|> <|fim_middle|> }
ast_fragments
// file: hyperswitch/crates/hyperswitch_domain_models/src/payments.rs | crate: hyperswitch_domain_models use common_utils::{ self, crypto::Encryptable, encryption::Encryption, errors::CustomResult, ext_traits::ValueExt, id_type, pii, types::{keymanager::ToEncryptable, MinorUnit}, }; use diesel_models::payment_intent::TaxDetails; use payment_intent::PaymentIntentUpdate; use self::payment_attempt::PaymentAttempt; use crate::{ address::Address, business_profile, customer, errors, merchant_account, merchant_connector_account, payment_address, payment_method_data, routing, ApiModelToDieselModelConvertor, }; pub fn get_connector_customer_id( &self, customer: Option<&customer::Customer>, merchant_connector_account: &merchant_connector_account::MerchantConnectorAccount, ) -> Option<String> { match customer .and_then(|cust| cust.get_connector_customer_id(&merchant_connector_account.get_id())) { Some(id) => Some(id.to_string()), None => self .payment_intent .get_connector_customer_id_from_feature_metadata(), } }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/hyperswitch_domain_models/src/payments.rs | crate: hyperswitch_domain_models use common_enums as storage_enums; pub fn with_source(payment_confirm_source: common_enums::PaymentSource) -> Self { <|fim_suffix|> <|fim_middle|> }
ast_fragments
// file: hyperswitch/crates/hyperswitch_domain_models/src/payments.rs | crate: hyperswitch_domain_models use common_utils::{ self, crypto::Encryptable, encryption::Encryption, errors::CustomResult, ext_traits::ValueExt, id_type, pii, types::{keymanager::ToEncryptable, MinorUnit}, }; use diesel_models::{ ephemeral_key, types::{FeatureMetadata, OrderDetailsWithAmount}, }; use self::payment_attempt::PaymentAttempt; pub fn get_feature_metadata(&self) -> Option<FeatureMetadata> { self.feature_metadata.clone() }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/hyperswitch_domain_models/src/payments.rs | crate: hyperswitch_domain_models use common_utils::{ self, crypto::Encryptable, encryption::Encryption, errors::CustomResult, ext_traits::ValueExt, id_type, pii, types::{keymanager::ToEncryptable, MinorUnit}, }; use diesel_models::payment_intent::TaxDetails; use diesel_models::{ ephemeral_key, types::{FeatureMetadata, OrderDetailsWithAmount}, }; use self::payment_attempt::PaymentAttempt; pub fn get_revenue_recovery_metadata( &self, ) -> Option<diesel_models::types::PaymentRevenueRecoveryMetadata> { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/hyperswitch_domain_models/src/payments.rs | crate: hyperswitch_domain_models use common_utils::ext_traits::OptionExt; use common_utils::{ self, crypto::Encryptable, encryption::Encryption, errors::CustomResult, ext_traits::ValueExt, id_type, pii, types::{keymanager::ToEncryptable, MinorUnit}, }; use diesel_models::{ ephemeral_key, types::{FeatureMetadata, OrderDetailsWithAmount}, }; use self::payment_attempt::PaymentAttempt; use crate::{ address::Address, business_profile, customer, errors, merchant_account, merchant_connector_account, payment_address, payment_method_data, routing, ApiModelToDieselModelConvertor, }; /// Check if the client secret is associated with the payment and if it has been expired pub fn validate_client_secret( &self, client_secret: &common_utils::types::ClientSecret, ) -> Result<(), errors::api_error_response::ApiErrorResponse> { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/hyperswitch_domain_models/src/payments.rs | crate: hyperswitch_domain_models use api_models::payments::SessionToken; use common_utils::{ self, crypto::Encryptable, encryption::Encryption, errors::CustomResult, ext_traits::ValueExt, id_type, pii, types::{keymanager::ToEncryptable, MinorUnit}, }; use common_enums as storage_enums; use crate::{ address::Address, business_profile, customer, errors, merchant_account, merchant_connector_account, payment_address, payment_method_data, routing, ApiModelToDieselModelConvertor, }; fn get_request_incremental_authorization_value( request: &api_models::payments::PaymentsCreateIntentRequest, ) -> CustomResult< common_enums::RequestIncrementalAuthorization, errors::api_error_response::ApiErrorResponse, > { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/hyperswitch_domain_models/src/payments.rs | crate: hyperswitch_domain_models use common_utils::{ self, crypto::Encryptable, encryption::Encryption, errors::CustomResult, ext_traits::ValueExt, id_type, pii, types::{keymanager::ToEncryptable, MinorUnit}, }; use self::payment_attempt::PaymentAttempt; pub fn get_billing_merchant_connector_account_id( &self, ) -> Option<id_type::MerchantConnectorAccountId> { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/hyperswitch_domain_models/src/payments.rs | crate: hyperswitch_domain_models use common_utils::{ self, crypto::Encryptable, encryption::Encryption, errors::CustomResult, ext_traits::ValueExt, id_type, pii, types::{keymanager::ToEncryptable, MinorUnit}, }; use self::payment_attempt::PaymentAttempt; pub fn get_connector_customer_id_from_feature_metadata(&self) -> Option<String> { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/hyperswitch_domain_models/src/payments.rs | crate: hyperswitch_domain_models use common_utils::{ self, crypto::Encryptable, encryption::Encryption, errors::CustomResult, ext_traits::ValueExt, id_type, pii, types::{keymanager::ToEncryptable, MinorUnit}, }; use common_enums as storage_enums; use self::payment_attempt::PaymentAttempt; fn get_payment_method_type(&self) -> Option<common_enums::PaymentMethod> { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/hyperswitch_domain_models/src/payments.rs | crate: hyperswitch_domain_models use common_utils::{ self, crypto::Encryptable, encryption::Encryption, errors::CustomResult, ext_traits::ValueExt, id_type, pii, types::{keymanager::ToEncryptable, MinorUnit}, }; use common_enums as storage_enums; use self::payment_attempt::PaymentAttempt; fn get_payment_method_sub_type(&self) -> Option<common_enums::PaymentMethodType> { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/hyperswitch_domain_models/src/payments.rs | crate: hyperswitch_domain_models use common_utils::{ self, crypto::Encryptable, encryption::Encryption, errors::CustomResult, ext_traits::ValueExt, id_type, pii, types::{keymanager::ToEncryptable, MinorUnit}, }; use self::payment_attempt::PaymentAttempt; /// Calculate the net amount for the order pub fn calculate_net_amount(&self) -> MinorUnit { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/hyperswitch_domain_models/src/payments.rs | crate: hyperswitch_domain_models use common_utils::{ self, crypto::Encryptable, encryption::Encryption, errors::CustomResult, ext_traits::ValueExt, id_type, pii, types::{keymanager::ToEncryptable, MinorUnit}, }; use self::payment_attempt::PaymentAttempt; /// Get the action to whether calculate external tax or not as a boolean value fn get_external_tax_action_as_bool(&self) -> bool { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/hyperswitch_domain_models/src/payments.rs | crate: hyperswitch_domain_models use common_utils::{ self, crypto::Encryptable, encryption::Encryption, errors::CustomResult, ext_traits::ValueExt, id_type, pii, types::{keymanager::ToEncryptable, MinorUnit}, }; use self::payment_attempt::PaymentAttempt; /// Get the action to whether calculate surcharge or not as a boolean value fn get_surcharge_action_as_bool(&self) -> bool { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/hyperswitch_domain_models/src/payments.rs | crate: hyperswitch_domain_models use common_utils::ext_traits::OptionExt; use common_utils::{ self, crypto::Encryptable, encryption::Encryption, errors::CustomResult, ext_traits::ValueExt, id_type, pii, types::{keymanager::ToEncryptable, MinorUnit}, }; use masking::Secret; use self::payment_attempt::PaymentAttempt; use crate::{ address::Address, business_profile, customer, errors, merchant_account, merchant_connector_account, payment_address, payment_method_data, routing, ApiModelToDieselModelConvertor, }; pub fn parse_and_get_metadata<T>( &self, type_name: &'static str, ) -> CustomResult<Option<T>, common_utils::errors::ParsingError> where T: for<'de> masking::Deserialize<'de>, { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/hyperswitch_domain_models/src/payments.rs | crate: hyperswitch_domain_models use api_models::payments::SessionToken; use common_utils::{ self, crypto::Encryptable, encryption::Encryption, errors::CustomResult, ext_traits::ValueExt, id_type, pii, types::{keymanager::ToEncryptable, MinorUnit}, }; use self::payment_attempt::PaymentAttempt; use crate::{ address::Address, business_profile, customer, errors, merchant_account, merchant_connector_account, payment_address, payment_method_data, routing, ApiModelToDieselModelConvertor, }; /// This is the url to which the customer will be redirected to, after completing the redirection flow pub fn create_finish_redirection_url( &self, base_url: &str, publishable_key: &str, ) -> CustomResult<url::Url, errors::api_error_response::ApiErrorResponse> { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/hyperswitch_domain_models/src/payments.rs | crate: hyperswitch_domain_models use api_models::payments::SessionToken; use common_utils::{ self, crypto::Encryptable, encryption::Encryption, errors::CustomResult, ext_traits::ValueExt, id_type, pii, types::{keymanager::ToEncryptable, MinorUnit}, }; use self::payment_attempt::PaymentAttempt; use crate::{ address::Address, business_profile, customer, errors, merchant_account, merchant_connector_account, payment_address, payment_method_data, routing, ApiModelToDieselModelConvertor, }; /// This is the url to which the customer will be redirected to, to complete the redirection flow pub fn create_start_redirection_url( &self, base_url: &str, publishable_key: String, ) -> CustomResult<url::Url, errors::api_error_response::ApiErrorResponse> { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/hyperswitch_domain_models/src/payments.rs | crate: hyperswitch_domain_models use common_utils::{ self, crypto::Encryptable, encryption::Encryption, errors::CustomResult, ext_traits::ValueExt, id_type, pii, types::{keymanager::ToEncryptable, MinorUnit}, }; use self::payment_attempt::PaymentAttempt; pub fn get_id(&self) -> &id_type::GlobalPaymentId { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/hyperswitch_domain_models/src/payments.rs | crate: hyperswitch_domain_models use api_models::payments::SessionToken; use common_utils::ext_traits::OptionExt; use common_utils::{ self, crypto::Encryptable, encryption::Encryption, errors::CustomResult, ext_traits::ValueExt, id_type, pii, types::{keymanager::ToEncryptable, MinorUnit}, }; use masking::Secret; use time::PrimitiveDateTime; use common_enums as storage_enums; use diesel_models::{ ephemeral_key, types::{FeatureMetadata, OrderDetailsWithAmount}, }; use crate::{ address::Address, business_profile, customer, errors, merchant_account, merchant_connector_account, payment_address, payment_method_data, routing, ApiModelToDieselModelConvertor, }; pub async fn create_domain_model_from_request( payment_id: &id_type::GlobalPaymentId, merchant_account: &merchant_account::MerchantAccount, profile: &business_profile::Profile, request: api_models::payments::PaymentsCreateIntentRequest, decrypted_payment_intent: DecryptedPaymentIntent, platform_merchant_id: Option<&merchant_account::MerchantAccount>, ) -> CustomResult<Self, errors::api_error_response::ApiErrorResponse> { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/hyperswitch_domain_models/src/lib.rs | crate: hyperswitch_domain_models use api_models::payments::{ ApplePayRecurringDetails as ApiApplePayRecurringDetails, ApplePayRegularBillingDetails as ApiApplePayRegularBillingDetails, FeatureMetadata as ApiFeatureMetadata, OrderDetailsWithAmount as ApiOrderDetailsWithAmount, RecurringPaymentIntervalUnit as ApiRecurringPaymentIntervalUnit, RedirectResponse as ApiRedirectResponse, }; use api_models::payments::{ BillingConnectorPaymentDetails as ApiBillingConnectorPaymentDetails, PaymentRevenueRecoveryMetadata as ApiRevenueRecoveryMetadata, }; fn convert_back(self) -> api_models::admin::PaymentLinkConfigRequest { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/hyperswitch_domain_models/src/lib.rs | crate: hyperswitch_domain_models use api_models::payments::{ ApplePayRecurringDetails as ApiApplePayRecurringDetails, ApplePayRegularBillingDetails as ApiApplePayRegularBillingDetails, FeatureMetadata as ApiFeatureMetadata, OrderDetailsWithAmount as ApiOrderDetailsWithAmount, RecurringPaymentIntervalUnit as ApiRecurringPaymentIntervalUnit, RedirectResponse as ApiRedirectResponse, }; use api_models::payments::{ BillingConnectorPaymentDetails as ApiBillingConnectorPaymentDetails, PaymentRevenueRecoveryMetadata as ApiRevenueRecoveryMetadata, }; use diesel_models::types::{ ApplePayRecurringDetails, ApplePayRegularBillingDetails, FeatureMetadata, OrderDetailsWithAmount, RecurringPaymentIntervalUnit, RedirectResponse, }; use diesel_models::types::{BillingConnectorPaymentDetails, PaymentRevenueRecoveryMetadata}; fn convert_from(item: api_models::admin::PaymentLinkConfigRequest) -> Self { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/hyperswitch_domain_models/src/lib.rs | crate: hyperswitch_domain_models use api_models::payments::{ ApplePayRecurringDetails as ApiApplePayRecurringDetails, ApplePayRegularBillingDetails as ApiApplePayRegularBillingDetails, FeatureMetadata as ApiFeatureMetadata, OrderDetailsWithAmount as ApiOrderDetailsWithAmount, RecurringPaymentIntervalUnit as ApiRecurringPaymentIntervalUnit, RedirectResponse as ApiRedirectResponse, }; fn convert_back(self) -> ApiOrderDetailsWithAmount { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/hyperswitch_domain_models/src/lib.rs | crate: hyperswitch_domain_models use api_models::payments::{ ApplePayRecurringDetails as ApiApplePayRecurringDetails, ApplePayRegularBillingDetails as ApiApplePayRegularBillingDetails, FeatureMetadata as ApiFeatureMetadata, OrderDetailsWithAmount as ApiOrderDetailsWithAmount, RecurringPaymentIntervalUnit as ApiRecurringPaymentIntervalUnit, RedirectResponse as ApiRedirectResponse, }; fn convert_from(from: ApiOrderDetailsWithAmount) -> Self { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/hyperswitch_domain_models/src/lib.rs | crate: hyperswitch_domain_models use api_models::payments::{ ApplePayRecurringDetails as ApiApplePayRecurringDetails, ApplePayRegularBillingDetails as ApiApplePayRegularBillingDetails, FeatureMetadata as ApiFeatureMetadata, OrderDetailsWithAmount as ApiOrderDetailsWithAmount, RecurringPaymentIntervalUnit as ApiRecurringPaymentIntervalUnit, RedirectResponse as ApiRedirectResponse, }; fn convert_back(self) -> ApiRecurringPaymentIntervalUnit { { Self::Year => ApiRecurringPaymentIntervalUnit::Year,<|fim_suffix|> <|fim_middle|> Self::Minute => ApiRecurringPaymentIntervalUnit::Minute, } }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/hyperswitch_domain_models/src/lib.rs | crate: hyperswitch_domain_models use api_models::payments::{ ApplePayRecurringDetails as ApiApplePayRecurringDetails, ApplePayRegularBillingDetails as ApiApplePayRegularBillingDetails, FeatureMetadata as ApiFeatureMetadata, OrderDetailsWithAmount as ApiOrderDetailsWithAmount, RecurringPaymentIntervalUnit as ApiRecurringPaymentIntervalUnit, RedirectResponse as ApiRedirectResponse, }; fn convert_from(from: ApiRecurringPaymentIntervalUnit) -> Self { { ApiRecurringPaymentIntervalUnit::Year => Self::Year,<|fim_suffix|> <|fim_middle|> ApiRecurringPaymentIntervalUnit::Minute => Self::Minute, } }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/hyperswitch_domain_models/src/lib.rs | crate: hyperswitch_domain_models use api_models::payments::{ ApplePayRecurringDetails as ApiApplePayRecurringDetails, ApplePayRegularBillingDetails as ApiApplePayRegularBillingDetails, FeatureMetadata as ApiFeatureMetadata, OrderDetailsWithAmount as ApiOrderDetailsWithAmount, RecurringPaymentIntervalUnit as ApiRecurringPaymentIntervalUnit, RedirectResponse as ApiRedirectResponse, }; use api_models::payments::{ BillingConnectorPaymentDetails as ApiBillingConnectorPaymentDetails, PaymentRevenueRecoveryMetadata as ApiRevenueRecoveryMetadata, }; fn from(error: &api_models::payments::RecordAttemptErrorDetails) -> Self { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/hyperswitch_domain_models/src/lib.rs | crate: hyperswitch_domain_models use api_models::payments::{ ApplePayRecurringDetails as ApiApplePayRecurringDetails, ApplePayRegularBillingDetails as ApiApplePayRegularBillingDetails, FeatureMetadata as ApiFeatureMetadata, OrderDetailsWithAmount as ApiOrderDetailsWithAmount, RecurringPaymentIntervalUnit as ApiRecurringPaymentIntervalUnit, RedirectResponse as ApiRedirectResponse, }; use api_models::payments::{ BillingConnectorPaymentDetails as ApiBillingConnectorPaymentDetails, PaymentRevenueRecoveryMetadata as ApiRevenueRecoveryMetadata, }; fn from(amount: &api_models::payments::PaymentAttemptAmountDetails) -> Self { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/hyperswitch_domain_models/src/lib.rs | crate: hyperswitch_domain_models use api_models::payments::{ ApplePayRecurringDetails as ApiApplePayRecurringDetails, ApplePayRegularBillingDetails as ApiApplePayRegularBillingDetails, FeatureMetadata as ApiFeatureMetadata, OrderDetailsWithAmount as ApiOrderDetailsWithAmount, RecurringPaymentIntervalUnit as ApiRecurringPaymentIntervalUnit, RedirectResponse as ApiRedirectResponse, }; use api_models::payments::{ BillingConnectorPaymentDetails as ApiBillingConnectorPaymentDetails, PaymentRevenueRecoveryMetadata as ApiRevenueRecoveryMetadata, }; fn from(amount_details: payments::AmountDetails) -> Self { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/hyperswitch_domain_models/src/lib.rs | crate: hyperswitch_domain_models use api_models::payments::{ ApplePayRecurringDetails as ApiApplePayRecurringDetails, ApplePayRegularBillingDetails as ApiApplePayRegularBillingDetails, FeatureMetadata as ApiFeatureMetadata, OrderDetailsWithAmount as ApiOrderDetailsWithAmount, RecurringPaymentIntervalUnit as ApiRecurringPaymentIntervalUnit, RedirectResponse as ApiRedirectResponse, }; use api_models::payments::{ BillingConnectorPaymentDetails as ApiBillingConnectorPaymentDetails, PaymentRevenueRecoveryMetadata as ApiRevenueRecoveryMetadata, }; use diesel_models::types::{ ApplePayRecurringDetails, ApplePayRegularBillingDetails, FeatureMetadata, OrderDetailsWithAmount, RecurringPaymentIntervalUnit, RedirectResponse, }; use diesel_models::types::{BillingConnectorPaymentDetails, PaymentRevenueRecoveryMetadata}; fn from(amount_details: api_models::payments::AmountDetails) -> Self { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/hyperswitch_domain_models/src/lib.rs | crate: hyperswitch_domain_models use api_models::payments::{ ApplePayRecurringDetails as ApiApplePayRecurringDetails, ApplePayRegularBillingDetails as ApiApplePayRegularBillingDetails, FeatureMetadata as ApiFeatureMetadata, OrderDetailsWithAmount as ApiOrderDetailsWithAmount, RecurringPaymentIntervalUnit as ApiRecurringPaymentIntervalUnit, RedirectResponse as ApiRedirectResponse, }; use api_models::payments::{ BillingConnectorPaymentDetails as ApiBillingConnectorPaymentDetails, PaymentRevenueRecoveryMetadata as ApiRevenueRecoveryMetadata, }; fn convert_back(self) -> api_models::admin::TransactionDetailsUiConfiguration { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/hyperswitch_domain_models/src/lib.rs | crate: hyperswitch_domain_models use api_models::payments::{ ApplePayRecurringDetails as ApiApplePayRecurringDetails, ApplePayRegularBillingDetails as ApiApplePayRegularBillingDetails, FeatureMetadata as ApiFeatureMetadata, OrderDetailsWithAmount as ApiOrderDetailsWithAmount, RecurringPaymentIntervalUnit as ApiRecurringPaymentIntervalUnit, RedirectResponse as ApiRedirectResponse, }; use api_models::payments::{ BillingConnectorPaymentDetails as ApiBillingConnectorPaymentDetails, PaymentRevenueRecoveryMetadata as ApiRevenueRecoveryMetadata, }; fn convert_from(from: api_models::admin::TransactionDetailsUiConfiguration) -> Self { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/hyperswitch_domain_models/src/lib.rs | crate: hyperswitch_domain_models use api_models::payments::{ ApplePayRecurringDetails as ApiApplePayRecurringDetails, ApplePayRegularBillingDetails as ApiApplePayRegularBillingDetails, FeatureMetadata as ApiFeatureMetadata, OrderDetailsWithAmount as ApiOrderDetailsWithAmount, RecurringPaymentIntervalUnit as ApiRecurringPaymentIntervalUnit, RedirectResponse as ApiRedirectResponse, }; use api_models::payments::{ BillingConnectorPaymentDetails as ApiBillingConnectorPaymentDetails, PaymentRevenueRecoveryMetadata as ApiRevenueRecoveryMetadata, }; fn convert_back(self) -> api_models::admin::PaymentLinkBackgroundImageConfig { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/hyperswitch_domain_models/src/lib.rs | crate: hyperswitch_domain_models use api_models::payments::{ ApplePayRecurringDetails as ApiApplePayRecurringDetails, ApplePayRegularBillingDetails as ApiApplePayRegularBillingDetails, FeatureMetadata as ApiFeatureMetadata, OrderDetailsWithAmount as ApiOrderDetailsWithAmount, RecurringPaymentIntervalUnit as ApiRecurringPaymentIntervalUnit, RedirectResponse as ApiRedirectResponse, }; use api_models::payments::{ BillingConnectorPaymentDetails as ApiBillingConnectorPaymentDetails, PaymentRevenueRecoveryMetadata as ApiRevenueRecoveryMetadata, }; fn convert_from(from: api_models::admin::PaymentLinkBackgroundImageConfig) -> Self { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/hyperswitch_domain_models/src/lib.rs | crate: hyperswitch_domain_models use api_models::payments::{ ApplePayRecurringDetails as ApiApplePayRecurringDetails, ApplePayRegularBillingDetails as ApiApplePayRegularBillingDetails, FeatureMetadata as ApiFeatureMetadata, OrderDetailsWithAmount as ApiOrderDetailsWithAmount, RecurringPaymentIntervalUnit as ApiRecurringPaymentIntervalUnit, RedirectResponse as ApiRedirectResponse, }; use api_models::payments::{ BillingConnectorPaymentDetails as ApiBillingConnectorPaymentDetails, PaymentRevenueRecoveryMetadata as ApiRevenueRecoveryMetadata, }; fn convert_back(self) -> api_models::admin::PaymentLinkTransactionDetails { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/hyperswitch_domain_models/src/lib.rs | crate: hyperswitch_domain_models use api_models::payments::{ ApplePayRecurringDetails as ApiApplePayRecurringDetails, ApplePayRegularBillingDetails as ApiApplePayRegularBillingDetails, FeatureMetadata as ApiFeatureMetadata, OrderDetailsWithAmount as ApiOrderDetailsWithAmount, RecurringPaymentIntervalUnit as ApiRecurringPaymentIntervalUnit, RedirectResponse as ApiRedirectResponse, }; use api_models::payments::{ BillingConnectorPaymentDetails as ApiBillingConnectorPaymentDetails, PaymentRevenueRecoveryMetadata as ApiRevenueRecoveryMetadata, }; use diesel_models::types::{ ApplePayRecurringDetails, ApplePayRegularBillingDetails, FeatureMetadata, OrderDetailsWithAmount, RecurringPaymentIntervalUnit, RedirectResponse, }; use diesel_models::types::{BillingConnectorPaymentDetails, PaymentRevenueRecoveryMetadata}; fn convert_from(from: api_models::admin::PaymentLinkTransactionDetails) -> Self { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/hyperswitch_domain_models/src/lib.rs | crate: hyperswitch_domain_models use api_models::payments::{ BillingConnectorPaymentDetails as ApiBillingConnectorPaymentDetails, PaymentRevenueRecoveryMetadata as ApiRevenueRecoveryMetadata, }; fn convert_back(self) -> ApiBillingConnectorPaymentDetails { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/hyperswitch_domain_models/src/lib.rs | crate: hyperswitch_domain_models use api_models::payments::{ BillingConnectorPaymentDetails as ApiBillingConnectorPaymentDetails, PaymentRevenueRecoveryMetadata as ApiRevenueRecoveryMetadata, }; fn convert_from(from: ApiBillingConnectorPaymentDetails) -> Self { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/hyperswitch_domain_models/src/lib.rs | crate: hyperswitch_domain_models use api_models::payments::{ BillingConnectorPaymentDetails as ApiBillingConnectorPaymentDetails, PaymentRevenueRecoveryMetadata as ApiRevenueRecoveryMetadata, }; fn convert_back(self) -> ApiRevenueRecoveryMetadata { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/hyperswitch_domain_models/src/lib.rs | crate: hyperswitch_domain_models use api_models::payments::{ BillingConnectorPaymentDetails as ApiBillingConnectorPaymentDetails, PaymentRevenueRecoveryMetadata as ApiRevenueRecoveryMetadata, }; use diesel_models::types::{BillingConnectorPaymentDetails, PaymentRevenueRecoveryMetadata}; fn convert_from(from: ApiRevenueRecoveryMetadata) -> Self { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/hyperswitch_domain_models/src/lib.rs | crate: hyperswitch_domain_models use api_models::payments::{ ApplePayRecurringDetails as ApiApplePayRecurringDetails, ApplePayRegularBillingDetails as ApiApplePayRegularBillingDetails, FeatureMetadata as ApiFeatureMetadata, OrderDetailsWithAmount as ApiOrderDetailsWithAmount, RecurringPaymentIntervalUnit as ApiRecurringPaymentIntervalUnit, RedirectResponse as ApiRedirectResponse, }; fn convert_back(self) -> ApiApplePayRecurringDetails { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/hyperswitch_domain_models/src/lib.rs | crate: hyperswitch_domain_models use api_models::payments::{ ApplePayRecurringDetails as ApiApplePayRecurringDetails, ApplePayRegularBillingDetails as ApiApplePayRegularBillingDetails, FeatureMetadata as ApiFeatureMetadata, OrderDetailsWithAmount as ApiOrderDetailsWithAmount, RecurringPaymentIntervalUnit as ApiRecurringPaymentIntervalUnit, RedirectResponse as ApiRedirectResponse, }; use diesel_models::types::{ ApplePayRecurringDetails, ApplePayRegularBillingDetails, FeatureMetadata, OrderDetailsWithAmount, RecurringPaymentIntervalUnit, RedirectResponse, }; fn convert_from(from: ApiApplePayRecurringDetails) -> Self { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/hyperswitch_domain_models/src/lib.rs | crate: hyperswitch_domain_models use api_models::payments::{ ApplePayRecurringDetails as ApiApplePayRecurringDetails, ApplePayRegularBillingDetails as ApiApplePayRegularBillingDetails, FeatureMetadata as ApiFeatureMetadata, OrderDetailsWithAmount as ApiOrderDetailsWithAmount, RecurringPaymentIntervalUnit as ApiRecurringPaymentIntervalUnit, RedirectResponse as ApiRedirectResponse, }; fn convert_back(self) -> ApiApplePayRegularBillingDetails { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/hyperswitch_domain_models/src/lib.rs | crate: hyperswitch_domain_models use api_models::payments::{ ApplePayRecurringDetails as ApiApplePayRecurringDetails, ApplePayRegularBillingDetails as ApiApplePayRegularBillingDetails, FeatureMetadata as ApiFeatureMetadata, OrderDetailsWithAmount as ApiOrderDetailsWithAmount, RecurringPaymentIntervalUnit as ApiRecurringPaymentIntervalUnit, RedirectResponse as ApiRedirectResponse, }; use diesel_models::types::{ ApplePayRecurringDetails, ApplePayRegularBillingDetails, FeatureMetadata, OrderDetailsWithAmount, RecurringPaymentIntervalUnit, RedirectResponse, }; fn convert_from(from: ApiApplePayRegularBillingDetails) -> Self { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/hyperswitch_domain_models/src/lib.rs | crate: hyperswitch_domain_models use api_models::payments::{ ApplePayRecurringDetails as ApiApplePayRecurringDetails, ApplePayRegularBillingDetails as ApiApplePayRegularBillingDetails, FeatureMetadata as ApiFeatureMetadata, OrderDetailsWithAmount as ApiOrderDetailsWithAmount, RecurringPaymentIntervalUnit as ApiRecurringPaymentIntervalUnit, RedirectResponse as ApiRedirectResponse, }; fn convert_back(self) -> ApiRecurringPaymentIntervalUnit { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/hyperswitch_domain_models/src/lib.rs | crate: hyperswitch_domain_models use api_models::payments::{ ApplePayRecurringDetails as ApiApplePayRecurringDetails, ApplePayRegularBillingDetails as ApiApplePayRegularBillingDetails, FeatureMetadata as ApiFeatureMetadata, OrderDetailsWithAmount as ApiOrderDetailsWithAmount, RecurringPaymentIntervalUnit as ApiRecurringPaymentIntervalUnit, RedirectResponse as ApiRedirectResponse, }; fn convert_from(from: ApiRecurringPaymentIntervalUnit) -> Self { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/hyperswitch_domain_models/src/lib.rs | crate: hyperswitch_domain_models use api_models::payments::{ ApplePayRecurringDetails as ApiApplePayRecurringDetails, ApplePayRegularBillingDetails as ApiApplePayRegularBillingDetails, FeatureMetadata as ApiFeatureMetadata, OrderDetailsWithAmount as ApiOrderDetailsWithAmount, RecurringPaymentIntervalUnit as ApiRecurringPaymentIntervalUnit, RedirectResponse as ApiRedirectResponse, }; fn convert_back(self) -> ApiRedirectResponse { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/hyperswitch_domain_models/src/lib.rs | crate: hyperswitch_domain_models use api_models::payments::{ ApplePayRecurringDetails as ApiApplePayRecurringDetails, ApplePayRegularBillingDetails as ApiApplePayRegularBillingDetails, FeatureMetadata as ApiFeatureMetadata, OrderDetailsWithAmount as ApiOrderDetailsWithAmount, RecurringPaymentIntervalUnit as ApiRecurringPaymentIntervalUnit, RedirectResponse as ApiRedirectResponse, }; fn convert_from(from: ApiRedirectResponse) -> Self { <|fim_suffix|> <|fim_middle|> }
ast_fragments
// file: hyperswitch/crates/hyperswitch_domain_models/src/lib.rs | crate: hyperswitch_domain_models use api_models::payments::{ ApplePayRecurringDetails as ApiApplePayRecurringDetails, ApplePayRegularBillingDetails as ApiApplePayRegularBillingDetails, FeatureMetadata as ApiFeatureMetadata, OrderDetailsWithAmount as ApiOrderDetailsWithAmount, RecurringPaymentIntervalUnit as ApiRecurringPaymentIntervalUnit, RedirectResponse as ApiRedirectResponse, }; fn convert_back(self) -> ApiFeatureMetadata { let Self { redirect_response, search_tags, apple_pay_recurring_details, payment_revenue_recovery_metadata, } = self; ApiFeatureMetadata { redirect_response: redirect_response .map(|redirect_response| redirect_response.convert_back()), search_tags, apple_pay_recurring_details: apple_pay_recurring_details .map(|value| value.convert_back()), payment_revenue_recovery_metadata: payment_revenue_recovery_metadata .map(|value| value.convert_back()), } }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/hyperswitch_domain_models/src/lib.rs | crate: hyperswitch_domain_models use api_models::payments::{ ApplePayRecurringDetails as ApiApplePayRecurringDetails, ApplePayRegularBillingDetails as ApiApplePayRegularBillingDetails, FeatureMetadata as ApiFeatureMetadata, OrderDetailsWithAmount as ApiOrderDetailsWithAmount, RecurringPaymentIntervalUnit as ApiRecurringPaymentIntervalUnit, RedirectResponse as ApiRedirectResponse, }; use api_models::payments::{ BillingConnectorPaymentDetails as ApiBillingConnectorPaymentDetails, PaymentRevenueRecoveryMetadata as ApiRevenueRecoveryMetadata, }; use diesel_models::types::{ ApplePayRecurringDetails, ApplePayRegularBillingDetails, FeatureMetadata, OrderDetailsWithAmount, RecurringPaymentIntervalUnit, RedirectResponse, }; use diesel_models::types::{BillingConnectorPaymentDetails, PaymentRevenueRecoveryMetadata}; fn convert_from(from: ApiFeatureMetadata) -> Self { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/hyperswitch_domain_models/src/lib.rs | crate: hyperswitch_domain_models use api_models::payments::{ ApplePayRecurringDetails as ApiApplePayRecurringDetails, ApplePayRegularBillingDetails as ApiApplePayRegularBillingDetails, FeatureMetadata as ApiFeatureMetadata, OrderDetailsWithAmount as ApiOrderDetailsWithAmount, RecurringPaymentIntervalUnit as ApiRecurringPaymentIntervalUnit, RedirectResponse as ApiRedirectResponse, }; fn convert_back(self) -> ApiFeatureMetadata { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments