mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-30 17:47:54 +08:00
refactor(router): profile based routes for payouts (#5794)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
@ -703,13 +703,12 @@ impl Routing {
|
|||||||
)
|
)
|
||||||
})),
|
})),
|
||||||
)
|
)
|
||||||
.service(web::resource("/list/{profile_id}").route(web::get().to(
|
.service(web::resource("/list/profile").route(web::get().to(
|
||||||
|state, req, path, query: web::Query<RoutingRetrieveQuery>| {
|
|state, req, query: web::Query<RoutingRetrieveQuery>| {
|
||||||
routing::list_routing_configs_for_profile(
|
routing::list_routing_configs_for_profile(
|
||||||
state,
|
state,
|
||||||
req,
|
req,
|
||||||
query,
|
query,
|
||||||
path,
|
|
||||||
&TransactionType::Payment,
|
&TransactionType::Payment,
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
@ -796,6 +795,16 @@ impl Routing {
|
|||||||
)
|
)
|
||||||
})),
|
})),
|
||||||
)
|
)
|
||||||
|
.service(web::resource("/payouts/list/profile").route(web::get().to(
|
||||||
|
|state, req, query: web::Query<RoutingRetrieveQuery>| {
|
||||||
|
routing::list_routing_configs_for_profile(
|
||||||
|
state,
|
||||||
|
req,
|
||||||
|
query,
|
||||||
|
&TransactionType::Payout,
|
||||||
|
)
|
||||||
|
},
|
||||||
|
)))
|
||||||
.service(web::resource("/payouts/active").route(web::get().to(
|
.service(web::resource("/payouts/active").route(web::get().to(
|
||||||
|state, req, query_params| {
|
|state, req, query_params| {
|
||||||
routing::routing_retrieve_linked_config(
|
routing::routing_retrieve_linked_config(
|
||||||
|
|||||||
@ -216,11 +216,9 @@ pub async fn list_routing_configs_for_profile(
|
|||||||
state: web::Data<AppState>,
|
state: web::Data<AppState>,
|
||||||
req: HttpRequest,
|
req: HttpRequest,
|
||||||
query: web::Query<RoutingRetrieveQuery>,
|
query: web::Query<RoutingRetrieveQuery>,
|
||||||
path: web::Path<common_utils::id_type::ProfileId>,
|
|
||||||
transaction_type: &enums::TransactionType,
|
transaction_type: &enums::TransactionType,
|
||||||
) -> impl Responder {
|
) -> impl Responder {
|
||||||
let flow = Flow::RoutingRetrieveDictionary;
|
let flow = Flow::RoutingRetrieveDictionary;
|
||||||
let path = path.into_inner();
|
|
||||||
Box::pin(oss_api::server_wrap(
|
Box::pin(oss_api::server_wrap(
|
||||||
flow,
|
flow,
|
||||||
state,
|
state,
|
||||||
@ -238,17 +236,11 @@ pub async fn list_routing_configs_for_profile(
|
|||||||
#[cfg(not(feature = "release"))]
|
#[cfg(not(feature = "release"))]
|
||||||
auth::auth_type(
|
auth::auth_type(
|
||||||
&auth::HeaderAuth(auth::ApiKeyAuth),
|
&auth::HeaderAuth(auth::ApiKeyAuth),
|
||||||
&auth::JWTAuthProfileFromRoute {
|
&auth::JWTAuth(Permission::RoutingRead),
|
||||||
profile_id: path,
|
|
||||||
required_permission: Permission::RoutingRead,
|
|
||||||
},
|
|
||||||
req.headers(),
|
req.headers(),
|
||||||
),
|
),
|
||||||
#[cfg(feature = "release")]
|
#[cfg(feature = "release")]
|
||||||
&auth::JWTAuthProfileFromRoute {
|
&auth::JWTAuth(Permission::RoutingRead),
|
||||||
profile_id: path,
|
|
||||||
required_permission: Permission::RoutingRead,
|
|
||||||
},
|
|
||||||
api_locking::LockAction::NotApplicable,
|
api_locking::LockAction::NotApplicable,
|
||||||
))
|
))
|
||||||
.await
|
.await
|
||||||
|
|||||||
Reference in New Issue
Block a user