id
stringlengths
11
116
type
stringclasses
1 value
granularity
stringclasses
4 values
content
stringlengths
16
477k
metadata
dict
fn_clm_router_payouts_list_available_filters_for_profile_-5579759040077786759
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/payouts pub async fn payouts_list_available_filters_for_profile( state: web::Data<AppState>, req: HttpRequest, json_payload: web::Json<common_utils::types::TimeRange>, ) -> HttpResponse { let flow = Flow::PayoutsFilter; let payload = json_payload.into_inner(); Box::pin(api::server_wrap( flow, state, &req, payload, |state, auth: auth::AuthenticationData, req, _| { let merchant_context = domain::MerchantContext::NormalMerchant(Box::new( domain::Context(auth.merchant_account, auth.key_store), )); payouts_list_available_filters_core( state, merchant_context, auth.profile_id.map(|profile_id| vec![profile_id]), req, ) }, auth::auth_type( &auth::HeaderAuth(auth::ApiKeyAuth { is_connected_allowed: false, is_platform_allowed: false, }), &auth::JWTAuth { permission: Permission::ProfilePayoutRead, }, req.headers(), ), api_locking::LockAction::NotApplicable, )) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 32, "total_crates": null }
fn_clm_router_frm_fulfillment_1512346102432244988
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/fraud_check pub async fn frm_fulfillment( state: web::Data<AppState>, req: HttpRequest, json_payload: web::Json<frm_core::types::FrmFulfillmentRequest>, ) -> HttpResponse { let flow = Flow::FrmFulfillment; Box::pin(api::server_wrap( flow, state.clone(), &req, json_payload.into_inner(), |state, auth: services::authentication::AuthenticationData, req, _| { let merchant_context = domain::MerchantContext::NormalMerchant(Box::new( domain::Context(auth.merchant_account, auth.key_store), )); frm_core::frm_fulfillment_core(state, merchant_context, req) }, &services::authentication::ApiKeyAuth { is_connected_allowed: false, is_platform_allowed: false, }, api_locking::LockAction::NotApplicable, )) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 26, "total_crates": null }
fn_clm_router_from_-1903156050771423972
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/lock_utils // Implementation of ApiIdentifier for From<Flow> fn from(flow: Flow) -> Self { match flow { Flow::MerchantsAccountCreate | Flow::MerchantsAccountRetrieve | Flow::MerchantsAccountUpdate | Flow::MerchantsAccountDelete | Flow::MerchantTransferKey | Flow::MerchantAccountList | Flow::EnablePlatformAccount => Self::MerchantAccount, Flow::OrganizationCreate | Flow::OrganizationRetrieve | Flow::OrganizationUpdate => { Self::Organization } Flow::RoutingCreateConfig | Flow::RoutingLinkConfig | Flow::RoutingUnlinkConfig | Flow::RoutingRetrieveConfig | Flow::RoutingRetrieveActiveConfig | Flow::RoutingRetrieveDefaultConfig | Flow::RoutingRetrieveDictionary | Flow::RoutingUpdateConfig | Flow::RoutingUpdateDefaultConfig | Flow::RoutingDeleteConfig | Flow::DecisionManagerDeleteConfig | Flow::DecisionManagerRetrieveConfig | Flow::ToggleDynamicRouting | Flow::CreateDynamicRoutingConfig | Flow::UpdateDynamicRoutingConfigs | Flow::DecisionManagerUpsertConfig | Flow::RoutingEvaluateRule | Flow::DecisionEngineRuleMigration | Flow::VolumeSplitOnRoutingType | Flow::DecisionEngineDecideGatewayCall | Flow::DecisionEngineGatewayFeedbackCall => Self::Routing, Flow::CreateSubscription | Flow::ConfirmSubscription | Flow::CreateAndConfirmSubscription | Flow::GetSubscription | Flow::UpdateSubscription | Flow::GetSubscriptionEstimate | Flow::GetPlansForSubscription => Self::Subscription, Flow::RetrieveForexFlow => Self::Forex, Flow::AddToBlocklist => Self::Blocklist, Flow::DeleteFromBlocklist => Self::Blocklist, Flow::ListBlocklist => Self::Blocklist, Flow::ToggleBlocklistGuard => Self::Blocklist, Flow::MerchantConnectorsCreate | Flow::MerchantConnectorsRetrieve | Flow::MerchantConnectorsUpdate | Flow::MerchantConnectorsDelete | Flow::MerchantConnectorsList => Self::MerchantConnector, Flow::ConfigKeyCreate | Flow::ConfigKeyFetch | Flow::ConfigKeyUpdate | Flow::ConfigKeyDelete | Flow::CreateConfigKey => Self::Configs, Flow::CustomersCreate | Flow::CustomersRetrieve | Flow::CustomersUpdate | Flow::CustomersDelete | Flow::CustomersGetMandates | Flow::CustomersList | Flow::CustomersListWithConstraints => Self::Customers, Flow::EphemeralKeyCreate | Flow::EphemeralKeyDelete => Self::Ephemeral, Flow::DeepHealthCheck | Flow::HealthCheck => Self::Health, Flow::MandatesRetrieve | Flow::MandatesRevoke | Flow::MandatesList => Self::Mandates, Flow::PaymentMethodsCreate | Flow::PaymentMethodsMigrate | Flow::PaymentMethodsBatchUpdate | Flow::PaymentMethodsList | Flow::CustomerPaymentMethodsList | Flow::GetPaymentMethodTokenData | Flow::PaymentMethodsRetrieve | Flow::PaymentMethodsUpdate | Flow::PaymentMethodsDelete | Flow::NetworkTokenStatusCheck | Flow::PaymentMethodCollectLink | Flow::ValidatePaymentMethod | Flow::ListCountriesCurrencies | Flow::DefaultPaymentMethodsSet | Flow::PaymentMethodSave | Flow::TotalPaymentMethodCount => Self::PaymentMethods, Flow::PmAuthLinkTokenCreate | Flow::PmAuthExchangeToken => Self::PaymentMethodAuth, Flow::PaymentsCreate | Flow::PaymentsRetrieve | Flow::PaymentsRetrieveForceSync | Flow::PaymentsUpdate | Flow::PaymentsConfirm | Flow::PaymentsCapture | Flow::PaymentsCancel | Flow::PaymentsCancelPostCapture | Flow::PaymentsApprove | Flow::PaymentsReject | Flow::PaymentsSessionToken | Flow::PaymentsStart | Flow::PaymentsList | Flow::PaymentsFilters | Flow::PaymentsAggregate | Flow::PaymentsRedirect | Flow::PaymentsIncrementalAuthorization | Flow::PaymentsExtendAuthorization | Flow::PaymentsExternalAuthentication | Flow::PaymentsAuthorize | Flow::GetExtendedCardInfo | Flow::PaymentsCompleteAuthorize | Flow::PaymentsManualUpdate | Flow::SessionUpdateTaxCalculation | Flow::PaymentsConfirmIntent | Flow::PaymentsCreateIntent | Flow::PaymentsGetIntent | Flow::GiftCardBalanceCheck | Flow::PaymentsPostSessionTokens | Flow::PaymentsUpdateMetadata | Flow::PaymentsUpdateIntent | Flow::PaymentsCreateAndConfirmIntent | Flow::PaymentStartRedirection | Flow::ProxyConfirmIntent | Flow::PaymentsRetrieveUsingMerchantReferenceId | Flow::PaymentAttemptsList | Flow::RecoveryPaymentsCreate | Flow::PaymentsSubmitEligibility => Self::Payments, Flow::PayoutsCreate | Flow::PayoutsRetrieve | Flow::PayoutsUpdate | Flow::PayoutsCancel | Flow::PayoutsFulfill | Flow::PayoutsList | Flow::PayoutsFilter | Flow::PayoutsAccounts | Flow::PayoutsConfirm | Flow::PayoutLinkInitiate => Self::Payouts, Flow::RefundsCreate | Flow::RefundsRetrieve | Flow::RefundsRetrieveForceSync | Flow::RefundsUpdate | Flow::RefundsList | Flow::RefundsFilters | Flow::RefundsAggregate | Flow::RefundsManualUpdate => Self::Refunds, Flow::Relay | Flow::RelayRetrieve => Self::Relay, Flow::FrmFulfillment | Flow::IncomingWebhookReceive | Flow::IncomingRelayWebhookReceive | Flow::WebhookEventInitialDeliveryAttemptList | Flow::WebhookEventDeliveryAttemptList | Flow::WebhookEventDeliveryRetry | Flow::RecoveryIncomingWebhookReceive | Flow::IncomingNetworkTokenWebhookReceive => Self::Webhooks, Flow::ApiKeyCreate | Flow::ApiKeyRetrieve | Flow::ApiKeyUpdate | Flow::ApiKeyRevoke | Flow::ApiKeyList => Self::ApiKeys, Flow::DisputesRetrieve | Flow::DisputesList | Flow::DisputesFilters | Flow::DisputesEvidenceSubmit | Flow::AttachDisputeEvidence | Flow::RetrieveDisputeEvidence | Flow::DisputesAggregate | Flow::DeleteDisputeEvidence => Self::Disputes, Flow::CardsInfo | Flow::CardsInfoCreate | Flow::CardsInfoUpdate | Flow::CardsInfoMigrate => Self::CardsInfo, Flow::CreateFile | Flow::DeleteFile | Flow::RetrieveFile => Self::Files, Flow::CacheInvalidate => Self::Cache, Flow::ProfileCreate | Flow::ProfileUpdate | Flow::ProfileRetrieve | Flow::ProfileDelete | Flow::ProfileList | Flow::ToggleExtendedCardInfo | Flow::ToggleConnectorAgnosticMit => Self::Profile, Flow::PaymentLinkRetrieve | Flow::PaymentLinkInitiate | Flow::PaymentSecureLinkInitiate | Flow::PaymentLinkList | Flow::PaymentLinkStatus => Self::PaymentLink, Flow::Verification => Self::Verification, Flow::RustLockerMigration => Self::RustLockerMigration, Flow::GsmRuleCreate | Flow::GsmRuleRetrieve | Flow::GsmRuleUpdate | Flow::GsmRuleDelete => Self::Gsm, Flow::ApplePayCertificatesMigration => Self::ApplePayCertificatesMigration, Flow::UserConnectAccount | Flow::UserSignUp | Flow::UserSignIn | Flow::Signout | Flow::ChangePassword | Flow::SetDashboardMetadata | Flow::GetMultipleDashboardMetadata | Flow::VerifyPaymentConnector | Flow::InternalUserSignup | Flow::TenantUserCreate | Flow::SwitchOrg | Flow::SwitchMerchantV2 | Flow::SwitchProfile | Flow::CreatePlatformAccount | Flow::UserOrgMerchantCreate | Flow::UserMerchantAccountCreate | Flow::GenerateSampleData | Flow::DeleteSampleData | Flow::GetUserDetails | Flow::GetUserRoleDetails | Flow::ForgotPassword | Flow::ResetPassword | Flow::RotatePassword | Flow::InviteMultipleUser | Flow::ReInviteUser | Flow::UserSignUpWithMerchantId | Flow::VerifyEmail | Flow::AcceptInviteFromEmail | Flow::VerifyEmailRequest | Flow::UpdateUserAccountDetails | Flow::TotpBegin | Flow::TotpReset | Flow::TotpVerify | Flow::TotpUpdate | Flow::RecoveryCodeVerify | Flow::RecoveryCodesGenerate | Flow::TerminateTwoFactorAuth | Flow::TwoFactorAuthStatus | Flow::CreateUserAuthenticationMethod | Flow::UpdateUserAuthenticationMethod | Flow::ListUserAuthenticationMethods | Flow::UserTransferKey | Flow::GetSsoAuthUrl | Flow::SignInWithSso | Flow::ListOrgForUser | Flow::ListMerchantsForUserInOrg | Flow::ListProfileForUserInOrgAndMerchant | Flow::ListInvitationsForUser | Flow::AuthSelect | Flow::GetThemeUsingLineage | Flow::GetThemeUsingThemeId | Flow::UploadFileToThemeStorage | Flow::CreateTheme | Flow::UpdateTheme | Flow::DeleteTheme | Flow::CreateUserTheme | Flow::UpdateUserTheme | Flow::DeleteUserTheme | Flow::GetUserThemeUsingThemeId | Flow::UploadFileToUserThemeStorage | Flow::GetUserThemeUsingLineage | Flow::ListAllThemesInLineage | Flow::CloneConnector => Self::User, Flow::GetDataFromHyperswitchAiFlow | Flow::ListAllChatInteractions => Self::AiWorkflow, Flow::ListRolesV2 | Flow::ListInvitableRolesAtEntityLevel | Flow::ListUpdatableRolesAtEntityLevel | Flow::GetRole | Flow::GetRoleV2 | Flow::GetRoleFromToken | Flow::GetRoleFromTokenV2 | Flow::GetParentGroupsInfoForRoleFromToken | Flow::UpdateUserRole | Flow::GetAuthorizationInfo | Flow::GetRolesInfo | Flow::GetParentGroupInfo | Flow::AcceptInvitationsV2 | Flow::AcceptInvitationsPreAuth | Flow::DeleteUserRole | Flow::CreateRole | Flow::CreateRoleV2 | Flow::UpdateRole | Flow::UserFromEmail | Flow::ListUsersInLineage => Self::UserRole, Flow::GetActionUrl | Flow::SyncOnboardingStatus | Flow::ResetTrackingId => { Self::ConnectorOnboarding } Flow::ReconMerchantUpdate | Flow::ReconTokenRequest | Flow::ReconServiceRequest | Flow::ReconVerifyToken => Self::Recon, Flow::RetrievePollStatus => Self::Poll, Flow::FeatureMatrix => Self::Documentation, Flow::TokenizeCard | Flow::TokenizeCardUsingPaymentMethodId | Flow::TokenizeCardBatch => Self::CardNetworkTokenization, Flow::HypersenseTokenRequest | Flow::HypersenseVerifyToken | Flow::HypersenseSignoutToken => Self::Hypersense, Flow::PaymentMethodSessionCreate | Flow::PaymentMethodSessionRetrieve | Flow::PaymentMethodSessionConfirm | Flow::PaymentMethodSessionUpdateSavedPaymentMethod | Flow::PaymentMethodSessionDeleteSavedPaymentMethod | Flow::PaymentMethodSessionUpdate => Self::PaymentMethodSession, Flow::RevenueRecoveryRetrieve | Flow::RevenueRecoveryResume => Self::ProcessTracker, Flow::AuthenticationCreate | Flow::AuthenticationEligibility | Flow::AuthenticationSync | Flow::AuthenticationSyncPostUpdate | Flow::AuthenticationAuthenticate => Self::Authentication, Flow::Proxy => Self::Proxy, Flow::ProfileAcquirerCreate | Flow::ProfileAcquirerUpdate => Self::ProfileAcquirer, Flow::ThreeDsDecisionRuleExecute => Self::ThreeDsDecisionRule, Flow::TokenizationCreate | Flow::TokenizationRetrieve | Flow::TokenizationDelete => { Self::GenericTokenization } Flow::RecoveryDataBackfill | Flow::RevenueRecoveryRedis => Self::RecoveryRecovery, } }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 2600, "total_crates": null }
fn_clm_router_card_iin_info_1533629363876500076
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/cards_info pub async fn card_iin_info( state: web::Data<AppState>, req: HttpRequest, path: web::Path<String>, payload: web::Query<api_models::cards_info::CardsInfoRequestParams>, ) -> impl Responder { let card_iin = path.into_inner(); let request_params = payload.into_inner(); let payload = api_models::cards_info::CardsInfoRequest { client_secret: request_params.client_secret, card_iin, }; let api_auth = auth::ApiKeyAuth::default(); let (auth, _) = match auth::check_client_secret_and_get_auth(req.headers(), &payload, api_auth) { Ok((auth, _auth_flow)) => (auth, _auth_flow), Err(e) => return api::log_and_return_error_response(e), }; Box::pin(api::server_wrap( Flow::CardsInfo, state, &req, payload, |state, auth, req, _| { let merchant_context = domain::MerchantContext::NormalMerchant(Box::new( domain::Context(auth.merchant_account, auth.key_store), )); cards_info::retrieve_card_info(state, merchant_context, req) }, &*auth, api_locking::LockAction::NotApplicable, )) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 34, "total_crates": null }
fn_clm_router_migrate_cards_info_1533629363876500076
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/cards_info pub async fn migrate_cards_info( state: web::Data<AppState>, req: HttpRequest, MultipartForm(form): MultipartForm<cards_info::CardsInfoUpdateForm>, ) -> HttpResponse { let flow = Flow::CardsInfoMigrate; let records = match cards_info::get_cards_bin_records(form) { Ok(records) => records, Err(e) => return api::log_and_return_error_response(e.into()), }; Box::pin(api::server_wrap( flow, state.clone(), &req, records, |state, _, payload, _| cards_info::migrate_cards_info(state, payload), &auth::AdminApiAuth, api_locking::LockAction::NotApplicable, )) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 27, "total_crates": null }
fn_clm_router_create_cards_info_1533629363876500076
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/cards_info pub async fn create_cards_info( state: web::Data<AppState>, req: HttpRequest, json_payload: web::Json<cards_info_api_types::CardInfoCreateRequest>, ) -> impl Responder { let payload = json_payload.into_inner(); let flow = Flow::CardsInfoCreate; Box::pin(api::server_wrap( flow, state.clone(), &req, payload, |state, _, payload, _| cards_info::create_card_info(state, payload), &auth::AdminApiAuth, api_locking::LockAction::NotApplicable, )) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 20, "total_crates": null }
fn_clm_router_update_cards_info_1533629363876500076
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/cards_info pub async fn update_cards_info( state: web::Data<AppState>, req: HttpRequest, json_payload: web::Json<cards_info_api_types::CardInfoUpdateRequest>, ) -> impl Responder { let payload = json_payload.into_inner(); let flow = Flow::CardsInfoUpdate; Box::pin(api::server_wrap( flow, state.clone(), &req, payload, |state, _, payload, _| cards_info::update_card_info(state, payload), &auth::AdminApiAuth, api_locking::LockAction::NotApplicable, )) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 20, "total_crates": null }
fn_clm_router_revenue_recovery_data_backfill_2853958453635724134
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/revenue_recovery_data_backfill pub async fn revenue_recovery_data_backfill( state: web::Data<AppState>, req: HttpRequest, query: web::Query<BackfillQuery>, MultipartForm(form): MultipartForm<RevenueRecoveryDataBackfillForm>, ) -> HttpResponse { let flow = Flow::RecoveryDataBackfill; // Parse cutoff_time from query parameter let cutoff_datetime = match query .cutoff_time .as_ref() .map(|time_str| { time::PrimitiveDateTime::parse( time_str, &time::format_description::well_known::Iso8601::DEFAULT, ) }) .transpose() { Ok(datetime) => datetime, Err(err) => { return HttpResponse::BadRequest().json(serde_json::json!({ "error": format!("Invalid datetime format: {}. Use ISO8601: 2024-01-15T10:30:00", err) })); } }; let records = match form.validate_and_get_records_with_errors() { Ok(records) => records, Err(e) => { return HttpResponse::BadRequest().json(serde_json::json!({ "error": e.to_string() })); } }; Box::pin(api::server_wrap( flow, state, &req, records, |state, _, records, _req| { revenue_recovery_data_backfill::revenue_recovery_data_backfill( state, records.records, cutoff_datetime, ) }, &auth::V2AdminApiAuth, api_locking::LockAction::NotApplicable, )) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 37, "total_crates": null }
fn_clm_router_update_revenue_recovery_additional_redis_data_2853958453635724134
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/revenue_recovery_data_backfill pub async fn update_revenue_recovery_additional_redis_data( state: web::Data<AppState>, req: HttpRequest, json_payload: web::Json<UpdateTokenStatusRequest>, ) -> HttpResponse { let flow = Flow::RecoveryDataBackfill; Box::pin(api::server_wrap( flow, state, &req, json_payload.into_inner(), |state, _: (), request, _| { revenue_recovery_data_backfill::redis_update_additional_details_for_revenue_recovery( state, request, ) }, &auth::V2AdminApiAuth, api_locking::LockAction::NotApplicable, )) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 18, "total_crates": null }
fn_clm_router_revenue_recovery_data_backfill_status_2853958453635724134
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/revenue_recovery_data_backfill pub async fn revenue_recovery_data_backfill_status( state: web::Data<AppState>, req: HttpRequest, path: web::Path<String>, ) -> HttpResponse { let flow = Flow::RecoveryDataBackfill; let connector_customer_id = path.into_inner(); Box::pin(api::server_wrap( flow, state, &req, connector_customer_id, |state, _: (), id, _| { revenue_recovery_data_backfill::unlock_connector_customer_status(state, id) }, &auth::V2AdminApiAuth, api_locking::LockAction::NotApplicable, )) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 18, "total_crates": null }
fn_clm_router_config_key_update_557134874487103329
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/configs pub async fn config_key_update( state: web::Data<AppState>, req: HttpRequest, path: web::Path<String>, json_payload: web::Json<api_types::ConfigUpdate>, ) -> impl Responder { let flow = Flow::ConfigKeyUpdate; let mut payload = json_payload.into_inner(); let key = path.into_inner(); payload.key = key; api::server_wrap( flow, state, &req, &payload, |state, _, payload, _| configs::update_config(state, payload), &ADMIN_API_AUTH, api_locking::LockAction::NotApplicable, ) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 18, "total_crates": null }
fn_clm_router_config_key_create_557134874487103329
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/configs pub async fn config_key_create( state: web::Data<AppState>, req: HttpRequest, json_payload: web::Json<api_types::Config>, ) -> impl Responder { let flow = Flow::CreateConfigKey; let payload = json_payload.into_inner(); api::server_wrap( flow, state, &req, payload, |state, _, data, _| configs::set_config(state, data), &ADMIN_API_AUTH, api_locking::LockAction::NotApplicable, ) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 16, "total_crates": null }
fn_clm_router_config_key_retrieve_557134874487103329
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/configs pub async fn config_key_retrieve( state: web::Data<AppState>, req: HttpRequest, path: web::Path<String>, ) -> impl Responder { let flow = Flow::ConfigKeyFetch; let key = path.into_inner(); api::server_wrap( flow, state, &req, &key, |state, _, key, _| configs::read_config(state, key), &ADMIN_API_AUTH, api_locking::LockAction::NotApplicable, ) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 16, "total_crates": null }
fn_clm_router_config_key_delete_557134874487103329
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/configs pub async fn config_key_delete( state: web::Data<AppState>, req: HttpRequest, path: web::Path<String>, ) -> impl Responder { let flow = Flow::ConfigKeyDelete; let key = path.into_inner(); api::server_wrap( flow, state, &req, key, |state, _, key, _| configs::config_delete(state, key), &ADMIN_API_AUTH, api_locking::LockAction::NotApplicable, ) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 16, "total_crates": null }
fn_clm_router_render_payout_link_-4289410142655320076
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/payout_link pub async fn render_payout_link( state: web::Data<AppState>, req: actix_web::HttpRequest, path: web::Path<( common_utils::id_type::MerchantId, common_utils::id_type::PayoutId, )>, ) -> impl Responder { let flow = Flow::PayoutLinkInitiate; let (merchant_id, payout_id) = path.into_inner(); let payload = PayoutLinkInitiateRequest { merchant_id: merchant_id.clone(), payout_id, }; let headers = req.headers(); Box::pin(api::server_wrap( flow, state, &req, payload.clone(), |state, auth, req, _| { let merchant_context = domain::MerchantContext::NormalMerchant(Box::new( domain::Context(auth.merchant_account, auth.key_store), )); initiate_payout_link(state, merchant_context, req, headers) }, &auth::MerchantIdAuth(merchant_id), api_locking::LockAction::NotApplicable, )) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 32, "total_crates": null }
fn_clm_router_apple_pay_merchant_registration_4276695261805352229
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/verification pub async fn apple_pay_merchant_registration( state: web::Data<AppState>, req: HttpRequest, json_payload: web::Json<verifications::ApplepayMerchantVerificationRequest>, path: web::Path<common_utils::id_type::MerchantId>, ) -> impl Responder { let flow = Flow::Verification; let merchant_id = path.into_inner(); Box::pin(api::server_wrap( flow, state, &req, json_payload.into_inner(), |state, auth: auth::AuthenticationData, body, _| { verification::verify_merchant_creds_for_applepay( state.clone(), body, merchant_id.clone(), Some(auth.profile.get_id().clone()), ) }, auth::auth_type( &auth::V2ApiKeyAuth { is_connected_allowed: false, is_platform_allowed: false, }, &auth::JWTAuth { permission: Permission::ProfileAccountWrite, }, req.headers(), ), api_locking::LockAction::NotApplicable, )) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 32, "total_crates": null }
fn_clm_router_retrieve_apple_pay_verified_domains_4276695261805352229
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/verification pub async fn retrieve_apple_pay_verified_domains( state: web::Data<AppState>, req: HttpRequest, params: web::Query<verifications::ApplepayGetVerifiedDomainsParam>, ) -> impl Responder { let flow = Flow::Verification; let merchant_id = &params.merchant_id; let mca_id = &params.merchant_connector_account_id; Box::pin(api::server_wrap( flow, state, &req, merchant_id.clone(), |state, _: auth::AuthenticationData, _, _| { verification::get_verified_apple_domains_with_mid_mca_id( state, merchant_id.to_owned(), mca_id.clone(), ) }, auth::auth_type( &auth::HeaderAuth(auth::ApiKeyAuth { is_connected_allowed: false, is_platform_allowed: false, }), &auth::JWTAuth { permission: Permission::MerchantAccountRead, }, req.headers(), ), api_locking::LockAction::NotApplicable, )) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 28, "total_crates": null }
fn_clm_router_get_locking_input_8675976497246847904
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/payments // Implementation of PaymentsGenericRequestWithResourceId<T> for GetLockingInput fn get_locking_input<F>(&self, flow: F) -> api_locking::LockAction where F: types::FlowMetric, lock_utils::ApiIdentifier: From<F>, { api_locking::LockAction::Hold { input: api_locking::LockingInput { unique_locking_key: self.global_payment_id.get_string_repr().to_owned(), api_identifier: lock_utils::ApiIdentifier::from(flow), override_lock_retries: None, }, } }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 131, "total_crates": null }
fn_clm_router_payments_create_8675976497246847904
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/payments pub async fn payments_create( state: web::Data<app::AppState>, req: actix_web::HttpRequest, json_payload: web::Json<payment_types::PaymentsRequest>, ) -> impl Responder { let flow = Flow::PaymentsCreate; let mut payload = json_payload.into_inner(); if let Err(err) = payload .validate() .map_err(|message| errors::ApiErrorResponse::InvalidRequestData { message }) { return api::log_and_return_error_response(err.into()); }; if let Some(api_enums::CaptureMethod::Scheduled) = payload.capture_method { return http_not_implemented(); }; if let Err(err) = get_or_generate_payment_id(&mut payload) { return api::log_and_return_error_response(err); } let header_payload = match HeaderPayload::foreign_try_from(req.headers()) { Ok(headers) => headers, Err(err) => { return api::log_and_return_error_response(err); } }; tracing::Span::current().record( "payment_id", payload .payment_id .as_ref() .map(|payment_id_type| payment_id_type.get_payment_intent_id()) .transpose() .unwrap_or_default() .as_ref() .map(|id| id.get_string_repr()) .unwrap_or_default(), ); let locking_action = payload.get_locking_input(flow.clone()); let auth_type = match env::which() { env::Env::Production => { &auth::InternalMerchantIdProfileIdAuth(auth::HeaderAuth(auth::ApiKeyAuth { is_connected_allowed: false, is_platform_allowed: true, })) } _ => auth::auth_type( &auth::InternalMerchantIdProfileIdAuth(auth::HeaderAuth(auth::ApiKeyAuth { is_connected_allowed: false, is_platform_allowed: true, })), &auth::InternalMerchantIdProfileIdAuth(auth::JWTAuth { permission: Permission::ProfilePaymentWrite, }), req.headers(), ), }; Box::pin(api::server_wrap( flow, state, &req, payload, |state, auth: auth::AuthenticationData, req, req_state| { let merchant_context = domain::MerchantContext::NormalMerchant(Box::new( domain::Context(auth.merchant_account, auth.key_store), )); authorize_verify_select::<_>( payments::PaymentCreate, state, req_state, merchant_context, auth.profile_id, header_payload.clone(), req, api::AuthFlow::Client, ) }, auth_type, locking_action, )) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 86, "total_crates": null }
fn_clm_router_payments_retrieve_8675976497246847904
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/payments pub async fn payments_retrieve( state: web::Data<app::AppState>, req: actix_web::HttpRequest, path: web::Path<common_utils::id_type::PaymentId>, json_payload: web::Query<payment_types::PaymentRetrieveBody>, ) -> impl Responder { let flow = match json_payload.force_sync { Some(true) => Flow::PaymentsRetrieveForceSync, _ => Flow::PaymentsRetrieve, }; let payment_id = path.into_inner(); tracing::Span::current().record("payment_id", payment_id.get_string_repr()); let payload = payment_types::PaymentsRetrieveRequest { resource_id: payment_types::PaymentIdType::PaymentIntentId(payment_id), merchant_id: json_payload.merchant_id.clone(), force_sync: json_payload.force_sync.unwrap_or(false), client_secret: json_payload.client_secret.clone(), expand_attempts: json_payload.expand_attempts, expand_captures: json_payload.expand_captures, all_keys_required: json_payload.all_keys_required, ..Default::default() }; let header_payload = match HeaderPayload::foreign_try_from(req.headers()) { Ok(headers) => headers, Err(err) => { return api::log_and_return_error_response(err); } }; tracing::Span::current().record("flow", flow.to_string()); let api_auth = auth::ApiKeyAuth { is_connected_allowed: false, is_platform_allowed: true, }; let (auth_type, auth_flow) = match auth::check_internal_api_key_auth( req.headers(), &payload, api_auth, state.conf.internal_merchant_id_profile_id_auth.clone(), ) { Ok(auth) => auth, Err(err) => return api::log_and_return_error_response(report!(err)), }; let locking_action = payload.get_locking_input(flow.clone()); Box::pin(api::server_wrap( flow, state, &req, payload, |state, auth: auth::AuthenticationData, req, req_state| { let merchant_context = domain::MerchantContext::NormalMerchant(Box::new( domain::Context(auth.merchant_account, auth.key_store), )); payments::payments_core::< api_types::PSync, payment_types::PaymentsResponse, _, _, _, payments::PaymentData<api_types::PSync>, >( state, req_state, merchant_context, auth.profile_id, payments::PaymentStatus, req, auth_flow, payments::CallConnectorAction::Trigger, None, header_payload.clone(), ) }, auth::auth_type( &*auth_type, &auth::JWTAuth { permission: Permission::ProfilePaymentRead, }, req.headers(), ), locking_action, )) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 68, "total_crates": null }
fn_clm_router_payments_confirm_8675976497246847904
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/payments pub async fn payments_confirm( state: web::Data<app::AppState>, req: actix_web::HttpRequest, json_payload: web::Json<payment_types::PaymentsRequest>, path: web::Path<common_utils::id_type::PaymentId>, ) -> impl Responder { let flow = Flow::PaymentsConfirm; let mut payload = json_payload.into_inner(); if let Err(err) = payload .validate() .map_err(|message| errors::ApiErrorResponse::InvalidRequestData { message }) { return api::log_and_return_error_response(err.into()); }; if let Some(api_enums::CaptureMethod::Scheduled) = payload.capture_method { return http_not_implemented(); }; let header_payload = match HeaderPayload::foreign_try_from(req.headers()) { Ok(headers) => headers, Err(err) => { return api::log_and_return_error_response(err); } }; if let Err(err) = helpers::populate_browser_info(&req, &mut payload, &header_payload) { return api::log_and_return_error_response(err); } let payment_id = path.into_inner(); tracing::Span::current().record("payment_id", payment_id.get_string_repr()); payload.payment_id = Some(payment_types::PaymentIdType::PaymentIntentId(payment_id)); payload.confirm = Some(true); let api_auth = auth::ApiKeyAuth { is_connected_allowed: false, is_platform_allowed: true, }; let (auth_type, auth_flow) = match auth::check_internal_api_key_auth( req.headers(), &payload, api_auth, state.conf.internal_merchant_id_profile_id_auth.clone(), ) { Ok(auth) => auth, Err(e) => return api::log_and_return_error_response(e), }; let locking_action = payload.get_locking_input(flow.clone()); Box::pin(api::server_wrap( flow, state, &req, payload, |state, auth: auth::AuthenticationData, req, req_state| { let merchant_context = domain::MerchantContext::NormalMerchant(Box::new( domain::Context(auth.merchant_account, auth.key_store), )); authorize_verify_select::<_>( payments::PaymentConfirm, state, req_state, merchant_context, auth.profile_id, header_payload.clone(), req, auth_flow, ) }, &*auth_type, locking_action, )) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 66, "total_crates": null }
fn_clm_router_payments_complete_authorize_8675976497246847904
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/payments pub async fn payments_complete_authorize( state: web::Data<app::AppState>, req: actix_web::HttpRequest, json_payload: web::Json<payment_types::PaymentsCompleteAuthorizeRequest>, path: web::Path<common_utils::id_type::PaymentId>, ) -> impl Responder { let flow = Flow::PaymentsCompleteAuthorize; let mut payload = json_payload.into_inner(); let payment_id = path.into_inner(); payload.payment_id.clone_from(&payment_id); tracing::Span::current().record("payment_id", payment_id.get_string_repr()); let payment_confirm_req = payment_types::PaymentsRequest { payment_id: Some(payment_types::PaymentIdType::PaymentIntentId( payment_id.clone(), )), shipping: payload.shipping.clone(), client_secret: Some(payload.client_secret.peek().clone()), threeds_method_comp_ind: payload.threeds_method_comp_ind.clone(), ..Default::default() }; let api_auth = auth::ApiKeyAuth { is_connected_allowed: false, is_platform_allowed: true, }; let (auth_type, auth_flow) = match auth::check_client_secret_and_get_auth(req.headers(), &payment_confirm_req, api_auth) { Ok(auth) => auth, Err(err) => return api::log_and_return_error_response(report!(err)), }; let locking_action = payload.get_locking_input(flow.clone()); Box::pin(api::server_wrap( flow, state, &req, payload, |state, auth: auth::AuthenticationData, _req, req_state| { let merchant_context = domain::MerchantContext::NormalMerchant(Box::new( domain::Context(auth.merchant_account, auth.key_store), )); payments::payments_core::< api_types::CompleteAuthorize, payment_types::PaymentsResponse, _, _, _, payments::PaymentData<api_types::CompleteAuthorize>, >( state.clone(), req_state, merchant_context, auth.profile_id, payments::operations::payment_complete_authorize::CompleteAuthorize, payment_confirm_req.clone(), auth_flow, payments::CallConnectorAction::Trigger, None, HeaderPayload::default(), ) }, &*auth_type, locking_action, )) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 62, "total_crates": null }
fn_clm_router_retrieve_dispute_-372201121203271291
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/disputes pub async fn retrieve_dispute( state: web::Data<AppState>, req: HttpRequest, path: web::Path<String>, json_payload: web::Query<dispute_models::DisputeRetrieveBody>, ) -> HttpResponse { let flow = Flow::DisputesRetrieve; let payload = dispute_models::DisputeRetrieveRequest { dispute_id: path.into_inner(), force_sync: json_payload.force_sync, }; Box::pin(api::server_wrap( flow, state, &req, payload, |state, auth: auth::AuthenticationData, req, _| { let merchant_context = domain::MerchantContext::NormalMerchant(Box::new( domain::Context(auth.merchant_account, auth.key_store), )); disputes::retrieve_dispute(state, merchant_context, auth.profile_id, req) }, auth::auth_type( &auth::HeaderAuth(auth::ApiKeyAuth { is_connected_allowed: false, is_platform_allowed: false, }), &auth::JWTAuth { permission: Permission::ProfileDisputeRead, }, req.headers(), ), api_locking::LockAction::NotApplicable, )) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 36, "total_crates": null }
fn_clm_router_retrieve_disputes_list_-372201121203271291
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/disputes pub async fn retrieve_disputes_list( state: web::Data<AppState>, req: HttpRequest, query: web::Query<dispute_models::DisputeListGetConstraints>, ) -> HttpResponse { let flow = Flow::DisputesList; let payload = query.into_inner(); Box::pin(api::server_wrap( flow, state, &req, payload, |state, auth: auth::AuthenticationData, req, _| { let merchant_context = domain::MerchantContext::NormalMerchant(Box::new( domain::Context(auth.merchant_account, auth.key_store), )); disputes::retrieve_disputes_list(state, merchant_context, None, req) }, auth::auth_type( &auth::HeaderAuth(auth::ApiKeyAuth { is_connected_allowed: false, is_platform_allowed: false, }), &auth::JWTAuth { permission: Permission::MerchantDisputeRead, }, req.headers(), ), api_locking::LockAction::NotApplicable, )) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 36, "total_crates": null }
fn_clm_router_fetch_disputes_-372201121203271291
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/disputes pub async fn fetch_disputes( state: web::Data<AppState>, req: HttpRequest, path: web::Path<String>, json_payload: web::Query<dispute_types::DisputeFetchQueryData>, ) -> HttpResponse { let flow = Flow::DisputesList; let connector_id = path.into_inner(); let payload = json_payload.into_inner(); Box::pin(api::server_wrap( flow, state, &req, payload, |state, auth: auth::AuthenticationData, req, _| { let merchant_context = domain::MerchantContext::NormalMerchant(Box::new( domain::Context(auth.merchant_account, auth.key_store), )); disputes::connector_sync_disputes(state, merchant_context, connector_id.clone(), req) }, auth::auth_type( &auth::HeaderAuth(auth::ApiKeyAuth { is_connected_allowed: false, is_platform_allowed: false, }), &auth::JWTAuth { permission: Permission::ProfileDisputeRead, }, req.headers(), ), api_locking::LockAction::NotApplicable, )) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 34, "total_crates": null }
fn_clm_router_accept_dispute_-372201121203271291
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/disputes pub async fn accept_dispute( state: web::Data<AppState>, req: HttpRequest, path: web::Path<String>, ) -> HttpResponse { let flow = Flow::DisputesRetrieve; let dispute_id = dispute_types::DisputeId { dispute_id: path.into_inner(), }; Box::pin(api::server_wrap( flow, state, &req, dispute_id, |state, auth: auth::AuthenticationData, req, _| { let merchant_context = domain::MerchantContext::NormalMerchant(Box::new( domain::Context(auth.merchant_account, auth.key_store), )); disputes::accept_dispute(state, merchant_context, auth.profile_id, req) }, auth::auth_type( &auth::HeaderAuth(auth::ApiKeyAuth { is_connected_allowed: false, is_platform_allowed: false, }), &auth::JWTAuth { permission: Permission::ProfileDisputeWrite, }, req.headers(), ), api_locking::LockAction::NotApplicable, )) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 33, "total_crates": null }
fn_clm_router_retrieve_dispute_evidence_-372201121203271291
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/disputes pub async fn retrieve_dispute_evidence( state: web::Data<AppState>, req: HttpRequest, path: web::Path<String>, ) -> HttpResponse { let flow = Flow::RetrieveDisputeEvidence; let dispute_id = dispute_types::DisputeId { dispute_id: path.into_inner(), }; Box::pin(api::server_wrap( flow, state, &req, dispute_id, |state, auth: auth::AuthenticationData, req, _| { let merchant_context = domain::MerchantContext::NormalMerchant(Box::new( domain::Context(auth.merchant_account, auth.key_store), )); disputes::retrieve_dispute_evidence(state, merchant_context, auth.profile_id, req) }, auth::auth_type( &auth::HeaderAuth(auth::ApiKeyAuth { is_connected_allowed: false, is_platform_allowed: false, }), &auth::JWTAuth { permission: Permission::ProfileDisputeRead, }, req.headers(), ), api_locking::LockAction::NotApplicable, )) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 33, "total_crates": null }
fn_clm_router_update_subscription_-1808138557104836612
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/subscription pub async fn update_subscription( state: web::Data<AppState>, req: HttpRequest, subscription_id: web::Path<common_utils::id_type::SubscriptionId>, json_payload: web::Json<subscription_types::UpdateSubscriptionRequest>, ) -> impl Responder { let flow = Flow::UpdateSubscription; let subscription_id = subscription_id.into_inner(); let profile_id = match extract_profile_id(&req) { Ok(id) => id, Err(response) => return response, }; Box::pin(oss_api::server_wrap( flow, state, &req, json_payload.into_inner(), |state, auth: auth::AuthenticationData, payload, _| { let merchant_context = domain::MerchantContext::NormalMerchant(Box::new( domain::Context(auth.merchant_account, auth.key_store), )); subscriptions::update_subscription( state.into(), merchant_context, profile_id.clone(), subscription_id.clone(), payload.clone(), ) }, &auth::HeaderAuth(auth::ApiKeyAuth { is_connected_allowed: false, is_platform_allowed: false, }), api_locking::LockAction::NotApplicable, )) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 53, "total_crates": null }
fn_clm_router_confirm_subscription_-1808138557104836612
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/subscription pub async fn confirm_subscription( state: web::Data<AppState>, req: HttpRequest, subscription_id: web::Path<common_utils::id_type::SubscriptionId>, json_payload: web::Json<subscription_types::ConfirmSubscriptionRequest>, ) -> impl Responder { let flow = Flow::ConfirmSubscription; let subscription_id = subscription_id.into_inner(); let payload = json_payload.into_inner(); let profile_id = match extract_profile_id(&req) { Ok(id) => id, Err(response) => return response, }; let api_auth = auth::ApiKeyAuth::default(); let (auth_type, _) = match auth::check_client_secret_and_get_auth(req.headers(), &payload, api_auth) { Ok(auth) => auth, Err(err) => return oss_api::log_and_return_error_response(error_stack::report!(err)), }; Box::pin(oss_api::server_wrap( flow, state, &req, payload, |state, auth: auth::AuthenticationData, payload, _| { let merchant_context = domain::MerchantContext::NormalMerchant(Box::new( domain::Context(auth.merchant_account, auth.key_store), )); subscriptions::confirm_subscription( state.into(), merchant_context, profile_id.clone(), payload.clone(), subscription_id.clone(), ) }, auth::auth_type( &*auth_type, &auth::JWTAuth { permission: Permission::ProfileSubscriptionWrite, }, req.headers(), ), api_locking::LockAction::NotApplicable, )) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 51, "total_crates": null }
fn_clm_router_extract_profile_id_-1808138557104836612
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/subscription fn extract_profile_id(req: &HttpRequest) -> Result<common_utils::id_type::ProfileId, HttpResponse> { let header_value = req.headers().get(X_PROFILE_ID).ok_or_else(|| { HttpResponse::BadRequest().json( errors::api_error_response::ApiErrorResponse::MissingRequiredField { field_name: X_PROFILE_ID, }, ) })?; let profile_str = header_value.to_str().unwrap_or_default(); if profile_str.is_empty() { return Err(HttpResponse::BadRequest().json( errors::api_error_response::ApiErrorResponse::MissingRequiredField { field_name: X_PROFILE_ID, }, )); } common_utils::id_type::ProfileId::from_str(profile_str).map_err(|_| { HttpResponse::BadRequest().json( errors::api_error_response::ApiErrorResponse::InvalidDataValue { field_name: X_PROFILE_ID, }, ) }) }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 49, "total_crates": null }
fn_clm_router_get_subscription_plans_-1808138557104836612
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/subscription pub async fn get_subscription_plans( state: web::Data<AppState>, req: HttpRequest, query: web::Query<subscription_types::GetPlansQuery>, ) -> impl Responder { let flow = Flow::GetPlansForSubscription; let api_auth = auth::ApiKeyAuth::default(); let payload = query.into_inner(); let profile_id = match extract_profile_id(&req) { Ok(profile_id) => profile_id, Err(response) => return response, }; let (auth_type, _) = match auth::check_client_secret_and_get_auth(req.headers(), &payload, api_auth) { Ok(auth) => auth, Err(err) => return oss_api::log_and_return_error_response(error_stack::report!(err)), }; Box::pin(oss_api::server_wrap( flow, state, &req, payload, |state, auth: auth::AuthenticationData, query, _| { let merchant_context = domain::MerchantContext::NormalMerchant(Box::new( domain::Context(auth.merchant_account, auth.key_store), )); subscriptions::get_subscription_plans( state.into(), merchant_context, profile_id.clone(), query, ) }, auth::auth_type( &*auth_type, &auth::JWTAuth { permission: Permission::ProfileSubscriptionRead, }, req.headers(), ), api_locking::LockAction::NotApplicable, )) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 48, "total_crates": null }
fn_clm_router_get_subscription_-1808138557104836612
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/subscription pub async fn get_subscription( state: web::Data<AppState>, req: HttpRequest, subscription_id: web::Path<common_utils::id_type::SubscriptionId>, ) -> impl Responder { let flow = Flow::GetSubscription; let subscription_id = subscription_id.into_inner(); let profile_id = match extract_profile_id(&req) { Ok(id) => id, Err(response) => return response, }; Box::pin(oss_api::server_wrap( flow, state, &req, (), |state, auth: auth::AuthenticationData, _, _| { let merchant_context = domain::MerchantContext::NormalMerchant(Box::new( domain::Context(auth.merchant_account, auth.key_store), )); subscriptions::get_subscription( state.into(), merchant_context, profile_id.clone(), subscription_id.clone(), ) }, auth::auth_type( &auth::HeaderAuth(auth::ApiKeyAuth { is_connected_allowed: false, is_platform_allowed: false, }), &auth::JWTAuth { permission: Permission::ProfileSubscriptionRead, }, req.headers(), ), api_locking::LockAction::NotApplicable, )) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 44, "total_crates": null }
fn_clm_router_list_blocked_payment_methods_-2455232197323537576
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/blocklist pub async fn list_blocked_payment_methods( state: web::Data<AppState>, req: HttpRequest, query_payload: web::Query<api_blocklist::ListBlocklistQuery>, ) -> HttpResponse { let flow = Flow::ListBlocklist; let payload = query_payload.into_inner(); let api_auth = auth::ApiKeyAuth { is_connected_allowed: false, is_platform_allowed: false, }; let (auth_type, _) = match auth::check_client_secret_and_get_auth(req.headers(), &payload, api_auth) { Ok(auth) => auth, Err(err) => return api::log_and_return_error_response(report!(err)), }; Box::pin(api::server_wrap( flow, state, &req, payload, |state, auth: auth::AuthenticationData, query, _| { let merchant_context = domain::MerchantContext::NormalMerchant(Box::new( domain::Context(auth.merchant_account, auth.key_store), )); blocklist::list_blocklist_entries(state, merchant_context, query) }, auth::auth_type( &*auth_type, &auth::JWTAuth { permission: Permission::MerchantAccountRead, }, req.headers(), ), api_locking::LockAction::NotApplicable, )) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 34, "total_crates": null }
fn_clm_router_add_entry_to_blocklist_-2455232197323537576
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/blocklist pub async fn add_entry_to_blocklist( state: web::Data<AppState>, req: HttpRequest, json_payload: web::Json<api_blocklist::AddToBlocklistRequest>, ) -> HttpResponse { let flow = Flow::AddToBlocklist; Box::pin(api::server_wrap( flow, state, &req, json_payload.into_inner(), |state, auth: auth::AuthenticationData, body, _| { let merchant_context = domain::MerchantContext::NormalMerchant(Box::new( domain::Context(auth.merchant_account, auth.key_store), )); blocklist::add_entry_to_blocklist(state, merchant_context, body) }, auth::auth_type( &auth::HeaderAuth(auth::ApiKeyAuth { is_connected_allowed: false, is_platform_allowed: false, }), &auth::JWTAuth { permission: Permission::MerchantAccountWrite, }, req.headers(), ), api_locking::LockAction::NotApplicable, )) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 33, "total_crates": null }
fn_clm_router_remove_entry_from_blocklist_-2455232197323537576
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/blocklist pub async fn remove_entry_from_blocklist( state: web::Data<AppState>, req: HttpRequest, json_payload: web::Json<api_blocklist::DeleteFromBlocklistRequest>, ) -> HttpResponse { let flow = Flow::DeleteFromBlocklist; Box::pin(api::server_wrap( flow, state, &req, json_payload.into_inner(), |state, auth: auth::AuthenticationData, body, _| { let merchant_context = domain::MerchantContext::NormalMerchant(Box::new( domain::Context(auth.merchant_account, auth.key_store), )); blocklist::remove_entry_from_blocklist(state, merchant_context, body) }, auth::auth_type( &auth::HeaderAuth(auth::ApiKeyAuth { is_connected_allowed: false, is_platform_allowed: false, }), &auth::JWTAuth { permission: Permission::MerchantAccountWrite, }, req.headers(), ), api_locking::LockAction::NotApplicable, )) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 33, "total_crates": null }
fn_clm_router_toggle_blocklist_guard_-2455232197323537576
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/blocklist pub async fn toggle_blocklist_guard( state: web::Data<AppState>, req: HttpRequest, query_payload: web::Query<api_blocklist::ToggleBlocklistQuery>, ) -> HttpResponse { let flow = Flow::ListBlocklist; Box::pin(api::server_wrap( flow, state, &req, query_payload.into_inner(), |state, auth: auth::AuthenticationData, query, _| { let merchant_context = domain::MerchantContext::NormalMerchant(Box::new( domain::Context(auth.merchant_account, auth.key_store), )); blocklist::toggle_blocklist_guard(state, merchant_context, query) }, auth::auth_type( &auth::HeaderAuth(auth::ApiKeyAuth { is_connected_allowed: false, is_platform_allowed: false, }), &auth::JWTAuth { permission: Permission::MerchantAccountWrite, }, req.headers(), ), api_locking::LockAction::NotApplicable, )) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 33, "total_crates": null }
fn_clm_router_update_user_authentication_method_6228449493035704208
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/user pub async fn update_user_authentication_method( state: web::Data<AppState>, req: HttpRequest, json_payload: web::Json<user_api::UpdateUserAuthenticationMethodRequest>, ) -> HttpResponse { let flow = Flow::UpdateUserAuthenticationMethod; Box::pin(api::server_wrap( flow, state.clone(), &req, json_payload.into_inner(), |state, _, req_body, _| user_core::update_user_authentication_method(state, req_body), &auth::AdminApiAuth, api_locking::LockAction::NotApplicable, )) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 32, "total_crates": null }
fn_clm_router_forgot_password_6228449493035704208
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/user pub async fn forgot_password( state: web::Data<AppState>, req: HttpRequest, payload: web::Json<user_api::ForgotPasswordRequest>, query: web::Query<user_api::AuthIdAndThemeIdQueryParam>, ) -> HttpResponse { let flow = Flow::ForgotPassword; let query_params = query.into_inner(); Box::pin(api::server_wrap( flow, state.clone(), &req, payload.into_inner(), |state, _: (), payload, _| { user_core::forgot_password( state, payload, query_params.auth_id.clone(), query_params.theme_id.clone(), ) }, &auth::NoAuth, api_locking::LockAction::NotApplicable, )) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 29, "total_crates": null }
fn_clm_router_sso_sign_6228449493035704208
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/user pub async fn sso_sign( state: web::Data<AppState>, req: HttpRequest, json_payload: web::Json<user_api::SsoSignInRequest>, ) -> HttpResponse { let flow = Flow::SignInWithSso; let payload = json_payload.into_inner(); Box::pin(api::server_wrap( flow, state.clone(), &req, payload, |state, user: Option<auth::UserFromSinglePurposeToken>, payload, _| { user_core::sso_sign(state, payload, user) }, auth::auth_type( &auth::NoAuth, &auth::SinglePurposeJWTAuth(TokenPurpose::SSO), req.headers(), ), api_locking::LockAction::NotApplicable, )) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 29, "total_crates": null }
fn_clm_router_user_signup_with_merchant_id_6228449493035704208
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/user pub async fn user_signup_with_merchant_id( state: web::Data<AppState>, http_req: HttpRequest, json_payload: web::Json<user_api::SignUpWithMerchantIdRequest>, query: web::Query<user_api::AuthIdAndThemeIdQueryParam>, ) -> HttpResponse { let flow = Flow::UserSignUpWithMerchantId; let req_payload = json_payload.into_inner(); let query_params = query.into_inner(); Box::pin(api::server_wrap( flow.clone(), state, &http_req, req_payload.clone(), |state, _, req_body, _| { user_core::signup_with_merchant_id( state, req_body, query_params.auth_id.clone(), query_params.theme_id.clone(), ) }, &auth::AdminApiAuth, api_locking::LockAction::NotApplicable, )) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 28, "total_crates": null }
fn_clm_router_user_connect_account_6228449493035704208
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/user pub async fn user_connect_account( state: web::Data<AppState>, http_req: HttpRequest, json_payload: web::Json<user_api::ConnectAccountRequest>, query: web::Query<user_api::AuthIdAndThemeIdQueryParam>, ) -> HttpResponse { let flow = Flow::UserConnectAccount; let req_payload = json_payload.into_inner(); let query_params = query.into_inner(); Box::pin(api::server_wrap( flow.clone(), state, &http_req, req_payload.clone(), |state, _: (), req_body, _| { user_core::connect_account( state, req_body, query_params.auth_id.clone(), query_params.theme_id.clone(), ) }, &auth::NoAuth, api_locking::LockAction::NotApplicable, )) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 28, "total_crates": null }
fn_clm_router_update_role_-241466186519839979
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/user_role pub async fn update_role( state: web::Data<AppState>, req: HttpRequest, json_payload: web::Json<role_api::UpdateRoleRequest>, path: web::Path<String>, ) -> HttpResponse { let flow = Flow::UpdateRole; let role_id = path.into_inner(); Box::pin(api::server_wrap( flow, state.clone(), &req, json_payload.into_inner(), |state, user, req, _| role_core::update_role(state, user, req, &role_id), &auth::JWTAuth { permission: Permission::MerchantUserWrite, }, api_locking::LockAction::NotApplicable, )) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 25, "total_crates": null }
fn_clm_router_accept_invitations_pre_auth_-241466186519839979
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/user_role pub async fn accept_invitations_pre_auth( state: web::Data<AppState>, req: HttpRequest, json_payload: web::Json<user_role_api::AcceptInvitationsPreAuthRequest>, ) -> HttpResponse { let flow = Flow::AcceptInvitationsPreAuth; let payload = json_payload.into_inner(); Box::pin(api::server_wrap( flow, state.clone(), &req, payload, |state, user, req_body, _| async move { user_role_core::accept_invitations_pre_auth(state, user, req_body).await }, &auth::SinglePurposeJWTAuth(TokenPurpose::AcceptInvite), api_locking::LockAction::NotApplicable, )) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 25, "total_crates": null }
fn_clm_router_get_parent_info_for_role_-241466186519839979
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/user_role pub async fn get_parent_info_for_role( state: web::Data<AppState>, req: HttpRequest, path: web::Path<String>, ) -> HttpResponse { let flow = Flow::GetRoleV2; let request_payload = user_role_api::role::GetRoleRequest { role_id: path.into_inner(), }; Box::pin(api::server_wrap( flow, state.clone(), &req, request_payload, |state, user, payload, _| async move { role_core::get_parent_info_for_role(state, user, payload).await }, &auth::JWTAuth { permission: Permission::ProfileUserRead, }, api_locking::LockAction::NotApplicable, )) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 23, "total_crates": null }
fn_clm_router_accept_invitations_v2_-241466186519839979
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/user_role pub async fn accept_invitations_v2( state: web::Data<AppState>, req: HttpRequest, json_payload: web::Json<user_role_api::AcceptInvitationsV2Request>, ) -> HttpResponse { let flow = Flow::AcceptInvitationsV2; let payload = json_payload.into_inner(); Box::pin(api::server_wrap( flow, state.clone(), &req, payload, |state, user, req_body, _| user_role_core::accept_invitations_v2(state, user, req_body), &auth::DashboardNoPermissionAuth, api_locking::LockAction::NotApplicable, )) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 23, "total_crates": null }
fn_clm_router_get_parent_group_info_-241466186519839979
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/user_role pub async fn get_parent_group_info( state: web::Data<AppState>, http_req: HttpRequest, query: web::Query<role_api::GetParentGroupsInfoQueryParams>, ) -> HttpResponse { let flow = Flow::GetParentGroupInfo; Box::pin(api::server_wrap( flow, state.clone(), &http_req, query.into_inner(), |state, user_from_token, request, _| async move { user_role_core::get_parent_group_info(state, user_from_token, request).await }, &auth::JWTAuth { permission: Permission::ProfileUserRead, }, api_locking::LockAction::NotApplicable, )) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 23, "total_crates": null }
fn_clm_router_files_create_3012772022715387752
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/files pub async fn files_create( state: web::Data<AppState>, req: HttpRequest, payload: Multipart, ) -> HttpResponse { let flow = Flow::CreateFile; let create_file_request_result = transformers::get_create_file_request(payload).await; let create_file_request = match create_file_request_result { Ok(valid_request) => valid_request, Err(err) => return api::log_and_return_error_response(err), }; Box::pin(api::server_wrap( flow, state, &req, create_file_request, |state, auth: auth::AuthenticationData, req, _| { let merchant_context = domain::MerchantContext::NormalMerchant(Box::new( domain::Context(auth.merchant_account, auth.key_store), )); files_create_core(state, merchant_context, req) }, auth::auth_type( &auth::HeaderAuth(auth::ApiKeyAuth { is_connected_allowed: false, is_platform_allowed: false, }), &auth::DashboardNoPermissionAuth, req.headers(), ), api_locking::LockAction::NotApplicable, )) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 32, "total_crates": null }
fn_clm_router_files_retrieve_3012772022715387752
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/files pub async fn files_retrieve( state: web::Data<AppState>, req: HttpRequest, path: web::Path<String>, json_payload: web::Query<file_types::FileRetrieveQuery>, ) -> HttpResponse { let flow = Flow::RetrieveFile; let file_id = files::FileRetrieveRequest { file_id: path.into_inner(), dispute_id: json_payload.dispute_id.clone(), }; Box::pin(api::server_wrap( flow, state, &req, file_id, |state, auth: auth::AuthenticationData, req, _| { let merchant_context = domain::MerchantContext::NormalMerchant(Box::new( domain::Context(auth.merchant_account, auth.key_store), )); files_retrieve_core(state, merchant_context, req) }, auth::auth_type( &auth::HeaderAuth(auth::ApiKeyAuth { is_connected_allowed: false, is_platform_allowed: false, }), &auth::DashboardNoPermissionAuth, req.headers(), ), api_locking::LockAction::NotApplicable, )) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 32, "total_crates": null }
fn_clm_router_files_delete_3012772022715387752
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/files pub async fn files_delete( state: web::Data<AppState>, req: HttpRequest, path: web::Path<String>, ) -> HttpResponse { let flow = Flow::DeleteFile; let file_id = files::FileId { file_id: path.into_inner(), }; Box::pin(api::server_wrap( flow, state, &req, file_id, |state, auth: auth::AuthenticationData, req, _| { let merchant_context = domain::MerchantContext::NormalMerchant(Box::new( domain::Context(auth.merchant_account, auth.key_store), )); files_delete_core(state, merchant_context, req) }, auth::auth_type( &auth::HeaderAuth(auth::ApiKeyAuth { is_connected_allowed: false, is_platform_allowed: false, }), &auth::DashboardNoPermissionAuth, req.headers(), ), api_locking::LockAction::NotApplicable, )) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 30, "total_crates": null }
fn_clm_router_recovery_receive_incoming_webhook_-5158236602761801294
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/recovery_webhooks pub async fn recovery_receive_incoming_webhook<W: types::OutgoingWebhookType>( state: web::Data<AppState>, req: HttpRequest, body: web::Bytes, path: web::Path<( common_utils::id_type::MerchantId, common_utils::id_type::ProfileId, common_utils::id_type::MerchantConnectorAccountId, )>, ) -> impl Responder { let flow = Flow::RecoveryIncomingWebhookReceive; let (merchant_id, profile_id, connector_id) = path.into_inner(); Box::pin(api::server_wrap( flow.clone(), state, &req, (), |state, auth, _, req_state| { let merchant_context = domain::MerchantContext::NormalMerchant(Box::new( domain::Context(auth.merchant_account, auth.key_store), )); webhooks::incoming_webhooks_wrapper::<W>( &flow, state.to_owned(), req_state, &req, merchant_context, auth.profile, &connector_id, body.clone(), false, ) }, &auth::MerchantIdAndProfileIdAuth { merchant_id, profile_id, }, api_locking::LockAction::NotApplicable, )) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 28, "total_crates": null }
fn_clm_router_profile_create_-7980504614590655901
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/profiles pub async fn profile_create( state: web::Data<AppState>, req: HttpRequest, json_payload: web::Json<admin::ProfileCreate>, ) -> HttpResponse { let flow = Flow::ProfileCreate; let payload = json_payload.into_inner(); if let Err(api_error) = payload .webhook_details .as_ref() .map(|details| { details .validate() .map_err(|message| errors::ApiErrorResponse::InvalidRequestData { message }) }) .transpose() { return api::log_and_return_error_response(api_error.into()); } Box::pin(api::server_wrap( flow, state, &req, payload, |state, auth::AuthenticationDataWithoutProfile { merchant_account, key_store, }, req, _| { let merchant_context = domain::MerchantContext::NormalMerchant(Box::new( domain::Context(merchant_account, key_store), )); create_profile(state, req, merchant_context) }, auth::auth_type( &auth::AdminApiAuthWithMerchantIdFromHeader, &auth::JWTAuthMerchantFromHeader { required_permission: permissions::Permission::MerchantAccountWrite, }, req.headers(), ), api_locking::LockAction::NotApplicable, )) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 42, "total_crates": null }
fn_clm_router_profile_update_-7980504614590655901
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/profiles pub async fn profile_update( state: web::Data<AppState>, req: HttpRequest, path: web::Path<common_utils::id_type::ProfileId>, json_payload: web::Json<api_models::admin::ProfileUpdate>, ) -> HttpResponse { let flow = Flow::ProfileUpdate; let profile_id = path.into_inner(); let payload = json_payload.into_inner(); if let Err(api_error) = payload .webhook_details .as_ref() .map(|details| { details .validate() .map_err(|message| errors::ApiErrorResponse::InvalidRequestData { message }) }) .transpose() { return api::log_and_return_error_response(api_error.into()); } Box::pin(api::server_wrap( flow, state, &req, payload, |state, auth::AuthenticationDataWithoutProfile { key_store, .. }, req, _| { update_profile(state, &profile_id, key_store, req) }, auth::auth_type( &auth::AdminApiAuthWithMerchantIdFromHeader, &auth::JWTAuthMerchantFromHeader { required_permission: permissions::Permission::MerchantAccountWrite, }, req.headers(), ), api_locking::LockAction::NotApplicable, )) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 38, "total_crates": null }
fn_clm_router_profiles_list_at_profile_level_-7980504614590655901
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/profiles pub async fn profiles_list_at_profile_level( state: web::Data<AppState>, req: HttpRequest, path: web::Path<common_utils::id_type::MerchantId>, ) -> HttpResponse { let flow = Flow::ProfileList; let merchant_id = path.into_inner(); Box::pin(api::server_wrap( flow, state, &req, merchant_id.clone(), |state, auth, merchant_id, _| { list_profile( state, merchant_id, auth.profile_id.map(|profile_id| vec![profile_id]), ) }, auth::auth_type( &auth::HeaderAuth(auth::ApiKeyAuthWithMerchantIdFromRoute(merchant_id.clone())), &auth::JWTAuthMerchantFromRoute { merchant_id, required_permission: permissions::Permission::ProfileAccountRead, }, req.headers(), ), api_locking::LockAction::NotApplicable, )) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 32, "total_crates": null }
fn_clm_router_payment_connector_list_profile_-7980504614590655901
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/profiles pub async fn payment_connector_list_profile( state: web::Data<AppState>, req: HttpRequest, path: web::Path<common_utils::id_type::MerchantId>, ) -> HttpResponse { let flow = Flow::MerchantConnectorsList; let merchant_id = path.into_inner(); api::server_wrap( flow, state, &req, merchant_id.to_owned(), |state, auth, merchant_id, _| { list_payment_connectors( state, merchant_id, auth.profile_id.map(|profile_id| vec![profile_id]), ) }, auth::auth_type( &auth::HeaderAuth(auth::ApiKeyAuthWithMerchantIdFromRoute(merchant_id.clone())), &auth::JWTAuthMerchantFromRoute { merchant_id, required_permission: permissions::Permission::ProfileConnectorRead, }, req.headers(), ), api_locking::LockAction::NotApplicable, ) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 30, "total_crates": null }
fn_clm_router_profiles_list_-7980504614590655901
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/profiles pub async fn profiles_list( state: web::Data<AppState>, req: HttpRequest, path: web::Path<common_utils::id_type::MerchantId>, ) -> HttpResponse { let flow = Flow::ProfileList; let merchant_id = path.into_inner(); Box::pin(api::server_wrap( flow, state, &req, merchant_id.clone(), |state, auth::AuthenticationDataWithoutProfile { .. }, merchant_id, _| { list_profile(state, merchant_id, None) }, auth::auth_type( &auth::AdminApiAuthWithMerchantIdFromRoute(merchant_id.clone()), &auth::JWTAuthMerchantFromRoute { merchant_id, required_permission: permissions::Permission::MerchantAccountRead, }, req.headers(), ), api_locking::LockAction::NotApplicable, )) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 28, "total_crates": null }
fn_clm_router_payment_connector_verify_3621194947953355548
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/verify_connector pub async fn payment_connector_verify( state: web::Data<AppState>, req: HttpRequest, json_payload: web::Json<VerifyConnectorRequest>, ) -> HttpResponse { let flow = Flow::VerifyPaymentConnector; Box::pin(services::server_wrap( flow, state, &req, json_payload.into_inner(), |state, auth: auth::AuthenticationData, req, _| { verify_connector::verify_connector_credentials(state, req, auth.profile_id) }, &auth::JWTAuth { permission: Permission::MerchantConnectorWrite, }, api_locking::LockAction::NotApplicable, )) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 18, "total_crates": null }
fn_clm_router_initiate_secure_payment_link_-3404231457079850673
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/payment_link pub async fn initiate_secure_payment_link( state: web::Data<AppState>, req: actix_web::HttpRequest, path: web::Path<( common_utils::id_type::MerchantId, common_utils::id_type::PaymentId, )>, ) -> impl Responder { let flow = Flow::PaymentSecureLinkInitiate; let (merchant_id, payment_id) = path.into_inner(); let payload = api_models::payments::PaymentLinkInitiateRequest { payment_id, merchant_id: merchant_id.clone(), }; let headers = req.headers(); Box::pin(api::server_wrap( flow, state, &req, payload.clone(), |state, auth: auth::AuthenticationData, _, _| { let merchant_context = domain::MerchantContext::NormalMerchant(Box::new( domain::Context(auth.merchant_account, auth.key_store), )); initiate_secure_payment_link_flow( state, merchant_context, payload.merchant_id.clone(), payload.payment_id.clone(), headers, ) }, &crate::services::authentication::MerchantIdAuth(merchant_id), api_locking::LockAction::NotApplicable, )) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 36, "total_crates": null }
fn_clm_router_initiate_payment_link_-3404231457079850673
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/payment_link pub async fn initiate_payment_link( state: web::Data<AppState>, req: actix_web::HttpRequest, path: web::Path<( common_utils::id_type::MerchantId, common_utils::id_type::PaymentId, )>, ) -> impl Responder { let flow = Flow::PaymentLinkInitiate; let (merchant_id, payment_id) = path.into_inner(); let payload = api_models::payments::PaymentLinkInitiateRequest { payment_id, merchant_id: merchant_id.clone(), }; Box::pin(api::server_wrap( flow, state, &req, payload.clone(), |state, auth: auth::AuthenticationData, _, _| { let merchant_context = domain::MerchantContext::NormalMerchant(Box::new( domain::Context(auth.merchant_account, auth.key_store), )); initiate_payment_link_flow( state, merchant_context, payload.merchant_id.clone(), payload.payment_id.clone(), ) }, &crate::services::authentication::MerchantIdAuth(merchant_id), api_locking::LockAction::NotApplicable, )) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 34, "total_crates": null }
fn_clm_router_payment_link_status_-3404231457079850673
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/payment_link pub async fn payment_link_status( state: web::Data<AppState>, req: actix_web::HttpRequest, path: web::Path<( common_utils::id_type::MerchantId, common_utils::id_type::PaymentId, )>, ) -> impl Responder { let flow = Flow::PaymentLinkStatus; let (merchant_id, payment_id) = path.into_inner(); let payload = api_models::payments::PaymentLinkInitiateRequest { payment_id, merchant_id: merchant_id.clone(), }; Box::pin(api::server_wrap( flow, state, &req, payload.clone(), |state, auth: auth::AuthenticationData, _, _| { let merchant_context = domain::MerchantContext::NormalMerchant(Box::new( domain::Context(auth.merchant_account, auth.key_store), )); get_payment_link_status( state, merchant_context, payload.merchant_id.clone(), payload.payment_id.clone(), ) }, &crate::services::authentication::MerchantIdAuth(merchant_id), api_locking::LockAction::NotApplicable, )) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 34, "total_crates": null }
fn_clm_router_payment_link_retrieve_-3404231457079850673
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/payment_link pub async fn payment_link_retrieve( state: web::Data<AppState>, req: actix_web::HttpRequest, path: web::Path<String>, json_payload: web::Query<api_models::payments::RetrievePaymentLinkRequest>, ) -> impl Responder { let flow = Flow::PaymentLinkRetrieve; let payload = json_payload.into_inner(); let api_auth = auth::ApiKeyAuth::default(); let (auth_type, _) = match auth::check_client_secret_and_get_auth(req.headers(), &payload, api_auth) { Ok(auth) => auth, Err(err) => return api::log_and_return_error_response(error_stack::report!(err)), }; api::server_wrap( flow, state, &req, payload.clone(), |state, _auth, _, _| retrieve_payment_link(state, path.clone()), &*auth_type, api_locking::LockAction::NotApplicable, ) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 28, "total_crates": null }
fn_clm_router_payments_link_list_-3404231457079850673
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/payment_link pub async fn payments_link_list( state: web::Data<AppState>, req: actix_web::HttpRequest, payload: web::Query<api_models::payments::PaymentLinkListConstraints>, ) -> impl Responder { let flow = Flow::PaymentLinkList; let payload = payload.into_inner(); Box::pin(api::server_wrap( flow, state, &req, payload, |state, auth: auth::AuthenticationData, payload, _| { list_payment_link(state, auth.merchant_account, payload) }, &auth::HeaderAuth(auth::ApiKeyAuth { is_connected_allowed: false, is_platform_allowed: false, }), api_locking::LockAction::NotApplicable, )) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 20, "total_crates": null }
fn_clm_router_get_revenue_recovery_redis_data_3084340741217052562
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/revenue_recovery_redis pub async fn get_revenue_recovery_redis_data( state: web::Data<AppState>, req: HttpRequest, path: web::Path<String>, query: web::Query<GetRedisDataQuery>, ) -> HttpResponse { let flow = Flow::RevenueRecoveryRedis; let connector_customer_id = path.into_inner(); let key_type = &query.key_type; Box::pin(api::server_wrap( flow, state, &req, (), |state, _: (), _, _| { revenue_recovery_data_backfill::get_redis_data(state, &connector_customer_id, key_type) }, &auth::V2AdminApiAuth, api_locking::LockAction::NotApplicable, )) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 18, "total_crates": null }
fn_clm_router_update_merchant_-575068109912823862
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/recon pub async fn update_merchant( state: web::Data<AppState>, req: HttpRequest, path: web::Path<common_utils::id_type::MerchantId>, json_payload: web::Json<recon_api::ReconUpdateMerchantRequest>, ) -> HttpResponse { let flow = Flow::ReconMerchantUpdate; let merchant_id = path.into_inner(); Box::pin(api::server_wrap( flow, state, &req, json_payload.into_inner(), |state, auth, req, _| recon::recon_merchant_account_update(state, auth, req), &authentication::AdminApiAuthWithMerchantIdFromRoute(merchant_id), api_locking::LockAction::NotApplicable, )) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 46, "total_crates": null }
fn_clm_router_verify_recon_token_-575068109912823862
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/recon pub async fn verify_recon_token(state: web::Data<AppState>, http_req: HttpRequest) -> HttpResponse { let flow = Flow::ReconVerifyToken; Box::pin(api::server_wrap( flow, state.clone(), &http_req, (), |state, user, _req, _| recon::verify_recon_token(state, user), &authentication::JWTAuth { permission: Permission::MerchantReconTokenRead, }, api_locking::LockAction::NotApplicable, )) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 21, "total_crates": null }
fn_clm_router_request_for_recon_-575068109912823862
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/recon pub async fn request_for_recon(state: web::Data<AppState>, http_req: HttpRequest) -> HttpResponse { let flow = Flow::ReconServiceRequest; Box::pin(api::server_wrap( flow, state, &http_req, (), |state, user, _, _| recon::send_recon_request(state, user), &authentication::JWTAuth { permission: Permission::MerchantAccountWrite, }, api_locking::LockAction::NotApplicable, )) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 16, "total_crates": null }
fn_clm_router_get_recon_token_-575068109912823862
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/recon pub async fn get_recon_token(state: web::Data<AppState>, req: HttpRequest) -> HttpResponse { let flow = Flow::ReconTokenRequest; Box::pin(api::server_wrap( flow, state, &req, (), |state, user, _, _| recon::generate_recon_token(state, user), &authentication::JWTAuth { permission: Permission::MerchantReconTokenRead, }, api_locking::LockAction::NotApplicable, )) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 16, "total_crates": null }
fn_clm_router_retrieve_poll_status_3618883788620165474
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/poll pub async fn retrieve_poll_status( state: web::Data<AppState>, req: HttpRequest, path: web::Path<String>, ) -> HttpResponse { let flow = Flow::RetrievePollStatus; let poll_id = PollId { poll_id: path.into_inner(), }; Box::pin(api::server_wrap( flow, state, &req, poll_id, |state, auth, req, _| { let merchant_context = domain::MerchantContext::NormalMerchant(Box::new( domain::Context(auth.merchant_account, auth.key_store), )); poll::retrieve_poll_status(state, req, merchant_context) }, &auth::HeaderAuth(auth::PublishableKeyAuth), api_locking::LockAction::NotApplicable, )) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 29, "total_crates": null }
fn_clm_router_receive_incoming_webhook_2248828411893614460
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/webhooks pub async fn receive_incoming_webhook<W: types::OutgoingWebhookType>( state: web::Data<AppState>, req: HttpRequest, body: web::Bytes, path: web::Path<( common_utils::id_type::MerchantId, common_utils::id_type::ProfileId, common_utils::id_type::MerchantConnectorAccountId, )>, ) -> impl Responder { let flow = Flow::IncomingWebhookReceive; let (merchant_id, profile_id, connector_id) = path.into_inner(); Box::pin(api::server_wrap( flow.clone(), state, &req, (), |state, auth, _, req_state| { let merchant_context = domain::MerchantContext::NormalMerchant(Box::new( domain::Context(auth.merchant_account, auth.key_store), )); webhooks::incoming_webhooks_wrapper::<W>( &flow, state.to_owned(), req_state, &req, merchant_context, auth.profile, &connector_id, body.clone(), false, ) }, &auth::MerchantIdAndProfileIdAuth { merchant_id, profile_id, }, api_locking::LockAction::NotApplicable, )) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 28, "total_crates": null }
fn_clm_router_receive_incoming_relay_webhook_2248828411893614460
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/webhooks pub async fn receive_incoming_relay_webhook<W: types::OutgoingWebhookType>( state: web::Data<AppState>, req: HttpRequest, body: web::Bytes, path: web::Path<( common_utils::id_type::MerchantId, common_utils::id_type::ProfileId, common_utils::id_type::MerchantConnectorAccountId, )>, ) -> impl Responder { let flow = Flow::IncomingWebhookReceive; let (merchant_id, profile_id, connector_id) = path.into_inner(); let is_relay_webhook = true; Box::pin(api::server_wrap( flow.clone(), state, &req, (), |state, auth, _, req_state| { let merchant_context = domain::MerchantContext::NormalMerchant(Box::new( domain::Context(auth.merchant_account, auth.key_store), )); webhooks::incoming_webhooks_wrapper::<W>( &flow, state.to_owned(), req_state, &req, merchant_context, auth.profile, &connector_id, body.clone(), is_relay_webhook, ) }, &auth::MerchantIdAndProfileIdAuth { merchant_id, profile_id, }, api_locking::LockAction::NotApplicable, )) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 28, "total_crates": null }
fn_clm_router_receive_network_token_requestor_incoming_webhook_2248828411893614460
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/webhooks pub async fn receive_network_token_requestor_incoming_webhook<W: types::OutgoingWebhookType>( state: web::Data<AppState>, req: HttpRequest, body: web::Bytes, _path: web::Path<String>, ) -> impl Responder { let flow = Flow::IncomingNetworkTokenWebhookReceive; Box::pin(api::server_wrap( flow.clone(), state, &req, (), |state, _: (), _, _| { webhooks::network_token_incoming_webhooks_wrapper::<W>( &flow, state.to_owned(), &req, body.clone(), ) }, &auth::NoAuth, api_locking::LockAction::NotApplicable, )) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 20, "total_crates": null }
fn_clm_router_api_key_retrieve_2524526058036860303
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/api_keys pub async fn api_key_retrieve( state: web::Data<AppState>, req: HttpRequest, path: web::Path<( common_utils::id_type::MerchantId, common_utils::id_type::ApiKeyId, )>, ) -> impl Responder { let flow = Flow::ApiKeyRetrieve; let (merchant_id, key_id) = path.into_inner(); api::server_wrap( flow, state, &req, (merchant_id.clone(), key_id.clone()), |state, _, (merchant_id, key_id), _| api_keys::retrieve_api_key(state, merchant_id, key_id), auth::auth_type( &auth::PlatformOrgAdminAuthWithMerchantIdFromRoute { merchant_id_from_route: merchant_id.clone(), is_admin_auth_allowed: true, }, &auth::JWTAuthMerchantFromRoute { merchant_id: merchant_id.clone(), required_permission: Permission::MerchantApiKeyRead, }, req.headers(), ), api_locking::LockAction::NotApplicable, ) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 28, "total_crates": null }
fn_clm_router_api_key_update_2524526058036860303
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/api_keys pub async fn api_key_update( state: web::Data<AppState>, req: HttpRequest, key_id: web::Path<common_utils::id_type::ApiKeyId>, json_payload: web::Json<api_types::UpdateApiKeyRequest>, ) -> impl Responder { let flow = Flow::ApiKeyUpdate; let api_key_id = key_id.into_inner(); let mut payload = json_payload.into_inner(); payload.key_id = api_key_id; Box::pin(api::server_wrap( flow, state, &req, payload, |state, auth::AuthenticationDataWithoutProfile { merchant_account, .. }, mut payload, _| { payload.merchant_id = merchant_account.get_id().to_owned(); api_keys::update_api_key(state, payload) }, auth::auth_type( &auth::AdminApiAuthWithMerchantIdFromHeader, &auth::JWTAuthMerchantFromHeader { required_permission: Permission::MerchantApiKeyRead, }, req.headers(), ), api_locking::LockAction::NotApplicable, )) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 28, "total_crates": null }
fn_clm_router_api_key_revoke_2524526058036860303
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/api_keys pub async fn api_key_revoke( state: web::Data<AppState>, req: HttpRequest, path: web::Path<common_utils::id_type::ApiKeyId>, ) -> impl Responder { let flow = Flow::ApiKeyRevoke; let key_id = path.into_inner(); Box::pin(api::server_wrap( flow, state, &req, &key_id, |state, auth::AuthenticationDataWithoutProfile { merchant_account, .. }, key_id, _| api_keys::revoke_api_key(state, merchant_account.get_id().to_owned(), key_id), auth::auth_type( &auth::AdminApiAuthWithMerchantIdFromHeader, &auth::JWTAuthMerchantFromHeader { required_permission: Permission::MerchantApiKeyWrite, }, req.headers(), ), api_locking::LockAction::NotApplicable, )) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 26, "total_crates": null }
fn_clm_router_api_key_list_2524526058036860303
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/api_keys pub async fn api_key_list( state: web::Data<AppState>, req: HttpRequest, query: web::Query<api_types::ListApiKeyConstraints>, ) -> impl Responder { let flow = Flow::ApiKeyList; let payload = query.into_inner(); Box::pin(api::server_wrap( flow, state, &req, payload, |state, auth::AuthenticationDataWithoutProfile { merchant_account, .. }, payload, _| async move { let merchant_id = merchant_account.get_id().to_owned(); api_keys::list_api_keys(state, merchant_id, payload.limit, payload.skip).await }, auth::auth_type( &auth::AdminApiAuthWithMerchantIdFromHeader, &auth::JWTAuthMerchantFromHeader { required_permission: Permission::MerchantApiKeyRead, }, req.headers(), ), api_locking::LockAction::NotApplicable, )) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 26, "total_crates": null }
fn_clm_router_api_key_create_2524526058036860303
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/api_keys pub async fn api_key_create( state: web::Data<AppState>, req: HttpRequest, json_payload: web::Json<api_types::CreateApiKeyRequest>, ) -> impl Responder { let flow = Flow::ApiKeyCreate; let payload = json_payload.into_inner(); Box::pin(api::server_wrap( flow, state, &req, payload, |state, auth::AuthenticationDataWithoutProfile { key_store, .. }, payload, _| async { api_keys::create_api_key(state, payload, key_store).await }, auth::auth_type( &auth::AdminApiAuthWithMerchantIdFromHeader, &auth::JWTAuthMerchantFromHeader { required_permission: Permission::MerchantApiKeyWrite, }, req.headers(), ), api_locking::LockAction::NotApplicable, )) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 22, "total_crates": null }
fn_clm_router_customers_retrieve_-4566142427107897037
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/customers pub async fn customers_retrieve( state: web::Data<AppState>, req: HttpRequest, path: web::Path<id_type::GlobalCustomerId>, ) -> HttpResponse { use crate::services::authentication::api_or_client_auth; let flow = Flow::CustomersRetrieve; let id = path.into_inner(); let v2_client_auth = auth::V2ClientAuth( common_utils::types::authentication::ResourceId::Customer(id.clone()), ); let auth = if auth::is_jwt_auth(req.headers()) { &auth::JWTAuth { permission: Permission::MerchantCustomerRead, } } else { api_or_client_auth( &auth::V2ApiKeyAuth { is_connected_allowed: false, is_platform_allowed: false, }, &v2_client_auth, req.headers(), ) }; Box::pin(api::server_wrap( flow, state, &req, id, |state, auth: auth::AuthenticationData, id, _| { let merchant_context = domain::MerchantContext::NormalMerchant(Box::new( domain::Context(auth.merchant_account, auth.key_store), )); retrieve_customer(state, merchant_context, id) }, auth, api_locking::LockAction::NotApplicable, )) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 38, "total_crates": null }
fn_clm_router_get_customer_mandates_-4566142427107897037
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/customers pub async fn get_customer_mandates( state: web::Data<AppState>, req: HttpRequest, path: web::Path<id_type::CustomerId>, ) -> impl Responder { let flow = Flow::CustomersGetMandates; let customer_id = path.into_inner(); Box::pin(api::server_wrap( flow, state, &req, customer_id, |state, auth: auth::AuthenticationData, customer_id, _| { let merchant_context = domain::MerchantContext::NormalMerchant(Box::new( domain::Context(auth.merchant_account, auth.key_store), )); crate::core::mandate::get_customer_mandates(state, merchant_context, customer_id) }, auth::auth_type( &auth::HeaderAuth(auth::ApiKeyAuth { is_connected_allowed: false, is_platform_allowed: false, }), &auth::JWTAuth { permission: Permission::MerchantMandateRead, }, req.headers(), ), api_locking::LockAction::NotApplicable, )) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 33, "total_crates": null }
fn_clm_router_customers_create_-4566142427107897037
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/customers pub async fn customers_create( state: web::Data<AppState>, req: HttpRequest, json_payload: web::Json<customers::CustomerRequest>, ) -> HttpResponse { let flow = Flow::CustomersCreate; Box::pin(api::server_wrap( flow, state, &req, json_payload.into_inner(), |state, auth: auth::AuthenticationData, req, _| { let merchant_context = domain::MerchantContext::NormalMerchant(Box::new( domain::Context(auth.merchant_account, auth.key_store), )); create_customer(state, merchant_context, req, None) }, auth::auth_type( &auth::HeaderAuth(auth::ApiKeyAuth { is_connected_allowed: false, is_platform_allowed: false, }), &auth::JWTAuth { permission: Permission::MerchantCustomerWrite, }, req.headers(), ), api_locking::LockAction::NotApplicable, )) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 30, "total_crates": null }
fn_clm_router_customers_update_-4566142427107897037
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/customers pub async fn customers_update( state: web::Data<AppState>, req: HttpRequest, path: web::Path<id_type::GlobalCustomerId>, json_payload: web::Json<customers::CustomerUpdateRequest>, ) -> HttpResponse { let flow = Flow::CustomersUpdate; let id = path.into_inner(); let request = json_payload.into_inner(); let request_internal = customers::CustomerUpdateRequestInternal { id, request }; Box::pin(api::server_wrap( flow, state, &req, request_internal, |state, auth: auth::AuthenticationData, request_internal, _| { let merchant_context = domain::MerchantContext::NormalMerchant(Box::new( domain::Context(auth.merchant_account, auth.key_store), )); update_customer(state, merchant_context, request_internal) }, auth::auth_type( &auth::V2ApiKeyAuth { is_connected_allowed: false, is_platform_allowed: false, }, &auth::JWTAuth { permission: Permission::MerchantCustomerWrite, }, req.headers(), ), api_locking::LockAction::NotApplicable, )) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 30, "total_crates": null }
fn_clm_router_customers_delete_-4566142427107897037
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/customers pub async fn customers_delete( state: web::Data<AppState>, req: HttpRequest, path: web::Path<id_type::CustomerId>, ) -> impl Responder { let flow = Flow::CustomersDelete; let customer_id = path.into_inner(); Box::pin(api::server_wrap( flow, state, &req, customer_id, |state, auth: auth::AuthenticationData, customer_id, _| { let merchant_context = domain::MerchantContext::NormalMerchant(Box::new( domain::Context(auth.merchant_account, auth.key_store), )); delete_customer(state, merchant_context, customer_id) }, auth::auth_type( &auth::HeaderAuth(auth::ApiKeyAuth { is_connected_allowed: false, is_platform_allowed: false, }), &auth::JWTAuth { permission: Permission::MerchantCustomerWrite, }, req.headers(), ), api_locking::LockAction::NotApplicable, )) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 30, "total_crates": null }
fn_clm_router_update_gsm_rule_920786760135525770
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/gsm pub async fn update_gsm_rule( state: web::Data<AppState>, req: HttpRequest, json_payload: web::Json<gsm_api_types::GsmUpdateRequest>, ) -> impl Responder { let payload = json_payload.into_inner(); let flow = Flow::GsmRuleUpdate; Box::pin(api::server_wrap( flow, state.clone(), &req, payload, |state, _, payload, _| gsm::update_gsm_rule(state, payload), &ADMIN_API_AUTH, api_locking::LockAction::NotApplicable, )) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 29, "total_crates": null }
fn_clm_router_delete_gsm_rule_920786760135525770
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/gsm pub async fn delete_gsm_rule( state: web::Data<AppState>, req: HttpRequest, json_payload: web::Json<gsm_api_types::GsmDeleteRequest>, ) -> impl Responder { let payload = json_payload.into_inner(); let flow = Flow::GsmRuleDelete; Box::pin(api::server_wrap( flow, state, &req, payload, |state, _, payload, _| gsm::delete_gsm_rule(state, payload), &ADMIN_API_AUTH, api_locking::LockAction::NotApplicable, )) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 27, "total_crates": null }
fn_clm_router_create_gsm_rule_920786760135525770
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/gsm pub async fn create_gsm_rule( state: web::Data<AppState>, req: HttpRequest, json_payload: web::Json<gsm_api_types::GsmCreateRequest>, ) -> impl Responder { let payload = json_payload.into_inner(); let flow = Flow::GsmRuleCreate; Box::pin(api::server_wrap( flow, state.clone(), &req, payload, |state, _, payload, _| gsm::create_gsm_rule(state, payload), &ADMIN_API_AUTH, api_locking::LockAction::NotApplicable, )) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 23, "total_crates": null }
fn_clm_router_get_gsm_rule_920786760135525770
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/gsm pub async fn get_gsm_rule( state: web::Data<AppState>, req: HttpRequest, json_payload: web::Json<gsm_api_types::GsmRetrieveRequest>, ) -> impl Responder { let gsm_retrieve_req = json_payload.into_inner(); let flow = Flow::GsmRuleRetrieve; Box::pin(api::server_wrap( flow, state.clone(), &req, gsm_retrieve_req, |state, _, gsm_retrieve_req, _| gsm::retrieve_gsm_rule(state, gsm_retrieve_req), &ADMIN_API_AUTH, api_locking::LockAction::NotApplicable, )) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 20, "total_crates": null }
fn_clm_router_convert_forex_1180464047181972409
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/currency pub async fn convert_forex( state: web::Data<AppState>, req: HttpRequest, params: web::Query<api_models::currency::CurrencyConversionParams>, ) -> HttpResponse { let flow = Flow::RetrieveForexFlow; let amount = params.amount; let to_currency = &params.to_currency; let from_currency = &params.from_currency; Box::pin(api::server_wrap( flow, state.clone(), &req, (), |state, _: auth::AuthenticationData, _, _| { currency::convert_forex( state, amount.get_amount_as_i64(), to_currency.to_string(), from_currency.to_string(), ) }, auth::auth_type( &auth::HeaderAuth(auth::ApiKeyAuth { is_connected_allowed: false, is_platform_allowed: false, }), &auth::DashboardNoPermissionAuth, req.headers(), ), api_locking::LockAction::NotApplicable, )) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 33, "total_crates": null }
fn_clm_router_retrieve_forex_1180464047181972409
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/currency pub async fn retrieve_forex(state: web::Data<AppState>, req: HttpRequest) -> HttpResponse { let flow = Flow::RetrieveForexFlow; Box::pin(api::server_wrap( flow, state, &req, (), |state, _auth: auth::AuthenticationData, _, _| currency::retrieve_forex(state), auth::auth_type( &auth::HeaderAuth(auth::ApiKeyAuth { is_connected_allowed: false, is_platform_allowed: false, }), &auth::DashboardNoPermissionAuth, req.headers(), ), api_locking::LockAction::NotApplicable, )) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 25, "total_crates": null }
fn_clm_router_profile_acquirer_update_6718944651151732204
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/profile_acquirer pub async fn profile_acquirer_update( state: web::Data<AppState>, req: HttpRequest, path: web::Path<( common_utils::id_type::ProfileId, common_utils::id_type::ProfileAcquirerId, )>, json_payload: web::Json<ProfileAcquirerUpdate>, ) -> HttpResponse { let flow = Flow::ProfileAcquirerUpdate; let (profile_id, profile_acquirer_id) = path.into_inner(); let payload = json_payload.into_inner(); Box::pin(api::server_wrap( flow, state, &req, payload, |state: super::SessionState, auth_data, req, _| { let merchant_context = domain::MerchantContext::NormalMerchant(Box::new( domain::Context(auth_data.merchant_account, auth_data.key_store), )); crate::core::profile_acquirer::update_profile_acquirer_config( state, profile_id.clone(), profile_acquirer_id.clone(), req, merchant_context.clone(), ) }, auth::auth_type( &auth::HeaderAuth(auth::ApiKeyAuth { is_connected_allowed: false, is_platform_allowed: true, }), &auth::JWTAuth { permission: Permission::ProfileAccountWrite, }, req.headers(), ), api_locking::LockAction::NotApplicable, )) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 38, "total_crates": null }
fn_clm_router_create_profile_acquirer_6718944651151732204
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/profile_acquirer pub async fn create_profile_acquirer( state: web::Data<AppState>, req: HttpRequest, json_payload: web::Json<ProfileAcquirerCreate>, ) -> HttpResponse { let flow = Flow::ProfileAcquirerCreate; let payload = json_payload.into_inner(); Box::pin(api::server_wrap( flow, state, &req, payload, |state: super::SessionState, auth_data, req, _| { let merchant_context = domain::MerchantContext::NormalMerchant(Box::new( domain::Context(auth_data.merchant_account, auth_data.key_store), )); crate::core::profile_acquirer::create_profile_acquirer( state, req, merchant_context.clone(), ) }, auth::auth_type( &auth::HeaderAuth(auth::ApiKeyAuth { is_connected_allowed: false, is_platform_allowed: true, }), &auth::JWTAuth { permission: Permission::ProfileAccountWrite, }, req.headers(), ), api_locking::LockAction::NotApplicable, )) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 35, "total_crates": null }
fn_clm_router_authentication_eligibility_3040576174620080288
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/authentication pub async fn authentication_eligibility( state: web::Data<app::AppState>, req: HttpRequest, json_payload: web::Json<AuthenticationEligibilityRequest>, path: web::Path<common_utils::id_type::AuthenticationId>, ) -> impl Responder { let flow = Flow::AuthenticationEligibility; let api_auth = auth::ApiKeyAuth::default(); let payload = json_payload.into_inner(); let (auth, _) = match auth::check_client_secret_and_get_auth(req.headers(), &payload, api_auth) { Ok((auth, _auth_flow)) => (auth, _auth_flow), Err(e) => return api::log_and_return_error_response(e), }; let authentication_id = path.into_inner(); Box::pin(api::server_wrap( flow, state, &req, payload, |state, auth: auth::AuthenticationData, req, _| { let merchant_context = domain::MerchantContext::NormalMerchant(Box::new( domain::Context(auth.merchant_account, auth.key_store), )); unified_authentication_service::authentication_eligibility_core( state, merchant_context, req, authentication_id.clone(), ) }, &*auth, api_locking::LockAction::NotApplicable, )) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 36, "total_crates": null }
fn_clm_router_authentication_authenticate_3040576174620080288
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/authentication pub async fn authentication_authenticate( state: web::Data<app::AppState>, req: HttpRequest, json_payload: web::Json<AuthenticationAuthenticateRequest>, path: web::Path<common_utils::id_type::AuthenticationId>, ) -> impl Responder { let flow = Flow::AuthenticationAuthenticate; let authentication_id = path.into_inner(); let api_auth = auth::ApiKeyAuth::default(); let payload = AuthenticationAuthenticateRequest { authentication_id, ..json_payload.into_inner() }; let (auth, auth_flow) = match auth::check_client_secret_and_get_auth(req.headers(), &payload, api_auth) { Ok((auth, auth_flow)) => (auth, auth_flow), Err(e) => return api::log_and_return_error_response(e), }; Box::pin(api::server_wrap( flow, state, &req, payload, |state, auth: auth::AuthenticationData, req, _| { let merchant_context = domain::MerchantContext::NormalMerchant(Box::new( domain::Context(auth.merchant_account, auth.key_store), )); unified_authentication_service::authentication_authenticate_core( state, merchant_context, req, auth_flow, ) }, &*auth, api_locking::LockAction::NotApplicable, )) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 34, "total_crates": null }
fn_clm_router_authentication_sync_3040576174620080288
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/authentication pub async fn authentication_sync( state: web::Data<app::AppState>, req: HttpRequest, path: web::Path<( common_utils::id_type::MerchantId, common_utils::id_type::AuthenticationId, )>, json_payload: web::Query<AuthenticationSyncRequest>, ) -> impl Responder { let flow = Flow::AuthenticationSync; let api_auth = auth::ApiKeyAuth::default(); let (_merchant_id, authentication_id) = path.into_inner(); let payload = AuthenticationSyncRequest { authentication_id, ..json_payload.into_inner() }; let (auth, auth_flow) = match auth::check_client_secret_and_get_auth(req.headers(), &payload, api_auth) { Ok((auth, auth_flow)) => (auth, auth_flow), Err(e) => return api::log_and_return_error_response(e), }; Box::pin(api::server_wrap( flow, state, &req, payload, |state, auth: auth::AuthenticationData, req, _| { let merchant_context = domain::MerchantContext::NormalMerchant(Box::new( domain::Context(auth.merchant_account, auth.key_store), )); unified_authentication_service::authentication_sync_core( state, merchant_context, auth_flow, req, ) }, &*auth, api_locking::LockAction::NotApplicable, )) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 34, "total_crates": null }
fn_clm_router_authentication_create_3040576174620080288
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/authentication pub async fn authentication_create( state: web::Data<app::AppState>, req: HttpRequest, json_payload: web::Json<AuthenticationCreateRequest>, ) -> impl Responder { let flow = Flow::AuthenticationCreate; Box::pin(api::server_wrap( flow, state, &req, json_payload.into_inner(), |state, auth: auth::AuthenticationData, req, _| { let merchant_context = domain::MerchantContext::NormalMerchant(Box::new( domain::Context(auth.merchant_account, auth.key_store), )); unified_authentication_service::authentication_create_core(state, merchant_context, req) }, &auth::HeaderAuth(auth::ApiKeyAuth { is_connected_allowed: false, is_platform_allowed: false, }), api_locking::LockAction::NotApplicable, )) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 26, "total_crates": null }
fn_clm_router_authentication_sync_post_update_3040576174620080288
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/authentication pub async fn authentication_sync_post_update( state: web::Data<app::AppState>, req: HttpRequest, path: web::Path<( common_utils::id_type::MerchantId, common_utils::id_type::AuthenticationId, )>, ) -> impl Responder { let flow = Flow::AuthenticationSyncPostUpdate; let (merchant_id, authentication_id) = path.into_inner(); let payload = AuthenticationSyncPostUpdateRequest { authentication_id }; Box::pin(api::server_wrap( flow, state, &req, payload, |state, auth: auth::AuthenticationData, req, _| { let merchant_context = domain::MerchantContext::NormalMerchant(Box::new( domain::Context(auth.merchant_account, auth.key_store), )); unified_authentication_service::authentication_post_sync_core( state, merchant_context, req, ) }, &auth::MerchantIdAuth(merchant_id), api_locking::LockAction::NotApplicable, )) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 26, "total_crates": null }
fn_clm_router_get_merchant_account_-6856152596163399049
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/routing async fn get_merchant_account( state: &super::SessionState, merchant_id: &common_utils::id_type::MerchantId, ) -> common_utils::errors::CustomResult<(MerchantKeyStore, domain::MerchantAccount), ApiErrorResponse> { let key_manager_state = &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(ApiErrorResponse::MerchantAccountNotFound)?; let merchant_account = state .store .find_merchant_account_by_merchant_id(key_manager_state, merchant_id, &key_store) .await .to_not_found_response(ApiErrorResponse::MerchantAccountNotFound)?; Ok((key_store, merchant_account)) }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 2557, "total_crates": null }
fn_clm_router_contract_based_routing_update_configs_-6856152596163399049
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/routing pub async fn contract_based_routing_update_configs( state: web::Data<AppState>, req: HttpRequest, path: web::Path<routing_types::DynamicRoutingUpdateConfigQuery>, json_payload: web::Json<routing_types::ContractBasedRoutingConfig>, ) -> impl Responder { let flow = Flow::UpdateDynamicRoutingConfigs; let routing_payload_wrapper = routing_types::ContractBasedRoutingPayloadWrapper { updated_config: json_payload.into_inner(), algorithm_id: path.algorithm_id.clone(), profile_id: path.profile_id.clone(), }; Box::pin(oss_api::server_wrap( flow, state, &req, routing_payload_wrapper.clone(), |state, auth: auth::AuthenticationData, wrapper: routing_types::ContractBasedRoutingPayloadWrapper, _| async { let merchant_context = domain::MerchantContext::NormalMerchant(Box::new( domain::Context(auth.merchant_account, auth.key_store), )); Box::pin(routing::contract_based_routing_update_configs( state, wrapper.updated_config, merchant_context, wrapper.algorithm_id, wrapper.profile_id, )) .await }, auth::auth_type( &auth::HeaderAuth(auth::ApiKeyAuth { is_connected_allowed: false, is_platform_allowed: false, }), &auth::JWTAuthProfileFromRoute { profile_id: routing_payload_wrapper.profile_id, required_permission: Permission::ProfileRoutingWrite, }, req.headers(), ), api_locking::LockAction::NotApplicable, )) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 41, "total_crates": null }
fn_clm_router_contract_based_routing_setup_config_-6856152596163399049
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/routing pub async fn contract_based_routing_setup_config( state: web::Data<AppState>, req: HttpRequest, path: web::Path<routing_types::ToggleDynamicRoutingPath>, query: web::Query<api_models::routing::ToggleDynamicRoutingQuery>, json_payload: Option<web::Json<routing_types::ContractBasedRoutingConfig>>, ) -> impl Responder { let flow = Flow::ToggleDynamicRouting; let routing_payload_wrapper = routing_types::ContractBasedRoutingSetupPayloadWrapper { config: json_payload.map(|json| json.into_inner()), profile_id: path.into_inner().profile_id, features_to_enable: query.into_inner().enable, }; Box::pin(oss_api::server_wrap( flow, state, &req, routing_payload_wrapper.clone(), |state, auth: auth::AuthenticationData, wrapper: routing_types::ContractBasedRoutingSetupPayloadWrapper, _| async move { let merchant_context = domain::MerchantContext::NormalMerchant(Box::new( domain::Context(auth.merchant_account, auth.key_store), )); Box::pin(routing::contract_based_dynamic_routing_setup( state, merchant_context, wrapper.profile_id, wrapper.features_to_enable, wrapper.config, )) .await }, auth::auth_type( &auth::HeaderAuth(auth::ApiKeyAuth { is_connected_allowed: false, is_platform_allowed: false, }), &auth::JWTAuthProfileFromRoute { profile_id: routing_payload_wrapper.profile_id, required_permission: Permission::ProfileRoutingWrite, }, req.headers(), ), api_locking::LockAction::NotApplicable, )) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 40, "total_crates": null }
fn_clm_router_list_routing_configs_for_profile_-6856152596163399049
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/routing pub async fn list_routing_configs_for_profile( state: web::Data<AppState>, req: HttpRequest, query: web::Query<RoutingRetrieveQuery>, transaction_type: Option<enums::TransactionType>, ) -> impl Responder { let flow = Flow::RoutingRetrieveDictionary; Box::pin(oss_api::server_wrap( flow, state, &req, query.into_inner(), |state, auth: auth::AuthenticationData, query_params, _| { let merchant_context = domain::MerchantContext::NormalMerchant(Box::new( domain::Context(auth.merchant_account, auth.key_store), )); routing::retrieve_merchant_routing_dictionary( state, merchant_context, auth.profile_id.map(|profile_id| vec![profile_id]), query_params.clone(), transaction_type .or(query_params.transaction_type) .unwrap_or(enums::TransactionType::Payment), ) }, auth::auth_type( &auth::HeaderAuth(auth::ApiKeyAuth { is_connected_allowed: false, is_platform_allowed: false, }), &auth::JWTAuth { permission: Permission::ProfileRoutingRead, }, req.headers(), ), api_locking::LockAction::NotApplicable, )) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 38, "total_crates": null }
fn_clm_router_create_success_based_routing_-6856152596163399049
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/routing pub async fn create_success_based_routing( state: web::Data<AppState>, req: HttpRequest, query: web::Query<api_models::routing::CreateDynamicRoutingQuery>, path: web::Path<routing_types::ToggleDynamicRoutingPath>, success_based_config: web::Json<routing_types::SuccessBasedRoutingConfig>, ) -> impl Responder { let flow = Flow::CreateDynamicRoutingConfig; let wrapper = routing_types::CreateDynamicRoutingWrapper { feature_to_enable: query.into_inner().enable, profile_id: path.into_inner().profile_id, payload: api_models::routing::DynamicRoutingPayload::SuccessBasedRoutingPayload( success_based_config.into_inner(), ), }; Box::pin(oss_api::server_wrap( flow, state, &req, wrapper.clone(), |state, auth: auth::AuthenticationData, wrapper: routing_types::CreateDynamicRoutingWrapper, _| { let merchant_context = domain::MerchantContext::NormalMerchant(Box::new( domain::Context(auth.merchant_account, auth.key_store), )); routing::create_specific_dynamic_routing( state, merchant_context, wrapper.feature_to_enable, wrapper.profile_id, api_models::routing::DynamicRoutingType::SuccessRateBasedRouting, wrapper.payload, ) }, auth::auth_type( &auth::HeaderAuth(auth::ApiKeyAuth { is_connected_allowed: false, is_platform_allowed: false, }), &auth::JWTAuthProfileFromRoute { profile_id: wrapper.profile_id, required_permission: Permission::ProfileRoutingWrite, }, req.headers(), ), api_locking::LockAction::NotApplicable, )) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 38, "total_crates": null }
fn_clm_router_client_secret_create_8169358679620158936
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/ephemeral_key pub async fn client_secret_create( state: web::Data<AppState>, req: HttpRequest, json_payload: web::Json<api_models::ephemeral_key::ClientSecretCreateRequest>, ) -> HttpResponse { let flow = Flow::EphemeralKeyCreate; let payload = json_payload.into_inner(); Box::pin(api::server_wrap( flow, state, &req, payload, |state, auth: auth::AuthenticationData, payload, _| { let merchant_context = domain::MerchantContext::NormalMerchant(Box::new( domain::Context(auth.merchant_account, auth.key_store), )); helpers::make_client_secret( state, payload.resource_id.to_owned(), merchant_context, req.headers(), ) }, &auth::V2ApiKeyAuth { is_connected_allowed: false, is_platform_allowed: false, }, api_locking::LockAction::NotApplicable, )) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 28, "total_crates": null }
fn_clm_router_ephemeral_key_create_8169358679620158936
clm
function
// Repository: hyperswitch // Crate: router // Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration // Module: crates/router/src/routes/ephemeral_key pub async fn ephemeral_key_create( state: web::Data<AppState>, req: HttpRequest, json_payload: web::Json<api_models::ephemeral_key::EphemeralKeyCreateRequest>, ) -> HttpResponse { let flow = Flow::EphemeralKeyCreate; let payload = json_payload.into_inner(); api::server_wrap( flow, state, &req, payload, |state, auth: auth::AuthenticationData, payload, _| { helpers::make_ephemeral_key( state, payload.customer_id, auth.merchant_account.get_id().to_owned(), ) }, &auth::HeaderAuth(auth::ApiKeyAuth { is_connected_allowed: false, is_platform_allowed: false, }), api_locking::LockAction::NotApplicable, ) .await }
{ "crate": "router", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 22, "total_crates": null }