text stringlengths 70 351k | source stringclasses 4
values |
|---|---|
<|fim_prefix|>
// file: hyperswitch/crates/router/src/events/event_logger.rs | crate: router
use super::EventType;
use crate::services::{kafka::KafkaMessage, logger};
pub(super) fn log_event<T: KafkaMessage>(&self, event: &T) {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/routes/payment_methods.rs | crate: router
use actix_web::{web, HttpRequest, HttpResponse};
use common_utils::{errors::CustomResult, id_type, transformers::ForeignFrom};
use router_env::{instrument, logger, tracing, Flow};
use super::app::{AppState, SessionState};
use crate::{
core::{
api_locking,
errors::{self, utils::StorageErrorExt},
payment_methods::{self as payment_methods_routes, cards},
},
services::{self, api, authentication as auth, authorization::permissions::Permission},
types::{
api::payment_methods::{self, PaymentMethodId},
domain,
storage::payment_method::PaymentTokenData,
},
};
use crate::{
core::{
customers,
payment_methods::{migration, tokenize},
},
types::api::customers::CustomerRequest,
};
pub async fn payment_method_session_delete_saved_payment_method(
state: web::Data<AppState>,
req: HttpRequest,
path: web::Path<id_type::GlobalPaymentMethodSessionId>,
json_payload: web::Json<
api_models::payment_methods::PaymentMethodSessionDeleteSavedPaymentMethod,
>,
) -> HttpResponse {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/routes/payment_methods.rs | crate: router
use actix_web::{web, HttpRequest, HttpResponse};
use common_utils::{errors::CustomResult, id_type, transformers::ForeignFrom};
use router_env::{instrument, logger, tracing, Flow};
use super::app::{AppState, SessionState};
use crate::{
core::{
api_locking,
errors::{self, utils::StorageErrorExt},
payment_methods::{self as payment_methods_routes, cards},
},
services::{self, api, authentication as auth, authorization::permissions::Permission},
types::{
api::payment_methods::{self, PaymentMethodId},
domain,
storage::payment_method::PaymentTokenData,
},
};
use crate::{
core::{
customers,
payment_methods::{migration, tokenize},
},
types::api::customers::CustomerRequest,
};
pub async fn payment_method_session_update_saved_payment_method(
state: web::Data<AppState>,
req: HttpRequest,
path: web::Path<id_type::GlobalPaymentMethodSessionId>,
json_payload: web::Json<
api_models::payment_methods::PaymentMethodSessionUpdateSavedPaymentMethod,
>,
) -> HttpResponse {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/routes/payment_methods.rs | crate: router
use actix_web::{web, HttpRequest, HttpResponse};
use common_utils::{errors::CustomResult, id_type, transformers::ForeignFrom};
use router_env::{instrument, logger, tracing, Flow};
use super::app::{AppState, SessionState};
use crate::{
core::{
api_locking,
errors::{self, utils::StorageErrorExt},
payment_methods::{self as payment_methods_routes, cards},
},
services::{self, api, authentication as auth, authorization::permissions::Permission},
types::{
api::payment_methods::{self, PaymentMethodId},
domain,
storage::payment_method::PaymentTokenData,
},
};
use crate::{
core::{
customers,
payment_methods::{migration, tokenize},
},
types::api::customers::CustomerRequest,
};
pub async fn payment_method_session_confirm(
state: web::Data<AppState>,
req: HttpRequest,
path: web::Path<id_type::GlobalPaymentMethodSessionId>,
json_payload: web::Json<api_models::payment_methods::PaymentMethodSessionConfirmRequest>,
) -> HttpResponse {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/routes/payment_methods.rs | crate: router
use actix_web::{web, HttpRequest, HttpResponse};
use common_utils::{errors::CustomResult, id_type, transformers::ForeignFrom};
use router_env::{instrument, logger, tracing, Flow};
use super::app::{AppState, SessionState};
use crate::{
core::{
api_locking,
errors::{self, utils::StorageErrorExt},
payment_methods::{self as payment_methods_routes, cards},
},
services::{self, api, authentication as auth, authorization::permissions::Permission},
types::{
api::payment_methods::{self, PaymentMethodId},
domain,
storage::payment_method::PaymentTokenData,
},
};
use crate::{
core::{
customers,
payment_methods::{migration, tokenize},
},
types::api::customers::CustomerRequest,
};
pub async fn payment_method_session_list_payment_methods(
state: web::Data<AppState>,
req: HttpRequest,
path: web::Path<id_type::GlobalPaymentMethodSessionId>,
) -> HttpResponse {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
// file: hyperswitch/crates/router/src/routes/payment_methods.rs | crate: router
use actix_web::{web, HttpRequest, HttpResponse};
use common_utils::{errors::CustomResult, id_type, transformers::ForeignFrom};
use router_env::{instrument, logger, tracing, Flow};
use super::app::{AppState, SessionState};
use crate::{
core::{
api_locking,
errors::{self, utils::StorageErrorExt},
payment_methods::{self as payment_methods_routes, cards},
},
services::{self, api, authentication as auth, authorization::permissions::Permission},
types::{
api::payment_methods::{self, PaymentMethodId},
domain,
storage::payment_method::PaymentTokenData,
},
};
use crate::{
core::{
customers,
payment_methods::{migration, tokenize},
},
types::api::customers::CustomerRequest,
};
pub async fn payment_methods_session_retrieve(
state: web::Data<AppState>,
req: HttpRequest,
path: web::Path<id_type::GlobalPaymentMethodSessionId>,
) -> HttpResponse {
let flow = Flow::PaymentMethodSessionRetrieve;
let payment_method_session_id = path.into_inner();
Box::pin(api::server_wrap(
flow,
state,
&req,
payment_method_session_id.clone(),
|state, auth: auth::AuthenticationData, payment_method_session_id, _| async move {
payment_methods_routes::payment_methods_session_retrieve(
state,
auth.merchant_account,
auth.key_store,
payment_method_session_id,
)
.await
},
auth::api_or_client_auth(
&auth::V2ApiKeyAuth,
&auth::V2ClientAuth(
common_utils::types::authentication::ResourceId::PaymentMethodSession(
payment_method_session_id,
),
),
req.headers(),
),
api_locking::LockAction::NotApplicable,
))
.await
} | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/routes/payment_methods.rs | crate: router
use actix_web::{web, HttpRequest, HttpResponse};
use common_utils::{errors::CustomResult, id_type, transformers::ForeignFrom};
use router_env::{instrument, logger, tracing, Flow};
use super::app::{AppState, SessionState};
use crate::{
core::{
api_locking,
errors::{self, utils::StorageErrorExt},
payment_methods::{self as payment_methods_routes, cards},
},
services::{self, api, authentication as auth, authorization::permissions::Permission},
types::{
api::payment_methods::{self, PaymentMethodId},
domain,
storage::payment_method::PaymentTokenData,
},
};
use crate::{
core::{
customers,
payment_methods::{migration, tokenize},
},
types::api::customers::CustomerRequest,
};
pub async fn payment_methods_session_update(
state: web::Data<AppState>,
req: HttpRequest,
path: web::Path<id_type::GlobalPaymentMethodSessionId>,
json_payload: web::Json<api_models::payment_methods::PaymentMethodsSessionUpdateRequest>,
) -> HttpResponse {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/routes/payment_methods.rs | crate: router
use actix_web::{web, HttpRequest, HttpResponse};
use router_env::{instrument, logger, tracing, Flow};
use super::app::{AppState, SessionState};
use crate::{
core::{
api_locking,
errors::{self, utils::StorageErrorExt},
payment_methods::{self as payment_methods_routes, cards},
},
services::{self, api, authentication as auth, authorization::permissions::Permission},
types::{
api::payment_methods::{self, PaymentMethodId},
domain,
storage::payment_method::PaymentTokenData,
},
};
use crate::{
core::{
customers,
payment_methods::{migration, tokenize},
},
types::api::customers::CustomerRequest,
};
pub async fn payment_methods_session_create(
state: web::Data<AppState>,
req: HttpRequest,
json_payload: web::Json<api_models::payment_methods::PaymentMethodSessionRequest>,
) -> HttpResponse {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/routes/payment_methods.rs | crate: router
use actix_multipart::form::MultipartForm;
use actix_web::{web, HttpRequest, HttpResponse};
use router_env::{instrument, logger, tracing, Flow};
use super::app::{AppState, SessionState};
use crate::{
core::{
api_locking,
errors::{self, utils::StorageErrorExt},
payment_methods::{self as payment_methods_routes, cards},
},
services::{self, api, authentication as auth, authorization::permissions::Permission},
types::{
api::payment_methods::{self, PaymentMethodId},
domain,
storage::payment_method::PaymentTokenData,
},
};
use crate::{
core::{
customers,
payment_methods::{migration, tokenize},
},
types::api::customers::CustomerRequest,
};
pub async fn tokenize_card_batch_api(
state: web::Data<AppState>,
req: HttpRequest,
MultipartForm(form): MultipartForm<tokenize::CardNetworkTokenizeForm>,
) -> HttpResponse {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/routes/payment_methods.rs | crate: router
use actix_web::{web, HttpRequest, HttpResponse};
use common_utils::{errors::CustomResult, id_type, transformers::ForeignFrom};
use error_stack::ResultExt;
use hyperswitch_domain_models::{
bulk_tokenization::CardNetworkTokenizeRequest, merchant_key_store::MerchantKeyStore,
};
use router_env::{instrument, logger, tracing, Flow};
use super::app::{AppState, SessionState};
use crate::{
core::{
api_locking,
errors::{self, utils::StorageErrorExt},
payment_methods::{self as payment_methods_routes, cards},
},
services::{self, api, authentication as auth, authorization::permissions::Permission},
types::{
api::payment_methods::{self, PaymentMethodId},
domain,
storage::payment_method::PaymentTokenData,
},
};
use crate::{
core::{
customers,
payment_methods::{migration, tokenize},
},
types::api::customers::CustomerRequest,
};
pub async fn tokenize_card_using_pm_api(
state: web::Data<AppState>,
req: HttpRequest,
path: web::Path<String>,
json_payload: web::Json<payment_methods::CardNetworkTokenizeRequest>,
) -> HttpResponse {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/routes/payment_methods.rs | crate: router
use actix_web::{web, HttpRequest, HttpResponse};
use hyperswitch_domain_models::{
bulk_tokenization::CardNetworkTokenizeRequest, merchant_key_store::MerchantKeyStore,
};
use router_env::{instrument, logger, tracing, Flow};
use super::app::{AppState, SessionState};
use crate::{
core::{
api_locking,
errors::{self, utils::StorageErrorExt},
payment_methods::{self as payment_methods_routes, cards},
},
services::{self, api, authentication as auth, authorization::permissions::Permission},
types::{
api::payment_methods::{self, PaymentMethodId},
domain,
storage::payment_method::PaymentTokenData,
},
};
use crate::{
core::{
customers,
payment_methods::{migration, tokenize},
},
types::api::customers::CustomerRequest,
};
pub async fn tokenize_card_api(
state: web::Data<AppState>,
req: HttpRequest,
json_payload: web::Json<payment_methods::CardNetworkTokenizeRequest>,
) -> HttpResponse {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/routes/payment_methods.rs | crate: router
use actix_web::{web, HttpRequest, HttpResponse};
use router_env::{instrument, logger, tracing, Flow};
use super::app::{AppState, SessionState};
use crate::{
core::{
api_locking,
errors::{self, utils::StorageErrorExt},
payment_methods::{self as payment_methods_routes, cards},
},
services::{self, api, authentication as auth, authorization::permissions::Permission},
types::{
api::payment_methods::{self, PaymentMethodId},
domain,
storage::payment_method::PaymentTokenData,
},
};
use crate::{
core::{
customers,
payment_methods::{migration, tokenize},
},
types::api::customers::CustomerRequest,
};
pub async fn default_payment_method_set_api(
state: web::Data<AppState>,
req: HttpRequest,
path: web::Path<payment_methods::DefaultPaymentMethod>,
) -> HttpResponse {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/routes/payment_methods.rs | crate: router
use actix_web::{web, HttpRequest, HttpResponse};
use router_env::{instrument, logger, tracing, Flow};
use super::app::{AppState, SessionState};
use crate::{
core::{
api_locking,
errors::{self, utils::StorageErrorExt},
payment_methods::{self as payment_methods_routes, cards},
},
services::{self, api, authentication as auth, authorization::permissions::Permission},
types::{
api::payment_methods::{self, PaymentMethodId},
domain,
storage::payment_method::PaymentTokenData,
},
};
use crate::{
core::{
customers,
payment_methods::{migration, tokenize},
},
types::api::customers::CustomerRequest,
};
pub async fn list_countries_currencies_for_connector_payment_method(
state: web::Data<AppState>,
req: HttpRequest,
query_payload: web::Query<payment_methods::ListCountriesCurrenciesRequest>,
) -> HttpResponse {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/routes/payment_methods.rs | crate: router
use actix_web::{web, HttpRequest, HttpResponse};
use router_env::{instrument, logger, tracing, Flow};
use super::app::{AppState, SessionState};
use crate::{
core::{
api_locking,
errors::{self, utils::StorageErrorExt},
payment_methods::{self as payment_methods_routes, cards},
},
services::{self, api, authentication as auth, authorization::permissions::Permission},
types::{
api::payment_methods::{self, PaymentMethodId},
domain,
storage::payment_method::PaymentTokenData,
},
};
use crate::{
core::{
customers,
payment_methods::{migration, tokenize},
},
types::api::customers::CustomerRequest,
};
pub async fn payment_method_delete_api(
state: web::Data<AppState>,
req: HttpRequest,
payment_method_id: web::Path<(String,)>,
) -> HttpResponse {
{
Ok(auth) => auth,<|fim_suffix|>
<|fim_middle|>
Err(err) => return api::log_and_return_error_response(err),
}
} | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/routes/payment_methods.rs | crate: router
use actix_web::{web, HttpRequest, HttpResponse};
use router_env::{instrument, logger, tracing, Flow};
use super::app::{AppState, SessionState};
use crate::{
core::{
api_locking,
errors::{self, utils::StorageErrorExt},
payment_methods::{self as payment_methods_routes, cards},
},
services::{self, api, authentication as auth, authorization::permissions::Permission},
types::{
api::payment_methods::{self, PaymentMethodId},
domain,
storage::payment_method::PaymentTokenData,
},
};
use crate::{
core::{
customers,
payment_methods::{migration, tokenize},
},
types::api::customers::CustomerRequest,
};
pub async fn payment_method_update_api(
state: web::Data<AppState>,
req: HttpRequest,
path: web::Path<String>,
json_payload: web::Json<payment_methods::PaymentMethodUpdate>,
) -> HttpResponse {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
// file: hyperswitch/crates/router/src/routes/payment_methods.rs | crate: router
use actix_web::{web, HttpRequest, HttpResponse};
use common_utils::{errors::CustomResult, id_type, transformers::ForeignFrom};
use router_env::{instrument, logger, tracing, Flow};
use super::app::{AppState, SessionState};
use crate::{
core::{
api_locking,
errors::{self, utils::StorageErrorExt},
payment_methods::{self as payment_methods_routes, cards},
},
services::{self, api, authentication as auth, authorization::permissions::Permission},
types::{
api::payment_methods::{self, PaymentMethodId},
domain,
storage::payment_method::PaymentTokenData,
},
};
use crate::{
core::{
customers,
payment_methods::{migration, tokenize},
},
types::api::customers::CustomerRequest,
};
pub async fn render_pm_collect_link(
state: web::Data<AppState>,
req: HttpRequest,
path: web::Path<(id_type::MerchantId, String)>,
) -> HttpResponse {
let flow = Flow::PaymentMethodCollectLink;
let (merchant_id, pm_collect_link_id) = path.into_inner();
let payload = payment_methods::PaymentMethodCollectLinkRenderRequest {
merchant_id: merchant_id.clone(),
pm_collect_link_id,
};
Box::pin(api::server_wrap(
flow,
state,
&req,
payload,
|state, auth: auth::AuthenticationData, req, _| {
payment_methods_routes::render_pm_collect_link(
state,
auth.merchant_account,
auth.key_store,
req,
)
},
&auth::MerchantIdAuth(merchant_id),
api_locking::LockAction::NotApplicable,
))
.await
} | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/routes/payment_methods.rs | crate: router
use actix_web::{web, HttpRequest, HttpResponse};
use router_env::{instrument, logger, tracing, Flow};
use super::app::{AppState, SessionState};
use crate::{
core::{
api_locking,
errors::{self, utils::StorageErrorExt},
payment_methods::{self as payment_methods_routes, cards},
},
services::{self, api, authentication as auth, authorization::permissions::Permission},
types::{
api::payment_methods::{self, PaymentMethodId},
domain,
storage::payment_method::PaymentTokenData,
},
};
use crate::{
core::{
customers,
payment_methods::{migration, tokenize},
},
types::api::customers::CustomerRequest,
};
pub async fn get_total_payment_method_count(
state: web::Data<AppState>,
req: HttpRequest,
) -> HttpResponse {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/routes/payment_methods.rs | crate: router
use actix_web::{web, HttpRequest, HttpResponse};
use common_utils::{errors::CustomResult, id_type, transformers::ForeignFrom};
use router_env::{instrument, logger, tracing, Flow};
use super::app::{AppState, SessionState};
use crate::{
core::{
api_locking,
errors::{self, utils::StorageErrorExt},
payment_methods::{self as payment_methods_routes, cards},
},
services::{self, api, authentication as auth, authorization::permissions::Permission},
types::{
api::payment_methods::{self, PaymentMethodId},
domain,
storage::payment_method::PaymentTokenData,
},
};
use crate::{
core::{
customers,
payment_methods::{migration, tokenize},
},
types::api::customers::CustomerRequest,
};
pub async fn list_customer_payment_method_api(
state: web::Data<AppState>,
customer_id: web::Path<id_type::GlobalCustomerId>,
req: HttpRequest,
query_payload: web::Query<api_models::payment_methods::PaymentMethodListRequest>,
) -> HttpResponse {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
// file: hyperswitch/crates/router/src/routes/payment_methods.rs | crate: router
use actix_web::{web, HttpRequest, HttpResponse};
use router_env::{instrument, logger, tracing, Flow};
use super::app::{AppState, SessionState};
use crate::{
core::{
api_locking,
errors::{self, utils::StorageErrorExt},
payment_methods::{self as payment_methods_routes, cards},
},
services::{self, api, authentication as auth, authorization::permissions::Permission},
types::{
api::payment_methods::{self, PaymentMethodId},
domain,
storage::payment_method::PaymentTokenData,
},
};
use crate::{
core::{
customers,
payment_methods::{migration, tokenize},
},
types::api::customers::CustomerRequest,
};
pub async fn list_customer_payment_method_api_client(
state: web::Data<AppState>,
req: HttpRequest,
query_payload: web::Query<payment_methods::PaymentMethodListRequest>,
) -> HttpResponse {
let flow = Flow::CustomerPaymentMethodsList;
let payload = query_payload.into_inner();
let api_key = auth::get_api_key(req.headers()).ok();
let (auth, _, is_ephemeral_auth) =
match auth::get_ephemeral_or_other_auth(req.headers(), false, Some(&payload)).await {
Ok((auth, _auth_flow, is_ephemeral_auth)) => (auth, _auth_flow, is_ephemeral_auth),
Err(e) => return api::log_and_return_error_response(e),
};
Box::pin(api::server_wrap(
flow,
state,
&req,
payload,
|state, auth: auth::AuthenticationData, req, _| {
cards::do_list_customer_pm_fetch_customer_if_not_passed(
state,
auth.merchant_account,
auth.key_store,
Some(req),
None,
is_ephemeral_auth.then_some(api_key).flatten(),
)
},
&*auth,
api_locking::LockAction::NotApplicable,
))
.await
} | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/routes/payment_methods.rs | crate: router
use actix_web::{web, HttpRequest, HttpResponse};
use common_utils::{errors::CustomResult, id_type, transformers::ForeignFrom};
use router_env::{instrument, logger, tracing, Flow};
use super::app::{AppState, SessionState};
use crate::{
core::{
api_locking,
errors::{self, utils::StorageErrorExt},
payment_methods::{self as payment_methods_routes, cards},
},
services::{self, api, authentication as auth, authorization::permissions::Permission},
types::{
api::payment_methods::{self, PaymentMethodId},
domain,
storage::payment_method::PaymentTokenData,
},
};
use crate::{
core::{
customers,
payment_methods::{migration, tokenize},
},
types::api::customers::CustomerRequest,
};
pub async fn list_customer_payment_method_api(
state: web::Data<AppState>,
customer_id: web::Path<(id_type::CustomerId,)>,
req: HttpRequest,
query_payload: web::Query<payment_methods::PaymentMethodListRequest>,
) -> HttpResponse {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/routes/payment_methods.rs | crate: router
use actix_web::{web, HttpRequest, HttpResponse};
use router_env::{instrument, logger, tracing, Flow};
use super::app::{AppState, SessionState};
use crate::{
core::{
api_locking,
errors::{self, utils::StorageErrorExt},
payment_methods::{self as payment_methods_routes, cards},
},
services::{self, api, authentication as auth, authorization::permissions::Permission},
types::{
api::payment_methods::{self, PaymentMethodId},
domain,
storage::payment_method::PaymentTokenData,
},
};
use crate::{
core::{
customers,
payment_methods::{migration, tokenize},
},
types::api::customers::CustomerRequest,
};
pub async fn list_payment_method_api(
state: web::Data<AppState>,
req: HttpRequest,
json_payload: web::Query<payment_methods::PaymentMethodListRequest>,
) -> HttpResponse {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
// file: hyperswitch/crates/router/src/routes/payment_methods.rs | crate: router
use actix_web::{web, HttpRequest, HttpResponse};
use router_env::{instrument, logger, tracing, Flow};
use super::app::{AppState, SessionState};
use crate::{
core::{
api_locking,
errors::{self, utils::StorageErrorExt},
payment_methods::{self as payment_methods_routes, cards},
},
services::{self, api, authentication as auth, authorization::permissions::Permission},
types::{
api::payment_methods::{self, PaymentMethodId},
domain,
storage::payment_method::PaymentTokenData,
},
};
use crate::{
core::{
customers,
payment_methods::{migration, tokenize},
},
types::api::customers::CustomerRequest,
};
pub async fn save_payment_method_api(
state: web::Data<AppState>,
req: HttpRequest,
json_payload: web::Json<payment_methods::PaymentMethodCreate>,
path: web::Path<String>,
) -> HttpResponse {
let flow = Flow::PaymentMethodSave;
let payload = json_payload.into_inner();
let pm_id = path.into_inner();
let (auth, _) = match auth::check_client_secret_and_get_auth(req.headers(), &payload) {
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, _| {
Box::pin(cards::add_payment_method_data(
state,
req,
auth.merchant_account,
auth.key_store,
pm_id.clone(),
))
},
&*auth,
api_locking::LockAction::NotApplicable,
))
.await
} | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/routes/payment_methods.rs | crate: router
use actix_multipart::form::MultipartForm;
use actix_web::{web, HttpRequest, HttpResponse};
use common_utils::{errors::CustomResult, id_type, transformers::ForeignFrom};
use router_env::{instrument, logger, tracing, Flow};
use super::app::{AppState, SessionState};
use crate::{
core::{
api_locking,
errors::{self, utils::StorageErrorExt},
payment_methods::{self as payment_methods_routes, cards},
},
services::{self, api, authentication as auth, authorization::permissions::Permission},
types::{
api::payment_methods::{self, PaymentMethodId},
domain,
storage::payment_method::PaymentTokenData,
},
};
use crate::{
core::{
customers,
payment_methods::{migration, tokenize},
},
types::api::customers::CustomerRequest,
};
pub async fn migrate_payment_methods(
state: web::Data<AppState>,
req: HttpRequest,
MultipartForm(form): MultipartForm<migration::PaymentMethodsMigrateForm>,
) -> HttpResponse {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/routes/payment_methods.rs | crate: router
use actix_web::{web, HttpRequest, HttpResponse};
use router_env::{instrument, logger, tracing, Flow};
use super::app::{AppState, SessionState};
use crate::{
core::{
api_locking,
errors::{self, utils::StorageErrorExt},
payment_methods::{self as payment_methods_routes, cards},
},
services::{self, api, authentication as auth, authorization::permissions::Permission},
types::{
api::payment_methods::{self, PaymentMethodId},
domain,
storage::payment_method::PaymentTokenData,
},
};
use crate::{
core::{
customers,
payment_methods::{migration, tokenize},
},
types::api::customers::CustomerRequest,
};
pub async fn migrate_payment_method_api(
state: web::Data<AppState>,
req: HttpRequest,
json_payload: web::Json<payment_methods::PaymentMethodMigrate>,
) -> HttpResponse {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/routes/payment_methods.rs | crate: router
use actix_web::{web, HttpRequest, HttpResponse};
use router_env::{instrument, logger, tracing, Flow};
use super::app::{AppState, SessionState};
use crate::{
core::{
api_locking,
errors::{self, utils::StorageErrorExt},
payment_methods::{self as payment_methods_routes, cards},
},
services::{self, api, authentication as auth, authorization::permissions::Permission},
types::{
api::payment_methods::{self, PaymentMethodId},
domain,
storage::payment_method::PaymentTokenData,
},
};
use crate::{
core::{
customers,
payment_methods::{migration, tokenize},
},
types::api::customers::CustomerRequest,
};
pub async fn payment_method_delete_api(
state: web::Data<AppState>,
req: HttpRequest,
path: web::Path<String>,
) -> HttpResponse {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/routes/payment_methods.rs | crate: router
use actix_web::{web, HttpRequest, HttpResponse};
use common_utils::{errors::CustomResult, id_type, transformers::ForeignFrom};
use router_env::{instrument, logger, tracing, Flow};
use super::app::{AppState, SessionState};
use crate::{
core::{
api_locking,
errors::{self, utils::StorageErrorExt},
payment_methods::{self as payment_methods_routes, cards},
},
services::{self, api, authentication as auth, authorization::permissions::Permission},
types::{
api::payment_methods::{self, PaymentMethodId},
domain,
storage::payment_method::PaymentTokenData,
},
};
use crate::{
core::{
customers,
payment_methods::{migration, tokenize},
},
types::api::customers::CustomerRequest,
};
pub async fn payment_method_update_api(
state: web::Data<AppState>,
req: HttpRequest,
path: web::Path<id_type::GlobalPaymentMethodId>,
json_payload: web::Json<payment_methods::PaymentMethodUpdate>,
) -> HttpResponse {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/routes/payment_methods.rs | crate: router
use actix_web::{web, HttpRequest, HttpResponse};
use router_env::{instrument, logger, tracing, Flow};
use super::app::{AppState, SessionState};
use crate::{
core::{
api_locking,
errors::{self, utils::StorageErrorExt},
payment_methods::{self as payment_methods_routes, cards},
},
services::{self, api, authentication as auth, authorization::permissions::Permission},
types::{
api::payment_methods::{self, PaymentMethodId},
domain,
storage::payment_method::PaymentTokenData,
},
};
use crate::{
core::{
customers,
payment_methods::{migration, tokenize},
},
types::api::customers::CustomerRequest,
};
pub async fn create_payment_method_intent_api(
state: web::Data<AppState>,
req: HttpRequest,
json_payload: web::Json<payment_methods::PaymentMethodIntentCreate>,
) -> HttpResponse {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/routes/payment_methods.rs | crate: router
use actix_web::{web, HttpRequest, HttpResponse};
use router_env::{instrument, logger, tracing, Flow};
use super::app::{AppState, SessionState};
use crate::{
core::{
api_locking,
errors::{self, utils::StorageErrorExt},
payment_methods::{self as payment_methods_routes, cards},
},
services::{self, api, authentication as auth, authorization::permissions::Permission},
types::{
api::payment_methods::{self, PaymentMethodId},
domain,
storage::payment_method::PaymentTokenData,
},
};
use crate::{
core::{
customers,
payment_methods::{migration, tokenize},
},
types::api::customers::CustomerRequest,
};
pub async fn create_payment_method_api(
state: web::Data<AppState>,
req: HttpRequest,
json_payload: web::Json<payment_methods::PaymentMethodCreate>,
) -> HttpResponse {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/routes/payment_methods.rs | crate: router
)
.await
}
},
&auth::V2ApiKeyAuth,
api_locking::LockAction::NotApplicable,
))
.await
}
#[cfg(feature = "v2")]
#[instrument(skip_all, fields(flow = ?Flow::PaymentMethodSessionRetrieve))]
pub async fn payment_methods_session_retrieve(
state: web::Data<AppState>,
req: HttpRequest,
path: web::Path<id_type::GlobalPaymentMethodSessionId>,
) -> HttpResponse {
let flow = Flow::PaymentMethodSessionRetrieve;
let payment_method_session_id = path.into_inner();
Box::pin(api::server_wrap(
flow,
state,
&req,
payment_method_session_id.clone(),
pub async fn payment_methods_session_retrieve(
state: web::Data<AppState>,
req: HttpRequest,
path: web::Path<id_type::GlobalPaymentMethodSessionId>,
) -> HttpResponse {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/routes/payment_methods.rs | crate: router
},
&auth::AdminApiAuth,
api_locking::LockAction::NotApplicable,
))
.await
}
#[cfg(all(
any(feature = "v1", feature = "v2", feature = "olap", feature = "oltp"),
not(feature = "payment_methods_v2")
))]
#[instrument(skip_all, fields(flow = ?Flow::TokenizeCardBatch))]
pub async fn tokenize_card_batch_api(
state: web::Data<AppState>,
req: HttpRequest,
MultipartForm(form): MultipartForm<tokenize::CardNetworkTokenizeForm>,
) -> HttpResponse {
let flow = Flow::TokenizeCardBatch;
let (merchant_id, records) = match tokenize::get_tokenize_card_form_records(form) {
Ok(res) => res,
Err(e) => return api::log_and_return_error_response(e.into()),
};
Box::pin(api::server_wrap(
flow,
pub async fn tokenize_card_batch_api(
state: web::Data<AppState>,
req: HttpRequest,
MultipartForm(form): MultipartForm<tokenize::CardNetworkTokenizeForm>,
) -> HttpResponse {
{
Ok(res) => res,<|fim_suffix|>
<|fim_middle|>
Err(e) => return api::log_and_return_error_response(e.into()),
}
} | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/routes/payment_methods.rs | crate: router
use common_utils::{errors::CustomResult, id_type, transformers::ForeignFrom};
use router_env::{instrument, logger, tracing, Flow};
use super::app::{AppState, SessionState};
use crate::{
core::{
api_locking,
errors::{self, utils::StorageErrorExt},
payment_methods::{self as payment_methods_routes, cards},
},
services::{self, api, authentication as auth, authorization::permissions::Permission},
types::{
api::payment_methods::{self, PaymentMethodId},
domain,
storage::payment_method::PaymentTokenData,
},
};
pub async fn delete(&self, state: &SessionState) -> CustomResult<(), errors::ApiErrorResponse> {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/routes/payment_methods.rs | crate: router
use diesel_models::enums::IntentStatus;
use crate::{
core::{
api_locking,
errors::{self, utils::StorageErrorExt},
payment_methods::{self as payment_methods_routes, cards},
},
services::{self, api, authentication as auth, authorization::permissions::Permission},
types::{
api::payment_methods::{self, PaymentMethodId},
domain,
storage::payment_method::PaymentTokenData,
},
};
pub fn should_delete_payment_method_token(&self, status: IntentStatus) -> bool {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/routes/payment_methods.rs | crate: router
use common_utils::{errors::CustomResult, id_type, transformers::ForeignFrom};
use super::app::{AppState, SessionState};
use crate::{
core::{
api_locking,
errors::{self, utils::StorageErrorExt},
payment_methods::{self as payment_methods_routes, cards},
},
services::{self, api, authentication as auth, authorization::permissions::Permission},
types::{
api::payment_methods::{self, PaymentMethodId},
domain,
storage::payment_method::PaymentTokenData,
},
};
pub async fn insert(
&self,
fulfillment_time: i64,
token: PaymentTokenData,
state: &SessionState,
) -> CustomResult<(), errors::ApiErrorResponse> {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/routes/payment_methods.rs | crate: router
use diesel_models::enums::IntentStatus;
use crate::{
core::{
api_locking,
errors::{self, utils::StorageErrorExt},
payment_methods::{self as payment_methods_routes, cards},
},
services::{self, api, authentication as auth, authorization::permissions::Permission},
types::{
api::payment_methods::{self, PaymentMethodId},
domain,
storage::payment_method::PaymentTokenData,
},
};
pub fn create_key_for_token(
(parent_pm_token, payment_method): (&String, api_models::enums::PaymentMethod),
) -> Self {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/routes/payment_methods.rs | crate: router
use actix_web::{web, HttpRequest, HttpResponse};
fn test_custom_list_deserialization_multi_amount() {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/routes/payment_methods.rs | crate: router
use actix_web::{web, HttpRequest, HttpResponse};
use router_env::{instrument, logger, tracing, Flow};
use super::app::{AppState, SessionState};
use crate::{
core::{
api_locking,
errors::{self, utils::StorageErrorExt},
payment_methods::{self as payment_methods_routes, cards},
},
services::{self, api, authentication as auth, authorization::permissions::Permission},
types::{
api::payment_methods::{self, PaymentMethodId},
domain,
storage::payment_method::PaymentTokenData,
},
};
use crate::{
core::{
customers,
payment_methods::{migration, tokenize},
},
types::api::customers::CustomerRequest,
};
pub async fn payment_method_retrieve_api(
state: web::Data<AppState>,
req: HttpRequest,
path: web::Path<String>,
) -> HttpResponse {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/routes/payment_methods.rs | crate: router
use actix_web::{web, HttpRequest, HttpResponse};
use router_env::{instrument, logger, tracing, Flow};
use super::app::{AppState, SessionState};
use crate::{
core::{
api_locking,
errors::{self, utils::StorageErrorExt},
payment_methods::{self as payment_methods_routes, cards},
},
services::{self, api, authentication as auth, authorization::permissions::Permission},
types::{
api::payment_methods::{self, PaymentMethodId},
domain,
storage::payment_method::PaymentTokenData,
},
};
use crate::{
core::{
customers,
payment_methods::{migration, tokenize},
},
types::api::customers::CustomerRequest,
};
pub async fn initiate_pm_collect_link_flow(
state: web::Data<AppState>,
req: HttpRequest,
json_payload: web::Json<payment_methods::PaymentMethodCollectLinkRequest>,
) -> HttpResponse {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/routes/payment_methods.rs | crate: router
use common_utils::{errors::CustomResult, id_type, transformers::ForeignFrom};
use hyperswitch_domain_models::{
bulk_tokenization::CardNetworkTokenizeRequest, merchant_key_store::MerchantKeyStore,
};
use super::app::{AppState, SessionState};
use crate::{
core::{
api_locking,
errors::{self, utils::StorageErrorExt},
payment_methods::{self as payment_methods_routes, cards},
},
services::{self, api, authentication as auth, authorization::permissions::Permission},
types::{
api::payment_methods::{self, PaymentMethodId},
domain,
storage::payment_method::PaymentTokenData,
},
};
async fn get_merchant_account(
state: &SessionState,
merchant_id: &id_type::MerchantId,
) -> CustomResult<(MerchantKeyStore, domain::MerchantAccount), errors::ApiErrorResponse> {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/routes/dummy_connector.rs | crate: router
use actix_web::web;
use super::app;
use crate::{
core::api_locking,
services::{api, authentication as auth},
};
pub async fn dummy_connector_payment_data(
state: web::Data<app::AppState>,
req: actix_web::HttpRequest,
path: web::Path<String>,
) -> impl actix_web::Responder {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/routes/dummy_connector.rs | crate: router
use actix_web::web;
use super::app;
use crate::{
core::api_locking,
services::{api, authentication as auth},
};
pub async fn dummy_connector_refund_data(
state: web::Data<app::AppState>,
req: actix_web::HttpRequest,
path: web::Path<String>,
) -> impl actix_web::Responder {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/routes/dummy_connector.rs | crate: router
use actix_web::web;
use super::app;
use crate::{
core::api_locking,
services::{api, authentication as auth},
};
pub async fn dummy_connector_refund(
state: web::Data<app::AppState>,
req: actix_web::HttpRequest,
json_payload: web::Json<types::DummyConnectorRefundRequest>,
path: web::Path<common_utils::id_type::PaymentId>,
) -> impl actix_web::Responder {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
// file: hyperswitch/crates/router/src/routes/dummy_connector.rs | crate: router
use actix_web::web;
use super::app;
use crate::{
core::api_locking,
services::{api, authentication as auth},
};
pub async fn dummy_connector_payment_data(
state: web::Data<app::AppState>,
req: actix_web::HttpRequest,
path: web::Path<String>,
) -> impl actix_web::Responder {
let flow = types::Flow::DummyPaymentRetrieve;
let payment_id = path.into_inner();
let payload = types::DummyConnectorPaymentRetrieveRequest { payment_id };
api::server_wrap(
flow,
state,
&req,
payload,
|state, _: (), req, _| core::payment_data(state, req),
&auth::NoAuth,
api_locking::LockAction::NotApplicable,
)
.await
} | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/routes/dummy_connector.rs | crate: router
use actix_web::web;
use super::app;
use crate::{
core::api_locking,
services::{api, authentication as auth},
};
pub async fn dummy_connector_payment(
state: web::Data<app::AppState>,
req: actix_web::HttpRequest,
json_payload: web::Json<types::DummyConnectorPaymentRequest>,
) -> impl actix_web::Responder {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/routes/dummy_connector.rs | crate: router
use actix_web::web;
use super::app;
use crate::{
core::api_locking,
services::{api, authentication as auth},
};
pub async fn dummy_connector_complete_payment(
state: web::Data<app::AppState>,
req: actix_web::HttpRequest,
path: web::Path<String>,
json_payload: web::Query<types::DummyConnectorPaymentCompleteBody>,
) -> impl actix_web::Responder {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/routes/dummy_connector.rs | crate: router
use actix_web::web;
use super::app;
use crate::{
core::api_locking,
services::{api, authentication as auth},
};
pub async fn dummy_connector_authorize_payment(
state: web::Data<app::AppState>,
req: actix_web::HttpRequest,
path: web::Path<String>,
) -> impl actix_web::Responder {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/routes/payouts.rs | crate: router
use actix_web::{
body::{BoxBody, MessageBody},
web, HttpRequest, HttpResponse, Responder,
};
use router_env::{instrument, tracing, Flow};
use super::app::AppState;
use crate::{
core::{api_locking, payouts::*},
services::{
api,
authentication::{self as auth},
authorization::permissions::Permission,
},
types::api::payouts as payout_types,
};
pub async fn payouts_list_available_filters_for_profile(
state: web::Data<AppState>,
req: HttpRequest,
json_payload: web::Json<common_utils::types::TimeRange>,
) -> HttpResponse {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
// file: hyperswitch/crates/router/src/routes/payouts.rs | crate: router
use actix_web::{
body::{BoxBody, MessageBody},
web, HttpRequest, HttpResponse, Responder,
};
use router_env::{instrument, tracing, Flow};
use super::app::AppState;
use crate::{
core::{api_locking, payouts::*},
services::{
api,
authentication::{self as auth},
authorization::permissions::Permission,
},
types::api::payouts as payout_types,
};
pub async fn payouts_list_available_filters_for_merchant(
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, _| {
payouts_list_available_filters_core(state, auth.merchant_account, None, req)
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth),
&auth::JWTAuth {
permission: Permission::MerchantPayoutRead,
},
req.headers(),
),
api_locking::LockAction::NotApplicable,
))
.await
} | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/routes/payouts.rs | crate: router
use actix_web::{
body::{BoxBody, MessageBody},
web, HttpRequest, HttpResponse, Responder,
};
use router_env::{instrument, tracing, Flow};
use super::app::AppState;
use crate::{
core::{api_locking, payouts::*},
services::{
api,
authentication::{self as auth},
authorization::permissions::Permission,
},
types::api::payouts as payout_types,
};
pub async fn payouts_list_by_filter_profile(
state: web::Data<AppState>,
req: HttpRequest,
json_payload: web::Json<payout_types::PayoutListFilterConstraints>,
) -> HttpResponse {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
// file: hyperswitch/crates/router/src/routes/payouts.rs | crate: router
use actix_web::{
body::{BoxBody, MessageBody},
web, HttpRequest, HttpResponse, Responder,
};
use router_env::{instrument, tracing, Flow};
use super::app::AppState;
use crate::{
core::{api_locking, payouts::*},
services::{
api,
authentication::{self as auth},
authorization::permissions::Permission,
},
types::api::payouts as payout_types,
};
pub async fn payouts_list_by_filter(
state: web::Data<AppState>,
req: HttpRequest,
json_payload: web::Json<payout_types::PayoutListFilterConstraints>,
) -> HttpResponse {
let flow = Flow::PayoutsList;
let payload = json_payload.into_inner();
Box::pin(api::server_wrap(
flow,
state,
&req,
payload,
|state, auth: auth::AuthenticationData, req, _| {
payouts_filtered_list_core(state, auth.merchant_account, None, auth.key_store, req)
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth),
&auth::JWTAuth {
permission: Permission::MerchantPayoutRead,
},
req.headers(),
),
api_locking::LockAction::NotApplicable,
))
.await
} | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/routes/payouts.rs | crate: router
use actix_web::{
body::{BoxBody, MessageBody},
web, HttpRequest, HttpResponse, Responder,
};
use router_env::{instrument, tracing, Flow};
use super::app::AppState;
use crate::{
core::{api_locking, payouts::*},
services::{
api,
authentication::{self as auth},
authorization::permissions::Permission,
},
types::api::payouts as payout_types,
};
pub async fn payouts_list_profile(
state: web::Data<AppState>,
req: HttpRequest,
json_payload: web::Query<payout_types::PayoutListConstraints>,
) -> HttpResponse {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/routes/payouts.rs | crate: router
use actix_web::{
body::{BoxBody, MessageBody},
web, HttpRequest, HttpResponse, Responder,
};
use router_env::{instrument, tracing, Flow};
use super::app::AppState;
use crate::{
core::{api_locking, payouts::*},
services::{
api,
authentication::{self as auth},
authorization::permissions::Permission,
},
types::api::payouts as payout_types,
};
pub async fn payouts_list(
state: web::Data<AppState>,
req: HttpRequest,
json_payload: web::Query<payout_types::PayoutListConstraints>,
) -> HttpResponse {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/routes/payouts.rs | crate: router
use actix_web::{
body::{BoxBody, MessageBody},
web, HttpRequest, HttpResponse, Responder,
};
use router_env::{instrument, tracing, Flow};
use super::app::AppState;
use crate::{
core::{api_locking, payouts::*},
services::{
api,
authentication::{self as auth},
authorization::permissions::Permission,
},
types::api::payouts as payout_types,
};
pub async fn payouts_confirm(
state: web::Data<AppState>,
req: HttpRequest,
json_payload: web::Json<payout_types::PayoutCreateRequest>,
path: web::Path<String>,
) -> HttpResponse {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/routes/payouts.rs | crate: router
use actix_web::{
body::{BoxBody, MessageBody},
web, HttpRequest, HttpResponse, Responder,
};
use router_env::{instrument, tracing, Flow};
use super::app::AppState;
use crate::{
core::{api_locking, payouts::*},
services::{
api,
authentication::{self as auth},
authorization::permissions::Permission,
},
types::api::payouts as payout_types,
};
pub async fn payouts_retrieve(
state: web::Data<AppState>,
req: HttpRequest,
path: web::Path<String>,
query_params: web::Query<payout_types::PayoutRetrieveBody>,
) -> HttpResponse {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/routes/payouts.rs | crate: router
use actix_web::{
body::{BoxBody, MessageBody},
web, HttpRequest, HttpResponse, Responder,
};
fn http_response<T: MessageBody + 'static>(response: T) -> HttpResponse<BoxBody> {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/routes/payouts.rs | crate: router
use actix_web::{
body::{BoxBody, MessageBody},
web, HttpRequest, HttpResponse, Responder,
};
use router_env::{instrument, tracing, Flow};
use super::app::AppState;
use crate::{
core::{api_locking, payouts::*},
services::{
api,
authentication::{self as auth},
authorization::permissions::Permission,
},
types::api::payouts as payout_types,
};
pub async fn payouts_list_available_filters_for_merchant(
state: web::Data<AppState>,
req: HttpRequest,
json_payload: web::Json<common_utils::types::TimeRange>,
) -> HttpResponse {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
// file: hyperswitch/crates/router/src/routes/payouts.rs | crate: router
use actix_web::{
body::{BoxBody, MessageBody},
web, HttpRequest, HttpResponse, Responder,
};
fn http_response<T: MessageBody + 'static>(response: T) -> HttpResponse<BoxBody> {
HttpResponse::Ok().body(response)
} | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/routes/payouts.rs | crate: router
use actix_web::{
body::{BoxBody, MessageBody},
web, HttpRequest, HttpResponse, Responder,
};
use router_env::{instrument, tracing, Flow};
pub async fn payouts_accounts() -> impl Responder {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/routes/payouts.rs | crate: router
use actix_web::{
body::{BoxBody, MessageBody},
web, HttpRequest, HttpResponse, Responder,
};
use router_env::{instrument, tracing, Flow};
use super::app::AppState;
use crate::{
core::{api_locking, payouts::*},
services::{
api,
authentication::{self as auth},
authorization::permissions::Permission,
},
types::api::payouts as payout_types,
};
pub async fn payouts_fulfill(
state: web::Data<AppState>,
req: HttpRequest,
json_payload: web::Json<payout_types::PayoutActionRequest>,
path: web::Path<String>,
) -> HttpResponse {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/routes/payouts.rs | crate: router
use actix_web::{
body::{BoxBody, MessageBody},
web, HttpRequest, HttpResponse, Responder,
};
use router_env::{instrument, tracing, Flow};
use super::app::AppState;
use crate::{
core::{api_locking, payouts::*},
services::{
api,
authentication::{self as auth},
authorization::permissions::Permission,
},
types::api::payouts as payout_types,
};
pub async fn payouts_cancel(
state: web::Data<AppState>,
req: HttpRequest,
json_payload: web::Json<payout_types::PayoutActionRequest>,
path: web::Path<String>,
) -> HttpResponse {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/routes/payouts.rs | crate: router
use actix_web::{
body::{BoxBody, MessageBody},
web, HttpRequest, HttpResponse, Responder,
};
use router_env::{instrument, tracing, Flow};
use super::app::AppState;
use crate::{
core::{api_locking, payouts::*},
services::{
api,
authentication::{self as auth},
authorization::permissions::Permission,
},
types::api::payouts as payout_types,
};
pub async fn payouts_update(
state: web::Data<AppState>,
req: HttpRequest,
path: web::Path<String>,
json_payload: web::Json<payout_types::PayoutCreateRequest>,
) -> HttpResponse {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/routes/payouts.rs | crate: router
use actix_web::{
body::{BoxBody, MessageBody},
web, HttpRequest, HttpResponse, Responder,
};
use router_env::{instrument, tracing, Flow};
use super::app::AppState;
use crate::{
core::{api_locking, payouts::*},
services::{
api,
authentication::{self as auth},
authorization::permissions::Permission,
},
types::api::payouts as payout_types,
};
pub async fn payouts_create(
state: web::Data<AppState>,
req: HttpRequest,
json_payload: web::Json<payout_types::PayoutCreateRequest>,
) -> HttpResponse {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/routes/lock_utils.rs | crate: router
use router_env::Flow;
fn from(flow: Flow) -> Self {
{
Flow::MerchantsAccountCreate
| Flow::MerchantsAccountRetrieve
| Flow::MerchantsAccountUpdate
| Flow::MerchantsAccountDelete
| Flow::MerchantTransferKey
| Flow::MerchantAccountList
| Flow::EnablePlatformAccount => Self::MerchantAccount,<|fim_suffix|>
<|fim_middle|>
Flow::RevenueRecoveryRetrieve => Self::ProcessTracker,
}
} | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/routes/lock_utils.rs | crate: router
use router_env::Flow;
fn from(flow: Flow) -> Self {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/routes/cards_info.rs | crate: router
use actix_web::{web, HttpRequest, HttpResponse, Responder};
use api_models::cards_info as cards_info_api_types;
use router_env::{instrument, tracing, Flow};
use super::app::AppState;
use crate::{
core::{api_locking, cards_info},
services::{api, authentication as auth},
};
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 {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/routes/cards_info.rs | crate: router
use actix_web::{web, HttpRequest, HttpResponse, Responder};
use api_models::cards_info as cards_info_api_types;
use router_env::{instrument, tracing, Flow};
use super::app::AppState;
use crate::{
core::{api_locking, cards_info},
services::{api, authentication as auth},
};
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 {
{
Ok((auth, _auth_flow)) => (auth, _auth_flow),<|fim_suffix|>
<|fim_middle|>
Err(e) => return api::log_and_return_error_response(e),
}
} | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/routes/cards_info.rs | crate: router
use actix_multipart::form::MultipartForm;
use actix_web::{web, HttpRequest, HttpResponse, Responder};
use api_models::cards_info as cards_info_api_types;
use router_env::{instrument, tracing, Flow};
use super::app::AppState;
use crate::{
core::{api_locking, cards_info},
services::{api, authentication as auth},
};
pub async fn migrate_cards_info(
state: web::Data<AppState>,
req: HttpRequest,
MultipartForm(form): MultipartForm<cards_info::CardsInfoUpdateForm>,
) -> HttpResponse {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/routes/cards_info.rs | crate: router
use actix_web::{web, HttpRequest, HttpResponse, Responder};
use api_models::cards_info as cards_info_api_types;
use router_env::{instrument, tracing, Flow};
use super::app::AppState;
use crate::{
core::{api_locking, cards_info},
services::{api, authentication as auth},
};
pub async fn update_cards_info(
state: web::Data<AppState>,
req: HttpRequest,
json_payload: web::Json<cards_info_api_types::CardInfoUpdateRequest>,
) -> impl Responder {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/routes/cards_info.rs | crate: router
use actix_web::{web, HttpRequest, HttpResponse, Responder};
use api_models::cards_info as cards_info_api_types;
use router_env::{instrument, tracing, Flow};
use super::app::AppState;
use crate::{
core::{api_locking, cards_info},
services::{api, authentication as auth},
};
pub async fn create_cards_info(
state: web::Data<AppState>,
req: HttpRequest,
json_payload: web::Json<cards_info_api_types::CardInfoCreateRequest>,
) -> impl Responder {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/routes/payments.rs | crate: router
use crate::{
core::api_locking::{self, GetLockingInput},
services::authorization::permissions::Permission,
};
use actix_web::{web, Responder};
use hyperswitch_domain_models::payments::HeaderPayload;
use router_env::{env, instrument, logger, tracing, types, Flow};
use super::app::ReqState;
use crate::{
self as app,
core::{
errors::{self, http_not_implemented},
payments::{self, PaymentRedirectFlow},
},
routes::lock_utils,
services::{api, authentication as auth},
types::{
api::{
self as api_types, enums as api_enums,
payments::{self as payment_types, PaymentIdTypeExt},
},
domain,
transformers::ForeignTryFrom,
},
};
pub async fn list_payment_methods(
state: web::Data<app::AppState>,
req: actix_web::HttpRequest,
path: web::Path<common_utils::id_type::GlobalPaymentId>,
query_payload: web::Query<api_models::payments::PaymentMethodsListRequest>,
) -> impl Responder {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/routes/payments.rs | crate: router
use crate::{
core::api_locking::{self, GetLockingInput},
services::authorization::permissions::Permission,
};
use actix_web::{web, Responder};
use error_stack::report;
use hyperswitch_domain_models::payments::HeaderPayload;
use masking::PeekInterface;
use router_env::{env, instrument, logger, tracing, types, Flow};
use super::app::ReqState;
use crate::{
self as app,
core::{
errors::{self, http_not_implemented},
payments::{self, PaymentRedirectFlow},
},
routes::lock_utils,
services::{api, authentication as auth},
types::{
api::{
self as api_types, enums as api_enums,
payments::{self as payment_types, PaymentIdTypeExt},
},
domain,
transformers::ForeignTryFrom,
},
};
pub async fn payments_capture(
state: web::Data<app::AppState>,
req: actix_web::HttpRequest,
payload: web::Json<api_models::payments::PaymentsCaptureRequest>,
path: web::Path<common_utils::id_type::GlobalPaymentId>,
) -> impl Responder {
{
Ok(headers) => headers,<|fim_suffix|>
<|fim_middle|>
Err(err) => {
return api::log_and_return_error_response(err);
}
}
} | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/routes/payments.rs | crate: router
use actix_web::{web, Responder};
use hyperswitch_domain_models::payments::HeaderPayload;
use router_env::{env, instrument, logger, tracing, types, Flow};
use super::app::ReqState;
use crate::{
self as app,
core::{
errors::{self, http_not_implemented},
payments::{self, PaymentRedirectFlow},
},
routes::lock_utils,
services::{api, authentication as auth},
types::{
api::{
self as api_types, enums as api_enums,
payments::{self as payment_types, PaymentIdTypeExt},
},
domain,
transformers::ForeignTryFrom,
},
};
pub async fn payments_finish_redirection(
state: web::Data<app::AppState>,
req: actix_web::HttpRequest,
json_payload: Option<web::Form<serde_json::Value>>,
path: web::Path<(
common_utils::id_type::GlobalPaymentId,
String,
common_utils::id_type::ProfileId,
)>,
) -> impl Responder {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/routes/payments.rs | crate: router
use crate::{
core::api_locking::{self, GetLockingInput},
services::authorization::permissions::Permission,
};
use actix_web::{web, Responder};
use hyperswitch_domain_models::payments::HeaderPayload;
use router_env::{env, instrument, logger, tracing, types, Flow};
use super::app::ReqState;
use crate::{
self as app,
core::{
errors::{self, http_not_implemented},
payments::{self, PaymentRedirectFlow},
},
routes::lock_utils,
services::{api, authentication as auth},
types::{
api::{
self as api_types, enums as api_enums,
payments::{self as payment_types, PaymentIdTypeExt},
},
domain,
transformers::ForeignTryFrom,
},
};
pub async fn payment_get_intent_using_merchant_reference_id(
state: web::Data<app::AppState>,
req: actix_web::HttpRequest,
path: web::Path<common_utils::id_type::PaymentReferenceId>,
) -> impl Responder {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/routes/payments.rs | crate: router
use crate::{
core::api_locking::{self, GetLockingInput},
services::authorization::permissions::Permission,
};
use actix_web::{web, Responder};
use error_stack::report;
use hyperswitch_domain_models::payments::HeaderPayload;
use masking::PeekInterface;
use router_env::{env, instrument, logger, tracing, types, Flow};
use super::app::ReqState;
use crate::{
self as app,
core::{
errors::{self, http_not_implemented},
payments::{self, PaymentRedirectFlow},
},
routes::lock_utils,
services::{api, authentication as auth},
types::{
api::{
self as api_types, enums as api_enums,
payments::{self as payment_types, PaymentIdTypeExt},
},
domain,
transformers::ForeignTryFrom,
},
};
pub async fn payment_status(
state: web::Data<app::AppState>,
req: actix_web::HttpRequest,
payload: web::Query<api_models::payments::PaymentsRetrieveRequest>,
path: web::Path<common_utils::id_type::GlobalPaymentId>,
) -> impl Responder {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/routes/payments.rs | crate: router
use crate::{
core::api_locking::{self, GetLockingInput},
services::authorization::permissions::Permission,
};
use actix_web::{web, Responder};
use error_stack::report;
use hyperswitch_domain_models::payments::HeaderPayload;
use masking::PeekInterface;
use router_env::{env, instrument, logger, tracing, types, Flow};
use super::app::ReqState;
use crate::{
self as app,
core::{
errors::{self, http_not_implemented},
payments::{self, PaymentRedirectFlow},
},
routes::lock_utils,
services::{api, authentication as auth},
types::{
api::{
self as api_types, enums as api_enums,
payments::{self as payment_types, PaymentIdTypeExt},
},
domain,
transformers::ForeignTryFrom,
},
};
pub async fn proxy_confirm_intent(
state: web::Data<app::AppState>,
req: actix_web::HttpRequest,
json_payload: web::Json<api_models::payments::ProxyPaymentsRequest>,
path: web::Path<common_utils::id_type::GlobalPaymentId>,
) -> impl Responder {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/routes/payments.rs | crate: router
use crate::{
core::api_locking::{self, GetLockingInput},
services::authorization::permissions::Permission,
};
use actix_web::{web, Responder};
use error_stack::report;
use hyperswitch_domain_models::payments::HeaderPayload;
use masking::PeekInterface;
use router_env::{env, instrument, logger, tracing, types, Flow};
use super::app::ReqState;
use crate::{
self as app,
core::{
errors::{self, http_not_implemented},
payments::{self, PaymentRedirectFlow},
},
routes::lock_utils,
services::{api, authentication as auth},
types::{
api::{
self as api_types, enums as api_enums,
payments::{self as payment_types, PaymentIdTypeExt},
},
domain,
transformers::ForeignTryFrom,
},
};
pub async fn payment_confirm_intent(
state: web::Data<app::AppState>,
req: actix_web::HttpRequest,
json_payload: web::Json<api_models::payments::PaymentsConfirmIntentRequest>,
path: web::Path<common_utils::id_type::GlobalPaymentId>,
) -> impl Responder {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/routes/payments.rs | crate: router
use actix_web::{web, Responder};
use hyperswitch_domain_models::payments::HeaderPayload;
use router_env::{env, instrument, logger, tracing, types, Flow};
use super::app::ReqState;
use crate::{
self as app,
core::{
errors::{self, http_not_implemented},
payments::{self, PaymentRedirectFlow},
},
routes::lock_utils,
services::{api, authentication as auth},
types::{
api::{
self as api_types, enums as api_enums,
payments::{self as payment_types, PaymentIdTypeExt},
},
domain,
transformers::ForeignTryFrom,
},
};
pub async fn payments_start_redirection(
state: web::Data<app::AppState>,
req: actix_web::HttpRequest,
payload: web::Query<api_models::payments::PaymentStartRedirectionParams>,
path: web::Path<common_utils::id_type::GlobalPaymentId>,
) -> impl Responder {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/routes/payments.rs | crate: router
use crate::{
core::api_locking::{self, GetLockingInput},
services::authorization::permissions::Permission,
};
use actix_web::{web, Responder};
use hyperswitch_domain_models::payments::HeaderPayload;
use router_env::{env, instrument, logger, tracing, types, Flow};
use super::app::ReqState;
use crate::{
self as app,
core::{
errors::{self, http_not_implemented},
payments::{self, PaymentRedirectFlow},
},
routes::lock_utils,
services::{api, authentication as auth},
types::{
api::{
self as api_types, enums as api_enums,
payments::{self as payment_types, PaymentIdTypeExt},
},
domain,
transformers::ForeignTryFrom,
},
};
pub async fn get_payments_aggregates_profile(
state: web::Data<app::AppState>,
req: actix_web::HttpRequest,
payload: web::Query<common_utils::types::TimeRange>,
) -> impl Responder {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
// file: hyperswitch/crates/router/src/routes/payments.rs | crate: router
use actix_web::{web, Responder};
use hyperswitch_domain_models::payments::HeaderPayload;
use router_env::{env, instrument, logger, tracing, types, Flow};
use super::app::ReqState;
use crate::{
self as app,
core::{
errors::{self, http_not_implemented},
payments::{self, PaymentRedirectFlow},
},
routes::lock_utils,
services::{api, authentication as auth},
types::{
api::{
self as api_types, enums as api_enums,
payments::{self as payment_types, PaymentIdTypeExt},
},
domain,
transformers::ForeignTryFrom,
},
};
pub async fn payments_manual_update(
state: web::Data<app::AppState>,
req: actix_web::HttpRequest,
json_payload: web::Json<payment_types::PaymentsManualUpdateRequest>,
path: web::Path<common_utils::id_type::PaymentId>,
) -> impl Responder {
let flow = Flow::PaymentsManualUpdate;
let mut payload = json_payload.into_inner();
let payment_id = path.into_inner();
let locking_action = payload.get_locking_input(flow.clone());
tracing::Span::current().record("payment_id", payment_id.get_string_repr());
payload.payment_id = payment_id;
Box::pin(api::server_wrap(
flow,
state,
&req,
payload,
|state, _auth, req, _req_state| payments::payments_manual_update(state, req),
&auth::AdminApiAuthWithMerchantIdFromHeader,
locking_action,
))
.await
} | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/routes/payments.rs | crate: router
use actix_web::{web, Responder};
use hyperswitch_domain_models::payments::HeaderPayload;
use router_env::{env, instrument, logger, tracing, types, Flow};
use super::app::ReqState;
use crate::{
self as app,
core::{
errors::{self, http_not_implemented},
payments::{self, PaymentRedirectFlow},
},
routes::lock_utils,
services::{api, authentication as auth},
types::{
api::{
self as api_types, enums as api_enums,
payments::{self as payment_types, PaymentIdTypeExt},
},
domain,
transformers::ForeignTryFrom,
},
};
pub async fn post_3ds_payments_authorize(
state: web::Data<app::AppState>,
req: actix_web::HttpRequest,
json_payload: Option<web::Form<serde_json::Value>>,
path: web::Path<(
common_utils::id_type::PaymentId,
common_utils::id_type::MerchantId,
String,
)>,
) -> impl Responder {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/routes/payments.rs | crate: router
use actix_web::{web, Responder};
use hyperswitch_domain_models::payments::HeaderPayload;
use router_env::{env, instrument, logger, tracing, types, Flow};
use super::app::ReqState;
use crate::{
self as app,
core::{
errors::{self, http_not_implemented},
payments::{self, PaymentRedirectFlow},
},
routes::lock_utils,
services::{api, authentication as auth},
types::{
api::{
self as api_types, enums as api_enums,
payments::{self as payment_types, PaymentIdTypeExt},
},
domain,
transformers::ForeignTryFrom,
},
};
pub async fn payments_external_authentication(
state: web::Data<app::AppState>,
req: actix_web::HttpRequest,
json_payload: web::Json<payment_types::PaymentsExternalAuthenticationRequest>,
path: web::Path<common_utils::id_type::PaymentId>,
) -> impl Responder {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/routes/payments.rs | crate: router
use actix_web::{web, Responder};
use hyperswitch_domain_models::payments::HeaderPayload;
use router_env::{env, instrument, logger, tracing, types, Flow};
use super::app::ReqState;
use crate::{
self as app,
core::{
errors::{self, http_not_implemented},
payments::{self, PaymentRedirectFlow},
},
routes::lock_utils,
services::{api, authentication as auth},
types::{
api::{
self as api_types, enums as api_enums,
payments::{self as payment_types, PaymentIdTypeExt},
},
domain,
transformers::ForeignTryFrom,
},
};
pub async fn payments_incremental_authorization(
state: web::Data<app::AppState>,
req: actix_web::HttpRequest,
json_payload: web::Json<payment_types::PaymentsIncrementalAuthorizationRequest>,
path: web::Path<common_utils::id_type::PaymentId>,
) -> impl Responder {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
// file: hyperswitch/crates/router/src/routes/payments.rs | crate: router
use crate::{
core::api_locking::{self, GetLockingInput},
services::authorization::permissions::Permission,
};
use actix_web::{web, Responder};
use hyperswitch_domain_models::payments::HeaderPayload;
use router_env::{env, instrument, logger, tracing, types, Flow};
use super::app::ReqState;
use crate::{
self as app,
core::{
errors::{self, http_not_implemented},
payments::{self, PaymentRedirectFlow},
},
routes::lock_utils,
services::{api, authentication as auth},
types::{
api::{
self as api_types, enums as api_enums,
payments::{self as payment_types, PaymentIdTypeExt},
},
domain,
transformers::ForeignTryFrom,
},
};
pub async fn payments_reject(
state: web::Data<app::AppState>,
http_req: actix_web::HttpRequest,
json_payload: web::Json<payment_types::PaymentsRejectRequest>,
path: web::Path<common_utils::id_type::PaymentId>,
) -> impl Responder {
let mut payload = json_payload.into_inner();
let payment_id = path.into_inner();
tracing::Span::current().record("payment_id", payment_id.get_string_repr());
payload.payment_id = payment_id;
let flow = Flow::PaymentsReject;
let fpayload = FPaymentsRejectRequest(&payload);
let locking_action = fpayload.get_locking_input(flow.clone());
Box::pin(api::server_wrap(
flow.clone(),
state,
&http_req,
payload.clone(),
|state, auth: auth::AuthenticationData, req, req_state| {
payments::payments_core::<
api_types::Void,
payment_types::PaymentsResponse,
_,
_,
_,
payments::PaymentData<api_types::Void>,
>(
state,
req_state,
auth.merchant_account,
auth.profile_id,
auth.key_store,
payments::PaymentReject,
payment_types::PaymentsCancelRequest {
payment_id: req.payment_id,
cancellation_reason: Some("Rejected by merchant".to_string()),
..Default::default()
},
api::AuthFlow::Merchant,
payments::CallConnectorAction::Trigger,
None,
HeaderPayload::default(),
auth.platform_merchant_account,
)
},
match env::which() {
env::Env::Production => &auth::HeaderAuth(auth::ApiKeyAuth),
_ => auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth),
&auth::JWTAuth {
permission: Permission::ProfilePaymentWrite,
},
http_req.headers(),
),
},
locking_action,
))
.await
} | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/routes/payments.rs | crate: router
use crate::{
core::api_locking::{self, GetLockingInput},
services::authorization::permissions::Permission,
};
use actix_web::{web, Responder};
use hyperswitch_domain_models::payments::HeaderPayload;
use router_env::{env, instrument, logger, tracing, types, Flow};
use super::app::ReqState;
use crate::{
self as app,
core::{
errors::{self, http_not_implemented},
payments::{self, PaymentRedirectFlow},
},
routes::lock_utils,
services::{api, authentication as auth},
types::{
api::{
self as api_types, enums as api_enums,
payments::{self as payment_types, PaymentIdTypeExt},
},
domain,
transformers::ForeignTryFrom,
},
};
pub async fn payments_approve(
state: web::Data<app::AppState>,
http_req: actix_web::HttpRequest,
json_payload: web::Json<payment_types::PaymentsApproveRequest>,
path: web::Path<common_utils::id_type::PaymentId>,
) -> impl Responder {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/routes/payments.rs | crate: router
use crate::{
core::api_locking::{self, GetLockingInput},
services::authorization::permissions::Permission,
};
use actix_web::{web, Responder};
use hyperswitch_domain_models::payments::HeaderPayload;
use router_env::{env, instrument, logger, tracing, types, Flow};
use super::app::ReqState;
use crate::{
self as app,
core::{
errors::{self, http_not_implemented},
payments::{self, PaymentRedirectFlow},
},
routes::lock_utils,
services::{api, authentication as auth},
types::{
api::{
self as api_types, enums as api_enums,
payments::{self as payment_types, PaymentIdTypeExt},
},
domain,
transformers::ForeignTryFrom,
},
};
pub async fn profile_payments_list_by_filter(
state: web::Data<app::AppState>,
req: actix_web::HttpRequest,
payload: web::Json<payment_types::PaymentListFilterConstraints>,
) -> impl Responder {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/routes/payments.rs | crate: router
use crate::{
core::api_locking::{self, GetLockingInput},
services::authorization::permissions::Permission,
};
use actix_web::{web, Responder};
use hyperswitch_domain_models::payments::HeaderPayload;
use router_env::{env, instrument, logger, tracing, types, Flow};
use super::app::ReqState;
use crate::{
self as app,
core::{
errors::{self, http_not_implemented},
payments::{self, PaymentRedirectFlow},
},
routes::lock_utils,
services::{api, authentication as auth},
types::{
api::{
self as api_types, enums as api_enums,
payments::{self as payment_types, PaymentIdTypeExt},
},
domain,
transformers::ForeignTryFrom,
},
};
pub async fn payments_list_by_filter(
state: web::Data<app::AppState>,
req: actix_web::HttpRequest,
payload: web::Json<payment_types::PaymentListFilterConstraints>,
) -> impl Responder {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
// file: hyperswitch/crates/router/src/routes/payments.rs | crate: router
use crate::{
core::api_locking::{self, GetLockingInput},
services::authorization::permissions::Permission,
};
use actix_web::{web, Responder};
use hyperswitch_domain_models::payments::HeaderPayload;
use router_env::{env, instrument, logger, tracing, types, Flow};
use super::app::ReqState;
use crate::{
self as app,
core::{
errors::{self, http_not_implemented},
payments::{self, PaymentRedirectFlow},
},
routes::lock_utils,
services::{api, authentication as auth},
types::{
api::{
self as api_types, enums as api_enums,
payments::{self as payment_types, PaymentIdTypeExt},
},
domain,
transformers::ForeignTryFrom,
},
};
pub async fn profile_payments_list(
state: web::Data<app::AppState>,
req: actix_web::HttpRequest,
payload: web::Query<payment_types::PaymentListConstraints>,
) -> impl Responder {
let flow = Flow::PaymentsList;
let payload = payload.into_inner();
Box::pin(api::server_wrap(
flow,
state,
&req,
payload,
|state, auth: auth::AuthenticationData, req, _| {
payments::list_payments(
state,
auth.merchant_account,
auth.profile_id.map(|profile_id| vec![profile_id]),
auth.key_store,
req,
)
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth),
&auth::JWTAuth {
permission: Permission::ProfilePaymentRead,
},
req.headers(),
),
api_locking::LockAction::NotApplicable,
))
.await
} | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/routes/payments.rs | crate: router
use crate::{
core::api_locking::{self, GetLockingInput},
services::authorization::permissions::Permission,
};
use actix_web::{web, Responder};
use hyperswitch_domain_models::payments::HeaderPayload;
use router_env::{env, instrument, logger, tracing, types, Flow};
use super::app::ReqState;
use crate::{
self as app,
core::{
errors::{self, http_not_implemented},
payments::{self, PaymentRedirectFlow},
},
routes::lock_utils,
services::{api, authentication as auth},
types::{
api::{
self as api_types, enums as api_enums,
payments::{self as payment_types, PaymentIdTypeExt},
},
domain,
transformers::ForeignTryFrom,
},
};
pub async fn payments_list(
state: web::Data<app::AppState>,
req: actix_web::HttpRequest,
payload: web::Query<payment_types::PaymentListConstraints>,
) -> impl Responder {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/routes/payments.rs | crate: router
use actix_web::{web, Responder};
use hyperswitch_domain_models::payments::HeaderPayload;
use router_env::{env, instrument, logger, tracing, types, Flow};
use super::app::ReqState;
use crate::{
self as app,
core::{
errors::{self, http_not_implemented},
payments::{self, PaymentRedirectFlow},
},
routes::lock_utils,
services::{api, authentication as auth},
types::{
api::{
self as api_types, enums as api_enums,
payments::{self as payment_types, PaymentIdTypeExt},
},
domain,
transformers::ForeignTryFrom,
},
};
pub async fn payments_cancel(
state: web::Data<app::AppState>,
req: actix_web::HttpRequest,
json_payload: web::Json<payment_types::PaymentsCancelRequest>,
path: web::Path<common_utils::id_type::PaymentId>,
) -> impl Responder {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/routes/payments.rs | crate: router
use actix_web::{web, Responder};
use error_stack::report;
use hyperswitch_domain_models::payments::HeaderPayload;
use router_env::{env, instrument, logger, tracing, types, Flow};
use super::app::ReqState;
use crate::{
self as app,
core::{
errors::{self, http_not_implemented},
payments::{self, PaymentRedirectFlow},
},
routes::lock_utils,
services::{api, authentication as auth},
types::{
api::{
self as api_types, enums as api_enums,
payments::{self as payment_types, PaymentIdTypeExt},
},
domain,
transformers::ForeignTryFrom,
},
};
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 {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/routes/payments.rs | crate: router
use actix_web::{web, Responder};
use hyperswitch_domain_models::payments::HeaderPayload;
use router_env::{env, instrument, logger, tracing, types, Flow};
use super::app::ReqState;
use crate::{
self as app,
core::{
errors::{self, http_not_implemented},
payments::{self, PaymentRedirectFlow},
},
routes::lock_utils,
services::{api, authentication as auth},
types::{
api::{
self as api_types, enums as api_enums,
payments::{self as payment_types, PaymentIdTypeExt},
},
domain,
transformers::ForeignTryFrom,
},
};
pub async fn payments_complete_authorize_redirect_with_creds_identifier(
state: web::Data<app::AppState>,
req: actix_web::HttpRequest,
json_payload: Option<web::Form<serde_json::Value>>,
path: web::Path<(
common_utils::id_type::PaymentId,
common_utils::id_type::MerchantId,
String,
String,
)>,
) -> impl Responder {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/routes/payments.rs | crate: router
use actix_web::{web, Responder};
use hyperswitch_domain_models::payments::HeaderPayload;
use router_env::{env, instrument, logger, tracing, types, Flow};
use super::app::ReqState;
use crate::{
self as app,
core::{
errors::{self, http_not_implemented},
payments::{self, PaymentRedirectFlow},
},
routes::lock_utils,
services::{api, authentication as auth},
types::{
api::{
self as api_types, enums as api_enums,
payments::{self as payment_types, PaymentIdTypeExt},
},
domain,
transformers::ForeignTryFrom,
},
};
pub async fn payments_complete_authorize_redirect(
state: web::Data<app::AppState>,
req: actix_web::HttpRequest,
json_payload: Option<web::Form<serde_json::Value>>,
path: web::Path<(
common_utils::id_type::PaymentId,
common_utils::id_type::MerchantId,
String,
)>,
) -> impl Responder {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/routes/payments.rs | crate: router
use actix_web::{web, Responder};
use hyperswitch_domain_models::payments::HeaderPayload;
use router_env::{env, instrument, logger, tracing, types, Flow};
use super::app::ReqState;
use crate::{
self as app,
core::{
errors::{self, http_not_implemented},
payments::{self, PaymentRedirectFlow},
},
routes::lock_utils,
services::{api, authentication as auth},
types::{
api::{
self as api_types, enums as api_enums,
payments::{self as payment_types, PaymentIdTypeExt},
},
domain,
transformers::ForeignTryFrom,
},
};
pub async fn payments_redirect_response_with_creds_identifier(
state: web::Data<app::AppState>,
req: actix_web::HttpRequest,
path: web::Path<(
common_utils::id_type::PaymentId,
common_utils::id_type::MerchantId,
String,
String,
)>,
) -> impl Responder {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/routes/payments.rs | crate: router
use actix_web::{web, Responder};
use hyperswitch_domain_models::payments::HeaderPayload;
use router_env::{env, instrument, logger, tracing, types, Flow};
use super::app::ReqState;
use crate::{
self as app,
core::{
errors::{self, http_not_implemented},
payments::{self, PaymentRedirectFlow},
},
routes::lock_utils,
services::{api, authentication as auth},
types::{
api::{
self as api_types, enums as api_enums,
payments::{self as payment_types, PaymentIdTypeExt},
},
domain,
transformers::ForeignTryFrom,
},
};
pub async fn payments_redirect_response(
state: web::Data<app::AppState>,
req: actix_web::HttpRequest,
json_payload: Option<web::Form<serde_json::Value>>,
path: web::Path<(
common_utils::id_type::PaymentId,
common_utils::id_type::MerchantId,
String,
)>,
) -> impl Responder {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/routes/payments.rs | crate: router
use actix_web::{web, Responder};
use hyperswitch_domain_models::payments::HeaderPayload;
use router_env::{env, instrument, logger, tracing, types, Flow};
use super::app::ReqState;
use crate::{
self as app,
core::{
errors::{self, http_not_implemented},
payments::{self, PaymentRedirectFlow},
},
routes::lock_utils,
services::{api, authentication as auth},
types::{
api::{
self as api_types, enums as api_enums,
payments::{self as payment_types, PaymentIdTypeExt},
},
domain,
transformers::ForeignTryFrom,
},
};
pub async fn payments_connector_session(
state: web::Data<app::AppState>,
req: actix_web::HttpRequest,
json_payload: web::Json<payment_types::PaymentsSessionRequest>,
) -> impl Responder {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/routes/payments.rs | crate: router
use crate::{
core::api_locking::{self, GetLockingInput},
services::authorization::permissions::Permission,
};
use actix_web::{web, Responder};
use error_stack::report;
use hyperswitch_domain_models::payments::HeaderPayload;
use masking::PeekInterface;
use router_env::{env, instrument, logger, tracing, types, Flow};
use super::app::ReqState;
use crate::{
self as app,
core::{
errors::{self, http_not_implemented},
payments::{self, PaymentRedirectFlow},
},
routes::lock_utils,
services::{api, authentication as auth},
types::{
api::{
self as api_types, enums as api_enums,
payments::{self as payment_types, PaymentIdTypeExt},
},
domain,
transformers::ForeignTryFrom,
},
};
pub async fn payments_connector_session(
state: web::Data<app::AppState>,
req: actix_web::HttpRequest,
json_payload: web::Json<payment_types::PaymentsSessionRequest>,
path: web::Path<common_utils::id_type::GlobalPaymentId>,
) -> impl Responder {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/routes/payments.rs | crate: router
use actix_web::{web, Responder};
use hyperswitch_domain_models::payments::HeaderPayload;
use router_env::{env, instrument, logger, tracing, types, Flow};
use super::app::ReqState;
use crate::{
self as app,
core::{
errors::{self, http_not_implemented},
payments::{self, PaymentRedirectFlow},
},
routes::lock_utils,
services::{api, authentication as auth},
types::{
api::{
self as api_types, enums as api_enums,
payments::{self as payment_types, PaymentIdTypeExt},
},
domain,
transformers::ForeignTryFrom,
},
};
pub async fn payments_dynamic_tax_calculation(
state: web::Data<app::AppState>,
req: actix_web::HttpRequest,
json_payload: web::Json<payment_types::PaymentsDynamicTaxCalculationRequest>,
path: web::Path<common_utils::id_type::PaymentId>,
) -> impl Responder {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/routes/payments.rs | crate: router
use actix_web::{web, Responder};
use hyperswitch_domain_models::payments::HeaderPayload;
use router_env::{env, instrument, logger, tracing, types, Flow};
use super::app::ReqState;
use crate::{
self as app,
core::{
errors::{self, http_not_implemented},
payments::{self, PaymentRedirectFlow},
},
routes::lock_utils,
services::{api, authentication as auth},
types::{
api::{
self as api_types, enums as api_enums,
payments::{self as payment_types, PaymentIdTypeExt},
},
domain,
transformers::ForeignTryFrom,
},
};
pub async fn payments_capture(
state: web::Data<app::AppState>,
req: actix_web::HttpRequest,
json_payload: web::Json<payment_types::PaymentsCaptureRequest>,
path: web::Path<common_utils::id_type::PaymentId>,
) -> impl Responder {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/routes/payments.rs | crate: router
use actix_web::{web, Responder};
use hyperswitch_domain_models::payments::HeaderPayload;
use router_env::{env, instrument, logger, tracing, types, Flow};
use super::app::ReqState;
use crate::{
self as app,
core::{
errors::{self, http_not_implemented},
payments::{self, PaymentRedirectFlow},
},
routes::lock_utils,
services::{api, authentication as auth},
types::{
api::{
self as api_types, enums as api_enums,
payments::{self as payment_types, PaymentIdTypeExt},
},
domain,
transformers::ForeignTryFrom,
},
};
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 {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/routes/payments.rs | crate: router
use actix_web::{web, Responder};
use hyperswitch_domain_models::payments::HeaderPayload;
use router_env::{env, instrument, logger, tracing, types, Flow};
use super::app::ReqState;
use crate::{
self as app,
core::{
errors::{self, http_not_implemented},
payments::{self, PaymentRedirectFlow},
},
routes::lock_utils,
services::{api, authentication as auth},
types::{
api::{
self as api_types, enums as api_enums,
payments::{self as payment_types, PaymentIdTypeExt},
},
domain,
transformers::ForeignTryFrom,
},
};
pub async fn payments_post_session_tokens(
state: web::Data<app::AppState>,
req: actix_web::HttpRequest,
json_payload: web::Json<payment_types::PaymentsPostSessionTokensRequest>,
path: web::Path<common_utils::id_type::PaymentId>,
) -> impl Responder {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router/src/routes/payments.rs | crate: router
use actix_web::{web, Responder};
use error_stack::report;
use hyperswitch_domain_models::payments::HeaderPayload;
use router_env::{env, instrument, logger, tracing, types, Flow};
use super::app::ReqState;
use crate::{
self as app,
core::{
errors::{self, http_not_implemented},
payments::{self, PaymentRedirectFlow},
},
routes::lock_utils,
services::{api, authentication as auth},
types::{
api::{
self as api_types, enums as api_enums,
payments::{self as payment_types, PaymentIdTypeExt},
},
domain,
transformers::ForeignTryFrom,
},
};
pub async fn payments_update(
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 {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.