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 common_utils::errors::CustomResult;
use diesel_models::configs as storage;
/// Every method on this trait is expected to go through the caching layer:
/// reads are served from (and populate) the config cache, and writes redact the
/// cached entry across all instances. Direct database access is intentionally
/// not exposed here.
#[router_derive::track_async_interface]
#[async_trait::async_trait]
pub trait ConfigInterface {
type Error;
async fn insert_config(
&self,
config: storage::ConfigNew,
) -> CustomResult<storage::Config, Self::Error>;
async fn find_config_by_key_optional(
&self,
key: &str,
) -> CustomResult<Option<storage::Config>, Self::Error>;
async fn find_config_by_key_unwrap_or(
&self,
key: &str,
// If the config is not found, this default value is substituted in and
// returned as-is. It is never written to the cache (Redis or in-memory) —
// only the underlying presence/absence of the key is cached.
default_config: String,
) -> CustomResult<storage::Config, Self::Error>;
async fn update_config_by_key(
&self,
key: &str,
config_update: storage::ConfigUpdate,
) -> CustomResult<storage::Config, Self::Error>;
async fn delete_config_by_key(&self, key: &str) -> CustomResult<storage::Config, Self::Error>;
}