text
string
file_path
string
module
string
type
string
tokens
int64
language
string
struct_name
string
type_name
string
trait_name
string
impl_type
string
function_name
string
source
string
section
string
keys
list
macro_type
string
url
string
title
string
chunk_index
int64
pub struct Address { pub address_id: String, pub city: Option<String>, pub country: Option<enums::CountryAlpha2>, pub line1: Option<Encryption>, pub line2: Option<Encryption>, pub line3: Option<Encryption>, pub state: Option<Encryption>, pub zip: Option<Encryption>, pub first_name: Option<Encryption>, pub last_name: Option<Encryption>, pub phone_number: Option<Encryption>, pub country_code: Option<String>, pub created_at: PrimitiveDateTime, pub modified_at: PrimitiveDateTime, pub customer_id: Option<common_utils::id_type::CustomerId>, pub merchant_id: common_utils::id_type::MerchantId, pub payment_id: Option<common_utils::id_type::PaymentId>, pub updated_by: String, pub email: Option<Encryption>, pub origin_zip: Option<Encryption>, }
crates/diesel_models/src/address.rs
diesel_models
struct_definition
194
rust
Address
null
null
null
null
null
null
null
null
null
null
null
pub async fn update_merchant( state: web::Data<AppState>, req: HttpRequest, path: web::Path<common_utils::id_type::MerchantId>, json_payload: web::Json<recon_api::ReconUpdateMerchantRequest>, ) -> HttpResponse { let flow = Flow::ReconMerchantUpdate; let merchant_id = path.into_inner(); Box::pin(api::server_wrap( flow, state, &req, json_payload.into_inner(), |state, auth, req, _| recon::recon_merchant_account_update(state, auth, req), &authentication::AdminApiAuthWithMerchantIdFromRoute(merchant_id), api_locking::LockAction::NotApplicable, )) .await }
crates/router/src/routes/recon.rs
router
function_signature
162
rust
null
null
null
null
update_merchant
null
null
null
null
null
null
null
impl StrongEq for String { fn strong_eq(&self, other: &Self) -> bool { let lhs = self.as_bytes(); let rhs = other.as_bytes(); bool::from(lhs.ct_eq(rhs)) } }
crates/masking/src/strong_secret.rs
masking
impl_block
49
rust
null
String
StrongEq for
impl StrongEq for for String
null
null
null
null
null
null
null
null
pub async fn get_aggregates_for_disputes( state: SessionState, merchant_context: domain::MerchantContext, profile_id_list: Option<Vec<common_utils::id_type::ProfileId>>, time_range: common_utils::types::TimeRange, ) -> RouterResponse<dispute_models::DisputesAggregateResponse> { let db = state.store.as_ref(); let dispute_status_with_count = db .get_dispute_status_with_count( merchant_context.get_merchant_account().get_id(), profile_id_list, &time_range, ) .await .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable("Unable to retrieve disputes aggregate")?; let mut status_map: HashMap<storage_enums::DisputeStatus, i64> = dispute_status_with_count.into_iter().collect(); for status in storage_enums::DisputeStatus::iter() { status_map.entry(status).or_default(); } Ok(services::ApplicationResponse::Json( dispute_models::DisputesAggregateResponse { status_with_count: status_map, }, )) }
crates/router/src/core/disputes.rs
router
function_signature
240
rust
null
null
null
null
get_aggregates_for_disputes
null
null
null
null
null
null
null
pub fn with_config_path(config_path: Option<PathBuf>) -> Result<Self, errors::DrainerError> { // Configuration values are picked up in the following priority order (1 being least // priority): // 1. Defaults from the implementation of the `Default` trait. // 2. Values from config file. The config file accessed depends on the environment // specified by the `RUN_ENV` environment variable. `RUN_ENV` can be one of // `development`, `sandbox` or `production`. If nothing is specified for `RUN_ENV`, // `/config/development.toml` file is read. // 3. Environment variables prefixed with `DRAINER` and each level separated by double // underscores. // // Values in config file override the defaults in `Default` trait, and the values set using // environment variables override both the defaults and the config file values. let environment = env::which(); let config_path = router_env::Config::config_path(&environment.to_string(), config_path); let config = router_env::Config::builder(&environment.to_string())? .add_source(File::from(config_path).required(false)) .add_source( Environment::with_prefix("DRAINER") .try_parsing(true) .separator("__") .list_separator(",") .with_list_parse_key("redis.cluster_urls"), ) .build()?; // The logger may not yet be initialized when constructing the application configuration #[allow(clippy::print_stderr)] serde_path_to_error::deserialize(config).map_err(|error| { logger::error!(%error, "Unable to deserialize application configuration"); eprintln!("Unable to deserialize application configuration: {error}"); errors::DrainerError::from(error.into_inner()) }) }
crates/drainer/src/settings.rs
drainer
function_signature
390
rust
null
null
null
null
with_config_path
null
null
null
null
null
null
null
impl PaymentUpdate { fn populate_payment_attempt_with_request( payment_attempt: &mut storage::PaymentAttempt, request: &api::PaymentsRequest, ) { request .business_sub_label .clone() .map(|bsl| payment_attempt.business_sub_label.replace(bsl)); request .payment_method_type .map(|pmt| payment_attempt.payment_method_type.replace(pmt)); request .payment_experience .map(|experience| payment_attempt.payment_experience.replace(experience)); payment_attempt.amount_to_capture = request .amount_to_capture .or(payment_attempt.amount_to_capture); request .capture_method .map(|i| payment_attempt.capture_method.replace(i)); } fn populate_payment_intent_with_request( payment_intent: &mut storage::PaymentIntent, request: &api::PaymentsRequest, ) { request .return_url .clone() .map(|i| payment_intent.return_url.replace(i.to_string())); payment_intent.business_country = request.business_country; payment_intent .business_label .clone_from(&request.business_label); request .description .clone() .map(|i| payment_intent.description.replace(i)); request .statement_descriptor_name .clone() .map(|i| payment_intent.statement_descriptor_name.replace(i)); request .statement_descriptor_suffix .clone() .map(|i| payment_intent.statement_descriptor_suffix.replace(i)); request .client_secret .clone() .map(|i| payment_intent.client_secret.replace(i)); } }
crates/router/src/core/payments/operations/payment_update.rs
router
impl_block
351
rust
null
PaymentUpdate
null
impl PaymentUpdate
null
null
null
null
null
null
null
null
impl Organization { pub fn new(org_new: OrganizationNew) -> Self { let OrganizationNew { org_id, org_name, organization_details, metadata, created_at, modified_at, id: _, organization_name: _, version, organization_type, platform_merchant_id, } = org_new; Self { id: Some(org_id.clone()), organization_name: org_name.clone(), org_id, org_name, organization_details, metadata, created_at, modified_at, version, organization_type: Some(organization_type), platform_merchant_id, } } pub fn get_organization_type(&self) -> common_enums::OrganizationType { self.organization_type.unwrap_or_default() } }
crates/diesel_models/src/organization.rs
diesel_models
impl_block
166
rust
null
Organization
null
impl Organization
null
null
null
null
null
null
null
null
pub fn permanent_card( payment_method_id: common_utils::id_type::GlobalPaymentMethodId, locker_id: Option<String>, token: String, ) -> Self { Self::PermanentCard(CardTokenData { payment_method_id, locker_id, token, }) }
crates/router/src/types/storage/payment_method.rs
router
function_signature
63
rust
null
null
null
null
permanent_card
null
null
null
null
null
null
null
pub struct Chargebee { amount_converter: &'static (dyn AmountConvertor<Output = MinorUnit> + Sync), }
crates/hyperswitch_connectors/src/connectors/chargebee.rs
hyperswitch_connectors
struct_definition
26
rust
Chargebee
null
null
null
null
null
null
null
null
null
null
null
pub struct PaymentMethodCreateWrapper(pub api::payment_methods::PaymentMethodCreate);
crates/router/src/core/webhooks/network_tokenization_incoming.rs
router
struct_definition
16
rust
PaymentMethodCreateWrapper
null
null
null
null
null
null
null
null
null
null
null
pub async fn get_multiple_dashboard_metadata( state: web::Data<AppState>, req: HttpRequest, query: web::Query<user_api::dashboard_metadata::GetMultipleMetaDataRequest>, ) -> HttpResponse { let flow = Flow::GetMultipleDashboardMetadata; let payload = match ReportSwitchExt::<_, ApiErrorResponse>::switch(parse_string_to_enums( query.into_inner().keys, )) { Ok(payload) => payload, Err(e) => { return api::log_and_return_error_response(e); } }; Box::pin(api::server_wrap( flow, state, &req, payload, user_core::dashboard_metadata::get_multiple_metadata, &auth::DashboardNoPermissionAuth, api_locking::LockAction::NotApplicable, )) .await }
crates/router/src/routes/user.rs
router
function_signature
174
rust
null
null
null
null
get_multiple_dashboard_metadata
null
null
null
null
null
null
null
pub struct RedsysOperationsResponse { #[serde(rename = "Ds_Order")] ds_order: String, #[serde(rename = "Ds_Response")] ds_response: DsResponse, #[serde(rename = "Ds_AuthorisationCode")] ds_authorisation_code: Option<String>, }
crates/hyperswitch_connectors/src/connectors/redsys/transformers.rs
hyperswitch_connectors
struct_definition
61
rust
RedsysOperationsResponse
null
null
null
null
null
null
null
null
null
null
null
File: crates/router/src/core/utils/refunds_transformers.rs Public structs: 1 pub struct SplitRefundInput { pub refund_request: Option<common_types::refunds::SplitRefund>, pub payment_charges: Option<common_types::payments::ConnectorChargeResponseData>, pub split_payment_request: Option<common_types::payments::SplitPaymentsRequest>, pub charge_id: Option<String>, }
crates/router/src/core/utils/refunds_transformers.rs
router
full_file
87
null
null
null
null
null
null
null
null
null
null
null
null
null
/// Get tenant id from String pub fn try_from_string(tenant_id: String) -> CustomResult<Self, ValidationError> { Self::try_from(std::borrow::Cow::from(tenant_id)) }
crates/common_utils/src/id_type/tenant.rs
common_utils
function_signature
45
rust
null
null
null
null
try_from_string
null
null
null
null
null
null
null
pub fn get_request_extended_authorization_bool_if_connector_supports( &self, connector: common_enums::connector_enums::Connector, always_request_extended_authorization_optional: Option<AlwaysRequestExtendedAuthorization>, payment_method_optional: Option<common_enums::PaymentMethod>, payment_method_type_optional: Option<common_enums::PaymentMethodType>, ) -> Option<RequestExtendedAuthorizationBool> { use router_env::logger; let is_extended_authorization_supported_by_connector = || { let supported_pms = connector.get_payment_methods_supporting_extended_authorization(); let supported_pmts = connector.get_payment_method_types_supporting_extended_authorization(); // check if payment method or payment method type is supported by the connector logger::info!( "Extended Authentication Connector:{:?}, Supported payment methods: {:?}, Supported payment method types: {:?}, Payment method Selected: {:?}, Payment method type Selected: {:?}", connector, supported_pms, supported_pmts, payment_method_optional, payment_method_type_optional ); match (payment_method_optional, payment_method_type_optional) { (Some(payment_method), Some(payment_method_type)) => { supported_pms.contains(&payment_method) && supported_pmts.contains(&payment_method_type) } (Some(payment_method), None) => supported_pms.contains(&payment_method), (None, Some(payment_method_type)) => supported_pmts.contains(&payment_method_type), (None, None) => false, } }; let intent_request_extended_authorization_optional = self.request_extended_authorization; if always_request_extended_authorization_optional.is_some_and( |always_request_extended_authorization| *always_request_extended_authorization, ) || intent_request_extended_authorization_optional.is_some_and( |intent_request_extended_authorization| *intent_request_extended_authorization, ) { Some(is_extended_authorization_supported_by_connector()) } else { None } .map(RequestExtendedAuthorizationBool::from) }
crates/hyperswitch_domain_models/src/payments.rs
hyperswitch_domain_models
function_signature
425
rust
null
null
null
null
get_request_extended_authorization_bool_if_connector_supports
null
null
null
null
null
null
null
File: crates/api_models/src/analytics/outgoing_webhook_event.rs Public structs: 1 #[derive(Clone, Debug, serde::Deserialize, serde::Serialize)] pub struct OutgoingWebhookLogsRequest { pub payment_id: common_utils::id_type::PaymentId, pub event_id: Option<String>, pub refund_id: Option<String>, pub dispute_id: Option<String>, pub mandate_id: Option<String>, pub payment_method_id: Option<String>, pub attempt_id: Option<String>, }
crates/api_models/src/analytics/outgoing_webhook_event.rs
api_models
full_file
108
null
null
null
null
null
null
null
null
null
null
null
null
null
pub fn is_three_ds_authentication(self) -> bool { matches!(self, Self::ThreeDsAuthentication) }
crates/common_enums/src/enums.rs
common_enums
function_signature
24
rust
null
null
null
null
is_three_ds_authentication
null
null
null
null
null
null
null
impl super::payments::filters::PaymentFilterAnalytics for SqlxClient {}
crates/analytics/src/sqlx.rs
analytics
impl_block
15
rust
null
SqlxClient
super::payments::filters::PaymentFilterAnalytics for
impl super::payments::filters::PaymentFilterAnalytics for for SqlxClient
null
null
null
null
null
null
null
null
pub async fn decide_connector<F, D>( state: SessionState, merchant_context: &domain::MerchantContext, business_profile: &domain::Profile, payment_data: &mut D, request_straight_through: Option<api::routing::StraightThroughAlgorithm>, routing_data: &mut storage::RoutingData, eligible_connectors: Option<Vec<enums::RoutableConnectors>>, mandate_type: Option<api::MandateTransactionType>, ) -> RouterResult<ConnectorCallType> where F: Send + Clone, D: OperationSessionGetters<F> + OperationSessionSetters<F> + Send + Sync + Clone, { // If the connector was already decided previously, use the same connector // This is in case of flows like payments_sync, payments_cancel where the successive operations // with the connector have to be made using the same connector account. if let Some(ref connector_name) = payment_data.get_payment_attempt().connector { // Connector was already decided previously, use the same connector let connector_data = api::ConnectorData::get_connector_by_name( &state.conf.connectors, connector_name, api::GetToken::Connector, payment_data .get_payment_attempt() .merchant_connector_id .clone(), ) .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable("Invalid connector name received in 'routed_through'")?; routing_data.routed_through = Some(connector_name.clone()); logger::debug!("euclid_routing: predetermined connector present in attempt"); return Ok(ConnectorCallType::PreDetermined(connector_data.into())); } if let Some(mandate_connector_details) = payment_data.get_mandate_connector().as_ref() { let connector_data = api::ConnectorData::get_connector_by_name( &state.conf.connectors, &mandate_connector_details.connector, api::GetToken::Connector, mandate_connector_details.merchant_connector_id.clone(), ) .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable("Invalid connector name received in 'routed_through'")?; routing_data.routed_through = Some(mandate_connector_details.connector.clone()); routing_data .merchant_connector_id .clone_from(&mandate_connector_details.merchant_connector_id); logger::debug!("euclid_routing: predetermined mandate connector"); return Ok(ConnectorCallType::PreDetermined(connector_data.into())); } if let Some((pre_routing_results, storage_pm_type)) = routing_data.routing_info.pre_routing_results.as_ref().zip( payment_data .get_payment_attempt() .payment_method_type .as_ref(), ) { if let (Some(routable_connector_choice), None) = ( pre_routing_results.get(storage_pm_type), &payment_data.get_token_data(), ) { let routable_connector_list = match routable_connector_choice { storage::PreRoutingConnectorChoice::Single(routable_connector) => { vec![routable_connector.clone()] } storage::PreRoutingConnectorChoice::Multiple(routable_connector_list) => { routable_connector_list.clone() } }; let mut pre_routing_connector_data_list = vec![]; let first_routable_connector = routable_connector_list .first() .ok_or(errors::ApiErrorResponse::IncorrectPaymentMethodConfiguration)?; routing_data.routed_through = Some(first_routable_connector.connector.to_string()); routing_data .merchant_connector_id .clone_from(&first_routable_connector.merchant_connector_id); for connector_choice in routable_connector_list.clone() { let connector_data = api::ConnectorData::get_connector_by_name( &state.conf.connectors, &connector_choice.connector.to_string(), api::GetToken::Connector, connector_choice.merchant_connector_id.clone(), ) .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable("Invalid connector name received")? .into(); pre_routing_connector_data_list.push(connector_data); } #[cfg(feature = "retry")] let should_do_retry = retry::config_should_call_gsm( &*state.store, merchant_context.get_merchant_account().get_id(), business_profile, ) .await; #[cfg(feature = "retry")] if payment_data.get_payment_attempt().payment_method_type == Some(storage_enums::PaymentMethodType::ApplePay) && should_do_retry { let retryable_connector_data = helpers::get_apple_pay_retryable_connectors( &state, merchant_context, payment_data, &pre_routing_connector_data_list, first_routable_connector .merchant_connector_id .clone() .as_ref(), business_profile.clone(), ) .await?; if let Some(connector_data_list) = retryable_connector_data { if connector_data_list.len() > 1 { logger::info!("Constructed apple pay retryable connector list"); return Ok(ConnectorCallType::Retryable(connector_data_list)); } } } logger::debug!("euclid_routing: pre-routing connector present"); let first_pre_routing_connector_data_list = pre_routing_connector_data_list .first() .ok_or(errors::ApiErrorResponse::IncorrectPaymentMethodConfiguration)?; helpers::override_setup_future_usage_to_on_session(&*state.store, payment_data).await?; return Ok(ConnectorCallType::PreDetermined( first_pre_routing_connector_data_list.clone(), )); } } if let Some(routing_algorithm) = request_straight_through { let (mut connectors, check_eligibility) = routing::perform_straight_through_routing( &routing_algorithm, payment_data.get_creds_identifier(), ) .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable("Failed execution of straight through routing")?; payment_data.set_routing_approach_in_attempt(Some( common_enums::RoutingApproach::StraightThroughRouting, )); if check_eligibility { let transaction_data = core_routing::PaymentsDslInput::new( payment_data.get_setup_mandate(), payment_data.get_payment_attempt(), payment_data.get_payment_intent(), payment_data.get_payment_method_data(), payment_data.get_address(), payment_data.get_recurring_details(), payment_data.get_currency(), ); connectors = routing::perform_eligibility_analysis_with_fallback( &state.clone(), merchant_context.get_merchant_key_store(), connectors, &TransactionData::Payment(transaction_data), eligible_connectors, business_profile, ) .await .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable("failed eligibility analysis and fallback")?; } let connector_data = connectors .into_iter() .map(|conn| { api::ConnectorData::get_connector_by_name( &state.conf.connectors, &conn.connector.to_string(), api::GetToken::Connector, conn.merchant_connector_id.clone(), ) .map(|connector_data| connector_data.into()) }) .collect::<CustomResult<Vec<_>, _>>() .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable("Invalid connector name received")?; logger::debug!("euclid_routing: straight through connector present"); return decide_multiplex_connector_for_normal_or_recurring_payment( &state, payment_data, routing_data, connector_data, mandate_type, business_profile.is_connector_agnostic_mit_enabled, business_profile.is_network_tokenization_enabled, ) .await; } if let Some(ref routing_algorithm) = routing_data.routing_info.algorithm { let (mut connectors, check_eligibility) = routing::perform_straight_through_routing( routing_algorithm, payment_data.get_creds_identifier(), ) .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable("Failed execution of straight through routing")?; if check_eligibility { let transaction_data = core_routing::PaymentsDslInput::new( payment_data.get_setup_mandate(), payment_data.get_payment_attempt(), payment_data.get_payment_intent(), payment_data.get_payment_method_data(), payment_data.get_address(), payment_data.get_recurring_details(), payment_data.get_currency(), ); connectors = routing::perform_eligibility_analysis_with_fallback( &state, merchant_context.get_merchant_key_store(), connectors, &TransactionData::Payment(transaction_data), eligible_connectors, business_profile, ) .await .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable("failed eligibility analysis and fallback")?; } logger::debug!("euclid_routing: single connector present in algorithm data"); let connector_data = connectors .into_iter() .map(|conn| { api::ConnectorData::get_connector_by_name( &state.conf.connectors, &conn.connector.to_string(), api::GetToken::Connector, conn.merchant_connector_id, ) .map(|connector_data| connector_data.into()) }) .collect::<CustomResult<Vec<_>, _>>() .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable("Invalid connector name received")?; return decide_multiplex_connector_for_normal_or_recurring_payment( &state, payment_data, routing_data, connector_data, mandate_type, business_profile.is_connector_agnostic_mit_enabled, business_profile.is_network_tokenization_enabled, ) .await; } let new_pd = payment_data.clone(); let transaction_data = core_routing::PaymentsDslInput::new( new_pd.get_setup_mandate(), new_pd.get_payment_attempt(), new_pd.get_payment_intent(), new_pd.get_payment_method_data(), new_pd.get_address(), new_pd.get_recurring_details(), new_pd.get_currency(), ); route_connector_v1_for_payments( &state, merchant_context, business_profile, payment_data, transaction_data, routing_data, eligible_connectors, mandate_type, ) .await }
crates/router/src/core/payments.rs
router
function_signature
2,162
rust
null
null
null
null
decide_connector
null
null
null
null
null
null
null
pub struct CybersourceServerErrorResponse { pub status: Option<String>, pub message: Option<String>, pub reason: Option<Reason>, }
crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs
hyperswitch_connectors
struct_definition
31
rust
CybersourceServerErrorResponse
null
null
null
null
null
null
null
null
null
null
null
impl api::MandateSetup for Worldpayvantiv {}
crates/hyperswitch_connectors/src/connectors/worldpayvantiv.rs
hyperswitch_connectors
impl_block
13
rust
null
Worldpayvantiv
api::MandateSetup for
impl api::MandateSetup for for Worldpayvantiv
null
null
null
null
null
null
null
null
File: crates/router/src/services/kafka/authentication.rs Public functions: 1 Public structs: 1 use diesel_models::{authentication::Authentication, enums as storage_enums}; use time::OffsetDateTime; #[derive(serde::Serialize, Debug)] pub struct KafkaAuthentication<'a> { pub authentication_id: &'a common_utils::id_type::AuthenticationId, pub merchant_id: &'a common_utils::id_type::MerchantId, pub authentication_connector: Option<&'a String>, pub connector_authentication_id: Option<&'a String>, pub authentication_data: Option<serde_json::Value>, pub payment_method_id: &'a String, pub authentication_type: Option<storage_enums::DecoupledAuthenticationType>, pub authentication_status: storage_enums::AuthenticationStatus, pub authentication_lifecycle_status: storage_enums::AuthenticationLifecycleStatus, #[serde(default, with = "time::serde::timestamp::milliseconds")] pub created_at: OffsetDateTime, #[serde(default, with = "time::serde::timestamp::milliseconds")] pub modified_at: OffsetDateTime, pub error_message: Option<&'a String>, pub error_code: Option<&'a String>, pub connector_metadata: Option<serde_json::Value>, pub maximum_supported_version: Option<common_utils::types::SemanticVersion>, pub threeds_server_transaction_id: Option<&'a String>, pub cavv: Option<&'a String>, pub authentication_flow_type: Option<&'a String>, pub message_version: Option<common_utils::types::SemanticVersion>, pub eci: Option<&'a String>, pub trans_status: Option<storage_enums::TransactionStatus>, pub acquirer_bin: Option<&'a String>, pub acquirer_merchant_id: Option<&'a String>, pub three_ds_method_data: Option<&'a String>, pub three_ds_method_url: Option<&'a String>, pub acs_url: Option<&'a String>, pub challenge_request: Option<&'a String>, pub acs_reference_number: Option<&'a String>, pub acs_trans_id: Option<&'a String>, pub acs_signed_content: Option<&'a String>, pub profile_id: &'a common_utils::id_type::ProfileId, pub payment_id: Option<&'a common_utils::id_type::PaymentId>, pub merchant_connector_id: Option<&'a common_utils::id_type::MerchantConnectorAccountId>, pub ds_trans_id: Option<&'a String>, pub directory_server_id: Option<&'a String>, pub acquirer_country_code: Option<&'a String>, pub organization_id: &'a common_utils::id_type::OrganizationId, } impl<'a> KafkaAuthentication<'a> { pub fn from_storage(authentication: &'a Authentication) -> Self { Self { created_at: authentication.created_at.assume_utc(), modified_at: authentication.modified_at.assume_utc(), authentication_id: &authentication.authentication_id, merchant_id: &authentication.merchant_id, authentication_status: authentication.authentication_status, authentication_connector: authentication.authentication_connector.as_ref(), connector_authentication_id: authentication.connector_authentication_id.as_ref(), authentication_data: authentication.authentication_data.clone(), payment_method_id: &authentication.payment_method_id, authentication_type: authentication.authentication_type, authentication_lifecycle_status: authentication.authentication_lifecycle_status, error_code: authentication.error_code.as_ref(), error_message: authentication.error_message.as_ref(), connector_metadata: authentication.connector_metadata.clone(), maximum_supported_version: authentication.maximum_supported_version.clone(), threeds_server_transaction_id: authentication.threeds_server_transaction_id.as_ref(), cavv: authentication.cavv.as_ref(), authentication_flow_type: authentication.authentication_flow_type.as_ref(), message_version: authentication.message_version.clone(), eci: authentication.eci.as_ref(), trans_status: authentication.trans_status.clone(), acquirer_bin: authentication.acquirer_bin.as_ref(), acquirer_merchant_id: authentication.acquirer_merchant_id.as_ref(), three_ds_method_data: authentication.three_ds_method_data.as_ref(), three_ds_method_url: authentication.three_ds_method_url.as_ref(), acs_url: authentication.acs_url.as_ref(), challenge_request: authentication.challenge_request.as_ref(), acs_reference_number: authentication.acs_reference_number.as_ref(), acs_trans_id: authentication.acs_trans_id.as_ref(), acs_signed_content: authentication.acs_signed_content.as_ref(), profile_id: &authentication.profile_id, payment_id: authentication.payment_id.as_ref(), merchant_connector_id: authentication.merchant_connector_id.as_ref(), ds_trans_id: authentication.ds_trans_id.as_ref(), directory_server_id: authentication.directory_server_id.as_ref(), acquirer_country_code: authentication.acquirer_country_code.as_ref(), organization_id: &authentication.organization_id, } } } impl super::KafkaMessage for KafkaAuthentication<'_> { fn key(&self) -> String { format!( "{}_{}", self.merchant_id.get_string_repr(), self.authentication_id.get_string_repr() ) } fn event_type(&self) -> crate::events::EventType { crate::events::EventType::Authentication } }
crates/router/src/services/kafka/authentication.rs
router
full_file
1,110
null
null
null
null
null
null
null
null
null
null
null
null
null
impl ExternalAuthentication for Netcetera {}
crates/hyperswitch_connectors/src/connectors/netcetera.rs
hyperswitch_connectors
impl_block
9
rust
null
Netcetera
ExternalAuthentication for
impl ExternalAuthentication for for Netcetera
null
null
null
null
null
null
null
null
pub async fn get_payments_aggregates_profile( state: web::Data<app::AppState>, req: actix_web::HttpRequest, payload: web::Query<common_utils::types::TimeRange>, ) -> impl Responder { let flow = Flow::PaymentsAggregate; let payload = payload.into_inner(); Box::pin(api::server_wrap( flow, state, &req, payload, |state, auth: auth::AuthenticationData, req, _| { let merchant_context = domain::MerchantContext::NormalMerchant(Box::new( domain::Context(auth.merchant_account, auth.key_store), )); payments::get_aggregates_for_payments( state, merchant_context, Some(vec![auth.profile.get_id().clone()]), req, ) }, &auth::JWTAuth { permission: Permission::ProfilePaymentRead, }, api_locking::LockAction::NotApplicable, )) .await }
crates/router/src/routes/payments.rs
router
function_signature
209
rust
null
null
null
null
get_payments_aggregates_profile
null
null
null
null
null
null
null
impl api::MandateSetup for Multisafepay {}
crates/hyperswitch_connectors/src/connectors/multisafepay.rs
hyperswitch_connectors
impl_block
14
rust
null
Multisafepay
api::MandateSetup for
impl api::MandateSetup for for Multisafepay
null
null
null
null
null
null
null
null
pub struct RevenueRecoveryInvoice(revenue_recovery::RevenueRecoveryInvoiceData);
crates/router/src/core/webhooks/recovery_incoming.rs
router
struct_definition
16
rust
RevenueRecoveryInvoice
null
null
null
null
null
null
null
null
null
null
null
pub fn supports_file_storage_module(self) -> bool { matches!(self, Self::Stripe | Self::Checkout | Self::Worldpayvantiv) }
crates/common_enums/src/connector_enums.rs
common_enums
function_signature
33
rust
null
null
null
null
supports_file_storage_module
null
null
null
null
null
null
null
pub struct ClickhouseClient { pub config: Arc<ClickhouseConfig>, pub database: String, }
crates/analytics/src/clickhouse.rs
analytics
struct_definition
23
rust
ClickhouseClient
null
null
null
null
null
null
null
null
null
null
null
pub struct NovalnetRefundResponse { pub customer: Option<NovalnetResponseCustomer>, pub merchant: Option<NovalnetResponseMerchant>, pub result: ResultData, pub transaction: Option<NovalnetRefundsTransactionData>, }
crates/hyperswitch_connectors/src/connectors/novalnet/transformers.rs
hyperswitch_connectors
struct_definition
55
rust
NovalnetRefundResponse
null
null
null
null
null
null
null
null
null
null
null
pub struct Helcim { amount_convertor: &'static (dyn AmountConvertor<Output = FloatMajorUnit> + Sync), }
crates/hyperswitch_connectors/src/connectors/helcim.rs
hyperswitch_connectors
struct_definition
29
rust
Helcim
null
null
null
null
null
null
null
null
null
null
null
pub struct ExternalVaultTokenData { /// Tokenized reference for Card Number pub tokenized_card_number: masking::Secret<String>, }
crates/api_models/src/payment_methods.rs
api_models
struct_definition
29
rust
ExternalVaultTokenData
null
null
null
null
null
null
null
null
null
null
null
impl Tokenizable for SetupMandateRequestData { fn set_session_token(&mut self, _token: Option<String>) {} }
crates/router/src/types.rs
router
impl_block
28
rust
null
SetupMandateRequestData
Tokenizable for
impl Tokenizable for for SetupMandateRequestData
null
null
null
null
null
null
null
null
pub async fn execute_decision_rule( state: web::Data<app::AppState>, req: actix_web::HttpRequest, payload: web::Json<api_models::three_ds_decision_rule::ThreeDsDecisionRuleExecuteRequest>, ) -> impl Responder { let flow = Flow::ThreeDsDecisionRuleExecute; let payload = payload.into_inner(); Box::pin(api::server_wrap( flow, state, &req, payload, |state, auth: auth::AuthenticationData, req, _| { let merchant_context = MerchantContext::NormalMerchant(Box::new(Context( auth.merchant_account, auth.key_store, ))); three_ds_decision_rule_core::execute_three_ds_decision_rule( state, merchant_context, req, ) }, &auth::HeaderAuth(auth::ApiKeyAuth { is_connected_allowed: false, is_platform_allowed: false, }), api_locking::LockAction::NotApplicable, )) .await }
crates/router/src/routes/three_ds_decision_rule.rs
router
function_signature
214
rust
null
null
null
null
execute_decision_rule
null
null
null
null
null
null
null
File: crates/common_utils/src/id_type/organization.rs Public functions: 1 use crate::errors::{CustomResult, ValidationError}; crate::id_type!( OrganizationId, "A type for organization_id that can be used for organization ids" ); crate::impl_id_type_methods!(OrganizationId, "organization_id"); // This is to display the `OrganizationId` as OrganizationId(abcd) crate::impl_debug_id_type!(OrganizationId); crate::impl_default_id_type!(OrganizationId, "org"); crate::impl_try_from_cow_str_id_type!(OrganizationId, "organization_id"); crate::impl_generate_id_id_type!(OrganizationId, "org"); crate::impl_serializable_secret_id_type!(OrganizationId); crate::impl_queryable_id_type!(OrganizationId); crate::impl_to_sql_from_sql_id_type!(OrganizationId); impl OrganizationId { /// Get an organization id from String pub fn try_from_string(org_id: String) -> CustomResult<Self, ValidationError> { Self::try_from(std::borrow::Cow::from(org_id)) } }
crates/common_utils/src/id_type/organization.rs
common_utils
full_file
224
null
null
null
null
null
null
null
null
null
null
null
null
null
pub fn get_link_with_token( base_url: impl std::fmt::Display, token: impl std::fmt::Display, action: impl std::fmt::Display, auth_id: &Option<impl std::fmt::Display>, theme_id: &Option<impl std::fmt::Display>, ) -> String { let mut email_url = format!("{base_url}/user/{action}?token={token}"); if let Some(auth_id) = auth_id { email_url = format!("{email_url}&auth_id={auth_id}"); } if let Some(theme_id) = theme_id { email_url = format!("{email_url}&theme_id={theme_id}"); } email_url }
crates/router/src/services/email/types.rs
router
function_signature
150
rust
null
null
null
null
get_link_with_token
null
null
null
null
null
null
null
impl Parse for Input { fn parse(input: ParseStream<'_>) -> syn::Result<Self> { let (_permission_label, permissions) = parse_label_with_punctuated_data(input)?; Ok(Self { permissions }) } }
crates/router_derive/src/macros/generate_permissions.rs
router_derive
impl_block
49
rust
null
Input
Parse for
impl Parse for for Input
null
null
null
null
null
null
null
null
pub struct ApproveRequest {}
crates/hyperswitch_connectors/src/connectors/worldline/transformers.rs
hyperswitch_connectors
struct_definition
6
rust
ApproveRequest
null
null
null
null
null
null
null
null
null
null
null
pub fn is_pre_processing_required_before_authorize(self) -> bool { matches!(self, Self::Airwallex) }
crates/common_enums/src/connector_enums.rs
common_enums
function_signature
27
rust
null
null
null
null
is_pre_processing_required_before_authorize
null
null
null
null
null
null
null
impl IncomingWebhook for Forte { fn get_webhook_object_reference_id( &self, _request: &IncomingWebhookRequestDetails<'_>, ) -> CustomResult<ObjectReferenceId, errors::ConnectorError> { Err(report!(errors::ConnectorError::WebhooksNotImplemented)) } fn get_webhook_event_type( &self, _request: &IncomingWebhookRequestDetails<'_>, ) -> CustomResult<IncomingWebhookEvent, errors::ConnectorError> { Ok(IncomingWebhookEvent::EventNotSupported) } fn get_webhook_resource_object( &self, _request: &IncomingWebhookRequestDetails<'_>, ) -> CustomResult<Box<dyn masking::ErasedMaskSerialize>, errors::ConnectorError> { Err(report!(errors::ConnectorError::WebhooksNotImplemented)) } }
crates/hyperswitch_connectors/src/connectors/forte.rs
hyperswitch_connectors
impl_block
183
rust
null
Forte
IncomingWebhook for
impl IncomingWebhook for for Forte
null
null
null
null
null
null
null
null
pub fn get_pm_link_config_as_value( &self, ) -> CustomResult<Option<serde_json::Value>, errors::ParsingError> { self.pm_collect_link_config .as_ref() .map(|pm_collect_link_config| pm_collect_link_config.encode_to_value()) .transpose() }
crates/api_models/src/admin.rs
api_models
function_signature
66
rust
null
null
null
null
get_pm_link_config_as_value
null
null
null
null
null
null
null
pub fn get_invoice_webhook_data_from_body( body: &[u8], ) -> CustomResult<Self, errors::ConnectorError> { let webhook_body = body .parse_struct::<Self>("StripebillingInvoiceBody") .change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?; Ok(webhook_body) }
crates/hyperswitch_connectors/src/connectors/stripebilling/transformers.rs
hyperswitch_connectors
function_signature
73
rust
null
null
null
null
get_invoice_webhook_data_from_body
null
null
null
null
null
null
null
first_attempt, total, count, error_message, routing_approach, signature_network, is_issuer_regulated, is_debit_routed, start_bucket, end_bucket, }) } } impl<'a> FromRow<'a, PgRow> for super::payments::filters::PaymentFilterRow { fn from_row(row: &'a PgRow) -> sqlx::Result<Self> { let currency: Option<DBEnumWrapper<Currency>> = row.try_get("currency").or_else(|e| match e { ColumnNotFound(_) => Ok(Default::default()), e => Err(e), })?; let status: Option<DBEnumWrapper<AttemptStatus>> = row.try_get("status").or_else(|e| match e { ColumnNotFound(_) => Ok(Default::default()), e => Err(e), })?; let connector: Option<String> = row.try_get("connector").or_else(|e| match e { ColumnNotFound(_) => Ok(Default::default()), e => Err(e), })?; let authentication_type: Option<DBEnumWrapper<AuthenticationType>> = row.try_get("authentication_type").or_else(|e| match e { ColumnNotFound(_) => Ok(Default::default()), e => Err(e), })?; let payment_method: Option<String> = row.try_get("payment_method").or_else(|e| match e { ColumnNotFound(_) => Ok(Default::default()), e => Err(e), })?; let payment_method_type: Option<String> = row.try_get("payment_method_type").or_else(|e| match e { ColumnNotFound(_) => Ok(Default::default()), e => Err(e), })?; let client_source: Option<String> = row.try_get("client_source").or_else(|e| match e { ColumnNotFound(_) => Ok(Default::default()), e => Err(e), })?; let client_version: Option<String> = row.try_get("client_version").or_else(|e| match e { ColumnNotFound(_) => Ok(Default::default()), e => Err(e), })?; let profile_id: Option<String> = row.try_get("profile_id").or_else(|e| match e { ColumnNotFound(_) => Ok(Default::default()), e => Err(e), })?; let card_network: Option<String> = row.try_get("card_network").or_else(|e| match e { ColumnNotFound(_) => Ok(Default::default()), e => Err(e), })?; let merchant_id: Option<String> = row.try_get("merchant_id").or_else(|e| match e { ColumnNotFound(_) => Ok(Default::default()), e => Err(e), })?; let card_last_4: Option<String> = row.try_get("card_last_4").or_else(|e| match e { ColumnNotFound(_) => Ok(Default::default()), e => Err(e), })?; let card_issuer: Option<String> = row.try_get("card_issuer").or_else(|e| match e { ColumnNotFound(_) => Ok(Default::default()), e => Err(e), })?; let error_reason: Option<String> = row.try_get("error_reason").or_else(|e| match e { ColumnNotFound(_) => Ok(Default::default()), e => Err(e), })?; let first_attempt: Option<bool> = row.try_get("first_attempt").or_else(|e| match e { ColumnNotFound(_) => Ok(Default::default()), e => Err(e), })?; let routing_approach: Option<DBEnumWrapper<RoutingApproach>> = row.try_get("routing_approach").or_else(|e| match e { ColumnNotFound(_) => Ok(Default::default()), e => Err(e), })?; let signature_network: Option<String> = row.try_get("signature_network").or_else(|e| match e { ColumnNotFound(_) => Ok(Default::default()), e => Err(e), })?; let is_issuer_regulated: Option<bool> = row.try_get("is_issuer_regulated").or_else(|e| match e { ColumnNotFound(_) => Ok(Default::default()), e => Err(e), })?; let is_debit_routed: Option<bool> = row.try_get("is_debit_routed").or_else(|e| match e { ColumnNotFound(_) => Ok(Default::default()), e => Err(e), })?; Ok(Self { currency, status, connector, authentication_type, payment_method, payment_method_type, client_source, client_version, profile_id, card_network, merchant_id, card_last_4, card_issuer, error_reason, first_attempt, routing_approach, signature_network, is_issuer_regulated, is_debit_routed, }) } } impl<'a> FromRow<'a, PgRow> for super::payment_intents::metrics::PaymentIntentMetricRow { fn from_row(row: &'a PgRow) -> sqlx::Result<Self> { let status: Option<DBEnumWrapper<IntentStatus>> = row.try_get("status").or_else(|e| match e { ColumnNotFound(_) => Ok(Default::default()), e => Err(e), })?; let currency: Option<DBEnumWrapper<Currency>> = row.try_get("currency").or_else(|e| match e { ColumnNotFound(_) => Ok(Default::default()), e => Err(e), })?; let profile_id: Option<String> = row.try_get("profile_id").or_else(|e| match e { ColumnNotFound(_) => Ok(Default::default()), e => Err(e), })?; let connector: Option<String> = row.try_get("connector").or_else(|e| match e { ColumnNotFound(_) => Ok(Default::default()), e => Err(e), })?; let authentication_type: Option<DBEnumWrapper<AuthenticationType>> = row.try_get("authentication_type").or_else(|e| match e { ColumnNotFound(_) => Ok(Default::default()), e => Err(e), })?; let payment_method: Option<String> = row.try_get("payment_method").or_else(|e| match e { ColumnNotFound(_) => Ok(Default::default()), e => Err(e), })?; let payment_method_type: Option<String> = row.try_get("payment_method_type").or_else(|e| match e { ColumnNotFound(_) => Ok(Default::default()), e => Err(e), })?; let card_network: Option<String> = row.try_get("card_network").or_else(|e| match e { ColumnNotFound(_) => Ok(Default::default()), e => Err(e), })?; let merchant_id: Option<String> = row.try_get("merchant_id").or_else(|e| match e { ColumnNotFound(_) => Ok(Default::default()), e => Err(e), })?; let card_last_4: Option<String> = row.try_get("card_last_4").or_else(|e| match e { ColumnNotFound(_) => Ok(Default::default()), e => Err(e), })?; let card_issuer: Option<String> = row.try_get("card_issuer").or_else(|e| match e { ColumnNotFound(_) => Ok(Default::default()), e => Err(e), })?; let error_reason: Option<String> = row.try_get("error_reason").or_else(|e| match e { ColumnNotFound(_) => Ok(Default::default()), e => Err(e), })?; let total: Option<bigdecimal::BigDecimal> = row.try_get("total").or_else(|e| match e { ColumnNotFound(_) => Ok(Default::default()), e => Err(e), })?; let count: Option<i64> = row.try_get("count").or_else(|e| match e { ColumnNotFound(_) => Ok(Default::default()), e => Err(e), })?; let first_attempt: Option<i64> = row.try_get("first_attempt").or_else(|e| match e { ColumnNotFound(_) => Ok(Default::default()), e => Err(e), })?; // Removing millisecond precision to get accurate diffs against clickhouse let start_bucket: Option<PrimitiveDateTime> = row .try_get::<Option<PrimitiveDateTime>, _>("start_bucket")? .and_then(|dt| dt.replace_millisecond(0).ok()); let end_bucket: Option<PrimitiveDateTime> = row .try_get::<Option<PrimitiveDateTime>, _>("end_bucket")? .and_then(|dt| dt.replace_millisecond(0).ok()); Ok(Self { status, currency, profile_id, connector, authentication_type, payment_method, payment_method_type, card_network, merchant_id, card_last_4, card_issuer, error_reason, first_attempt, total, count, start_bucket, end_bucket, }) } } impl<'a> FromRow<'a, PgRow> for super::payment_intents::filters::PaymentIntentFilterRow { fn from_row(row: &'a PgRow) -> sqlx::Result<Self> { let status: Option<DBEnumWrapper<IntentStatus>> = row.try_get("status").or_else(|e| match e { ColumnNotFound(_) => Ok(Default::default()), e => Err(e), })?; let currency: Option<DBEnumWrapper<Currency>> = row.try_get("currency").or_else(|e| match e { ColumnNotFound(_) => Ok(Default::default()), e => Err(e), })?; let profile_id: Option<String> = row.try_get("profile_id").or_else(|e| match e { ColumnNotFound(_) => Ok(Default::default()), e => Err(e), })?; let connector: Option<String> = row.try_get("connector").or_else(|e| match e { ColumnNotFound(_) => Ok(Default::default()), e => Err(e), })?; let authentication_type: Option<DBEnumWrapper<AuthenticationType>> = row.try_get("authentication_type").or_else(|e| match e { ColumnNotFound(_) => Ok(Default::default()), e => Err(e), })?; let payment_method: Option<String> = row.try_get("payment_method").or_else(|e| match e { ColumnNotFound(_) => Ok(Default::default()), e => Err(e), })?; let payment_method_type: Option<String> = row.try_get("payment_method_type").or_else(|e| match e { ColumnNotFound(_) => Ok(Default::default()), e => Err(e), })?; let card_network: Option<String> = row.try_get("card_network").or_else(|e| match e { ColumnNotFound(_) => Ok(Default::default()), e => Err(e), })?; let merchant_id: Option<String> = row.try_get("merchant_id").or_else(|e| match e { ColumnNotFound(_) => Ok(Default::default()), e => Err(e), })?; let card_last_4: Option<String> = row.try_get("card_last_4").or_else(|e| match e { ColumnNotFound(_) => Ok(Default::default()), e => Err(e), })?; let card_issuer: Option<String> = row.try_get("card_issuer").or_else(|e| match e { ColumnNotFound(_) => Ok(Default::default()), e => Err(e), })?; let error_reason: Option<String> = row.try_get("error_reason").or_else(|e| match e { ColumnNotFound(_) => Ok(Default::default()), e => Err(e), })?; let customer_id: Option<String> = row.try_get("customer_id").or_else(|e| match e { ColumnNotFound(_) => Ok(Default::default()), e => Err(e), })?; Ok(Self { status, currency, profile_id, connector, authentication_type, payment_method, payment_method_type, card_network, merchant_id, card_last_4, card_issuer, error_reason, customer_id, }) } } impl<'a> FromRow<'a, PgRow> for super::refunds::filters::RefundFilterRow { fn from_row(row: &'a PgRow) -> sqlx::Result<Self> { let currency: Option<DBEnumWrapper<Currency>> = row.try_get("currency").or_else(|e| match e { ColumnNotFound(_) => Ok(Default::default()), e => Err(e), })?; let refund_status: Option<DBEnumWrapper<RefundStatus>> = row.try_get("refund_status").or_else(|e| match e { ColumnNotFound(_) => Ok(Default::default()), e => Err(e), })?; let connector: Option<String> = row.try_get("connector").or_else(|e| match e { ColumnNotFound(_) => Ok(Default::default()), e => Err(e), })?; let refund_type: Option<DBEnumWrapper<RefundType>> = row.try_get("refund_type").or_else(|e| match e { ColumnNotFound(_) => Ok(Default::default()), e => Err(e), })?; let profile_id: Option<String> = row.try_get("profile_id").or_else(|e| match e { ColumnNotFound(_) => Ok(Default::default()), e => Err(e), })?; let refund_reason: Option<String> = row.try_get("refund_reason").or_else(|e| match e { ColumnNotFound(_) => Ok(Default::default()), e => Err(e), })?; let refund_error_message: Option<String> = row.try_get("refund_error_message").or_else(|e| match e { ColumnNotFound(_) => Ok(Default::default()), e => Err(e), })?; Ok(Self { currency, refund_status, connector, refund_type, profile_id, refund_reason, refund_error_message, }) } } impl<'a> FromRow<'a, PgRow> for super::refunds::distribution::RefundDistributionRow { fn from_row(row: &'a PgRow) -> sqlx::Result<Self> { let currency: Option<DBEnumWrapper<Currency>> = row.try_get("currency").or_else(|e| match e { ColumnNotFound(_) => Ok(Default::default()), e => Err(e), })?; let refund_status: Option<DBEnumWrapper<RefundStatus>> = row.try_get("refund_status").or_else(|e| match e { ColumnNotFound(_) => Ok(Default::default()), e => Err(e), })?; let connector: Option<String> = row.try_get("connector").or_else(|e| match e { ColumnNotFound(_) => Ok(Default::default()), e => Err(e), })?; let refund_type: Option<DBEnumWrapper<RefundType>> = row.try_get("refund_type").or_else(|e| match e { ColumnNotFound(_) => Ok(Default::default()), e => Err(e), })?; let profile_id: Option<String> = row.try_get("profile_id").or_else(|e| match e { ColumnNotFound(_) => Ok(Default::default()), e => Err(e), })?; let total: Option<bigdecimal::BigDecimal> = row.try_get("total").or_else(|e| match e { ColumnNotFound(_) => Ok(Default::default()), e => Err(e), })?; let count: Option<i64> = row.try_get("count").or_else(|e| match e { ColumnNotFound(_) => Ok(Default::default()), e => Err(e), })?; let refund_reason: Option<String> = row.try_get("refund_reason").or_else(|e| match e { ColumnNotFound(_) => Ok(Default::default()), e => Err(e), })?; let refund_error_message: Option<String> = row.try_get("refund_error_message").or_else(|e| match e { ColumnNotFound(_) => Ok(Default::default()), e => Err(e), })?; // Removing millisecond precision to get accurate diffs against clickhouse let start_bucket: Option<PrimitiveDateTime> = row .try_get::<Option<PrimitiveDateTime>, _>("start_bucket")? .and_then(|dt| dt.replace_millisecond(0).ok()); let end_bucket: Option<PrimitiveDateTime> = row .try_get::<Option<PrimitiveDateTime>, _>("end_bucket")? .and_then(|dt| dt.replace_millisecond(0).ok()); Ok(Self { currency, refund_status, connector, refund_type, profile_id, total, count, refund_reason, refund_error_message, start_bucket, end_bucket, }) } } impl<'a> FromRow<'a, PgRow> for super::frm::filters::FrmFilterRow { fn from_row(row: &'a PgRow) -> sqlx::Result<Self> { let frm_name: Option<String> = row.try_get("frm_name").or_else(|e| match e { ColumnNotFound(_) => Ok(Default::default()), e => Err(e), })?; let frm_status: Option<DBEnumWrapper<FraudCheckStatus>> = row.try_get("frm_status").or_else(|e| match e { ColumnNotFound(_) => Ok(Default::default()), e => Err(e), })?; let frm_transaction_type: Option<DBEnumWrapper<FrmTransactionType>> = row.try_get("frm_transaction_type").or_else(|e| match e { ColumnNotFound(_) => Ok(Default::default()), e => Err(e), })?; Ok(Self { frm_name, frm_status, frm_transaction_type, }) } } impl<'a> FromRow<'a, PgRow> for super::disputes::filters::DisputeFilterRow { fn from_row(row: &'a PgRow) -> sqlx::Result<Self> { let dispute_stage: Option<String> = row.try_get("dispute_stage").or_else(|e| match e { ColumnNotFound(_) => Ok(Default::default()), e => Err(e), })?; let dispute_status: Option<String> = row.try_get("dispute_status").or_else(|e| match e { ColumnNotFound(_) => Ok(Default::default()), e => Err(e), })?; let connector: Option<String> = row.try_get("connector").or_else(|e| match e { ColumnNotFound(_) => Ok(Default::default()), e => Err(e), })?; let connector_status: Option<String> = row.try_get("connector_status").or_else(|e| match e { ColumnNotFound(_) => Ok(Default::default()), e => Err(e), })?; let currency: Option<DBEnumWrapper<Currency>> = row.try_get("currency").or_else(|e| match e { ColumnNotFound(_) => Ok(Default::default()), e => Err(e), })?; Ok(Self { dispute_stage, dispute_status, connector, connector_status, currency, }) } } impl<'a> FromRow<'a, PgRow> for super::disputes::metrics::DisputeMetricRow { fn from_row(row: &'a PgRow) -> sqlx::Result<Self> { let dispute_stage: Option<DBEnumWrapper<DisputeStage>> = row.try_get("dispute_stage").or_else(|e| match e { ColumnNotFound(_) => Ok(Default::default()), e => Err(e), })?; let dispute_status: Option<DBEnumWrapper<DisputeStatus>> = row.try_get("dispute_status").or_else(|e| match e { ColumnNotFound(_) => Ok(Default::default()), e => Err(e), })?; let connector: Option<String> = row.try_get("connector").or_else(|e| match e { ColumnNotFound(_) => Ok(Default::default()), e => Err(e), })?; let currency: Option<DBEnumWrapper<Currency>> = row.try_get("currency").or_else(|e| match e { ColumnNotFound(_) => Ok(Default::default()), e => Err(e), })?; let total: Option<bigdecimal::BigDecimal> = row.try_get("total").or_else(|e| match e { ColumnNotFound(_) => Ok(Default::default()), e => Err(e), })?; let count: Option<i64> = row.try_get("count").or_else(|e| match e { ColumnNotFound(_) => Ok(Default::default()), e => Err(e), })?; // Removing millisecond precision to get accurate diffs against clickhouse let start_bucket: Option<PrimitiveDateTime> = row .try_get::<Option<PrimitiveDateTime>, _>("start_bucket")? .and_then(|dt| dt.replace_millisecond(0).ok()); let end_bucket: Option<PrimitiveDateTime> = row .try_get::<Option<PrimitiveDateTime>, _>("end_bucket")? .and_then(|dt| dt.replace_millisecond(0).ok()); Ok(Self { dispute_stage, dispute_status, connector, currency, total, count, start_bucket, end_bucket, }) } } impl ToSql<SqlxClient> for PrimitiveDateTime { fn to_sql(&self, _table_engine: &TableEngine) -> error_stack::Result<String, ParsingError> { Ok(self.to_string()) } } impl ToSql<SqlxClient> for AnalyticsCollection { fn to_sql(&self, _table_engine: &TableEngine) -> error_stack::Result<String, ParsingError> { match self { Self::Payment => Ok("payment_attempt".to_string()), Self::PaymentSessionized => Err(error_stack::report!(ParsingError::UnknownError) .attach_printable("PaymentSessionized table is not implemented for Sqlx"))?, Self::Refund => Ok("refund".to_string()), Self::RefundSessionized => Err(error_stack::report!(ParsingError::UnknownError) .attach_printable("RefundSessionized table is not implemented for Sqlx"))?, Self::SdkEvents => Err(error_stack::report!(ParsingError::UnknownError) .attach_printable("SdkEventsAudit table is not implemented for Sqlx"))?, Self::SdkEventsAnalytics => Err(error_stack::report!(ParsingError::UnknownError) .attach_printable("SdkEvents table is not implemented for Sqlx"))?, Self::ApiEvents => Err(error_stack::report!(ParsingError::UnknownError) .attach_printable("ApiEvents table is not implemented for Sqlx"))?, Self::FraudCheck => Ok("fraud_check".to_string()), Self::PaymentIntent => Ok("payment_intent".to_string()), Self::PaymentIntentSessionized => Err(error_stack::report!( ParsingError::UnknownError ) .attach_printable("PaymentIntentSessionized table is not implemented for Sqlx"))?, Self::ConnectorEvents => Err(error_stack::report!(ParsingError::UnknownError) .attach_printable("ConnectorEvents table is not implemented for Sqlx"))?, Self::ApiEventsAnalytics => Err(error_stack::report!(ParsingError::UnknownError) .attach_printable("ApiEvents table is not implemented for Sqlx"))?, Self::ActivePaymentsAnalytics => Err(error_stack::report!(ParsingError::UnknownError) .attach_printable("ActivePaymentsAnalytics table is not implemented for Sqlx"))?, Self::OutgoingWebhookEvent => Err(error_stack::report!(ParsingError::UnknownError) .attach_printable("OutgoingWebhookEvents table is not implemented for Sqlx"))?, Self::Dispute => Ok("dispute".to_string()), Self::DisputeSessionized => Err(error_stack::report!(ParsingError::UnknownError) .attach_printable("DisputeSessionized table is not implemented for Sqlx"))?, Self::Authentications => Err(error_stack::report!(ParsingError::UnknownError) .attach_printable("Authentications table is not implemented for Sqlx"))?, Self::RoutingEvents => Err(error_stack::report!(ParsingError::UnknownError) .attach_printable("RoutingEvents table is not implemented for Sqlx"))?, } } } impl<T> ToSql<SqlxClient> for Aggregate<T> where T: ToSql<SqlxClient>, { fn to_sql(&self, table_engine: &TableEngine) -> error_stack::Result<String, ParsingError> { Ok(match self { Self::Count { field: _, alias } => { format!( "count(*){}", alias.map_or_else(|| "".to_owned(), |alias| format!(" as {alias}")) ) } Self::Sum { field, alias } => { format!( "sum({}){}", field .to_sql(table_engine) .attach_printable("Failed to sum aggregate")?, alias.map_or_else(|| "".to_owned(), |alias| format!(" as {alias}")) ) } Self::Min { field, alias } => { format!( "min({}){}", field .to_sql(table_engine) .attach_printable("Failed to min aggregate")?, alias.map_or_else(|| "".to_owned(), |alias| format!(" as {alias}")) ) } Self::Max { field, alias } => { format!( "max({}){}", field .to_sql(table_engine) .attach_printable("Failed to max aggregate")?, alias.map_or_else(|| "".to_owned(), |alias| format!(" as {alias}")) ) } Self::Percentile { field, alias, percentile, } => { format!( "percentile_cont(0.{}) within group (order by {} asc){}", percentile.map_or_else(|| "50".to_owned(), |percentile| percentile.to_string()), field .to_sql(table_engine) .attach_printable("Failed to percentile aggregate")?, alias.map_or_else(|| "".to_owned(), |alias| format!(" as {alias}")) ) } Self::DistinctCount { field, alias } => { format!( "count(distinct {}){}", field .to_sql(table_engine) .attach_printable("Failed to distinct count aggregate")?, alias.map_or_else(|| "".to_owned(), |alias| format!(" as {alias}")) ) } }) } } impl<T> ToSql<SqlxClient> for Window<T> where T: ToSql<SqlxClient>, { fn to_sql(&self, table_engine: &TableEngine) -> error_stack::Result<String, ParsingError> { Ok(match self { Self::Sum { field, partition_by, order_by, alias, } => { format!( "sum({}) over ({}{}){}", field .to_sql(table_engine) .attach_printable("Failed to sum window")?, partition_by.as_ref().map_or_else( || "".to_owned(), |partition_by| format!("partition by {}", partition_by.to_owned()) ), order_by.as_ref().map_or_else( || "".to_owned(), |(order_column, order)| format!( " order by {} {}", order_column.to_owned(), order ) ), alias.map_or_else(|| "".to_owned(), |alias| format!(" as {alias}")) ) } Self::RowNumber { field: _, partition_by, order_by, alias, } => { format!( "row_number() over ({}{}){}", partition_by.as_ref().map_or_else( || "".to_owned(), |partition_by| format!("partition by {}", partition_by.to_owned()) ), order_by.as_ref().map_or_else( || "".to_owned(), |(order_column, order)| format!( " order by {} {}", order_column.to_owned(), order ) ), alias.map_or_else(|| "".to_owned(), |alias| format!(" as {alias}")) ) } }) } }
crates/analytics/src/sqlx.rs#chunk1
analytics
chunk
6,133
null
null
null
null
null
null
null
null
null
null
null
null
null
pub struct ProphetpayRefundRequest { pub amount: f64, pub card_token: Secret<String>, pub transaction_id: String, pub profile: Secret<String>, pub ref_info: String, pub inquiry_reference: String, pub action_type: i8, }
crates/hyperswitch_connectors/src/connectors/prophetpay/transformers.rs
hyperswitch_connectors
struct_definition
61
rust
ProphetpayRefundRequest
null
null
null
null
null
null
null
null
null
null
null
pub struct KeyManagerState { pub tenant_id: id_type::TenantId, pub global_tenant_id: id_type::TenantId, pub enabled: bool, pub url: String, pub client_idle_timeout: Option<u64>, #[cfg(feature = "km_forward_x_request_id")] pub request_id: Option<RequestId>, #[cfg(feature = "keymanager_mtls")] pub ca: Secret<String>, #[cfg(feature = "keymanager_mtls")] pub cert: Secret<String>, pub infra_values: Option<serde_json::Value>, }
crates/common_utils/src/types/keymanager.rs
common_utils
struct_definition
123
rust
KeyManagerState
null
null
null
null
null
null
null
null
null
null
null
impl Responder { let flow = Flow::PaymentsStart; let (payment_id, merchant_id, attempt_id) = path.into_inner(); let payload = payment_types::PaymentsStartRequest { payment_id: payment_id.clone(), merchant_id: merchant_id.clone(), attempt_id: attempt_id.clone(), }; let locking_action = payload.get_locking_input(flow.clone()); tracing::Span::current().record("payment_id", payment_id.get_string_repr()); Box::pin(api::server_wrap( flow, state, &req, payload, |state, auth: auth::AuthenticationData, req, req_state| { let merchant_context = domain::MerchantContext::NormalMerchant(Box::new( domain::Context(auth.merchant_account, auth.key_store), )); payments::payments_core::< api_types::Authorize, payment_types::PaymentsResponse, _, _, _, payments::PaymentData<api_types::Authorize>, >( state, req_state, merchant_context, auth.profile_id, payments::operations::PaymentStart, req, api::AuthFlow::Client, payments::CallConnectorAction::Trigger, None, HeaderPayload::default(), ) }, &auth::MerchantIdAuth(merchant_id), locking_action, )) .await }
crates/router/src/routes/payments.rs
router
impl_block
290
rust
null
Responder
null
impl Responder
null
null
null
null
null
null
null
null
pub struct ItaubankAuthRequest { client_id: Secret<String>, client_secret: Secret<String>, grant_type: ItaubankGrantType, }
crates/hyperswitch_connectors/src/connectors/itaubank/transformers.rs
hyperswitch_connectors
struct_definition
33
rust
ItaubankAuthRequest
null
null
null
null
null
null
null
null
null
null
null
impl NmiMerchantDefinedField { pub fn new(metadata: &serde_json::Value) -> Self { let metadata_as_string = metadata.to_string(); let hash_map: std::collections::BTreeMap<String, serde_json::Value> = serde_json::from_str(&metadata_as_string).unwrap_or(std::collections::BTreeMap::new()); let inner = hash_map .into_iter() .enumerate() .map(|(index, (hs_key, hs_value))| { let nmi_key = format!("merchant_defined_field_{}", index + 1); let nmi_value = format!("{hs_key}={hs_value}"); (nmi_key, Secret::new(nmi_value)) }) .collect(); Self { inner } } }
crates/hyperswitch_connectors/src/connectors/nmi/transformers.rs
hyperswitch_connectors
impl_block
167
rust
null
NmiMerchantDefinedField
null
impl NmiMerchantDefinedField
null
null
null
null
null
null
null
null
File: crates/router/src/core/webhooks/incoming.rs Public functions: 5 Public structs: 1 use std::{str::FromStr, time::Instant}; use actix_web::FromRequest; #[cfg(feature = "payouts")] use api_models::payouts as payout_models; use api_models::webhooks::{self, WebhookResponseTracker}; use common_utils::{ errors::ReportSwitchExt, events::ApiEventsType, ext_traits::{AsyncExt, ByteSliceExt}, types::{AmountConvertor, StringMinorUnitForConnector}, }; use diesel_models::{refund as diesel_refund, ConnectorMandateReferenceId}; use error_stack::{report, ResultExt}; use hyperswitch_domain_models::{ mandates::CommonMandateReference, payments::{payment_attempt::PaymentAttempt, HeaderPayload}, router_request_types::VerifyWebhookSourceRequestData, router_response_types::{VerifyWebhookSourceResponseData, VerifyWebhookStatus}, }; use hyperswitch_interfaces::webhooks::{IncomingWebhookFlowError, IncomingWebhookRequestDetails}; use masking::{ExposeInterface, PeekInterface}; use router_env::{instrument, tracing, tracing_actix_web::RequestId}; use super::{types, utils, MERCHANT_ID}; use crate::{ consts, core::{ api_locking, errors::{self, ConnectorErrorExt, CustomResult, RouterResponse, StorageErrorExt}, metrics, payment_methods, payments::{self, tokenization}, refunds, relay, unified_connector_service, utils as core_utils, webhooks::{network_tokenization_incoming, utils::construct_webhook_router_data}, }, db::StorageInterface, events::api_logs::ApiEvent, logger, routes::{ app::{ReqState, SessionStateInfo}, lock_utils, SessionState, }, services::{ self, authentication as auth, connector_integration_interface::ConnectorEnum, ConnectorValidation, }, types::{ api::{ self, mandates::MandateResponseExt, ConnectorCommon, ConnectorData, GetToken, IncomingWebhook, }, domain, storage::{self, enums}, transformers::{ForeignFrom, ForeignInto, ForeignTryFrom}, }, utils::{self as helper_utils, ext_traits::OptionExt, generate_id}, }; #[cfg(feature = "payouts")] use crate::{core::payouts, types::storage::PayoutAttemptUpdate}; #[allow(clippy::too_many_arguments)] pub async fn incoming_webhooks_wrapper<W: types::OutgoingWebhookType>( flow: &impl router_env::types::FlowMetric, state: SessionState, req_state: ReqState, req: &actix_web::HttpRequest, merchant_context: domain::MerchantContext, connector_name_or_mca_id: &str, body: actix_web::web::Bytes, is_relay_webhook: bool, ) -> RouterResponse<serde_json::Value> { let start_instant = Instant::now(); let (application_response, webhooks_response_tracker, serialized_req) = Box::pin(incoming_webhooks_core::<W>( state.clone(), req_state, req, merchant_context.clone(), connector_name_or_mca_id, body.clone(), is_relay_webhook, )) .await?; logger::info!(incoming_webhook_payload = ?serialized_req); let request_duration = Instant::now() .saturating_duration_since(start_instant) .as_millis(); let request_id = RequestId::extract(req) .await .attach_printable("Unable to extract request id from request") .change_context(errors::ApiErrorResponse::InternalServerError)?; let auth_type = auth::AuthenticationType::WebhookAuth { merchant_id: merchant_context.get_merchant_account().get_id().clone(), }; let status_code = 200; let api_event = ApiEventsType::Webhooks { connector: connector_name_or_mca_id.to_string(), payment_id: webhooks_response_tracker.get_payment_id(), }; let response_value = serde_json::to_value(&webhooks_response_tracker) .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable("Could not convert webhook effect to string")?; let infra = state.infra_components.clone(); let api_event = ApiEvent::new( state.tenant.tenant_id.clone(), Some(merchant_context.get_merchant_account().get_id().clone()), flow, &request_id, request_duration, status_code, serialized_req, Some(response_value), None, auth_type, None, api_event, req, req.method(), infra, ); state.event_handler().log_event(&api_event); Ok(application_response) } #[cfg(feature = "v1")] pub async fn network_token_incoming_webhooks_wrapper<W: types::OutgoingWebhookType>( flow: &impl router_env::types::FlowMetric, state: SessionState, req: &actix_web::HttpRequest, body: actix_web::web::Bytes, ) -> RouterResponse<serde_json::Value> { let start_instant = Instant::now(); let request_details: IncomingWebhookRequestDetails<'_> = IncomingWebhookRequestDetails { method: req.method().clone(), uri: req.uri().clone(), headers: req.headers(), query_params: req.query_string().to_string(), body: &body, }; let (application_response, webhooks_response_tracker, serialized_req, merchant_id) = Box::pin( network_token_incoming_webhooks_core::<W>(&state, request_details), ) .await?; logger::info!(incoming_webhook_payload = ?serialized_req); let request_duration = Instant::now() .saturating_duration_since(start_instant) .as_millis(); let request_id = RequestId::extract(req) .await .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable("Unable to extract request id from request")?; let auth_type = auth::AuthenticationType::NoAuth; let status_code = 200; let api_event = ApiEventsType::NetworkTokenWebhook { payment_method_id: webhooks_response_tracker.get_payment_method_id(), }; let response_value = serde_json::to_value(&webhooks_response_tracker) .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable("Could not convert webhook effect to string")?; let infra = state.infra_components.clone(); let api_event = ApiEvent::new( state.tenant.tenant_id.clone(), Some(merchant_id), flow, &request_id, request_duration, status_code, serialized_req, Some(response_value), None, auth_type, None, api_event, req, req.method(), infra, ); state.event_handler().log_event(&api_event); Ok(application_response) } #[allow(clippy::too_many_arguments)] #[instrument(skip_all)] async fn incoming_webhooks_core<W: types::OutgoingWebhookType>( state: SessionState, req_state: ReqState, req: &actix_web::HttpRequest, merchant_context: domain::MerchantContext, connector_name_or_mca_id: &str, body: actix_web::web::Bytes, is_relay_webhook: bool, ) -> errors::RouterResult<( services::ApplicationResponse<serde_json::Value>, WebhookResponseTracker, serde_json::Value, )> { // Initial setup and metrics metrics::WEBHOOK_INCOMING_COUNT.add( 1, router_env::metric_attributes!(( MERCHANT_ID, merchant_context.get_merchant_account().get_id().clone() )), ); let request_details = IncomingWebhookRequestDetails { method: req.method().clone(), uri: req.uri().clone(), headers: req.headers(), query_params: req.query_string().to_string(), body: &body, }; // Fetch the merchant connector account to get the webhooks source secret let (merchant_connector_account, connector, connector_name) = fetch_optional_mca_and_connector(&state, &merchant_context, connector_name_or_mca_id) .await?; // Determine webhook processing path (UCS vs non-UCS) and handle event type extraction let webhook_processing_result = if unified_connector_service::should_call_unified_connector_service_for_webhooks( &state, &merchant_context, &connector_name, ) .await? { logger::info!( connector = connector_name, "Using Unified Connector Service for webhook processing", ); process_ucs_webhook_transform( &state, &merchant_context, &connector_name, &body, &request_details, merchant_connector_account.as_ref(), ) .await? } else { // NON-UCS PATH: Need to decode body first let decoded_body = connector .decode_webhook_body( &request_details, merchant_context.get_merchant_account().get_id(), merchant_connector_account .and_then(|mca| mca.connector_webhook_details.clone()), &connector_name, ) .await .switch() .attach_printable("There was an error in incoming webhook body decoding")?; process_non_ucs_webhook( &state, &merchant_context, &connector, &connector_name, decoded_body.into(), &request_details, ) .await? }; // Update request_details with the appropriate body (decoded for non-UCS, raw for UCS) let final_request_details = match &webhook_processing_result.decoded_body { Some(decoded_body) => IncomingWebhookRequestDetails { method: request_details.method.clone(), uri: request_details.uri.clone(), headers: request_details.headers, query_params: request_details.query_params.clone(), body: decoded_body, }, None => request_details, // Use original request details for UCS }; logger::info!(event_type=?webhook_processing_result.event_type); // Check if webhook should be processed further let is_webhook_event_supported = !matches!( webhook_processing_result.event_type, webhooks::IncomingWebhookEvent::EventNotSupported ); let is_webhook_event_enabled = !utils::is_webhook_event_disabled( &*state.clone().store, connector_name.as_str(), merchant_context.get_merchant_account().get_id(), &webhook_processing_result.event_type, ) .await; let flow_type: api::WebhookFlow = webhook_processing_result.event_type.into(); let process_webhook_further = is_webhook_event_enabled && is_webhook_event_supported && !matches!(flow_type, api::WebhookFlow::ReturnResponse); logger::info!(process_webhook=?process_webhook_further); let mut event_object: Box<dyn masking::ErasedMaskSerialize> = Box::new(serde_json::Value::Null); let webhook_effect = match process_webhook_further { true => { let business_logic_result = process_webhook_business_logic( &state, req_state, &merchant_context, &connector, &connector_name, webhook_processing_result.event_type, webhook_processing_result.source_verified, &webhook_processing_result.transform_data, &final_request_details, is_relay_webhook, ) .await; match business_logic_result { Ok(response) => { // Extract event object for serialization event_object = extract_webhook_event_object( &webhook_processing_result.transform_data, &connector, &final_request_details, )?; response } Err(error) => { let error_result = handle_incoming_webhook_error( error, &connector, connector_name.as_str(), &final_request_details, ); match error_result { Ok((_, webhook_tracker, _)) => webhook_tracker, Err(e) => return Err(e), } } } } false => { metrics::WEBHOOK_INCOMING_FILTERED_COUNT.add( 1, router_env::metric_attributes!(( MERCHANT_ID, merchant_context.get_merchant_account().get_id().clone() )), ); WebhookResponseTracker::NoEffect } }; // Generate response let response = connector .get_webhook_api_response(&final_request_details, None) .switch() .attach_printable("Could not get incoming webhook api response from connector")?; let serialized_request = event_object .masked_serialize() .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable("Could not convert webhook effect to string")?; Ok((response, webhook_effect, serialized_request)) } /// Process UCS webhook transformation using the high-level UCS abstraction async fn process_ucs_webhook_transform( state: &SessionState, merchant_context: &domain::MerchantContext, connector_name: &str, body: &actix_web::web::Bytes, request_details: &IncomingWebhookRequestDetails<'_>, merchant_connector_account: Option<&domain::MerchantConnectorAccount>, ) -> errors::RouterResult<WebhookProcessingResult> { // Use the new UCS abstraction which provides clean separation let (event_type, source_verified, transform_data) = unified_connector_service::call_unified_connector_service_for_webhook( state, merchant_context, connector_name, body, request_details, merchant_connector_account, ) .await?; Ok(WebhookProcessingResult { event_type, source_verified, transform_data: Some(Box::new(transform_data)), decoded_body: None, // UCS path uses raw body }) } /// Result type for webhook processing path determination pub struct WebhookProcessingResult { event_type: webhooks::IncomingWebhookEvent, source_verified: bool, transform_data: Option<Box<unified_connector_service::WebhookTransformData>>, decoded_body: Option<actix_web::web::Bytes>, } /// Process non-UCS webhook using traditional connector processing async fn process_non_ucs_webhook( state: &SessionState, merchant_context: &domain::MerchantContext, connector: &ConnectorEnum, connector_name: &str, decoded_body: actix_web::web::Bytes, request_details: &IncomingWebhookRequestDetails<'_>, ) -> errors::RouterResult<WebhookProcessingResult> { // Create request_details with decoded body for connector processing let updated_request_details = IncomingWebhookRequestDetails { method: request_details.method.clone(), uri: request_details.uri.clone(), headers: request_details.headers, query_params: request_details.query_params.clone(), body: &decoded_body, }; match connector .get_webhook_event_type(&updated_request_details) .allow_webhook_event_type_not_found( state .clone() .conf .webhooks .ignore_error .event_type .unwrap_or(true), ) .switch() .attach_printable("Could not find event type in incoming webhook body")? { Some(event_type) => Ok(WebhookProcessingResult { event_type, source_verified: false, transform_data: None, decoded_body: Some(decoded_body), }), None => { metrics::WEBHOOK_EVENT_TYPE_IDENTIFICATION_FAILURE_COUNT.add( 1, router_env::metric_attributes!( ( MERCHANT_ID, merchant_context.get_merchant_account().get_id().clone() ), ("connector", connector_name.to_string()) ), ); Err(errors::ApiErrorResponse::WebhookProcessingFailure) .attach_printable("Failed to identify event type in incoming webhook body") } } } /// Extract webhook event object based on transform data availability fn extract_webhook_event_object( transform_data: &Option<Box<unified_connector_service::WebhookTransformData>>, connector: &ConnectorEnum, request_details: &IncomingWebhookRequestDetails<'_>, ) -> errors::RouterResult<Box<dyn masking::ErasedMaskSerialize>> { match transform_data { Some(transform_data) => match &transform_data.webhook_content { Some(webhook_content) => { let serialized_value = serde_json::to_value(webhook_content) .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable("Failed to serialize UCS webhook content")?; Ok(Box::new(serialized_value)) } None => connector .get_webhook_resource_object(request_details) .switch() .attach_printable("Could not find resource object in incoming webhook body"), }, None => connector .get_webhook_resource_object(request_details) .switch() .attach_printable("Could not find resource object in incoming webhook body"), } } /// Process the main webhook business logic after event type determination #[allow(clippy::too_many_arguments)] async fn process_webhook_business_logic( state: &SessionState, req_state: ReqState, merchant_context: &domain::MerchantContext, connector: &ConnectorEnum, connector_name: &str, event_type: webhooks::IncomingWebhookEvent, source_verified_via_ucs: bool, webhook_transform_data: &Option<Box<unified_connector_service::WebhookTransformData>>, request_details: &IncomingWebhookRequestDetails<'_>, is_relay_webhook: bool, ) -> errors::RouterResult<WebhookResponseTracker> { let object_ref_id = connector .get_webhook_object_reference_id(request_details) .switch() .attach_printable("Could not find object reference id in incoming webhook body")?; let connector_enum = api_models::enums::Connector::from_str(connector_name) .change_context(errors::ApiErrorResponse::InvalidDataValue { field_name: "connector", }) .attach_printable_lazy(|| format!("unable to parse connector name {connector_name:?}"))?; let connectors_with_source_verification_call = &state.conf.webhook_source_verification_call; let merchant_connector_account = match Box::pin(helper_utils::get_mca_from_object_reference_id( state, object_ref_id.clone(), merchant_context, connector_name, )) .await { Ok(mca) => mca, Err(error) => { let result = handle_incoming_webhook_error(error, connector, connector_name, request_details); match result { Ok((_, webhook_tracker, _)) => return Ok(webhook_tracker), Err(e) => return Err(e), } } }; let source_verified = if source_verified_via_ucs { // If UCS handled verification, use that result source_verified_via_ucs } else { // Fall back to traditional source verification if connectors_with_source_verification_call .connectors_with_webhook_source_verification_call .contains(&connector_enum) { verify_webhook_source_verification_call( connector.clone(), state, merchant_context, merchant_connector_account.clone(), connector_name, request_details, ) .await .or_else(|error| match error.current_context() { errors::ConnectorError::WebhookSourceVerificationFailed => { logger::error!(?error, "Source Verification Failed"); Ok(false) } _ => Err(error), }) .switch() .attach_printable("There was an issue in incoming webhook source verification")? } else { connector .clone() .verify_webhook_source( request_details, merchant_context.get_merchant_account().get_id(), merchant_connector_account.connector_webhook_details.clone(), merchant_connector_account.connector_account_details.clone(), connector_name, ) .await .or_else(|error| match error.current_context() { errors::ConnectorError::WebhookSourceVerificationFailed => { logger::error!(?error, "Source Verification Failed"); Ok(false) } _ => Err(error), }) .switch() .attach_printable("There was an issue in incoming webhook source verification")? } }; if source_verified { metrics::WEBHOOK_SOURCE_VERIFIED_COUNT.add( 1, router_env::metric_attributes!(( MERCHANT_ID, merchant_context.get_merchant_account().get_id().clone() )), ); } else if connector.is_webhook_source_verification_mandatory() { // if webhook consumption is mandatory for connector, fail webhook // so that merchant can retrigger it after updating merchant_secret return Err(errors::ApiErrorResponse::WebhookAuthenticationFailed.into()); } logger::info!(source_verified=?source_verified); let event_object: Box<dyn masking::ErasedMaskSerialize> = if let Some(transform_data) = webhook_transform_data { // Use UCS transform data if available if let Some(webhook_content) = &transform_data.webhook_content { // Convert UCS webhook content to appropriate format Box::new( serde_json::to_value(webhook_content) .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable("Failed to serialize UCS webhook content")?, ) } else { // Fall back to connector extraction connector .get_webhook_resource_object(request_details) .switch() .attach_printable("Could not find resource object in incoming webhook body")? } } else { // Use traditional connector extraction connector .get_webhook_resource_object(request_details) .switch() .attach_printable("Could not find resource object in incoming webhook body")? }; let webhook_details = api::IncomingWebhookDetails { object_reference_id: object_ref_id.clone(), resource_object: serde_json::to_vec(&event_object) .change_context(errors::ParsingError::EncodeError("byte-vec")) .attach_printable("Unable to convert webhook payload to a value") .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable( "There was an issue when encoding the incoming webhook body to bytes", )?, }; let profile_id = &merchant_connector_account.profile_id; let key_manager_state = &(state).into(); let business_profile = state .store .find_business_profile_by_profile_id( key_manager_state, merchant_context.get_merchant_key_store(), profile_id, ) .await .to_not_found_response(errors::ApiErrorResponse::ProfileNotFound { id: profile_id.get_string_repr().to_owned(), })?; // If the incoming webhook is a relay webhook, then we need to trigger the relay webhook flow let result_response = if is_relay_webhook { let relay_webhook_response = Box::pin(relay_incoming_webhook_flow( state.clone(), merchant_context.clone(), business_profile, webhook_details, event_type, source_verified, )) .await .attach_printable("Incoming webhook flow for relay failed"); // Using early return ensures unsupported webhooks are acknowledged to the connector if let Some(errors::ApiErrorResponse::NotSupported { .. }) = relay_webhook_response .as_ref() .err() .map(|a| a.current_context()) { logger::error!( webhook_payload =? request_details.body, "Failed while identifying the event type", ); let _response = connector .get_webhook_api_response(request_details, None) .switch() .attach_printable( "Failed while early return in case of not supported event type in relay webhooks", )?; return Ok(WebhookResponseTracker::NoEffect); }; relay_webhook_response } else { let flow_type: api::WebhookFlow = event_type.into(); match flow_type { api::WebhookFlow::Payment => Box::pin(payments_incoming_webhook_flow( state.clone(), req_state, merchant_context.clone(), business_profile, webhook_details, source_verified, connector, request_details, event_type, webhook_transform_data, )) .await .attach_printable("Incoming webhook flow for payments failed"), api::WebhookFlow::Refund => Box::pin(refunds_incoming_webhook_flow( state.clone(), merchant_context.clone(), business_profile, webhook_details, connector_name, source_verified, event_type, )) .await .attach_printable("Incoming webhook flow for refunds failed"), api::WebhookFlow::Dispute => Box::pin(disputes_incoming_webhook_flow( state.clone(), merchant_context.clone(), business_profile, webhook_details, source_verified, connector, request_details, event_type, )) .await .attach_printable("Incoming webhook flow for disputes failed"), api::WebhookFlow::BankTransfer => Box::pin(bank_transfer_webhook_flow( state.clone(), req_state, merchant_context.clone(), business_profile, webhook_details, source_verified, )) .await .attach_printable("Incoming bank-transfer webhook flow failed"), api::WebhookFlow::ReturnResponse => Ok(WebhookResponseTracker::NoEffect), api::WebhookFlow::Mandate => Box::pin(mandates_incoming_webhook_flow( state.clone(), merchant_context.clone(), business_profile, webhook_details, source_verified, event_type, )) .await .attach_printable("Incoming webhook flow for mandates failed"), api::WebhookFlow::ExternalAuthentication => { Box::pin(external_authentication_incoming_webhook_flow( state.clone(), req_state, merchant_context.clone(), source_verified, event_type, request_details, connector, object_ref_id, business_profile, merchant_connector_account, )) .await .attach_printable("Incoming webhook flow for external authentication failed") } api::WebhookFlow::FraudCheck => Box::pin(frm_incoming_webhook_flow( state.clone(), req_state, merchant_context.clone(), source_verified, event_type, object_ref_id, business_profile, )) .await .attach_printable("Incoming webhook flow for fraud check failed"), #[cfg(feature = "payouts")] api::WebhookFlow::Payout => Box::pin(payouts_incoming_webhook_flow( state.clone(), merchant_context.clone(), business_profile, webhook_details, event_type, source_verified, )) .await .attach_printable("Incoming webhook flow for payouts failed"), _ => Err(errors::ApiErrorResponse::InternalServerError) .attach_printable("Unsupported Flow Type received in incoming webhooks"), } }; match result_response { Ok(response) => Ok(response), Err(error) => { let result = handle_incoming_webhook_error(error, connector, connector_name, request_details); match result { Ok((_, webhook_tracker, _)) => Ok(webhook_tracker), Err(e) => Err(e), } } } } fn handle_incoming_webhook_error( error: error_stack::Report<errors::ApiErrorResponse>, connector: &ConnectorEnum, connector_name: &str, request_details: &IncomingWebhookRequestDetails<'_>, ) -> errors::RouterResult<( services::ApplicationResponse<serde_json::Value>, WebhookResponseTracker, serde_json::Value, )> { logger::error!(?error, "Incoming webhook flow failed"); // fetch the connector enum from the connector name let connector_enum = api_models::connector_enums::Connector::from_str(connector_name) .change_context(errors::ApiErrorResponse::InvalidDataValue { field_name: "connector", }) .attach_printable_lazy(|| format!("unable to parse connector name {connector_name:?}"))?; // get the error response from the connector if connector_enum.should_acknowledge_webhook_for_resource_not_found_errors() { let response = connector .get_webhook_api_response( request_details, Some(IncomingWebhookFlowError::from(error.current_context())), ) .switch() .attach_printable("Failed to get incoming webhook api response from connector")?; Ok(( response, WebhookResponseTracker::NoEffect, serde_json::Value::Null, )) } else { Err(error) } } #[instrument(skip_all)] #[cfg(feature = "v1")] async fn network_token_incoming_webhooks_core<W: types::OutgoingWebhookType>( state: &SessionState, request_details: IncomingWebhookRequestDetails<'_>, ) -> errors::RouterResult<( services::ApplicationResponse<serde_json::Value>, WebhookResponseTracker, serde_json::Value, common_utils::id_type::MerchantId, )> { let serialized_request = network_tokenization_incoming::get_network_token_resource_object(&request_details) .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable("Network Token Requestor Webhook deserialization failed")? .masked_serialize() .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable("Could not convert webhook effect to string")?; let network_tokenization_service = &state .conf .network_tokenization_service .as_ref() .ok_or(errors::NetworkTokenizationError::NetworkTokenizationServiceNotConfigured) .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable("Network Tokenization Service not configured")?; //source verification network_tokenization_incoming::Authorization::new(request_details.headers.get("Authorization")) .verify_webhook_source(network_tokenization_service.get_inner()) .await?; let response: network_tokenization_incoming::NetworkTokenWebhookResponse = request_details .body .parse_struct("NetworkTokenWebhookResponse") .change_context(errors::ApiErrorResponse::WebhookUnprocessableEntity)?; let (merchant_id, payment_method_id, _customer_id) = response .fetch_merchant_id_payment_method_id_customer_id_from_callback_mapper(state) .await?; metrics::WEBHOOK_SOURCE_VERIFIED_COUNT.add( 1, router_env::metric_attributes!((MERCHANT_ID, merchant_id.clone())), ); let merchant_context = network_tokenization_incoming::fetch_merchant_account_for_network_token_webhooks( state, &merchant_id, ) .await?; let payment_method = network_tokenization_incoming::fetch_payment_method_for_network_token_webhooks( state, merchant_context.get_merchant_account(), merchant_context.get_merchant_key_store(), &payment_method_id, ) .await?; let response_data = response.get_response_data(); let webhook_resp_tracker = response_data .update_payment_method(state, &payment_method, &merchant_context) .await?; Ok(( services::ApplicationResponse::StatusOk, webhook_resp_tracker, serialized_request, merchant_id.clone(), )) } #[allow(clippy::too_many_arguments)] #[instrument(skip_all)] async fn payments_incoming_webhook_flow( state: SessionState, req_state: ReqState, merchant_context: domain::MerchantContext, business_profile: domain::Profile, webhook_details: api::IncomingWebhookDetails, source_verified: bool, connector: &ConnectorEnum, request_details: &IncomingWebhookRequestDetails<'_>, event_type: webhooks::IncomingWebhookEvent, webhook_transform_data: &Option<Box<unified_connector_service::WebhookTransformData>>, ) -> CustomResult<WebhookResponseTracker, errors::ApiErrorResponse> { let consume_or_trigger_flow = if source_verified { // Determine the appropriate action based on UCS availability let resource_object = webhook_details.resource_object; match webhook_transform_data.as_ref() { Some(transform_data) => { // Serialize the transform data to pass to UCS handler let transform_data_bytes = serde_json::to_vec(transform_data.as_ref()) .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable("Failed to serialize UCS webhook transform data")?; payments::CallConnectorAction::UCSHandleResponse(transform_data_bytes) } None => payments::CallConnectorAction::HandleResponse(resource_object), } } else { payments::CallConnectorAction::Trigger }; let payments_response = match webhook_details.object_reference_id { webhooks::ObjectReferenceId::PaymentId(ref id) => { let payment_id = get_payment_id( state.store.as_ref(), id, merchant_context.get_merchant_account().get_id(), merchant_context.get_merchant_account().storage_scheme, ) .await?; let lock_action = api_locking::LockAction::Hold { input: api_locking::LockingInput { unique_locking_key: payment_id.get_string_repr().to_owned(), api_identifier: lock_utils::ApiIdentifier::Payments, override_lock_retries: None, }, }; lock_action .clone() .perform_locking_action( &state, merchant_context.get_merchant_account().get_id().to_owned(), ) .await?; let response = Box::pin(payments::payments_core::< api::PSync, api::PaymentsResponse, _, _, _, payments::PaymentData<api::PSync>, >( state.clone(), req_state, merchant_context.clone(), None, payments::operations::PaymentStatus, api::PaymentsRetrieveRequest { resource_id: id.clone(), merchant_id: Some(merchant_context.get_merchant_account().get_id().clone()), force_sync: true, connector: None, param: None, merchant_connector_details: None, client_secret: None, expand_attempts: None, expand_captures: None, all_keys_required: None, }, services::AuthFlow::Merchant, consume_or_trigger_flow.clone(), None, HeaderPayload::default(), )) .await; // When mandate details are present in successful webhooks, and consuming webhooks are skipped during payment sync if the payment status is already updated to charged, this function is used to update the connector mandate details. if should_update_connector_mandate_details(source_verified, event_type) { update_connector_mandate_details( &state, &merchant_context, webhook_details.object_reference_id.clone(), connector, request_details, ) .await? }; lock_action .free_lock_action( &state, merchant_context.get_merchant_account().get_id().to_owned(), ) .await?; match response { Ok(value) => value, Err(err) if matches!( err.current_context(), &errors::ApiErrorResponse::PaymentNotFound ) && state .conf .webhooks .ignore_error .payment_not_found .unwrap_or(true) => { metrics::WEBHOOK_PAYMENT_NOT_FOUND.add( 1, router_env::metric_attributes!(( "merchant_id", merchant_context.get_merchant_account().get_id().clone() )), ); return Ok(WebhookResponseTracker::NoEffect); } error @ Err(_) => error?, } } _ => Err(errors::ApiErrorResponse::WebhookProcessingFailure).attach_printable( "Did not get payment id as object reference id in webhook payments flow", )?, }; match payments_response { services::ApplicationResponse::JsonWithHeaders((payments_response, _)) => { let payment_id = payments_response.payment_id.clone(); let status = payments_response.status; let event_type: Option<enums::EventType> = payments_response.status.into(); // If event is NOT an UnsupportedEvent, trigger Outgoing Webhook if let Some(outgoing_event_type) = event_type { let primary_object_created_at = payments_response.created; Box::pin(super::create_event_and_trigger_outgoing_webhook( state, merchant_context, business_profile, outgoing_event_type, enums::EventClass::Payments, payment_id.get_string_repr().to_owned(), enums::EventObjectType::PaymentDetails, api::OutgoingWebhookContent::PaymentDetails(Box::new(payments_response)), primary_object_created_at, )) .await?; }; let response = WebhookResponseTracker::Payment { payment_id, status }; Ok(response) } _ => Err(errors::ApiErrorResponse::WebhookProcessingFailure) .attach_printable("received non-json response from payments core")?, } } #[cfg(feature = "payouts")] #[instrument(skip_all)] async fn payouts_incoming_webhook_flow( state: SessionState, merchant_context: domain::MerchantContext, business_profile: domain::Profile, webhook_details: api::IncomingWebhookDetails, event_type: webhooks::IncomingWebhookEvent, source_verified: bool, ) -> CustomResult<WebhookResponseTracker, errors::ApiErrorResponse> { metrics::INCOMING_PAYOUT_WEBHOOK_METRIC.add(1, &[]); if source_verified { let db = &*state.store; //find payout_attempt by object_reference_id let payout_attempt = match webhook_details.object_reference_id { webhooks::ObjectReferenceId::PayoutId(payout_id_type) => match payout_id_type { webhooks::PayoutIdType::PayoutAttemptId(id) => db .find_payout_attempt_by_merchant_id_payout_attempt_id( merchant_context.get_merchant_account().get_id(), &id, merchant_context.get_merchant_account().storage_scheme, ) .await .change_context(errors::ApiErrorResponse::WebhookResourceNotFound)
crates/router/src/core/webhooks/incoming.rs#chunk0
router
chunk
8,188
null
null
null
null
null
null
null
null
null
null
null
null
null
pub struct OpennodeErrorResponse { pub message: String, }
crates/hyperswitch_connectors/src/connectors/opennode/transformers.rs
hyperswitch_connectors
struct_definition
14
rust
OpennodeErrorResponse
null
null
null
null
null
null
null
null
null
null
null
File: crates/analytics/src/payments/distribution/payment_error_message.rs use api_models::analytics::{ payments::{PaymentDimensions, PaymentFilters, PaymentMetricsBucketIdentifier}, Granularity, PaymentDistributionBody, TimeRange, }; use common_utils::errors::ReportSwitchExt; use diesel_models::enums as storage_enums; use error_stack::ResultExt; use time::PrimitiveDateTime; use super::{PaymentDistribution, PaymentDistributionRow}; use crate::{ enums::AuthInfo, query::{ Aggregate, GroupByClause, Order, QueryBuilder, QueryFilter, SeriesBucket, ToSql, Window, }, types::{AnalyticsCollection, AnalyticsDataSource, MetricsError, MetricsResult}, }; #[derive(Default)] pub(super) struct PaymentErrorMessage; #[async_trait::async_trait] impl<T> PaymentDistribution<T> for PaymentErrorMessage where T: AnalyticsDataSource + super::PaymentDistributionAnalytics, PrimitiveDateTime: ToSql<T>, AnalyticsCollection: ToSql<T>, Granularity: GroupByClause<T>, Aggregate<&'static str>: ToSql<T>, Window<&'static str>: ToSql<T>, { async fn load_distribution( &self, distribution: &PaymentDistributionBody, dimensions: &[PaymentDimensions], auth: &AuthInfo, filters: &PaymentFilters, granularity: Option<Granularity>, time_range: &TimeRange, pool: &T, ) -> MetricsResult<Vec<(PaymentMetricsBucketIdentifier, PaymentDistributionRow)>> { let mut query_builder: QueryBuilder<T> = QueryBuilder::new(AnalyticsCollection::Payment); for dim in dimensions.iter() { query_builder.add_select_column(dim).switch()?; } query_builder .add_select_column(&distribution.distribution_for) .switch()?; query_builder .add_select_column(Aggregate::Count { field: None, alias: Some("count"), }) .switch()?; query_builder .add_select_column(Aggregate::Min { field: "created_at", alias: Some("start_bucket"), }) .switch()?; query_builder .add_select_column(Aggregate::Max { field: "created_at", alias: Some("end_bucket"), }) .switch()?; filters.set_filter_clause(&mut query_builder).switch()?; auth.set_filter_clause(&mut query_builder).switch()?; time_range .set_filter_clause(&mut query_builder) .attach_printable("Error filtering time range") .switch()?; for dim in dimensions.iter() { query_builder .add_group_by_clause(dim) .attach_printable("Error grouping by dimensions") .switch()?; } query_builder .add_group_by_clause(&distribution.distribution_for) .attach_printable("Error grouping by distribution_for") .switch()?; if let Some(granularity) = granularity { granularity .set_group_by_clause(&mut query_builder) .attach_printable("Error adding granularity") .switch()?; } query_builder .add_filter_clause( PaymentDimensions::PaymentStatus, storage_enums::AttemptStatus::Failure, ) .switch()?; for dim in dimensions.iter() { query_builder.add_outer_select_column(dim).switch()?; } query_builder .add_outer_select_column(&distribution.distribution_for) .switch()?; query_builder.add_outer_select_column("count").switch()?; query_builder .add_outer_select_column("start_bucket") .switch()?; query_builder .add_outer_select_column("end_bucket") .switch()?; let sql_dimensions = query_builder.transform_to_sql_values(dimensions).switch()?; query_builder .add_outer_select_column(Window::Sum { field: "count", partition_by: Some(sql_dimensions), order_by: None, alias: Some("total"), }) .switch()?; query_builder .add_top_n_clause( dimensions, distribution.distribution_cardinality.into(), "count", Order::Descending, ) .switch()?; query_builder .execute_query::<PaymentDistributionRow, _>(pool) .await .change_context(MetricsError::QueryBuildingError)? .change_context(MetricsError::QueryExecutionFailure)? .into_iter() .map(|i| { Ok(( PaymentMetricsBucketIdentifier::new( i.currency.as_ref().map(|i| i.0), i.status.as_ref().map(|i| i.0), i.connector.clone(), i.authentication_type.as_ref().map(|i| i.0), i.payment_method.clone(), i.payment_method_type.clone(), i.client_source.clone(), i.client_version.clone(), i.profile_id.clone(), i.card_network.clone(), i.merchant_id.clone(), i.card_last_4.clone(), i.card_issuer.clone(), i.error_reason.clone(), i.routing_approach.as_ref().map(|i| i.0.clone()), i.signature_network.clone(), i.is_issuer_regulated, i.is_debit_routed, TimeRange { start_time: match (granularity, i.start_bucket) { (Some(g), Some(st)) => g.clip_to_start(st)?, _ => time_range.start_time, }, end_time: granularity.as_ref().map_or_else( || Ok(time_range.end_time), |g| i.end_bucket.map(|et| g.clip_to_end(et)).transpose(), )?, }, ), i, )) }) .collect::<error_stack::Result< Vec<(PaymentMetricsBucketIdentifier, PaymentDistributionRow)>, crate::query::PostProcessingError, >>() .change_context(MetricsError::PostProcessingFailure) } }
crates/analytics/src/payments/distribution/payment_error_message.rs
analytics
full_file
1,238
null
null
null
null
null
null
null
null
null
null
null
null
null
pub fn non_enum_error() -> syn::Error { syn::Error::new(Span::call_site(), "This macro only supports enums.") }
crates/router_derive/src/macros/helpers.rs
router_derive
function_signature
31
rust
null
null
null
null
non_enum_error
null
null
null
null
null
null
null
pub struct StripebillingInvoiceBillingAddress { pub country: Option<enums::CountryAlpha2>, pub city: Option<String>, pub address_line1: Option<Secret<String>>, pub address_line2: Option<Secret<String>>, pub zip_code: Option<Secret<String>>, pub state: Option<Secret<String>>, }
crates/hyperswitch_connectors/src/connectors/stripebilling/transformers.rs
hyperswitch_connectors
struct_definition
69
rust
StripebillingInvoiceBillingAddress
null
null
null
null
null
null
null
null
null
null
null
pub struct CaptureIntegrityObject { /// capture amount pub capture_amount: Option<MinorUnit>, /// capture currency pub currency: storage_enums::Currency, }
crates/hyperswitch_domain_models/src/router_request_types.rs
hyperswitch_domain_models
struct_definition
38
rust
CaptureIntegrityObject
null
null
null
null
null
null
null
null
null
null
null
/// Generates the permissions enum and implematations for the permissions /// /// **NOTE:** You have to make sure that all the identifiers used /// in the macro input are present in the respective enums as well. /// /// ## Usage /// ``` /// use router_derive::generate_permissions; /// /// enum Scope { /// Read, /// Write, /// } /// /// enum EntityType { /// Profile, /// Merchant, /// Org, /// } /// /// enum Resource { /// Payments, /// Refunds, /// } /// /// generate_permissions! { /// permissions: [ /// Payments: { /// scopes: [Read, Write], /// entities: [Profile, Merchant, Org] /// }, /// Refunds: { /// scopes: [Read], /// entities: [Profile, Org] /// } /// ] /// } /// ``` /// This will generate the following enum. /// ``` /// enum Permission { /// ProfilePaymentsRead, /// ProfilePaymentsWrite, /// MerchantPaymentsRead, /// MerchantPaymentsWrite, /// OrgPaymentsRead, /// OrgPaymentsWrite, /// ProfileRefundsRead, /// OrgRefundsRead, /// ``` #[proc_macro] pub fn generate_permissions(input: proc_macro::TokenStream) -> proc_macro::TokenStream { macros::generate_permissions_inner(input) }
crates/router_derive/src/lib.rs
router_derive
macro
279
rust
null
null
null
null
null
null
null
null
proc_function_like
null
null
null
impl api::PaymentSession for Multisafepay {}
crates/hyperswitch_connectors/src/connectors/multisafepay.rs
hyperswitch_connectors
impl_block
12
rust
null
Multisafepay
api::PaymentSession for
impl api::PaymentSession for for Multisafepay
null
null
null
null
null
null
null
null
pub struct CardPaymentMethod { pub card: Card, pub requires_approval: bool, pub payment_product_id: u16, }
crates/hyperswitch_connectors/src/connectors/worldline/transformers.rs
hyperswitch_connectors
struct_definition
30
rust
CardPaymentMethod
null
null
null
null
null
null
null
null
null
null
null
pub struct CoinbasePaymentsRequest { pub name: Option<Secret<String>>, pub description: Option<String>, pub pricing_type: String, pub local_price: LocalPrice, pub redirect_url: String, pub cancel_url: String, }
crates/hyperswitch_connectors/src/connectors/coinbase/transformers.rs
hyperswitch_connectors
struct_definition
52
rust
CoinbasePaymentsRequest
null
null
null
null
null
null
null
null
null
null
null
impl api::PaymentToken for Dwolla {}
crates/hyperswitch_connectors/src/connectors/dwolla.rs
hyperswitch_connectors
impl_block
9
rust
null
Dwolla
api::PaymentToken for
impl api::PaymentToken for for Dwolla
null
null
null
null
null
null
null
null
impl NoEmailClient { /// Constructs a new client when email is disabled pub async fn create() -> Self { Self {} } }
crates/external_services/src/email/no_email.rs
external_services
impl_block
31
rust
null
NoEmailClient
null
impl NoEmailClient
null
null
null
null
null
null
null
null
OpenAPI Block Path: components.schemas.FrmConfigs { "type": "object", "description": "Details of FrmConfigs are mentioned here... it should be passed in payment connector create api call, and stored in merchant_connector_table", "required": [ "gateway", "payment_methods" ], "properties": { "gateway": { "$ref": "#/components/schemas/ConnectorType" }, "payment_methods": { "type": "array", "items": { "$ref": "#/components/schemas/FrmPaymentMethod" }, "description": "payment methods that can be used in the payment" } }, "additionalProperties": false }
./hyperswitch/api-reference/v1/openapi_spec_v1.json
null
openapi_block
153
.json
null
null
null
null
null
openapi_spec
components
[ "schemas", "FrmConfigs" ]
null
null
null
null
pub struct KafkaDispute<'a> { pub dispute_id: &'a String, pub dispute_amount: MinorUnit, pub currency: storage_enums::Currency, pub dispute_stage: &'a storage_enums::DisputeStage, pub dispute_status: &'a storage_enums::DisputeStatus, pub payment_id: &'a id_type::PaymentId, pub attempt_id: &'a String, pub merchant_id: &'a id_type::MerchantId, pub connector_status: &'a String, pub connector_dispute_id: &'a String, pub connector_reason: Option<&'a String>, pub connector_reason_code: Option<&'a String>, #[serde(default, with = "time::serde::timestamp::option")] pub challenge_required_by: Option<OffsetDateTime>, #[serde(default, with = "time::serde::timestamp::option")] pub connector_created_at: Option<OffsetDateTime>, #[serde(default, with = "time::serde::timestamp::option")] pub connector_updated_at: Option<OffsetDateTime>, #[serde(default, with = "time::serde::timestamp")] pub created_at: OffsetDateTime, #[serde(default, with = "time::serde::timestamp")] pub modified_at: OffsetDateTime, pub connector: &'a String, pub evidence: &'a Secret<serde_json::Value>, pub profile_id: Option<&'a id_type::ProfileId>, pub merchant_connector_id: Option<&'a id_type::MerchantConnectorAccountId>, pub organization_id: &'a id_type::OrganizationId, }
crates/router/src/services/kafka/dispute.rs
router
struct_definition
336
rust
KafkaDispute
null
null
null
null
null
null
null
null
null
null
null
pub struct TokeniseCreditCardResponse { tokenise_credit_card_result: TokeniseCreditCardResult, }
crates/hyperswitch_connectors/src/connectors/bamboraapac/transformers.rs
hyperswitch_connectors
struct_definition
22
rust
TokeniseCreditCardResponse
null
null
null
null
null
null
null
null
null
null
null
impl api::ConnectorCustomer for Stripe {}
crates/hyperswitch_connectors/src/connectors/stripe.rs
hyperswitch_connectors
impl_block
8
rust
null
Stripe
api::ConnectorCustomer for
impl api::ConnectorCustomer for for Stripe
null
null
null
null
null
null
null
null
File: crates/hyperswitch_domain_models/src/router_flow_types/payouts.rs Public structs: 8 #[derive(Debug, Clone)] pub struct PoCancel; #[derive(Debug, Clone)] pub struct PoCreate; #[derive(Debug, Clone)] pub struct PoEligibility; #[derive(Debug, Clone)] pub struct PoFulfill; #[derive(Debug, Clone)] pub struct PoQuote; #[derive(Debug, Clone)] pub struct PoRecipient; #[derive(Debug, Clone)] pub struct PoRecipientAccount; #[derive(Debug, Clone)] pub struct PoSync;
crates/hyperswitch_domain_models/src/router_flow_types/payouts.rs
hyperswitch_domain_models
full_file
116
null
null
null
null
null
null
null
null
null
null
null
null
null
pub fn get_surcharge_details_redis_hashset_key(surcharge_key: &SurchargeKey) -> String { match surcharge_key { SurchargeKey::Token(token) => { format!("token_{token}") } SurchargeKey::PaymentMethodData(payment_method, payment_method_type, card_network) => { if let Some(card_network) = card_network { format!("{payment_method}_{payment_method_type}_{card_network}") } else { format!("{payment_method}_{payment_method_type}") } } } }
crates/router/src/core/payments/types.rs
router
function_signature
114
rust
null
null
null
null
get_surcharge_details_redis_hashset_key
null
null
null
null
null
null
null
impl Responder { let flow = Flow::PaymentsList; let payload = payload.into_inner(); Box::pin(api::server_wrap( flow, state, &req, payload, |state, auth: auth::AuthenticationData, req, _| { let merchant_context = domain::MerchantContext::NormalMerchant(Box::new( domain::Context(auth.merchant_account, auth.key_store), )); payments::list_payments( state, merchant_context, auth.profile_id.map(|profile_id| vec![profile_id]), req, ) }, auth::auth_type( &auth::HeaderAuth(auth::ApiKeyAuth { is_connected_allowed: false, is_platform_allowed: true, }), &auth::JWTAuth { permission: Permission::ProfilePaymentRead, }, req.headers(), ), api_locking::LockAction::NotApplicable, )) .await }
crates/router/src/routes/payments.rs
router
impl_block
199
rust
null
Responder
null
impl Responder
null
null
null
null
null
null
null
null
pub struct MerchantDetails { /// The merchant's primary contact name #[schema(value_type = Option<String>, max_length = 255, example = "John Doe")] pub primary_contact_person: Option<Secret<String>>, /// The merchant's primary phone number #[schema(value_type = Option<String>, max_length = 255, example = "999999999")] pub primary_phone: Option<Secret<String>>, /// The merchant's primary email address #[schema(value_type = Option<String>, max_length = 255, example = "[email protected]")] pub primary_email: Option<pii::Email>, /// The merchant's secondary contact name #[schema(value_type = Option<String>, max_length= 255, example = "John Doe2")] pub secondary_contact_person: Option<Secret<String>>, /// The merchant's secondary phone number #[schema(value_type = Option<String>, max_length = 255, example = "999999988")] pub secondary_phone: Option<Secret<String>>, /// The merchant's secondary email address #[schema(value_type = Option<String>, max_length = 255, example = "[email protected]")] pub secondary_email: Option<pii::Email>, /// The business website of the merchant #[schema(max_length = 255, example = "www.example.com")] pub website: Option<String>, /// A brief description about merchant's business #[schema( max_length = 255, example = "Online Retail with a wide selection of organic products for North America" )] pub about_business: Option<String>, /// The merchant's address details pub address: Option<AddressDetails>, #[schema(value_type = Option<String>, example = "123456789")] pub merchant_tax_registration_id: Option<Secret<String>>, }
crates/api_models/src/admin.rs
api_models
struct_definition
429
rust
MerchantDetails
null
null
null
null
null
null
null
null
null
null
null
let is_error_in_response = router_data.response.is_err(); // If is_error_in_response is true, should_continue_payment should be false, we should throw the error (router_data, !is_error_in_response) } else { (router_data, should_continue_payment) } } _ => { // 3DS validation for paypal cards after verification (authorize call) if connector.connector_name == router_types::Connector::Paypal && payment_data.get_payment_attempt().get_payment_method() == Some(storage_enums::PaymentMethod::Card) && matches!(format!("{operation:?}").as_str(), "CompleteAuthorize") { router_data = router_data.preprocessing_steps(state, connector).await?; let is_error_in_response = router_data.response.is_err(); // If is_error_in_response is true, should_continue_payment should be false, we should throw the error (router_data, !is_error_in_response) } else { (router_data, should_continue_payment) } } }; Ok(router_data_and_should_continue_payment) } #[cfg(feature = "v1")] async fn complete_confirmation_for_click_to_pay_if_required<F, D>( state: &SessionState, merchant_context: &domain::MerchantContext, payment_data: &D, ) -> RouterResult<()> where F: Send + Clone + Sync, D: OperationSessionGetters<F> + OperationSessionSetters<F> + Send + Sync + Clone, { let payment_attempt = payment_data.get_payment_attempt(); let payment_intent = payment_data.get_payment_intent(); let service_details = payment_data.get_click_to_pay_service_details(); let authentication = payment_data.get_authentication(); let should_do_uas_confirmation_call = service_details .as_ref() .map(|details| details.is_network_confirmation_call_required()) .unwrap_or(true); if should_do_uas_confirmation_call && (payment_intent.status == storage_enums::IntentStatus::Succeeded || payment_intent.status == storage_enums::IntentStatus::Failed) { let authentication_connector_id = authentication .as_ref() .and_then(|auth| auth.authentication.merchant_connector_id.clone()) .ok_or(errors::ApiErrorResponse::InternalServerError) .attach_printable( "Failed to get authentication connector id from authentication table", )?; let key_manager_state = &(state).into(); let key_store = merchant_context.get_merchant_key_store(); let merchant_id = merchant_context.get_merchant_account().get_id(); let connector_mca = state .store .find_by_merchant_connector_account_merchant_id_merchant_connector_id( key_manager_state, merchant_id, &authentication_connector_id, key_store, ) .await .to_not_found_response(errors::ApiErrorResponse::MerchantConnectorAccountNotFound { id: authentication_connector_id.get_string_repr().to_string(), })?; let payment_method = payment_attempt .payment_method .ok_or(errors::ApiErrorResponse::InternalServerError) .attach_printable("Failed to get payment method from payment attempt")?; ClickToPay::confirmation( state, payment_attempt.authentication_id.as_ref(), payment_intent.currency, payment_attempt.status, service_details.cloned(), &helpers::MerchantConnectorAccountType::DbVal(Box::new(connector_mca.clone())), &connector_mca.connector_name, payment_method, payment_attempt.net_amount.get_order_amount(), Some(&payment_intent.payment_id), merchant_id, ) .await?; Ok(()) } else { Ok(()) } } #[cfg(feature = "v1")] #[allow(clippy::too_many_arguments)] async fn complete_postprocessing_steps_if_required<F, Q, RouterDReq, D>( state: &SessionState, merchant_context: &domain::MerchantContext, customer: &Option<domain::Customer>, merchant_conn_account: &helpers::MerchantConnectorAccountType, connector: &api::ConnectorData, payment_data: &mut D, _operation: &BoxedOperation<'_, F, Q, D>, header_payload: Option<HeaderPayload>, ) -> RouterResult<RouterData<F, RouterDReq, router_types::PaymentsResponseData>> where F: Send + Clone + Sync, RouterDReq: Send + Sync, D: OperationSessionGetters<F> + OperationSessionSetters<F> + Send + Sync + Clone, RouterData<F, RouterDReq, router_types::PaymentsResponseData>: Feature<F, RouterDReq> + Send, dyn api::Connector: services::api::ConnectorIntegration<F, RouterDReq, router_types::PaymentsResponseData>, D: ConstructFlowSpecificData<F, RouterDReq, router_types::PaymentsResponseData>, { let mut router_data = payment_data .construct_router_data( state, connector.connector.id(), merchant_context, customer, merchant_conn_account, None, header_payload, ) .await?; match payment_data.get_payment_method_data() { Some(domain::PaymentMethodData::OpenBanking(domain::OpenBankingData::OpenBankingPIS { .. })) => { if connector.connector_name == router_types::Connector::Plaid { router_data = router_data.postprocessing_steps(state, connector).await?; let token = if let Ok(ref res) = router_data.response { match res { router_types::PaymentsResponseData::PostProcessingResponse { session_token, } => session_token .as_ref() .map(|token| api::SessionToken::OpenBanking(token.clone())), _ => None, } } else { None }; if let Some(t) = token { payment_data.push_sessions_token(t); } Ok(router_data) } else { Ok(router_data) } } _ => Ok(router_data), } } pub fn is_preprocessing_required_for_wallets(connector_name: String) -> bool { connector_name == *"trustpay" || connector_name == *"payme" } #[cfg(feature = "v1")] #[instrument(skip_all)] pub async fn construct_profile_id_and_get_mca<'a, F, D>( state: &'a SessionState, merchant_context: &domain::MerchantContext, payment_data: &D, connector_name: &str, merchant_connector_id: Option<&id_type::MerchantConnectorAccountId>, _should_validate: bool, ) -> RouterResult<helpers::MerchantConnectorAccountType> where F: Clone, D: OperationSessionGetters<F> + Send + Sync + Clone, { let profile_id = payment_data .get_payment_intent() .profile_id .as_ref() .get_required_value("profile_id") .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable("profile_id is not set in payment_intent")? .clone(); #[cfg(feature = "v2")] let profile_id = payment_data.get_payment_intent().profile_id.clone(); let merchant_connector_account = helpers::get_merchant_connector_account( state, merchant_context.get_merchant_account().get_id(), payment_data.get_creds_identifier(), merchant_context.get_merchant_key_store(), &profile_id, connector_name, merchant_connector_id, ) .await?; Ok(merchant_connector_account) } fn is_payment_method_tokenization_enabled_for_connector( state: &SessionState, connector_name: &str, payment_method: storage::enums::PaymentMethod, payment_method_type: Option<storage::enums::PaymentMethodType>, payment_method_token: Option<&PaymentMethodToken>, mandate_flow_enabled: Option<storage_enums::FutureUsage>, ) -> RouterResult<bool> { let connector_tokenization_filter = state.conf.tokenization.0.get(connector_name); Ok(connector_tokenization_filter .map(|connector_filter| { connector_filter .payment_method .clone() .contains(&payment_method) && is_payment_method_type_allowed_for_connector( payment_method_type, connector_filter.payment_method_type.clone(), ) && is_apple_pay_pre_decrypt_type_connector_tokenization( payment_method_type, payment_method_token, connector_filter.apple_pay_pre_decrypt_flow.clone(), ) && is_payment_flow_allowed_for_connector( mandate_flow_enabled, connector_filter.flow.clone(), ) }) .unwrap_or(false)) } fn is_payment_flow_allowed_for_connector( mandate_flow_enabled: Option<storage_enums::FutureUsage>, payment_flow: Option<PaymentFlow>, ) -> bool { if payment_flow.is_none() { true } else { matches!(payment_flow, Some(PaymentFlow::Mandates)) && matches!( mandate_flow_enabled, Some(storage_enums::FutureUsage::OffSession) ) } } fn is_apple_pay_pre_decrypt_type_connector_tokenization( payment_method_type: Option<storage::enums::PaymentMethodType>, payment_method_token: Option<&PaymentMethodToken>, apple_pay_pre_decrypt_flow_filter: Option<ApplePayPreDecryptFlow>, ) -> bool { match (payment_method_type, payment_method_token) { ( Some(storage::enums::PaymentMethodType::ApplePay), Some(PaymentMethodToken::ApplePayDecrypt(..)), ) => !matches!( apple_pay_pre_decrypt_flow_filter, Some(ApplePayPreDecryptFlow::NetworkTokenization) ), _ => true, } } fn decide_apple_pay_flow( state: &SessionState, payment_method_type: Option<enums::PaymentMethodType>, merchant_connector_account: Option<&helpers::MerchantConnectorAccountType>, ) -> Option<domain::ApplePayFlow> { payment_method_type.and_then(|pmt| match pmt { enums::PaymentMethodType::ApplePay => { check_apple_pay_metadata(state, merchant_connector_account) } _ => None, }) } fn check_apple_pay_metadata( state: &SessionState, merchant_connector_account: Option<&helpers::MerchantConnectorAccountType>, ) -> Option<domain::ApplePayFlow> { merchant_connector_account.and_then(|mca| { let metadata = mca.get_metadata(); metadata.and_then(|apple_pay_metadata| { let parsed_metadata = apple_pay_metadata .clone() .parse_value::<api_models::payments::ApplepayCombinedSessionTokenData>( "ApplepayCombinedSessionTokenData", ) .map(|combined_metadata| { api_models::payments::ApplepaySessionTokenMetadata::ApplePayCombined( combined_metadata.apple_pay_combined, ) }) .or_else(|_| { apple_pay_metadata .parse_value::<api_models::payments::ApplepaySessionTokenData>( "ApplepaySessionTokenData", ) .map(|old_metadata| { api_models::payments::ApplepaySessionTokenMetadata::ApplePay( old_metadata.apple_pay, ) }) }) .map_err(|error| { logger::warn!(?error, "Failed to Parse Value to ApplepaySessionTokenData") }); parsed_metadata.ok().map(|metadata| match metadata { api_models::payments::ApplepaySessionTokenMetadata::ApplePayCombined( apple_pay_combined, ) => match apple_pay_combined { api_models::payments::ApplePayCombinedMetadata::Simplified { .. } => { domain::ApplePayFlow::Simplified(payments_api::PaymentProcessingDetails { payment_processing_certificate: state .conf .applepay_decrypt_keys .get_inner() .apple_pay_ppc .clone(), payment_processing_certificate_key: state .conf .applepay_decrypt_keys .get_inner() .apple_pay_ppc_key .clone(), }) } api_models::payments::ApplePayCombinedMetadata::Manual { payment_request_data: _, session_token_data, } => { if let Some(manual_payment_processing_details_at) = session_token_data.payment_processing_details_at { match manual_payment_processing_details_at { payments_api::PaymentProcessingDetailsAt::Hyperswitch( payment_processing_details, ) => domain::ApplePayFlow::Simplified(payment_processing_details), payments_api::PaymentProcessingDetailsAt::Connector => { domain::ApplePayFlow::Manual } } } else { domain::ApplePayFlow::Manual } } }, api_models::payments::ApplepaySessionTokenMetadata::ApplePay(_) => { domain::ApplePayFlow::Manual } }) }) }) } fn get_google_pay_connector_wallet_details( state: &SessionState, merchant_connector_account: &helpers::MerchantConnectorAccountType, ) -> Option<GooglePayPaymentProcessingDetails> { let google_pay_root_signing_keys = state .conf .google_pay_decrypt_keys .as_ref() .map(|google_pay_keys| google_pay_keys.google_pay_root_signing_keys.clone()); match merchant_connector_account.get_connector_wallets_details() { Some(wallet_details) => { let google_pay_wallet_details = wallet_details .parse_value::<api_models::payments::GooglePayWalletDetails>( "GooglePayWalletDetails", ) .map_err(|error| { logger::warn!(?error, "Failed to Parse Value to GooglePayWalletDetails") }); google_pay_wallet_details .ok() .and_then( |google_pay_wallet_details| { match google_pay_wallet_details .google_pay .provider_details { api_models::payments::GooglePayProviderDetails::GooglePayMerchantDetails(merchant_details) => { match ( merchant_details .merchant_info .tokenization_specification .parameters .private_key, google_pay_root_signing_keys, merchant_details .merchant_info .tokenization_specification .parameters .recipient_id, ) { (Some(google_pay_private_key), Some(google_pay_root_signing_keys), Some(google_pay_recipient_id)) => { Some(GooglePayPaymentProcessingDetails { google_pay_private_key, google_pay_root_signing_keys, google_pay_recipient_id }) } _ => { logger::warn!("One or more of the following fields are missing in GooglePayMerchantDetails: google_pay_private_key, google_pay_root_signing_keys, google_pay_recipient_id"); None } } } } } ) } None => None, } } fn is_payment_method_type_allowed_for_connector( current_pm_type: Option<storage::enums::PaymentMethodType>, pm_type_filter: Option<PaymentMethodTypeTokenFilter>, ) -> bool { match (current_pm_type).zip(pm_type_filter) { Some((pm_type, type_filter)) => match type_filter { PaymentMethodTypeTokenFilter::AllAccepted => true, PaymentMethodTypeTokenFilter::EnableOnly(enabled) => enabled.contains(&pm_type), PaymentMethodTypeTokenFilter::DisableOnly(disabled) => !disabled.contains(&pm_type), }, None => true, // Allow all types if payment_method_type is not present } } #[allow(clippy::too_many_arguments)] async fn decide_payment_method_tokenize_action( state: &SessionState, connector_name: &str, payment_method: storage::enums::PaymentMethod, payment_intent_data: payments::PaymentIntent, pm_parent_token: Option<&str>, is_connector_tokenization_enabled: bool, ) -> RouterResult<TokenizationAction> { if matches!( payment_intent_data.split_payments, Some(common_types::payments::SplitPaymentsRequest::StripeSplitPayment(_)) ) { Ok(TokenizationAction::TokenizeInConnector) } else { match pm_parent_token { None => Ok(if is_connector_tokenization_enabled { TokenizationAction::TokenizeInConnectorAndRouter } else { TokenizationAction::TokenizeInRouter }), Some(token) => { let redis_conn = state .store .get_redis_conn() .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable("Failed to get redis connection")?; let key = format!( "pm_token_{}_{}_{}", token.to_owned(), payment_method, connector_name ); let connector_token_option = redis_conn .get_key::<Option<String>>(&key.into()) .await .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable("Failed to fetch the token from redis")?; match connector_token_option { Some(connector_token) => { Ok(TokenizationAction::ConnectorToken(connector_token)) } None => Ok(if is_connector_tokenization_enabled { TokenizationAction::TokenizeInConnectorAndRouter } else { TokenizationAction::TokenizeInRouter }), } } } } } #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, PartialEq, Eq)] pub struct PazePaymentProcessingDetails { pub paze_private_key: Secret<String>, pub paze_private_key_passphrase: Secret<String>, } #[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] pub struct GooglePayPaymentProcessingDetails { pub google_pay_private_key: Secret<String>, pub google_pay_root_signing_keys: Secret<String>, pub google_pay_recipient_id: Secret<String>, } #[derive(Clone, Debug)] pub enum TokenizationAction { TokenizeInRouter, TokenizeInConnector, TokenizeInConnectorAndRouter, ConnectorToken(String), SkipConnectorTokenization, } #[cfg(feature = "v2")] #[allow(clippy::too_many_arguments)] pub async fn get_connector_tokenization_action_when_confirm_true<F, Req, D>( _state: &SessionState, _operation: &BoxedOperation<'_, F, Req, D>, payment_data: &mut D, _validate_result: &operations::ValidateResult, _merchant_key_store: &domain::MerchantKeyStore, _customer: &Option<domain::Customer>, _business_profile: &domain::Profile, ) -> RouterResult<(D, TokenizationAction)> where F: Send + Clone, D: OperationSessionGetters<F> + OperationSessionSetters<F> + Send + Sync + Clone, { // TODO: Implement this function let payment_data = payment_data.to_owned(); Ok((payment_data, TokenizationAction::SkipConnectorTokenization)) } #[cfg(feature = "v1")] #[allow(clippy::too_many_arguments)] pub async fn get_connector_tokenization_action_when_confirm_true<F, Req, D>( state: &SessionState, operation: &BoxedOperation<'_, F, Req, D>, payment_data: &mut D, validate_result: &operations::ValidateResult, merchant_key_store: &domain::MerchantKeyStore, customer: &Option<domain::Customer>, business_profile: &domain::Profile, should_retry_with_pan: bool, ) -> RouterResult<(D, TokenizationAction)> where F: Send + Clone, D: OperationSessionGetters<F> + OperationSessionSetters<F> + Send + Sync + Clone, { let connector = payment_data.get_payment_attempt().connector.to_owned(); let is_mandate = payment_data .get_mandate_id() .as_ref() .and_then(|inner| inner.mandate_reference_id.as_ref()) .map(|mandate_reference| match mandate_reference { api_models::payments::MandateReferenceId::ConnectorMandateId(_) => true, api_models::payments::MandateReferenceId::NetworkMandateId(_) | api_models::payments::MandateReferenceId::NetworkTokenWithNTI(_) => false, }) .unwrap_or(false); let payment_data_and_tokenization_action = match connector { Some(_) if is_mandate => ( payment_data.to_owned(), TokenizationAction::SkipConnectorTokenization, ), Some(connector) if is_operation_confirm(&operation) => { let payment_method = payment_data .get_payment_attempt() .payment_method .get_required_value("payment_method")?; let payment_method_type = payment_data.get_payment_attempt().payment_method_type; let mandate_flow_enabled = payment_data .get_payment_attempt() .setup_future_usage_applied; let is_connector_tokenization_enabled = is_payment_method_tokenization_enabled_for_connector( state, &connector, payment_method, payment_method_type, payment_data.get_payment_method_token(), mandate_flow_enabled, )?; let payment_method_action = decide_payment_method_tokenize_action( state, &connector, payment_method, payment_data.get_payment_intent().clone(), payment_data.get_token(), is_connector_tokenization_enabled, ) .await?; let connector_tokenization_action = match payment_method_action { TokenizationAction::TokenizeInRouter => { let (_operation, payment_method_data, pm_id) = operation .to_domain()? .make_pm_data( state, payment_data, validate_result.storage_scheme, merchant_key_store, customer, business_profile, should_retry_with_pan, ) .await?; payment_data.set_payment_method_data(payment_method_data); payment_data.set_payment_method_id_in_attempt(pm_id); TokenizationAction::SkipConnectorTokenization } TokenizationAction::TokenizeInConnector => TokenizationAction::TokenizeInConnector, TokenizationAction::TokenizeInConnectorAndRouter => { let (_operation, payment_method_data, pm_id) = operation .to_domain()? .make_pm_data( state, payment_data, validate_result.storage_scheme, merchant_key_store, customer, business_profile, should_retry_with_pan, ) .await?; payment_data.set_payment_method_data(payment_method_data); payment_data.set_payment_method_id_in_attempt(pm_id); TokenizationAction::TokenizeInConnector } TokenizationAction::ConnectorToken(token) => { payment_data.set_pm_token(token); TokenizationAction::SkipConnectorTokenization } TokenizationAction::SkipConnectorTokenization => { TokenizationAction::SkipConnectorTokenization } }; (payment_data.to_owned(), connector_tokenization_action) } _ => ( payment_data.to_owned(), TokenizationAction::SkipConnectorTokenization, ), }; Ok(payment_data_and_tokenization_action) } #[cfg(feature = "v2")] pub async fn tokenize_in_router_when_confirm_false_or_external_authentication<F, Req, D>( state: &SessionState, operation: &BoxedOperation<'_, F, Req, D>, payment_data: &mut D, validate_result: &operations::ValidateResult, merchant_key_store: &domain::MerchantKeyStore, customer: &Option<domain::Customer>, business_profile: &domain::Profile, ) -> RouterResult<D> where F: Send + Clone, D: OperationSessionGetters<F> + OperationSessionSetters<F> + Send + Sync + Clone, { todo!() } #[cfg(feature = "v1")] pub async fn tokenize_in_router_when_confirm_false_or_external_authentication<F, Req, D>( state: &SessionState, operation: &BoxedOperation<'_, F, Req, D>, payment_data: &mut D, validate_result: &operations::ValidateResult, merchant_key_store: &domain::MerchantKeyStore, customer: &Option<domain::Customer>, business_profile: &domain::Profile, ) -> RouterResult<D> where F: Send + Clone, D: OperationSessionGetters<F> + OperationSessionSetters<F> + Send + Sync + Clone, { // On confirm is false and only router related let is_external_authentication_requested = payment_data .get_payment_intent() .request_external_three_ds_authentication; let payment_data = if !is_operation_confirm(operation) || is_external_authentication_requested == Some(true) { let (_operation, payment_method_data, pm_id) = operation .to_domain()? .make_pm_data( state, payment_data, validate_result.storage_scheme, merchant_key_store, customer, business_profile, false, ) .await?; payment_data.set_payment_method_data(payment_method_data); if let Some(payment_method_id) = pm_id { payment_data.set_payment_method_id_in_attempt(Some(payment_method_id)); } payment_data } else { payment_data }; Ok(payment_data.to_owned()) } #[derive(Clone)] pub struct MandateConnectorDetails { pub connector: String, pub merchant_connector_id: Option<id_type::MerchantConnectorAccountId>, } #[derive(Clone)] pub struct PaymentData<F> where F: Clone, { pub flow: PhantomData<F>, pub payment_intent: storage::PaymentIntent, pub payment_attempt: storage::PaymentAttempt, pub multiple_capture_data: Option<types::MultipleCaptureData>, pub amount: api::Amount, pub mandate_id: Option<api_models::payments::MandateIds>, pub mandate_connector: Option<MandateConnectorDetails>, pub currency: storage_enums::Currency, pub setup_mandate: Option<MandateData>, pub customer_acceptance: Option<common_payments_types::CustomerAcceptance>, pub address: PaymentAddress, pub token: Option<String>, pub token_data: Option<storage::PaymentTokenData>, pub confirm: Option<bool>, pub force_sync: Option<bool>, pub all_keys_required: Option<bool>, pub payment_method_data: Option<domain::PaymentMethodData>, pub payment_method_token: Option<PaymentMethodToken>, pub payment_method_info: Option<domain::PaymentMethod>, pub refunds: Vec<diesel_refund::Refund>, pub disputes: Vec<storage::Dispute>, pub attempts: Option<Vec<storage::PaymentAttempt>>, pub sessions_token: Vec<api::SessionToken>, pub card_cvc: Option<Secret<String>>, pub email: Option<pii::Email>, pub creds_identifier: Option<String>, pub pm_token: Option<String>, pub connector_customer_id: Option<String>, pub recurring_mandate_payment_data: Option<hyperswitch_domain_models::router_data::RecurringMandatePaymentData>, pub ephemeral_key: Option<ephemeral_key::EphemeralKey>, pub redirect_response: Option<api_models::payments::RedirectResponse>, pub surcharge_details: Option<types::SurchargeDetails>, pub frm_message: Option<FraudCheck>, pub payment_link_data: Option<api_models::payments::PaymentLinkResponse>, pub incremental_authorization_details: Option<IncrementalAuthorizationDetails>, pub authorizations: Vec<diesel_models::authorization::Authorization>, pub authentication: Option<domain::authentication::AuthenticationStore>, pub recurring_details: Option<RecurringDetails>, pub poll_config: Option<router_types::PollConfig>, pub tax_data: Option<TaxData>, pub session_id: Option<String>, pub service_details: Option<api_models::payments::CtpServiceDetails>, pub card_testing_guard_data: Option<hyperswitch_domain_models::card_testing_guard_data::CardTestingGuardData>, pub vault_operation: Option<domain_payments::VaultOperation>, pub threeds_method_comp_ind: Option<api_models::payments::ThreeDsCompletionIndicator>, pub whole_connector_response: Option<Secret<String>>, } #[derive(Clone, serde::Serialize, Debug)] pub struct TaxData { pub shipping_details: hyperswitch_domain_models::address::Address, pub payment_method_type: enums::PaymentMethodType, } #[derive(Clone, serde::Serialize, Debug)] pub struct PaymentEvent { payment_intent: storage::PaymentIntent, payment_attempt: storage::PaymentAttempt, } impl<F: Clone> PaymentData<F> { // Get the method by which a card is discovered during a payment #[cfg(feature = "v1")] fn get_card_discovery_for_card_payment_method(&self) -> Option<common_enums::CardDiscovery> { match self.payment_attempt.payment_method { Some(storage_enums::PaymentMethod::Card) => { if self .token_data .as_ref() .map(storage::PaymentTokenData::is_permanent_card) .unwrap_or(false) { Some(common_enums::CardDiscovery::SavedCard) } else if self.service_details.is_some() { Some(common_enums::CardDiscovery::ClickToPay) } else { Some(common_enums::CardDiscovery::Manual) } } _ => None, } } fn to_event(&self) -> PaymentEvent { PaymentEvent { payment_intent: self.payment_intent.clone(), payment_attempt: self.payment_attempt.clone(), } } } impl EventInfo for PaymentEvent { type Data = Self; fn data(&self) -> error_stack::Result<Self::Data, events::EventsError> { Ok(self.clone()) } fn key(&self) -> String { "payment".to_string() } } #[derive(Debug, Default, Clone)] pub struct IncrementalAuthorizationDetails { pub additional_amount: MinorUnit, pub total_amount: MinorUnit, pub reason: Option<String>, pub authorization_id: Option<String>, } pub async fn get_payment_link_response_from_id( state: &SessionState, payment_link_id: &str, ) -> CustomResult<api_models::payments::PaymentLinkResponse, errors::ApiErrorResponse> { let db = &*state.store; let payment_link_object = db .find_payment_link_by_payment_link_id(payment_link_id) .await .to_not_found_response(errors::ApiErrorResponse::PaymentLinkNotFound)?; Ok(api_models::payments::PaymentLinkResponse { link: payment_link_object.link_to_pay.clone(), secure_link: payment_link_object.secure_link, payment_link_id: payment_link_object.payment_link_id, }) } #[cfg(feature = "v1")] pub fn if_not_create_change_operation<'a, Op, F>( status: storage_enums::IntentStatus, confirm: Option<bool>, current: &'a Op, ) -> BoxedOperation<'a, F, api::PaymentsRequest, PaymentData<F>> where F: Send + Clone + Sync, Op: Operation<F, api::PaymentsRequest, Data = PaymentData<F>> + Send + Sync, &'a Op: Operation<F, api::PaymentsRequest, Data = PaymentData<F>>, PaymentStatus: Operation<F, api::PaymentsRequest, Data = PaymentData<F>>, &'a PaymentStatus: Operation<F, api::PaymentsRequest, Data = PaymentData<F>>, { if confirm.unwrap_or(false) { Box::new(PaymentConfirm) } else { match status { storage_enums::IntentStatus::RequiresConfirmation | storage_enums::IntentStatus::RequiresCustomerAction | storage_enums::IntentStatus::RequiresPaymentMethod => Box::new(current), _ => Box::new(&PaymentStatus), } } } #[cfg(feature = "v1")] pub fn is_confirm<'a, F: Clone + Send, R, Op>( operation: &'a Op, confirm: Option<bool>, ) -> BoxedOperation<'a, F, R, PaymentData<F>> where PaymentConfirm: Operation<F, R, Data = PaymentData<F>>, &'a PaymentConfirm: Operation<F, R, Data = PaymentData<F>>, Op: Operation<F, R, Data = PaymentData<F>> + Send + Sync, &'a Op: Operation<F, R, Data = PaymentData<F>>, { if confirm.unwrap_or(false) { Box::new(&PaymentConfirm) } else { Box::new(operation) } } #[cfg(feature = "v1")] pub fn should_call_connector<Op: Debug, F: Clone, D>(operation: &Op, payment_data: &D) -> bool where D: OperationSessionGetters<F> + Send + Sync + Clone, { match format!("{operation:?}").as_str() { "PaymentConfirm" => true, "PaymentStart" => { !matches!( payment_data.get_payment_intent().status, storage_enums::IntentStatus::Failed | storage_enums::IntentStatus::Succeeded ) && payment_data .get_payment_attempt() .authentication_data .is_none() } "PaymentStatus" => { payment_data.get_all_keys_required().unwrap_or(false) || matches!( payment_data.get_payment_intent().status, storage_enums::IntentStatus::Processing | storage_enums::IntentStatus::RequiresCustomerAction | storage_enums::IntentStatus::RequiresMerchantAction | storage_enums::IntentStatus::RequiresCapture | storage_enums::IntentStatus::PartiallyCapturedAndCapturable ) && payment_data.get_force_sync().unwrap_or(false) } "PaymentCancel" => matches!( payment_data.get_payment_intent().status, storage_enums::IntentStatus::RequiresCapture | storage_enums::IntentStatus::PartiallyCapturedAndCapturable ), "PaymentCancelPostCapture" => matches!( payment_data.get_payment_intent().status, storage_enums::IntentStatus::Succeeded | storage_enums::IntentStatus::PartiallyCaptured | storage_enums::IntentStatus::PartiallyCapturedAndCapturable ), "PaymentCapture" => { matches!( payment_data.get_payment_intent().status, storage_enums::IntentStatus::RequiresCapture | storage_enums::IntentStatus::PartiallyAuthorizedAndRequiresCapture | storage_enums::IntentStatus::PartiallyCapturedAndCapturable ) || (matches!( payment_data.get_payment_intent().status, storage_enums::IntentStatus::Processing ) && matches!( payment_data.get_capture_method(), Some(storage_enums::CaptureMethod::ManualMultiple) )) } "CompleteAuthorize" => true, "PaymentApprove" => true, "PaymentReject" => true, "PaymentSession" => true, "PaymentSessionUpdate" => true, "PaymentPostSessionTokens" => true, "PaymentUpdateMetadata" => true, "PaymentIncrementalAuthorization" => matches!( payment_data.get_payment_intent().status, storage_enums::IntentStatus::RequiresCapture ), _ => false, } } pub fn is_operation_confirm<Op: Debug>(operation: &Op) -> bool { matches!(format!("{operation:?}").as_str(), "PaymentConfirm") } pub fn is_operation_complete_authorize<Op: Debug>(operation: &Op) -> bool { matches!(format!("{operation:?}").as_str(), "CompleteAuthorize") } #[cfg(all(feature = "olap", feature = "v1"))] pub async fn list_payments( state: SessionState, merchant_context: domain::MerchantContext, profile_id_list: Option<Vec<id_type::ProfileId>>, constraints: api::PaymentListConstraints, ) -> RouterResponse<api::PaymentListResponse> { helpers::validate_payment_list_request(&constraints)?; let merchant_id = merchant_context.get_merchant_account().get_id(); let db = state.store.as_ref(); let payment_intents = helpers::filter_by_constraints( &state, &(constraints, profile_id_list).try_into()?, merchant_id, merchant_context.get_merchant_key_store(), merchant_context.get_merchant_account().storage_scheme, ) .await .to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?; let collected_futures = payment_intents.into_iter().map(|pi| { async { match db .find_payment_attempt_by_payment_id_merchant_id_attempt_id( &pi.payment_id, merchant_id, &pi.active_attempt.get_id(), // since OLAP doesn't have KV. Force to get the data from PSQL. storage_enums::MerchantStorageScheme::PostgresOnly, ) .await { Ok(pa) => Some(Ok((pi, pa))), Err(error) => { if matches!( error.current_context(), errors::StorageError::ValueNotFound(_) ) { logger::warn!( ?error, "payment_attempts missing for payment_id : {:?}", pi.payment_id, ); return None; } Some(Err(error)) } } } }); //If any of the response are Err, we will get Result<Err(_)> let pi_pa_tuple_vec: Result<Vec<(storage::PaymentIntent, storage::PaymentAttempt)>, _> = join_all(collected_futures) .await .into_iter() .flatten() //Will ignore `None`, will only flatten 1 level .collect::<Result<Vec<(storage::PaymentIntent, storage::PaymentAttempt)>, _>>(); //Will collect responses in same order async, leading to sorted responses //Converting Intent-Attempt array to Response if no error let data: Vec<api::PaymentsResponse> = pi_pa_tuple_vec .change_context(errors::ApiErrorResponse::InternalServerError)? .into_iter() .map(ForeignFrom::foreign_from) .collect(); Ok(services::ApplicationResponse::Json( api::PaymentListResponse { size: data.len(), data, }, )) } #[cfg(all(feature = "v2", feature = "olap"))] pub async fn list_payments( state: SessionState, merchant_context: domain::MerchantContext,
crates/router/src/core/payments.rs#chunk6
router
chunk
8,191
null
null
null
null
null
null
null
null
null
null
null
null
null
pub async fn list_customer_payment_method( state: &routes::SessionState, merchant_context: domain::MerchantContext, payment_intent: Option<storage::PaymentIntent>, customer_id: &id_type::CustomerId, limit: Option<i64>, ) -> errors::RouterResponse<api::CustomerPaymentMethodsListResponse> { let db = &*state.store; let key_manager_state = &state.into(); let off_session_payment_flag = payment_intent .as_ref() .map(|pi| { matches!( pi.setup_future_usage, Some(common_enums::FutureUsage::OffSession) ) }) .unwrap_or(false); let customer = db .find_customer_by_customer_id_merchant_id( &state.into(), customer_id, merchant_context.get_merchant_account().get_id(), merchant_context.get_merchant_key_store(), merchant_context.get_merchant_account().storage_scheme, ) .await .to_not_found_response(errors::ApiErrorResponse::CustomerNotFound)?; let is_requires_cvv = db .find_config_by_key_unwrap_or( &merchant_context .get_merchant_account() .get_id() .get_requires_cvv_key(), Some("true".to_string()), ) .await .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable("Failed to fetch requires_cvv config")?; let requires_cvv = is_requires_cvv.config != "false"; let resp = db .find_payment_method_by_customer_id_merchant_id_status( &(state.into()), merchant_context.get_merchant_key_store(), customer_id, merchant_context.get_merchant_account().get_id(), common_enums::PaymentMethodStatus::Active, limit, merchant_context.get_merchant_account().storage_scheme, ) .await .to_not_found_response(errors::ApiErrorResponse::PaymentMethodNotFound)?; let mut customer_pms = Vec::new(); let profile_id = payment_intent .as_ref() .map(|payment_intent| { payment_intent .profile_id .clone() .get_required_value("profile_id") .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable("profile_id is not set in payment_intent") }) .transpose()?; let business_profile = core_utils::validate_and_get_business_profile( db, key_manager_state, merchant_context.get_merchant_key_store(), profile_id.as_ref(), merchant_context.get_merchant_account().get_id(), ) .await?; let is_connector_agnostic_mit_enabled = business_profile .as_ref() .and_then(|business_profile| business_profile.is_connector_agnostic_mit_enabled) .unwrap_or(false); for pm in resp.into_iter() { let parent_payment_method_token = generate_id(consts::ID_LENGTH, "token"); let payment_method = pm .get_payment_method_type() .get_required_value("payment_method")?; let pm_list_context = get_pm_list_context( state, &payment_method, merchant_context.get_merchant_key_store(), &pm, Some(parent_payment_method_token.clone()), true, false, &merchant_context, ) .await?; if pm_list_context.is_none() { continue; } let pm_list_context = pm_list_context.get_required_value("PaymentMethodListContext")?; // Retrieve the masked bank details to be sent as a response let bank_details = if payment_method == enums::PaymentMethod::BankDebit { get_masked_bank_details(&pm).await.unwrap_or_else(|error| { logger::error!(?error); None }) } else { None }; let payment_method_billing = pm .payment_method_billing_address .clone() .map(|decrypted_data| decrypted_data.into_inner().expose()) .map(|decrypted_value| decrypted_value.parse_value("payment method billing address")) .transpose() .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable("unable to decrypt payment method billing address details")?; let connector_mandate_details = pm .get_common_mandate_reference() .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable("Failed to deserialize to Payment Mandate Reference ")?; let mca_enabled = get_mca_status( state, merchant_context.get_merchant_key_store(), profile_id.clone(), merchant_context.get_merchant_account().get_id(), is_connector_agnostic_mit_enabled, Some(connector_mandate_details), pm.network_transaction_id.as_ref(), ) .await?; let requires_cvv = if is_connector_agnostic_mit_enabled { requires_cvv && !(off_session_payment_flag && (pm.connector_mandate_details.is_some() || pm.network_transaction_id.is_some())) } else { requires_cvv && !(off_session_payment_flag && pm.connector_mandate_details.is_some()) }; // Need validation for enabled payment method ,querying MCA let pma = api::CustomerPaymentMethod { payment_token: parent_payment_method_token.to_owned(), payment_method_id: pm.payment_method_id.clone(), customer_id: pm.customer_id.clone(), payment_method, payment_method_type: pm.get_payment_method_subtype(), payment_method_issuer: pm.payment_method_issuer, card: pm_list_context.card_details, metadata: pm.metadata, payment_method_issuer_code: pm.payment_method_issuer_code, recurring_enabled: mca_enabled, installment_payment_enabled: Some(false), payment_experience: Some(vec![api_models::enums::PaymentExperience::RedirectToUrl]), created: Some(pm.created_at), #[cfg(feature = "payouts")] bank_transfer: pm_list_context.bank_transfer_details, bank: bank_details, surcharge_details: None, requires_cvv, last_used_at: Some(pm.last_used_at), default_payment_method_set: customer.default_payment_method_id.is_some() && customer.default_payment_method_id == Some(pm.payment_method_id), billing: payment_method_billing, }; if requires_cvv || mca_enabled.unwrap_or(false) { customer_pms.push(pma.to_owned()); } let redis_conn = state .store .get_redis_conn() .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable("Failed to get redis connection")?; let intent_fulfillment_time = business_profile .as_ref() .and_then(|b_profile| b_profile.get_order_fulfillment_time()) .unwrap_or(consts::DEFAULT_INTENT_FULFILLMENT_TIME); let hyperswitch_token_data = pm_list_context .hyperswitch_token_data .get_required_value("PaymentTokenData")?; ParentPaymentMethodToken::create_key_for_token(( &parent_payment_method_token, pma.payment_method, )) .insert(intent_fulfillment_time, hyperswitch_token_data, state) .await?; if let Some(metadata) = pma.metadata { let pm_metadata_vec: payment_methods::PaymentMethodMetadata = metadata .parse_value("PaymentMethodMetadata") .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable( "Failed to deserialize metadata to PaymentmethodMetadata struct", )?; for pm_metadata in pm_metadata_vec.payment_method_tokenization { let key = format!( "pm_token_{}_{}_{}", parent_payment_method_token, pma.payment_method, pm_metadata.0 ); redis_conn .set_key_with_expiry(&key.into(), pm_metadata.1, intent_fulfillment_time) .await .change_context(errors::StorageError::KVError) .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable("Failed to add data in redis")?; } } } let mut response = api::CustomerPaymentMethodsListResponse { customer_payment_methods: customer_pms, is_guest_customer: payment_intent.as_ref().map(|_| false), //to return this key only when the request is tied to a payment intent }; Box::pin(perform_surcharge_ops( payment_intent, state, merchant_context, business_profile, &mut response, )) .await?; Ok(services::ApplicationResponse::Json(response)) }
crates/router/src/core/payment_methods/cards.rs
router
function_signature
1,807
rust
null
null
null
null
list_customer_payment_method
null
null
null
null
null
null
null
pub struct Address { pub city: Option<String>, pub country: Option<common_enums::CountryAlpha2>, pub line1: Option<Secret<String>>, pub line2: Option<Secret<String>>, pub line3: Option<Secret<String>>, pub post_code: Option<Secret<String>>, pub state: Option<Secret<String>>, }
crates/hyperswitch_connectors/src/connectors/unified_authentication_service/transformers.rs
hyperswitch_connectors
struct_definition
75
rust
Address
null
null
null
null
null
null
null
null
null
null
null
impl ConnectorResponse { #[instrument(skip(conn))] pub async fn update( self, conn: &PgPooledConn, connector_response: ConnectorResponseUpdate, ) -> StorageResult<Self> { let payment_attempt_update = match connector_response.clone() { ConnectorResponseUpdate::ResponseUpdate { connector_transaction_id, authentication_data, encoded_data, connector_name, charge_id, updated_by, } => PaymentAttemptUpdate::ConnectorResponse { authentication_data, encoded_data, connector_transaction_id, connector: connector_name, charge_id, updated_by, }, ConnectorResponseUpdate::ErrorUpdate { connector_name, updated_by, } => PaymentAttemptUpdate::ConnectorResponse { authentication_data: None, encoded_data: None, connector_transaction_id: None, connector: connector_name, charge_id: None, updated_by, }, }; let _payment_attempt: Result<PaymentAttempt, _> = generics::generic_update_with_unique_predicate_get_result::< <PaymentAttempt as HasTable>::Table, _, _, _, >( conn, pa_dsl::attempt_id .eq(self.attempt_id.to_owned()) .and(pa_dsl::merchant_id.eq(self.merchant_id.to_owned())), PaymentAttemptUpdateInternal::from(payment_attempt_update), ) .await .inspect_err(|err| { logger::error!( "Error while updating payment attempt in connector_response flow {:?}", err ); }); let connector_response_result = match generics::generic_update_with_unique_predicate_get_result::< <Self as HasTable>::Table, _, _, _, >( conn, dsl::merchant_id .eq(self.merchant_id.clone()) .and(dsl::payment_id.eq(self.payment_id.clone())) .and(dsl::attempt_id.eq(self.attempt_id.clone())), ConnectorResponseUpdateInternal::from(connector_response), ) .await { Err(error) => match error.current_context() { errors::DatabaseError::NoFieldsToUpdate => Ok(self), _ => Err(error), }, result => result, }; connector_response_result } #[instrument(skip(conn))] pub async fn find_by_payment_id_merchant_id_attempt_id( conn: &PgPooledConn, payment_id: &common_utils::id_type::PaymentId, merchant_id: &common_utils::id_type::MerchantId, attempt_id: &str, ) -> StorageResult<Self> { let connector_response: Self = generics::generic_find_one::<<Self as HasTable>::Table, _, _>( conn, dsl::merchant_id.eq(merchant_id.to_owned()).and( dsl::payment_id .eq(payment_id.to_owned()) .and(dsl::attempt_id.eq(attempt_id.to_owned())), ), ) .await?; match generics::generic_find_one::<<PaymentAttempt as HasTable>::Table, _, _>( conn, pa_dsl::payment_id.eq(payment_id.to_owned()).and( pa_dsl::merchant_id .eq(merchant_id.to_owned()) .and(pa_dsl::attempt_id.eq(attempt_id.to_owned())), ), ) .await { Ok::<PaymentAttempt, _>(payment_attempt) => { if payment_attempt.authentication_data != connector_response.authentication_data { logger::error!( "Not Equal pa_authentication_data : {:?}, cr_authentication_data: {:?} ", payment_attempt.authentication_data, connector_response.authentication_data ); } if payment_attempt.encoded_data != connector_response.encoded_data { logger::error!( "Not Equal pa_encoded_data : {:?}, cr_encoded_data: {:?} ", payment_attempt.encoded_data, connector_response.encoded_data ); } if payment_attempt.connector_transaction_id != connector_response.connector_transaction_id { logger::error!( "Not Equal pa_connector_transaction_id : {:?}, cr_connector_transaction_id: {:?} ", payment_attempt.connector_transaction_id, connector_response.connector_transaction_id ); } if payment_attempt.connector != connector_response.connector_name { logger::error!( "Not Equal pa_connector : {:?}, cr_connector_name: {:?} ", payment_attempt.connector, connector_response.connector_name ); } } Err(err) => { logger::error!( "Error while finding payment attempt in connector_response flow {:?}", err ); } } Ok(connector_response) } }
crates/diesel_models/src/query/connector_response.rs
diesel_models
impl_block
994
rust
null
ConnectorResponse
null
impl ConnectorResponse
null
null
null
null
null
null
null
null
impl api::RefundExecute for Xendit {}
crates/hyperswitch_connectors/src/connectors/xendit.rs
hyperswitch_connectors
impl_block
11
rust
null
Xendit
api::RefundExecute for
impl api::RefundExecute for for Xendit
null
null
null
null
null
null
null
null
pub fn get_surcharge_amount(&self) -> Option<MinorUnit> { self.surcharge_amount }
crates/hyperswitch_domain_models/src/payments/payment_attempt.rs
hyperswitch_domain_models
function_signature
25
rust
null
null
null
null
get_surcharge_amount
null
null
null
null
null
null
null
pub struct TransactionEvent { pub id: String, pub amount: MinorUnit, pub created: String, pub currency: Currency, pub fee: Option<i64>, pub fee_refunded: Option<MinorUnit>, pub reference_id: Option<String>, #[serde(rename = "type")] pub event_type: AffirmEventType, pub settlement_transaction_id: Option<String>, pub transaction_id: String, pub order_id: String, pub shipping_carrier: Option<String>, pub shipping_confirmation: Option<String>, pub shipping: Option<Shipping>, pub agent_alias: Option<String>, pub merchant_transaction_id: Option<String>, }
crates/hyperswitch_connectors/src/connectors/affirm/transformers.rs
hyperswitch_connectors
struct_definition
141
rust
TransactionEvent
null
null
null
null
null
null
null
null
null
null
null
File: crates/diesel_models/src/user.rs Public structs: 3 use common_utils::{encryption::Encryption, pii, types::user::LineageContext}; use diesel::{AsChangeset, Identifiable, Insertable, Queryable, Selectable}; use masking::Secret; use time::PrimitiveDateTime; use crate::{diesel_impl::OptionalDieselArray, enums::TotpStatus, schema::users}; pub mod dashboard_metadata; pub mod sample_data; pub mod theme; #[derive(Clone, Debug, Identifiable, Queryable, Selectable)] #[diesel(table_name = users, primary_key(user_id), check_for_backend(diesel::pg::Pg))] pub struct User { pub user_id: String, pub email: pii::Email, pub name: Secret<String>, pub password: Option<Secret<String>>, pub is_verified: bool, pub created_at: PrimitiveDateTime, pub last_modified_at: PrimitiveDateTime, pub totp_status: TotpStatus, pub totp_secret: Option<Encryption>, #[diesel(deserialize_as = OptionalDieselArray<Secret<String>>)] pub totp_recovery_codes: Option<Vec<Secret<String>>>, pub last_password_modified_at: Option<PrimitiveDateTime>, pub lineage_context: Option<LineageContext>, } #[derive( router_derive::Setter, Clone, Debug, Default, Insertable, router_derive::DebugAsDisplay, )] #[diesel(table_name = users)] pub struct UserNew { pub user_id: String, pub email: pii::Email, pub name: Secret<String>, pub password: Option<Secret<String>>, pub is_verified: bool, pub created_at: Option<PrimitiveDateTime>, pub last_modified_at: Option<PrimitiveDateTime>, pub totp_status: TotpStatus, pub totp_secret: Option<Encryption>, pub totp_recovery_codes: Option<Vec<Secret<String>>>, pub last_password_modified_at: Option<PrimitiveDateTime>, pub lineage_context: Option<LineageContext>, } #[derive(Clone, Debug, AsChangeset, router_derive::DebugAsDisplay)] #[diesel(table_name = users)] pub struct UserUpdateInternal { name: Option<String>, password: Option<Secret<String>>, is_verified: Option<bool>, last_modified_at: PrimitiveDateTime, totp_status: Option<TotpStatus>, totp_secret: Option<Encryption>, totp_recovery_codes: Option<Vec<Secret<String>>>, last_password_modified_at: Option<PrimitiveDateTime>, lineage_context: Option<LineageContext>, } #[derive(Debug)] pub enum UserUpdate { VerifyUser, AccountUpdate { name: Option<String>, is_verified: Option<bool>, }, TotpUpdate { totp_status: Option<TotpStatus>, totp_secret: Option<Encryption>, totp_recovery_codes: Option<Vec<Secret<String>>>, }, PasswordUpdate { password: Secret<String>, }, LineageContextUpdate { lineage_context: LineageContext, }, } impl From<UserUpdate> for UserUpdateInternal { fn from(user_update: UserUpdate) -> Self { let last_modified_at = common_utils::date_time::now(); match user_update { UserUpdate::VerifyUser => Self { name: None, password: None, is_verified: Some(true), last_modified_at, totp_status: None, totp_secret: None, totp_recovery_codes: None, last_password_modified_at: None, lineage_context: None, }, UserUpdate::AccountUpdate { name, is_verified } => Self { name, password: None, is_verified, last_modified_at, totp_status: None, totp_secret: None, totp_recovery_codes: None, last_password_modified_at: None, lineage_context: None, }, UserUpdate::TotpUpdate { totp_status, totp_secret, totp_recovery_codes, } => Self { name: None, password: None, is_verified: None, last_modified_at, totp_status, totp_secret, totp_recovery_codes, last_password_modified_at: None, lineage_context: None, }, UserUpdate::PasswordUpdate { password } => Self { name: None, password: Some(password), is_verified: None, last_modified_at, last_password_modified_at: Some(last_modified_at), totp_status: None, totp_secret: None, totp_recovery_codes: None, lineage_context: None, }, UserUpdate::LineageContextUpdate { lineage_context } => Self { name: None, password: None, is_verified: None, last_modified_at, last_password_modified_at: None, totp_status: None, totp_secret: None, totp_recovery_codes: None, lineage_context: Some(lineage_context), }, } } }
crates/diesel_models/src/user.rs
diesel_models
full_file
1,064
null
null
null
null
null
null
null
null
null
null
null
null
null
pub struct Amount { total_amount: StringMajorUnit, currency: api_models::enums::Currency, }
crates/hyperswitch_connectors/src/connectors/wellsfargo/transformers.rs
hyperswitch_connectors
struct_definition
23
rust
Amount
null
null
null
null
null
null
null
null
null
null
null
pub struct DeutschebankAccessTokenRequest { pub grant_type: String, pub client_id: Secret<String>, pub client_secret: Secret<String>, pub scope: String, }
crates/hyperswitch_connectors/src/connectors/deutschebank/transformers.rs
hyperswitch_connectors
struct_definition
37
rust
DeutschebankAccessTokenRequest
null
null
null
null
null
null
null
null
null
null
null
impl api::MandateSetup for Cybersource {}
crates/hyperswitch_connectors/src/connectors/cybersource.rs
hyperswitch_connectors
impl_block
12
rust
null
Cybersource
api::MandateSetup for
impl api::MandateSetup for for Cybersource
null
null
null
null
null
null
null
null
pub struct BamboraapacRouterData<T> { pub amount: MinorUnit, pub router_data: T, }
crates/hyperswitch_connectors/src/connectors/bamboraapac/transformers.rs
hyperswitch_connectors
struct_definition
27
rust
BamboraapacRouterData
null
null
null
null
null
null
null
null
null
null
null
pub struct BluesnapVoidRequest { card_transaction_type: BluesnapTxnType, transaction_id: String, }
crates/hyperswitch_connectors/src/connectors/bluesnap/transformers.rs
hyperswitch_connectors
struct_definition
25
rust
BluesnapVoidRequest
null
null
null
null
null
null
null
null
null
null
null
pub struct EntityTypeQueryParam { pub entity_type: EntityType, }
crates/api_models/src/user/theme.rs
api_models
struct_definition
13
rust
EntityTypeQueryParam
null
null
null
null
null
null
null
null
null
null
null
pub struct CybersourceConnectorMetadataObject { pub disable_avs: Option<bool>, pub disable_cvn: Option<bool>, }
crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs
hyperswitch_connectors
struct_definition
28
rust
CybersourceConnectorMetadataObject
null
null
null
null
null
null
null
null
null
null
null
pub struct PaysafeAuthType { pub(super) username: Secret<String>, pub(super) password: Secret<String>, }
crates/hyperswitch_connectors/src/connectors/paysafe/transformers.rs
hyperswitch_connectors
struct_definition
26
rust
PaysafeAuthType
null
null
null
null
null
null
null
null
null
null
null
impl ConnectorSpecifications for Payeezy { fn get_connector_about(&self) -> Option<&'static ConnectorInfo> { Some(&PAYEEZY_CONNECTOR_INFO) } fn get_supported_payment_methods(&self) -> Option<&'static SupportedPaymentMethods> { Some(&*PAYEEZY_SUPPORTED_PAYMENT_METHODS) } fn get_supported_webhook_flows(&self) -> Option<&'static [enums::EventClass]> { Some(&PAYEEZY_SUPPORTED_WEBHOOK_FLOWS) } }
crates/hyperswitch_connectors/src/connectors/payeezy.rs
hyperswitch_connectors
impl_block
109
rust
null
Payeezy
ConnectorSpecifications for
impl ConnectorSpecifications for for Payeezy
null
null
null
null
null
null
null
null
File: crates/hyperswitch_domain_models/src/router_flow_types/fraud_check.rs Public structs: 5 #[derive(Debug, Clone)] pub struct Sale; #[derive(Debug, Clone)] pub struct Checkout; #[derive(Debug, Clone)] pub struct Transaction; #[derive(Debug, Clone)] pub struct Fulfillment; #[derive(Debug, Clone)] pub struct RecordReturn;
crates/hyperswitch_domain_models/src/router_flow_types/fraud_check.rs
hyperswitch_domain_models
full_file
77
null
null
null
null
null
null
null
null
null
null
null
null
null
/// Panics if `json_payload` array does not contain one `GetPaymentIntentMetricRequest` element. pub async fn get_org_payment_intent_metrics( state: web::Data<AppState>, req: actix_web::HttpRequest, json_payload: web::Json<[GetPaymentIntentMetricRequest; 1]>, ) -> impl Responder { // safety: This shouldn't panic owing to the data type #[allow(clippy::expect_used)] let payload = json_payload .into_inner() .to_vec() .pop() .expect("Couldn't get GetPaymentIntentMetricRequest"); let flow = AnalyticsFlow::GetPaymentIntentMetrics; Box::pin(api::server_wrap( flow, state, &req, payload, |state, auth: AuthenticationData, req, _| async move { let org_id = auth.merchant_account.get_org_id(); let auth: AuthInfo = AuthInfo::OrgLevel { org_id: org_id.clone(), }; let validator_response = request_validator( AnalyticsRequest { payment_intent: Some(req.clone()), ..Default::default() }, &state, ) .await?; let ex_rates = validator_response; analytics::payment_intents::get_metrics(&state.pool, &ex_rates, &auth, req) .await .map(ApplicationResponse::Json) }, auth::auth_type( &auth::PlatformOrgAdminAuth { is_admin_auth_allowed: false, organization_id: None, }, &auth::JWTAuth { permission: Permission::OrganizationAnalyticsRead, }, req.headers(), ), api_locking::LockAction::NotApplicable, )) .await }
crates/router/src/analytics.rs
router
function_signature
374
rust
null
null
null
null
get_org_payment_intent_metrics
null
null
null
null
null
null
null
pub struct WiseRecipientCreateRequest { currency: String, #[serde(rename = "type")] recipient_type: RecipientType, profile: Secret<String>, account_holder_name: Secret<String>, details: WiseBankDetails, }
crates/hyperswitch_connectors/src/connectors/wise/transformers.rs
hyperswitch_connectors
struct_definition
50
rust
WiseRecipientCreateRequest
null
null
null
null
null
null
null
null
null
null
null
pub async fn refund_retrieve( state: web::Data<routes::AppState>, req: HttpRequest, path: web::Path<String>, ) -> HttpResponse { let refund_request = refund_types::RefundsRetrieveRequest { refund_id: path.into_inner(), force_sync: Some(true), merchant_connector_details: None, }; let flow = Flow::RefundsRetrieveForceSync; Box::pin(wrap::compatibility_api_wrap::< _, _, _, _, _, types::StripeRefundResponse, errors::StripeErrorCode, _, >( flow, state.into_inner(), &req, refund_request, |state, auth: auth::AuthenticationData, refund_request, _| { let merchant_context = domain::MerchantContext::NormalMerchant(Box::new( domain::Context(auth.merchant_account, auth.key_store), )); refunds::refund_response_wrapper( state, merchant_context, None, refund_request, refunds::refund_retrieve_core_with_refund_id, ) }, &auth::HeaderAuth(auth::ApiKeyAuth { is_connected_allowed: false, is_platform_allowed: false, }), api_locking::LockAction::NotApplicable, )) .await }
crates/router/src/compatibility/stripe/refunds.rs
router
function_signature
278
rust
null
null
null
null
refund_retrieve
null
null
null
null
null
null
null
impl api::RefundExecute for Checkout {}
crates/hyperswitch_connectors/src/connectors/checkout.rs
hyperswitch_connectors
impl_block
9
rust
null
Checkout
api::RefundExecute for
impl api::RefundExecute for for Checkout
null
null
null
null
null
null
null
null
impl RefundExecute for Signifyd {}
crates/hyperswitch_connectors/src/connectors/signifyd.rs
hyperswitch_connectors
impl_block
9
rust
null
Signifyd
RefundExecute for
impl RefundExecute for for Signifyd
null
null
null
null
null
null
null
null
impl PaymentAuthorize for Threedsecureio {}
crates/hyperswitch_connectors/src/connectors/threedsecureio.rs
hyperswitch_connectors
impl_block
9
rust
null
Threedsecureio
PaymentAuthorize for
impl PaymentAuthorize for for Threedsecureio
null
null
null
null
null
null
null
null
impl MerchantAccount { #[cfg(feature = "v1")] /// Get the unique identifier of MerchantAccount pub fn get_id(&self) -> &common_utils::id_type::MerchantId { &self.merchant_id } #[cfg(feature = "v2")] pub fn get_id(&self) -> &common_utils::id_type::MerchantId { &self.id } }
crates/diesel_models/src/merchant_account.rs
diesel_models
impl_block
87
rust
null
MerchantAccount
null
impl MerchantAccount
null
null
null
null
null
null
null
null
pub fn set_three_d_s_cres(mut self, cres: String) -> Self { self.cres = Some(cres); self }
crates/hyperswitch_connectors/src/connectors/redsys/transformers.rs
hyperswitch_connectors
function_signature
32
rust
null
null
null
null
set_three_d_s_cres
null
null
null
null
null
null
null
pub struct RefundErrorDetails { pub code: String, pub message: String, }
crates/api_models/src/refunds.rs
api_models
struct_definition
20
rust
RefundErrorDetails
null
null
null
null
null
null
null
null
null
null
null
impl AddressNew { pub async fn insert(self, conn: &PgPooledConn) -> StorageResult<Address> { generics::generic_insert(conn, self).await } }
crates/diesel_models/src/query/address.rs
diesel_models
impl_block
39
rust
null
AddressNew
null
impl AddressNew
null
null
null
null
null
null
null
null
impl RedisConnInterface for KafkaStore { fn get_redis_conn(&self) -> CustomResult<Arc<RedisConnectionPool>, RedisError> { self.diesel_store.get_redis_conn() } }
crates/router/src/db/kafka_store.rs
router
impl_block
42
rust
null
KafkaStore
RedisConnInterface for
impl RedisConnInterface for for KafkaStore
null
null
null
null
null
null
null
null
pub fn build_refund_update_for_rsync( connector: &api::ConnectorData, merchant_context: &domain::MerchantContext, router_data_response: RouterData<api::RSync, types::RefundsData, types::RefundsResponseData>, ) -> diesel_refund::RefundUpdate { let merchant_account = merchant_context.get_merchant_account(); let storage_scheme = &merchant_context.get_merchant_account().storage_scheme; match router_data_response.response { Err(error_message) => { let refund_status = match error_message.status_code { // marking failure for 2xx because this is genuine refund failure 200..=299 => Some(enums::RefundStatus::Failure), _ => None, }; let refund_error_message = error_message.reason.or(Some(error_message.message)); let refund_error_code = Some(error_message.code); diesel_refund::RefundUpdate::build_error_update_for_refund_failure( refund_status, refund_error_message, refund_error_code, storage_scheme, ) } Ok(response) => match router_data_response.integrity_check.clone() { Err(err) => { metrics::INTEGRITY_CHECK_FAILED.add( 1, router_env::metric_attributes!( ("connector", connector.connector_name.to_string()), ("merchant_id", merchant_account.get_id().clone()), ), ); let connector_refund_id = err .connector_transaction_id .map(common_utils_types::ConnectorTransactionId::from); diesel_refund::RefundUpdate::build_error_update_for_integrity_check_failure( err.field_names, connector_refund_id, storage_scheme, ) } Ok(()) => { let connector_refund_id = common_utils_types::ConnectorTransactionId::from(response.connector_refund_id); diesel_refund::RefundUpdate::build_refund_update( connector_refund_id, response.refund_status, storage_scheme, ) } }, } }
crates/router/src/core/refunds_v2.rs
router
function_signature
427
rust
null
null
null
null
build_refund_update_for_rsync
null
null
null
null
null
null
null
pub fn get_refund_metrics_info() -> Vec<NameDescription> { RefundMetrics::iter().map(Into::into).collect() }
crates/analytics/src/utils.rs
analytics
function_signature
31
rust
null
null
null
null
get_refund_metrics_info
null
null
null
null
null
null
null
impl WorldpayPaymentsRequestData for RouterData<Authorize, PaymentsAuthorizeData, PaymentsResponseData> { fn get_return_url(&self) -> Result<String, error_stack::Report<errors::ConnectorError>> { self.request.get_complete_authorize_url() } fn get_auth_type(&self) -> &enums::AuthenticationType { &self.auth_type } fn get_browser_info(&self) -> Option<&BrowserInformation> { self.request.browser_info.as_ref() } fn get_payment_method_data(&self) -> &PaymentMethodData { &self.request.payment_method_data } fn get_setup_future_usage(&self) -> Option<enums::FutureUsage> { self.request.setup_future_usage } fn get_off_session(&self) -> Option<bool> { self.request.off_session } fn get_mandate_id(&self) -> Option<MandateIds> { self.request.mandate_id.clone() } fn get_currency(&self) -> enums::Currency { self.request.currency } fn get_optional_billing_address(&self) -> Option<&address::Address> { self.get_optional_billing() } fn get_connector_meta_data(&self) -> Option<&pii::SecretSerdeValue> { self.connector_meta_data.as_ref() } fn get_payment_method(&self) -> enums::PaymentMethod { self.payment_method } fn get_payment_method_type(&self) -> Option<enums::PaymentMethodType> { self.request.payment_method_type } fn get_connector_request_reference_id(&self) -> String { self.connector_request_reference_id.clone() } fn get_is_mandate_payment(&self) -> bool { self.request.is_mandate_payment() } fn get_settlement_info(&self, amount: i64) -> Option<AutoSettlement> { match (self.request.capture_method.unwrap_or_default(), amount) { (_, 0) => None, (enums::CaptureMethod::Automatic, _) | (enums::CaptureMethod::SequentialAutomatic, _) => Some(AutoSettlement { auto: true }), (enums::CaptureMethod::Manual, _) | (enums::CaptureMethod::ManualMultiple, _) => { Some(AutoSettlement { auto: false }) } _ => None, } } }
crates/hyperswitch_connectors/src/connectors/worldpay/transformers.rs
hyperswitch_connectors
impl_block
503
rust
null
RouterData
WorldpayPaymentsRequestData for
impl WorldpayPaymentsRequestData for for RouterData
null
null
null
null
null
null
null
null
pub struct NestedErrorStack<'a> { context: std::borrow::Cow<'a, str>, attachments: Vec<std::borrow::Cow<'a, str>>, sources: Vec<NestedErrorStack<'a>>, }
crates/router/src/core/errors.rs
router
struct_definition
49
rust
NestedErrorStack
null
null
null
null
null
null
null
null
null
null
null