Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation
Rust adyenbeginner-friendlyfeaturedfinancefintechhacktoberfesthigh-performanceopen-sourceorchestrationpaymentpayment-gatewaypayment-integrationpayment-processingpaymentspayments-platformrestful-apirustsdkstripeworks-with-react
use actix_web::{web, HttpRequest, Responder};
use router_env::{instrument, Flow};
use super::app::AppState;
use crate::{
core::{api_locking, unified_connector_service::kill_switch},
services::{api as oss_api, authentication as auth},
};
/// Reports whether the UCS kill switch has tripped a scope, and what tripped it.
///
/// `scope` is the `rollout_scope` the trip logs, or the whole redis key.
/// Use `ucs_shadow_killed` to inspect the global shadow counter and its configured threshold.
#[instrument(skip_all, fields(flow = ?Flow::UnifiedConnectorServiceKillSwitchStatus))]
pub async fn kill_switch_status(
state: web::Data<AppState>,
req: HttpRequest,
path: web::Path<String>,
) -> impl Responder {
let flow = Flow::UnifiedConnectorServiceKillSwitchStatus;
Box::pin(oss_api::server_wrap(
flow,
state,
&req,
path.into_inner(),
|state, _, scope, _| kill_switch::trip_status(state, scope),
&auth::AdminApiAuth,
api_locking::LockAction::NotApplicable,
))
.await
}
/// Clears a UCS kill switch trip, returning the scope to whatever its rollout config says.
/// Accepts a primary UCS rollout scope or its Redis key, or `ucs_shadow_killed` for shadow.
#[instrument(skip_all, fields(flow = ?Flow::UnifiedConnectorServiceKillSwitchReset))]
pub async fn reset_kill_switch(
state: web::Data<AppState>,
req: HttpRequest,
path: web::Path<String>,
) -> impl Responder {
let flow = Flow::UnifiedConnectorServiceKillSwitchReset;
Box::pin(oss_api::server_wrap(
flow,
state,
&req,
path.into_inner(),
|state, _, scope, _| kill_switch::reset(state, scope),
&auth::AdminApiAuth,
api_locking::LockAction::NotApplicable,
))
.await
}