text stringlengths 70 351k | source stringclasses 4 values |
|---|---|
<|fim_prefix|>
// file: hyperswitch/crates/euclid/src/dssa/analyzer.rs | crate: euclid
use hyperswitch_constraint_graph::{ConstraintGraph, Memoization};
use crate::{
dssa::{
graph::CgraphExt,
state_machine, truth,
types::{self, EuclidAnalysable},
},
frontend::{
ast,
dir::{self, EuclidDirFilter},
vir,
},
types::{DataType, Metadata},
};
fn perform_context_analyses(
context: &types::ConjunctiveContext<'_>,
knowledge_graph: &ConstraintGraph<dir::DirValue>,
) -> Result<(), types::AnalysisError> {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
// file: hyperswitch/crates/api_models/src/events.rs | crate: api_models
use common_utils::{
events::{ApiEventMetric, ApiEventsType},
impl_api_event_type,
};
fn get_api_event_type(&self) -> Option<ApiEventsType> {
Some(ApiEventsType::PaymentMethodSession {
payment_method_session_id: self.id.clone(),
})
} | ast_fragments |
// file: hyperswitch/crates/api_models/src/events.rs | crate: api_models
use common_utils::{
events::{ApiEventMetric, ApiEventsType},
impl_api_event_type,
};
fn get_api_event_type(&self) -> Option<ApiEventsType> {
Some(ApiEventsType::PaymentMethodCreate)
} | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/organization.rs | crate: api_models
use common_utils::{id_type, pii};
pub fn new(org_name: Option<String>) -> Self {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/surcharge_decision_configs.rs | crate: api_models
use common_utils::{
consts::SURCHARGE_PERCENTAGE_PRECISION_LENGTH,
events,
types::{MinorUnit, Percentage},
};
fn get_api_event_type(&self) -> Option<events::ApiEventsType> {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
// file: hyperswitch/crates/api_models/src/surcharge_decision_configs.rs | crate: api_models
use common_utils::{
consts::SURCHARGE_PERCENTAGE_PRECISION_LENGTH,
events,
types::{MinorUnit, Percentage},
};
fn get_api_event_type(&self) -> Option<events::ApiEventsType> {
Some(events::ApiEventsType::Routing)
} | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/disputes.rs | crate: api_models
use std::collections::HashMap;
use serde::de::Error;
fn parse_comma_separated<'de, D, T>(v: D) -> Result<Option<Vec<T>>, D::Error>
where
D: serde::Deserializer<'de>,
T: std::str::FromStr,
<T as std::str::FromStr>::Err: std::fmt::Debug + std::fmt::Display + std::error::Error,
{
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/enums.rs | crate: api_models
fn from(scope: PermissionScope) -> Self {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/enums.rs | crate: api_models
use std::str::FromStr;
pub use common_enums::*;
pub use super::connector_enums::Connector;
pub fn convert_frm_connector(connector_name: &str) -> Option<FrmConnectors> {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/enums.rs | crate: api_models
use std::str::FromStr;
pub use common_enums::*;
pub use super::connector_enums::Connector;
pub fn convert_billing_connector(connector_name: &str) -> Option<BillingConnectors> {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/enums.rs | crate: api_models
use std::str::FromStr;
pub use common_enums::*;
pub use super::connector_enums::Connector;
pub fn convert_tax_connector(connector_name: &str) -> Option<TaxConnectors> {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/enums.rs | crate: api_models
use std::str::FromStr;
pub use common_enums::*;
pub use super::connector_enums::Connector;
pub fn convert_authentication_connector(connector_name: &str) -> Option<AuthenticationConnectors> {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/enums.rs | crate: api_models
use std::str::FromStr;
pub use common_enums::*;
pub use super::connector_enums::Connector;
pub fn convert_pm_auth_connector(connector_name: &str) -> Option<PmAuthConnectors> {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/enums.rs | crate: api_models
fn test_partialeq_for_field_type() {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/enums.rs | crate: api_models
pub use common_enums::*;
pub use super::connector_enums::Connector;
pub fn get_shipping_variants() -> Vec<Self> {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/enums.rs | crate: api_models
pub use common_enums::*;
pub use super::connector_enums::Connector;
pub fn get_billing_variants() -> Vec<Self> {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/enums.rs | crate: api_models
pub use super::connector_enums::Connector;
fn try_from(value: Connector) -> Result<Self, Self::Error> {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/enums.rs | crate: api_models
fn from(value: PayoutConnectors) -> Self {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/blocklist.rs | crate: api_models
fn default_list_limit() -> u16 {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/customers.rs | crate: api_models
use crate::payments;
pub fn get_default_customer_shipping_address(&self) -> Option<payments::AddressDetails> {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/customers.rs | crate: api_models
use common_utils::{crypto, custom_serde, id_type, pii, types::Description};
pub fn get_merchant_reference_id(&self) -> Option<id_type::CustomerId> {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/customers.rs | crate: api_models
use crate::payments;
pub fn get_address(&self) -> Option<payments::AddressDetails> {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/customers.rs | crate: api_models
use common_utils::{crypto, custom_serde, id_type, pii, types::Description};
pub fn get_optional_email(&self) -> Option<pii::Email> {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/customers.rs | crate: api_models
use crate::payments;
pub fn get_default_customer_billing_address(&self) -> Option<payments::AddressDetails> {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/mandates.rs | crate: api_models
pub fn is_network_transaction_id_and_card_details_flow(self) -> bool {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/webhook_events.rs | crate: api_models
pub fn new(total_count: i64, events: Vec<EventListItemResponse>) -> Self {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/errors/actix.rs | crate: api_models
use super::types::ApiErrorResponse;
fn error_response(&self) -> actix_web::HttpResponse {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
// file: hyperswitch/crates/api_models/src/errors/actix.rs | crate: api_models
use super::types::ApiErrorResponse;
fn status_code(&self) -> reqwest::StatusCode {
use reqwest::StatusCode;
match self {
Self::Unauthorized(_) => StatusCode::UNAUTHORIZED,
Self::ForbiddenCommonResource(_) => StatusCode::FORBIDDEN,
Self::ForbiddenPrivateResource(_) => StatusCode::NOT_FOUND,
Self::Conflict(_) => StatusCode::CONFLICT,
Self::Gone(_) => StatusCode::GONE,
Self::Unprocessable(_) => StatusCode::UNPROCESSABLE_ENTITY,
Self::InternalServerError(_) => StatusCode::INTERNAL_SERVER_ERROR,
Self::NotImplemented(_) => StatusCode::NOT_IMPLEMENTED,
Self::ConnectorError(_, code) => *code,
Self::MethodNotAllowed(_) => StatusCode::METHOD_NOT_ALLOWED,
Self::NotFound(_) => StatusCode::NOT_FOUND,
Self::BadRequest(_) => StatusCode::BAD_REQUEST,
Self::DomainError(_) => StatusCode::OK,
}
} | ast_fragments |
// file: hyperswitch/crates/api_models/src/events/dispute.rs | crate: api_models
use common_utils::events::{ApiEventMetric, ApiEventsType};
fn get_api_event_type(&self) -> Option<ApiEventsType> {
Some(ApiEventsType::ResourceListAPI)
} | ast_fragments |
// file: hyperswitch/crates/api_models/src/events/payouts.rs | crate: api_models
use common_utils::events::{ApiEventMetric, ApiEventsType};
fn get_api_event_type(&self) -> Option<ApiEventsType> {
Some(ApiEventsType::Payout {
payout_id: self.payout_id.clone(),
})
} | ast_fragments |
// file: hyperswitch/crates/api_models/src/events/recon.rs | crate: api_models
use common_utils::events::{ApiEventMetric, ApiEventsType};
fn get_api_event_type(&self) -> Option<ApiEventsType> {
Some(ApiEventsType::Recon)
} | ast_fragments |
// file: hyperswitch/crates/api_models/src/events/gsm.rs | crate: api_models
use common_utils::events::{ApiEventMetric, ApiEventsType};
fn get_api_event_type(&self) -> Option<ApiEventsType> {
Some(ApiEventsType::Gsm)
} | ast_fragments |
// file: hyperswitch/crates/api_models/src/events/revenue_recovery.rs | crate: api_models
use common_utils::events::{ApiEventMetric, ApiEventsType};
fn get_api_event_type(&self) -> Option<ApiEventsType> {
Some(ApiEventsType::ProcessTracker)
} | ast_fragments |
// file: hyperswitch/crates/api_models/src/events/routing.rs | crate: api_models
use common_utils::events::{ApiEventMetric, ApiEventsType};
fn get_api_event_type(&self) -> Option<ApiEventsType> {
Some(ApiEventsType::Routing)
} | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/analytics/payment_intents.rs | crate: api_models
use super::{ForexMetric, NameDescription, TimeRange};
use crate::enums::{
AuthenticationType, Connector, Currency, IntentStatus, PaymentMethod, PaymentMethodType,
};
pub fn new(
status: Option<IntentStatus>,
currency: Option<Currency>,
profile_id: Option<String>,
connector: Option<String>,
auth_type: Option<AuthenticationType>,
payment_method: Option<String>,
payment_method_type: Option<String>,
card_network: Option<String>,
merchant_id: Option<String>,
card_last_4: Option<String>,
card_issuer: Option<String>,
error_reason: Option<String>,
normalized_time_range: TimeRange,
) -> Self {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/analytics/payment_intents.rs | crate: api_models
fn from(value: PaymentIntentDimensions) -> Self {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/analytics/payment_intents.rs | crate: api_models
fn from(value: PaymentIntentMetrics) -> Self {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/analytics/payment_intents.rs | crate: api_models
fn is_forex_metric(&self) -> bool {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/analytics/api_event.rs | crate: api_models
use super::{NameDescription, TimeRange};
pub fn new(normalized_time_range: TimeRange) -> Self {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/analytics/api_event.rs | crate: api_models
fn from(value: ApiEventMetrics) -> Self {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/analytics/api_event.rs | crate: api_models
fn from(value: ApiEventDimensions) -> Self {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/analytics/payments.rs | crate: api_models
use super::{ForexMetric, NameDescription, TimeRange};
use crate::enums::{
AttemptStatus, AuthenticationType, CardNetwork, Connector, Currency, PaymentMethod,
PaymentMethodType,
};
pub fn new(
currency: Option<Currency>,
status: Option<AttemptStatus>,
connector: Option<String>,
auth_type: Option<AuthenticationType>,
payment_method: Option<String>,
payment_method_type: Option<String>,
client_source: Option<String>,
client_version: Option<String>,
profile_id: Option<String>,
card_network: Option<String>,
merchant_id: Option<String>,
card_last_4: Option<String>,
card_issuer: Option<String>,
error_reason: Option<String>,
normalized_time_range: TimeRange,
) -> Self {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/analytics/payments.rs | crate: api_models
use std::{
collections::hash_map::DefaultHasher,
hash::{Hash, Hasher},
};
fn hash<H: Hasher>(&self, state: &mut H) {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/analytics/payments.rs | crate: api_models
fn from(value: PaymentDimensions) -> Self {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/analytics/payments.rs | crate: api_models
fn from(value: PaymentMetrics) -> Self {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/analytics/disputes.rs | crate: api_models
use super::{ForexMetric, NameDescription, TimeRange};
use crate::enums::{Currency, DisputeStage};
pub fn new(
dispute_stage: Option<DisputeStage>,
connector: Option<String>,
currency: Option<Currency>,
normalized_time_range: TimeRange,
) -> Self {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/analytics/disputes.rs | crate: api_models
fn from(value: DisputeMetrics) -> Self {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/analytics/disputes.rs | crate: api_models
fn from(value: DisputeDimensions) -> Self {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/analytics/frm.rs | crate: api_models
use super::{NameDescription, TimeRange};
pub fn new(
frm_status: Option<String>,
frm_name: Option<String>,
frm_transaction_type: Option<String>,
normalized_time_range: TimeRange,
) -> Self {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/analytics/frm.rs | crate: api_models
fn from(value: FrmDimensions) -> Self {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/analytics/frm.rs | crate: api_models
fn from(value: FrmMetrics) -> Self {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
// file: hyperswitch/crates/api_models/src/analytics/active_payments.rs | crate: api_models
use std::{
collections::hash_map::DefaultHasher,
hash::{Hash, Hasher},
};
fn eq(&self, other: &Self) -> bool {
let mut left = DefaultHasher::new();
self.hash(&mut left);
let mut right = DefaultHasher::new();
other.hash(&mut right);
left.finish() == right.finish()
} | ast_fragments |
// file: hyperswitch/crates/api_models/src/analytics/active_payments.rs | crate: api_models
use std::{
collections::hash_map::DefaultHasher,
hash::{Hash, Hasher},
};
fn hash<H: Hasher>(&self, state: &mut H) {
self.time_bucket.hash(state);
} | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/analytics/active_payments.rs | crate: api_models
pub fn new(time_bucket: Option<String>) -> Self {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/analytics/active_payments.rs | crate: api_models
fn from(value: ActivePaymentsMetrics) -> Self {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/analytics/search.rs | crate: api_models
pub fn is_all_none(&self) -> bool {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/analytics/sdk_events.rs | crate: api_models
pub fn new(
payment_method: Option<String>,
platform: Option<String>,
browser_name: Option<String>,
source: Option<String>,
component: Option<String>,
payment_experience: Option<String>,
time_bucket: Option<String>,
) -> Self {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/analytics/sdk_events.rs | crate: api_models
fn from(value: SdkEventDimensions) -> Self {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/analytics/sdk_events.rs | crate: api_models
fn from(value: SdkEventMetrics) -> Self {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router_env/tests/logger.rs | crate: router_env
use self::test_module::fn_with_colon;
async fn basic() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router_env/tests/logger.rs | crate: router_env
use ::config::ConfigError;
use router_env::TelemetryGuard;
use self::test_module::fn_with_colon;
fn logger() -> error_stack::Result<&'static TelemetryGuard, ConfigError> {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router_env/tests/test_module.rs | crate: router_env
use router_env as logger;
pub async fn fn_without_colon(val: i32) {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router_env/tests/test_module.rs | crate: router_env
use router_env as logger;
pub async fn fn_with_colon(val: i32) {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router_env/src/vergen.rs | crate: router_env
pub fn generate_cargo_instructions() {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router_env/src/metrics.rs | crate: router_env
pub use helpers::f64_histogram_buckets;
pub fn f64_histogram_buckets() -> Vec<f64> {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router_env/src/logger/config.rs | crate: router_env
use std::path::PathBuf;
/// Constructor expecting config path set explicitly.
pub fn new_with_config_path(
explicit_config_path: Option<PathBuf>,
) -> Result<Self, config::ConfigError> {
{// Configuration values are picked up in the following priority order (1 being least<|fim_suffix|>
<|fim_middle|>
serde_path_to_error::deserialize(config).map_err(|error| {
crate::error!(%error, "Unable to deserialize configuration");
eprintln!("Unable to deserialize application configuration: {error}");
error.into_inner()
})}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router_env/src/logger/config.rs | crate: router_env
use std::path::PathBuf;
/// Get the Directory for the config file
/// Read the env variable `CONFIG_DIR` or fallback to `config`
pub fn get_config_directory() -> PathBuf {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router_env/src/logger/config.rs | crate: router_env
use std::path::PathBuf;
/// Config path.
pub fn config_path(environment: &str, explicit_config_path: Option<PathBuf>) -> PathBuf {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router_env/src/logger/config.rs | crate: router_env
/// Construct config builder extending it by fall-back defaults and setting config file to load.
pub fn builder(
environment: &str,
) -> Result<config::ConfigBuilder<config::builder::DefaultState>, config::ConfigError> {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router_env/src/logger/config.rs | crate: router_env
/// Default constructor.
pub fn new() -> Result<Self, config::ConfigError> {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router_env/src/logger/config.rs | crate: router_env
/// Returns the most verbose [`tracing::Level`]
pub fn into_level(self) -> tracing::Level {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
// file: hyperswitch/crates/router_env/src/logger/defaults.rs | crate: router_env
fn default() -> Self {
Self {
enabled: false,
level: super::config::Level(tracing::Level::INFO),
log_format: super::config::LogFormat::Json,
filtering_directive: None,
}
} | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/payment_methods/src/state.rs | crate: payment_methods
use common_utils::errors::CustomResult;
use hyperswitch_domain_models::{
merchant_account::MerchantAccount, payment_methods::PaymentMethod,
};
use hyperswitch_domain_models::{
merchant_key_store::MerchantKeyStore, payment_methods::PaymentMethodInterface,
};
use storage_impl::{errors, kv_router_store::KVRouterStore, DatabaseStore, MockDb, RouterStore};
pub async fn find_payment_method(
&self,
key_store: &MerchantKeyStore,
merchant_account: &MerchantAccount,
payment_method_id: String,
) -> CustomResult<PaymentMethod, errors::StorageError> {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/payment_methods/src/state.rs | crate: payment_methods
fn from(state: &PaymentMethodsState) -> Self {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/pm_auth/src/types.rs | crate: pm_auth
fn get_not_implemented() -> Self {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/pm_auth/src/types.rs | crate: pm_auth
pub type ExchangeTokenRouterData =
PaymentAuthRouterData<ExchangeToken, ExchangeTokenRequest, ExchangeTokenResponse>;
pub type PaymentAuthExchangeTokenType =
dyn api::ConnectorIntegration<ExchangeToken, ExchangeTokenRequest, ExchangeTokenResponse>;
fn from(value: ExchangeTokenResponse) -> Self {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/external_services/src/grpc_client.rs | crate: external_services
use common_utils::consts;
use router_env::logger;
fn add_headers_to_grpc_request(&mut self, headers: GrpcHeaders) {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/external_services/src/grpc_client.rs | crate: external_services
use std::{fmt::Debug, sync::Arc};
use dynamic_routing::{DynamicRoutingClientConfig, RoutingStrategy};
use health_check_client::HealthCheckClient;
use hyper_util::client::legacy::connect::HttpConnector;
pub type Client = hyper_util::client::legacy::Client<HttpConnector, UnsyncBoxBody<Bytes, Status>>;
pub async fn get_grpc_client_interface(&self) -> Arc<GrpcClients> {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/external_services/src/grpc_client.rs | crate: external_services
use std::{fmt::Debug, sync::Arc};
use router_env::logger;
use tonic::Status;
pub type Client = hyper_util::client::legacy::Client<HttpConnector, UnsyncBoxBody<Bytes, Status>>;
pub(crate) fn create_grpc_request<T: Debug>(message: T, headers: GrpcHeaders) -> tonic::Request<T> {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/external_services/src/hashicorp_vault/core.rs | crate: external_services
fn from_encoded(input: String) -> Option<Self> {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/external_services/src/hashicorp_vault/core.rs | crate: external_services
use std::{collections::HashMap, future::Future, pin::Pin};
use error_stack::{Report, ResultExt};
/// Asynchronously fetches data from HashiCorp Vault using the specified engine.
///
/// # Parameters
///
/// - `data`: A String representing the location or identifier of the data in HashiCorp Vault.
///
/// # Type Parameters
///
/// - `En`: The engine type that implements the `Engine` trait.
/// - `I`: The type that can be constructed from the retrieved encoded data.
pub async fn fetch<En, I>(&self, data: String) -> error_stack::Result<I, HashiCorpError>
where
for<'a> En: Engine<
ReturnType<'a, String> = Pin<
Box<
dyn Future<Output = error_stack::Result<String, HashiCorpError>>
+ Send
+ 'a,
>,
>,
> + 'a,
I: FromEncoded,
{
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/external_services/src/hashicorp_vault/core.rs | crate: external_services
use error_stack::{Report, ResultExt};
use vaultrs::client::{VaultClient, VaultClientSettingsBuilder};
/// Creates a new instance of HashiCorpVault based on the provided configuration.
///
/// # Parameters
///
/// - `config`: A reference to a `HashiCorpVaultConfig` containing the configuration details.
pub fn new(config: &HashiCorpVaultConfig) -> error_stack::Result<Self, HashiCorpError> {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/external_services/src/hashicorp_vault/core.rs | crate: external_services
use std::{collections::HashMap, future::Future, pin::Pin};
use error_stack::{Report, ResultExt};
use vaultrs::client::{VaultClient, VaultClientSettingsBuilder};
fn read(client: &HashiCorpVault, location: String) -> Self::ReturnType<'_, String> {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/external_services/src/hashicorp_vault/core.rs | crate: external_services
use error_stack::{Report, ResultExt};
/// Asynchronously retrieves a HashiCorp Vault client based on the provided configuration.
///
/// # Parameters
///
/// - `config`: A reference to a `HashiCorpVaultConfig` containing the configuration details.
pub async fn get_hashicorp_client(
config: &HashiCorpVaultConfig,
) -> error_stack::Result<&'static HashiCorpVault, HashiCorpError> {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/external_services/src/hashicorp_vault/core.rs | crate: external_services
use common_utils::{ext_traits::ConfigExt, fp_utils::when};
/// Verifies that the [`HashiCorpVault`] configuration is usable.
pub fn validate(&self) -> Result<(), &'static str> {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/external_services/src/hashicorp_vault/implementers.rs | crate: external_services
use common_utils::errors::CustomResult;
use hyperswitch_interfaces::secrets_interface::{
SecretManagementInterface, SecretsManagementError,
};
use masking::{ExposeInterface, Secret};
use crate::hashicorp_vault::core::{HashiCorpVault, Kv2};
async fn get_secret(
&self,
input: Secret<String>,
) -> CustomResult<Secret<String>, SecretsManagementError> {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/external_services/src/file_storage/file_system.rs | crate: external_services
use common_utils::errors::CustomResult;
use crate::file_storage::{FileStorageError, FileStorageInterface};
/// Retrieves the file content associated with the specified file key from the file system.
async fn retrieve_file(&self, file_key: &str) -> CustomResult<Vec<u8>, FileStorageError> {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/external_services/src/file_storage/file_system.rs | crate: external_services
use common_utils::errors::CustomResult;
use crate::file_storage::{FileStorageError, FileStorageInterface};
/// Deletes the file associated with the specified file key from the file system.
async fn delete_file(&self, file_key: &str) -> CustomResult<(), FileStorageError> {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/external_services/src/file_storage/file_system.rs | crate: external_services
use common_utils::errors::CustomResult;
use crate::file_storage::{FileStorageError, FileStorageInterface};
/// Saves the provided file data to the file system under the specified file key.
async fn upload_file(
&self,
file_key: &str,
file: Vec<u8>,
) -> CustomResult<(), FileStorageError> {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/external_services/src/file_storage/file_system.rs | crate: external_services
use std::{
fs::{remove_file, File},
io::{Read, Write},
path::PathBuf,
};
use common_utils::errors::CustomResult;
/// Retrieves the file content associated with the specified file key from the file system.
async fn retrieve_file(&self, file_key: &str) -> CustomResult<Vec<u8>, FileSystemStorageError> {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/external_services/src/file_storage/file_system.rs | crate: external_services
use std::{
fs::{remove_file, File},
io::{Read, Write},
path::PathBuf,
};
use common_utils::errors::CustomResult;
/// Deletes the file associated with the specified file key from the file system.
async fn delete_file(&self, file_key: &str) -> CustomResult<(), FileSystemStorageError> {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/external_services/src/file_storage/file_system.rs | crate: external_services
use std::{
fs::{remove_file, File},
io::{Read, Write},
path::PathBuf,
};
use common_utils::errors::CustomResult;
/// Saves the provided file data to the file system under the specified file key.
async fn upload_file(
&self,
file_key: &str,
file: Vec<u8>,
) -> CustomResult<(), FileSystemStorageError> {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/external_services/src/file_storage/file_system.rs | crate: external_services
use std::{
fs::{remove_file, File},
io::{Read, Write},
path::PathBuf,
};
/// Constructs the file path for a given file key within the file system.
/// The file path is generated based on the workspace path and the provided file key.
fn get_file_path(file_key: impl AsRef<str>) -> PathBuf {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/external_services/src/file_storage/aws_s3.rs | crate: external_services
use common_utils::{errors::CustomResult, ext_traits::ConfigExt};
use crate::file_storage::{FileStorageError, FileStorageInterface};
/// Retrieves a file from AWS S3.
async fn retrieve_file(&self, file_key: &str) -> CustomResult<Vec<u8>, FileStorageError> {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/external_services/src/file_storage/aws_s3.rs | crate: external_services
use common_utils::{errors::CustomResult, ext_traits::ConfigExt};
use crate::file_storage::{FileStorageError, FileStorageInterface};
/// Deletes a file from AWS S3.
async fn delete_file(&self, file_key: &str) -> CustomResult<(), FileStorageError> {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/external_services/src/file_storage/aws_s3.rs | crate: external_services
use common_utils::{errors::CustomResult, ext_traits::ConfigExt};
use crate::file_storage::{FileStorageError, FileStorageInterface};
/// Uploads a file to AWS S3.
async fn upload_file(
&self,
file_key: &str,
file: Vec<u8>,
) -> CustomResult<(), FileStorageError> {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/external_services/src/file_storage/aws_s3.rs | crate: external_services
use aws_sdk_s3::{
operation::{
delete_object::DeleteObjectError, get_object::GetObjectError, put_object::PutObjectError,
},
Client,
};
use common_utils::{errors::CustomResult, ext_traits::ConfigExt};
/// Retrieves a file from AWS S3.
async fn retrieve_file(&self, file_key: &str) -> CustomResult<Vec<u8>, AwsS3StorageError> {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/external_services/src/file_storage/aws_s3.rs | crate: external_services
use aws_sdk_s3::{
operation::{
delete_object::DeleteObjectError, get_object::GetObjectError, put_object::PutObjectError,
},
Client,
};
use common_utils::{errors::CustomResult, ext_traits::ConfigExt};
/// Deletes a file from AWS S3.
async fn delete_file(&self, file_key: &str) -> CustomResult<(), AwsS3StorageError> {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/external_services/src/file_storage/aws_s3.rs | crate: external_services
use aws_sdk_s3::{
operation::{
delete_object::DeleteObjectError, get_object::GetObjectError, put_object::PutObjectError,
},
Client,
};
use common_utils::{errors::CustomResult, ext_traits::ConfigExt};
/// Uploads a file to AWS S3.
async fn upload_file(
&self,
file_key: &str,
file: Vec<u8>,
) -> CustomResult<(), AwsS3StorageError> {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/external_services/src/file_storage/aws_s3.rs | crate: external_services
use aws_config::meta::region::RegionProviderChain;
use aws_sdk_s3::{
operation::{
delete_object::DeleteObjectError, get_object::GetObjectError, put_object::PutObjectError,
},
Client,
};
use aws_sdk_sts::config::Region;
use super::InvalidFileStorageConfig;
/// Creates a new AWS S3 file storage client.
pub(super) async fn new(config: &AwsFileStorageConfig) -> Self {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.