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
⌀ |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
// File: crates/router/src/services/openidconnect.rs
// Module: router
// Public functions: 2
use common_utils::errors::ErrorSwitch;
use error_stack::ResultExt;
use external_services::http_client::client;
use masking::{ExposeInterface, Secret};
use oidc::TokenResponse;
use openidconnect::{self as oidc, core as oidc_core};
use redis_interface::RedisConnectionPool;
use storage_impl::errors::ApiClientError;
use crate::{
consts,
core::errors::{UserErrors, UserResult},
routes::SessionState,
types::domain::user::UserEmail,
};
pub async fn get_authorization_url(
state: SessionState,
redirect_url: String,
redirect_state: Secret<String>,
base_url: Secret<String>,
client_id: Secret<String>,
) -> UserResult<url::Url> {
let discovery_document = get_discovery_document(base_url, &state).await?;
let (auth_url, csrf_token, nonce) =
get_oidc_core_client(discovery_document, client_id, None, redirect_url)?
.authorize_url(
oidc_core::CoreAuthenticationFlow::AuthorizationCode,
|| oidc::CsrfToken::new(redirect_state.expose()),
oidc::Nonce::new_random,
)
.add_scope(oidc::Scope::new("email".to_string()))
.url();
// Save csrf & nonce as key value respectively
let key = get_oidc_redis_key(csrf_token.secret());
get_redis_connection_for_global_tenant(&state)?
.set_key_with_expiry(&key.into(), nonce.secret(), consts::user::REDIS_SSO_TTL)
.await
.change_context(UserErrors::InternalServerError)
.attach_printable("Failed to save csrf-nonce in redis")?;
Ok(auth_url)
}
pub async fn get_user_email_from_oidc_provider(
state: &SessionState,
redirect_url: String,
redirect_state: Secret<String>,
base_url: Secret<String>,
client_id: Secret<String>,
authorization_code: Secret<String>,
client_secret: Secret<String>,
) -> UserResult<UserEmail> {
let nonce = get_nonce_from_redis(state, &redirect_state).await?;
let discovery_document = get_discovery_document(base_url, state).await?;
let client = get_oidc_core_client(
discovery_document,
client_id,
Some(client_secret),
redirect_url,
)?;
let nonce_clone = nonce.clone();
client
.authorize_url(
oidc_core::CoreAuthenticationFlow::AuthorizationCode,
|| oidc::CsrfToken::new(redirect_state.expose()),
|| nonce_clone,
)
.add_scope(oidc::Scope::new("email".to_string()));
// Send request to OpenId provider with authorization code
let token_response = client
.exchange_code(oidc::AuthorizationCode::new(authorization_code.expose()))
.request_async(|req| get_oidc_reqwest_client(state, req))
.await
.map_err(|e| match e {
oidc::RequestTokenError::ServerResponse(resp)
if resp.error() == &oidc_core::CoreErrorResponseType::InvalidGrant =>
{
UserErrors::SSOFailed
}
_ => UserErrors::InternalServerError,
})
.attach_printable("Failed to exchange code and fetch oidc token")?;
// Fetch id token from response
let id_token = token_response
.id_token()
.ok_or(UserErrors::InternalServerError)
.attach_printable("Id Token not provided in token response")?;
// Verify id token
let id_token_claims = id_token
.claims(&client.id_token_verifier(), &nonce)
.change_context(UserErrors::InternalServerError)
.attach_printable("Failed to verify id token")?;
// Get email from token
let email_from_token = id_token_claims
.email()
.map(|email| email.to_string())
.ok_or(UserErrors::InternalServerError)
.attach_printable("OpenID Provider Didnt provide email")?;
UserEmail::new(Secret::new(email_from_token))
.change_context(UserErrors::InternalServerError)
.attach_printable("Failed to create email type")
}
// TODO: Cache Discovery Document
async fn get_discovery_document(
base_url: Secret<String>,
state: &SessionState,
) -> UserResult<oidc_core::CoreProviderMetadata> {
let issuer_url =
oidc::IssuerUrl::new(base_url.expose()).change_context(UserErrors::InternalServerError)?;
oidc_core::CoreProviderMetadata::discover_async(issuer_url, |req| {
get_oidc_reqwest_client(state, req)
})
.await
.change_context(UserErrors::InternalServerError)
}
fn get_oidc_core_client(
discovery_document: oidc_core::CoreProviderMetadata,
client_id: Secret<String>,
client_secret: Option<Secret<String>>,
redirect_url: String,
) -> UserResult<oidc_core::CoreClient> {
let client_id = oidc::ClientId::new(client_id.expose());
let client_secret = client_secret.map(|secret| oidc::ClientSecret::new(secret.expose()));
let redirect_url = oidc::RedirectUrl::new(redirect_url)
.change_context(UserErrors::InternalServerError)
.attach_printable("Error creating redirect URL type")?;
Ok(
oidc_core::CoreClient::from_provider_metadata(discovery_document, client_id, client_secret)
.set_redirect_uri(redirect_url),
)
}
async fn get_nonce_from_redis(
state: &SessionState,
redirect_state: &Secret<String>,
) -> UserResult<oidc::Nonce> {
let redis_connection = get_redis_connection_for_global_tenant(state)?;
let redirect_state = redirect_state.clone().expose();
let key = get_oidc_redis_key(&redirect_state);
redis_connection
.get_key::<Option<String>>(&key.into())
.await
.change_context(UserErrors::InternalServerError)
.attach_printable("Error Fetching CSRF from redis")?
.map(oidc::Nonce::new)
.ok_or(UserErrors::SSOFailed)
.attach_printable("Cannot find csrf in redis. Csrf invalid or expired")
}
async fn get_oidc_reqwest_client(
state: &SessionState,
request: oidc::HttpRequest,
) -> Result<oidc::HttpResponse, ApiClientError> {
let client = client::create_client(&state.conf.proxy, None, None, None)
.map_err(|e| e.current_context().switch())?;
let mut request_builder = client
.request(request.method, request.url)
.body(request.body);
for (name, value) in &request.headers {
request_builder = request_builder.header(name.as_str(), value.as_bytes());
}
let request = request_builder
.build()
.map_err(|_| ApiClientError::ClientConstructionFailed)?;
let response = client
.execute(request)
.await
.map_err(|_| ApiClientError::RequestNotSent("OpenIDConnect".to_string()))?;
Ok(oidc::HttpResponse {
status_code: response.status(),
headers: response.headers().to_owned(),
body: response
.bytes()
.await
.map_err(|_| ApiClientError::ResponseDecodingFailed)?
.to_vec(),
})
}
fn get_oidc_redis_key(csrf: &str) -> String {
format!("{}OIDC_{}", consts::user::REDIS_SSO_PREFIX, csrf)
}
fn get_redis_connection_for_global_tenant(
state: &SessionState,
) -> UserResult<std::sync::Arc<RedisConnectionPool>> {
state
.global_store
.get_redis_conn()
.change_context(UserErrors::InternalServerError)
.attach_printable("Failed to get redis connection")
}
|
crates/router/src/services/openidconnect.rs
|
router
|
full_file
| null | null | null | 1,690
| null | null | null | null | null | null | null |
// Function: mk_basilisk_req
// File: crates/router/src/core/payment_methods/transformers.rs
// Module: router
pub fn mk_basilisk_req(
jwekey: &settings::Jwekey,
jws: &str,
locker_choice: api_enums::LockerChoice,
) -> CustomResult<encryption::JweBody, errors::VaultError>
|
crates/router/src/core/payment_methods/transformers.rs
|
router
|
function_signature
| null | null | null | 82
|
mk_basilisk_req
| null | null | null | null | null | null |
// Struct: AveragePaymentTime
// File: crates/api_models/src/analytics/sdk_events.rs
// Module: api_models
// Implementations: 0
pub struct AveragePaymentTime
|
crates/api_models/src/analytics/sdk_events.rs
|
api_models
|
struct_definition
|
AveragePaymentTime
| 0
|
[] | 38
| null | null | null | null | null | null | null |
// Implementation: impl api::Payment for for Payload
// File: crates/hyperswitch_connectors/src/connectors/payload.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::Payment for for Payload
|
crates/hyperswitch_connectors/src/connectors/payload.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 53
| null |
Payload
|
api::Payment for
| 0
| 0
| null | null |
// Function: store_card_in_locker
// File: crates/router/src/core/payment_methods/tokenize/card_executor.rs
// Module: router
pub fn store_card_in_locker(
&self,
card: &domain::CardDetail,
customer_id: &id_type::CustomerId,
) -> RouterResult<pm_transformers::StoreCardRespPayload>
|
crates/router/src/core/payment_methods/tokenize/card_executor.rs
|
router
|
function_signature
| null | null | null | 75
|
store_card_in_locker
| null | null | null | null | null | null |
payment_data,
req,
customer,
connector_http_status_code,
external_latency,
))
}
#[cfg(feature = "v1")]
// This function is intended for use when the feature being implemented is not aligned with the
// core payment operations.
#[allow(clippy::too_many_arguments, clippy::type_complexity)]
#[instrument(skip_all, fields(payment_id, merchant_id))]
pub async fn proxy_for_payments_operation_core<F, Req, Op, FData, D>(
state: &SessionState,
req_state: ReqState,
merchant_context: domain::MerchantContext,
profile_id_from_auth_layer: Option<id_type::ProfileId>,
operation: Op,
req: Req,
call_connector_action: CallConnectorAction,
auth_flow: services::AuthFlow,
header_payload: HeaderPayload,
return_raw_connector_response: Option<bool>,
) -> RouterResult<(D, Req, Option<domain::Customer>, Option<u16>, Option<u128>)>
where
F: Send + Clone + Sync,
Req: Authenticate + Clone,
Op: Operation<F, Req, Data = D> + Send + Sync,
D: OperationSessionGetters<F> + OperationSessionSetters<F> + Send + Sync + Clone,
// To create connector flow specific interface data
D: ConstructFlowSpecificData<F, FData, router_types::PaymentsResponseData>,
RouterData<F, FData, router_types::PaymentsResponseData>: Feature<F, FData>,
// To construct connector flow specific api
dyn api::Connector:
services::api::ConnectorIntegration<F, FData, router_types::PaymentsResponseData>,
// To perform router related operation for PaymentResponse
PaymentResponse: Operation<F, FData, Data = D>,
FData: Send + Sync + Clone,
{
let operation: BoxedOperation<'_, F, Req, D> = Box::new(operation);
tracing::Span::current().record(
"merchant_id",
merchant_context
.get_merchant_account()
.get_id()
.get_string_repr(),
);
let (operation, validate_result) = operation
.to_validate_request()?
.validate_request(&req, &merchant_context)?;
tracing::Span::current().record("payment_id", format!("{}", validate_result.payment_id));
let operations::GetTrackerResponse {
operation,
customer_details: _,
mut payment_data,
business_profile,
mandate_type: _,
} = operation
.to_get_tracker()?
.get_trackers(
state,
&validate_result.payment_id,
&req,
&merchant_context,
auth_flow,
&header_payload,
)
.await?;
core_utils::validate_profile_id_from_auth_layer(
profile_id_from_auth_layer,
&payment_data.get_payment_intent().clone(),
)?;
common_utils::fp_utils::when(!should_call_connector(&operation, &payment_data), || {
Err(errors::ApiErrorResponse::IncorrectPaymentMethodConfiguration).attach_printable(format!(
"Nti and card details based mit flow is not support for this {operation:?} payment operation"
))
})?;
let connector_choice = operation
.to_domain()?
.get_connector(
&merchant_context,
&state.clone(),
&req,
payment_data.get_payment_intent(),
)
.await?;
let connector = set_eligible_connector_for_nti_in_payment_data(
state,
&business_profile,
merchant_context.get_merchant_key_store(),
&mut payment_data,
connector_choice,
)
.await?;
let should_add_task_to_process_tracker = should_add_task_to_process_tracker(&payment_data);
let locale = header_payload.locale.clone();
let schedule_time = if should_add_task_to_process_tracker {
payment_sync::get_sync_process_schedule_time(
&*state.store,
connector.connector.id(),
merchant_context.get_merchant_account().get_id(),
0,
)
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Failed while getting process schedule time")?
} else {
None
};
let (router_data, mca) = proxy_for_call_connector_service(
state,
req_state.clone(),
&merchant_context,
connector.clone(),
&operation,
&mut payment_data,
&None,
call_connector_action.clone(),
&validate_result,
schedule_time,
header_payload.clone(),
&business_profile,
return_raw_connector_response,
)
.await?;
let op_ref = &operation;
let should_trigger_post_processing_flows = is_operation_confirm(&operation);
let operation = Box::new(PaymentResponse);
let connector_http_status_code = router_data.connector_http_status_code;
let external_latency = router_data.external_latency;
add_connector_http_status_code_metrics(connector_http_status_code);
#[cfg(all(feature = "dynamic_routing", feature = "v1"))]
let routable_connectors =
convert_connector_data_to_routable_connectors(&[connector.clone().into()])
.map_err(|e| logger::error!(routable_connector_error=?e))
.unwrap_or_default();
let mut payment_data = operation
.to_post_update_tracker()?
.update_tracker(
state,
payment_data,
router_data,
merchant_context.get_merchant_key_store(),
merchant_context.get_merchant_account().storage_scheme,
&locale,
#[cfg(all(feature = "dynamic_routing", feature = "v1"))]
routable_connectors,
#[cfg(all(feature = "dynamic_routing", feature = "v1"))]
&business_profile,
)
.await?;
if should_trigger_post_processing_flows {
complete_postprocessing_steps_if_required(
state,
&merchant_context,
&None,
&mca,
&connector,
&mut payment_data,
op_ref,
Some(header_payload.clone()),
)
.await?;
}
let cloned_payment_data = payment_data.clone();
utils::trigger_payments_webhook(
merchant_context.clone(),
business_profile,
cloned_payment_data,
None,
state,
operation,
)
.await
.map_err(|error| logger::warn!(payments_outgoing_webhook_error=?error))
.ok();
Ok((
payment_data,
req,
None,
connector_http_status_code,
external_latency,
))
}
#[cfg(feature = "v2")]
#[allow(clippy::too_many_arguments, clippy::type_complexity)]
#[instrument(skip_all, fields(payment_id, merchant_id))]
pub async fn proxy_for_payments_operation_core<F, Req, Op, FData, D>(
state: &SessionState,
req_state: ReqState,
merchant_context: domain::MerchantContext,
profile: domain::Profile,
operation: Op,
req: Req,
get_tracker_response: operations::GetTrackerResponse<D>,
call_connector_action: CallConnectorAction,
header_payload: HeaderPayload,
return_raw_connector_response: Option<bool>,
) -> RouterResult<(D, Req, Option<u16>, Option<u128>)>
where
F: Send + Clone + Sync,
Req: Send + Sync + Authenticate,
Op: Operation<F, Req, Data = D> + Send + Sync,
D: OperationSessionGetters<F> + OperationSessionSetters<F> + Send + Sync + Clone,
// To create connector flow specific interface data
D: ConstructFlowSpecificData<F, FData, router_types::PaymentsResponseData>,
RouterData<F, FData, router_types::PaymentsResponseData>: Feature<F, FData>,
// To construct connector flow specific api
dyn api::Connector:
services::api::ConnectorIntegration<F, FData, router_types::PaymentsResponseData>,
RouterData<F, FData, router_types::PaymentsResponseData>:
hyperswitch_domain_models::router_data::TrackerPostUpdateObjects<F, FData, D>,
// To perform router related operation for PaymentResponse
PaymentResponse: Operation<F, FData, Data = D>,
FData: Send + Sync + Clone,
{
let operation: BoxedOperation<'_, F, Req, D> = Box::new(operation);
// Get the trackers related to track the state of the payment
let operations::GetTrackerResponse { mut payment_data } = get_tracker_response;
// consume the req merchant_connector_id and set it in the payment_data
let connector = operation
.to_domain()?
.perform_routing(&merchant_context, &profile, state, &mut payment_data)
.await?;
let payment_data = match connector {
ConnectorCallType::PreDetermined(connector_data) => {
let router_data = proxy_for_call_connector_service(
state,
req_state.clone(),
&merchant_context,
connector_data.connector_data.clone(),
&operation,
&mut payment_data,
call_connector_action.clone(),
header_payload.clone(),
&profile,
return_raw_connector_response,
)
.await?;
let payments_response_operation = Box::new(PaymentResponse);
payments_response_operation
.to_post_update_tracker()?
.update_tracker(
state,
payment_data,
router_data,
merchant_context.get_merchant_key_store(),
merchant_context.get_merchant_account().storage_scheme,
)
.await?
}
ConnectorCallType::Retryable(vec) => todo!(),
ConnectorCallType::SessionMultiple(vec) => todo!(),
ConnectorCallType::Skip => payment_data,
};
Ok((payment_data, req, None, None))
}
#[cfg(feature = "v2")]
#[allow(clippy::too_many_arguments, clippy::type_complexity)]
#[instrument(skip_all, fields(payment_id, merchant_id))]
pub async fn external_vault_proxy_for_payments_operation_core<F, Req, Op, FData, D>(
state: &SessionState,
req_state: ReqState,
merchant_context: domain::MerchantContext,
profile: domain::Profile,
operation: Op,
req: Req,
get_tracker_response: operations::GetTrackerResponse<D>,
call_connector_action: CallConnectorAction,
header_payload: HeaderPayload,
return_raw_connector_response: Option<bool>,
) -> RouterResult<(D, Req, Option<u16>, Option<u128>)>
where
F: Send + Clone + Sync,
Req: Send + Sync + Authenticate,
Op: Operation<F, Req, Data = D> + Send + Sync,
D: OperationSessionGetters<F> + OperationSessionSetters<F> + Send + Sync + Clone,
// To create connector flow specific interface data
D: ConstructFlowSpecificData<F, FData, router_types::PaymentsResponseData>,
RouterData<F, FData, router_types::PaymentsResponseData>: Feature<F, FData>,
// To construct connector flow specific api
dyn api::Connector:
services::api::ConnectorIntegration<F, FData, router_types::PaymentsResponseData>,
RouterData<F, FData, router_types::PaymentsResponseData>:
hyperswitch_domain_models::router_data::TrackerPostUpdateObjects<F, FData, D>,
// To perform router related operation for PaymentResponse
PaymentResponse: Operation<F, FData, Data = D>,
FData: Send + Sync + Clone,
{
let operation: BoxedOperation<'_, F, Req, D> = Box::new(operation);
// Get the trackers related to track the state of the payment
let operations::GetTrackerResponse { mut payment_data } = get_tracker_response;
let (_operation, customer) = operation
.to_domain()?
.get_customer_details(
state,
&mut payment_data,
merchant_context.get_merchant_key_store(),
merchant_context.get_merchant_account().storage_scheme,
)
.await
.to_not_found_response(errors::ApiErrorResponse::CustomerNotFound)
.attach_printable("Failed while fetching/creating customer")?;
operation
.to_domain()?
.create_or_fetch_payment_method(state, &merchant_context, &profile, &mut payment_data)
.await?;
// consume the req merchant_connector_id and set it in the payment_data
let connector = operation
.to_domain()?
.perform_routing(&merchant_context, &profile, state, &mut payment_data)
.await?;
let payment_data = match connector {
ConnectorCallType::PreDetermined(connector_data) => {
let (mca_type_details, external_vault_mca_type_details, updated_customer, router_data) =
call_connector_service_prerequisites_for_external_vault_proxy(
state,
req_state.clone(),
&merchant_context,
connector_data.connector_data.clone(),
&operation,
&mut payment_data,
&customer,
call_connector_action.clone(),
None,
header_payload.clone(),
None,
&profile,
false,
false, //should_retry_with_pan is set to false in case of PreDetermined ConnectorCallType
req.should_return_raw_response(),
)
.await?;
let router_data = call_unified_connector_service_for_external_proxy(
state,
req_state.clone(),
&merchant_context,
connector_data.connector_data.clone(),
&operation,
&mut payment_data,
&customer,
call_connector_action.clone(),
None, // schedule_time is not used in PreDetermined ConnectorCallType
header_payload.clone(),
#[cfg(feature = "frm")]
None,
&profile,
false,
false, //should_retry_with_pan is set to false in case of PreDetermined ConnectorCallType
req.should_return_raw_response(),
mca_type_details,
external_vault_mca_type_details,
router_data,
updated_customer,
)
.await?;
// update payment method if its a successful transaction
if router_data.status.is_success() {
operation
.to_domain()?
.update_payment_method(state, &merchant_context, &mut payment_data)
.await;
}
let payments_response_operation = Box::new(PaymentResponse);
payments_response_operation
.to_post_update_tracker()?
.update_tracker(
state,
payment_data,
router_data,
merchant_context.get_merchant_key_store(),
merchant_context.get_merchant_account().storage_scheme,
)
.await?
}
ConnectorCallType::Retryable(_) => todo!(),
ConnectorCallType::SessionMultiple(_) => todo!(),
ConnectorCallType::Skip => payment_data,
};
Ok((payment_data, req, None, None))
}
#[cfg(feature = "v2")]
#[allow(clippy::too_many_arguments, clippy::type_complexity)]
#[instrument(skip_all, fields(payment_id, merchant_id))]
pub async fn payments_intent_operation_core<F, Req, Op, D>(
state: &SessionState,
req_state: ReqState,
merchant_context: domain::MerchantContext,
profile: domain::Profile,
operation: Op,
req: Req,
payment_id: id_type::GlobalPaymentId,
header_payload: HeaderPayload,
) -> RouterResult<(D, Req, Option<domain::Customer>)>
where
F: Send + Clone + Sync,
Req: Clone,
Op: Operation<F, Req, Data = D> + Send + Sync,
D: OperationSessionGetters<F> + OperationSessionSetters<F> + Send + Sync + Clone,
{
let operation: BoxedOperation<'_, F, Req, D> = Box::new(operation);
tracing::Span::current().record(
"merchant_id",
merchant_context
.get_merchant_account()
.get_id()
.get_string_repr(),
);
let _validate_result = operation
.to_validate_request()?
.validate_request(&req, &merchant_context)?;
tracing::Span::current().record("global_payment_id", payment_id.get_string_repr());
let operations::GetTrackerResponse { mut payment_data } = operation
.to_get_tracker()?
.get_trackers(
state,
&payment_id,
&req,
&merchant_context,
&profile,
&header_payload,
)
.await?;
let (_operation, customer) = operation
.to_domain()?
.get_customer_details(
state,
&mut payment_data,
merchant_context.get_merchant_key_store(),
merchant_context.get_merchant_account().storage_scheme,
)
.await
.to_not_found_response(errors::ApiErrorResponse::CustomerNotFound)
.attach_printable("Failed while fetching/creating customer")?;
let (_operation, payment_data) = operation
.to_update_tracker()?
.update_trackers(
state,
req_state,
payment_data,
customer.clone(),
merchant_context.get_merchant_account().storage_scheme,
None,
merchant_context.get_merchant_key_store(),
None,
header_payload,
)
.await?;
Ok((payment_data, req, customer))
}
#[cfg(feature = "v2")]
#[allow(clippy::too_many_arguments, clippy::type_complexity)]
#[instrument(skip_all, fields(payment_id, merchant_id))]
pub async fn payments_attempt_operation_core<F, Req, Op, D>(
state: &SessionState,
req_state: ReqState,
merchant_context: domain::MerchantContext,
profile: domain::Profile,
operation: Op,
req: Req,
payment_id: id_type::GlobalPaymentId,
header_payload: HeaderPayload,
) -> RouterResult<(D, Req, Option<domain::Customer>)>
where
F: Send + Clone + Sync,
Req: Clone,
Op: Operation<F, Req, Data = D> + Send + Sync,
D: OperationSessionGetters<F> + Send + Sync + Clone,
{
let operation: BoxedOperation<'_, F, Req, D> = Box::new(operation);
tracing::Span::current().record(
"merchant_id",
merchant_context
.get_merchant_account()
.get_id()
.get_string_repr(),
);
let _validate_result = operation
.to_validate_request()?
.validate_request(&req, &merchant_context)?;
tracing::Span::current().record("global_payment_id", payment_id.get_string_repr());
let operations::GetTrackerResponse { mut payment_data } = operation
.to_get_tracker()?
.get_trackers(
state,
&payment_id,
&req,
&merchant_context,
&profile,
&header_payload,
)
.await?;
let (_operation, customer) = operation
.to_domain()?
.get_customer_details(
state,
&mut payment_data,
merchant_context.get_merchant_key_store(),
merchant_context.get_merchant_account().storage_scheme,
)
.await
.to_not_found_response(errors::ApiErrorResponse::CustomerNotFound)
.attach_printable("Failed while fetching/creating customer")?;
let (_operation, payment_data) = operation
.to_update_tracker()?
.update_trackers(
state,
req_state,
payment_data,
customer.clone(),
merchant_context.get_merchant_account().storage_scheme,
None,
merchant_context.get_merchant_key_store(),
None,
header_payload,
)
.await?;
Ok((payment_data, req, customer))
}
#[instrument(skip_all)]
#[cfg(feature = "v1")]
pub async fn call_decision_manager<F, D>(
state: &SessionState,
merchant_context: &domain::MerchantContext,
_business_profile: &domain::Profile,
payment_data: &D,
) -> RouterResult<Option<enums::AuthenticationType>>
where
F: Clone,
D: OperationSessionGetters<F>,
{
let setup_mandate = payment_data.get_setup_mandate();
let payment_method_data = payment_data.get_payment_method_data();
let payment_dsl_data = core_routing::PaymentsDslInput::new(
setup_mandate,
payment_data.get_payment_attempt(),
payment_data.get_payment_intent(),
payment_method_data,
payment_data.get_address(),
payment_data.get_recurring_details(),
payment_data.get_currency(),
);
let algorithm_ref: api::routing::RoutingAlgorithmRef = merchant_context
.get_merchant_account()
.routing_algorithm
.clone()
.map(|val| val.parse_value("routing algorithm"))
.transpose()
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Could not decode the routing algorithm")?
.unwrap_or_default();
let output = perform_decision_management(
state,
algorithm_ref,
merchant_context.get_merchant_account().get_id(),
&payment_dsl_data,
)
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Could not decode the conditional config")?;
Ok(payment_dsl_data
.payment_attempt
.authentication_type
.or(output.override_3ds))
}
// TODO: Move to business profile surcharge column
#[instrument(skip_all)]
#[cfg(feature = "v2")]
pub fn call_decision_manager<F>(
state: &SessionState,
record: common_types::payments::DecisionManagerRecord,
payment_data: &PaymentConfirmData<F>,
) -> RouterResult<Option<enums::AuthenticationType>>
where
F: Clone,
{
let payment_method_data = payment_data.get_payment_method_data();
let payment_dsl_data = core_routing::PaymentsDslInput::new(
None,
payment_data.get_payment_attempt(),
payment_data.get_payment_intent(),
payment_method_data,
payment_data.get_address(),
None,
payment_data.get_currency(),
);
let output = perform_decision_management(record, &payment_dsl_data)
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Could not decode the conditional config")?;
Ok(output.override_3ds)
}
#[cfg(feature = "v2")]
#[instrument(skip_all)]
async fn populate_surcharge_details<F>(
state: &SessionState,
payment_data: &mut PaymentData<F>,
) -> RouterResult<()>
where
F: Send + Clone,
{
todo!()
}
#[cfg(feature = "v1")]
#[instrument(skip_all)]
async fn populate_surcharge_details<F>(
state: &SessionState,
payment_data: &mut PaymentData<F>,
) -> RouterResult<()>
where
F: Send + Clone,
{
if payment_data
.payment_intent
.surcharge_applicable
.unwrap_or(false)
{
logger::debug!("payment_intent.surcharge_applicable = true");
if let Some(surcharge_details) = payment_data.payment_attempt.get_surcharge_details() {
// if retry payment, surcharge would have been populated from the previous attempt. Use the same surcharge
let surcharge_details =
types::SurchargeDetails::from((&surcharge_details, &payment_data.payment_attempt));
payment_data.surcharge_details = Some(surcharge_details);
return Ok(());
}
let raw_card_key = payment_data
.payment_method_data
.as_ref()
.and_then(helpers::get_key_params_for_surcharge_details)
.map(|(payment_method, payment_method_type, card_network)| {
types::SurchargeKey::PaymentMethodData(
payment_method,
payment_method_type,
card_network,
)
});
let saved_card_key = payment_data.token.clone().map(types::SurchargeKey::Token);
let surcharge_key = raw_card_key
.or(saved_card_key)
.get_required_value("payment_method_data or payment_token")?;
logger::debug!(surcharge_key_confirm =? surcharge_key);
let calculated_surcharge_details =
match types::SurchargeMetadata::get_individual_surcharge_detail_from_redis(
state,
surcharge_key,
&payment_data.payment_attempt.attempt_id,
)
.await
{
Ok(surcharge_details) => Some(surcharge_details),
Err(err) if err.current_context() == &RedisError::NotFound => None,
Err(err) => {
Err(err).change_context(errors::ApiErrorResponse::InternalServerError)?
}
};
payment_data.surcharge_details = calculated_surcharge_details.clone();
//Update payment_attempt net_amount with surcharge details
payment_data
.payment_attempt
.net_amount
.set_surcharge_details(calculated_surcharge_details);
} else {
let surcharge_details =
payment_data
.payment_attempt
.get_surcharge_details()
.map(|surcharge_details| {
logger::debug!("surcharge sent in payments create request");
types::SurchargeDetails::from((
&surcharge_details,
&payment_data.payment_attempt,
))
});
payment_data.surcharge_details = surcharge_details;
}
Ok(())
}
#[inline]
pub fn get_connector_data(
connectors: &mut IntoIter<api::ConnectorRoutingData>,
) -> RouterResult<api::ConnectorRoutingData> {
connectors
.next()
.ok_or(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Connector not found in connectors iterator")
}
#[cfg(feature = "v1")]
pub fn get_connector_with_networks(
connectors: &mut IntoIter<api::ConnectorRoutingData>,
) -> Option<(api::ConnectorData, enums::CardNetwork)> {
connectors.find_map(|connector| {
connector
.network
.map(|network| (connector.connector_data, network))
})
}
#[cfg(feature = "v1")]
fn get_connector_data_with_routing_decision(
connectors: &mut IntoIter<api::ConnectorRoutingData>,
business_profile: &domain::Profile,
debit_routing_output_optional: Option<api_models::open_router::DebitRoutingOutput>,
) -> RouterResult<(
api::ConnectorData,
Option<routing_helpers::RoutingDecisionData>,
)> {
if business_profile.is_debit_routing_enabled && debit_routing_output_optional.is_some() {
if let Some((data, card_network)) = get_connector_with_networks(connectors) {
let debit_routing_output =
debit_routing_output_optional.get_required_value("debit routing output")?;
let routing_decision =
routing_helpers::RoutingDecisionData::get_debit_routing_decision_data(
card_network,
Some(debit_routing_output),
);
return Ok((data, Some(routing_decision)));
}
}
Ok((get_connector_data(connectors)?.connector_data, None))
}
#[cfg(feature = "v2")]
#[instrument(skip_all)]
pub async fn call_surcharge_decision_management_for_session_flow(
_state: &SessionState,
_merchant_context: &domain::MerchantContext,
_payment_attempt: &storage::PaymentAttempt,
_payment_intent: &storage::PaymentIntent,
_billing_address: Option<hyperswitch_domain_models::address::Address>,
_session_connector_data: &[api::SessionConnectorData],
) -> RouterResult<Option<api::SessionSurchargeDetails>> {
todo!()
}
#[cfg(feature = "v1")]
#[instrument(skip_all)]
pub async fn call_surcharge_decision_management_for_session_flow(
state: &SessionState,
merchant_context: &domain::MerchantContext,
_business_profile: &domain::Profile,
payment_attempt: &storage::PaymentAttempt,
payment_intent: &storage::PaymentIntent,
billing_address: Option<hyperswitch_domain_models::address::Address>,
session_connector_data: &api::SessionConnectorDatas,
) -> RouterResult<Option<api::SessionSurchargeDetails>> {
if let Some(surcharge_amount) = payment_attempt.net_amount.get_surcharge_amount() {
Ok(Some(api::SessionSurchargeDetails::PreDetermined(
types::SurchargeDetails {
original_amount: payment_attempt.net_amount.get_order_amount(),
surcharge: Surcharge::Fixed(surcharge_amount),
tax_on_surcharge: None,
surcharge_amount,
tax_on_surcharge_amount: payment_attempt
.net_amount
.get_tax_on_surcharge()
.unwrap_or_default(),
},
)))
} else {
let payment_method_type_list = session_connector_data
.iter()
.map(|session_connector_data| session_connector_data.payment_method_sub_type)
.collect();
#[cfg(feature = "v1")]
let algorithm_ref: api::routing::RoutingAlgorithmRef = merchant_context
.get_merchant_account()
.routing_algorithm
.clone()
.map(|val| val.parse_value("routing algorithm"))
.transpose()
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Could not decode the routing algorithm")?
.unwrap_or_default();
// TODO: Move to business profile surcharge column
#[cfg(feature = "v2")]
let algorithm_ref: api::routing::RoutingAlgorithmRef = todo!();
let surcharge_results =
surcharge_decision_configs::perform_surcharge_decision_management_for_session_flow(
state,
algorithm_ref,
payment_attempt,
payment_intent,
billing_address,
&payment_method_type_list,
)
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("error performing surcharge decision operation")?;
Ok(if surcharge_results.is_empty_result() {
None
} else {
Some(api::SessionSurchargeDetails::Calculated(surcharge_results))
})
}
}
#[cfg(feature = "v1")]
#[allow(clippy::too_many_arguments)]
pub async fn payments_core<F, Res, Req, Op, FData, D>(
state: SessionState,
req_state: ReqState,
merchant_context: domain::MerchantContext,
profile_id: Option<id_type::ProfileId>,
operation: Op,
req: Req,
auth_flow: services::AuthFlow,
call_connector_action: CallConnectorAction,
eligible_connectors: Option<Vec<enums::Connector>>,
header_payload: HeaderPayload,
) -> RouterResponse<Res>
where
F: Send + Clone + Sync,
FData: Send + Sync + Clone + router_types::Capturable,
Op: Operation<F, Req, Data = D> + Send + Sync + Clone,
Req: Debug + Authenticate + Clone,
D: OperationSessionGetters<F> + OperationSessionSetters<F> + Send + Sync + Clone,
Res: transformers::ToResponse<F, D, Op>,
// To create connector flow specific interface data
D: ConstructFlowSpecificData<F, FData, router_types::PaymentsResponseData>,
RouterData<F, FData, router_types::PaymentsResponseData>: Feature<F, FData>,
// To construct connector flow specific api
dyn api::Connector:
services::api::ConnectorIntegration<F, FData, router_types::PaymentsResponseData>,
// To perform router related operation for PaymentResponse
PaymentResponse: Operation<F, FData, Data = D>,
{
let eligible_routable_connectors = eligible_connectors.map(|connectors| {
connectors
.into_iter()
.flat_map(|c| c.foreign_try_into())
.collect()
});
let (payment_data, _req, customer, connector_http_status_code, external_latency) =
payments_operation_core::<_, _, _, _, _>(
&state,
req_state,
&merchant_context,
profile_id,
operation.clone(),
req,
call_connector_action,
auth_flow,
eligible_routable_connectors,
header_payload.clone(),
)
.await?;
Res::generate_response(
payment_data,
customer,
auth_flow,
&state.base_url,
operation,
&state.conf.connector_request_reference_id_config,
connector_http_status_code,
external_latency,
header_payload.x_hs_latency,
)
}
#[cfg(feature = "v1")]
#[allow(clippy::too_many_arguments)]
pub async fn proxy_for_payments_core<F, Res, Req, Op, FData, D>(
state: SessionState,
req_state: ReqState,
merchant_context: domain::MerchantContext,
profile_id: Option<id_type::ProfileId>,
operation: Op,
req: Req,
auth_flow: services::AuthFlow,
call_connector_action: CallConnectorAction,
header_payload: HeaderPayload,
return_raw_connector_response: Option<bool>,
) -> RouterResponse<Res>
where
F: Send + Clone + Sync,
FData: Send + Sync + Clone,
Op: Operation<F, Req, Data = D> + Send + Sync + Clone,
Req: Debug + Authenticate + Clone,
D: OperationSessionGetters<F> + OperationSessionSetters<F> + Send + Sync + Clone,
Res: transformers::ToResponse<F, D, Op>,
// To create connector flow specific interface data
D: ConstructFlowSpecificData<F, FData, router_types::PaymentsResponseData>,
RouterData<F, FData, router_types::PaymentsResponseData>: Feature<F, FData>,
// To construct connector flow specific api
dyn api::Connector:
services::api::ConnectorIntegration<F, FData, router_types::PaymentsResponseData>,
// To perform router related operation for PaymentResponse
PaymentResponse: Operation<F, FData, Data = D>,
{
let (payment_data, _req, customer, connector_http_status_code, external_latency) =
proxy_for_payments_operation_core::<_, _, _, _, _>(
&state,
req_state,
merchant_context,
profile_id,
operation.clone(),
req,
call_connector_action,
auth_flow,
header_payload.clone(),
return_raw_connector_response,
)
.await?;
Res::generate_response(
payment_data,
customer,
auth_flow,
&state.base_url,
operation,
&state.conf.connector_request_reference_id_config,
connector_http_status_code,
external_latency,
header_payload.x_hs_latency,
)
}
#[cfg(feature = "v2")]
#[allow(clippy::too_many_arguments)]
pub async fn proxy_for_payments_core<F, Res, Req, Op, FData, D>(
state: SessionState,
req_state: ReqState,
merchant_context: domain::MerchantContext,
profile: domain::Profile,
operation: Op,
req: Req,
payment_id: id_type::GlobalPaymentId,
call_connector_action: CallConnectorAction,
header_payload: HeaderPayload,
return_raw_connector_response: Option<bool>,
) -> RouterResponse<Res>
where
F: Send + Clone + Sync,
Req: Send + Sync + Authenticate,
FData: Send + Sync + Clone,
Op: Operation<F, Req, Data = D> + ValidateStatusForOperation + Send + Sync + Clone,
Req: Debug,
D: OperationSessionGetters<F>
+ OperationSessionSetters<F>
+ transformers::GenerateResponse<Res>
+ Send
+ Sync
+ Clone,
D: ConstructFlowSpecificData<F, FData, router_types::PaymentsResponseData>,
RouterData<F, FData, router_types::PaymentsResponseData>: Feature<F, FData>,
dyn api::Connector:
services::api::ConnectorIntegration<F, FData, router_types::PaymentsResponseData>,
PaymentResponse: Operation<F, FData, Data = D>,
RouterData<F, FData, router_types::PaymentsResponseData>:
hyperswitch_domain_models::router_data::TrackerPostUpdateObjects<F, FData, D>,
{
operation
.to_validate_request()?
.validate_request(&req, &merchant_context)?;
let get_tracker_response = operation
.to_get_tracker()?
.get_trackers(
&state,
&payment_id,
&req,
&merchant_context,
&profile,
&header_payload,
)
.await?;
let (payment_data, _req, connector_http_status_code, external_latency) =
proxy_for_payments_operation_core::<_, _, _, _, _>(
&state,
req_state,
merchant_context.clone(),
profile.clone(),
operation.clone(),
req,
get_tracker_response,
call_connector_action,
header_payload.clone(),
return_raw_connector_response,
)
.await?;
payment_data.generate_response(
&state,
connector_http_status_code,
external_latency,
header_payload.x_hs_latency,
&merchant_context,
&profile,
None,
)
}
#[cfg(feature = "v2")]
#[allow(clippy::too_many_arguments)]
pub async fn external_vault_proxy_for_payments_core<F, Res, Req, Op, FData, D>(
state: SessionState,
req_state: ReqState,
merchant_context: domain::MerchantContext,
profile: domain::Profile,
operation: Op,
req: Req,
payment_id: id_type::GlobalPaymentId,
call_connector_action: CallConnectorAction,
header_payload: HeaderPayload,
return_raw_connector_response: Option<bool>,
) -> RouterResponse<Res>
where
F: Send + Clone + Sync,
Req: Send + Sync + Authenticate,
FData: Send + Sync + Clone,
Op: Operation<F, Req, Data = D> + ValidateStatusForOperation + Send + Sync + Clone,
Req: Debug,
D: OperationSessionGetters<F>
+ OperationSessionSetters<F>
+ transformers::GenerateResponse<Res>
+ Send
+ Sync
+ Clone,
D: ConstructFlowSpecificData<F, FData, router_types::PaymentsResponseData>,
RouterData<F, FData, router_types::PaymentsResponseData>: Feature<F, FData>,
dyn api::Connector:
services::api::ConnectorIntegration<F, FData, router_types::PaymentsResponseData>,
|
crates/router/src/core/payments.rs#chunk1
|
router
|
chunk
| null | null | null | 8,179
| null | null | null | null | null | null | null |
// Struct: ConnectorAuthentication
// File: crates/test_utils/src/connector_auth.rs
// Module: test_utils
// Implementations: 2
// Traits: Default
pub struct ConnectorAuthentication
|
crates/test_utils/src/connector_auth.rs
|
test_utils
|
struct_definition
|
ConnectorAuthentication
| 2
|
[
"Default"
] | 40
| null | null | null | null | null | null | null |
// Implementation: impl Responder
// File: crates/router/src/routes/payment_link.rs
// Module: router
// Methods: 0 total (0 public)
impl Responder
|
crates/router/src/routes/payment_link.rs
|
router
|
impl_block
| null | null | null | 36
| null |
Responder
| null | 0
| 0
| null | null |
// Implementation: impl FlattenedPaymentMethodsEnabled
// File: crates/router/src/core/payments/payment_methods.rs
// Module: router
// Methods: 1 total (0 public)
impl FlattenedPaymentMethodsEnabled
|
crates/router/src/core/payments/payment_methods.rs
|
router
|
impl_block
| null | null | null | 46
| null |
FlattenedPaymentMethodsEnabled
| null | 1
| 0
| null | null |
// Struct: SdkEventMetricsAccumulator
// File: crates/analytics/src/sdk_events/accumulator.rs
// Module: analytics
// Implementations: 1
pub struct SdkEventMetricsAccumulator
|
crates/analytics/src/sdk_events/accumulator.rs
|
analytics
|
struct_definition
|
SdkEventMetricsAccumulator
| 1
|
[] | 45
| null | null | null | null | null | null | null |
// Struct: MerchantAdvice
// File: crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct MerchantAdvice
|
crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
MerchantAdvice
| 0
|
[] | 47
| null | null | null | null | null | null | null |
// Function: get_action_url
// File: crates/router/src/routes/connector_onboarding.rs
// Module: router
pub fn get_action_url(
state: web::Data<AppState>,
http_req: HttpRequest,
json_payload: web::Json<api_types::ActionUrlRequest>,
) -> HttpResponse
|
crates/router/src/routes/connector_onboarding.rs
|
router
|
function_signature
| null | null | null | 64
|
get_action_url
| null | null | null | null | null | null |
// Function: find_generic_link_by_link_id
// File: crates/diesel_models/src/query/generic_link.rs
// Module: diesel_models
pub fn find_generic_link_by_link_id(
conn: &PgPooledConn,
link_id: &str,
) -> StorageResult<GenericLinkState>
|
crates/diesel_models/src/query/generic_link.rs
|
diesel_models
|
function_signature
| null | null | null | 65
|
find_generic_link_by_link_id
| null | null | null | null | null | null |
// Struct: RefundResponse
// File: crates/hyperswitch_connectors/src/connectors/nexixpay/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct RefundResponse
|
crates/hyperswitch_connectors/src/connectors/nexixpay/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
RefundResponse
| 0
|
[] | 49
| null | null | null | null | null | null | null |
// Function: create_payment_method_api
// File: crates/openapi/src/routes/payment_method.rs
// Module: openapi
pub fn create_payment_method_api()
|
crates/openapi/src/routes/payment_method.rs
|
openapi
|
function_signature
| null | null | null | 33
|
create_payment_method_api
| null | null | null | null | null | null |
// Implementation: impl ConnectorRedirectResponse for for ConnectorEnum
// File: crates/hyperswitch_interfaces/src/connector_integration_interface.rs
// Module: hyperswitch_interfaces
// Methods: 1 total (0 public)
impl ConnectorRedirectResponse for for ConnectorEnum
|
crates/hyperswitch_interfaces/src/connector_integration_interface.rs
|
hyperswitch_interfaces
|
impl_block
| null | null | null | 53
| null |
ConnectorEnum
|
ConnectorRedirectResponse for
| 1
| 0
| null | null |
// Function: totp_update
// File: crates/router/src/routes/user.rs
// Module: router
pub fn totp_update(
state: web::Data<AppState>,
req: HttpRequest,
json_payload: web::Json<user_api::VerifyTotpRequest>,
) -> HttpResponse
|
crates/router/src/routes/user.rs
|
router
|
function_signature
| null | null | null | 61
|
totp_update
| null | null | null | null | null | null |
// Function: handle
// File: crates/common_utils/src/signals.rs
// Module: common_utils
// Documentation: Dummy handler for signals in windows (empty)
pub fn handle(&self) -> Self
|
crates/common_utils/src/signals.rs
|
common_utils
|
function_signature
| null | null | null | 42
|
handle
| null | null | null | null | null | null |
// Function: new
// File: crates/hyperswitch_connectors/src/connectors/elavon.rs
// Module: hyperswitch_connectors
pub fn new() -> &'static Self
|
crates/hyperswitch_connectors/src/connectors/elavon.rs
|
hyperswitch_connectors
|
function_signature
| null | null | null | 39
|
new
| null | null | null | null | null | null |
// Module Structure
// File: crates/router/src/types/api/files.rs
// Module: router
// Public exports:
pub use hyperswitch_domain_models::router_flow_types::files::{Retrieve, Upload};
pub use hyperswitch_interfaces::api::files::{FilePurpose, FileUpload, RetrieveFile, UploadFile};
pub use super::files_v2::{FileUploadV2, RetrieveFileV2, UploadFileV2};
|
crates/router/src/types/api/files.rs
|
router
|
module_structure
| null | null | null | 86
| null | null | null | null | null | 0
| 3
|
// File: crates/common_utils/src/id_type/profile.rs
// Module: common_utils
use std::str::FromStr;
crate::id_type!(
ProfileId,
"A type for profile_id that can be used for business profile ids"
);
crate::impl_id_type_methods!(ProfileId, "profile_id");
// This is to display the `ProfileId` as ProfileId(abcd)
crate::impl_debug_id_type!(ProfileId);
crate::impl_try_from_cow_str_id_type!(ProfileId, "profile_id");
crate::impl_generate_id_id_type!(ProfileId, "pro");
crate::impl_serializable_secret_id_type!(ProfileId);
crate::impl_queryable_id_type!(ProfileId);
crate::impl_to_sql_from_sql_id_type!(ProfileId);
impl crate::events::ApiEventMetric for ProfileId {
fn get_api_event_type(&self) -> Option<crate::events::ApiEventsType> {
Some(crate::events::ApiEventsType::BusinessProfile {
profile_id: self.clone(),
})
}
}
impl FromStr for ProfileId {
type Err = error_stack::Report<crate::errors::ValidationError>;
fn from_str(s: &str) -> Result<Self, Self::Err> {
let cow_string = std::borrow::Cow::Owned(s.to_string());
Self::try_from(cow_string)
}
}
// This is implemented so that we can use profile id directly as attribute in metrics
#[cfg(feature = "metrics")]
impl From<ProfileId> for router_env::opentelemetry::Value {
fn from(val: ProfileId) -> Self {
Self::from(val.0 .0 .0)
}
}
|
crates/common_utils/src/id_type/profile.rs
|
common_utils
|
full_file
| null | null | null | 352
| null | null | null | null | null | null | null |
// Struct: ApplePayTokenizedCard
// File: crates/hyperswitch_connectors/src/connectors/bankofamerica/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct ApplePayTokenizedCard
|
crates/hyperswitch_connectors/src/connectors/bankofamerica/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
ApplePayTokenizedCard
| 0
|
[] | 54
| null | null | null | null | null | null | null |
// Implementation: impl api::PaymentAuthorize for for Moneris
// File: crates/hyperswitch_connectors/src/connectors/moneris.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::PaymentAuthorize for for Moneris
|
crates/hyperswitch_connectors/src/connectors/moneris.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 61
| null |
Moneris
|
api::PaymentAuthorize for
| 0
| 0
| null | null |
// Function: get_tax_on_surcharge
// File: crates/hyperswitch_domain_models/src/payments/payment_attempt.rs
// Module: hyperswitch_domain_models
pub fn get_tax_on_surcharge(&self) -> Option<MinorUnit>
|
crates/hyperswitch_domain_models/src/payments/payment_attempt.rs
|
hyperswitch_domain_models
|
function_signature
| null | null | null | 50
|
get_tax_on_surcharge
| null | null | null | null | null | null |
// Struct: LockerMockUp
// File: crates/diesel_models/src/locker_mock_up.rs
// Module: diesel_models
// Implementations: 0
pub struct LockerMockUp
|
crates/diesel_models/src/locker_mock_up.rs
|
diesel_models
|
struct_definition
|
LockerMockUp
| 0
|
[] | 39
| null | null | null | null | null | null | null |
// Struct: ChargebeeInvoiceData
// File: crates/hyperswitch_connectors/src/connectors/chargebee/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct ChargebeeInvoiceData
|
crates/hyperswitch_connectors/src/connectors/chargebee/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
ChargebeeInvoiceData
| 0
|
[] | 50
| null | null | null | null | null | null | null |
// Struct: PaymentLinkFormData
// File: crates/hyperswitch_domain_models/src/api.rs
// Module: hyperswitch_domain_models
// Implementations: 0
pub struct PaymentLinkFormData
|
crates/hyperswitch_domain_models/src/api.rs
|
hyperswitch_domain_models
|
struct_definition
|
PaymentLinkFormData
| 0
|
[] | 41
| null | null | null | null | null | null | null |
// Implementation: impl api::RefundExecute for for Bitpay
// File: crates/hyperswitch_connectors/src/connectors/bitpay.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::RefundExecute for for Bitpay
|
crates/hyperswitch_connectors/src/connectors/bitpay.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 59
| null |
Bitpay
|
api::RefundExecute for
| 0
| 0
| null | null |
// Function: new
// File: crates/hyperswitch_connectors/src/connectors/cashtocode.rs
// Module: hyperswitch_connectors
pub fn new() -> &'static Self
|
crates/hyperswitch_connectors/src/connectors/cashtocode.rs
|
hyperswitch_connectors
|
function_signature
| null | null | null | 40
|
new
| null | null | null | null | null | null |
// Function: validate
// File: crates/analytics/src/opensearch.rs
// Module: analytics
pub fn validate(&self) -> Result<(), ApplicationError>
|
crates/analytics/src/opensearch.rs
|
analytics
|
function_signature
| null | null | null | 34
|
validate
| null | null | null | null | null | null |
// Struct: CardPaymentInformation
// File: crates/hyperswitch_connectors/src/connectors/barclaycard/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct CardPaymentInformation
|
crates/hyperswitch_connectors/src/connectors/barclaycard/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
CardPaymentInformation
| 0
|
[] | 49
| null | null | null | null | null | null | null |
// Implementation: impl api::Refund for for Payload
// File: crates/hyperswitch_connectors/src/connectors/payload.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::Refund for for Payload
|
crates/hyperswitch_connectors/src/connectors/payload.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 55
| null |
Payload
|
api::Refund for
| 0
| 0
| null | null |
// Implementation: impl api::ConnectorValidation for for Wise
// File: crates/hyperswitch_connectors/src/connectors/wise.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::ConnectorValidation for for Wise
|
crates/hyperswitch_connectors/src/connectors/wise.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 55
| null |
Wise
|
api::ConnectorValidation for
| 0
| 0
| null | null |
// Function: delete_surcharge_decision_config
// File: crates/router/src/core/surcharge_decision_config.rs
// Module: router
pub fn delete_surcharge_decision_config(
_state: SessionState,
_merchant_context: domain::MerchantContext,
) -> RouterResponse<()>
|
crates/router/src/core/surcharge_decision_config.rs
|
router
|
function_signature
| null | null | null | 58
|
delete_surcharge_decision_config
| null | null | null | null | null | null |
// Function: evaluate_routing_rule
// File: crates/openapi/src/routes/routing.rs
// Module: openapi
pub fn evaluate_routing_rule()
|
crates/openapi/src/routes/routing.rs
|
openapi
|
function_signature
| null | null | null | 31
|
evaluate_routing_rule
| null | null | null | null | null | null |
// Struct: UserField
// File: crates/hyperswitch_connectors/src/connectors/authorizedotnet/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct UserField
|
crates/hyperswitch_connectors/src/connectors/authorizedotnet/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
UserField
| 0
|
[] | 47
| null | null | null | null | null | null | null |
// Implementation: impl api::RefundSync for for Nexinets
// File: crates/hyperswitch_connectors/src/connectors/nexinets.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::RefundSync for for Nexinets
|
crates/hyperswitch_connectors/src/connectors/nexinets.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 63
| null |
Nexinets
|
api::RefundSync for
| 0
| 0
| null | null |
ApiError::new("IR", 4, format!("Missing required param: {field_name}"), None),
),
Self::InvalidDataFormat {
field_name,
expected_format,
} => AER::Unprocessable(ApiError::new(
"IR",
5,
format!(
"{field_name} contains invalid data. Expected format is {expected_format}"
), None
)),
Self::InvalidRequestData { message } => {
AER::Unprocessable(ApiError::new("IR", 6, message.to_string(), None))
}
Self::InvalidDataValue { field_name } => AER::BadRequest(ApiError::new(
"IR",
7,
format!("Invalid value provided: {field_name}"), None
)),
Self::ClientSecretNotGiven => AER::BadRequest(ApiError::new(
"IR",
8,
"client_secret was not provided", None
)),
Self::ClientSecretExpired => AER::BadRequest(ApiError::new(
"IR",
8,
"The provided client_secret has expired", None
)),
Self::ClientSecretInvalid => {
AER::BadRequest(ApiError::new("IR", 9, "The client_secret provided does not match the client_secret associated with the Payment", None))
}
Self::MandateActive => {
AER::BadRequest(ApiError::new("IR", 10, "Customer has active mandate/subsciption", None))
}
Self::CustomerRedacted => {
AER::BadRequest(ApiError::new("IR", 11, "Customer has already been redacted", None))
}
Self::MaximumRefundCount => AER::BadRequest(ApiError::new("IR", 12, "Reached maximum refund attempts", None)),
Self::RefundAmountExceedsPaymentAmount => {
AER::BadRequest(ApiError::new("IR", 13, "The refund amount exceeds the amount captured", None))
}
Self::PaymentUnexpectedState {
current_flow,
field_name,
current_value,
states,
} => AER::BadRequest(ApiError::new("IR", 14, format!("This Payment could not be {current_flow} because it has a {field_name} of {current_value}. The expected state is {states}"), None)),
Self::InvalidEphemeralKey => AER::Unauthorized(ApiError::new("IR", 15, "Invalid Ephemeral Key for the customer", None)),
Self::PreconditionFailed { message } => {
AER::BadRequest(ApiError::new("IR", 16, message.to_string(), None))
}
Self::InvalidJwtToken => AER::Unauthorized(ApiError::new("IR", 17, "Access forbidden, invalid JWT token was used", None)),
Self::GenericUnauthorized { message } => {
AER::Unauthorized(ApiError::new("IR", 18, message.to_string(), None))
},
Self::NotSupported { message } => {
AER::BadRequest(ApiError::new("IR", 19, "Payment method type not supported", Some(Extra {reason: Some(message.to_owned()), ..Default::default()})))
},
Self::FlowNotSupported { flow, connector } => {
AER::BadRequest(ApiError::new("IR", 20, format!("{flow} flow not supported"), Some(Extra {connector: Some(connector.to_owned()), ..Default::default()}))) //FIXME: error message
}
Self::MissingRequiredFields { field_names } => AER::BadRequest(
ApiError::new("IR", 21, "Missing required params".to_string(), Some(Extra {data: Some(serde_json::json!(field_names)), ..Default::default() })),
),
Self::AccessForbidden {resource} => {
AER::ForbiddenCommonResource(ApiError::new("IR", 22, format!("Access forbidden. Not authorized to access this resource {resource}"), None))
},
Self::FileProviderNotSupported { message } => {
AER::BadRequest(ApiError::new("IR", 23, message.to_string(), None))
},
Self::InvalidWalletToken { wallet_name} => AER::Unprocessable(ApiError::new(
"IR",
24,
format!("Invalid {wallet_name} wallet token"), None
)),
Self::PaymentMethodDeleteFailed => {
AER::BadRequest(ApiError::new("IR", 25, "Cannot delete the default payment method", None))
}
Self::InvalidCookie => {
AER::BadRequest(ApiError::new("IR", 26, "Invalid Cookie", None))
}
Self::ExtendedCardInfoNotFound => {
AER::NotFound(ApiError::new("IR", 27, "Extended card info does not exist", None))
}
Self::CurrencyNotSupported { message } => {
AER::BadRequest(ApiError::new("IR", 28, message, None))
}
Self::UnprocessableEntity {message} => AER::Unprocessable(ApiError::new("IR", 29, message.to_string(), None)),
Self::InvalidConnectorConfiguration {config} => {
AER::BadRequest(ApiError::new("IR", 30, format!("Merchant connector account is configured with invalid {config}"), None))
}
Self::InvalidCardIin => AER::BadRequest(ApiError::new("IR", 31, "The provided card IIN does not exist", None)),
Self::InvalidCardIinLength => AER::BadRequest(ApiError::new("IR", 32, "The provided card IIN length is invalid, please provide an IIN with 6 digits", None)),
Self::MissingFile => {
AER::BadRequest(ApiError::new("IR", 33, "File not found in the request", None))
}
Self::MissingDisputeId => {
AER::BadRequest(ApiError::new("IR", 34, "Dispute id not found in the request", None))
}
Self::MissingFilePurpose => {
AER::BadRequest(ApiError::new("IR", 35, "File purpose not found in the request or is invalid", None))
}
Self::MissingFileContentType => {
AER::BadRequest(ApiError::new("IR", 36, "File content type not found", None))
}
Self::GenericNotFoundError { message } => {
AER::NotFound(ApiError::new("IR", 37, message, None))
},
Self::GenericDuplicateError { message } => {
AER::BadRequest(ApiError::new("IR", 38, message, None))
}
Self::IncorrectPaymentMethodConfiguration => {
AER::BadRequest(ApiError::new("IR", 39, "No eligible connector was found for the current payment method configuration", None))
}
Self::LinkConfigurationError { message } => {
AER::BadRequest(ApiError::new("IR", 40, message, None))
},
Self::PayoutFailed { data } => {
AER::BadRequest(ApiError::new("IR", 41, "Payout failed while processing with connector.", Some(Extra { data: data.clone(), ..Default::default()})))
},
Self::CookieNotFound => {
AER::Unauthorized(ApiError::new("IR", 42, "Cookies are not found in the request", None))
},
Self::ExternalVaultFailed => {
AER::BadRequest(ApiError::new("IR", 45, "External Vault failed while processing with connector.", None))
},
Self::MandatePaymentDataMismatch { fields} => {
AER::BadRequest(ApiError::new("IR", 46, format!("Field {fields} doesn't match with the ones used during mandate creation"), Some(Extra {fields: Some(fields.to_owned()), ..Default::default()}))) //FIXME: error message
}
Self::MaxFieldLengthViolated { connector, field_name, max_length, received_length} => {
AER::BadRequest(ApiError::new("IR", 47, format!("Connector '{connector}' rejected field '{field_name}': length {received_length} exceeds maximum of {max_length}"), Some(Extra {connector: Some(connector.to_string()), ..Default::default()})))
}
Self::WebhookAuthenticationFailed => {
AER::Unauthorized(ApiError::new("WE", 1, "Webhook authentication failed", None))
}
Self::WebhookBadRequest => {
AER::BadRequest(ApiError::new("WE", 2, "Bad request body received", None))
}
Self::WebhookProcessingFailure => {
AER::InternalServerError(ApiError::new("WE", 3, "There was an issue processing the webhook", None))
},
Self::WebhookResourceNotFound => {
AER::NotFound(ApiError::new("WE", 4, "Webhook resource was not found", None))
}
Self::WebhookUnprocessableEntity => {
AER::Unprocessable(ApiError::new("WE", 5, "There was an issue processing the webhook body", None))
},
Self::WebhookInvalidMerchantSecret => {
AER::BadRequest(ApiError::new("WE", 6, "Merchant Secret set for webhook source verification is invalid", None))
}
Self::IntegrityCheckFailed {
reason,
field_names,
connector_transaction_id
} => AER::InternalServerError(ApiError::new(
"IE",
0,
format!("{reason} as data mismatched for {field_names}"),
Some(Extra {
connector_transaction_id: connector_transaction_id.to_owned(),
..Default::default()
})
)),
Self::PlatformAccountAuthNotSupported => {
AER::BadRequest(ApiError::new("IR", 43, "API does not support platform operation", None))
}
Self::InvalidPlatformOperation => {
AER::Unauthorized(ApiError::new("IR", 44, "Invalid platform account operation", None))
}
Self::TokenizationRecordNotFound{ id } => {
AER::NotFound(ApiError::new("HE", 2, format!("Tokenization record not found for the given token_id '{id}' "), None))
}
Self::SubscriptionError { operation } => {
AER::BadRequest(ApiError::new("CE", 9, format!("Subscription operation: {operation} failed with connector"), None))
}
}
}
}
impl actix_web::ResponseError for ApiErrorResponse {
fn status_code(&self) -> StatusCode {
ErrorSwitch::<api_models::errors::types::ApiErrorResponse>::switch(self).status_code()
}
fn error_response(&self) -> actix_web::HttpResponse {
ErrorSwitch::<api_models::errors::types::ApiErrorResponse>::switch(self).error_response()
}
}
impl From<ApiErrorResponse> for router_data::ErrorResponse {
fn from(error: ApiErrorResponse) -> Self {
Self {
code: error.error_code(),
message: error.error_message(),
reason: None,
status_code: match error {
ApiErrorResponse::ExternalConnectorError { status_code, .. } => status_code,
_ => 500,
},
attempt_status: None,
connector_transaction_id: None,
network_advice_code: None,
network_decline_code: None,
network_error_message: None,
connector_metadata: None,
}
}
}
|
crates/hyperswitch_domain_models/src/errors/api_error_response.rs#chunk1
|
hyperswitch_domain_models
|
chunk
| null | null | null | 2,491
| null | null | null | null | null | null | null |
// File: crates/hyperswitch_interfaces/src/consts.rs
// Module: hyperswitch_interfaces
//! connector integration related const declarations
/// No error message string const
pub const NO_ERROR_MESSAGE: &str = "No error message";
/// No error code string const
pub const NO_ERROR_CODE: &str = "No error code";
/// Accepted format for request
pub const ACCEPT_HEADER: &str = "text/html,application/json";
/// User agent for request send from backend server
pub const USER_AGENT: &str = "Hyperswitch-Backend-Server";
|
crates/hyperswitch_interfaces/src/consts.rs
|
hyperswitch_interfaces
|
full_file
| null | null | null | 118
| null | null | null | null | null | null | null |
// Function: is_overcapture_enabled
// File: crates/hyperswitch_domain_models/src/router_data.rs
// Module: hyperswitch_domain_models
pub fn is_overcapture_enabled(&self) -> Option<primitive_wrappers::OvercaptureEnabledBool>
|
crates/hyperswitch_domain_models/src/router_data.rs
|
hyperswitch_domain_models
|
function_signature
| null | null | null | 52
|
is_overcapture_enabled
| null | null | null | null | null | null |
// Implementation: impl PaymentAttempt
// File: crates/diesel_models/src/query/payment_attempt.rs
// Module: diesel_models
// Methods: 18 total (0 public)
impl PaymentAttempt
|
crates/diesel_models/src/query/payment_attempt.rs
|
diesel_models
|
impl_block
| null | null | null | 40
| null |
PaymentAttempt
| null | 18
| 0
| null | null |
// Struct: EventListRequestInternal
// File: crates/api_models/src/webhook_events.rs
// Module: api_models
// Implementations: 1
// Traits: common_utils::events::ApiEventMetric
pub struct EventListRequestInternal
|
crates/api_models/src/webhook_events.rs
|
api_models
|
struct_definition
|
EventListRequestInternal
| 1
|
[
"common_utils::events::ApiEventMetric"
] | 51
| null | null | null | null | null | null | null |
// Implementation: impl RefundSync for for DummyConnector
// File: crates/hyperswitch_connectors/src/connectors/dummyconnector.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl RefundSync for for DummyConnector
|
crates/hyperswitch_connectors/src/connectors/dummyconnector.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 56
| null |
DummyConnector
|
RefundSync for
| 0
| 0
| null | null |
// Function: extract_merchant_details_url
// File: crates/router/src/types/api/connector_onboarding/paypal.rs
// Module: router
pub fn extract_merchant_details_url(self, paypal_base_url: &str) -> RouterResult<String>
|
crates/router/src/types/api/connector_onboarding/paypal.rs
|
router
|
function_signature
| null | null | null | 51
|
extract_merchant_details_url
| null | null | null | null | null | null |
// Function: validate
// File: crates/router_derive/src/macros/schema.rs
// Module: router_derive
pub fn validate(&self) -> Result<(), String>
|
crates/router_derive/src/macros/schema.rs
|
router_derive
|
function_signature
| null | null | null | 36
|
validate
| 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 |
// Module Structure
// File: crates/hyperswitch_connectors/src/connectors/dlocal.rs
// Module: hyperswitch_connectors
// Public submodules:
pub mod transformers;
|
crates/hyperswitch_connectors/src/connectors/dlocal.rs
|
hyperswitch_connectors
|
module_structure
| null | null | null | 38
| null | null | null | null | null | 1
| 0
|
// Implementation: impl ConnectorCommon for for Cybersource
// File: crates/hyperswitch_connectors/src/connectors/cybersource.rs
// Module: hyperswitch_connectors
// Methods: 5 total (0 public)
impl ConnectorCommon for for Cybersource
|
crates/hyperswitch_connectors/src/connectors/cybersource.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 57
| null |
Cybersource
|
ConnectorCommon for
| 5
| 0
| null | null |
// Implementation: impl api::PaymentVoid for for Inespay
// File: crates/hyperswitch_connectors/src/connectors/inespay.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::PaymentVoid for for Inespay
|
crates/hyperswitch_connectors/src/connectors/inespay.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 60
| null |
Inespay
|
api::PaymentVoid for
| 0
| 0
| null | null |
// Function: find_by_merchant_id_subscription_id
// File: crates/diesel_models/src/query/subscription.rs
// Module: diesel_models
pub fn find_by_merchant_id_subscription_id(
conn: &PgPooledConn,
merchant_id: &common_utils::id_type::MerchantId,
id: String,
) -> StorageResult<Self>
|
crates/diesel_models/src/query/subscription.rs
|
diesel_models
|
function_signature
| null | null | null | 75
|
find_by_merchant_id_subscription_id
| null | null | null | null | null | null |
// Implementation: impl api::MandateSetup for for Paysafe
// File: crates/hyperswitch_connectors/src/connectors/paysafe.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::MandateSetup for for Paysafe
|
crates/hyperswitch_connectors/src/connectors/paysafe.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 62
| null |
Paysafe
|
api::MandateSetup for
| 0
| 0
| null | null |
// Implementation: impl api::PayoutCreate for for Stripe
// File: crates/hyperswitch_connectors/src/connectors/stripe.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::PayoutCreate for for Stripe
|
crates/hyperswitch_connectors/src/connectors/stripe.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 57
| null |
Stripe
|
api::PayoutCreate for
| 0
| 0
| null | null |
// Struct: CoinbaseRefundRequest
// File: crates/hyperswitch_connectors/src/connectors/coinbase/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct CoinbaseRefundRequest
|
crates/hyperswitch_connectors/src/connectors/coinbase/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
CoinbaseRefundRequest
| 0
|
[] | 50
| null | null | null | null | null | null | null |
// Struct: ConnectorParamsWithMoreUrls
// File: crates/hyperswitch_domain_models/src/connector_endpoints.rs
// Module: hyperswitch_domain_models
// Implementations: 0
pub struct ConnectorParamsWithMoreUrls
|
crates/hyperswitch_domain_models/src/connector_endpoints.rs
|
hyperswitch_domain_models
|
struct_definition
|
ConnectorParamsWithMoreUrls
| 0
|
[] | 48
| null | null | null | null | null | null | null |
// Function: get_payment_method_create_request
// File: crates/router/src/core/payment_methods.rs
// Module: router
pub fn get_payment_method_create_request(
payment_method_data: Option<&domain::PaymentMethodData>,
payment_method: Option<storage_enums::PaymentMethod>,
payment_method_type: Option<storage_enums::PaymentMethodType>,
customer_id: &Option<id_type::CustomerId>,
billing_name: Option<Secret<String>>,
payment_method_billing_address: Option<&hyperswitch_domain_models::address::Address>,
) -> RouterResult<payment_methods::PaymentMethodCreate>
|
crates/router/src/core/payment_methods.rs
|
router
|
function_signature
| null | null | null | 125
|
get_payment_method_create_request
| null | null | null | null | null | null |
// Implementation: impl ConnectorValidation for for Trustpay
// File: crates/hyperswitch_connectors/src/connectors/trustpay.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl ConnectorValidation for for Trustpay
|
crates/hyperswitch_connectors/src/connectors/trustpay.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 54
| null |
Trustpay
|
ConnectorValidation for
| 0
| 0
| null | null |
// Struct: BamboraCard
// File: crates/hyperswitch_connectors/src/connectors/bambora/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct BamboraCard
|
crates/hyperswitch_connectors/src/connectors/bambora/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
BamboraCard
| 0
|
[] | 50
| null | null | null | null | null | null | null |
// Struct: SyncTransactionResponse
// File: crates/hyperswitch_connectors/src/connectors/authorizedotnet/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct SyncTransactionResponse
|
crates/hyperswitch_connectors/src/connectors/authorizedotnet/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
SyncTransactionResponse
| 0
|
[] | 49
| null | null | null | null | null | null | null |
// Struct: Headers
// File: crates/api_models/src/proxy.rs
// Module: api_models
// Implementations: 1
pub struct Headers
|
crates/api_models/src/proxy.rs
|
api_models
|
struct_definition
|
Headers
| 1
|
[] | 32
| null | null | null | null | null | null | null |
// File: crates/router/src/db/callback_mapper.rs
// Module: router
use error_stack::report;
use hyperswitch_domain_models::callback_mapper as domain;
use router_env::{instrument, tracing};
use storage_impl::{DataModelExt, MockDb};
use super::Store;
use crate::{
connection,
core::errors::{self, CustomResult},
types::storage,
};
#[async_trait::async_trait]
pub trait CallbackMapperInterface {
async fn insert_call_back_mapper(
&self,
call_back_mapper: domain::CallbackMapper,
) -> CustomResult<domain::CallbackMapper, errors::StorageError>;
async fn find_call_back_mapper_by_id(
&self,
id: &str,
) -> CustomResult<domain::CallbackMapper, errors::StorageError>;
}
#[async_trait::async_trait]
impl CallbackMapperInterface for Store {
#[instrument(skip_all)]
async fn insert_call_back_mapper(
&self,
call_back_mapper: domain::CallbackMapper,
) -> CustomResult<domain::CallbackMapper, errors::StorageError> {
let conn = connection::pg_connection_write(self).await?;
call_back_mapper
.to_storage_model()
.insert(&conn)
.await
.map_err(|error| report!(errors::StorageError::from(error)))
.map(domain::CallbackMapper::from_storage_model)
}
#[instrument(skip_all)]
async fn find_call_back_mapper_by_id(
&self,
id: &str,
) -> CustomResult<domain::CallbackMapper, errors::StorageError> {
let conn = connection::pg_connection_read(self).await?;
storage::CallbackMapper::find_by_id(&conn, id)
.await
.map_err(|error| report!(errors::StorageError::from(error)))
.map(domain::CallbackMapper::from_storage_model)
}
}
#[async_trait::async_trait]
impl CallbackMapperInterface for MockDb {
#[instrument(skip_all)]
async fn insert_call_back_mapper(
&self,
_call_back_mapper: domain::CallbackMapper,
) -> CustomResult<domain::CallbackMapper, errors::StorageError> {
Err(errors::StorageError::MockDbError)?
}
#[instrument(skip_all)]
async fn find_call_back_mapper_by_id(
&self,
_id: &str,
) -> CustomResult<domain::CallbackMapper, errors::StorageError> {
Err(errors::StorageError::MockDbError)?
}
}
|
crates/router/src/db/callback_mapper.rs
|
router
|
full_file
| null | null | null | 529
| null | null | null | null | null | null | null |
// Implementation: impl api::Refund for for Coinbase
// File: crates/hyperswitch_connectors/src/connectors/coinbase.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::Refund for for Coinbase
|
crates/hyperswitch_connectors/src/connectors/coinbase.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 56
| null |
Coinbase
|
api::Refund for
| 0
| 0
| null | null |
// Struct: CardholderAccount
// File: crates/hyperswitch_connectors/src/connectors/netcetera/netcetera_types.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct CardholderAccount
|
crates/hyperswitch_connectors/src/connectors/netcetera/netcetera_types.rs
|
hyperswitch_connectors
|
struct_definition
|
CardholderAccount
| 0
|
[] | 51
| null | null | null | null | null | null | null |
// Function: execute_card_tokenization
// File: crates/router/src/core/payment_methods/cards.rs
// Module: router
pub fn execute_card_tokenization(
executor: tokenize::CardNetworkTokenizeExecutor<'_, domain::TokenizeCardRequest>,
builder: tokenize::NetworkTokenizationBuilder<'_, tokenize::TokenizeWithCard>,
req: &domain::TokenizeCardRequest,
) -> errors::RouterResult<api::CardNetworkTokenizeResponse>
|
crates/router/src/core/payment_methods/cards.rs
|
router
|
function_signature
| null | null | null | 95
|
execute_card_tokenization
| null | null | null | null | null | null |
// Struct: ApiEventFilters
// File: crates/api_models/src/analytics/api_event.rs
// Module: api_models
// Implementations: 0
pub struct ApiEventFilters
|
crates/api_models/src/analytics/api_event.rs
|
api_models
|
struct_definition
|
ApiEventFilters
| 0
|
[] | 38
| null | null | null | null | null | null | null |
// Function: delete_user_role
// File: crates/router/src/routes/user_role.rs
// Module: router
pub fn delete_user_role(
state: web::Data<AppState>,
req: HttpRequest,
payload: web::Json<user_role_api::DeleteUserRoleRequest>,
) -> HttpResponse
|
crates/router/src/routes/user_role.rs
|
router
|
function_signature
| null | null | null | 61
|
delete_user_role
| 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 |
// Struct: CheckoutLineItem
// File: crates/hyperswitch_connectors/src/connectors/checkout/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct CheckoutLineItem
|
crates/hyperswitch_connectors/src/connectors/checkout/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
CheckoutLineItem
| 0
|
[] | 47
| null | null | null | null | null | null | null |
// Implementation: impl ConnectorSpecifications for for Worldline
// File: crates/hyperswitch_connectors/src/connectors/worldline.rs
// Module: hyperswitch_connectors
// Methods: 3 total (0 public)
impl ConnectorSpecifications for for Worldline
|
crates/hyperswitch_connectors/src/connectors/worldline.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 53
| null |
Worldline
|
ConnectorSpecifications for
| 3
| 0
| null | null |
// Struct: Powertranz
// File: crates/hyperswitch_connectors/src/connectors/powertranz.rs
// Module: hyperswitch_connectors
// Implementations: 17
// Traits: api::Payment, api::PaymentSession, api::ConnectorAccessToken, api::MandateSetup, api::PaymentAuthorize, api::PaymentsCompleteAuthorize, api::PaymentSync, api::PaymentCapture, api::PaymentVoid, api::Refund, api::RefundExecute, api::RefundSync, api::PaymentToken, ConnectorCommon, ConnectorValidation, webhooks::IncomingWebhook, ConnectorSpecifications
pub struct Powertranz
|
crates/hyperswitch_connectors/src/connectors/powertranz.rs
|
hyperswitch_connectors
|
struct_definition
|
Powertranz
| 17
|
[
"api::Payment",
"api::PaymentSession",
"api::ConnectorAccessToken",
"api::MandateSetup",
"api::PaymentAuthorize",
"api::PaymentsCompleteAuthorize",
"api::PaymentSync",
"api::PaymentCapture",
"api::PaymentVoid",
"api::Refund",
"api::RefundExecute",
"api::RefundSync",
"api::PaymentToken",
"ConnectorCommon",
"ConnectorValidation",
"webhooks::IncomingWebhook",
"ConnectorSpecifications"
] | 134
| null | null | null | null | null | null | null |
// Struct: FacilitapayCredentials
// File: crates/hyperswitch_connectors/src/connectors/facilitapay/requests.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct FacilitapayCredentials
|
crates/hyperswitch_connectors/src/connectors/facilitapay/requests.rs
|
hyperswitch_connectors
|
struct_definition
|
FacilitapayCredentials
| 0
|
[] | 53
| null | null | null | null | null | null | null |
// Function: files_create_core
// File: crates/router/src/core/files.rs
// Module: router
pub fn files_create_core(
state: SessionState,
merchant_context: domain::MerchantContext,
create_file_request: api::CreateFileRequest,
) -> RouterResponse<files::CreateFileResponse>
|
crates/router/src/core/files.rs
|
router
|
function_signature
| null | null | null | 65
|
files_create_core
| null | null | null | null | null | null |
// Function: new
// File: crates/api_models/src/analytics/auth_events.rs
// Module: api_models
pub fn new(
authentication_status: Option<AuthenticationStatus>,
trans_status: Option<TransactionStatus>,
authentication_type: Option<DecoupledAuthenticationType>,
error_message: Option<String>,
authentication_connector: Option<AuthenticationConnectors>,
message_version: Option<String>,
acs_reference_number: Option<String>,
mcc: Option<String>,
currency: Option<Currency>,
merchant_country: Option<String>,
billing_country: Option<String>,
shipping_country: Option<String>,
issuer_country: Option<String>,
earliest_supported_version: Option<String>,
latest_supported_version: Option<String>,
whitelist_decision: Option<bool>,
device_manufacturer: Option<String>,
device_type: Option<String>,
device_brand: Option<String>,
device_os: Option<String>,
device_display: Option<String>,
browser_name: Option<String>,
browser_version: Option<String>,
issuer_id: Option<String>,
scheme_name: Option<String>,
exemption_requested: Option<bool>,
exemption_accepted: Option<bool>,
normalized_time_range: TimeRange,
) -> Self
|
crates/api_models/src/analytics/auth_events.rs
|
api_models
|
function_signature
| null | null | null | 244
|
new
| null | null | null | null | null | null |
// Function: delete_dispute_evidence
// File: crates/router/src/routes/disputes.rs
// Module: router
pub fn delete_dispute_evidence(
state: web::Data<AppState>,
req: HttpRequest,
json_payload: web::Json<dispute_models::DeleteEvidenceRequest>,
) -> HttpResponse
|
crates/router/src/routes/disputes.rs
|
router
|
function_signature
| null | null | null | 67
|
delete_dispute_evidence
| null | null | null | null | null | null |
// Struct: HashedApiKey
// File: crates/diesel_models/src/api_keys.rs
// Module: diesel_models
// Implementations: 1
pub struct HashedApiKey
|
crates/diesel_models/src/api_keys.rs
|
diesel_models
|
struct_definition
|
HashedApiKey
| 1
|
[] | 37
| null | null | null | null | null | null | null |
// File: crates/router_env/src/lib.rs
// Module: router_env
#![warn(missing_debug_implementations)]
//! Environment of payment router: logger, basic config, its environment awareness.
#![doc = include_str!(concat!(env!("CARGO_MANIFEST_DIR" ), "/", "README.md"))]
/// Utilities to identify members of the current cargo workspace.
pub mod cargo_workspace;
pub mod env;
pub mod logger;
pub mod metrics;
/// `cargo` build instructions generation for obtaining information about the application
/// environment.
#[cfg(feature = "vergen")]
pub mod vergen;
// pub use literally;
#[doc(inline)]
pub use logger::*;
pub use opentelemetry;
pub use tracing;
#[cfg(feature = "actix_web")]
pub use tracing_actix_web;
pub use tracing_appender;
#[doc(inline)]
pub use self::env::*;
|
crates/router_env/src/lib.rs
|
router_env
|
full_file
| null | null | null | 179
| null | null | null | null | null | null | null |
// Function: generic_list_roles_by_entity_type
// File: crates/diesel_models/src/query/role.rs
// Module: diesel_models
pub fn generic_list_roles_by_entity_type(
conn: &PgPooledConn,
payload: ListRolesByEntityPayload,
is_lineage_data_required: bool,
tenant_id: id_type::TenantId,
org_id: id_type::OrganizationId,
) -> StorageResult<Vec<Self>>
|
crates/diesel_models/src/query/role.rs
|
diesel_models
|
function_signature
| null | null | null | 93
|
generic_list_roles_by_entity_type
| null | null | null | null | null | null |
// Struct: ActivePayments
// File: crates/api_models/src/analytics/active_payments.rs
// Module: api_models
// Implementations: 0
pub struct ActivePayments
|
crates/api_models/src/analytics/active_payments.rs
|
api_models
|
struct_definition
|
ActivePayments
| 0
|
[] | 37
| null | null | null | null | null | null | null |
// Struct: NexiCardDetails
// File: crates/hyperswitch_connectors/src/connectors/nexinets/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct NexiCardDetails
|
crates/hyperswitch_connectors/src/connectors/nexinets/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
NexiCardDetails
| 0
|
[] | 51
| null | null | null | null | null | null | null |
// Implementation: impl FetchDisputes for for Worldpayvantiv
// File: crates/hyperswitch_connectors/src/connectors/worldpayvantiv.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl FetchDisputes for for Worldpayvantiv
|
crates/hyperswitch_connectors/src/connectors/worldpayvantiv.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 63
| null |
Worldpayvantiv
|
FetchDisputes for
| 0
| 0
| null | null |
// Implementation: impl api::PaymentCapture for for Blackhawknetwork
// File: crates/hyperswitch_connectors/src/connectors/blackhawknetwork.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::PaymentCapture for for Blackhawknetwork
|
crates/hyperswitch_connectors/src/connectors/blackhawknetwork.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 60
| null |
Blackhawknetwork
|
api::PaymentCapture for
| 0
| 0
| null | null |
// File: crates/hyperswitch_connectors/src/connectors/netcetera/netcetera_types.rs
// Module: hyperswitch_connectors
// Public functions: 4
// Public structs: 17
use std::collections::HashMap;
use common_utils::{pii::Email, types::SemanticVersion};
use hyperswitch_domain_models::router_request_types::{
authentication::MessageCategory, BrowserInformation,
};
use hyperswitch_interfaces::errors::ConnectorError;
use masking::ExposeInterface;
use serde::{Deserialize, Serialize};
use unidecode::unidecode;
use crate::utils::{AddressDetailsData as _, PhoneDetailsData as _};
#[derive(Debug, Deserialize, Serialize, Clone)]
#[serde(untagged)]
pub enum SingleOrListElement<T> {
Single(T),
List(Vec<T>),
}
impl<T> SingleOrListElement<T> {
fn get_version_checked(message_version: SemanticVersion, value: T) -> Self {
if message_version.get_major() >= 2 && message_version.get_minor() >= 3 {
Self::List(vec![value])
} else {
Self::Single(value)
}
}
}
impl<T> SingleOrListElement<T> {
pub fn new_single(value: T) -> Self {
Self::Single(value)
}
pub fn new_list(value: Vec<T>) -> Self {
Self::List(value)
}
}
#[derive(Debug, Deserialize, Serialize, Clone)]
pub enum NetceteraDeviceChannel {
#[serde(rename = "01")]
AppBased,
#[serde(rename = "02")]
Browser,
#[serde(rename = "03")]
ThreeDsRequestorInitiated,
}
impl From<api_models::payments::DeviceChannel> for NetceteraDeviceChannel {
fn from(value: api_models::payments::DeviceChannel) -> Self {
match value {
api_models::payments::DeviceChannel::App => Self::AppBased,
api_models::payments::DeviceChannel::Browser => Self::Browser,
}
}
}
#[derive(Debug, Deserialize, Serialize, Clone)]
pub enum NetceteraMessageCategory {
#[serde(rename = "01")]
PaymentAuthentication,
#[serde(rename = "02")]
NonPaymentAuthentication,
}
impl From<MessageCategory> for NetceteraMessageCategory {
fn from(value: MessageCategory) -> Self {
match value {
MessageCategory::NonPayment => Self::NonPaymentAuthentication,
MessageCategory::Payment => Self::PaymentAuthentication,
}
}
}
#[derive(Debug, Deserialize, Serialize, Clone)]
pub enum ThreeDSMethodCompletionIndicator {
/// Successfully completed
Y,
/// Did not successfully complete
N,
/// Unavailable - 3DS Method URL was not present in the PRes message data
U,
}
impl From<api_models::payments::ThreeDsCompletionIndicator> for ThreeDSMethodCompletionIndicator {
fn from(value: api_models::payments::ThreeDsCompletionIndicator) -> Self {
match value {
api_models::payments::ThreeDsCompletionIndicator::Success => Self::Y,
api_models::payments::ThreeDsCompletionIndicator::Failure => Self::N,
api_models::payments::ThreeDsCompletionIndicator::NotAvailable => Self::U,
}
}
}
#[derive(Serialize, Deserialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
pub struct ThreeDSRequestor {
#[serde(rename = "threeDSRequestorAuthenticationInd")]
pub three_ds_requestor_authentication_ind: ThreeDSRequestorAuthenticationIndicator,
/// Format of this field was changed with EMV 3DS 2.3.1 version:
/// In versions prior to 2.3.1, this field is a single object.
/// Starting from EMVCo version 2.3.1, this field is now an array of objects. Accepted value length is 1-3 elements.
///
/// This field is optional, but recommended to include.
#[serde(rename = "threeDSRequestorAuthenticationInfo")]
pub three_ds_requestor_authentication_info:
Option<SingleOrListElement<ThreeDSRequestorAuthenticationInformation>>,
#[serde(rename = "threeDSRequestorChallengeInd")]
pub three_ds_requestor_challenge_ind:
Option<SingleOrListElement<ThreeDSRequestorChallengeIndicator>>,
#[serde(rename = "threeDSRequestorPriorAuthenticationInfo")]
pub three_ds_requestor_prior_authentication_info:
Option<SingleOrListElement<ThreeDSRequestorPriorTransactionAuthenticationInformation>>,
#[serde(rename = "threeDSRequestorDecReqInd")]
pub three_ds_requestor_dec_req_ind: Option<ThreeDSRequestorDecoupledRequestIndicator>,
/// Indicates the maximum amount of time that the 3DS Requestor will wait for an ACS to provide the results
/// of a Decoupled Authentication transaction (in minutes). Valid values are between 1 and 10080.
///
/// The field is optional and if value is not present, the expected action is for the ACS to interpret it as
/// 10080 minutes (7 days).
/// Available for supporting EMV 3DS 2.2.0 and later versions.
///
/// Starting from EMV 3DS 2.3.1:
/// This field is required if threeDSRequestorDecReqInd = Y, F or B.
#[serde(rename = "threeDSRequestorDecMaxTime")]
pub three_ds_requestor_dec_max_time: Option<u32>,
/// External IP address (i.e., the device public IP address) used by the 3DS Requestor App when it connects to the
/// 3DS Requestor environment. The value length is maximum 45 characters. Accepted values are:
///
/// - IPv4 address is represented in the dotted decimal f. Refer to RFC 791.
/// - IPv6 address. Refer to RFC 4291.
///
/// This field is required when deviceChannel = 01 (APP) and unless market or regional mandate restricts sending
/// this information.
/// Available for supporting EMV 3DS 2.3.1 and later versions.
pub app_ip: Option<std::net::IpAddr>,
/// Indicate if the 3DS Requestor supports the SPC authentication.
///
/// The accepted values are:
///
/// - Y -> Supported
///
/// This field is required if deviceChannel = 02 (BRW) and it is supported by the 3DS Requestor.
/// Available for supporting EMV 3DS 2.3.1 and later versions.
#[serde(rename = "threeDSRequestorSpcSupport")]
pub three_ds_requestor_spc_support: Option<String>,
/// Reason that the SPC authentication was not completed.
/// Accepted value length is 2 characters.
///
/// The accepted values are:
///
/// - 01 -> SPC did not run or did not successfully complete
/// - 02 -> Cardholder cancels the SPC authentication
///
/// This field is required if deviceChannel = 02 (BRW) and the 3DS Requestor attempts to invoke SPC API and there is an
/// error.
/// Available for supporting EMV 3DS 2.3.1 and later versions.
pub spc_incomp_ind: Option<String>,
}
/// Indicates the type of Authentication request.
///
/// This data element provides additional information to the ACS to determine the best approach for handling an authentication request.
///
/// This value is used for App-based and Browser flows.
#[derive(Serialize, Deserialize, Debug, Clone)]
pub enum ThreeDSRequestorAuthenticationIndicator {
#[serde(rename = "01")]
Payment,
#[serde(rename = "02")]
Recurring,
#[serde(rename = "03")]
Installment,
#[serde(rename = "04")]
AddCard,
#[serde(rename = "05")]
MaintainCard,
#[serde(rename = "06")]
CardholderVerification,
#[serde(rename = "07")]
BillingAgreement,
}
impl ThreeDSRequestor {
pub fn new(
app_ip: Option<std::net::IpAddr>,
psd2_sca_exemption_type: Option<common_enums::ScaExemptionType>,
force_3ds_challenge: bool,
message_version: SemanticVersion,
) -> Self {
// if sca exemption is provided, we need to set the challenge indicator to NoChallengeRequestedTransactionalRiskAnalysis
let three_ds_requestor_challenge_ind = if force_3ds_challenge {
Some(SingleOrListElement::get_version_checked(
message_version,
ThreeDSRequestorChallengeIndicator::ChallengeRequestedMandate,
))
} else if let Some(common_enums::ScaExemptionType::TransactionRiskAnalysis) =
psd2_sca_exemption_type
{
Some(SingleOrListElement::get_version_checked(
message_version,
ThreeDSRequestorChallengeIndicator::NoChallengeRequestedTransactionalRiskAnalysis,
))
} else {
None
};
Self {
three_ds_requestor_authentication_ind: ThreeDSRequestorAuthenticationIndicator::Payment,
three_ds_requestor_authentication_info: None,
three_ds_requestor_challenge_ind,
three_ds_requestor_prior_authentication_info: None,
three_ds_requestor_dec_req_ind: None,
three_ds_requestor_dec_max_time: None,
app_ip,
three_ds_requestor_spc_support: None,
spc_incomp_ind: None,
}
}
}
#[derive(Serialize, Deserialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
pub struct ThreeDSRequestorAuthenticationInformation {
/// Mechanism used by the Cardholder to authenticate to the 3DS Requestor. Accepted values are:
/// - 01 -> No 3DS Requestor authentication occurred (i.e. cardholder "logged in" as guest)
/// - 02 -> Login to the cardholder account at the 3DS Requestor system using 3DS Requestor's own credentials
/// - 03 -> Login to the cardholder account at the 3DS Requestor system using federated ID
/// - 04 -> Login to the cardholder account at the 3DS Requestor system using issuer credentials
/// - 05 -> Login to the cardholder account at the 3DS Requestor system using third-party authentication
/// - 06 -> Login to the cardholder account at the 3DS Requestor system using FIDO Authenticator.
///
/// The next values are accepted as well if 3DS Server initiates authentication with EMV 3DS 2.2.0 version or greater (required protocol version can be set in ThreeDSServerAuthenticationRequest#preferredProtocolVersion field):
/// - 07 -> Login to the cardholder account at the 3DS Requestor system using FIDO Authenticator (FIDO assurance data signed).
/// - 08 -> SRC Assurance Data.
/// - Additionally, 80-99 can be used for PS-specific values, regardless of protocol version.
#[serde(rename = "threeDSReqAuthMethod")]
pub three_ds_req_auth_method: ThreeDSReqAuthMethod,
/// Date and time converted into UTC of the cardholder authentication. Field is limited to 12 characters and accepted format is YYYYMMDDHHMM
#[serde(rename = "threeDSReqAuthTimestamp")]
pub three_ds_req_auth_timestamp: String,
/// Data that documents and supports a specific authentication process. In the current version of the specification, this data element is not defined in detail, however the intention is that for each 3DS Requestor Authentication Method, this field carry data that the ACS can use to verify the authentication process.
/// For example, if the 3DS Requestor Authentication Method is:
///
/// - 03 -> then this element can carry information about the provider of the federated ID and related information
/// - 06 -> then this element can carry the FIDO attestation data (incl. the signature)
/// - 07 -> then this element can carry FIDO Attestation data with the FIDO assurance data signed.
/// - 08 -> then this element can carry the SRC assurance data.
#[serde(rename = "threeDSReqAuthData")]
pub three_ds_req_auth_data: Option<String>,
}
/// Indicates whether a challenge is requested for this transaction. For example: For 01-PA, a 3DS Requestor may have
/// concerns about the transaction, and request a challenge. For 02-NPA, a challenge may be necessary when adding a new
/// card to a wallet.
///
/// This field is optional. The accepted values are:
///
/// - 01 -> No preference
/// - 02 -> No challenge requested
/// - 03 -> Challenge requested: 3DS Requestor Preference
/// - 04 -> Challenge requested: Mandate.
/// The next values are accepted as well if 3DS Server initiates authentication with EMV 3DS 2.2.0 version
/// or greater (required protocol version can be set in
/// ThreeDSServerAuthenticationRequest#preferredProtocolVersion field):
///
/// - 05 -> No challenge requested (transactional risk analysis is already performed)
/// - 06 -> No challenge requested (Data share only)
/// - 07 -> No challenge requested (strong consumer authentication is already performed)
/// - 08 -> No challenge requested (utilise whitelist exemption if no challenge required)
/// - 09 -> Challenge requested (whitelist prompt requested if challenge required).
/// - Additionally, 80-99 can be used for PS-specific values, regardless of protocol version.
///
/// If the element is not provided, the expected action is that the ACS would interpret as 01 -> No preference.
///
/// Format of this field was changed with EMV 3DS 2.3.1 version:
/// In versions prior to 2.3.1, this field is a String.
/// Starting from EMVCo version 2.3.1, this field is now an array of objects. Accepted value length is 1-2 elements.
/// When providing two preferences, the 3DS Requestor ensures that they are in preference order and are not
/// conflicting. For example, 02 = No challenge requested and 04 = Challenge requested (Mandate).
#[derive(Serialize, Deserialize, Debug, Clone)]
pub enum ThreeDSRequestorChallengeIndicator {
#[serde(rename = "01")]
NoPreference,
#[serde(rename = "02")]
NoChallengeRequested,
#[serde(rename = "03")]
ChallengeRequested3DSRequestorPreference,
#[serde(rename = "04")]
ChallengeRequestedMandate,
#[serde(rename = "05")]
NoChallengeRequestedTransactionalRiskAnalysis,
#[serde(rename = "06")]
NoChallengeRequestedDataShareOnly,
#[serde(rename = "07")]
NoChallengeRequestedStrongConsumerAuthentication,
#[serde(rename = "08")]
NoChallengeRequestedWhitelistExemption,
#[serde(rename = "09")]
ChallengeRequestedWhitelistPrompt,
}
/// This field contains information about how the 3DS Requestor authenticated the cardholder as part of a previous 3DS transaction.
/// Format of this field was changed with EMV 3DS 2.3.1 version:
/// In versions prior to 2.3.1, this field is a single object.
/// Starting from EMVCo version 2.3.1, this field is now an array of objects. Accepted value length is 1-3 elements.
///
/// This field is optional, but recommended to include for versions prior to 2.3.1. From 2.3.1,
/// it is required for 3RI in the case of Decoupled Authentication Fallback or for SPC.
#[derive(Serialize, Deserialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
pub struct ThreeDSRequestorPriorTransactionAuthenticationInformation {
/// This data element provides additional information to the ACS to determine the best
/// approach for handling a request. The field is limited to 36 characters containing
/// ACS Transaction ID for a prior authenticated transaction (for example, the first
/// recurring transaction that was authenticated with the cardholder).
pub three_ds_req_prior_ref: String,
/// Mechanism used by the Cardholder to previously authenticate to the 3DS Requestor.
/// Accepted values for this field are:
/// - 01 -> Frictionless authentication occurred by ACS
/// - 02 -> Cardholder challenge occurred by ACS
/// - 03 -> AVS verified
/// - 04 -> Other issuer methods
/// - 80-99 -> PS-specific value (dependent on the payment scheme type).
pub three_ds_req_prior_auth_method: String,
/// Date and time converted into UTC of the prior authentication. Accepted date
/// format is YYYYMMDDHHMM.
pub three_ds_req_prior_auth_timestamp: String,
/// Data that documents and supports a specific authentication process. In the current
/// version of the specification this data element is not defined in detail, however
/// the intention is that for each 3DS Requestor Authentication Method, this field carry
/// data that the ACS can use to verify the authentication process. In future versions
/// of the application, these details are expected to be included. Field is limited to
/// maximum 2048 characters.
pub three_ds_req_prior_auth_data: String,
}
/// Enum indicating whether the 3DS Requestor requests the ACS to utilize Decoupled Authentication.
#[derive(Serialize, Deserialize, Debug, Clone)]
pub enum ThreeDSRequestorDecoupledRequestIndicator {
/// Decoupled Authentication is supported and preferred if challenge is necessary.
Y,
/// Do not use Decoupled Authentication.
N,
/// Decoupled Authentication is supported and is to be used only as a fallback challenge method
/// if a challenge is necessary (Transaction Status = D in RReq).
F,
/// Decoupled Authentication is supported and can be used as a primary or fallback challenge method
/// if a challenge is necessary (Transaction Status = D in either ARes or RReq).
B,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
pub enum SchemeId {
Visa,
Mastercard,
#[serde(rename = "JCB")]
Jcb,
#[serde(rename = "American Express")]
AmericanExpress,
Diners,
// For Cartes Bancaires and UnionPay, it is recommended to send the scheme ID
#[serde(rename = "CB")]
CartesBancaires,
UnionPay,
}
impl TryFrom<common_enums::CardNetwork> for SchemeId {
type Error = error_stack::Report<ConnectorError>;
fn try_from(network: common_enums::CardNetwork) -> Result<Self, Self::Error> {
match network {
common_enums::CardNetwork::Visa => Ok(Self::Visa),
common_enums::CardNetwork::Mastercard => Ok(Self::Mastercard),
common_enums::CardNetwork::JCB => Ok(Self::Jcb),
common_enums::CardNetwork::AmericanExpress => Ok(Self::AmericanExpress),
common_enums::CardNetwork::DinersClub => Ok(Self::Diners),
common_enums::CardNetwork::CartesBancaires => Ok(Self::CartesBancaires),
common_enums::CardNetwork::UnionPay => Ok(Self::UnionPay),
_ => Err(ConnectorError::RequestEncodingFailedWithReason(
"Invalid card network".to_string(),
))?,
}
}
}
#[derive(Serialize, Deserialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
pub struct CardholderAccount {
/// Indicates the type of account.
/// This is required if 3DS Requestor is asking Cardholder which Account Type they are using before making
/// the purchase. This field is required in some markets. Otherwise, it is optional.
pub acct_type: Option<AccountType>,
/// Expiry date of the PAN or token supplied to the 3DS Requestor by the Cardholder.
/// The field has 4 characters in a format YYMM.
///
/// The requirements of the presence of this field are DS specific.
pub card_expiry_date: Option<masking::Secret<String>>,
/// This field contains additional information about the Cardholder’s account provided by the 3DS Requestor.
///
/// The field is optional but recommended to include.
///
/// Starting from EMV 3DS 2.3.1, added new field:
/// - `ch_acc_req_id` -> The 3DS Requestor assigned account identifier of the transacting Cardholder.
/// This identifier is a unique representation of the account identifier for the 3DS Requestor and
/// is provided as a String.
pub acct_info: Option<CardHolderAccountInformation>,
/// Account number that will be used in the authorization request for payment transactions.
/// May be represented by PAN or token.
///
/// This field is required.
pub acct_number: cards::CardNumber,
/// ID for the scheme to which the Cardholder's acctNumber belongs to.
/// It will be used to identify the Scheme from the 3DS Server configuration.
///
/// This field is optional, but recommended to include.
/// It should be present when it is not one of the schemes for which scheme resolving regular expressions
/// are provided in the 3DS Server Configuration Properties. Additionally,
/// if the schemeId is present in the request and there are card ranges found by multiple schemes, the schemeId will be
/// used for proper resolving of the versioning data.
pub scheme_id: Option<SchemeId>,
/// Additional information about the account optionally provided by the 3DS Requestor.
///
/// This field is limited to 64 characters and it is optional to use.
#[serde(rename = "acctID")]
pub acct_id: Option<String>,
/// Indicates if the transaction was de-tokenized prior to being received by the ACS.
///
/// The boolean value of true is the only valid response for this field when it is present.
///
/// The field is required only if there is a de-tokenization of an Account Number.
pub pay_token_ind: Option<bool>,
/// Information about the de-tokenised Payment Token.
/// Note: Data will be formatted into a JSON object prior to being placed into the EMV Payment Token field of the message.
///
/// This field is optional.
pub pay_token_info: Option<String>,
/// Three or four-digit security code printed on the card.
/// The value is numeric and limited to 3-4 characters.
///
/// This field is required depending on the rules provided by the Directory Server.
/// Available for supporting EMV 3DS 2.3.1 and later versions.
pub card_security_code: Option<masking::Secret<String>>,
}
#[derive(Serialize, Deserialize, Debug, Clone)]
pub enum AccountType {
#[serde(rename = "01")]
NotApplicable,
#[serde(rename = "02")]
Credit,
#[serde(rename = "03")]
Debit,
#[serde(rename = "80")]
Jcb,
/// 81-99 -> PS-specific value (dependent on the payment scheme type).
#[serde(untagged)]
PsSpecificValue(String),
}
#[derive(Serialize, Deserialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
pub struct CardHolderAccountInformation {
/// Length of time that the cardholder has had the account with the 3DS Requestor.
///
/// Accepted values are:
/// - `01` -> No account
/// - `02` -> Created during this transaction
/// - `03` -> Less than 30 days
/// - `04` -> Between 30 and 60 days
/// - `05` -> More than 60 days
pub ch_acc_age_ind: Option<String>,
/// Date converted into UTC that the cardholder opened the account with the 3DS Requestor.
///
/// Date format = YYYYMMDD.
pub ch_acc_date: Option<String>,
/// Length of time since the cardholder’s account information with the 3DS Requestor was
/// last changed.
///
/// Includes Billing or Shipping address, new payment account, or new user(s) added.
///
/// Accepted values are:
/// - `01` -> Changed during this transaction
/// - `02` -> Less than 30 days
/// - `03` -> 30 - 60 days
/// - `04` -> More than 60 days
pub ch_acc_change_ind: Option<String>,
/// Date converted into UTC that the cardholder’s account with the 3DS Requestor was last changed.
///
/// Including Billing or Shipping address, new payment account, or new user(s) added.
///
/// Date format = YYYYMMDD.
pub ch_acc_change: Option<String>,
/// Length of time since the cardholder’s account with the 3DS Requestor had a password change
/// or account reset.
///
/// The accepted values are:
/// - `01` -> No change
/// - `02` -> Changed during this transaction
/// - `03` -> Less than 30 days
/// - `04` -> 30 - 60 days
/// - `05` -> More than 60 days
pub ch_acc_pw_change_ind: Option<String>,
/// Date converted into UTC that cardholder’s account with the 3DS Requestor had a password
/// change or account reset.
///
/// Date format must be YYYYMMDD.
pub ch_acc_pw_change: Option<String>,
/// Indicates when the shipping address used for this transaction was first used with the
/// 3DS Requestor.
///
/// Accepted values are:
/// - `01` -> This transaction
/// - `02` -> Less than 30 days
/// - `03` -> 30 - 60 days
/// - `04` -> More than 60 days
pub ship_address_usage_ind: Option<String>,
/// Date converted into UTC when the shipping address used for this transaction was first
/// used with the 3DS Requestor.
///
/// Date format must be YYYYMMDD.
pub ship_address_usage: Option<String>,
/// Number of transactions (successful and abandoned) for this cardholder account with the
/// 3DS Requestor across all payment accounts in the previous 24 hours.
pub txn_activity_day: Option<u32>,
/// Number of transactions (successful and abandoned) for this cardholder account with the
/// 3DS Requestor across all payment accounts in the previous year.
pub txn_activity_year: Option<u32>,
/// Number of Add Card attempts in the last 24 hours.
pub provision_attempts_day: Option<u32>,
/// Number of purchases with this cardholder account during the previous six months.
pub nb_purchase_account: Option<u32>,
/// Indicates whether the 3DS Requestor has experienced suspicious activity
/// (including previous fraud) on the cardholder account.
///
/// Accepted values are:
/// - `01` -> No suspicious activity has been observed
/// - `02` -> Suspicious activity has been observed
pub suspicious_acc_activity: Option<String>,
/// Indicates if the Cardholder Name on the account is identical to the shipping Name used
/// for this transaction.
///
/// Accepted values are:
/// - `01` -> Account Name identical to shipping Name
/// - `02` -> Account Name different than shipping Name
pub ship_name_indicator: Option<String>,
/// Indicates the length of time that the payment account was enrolled in the cardholder’s
/// account with the 3DS Requester.
///
/// Accepted values are:
/// - `01` -> No account (guest check-out)
/// - `02` -> During this transaction
/// - `03` -> Less than 30 days
/// - `04` -> 30 - 60 days
/// - `05` -> More than 60 days
pub payment_acc_ind: Option<String>,
/// Date converted into UTC that the payment account was enrolled in the cardholder’s account with
/// the 3DS Requestor.
///
/// Date format must be YYYYMMDD.
pub payment_acc_age: Option<String>,
/// The 3DS Requestor assigned account identifier of the transacting Cardholder.
///
/// This identifier is a unique representation of the account identifier for the 3DS Requestor and
/// is provided as a String. Accepted value length is maximum 64 characters.
///
/// Added starting from EMV 3DS 2.3.1.
pub ch_acc_req_id: Option<String>,
}
#[derive(Serialize, Deserialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
#[serde_with::skip_serializing_none]
pub struct Cardholder {
/// Indicates whether the Cardholder Shipping Address and Cardholder Billing Address are the same.
///
/// Accepted values:
/// - `Y` -> Shipping Address matches Billing Address
/// - `N` -> Shipping Address does not match Billing Address
///
/// If the field is not set and the shipping and billing addresses are the same, the 3DS Server will set the value to
/// `Y`. Otherwise, the value will not be changed.
///
/// This field is optional.
addr_match: Option<String>,
/// The city of the Cardholder billing address associated with the card used for this purchase.
///
/// This field is limited to a maximum of 50 characters.
///
/// This field is required unless market or regional mandate restricts sending this information.
bill_addr_city: Option<String>,
/// The country of the Cardholder billing address associated with the card used for this purchase.
///
/// This field is limited to 3 characters. This value shall be the ISO 3166-1 numeric country code, except values
/// from range 901 - 999 which are reserved by ISO.
///
/// The field is required if Cardholder Billing Address State is present and unless market or regional mandate
/// restricts sending this information.
bill_addr_country: Option<String>,
/// First line of the street address or equivalent local portion of the Cardholder billing address associated with
/// the card use for this purchase.
///
/// This field is limited to a maximum of 50 characters.
///
/// This field is required unless market or regional mandate restricts sending this information.
bill_addr_line1: Option<masking::Secret<String>>,
/// Second line of the street address or equivalent local portion of the Cardholder billing address associated with
/// the card use for this purchase.
///
/// This field is limited to a maximum of 50 characters.
///
/// This field is required unless market or regional mandate restricts sending this information.
bill_addr_line2: Option<masking::Secret<String>>,
/// Third line of the street address or equivalent local portion of the Cardholder billing address associated with
/// the card use for this purchase.
///
/// This field is limited to a maximum of 50 characters.
///
/// This field is required unless market or regional mandate restricts sending this information.
bill_addr_line3: Option<masking::Secret<String>>,
/// ZIP or other postal code of the Cardholder billing address associated with the card used for this purchase.
///
/// This field is limited to a maximum of 16 characters.
///
/// This field is required unless market or regional mandate restricts sending this information.
bill_addr_post_code: Option<masking::Secret<String>>,
/// The state or province of the Cardholder billing address associated with the card used for this purchase.
///
/// This field is limited to 3 characters. The value should be the country subdivision code defined in ISO 3166-2.
///
/// This field is required unless State is not applicable for this country and unless market or regional mandate
/// restricts sending this information.
bill_addr_state: Option<masking::Secret<String>>,
/// The email address associated with the account that is either entered by the Cardholder, or is on file with
/// the 3DS Requestor.
///
/// This field is limited to a maximum of 256 characters and shall meet requirements of Section 3.4 of
/// IETF RFC 5322.
///
/// This field is required unless market or regional mandate restricts sending this information.
email: Option<Email>,
/// The home phone provided by the Cardholder.
///
/// Refer to ITU-E.164 for additional information on format and length.
///
/// This field is required if available, unless market or regional mandate restricts sending this information.
home_phone: Option<PhoneNumber>,
/// The mobile phone provided by the Cardholder.
///
/// Refer to ITU-E.164 for additional information on format and length.
///
/// This field is required if available, unless market or regional mandate restricts sending this information.
mobile_phone: Option<PhoneNumber>,
/// The work phone provided by the Cardholder.
///
/// Refer to ITU-E.164 for additional information on format and length.
///
/// This field is required if available, unless market or regional mandate restricts sending this information.
work_phone: Option<PhoneNumber>,
/// Name of the Cardholder.
///
/// This field is limited to 2-45 characters.
///
/// This field is required unless market or regional mandate restricts sending this information.
///
/// Starting from EMV 3DS 2.3.1:
/// This field is limited to 1-45 characters.
cardholder_name: Option<masking::Secret<String>>,
/// City portion of the shipping address requested by the Cardholder.
///
/// This field is required unless shipping information is the same as billing information, or market or regional
/// mandate restricts sending this information.
ship_addr_city: Option<String>,
/// Country of the shipping address requested by the Cardholder.
///
/// This field is limited to 3 characters. This value shall be the ISO 3166-1 numeric country code, except values
/// from range 901 - 999 which are reserved by ISO.
///
/// This field is required if Cardholder Shipping Address State is present and if shipping information are not the same
/// as billing information. This field can be omitted if market or regional mandate restricts sending this information.
ship_addr_country: Option<String>,
/// First line of the street address or equivalent local portion of the shipping address associated with
/// the card use for this purchase.
///
/// This field is limited to a maximum of 50 characters.
///
/// This field is required unless shipping information is the same as billing information, or market or regional
/// mandate restricts sending this information.
ship_addr_line1: Option<masking::Secret<String>>,
/// Second line of the street address or equivalent local portion of the shipping address associated with
/// the card use for this purchase.
///
/// This field is limited to a maximum of 50 characters.
///
/// This field is required unless shipping information is the same as billing information, or market or regional
/// mandate restricts sending this information.
ship_addr_line2: Option<masking::Secret<String>>,
/// Third line of the street address or equivalent local portion of the shipping address associated with
/// the card use for this purchase.
///
/// This field is limited to a maximum of 50 characters.
///
/// This field is required unless shipping information is the same as billing information, or market or regional
/// mandate restricts sending this information.
ship_addr_line3: Option<masking::Secret<String>>,
/// ZIP or other postal code of the shipping address associated with the card used for this purchase.
///
/// This field is limited to a maximum of 16 characters.
///
/// This field is required unless shipping information is the same as billing information, or market or regional
/// mandate restricts sending this information.
ship_addr_post_code: Option<masking::Secret<String>>,
/// The state or province of the shipping address associated with the card used for this purchase.
///
/// This field is limited to 3 characters. The value should be the country subdivision code defined in ISO 3166-2.
///
/// This field is required unless shipping information is the same as billing information, or State is not applicable
/// for this country, or market or regional mandate restricts sending this information.
ship_addr_state: Option<masking::Secret<String>>,
/// Tax ID is the Cardholder's tax identification.
///
/// The value is limited to 45 characters.
///
/// This field is required depending on the rules provided by the Directory Server.
|
crates/hyperswitch_connectors/src/connectors/netcetera/netcetera_types.rs#chunk0
|
hyperswitch_connectors
|
chunk
| null | null | null | 8,173
| null | null | null | null | null | null | null |
// Struct: SmtpServerConfig
// File: crates/external_services/src/email/smtp.rs
// Module: external_services
// Implementations: 1
pub struct SmtpServerConfig
|
crates/external_services/src/email/smtp.rs
|
external_services
|
struct_definition
|
SmtpServerConfig
| 1
|
[] | 40
| null | null | null | null | null | null | null |
// Struct: RedirectData
// File: crates/hyperswitch_connectors/src/connectors/worldline/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct RedirectData
|
crates/hyperswitch_connectors/src/connectors/worldline/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
RedirectData
| 0
|
[] | 45
| null | null | null | null | null | null | null |
// Implementation: impl Hash for for PaymentMetricsBucketIdentifier
// File: crates/api_models/src/analytics/payments.rs
// Module: api_models
// Methods: 1 total (0 public)
impl Hash for for PaymentMetricsBucketIdentifier
|
crates/api_models/src/analytics/payments.rs
|
api_models
|
impl_block
| null | null | null | 49
| null |
PaymentMetricsBucketIdentifier
|
Hash for
| 1
| 0
| null | null |
// Struct: InespayErrorResponse
// File: crates/hyperswitch_connectors/src/connectors/inespay/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct InespayErrorResponse
|
crates/hyperswitch_connectors/src/connectors/inespay/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
InespayErrorResponse
| 0
|
[] | 50
| null | null | null | null | null | null | null |
// Struct: FrmFulfillmentRequest
// File: crates/hyperswitch_domain_models/src/router_request_types/fraud_check.rs
// Module: hyperswitch_domain_models
// Implementations: 1
// Traits: ApiEventMetric
pub struct FrmFulfillmentRequest
|
crates/hyperswitch_domain_models/src/router_request_types/fraud_check.rs
|
hyperswitch_domain_models
|
struct_definition
|
FrmFulfillmentRequest
| 1
|
[
"ApiEventMetric"
] | 57
| null | null | null | null | null | null | null |
// File: crates/analytics/src/payments/metrics/sessionized_metrics/debit_routing.rs
// Module: analytics
use std::collections::HashSet;
use api_models::analytics::{
payments::{PaymentDimensions, PaymentFilters, PaymentMetricsBucketIdentifier},
Granularity, TimeRange,
};
use common_utils::errors::ReportSwitchExt;
use diesel_models::enums as storage_enums;
use error_stack::ResultExt;
use time::PrimitiveDateTime;
use super::PaymentMetricRow;
use crate::{
enums::AuthInfo,
query::{Aggregate, GroupByClause, QueryBuilder, QueryFilter, SeriesBucket, ToSql, Window},
types::{AnalyticsCollection, AnalyticsDataSource, MetricsError, MetricsResult},
};
#[derive(Default)]
pub(crate) struct DebitRouting;
#[async_trait::async_trait]
impl<T> super::PaymentMetric<T> for DebitRouting
where
T: AnalyticsDataSource + super::PaymentMetricAnalytics,
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: &[PaymentDimensions],
auth: &AuthInfo,
filters: &PaymentFilters,
granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(PaymentMetricsBucketIdentifier, PaymentMetricRow)>> {
let mut query_builder: QueryBuilder<T> =
QueryBuilder::new(AnalyticsCollection::PaymentSessionized);
for dim in dimensions.iter() {
query_builder.add_select_column(dim).switch()?;
}
query_builder
.add_select_column(Aggregate::Count {
field: None,
alias: Some("count"),
})
.switch()?;
query_builder
.add_select_column(Aggregate::Sum {
field: "debit_routing_savings",
alias: Some("total"),
})
.switch()?;
query_builder.add_select_column("currency").switch()?;
query_builder
.add_select_column(Aggregate::Min {
field: "created_at",
alias: Some("start_bucket"),
})
.switch()?;
query_builder
.add_select_column(Aggregate::Max {
field: "created_at",
alias: Some("end_bucket"),
})
.switch()?;
filters.set_filter_clause(&mut query_builder).switch()?;
auth.set_filter_clause(&mut query_builder).switch()?;
time_range
.set_filter_clause(&mut query_builder)
.attach_printable("Error filtering time range")
.switch()?;
for dim in dimensions.iter() {
query_builder
.add_group_by_clause(dim)
.attach_printable("Error grouping by dimensions")
.switch()?;
}
query_builder
.add_group_by_clause("currency")
.attach_printable("Error grouping by currency")
.switch()?;
if let Some(granularity) = granularity {
granularity
.set_group_by_clause(&mut query_builder)
.attach_printable("Error adding granularity")
.switch()?;
}
query_builder
.add_filter_clause(
PaymentDimensions::PaymentStatus,
storage_enums::AttemptStatus::Charged,
)
.switch()?;
query_builder
.execute_query::<PaymentMetricRow, _>(pool)
.await
.change_context(MetricsError::QueryBuildingError)?
.change_context(MetricsError::QueryExecutionFailure)?
.into_iter()
.map(|i| {
Ok((
PaymentMetricsBucketIdentifier::new(
i.currency.as_ref().map(|i| i.0),
None,
i.connector.clone(),
i.authentication_type.as_ref().map(|i| i.0),
i.payment_method.clone(),
i.payment_method_type.clone(),
i.client_source.clone(),
i.client_version.clone(),
i.profile_id.clone(),
i.card_network.clone(),
i.merchant_id.clone(),
i.card_last_4.clone(),
i.card_issuer.clone(),
i.error_reason.clone(),
i.routing_approach.as_ref().map(|i| i.0.clone()),
i.signature_network.clone(),
i.is_issuer_regulated,
i.is_debit_routed,
TimeRange {
start_time: match (granularity, i.start_bucket) {
(Some(g), Some(st)) => g.clip_to_start(st)?,
_ => time_range.start_time,
},
end_time: granularity.as_ref().map_or_else(
|| Ok(time_range.end_time),
|g| i.end_bucket.map(|et| g.clip_to_end(et)).transpose(),
)?,
},
),
i,
))
})
.collect::<error_stack::Result<
HashSet<(PaymentMetricsBucketIdentifier, PaymentMetricRow)>,
crate::query::PostProcessingError,
>>()
.change_context(MetricsError::PostProcessingFailure)
}
}
|
crates/analytics/src/payments/metrics/sessionized_metrics/debit_routing.rs
|
analytics
|
full_file
| null | null | null | 1,064
| null | null | null | null | null | null | null |
// Struct: OpennodeWebhookDetails
// File: crates/hyperswitch_connectors/src/connectors/opennode/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct OpennodeWebhookDetails
|
crates/hyperswitch_connectors/src/connectors/opennode/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
OpennodeWebhookDetails
| 0
|
[] | 53
| 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 |
// Function: get_payment_config_routing_id
// File: crates/common_utils/src/id_type/merchant.rs
// Module: common_utils
// Documentation: get_payment_config_routing_id
pub fn get_payment_config_routing_id(&self) -> String
|
crates/common_utils/src/id_type/merchant.rs
|
common_utils
|
function_signature
| null | null | null | 49
|
get_payment_config_routing_id
| null | null | null | null | null | null |
// Implementation: impl api::MandateSetup for for Juspaythreedsserver
// File: crates/hyperswitch_connectors/src/connectors/juspaythreedsserver.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::MandateSetup for for Juspaythreedsserver
|
crates/hyperswitch_connectors/src/connectors/juspaythreedsserver.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 76
| null |
Juspaythreedsserver
|
api::MandateSetup for
| 0
| 0
| null | null |
// Implementation: impl ConnectorValidation for for Coinbase
// File: crates/hyperswitch_connectors/src/connectors/coinbase.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl ConnectorValidation for for Coinbase
|
crates/hyperswitch_connectors/src/connectors/coinbase.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 52
| null |
Coinbase
|
ConnectorValidation for
| 0
| 0
| null | null |
// TODO: This has to be generated as the reference id based on the connector configuration
// Some connectros might not accept accept the global id. This has to be done when generating the reference id
connector_request_reference_id,
preprocessing_id: attempt.preprocessing_step_id.clone(),
#[cfg(feature = "payouts")]
payout_method_data: None,
#[cfg(feature = "payouts")]
quote_id: None,
// TODO: take this based on the env
test_mode: Some(true),
payment_method_balance: None,
connector_api_version: None,
connector_http_status_code: None,
external_latency: None,
apple_pay_flow: None,
frm_metadata: None,
refund_id: None,
dispute_id: None,
connector_response: None,
integrity_check: Ok(()),
additional_merchant_data: None,
header_payload,
connector_mandate_request_reference_id: None,
authentication_id: None,
psd2_sca_exemption_type: None,
raw_connector_response: None,
is_payment_id_from_merchant: None,
l2_l3_data: None,
minor_amount_capturable: None,
};
Ok(router_data)
}
#[cfg(feature = "v2")]
#[instrument(skip_all)]
#[allow(clippy::too_many_arguments)]
pub async fn construct_cancel_router_data_v2<'a>(
state: &'a SessionState,
merchant_account: &domain::MerchantAccount,
merchant_connector_account: &domain::MerchantConnectorAccountTypeDetails,
payment_data: &hyperswitch_domain_models::payments::PaymentCancelData<api::Void>,
request: types::PaymentsCancelData,
connector_request_reference_id: String,
customer_id: Option<common_utils::id_type::CustomerId>,
header_payload: Option<hyperswitch_domain_models::payments::HeaderPayload>,
) -> RouterResult<
RouterDataV2<
api::Void,
flow_common_types::PaymentFlowData,
types::PaymentsCancelData,
types::PaymentsResponseData,
>,
> {
let auth_type: types::ConnectorAuthType = merchant_connector_account
.get_connector_account_details()
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Failed while parsing value for ConnectorAuthType")?;
let payment_cancel_data = flow_common_types::PaymentFlowData {
merchant_id: merchant_account.get_id().clone(),
customer_id,
connector_customer: None,
payment_id: payment_data
.payment_attempt
.payment_id
.get_string_repr()
.to_owned(),
attempt_id: payment_data
.payment_attempt
.get_id()
.get_string_repr()
.to_owned(),
status: payment_data.payment_attempt.status,
payment_method: payment_data.payment_attempt.payment_method_type,
description: payment_data
.payment_intent
.description
.as_ref()
.map(|description| description.get_string_repr())
.map(ToOwned::to_owned),
address: hyperswitch_domain_models::payment_address::PaymentAddress::default(),
auth_type: payment_data.payment_attempt.authentication_type,
connector_meta_data: merchant_connector_account.get_metadata(),
amount_captured: None,
minor_amount_captured: None,
access_token: None,
session_token: None,
reference_id: None,
payment_method_token: None,
recurring_mandate_payment_data: None,
preprocessing_id: payment_data.payment_attempt.preprocessing_step_id.clone(),
payment_method_balance: None,
connector_api_version: None,
connector_request_reference_id,
test_mode: Some(true),
connector_http_status_code: None,
external_latency: None,
apple_pay_flow: None,
connector_response: None,
payment_method_status: None,
};
let router_data_v2 = RouterDataV2 {
flow: PhantomData,
tenant_id: state.tenant.tenant_id.clone(),
resource_common_data: payment_cancel_data,
connector_auth_type: auth_type,
request,
response: Err(hyperswitch_domain_models::router_data::ErrorResponse::default()),
};
Ok(router_data_v2)
}
#[cfg(feature = "v2")]
#[instrument(skip_all)]
#[allow(clippy::too_many_arguments)]
pub async fn construct_router_data_for_cancel<'a>(
state: &'a SessionState,
payment_data: hyperswitch_domain_models::payments::PaymentCancelData<
hyperswitch_domain_models::router_flow_types::Void,
>,
connector_id: &str,
merchant_context: &domain::MerchantContext,
customer: &'a Option<domain::Customer>,
merchant_connector_account: &domain::MerchantConnectorAccountTypeDetails,
_merchant_recipient_data: Option<types::MerchantRecipientData>,
header_payload: Option<hyperswitch_domain_models::payments::HeaderPayload>,
) -> RouterResult<types::PaymentsCancelRouterData> {
fp_utils::when(merchant_connector_account.is_disabled(), || {
Err(errors::ApiErrorResponse::MerchantConnectorAccountDisabled)
})?;
// TODO: Take Globalid and convert to connector reference id
let customer_id = customer
.to_owned()
.map(|customer| common_utils::id_type::CustomerId::try_from(customer.id.clone()))
.transpose()
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable(
"Invalid global customer generated, not able to convert to reference id",
)?;
let payment_intent = payment_data.get_payment_intent();
let attempt = payment_data.get_payment_attempt();
let connector_request_reference_id = payment_data
.payment_attempt
.connector_request_reference_id
.clone()
.ok_or(errors::ApiErrorResponse::InternalServerError)
.attach_printable("connector_request_reference_id not found in payment_attempt")?;
let request = types::PaymentsCancelData {
amount: Some(attempt.amount_details.get_net_amount().get_amount_as_i64()),
currency: Some(payment_intent.amount_details.currency),
connector_transaction_id: attempt
.get_connector_payment_id()
.unwrap_or_default()
.to_string(),
cancellation_reason: attempt.cancellation_reason.clone(),
connector_meta: attempt.connector_metadata.clone().expose_option(),
browser_info: None,
metadata: None,
minor_amount: Some(attempt.amount_details.get_net_amount()),
webhook_url: None,
capture_method: Some(payment_intent.capture_method),
};
// Construct RouterDataV2 for cancel operation
let router_data_v2 = construct_cancel_router_data_v2(
state,
merchant_context.get_merchant_account(),
merchant_connector_account,
&payment_data,
request,
connector_request_reference_id.clone(),
customer_id.clone(),
header_payload.clone(),
)
.await?;
// Convert RouterDataV2 to old RouterData (v1) using the existing RouterDataConversion trait
let router_data = flow_common_types::PaymentFlowData::to_old_router_data(router_data_v2)
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable(
"Cannot construct router data for making the unified connector service call",
)?;
Ok(router_data)
}
#[cfg(feature = "v2")]
#[instrument(skip_all)]
#[allow(clippy::too_many_arguments)]
pub async fn construct_payment_router_data_for_sdk_session<'a>(
state: &'a SessionState,
payment_data: hyperswitch_domain_models::payments::PaymentIntentData<api::Session>,
connector_id: &str,
merchant_context: &domain::MerchantContext,
customer: &'a Option<domain::Customer>,
merchant_connector_account: &domain::MerchantConnectorAccountTypeDetails,
_merchant_recipient_data: Option<types::MerchantRecipientData>,
header_payload: Option<hyperswitch_domain_models::payments::HeaderPayload>,
) -> RouterResult<types::PaymentsSessionRouterData> {
fp_utils::when(merchant_connector_account.is_disabled(), || {
Err(errors::ApiErrorResponse::MerchantConnectorAccountDisabled)
})?;
let auth_type: types::ConnectorAuthType = merchant_connector_account
.get_connector_account_details()
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Failed while parsing value for ConnectorAuthType")?;
// TODO: Take Globalid and convert to connector reference id
let customer_id = customer
.to_owned()
.map(|customer| common_utils::id_type::CustomerId::try_from(customer.id.clone()))
.transpose()
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable(
"Invalid global customer generated, not able to convert to reference id",
)?;
let billing_address = payment_data
.payment_intent
.billing_address
.as_ref()
.map(|billing_address| billing_address.clone().into_inner());
// fetch email from customer or billing address (fallback)
let email = customer
.as_ref()
.and_then(|customer| customer.email.clone())
.map(pii::Email::from)
.or(billing_address
.as_ref()
.and_then(|address| address.email.clone()));
// fetch customer name from customer or billing address (fallback)
let customer_name = customer
.as_ref()
.and_then(|customer| customer.name.clone())
.map(|name| name.into_inner())
.or(billing_address.and_then(|address| {
address
.address
.as_ref()
.and_then(|address_details| address_details.get_optional_full_name())
}));
let order_details = payment_data
.payment_intent
.order_details
.clone()
.map(|order_details| {
order_details
.into_iter()
.map(|order_detail| order_detail.expose())
.collect()
});
let required_amount_type = StringMajorUnitForConnector;
let apple_pay_amount = required_amount_type
.convert(
payment_data.payment_intent.amount_details.order_amount,
payment_data.payment_intent.amount_details.currency,
)
.change_context(errors::ApiErrorResponse::PreconditionFailed {
message: "Failed to convert amount to string major unit for applePay".to_string(),
})?;
let apple_pay_recurring_details = payment_data
.payment_intent
.feature_metadata
.and_then(|feature_metadata| feature_metadata.apple_pay_recurring_details)
.map(|apple_pay_recurring_details| {
ForeignInto::foreign_into((apple_pay_recurring_details, apple_pay_amount))
});
let order_tax_amount = payment_data
.payment_intent
.amount_details
.tax_details
.clone()
.and_then(|tax| tax.get_default_tax_amount());
// TODO: few fields are repeated in both routerdata and request
let request = types::PaymentsSessionData {
amount: payment_data
.payment_intent
.amount_details
.order_amount
.get_amount_as_i64(),
currency: payment_data.payment_intent.amount_details.currency,
country: payment_data
.payment_intent
.billing_address
.and_then(|billing_address| {
billing_address
.get_inner()
.address
.as_ref()
.and_then(|address| address.country)
}),
// TODO: populate surcharge here
surcharge_details: None,
order_details,
email,
minor_amount: payment_data.payment_intent.amount_details.order_amount,
apple_pay_recurring_details,
customer_name,
metadata: payment_data.payment_intent.metadata,
order_tax_amount,
shipping_cost: payment_data.payment_intent.amount_details.shipping_cost,
};
// TODO: evaluate the fields in router data, if they are required or not
let router_data = types::RouterData {
flow: PhantomData,
merchant_id: merchant_context.get_merchant_account().get_id().clone(),
// TODO: evaluate why we need customer id at the connector level. We already have connector customer id.
customer_id,
connector: connector_id.to_owned(),
tenant_id: state.tenant.tenant_id.clone(),
// TODO: evaluate why we need payment id at the connector level. We already have connector reference id
payment_id: payment_data.payment_intent.id.get_string_repr().to_owned(),
// TODO: evaluate why we need attempt id at the connector level. We already have connector reference id
attempt_id: "".to_string(),
status: enums::AttemptStatus::Started,
payment_method: enums::PaymentMethod::Wallet,
connector_auth_type: auth_type,
description: payment_data
.payment_intent
.description
.as_ref()
.map(|description| description.get_string_repr())
.map(ToOwned::to_owned),
// TODO: Create unified address
address: hyperswitch_domain_models::payment_address::PaymentAddress::default(),
auth_type: payment_data
.payment_intent
.authentication_type
.unwrap_or_default(),
connector_meta_data: merchant_connector_account.get_metadata(),
connector_wallets_details: None,
request,
response: Err(hyperswitch_domain_models::router_data::ErrorResponse::default()),
amount_captured: None,
minor_amount_captured: None,
access_token: None,
session_token: None,
reference_id: None,
payment_method_status: None,
payment_method_token: None,
connector_customer: None,
recurring_mandate_payment_data: None,
// TODO: This has to be generated as the reference id based on the connector configuration
// Some connectros might not accept accept the global id. This has to be done when generating the reference id
connector_request_reference_id: "".to_string(),
preprocessing_id: None,
#[cfg(feature = "payouts")]
payout_method_data: None,
#[cfg(feature = "payouts")]
quote_id: None,
// TODO: take this based on the env
test_mode: Some(true),
payment_method_balance: None,
connector_api_version: None,
connector_http_status_code: None,
external_latency: None,
apple_pay_flow: None,
frm_metadata: None,
refund_id: None,
dispute_id: None,
connector_response: None,
integrity_check: Ok(()),
additional_merchant_data: None,
header_payload,
connector_mandate_request_reference_id: None,
psd2_sca_exemption_type: None,
authentication_id: None,
raw_connector_response: None,
is_payment_id_from_merchant: None,
l2_l3_data: None,
minor_amount_capturable: None,
};
Ok(router_data)
}
#[cfg(feature = "v2")]
#[instrument(skip_all)]
#[allow(clippy::too_many_arguments)]
pub async fn construct_payment_router_data_for_setup_mandate<'a>(
state: &'a SessionState,
payment_data: hyperswitch_domain_models::payments::PaymentConfirmData<api::SetupMandate>,
connector_id: &str,
merchant_context: &domain::MerchantContext,
customer: &'a Option<domain::Customer>,
merchant_connector_account: &domain::MerchantConnectorAccountTypeDetails,
_merchant_recipient_data: Option<types::MerchantRecipientData>,
header_payload: Option<hyperswitch_domain_models::payments::HeaderPayload>,
) -> RouterResult<types::SetupMandateRouterData> {
fp_utils::when(merchant_connector_account.is_disabled(), || {
Err(errors::ApiErrorResponse::MerchantConnectorAccountDisabled)
})?;
let auth_type = merchant_connector_account
.get_connector_account_details()
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Failed while parsing value for ConnectorAuthType")?;
// TODO: Take Globalid and convert to connector reference id
let customer_id = customer
.to_owned()
.map(|customer| common_utils::id_type::CustomerId::try_from(customer.id.clone()))
.transpose()
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable(
"Invalid global customer generated, not able to convert to reference id",
)?;
let connector_customer_id = customer.as_ref().and_then(|customer| {
customer
.get_connector_customer_id(merchant_connector_account)
.map(String::from)
});
let payment_method = payment_data.payment_attempt.payment_method_type;
let router_base_url = &state.base_url;
let attempt = &payment_data.payment_attempt;
let complete_authorize_url = Some(helpers::create_complete_authorize_url(
router_base_url,
attempt,
connector_id,
None,
));
let webhook_url = match merchant_connector_account {
domain::MerchantConnectorAccountTypeDetails::MerchantConnectorAccount(
merchant_connector_account,
) => Some(helpers::create_webhook_url(
router_base_url,
&attempt.merchant_id,
merchant_connector_account.get_id().get_string_repr(),
)),
// TODO: Implement for connectors that require a webhook URL to be included in the request payload.
domain::MerchantConnectorAccountTypeDetails::MerchantConnectorDetails(_) => {
todo!("Add webhook URL to request for this connector")
}
};
let router_return_url = payment_data
.payment_intent
.create_finish_redirection_url(
router_base_url,
merchant_context
.get_merchant_account()
.publishable_key
.as_ref(),
)
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Unable to construct finish redirection url")?
.to_string();
let connector_request_reference_id = payment_data
.payment_attempt
.connector_request_reference_id
.clone()
.ok_or(errors::ApiErrorResponse::InternalServerError)
.attach_printable("connector_request_reference_id not found in payment_attempt")?;
let email = customer
.as_ref()
.and_then(|customer| customer.email.clone())
.map(pii::Email::from);
let browser_info = payment_data
.payment_attempt
.browser_info
.clone()
.map(types::BrowserInformation::from);
// TODO: few fields are repeated in both routerdata and request
let request = types::SetupMandateRequestData {
currency: payment_data.payment_intent.amount_details.currency,
payment_method_data: payment_data
.payment_method_data
.get_required_value("payment_method_data")?,
amount: Some(
payment_data
.payment_attempt
.amount_details
.get_net_amount()
.get_amount_as_i64(),
),
confirm: true,
statement_descriptor_suffix: None,
customer_acceptance: None,
mandate_id: None,
setup_future_usage: Some(payment_data.payment_intent.setup_future_usage),
off_session: None,
setup_mandate_details: None,
router_return_url: Some(router_return_url.clone()),
webhook_url,
browser_info,
email,
customer_name: None,
return_url: Some(router_return_url),
payment_method_type: Some(payment_data.payment_attempt.payment_method_subtype),
request_incremental_authorization: matches!(
payment_data
.payment_intent
.request_incremental_authorization,
RequestIncrementalAuthorization::True
),
metadata: payment_data.payment_intent.metadata,
minor_amount: Some(payment_data.payment_attempt.amount_details.get_net_amount()),
shipping_cost: payment_data.payment_intent.amount_details.shipping_cost,
capture_method: Some(payment_data.payment_intent.capture_method),
complete_authorize_url,
connector_testing_data: None,
customer_id: None,
enable_partial_authorization: None,
payment_channel: None,
enrolled_for_3ds: true,
related_transaction_id: None,
is_stored_credential: None,
};
let connector_mandate_request_reference_id = payment_data
.payment_attempt
.connector_token_details
.as_ref()
.and_then(|detail| detail.get_connector_token_request_reference_id());
// TODO: evaluate the fields in router data, if they are required or not
let router_data = types::RouterData {
flow: PhantomData,
merchant_id: merchant_context.get_merchant_account().get_id().clone(),
tenant_id: state.tenant.tenant_id.clone(),
// TODO: evaluate why we need customer id at the connector level. We already have connector customer id.
customer_id,
connector: connector_id.to_owned(),
// TODO: evaluate why we need payment id at the connector level. We already have connector reference id
payment_id: payment_data
.payment_attempt
.payment_id
.get_string_repr()
.to_owned(),
// TODO: evaluate why we need attempt id at the connector level. We already have connector reference id
attempt_id: payment_data
.payment_attempt
.get_id()
.get_string_repr()
.to_owned(),
status: payment_data.payment_attempt.status,
payment_method,
connector_auth_type: auth_type,
description: payment_data
.payment_intent
.description
.as_ref()
.map(|description| description.get_string_repr())
.map(ToOwned::to_owned),
// TODO: Create unified address
address: payment_data.payment_address.clone(),
auth_type: payment_data.payment_attempt.authentication_type,
connector_meta_data: None,
connector_wallets_details: None,
request,
response: Err(hyperswitch_domain_models::router_data::ErrorResponse::default()),
amount_captured: None,
minor_amount_captured: None,
access_token: None,
session_token: None,
reference_id: None,
payment_method_status: None,
payment_method_token: None,
connector_customer: connector_customer_id,
recurring_mandate_payment_data: None,
// TODO: This has to be generated as the reference id based on the connector configuration
// Some connectros might not accept accept the global id. This has to be done when generating the reference id
connector_request_reference_id,
preprocessing_id: payment_data.payment_attempt.preprocessing_step_id,
#[cfg(feature = "payouts")]
payout_method_data: None,
#[cfg(feature = "payouts")]
quote_id: None,
// TODO: take this based on the env
test_mode: Some(true),
payment_method_balance: None,
connector_api_version: None,
connector_http_status_code: None,
external_latency: None,
apple_pay_flow: None,
frm_metadata: None,
refund_id: None,
dispute_id: None,
connector_response: None,
integrity_check: Ok(()),
additional_merchant_data: None,
header_payload,
connector_mandate_request_reference_id,
authentication_id: None,
psd2_sca_exemption_type: None,
raw_connector_response: None,
is_payment_id_from_merchant: None,
l2_l3_data: None,
minor_amount_capturable: None,
};
Ok(router_data)
}
#[cfg(feature = "v1")]
#[instrument(skip_all)]
#[allow(clippy::too_many_arguments)]
pub async fn construct_payment_router_data<'a, F, T>(
state: &'a SessionState,
payment_data: PaymentData<F>,
connector_id: &str,
merchant_context: &domain::MerchantContext,
customer: &'a Option<domain::Customer>,
merchant_connector_account: &helpers::MerchantConnectorAccountType,
merchant_recipient_data: Option<types::MerchantRecipientData>,
header_payload: Option<hyperswitch_domain_models::payments::HeaderPayload>,
) -> RouterResult<types::RouterData<F, T, types::PaymentsResponseData>>
where
T: TryFrom<PaymentAdditionalData<'a, F>>,
types::RouterData<F, T, types::PaymentsResponseData>: Feature<F, T>,
F: Clone,
error_stack::Report<errors::ApiErrorResponse>:
From<<T as TryFrom<PaymentAdditionalData<'a, F>>>::Error>,
{
let (payment_method, router_data);
fp_utils::when(merchant_connector_account.is_disabled(), || {
Err(errors::ApiErrorResponse::MerchantConnectorAccountDisabled)
})?;
let test_mode = merchant_connector_account.is_test_mode_on();
let auth_type: types::ConnectorAuthType = merchant_connector_account
.get_connector_account_details()
.parse_value("ConnectorAuthType")
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Failed while parsing value for ConnectorAuthType")?;
payment_method = payment_data
.payment_attempt
.payment_method
.or(payment_data.payment_attempt.payment_method)
.get_required_value("payment_method_type")?;
let resource_id = match payment_data
.payment_attempt
.get_connector_payment_id()
.map(ToString::to_string)
{
Some(id) => types::ResponseId::ConnectorTransactionId(id),
None => types::ResponseId::NoResponseId,
};
// [#44]: why should response be filled during request
let response = Ok(types::PaymentsResponseData::TransactionResponse {
resource_id,
redirection_data: Box::new(None),
mandate_reference: Box::new(None),
connector_metadata: None,
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
charges: None,
});
let additional_data = PaymentAdditionalData {
router_base_url: state.base_url.clone(),
connector_name: connector_id.to_string(),
payment_data: payment_data.clone(),
state,
customer_data: customer,
};
let customer_id = customer.to_owned().map(|customer| customer.customer_id);
let supported_connector = &state
.conf
.multiple_api_version_supported_connectors
.supported_connectors;
let connector_enum = api_models::enums::Connector::from_str(connector_id)
.change_context(errors::ConnectorError::InvalidConnectorName)
.change_context(errors::ApiErrorResponse::InvalidDataValue {
field_name: "connector",
})
.attach_printable_lazy(|| format!("unable to parse connector name {connector_id:?}"))?;
let connector_api_version = if supported_connector.contains(&connector_enum) {
state
.store
.find_config_by_key(&format!("connector_api_version_{connector_id}"))
.await
.map(|value| value.config)
.ok()
} else {
None
};
let apple_pay_flow = payments::decide_apple_pay_flow(
state,
payment_data.payment_attempt.payment_method_type,
Some(merchant_connector_account),
);
let unified_address = if let Some(payment_method_info) =
payment_data.payment_method_info.clone()
{
let payment_method_billing = payment_method_info
.payment_method_billing_address
.map(|decrypted_data| decrypted_data.into_inner().expose())
.map(|decrypted_value| decrypted_value.parse_value("payment_method_billing_address"))
.transpose()
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("unable to parse payment_method_billing_address")?;
payment_data
.address
.clone()
.unify_with_payment_data_billing(payment_method_billing)
} else {
payment_data.address
};
let connector_mandate_request_reference_id = payment_data
.payment_attempt
.connector_mandate_detail
.as_ref()
.and_then(|detail| detail.get_connector_mandate_request_reference_id());
let order_details = payment_data
.payment_intent
.order_details
.as_ref()
.map(|order_details| {
order_details
.iter()
.map(|data| {
data.to_owned()
.parse_value("OrderDetailsWithAmount")
.change_context(errors::ApiErrorResponse::InvalidDataValue {
field_name: "OrderDetailsWithAmount",
})
.attach_printable("Unable to parse OrderDetailsWithAmount")
})
.collect::<Result<Vec<_>, _>>()
})
.transpose()?;
let l2_l3_data = state.conf.l2_l3_data_config.enabled.then(|| {
let shipping_address = unified_address.get_shipping();
let billing_address = unified_address.get_payment_billing();
let merchant_tax_registration_id = merchant_context
.get_merchant_account()
.get_merchant_tax_registration_id();
types::L2L3Data {
order_date: payment_data.payment_intent.order_date,
tax_status: payment_data.payment_intent.tax_status,
customer_tax_registration_id: customer.as_ref().and_then(|c| {
c.tax_registration_id
.as_ref()
.map(|e| e.clone().into_inner())
}),
order_details: order_details.clone(),
discount_amount: payment_data.payment_intent.discount_amount,
shipping_cost: payment_data.payment_intent.shipping_cost,
shipping_amount_tax: payment_data.payment_intent.shipping_amount_tax,
duty_amount: payment_data.payment_intent.duty_amount,
order_tax_amount: payment_data
.payment_attempt
.net_amount
.get_order_tax_amount(),
merchant_order_reference_id: payment_data
.payment_intent
.merchant_order_reference_id
.clone(),
customer_id: payment_data.payment_intent.customer_id.clone(),
shipping_origin_zip: shipping_address
.and_then(|addr| addr.address.as_ref())
.and_then(|details| details.origin_zip.clone()),
shipping_state: shipping_address
.as_ref()
.and_then(|addr| addr.address.as_ref())
.and_then(|details| details.state.clone()),
shipping_country: shipping_address
.as_ref()
.and_then(|addr| addr.address.as_ref())
.and_then(|details| details.country),
shipping_destination_zip: shipping_address
.as_ref()
.and_then(|addr| addr.address.as_ref())
.and_then(|details| details.zip.clone()),
billing_address_city: billing_address
.as_ref()
.and_then(|addr| addr.address.as_ref())
.and_then(|details| details.city.clone()),
merchant_tax_registration_id,
}
});
crate::logger::debug!("unified address details {:?}", unified_address);
router_data = types::RouterData {
flow: PhantomData,
merchant_id: merchant_context.get_merchant_account().get_id().clone(),
customer_id,
tenant_id: state.tenant.tenant_id.clone(),
connector: connector_id.to_owned(),
payment_id: payment_data
.payment_attempt
.payment_id
.get_string_repr()
.to_owned(),
attempt_id: payment_data.payment_attempt.attempt_id.clone(),
status: payment_data.payment_attempt.status,
payment_method,
connector_auth_type: auth_type,
description: payment_data.payment_intent.description.clone(),
address: unified_address,
auth_type: payment_data
.payment_attempt
.authentication_type
.unwrap_or_default(),
connector_meta_data: merchant_connector_account.get_metadata(),
connector_wallets_details: merchant_connector_account.get_connector_wallets_details(),
request: T::try_from(additional_data)?,
response,
amount_captured: payment_data
.payment_intent
.amount_captured
.map(|amt| amt.get_amount_as_i64()),
minor_amount_captured: payment_data.payment_intent.amount_captured,
access_token: None,
session_token: None,
reference_id: None,
payment_method_status: payment_data.payment_method_info.map(|info| info.status),
payment_method_token: payment_data
.pm_token
.map(|token| types::PaymentMethodToken::Token(Secret::new(token))),
connector_customer: payment_data.connector_customer_id,
recurring_mandate_payment_data: payment_data.recurring_mandate_payment_data,
connector_request_reference_id: core_utils::get_connector_request_reference_id(
&state.conf,
merchant_context.get_merchant_account().get_id(),
&payment_data.payment_intent,
&payment_data.payment_attempt,
connector_id,
)?,
preprocessing_id: payment_data.payment_attempt.preprocessing_step_id,
#[cfg(feature = "payouts")]
payout_method_data: None,
#[cfg(feature = "payouts")]
quote_id: None,
test_mode,
payment_method_balance: None,
connector_api_version,
connector_http_status_code: None,
external_latency: None,
apple_pay_flow,
frm_metadata: None,
refund_id: None,
dispute_id: None,
connector_response: None,
integrity_check: Ok(()),
additional_merchant_data: merchant_recipient_data.map(|data| {
api_models::admin::AdditionalMerchantData::foreign_from(
types::AdditionalMerchantData::OpenBankingRecipientData(data),
)
}),
header_payload,
connector_mandate_request_reference_id,
authentication_id: None,
psd2_sca_exemption_type: payment_data.payment_intent.psd2_sca_exemption_type,
raw_connector_response: None,
is_payment_id_from_merchant: payment_data.payment_intent.is_payment_id_from_merchant,
l2_l3_data,
minor_amount_capturable: None,
};
Ok(router_data)
}
#[cfg(feature = "v1")]
#[instrument(skip_all)]
#[allow(clippy::too_many_arguments)]
pub async fn construct_payment_router_data_for_update_metadata<'a>(
state: &'a SessionState,
payment_data: PaymentData<api::UpdateMetadata>,
connector_id: &str,
merchant_context: &domain::MerchantContext,
customer: &'a Option<domain::Customer>,
merchant_connector_account: &helpers::MerchantConnectorAccountType,
merchant_recipient_data: Option<types::MerchantRecipientData>,
header_payload: Option<hyperswitch_domain_models::payments::HeaderPayload>,
) -> RouterResult<
types::RouterData<
api::UpdateMetadata,
types::PaymentsUpdateMetadataData,
types::PaymentsResponseData,
>,
> {
let (payment_method, router_data);
fp_utils::when(merchant_connector_account.is_disabled(), || {
Err(errors::ApiErrorResponse::MerchantConnectorAccountDisabled)
})?;
let test_mode = merchant_connector_account.is_test_mode_on();
let auth_type: types::ConnectorAuthType = merchant_connector_account
.get_connector_account_details()
.parse_value("ConnectorAuthType")
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Failed while parsing value for ConnectorAuthType")?;
payment_method = payment_data
.payment_attempt
.payment_method
.or(payment_data.payment_attempt.payment_method)
.get_required_value("payment_method_type")?;
// [#44]: why should response be filled during request
let response = Err(hyperswitch_domain_models::router_data::ErrorResponse {
code: "IR_20".to_string(),
message: "Update metadata is not implemented for this connector".to_string(),
reason: None,
status_code: http::StatusCode::BAD_REQUEST.as_u16(),
attempt_status: None,
connector_transaction_id: None,
network_decline_code: None,
network_advice_code: None,
network_error_message: None,
connector_metadata: None,
});
let additional_data = PaymentAdditionalData {
router_base_url: state.base_url.clone(),
connector_name: connector_id.to_string(),
payment_data: payment_data.clone(),
state,
customer_data: customer,
};
let customer_id = customer.to_owned().map(|customer| customer.customer_id);
let supported_connector = &state
.conf
.multiple_api_version_supported_connectors
.supported_connectors;
let connector_enum = api_models::enums::Connector::from_str(connector_id)
.change_context(errors::ConnectorError::InvalidConnectorName)
.change_context(errors::ApiErrorResponse::InvalidDataValue {
field_name: "connector",
})
.attach_printable_lazy(|| format!("unable to parse connector name {connector_id:?}"))?;
let connector_api_version = if supported_connector.contains(&connector_enum) {
state
.store
.find_config_by_key(&format!("connector_api_version_{connector_id}"))
.await
.map(|value| value.config)
.ok()
} else {
None
};
let apple_pay_flow = payments::decide_apple_pay_flow(
state,
payment_data.payment_attempt.payment_method_type,
Some(merchant_connector_account),
);
let unified_address = if let Some(payment_method_info) =
payment_data.payment_method_info.clone()
{
let payment_method_billing = payment_method_info
.payment_method_billing_address
.map(|decrypted_data| decrypted_data.into_inner().expose())
.map(|decrypted_value| decrypted_value.parse_value("payment_method_billing_address"))
.transpose()
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("unable to parse payment_method_billing_address")?;
payment_data
.address
.clone()
.unify_with_payment_data_billing(payment_method_billing)
} else {
payment_data.address
};
let connector_mandate_request_reference_id = payment_data
.payment_attempt
.connector_mandate_detail
.as_ref()
.and_then(|detail| detail.get_connector_mandate_request_reference_id());
crate::logger::debug!("unified address details {:?}", unified_address);
router_data = types::RouterData {
flow: PhantomData,
merchant_id: merchant_context.get_merchant_account().get_id().clone(),
customer_id,
tenant_id: state.tenant.tenant_id.clone(),
connector: connector_id.to_owned(),
payment_id: payment_data
.payment_attempt
.payment_id
.get_string_repr()
.to_owned(),
attempt_id: payment_data.payment_attempt.attempt_id.clone(),
status: payment_data.payment_attempt.status,
payment_method,
connector_auth_type: auth_type,
description: payment_data.payment_intent.description.clone(),
address: unified_address,
auth_type: payment_data
.payment_attempt
.authentication_type
.unwrap_or_default(),
|
crates/router/src/core/payments/transformers.rs#chunk1
|
router
|
chunk
| null | null | null | 8,186
| null | null | null | null | null | null | null |
// Implementation: impl ConnectorSpecifications for for ConnectorEnum
// File: crates/hyperswitch_interfaces/src/connector_integration_interface.rs
// Module: hyperswitch_interfaces
// Methods: 7 total (0 public)
impl ConnectorSpecifications for for ConnectorEnum
|
crates/hyperswitch_interfaces/src/connector_integration_interface.rs
|
hyperswitch_interfaces
|
impl_block
| null | null | null | 51
| null |
ConnectorEnum
|
ConnectorSpecifications for
| 7
| 0
| null | null |
// Struct: ResponseData
// File: crates/hyperswitch_connectors/src/connectors/rapyd/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct ResponseData
|
crates/hyperswitch_connectors/src/connectors/rapyd/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
ResponseData
| 0
|
[] | 46
| null | null | null | null | null | null | null |
// Implementation: impl api::MandateSetup for for Opayo
// File: crates/hyperswitch_connectors/src/connectors/opayo.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::MandateSetup for for Opayo
|
crates/hyperswitch_connectors/src/connectors/opayo.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 61
| null |
Opayo
|
api::MandateSetup for
| 0
| 0
| null | null |
// Function: call_create_connector_customer_if_required
// File: crates/router/src/core/payments.rs
// Module: router
pub fn call_create_connector_customer_if_required<F, Req, D>(
state: &SessionState,
customer: &Option<domain::Customer>,
merchant_context: &domain::MerchantContext,
merchant_connector_account: &domain::MerchantConnectorAccountTypeDetails,
payment_data: &mut D,
) -> RouterResult<Option<storage::CustomerUpdate>>
where
F: Send + Clone + Sync,
Req: Send + Sync,
// To create connector flow specific interface data
D: OperationSessionGetters<F> + OperationSessionSetters<F> + Send + Sync + Clone,
D: ConstructFlowSpecificData<F, Req, router_types::PaymentsResponseData>,
RouterData<F, Req, router_types::PaymentsResponseData>: Feature<F, Req> + Send,
// To construct connector flow specific api
dyn api::Connector:
services::api::ConnectorIntegration<F, Req, router_types::PaymentsResponseData>,
|
crates/router/src/core/payments.rs
|
router
|
function_signature
| null | null | null | 224
|
call_create_connector_customer_if_required
| null | null | null | null | null | null |
// Struct: PayPalActionUrlResponse
// File: crates/api_models/src/connector_onboarding.rs
// Module: api_models
// Implementations: 0
pub struct PayPalActionUrlResponse
|
crates/api_models/src/connector_onboarding.rs
|
api_models
|
struct_definition
|
PayPalActionUrlResponse
| 0
|
[] | 40
| null | null | null | null | null | null | null |
// Struct: Amount
// File: crates/hyperswitch_connectors/src/connectors/trustpay/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct Amount
|
crates/hyperswitch_connectors/src/connectors/trustpay/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
Amount
| 0
|
[] | 44
| null | null | null | null | null | null | null |
// Struct: NmiWebhookEventBody
// File: crates/hyperswitch_connectors/src/connectors/nmi/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct NmiWebhookEventBody
|
crates/hyperswitch_connectors/src/connectors/nmi/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
NmiWebhookEventBody
| 0
|
[] | 53
| 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.