repo stringclasses 4
values | file_path stringlengths 6 193 | extension stringclasses 23
values | content stringlengths 0 1.73M | token_count int64 0 724k | __index_level_0__ int64 0 10.8k |
|---|---|---|---|---|---|
hyperswitch | crates/api_models/src/analytics/disputes.rs | .rs | use std::{
collections::hash_map::DefaultHasher,
hash::{Hash, Hasher},
};
use super::{ForexMetric, NameDescription, TimeRange};
use crate::enums::{Currency, DisputeStage};
#[derive(
Clone,
Debug,
Hash,
PartialEq,
Eq,
serde::Serialize,
serde::Deserialize,
strum::Display,
str... | 934 | 2,006 |
hyperswitch | crates/api_models/src/analytics/search.rs | .rs | use common_utils::{hashing::HashedString, types::TimeRange};
use masking::WithType;
use serde_json::Value;
#[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)]
pub struct SearchFilters {
pub payment_method: Option<Vec<String>>,
pub currency: Option<Vec<String>>,
pub status: Option<Vec<Str... | 934 | 2,007 |
hyperswitch | crates/api_models/src/analytics/payments.rs | .rs | use std::{
collections::hash_map::DefaultHasher,
hash::{Hash, Hasher},
};
use common_utils::id_type;
use super::{ForexMetric, NameDescription, TimeRange};
use crate::enums::{
AttemptStatus, AuthenticationType, CardNetwork, Connector, Currency, PaymentMethod,
PaymentMethodType,
};
#[derive(Clone, Debu... | 2,026 | 2,008 |
hyperswitch | crates/api_models/src/analytics/connector_events.rs | .rs | #[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
pub struct ConnectorEventsRequest {
pub payment_id: common_utils::id_type::PaymentId,
pub refund_id: Option<String>,
pub dispute_id: Option<String>,
}
| 51 | 2,009 |
hyperswitch | crates/api_models/src/analytics/auth_events.rs | .rs | use std::{
collections::hash_map::DefaultHasher,
hash::{Hash, Hasher},
};
use common_enums::{
AuthenticationConnectors, AuthenticationStatus, DecoupledAuthenticationType, TransactionStatus,
};
use super::{NameDescription, TimeRange};
#[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)]
... | 1,310 | 2,010 |
hyperswitch | crates/api_models/src/analytics/payment_intents.rs | .rs | use std::{
collections::hash_map::DefaultHasher,
hash::{Hash, Hasher},
};
use common_utils::id_type;
use super::{ForexMetric, NameDescription, TimeRange};
use crate::enums::{
AuthenticationType, Connector, Currency, IntentStatus, PaymentMethod, PaymentMethodType,
};
#[derive(Clone, Debug, Default, serde:... | 1,807 | 2,011 |
hyperswitch | crates/api_models/src/analytics/outgoing_webhook_event.rs | .rs | #[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
pub struct OutgoingWebhookLogsRequest {
pub payment_id: common_utils::id_type::PaymentId,
pub event_id: Option<String>,
pub refund_id: Option<String>,
pub dispute_id: Option<String>,
pub mandate_id: Option<String>,
pub payment_method_... | 87 | 2,012 |
hyperswitch | crates/api_models/src/analytics/refunds.rs | .rs | use std::{
collections::hash_map::DefaultHasher,
hash::{Hash, Hasher},
};
use common_utils::id_type;
use crate::enums::{Currency, RefundStatus};
#[derive(
Clone,
Copy,
Debug,
Default,
Hash,
Eq,
PartialEq,
serde::Serialize,
serde::Deserialize,
strum::Display,
strum:... | 1,551 | 2,013 |
hyperswitch | crates/api_models/src/analytics/api_event.rs | .rs | use std::{
collections::hash_map::DefaultHasher,
hash::{Hash, Hasher},
};
use super::{NameDescription, TimeRange};
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
pub struct ApiLogsRequest {
#[serde(flatten)]
pub query_param: QueryType,
}
pub enum FilterType {
ApiCountFilter,
Lat... | 864 | 2,014 |
hyperswitch | crates/api_models/src/analytics/sdk_events.rs | .rs | use std::{
collections::hash_map::DefaultHasher,
hash::{Hash, Hasher},
};
use super::{NameDescription, TimeRange};
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
#[serde(rename_all = "camelCase")]
pub struct SdkEventsRequest {
pub payment_id: common_utils::id_type::PaymentId,
pub time_r... | 1,285 | 2,015 |
hyperswitch | crates/api_models/src/analytics/active_payments.rs | .rs | use std::{
collections::hash_map::DefaultHasher,
hash::{Hash, Hasher},
};
use super::NameDescription;
#[derive(
Clone,
Debug,
Hash,
PartialEq,
Eq,
serde::Serialize,
serde::Deserialize,
strum::Display,
strum::EnumIter,
strum::AsRefStr,
)]
#[strum(serialize_all = "snake_c... | 403 | 2,016 |
hyperswitch | crates/api_models/src/user/sample_data.rs | .rs | use common_enums::{AuthenticationType, CountryAlpha2};
use time::PrimitiveDateTime;
use crate::enums::Connector;
#[derive(serde::Deserialize, Debug, serde::Serialize)]
pub struct SampleDataRequest {
pub record: Option<usize>,
pub connector: Option<Vec<Connector>>,
#[serde(default, with = "common_utils::cu... | 225 | 2,017 |
hyperswitch | crates/api_models/src/user/dashboard_metadata.rs | .rs | use common_enums::{CountryAlpha2, MerchantProductType};
use common_utils::{id_type, pii};
use masking::Secret;
use strum::EnumString;
#[derive(Debug, serde::Deserialize, serde::Serialize)]
pub enum SetMetaDataRequest {
ProductionAgreement(ProductionAgreementRequest),
SetupProcessor(SetupProcessor),
Configu... | 1,160 | 2,018 |
hyperswitch | crates/api_models/src/user/theme.rs | .rs | use actix_multipart::form::{bytes::Bytes, text::Text, MultipartForm};
use common_enums::EntityType;
use common_utils::{
id_type,
types::theme::{EmailThemeConfig, ThemeLineage},
};
use masking::Secret;
use serde::{Deserialize, Serialize};
#[derive(Debug, Serialize)]
pub struct GetThemeResponse {
pub theme_i... | 834 | 2,019 |
hyperswitch | crates/common_utils/Cargo.toml | .toml | [package]
name = "common_utils"
description = "Utilities shared across `router` and other crates"
version = "0.1.0"
edition.workspace = true
rust-version.workspace = true
readme = "README.md"
license.workspace = true
[features]
default = []
keymanager = ["dep:router_env"]
keymanager_mtls = ["reqwest/rustls-tls"]
encry... | 971 | 2,020 |
hyperswitch | crates/common_utils/README.md | .md | # Common Utils
Utilities shared across `router` and other crates.
| 14 | 2,021 |
hyperswitch | crates/common_utils/tests/percentage.rs | .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... | 1,551 | 2,022 |
hyperswitch | crates/common_utils/src/hashing.rs | .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... | 174 | 2,023 |
hyperswitch | crates/common_utils/src/custom_serde.rs | .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... | 2,336 | 2,024 |
hyperswitch | crates/common_utils/src/metrics.rs | .rs | //! Utilities for metrics
pub mod utils;
| 9 | 2,025 |
hyperswitch | crates/common_utils/src/signals.rs | .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... | 519 | 2,026 |
hyperswitch | crates/common_utils/src/access_token.rs | .rs | //! Commonly used utilities for access token
use std::fmt::Display;
use crate::id_type;
/// Create a key for fetching the access token from redis
pub fn create_access_token_key(
merchant_id: &id_type::MerchantId,
merchant_connector_id_or_connector_name: impl Display,
) -> String {
merchant_id.get_access_... | 83 | 2,027 |
hyperswitch | crates/common_utils/src/encryption.rs | .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... | 495 | 2,028 |
hyperswitch | crates/common_utils/src/fp_utils.rs | .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... | 279 | 2,029 |
hyperswitch | crates/common_utils/src/keymanager.rs | .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... | 1,940 | 2,030 |
hyperswitch | crates/common_utils/src/crypto.rs | .rs | //! Utilities for cryptographic algorithms
use std::ops::Deref;
use error_stack::ResultExt;
use masking::{ExposeInterface, Secret};
use md5;
use ring::{
aead::{self, BoundKey, OpeningKey, SealingKey, UnboundKey},
hmac,
};
use crate::{
errors::{self, CustomResult},
pii::{self, EncryptionStrategy},
};
... | 7,189 | 2,031 |
hyperswitch | crates/common_utils/src/id_type.rs | .rs | //! Common ID types
//! The id type can be used to create specific id types with custom behaviour
mod api_key;
mod client_secret;
mod customer;
#[cfg(feature = "v2")]
mod global_id;
mod merchant;
mod merchant_connector_account;
mod organization;
mod payment;
mod profile;
mod refunds;
mod relay;
mod routing;
mod tenant... | 2,718 | 2,032 |
hyperswitch | crates/common_utils/src/request.rs | .rs | use masking::{Maskable, Secret};
use serde::{Deserialize, Serialize};
pub type Headers = std::collections::HashSet<(String, Maskable<String>)>;
#[derive(
Clone, Copy, Debug, Eq, PartialEq, Deserialize, Serialize, strum::Display, strum::EnumString,
)]
#[serde(rename_all = "UPPERCASE")]
#[strum(serialize_all = "UPP... | 1,210 | 2,033 |
hyperswitch | crates/common_utils/src/ext_traits.rs | .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... | 4,735 | 2,034 |
hyperswitch | crates/common_utils/src/transformers.rs | .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>:... | 120 | 2,035 |
hyperswitch | crates/common_utils/src/link_utils.rs | .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... | 2,899 | 2,036 |
hyperswitch | crates/common_utils/src/pii.rs | .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,... | 3,611 | 2,037 |
hyperswitch | crates/common_utils/src/new_type.rs | .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... | 2,802 | 2,038 |
hyperswitch | crates/common_utils/src/consts.rs | .rs | //! Commonly used constants
/// Number of characters in a generated ID
pub const ID_LENGTH: usize = 20;
/// Characters to use for generating NanoID
pub(crate) const ALPHABETS: [char; 62] = [
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i',
'j', 'k', 'l', 'm', 'n',... | 1,928 | 2,039 |
hyperswitch | crates/common_utils/src/types.rs | .rs | //! Types that can be used in other crates
pub mod keymanager;
/// Enum for Authentication Level
pub mod authentication;
/// Enum for Theme Lineage
pub mod theme;
/// types that are wrappers around primitive types
pub mod primitive_wrappers;
use std::{
borrow::Cow,
fmt::Display,
iter::Sum,
ops::{Add,... | 12,357 | 2,040 |
hyperswitch | crates/common_utils/src/payout_method_utils.rs | .rs | //! This module has common utilities for payout method data in HyperSwitch
use common_enums;
use diesel::{sql_types::Jsonb, AsExpression, FromSqlRow};
use masking::Secret;
use serde::{Deserialize, Serialize};
use utoipa::ToSchema;
use crate::new_type::{
MaskedBankAccount, MaskedBic, MaskedEmail, MaskedIban, Maske... | 2,104 | 2,041 |
hyperswitch | crates/common_utils/src/lib.rs | .rs | #![warn(missing_docs, missing_debug_implementations)]
#![doc = include_str!(concat!(env!("CARGO_MANIFEST_DIR" ), "/", "README.md"))]
use masking::{PeekInterface, Secret};
pub mod access_token;
pub mod consts;
pub mod crypto;
pub mod custom_serde;
#[allow(missing_docs)] // Todo: add docs
pub mod encryption;
pub mod er... | 2,919 | 2,042 |
hyperswitch | crates/common_utils/src/errors.rs | .rs | //! Errors and error specific types for universal use
use crate::types::MinorUnit;
/// Custom Result
/// A custom datatype that wraps the error variant <E> into a report, allowing
/// error_stack::Report<E> specific extendability
///
/// Effectively, equivalent to `Result<T, error_stack::Report<E>>`
pub type CustomRe... | 1,743 | 2,043 |
hyperswitch | crates/common_utils/src/validation.rs | .rs | //! Custom validations for some shared types.
use std::collections::HashSet;
use error_stack::report;
use globset::Glob;
use once_cell::sync::Lazy;
use regex::Regex;
#[cfg(feature = "logs")]
use router_env::logger;
use crate::errors::{CustomResult, ValidationError};
/// Validates a given phone number using the [pho... | 1,173 | 2,044 |
hyperswitch | crates/common_utils/src/events.rs | .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 {
... | 1,245 | 2,045 |
hyperswitch | crates/common_utils/src/macros.rs | .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
}
}
... | 3,316 | 2,046 |
hyperswitch | crates/common_utils/src/types/authentication.rs | .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 {
... | 421 | 2,047 |
hyperswitch | crates/common_utils/src/types/keymanager.rs | .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::tracing_actix_web::RequestId;
use rustc_hash::FxHashMap;
... | 3,524 | 2,048 |
hyperswitch | crates/common_utils/src/types/primitive_wrappers.rs | .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)]
... | 927 | 2,049 |
hyperswitch | crates/common_utils/src/types/theme.rs | .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... | 1,250 | 2,050 |
hyperswitch | crates/common_utils/src/id_type/merchant.rs | .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 std::fmt::Display;
use crate::{
date_time,
errors::{CustomResult, ValidationError},
generate_id_with_default_len,
id_type::{Al... | 1,750 | 2,051 |
hyperswitch | crates/common_utils/src/id_type/organization.rs | .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... | 206 | 2,052 |
hyperswitch | crates/common_utils/src/id_type/relay.rs | .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... | 200 | 2,053 |
hyperswitch | crates/common_utils/src/id_type/routing.rs | .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... | 181 | 2,054 |
hyperswitch | crates/common_utils/src/id_type/payment.rs | .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... | 854 | 2,055 |
hyperswitch | crates/common_utils/src/id_type/customer.rs | .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... | 219 | 2,056 |
hyperswitch | crates/common_utils/src/id_type/api_key.rs | .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_... | 366 | 2,057 |
hyperswitch | crates/common_utils/src/id_type/refunds.rs | .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, ... | 133 | 2,058 |
hyperswitch | crates/common_utils/src/id_type/global_id.rs | .rs | pub(super) mod customer;
pub(super) mod payment;
pub(super) mod payment_methods;
pub(super) mod refunds;
use diesel::{backend::Backend, deserialize::FromSql, serialize::ToSql, sql_types};
use error_stack::ResultExt;
use thiserror::Error;
use crate::{
consts::{CELL_IDENTIFIER_LENGTH, MAX_GLOBAL_ID_LENGTH, MIN_GLOB... | 2,032 | 2,059 |
hyperswitch | crates/common_utils/src/id_type/tenant.rs | .rs | use crate::{
consts::DEFAULT_GLOBAL_TENANT_ID,
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` as TenantId(abcd... | 251 | 2,060 |
hyperswitch | crates/common_utils/src/id_type/merchant_connector_account.rs | .rs | 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 display the `MerchantConne... | 216 | 2,061 |
hyperswitch | crates/common_utils/src/id_type/client_secret.rs | .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... | 266 | 2,062 |
hyperswitch | crates/common_utils/src/id_type/profile.rs | .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... | 334 | 2,063 |
hyperswitch | crates/common_utils/src/id_type/global_id/payment.rs | .rs | use common_enums::enums;
use error_stack::ResultExt;
use crate::{errors, generate_id_with_default_len, generate_time_ordered_id_without_prefix, types};
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>... | 842 | 2,064 |
hyperswitch | crates/common_utils/src/id_type/global_id/customer.rs | .rs | use error_stack::ResultExt;
use crate::{errors, generate_id_with_default_len, generate_time_ordered_id_without_prefix, types};
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... | 380 | 2,065 |
hyperswitch | crates/common_utils/src/id_type/global_id/refunds.rs | .rs | use error_stack::ResultExt;
use crate::{errors, generate_id_with_default_len, generate_time_ordered_id_without_prefix, types};
/// A global id that can be used to identify a refund
#[derive(
Debug,
Clone,
Hash,
PartialEq,
Eq,
serde::Serialize,
serde::Deserialize,
diesel::expression::As... | 586 | 2,066 |
hyperswitch | crates/common_utils/src/id_type/global_id/payment_methods.rs | .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... | 1,319 | 2,067 |
hyperswitch | crates/common_utils/src/metrics/utils.rs | .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;
... | 213 | 2,068 |
hyperswitch | crates/hyperswitch_connectors/Cargo.toml | .toml | [package]
name = "hyperswitch_connectors"
version = "0.1.0"
edition.workspace = true
rust-version.workspace = true
license.workspace = true
[features]
frm = ["hyperswitch_domain_models/frm", "hyperswitch_interfaces/frm"]
payouts = ["hyperswitch_domain_models/payouts", "api_models/payouts", "hyperswitch_interfaces/payo... | 902 | 2,069 |
hyperswitch | crates/hyperswitch_connectors/src/metrics.rs | .rs | //! Metrics interface
use router_env::{counter_metric, global_meter};
global_meter!(GLOBAL_METER, "ROUTER_API");
counter_metric!(CONNECTOR_RESPONSE_DESERIALIZATION_FAILURE, GLOBAL_METER);
| 42 | 2,070 |
hyperswitch | crates/hyperswitch_connectors/src/utils.rs | .rs | use std::{
collections::{HashMap, HashSet},
marker::PhantomData,
str::FromStr,
};
use api_models::payments;
#[cfg(feature = "payouts")]
use api_models::payouts::PayoutVendorAccountDetails;
use base64::Engine;
use common_enums::{
enums,
enums::{
AlbaniaStatesAbbreviation, AndorraStatesAbbrev... | 68,325 | 2,071 |
hyperswitch | crates/hyperswitch_connectors/src/default_implementations_v2.rs | .rs | use hyperswitch_domain_models::{
router_data::AccessToken,
router_data_v2::{
flow_common_types::{
BillingConnectorPaymentsSyncFlowData, DisputesFlowData, MandateRevokeFlowData,
PaymentFlowData, RefundFlowData, RevenueRecoveryRecordBackData,
WebhookSourceVerifyData,
... | 18,725 | 2,072 |
hyperswitch | crates/hyperswitch_connectors/src/types.rs | .rs | #[cfg(feature = "payouts")]
use hyperswitch_domain_models::types::{PayoutsData, PayoutsResponseData};
use hyperswitch_domain_models::{
router_data::{AccessToken, RouterData},
router_flow_types::{
Accept, AccessTokenAuth, Authorize, Capture, Defend, Evidence, PSync, PreProcessing,
Session, Upload... | 628 | 2,073 |
hyperswitch | crates/hyperswitch_connectors/src/lib.rs | .rs | //! Hyperswitch connectors
pub mod connectors;
pub mod constants;
pub mod default_implementations;
pub mod default_implementations_v2;
pub mod metrics;
pub mod types;
pub mod utils;
| 42 | 2,074 |
hyperswitch | crates/hyperswitch_connectors/src/connectors.rs | .rs | pub mod aci;
pub mod adyen;
pub mod airwallex;
pub mod amazonpay;
pub mod authorizedotnet;
pub mod bambora;
pub mod bamboraapac;
pub mod bankofamerica;
pub mod billwerk;
pub mod bitpay;
pub mod bluesnap;
pub mod boku;
pub mod braintree;
pub mod cashtocode;
pub mod chargebee;
pub mod checkout;
pub mod coinbase;
pub mod ... | 1,092 | 2,075 |
hyperswitch | crates/hyperswitch_connectors/src/default_implementations.rs | .rs | // impl api::PaymentIncrementalAuthorization for Helcim {}
// impl api::ConnectorCustomer for Helcim {}
// impl api::PaymentsPreProcessing for Helcim {}
// impl api::PaymentReject for Helcim {}
// impl api::PaymentApprove for Helcim {}
use common_utils::errors::CustomResult;
#[cfg(feature = "frm")]
use hyperswitch_doma... | 28,210 | 2,076 |
hyperswitch | crates/hyperswitch_connectors/src/constants.rs | .rs | /// Header Constants
pub(crate) mod headers {
pub(crate) const ACCEPT: &str = "Accept";
pub(crate) const API_KEY: &str = "API-KEY";
pub(crate) const APIKEY: &str = "apikey";
pub(crate) const API_TOKEN: &str = "Api-Token";
pub(crate) const AUTHORIZATION: &str = "Authorization";
pub(crate) const C... | 717 | 2,077 |
hyperswitch | crates/hyperswitch_connectors/src/connectors/fiserv.rs | .rs | pub mod transformers;
use base64::Engine;
use common_enums::enums;
use common_utils::{
errors::CustomResult,
ext_traits::BytesExt,
request::{Method, Request, RequestBuilder, RequestContent},
types::{AmountConvertor, FloatMajorUnit, FloatMajorUnitForConnector},
};
use error_stack::{report, ResultExt};
u... | 6,075 | 2,078 |
hyperswitch | crates/hyperswitch_connectors/src/connectors/checkout.rs | .rs | pub mod transformers;
use common_enums::{enums, CallConnectorAction, PaymentAction};
use common_utils::{
crypto,
errors::CustomResult,
ext_traits::ByteSliceExt,
request::{Method, Request, RequestBuilder, RequestContent},
types::{AmountConvertor, MinorUnit, MinorUnitForConnector},
};
use error_stack... | 11,639 | 2,079 |
hyperswitch | crates/hyperswitch_connectors/src/connectors/bluesnap.rs | .rs | pub mod transformers;
use api_models::webhooks::IncomingWebhookEvent;
use base64::Engine;
use common_enums::{enums, CallConnectorAction, PaymentAction};
use common_utils::{
consts::BASE64_ENGINE,
crypto,
errors::CustomResult,
ext_traits::{BytesExt, StringExt, ValueExt},
request::{Method, Request, R... | 12,000 | 2,080 |
hyperswitch | crates/hyperswitch_connectors/src/connectors/payu.rs | .rs | pub mod transformers;
use std::sync::LazyLock;
use api_models::webhooks::IncomingWebhookEvent;
use common_enums::enums;
use common_utils::{
errors::CustomResult,
ext_traits::ByteSliceExt,
request::{Method, Request, RequestBuilder, RequestContent},
types::{AmountConvertor, MinorUnit, MinorUnitForConnect... | 6,534 | 2,081 |
hyperswitch | crates/hyperswitch_connectors/src/connectors/bitpay.rs | .rs | pub mod transformers;
use std::sync::LazyLock;
use api_models::webhooks::IncomingWebhookEvent;
use common_enums::enums;
use common_utils::{
errors::{CustomResult, ReportSwitchExt},
ext_traits::ByteSliceExt,
request::{Method, Request, RequestBuilder, RequestContent},
types::{AmountConvertor, FloatMajorU... | 3,496 | 2,082 |
hyperswitch | crates/hyperswitch_connectors/src/connectors/iatapay.rs | .rs | pub mod transformers;
use api_models::{enums, webhooks::IncomingWebhookEvent};
use base64::Engine;
use common_utils::{
consts::BASE64_ENGINE,
crypto,
errors::CustomResult,
ext_traits::{ByteSliceExt, BytesExt},
request::{Method, Request, RequestBuilder, RequestContent},
types::{AmountConvertor, ... | 6,857 | 2,083 |
hyperswitch | crates/hyperswitch_connectors/src/connectors/ctp_mastercard.rs | .rs | use common_utils::errors::CustomResult;
use error_stack::report;
use hyperswitch_domain_models::{
router_data::{AccessToken, RouterData},
router_flow_types::{
access_token_auth::AccessTokenAuth,
payments::{Authorize, Capture, PSync, PaymentMethodToken, Session, SetupMandate, Void},
refun... | 1,012 | 2,084 |
hyperswitch | crates/hyperswitch_connectors/src/connectors/opennode.rs | .rs | pub mod transformers;
use std::fmt::Debug;
use common_utils::{
crypto,
errors::CustomResult,
ext_traits::BytesExt,
request::{Method, Request, RequestBuilder, RequestContent},
};
use error_stack::ResultExt;
use hyperswitch_domain_models::{
router_data::{AccessToken, ConnectorAuthType, ErrorResponse... | 3,415 | 2,085 |
hyperswitch | crates/hyperswitch_connectors/src/connectors/globepay.rs | .rs | pub mod transformers;
use common_utils::{
crypto::{self, GenerateDigest},
errors::CustomResult,
ext_traits::BytesExt,
request::{Method, Request, RequestBuilder, RequestContent},
types::{AmountConvertor, MinorUnit, MinorUnitForConnector},
};
use error_stack::{report, ResultExt};
use hex::encode;
use... | 4,297 | 2,086 |
hyperswitch | crates/hyperswitch_connectors/src/connectors/coinbase.rs | .rs | pub mod transformers;
use std::fmt::Debug;
use common_enums::enums;
use common_utils::{
crypto,
errors::CustomResult,
ext_traits::ByteSliceExt,
request::{Method, Request, RequestBuilder, RequestContent},
};
use error_stack::ResultExt;
use hyperswitch_domain_models::{
configs::Connectors,
route... | 3,706 | 2,087 |
hyperswitch | crates/hyperswitch_connectors/src/connectors/coingate.rs | .rs | pub mod transformers;
use common_enums::{CaptureMethod, PaymentMethod, PaymentMethodType};
use common_utils::{
crypto,
errors::CustomResult,
ext_traits::{ByteSliceExt, BytesExt, ValueExt},
request::{Method, Request, RequestBuilder, RequestContent},
types::{AmountConvertor, StringMajorUnit, StringMa... | 4,888 | 2,088 |
hyperswitch | crates/hyperswitch_connectors/src/connectors/powertranz.rs | .rs | pub mod transformers;
use std::fmt::Debug;
use api_models::enums::AuthenticationType;
use common_enums::enums;
use common_utils::{
errors::CustomResult,
ext_traits::{BytesExt, ValueExt},
request::{Method, Request, RequestBuilder, RequestContent},
};
use error_stack::{report, ResultExt};
use hyperswitch_do... | 5,214 | 2,089 |
hyperswitch | crates/hyperswitch_connectors/src/connectors/jpmorgan.rs | .rs | pub mod transformers;
use std::sync::LazyLock;
use base64::Engine;
use common_enums::enums;
use common_utils::{
errors::CustomResult,
ext_traits::BytesExt,
request::{Method, Request, RequestBuilder, RequestContent},
types::{AmountConvertor, MinorUnit, MinorUnitForConnector},
};
use error_stack::{report... | 6,595 | 2,090 |
hyperswitch | crates/hyperswitch_connectors/src/connectors/novalnet.rs | .rs | pub mod transformers;
use core::str;
use std::{collections::HashSet, sync::LazyLock};
use base64::Engine;
use common_enums::enums;
use common_utils::{
crypto,
errors::CustomResult,
ext_traits::{ByteSliceExt, BytesExt},
request::{Method, Request, RequestBuilder, RequestContent},
types::{AmountConver... | 8,693 | 2,091 |
hyperswitch | crates/hyperswitch_connectors/src/connectors/trustpay.rs | .rs | pub mod transformers;
use base64::Engine;
use common_enums::{enums, PaymentAction};
use common_utils::{
crypto,
errors::{CustomResult, ReportSwitchExt},
ext_traits::ByteSliceExt,
request::{Method, Request, RequestBuilder, RequestContent},
types::{AmountConvertor, StringMajorUnit, StringMajorUnitFor... | 9,417 | 2,092 |
hyperswitch | crates/hyperswitch_connectors/src/connectors/paybox.rs | .rs | pub mod transformers;
use std::sync::LazyLock;
use api_models::webhooks::{IncomingWebhookEvent, ObjectReferenceId};
use common_enums::{enums, CallConnectorAction, PaymentAction};
use common_utils::{
errors::CustomResult,
ext_traits::BytesExt,
request::{Method, Request, RequestBuilder, RequestContent},
... | 5,773 | 2,093 |
hyperswitch | crates/hyperswitch_connectors/src/connectors/volt.rs | .rs | pub mod transformers;
use api_models::webhooks::IncomingWebhookEvent;
use common_enums::enums;
use common_utils::{
crypto,
errors::CustomResult,
ext_traits::ByteSliceExt,
request::{Method, Request, RequestBuilder, RequestContent},
types::{AmountConvertor, MinorUnit, MinorUnitForConnector},
};
use e... | 5,740 | 2,094 |
hyperswitch | crates/hyperswitch_connectors/src/connectors/noon.rs | .rs | pub mod transformers;
use api_models::webhooks::{ConnectorWebhookSecrets, IncomingWebhookEvent, ObjectReferenceId};
use base64::Engine;
use common_enums::enums;
use common_utils::{
crypto,
errors::CustomResult,
ext_traits::ByteSliceExt,
request::{Method, Request, RequestBuilder, RequestContent},
ty... | 7,035 | 2,095 |
hyperswitch | crates/hyperswitch_connectors/src/connectors/rapyd.rs | .rs | pub mod transformers;
use api_models::webhooks::IncomingWebhookEvent;
use base64::Engine;
use common_enums::enums;
use common_utils::{
consts::BASE64_ENGINE_URL_SAFE,
crypto, date_time,
errors::CustomResult,
ext_traits::{ByteSliceExt, BytesExt, Encode, StringExt},
request::{Method, Request, Request... | 8,643 | 2,096 |
hyperswitch | crates/hyperswitch_connectors/src/connectors/fiservemea.rs | .rs | pub mod transformers;
use base64::Engine;
use common_enums::enums;
use common_utils::{
errors::CustomResult,
ext_traits::BytesExt,
request::{Method, Request, RequestBuilder, RequestContent},
types::{AmountConvertor, StringMajorUnit, StringMajorUnitForConnector},
};
use error_stack::{report, ResultExt};... | 6,635 | 2,097 |
hyperswitch | crates/hyperswitch_connectors/src/connectors/nuvei.rs | .rs | pub mod transformers;
use std::fmt::Debug;
use api_models::{payments::PaymentIdType, webhooks::IncomingWebhookEvent};
use common_enums::{enums, CallConnectorAction, PaymentAction};
use common_utils::{
crypto,
errors::{CustomResult, ReportSwitchExt},
ext_traits::{ByteSliceExt, BytesExt, ValueExt},
id_t... | 7,270 | 2,098 |
hyperswitch | crates/hyperswitch_connectors/src/connectors/worldpay.rs | .rs | mod requests;
mod response;
pub mod transformers;
use api_models::{payments::PaymentIdType, webhooks::IncomingWebhookEvent};
use common_enums::{enums, PaymentAction};
use common_utils::{
crypto,
errors::CustomResult,
ext_traits::{ByteSliceExt, BytesExt},
request::{Method, Request, RequestBuilder, Reque... | 9,482 | 2,099 |
hyperswitch | crates/hyperswitch_connectors/src/connectors/billwerk.rs | .rs | pub mod transformers;
use api_models::webhooks::{IncomingWebhookEvent, ObjectReferenceId};
use base64::Engine;
use common_enums::enums;
use common_utils::{
consts::BASE64_ENGINE,
errors::CustomResult,
ext_traits::BytesExt,
request::{Method, Request, RequestBuilder, RequestContent},
types::{AmountCo... | 6,543 | 2,100 |
hyperswitch | crates/hyperswitch_connectors/src/connectors/getnet.rs | .rs | pub mod transformers;
use api_models::webhooks::IncomingWebhookEvent;
use base64::{self, Engine};
use common_enums::enums;
use common_utils::{
consts::BASE64_ENGINE,
crypto,
errors::CustomResult,
ext_traits::BytesExt,
request::{Method, Request, RequestBuilder, RequestContent},
types::{AmountConv... | 6,291 | 2,101 |
hyperswitch | crates/hyperswitch_connectors/src/connectors/hipay.rs | .rs | pub mod transformers;
use base64::Engine;
use common_enums::{CaptureMethod, PaymentMethod, PaymentMethodType};
use common_utils::{
consts::BASE64_ENGINE,
errors::{self as common_errors, CustomResult},
ext_traits::BytesExt,
request::{Method, Request, RequestBuilder, RequestContent},
types::{AmountCon... | 5,929 | 2,102 |
hyperswitch | crates/hyperswitch_connectors/src/connectors/braintree.rs | .rs | pub mod transformers;
use api_models::webhooks::IncomingWebhookEvent;
use base64::Engine;
use common_enums::{enums, CallConnectorAction, PaymentAction};
use common_utils::{
consts::BASE64_ENGINE,
crypto,
errors::{CustomResult, ParsingError},
ext_traits::{BytesExt, XmlExt},
request::{Method, Request... | 9,746 | 2,103 |
hyperswitch | crates/hyperswitch_connectors/src/connectors/klarna.rs | .rs | pub mod transformers;
use api_models::webhooks::IncomingWebhookEvent;
use base64::Engine;
use common_enums::enums;
use common_utils::{
consts::BASE64_ENGINE,
errors::CustomResult,
ext_traits::BytesExt,
request::{Method, Request, RequestBuilder, RequestContent},
types::{AmountConvertor, MinorUnit, M... | 12,912 | 2,104 |
hyperswitch | crates/hyperswitch_connectors/src/connectors/cashtocode.rs | .rs | pub mod transformers;
use base64::Engine;
use common_enums::enums;
use common_utils::{
errors::CustomResult,
ext_traits::ByteSliceExt,
request::{Method, Request, RequestBuilder, RequestContent},
types::{AmountConvertor, FloatMajorUnit, FloatMajorUnitForConnector},
};
use error_stack::ResultExt;
use hype... | 3,681 | 2,105 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.