repo stringlengths 6 65 | file_url stringlengths 81 311 | file_path stringlengths 6 227 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:31:58 2026-01-04 20:25:31 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/common_utils/src/lib.rs | crates/common_utils/src/lib.rs | #![warn(missing_docs, missing_debug_implementations)]
#![doc = include_str!(concat!(env!("CARGO_MANIFEST_DIR" ), "/", "README.md"))]
use masking::{ExposeInterface, PeekInterface, Secret};
pub mod access_token;
pub mod consts;
pub mod crypto;
pub mod custom_serde;
#[allow(missing_docs)] // Todo: add docs
pub mod encry... | rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/common_utils/src/access_token.rs | crates/common_utils/src/access_token.rs | //! Commonly used utilities for access token
use std::fmt::Display;
use crate::id_type;
/// Create a default key for fetching the access token from redis
pub fn get_default_access_token_key(
merchant_id: &id_type::MerchantId,
merchant_connector_id_or_connector_name: impl Display,
) -> String {
format!(
... | rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/common_utils/src/pii.rs | crates/common_utils/src/pii.rs | //! Personal Identifiable Information protection.
use std::{convert::AsRef, fmt, ops, str::FromStr};
use diesel::{
backend::Backend,
deserialize,
deserialize::FromSql,
prelude::*,
serialize::{Output, ToSql},
sql_types, AsExpression,
};
use error_stack::ResultExt;
use masking::{ExposeInterface,... | rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/common_utils/src/ext_traits.rs | crates/common_utils/src/ext_traits.rs | //! This module holds traits for extending functionalities for existing datatypes
//! & inbuilt datatypes.
use error_stack::ResultExt;
use masking::{ExposeInterface, PeekInterface, Secret, Strategy};
use quick_xml::de;
#[cfg(all(feature = "logs", feature = "async_ext"))]
use router_env::logger;
use serde::{Deserialize... | rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/common_utils/src/ucs_types.rs | crates/common_utils/src/ucs_types.rs | use crate::id_type;
/// Represents a reference ID for the Unified Connector Service (UCS).
///
/// This enum can hold either a payment reference ID or a refund reference ID,
/// allowing for a unified way to handle different types of transaction references
/// when interacting with the UCS.
#[derive(Debug)]
pub enum U... | rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/common_utils/src/validation.rs | crates/common_utils/src/validation.rs | //! Custom validations for some shared types.
#![deny(clippy::invalid_regex)]
use std::{collections::HashSet, sync::LazyLock};
use error_stack::report;
use globset::Glob;
use regex::Regex;
#[cfg(feature = "logs")]
use router_env::logger;
use crate::errors::{CustomResult, ValidationError};
/// Validates a given pho... | rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/common_utils/src/encryption.rs | crates/common_utils/src/encryption.rs | use diesel::{
backend::Backend,
deserialize::{self, FromSql, Queryable},
expression::AsExpression,
serialize::ToSql,
sql_types,
};
use masking::Secret;
use crate::{crypto::Encryptable, pii::EncryptionStrategy};
impl<DB> FromSql<sql_types::Binary, DB> for Encryption
where
DB: Backend,
Secre... | rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/common_utils/src/id_type.rs | crates/common_utils/src/id_type.rs | //! Common ID types
//! The id type can be used to create specific id types with custom behaviour
mod api_key;
mod authentication;
mod client_secret;
mod customer;
#[cfg(feature = "v2")]
mod global_id;
mod invoice;
mod merchant;
mod merchant_connector_account;
mod organization;
mod payment;
mod payout;
mod profile;
mo... | rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/common_utils/src/new_type.rs | crates/common_utils/src/new_type.rs | //! Contains new types with restrictions
use masking::{ExposeInterface, PeekInterface, Secret};
use crate::{
consts::MAX_ALLOWED_MERCHANT_NAME_LENGTH,
pii::{Email, UpiVpaMaskingStrategy},
transformers::ForeignFrom,
};
#[nutype::nutype(
derive(Clone, Serialize, Deserialize, Debug),
validate(len_cha... | rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/common_utils/src/keymanager.rs | crates/common_utils/src/keymanager.rs | //! Consists of all the common functions to use the Keymanager.
use core::fmt::Debug;
use std::str::FromStr;
use base64::Engine;
use error_stack::ResultExt;
use http::{HeaderMap, HeaderName, HeaderValue, Method, StatusCode};
use masking::{PeekInterface, StrongSecret};
use once_cell::sync::OnceCell;
use router_env::{i... | rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/common_utils/src/types.rs | crates/common_utils/src/types.rs | //! Types that can be used in other crates
pub mod keymanager;
/// Enum for Authentication Level
pub mod authentication;
/// User related types
pub mod user;
/// types that are wrappers around primitive types
pub mod primitive_wrappers;
use std::{
borrow::Cow,
fmt::Display,
iter::Sum,
num::NonZeroI64... | rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | true |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/common_utils/src/macros.rs | crates/common_utils/src/macros.rs | //! Utility macros
#[allow(missing_docs)]
#[macro_export]
macro_rules! newtype_impl {
($is_pub:vis, $name:ident, $ty_path:path) => {
impl core::ops::Deref for $name {
type Target = $ty_path;
fn deref(&self) -> &Self::Target {
&self.0
}
}
... | rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/common_utils/src/link_utils.rs | crates/common_utils/src/link_utils.rs | //! This module has common utilities for links in HyperSwitch
use std::{collections::HashSet, primitive::i64};
use common_enums::{enums, UIWidgetFormLayout};
use diesel::{
backend::Backend,
deserialize,
deserialize::FromSql,
serialize::{Output, ToSql},
sql_types::Jsonb,
AsExpression, FromSqlRo... | rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/common_utils/src/custom_serde.rs | crates/common_utils/src/custom_serde.rs | //! Custom serialization/deserialization implementations.
/// Use the well-known ISO 8601 format when serializing and deserializing an
/// [`PrimitiveDateTime`][PrimitiveDateTime].
///
/// [PrimitiveDateTime]: ::time::PrimitiveDateTime
pub mod iso8601 {
use std::num::NonZeroU8;
use serde::{ser::Error as _, De... | rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/common_utils/src/transformers.rs | crates/common_utils/src/transformers.rs | //! Utilities for converting between foreign types
/// Trait for converting from one foreign type to another
pub trait ForeignFrom<F> {
/// Convert from a foreign type to the current type
fn foreign_from(from: F) -> Self;
}
/// Trait for converting from one foreign type to another
pub trait ForeignTryFrom<F>:... | rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/common_utils/src/events.rs | crates/common_utils/src/events.rs | use serde::Serialize;
use crate::{id_type, types::TimeRange};
pub trait ApiEventMetric {
fn get_api_event_type(&self) -> Option<ApiEventsType> {
None
}
}
#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
#[serde(tag = "flow_type", rename_all = "snake_case")]
pub enum ApiEventsType {
Payout {
... | rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/common_utils/src/metrics.rs | crates/common_utils/src/metrics.rs | //! Utilities for metrics
pub mod utils;
| rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/common_utils/src/request.rs | crates/common_utils/src/request.rs | use masking::{Maskable, Secret};
use reqwest::multipart::Form;
use serde::{Deserialize, Serialize};
use utoipa::ToSchema;
pub type Headers = std::collections::HashSet<(String, Maskable<String>)>;
#[derive(
Clone,
Copy,
Debug,
Eq,
PartialEq,
Deserialize,
Serialize,
strum::Display,
s... | rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/common_utils/src/crypto.rs | crates/common_utils/src/crypto.rs | //! Utilities for cryptographic algorithms
use std::ops::Deref;
use base64::Engine;
use error_stack::ResultExt;
use masking::{ExposeInterface, PeekInterface, Secret};
use ring::{
aead::{self, BoundKey, OpeningKey, SealingKey, UnboundKey},
hmac, rand as ring_rand,
signature::{RsaKeyPair, RSA_PSS_SHA256},
};... | rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | true |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/common_utils/src/fp_utils.rs | crates/common_utils/src/fp_utils.rs | //! Functional programming utilities
/// The Applicative trait provides a pure behavior,
/// which can be used to create values of type f a from values of type a.
pub trait Applicative<R> {
/// The Associative type acts as a (f a) wrapper for Self.
type WrappedSelf<T>;
/// Applicative::pure(_) is abstract... | rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/common_utils/src/signals.rs | crates/common_utils/src/signals.rs | //! Provide Interface for worker services to handle signals
#[cfg(not(target_os = "windows"))]
use futures::StreamExt;
#[cfg(not(target_os = "windows"))]
use router_env::logger;
use tokio::sync::mpsc;
/// This functions is meant to run in parallel to the application.
/// It will send a signal to the receiver when a S... | rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/common_utils/src/hashing.rs | crates/common_utils/src/hashing.rs | use masking::{PeekInterface, Secret, Strategy};
use serde::{Deserialize, Serialize, Serializer};
#[derive(Clone, PartialEq, Debug, Deserialize)]
/// Represents a hashed string using blake3's hashing strategy.
pub struct HashedString<T: Strategy<String>>(Secret<String, T>);
impl<T: Strategy<String>> Serialize for Hash... | rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/common_utils/src/tokenization.rs | crates/common_utils/src/tokenization.rs | //! Module for tokenization-related functionality
//!
//! This module provides types and functions for handling tokenized payment data,
//! including response structures and token generation utilities.
use crate::consts::TOKEN_LENGTH;
#[cfg(all(feature = "v2", feature = "tokenization_v2"))]
/// Generates a new token ... | rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/common_utils/src/metrics/utils.rs | crates/common_utils/src/metrics/utils.rs | //! metric utility functions
use std::time;
use router_env::opentelemetry;
/// Record the time taken by the future to execute
#[inline]
pub async fn time_future<F, R>(future: F) -> (R, time::Duration)
where
F: futures::Future<Output = R>,
{
let start = time::Instant::now();
let result = future.await;
... | rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/common_utils/src/id_type/tenant.rs | crates/common_utils/src/id_type/tenant.rs | use crate::{
consts::{DEFAULT_GLOBAL_TENANT_ID, DEFAULT_TENANT},
errors::{CustomResult, ValidationError},
};
crate::id_type!(
TenantId,
"A type for tenant_id that can be used for unique identifier for a tenant"
);
crate::impl_id_type_methods!(TenantId, "tenant_id");
// This is to display the `TenantId... | rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/common_utils/src/id_type/refunds.rs | crates/common_utils/src/id_type/refunds.rs | crate::id_type!(RefundReferenceId, "A type for refund_reference_id");
crate::impl_id_type_methods!(RefundReferenceId, "refund_reference_id");
// This is to display the `RefundReferenceId` as RefundReferenceId(abcd)
crate::impl_debug_id_type!(RefundReferenceId);
crate::impl_try_from_cow_str_id_type!(RefundReferenceId, ... | rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/common_utils/src/id_type/routing.rs | crates/common_utils/src/id_type/routing.rs | crate::id_type!(
RoutingId,
" A type for routing_id that can be used for routing ids"
);
crate::impl_id_type_methods!(RoutingId, "routing_id");
// This is to display the `RoutingId` as RoutingId(abcd)
crate::impl_debug_id_type!(RoutingId);
crate::impl_try_from_cow_str_id_type!(RoutingId, "routing_id");
crate... | rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/common_utils/src/id_type/profile_acquirer.rs | crates/common_utils/src/id_type/profile_acquirer.rs | use std::str::FromStr;
crate::id_type!(
ProfileAcquirerId,
"A type for profile_acquirer_id that can be used for profile acquirer ids"
);
crate::impl_id_type_methods!(ProfileAcquirerId, "profile_acquirer_id");
// This is to display the `ProfileAcquirerId` as ProfileAcquirerId(abcd)
crate::impl_debug_id_type!(P... | rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/common_utils/src/id_type/organization.rs | crates/common_utils/src/id_type/organization.rs | use crate::errors::{CustomResult, ValidationError};
crate::id_type!(
OrganizationId,
"A type for organization_id that can be used for organization ids"
);
crate::impl_id_type_methods!(OrganizationId, "organization_id");
// This is to display the `OrganizationId` as OrganizationId(abcd)
crate::impl_debug_id_ty... | rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/common_utils/src/id_type/client_secret.rs | crates/common_utils/src/id_type/client_secret.rs | crate::id_type!(
ClientSecretId,
"A type for key_id that can be used for Ephemeral key IDs"
);
crate::impl_id_type_methods!(ClientSecretId, "key_id");
// This is to display the `ClientSecretId` as ClientSecretId(abcd)
crate::impl_debug_id_type!(ClientSecretId);
crate::impl_try_from_cow_str_id_type!(ClientSecre... | rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/common_utils/src/id_type/subscription.rs | crates/common_utils/src/id_type/subscription.rs | crate::id_type!(
SubscriptionId,
" A type for subscription_id that can be used for subscription ids"
);
crate::impl_id_type_methods!(SubscriptionId, "subscription_id");
// This is to display the `SubscriptionId` as SubscriptionId(subs)
crate::impl_debug_id_type!(SubscriptionId);
crate::impl_try_from_cow_str_i... | rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/common_utils/src/id_type/invoice.rs | crates/common_utils/src/id_type/invoice.rs | crate::id_type!(
InvoiceId,
" A type for invoice_id that can be used for invoice ids"
);
crate::impl_id_type_methods!(InvoiceId, "invoice_id");
// This is to display the `InvoiceId` as InvoiceId(subs)
crate::impl_debug_id_type!(InvoiceId);
crate::impl_try_from_cow_str_id_type!(InvoiceId, "invoice_id");
crate... | rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/common_utils/src/id_type/relay.rs | crates/common_utils/src/id_type/relay.rs | use std::str::FromStr;
crate::id_type!(
RelayId,
"A type for relay_id that can be used for relay ids"
);
crate::impl_id_type_methods!(RelayId, "relay_id");
crate::impl_try_from_cow_str_id_type!(RelayId, "relay_id");
crate::impl_generate_id_id_type!(RelayId, "relay");
crate::impl_serializable_secret_id_type!(R... | rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/common_utils/src/id_type/api_key.rs | crates/common_utils/src/id_type/api_key.rs | crate::id_type!(
ApiKeyId,
"A type for key_id that can be used for API key IDs"
);
crate::impl_id_type_methods!(ApiKeyId, "key_id");
// This is to display the `ApiKeyId` as ApiKeyId(abcd)
crate::impl_debug_id_type!(ApiKeyId);
crate::impl_try_from_cow_str_id_type!(ApiKeyId, "key_id");
crate::impl_serializable_... | rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/common_utils/src/id_type/merchant_connector_account.rs | crates/common_utils/src/id_type/merchant_connector_account.rs | use std::str::FromStr;
use crate::errors::{CustomResult, ValidationError};
crate::id_type!(
MerchantConnectorAccountId,
"A type for merchant_connector_id that can be used for merchant_connector_account ids"
);
crate::impl_id_type_methods!(MerchantConnectorAccountId, "merchant_connector_id");
// This is to di... | rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/common_utils/src/id_type/payment.rs | crates/common_utils/src/id_type/payment.rs | use crate::{
errors::{CustomResult, ValidationError},
generate_id_with_default_len,
id_type::{AlphaNumericId, LengthId},
};
crate::id_type!(
PaymentId,
"A type for payment_id that can be used for payment ids"
);
crate::impl_id_type_methods!(PaymentId, "payment_id");
// This is to display the `Paym... | rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/common_utils/src/id_type/payout.rs | crates/common_utils/src/id_type/payout.rs | crate::id_type!(
PayoutId,
"A domain type for payout_id that can be used for payout ids"
);
crate::impl_id_type_methods!(PayoutId, "payout_id");
crate::impl_debug_id_type!(PayoutId);
crate::impl_try_from_cow_str_id_type!(PayoutId, "payout_id");
crate::impl_generate_id_id_type!(PayoutId, "payout");
crate::impl_q... | rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/common_utils/src/id_type/global_id.rs | crates/common_utils/src/id_type/global_id.rs | pub(super) mod customer;
pub(super) mod payment;
pub(super) mod payment_methods;
pub(super) mod refunds;
pub(super) mod token;
use diesel::{backend::Backend, deserialize::FromSql, serialize::ToSql, sql_types};
use error_stack::ResultExt;
use thiserror::Error;
use crate::{
consts::{CELL_IDENTIFIER_LENGTH, MAX_GLOB... | rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/common_utils/src/id_type/authentication.rs | crates/common_utils/src/id_type/authentication.rs | crate::id_type!(
AuthenticationId,
"A type for authentication_id that can be used for authentication IDs"
);
crate::impl_id_type_methods!(AuthenticationId, "authentication_id");
// This is to display the `AuthenticationId` as AuthenticationId(abcd)
crate::impl_debug_id_type!(AuthenticationId);
crate::impl_try_... | rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/common_utils/src/id_type/customer.rs | crates/common_utils/src/id_type/customer.rs | crate::id_type!(
CustomerId,
"A type for customer_id that can be used for customer ids"
);
crate::impl_id_type_methods!(CustomerId, "customer_id");
// This is to display the `CustomerId` as CustomerId(abcd)
crate::impl_debug_id_type!(CustomerId);
crate::impl_default_id_type!(CustomerId, "cus");
crate::impl_try... | rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/common_utils/src/id_type/webhook_endpoint.rs | crates/common_utils/src/id_type/webhook_endpoint.rs | use crate::errors::{CustomResult, ValidationError};
crate::id_type!(
WebhookEndpointId,
"A type for webhook_endpoint_id that can be used for unique identifier for a webhook_endpoint"
);
crate::impl_id_type_methods!(WebhookEndpointId, "webhook_endpoint_id");
crate::impl_generate_id_id_type!(WebhookEndpointId, "... | rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/common_utils/src/id_type/merchant.rs | crates/common_utils/src/id_type/merchant.rs | //! Contains the id type for merchant account
//!
//! Ids for merchant account are derived from the merchant name
//! If there are any special characters, they are removed
use crate::{
date_time,
errors::{CustomResult, ValidationError},
generate_id_with_default_len,
id_type::{AlphaNumericId, LengthId},... | rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/common_utils/src/id_type/profile.rs | crates/common_utils/src/id_type/profile.rs | use std::str::FromStr;
crate::id_type!(
ProfileId,
"A type for profile_id that can be used for business profile ids"
);
crate::impl_id_type_methods!(ProfileId, "profile_id");
// This is to display the `ProfileId` as ProfileId(abcd)
crate::impl_debug_id_type!(ProfileId);
crate::impl_try_from_cow_str_id_type!(P... | rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/common_utils/src/id_type/global_id/refunds.rs | crates/common_utils/src/id_type/global_id/refunds.rs | use error_stack::ResultExt;
use crate::errors;
/// A global id that can be used to identify a refund
#[derive(
Debug,
Clone,
Hash,
PartialEq,
Eq,
serde::Serialize,
serde::Deserialize,
diesel::expression::AsExpression,
)]
#[diesel(sql_type = diesel::sql_types::Text)]
pub struct GlobalRe... | rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/common_utils/src/id_type/global_id/payment.rs | crates/common_utils/src/id_type/global_id/payment.rs | use common_enums::enums;
use error_stack::ResultExt;
use crate::errors;
crate::global_id_type!(
GlobalPaymentId,
"A global id that can be used to identify a payment.
The format will be `<cell_id>_<entity_prefix>_<time_ordered_id>`.
Example: `cell1_pay_uu1a2b3c4d5e6f7g8h9i0j1k2l3m4n5o6p`"
);
// Database rel... | rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/common_utils/src/id_type/global_id/payment_methods.rs | crates/common_utils/src/id_type/global_id/payment_methods.rs | use error_stack::ResultExt;
use crate::{
errors::CustomResult,
id_type::global_id::{CellId, GlobalEntity, GlobalId},
};
/// A global id that can be used to identify a payment method
#[derive(
Debug,
Clone,
Hash,
PartialEq,
Eq,
serde::Serialize,
serde::Deserialize,
diesel::expre... | rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/common_utils/src/id_type/global_id/customer.rs | crates/common_utils/src/id_type/global_id/customer.rs | use crate::errors;
crate::global_id_type!(
GlobalCustomerId,
"A global id that can be used to identify a customer.
The format will be `<cell_id>_<entity_prefix>_<time_ordered_id>`.
Example: `cell1_cus_uu1a2b3c4d5e6f7g8h9i0j1k2l3m4n5o6p`"
);
// Database related implementations so that this field can be used ... | rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/common_utils/src/id_type/global_id/token.rs | crates/common_utils/src/id_type/global_id/token.rs | use std::borrow::Cow;
use error_stack::ResultExt;
use crate::errors::{CustomResult, ValidationError};
crate::global_id_type!(
GlobalTokenId,
"A global id that can be used to identify a token.
The format will be `<cell_id>_<entity_prefix>_<time_ordered_id>`.
Example: `cell1_tok_uu1a2b3c4d5e6f7g8h9i0j1k2l3m4... | rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/common_utils/src/types/user.rs | crates/common_utils/src/types/user.rs | /// User related types
pub mod core;
/// Theme related types
pub mod theme;
pub use core::*;
pub use theme::*;
| rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/common_utils/src/types/primitive_wrappers.rs | crates/common_utils/src/types/primitive_wrappers.rs | pub(crate) mod bool_wrappers {
use serde::{Deserialize, Serialize};
/// Bool that represents if Extended Authorization is Applied or not
#[derive(
Clone, Copy, Debug, Eq, PartialEq, Serialize, Deserialize, diesel::expression::AsExpression,
)]
#[diesel(sql_type = diesel::sql_types::Bool)]
... | rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/common_utils/src/types/keymanager.rs | crates/common_utils/src/types/keymanager.rs | #![allow(missing_docs)]
use core::fmt;
use base64::Engine;
use masking::{ExposeInterface, PeekInterface, Secret, Strategy, StrongSecret};
#[cfg(feature = "encryption_service")]
use router_env::logger;
#[cfg(feature = "km_forward_x_request_id")]
use router_env::RequestId;
use rustc_hash::FxHashMap;
use serde::{
de... | rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/common_utils/src/types/authentication.rs | crates/common_utils/src/types/authentication.rs | use crate::id_type;
/// Enum for different levels of authentication
#[derive(
Clone,
Debug,
Hash,
Eq,
PartialEq,
serde::Deserialize,
serde::Serialize,
strum::Display,
strum::EnumString,
)]
pub enum AuthInfo {
/// OrgLevel: Authentication at the organization level
OrgLevel {
... | rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/common_utils/src/types/user/theme.rs | crates/common_utils/src/types/user/theme.rs | use common_enums::EntityType;
use serde::{Deserialize, Serialize};
use crate::{
events::{ApiEventMetric, ApiEventsType},
id_type, impl_api_event_type,
};
/// Enum for having all the required lineage for every level.
/// Currently being used for theme related APIs and queries.
#[derive(Debug, Deserialize, Seri... | rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/common_utils/src/types/user/core.rs | crates/common_utils/src/types/user/core.rs | use diesel::{deserialize::FromSqlRow, expression::AsExpression};
use crate::id_type;
/// Struct for lineageContext
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize, AsExpression, FromSqlRow)]
#[diesel(sql_type = diesel::sql_types::Jsonb)]
pub struct LineageContext {
/// user_id: String
pub user_id:... | rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/common_utils/tests/percentage.rs | crates/common_utils/tests/percentage.rs | #![allow(clippy::panic_in_result_fn)]
use common_utils::{errors::PercentageError, types::Percentage};
const PRECISION_2: u8 = 2;
const PRECISION_0: u8 = 0;
#[test]
fn invalid_range_more_than_100() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
let percentage = Percentage::<PRECISION_2>::from_string("100... | rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/payment_methods/src/lib.rs | crates/payment_methods/src/lib.rs | pub mod configs;
pub mod controller;
pub mod core;
pub mod helpers;
pub mod state;
| rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/payment_methods/src/helpers.rs | crates/payment_methods/src/helpers.rs | use api_models::{enums as api_enums, payment_methods as api};
#[cfg(feature = "v1")]
use common_utils::ext_traits::AsyncExt;
pub use hyperswitch_domain_models::{errors::api_error_response, payment_methods as domain};
#[cfg(feature = "v1")]
use router_env::logger;
use crate::state;
#[cfg(feature = "v1")]
pub async fn p... | rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/payment_methods/src/state.rs | crates/payment_methods/src/state.rs | #[cfg(feature = "v1")]
use common_utils::errors::CustomResult;
use common_utils::types::keymanager;
#[cfg(feature = "v1")]
use hyperswitch_domain_models::merchant_account;
use hyperswitch_domain_models::{
cards_info, customer, merchant_key_store, payment_methods as pm_domain,
};
use storage_impl::{errors, kv_router... | rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/payment_methods/src/core.rs | crates/payment_methods/src/core.rs | pub mod errors;
pub mod migration;
| rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/payment_methods/src/controller.rs | crates/payment_methods/src/controller.rs | use std::fmt::Debug;
use api_models::payment_methods as api;
#[cfg(feature = "payouts")]
use api_models::payouts;
#[cfg(feature = "v1")]
use common_enums::enums as common_enums;
#[cfg(feature = "v2")]
use common_utils::encryption;
use common_utils::{crypto, ext_traits, id_type, type_name, types::keymanager};
use error... | rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/payment_methods/src/configs.rs | crates/payment_methods/src/configs.rs | pub mod payment_connector_required_fields;
pub mod settings;
| rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/payment_methods/src/configs/settings.rs | crates/payment_methods/src/configs/settings.rs | use std::collections::{HashMap, HashSet};
use api_models::{enums, payment_methods::RequiredFieldInfo};
use common_utils::errors::CustomResult;
use hyperswitch_interfaces::secrets_interface::{
secret_handler::SecretsHandler,
secret_state::{RawSecret, SecretStateContainer, SecuredSecret},
SecretManagementInt... | rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/payment_methods/src/configs/payment_connector_required_fields.rs | crates/payment_methods/src/configs/payment_connector_required_fields.rs | use std::collections::{HashMap, HashSet};
use api_models::{
enums::{self, Connector, FieldType},
payment_methods::RequiredFieldInfo,
};
use crate::configs::settings::{
BankRedirectConfig, ConnectorFields, Mandates, RequiredFieldFinal,
SupportedConnectorsForMandate, SupportedPaymentMethodTypesForMandat... | rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | true |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/payment_methods/src/core/errors.rs | crates/payment_methods/src/core/errors.rs | pub use common_utils::errors::{CustomResult, ParsingError, ValidationError};
pub use hyperswitch_domain_models::{
api,
errors::api_error_response::{self, *},
};
pub type PmResult<T> = CustomResult<T, ApiErrorResponse>;
pub type PmResponse<T> = CustomResult<api::ApplicationResponse<T>, ApiErrorResponse>;
pub ty... | rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/payment_methods/src/core/migration.rs | crates/payment_methods/src/core/migration.rs | use actix_multipart::form::{self, bytes, text};
use api_models::payment_methods as pm_api;
use csv::Reader;
use error_stack::ResultExt;
#[cfg(feature = "v1")]
use hyperswitch_domain_models::{api, platform};
use masking::PeekInterface;
use rdkafka::message::ToBytes;
use router_env::{instrument, tracing};
use crate::cor... | rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/payment_methods/src/core/migration/payment_methods.rs | crates/payment_methods/src/core/migration/payment_methods.rs | use std::str::FromStr;
#[cfg(feature = "v2")]
use api_models::enums as api_enums;
#[cfg(feature = "v1")]
use api_models::enums;
use api_models::payment_methods as pm_api;
#[cfg(feature = "v1")]
use common_utils::{
consts,
crypto::Encryptable,
ext_traits::{AsyncExt, ConfigExt},
generate_id,
};
use commo... | rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/storage_impl/src/config.rs | crates/storage_impl/src/config.rs | use common_utils::DbConnectionParams;
use hyperswitch_domain_models::master_key::MasterKeyInterface;
use masking::{PeekInterface, Secret};
use crate::{kv_router_store, DatabaseStore, MockDb, RouterStore};
#[derive(Debug, Clone, serde::Deserialize)]
pub struct Database {
pub username: String,
pub password: Sec... | rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/storage_impl/src/errors.rs | crates/storage_impl/src/errors.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... | rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/storage_impl/src/callback_mapper.rs | crates/storage_impl/src/callback_mapper.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... | rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/storage_impl/src/lib.rs | crates/storage_impl/src/lib.rs | use std::{fmt::Debug, sync::Arc};
use common_utils::types::TenantConfig;
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::RedisConnInterf... | rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/storage_impl/src/address.rs | crates/storage_impl/src/address.rs | use diesel_models::address::Address;
use crate::redis::kv_store::KvStorePartition;
impl KvStorePartition for Address {}
| rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/storage_impl/src/customers.rs | crates/storage_impl/src/customers.rs | use common_utils::{id_type, pii};
use diesel_models::{customers, kv};
use error_stack::ResultExt;
use futures::future::try_join_all;
use hyperswitch_domain_models::{
behaviour::{Conversion, ReverseConversion},
customer as domain,
merchant_key_store::MerchantKeyStore,
};
use masking::PeekInterface;
use route... | rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | true |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/storage_impl/src/platform_wrapper.rs | crates/storage_impl/src/platform_wrapper.rs | /// Platform wrapper for database operations
///
/// Purpose: Prevent mixing Provider and Processor credentials when making DB calls.
///
/// Use wrappers when:
/// - You have Platform and need DB calls
/// - Multiple credentials needed (key_store, merchant_id, storage_scheme)
///
/// Direct DB calls are OK when no wra... | rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/storage_impl/src/cards_info.rs | crates/storage_impl/src/cards_info.rs | pub use diesel_models::{CardInfo, UpdateCardInfo};
use error_stack::report;
use hyperswitch_domain_models::cards_info::CardsInfoInterface;
use router_env::{instrument, tracing};
use crate::{
errors::StorageError,
kv_router_store::KVRouterStore,
redis::kv_store::KvStorePartition,
utils::{pg_connection_r... | rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/storage_impl/src/merchant_account.rs | crates/storage_impl/src/merchant_account.rs | #[cfg(feature = "olap")]
use std::collections::HashMap;
use common_utils::ext_traits::AsyncExt;
use diesel_models::merchant_account as storage;
use error_stack::{report, ResultExt};
use hyperswitch_domain_models::{
behaviour::{Conversion, ReverseConversion},
master_key::MasterKeyInterface,
merchant_account... | rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/storage_impl/src/connection.rs | crates/storage_impl/src/connection.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... | rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/storage_impl/src/database.rs | crates/storage_impl/src/database.rs | pub mod store;
| rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/storage_impl/src/mock_db.rs | crates/storage_impl/src/mock_db.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,
... | rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/storage_impl/src/subscription.rs | crates/storage_impl/src/subscription.rs | use common_utils::errors::CustomResult;
pub use diesel_models::subscription::Subscription;
use error_stack::ResultExt;
pub use hyperswitch_domain_models::{
behaviour::Conversion,
merchant_key_store::MerchantKeyStore,
subscription::{
Subscription as DomainSubscription, SubscriptionInterface,
... | rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/storage_impl/src/invoice.rs | crates/storage_impl/src/invoice.rs | use common_utils::errors::CustomResult;
pub use diesel_models::invoice::Invoice;
use error_stack::{report, ResultExt};
pub use hyperswitch_domain_models::{
behaviour::Conversion,
invoice::{Invoice as DomainInvoice, InvoiceInterface, InvoiceUpdate as DomainInvoiceUpdate},
merchant_key_store::MerchantKeyStore... | rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/storage_impl/src/merchant_connector_account.rs | crates/storage_impl/src/merchant_connector_account.rs | use async_bb8_diesel::AsyncConnection;
use common_utils::{encryption::Encryption, ext_traits::AsyncExt};
use diesel_models::merchant_connector_account as storage;
use error_stack::{report, ResultExt};
use hyperswitch_domain_models::{
behaviour::{Conversion, ReverseConversion},
merchant_connector_account::{self ... | rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | true |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/storage_impl/src/payment_method.rs | crates/storage_impl/src/payment_method.rs | pub use diesel_models::payment_method::PaymentMethod;
use crate::redis::kv_store::KvStorePartition;
impl KvStorePartition for PaymentMethod {}
#[cfg(feature = "v1")]
use std::collections::HashSet;
use common_enums::enums::MerchantStorageScheme;
use common_utils::{errors::CustomResult, id_type};
#[cfg(feature = "v1"... | rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | true |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/storage_impl/src/payouts.rs | crates/storage_impl/src/payouts.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 {}
| rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/storage_impl/src/utils.rs | crates/storage_impl/src/utils.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... | rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/storage_impl/src/lookup.rs | crates/storage_impl/src/lookup.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... | rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/storage_impl/src/business_profile.rs | crates/storage_impl/src/business_profile.rs | use common_utils::ext_traits::AsyncExt;
use diesel_models::business_profile::{self, ProfileUpdateInternal};
use error_stack::{report, ResultExt};
use hyperswitch_domain_models::{
behaviour::{Conversion, ReverseConversion},
business_profile as domain,
business_profile::ProfileInterface,
merchant_key_stor... | rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/storage_impl/src/mandate.rs | crates/storage_impl/src/mandate.rs | use diesel_models::Mandate;
use crate::redis::kv_store::KvStorePartition;
impl KvStorePartition for Mandate {}
| rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/storage_impl/src/metrics.rs | crates/storage_impl/src/metrics.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_... | rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/storage_impl/src/refund.rs | crates/storage_impl/src/refund.rs | use diesel_models::refund::Refund;
use crate::redis::kv_store::KvStorePartition;
impl KvStorePartition for Refund {}
| rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/storage_impl/src/kv_router_store.rs | crates/storage_impl/src/kv_router_store.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... | rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/storage_impl/src/configs.rs | crates/storage_impl/src/configs.rs | use diesel_models::configs as storage;
use error_stack::report;
use hyperswitch_domain_models::configs::ConfigInterface;
use router_env::{instrument, tracing};
use crate::{
connection,
errors::StorageError,
kv_router_store,
redis::{
cache,
cache::{CacheKind, CONFIG_CACHE},
},
st... | rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/storage_impl/src/redis.rs | crates/storage_impl/src/redis.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... | rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/storage_impl/src/reverse_lookup.rs | crates/storage_impl/src/reverse_lookup.rs | use diesel_models::reverse_lookup::ReverseLookup;
use crate::redis::kv_store::KvStorePartition;
impl KvStorePartition for ReverseLookup {}
| rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/storage_impl/src/merchant_key_store.rs | crates/storage_impl/src/merchant_key_store.rs | use error_stack::{report, ResultExt};
use hyperswitch_domain_models::{
behaviour::{Conversion, ReverseConversion},
merchant_key_store as domain,
merchant_key_store::MerchantKeyStoreInterface,
};
use masking::Secret;
use router_env::{instrument, tracing};
#[cfg(feature = "accounts_cache")]
use crate::redis:... | rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/storage_impl/src/payments.rs | crates/storage_impl/src/payments.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 {}
| rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/storage_impl/src/tokenization.rs | crates/storage_impl/src/tokenization.rs | #[cfg(all(feature = "v2", feature = "tokenization_v2"))]
use common_utils::errors::CustomResult;
#[cfg(all(feature = "v2", feature = "tokenization_v2"))]
use diesel_models::tokenization as tokenization_diesel;
#[cfg(all(feature = "v2", feature = "tokenization_v2"))]
use error_stack::{report, ResultExt};
#[cfg(all(featu... | rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/storage_impl/src/payments/payment_attempt.rs | crates/storage_impl/src/payments/payment_attempt.rs | use common_utils::{errors::CustomResult, ext_traits::AsyncExt};
#[cfg(feature = "v1")]
use common_utils::{fallback_reverse_lookup_not_found, types::ConnectorTransactionId};
use diesel_models::{
enums::{
MandateAmountData as DieselMandateAmountData, MandateDataType as DieselMandateType,
MandateDetail... | rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | true |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/storage_impl/src/payments/payment_intent.rs | crates/storage_impl/src/payments/payment_intent.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};
#[cfg(feature = "v2")]
use common_utils::fallback_reverse_lookup_not_found;
#[cfg(feature = "ola... | rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | true |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/storage_impl/src/payouts/payout_attempt.rs | crates/storage_impl/src/payouts/payout_attempt.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... | rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | false |
juspay/hyperswitch | https://github.com/juspay/hyperswitch/blob/4201e04a8f0f1d46b57f24868f4f943a9be50bda/crates/storage_impl/src/payouts/payouts.rs | crates/storage_impl/src/payouts/payouts.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(feature = "olap")]
use diesel::{associations::HasTable, ExpressionMethods, QueryDsl};
#[cfg(all(feature = "v1", feature = "ola... | rust | Apache-2.0 | 4201e04a8f0f1d46b57f24868f4f943a9be50bda | 2026-01-04T15:31:59.475325Z | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.