repo
stringclasses
4 values
file_path
stringlengths
6
193
extension
stringclasses
30 values
content
stringlengths
0
5.21M
token_count
int64
0
3.8M
hyperswitch
crates/hyperswitch_interfaces/src/events.rs
.rs
//! Events interface pub mod connector_api_logs;
10
hyperswitch
crates/hyperswitch_interfaces/src/configs.rs
.rs
pub use hyperswitch_domain_models::configs::Connectors;
12
hyperswitch
crates/hyperswitch_interfaces/src/connector_integration_v2.rs
.rs
//! definition of the new connector integration trait use common_utils::{ errors::CustomResult, request::{Method, Request, RequestBuilder, RequestContent}, }; use hyperswitch_domain_models::{router_data::ErrorResponse, router_data_v2::RouterDataV2}; use masking::Maskable; use serde_json::json; use crate::{ ...
2,057
hyperswitch
crates/hyperswitch_interfaces/src/events/connector_api_logs.rs
.rs
//! Connector API logs interface use common_utils::request::Method; use router_env::tracing_actix_web::RequestId; use serde::Serialize; use serde_json::json; use time::OffsetDateTime; /// struct ConnectorEvent #[derive(Debug, Serialize)] pub struct ConnectorEvent { tenant_id: common_utils::id_type::TenantId, ...
667
hyperswitch
crates/hyperswitch_interfaces/src/api/revenue_recovery_v2.rs
.rs
//! Revenue Recovery Interface V2 use hyperswitch_domain_models::{ router_data_v2::flow_common_types::{ BillingConnectorPaymentsSyncFlowData, RevenueRecoveryRecordBackData, }, router_flow_types::{BillingConnectorPaymentsSync, RecoveryRecordBack}, router_request_types::revenue_recovery::{ ...
268
hyperswitch
crates/hyperswitch_interfaces/src/api/payments_v2.rs
.rs
//! Payments V2 interface use hyperswitch_domain_models::{ router_data_v2::PaymentFlowData, router_flow_types::payments::{ Approve, Authorize, AuthorizeSessionToken, CalculateTax, Capture, CompleteAuthorize, CreateConnectorCustomer, IncrementalAuthorization, PSync, PaymentMethodToken, P...
1,170
hyperswitch
crates/hyperswitch_interfaces/src/api/disputes.rs
.rs
//! Disputes interface use hyperswitch_domain_models::{ router_flow_types::dispute::{Accept, Defend, Evidence}, router_request_types::{ AcceptDisputeRequestData, DefendDisputeRequestData, SubmitEvidenceRequestData, }, router_response_types::{AcceptDisputeResponse, DefendDisputeResponse, SubmitE...
203
hyperswitch
crates/hyperswitch_interfaces/src/api/authentication.rs
.rs
use hyperswitch_domain_models::{ router_flow_types::authentication::{ Authentication, PostAuthentication, PreAuthentication, PreAuthenticationVersionCall, }, router_request_types::authentication::{ ConnectorAuthenticationRequestData, ConnectorPostAuthenticationRequestData, PreAuthNRe...
248
hyperswitch
crates/hyperswitch_interfaces/src/api/authentication_v2.rs
.rs
use hyperswitch_domain_models::{ router_data_v2::ExternalAuthenticationFlowData, router_flow_types::authentication::{ Authentication, PostAuthentication, PreAuthentication, PreAuthenticationVersionCall, }, router_request_types::authentication::{ ConnectorAuthenticationRequestData, Connec...
333
hyperswitch
crates/hyperswitch_interfaces/src/api/payments.rs
.rs
//! Payments interface use hyperswitch_domain_models::{ router_flow_types::payments::{ Approve, Authorize, AuthorizeSessionToken, CalculateTax, Capture, CompleteAuthorize, CreateConnectorCustomer, IncrementalAuthorization, PSync, PaymentMethodToken, PostProcessing, PostSessionTokens, PrePro...
906
hyperswitch
crates/hyperswitch_interfaces/src/api/payouts_v2.rs
.rs
//! Payouts V2 interface use hyperswitch_domain_models::{ router_data_v2::flow_common_types::PayoutFlowData, router_flow_types::payouts::{ PoCancel, PoCreate, PoEligibility, PoFulfill, PoQuote, PoRecipient, PoRecipientAccount, PoSync, }, router_request_types::PayoutsData, router_resp...
590
hyperswitch
crates/hyperswitch_interfaces/src/api/revenue_recovery.rs
.rs
//! Revenue Recovery Interface use hyperswitch_domain_models::{ router_flow_types::{BillingConnectorPaymentsSync, RecoveryRecordBack}, router_request_types::revenue_recovery::{ BillingConnectorPaymentsSyncRequest, RevenueRecoveryRecordBackRequest, }, router_response_types::revenue_recovery::{ ...
269
hyperswitch
crates/hyperswitch_interfaces/src/api/files_v2.rs
.rs
//! Files V2 interface use hyperswitch_domain_models::{ router_data_v2::FilesFlowData, router_flow_types::{Retrieve, Upload}, router_request_types::{RetrieveFileRequestData, UploadFileRequestData}, router_response_types::{RetrieveFileResponse, UploadFileResponse}, }; use crate::api::{errors, files::Fi...
274
hyperswitch
crates/hyperswitch_interfaces/src/api/disputes_v2.rs
.rs
//! Disputes V2 interface use hyperswitch_domain_models::{ router_data_v2::DisputesFlowData, router_flow_types::dispute::{Accept, Defend, Evidence}, router_request_types::{ AcceptDisputeRequestData, DefendDisputeRequestData, SubmitEvidenceRequestData, }, router_response_types::{AcceptDispute...
273
hyperswitch
crates/hyperswitch_interfaces/src/api/refunds.rs
.rs
//! Refunds interface use hyperswitch_domain_models::{ router_flow_types::{Execute, RSync}, router_request_types::RefundsData, router_response_types::RefundsResponseData, }; use crate::api::{self, ConnectorCommon}; /// trait RefundExecute pub trait RefundExecute: api::ConnectorIntegration<Execute, Re...
133
hyperswitch
crates/hyperswitch_interfaces/src/api/fraud_check.rs
.rs
//! FRM interface use hyperswitch_domain_models::{ router_flow_types::{Checkout, Fulfillment, RecordReturn, Sale, Transaction}, router_request_types::fraud_check::{ FraudCheckCheckoutData, FraudCheckFulfillmentData, FraudCheckRecordReturnData, FraudCheckSaleData, FraudCheckTransactionData, }...
305
hyperswitch
crates/hyperswitch_interfaces/src/api/fraud_check_v2.rs
.rs
//! FRM V2 interface use hyperswitch_domain_models::{ router_data_v2::flow_common_types::FrmFlowData, router_flow_types::{Checkout, Fulfillment, RecordReturn, Sale, Transaction}, router_request_types::fraud_check::{ FraudCheckCheckoutData, FraudCheckFulfillmentData, FraudCheckRecordReturnData, ...
393
hyperswitch
crates/hyperswitch_interfaces/src/api/payouts.rs
.rs
//! Payouts interface use hyperswitch_domain_models::{ router_flow_types::payouts::{ PoCancel, PoCreate, PoEligibility, PoFulfill, PoQuote, PoRecipient, PoRecipientAccount, PoSync, }, router_request_types::PayoutsData, router_response_types::PayoutsResponseData, }; use super::Connector...
453
hyperswitch
crates/hyperswitch_interfaces/src/api/refunds_v2.rs
.rs
//! Refunds V2 interface use hyperswitch_domain_models::{ router_data_v2::flow_common_types::RefundFlowData, router_flow_types::refunds::{Execute, RSync}, router_request_types::RefundsData, router_response_types::RefundsResponseData, }; use crate::api::{ConnectorCommon, ConnectorIntegrationV2}; /// t...
184
hyperswitch
crates/hyperswitch_interfaces/src/api/files.rs
.rs
//! Files interface use hyperswitch_domain_models::{ router_flow_types::files::{Retrieve, Upload}, router_request_types::{RetrieveFileRequestData, UploadFileRequestData}, router_response_types::{RetrieveFileResponse, UploadFileResponse}, }; use crate::{ api::{ConnectorCommon, ConnectorIntegration}, ...
289
hyperswitch
crates/hyperswitch_interfaces/src/secrets_interface/secret_handler.rs
.rs
//! Module containing trait for raw secret retrieval use common_utils::errors::CustomResult; use crate::secrets_interface::{ secret_state::{RawSecret, SecretStateContainer, SecuredSecret}, SecretManagementInterface, SecretsManagementError, }; /// Trait defining the interface for retrieving a raw secret value...
161
hyperswitch
crates/hyperswitch_interfaces/src/secrets_interface/secret_state.rs
.rs
//! Module to manage encrypted and decrypted states for a given type. use std::marker::PhantomData; use serde::{Deserialize, Deserializer}; /// Trait defining the states of a secret pub trait SecretState {} /// Decrypted state #[derive(Debug, Clone, Deserialize, Default)] pub struct RawSecret {} /// Encrypted stat...
415
hyperswitch
crates/storage_impl/Cargo.toml
.toml
[package] name = "storage_impl" description = "Storage backend implementations for data structures in router" version = "0.1.0" edition.workspace = true rust-version.workspace = true readme = "README.md" license.workspace = true [features] default = ["olap", "oltp"] dynamic_routing = [] oltp = [] olap = ["hyperswitch_...
743
hyperswitch
crates/storage_impl/README.md
.md
# Storage implementations Storage backend implementations for data structures & objects.
13
hyperswitch
crates/storage_impl/src/mock_db.rs
.rs
use std::sync::Arc; use common_utils::{errors::CustomResult, types::keymanager::KeyManagerState}; use diesel_models as store; use error_stack::ResultExt; use futures::lock::{Mutex, MutexGuard}; use hyperswitch_domain_models::{ behaviour::{Conversion, ReverseConversion}, merchant_key_store::MerchantKeyStore, ...
1,798
hyperswitch
crates/storage_impl/src/metrics.rs
.rs
use router_env::{counter_metric, gauge_metric, global_meter}; global_meter!(GLOBAL_METER, "ROUTER_API"); counter_metric!(KV_MISS, GLOBAL_METER); // No. of KV misses // Metrics for KV counter_metric!(KV_OPERATION_SUCCESSFUL, GLOBAL_METER); counter_metric!(KV_OPERATION_FAILED, GLOBAL_METER); counter_metric!(KV_PUSHED_...
175
hyperswitch
crates/storage_impl/src/refund.rs
.rs
use diesel_models::refund::Refund; use crate::redis::kv_store::KvStorePartition; impl KvStorePartition for Refund {}
30
hyperswitch
crates/storage_impl/src/connection.rs
.rs
use bb8::PooledConnection; use common_utils::errors; use diesel::PgConnection; use error_stack::ResultExt; pub type PgPool = bb8::Pool<async_bb8_diesel::ConnectionManager<PgConnection>>; pub type PgPooledConn = async_bb8_diesel::Connection<PgConnection>; /// Creates a Redis connection pool for the specified Redis se...
497
hyperswitch
crates/storage_impl/src/lookup.rs
.rs
use common_utils::errors::CustomResult; use diesel_models::{ enums as storage_enums, kv, reverse_lookup::{ ReverseLookup as DieselReverseLookup, ReverseLookupNew as DieselReverseLookupNew, }, }; use error_stack::ResultExt; use redis_interface::SetnxReply; use crate::{ diesel_error_to_data_error...
1,183
hyperswitch
crates/storage_impl/src/payments.rs
.rs
pub mod payment_attempt; pub mod payment_intent; use diesel_models::{payment_attempt::PaymentAttempt, PaymentIntent}; use crate::redis::kv_store::KvStorePartition; impl KvStorePartition for PaymentIntent {} impl KvStorePartition for PaymentAttempt {}
52
hyperswitch
crates/storage_impl/src/address.rs
.rs
use diesel_models::address::Address; use crate::redis::kv_store::KvStorePartition; impl KvStorePartition for Address {}
28
hyperswitch
crates/storage_impl/src/callback_mapper.rs
.rs
use diesel_models::callback_mapper::CallbackMapper as DieselCallbackMapper; use hyperswitch_domain_models::callback_mapper::CallbackMapper; use crate::DataModelExt; impl DataModelExt for CallbackMapper { type StorageModel = DieselCallbackMapper; fn to_storage_model(self) -> Self::StorageModel { Diese...
173
hyperswitch
crates/storage_impl/src/database.rs
.rs
pub mod store;
4
hyperswitch
crates/storage_impl/src/utils.rs
.rs
use bb8::PooledConnection; use diesel::PgConnection; use error_stack::ResultExt; use crate::{ errors::{RedisErrorExt, StorageError}, metrics, DatabaseStore, }; pub async fn pg_connection_read<T: DatabaseStore>( store: &T, ) -> error_stack::Result< PooledConnection<'_, async_bb8_diesel::ConnectionManag...
1,082
hyperswitch
crates/storage_impl/src/config.rs
.rs
use common_utils::{id_type, DbConnectionParams}; use masking::Secret; #[derive(Debug, Clone, serde::Deserialize)] pub struct Database { pub username: String, pub password: Secret<String>, pub host: String, pub port: u16, pub dbname: String, pub pool_size: u32, pub connection_timeout: u64, ...
482
hyperswitch
crates/storage_impl/src/kv_router_store.rs
.rs
use std::{fmt::Debug, sync::Arc}; use common_enums::enums::MerchantStorageScheme; use common_utils::{fallback_reverse_lookup_not_found, types::keymanager::KeyManagerState}; use diesel_models::{errors::DatabaseError, kv}; use error_stack::ResultExt; use hyperswitch_domain_models::{ behaviour::{Conversion, ReverseCo...
3,910
hyperswitch
crates/storage_impl/src/customers.rs
.rs
use diesel_models::customers::Customer; use crate::redis::kv_store::KvStorePartition; impl KvStorePartition for Customer {}
28
hyperswitch
crates/storage_impl/src/payment_method.rs
.rs
use diesel_models::payment_method::PaymentMethod; use crate::redis::kv_store::KvStorePartition; impl KvStorePartition for PaymentMethod {} use common_enums::enums::MerchantStorageScheme; use common_utils::{errors::CustomResult, id_type, types::keymanager::KeyManagerState}; use diesel_models::{ kv, payment_me...
7,953
hyperswitch
crates/storage_impl/src/mandate.rs
.rs
use diesel_models::Mandate; use crate::redis::kv_store::KvStorePartition; impl KvStorePartition for Mandate {}
29
hyperswitch
crates/storage_impl/src/lib.rs
.rs
use std::{fmt::Debug, sync::Arc}; use diesel_models as store; use error_stack::ResultExt; use hyperswitch_domain_models::{ behaviour::{Conversion, ReverseConversion}, merchant_key_store::MerchantKeyStore, }; use masking::StrongSecret; use redis::{kv_store::RedisConnInterface, pub_sub::PubSubInterface, RedisSto...
3,253
hyperswitch
crates/storage_impl/src/payouts.rs
.rs
pub mod payout_attempt; #[allow(clippy::module_inception)] pub mod payouts; use diesel_models::{payout_attempt::PayoutAttempt, payouts::Payouts}; use crate::redis::kv_store::KvStorePartition; impl KvStorePartition for Payouts {} impl KvStorePartition for PayoutAttempt {}
67
hyperswitch
crates/storage_impl/src/errors.rs
.rs
pub use common_enums::{ApiClientError, ApplicationError, ApplicationResult}; pub use redis_interface::errors::RedisError; use crate::store::errors::DatabaseError; pub type StorageResult<T> = error_stack::Result<T, StorageError>; #[derive(Debug, thiserror::Error)] pub enum StorageError { #[error("Initialization Er...
2,250
hyperswitch
crates/storage_impl/src/redis.rs
.rs
pub mod cache; pub mod kv_store; pub mod pub_sub; use std::sync::{atomic, Arc}; use router_env::tracing::Instrument; use self::{kv_store::RedisConnInterface, pub_sub::PubSubInterface}; #[derive(Clone)] pub struct RedisStore { // Maybe expose the redis_conn via traits instead of the making the field public p...
404
hyperswitch
crates/storage_impl/src/reverse_lookup.rs
.rs
use diesel_models::reverse_lookup::ReverseLookup; use crate::redis::kv_store::KvStorePartition; impl KvStorePartition for ReverseLookup {}
31
hyperswitch
crates/storage_impl/src/mock_db/payment_intent.rs
.rs
use common_utils::{errors::CustomResult, types::keymanager::KeyManagerState}; use diesel_models::enums as storage_enums; use error_stack::ResultExt; use hyperswitch_domain_models::{ behaviour::Conversion, merchant_key_store::MerchantKeyStore, payments::{ payment_intent::{PaymentIntentInterface, Paym...
2,077
hyperswitch
crates/storage_impl/src/mock_db/redis_conn.rs
.rs
use std::sync::Arc; use redis_interface::errors::RedisError; use super::MockDb; use crate::redis::kv_store::RedisConnInterface; impl RedisConnInterface for MockDb { fn get_redis_conn( &self, ) -> Result<Arc<redis_interface::RedisConnectionPool>, error_stack::Report<RedisError>> { self.redis.g...
85
hyperswitch
crates/storage_impl/src/mock_db/payout_attempt.rs
.rs
use common_utils::errors::CustomResult; use diesel_models::enums as storage_enums; use hyperswitch_domain_models::payouts::{ payout_attempt::{ PayoutAttempt, PayoutAttemptInterface, PayoutAttemptNew, PayoutAttemptUpdate, }, payouts::Payouts, }; use super::MockDb; use crate::errors::StorageError; #...
562
hyperswitch
crates/storage_impl/src/mock_db/payouts.rs
.rs
use common_utils::errors::CustomResult; use diesel_models::enums as storage_enums; use hyperswitch_domain_models::payouts::{ payout_attempt::PayoutAttempt, payouts::{Payouts, PayoutsInterface, PayoutsNew, PayoutsUpdate}, }; use crate::{errors::StorageError, MockDb}; #[async_trait::async_trait] impl PayoutsInt...
1,034
hyperswitch
crates/storage_impl/src/mock_db/payment_attempt.rs
.rs
use common_utils::errors::CustomResult; #[cfg(feature = "v2")] use common_utils::{id_type, types::keymanager::KeyManagerState}; use diesel_models::enums as storage_enums; #[cfg(feature = "v2")] use hyperswitch_domain_models::merchant_key_store::MerchantKeyStore; #[cfg(feature = "v1")] use hyperswitch_domain_models::pay...
3,154
hyperswitch
crates/storage_impl/src/payments/payment_intent.rs
.rs
#[cfg(feature = "olap")] use api_models::payments::{AmountFilter, Order, SortBy, SortOn}; #[cfg(feature = "olap")] use async_bb8_diesel::{AsyncConnection, AsyncRunQueryDsl}; use common_utils::{ ext_traits::{AsyncExt, Encode}, types::keymanager::KeyManagerState, }; #[cfg(feature = "olap")] use diesel::{associati...
11,201
hyperswitch
crates/storage_impl/src/payments/payment_attempt.rs
.rs
#[cfg(feature = "v2")] use common_utils::types::keymanager::KeyManagerState; use common_utils::{ errors::CustomResult, fallback_reverse_lookup_not_found, types::{ConnectorTransactionId, ConnectorTransactionIdTrait}, }; use diesel_models::{ enums::{ MandateAmountData as DieselMandateAmountData, M...
14,754
hyperswitch
crates/storage_impl/src/database/store.rs
.rs
use async_bb8_diesel::{AsyncConnection, ConnectionError}; use bb8::CustomizeConnection; use common_utils::DbConnectionParams; use diesel::PgConnection; use error_stack::ResultExt; use crate::{ config::{Database, TenantConfig}, errors::{StorageError, StorageResult}, }; pub type PgPool = bb8::Pool<async_bb8_die...
1,151
hyperswitch
crates/storage_impl/src/redis/cache.rs
.rs
use std::{any::Any, borrow::Cow, fmt::Debug, sync::Arc}; use common_utils::{ errors::{self, CustomResult}, ext_traits::ByteSliceExt, }; use dyn_clone::DynClone; use error_stack::{Report, ResultExt}; use moka::future::Cache as MokaCache; use once_cell::sync::Lazy; use redis_interface::{errors::RedisError, Redis...
3,997
hyperswitch
crates/storage_impl/src/redis/pub_sub.rs
.rs
use std::sync::atomic; use error_stack::ResultExt; use redis_interface::{errors as redis_errors, PubsubInterface, RedisValue}; use router_env::{logger, tracing::Instrument}; use crate::redis::cache::{ CacheKey, CacheKind, CacheRedact, ACCOUNTS_CACHE, CGRAPH_CACHE, CONFIG_CACHE, CONTRACT_BASED_DYNAMIC_ALGORITH...
1,710
hyperswitch
crates/storage_impl/src/redis/kv_store.rs
.rs
use std::{fmt::Debug, sync::Arc}; use common_utils::errors::CustomResult; use diesel_models::enums::MerchantStorageScheme; use error_stack::report; use redis_interface::errors::RedisError; use router_derive::TryGetEnumVariant; use router_env::logger; use serde::de; use crate::{kv_router_store::KVRouterStore, metrics,...
2,544
hyperswitch
crates/storage_impl/src/payouts/payout_attempt.rs
.rs
use std::str::FromStr; use api_models::enums::PayoutConnectors; use common_utils::{errors::CustomResult, ext_traits::Encode, fallback_reverse_lookup_not_found}; use diesel_models::{ enums::MerchantStorageScheme, kv, payout_attempt::{ PayoutAttempt as DieselPayoutAttempt, PayoutAttemptNew as DieselP...
5,213
hyperswitch
crates/storage_impl/src/payouts/payouts.rs
.rs
#[cfg(feature = "olap")] use api_models::enums::PayoutConnectors; #[cfg(feature = "olap")] use async_bb8_diesel::{AsyncConnection, AsyncRunQueryDsl}; use common_utils::ext_traits::Encode; #[cfg(all( feature = "olap", any(feature = "v1", feature = "v2"), not(feature = "customer_v2") ))] use diesel::JoinOnDsl...
8,315
hyperswitch
crates/router_env/Cargo.toml
.toml
[package] name = "router_env" description = "Environment of payment router: logger, basic config, its environment awareness." version = "0.1.0" edition.workspace = true rust-version.workspace = true readme = "README.md" license.workspace = true [dependencies] cargo_metadata = "0.18.1" config = { version = "0.14.0", fe...
691
hyperswitch
crates/router_env/build.rs
.rs
mod vergen { include!("src/vergen.rs"); } mod cargo_workspace { include!("src/cargo_workspace.rs"); } fn main() { vergen::generate_cargo_instructions(); cargo_workspace::verify_cargo_metadata_format(); cargo_workspace::set_cargo_workspace_members_env(); }
63
hyperswitch
crates/router_env/README.md
.md
# router_env Environment of payment router: logger, basic config, its environment awareness. ## Example ```rust use router_env::logger; use tracing::{self, instrument}; #[instrument] pub fn sample() -> () { logger::log!( logger::Level::INFO, payment_id = 8565654, payment_attempt_id = 596...
142
hyperswitch
crates/router_env/tests/test_module.rs
.rs
use router_env as logger; #[tracing::instrument(skip_all)] pub async fn fn_with_colon(val: i32) { let a = 13; let b = 31; logger::log!( logger::Level::WARN, ?a, ?b, tag = ?logger::Tag::ApiIncomingRequest, category = ?logger::Category::Api, flow = "some_flow"...
281
hyperswitch
crates/router_env/tests/env.rs
.rs
#![allow(clippy::print_stdout)] #[cfg(feature = "vergen")] use router_env as env; #[cfg(feature = "vergen")] #[tokio::test] async fn basic() -> Result<(), Box<dyn std::error::Error + Send + Sync>> { println!("CARGO_PKG_VERSION : {:?}", env!("CARGO_PKG_VERSION")); println!("CARGO_PROFILE : {:?}", env!("CARGO_P...
301
hyperswitch
crates/router_env/tests/logger.rs
.rs
#![allow(clippy::unwrap_used)] mod test_module; use ::config::ConfigError; use router_env::TelemetryGuard; use self::test_module::fn_with_colon; fn logger() -> error_stack::Result<&'static TelemetryGuard, ConfigError> { use once_cell::sync::OnceCell; static INSTANCE: OnceCell<TelemetryGuard> = OnceCell::ne...
171
hyperswitch
crates/router_env/src/metrics.rs
.rs
//! Utilities to easily create opentelemetry contexts, meters and metrics. /// Create a global [`Meter`][Meter] with the specified name and an optional description. /// /// [Meter]: opentelemetry::metrics::Meter #[macro_export] macro_rules! global_meter { ($name:ident) => { static $name: once_cell::sync::L...
1,442
hyperswitch
crates/router_env/src/cargo_workspace.rs
.rs
/// Sets the `CARGO_WORKSPACE_MEMBERS` environment variable to include a comma-separated list of /// names of all crates in the current cargo workspace. /// /// This function should be typically called within build scripts, so that the environment variable /// is available to the corresponding crate at compile time. //...
538
hyperswitch
crates/router_env/src/vergen.rs
.rs
/// Configures the [`vergen`][::vergen] crate to generate the `cargo` build instructions. /// /// This function should be typically called within build scripts to generate `cargo` build /// instructions for the corresponding crate. /// /// # Panics /// /// Panics if `vergen` fails to generate `cargo` build instructions...
272
hyperswitch
crates/router_env/src/env.rs
.rs
//! Information about the current environment. use std::path::PathBuf; use serde::{Deserialize, Serialize}; /// Environment variables accessed by the application. This module aims to be the source of truth /// containing all environment variable that the application accesses. pub mod vars { /// Parent directory ...
1,186
hyperswitch
crates/router_env/src/logger.rs
.rs
//! Logger of the system. pub use tracing::{debug, error, event as log, info, warn}; pub use tracing_attributes::instrument; pub mod config; mod defaults; pub use crate::config::Config; // mod macros; pub mod types; pub use types::{Category, Flow, Level, Tag}; mod setup; pub use setup::{setup, TelemetryGuard}; pub...
101
hyperswitch
crates/router_env/src/lib.rs
.rs
#![warn(missing_debug_implementations)] //! Environment of payment router: logger, basic config, its environment awareness. #![doc = include_str!(concat!(env!("CARGO_MANIFEST_DIR" ), "/", "README.md"))] /// Utilities to identify members of the current cargo workspace. pub mod cargo_workspace; pub mod env; pub mod lo...
168
hyperswitch
crates/router_env/src/logger/setup.rs
.rs
//! Setup logging subsystem. use std::time::Duration; use ::config::ConfigError; use serde_json::ser::{CompactFormatter, PrettyFormatter}; use tracing_appender::non_blocking::WorkerGuard; use tracing_subscriber::{fmt, prelude::*, util::SubscriberInitExt, EnvFilter, Layer}; use crate::{config, FormattingLayer, Storag...
2,837
hyperswitch
crates/router_env/src/logger/formatter.rs
.rs
//! Formatting [layer](https://docs.rs/tracing-subscriber/0.3.15/tracing_subscriber/layer/trait.Layer.html) for Router. use std::{ collections::{HashMap, HashSet}, fmt, io::Write, }; use config::ConfigError; use once_cell::sync::Lazy; use serde::ser::{SerializeMap, Serializer}; use serde_json::{ser::Forma...
3,367
hyperswitch
crates/router_env/src/logger/config.rs
.rs
//! Logger-specific config. use std::path::PathBuf; use serde::Deserialize; /// Config settings. #[derive(Debug, Deserialize, Clone)] pub struct Config { /// Logging to a file. pub log: Log, } /// Log config settings. #[derive(Debug, Deserialize, Clone, Default)] #[serde(default)] pub struct Log { /// L...
1,570
hyperswitch
crates/router_env/src/logger/defaults.rs
.rs
impl Default for super::config::LogFile { fn default() -> Self { Self { enabled: true, path: "logs".into(), file_name: "debug.log".into(), level: super::config::Level(tracing::Level::DEBUG), filtering_directive: None, } } } impl Defaul...
134
hyperswitch
crates/router_env/src/logger/types.rs
.rs
//! Types. use serde::Deserialize; use strum::{Display, EnumString}; pub use tracing::{ field::{Field, Visit}, Level, Value, }; /// Category and tag of log event. /// /// Don't hesitate to add your variant if it is missing here. #[derive(Debug, Default, Deserialize, Clone, Display, EnumString)] pub enum Tag {...
3,795
hyperswitch
crates/router_env/src/logger/storage.rs
.rs
//! Storing [layer](https://docs.rs/tracing-subscriber/0.3.15/tracing_subscriber/layer/trait.Layer.html) for Router. use std::{collections::HashMap, fmt, time::Instant}; use tracing::{ field::{Field, Visit}, span::{Attributes, Record}, Id, Subscriber, }; use tracing_subscriber::{layer::Context, Layer}; /...
1,370
hyperswitch
crates/router/Cargo.toml
.toml
[package] name = "router" description = "Modern, fast and open payment router" version = "0.2.0" edition.workspace = true default-run = "router" rust-version.workspace = true readme = "README.md" license.workspace = true [features] default = ["common_default", "v1"] common_default = ["kv_store", "stripe", "oltp", "ola...
2,977
hyperswitch
crates/router/build.rs
.rs
fn main() { // Set thread stack size to 10 MiB for debug builds // Reference: https://doc.rust-lang.org/std/thread/#stack-size #[cfg(debug_assertions)] println!("cargo:rustc-env=RUST_MIN_STACK=10485760"); // 10 * 1024 * 1024 = 10 MiB #[cfg(feature = "vergen")] router_env::vergen::generate_cargo...
111
hyperswitch
crates/router/README.md
.md
# Router Main crate of the project. ## Files Tree Layout <!-- FIXME: this table should either be generated by a script or smoke test should be introduced checking it agrees with actual structure --> <!-- FIXME: fill missing --> ```text ├── src : source code │   ├── configs : c...
313
hyperswitch
crates/router/locales/zh.yml
.yml
_version: 1 payout_link: initiate: not_allowed: "您没有权限查看此内容" title: "支付链接" status: title: "支付状态" info: ref_id: "参考ID" error_code: "错误代码" error_message: "错误信息" message: failed: "处理您的支付时失败。请与您的服务提供商确认更多详细信息。" processing: "您的支付应在2-3个工作日内处理完毕。" success: "您的支付已成功完...
282
hyperswitch
crates/router/locales/de.yml
.yml
_version: 1 payout_link: initiate: not_allowed: "Sie dürfen diesen Inhalt nicht anzeigen" title: "Auszahlungslinks" status: title: "Auszahlungsstatus" info: ref_id: "Referenz-ID" error_code: "Fehlercode" error_message: "Fehlermeldung" message: failed: "Die Auszahlung kon...
330
hyperswitch
crates/router/locales/es.yml
.yml
_version: 1 payout_link: initiate: not_allowed: "No tienes permiso para ver este contenido" title: "Enlaces de Pago" status: title: "Estado del Pago" info: ref_id: "ID de Referencia" error_code: "Código de Error" error_message: "Mensaje de Error" message: failed: "No se ...
311
hyperswitch
crates/router/locales/pl.yml
.yml
_version: 1 payout_link: initiate: not_allowed: "Nie masz uprawnień do wyświetlania tej treści" title: "Linki do wypłat" status: title: "Status wypłaty" info: ref_id: "ID referencyjny" error_code: "Kod błędu" error_message: "Komunikat o błędzie" message: failed: "Nie uda...
389
hyperswitch
crates/router/locales/ja.yml
.yml
_version: 1 payout_link: initiate: not_allowed: "このコンテンツを見ることはできません" title: "支払いリンク" status: title: "支払いステータス" info: ref_id: "参照ID" error_code: "エラーコード" error_message: "エラーメッセージ" message: failed: "支払いの処理に失敗しました。詳細については提供者に確認してください。" processing: "支払いは2〜3営業日以内に処理される予...
322
hyperswitch
crates/router/locales/ar.yml
.yml
_version: 1 payout_link: initiate: not_allowed: "لا يُسمح لك بمشاهدة هذا المحتوى" title: "روابط الدفع" status: title: "حالة الدفع" info: ref_id: "معرف المرجع" error_code: "رمز الخطأ" error_message: "رسالة الخطأ" message: failed: "فشل في معالجة الدفع الخاص بك. يرجى التحقق...
353
hyperswitch
crates/router/locales/nl.yml
.yml
_version: 1 payout_link: initiate: not_allowed: "Je bent niet toegestaan om deze inhoud te bekijken" title: "Betalingslinks" status: title: "Betalingsstatus" info: ref_id: "Referentie-ID" error_code: "Foutcode" error_message: "Foutmelding" message: failed: "Het is niet g...
332
hyperswitch
crates/router/locales/it.yml
.yml
_version: 1 payout_link: initiate: not_allowed: "Non sei autorizzato a visualizzare questo contenuto" title: "Link di Pagamento" status: title: "Stato del Pagamento" info: ref_id: "ID di Riferimento" error_code: "Codice di Errore" error_message: "Messaggio di Errore" message: ...
342
hyperswitch
crates/router/locales/he.yml
.yml
_version: 1 payout_link: initiate: not_allowed: "אינך מורשה לצפות בתוכן זה" title: "קישורי תשלום" status: title: "סטטוס תשלום" info: ref_id: "מספר הפניה" error_code: "קוד שגיאה" error_message: "הודעת שגיאה" message: failed: "נכשל בעיבוד התשלום שלך. אנא בדוק עם הספק שלך ל...
317
hyperswitch
crates/router/locales/ru.yml
.yml
_version: 1 payout_link: initiate: not_allowed: "Вам не разрешено просматривать этот контент" title: "Ссылки на выплаты" status: title: "Статус выплаты" info: ref_id: "ID ссылки" error_code: "Код ошибки" error_message: "Сообщение об ошибке" message: failed: "Не удалось о...
375
hyperswitch
crates/router/locales/sv.yml
.yml
_version: 1 payout_link: initiate: not_allowed: "Du har inte tillåtelse att visa detta innehåll" title: "Utbetalningslänkar" status: title: "Utbetalningsstatus" info: ref_id: "Referens-ID" error_code: "Felkod" error_message: "Felmeddelande" message: failed: "Det gick int...
344
hyperswitch
crates/router/locales/en-GB.yml
.yml
_version: 1 payout_link: initiate: not_allowed: "You are not allowed to view this content" title: "Payout Links" status: title: "Payout Status" info: ref_id: "Ref Id" error_code: "Error Code" error_message: "Error Message" message: failed: "Failed to process your payout....
272
hyperswitch
crates/router/locales/fr-BE.yml
.yml
_version: 1 payout_link: initiate: not_allowed: "Vous n'êtes pas autorisé à voir ce contenu" title: "Liens de paiement" status: title: "Statut du paiement" info: ref_id: "ID de référence" error_code: "Code d'erreur" error_message: "Message d'erreur" message: failed: "Éch...
329
hyperswitch
crates/router/locales/en.yml
.yml
_version: 1 payout_link: initiate: not_allowed: "You are not allowed to view this content" title: "Payout Links" status: title: "Payout Status" info: ref_id: "Reference Id" error_code: "Error Code" error_message: "Error Message" message: failed: "Failed to process your p...
272
hyperswitch
crates/router/locales/fr.yml
.yml
_version: 1 payout_link: initiate: not_allowed: "Vous n'êtes pas autorisé à voir ce contenu" title: "Liens de Paiement" status: title: "Statut de Paiement" info: ref_id: "Id de Réf" error_code: "Code d'Erreur" error_message: "Message d'Erreur" message: failed: "Échec du ...
332
hyperswitch
crates/router/locales/pt.yml
.yml
_version: 1 payout_link: initiate: not_allowed: "Você não tem permissão para visualizar este conteúdo" title: "Links de Pagamento" status: title: "Status do Pagamento" info: ref_id: "ID de Referência" error_code: "Código de Erro" error_message: "Mensagem de Erro" message: ...
324
hyperswitch
crates/router/locales/ca.yml
.yml
_version: 1 payout_link: initiate: not_allowed: "No tens permís per veure aquest contingut" title: "Enllaços de Pagament" status: title: "Estat del Pagament" info: ref_id: "ID de Referència" error_code: "Codi d'Error" error_message: "Missatge d'Error" message: failed: "N...
361
hyperswitch
crates/router/tests/integration_demo.rs
.rs
#![allow(clippy::unwrap_used)] mod utils; use masking::PeekInterface; use test_utils::connector_auth::ConnectorAuthentication; use utils::{mk_service, ApiKey, AppClient, MerchantId, PaymentId, Status}; /// Example of unit test /// Kind of test: output-based testing /// 1) Create Merchant account #[actix_web::test] as...
1,588
hyperswitch
crates/router/tests/cache.rs
.rs
#![allow(clippy::unwrap_used, clippy::print_stdout)] use std::sync::Arc; use router::{configs::settings::Settings, routes, services}; use storage_impl::redis::cache::{self, CacheKey}; mod utils; #[actix_web::test] async fn invalidate_existing_cache_success() { // Arrange Box::pin(utils::setup()).await; l...
728
hyperswitch
crates/router/tests/health_check.rs
.rs
mod utils; use utils::{mk_service, AppClient}; #[actix_web::test] async fn health_check() { let server = Box::pin(mk_service()).await; let client = AppClient::guest(); assert_eq!(client.health(&server).await, "health is good"); }
64
hyperswitch
crates/router/tests/payments.rs
.rs
#![allow( clippy::expect_used, clippy::unwrap_in_result, clippy::unwrap_used, clippy::print_stdout )] mod utils; use std::{borrow::Cow, sync::Arc}; use common_utils::{id_type, types::MinorUnit}; use router::{ configs, core::payments, db::StorageImpl, routes, services, types::{ ...
6,224
hyperswitch
crates/router/tests/webhooks.rs
.rs
// use std::sync; // use router::{configs::settings, connection, core::webhooks, types::api}; // mod utils; // fn get_config() -> settings::Settings { // settings::Settings::new().expect("Settings") // } // struct TestApp { // redis_conn: connection::RedisPool, // } // impl TestApp { // async fn init() ...
394