text
stringlengths 65
57.3k
| file_path
stringlengths 22
92
| module
stringclasses 38
values | type
stringclasses 7
values | struct_name
stringlengths 3
60
⌀ | impl_count
int64 0
60
⌀ | traits
listlengths 0
59
⌀ | tokens
int64 16
8.19k
| function_name
stringlengths 3
85
⌀ | type_name
stringlengths 1
67
⌀ | trait_name
stringclasses 573
values | method_count
int64 0
31
⌀ | public_method_count
int64 0
19
⌀ | submodule_count
int64 0
56
⌀ | export_count
int64 0
9
⌀ |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
// Implementation: impl GlobalStorageInterface for for MockDb
// File: crates/router/src/db.rs
// Module: router
// Methods: 1 total (0 public)
impl GlobalStorageInterface for for MockDb
|
crates/router/src/db.rs
|
router
|
impl_block
| null | null | null | 44
| null |
MockDb
|
GlobalStorageInterface for
| 1
| 0
| null | null |
// Struct: DynamicRoutingAlgorithmRef
// File: crates/api_models/src/routing.rs
// Module: api_models
// Implementations: 2
pub struct DynamicRoutingAlgorithmRef
|
crates/api_models/src/routing.rs
|
api_models
|
struct_definition
|
DynamicRoutingAlgorithmRef
| 2
|
[] | 38
| null | null | null | null | null | null | null |
// Struct: PayboxErrorResponse
// File: crates/hyperswitch_connectors/src/connectors/paybox/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct PayboxErrorResponse
|
crates/hyperswitch_connectors/src/connectors/paybox/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
PayboxErrorResponse
| 0
|
[] | 47
| null | null | null | null | null | null | null |
// Implementation: impl webhooks::IncomingWebhook for for Jpmorgan
// File: crates/hyperswitch_connectors/src/connectors/jpmorgan.rs
// Module: hyperswitch_connectors
// Methods: 3 total (0 public)
impl webhooks::IncomingWebhook for for Jpmorgan
|
crates/hyperswitch_connectors/src/connectors/jpmorgan.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 64
| null |
Jpmorgan
|
webhooks::IncomingWebhook for
| 3
| 0
| null | null |
// Implementation: impl SecretsHandler for for PaymentMethodAuth
// File: crates/payment_methods/src/configs/settings.rs
// Module: payment_methods
// Methods: 1 total (0 public)
impl SecretsHandler for for PaymentMethodAuth
|
crates/payment_methods/src/configs/settings.rs
|
payment_methods
|
impl_block
| null | null | null | 48
| null |
PaymentMethodAuth
|
SecretsHandler for
| 1
| 0
| null | null |
// Struct: BraintreeDisputeData
// File: crates/hyperswitch_connectors/src/connectors/braintree/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct BraintreeDisputeData
|
crates/hyperswitch_connectors/src/connectors/braintree/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
BraintreeDisputeData
| 0
|
[] | 52
| null | null | null | null | null | null | null |
// Function: get_wallet_data
// File: crates/hyperswitch_domain_models/src/payment_method_data.rs
// Module: hyperswitch_domain_models
pub fn get_wallet_data(&self) -> Option<&WalletData>
|
crates/hyperswitch_domain_models/src/payment_method_data.rs
|
hyperswitch_domain_models
|
function_signature
| null | null | null | 45
|
get_wallet_data
| null | null | null | null | null | null |
// Implementation: impl PartnerReferralResponse
// File: crates/router/src/types/api/connector_onboarding/paypal.rs
// Module: router
// Methods: 1 total (1 public)
impl PartnerReferralResponse
|
crates/router/src/types/api/connector_onboarding/paypal.rs
|
router
|
impl_block
| null | null | null | 45
| null |
PartnerReferralResponse
| null | 1
| 1
| null | null |
// File: crates/api_models/src/events/refund.rs
// Module: api_models
use common_utils::events::{ApiEventMetric, ApiEventsType};
use crate::refunds::{
self, RefundAggregateResponse, RefundListFilters, RefundListMetaData, RefundListRequest,
RefundListResponse,
};
#[cfg(feature = "v1")]
use crate::refunds::{
RefundManualUpdateRequest, RefundRequest, RefundUpdateRequest, RefundsRetrieveRequest,
};
#[cfg(feature = "v1")]
impl ApiEventMetric for RefundRequest {
fn get_api_event_type(&self) -> Option<ApiEventsType> {
let payment_id = self.payment_id.clone();
self.refund_id
.clone()
.map(|refund_id| ApiEventsType::Refund {
payment_id: Some(payment_id),
refund_id,
})
}
}
#[cfg(feature = "v1")]
impl ApiEventMetric for refunds::RefundResponse {
fn get_api_event_type(&self) -> Option<ApiEventsType> {
Some(ApiEventsType::Refund {
payment_id: Some(self.payment_id.clone()),
refund_id: self.refund_id.clone(),
})
}
}
#[cfg(feature = "v2")]
impl ApiEventMetric for refunds::RefundResponse {
fn get_api_event_type(&self) -> Option<ApiEventsType> {
Some(ApiEventsType::Refund {
payment_id: Some(self.payment_id.clone()),
refund_id: self.id.clone(),
})
}
}
#[cfg(feature = "v1")]
impl ApiEventMetric for RefundsRetrieveRequest {
fn get_api_event_type(&self) -> Option<ApiEventsType> {
Some(ApiEventsType::Refund {
payment_id: None,
refund_id: self.refund_id.clone(),
})
}
}
#[cfg(feature = "v2")]
impl ApiEventMetric for refunds::RefundsRetrieveRequest {
fn get_api_event_type(&self) -> Option<ApiEventsType> {
Some(ApiEventsType::Refund {
payment_id: None,
refund_id: self.refund_id.clone(),
})
}
}
#[cfg(feature = "v1")]
impl ApiEventMetric for RefundUpdateRequest {
fn get_api_event_type(&self) -> Option<ApiEventsType> {
Some(ApiEventsType::Refund {
payment_id: None,
refund_id: self.refund_id.clone(),
})
}
}
#[cfg(feature = "v1")]
impl ApiEventMetric for RefundManualUpdateRequest {
fn get_api_event_type(&self) -> Option<ApiEventsType> {
Some(ApiEventsType::Refund {
payment_id: None,
refund_id: self.refund_id.clone(),
})
}
}
impl ApiEventMetric for RefundListRequest {
fn get_api_event_type(&self) -> Option<ApiEventsType> {
Some(ApiEventsType::ResourceListAPI)
}
}
impl ApiEventMetric for RefundListResponse {
fn get_api_event_type(&self) -> Option<ApiEventsType> {
Some(ApiEventsType::ResourceListAPI)
}
}
impl ApiEventMetric for RefundAggregateResponse {
fn get_api_event_type(&self) -> Option<ApiEventsType> {
Some(ApiEventsType::ResourceListAPI)
}
}
impl ApiEventMetric for RefundListMetaData {
fn get_api_event_type(&self) -> Option<ApiEventsType> {
Some(ApiEventsType::ResourceListAPI)
}
}
impl ApiEventMetric for RefundListFilters {
fn get_api_event_type(&self) -> Option<ApiEventsType> {
Some(ApiEventsType::ResourceListAPI)
}
}
|
crates/api_models/src/events/refund.rs
|
api_models
|
full_file
| null | null | null | 790
| null | null | null | null | null | null | null |
// Struct: AccessTokenErrorResponse
// File: crates/hyperswitch_connectors/src/connectors/deutschebank/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct AccessTokenErrorResponse
|
crates/hyperswitch_connectors/src/connectors/deutschebank/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
AccessTokenErrorResponse
| 0
|
[] | 46
| null | null | null | null | null | null | null |
// Implementation: impl Responder
// File: crates/router/src/routes/payments.rs
// Module: router
// Methods: 0 total (0 public)
impl Responder
|
crates/router/src/routes/payments.rs
|
router
|
impl_block
| null | null | null | 36
| null |
Responder
| null | 0
| 0
| null | null |
// Struct: RefundSuccessCount
// File: crates/api_models/src/analytics/refunds.rs
// Module: api_models
// Implementations: 0
pub struct RefundSuccessCount
|
crates/api_models/src/analytics/refunds.rs
|
api_models
|
struct_definition
|
RefundSuccessCount
| 0
|
[] | 40
| null | null | null | null | null | null | null |
// Function: delete_by_theme_id_and_lineage
// File: crates/diesel_models/src/query/user/theme.rs
// Module: diesel_models
pub fn delete_by_theme_id_and_lineage(
conn: &PgPooledConn,
theme_id: String,
lineage: ThemeLineage,
) -> StorageResult<Self>
|
crates/diesel_models/src/query/user/theme.rs
|
diesel_models
|
function_signature
| null | null | null | 69
|
delete_by_theme_id_and_lineage
| null | null | null | null | null | null |
// Implementation: impl AuthToken
// File: crates/router/src/services/authentication.rs
// Module: router
// Methods: 1 total (0 public)
impl AuthToken
|
crates/router/src/services/authentication.rs
|
router
|
impl_block
| null | null | null | 35
| null |
AuthToken
| null | 1
| 0
| null | null |
// Struct: Threedsecureio
// File: crates/hyperswitch_connectors/src/connectors/threedsecureio.rs
// Module: hyperswitch_connectors
// Implementations: 21
// Traits: Payment, PaymentSession, ConnectorAccessToken, MandateSetup, PaymentAuthorize, PaymentSync, PaymentCapture, PaymentVoid, Refund, RefundExecute, RefundSync, PaymentToken, ConnectorCommon, ConnectorValidation, IncomingWebhook, ConnectorPreAuthentication, ConnectorPreAuthenticationVersionCall, ExternalAuthentication, ConnectorAuthentication, ConnectorPostAuthentication, ConnectorSpecifications
pub struct Threedsecureio
|
crates/hyperswitch_connectors/src/connectors/threedsecureio.rs
|
hyperswitch_connectors
|
struct_definition
|
Threedsecureio
| 21
|
[
"Payment",
"PaymentSession",
"ConnectorAccessToken",
"MandateSetup",
"PaymentAuthorize",
"PaymentSync",
"PaymentCapture",
"PaymentVoid",
"Refund",
"RefundExecute",
"RefundSync",
"PaymentToken",
"ConnectorCommon",
"ConnectorValidation",
"IncomingWebhook",
"ConnectorPreAuthentication",
"ConnectorPreAuthenticationVersionCall",
"ExternalAuthentication",
"ConnectorAuthentication",
"ConnectorPostAuthentication",
"ConnectorSpecifications"
] | 123
| null | null | null | null | null | null | null |
// Implementation: impl IncomingWebhook for for Itaubank
// File: crates/hyperswitch_connectors/src/connectors/itaubank.rs
// Module: hyperswitch_connectors
// Methods: 3 total (0 public)
impl IncomingWebhook for for Itaubank
|
crates/hyperswitch_connectors/src/connectors/itaubank.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 59
| null |
Itaubank
|
IncomingWebhook for
| 3
| 0
| null | null |
// Implementation: impl Nomupay
// File: crates/hyperswitch_connectors/src/connectors/nomupay.rs
// Module: hyperswitch_connectors
// Methods: 1 total (1 public)
impl Nomupay
|
crates/hyperswitch_connectors/src/connectors/nomupay.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 49
| null |
Nomupay
| null | 1
| 1
| null | null |
// Function: get_grpc_headers_ucs
// File: crates/router/src/routes/app.rs
// Module: router
pub fn get_grpc_headers_ucs(&self) -> GrpcHeadersUcsBuilderInitial
|
crates/router/src/routes/app.rs
|
router
|
function_signature
| null | null | null | 44
|
get_grpc_headers_ucs
| null | null | null | null | null | null |
// Function: has_exceeded_monitoring_threshold
// File: crates/diesel_models/src/business_profile.rs
// Module: diesel_models
pub fn has_exceeded_monitoring_threshold(&self, monitoring_threshold_in_seconds: i64) -> bool
|
crates/diesel_models/src/business_profile.rs
|
diesel_models
|
function_signature
| null | null | null | 50
|
has_exceeded_monitoring_threshold
| null | null | null | null | null | null |
// Function: validate_card_testing_guard_checks
// File: crates/router/src/core/card_testing_guard/utils.rs
// Module: router
pub fn validate_card_testing_guard_checks(
state: &SessionState,
request: &api::PaymentsRequest,
payment_method_data: Option<&api_models::payments::PaymentMethodData>,
customer_id: &Option<common_utils::id_type::CustomerId>,
business_profile: &domain::Profile,
) -> RouterResult<Option<CardTestingGuardData>>
|
crates/router/src/core/card_testing_guard/utils.rs
|
router
|
function_signature
| null | null | null | 101
|
validate_card_testing_guard_checks
| null | null | null | null | null | null |
// Function: find_by_payment_id_merchant_id_attempt_id
// File: crates/diesel_models/src/query/payment_attempt.rs
// Module: diesel_models
pub fn find_by_payment_id_merchant_id_attempt_id(
conn: &PgPooledConn,
payment_id: &common_utils::id_type::PaymentId,
merchant_id: &common_utils::id_type::MerchantId,
attempt_id: &str,
) -> StorageResult<Self>
|
crates/diesel_models/src/query/payment_attempt.rs
|
diesel_models
|
function_signature
| null | null | null | 95
|
find_by_payment_id_merchant_id_attempt_id
| null | null | null | null | null | null |
// Implementation: impl Responder
// File: crates/router/src/analytics.rs
// Module: router
// Methods: 0 total (0 public)
impl Responder
|
crates/router/src/analytics.rs
|
router
|
impl_block
| null | null | null | 35
| null |
Responder
| null | 0
| 0
| null | null |
// Function: generate_cargo_instructions
// File: crates/router_env/src/vergen.rs
// Module: router_env
pub fn generate_cargo_instructions()
|
crates/router_env/src/vergen.rs
|
router_env
|
function_signature
| null | null | null | 33
|
generate_cargo_instructions
| null | null | null | null | null | null |
// Function: get_metadata_as_secret
// File: crates/api_models/src/admin.rs
// Module: api_models
pub fn get_metadata_as_secret(
&self,
) -> CustomResult<Option<pii::SecretSerdeValue>, errors::ParsingError>
|
crates/api_models/src/admin.rs
|
api_models
|
function_signature
| null | null | null | 54
|
get_metadata_as_secret
| null | null | null | null | null | null |
// Implementation: impl api::ConnectorAccessToken for for Paytm
// File: crates/hyperswitch_connectors/src/connectors/paytm.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::ConnectorAccessToken for for Paytm
|
crates/hyperswitch_connectors/src/connectors/paytm.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 57
| null |
Paytm
|
api::ConnectorAccessToken for
| 0
| 0
| null | null |
// Implementation: impl api::PaymentVoid for for Sift
// File: crates/hyperswitch_connectors/src/connectors/sift.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::PaymentVoid for for Sift
|
crates/hyperswitch_connectors/src/connectors/sift.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 57
| null |
Sift
|
api::PaymentVoid for
| 0
| 0
| null | null |
// Struct: PreAuthenticationVersionCall
// File: crates/hyperswitch_domain_models/src/router_flow_types/authentication.rs
// Module: hyperswitch_domain_models
// Implementations: 0
pub struct PreAuthenticationVersionCall
|
crates/hyperswitch_domain_models/src/router_flow_types/authentication.rs
|
hyperswitch_domain_models
|
struct_definition
|
PreAuthenticationVersionCall
| 0
|
[] | 46
| null | null | null | null | null | null | null |
// Function: new
// File: crates/api_models/src/routing.rs
// Module: api_models
pub fn new(routable_connector_choice: RoutableConnectorChoice, bucket_name: String) -> Self
|
crates/api_models/src/routing.rs
|
api_models
|
function_signature
| null | null | null | 43
|
new
| null | null | null | null | null | null |
// Struct: MerchantAccountSetter
// File: crates/hyperswitch_domain_models/src/merchant_account.rs
// Module: hyperswitch_domain_models
// Implementations: 0
// Documentation: Set the private fields of merchant account
pub struct MerchantAccountSetter
|
crates/hyperswitch_domain_models/src/merchant_account.rs
|
hyperswitch_domain_models
|
struct_definition
|
MerchantAccountSetter
| 0
|
[] | 54
| null | null | null | null | null | null | null |
// Function: config_delete
// File: crates/router/src/core/configs.rs
// Module: router
pub fn config_delete(state: SessionState, key: String) -> RouterResponse<api::Config>
|
crates/router/src/core/configs.rs
|
router
|
function_signature
| null | null | null | 43
|
config_delete
| null | null | null | null | null | null |
// Function: payment_connector_list_profile
// File: crates/router/src/routes/profiles.rs
// Module: router
pub fn payment_connector_list_profile(
state: web::Data<AppState>,
req: HttpRequest,
path: web::Path<common_utils::id_type::MerchantId>,
) -> HttpResponse
|
crates/router/src/routes/profiles.rs
|
router
|
function_signature
| null | null | null | 64
|
payment_connector_list_profile
| null | null | null | null | null | null |
// Function: frm_fulfillment
// File: crates/router/src/routes/fraud_check.rs
// Module: router
pub fn frm_fulfillment(
state: web::Data<AppState>,
req: HttpRequest,
json_payload: web::Json<frm_core::types::FrmFulfillmentRequest>,
) -> HttpResponse
|
crates/router/src/routes/fraud_check.rs
|
router
|
function_signature
| null | null | null | 69
|
frm_fulfillment
| null | null | null | null | null | null |
// Function: list_metadata_by_profile_id
// File: crates/diesel_models/src/query/routing_algorithm.rs
// Module: diesel_models
pub fn list_metadata_by_profile_id(
conn: &PgPooledConn,
profile_id: &common_utils::id_type::ProfileId,
limit: i64,
offset: i64,
) -> StorageResult<Vec<RoutingProfileMetadata>>
|
crates/diesel_models/src/query/routing_algorithm.rs
|
diesel_models
|
function_signature
| null | null | null | 85
|
list_metadata_by_profile_id
| null | null | null | null | null | null |
// Struct: Gateways
// File: crates/hyperswitch_connectors/src/connectors/multisafepay/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct Gateways
|
crates/hyperswitch_connectors/src/connectors/multisafepay/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
Gateways
| 0
|
[] | 49
| null | null | null | null | null | null | null |
// Function: get_all_action_types
// File: crates/router/src/core/payments.rs
// Module: router
pub fn get_all_action_types(
state: &SessionState,
is_connector_agnostic_mit_enabled: Option<bool>,
is_network_tokenization_enabled: bool,
payment_method_info: &domain::PaymentMethod,
connector: api::ConnectorData,
) -> Vec<ActionType>
|
crates/router/src/core/payments.rs
|
router
|
function_signature
| null | null | null | 84
|
get_all_action_types
| null | null | null | null | null | null |
// Struct: Customer
// File: crates/hyperswitch_connectors/src/connectors/worldpay/requests.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct Customer
|
crates/hyperswitch_connectors/src/connectors/worldpay/requests.rs
|
hyperswitch_connectors
|
struct_definition
|
Customer
| 0
|
[] | 42
| null | null | null | null | null | null | null |
// File: crates/analytics/src/frm/metrics.rs
// Module: analytics
// Public structs: 1
use api_models::analytics::{
frm::{FrmDimensions, FrmFilters, FrmMetrics, FrmMetricsBucketIdentifier, FrmTransactionType},
Granularity, TimeRange,
};
use diesel_models::enums as storage_enums;
use time::PrimitiveDateTime;
mod frm_blocked_rate;
mod frm_triggered_attempts;
use frm_blocked_rate::FrmBlockedRate;
use frm_triggered_attempts::FrmTriggeredAttempts;
use crate::{
query::{Aggregate, GroupByClause, ToSql, Window},
types::{AnalyticsCollection, AnalyticsDataSource, DBEnumWrapper, LoadRow, MetricsResult},
};
#[derive(Debug, Eq, PartialEq, serde::Deserialize)]
pub struct FrmMetricRow {
pub frm_name: Option<String>,
pub frm_status: Option<DBEnumWrapper<storage_enums::FraudCheckStatus>>,
pub frm_transaction_type: Option<DBEnumWrapper<FrmTransactionType>>,
pub total: Option<bigdecimal::BigDecimal>,
pub count: Option<i64>,
#[serde(with = "common_utils::custom_serde::iso8601::option")]
pub start_bucket: Option<PrimitiveDateTime>,
#[serde(with = "common_utils::custom_serde::iso8601::option")]
pub end_bucket: Option<PrimitiveDateTime>,
}
pub trait FrmMetricAnalytics: LoadRow<FrmMetricRow> {}
#[async_trait::async_trait]
pub trait FrmMetric<T>
where
T: AnalyticsDataSource + FrmMetricAnalytics,
PrimitiveDateTime: ToSql<T>,
AnalyticsCollection: ToSql<T>,
Granularity: GroupByClause<T>,
Aggregate<&'static str>: ToSql<T>,
Window<&'static str>: ToSql<T>,
{
async fn load_metrics(
&self,
dimensions: &[FrmDimensions],
merchant_id: &common_utils::id_type::MerchantId,
filters: &FrmFilters,
granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<Vec<(FrmMetricsBucketIdentifier, FrmMetricRow)>>;
}
#[async_trait::async_trait]
impl<T> FrmMetric<T> for FrmMetrics
where
T: AnalyticsDataSource + FrmMetricAnalytics,
PrimitiveDateTime: ToSql<T>,
AnalyticsCollection: ToSql<T>,
Granularity: GroupByClause<T>,
Aggregate<&'static str>: ToSql<T>,
Window<&'static str>: ToSql<T>,
{
async fn load_metrics(
&self,
dimensions: &[FrmDimensions],
merchant_id: &common_utils::id_type::MerchantId,
filters: &FrmFilters,
granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<Vec<(FrmMetricsBucketIdentifier, FrmMetricRow)>> {
match self {
Self::FrmTriggeredAttempts => {
FrmTriggeredAttempts::default()
.load_metrics(
dimensions,
merchant_id,
filters,
granularity,
time_range,
pool,
)
.await
}
Self::FrmBlockedRate => {
FrmBlockedRate::default()
.load_metrics(
dimensions,
merchant_id,
filters,
granularity,
time_range,
pool,
)
.await
}
}
}
}
|
crates/analytics/src/frm/metrics.rs
|
analytics
|
full_file
| null | null | null | 725
| null | null | null | null | null | null | null |
// Struct: PayoutsUpdateInternal
// File: crates/diesel_models/src/payouts.rs
// Module: diesel_models
// Implementations: 1
// Traits: Default
pub struct PayoutsUpdateInternal
|
crates/diesel_models/src/payouts.rs
|
diesel_models
|
struct_definition
|
PayoutsUpdateInternal
| 1
|
[
"Default"
] | 47
| null | null | null | null | null | null | null |
// Function: as_str
// File: crates/hyperswitch_connectors/src/connectors/trustpayments/transformers.rs
// Module: hyperswitch_connectors
pub fn as_str(&self) -> &'static str
|
crates/hyperswitch_connectors/src/connectors/trustpayments/transformers.rs
|
hyperswitch_connectors
|
function_signature
| null | null | null | 46
|
as_str
| null | null | null | null | null | null |
// Function: push_metrics_with_update_window_for_contract_based_routing
// File: crates/router/src/core/routing/helpers.rs
// Module: router
pub fn push_metrics_with_update_window_for_contract_based_routing(
state: &SessionState,
payment_attempt: &storage::PaymentAttempt,
routable_connectors: Vec<routing_types::RoutableConnectorChoice>,
profile_id: &id_type::ProfileId,
dynamic_routing_algo_ref: routing_types::DynamicRoutingAlgorithmRef,
_dynamic_routing_config_params_interpolator: DynamicRoutingConfigParamsInterpolator,
) -> RouterResult<()>
|
crates/router/src/core/routing/helpers.rs
|
router
|
function_signature
| null | null | null | 121
|
push_metrics_with_update_window_for_contract_based_routing
| null | null | null | null | null | null |
// Implementation: impl ConnectorValidation for for Loonio
// File: crates/hyperswitch_connectors/src/connectors/loonio.rs
// Module: hyperswitch_connectors
// Methods: 2 total (0 public)
impl ConnectorValidation for for Loonio
|
crates/hyperswitch_connectors/src/connectors/loonio.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 54
| null |
Loonio
|
ConnectorValidation for
| 2
| 0
| null | null |
// Struct: Stripe
// File: crates/hyperswitch_connectors/src/connectors/stripe.rs
// Module: hyperswitch_connectors
// Implementations: 31
// Traits: ConnectorCommon, ConnectorValidation, api::Payment, api::PaymentAuthorize, api::PaymentUpdateMetadata, api::PaymentSync, api::PaymentVoid, api::PaymentCapture, api::PaymentSession, api::ConnectorAccessToken, api::ConnectorCustomer, api::PaymentToken, api::MandateSetup, PaymentIncrementalAuthorization, api::Refund, api::RefundExecute, api::RefundSync, UploadFile, FileUpload, RetrieveFile, SubmitEvidence, IncomingWebhook, ConnectorRedirectResponse, api::Payouts, api::PayoutCancel, api::PayoutCreate, api::PayoutFulfill, api::PayoutRecipient, api::PayoutRecipientAccount, ConnectorSpecifications
pub struct Stripe
|
crates/hyperswitch_connectors/src/connectors/stripe.rs
|
hyperswitch_connectors
|
struct_definition
|
Stripe
| 31
|
[
"ConnectorCommon",
"ConnectorValidation",
"api::Payment",
"api::PaymentAuthorize",
"api::PaymentUpdateMetadata",
"api::PaymentSync",
"api::PaymentVoid",
"api::PaymentCapture",
"api::PaymentSession",
"api::ConnectorAccessToken",
"api::ConnectorCustomer",
"api::PaymentToken",
"api::MandateSetup",
"PaymentIncrementalAuthorization",
"api::Refund",
"api::RefundExecute",
"api::RefundSync",
"UploadFile",
"FileUpload",
"RetrieveFile",
"SubmitEvidence",
"IncomingWebhook",
"ConnectorRedirectResponse",
"api::Payouts",
"api::PayoutCancel",
"api::PayoutCreate",
"api::PayoutFulfill",
"api::PayoutRecipient",
"api::PayoutRecipientAccount",
"ConnectorSpecifications"
] | 190
| null | null | null | null | null | null | null |
// Implementation: impl api::MandateSetup for for Coinbase
// File: crates/hyperswitch_connectors/src/connectors/coinbase.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::MandateSetup for for Coinbase
|
crates/hyperswitch_connectors/src/connectors/coinbase.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 60
| null |
Coinbase
|
api::MandateSetup for
| 0
| 0
| null | null |
// Function: customer_delete
// File: crates/router/src/compatibility/stripe/customers.rs
// Module: router
pub fn customer_delete(
state: web::Data<routes::AppState>,
req: HttpRequest,
path: web::Path<id_type::CustomerId>,
) -> HttpResponse
|
crates/router/src/compatibility/stripe/customers.rs
|
router
|
function_signature
| null | null | null | 62
|
customer_delete
| null | null | null | null | null | null |
// Function: pg_accounts_connection_write
// File: crates/router/src/connection.rs
// Module: router
pub fn pg_accounts_connection_write<T: storage_impl::DatabaseStore>(
store: &T,
) -> errors::CustomResult<
PooledConnection<'_, async_bb8_diesel::ConnectionManager<PgConnection>>,
storage_errors::StorageError,
>
|
crates/router/src/connection.rs
|
router
|
function_signature
| null | null | null | 75
|
pg_accounts_connection_write
| null | null | null | null | null | null |
// Implementation: impl ConnectorCommon for for Nexixpay
// File: crates/hyperswitch_connectors/src/connectors/nexixpay.rs
// Module: hyperswitch_connectors
// Methods: 6 total (0 public)
impl ConnectorCommon for for Nexixpay
|
crates/hyperswitch_connectors/src/connectors/nexixpay.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 57
| null |
Nexixpay
|
ConnectorCommon for
| 6
| 0
| null | null |
// Function: get_sso_auth_url
// File: crates/router/src/routes/user.rs
// Module: router
pub fn get_sso_auth_url(
state: web::Data<AppState>,
req: HttpRequest,
query: web::Query<user_api::GetSsoAuthUrlRequest>,
) -> HttpResponse
|
crates/router/src/routes/user.rs
|
router
|
function_signature
| null | null | null | 66
|
get_sso_auth_url
| null | null | null | null | null | null |
// Function: server
// File: crates/router/src/compatibility/stripe/app.rs
// Module: router
pub fn server(config: routes::AppState) -> Scope
|
crates/router/src/compatibility/stripe/app.rs
|
router
|
function_signature
| null | null | null | 35
|
server
| null | null | null | null | null | null |
// Struct: ClientTokenInput
// File: crates/hyperswitch_connectors/src/connectors/braintree/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct ClientTokenInput
|
crates/hyperswitch_connectors/src/connectors/braintree/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
ClientTokenInput
| 0
|
[] | 48
| null | null | null | null | null | null | null |
// File: crates/diesel_models/src/query/refund.rs
// Module: diesel_models
// Public functions: 10
use diesel::{associations::HasTable, BoolExpressionMethods, ExpressionMethods, Table};
use super::generics;
#[cfg(feature = "v1")]
use crate::schema::refund::dsl;
#[cfg(feature = "v2")]
use crate::schema_v2::refund::dsl;
use crate::{
errors,
refund::{Refund, RefundNew, RefundUpdate, RefundUpdateInternal},
PgPooledConn, StorageResult,
};
impl RefundNew {
pub async fn insert(self, conn: &PgPooledConn) -> StorageResult<Refund> {
generics::generic_insert(conn, self).await
}
}
#[cfg(feature = "v1")]
impl Refund {
pub async fn update(self, conn: &PgPooledConn, refund: RefundUpdate) -> StorageResult<Self> {
match generics::generic_update_with_unique_predicate_get_result::<
<Self as HasTable>::Table,
_,
_,
_,
>(
conn,
dsl::refund_id
.eq(self.refund_id.to_owned())
.and(dsl::merchant_id.eq(self.merchant_id.to_owned())),
RefundUpdateInternal::from(refund),
)
.await
{
Err(error) => match error.current_context() {
errors::DatabaseError::NoFieldsToUpdate => Ok(self),
_ => Err(error),
},
result => result,
}
}
// This is required to be changed for KV.
pub async fn find_by_merchant_id_refund_id(
conn: &PgPooledConn,
merchant_id: &common_utils::id_type::MerchantId,
refund_id: &str,
) -> StorageResult<Self> {
generics::generic_find_one::<<Self as HasTable>::Table, _, _>(
conn,
dsl::merchant_id
.eq(merchant_id.to_owned())
.and(dsl::refund_id.eq(refund_id.to_owned())),
)
.await
}
pub async fn find_by_merchant_id_connector_refund_id_connector(
conn: &PgPooledConn,
merchant_id: &common_utils::id_type::MerchantId,
connector_refund_id: &str,
connector: &str,
) -> StorageResult<Self> {
generics::generic_find_one::<<Self as HasTable>::Table, _, _>(
conn,
dsl::merchant_id
.eq(merchant_id.to_owned())
.and(dsl::connector_refund_id.eq(connector_refund_id.to_owned()))
.and(dsl::connector.eq(connector.to_owned())),
)
.await
}
pub async fn find_by_internal_reference_id_merchant_id(
conn: &PgPooledConn,
internal_reference_id: &str,
merchant_id: &common_utils::id_type::MerchantId,
) -> StorageResult<Self> {
generics::generic_find_one::<<Self as HasTable>::Table, _, _>(
conn,
dsl::merchant_id
.eq(merchant_id.to_owned())
.and(dsl::internal_reference_id.eq(internal_reference_id.to_owned())),
)
.await
}
pub async fn find_by_merchant_id_connector_transaction_id(
conn: &PgPooledConn,
merchant_id: &common_utils::id_type::MerchantId,
connector_transaction_id: &str,
) -> StorageResult<Vec<Self>> {
generics::generic_filter::<
<Self as HasTable>::Table,
_,
<<Self as HasTable>::Table as Table>::PrimaryKey,
_,
>(
conn,
dsl::merchant_id
.eq(merchant_id.to_owned())
.and(dsl::connector_transaction_id.eq(connector_transaction_id.to_owned())),
None,
None,
None,
)
.await
}
pub async fn find_by_payment_id_merchant_id(
conn: &PgPooledConn,
payment_id: &common_utils::id_type::PaymentId,
merchant_id: &common_utils::id_type::MerchantId,
) -> StorageResult<Vec<Self>> {
generics::generic_filter::<
<Self as HasTable>::Table,
_,
<<Self as HasTable>::Table as Table>::PrimaryKey,
_,
>(
conn,
dsl::merchant_id
.eq(merchant_id.to_owned())
.and(dsl::payment_id.eq(payment_id.to_owned())),
None,
None,
None,
)
.await
}
}
#[cfg(feature = "v2")]
impl Refund {
pub async fn update_with_id(
self,
conn: &PgPooledConn,
refund: RefundUpdate,
) -> StorageResult<Self> {
match generics::generic_update_by_id::<<Self as HasTable>::Table, _, _, _>(
conn,
self.id.to_owned(),
RefundUpdateInternal::from(refund),
)
.await
{
Err(error) => match error.current_context() {
errors::DatabaseError::NoFieldsToUpdate => Ok(self),
_ => Err(error),
},
result => result,
}
}
pub async fn find_by_global_id(
conn: &PgPooledConn,
id: &common_utils::id_type::GlobalRefundId,
) -> StorageResult<Self> {
generics::generic_find_one::<<Self as HasTable>::Table, _, _>(
conn,
dsl::id.eq(id.to_owned()),
)
.await
}
pub async fn find_by_merchant_id_connector_transaction_id(
conn: &PgPooledConn,
merchant_id: &common_utils::id_type::MerchantId,
connector_transaction_id: &str,
) -> StorageResult<Vec<Self>> {
generics::generic_filter::<
<Self as HasTable>::Table,
_,
<<Self as HasTable>::Table as Table>::PrimaryKey,
_,
>(
conn,
dsl::merchant_id
.eq(merchant_id.to_owned())
.and(dsl::connector_transaction_id.eq(connector_transaction_id.to_owned())),
None,
None,
None,
)
.await
}
}
|
crates/diesel_models/src/query/refund.rs
|
diesel_models
|
full_file
| null | null | null | 1,357
| null | null | null | null | null | null | null |
// Struct: Card
// File: crates/hyperswitch_domain_models/src/payment_method_data.rs
// Module: hyperswitch_domain_models
// Implementations: 0
pub struct Card
|
crates/hyperswitch_domain_models/src/payment_method_data.rs
|
hyperswitch_domain_models
|
struct_definition
|
Card
| 0
|
[] | 39
| null | null | null | null | null | null | null |
// Implementation: impl api::PaymentAuthorize for for Volt
// File: crates/hyperswitch_connectors/src/connectors/volt.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::PaymentAuthorize for for Volt
|
crates/hyperswitch_connectors/src/connectors/volt.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 55
| null |
Volt
|
api::PaymentAuthorize for
| 0
| 0
| null | null |
// Struct: RevenueRecovery
// File: crates/router/src/services/kafka/revenue_recovery.rs
// Module: router
// Implementations: 1
// Traits: super::KafkaMessage
pub struct RevenueRecovery<'a>
|
crates/router/src/services/kafka/revenue_recovery.rs
|
router
|
struct_definition
|
RevenueRecovery
| 1
|
[
"super::KafkaMessage"
] | 50
| null | null | null | null | null | null | null |
// Implementation: impl IncomingWebhook for for Opennode
// File: crates/hyperswitch_connectors/src/connectors/opennode.rs
// Module: hyperswitch_connectors
// Methods: 6 total (0 public)
impl IncomingWebhook for for Opennode
|
crates/hyperswitch_connectors/src/connectors/opennode.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 57
| null |
Opennode
|
IncomingWebhook for
| 6
| 0
| null | null |
// Function: routing_retrieve_default_config_for_profiles
// File: crates/openapi/src/routes/routing.rs
// Module: openapi
pub fn routing_retrieve_default_config_for_profiles()
|
crates/openapi/src/routes/routing.rs
|
openapi
|
function_signature
| null | null | null | 39
|
routing_retrieve_default_config_for_profiles
| null | null | null | null | null | null |
// Function: get_dynamic_routing_volume_split
// File: crates/router/src/routes/routing.rs
// Module: router
pub fn get_dynamic_routing_volume_split(
state: web::Data<AppState>,
req: HttpRequest,
path: web::Path<routing_types::ToggleDynamicRoutingPath>,
) -> impl Responder
|
crates/router/src/routes/routing.rs
|
router
|
function_signature
| null | null | null | 67
|
get_dynamic_routing_volume_split
| null | null | null | null | null | null |
// Struct: AdminApiAuth
// File: crates/router/src/services/authentication.rs
// Module: router
// Implementations: 0
pub struct AdminApiAuth
|
crates/router/src/services/authentication.rs
|
router
|
struct_definition
|
AdminApiAuth
| 0
|
[] | 34
| null | null | null | null | null | null | null |
// Implementation: impl Hash for for AuthEventMetricsBucketIdentifier
// File: crates/api_models/src/analytics/auth_events.rs
// Module: api_models
// Methods: 1 total (0 public)
impl Hash for for AuthEventMetricsBucketIdentifier
|
crates/api_models/src/analytics/auth_events.rs
|
api_models
|
impl_block
| null | null | null | 51
| null |
AuthEventMetricsBucketIdentifier
|
Hash for
| 1
| 0
| null | null |
// Implementation: impl GetPaymentMethodType for for OpenBankingData
// File: crates/hyperswitch_domain_models/src/payment_method_data.rs
// Module: hyperswitch_domain_models
// Methods: 1 total (0 public)
impl GetPaymentMethodType for for OpenBankingData
|
crates/hyperswitch_domain_models/src/payment_method_data.rs
|
hyperswitch_domain_models
|
impl_block
| null | null | null | 60
| null |
OpenBankingData
|
GetPaymentMethodType for
| 1
| 0
| null | null |
// Implementation: impl events::ApiEventMetric for for DecisionManager
// File: crates/api_models/src/conditional_configs.rs
// Module: api_models
// Methods: 1 total (0 public)
impl events::ApiEventMetric for for DecisionManager
|
crates/api_models/src/conditional_configs.rs
|
api_models
|
impl_block
| null | null | null | 52
| null |
DecisionManager
|
events::ApiEventMetric for
| 1
| 0
| null | null |
// Struct: CommonMandateReference
// File: crates/diesel_models/src/payment_method.rs
// Module: diesel_models
// Implementations: 1
pub struct CommonMandateReference
|
crates/diesel_models/src/payment_method.rs
|
diesel_models
|
struct_definition
|
CommonMandateReference
| 1
|
[] | 41
| null | null | null | null | null | null | null |
// Function: into_inner
// File: crates/router/src/types/domain/user.rs
// Module: router
pub fn into_inner(self) -> Vec<Secret<String>>
|
crates/router/src/types/domain/user.rs
|
router
|
function_signature
| null | null | null | 34
|
into_inner
| null | null | null | null | null | null |
// Function: get_global_search_results
// File: crates/router/src/analytics.rs
// Module: router
pub fn get_global_search_results(
state: web::Data<AppState>,
req: actix_web::HttpRequest,
json_payload: web::Json<GetGlobalSearchRequest>,
) -> impl Responder
|
crates/router/src/analytics.rs
|
router
|
function_signature
| null | null | null | 67
|
get_global_search_results
| null | null | null | null | null | null |
// Implementation: impl ConnectorSpecifications for for Coinbase
// File: crates/hyperswitch_connectors/src/connectors/coinbase.rs
// Module: hyperswitch_connectors
// Methods: 3 total (0 public)
impl ConnectorSpecifications for for Coinbase
|
crates/hyperswitch_connectors/src/connectors/coinbase.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 52
| null |
Coinbase
|
ConnectorSpecifications for
| 3
| 0
| null | null |
// Struct: ErrorData
// File: crates/hyperswitch_connectors/src/connectors/dummyconnector/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct ErrorData
|
crates/hyperswitch_connectors/src/connectors/dummyconnector/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
ErrorData
| 0
|
[] | 46
| null | null | null | null | null | null | null |
where
D: OperationSessionGetters<F> + Send + Sync + Clone,
{
match format!("{operation:?}").as_str() {
"PaymentConfirm" => true,
"PaymentStart" => {
!matches!(
payment_data.get_payment_intent().status,
storage_enums::IntentStatus::Failed | storage_enums::IntentStatus::Succeeded
) && payment_data
.get_payment_attempt()
.authentication_data
.is_none()
}
"PaymentStatus" => {
payment_data.get_all_keys_required().unwrap_or(false)
|| matches!(
payment_data.get_payment_intent().status,
storage_enums::IntentStatus::Processing
| storage_enums::IntentStatus::RequiresCustomerAction
| storage_enums::IntentStatus::RequiresMerchantAction
| storage_enums::IntentStatus::RequiresCapture
| storage_enums::IntentStatus::PartiallyCapturedAndCapturable
) && payment_data.get_force_sync().unwrap_or(false)
}
"PaymentCancel" => matches!(
payment_data.get_payment_intent().status,
storage_enums::IntentStatus::RequiresCapture
| storage_enums::IntentStatus::PartiallyCapturedAndCapturable
),
"PaymentCancelPostCapture" => matches!(
payment_data.get_payment_intent().status,
storage_enums::IntentStatus::Succeeded
| storage_enums::IntentStatus::PartiallyCaptured
| storage_enums::IntentStatus::PartiallyCapturedAndCapturable
),
"PaymentCapture" => {
matches!(
payment_data.get_payment_intent().status,
storage_enums::IntentStatus::RequiresCapture
| storage_enums::IntentStatus::PartiallyAuthorizedAndRequiresCapture
| storage_enums::IntentStatus::PartiallyCapturedAndCapturable
) || (matches!(
payment_data.get_payment_intent().status,
storage_enums::IntentStatus::Processing
) && matches!(
payment_data.get_capture_method(),
Some(storage_enums::CaptureMethod::ManualMultiple)
))
}
"CompleteAuthorize" => true,
"PaymentApprove" => true,
"PaymentReject" => true,
"PaymentSession" => true,
"PaymentSessionUpdate" => true,
"PaymentPostSessionTokens" => true,
"PaymentUpdateMetadata" => true,
"PaymentIncrementalAuthorization" => matches!(
payment_data.get_payment_intent().status,
storage_enums::IntentStatus::RequiresCapture
),
_ => false,
}
}
pub fn is_operation_confirm<Op: Debug>(operation: &Op) -> bool {
matches!(format!("{operation:?}").as_str(), "PaymentConfirm")
}
pub fn is_operation_complete_authorize<Op: Debug>(operation: &Op) -> bool {
matches!(format!("{operation:?}").as_str(), "CompleteAuthorize")
}
#[cfg(all(feature = "olap", feature = "v1"))]
pub async fn list_payments(
state: SessionState,
merchant_context: domain::MerchantContext,
profile_id_list: Option<Vec<id_type::ProfileId>>,
constraints: api::PaymentListConstraints,
) -> RouterResponse<api::PaymentListResponse> {
helpers::validate_payment_list_request(&constraints)?;
let merchant_id = merchant_context.get_merchant_account().get_id();
let db = state.store.as_ref();
let payment_intents = helpers::filter_by_constraints(
&state,
&(constraints, profile_id_list).try_into()?,
merchant_id,
merchant_context.get_merchant_key_store(),
merchant_context.get_merchant_account().storage_scheme,
)
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
let collected_futures = payment_intents.into_iter().map(|pi| {
async {
match db
.find_payment_attempt_by_payment_id_merchant_id_attempt_id(
&pi.payment_id,
merchant_id,
&pi.active_attempt.get_id(),
// since OLAP doesn't have KV. Force to get the data from PSQL.
storage_enums::MerchantStorageScheme::PostgresOnly,
)
.await
{
Ok(pa) => Some(Ok((pi, pa))),
Err(error) => {
if matches!(
error.current_context(),
errors::StorageError::ValueNotFound(_)
) {
logger::warn!(
?error,
"payment_attempts missing for payment_id : {:?}",
pi.payment_id,
);
return None;
}
Some(Err(error))
}
}
}
});
//If any of the response are Err, we will get Result<Err(_)>
let pi_pa_tuple_vec: Result<Vec<(storage::PaymentIntent, storage::PaymentAttempt)>, _> =
join_all(collected_futures)
.await
.into_iter()
.flatten() //Will ignore `None`, will only flatten 1 level
.collect::<Result<Vec<(storage::PaymentIntent, storage::PaymentAttempt)>, _>>();
//Will collect responses in same order async, leading to sorted responses
//Converting Intent-Attempt array to Response if no error
let data: Vec<api::PaymentsResponse> = pi_pa_tuple_vec
.change_context(errors::ApiErrorResponse::InternalServerError)?
.into_iter()
.map(ForeignFrom::foreign_from)
.collect();
Ok(services::ApplicationResponse::Json(
api::PaymentListResponse {
size: data.len(),
data,
},
))
}
#[cfg(all(feature = "v2", feature = "olap"))]
pub async fn list_payments(
state: SessionState,
merchant_context: domain::MerchantContext,
constraints: api::PaymentListConstraints,
) -> RouterResponse<payments_api::PaymentListResponse> {
common_utils::metrics::utils::record_operation_time(
async {
let limit = &constraints.limit;
helpers::validate_payment_list_request_for_joins(*limit)?;
let db: &dyn StorageInterface = state.store.as_ref();
let fetch_constraints = constraints.clone().into();
let list: Vec<(storage::PaymentIntent, Option<storage::PaymentAttempt>)> = db
.get_filtered_payment_intents_attempt(
&(&state).into(),
merchant_context.get_merchant_account().get_id(),
&fetch_constraints,
merchant_context.get_merchant_key_store(),
merchant_context.get_merchant_account().storage_scheme,
)
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
let data: Vec<api_models::payments::PaymentsListResponseItem> =
list.into_iter().map(ForeignFrom::foreign_from).collect();
let active_attempt_ids = db
.get_filtered_active_attempt_ids_for_total_count(
merchant_context.get_merchant_account().get_id(),
&fetch_constraints,
merchant_context.get_merchant_account().storage_scheme,
)
.await
.to_not_found_response(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Error while retrieving active_attempt_ids for merchant")?;
let total_count = if constraints.has_no_attempt_filters() {
i64::try_from(active_attempt_ids.len())
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Error while converting from usize to i64")
} else {
let active_attempt_ids = active_attempt_ids
.into_iter()
.flatten()
.collect::<Vec<String>>();
db.get_total_count_of_filtered_payment_attempts(
merchant_context.get_merchant_account().get_id(),
&active_attempt_ids,
constraints.connector,
constraints.payment_method_type,
constraints.payment_method_subtype,
constraints.authentication_type,
constraints.merchant_connector_id,
constraints.card_network,
merchant_context.get_merchant_account().storage_scheme,
)
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Error while retrieving total count of payment attempts")
}?;
Ok(services::ApplicationResponse::Json(
api_models::payments::PaymentListResponse {
count: data.len(),
total_count,
data,
},
))
},
&metrics::PAYMENT_LIST_LATENCY,
router_env::metric_attributes!((
"merchant_id",
merchant_context.get_merchant_account().get_id().clone()
)),
)
.await
}
#[cfg(all(feature = "olap", feature = "v1"))]
pub async fn apply_filters_on_payments(
state: SessionState,
merchant_context: domain::MerchantContext,
profile_id_list: Option<Vec<id_type::ProfileId>>,
constraints: api::PaymentListFilterConstraints,
) -> RouterResponse<api::PaymentListResponseV2> {
common_utils::metrics::utils::record_operation_time(
async {
let limit = &constraints.limit;
helpers::validate_payment_list_request_for_joins(*limit)?;
let db: &dyn StorageInterface = state.store.as_ref();
let pi_fetch_constraints = (constraints.clone(), profile_id_list.clone()).try_into()?;
let list: Vec<(storage::PaymentIntent, storage::PaymentAttempt)> = db
.get_filtered_payment_intents_attempt(
&(&state).into(),
merchant_context.get_merchant_account().get_id(),
&pi_fetch_constraints,
merchant_context.get_merchant_key_store(),
merchant_context.get_merchant_account().storage_scheme,
)
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
let data: Vec<api::PaymentsResponse> =
list.into_iter().map(ForeignFrom::foreign_from).collect();
let active_attempt_ids = db
.get_filtered_active_attempt_ids_for_total_count(
merchant_context.get_merchant_account().get_id(),
&pi_fetch_constraints,
merchant_context.get_merchant_account().storage_scheme,
)
.await
.to_not_found_response(errors::ApiErrorResponse::InternalServerError)?;
let total_count = if constraints.has_no_attempt_filters() {
i64::try_from(active_attempt_ids.len())
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Error while converting from usize to i64")
} else {
db.get_total_count_of_filtered_payment_attempts(
merchant_context.get_merchant_account().get_id(),
&active_attempt_ids,
constraints.connector,
constraints.payment_method,
constraints.payment_method_type,
constraints.authentication_type,
constraints.merchant_connector_id,
constraints.card_network,
constraints.card_discovery,
merchant_context.get_merchant_account().storage_scheme,
)
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
}?;
Ok(services::ApplicationResponse::Json(
api::PaymentListResponseV2 {
count: data.len(),
total_count,
data,
},
))
},
&metrics::PAYMENT_LIST_LATENCY,
router_env::metric_attributes!((
"merchant_id",
merchant_context.get_merchant_account().get_id().clone()
)),
)
.await
}
#[cfg(all(feature = "olap", feature = "v1"))]
pub async fn get_filters_for_payments(
state: SessionState,
merchant_context: domain::MerchantContext,
time_range: common_utils::types::TimeRange,
) -> RouterResponse<api::PaymentListFilters> {
let db = state.store.as_ref();
let pi = db
.filter_payment_intents_by_time_range_constraints(
&(&state).into(),
merchant_context.get_merchant_account().get_id(),
&time_range,
merchant_context.get_merchant_key_store(),
merchant_context.get_merchant_account().storage_scheme,
)
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
let filters = db
.get_filters_for_payments(
pi.as_slice(),
merchant_context.get_merchant_account().get_id(),
// since OLAP doesn't have KV. Force to get the data from PSQL.
storage_enums::MerchantStorageScheme::PostgresOnly,
)
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
Ok(services::ApplicationResponse::Json(
api::PaymentListFilters {
connector: filters.connector,
currency: filters.currency,
status: filters.status,
payment_method: filters.payment_method,
payment_method_type: filters.payment_method_type,
authentication_type: filters.authentication_type,
},
))
}
#[cfg(feature = "olap")]
pub async fn get_payment_filters(
state: SessionState,
merchant_context: domain::MerchantContext,
profile_id_list: Option<Vec<id_type::ProfileId>>,
) -> RouterResponse<api::PaymentListFiltersV2> {
let merchant_connector_accounts = if let services::ApplicationResponse::Json(data) =
super::admin::list_payment_connectors(
state,
merchant_context.get_merchant_account().get_id().to_owned(),
profile_id_list,
)
.await?
{
data
} else {
return Err(errors::ApiErrorResponse::InternalServerError.into());
};
let mut connector_map: HashMap<String, Vec<MerchantConnectorInfo>> = HashMap::new();
let mut payment_method_types_map: HashMap<
enums::PaymentMethod,
HashSet<enums::PaymentMethodType>,
> = HashMap::new();
// populate connector map
merchant_connector_accounts
.iter()
.filter_map(|merchant_connector_account| {
merchant_connector_account
.connector_label
.as_ref()
.map(|label| {
let info = merchant_connector_account.to_merchant_connector_info(label);
(merchant_connector_account.get_connector_name(), info)
})
})
.for_each(|(connector_name, info)| {
connector_map
.entry(connector_name.to_string())
.or_default()
.push(info);
});
// populate payment method type map
merchant_connector_accounts
.iter()
.flat_map(|merchant_connector_account| {
merchant_connector_account.payment_methods_enabled.as_ref()
})
.map(|payment_methods_enabled| {
payment_methods_enabled
.iter()
.filter_map(|payment_method_enabled| {
payment_method_enabled
.get_payment_method_type()
.map(|types_vec| {
(
payment_method_enabled.get_payment_method(),
types_vec.clone(),
)
})
})
})
.for_each(|payment_methods_enabled| {
payment_methods_enabled.for_each(
|(payment_method_option, payment_method_types_vec)| {
if let Some(payment_method) = payment_method_option {
payment_method_types_map
.entry(payment_method)
.or_default()
.extend(payment_method_types_vec.iter().filter_map(
|req_payment_method_types| {
req_payment_method_types.get_payment_method_type()
},
));
}
},
);
});
Ok(services::ApplicationResponse::Json(
api::PaymentListFiltersV2 {
connector: connector_map,
currency: enums::Currency::iter().collect(),
status: enums::IntentStatus::iter().collect(),
payment_method: payment_method_types_map,
authentication_type: enums::AuthenticationType::iter().collect(),
card_network: enums::CardNetwork::iter().collect(),
card_discovery: enums::CardDiscovery::iter().collect(),
},
))
}
#[cfg(feature = "olap")]
pub async fn get_aggregates_for_payments(
state: SessionState,
merchant_context: domain::MerchantContext,
profile_id_list: Option<Vec<id_type::ProfileId>>,
time_range: common_utils::types::TimeRange,
) -> RouterResponse<api::PaymentsAggregateResponse> {
let db = state.store.as_ref();
let intent_status_with_count = db
.get_intent_status_with_count(
merchant_context.get_merchant_account().get_id(),
profile_id_list,
&time_range,
)
.await
.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;
let mut status_map: HashMap<enums::IntentStatus, i64> =
intent_status_with_count.into_iter().collect();
for status in enums::IntentStatus::iter() {
status_map.entry(status).or_default();
}
Ok(services::ApplicationResponse::Json(
api::PaymentsAggregateResponse {
status_with_count: status_map,
},
))
}
#[cfg(feature = "v1")]
pub async fn add_process_sync_task(
db: &dyn StorageInterface,
payment_attempt: &storage::PaymentAttempt,
schedule_time: time::PrimitiveDateTime,
) -> CustomResult<(), errors::StorageError> {
let tracking_data = api::PaymentsRetrieveRequest {
force_sync: true,
merchant_id: Some(payment_attempt.merchant_id.clone()),
resource_id: api::PaymentIdType::PaymentAttemptId(payment_attempt.get_id().to_owned()),
..Default::default()
};
let runner = storage::ProcessTrackerRunner::PaymentsSyncWorkflow;
let task = "PAYMENTS_SYNC";
let tag = ["SYNC", "PAYMENT"];
let process_tracker_id = pt_utils::get_process_tracker_id(
runner,
task,
payment_attempt.get_id(),
&payment_attempt.merchant_id,
);
let process_tracker_entry = storage::ProcessTrackerNew::new(
process_tracker_id,
task,
runner,
tag,
tracking_data,
None,
schedule_time,
common_types::consts::API_VERSION,
)
.map_err(errors::StorageError::from)?;
db.insert_process(process_tracker_entry).await?;
Ok(())
}
#[cfg(feature = "v2")]
pub async fn reset_process_sync_task(
db: &dyn StorageInterface,
payment_attempt: &storage::PaymentAttempt,
schedule_time: time::PrimitiveDateTime,
) -> Result<(), errors::ProcessTrackerError> {
todo!()
}
#[cfg(feature = "v1")]
pub async fn reset_process_sync_task(
db: &dyn StorageInterface,
payment_attempt: &storage::PaymentAttempt,
schedule_time: time::PrimitiveDateTime,
) -> Result<(), errors::ProcessTrackerError> {
let runner = storage::ProcessTrackerRunner::PaymentsSyncWorkflow;
let task = "PAYMENTS_SYNC";
let process_tracker_id = pt_utils::get_process_tracker_id(
runner,
task,
payment_attempt.get_id(),
&payment_attempt.merchant_id,
);
let psync_process = db
.find_process_by_id(&process_tracker_id)
.await?
.ok_or(errors::ProcessTrackerError::ProcessFetchingFailed)?;
db.as_scheduler()
.reset_process(psync_process, schedule_time)
.await?;
Ok(())
}
#[cfg(feature = "v1")]
pub fn update_straight_through_routing<F, D>(
payment_data: &mut D,
request_straight_through: serde_json::Value,
) -> CustomResult<(), errors::ParsingError>
where
F: Send + Clone,
D: OperationSessionGetters<F> + OperationSessionSetters<F> + Send + Sync + Clone,
{
let _: api_models::routing::StaticRoutingAlgorithm = request_straight_through
.clone()
.parse_value("RoutingAlgorithm")
.attach_printable("Invalid straight through routing rules format")?;
payment_data.set_straight_through_algorithm_in_payment_attempt(request_straight_through);
Ok(())
}
#[cfg(feature = "v1")]
pub fn is_pre_network_tokenization_enabled(
state: &SessionState,
business_profile: &domain::Profile,
customer_acceptance: Option<Secret<serde_json::Value>>,
connector_name: enums::Connector,
) -> bool {
let ntid_supported_connectors = &state
.conf
.network_transaction_id_supported_connectors
.connector_list;
let is_nt_supported_connector = ntid_supported_connectors.contains(&connector_name);
business_profile.is_network_tokenization_enabled
&& business_profile.is_pre_network_tokenization_enabled
&& customer_acceptance.is_some()
&& is_nt_supported_connector
}
#[cfg(feature = "v1")]
pub async fn get_vault_operation_for_pre_network_tokenization(
state: &SessionState,
customer_id: id_type::CustomerId,
card_data: &hyperswitch_domain_models::payment_method_data::Card,
) -> payments::VaultOperation {
let pre_tokenization_response =
tokenization::pre_payment_tokenization(state, customer_id, card_data)
.await
.ok();
match pre_tokenization_response {
Some((Some(token_response), Some(token_ref))) => {
let token_data = domain::NetworkTokenData::from(token_response);
let network_token_data_for_vault = payments::NetworkTokenDataForVault {
network_token_data: token_data.clone(),
network_token_req_ref_id: token_ref,
};
payments::VaultOperation::SaveCardAndNetworkTokenData(Box::new(
payments::CardAndNetworkTokenDataForVault {
card_data: card_data.clone(),
network_token: network_token_data_for_vault.clone(),
},
))
}
Some((None, Some(token_ref))) => {
payments::VaultOperation::SaveCardData(payments::CardDataForVault {
card_data: card_data.clone(),
network_token_req_ref_id: Some(token_ref),
})
}
_ => payments::VaultOperation::SaveCardData(payments::CardDataForVault {
card_data: card_data.clone(),
network_token_req_ref_id: None,
}),
}
}
#[cfg(feature = "v1")]
#[allow(clippy::too_many_arguments)]
pub async fn get_connector_choice<F, Req, D>(
operation: &BoxedOperation<'_, F, Req, D>,
state: &SessionState,
req: &Req,
merchant_context: &domain::MerchantContext,
business_profile: &domain::Profile,
payment_data: &mut D,
eligible_connectors: Option<Vec<enums::RoutableConnectors>>,
mandate_type: Option<api::MandateTransactionType>,
) -> RouterResult<Option<ConnectorCallType>>
where
F: Send + Clone,
D: OperationSessionGetters<F> + OperationSessionSetters<F> + Send + Sync + Clone,
{
let connector_choice = operation
.to_domain()?
.get_connector(
merchant_context,
&state.clone(),
req,
payment_data.get_payment_intent(),
)
.await?;
let connector = if should_call_connector(operation, payment_data) {
Some(match connector_choice {
api::ConnectorChoice::SessionMultiple(connectors) => {
let routing_output = perform_session_token_routing(
state.clone(),
merchant_context,
business_profile,
payment_data,
connectors,
)
.await?;
ConnectorCallType::SessionMultiple(routing_output)
}
api::ConnectorChoice::StraightThrough(straight_through) => {
connector_selection(
state,
merchant_context,
business_profile,
payment_data,
Some(straight_through),
eligible_connectors,
mandate_type,
)
.await?
}
api::ConnectorChoice::Decide => {
connector_selection(
state,
merchant_context,
business_profile,
payment_data,
None,
eligible_connectors,
mandate_type,
)
.await?
}
})
} else if let api::ConnectorChoice::StraightThrough(algorithm) = connector_choice {
update_straight_through_routing(payment_data, algorithm)
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Failed to update straight through routing algorithm")?;
None
} else {
None
};
Ok(connector)
}
async fn get_eligible_connector_for_nti<T: core_routing::GetRoutableConnectorsForChoice, F, D>(
state: &SessionState,
key_store: &domain::MerchantKeyStore,
payment_data: &D,
connector_choice: T,
business_profile: &domain::Profile,
) -> RouterResult<(
api_models::payments::MandateReferenceId,
hyperswitch_domain_models::payment_method_data::CardDetailsForNetworkTransactionId,
api::ConnectorData,
)>
where
F: Send + Clone,
D: OperationSessionGetters<F> + OperationSessionSetters<F> + Send + Sync + Clone,
{
// Since this flow will only be used in the MIT flow, recurring details are mandatory.
let recurring_payment_details = payment_data
.get_recurring_details()
.ok_or(errors::ApiErrorResponse::IncorrectPaymentMethodConfiguration)
.attach_printable("Failed to fetch recurring details for mit")?;
let (mandate_reference_id, card_details_for_network_transaction_id)= hyperswitch_domain_models::payment_method_data::CardDetailsForNetworkTransactionId::get_nti_and_card_details_for_mit_flow(recurring_payment_details.clone()).get_required_value("network transaction id and card details").attach_printable("Failed to fetch network transaction id and card details for mit")?;
helpers::validate_card_expiry(
&card_details_for_network_transaction_id.card_exp_month,
&card_details_for_network_transaction_id.card_exp_year,
)?;
let network_transaction_id_supported_connectors = &state
.conf
.network_transaction_id_supported_connectors
.connector_list
.iter()
.map(|value| value.to_string())
.collect::<HashSet<_>>();
let eligible_connector_data_list = connector_choice
.get_routable_connectors(&*state.store, business_profile)
.await?
.filter_network_transaction_id_flow_supported_connectors(
network_transaction_id_supported_connectors.to_owned(),
)
.construct_dsl_and_perform_eligibility_analysis(
state,
key_store,
payment_data,
business_profile.get_id(),
)
.await
.attach_printable("Failed to fetch eligible connector data")?;
let eligible_connector_data = eligible_connector_data_list
.first()
.ok_or(errors::ApiErrorResponse::IncorrectPaymentMethodConfiguration)
.attach_printable(
"No eligible connector found for the network transaction id based mit flow",
)?;
Ok((
mandate_reference_id,
card_details_for_network_transaction_id,
eligible_connector_data.clone(),
))
}
pub async fn set_eligible_connector_for_nti_in_payment_data<F, D>(
state: &SessionState,
business_profile: &domain::Profile,
key_store: &domain::MerchantKeyStore,
payment_data: &mut D,
connector_choice: api::ConnectorChoice,
) -> RouterResult<api::ConnectorData>
where
F: Send + Clone,
D: OperationSessionGetters<F> + OperationSessionSetters<F> + Send + Sync + Clone,
{
let (mandate_reference_id, card_details_for_network_transaction_id, eligible_connector_data) =
match connector_choice {
api::ConnectorChoice::StraightThrough(straight_through) => {
get_eligible_connector_for_nti(
state,
key_store,
payment_data,
core_routing::StraightThroughAlgorithmTypeSingle(straight_through),
business_profile,
)
.await?
}
api::ConnectorChoice::Decide => {
get_eligible_connector_for_nti(
state,
key_store,
payment_data,
core_routing::DecideConnector,
business_profile,
)
.await?
}
api::ConnectorChoice::SessionMultiple(_) => {
Err(errors::ApiErrorResponse::InternalServerError).attach_printable(
"Invalid routing rule configured for nti and card details based mit flow",
)?
}
};
// Set the eligible connector in the attempt
payment_data
.set_connector_in_payment_attempt(Some(eligible_connector_data.connector_name.to_string()));
// Set `NetworkMandateId` as the MandateId
payment_data.set_mandate_id(payments_api::MandateIds {
mandate_id: None,
mandate_reference_id: Some(mandate_reference_id),
});
// Set the card details received in the recurring details within the payment method data.
payment_data.set_payment_method_data(Some(
hyperswitch_domain_models::payment_method_data::PaymentMethodData::CardDetailsForNetworkTransactionId(card_details_for_network_transaction_id),
));
Ok(eligible_connector_data)
}
#[cfg(feature = "v1")]
#[allow(clippy::too_many_arguments)]
pub async fn connector_selection<F, D>(
state: &SessionState,
merchant_context: &domain::MerchantContext,
business_profile: &domain::Profile,
payment_data: &mut D,
request_straight_through: Option<serde_json::Value>,
eligible_connectors: Option<Vec<enums::RoutableConnectors>>,
mandate_type: Option<api::MandateTransactionType>,
) -> RouterResult<ConnectorCallType>
where
F: Send + Clone,
D: OperationSessionGetters<F> + OperationSessionSetters<F> + Send + Sync + Clone,
{
let request_straight_through: Option<api::routing::StraightThroughAlgorithm> =
request_straight_through
.map(|val| val.parse_value("RoutingAlgorithm"))
.transpose()
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Invalid straight through routing rules format")?;
let mut routing_data = storage::RoutingData {
routed_through: payment_data.get_payment_attempt().connector.clone(),
merchant_connector_id: payment_data
.get_payment_attempt()
.merchant_connector_id
.clone(),
algorithm: request_straight_through.clone(),
routing_info: payment_data
.get_payment_attempt()
.straight_through_algorithm
.clone()
.map(|val| val.parse_value("PaymentRoutingInfo"))
.transpose()
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Invalid straight through algorithm format found in payment attempt")?
.unwrap_or(storage::PaymentRoutingInfo {
algorithm: None,
pre_routing_results: None,
}),
};
let decided_connector = decide_connector(
state.clone(),
merchant_context,
business_profile,
payment_data,
request_straight_through,
&mut routing_data,
eligible_connectors,
mandate_type,
)
.await?;
let encoded_info = routing_data
.routing_info
.encode_to_value()
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("error serializing payment routing info to serde value")?;
payment_data.set_connector_in_payment_attempt(routing_data.routed_through);
payment_data.set_merchant_connector_id_in_attempt(routing_data.merchant_connector_id);
payment_data.set_straight_through_algorithm_in_payment_attempt(encoded_info);
Ok(decided_connector)
}
#[cfg(feature = "v2")]
#[allow(clippy::too_many_arguments)]
pub async fn connector_selection<F, D>(
state: &SessionState,
merchant_context: &domain::MerchantContext,
business_profile: &domain::Profile,
payment_data: &mut D,
mandate_type: Option<api::MandateTransactionType>,
) -> RouterResult<ConnectorCallType>
where
F: Send + Clone,
D: OperationSessionGetters<F> + OperationSessionSetters<F> + Send + Sync + Clone,
{
let mut routing_data = storage::RoutingData {
routed_through: payment_data.get_payment_attempt().connector.clone(),
merchant_connector_id: payment_data
.get_payment_attempt()
.merchant_connector_id
.clone(),
pre_routing_connector_choice: payment_data.get_pre_routing_result().and_then(
|pre_routing_results| {
pre_routing_results
.get(&payment_data.get_payment_attempt().payment_method_subtype)
.cloned()
},
),
algorithm_requested: payment_data
.get_payment_intent()
.routing_algorithm_id
.clone(),
};
let payment_dsl_input = core_routing::PaymentsDslInput::new(
None,
payment_data.get_payment_attempt(),
payment_data.get_payment_intent(),
payment_data.get_payment_method_data(),
payment_data.get_address(),
None,
payment_data.get_currency(),
);
let decided_connector = decide_connector(
state.clone(),
merchant_context,
business_profile,
&mut routing_data,
payment_dsl_input,
mandate_type,
)
.await?;
payment_data.set_connector_in_payment_attempt(routing_data.routed_through);
payment_data.set_merchant_connector_id_in_attempt(routing_data.merchant_connector_id);
Ok(decided_connector)
}
#[allow(clippy::too_many_arguments)]
#[cfg(feature = "v2")]
pub async fn decide_connector(
state: SessionState,
merchant_context: &domain::MerchantContext,
business_profile: &domain::Profile,
routing_data: &mut storage::RoutingData,
payment_dsl_input: core_routing::PaymentsDslInput<'_>,
mandate_type: Option<api::MandateTransactionType>,
) -> RouterResult<ConnectorCallType> {
// If the connector was already decided previously, use the same connector
// This is in case of flows like payments_sync, payments_cancel where the successive operations
// with the connector have to be made using the same connector account.
let predetermined_info_cloned = routing_data
.routed_through
.as_ref()
.zip(routing_data.merchant_connector_id.as_ref())
.map(|(cn_ref, mci_ref)| (cn_ref.clone(), mci_ref.clone()));
match (
predetermined_info_cloned,
routing_data.pre_routing_connector_choice.as_ref(),
) {
// Condition 1: Connector was already decided previously
(Some((owned_connector_name, owned_merchant_connector_id)), _) => {
api::ConnectorData::get_connector_by_name(
&state.conf.connectors,
&owned_connector_name,
api::GetToken::Connector,
Some(owned_merchant_connector_id.clone()),
)
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Invalid connector name received in 'routed_through'")
.map(|connector_data| {
routing_data.routed_through = Some(owned_connector_name);
ConnectorCallType::PreDetermined(connector_data.into())
})
}
// Condition 2: Pre-routing connector choice
(None, Some(routable_connector_choice)) => {
let routable_connector_list = match routable_connector_choice {
storage::PreRoutingConnectorChoice::Single(routable_connector) => {
vec![routable_connector.clone()]
}
storage::PreRoutingConnectorChoice::Multiple(routable_connector_list) => {
routable_connector_list.clone()
}
};
routable_connector_list
.first()
.ok_or_else(|| {
report!(errors::ApiErrorResponse::IncorrectPaymentMethodConfiguration)
.attach_printable("No first routable connector in pre_routing_connector_choice")
})
.and_then(|first_routable_connector| {
routing_data.routed_through = Some(first_routable_connector.connector.to_string());
routing_data
.merchant_connector_id
.clone_from(&first_routable_connector.merchant_connector_id);
let pre_routing_connector_data_list_result: RouterResult<Vec<api::ConnectorData>> = routable_connector_list
.iter()
.map(|connector_choice| {
api::ConnectorData::get_connector_by_name(
&state.conf.connectors,
&connector_choice.connector.to_string(),
api::GetToken::Connector,
connector_choice.merchant_connector_id.clone(),
)
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Invalid connector name received while processing pre_routing_connector_choice")
})
.collect::<Result<Vec<_>, _>>(); // Collects into RouterResult<Vec<ConnectorData>>
pre_routing_connector_data_list_result
.and_then(|list| {
list.first()
.cloned()
.ok_or_else(|| {
report!(errors::ApiErrorResponse::IncorrectPaymentMethodConfiguration)
.attach_printable("Empty pre_routing_connector_data_list after mapping")
})
.map(|first_data| ConnectorCallType::PreDetermined(first_data.into()))
})
})
}
(None, None) => {
route_connector_v2_for_payments(
&state,
merchant_context,
business_profile,
payment_dsl_input,
routing_data,
mandate_type,
)
.await
}
}
}
#[allow(clippy::too_many_arguments)]
#[cfg(feature = "v1")]
pub async fn decide_connector<F, D>(
state: SessionState,
merchant_context: &domain::MerchantContext,
business_profile: &domain::Profile,
payment_data: &mut D,
request_straight_through: Option<api::routing::StraightThroughAlgorithm>,
routing_data: &mut storage::RoutingData,
eligible_connectors: Option<Vec<enums::RoutableConnectors>>,
mandate_type: Option<api::MandateTransactionType>,
) -> RouterResult<ConnectorCallType>
where
F: Send + Clone,
D: OperationSessionGetters<F> + OperationSessionSetters<F> + Send + Sync + Clone,
{
// If the connector was already decided previously, use the same connector
// This is in case of flows like payments_sync, payments_cancel where the successive operations
// with the connector have to be made using the same connector account.
if let Some(ref connector_name) = payment_data.get_payment_attempt().connector {
// Connector was already decided previously, use the same connector
let connector_data = api::ConnectorData::get_connector_by_name(
&state.conf.connectors,
connector_name,
api::GetToken::Connector,
payment_data
.get_payment_attempt()
.merchant_connector_id
.clone(),
)
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Invalid connector name received in 'routed_through'")?;
routing_data.routed_through = Some(connector_name.clone());
logger::debug!("euclid_routing: predetermined connector present in attempt");
return Ok(ConnectorCallType::PreDetermined(connector_data.into()));
}
|
crates/router/src/core/payments.rs#chunk7
|
router
|
chunk
| null | null | null | 8,189
| null | null | null | null | null | null | null |
// Function: perform_routing_for_single_straight_through_algorithm
// File: crates/router/src/core/payments/routing.rs
// Module: router
pub fn perform_routing_for_single_straight_through_algorithm(
algorithm: &routing_types::StraightThroughAlgorithm,
) -> RoutingResult<Vec<routing_types::RoutableConnectorChoice>>
|
crates/router/src/core/payments/routing.rs
|
router
|
function_signature
| null | null | null | 67
|
perform_routing_for_single_straight_through_algorithm
| null | null | null | null | null | null |
// Implementation: impl IncomingWebhook for for Iatapay
// File: crates/hyperswitch_connectors/src/connectors/iatapay.rs
// Module: hyperswitch_connectors
// Methods: 6 total (0 public)
impl IncomingWebhook for for Iatapay
|
crates/hyperswitch_connectors/src/connectors/iatapay.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 61
| null |
Iatapay
|
IncomingWebhook for
| 6
| 0
| null | null |
// Implementation: impl api::Refund for for Boku
// File: crates/hyperswitch_connectors/src/connectors/boku.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::Refund for for Boku
|
crates/hyperswitch_connectors/src/connectors/boku.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 57
| null |
Boku
|
api::Refund for
| 0
| 0
| null | null |
// Struct: Classic
// File: crates/connector_configs/src/connector.rs
// Module: connector_configs
// Implementations: 0
pub struct Classic
|
crates/connector_configs/src/connector.rs
|
connector_configs
|
struct_definition
|
Classic
| 0
|
[] | 33
| null | null | null | null | null | null | null |
// Implementation: impl api::ConnectorCustomer for for Stax
// File: crates/hyperswitch_connectors/src/connectors/stax.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::ConnectorCustomer for for Stax
|
crates/hyperswitch_connectors/src/connectors/stax.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 57
| null |
Stax
|
api::ConnectorCustomer for
| 0
| 0
| null | null |
// Function: recovery_payments_create
// File: crates/router/src/routes/payments.rs
// Module: router
pub fn recovery_payments_create(
state: web::Data<app::AppState>,
req: actix_web::HttpRequest,
json_payload: web::Json<payment_types::RecoveryPaymentsCreate>,
) -> impl Responder
|
crates/router/src/routes/payments.rs
|
router
|
function_signature
| null | null | null | 70
|
recovery_payments_create
| null | null | null | null | null | null |
// Implementation: impl api::PaymentCapture for for Payme
// File: crates/hyperswitch_connectors/src/connectors/payme.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::PaymentCapture for for Payme
|
crates/hyperswitch_connectors/src/connectors/payme.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 57
| null |
Payme
|
api::PaymentCapture for
| 0
| 0
| null | null |
// Implementation: impl api::RefundExecute for for Fiuu
// File: crates/hyperswitch_connectors/src/connectors/fiuu.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::RefundExecute for for Fiuu
|
crates/hyperswitch_connectors/src/connectors/fiuu.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 62
| null |
Fiuu
|
api::RefundExecute for
| 0
| 0
| null | null |
// File: crates/router_env/src/logger.rs
// Module: router_env
//! Logger of the system.
pub use tracing::{debug, error, event as log, info, warn};
pub use tracing_attributes::instrument;
pub mod config;
mod defaults;
pub use crate::config::Config;
// mod macros;
pub mod types;
pub use types::{Category, Flow, Level, Tag};
mod setup;
pub use setup::{setup, TelemetryGuard};
pub mod formatter;
pub use formatter::FormattingLayer;
pub mod storage;
pub use storage::{Storage, StorageSubscription};
|
crates/router_env/src/logger.rs
|
router_env
|
full_file
| null | null | null | 117
| null | null | null | null | null | null | null |
// Function: get_signature_network
// File: crates/api_models/src/open_router.rs
// Module: api_models
pub fn get_signature_network(&self) -> Option<common_enums::CardNetwork>
|
crates/api_models/src/open_router.rs
|
api_models
|
function_signature
| null | null | null | 42
|
get_signature_network
| null | null | null | null | null | null |
// Function: execute_dsl_and_get_conditional_config
// File: crates/router/src/core/payments/conditional_configs.rs
// Module: router
pub fn execute_dsl_and_get_conditional_config(
backend_input: dsl_inputs::BackendInput,
interpreter: &backend::VirInterpreterBackend<common_types::payments::ConditionalConfigs>,
) -> ConditionalConfigResult<common_types::payments::ConditionalConfigs>
|
crates/router/src/core/payments/conditional_configs.rs
|
router
|
function_signature
| null | null | null | 85
|
execute_dsl_and_get_conditional_config
| null | null | null | null | null | null |
// Function: read_config
// File: crates/router/src/core/configs.rs
// Module: router
pub fn read_config(state: SessionState, key: &str) -> RouterResponse<api::Config>
|
crates/router/src/core/configs.rs
|
router
|
function_signature
| null | null | null | 44
|
read_config
| null | null | null | null | null | null |
// Struct: Coinbase
// File: crates/hyperswitch_connectors/src/connectors/coinbase.rs
// Module: hyperswitch_connectors
// Implementations: 17
// Traits: api::Payment, api::PaymentToken, api::PaymentSession, api::ConnectorAccessToken, api::MandateSetup, api::PaymentAuthorize, api::PaymentSync, api::PaymentCapture, api::PaymentVoid, api::Refund, api::RefundExecute, api::RefundSync, ConnectorCommon, ConnectorValidation, webhooks::IncomingWebhook, ConnectorSpecifications
pub struct Coinbase
|
crates/hyperswitch_connectors/src/connectors/coinbase.rs
|
hyperswitch_connectors
|
struct_definition
|
Coinbase
| 17
|
[
"api::Payment",
"api::PaymentToken",
"api::PaymentSession",
"api::ConnectorAccessToken",
"api::MandateSetup",
"api::PaymentAuthorize",
"api::PaymentSync",
"api::PaymentCapture",
"api::PaymentVoid",
"api::Refund",
"api::RefundExecute",
"api::RefundSync",
"ConnectorCommon",
"ConnectorValidation",
"webhooks::IncomingWebhook",
"ConnectorSpecifications"
] | 124
| null | null | null | null | null | null | null |
// Implementation: impl api::PaymentAuthorize for for Worldpayxml
// File: crates/hyperswitch_connectors/src/connectors/worldpayxml.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::PaymentAuthorize for for Worldpayxml
|
crates/hyperswitch_connectors/src/connectors/worldpayxml.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 60
| null |
Worldpayxml
|
api::PaymentAuthorize for
| 0
| 0
| null | null |
// Struct: FrmMetricRow
// File: crates/analytics/src/frm/metrics.rs
// Module: analytics
// Implementations: 0
pub struct FrmMetricRow
|
crates/analytics/src/frm/metrics.rs
|
analytics
|
struct_definition
|
FrmMetricRow
| 0
|
[] | 37
| null | null | null | null | null | null | null |
// Function: get_resources
// File: crates/storage_impl/src/mock_db.rs
// Module: storage_impl
pub fn get_resources<D, R>(
&self,
state: &KeyManagerState,
key_store: &MerchantKeyStore,
resources: MutexGuard<'_, Vec<D>>,
filter_fn: impl Fn(&&D) -> bool,
error_message: String,
) -> CustomResult<Vec<R>, StorageError>
where
D: Sync + ReverseConversion<R> + Clone,
R: Conversion,
|
crates/storage_impl/src/mock_db.rs
|
storage_impl
|
function_signature
| null | null | null | 112
|
get_resources
| null | null | null | null | null | null |
// Implementation: impl api::PaymentAuthorize for for Payu
// File: crates/hyperswitch_connectors/src/connectors/payu.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::PaymentAuthorize for for Payu
|
crates/hyperswitch_connectors/src/connectors/payu.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 57
| null |
Payu
|
api::PaymentAuthorize for
| 0
| 0
| null | null |
// Implementation: impl api::PaymentSession for for Hipay
// File: crates/hyperswitch_connectors/src/connectors/hipay.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::PaymentSession for for Hipay
|
crates/hyperswitch_connectors/src/connectors/hipay.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 58
| null |
Hipay
|
api::PaymentSession for
| 0
| 0
| null | null |
// Implementation: impl api::PaymentToken for for HyperswitchVault
// File: crates/hyperswitch_connectors/src/connectors/hyperswitch_vault.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::PaymentToken for for HyperswitchVault
|
crates/hyperswitch_connectors/src/connectors/hyperswitch_vault.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 65
| null |
HyperswitchVault
|
api::PaymentToken for
| 0
| 0
| null | null |
// File: crates/router/src/core/configs.rs
// Module: router
// Public functions: 4
use error_stack::ResultExt;
use crate::{
core::errors::{self, utils::StorageErrorExt, RouterResponse},
routes::SessionState,
services::ApplicationResponse,
types::{api, transformers::ForeignInto},
};
pub async fn set_config(state: SessionState, config: api::Config) -> RouterResponse<api::Config> {
let store = state.store.as_ref();
let config = store
.insert_config(diesel_models::configs::ConfigNew {
key: config.key,
config: config.value,
})
.await
.to_duplicate_response(errors::ApiErrorResponse::DuplicateConfig)
.attach_printable("Unknown error, while setting config key")?;
Ok(ApplicationResponse::Json(config.foreign_into()))
}
pub async fn read_config(state: SessionState, key: &str) -> RouterResponse<api::Config> {
let store = state.store.as_ref();
let config = store
.find_config_by_key(key)
.await
.to_not_found_response(errors::ApiErrorResponse::ConfigNotFound)?;
Ok(ApplicationResponse::Json(config.foreign_into()))
}
pub async fn update_config(
state: SessionState,
config_update: &api::ConfigUpdate,
) -> RouterResponse<api::Config> {
let store = state.store.as_ref();
let config = store
.update_config_by_key(&config_update.key, config_update.foreign_into())
.await
.to_not_found_response(errors::ApiErrorResponse::ConfigNotFound)?;
Ok(ApplicationResponse::Json(config.foreign_into()))
}
pub async fn config_delete(state: SessionState, key: String) -> RouterResponse<api::Config> {
let store = state.store.as_ref();
let config = store
.delete_config_by_key(&key)
.await
.to_not_found_response(errors::ApiErrorResponse::ConfigNotFound)?;
Ok(ApplicationResponse::Json(config.foreign_into()))
}
|
crates/router/src/core/configs.rs
|
router
|
full_file
| null | null | null | 431
| null | null | null | null | null | null | null |
// Function: validate
// File: crates/external_services/src/email/smtp.rs
// Module: external_services
// Documentation: Validation for the SMTP server client specific configs
pub fn validate(&self) -> Result<(), &'static str>
|
crates/external_services/src/email/smtp.rs
|
external_services
|
function_signature
| null | null | null | 49
|
validate
| null | null | null | null | null | null |
// Implementation: impl api::PaymentVoid for for Opennode
// File: crates/hyperswitch_connectors/src/connectors/opennode.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::PaymentVoid for for Opennode
|
crates/hyperswitch_connectors/src/connectors/opennode.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 59
| null |
Opennode
|
api::PaymentVoid for
| 0
| 0
| null | null |
// Implementation: impl api::Refund for for Powertranz
// File: crates/hyperswitch_connectors/src/connectors/powertranz.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::Refund for for Powertranz
|
crates/hyperswitch_connectors/src/connectors/powertranz.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 60
| null |
Powertranz
|
api::Refund for
| 0
| 0
| null | null |
// Struct: PlaidPaymentsRequest
// File: crates/hyperswitch_connectors/src/connectors/plaid/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct PlaidPaymentsRequest
|
crates/hyperswitch_connectors/src/connectors/plaid/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
PlaidPaymentsRequest
| 0
|
[] | 49
| null | null | null | null | null | null | null |
// Implementation: impl FileMetadata
// File: crates/diesel_models/src/query/file.rs
// Module: diesel_models
// Methods: 3 total (0 public)
impl FileMetadata
|
crates/diesel_models/src/query/file.rs
|
diesel_models
|
impl_block
| null | null | null | 38
| null |
FileMetadata
| null | 3
| 0
| null | null |
// Function: sso_sign
// File: crates/router/src/core/user.rs
// Module: router
pub fn sso_sign(
state: SessionState,
request: user_api::SsoSignInRequest,
user_from_single_purpose_token: Option<auth::UserFromSinglePurposeToken>,
) -> UserResponse<user_api::TokenResponse>
|
crates/router/src/core/user.rs
|
router
|
function_signature
| null | null | null | 74
|
sso_sign
| null | null | null | null | null | null |
// Struct: PaysafeApplePayPaymentToken
// File: crates/hyperswitch_connectors/src/connectors/paysafe/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct PaysafeApplePayPaymentToken
|
crates/hyperswitch_connectors/src/connectors/paysafe/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
PaysafeApplePayPaymentToken
| 0
|
[] | 54
| null | null | null | null | null | null | null |
// Struct: GpayTokenParameters
// File: crates/hyperswitch_connectors/src/connectors/trustpay/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct GpayTokenParameters
|
crates/hyperswitch_connectors/src/connectors/trustpay/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
GpayTokenParameters
| 0
|
[] | 50
| null | null | null | null | null | null | null |
// Implementation: impl Default for for PayoutMethodData
// File: crates/api_models/src/payouts.rs
// Module: api_models
// Methods: 1 total (0 public)
impl Default for for PayoutMethodData
|
crates/api_models/src/payouts.rs
|
api_models
|
impl_block
| null | null | null | 48
| null |
PayoutMethodData
|
Default for
| 1
| 0
| null | null |
// Implementation: impl ApplePayPaymentData
// File: crates/common_types/src/payments.rs
// Module: common_types
// Methods: 4 total (4 public)
impl ApplePayPaymentData
|
crates/common_types/src/payments.rs
|
common_types
|
impl_block
| null | null | null | 41
| null |
ApplePayPaymentData
| null | 4
| 4
| null | null |
// Module Structure
// File: crates/router/src/core/payments/vault_session.rs
// Module: router
// Public exports:
pub use common_enums::enums::CallConnectorAction;
pub use hyperswitch_domain_models::{
mandates::MandateData,
payment_address::PaymentAddress,
payments::{HeaderPayload, PaymentIntentData},
router_data::{PaymentMethodToken, RouterData},
router_data_v2::{flow_common_types::VaultConnectorFlowData, RouterDataV2},
router_flow_types::ExternalVaultCreateFlow,
router_request_types::CustomerDetails,
types::{VaultRouterData, VaultRouterDataV2},
};
|
crates/router/src/core/payments/vault_session.rs
|
router
|
module_structure
| null | null | null | 134
| null | null | null | null | null | 0
| 2
|
// Struct: ClientRiskInformationRules
// File: crates/hyperswitch_connectors/src/connectors/bankofamerica/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct ClientRiskInformationRules
|
crates/hyperswitch_connectors/src/connectors/bankofamerica/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
ClientRiskInformationRules
| 0
|
[] | 52
| null | null | null | null | null | null | null |
// Function: construct_event_builder
// File: crates/router/src/core/payments/routing/utils.rs
// Module: router
pub fn construct_event_builder(
self,
url: String,
routing_engine: routing_events::RoutingEngine,
method: routing_events::ApiMethod,
) -> RoutingResult<Self>
|
crates/router/src/core/payments/routing/utils.rs
|
router
|
function_signature
| null | null | null | 66
|
construct_event_builder
| null | null | null | null | null | null |
// File: crates/hyperswitch_interfaces/src/api/fraud_check.rs
// Module: hyperswitch_interfaces
//! FRM interface
use hyperswitch_domain_models::{
router_flow_types::{Checkout, Fulfillment, RecordReturn, Sale, Transaction},
router_request_types::fraud_check::{
FraudCheckCheckoutData, FraudCheckFulfillmentData, FraudCheckRecordReturnData,
FraudCheckSaleData, FraudCheckTransactionData,
},
router_response_types::fraud_check::FraudCheckResponseData,
};
use crate::api::ConnectorIntegration;
/// trait FraudCheckSale
pub trait FraudCheckSale:
ConnectorIntegration<Sale, FraudCheckSaleData, FraudCheckResponseData>
{
}
/// trait FraudCheckCheckout
pub trait FraudCheckCheckout:
ConnectorIntegration<Checkout, FraudCheckCheckoutData, FraudCheckResponseData>
{
}
/// trait FraudCheckTransaction
pub trait FraudCheckTransaction:
ConnectorIntegration<Transaction, FraudCheckTransactionData, FraudCheckResponseData>
{
}
/// trait FraudCheckFulfillment
pub trait FraudCheckFulfillment:
ConnectorIntegration<Fulfillment, FraudCheckFulfillmentData, FraudCheckResponseData>
{
}
/// trait FraudCheckRecordReturn
pub trait FraudCheckRecordReturn:
ConnectorIntegration<RecordReturn, FraudCheckRecordReturnData, FraudCheckResponseData>
{
}
/// trait FraudCheck
pub trait FraudCheck:
super::ConnectorCommon
+ FraudCheckSale
+ FraudCheckTransaction
+ FraudCheckCheckout
+ FraudCheckFulfillment
+ FraudCheckRecordReturn
{
}
|
crates/hyperswitch_interfaces/src/api/fraud_check.rs
|
hyperswitch_interfaces
|
full_file
| null | null | null | 328
| null | null | null | null | null | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.