id
stringlengths
20
153
type
stringclasses
1 value
granularity
stringclasses
14 values
content
stringlengths
16
84.3k
metadata
dict
hyperswitch_method_router_KafkaEvent<'a, T>_old
clm
method
// hyperswitch/crates/router/src/services/kafka.rs // impl for KafkaEvent<'a, T> fn old(event: &'a T, tenant_id: TenantID, clickhouse_database: Option<String>) -> Self { Self { event, sign_flag: -1, tenant_id, clickhouse_database, } }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "KafkaEvent<'a, T>", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "old", "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_method_router_KafkaConsolidatedEvent<'a, T>_new
clm
method
// hyperswitch/crates/router/src/services/kafka.rs // impl for KafkaConsolidatedEvent<'a, T> fn new(event: &'a T, tenant_id: TenantID) -> Self { Self { log: KafkaConsolidatedLog { event, tenant_id }, log_type: event.event_type(), } }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "KafkaConsolidatedEvent<'a, T>", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "new", "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_method_router_KafkaSettings_validate
clm
method
// hyperswitch/crates/router/src/services/kafka.rs // impl for KafkaSettings pub fn validate(&self) -> Result<(), crate::core::errors::ApplicationError> { use common_utils::ext_traits::ConfigExt; use crate::core::errors::ApplicationError; common_utils::fp_utils::when(self.brokers.is_empty(), || { Err(ApplicationError::InvalidConfigurationValueError( "Kafka brokers must not be empty".into(), )) })?; common_utils::fp_utils::when(self.intent_analytics_topic.is_default_or_empty(), || { Err(ApplicationError::InvalidConfigurationValueError( "Kafka Intent Analytics topic must not be empty".into(), )) })?; common_utils::fp_utils::when(self.attempt_analytics_topic.is_default_or_empty(), || { Err(ApplicationError::InvalidConfigurationValueError( "Kafka Attempt Analytics topic must not be empty".into(), )) })?; common_utils::fp_utils::when(self.refund_analytics_topic.is_default_or_empty(), || { Err(ApplicationError::InvalidConfigurationValueError( "Kafka Refund Analytics topic must not be empty".into(), )) })?; common_utils::fp_utils::when(self.api_logs_topic.is_default_or_empty(), || { Err(ApplicationError::InvalidConfigurationValueError( "Kafka API event Analytics topic must not be empty".into(), )) })?; common_utils::fp_utils::when(self.connector_logs_topic.is_default_or_empty(), || { Err(ApplicationError::InvalidConfigurationValueError( "Kafka Connector Logs topic must not be empty".into(), )) })?; common_utils::fp_utils::when( self.outgoing_webhook_logs_topic.is_default_or_empty(), || { Err(ApplicationError::InvalidConfigurationValueError( "Kafka Outgoing Webhook Logs topic must not be empty".into(), )) }, )?; common_utils::fp_utils::when(self.dispute_analytics_topic.is_default_or_empty(), || { Err(ApplicationError::InvalidConfigurationValueError( "Kafka Dispute Logs topic must not be empty".into(), )) })?; common_utils::fp_utils::when(self.audit_events_topic.is_default_or_empty(), || { Err(ApplicationError::InvalidConfigurationValueError( "Kafka Audit Events topic must not be empty".into(), )) })?; #[cfg(feature = "payouts")] common_utils::fp_utils::when(self.payout_analytics_topic.is_default_or_empty(), || { Err(ApplicationError::InvalidConfigurationValueError( "Kafka Payout Analytics topic must not be empty".into(), )) })?; common_utils::fp_utils::when(self.consolidated_events_topic.is_default_or_empty(), || { Err(ApplicationError::InvalidConfigurationValueError( "Consolidated Events topic must not be empty".into(), )) })?; common_utils::fp_utils::when( self.authentication_analytics_topic.is_default_or_empty(), || { Err(ApplicationError::InvalidConfigurationValueError( "Kafka Authentication Analytics topic must not be empty".into(), )) }, )?; common_utils::fp_utils::when(self.routing_logs_topic.is_default_or_empty(), || { Err(ApplicationError::InvalidConfigurationValueError( "Kafka Routing Logs topic must not be empty".into(), )) })?; Ok(()) }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "KafkaSettings", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "validate", "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_method_router_KafkaProducer_set_tenancy
clm
method
// hyperswitch/crates/router/src/services/kafka.rs // impl for KafkaProducer pub fn set_tenancy(&mut self, tenant_config: &dyn TenantConfig) { self.ckh_database_name = Some(tenant_config.get_clickhouse_database().to_string()); }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "KafkaProducer", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "set_tenancy", "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_method_router_KafkaProducer_create
clm
method
// hyperswitch/crates/router/src/services/kafka.rs // impl for KafkaProducer pub async fn create(conf: &KafkaSettings) -> MQResult<Self> { Ok(Self { producer: Arc::new(RdKafkaProducer( ThreadedProducer::from_config( rdkafka::ClientConfig::new().set("bootstrap.servers", conf.brokers.join(",")), ) .change_context(KafkaError::InitializationError)?, )), fraud_check_analytics_topic: conf.fraud_check_analytics_topic.clone(), intent_analytics_topic: conf.intent_analytics_topic.clone(), attempt_analytics_topic: conf.attempt_analytics_topic.clone(), refund_analytics_topic: conf.refund_analytics_topic.clone(), api_logs_topic: conf.api_logs_topic.clone(), connector_logs_topic: conf.connector_logs_topic.clone(), outgoing_webhook_logs_topic: conf.outgoing_webhook_logs_topic.clone(), dispute_analytics_topic: conf.dispute_analytics_topic.clone(), audit_events_topic: conf.audit_events_topic.clone(), #[cfg(feature = "payouts")] payout_analytics_topic: conf.payout_analytics_topic.clone(), consolidated_events_topic: conf.consolidated_events_topic.clone(), authentication_analytics_topic: conf.authentication_analytics_topic.clone(), ckh_database_name: None, routing_logs_topic: conf.routing_logs_topic.clone(), revenue_recovery_topic: conf.revenue_recovery_topic.clone(), }) }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "KafkaProducer", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "create", "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_method_router_KafkaProducer_log_event
clm
method
// hyperswitch/crates/router/src/services/kafka.rs // impl for KafkaProducer pub fn log_event<T: KafkaMessage>(&self, event: &T) -> MQResult<()> { router_env::logger::debug!("Logging Kafka Event {event:?}"); let topic = self.get_topic(event.event_type()); self.producer .0 .send( BaseRecord::to(topic) .key(&event.key()) .payload(&event.value()?) .timestamp(event.creation_timestamp().unwrap_or_else(|| { (OffsetDateTime::now_utc().unix_timestamp_nanos() / 1_000_000) .try_into() .unwrap_or_else(|_| { // kafka producer accepts milliseconds // try converting nanos to millis if that fails convert seconds to millis OffsetDateTime::now_utc().unix_timestamp() * 1_000 }) })), ) .map_err(|(error, record)| report!(error).attach_printable(format!("{record:?}"))) .change_context(KafkaError::GenericError) }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "KafkaProducer", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "log_event", "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_method_router_KafkaProducer_log_fraud_check
clm
method
// hyperswitch/crates/router/src/services/kafka.rs // impl for KafkaProducer pub async fn log_fraud_check( &self, attempt: &FraudCheck, old_attempt: Option<FraudCheck>, tenant_id: TenantID, ) -> MQResult<()> { if let Some(negative_event) = old_attempt { self.log_event(&KafkaEvent::old( &KafkaFraudCheck::from_storage(&negative_event), tenant_id.clone(), self.ckh_database_name.clone(), )) .attach_printable_lazy(|| { format!("Failed to add negative fraud check event {negative_event:?}") })?; }; self.log_event(&KafkaEvent::new( &KafkaFraudCheck::from_storage(attempt), tenant_id.clone(), self.ckh_database_name.clone(), )) .attach_printable_lazy(|| { format!("Failed to add positive fraud check event {attempt:?}") })?; self.log_event(&KafkaConsolidatedEvent::new( &KafkaFraudCheckEvent::from_storage(attempt), tenant_id.clone(), )) .attach_printable_lazy(|| { format!("Failed to add consolidated fraud check event {attempt:?}") }) }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "KafkaProducer", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "log_fraud_check", "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_method_router_KafkaProducer_log_payment_attempt
clm
method
// hyperswitch/crates/router/src/services/kafka.rs // impl for KafkaProducer pub async fn log_payment_attempt( &self, attempt: &PaymentAttempt, old_attempt: Option<PaymentAttempt>, tenant_id: TenantID, ) -> MQResult<()> { if let Some(negative_event) = old_attempt { self.log_event(&KafkaEvent::old( &KafkaPaymentAttempt::from_storage(&negative_event), tenant_id.clone(), self.ckh_database_name.clone(), )) .attach_printable_lazy(|| { format!("Failed to add negative attempt event {negative_event:?}") })?; }; self.log_event(&KafkaEvent::new( &KafkaPaymentAttempt::from_storage(attempt), tenant_id.clone(), self.ckh_database_name.clone(), )) .attach_printable_lazy(|| format!("Failed to add positive attempt event {attempt:?}"))?; self.log_event(&KafkaConsolidatedEvent::new( &KafkaPaymentAttemptEvent::from_storage(attempt), tenant_id.clone(), )) .attach_printable_lazy(|| format!("Failed to add consolidated attempt event {attempt:?}")) }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "KafkaProducer", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "log_payment_attempt", "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_method_router_KafkaProducer_log_payment_attempt_delete
clm
method
// hyperswitch/crates/router/src/services/kafka.rs // impl for KafkaProducer pub async fn log_payment_attempt_delete( &self, delete_old_attempt: &PaymentAttempt, tenant_id: TenantID, ) -> MQResult<()> { self.log_event(&KafkaEvent::old( &KafkaPaymentAttempt::from_storage(delete_old_attempt), tenant_id.clone(), self.ckh_database_name.clone(), )) .attach_printable_lazy(|| { format!("Failed to add negative attempt event {delete_old_attempt:?}") }) }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "KafkaProducer", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "log_payment_attempt_delete", "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_method_router_KafkaProducer_log_authentication
clm
method
// hyperswitch/crates/router/src/services/kafka.rs // impl for KafkaProducer pub async fn log_authentication( &self, authentication: &Authentication, old_authentication: Option<Authentication>, tenant_id: TenantID, ) -> MQResult<()> { if let Some(negative_event) = old_authentication { self.log_event(&KafkaEvent::old( &KafkaAuthentication::from_storage(&negative_event), tenant_id.clone(), self.ckh_database_name.clone(), )) .attach_printable_lazy(|| { format!("Failed to add negative authentication event {negative_event:?}") })?; }; self.log_event(&KafkaEvent::new( &KafkaAuthentication::from_storage(authentication), tenant_id.clone(), self.ckh_database_name.clone(), )) .attach_printable_lazy(|| { format!("Failed to add positive authentication event {authentication:?}") })?; self.log_event(&KafkaConsolidatedEvent::new( &KafkaAuthenticationEvent::from_storage(authentication), tenant_id.clone(), )) .attach_printable_lazy(|| { format!("Failed to add consolidated authentication event {authentication:?}") }) }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "KafkaProducer", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "log_authentication", "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_method_router_KafkaProducer_log_payment_intent
clm
method
// hyperswitch/crates/router/src/services/kafka.rs // impl for KafkaProducer pub async fn log_payment_intent( &self, intent: &PaymentIntent, old_intent: Option<PaymentIntent>, tenant_id: TenantID, infra_values: Option<Value>, ) -> MQResult<()> { if let Some(negative_event) = old_intent { self.log_event(&KafkaEvent::old( &KafkaPaymentIntent::from_storage(&negative_event, infra_values.clone()), tenant_id.clone(), self.ckh_database_name.clone(), )) .attach_printable_lazy(|| { format!("Failed to add negative intent event {negative_event:?}") })?; }; self.log_event(&KafkaEvent::new( &KafkaPaymentIntent::from_storage(intent, infra_values.clone()), tenant_id.clone(), self.ckh_database_name.clone(), )) .attach_printable_lazy(|| format!("Failed to add positive intent event {intent:?}"))?; self.log_event(&KafkaConsolidatedEvent::new( &KafkaPaymentIntentEvent::from_storage(intent, infra_values.clone()), tenant_id.clone(), )) .attach_printable_lazy(|| format!("Failed to add consolidated intent event {intent:?}")) }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "KafkaProducer", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "log_payment_intent", "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_method_router_KafkaProducer_log_payment_intent_delete
clm
method
// hyperswitch/crates/router/src/services/kafka.rs // impl for KafkaProducer pub async fn log_payment_intent_delete( &self, delete_old_intent: &PaymentIntent, tenant_id: TenantID, infra_values: Option<Value>, ) -> MQResult<()> { self.log_event(&KafkaEvent::old( &KafkaPaymentIntent::from_storage(delete_old_intent, infra_values), tenant_id.clone(), self.ckh_database_name.clone(), )) .attach_printable_lazy(|| { format!("Failed to add negative intent event {delete_old_intent:?}") }) }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "KafkaProducer", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "log_payment_intent_delete", "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_method_router_KafkaProducer_log_refund
clm
method
// hyperswitch/crates/router/src/services/kafka.rs // impl for KafkaProducer pub async fn log_refund( &self, refund: &Refund, old_refund: Option<Refund>, tenant_id: TenantID, ) -> MQResult<()> { if let Some(negative_event) = old_refund { self.log_event(&KafkaEvent::old( &KafkaRefund::from_storage(&negative_event), tenant_id.clone(), self.ckh_database_name.clone(), )) .attach_printable_lazy(|| { format!("Failed to add negative refund event {negative_event:?}") })?; }; self.log_event(&KafkaEvent::new( &KafkaRefund::from_storage(refund), tenant_id.clone(), self.ckh_database_name.clone(), )) .attach_printable_lazy(|| format!("Failed to add positive refund event {refund:?}"))?; self.log_event(&KafkaConsolidatedEvent::new( &KafkaRefundEvent::from_storage(refund), tenant_id.clone(), )) .attach_printable_lazy(|| format!("Failed to add consolidated refund event {refund:?}")) }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "KafkaProducer", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "log_refund", "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_method_router_KafkaProducer_log_refund_delete
clm
method
// hyperswitch/crates/router/src/services/kafka.rs // impl for KafkaProducer pub async fn log_refund_delete( &self, delete_old_refund: &Refund, tenant_id: TenantID, ) -> MQResult<()> { self.log_event(&KafkaEvent::old( &KafkaRefund::from_storage(delete_old_refund), tenant_id.clone(), self.ckh_database_name.clone(), )) .attach_printable_lazy(|| { format!("Failed to add negative refund event {delete_old_refund:?}") }) }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "KafkaProducer", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "log_refund_delete", "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_method_router_KafkaProducer_log_dispute
clm
method
// hyperswitch/crates/router/src/services/kafka.rs // impl for KafkaProducer pub async fn log_dispute( &self, dispute: &Dispute, old_dispute: Option<Dispute>, tenant_id: TenantID, ) -> MQResult<()> { if let Some(negative_event) = old_dispute { self.log_event(&KafkaEvent::old( &KafkaDispute::from_storage(&negative_event), tenant_id.clone(), self.ckh_database_name.clone(), )) .attach_printable_lazy(|| { format!("Failed to add negative dispute event {negative_event:?}") })?; }; self.log_event(&KafkaEvent::new( &KafkaDispute::from_storage(dispute), tenant_id.clone(), self.ckh_database_name.clone(), )) .attach_printable_lazy(|| format!("Failed to add positive dispute event {dispute:?}"))?; self.log_event(&KafkaConsolidatedEvent::new( &KafkaDisputeEvent::from_storage(dispute), tenant_id.clone(), )) .attach_printable_lazy(|| format!("Failed to add consolidated dispute event {dispute:?}")) }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "KafkaProducer", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "log_dispute", "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_method_router_KafkaProducer_log_dispute_delete
clm
method
// hyperswitch/crates/router/src/services/kafka.rs // impl for KafkaProducer pub async fn log_dispute_delete( &self, delete_old_dispute: &Dispute, tenant_id: TenantID, ) -> MQResult<()> { self.log_event(&KafkaEvent::old( &KafkaDispute::from_storage(delete_old_dispute), tenant_id.clone(), self.ckh_database_name.clone(), )) .attach_printable_lazy(|| { format!("Failed to add negative dispute event {delete_old_dispute:?}") }) }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "KafkaProducer", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "log_dispute_delete", "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_method_router_KafkaProducer_log_payout
clm
method
// hyperswitch/crates/router/src/services/kafka.rs // impl for KafkaProducer pub async fn log_payout( &self, payout: &KafkaPayout<'_>, old_payout: Option<KafkaPayout<'_>>, tenant_id: TenantID, ) -> MQResult<()> { if let Some(negative_event) = old_payout { self.log_event(&KafkaEvent::old( &negative_event, tenant_id.clone(), self.ckh_database_name.clone(), )) .attach_printable_lazy(|| { format!("Failed to add negative payout event {negative_event:?}") })?; }; self.log_event(&KafkaEvent::new( payout, tenant_id.clone(), self.ckh_database_name.clone(), )) .attach_printable_lazy(|| format!("Failed to add positive payout event {payout:?}")) }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "KafkaProducer", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "log_payout", "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_method_router_KafkaProducer_log_payout_delete
clm
method
// hyperswitch/crates/router/src/services/kafka.rs // impl for KafkaProducer pub async fn log_payout_delete( &self, delete_old_payout: &KafkaPayout<'_>, tenant_id: TenantID, ) -> MQResult<()> { self.log_event(&KafkaEvent::old( delete_old_payout, tenant_id.clone(), self.ckh_database_name.clone(), )) .attach_printable_lazy(|| { format!("Failed to add negative payout event {delete_old_payout:?}") }) }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "KafkaProducer", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "log_payout_delete", "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_method_router_KafkaProducer_get_topic
clm
method
// hyperswitch/crates/router/src/services/kafka.rs // impl for KafkaProducer pub fn get_topic(&self, event: EventType) -> &str { match event { EventType::FraudCheck => &self.fraud_check_analytics_topic, EventType::ApiLogs => &self.api_logs_topic, EventType::PaymentAttempt => &self.attempt_analytics_topic, EventType::PaymentIntent => &self.intent_analytics_topic, EventType::Refund => &self.refund_analytics_topic, EventType::ConnectorApiLogs => &self.connector_logs_topic, EventType::OutgoingWebhookLogs => &self.outgoing_webhook_logs_topic, EventType::Dispute => &self.dispute_analytics_topic, EventType::AuditEvent => &self.audit_events_topic, #[cfg(feature = "payouts")] EventType::Payout => &self.payout_analytics_topic, EventType::Consolidated => &self.consolidated_events_topic, EventType::Authentication => &self.authentication_analytics_topic, EventType::RoutingApiLogs => &self.routing_logs_topic, EventType::RevenueRecovery => &self.revenue_recovery_topic, } }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "KafkaProducer", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "get_topic", "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_method_router_PlatformOrgAdminAuthWithMerchantIdFromRoute_fetch_key_store_and_account
clm
method
// hyperswitch/crates/router/src/services/authentication.rs // impl for PlatformOrgAdminAuthWithMerchantIdFromRoute async fn fetch_key_store_and_account<A: SessionStateInfo + Sync>( merchant_id: &id_type::MerchantId, state: &A, ) -> RouterResult<(domain::MerchantKeyStore, domain::MerchantAccount)> { let key_manager_state = &(&state.session_state()).into(); let key_store = state .store() .get_merchant_key_store_by_merchant_id( key_manager_state, merchant_id, &state.store().get_master_key().to_vec().into(), ) .await .to_not_found_response(errors::ApiErrorResponse::Unauthorized)?; let merchant = state .store() .find_merchant_account_by_merchant_id(key_manager_state, merchant_id, &key_store) .await .to_not_found_response(errors::ApiErrorResponse::Unauthorized)?; Ok((key_store, merchant)) }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "PlatformOrgAdminAuthWithMerchantIdFromRoute", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "fetch_key_store_and_account", "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_method_router_AdminApiAuthWithApiKeyFallbackAndMerchantIdFromRoute_fetch_merchant_key_store_and_account
clm
method
// hyperswitch/crates/router/src/services/authentication.rs // impl for AdminApiAuthWithApiKeyFallbackAndMerchantIdFromRoute async fn fetch_merchant_key_store_and_account<A: SessionStateInfo + Sync>( merchant_id: &id_type::MerchantId, state: &A, ) -> RouterResult<(domain::MerchantKeyStore, domain::MerchantAccount)> { let key_manager_state = &(&state.session_state()).into(); let key_store = state .store() .get_merchant_key_store_by_merchant_id( key_manager_state, merchant_id, &state.store().get_master_key().to_vec().into(), ) .await .to_not_found_response(errors::ApiErrorResponse::Unauthorized)?; let merchant = state .store() .find_merchant_account_by_merchant_id(key_manager_state, merchant_id, &key_store) .await .to_not_found_response(errors::ApiErrorResponse::Unauthorized)?; Ok((key_store, merchant)) }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "AdminApiAuthWithApiKeyFallbackAndMerchantIdFromRoute", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "fetch_merchant_key_store_and_account", "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_method_router_ExternalToken_new_token
clm
method
// hyperswitch/crates/router/src/services/authentication.rs // impl for ExternalToken pub async fn new_token( user_id: String, merchant_id: id_type::MerchantId, settings: &Settings, external_service_type: ExternalServiceType, ) -> UserResult<String> { let exp_duration = std::time::Duration::from_secs(consts::JWT_TOKEN_TIME_IN_SECS); let exp = jwt::generate_exp(exp_duration)?.as_secs(); let token_payload = Self { user_id, merchant_id, exp, external_service_type, }; jwt::generate_jwt(&token_payload, settings).await }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "ExternalToken", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "new_token", "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_method_router_ExternalToken_check_service_type
clm
method
// hyperswitch/crates/router/src/services/authentication.rs // impl for ExternalToken pub fn check_service_type( &self, required_service_type: &ExternalServiceType, ) -> RouterResult<()> { Ok(fp_utils::when( &self.external_service_type != required_service_type, || { Err(errors::ApiErrorResponse::AccessForbidden { resource: required_service_type.to_string(), }) }, )?) }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "ExternalToken", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "check_service_type", "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_method_router_KafkaRefundEvent<'a>_from_storage
clm
method
// hyperswitch/crates/router/src/services/kafka/refund_event.rs // impl for KafkaRefundEvent<'a> pub fn from_storage(refund: &'a Refund) -> Self { let Refund { payment_id, merchant_id, connector_transaction_id, connector, connector_refund_id, external_reference_id, refund_type, total_amount, currency, refund_amount, refund_status, sent_to_gateway, refund_error_message, metadata, refund_arn, created_at, modified_at, description, attempt_id, refund_reason, refund_error_code, profile_id, updated_by, charges, organization_id, split_refunds, unified_code, unified_message, processor_refund_data, processor_transaction_data, id, merchant_reference_id, connector_id, } = refund; Self { refund_id: id, merchant_reference_id, payment_id, merchant_id, connector_transaction_id, connector, connector_refund_id: connector_refund_id.as_ref(), external_reference_id: external_reference_id.as_ref(), refund_type, total_amount, currency, refund_amount, refund_status, sent_to_gateway, refund_error_message: refund_error_message.as_ref(), refund_arn: refund_arn.as_ref(), created_at: created_at.assume_utc(), modified_at: modified_at.assume_utc(), description: description.as_ref(), attempt_id, refund_reason: refund_reason.as_ref(), refund_error_code: refund_error_code.as_ref(), profile_id: profile_id.as_ref(), organization_id, metadata: metadata.as_ref(), updated_by, merchant_connector_id: connector_id.as_ref(), charges: charges.as_ref(), connector_refund_data: processor_refund_data.as_ref(), connector_transaction_data: processor_transaction_data.as_ref(), split_refunds: split_refunds.as_ref(), unified_code: unified_code.as_ref(), unified_message: unified_message.as_ref(), processor_refund_data: processor_refund_data.as_ref(), processor_transaction_data: processor_transaction_data.as_ref(), } }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "KafkaRefundEvent<'a>", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "from_storage", "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_method_router_KafkaRefundEvent<'a>_from_storage
clm
method
// hyperswitch/crates/router/src/services/kafka/refund_event.rs // impl for KafkaRefundEvent<'a> pub fn from_storage(refund: &'a Refund) -> Self { let Refund { payment_id, merchant_id, connector_transaction_id, connector, connector_refund_id, external_reference_id, refund_type, total_amount, currency, refund_amount, refund_status, sent_to_gateway, refund_error_message, metadata, refund_arn, created_at, modified_at, description, attempt_id, refund_reason, refund_error_code, profile_id, updated_by, charges, organization_id, split_refunds, unified_code, unified_message, processor_refund_data, processor_transaction_data, id, merchant_reference_id, connector_id, } = refund; Self { refund_id: id, merchant_reference_id, payment_id, merchant_id, connector_transaction_id, connector, connector_refund_id: connector_refund_id.as_ref(), external_reference_id: external_reference_id.as_ref(), refund_type, total_amount, currency, refund_amount, refund_status, sent_to_gateway, refund_error_message: refund_error_message.as_ref(), refund_arn: refund_arn.as_ref(), created_at: created_at.assume_utc(), modified_at: modified_at.assume_utc(), description: description.as_ref(), attempt_id, refund_reason: refund_reason.as_ref(), refund_error_code: refund_error_code.as_ref(), profile_id: profile_id.as_ref(), organization_id, metadata: metadata.as_ref(), updated_by, merchant_connector_id: connector_id.as_ref(), charges: charges.as_ref(), connector_refund_data: processor_refund_data.as_ref(), connector_transaction_data: processor_transaction_data.as_ref(), split_refunds: split_refunds.as_ref(), unified_code: unified_code.as_ref(), unified_message: unified_message.as_ref(), processor_refund_data: processor_refund_data.as_ref(), processor_transaction_data: processor_transaction_data.as_ref(), } }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "KafkaRefundEvent<'a>", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "from_storage", "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_method_router_KafkaDispute<'a>_from_storage
clm
method
// hyperswitch/crates/router/src/services/kafka/dispute.rs // impl for KafkaDispute<'a> pub fn from_storage(dispute: &'a Dispute) -> Self { let currency = dispute.dispute_currency.unwrap_or( dispute .currency .to_uppercase() .parse_enum("Currency") .unwrap_or_default(), ); Self { dispute_id: &dispute.dispute_id, dispute_amount: StringMinorUnitForConnector::convert_back( &StringMinorUnitForConnector, dispute.amount.clone(), currency, ) .unwrap_or_else(|e| { router_env::logger::error!("Failed to convert dispute amount: {e:?}"); MinorUnit::new(0) }), currency, dispute_stage: &dispute.dispute_stage, dispute_status: &dispute.dispute_status, payment_id: &dispute.payment_id, attempt_id: &dispute.attempt_id, merchant_id: &dispute.merchant_id, connector_status: &dispute.connector_status, connector_dispute_id: &dispute.connector_dispute_id, connector_reason: dispute.connector_reason.as_ref(), connector_reason_code: dispute.connector_reason_code.as_ref(), challenge_required_by: dispute.challenge_required_by.map(|i| i.assume_utc()), connector_created_at: dispute.connector_created_at.map(|i| i.assume_utc()), connector_updated_at: dispute.connector_updated_at.map(|i| i.assume_utc()), created_at: dispute.created_at.assume_utc(), modified_at: dispute.modified_at.assume_utc(), connector: &dispute.connector, evidence: &dispute.evidence, profile_id: dispute.profile_id.as_ref(), merchant_connector_id: dispute.merchant_connector_id.as_ref(), organization_id: &dispute.organization_id, } }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "KafkaDispute<'a>", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "from_storage", "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_method_router_KafkaPaymentAttempt<'a>_from_storage
clm
method
// hyperswitch/crates/router/src/services/kafka/payment_attempt.rs // impl for KafkaPaymentAttempt<'a> pub fn from_storage(attempt: &'a PaymentAttempt) -> Self { use masking::PeekInterface; let PaymentAttempt { payment_id, merchant_id, attempts_group_id, amount_details, status, connector, error, authentication_type, created_at, modified_at, last_synced, cancellation_reason, browser_info, payment_token, connector_metadata, payment_experience, payment_method_data, routing_result, preprocessing_step_id, multiple_capture_count, connector_response_reference_id, updated_by, redirection_data, encoded_data, merchant_connector_id, external_three_ds_authentication_attempted, authentication_connector, authentication_id, fingerprint_id, client_source, client_version, customer_acceptance, profile_id, organization_id, payment_method_type, payment_method_id, connector_payment_id, payment_method_subtype, authentication_applied, external_reference_id, payment_method_billing_address, id, connector_token_details, card_discovery, charges, feature_metadata, processor_merchant_id, created_by, connector_request_reference_id, network_transaction_id: _, authorized_amount: _, } = attempt; let (connector_payment_id, connector_payment_data) = connector_payment_id .clone() .map(types::ConnectorTransactionId::form_id_and_data) .map(|(txn_id, txn_data)| (Some(txn_id), txn_data)) .unwrap_or((None, None)); Self { payment_id, merchant_id, attempt_id: id, attempts_group_id: attempts_group_id.as_ref(), status: *status, amount: amount_details.get_net_amount(), connector: connector.as_ref(), error_message: error.as_ref().map(|error_details| &error_details.message), surcharge_amount: amount_details.get_surcharge_amount(), tax_amount: amount_details.get_tax_on_surcharge(), payment_method_id: payment_method_id.as_ref(), payment_method: *payment_method_type, connector_transaction_id: connector_response_reference_id.as_ref(), authentication_type: *authentication_type, created_at: created_at.assume_utc(), modified_at: modified_at.assume_utc(), last_synced: last_synced.map(|i| i.assume_utc()), cancellation_reason: cancellation_reason.as_ref(), amount_to_capture: amount_details.get_amount_to_capture(), browser_info: browser_info.as_ref(), error_code: error.as_ref().map(|error_details| &error_details.code), connector_metadata: connector_metadata.as_ref().map(|v| v.peek().to_string()), payment_experience: payment_experience.as_ref(), payment_method_type: payment_method_subtype, payment_method_data: payment_method_data.as_ref().map(|v| v.peek().to_string()), error_reason: error .as_ref() .and_then(|error_details| error_details.reason.as_ref()), multiple_capture_count: *multiple_capture_count, amount_capturable: amount_details.get_amount_capturable(), merchant_connector_id: merchant_connector_id.as_ref(), net_amount: amount_details.get_net_amount(), unified_code: error .as_ref() .and_then(|error_details| error_details.unified_code.as_ref()), unified_message: error .as_ref() .and_then(|error_details| error_details.unified_message.as_ref()), client_source: client_source.as_ref(), client_version: client_version.as_ref(), profile_id, organization_id, card_network: payment_method_data .as_ref() .map(|data| data.peek()) .and_then(|data| data.as_object()) .and_then(|pm| pm.get("card")) .and_then(|data| data.as_object()) .and_then(|card| card.get("card_network")) .and_then(|network| network.as_str()) .map(|network| network.to_string()), card_discovery: card_discovery.map(|discovery| discovery.to_string()), payment_token: payment_token.clone(), preprocessing_step_id: preprocessing_step_id.clone(), connector_response_reference_id: connector_response_reference_id.clone(), updated_by, encoded_data: encoded_data.as_ref(), external_three_ds_authentication_attempted: *external_three_ds_authentication_attempted, authentication_connector: authentication_connector.clone(), authentication_id: authentication_id .as_ref() .map(|id| id.get_string_repr().to_string().clone()), fingerprint_id: fingerprint_id.clone(), customer_acceptance: customer_acceptance.as_ref(), shipping_cost: amount_details.get_shipping_cost(), order_tax_amount: amount_details.get_order_tax_amount(), charges: charges.clone(), processor_merchant_id, created_by: created_by.as_ref(), payment_method_type_v2: *payment_method_type, connector_payment_id: connector_payment_id.as_ref().cloned(), payment_method_subtype: *payment_method_subtype, routing_result: routing_result.clone(), authentication_applied: *authentication_applied, external_reference_id: external_reference_id.clone(), tax_on_surcharge: amount_details.get_tax_on_surcharge(), payment_method_billing_address: payment_method_billing_address .as_ref() .map(|v| masking::Secret::new(v.get_inner())), redirection_data: redirection_data.as_ref(), connector_payment_data, connector_token_details: connector_token_details.as_ref(), feature_metadata: feature_metadata.as_ref(), network_advice_code: error .as_ref() .and_then(|details| details.network_advice_code.clone()), network_decline_code: error .as_ref() .and_then(|details| details.network_decline_code.clone()), network_error_message: error .as_ref() .and_then(|details| details.network_error_message.clone()), connector_request_reference_id: connector_request_reference_id.clone(), } }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "KafkaPaymentAttempt<'a>", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "from_storage", "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_method_router_KafkaPaymentAttempt<'a>_from_storage
clm
method
// hyperswitch/crates/router/src/services/kafka/payment_attempt.rs // impl for KafkaPaymentAttempt<'a> pub fn from_storage(attempt: &'a PaymentAttempt) -> Self { use masking::PeekInterface; let PaymentAttempt { payment_id, merchant_id, attempts_group_id, amount_details, status, connector, error, authentication_type, created_at, modified_at, last_synced, cancellation_reason, browser_info, payment_token, connector_metadata, payment_experience, payment_method_data, routing_result, preprocessing_step_id, multiple_capture_count, connector_response_reference_id, updated_by, redirection_data, encoded_data, merchant_connector_id, external_three_ds_authentication_attempted, authentication_connector, authentication_id, fingerprint_id, client_source, client_version, customer_acceptance, profile_id, organization_id, payment_method_type, payment_method_id, connector_payment_id, payment_method_subtype, authentication_applied, external_reference_id, payment_method_billing_address, id, connector_token_details, card_discovery, charges, feature_metadata, processor_merchant_id, created_by, connector_request_reference_id, network_transaction_id: _, authorized_amount: _, } = attempt; let (connector_payment_id, connector_payment_data) = connector_payment_id .clone() .map(types::ConnectorTransactionId::form_id_and_data) .map(|(txn_id, txn_data)| (Some(txn_id), txn_data)) .unwrap_or((None, None)); Self { payment_id, merchant_id, attempt_id: id, attempts_group_id: attempts_group_id.as_ref(), status: *status, amount: amount_details.get_net_amount(), connector: connector.as_ref(), error_message: error.as_ref().map(|error_details| &error_details.message), surcharge_amount: amount_details.get_surcharge_amount(), tax_amount: amount_details.get_tax_on_surcharge(), payment_method_id: payment_method_id.as_ref(), payment_method: *payment_method_type, connector_transaction_id: connector_response_reference_id.as_ref(), authentication_type: *authentication_type, created_at: created_at.assume_utc(), modified_at: modified_at.assume_utc(), last_synced: last_synced.map(|i| i.assume_utc()), cancellation_reason: cancellation_reason.as_ref(), amount_to_capture: amount_details.get_amount_to_capture(), browser_info: browser_info.as_ref(), error_code: error.as_ref().map(|error_details| &error_details.code), connector_metadata: connector_metadata.as_ref().map(|v| v.peek().to_string()), payment_experience: payment_experience.as_ref(), payment_method_type: payment_method_subtype, payment_method_data: payment_method_data.as_ref().map(|v| v.peek().to_string()), error_reason: error .as_ref() .and_then(|error_details| error_details.reason.as_ref()), multiple_capture_count: *multiple_capture_count, amount_capturable: amount_details.get_amount_capturable(), merchant_connector_id: merchant_connector_id.as_ref(), net_amount: amount_details.get_net_amount(), unified_code: error .as_ref() .and_then(|error_details| error_details.unified_code.as_ref()), unified_message: error .as_ref() .and_then(|error_details| error_details.unified_message.as_ref()), client_source: client_source.as_ref(), client_version: client_version.as_ref(), profile_id, organization_id, card_network: payment_method_data .as_ref() .map(|data| data.peek()) .and_then(|data| data.as_object()) .and_then(|pm| pm.get("card")) .and_then(|data| data.as_object()) .and_then(|card| card.get("card_network")) .and_then(|network| network.as_str()) .map(|network| network.to_string()), card_discovery: card_discovery.map(|discovery| discovery.to_string()), payment_token: payment_token.clone(), preprocessing_step_id: preprocessing_step_id.clone(), connector_response_reference_id: connector_response_reference_id.clone(), updated_by, encoded_data: encoded_data.as_ref(), external_three_ds_authentication_attempted: *external_three_ds_authentication_attempted, authentication_connector: authentication_connector.clone(), authentication_id: authentication_id .as_ref() .map(|id| id.get_string_repr().to_string().clone()), fingerprint_id: fingerprint_id.clone(), customer_acceptance: customer_acceptance.as_ref(), shipping_cost: amount_details.get_shipping_cost(), order_tax_amount: amount_details.get_order_tax_amount(), charges: charges.clone(), processor_merchant_id, created_by: created_by.as_ref(), payment_method_type_v2: *payment_method_type, connector_payment_id: connector_payment_id.as_ref().cloned(), payment_method_subtype: *payment_method_subtype, routing_result: routing_result.clone(), authentication_applied: *authentication_applied, external_reference_id: external_reference_id.clone(), tax_on_surcharge: amount_details.get_tax_on_surcharge(), payment_method_billing_address: payment_method_billing_address .as_ref() .map(|v| masking::Secret::new(v.get_inner())), redirection_data: redirection_data.as_ref(), connector_payment_data, connector_token_details: connector_token_details.as_ref(), feature_metadata: feature_metadata.as_ref(), network_advice_code: error .as_ref() .and_then(|details| details.network_advice_code.clone()), network_decline_code: error .as_ref() .and_then(|details| details.network_decline_code.clone()), network_error_message: error .as_ref() .and_then(|details| details.network_error_message.clone()), connector_request_reference_id: connector_request_reference_id.clone(), } }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "KafkaPaymentAttempt<'a>", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "from_storage", "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_method_router_KafkaPayout<'a>_from_storage
clm
method
// hyperswitch/crates/router/src/services/kafka/payout.rs // impl for KafkaPayout<'a> pub fn from_storage(payouts: &'a Payouts, payout_attempt: &'a PayoutAttempt) -> Self { Self { payout_id: &payouts.payout_id, payout_attempt_id: &payout_attempt.payout_attempt_id, merchant_id: &payouts.merchant_id, customer_id: payouts.customer_id.as_ref(), address_id: payouts.address_id.as_ref(), profile_id: &payouts.profile_id, payout_method_id: payouts.payout_method_id.as_ref(), payout_type: payouts.payout_type, amount: payouts.amount, destination_currency: payouts.destination_currency, source_currency: payouts.source_currency, description: payouts.description.as_ref(), recurring: payouts.recurring, auto_fulfill: payouts.auto_fulfill, return_url: payouts.return_url.as_ref(), entity_type: payouts.entity_type, metadata: payouts.metadata.clone(), created_at: payouts.created_at.assume_utc(), last_modified_at: payouts.last_modified_at.assume_utc(), attempt_count: payouts.attempt_count, status: payouts.status, priority: payouts.priority, connector: payout_attempt.connector.as_ref(), connector_payout_id: payout_attempt.connector_payout_id.as_ref(), is_eligible: payout_attempt.is_eligible, error_message: payout_attempt.error_message.as_ref(), error_code: payout_attempt.error_code.as_ref(), business_country: payout_attempt.business_country, business_label: payout_attempt.business_label.as_ref(), merchant_connector_id: payout_attempt.merchant_connector_id.as_ref(), } }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "KafkaPayout<'a>", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "from_storage", "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_method_router_KafkaFraudCheck<'a>_from_storage
clm
method
// hyperswitch/crates/router/src/services/kafka/fraud_check.rs // impl for KafkaFraudCheck<'a> pub fn from_storage(check: &'a FraudCheck) -> Self { Self { frm_id: &check.frm_id, payment_id: &check.payment_id, merchant_id: &check.merchant_id, attempt_id: &check.attempt_id, created_at: check.created_at.assume_utc(), frm_name: &check.frm_name, frm_transaction_id: check.frm_transaction_id.as_ref(), frm_transaction_type: check.frm_transaction_type, frm_status: check.frm_status, frm_score: check.frm_score, frm_reason: check.frm_reason.clone(), frm_error: check.frm_error.as_ref(), payment_details: check.payment_details.clone(), metadata: check.metadata.clone(), modified_at: check.modified_at.assume_utc(), last_step: check.last_step, payment_capture_method: check.payment_capture_method, } }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "KafkaFraudCheck<'a>", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "from_storage", "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_method_router_KafkaDisputeEvent<'a>_from_storage
clm
method
// hyperswitch/crates/router/src/services/kafka/dispute_event.rs // impl for KafkaDisputeEvent<'a> pub fn from_storage(dispute: &'a Dispute) -> Self { let currency = dispute.dispute_currency.unwrap_or( dispute .currency .to_uppercase() .parse_enum("Currency") .unwrap_or_default(), ); Self { dispute_id: &dispute.dispute_id, dispute_amount: StringMinorUnitForConnector::convert_back( &StringMinorUnitForConnector, dispute.amount.clone(), currency, ) .unwrap_or_else(|e| { router_env::logger::error!("Failed to convert dispute amount: {e:?}"); MinorUnit::new(0) }), currency, dispute_stage: &dispute.dispute_stage, dispute_status: &dispute.dispute_status, payment_id: &dispute.payment_id, attempt_id: &dispute.attempt_id, merchant_id: &dispute.merchant_id, connector_status: &dispute.connector_status, connector_dispute_id: &dispute.connector_dispute_id, connector_reason: dispute.connector_reason.as_ref(), connector_reason_code: dispute.connector_reason_code.as_ref(), challenge_required_by: dispute.challenge_required_by.map(|i| i.assume_utc()), connector_created_at: dispute.connector_created_at.map(|i| i.assume_utc()), connector_updated_at: dispute.connector_updated_at.map(|i| i.assume_utc()), created_at: dispute.created_at.assume_utc(), modified_at: dispute.modified_at.assume_utc(), connector: &dispute.connector, evidence: &dispute.evidence, profile_id: dispute.profile_id.as_ref(), merchant_connector_id: dispute.merchant_connector_id.as_ref(), organization_id: &dispute.organization_id, } }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "KafkaDisputeEvent<'a>", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "from_storage", "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_method_router_KafkaPaymentAttemptEvent<'a>_from_storage
clm
method
// hyperswitch/crates/router/src/services/kafka/payment_attempt_event.rs // impl for KafkaPaymentAttemptEvent<'a> pub fn from_storage(attempt: &'a PaymentAttempt) -> Self { use masking::PeekInterface; let PaymentAttempt { payment_id, merchant_id, attempts_group_id, amount_details, status, connector, error, authentication_type, created_at, modified_at, last_synced, cancellation_reason, browser_info, payment_token, connector_metadata, payment_experience, payment_method_data, routing_result, preprocessing_step_id, multiple_capture_count, connector_response_reference_id, updated_by, redirection_data, encoded_data, merchant_connector_id, external_three_ds_authentication_attempted, authentication_connector, authentication_id, fingerprint_id, client_source, client_version, customer_acceptance, profile_id, organization_id, payment_method_type, payment_method_id, connector_payment_id, payment_method_subtype, authentication_applied, external_reference_id, payment_method_billing_address, id, connector_token_details, card_discovery, charges, feature_metadata, processor_merchant_id, created_by, connector_request_reference_id, network_transaction_id: _, authorized_amount: _, } = attempt; let (connector_payment_id, connector_payment_data) = connector_payment_id .clone() .map(types::ConnectorTransactionId::form_id_and_data) .map(|(txn_id, txn_data)| (Some(txn_id), txn_data)) .unwrap_or((None, None)); Self { payment_id, merchant_id, attempt_id: id, attempts_group_id: attempts_group_id.as_ref(), status: *status, amount: amount_details.get_net_amount(), connector: connector.as_ref(), error_message: error.as_ref().map(|error_details| &error_details.message), surcharge_amount: amount_details.get_surcharge_amount(), tax_amount: amount_details.get_tax_on_surcharge(), payment_method_id: payment_method_id.as_ref(), payment_method: *payment_method_type, connector_transaction_id: connector_response_reference_id.as_ref(), authentication_type: *authentication_type, created_at: created_at.assume_utc(), modified_at: modified_at.assume_utc(), last_synced: last_synced.map(|i| i.assume_utc()), cancellation_reason: cancellation_reason.as_ref(), amount_to_capture: amount_details.get_amount_to_capture(), browser_info: browser_info.as_ref(), error_code: error.as_ref().map(|error_details| &error_details.code), connector_metadata: connector_metadata.as_ref().map(|v| v.peek().to_string()), payment_experience: payment_experience.as_ref(), payment_method_type: payment_method_subtype, payment_method_data: payment_method_data.as_ref().map(|v| v.peek().to_string()), error_reason: error .as_ref() .and_then(|error_details| error_details.reason.as_ref()), multiple_capture_count: *multiple_capture_count, amount_capturable: amount_details.get_amount_capturable(), merchant_connector_id: merchant_connector_id.as_ref(), net_amount: amount_details.get_net_amount(), unified_code: error .as_ref() .and_then(|error_details| error_details.unified_code.as_ref()), unified_message: error .as_ref() .and_then(|error_details| error_details.unified_message.as_ref()), client_source: client_source.as_ref(), client_version: client_version.as_ref(), profile_id, organization_id, card_network: payment_method_data .as_ref() .map(|data| data.peek()) .and_then(|data| data.as_object()) .and_then(|pm| pm.get("card")) .and_then(|data| data.as_object()) .and_then(|card| card.get("card_network")) .and_then(|network| network.as_str()) .map(|network| network.to_string()), card_discovery: card_discovery.map(|discovery| discovery.to_string()), payment_token: payment_token.clone(), preprocessing_step_id: preprocessing_step_id.clone(), connector_response_reference_id: connector_response_reference_id.clone(), updated_by, encoded_data: encoded_data.as_ref(), external_three_ds_authentication_attempted: *external_three_ds_authentication_attempted, authentication_connector: authentication_connector.clone(), authentication_id: authentication_id .as_ref() .map(|id| id.get_string_repr().to_string()), fingerprint_id: fingerprint_id.clone(), customer_acceptance: customer_acceptance.as_ref(), shipping_cost: amount_details.get_shipping_cost(), order_tax_amount: amount_details.get_order_tax_amount(), charges: charges.clone(), processor_merchant_id, created_by: created_by.as_ref(), payment_method_type_v2: *payment_method_type, connector_payment_id: connector_payment_id.as_ref().cloned(), payment_method_subtype: *payment_method_subtype, routing_result: routing_result.clone(), authentication_applied: *authentication_applied, external_reference_id: external_reference_id.clone(), tax_on_surcharge: amount_details.get_tax_on_surcharge(), payment_method_billing_address: payment_method_billing_address .as_ref() .map(|v| masking::Secret::new(v.get_inner())), redirection_data: redirection_data.as_ref(), connector_payment_data, connector_token_details: connector_token_details.as_ref(), feature_metadata: feature_metadata.as_ref(), network_advice_code: error .as_ref() .and_then(|details| details.network_advice_code.clone()), network_decline_code: error .as_ref() .and_then(|details| details.network_decline_code.clone()), network_error_message: error .as_ref() .and_then(|details| details.network_error_message.clone()), connector_request_reference_id: connector_request_reference_id.clone(), } }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "KafkaPaymentAttemptEvent<'a>", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "from_storage", "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_method_router_KafkaPaymentAttemptEvent<'a>_from_storage
clm
method
// hyperswitch/crates/router/src/services/kafka/payment_attempt_event.rs // impl for KafkaPaymentAttemptEvent<'a> pub fn from_storage(attempt: &'a PaymentAttempt) -> Self { use masking::PeekInterface; let PaymentAttempt { payment_id, merchant_id, attempts_group_id, amount_details, status, connector, error, authentication_type, created_at, modified_at, last_synced, cancellation_reason, browser_info, payment_token, connector_metadata, payment_experience, payment_method_data, routing_result, preprocessing_step_id, multiple_capture_count, connector_response_reference_id, updated_by, redirection_data, encoded_data, merchant_connector_id, external_three_ds_authentication_attempted, authentication_connector, authentication_id, fingerprint_id, client_source, client_version, customer_acceptance, profile_id, organization_id, payment_method_type, payment_method_id, connector_payment_id, payment_method_subtype, authentication_applied, external_reference_id, payment_method_billing_address, id, connector_token_details, card_discovery, charges, feature_metadata, processor_merchant_id, created_by, connector_request_reference_id, network_transaction_id: _, authorized_amount: _, } = attempt; let (connector_payment_id, connector_payment_data) = connector_payment_id .clone() .map(types::ConnectorTransactionId::form_id_and_data) .map(|(txn_id, txn_data)| (Some(txn_id), txn_data)) .unwrap_or((None, None)); Self { payment_id, merchant_id, attempt_id: id, attempts_group_id: attempts_group_id.as_ref(), status: *status, amount: amount_details.get_net_amount(), connector: connector.as_ref(), error_message: error.as_ref().map(|error_details| &error_details.message), surcharge_amount: amount_details.get_surcharge_amount(), tax_amount: amount_details.get_tax_on_surcharge(), payment_method_id: payment_method_id.as_ref(), payment_method: *payment_method_type, connector_transaction_id: connector_response_reference_id.as_ref(), authentication_type: *authentication_type, created_at: created_at.assume_utc(), modified_at: modified_at.assume_utc(), last_synced: last_synced.map(|i| i.assume_utc()), cancellation_reason: cancellation_reason.as_ref(), amount_to_capture: amount_details.get_amount_to_capture(), browser_info: browser_info.as_ref(), error_code: error.as_ref().map(|error_details| &error_details.code), connector_metadata: connector_metadata.as_ref().map(|v| v.peek().to_string()), payment_experience: payment_experience.as_ref(), payment_method_type: payment_method_subtype, payment_method_data: payment_method_data.as_ref().map(|v| v.peek().to_string()), error_reason: error .as_ref() .and_then(|error_details| error_details.reason.as_ref()), multiple_capture_count: *multiple_capture_count, amount_capturable: amount_details.get_amount_capturable(), merchant_connector_id: merchant_connector_id.as_ref(), net_amount: amount_details.get_net_amount(), unified_code: error .as_ref() .and_then(|error_details| error_details.unified_code.as_ref()), unified_message: error .as_ref() .and_then(|error_details| error_details.unified_message.as_ref()), client_source: client_source.as_ref(), client_version: client_version.as_ref(), profile_id, organization_id, card_network: payment_method_data .as_ref() .map(|data| data.peek()) .and_then(|data| data.as_object()) .and_then(|pm| pm.get("card")) .and_then(|data| data.as_object()) .and_then(|card| card.get("card_network")) .and_then(|network| network.as_str()) .map(|network| network.to_string()), card_discovery: card_discovery.map(|discovery| discovery.to_string()), payment_token: payment_token.clone(), preprocessing_step_id: preprocessing_step_id.clone(), connector_response_reference_id: connector_response_reference_id.clone(), updated_by, encoded_data: encoded_data.as_ref(), external_three_ds_authentication_attempted: *external_three_ds_authentication_attempted, authentication_connector: authentication_connector.clone(), authentication_id: authentication_id .as_ref() .map(|id| id.get_string_repr().to_string()), fingerprint_id: fingerprint_id.clone(), customer_acceptance: customer_acceptance.as_ref(), shipping_cost: amount_details.get_shipping_cost(), order_tax_amount: amount_details.get_order_tax_amount(), charges: charges.clone(), processor_merchant_id, created_by: created_by.as_ref(), payment_method_type_v2: *payment_method_type, connector_payment_id: connector_payment_id.as_ref().cloned(), payment_method_subtype: *payment_method_subtype, routing_result: routing_result.clone(), authentication_applied: *authentication_applied, external_reference_id: external_reference_id.clone(), tax_on_surcharge: amount_details.get_tax_on_surcharge(), payment_method_billing_address: payment_method_billing_address .as_ref() .map(|v| masking::Secret::new(v.get_inner())), redirection_data: redirection_data.as_ref(), connector_payment_data, connector_token_details: connector_token_details.as_ref(), feature_metadata: feature_metadata.as_ref(), network_advice_code: error .as_ref() .and_then(|details| details.network_advice_code.clone()), network_decline_code: error .as_ref() .and_then(|details| details.network_decline_code.clone()), network_error_message: error .as_ref() .and_then(|details| details.network_error_message.clone()), connector_request_reference_id: connector_request_reference_id.clone(), } }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "KafkaPaymentAttemptEvent<'a>", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "from_storage", "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_method_router_KafkaFraudCheckEvent<'a>_from_storage
clm
method
// hyperswitch/crates/router/src/services/kafka/fraud_check_event.rs // impl for KafkaFraudCheckEvent<'a> pub fn from_storage(check: &'a FraudCheck) -> Self { Self { frm_id: &check.frm_id, payment_id: &check.payment_id, merchant_id: &check.merchant_id, attempt_id: &check.attempt_id, created_at: check.created_at.assume_utc(), frm_name: &check.frm_name, frm_transaction_id: check.frm_transaction_id.as_ref(), frm_transaction_type: check.frm_transaction_type, frm_status: check.frm_status, frm_score: check.frm_score, frm_reason: check.frm_reason.clone(), frm_error: check.frm_error.as_ref(), payment_details: check.payment_details.clone(), metadata: check.metadata.clone(), modified_at: check.modified_at.assume_utc(), last_step: check.last_step, payment_capture_method: check.payment_capture_method, } }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "KafkaFraudCheckEvent<'a>", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "from_storage", "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_method_router_KafkaRefund<'a>_from_storage
clm
method
// hyperswitch/crates/router/src/services/kafka/refund.rs // impl for KafkaRefund<'a> pub fn from_storage(refund: &'a Refund) -> Self { let Refund { payment_id, merchant_id, connector_transaction_id, connector, connector_refund_id, external_reference_id, refund_type, total_amount, currency, refund_amount, refund_status, sent_to_gateway, refund_error_message, metadata, refund_arn, created_at, modified_at, description, attempt_id, refund_reason, refund_error_code, profile_id, updated_by, charges, organization_id, split_refunds, unified_code, unified_message, processor_refund_data, processor_transaction_data, id, merchant_reference_id, connector_id, } = refund; Self { refund_id: id, merchant_reference_id, payment_id, merchant_id, connector_transaction_id, connector, connector_refund_id: connector_refund_id.as_ref(), external_reference_id: external_reference_id.as_ref(), refund_type, total_amount, currency, refund_amount, refund_status, sent_to_gateway, refund_error_message: refund_error_message.as_ref(), refund_arn: refund_arn.as_ref(), created_at: created_at.assume_utc(), modified_at: modified_at.assume_utc(), description: description.as_ref(), attempt_id, refund_reason: refund_reason.as_ref(), refund_error_code: refund_error_code.as_ref(), profile_id: profile_id.as_ref(), organization_id, metadata: metadata.as_ref(), updated_by, merchant_connector_id: connector_id.as_ref(), charges: charges.as_ref(), connector_refund_data: processor_refund_data.as_ref(), connector_transaction_data: processor_transaction_data.as_ref(), split_refunds: split_refunds.as_ref(), unified_code: unified_code.as_ref(), unified_message: unified_message.as_ref(), processor_refund_data: processor_refund_data.as_ref(), processor_transaction_data: processor_transaction_data.as_ref(), } }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "KafkaRefund<'a>", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "from_storage", "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_method_router_KafkaRefund<'a>_from_storage
clm
method
// hyperswitch/crates/router/src/services/kafka/refund.rs // impl for KafkaRefund<'a> pub fn from_storage(refund: &'a Refund) -> Self { let Refund { payment_id, merchant_id, connector_transaction_id, connector, connector_refund_id, external_reference_id, refund_type, total_amount, currency, refund_amount, refund_status, sent_to_gateway, refund_error_message, metadata, refund_arn, created_at, modified_at, description, attempt_id, refund_reason, refund_error_code, profile_id, updated_by, charges, organization_id, split_refunds, unified_code, unified_message, processor_refund_data, processor_transaction_data, id, merchant_reference_id, connector_id, } = refund; Self { refund_id: id, merchant_reference_id, payment_id, merchant_id, connector_transaction_id, connector, connector_refund_id: connector_refund_id.as_ref(), external_reference_id: external_reference_id.as_ref(), refund_type, total_amount, currency, refund_amount, refund_status, sent_to_gateway, refund_error_message: refund_error_message.as_ref(), refund_arn: refund_arn.as_ref(), created_at: created_at.assume_utc(), modified_at: modified_at.assume_utc(), description: description.as_ref(), attempt_id, refund_reason: refund_reason.as_ref(), refund_error_code: refund_error_code.as_ref(), profile_id: profile_id.as_ref(), organization_id, metadata: metadata.as_ref(), updated_by, merchant_connector_id: connector_id.as_ref(), charges: charges.as_ref(), connector_refund_data: processor_refund_data.as_ref(), connector_transaction_data: processor_transaction_data.as_ref(), split_refunds: split_refunds.as_ref(), unified_code: unified_code.as_ref(), unified_message: unified_message.as_ref(), processor_refund_data: processor_refund_data.as_ref(), processor_transaction_data: processor_transaction_data.as_ref(), } }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "KafkaRefund<'a>", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "from_storage", "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_method_router_KafkaPaymentIntentEvent<'_>_get_id
clm
method
// hyperswitch/crates/router/src/services/kafka/payment_intent_event.rs // impl for KafkaPaymentIntentEvent<'_> pub fn get_id(&self) -> &id_type::GlobalPaymentId { self.payment_id }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "KafkaPaymentIntentEvent<'_>", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "get_id", "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_method_router_KafkaPaymentIntentEvent<'a>_from_storage
clm
method
// hyperswitch/crates/router/src/services/kafka/payment_intent_event.rs // impl for KafkaPaymentIntentEvent<'a> pub fn from_storage(intent: &'a PaymentIntent, infra_values: Option<Value>) -> Self { let PaymentIntent { id, merchant_id, status, amount_details, amount_captured, customer_id, description, return_url, metadata, statement_descriptor, created_at, modified_at, last_synced, setup_future_usage, active_attempt_id, active_attempt_id_type, active_attempts_group_id, order_details, allowed_payment_method_types, connector_metadata, feature_metadata, attempt_count, profile_id, payment_link_id, frm_merchant_decision, updated_by, request_incremental_authorization, split_txns_enabled, authorization_count, session_expiry, request_external_three_ds_authentication, frm_metadata, customer_details, merchant_reference_id, billing_address, shipping_address, capture_method, authentication_type, prerouting_algorithm, organization_id, enable_payment_link, apply_mit_exemption, customer_present, payment_link_config, routing_algorithm_id, split_payments, force_3ds_challenge, force_3ds_challenge_trigger, processor_merchant_id, created_by, is_iframe_redirection_enabled, is_payment_id_from_merchant, enable_partial_authorization, } = intent; Self { payment_id: id, merchant_id, status: *status, amount: amount_details.order_amount, currency: amount_details.currency, amount_captured: *amount_captured, customer_id: customer_id.as_ref(), description: description.as_ref(), return_url: return_url.as_ref(), metadata: metadata.as_ref(), statement_descriptor: statement_descriptor.as_ref(), created_at: created_at.assume_utc(), modified_at: modified_at.assume_utc(), last_synced: last_synced.map(|t| t.assume_utc()), setup_future_usage: *setup_future_usage, off_session: setup_future_usage.is_off_session(), active_attempt_id: active_attempt_id.as_ref(), active_attempt_id_type: *active_attempt_id_type, active_attempts_group_id: active_attempts_group_id.as_ref(), attempt_count: *attempt_count, profile_id, customer_email: None, feature_metadata: feature_metadata.as_ref(), organization_id, order_details: order_details.as_ref(), allowed_payment_method_types: allowed_payment_method_types.as_ref(), connector_metadata: connector_metadata.as_ref(), payment_link_id: payment_link_id.as_ref(), updated_by, surcharge_applicable: None, request_incremental_authorization: *request_incremental_authorization, split_txns_enabled: *split_txns_enabled, authorization_count: *authorization_count, session_expiry: session_expiry.assume_utc(), request_external_three_ds_authentication: *request_external_three_ds_authentication, frm_metadata: frm_metadata .as_ref() .map(|frm_metadata| frm_metadata.as_ref()), customer_details: customer_details .as_ref() .map(|customer_details| customer_details.get_inner().as_ref()), shipping_cost: amount_details.shipping_cost, tax_details: amount_details.tax_details.clone(), skip_external_tax_calculation: amount_details.get_external_tax_action_as_bool(), request_extended_authorization: None, psd2_sca_exemption_type: None, split_payments: split_payments.as_ref(), platform_merchant_id: None, force_3ds_challenge: *force_3ds_challenge, force_3ds_challenge_trigger: *force_3ds_challenge_trigger, processor_merchant_id, created_by: created_by.as_ref(), is_iframe_redirection_enabled: *is_iframe_redirection_enabled, merchant_reference_id: merchant_reference_id.as_ref(), billing_address: billing_address .as_ref() .map(|billing_address| Secret::new(billing_address.get_inner())), shipping_address: shipping_address .as_ref() .map(|shipping_address| Secret::new(shipping_address.get_inner())), capture_method: *capture_method, authentication_type: *authentication_type, prerouting_algorithm: prerouting_algorithm.as_ref(), surcharge_amount: amount_details.surcharge_amount, tax_on_surcharge: amount_details.tax_on_surcharge, frm_merchant_decision: *frm_merchant_decision, enable_payment_link: *enable_payment_link, apply_mit_exemption: *apply_mit_exemption, customer_present: *customer_present, routing_algorithm_id: routing_algorithm_id.as_ref(), payment_link_config: payment_link_config.as_ref(), infra_values, enable_partial_authorization: *enable_partial_authorization, } }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "KafkaPaymentIntentEvent<'a>", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "from_storage", "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_method_router_KafkaPaymentIntentEvent<'a>_from_storage
clm
method
// hyperswitch/crates/router/src/services/kafka/payment_intent_event.rs // impl for KafkaPaymentIntentEvent<'a> pub fn from_storage(intent: &'a PaymentIntent, infra_values: Option<Value>) -> Self { let PaymentIntent { id, merchant_id, status, amount_details, amount_captured, customer_id, description, return_url, metadata, statement_descriptor, created_at, modified_at, last_synced, setup_future_usage, active_attempt_id, active_attempt_id_type, active_attempts_group_id, order_details, allowed_payment_method_types, connector_metadata, feature_metadata, attempt_count, profile_id, payment_link_id, frm_merchant_decision, updated_by, request_incremental_authorization, split_txns_enabled, authorization_count, session_expiry, request_external_three_ds_authentication, frm_metadata, customer_details, merchant_reference_id, billing_address, shipping_address, capture_method, authentication_type, prerouting_algorithm, organization_id, enable_payment_link, apply_mit_exemption, customer_present, payment_link_config, routing_algorithm_id, split_payments, force_3ds_challenge, force_3ds_challenge_trigger, processor_merchant_id, created_by, is_iframe_redirection_enabled, is_payment_id_from_merchant, enable_partial_authorization, } = intent; Self { payment_id: id, merchant_id, status: *status, amount: amount_details.order_amount, currency: amount_details.currency, amount_captured: *amount_captured, customer_id: customer_id.as_ref(), description: description.as_ref(), return_url: return_url.as_ref(), metadata: metadata.as_ref(), statement_descriptor: statement_descriptor.as_ref(), created_at: created_at.assume_utc(), modified_at: modified_at.assume_utc(), last_synced: last_synced.map(|t| t.assume_utc()), setup_future_usage: *setup_future_usage, off_session: setup_future_usage.is_off_session(), active_attempt_id: active_attempt_id.as_ref(), active_attempt_id_type: *active_attempt_id_type, active_attempts_group_id: active_attempts_group_id.as_ref(), attempt_count: *attempt_count, profile_id, customer_email: None, feature_metadata: feature_metadata.as_ref(), organization_id, order_details: order_details.as_ref(), allowed_payment_method_types: allowed_payment_method_types.as_ref(), connector_metadata: connector_metadata.as_ref(), payment_link_id: payment_link_id.as_ref(), updated_by, surcharge_applicable: None, request_incremental_authorization: *request_incremental_authorization, split_txns_enabled: *split_txns_enabled, authorization_count: *authorization_count, session_expiry: session_expiry.assume_utc(), request_external_three_ds_authentication: *request_external_three_ds_authentication, frm_metadata: frm_metadata .as_ref() .map(|frm_metadata| frm_metadata.as_ref()), customer_details: customer_details .as_ref() .map(|customer_details| customer_details.get_inner().as_ref()), shipping_cost: amount_details.shipping_cost, tax_details: amount_details.tax_details.clone(), skip_external_tax_calculation: amount_details.get_external_tax_action_as_bool(), request_extended_authorization: None, psd2_sca_exemption_type: None, split_payments: split_payments.as_ref(), platform_merchant_id: None, force_3ds_challenge: *force_3ds_challenge, force_3ds_challenge_trigger: *force_3ds_challenge_trigger, processor_merchant_id, created_by: created_by.as_ref(), is_iframe_redirection_enabled: *is_iframe_redirection_enabled, merchant_reference_id: merchant_reference_id.as_ref(), billing_address: billing_address .as_ref() .map(|billing_address| Secret::new(billing_address.get_inner())), shipping_address: shipping_address .as_ref() .map(|shipping_address| Secret::new(shipping_address.get_inner())), capture_method: *capture_method, authentication_type: *authentication_type, prerouting_algorithm: prerouting_algorithm.as_ref(), surcharge_amount: amount_details.surcharge_amount, tax_on_surcharge: amount_details.tax_on_surcharge, frm_merchant_decision: *frm_merchant_decision, enable_payment_link: *enable_payment_link, apply_mit_exemption: *apply_mit_exemption, customer_present: *customer_present, routing_algorithm_id: routing_algorithm_id.as_ref(), payment_link_config: payment_link_config.as_ref(), infra_values, enable_partial_authorization: *enable_partial_authorization, } }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "KafkaPaymentIntentEvent<'a>", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "from_storage", "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_method_router_KafkaAuthenticationEvent<'a>_from_storage
clm
method
// hyperswitch/crates/router/src/services/kafka/authentication_event.rs // impl for KafkaAuthenticationEvent<'a> pub fn from_storage(authentication: &'a Authentication) -> Self { Self { created_at: authentication.created_at.assume_utc(), modified_at: authentication.modified_at.assume_utc(), authentication_id: &authentication.authentication_id, merchant_id: &authentication.merchant_id, authentication_status: authentication.authentication_status, authentication_connector: authentication.authentication_connector.as_ref(), connector_authentication_id: authentication.connector_authentication_id.as_ref(), authentication_data: authentication.authentication_data.clone(), payment_method_id: &authentication.payment_method_id, authentication_type: authentication.authentication_type, authentication_lifecycle_status: authentication.authentication_lifecycle_status, error_code: authentication.error_code.as_ref(), error_message: authentication.error_message.as_ref(), connector_metadata: authentication.connector_metadata.clone(), maximum_supported_version: authentication.maximum_supported_version.clone(), threeds_server_transaction_id: authentication.threeds_server_transaction_id.as_ref(), cavv: authentication.cavv.as_ref(), authentication_flow_type: authentication.authentication_flow_type.as_ref(), message_version: authentication.message_version.clone(), eci: authentication.eci.as_ref(), trans_status: authentication.trans_status.clone(), acquirer_bin: authentication.acquirer_bin.as_ref(), acquirer_merchant_id: authentication.acquirer_merchant_id.as_ref(), three_ds_method_data: authentication.three_ds_method_data.as_ref(), three_ds_method_url: authentication.three_ds_method_url.as_ref(), acs_url: authentication.acs_url.as_ref(), challenge_request: authentication.challenge_request.as_ref(), acs_reference_number: authentication.acs_reference_number.as_ref(), acs_trans_id: authentication.acs_trans_id.as_ref(), acs_signed_content: authentication.acs_signed_content.as_ref(), profile_id: &authentication.profile_id, payment_id: authentication.payment_id.as_ref(), merchant_connector_id: authentication.merchant_connector_id.as_ref(), ds_trans_id: authentication.ds_trans_id.as_ref(), directory_server_id: authentication.directory_server_id.as_ref(), acquirer_country_code: authentication.acquirer_country_code.as_ref(), organization_id: &authentication.organization_id, } }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "KafkaAuthenticationEvent<'a>", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "from_storage", "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_method_router_KafkaAuthentication<'a>_from_storage
clm
method
// hyperswitch/crates/router/src/services/kafka/authentication.rs // impl for KafkaAuthentication<'a> pub fn from_storage(authentication: &'a Authentication) -> Self { Self { created_at: authentication.created_at.assume_utc(), modified_at: authentication.modified_at.assume_utc(), authentication_id: &authentication.authentication_id, merchant_id: &authentication.merchant_id, authentication_status: authentication.authentication_status, authentication_connector: authentication.authentication_connector.as_ref(), connector_authentication_id: authentication.connector_authentication_id.as_ref(), authentication_data: authentication.authentication_data.clone(), payment_method_id: &authentication.payment_method_id, authentication_type: authentication.authentication_type, authentication_lifecycle_status: authentication.authentication_lifecycle_status, error_code: authentication.error_code.as_ref(), error_message: authentication.error_message.as_ref(), connector_metadata: authentication.connector_metadata.clone(), maximum_supported_version: authentication.maximum_supported_version.clone(), threeds_server_transaction_id: authentication.threeds_server_transaction_id.as_ref(), cavv: authentication.cavv.as_ref(), authentication_flow_type: authentication.authentication_flow_type.as_ref(), message_version: authentication.message_version.clone(), eci: authentication.eci.as_ref(), trans_status: authentication.trans_status.clone(), acquirer_bin: authentication.acquirer_bin.as_ref(), acquirer_merchant_id: authentication.acquirer_merchant_id.as_ref(), three_ds_method_data: authentication.three_ds_method_data.as_ref(), three_ds_method_url: authentication.three_ds_method_url.as_ref(), acs_url: authentication.acs_url.as_ref(), challenge_request: authentication.challenge_request.as_ref(), acs_reference_number: authentication.acs_reference_number.as_ref(), acs_trans_id: authentication.acs_trans_id.as_ref(), acs_signed_content: authentication.acs_signed_content.as_ref(), profile_id: &authentication.profile_id, payment_id: authentication.payment_id.as_ref(), merchant_connector_id: authentication.merchant_connector_id.as_ref(), ds_trans_id: authentication.ds_trans_id.as_ref(), directory_server_id: authentication.directory_server_id.as_ref(), acquirer_country_code: authentication.acquirer_country_code.as_ref(), organization_id: &authentication.organization_id, } }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "KafkaAuthentication<'a>", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "from_storage", "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_method_router_KafkaPaymentIntent<'a>_from_storage
clm
method
// hyperswitch/crates/router/src/services/kafka/payment_intent.rs // impl for KafkaPaymentIntent<'a> pub fn from_storage(intent: &'a PaymentIntent, infra_values: Option<Value>) -> Self { let PaymentIntent { id, merchant_id, status, amount_details, amount_captured, customer_id, description, return_url, metadata, statement_descriptor, created_at, modified_at, last_synced, setup_future_usage, active_attempt_id, active_attempt_id_type, active_attempts_group_id, order_details, allowed_payment_method_types, connector_metadata, feature_metadata, attempt_count, profile_id, payment_link_id, frm_merchant_decision, updated_by, request_incremental_authorization, split_txns_enabled, authorization_count, session_expiry, request_external_three_ds_authentication, frm_metadata, customer_details, merchant_reference_id, billing_address, shipping_address, capture_method, authentication_type, prerouting_algorithm, organization_id, enable_payment_link, apply_mit_exemption, customer_present, payment_link_config, routing_algorithm_id, split_payments, force_3ds_challenge, force_3ds_challenge_trigger, processor_merchant_id, created_by, is_iframe_redirection_enabled, is_payment_id_from_merchant, enable_partial_authorization, } = intent; Self { payment_id: id, merchant_id, status: *status, amount: amount_details.order_amount, currency: amount_details.currency, amount_captured: *amount_captured, customer_id: customer_id.as_ref(), description: description.as_ref(), return_url: return_url.as_ref(), metadata: metadata.as_ref(), statement_descriptor: statement_descriptor.as_ref(), created_at: created_at.assume_utc(), modified_at: modified_at.assume_utc(), last_synced: last_synced.map(|t| t.assume_utc()), setup_future_usage: *setup_future_usage, off_session: setup_future_usage.is_off_session(), active_attempt_id: active_attempt_id.as_ref(), active_attempt_id_type: *active_attempt_id_type, active_attempts_group_id: active_attempts_group_id.as_ref(), attempt_count: *attempt_count, profile_id, customer_email: None, feature_metadata: feature_metadata.as_ref(), organization_id, order_details: order_details.as_ref(), allowed_payment_method_types: allowed_payment_method_types.as_ref(), connector_metadata: connector_metadata.as_ref(), payment_link_id: payment_link_id.as_ref(), updated_by, surcharge_applicable: None, request_incremental_authorization: *request_incremental_authorization, split_txns_enabled: *split_txns_enabled, authorization_count: *authorization_count, session_expiry: session_expiry.assume_utc(), request_external_three_ds_authentication: *request_external_three_ds_authentication, frm_metadata: frm_metadata .as_ref() .map(|frm_metadata| frm_metadata.as_ref()), customer_details: customer_details .as_ref() .map(|customer_details| customer_details.get_inner().as_ref()), shipping_cost: amount_details.shipping_cost, tax_details: amount_details.tax_details.clone(), skip_external_tax_calculation: amount_details.get_external_tax_action_as_bool(), request_extended_authorization: None, psd2_sca_exemption_type: None, split_payments: split_payments.as_ref(), platform_merchant_id: None, force_3ds_challenge: *force_3ds_challenge, force_3ds_challenge_trigger: *force_3ds_challenge_trigger, processor_merchant_id, created_by: created_by.as_ref(), is_iframe_redirection_enabled: *is_iframe_redirection_enabled, merchant_reference_id: merchant_reference_id.as_ref(), billing_address: billing_address .as_ref() .map(|billing_address| Secret::new(billing_address.get_inner())), shipping_address: shipping_address .as_ref() .map(|shipping_address| Secret::new(shipping_address.get_inner())), capture_method: *capture_method, authentication_type: *authentication_type, prerouting_algorithm: prerouting_algorithm.as_ref(), surcharge_amount: amount_details.surcharge_amount, tax_on_surcharge: amount_details.tax_on_surcharge, frm_merchant_decision: *frm_merchant_decision, enable_payment_link: *enable_payment_link, apply_mit_exemption: *apply_mit_exemption, customer_present: *customer_present, routing_algorithm_id: routing_algorithm_id.as_ref(), payment_link_config: payment_link_config.as_ref(), infra_values, enable_partial_authorization: *enable_partial_authorization, } }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "KafkaPaymentIntent<'a>", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "from_storage", "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_method_router_KafkaPaymentIntent<'a>_from_storage
clm
method
// hyperswitch/crates/router/src/services/kafka/payment_intent.rs // impl for KafkaPaymentIntent<'a> pub fn from_storage(intent: &'a PaymentIntent, infra_values: Option<Value>) -> Self { let PaymentIntent { id, merchant_id, status, amount_details, amount_captured, customer_id, description, return_url, metadata, statement_descriptor, created_at, modified_at, last_synced, setup_future_usage, active_attempt_id, active_attempt_id_type, active_attempts_group_id, order_details, allowed_payment_method_types, connector_metadata, feature_metadata, attempt_count, profile_id, payment_link_id, frm_merchant_decision, updated_by, request_incremental_authorization, split_txns_enabled, authorization_count, session_expiry, request_external_three_ds_authentication, frm_metadata, customer_details, merchant_reference_id, billing_address, shipping_address, capture_method, authentication_type, prerouting_algorithm, organization_id, enable_payment_link, apply_mit_exemption, customer_present, payment_link_config, routing_algorithm_id, split_payments, force_3ds_challenge, force_3ds_challenge_trigger, processor_merchant_id, created_by, is_iframe_redirection_enabled, is_payment_id_from_merchant, enable_partial_authorization, } = intent; Self { payment_id: id, merchant_id, status: *status, amount: amount_details.order_amount, currency: amount_details.currency, amount_captured: *amount_captured, customer_id: customer_id.as_ref(), description: description.as_ref(), return_url: return_url.as_ref(), metadata: metadata.as_ref(), statement_descriptor: statement_descriptor.as_ref(), created_at: created_at.assume_utc(), modified_at: modified_at.assume_utc(), last_synced: last_synced.map(|t| t.assume_utc()), setup_future_usage: *setup_future_usage, off_session: setup_future_usage.is_off_session(), active_attempt_id: active_attempt_id.as_ref(), active_attempt_id_type: *active_attempt_id_type, active_attempts_group_id: active_attempts_group_id.as_ref(), attempt_count: *attempt_count, profile_id, customer_email: None, feature_metadata: feature_metadata.as_ref(), organization_id, order_details: order_details.as_ref(), allowed_payment_method_types: allowed_payment_method_types.as_ref(), connector_metadata: connector_metadata.as_ref(), payment_link_id: payment_link_id.as_ref(), updated_by, surcharge_applicable: None, request_incremental_authorization: *request_incremental_authorization, split_txns_enabled: *split_txns_enabled, authorization_count: *authorization_count, session_expiry: session_expiry.assume_utc(), request_external_three_ds_authentication: *request_external_three_ds_authentication, frm_metadata: frm_metadata .as_ref() .map(|frm_metadata| frm_metadata.as_ref()), customer_details: customer_details .as_ref() .map(|customer_details| customer_details.get_inner().as_ref()), shipping_cost: amount_details.shipping_cost, tax_details: amount_details.tax_details.clone(), skip_external_tax_calculation: amount_details.get_external_tax_action_as_bool(), request_extended_authorization: None, psd2_sca_exemption_type: None, split_payments: split_payments.as_ref(), platform_merchant_id: None, force_3ds_challenge: *force_3ds_challenge, force_3ds_challenge_trigger: *force_3ds_challenge_trigger, processor_merchant_id, created_by: created_by.as_ref(), is_iframe_redirection_enabled: *is_iframe_redirection_enabled, merchant_reference_id: merchant_reference_id.as_ref(), billing_address: billing_address .as_ref() .map(|billing_address| Secret::new(billing_address.get_inner())), shipping_address: shipping_address .as_ref() .map(|shipping_address| Secret::new(shipping_address.get_inner())), capture_method: *capture_method, authentication_type: *authentication_type, prerouting_algorithm: prerouting_algorithm.as_ref(), surcharge_amount: amount_details.surcharge_amount, tax_on_surcharge: amount_details.tax_on_surcharge, frm_merchant_decision: *frm_merchant_decision, enable_payment_link: *enable_payment_link, apply_mit_exemption: *apply_mit_exemption, customer_present: *customer_present, routing_algorithm_id: routing_algorithm_id.as_ref(), payment_link_config: payment_link_config.as_ref(), infra_values, enable_partial_authorization: *enable_partial_authorization, } }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "KafkaPaymentIntent<'a>", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "from_storage", "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_method_router_KafkaPaymentIntent<'_>_get_id
clm
method
// hyperswitch/crates/router/src/services/kafka/payment_intent.rs // impl for KafkaPaymentIntent<'_> fn get_id(&self) -> &id_type::GlobalPaymentId { self.payment_id }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "KafkaPaymentIntent<'_>", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "get_id", "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_method_router_ProxyClient_new
clm
method
// hyperswitch/crates/router/src/services/api/client.rs // impl for ProxyClient pub fn new(proxy_config: &Proxy) -> CustomResult<Self, ApiClientError> { let client = client::get_client_builder(proxy_config) .switch()? .build() .change_context(ApiClientError::InvalidProxyConfiguration)?; Ok(Self { proxy_config: proxy_config.clone(), client, request_id: None, }) }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "ProxyClient", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "new", "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_method_router_ProxyClient_get_reqwest_client
clm
method
// hyperswitch/crates/router/src/services/api/client.rs // impl for ProxyClient pub fn get_reqwest_client( &self, client_certificate: Option<masking::Secret<String>>, client_certificate_key: Option<masking::Secret<String>>, ) -> CustomResult<reqwest::Client, ApiClientError> { match (client_certificate, client_certificate_key) { (Some(certificate), Some(certificate_key)) => { let client_builder = client::get_client_builder(&self.proxy_config).switch()?; let identity = client::create_identity_from_certificate_and_key(certificate, certificate_key) .switch()?; Ok(client_builder .identity(identity) .build() .change_context(ApiClientError::ClientConstructionFailed) .attach_printable( "Failed to construct client with certificate and certificate key", )?) } (_, _) => Ok(self.client.clone()), } }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "ProxyClient", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "get_reqwest_client", "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_method_router_ExtractedPayload_from_headers
clm
method
// hyperswitch/crates/router/src/services/authentication/detached.rs // impl for ExtractedPayload pub fn from_headers(headers: &HeaderMap) -> RouterResult<Self> { let merchant_id = headers .get(HEADER_MERCHANT_ID) .and_then(|value| value.to_str().ok()) .ok_or_else(|| ApiErrorResponse::InvalidRequestData { message: format!("`{HEADER_MERCHANT_ID}` header is invalid or not present"), }) .map_err(error_stack::Report::from) .and_then(|merchant_id| { MerchantId::try_from(Cow::from(merchant_id.to_string())).change_context( ApiErrorResponse::InvalidRequestData { message: format!( "`{HEADER_MERCHANT_ID}` header is invalid or not present", ), }, ) })?; let auth_type: PayloadType = headers .get(HEADER_AUTH_TYPE) .and_then(|inner| inner.to_str().ok()) .ok_or_else(|| ApiErrorResponse::InvalidRequestData { message: format!("`{HEADER_AUTH_TYPE}` header not present"), })? .parse::<PayloadType>() .change_context(ApiErrorResponse::InvalidRequestData { message: format!("`{HEADER_AUTH_TYPE}` header not present"), })?; let key_id = headers .get(HEADER_KEY_ID) .and_then(|value| value.to_str().ok()) .map(|key_id| ApiKeyId::try_from(Cow::from(key_id.to_string()))) .transpose() .change_context(ApiErrorResponse::InvalidRequestData { message: format!("`{HEADER_KEY_ID}` header is invalid or not present"), })?; Ok(Self { payload_type: auth_type, merchant_id: Some(merchant_id), key_id, }) }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "ExtractedPayload", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "from_headers", "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_method_router_ExtractedPayload_verify_checksum
clm
method
// hyperswitch/crates/router/src/services/authentication/detached.rs // impl for ExtractedPayload pub fn verify_checksum( &self, headers: &HeaderMap, algo: impl VerifySignature, secret: &[u8], ) -> bool { let output = || { let checksum = headers.get(HEADER_CHECKSUM)?.to_str().ok()?; let payload = self.generate_payload(); algo.verify_signature(secret, &hex::decode(checksum).ok()?, payload.as_bytes()) .ok() }; output().unwrap_or(false) }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "ExtractedPayload", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "verify_checksum", "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_method_router_ExtractedPayload_generate_payload
clm
method
// hyperswitch/crates/router/src/services/authentication/detached.rs // impl for ExtractedPayload fn generate_payload(&self) -> String { append_option( &self.payload_type.to_string(), &self .merchant_id .as_ref() .map(|inner| append_api_key(inner.get_string_repr(), &self.key_id)), ) }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "ExtractedPayload", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "generate_payload", "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_method_router_Entity_get_entity_type
clm
method
// hyperswitch/crates/router/src/services/email/types.rs // impl for Entity pub fn get_entity_type(&self) -> EntityType { self.entity_type }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "Entity", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "get_entity_type", "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_method_router_Entity_get_entity_id
clm
method
// hyperswitch/crates/router/src/services/email/types.rs // impl for Entity pub fn get_entity_id(&self) -> &str { &self.entity_id }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "Entity", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "get_entity_id", "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_method_router_EmailToken_new_token
clm
method
// hyperswitch/crates/router/src/services/email/types.rs // impl for EmailToken pub async fn new_token( email: domain::UserEmail, entity: Option<Entity>, flow: domain::Origin, settings: &configs::Settings, ) -> UserResult<String> { let expiration_duration = std::time::Duration::from_secs(consts::EMAIL_TOKEN_TIME_IN_SECS); let exp = jwt::generate_exp(expiration_duration)?.as_secs(); let token_payload = Self { email: email.get_secret().expose(), flow, exp, entity, }; jwt::generate_jwt(&token_payload, settings).await }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "EmailToken", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "new_token", "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_method_router_EmailToken_get_email
clm
method
// hyperswitch/crates/router/src/services/email/types.rs // impl for EmailToken pub fn get_email(&self) -> UserResult<domain::UserEmail> { pii::Email::try_from(self.email.clone()) .change_context(UserErrors::InternalServerError) .and_then(domain::UserEmail::from_pii_email) }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "EmailToken", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "get_email", "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_method_router_EmailToken_get_entity
clm
method
// hyperswitch/crates/router/src/services/email/types.rs // impl for EmailToken pub fn get_entity(&self) -> Option<&Entity> { self.entity.as_ref() }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "EmailToken", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "get_entity", "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_method_router_EmailToken_get_flow
clm
method
// hyperswitch/crates/router/src/services/email/types.rs // impl for EmailToken pub fn get_flow(&self) -> domain::Origin { self.flow.clone() }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "EmailToken", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "get_flow", "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_method_router_BizEmailProd_new
clm
method
// hyperswitch/crates/router/src/services/email/types.rs // impl for BizEmailProd pub fn new( state: &SessionState, data: ProdIntent, theme_id: Option<String>, theme_config: EmailThemeConfig, ) -> UserResult<Self> { Ok(Self { recipient_email: domain::UserEmail::from_pii_email( state.conf.email.prod_intent_recipient_email.clone(), )?, settings: state.conf.clone(), user_name: data .poc_name .map(|s| Secret::new(s.peek().clone().into_inner())) .unwrap_or_default(), poc_email: data .poc_email .map(|s| Secret::new(s.peek().clone())) .unwrap_or_default(), legal_business_name: data .legal_business_name .map(|s| s.into_inner()) .unwrap_or_default(), business_location: data .business_location .unwrap_or(common_enums::CountryAlpha2::AD) .to_string(), business_website: data .business_website .map(|s| s.into_inner()) .unwrap_or_default(), theme_id, theme_config, product_type: data.product_type, }) }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "BizEmailProd", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "new", "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_fn_storage_impl_3332733565753607950
clm
function
// hyperswitch/crates/storage_impl/src/tokenization.rs async fn insert_tokenization( &self, _tokenization: hyperswitch_domain_models::tokenization::Tokenization, _merchant_key_store: &MerchantKeyStore, _key_manager_state: &KeyManagerState, ) -> CustomResult<hyperswitch_domain_models::tokenization::Tokenization, errors::StorageError> { Err(errors::StorageError::MockDbError)? }
{ "chunk": null, "crate": "storage_impl", "enum_name": null, "file_size": null, "for_type": null, "function_name": "insert_tokenization", "is_async": false, "is_pub": false, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_fn_storage_impl_-4377946749324448938
clm
function
// hyperswitch/crates/storage_impl/src/tokenization.rs async fn get_entity_id_vault_id_by_token_id( &self, _token: &common_utils::id_type::GlobalTokenId, _merchant_key_store: &MerchantKeyStore, _key_manager_state: &KeyManagerState, ) -> CustomResult<hyperswitch_domain_models::tokenization::Tokenization, errors::StorageError> { Err(errors::StorageError::MockDbError)? }
{ "chunk": null, "crate": "storage_impl", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_entity_id_vault_id_by_token_id", "is_async": false, "is_pub": false, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_fn_storage_impl_7027819012142630718
clm
function
// hyperswitch/crates/storage_impl/src/tokenization.rs async fn update_tokenization_record( &self, tokenization_record: hyperswitch_domain_models::tokenization::Tokenization, tokenization_update: hyperswitch_domain_models::tokenization::TokenizationUpdate, merchant_key_store: &MerchantKeyStore, key_manager_state: &KeyManagerState, ) -> CustomResult<hyperswitch_domain_models::tokenization::Tokenization, errors::StorageError> { Err(errors::StorageError::MockDbError)? }
{ "chunk": null, "crate": "storage_impl", "enum_name": null, "file_size": null, "for_type": null, "function_name": "update_tokenization_record", "is_async": false, "is_pub": false, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_fn_storage_impl_-2366137842997590857
clm
function
// hyperswitch/crates/storage_impl/src/mock_db.rs pub async fn new(redis: &RedisSettings) -> error_stack::Result<Self, StorageError> { Ok(Self { addresses: Default::default(), configs: Default::default(), merchant_accounts: Default::default(), merchant_connector_accounts: Default::default(), payment_attempts: Default::default(), payment_intents: Default::default(), payment_methods: Default::default(), customers: Default::default(), refunds: Default::default(), processes: Default::default(), redis: Arc::new( RedisStore::new(redis) .await .change_context(StorageError::InitializationError)?, ), api_keys: Default::default(), ephemeral_keys: Default::default(), cards_info: Default::default(), events: Default::default(), disputes: Default::default(), lockers: Default::default(), mandates: Default::default(), captures: Default::default(), merchant_key_store: Default::default(), #[cfg(all(feature = "v2", feature = "tokenization_v2"))] tokenizations: Default::default(), business_profiles: Default::default(), reverse_lookups: Default::default(), payment_link: Default::default(), organizations: Default::default(), users: Default::default(), user_roles: Default::default(), authorizations: Default::default(), dashboard_metadata: Default::default(), #[cfg(feature = "payouts")] payout_attempt: Default::default(), #[cfg(feature = "payouts")] payouts: Default::default(), authentications: Default::default(), roles: Default::default(), user_key_store: Default::default(), user_authentication_methods: Default::default(), themes: Default::default(), hyperswitch_ai_interactions: Default::default(), }) }
{ "chunk": null, "crate": "storage_impl", "enum_name": null, "file_size": null, "for_type": null, "function_name": "new", "is_async": false, "is_pub": true, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_fn_storage_impl_-1322352202995902688
clm
function
// hyperswitch/crates/storage_impl/src/mock_db.rs pub async fn find_resource<D, R>( &self, state: &KeyManagerState, key_store: &MerchantKeyStore, resources: MutexGuard<'_, Vec<D>>, filter_fn: impl Fn(&&D) -> bool, ) -> CustomResult<Option<R>, StorageError> where D: Sync + ReverseConversion<R> + Clone, R: Conversion, { let resource = resources.iter().find(filter_fn).cloned(); match resource { Some(res) => Ok(Some( res.convert( state, key_store.key.get_inner(), key_store.merchant_id.clone().into(), ) .await .change_context(StorageError::DecryptionError)?, )), None => Ok(None), } }
{ "chunk": null, "crate": "storage_impl", "enum_name": null, "file_size": null, "for_type": null, "function_name": "find_resource", "is_async": false, "is_pub": true, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_fn_storage_impl_7308687999519948312
clm
function
// hyperswitch/crates/storage_impl/src/mock_db.rs pub async fn get_resource<D, R>( &self, state: &KeyManagerState, key_store: &MerchantKeyStore, resources: MutexGuard<'_, Vec<D>>, filter_fn: impl Fn(&&D) -> bool, error_message: String, ) -> CustomResult<R, StorageError> where D: Sync + ReverseConversion<R> + Clone, R: Conversion, { match self .find_resource(state, key_store, resources, filter_fn) .await? { Some(res) => Ok(res), None => Err(StorageError::ValueNotFound(error_message).into()), } }
{ "chunk": null, "crate": "storage_impl", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_resource", "is_async": false, "is_pub": true, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_fn_storage_impl_4832741521067261725
clm
function
// hyperswitch/crates/storage_impl/src/mock_db.rs pub async fn get_resources<D, R>( &self, state: &KeyManagerState, key_store: &MerchantKeyStore, resources: MutexGuard<'_, Vec<D>>, filter_fn: impl Fn(&&D) -> bool, error_message: String, ) -> CustomResult<Vec<R>, StorageError> where D: Sync + ReverseConversion<R> + Clone, R: Conversion, { let resources: Vec<_> = resources.iter().filter(filter_fn).cloned().collect(); if resources.is_empty() { Err(StorageError::ValueNotFound(error_message).into()) } else { let pm_futures = resources .into_iter() .map(|pm| async { pm.convert( state, key_store.key.get_inner(), key_store.merchant_id.clone().into(), ) .await .change_context(StorageError::DecryptionError) }) .collect::<Vec<_>>(); let domain_resources = futures::future::try_join_all(pm_futures).await?; Ok(domain_resources) } }
{ "chunk": null, "crate": "storage_impl", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_resources", "is_async": false, "is_pub": true, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_fn_storage_impl_-5210310508120321080
clm
function
// hyperswitch/crates/storage_impl/src/mock_db.rs pub async fn update_resource<D, R>( &self, state: &KeyManagerState, key_store: &MerchantKeyStore, mut resources: MutexGuard<'_, Vec<D>>, resource_updated: D, filter_fn: impl Fn(&&mut D) -> bool, error_message: String, ) -> CustomResult<R, StorageError> where D: Sync + ReverseConversion<R> + Clone, R: Conversion, { if let Some(pm) = resources.iter_mut().find(filter_fn) { *pm = resource_updated.clone(); let result = resource_updated .convert( state, key_store.key.get_inner(), key_store.merchant_id.clone().into(), ) .await .change_context(StorageError::DecryptionError)?; Ok(result) } else { Err(StorageError::ValueNotFound(error_message).into()) } }
{ "chunk": null, "crate": "storage_impl", "enum_name": null, "file_size": null, "for_type": null, "function_name": "update_resource", "is_async": false, "is_pub": true, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_fn_storage_impl_-2207186701789150439
clm
function
// hyperswitch/crates/storage_impl/src/mock_db.rs pub fn master_key(&self) -> &[u8] { &[ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, ] }
{ "chunk": null, "crate": "storage_impl", "enum_name": null, "file_size": null, "for_type": null, "function_name": "master_key", "is_async": false, "is_pub": true, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_fn_storage_impl_5706302173169931781
clm
function
// hyperswitch/crates/storage_impl/src/callback_mapper.rs fn to_storage_model(self) -> Self::StorageModel { DieselCallbackMapper { id: self.id, type_: self.callback_mapper_id_type, data: self.data, created_at: self.created_at, last_modified_at: self.last_modified_at, } }
{ "chunk": null, "crate": "storage_impl", "enum_name": null, "file_size": null, "for_type": null, "function_name": "to_storage_model", "is_async": false, "is_pub": false, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_fn_storage_impl_7582129844680556127
clm
function
// hyperswitch/crates/storage_impl/src/callback_mapper.rs fn from_storage_model(storage_model: Self::StorageModel) -> Self { Self { id: storage_model.id, callback_mapper_id_type: storage_model.type_, data: storage_model.data, created_at: storage_model.created_at, last_modified_at: storage_model.last_modified_at, } }
{ "chunk": null, "crate": "storage_impl", "enum_name": null, "file_size": null, "for_type": null, "function_name": "from_storage_model", "is_async": false, "is_pub": false, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_fn_storage_impl_-5427538510729062530
clm
function
// hyperswitch/crates/storage_impl/src/lookup.rs async fn insert_reverse_lookup( &self, new: DieselReverseLookupNew, storage_scheme: storage_enums::MerchantStorageScheme, ) -> CustomResult<DieselReverseLookup, errors::StorageError> { let storage_scheme = Box::pin(decide_storage_scheme::<_, DieselReverseLookup>( self, storage_scheme, Op::Insert, )) .await; match storage_scheme { storage_enums::MerchantStorageScheme::PostgresOnly => { self.router_store .insert_reverse_lookup(new, storage_scheme) .await } storage_enums::MerchantStorageScheme::RedisKv => { let created_rev_lookup = DieselReverseLookup { lookup_id: new.lookup_id.clone(), sk_id: new.sk_id.clone(), pk_id: new.pk_id.clone(), source: new.source.clone(), updated_by: storage_scheme.to_string(), }; let redis_entry = kv::TypedSql { op: kv::DBOperation::Insert { insertable: Box::new(kv::Insertable::ReverseLookUp(new)), }, }; match Box::pin(kv_wrapper::<DieselReverseLookup, _, _>( self, KvOperation::SetNx(&created_rev_lookup, redis_entry), PartitionKey::CombinationKey { combination: &format!("reverse_lookup_{}", &created_rev_lookup.lookup_id), }, )) .await .map_err(|err| err.to_redis_failed_response(&created_rev_lookup.lookup_id))? .try_into_setnx() { Ok(SetnxReply::KeySet) => Ok(created_rev_lookup), Ok(SetnxReply::KeyNotSet) => Err(errors::StorageError::DuplicateValue { entity: "reverse_lookup", key: Some(created_rev_lookup.lookup_id.clone()), } .into()), Err(er) => Err(er).change_context(errors::StorageError::KVError), } } } }
{ "chunk": null, "crate": "storage_impl", "enum_name": null, "file_size": null, "for_type": null, "function_name": "insert_reverse_lookup", "is_async": false, "is_pub": false, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_fn_storage_impl_-6200364176669792224
clm
function
// hyperswitch/crates/storage_impl/src/lookup.rs async fn get_lookup_by_lookup_id( &self, id: &str, storage_scheme: storage_enums::MerchantStorageScheme, ) -> CustomResult<DieselReverseLookup, errors::StorageError> { let database_call = || async { self.router_store .get_lookup_by_lookup_id(id, storage_scheme) .await }; let storage_scheme = Box::pin(decide_storage_scheme::<_, DieselReverseLookup>( self, storage_scheme, Op::Find, )) .await; match storage_scheme { storage_enums::MerchantStorageScheme::PostgresOnly => database_call().await, storage_enums::MerchantStorageScheme::RedisKv => { let redis_fut = async { Box::pin(kv_wrapper( self, KvOperation::<DieselReverseLookup>::Get, PartitionKey::CombinationKey { combination: &format!("reverse_lookup_{id}"), }, )) .await? .try_into_get() }; Box::pin(try_redis_get_else_try_database_get( redis_fut, database_call, )) .await } } }
{ "chunk": null, "crate": "storage_impl", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_lookup_by_lookup_id", "is_async": false, "is_pub": false, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_fn_storage_impl_-7110812886846495090
clm
function
// hyperswitch/crates/storage_impl/src/merchant_account.rs async fn insert_merchant( &self, state: &KeyManagerState, merchant_account: domain::MerchantAccount, merchant_key_store: &MerchantKeyStore, ) -> CustomResult<domain::MerchantAccount, StorageError> { let mut accounts = self.merchant_accounts.lock().await; let account = Conversion::convert(merchant_account) .await .change_context(StorageError::EncryptionError)?; accounts.push(account.clone()); account .convert( state, merchant_key_store.key.get_inner(), merchant_key_store.merchant_id.clone().into(), ) .await .change_context(StorageError::DecryptionError) }
{ "chunk": null, "crate": "storage_impl", "enum_name": null, "file_size": null, "for_type": null, "function_name": "insert_merchant", "is_async": false, "is_pub": false, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_fn_storage_impl_-1780589215910913310
clm
function
// hyperswitch/crates/storage_impl/src/merchant_account.rs async fn find_merchant_account_by_merchant_id( &self, state: &KeyManagerState, merchant_id: &common_utils::id_type::MerchantId, merchant_key_store: &MerchantKeyStore, ) -> CustomResult<domain::MerchantAccount, StorageError> { let accounts = self.merchant_accounts.lock().await; accounts .iter() .find(|account| account.get_id() == merchant_id) .cloned() .ok_or(StorageError::ValueNotFound(format!( "Merchant ID: {merchant_id:?} not found", )))? .convert( state, merchant_key_store.key.get_inner(), merchant_key_store.merchant_id.clone().into(), ) .await .change_context(StorageError::DecryptionError) }
{ "chunk": null, "crate": "storage_impl", "enum_name": null, "file_size": null, "for_type": null, "function_name": "find_merchant_account_by_merchant_id", "is_async": false, "is_pub": false, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_fn_storage_impl_8205225293639448232
clm
function
// hyperswitch/crates/storage_impl/src/merchant_account.rs async fn update_merchant( &self, state: &KeyManagerState, merchant_account: domain::MerchantAccount, merchant_account_update: domain::MerchantAccountUpdate, merchant_key_store: &MerchantKeyStore, ) -> CustomResult<domain::MerchantAccount, StorageError> { let merchant_id = merchant_account.get_id().to_owned(); let mut accounts = self.merchant_accounts.lock().await; accounts .iter_mut() .find(|account| account.get_id() == merchant_account.get_id()) .async_map(|account| async { let update = MerchantAccountUpdateInternal::from(merchant_account_update) .apply_changeset( Conversion::convert(merchant_account) .await .change_context(StorageError::EncryptionError)?, ); *account = update.clone(); update .convert( state, merchant_key_store.key.get_inner(), merchant_key_store.merchant_id.clone().into(), ) .await .change_context(StorageError::DecryptionError) }) .await .transpose()? .ok_or( StorageError::ValueNotFound(format!("Merchant ID: {merchant_id:?} not found",)) .into(), ) }
{ "chunk": null, "crate": "storage_impl", "enum_name": null, "file_size": null, "for_type": null, "function_name": "update_merchant", "is_async": false, "is_pub": false, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_fn_storage_impl_-1363990219306002324
clm
function
// hyperswitch/crates/storage_impl/src/merchant_account.rs async fn update_specific_fields_in_merchant( &self, state: &KeyManagerState, merchant_id: &common_utils::id_type::MerchantId, merchant_account_update: domain::MerchantAccountUpdate, merchant_key_store: &MerchantKeyStore, ) -> CustomResult<domain::MerchantAccount, StorageError> { let mut accounts = self.merchant_accounts.lock().await; accounts .iter_mut() .find(|account| account.get_id() == merchant_id) .async_map(|account| async { let update = MerchantAccountUpdateInternal::from(merchant_account_update) .apply_changeset(account.clone()); *account = update.clone(); update .convert( state, merchant_key_store.key.get_inner(), merchant_key_store.merchant_id.clone().into(), ) .await .change_context(StorageError::DecryptionError) }) .await .transpose()? .ok_or( StorageError::ValueNotFound(format!("Merchant ID: {merchant_id:?} not found",)) .into(), ) }
{ "chunk": null, "crate": "storage_impl", "enum_name": null, "file_size": null, "for_type": null, "function_name": "update_specific_fields_in_merchant", "is_async": false, "is_pub": false, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_fn_storage_impl_-7562114981701970620
clm
function
// hyperswitch/crates/storage_impl/src/merchant_account.rs async fn find_merchant_account_by_publishable_key( &self, state: &KeyManagerState, publishable_key: &str, ) -> CustomResult<(domain::MerchantAccount, MerchantKeyStore), StorageError> { let accounts = self.merchant_accounts.lock().await; let account = accounts .iter() .find(|account| { account .publishable_key .as_ref() .is_some_and(|key| key == publishable_key) }) .ok_or(StorageError::ValueNotFound(format!( "Publishable Key: {publishable_key} not found", )))?; let key_store = self .get_merchant_key_store_by_merchant_id( state, account.get_id(), &self.get_master_key().to_vec().into(), ) .await?; let merchant_account = account .clone() .convert( state, key_store.key.get_inner(), key_store.merchant_id.clone().into(), ) .await .change_context(StorageError::DecryptionError)?; Ok((merchant_account, key_store)) }
{ "chunk": null, "crate": "storage_impl", "enum_name": null, "file_size": null, "for_type": null, "function_name": "find_merchant_account_by_publishable_key", "is_async": false, "is_pub": false, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_fn_storage_impl_5178384211042724806
clm
function
// hyperswitch/crates/storage_impl/src/merchant_account.rs async fn list_merchant_accounts_by_organization_id( &self, state: &KeyManagerState, organization_id: &common_utils::id_type::OrganizationId, ) -> CustomResult<Vec<domain::MerchantAccount>, StorageError> { let accounts = self.merchant_accounts.lock().await; let futures = accounts .iter() .filter(|account| account.organization_id == *organization_id) .map(|account| async { let key_store = self .get_merchant_key_store_by_merchant_id( state, account.get_id(), &self.get_master_key().to_vec().into(), ) .await; match key_store { Ok(key) => account .clone() .convert(state, key.key.get_inner(), key.merchant_id.clone().into()) .await .change_context(StorageError::DecryptionError), Err(err) => Err(err), } }); futures::future::join_all(futures) .await .into_iter() .collect() }
{ "chunk": null, "crate": "storage_impl", "enum_name": null, "file_size": null, "for_type": null, "function_name": "list_merchant_accounts_by_organization_id", "is_async": false, "is_pub": false, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_fn_storage_impl_-3297639959387252555
clm
function
// hyperswitch/crates/storage_impl/src/merchant_account.rs async fn delete_merchant_account_by_merchant_id( &self, merchant_id: &common_utils::id_type::MerchantId, ) -> CustomResult<bool, StorageError> { let mut accounts = self.merchant_accounts.lock().await; accounts.retain(|x| x.get_id() != merchant_id); Ok(true) }
{ "chunk": null, "crate": "storage_impl", "enum_name": null, "file_size": null, "for_type": null, "function_name": "delete_merchant_account_by_merchant_id", "is_async": false, "is_pub": false, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_fn_storage_impl_-6616523396678016513
clm
function
// hyperswitch/crates/storage_impl/src/merchant_account.rs async fn list_multiple_merchant_accounts( &self, state: &KeyManagerState, merchant_ids: Vec<common_utils::id_type::MerchantId>, ) -> CustomResult<Vec<domain::MerchantAccount>, StorageError> { let accounts = self.merchant_accounts.lock().await; let futures = accounts .iter() .filter(|account| merchant_ids.contains(account.get_id())) .map(|account| async { let key_store = self .get_merchant_key_store_by_merchant_id( state, account.get_id(), &self.get_master_key().to_vec().into(), ) .await; match key_store { Ok(key) => account .clone() .convert(state, key.key.get_inner(), key.merchant_id.clone().into()) .await .change_context(StorageError::DecryptionError), Err(err) => Err(err), } }); futures::future::join_all(futures) .await .into_iter() .collect() }
{ "chunk": null, "crate": "storage_impl", "enum_name": null, "file_size": null, "for_type": null, "function_name": "list_multiple_merchant_accounts", "is_async": false, "is_pub": false, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_fn_storage_impl_-1193598669645102513
clm
function
// hyperswitch/crates/storage_impl/src/merchant_account.rs async fn list_merchant_and_org_ids( &self, _state: &KeyManagerState, limit: u32, offset: Option<u32>, ) -> CustomResult< Vec<( common_utils::id_type::MerchantId, common_utils::id_type::OrganizationId, )>, StorageError, > { let accounts = self.merchant_accounts.lock().await; let limit = limit.try_into().unwrap_or(accounts.len()); let offset = offset.unwrap_or(0).try_into().unwrap_or(0); let merchant_and_org_ids = accounts .iter() .skip(offset) .take(limit) .map(|account| (account.get_id().clone(), account.organization_id.clone())) .collect::<Vec<_>>(); Ok(merchant_and_org_ids) }
{ "chunk": null, "crate": "storage_impl", "enum_name": null, "file_size": null, "for_type": null, "function_name": "list_merchant_and_org_ids", "is_async": false, "is_pub": false, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_fn_storage_impl_8002433208079138462
clm
function
// hyperswitch/crates/storage_impl/src/merchant_account.rs async fn update_all_merchant_account( &self, merchant_account_update: domain::MerchantAccountUpdate, ) -> CustomResult<usize, StorageError> { let mut accounts = self.merchant_accounts.lock().await; Ok(accounts.iter_mut().fold(0, |acc, account| { let update = MerchantAccountUpdateInternal::from(merchant_account_update.clone()) .apply_changeset(account.clone()); *account = update; acc + 1 })) }
{ "chunk": null, "crate": "storage_impl", "enum_name": null, "file_size": null, "for_type": null, "function_name": "update_all_merchant_account", "is_async": false, "is_pub": false, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_fn_storage_impl_7870759459716346160
clm
function
// hyperswitch/crates/storage_impl/src/merchant_account.rs async fn publish_and_redact_merchant_account_cache( store: &(dyn RedisConnInterface + Send + Sync), merchant_account: &storage::MerchantAccount, ) -> CustomResult<(), StorageError> { let publishable_key = merchant_account .publishable_key .as_ref() .map(|publishable_key| CacheKind::Accounts(publishable_key.into())); #[cfg(feature = "v1")] let cgraph_key = merchant_account.default_profile.as_ref().map(|profile_id| { CacheKind::CGraph( format!( "cgraph_{}_{}", merchant_account.get_id().get_string_repr(), profile_id.get_string_repr(), ) .into(), ) }); // TODO: we will not have default profile in v2 #[cfg(feature = "v2")] let cgraph_key = None; let mut cache_keys = vec![CacheKind::Accounts( merchant_account.get_id().get_string_repr().into(), )]; cache_keys.extend(publishable_key.into_iter()); cache_keys.extend(cgraph_key.into_iter()); cache::redact_from_redis_and_publish(store, cache_keys).await?; Ok(()) }
{ "chunk": null, "crate": "storage_impl", "enum_name": null, "file_size": null, "for_type": null, "function_name": "publish_and_redact_merchant_account_cache", "is_async": false, "is_pub": false, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_fn_storage_impl_-4084722427487368082
clm
function
// hyperswitch/crates/storage_impl/src/merchant_account.rs async fn publish_and_redact_all_merchant_account_cache( cache: &(dyn RedisConnInterface + Send + Sync), merchant_accounts: &[storage::MerchantAccount], ) -> CustomResult<(), StorageError> { let merchant_ids = merchant_accounts .iter() .map(|merchant_account| merchant_account.get_id().get_string_repr().to_string()); let publishable_keys = merchant_accounts .iter() .filter_map(|m| m.publishable_key.clone()); let cache_keys: Vec<CacheKind<'_>> = merchant_ids .chain(publishable_keys) .map(|s| CacheKind::Accounts(s.into())) .collect(); cache::redact_from_redis_and_publish(cache, cache_keys).await?; Ok(()) }
{ "chunk": null, "crate": "storage_impl", "enum_name": null, "file_size": null, "for_type": null, "function_name": "publish_and_redact_all_merchant_account_cache", "is_async": false, "is_pub": false, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_fn_storage_impl_4132474553682624774
clm
function
// hyperswitch/crates/storage_impl/src/cards_info.rs async fn get_card_info(&self, card_iin: &str) -> CustomResult<Option<CardInfo>, StorageError> { Ok(self .cards_info .lock() .await .iter() .find(|ci| ci.card_iin == card_iin) .cloned()) }
{ "chunk": null, "crate": "storage_impl", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_card_info", "is_async": false, "is_pub": false, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_fn_storage_impl_-4735786986557851562
clm
function
// hyperswitch/crates/storage_impl/src/cards_info.rs async fn add_card_info(&self, _data: CardInfo) -> CustomResult<CardInfo, StorageError> { Err(StorageError::MockDbError)? }
{ "chunk": null, "crate": "storage_impl", "enum_name": null, "file_size": null, "for_type": null, "function_name": "add_card_info", "is_async": false, "is_pub": false, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_fn_storage_impl_-7731727263841517989
clm
function
// hyperswitch/crates/storage_impl/src/cards_info.rs async fn update_card_info( &self, _card_iin: String, _data: UpdateCardInfo, ) -> CustomResult<CardInfo, StorageError> { Err(StorageError::MockDbError)? }
{ "chunk": null, "crate": "storage_impl", "enum_name": null, "file_size": null, "for_type": null, "function_name": "update_card_info", "is_async": false, "is_pub": false, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_fn_storage_impl_-7532207658890336195
clm
function
// hyperswitch/crates/storage_impl/src/payment_method.rs async fn find_payment_method( &self, state: &KeyManagerState, key_store: &MerchantKeyStore, payment_method_id: &id_type::GlobalPaymentMethodId, _storage_scheme: MerchantStorageScheme, ) -> CustomResult<DomainPaymentMethod, errors::StorageError> { let payment_methods = self.payment_methods.lock().await; self.get_resource::<PaymentMethod, _>( state, key_store, payment_methods, |pm| pm.get_id() == payment_method_id, "cannot find payment method".to_string(), ) .await }
{ "chunk": null, "crate": "storage_impl", "enum_name": null, "file_size": null, "for_type": null, "function_name": "find_payment_method", "is_async": false, "is_pub": false, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_fn_storage_impl_1092147583942796903
clm
function
// hyperswitch/crates/storage_impl/src/payment_method.rs async fn find_payment_method_by_locker_id( &self, state: &KeyManagerState, key_store: &MerchantKeyStore, locker_id: &str, _storage_scheme: MerchantStorageScheme, ) -> CustomResult<DomainPaymentMethod, errors::StorageError> { let payment_methods = self.payment_methods.lock().await; self.get_resource::<PaymentMethod, _>( state, key_store, payment_methods, |pm| pm.locker_id == Some(locker_id.to_string()), "cannot find payment method".to_string(), ) .await }
{ "chunk": null, "crate": "storage_impl", "enum_name": null, "file_size": null, "for_type": null, "function_name": "find_payment_method_by_locker_id", "is_async": false, "is_pub": false, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_fn_storage_impl_-773603190069101449
clm
function
// hyperswitch/crates/storage_impl/src/payment_method.rs async fn get_payment_method_count_by_customer_id_merchant_id_status( &self, customer_id: &id_type::CustomerId, merchant_id: &id_type::MerchantId, status: common_enums::PaymentMethodStatus, ) -> CustomResult<i64, errors::StorageError> { let payment_methods = self.payment_methods.lock().await; let count = payment_methods .iter() .filter(|pm| { pm.customer_id == *customer_id && pm.merchant_id == *merchant_id && pm.status == status }) .count(); i64::try_from(count).change_context(errors::StorageError::MockDbError) }
{ "chunk": null, "crate": "storage_impl", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_payment_method_count_by_customer_id_merchant_id_status", "is_async": false, "is_pub": false, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_fn_storage_impl_8708921875742506578
clm
function
// hyperswitch/crates/storage_impl/src/payment_method.rs async fn get_payment_method_count_by_merchant_id_status( &self, merchant_id: &id_type::MerchantId, status: common_enums::PaymentMethodStatus, ) -> CustomResult<i64, errors::StorageError> { let payment_methods = self.payment_methods.lock().await; let count = payment_methods .iter() .filter(|pm| pm.merchant_id == *merchant_id && pm.status == status) .count(); i64::try_from(count).change_context(errors::StorageError::MockDbError) }
{ "chunk": null, "crate": "storage_impl", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_payment_method_count_by_merchant_id_status", "is_async": false, "is_pub": false, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_fn_storage_impl_993347225740022209
clm
function
// hyperswitch/crates/storage_impl/src/payment_method.rs async fn insert_payment_method( &self, _state: &KeyManagerState, _key_store: &MerchantKeyStore, payment_method: DomainPaymentMethod, _storage_scheme: MerchantStorageScheme, ) -> CustomResult<DomainPaymentMethod, errors::StorageError> { let mut payment_methods = self.payment_methods.lock().await; let pm = Conversion::convert(payment_method.clone()) .await .change_context(errors::StorageError::DecryptionError)?; payment_methods.push(pm); Ok(payment_method) }
{ "chunk": null, "crate": "storage_impl", "enum_name": null, "file_size": null, "for_type": null, "function_name": "insert_payment_method", "is_async": false, "is_pub": false, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_fn_storage_impl_3009450404400746228
clm
function
// hyperswitch/crates/storage_impl/src/payment_method.rs async fn update_payment_method( &self, state: &KeyManagerState, key_store: &MerchantKeyStore, payment_method: DomainPaymentMethod, payment_method_update: PaymentMethodUpdate, _storage_scheme: MerchantStorageScheme, ) -> CustomResult<DomainPaymentMethod, errors::StorageError> { let payment_method_updated = PaymentMethodUpdateInternal::from(payment_method_update) .apply_changeset( Conversion::convert(payment_method.clone()) .await .change_context(errors::StorageError::EncryptionError)?, ); self.update_resource::<PaymentMethod, _>( state, key_store, self.payment_methods.lock().await, payment_method_updated, |pm| pm.get_id() == payment_method.get_id(), "cannot update payment method".to_string(), ) .await }
{ "chunk": null, "crate": "storage_impl", "enum_name": null, "file_size": null, "for_type": null, "function_name": "update_payment_method", "is_async": false, "is_pub": false, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_fn_storage_impl_-7746357020830984659
clm
function
// hyperswitch/crates/storage_impl/src/payment_method.rs async fn find_payment_method_by_customer_id_merchant_id_list( &self, state: &KeyManagerState, key_store: &MerchantKeyStore, customer_id: &id_type::CustomerId, merchant_id: &id_type::MerchantId, _limit: Option<i64>, ) -> CustomResult<Vec<DomainPaymentMethod>, errors::StorageError> { let payment_methods = self.payment_methods.lock().await; self.get_resources( state, key_store, payment_methods, |pm| pm.customer_id == *customer_id && pm.merchant_id == *merchant_id, "cannot find payment method".to_string(), ) .await }
{ "chunk": null, "crate": "storage_impl", "enum_name": null, "file_size": null, "for_type": null, "function_name": "find_payment_method_by_customer_id_merchant_id_list", "is_async": false, "is_pub": false, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_fn_storage_impl_-5270069393875297081
clm
function
// hyperswitch/crates/storage_impl/src/payment_method.rs async fn find_payment_method_list_by_global_customer_id( &self, _state: &KeyManagerState, _key_store: &MerchantKeyStore, _id: &id_type::GlobalCustomerId, _limit: Option<i64>, ) -> CustomResult<Vec<DomainPaymentMethod>, errors::StorageError> { todo!() }
{ "chunk": null, "crate": "storage_impl", "enum_name": null, "file_size": null, "for_type": null, "function_name": "find_payment_method_list_by_global_customer_id", "is_async": false, "is_pub": false, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_fn_storage_impl_5168888004366980338
clm
function
// hyperswitch/crates/storage_impl/src/payment_method.rs async fn find_payment_method_by_customer_id_merchant_id_status( &self, state: &KeyManagerState, key_store: &MerchantKeyStore, customer_id: &id_type::CustomerId, merchant_id: &id_type::MerchantId, status: common_enums::PaymentMethodStatus, _limit: Option<i64>, _storage_scheme: MerchantStorageScheme, ) -> CustomResult<Vec<DomainPaymentMethod>, errors::StorageError> { let payment_methods = self.payment_methods.lock().await; self.get_resources( state, key_store, payment_methods, |pm| { pm.customer_id == *customer_id && pm.merchant_id == *merchant_id && pm.status == status }, "cannot find payment method".to_string(), ) .await }
{ "chunk": null, "crate": "storage_impl", "enum_name": null, "file_size": null, "for_type": null, "function_name": "find_payment_method_by_customer_id_merchant_id_status", "is_async": false, "is_pub": false, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_fn_storage_impl_-6807731826990074454
clm
function
// hyperswitch/crates/storage_impl/src/payment_method.rs async fn find_payment_method_by_global_customer_id_merchant_id_status( &self, state: &KeyManagerState, key_store: &MerchantKeyStore, customer_id: &id_type::GlobalCustomerId, merchant_id: &id_type::MerchantId, status: common_enums::PaymentMethodStatus, _limit: Option<i64>, _storage_scheme: MerchantStorageScheme, ) -> CustomResult<Vec<DomainPaymentMethod>, errors::StorageError> { let payment_methods = self.payment_methods.lock().await; let find_pm_by = |pm: &&PaymentMethod| { pm.customer_id == *customer_id && pm.merchant_id == *merchant_id && pm.status == status }; let error_message = "cannot find payment method".to_string(); self.get_resources(state, key_store, payment_methods, find_pm_by, error_message) .await }
{ "chunk": null, "crate": "storage_impl", "enum_name": null, "file_size": null, "for_type": null, "function_name": "find_payment_method_by_global_customer_id_merchant_id_status", "is_async": false, "is_pub": false, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_fn_storage_impl_-7341525787697999652
clm
function
// hyperswitch/crates/storage_impl/src/payment_method.rs async fn delete_payment_method_by_merchant_id_payment_method_id( &self, state: &KeyManagerState, key_store: &MerchantKeyStore, merchant_id: &id_type::MerchantId, payment_method_id: &str, ) -> CustomResult<DomainPaymentMethod, errors::StorageError> { let mut payment_methods = self.payment_methods.lock().await; match payment_methods .iter() .position(|pm| pm.merchant_id == *merchant_id && pm.get_id() == payment_method_id) { Some(index) => { let deleted_payment_method = payment_methods.remove(index); Ok(deleted_payment_method .convert( state, key_store.key.get_inner(), key_store.merchant_id.clone().into(), ) .await .change_context(errors::StorageError::DecryptionError)?) } None => Err(errors::StorageError::ValueNotFound( "cannot find payment method to delete".to_string(), ) .into()), } }
{ "chunk": null, "crate": "storage_impl", "enum_name": null, "file_size": null, "for_type": null, "function_name": "delete_payment_method_by_merchant_id_payment_method_id", "is_async": false, "is_pub": false, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_fn_storage_impl_2509904214363360845
clm
function
// hyperswitch/crates/storage_impl/src/payment_method.rs async fn delete_payment_method( &self, state: &KeyManagerState, key_store: &MerchantKeyStore, payment_method: DomainPaymentMethod, ) -> CustomResult<DomainPaymentMethod, errors::StorageError> { let payment_method_update = PaymentMethodUpdate::StatusUpdate { status: Some(common_enums::PaymentMethodStatus::Inactive), }; let payment_method_updated = PaymentMethodUpdateInternal::from(payment_method_update) .apply_changeset( Conversion::convert(payment_method.clone()) .await .change_context(errors::StorageError::EncryptionError)?, ); self.update_resource::<PaymentMethod, _>( state, key_store, self.payment_methods.lock().await, payment_method_updated, |pm| pm.get_id() == payment_method.get_id(), "cannot find payment method".to_string(), ) .await }
{ "chunk": null, "crate": "storage_impl", "enum_name": null, "file_size": null, "for_type": null, "function_name": "delete_payment_method", "is_async": false, "is_pub": false, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_fn_storage_impl_-8790022589464836293
clm
function
// hyperswitch/crates/storage_impl/src/payment_method.rs async fn find_payment_method_by_fingerprint_id( &self, state: &KeyManagerState, key_store: &MerchantKeyStore, fingerprint_id: &str, ) -> CustomResult<DomainPaymentMethod, errors::StorageError> { let payment_methods = self.payment_methods.lock().await; self.get_resource::<PaymentMethod, _>( state, key_store, payment_methods, |pm| pm.locker_fingerprint_id == Some(fingerprint_id.to_string()), "cannot find payment method".to_string(), ) .await }
{ "chunk": null, "crate": "storage_impl", "enum_name": null, "file_size": null, "for_type": null, "function_name": "find_payment_method_by_fingerprint_id", "is_async": false, "is_pub": false, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_fn_storage_impl_-7077059613575482562
clm
function
// hyperswitch/crates/storage_impl/src/merchant_connector_account.rs async fn find_merchant_connector_account_by_merchant_id_connector_label( &self, state: &KeyManagerState, merchant_id: &common_utils::id_type::MerchantId, connector: &str, key_store: &MerchantKeyStore, ) -> CustomResult<domain::MerchantConnectorAccount, StorageError> { match self .merchant_connector_accounts .lock() .await .iter() .find(|account| { account.merchant_id == *merchant_id && account.connector_label == Some(connector.to_string()) }) .cloned() .async_map(|account| async { account .convert( state, key_store.key.get_inner(), key_store.merchant_id.clone().into(), ) .await .change_context(StorageError::DecryptionError) }) .await { Some(result) => result, None => { return Err(StorageError::ValueNotFound( "cannot find merchant connector account".to_string(), ) .into()) } } }
{ "chunk": null, "crate": "storage_impl", "enum_name": null, "file_size": null, "for_type": null, "function_name": "find_merchant_connector_account_by_merchant_id_connector_label", "is_async": false, "is_pub": false, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_fn_storage_impl_2983762015025110709
clm
function
// hyperswitch/crates/storage_impl/src/merchant_connector_account.rs async fn find_merchant_connector_account_by_profile_id_connector_name( &self, state: &KeyManagerState, profile_id: &common_utils::id_type::ProfileId, connector_name: &str, key_store: &MerchantKeyStore, ) -> CustomResult<domain::MerchantConnectorAccount, StorageError> { let maybe_mca = self .merchant_connector_accounts .lock() .await .iter() .find(|account| { account.profile_id.eq(&Some(profile_id.to_owned())) && account.connector_name == connector_name }) .cloned(); match maybe_mca { Some(mca) => mca .to_owned() .convert( state, key_store.key.get_inner(), key_store.merchant_id.clone().into(), ) .await .change_context(StorageError::DecryptionError), None => Err(StorageError::ValueNotFound( "cannot find merchant connector account".to_string(), ) .into()), } }
{ "chunk": null, "crate": "storage_impl", "enum_name": null, "file_size": null, "for_type": null, "function_name": "find_merchant_connector_account_by_profile_id_connector_name", "is_async": false, "is_pub": false, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
hyperswitch_fn_storage_impl_4901722361213452326
clm
function
// hyperswitch/crates/storage_impl/src/merchant_connector_account.rs async fn find_merchant_connector_account_by_merchant_id_connector_name( &self, state: &KeyManagerState, merchant_id: &common_utils::id_type::MerchantId, connector_name: &str, key_store: &MerchantKeyStore, ) -> CustomResult<Vec<domain::MerchantConnectorAccount>, StorageError> { let accounts = self .merchant_connector_accounts .lock() .await .iter() .filter(|account| { account.merchant_id == *merchant_id && account.connector_name == connector_name }) .cloned() .collect::<Vec<_>>(); let mut output = Vec::with_capacity(accounts.len()); for account in accounts.into_iter() { output.push( account .convert( state, key_store.key.get_inner(), key_store.merchant_id.clone().into(), ) .await .change_context(StorageError::DecryptionError)?, ) } Ok(output) }
{ "chunk": null, "crate": "storage_impl", "enum_name": null, "file_size": null, "for_type": null, "function_name": "find_merchant_connector_account_by_merchant_id_connector_name", "is_async": false, "is_pub": false, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "hyperswitch", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }