id
stringlengths
11
116
type
stringclasses
1 value
granularity
stringclasses
4 values
content
stringlengths
16
477k
metadata
dict
fn_clm_common_utils_from_3664153003756899413
clm
function
// Repository: hyperswitch // Crate: common_utils // Purpose: Utility functions shared across crates // Module: crates/common_utils/src/id_type/payment // Implementation of router_env::opentelemetry::Value for From<PaymentId> fn from(val: PaymentId) -> Self { Self::from(val.0 .0 .0) }
{ "crate": "common_utils", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 2602, "total_crates": null }
fn_clm_common_utils_from_str_3664153003756899413
clm
function
// Repository: hyperswitch // Crate: common_utils // Purpose: Utility functions shared across crates // Module: crates/common_utils/src/id_type/payment // Implementation of PaymentReferenceId for std::str::FromStr fn from_str(s: &str) -> Result<Self, Self::Err> { let cow_string = std::borrow::Cow::Owned(s.to_string()); Self::try_from(cow_string) }
{ "crate": "common_utils", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 785, "total_crates": null }
fn_clm_common_utils_wrap_3664153003756899413
clm
function
// Repository: hyperswitch // Crate: common_utils // Purpose: Utility functions shared across crates // Module: crates/common_utils/src/id_type/payment // Implementation of None for PaymentId /// Wrap a string inside PaymentId pub fn wrap(payment_id_string: String) -> CustomResult<Self, ValidationError> { Self::try_from(std::borrow::Cow::from(payment_id_string)) }
{ "crate": "common_utils", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 94, "total_crates": null }
fn_clm_common_utils_generate_test_payment_id_for_sample_data_3664153003756899413
clm
function
// Repository: hyperswitch // Crate: common_utils // Purpose: Utility functions shared across crates // Module: crates/common_utils/src/id_type/payment // Implementation of None for PaymentId /// Generate a test payment id with prefix test_ pub fn generate_test_payment_id_for_sample_data() -> Self { let id = generate_id_with_default_len("test"); let alphanumeric_id = AlphaNumericId::new_unchecked(id); let id = LengthId::new_unchecked(alphanumeric_id); Self(id) }
{ "crate": "common_utils", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 44, "total_crates": null }
fn_clm_common_utils_get_irrelevant_id_3664153003756899413
clm
function
// Repository: hyperswitch // Crate: common_utils // Purpose: Utility functions shared across crates // Module: crates/common_utils/src/id_type/payment // Implementation of None for PaymentId /// Get payment id in the format of irrelevant_payment_id_in_{flow} pub fn get_irrelevant_id(flow: &str) -> Self { let alphanumeric_id = AlphaNumericId::new_unchecked(format!("irrelevant_payment_id_in_{flow}")); let id = LengthId::new_unchecked(alphanumeric_id); Self(id) }
{ "crate": "common_utils", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 39, "total_crates": null }
fn_clm_common_utils_get_api_event_type_8326840139740291483
clm
function
// Repository: hyperswitch // Crate: common_utils // Purpose: Utility functions shared across crates // Module: crates/common_utils/src/id_type/invoice // Implementation of InvoiceId for crate::events::ApiEventMetric fn get_api_event_type(&self) -> Option<crate::events::ApiEventsType> { Some(crate::events::ApiEventsType::Invoice) }
{ "crate": "common_utils", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 26, "total_crates": null }
fn_clm_common_utils_get_api_event_type_3765022813668262941
clm
function
// Repository: hyperswitch // Crate: common_utils // Purpose: Utility functions shared across crates // Module: crates/common_utils/src/id_type/customer // Implementation of CustomerId for crate::events::ApiEventMetric fn get_api_event_type(&self) -> Option<crate::events::ApiEventsType> { Some(crate::events::ApiEventsType::Customer { customer_id: self.clone(), }) }
{ "crate": "common_utils", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 28, "total_crates": null }
fn_clm_common_utils_from_459422617766455663
clm
function
// Repository: hyperswitch // Crate: common_utils // Purpose: Utility functions shared across crates // Module: crates/common_utils/src/id_type/profile_acquirer // Implementation of router_env::opentelemetry::Value for From<ProfileAcquirerId> fn from(val: ProfileAcquirerId) -> Self { Self::from(val.0 .0 .0) }
{ "crate": "common_utils", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 2602, "total_crates": null }
fn_clm_common_utils_from_str_459422617766455663
clm
function
// Repository: hyperswitch // Crate: common_utils // Purpose: Utility functions shared across crates // Module: crates/common_utils/src/id_type/profile_acquirer // Implementation of ProfileAcquirerId for FromStr fn from_str(s: &str) -> Result<Self, Self::Err> { let cow_string = std::borrow::Cow::Owned(s.to_string()); Self::try_from(cow_string) }
{ "crate": "common_utils", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 785, "total_crates": null }
fn_clm_common_utils_cmp_459422617766455663
clm
function
// Repository: hyperswitch // Crate: common_utils // Purpose: Utility functions shared across crates // Module: crates/common_utils/src/id_type/profile_acquirer // Implementation of ProfileAcquirerId for Ord fn cmp(&self, other: &Self) -> std::cmp::Ordering { self.0 .0 .0.cmp(&other.0 .0 .0) }
{ "crate": "common_utils", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 28, "total_crates": null }
fn_clm_common_utils_get_api_event_type_459422617766455663
clm
function
// Repository: hyperswitch // Crate: common_utils // Purpose: Utility functions shared across crates // Module: crates/common_utils/src/id_type/profile_acquirer // Implementation of ProfileAcquirerId for crate::events::ApiEventMetric fn get_api_event_type(&self) -> Option<crate::events::ApiEventsType> { Some(crate::events::ApiEventsType::ProfileAcquirer { profile_acquirer_id: self.clone(), }) }
{ "crate": "common_utils", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 28, "total_crates": null }
fn_clm_common_utils_partial_cmp_459422617766455663
clm
function
// Repository: hyperswitch // Crate: common_utils // Purpose: Utility functions shared across crates // Module: crates/common_utils/src/id_type/profile_acquirer // Implementation of ProfileAcquirerId for PartialOrd fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> { Some(self.cmp(other)) }
{ "crate": "common_utils", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 13, "total_crates": null }
fn_clm_common_utils_get_external_authentication_request_poll_id_-4187107868894774292
clm
function
// Repository: hyperswitch // Crate: common_utils // Purpose: Utility functions shared across crates // Module: crates/common_utils/src/id_type/authentication // Inherent implementation for AuthenticationId /// Get external authentication request poll id pub fn get_external_authentication_request_poll_id(&self) -> String { format!("external_authentication_{}", self.get_string_repr()) }
{ "crate": "common_utils", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 36, "total_crates": null }
fn_clm_common_utils_generate_authentication_id_-4187107868894774292
clm
function
// Repository: hyperswitch // Crate: common_utils // Purpose: Utility functions shared across crates // Module: crates/common_utils/src/id_type/authentication // Inherent implementation for AuthenticationId /// Generate Authentication Id from prefix pub fn generate_authentication_id(prefix: &'static str) -> Self { Self(crate::generate_ref_id_with_default_length(prefix)) }
{ "crate": "common_utils", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 34, "total_crates": null }
fn_clm_common_utils_get_api_event_type_-4187107868894774292
clm
function
// Repository: hyperswitch // Crate: common_utils // Purpose: Utility functions shared across crates // Module: crates/common_utils/src/id_type/authentication // Implementation of None for crate::events::ApiEventMetric fn get_api_event_type(&self) -> Option<crate::events::ApiEventsType> { Some(crate::events::ApiEventsType::Authentication { authentication_id: self.1.clone(), }) }
{ "crate": "common_utils", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 28, "total_crates": null }
fn_clm_common_utils_get_api_event_type_-7151518258781889553
clm
function
// Repository: hyperswitch // Crate: common_utils // Purpose: Utility functions shared across crates // Module: crates/common_utils/src/id_type/routing // Implementation of RoutingId for crate::events::ApiEventMetric fn get_api_event_type(&self) -> Option<crate::events::ApiEventsType> { Some(crate::events::ApiEventsType::Routing) }
{ "crate": "common_utils", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 26, "total_crates": null }
fn_clm_common_utils_get_api_event_type_-8295601603310586820
clm
function
// Repository: hyperswitch // Crate: common_utils // Purpose: Utility functions shared across crates // Module: crates/common_utils/src/id_type/api_key // Implementation of None for crate::events::ApiEventMetric fn get_api_event_type(&self) -> Option<crate::events::ApiEventsType> { Some(crate::events::ApiEventsType::ApiKey { key_id: self.1.clone(), }) }
{ "crate": "common_utils", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 28, "total_crates": null }
fn_clm_common_utils_generate_key_id_-8295601603310586820
clm
function
// Repository: hyperswitch // Crate: common_utils // Purpose: Utility functions shared across crates // Module: crates/common_utils/src/id_type/api_key // Inherent implementation for ApiKeyId /// Generate Api Key Id from prefix pub fn generate_key_id(prefix: &'static str) -> Self { Self(crate::generate_ref_id_with_default_length(prefix)) }
{ "crate": "common_utils", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 25, "total_crates": null }
fn_clm_common_utils_from_str_-4448028231025927881
clm
function
// Repository: hyperswitch // Crate: common_utils // Purpose: Utility functions shared across crates // Module: crates/common_utils/src/id_type/relay // Implementation of RelayId for FromStr fn from_str(s: &str) -> Result<Self, Self::Err> { let cow_string = std::borrow::Cow::Owned(s.to_string()); Self::try_from(cow_string) }
{ "crate": "common_utils", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 785, "total_crates": null }
fn_clm_common_utils_try_from_string_8665026993116460444
clm
function
// Repository: hyperswitch // Crate: common_utils // Purpose: Utility functions shared across crates // Module: crates/common_utils/src/id_type/webhook_endpoint // Inherent implementation for WebhookEndpointId /// Get webhook_endpoint id from String pub fn try_from_string(webhook_endpoint_id: String) -> CustomResult<Self, ValidationError> { Self::try_from(std::borrow::Cow::from(webhook_endpoint_id)) }
{ "crate": "common_utils", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 88, "total_crates": null }
fn_clm_common_utils_get_string_repr_8785449087001088396
clm
function
// Repository: hyperswitch // Crate: common_utils // Purpose: Utility functions shared across crates // Module: crates/common_utils/src/id_type/global_id/payment_methods // Inherent implementation for GlobalPaymentMethodId /// Get string representation of the id pub fn get_string_repr(&self) -> &str { self.0.get_string_repr() }
{ "crate": "common_utils", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 1370, "total_crates": null }
fn_clm_common_utils_build_8785449087001088396
clm
function
// Repository: hyperswitch // Crate: common_utils // Purpose: Utility functions shared across crates // Module: crates/common_utils/src/id_type/global_id/payment_methods // Implementation of GlobalPaymentMethodSessionId for diesel::Queryable<diesel::sql_types::Text, DB> fn build(row: Self::Row) -> diesel::deserialize::Result<Self> { Ok(row) }
{ "crate": "common_utils", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 572, "total_crates": null }
fn_clm_common_utils_generate_8785449087001088396
clm
function
// Repository: hyperswitch // Crate: common_utils // Purpose: Utility functions shared across crates // Module: crates/common_utils/src/id_type/global_id/payment_methods // Inherent implementation for GlobalPaymentMethodId /// Create a new GlobalPaymentMethodId from cell id information pub fn generate(cell_id: &CellId) -> error_stack::Result<Self, GlobalPaymentMethodIdError> { let global_id = GlobalId::generate(cell_id, GlobalEntity::PaymentMethod); Ok(Self(global_id)) }
{ "crate": "common_utils", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 145, "total_crates": null }
fn_clm_common_utils_to_sql_8785449087001088396
clm
function
// Repository: hyperswitch // Crate: common_utils // Purpose: Utility functions shared across crates // Module: crates/common_utils/src/id_type/global_id/payment_methods // Implementation of GlobalPaymentMethodSessionId for diesel::serialize::ToSql<diesel::sql_types::Text, DB> fn to_sql<'b>( &'b self, out: &mut diesel::serialize::Output<'b, '_, DB>, ) -> diesel::serialize::Result { self.0.to_sql(out) }
{ "crate": "common_utils", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 100, "total_crates": null }
fn_clm_common_utils_from_sql_8785449087001088396
clm
function
// Repository: hyperswitch // Crate: common_utils // Purpose: Utility functions shared across crates // Module: crates/common_utils/src/id_type/global_id/payment_methods // Implementation of GlobalPaymentMethodSessionId for diesel::deserialize::FromSql<diesel::sql_types::Text, DB> fn from_sql(value: DB::RawValue<'_>) -> diesel::deserialize::Result<Self> { let global_id = GlobalId::from_sql(value)?; Ok(Self(global_id)) }
{ "crate": "common_utils", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 54, "total_crates": null }
fn_clm_common_utils_try_from_9007851615587624735
clm
function
// Repository: hyperswitch // Crate: common_utils // Purpose: Utility functions shared across crates // Module: crates/common_utils/src/id_type/global_id/refunds // Implementation of GlobalRefundId for TryFrom<std::borrow::Cow<'static, str>> fn try_from(value: std::borrow::Cow<'static, str>) -> Result<Self, Self::Error> { let merchant_ref_id = super::GlobalId::from_string(value).change_context( errors::ValidationError::IncorrectValueProvided { field_name: "refund_id", }, )?; Ok(Self(merchant_ref_id)) }
{ "crate": "common_utils", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 2663, "total_crates": null }
fn_clm_common_utils_get_string_repr_9007851615587624735
clm
function
// Repository: hyperswitch // Crate: common_utils // Purpose: Utility functions shared across crates // Module: crates/common_utils/src/id_type/global_id/refunds // Inherent implementation for GlobalRefundId /// Get string representation of the id pub fn get_string_repr(&self) -> &str { self.0.get_string_repr() }
{ "crate": "common_utils", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 1370, "total_crates": null }
fn_clm_common_utils_generate_9007851615587624735
clm
function
// Repository: hyperswitch // Crate: common_utils // Purpose: Utility functions shared across crates // Module: crates/common_utils/src/id_type/global_id/refunds // Inherent implementation for GlobalRefundId /// Generate a new GlobalRefundId from a cell id pub fn generate(cell_id: &crate::id_type::CellId) -> Self { let global_id = super::GlobalId::generate(cell_id, super::GlobalEntity::Refund); Self(global_id) }
{ "crate": "common_utils", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 145, "total_crates": null }
fn_clm_common_utils_to_sql_9007851615587624735
clm
function
// Repository: hyperswitch // Crate: common_utils // Purpose: Utility functions shared across crates // Module: crates/common_utils/src/id_type/global_id/refunds // Implementation of GlobalRefundId for diesel::serialize::ToSql<diesel::sql_types::Text, DB> fn to_sql<'b>( &'b self, out: &mut diesel::serialize::Output<'b, '_, DB>, ) -> diesel::serialize::Result { self.0.to_sql(out) }
{ "crate": "common_utils", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 100, "total_crates": null }
fn_clm_common_utils_from_sql_9007851615587624735
clm
function
// Repository: hyperswitch // Crate: common_utils // Purpose: Utility functions shared across crates // Module: crates/common_utils/src/id_type/global_id/refunds // Implementation of GlobalRefundId for diesel::deserialize::FromSql<diesel::sql_types::Text, DB> fn from_sql(value: DB::RawValue<'_>) -> diesel::deserialize::Result<Self> { super::GlobalId::from_sql(value).map(Self) }
{ "crate": "common_utils", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 54, "total_crates": null }
fn_clm_common_utils_get_string_repr_-3248086116173448559
clm
function
// Repository: hyperswitch // Crate: common_utils // Purpose: Utility functions shared across crates // Module: crates/common_utils/src/id_type/global_id/token // Inherent implementation for GlobalTokenId /// Get string representation of the id pub fn get_string_repr(&self) -> &str { self.0.get_string_repr() }
{ "crate": "common_utils", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 1370, "total_crates": null }
fn_clm_common_utils_generate_-3248086116173448559
clm
function
// Repository: hyperswitch // Crate: common_utils // Purpose: Utility functions shared across crates // Module: crates/common_utils/src/id_type/global_id/token // Inherent implementation for GlobalTokenId /// Generate a new GlobalTokenId from a cell id pub fn generate(cell_id: &crate::id_type::CellId) -> Self { let global_id = super::GlobalId::generate(cell_id, super::GlobalEntity::Token); Self(global_id) }
{ "crate": "common_utils", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 145, "total_crates": null }
fn_clm_common_utils_from_string_-3248086116173448559
clm
function
// Repository: hyperswitch // Crate: common_utils // Purpose: Utility functions shared across crates // Module: crates/common_utils/src/id_type/global_id/token // Inherent implementation for GlobalTokenId ///Get GlobalTokenId from a string pub fn from_string(token_string: &str) -> CustomResult<Self, ValidationError> { let token = super::GlobalId::from_string(Cow::Owned(token_string.to_string())) .change_context(ValidationError::IncorrectValueProvided { field_name: "GlobalTokenId", })?; Ok(Self(token)) }
{ "crate": "common_utils", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 88, "total_crates": null }
fn_clm_common_utils_get_api_event_type_-3248086116173448559
clm
function
// Repository: hyperswitch // Crate: common_utils // Purpose: Utility functions shared across crates // Module: crates/common_utils/src/id_type/global_id/token // Implementation of GlobalTokenId for crate::events::ApiEventMetric fn get_api_event_type(&self) -> Option<crate::events::ApiEventsType> { Some(crate::events::ApiEventsType::Token { token_id: Some(self.clone()), }) }
{ "crate": "common_utils", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 28, "total_crates": null }
fn_clm_common_utils_try_from_-8013628068853010409
clm
function
// Repository: hyperswitch // Crate: common_utils // Purpose: Utility functions shared across crates // Module: crates/common_utils/src/id_type/global_id/payment // Implementation of GlobalAttemptId for TryFrom<std::borrow::Cow<'static, str>> fn try_from(value: std::borrow::Cow<'static, str>) -> Result<Self, Self::Error> { let global_attempt_id = super::GlobalId::from_string(value).change_context( errors::ValidationError::IncorrectValueProvided { field_name: "payment_id", }, )?; Ok(Self(global_attempt_id)) }
{ "crate": "common_utils", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 2663, "total_crates": null }
fn_clm_common_utils_get_string_repr_-8013628068853010409
clm
function
// Repository: hyperswitch // Crate: common_utils // Purpose: Utility functions shared across crates // Module: crates/common_utils/src/id_type/global_id/payment // Implementation of None for GlobalAttemptId /// Get string representation of the id pub fn get_string_repr(&self) -> &str { self.0.get_string_repr() }
{ "crate": "common_utils", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 1370, "total_crates": null }
fn_clm_common_utils_generate_-8013628068853010409
clm
function
// Repository: hyperswitch // Crate: common_utils // Purpose: Utility functions shared across crates // Module: crates/common_utils/src/id_type/global_id/payment // Implementation of None for GlobalAttemptId /// Generate a new GlobalAttemptId from a cell id pub fn generate(cell_id: &super::CellId) -> Self { let global_id = super::GlobalId::generate(cell_id, super::GlobalEntity::Attempt); Self(global_id) }
{ "crate": "common_utils", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 145, "total_crates": null }
fn_clm_common_utils_get_execute_revenue_recovery_id_-8013628068853010409
clm
function
// Repository: hyperswitch // Crate: common_utils // Purpose: Utility functions shared across crates // Module: crates/common_utils/src/id_type/global_id/payment // Implementation of None for GlobalPaymentId /// Generate the id for revenue recovery Execute PT workflow pub fn get_execute_revenue_recovery_id( &self, task: &str, runner: enums::ProcessTrackerRunner, ) -> String { format!("{runner}_{task}_{}", self.get_string_repr()) }
{ "crate": "common_utils", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 27, "total_crates": null }
fn_clm_common_utils_get_psync_revenue_recovery_id_-8013628068853010409
clm
function
// Repository: hyperswitch // Crate: common_utils // Purpose: Utility functions shared across crates // Module: crates/common_utils/src/id_type/global_id/payment // Implementation of None for GlobalAttemptId /// Generate the id for Revenue Recovery Psync PT workflow pub fn get_psync_revenue_recovery_id( &self, task: &str, runner: enums::ProcessTrackerRunner, ) -> String { format!("{runner}_{task}_{}", self.get_string_repr()) }
{ "crate": "common_utils", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 27, "total_crates": null }
fn_clm_common_utils_try_from_2579767162077166762
clm
function
// Repository: hyperswitch // Crate: common_utils // Purpose: Utility functions shared across crates // Module: crates/common_utils/src/id_type/global_id/customer // Implementation of crate::id_type::CustomerId for TryFrom<GlobalCustomerId> fn try_from(value: GlobalCustomerId) -> Result<Self, Self::Error> { Self::try_from(std::borrow::Cow::from(value.get_string_repr().to_owned())) }
{ "crate": "common_utils", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 2665, "total_crates": null }
fn_clm_common_utils_get_string_repr_2579767162077166762
clm
function
// Repository: hyperswitch // Crate: common_utils // Purpose: Utility functions shared across crates // Module: crates/common_utils/src/id_type/global_id/customer // Inherent implementation for GlobalCustomerId /// Get string representation of the id pub fn get_string_repr(&self) -> &str { self.0.get_string_repr() }
{ "crate": "common_utils", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 1370, "total_crates": null }
fn_clm_common_utils_generate_2579767162077166762
clm
function
// Repository: hyperswitch // Crate: common_utils // Purpose: Utility functions shared across crates // Module: crates/common_utils/src/id_type/global_id/customer // Inherent implementation for GlobalCustomerId /// Generate a new GlobalCustomerId from a cell id pub fn generate(cell_id: &crate::id_type::CellId) -> Self { let global_id = super::GlobalId::generate(cell_id, super::GlobalEntity::Customer); Self(global_id) }
{ "crate": "common_utils", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 145, "total_crates": null }
fn_clm_common_utils_get_api_event_type_2579767162077166762
clm
function
// Repository: hyperswitch // Crate: common_utils // Purpose: Utility functions shared across crates // Module: crates/common_utils/src/id_type/global_id/customer // Implementation of GlobalCustomerId for crate::events::ApiEventMetric fn get_api_event_type(&self) -> Option<crate::events::ApiEventsType> { Some(crate::events::ApiEventsType::Customer { customer_id: Some(self.clone()), }) }
{ "crate": "common_utils", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 28, "total_crates": null }
fn_clm_hyperswitch_domain_models_from_-7164040261352528320
clm
function
// Repository: hyperswitch // Crate: hyperswitch_domain_models // Purpose: Business logic data models bridging API and database layers // Module: crates/hyperswitch_domain_models/src/tokenization // Implementation of diesel_models::tokenization::TokenizationUpdateInternal for From<TokenizationUpdate> fn from(value: TokenizationUpdate) -> Self { let now = date_time::now(); match value { TokenizationUpdate::DeleteTokenizationRecordUpdate { flag } => Self { updated_at: now, flag, }, } }
{ "crate": "hyperswitch_domain_models", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 2602, "total_crates": null }
fn_clm_hyperswitch_domain_models_convert_-7164040261352528320
clm
function
// Repository: hyperswitch // Crate: hyperswitch_domain_models // Purpose: Business logic data models bridging API and database layers // Module: crates/hyperswitch_domain_models/src/tokenization // Implementation of Tokenization for super::behaviour::Conversion async fn convert(self) -> CustomResult<Self::DstType, ValidationError> { Ok(diesel_models::tokenization::Tokenization { id: self.id, merchant_id: self.merchant_id, customer_id: self.customer_id, locker_id: self.locker_id, created_at: self.created_at, updated_at: self.updated_at, version: self.version, flag: self.flag, }) }
{ "crate": "hyperswitch_domain_models", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 362, "total_crates": null }
fn_clm_hyperswitch_domain_models_convert_back_-7164040261352528320
clm
function
// Repository: hyperswitch // Crate: hyperswitch_domain_models // Purpose: Business logic data models bridging API and database layers // Module: crates/hyperswitch_domain_models/src/tokenization // Implementation of Tokenization for super::behaviour::Conversion async fn convert_back( _state: &keymanager::KeyManagerState, item: Self::DstType, _key: &Secret<Vec<u8>>, _key_manager_identifier: keymanager::Identifier, ) -> CustomResult<Self, ValidationError> { Ok(Self { id: item.id, merchant_id: item.merchant_id, customer_id: item.customer_id, locker_id: item.locker_id, created_at: item.created_at, updated_at: item.updated_at, flag: item.flag, version: item.version, }) }
{ "crate": "hyperswitch_domain_models", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 104, "total_crates": null }
fn_clm_hyperswitch_domain_models_is_disabled_-7164040261352528320
clm
function
// Repository: hyperswitch // Crate: hyperswitch_domain_models // Purpose: Business logic data models bridging API and database layers // Module: crates/hyperswitch_domain_models/src/tokenization // Inherent implementation for Tokenization pub fn is_disabled(&self) -> bool { self.flag == common_enums::TokenizationFlag::Disabled }
{ "crate": "hyperswitch_domain_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 51, "total_crates": null }
fn_clm_hyperswitch_domain_models_construct_new_-7164040261352528320
clm
function
// Repository: hyperswitch // Crate: hyperswitch_domain_models // Purpose: Business logic data models bridging API and database layers // Module: crates/hyperswitch_domain_models/src/tokenization // Implementation of Tokenization for super::behaviour::Conversion async fn construct_new(self) -> CustomResult<Self::NewDstType, ValidationError> { Ok(diesel_models::tokenization::Tokenization { id: self.id, merchant_id: self.merchant_id, customer_id: self.customer_id, locker_id: self.locker_id, created_at: self.created_at, updated_at: self.updated_at, version: self.version, flag: self.flag, }) }
{ "crate": "hyperswitch_domain_models", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 14, "total_crates": null }
fn_clm_hyperswitch_domain_models_get_required_value_3304431074113062079
clm
function
// Repository: hyperswitch // Crate: hyperswitch_domain_models // Purpose: Business logic data models bridging API and database layers // Module: crates/hyperswitch_domain_models/src/ext_traits // Implementation of Option<T> for OptionExt<T> fn get_required_value(self, field_name: &'static str) -> DomainResult<T> { match self { Some(v) => Ok(v), None => Err(error_stack::Report::new( api_error_response::ApiErrorResponse::MissingRequiredField { field_name }, ) .attach_printable(format!("Missing required field {field_name}"))), } }
{ "crate": "hyperswitch_domain_models", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 936, "total_crates": null }
fn_clm_hyperswitch_domain_models_parse_value_3304431074113062079
clm
function
// Repository: hyperswitch // Crate: hyperswitch_domain_models // Purpose: Business logic data models bridging API and database layers // Module: crates/hyperswitch_domain_models/src/ext_traits // Implementation of Option<T> for OptionExt<T> fn parse_value<U>(self, type_name: &'static str) -> CustomResult<U, errors::ParsingError> where T: ValueExt, U: serde::de::DeserializeOwned, { let value = self .get_required_value(type_name) .change_context(errors::ParsingError::UnknownError)?; value.parse_value(type_name) }
{ "crate": "hyperswitch_domain_models", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 479, "total_crates": null }
fn_clm_hyperswitch_domain_models_parse_enum_3304431074113062079
clm
function
// Repository: hyperswitch // Crate: hyperswitch_domain_models // Purpose: Business logic data models bridging API and database layers // Module: crates/hyperswitch_domain_models/src/ext_traits // Implementation of Option<T> for OptionExt<T> fn parse_enum<E>(self, enum_name: &'static str) -> CustomResult<E, errors::ParsingError> where T: AsRef<str>, E: std::str::FromStr, <E as std::str::FromStr>::Err: std::error::Error + Send + Sync + 'static, { let value = self .get_required_value(enum_name) .change_context(errors::ParsingError::UnknownError)?; E::from_str(value.as_ref()) .change_context(errors::ParsingError::UnknownError) .attach_printable_lazy(|| format!("Invalid {{ {enum_name} }} ")) }
{ "crate": "hyperswitch_domain_models", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 59, "total_crates": null }
fn_clm_hyperswitch_domain_models_check_value_present_3304431074113062079
clm
function
// Repository: hyperswitch // Crate: hyperswitch_domain_models // Purpose: Business logic data models bridging API and database layers // Module: crates/hyperswitch_domain_models/src/ext_traits // Implementation of Option<T> for OptionExt<T> fn check_value_present(&self, field_name: &'static str) -> DomainResult<()> { when(self.is_none(), || { Err(error_stack::Report::new( api_error_response::ApiErrorResponse::MissingRequiredField { field_name }, ) .attach_printable(format!("Missing required field {field_name}"))) }) }
{ "crate": "hyperswitch_domain_models", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 22, "total_crates": null }
fn_clm_hyperswitch_domain_models_update_value_3304431074113062079
clm
function
// Repository: hyperswitch // Crate: hyperswitch_domain_models // Purpose: Business logic data models bridging API and database layers // Module: crates/hyperswitch_domain_models/src/ext_traits // Implementation of Option<T> for OptionExt<T> fn update_value(&mut self, value: Self) { if let Some(a) = value { *self = Some(a) } }
{ "crate": "hyperswitch_domain_models", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 11, "total_crates": null }
fn_clm_hyperswitch_domain_models_try_from_3282670415152624300
clm
function
// Repository: hyperswitch // Crate: hyperswitch_domain_models // Purpose: Business logic data models bridging API and database layers // Module: crates/hyperswitch_domain_models/src/router_request_types // Implementation of AccessTokenRequestData for TryFrom<( router_data::ConnectorAuthType, Option<AccessTokenAuthenticationResponse>, )> fn try_from( (connector_auth, authentication_token): ( router_data::ConnectorAuthType, Option<AccessTokenAuthenticationResponse>, ), ) -> Result<Self, Self::Error> { let mut access_token_request_data = Self::try_from(connector_auth)?; access_token_request_data.authentication_token = authentication_token; Ok(access_token_request_data) }
{ "crate": "hyperswitch_domain_models", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 2659, "total_crates": null }
fn_clm_hyperswitch_domain_models_from_3282670415152624300
clm
function
// Repository: hyperswitch // Crate: hyperswitch_domain_models // Purpose: Business logic data models bridging API and database layers // Module: crates/hyperswitch_domain_models/src/router_request_types // Implementation of SurchargeDetails for From<( &RequestSurchargeDetails, &payments::payment_attempt::PaymentAttempt, )> fn from( (_request_surcharge_details, _payment_attempt): ( &RequestSurchargeDetails, &payments::payment_attempt::PaymentAttempt, ), ) -> Self { todo!() }
{ "crate": "hyperswitch_domain_models", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 2600, "total_crates": null }
fn_clm_hyperswitch_domain_models_get_connector_transaction_id_3282670415152624300
clm
function
// Repository: hyperswitch // Crate: hyperswitch_domain_models // Purpose: Business logic data models bridging API and database layers // Module: crates/hyperswitch_domain_models/src/router_request_types // Inherent implementation for ResponseId pub fn get_connector_transaction_id( &self, ) -> errors::CustomResult<String, errors::ValidationError> { match self { Self::ConnectorTransactionId(txn_id) => Ok(txn_id.to_string()), _ => Err(errors::ValidationError::IncorrectValueProvided { field_name: "connector_transaction_id", }) .attach_printable("Expected connector transaction ID not found"), } }
{ "crate": "hyperswitch_domain_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 1273, "total_crates": null }
fn_clm_hyperswitch_domain_models_get_total_surcharge_amount_3282670415152624300
clm
function
// Repository: hyperswitch // Crate: hyperswitch_domain_models // Purpose: Business logic data models bridging API and database layers // Module: crates/hyperswitch_domain_models/src/router_request_types // Inherent implementation for SurchargeDetails pub fn get_total_surcharge_amount(&self) -> MinorUnit { self.surcharge_amount + self.tax_on_surcharge_amount }
{ "crate": "hyperswitch_domain_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 33, "total_crates": null }
fn_clm_hyperswitch_domain_models_new_-3534388213536739833
clm
function
// Repository: hyperswitch // Crate: hyperswitch_domain_models // Purpose: Business logic data models bridging API and database layers // Module: crates/hyperswitch_domain_models/src/callback_mapper // Inherent implementation for CallbackMapper pub fn new( id: String, callback_mapper_id_type: common_enums::CallbackMapperIdType, data: CallbackMapperData, created_at: time::PrimitiveDateTime, last_modified_at: time::PrimitiveDateTime, ) -> Self { Self { id, callback_mapper_id_type, data, created_at, last_modified_at, } }
{ "crate": "hyperswitch_domain_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 14463, "total_crates": null }
fn_clm_hyperswitch_domain_models_try_from_9126787093276951243
clm
function
// Repository: hyperswitch // Crate: hyperswitch_domain_models // Purpose: Business logic data models bridging API and database layers // Module: crates/hyperswitch_domain_models/src/payment_methods // Implementation of PaymentMethodVaultSourceDetails for TryFrom<( Option<storage_enums::VaultType>, Option<id_type::MerchantConnectorAccountId>, )> fn try_from( value: ( Option<storage_enums::VaultType>, Option<id_type::MerchantConnectorAccountId>, ), ) -> Result<Self, Self::Error> { match value { (Some(storage_enums::VaultType::External), Some(external_vault_source)) => { Ok(Self::ExternalVault { external_vault_source, }) } (Some(storage_enums::VaultType::External), None) => { Err(ValidationError::MissingRequiredField { field_name: "external vault mca id".to_string(), } .into()) } (Some(storage_enums::VaultType::Internal), _) | (None, _) => Ok(Self::InternalVault), // defaulting to internal vault if vault type is none } }
{ "crate": "hyperswitch_domain_models", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 2661, "total_crates": null }
fn_clm_hyperswitch_domain_models_from_9126787093276951243
clm
function
// Repository: hyperswitch // Crate: hyperswitch_domain_models // Purpose: Business logic data models bridging API and database layers // Module: crates/hyperswitch_domain_models/src/payment_methods // Implementation of None for From<PaymentMethodVaultSourceDetails> fn from(value: PaymentMethodVaultSourceDetails) -> Self { match value { PaymentMethodVaultSourceDetails::ExternalVault { external_vault_source, } => ( Some(storage_enums::VaultType::External), Some(external_vault_source), ), PaymentMethodVaultSourceDetails::InternalVault => { (Some(storage_enums::VaultType::Internal), None) } } }
{ "crate": "hyperswitch_domain_models", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 2600, "total_crates": null }
fn_clm_hyperswitch_domain_models_get_id_9126787093276951243
clm
function
// Repository: hyperswitch // Crate: hyperswitch_domain_models // Purpose: Business logic data models bridging API and database layers // Module: crates/hyperswitch_domain_models/src/payment_methods // Inherent implementation for PaymentMethod pub fn get_id(&self) -> &id_type::GlobalPaymentMethodId { &self.id }
{ "crate": "hyperswitch_domain_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 2472, "total_crates": null }
fn_clm_hyperswitch_domain_models_get_string_repr_9126787093276951243
clm
function
// Repository: hyperswitch // Crate: hyperswitch_domain_models // Purpose: Business logic data models bridging API and database layers // Module: crates/hyperswitch_domain_models/src/payment_methods // Inherent implementation for VaultId pub fn get_string_repr(&self) -> &String { &self.0 }
{ "crate": "hyperswitch_domain_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 1368, "total_crates": null }
fn_clm_hyperswitch_domain_models_foreign_try_from_9126787093276951243
clm
function
// Repository: hyperswitch // Crate: hyperswitch_domain_models // Purpose: Business logic data models bridging API and database layers // Module: crates/hyperswitch_domain_models/src/payment_methods // Implementation of Vec<PaymentMethodCustomerMigrate> for ForeignTryFrom<(&[payment_methods::PaymentMethodRecord], id_type::MerchantId)> fn foreign_try_from( (records, merchant_id): (&[payment_methods::PaymentMethodRecord], id_type::MerchantId), ) -> Result<Self, Self::Error> { let (customers_migration, migration_errors): (Self, Vec<_>) = records .iter() .map(|record| { PaymentMethodCustomerMigrate::try_from((record.clone(), merchant_id.clone())) }) .fold((Self::new(), Vec::new()), |mut acc, result| { match result { Ok(customer) => acc.0.push(customer), Err(e) => acc.1.push(e.to_string()), } acc }); migration_errors .is_empty() .then_some(customers_migration) .ok_or_else(|| { error_stack::report!(ValidationError::InvalidValue { message: migration_errors.join(", "), }) }) }
{ "crate": "hyperswitch_domain_models", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 456, "total_crates": null }
fn_clm_hyperswitch_domain_models_try_from_172795816528281465
clm
function
// Repository: hyperswitch // Crate: hyperswitch_domain_models // Purpose: Business logic data models bridging API and database layers // Module: crates/hyperswitch_domain_models/src/refunds // Implementation of RefundListConstraints for TryFrom<( api_models::refunds::RefundListRequest, Option<Vec<common_utils::id_type::ProfileId>>, )> fn try_from( (value, auth_profile_id_list): ( api_models::refunds::RefundListRequest, Option<Vec<common_utils::id_type::ProfileId>>, ), ) -> Result<Self, Self::Error> { let api_models::refunds::RefundListRequest { connector, currency, refund_status, payment_id, refund_id, profile_id, limit, offset, time_range, amount_filter, merchant_connector_id, } = value; let profile_id_from_request_body = profile_id; let profile_id_list = match (profile_id_from_request_body, auth_profile_id_list) { (None, None) => None, (None, Some(auth_profile_id_list)) => Some(auth_profile_id_list), (Some(profile_id_from_request_body), None) => Some(vec![profile_id_from_request_body]), (Some(profile_id_from_request_body), Some(auth_profile_id_list)) => { let profile_id_from_request_body_is_available_in_auth_profile_id_list = auth_profile_id_list.contains(&profile_id_from_request_body); if profile_id_from_request_body_is_available_in_auth_profile_id_list { Some(vec![profile_id_from_request_body]) } else { // This scenario is very unlikely to happen return Err(error_stack::Report::new( errors::api_error_response::ApiErrorResponse::PreconditionFailed { message: format!( "Access not available for the given profile_id {profile_id_from_request_body:?}", ), }, )); } } }; Ok(Self { payment_id, refund_id, profile_id: profile_id_list, limit, offset, time_range, amount_filter, connector, merchant_connector_id, currency, refund_status, }) }
{ "crate": "hyperswitch_domain_models", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 2661, "total_crates": null }
fn_clm_hyperswitch_domain_models_from_172795816528281465
clm
function
// Repository: hyperswitch // Crate: hyperswitch_domain_models // Purpose: Business logic data models bridging API and database layers // Module: crates/hyperswitch_domain_models/src/refunds // Implementation of RefundListConstraints for From<(api_models::refunds::RefundListRequest, Profile)> fn from((value, profile): (api_models::refunds::RefundListRequest, Profile)) -> Self { let api_models::refunds::RefundListRequest { payment_id, refund_id, connector, currency, refund_status, limit, offset, time_range, amount_filter, connector_id_list, } = value; Self { payment_id, refund_id, profile_id: profile.get_id().to_owned(), limit, offset, time_range, amount_filter, connector, connector_id_list, currency, refund_status, } }
{ "crate": "hyperswitch_domain_models", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 2604, "total_crates": null }
fn_clm_hyperswitch_domain_models_new_-8652190558152331731
clm
function
// Repository: hyperswitch // Crate: hyperswitch_domain_models // Purpose: Business logic data models bridging API and database layers // Module: crates/hyperswitch_domain_models/src/payment_address // Inherent implementation for PaymentAddress pub fn new( shipping: Option<Address>, billing: Option<Address>, payment_method_billing: Option<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 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, billing, unified_payment_method_billing, payment_method_billing, } }
{ "crate": "hyperswitch_domain_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 14481, "total_crates": null }
fn_clm_hyperswitch_domain_models_get_payment_method_billing_-8652190558152331731
clm
function
// Repository: hyperswitch // Crate: hyperswitch_domain_models // Purpose: Business logic data models bridging API and database layers // Module: crates/hyperswitch_domain_models/src/payment_address // Inherent implementation for PaymentAddress pub fn get_payment_method_billing(&self) -> Option<&Address> { self.unified_payment_method_billing.as_ref() }
{ "crate": "hyperswitch_domain_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 176, "total_crates": null }
fn_clm_hyperswitch_domain_models_get_shipping_-8652190558152331731
clm
function
// Repository: hyperswitch // Crate: hyperswitch_domain_models // Purpose: Business logic data models bridging API and database layers // Module: crates/hyperswitch_domain_models/src/payment_address // Inherent implementation for PaymentAddress pub fn get_shipping(&self) -> Option<&Address> { self.shipping.as_ref() }
{ "crate": "hyperswitch_domain_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 119, "total_crates": null }
fn_clm_hyperswitch_domain_models_unify_with_payment_method_data_billing_-8652190558152331731
clm
function
// Repository: hyperswitch // Crate: hyperswitch_domain_models // Purpose: Business logic data models bridging API and database layers // Module: crates/hyperswitch_domain_models/src/payment_address // Inherent implementation for PaymentAddress /// Unify the billing details from `payment_method_data.[payment_method_data].billing details`. /// Here the fields passed in payment_method_data_billing takes precedence pub fn unify_with_payment_method_data_billing( self, payment_method_data_billing: Option<Address>, ) -> Self { // Unify the billing details with `payment_method_data.billing_details` let unified_payment_method_billing = payment_method_data_billing .map(|payment_method_data_billing| { payment_method_data_billing.unify_address(self.get_payment_method_billing()) }) .or(self.get_payment_method_billing().cloned()); Self { shipping: self.shipping, billing: self.billing, unified_payment_method_billing, payment_method_billing: self.payment_method_billing, } }
{ "crate": "hyperswitch_domain_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 36, "total_crates": null }
fn_clm_hyperswitch_domain_models_unify_with_payment_data_billing_-8652190558152331731
clm
function
// Repository: hyperswitch // Crate: hyperswitch_domain_models // Purpose: Business logic data models bridging API and database layers // Module: crates/hyperswitch_domain_models/src/payment_address // Inherent implementation for PaymentAddress /// Unify the billing details from `payment_method_data.[payment_method_data].billing details`. /// Here the `self` takes precedence pub fn unify_with_payment_data_billing( self, other_payment_method_billing: Option<Address>, ) -> Self { let unified_payment_method_billing = self .get_payment_method_billing() .map(|payment_method_billing| { payment_method_billing .clone() .unify_address(other_payment_method_billing.as_ref()) }) .or(other_payment_method_billing); Self { shipping: self.shipping, billing: self.billing, unified_payment_method_billing, payment_method_billing: self.payment_method_billing, } }
{ "crate": "hyperswitch_domain_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 36, "total_crates": null }
fn_clm_hyperswitch_domain_models_from_-8614741292085815863
clm
function
// Repository: hyperswitch // Crate: hyperswitch_domain_models // Purpose: Business logic data models bridging API and database layers // Module: crates/hyperswitch_domain_models/src/merchant_account // Implementation of MerchantAccountUpdateInternal for From<MerchantAccountUpdate> fn from(merchant_account_update: MerchantAccountUpdate) -> Self { let now = date_time::now(); match merchant_account_update { MerchantAccountUpdate::Update { merchant_name, merchant_details, publishable_key, metadata, } => Self { merchant_name: merchant_name.map(Encryption::from), merchant_details: merchant_details.map(Encryption::from), publishable_key, metadata: metadata.map(|metadata| *metadata), modified_at: now, storage_scheme: None, organization_id: None, recon_status: None, is_platform_account: None, product_type: None, }, MerchantAccountUpdate::StorageSchemeUpdate { storage_scheme } => Self { storage_scheme: Some(storage_scheme), modified_at: now, merchant_name: None, merchant_details: None, publishable_key: None, metadata: None, organization_id: None, recon_status: None, is_platform_account: None, product_type: None, }, MerchantAccountUpdate::ReconUpdate { recon_status } => Self { recon_status: Some(recon_status), modified_at: now, merchant_name: None, merchant_details: None, publishable_key: None, storage_scheme: None, metadata: None, organization_id: None, is_platform_account: None, product_type: None, }, MerchantAccountUpdate::ModifiedAtUpdate => Self { modified_at: now, merchant_name: None, merchant_details: None, publishable_key: None, storage_scheme: None, metadata: None, organization_id: None, recon_status: None, is_platform_account: None, product_type: None, }, MerchantAccountUpdate::ToPlatformAccount => Self { modified_at: now, merchant_name: None, merchant_details: None, publishable_key: None, storage_scheme: None, metadata: None, organization_id: None, recon_status: None, is_platform_account: Some(true), product_type: None, }, } }
{ "crate": "hyperswitch_domain_models", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 2608, "total_crates": null }
fn_clm_hyperswitch_domain_models_get_id_-8614741292085815863
clm
function
// Repository: hyperswitch // Crate: hyperswitch_domain_models // Purpose: Business logic data models bridging API and database layers // Module: crates/hyperswitch_domain_models/src/merchant_account // Inherent implementation for MerchantAccount /// Get the unique identifier of MerchantAccount pub fn get_id(&self) -> &common_utils::id_type::MerchantId { &self.id }
{ "crate": "hyperswitch_domain_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 2472, "total_crates": null }
fn_clm_hyperswitch_domain_models_convert_-8614741292085815863
clm
function
// Repository: hyperswitch // Crate: hyperswitch_domain_models // Purpose: Business logic data models bridging API and database layers // Module: crates/hyperswitch_domain_models/src/merchant_account // Implementation of MerchantAccount for Conversion async fn convert(self) -> CustomResult<Self::DstType, ValidationError> { let setter = diesel_models::merchant_account::MerchantAccountSetter { merchant_id: self.merchant_id, return_url: self.return_url, enable_payment_response_hash: self.enable_payment_response_hash, payment_response_hash_key: self.payment_response_hash_key, redirect_to_merchant_with_http_post: self.redirect_to_merchant_with_http_post, merchant_name: self.merchant_name.map(|name| name.into()), merchant_details: self.merchant_details.map(|details| details.into()), webhook_details: self.webhook_details, sub_merchants_enabled: self.sub_merchants_enabled, parent_merchant_id: self.parent_merchant_id, publishable_key: Some(self.publishable_key), storage_scheme: self.storage_scheme, locker_id: self.locker_id, metadata: self.metadata, routing_algorithm: self.routing_algorithm, primary_business_details: self.primary_business_details, created_at: self.created_at, modified_at: self.modified_at, intent_fulfillment_time: self.intent_fulfillment_time, frm_routing_algorithm: self.frm_routing_algorithm, payout_routing_algorithm: self.payout_routing_algorithm, organization_id: self.organization_id, is_recon_enabled: self.is_recon_enabled, default_profile: self.default_profile, recon_status: self.recon_status, payment_link_config: self.payment_link_config, pm_collect_link_config: self.pm_collect_link_config, version: self.version, is_platform_account: self.is_platform_account, product_type: self.product_type, merchant_account_type: self.merchant_account_type, }; Ok(diesel_models::MerchantAccount::from(setter)) }
{ "crate": "hyperswitch_domain_models", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 372, "total_crates": null }
fn_clm_hyperswitch_domain_models_get_org_id_-8614741292085815863
clm
function
// Repository: hyperswitch // Crate: hyperswitch_domain_models // Purpose: Business logic data models bridging API and database layers // Module: crates/hyperswitch_domain_models/src/merchant_account // Inherent implementation for MerchantAccount /// Get the organization_id from MerchantAccount pub fn get_org_id(&self) -> &common_utils::id_type::OrganizationId { &self.organization_id }
{ "crate": "hyperswitch_domain_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 162, "total_crates": null }
fn_clm_hyperswitch_domain_models_convert_back_-8614741292085815863
clm
function
// Repository: hyperswitch // Crate: hyperswitch_domain_models // Purpose: Business logic data models bridging API and database layers // Module: crates/hyperswitch_domain_models/src/merchant_account // Implementation of MerchantAccount for Conversion async fn convert_back( state: &keymanager::KeyManagerState, item: Self::DstType, key: &Secret<Vec<u8>>, key_manager_identifier: keymanager::Identifier, ) -> CustomResult<Self, ValidationError> where Self: Sized, { let merchant_id = item.get_id().to_owned(); let publishable_key = item.publishable_key .ok_or(ValidationError::MissingRequiredField { field_name: "publishable_key".to_string(), })?; async { Ok::<Self, error_stack::Report<common_utils::errors::CryptoError>>(Self { merchant_id, return_url: item.return_url, enable_payment_response_hash: item.enable_payment_response_hash, payment_response_hash_key: item.payment_response_hash_key, redirect_to_merchant_with_http_post: item.redirect_to_merchant_with_http_post, merchant_name: item .merchant_name .async_lift(|inner| async { crypto_operation( state, type_name!(Self::DstType), CryptoOperation::DecryptOptional(inner), key_manager_identifier.clone(), key.peek(), ) .await .and_then(|val| val.try_into_optionaloperation()) }) .await?, merchant_details: item .merchant_details .async_lift(|inner| async { crypto_operation( state, type_name!(Self::DstType), CryptoOperation::DecryptOptional(inner), key_manager_identifier.clone(), key.peek(), ) .await .and_then(|val| val.try_into_optionaloperation()) }) .await?, webhook_details: item.webhook_details, sub_merchants_enabled: item.sub_merchants_enabled, parent_merchant_id: item.parent_merchant_id, publishable_key, storage_scheme: item.storage_scheme, locker_id: item.locker_id, metadata: item.metadata, routing_algorithm: item.routing_algorithm, frm_routing_algorithm: item.frm_routing_algorithm, primary_business_details: item.primary_business_details, created_at: item.created_at, modified_at: item.modified_at, intent_fulfillment_time: item.intent_fulfillment_time, payout_routing_algorithm: item.payout_routing_algorithm, organization_id: item.organization_id, is_recon_enabled: item.is_recon_enabled, default_profile: item.default_profile, recon_status: item.recon_status, payment_link_config: item.payment_link_config, pm_collect_link_config: item.pm_collect_link_config, version: item.version, is_platform_account: item.is_platform_account, product_type: item.product_type, merchant_account_type: item.merchant_account_type.unwrap_or_default(), }) } .await .change_context(ValidationError::InvalidValue { message: "Failed while decrypting merchant data".to_string(), }) }
{ "crate": "hyperswitch_domain_models", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 146, "total_crates": null }
fn_clm_hyperswitch_domain_models_deref_-5997548289883200385
clm
function
// Repository: hyperswitch // Crate: hyperswitch_domain_models // Purpose: Business logic data models bridging API and database layers // Module: crates/hyperswitch_domain_models/src/router_data_v2 // Implementation of RouterDataV2<Flow, ResourceCommonData, FlowSpecificRequest, FlowSpecificResponse> for Deref fn deref(&self) -> &Self::Target { &self.resource_common_data }
{ "crate": "hyperswitch_domain_models", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 41, "total_crates": null }
fn_clm_hyperswitch_domain_models_from_-6250935193007323762
clm
function
// Repository: hyperswitch // Crate: hyperswitch_domain_models // Purpose: Business logic data models bridging API and database layers // Module: crates/hyperswitch_domain_models/src/payouts // Implementation of PayoutFetchConstraints for From<api_models::payouts::PayoutListFilterConstraints> fn from(value: api_models::payouts::PayoutListFilterConstraints) -> Self { if let Some(payout_id) = value.payout_id { Self::Single { payout_id } } else { Self::List(Box::new(PayoutListParams { offset: value.offset.unwrap_or_default(), starting_at: value.time_range.map(|t| t.start_time), ending_at: value.time_range.and_then(|t| t.end_time), connector: value.connector, currency: value.currency, status: value.status, payout_method: value.payout_method, profile_id: value.profile_id, customer_id: value.customer_id, starting_after_id: None, ending_before_id: None, entity_type: value.entity_type, merchant_order_reference_id: value.merchant_order_reference_id, limit: Some(std::cmp::min( value.limit, consts::PAYOUTS_LIST_MAX_LIMIT_POST, )), })) } }
{ "crate": "hyperswitch_domain_models", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 2612, "total_crates": null }
fn_clm_hyperswitch_domain_models_new_5046766036688905859
clm
function
// Repository: hyperswitch // Crate: hyperswitch_domain_models // Purpose: Business logic data models bridging API and database layers // Module: crates/hyperswitch_domain_models/src/merchant_connector_account // Implementation of None for AccountReferenceMap pub fn new( hash_map: HashMap<id_type::MerchantConnectorAccountId, String>, ) -> Result<Self, api_error_response::ApiErrorResponse> { Self::validate(&hash_map)?; let recovery_to_billing = hash_map.clone(); let mut billing_to_recovery = HashMap::new(); for (key, value) in &hash_map { billing_to_recovery.insert(value.clone(), key.clone()); } Ok(Self { recovery_to_billing, billing_to_recovery, }) }
{ "crate": "hyperswitch_domain_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 14475, "total_crates": null }
fn_clm_hyperswitch_domain_models_from_5046766036688905859
clm
function
// Repository: hyperswitch // Crate: hyperswitch_domain_models // Purpose: Business logic data models bridging API and database layers // Module: crates/hyperswitch_domain_models/src/merchant_connector_account // Implementation of MerchantConnectorAccountFeatureMetadata for From<DieselMerchantConnectorAccountFeatureMetadata> fn from(feature_metadata: DieselMerchantConnectorAccountFeatureMetadata) -> Self { let revenue_recovery = feature_metadata.revenue_recovery.map(|recovery_metadata| { let mut billing_to_recovery = HashMap::new(); for (key, value) in &recovery_metadata.billing_account_reference.0 { billing_to_recovery.insert(value.to_string(), key.clone()); } RevenueRecoveryMetadata { max_retry_count: recovery_metadata.max_retry_count, billing_connector_retry_threshold: recovery_metadata .billing_connector_retry_threshold, mca_reference: AccountReferenceMap { recovery_to_billing: recovery_metadata.billing_account_reference.0, billing_to_recovery, }, } }); Self { revenue_recovery } }
{ "crate": "hyperswitch_domain_models", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 2610, "total_crates": null }
fn_clm_hyperswitch_domain_models_get_id_5046766036688905859
clm
function
// Repository: hyperswitch // Crate: hyperswitch_domain_models // Purpose: Business logic data models bridging API and database layers // Module: crates/hyperswitch_domain_models/src/merchant_connector_account // Inherent implementation for MerchantConnectorAccount pub fn get_id(&self) -> id_type::MerchantConnectorAccountId { self.id.clone() }
{ "crate": "hyperswitch_domain_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 2474, "total_crates": null }
fn_clm_hyperswitch_domain_models_convert_5046766036688905859
clm
function
// Repository: hyperswitch // Crate: hyperswitch_domain_models // Purpose: Business logic data models bridging API and database layers // Module: crates/hyperswitch_domain_models/src/merchant_connector_account // Implementation of MerchantConnectorAccount for behaviour::Conversion async fn convert(self) -> CustomResult<Self::DstType, ValidationError> { Ok(storage::MerchantConnectorAccount { id: self.id, merchant_id: self.merchant_id, connector_name: self.connector_name, connector_account_details: self.connector_account_details.into(), disabled: self.disabled, payment_methods_enabled: self.payment_methods_enabled, connector_type: self.connector_type, metadata: self.metadata, frm_config: self.frm_configs, connector_label: self.connector_label, created_at: self.created_at, modified_at: self.modified_at, connector_webhook_details: self.connector_webhook_details, profile_id: self.profile_id, applepay_verified_domains: self.applepay_verified_domains, pm_auth_config: self.pm_auth_config, status: self.status, connector_wallets_details: self.connector_wallets_details.map(Encryption::from), additional_merchant_data: self.additional_merchant_data.map(|data| data.into()), version: self.version, feature_metadata: self.feature_metadata.map(From::from), }) }
{ "crate": "hyperswitch_domain_models", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 372, "total_crates": null }
fn_clm_hyperswitch_domain_models_validate_5046766036688905859
clm
function
// Repository: hyperswitch // Crate: hyperswitch_domain_models // Purpose: Business logic data models bridging API and database layers // Module: crates/hyperswitch_domain_models/src/merchant_connector_account // Implementation of None for AccountReferenceMap fn validate( hash_map: &HashMap<id_type::MerchantConnectorAccountId, String>, ) -> Result<(), api_error_response::ApiErrorResponse> { let mut seen_values = std::collections::HashSet::new(); // To check uniqueness of values for value in hash_map.values() { if !seen_values.insert(value.clone()) { return Err(api_error_response::ApiErrorResponse::InvalidRequestData { message: "Duplicate account reference IDs found in Recovery feature metadata. Each account reference ID must be unique.".to_string(), }); } } Ok(()) }
{ "crate": "hyperswitch_domain_models", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 219, "total_crates": null }
fn_clm_hyperswitch_domain_models_get_id_713396906110587345
clm
function
// Repository: hyperswitch // Crate: hyperswitch_domain_models // Purpose: Business logic data models bridging API and database layers // Module: crates/hyperswitch_domain_models/src/payments // Inherent implementation for PaymentIntent pub fn get_id(&self) -> &id_type::GlobalPaymentId { &self.id }
{ "crate": "hyperswitch_domain_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 2472, "total_crates": null }
fn_clm_hyperswitch_domain_models_create_domain_model_from_request_713396906110587345
clm
function
// Repository: hyperswitch // Crate: hyperswitch_domain_models // Purpose: Business logic data models bridging API and database layers // Module: crates/hyperswitch_domain_models/src/payments // Inherent implementation for PaymentIntent pub async fn create_domain_model_from_request( payment_id: &id_type::GlobalPaymentId, merchant_context: &merchant_context::MerchantContext, profile: &business_profile::Profile, request: api_models::payments::PaymentsCreateIntentRequest, decrypted_payment_intent: DecryptedPaymentIntent, ) -> CustomResult<Self, errors::api_error_response::ApiErrorResponse> { let request_incremental_authorization = Self::get_request_incremental_authorization_value(&request)?; let allowed_payment_method_types = request.allowed_payment_method_types; let session_expiry = common_utils::date_time::now().saturating_add(time::Duration::seconds( request.session_expiry.map(i64::from).unwrap_or( profile .session_expiry .unwrap_or(common_utils::consts::DEFAULT_SESSION_EXPIRY), ), )); let order_details = request.order_details.map(|order_details| { order_details .into_iter() .map(|order_detail| Secret::new(OrderDetailsWithAmount::convert_from(order_detail))) .collect() }); Ok(Self { id: payment_id.clone(), merchant_id: merchant_context.get_merchant_account().get_id().clone(), // Intent status would be RequiresPaymentMethod because we are creating a new payment intent status: common_enums::IntentStatus::RequiresPaymentMethod, amount_details: AmountDetails::from(request.amount_details), amount_captured: None, customer_id: request.customer_id, description: request.description, return_url: request.return_url, metadata: request.metadata, statement_descriptor: request.statement_descriptor, created_at: common_utils::date_time::now(), modified_at: common_utils::date_time::now(), last_synced: None, setup_future_usage: request.setup_future_usage.unwrap_or_default(), active_attempt_id: None, active_attempt_id_type: common_enums::ActiveAttemptIDType::AttemptID, active_attempts_group_id: None, order_details, allowed_payment_method_types, connector_metadata: request.connector_metadata, feature_metadata: request.feature_metadata.map(FeatureMetadata::convert_from), // Attempt count is 0 in create intent as no attempt is made yet attempt_count: 0, profile_id: profile.get_id().clone(), payment_link_id: None, frm_merchant_decision: None, updated_by: merchant_context .get_merchant_account() .storage_scheme .to_string(), request_incremental_authorization, // Authorization count is 0 in create intent as no authorization is made yet authorization_count: Some(0), session_expiry, request_external_three_ds_authentication: request .request_external_three_ds_authentication .unwrap_or_default(), split_txns_enabled: profile.split_txns_enabled, frm_metadata: request.frm_metadata, customer_details: None, merchant_reference_id: request.merchant_reference_id, billing_address: decrypted_payment_intent .billing_address .as_ref() .map(|data| { data.clone() .deserialize_inner_value(|value| value.parse_value("Address")) }) .transpose() .change_context(errors::api_error_response::ApiErrorResponse::InternalServerError) .attach_printable("Unable to decode billing address")?, shipping_address: decrypted_payment_intent .shipping_address .as_ref() .map(|data| { data.clone() .deserialize_inner_value(|value| value.parse_value("Address")) }) .transpose() .change_context(errors::api_error_response::ApiErrorResponse::InternalServerError) .attach_printable("Unable to decode shipping address")?, capture_method: request.capture_method.unwrap_or_default(), authentication_type: request.authentication_type, prerouting_algorithm: None, organization_id: merchant_context .get_merchant_account() .organization_id .clone(), enable_payment_link: request.payment_link_enabled.unwrap_or_default(), apply_mit_exemption: request.apply_mit_exemption.unwrap_or_default(), customer_present: request.customer_present.unwrap_or_default(), payment_link_config: request .payment_link_config .map(ApiModelToDieselModelConvertor::convert_from), routing_algorithm_id: request.routing_algorithm_id, split_payments: None, force_3ds_challenge: None, force_3ds_challenge_trigger: None, processor_merchant_id: merchant_context.get_merchant_account().get_id().clone(), created_by: None, is_iframe_redirection_enabled: None, is_payment_id_from_merchant: None, enable_partial_authorization: request.enable_partial_authorization, }) }
{ "crate": "hyperswitch_domain_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 148, "total_crates": null }
fn_clm_hyperswitch_domain_models_get_payment_method_type_713396906110587345
clm
function
// Repository: hyperswitch // Crate: hyperswitch_domain_models // Purpose: Business logic data models bridging API and database layers // Module: crates/hyperswitch_domain_models/src/payments // Inherent implementation for PaymentIntent fn get_payment_method_type(&self) -> Option<common_enums::PaymentMethod> { self.feature_metadata .as_ref() .and_then(|metadata| metadata.get_payment_method_type()) }
{ "crate": "hyperswitch_domain_models", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 125, "total_crates": null }
fn_clm_hyperswitch_domain_models_get_updated_feature_metadata_713396906110587345
clm
function
// Repository: hyperswitch // Crate: hyperswitch_domain_models // Purpose: Business logic data models bridging API and database layers // Module: crates/hyperswitch_domain_models/src/payments // Inherent implementation for PaymentAttemptRecordData<F> 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 feature_metadata_first_pg_error_code = revenue_recovery .as_ref() .and_then(|data| data.first_payment_attempt_pg_error_code.clone()); let (first_pg_error_code, first_network_advice_code, first_network_decline_code) = feature_metadata_first_pg_error_code.map_or_else( || { let first_pg_error_code = self .payment_attempt .error .as_ref() .map(|error| error.code.clone()); let first_network_advice_code = self .payment_attempt .error .as_ref() .and_then(|error| error.network_advice_code.clone()); let first_network_decline_code = self .payment_attempt .error .as_ref() .and_then(|error| error.network_decline_code.clone()); ( first_pg_error_code, first_network_advice_code, first_network_decline_code, ) }, |pg_code| { let advice_code = revenue_recovery .as_ref() .and_then(|data| data.first_payment_attempt_network_advice_code.clone()); let decline_code = revenue_recovery .as_ref() .and_then(|data| data.first_payment_attempt_network_decline_code.clone()); (Some(pg_code), advice_code, decline_code) }, ); let billing_connector_payment_method_details = Some( diesel_models::types::BillingConnectorPaymentMethodDetails::Card( diesel_models::types::BillingConnectorAdditionalCardInfo { card_network: self.revenue_recovery_data.card_network.clone(), card_issuer: self.revenue_recovery_data.card_issuer.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( self.revenue_recovery_data .retry_count .map_or_else(|| 1, |retry_count| retry_count), |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::ConnectorCallUnsuccessful, 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 })?, invoice_next_billing_time: self.revenue_recovery_data.invoice_next_billing_time, invoice_billing_started_at_time: self .revenue_recovery_data .invoice_next_billing_time, billing_connector_payment_method_details, first_payment_attempt_network_advice_code: first_network_advice_code, first_payment_attempt_network_decline_code: first_network_decline_code, first_payment_attempt_pg_error_code: first_pg_error_code, }), None => Err(errors::api_error_response::ApiErrorResponse::InternalServerError) .attach_printable("Connector not found in payment attempt")?, }; Ok(Some(FeatureMetadata { redirect_response: payment_intent_feature_metadata .as_ref() .and_then(|data| data.redirect_response.clone()), search_tags: payment_intent_feature_metadata .as_ref() .and_then(|data| data.search_tags.clone()), apple_pay_recurring_details: payment_intent_feature_metadata .as_ref() .and_then(|data| data.apple_pay_recurring_details.clone()), payment_revenue_recovery_metadata, })) }
{ "crate": "hyperswitch_domain_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 109, "total_crates": null }
fn_clm_hyperswitch_domain_models_get_connector_customer_id_713396906110587345
clm
function
// Repository: hyperswitch // Crate: hyperswitch_domain_models // Purpose: Business logic data models bridging API and database layers // Module: crates/hyperswitch_domain_models/src/payments // Inherent implementation for PaymentConfirmData<F> pub fn get_connector_customer_id( &self, customer: Option<&customer::Customer>, merchant_connector_account: &MerchantConnectorAccountTypeDetails, ) -> Option<String> { match merchant_connector_account { MerchantConnectorAccountTypeDetails::MerchantConnectorAccount(_) => customer .and_then(|customer| customer.get_connector_customer_id(merchant_connector_account)) .map(|id| id.to_string()) .or_else(|| { self.payment_intent .get_connector_customer_id_from_feature_metadata() }), MerchantConnectorAccountTypeDetails::MerchantConnectorDetails(_) => None, } }
{ "crate": "hyperswitch_domain_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 66, "total_crates": null }
fn_clm_hyperswitch_domain_models_get_merchant_account_7918523242986745283
clm
function
// Repository: hyperswitch // Crate: hyperswitch_domain_models // Purpose: Business logic data models bridging API and database layers // Module: crates/hyperswitch_domain_models/src/merchant_context // Inherent implementation for MerchantContext pub fn get_merchant_account(&self) -> &MerchantAccount { match self { Self::NormalMerchant(merchant_account) => &merchant_account.0, } }
{ "crate": "hyperswitch_domain_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 2559, "total_crates": null }
fn_clm_hyperswitch_domain_models_get_merchant_key_store_7918523242986745283
clm
function
// Repository: hyperswitch // Crate: hyperswitch_domain_models // Purpose: Business logic data models bridging API and database layers // Module: crates/hyperswitch_domain_models/src/merchant_context // Inherent implementation for MerchantContext pub fn get_merchant_key_store(&self) -> &MerchantKeyStore { match self { Self::NormalMerchant(merchant_account) => &merchant_account.1, } }
{ "crate": "hyperswitch_domain_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 1572, "total_crates": null }
fn_clm_hyperswitch_domain_models_from_8161278287896526910
clm
function
// Repository: hyperswitch // Crate: hyperswitch_domain_models // Purpose: Business logic data models bridging API and database layers // Module: crates/hyperswitch_domain_models/src/lib // Implementation of payments::payment_attempt::ErrorDetails for From<&api_models::payments::RecordAttemptErrorDetails> fn from(error: &api_models::payments::RecordAttemptErrorDetails) -> Self { Self { code: error.code.clone(), message: error.message.clone(), reason: Some(error.message.clone()), unified_code: None, unified_message: None, network_advice_code: error.network_advice_code.clone(), network_decline_code: error.network_decline_code.clone(), network_error_message: error.network_error_message.clone(), } }
{ "crate": "hyperswitch_domain_models", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 2612, "total_crates": null }
fn_clm_hyperswitch_domain_models_get_id_8161278287896526910
clm
function
// Repository: hyperswitch // Crate: hyperswitch_domain_models // Purpose: Business logic data models bridging API and database layers // Module: crates/hyperswitch_domain_models/src/lib // Inherent implementation for RemoteStorageObject<T> pub fn get_id(&self) -> String { match self { Self::ForeignID(id) => id.clone(), Self::Object(i) => i.foreign_id(), } }
{ "crate": "hyperswitch_domain_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 2476, "total_crates": null }
fn_clm_hyperswitch_domain_models_convert_back_8161278287896526910
clm
function
// Repository: hyperswitch // Crate: hyperswitch_domain_models // Purpose: Business logic data models bridging API and database layers // Module: crates/hyperswitch_domain_models/src/lib // Implementation of diesel_models::TransactionDetailsUiConfiguration for ApiModelToDieselModelConvertor<api_models::admin::TransactionDetailsUiConfiguration> fn convert_back(self) -> api_models::admin::TransactionDetailsUiConfiguration { let Self { position, is_key_bold, is_value_bold, } = self; api_models::admin::TransactionDetailsUiConfiguration { position, is_key_bold, is_value_bold, } }
{ "crate": "hyperswitch_domain_models", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 104, "total_crates": null }
fn_clm_hyperswitch_domain_models_convert_from_8161278287896526910
clm
function
// Repository: hyperswitch // Crate: hyperswitch_domain_models // Purpose: Business logic data models bridging API and database layers // Module: crates/hyperswitch_domain_models/src/lib // Implementation of diesel_models::TransactionDetailsUiConfiguration for ApiModelToDieselModelConvertor<api_models::admin::TransactionDetailsUiConfiguration> fn convert_from(from: api_models::admin::TransactionDetailsUiConfiguration) -> Self { Self { position: from.position, is_key_bold: from.is_key_bold, is_value_bold: from.is_value_bold, } }
{ "crate": "hyperswitch_domain_models", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 14, "total_crates": null }
fn_clm_hyperswitch_domain_models_validate_-5820137439940548190
clm
function
// Repository: hyperswitch // Crate: hyperswitch_domain_models // Purpose: Business logic data models bridging API and database layers // Module: crates/hyperswitch_domain_models/src/connector_endpoints // Inherent implementation for NoParams /// function to satisfy connector param validation macro pub fn validate(&self, _parent_field: &str) -> Result<(), ApplicationError> { Ok(()) }
{ "crate": "hyperswitch_domain_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 219, "total_crates": null }
fn_clm_hyperswitch_domain_models_get_connector_params_-5820137439940548190
clm
function
// Repository: hyperswitch // Crate: hyperswitch_domain_models // Purpose: Business logic data models bridging API and database layers // Module: crates/hyperswitch_domain_models/src/connector_endpoints // Inherent implementation for Connectors pub fn get_connector_params( &self, connector: connector_enums::Connector, ) -> CustomResult<ConnectorParams, api_error_response::ApiErrorResponse> { match connector { connector_enums::Connector::Recurly => Ok(self.recurly.clone()), connector_enums::Connector::Stripebilling => Ok(self.stripebilling.clone()), connector_enums::Connector::Chargebee => Ok(self.chargebee.clone()), _ => Err(api_error_response::ApiErrorResponse::IncorrectConnectorNameGiven.into()), } }
{ "crate": "hyperswitch_domain_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 38, "total_crates": null }
fn_clm_hyperswitch_domain_models_try_from_7643475919217427936
clm
function
// Repository: hyperswitch // Crate: hyperswitch_domain_models // Purpose: Business logic data models bridging API and database layers // Module: crates/hyperswitch_domain_models/src/disputes // Implementation of DisputeListConstraints for TryFrom<( api_models::disputes::DisputeListGetConstraints, Option<Vec<common_utils::id_type::ProfileId>>, )> fn try_from( (value, auth_profile_id_list): ( api_models::disputes::DisputeListGetConstraints, Option<Vec<common_utils::id_type::ProfileId>>, ), ) -> Result<Self, Self::Error> { let api_models::disputes::DisputeListGetConstraints { dispute_id, payment_id, limit, offset, profile_id, dispute_status, dispute_stage, reason, connector, merchant_connector_id, currency, time_range, } = value; let profile_id_from_request_body = profile_id; // Match both the profile ID from the request body and the list of authenticated profile IDs coming from auth layer let profile_id_list = match (profile_id_from_request_body, auth_profile_id_list) { (None, None) => None, // Case when the request body profile ID is None, but authenticated profile IDs are available, return the auth list (None, Some(auth_profile_id_list)) => Some(auth_profile_id_list), // Case when the request body profile ID is provided, but the auth list is None, create a vector with the request body profile ID (Some(profile_id_from_request_body), None) => Some(vec![profile_id_from_request_body]), (Some(profile_id_from_request_body), Some(auth_profile_id_list)) => { // Check if the profile ID from the request body is present in the authenticated profile ID list let profile_id_from_request_body_is_available_in_auth_profile_id_list = auth_profile_id_list.contains(&profile_id_from_request_body); if profile_id_from_request_body_is_available_in_auth_profile_id_list { Some(vec![profile_id_from_request_body]) } else { // If the profile ID is not valid, return an error indicating access is not available return Err(error_stack::Report::new( errors::api_error_response::ApiErrorResponse::PreconditionFailed { message: format!( "Access not available for the given profile_id {profile_id_from_request_body:?}", ), }, )); } } }; Ok(Self { dispute_id, payment_id, limit, offset, profile_id: profile_id_list, dispute_status, dispute_stage, reason, connector, merchant_connector_id, currency, time_range, }) }
{ "crate": "hyperswitch_domain_models", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 2661, "total_crates": null }
fn_clm_hyperswitch_domain_models_new_4408191244781062600
clm
function
// Repository: hyperswitch // Crate: hyperswitch_domain_models // Purpose: Business logic data models bridging API and database layers // Module: crates/hyperswitch_domain_models/src/subscription // Inherent implementation for SubscriptionUpdate pub fn new( connector_subscription_id: Option<String>, payment_method_id: Option<Secret<String>>, status: Option<String>, plan_id: Option<String>, item_price_id: Option<String>, ) -> Self { Self { connector_subscription_id, payment_method_id: payment_method_id.map(|pmid| pmid.peek().clone()), status, modified_at: common_utils::date_time::now(), plan_id, item_price_id, } }
{ "crate": "hyperswitch_domain_models", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 14471, "total_crates": null }
fn_clm_hyperswitch_domain_models_from_4408191244781062600
clm
function
// Repository: hyperswitch // Crate: hyperswitch_domain_models // Purpose: Business logic data models bridging API and database layers // Module: crates/hyperswitch_domain_models/src/subscription // Implementation of api_models::subscription::ClientSecret for From<ClientSecret> fn from(domain_secret: ClientSecret) -> Self { Self::new(domain_secret.to_string()) }
{ "crate": "hyperswitch_domain_models", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 2604, "total_crates": null }
fn_clm_hyperswitch_domain_models_convert_4408191244781062600
clm
function
// Repository: hyperswitch // Crate: hyperswitch_domain_models // Purpose: Business logic data models bridging API and database layers // Module: crates/hyperswitch_domain_models/src/subscription // Implementation of SubscriptionUpdate for super::behaviour::Conversion async fn convert(self) -> CustomResult<Self::DstType, ValidationError> { Ok(diesel_models::subscription::SubscriptionUpdate { connector_subscription_id: self.connector_subscription_id, payment_method_id: self.payment_method_id, status: self.status, modified_at: self.modified_at, plan_id: self.plan_id, item_price_id: self.item_price_id, }) }
{ "crate": "hyperswitch_domain_models", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 362, "total_crates": null }
fn_clm_hyperswitch_domain_models_convert_back_4408191244781062600
clm
function
// Repository: hyperswitch // Crate: hyperswitch_domain_models // Purpose: Business logic data models bridging API and database layers // Module: crates/hyperswitch_domain_models/src/subscription // Implementation of SubscriptionUpdate for super::behaviour::Conversion async fn convert_back( _state: &KeyManagerState, item: Self::DstType, _key: &Secret<Vec<u8>>, _key_manager_identifier: keymanager::Identifier, ) -> CustomResult<Self, ValidationError> where Self: Sized, { Ok(Self { connector_subscription_id: item.connector_subscription_id, payment_method_id: item.payment_method_id, status: item.status, modified_at: item.modified_at, plan_id: item.plan_id, item_price_id: item.item_price_id, }) }
{ "crate": "hyperswitch_domain_models", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 104, "total_crates": null }