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/kgraph_utils/src/transformers.rs
.rs
use api_models::enums as api_enums; use euclid::{ backend::BackendInput, dirval, dssa::types::AnalysisErrorType, frontend::{ast, dir}, types::{NumValue, StrValue}, }; use crate::error::KgraphError; pub trait IntoContext { fn into_context(self) -> Result<Vec<dir::DirValue>, KgraphError>; } imp...
12,357
hyperswitch
crates/kgraph_utils/src/types.rs
.rs
use std::collections::{HashMap, HashSet}; use api_models::enums as api_enums; use serde::Deserialize; #[derive(Debug, Deserialize, Clone, Default)] pub struct CountryCurrencyFilter { pub connector_configs: HashMap<api_enums::RoutableConnectors, PaymentMethodFilters>, pub default_configs: Option<PaymentMethodF...
261
hyperswitch
crates/kgraph_utils/src/lib.rs
.rs
pub mod error; pub mod mca; pub mod transformers; pub mod types;
17
hyperswitch
crates/kgraph_utils/src/error.rs
.rs
#[cfg(feature = "v2")] use common_enums::connector_enums; use euclid::{dssa::types::AnalysisErrorType, frontend::dir}; #[derive(Debug, thiserror::Error, serde::Serialize)] #[serde(tag = "type", content = "info", rename_all = "snake_case")] pub enum KgraphError { #[error("Invalid connector name encountered: '{0}'")]...
205
hyperswitch
crates/external_services/Cargo.toml
.toml
[package] name = "external_services" description = "Interactions of the router with external systems" version = "0.1.0" edition.workspace = true rust-version.workspace = true readme = "README.md" license.workspace = true [features] aws_kms = ["dep:aws-config", "dep:aws-sdk-kms"] email = ["dep:aws-config"] aws_s3 = ["d...
774
hyperswitch
crates/external_services/build.rs
.rs
#[allow(clippy::expect_used)] fn main() -> Result<(), Box<dyn std::error::Error>> { #[cfg(feature = "dynamic_routing")] { // Get the directory of the current crate let proto_path = router_env::workspace_path().join("proto"); let success_rate_proto_file = proto_path.join("success_rate.pr...
219
hyperswitch
crates/external_services/README.md
.md
# External Services This crate includes interactions with external systems, which may be shared across crates within this workspace.
24
hyperswitch
crates/external_services/src/email.rs
.rs
//! Interactions with the AWS SES SDK use aws_sdk_sesv2::types::Body; use common_utils::{errors::CustomResult, pii}; use serde::Deserialize; /// Implementation of aws ses client pub mod ses; /// Implementation of SMTP server client pub mod smtp; /// Implementation of Email client when email support is disabled pub ...
1,306
hyperswitch
crates/external_services/src/hashicorp_vault.rs
.rs
//! Interactions with the HashiCorp Vault pub mod core; pub mod implementers;
19
hyperswitch
crates/external_services/src/managers.rs
.rs
//! Config and client managers pub mod encryption_management; pub mod secrets_management;
16
hyperswitch
crates/external_services/src/file_storage.rs
.rs
//! Module for managing file storage operations with support for multiple storage schemes. use std::{ fmt::{Display, Formatter}, sync::Arc, }; use common_utils::errors::CustomResult; /// Includes functionality for AWS S3 storage operations. #[cfg(feature = "aws_s3")] mod aws_s3; mod file_system; /// Enum r...
694
hyperswitch
crates/external_services/src/grpc_client.rs
.rs
/// Dyanimc Routing Client interface implementation #[cfg(feature = "dynamic_routing")] pub mod dynamic_routing; /// gRPC based Heath Check Client interface implementation #[cfg(feature = "dynamic_routing")] pub mod health_check_client; use std::{fmt::Debug, sync::Arc}; #[cfg(feature = "dynamic_routing")] use common_u...
1,034
hyperswitch
crates/external_services/src/lib.rs
.rs
//! Interactions with external systems. #![warn(missing_docs, missing_debug_implementations)] #[cfg(feature = "email")] pub mod email; #[cfg(feature = "aws_kms")] pub mod aws_kms; pub mod file_storage; #[cfg(feature = "hashicorp-vault")] pub mod hashicorp_vault; pub mod no_encryption; /// Building grpc clients to...
362
hyperswitch
crates/external_services/src/aws_kms.rs
.rs
//! Interactions with the AWS KMS SDK pub mod core; pub mod implementers;
19
hyperswitch
crates/external_services/src/no_encryption.rs
.rs
//! No encryption functionalities pub mod core; pub mod implementers;
14
hyperswitch
crates/external_services/src/grpc_client/dynamic_routing.rs
.rs
/// Module for Contract based routing pub mod contract_routing_client; use std::fmt::Debug; use common_utils::errors::CustomResult; use router_env::logger; use serde; /// Elimination Routing Client Interface Implementation pub mod elimination_based_client; /// Success Routing Client Interface Implementation pub mod s...
774
hyperswitch
crates/external_services/src/grpc_client/health_check_client.rs
.rs
use std::{collections::HashMap, fmt::Debug}; use api_models::health_check::{HealthCheckMap, HealthCheckServices}; use common_utils::{errors::CustomResult, ext_traits::AsyncExt}; use error_stack::ResultExt; pub use health_check::{ health_check_response::ServingStatus, health_client::HealthClient, HealthCheckRequest...
997
hyperswitch
crates/external_services/src/grpc_client/dynamic_routing/success_rate_client.rs
.rs
use api_models::routing::{ CurrentBlockThreshold, RoutableConnectorChoice, RoutableConnectorChoiceWithStatus, SuccessBasedRoutingConfig, SuccessBasedRoutingConfigBody, SuccessRateSpecificityLevel, }; use common_utils::{ext_traits::OptionExt, transformers::ForeignTryFrom}; use error_stack::ResultExt; use router_...
2,275
hyperswitch
crates/external_services/src/grpc_client/dynamic_routing/contract_routing_client.rs
.rs
use api_models::routing::{ ContractBasedRoutingConfig, ContractBasedRoutingConfigBody, ContractBasedTimeScale, LabelInformation, RoutableConnectorChoice, RoutableConnectorChoiceWithStatus, }; use common_utils::{ ext_traits::OptionExt, transformers::{ForeignFrom, ForeignTryFrom}, }; pub use contract_rout...
1,333
hyperswitch
crates/external_services/src/grpc_client/dynamic_routing/elimination_based_client.rs
.rs
use api_models::routing::{ EliminationAnalyserConfig as EliminationConfig, RoutableConnectorChoice, RoutableConnectorChoiceWithBucketName, }; use common_utils::{ext_traits::OptionExt, transformers::ForeignTryFrom}; pub use elimination_rate::{ elimination_analyser_client::EliminationAnalyserClient, Eliminati...
1,273
hyperswitch
crates/external_services/src/managers/secrets_management.rs
.rs
//! Secrets management util module use common_utils::errors::CustomResult; #[cfg(feature = "hashicorp-vault")] use error_stack::ResultExt; use hyperswitch_interfaces::secrets_interface::{ SecretManagementInterface, SecretsManagementError, }; #[cfg(feature = "aws_kms")] use crate::aws_kms; #[cfg(feature = "hashico...
565
hyperswitch
crates/external_services/src/managers/encryption_management.rs
.rs
//! Encryption management util module use std::sync::Arc; use common_utils::errors::CustomResult; use hyperswitch_interfaces::encryption_interface::{ EncryptionError, EncryptionManagementInterface, }; #[cfg(feature = "aws_kms")] use crate::aws_kms; use crate::no_encryption::core::NoEncryption; /// Enum represen...
359
hyperswitch
crates/external_services/src/hashicorp_vault/core.rs
.rs
//! Interactions with the HashiCorp Vault use std::{collections::HashMap, future::Future, pin::Pin}; use common_utils::{ext_traits::ConfigExt, fp_utils::when}; use error_stack::{Report, ResultExt}; use masking::{PeekInterface, Secret}; use vaultrs::client::{VaultClient, VaultClientSettingsBuilder}; static HC_CLIENT:...
1,832
hyperswitch
crates/external_services/src/hashicorp_vault/implementers.rs
.rs
//! Trait implementations for Hashicorp vault client use common_utils::errors::CustomResult; use error_stack::ResultExt; use hyperswitch_interfaces::secrets_interface::{ SecretManagementInterface, SecretsManagementError, }; use masking::{ExposeInterface, Secret}; use crate::hashicorp_vault::core::{HashiCorpVault,...
176
hyperswitch
crates/external_services/src/email/ses.rs
.rs
use std::time::{Duration, SystemTime}; use aws_sdk_sesv2::{ config::Region, operation::send_email::SendEmailError, types::{Body, Content, Destination, EmailContent, Message}, Client, }; use aws_sdk_sts::config::Credentials; use aws_smithy_runtime::client::http::hyper_014::HyperClientBuilder; use common...
1,812
hyperswitch
crates/external_services/src/email/smtp.rs
.rs
use std::time::Duration; use common_utils::{errors::CustomResult, pii}; use error_stack::ResultExt; use lettre::{ address::AddressError, error, message::{header::ContentType, Mailbox}, transport::smtp::{self, authentication::Credentials}, Message, SmtpTransport, Transport, }; use masking::{PeekInte...
1,442
hyperswitch
crates/external_services/src/email/no_email.rs
.rs
use common_utils::{errors::CustomResult, pii}; use router_env::logger; use crate::email::{EmailClient, EmailError, EmailResult, IntermediateString}; /// Client when email support is disabled #[derive(Debug, Clone, Default, serde::Deserialize)] pub struct NoEmailClient {} impl NoEmailClient { /// Constructs a new...
237
hyperswitch
crates/external_services/src/aws_kms/core.rs
.rs
//! Interactions with the AWS KMS SDK use std::time::Instant; use aws_config::meta::region::RegionProviderChain; use aws_sdk_kms::{config::Region, primitives::Blob, Client}; use base64::Engine; use common_utils::errors::CustomResult; use error_stack::{report, ResultExt}; use router_env::logger; use crate::{consts, m...
1,798
hyperswitch
crates/external_services/src/aws_kms/implementers.rs
.rs
//! Trait implementations for aws kms client use common_utils::errors::CustomResult; use error_stack::ResultExt; use hyperswitch_interfaces::{ encryption_interface::{EncryptionError, EncryptionManagementInterface}, secrets_interface::{SecretManagementInterface, SecretsManagementError}, }; use masking::{PeekInt...
289
hyperswitch
crates/external_services/src/file_storage/aws_s3.rs
.rs
use aws_config::meta::region::RegionProviderChain; use aws_sdk_s3::{ operation::{ delete_object::DeleteObjectError, get_object::GetObjectError, put_object::PutObjectError, }, Client, }; use aws_sdk_sts::config::Region; use common_utils::{errors::CustomResult, ext_traits::ConfigExt}; use error_stack:...
1,172
hyperswitch
crates/external_services/src/file_storage/file_system.rs
.rs
//! Module for local file system storage operations use std::{ fs::{remove_file, File}, io::{Read, Write}, path::PathBuf, }; use common_utils::errors::CustomResult; use error_stack::ResultExt; use crate::file_storage::{FileStorageError, FileStorageInterface}; /// Constructs the file path for a given fil...
974
hyperswitch
crates/external_services/src/no_encryption/core.rs
.rs
//! No encryption core functionalities /// No encryption type #[derive(Debug, Clone)] pub struct NoEncryption; impl NoEncryption { /// Encryption functionality pub fn encrypt(&self, data: impl AsRef<[u8]>) -> Vec<u8> { data.as_ref().into() } /// Decryption functionality pub fn decrypt(&se...
102
hyperswitch
crates/external_services/src/no_encryption/implementers.rs
.rs
//! Trait implementations for No encryption client use common_utils::errors::CustomResult; use error_stack::ResultExt; use hyperswitch_interfaces::{ encryption_interface::{EncryptionError, EncryptionManagementInterface}, secrets_interface::{SecretManagementInterface, SecretsManagementError}, }; use masking::{E...
251
hyperswitch
crates/masking/Cargo.toml
.toml
[package] name = "masking" description = "Personal Identifiable Information protection. Wrapper types and traits for secret management which help ensure they aren't accidentally copied, logged, or otherwise exposed (as much as possible), and also ensure secrets are securely wiped from memory when dropped." version = "0...
423
hyperswitch
crates/masking/README.md
.md
# Masking Personal Identifiable Information protection. Wrapper types and traits for secret management which help ensure they aren't accidentally copied, logged, or otherwise exposed (as much as possible), and also ensure secrets are securely wiped from memory when dropped. Secret-keeping library inspired by `secrecy`...
507
hyperswitch
crates/masking/tests/basic.rs
.rs
#![allow(dead_code, clippy::unwrap_used, clippy::panic_in_result_fn)] use masking::Secret; #[cfg(feature = "serde")] use masking::SerializableSecret; #[cfg(feature = "alloc")] use masking::ZeroizableSecret; #[cfg(feature = "serde")] use serde::Serialize; #[test] fn basic() -> Result<(), Box<dyn std::error::Error + Se...
1,027
hyperswitch
crates/masking/src/vec.rs
.rs
//! Secret `Vec` types //! //! There is not alias type by design. #[cfg(feature = "serde")] use super::{SerializableSecret, Serialize}; #[cfg(feature = "serde")] impl<S: Serialize> SerializableSecret for Vec<S> {}
51
hyperswitch
crates/masking/src/boxed.rs
.rs
//! `Box` types containing secrets //! //! There is not alias type by design. #[cfg(feature = "serde")] use super::{SerializableSecret, Serialize}; #[cfg(feature = "serde")] impl<S: Serialize> SerializableSecret for Box<S> {}
52
hyperswitch
crates/masking/src/serde.rs
.rs
//! Serde-related. pub use erased_serde::Serialize as ErasedSerialize; pub use serde::{de, Deserialize, Serialize, Serializer}; use serde_json::{value::Serializer as JsonValueSerializer, Value}; use crate::{Secret, Strategy, StrongSecret, ZeroizableSecret}; /// Marker trait for secret types which can be [`Serialize`...
3,935
hyperswitch
crates/masking/src/strong_secret.rs
.rs
//! Structure describing secret. use std::{fmt, marker::PhantomData}; use subtle::ConstantTimeEq; use zeroize::{self, Zeroize as ZeroizableSecret}; use crate::{strategy::Strategy, PeekInterface}; /// Secret thing. /// /// To get access to value use method `expose()` of trait [`crate::ExposeInterface`]. pub struct S...
824
hyperswitch
crates/masking/src/cassandra.rs
.rs
use scylla::{ deserialize::DeserializeValue, frame::response::result::ColumnType, serialize::{ value::SerializeValue, writers::{CellWriter, WrittenCellProof}, SerializationError, }, }; use crate::{abs::PeekInterface, StrongSecret}; impl<T> SerializeValue for StrongSecret<T> whe...
286
hyperswitch
crates/masking/src/abs.rs
.rs
//! Abstract data types. use crate::Secret; /// Interface to expose a reference to an inner secret pub trait PeekInterface<S> { /// Only method providing access to the secret value. fn peek(&self) -> &S; /// Provide a mutable reference to the inner value. fn peek_mut(&mut self) -> &mut S; } /// Inte...
409
hyperswitch
crates/masking/src/maskable.rs
.rs
//! This module contains Masking objects and traits use crate::{ExposeInterface, Secret}; /// An Enum that allows us to optionally mask data, based on which enum variant that data is stored /// in. #[derive(Clone, Eq, PartialEq)] pub enum Maskable<T: Eq + PartialEq + Clone> { /// Variant which masks the data by w...
779
hyperswitch
crates/masking/src/string.rs
.rs
//! Secret strings //! //! There is not alias type by design. use alloc::{ str::FromStr, string::{String, ToString}, }; #[cfg(feature = "serde")] use super::SerializableSecret; use super::{Secret, Strategy}; use crate::StrongSecret; #[cfg(feature = "serde")] impl SerializableSecret for String {} impl<I> Fro...
195
hyperswitch
crates/masking/src/lib.rs
.rs
#![cfg_attr(docsrs, feature(doc_auto_cfg, doc_cfg_hide))] #![cfg_attr(docsrs, doc(cfg_hide(doc)))] #![warn(missing_docs)] //! Personal Identifiable Information protection. Wrapper types and traits for secret management which help ensure they aren't accidentally copied, logged, or otherwise exposed (as much as possible...
372
hyperswitch
crates/masking/src/secret.rs
.rs
//! Structure describing secret. use std::{fmt, marker::PhantomData}; use crate::{strategy::Strategy, PeekInterface, StrongSecret}; /// Secret thing. /// /// To get access to value use method `expose()` of trait [`crate::ExposeInterface`]. /// /// ## Masking /// Use the [`crate::strategy::Strategy`] trait to impleme...
1,143
hyperswitch
crates/masking/src/bytes.rs
.rs
//! Optional `Secret` wrapper type for the `bytes::BytesMut` crate. use core::fmt; use bytes::BytesMut; #[cfg(all(feature = "bytes", feature = "serde"))] use serde::de::{self, Deserialize}; use super::{PeekInterface, ZeroizableSecret}; /// Instance of [`BytesMut`] protected by a type that impls the [`ExposeInterfac...
711
hyperswitch
crates/masking/src/diesel.rs
.rs
//! Diesel-related. use diesel::{ backend::Backend, deserialize::{self, FromSql, Queryable}, expression::AsExpression, internal::derives::as_expression::Bound, serialize::{self, Output, ToSql}, sql_types, }; use crate::{Secret, Strategy, StrongSecret, ZeroizableSecret}; impl<S, I, T> AsExpres...
1,019
hyperswitch
crates/masking/src/strategy.rs
.rs
use core::fmt; /// Debugging trait which is specialized for handling secret values pub trait Strategy<T> { /// Format information about the secret's type. fn fmt(value: &T, fmt: &mut fmt::Formatter<'_>) -> fmt::Result; } /// Debug with type #[cfg_attr(feature = "serde", derive(serde::Deserialize))] #[derive(D...
206
hyperswitch
crates/hyperswitch_constraint_graph/Cargo.toml
.toml
[package] name = "hyperswitch_constraint_graph" description = "Constraint Graph Framework for modeling Domain-Specific Constraints" version = "0.1.0" edition.workspace = true rust-version.workspace = true [features] viz = ["dep:graphviz-rust"] [dependencies] erased-serde = "0.3.28" graphviz-rust = { version = "0.6.2"...
164
hyperswitch
crates/hyperswitch_constraint_graph/src/graph.rs
.rs
use std::sync::{Arc, Weak}; use rustc_hash::{FxHashMap, FxHashSet}; use crate::{ builder, dense_map::DenseMap, error::{self, AnalysisTrace, GraphError}, types::{ CheckingContext, CycleCheck, DomainId, DomainIdentifier, DomainInfo, Edge, EdgeId, Memoization, Metadata, Node, NodeId, Node...
5,106
hyperswitch
crates/hyperswitch_constraint_graph/src/types.rs
.rs
use std::{ any::Any, fmt, hash, ops::{Deref, DerefMut}, sync::Arc, }; use rustc_hash::{FxHashMap, FxHashSet}; use crate::{dense_map::impl_entity, error::AnalysisTrace}; pub trait KeyNode: fmt::Debug + Clone + hash::Hash + serde::Serialize + PartialEq + Eq {} pub trait ValueNode: fmt::Debug + Clone +...
1,439
hyperswitch
crates/hyperswitch_constraint_graph/src/builder.rs
.rs
use std::sync::Arc; use rustc_hash::{FxHashMap, FxHashSet}; use crate::{ dense_map::DenseMap, error::GraphError, graph::ConstraintGraph, types::{ DomainId, DomainIdentifier, DomainInfo, Edge, EdgeId, Metadata, Node, NodeId, NodeType, NodeValue, Relation, Strength, ValueNode, }, }; ...
1,988
hyperswitch
crates/hyperswitch_constraint_graph/src/lib.rs
.rs
pub mod builder; mod dense_map; pub mod error; pub mod graph; pub mod types; pub use builder::ConstraintGraphBuilder; pub use error::{AnalysisTrace, GraphError}; pub use graph::ConstraintGraph; #[cfg(feature = "viz")] pub use types::NodeViz; pub use types::{ CheckingContext, CycleCheck, DomainId, DomainIdentifier,...
105
hyperswitch
crates/hyperswitch_constraint_graph/src/error.rs
.rs
use std::sync::{Arc, Weak}; use crate::types::{Metadata, NodeValue, Relation, RelationResolution, ValueNode}; #[derive(Debug, Clone, serde::Serialize)] #[serde(tag = "type", content = "predecessor", rename_all = "snake_case")] pub enum ValueTracePredecessor<V: ValueNode> { Mandatory(Box<Weak<AnalysisTrace<V>>>), ...
587
hyperswitch
crates/hyperswitch_constraint_graph/src/dense_map.rs
.rs
use std::{fmt, iter, marker::PhantomData, ops, slice, vec}; pub trait EntityId { fn get_id(&self) -> usize; fn with_id(id: usize) -> Self; } macro_rules! impl_entity { ($name:ident) => { impl $crate::dense_map::EntityId for $name { #[inline] fn get_id(&self) -> usize { ...
1,406
hyperswitch
crates/router_derive/Cargo.toml
.toml
[package] name = "router_derive" description = "Utility macros for the `router` crate" version = "0.1.0" edition.workspace = true rust-version.workspace = true readme = "README.md" license.workspace = true [lib] proc-macro = true doctest = false [dependencies] indexmap = "2.2.6" proc-macro2 = "1.0.79" quote = "1.0.35...
277
hyperswitch
crates/router_derive/README.md
.md
# `router_derive` Utility macros for the `router` crate.
15
hyperswitch
crates/router_derive/src/lib.rs
.rs
//! Utility macros for the `router` crate. #![warn(missing_docs)] use syn::parse_macro_input; use crate::macros::diesel::DieselEnumMeta; mod macros; /// Uses the [`Debug`][Debug] implementation of a type to derive its [`Display`][Display] /// implementation. /// /// Causes a compilation error if the type doesn't impl...
5,911
hyperswitch
crates/router_derive/src/macros.rs
.rs
pub(crate) mod api_error; pub(crate) mod diesel; pub(crate) mod generate_permissions; pub(crate) mod generate_schema; pub(crate) mod misc; pub(crate) mod operation; pub(crate) mod to_encryptable; pub(crate) mod try_get_enum; mod helpers; use proc_macro2::TokenStream; use quote::quote; use syn::DeriveInput; pub(crate...
282
hyperswitch
crates/router_derive/src/macros/api_error.rs
.rs
mod helpers; use std::collections::HashMap; use proc_macro2::TokenStream; use quote::quote; use syn::{ punctuated::Punctuated, token::Comma, Data, DeriveInput, Fields, Ident, ImplGenerics, TypeGenerics, Variant, WhereClause, }; use crate::macros::{ api_error::helpers::{ check_missing_attributes, ...
2,061
hyperswitch
crates/router_derive/src/macros/generate_schema.rs
.rs
use std::collections::{HashMap, HashSet}; use indexmap::IndexMap; use syn::{self, parse::Parse, parse_quote, punctuated::Punctuated, Token}; use crate::macros::helpers; /// Parse schemas from attribute /// Example /// /// #[mandatory_in(PaymentsCreateRequest, PaymentsUpdateRequest)] /// would return /// /// [Payment...
1,923
hyperswitch
crates/router_derive/src/macros/try_get_enum.rs
.rs
use proc_macro2::Span; use quote::ToTokens; use syn::{parse::Parse, punctuated::Punctuated}; mod try_get_keyword { use syn::custom_keyword; custom_keyword!(error_type); } #[derive(Debug)] pub struct TryGetEnumMeta { error_type: syn::Ident, variant: syn::Ident, } impl Parse for TryGetEnumMeta { f...
859
hyperswitch
crates/router_derive/src/macros/to_encryptable.rs
.rs
use std::iter::Iterator; use quote::{format_ident, quote}; use syn::{parse::Parse, punctuated::Punctuated, token::Comma, Field, Ident, Type as SynType}; use crate::macros::{helpers::get_struct_fields, misc::get_field_type}; pub struct FieldMeta { _meta_type: Ident, pub value: Ident, } impl Parse for FieldMe...
2,534
hyperswitch
crates/router_derive/src/macros/helpers.rs
.rs
use proc_macro2::Span; use quote::ToTokens; use syn::{parse::Parse, punctuated::Punctuated, spanned::Spanned, Attribute, Token}; pub fn non_enum_error() -> syn::Error { syn::Error::new(Span::call_site(), "This macro only supports enums.") } pub(super) fn occurrence_error<T: ToTokens>( first_keyword: T, se...
490
hyperswitch
crates/router_derive/src/macros/operation.rs
.rs
use std::str::FromStr; use proc_macro2::{Span, TokenStream}; use quote::{quote, ToTokens}; use strum::IntoEnumIterator; use syn::{self, parse::Parse, DeriveInput}; use crate::macros::helpers; #[derive(Debug, Clone, Copy, strum::EnumString, strum::EnumIter, strum::Display)] #[strum(serialize_all = "snake_case")] pub ...
3,384
hyperswitch
crates/router_derive/src/macros/misc.rs
.rs
pub fn get_field_type(field_type: syn::Type) -> Option<syn::Ident> { if let syn::Type::Path(path) = field_type { path.path .segments .last() .map(|last_path_segment| last_path_segment.ident.to_owned()) } else { None } } /// Implement the `validate` functi...
511
hyperswitch
crates/router_derive/src/macros/generate_permissions.rs
.rs
use proc_macro::TokenStream; use quote::{format_ident, quote}; use syn::{ braced, bracketed, parse::{Parse, ParseBuffer, ParseStream}, parse_macro_input, punctuated::Punctuated, token::Comma, Ident, Token, }; struct ResourceInput { resource_name: Ident, scopes: Punctuated<Ident, Token![...
887
hyperswitch
crates/router_derive/src/macros/diesel.rs
.rs
use proc_macro2::{Span, TokenStream}; use quote::{format_ident, quote, ToTokens}; use syn::{parse::Parse, Data, DeriveInput, ItemEnum}; use crate::macros::helpers; pub(crate) fn diesel_enum_text_derive_inner(ast: &DeriveInput) -> syn::Result<TokenStream> { let name = &ast.ident; let (impl_generics, ty_generic...
1,740
hyperswitch
crates/router_derive/src/macros/api_error/helpers.rs
.rs
use proc_macro2::TokenStream; use quote::ToTokens; use syn::{ parse::Parse, spanned::Spanned, DeriveInput, Field, Fields, LitStr, Token, TypePath, Variant, }; use crate::macros::helpers::{get_metadata_inner, occurrence_error}; mod keyword { use syn::custom_keyword; // Enum metadata custom_keyword!(er...
1,826
hyperswitch
crates/payment_methods/Cargo.toml
.toml
[package] name = "payment_methods" version = "0.1.0" edition.workspace = true rust-version.workspace = true license.workspace = true [dependencies] async-trait = "0.1.79" dyn-clone = "1.0.17" common_utils = { version = "0.1.0", path = "../common_utils", features = ["signals", "async_ext", "logs", "metrics", "keymanag...
244
hyperswitch
crates/payment_methods/src/lib.rs
.rs
pub mod state;
4
hyperswitch
crates/payment_methods/src/state.rs
.rs
#[cfg(all( any(feature = "v1", feature = "v2"), not(feature = "payment_methods_v2") ))] use common_utils::errors::CustomResult; use common_utils::types::keymanager::KeyManagerState; #[cfg(all( any(feature = "v1", feature = "v2"), not(feature = "payment_methods_v2") ))] use hyperswitch_domain_models::{ ...
570
hyperswitch
crates/config_importer/Cargo.toml
.toml
[package] name = "config_importer" description = "Utility to convert a TOML configuration file to a list of environment variables" version = "0.1.0" edition.workspace = true rust-version.workspace = true readme = "README.md" license.workspace = true [package.metadata.docs.rs] all-features = true rustdoc-args = ["--cfg...
248
hyperswitch
crates/config_importer/README.md
.md
# config_importer A simple utility tool to import a Hyperswitch TOML configuration file, convert it into environment variable key-value pairs, and export it in the specified format. As of now, it supports only exporting the environment variables to a JSON format compatible with Kubernetes, but it can be easily extende...
323
hyperswitch
crates/config_importer/src/main.rs
.rs
mod cli; use std::io::{BufWriter, Write}; use anyhow::Context; /// The separator used in environment variable names. const ENV_VAR_SEPARATOR: &str = "__"; #[cfg(not(feature = "preserve_order"))] type EnvironmentVariableMap = std::collections::HashMap<String, String>; #[cfg(feature = "preserve_order")] type Environ...
841
hyperswitch
crates/config_importer/src/cli.rs
.rs
use std::path::PathBuf; /// Utility to import a hyperswitch TOML configuration file, convert it into environment variable /// key-value pairs, and export it in the specified format. #[derive(clap::Parser, Debug)] #[command(arg_required_else_help = true)] pub(crate) struct Args { /// Input TOML configuration file. ...
319
hyperswitch
crates/hyperswitch_domain_models/Cargo.toml
.toml
[package] name = "hyperswitch_domain_models" description = "Represents the data/domain models used by the business layer" version = "0.1.0" edition.workspace = true rust-version.workspace = true readme = "README.md" license.workspace = true [features] default = ["olap", "frm"] encryption_service = [] olap = [] payouts...
644
hyperswitch
crates/hyperswitch_domain_models/README.md
.md
# Hyperswitch domain models Represents the data/domain models used by the business/domain layer
19
hyperswitch
crates/hyperswitch_domain_models/src/behaviour.rs
.rs
use common_utils::{ errors::{CustomResult, ValidationError}, types::keymanager::{Identifier, KeyManagerState}, }; use masking::Secret; /// Trait for converting domain types to storage models #[async_trait::async_trait] pub trait Conversion { type DstType; type NewDstType; async fn convert(self) -> ...
305
hyperswitch
crates/hyperswitch_domain_models/src/network_tokenization.rs
.rs
#[cfg(all( any(feature = "v1", feature = "v2"), not(feature = "payment_methods_v2") ))] use cards::CardNumber; #[cfg(all(feature = "v2", feature = "payment_methods_v2"))] use cards::{CardNumber, NetworkToken}; #[cfg(all( any(feature = "v1", feature = "v2"), not(feature = "payment_methods_v2") ))] pub t...
127
hyperswitch
crates/hyperswitch_domain_models/src/merchant_account.rs
.rs
use common_utils::{ crypto::{OptionalEncryptableName, OptionalEncryptableValue}, date_time, encryption::Encryption, errors::{CustomResult, ValidationError}, ext_traits::ValueExt, pii, type_name, types::keymanager::{self}, }; use diesel_models::{ enums::MerchantStorageScheme, merchant_acc...
6,402
hyperswitch
crates/hyperswitch_domain_models/src/router_flow_types.rs
.rs
pub mod access_token_auth; pub mod authentication; pub mod dispute; pub mod files; pub mod fraud_check; pub mod mandate_revoke; pub mod payments; pub mod payouts; pub mod refunds; pub mod revenue_recovery; pub mod unified_authentication_service; pub mod webhooks; pub use access_token_auth::*; pub use dispute::*; pub u...
104
hyperswitch
crates/hyperswitch_domain_models/src/type_encryption.rs
.rs
use async_trait::async_trait; use common_utils::{ crypto, encryption::Encryption, errors::{self, CustomResult}, ext_traits::AsyncExt, metrics::utils::record_operation_time, types::keymanager::{Identifier, KeyManagerState}, }; use encrypt::TypeEncryption; use masking::Secret; use router_env::{ins...
10,781
hyperswitch
crates/hyperswitch_domain_models/src/disputes.rs
.rs
use crate::errors; pub struct DisputeListConstraints { pub dispute_id: Option<String>, pub payment_id: Option<common_utils::id_type::PaymentId>, pub limit: Option<u32>, pub offset: Option<u32>, pub profile_id: Option<Vec<common_utils::id_type::ProfileId>>, pub dispute_status: Option<Vec<common_...
731
hyperswitch
crates/hyperswitch_domain_models/src/api.rs
.rs
use std::{collections::HashSet, fmt::Display}; use common_utils::{ events::{ApiEventMetric, ApiEventsType}, impl_api_event_type, }; use super::payment_method_data::PaymentMethodData; #[derive(Debug, Eq, PartialEq)] pub enum ApplicationResponse<R> { Json(R), StatusOk, TextPlain(String), JsonFo...
977
hyperswitch
crates/hyperswitch_domain_models/src/bulk_tokenization.rs
.rs
use api_models::{payment_methods as payment_methods_api, payments as payments_api}; use cards::CardNumber; use common_enums as enums; use common_utils::{ errors, ext_traits::OptionExt, id_type, pii, transformers::{ForeignFrom, ForeignTryFrom}, }; use error_stack::report; use crate::{ address::{Addr...
2,443
hyperswitch
crates/hyperswitch_domain_models/src/relay.rs
.rs
use common_enums::enums; use common_utils::{ self, errors::{CustomResult, ValidationError}, id_type::{self, GenerateId}, pii, types::{keymanager, MinorUnit}, }; use diesel_models::relay::RelayUpdateInternal; use error_stack::ResultExt; use masking::{ExposeInterface, Secret}; use serde::{self, Deseri...
2,125
hyperswitch
crates/hyperswitch_domain_models/src/router_data.rs
.rs
use std::{collections::HashMap, marker::PhantomData}; use common_types::primitive_wrappers; use common_utils::{ errors::IntegrityCheckError, ext_traits::{OptionExt, ValueExt}, id_type, types::MinorUnit, }; use error_stack::ResultExt; use masking::{ExposeInterface, Secret}; use crate::{ network_tok...
11,087
hyperswitch
crates/hyperswitch_domain_models/src/payment_method_data.rs
.rs
use api_models::{ mandates, payment_methods::{self}, payments::{ additional_info as payment_additional_types, AmazonPayRedirectData, ExtendedCardInfo, }, }; use common_enums::enums as api_enums; #[cfg(feature = "v2")] use common_utils::ext_traits::OptionExt; use common_utils::{ id_type, ...
17,798
hyperswitch
crates/hyperswitch_domain_models/src/payments.rs
.rs
#[cfg(feature = "v2")] use std::marker::PhantomData; #[cfg(feature = "v2")] use api_models::payments::SessionToken; use common_types::primitive_wrappers::{ AlwaysRequestExtendedAuthorization, RequestExtendedAuthorizationBool, }; #[cfg(feature = "v2")] use common_utils::ext_traits::OptionExt; use common_utils::{ ...
8,694
hyperswitch
crates/hyperswitch_domain_models/src/address.rs
.rs
use masking::{PeekInterface, Secret}; #[derive(Default, Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize)] pub struct Address { pub address: Option<AddressDetails>, pub phone: Option<PhoneDetails>, pub email: Option<common_utils::pii::Email>, } impl masking::SerializableSecret for Address...
1,201
hyperswitch
crates/hyperswitch_domain_models/src/callback_mapper.rs
.rs
use common_utils::pii; use serde::{self, Deserialize, Serialize}; #[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] pub struct CallbackMapper { pub id: String, #[serde(rename = "type")] pub type_: String, pub data: pii::SecretSerdeValue, pub created_at: time::PrimitiveDateTime, pub...
87
hyperswitch
crates/hyperswitch_domain_models/src/mandates.rs
.rs
use std::collections::HashMap; use api_models::payments::{ AcceptanceType as ApiAcceptanceType, CustomerAcceptance as ApiCustomerAcceptance, MandateAmountData as ApiMandateAmountData, MandateData as ApiMandateData, MandateType, OnlineMandate as ApiOnlineMandate, }; use common_enums::Currency; use common_ut...
4,506
hyperswitch
crates/hyperswitch_domain_models/src/routing.rs
.rs
use std::collections::HashMap; use api_models::{enums as api_enums, routing}; use serde; #[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] pub struct RoutingData { pub routed_through: Option<String>, pub merchant_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>, pub ro...
491
hyperswitch
crates/hyperswitch_domain_models/src/customer.rs
.rs
#[cfg(all(feature = "v2", feature = "customer_v2"))] use common_enums::DeleteStatus; use common_utils::{ crypto::{self, Encryptable}, date_time, encryption::Encryption, errors::{CustomResult, ValidationError}, id_type, pii, types::{ keymanager::{self, KeyManagerState, ToEncryptable}, ...
3,787
hyperswitch
crates/hyperswitch_domain_models/src/revenue_recovery.rs
.rs
use api_models::{payments as api_payments, webhooks}; use common_enums::enums as common_enums; use common_utils::{id_type, types as util_types}; use time::PrimitiveDateTime; use crate::router_response_types::revenue_recovery::BillingConnectorPaymentsSyncResponse; /// Recovery payload is unified struct constructed fro...
2,482
hyperswitch
crates/hyperswitch_domain_models/src/router_response_types.rs
.rs
pub mod disputes; pub mod fraud_check; pub mod revenue_recovery; use std::collections::HashMap; use common_utils::{request::Method, types::MinorUnit}; pub use disputes::{AcceptDisputeResponse, DefendDisputeResponse, SubmitEvidenceResponse}; use crate::{ errors::api_error_response::ApiErrorResponse, router_req...
3,980
hyperswitch
crates/hyperswitch_domain_models/src/payment_address.rs
.rs
use crate::address::Address; #[derive(Clone, Default, Debug)] pub struct PaymentAddress { shipping: Option<Address>, billing: Option<Address>, unified_payment_method_billing: Option<Address>, payment_method_billing: Option<Address>, } impl PaymentAddress { pub fn new( shipping: Option<Addr...
735
hyperswitch
crates/hyperswitch_domain_models/src/consts.rs
.rs
//! Constants that are used in the domain models. use std::collections::HashSet; use router_env::once_cell::sync::Lazy; pub static ROUTING_ENABLED_PAYMENT_METHODS: Lazy<HashSet<common_enums::PaymentMethod>> = Lazy::new(|| { let mut set = HashSet::new(); set.insert(common_enums::PaymentMethod::Ban...
253