text
stringlengths
65
57.3k
file_path
stringlengths
22
92
module
stringclasses
38 values
type
stringclasses
7 values
struct_name
stringlengths
3
60
impl_count
int64
0
60
traits
listlengths
0
59
tokens
int64
16
8.19k
function_name
stringlengths
3
85
type_name
stringlengths
1
67
trait_name
stringclasses
573 values
method_count
int64
0
31
public_method_count
int64
0
19
submodule_count
int64
0
56
export_count
int64
0
9
// Implementation: impl ConnectorCommon for for Opennode // File: crates/hyperswitch_connectors/src/connectors/opennode.rs // Module: hyperswitch_connectors // Methods: 6 total (0 public) impl ConnectorCommon for for Opennode
crates/hyperswitch_connectors/src/connectors/opennode.rs
hyperswitch_connectors
impl_block
null
null
null
55
null
Opennode
ConnectorCommon for
6
0
null
null
// Struct: PowertranzAddressDetails // File: crates/hyperswitch_connectors/src/connectors/powertranz/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct PowertranzAddressDetails
crates/hyperswitch_connectors/src/connectors/powertranz/transformers.rs
hyperswitch_connectors
struct_definition
PowertranzAddressDetails
0
[]
52
null
null
null
null
null
null
null
// Implementation: impl ForexMetric for for PaymentIntentMetrics // File: crates/api_models/src/analytics/payment_intents.rs // Module: api_models // Methods: 1 total (0 public) impl ForexMetric for for PaymentIntentMetrics
crates/api_models/src/analytics/payment_intents.rs
api_models
impl_block
null
null
null
50
null
PaymentIntentMetrics
ForexMetric for
1
0
null
null
// Implementation: impl CommonMandateReference // File: crates/diesel_models/src/payment_method.rs // Module: diesel_models // Methods: 2 total (2 public) impl CommonMandateReference
crates/diesel_models/src/payment_method.rs
diesel_models
impl_block
null
null
null
44
null
CommonMandateReference
null
2
2
null
null
// Struct: DynamicRoutingStatsNew // File: crates/diesel_models/src/dynamic_routing_stats.rs // Module: diesel_models // Implementations: 0 pub struct DynamicRoutingStatsNew
crates/diesel_models/src/dynamic_routing_stats.rs
diesel_models
struct_definition
DynamicRoutingStatsNew
0
[]
41
null
null
null
null
null
null
null
// Implementation: impl DynamicRoutingAlgoAccessor for for SuccessBasedAlgorithm // File: crates/api_models/src/routing.rs // Module: api_models // Methods: 2 total (0 public) impl DynamicRoutingAlgoAccessor for for SuccessBasedAlgorithm
crates/api_models/src/routing.rs
api_models
impl_block
null
null
null
53
null
SuccessBasedAlgorithm
DynamicRoutingAlgoAccessor for
2
0
null
null
// Implementation: impl ConnectorCommon for for Payload // File: crates/hyperswitch_connectors/src/connectors/payload.rs // Module: hyperswitch_connectors // Methods: 6 total (0 public) impl ConnectorCommon for for Payload
crates/hyperswitch_connectors/src/connectors/payload.rs
hyperswitch_connectors
impl_block
null
null
null
51
null
Payload
ConnectorCommon for
6
0
null
null
// Implementation: impl Default for for Database // File: crates/storage_impl/src/config.rs // Module: storage_impl // Methods: 1 total (0 public) impl Default for for Database
crates/storage_impl/src/config.rs
storage_impl
impl_block
null
null
null
40
null
Database
Default for
1
0
null
null
// Implementation: impl Responder // File: crates/router/src/analytics.rs // Module: router // Methods: 0 total (0 public) impl Responder
crates/router/src/analytics.rs
router
impl_block
null
null
null
35
null
Responder
null
0
0
null
null
// Function: get_connector_transaction_id_as_string // File: crates/api_models/src/webhooks.rs // Module: api_models pub fn get_connector_transaction_id_as_string( self, ) -> Result<String, common_utils::errors::ValidationError>
crates/api_models/src/webhooks.rs
api_models
function_signature
null
null
null
52
get_connector_transaction_id_as_string
null
null
null
null
null
null
// Function: payment_intents_retrieve_with_gateway_creds // File: crates/router/src/compatibility/stripe/payment_intents.rs // Module: router pub fn payment_intents_retrieve_with_gateway_creds( state: web::Data<routes::AppState>, qs_config: web::Data<serde_qs::Config>, req: HttpRequest, form_payload: web::Bytes, ) -> HttpResponse
crates/router/src/compatibility/stripe/payment_intents.rs
router
function_signature
null
null
null
86
payment_intents_retrieve_with_gateway_creds
null
null
null
null
null
null
// Implementation: impl api::PaymentCapture for for Square // File: crates/hyperswitch_connectors/src/connectors/square.rs // Module: hyperswitch_connectors // Methods: 0 total (0 public) impl api::PaymentCapture for for Square
crates/hyperswitch_connectors/src/connectors/square.rs
hyperswitch_connectors
impl_block
null
null
null
55
null
Square
api::PaymentCapture for
0
0
null
null
// Function: create_organization // File: crates/router/src/core/admin.rs // Module: router pub fn create_organization( state: SessionState, req: api::OrganizationCreateRequest, ) -> RouterResponse<api::OrganizationResponse>
crates/router/src/core/admin.rs
router
function_signature
null
null
null
51
create_organization
null
null
null
null
null
null
// Function: update_by_merchant_id_payout_attempt_id // File: crates/diesel_models/src/query/payout_attempt.rs // Module: diesel_models pub fn update_by_merchant_id_payout_attempt_id( conn: &PgPooledConn, merchant_id: &common_utils::id_type::MerchantId, payout_attempt_id: &str, payout: PayoutAttemptUpdate, ) -> StorageResult<Self>
crates/diesel_models/src/query/payout_attempt.rs
diesel_models
function_signature
null
null
null
91
update_by_merchant_id_payout_attempt_id
null
null
null
null
null
null
// Function: new // File: crates/hyperswitch_connectors/src/connectors/blackhawknetwork.rs // Module: hyperswitch_connectors pub fn new() -> &'static Self
crates/hyperswitch_connectors/src/connectors/blackhawknetwork.rs
hyperswitch_connectors
function_signature
null
null
null
39
new
null
null
null
null
null
null
// Implementation: impl FileUpload for for Worldpayvantiv // File: crates/hyperswitch_connectors/src/connectors/worldpayvantiv.rs // Module: hyperswitch_connectors // Methods: 1 total (0 public) impl FileUpload for for Worldpayvantiv
crates/hyperswitch_connectors/src/connectors/worldpayvantiv.rs
hyperswitch_connectors
impl_block
null
null
null
59
null
Worldpayvantiv
FileUpload for
1
0
null
null
// File: crates/router/src/workflows/outgoing_webhook_retry.rs // Module: router // Public structs: 1 #[cfg(feature = "payouts")] use api_models::payouts as payout_models; use api_models::{ enums::EventType, webhook_events::OutgoingWebhookRequestContent, webhooks::{OutgoingWebhook, OutgoingWebhookContent}, }; use common_utils::{ consts::DEFAULT_LOCALE, ext_traits::{StringExt, ValueExt}, id_type, }; use diesel_models::process_tracker::business_status; use error_stack::ResultExt; use masking::PeekInterface; use router_env::tracing::{self, instrument}; use scheduler::{ consumer::{self, workflows::ProcessTrackerWorkflow}, types::process_data, utils as scheduler_utils, }; #[cfg(feature = "payouts")] use crate::core::payouts; use crate::{ core::{ payments, webhooks::{self as webhooks_core, types::OutgoingWebhookTrackingData}, }, db::StorageInterface, errors, logger, routes::{app::ReqState, SessionState}, types::{domain, storage}, }; pub struct OutgoingWebhookRetryWorkflow; #[async_trait::async_trait] impl ProcessTrackerWorkflow<SessionState> for OutgoingWebhookRetryWorkflow { #[cfg(feature = "v1")] #[instrument(skip_all)] async fn execute_workflow<'a>( &'a self, state: &'a SessionState, process: storage::ProcessTracker, ) -> Result<(), errors::ProcessTrackerError> { let delivery_attempt = storage::enums::WebhookDeliveryAttempt::AutomaticRetry; let tracking_data: OutgoingWebhookTrackingData = process .tracking_data .clone() .parse_value("OutgoingWebhookTrackingData")?; let db = &*state.store; let key_manager_state = &state.into(); let key_store = db .get_merchant_key_store_by_merchant_id( key_manager_state, &tracking_data.merchant_id, &db.get_master_key().to_vec().into(), ) .await?; let business_profile = db .find_business_profile_by_profile_id( key_manager_state, &key_store, &tracking_data.business_profile_id, ) .await?; let event_id = webhooks_core::utils::generate_event_id(); let idempotent_event_id = webhooks_core::utils::get_idempotent_event_id( &tracking_data.primary_object_id, tracking_data.event_type, delivery_attempt, ) .change_context(errors::ApiErrorResponse::WebhookProcessingFailure) .attach_printable("Failed to generate idempotent event ID")?; let initial_event = match &tracking_data.initial_attempt_id { Some(initial_attempt_id) => { db.find_event_by_merchant_id_event_id( key_manager_state, &business_profile.merchant_id, initial_attempt_id, &key_store, ) .await? } // Tracking data inserted by old version of application, fetch event using old event ID // format None => { let old_event_id = format!( "{}_{}", tracking_data.primary_object_id, tracking_data.event_type ); db.find_event_by_merchant_id_event_id( key_manager_state, &business_profile.merchant_id, &old_event_id, &key_store, ) .await? } }; let now = common_utils::date_time::now(); let new_event = domain::Event { event_id, event_type: initial_event.event_type, event_class: initial_event.event_class, is_webhook_notified: false, primary_object_id: initial_event.primary_object_id, primary_object_type: initial_event.primary_object_type, created_at: now, merchant_id: Some(business_profile.merchant_id.clone()), business_profile_id: Some(business_profile.get_id().to_owned()), primary_object_created_at: initial_event.primary_object_created_at, idempotent_event_id: Some(idempotent_event_id), initial_attempt_id: Some(initial_event.event_id.clone()), request: initial_event.request, response: None, delivery_attempt: Some(delivery_attempt), metadata: initial_event.metadata, is_overall_delivery_successful: Some(false), }; let event = db .insert_event(key_manager_state, new_event, &key_store) .await .inspect_err(|error| { logger::error!(?error, "Failed to insert event in events table"); })?; match &event.request { Some(request) => { let request_content: OutgoingWebhookRequestContent = request .get_inner() .peek() .parse_struct("OutgoingWebhookRequestContent")?; Box::pin(webhooks_core::trigger_webhook_and_raise_event( state.clone(), business_profile, &key_store, event, request_content, delivery_attempt, None, Some(process), )) .await; } // Event inserted by old version of application, fetch current information about // resource None => { let merchant_account = db .find_merchant_account_by_merchant_id( key_manager_state, &tracking_data.merchant_id, &key_store, ) .await?; let merchant_context = domain::MerchantContext::NormalMerchant(Box::new( domain::Context(merchant_account.clone(), key_store.clone()), )); // TODO: Add request state for the PT flows as well let (content, event_type) = Box::pin(get_outgoing_webhook_content_and_event_type( state.clone(), state.get_req_state(), merchant_account.clone(), key_store.clone(), &tracking_data, )) .await?; match event_type { // Resource status is same as the event type of the current event Some(event_type) if event_type == tracking_data.event_type => { let outgoing_webhook = OutgoingWebhook { merchant_id: tracking_data.merchant_id.clone(), event_id: event.event_id.clone(), event_type, content: content.clone(), timestamp: event.created_at, }; let request_content = webhooks_core::get_outgoing_webhook_request( &merchant_context, outgoing_webhook, &business_profile, ) .map_err(|error| { logger::error!( ?error, "Failed to obtain outgoing webhook request content" ); errors::ProcessTrackerError::EApiErrorResponse })?; Box::pin(webhooks_core::trigger_webhook_and_raise_event( state.clone(), business_profile, &key_store, event, request_content, delivery_attempt, Some(content), Some(process), )) .await; } // Resource status has changed since the event was created, finish task _ => { logger::warn!( %event.event_id, "The current status of the resource `{:?}` (event type: {:?}) and the status of \ the resource when the event was created (event type: {:?}) differ, finishing task", tracking_data.primary_object_id, event_type, tracking_data.event_type ); db.as_scheduler() .finish_process_with_business_status( process.clone(), business_status::RESOURCE_STATUS_MISMATCH, ) .await?; } } } }; Ok(()) } #[cfg(feature = "v2")] async fn execute_workflow<'a>( &'a self, _state: &'a SessionState, _process: storage::ProcessTracker, ) -> Result<(), errors::ProcessTrackerError> { todo!() } #[instrument(skip_all)] async fn error_handler<'a>( &'a self, state: &'a SessionState, process: storage::ProcessTracker, error: errors::ProcessTrackerError, ) -> errors::CustomResult<(), errors::ProcessTrackerError> { consumer::consumer_error_handler(state.store.as_scheduler(), process, error).await } } /// Get the schedule time for the specified retry count. /// /// The schedule time can be configured in configs with this key: `pt_mapping_outgoing_webhooks`. /// /// ```json /// { /// "default_mapping": { /// "start_after": 60, /// "frequency": [300], /// "count": [5] /// }, /// "custom_merchant_mapping": { /// "merchant_id1": { /// "start_after": 30, /// "frequency": [300], /// "count": [2] /// } /// } /// } /// ``` /// /// This configuration value represents: /// - `default_mapping.start_after`: The first retry attempt should happen after 60 seconds by /// default. /// - `default_mapping.frequency` and `count`: The next 5 retries should have an interval of 300 /// seconds between them by default. /// - `custom_merchant_mapping.merchant_id1`: Merchant-specific retry configuration for merchant /// with merchant ID `merchant_id1`. #[cfg(feature = "v1")] #[instrument(skip_all)] pub(crate) async fn get_webhook_delivery_retry_schedule_time( db: &dyn StorageInterface, merchant_id: &id_type::MerchantId, retry_count: i32, ) -> Option<time::PrimitiveDateTime> { let key = "pt_mapping_outgoing_webhooks"; let result = db .find_config_by_key(key) .await .map(|value| value.config) .and_then(|config| { config .parse_struct("OutgoingWebhookRetryProcessTrackerMapping") .change_context(errors::StorageError::DeserializationFailed) }); let mapping = result.map_or_else( |error| { if error.current_context().is_db_not_found() { logger::debug!("Outgoing webhooks retry config `{key}` not found, ignoring"); } else { logger::error!( ?error, "Failed to read outgoing webhooks retry config `{key}`" ); } process_data::OutgoingWebhookRetryProcessTrackerMapping::default() }, |mapping| { logger::debug!(?mapping, "Using custom outgoing webhooks retry config"); mapping }, ); let time_delta = scheduler_utils::get_outgoing_webhook_retry_schedule_time( mapping, merchant_id, retry_count, ); scheduler_utils::get_time_from_delta(time_delta) } /// Schedule the webhook delivery task for retry #[cfg(feature = "v1")] #[instrument(skip_all)] pub(crate) async fn retry_webhook_delivery_task( db: &dyn StorageInterface, merchant_id: &id_type::MerchantId, process: storage::ProcessTracker, ) -> errors::CustomResult<(), errors::StorageError> { let schedule_time = get_webhook_delivery_retry_schedule_time(db, merchant_id, process.retry_count + 1).await; match schedule_time { Some(schedule_time) => { db.as_scheduler() .retry_process(process, schedule_time) .await } None => { db.as_scheduler() .finish_process_with_business_status(process, business_status::RETRIES_EXCEEDED) .await } } } #[cfg(feature = "v1")] #[instrument(skip_all)] async fn get_outgoing_webhook_content_and_event_type( state: SessionState, req_state: ReqState, merchant_account: domain::MerchantAccount, key_store: domain::MerchantKeyStore, tracking_data: &OutgoingWebhookTrackingData, ) -> Result<(OutgoingWebhookContent, Option<EventType>), errors::ProcessTrackerError> { use api_models::{ disputes::DisputeRetrieveRequest, mandates::MandateId, payments::{PaymentIdType, PaymentsResponse, PaymentsRetrieveRequest}, refunds::{RefundResponse, RefundsRetrieveRequest}, }; use crate::{ core::{ disputes::retrieve_dispute, mandate::get_mandate, payments::{payments_core, CallConnectorAction, PaymentStatus}, refunds::refund_retrieve_core_with_refund_id, }, services::{ApplicationResponse, AuthFlow}, types::{api::PSync, transformers::ForeignFrom}, }; let merchant_context = domain::MerchantContext::NormalMerchant(Box::new(domain::Context( merchant_account.clone(), key_store.clone(), ))); match tracking_data.event_class { diesel_models::enums::EventClass::Payments => { let payment_id = tracking_data.primary_object_id.clone(); let payment_id = id_type::PaymentId::try_from(std::borrow::Cow::Owned(payment_id)) .map_err(|payment_id_parsing_error| { logger::error!( ?payment_id_parsing_error, "Failed to parse payment ID from tracking data" ); errors::ProcessTrackerError::DeserializationFailed })?; let request = PaymentsRetrieveRequest { resource_id: PaymentIdType::PaymentIntentId(payment_id), merchant_id: Some(tracking_data.merchant_id.clone()), force_sync: false, ..Default::default() }; let payments_response = match Box::pin(payments_core::< PSync, PaymentsResponse, _, _, _, payments::PaymentData<PSync>, >( state, req_state, merchant_context.clone(), None, PaymentStatus, request, AuthFlow::Client, CallConnectorAction::Avoid, None, hyperswitch_domain_models::payments::HeaderPayload::default(), )) .await? { ApplicationResponse::Json(payments_response) | ApplicationResponse::JsonWithHeaders((payments_response, _)) => { Ok(payments_response) } ApplicationResponse::StatusOk | ApplicationResponse::TextPlain(_) | ApplicationResponse::JsonForRedirection(_) | ApplicationResponse::Form(_) | ApplicationResponse::GenericLinkForm(_) | ApplicationResponse::PaymentLinkForm(_) | ApplicationResponse::FileData(_) => { Err(errors::ProcessTrackerError::ResourceFetchingFailed { resource_name: tracking_data.primary_object_id.clone(), }) } }?; let event_type: Option<EventType> = payments_response.status.into(); logger::debug!(current_resource_status=%payments_response.status); Ok(( OutgoingWebhookContent::PaymentDetails(Box::new(payments_response)), event_type, )) } diesel_models::enums::EventClass::Refunds => { let refund_id = tracking_data.primary_object_id.clone(); let request = RefundsRetrieveRequest { refund_id, force_sync: Some(false), merchant_connector_details: None, }; let refund = Box::pin(refund_retrieve_core_with_refund_id( state, merchant_context.clone(), None, request, )) .await?; let event_type: Option<EventType> = refund.refund_status.into(); logger::debug!(current_resource_status=%refund.refund_status); let refund_response = RefundResponse::foreign_from(refund); Ok(( OutgoingWebhookContent::RefundDetails(Box::new(refund_response)), event_type, )) } diesel_models::enums::EventClass::Disputes => { let dispute_id = tracking_data.primary_object_id.clone(); let request = DisputeRetrieveRequest { dispute_id, force_sync: None, }; let dispute_response = match Box::pin(retrieve_dispute( state, merchant_context.clone(), None, request, )) .await? { ApplicationResponse::Json(dispute_response) | ApplicationResponse::JsonWithHeaders((dispute_response, _)) => { Ok(dispute_response) } ApplicationResponse::StatusOk | ApplicationResponse::TextPlain(_) | ApplicationResponse::JsonForRedirection(_) | ApplicationResponse::Form(_) | ApplicationResponse::GenericLinkForm(_) | ApplicationResponse::PaymentLinkForm(_) | ApplicationResponse::FileData(_) => { Err(errors::ProcessTrackerError::ResourceFetchingFailed { resource_name: tracking_data.primary_object_id.clone(), }) } } .map(Box::new)?; let event_type = Some(EventType::from(dispute_response.dispute_status)); logger::debug!(current_resource_status=%dispute_response.dispute_status); Ok(( OutgoingWebhookContent::DisputeDetails(dispute_response), event_type, )) } diesel_models::enums::EventClass::Mandates => { let mandate_id = tracking_data.primary_object_id.clone(); let request = MandateId { mandate_id }; let mandate_response = match get_mandate(state, merchant_context.clone(), request).await? { ApplicationResponse::Json(mandate_response) | ApplicationResponse::JsonWithHeaders((mandate_response, _)) => { Ok(mandate_response) } ApplicationResponse::StatusOk | ApplicationResponse::TextPlain(_) | ApplicationResponse::JsonForRedirection(_) | ApplicationResponse::Form(_) | ApplicationResponse::GenericLinkForm(_) | ApplicationResponse::PaymentLinkForm(_) | ApplicationResponse::FileData(_) => { Err(errors::ProcessTrackerError::ResourceFetchingFailed { resource_name: tracking_data.primary_object_id.clone(), }) } } .map(Box::new)?; let event_type: Option<EventType> = mandate_response.status.into(); logger::debug!(current_resource_status=%mandate_response.status); Ok(( OutgoingWebhookContent::MandateDetails(mandate_response), event_type, )) } #[cfg(feature = "payouts")] diesel_models::enums::EventClass::Payouts => { let payout_id = tracking_data.primary_object_id.clone(); let request = payout_models::PayoutRequest::PayoutActionRequest( payout_models::PayoutActionRequest { payout_id: id_type::PayoutId::try_from(std::borrow::Cow::Owned(payout_id))?, }, ); let payout_data = Box::pin(payouts::make_payout_data( &state, &merchant_context, None, &request, DEFAULT_LOCALE, )) .await?; let payout_create_response = payouts::response_handler(&state, &merchant_context, &payout_data).await?; let event_type: Option<EventType> = payout_data.payout_attempt.status.into(); logger::debug!(current_resource_status=%payout_data.payout_attempt.status); Ok(( OutgoingWebhookContent::PayoutDetails(Box::new(payout_create_response)), event_type, )) } } }
crates/router/src/workflows/outgoing_webhook_retry.rs
router
full_file
null
null
null
4,049
null
null
null
null
null
null
null
// File: crates/diesel_models/src/blocklist_lookup.rs // Module: diesel_models // Public structs: 2 use diesel::{Identifiable, Insertable, Queryable, Selectable}; use serde::{Deserialize, Serialize}; use crate::schema::blocklist_lookup; #[derive(Default, Clone, Debug, Eq, Insertable, PartialEq, Serialize, Deserialize)] #[diesel(table_name = blocklist_lookup)] pub struct BlocklistLookupNew { pub merchant_id: common_utils::id_type::MerchantId, pub fingerprint: String, } #[derive( Default, Clone, Debug, Eq, PartialEq, Identifiable, Queryable, Selectable, Deserialize, Serialize, )] #[diesel(table_name = blocklist_lookup, primary_key(merchant_id, fingerprint), check_for_backend(diesel::pg::Pg))] pub struct BlocklistLookup { pub merchant_id: common_utils::id_type::MerchantId, pub fingerprint: String, }
crates/diesel_models/src/blocklist_lookup.rs
diesel_models
full_file
null
null
null
206
null
null
null
null
null
null
null
// Struct: BamboraRefundRequest // File: crates/hyperswitch_connectors/src/connectors/bambora/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct BamboraRefundRequest
crates/hyperswitch_connectors/src/connectors/bambora/transformers.rs
hyperswitch_connectors
struct_definition
BamboraRefundRequest
0
[]
54
null
null
null
null
null
null
null
// Function: generate_jwt // File: crates/router/src/types/domain/user/decision_manager.rs // Module: router pub fn generate_jwt( self, state: &SessionState, next_flow: &NextFlow, user_role: &UserRole, ) -> UserResult<Secret<String>>
crates/router/src/types/domain/user/decision_manager.rs
router
function_signature
null
null
null
64
generate_jwt
null
null
null
null
null
null
// Function: get_payment_filter_for_dimension // File: crates/analytics/src/payments/filters.rs // Module: analytics pub fn get_payment_filter_for_dimension<T>( dimension: PaymentDimensions, auth: &AuthInfo, time_range: &TimeRange, pool: &T, ) -> FiltersResult<Vec<PaymentFilterRow>> where T: AnalyticsDataSource + PaymentFilterAnalytics, PrimitiveDateTime: ToSql<T>, AnalyticsCollection: ToSql<T>, Granularity: GroupByClause<T>, Aggregate<&'static str>: ToSql<T>, Window<&'static str>: ToSql<T>,
crates/analytics/src/payments/filters.rs
analytics
function_signature
null
null
null
132
get_payment_filter_for_dimension
null
null
null
null
null
null
// Function: verify_recon_token // File: crates/router/src/core/recon.rs // Module: router pub fn verify_recon_token( state: SessionState, user_with_role: authentication::UserFromTokenWithRoleInfo, ) -> UserResponse<recon_api::VerifyTokenResponse>
crates/router/src/core/recon.rs
router
function_signature
null
null
null
64
verify_recon_token
null
null
null
null
null
null
// Struct: ListInvitationForUserResponse // File: crates/api_models/src/user_role.rs // Module: api_models // Implementations: 0 pub struct ListInvitationForUserResponse
crates/api_models/src/user_role.rs
api_models
struct_definition
ListInvitationForUserResponse
0
[]
42
null
null
null
null
null
null
null
// Struct: ReferencesResponse // File: crates/hyperswitch_connectors/src/connectors/trustpay/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct ReferencesResponse
crates/hyperswitch_connectors/src/connectors/trustpay/transformers.rs
hyperswitch_connectors
struct_definition
ReferencesResponse
0
[]
46
null
null
null
null
null
null
null
// Function: proxy_for_payments_operation_core // File: crates/router/src/core/payments.rs // Module: router pub fn proxy_for_payments_operation_core<F, Req, Op, FData, D>( state: &SessionState, req_state: ReqState, merchant_context: domain::MerchantContext, profile: domain::Profile, operation: Op, req: Req, get_tracker_response: operations::GetTrackerResponse<D>, call_connector_action: CallConnectorAction, header_payload: HeaderPayload, return_raw_connector_response: Option<bool>, ) -> RouterResult<(D, Req, Option<u16>, Option<u128>)> where F: Send + Clone + Sync, Req: Send + Sync + Authenticate, Op: Operation<F, Req, Data = D> + Send + Sync, D: OperationSessionGetters<F> + OperationSessionSetters<F> + Send + Sync + Clone, // To create connector flow specific interface data D: ConstructFlowSpecificData<F, FData, router_types::PaymentsResponseData>, RouterData<F, FData, router_types::PaymentsResponseData>: Feature<F, FData>, // To construct connector flow specific api dyn api::Connector: services::api::ConnectorIntegration<F, FData, router_types::PaymentsResponseData>, RouterData<F, FData, router_types::PaymentsResponseData>: hyperswitch_domain_models::router_data::TrackerPostUpdateObjects<F, FData, D>, // To perform router related operation for PaymentResponse PaymentResponse: Operation<F, FData, Data = D>, FData: Send + Sync + Clone,
crates/router/src/core/payments.rs
router
function_signature
null
null
null
359
proxy_for_payments_operation_core
null
null
null
null
null
null
// Function: refund_filter_list // File: crates/router/src/core/refunds.rs // Module: router pub fn refund_filter_list( state: SessionState, merchant_context: domain::MerchantContext, req: common_utils::types::TimeRange, ) -> RouterResponse<api_models::refunds::RefundListMetaData>
crates/router/src/core/refunds.rs
router
function_signature
null
null
null
71
refund_filter_list
null
null
null
null
null
null
// Struct: HyperswitchVaultCustomerCreateResponse // File: crates/hyperswitch_connectors/src/connectors/hyperswitch_vault/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct HyperswitchVaultCustomerCreateResponse
crates/hyperswitch_connectors/src/connectors/hyperswitch_vault/transformers.rs
hyperswitch_connectors
struct_definition
HyperswitchVaultCustomerCreateResponse
0
[]
59
null
null
null
null
null
null
null
// Struct: CycleCheck // File: crates/hyperswitch_constraint_graph/src/types.rs // Module: hyperswitch_constraint_graph // Implementations: 4 // Traits: Default, Deref, DerefMut pub struct CycleCheck
crates/hyperswitch_constraint_graph/src/types.rs
hyperswitch_constraint_graph
struct_definition
CycleCheck
4
[ "Default", "Deref", "DerefMut" ]
51
null
null
null
null
null
null
null
specific_features: None, }, ); adyen_supported_payment_methods.add( enums::PaymentMethod::GiftCard, PaymentMethodType::Givex, PaymentMethodDetails { mandates: enums::FeatureStatus::NotSupported, refunds: enums::FeatureStatus::Supported, supported_capture_methods: supported_capture_methods2.clone(), specific_features: None, }, ); adyen_supported_payment_methods }); static ADYEN_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { display_name: "Adyen", description: "Adyen is a Dutch payment company with the status of an acquiring bank that allows businesses to accept e-commerce, mobile, and point-of-sale payments. It is listed on the stock exchange Euronext Amsterdam", connector_type: enums::HyperswitchConnectorCategory::PaymentGateway, integration_status: enums::ConnectorIntegrationStatus::Live, }; static ADYEN_SUPPORTED_WEBHOOK_FLOWS: &[enums::EventClass] = &[ enums::EventClass::Payments, enums::EventClass::Refunds, enums::EventClass::Disputes, #[cfg(feature = "payouts")] enums::EventClass::Payouts, enums::EventClass::Mandates, ]; impl ConnectorSpecifications for Adyen { fn get_connector_about(&self) -> Option<&'static ConnectorInfo> { Some(&ADYEN_CONNECTOR_INFO) } fn get_supported_payment_methods(&self) -> Option<&'static SupportedPaymentMethods> { Some(&*ADYEN_SUPPORTED_PAYMENT_METHODS) } fn get_supported_webhook_flows(&self) -> Option<&'static [enums::EventClass]> { Some(ADYEN_SUPPORTED_WEBHOOK_FLOWS) } }
crates/hyperswitch_connectors/src/connectors/adyen.rs#chunk3
hyperswitch_connectors
chunk
null
null
null
380
null
null
null
null
null
null
null
// Function: get_filters_for_payments // File: crates/diesel_models/src/query/payment_attempt.rs // Module: diesel_models pub fn get_filters_for_payments( conn: &PgPooledConn, pi: &[PaymentIntent], merchant_id: &common_utils::id_type::MerchantId, ) -> StorageResult<( Vec<String>, Vec<enums::Currency>, Vec<IntentStatus>, Vec<enums::PaymentMethod>, Vec<enums::PaymentMethodType>, Vec<enums::AuthenticationType>, )>
crates/diesel_models/src/query/payment_attempt.rs
diesel_models
function_signature
null
null
null
116
get_filters_for_payments
null
null
null
null
null
null
// Function: payouts_fulfill_core // File: crates/router/src/core/payouts.rs // Module: router pub fn payouts_fulfill_core( state: SessionState, merchant_context: domain::MerchantContext, req: payouts::PayoutActionRequest, ) -> RouterResponse<payouts::PayoutCreateResponse>
crates/router/src/core/payouts.rs
router
function_signature
null
null
null
70
payouts_fulfill_core
null
null
null
null
null
null
// Struct: RevenueRecoveryData // File: crates/hyperswitch_domain_models/src/payments.rs // Module: hyperswitch_domain_models // Implementations: 0 pub struct RevenueRecoveryData
crates/hyperswitch_domain_models/src/payments.rs
hyperswitch_domain_models
struct_definition
RevenueRecoveryData
0
[]
44
null
null
null
null
null
null
null
// Implementation: impl PaymentSync for for Worldline // File: crates/hyperswitch_connectors/src/connectors/worldline.rs // Module: hyperswitch_connectors // Methods: 0 total (0 public) impl PaymentSync for for Worldline
crates/hyperswitch_connectors/src/connectors/worldline.rs
hyperswitch_connectors
impl_block
null
null
null
53
null
Worldline
PaymentSync for
0
0
null
null
// Implementation: impl api::PaymentAuthorize for for Opayo // File: crates/hyperswitch_connectors/src/connectors/opayo.rs // Module: hyperswitch_connectors // Methods: 0 total (0 public) impl api::PaymentAuthorize for for Opayo
crates/hyperswitch_connectors/src/connectors/opayo.rs
hyperswitch_connectors
impl_block
null
null
null
57
null
Opayo
api::PaymentAuthorize for
0
0
null
null
// Struct: ThreeDsDecisionRuleExecuteResponse // File: crates/api_models/src/three_ds_decision_rule.rs // Module: api_models // Implementations: 1 // Traits: common_utils::events::ApiEventMetric pub struct ThreeDsDecisionRuleExecuteResponse
crates/api_models/src/three_ds_decision_rule.rs
api_models
struct_definition
ThreeDsDecisionRuleExecuteResponse
1
[ "common_utils::events::ApiEventMetric" ]
57
null
null
null
null
null
null
null
// Implementation: impl ConnectorValidation for for Fiservemea // File: crates/hyperswitch_connectors/src/connectors/fiservemea.rs // Module: hyperswitch_connectors // Methods: 0 total (0 public) impl ConnectorValidation for for Fiservemea
crates/hyperswitch_connectors/src/connectors/fiservemea.rs
hyperswitch_connectors
impl_block
null
null
null
62
null
Fiservemea
ConnectorValidation for
0
0
null
null
// Struct: HelcimVerifyRequest // File: crates/hyperswitch_connectors/src/connectors/helcim/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct HelcimVerifyRequest
crates/hyperswitch_connectors/src/connectors/helcim/transformers.rs
hyperswitch_connectors
struct_definition
HelcimVerifyRequest
0
[]
53
null
null
null
null
null
null
null
// Function: merchant_account_list // File: crates/router/src/routes/admin.rs // Module: router pub fn merchant_account_list( state: web::Data<AppState>, req: HttpRequest, query_params: web::Query<api_models::admin::MerchantAccountListRequest>, ) -> HttpResponse
crates/router/src/routes/admin.rs
router
function_signature
null
null
null
63
merchant_account_list
null
null
null
null
null
null
// Implementation: impl Capture // File: crates/diesel_models/src/query/capture.rs // Module: diesel_models // Methods: 3 total (0 public) impl Capture
crates/diesel_models/src/query/capture.rs
diesel_models
impl_block
null
null
null
37
null
Capture
null
3
0
null
null
// Function: get_payment_update_enabled_for_client_auth_key // File: crates/common_utils/src/id_type/merchant.rs // Module: common_utils // Documentation: allow payment update via client auth default should be false pub fn get_payment_update_enabled_for_client_auth_key(&self) -> String
crates/common_utils/src/id_type/merchant.rs
common_utils
function_signature
null
null
null
60
get_payment_update_enabled_for_client_auth_key
null
null
null
null
null
null
// Function: get_filter_type_clause // File: crates/analytics/src/query.rs // Module: analytics pub fn get_filter_type_clause(&self) -> Option<String>
crates/analytics/src/query.rs
analytics
function_signature
null
null
null
36
get_filter_type_clause
null
null
null
null
null
null
// Function: get_authorization_info_with_groups // File: crates/router/src/core/user_role.rs // Module: router pub fn get_authorization_info_with_groups( _state: SessionState, ) -> UserResponse<user_role_api::AuthorizationInfoResponse>
crates/router/src/core/user_role.rs
router
function_signature
null
null
null
55
get_authorization_info_with_groups
null
null
null
null
null
null
// Implementation: impl common_utils::events::ApiEventMetric for for CardNetworkTokenizeResponse // File: crates/api_models/src/payment_methods.rs // Module: api_models // Methods: 0 total (0 public) impl common_utils::events::ApiEventMetric for for CardNetworkTokenizeResponse
crates/api_models/src/payment_methods.rs
api_models
impl_block
null
null
null
63
null
CardNetworkTokenizeResponse
common_utils::events::ApiEventMetric for
0
0
null
null
// Function: new // File: crates/hyperswitch_connectors/src/connectors/mifinity.rs // Module: hyperswitch_connectors pub fn new() -> &'static Self
crates/hyperswitch_connectors/src/connectors/mifinity.rs
hyperswitch_connectors
function_signature
null
null
null
39
new
null
null
null
null
null
null
// Struct: SdkEventMetricsBucketIdentifier // File: crates/api_models/src/analytics/sdk_events.rs // Module: api_models // Implementations: 3 // Traits: Hash, PartialEq pub struct SdkEventMetricsBucketIdentifier
crates/api_models/src/analytics/sdk_events.rs
api_models
struct_definition
SdkEventMetricsBucketIdentifier
3
[ "Hash", "PartialEq" ]
51
null
null
null
null
null
null
null
// Implementation: impl SurchargeMetadata // File: crates/router/src/core/payments/types.rs // Module: router // Methods: 10 total (8 public) impl SurchargeMetadata
crates/router/src/core/payments/types.rs
router
impl_block
null
null
null
40
null
SurchargeMetadata
null
10
8
null
null
// Implementation: impl MerchantId // File: crates/router/src/types/domain/user.rs // Module: router // Methods: 2 total (2 public) impl MerchantId
crates/router/src/types/domain/user.rs
router
impl_block
null
null
null
36
null
MerchantId
null
2
2
null
null
// Struct: RefundResponse // File: crates/hyperswitch_connectors/src/connectors/juspaythreedsserver/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct RefundResponse
crates/hyperswitch_connectors/src/connectors/juspaythreedsserver/transformers.rs
hyperswitch_connectors
struct_definition
RefundResponse
0
[]
52
null
null
null
null
null
null
null
)) } fn handle_response( &self, data: &PaymentsIncrementalAuthorizationRouterData, event_builder: Option<&mut ConnectorEvent>, res: Response, ) -> CustomResult< RouterData< IncrementalAuthorization, PaymentsIncrementalAuthorizationData, PaymentsResponseData, >, errors::ConnectorError, > { let response: cybersource::CybersourcePaymentsIncrementalAuthorizationResponse = res .response .parse_struct("Cybersource PaymentResponse") .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; event_builder.map(|i| i.set_response_body(&response)); router_env::logger::info!(connector_response=?response); RouterData::try_from(ResponseRouterData { response, data: data.clone(), http_code: res.status_code, }) .change_context(errors::ConnectorError::ResponseHandlingFailed) } fn get_error_response( &self, res: Response, event_builder: Option<&mut ConnectorEvent>, ) -> CustomResult<ErrorResponse, errors::ConnectorError> { self.build_error_response(res, event_builder) } } #[async_trait::async_trait] impl webhooks::IncomingWebhook for Cybersource { fn get_webhook_object_reference_id( &self, _request: &webhooks::IncomingWebhookRequestDetails<'_>, ) -> CustomResult<api_models::webhooks::ObjectReferenceId, errors::ConnectorError> { Err(report!(errors::ConnectorError::WebhooksNotImplemented)) } fn get_webhook_event_type( &self, _request: &webhooks::IncomingWebhookRequestDetails<'_>, ) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> { Ok(api_models::webhooks::IncomingWebhookEvent::EventNotSupported) } fn get_webhook_resource_object( &self, _request: &webhooks::IncomingWebhookRequestDetails<'_>, ) -> CustomResult<Box<dyn masking::ErasedMaskSerialize>, errors::ConnectorError> { Err(report!(errors::ConnectorError::WebhooksNotImplemented)) } } static CYBERSOURCE_SUPPORTED_PAYMENT_METHODS: LazyLock<SupportedPaymentMethods> = LazyLock::new(|| { let supported_capture_methods = vec![ enums::CaptureMethod::Automatic, enums::CaptureMethod::Manual, enums::CaptureMethod::SequentialAutomatic, ]; let supported_card_network = vec![ common_enums::CardNetwork::Visa, common_enums::CardNetwork::Mastercard, common_enums::CardNetwork::AmericanExpress, common_enums::CardNetwork::JCB, common_enums::CardNetwork::DinersClub, common_enums::CardNetwork::Discover, common_enums::CardNetwork::Visa, common_enums::CardNetwork::CartesBancaires, common_enums::CardNetwork::UnionPay, common_enums::CardNetwork::Maestro, ]; let mut cybersource_supported_payment_methods = SupportedPaymentMethods::new(); cybersource_supported_payment_methods.add( enums::PaymentMethod::Card, enums::PaymentMethodType::Credit, PaymentMethodDetails { mandates: enums::FeatureStatus::Supported, refunds: enums::FeatureStatus::Supported, supported_capture_methods: supported_capture_methods.clone(), specific_features: Some( api_models::feature_matrix::PaymentMethodSpecificFeatures::Card({ api_models::feature_matrix::CardSpecificFeatures { three_ds: common_enums::FeatureStatus::Supported, no_three_ds: common_enums::FeatureStatus::Supported, supported_card_networks: supported_card_network.clone(), } }), ), }, ); cybersource_supported_payment_methods.add( enums::PaymentMethod::Card, enums::PaymentMethodType::Debit, PaymentMethodDetails { mandates: enums::FeatureStatus::Supported, refunds: enums::FeatureStatus::Supported, supported_capture_methods: supported_capture_methods.clone(), specific_features: Some( api_models::feature_matrix::PaymentMethodSpecificFeatures::Card({ api_models::feature_matrix::CardSpecificFeatures { three_ds: common_enums::FeatureStatus::Supported, no_three_ds: common_enums::FeatureStatus::Supported, supported_card_networks: supported_card_network.clone(), } }), ), }, ); cybersource_supported_payment_methods.add( enums::PaymentMethod::Wallet, enums::PaymentMethodType::ApplePay, PaymentMethodDetails { mandates: enums::FeatureStatus::Supported, refunds: enums::FeatureStatus::Supported, supported_capture_methods: supported_capture_methods.clone(), specific_features: None, }, ); cybersource_supported_payment_methods.add( enums::PaymentMethod::Wallet, enums::PaymentMethodType::GooglePay, PaymentMethodDetails { mandates: enums::FeatureStatus::Supported, refunds: enums::FeatureStatus::Supported, supported_capture_methods: supported_capture_methods.clone(), specific_features: None, }, ); cybersource_supported_payment_methods.add( enums::PaymentMethod::Wallet, enums::PaymentMethodType::Paze, PaymentMethodDetails { mandates: enums::FeatureStatus::Supported, refunds: enums::FeatureStatus::Supported, supported_capture_methods: supported_capture_methods.clone(), specific_features: None, }, ); cybersource_supported_payment_methods.add( enums::PaymentMethod::Wallet, enums::PaymentMethodType::SamsungPay, PaymentMethodDetails { mandates: enums::FeatureStatus::Supported, refunds: enums::FeatureStatus::Supported, supported_capture_methods: supported_capture_methods.clone(), specific_features: None, }, ); cybersource_supported_payment_methods }); static CYBERSOURCE_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { display_name: "Cybersource", description: "Cybersource provides payments, fraud protection, integrations, and support to help businesses grow with a digital-first approach.", connector_type: enums::HyperswitchConnectorCategory::PaymentGateway, integration_status: enums::ConnectorIntegrationStatus::Live, }; static CYBERSOURCE_SUPPORTED_WEBHOOK_FLOWS: [common_enums::EventClass; 0] = []; impl ConnectorSpecifications for Cybersource { fn get_connector_about(&self) -> Option<&'static ConnectorInfo> { Some(&CYBERSOURCE_CONNECTOR_INFO) } fn get_supported_payment_methods(&self) -> Option<&'static SupportedPaymentMethods> { Some(&*CYBERSOURCE_SUPPORTED_PAYMENT_METHODS) } fn get_supported_webhook_flows(&self) -> Option<&'static [enums::EventClass]> { Some(&CYBERSOURCE_SUPPORTED_WEBHOOK_FLOWS) } }
crates/hyperswitch_connectors/src/connectors/cybersource.rs#chunk2
hyperswitch_connectors
chunk
null
null
null
1,479
null
null
null
null
null
null
null
// Function: send_request_to_key_service_for_merchant // File: crates/router/src/core/encryption.rs // Module: router pub fn send_request_to_key_service_for_merchant( state: &SessionState, keys: Vec<MerchantKeyStore>, ) -> errors::CustomResult<usize, errors::ApiErrorResponse>
crates/router/src/core/encryption.rs
router
function_signature
null
null
null
68
send_request_to_key_service_for_merchant
null
null
null
null
null
null
// Implementation: impl api::PaymentToken for for Bluesnap // File: crates/hyperswitch_connectors/src/connectors/bluesnap.rs // Module: hyperswitch_connectors // Methods: 0 total (0 public) impl api::PaymentToken for for Bluesnap
crates/hyperswitch_connectors/src/connectors/bluesnap.rs
hyperswitch_connectors
impl_block
null
null
null
58
null
Bluesnap
api::PaymentToken for
0
0
null
null
// Struct: PazeWalletData // File: crates/hyperswitch_domain_models/src/payment_method_data.rs // Module: hyperswitch_domain_models // Implementations: 0 pub struct PazeWalletData
crates/hyperswitch_domain_models/src/payment_method_data.rs
hyperswitch_domain_models
struct_definition
PazeWalletData
0
[]
45
null
null
null
null
null
null
null
// Struct: StripeSplitRefundRequest // File: crates/common_types/src/refunds.rs // Module: common_types // Implementations: 0 // Documentation: Charge specific fields for controlling the revert of funds from either platform or connected account for Stripe. Check sub-fields for more details. pub struct StripeSplitRefundRequest
crates/common_types/src/refunds.rs
common_types
struct_definition
StripeSplitRefundRequest
0
[]
68
null
null
null
null
null
null
null
// Struct: NovalnetRefundSyncResponse // File: crates/hyperswitch_connectors/src/connectors/novalnet/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct NovalnetRefundSyncResponse
crates/hyperswitch_connectors/src/connectors/novalnet/transformers.rs
hyperswitch_connectors
struct_definition
NovalnetRefundSyncResponse
0
[]
56
null
null
null
null
null
null
null
// Function: get_extended_card_info // File: crates/router/src/core/payments.rs // Module: router pub fn get_extended_card_info( state: SessionState, merchant_id: id_type::MerchantId, payment_id: id_type::PaymentId, ) -> RouterResponse<payments_api::ExtendedCardInfoResponse>
crates/router/src/core/payments.rs
router
function_signature
null
null
null
71
get_extended_card_info
null
null
null
null
null
null
// Implementation: impl super::behaviour::Conversion for for Relay // File: crates/hyperswitch_domain_models/src/relay.rs // Module: hyperswitch_domain_models // Methods: 3 total (0 public) impl super::behaviour::Conversion for for Relay
crates/hyperswitch_domain_models/src/relay.rs
hyperswitch_domain_models
impl_block
null
null
null
57
null
Relay
super::behaviour::Conversion for
3
0
null
null
// Implementation: impl api::Payment for for Moneris // File: crates/hyperswitch_connectors/src/connectors/moneris.rs // Module: hyperswitch_connectors // Methods: 0 total (0 public) impl api::Payment for for Moneris
crates/hyperswitch_connectors/src/connectors/moneris.rs
hyperswitch_connectors
impl_block
null
null
null
59
null
Moneris
api::Payment for
0
0
null
null
// Implementation: impl common_utils::events::ApiEventMetric for for ProfileAcquirerCreate // File: crates/api_models/src/profile_acquirer.rs // Module: api_models // Methods: 0 total (0 public) impl common_utils::events::ApiEventMetric for for ProfileAcquirerCreate
crates/api_models/src/profile_acquirer.rs
api_models
impl_block
null
null
null
62
null
ProfileAcquirerCreate
common_utils::events::ApiEventMetric for
0
0
null
null
// Function: remove_entry_from_blocklist // File: crates/router/src/routes/blocklist.rs // Module: router pub fn remove_entry_from_blocklist( state: web::Data<AppState>, req: HttpRequest, json_payload: web::Json<api_blocklist::DeleteFromBlocklistRequest>, ) -> HttpResponse
crates/router/src/routes/blocklist.rs
router
function_signature
null
null
null
68
remove_entry_from_blocklist
null
null
null
null
null
null
// Struct: ProcessingInformation // File: crates/hyperswitch_connectors/src/connectors/bankofamerica/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct ProcessingInformation
crates/hyperswitch_connectors/src/connectors/bankofamerica/transformers.rs
hyperswitch_connectors
struct_definition
ProcessingInformation
0
[]
48
null
null
null
null
null
null
null
// Implementation: impl api::PaymentVoid for for Payme // File: crates/hyperswitch_connectors/src/connectors/payme.rs // Module: hyperswitch_connectors // Methods: 0 total (0 public) impl api::PaymentVoid for for Payme
crates/hyperswitch_connectors/src/connectors/payme.rs
hyperswitch_connectors
impl_block
null
null
null
57
null
Payme
api::PaymentVoid for
0
0
null
null
// Struct: ConnectorAuthTypeAndMetadataValidation // File: crates/router/src/core/connector_validation.rs // Module: router // Implementations: 1 pub struct ConnectorAuthTypeAndMetadataValidation<'a>
crates/router/src/core/connector_validation.rs
router
struct_definition
ConnectorAuthTypeAndMetadataValidation
1
[]
45
null
null
null
null
null
null
null
// Implementation: impl api::PaymentAuthorize for for Worldline // File: crates/hyperswitch_connectors/src/connectors/worldline.rs // Module: hyperswitch_connectors // Methods: 0 total (0 public) impl api::PaymentAuthorize for for Worldline
crates/hyperswitch_connectors/src/connectors/worldline.rs
hyperswitch_connectors
impl_block
null
null
null
57
null
Worldline
api::PaymentAuthorize for
0
0
null
null
// Struct: WorldpayErrorResponse // File: crates/hyperswitch_connectors/src/connectors/worldpay/response.rs // Module: hyperswitch_connectors // Implementations: 1 pub struct WorldpayErrorResponse
crates/hyperswitch_connectors/src/connectors/worldpay/response.rs
hyperswitch_connectors
struct_definition
WorldpayErrorResponse
1
[]
45
null
null
null
null
null
null
null
// Struct: DisputeFilterValue // File: crates/api_models/src/analytics.rs // Module: api_models // Implementations: 0 pub struct DisputeFilterValue
crates/api_models/src/analytics.rs
api_models
struct_definition
DisputeFilterValue
0
[]
38
null
null
null
null
null
null
null
// File: crates/hyperswitch_connectors/src/connectors/facilitapay/responses.rs // Module: hyperswitch_connectors // Public structs: 16 use common_utils::{pii, types::StringMajorUnit}; use masking::Secret; use serde::{Deserialize, Serialize}; use super::requests::DocumentType; // Response body for POST /sign_in #[derive(Debug, Deserialize, Serialize)] pub struct FacilitapayAuthResponse { username: Secret<String>, name: Secret<String>, pub jwt: Secret<String>, } #[derive(Debug, Deserialize, Serialize, Clone, PartialEq, Eq)] #[serde(rename_all = "snake_case")] pub enum SubjectKycStatus { // Customer is able to send/receive money through the platform. No action is needed on your side. Approved, // Customer is required to upload documents or uploaded documents have been rejected by KYC. Reproved, // Customer has uploaded KYC documents but awaiting analysis from the backoffice. No action is needed on your side. WaitingApproval, } #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] #[serde(rename_all = "snake_case")] pub struct FacilitapaySubject { pub social_name: Secret<String>, pub document_type: DocumentType, pub document_number: Secret<String>, // In documentation, both CountryAlpha2 and String are used. We cannot rely on CountryAlpha2. pub fiscal_country: String, pub updated_at: Option<String>, pub status: SubjectKycStatus, #[serde(rename = "id")] pub customer_id: Secret<String>, pub birth_date: Option<time::Date>, pub email: Option<pii::Email>, pub phone_country_code: Option<Secret<String>>, pub phone_area_code: Option<Secret<String>>, pub phone_number: Option<Secret<String>>, pub address_street: Option<Secret<String>>, pub address_number: Option<Secret<String>>, pub address_complement: Option<Secret<String>>, pub address_city: Option<String>, pub address_state: Option<String>, pub address_postal_code: Option<Secret<String>>, pub address_country: Option<String>, pub address_neighborhood: Option<Secret<String>>, pub net_monthly_average_income: Option<StringMajorUnit>, pub clearance_level: Option<i32>, pub required_clearance_level: Option<i32>, pub inserted_at: Option<String>, pub references: Option<Vec<serde_json::Value>>, pub rfc_pf: Option<Secret<String>>, // 13-digit RFC, specific to Mexico users pub documents: Option<Vec<serde_json::Value>>, } #[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] #[serde(rename_all = "snake_case")] pub struct FacilitapayCustomerResponse { pub data: FacilitapaySubject, } #[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] pub struct PixInfo { #[serde(rename = "type")] pub key_type: String, pub key: Secret<String>, } #[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] pub struct CreditCardResponseInfo { pub id: String, pub status: Option<String>, pub document_type: String, pub document_number: Secret<String>, pub birthdate: Option<String>, pub phone_country_code: Option<String>, pub phone_area_code: Option<String>, pub phone_number: Option<Secret<String>>, pub inserted_at: Option<String>, } // PaymentsResponse #[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq, Eq)] #[serde(rename_all = "snake_case")] #[derive(strum::Display)] pub enum FacilitapayPaymentStatus { /// Transaction has been created but it is waiting for an incoming TED/Wire. /// This is the first recorded status in production mode. #[default] Pending, /// Incoming TED/Wire has been identified into Facilita´s bank account. /// When it is a deposit into an internal bank account and there is no /// conversion involved (BRL to BRL for instance), that is the final state. Identified, /// The conversion rate has been closed and therefore the exchanged value /// is defined - when it is a deposit into an internal bank account, that is the final state. Exchanged, /// The exchanged value has been wired to its destination (a real bank account) - that is also a final state. Wired, /// When for any reason the transaction cannot be concluded or need to be reversed, it is canceled. #[serde(rename = "canceled")] Cancelled, } #[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] pub struct FacilitapayPaymentsResponse { pub data: TransactionData, } #[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] pub struct OwnerCompany { pub social_name: Option<Secret<String>>, #[serde(rename = "id")] pub company_id: Option<String>, pub document_type: DocumentType, pub document_number: Secret<String>, } #[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] pub struct BankInfo { pub swift: Option<Secret<String>>, pub name: Option<String>, #[serde(rename = "id")] pub bank_id: Secret<String>, pub code: Option<Secret<String>>, } #[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] pub struct BankAccountDetail { pub routing_number: Option<Secret<String>>, pub pix_info: Option<PixInfo>, pub owner_name: Option<Secret<String>>, pub owner_document_type: Option<String>, pub owner_document_number: Option<Secret<String>>, pub owner_company: Option<OwnerCompany>, pub internal: Option<bool>, pub intermediary_bank_account: Option<Secret<String>>, pub intermediary_bank_account_id: Option<Secret<String>>, #[serde(rename = "id")] pub bank_account_id: Secret<String>, pub iban: Option<Secret<String>>, pub flow_type: Option<String>, pub currency: api_models::enums::Currency, pub branch_number: Option<Secret<String>>, pub branch_country: Option<String>, pub bank: Option<BankInfo>, pub account_type: Option<String>, pub account_number: Option<Secret<String>>, pub aba: Option<String>, } #[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] pub struct TransactionData { #[serde(rename = "id")] pub transaction_id: String, pub value: StringMajorUnit, pub status: FacilitapayPaymentStatus, pub currency: api_models::enums::Currency, pub exchange_currency: api_models::enums::Currency, // Details about the destination account (Required) pub to_bank_account: BankAccountDetail, // Details about the source - mutually exclusive pub from_credit_card: Option<CreditCardResponseInfo>, pub from_bank_account: Option<BankAccountDetail>, // Populated for PIX // Subject information (customer) pub subject_id: String, pub subject: Option<FacilitapaySubject>, pub subject_is_receiver: Option<bool>, // Source identification (potentially redundant with subject or card/bank info) pub source_name: Option<Secret<String>>, pub source_document_type: DocumentType, pub source_document_number: Secret<String>, // Timestamps and flags pub inserted_at: Option<String>, pub for_exchange: Option<bool>, pub exchange_under_request: Option<bool>, pub estimated_value_until_exchange: Option<bool>, pub cleared: Option<bool>, // PIX specific field pub dynamic_pix_code: Option<String>, // QR code string for PIX // Exchange details pub exchanged_value: Option<StringMajorUnit>, // Cancelation details #[serde(rename = "canceled_reason")] pub cancelled_reason: Option<String>, #[serde(rename = "canceled_at")] pub cancelled_at: Option<String>, // Other fields pub bank_transaction: Option<Secret<serde_json::Value>>, pub meta: Option<serde_json::Value>, } // Void response structures (for /refund endpoint) #[derive(Debug, Clone, Serialize, Deserialize)] pub struct VoidBankTransaction { #[serde(rename = "id")] pub transaction_id: String, pub value: StringMajorUnit, pub currency: api_models::enums::Currency, pub iof_value: Option<StringMajorUnit>, pub fx_value: Option<StringMajorUnit>, pub exchange_rate: Option<StringMajorUnit>, pub exchange_currency: api_models::enums::Currency, pub exchanged_value: StringMajorUnit, pub exchange_approved: bool, pub wire_id: Option<String>, pub exchange_id: Option<String>, pub movement_date: String, pub source_name: Secret<String>, pub source_document_number: Secret<String>, pub source_document_type: String, pub source_id: String, pub source_type: String, pub source_description: String, pub source_bank: Option<String>, pub source_branch: Option<String>, pub source_account: Option<String>, pub source_bank_ispb: Option<String>, pub company_id: String, pub company_name: String, } #[derive(Debug, Clone, Serialize, Deserialize)] pub struct VoidData { #[serde(rename = "id")] pub void_id: String, pub reason: Option<String>, pub inserted_at: String, pub status: FacilitapayPaymentStatus, pub transaction_kind: String, pub bank_transaction: VoidBankTransaction, } #[derive(Debug, Clone, Serialize, Deserialize)] pub struct FacilitapayVoidResponse { pub data: VoidData, } // Refund response uses the same TransactionData structure as payments #[derive(Debug, Clone, Serialize, Deserialize)] pub struct FacilitapayRefundResponse { pub data: TransactionData, } // Webhook structures #[derive(Debug, Clone, Serialize, Deserialize)] pub struct FacilitapayWebhookNotification { pub notification: FacilitapayWebhookBody, } #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "snake_case")] pub struct FacilitapayWebhookBody { #[serde(rename = "type")] pub event_type: FacilitapayWebhookEventType, pub secret: Secret<String>, #[serde(flatten)] pub data: FacilitapayWebhookData, } #[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] #[serde(rename_all = "snake_case")] pub enum FacilitapayWebhookEventType { ExchangeCreated, Identified, PaymentApproved, PaymentExpired, PaymentFailed, PaymentRefunded, WireCreated, WireWaitingCorrection, } #[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] #[serde(rename_all = "UPPERCASE")] pub enum FacilitapayWebhookErrorCode { /// Creditor account number invalid or missing (branch_number or account_number incorrect) Ac03, /// Creditor account type missing or invalid (account_type incorrect) Ac14, /// Value in Creditor Identifier is incorrect (owner_document_number incorrect) Ch11, /// Transaction type not supported/authorized on this account (account rejected the payment) Ag03, } #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum FacilitapayWebhookData { CardPayment { transaction_id: String, checkout_id: Option<String>, }, Exchange { exchange_id: String, transaction_ids: Vec<String>, }, Transaction { transaction_id: String, }, Wire { wire_id: String, transaction_ids: Vec<String>, }, WireError { error_code: FacilitapayWebhookErrorCode, error_description: String, bank_account_owner_id: String, bank_account_id: String, transaction_ids: Vec<String>, wire_id: String, }, }
crates/hyperswitch_connectors/src/connectors/facilitapay/responses.rs
hyperswitch_connectors
full_file
null
null
null
2,528
null
null
null
null
null
null
null
// Struct: DataResponse // File: crates/hyperswitch_connectors/src/connectors/braintree/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct DataResponse
crates/hyperswitch_connectors/src/connectors/braintree/transformers.rs
hyperswitch_connectors
struct_definition
DataResponse
0
[]
46
null
null
null
null
null
null
null
// Struct: BamboraapacMandateResponse // File: crates/hyperswitch_connectors/src/connectors/bamboraapac/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct BamboraapacMandateResponse
crates/hyperswitch_connectors/src/connectors/bamboraapac/transformers.rs
hyperswitch_connectors
struct_definition
BamboraapacMandateResponse
0
[]
62
null
null
null
null
null
null
null
// File: crates/external_services/src/http_client.rs // Module: external_services // Public functions: 1 use common_utils::{consts, errors::CustomResult, request::Request}; use hyperswitch_interfaces::{errors::HttpClientError, types::Proxy}; use request::{HeaderExt, RequestBuilderExt}; use router_env::{instrument, logger, tracing}; /// client module pub mod client; /// metrics module pub mod metrics; /// request module pub mod request; use std::{error::Error, time::Duration}; use common_utils::request::RequestContent; pub use common_utils::request::{ContentType, Method, RequestBuilder}; use error_stack::ResultExt; #[allow(missing_docs)] #[instrument(skip_all)] pub async fn send_request( client_proxy: &Proxy, request: Request, option_timeout_secs: Option<u64>, ) -> CustomResult<reqwest::Response, HttpClientError> { logger::info!(method=?request.method, headers=?request.headers, payload=?request.body, ?request); let url = url::Url::parse(&request.url).change_context(HttpClientError::UrlParsingFailed)?; let client = client::create_client( client_proxy, request.certificate, request.certificate_key, request.ca_certificate, )?; let headers = request.headers.construct_header_map()?; let metrics_tag = router_env::metric_attributes!(( consts::METRICS_HOST_TAG_NAME, url.host_str().unwrap_or_default().to_owned() )); let request = { match request.method { Method::Get => client.get(url), Method::Post => { let client = client.post(url); match request.body { Some(RequestContent::Json(payload)) => client.json(&payload), Some(RequestContent::FormData(form)) => client.multipart(form), Some(RequestContent::FormUrlEncoded(payload)) => client.form(&payload), Some(RequestContent::Xml(payload)) => { let body = quick_xml::se::to_string(&payload) .change_context(HttpClientError::BodySerializationFailed)?; client.body(body).header("Content-Type", "application/xml") } Some(RequestContent::RawBytes(payload)) => client.body(payload), None => client, } } Method::Put => { let client = client.put(url); match request.body { Some(RequestContent::Json(payload)) => client.json(&payload), Some(RequestContent::FormData(form)) => client.multipart(form), Some(RequestContent::FormUrlEncoded(payload)) => client.form(&payload), Some(RequestContent::Xml(payload)) => { let body = quick_xml::se::to_string(&payload) .change_context(HttpClientError::BodySerializationFailed)?; client.body(body).header("Content-Type", "application/xml") } Some(RequestContent::RawBytes(payload)) => client.body(payload), None => client, } } Method::Patch => { let client = client.patch(url); match request.body { Some(RequestContent::Json(payload)) => client.json(&payload), Some(RequestContent::FormData(form)) => client.multipart(form), Some(RequestContent::FormUrlEncoded(payload)) => client.form(&payload), Some(RequestContent::Xml(payload)) => { let body = quick_xml::se::to_string(&payload) .change_context(HttpClientError::BodySerializationFailed)?; client.body(body).header("Content-Type", "application/xml") } Some(RequestContent::RawBytes(payload)) => client.body(payload), None => client, } } Method::Delete => client.delete(url), } .add_headers(headers) .timeout(Duration::from_secs( option_timeout_secs.unwrap_or(consts::REQUEST_TIME_OUT), )) }; // We cannot clone the request type, because it has Form trait which is not cloneable. So we are cloning the request builder here. let cloned_send_request = request.try_clone().map(|cloned_request| async { cloned_request .send() .await .map_err(|error| match error { error if error.is_timeout() => { metrics::REQUEST_BUILD_FAILURE.add(1, metrics_tag); HttpClientError::RequestTimeoutReceived } error if is_connection_closed_before_message_could_complete(&error) => { metrics::REQUEST_BUILD_FAILURE.add(1, metrics_tag); HttpClientError::ConnectionClosedIncompleteMessage } _ => HttpClientError::RequestNotSent(error.to_string()), }) .attach_printable("Unable to send request to connector") }); let send_request = async { request .send() .await .map_err(|error| match error { error if error.is_timeout() => { metrics::REQUEST_BUILD_FAILURE.add(1, metrics_tag); HttpClientError::RequestTimeoutReceived } error if is_connection_closed_before_message_could_complete(&error) => { metrics::REQUEST_BUILD_FAILURE.add(1, metrics_tag); HttpClientError::ConnectionClosedIncompleteMessage } _ => HttpClientError::RequestNotSent(error.to_string()), }) .attach_printable("Unable to send request to connector") }; let response = common_utils::metrics::utils::record_operation_time( send_request, &metrics::EXTERNAL_REQUEST_TIME, metrics_tag, ) .await; // Retry once if the response is connection closed. // // This is just due to the racy nature of networking. // hyper has a connection pool of idle connections, and it selected one to send your request. // Most of the time, hyper will receive the server’s FIN and drop the dead connection from its pool. // But occasionally, a connection will be selected from the pool // and written to at the same time the server is deciding to close the connection. // Since hyper already wrote some of the request, // it can’t really retry it automatically on a new connection, since the server may have acted already match response { Ok(response) => Ok(response), Err(error) if error.current_context() == &HttpClientError::ConnectionClosedIncompleteMessage => { metrics::AUTO_RETRY_CONNECTION_CLOSED.add(1, metrics_tag); match cloned_send_request { Some(cloned_request) => { logger::info!( "Retrying request due to connection closed before message could complete" ); common_utils::metrics::utils::record_operation_time( cloned_request, &metrics::EXTERNAL_REQUEST_TIME, metrics_tag, ) .await } None => { logger::info!("Retrying request due to connection closed before message could complete failed as request is not cloneable"); Err(error) } } } err @ Err(_) => err, } } fn is_connection_closed_before_message_could_complete(error: &reqwest::Error) -> bool { let mut source = error.source(); while let Some(err) = source { if let Some(hyper_err) = err.downcast_ref::<hyper::Error>() { if hyper_err.is_incomplete_message() { return true; } } source = err.source(); } false }
crates/external_services/src/http_client.rs
external_services
full_file
null
null
null
1,514
null
null
null
null
null
null
null
// Function: check_currency_country_filters // File: crates/router/src/core/payout_link.rs // Module: router pub fn check_currency_country_filters( payout_method_filter: Option<&PaymentMethodFilters>, request_payout_method_type: &api_models::payment_methods::RequestPaymentMethodTypes, currency: common_enums::Currency, country: Option<&common_enums::CountryAlpha2>, ) -> errors::RouterResult<Option<bool>>
crates/router/src/core/payout_link.rs
router
function_signature
null
null
null
93
check_currency_country_filters
null
null
null
null
null
null
// Struct: TwoFactorAuthAttempts // File: crates/api_models/src/user.rs // Module: api_models // Implementations: 0 pub struct TwoFactorAuthAttempts
crates/api_models/src/user.rs
api_models
struct_definition
TwoFactorAuthAttempts
0
[]
37
null
null
null
null
null
null
null
// Function: filter_resources // File: crates/storage_impl/src/kv_router_store.rs // Module: storage_impl pub fn filter_resources<D, R, M>( &self, state: &KeyManagerState, key_store: &MerchantKeyStore, storage_scheme: MerchantStorageScheme, filter_resource_db_fut: R, filter_fn: impl Fn(&M) -> bool, FilterResourceParams
crates/storage_impl/src/kv_router_store.rs
storage_impl
function_signature
null
null
null
89
filter_resources
null
null
null
null
null
null
// File: crates/router/src/services/authentication.rs // Module: router // Public functions: 30 // Public structs: 44 use std::str::FromStr; use actix_web::http::header::HeaderMap; #[cfg(feature = "v2")] use api_models::payment_methods::PaymentMethodIntentConfirm; #[cfg(feature = "v1")] use api_models::payment_methods::{PaymentMethodCreate, PaymentMethodListRequest}; use api_models::payments; #[cfg(feature = "payouts")] use api_models::payouts; use async_trait::async_trait; use common_enums::TokenPurpose; use common_utils::{date_time, fp_utils, id_type}; #[cfg(feature = "v2")] use diesel_models::ephemeral_key; use error_stack::{report, ResultExt}; use jsonwebtoken::{decode, Algorithm, DecodingKey, Validation}; #[cfg(feature = "v2")] use masking::ExposeInterface; use masking::PeekInterface; use router_env::logger; use serde::Serialize; use self::blacklist::BlackList; #[cfg(all(feature = "partial-auth", feature = "v1"))] use self::detached::ExtractedPayload; #[cfg(feature = "partial-auth")] use self::detached::GetAuthType; use super::authorization::{self, permissions::Permission}; #[cfg(feature = "olap")] use super::jwt; #[cfg(feature = "olap")] use crate::configs::Settings; #[cfg(feature = "olap")] use crate::consts; #[cfg(feature = "olap")] use crate::core::errors::UserResult; #[cfg(all(feature = "partial-auth", feature = "v1"))] use crate::core::metrics; use crate::{ configs::settings, core::{ api_keys, errors::{self, utils::StorageErrorExt, RouterResult}, }, headers, routes::app::SessionStateInfo, services::api, types::{domain, storage}, utils::OptionExt, }; pub mod blacklist; pub mod cookies; pub mod decision; #[cfg(feature = "partial-auth")] mod detached; #[cfg(feature = "v1")] #[derive(Clone, Debug)] pub struct AuthenticationData { pub merchant_account: domain::MerchantAccount, pub platform_merchant_account: Option<domain::MerchantAccount>, pub key_store: domain::MerchantKeyStore, pub profile_id: Option<id_type::ProfileId>, } #[cfg(feature = "v2")] #[derive(Clone, Debug)] pub struct AuthenticationData { pub merchant_account: domain::MerchantAccount, pub key_store: domain::MerchantKeyStore, pub profile: domain::Profile, pub platform_merchant_account: Option<domain::MerchantAccount>, } #[derive(Clone, Debug)] pub struct AuthenticationDataWithoutProfile { pub merchant_account: domain::MerchantAccount, pub key_store: domain::MerchantKeyStore, } #[derive(Clone, Debug)] pub struct AuthenticationDataWithMultipleProfiles { pub merchant_account: domain::MerchantAccount, pub key_store: domain::MerchantKeyStore, pub profile_id_list: Option<Vec<id_type::ProfileId>>, } #[derive(Clone, Debug)] pub struct AuthenticationDataWithUser { pub merchant_account: domain::MerchantAccount, pub key_store: domain::MerchantKeyStore, pub user: storage::User, pub profile_id: id_type::ProfileId, } #[derive(Clone, Debug)] pub struct AuthenticationDataWithOrg { pub organization_id: id_type::OrganizationId, } #[derive(Clone)] pub struct UserFromTokenWithRoleInfo { pub user: UserFromToken, pub role_info: authorization::roles::RoleInfo, } #[derive(Clone, Debug, Eq, PartialEq, Serialize)] #[serde( tag = "api_auth_type", content = "authentication_data", rename_all = "snake_case" )] pub enum AuthenticationType { ApiKey { merchant_id: id_type::MerchantId, key_id: id_type::ApiKeyId, }, AdminApiKey, AdminApiAuthWithMerchantId { merchant_id: id_type::MerchantId, }, OrganizationJwt { org_id: id_type::OrganizationId, user_id: String, }, MerchantJwt { merchant_id: id_type::MerchantId, user_id: Option<String>, }, MerchantJwtWithProfileId { merchant_id: id_type::MerchantId, profile_id: Option<id_type::ProfileId>, user_id: String, }, UserJwt { user_id: String, }, SinglePurposeJwt { user_id: String, purpose: TokenPurpose, }, SinglePurposeOrLoginJwt { user_id: String, purpose: Option<TokenPurpose>, role_id: Option<String>, }, MerchantId { merchant_id: id_type::MerchantId, }, PublishableKey { merchant_id: id_type::MerchantId, }, WebhookAuth { merchant_id: id_type::MerchantId, }, InternalMerchantIdProfileId { merchant_id: id_type::MerchantId, profile_id: Option<id_type::ProfileId>, }, NoAuth, } impl events::EventInfo for AuthenticationType { type Data = Self; fn data(&self) -> error_stack::Result<Self::Data, events::EventsError> { Ok(self.clone()) } fn key(&self) -> String { "auth_info".to_string() } } impl AuthenticationType { pub fn get_merchant_id(&self) -> Option<&id_type::MerchantId> { match self { Self::ApiKey { merchant_id, key_id: _, } | Self::AdminApiAuthWithMerchantId { merchant_id } | Self::MerchantId { merchant_id } | Self::PublishableKey { merchant_id } | Self::MerchantJwt { merchant_id, user_id: _, } | Self::MerchantJwtWithProfileId { merchant_id, .. } | Self::WebhookAuth { merchant_id } | Self::InternalMerchantIdProfileId { merchant_id, .. } => Some(merchant_id), Self::AdminApiKey | Self::OrganizationJwt { .. } | Self::UserJwt { .. } | Self::SinglePurposeJwt { .. } | Self::SinglePurposeOrLoginJwt { .. } | Self::NoAuth => None, } } } #[derive(Clone, Debug, Eq, PartialEq, Serialize, serde::Deserialize, strum::Display)] #[serde(rename_all = "snake_case")] #[strum(serialize_all = "snake_case")] pub enum ExternalServiceType { Hypersense, } #[cfg(feature = "olap")] #[derive(Clone, Debug)] pub struct UserFromSinglePurposeToken { pub user_id: String, pub origin: domain::Origin, pub path: Vec<TokenPurpose>, pub tenant_id: Option<id_type::TenantId>, } #[cfg(feature = "olap")] #[derive(serde::Serialize, serde::Deserialize)] pub struct SinglePurposeToken { pub user_id: String, pub purpose: TokenPurpose, pub origin: domain::Origin, pub path: Vec<TokenPurpose>, pub exp: u64, pub tenant_id: Option<id_type::TenantId>, } #[cfg(feature = "olap")] impl SinglePurposeToken { pub async fn new_token( user_id: String, purpose: TokenPurpose, origin: domain::Origin, settings: &Settings, path: Vec<TokenPurpose>, tenant_id: Option<id_type::TenantId>, ) -> UserResult<String> { let exp_duration = std::time::Duration::from_secs(consts::SINGLE_PURPOSE_TOKEN_TIME_IN_SECS); let exp = jwt::generate_exp(exp_duration)?.as_secs(); let token_payload = Self { user_id, purpose, origin, exp, path, tenant_id, }; jwt::generate_jwt(&token_payload, settings).await } } #[derive(serde::Serialize, serde::Deserialize)] pub struct AuthToken { pub user_id: String, pub merchant_id: id_type::MerchantId, pub role_id: String, pub exp: u64, pub org_id: id_type::OrganizationId, pub profile_id: id_type::ProfileId, pub tenant_id: Option<id_type::TenantId>, } #[cfg(feature = "olap")] impl AuthToken { pub async fn new_token( user_id: String, merchant_id: id_type::MerchantId, role_id: String, settings: &Settings, org_id: id_type::OrganizationId, profile_id: id_type::ProfileId, tenant_id: Option<id_type::TenantId>, ) -> UserResult<String> { let exp_duration = std::time::Duration::from_secs(consts::JWT_TOKEN_TIME_IN_SECS); let exp = jwt::generate_exp(exp_duration)?.as_secs(); let token_payload = Self { user_id, merchant_id, role_id, exp, org_id, profile_id, tenant_id, }; jwt::generate_jwt(&token_payload, settings).await } } #[derive(Clone)] pub struct UserFromToken { pub user_id: String, pub merchant_id: id_type::MerchantId, pub role_id: String, pub org_id: id_type::OrganizationId, pub profile_id: id_type::ProfileId, pub tenant_id: Option<id_type::TenantId>, } pub struct UserIdFromAuth { pub user_id: String, pub tenant_id: Option<id_type::TenantId>, } #[cfg(feature = "olap")] #[derive(serde::Serialize, serde::Deserialize)] pub struct SinglePurposeOrLoginToken { pub user_id: String, pub role_id: Option<String>, pub purpose: Option<TokenPurpose>, pub exp: u64, pub tenant_id: Option<id_type::TenantId>, } pub trait AuthInfo { fn get_merchant_id(&self) -> Option<&id_type::MerchantId>; } impl AuthInfo for () { fn get_merchant_id(&self) -> Option<&id_type::MerchantId> { None } } #[cfg(feature = "v1")] impl AuthInfo for AuthenticationData { fn get_merchant_id(&self) -> Option<&id_type::MerchantId> { Some(self.merchant_account.get_id()) } } #[cfg(feature = "v2")] impl AuthInfo for AuthenticationData { fn get_merchant_id(&self) -> Option<&id_type::MerchantId> { Some(self.merchant_account.get_id()) } } impl AuthInfo for AuthenticationDataWithMultipleProfiles { fn get_merchant_id(&self) -> Option<&id_type::MerchantId> { Some(self.merchant_account.get_id()) } } #[async_trait] pub trait AuthenticateAndFetch<T, A> where A: SessionStateInfo, { async fn authenticate_and_fetch( &self, request_headers: &HeaderMap, state: &A, ) -> RouterResult<(T, AuthenticationType)>; } #[derive(Debug, Default)] pub struct ApiKeyAuth { pub is_connected_allowed: bool, pub is_platform_allowed: bool, } pub struct NoAuth; #[cfg(feature = "partial-auth")] impl GetAuthType for ApiKeyAuth { fn get_auth_type(&self) -> detached::PayloadType { detached::PayloadType::ApiKey } } // // # Header Auth // // Header Auth is a feature that allows you to authenticate requests using custom headers. This is // done by checking whether the request contains the specified headers. // - `x-merchant-id` header is used to authenticate the merchant. // // ## Checksum // - `x-auth-checksum` header is used to authenticate the request. The checksum is calculated using the // above mentioned headers is generated by hashing the headers mentioned above concatenated with `:` and then hashed with the detached authentication key. // // When the [`partial-auth`] feature is disabled the implementation for [`AuthenticateAndFetch`] // changes where the authentication is done by the [`I`] implementation. // pub struct HeaderAuth<I>(pub I); #[async_trait] impl<A> AuthenticateAndFetch<(), A> for NoAuth where A: SessionStateInfo + Sync, { async fn authenticate_and_fetch( &self, _request_headers: &HeaderMap, _state: &A, ) -> RouterResult<((), AuthenticationType)> { Ok(((), AuthenticationType::NoAuth)) } } #[async_trait] impl<A, T> AuthenticateAndFetch<Option<T>, A> for NoAuth where A: SessionStateInfo + Sync, { async fn authenticate_and_fetch( &self, _request_headers: &HeaderMap, _state: &A, ) -> RouterResult<(Option<T>, AuthenticationType)> { Ok((None, AuthenticationType::NoAuth)) } } #[cfg(feature = "v2")] #[async_trait] impl<A> AuthenticateAndFetch<AuthenticationData, A> for ApiKeyAuth where A: SessionStateInfo + Sync, { async fn authenticate_and_fetch( &self, request_headers: &HeaderMap, state: &A, ) -> RouterResult<(AuthenticationData, AuthenticationType)> { let api_key = get_api_key(request_headers) .change_context(errors::ApiErrorResponse::Unauthorized)? .trim(); if api_key.is_empty() { return Err(errors::ApiErrorResponse::Unauthorized) .attach_printable("API key is empty"); } let profile_id = HeaderMapStruct::new(request_headers) .get_id_type_from_header::<id_type::ProfileId>(headers::X_PROFILE_ID)?; let api_key = api_keys::PlaintextApiKey::from(api_key); let hash_key = { let config = state.conf(); config.api_keys.get_inner().get_hash_key()? }; let hashed_api_key = api_key.keyed_hash(hash_key.peek()); let stored_api_key = state .store() .find_api_key_by_hash_optional(hashed_api_key.into()) .await .change_context(errors::ApiErrorResponse::InternalServerError) // If retrieve failed .attach_printable("Failed to retrieve API key")? .ok_or(report!(errors::ApiErrorResponse::Unauthorized)) // If retrieve returned `None` .attach_printable("Merchant not authenticated")?; if stored_api_key .expires_at .map(|expires_at| expires_at < date_time::now()) .unwrap_or(false) { return Err(report!(errors::ApiErrorResponse::Unauthorized)) .attach_printable("API key has expired"); } let key_manager_state = &(&state.session_state()).into(); let key_store = state .store() .get_merchant_key_store_by_merchant_id( key_manager_state, &stored_api_key.merchant_id, &state.store().get_master_key().to_vec().into(), ) .await .change_context(errors::ApiErrorResponse::Unauthorized) .attach_printable("Failed to fetch merchant key store for the merchant id")?; let merchant = state .store() .find_merchant_account_by_merchant_id( key_manager_state, &stored_api_key.merchant_id, &key_store, ) .await .to_not_found_response(errors::ApiErrorResponse::Unauthorized)?; // Get connected merchant account if API call is done by Platform merchant account on behalf of connected merchant account let (merchant, platform_merchant_account) = if state.conf().platform.enabled { get_platform_merchant_account(state, request_headers, merchant).await? } else { (merchant, None) }; if platform_merchant_account.is_some() && !self.is_platform_allowed { return Err(report!( errors::ApiErrorResponse::PlatformAccountAuthNotSupported )) .attach_printable("Platform not authorized to access the resource"); } let key_store = if platform_merchant_account.is_some() { state .store() .get_merchant_key_store_by_merchant_id( key_manager_state, merchant.get_id(), &state.store().get_master_key().to_vec().into(), ) .await .change_context(errors::ApiErrorResponse::Unauthorized) .attach_printable("Failed to fetch merchant key store for the merchant id")? } else { key_store }; let profile = state .store() .find_business_profile_by_profile_id(key_manager_state, &key_store, &profile_id) .await .to_not_found_response(errors::ApiErrorResponse::Unauthorized)?; let auth = AuthenticationData { merchant_account: merchant, platform_merchant_account, key_store, profile, }; Ok(( auth.clone(), AuthenticationType::ApiKey { merchant_id: auth.merchant_account.get_id().clone(), key_id: stored_api_key.key_id, }, )) } } #[cfg(feature = "v1")] #[async_trait] impl<A> AuthenticateAndFetch<AuthenticationData, A> for ApiKeyAuth where A: SessionStateInfo + Sync, { async fn authenticate_and_fetch( &self, request_headers: &HeaderMap, state: &A, ) -> RouterResult<(AuthenticationData, AuthenticationType)> { let api_key = get_api_key(request_headers) .change_context(errors::ApiErrorResponse::Unauthorized)? .trim(); if api_key.is_empty() { return Err(errors::ApiErrorResponse::Unauthorized) .attach_printable("API key is empty"); } let api_key = api_keys::PlaintextApiKey::from(api_key); let hash_key = { let config = state.conf(); config.api_keys.get_inner().get_hash_key()? }; let hashed_api_key = api_key.keyed_hash(hash_key.peek()); let stored_api_key = state .store() .find_api_key_by_hash_optional(hashed_api_key.into()) .await .change_context(errors::ApiErrorResponse::InternalServerError) // If retrieve failed .attach_printable("Failed to retrieve API key")? .ok_or(report!(errors::ApiErrorResponse::Unauthorized)) // If retrieve returned `None` .attach_printable("Merchant not authenticated")?; if stored_api_key .expires_at .map(|expires_at| expires_at < date_time::now()) .unwrap_or(false) { return Err(report!(errors::ApiErrorResponse::Unauthorized)) .attach_printable("API key has expired"); } let key_manager_state = &(&state.session_state()).into(); let key_store = state .store() .get_merchant_key_store_by_merchant_id( key_manager_state, &stored_api_key.merchant_id, &state.store().get_master_key().to_vec().into(), ) .await .change_context(errors::ApiErrorResponse::Unauthorized) .attach_printable("Failed to fetch merchant key store for the merchant id")?; let profile_id = get_header_value_by_key(headers::X_PROFILE_ID.to_string(), request_headers)? .map(id_type::ProfileId::from_str) .transpose() .change_context(errors::ValidationError::IncorrectValueProvided { field_name: "X-Profile-Id", }) .change_context(errors::ApiErrorResponse::Unauthorized)?; let merchant = state .store() .find_merchant_account_by_merchant_id( key_manager_state, &stored_api_key.merchant_id, &key_store, ) .await .to_not_found_response(errors::ApiErrorResponse::Unauthorized)?; let (merchant, platform_merchant_account) = if state.conf().platform.enabled { get_platform_merchant_account(state, request_headers, merchant).await? } else { (merchant, None) }; if platform_merchant_account.is_some() && !self.is_platform_allowed { return Err(report!( errors::ApiErrorResponse::PlatformAccountAuthNotSupported )) .attach_printable("Platform not authorized to access the resource"); } let key_store = if platform_merchant_account.is_some() { state .store() .get_merchant_key_store_by_merchant_id( key_manager_state, merchant.get_id(), &state.store().get_master_key().to_vec().into(), ) .await .change_context(errors::ApiErrorResponse::Unauthorized) .attach_printable("Failed to fetch merchant key store for the merchant id")? } else { key_store }; let auth = AuthenticationData { merchant_account: merchant, platform_merchant_account, key_store, profile_id, }; Ok(( auth.clone(), AuthenticationType::ApiKey { merchant_id: auth.merchant_account.get_id().clone(), key_id: stored_api_key.key_id, }, )) } } #[derive(Debug)] pub struct ApiKeyAuthWithMerchantIdFromRoute(pub id_type::MerchantId); #[cfg(feature = "partial-auth")] impl GetAuthType for ApiKeyAuthWithMerchantIdFromRoute { fn get_auth_type(&self) -> detached::PayloadType { detached::PayloadType::ApiKey } } #[cfg(feature = "v1")] #[async_trait] impl<A> AuthenticateAndFetch<AuthenticationData, A> for ApiKeyAuthWithMerchantIdFromRoute where A: SessionStateInfo + Sync, { async fn authenticate_and_fetch( &self, request_headers: &HeaderMap, state: &A, ) -> RouterResult<(AuthenticationData, AuthenticationType)> { let api_auth = ApiKeyAuth { is_connected_allowed: false, is_platform_allowed: false, }; let (auth_data, auth_type) = api_auth .authenticate_and_fetch(request_headers, state) .await?; let merchant_id_from_route = self.0.clone(); let merchant_id_from_api_key = auth_data.merchant_account.get_id(); if merchant_id_from_route != *merchant_id_from_api_key { return Err(report!(errors::ApiErrorResponse::Unauthorized)).attach_printable( "Merchant ID from route and Merchant ID from api-key in header do not match", ); } Ok((auth_data, auth_type)) } } #[derive(Debug, Default)] pub struct PlatformOrgAdminAuth { pub is_admin_auth_allowed: bool, pub organization_id: Option<id_type::OrganizationId>, } #[cfg(feature = "v1")] #[async_trait] impl<A> AuthenticateAndFetch<Option<AuthenticationDataWithOrg>, A> for PlatformOrgAdminAuth where A: SessionStateInfo + Sync, { async fn authenticate_and_fetch( &self, request_headers: &HeaderMap, state: &A, ) -> RouterResult<(Option<AuthenticationDataWithOrg>, AuthenticationType)> { // Step 1: Admin API Key and API Key Fallback (if allowed) if self.is_admin_auth_allowed { let admin_auth = AdminApiAuthWithApiKeyFallback { organization_id: self.organization_id.clone(), }; match admin_auth .authenticate_and_fetch(request_headers, state) .await { Ok((auth, auth_type)) => { return Ok((auth, auth_type)); } Err(e) => { logger::warn!("Admin API Auth failed: {:?}", e); } } } // Step 2: Try Platform Auth let api_key = get_api_key(request_headers) .change_context(errors::ApiErrorResponse::Unauthorized)? .trim(); if api_key.is_empty() { return Err(errors::ApiErrorResponse::Unauthorized) .attach_printable("API key is empty"); } let api_key_plaintext = api_keys::PlaintextApiKey::from(api_key); let hash_key = state.conf().api_keys.get_inner().get_hash_key()?; let hashed_api_key = api_key_plaintext.keyed_hash(hash_key.peek()); let stored_api_key = state .store() .find_api_key_by_hash_optional(hashed_api_key.into()) .await .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable("Failed to retrieve API key")? .ok_or_else(|| report!(errors::ApiErrorResponse::Unauthorized)) .attach_printable("Merchant not authenticated via API key")?; if stored_api_key .expires_at .map(|expires_at| expires_at < date_time::now()) .unwrap_or(false) { return Err(report!(errors::ApiErrorResponse::Unauthorized)) .attach_printable("API key has expired"); } let key_manager_state = &(&state.session_state()).into(); let key_store = state .store() .get_merchant_key_store_by_merchant_id( key_manager_state, &stored_api_key.merchant_id, &state.store().get_master_key().to_vec().into(), ) .await .change_context(errors::ApiErrorResponse::Unauthorized) .attach_printable("Failed to fetch merchant key store for the merchant id")?; let merchant_account = state .store() .find_merchant_account_by_merchant_id( key_manager_state, &stored_api_key.merchant_id, &key_store, ) .await .to_not_found_response(errors::ApiErrorResponse::Unauthorized) .attach_printable("Merchant account not found")?; if !(state.conf().platform.enabled && merchant_account.is_platform_account()) { return Err(report!(errors::ApiErrorResponse::Unauthorized) .attach_printable("Platform authentication check failed")); } if let Some(ref organization_id) = self.organization_id { if organization_id != merchant_account.get_org_id() { return Err(report!(errors::ApiErrorResponse::Unauthorized)) .attach_printable("Organization ID does not match"); } } Ok(( Some(AuthenticationDataWithOrg { organization_id: merchant_account.get_org_id().clone(), }), AuthenticationType::ApiKey { merchant_id: merchant_account.get_id().clone(), key_id: stored_api_key.key_id, }, )) } } #[cfg(feature = "v1")] #[async_trait] impl<A> AuthenticateAndFetch<AuthenticationData, A> for PlatformOrgAdminAuth where A: SessionStateInfo + Sync, { async fn authenticate_and_fetch( &self, request_headers: &HeaderMap, state: &A, ) -> RouterResult<(AuthenticationData, AuthenticationType)> { let api_key = get_api_key(request_headers) .change_context(errors::ApiErrorResponse::Unauthorized)? .trim(); if api_key.is_empty() { return Err(errors::ApiErrorResponse::Unauthorized) .attach_printable("API key is empty"); } let api_key_plaintext = api_keys::PlaintextApiKey::from(api_key); let hash_key = state.conf().api_keys.get_inner().get_hash_key()?; let hashed_api_key = api_key_plaintext.keyed_hash(hash_key.peek()); let stored_api_key = state .store() .find_api_key_by_hash_optional(hashed_api_key.into()) .await .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable("Failed to retrieve API key")? .ok_or_else(|| report!(errors::ApiErrorResponse::Unauthorized)) .attach_printable("Merchant not authenticated via API key")?; if stored_api_key .expires_at .map(|expires_at| expires_at < date_time::now()) .unwrap_or(false) { return Err(report!(errors::ApiErrorResponse::Unauthorized)) .attach_printable("API key has expired"); } let key_manager_state = &(&state.session_state()).into(); let key_store = state .store() .get_merchant_key_store_by_merchant_id( key_manager_state, &stored_api_key.merchant_id, &state.store().get_master_key().to_vec().into(), ) .await .change_context(errors::ApiErrorResponse::Unauthorized) .attach_printable("Failed to fetch merchant key store for the merchant id")?; let merchant_account = state .store() .find_merchant_account_by_merchant_id( key_manager_state, &stored_api_key.merchant_id, &key_store, ) .await .to_not_found_response(errors::ApiErrorResponse::Unauthorized) .attach_printable("Merchant account not found")?; if !(state.conf().platform.enabled && merchant_account.is_platform_account()) { return Err(report!(errors::ApiErrorResponse::Unauthorized) .attach_printable("Platform authentication check failed")); } if let Some(ref organization_id) = self.organization_id { if organization_id != merchant_account.get_org_id() { return Err(report!(errors::ApiErrorResponse::Unauthorized)) .attach_printable("Organization ID does not match"); } } let auth = AuthenticationData { merchant_account: merchant_account.clone(), platform_merchant_account: Some(merchant_account.clone()), key_store, profile_id: None, }; Ok(( auth.clone(), AuthenticationType::ApiKey { merchant_id: auth.merchant_account.get_id().clone(), key_id: stored_api_key.key_id, }, )) } } #[derive(Debug)] pub struct PlatformOrgAdminAuthWithMerchantIdFromRoute { pub merchant_id_from_route: id_type::MerchantId, pub is_admin_auth_allowed: bool, } #[cfg(feature = "v1")] impl PlatformOrgAdminAuthWithMerchantIdFromRoute { async fn fetch_key_store_and_account<A: SessionStateInfo + Sync>( merchant_id: &id_type::MerchantId, state: &A, ) -> RouterResult<(domain::MerchantKeyStore, domain::MerchantAccount)> { let key_manager_state = &(&state.session_state()).into(); let key_store = state .store() .get_merchant_key_store_by_merchant_id( key_manager_state, merchant_id, &state.store().get_master_key().to_vec().into(), ) .await .to_not_found_response(errors::ApiErrorResponse::Unauthorized)?; let merchant = state .store() .find_merchant_account_by_merchant_id(key_manager_state, merchant_id, &key_store) .await .to_not_found_response(errors::ApiErrorResponse::Unauthorized)?; Ok((key_store, merchant)) } } #[cfg(feature = "v1")] #[async_trait] impl<A> AuthenticateAndFetch<AuthenticationData, A> for PlatformOrgAdminAuthWithMerchantIdFromRoute where A: SessionStateInfo + Sync, { async fn authenticate_and_fetch( &self, request_headers: &HeaderMap, state: &A, ) -> RouterResult<(AuthenticationData, AuthenticationType)> { let route_merchant_id = self.merchant_id_from_route.clone(); // Step 1: Admin API Key and API Key Fallback (if allowed) if self.is_admin_auth_allowed { let admin_auth = AdminApiAuthWithApiKeyFallbackAndMerchantIdFromRoute(route_merchant_id.clone()); match admin_auth .authenticate_and_fetch(request_headers, state) .await { Ok((auth_data, auth_type)) => return Ok((auth_data, auth_type)), Err(e) => { logger::warn!("Admin API Auth failed: {:?}", e); } } } // Step 2: Platform authentication let api_key = get_api_key(request_headers) .change_context(errors::ApiErrorResponse::Unauthorized)? .trim(); if api_key.is_empty() { return Err(errors::ApiErrorResponse::Unauthorized) .attach_printable("API key is empty"); } let api_key_plaintext = api_keys::PlaintextApiKey::from(api_key); let hash_key = { let config = state.conf(); config.api_keys.get_inner().get_hash_key()? }; let hashed_api_key = api_key_plaintext.keyed_hash(hash_key.peek()); let stored_api_key = state .store() .find_api_key_by_hash_optional(hashed_api_key.into()) .await .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable("Failed to retrieve API key")? .ok_or_else(|| report!(errors::ApiErrorResponse::Unauthorized)) .attach_printable("Merchant not authenticated via API key")?; if stored_api_key .expires_at .map(|expires_at| expires_at < date_time::now()) .unwrap_or(false) { return Err(report!(errors::ApiErrorResponse::Unauthorized)) .attach_printable("API key has expired"); } let (_, platform_merchant) = Self::fetch_key_store_and_account(&stored_api_key.merchant_id, state).await?; if !(state.conf().platform.enabled && platform_merchant.is_platform_account()) { return Err(report!(errors::ApiErrorResponse::Unauthorized)) .attach_printable("Platform authentication check failed"); } let (route_key_store, route_merchant) = Self::fetch_key_store_and_account(&route_merchant_id, state).await?; if platform_merchant.get_org_id() != route_merchant.get_org_id() { return Err(report!(errors::ApiErrorResponse::Unauthorized)) .attach_printable("Route merchant not under same org as platform merchant"); } let auth = AuthenticationData { merchant_account: route_merchant, platform_merchant_account: Some(platform_merchant.clone()), key_store: route_key_store, profile_id: None, }; Ok(( auth.clone(), AuthenticationType::ApiKey { merchant_id: platform_merchant.get_id().clone(), key_id: stored_api_key.key_id, }, )) } } #[cfg(not(feature = "partial-auth"))] #[async_trait] impl<A, I> AuthenticateAndFetch<AuthenticationData, A> for HeaderAuth<I> where A: SessionStateInfo + Send + Sync, I: AuthenticateAndFetch<AuthenticationData, A> + Sync + Send, { async fn authenticate_and_fetch( &self, request_headers: &HeaderMap, state: &A, ) -> RouterResult<(AuthenticationData, AuthenticationType)> { self.0.authenticate_and_fetch(request_headers, state).await } } #[cfg(all(feature = "partial-auth", feature = "v1"))] #[async_trait] impl<A, I> AuthenticateAndFetch<AuthenticationData, A> for HeaderAuth<I> where A: SessionStateInfo + Sync, I: AuthenticateAndFetch<AuthenticationData, A> + GetAuthType + Sync + Send, { async fn authenticate_and_fetch( &self, request_headers: &HeaderMap, state: &A, ) -> RouterResult<(AuthenticationData, AuthenticationType)> { let enable_partial_auth = state.conf().api_keys.get_inner().enable_partial_auth; // This is a early return if partial auth is disabled // Preventing the need to go through the header extraction process if !enable_partial_auth { return self.0.authenticate_and_fetch(request_headers, state).await; } let report_failure = || { metrics::PARTIAL_AUTH_FAILURE.add(1, &[]); }; let profile_id = HeaderMapStruct::new(request_headers) .get_id_type_from_header_if_present::<id_type::ProfileId>(headers::X_PROFILE_ID) .change_context(errors::ValidationError::IncorrectValueProvided { field_name: "X-Profile-Id", }) .change_context(errors::ApiErrorResponse::Unauthorized)?; let payload = ExtractedPayload::from_headers(request_headers) .and_then(|value| { let (algo, secret) = state.get_detached_auth()?; Ok(value .verify_checksum(request_headers, algo, secret) .then_some(value)) }) .map(|inner_payload| { inner_payload.and_then(|inner| { (inner.payload_type == self.0.get_auth_type()).then_some(inner) }) }); match payload { Ok(Some(data)) => match data { ExtractedPayload { payload_type: detached::PayloadType::ApiKey, merchant_id: Some(merchant_id), key_id: Some(key_id), } => { let auth = construct_authentication_data( state, &merchant_id, request_headers, profile_id, ) .await?; Ok(( auth.clone(), AuthenticationType::ApiKey { merchant_id: auth.merchant_account.get_id().clone(), key_id, }, )) } ExtractedPayload { payload_type: detached::PayloadType::PublishableKey, merchant_id: Some(merchant_id), key_id: None, } => { let auth = construct_authentication_data( state, &merchant_id, request_headers, profile_id, ) .await?; Ok(( auth.clone(), AuthenticationType::PublishableKey { merchant_id: auth.merchant_account.get_id().clone(), }, )) } _ => { report_failure(); self.0.authenticate_and_fetch(request_headers, state).await } }, Ok(None) => { report_failure(); self.0.authenticate_and_fetch(request_headers, state).await } Err(error) => { logger::error!(%error, "Failed to extract payload from headers"); report_failure();
crates/router/src/services/authentication.rs#chunk0
router
chunk
null
null
null
8,187
null
null
null
null
null
null
null
// Struct: CoinbaseWebhookDetails // File: crates/hyperswitch_connectors/src/connectors/coinbase/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct CoinbaseWebhookDetails
crates/hyperswitch_connectors/src/connectors/coinbase/transformers.rs
hyperswitch_connectors
struct_definition
CoinbaseWebhookDetails
0
[]
50
null
null
null
null
null
null
null
// Implementation: impl api::PaymentAuthorize for for Breadpay // File: crates/hyperswitch_connectors/src/connectors/breadpay.rs // Module: hyperswitch_connectors // Methods: 0 total (0 public) impl api::PaymentAuthorize for for Breadpay
crates/hyperswitch_connectors/src/connectors/breadpay.rs
hyperswitch_connectors
impl_block
null
null
null
58
null
Breadpay
api::PaymentAuthorize for
0
0
null
null
// File: crates/external_services/src/hashicorp_vault.rs // Module: external_services //! Interactions with the HashiCorp Vault pub mod core; pub mod implementers;
crates/external_services/src/hashicorp_vault.rs
external_services
full_file
null
null
null
40
null
null
null
null
null
null
null
// Struct: RefundResponse // File: crates/hyperswitch_connectors/src/connectors/paypal/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct RefundResponse
crates/hyperswitch_connectors/src/connectors/paypal/transformers.rs
hyperswitch_connectors
struct_definition
RefundResponse
0
[]
47
null
null
null
null
null
null
null
// Struct: DisputePayload // File: crates/hyperswitch_interfaces/src/disputes.rs // Module: hyperswitch_interfaces // Implementations: 0 pub struct DisputePayload
crates/hyperswitch_interfaces/src/disputes.rs
hyperswitch_interfaces
struct_definition
DisputePayload
0
[]
41
null
null
null
null
null
null
null
// Implementation: impl UserRole // File: crates/diesel_models/src/query/user_role.rs // Module: diesel_models // Methods: 7 total (0 public) impl UserRole
crates/diesel_models/src/query/user_role.rs
diesel_models
impl_block
null
null
null
37
null
UserRole
null
7
0
null
null
// Implementation: impl AddressUpdateInternal // File: crates/diesel_models/src/address.rs // Module: diesel_models // Methods: 1 total (1 public) impl AddressUpdateInternal
crates/diesel_models/src/address.rs
diesel_models
impl_block
null
null
null
39
null
AddressUpdateInternal
null
1
1
null
null
// Implementation: impl PaymentDistributionAccumulator for for ErrorDistributionAccumulator // File: crates/analytics/src/payments/accumulator.rs // Module: analytics // Methods: 2 total (0 public) impl PaymentDistributionAccumulator for for ErrorDistributionAccumulator
crates/analytics/src/payments/accumulator.rs
analytics
impl_block
null
null
null
58
null
ErrorDistributionAccumulator
PaymentDistributionAccumulator for
2
0
null
null
// Struct: GlobepayErrorResponse // File: crates/hyperswitch_connectors/src/connectors/globepay/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct GlobepayErrorResponse
crates/hyperswitch_connectors/src/connectors/globepay/transformers.rs
hyperswitch_connectors
struct_definition
GlobepayErrorResponse
0
[]
51
null
null
null
null
null
null
null
// Module Structure // File: crates/router/src/core/payments.rs // Module: router // Public submodules: pub mod access_token; pub mod conditional_configs; pub mod customers; pub mod flows; pub mod helpers; pub mod operations; pub mod retry; pub mod routing; pub mod session_operation; pub mod tokenization; pub mod transformers; pub mod types; pub mod vault_session; pub mod payment_methods; // Public exports: pub use common_enums::enums::{CallConnectorAction, GatewaySystem}; pub use hyperswitch_domain_models::{ mandates::MandateData, payment_address::PaymentAddress, payments::{self as domain_payments, HeaderPayload}, router_data::{PaymentMethodToken, RouterData}, router_request_types::CustomerDetails, }; pub use session_operation::payments_session_core; pub use self::operations::{ PaymentApprove, PaymentCancel, PaymentCancelPostCapture, PaymentCapture, PaymentConfirm, PaymentCreate, PaymentIncrementalAuthorization, PaymentPostSessionTokens, PaymentReject, PaymentSession, PaymentSessionUpdate, PaymentStatus, PaymentUpdate, PaymentUpdateMetadata, };
crates/router/src/core/payments.rs
router
module_structure
null
null
null
229
null
null
null
null
null
14
4
// Function: log_payment_intent // File: crates/router/src/services/kafka.rs // Module: router pub fn log_payment_intent( &self, intent: &PaymentIntent, old_intent: Option<PaymentIntent>, tenant_id: TenantID, infra_values: Option<Value>, ) -> MQResult<()>
crates/router/src/services/kafka.rs
router
function_signature
null
null
null
69
log_payment_intent
null
null
null
null
null
null
// Struct: Stax // File: crates/hyperswitch_connectors/src/connectors/stax.rs // Module: hyperswitch_connectors // Implementations: 17 // Traits: api::Payment, api::PaymentSession, api::ConnectorAccessToken, api::MandateSetup, api::PaymentAuthorize, api::PaymentSync, api::PaymentCapture, api::PaymentVoid, api::Refund, api::RefundExecute, api::RefundSync, api::PaymentToken, ConnectorCommon, ConnectorValidation, api::ConnectorCustomer, webhooks::IncomingWebhook, ConnectorSpecifications pub struct Stax
crates/hyperswitch_connectors/src/connectors/stax.rs
hyperswitch_connectors
struct_definition
Stax
17
[ "api::Payment", "api::PaymentSession", "api::ConnectorAccessToken", "api::MandateSetup", "api::PaymentAuthorize", "api::PaymentSync", "api::PaymentCapture", "api::PaymentVoid", "api::Refund", "api::RefundExecute", "api::RefundSync", "api::PaymentToken", "ConnectorCommon", "ConnectorValidation", "api::ConnectorCustomer", "webhooks::IncomingWebhook", "ConnectorSpecifications" ]
130
null
null
null
null
null
null
null
// Implementation: impl ConnectorCommon for for Nmi // File: crates/hyperswitch_connectors/src/connectors/nmi.rs // Module: hyperswitch_connectors // Methods: 4 total (0 public) impl ConnectorCommon for for Nmi
crates/hyperswitch_connectors/src/connectors/nmi.rs
hyperswitch_connectors
impl_block
null
null
null
53
null
Nmi
ConnectorCommon for
4
0
null
null
// File: crates/api_models/src/events/payment.rs // Module: api_models use common_utils::events::{ApiEventMetric, ApiEventsType}; #[cfg(feature = "v2")] use super::{ PaymentAttemptListRequest, PaymentAttemptListResponse, PaymentStartRedirectionRequest, PaymentsCreateIntentRequest, PaymentsGetIntentRequest, PaymentsIntentResponse, PaymentsRequest, RecoveryPaymentsCreate, RecoveryPaymentsResponse, }; #[cfg(feature = "v2")] use crate::payment_methods::{ ListMethodsForPaymentMethodsRequest, PaymentMethodListResponseForSession, }; use crate::{ payment_methods::{ self, ListCountriesCurrenciesRequest, ListCountriesCurrenciesResponse, PaymentMethodCollectLinkRenderRequest, PaymentMethodCollectLinkRequest, PaymentMethodCollectLinkResponse, PaymentMethodMigrateResponse, PaymentMethodResponse, PaymentMethodUpdate, }, payments::{ self, PaymentListConstraints, PaymentListFilters, PaymentListFiltersV2, PaymentListResponse, PaymentsAggregateResponse, PaymentsSessionResponse, RedirectionResponse, }, }; #[cfg(feature = "v1")] use crate::{ payment_methods::{PaymentMethodListRequest, PaymentMethodListResponse}, payments::{ ExtendedCardInfoResponse, PaymentIdType, PaymentListFilterConstraints, PaymentListResponseV2, PaymentsApproveRequest, PaymentsCancelPostCaptureRequest, PaymentsCancelRequest, PaymentsCaptureRequest, PaymentsCompleteAuthorizeRequest, PaymentsDynamicTaxCalculationRequest, PaymentsDynamicTaxCalculationResponse, PaymentsExternalAuthenticationRequest, PaymentsExternalAuthenticationResponse, PaymentsIncrementalAuthorizationRequest, PaymentsManualUpdateRequest, PaymentsManualUpdateResponse, PaymentsPostSessionTokensRequest, PaymentsPostSessionTokensResponse, PaymentsRejectRequest, PaymentsRetrieveRequest, PaymentsStartRequest, PaymentsUpdateMetadataRequest, PaymentsUpdateMetadataResponse, }, }; #[cfg(feature = "v1")] impl ApiEventMetric for PaymentsRetrieveRequest { fn get_api_event_type(&self) -> Option<ApiEventsType> { match self.resource_id { PaymentIdType::PaymentIntentId(ref id) => Some(ApiEventsType::Payment { payment_id: id.clone(), }), _ => None, } } } #[cfg(feature = "v1")] impl ApiEventMetric for PaymentsStartRequest { fn get_api_event_type(&self) -> Option<ApiEventsType> { Some(ApiEventsType::Payment { payment_id: self.payment_id.clone(), }) } } #[cfg(feature = "v1")] impl ApiEventMetric for PaymentsCaptureRequest { fn get_api_event_type(&self) -> Option<ApiEventsType> { Some(ApiEventsType::Payment { payment_id: self.payment_id.to_owned(), }) } } #[cfg(feature = "v1")] impl ApiEventMetric for PaymentsCompleteAuthorizeRequest { fn get_api_event_type(&self) -> Option<ApiEventsType> { Some(ApiEventsType::Payment { payment_id: self.payment_id.clone(), }) } } #[cfg(feature = "v1")] impl ApiEventMetric for PaymentsDynamicTaxCalculationRequest { fn get_api_event_type(&self) -> Option<ApiEventsType> { Some(ApiEventsType::Payment { payment_id: self.payment_id.clone(), }) } } #[cfg(feature = "v1")] impl ApiEventMetric for PaymentsPostSessionTokensRequest { fn get_api_event_type(&self) -> Option<ApiEventsType> { Some(ApiEventsType::Payment { payment_id: self.payment_id.clone(), }) } } #[cfg(feature = "v1")] impl ApiEventMetric for PaymentsUpdateMetadataRequest { fn get_api_event_type(&self) -> Option<ApiEventsType> { Some(ApiEventsType::Payment { payment_id: self.payment_id.clone(), }) } } #[cfg(feature = "v1")] impl ApiEventMetric for PaymentsUpdateMetadataResponse { fn get_api_event_type(&self) -> Option<ApiEventsType> { Some(ApiEventsType::Payment { payment_id: self.payment_id.clone(), }) } } #[cfg(feature = "v1")] impl ApiEventMetric for PaymentsPostSessionTokensResponse { fn get_api_event_type(&self) -> Option<ApiEventsType> { Some(ApiEventsType::Payment { payment_id: self.payment_id.clone(), }) } } #[cfg(feature = "v1")] impl ApiEventMetric for PaymentsDynamicTaxCalculationResponse {} #[cfg(feature = "v1")] impl ApiEventMetric for PaymentsCancelRequest { fn get_api_event_type(&self) -> Option<ApiEventsType> { Some(ApiEventsType::Payment { payment_id: self.payment_id.clone(), }) } } #[cfg(feature = "v1")] impl ApiEventMetric for PaymentsCancelPostCaptureRequest { fn get_api_event_type(&self) -> Option<ApiEventsType> { Some(ApiEventsType::Payment { payment_id: self.payment_id.clone(), }) } } #[cfg(feature = "v1")] impl ApiEventMetric for PaymentsApproveRequest { fn get_api_event_type(&self) -> Option<ApiEventsType> { Some(ApiEventsType::Payment { payment_id: self.payment_id.clone(), }) } } #[cfg(feature = "v1")] impl ApiEventMetric for PaymentsRejectRequest { fn get_api_event_type(&self) -> Option<ApiEventsType> { Some(ApiEventsType::Payment { payment_id: self.payment_id.clone(), }) } } #[cfg(feature = "v1")] impl ApiEventMetric for payments::PaymentsRequest { fn get_api_event_type(&self) -> Option<ApiEventsType> { match self.payment_id { Some(PaymentIdType::PaymentIntentId(ref id)) => Some(ApiEventsType::Payment { payment_id: id.clone(), }), _ => None, } } } #[cfg(feature = "v2")] impl ApiEventMetric for PaymentsCreateIntentRequest { fn get_api_event_type(&self) -> Option<ApiEventsType> { None } } #[cfg(feature = "v2")] impl ApiEventMetric for payments::GiftCardBalanceCheckResponse { fn get_api_event_type(&self) -> Option<ApiEventsType> { None } } #[cfg(feature = "v2")] impl ApiEventMetric for PaymentsRequest { fn get_api_event_type(&self) -> Option<ApiEventsType> { None } } #[cfg(feature = "v2")] impl ApiEventMetric for PaymentsGetIntentRequest { fn get_api_event_type(&self) -> Option<ApiEventsType> { Some(ApiEventsType::Payment { payment_id: self.id.clone(), }) } } #[cfg(feature = "v2")] impl ApiEventMetric for PaymentAttemptListRequest { fn get_api_event_type(&self) -> Option<ApiEventsType> { Some(ApiEventsType::Payment { payment_id: self.payment_intent_id.clone(), }) } } #[cfg(feature = "v2")] impl ApiEventMetric for PaymentAttemptListResponse { fn get_api_event_type(&self) -> Option<ApiEventsType> { None } } #[cfg(feature = "v2")] impl ApiEventMetric for PaymentsIntentResponse { fn get_api_event_type(&self) -> Option<ApiEventsType> { Some(ApiEventsType::Payment { payment_id: self.id.clone(), }) } } #[cfg(feature = "v2")] impl ApiEventMetric for payments::PaymentsResponse { fn get_api_event_type(&self) -> Option<ApiEventsType> { Some(ApiEventsType::Payment { payment_id: self.id.clone(), }) } } #[cfg(feature = "v2")] impl ApiEventMetric for payments::PaymentsCancelRequest { fn get_api_event_type(&self) -> Option<ApiEventsType> { None } } #[cfg(feature = "v2")] impl ApiEventMetric for payments::PaymentsCancelResponse { fn get_api_event_type(&self) -> Option<ApiEventsType> { Some(ApiEventsType::Payment { payment_id: self.id.clone(), }) } } #[cfg(feature = "v1")] impl ApiEventMetric for payments::PaymentsResponse { fn get_api_event_type(&self) -> Option<ApiEventsType> { Some(ApiEventsType::Payment { payment_id: self.payment_id.clone(), }) } } impl ApiEventMetric for PaymentMethodResponse { #[cfg(feature = "v1")] fn get_api_event_type(&self) -> Option<ApiEventsType> { Some(ApiEventsType::PaymentMethod { payment_method_id: self.payment_method_id.clone(), payment_method: self.payment_method, payment_method_type: self.payment_method_type, }) } #[cfg(feature = "v2")] fn get_api_event_type(&self) -> Option<ApiEventsType> { Some(ApiEventsType::PaymentMethod { payment_method_id: self.id.clone(), payment_method_type: self.payment_method_type, payment_method_subtype: self.payment_method_subtype, }) } } impl ApiEventMetric for PaymentMethodMigrateResponse { #[cfg(feature = "v1")] fn get_api_event_type(&self) -> Option<ApiEventsType> { Some(ApiEventsType::PaymentMethod { payment_method_id: self.payment_method_response.payment_method_id.clone(), payment_method: self.payment_method_response.payment_method, payment_method_type: self.payment_method_response.payment_method_type, }) } #[cfg(feature = "v2")] fn get_api_event_type(&self) -> Option<ApiEventsType> { Some(ApiEventsType::PaymentMethod { payment_method_id: self.payment_method_response.id.clone(), payment_method_type: self.payment_method_response.payment_method_type, payment_method_subtype: self.payment_method_response.payment_method_subtype, }) } } impl ApiEventMetric for PaymentMethodUpdate {} #[cfg(feature = "v1")] impl ApiEventMetric for payment_methods::DefaultPaymentMethod { fn get_api_event_type(&self) -> Option<ApiEventsType> { Some(ApiEventsType::PaymentMethod { payment_method_id: self.payment_method_id.clone(), payment_method: None, payment_method_type: None, }) } } #[cfg(feature = "v2")] impl ApiEventMetric for payment_methods::PaymentMethodDeleteResponse { fn get_api_event_type(&self) -> Option<ApiEventsType> { Some(ApiEventsType::PaymentMethod { payment_method_id: self.id.clone(), payment_method_type: None, payment_method_subtype: None, }) } } #[cfg(feature = "v1")] impl ApiEventMetric for payment_methods::PaymentMethodDeleteResponse { fn get_api_event_type(&self) -> Option<ApiEventsType> { Some(ApiEventsType::PaymentMethod { payment_method_id: self.payment_method_id.clone(), payment_method: None, payment_method_type: None, }) } } impl ApiEventMetric for payment_methods::CustomerPaymentMethodsListResponse {} #[cfg(feature = "v1")] impl ApiEventMetric for PaymentMethodListRequest { fn get_api_event_type(&self) -> Option<ApiEventsType> { Some(ApiEventsType::PaymentMethodList { payment_id: self .client_secret .as_ref() .and_then(|cs| cs.rsplit_once("_secret_")) .map(|(pid, _)| pid.to_string()), }) } } #[cfg(feature = "v2")] impl ApiEventMetric for ListMethodsForPaymentMethodsRequest { fn get_api_event_type(&self) -> Option<ApiEventsType> { Some(ApiEventsType::PaymentMethodList { payment_id: self .client_secret .as_ref() .and_then(|cs| cs.rsplit_once("_secret_")) .map(|(pid, _)| pid.to_string()), }) } } impl ApiEventMetric for ListCountriesCurrenciesRequest {} impl ApiEventMetric for ListCountriesCurrenciesResponse {} #[cfg(feature = "v1")] impl ApiEventMetric for PaymentMethodListResponse {} #[cfg(feature = "v1")] impl ApiEventMetric for payment_methods::CustomerDefaultPaymentMethodResponse { fn get_api_event_type(&self) -> Option<ApiEventsType> { Some(ApiEventsType::PaymentMethod { payment_method_id: self.default_payment_method_id.clone().unwrap_or_default(), payment_method: Some(self.payment_method), payment_method_type: self.payment_method_type, }) } } impl ApiEventMetric for PaymentMethodCollectLinkRequest { fn get_api_event_type(&self) -> Option<ApiEventsType> { self.pm_collect_link_id .as_ref() .map(|id| ApiEventsType::PaymentMethodCollectLink { link_id: id.clone(), }) } } impl ApiEventMetric for PaymentMethodCollectLinkRenderRequest { fn get_api_event_type(&self) -> Option<ApiEventsType> { Some(ApiEventsType::PaymentMethodCollectLink { link_id: self.pm_collect_link_id.clone(), }) } } impl ApiEventMetric for PaymentMethodCollectLinkResponse { fn get_api_event_type(&self) -> Option<ApiEventsType> { Some(ApiEventsType::PaymentMethodCollectLink { link_id: self.pm_collect_link_id.clone(), }) } } #[cfg(feature = "v1")] impl ApiEventMetric for PaymentListFilterConstraints { fn get_api_event_type(&self) -> Option<ApiEventsType> { Some(ApiEventsType::ResourceListAPI) } } impl ApiEventMetric for PaymentListFilters { fn get_api_event_type(&self) -> Option<ApiEventsType> { Some(ApiEventsType::ResourceListAPI) } } impl ApiEventMetric for PaymentListFiltersV2 { fn get_api_event_type(&self) -> Option<ApiEventsType> { Some(ApiEventsType::ResourceListAPI) } } impl ApiEventMetric for PaymentListConstraints { fn get_api_event_type(&self) -> Option<ApiEventsType> { Some(ApiEventsType::ResourceListAPI) } } impl ApiEventMetric for PaymentListResponse { fn get_api_event_type(&self) -> Option<ApiEventsType> { Some(ApiEventsType::ResourceListAPI) } } #[cfg(feature = "v2")] impl ApiEventMetric for RecoveryPaymentsCreate { fn get_api_event_type(&self) -> Option<ApiEventsType> { None } } #[cfg(feature = "v2")] impl ApiEventMetric for RecoveryPaymentsResponse { fn get_api_event_type(&self) -> Option<ApiEventsType> { None } } #[cfg(feature = "v1")] impl ApiEventMetric for PaymentListResponseV2 { fn get_api_event_type(&self) -> Option<ApiEventsType> { Some(ApiEventsType::ResourceListAPI) } } impl ApiEventMetric for PaymentsAggregateResponse { fn get_api_event_type(&self) -> Option<ApiEventsType> { Some(ApiEventsType::ResourceListAPI) } } impl ApiEventMetric for RedirectionResponse {} #[cfg(feature = "v1")] impl ApiEventMetric for PaymentsIncrementalAuthorizationRequest { fn get_api_event_type(&self) -> Option<ApiEventsType> { Some(ApiEventsType::Payment { payment_id: self.payment_id.clone(), }) } } #[cfg(feature = "v1")] impl ApiEventMetric for PaymentsExternalAuthenticationResponse {} #[cfg(feature = "v1")] impl ApiEventMetric for PaymentsExternalAuthenticationRequest { fn get_api_event_type(&self) -> Option<ApiEventsType> { Some(ApiEventsType::Payment { payment_id: self.payment_id.clone(), }) } } #[cfg(feature = "v1")] impl ApiEventMetric for ExtendedCardInfoResponse {} #[cfg(feature = "v1")] impl ApiEventMetric for PaymentsManualUpdateRequest { fn get_api_event_type(&self) -> Option<ApiEventsType> { Some(ApiEventsType::Payment { payment_id: self.payment_id.clone(), }) } } #[cfg(feature = "v1")] impl ApiEventMetric for PaymentsManualUpdateResponse { fn get_api_event_type(&self) -> Option<ApiEventsType> { Some(ApiEventsType::Payment { payment_id: self.payment_id.clone(), }) } } impl ApiEventMetric for PaymentsSessionResponse { fn get_api_event_type(&self) -> Option<ApiEventsType> { Some(ApiEventsType::Payment { payment_id: self.payment_id.clone(), }) } } #[cfg(feature = "v2")] impl ApiEventMetric for PaymentStartRedirectionRequest { fn get_api_event_type(&self) -> Option<ApiEventsType> { Some(ApiEventsType::Payment { payment_id: self.id.clone(), }) } } #[cfg(feature = "v2")] impl ApiEventMetric for payments::PaymentMethodListResponseForPayments { // Payment id would be populated by the request fn get_api_event_type(&self) -> Option<ApiEventsType> { None } } #[cfg(feature = "v2")] impl ApiEventMetric for PaymentMethodListResponseForSession {} #[cfg(feature = "v2")] impl ApiEventMetric for payments::PaymentsCaptureResponse { fn get_api_event_type(&self) -> Option<ApiEventsType> { Some(ApiEventsType::Payment { payment_id: self.id.clone(), }) } }
crates/api_models/src/events/payment.rs
api_models
full_file
null
null
null
3,730
null
null
null
null
null
null
null
// Implementation: impl Helcim // File: crates/hyperswitch_connectors/src/connectors/helcim.rs // Module: hyperswitch_connectors // Methods: 1 total (1 public) impl Helcim
crates/hyperswitch_connectors/src/connectors/helcim.rs
hyperswitch_connectors
impl_block
null
null
null
49
null
Helcim
null
1
1
null
null
// Struct: TesouroErrorResponse // File: crates/hyperswitch_connectors/src/connectors/tesouro/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct TesouroErrorResponse
crates/hyperswitch_connectors/src/connectors/tesouro/transformers.rs
hyperswitch_connectors
struct_definition
TesouroErrorResponse
0
[]
48
null
null
null
null
null
null
null
// Implementation: impl api::PaymentSync for for Barclaycard // File: crates/hyperswitch_connectors/src/connectors/barclaycard.rs // Module: hyperswitch_connectors // Methods: 0 total (0 public) impl api::PaymentSync for for Barclaycard
crates/hyperswitch_connectors/src/connectors/barclaycard.rs
hyperswitch_connectors
impl_block
null
null
null
61
null
Barclaycard
api::PaymentSync for
0
0
null
null
// Struct: Archipel3DS // File: crates/hyperswitch_connectors/src/connectors/archipel/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct Archipel3DS
crates/hyperswitch_connectors/src/connectors/archipel/transformers.rs
hyperswitch_connectors
struct_definition
Archipel3DS
0
[]
49
null
null
null
null
null
null
null
// Struct: MandateCard // File: crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct MandateCard
crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs
hyperswitch_connectors
struct_definition
MandateCard
0
[]
49
null
null
null
null
null
null
null
// Function: api_key_retrieve // File: crates/openapi/src/routes/api_keys.rs // Module: openapi pub fn api_key_retrieve()
crates/openapi/src/routes/api_keys.rs
openapi
function_signature
null
null
null
33
api_key_retrieve
null
null
null
null
null
null
// Struct: CardRange // File: crates/hyperswitch_connectors/src/connectors/netcetera/transformers.rs // Module: hyperswitch_connectors // Implementations: 1 pub struct CardRange
crates/hyperswitch_connectors/src/connectors/netcetera/transformers.rs
hyperswitch_connectors
struct_definition
CardRange
1
[]
47
null
null
null
null
null
null
null
// Implementation: impl Responder // File: crates/router/src/routes/api_keys.rs // Module: router // Methods: 0 total (0 public) impl Responder
crates/router/src/routes/api_keys.rs
router
impl_block
null
null
null
36
null
Responder
null
0
0
null
null
// Module Structure // File: crates/hyperswitch_connectors/src/connectors/rapyd.rs // Module: hyperswitch_connectors // Public submodules: pub mod transformers;
crates/hyperswitch_connectors/src/connectors/rapyd.rs
hyperswitch_connectors
module_structure
null
null
null
39
null
null
null
null
null
1
0
// Module Structure // File: crates/hyperswitch_domain_models/src/lib.rs // Module: hyperswitch_domain_models // Public submodules: pub mod address; pub mod api; pub mod authentication; pub mod behaviour; pub mod bulk_tokenization; pub mod business_profile; pub mod callback_mapper; pub mod card_testing_guard_data; pub mod cards_info; pub mod chat; pub mod connector_endpoints; pub mod consts; pub mod customer; pub mod disputes; pub mod errors; // ... and 27 more
crates/hyperswitch_domain_models/src/lib.rs
hyperswitch_domain_models
module_structure
null
null
null
109
null
null
null
null
null
42
0
// Function: internal_sync_refund_with_gateway // File: crates/router/src/core/refunds_v2.rs // Module: router pub fn internal_sync_refund_with_gateway( state: &SessionState, merchant_context: &domain::MerchantContext, payment_attempt: &storage::PaymentAttempt, payment_intent: &storage::PaymentIntent, refund: &diesel_refund::Refund, merchant_connector_details: common_types::domain::MerchantConnectorAuthDetails, ) -> errors::RouterResult<diesel_refund::Refund>
crates/router/src/core/refunds_v2.rs
router
function_signature
null
null
null
115
internal_sync_refund_with_gateway
null
null
null
null
null
null
// Function: create_finish_redirection_url // File: crates/hyperswitch_domain_models/src/payments.rs // Module: hyperswitch_domain_models // Documentation: This is the url to which the customer will be redirected to, after completing the redirection flow pub fn create_finish_redirection_url( &self, base_url: &str, publishable_key: &str, ) -> CustomResult<url::Url, errors::api_error_response::ApiErrorResponse>
crates/hyperswitch_domain_models/src/payments.rs
hyperswitch_domain_models
function_signature
null
null
null
100
create_finish_redirection_url
null
null
null
null
null
null
// Implementation: impl Poll // File: crates/router/src/routes/app.rs // Module: router // Methods: 1 total (1 public) impl Poll
crates/router/src/routes/app.rs
router
impl_block
null
null
null
33
null
Poll
null
1
1
null
null