text
stringlengths
70
351k
source
stringclasses
4 values
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/profiles.rs | crate: router use actix_web::{web, HttpRequest, HttpResponse}; use router_env::{instrument, tracing, Flow}; use super::app::AppState; use crate::{ core::{admin::*, api_locking}, services::{api, authentication as auth, authorization::permissions}, types::api::admin, }; 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 { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/profiles.rs | crate: router use actix_web::{web, HttpRequest, HttpResponse}; use router_env::{instrument, tracing, Flow}; use super::app::AppState; use crate::{ core::{admin::*, api_locking}, services::{api, authentication as auth, authorization::permissions}, types::api::admin, }; pub async fn profile_update( state: web::Data<AppState>, req: HttpRequest, path: web::Path<( common_utils::id_type::MerchantId, common_utils::id_type::ProfileId, )>, json_payload: web::Json<api_models::admin::ProfileUpdate>, ) -> HttpResponse { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/profiles.rs | crate: router use actix_web::{web, HttpRequest, HttpResponse}; use router_env::{instrument, tracing, Flow}; use super::app::AppState; use crate::{ core::{admin::*, api_locking}, services::{api, authentication as auth, authorization::permissions}, types::api::admin, }; pub async fn profile_retrieve( state: web::Data<AppState>, req: HttpRequest, path: web::Path<common_utils::id_type::ProfileId>, ) -> HttpResponse { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/profiles.rs | crate: router use actix_web::{web, HttpRequest, HttpResponse}; use router_env::{instrument, tracing, Flow}; use super::app::AppState; use crate::{ core::{admin::*, api_locking}, services::{api, authentication as auth, authorization::permissions}, types::api::admin, }; pub async fn profile_retrieve( state: web::Data<AppState>, req: HttpRequest, path: web::Path<( common_utils::id_type::MerchantId, common_utils::id_type::ProfileId, )>, ) -> HttpResponse { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/profiles.rs | crate: router use actix_web::{web, HttpRequest, HttpResponse}; use router_env::{instrument, tracing, Flow}; use super::app::AppState; use crate::{ core::{admin::*, api_locking}, services::{api, authentication as auth, authorization::permissions}, types::api::admin, }; pub async fn profile_create( state: web::Data<AppState>, req: HttpRequest, json_payload: web::Json<admin::ProfileCreate>, ) -> HttpResponse { <|fim_suffix|> <|fim_middle|> }
ast_fragments
// file: hyperswitch/crates/router/src/routes/profiles.rs | crate: router use actix_web::{web, HttpRequest, HttpResponse}; use router_env::{instrument, tracing, Flow}; use super::app::AppState; use crate::{ core::{admin::*, api_locking}, services::{api, authentication as auth, authorization::permissions}, types::api::admin, }; pub async fn profile_create( state: web::Data<AppState>, req: HttpRequest, json_payload: web::Json<admin::ProfileCreate>, path: web::Path<common_utils::id_type::MerchantId>, ) -> HttpResponse { let flow = Flow::ProfileCreate; let payload = json_payload.into_inner(); let merchant_id = path.into_inner(); Box::pin(api::server_wrap( flow, state, &req, payload, |state, auth_data, req, _| { create_profile(state, req, auth_data.merchant_account, auth_data.key_store) }, auth::auth_type( &auth::HeaderAuth(auth::ApiKeyAuthWithMerchantIdFromRoute(merchant_id.clone())), &auth::JWTAuthMerchantFromRoute { merchant_id, required_permission: permissions::Permission::MerchantAccountWrite, }, req.headers(), ), api_locking::LockAction::NotApplicable, )) .await }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/profiles.rs | crate: router use actix_web::{web, HttpRequest, HttpResponse}; use router_env::{instrument, tracing, Flow}; use super::app::AppState; use crate::{ core::{admin::*, api_locking}, services::{api, authentication as auth, authorization::permissions}, types::api::admin, }; pub async fn profile_create( state: web::Data<AppState>, req: HttpRequest, json_payload: web::Json<admin::ProfileCreate>, path: web::Path<common_utils::id_type::MerchantId>, ) -> HttpResponse { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/profiles.rs | crate: router use actix_web::{web, HttpRequest, HttpResponse}; use router_env::{instrument, tracing, Flow}; use super::app::AppState; use crate::{ core::{admin::*, api_locking}, services::{api, authentication as auth, authorization::permissions}, types::api::admin, }; pub async fn toggle_extended_card_info( state: web::Data<AppState>, req: HttpRequest, path: web::Path<( common_utils::id_type::MerchantId, common_utils::id_type::ProfileId, )>, json_payload: web::Json<api_models::admin::ExtendedCardInfoChoice>, ) -> HttpResponse { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/profiles.rs | crate: router use actix_web::{web, HttpRequest, HttpResponse}; use router_env::{instrument, tracing, Flow}; use super::app::AppState; use crate::{ core::{admin::*, api_locking}, services::{api, authentication as auth, authorization::permissions}, types::api::admin, }; pub async fn profile_delete( state: web::Data<AppState>, req: HttpRequest, path: web::Path<( common_utils::id_type::MerchantId, common_utils::id_type::ProfileId, )>, ) -> HttpResponse { <|fim_suffix|> <|fim_middle|> }
ast_fragments
// file: hyperswitch/crates/router/src/routes/payment_link.rs | crate: router use actix_web::{web, Responder}; use router_env::{instrument, tracing, Flow}; use crate::{ core::{api_locking, payment_link::*}, services::{api, authentication as auth}, AppState, }; 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, _, _| { get_payment_link_status( state, auth.merchant_account, auth.key_store, payload.merchant_id.clone(), payload.payment_id.clone(), ) }, &crate::services::authentication::MerchantIdAuth(merchant_id), api_locking::LockAction::NotApplicable, )) .await }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/payment_link.rs | crate: router use actix_web::{web, Responder}; use router_env::{instrument, tracing, Flow}; use crate::{ core::{api_locking, payment_link::*}, services::{api, authentication as auth}, AppState, }; 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 { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/payment_link.rs | crate: router use actix_web::{web, Responder}; use router_env::{instrument, tracing, Flow}; use crate::{ core::{api_locking, payment_link::*}, services::{api, authentication as auth}, AppState, }; 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 { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/payment_link.rs | crate: router use actix_web::{web, Responder}; use router_env::{instrument, tracing, Flow}; use crate::{ core::{api_locking, payment_link::*}, services::{api, authentication as auth}, AppState, }; 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 { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/payment_link.rs | crate: router use actix_web::{web, Responder}; use router_env::{instrument, tracing, Flow}; use crate::{ core::{api_locking, payment_link::*}, services::{api, authentication as auth}, AppState, }; 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 { { Ok(auth) => auth,<|fim_suffix|> <|fim_middle|> Err(err) => return api::log_and_return_error_response(error_stack::report!(err)), } }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/payment_link.rs | crate: router use actix_web::{web, Responder}; use router_env::{instrument, tracing, Flow}; use crate::{ core::{api_locking, payment_link::*}, services::{api, authentication as auth}, AppState, }; pub async fn payments_link_list( state: web::Data<AppState>, req: actix_web::HttpRequest, payload: web::Query<api_models::payments::PaymentLinkListConstraints>, ) -> impl Responder { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/payment_link.rs | crate: router use actix_web::{web, Responder}; use router_env::{instrument, tracing, Flow}; use crate::{ core::{api_locking, payment_link::*}, services::{api, authentication as auth}, AppState, }; 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 { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/api_keys.rs | crate: router use actix_web::{web, HttpRequest, Responder}; use router_env::{instrument, tracing, Flow}; use super::app::AppState; use crate::{ core::{api_keys, api_locking}, services::{api, authentication as auth, authorization::permissions::Permission}, types::api as api_types, }; pub async fn api_key_list( state: web::Data<AppState>, req: HttpRequest, query: web::Query<api_types::ListApiKeyConstraints>, ) -> impl Responder { <|fim_suffix|> <|fim_middle|> }
ast_fragments
// file: hyperswitch/crates/router/src/routes/api_keys.rs | crate: router use actix_web::{web, HttpRequest, Responder}; use router_env::{instrument, tracing, Flow}; use super::app::AppState; use crate::{ core::{api_keys, api_locking}, services::{api, authentication as auth, authorization::permissions::Permission}, types::api as api_types, }; pub async fn api_key_list( state: web::Data<AppState>, req: HttpRequest, path: web::Path<common_utils::id_type::MerchantId>, query: web::Query<api_types::ListApiKeyConstraints>, ) -> impl Responder { let flow = Flow::ApiKeyList; let list_api_key_constraints = query.into_inner(); let limit = list_api_key_constraints.limit; let offset = list_api_key_constraints.skip; let merchant_id = path.into_inner(); Box::pin(api::server_wrap( flow, state, &req, (limit, offset, merchant_id.clone()), |state, _, (limit, offset, merchant_id), _| async move { api_keys::list_api_keys(state, merchant_id, limit, offset).await }, auth::auth_type( &auth::AdminApiAuthWithApiKeyFallbackAndMerchantIdFromRoute(merchant_id.clone()), &auth::JWTAuthMerchantFromRoute { merchant_id, required_permission: Permission::MerchantApiKeyRead, }, req.headers(), ), api_locking::LockAction::NotApplicable, )) .await }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/api_keys.rs | crate: router use actix_web::{web, HttpRequest, Responder}; use router_env::{instrument, tracing, Flow}; use super::app::AppState; use crate::{ core::{api_keys, api_locking}, services::{api, authentication as auth, authorization::permissions::Permission}, types::api as api_types, }; pub async fn api_key_revoke( state: web::Data<AppState>, req: HttpRequest, path: web::Path<( common_utils::id_type::MerchantId, common_utils::id_type::ApiKeyId, )>, ) -> impl Responder { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/api_keys.rs | crate: router use actix_web::{web, HttpRequest, Responder}; use router_env::{instrument, tracing, Flow}; use super::app::AppState; use crate::{ core::{api_keys, api_locking}, services::{api, authentication as auth, authorization::permissions::Permission}, types::api as api_types, }; 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 { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/api_keys.rs | crate: router use actix_web::{web, HttpRequest, Responder}; use router_env::{instrument, tracing, Flow}; use super::app::AppState; use crate::{ core::{api_keys, api_locking}, services::{api, authentication as auth, authorization::permissions::Permission}, types::api as api_types, }; pub async fn api_key_update( state: web::Data<AppState>, req: HttpRequest, path: web::Path<( common_utils::id_type::MerchantId, common_utils::id_type::ApiKeyId, )>, json_payload: web::Json<api_types::UpdateApiKeyRequest>, ) -> impl Responder { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/api_keys.rs | crate: router use actix_web::{web, HttpRequest, Responder}; use router_env::{instrument, tracing, Flow}; use super::app::AppState; use crate::{ core::{api_keys, api_locking}, services::{api, authentication as auth, authorization::permissions::Permission}, types::api as api_types, }; 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 { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/api_keys.rs | crate: router use actix_web::{web, HttpRequest, Responder}; use router_env::{instrument, tracing, Flow}; use super::app::AppState; use crate::{ core::{api_keys, api_locking}, services::{api, authentication as auth, authorization::permissions::Permission}, types::api as api_types, }; pub async fn api_key_retrieve( state: web::Data<AppState>, req: HttpRequest, path: web::Path<common_utils::id_type::ApiKeyId>, ) -> impl Responder { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/api_keys.rs | crate: router use actix_web::{web, HttpRequest, Responder}; use router_env::{instrument, tracing, Flow}; use super::app::AppState; use crate::{ core::{api_keys, api_locking}, services::{api, authentication as auth, authorization::permissions::Permission}, types::api as api_types, }; pub async fn api_key_create( state: web::Data<AppState>, req: HttpRequest, json_payload: web::Json<api_types::CreateApiKeyRequest>, ) -> impl Responder { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/api_keys.rs | crate: router use actix_web::{web, HttpRequest, Responder}; use router_env::{instrument, tracing, Flow}; use super::app::AppState; use crate::{ core::{api_keys, api_locking}, services::{api, authentication as auth, authorization::permissions::Permission}, types::api as api_types, }; pub async fn api_key_create( state: web::Data<AppState>, req: HttpRequest, path: web::Path<common_utils::id_type::MerchantId>, json_payload: web::Json<api_types::CreateApiKeyRequest>, ) -> impl Responder { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/api_keys.rs | crate: router use actix_web::{web, HttpRequest, Responder}; use router_env::{instrument, tracing, Flow}; use super::app::AppState; use crate::{ core::{api_keys, api_locking}, services::{api, authentication as auth, authorization::permissions::Permission}, types::api as api_types, }; pub async fn api_key_list( state: web::Data<AppState>, req: HttpRequest, path: web::Path<common_utils::id_type::MerchantId>, query: web::Query<api_types::ListApiKeyConstraints>, ) -> impl Responder { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/currency.rs | crate: router use actix_web::{web, HttpRequest, HttpResponse}; use router_env::Flow; use crate::{ core::{api_locking, currency}, routes::AppState, services::{api, authentication as auth}, }; pub async fn convert_forex( state: web::Data<AppState>, req: HttpRequest, params: web::Query<api_models::currency::CurrencyConversionParams>, ) -> HttpResponse { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/currency.rs | crate: router use actix_web::{web, HttpRequest, HttpResponse}; use router_env::Flow; use crate::{ core::{api_locking, currency}, routes::AppState, services::{api, authentication as auth}, }; pub async fn retrieve_forex(state: web::Data<AppState>, req: HttpRequest) -> HttpResponse { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
// file: hyperswitch/crates/router/src/routes/currency.rs | crate: router use actix_web::{web, HttpRequest, HttpResponse}; use router_env::Flow; use crate::{ core::{api_locking, currency}, routes::AppState, services::{api, authentication as auth}, }; 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), &auth::DashboardNoPermissionAuth, req.headers(), ), api_locking::LockAction::NotApplicable, )) .await }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/routing.rs | crate: router use actix_web::{web, HttpRequest, Responder}; use api_models::{enums, routing as routing_types, routing::RoutingRetrieveQuery}; use router_env::{ tracing::{self, instrument}, Flow, }; use crate::{ core::{api_locking, conditional_config, routing, surcharge_decision_config}, routes::AppState, services::{api as oss_api, authentication as auth, authorization::permissions::Permission}, }; pub async fn set_dynamic_routing_volume_split( state: web::Data<AppState>, req: HttpRequest, query: web::Query<api_models::routing::DynamicRoutingVolumeSplitQuery>, path: web::Path<routing_types::ToggleDynamicRoutingPath>, ) -> impl Responder { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/routing.rs | crate: router use actix_web::{web, HttpRequest, Responder}; use api_models::{enums, routing as routing_types, routing::RoutingRetrieveQuery}; use router_env::{ tracing::{self, instrument}, Flow, }; use crate::{ core::{api_locking, conditional_config, routing, surcharge_decision_config}, routes::AppState, services::{api as oss_api, authentication as auth, authorization::permissions::Permission}, }; pub async fn toggle_elimination_routing( state: web::Data<AppState>, req: HttpRequest, query: web::Query<api_models::routing::ToggleDynamicRoutingQuery>, path: web::Path<routing_types::ToggleDynamicRoutingPath>, ) -> impl Responder { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/routing.rs | crate: router use actix_web::{web, HttpRequest, Responder}; use api_models::{enums, routing as routing_types, routing::RoutingRetrieveQuery}; use router_env::{ tracing::{self, instrument}, Flow, }; use crate::{ core::{api_locking, conditional_config, routing, surcharge_decision_config}, routes::AppState, services::{api as oss_api, authentication as auth, authorization::permissions::Permission}, }; 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 { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/routing.rs | crate: router use actix_web::{web, HttpRequest, Responder}; use api_models::{enums, routing as routing_types, routing::RoutingRetrieveQuery}; use router_env::{ tracing::{self, instrument}, Flow, }; use crate::{ core::{api_locking, conditional_config, routing, surcharge_decision_config}, routes::AppState, services::{api as oss_api, authentication as auth, authorization::permissions::Permission}, }; 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 { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/routing.rs | crate: router use actix_web::{web, HttpRequest, Responder}; use api_models::{enums, routing as routing_types, routing::RoutingRetrieveQuery}; use router_env::{ tracing::{self, instrument}, Flow, }; use crate::{ core::{api_locking, conditional_config, routing, surcharge_decision_config}, routes::AppState, services::{api as oss_api, authentication as auth, authorization::permissions::Permission}, }; pub async fn success_based_routing_update_configs( state: web::Data<AppState>, req: HttpRequest, path: web::Path<routing_types::DynamicRoutingUpdateConfigQuery>, json_payload: web::Json<routing_types::SuccessBasedRoutingConfig>, ) -> impl Responder { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/routing.rs | crate: router use actix_web::{web, HttpRequest, Responder}; use api_models::{enums, routing as routing_types, routing::RoutingRetrieveQuery}; use router_env::{ tracing::{self, instrument}, Flow, }; use crate::{ core::{api_locking, conditional_config, routing, surcharge_decision_config}, routes::AppState, services::{api as oss_api, authentication as auth, authorization::permissions::Permission}, }; pub async fn toggle_success_based_routing( state: web::Data<AppState>, req: HttpRequest, query: web::Query<api_models::routing::ToggleDynamicRoutingQuery>, path: web::Path<routing_types::ToggleDynamicRoutingPath>, ) -> impl Responder { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/routing.rs | crate: router use actix_web::{web, HttpRequest, Responder}; use api_models::{enums, routing as routing_types, routing::RoutingRetrieveQuery}; use router_env::{ tracing::{self, instrument}, Flow, }; use crate::{ core::{api_locking, conditional_config, routing, surcharge_decision_config}, routes::AppState, services::{api as oss_api, authentication as auth, authorization::permissions::Permission}, }; pub async fn routing_update_default_config_for_profile( state: web::Data<AppState>, req: HttpRequest, path: web::Path<common_utils::id_type::ProfileId>, json_payload: web::Json<Vec<routing_types::RoutableConnectorChoice>>, transaction_type: &enums::TransactionType, ) -> impl Responder { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/routing.rs | crate: router use actix_web::{web, HttpRequest, Responder}; use api_models::{enums, routing as routing_types, routing::RoutingRetrieveQuery}; use router_env::{ tracing::{self, instrument}, Flow, }; use crate::{ core::{api_locking, conditional_config, routing, surcharge_decision_config}, routes::AppState, services::{api as oss_api, authentication as auth, authorization::permissions::Permission}, }; pub async fn routing_retrieve_default_config_for_profiles( state: web::Data<AppState>, req: HttpRequest, transaction_type: &enums::TransactionType, ) -> impl Responder { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/routing.rs | crate: router use actix_web::{web, HttpRequest, Responder}; use api_models::{enums, routing as routing_types, routing::RoutingRetrieveQuery}; use router_env::{ tracing::{self, instrument}, Flow, }; use crate::{ core::{api_locking, conditional_config, routing, surcharge_decision_config}, routes::AppState, services::{api as oss_api, authentication as auth, authorization::permissions::Permission}, }; pub async fn routing_retrieve_linked_config( state: web::Data<AppState>, req: HttpRequest, query: web::Query<RoutingRetrieveQuery>, path: web::Path<common_utils::id_type::ProfileId>, transaction_type: &enums::TransactionType, ) -> impl Responder { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/routing.rs | crate: router use actix_web::{web, HttpRequest, Responder}; use api_models::{enums, routing as routing_types, routing::RoutingRetrieveQuery}; use router_env::{ tracing::{self, instrument}, Flow, }; use crate::{ core::{api_locking, conditional_config, routing, surcharge_decision_config}, routes::AppState, services::{api as oss_api, authentication as auth, authorization::permissions::Permission}, }; pub async fn routing_retrieve_linked_config( state: web::Data<AppState>, req: HttpRequest, query: web::Query<routing_types::RoutingRetrieveLinkQuery>, transaction_type: &enums::TransactionType, ) -> impl Responder { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/routing.rs | crate: router use actix_web::{web, HttpRequest, Responder}; use router_env::{ tracing::{self, instrument}, Flow, }; use crate::{ core::{api_locking, conditional_config, routing, surcharge_decision_config}, routes::AppState, services::{api as oss_api, authentication as auth, authorization::permissions::Permission}, }; pub async fn retrieve_decision_manager_config( state: web::Data<AppState>, req: HttpRequest, ) -> impl Responder { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/routing.rs | crate: router use actix_web::{web, HttpRequest, Responder}; use router_env::{ tracing::{self, instrument}, Flow, }; use crate::{ core::{api_locking, conditional_config, routing, surcharge_decision_config}, routes::AppState, services::{api as oss_api, authentication as auth, authorization::permissions::Permission}, }; pub async fn delete_decision_manager_config( state: web::Data<AppState>, req: HttpRequest, ) -> impl Responder { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/routing.rs | crate: router use actix_web::{web, HttpRequest, Responder}; use api_models::{enums, routing as routing_types, routing::RoutingRetrieveQuery}; use router_env::{ tracing::{self, instrument}, Flow, }; use crate::{ core::{api_locking, conditional_config, routing, surcharge_decision_config}, routes::AppState, services::{api as oss_api, authentication as auth, authorization::permissions::Permission}, }; pub async fn upsert_decision_manager_config( state: web::Data<AppState>, req: HttpRequest, json_payload: web::Json<api_models::conditional_configs::DecisionManagerRequest>, ) -> impl Responder { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/routing.rs | crate: router use actix_web::{web, HttpRequest, Responder}; use api_models::{enums, routing as routing_types, routing::RoutingRetrieveQuery}; use router_env::{ tracing::{self, instrument}, Flow, }; use crate::{ core::{api_locking, conditional_config, routing, surcharge_decision_config}, routes::AppState, services::{api as oss_api, authentication as auth, authorization::permissions::Permission}, }; pub async fn upsert_decision_manager_config( state: web::Data<AppState>, req: HttpRequest, json_payload: web::Json<api_models::conditional_configs::DecisionManager>, ) -> impl Responder { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/routing.rs | crate: router use actix_web::{web, HttpRequest, Responder}; use router_env::{ tracing::{self, instrument}, Flow, }; use crate::{ core::{api_locking, conditional_config, routing, surcharge_decision_config}, routes::AppState, services::{api as oss_api, authentication as auth, authorization::permissions::Permission}, }; pub async fn retrieve_surcharge_decision_manager_config( state: web::Data<AppState>, req: HttpRequest, ) -> impl Responder { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/routing.rs | crate: router use actix_web::{web, HttpRequest, Responder}; use router_env::{ tracing::{self, instrument}, Flow, }; use crate::{ core::{api_locking, conditional_config, routing, surcharge_decision_config}, routes::AppState, services::{api as oss_api, authentication as auth, authorization::permissions::Permission}, }; pub async fn delete_surcharge_decision_manager_config( state: web::Data<AppState>, req: HttpRequest, ) -> impl Responder { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/routing.rs | crate: router use actix_web::{web, HttpRequest, Responder}; use api_models::{enums, routing as routing_types, routing::RoutingRetrieveQuery}; use router_env::{ tracing::{self, instrument}, Flow, }; use crate::{ core::{api_locking, conditional_config, routing, surcharge_decision_config}, routes::AppState, services::{api as oss_api, authentication as auth, authorization::permissions::Permission}, }; pub async fn upsert_surcharge_decision_manager_config( state: web::Data<AppState>, req: HttpRequest, json_payload: web::Json<api_models::surcharge_decision_configs::SurchargeDecisionConfigReq>, ) -> impl Responder { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/routing.rs | crate: router use actix_web::{web, HttpRequest, Responder}; use api_models::{enums, routing as routing_types, routing::RoutingRetrieveQuery}; use router_env::{ tracing::{self, instrument}, Flow, }; use crate::{ core::{api_locking, conditional_config, routing, surcharge_decision_config}, routes::AppState, services::{api as oss_api, authentication as auth, authorization::permissions::Permission}, }; pub async fn routing_retrieve_default_config( state: web::Data<AppState>, req: HttpRequest, path: web::Path<common_utils::id_type::ProfileId>, ) -> impl Responder { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/routing.rs | crate: router use actix_web::{web, HttpRequest, Responder}; use api_models::{enums, routing as routing_types, routing::RoutingRetrieveQuery}; use router_env::{ tracing::{self, instrument}, Flow, }; use crate::{ core::{api_locking, conditional_config, routing, surcharge_decision_config}, routes::AppState, services::{api as oss_api, authentication as auth, authorization::permissions::Permission}, }; pub async fn routing_update_default_config( state: web::Data<AppState>, req: HttpRequest, json_payload: web::Json<Vec<routing_types::RoutableConnectorChoice>>, transaction_type: &enums::TransactionType, ) -> impl Responder { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/routing.rs | crate: router use actix_web::{web, HttpRequest, Responder}; use api_models::{enums, routing as routing_types, routing::RoutingRetrieveQuery}; use router_env::{ tracing::{self, instrument}, Flow, }; use crate::{ core::{api_locking, conditional_config, routing, surcharge_decision_config}, routes::AppState, services::{api as oss_api, authentication as auth, authorization::permissions::Permission}, }; pub async fn routing_update_default_config( state: web::Data<AppState>, req: HttpRequest, path: web::Path<common_utils::id_type::ProfileId>, json_payload: web::Json<Vec<routing_types::RoutableConnectorChoice>>, ) -> impl Responder { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/routing.rs | crate: router use actix_web::{web, HttpRequest, Responder}; use api_models::{enums, routing as routing_types, routing::RoutingRetrieveQuery}; use router_env::{ tracing::{self, instrument}, Flow, }; use crate::{ core::{api_locking, conditional_config, routing, surcharge_decision_config}, routes::AppState, services::{api as oss_api, authentication as auth, authorization::permissions::Permission}, }; pub async fn routing_unlink_config( state: web::Data<AppState>, req: HttpRequest, payload: web::Json<routing_types::RoutingConfigRequest>, transaction_type: &enums::TransactionType, ) -> impl Responder { <|fim_suffix|> <|fim_middle|> }
ast_fragments
// file: hyperswitch/crates/router/src/routes/routing.rs | crate: router use actix_web::{web, HttpRequest, Responder}; use api_models::{enums, routing as routing_types, routing::RoutingRetrieveQuery}; use router_env::{ tracing::{self, instrument}, Flow, }; use crate::{ core::{api_locking, conditional_config, routing, surcharge_decision_config}, routes::AppState, services::{api as oss_api, authentication as auth, authorization::permissions::Permission}, }; pub async fn routing_unlink_config( state: web::Data<AppState>, req: HttpRequest, path: web::Path<common_utils::id_type::ProfileId>, transaction_type: &enums::TransactionType, ) -> impl Responder { let flow = Flow::RoutingUnlinkConfig; let path = path.into_inner(); Box::pin(oss_api::server_wrap( flow, state, &req, path.clone(), |state, auth: auth::AuthenticationData, path, _| { routing::unlink_routing_config_under_profile( state, auth.merchant_account, auth.key_store, path, transaction_type, ) }, #[cfg(not(feature = "release"))] auth::auth_type( &auth::V2ApiKeyAuth, &auth::JWTAuthProfileFromRoute { profile_id: path, required_permission: Permission::MerchantRoutingWrite, }, req.headers(), ), #[cfg(feature = "release")] &auth::JWTAuthProfileFromRoute { profile_id: path, required_permission: Permission::MerchantRoutingWrite, }, api_locking::LockAction::NotApplicable, )) .await }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/routing.rs | crate: router use actix_web::{web, HttpRequest, Responder}; use api_models::{enums, routing as routing_types, routing::RoutingRetrieveQuery}; use router_env::{ tracing::{self, instrument}, Flow, }; use crate::{ core::{api_locking, conditional_config, routing, surcharge_decision_config}, routes::AppState, services::{api as oss_api, authentication as auth, authorization::permissions::Permission}, }; pub async fn list_routing_configs_for_profile( state: web::Data<AppState>, req: HttpRequest, query: web::Query<RoutingRetrieveQuery>, transaction_type: &enums::TransactionType, ) -> impl Responder { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/routing.rs | crate: router use actix_web::{web, HttpRequest, Responder}; use api_models::{enums, routing as routing_types, routing::RoutingRetrieveQuery}; use router_env::{ tracing::{self, instrument}, Flow, }; use crate::{ core::{api_locking, conditional_config, routing, surcharge_decision_config}, routes::AppState, services::{api as oss_api, authentication as auth, authorization::permissions::Permission}, }; pub async fn list_routing_configs( state: web::Data<AppState>, req: HttpRequest, query: web::Query<RoutingRetrieveQuery>, transaction_type: &enums::TransactionType, ) -> impl Responder { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/routing.rs | crate: router use actix_web::{web, HttpRequest, Responder}; use api_models::{enums, routing as routing_types, routing::RoutingRetrieveQuery}; use router_env::{ tracing::{self, instrument}, Flow, }; use crate::{ core::{api_locking, conditional_config, routing, surcharge_decision_config}, routes::AppState, services::{api as oss_api, authentication as auth, authorization::permissions::Permission}, }; pub async fn routing_retrieve_config( state: web::Data<AppState>, req: HttpRequest, path: web::Path<common_utils::id_type::RoutingId>, ) -> impl Responder { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/routing.rs | crate: router use actix_web::{web, HttpRequest, Responder}; use api_models::{enums, routing as routing_types, routing::RoutingRetrieveQuery}; use router_env::{ tracing::{self, instrument}, Flow, }; use crate::{ core::{api_locking, conditional_config, routing, surcharge_decision_config}, routes::AppState, services::{api as oss_api, authentication as auth, authorization::permissions::Permission}, }; pub async fn routing_link_config( state: web::Data<AppState>, req: HttpRequest, path: web::Path<common_utils::id_type::ProfileId>, json_payload: web::Json<routing_types::RoutingAlgorithmId>, transaction_type: &enums::TransactionType, ) -> impl Responder { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/routing.rs | crate: router use actix_web::{web, HttpRequest, Responder}; use api_models::{enums, routing as routing_types, routing::RoutingRetrieveQuery}; use router_env::{ tracing::{self, instrument}, Flow, }; use crate::{ core::{api_locking, conditional_config, routing, surcharge_decision_config}, routes::AppState, services::{api as oss_api, authentication as auth, authorization::permissions::Permission}, }; pub async fn routing_link_config( state: web::Data<AppState>, req: HttpRequest, path: web::Path<common_utils::id_type::RoutingId>, transaction_type: &enums::TransactionType, ) -> impl Responder { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/routing.rs | crate: router use actix_web::{web, HttpRequest, Responder}; use api_models::{enums, routing as routing_types, routing::RoutingRetrieveQuery}; use router_env::{ tracing::{self, instrument}, Flow, }; use crate::{ core::{api_locking, conditional_config, routing, surcharge_decision_config}, routes::AppState, services::{api as oss_api, authentication as auth, authorization::permissions::Permission}, }; pub async fn routing_create_config( state: web::Data<AppState>, req: HttpRequest, json_payload: web::Json<routing_types::RoutingConfigRequest>, transaction_type: enums::TransactionType, ) -> impl Responder { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/routing.rs | crate: router use actix_web::{web, HttpRequest, Responder}; use api_models::{enums, routing as routing_types, routing::RoutingRetrieveQuery}; use router_env::{ tracing::{self, instrument}, Flow, }; use crate::{ core::{api_locking, conditional_config, routing, surcharge_decision_config}, routes::AppState, services::{api as oss_api, authentication as auth, authorization::permissions::Permission}, }; pub async fn routing_unlink_config( state: web::Data<AppState>, req: HttpRequest, path: web::Path<common_utils::id_type::ProfileId>, transaction_type: &enums::TransactionType, ) -> impl Responder { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/routing.rs | crate: router use actix_web::{web, HttpRequest, Responder}; use api_models::{enums, routing as routing_types, routing::RoutingRetrieveQuery}; use router_env::{ tracing::{self, instrument}, Flow, }; use crate::{ core::{api_locking, conditional_config, routing, surcharge_decision_config}, routes::AppState, services::{api as oss_api, authentication as auth, authorization::permissions::Permission}, }; pub async fn routing_retrieve_default_config( state: web::Data<AppState>, req: HttpRequest, transaction_type: &enums::TransactionType, ) -> impl Responder { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/app.rs | crate: router use std::{collections::HashMap, sync::Arc}; use common_utils::crypto::Blake3; use common_utils::id_type; use external_services::email::{ no_email::NoEmailClient, ses::AwsSes, smtp::SmtpServer, EmailClientConfigs, EmailService, }; use external_services::{ file_storage::FileStorageInterface, grpc_client::{GrpcClients, GrpcHeaders}, }; use self::settings::Tenant; pub use crate::analytics::opensearch::OpenSearchClient; pub use crate::{ configs::settings, db::{ AccountsStorageInterface, CommonStorageInterface, GlobalStorageInterface, StorageImpl, StorageInterface, }, events::EventsHandler, services::{get_cache_store, get_store}, }; pub fn get_session_state<E, F>( self: Arc<Self>, tenant: &id_type::TenantId, locale: Option<String>, err: F, ) -> Result<SessionState, E> where F: FnOnce() -> E + Copy, { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/app.rs | crate: router use std::{collections::HashMap, sync::Arc}; use storage_impl::{config::TenantConfig, redis::RedisStore, MockDb}; pub use crate::analytics::opensearch::OpenSearchClient; pub use crate::{ configs::settings, db::{ AccountsStorageInterface, CommonStorageInterface, GlobalStorageInterface, StorageImpl, StorageInterface, }, events::EventsHandler, services::{get_cache_store, get_store}, }; use crate::{ configs::{secrets_transformers, Settings}, db::kafka_store::{KafkaStore, TenantID}, routes::hypersense as hypersense_routes, }; /// # Panics /// /// Panics if Failed to create store pub async fn get_store_interface( storage_impl: &StorageImpl, event_handler: &EventsHandler, conf: &Settings, tenant: &dyn TenantConfig, cache_store: Arc<RedisStore>, testable: bool, ) -> Box<dyn CommonStorageInterface> { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/app.rs | crate: router self.event_handler.clone() } fn get_request_id(&self) -> Option<String> { self.api_client.get_request_id() } fn add_request_id(&mut self, request_id: RequestId) { self.api_client.add_request_id(request_id); self.store.add_request_id(request_id.to_string()); self.request_id.replace(request_id); } #[cfg(feature = "partial-auth")] fn get_detached_auth(&self) -> RouterResult<(Blake3, &[u8])> { use error_stack::ResultExt; use hyperswitch_domain_models::errors::api_error_response as errors; use masking::prelude::PeekInterface as _; use router_env::logger; let output = CHECKSUM_KEY.get_or_try_init(|| { let conf = self.conf(); let context = conf .api_keys .get_inner() .checksum_auth_context .peek() fn get_detached_auth(&self) -> RouterResult<(Blake3, &[u8])> { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/app.rs | crate: router fn get_request_id(&self) -> Option<String> { self.api_client.get_request_id() } } impl AsRef<Self> for AppState { fn as_ref(&self) -> &Self { self } } #[cfg(feature = "email")] pub async fn create_email_client( settings: &settings::Settings<RawSecret>, ) -> Box<dyn EmailService> { match &settings.email.client_config { EmailClientConfigs::Ses { aws_ses } => Box::new( AwsSes::create( &settings.email, aws_ses, settings.proxy.https_url.to_owned(), ) .await, ), EmailClientConfigs::Smtp { smtp } => { pub async fn create_email_client( settings: &settings::Settings<RawSecret>, ) -> Box<dyn EmailService> { { EmailClientConfigs::Ses { aws_ses } => Box::new( AwsSes::create( &settings.email, aws_ses, settings.proxy.https_url.to_owned(), ) .await, ),<|fim_suffix|> <|fim_middle|> EmailClientConfigs::NoEmailClient => Box::new(NoEmailClient::create().await), } }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/app.rs | crate: router use actix_web::{web, Scope}; use storage_impl::{config::TenantConfig, redis::RedisStore, MockDb}; use super::{apple_pay_certificates_migration, blocklist, payment_link, webhook_events}; pub use crate::analytics::opensearch::OpenSearchClient; pub use crate::{ configs::settings, db::{ AccountsStorageInterface, CommonStorageInterface, GlobalStorageInterface, StorageImpl, StorageInterface, }, events::EventsHandler, services::{get_cache_store, get_store}, }; pub fn server(config: AppState) -> Scope { <|fim_suffix|> <|fim_middle|> }
ast_fragments
// file: hyperswitch/crates/router/src/routes/app.rs | crate: router use actix_web::{web, Scope}; use super::{ admin, api_keys, cache::*, connector_onboarding, disputes, files, gsm, health::*, profiles, relay, user, user_role, }; pub use crate::analytics::opensearch::OpenSearchClient; pub use crate::{ configs::settings, db::{ AccountsStorageInterface, CommonStorageInterface, GlobalStorageInterface, StorageImpl, StorageInterface, }, events::EventsHandler, services::{get_cache_store, get_store}, }; pub fn server(state: AppState) -> Scope { web::scope("/cache") .app_data(web::Data::new(state)) .service(web::resource("/invalidate/{key}").route(web::post().to(invalidate))) }
ast_fragments
// file: hyperswitch/crates/router/src/routes/app.rs | crate: router use actix_web::{web, Scope}; use super::{apple_pay_certificates_migration, blocklist, payment_link, webhook_events}; pub use crate::analytics::opensearch::OpenSearchClient; pub use crate::{ configs::settings, db::{ AccountsStorageInterface, CommonStorageInterface, GlobalStorageInterface, StorageImpl, StorageInterface, }, events::EventsHandler, services::{get_cache_store, get_store}, }; pub fn server(state: AppState) -> Scope { web::scope("/apple_pay_certificates_migration") .app_data(web::Data::new(state)) .service(web::resource("").route( web::post().to(apple_pay_certificates_migration::apple_pay_certificates_migration), )) }
ast_fragments
// file: hyperswitch/crates/router/src/routes/app.rs | crate: router use actix_web::{web, Scope}; use super::{ admin, api_keys, cache::*, connector_onboarding, disputes, files, gsm, health::*, profiles, relay, user, user_role, }; pub use crate::analytics::opensearch::OpenSearchClient; pub use crate::{ configs::settings, db::{ AccountsStorageInterface, CommonStorageInterface, GlobalStorageInterface, StorageImpl, StorageInterface, }, events::EventsHandler, services::{get_cache_store, get_store}, }; pub fn server(state: AppState) -> Scope { web::scope("/v2/merchant-accounts") .app_data(web::Data::new(state)) .service(web::resource("").route(web::post().to(admin::merchant_account_create))) .service( web::scope("/{id}") .service( web::resource("") .route(web::get().to(admin::retrieve_merchant_account)) .route(web::put().to(admin::update_merchant_account)), ) .service( web::resource("/profiles").route(web::get().to(profiles::profiles_list)), ), ) }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/app.rs | crate: router use hyperswitch_interfaces::{ encryption_interface::EncryptionManagementInterface, secrets_interface::secret_state::{RawSecret, SecuredSecret}, }; use tokio::sync::oneshot; use self::settings::Tenant; pub use crate::analytics::opensearch::OpenSearchClient; use crate::analytics::AnalyticsProvider; use crate::errors::RouterResult; use crate::routes::cards_info::{ card_iin_info, create_cards_info, migrate_cards_info, update_cards_info, }; use crate::routes::feature_matrix; use crate::routes::fraud_check as frm_routes; use crate::routes::recon as recon_routes; pub use crate::{ configs::settings, db::{ AccountsStorageInterface, CommonStorageInterface, GlobalStorageInterface, StorageImpl, StorageInterface, }, events::EventsHandler, services::{get_cache_store, get_store}, }; use crate::{ configs::{secrets_transformers, Settings}, db::kafka_store::{KafkaStore, TenantID}, routes::hypersense as hypersense_routes, }; pub async fn new( conf: settings::Settings<SecuredSecret>, shut_down_signal: oneshot::Sender<()>, api_client: Box<dyn crate::services::ApiClient>, ) -> Self { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/app.rs | crate: router use external_services::email::{ no_email::NoEmailClient, ses::AwsSes, smtp::SmtpServer, EmailClientConfigs, EmailService, }; use hyperswitch_interfaces::{ encryption_interface::EncryptionManagementInterface, secrets_interface::secret_state::{RawSecret, SecuredSecret}, }; use self::settings::Tenant; pub use crate::analytics::opensearch::OpenSearchClient; pub use crate::{ configs::settings, db::{ AccountsStorageInterface, CommonStorageInterface, GlobalStorageInterface, StorageImpl, StorageInterface, }, events::EventsHandler, services::{get_cache_store, get_store}, }; use crate::{ configs::{secrets_transformers, Settings}, db::kafka_store::{KafkaStore, TenantID}, routes::hypersense as hypersense_routes, }; pub async fn create_email_client( settings: &settings::Settings<RawSecret>, ) -> Box<dyn EmailService> { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/app.rs | crate: router use self::settings::Tenant; fn as_ref(&self) -> &Self { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/app.rs | crate: router use self::settings::Tenant; fn add_flow_name(&mut self, flow_name: String) { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/app.rs | crate: router use router_env::tracing_actix_web::RequestId; use self::settings::Tenant; fn add_request_id(&mut self, request_id: RequestId) { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/app.rs | crate: router use self::settings::Tenant; pub use crate::{ configs::settings, db::{ AccountsStorageInterface, CommonStorageInterface, GlobalStorageInterface, StorageImpl, StorageInterface, }, events::EventsHandler, services::{get_cache_store, get_store}, }; fn event_handler(&self) -> EventsHandler { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/app.rs | crate: router use std::{collections::HashMap, sync::Arc}; use external_services::email::{ no_email::NoEmailClient, ses::AwsSes, smtp::SmtpServer, EmailClientConfigs, EmailService, }; use self::settings::Tenant; fn email_client(&self) -> Arc<Box<dyn EmailService>> { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/app.rs | crate: router use hyperswitch_interfaces::{ encryption_interface::EncryptionManagementInterface, secrets_interface::secret_state::{RawSecret, SecuredSecret}, }; use self::settings::Tenant; pub use crate::{ configs::settings, db::{ AccountsStorageInterface, CommonStorageInterface, GlobalStorageInterface, StorageImpl, StorageInterface, }, events::EventsHandler, services::{get_cache_store, get_store}, }; use crate::{ configs::{secrets_transformers, Settings}, db::kafka_store::{KafkaStore, TenantID}, routes::hypersense as hypersense_routes, }; fn conf(&self) -> settings::Settings<RawSecret> { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/app.rs | crate: router use common_utils::id_type; use self::settings::Tenant; fn get_tenants(&self) -> Vec<id_type::TenantId> { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/app.rs | crate: router use self::settings::Tenant; fn session_state(&self) -> SessionState { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/app.rs | crate: router use self::settings::Tenant; pub use crate::{ configs::settings, db::{ AccountsStorageInterface, CommonStorageInterface, GlobalStorageInterface, StorageImpl, StorageInterface, }, events::EventsHandler, services::{get_cache_store, get_store}, }; fn store(&self) -> Box<dyn StorageInterface> { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/app.rs | crate: router use external_services::{ file_storage::FileStorageInterface, grpc_client::{GrpcClients, GrpcHeaders}, }; use self::settings::Tenant; pub use crate::analytics::opensearch::OpenSearchClient; pub use crate::{ configs::settings, db::{ AccountsStorageInterface, CommonStorageInterface, GlobalStorageInterface, StorageImpl, StorageInterface, }, events::EventsHandler, services::{get_cache_store, get_store}, }; pub fn get_grpc_headers(&self) -> GrpcHeaders { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/app.rs | crate: router use self::settings::Tenant; pub use crate::analytics::opensearch::OpenSearchClient; pub use crate::{ configs::settings, db::{ AccountsStorageInterface, CommonStorageInterface, GlobalStorageInterface, StorageImpl, StorageInterface, }, events::EventsHandler, services::{get_cache_store, get_store}, }; pub fn get_req_state(&self) -> ReqState { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/app.rs | crate: router use scheduler::SchedulerInterface; use self::settings::Tenant; fn get_db(&self) -> Box<dyn SchedulerInterface> { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/app.rs | crate: router use std::{collections::HashMap, sync::Arc}; use external_services::email::{ no_email::NoEmailClient, ses::AwsSes, smtp::SmtpServer, EmailClientConfigs, EmailService, }; use external_services::{ file_storage::FileStorageInterface, grpc_client::{GrpcClients, GrpcHeaders}, }; use hyperswitch_interfaces::{ encryption_interface::EncryptionManagementInterface, secrets_interface::secret_state::{RawSecret, SecuredSecret}, }; use storage_impl::{config::TenantConfig, redis::RedisStore, MockDb}; use tokio::sync::oneshot; use self::settings::Tenant; pub use crate::analytics::opensearch::OpenSearchClient; use crate::analytics::AnalyticsProvider; use crate::errors::RouterResult; use crate::routes::cards_info::{ card_iin_info, create_cards_info, migrate_cards_info, update_cards_info, }; use crate::routes::feature_matrix; use crate::routes::fraud_check as frm_routes; use crate::routes::recon as recon_routes; pub use crate::{ configs::settings, db::{ AccountsStorageInterface, CommonStorageInterface, GlobalStorageInterface, StorageImpl, StorageInterface, }, events::EventsHandler, services::{get_cache_store, get_store}, }; use crate::{ configs::{secrets_transformers, Settings}, db::kafka_store::{KafkaStore, TenantID}, routes::hypersense as hypersense_routes, }; /// # Panics /// /// Panics if Store can't be created or JWE decryption fails pub async fn with_storage( conf: settings::Settings<SecuredSecret>, storage_impl: StorageImpl, shut_down_signal: oneshot::Sender<()>, api_client: Box<dyn crate::services::ApiClient>, ) -> Self { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/app.rs | crate: router use actix_web::{web, Scope}; use external_services::email::{ no_email::NoEmailClient, ses::AwsSes, smtp::SmtpServer, EmailClientConfigs, EmailService, }; use super::dummy_connector::*; use super::{ admin, api_keys, cache::*, connector_onboarding, disputes, files, gsm, health::*, profiles, relay, user, user_role, }; pub use crate::analytics::opensearch::OpenSearchClient; use crate::routes::cards_info::{ card_iin_info, create_cards_info, migrate_cards_info, update_cards_info, }; use crate::routes::feature_matrix; use crate::routes::fraud_check as frm_routes; use crate::routes::recon as recon_routes; pub use crate::{ configs::settings, db::{ AccountsStorageInterface, CommonStorageInterface, GlobalStorageInterface, StorageImpl, StorageInterface, }, events::EventsHandler, services::{get_cache_store, get_store}, }; use crate::{ configs::{secrets_transformers, Settings}, db::kafka_store::{KafkaStore, TenantID}, routes::hypersense as hypersense_routes, }; pub fn server(state: AppState) -> Scope { {let mut route = web::scope("/user").app_data(web::Data::new(state));<|fim_suffix|> <|fim_middle|> route}}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/admin.rs | crate: router use actix_web::{web, HttpRequest, HttpResponse}; use router_env::{instrument, tracing, Flow}; use super::app::AppState; use crate::{ core::{admin::*, api_locking}, services::{api, authentication as auth, authorization::permissions::Permission}, types::api::admin, }; pub async fn connector_delete( state: web::Data<AppState>, req: HttpRequest, path: web::Path<common_utils::id_type::MerchantConnectorAccountId>, ) -> HttpResponse { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/admin.rs | crate: router use actix_web::{web, HttpRequest, HttpResponse}; use router_env::{instrument, tracing, Flow}; use super::app::AppState; use crate::{ core::{admin::*, api_locking}, services::{api, authentication as auth, authorization::permissions::Permission}, types::api::admin, }; pub async fn connector_delete( state: web::Data<AppState>, req: HttpRequest, path: web::Path<( common_utils::id_type::MerchantId, common_utils::id_type::MerchantConnectorAccountId, )>, ) -> HttpResponse { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/admin.rs | crate: router use actix_web::{web, HttpRequest, HttpResponse}; use router_env::{instrument, tracing, Flow}; use super::app::AppState; use crate::{ core::{admin::*, api_locking}, services::{api, authentication as auth, authorization::permissions::Permission}, types::api::admin, }; pub async fn connector_update( state: web::Data<AppState>, req: HttpRequest, path: web::Path<common_utils::id_type::MerchantConnectorAccountId>, json_payload: web::Json<api_models::admin::MerchantConnectorUpdate>, ) -> HttpResponse { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/admin.rs | crate: router use actix_web::{web, HttpRequest, HttpResponse}; use router_env::{instrument, tracing, Flow}; use super::app::AppState; use crate::{ core::{admin::*, api_locking}, services::{api, authentication as auth, authorization::permissions::Permission}, types::api::admin, }; pub async fn connector_update( state: web::Data<AppState>, req: HttpRequest, path: web::Path<( common_utils::id_type::MerchantId, common_utils::id_type::MerchantConnectorAccountId, )>, json_payload: web::Json<api_models::admin::MerchantConnectorUpdate>, ) -> HttpResponse { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/admin.rs | crate: router use actix_web::{web, HttpRequest, HttpResponse}; use router_env::{instrument, tracing, Flow}; use super::app::AppState; use crate::{ core::{admin::*, api_locking}, services::{api, authentication as auth, authorization::permissions::Permission}, types::api::admin, }; pub async fn connector_list_profile( state: web::Data<AppState>, req: HttpRequest, path: web::Path<common_utils::id_type::MerchantId>, ) -> HttpResponse { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/admin.rs | crate: router use actix_web::{web, HttpRequest, HttpResponse}; use router_env::{instrument, tracing, Flow}; use super::app::AppState; use crate::{ core::{admin::*, api_locking}, services::{api, authentication as auth, authorization::permissions::Permission}, types::api::admin, }; pub async fn connector_list( state: web::Data<AppState>, req: HttpRequest, path: web::Path<common_utils::id_type::MerchantId>, ) -> HttpResponse { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/admin.rs | crate: router use actix_web::{web, HttpRequest, HttpResponse}; use router_env::{instrument, tracing, Flow}; use super::app::AppState; use crate::{ core::{admin::*, api_locking}, services::{api, authentication as auth, authorization::permissions::Permission}, types::api::admin, }; pub async fn connector_list( state: web::Data<AppState>, req: HttpRequest, path: web::Path<common_utils::id_type::ProfileId>, ) -> HttpResponse { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/admin.rs | crate: router use actix_web::{web, HttpRequest, HttpResponse}; use router_env::{instrument, tracing, Flow}; use super::app::AppState; use crate::{ core::{admin::*, api_locking}, services::{api, authentication as auth, authorization::permissions::Permission}, types::api::admin, }; pub async fn connector_retrieve( state: web::Data<AppState>, req: HttpRequest, path: web::Path<common_utils::id_type::MerchantConnectorAccountId>, ) -> HttpResponse { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/admin.rs | crate: router use actix_web::{web, HttpRequest, HttpResponse}; use router_env::{instrument, tracing, Flow}; use super::app::AppState; use crate::{ core::{admin::*, api_locking}, services::{api, authentication as auth, authorization::permissions::Permission}, types::api::admin, }; pub async fn connector_retrieve( state: web::Data<AppState>, req: HttpRequest, path: web::Path<( common_utils::id_type::MerchantId, common_utils::id_type::MerchantConnectorAccountId, )>, ) -> HttpResponse { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/admin.rs | crate: router use actix_web::{web, HttpRequest, HttpResponse}; use router_env::{instrument, tracing, Flow}; use super::app::AppState; use crate::{ core::{admin::*, api_locking}, services::{api, authentication as auth, authorization::permissions::Permission}, types::api::admin, }; pub async fn connector_create( state: web::Data<AppState>, req: HttpRequest, json_payload: web::Json<admin::MerchantConnectorCreate>, ) -> HttpResponse { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
// file: hyperswitch/crates/router/src/routes/admin.rs | crate: router use actix_web::{web, HttpRequest, HttpResponse}; use router_env::{instrument, tracing, Flow}; use super::app::AppState; use crate::{ core::{admin::*, api_locking}, services::{api, authentication as auth, authorization::permissions::Permission}, types::api::admin, }; pub async fn connector_create( state: web::Data<AppState>, req: HttpRequest, path: web::Path<common_utils::id_type::MerchantId>, json_payload: web::Json<admin::MerchantConnectorCreate>, ) -> HttpResponse { let flow = Flow::MerchantConnectorsCreate; let payload = json_payload.into_inner(); let merchant_id = path.into_inner(); Box::pin(api::server_wrap( flow, state, &req, payload, |state, auth_data, req, _| { create_connector( state, req, auth_data.merchant_account, auth_data.profile_id, auth_data.key_store, ) }, auth::auth_type( &auth::HeaderAuth(auth::ApiKeyAuthWithMerchantIdFromRoute(merchant_id.clone())), &auth::JWTAuthMerchantFromRoute { merchant_id: merchant_id.clone(), required_permission: Permission::ProfileConnectorWrite, }, req.headers(), ), api_locking::LockAction::NotApplicable, )) .await }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/admin.rs | crate: router use actix_web::{web, HttpRequest, HttpResponse}; use router_env::{instrument, tracing, Flow}; use super::app::AppState; use crate::{ core::{admin::*, api_locking}, services::{api, authentication as auth, authorization::permissions::Permission}, types::api::admin, }; pub async fn update_merchant_account( state: web::Data<AppState>, req: HttpRequest, mid: web::Path<common_utils::id_type::MerchantId>, json_payload: web::Json<admin::MerchantAccountUpdate>, ) -> HttpResponse { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/admin.rs | crate: router use actix_web::{web, HttpRequest, HttpResponse}; use router_env::{instrument, tracing, Flow}; use super::app::AppState; use crate::{ core::{admin::*, api_locking}, services::{api, authentication as auth, authorization::permissions::Permission}, types::api::admin, }; pub async fn merchant_account_list( state: web::Data<AppState>, req: HttpRequest, organization_id: web::Path<common_utils::id_type::OrganizationId>, ) -> HttpResponse { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/admin.rs | crate: router use actix_web::{web, HttpRequest, HttpResponse}; use router_env::{instrument, tracing, Flow}; use super::app::AppState; use crate::{ core::{admin::*, api_locking}, services::{api, authentication as auth, authorization::permissions::Permission}, types::api::admin, }; pub async fn retrieve_merchant_account( state: web::Data<AppState>, req: HttpRequest, mid: web::Path<common_utils::id_type::MerchantId>, ) -> HttpResponse { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/admin.rs | crate: router use actix_web::{web, HttpRequest, HttpResponse}; use router_env::{instrument, tracing, Flow}; use super::app::AppState; use crate::{ core::{admin::*, api_locking}, services::{api, authentication as auth, authorization::permissions::Permission}, types::api::admin, }; pub async fn merchant_account_create( state: web::Data<AppState>, req: HttpRequest, json_payload: web::Json<api_models::admin::MerchantAccountCreateWithoutOrgId>, ) -> HttpResponse { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/admin.rs | crate: router use actix_web::{web, HttpRequest, HttpResponse}; use router_env::{instrument, tracing, Flow}; use super::app::AppState; use crate::{ core::{admin::*, api_locking}, services::{api, authentication as auth, authorization::permissions::Permission}, types::api::admin, }; pub async fn organization_retrieve( state: web::Data<AppState>, req: HttpRequest, org_id: web::Path<common_utils::id_type::OrganizationId>, ) -> HttpResponse { <|fim_suffix|> <|fim_middle|> }
ast_fragments
<|fim_prefix|> // file: hyperswitch/crates/router/src/routes/admin.rs | crate: router use actix_web::{web, HttpRequest, HttpResponse}; use router_env::{instrument, tracing, Flow}; use super::app::AppState; use crate::{ core::{admin::*, api_locking}, services::{api, authentication as auth, authorization::permissions::Permission}, types::api::admin, }; pub async fn organization_update( state: web::Data<AppState>, req: HttpRequest, org_id: web::Path<common_utils::id_type::OrganizationId>, json_payload: web::Json<admin::OrganizationUpdateRequest>, ) -> HttpResponse { {<|fim_suffix|> <|fim_middle|> }}
ast_fragments