id
stringlengths
20
153
type
stringclasses
1 value
granularity
stringclasses
14 values
content
stringlengths
16
84.3k
metadata
dict
hyperswitch_method_router_RoutingEventsResponse<Res>_set_response
clm
method
// hyperswitch/crates/router/src/core/payments/routing/utils.rs // impl for RoutingEventsResponse<Res> pub fn set_response(&mut self, response: Res) { self.response = Some(response); }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "RoutingEventsResponse<Res>", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "set_response", "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_RoutingEventsResponse<Res>_set_event
clm
method
// hyperswitch/crates/router/src/core/payments/routing/utils.rs // impl for RoutingEventsResponse<Res> pub fn set_event(&mut self, event: routing_events::RoutingEvent) { self.event = Some(event); }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "RoutingEventsResponse<Res>", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "set_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_RoutingEventsWrapper<Req>_new
clm
method
// hyperswitch/crates/router/src/core/payments/routing/utils.rs // impl for RoutingEventsWrapper<Req> pub fn new( tenant_id: id_type::TenantId, request_id: Option<RequestId>, payment_id: String, profile_id: id_type::ProfileId, merchant_id: id_type::MerchantId, flow: String, request: Option<Req>, parse_response: bool, log_event: bool, ) -> Self { Self { tenant_id, request_id, payment_id, profile_id, merchant_id, flow, request, parse_response, log_event, routing_event: None, } }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "RoutingEventsWrapper<Req>", "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_RoutingEventsWrapper<Req>_construct_event_builder
clm
method
// hyperswitch/crates/router/src/core/payments/routing/utils.rs // impl for RoutingEventsWrapper<Req> pub fn construct_event_builder( self, url: String, routing_engine: routing_events::RoutingEngine, method: routing_events::ApiMethod, ) -> RoutingResult<Self> { let mut wrapper = self; let request = wrapper .request .clone() .ok_or(errors::RoutingError::RoutingEventsError { message: "Request body is missing".to_string(), status_code: 400, })?; let serialized_request = serde_json::to_value(&request) .change_context(errors::RoutingError::RoutingEventsError { message: "Failed to serialize RoutingRequest".to_string(), status_code: 500, }) .attach_printable("Failed to serialize request body")?; let routing_event = routing_events::RoutingEvent::new( wrapper.tenant_id.clone(), "".to_string(), &wrapper.flow, serialized_request, url, method, wrapper.payment_id.clone(), wrapper.profile_id.clone(), wrapper.merchant_id.clone(), wrapper.request_id, routing_engine, ); wrapper.set_routing_event(routing_event); Ok(wrapper) }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "RoutingEventsWrapper<Req>", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "construct_event_builder", "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_RoutingEventsWrapper<Req>_trigger_event
clm
method
// hyperswitch/crates/router/src/core/payments/routing/utils.rs // impl for RoutingEventsWrapper<Req> pub async fn trigger_event<Res, F, Fut>( self, state: &SessionState, func: F, ) -> RoutingResult<RoutingEventsResponse<Res>> where F: FnOnce() -> Fut + Send, Res: Serialize + serde::de::DeserializeOwned + Clone, Fut: futures::Future<Output = RoutingResult<Option<Res>>> + Send, { let mut routing_event = self.routing_event .ok_or(errors::RoutingError::RoutingEventsError { message: "Routing event is missing".to_string(), status_code: 500, })?; let mut response = RoutingEventsResponse::new(None, None); let resp = func().await; match resp { Ok(ok_resp) => { if let Some(resp) = ok_resp { routing_event.set_response_body(&resp); // routing_event // .set_routable_connectors(ok_resp.get_routable_connectors().unwrap_or_default()); // routing_event.set_payment_connector(ok_resp.get_payment_connector()); routing_event.set_status_code(200); response.set_response(resp.clone()); self.log_event .then(|| state.event_handler().log_event(&routing_event)); } } Err(err) => { // Need to figure out a generic way to log errors routing_event .set_error(serde_json::json!({"error": err.current_context().to_string()})); match err.current_context() { errors::RoutingError::RoutingEventsError { status_code, .. } => { routing_event.set_status_code(*status_code); } _ => { routing_event.set_status_code(500); } } state.event_handler().log_event(&routing_event) } } response.set_event(routing_event); Ok(response) }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "RoutingEventsWrapper<Req>", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "trigger_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_RoutingEventsWrapper<Req>_set_log_event
clm
method
// hyperswitch/crates/router/src/core/payments/routing/utils.rs // impl for RoutingEventsWrapper<Req> pub fn set_log_event(&mut self, log_event: bool) { self.log_event = log_event; }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "RoutingEventsWrapper<Req>", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "set_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_RoutingEventsWrapper<Req>_set_request_body
clm
method
// hyperswitch/crates/router/src/core/payments/routing/utils.rs // impl for RoutingEventsWrapper<Req> pub fn set_request_body(&mut self, request: Req) { self.request = Some(request); }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "RoutingEventsWrapper<Req>", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "set_request_body", "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_RoutingEventsWrapper<Req>_set_routing_event
clm
method
// hyperswitch/crates/router/src/core/payments/routing/utils.rs // impl for RoutingEventsWrapper<Req> pub fn set_routing_event(&mut self, routing_event: routing_events::RoutingEvent) { self.routing_event = Some(routing_event); }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "RoutingEventsWrapper<Req>", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "set_routing_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_RoutingApproach_from_decision_engine_approach
clm
method
// hyperswitch/crates/api_models/src/routing.rs // impl for RoutingApproach pub fn from_decision_engine_approach(approach: &str) -> Self { match approach { "SR_SELECTION_V3_ROUTING" => Self::Exploitation, "SR_V3_HEDGING" => Self::Exploration, _ => Self::Default, } }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "RoutingApproach", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "from_decision_engine_approach", "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_RoutingApproach_from_decision_engine_approach
clm
method
// hyperswitch/crates/router/src/core/payments/routing/utils.rs // impl for RoutingApproach pub fn from_decision_engine_approach(approach: &str) -> Self { match approach { "SR_SELECTION_V3_ROUTING" => Self::Exploitation, "SR_V3_HEDGING" => Self::Exploration, _ => Self::Default, } }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "RoutingApproach", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "from_decision_engine_approach", "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_ProxyRequestWrapper_get_proxy_record
clm
method
// hyperswitch/crates/router/src/core/proxy/utils.rs // impl for ProxyRequestWrapper pub async fn get_proxy_record( &self, state: &SessionState, key_store: &domain::MerchantKeyStore, storage_scheme: common_enums::enums::MerchantStorageScheme, ) -> RouterResult<ProxyRecord> { let token = &self.0.token; match self.0.token_type { proxy_api_models::TokenType::PaymentMethodId => { let pm_id = PaymentMethodId { payment_method_id: token.clone(), }; let pm_id = id_type::GlobalPaymentMethodId::generate_from_string(pm_id.payment_method_id) .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable("Unable to generate GlobalPaymentMethodId")?; let payment_method_record = state .store .find_payment_method(&((state).into()), key_store, &pm_id, storage_scheme) .await .change_context(errors::ApiErrorResponse::PaymentMethodNotFound)?; Ok(ProxyRecord::PaymentMethodRecord(Box::new( payment_method_record, ))) } proxy_api_models::TokenType::TokenizationId => { let token_id = id_type::GlobalTokenId::from_string(token.clone().as_str()) .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable( "Error while coneverting from string to GlobalTokenId type", )?; let db = state.store.as_ref(); let key_manager_state = &(state).into(); let tokenization_record = db .get_entity_id_vault_id_by_token_id(&token_id, key_store, key_manager_state) .await .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable("Error while fetching tokenization record from vault")?; Ok(ProxyRecord::TokenizationRecord(Box::new( tokenization_record, ))) } } }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "ProxyRequestWrapper", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "get_proxy_record", "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_ProxyRequestWrapper_get_headers
clm
method
// hyperswitch/crates/router/src/core/proxy/utils.rs // impl for ProxyRequestWrapper pub fn get_headers(&self) -> Vec<(String, masking::Maskable<String>)> { self.0 .headers .as_map() .iter() .map(|(key, value)| (key.clone(), value.clone().into_masked())) .collect() }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "ProxyRequestWrapper", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "get_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_ProxyRequestWrapper_get_destination_url
clm
method
// hyperswitch/crates/router/src/core/proxy/utils.rs // impl for ProxyRequestWrapper pub fn get_destination_url(&self) -> &str { self.0.destination_url.as_str() }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "ProxyRequestWrapper", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "get_destination_url", "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_ProxyRequestWrapper_get_method
clm
method
// hyperswitch/crates/router/src/core/proxy/utils.rs // impl for ProxyRequestWrapper pub fn get_method(&self) -> common_utils::request::Method { self.0.method }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "ProxyRequestWrapper", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "get_method", "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_ProxyRecord_get_vault_id
clm
method
// hyperswitch/crates/router/src/core/proxy/utils.rs // impl for ProxyRecord fn get_vault_id(&self) -> RouterResult<payment_methods::VaultId> { match self { Self::PaymentMethodRecord(payment_method) => payment_method .locker_id .clone() .get_required_value("vault_id") .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable("Locker id not present in Payment Method Entry"), Self::TokenizationRecord(tokenization_record) => Ok( payment_methods::VaultId::generate(tokenization_record.locker_id.clone()), ), } }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "ProxyRecord", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "get_vault_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_ProxyRecord_get_customer_id
clm
method
// hyperswitch/crates/router/src/core/proxy/utils.rs // impl for ProxyRecord fn get_customer_id(&self) -> id_type::GlobalCustomerId { match self { Self::PaymentMethodRecord(payment_method) => payment_method.customer_id.clone(), Self::TokenizationRecord(tokenization_record) => { tokenization_record.customer_id.clone() } } }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "ProxyRecord", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "get_customer_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_ProxyRecord_get_vault_data
clm
method
// hyperswitch/crates/router/src/core/proxy/utils.rs // impl for ProxyRecord pub async fn get_vault_data( &self, state: &SessionState, merchant_context: domain::MerchantContext, ) -> RouterResult<Value> { match self { Self::PaymentMethodRecord(_) => { let vault_resp = vault::retrieve_payment_method_from_vault_internal( state, &merchant_context, &self.get_vault_id()?, &self.get_customer_id(), ) .await .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable("Error while fetching data from vault")?; Ok(vault_resp .data .encode_to_value() .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable("Failed to serialize vault data")?) } Self::TokenizationRecord(_) => { let vault_request = pm_types::VaultRetrieveRequest { entity_id: self.get_customer_id(), vault_id: self.get_vault_id()?, }; let vault_data = vault::retrieve_value_from_vault(state, vault_request) .await .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable("Failed to retrieve vault data")?; Ok(vault_data.get("data").cloned().unwrap_or(Value::Null)) } } }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "ProxyRecord", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "get_vault_data", "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_Decision_get_decision_based_on_params
clm
method
// hyperswitch/crates/router/src/core/revenue_recovery/types.rs // impl for Decision pub async fn get_decision_based_on_params( state: &SessionState, intent_status: enums::IntentStatus, called_connector: enums::PaymentConnectorTransmission, active_attempt_id: Option<id_type::GlobalAttemptId>, revenue_recovery_data: &storage::revenue_recovery::RevenueRecoveryPaymentData, payment_id: &id_type::GlobalPaymentId, ) -> RecoveryResult<Self> { logger::info!("Entering get_decision_based_on_params"); Ok(match (intent_status, called_connector, active_attempt_id) { ( enums::IntentStatus::Failed, enums::PaymentConnectorTransmission::ConnectorCallUnsuccessful, None, ) => Self::Execute, ( enums::IntentStatus::Processing, enums::PaymentConnectorTransmission::ConnectorCallSucceeded, Some(_), ) => { let psync_data = revenue_recovery_core::api::call_psync_api( state, payment_id, revenue_recovery_data, true, true, ) .await .change_context(errors::RecoveryError::PaymentCallFailed) .attach_printable("Error while executing the Psync call")?; let payment_attempt = psync_data.payment_attempt; Self::Psync(payment_attempt.status, payment_attempt.get_id().clone()) } ( enums::IntentStatus::Failed, enums::PaymentConnectorTransmission::ConnectorCallUnsuccessful, Some(_), ) => { let psync_data = revenue_recovery_core::api::call_psync_api( state, payment_id, revenue_recovery_data, true, true, ) .await .change_context(errors::RecoveryError::PaymentCallFailed) .attach_printable("Error while executing the Psync call")?; let payment_attempt = psync_data.payment_attempt; let attempt_triggered_by = payment_attempt .feature_metadata .and_then(|metadata| { metadata.revenue_recovery.map(|revenue_recovery_metadata| { revenue_recovery_metadata.attempt_triggered_by }) }) .get_required_value("Attempt Triggered By") .change_context(errors::RecoveryError::ValueNotFound)?; Self::ReviewForFailedPayment(attempt_triggered_by) } (enums::IntentStatus::Succeeded, _, _) => Self::ReviewForSuccessfulPayment, _ => Self::InvalidDecision, }) }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "Decision", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "get_decision_based_on_params", "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_RoutingDecisionData_apply_routing_decision
clm
method
// hyperswitch/crates/router/src/core/routing/helpers.rs // impl for RoutingDecisionData pub fn apply_routing_decision<F, D>(&self, payment_data: &mut D) where F: Send + Clone, D: OperationSessionGetters<F> + OperationSessionSetters<F> + Send + Sync + Clone, { match self { Self::DebitRouting(data) => data.apply_debit_routing_decision(payment_data), } }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "RoutingDecisionData", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "apply_routing_decision", "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_RoutingDecisionData_get_debit_routing_decision_data
clm
method
// hyperswitch/crates/router/src/core/routing/helpers.rs // impl for RoutingDecisionData pub fn get_debit_routing_decision_data( network: common_enums::enums::CardNetwork, debit_routing_result: Option<open_router::DebitRoutingOutput>, ) -> Self { Self::DebitRouting(DebitRoutingDecisionData { card_network: network, debit_routing_result, }) }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "RoutingDecisionData", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "get_debit_routing_decision_data", "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_DebitRoutingDecisionData_apply_debit_routing_decision
clm
method
// hyperswitch/crates/router/src/core/routing/helpers.rs // impl for DebitRoutingDecisionData pub fn apply_debit_routing_decision<F, D>(&self, payment_data: &mut D) where F: Send + Clone, D: OperationSessionGetters<F> + OperationSessionSetters<F> + Send + Sync + Clone, { payment_data.set_card_network(self.card_network.clone()); self.debit_routing_result .as_ref() .map(|data| payment_data.set_co_badged_card_data(data)); }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "DebitRoutingDecisionData", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "apply_debit_routing_decision", "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_ChatErrors_get_error_message
clm
method
// hyperswitch/crates/router/src/core/errors/chat.rs // impl for ChatErrors pub fn get_error_message(&self) -> String { match self { Self::InternalServerError => "Something went wrong".to_string(), Self::MissingConfigError => "Missing webhook url".to_string(), Self::ChatResponseDeserializationFailed => "Failed to parse chat response".to_string(), Self::UnauthorizedAccess => "Not authorized to access the resource".to_string(), } }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "ChatErrors", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "get_error_message", "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_WebhookResponse_get_outgoing_webhook_response_content
clm
method
// hyperswitch/crates/router/src/core/webhooks/types.rs // impl for WebhookResponse pub async fn get_outgoing_webhook_response_content( self, ) -> webhook_events::OutgoingWebhookResponseContent { let status_code = self.response.status(); let response_headers = self .response .headers() .iter() .map(|(name, value)| { ( name.as_str().to_owned(), value .to_str() .map(|s| Secret::from(String::from(s))) .unwrap_or_else(|error| { logger::warn!( "Response header {} contains non-UTF-8 characters: {error:?}", name.as_str() ); Secret::from(String::from("Non-UTF-8 header value")) }), ) }) .collect::<Vec<_>>(); let response_body = self .response .text() .await .map(Secret::from) .unwrap_or_else(|error| { logger::warn!("Response contains non-UTF-8 characters: {error:?}"); Secret::from(String::from("Non-UTF-8 response body")) }); webhook_events::OutgoingWebhookResponseContent { body: Some(response_body), headers: Some(response_headers), status_code: Some(status_code.as_u16()), error_message: None, } }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "WebhookResponse", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "get_outgoing_webhook_response_content", "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_NetworkTokenWebhookResponse_get_network_token_requestor_ref_id
clm
method
// hyperswitch/crates/router/src/core/webhooks/network_tokenization_incoming.rs // impl for NetworkTokenWebhookResponse fn get_network_token_requestor_ref_id(&self) -> String { match self { Self::PanMetadataUpdate(data) => data.card.card_reference.clone(), Self::NetworkTokenMetadataUpdate(data) => data.token.card_reference.clone(), } }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "NetworkTokenWebhookResponse", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "get_network_token_requestor_ref_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_NetworkTokenWebhookResponse_get_response_data
clm
method
// hyperswitch/crates/router/src/core/webhooks/network_tokenization_incoming.rs // impl for NetworkTokenWebhookResponse pub fn get_response_data(self) -> Box<dyn NetworkTokenWebhookResponseExt> { match self { Self::PanMetadataUpdate(data) => Box::new(data), Self::NetworkTokenMetadataUpdate(data) => Box::new(data), } }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "NetworkTokenWebhookResponse", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "get_response_data", "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_NetworkTokenWebhookResponse_fetch_merchant_id_payment_method_id_customer_id_from_callback_mapper
clm
method
// hyperswitch/crates/router/src/core/webhooks/network_tokenization_incoming.rs // impl for NetworkTokenWebhookResponse pub async fn fetch_merchant_id_payment_method_id_customer_id_from_callback_mapper( &self, state: &SessionState, ) -> RouterResult<(id_type::MerchantId, String, id_type::CustomerId)> { let network_token_requestor_ref_id = &self.get_network_token_requestor_ref_id(); let db = &*state.store; let callback_mapper_data = db .find_call_back_mapper_by_id(network_token_requestor_ref_id) .await .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable("Failed to fetch callback mapper data")?; Ok(callback_mapper_data .data .get_network_token_webhook_details()) }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "NetworkTokenWebhookResponse", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "fetch_merchant_id_payment_method_id_customer_id_from_callback_mapper", "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_Authorization_new
clm
method
// hyperswitch/crates/router/src/core/webhooks/network_tokenization_incoming.rs // impl for Authorization pub fn new(header: Option<&HeaderValue>) -> Self { Self { header: header.cloned(), } }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "Authorization", "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_Authorization_verify_webhook_source
clm
method
// hyperswitch/crates/router/src/core/webhooks/network_tokenization_incoming.rs // impl for Authorization pub async fn verify_webhook_source( self, nt_service: &settings::NetworkTokenizationService, ) -> CustomResult<(), errors::ApiErrorResponse> { let secret = nt_service.webhook_source_verification_key.clone(); let source_verified = match self.header { Some(authorization_header) => match authorization_header.to_str() { Ok(header_value) => Ok(header_value == secret.expose()), Err(err) => { logger::error!(?err, "Failed to parse authorization header"); Err(errors::ApiErrorResponse::WebhookAuthenticationFailed) } }, None => Ok(false), }?; logger::info!(source_verified=?source_verified); helper_utils::when(!source_verified, || { Err(report!( errors::ApiErrorResponse::WebhookAuthenticationFailed )) })?; Ok(()) }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "Authorization", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "verify_webhook_source", "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_PaymentMethodCreateWrapper_get_inner
clm
method
// hyperswitch/crates/router/src/core/webhooks/network_tokenization_incoming.rs // impl for PaymentMethodCreateWrapper fn get_inner(self) -> api::payment_methods::PaymentMethodCreate { self.0 }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "PaymentMethodCreateWrapper", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "get_inner", "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_RevenueRecoveryInvoice_get_or_create_custom_recovery_intent
clm
method
// hyperswitch/crates/router/src/core/webhooks/recovery_incoming.rs // impl for RevenueRecoveryInvoice pub async fn get_or_create_custom_recovery_intent( data: api_models::payments::RecoveryPaymentsCreate, state: &SessionState, req_state: &ReqState, merchant_context: &domain::MerchantContext, profile: &domain::Profile, ) -> CustomResult<revenue_recovery::RecoveryPaymentIntent, errors::RevenueRecoveryError> { let recovery_intent = Self(revenue_recovery::RevenueRecoveryInvoiceData::foreign_from( data, )); recovery_intent .get_payment_intent(state, req_state, merchant_context, profile) .await .transpose() .async_unwrap_or_else(|| async { recovery_intent .create_payment_intent(state, req_state, merchant_context, profile) .await }) .await }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "RevenueRecoveryInvoice", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "get_or_create_custom_recovery_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_RevenueRecoveryInvoice_get_recovery_invoice_details
clm
method
// hyperswitch/crates/router/src/core/webhooks/recovery_incoming.rs // impl for RevenueRecoveryInvoice fn get_recovery_invoice_details( connector_enum: &connector_integration_interface::ConnectorEnum, request_details: &hyperswitch_interfaces::webhooks::IncomingWebhookRequestDetails<'_>, billing_connector_invoice_details: Option< &revenue_recovery_response::BillingConnectorInvoiceSyncResponse, >, ) -> CustomResult<Self, errors::RevenueRecoveryError> { billing_connector_invoice_details.map_or_else( || { interface_webhooks::IncomingWebhook::get_revenue_recovery_invoice_details( connector_enum, request_details, ) .change_context(errors::RevenueRecoveryError::InvoiceWebhookProcessingFailed) .attach_printable("Failed while getting revenue recovery invoice details") .map(RevenueRecoveryInvoice) }, |data| { Ok(Self(revenue_recovery::RevenueRecoveryInvoiceData::from( data, ))) }, ) }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "RevenueRecoveryInvoice", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "get_recovery_invoice_details", "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_RevenueRecoveryInvoice_get_payment_intent
clm
method
// hyperswitch/crates/router/src/core/webhooks/recovery_incoming.rs // impl for RevenueRecoveryInvoice async fn get_payment_intent( &self, state: &SessionState, req_state: &ReqState, merchant_context: &domain::MerchantContext, profile: &domain::Profile, ) -> CustomResult<Option<revenue_recovery::RecoveryPaymentIntent>, errors::RevenueRecoveryError> { let payment_response = Box::pin(payments::payments_get_intent_using_merchant_reference( state.clone(), merchant_context.clone(), profile.clone(), req_state.clone(), &self.0.merchant_reference_id, hyperswitch_domain_models::payments::HeaderPayload::default(), )) .await; let response = match payment_response { Ok(services::ApplicationResponse::JsonWithHeaders((payments_response, _))) => { let payment_id = payments_response.id.clone(); let status = payments_response.status; let feature_metadata = payments_response.feature_metadata; let merchant_id = merchant_context.get_merchant_account().get_id().clone(); let revenue_recovery_invoice_data = &self.0; Ok(Some(revenue_recovery::RecoveryPaymentIntent { payment_id, status, feature_metadata, merchant_id, merchant_reference_id: Some( revenue_recovery_invoice_data.merchant_reference_id.clone(), ), invoice_amount: revenue_recovery_invoice_data.amount, invoice_currency: revenue_recovery_invoice_data.currency, created_at: revenue_recovery_invoice_data.billing_started_at, billing_address: revenue_recovery_invoice_data.billing_address.clone(), })) } Err(err) if matches!( err.current_context(), &errors::ApiErrorResponse::PaymentNotFound ) => { Ok(None) } Ok(_) => Err(errors::RevenueRecoveryError::PaymentIntentFetchFailed) .attach_printable("Unexpected response from payment intent core"), error @ Err(_) => { logger::error!(?error); Err(errors::RevenueRecoveryError::PaymentIntentFetchFailed) .attach_printable("failed to fetch payment intent recovery webhook flow") } }?; Ok(response) }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "RevenueRecoveryInvoice", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "get_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_RevenueRecoveryInvoice_create_payment_intent
clm
method
// hyperswitch/crates/router/src/core/webhooks/recovery_incoming.rs // impl for RevenueRecoveryInvoice async fn create_payment_intent( &self, state: &SessionState, req_state: &ReqState, merchant_context: &domain::MerchantContext, profile: &domain::Profile, ) -> CustomResult<revenue_recovery::RecoveryPaymentIntent, errors::RevenueRecoveryError> { let payload = api_payments::PaymentsCreateIntentRequest::from(&self.0); let global_payment_id = id_type::GlobalPaymentId::generate(&state.conf.cell_information.id); let create_intent_response = Box::pin(payments::payments_intent_core::< router_flow_types::payments::PaymentCreateIntent, api_payments::PaymentsIntentResponse, _, _, hyperswitch_domain_models::payments::PaymentIntentData< router_flow_types::payments::PaymentCreateIntent, >, >( state.clone(), req_state.clone(), merchant_context.clone(), profile.clone(), payments::operations::PaymentIntentCreate, payload, global_payment_id, hyperswitch_domain_models::payments::HeaderPayload::default(), )) .await .change_context(errors::RevenueRecoveryError::PaymentIntentCreateFailed)?; let response = create_intent_response .get_json_body() .change_context(errors::RevenueRecoveryError::PaymentIntentCreateFailed) .attach_printable("expected json response")?; let merchant_id = merchant_context.get_merchant_account().get_id().clone(); let revenue_recovery_invoice_data = &self.0; Ok(revenue_recovery::RecoveryPaymentIntent { payment_id: response.id, status: response.status, feature_metadata: response.feature_metadata, merchant_id, merchant_reference_id: Some( revenue_recovery_invoice_data.merchant_reference_id.clone(), ), invoice_amount: revenue_recovery_invoice_data.amount, invoice_currency: revenue_recovery_invoice_data.currency, created_at: revenue_recovery_invoice_data.billing_started_at, billing_address: revenue_recovery_invoice_data.billing_address.clone(), }) }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "RevenueRecoveryInvoice", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "create_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_RecoveryPaymentTuple_new
clm
method
// hyperswitch/crates/router/src/core/webhooks/recovery_incoming.rs // impl for RecoveryPaymentTuple pub fn new( payment_intent: &revenue_recovery::RecoveryPaymentIntent, payment_attempt: &revenue_recovery::RecoveryPaymentAttempt, ) -> Self { Self(payment_intent.clone(), payment_attempt.clone()) }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "RecoveryPaymentTuple", "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_RecoveryPaymentTuple_publish_revenue_recovery_event_to_kafka
clm
method
// hyperswitch/crates/router/src/core/webhooks/recovery_incoming.rs // impl for RecoveryPaymentTuple pub async fn publish_revenue_recovery_event_to_kafka( state: &SessionState, recovery_payment_tuple: &Self, retry_count: Option<i32>, ) -> CustomResult<(), errors::RevenueRecoveryError> { let recovery_payment_intent = &recovery_payment_tuple.0; let recovery_payment_attempt = &recovery_payment_tuple.1; let revenue_recovery_feature_metadata = recovery_payment_intent .feature_metadata .as_ref() .and_then(|metadata| metadata.revenue_recovery.as_ref()); let billing_city = recovery_payment_intent .billing_address .as_ref() .and_then(|billing_address| billing_address.address.as_ref()) .and_then(|address| address.city.clone()) .map(Secret::new); let billing_state = recovery_payment_intent .billing_address .as_ref() .and_then(|billing_address| billing_address.address.as_ref()) .and_then(|address| address.state.clone()); let billing_country = recovery_payment_intent .billing_address .as_ref() .and_then(|billing_address| billing_address.address.as_ref()) .and_then(|address| address.country); let card_info = revenue_recovery_feature_metadata.and_then(|metadata| { metadata .billing_connector_payment_method_details .as_ref() .and_then(|details| details.get_billing_connector_card_info()) }); #[allow(clippy::as_conversions)] let retry_count = Some(retry_count.unwrap_or_else(|| { revenue_recovery_feature_metadata .map(|data| data.total_retry_count as i32) .unwrap_or(0) })); let event = kafka::revenue_recovery::RevenueRecovery { merchant_id: &recovery_payment_intent.merchant_id, invoice_amount: recovery_payment_intent.invoice_amount, invoice_currency: &recovery_payment_intent.invoice_currency, invoice_date: revenue_recovery_feature_metadata.and_then(|data| { data.invoice_billing_started_at_time .map(|time| time.assume_utc()) }), invoice_due_date: revenue_recovery_feature_metadata .and_then(|data| data.invoice_next_billing_time.map(|time| time.assume_utc())), billing_city, billing_country: billing_country.as_ref(), billing_state, attempt_amount: recovery_payment_attempt.amount, attempt_currency: &recovery_payment_intent.invoice_currency.clone(), attempt_status: &recovery_payment_attempt.attempt_status.clone(), pg_error_code: recovery_payment_attempt.error_code.clone(), network_advice_code: recovery_payment_attempt.network_advice_code.clone(), network_error_code: recovery_payment_attempt.network_decline_code.clone(), first_pg_error_code: revenue_recovery_feature_metadata .and_then(|data| data.first_payment_attempt_pg_error_code.clone()), first_network_advice_code: revenue_recovery_feature_metadata .and_then(|data| data.first_payment_attempt_network_advice_code.clone()), first_network_error_code: revenue_recovery_feature_metadata .and_then(|data| data.first_payment_attempt_network_decline_code.clone()), attempt_created_at: recovery_payment_attempt.created_at.assume_utc(), payment_method_type: revenue_recovery_feature_metadata .map(|data| &data.payment_method_type), payment_method_subtype: revenue_recovery_feature_metadata .map(|data| &data.payment_method_subtype), card_network: card_info .as_ref() .and_then(|info| info.card_network.as_ref()), card_issuer: card_info.and_then(|data| data.card_issuer.clone()), retry_count, payment_gateway: revenue_recovery_feature_metadata.map(|data| data.connector), }; state.event_handler.log_event(&event); Ok(()) }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "RecoveryPaymentTuple", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "publish_revenue_recovery_event_to_kafka", "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_SurchargeSource_generate_surcharge_details_and_populate_surcharge_metadata
clm
method
// hyperswitch/crates/router/src/core/payment_methods/surcharge_decision_configs.rs // impl for SurchargeSource pub fn generate_surcharge_details_and_populate_surcharge_metadata( &self, backend_input: &backend::BackendInput, payment_attempt: &storage::PaymentAttempt, surcharge_metadata_and_key: (&mut types::SurchargeMetadata, types::SurchargeKey), ) -> ConditionalConfigResult<Option<types::SurchargeDetails>> { match self { Self::Generate(interpreter) => { let surcharge_output = execute_dsl_and_get_conditional_config( backend_input.clone(), &interpreter.cached_algorithm, )?; Ok(surcharge_output .surcharge_details .map(|surcharge_details| { get_surcharge_details_from_surcharge_output( surcharge_details, payment_attempt, ) }) .transpose()? .inspect(|surcharge_details| { let (surcharge_metadata, surcharge_key) = surcharge_metadata_and_key; surcharge_metadata .insert_surcharge_details(surcharge_key, surcharge_details.clone()); })) } Self::Predetermined(request_surcharge_details) => Ok(Some( types::SurchargeDetails::from((request_surcharge_details, payment_attempt)), )), } }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "SurchargeSource", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "generate_surcharge_details_and_populate_surcharge_metadata", "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_StoreLockerReq_update_requestor_card_reference
clm
method
// hyperswitch/crates/router/src/core/payment_methods/transformers.rs // impl for StoreLockerReq pub fn update_requestor_card_reference(&mut self, card_reference: Option<String>) { match self { Self::LockerCard(c) => c.requestor_card_reference = card_reference, Self::LockerGeneric(_) => (), } }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "StoreLockerReq", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "update_requestor_card_reference", "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_PaymentMethodsUpdateForm_validate_and_get_payment_method_records
clm
method
// hyperswitch/crates/router/src/core/payment_methods/migration.rs // impl for PaymentMethodsUpdateForm pub fn validate_and_get_payment_method_records(self) -> UpdateValidationResult { let records = parse_update_csv(self.file.data.to_bytes()).map_err(|e| { errors::ApiErrorResponse::PreconditionFailed { message: e.to_string(), } })?; Ok((self.merchant_id.clone(), records)) }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "PaymentMethodsUpdateForm", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "validate_and_get_payment_method_records", "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_NetworkTokenizationBuilder<'a, TokenizeWithCard>_new
clm
method
// hyperswitch/crates/router/src/core/payment_methods/tokenize/card_executor.rs // impl for NetworkTokenizationBuilder<'a, TokenizeWithCard> pub fn new() -> Self { Self { state: std::marker::PhantomData, customer: None, card: None, card_cvc: None, network_token: None, stored_card: None, stored_token: None, payment_method_response: None, card_tokenized: false, error_code: None, error_message: None, } }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "NetworkTokenizationBuilder<'a, TokenizeWithCard>", "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_NetworkTokenizationBuilder<'a, TokenizeWithCard>_set_validate_result
clm
method
// hyperswitch/crates/router/src/core/payment_methods/tokenize/card_executor.rs // impl for NetworkTokenizationBuilder<'a, TokenizeWithCard> pub fn set_validate_result(self) -> NetworkTokenizationBuilder<'a, CardRequestValidated> { NetworkTokenizationBuilder { state: std::marker::PhantomData, customer: self.customer, card: self.card, card_cvc: self.card_cvc, network_token: self.network_token, stored_card: self.stored_card, stored_token: self.stored_token, payment_method_response: self.payment_method_response, card_tokenized: self.card_tokenized, error_code: self.error_code, error_message: self.error_message, } }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "NetworkTokenizationBuilder<'a, TokenizeWithCard>", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "set_validate_result", "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_NetworkTokenizationBuilder<'a, CardRequestValidated>_set_card_details
clm
method
// hyperswitch/crates/router/src/core/payment_methods/tokenize/card_executor.rs // impl for NetworkTokenizationBuilder<'a, CardRequestValidated> pub fn set_card_details( self, card_req: &'a domain::TokenizeCardRequest, optional_card_info: Option<diesel_models::CardInfo>, ) -> NetworkTokenizationBuilder<'a, CardDetailsAssigned> { let card = domain::CardDetail { card_number: card_req.raw_card_number.clone(), card_exp_month: card_req.card_expiry_month.clone(), card_exp_year: card_req.card_expiry_year.clone(), bank_code: optional_card_info .as_ref() .and_then(|card_info| card_info.bank_code.clone()), nick_name: card_req.nick_name.clone(), card_holder_name: card_req.card_holder_name.clone(), card_issuer: optional_card_info .as_ref() .map_or(card_req.card_issuer.clone(), |card_info| { card_info.card_issuer.clone() }), card_network: optional_card_info .as_ref() .map_or(card_req.card_network.clone(), |card_info| { card_info.card_network.clone() }), card_type: optional_card_info.as_ref().map_or( card_req .card_type .as_ref() .map(|card_type| card_type.to_string()), |card_info| card_info.card_type.clone(), ), card_issuing_country: optional_card_info .as_ref() .map_or(card_req.card_issuing_country.clone(), |card_info| { card_info.card_issuing_country.clone() }), co_badged_card_data: None, }; NetworkTokenizationBuilder { state: std::marker::PhantomData, card: Some(card), card_cvc: card_req.card_cvc.clone(), customer: self.customer, network_token: self.network_token, stored_card: self.stored_card, stored_token: self.stored_token, payment_method_response: self.payment_method_response, card_tokenized: self.card_tokenized, error_code: self.error_code, error_message: self.error_message, } }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "NetworkTokenizationBuilder<'a, CardRequestValidated>", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "set_card_details", "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_NetworkTokenizationBuilder<'a, CardDetailsAssigned>_set_customer
clm
method
// hyperswitch/crates/router/src/core/payment_methods/tokenize/card_executor.rs // impl for NetworkTokenizationBuilder<'a, CardDetailsAssigned> pub fn set_customer( self, customer: &'a api::CustomerDetails, ) -> NetworkTokenizationBuilder<'a, CustomerAssigned> { NetworkTokenizationBuilder { state: std::marker::PhantomData, customer: Some(customer), card: self.card, card_cvc: self.card_cvc, network_token: self.network_token, stored_card: self.stored_card, stored_token: self.stored_token, payment_method_response: self.payment_method_response, card_tokenized: self.card_tokenized, error_code: self.error_code, error_message: self.error_message, } }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "NetworkTokenizationBuilder<'a, CardDetailsAssigned>", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "set_customer", "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_NetworkTokenizationBuilder<'a, CustomerAssigned>_get_optional_card_and_cvc
clm
method
// hyperswitch/crates/router/src/core/payment_methods/tokenize/card_executor.rs // impl for NetworkTokenizationBuilder<'a, CustomerAssigned> pub fn get_optional_card_and_cvc( &self, ) -> (Option<domain::CardDetail>, Option<masking::Secret<String>>) { (self.card.clone(), self.card_cvc.clone()) }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "NetworkTokenizationBuilder<'a, CustomerAssigned>", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "get_optional_card_and_cvc", "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_NetworkTokenizationBuilder<'a, CustomerAssigned>_set_token_details
clm
method
// hyperswitch/crates/router/src/core/payment_methods/tokenize/card_executor.rs // impl for NetworkTokenizationBuilder<'a, CustomerAssigned> pub fn set_token_details( self, network_token: &'a NetworkTokenizationResponse, ) -> NetworkTokenizationBuilder<'a, CardTokenized> { NetworkTokenizationBuilder { state: std::marker::PhantomData, network_token: Some(&network_token.0), customer: self.customer, card: self.card, card_cvc: self.card_cvc, stored_card: self.stored_card, stored_token: self.stored_token, payment_method_response: self.payment_method_response, card_tokenized: self.card_tokenized, error_code: self.error_code, error_message: self.error_message, } }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "NetworkTokenizationBuilder<'a, CustomerAssigned>", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "set_token_details", "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_NetworkTokenizationBuilder<'a, CardTokenized>_set_stored_card_response
clm
method
// hyperswitch/crates/router/src/core/payment_methods/tokenize/card_executor.rs // impl for NetworkTokenizationBuilder<'a, CardTokenized> pub fn set_stored_card_response( self, store_card_response: &'a StoreLockerResponse, ) -> NetworkTokenizationBuilder<'a, CardStored> { NetworkTokenizationBuilder { state: std::marker::PhantomData, stored_card: Some(&store_card_response.store_card_resp), customer: self.customer, card: self.card, card_cvc: self.card_cvc, network_token: self.network_token, stored_token: self.stored_token, payment_method_response: self.payment_method_response, card_tokenized: self.card_tokenized, error_code: self.error_code, error_message: self.error_message, } }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "NetworkTokenizationBuilder<'a, CardTokenized>", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "set_stored_card_response", "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_NetworkTokenizationBuilder<'a, CardStored>_set_stored_token_response
clm
method
// hyperswitch/crates/router/src/core/payment_methods/tokenize/card_executor.rs // impl for NetworkTokenizationBuilder<'a, CardStored> pub fn set_stored_token_response( self, store_token_response: &'a StoreLockerResponse, ) -> NetworkTokenizationBuilder<'a, CardTokenStored> { NetworkTokenizationBuilder { state: std::marker::PhantomData, card_tokenized: true, stored_token: Some(&store_token_response.store_token_resp), customer: self.customer, card: self.card, card_cvc: self.card_cvc, network_token: self.network_token, stored_card: self.stored_card, payment_method_response: self.payment_method_response, error_code: self.error_code, error_message: self.error_message, } }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "NetworkTokenizationBuilder<'a, CardStored>", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "set_stored_token_response", "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_NetworkTokenizationBuilder<'a, CardTokenStored>_set_payment_method_response
clm
method
// hyperswitch/crates/router/src/core/payment_methods/tokenize/card_executor.rs // impl for NetworkTokenizationBuilder<'a, CardTokenStored> pub fn set_payment_method_response( self, payment_method: &'a domain::PaymentMethod, ) -> NetworkTokenizationBuilder<'a, PaymentMethodCreated> { let card_detail_from_locker = self.card.as_ref().map(|card| api::CardDetailFromLocker { scheme: None, issuer_country: card.card_issuing_country.clone(), last4_digits: Some(card.card_number.clone().get_last4()), card_number: None, expiry_month: Some(card.card_exp_month.clone().clone()), expiry_year: Some(card.card_exp_year.clone().clone()), card_token: None, card_holder_name: card.card_holder_name.clone(), card_fingerprint: None, nick_name: card.nick_name.clone(), card_network: card.card_network.clone(), card_isin: Some(card.card_number.clone().get_card_isin()), card_issuer: card.card_issuer.clone(), card_type: card.card_type.clone(), saved_to_locker: true, }); let payment_method_response = api::PaymentMethodResponse { merchant_id: payment_method.merchant_id.clone(), customer_id: Some(payment_method.customer_id.clone()), payment_method_id: payment_method.payment_method_id.clone(), payment_method: payment_method.payment_method, payment_method_type: payment_method.payment_method_type, card: card_detail_from_locker, recurring_enabled: Some(true), installment_payment_enabled: Some(false), metadata: payment_method.metadata.clone(), created: Some(payment_method.created_at), last_used_at: Some(payment_method.last_used_at), client_secret: payment_method.client_secret.clone(), bank_transfer: None, payment_experience: None, }; NetworkTokenizationBuilder { state: std::marker::PhantomData, payment_method_response: Some(payment_method_response), customer: self.customer, card: self.card, card_cvc: self.card_cvc, network_token: self.network_token, stored_card: self.stored_card, stored_token: self.stored_token, card_tokenized: self.card_tokenized, error_code: self.error_code, error_message: self.error_message, } }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "NetworkTokenizationBuilder<'a, CardTokenStored>", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "set_payment_method_response", "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_NetworkTokenizationBuilder<'a, TokenizeWithPmId>_new
clm
method
// hyperswitch/crates/router/src/core/payment_methods/tokenize/payment_method_executor.rs // impl for NetworkTokenizationBuilder<'a, TokenizeWithPmId> pub fn new() -> Self { Self { state: std::marker::PhantomData, customer: None, card: None, card_cvc: None, network_token: None, stored_card: None, stored_token: None, payment_method_response: None, card_tokenized: false, error_code: None, error_message: None, } }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "NetworkTokenizationBuilder<'a, TokenizeWithPmId>", "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_NetworkTokenizationBuilder<'a, PmFetched>_set_validate_result
clm
method
// hyperswitch/crates/router/src/core/payment_methods/tokenize/payment_method_executor.rs // impl for NetworkTokenizationBuilder<'a, PmFetched> pub fn set_validate_result( self, customer: &'a api::CustomerDetails, ) -> NetworkTokenizationBuilder<'a, PmValidated> { NetworkTokenizationBuilder { state: std::marker::PhantomData, customer: Some(customer), card: self.card, card_cvc: self.card_cvc, network_token: self.network_token, stored_card: self.stored_card, stored_token: self.stored_token, payment_method_response: self.payment_method_response, card_tokenized: self.card_tokenized, error_code: self.error_code, error_message: self.error_message, } }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "NetworkTokenizationBuilder<'a, PmFetched>", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "set_validate_result", "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_NetworkTokenizationBuilder<'a, PmValidated>_set_card_details
clm
method
// hyperswitch/crates/router/src/core/payment_methods/tokenize/payment_method_executor.rs // impl for NetworkTokenizationBuilder<'a, PmValidated> pub fn set_card_details( self, card_from_locker: &'a api_models::payment_methods::Card, optional_card_info: Option<diesel_models::CardInfo>, card_cvc: Option<Secret<String>>, ) -> NetworkTokenizationBuilder<'a, PmAssigned> { let card = domain::CardDetail { card_number: card_from_locker.card_number.clone(), card_exp_month: card_from_locker.card_exp_month.clone(), card_exp_year: card_from_locker.card_exp_year.clone(), bank_code: optional_card_info .as_ref() .and_then(|card_info| card_info.bank_code.clone()), nick_name: card_from_locker .nick_name .as_ref() .map(|nick_name| Secret::new(nick_name.clone())), card_holder_name: card_from_locker.name_on_card.clone(), card_issuer: optional_card_info .as_ref() .and_then(|card_info| card_info.card_issuer.clone()), card_network: optional_card_info .as_ref() .and_then(|card_info| card_info.card_network.clone()), card_type: optional_card_info .as_ref() .and_then(|card_info| card_info.card_type.clone()), card_issuing_country: optional_card_info .as_ref() .and_then(|card_info| card_info.card_issuing_country.clone()), co_badged_card_data: None, }; NetworkTokenizationBuilder { state: std::marker::PhantomData, card: Some(card), card_cvc, customer: self.customer, network_token: self.network_token, stored_card: self.stored_card, stored_token: self.stored_token, payment_method_response: self.payment_method_response, card_tokenized: self.card_tokenized, error_code: self.error_code, error_message: self.error_message, } }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "NetworkTokenizationBuilder<'a, PmValidated>", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "set_card_details", "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_NetworkTokenizationBuilder<'a, PmAssigned>_get_optional_card_and_cvc
clm
method
// hyperswitch/crates/router/src/core/payment_methods/tokenize/payment_method_executor.rs // impl for NetworkTokenizationBuilder<'a, PmAssigned> pub fn get_optional_card_and_cvc( &self, ) -> (Option<domain::CardDetail>, Option<Secret<String>>) { (self.card.clone(), self.card_cvc.clone()) }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "NetworkTokenizationBuilder<'a, PmAssigned>", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "get_optional_card_and_cvc", "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_NetworkTokenizationBuilder<'a, PmAssigned>_set_token_details
clm
method
// hyperswitch/crates/router/src/core/payment_methods/tokenize/payment_method_executor.rs // impl for NetworkTokenizationBuilder<'a, PmAssigned> pub fn set_token_details( self, network_token: &'a NetworkTokenizationResponse, ) -> NetworkTokenizationBuilder<'a, PmTokenized> { NetworkTokenizationBuilder { state: std::marker::PhantomData, network_token: Some(&network_token.0), card_tokenized: true, customer: self.customer, card: self.card, card_cvc: self.card_cvc, stored_card: self.stored_card, stored_token: self.stored_token, payment_method_response: self.payment_method_response, error_code: self.error_code, error_message: self.error_message, } }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "NetworkTokenizationBuilder<'a, PmAssigned>", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "set_token_details", "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_NetworkTokenizationBuilder<'a, PmTokenized>_set_stored_token_response
clm
method
// hyperswitch/crates/router/src/core/payment_methods/tokenize/payment_method_executor.rs // impl for NetworkTokenizationBuilder<'a, PmTokenized> pub fn set_stored_token_response( self, store_token_response: &'a pm_transformers::StoreCardRespPayload, ) -> NetworkTokenizationBuilder<'a, PmTokenStored> { NetworkTokenizationBuilder { state: std::marker::PhantomData, stored_token: Some(store_token_response), customer: self.customer, card: self.card, card_cvc: self.card_cvc, network_token: self.network_token, stored_card: self.stored_card, payment_method_response: self.payment_method_response, card_tokenized: self.card_tokenized, error_code: self.error_code, error_message: self.error_message, } }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "NetworkTokenizationBuilder<'a, PmTokenized>", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "set_stored_token_response", "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_NetworkTokenizationBuilder<'a, PmTokenStored>_set_payment_method
clm
method
// hyperswitch/crates/router/src/core/payment_methods/tokenize/payment_method_executor.rs // impl for NetworkTokenizationBuilder<'a, PmTokenStored> pub fn set_payment_method( self, payment_method: &'a domain::PaymentMethod, ) -> NetworkTokenizationBuilder<'a, PmTokenUpdated> { let payment_method_response = api::PaymentMethodResponse { merchant_id: payment_method.merchant_id.clone(), customer_id: Some(payment_method.customer_id.clone()), payment_method_id: payment_method.payment_method_id.clone(), payment_method: payment_method.payment_method, payment_method_type: payment_method.payment_method_type, recurring_enabled: Some(true), installment_payment_enabled: Some(false), metadata: payment_method.metadata.clone(), created: Some(payment_method.created_at), last_used_at: Some(payment_method.last_used_at), client_secret: payment_method.client_secret.clone(), card: None, bank_transfer: None, payment_experience: None, }; NetworkTokenizationBuilder { state: std::marker::PhantomData, payment_method_response: Some(payment_method_response), customer: self.customer, card: self.card, card_cvc: self.card_cvc, stored_token: self.stored_token, network_token: self.network_token, stored_card: self.stored_card, card_tokenized: self.card_tokenized, error_code: self.error_code, error_message: self.error_message, } }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "NetworkTokenizationBuilder<'a, PmTokenStored>", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "set_payment_method", "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_Health_server
clm
method
// hyperswitch/crates/drainer/src/health_check.rs // impl for Health pub fn server(conf: Settings, stores: HashMap<id_type::TenantId, Arc<Store>>) -> Scope { web::scope("health") .app_data(web::Data::new(conf)) .app_data(web::Data::new(stores)) .service(web::resource("").route(web::get().to(health))) .service(web::resource("/ready").route(web::get().to(deep_health_check))) }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "Health", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "server", "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_Health_server
clm
method
// hyperswitch/crates/router/src/bin/scheduler.rs // impl for Health pub fn server(state: routes::AppState, service: String) -> Scope { web::scope("health") .app_data(web::Data::new(state)) .app_data(web::Data::new(service)) .service(web::resource("").route(web::get().to(health))) .service(web::resource("/ready").route(web::get().to(deep_health_check))) }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "Health", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "server", "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_UserFromToken_get_merchant_account_from_db
clm
method
// hyperswitch/crates/router/src/utils/user.rs // impl for UserFromToken pub async fn get_merchant_account_from_db( &self, state: SessionState, ) -> UserResult<MerchantAccount> { let key_manager_state = &(&state).into(); let key_store = state .store .get_merchant_key_store_by_merchant_id( key_manager_state, &self.merchant_id, &state.store.get_master_key().to_vec().into(), ) .await .map_err(|e| { if e.current_context().is_db_not_found() { e.change_context(UserErrors::MerchantIdNotFound) } else { e.change_context(UserErrors::InternalServerError) } })?; let merchant_account = state .store .find_merchant_account_by_merchant_id(key_manager_state, &self.merchant_id, &key_store) .await .map_err(|e| { if e.current_context().is_db_not_found() { e.change_context(UserErrors::MerchantIdNotFound) } else { e.change_context(UserErrors::InternalServerError) } })?; Ok(merchant_account) }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "UserFromToken", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "get_merchant_account_from_db", "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_UserFromToken_get_user_from_db
clm
method
// hyperswitch/crates/router/src/utils/user.rs // impl for UserFromToken pub async fn get_user_from_db(&self, state: &SessionState) -> UserResult<UserFromStorage> { let user = state .global_store .find_user_by_id(&self.user_id) .await .change_context(UserErrors::InternalServerError)?; Ok(user.into()) }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "UserFromToken", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "get_user_from_db", "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_UserFromToken_get_role_info_from_db
clm
method
// hyperswitch/crates/router/src/utils/user.rs // impl for UserFromToken pub async fn get_role_info_from_db(&self, state: &SessionState) -> UserResult<RoleInfo> { RoleInfo::from_role_id_org_id_tenant_id( state, &self.role_id, &self.org_id, self.tenant_id.as_ref().unwrap_or(&state.tenant.tenant_id), ) .await .change_context(UserErrors::InternalServerError) }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "UserFromToken", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "get_role_info_from_db", "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_FxExchangeRatesCacheEntry_new
clm
method
// hyperswitch/crates/router/src/utils/currency.rs // impl for FxExchangeRatesCacheEntry fn new(exchange_rate: ExchangeRates) -> Self { Self { data: Arc::new(exchange_rate), timestamp: date_time::now_unix_timestamp(), } }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "FxExchangeRatesCacheEntry", "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_FxExchangeRatesCacheEntry_is_expired
clm
method
// hyperswitch/crates/router/src/utils/currency.rs // impl for FxExchangeRatesCacheEntry fn is_expired(&self, data_expiration_delay: u32) -> bool { self.timestamp + i64::from(data_expiration_delay) < date_time::now_unix_timestamp() }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "FxExchangeRatesCacheEntry", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "is_expired", "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_Multitenancy_get_tenants
clm
method
// hyperswitch/crates/drainer/src/settings.rs // impl for Multitenancy pub fn get_tenants(&self) -> &HashMap<id_type::TenantId, Tenant> { &self.tenants.0 }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "Multitenancy", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "get_tenants", "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_Multitenancy_get_tenant_ids
clm
method
// hyperswitch/crates/drainer/src/settings.rs // impl for Multitenancy pub fn get_tenant_ids(&self) -> Vec<id_type::TenantId> { self.tenants .0 .values() .map(|tenant| tenant.tenant_id.clone()) .collect() }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "Multitenancy", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "get_tenant_ids", "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_Multitenancy_get_tenant
clm
method
// hyperswitch/crates/drainer/src/settings.rs // impl for Multitenancy pub fn get_tenant(&self, tenant_id: &id_type::TenantId) -> Option<&Tenant> { self.tenants.0.get(tenant_id) }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "Multitenancy", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "get_tenant", "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_Multitenancy_get_tenants
clm
method
// hyperswitch/crates/router/src/configs/settings.rs // impl for Multitenancy pub fn get_tenants(&self) -> &HashMap<id_type::TenantId, Tenant> { &self.tenants.0 }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "Multitenancy", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "get_tenants", "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_Multitenancy_get_tenant_ids
clm
method
// hyperswitch/crates/router/src/configs/settings.rs // impl for Multitenancy pub fn get_tenant_ids(&self) -> Vec<id_type::TenantId> { self.tenants .0 .values() .map(|tenant| tenant.tenant_id.clone()) .collect() }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "Multitenancy", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "get_tenant_ids", "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_Multitenancy_get_tenant
clm
method
// hyperswitch/crates/router/src/configs/settings.rs // impl for Multitenancy pub fn get_tenant(&self, tenant_id: &id_type::TenantId) -> Option<&Tenant> { self.tenants.0.get(tenant_id) }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "Multitenancy", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "get_tenant", "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_TenantConfig_get_store_interface_map
clm
method
// hyperswitch/crates/router/src/configs/settings.rs // impl for TenantConfig pub async fn get_store_interface_map( &self, storage_impl: &app::StorageImpl, conf: &configs::Settings, cache_store: Arc<storage_impl::redis::RedisStore>, testable: bool, ) -> HashMap<id_type::TenantId, Box<dyn app::StorageInterface>> { #[allow(clippy::expect_used)] let event_handler = conf .events .get_event_handler() .await .expect("Failed to create event handler"); futures::future::join_all(self.0.iter().map(|(tenant_name, tenant)| async { let store = AppState::get_store_interface( storage_impl, &event_handler, conf, tenant, cache_store.clone(), testable, ) .await .get_storage_interface(); (tenant_name.clone(), store) })) .await .into_iter() .collect() }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "TenantConfig", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "get_store_interface_map", "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_TenantConfig_get_accounts_store_interface_map
clm
method
// hyperswitch/crates/router/src/configs/settings.rs // impl for TenantConfig pub async fn get_accounts_store_interface_map( &self, storage_impl: &app::StorageImpl, conf: &configs::Settings, cache_store: Arc<storage_impl::redis::RedisStore>, testable: bool, ) -> HashMap<id_type::TenantId, Box<dyn app::AccountsStorageInterface>> { #[allow(clippy::expect_used)] let event_handler = conf .events .get_event_handler() .await .expect("Failed to create event handler"); futures::future::join_all(self.0.iter().map(|(tenant_name, tenant)| async { let store = AppState::get_store_interface( storage_impl, &event_handler, conf, tenant, cache_store.clone(), testable, ) .await .get_accounts_storage_interface(); (tenant_name.clone(), store) })) .await .into_iter() .collect() }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "TenantConfig", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "get_accounts_store_interface_map", "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_TenantConfig_get_pools_map
clm
method
// hyperswitch/crates/router/src/configs/settings.rs // impl for TenantConfig pub async fn get_pools_map( &self, analytics_config: &AnalyticsConfig, ) -> HashMap<id_type::TenantId, AnalyticsProvider> { futures::future::join_all(self.0.iter().map(|(tenant_name, tenant)| async { ( tenant_name.clone(), AnalyticsProvider::from_conf(analytics_config, tenant).await, ) })) .await .into_iter() .collect() }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "TenantConfig", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "get_pools_map", "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_Settings<RawSecret>_is_kv_soft_kill_mode
clm
method
// hyperswitch/crates/router/src/configs/settings.rs // impl for Settings<RawSecret> pub fn is_kv_soft_kill_mode(&self) -> bool { false }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "Settings<RawSecret>", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "is_kv_soft_kill_mode", "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_super::settings::Server_validate
clm
method
// hyperswitch/crates/scheduler/src/configs/validations.rs // impl for super::settings::Server pub fn validate(&self) -> Result<(), ApplicationError> { common_utils::fp_utils::when(self.host.is_default_or_empty(), || { Err(ApplicationError::InvalidConfigurationValueError( "server host must not be empty".into(), )) }) }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "super::settings::Server", "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_super::settings::ChatSettings_validate
clm
method
// hyperswitch/crates/router/src/configs/validations.rs // impl for super::settings::ChatSettings pub fn validate(&self) -> Result<(), ApplicationError> { use common_utils::fp_utils::when; when(self.enabled && self.hyperswitch_ai_host.is_empty(), || { Err(ApplicationError::InvalidConfigurationValueError( "hyperswitch ai host must be set if chat is enabled".into(), )) }) }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "super::settings::ChatSettings", "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_KafkaStore_new
clm
method
// hyperswitch/crates/router/src/db/kafka_store.rs // impl for KafkaStore pub async fn new( store: Store, mut kafka_producer: KafkaProducer, tenant_id: TenantID, tenant_config: &dyn TenantConfig, ) -> Self { kafka_producer.set_tenancy(tenant_config); Self { kafka_producer, diesel_store: store, tenant_id, } }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "KafkaStore", "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_OutgoingWebhookEvent_new
clm
method
// hyperswitch/crates/router/src/events/outgoing_webhook_logs.rs // impl for OutgoingWebhookEvent pub fn new( tenant_id: common_utils::id_type::TenantId, merchant_id: common_utils::id_type::MerchantId, event_id: String, event_type: OutgoingWebhookEventType, content: Option<OutgoingWebhookEventContent>, error: Option<Value>, initial_attempt_id: Option<String>, status_code: Option<u16>, delivery_attempt: Option<WebhookDeliveryAttempt>, ) -> Self { Self { tenant_id, merchant_id, event_id, event_type, content, is_error: error.is_some(), error, created_at_timestamp: OffsetDateTime::now_utc().unix_timestamp_nanos() / 1_000_000, initial_attempt_id, status_code, delivery_attempt, } }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "OutgoingWebhookEvent", "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_ApiEvent_new
clm
method
// hyperswitch/crates/router/src/events/api_logs.rs // impl for ApiEvent pub fn new( tenant_id: common_utils::id_type::TenantId, merchant_id: Option<common_utils::id_type::MerchantId>, api_flow: &impl FlowMetric, request_id: &RequestId, latency: u128, status_code: i64, request: serde_json::Value, response: Option<serde_json::Value>, hs_latency: Option<u128>, auth_type: AuthenticationType, error: Option<serde_json::Value>, event_type: ApiEventsType, http_req: &HttpRequest, http_method: &http::Method, infra_components: Option<serde_json::Value>, ) -> Self { Self { tenant_id, merchant_id, api_flow: api_flow.to_string(), created_at_timestamp: OffsetDateTime::now_utc().unix_timestamp_nanos() / 1_000_000, request_id: request_id.as_hyphenated().to_string(), latency, status_code, request: request.to_string(), response: response.map(|resp| resp.to_string()), auth_type, error, ip_addr: http_req .connection_info() .realip_remote_addr() .map(ToOwned::to_owned), user_agent: http_req .headers() .get("user-agent") .and_then(|user_agent_value| user_agent_value.to_str().ok().map(ToOwned::to_owned)), url_path: http_req.path().to_string(), event_type, hs_latency, http_method: http_method.to_string(), infra_components, } }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "ApiEvent", "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_AuditEvent_new
clm
method
// hyperswitch/crates/router/src/events/audit_events.rs // impl for AuditEvent pub fn new(event_type: AuditEventType) -> Self { Self { event_type, created_at: common_utils::date_time::now(), } }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "AuditEvent", "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_EventLogger_log_event
clm
method
// hyperswitch/crates/router/src/events/event_logger.rs // impl for EventLogger pub(super) fn log_event<T: KafkaMessage>(&self, event: &T) { logger::info!(event = ?event.masked_serialize().unwrap_or_else(|e| serde_json::json!({"error": e.to_string()})), event_type =? event.event_type(), event_id =? event.key(), log_type =? "event"); }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "EventLogger", "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_SessionState_get_req_state
clm
method
// hyperswitch/crates/router/src/routes/app.rs // impl for SessionState pub fn get_req_state(&self) -> ReqState { ReqState { event_context: events::EventContext::new(self.event_handler.clone()), } }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "SessionState", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "get_req_state", "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_SessionState_get_grpc_headers
clm
method
// hyperswitch/crates/router/src/routes/app.rs // impl for SessionState pub fn get_grpc_headers(&self) -> GrpcHeaders { GrpcHeaders { tenant_id: self.tenant.tenant_id.get_string_repr().to_string(), request_id: self.request_id.map(|req_id| (*req_id).to_string()), } }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "SessionState", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "get_grpc_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_SessionState_get_grpc_headers_ucs
clm
method
// hyperswitch/crates/router/src/routes/app.rs // impl for SessionState pub fn get_grpc_headers_ucs( &self, unified_connector_service_execution_mode: ExecutionMode, ) -> GrpcHeadersUcsBuilderInitial { let tenant_id = self.tenant.tenant_id.get_string_repr().to_string(); let request_id = self.request_id.map(|req_id| (*req_id).to_string()); let shadow_mode = match unified_connector_service_execution_mode { ExecutionMode::Primary => false, ExecutionMode::Shadow => true, }; GrpcHeadersUcs::builder() .tenant_id(tenant_id) .request_id(request_id) .shadow_mode(Some(shadow_mode)) }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "SessionState", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "get_grpc_headers_ucs", "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_SessionState_get_recovery_grpc_headers
clm
method
// hyperswitch/crates/router/src/routes/app.rs // impl for SessionState pub fn get_recovery_grpc_headers(&self) -> GrpcRecoveryHeaders { GrpcRecoveryHeaders { request_id: self.request_id.map(|req_id| (*req_id).to_string()), } }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "SessionState", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "get_recovery_grpc_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_AppState_with_storage
clm
method
// hyperswitch/crates/router/src/routes/app.rs // impl for AppState pub async fn with_storage( conf: settings::Settings<SecuredSecret>, storage_impl: StorageImpl, shut_down_signal: oneshot::Sender<()>, api_client: Box<dyn crate::services::ApiClient>, ) -> Self { #[allow(clippy::expect_used)] let secret_management_client = conf .secrets_management .get_secret_management_client() .await .expect("Failed to create secret management client"); let conf = Box::pin(secrets_transformers::fetch_raw_secrets( conf, &*secret_management_client, )) .await; #[allow(clippy::expect_used)] let encryption_client = conf .encryption_management .get_encryption_management_client() .await .expect("Failed to create encryption client"); Box::pin(async move { let testable = storage_impl == StorageImpl::PostgresqlTest; #[allow(clippy::expect_used)] let event_handler = conf .events .get_event_handler() .await .expect("Failed to create event handler"); #[allow(clippy::expect_used)] #[cfg(feature = "olap")] let opensearch_client = conf .opensearch .get_opensearch_client() .await .expect("Failed to initialize OpenSearch client.") .map(Arc::new); #[allow(clippy::expect_used)] let cache_store = get_cache_store(&conf.clone(), shut_down_signal, testable) .await .expect("Failed to create store"); let global_store: Box<dyn GlobalStorageInterface> = Self::get_store_interface( &storage_impl, &event_handler, &conf, &conf.multitenancy.global_tenant, Arc::clone(&cache_store), testable, ) .await .get_global_storage_interface(); #[cfg(feature = "olap")] let pools = conf .multitenancy .tenants .get_pools_map(conf.analytics.get_inner()) .await; let stores = conf .multitenancy .tenants .get_store_interface_map(&storage_impl, &conf, Arc::clone(&cache_store), testable) .await; let accounts_store = conf .multitenancy .tenants .get_accounts_store_interface_map( &storage_impl, &conf, Arc::clone(&cache_store), testable, ) .await; #[cfg(feature = "email")] let email_client = Arc::new(create_email_client(&conf).await); let file_storage_client = conf.file_storage.get_file_storage_client().await; let theme_storage_client = conf.theme.storage.get_file_storage_client().await; let crm_client = conf.crm.get_crm_client().await; let grpc_client = conf.grpc_client.get_grpc_client_interface().await; let infra_component_values = Self::process_env_mappings(conf.infra_values.clone()); let enhancement = conf.enhancement.clone(); let superposition_service = if conf.superposition.get_inner().enabled { match SuperpositionClient::new(conf.superposition.get_inner().clone()).await { Ok(client) => { router_env::logger::info!("Superposition client initialized successfully"); Some(Arc::new(client)) } Err(err) => { router_env::logger::warn!( "Failed to initialize superposition client: {:?}. Continuing without superposition support.", err ); None } } } else { None }; Self { flow_name: String::from("default"), stores, global_store, accounts_store, conf: Arc::new(conf), #[cfg(feature = "email")] email_client, api_client, event_handler, #[cfg(feature = "olap")] pools, #[cfg(feature = "olap")] opensearch_client, request_id: None, file_storage_client, encryption_client, grpc_client, theme_storage_client, crm_client, infra_components: infra_component_values, enhancement, superposition_service, } }) .await }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "AppState", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "with_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_AppState_get_store_interface
clm
method
// hyperswitch/crates/router/src/routes/app.rs // impl for AppState pub async fn get_store_interface( storage_impl: &StorageImpl, event_handler: &EventsHandler, conf: &Settings, tenant: &dyn TenantConfig, cache_store: Arc<RedisStore>, testable: bool, ) -> Box<dyn CommonStorageInterface> { match storage_impl { StorageImpl::Postgresql | StorageImpl::PostgresqlTest => match event_handler { EventsHandler::Kafka(kafka_client) => Box::new( KafkaStore::new( #[allow(clippy::expect_used)] get_store(&conf.clone(), tenant, Arc::clone(&cache_store), testable) .await .expect("Failed to create store"), kafka_client.clone(), TenantID(tenant.get_tenant_id().get_string_repr().to_owned()), tenant, ) .await, ), EventsHandler::Logs(_) => Box::new( #[allow(clippy::expect_used)] get_store(conf, tenant, Arc::clone(&cache_store), testable) .await .expect("Failed to create store"), ), }, #[allow(clippy::expect_used)] StorageImpl::Mock => Box::new( MockDb::new(&conf.redis) .await .expect("Failed to create mock store"), ), } }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "AppState", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "get_store_interface", "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_AppState_new
clm
method
// hyperswitch/crates/router/src/routes/app.rs // impl for AppState pub async fn new( conf: settings::Settings<SecuredSecret>, shut_down_signal: oneshot::Sender<()>, api_client: Box<dyn crate::services::ApiClient>, ) -> Self { Box::pin(Self::with_storage( conf, StorageImpl::Postgresql, shut_down_signal, api_client, )) .await }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "AppState", "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_AppState_get_session_state
clm
method
// hyperswitch/crates/router/src/routes/app.rs // impl for AppState pub fn get_session_state<E, F>( self: Arc<Self>, tenant: &id_type::TenantId, locale: Option<String>, err: F, ) -> Result<SessionState, E> where F: FnOnce() -> E + Copy, { let tenant_conf = self.conf.multitenancy.get_tenant(tenant).ok_or_else(err)?; let mut event_handler = self.event_handler.clone(); event_handler.add_tenant(tenant_conf); let store = self.stores.get(tenant).ok_or_else(err)?.clone(); Ok(SessionState { store, global_store: self.global_store.clone(), accounts_store: self.accounts_store.get(tenant).ok_or_else(err)?.clone(), conf: Arc::clone(&self.conf), api_client: self.api_client.clone(), event_handler, #[cfg(feature = "olap")] pool: self.pools.get(tenant).ok_or_else(err)?.clone(), file_storage_client: self.file_storage_client.clone(), request_id: self.request_id, base_url: tenant_conf.base_url.clone(), tenant: tenant_conf.clone(), #[cfg(feature = "email")] email_client: Arc::clone(&self.email_client), #[cfg(feature = "olap")] opensearch_client: self.opensearch_client.clone(), grpc_client: Arc::clone(&self.grpc_client), theme_storage_client: self.theme_storage_client.clone(), locale: locale.unwrap_or(common_utils::consts::DEFAULT_LOCALE.to_string()), crm_client: self.crm_client.clone(), infra_components: self.infra_components.clone(), enhancement: self.enhancement.clone(), superposition_service: self.superposition_service.clone(), }) }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "AppState", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "get_session_state", "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_AppState_process_env_mappings
clm
method
// hyperswitch/crates/router/src/routes/app.rs // impl for AppState pub fn process_env_mappings( mappings: Option<HashMap<String, String>>, ) -> Option<serde_json::Value> { let result: HashMap<String, String> = mappings? .into_iter() .filter_map(|(key, env_var)| std::env::var(&env_var).ok().map(|value| (key, value))) .collect(); if result.is_empty() { None } else { Some(serde_json::Value::Object( result .into_iter() .map(|(k, v)| (k, serde_json::Value::String(v))) .collect(), )) } }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "AppState", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "process_env_mappings", "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_Health_server
clm
method
// hyperswitch/crates/drainer/src/health_check.rs // impl for Health pub fn server(conf: Settings, stores: HashMap<id_type::TenantId, Arc<Store>>) -> Scope { web::scope("health") .app_data(web::Data::new(conf)) .app_data(web::Data::new(stores)) .service(web::resource("").route(web::get().to(health))) .service(web::resource("/ready").route(web::get().to(deep_health_check))) }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "Health", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "server", "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_Health_server
clm
method
// hyperswitch/crates/router/src/bin/scheduler.rs // impl for Health pub fn server(state: routes::AppState, service: String) -> Scope { web::scope("health") .app_data(web::Data::new(state)) .app_data(web::Data::new(service)) .service(web::resource("").route(web::get().to(health))) .service(web::resource("/ready").route(web::get().to(deep_health_check))) }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "Health", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "server", "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_Health_server
clm
method
// hyperswitch/crates/drainer/src/health_check.rs // impl for Health pub fn server(conf: Settings, stores: HashMap<id_type::TenantId, Arc<Store>>) -> Scope { web::scope("health") .app_data(web::Data::new(conf)) .app_data(web::Data::new(stores)) .service(web::resource("").route(web::get().to(health))) .service(web::resource("/ready").route(web::get().to(deep_health_check))) }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "Health", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "server", "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_Health_server
clm
method
// hyperswitch/crates/router/src/bin/scheduler.rs // impl for Health pub fn server(state: routes::AppState, service: String) -> Scope { web::scope("health") .app_data(web::Data::new(state)) .app_data(web::Data::new(service)) .service(web::resource("").route(web::get().to(health))) .service(web::resource("/ready").route(web::get().to(deep_health_check))) }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "Health", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "server", "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_Mandates_server
clm
method
// hyperswitch/crates/router/src/compatibility/stripe/app.rs // impl for Mandates pub fn server(config: routes::AppState) -> Scope { web::scope("/payment_methods") .app_data(web::Data::new(config)) .service(web::resource("/{id}/detach").route(web::post().to(mandates::revoke_mandate))) }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "Mandates", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "server", "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_RecoveryDataBackfill_server
clm
method
// hyperswitch/crates/router/src/routes/app.rs // impl for RecoveryDataBackfill pub fn server(state: AppState) -> Scope { web::scope("/v2/recovery/data-backfill") .app_data(web::Data::new(state)) .service( web::resource("").route( web::post() .to(super::revenue_recovery_data_backfill::revenue_recovery_data_backfill), ), ) .service(web::resource("/status/{token_id}").route( web::post().to( super::revenue_recovery_data_backfill::revenue_recovery_data_backfill_status, ), )) .service(web::resource("/redis-data/{token_id}").route( web::get().to( super::revenue_recovery_redis::get_revenue_recovery_redis_data, ), )) .service(web::resource("/update-token").route( web::put().to( super::revenue_recovery_data_backfill::update_revenue_recovery_additional_redis_data, ), )) }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "RecoveryDataBackfill", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "server", "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_DummyConnectors_get_connector_image_link
clm
method
// hyperswitch/crates/router/src/routes/dummy_connector/types.rs // impl for DummyConnectors pub fn get_connector_image_link(self, base_url: &str) -> String { let image_name = match self { Self::PhonyPay => "PHONYPAY.svg", Self::FauxPay => "FAUXPAY.svg", Self::PretendPay => "PRETENDPAY.svg", Self::StripeTest => "STRIPE_TEST.svg", Self::PaypalTest => "PAYPAL_TEST.svg", _ => "PHONYPAY.svg", }; format!("{base_url}{image_name}") }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "DummyConnectors", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "get_connector_image_link", "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_DummyConnectorPaymentAttempt_build_payment_data
clm
method
// hyperswitch/crates/router/src/routes/dummy_connector/types.rs // impl for DummyConnectorPaymentAttempt pub fn build_payment_data( self, status: DummyConnectorStatus, next_action: Option<DummyConnectorNextAction>, return_url: Option<String>, ) -> DummyConnectorPaymentData { DummyConnectorPaymentData { attempt_id: self.attempt_id, payment_id: self.payment_id, status, amount: self.payment_request.amount, eligible_amount: self.payment_request.amount, connector: self.payment_request.connector, created: self.timestamp, currency: self.payment_request.currency, payment_method_type: self.payment_request.payment_method_data.into(), next_action, return_url, } }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "DummyConnectorPaymentAttempt", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "build_payment_data", "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_DummyConnectorPaymentData_is_eligible_for_refund
clm
method
// hyperswitch/crates/router/src/routes/dummy_connector/types.rs // impl for DummyConnectorPaymentData pub fn is_eligible_for_refund(&self, refund_amount: i64) -> DummyConnectorResult<()> { if self.eligible_amount < refund_amount { return Err( report!(DummyConnectorErrors::RefundAmountExceedsPaymentAmount) .attach_printable("Eligible amount is lesser than refund amount"), ); } if self.status != DummyConnectorStatus::Succeeded { return Err(report!(DummyConnectorErrors::PaymentNotSuccessful) .attach_printable("Payment is not successful to process the refund")); } Ok(()) }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "DummyConnectorPaymentData", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "is_eligible_for_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_DummyConnectorRefundResponse_new
clm
method
// hyperswitch/crates/router/src/routes/dummy_connector/types.rs // impl for DummyConnectorRefundResponse pub fn new( status: DummyConnectorStatus, id: String, currency: Currency, created: PrimitiveDateTime, payment_amount: i64, refund_amount: i64, ) -> Self { Self { status, id, currency, created, payment_amount, refund_amount, } }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "DummyConnectorRefundResponse", "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_types::DummyConnectorUpiCollect_get_flow_from_upi_collect
clm
method
// hyperswitch/crates/router/src/routes/dummy_connector/utils.rs // impl for types::DummyConnectorUpiCollect pub fn get_flow_from_upi_collect( self, ) -> types::DummyConnectorResult<types::DummyConnectorUpiFlow> { let vpa_id = self.vpa_id.peek(); match vpa_id.as_str() { consts::DUMMY_CONNECTOR_UPI_FAILURE_VPA_ID => Ok(types::DummyConnectorUpiFlow { status: types::DummyConnectorStatus::Failed, error: errors::DummyConnectorErrors::PaymentNotSuccessful.into(), is_next_action_required: false, }), consts::DUMMY_CONNECTOR_UPI_SUCCESS_VPA_ID => Ok(types::DummyConnectorUpiFlow { status: types::DummyConnectorStatus::Processing, error: None, is_next_action_required: true, }), _ => Ok(types::DummyConnectorUpiFlow { status: types::DummyConnectorStatus::Failed, error: Some(errors::DummyConnectorErrors::PaymentDeclined { message: "Invalid Upi id", }), is_next_action_required: false, }), } }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "types::DummyConnectorUpiCollect", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "get_flow_from_upi_collect", "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_types::DummyConnectorCard_get_flow_from_card_number
clm
method
// hyperswitch/crates/router/src/routes/dummy_connector/utils.rs // impl for types::DummyConnectorCard pub fn get_flow_from_card_number( self, connector: DummyConnectors, ) -> types::DummyConnectorResult<types::DummyConnectorCardFlow> { let card_number = self.number.peek(); match card_number.as_str() { "4111111111111111" | "4242424242424242" | "5555555555554444" | "38000000000006" | "378282246310005" | "6011111111111117" => { Ok(types::DummyConnectorCardFlow::NoThreeDS( types::DummyConnectorStatus::Succeeded, None, )) } "5105105105105100" | "4000000000000002" => { Ok(types::DummyConnectorCardFlow::NoThreeDS( types::DummyConnectorStatus::Failed, Some(errors::DummyConnectorErrors::PaymentDeclined { message: "Card declined", }), )) } "4000000000009995" => { if connector == DummyConnectors::StripeTest { Ok(types::DummyConnectorCardFlow::NoThreeDS( types::DummyConnectorStatus::Succeeded, None, )) } else { Ok(types::DummyConnectorCardFlow::NoThreeDS( types::DummyConnectorStatus::Failed, Some(errors::DummyConnectorErrors::PaymentDeclined { message: "Internal Server Error from Connector, Please try again later", }), )) } } "4000000000009987" => Ok(types::DummyConnectorCardFlow::NoThreeDS( types::DummyConnectorStatus::Failed, Some(errors::DummyConnectorErrors::PaymentDeclined { message: "Lost card", }), )), "4000000000009979" => Ok(types::DummyConnectorCardFlow::NoThreeDS( types::DummyConnectorStatus::Failed, Some(errors::DummyConnectorErrors::PaymentDeclined { message: "Stolen card", }), )), "4000003800000446" => Ok(types::DummyConnectorCardFlow::ThreeDS( types::DummyConnectorStatus::Succeeded, None, )), _ => Err(report!(errors::DummyConnectorErrors::CardNotSupported) .attach_printable("The card is not supported")), } }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "types::DummyConnectorCard", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "get_flow_from_card_number", "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_types::DummyConnectorPaymentData_process_payment_attempt
clm
method
// hyperswitch/crates/router/src/routes/dummy_connector/utils.rs // impl for types::DummyConnectorPaymentData pub fn process_payment_attempt( state: &SessionState, payment_attempt: types::DummyConnectorPaymentAttempt, ) -> types::DummyConnectorResult<Self> { let redirect_url = format!( "{}/dummy-connector/authorize/{}", state.base_url, payment_attempt.attempt_id ); payment_attempt .clone() .payment_request .payment_method_data .build_payment_data_from_payment_attempt(payment_attempt, redirect_url) }
{ "chunk": null, "crate": "router", "enum_name": null, "file_size": null, "for_type": "types::DummyConnectorPaymentData", "function_name": null, "is_async": null, "is_pub": null, "lines": null, "method_name": "process_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 }