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
// Function: insert_recovery_code_in_redis // File: crates/router/src/utils/user/two_factor_auth.rs // Module: router pub fn insert_recovery_code_in_redis(state: &SessionState, user_id: &str) -> UserResult<()>
crates/router/src/utils/user/two_factor_auth.rs
router
function_signature
null
null
null
51
insert_recovery_code_in_redis
null
null
null
null
null
null
// Implementation: impl DecisionEngineApiHandler for for SRApiClient // File: crates/router/src/core/payments/routing/utils.rs // Module: router // Methods: 1 total (0 public) impl DecisionEngineApiHandler for for SRApiClient
crates/router/src/core/payments/routing/utils.rs
router
impl_block
null
null
null
55
null
SRApiClient
DecisionEngineApiHandler for
1
0
null
null
// Implementation: impl api::PaymentSync for for Cashtocode // File: crates/hyperswitch_connectors/src/connectors/cashtocode.rs // Module: hyperswitch_connectors // Methods: 0 total (0 public) impl api::PaymentSync for for Cashtocode
crates/hyperswitch_connectors/src/connectors/cashtocode.rs
hyperswitch_connectors
impl_block
null
null
null
61
null
Cashtocode
api::PaymentSync for
0
0
null
null
// Function: validate_and_create_refund // File: crates/router/src/core/refunds_v2.rs // Module: router pub fn validate_and_create_refund( state: &SessionState, merchant_context: &domain::MerchantContext, payment_attempt: &storage::PaymentAttempt, payment_intent: &storage::PaymentIntent, refund_amount: common_utils_types::MinorUnit, req: refunds::RefundsCreateRequest, global_refund_id: id_type::GlobalRefundId, merchant_connector_details: Option<common_types::domain::MerchantConnectorAuthDetails>, ) -> errors::RouterResult<refunds::RefundResponse>
crates/router/src/core/refunds_v2.rs
router
function_signature
null
null
null
138
validate_and_create_refund
null
null
null
null
null
null
// Struct: IatapayRouterData // File: crates/hyperswitch_connectors/src/connectors/iatapay/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct IatapayRouterData<T>
crates/hyperswitch_connectors/src/connectors/iatapay/transformers.rs
hyperswitch_connectors
struct_definition
IatapayRouterData
0
[]
57
null
null
null
null
null
null
null
// Function: connector_selection // File: crates/router/src/core/payments.rs // Module: router pub fn connector_selection<F, D>( state: &SessionState, merchant_context: &domain::MerchantContext, business_profile: &domain::Profile, payment_data: &mut D, request_straight_through: Option<serde_json::Value>, eligible_connectors: Option<Vec<enums::RoutableConnectors>>, mandate_type: Option<api::MandateTransactionType>, ) -> RouterResult<ConnectorCallType> where F: Send + Clone, D: OperationSessionGetters<F> + OperationSessionSetters<F> + Send + Sync + Clone,
crates/router/src/core/payments.rs
router
function_signature
null
null
null
148
connector_selection
null
null
null
null
null
null
// Implementation: impl FeatureMatrix // File: crates/router/src/routes/app.rs // Module: router // Methods: 1 total (1 public) impl FeatureMatrix
crates/router/src/routes/app.rs
router
impl_block
null
null
null
35
null
FeatureMatrix
null
1
1
null
null
// Struct: DummyConnectorAuthType // File: crates/hyperswitch_connectors/src/connectors/dummyconnector/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct DummyConnectorAuthType
crates/hyperswitch_connectors/src/connectors/dummyconnector/transformers.rs
hyperswitch_connectors
struct_definition
DummyConnectorAuthType
0
[]
50
null
null
null
null
null
null
null
// Implementation: impl Responder // File: crates/router/src/routes/routing.rs // Module: router // Methods: 0 total (0 public) impl Responder
crates/router/src/routes/routing.rs
router
impl_block
null
null
null
36
null
Responder
null
0
0
null
null
// File: crates/api_models/src/verify_connector.rs // Module: api_models // Public structs: 1 use common_utils::events::{ApiEventMetric, ApiEventsType}; use crate::{admin, enums}; #[derive(Clone, Debug, serde::Deserialize, serde::Serialize)] pub struct VerifyConnectorRequest { pub connector_name: enums::Connector, pub connector_account_details: admin::ConnectorAuthType, } common_utils::impl_api_event_type!(Miscellaneous, (VerifyConnectorRequest));
crates/api_models/src/verify_connector.rs
api_models
full_file
null
null
null
104
null
null
null
null
null
null
null
// Function: get_total_surcharge_amount // File: crates/hyperswitch_domain_models/src/router_request_types.rs // Module: hyperswitch_domain_models pub fn get_total_surcharge_amount(&self) -> MinorUnit
crates/hyperswitch_domain_models/src/router_request_types.rs
hyperswitch_domain_models
function_signature
null
null
null
46
get_total_surcharge_amount
null
null
null
null
null
null
// Implementation: impl api::PaymentSession for for Worldpayxml // File: crates/hyperswitch_connectors/src/connectors/worldpayxml.rs // Module: hyperswitch_connectors // Methods: 0 total (0 public) impl api::PaymentSession for for Worldpayxml
crates/hyperswitch_connectors/src/connectors/worldpayxml.rs
hyperswitch_connectors
impl_block
null
null
null
60
null
Worldpayxml
api::PaymentSession for
0
0
null
null
// Struct: ConnectorFields // File: crates/payment_methods/src/configs/settings.rs // Module: payment_methods // Implementations: 0 pub struct ConnectorFields
crates/payment_methods/src/configs/settings.rs
payment_methods
struct_definition
ConnectorFields
0
[]
35
null
null
null
null
null
null
null
// Struct: CommonMandateReference // File: crates/api_models/src/payment_methods.rs // Module: api_models // Implementations: 0 pub struct CommonMandateReference
crates/api_models/src/payment_methods.rs
api_models
struct_definition
CommonMandateReference
0
[]
40
null
null
null
null
null
null
null
// Implementation: impl ConnectorSpecifications for for Aci // File: crates/hyperswitch_connectors/src/connectors/aci.rs // Module: hyperswitch_connectors // Methods: 3 total (0 public) impl ConnectorSpecifications for for Aci
crates/hyperswitch_connectors/src/connectors/aci.rs
hyperswitch_connectors
impl_block
null
null
null
53
null
Aci
ConnectorSpecifications for
3
0
null
null
// Function: create_org_merchant_for_user // File: crates/router/src/core/user.rs // Module: router pub fn create_org_merchant_for_user( state: SessionState, req: user_api::UserOrgMerchantCreateRequest, ) -> UserResponse<()>
crates/router/src/core/user.rs
router
function_signature
null
null
null
57
create_org_merchant_for_user
null
null
null
null
null
null
// Implementation: impl api::PaymentAuthorize for for Elavon // File: crates/hyperswitch_connectors/src/connectors/elavon.rs // Module: hyperswitch_connectors // Methods: 0 total (0 public) impl api::PaymentAuthorize for for Elavon
crates/hyperswitch_connectors/src/connectors/elavon.rs
hyperswitch_connectors
impl_block
null
null
null
60
null
Elavon
api::PaymentAuthorize for
0
0
null
null
// File: crates/router/src/core/payments/operations/payment_response.rs // Module: router // Public structs: 2 use std::{collections::HashMap, ops::Deref}; use api_models::payments::{ConnectorMandateReferenceId, MandateReferenceId}; #[cfg(feature = "dynamic_routing")] use api_models::routing::RoutableConnectorChoice; use async_trait::async_trait; use common_enums::AuthorizationStatus; #[cfg(all(feature = "v1", feature = "dynamic_routing"))] use common_utils::ext_traits::ValueExt; use common_utils::{ ext_traits::{AsyncExt, Encode}, types::{keymanager::KeyManagerState, ConnectorTransactionId, MinorUnit}, }; use error_stack::{report, ResultExt}; use futures::FutureExt; use hyperswitch_domain_models::payments::payment_attempt::PaymentAttempt; #[cfg(feature = "v2")] use hyperswitch_domain_models::payments::{ PaymentConfirmData, PaymentIntentData, PaymentStatusData, }; use router_derive; use router_env::{instrument, logger, tracing}; use storage_impl::DataModelExt; use tracing_futures::Instrument; use super::{Operation, OperationSessionSetters, PostUpdateTracker}; #[cfg(all(feature = "v1", feature = "dynamic_routing"))] use crate::core::routing::helpers as routing_helpers; #[cfg(feature = "v2")] use crate::utils::OptionExt; use crate::{ connector::utils::PaymentResponseRouterData, consts, core::{ card_testing_guard::utils as card_testing_guard_utils, errors::{self, CustomResult, RouterResult, StorageErrorExt}, mandate, payment_methods::{self, cards::create_encrypted_data}, payments::{ helpers::{ self as payments_helpers, update_additional_payment_data_with_connector_response_pm_data, }, tokenization, types::MultipleCaptureData, PaymentData, PaymentMethodChecker, }, utils as core_utils, }, routes::{metrics, SessionState}, types::{ self, domain, storage::{self, enums}, transformers::{ForeignFrom, ForeignTryFrom}, CaptureSyncResponse, ErrorResponse, }, utils, }; #[cfg(feature = "v1")] #[derive(Debug, Clone, Copy, router_derive::PaymentOperation)] #[operation( operations = "post_update_tracker", flow = "sync_data, cancel_data, authorize_data, capture_data, complete_authorize_data, approve_data, reject_data, setup_mandate_data, session_data,incremental_authorization_data, sdk_session_update_data, post_session_tokens_data, update_metadata_data, cancel_post_capture_data" )] pub struct PaymentResponse; #[cfg(feature = "v2")] #[derive(Debug, Clone, Copy)] pub struct PaymentResponse; #[cfg(feature = "v1")] #[async_trait] impl<F: Send + Clone> PostUpdateTracker<F, PaymentData<F>, types::PaymentsAuthorizeData> for PaymentResponse { async fn update_tracker<'b>( &'b self, db: &'b SessionState, mut payment_data: PaymentData<F>, router_data: types::RouterData< F, types::PaymentsAuthorizeData, types::PaymentsResponseData, >, key_store: &domain::MerchantKeyStore, storage_scheme: enums::MerchantStorageScheme, locale: &Option<String>, #[cfg(all(feature = "v1", feature = "dynamic_routing"))] routable_connector: Vec< RoutableConnectorChoice, >, #[cfg(all(feature = "v1", feature = "dynamic_routing"))] business_profile: &domain::Profile, ) -> RouterResult<PaymentData<F>> where F: 'b, { payment_data.mandate_id = payment_data .mandate_id .or_else(|| router_data.request.mandate_id.clone()); // update setup_future_usage incase it is downgraded to on-session payment_data.payment_attempt.setup_future_usage_applied = router_data.request.setup_future_usage; payment_data = Box::pin(payment_response_update_tracker( db, payment_data, router_data, key_store, storage_scheme, locale, #[cfg(all(feature = "v1", feature = "dynamic_routing"))] routable_connector, #[cfg(all(feature = "v1", feature = "dynamic_routing"))] business_profile, )) .await?; Ok(payment_data) } #[cfg(feature = "v2")] async fn save_pm_and_mandate<'b>( &self, state: &SessionState, resp: &types::RouterData<F, types::PaymentsAuthorizeData, types::PaymentsResponseData>, merchant_context: &domain::MerchantContext, payment_data: &mut PaymentData<F>, business_profile: &domain::Profile, ) -> CustomResult<(), errors::ApiErrorResponse> where F: 'b + Clone + Send + Sync, { todo!() } #[cfg(feature = "v1")] async fn save_pm_and_mandate<'b>( &self, state: &SessionState, resp: &types::RouterData<F, types::PaymentsAuthorizeData, types::PaymentsResponseData>, merchant_context: &domain::MerchantContext, payment_data: &mut PaymentData<F>, business_profile: &domain::Profile, ) -> CustomResult<(), errors::ApiErrorResponse> where F: 'b + Clone + Send + Sync, { let customer_id = payment_data.payment_intent.customer_id.clone(); let save_payment_data = tokenization::SavePaymentMethodData::from(resp); let payment_method_billing_address = payment_data.address.get_payment_method_billing(); let connector_name = payment_data .payment_attempt .connector .clone() .ok_or_else(|| { logger::error!("Missing required Param connector_name"); errors::ApiErrorResponse::MissingRequiredField { field_name: "connector_name", } })?; let merchant_connector_id = payment_data.payment_attempt.merchant_connector_id.clone(); let billing_name = resp .address .get_payment_method_billing() .and_then(|billing_details| billing_details.address.as_ref()) .and_then(|address| address.get_optional_full_name()); let mut should_avoid_saving = false; let vault_operation = payment_data.vault_operation.clone(); let payment_method_info = payment_data.payment_method_info.clone(); if let Some(payment_method_info) = &payment_data.payment_method_info { if payment_data.payment_intent.off_session.is_none() && resp.response.is_ok() { should_avoid_saving = resp.request.payment_method_type == Some(enums::PaymentMethodType::ApplePay) || resp.request.payment_method_type == Some(enums::PaymentMethodType::GooglePay); payment_methods::cards::update_last_used_at( payment_method_info, state, merchant_context.get_merchant_account().storage_scheme, merchant_context.get_merchant_key_store(), ) .await .map_err(|e| { logger::error!("Failed to update last used at: {:?}", e); }) .ok(); } }; let connector_mandate_reference_id = payment_data .payment_attempt .connector_mandate_detail .as_ref() .map(|detail| ConnectorMandateReferenceId::foreign_from(detail.clone())); let save_payment_call_future = Box::pin(tokenization::save_payment_method( state, connector_name.clone(), save_payment_data, customer_id.clone(), merchant_context, resp.request.payment_method_type, billing_name.clone(), payment_method_billing_address, business_profile, connector_mandate_reference_id.clone(), merchant_connector_id.clone(), vault_operation.clone(), payment_method_info.clone(), )); let is_connector_mandate = resp.request.customer_acceptance.is_some() && matches!( resp.request.setup_future_usage, Some(enums::FutureUsage::OffSession) ); let is_legacy_mandate = resp.request.setup_mandate_details.is_some() && matches!( resp.request.setup_future_usage, Some(enums::FutureUsage::OffSession) ); let storage_scheme = merchant_context.get_merchant_account().storage_scheme; if is_legacy_mandate { // Mandate is created on the application side and at the connector. let tokenization::SavePaymentMethodDataResponse { payment_method_id, .. } = save_payment_call_future.await?; let mandate_id = mandate::mandate_procedure( state, resp, &customer_id.clone(), payment_method_id.clone(), merchant_connector_id.clone(), merchant_context.get_merchant_account().storage_scheme, payment_data.payment_intent.get_id(), ) .await?; payment_data.payment_attempt.payment_method_id = payment_method_id; payment_data.payment_attempt.mandate_id = mandate_id; Ok(()) } else if is_connector_mandate { // The mandate is created on connector's end. let tokenization::SavePaymentMethodDataResponse { payment_method_id, connector_mandate_reference_id, .. } = save_payment_call_future.await?; payment_data.payment_method_info = if let Some(payment_method_id) = &payment_method_id { match state .store .find_payment_method( &(state.into()), merchant_context.get_merchant_key_store(), payment_method_id, storage_scheme, ) .await { Ok(payment_method) => Some(payment_method), Err(error) => { if error.current_context().is_db_not_found() { logger::info!("Payment Method not found in db {:?}", error); None } else { Err(error) .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable("Error retrieving payment method from db") .map_err(|err| logger::error!(payment_method_retrieve=?err)) .ok() } } } } else { None }; payment_data.payment_attempt.payment_method_id = payment_method_id; payment_data.payment_attempt.connector_mandate_detail = connector_mandate_reference_id .clone() .map(ForeignFrom::foreign_from); payment_data.set_mandate_id(api_models::payments::MandateIds { mandate_id: None, mandate_reference_id: connector_mandate_reference_id.map(|connector_mandate_id| { MandateReferenceId::ConnectorMandateId(connector_mandate_id) }), }); Ok(()) } else if should_avoid_saving { if let Some(pm_info) = &payment_data.payment_method_info { payment_data.payment_attempt.payment_method_id = Some(pm_info.get_id().clone()); }; Ok(()) } else { // Save card flow let save_payment_data = tokenization::SavePaymentMethodData::from(resp); let state = state.clone(); let customer_id = payment_data.payment_intent.customer_id.clone(); let payment_attempt = payment_data.payment_attempt.clone(); let business_profile = business_profile.clone(); let payment_method_type = resp.request.payment_method_type; let payment_method_billing_address = payment_method_billing_address.cloned(); let cloned_merchant_context = merchant_context.clone(); logger::info!("Call to save_payment_method in locker"); let _task_handle = tokio::spawn( async move { logger::info!("Starting async call to save_payment_method in locker"); let result = Box::pin(tokenization::save_payment_method( &state, connector_name, save_payment_data, customer_id, &cloned_merchant_context, payment_method_type, billing_name, payment_method_billing_address.as_ref(), &business_profile, connector_mandate_reference_id, merchant_connector_id.clone(), vault_operation.clone(), payment_method_info.clone(), )) .await; if let Err(err) = result { logger::error!("Asynchronously saving card in locker failed : {:?}", err); } else if let Ok(tokenization::SavePaymentMethodDataResponse { payment_method_id, .. }) = result { let payment_attempt_update = storage::PaymentAttemptUpdate::PaymentMethodDetailsUpdate { payment_method_id, updated_by: storage_scheme.clone().to_string(), }; #[cfg(feature = "v1")] let respond = state .store .update_payment_attempt_with_attempt_id( payment_attempt, payment_attempt_update, storage_scheme, ) .await; #[cfg(feature = "v2")] let respond = state .store .update_payment_attempt_with_attempt_id( &(&state).into(), &key_store, payment_attempt, payment_attempt_update, storage_scheme, ) .await; if let Err(err) = respond { logger::error!("Error updating payment attempt: {:?}", err); }; } } .in_current_span(), ); Ok(()) } } } #[cfg(feature = "v1")] #[async_trait] impl<F: Clone> PostUpdateTracker<F, PaymentData<F>, types::PaymentsIncrementalAuthorizationData> for PaymentResponse { async fn update_tracker<'b>( &'b self, state: &'b SessionState, mut payment_data: PaymentData<F>, router_data: types::RouterData< F, types::PaymentsIncrementalAuthorizationData, types::PaymentsResponseData, >, key_store: &domain::MerchantKeyStore, storage_scheme: enums::MerchantStorageScheme, _locale: &Option<String>, #[cfg(all(feature = "v1", feature = "dynamic_routing"))] _routable_connector: Vec< RoutableConnectorChoice, >, #[cfg(all(feature = "v1", feature = "dynamic_routing"))] _business_profile: &domain::Profile, ) -> RouterResult<PaymentData<F>> where F: 'b + Send, { let incremental_authorization_details = payment_data .incremental_authorization_details .clone() .ok_or_else(|| { report!(errors::ApiErrorResponse::InternalServerError) .attach_printable("missing incremental_authorization_details in payment_data") })?; // Update payment_intent and payment_attempt 'amount' if incremental_authorization is successful let (option_payment_attempt_update, option_payment_intent_update) = match router_data .response .clone() { Err(_) => (None, None), Ok(types::PaymentsResponseData::IncrementalAuthorizationResponse { status, .. }) => { if status == AuthorizationStatus::Success { ( Some( storage::PaymentAttemptUpdate::IncrementalAuthorizationAmountUpdate { net_amount: hyperswitch_domain_models::payments::payment_attempt::NetAmount::new( // Internally, `NetAmount` is computed as (order_amount + additional_amount), so we subtract here to avoid double-counting. incremental_authorization_details.total_amount - payment_data.payment_attempt.net_amount.get_additional_amount(), None, None, None, None, ), amount_capturable: incremental_authorization_details.total_amount, }, ), Some( storage::PaymentIntentUpdate::IncrementalAuthorizationAmountUpdate { amount: incremental_authorization_details.total_amount - payment_data.payment_attempt.net_amount.get_additional_amount(), }, ), ) } else { (None, None) } } _ => Err(errors::ApiErrorResponse::InternalServerError) .attach_printable("unexpected response in incremental_authorization flow")?, }; //payment_attempt update if let Some(payment_attempt_update) = option_payment_attempt_update { #[cfg(feature = "v1")] { payment_data.payment_attempt = state .store .update_payment_attempt_with_attempt_id( payment_data.payment_attempt.clone(), payment_attempt_update, storage_scheme, ) .await .to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?; } #[cfg(feature = "v2")] { payment_data.payment_attempt = state .store .update_payment_attempt_with_attempt_id( &state.into(), key_store, payment_data.payment_attempt.clone(), payment_attempt_update, storage_scheme, ) .await .to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?; } } // payment_intent update if let Some(payment_intent_update) = option_payment_intent_update { payment_data.payment_intent = state .store .update_payment_intent( &state.into(), payment_data.payment_intent.clone(), payment_intent_update, key_store, storage_scheme, ) .await .to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?; } // Update the status of authorization record let authorization_update = match &router_data.response { Err(res) => Ok(storage::AuthorizationUpdate::StatusUpdate { status: AuthorizationStatus::Failure, error_code: Some(res.code.clone()), error_message: Some(res.message.clone()), connector_authorization_id: None, }), Ok(types::PaymentsResponseData::IncrementalAuthorizationResponse { status, error_code, error_message, connector_authorization_id, }) => Ok(storage::AuthorizationUpdate::StatusUpdate { status: status.clone(), error_code: error_code.clone(), error_message: error_message.clone(), connector_authorization_id: connector_authorization_id.clone(), }), Ok(_) => Err(errors::ApiErrorResponse::InternalServerError) .attach_printable("unexpected response in incremental_authorization flow"), }?; let authorization_id = incremental_authorization_details .authorization_id .clone() .ok_or( report!(errors::ApiErrorResponse::InternalServerError).attach_printable( "missing authorization_id in incremental_authorization_details in payment_data", ), )?; state .store .update_authorization_by_merchant_id_authorization_id( router_data.merchant_id.clone(), authorization_id, authorization_update, ) .await .to_not_found_response(errors::ApiErrorResponse::InternalServerError) .attach_printable("failed while updating authorization")?; //Fetch all the authorizations of the payment and send in incremental authorization response let authorizations = state .store .find_all_authorizations_by_merchant_id_payment_id( &router_data.merchant_id, payment_data.payment_intent.get_id(), ) .await .to_not_found_response(errors::ApiErrorResponse::InternalServerError) .attach_printable("failed while retrieving authorizations")?; payment_data.authorizations = authorizations; Ok(payment_data) } } #[cfg(feature = "v1")] #[async_trait] impl<F: Clone> PostUpdateTracker<F, PaymentData<F>, types::PaymentsSyncData> for PaymentResponse { async fn update_tracker<'b>( &'b self, db: &'b SessionState, payment_data: PaymentData<F>, router_data: types::RouterData<F, types::PaymentsSyncData, types::PaymentsResponseData>, key_store: &domain::MerchantKeyStore, storage_scheme: enums::MerchantStorageScheme, locale: &Option<String>, #[cfg(all(feature = "v1", feature = "dynamic_routing"))] routable_connector: Vec< RoutableConnectorChoice, >, #[cfg(all(feature = "v1", feature = "dynamic_routing"))] business_profile: &domain::Profile, ) -> RouterResult<PaymentData<F>> where F: 'b + Send, { Box::pin(payment_response_update_tracker( db, payment_data, router_data, key_store, storage_scheme, locale, #[cfg(all(feature = "v1", feature = "dynamic_routing"))] routable_connector, #[cfg(all(feature = "v1", feature = "dynamic_routing"))] business_profile, )) .await } async fn save_pm_and_mandate<'b>( &self, state: &SessionState, resp: &types::RouterData<F, types::PaymentsSyncData, types::PaymentsResponseData>, merchant_context: &domain::MerchantContext, payment_data: &mut PaymentData<F>, _business_profile: &domain::Profile, ) -> CustomResult<(), errors::ApiErrorResponse> where F: 'b + Clone + Send + Sync, { let (connector_mandate_id, mandate_metadata, connector_mandate_request_reference_id) = resp .response .clone() .ok() .and_then(|resp| { if let types::PaymentsResponseData::TransactionResponse { mandate_reference, .. } = resp { mandate_reference.map(|mandate_ref| { ( mandate_ref.connector_mandate_id.clone(), mandate_ref.mandate_metadata.clone(), mandate_ref.connector_mandate_request_reference_id.clone(), ) }) } else { None } }) .unwrap_or((None, None, None)); update_connector_mandate_details_for_the_flow( connector_mandate_id, mandate_metadata, connector_mandate_request_reference_id, payment_data, )?; update_payment_method_status_and_ntid( state, merchant_context.get_merchant_key_store(), payment_data, resp.status, resp.response.clone(), merchant_context.get_merchant_account().storage_scheme, ) .await?; Ok(()) } } #[cfg(feature = "v1")] #[async_trait] impl<F: Clone> PostUpdateTracker<F, PaymentData<F>, types::PaymentsSessionData> for PaymentResponse { async fn update_tracker<'b>( &'b self, db: &'b SessionState, mut payment_data: PaymentData<F>, router_data: types::RouterData<F, types::PaymentsSessionData, types::PaymentsResponseData>, key_store: &domain::MerchantKeyStore, storage_scheme: enums::MerchantStorageScheme, locale: &Option<String>, #[cfg(all(feature = "v1", feature = "dynamic_routing"))] routable_connector: Vec< RoutableConnectorChoice, >, #[cfg(all(feature = "v1", feature = "dynamic_routing"))] business_profile: &domain::Profile, ) -> RouterResult<PaymentData<F>> where F: 'b + Send, { payment_data = Box::pin(payment_response_update_tracker( db, payment_data, router_data, key_store, storage_scheme, locale, #[cfg(all(feature = "v1", feature = "dynamic_routing"))] routable_connector, #[cfg(all(feature = "v1", feature = "dynamic_routing"))] business_profile, )) .await?; Ok(payment_data) } } #[cfg(feature = "v1")] #[async_trait] impl<F: Clone> PostUpdateTracker<F, PaymentData<F>, types::SdkPaymentsSessionUpdateData> for PaymentResponse { async fn update_tracker<'b>( &'b self, db: &'b SessionState, mut payment_data: PaymentData<F>, router_data: types::RouterData< F, types::SdkPaymentsSessionUpdateData, types::PaymentsResponseData, >, key_store: &domain::MerchantKeyStore, storage_scheme: enums::MerchantStorageScheme, _locale: &Option<String>, #[cfg(feature = "dynamic_routing")] _routable_connector: Vec<RoutableConnectorChoice>, #[cfg(feature = "dynamic_routing")] _business_profile: &domain::Profile, ) -> RouterResult<PaymentData<F>> where F: 'b + Send, { let connector = payment_data .payment_attempt .connector .clone() .ok_or(errors::ApiErrorResponse::InternalServerError) .attach_printable("connector not found")?; let key_manager_state = db.into(); // For PayPal, if we call TaxJar for tax calculation, we need to call the connector again to update the order amount so that we can confirm the updated amount and order details. Therefore, we will store the required changes in the database during the post_update_tracker call. if payment_data.should_update_in_post_update_tracker() { match router_data.response.clone() { Ok(types::PaymentsResponseData::PaymentResourceUpdateResponse { status }) => { if status.is_success() { let shipping_address = payment_data .tax_data .clone() .map(|tax_data| tax_data.shipping_details); let shipping_details = shipping_address .clone() .async_map(|shipping_details| { create_encrypted_data( &key_manager_state, key_store, shipping_details, ) }) .await .transpose() .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable("Unable to encrypt shipping details")?; let shipping_address = payments_helpers::create_or_update_address_for_payment_by_request( db, shipping_address.map(From::from).as_ref(), payment_data.payment_intent.shipping_address_id.as_deref(), &payment_data.payment_intent.merchant_id, payment_data.payment_intent.customer_id.as_ref(), key_store, &payment_data.payment_intent.payment_id, storage_scheme, ) .await?; let payment_intent_update = hyperswitch_domain_models::payments::payment_intent::PaymentIntentUpdate::SessionResponseUpdate { tax_details: payment_data.payment_intent.tax_details.clone().ok_or(errors::ApiErrorResponse::InternalServerError).attach_printable("payment_intent.tax_details not found")?, shipping_address_id: shipping_address.map(|address| address.address_id), updated_by: payment_data.payment_intent.updated_by.clone(), shipping_details, }; let m_db = db.clone().store; let payment_intent = payment_data.payment_intent.clone(); let key_manager_state: KeyManagerState = db.into(); let updated_payment_intent = m_db .update_payment_intent( &key_manager_state, payment_intent, payment_intent_update, key_store, storage_scheme, ) .await .to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?; payment_data.payment_intent = updated_payment_intent; } else { router_data.response.map_err(|err| { errors::ApiErrorResponse::ExternalConnectorError { code: err.code, message: err.message, connector, status_code: err.status_code, reason: err.reason, } })?; } } Err(err) => { Err(errors::ApiErrorResponse::ExternalConnectorError { code: err.code, message: err.message, connector, status_code: err.status_code, reason: err.reason, })?; } _ => { Err(errors::ApiErrorResponse::InternalServerError) .attach_printable("Unexpected response in session_update flow")?; } } } Ok(payment_data) } } #[cfg(feature = "v1")] #[async_trait] impl<F: Clone> PostUpdateTracker<F, PaymentData<F>, types::PaymentsPostSessionTokensData> for PaymentResponse { async fn update_tracker<'b>( &'b self, db: &'b SessionState, mut payment_data: PaymentData<F>, router_data: types::RouterData< F, types::PaymentsPostSessionTokensData, types::PaymentsResponseData, >, _key_store: &domain::MerchantKeyStore, storage_scheme: enums::MerchantStorageScheme, _locale: &Option<String>, #[cfg(all(feature = "v1", feature = "dynamic_routing"))] _routable_connector: Vec< RoutableConnectorChoice, >, #[cfg(all(feature = "v1", feature = "dynamic_routing"))] _business_profile: &domain::Profile, ) -> RouterResult<PaymentData<F>> where F: 'b + Send, { match router_data.response.clone() { Ok(types::PaymentsResponseData::TransactionResponse { connector_metadata, .. }) => { let m_db = db.clone().store; let payment_attempt_update = storage::PaymentAttemptUpdate::PostSessionTokensUpdate { updated_by: storage_scheme.clone().to_string(), connector_metadata, }; let updated_payment_attempt = m_db .update_payment_attempt_with_attempt_id( payment_data.payment_attempt.clone(), payment_attempt_update, storage_scheme, ) .await .to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?; payment_data.payment_attempt = updated_payment_attempt; } Err(err) => { logger::error!("Invalid request sent to connector: {:?}", err); Err(errors::ApiErrorResponse::InvalidRequestData { message: "Invalid request sent to connector".to_string(), })?; } _ => { Err(errors::ApiErrorResponse::InternalServerError) .attach_printable("Unexpected response in PostSessionTokens flow")?; } } Ok(payment_data) } } #[cfg(feature = "v1")] #[async_trait] impl<F: Clone> PostUpdateTracker<F, PaymentData<F>, types::PaymentsUpdateMetadataData> for PaymentResponse { async fn update_tracker<'b>( &'b self, db: &'b SessionState, mut payment_data: PaymentData<F>, router_data: types::RouterData< F, types::PaymentsUpdateMetadataData, types::PaymentsResponseData, >, key_store: &domain::MerchantKeyStore, storage_scheme: enums::MerchantStorageScheme, _locale: &Option<String>, #[cfg(all(feature = "v1", feature = "dynamic_routing"))] _routable_connector: Vec< RoutableConnectorChoice, >, #[cfg(all(feature = "v1", feature = "dynamic_routing"))] _business_profile: &domain::Profile, ) -> RouterResult<PaymentData<F>> where F: 'b + Send, { let connector = payment_data .payment_attempt .connector .clone() .ok_or(errors::ApiErrorResponse::InternalServerError) .attach_printable("connector not found in payment_attempt")?; match router_data.response.clone() { Ok(types::PaymentsResponseData::PaymentResourceUpdateResponse { status, .. }) => { if status.is_success() { let m_db = db.clone().store; let payment_intent = payment_data.payment_intent.clone(); let key_manager_state: KeyManagerState = db.into(); let payment_intent_update = hyperswitch_domain_models::payments::payment_intent::PaymentIntentUpdate::MetadataUpdate { metadata: payment_data .payment_intent .metadata .clone() .ok_or(errors::ApiErrorResponse::InternalServerError) .attach_printable("payment_intent.metadata not found")?, updated_by: payment_data.payment_intent.updated_by.clone(), }; let updated_payment_intent = m_db .update_payment_intent( &key_manager_state, payment_intent, payment_intent_update, key_store, storage_scheme, ) .await .to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?; payment_data.payment_intent = updated_payment_intent; } else { router_data.response.map_err(|err| { errors::ApiErrorResponse::ExternalConnectorError { code: err.code, message: err.message, connector, status_code: err.status_code, reason: err.reason, } })?; } } Err(err) => { Err(errors::ApiErrorResponse::ExternalConnectorError { code: err.code, message: err.message, connector, status_code: err.status_code, reason: err.reason, })?; } _ => { Err(errors::ApiErrorResponse::InternalServerError) .attach_printable("Unexpected response in Update Metadata flow")?; } } Ok(payment_data) } } #[cfg(feature = "v1")] #[async_trait] impl<F: Clone> PostUpdateTracker<F, PaymentData<F>, types::PaymentsCaptureData> for PaymentResponse { async fn update_tracker<'b>( &'b self, db: &'b SessionState, mut payment_data: PaymentData<F>, router_data: types::RouterData<F, types::PaymentsCaptureData, types::PaymentsResponseData>, key_store: &domain::MerchantKeyStore, storage_scheme: enums::MerchantStorageScheme, locale: &Option<String>, #[cfg(all(feature = "v1", feature = "dynamic_routing"))] routable_connector: Vec< RoutableConnectorChoice, >, #[cfg(all(feature = "v1", feature = "dynamic_routing"))] business_profile: &domain::Profile, ) -> RouterResult<PaymentData<F>> where F: 'b + Send, { payment_data = Box::pin(payment_response_update_tracker( db, payment_data, router_data, key_store, storage_scheme, locale, #[cfg(all(feature = "v1", feature = "dynamic_routing"))] routable_connector, #[cfg(all(feature = "v1", feature = "dynamic_routing"))] business_profile, )) .await?; Ok(payment_data) } } #[cfg(feature = "v1")] #[async_trait] impl<F: Clone> PostUpdateTracker<F, PaymentData<F>, types::PaymentsCancelData> for PaymentResponse { async fn update_tracker<'b>( &'b self, db: &'b SessionState, mut payment_data: PaymentData<F>, router_data: types::RouterData<F, types::PaymentsCancelData, types::PaymentsResponseData>, key_store: &domain::MerchantKeyStore, storage_scheme: enums::MerchantStorageScheme, locale: &Option<String>, #[cfg(all(feature = "v1", feature = "dynamic_routing"))] routable_connector: Vec< RoutableConnectorChoice, >, #[cfg(all(feature = "v1", feature = "dynamic_routing"))] business_profile: &domain::Profile, ) -> RouterResult<PaymentData<F>> where F: 'b + Send, { payment_data = Box::pin(payment_response_update_tracker( db, payment_data, router_data, key_store, storage_scheme, locale, #[cfg(all(feature = "v1", feature = "dynamic_routing"))] routable_connector, #[cfg(all(feature = "v1", feature = "dynamic_routing"))] business_profile, )) .await?; Ok(payment_data) } } #[cfg(feature = "v1")] #[async_trait] impl<F: Clone> PostUpdateTracker<F, PaymentData<F>, types::PaymentsCancelPostCaptureData> for PaymentResponse { async fn update_tracker<'b>( &'b self, db: &'b SessionState, mut payment_data: PaymentData<F>, router_data: types::RouterData< F, types::PaymentsCancelPostCaptureData, types::PaymentsResponseData, >, key_store: &domain::MerchantKeyStore, storage_scheme: enums::MerchantStorageScheme, locale: &Option<String>, #[cfg(all(feature = "v1", feature = "dynamic_routing"))] routable_connector: Vec< RoutableConnectorChoice, >, #[cfg(all(feature = "v1", feature = "dynamic_routing"))] business_profile: &domain::Profile, ) -> RouterResult<PaymentData<F>> where F: 'b + Send, { payment_data = Box::pin(payment_response_update_tracker( db, payment_data, router_data, key_store, storage_scheme, locale, #[cfg(all(feature = "v1", feature = "dynamic_routing"))] routable_connector, #[cfg(all(feature = "v1", feature = "dynamic_routing"))] business_profile, )) .await?; Ok(payment_data) } } #[cfg(feature = "v1")] #[async_trait] impl<F: Clone> PostUpdateTracker<F, PaymentData<F>, types::PaymentsApproveData> for PaymentResponse { async fn update_tracker<'b>( &'b self, db: &'b SessionState, mut payment_data: PaymentData<F>, router_data: types::RouterData<F, types::PaymentsApproveData, types::PaymentsResponseData>, key_store: &domain::MerchantKeyStore, storage_scheme: enums::MerchantStorageScheme, locale: &Option<String>, #[cfg(all(feature = "v1", feature = "dynamic_routing"))] routable_connector: Vec< RoutableConnectorChoice, >, #[cfg(all(feature = "v1", feature = "dynamic_routing"))] business_profile: &domain::Profile, ) -> RouterResult<PaymentData<F>> where F: 'b + Send, { payment_data = Box::pin(payment_response_update_tracker( db, payment_data, router_data, key_store, storage_scheme, locale, #[cfg(all(feature = "v1", feature = "dynamic_routing"))] routable_connector, #[cfg(all(feature = "v1", feature = "dynamic_routing"))] business_profile, )) .await?; Ok(payment_data) } } #[cfg(feature = "v1")] #[async_trait] impl<F: Clone> PostUpdateTracker<F, PaymentData<F>, types::PaymentsRejectData> for PaymentResponse { async fn update_tracker<'b>( &'b self, db: &'b SessionState, mut payment_data: PaymentData<F>, router_data: types::RouterData<F, types::PaymentsRejectData, types::PaymentsResponseData>, key_store: &domain::MerchantKeyStore, storage_scheme: enums::MerchantStorageScheme,
crates/router/src/core/payments/operations/payment_response.rs#chunk0
router
chunk
null
null
null
8,188
null
null
null
null
null
null
null
// Struct: SquarePaymentsResponseDetails // File: crates/hyperswitch_connectors/src/connectors/square/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct SquarePaymentsResponseDetails
crates/hyperswitch_connectors/src/connectors/square/transformers.rs
hyperswitch_connectors
struct_definition
SquarePaymentsResponseDetails
0
[]
49
null
null
null
null
null
null
null
// Function: get_data_from_hyperswitch_ai_workflow // File: crates/router/src/routes/chat.rs // Module: router pub fn get_data_from_hyperswitch_ai_workflow( state: web::Data<AppState>, http_req: HttpRequest, payload: web::Json<chat_api::ChatRequest>, ) -> HttpResponse
crates/router/src/routes/chat.rs
router
function_signature
null
null
null
71
get_data_from_hyperswitch_ai_workflow
null
null
null
null
null
null
// Function: update // File: crates/diesel_models/src/query/merchant_account.rs // Module: diesel_models pub fn update( self, conn: &PgPooledConn, merchant_account: MerchantAccountUpdateInternal, ) -> StorageResult<Self>
crates/diesel_models/src/query/merchant_account.rs
diesel_models
function_signature
null
null
null
57
update
null
null
null
null
null
null
// Implementation: impl api::PaymentToken for for Mollie // File: crates/hyperswitch_connectors/src/connectors/mollie.rs // Module: hyperswitch_connectors // Methods: 0 total (0 public) impl api::PaymentToken for for Mollie
crates/hyperswitch_connectors/src/connectors/mollie.rs
hyperswitch_connectors
impl_block
null
null
null
60
null
Mollie
api::PaymentToken for
0
0
null
null
// Struct: CustomerBankAccounts // File: crates/hyperswitch_connectors/src/connectors/gocardless/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct CustomerBankAccounts
crates/hyperswitch_connectors/src/connectors/gocardless/transformers.rs
hyperswitch_connectors
struct_definition
CustomerBankAccounts
0
[]
48
null
null
null
null
null
null
null
// Struct: PaymentsPreProcessingData // File: crates/hyperswitch_domain_models/src/router_request_types.rs // Module: hyperswitch_domain_models // Implementations: 0 pub struct PaymentsPreProcessingData
crates/hyperswitch_domain_models/src/router_request_types.rs
hyperswitch_domain_models
struct_definition
PaymentsPreProcessingData
0
[]
45
null
null
null
null
null
null
null
// Function: get_inner_value // File: crates/common_utils/src/request.rs // Module: common_utils pub fn get_inner_value(&self) -> Secret<String>
crates/common_utils/src/request.rs
common_utils
function_signature
null
null
null
35
get_inner_value
null
null
null
null
null
null
// Function: get_enable_payment_response_hash // File: crates/api_models/src/admin.rs // Module: api_models pub fn get_enable_payment_response_hash(&self) -> bool
crates/api_models/src/admin.rs
api_models
function_signature
null
null
null
37
get_enable_payment_response_hash
null
null
null
null
null
null
// File: crates/openapi/src/openapi.rs // Module: openapi use crate::routes; #[derive(utoipa::OpenApi)] #[openapi( info( title = "Hyperswitch - API Documentation", contact( name = "Hyperswitch Support", url = "https://hyperswitch.io", email = "hyperswitch@juspay.in" ), // terms_of_service = "https://www.juspay.io/terms", description = r#" ## Get started Hyperswitch provides a collection of APIs that enable you to process and manage payments. Our APIs accept and return JSON in the HTTP body, and return standard HTTP response codes. You can consume the APIs directly using your favorite HTTP/REST library. We have a testing environment referred to "sandbox", which you can setup to test API calls without affecting production data. Currently, our sandbox environment is live while our production environment is under development and will be available soon. You can sign up on our Dashboard to get API keys to access Hyperswitch API. ### Environment Use the following base URLs when making requests to the APIs: | Environment | Base URL | |---------------|------------------------------------| | Sandbox | <https://sandbox.hyperswitch.io> | | Production | <https://api.hyperswitch.io> | ## Authentication When you sign up on our [dashboard](https://app.hyperswitch.io) and create a merchant account, you are given a secret key (also referred as api-key) and a publishable key. You may authenticate all API requests with Hyperswitch server by providing the appropriate key in the request Authorization header. | Key | Description | |-----------------|-----------------------------------------------------------------------------------------------| | api-key | Private key. Used to authenticate all API requests from your merchant server | | publishable key | Unique identifier for your account. Used to authenticate API requests from your app's client | Never share your secret api keys. Keep them guarded and secure. "#, ), servers( (url = "https://sandbox.hyperswitch.io", description = "Sandbox Environment") ), tags( (name = "Merchant Account", description = "Create and manage merchant accounts"), (name = "Profile", description = "Create and manage profiles"), (name = "Merchant Connector Account", description = "Create and manage merchant connector accounts"), (name = "Payments", description = "Create and manage one-time payments, recurring payments and mandates"), (name = "Refunds", description = "Create and manage refunds for successful payments"), (name = "Mandates", description = "Manage mandates"), (name = "Customers", description = "Create and manage customers"), (name = "Payment Methods", description = "Create and manage payment methods of customers"), (name = "Disputes", description = "Manage disputes"), (name = "API Key", description = "Create and manage API Keys"), (name = "Payouts", description = "Create and manage payouts"), (name = "payment link", description = "Create payment link"), (name = "Routing", description = "Create and manage routing configurations"), (name = "Event", description = "Manage events"), (name = "Authentication", description = "Create and manage authentication") ), // The paths will be displayed in the same order as they are registered here paths( // Routes for payments routes::payments::payments_create, routes::payments::payments_update, routes::payments::payments_confirm, routes::payments::payments_retrieve, routes::payments::payments_capture, routes::payments::payments_connector_session, routes::payments::payments_cancel, routes::payments::payments_cancel_post_capture, routes::payments::payments_list, routes::payments::payments_incremental_authorization, routes::payment_link::payment_link_retrieve, routes::payments::payments_external_authentication, routes::payments::payments_complete_authorize, routes::payments::payments_post_session_tokens, routes::payments::payments_update_metadata, // Routes for relay routes::relay::relay, routes::relay::relay_retrieve, // Routes for refunds routes::refunds::refunds_create, routes::refunds::refunds_retrieve, routes::refunds::refunds_update, routes::refunds::refunds_list, // Routes for Organization routes::organization::organization_create, routes::organization::organization_retrieve, routes::organization::organization_update, // Routes for merchant account routes::merchant_account::merchant_account_create, routes::merchant_account::retrieve_merchant_account, routes::merchant_account::update_merchant_account, routes::merchant_account::delete_merchant_account, routes::merchant_account::merchant_account_kv_status, // Routes for merchant connector account routes::merchant_connector_account::connector_create, routes::merchant_connector_account::connector_retrieve, routes::merchant_connector_account::connector_list, routes::merchant_connector_account::connector_update, routes::merchant_connector_account::connector_delete, //Routes for gsm routes::gsm::create_gsm_rule, routes::gsm::get_gsm_rule, routes::gsm::update_gsm_rule, routes::gsm::delete_gsm_rule, // Routes for mandates routes::mandates::get_mandate, routes::mandates::revoke_mandate, routes::mandates::customers_mandates_list, //Routes for customers routes::customers::customers_create, routes::customers::customers_retrieve, routes::customers::customers_list, routes::customers::customers_update, routes::customers::customers_delete, //Routes for payment methods routes::payment_method::create_payment_method_api, routes::payment_method::list_payment_method_api, routes::payment_method::list_customer_payment_method_api, routes::payment_method::list_customer_payment_method_api_client, routes::payment_method::default_payment_method_set_api, routes::payment_method::payment_method_retrieve_api, routes::payment_method::payment_method_update_api, routes::payment_method::payment_method_delete_api, // Routes for Profile routes::profile::profile_create, routes::profile::profile_list, routes::profile::profile_retrieve, routes::profile::profile_update, routes::profile::profile_delete, // Routes for disputes routes::disputes::retrieve_dispute, routes::disputes::retrieve_disputes_list, // Routes for routing routes::routing::routing_create_config, routes::routing::routing_link_config, routes::routing::routing_retrieve_config, routes::routing::list_routing_configs, routes::routing::routing_unlink_config, routes::routing::routing_update_default_config, routes::routing::routing_retrieve_default_config, routes::routing::routing_retrieve_linked_config, routes::routing::routing_retrieve_default_config_for_profiles, routes::routing::routing_update_default_config_for_profile, routes::routing::success_based_routing_update_configs, routes::routing::toggle_success_based_routing, routes::routing::toggle_elimination_routing, routes::routing::contract_based_routing_setup_config, routes::routing::contract_based_routing_update_configs, routes::routing::call_decide_gateway_open_router, routes::routing::call_update_gateway_score_open_router, routes::routing::evaluate_routing_rule, // Routes for blocklist routes::blocklist::remove_entry_from_blocklist, routes::blocklist::list_blocked_payment_methods, routes::blocklist::add_entry_to_blocklist, routes::blocklist::toggle_blocklist_guard, // Routes for payouts routes::payouts::payouts_create, routes::payouts::payouts_retrieve, routes::payouts::payouts_update, routes::payouts::payouts_cancel, routes::payouts::payouts_fulfill, routes::payouts::payouts_list, routes::payouts::payouts_confirm, routes::payouts::payouts_list_filters, routes::payouts::payouts_list_by_filter, // Routes for api keys routes::api_keys::api_key_create, routes::api_keys::api_key_retrieve, routes::api_keys::api_key_update, routes::api_keys::api_key_revoke, routes::api_keys::api_key_list, // Routes for events routes::webhook_events::list_initial_webhook_delivery_attempts, routes::webhook_events::list_initial_webhook_delivery_attempts_with_jwtauth, routes::webhook_events::list_webhook_delivery_attempts, routes::webhook_events::retry_webhook_delivery_attempt, // Routes for poll apis routes::poll::retrieve_poll_status, // Routes for profile acquirer account routes::profile_acquirer::profile_acquirer_create, routes::profile_acquirer::profile_acquirer_update, // Routes for 3DS Decision Rule routes::three_ds_decision_rule::three_ds_decision_rule_execute, // Routes for authentication routes::authentication::authentication_create, // Routes for platform account routes::platform::create_platform_account, ), components(schemas( common_utils::types::MinorUnit, common_utils::types::StringMinorUnit, common_utils::types::TimeRange, common_utils::link_utils::GenericLinkUiConfig, common_utils::link_utils::EnabledPaymentMethod, common_utils::payout_method_utils::AdditionalPayoutMethodData, common_utils::payout_method_utils::CardAdditionalData, common_utils::payout_method_utils::BankAdditionalData, common_utils::payout_method_utils::WalletAdditionalData, common_utils::payout_method_utils::AchBankTransferAdditionalData, common_utils::payout_method_utils::BacsBankTransferAdditionalData, common_utils::payout_method_utils::SepaBankTransferAdditionalData, common_utils::payout_method_utils::PixBankTransferAdditionalData, common_utils::payout_method_utils::PaypalAdditionalData, common_utils::payout_method_utils::VenmoAdditionalData, common_types::payments::SplitPaymentsRequest, common_types::payments::GpayTokenizationData, common_types::payments::GPayPredecryptData, common_types::payments::GpayEcryptedTokenizationData, common_types::payments::ApplePayPaymentData, common_types::payments::ApplePayPredecryptData, common_types::payments::ApplePayCryptogramData, common_types::payments::StripeSplitPaymentRequest, common_types::domain::AdyenSplitData, common_types::domain::AdyenSplitItem, common_types::payments::AcceptanceType, common_types::payments::CustomerAcceptance, common_types::payments::OnlineMandate, common_types::payments::XenditSplitRequest, common_types::payments::XenditSplitRoute, common_types::payments::XenditChargeResponseData, common_types::payments::XenditMultipleSplitResponse, common_types::payments::XenditMultipleSplitRequest, common_types::domain::XenditSplitSubMerchantData, common_utils::types::ChargeRefunds, common_types::refunds::SplitRefund, common_types::refunds::StripeSplitRefundRequest, common_types::payments::ConnectorChargeResponseData, common_types::payments::StripeChargeResponseData, common_types::three_ds_decision_rule_engine::ThreeDSDecisionRule, common_types::three_ds_decision_rule_engine::ThreeDSDecision, common_types::payments::MerchantCountryCode, api_models::enums::PaymentChannel, api_models::three_ds_decision_rule::ThreeDsDecisionRuleExecuteRequest, api_models::three_ds_decision_rule::ThreeDsDecisionRuleExecuteResponse, api_models::three_ds_decision_rule::PaymentData, api_models::three_ds_decision_rule::PaymentMethodMetaData, api_models::three_ds_decision_rule::CustomerDeviceData, api_models::three_ds_decision_rule::IssuerData, api_models::three_ds_decision_rule::AcquirerData, api_models::refunds::RefundRequest, api_models::refunds::RefundType, api_models::refunds::RefundResponse, api_models::refunds::RefundStatus, api_models::refunds::RefundUpdateRequest, api_models::organization::OrganizationCreateRequest, api_models::organization::OrganizationUpdateRequest, api_models::organization::OrganizationResponse, api_models::admin::MerchantAccountCreate, api_models::admin::MerchantAccountUpdate, api_models::admin::MerchantAccountDeleteResponse, api_models::admin::MerchantConnectorDeleteResponse, api_models::admin::MerchantConnectorResponse, api_models::admin::MerchantConnectorListResponse, api_models::admin::AuthenticationConnectorDetails, api_models::admin::ExtendedCardInfoConfig, api_models::admin::BusinessGenericLinkConfig, api_models::admin::BusinessCollectLinkConfig, api_models::admin::BusinessPayoutLinkConfig, api_models::admin::CardTestingGuardConfig, api_models::admin::CardTestingGuardStatus, api_models::customers::CustomerRequest, api_models::customers::CustomerUpdateRequest, api_models::customers::CustomerDeleteResponse, api_models::payment_methods::PaymentMethodCreate, api_models::payment_methods::PaymentMethodResponse, api_models::payment_methods::CustomerPaymentMethod, common_types::three_ds_decision_rule_engine::ThreeDSDecisionRule, common_types::domain::AcquirerConfigMap, common_types::domain::AcquirerConfig, api_models::payment_methods::PaymentMethodListResponse, api_models::payment_methods::ResponsePaymentMethodsEnabled, api_models::payment_methods::ResponsePaymentMethodTypes, api_models::payment_methods::PaymentExperienceTypes, api_models::payment_methods::CardNetworkTypes, api_models::payment_methods::BankDebitTypes, api_models::payment_methods::BankTransferTypes, api_models::payment_methods::CustomerPaymentMethodsListResponse, api_models::payment_methods::PaymentMethodDeleteResponse, api_models::payment_methods::PaymentMethodUpdate, api_models::payment_methods::CustomerDefaultPaymentMethodResponse, api_models::payment_methods::CardDetailFromLocker, api_models::payment_methods::PaymentMethodCreateData, api_models::payment_methods::CardDetail, api_models::payment_methods::CardDetailUpdate, api_models::payment_methods::RequestPaymentMethodTypes, api_models::poll::PollResponse, api_models::poll::PollStatus, api_models::customers::CustomerResponse, api_models::admin::AcceptedCountries, api_models::admin::AcceptedCurrencies, api_models::enums::AdyenSplitType, api_models::enums::PaymentType, api_models::enums::ScaExemptionType, api_models::enums::PaymentMethod, api_models::enums::TriggeredBy, api_models::enums::TokenDataType, api_models::enums::PaymentMethodType, api_models::enums::ConnectorType, api_models::enums::PayoutConnectors, api_models::enums::AuthenticationConnectors, api_models::enums::Currency, api_models::enums::DocumentKind, api_models::enums::IntentStatus, api_models::enums::CaptureMethod, api_models::enums::FutureUsage, api_models::enums::AuthenticationType, api_models::enums::Connector, api_models::enums::PaymentMethod, api_models::enums::PaymentMethodIssuerCode, api_models::enums::TaxStatus, api_models::enums::MandateStatus, api_models::enums::PaymentExperience, api_models::enums::BankNames, api_models::enums::BankType, api_models::enums::BankHolderType, api_models::enums::CardNetwork, api_models::enums::MerchantCategoryCode, api_models::enums::DisputeStage, api_models::enums::DisputeStatus, api_models::enums::CountryAlpha2, api_models::enums::Country, api_models::enums::CountryAlpha3, api_models::enums::FieldType, api_models::enums::FrmAction, api_models::enums::FrmPreferredFlowTypes, api_models::enums::RetryAction, api_models::enums::AttemptStatus, api_models::enums::CaptureStatus, api_models::enums::ReconStatus, api_models::enums::ConnectorStatus, api_models::enums::AuthorizationStatus, api_models::enums::ElementPosition, api_models::enums::ElementSize, api_models::enums::SizeVariants, api_models::enums::MerchantProductType, api_models::enums::PaymentLinkDetailsLayout, api_models::enums::PaymentMethodStatus, api_models::enums::UIWidgetFormLayout, api_models::enums::MerchantProductType, api_models::enums::HyperswitchConnectorCategory, api_models::enums::ConnectorIntegrationStatus, api_models::enums::CardDiscovery, api_models::enums::FeatureStatus, api_models::enums::MerchantProductType, api_models::enums::CtpServiceProvider, api_models::enums::PaymentLinkSdkLabelType, api_models::enums::OrganizationType, api_models::enums::PaymentLinkShowSdkTerms, api_models::enums::ExternalVaultEnabled, api_models::enums::VaultSdk, api_models::admin::ExternalVaultConnectorDetails, api_models::admin::MerchantConnectorCreate, api_models::admin::AdditionalMerchantData, api_models::admin::ConnectorWalletDetails, api_models::admin::MerchantRecipientData, api_models::admin::MerchantAccountData, api_models::admin::MerchantConnectorUpdate, api_models::admin::PrimaryBusinessDetails, api_models::admin::FrmConfigs, api_models::admin::FrmPaymentMethod, api_models::admin::FrmPaymentMethodType, api_models::admin::PaymentMethodsEnabled, api_models::admin::MerchantConnectorDetailsWrap, api_models::admin::MerchantConnectorDetails, api_models::admin::MerchantConnectorWebhookDetails, api_models::admin::ProfileCreate, api_models::admin::ProfileResponse, api_models::admin::BusinessPaymentLinkConfig, api_models::admin::PaymentLinkBackgroundImageConfig, api_models::admin::PaymentLinkConfigRequest, api_models::admin::PaymentLinkConfig, api_models::admin::PaymentLinkTransactionDetails, api_models::admin::TransactionDetailsUiConfiguration, api_models::disputes::DisputeResponse, api_models::disputes::DisputeResponsePaymentsRetrieve, api_models::gsm::GsmCreateRequest, api_models::gsm::GsmRetrieveRequest, api_models::gsm::GsmUpdateRequest, api_models::gsm::GsmDeleteRequest, api_models::gsm::GsmDeleteResponse, api_models::gsm::GsmResponse, api_models::enums::GsmDecision, api_models::enums::GsmFeature, common_types::domain::GsmFeatureData, common_types::domain::RetryFeatureData, api_models::payments::AddressDetails, api_models::payments::BankDebitData, api_models::payments::AliPayQr, api_models::payments::AliPayRedirection, api_models::payments::MomoRedirection, api_models::payments::TouchNGoRedirection, api_models::payments::GcashRedirection, api_models::payments::KakaoPayRedirection, api_models::payments::AliPayHkRedirection, api_models::payments::GoPayRedirection, api_models::payments::MbWayRedirection, api_models::payments::MobilePayRedirection, api_models::payments::WeChatPayRedirection, api_models::payments::WeChatPayQr, api_models::payments::BankDebitBilling, api_models::payments::CryptoData, api_models::payments::RewardData, api_models::payments::UpiData, api_models::payments::UpiCollectData, api_models::payments::UpiIntentData, api_models::payments::VoucherData, api_models::payments::BoletoVoucherData, api_models::payments::AlfamartVoucherData, api_models::payments::IndomaretVoucherData, api_models::payments::Address, api_models::payments::VoucherData, api_models::payments::JCSVoucherData, api_models::payments::AlfamartVoucherData, api_models::payments::IndomaretVoucherData, api_models::payments::BankRedirectData, api_models::payments::RealTimePaymentData, api_models::payments::BankRedirectBilling, api_models::payments::BankRedirectBilling, api_models::payments::ConnectorMetadata, api_models::payments::FeatureMetadata, api_models::payments::ApplepayConnectorMetadataRequest, api_models::payments::SessionTokenInfo, api_models::payments::PaymentProcessingDetailsAt, api_models::payments::ApplepayInitiative, api_models::payments::PaymentProcessingDetails, api_models::payments::PaymentMethodDataResponseWithBilling, api_models::payments::PaymentMethodDataResponse, api_models::payments::CardResponse, api_models::payments::PaylaterResponse, api_models::payments::KlarnaSdkPaymentMethodResponse, api_models::payments::SwishQrData, api_models::payments::RevolutPayData, api_models::payments::AirwallexData, api_models::payments::BraintreeData, api_models::payments::NoonData, api_models::payments::OrderDetailsWithAmount, api_models::payments::NextActionType, api_models::payments::WalletData, api_models::payments::NextActionData, api_models::payments::PayLaterData, api_models::payments::MandateData, api_models::payments::PhoneDetails, api_models::payments::PaymentMethodData, api_models::payments::PaymentMethodDataRequest, api_models::payments::MandateType, api_models::payments::MandateAmountData, api_models::payments::Card, api_models::payments::CardRedirectData, api_models::payments::CardToken, api_models::payments::PaymentsRequest, api_models::payments::PaymentsCreateRequest, api_models::payments::PaymentsUpdateRequest, api_models::payments::PaymentsConfirmRequest, api_models::payments::PaymentsResponse, api_models::payments::PaymentsCreateResponseOpenApi, api_models::errors::types::GenericErrorResponseOpenApi, api_models::payments::PaymentRetrieveBody, api_models::payments::PaymentsRetrieveRequest, api_models::payments::PaymentsCaptureRequest, api_models::payments::PaymentsSessionRequest, api_models::payments::PaymentsSessionResponse, api_models::payments::PazeWalletData, api_models::payments::SessionToken, api_models::payments::ApplePaySessionResponse, api_models::payments::NullObject, api_models::payments::ThirdPartySdkSessionResponse, api_models::payments::NoThirdPartySdkSessionResponse, api_models::payments::SecretInfoToInitiateSdk, api_models::payments::ApplePayPaymentRequest, api_models::payments::ApplePayBillingContactFields, api_models::payments::ApplePayShippingContactFields, api_models::payments::ApplePayRecurringPaymentRequest, api_models::payments::ApplePayRegularBillingRequest, api_models::payments::ApplePayPaymentTiming, api_models::payments::RecurringPaymentIntervalUnit, api_models::payments::ApplePayRecurringDetails, api_models::payments::ApplePayRegularBillingDetails, api_models::payments::ApplePayAddressParameters, api_models::payments::AmountInfo, api_models::payments::ClickToPaySessionResponse, api_models::enums::ProductType, api_models::enums::MerchantAccountType, api_models::enums::MerchantAccountRequestType, api_models::payments::GooglePayWalletData, api_models::payments::PayPalWalletData, api_models::payments::PaypalRedirection, api_models::payments::GpayMerchantInfo, api_models::payments::GpayAllowedPaymentMethods, api_models::payments::GpayAllowedMethodsParameters, api_models::payments::GpayTokenizationSpecification, api_models::payments::GpayTokenParameters, api_models::payments::GpayTransactionInfo, api_models::payments::GpaySessionTokenResponse, api_models::payments::GooglePayThirdPartySdkData, api_models::payments::KlarnaSessionTokenResponse, api_models::payments::PaypalSessionTokenResponse, api_models::payments::ApplepaySessionTokenResponse, api_models::payments::SdkNextAction, api_models::payments::NextActionCall, api_models::payments::SdkNextActionData, api_models::payments::SamsungPayWalletData, api_models::payments::WeChatPay, api_models::payments::GooglePayPaymentMethodInfo, api_models::payments::ApplePayWalletData, api_models::payments::SamsungPayWalletCredentials, api_models::payments::SamsungPayWebWalletData, api_models::payments::SamsungPayAppWalletData, api_models::payments::SamsungPayCardBrand, api_models::payments::SamsungPayTokenData, api_models::payments::ApplepayPaymentMethod, api_models::payments::PaymentsCancelRequest, api_models::payments::PaymentsCancelPostCaptureRequest, api_models::payments::PaymentListConstraints, api_models::payments::PaymentListResponse, api_models::payments::CashappQr, api_models::payments::BankTransferData, api_models::payments::BankTransferNextStepsData, api_models::payments::SepaAndBacsBillingDetails, api_models::payments::AchBillingDetails, api_models::payments::MultibancoBillingDetails, api_models::payments::DokuBillingDetails, api_models::payments::BankTransferInstructions, api_models::payments::MobilePaymentNextStepData, api_models::payments::MobilePaymentConsent, api_models::payments::IframeData, api_models::payments::ReceiverDetails, api_models::payments::AchTransfer, api_models::payments::MultibancoTransferInstructions, api_models::payments::DokuBankTransferInstructions, api_models::payments::AmazonPayRedirectData, api_models::payments::SkrillData, api_models::payments::PayseraData, api_models::payments::ApplePayRedirectData, api_models::payments::ApplePayThirdPartySdkData, api_models::payments::GooglePayRedirectData, api_models::payments::GooglePayThirdPartySdk, api_models::payments::GooglePaySessionResponse, api_models::payments::PazeSessionTokenResponse, api_models::payments::SamsungPaySessionTokenResponse, api_models::payments::SamsungPayMerchantPaymentInformation, api_models::payments::SamsungPayAmountDetails, api_models::payments::SamsungPayAmountFormat, api_models::payments::SamsungPayProtocolType, api_models::payments::GpayShippingAddressParameters, api_models::payments::GpayBillingAddressParameters, api_models::payments::GpayBillingAddressFormat, api_models::payments::NetworkDetails, api_models::payments::SepaBankTransferInstructions, api_models::payments::BacsBankTransferInstructions, api_models::payments::RedirectResponse, api_models::payments::RequestSurchargeDetails, api_models::payments::PaymentAttemptResponse, api_models::payments::CaptureResponse, api_models::payments::PaymentsIncrementalAuthorizationRequest, api_models::payments::IncrementalAuthorizationResponse, api_models::payments::PaymentsCompleteAuthorizeRequest, api_models::payments::PaymentsExternalAuthenticationRequest, api_models::payments::PaymentsExternalAuthenticationResponse, api_models::payments::SdkInformation, api_models::payments::DeviceChannel, api_models::payments::ThreeDsCompletionIndicator, api_models::payments::MifinityData, api_models::enums::TransactionStatus, api_models::payments::BrowserInformation, api_models::payments::PaymentCreatePaymentLinkConfig, api_models::payments::ThreeDsData, api_models::payments::ThreeDsMethodData, api_models::payments::ThreeDsMethodKey, api_models::payments::PollConfigResponse, api_models::payments::PollConfig, api_models::payments::ExternalAuthenticationDetailsResponse, api_models::payments::ExtendedCardInfo, api_models::payments::AmazonPaySessionTokenData, api_models::payments::AmazonPayMerchantCredentials, api_models::payments::AmazonPayWalletData, api_models::payments::AmazonPaySessionTokenResponse, api_models::payments::AmazonPayPaymentIntent, api_models::payments::AmazonPayDeliveryOptions, api_models::payments::AmazonPayDeliveryPrice, api_models::payments::AmazonPayShippingMethod, api_models::payment_methods::RequiredFieldInfo, api_models::payment_methods::DefaultPaymentMethod, api_models::payment_methods::MaskedBankDetails, api_models::payment_methods::SurchargeDetailsResponse, api_models::payment_methods::SurchargeResponse, api_models::payment_methods::SurchargePercentage, api_models::payment_methods::PaymentMethodCollectLinkRequest, api_models::payment_methods::PaymentMethodCollectLinkResponse, api_models::payment_methods::CardType, api_models::payment_methods::CardNetworkTokenizeRequest, api_models::payment_methods::CardNetworkTokenizeResponse, api_models::payment_methods::TokenizeDataRequest, api_models::payment_methods::TokenizeCardRequest, api_models::payment_methods::TokenizePaymentMethodRequest, api_models::refunds::RefundListRequest, api_models::refunds::RefundListResponse, api_models::relay::RelayRequest, api_models::relay::RelayResponse, api_models::enums::RelayType, api_models::relay::RelayData, api_models::relay::RelayRefundRequestData, api_models::enums::RelayStatus, api_models::relay::RelayError, api_models::payments::AmountFilter, api_models::mandates::MandateRevokedResponse, api_models::mandates::MandateResponse, api_models::mandates::MandateCardDetails, api_models::mandates::RecurringDetails, api_models::mandates::NetworkTransactionIdAndCardDetails, api_models::mandates::ProcessorPaymentToken, api_models::ephemeral_key::EphemeralKeyCreateResponse, api_models::payments::CustomerDetails, api_models::payments::GiftCardData, api_models::payments::GiftCardDetails, api_models::payments::BHNGiftCardDetails, api_models::payments::MobilePaymentData, api_models::payments::MobilePaymentResponse, api_models::payments::Address, api_models::payments::BankCodeResponse, api_models::payouts::CardPayout, api_models::payouts::Wallet, api_models::payouts::Paypal, api_models::payouts::Venmo, api_models::payouts::AchBankTransfer, api_models::payouts::BacsBankTransfer, api_models::payouts::SepaBankTransfer, api_models::payouts::PixBankTransfer, api_models::payouts::PayoutsCreateRequest, api_models::payouts::PayoutUpdateRequest, api_models::payouts::PayoutConfirmRequest, api_models::payouts::PayoutCancelRequest, api_models::payouts::PayoutFulfillRequest, api_models::payouts::PayoutRetrieveRequest, api_models::payouts::PayoutAttemptResponse, api_models::payouts::PayoutCreateResponse, api_models::payouts::PayoutListConstraints, api_models::payouts::PayoutListFilters, api_models::payouts::PayoutListFilterConstraints, api_models::payouts::PayoutListResponse, api_models::payouts::PayoutRetrieveBody, api_models::payouts::PayoutMethodData, api_models::payouts::PayoutMethodDataResponse, api_models::payouts::PayoutLinkResponse, api_models::payouts::Bank, api_models::payouts::PayoutCreatePayoutLinkConfig, api_models::enums::PayoutEntityType, api_models::enums::PayoutSendPriority, api_models::enums::PayoutStatus, api_models::enums::PayoutType, api_models::enums::TransactionType, api_models::payments::FrmMessage, api_models::webhooks::OutgoingWebhook, api_models::webhooks::OutgoingWebhookContent, api_models::enums::EventClass, api_models::enums::EventType, api_models::enums::DecoupledAuthenticationType, api_models::enums::AuthenticationStatus, api_models::admin::MerchantAccountResponse, api_models::admin::MerchantConnectorId, api_models::admin::MerchantDetails, api_models::admin::ToggleKVRequest, api_models::admin::ToggleKVResponse, api_models::admin::WebhookDetails, api_models::api_keys::ApiKeyExpiration, api_models::api_keys::CreateApiKeyRequest, api_models::api_keys::CreateApiKeyResponse, api_models::api_keys::RetrieveApiKeyResponse, api_models::api_keys::RevokeApiKeyResponse, api_models::api_keys::UpdateApiKeyRequest, api_models::payments::RetrievePaymentLinkRequest, api_models::payments::PaymentLinkResponse, api_models::payments::RetrievePaymentLinkResponse, api_models::payments::PaymentLinkInitiateRequest, api_models::payouts::PayoutLinkInitiateRequest, api_models::payments::ExtendedCardInfoResponse, api_models::payments::GooglePayAssuranceDetails, api_models::routing::RoutingConfigRequest, api_models::routing::RoutingDictionaryRecord, api_models::routing::RoutingKind, api_models::routing::RoutableConnectorChoice, api_models::routing::DynamicRoutingFeatures, api_models::routing::SuccessBasedRoutingConfig, api_models::routing::DynamicRoutingConfigParams, api_models::routing::CurrentBlockThreshold, api_models::routing::SuccessBasedRoutingConfigBody, api_models::routing::ContractBasedRoutingConfig, api_models::routing::ContractBasedRoutingConfigBody, api_models::routing::LabelInformation, api_models::routing::ContractBasedTimeScale, api_models::routing::LinkedRoutingConfigRetrieveResponse, api_models::routing::RoutingRetrieveResponse, api_models::routing::ProfileDefaultRoutingConfig, api_models::routing::MerchantRoutingAlgorithm, api_models::routing::RoutingAlgorithmKind, api_models::routing::RoutingDictionary, api_models::routing::RoutingAlgorithmWrapper, api_models::routing::EliminationRoutingConfig, api_models::open_router::DecisionEngineEliminationData, api_models::routing::EliminationAnalyserConfig, api_models::routing::DynamicRoutingAlgorithm, api_models::routing::StaticRoutingAlgorithm, api_models::routing::StraightThroughAlgorithm, api_models::routing::ConnectorVolumeSplit, api_models::routing::ConnectorSelection, api_models::routing::SuccessRateSpecificityLevel, api_models::routing::ToggleDynamicRoutingQuery, api_models::routing::ToggleDynamicRoutingPath, api_models::routing::ProgramThreeDsDecisionRule, api_models::routing::RuleThreeDsDecisionRule, api_models::routing::RoutingVolumeSplitResponse, api_models::routing::ast::RoutableChoiceKind, api_models::enums::RoutableConnectors, api_models::routing::ast::ProgramConnectorSelection, api_models::routing::ast::RuleConnectorSelection, api_models::routing::ast::IfStatement, api_models::routing::ast::Comparison, api_models::routing::ast::ComparisonType, api_models::routing::ast::ValueType, api_models::routing::ast::MetadataValue, api_models::routing::ast::NumberComparison, api_models::payment_methods::RequestPaymentMethodTypes, api_models::payments::PaymentLinkStatus, api_models::blocklist::BlocklistRequest, api_models::blocklist::BlocklistResponse, api_models::blocklist::ToggleBlocklistResponse, api_models::blocklist::ListBlocklistQuery, api_models::enums::BlocklistDataKind, api_models::enums::ErrorCategory, api_models::webhook_events::EventListConstraints, api_models::webhook_events::EventListItemResponse, api_models::webhook_events::EventRetrieveResponse, api_models::webhook_events::OutgoingWebhookRequestContent, api_models::webhook_events::OutgoingWebhookResponseContent, api_models::webhook_events::TotalEventsResponse, api_models::enums::WebhookDeliveryAttempt, api_models::enums::PaymentChargeType, api_models::enums::StripeChargeType, api_models::payments::CustomerDetailsResponse, api_models::payments::SdkType, api_models::payments::OpenBankingData, api_models::payments::OpenBankingSessionToken, api_models::payments::BankDebitResponse, api_models::payments::BankRedirectResponse, api_models::payments::BankTransferResponse, api_models::payments::CardRedirectResponse,
crates/openapi/src/openapi.rs#chunk0
openapi
chunk
null
null
null
8,183
null
null
null
null
null
null
null
// File: crates/router/src/core/three_ds_decision_rule.rs // Module: router // Public functions: 2 // Public structs: 1 pub mod utils; use common_types::three_ds_decision_rule_engine::ThreeDSDecisionRule; use common_utils::ext_traits::ValueExt; use error_stack::ResultExt; use euclid::{ backend::{self, inputs as dsl_inputs, EuclidBackend}, frontend::ast, }; use hyperswitch_domain_models::merchant_context::MerchantContext; use router_env::{instrument, tracing}; use crate::{ core::{ errors, errors::{RouterResponse, StorageErrorExt}, }, services, types::transformers::ForeignFrom, SessionState, }; #[instrument(skip_all)] pub async fn execute_three_ds_decision_rule( state: SessionState, merchant_context: MerchantContext, request: api_models::three_ds_decision_rule::ThreeDsDecisionRuleExecuteRequest, ) -> RouterResponse<api_models::three_ds_decision_rule::ThreeDsDecisionRuleExecuteResponse> { let decision = get_three_ds_decision_rule_output( &state, merchant_context.get_merchant_account().get_id(), request.clone(), ) .await?; // Construct response let response = api_models::three_ds_decision_rule::ThreeDsDecisionRuleExecuteResponse { decision }; Ok(services::ApplicationResponse::Json(response)) } pub async fn get_three_ds_decision_rule_output( state: &SessionState, merchant_id: &common_utils::id_type::MerchantId, request: api_models::three_ds_decision_rule::ThreeDsDecisionRuleExecuteRequest, ) -> errors::RouterResult<common_types::three_ds_decision_rule_engine::ThreeDSDecision> { let db = state.store.as_ref(); // Retrieve the rule from database let routing_algorithm = db .find_routing_algorithm_by_algorithm_id_merchant_id(&request.routing_id, merchant_id) .await .to_not_found_response(errors::ApiErrorResponse::ResourceIdNotFound)?; let algorithm: Algorithm = routing_algorithm .algorithm_data .parse_value("Algorithm") .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable("Error parsing program from three_ds_decision rule algorithm")?; let program: ast::Program<ThreeDSDecisionRule> = algorithm .data .parse_value("Program<ThreeDSDecisionRule>") .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable("Error parsing program from three_ds_decision rule algorithm")?; // Construct backend input from request let backend_input = dsl_inputs::BackendInput::foreign_from(request.clone()); // Initialize interpreter with the rule program let interpreter = backend::VirInterpreterBackend::with_program(program) .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable("Error initializing DSL interpreter backend")?; // Execute the rule let result = interpreter .execute(backend_input) .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable("Error executing 3DS decision rule")?; // Apply PSD2 validations to the decision let final_decision = utils::apply_psd2_validations_during_execute(result.get_output().get_decision(), &request); Ok(final_decision) } #[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] pub struct Algorithm { data: serde_json::Value, }
crates/router/src/core/three_ds_decision_rule.rs
router
full_file
null
null
null
720
null
null
null
null
null
null
null
// Struct: Reason // File: crates/hyperswitch_connectors/src/connectors/trustpay/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct Reason
crates/hyperswitch_connectors/src/connectors/trustpay/transformers.rs
hyperswitch_connectors
struct_definition
Reason
0
[]
44
null
null
null
null
null
null
null
// Struct: PspTokenResult // File: crates/router/src/types.rs // Module: router // Implementations: 0 pub struct PspTokenResult
crates/router/src/types.rs
router
struct_definition
PspTokenResult
0
[]
35
null
null
null
null
null
null
null
// File: crates/router/tests/connectors/hipay.rs // Module: router use hyperswitch_domain_models::payment_method_data::{Card, PaymentMethodData}; use masking::Secret; use router::types::{self, api, storage::enums}; use test_utils::connector_auth; use crate::utils::{self, ConnectorActions}; #[derive(Clone, Copy)] struct HipayTest; impl ConnectorActions for HipayTest {} impl utils::Connector for HipayTest { fn get_data(&self) -> api::ConnectorData { use router::connector::Hipay; utils::construct_connector_data_old( Box::new(Hipay::new()), types::Connector::Plaid, api::GetToken::Connector, None, ) } fn get_auth_token(&self) -> types::ConnectorAuthType { utils::to_connector_auth_type( connector_auth::ConnectorAuthentication::new() .hipay .expect("Missing connector authentication configuration") .into(), ) } fn get_name(&self) -> String { "hipay".to_string() } } static CONNECTOR: HipayTest = HipayTest {}; fn get_default_payment_info() -> Option<utils::PaymentInfo> { None } fn payment_method_details() -> Option<types::PaymentsAuthorizeData> { None } // Cards Positive Tests // Creates a payment using the manual capture flow (Non 3DS). #[actix_web::test] async fn should_only_authorize_payment() { let response = CONNECTOR .authorize_payment(payment_method_details(), get_default_payment_info()) .await .expect("Authorize payment response"); assert_eq!(response.status, enums::AttemptStatus::Authorized); } // Captures a payment using the manual capture flow (Non 3DS). #[actix_web::test] async fn should_capture_authorized_payment() { let response = CONNECTOR .authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info()) .await .expect("Capture payment response"); assert_eq!(response.status, enums::AttemptStatus::Charged); } // Partially captures a payment using the manual capture flow (Non 3DS). #[actix_web::test] async fn should_partially_capture_authorized_payment() { let response = CONNECTOR .authorize_and_capture_payment( payment_method_details(), Some(types::PaymentsCaptureData { amount_to_capture: 50, ..utils::PaymentCaptureType::default().0 }), get_default_payment_info(), ) .await .expect("Capture payment response"); assert_eq!(response.status, enums::AttemptStatus::Charged); } // Synchronizes a payment using the manual capture flow (Non 3DS). #[actix_web::test] async fn should_sync_authorized_payment() { let authorize_response = CONNECTOR .authorize_payment(payment_method_details(), get_default_payment_info()) .await .expect("Authorize payment response"); let txn_id = utils::get_connector_transaction_id(authorize_response.response); let response = CONNECTOR .psync_retry_till_status_matches( enums::AttemptStatus::Authorized, Some(types::PaymentsSyncData { connector_transaction_id: types::ResponseId::ConnectorTransactionId( txn_id.unwrap(), ), ..Default::default() }), get_default_payment_info(), ) .await .expect("PSync response"); assert_eq!(response.status, enums::AttemptStatus::Authorized,); } // Voids a payment using the manual capture flow (Non 3DS). #[actix_web::test] async fn should_void_authorized_payment() { let response = CONNECTOR .authorize_and_void_payment( payment_method_details(), Some(types::PaymentsCancelData { connector_transaction_id: String::from(""), cancellation_reason: Some("requested_by_customer".to_string()), ..Default::default() }), get_default_payment_info(), ) .await .expect("Void payment response"); assert_eq!(response.status, enums::AttemptStatus::Voided); } // Refunds a payment using the manual capture flow (Non 3DS). #[actix_web::test] async fn should_refund_manually_captured_payment() { let response = CONNECTOR .capture_payment_and_refund( payment_method_details(), None, None, get_default_payment_info(), ) .await .unwrap(); assert_eq!( response.response.unwrap().refund_status, enums::RefundStatus::Success, ); } // Partially refunds a payment using the manual capture flow (Non 3DS). #[actix_web::test] async fn should_partially_refund_manually_captured_payment() { let response = CONNECTOR .capture_payment_and_refund( payment_method_details(), None, Some(types::RefundsData { refund_amount: 50, ..utils::PaymentRefundType::default().0 }), get_default_payment_info(), ) .await .unwrap(); assert_eq!( response.response.unwrap().refund_status, enums::RefundStatus::Success, ); } // Synchronizes a refund using the manual capture flow (Non 3DS). #[actix_web::test] async fn should_sync_manually_captured_refund() { let refund_response = CONNECTOR .capture_payment_and_refund( payment_method_details(), None, None, get_default_payment_info(), ) .await .unwrap(); let response = CONNECTOR .rsync_retry_till_status_matches( enums::RefundStatus::Success, refund_response.response.unwrap().connector_refund_id, None, get_default_payment_info(), ) .await .unwrap(); assert_eq!( response.response.unwrap().refund_status, enums::RefundStatus::Success, ); } // Creates a payment using the automatic capture flow (Non 3DS). #[actix_web::test] async fn should_make_payment() { let authorize_response = CONNECTOR .make_payment(payment_method_details(), get_default_payment_info()) .await .unwrap(); assert_eq!(authorize_response.status, enums::AttemptStatus::Charged); } // Synchronizes a payment using the automatic capture flow (Non 3DS). #[actix_web::test] async fn should_sync_auto_captured_payment() { let authorize_response = CONNECTOR .make_payment(payment_method_details(), get_default_payment_info()) .await .unwrap(); assert_eq!(authorize_response.status, enums::AttemptStatus::Charged); let txn_id = utils::get_connector_transaction_id(authorize_response.response); assert_ne!(txn_id, None, "Empty connector transaction id"); let response = CONNECTOR .psync_retry_till_status_matches( enums::AttemptStatus::Charged, Some(types::PaymentsSyncData { connector_transaction_id: types::ResponseId::ConnectorTransactionId( txn_id.unwrap(), ), capture_method: Some(enums::CaptureMethod::Automatic), ..Default::default() }), get_default_payment_info(), ) .await .unwrap(); assert_eq!(response.status, enums::AttemptStatus::Charged,); } // Refunds a payment using the automatic capture flow (Non 3DS). #[actix_web::test] async fn should_refund_auto_captured_payment() { let response = CONNECTOR .make_payment_and_refund(payment_method_details(), None, get_default_payment_info()) .await .unwrap(); assert_eq!( response.response.unwrap().refund_status, enums::RefundStatus::Success, ); } // Partially refunds a payment using the automatic capture flow (Non 3DS). #[actix_web::test] async fn should_partially_refund_succeeded_payment() { let refund_response = CONNECTOR .make_payment_and_refund( payment_method_details(), Some(types::RefundsData { refund_amount: 50, ..utils::PaymentRefundType::default().0 }), get_default_payment_info(), ) .await .unwrap(); assert_eq!( refund_response.response.unwrap().refund_status, enums::RefundStatus::Success, ); } // Creates multiple refunds against a payment using the automatic capture flow (Non 3DS). #[actix_web::test] async fn should_refund_succeeded_payment_multiple_times() { CONNECTOR .make_payment_and_multiple_refund( payment_method_details(), Some(types::RefundsData { refund_amount: 50, ..utils::PaymentRefundType::default().0 }), get_default_payment_info(), ) .await; } // Synchronizes a refund using the automatic capture flow (Non 3DS). #[actix_web::test] async fn should_sync_refund() { let refund_response = CONNECTOR .make_payment_and_refund(payment_method_details(), None, get_default_payment_info()) .await .unwrap(); let response = CONNECTOR .rsync_retry_till_status_matches( enums::RefundStatus::Success, refund_response.response.unwrap().connector_refund_id, None, get_default_payment_info(), ) .await .unwrap(); assert_eq!( response.response.unwrap().refund_status, enums::RefundStatus::Success, ); } // Cards Negative scenarios // Creates a payment with incorrect CVC. #[actix_web::test] async fn should_fail_payment_for_incorrect_cvc() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { payment_method_data: PaymentMethodData::Card(Card { card_cvc: Secret::new("12345".to_string()), ..utils::CCardType::default().0 }), ..utils::PaymentAuthorizeType::default().0 }), get_default_payment_info(), ) .await .unwrap(); assert_eq!( response.response.unwrap_err().message, "Your card's security code is invalid.".to_string(), ); } // Creates a payment with incorrect expiry month. #[actix_web::test] async fn should_fail_payment_for_invalid_exp_month() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { payment_method_data: PaymentMethodData::Card(Card { card_exp_month: Secret::new("20".to_string()), ..utils::CCardType::default().0 }), ..utils::PaymentAuthorizeType::default().0 }), get_default_payment_info(), ) .await .unwrap(); assert_eq!( response.response.unwrap_err().message, "Your card's expiration month is invalid.".to_string(), ); } // Creates a payment with incorrect expiry year. #[actix_web::test] async fn should_fail_payment_for_incorrect_expiry_year() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { payment_method_data: PaymentMethodData::Card(Card { card_exp_year: Secret::new("2000".to_string()), ..utils::CCardType::default().0 }), ..utils::PaymentAuthorizeType::default().0 }), get_default_payment_info(), ) .await .unwrap(); assert_eq!( response.response.unwrap_err().message, "Your card's expiration year is invalid.".to_string(), ); } // Voids a payment using automatic capture flow (Non 3DS). #[actix_web::test] async fn should_fail_void_payment_for_auto_capture() { let authorize_response = CONNECTOR .make_payment(payment_method_details(), get_default_payment_info()) .await .unwrap(); assert_eq!(authorize_response.status, enums::AttemptStatus::Charged); let txn_id = utils::get_connector_transaction_id(authorize_response.response); assert_ne!(txn_id, None, "Empty connector transaction id"); let void_response = CONNECTOR .void_payment(txn_id.unwrap(), None, get_default_payment_info()) .await .unwrap(); assert_eq!( void_response.response.unwrap_err().message, "You cannot cancel this PaymentIntent because it has a status of succeeded." ); } // Captures a payment using invalid connector payment id. #[actix_web::test] async fn should_fail_capture_for_invalid_payment() { let capture_response = CONNECTOR .capture_payment("123456789".to_string(), None, get_default_payment_info()) .await .unwrap(); assert_eq!( capture_response.response.unwrap_err().message, String::from("No such payment_intent: '123456789'") ); } // Refunds a payment with refund amount higher than payment amount. #[actix_web::test] async fn should_fail_for_refund_amount_higher_than_payment_amount() { let response = CONNECTOR .make_payment_and_refund( payment_method_details(), Some(types::RefundsData { refund_amount: 150, ..utils::PaymentRefundType::default().0 }), get_default_payment_info(), ) .await .unwrap(); assert_eq!( response.response.unwrap_err().message, "Refund amount (₹1.50) is greater than charge amount (₹1.00)", ); } // Connector dependent test cases goes here // [#478]: add unit tests for non 3DS, wallets & webhooks in connector tests
crates/router/tests/connectors/hipay.rs
router
full_file
null
null
null
2,931
null
null
null
null
null
null
null
// Struct: FiservemeaCaptureRequest // File: crates/hyperswitch_connectors/src/connectors/fiservemea/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct FiservemeaCaptureRequest
crates/hyperswitch_connectors/src/connectors/fiservemea/transformers.rs
hyperswitch_connectors
struct_definition
FiservemeaCaptureRequest
0
[]
58
null
null
null
null
null
null
null
// Struct: DatatransErrorResponse // File: crates/hyperswitch_connectors/src/connectors/datatrans/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct DatatransErrorResponse
crates/hyperswitch_connectors/src/connectors/datatrans/transformers.rs
hyperswitch_connectors
struct_definition
DatatransErrorResponse
0
[]
50
null
null
null
null
null
null
null
// Function: insert // File: crates/diesel_models/src/query/merchant_key_store.rs // Module: diesel_models pub fn insert(self, conn: &PgPooledConn) -> StorageResult<MerchantKeyStore>
crates/diesel_models/src/query/merchant_key_store.rs
diesel_models
function_signature
null
null
null
47
insert
null
null
null
null
null
null
// Function: payments_create_and_confirm_intent // File: crates/router/src/core/payments.rs // Module: router pub fn payments_create_and_confirm_intent( state: SessionState, req_state: ReqState, merchant_context: domain::MerchantContext, profile: domain::Profile, request: payments_api::PaymentsRequest, header_payload: HeaderPayload, ) -> RouterResponse<payments_api::PaymentsResponse>
crates/router/src/core/payments.rs
router
function_signature
null
null
null
90
payments_create_and_confirm_intent
null
null
null
null
null
null
// Implementation: impl api::PaymentCapture for for Ebanx // File: crates/hyperswitch_connectors/src/connectors/ebanx.rs // Module: hyperswitch_connectors // Methods: 0 total (0 public) impl api::PaymentCapture for for Ebanx
crates/hyperswitch_connectors/src/connectors/ebanx.rs
hyperswitch_connectors
impl_block
null
null
null
61
null
Ebanx
api::PaymentCapture for
0
0
null
null
// Struct: UpiDetails // File: crates/hyperswitch_connectors/src/connectors/razorpay/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct UpiDetails
crates/hyperswitch_connectors/src/connectors/razorpay/transformers.rs
hyperswitch_connectors
struct_definition
UpiDetails
0
[]
49
null
null
null
null
null
null
null
// Implementation: impl Default for for DisputePollingIntervalInHours // File: crates/common_types/src/primitive_wrappers.rs // Module: common_types // Methods: 1 total (0 public) impl Default for for DisputePollingIntervalInHours
crates/common_types/src/primitive_wrappers.rs
common_types
impl_block
null
null
null
55
null
DisputePollingIntervalInHours
Default for
1
0
null
null
// Function: retrieve_value_from_vault // File: crates/router/src/core/payment_methods/vault.rs // Module: router pub fn retrieve_value_from_vault( state: &routes::SessionState, request: pm_types::VaultRetrieveRequest, ) -> CustomResult<serde_json::value::Value, errors::VaultError>
crates/router/src/core/payment_methods/vault.rs
router
function_signature
null
null
null
71
retrieve_value_from_vault
null
null
null
null
null
null
// Function: get_tenants // File: crates/drainer/src/settings.rs // Module: drainer pub fn get_tenants(&self) -> &HashMap<id_type::TenantId, Tenant>
crates/drainer/src/settings.rs
drainer
function_signature
null
null
null
43
get_tenants
null
null
null
null
null
null
// Function: create_certificate // File: crates/external_services/src/http_client/client.rs // Module: external_services pub fn create_certificate( encoded_certificate: masking::Secret<String>, ) -> Result<Vec<reqwest::Certificate>, error_stack::Report<HttpClientError>>
crates/external_services/src/http_client/client.rs
external_services
function_signature
null
null
null
57
create_certificate
null
null
null
null
null
null
// Struct: Amount // File: crates/hyperswitch_connectors/src/connectors/barclaycard/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct Amount
crates/hyperswitch_connectors/src/connectors/barclaycard/transformers.rs
hyperswitch_connectors
struct_definition
Amount
0
[]
45
null
null
null
null
null
null
null
// Struct: RiskifiedPaymentsCheckoutRequest // File: crates/hyperswitch_connectors/src/connectors/riskified/transformers/api.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct RiskifiedPaymentsCheckoutRequest
crates/hyperswitch_connectors/src/connectors/riskified/transformers/api.rs
hyperswitch_connectors
struct_definition
RiskifiedPaymentsCheckoutRequest
0
[]
53
null
null
null
null
null
null
null
// Struct: AmountComponents // File: crates/hyperswitch_connectors/src/connectors/authipay/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct AmountComponents
crates/hyperswitch_connectors/src/connectors/authipay/transformers.rs
hyperswitch_connectors
struct_definition
AmountComponents
0
[]
45
null
null
null
null
null
null
null
// Function: payment_method_delete_api // File: crates/openapi/src/routes/payment_method.rs // Module: openapi pub fn payment_method_delete_api()
crates/openapi/src/routes/payment_method.rs
openapi
function_signature
null
null
null
33
payment_method_delete_api
null
null
null
null
null
null
// Struct: AciWebhookCustomerDetails // File: crates/hyperswitch_connectors/src/connectors/aci/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct AciWebhookCustomerDetails
crates/hyperswitch_connectors/src/connectors/aci/transformers.rs
hyperswitch_connectors
struct_definition
AciWebhookCustomerDetails
0
[]
53
null
null
null
null
null
null
null
// Struct: NomupayMetadata // File: crates/hyperswitch_connectors/src/connectors/nomupay/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct NomupayMetadata
crates/hyperswitch_connectors/src/connectors/nomupay/transformers.rs
hyperswitch_connectors
struct_definition
NomupayMetadata
0
[]
51
null
null
null
null
null
null
null
// Struct: PaymentResponse // File: crates/hyperswitch_connectors/src/connectors/worldpayvantiv/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct PaymentResponse
crates/hyperswitch_connectors/src/connectors/worldpayvantiv/transformers.rs
hyperswitch_connectors
struct_definition
PaymentResponse
0
[]
47
null
null
null
null
null
null
null
let connector_payment_id = req.request.connector_transaction_id.clone(); Ok(format!( "{}pts/v2/payments/{}/captures", self.base_url(connectors), connector_payment_id )) } fn get_request_body( &self, req: &PaymentsCaptureRouterData, _connectors: &Connectors, ) -> CustomResult<RequestContent, errors::ConnectorError> { let amount = convert_amount( self.amount_converter, req.request.minor_amount_to_capture, req.request.currency, )?; let connector_router_data = cybersource::CybersourceRouterData::from((amount, req)); let connector_req = cybersource::CybersourcePaymentsCaptureRequest::try_from(&connector_router_data)?; Ok(RequestContent::Json(Box::new(connector_req))) } fn build_request( &self, req: &PaymentsCaptureRouterData, connectors: &Connectors, ) -> CustomResult<Option<Request>, errors::ConnectorError> { Ok(Some( RequestBuilder::new() .method(Method::Post) .url(&PaymentsCaptureType::get_url(self, req, connectors)?) .attach_default_headers() .headers(PaymentsCaptureType::get_headers(self, req, connectors)?) .set_body(PaymentsCaptureType::get_request_body( self, req, connectors, )?) .build(), )) } fn handle_response( &self, data: &PaymentsCaptureRouterData, event_builder: Option<&mut ConnectorEvent>, res: Response, ) -> CustomResult< RouterData<Capture, PaymentsCaptureData, PaymentsResponseData>, errors::ConnectorError, > { let response: cybersource::CybersourcePaymentsResponse = res .response .parse_struct("Cybersource PaymentResponse") .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; event_builder.map(|i| i.set_response_body(&response)); router_env::logger::info!(connector_response=?response); RouterData::try_from(ResponseRouterData { response, data: data.clone(), http_code: res.status_code, }) } fn get_error_response( &self, res: Response, event_builder: Option<&mut ConnectorEvent>, ) -> CustomResult<ErrorResponse, errors::ConnectorError> { self.build_error_response(res, event_builder) } fn get_5xx_error_response( &self, res: Response, event_builder: Option<&mut ConnectorEvent>, ) -> CustomResult<ErrorResponse, errors::ConnectorError> { let response: cybersource::CybersourceServerErrorResponse = res .response .parse_struct("CybersourceServerErrorResponse") .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; event_builder.map(|event| event.set_response_body(&response)); router_env::logger::info!(error_response=?response); Ok(ErrorResponse { status_code: res.status_code, reason: response.status.clone(), code: response .status .unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_CODE.to_string()), message: response .message .unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_MESSAGE.to_string()), attempt_status: None, connector_transaction_id: None, network_advice_code: None, network_decline_code: None, network_error_message: None, connector_metadata: None, }) } } impl ConnectorIntegration<PSync, PaymentsSyncData, PaymentsResponseData> for Cybersource { fn get_headers( &self, req: &PaymentsSyncRouterData, connectors: &Connectors, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { self.build_headers(req, connectors) } fn get_http_method(&self) -> Method { Method::Get } fn get_url( &self, req: &PaymentsSyncRouterData, connectors: &Connectors, ) -> CustomResult<String, errors::ConnectorError> { let connector_payment_id = req .request .connector_transaction_id .get_connector_transaction_id() .change_context(errors::ConnectorError::MissingConnectorTransactionID)?; Ok(format!( "{}tss/v2/transactions/{}", self.base_url(connectors), connector_payment_id )) } fn get_content_type(&self) -> &'static str { self.common_get_content_type() } fn build_request( &self, req: &PaymentsSyncRouterData, connectors: &Connectors, ) -> CustomResult<Option<Request>, errors::ConnectorError> { Ok(Some( RequestBuilder::new() .method(Method::Get) .url(&PaymentsSyncType::get_url(self, req, connectors)?) .attach_default_headers() .headers(PaymentsSyncType::get_headers(self, req, connectors)?) .build(), )) } fn handle_response( &self, data: &PaymentsSyncRouterData, event_builder: Option<&mut ConnectorEvent>, res: Response, ) -> CustomResult<PaymentsSyncRouterData, errors::ConnectorError> { let response: cybersource::CybersourceTransactionResponse = res .response .parse_struct("Cybersource PaymentSyncResponse") .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; event_builder.map(|i| i.set_response_body(&response)); router_env::logger::info!(connector_response=?response); RouterData::try_from(ResponseRouterData { response, data: data.clone(), http_code: res.status_code, }) } fn get_error_response( &self, res: Response, event_builder: Option<&mut ConnectorEvent>, ) -> CustomResult<ErrorResponse, errors::ConnectorError> { self.build_error_response(res, event_builder) } } #[cfg(feature = "v1")] impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData> for Cybersource { fn get_headers( &self, req: &PaymentsAuthorizeRouterData, connectors: &Connectors, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { self.build_headers(req, connectors) } fn get_content_type(&self) -> &'static str { self.common_get_content_type() } fn get_url( &self, req: &PaymentsAuthorizeRouterData, connectors: &Connectors, ) -> CustomResult<String, errors::ConnectorError> { if req.is_three_ds() && req.request.is_card() && (req.request.connector_mandate_id().is_none() && req.request.get_optional_network_transaction_id().is_none()) && req.request.authentication_data.is_none() { Ok(format!( "{}risk/v1/authentication-setups", ConnectorCommon::base_url(self, connectors) )) } else { Ok(format!( "{}pts/v2/payments/", ConnectorCommon::base_url(self, connectors) )) } } fn get_request_body( &self, req: &PaymentsAuthorizeRouterData, _connectors: &Connectors, ) -> CustomResult<RequestContent, errors::ConnectorError> { let amount = convert_amount( self.amount_converter, req.request.minor_amount, req.request.currency, )?; let connector_router_data = cybersource::CybersourceRouterData::from((amount, req)); if req.is_three_ds() && req.request.is_card() && (req.request.connector_mandate_id().is_none() && req.request.get_optional_network_transaction_id().is_none()) && req.request.authentication_data.is_none() { let connector_req = cybersource::CybersourceAuthSetupRequest::try_from(&connector_router_data)?; Ok(RequestContent::Json(Box::new(connector_req))) } else { let connector_req = cybersource::CybersourcePaymentsRequest::try_from(&connector_router_data)?; Ok(RequestContent::Json(Box::new(connector_req))) } } fn build_request( &self, req: &PaymentsAuthorizeRouterData, connectors: &Connectors, ) -> CustomResult<Option<Request>, errors::ConnectorError> { let request = RequestBuilder::new() .method(Method::Post) .url(&PaymentsAuthorizeType::get_url(self, req, connectors)?) .attach_default_headers() .headers(PaymentsAuthorizeType::get_headers(self, req, connectors)?) .set_body(self.get_request_body(req, connectors)?) .build(); Ok(Some(request)) } fn handle_response( &self, data: &PaymentsAuthorizeRouterData, event_builder: Option<&mut ConnectorEvent>, res: Response, ) -> CustomResult<PaymentsAuthorizeRouterData, errors::ConnectorError> { if data.is_three_ds() && data.request.is_card() && (data.request.connector_mandate_id().is_none() && data.request.get_optional_network_transaction_id().is_none()) && data.request.authentication_data.is_none() { let response: cybersource::CybersourceAuthSetupResponse = res .response .parse_struct("Cybersource AuthSetupResponse") .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; event_builder.map(|i| i.set_response_body(&response)); router_env::logger::info!(connector_response=?response); RouterData::try_from(ResponseRouterData { response, data: data.clone(), http_code: res.status_code, }) } else { let response: cybersource::CybersourcePaymentsResponse = res .response .parse_struct("Cybersource PaymentResponse") .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; event_builder.map(|i| i.set_response_body(&response)); router_env::logger::info!(connector_response=?response); RouterData::try_from(ResponseRouterData { response, data: data.clone(), http_code: res.status_code, }) } } fn get_error_response( &self, res: Response, event_builder: Option<&mut ConnectorEvent>, ) -> CustomResult<ErrorResponse, errors::ConnectorError> { self.build_error_response(res, event_builder) } fn get_5xx_error_response( &self, res: Response, event_builder: Option<&mut ConnectorEvent>, ) -> CustomResult<ErrorResponse, errors::ConnectorError> { let response: cybersource::CybersourceServerErrorResponse = res .response .parse_struct("CybersourceServerErrorResponse") .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; event_builder.map(|event| event.set_response_body(&response)); router_env::logger::info!(error_response=?response); let attempt_status = match response.reason { Some(reason) => match reason { transformers::Reason::SystemError => Some(enums::AttemptStatus::Failure), transformers::Reason::ServerTimeout | transformers::Reason::ServiceTimeout => None, }, None => None, }; Ok(ErrorResponse { status_code: res.status_code, reason: response.status.clone(), code: response .status .unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_CODE.to_string()), message: response .message .unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_MESSAGE.to_string()), attempt_status, connector_transaction_id: None, network_advice_code: None, network_decline_code: None, network_error_message: None, connector_metadata: None, }) } } #[cfg(feature = "v2")] impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData> for Cybersource { fn get_headers( &self, req: &PaymentsAuthorizeRouterData, connectors: &Connectors, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { self.build_headers(req, connectors) } fn get_content_type(&self) -> &'static str { self.common_get_content_type() } fn get_url( &self, req: &PaymentsAuthorizeRouterData, connectors: &Connectors, ) -> CustomResult<String, errors::ConnectorError> { Ok(format!( "{}pts/v2/payments/", ConnectorCommon::base_url(self, connectors) )) } fn get_request_body( &self, req: &PaymentsAuthorizeRouterData, _connectors: &Connectors, ) -> CustomResult<RequestContent, errors::ConnectorError> { let amount = convert_amount( self.amount_converter, req.request.minor_amount, req.request.currency, )?; let connector_router_data = cybersource::CybersourceRouterData::from((amount, req)); let connector_req = cybersource::CybersourcePaymentsRequest::try_from(&connector_router_data)?; Ok(RequestContent::Json(Box::new(connector_req))) } fn build_request( &self, req: &PaymentsAuthorizeRouterData, connectors: &Connectors, ) -> CustomResult<Option<Request>, errors::ConnectorError> { let request = RequestBuilder::new() .method(Method::Post) .url(&PaymentsAuthorizeType::get_url(self, req, connectors)?) .attach_default_headers() .headers(PaymentsAuthorizeType::get_headers(self, req, connectors)?) .set_body(self.get_request_body(req, connectors)?) .build(); Ok(Some(request)) } fn handle_response( &self, data: &PaymentsAuthorizeRouterData, event_builder: Option<&mut ConnectorEvent>, res: Response, ) -> CustomResult<PaymentsAuthorizeRouterData, errors::ConnectorError> { let response: cybersource::CybersourcePaymentsResponse = res .response .parse_struct("Cybersource PaymentResponse") .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; event_builder.map(|i| i.set_response_body(&response)); router_env::logger::info!(connector_response=?response); RouterData::try_from(ResponseRouterData { response, data: data.clone(), http_code: res.status_code, }) } fn get_error_response( &self, res: Response, event_builder: Option<&mut ConnectorEvent>, ) -> CustomResult<ErrorResponse, errors::ConnectorError> { self.build_error_response(res, event_builder) } fn get_5xx_error_response( &self, res: Response, event_builder: Option<&mut ConnectorEvent>, ) -> CustomResult<ErrorResponse, errors::ConnectorError> { let response: cybersource::CybersourceServerErrorResponse = res .response .parse_struct("CybersourceServerErrorResponse") .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; event_builder.map(|event| event.set_response_body(&response)); router_env::logger::info!(error_response=?response); let attempt_status = match response.reason { Some(reason) => match reason { transformers::Reason::SystemError => Some(enums::AttemptStatus::Failure), transformers::Reason::ServerTimeout | transformers::Reason::ServiceTimeout => None, }, None => None, }; Ok(ErrorResponse { status_code: res.status_code, reason: response.status.clone(), code: response .status .unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_CODE.to_string()), message: response .message .unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_MESSAGE.to_string()), attempt_status, connector_transaction_id: None, network_advice_code: None, network_decline_code: None, network_error_message: None, connector_metadata: None, }) } } #[cfg(feature = "payouts")] impl ConnectorIntegration<PoFulfill, PayoutsData, PayoutsResponseData> for Cybersource { fn get_url( &self, _req: &PayoutsRouterData<PoFulfill>, connectors: &Connectors, ) -> CustomResult<String, errors::ConnectorError> { Ok(format!("{}pts/v2/payouts", self.base_url(connectors))) } fn get_headers( &self, req: &PayoutsRouterData<PoFulfill>, connectors: &Connectors, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { self.build_headers(req, connectors) } fn get_request_body( &self, req: &PayoutsRouterData<PoFulfill>, _connectors: &Connectors, ) -> CustomResult<RequestContent, errors::ConnectorError> { let amount = convert_amount( self.amount_converter, req.request.minor_amount, req.request.destination_currency, )?; let connector_router_data = cybersource::CybersourceRouterData::from((amount, req)); let connector_req = cybersource::CybersourcePayoutFulfillRequest::try_from(&connector_router_data)?; Ok(RequestContent::Json(Box::new(connector_req))) } fn build_request( &self, req: &PayoutsRouterData<PoFulfill>, connectors: &Connectors, ) -> CustomResult<Option<Request>, errors::ConnectorError> { let request = RequestBuilder::new() .method(Method::Post) .url(&PayoutFulfillType::get_url(self, req, connectors)?) .attach_default_headers() .headers(PayoutFulfillType::get_headers(self, req, connectors)?) .set_body(PayoutFulfillType::get_request_body(self, req, connectors)?) .build(); Ok(Some(request)) } fn handle_response( &self, data: &PayoutsRouterData<PoFulfill>, event_builder: Option<&mut ConnectorEvent>, res: Response, ) -> CustomResult<PayoutsRouterData<PoFulfill>, errors::ConnectorError> { let response: cybersource::CybersourceFulfillResponse = res .response .parse_struct("CybersourceFulfillResponse") .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; event_builder.map(|i| i.set_response_body(&response)); router_env::logger::info!(connector_response=?response); RouterData::try_from(ResponseRouterData { response, data: data.clone(), http_code: res.status_code, }) } fn get_error_response( &self, res: Response, event_builder: Option<&mut ConnectorEvent>, ) -> CustomResult<ErrorResponse, errors::ConnectorError> { self.build_error_response(res, event_builder) } fn get_5xx_error_response( &self, res: Response, event_builder: Option<&mut ConnectorEvent>, ) -> CustomResult<ErrorResponse, errors::ConnectorError> { let response: cybersource::CybersourceServerErrorResponse = res .response .parse_struct("CybersourceServerErrorResponse") .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; event_builder.map(|event| event.set_response_body(&response)); router_env::logger::info!(error_response=?response); let attempt_status = match response.reason { Some(reason) => match reason { transformers::Reason::SystemError => Some(enums::AttemptStatus::Failure), transformers::Reason::ServerTimeout | transformers::Reason::ServiceTimeout => None, }, None => None, }; Ok(ErrorResponse { status_code: res.status_code, reason: response.status.clone(), code: response .status .unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_CODE.to_string()), message: response .message .unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_MESSAGE.to_string()), attempt_status, connector_transaction_id: None, network_advice_code: None, network_decline_code: None, network_error_message: None, connector_metadata: None, }) } } impl ConnectorIntegration<CompleteAuthorize, CompleteAuthorizeData, PaymentsResponseData> for Cybersource { fn get_headers( &self, req: &PaymentsCompleteAuthorizeRouterData, connectors: &Connectors, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { self.build_headers(req, connectors) } fn get_content_type(&self) -> &'static str { self.common_get_content_type() } fn get_url( &self, _req: &PaymentsCompleteAuthorizeRouterData, connectors: &Connectors, ) -> CustomResult<String, errors::ConnectorError> { Ok(format!( "{}pts/v2/payments/", ConnectorCommon::base_url(self, connectors) )) } fn get_request_body( &self, req: &PaymentsCompleteAuthorizeRouterData, _connectors: &Connectors, ) -> CustomResult<RequestContent, errors::ConnectorError> { let amount = convert_amount( self.amount_converter, req.request.minor_amount, req.request.currency, )?; let connector_router_data = cybersource::CybersourceRouterData::from((amount, req)); let connector_req = cybersource::CybersourcePaymentsRequest::try_from(&connector_router_data)?; Ok(RequestContent::Json(Box::new(connector_req))) } fn build_request( &self, req: &PaymentsCompleteAuthorizeRouterData, connectors: &Connectors, ) -> CustomResult<Option<Request>, errors::ConnectorError> { Ok(Some( RequestBuilder::new() .method(Method::Post) .url(&PaymentsCompleteAuthorizeType::get_url( self, req, connectors, )?) .attach_default_headers() .headers(PaymentsCompleteAuthorizeType::get_headers( self, req, connectors, )?) .set_body(PaymentsCompleteAuthorizeType::get_request_body( self, req, connectors, )?) .build(), )) } fn handle_response( &self, data: &PaymentsCompleteAuthorizeRouterData, event_builder: Option<&mut ConnectorEvent>, res: Response, ) -> CustomResult<PaymentsCompleteAuthorizeRouterData, errors::ConnectorError> { let response: cybersource::CybersourcePaymentsResponse = res .response .parse_struct("Cybersource PaymentResponse") .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; event_builder.map(|i| i.set_response_body(&response)); router_env::logger::info!(connector_response=?response); RouterData::try_from(ResponseRouterData { response, data: data.clone(), http_code: res.status_code, }) } fn get_error_response( &self, res: Response, event_builder: Option<&mut ConnectorEvent>, ) -> CustomResult<ErrorResponse, errors::ConnectorError> { self.build_error_response(res, event_builder) } fn get_5xx_error_response( &self, res: Response, event_builder: Option<&mut ConnectorEvent>, ) -> CustomResult<ErrorResponse, errors::ConnectorError> { let response: cybersource::CybersourceServerErrorResponse = res .response .parse_struct("CybersourceServerErrorResponse") .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; event_builder.map(|event| event.set_response_body(&response)); router_env::logger::info!(error_response=?response); let attempt_status = match response.reason { Some(reason) => match reason { transformers::Reason::SystemError => Some(enums::AttemptStatus::Failure), transformers::Reason::ServerTimeout | transformers::Reason::ServiceTimeout => None, }, None => None, }; Ok(ErrorResponse { status_code: res.status_code, reason: response.status.clone(), code: response .status .unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_CODE.to_string()), message: response .message .unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_MESSAGE.to_string()), attempt_status, connector_transaction_id: None, network_advice_code: None, network_decline_code: None, network_error_message: None, connector_metadata: None, }) } } impl ConnectorIntegration<Void, PaymentsCancelData, PaymentsResponseData> for Cybersource { fn get_headers( &self, req: &PaymentsCancelRouterData, connectors: &Connectors, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { self.build_headers(req, connectors) } fn get_url( &self, req: &PaymentsCancelRouterData, connectors: &Connectors, ) -> CustomResult<String, errors::ConnectorError> { let connector_payment_id = req.request.connector_transaction_id.clone(); Ok(format!( "{}pts/v2/payments/{connector_payment_id}/reversals", self.base_url(connectors) )) } fn get_content_type(&self) -> &'static str { self.common_get_content_type() } fn get_request_body( &self, req: &PaymentsCancelRouterData, _connectors: &Connectors, ) -> CustomResult<RequestContent, errors::ConnectorError> { let minor_amount = req.request .minor_amount .ok_or(errors::ConnectorError::MissingRequiredField { field_name: "Amount", })?; let currency = req.request .currency .ok_or(errors::ConnectorError::MissingRequiredField { field_name: "Currency", })?; let amount = convert_amount(self.amount_converter, minor_amount, currency)?; let connector_router_data = cybersource::CybersourceRouterData::from((amount, req)); let connector_req = cybersource::CybersourceVoidRequest::try_from(&connector_router_data)?; Ok(RequestContent::Json(Box::new(connector_req))) } fn build_request( &self, req: &PaymentsCancelRouterData, connectors: &Connectors, ) -> CustomResult<Option<Request>, errors::ConnectorError> { Ok(Some( RequestBuilder::new() .method(Method::Post) .url(&PaymentsVoidType::get_url(self, req, connectors)?) .attach_default_headers() .headers(PaymentsVoidType::get_headers(self, req, connectors)?) .set_body(self.get_request_body(req, connectors)?) .build(), )) } fn handle_response( &self, data: &PaymentsCancelRouterData, event_builder: Option<&mut ConnectorEvent>, res: Response, ) -> CustomResult<PaymentsCancelRouterData, errors::ConnectorError> { let response: cybersource::CybersourcePaymentsResponse = res .response .parse_struct("Cybersource PaymentResponse") .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; event_builder.map(|i| i.set_response_body(&response)); router_env::logger::info!(connector_response=?response); RouterData::try_from(ResponseRouterData { response, data: data.clone(), http_code: res.status_code, }) } fn get_error_response( &self, res: Response, event_builder: Option<&mut ConnectorEvent>, ) -> CustomResult<ErrorResponse, errors::ConnectorError> { self.build_error_response(res, event_builder) } fn get_5xx_error_response( &self, res: Response, event_builder: Option<&mut ConnectorEvent>, ) -> CustomResult<ErrorResponse, errors::ConnectorError> { let response: cybersource::CybersourceServerErrorResponse = res .response .parse_struct("CybersourceServerErrorResponse") .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; event_builder.map(|event| event.set_response_body(&response)); router_env::logger::info!(error_response=?response); Ok(ErrorResponse { status_code: res.status_code, reason: response.status.clone(), code: response .status .unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_CODE.to_string()), message: response .message .unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_MESSAGE.to_string()), attempt_status: None, connector_transaction_id: None, network_advice_code: None, network_decline_code: None, network_error_message: None, connector_metadata: None, }) } } impl Refund for Cybersource {} impl RefundExecute for Cybersource {} impl RefundSync for Cybersource {} #[allow(dead_code)] impl ConnectorIntegration<Execute, RefundsData, RefundsResponseData> for Cybersource { fn get_headers( &self, req: &RefundExecuteRouterData, connectors: &Connectors, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { self.build_headers(req, connectors) } fn get_content_type(&self) -> &'static str { self.common_get_content_type() } fn get_url( &self, req: &RefundExecuteRouterData, connectors: &Connectors, ) -> CustomResult<String, errors::ConnectorError> { let connector_payment_id = req.request.connector_transaction_id.clone(); Ok(format!( "{}pts/v2/payments/{}/refunds", self.base_url(connectors), connector_payment_id )) } fn get_request_body( &self, req: &RefundExecuteRouterData, _connectors: &Connectors, ) -> CustomResult<RequestContent, errors::ConnectorError> { let refund_amount = convert_amount( self.amount_converter, req.request.minor_refund_amount, req.request.currency, )?; let connector_router_data = cybersource::CybersourceRouterData::from((refund_amount, req)); let connector_req = cybersource::CybersourceRefundRequest::try_from(&connector_router_data)?; Ok(RequestContent::Json(Box::new(connector_req))) } fn build_request( &self, req: &RefundExecuteRouterData, connectors: &Connectors, ) -> CustomResult<Option<Request>, errors::ConnectorError> { Ok(Some( RequestBuilder::new() .method(Method::Post) .url(&RefundExecuteType::get_url(self, req, connectors)?) .attach_default_headers() .headers(RefundExecuteType::get_headers(self, req, connectors)?) .set_body(self.get_request_body(req, connectors)?) .build(), )) } fn handle_response( &self, data: &RefundExecuteRouterData, event_builder: Option<&mut ConnectorEvent>, res: Response, ) -> CustomResult<RefundExecuteRouterData, errors::ConnectorError> { let response: cybersource::CybersourceRefundResponse = res .response .parse_struct("Cybersource RefundResponse") .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; event_builder.map(|i| i.set_response_body(&response)); router_env::logger::info!(connector_response=?response); RouterData::try_from(ResponseRouterData { response, data: data.clone(), http_code: res.status_code, }) } fn get_error_response( &self, res: Response, event_builder: Option<&mut ConnectorEvent>, ) -> CustomResult<ErrorResponse, errors::ConnectorError> { self.build_error_response(res, event_builder) } } #[allow(dead_code)] impl ConnectorIntegration<RSync, RefundsData, RefundsResponseData> for Cybersource { fn get_headers( &self, req: &RefundSyncRouterData, connectors: &Connectors, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { self.build_headers(req, connectors) } fn get_content_type(&self) -> &'static str { self.common_get_content_type() } fn get_http_method(&self) -> Method { Method::Get } fn get_url( &self, req: &RefundSyncRouterData, connectors: &Connectors, ) -> CustomResult<String, errors::ConnectorError> { let refund_id = req.request.get_connector_refund_id()?; Ok(format!( "{}tss/v2/transactions/{}", self.base_url(connectors), refund_id )) } fn build_request( &self, req: &RefundSyncRouterData, connectors: &Connectors, ) -> CustomResult<Option<Request>, errors::ConnectorError> { Ok(Some( RequestBuilder::new() .method(Method::Get) .url(&RefundSyncType::get_url(self, req, connectors)?) .attach_default_headers() .headers(RefundSyncType::get_headers(self, req, connectors)?) .build(), )) } fn handle_response( &self, data: &RefundSyncRouterData, event_builder: Option<&mut ConnectorEvent>, res: Response, ) -> CustomResult<RefundSyncRouterData, errors::ConnectorError> { let response: cybersource::CybersourceRsyncResponse = res .response .parse_struct("Cybersource RefundSyncResponse") .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; event_builder.map(|i| i.set_response_body(&response)); router_env::logger::info!(connector_response=?response); RouterData::try_from(ResponseRouterData { response, data: data.clone(), http_code: res.status_code, }) } fn get_error_response( &self, res: Response, event_builder: Option<&mut ConnectorEvent>, ) -> CustomResult<ErrorResponse, errors::ConnectorError> { self.build_error_response(res, event_builder) } } impl ConnectorIntegration< IncrementalAuthorization, PaymentsIncrementalAuthorizationData, PaymentsResponseData, > for Cybersource { fn get_headers( &self, req: &PaymentsIncrementalAuthorizationRouterData, connectors: &Connectors, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { self.build_headers(req, connectors) } fn get_http_method(&self) -> Method { Method::Patch } fn get_content_type(&self) -> &'static str { self.common_get_content_type() } fn get_url( &self, req: &PaymentsIncrementalAuthorizationRouterData, connectors: &Connectors, ) -> CustomResult<String, errors::ConnectorError> { let connector_payment_id = req.request.connector_transaction_id.clone(); Ok(format!( "{}pts/v2/payments/{}", self.base_url(connectors), connector_payment_id )) } fn get_request_body( &self, req: &PaymentsIncrementalAuthorizationRouterData, _connectors: &Connectors, ) -> CustomResult<RequestContent, errors::ConnectorError> { let minor_additional_amount = MinorUnit::new(req.request.additional_amount); let additional_amount = convert_amount( self.amount_converter, minor_additional_amount, req.request.currency, )?; let connector_router_data = cybersource::CybersourceRouterData::from((additional_amount, req)); let connector_request = cybersource::CybersourcePaymentsIncrementalAuthorizationRequest::try_from( &connector_router_data, )?; Ok(RequestContent::Json(Box::new(connector_request))) } fn build_request( &self, req: &PaymentsIncrementalAuthorizationRouterData, connectors: &Connectors, ) -> CustomResult<Option<Request>, errors::ConnectorError> { Ok(Some( RequestBuilder::new() .method(Method::Patch) .url(&IncrementalAuthorizationType::get_url( self, req, connectors, )?) .attach_default_headers() .headers(IncrementalAuthorizationType::get_headers( self, req, connectors, )?) .set_body(IncrementalAuthorizationType::get_request_body( self, req, connectors, )?) .build(), )) } fn handle_response( &self, data: &PaymentsIncrementalAuthorizationRouterData, event_builder: Option<&mut ConnectorEvent>, res: Response, ) -> CustomResult< RouterData< IncrementalAuthorization, PaymentsIncrementalAuthorizationData, PaymentsResponseData, >, errors::ConnectorError, > { let response: cybersource::CybersourcePaymentsIncrementalAuthorizationResponse = res .response .parse_struct("Cybersource PaymentResponse") .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; event_builder.map(|i| i.set_response_body(&response));
crates/hyperswitch_connectors/src/connectors/cybersource.rs#chunk1
hyperswitch_connectors
chunk
null
null
null
8,180
null
null
null
null
null
null
null
// Function: new // File: crates/currency_conversion/src/types.rs // Module: currency_conversion pub fn new(base_currency: Currency, conversion: HashMap<Currency, CurrencyFactors>) -> Self
crates/currency_conversion/src/types.rs
currency_conversion
function_signature
null
null
null
41
new
null
null
null
null
null
null
// Struct: CurrencyConversionParams // File: crates/api_models/src/currency.rs // Module: api_models // Implementations: 1 // Traits: ApiEventMetric pub struct CurrencyConversionParams
crates/api_models/src/currency.rs
api_models
struct_definition
CurrencyConversionParams
1
[ "ApiEventMetric" ]
43
null
null
null
null
null
null
null
// File: crates/analytics/src/auth_events/filters.rs // Module: analytics // Public functions: 1 // Public structs: 1 use api_models::analytics::{auth_events::AuthEventDimensions, Granularity, TimeRange}; use common_enums::{Currency, DecoupledAuthenticationType}; use common_utils::errors::ReportSwitchExt; use diesel_models::enums::{AuthenticationConnectors, AuthenticationStatus, TransactionStatus}; use error_stack::ResultExt; use time::PrimitiveDateTime; use crate::{ enums::AuthInfo, query::{Aggregate, GroupByClause, QueryBuilder, QueryFilter, ToSql, Window}, types::{ AnalyticsCollection, AnalyticsDataSource, DBEnumWrapper, FiltersError, FiltersResult, LoadRow, }, }; pub trait AuthEventFilterAnalytics: LoadRow<AuthEventFilterRow> {} pub async fn get_auth_events_filter_for_dimension<T>( dimension: AuthEventDimensions, auth: &AuthInfo, time_range: &TimeRange, pool: &T, ) -> FiltersResult<Vec<AuthEventFilterRow>> where T: AnalyticsDataSource + AuthEventFilterAnalytics, PrimitiveDateTime: ToSql<T>, AnalyticsCollection: ToSql<T>, Granularity: GroupByClause<T>, Aggregate<&'static str>: ToSql<T>, Window<&'static str>: ToSql<T>, { let mut query_builder: QueryBuilder<T> = QueryBuilder::new(AnalyticsCollection::Authentications); query_builder.add_select_column(dimension).switch()?; time_range .set_filter_clause(&mut query_builder) .attach_printable("Error filtering time range") .switch()?; query_builder.set_distinct(); auth.set_filter_clause(&mut query_builder).switch()?; query_builder .execute_query::<AuthEventFilterRow, _>(pool) .await .change_context(FiltersError::QueryBuildingError)? .change_context(FiltersError::QueryExecutionFailure) } #[derive(Debug, serde::Serialize, Eq, PartialEq, serde::Deserialize)] pub struct AuthEventFilterRow { pub authentication_status: Option<DBEnumWrapper<AuthenticationStatus>>, pub trans_status: Option<DBEnumWrapper<TransactionStatus>>, pub authentication_type: Option<DBEnumWrapper<DecoupledAuthenticationType>>, pub error_message: Option<String>, pub authentication_connector: Option<DBEnumWrapper<AuthenticationConnectors>>, pub message_version: Option<String>, pub acs_reference_number: Option<String>, pub platform: Option<String>, pub mcc: Option<String>, pub currency: Option<DBEnumWrapper<Currency>>, pub merchant_country: Option<String>, pub billing_country: Option<String>, pub shipping_country: Option<String>, pub issuer_country: Option<String>, pub earliest_supported_version: Option<String>, pub latest_supported_version: Option<String>, pub whitelist_decision: Option<bool>, pub device_manufacturer: Option<String>, pub device_type: Option<String>, pub device_brand: Option<String>, pub device_os: Option<String>, pub device_display: Option<String>, pub browser_name: Option<String>, pub browser_version: Option<String>, pub issuer_id: Option<String>, pub scheme_name: Option<String>, pub exemption_requested: Option<bool>, pub exemption_accepted: Option<bool>, }
crates/analytics/src/auth_events/filters.rs
analytics
full_file
null
null
null
700
null
null
null
null
null
null
null
// Implementation: impl api::MandateSetup for for Vgs // File: crates/hyperswitch_connectors/src/connectors/vgs.rs // Module: hyperswitch_connectors // Methods: 0 total (0 public) impl api::MandateSetup for for Vgs
crates/hyperswitch_connectors/src/connectors/vgs.rs
hyperswitch_connectors
impl_block
null
null
null
61
null
Vgs
api::MandateSetup for
0
0
null
null
// Function: revenue_recovery_data_backfill // File: crates/router/src/core/revenue_recovery_data_backfill.rs // Module: router pub fn revenue_recovery_data_backfill( state: SessionState, records: Vec<RevenueRecoveryBackfillRequest>, cutoff_datetime: Option<time::PrimitiveDateTime>, ) -> RouterResult<ApplicationResponse<RevenueRecoveryDataBackfillResponse>>
crates/router/src/core/revenue_recovery_data_backfill.rs
router
function_signature
null
null
null
81
revenue_recovery_data_backfill
null
null
null
null
null
null
// Implementation: impl api::PaymentSync for for Inespay // File: crates/hyperswitch_connectors/src/connectors/inespay.rs // Module: hyperswitch_connectors // Methods: 0 total (0 public) impl api::PaymentSync for for Inespay
crates/hyperswitch_connectors/src/connectors/inespay.rs
hyperswitch_connectors
impl_block
null
null
null
60
null
Inespay
api::PaymentSync for
0
0
null
null
// Implementation: impl Default for for ConsumerSettings // File: crates/scheduler/src/settings.rs // Module: scheduler // Methods: 1 total (0 public) impl Default for for ConsumerSettings
crates/scheduler/src/settings.rs
scheduler
impl_block
null
null
null
41
null
ConsumerSettings
Default for
1
0
null
null
// Trait: ErrorSwitch // File: crates/common_utils/src/errors.rs // Module: common_utils // Documentation: Allow [error_stack::Report] to convert between error types This auto-implements [ReportSwitchExt] for the corresponding errors pub trait ErrorSwitch<T>
crates/common_utils/src/errors.rs
common_utils
trait_definition
null
null
null
57
null
null
ErrorSwitch
null
null
null
null
// Implementation: impl DatabaseStore for for RouterStore // File: crates/storage_impl/src/lib.rs // Module: storage_impl // Methods: 5 total (0 public) impl DatabaseStore for for RouterStore
crates/storage_impl/src/lib.rs
storage_impl
impl_block
null
null
null
44
null
RouterStore
DatabaseStore for
5
0
null
null
// Function: set_error_response_body // File: crates/hyperswitch_interfaces/src/events/connector_api_logs.rs // Module: hyperswitch_interfaces // Documentation: fn set_error_response_body pub fn set_error_response_body<T: Serialize>(&mut self, response: &T)
crates/hyperswitch_interfaces/src/events/connector_api_logs.rs
hyperswitch_interfaces
function_signature
null
null
null
59
set_error_response_body
null
null
null
null
null
null
// Struct: PayloadRouterData // File: crates/hyperswitch_connectors/src/connectors/payload/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct PayloadRouterData<T>
crates/hyperswitch_connectors/src/connectors/payload/transformers.rs
hyperswitch_connectors
struct_definition
PayloadRouterData
0
[]
49
null
null
null
null
null
null
null
// Struct: LockingInput // File: crates/router/src/core/api_locking.rs // Module: router // Implementations: 1 pub struct LockingInput
crates/router/src/core/api_locking.rs
router
struct_definition
LockingInput
1
[]
36
null
null
null
null
null
null
null
// Trait: RequestIdStore // File: crates/router/src/db.rs // Module: router pub trait RequestIdStore
crates/router/src/db.rs
router
trait_definition
null
null
null
26
null
null
RequestIdStore
null
null
null
null
// Function: try_get_enum_variant // File: crates/router_derive/src/macros/try_get_enum.rs // Module: router_derive // Documentation: Try and get the variants for an enum pub fn try_get_enum_variant( input: syn::DeriveInput, ) -> Result<proc_macro2::TokenStream, syn::Error>
crates/router_derive/src/macros/try_get_enum.rs
router_derive
function_signature
null
null
null
74
try_get_enum_variant
null
null
null
null
null
null
// Implementation: impl Rapyd // File: crates/hyperswitch_connectors/src/connectors/rapyd.rs // Module: hyperswitch_connectors // Methods: 1 total (1 public) impl Rapyd
crates/hyperswitch_connectors/src/connectors/rapyd.rs
hyperswitch_connectors
impl_block
null
null
null
48
null
Rapyd
null
1
1
null
null
// Implementation: impl api::Payment for for Payme // File: crates/hyperswitch_connectors/src/connectors/payme.rs // Module: hyperswitch_connectors // Methods: 0 total (0 public) impl api::Payment for for Payme
crates/hyperswitch_connectors/src/connectors/payme.rs
hyperswitch_connectors
impl_block
null
null
null
55
null
Payme
api::Payment for
0
0
null
null
// File: crates/router/src/routes.rs // Module: router pub mod admin; pub mod api_keys; pub mod app; #[cfg(feature = "v1")] pub mod apple_pay_certificates_migration; pub mod authentication; #[cfg(all(feature = "olap", feature = "v1"))] pub mod blocklist; pub mod cache; pub mod cards_info; pub mod configs; #[cfg(feature = "olap")] pub mod connector_onboarding; #[cfg(any(feature = "olap", feature = "oltp"))] pub mod currency; pub mod customers; pub mod disputes; #[cfg(feature = "dummy_connector")] pub mod dummy_connector; pub mod ephemeral_key; pub mod feature_matrix; pub mod files; #[cfg(feature = "frm")] pub mod fraud_check; pub mod gsm; pub mod health; pub mod hypersense; pub mod lock_utils; #[cfg(feature = "v1")] pub mod locker_migration; pub mod mandates; pub mod metrics; #[cfg(feature = "v1")] pub mod payment_link; pub mod payment_methods; pub mod payments; #[cfg(feature = "payouts")] pub mod payout_link; #[cfg(feature = "payouts")] pub mod payouts; #[cfg(any(feature = "olap", feature = "oltp"))] pub mod pm_auth; pub mod poll; #[cfg(feature = "olap")] pub mod profile_acquirer; #[cfg(feature = "olap")] pub mod profiles; #[cfg(feature = "recon")] pub mod recon; pub mod refunds; #[cfg(feature = "v2")] pub mod revenue_recovery_data_backfill; #[cfg(feature = "olap")] pub mod routing; #[cfg(feature = "v1")] pub mod subscription; pub mod three_ds_decision_rule; pub mod tokenization; #[cfg(feature = "olap")] pub mod user; #[cfg(feature = "olap")] pub mod user_role; #[cfg(feature = "olap")] pub mod verification; #[cfg(feature = "olap")] pub mod verify_connector; #[cfg(all(feature = "olap", feature = "v1"))] pub mod webhook_events; pub mod webhooks; #[cfg(all(feature = "v2", feature = "revenue_recovery"))] pub mod recovery_webhooks; pub mod relay; #[cfg(feature = "olap")] pub mod process_tracker; #[cfg(feature = "v2")] pub mod proxy; pub mod chat; #[cfg(feature = "dummy_connector")] pub use self::app::DummyConnector; #[cfg(feature = "v2")] pub use self::app::PaymentMethodSession; #[cfg(all(feature = "oltp", feature = "v2"))] pub use self::app::Proxy; #[cfg(all(feature = "olap", feature = "recon", feature = "v1"))] pub use self::app::Recon; pub use self::app::{ ApiKeys, AppState, ApplePayCertificatesMigration, Authentication, Cache, Cards, Chat, Configs, ConnectorOnboarding, Customers, Disputes, EphemeralKey, FeatureMatrix, Files, Forex, Gsm, Health, Hypersense, Mandates, MerchantAccount, MerchantConnectorAccount, PaymentLink, PaymentMethods, Payments, Poll, ProcessTracker, ProcessTrackerDeprecated, Profile, ProfileAcquirer, ProfileNew, Refunds, Relay, RelayWebhooks, SessionState, ThreeDsDecisionRule, User, UserDeprecated, Webhooks, }; #[cfg(feature = "olap")] pub use self::app::{Blocklist, Organization, Routing, Subscription, Verify, WebhookEvents}; #[cfg(feature = "payouts")] pub use self::app::{PayoutLink, Payouts}; #[cfg(feature = "v2")] pub use self::app::{RecoveryDataBackfill, Tokenization}; #[cfg(all(feature = "stripe", feature = "v1"))] pub use super::compatibility::stripe::StripeApis; #[cfg(feature = "olap")] pub use crate::analytics::routes::{self as analytics, Analytics};
crates/router/src/routes.rs
router
full_file
null
null
null
843
null
null
null
null
null
null
null
// Struct: VaultTransactionBody // File: crates/hyperswitch_connectors/src/connectors/braintree/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct VaultTransactionBody
crates/hyperswitch_connectors/src/connectors/braintree/transformers.rs
hyperswitch_connectors
struct_definition
VaultTransactionBody
0
[]
48
null
null
null
null
null
null
null
// Struct: FiservemeaVoidRequest // File: crates/hyperswitch_connectors/src/connectors/fiservemea/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct FiservemeaVoidRequest
crates/hyperswitch_connectors/src/connectors/fiservemea/transformers.rs
hyperswitch_connectors
struct_definition
FiservemeaVoidRequest
0
[]
58
null
null
null
null
null
null
null
// Struct: CybersourceThreeDSMetadata // File: crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct CybersourceThreeDSMetadata
crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs
hyperswitch_connectors
struct_definition
CybersourceThreeDSMetadata
0
[]
55
null
null
null
null
null
null
null
// Struct: CryptopayRouterData // File: crates/hyperswitch_connectors/src/connectors/cryptopay/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct CryptopayRouterData<T>
crates/hyperswitch_connectors/src/connectors/cryptopay/transformers.rs
hyperswitch_connectors
struct_definition
CryptopayRouterData
0
[]
55
null
null
null
null
null
null
null
// File: crates/analytics/src/auth_events/metrics/authentication_exemption_approved_count.rs // Module: analytics use std::collections::HashSet; use api_models::analytics::{ auth_events::{AuthEventDimensions, AuthEventFilters, AuthEventMetricsBucketIdentifier}, Granularity, TimeRange, }; use common_utils::errors::ReportSwitchExt; use error_stack::ResultExt; use time::PrimitiveDateTime; use super::AuthEventMetricRow; use crate::{ query::{Aggregate, GroupByClause, QueryBuilder, QueryFilter, SeriesBucket, ToSql, Window}, types::{AnalyticsCollection, AnalyticsDataSource, MetricsError, MetricsResult}, AuthInfo, }; #[derive(Default)] pub(super) struct AuthenticationExemptionApprovedCount; #[async_trait::async_trait] impl<T> super::AuthEventMetric<T> for AuthenticationExemptionApprovedCount where T: AnalyticsDataSource + super::AuthEventMetricAnalytics, PrimitiveDateTime: ToSql<T>, AnalyticsCollection: ToSql<T>, Granularity: GroupByClause<T>, Aggregate<&'static str>: ToSql<T>, Window<&'static str>: ToSql<T>, { async fn load_metrics( &self, auth: &AuthInfo, dimensions: &[AuthEventDimensions], filters: &AuthEventFilters, granularity: Option<Granularity>, time_range: &TimeRange, pool: &T, ) -> MetricsResult<HashSet<(AuthEventMetricsBucketIdentifier, AuthEventMetricRow)>> { let mut query_builder: QueryBuilder<T> = QueryBuilder::new(AnalyticsCollection::Authentications); 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::Min { field: "created_at", alias: Some("start_bucket"), }) .switch()?; query_builder .add_select_column(Aggregate::Max { field: "created_at", alias: Some("end_bucket"), }) .switch()?; query_builder .add_filter_clause(AuthEventDimensions::ExemptionAccepted, true) .switch()?; filters.set_filter_clause(&mut query_builder).switch()?; time_range .set_filter_clause(&mut query_builder) .attach_printable("Error filtering time range") .switch()?; auth.set_filter_clause(&mut query_builder).switch()?; for dim in dimensions.iter() { query_builder .add_group_by_clause(dim) .attach_printable("Error grouping by dimensions") .switch()?; } if let Some(granularity) = granularity { granularity .set_group_by_clause(&mut query_builder) .attach_printable("Error adding granularity") .switch()?; } query_builder .execute_query::<AuthEventMetricRow, _>(pool) .await .change_context(MetricsError::QueryBuildingError)? .change_context(MetricsError::QueryExecutionFailure)? .into_iter() .map(|i| { Ok(( AuthEventMetricsBucketIdentifier::new( i.authentication_status.as_ref().map(|i| i.0), i.trans_status.as_ref().map(|i| i.0.clone()), i.authentication_type.as_ref().map(|i| i.0), i.error_message.clone(), i.authentication_connector.as_ref().map(|i| i.0), i.message_version.clone(), i.acs_reference_number.clone(), i.mcc.clone(), i.currency.as_ref().map(|i| i.0), i.merchant_country.clone(), i.billing_country.clone(), i.shipping_country.clone(), i.issuer_country.clone(), i.earliest_supported_version.clone(), i.latest_supported_version.clone(), i.whitelist_decision, i.device_manufacturer.clone(), i.device_type.clone(), i.device_brand.clone(), i.device_os.clone(), i.device_display.clone(), i.browser_name.clone(), i.browser_version.clone(), i.issuer_id.clone(), i.scheme_name.clone(), i.exemption_requested, i.exemption_accepted, 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<(AuthEventMetricsBucketIdentifier, AuthEventMetricRow)>, crate::query::PostProcessingError, >>() .change_context(MetricsError::PostProcessingFailure) } }
crates/analytics/src/auth_events/metrics/authentication_exemption_approved_count.rs
analytics
full_file
null
null
null
1,059
null
null
null
null
null
null
null
// Struct: RoutingEvent // File: crates/hyperswitch_interfaces/src/events/routing_api_logs.rs // Module: hyperswitch_interfaces // Implementations: 1 // Documentation: RoutingEvent type pub struct RoutingEvent
crates/hyperswitch_interfaces/src/events/routing_api_logs.rs
hyperswitch_interfaces
struct_definition
RoutingEvent
1
[]
48
null
null
null
null
null
null
null
// Function: get_multiple_dashboard_metadata // File: crates/router/src/routes/user.rs // Module: router pub fn get_multiple_dashboard_metadata( state: web::Data<AppState>, req: HttpRequest, query: web::Query<user_api::dashboard_metadata::GetMultipleMetaDataRequest>, ) -> HttpResponse
crates/router/src/routes/user.rs
router
function_signature
null
null
null
65
get_multiple_dashboard_metadata
null
null
null
null
null
null
// Function: get_payment_dimensions // File: crates/analytics/src/utils.rs // Module: analytics pub fn get_payment_dimensions() -> Vec<NameDescription>
crates/analytics/src/utils.rs
analytics
function_signature
null
null
null
34
get_payment_dimensions
null
null
null
null
null
null
// Struct: NuveiSessionRequest // File: crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct NuveiSessionRequest
crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs
hyperswitch_connectors
struct_definition
NuveiSessionRequest
0
[]
53
null
null
null
null
null
null
null
// Struct: CybersourceRefundResponse // File: crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct CybersourceRefundResponse
crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs
hyperswitch_connectors
struct_definition
CybersourceRefundResponse
0
[]
55
null
null
null
null
null
null
null
// Function: check_if_connector_exists // File: crates/router/src/utils/connector_onboarding.rs // Module: router pub fn check_if_connector_exists( state: &SessionState, connector_id: &common_utils::id_type::MerchantConnectorAccountId, merchant_id: &common_utils::id_type::MerchantId, ) -> RouterResult<()>
crates/router/src/utils/connector_onboarding.rs
router
function_signature
null
null
null
74
check_if_connector_exists
null
null
null
null
null
null
// Struct: Errors // File: crates/hyperswitch_connectors/src/connectors/trustpay/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct Errors
crates/hyperswitch_connectors/src/connectors/trustpay/transformers.rs
hyperswitch_connectors
struct_definition
Errors
0
[]
44
null
null
null
null
null
null
null
// Function: from // File: crates/hyperswitch_domain_models/src/relay.rs // Module: hyperswitch_domain_models pub fn from( response: Result<router_response_types::RefundsResponseData, ErrorResponse>, ) -> Self
crates/hyperswitch_domain_models/src/relay.rs
hyperswitch_domain_models
function_signature
null
null
null
52
from
null
null
null
null
null
null
// Implementation: impl IncomingWebhook for for Wellsfargopayout // File: crates/hyperswitch_connectors/src/connectors/wellsfargopayout.rs // Module: hyperswitch_connectors // Methods: 3 total (0 public) impl IncomingWebhook for for Wellsfargopayout
crates/hyperswitch_connectors/src/connectors/wellsfargopayout.rs
hyperswitch_connectors
impl_block
null
null
null
65
null
Wellsfargopayout
IncomingWebhook for
3
0
null
null
// Implementation: impl Default for for Mandates // File: crates/payment_methods/src/configs/payment_connector_required_fields.rs // Module: payment_methods // Methods: 1 total (0 public) impl Default for for Mandates
crates/payment_methods/src/configs/payment_connector_required_fields.rs
payment_methods
impl_block
null
null
null
47
null
Mandates
Default for
1
0
null
null
// Function: refund_retrieve_core // File: crates/router/src/core/refunds_v2.rs // Module: router pub fn refund_retrieve_core( state: SessionState, merchant_context: domain::MerchantContext, profile_id: Option<id_type::ProfileId>, request: refunds::RefundsRetrieveRequest, refund: diesel_refund::Refund, ) -> errors::RouterResult<diesel_refund::Refund>
crates/router/src/core/refunds_v2.rs
router
function_signature
null
null
null
94
refund_retrieve_core
null
null
null
null
null
null
// Function: payment_method_retrieve_api // File: crates/openapi/src/routes/payment_method.rs // Module: openapi pub fn payment_method_retrieve_api()
crates/openapi/src/routes/payment_method.rs
openapi
function_signature
null
null
null
35
payment_method_retrieve_api
null
null
null
null
null
null
// Implementation: impl ConnectorCommon for for Authipay // File: crates/hyperswitch_connectors/src/connectors/authipay.rs // Module: hyperswitch_connectors // Methods: 6 total (0 public) impl ConnectorCommon for for Authipay
crates/hyperswitch_connectors/src/connectors/authipay.rs
hyperswitch_connectors
impl_block
null
null
null
53
null
Authipay
ConnectorCommon for
6
0
null
null
// Struct: WebhookEventDataResourceEvent // File: crates/hyperswitch_connectors/src/connectors/payme/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct WebhookEventDataResourceEvent
crates/hyperswitch_connectors/src/connectors/payme/transformers.rs
hyperswitch_connectors
struct_definition
WebhookEventDataResourceEvent
0
[]
51
null
null
null
null
null
null
null
// Function: option_to_result // File: crates/hyperswitch_connectors/src/connectors/novalnet/transformers.rs // Module: hyperswitch_connectors pub fn option_to_result<T>(opt: Option<T>) -> Result<T, errors::ConnectorError>
crates/hyperswitch_connectors/src/connectors/novalnet/transformers.rs
hyperswitch_connectors
function_signature
null
null
null
57
option_to_result
null
null
null
null
null
null
// File: crates/analytics/src/auth_events/metrics/challenge_attempt_count.rs // Module: analytics use std::collections::HashSet; use api_models::analytics::{ auth_events::{AuthEventDimensions, AuthEventFilters, AuthEventMetricsBucketIdentifier}, Granularity, TimeRange, }; use common_enums::{AuthenticationStatus, DecoupledAuthenticationType}; use common_utils::errors::ReportSwitchExt; use error_stack::ResultExt; use time::PrimitiveDateTime; use super::AuthEventMetricRow; use crate::{ query::{Aggregate, GroupByClause, QueryBuilder, QueryFilter, SeriesBucket, ToSql, Window}, types::{AnalyticsCollection, AnalyticsDataSource, MetricsError, MetricsResult}, AuthInfo, }; #[derive(Default)] pub(super) struct ChallengeAttemptCount; #[async_trait::async_trait] impl<T> super::AuthEventMetric<T> for ChallengeAttemptCount where T: AnalyticsDataSource + super::AuthEventMetricAnalytics, PrimitiveDateTime: ToSql<T>, AnalyticsCollection: ToSql<T>, Granularity: GroupByClause<T>, Aggregate<&'static str>: ToSql<T>, Window<&'static str>: ToSql<T>, { async fn load_metrics( &self, auth: &AuthInfo, dimensions: &[AuthEventDimensions], filters: &AuthEventFilters, granularity: Option<Granularity>, time_range: &TimeRange, pool: &T, ) -> MetricsResult<HashSet<(AuthEventMetricsBucketIdentifier, AuthEventMetricRow)>> { let mut query_builder: QueryBuilder<T> = QueryBuilder::new(AnalyticsCollection::Authentications); 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::Min { field: "created_at", alias: Some("start_bucket"), }) .switch()?; query_builder .add_select_column(Aggregate::Max { field: "created_at", alias: Some("end_bucket"), }) .switch()?; query_builder .add_filter_clause( "authentication_type", DecoupledAuthenticationType::Challenge, ) .switch()?; query_builder .add_filter_in_range_clause( "authentication_status", &[AuthenticationStatus::Success, AuthenticationStatus::Failed], ) .switch()?; filters.set_filter_clause(&mut query_builder).switch()?; time_range .set_filter_clause(&mut query_builder) .attach_printable("Error filtering time range") .switch()?; auth.set_filter_clause(&mut query_builder).switch()?; for dim in dimensions.iter() { query_builder .add_group_by_clause(dim) .attach_printable("Error grouping by dimensions") .switch()?; } if let Some(granularity) = granularity { granularity .set_group_by_clause(&mut query_builder) .attach_printable("Error adding granularity") .switch()?; } query_builder .execute_query::<AuthEventMetricRow, _>(pool) .await .change_context(MetricsError::QueryBuildingError)? .change_context(MetricsError::QueryExecutionFailure)? .into_iter() .map(|i| { Ok(( AuthEventMetricsBucketIdentifier::new( i.authentication_status.as_ref().map(|i| i.0), i.trans_status.as_ref().map(|i| i.0.clone()), i.authentication_type.as_ref().map(|i| i.0), i.error_message.clone(), i.authentication_connector.as_ref().map(|i| i.0), i.message_version.clone(), i.acs_reference_number.clone(), i.mcc.clone(), i.currency.as_ref().map(|i| i.0), i.merchant_country.clone(), i.billing_country.clone(), i.shipping_country.clone(), i.issuer_country.clone(), i.earliest_supported_version.clone(), i.latest_supported_version.clone(), i.whitelist_decision, i.device_manufacturer.clone(), i.device_type.clone(), i.device_brand.clone(), i.device_os.clone(), i.device_display.clone(), i.browser_name.clone(), i.browser_version.clone(), i.issuer_id.clone(), i.scheme_name.clone(), i.exemption_requested, i.exemption_accepted, 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<(AuthEventMetricsBucketIdentifier, AuthEventMetricRow)>, crate::query::PostProcessingError, >>() .change_context(MetricsError::PostProcessingFailure) } }
crates/analytics/src/auth_events/metrics/challenge_attempt_count.rs
analytics
full_file
null
null
null
1,111
null
null
null
null
null
null
null
// Struct: NoKey // File: crates/test_utils/src/connector_auth.rs // Module: test_utils // Implementations: 0 pub struct NoKey
crates/test_utils/src/connector_auth.rs
test_utils
struct_definition
NoKey
0
[]
35
null
null
null
null
null
null
null
// Implementation: impl api::MandateSetup for for Cashtocode // File: crates/hyperswitch_connectors/src/connectors/cashtocode.rs // Module: hyperswitch_connectors // Methods: 0 total (0 public) impl api::MandateSetup for for Cashtocode
crates/hyperswitch_connectors/src/connectors/cashtocode.rs
hyperswitch_connectors
impl_block
null
null
null
65
null
Cashtocode
api::MandateSetup for
0
0
null
null
// Implementation: impl api::Refund for for Taxjar // File: crates/hyperswitch_connectors/src/connectors/taxjar.rs // Module: hyperswitch_connectors // Methods: 0 total (0 public) impl api::Refund for for Taxjar
crates/hyperswitch_connectors/src/connectors/taxjar.rs
hyperswitch_connectors
impl_block
null
null
null
58
null
Taxjar
api::Refund for
0
0
null
null
pub struct BarclaycardTransactionResponse { id: String, application_information: ApplicationInformation, client_reference_information: Option<ClientReferenceInformation>, processor_information: Option<ClientProcessorInformation>, processing_information: Option<ProcessingInformationResponse>, payment_information: Option<PaymentInformationResponse>, payment_insights_information: Option<PaymentInsightsInformation>, error_information: Option<BarclaycardErrorInformation>, fraud_marking_information: Option<FraudMarkingInformation>, risk_information: Option<ClientRiskInformation>, reconciliation_id: Option<String>, consumer_authentication_information: Option<ConsumerAuthenticationInformation>, } #[derive(Debug, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct FraudMarkingInformation { reason: Option<String>, } #[derive(Debug, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct ApplicationInformation { status: Option<BarclaycardPaymentStatus>, } impl<F> TryFrom< ResponseRouterData< F, BarclaycardTransactionResponse, PaymentsSyncData, PaymentsResponseData, >, > for RouterData<F, PaymentsSyncData, PaymentsResponseData> { type Error = error_stack::Report<errors::ConnectorError>; fn try_from( item: ResponseRouterData< F, BarclaycardTransactionResponse, PaymentsSyncData, PaymentsResponseData, >, ) -> Result<Self, Self::Error> { match item.response.application_information.status { Some(app_status) => { let status = map_barclaycard_attempt_status(( app_status, item.data.request.is_auto_capture()?, )); let connector_response = match item.data.payment_method { common_enums::PaymentMethod::Card => item .response .processor_information .as_ref() .and_then(|processor_information| { item.response .consumer_authentication_information .as_ref() .map(|consumer_auth_information| { convert_to_additional_payment_method_connector_response( processor_information, consumer_auth_information, ) }) }) .map(ConnectorResponseData::with_additional_payment_method_data), common_enums::PaymentMethod::CardRedirect | common_enums::PaymentMethod::PayLater | common_enums::PaymentMethod::Wallet | common_enums::PaymentMethod::BankRedirect | common_enums::PaymentMethod::BankTransfer | common_enums::PaymentMethod::Crypto | common_enums::PaymentMethod::BankDebit | common_enums::PaymentMethod::Reward | common_enums::PaymentMethod::RealTimePayment | common_enums::PaymentMethod::MobilePayment | common_enums::PaymentMethod::Upi | common_enums::PaymentMethod::Voucher | common_enums::PaymentMethod::OpenBanking | common_enums::PaymentMethod::GiftCard => None, }; let risk_info: Option<ClientRiskInformation> = None; if utils::is_payment_failure(status) { Ok(Self { response: Err(get_error_response( &item.response.error_information, &item.response.processor_information, &risk_info, Some(status), item.http_code, item.response.id.clone(), )), status: enums::AttemptStatus::Failure, connector_response, ..item.data }) } else { Ok(Self { status, response: Ok(PaymentsResponseData::TransactionResponse { resource_id: ResponseId::ConnectorTransactionId( item.response.id.clone(), ), redirection_data: Box::new(None), mandate_reference: Box::new(None), connector_metadata: None, network_txn_id: None, connector_response_reference_id: item .response .client_reference_information .map(|cref| cref.code) .unwrap_or(Some(item.response.id)), incremental_authorization_allowed: None, charges: None, }), connector_response, ..item.data }) } } None => Ok(Self { status: item.data.status, response: Ok(PaymentsResponseData::TransactionResponse { resource_id: ResponseId::ConnectorTransactionId(item.response.id.clone()), redirection_data: Box::new(None), mandate_reference: Box::new(None), connector_metadata: None, network_txn_id: None, connector_response_reference_id: Some(item.response.id), incremental_authorization_allowed: None, charges: None, }), ..item.data }), } } } impl<F> TryFrom< ResponseRouterData< F, BarclaycardPaymentsResponse, CompleteAuthorizeData, PaymentsResponseData, >, > for RouterData<F, CompleteAuthorizeData, PaymentsResponseData> { type Error = error_stack::Report<errors::ConnectorError>; fn try_from( item: ResponseRouterData< F, BarclaycardPaymentsResponse, CompleteAuthorizeData, PaymentsResponseData, >, ) -> Result<Self, Self::Error> { match item.response { BarclaycardPaymentsResponse::ClientReferenceInformation(info_response) => { let status = map_barclaycard_attempt_status(( info_response .status .clone() .unwrap_or(BarclaycardPaymentStatus::StatusNotReceived), item.data.request.is_auto_capture()?, )); let response = get_payment_response((&info_response, status, item.http_code)) .map_err(|err| *err); let connector_response = info_response .processor_information .as_ref() .map(AdditionalPaymentMethodConnectorResponse::from) .map(ConnectorResponseData::with_additional_payment_method_data); Ok(Self { status, response, connector_response, ..item.data }) } BarclaycardPaymentsResponse::ErrorInformation(ref error_response) => { Ok(map_error_response(&error_response.clone(), item, None)) } } } } impl From<&ClientProcessorInformation> for AdditionalPaymentMethodConnectorResponse { fn from(processor_information: &ClientProcessorInformation) -> Self { let payment_checks = Some( serde_json::json!({"avs_response": processor_information.avs, "card_verification": processor_information.card_verification}), ); Self::Card { authentication_data: None, payment_checks, card_network: None, domestic_network: None, } } } #[derive(Debug, Serialize)] #[serde(rename_all = "camelCase")] pub struct OrderInformation { amount_details: Amount, } #[derive(Debug, Serialize)] #[serde(rename_all = "camelCase")] pub struct BarclaycardCaptureRequest { order_information: OrderInformation, client_reference_information: ClientReferenceInformation, #[serde(skip_serializing_if = "Option::is_none")] merchant_defined_information: Option<Vec<MerchantDefinedInformation>>, } impl TryFrom<&BarclaycardRouterData<&PaymentsCaptureRouterData>> for BarclaycardCaptureRequest { type Error = error_stack::Report<errors::ConnectorError>; fn try_from( value: &BarclaycardRouterData<&PaymentsCaptureRouterData>, ) -> Result<Self, Self::Error> { let merchant_defined_information = value .router_data .request .metadata .clone() .map(convert_metadata_to_merchant_defined_info); Ok(Self { order_information: OrderInformation { amount_details: Amount { total_amount: value.amount.to_owned(), currency: value.router_data.request.currency, }, }, client_reference_information: ClientReferenceInformation { code: Some(value.router_data.connector_request_reference_id.clone()), }, merchant_defined_information, }) } } #[derive(Debug, Serialize)] #[serde(rename_all = "camelCase")] pub struct BarclaycardVoidRequest { client_reference_information: ClientReferenceInformation, reversal_information: ReversalInformation, #[serde(skip_serializing_if = "Option::is_none")] merchant_defined_information: Option<Vec<MerchantDefinedInformation>>, // The connector documentation does not mention the merchantDefinedInformation field for Void requests. But this has been still added because it works! } #[derive(Debug, Serialize)] #[serde(rename_all = "camelCase")] pub struct ReversalInformation { amount_details: Amount, reason: String, } impl TryFrom<&BarclaycardRouterData<&PaymentsCancelRouterData>> for BarclaycardVoidRequest { type Error = error_stack::Report<errors::ConnectorError>; fn try_from( value: &BarclaycardRouterData<&PaymentsCancelRouterData>, ) -> Result<Self, Self::Error> { let merchant_defined_information = value .router_data .request .metadata .clone() .map(convert_metadata_to_merchant_defined_info); Ok(Self { client_reference_information: ClientReferenceInformation { code: Some(value.router_data.connector_request_reference_id.clone()), }, reversal_information: ReversalInformation { amount_details: Amount { total_amount: value.amount.to_owned(), currency: value.router_data.request.currency.ok_or( errors::ConnectorError::MissingRequiredField { field_name: "Currency", }, )?, }, reason: value .router_data .request .cancellation_reason .clone() .ok_or(errors::ConnectorError::MissingRequiredField { field_name: "Cancellation Reason", })?, }, merchant_defined_information, }) } } #[derive(Debug, Serialize)] #[serde(rename_all = "camelCase")] pub struct BarclaycardRefundRequest { order_information: OrderInformation, client_reference_information: ClientReferenceInformation, } impl<F> TryFrom<&BarclaycardRouterData<&RefundsRouterData<F>>> for BarclaycardRefundRequest { type Error = error_stack::Report<errors::ConnectorError>; fn try_from(item: &BarclaycardRouterData<&RefundsRouterData<F>>) -> Result<Self, Self::Error> { Ok(Self { order_information: OrderInformation { amount_details: Amount { total_amount: item.amount.clone(), currency: item.router_data.request.currency, }, }, client_reference_information: ClientReferenceInformation { code: Some(item.router_data.request.refund_id.clone()), }, }) } } impl From<BarclaycardRefundResponse> for enums::RefundStatus { fn from(item: BarclaycardRefundResponse) -> Self { let error_reason = item .error_information .and_then(|error_info| error_info.reason); match item.status { BarclaycardRefundStatus::Succeeded | BarclaycardRefundStatus::Transmitted => { Self::Success } BarclaycardRefundStatus::Cancelled | BarclaycardRefundStatus::Failed | BarclaycardRefundStatus::Voided => Self::Failure, BarclaycardRefundStatus::Pending => Self::Pending, BarclaycardRefundStatus::TwoZeroOne => { if error_reason == Some("PROCESSOR_DECLINED".to_string()) { Self::Failure } else { Self::Pending } } } } } #[derive(Debug, Clone, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct BarclaycardRefundResponse { id: String, status: BarclaycardRefundStatus, error_information: Option<BarclaycardErrorInformation>, } impl TryFrom<RefundsResponseRouterData<Execute, BarclaycardRefundResponse>> for RefundsRouterData<Execute> { type Error = error_stack::Report<errors::ConnectorError>; fn try_from( item: RefundsResponseRouterData<Execute, BarclaycardRefundResponse>, ) -> Result<Self, Self::Error> { let refund_status = enums::RefundStatus::from(item.response.clone()); let response = if utils::is_refund_failure(refund_status) { Err(get_error_response( &item.response.error_information, &None, &None, None, item.http_code, item.response.id, )) } else { Ok(RefundsResponseData { connector_refund_id: item.response.id, refund_status, }) }; Ok(Self { response, ..item.data }) } } #[derive(Debug, Clone, PartialEq, Deserialize, Serialize)] #[serde(rename_all = "SCREAMING_SNAKE_CASE")] pub enum BarclaycardRefundStatus { Succeeded, Transmitted, Failed, Pending, Voided, Cancelled, #[serde(rename = "201")] TwoZeroOne, } #[derive(Debug, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct RsyncApplicationInformation { status: Option<BarclaycardRefundStatus>, } #[derive(Debug, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct BarclaycardRsyncResponse { id: String, application_information: Option<RsyncApplicationInformation>, error_information: Option<BarclaycardErrorInformation>, } impl TryFrom<RefundsResponseRouterData<RSync, BarclaycardRsyncResponse>> for RefundsRouterData<RSync> { type Error = error_stack::Report<errors::ConnectorError>; fn try_from( item: RefundsResponseRouterData<RSync, BarclaycardRsyncResponse>, ) -> Result<Self, Self::Error> { let response = match item .response .application_information .and_then(|application_information| application_information.status) { Some(status) => { let error_reason = item .response .error_information .clone() .and_then(|error_info| error_info.reason); let refund_status = match status { BarclaycardRefundStatus::Succeeded | BarclaycardRefundStatus::Transmitted => { enums::RefundStatus::Success } BarclaycardRefundStatus::Cancelled | BarclaycardRefundStatus::Failed | BarclaycardRefundStatus::Voided => enums::RefundStatus::Failure, BarclaycardRefundStatus::Pending => enums::RefundStatus::Pending, BarclaycardRefundStatus::TwoZeroOne => { if error_reason == Some("PROCESSOR_DECLINED".to_string()) { enums::RefundStatus::Failure } else { enums::RefundStatus::Pending } } }; if utils::is_refund_failure(refund_status) { if status == BarclaycardRefundStatus::Voided { Err(get_error_response( &Some(BarclaycardErrorInformation { message: Some(constants::REFUND_VOIDED.to_string()), reason: Some(constants::REFUND_VOIDED.to_string()), details: None, }), &None, &None, None, item.http_code, item.response.id.clone(), )) } else { Err(get_error_response( &item.response.error_information, &None, &None, None, item.http_code, item.response.id.clone(), )) } } else { Ok(RefundsResponseData { connector_refund_id: item.response.id, refund_status, }) } } None => Ok(RefundsResponseData { connector_refund_id: item.response.id.clone(), refund_status: match item.data.response { Ok(response) => response.refund_status, Err(_) => common_enums::RefundStatus::Pending, }, }), }; Ok(Self { response, ..item.data }) } } #[derive(Debug, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct BarclaycardStandardErrorResponse { pub error_information: Option<ErrorInformation>, pub status: Option<String>, pub message: Option<String>, pub reason: Option<String>, pub details: Option<Vec<Details>>, } #[derive(Debug, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct BarclaycardServerErrorResponse { pub status: Option<String>, pub message: Option<String>, pub reason: Option<Reason>, } #[derive(Debug, Deserialize, Serialize)] #[serde(rename_all = "SCREAMING_SNAKE_CASE")] pub enum Reason { SystemError, ServerTimeout, ServiceTimeout, } #[derive(Debug, Deserialize, Serialize)] pub struct BarclaycardAuthenticationErrorResponse { pub response: AuthenticationErrorInformation, } #[derive(Debug, Deserialize, Serialize)] #[serde(untagged)] pub enum BarclaycardErrorResponse { AuthenticationError(BarclaycardAuthenticationErrorResponse), StandardError(BarclaycardStandardErrorResponse), } #[derive(Debug, Deserialize, Clone, Serialize)] #[serde(rename_all = "camelCase")] pub struct Details { pub field: String, pub reason: String, } #[derive(Debug, Default, Deserialize, Serialize)] pub struct ErrorInformation { pub message: String, pub reason: String, pub details: Option<Vec<Details>>, } #[derive(Debug, Default, Deserialize, Serialize)] pub struct AuthenticationErrorInformation { pub rmsg: String, } fn get_error_response( error_data: &Option<BarclaycardErrorInformation>, processor_information: &Option<ClientProcessorInformation>, risk_information: &Option<ClientRiskInformation>, attempt_status: Option<enums::AttemptStatus>, status_code: u16, transaction_id: String, ) -> ErrorResponse { let avs_message = risk_information .clone() .map(|client_risk_information| { client_risk_information.rules.map(|rules| { rules .iter() .map(|risk_info| { risk_info.name.clone().map_or("".to_string(), |name| { format!(" , {}", name.clone().expose()) }) }) .collect::<Vec<String>>() .join("") }) }) .unwrap_or(Some("".to_string())); let detailed_error_info = error_data.to_owned().and_then(|error_info| { error_info.details.map(|error_details| { error_details .iter() .map(|details| format!("{} : {}", details.field, details.reason)) .collect::<Vec<_>>() .join(", ") }) }); let network_decline_code = processor_information .as_ref() .and_then(|info| info.response_code.clone()); let network_advice_code = processor_information.as_ref().and_then(|info| { info.merchant_advice .as_ref() .and_then(|merchant_advice| merchant_advice.code_raw.clone()) }); let reason = get_error_reason( error_data .clone() .and_then(|error_details| error_details.message), detailed_error_info, avs_message, ); let error_message = error_data .clone() .and_then(|error_details| error_details.reason); ErrorResponse { code: error_message .clone() .unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_CODE.to_string()), message: error_message .clone() .unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_MESSAGE.to_string()), reason, status_code, attempt_status, connector_transaction_id: Some(transaction_id.clone()), network_advice_code, network_decline_code, network_error_message: None, connector_metadata: None, } } impl TryFrom<&hyperswitch_domain_models::payment_method_data::Card> for PaymentInformation { type Error = error_stack::Report<errors::ConnectorError>; fn try_from( ccard: &hyperswitch_domain_models::payment_method_data::Card, ) -> Result<Self, Self::Error> { let card_type = match ccard .card_network .clone() .and_then(get_barclaycard_card_type) { Some(card_network) => Some(card_network.to_string()), None => ccard.get_card_issuer().ok().map(String::from), }; Ok(Self::Cards(Box::new(CardPaymentInformation { card: Card { number: ccard.card_number.clone(), expiration_month: ccard.card_exp_month.clone(), expiration_year: ccard.card_exp_year.clone(), security_code: ccard.card_cvc.clone(), card_type, type_selection_indicator: Some("1".to_owned()), }, }))) } } impl TryFrom<&GooglePayWalletData> for PaymentInformation { type Error = error_stack::Report<errors::ConnectorError>; fn try_from(google_pay_data: &GooglePayWalletData) -> Result<Self, Self::Error> { Ok(Self::GooglePay(Box::new(GooglePayPaymentInformation { fluid_data: FluidData { value: Secret::from( consts::BASE64_ENGINE.encode( google_pay_data .tokenization_data .get_encrypted_google_pay_token() .change_context(errors::ConnectorError::MissingRequiredField { field_name: "gpay wallet_token", })? .clone(), ), ), descriptor: None, }, }))) } } fn get_commerce_indicator(network: Option<String>) -> String { match network { Some(card_network) => match card_network.to_lowercase().as_str() { "amex" => "aesk", "discover" => "dipb", "mastercard" => "spa", "visa" => "internet", _ => "internet", }, None => "internet", } .to_string() } pub fn get_error_reason( error_info: Option<String>, detailed_error_info: Option<String>, avs_error_info: Option<String>, ) -> Option<String> { match (error_info, detailed_error_info, avs_error_info) { (Some(message), Some(details), Some(avs_message)) => Some(format!( "{message}, detailed_error_information: {details}, avs_message: {avs_message}", )), (Some(message), Some(details), None) => { Some(format!("{message}, detailed_error_information: {details}")) } (Some(message), None, Some(avs_message)) => { Some(format!("{message}, avs_message: {avs_message}")) } (None, Some(details), Some(avs_message)) => { Some(format!("{details}, avs_message: {avs_message}")) } (Some(message), None, None) => Some(message), (None, Some(details), None) => Some(details), (None, None, Some(avs_message)) => Some(avs_message), (None, None, None) => None, } }
crates/hyperswitch_connectors/src/connectors/barclaycard/transformers.rs#chunk2
hyperswitch_connectors
chunk
null
null
null
4,923
null
null
null
null
null
null
null
// Module Structure // File: crates/router/src/core/user_role.rs // Module: router // Public submodules: pub mod role;
crates/router/src/core/user_role.rs
router
module_structure
null
null
null
29
null
null
null
null
null
1
0
// Function: get_network_token // File: crates/router/src/core/payment_methods/network_tokenization.rs // Module: router pub fn get_network_token( state: &routes::SessionState, customer_id: id_type::CustomerId, network_token_requestor_ref_id: String, tokenization_service: &settings::NetworkTokenizationService, ) -> CustomResult<pm_types::TokenResponse, errors::NetworkTokenizationError>
crates/router/src/core/payment_methods/network_tokenization.rs
router
function_signature
null
null
null
91
get_network_token
null
null
null
null
null
null
// Module Structure // File: crates/hyperswitch_connectors/src/connectors/bluesnap.rs // Module: hyperswitch_connectors // Public submodules: pub mod transformers;
crates/hyperswitch_connectors/src/connectors/bluesnap.rs
hyperswitch_connectors
module_structure
null
null
null
39
null
null
null
null
null
1
0
// Implementation: impl IncomingWebhook for for Payeezy // File: crates/hyperswitch_connectors/src/connectors/payeezy.rs // Module: hyperswitch_connectors // Methods: 3 total (0 public) impl IncomingWebhook for for Payeezy
crates/hyperswitch_connectors/src/connectors/payeezy.rs
hyperswitch_connectors
impl_block
null
null
null
58
null
Payeezy
IncomingWebhook for
3
0
null
null
// Struct: CashtocodeIncomingWebhook // File: crates/hyperswitch_connectors/src/connectors/cashtocode/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct CashtocodeIncomingWebhook
crates/hyperswitch_connectors/src/connectors/cashtocode/transformers.rs
hyperswitch_connectors
struct_definition
CashtocodeIncomingWebhook
0
[]
55
null
null
null
null
null
null
null
// Implementation: impl ConnectorAuthenticationMap // File: crates/test_utils/src/connector_auth.rs // Module: test_utils // Methods: 2 total (2 public) impl ConnectorAuthenticationMap
crates/test_utils/src/connector_auth.rs
test_utils
impl_block
null
null
null
40
null
ConnectorAuthenticationMap
null
2
2
null
null
// Implementation: impl OrganizationBridge for for Organization // File: crates/diesel_models/src/organization.rs // Module: diesel_models // Methods: 3 total (0 public) impl OrganizationBridge for for Organization
crates/diesel_models/src/organization.rs
diesel_models
impl_block
null
null
null
44
null
Organization
OrganizationBridge for
3
0
null
null
// Struct: SantanderPixQRPaymentRequest // File: crates/hyperswitch_connectors/src/connectors/santander/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct SantanderPixQRPaymentRequest
crates/hyperswitch_connectors/src/connectors/santander/transformers.rs
hyperswitch_connectors
struct_definition
SantanderPixQRPaymentRequest
0
[]
54
null
null
null
null
null
null
null
// Function: find_by_payment_id // File: crates/diesel_models/src/query/payment_attempt.rs // Module: diesel_models pub fn find_by_payment_id( conn: &PgPooledConn, payment_id: &common_utils::id_type::GlobalPaymentId, ) -> StorageResult<Vec<Self>>
crates/diesel_models/src/query/payment_attempt.rs
diesel_models
function_signature
null
null
null
66
find_by_payment_id
null
null
null
null
null
null