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: get_user_details // File: crates/router/src/routes/user.rs // Module: router pub fn get_user_details(state: web::Data<AppState>, req: HttpRequest) -> HttpResponse
crates/router/src/routes/user.rs
router
function_signature
null
null
null
41
get_user_details
null
null
null
null
null
null
// Implementation: impl api::PaymentCapture for for Globalpay // File: crates/hyperswitch_connectors/src/connectors/globalpay.rs // Module: hyperswitch_connectors // Methods: 0 total (0 public) impl api::PaymentCapture for for Globalpay
crates/hyperswitch_connectors/src/connectors/globalpay.rs
hyperswitch_connectors
impl_block
null
null
null
57
null
Globalpay
api::PaymentCapture for
0
0
null
null
// Struct: AuthenticationUpdateInternal // File: crates/diesel_models/src/authentication.rs // Module: diesel_models // Implementations: 2 // Traits: Default pub struct AuthenticationUpdateInternal
crates/diesel_models/src/authentication.rs
diesel_models
struct_definition
AuthenticationUpdateInternal
2
[ "Default" ]
41
null
null
null
null
null
null
null
// Implementation: impl AppStateInfo for for AppState // File: crates/router/src/routes/app.rs // Module: router // Methods: 6 total (0 public) impl AppStateInfo for for AppState
crates/router/src/routes/app.rs
router
impl_block
null
null
null
41
null
AppState
AppStateInfo for
6
0
null
null
// Function: routing_retrieve_config // File: crates/openapi/src/routes/routing.rs // Module: openapi pub fn routing_retrieve_config()
crates/openapi/src/routes/routing.rs
openapi
function_signature
null
null
null
33
routing_retrieve_config
null
null
null
null
null
null
// Implementation: impl UserEmail // File: crates/router/src/types/domain/user.rs // Module: router // Methods: 6 total (6 public) impl UserEmail
crates/router/src/types/domain/user.rs
router
impl_block
null
null
null
36
null
UserEmail
null
6
6
null
null
// Implementation: impl api::PaymentToken for for Klarna // File: crates/hyperswitch_connectors/src/connectors/klarna.rs // Module: hyperswitch_connectors // Methods: 0 total (0 public) impl api::PaymentToken for for Klarna
crates/hyperswitch_connectors/src/connectors/klarna.rs
hyperswitch_connectors
impl_block
null
null
null
58
null
Klarna
api::PaymentToken for
0
0
null
null
// Implementation: impl Responder // File: crates/router/src/routes/api_keys.rs // Module: router // Methods: 0 total (0 public) impl Responder
crates/router/src/routes/api_keys.rs
router
impl_block
null
null
null
36
null
Responder
null
0
0
null
null
// Function: add_confirm_value_in_infra_values // File: crates/common_utils/src/types/keymanager.rs // Module: common_utils pub fn add_confirm_value_in_infra_values( &self, is_confirm_operation: bool, ) -> Option<serde_json::Value>
crates/common_utils/src/types/keymanager.rs
common_utils
function_signature
null
null
null
60
add_confirm_value_in_infra_values
null
null
null
null
null
null
// Function: new // File: crates/router/src/core/admin.rs // Module: router pub fn new(profile: domain::Profile) -> Self
crates/router/src/core/admin.rs
router
function_signature
null
null
null
31
new
null
null
null
null
null
null
// Function: connector_delete // File: crates/router/src/routes/admin.rs // Module: router pub fn connector_delete( state: web::Data<AppState>, req: HttpRequest, path: web::Path<( common_utils::id_type::MerchantId, common_utils::id_type::MerchantConnectorAccountId, )
crates/router/src/routes/admin.rs
router
function_signature
null
null
null
71
connector_delete
null
null
null
null
null
null
// Function: to_merchant_connector_info // File: crates/api_models/src/admin.rs // Module: api_models pub fn to_merchant_connector_info(&self, connector_label: &String) -> MerchantConnectorInfo
crates/api_models/src/admin.rs
api_models
function_signature
null
null
null
45
to_merchant_connector_info
null
null
null
null
null
null
// Module Structure // File: crates/hyperswitch_connectors/src/connectors/inespay.rs // Module: hyperswitch_connectors // Public submodules: pub mod transformers;
crates/hyperswitch_connectors/src/connectors/inespay.rs
hyperswitch_connectors
module_structure
null
null
null
39
null
null
null
null
null
1
0
// Struct: ConnectorWebhookSecrets // File: crates/api_models/src/webhooks.rs // Module: api_models // Implementations: 0 pub struct ConnectorWebhookSecrets
crates/api_models/src/webhooks.rs
api_models
struct_definition
ConnectorWebhookSecrets
0
[]
40
null
null
null
null
null
null
null
// Implementation: impl api::Payment for for Nomupay // File: crates/hyperswitch_connectors/src/connectors/nomupay.rs // Module: hyperswitch_connectors // Methods: 0 total (0 public) impl api::Payment for for Nomupay
crates/hyperswitch_connectors/src/connectors/nomupay.rs
hyperswitch_connectors
impl_block
null
null
null
59
null
Nomupay
api::Payment for
0
0
null
null
fn get_browser_info(&self) -> Result<BrowserInformation, Error>; fn get_order_details(&self) -> Result<Vec<OrderDetailsWithAmount>, Error>; fn get_card(&self) -> Result<domain::Card, Error>; fn connector_mandate_id(&self) -> Option<String>; fn get_optional_network_transaction_id(&self) -> Option<String>; fn is_mandate_payment(&self) -> bool; fn is_cit_mandate_payment(&self) -> bool; fn is_customer_initiated_mandate_payment(&self) -> bool; fn get_webhook_url(&self) -> Result<String, Error>; fn get_router_return_url(&self) -> Result<String, Error>; fn is_wallet(&self) -> bool; fn is_card(&self) -> bool; fn get_payment_method_type(&self) -> Result<enums::PaymentMethodType, Error>; fn get_connector_mandate_id(&self) -> Result<String, Error>; fn get_complete_authorize_url(&self) -> Result<String, Error>; fn get_ip_address_as_optional(&self) -> Option<Secret<String, IpAddress>>; fn get_original_amount(&self) -> i64; fn get_surcharge_amount(&self) -> Option<i64>; fn get_tax_on_surcharge_amount(&self) -> Option<i64>; fn get_total_surcharge_amount(&self) -> Option<i64>; fn get_metadata_as_object(&self) -> Option<pii::SecretSerdeValue>; fn get_authentication_data(&self) -> Result<AuthenticationData, Error>; fn get_connector_mandate_request_reference_id(&self) -> Result<String, Error>; } pub trait PaymentMethodTokenizationRequestData { fn get_browser_info(&self) -> Result<BrowserInformation, Error>; } impl PaymentMethodTokenizationRequestData for types::PaymentMethodTokenizationData { fn get_browser_info(&self) -> Result<BrowserInformation, Error> { self.browser_info .clone() .ok_or_else(missing_field_err("browser_info")) } } impl PaymentsAuthorizeRequestData for types::PaymentsAuthorizeData { fn is_auto_capture(&self) -> Result<bool, Error> { match self.capture_method { Some(enums::CaptureMethod::Automatic) | None | Some(enums::CaptureMethod::SequentialAutomatic) => Ok(true), Some(enums::CaptureMethod::Manual) => Ok(false), Some(_) => Err(errors::ConnectorError::CaptureMethodNotSupported.into()), } } fn get_email(&self) -> Result<Email, Error> { self.email.clone().ok_or_else(missing_field_err("email")) } fn get_optional_email(&self) -> Option<Email> { self.email.clone() } fn get_browser_info(&self) -> Result<BrowserInformation, Error> { self.browser_info .clone() .ok_or_else(missing_field_err("browser_info")) } fn get_order_details(&self) -> Result<Vec<OrderDetailsWithAmount>, Error> { self.order_details .clone() .ok_or_else(missing_field_err("order_details")) } fn get_card(&self) -> Result<domain::Card, Error> { match self.payment_method_data.clone() { domain::PaymentMethodData::Card(card) => Ok(card), _ => Err(missing_field_err("card")()), } } fn get_complete_authorize_url(&self) -> Result<String, Error> { self.complete_authorize_url .clone() .ok_or_else(missing_field_err("complete_authorize_url")) } fn connector_mandate_id(&self) -> Option<String> { self.mandate_id .as_ref() .and_then(|mandate_ids| match &mandate_ids.mandate_reference_id { Some(payments::MandateReferenceId::ConnectorMandateId(connector_mandate_ids)) => { connector_mandate_ids.get_connector_mandate_id() } Some(payments::MandateReferenceId::NetworkMandateId(_)) | None | Some(payments::MandateReferenceId::NetworkTokenWithNTI(_)) => None, }) } fn get_optional_network_transaction_id(&self) -> Option<String> { self.mandate_id .as_ref() .and_then(|mandate_ids| match &mandate_ids.mandate_reference_id { Some(payments::MandateReferenceId::NetworkMandateId(network_transaction_id)) => { Some(network_transaction_id.clone()) } Some(payments::MandateReferenceId::ConnectorMandateId(_)) | Some(payments::MandateReferenceId::NetworkTokenWithNTI(_)) | None => None, }) } fn is_mandate_payment(&self) -> bool { ((self.customer_acceptance.is_some() || self.setup_mandate_details.is_some()) && self.setup_future_usage == Some(storage_enums::FutureUsage::OffSession)) || self .mandate_id .as_ref() .and_then(|mandate_ids| mandate_ids.mandate_reference_id.as_ref()) .is_some() } fn is_cit_mandate_payment(&self) -> bool { (self.customer_acceptance.is_some() || self.setup_mandate_details.is_some()) && self.setup_future_usage == Some(storage_enums::FutureUsage::OffSession) } fn get_webhook_url(&self) -> Result<String, Error> { self.webhook_url .clone() .ok_or_else(missing_field_err("webhook_url")) } fn get_router_return_url(&self) -> Result<String, Error> { self.router_return_url .clone() .ok_or_else(missing_field_err("return_url")) } fn is_wallet(&self) -> bool { matches!( self.payment_method_data, domain::PaymentMethodData::Wallet(_) ) } fn is_card(&self) -> bool { matches!(self.payment_method_data, domain::PaymentMethodData::Card(_)) } fn get_payment_method_type(&self) -> Result<enums::PaymentMethodType, Error> { self.payment_method_type .to_owned() .ok_or_else(missing_field_err("payment_method_type")) } fn get_connector_mandate_id(&self) -> Result<String, Error> { self.connector_mandate_id() .ok_or_else(missing_field_err("connector_mandate_id")) } fn get_ip_address_as_optional(&self) -> Option<Secret<String, IpAddress>> { self.browser_info.clone().and_then(|browser_info| { browser_info .ip_address .map(|ip| Secret::new(ip.to_string())) }) } fn get_original_amount(&self) -> i64 { self.surcharge_details .as_ref() .map(|surcharge_details| surcharge_details.original_amount.get_amount_as_i64()) .unwrap_or(self.amount) } fn get_surcharge_amount(&self) -> Option<i64> { self.surcharge_details .as_ref() .map(|surcharge_details| surcharge_details.surcharge_amount.get_amount_as_i64()) } fn get_tax_on_surcharge_amount(&self) -> Option<i64> { self.surcharge_details.as_ref().map(|surcharge_details| { surcharge_details .tax_on_surcharge_amount .get_amount_as_i64() }) } fn get_total_surcharge_amount(&self) -> Option<i64> { self.surcharge_details.as_ref().map(|surcharge_details| { surcharge_details .get_total_surcharge_amount() .get_amount_as_i64() }) } fn is_customer_initiated_mandate_payment(&self) -> bool { (self.customer_acceptance.is_some() || self.setup_mandate_details.is_some()) && self.setup_future_usage == Some(storage_enums::FutureUsage::OffSession) } fn get_metadata_as_object(&self) -> Option<pii::SecretSerdeValue> { self.metadata.clone().and_then(|meta_data| match meta_data { serde_json::Value::Null | serde_json::Value::Bool(_) | serde_json::Value::Number(_) | serde_json::Value::String(_) | serde_json::Value::Array(_) => None, serde_json::Value::Object(_) => Some(meta_data.into()), }) } fn get_authentication_data(&self) -> Result<AuthenticationData, Error> { self.authentication_data .clone() .ok_or_else(missing_field_err("authentication_data")) } /// Attempts to retrieve the connector mandate reference ID as a `Result<String, Error>`. fn get_connector_mandate_request_reference_id(&self) -> Result<String, Error> { self.mandate_id .as_ref() .and_then(|mandate_ids| match &mandate_ids.mandate_reference_id { Some(payments::MandateReferenceId::ConnectorMandateId(connector_mandate_ids)) => { connector_mandate_ids.get_connector_mandate_request_reference_id() } Some(payments::MandateReferenceId::NetworkMandateId(_)) | None | Some(payments::MandateReferenceId::NetworkTokenWithNTI(_)) => None, }) .ok_or_else(missing_field_err("connector_mandate_request_reference_id")) } } pub trait ConnectorCustomerData { fn get_email(&self) -> Result<Email, Error>; } impl ConnectorCustomerData for types::ConnectorCustomerData { fn get_email(&self) -> Result<Email, Error> { self.email.clone().ok_or_else(missing_field_err("email")) } } pub trait BrowserInformationData { fn get_accept_header(&self) -> Result<String, Error>; fn get_language(&self) -> Result<String, Error>; fn get_screen_height(&self) -> Result<u32, Error>; fn get_screen_width(&self) -> Result<u32, Error>; fn get_color_depth(&self) -> Result<u8, Error>; fn get_user_agent(&self) -> Result<String, Error>; fn get_time_zone(&self) -> Result<i32, Error>; fn get_java_enabled(&self) -> Result<bool, Error>; fn get_java_script_enabled(&self) -> Result<bool, Error>; fn get_ip_address(&self) -> Result<Secret<String, IpAddress>, Error>; } impl BrowserInformationData for BrowserInformation { fn get_ip_address(&self) -> Result<Secret<String, IpAddress>, Error> { let ip_address = self .ip_address .ok_or_else(missing_field_err("browser_info.ip_address"))?; Ok(Secret::new(ip_address.to_string())) } fn get_accept_header(&self) -> Result<String, Error> { self.accept_header .clone() .ok_or_else(missing_field_err("browser_info.accept_header")) } fn get_language(&self) -> Result<String, Error> { self.language .clone() .ok_or_else(missing_field_err("browser_info.language")) } fn get_screen_height(&self) -> Result<u32, Error> { self.screen_height .ok_or_else(missing_field_err("browser_info.screen_height")) } fn get_screen_width(&self) -> Result<u32, Error> { self.screen_width .ok_or_else(missing_field_err("browser_info.screen_width")) } fn get_color_depth(&self) -> Result<u8, Error> { self.color_depth .ok_or_else(missing_field_err("browser_info.color_depth")) } fn get_user_agent(&self) -> Result<String, Error> { self.user_agent .clone() .ok_or_else(missing_field_err("browser_info.user_agent")) } fn get_time_zone(&self) -> Result<i32, Error> { self.time_zone .ok_or_else(missing_field_err("browser_info.time_zone")) } fn get_java_enabled(&self) -> Result<bool, Error> { self.java_enabled .ok_or_else(missing_field_err("browser_info.java_enabled")) } fn get_java_script_enabled(&self) -> Result<bool, Error> { self.java_script_enabled .ok_or_else(missing_field_err("browser_info.java_script_enabled")) } } pub trait PaymentsCompleteAuthorizeRequestData { fn is_auto_capture(&self) -> Result<bool, Error>; fn get_email(&self) -> Result<Email, Error>; fn get_redirect_response_payload(&self) -> Result<pii::SecretSerdeValue, Error>; fn get_complete_authorize_url(&self) -> Result<String, Error>; fn is_mandate_payment(&self) -> bool; fn get_connector_mandate_request_reference_id(&self) -> Result<String, Error>; fn is_cit_mandate_payment(&self) -> bool; } impl PaymentsCompleteAuthorizeRequestData for types::CompleteAuthorizeData { fn is_auto_capture(&self) -> Result<bool, Error> { match self.capture_method { Some(enums::CaptureMethod::Automatic) | None | Some(enums::CaptureMethod::SequentialAutomatic) => Ok(true), Some(enums::CaptureMethod::Manual) => Ok(false), Some(_) => Err(errors::ConnectorError::CaptureMethodNotSupported.into()), } } fn get_email(&self) -> Result<Email, Error> { self.email.clone().ok_or_else(missing_field_err("email")) } fn get_redirect_response_payload(&self) -> Result<pii::SecretSerdeValue, Error> { self.redirect_response .as_ref() .and_then(|res| res.payload.to_owned()) .ok_or( errors::ConnectorError::MissingConnectorRedirectionPayload { field_name: "request.redirect_response.payload", } .into(), ) } fn get_complete_authorize_url(&self) -> Result<String, Error> { self.complete_authorize_url .clone() .ok_or_else(missing_field_err("complete_authorize_url")) } fn is_mandate_payment(&self) -> bool { ((self.customer_acceptance.is_some() || self.setup_mandate_details.is_some()) && self.setup_future_usage == Some(storage_enums::FutureUsage::OffSession)) || self .mandate_id .as_ref() .and_then(|mandate_ids| mandate_ids.mandate_reference_id.as_ref()) .is_some() } fn is_cit_mandate_payment(&self) -> bool { (self.customer_acceptance.is_some() || self.setup_mandate_details.is_some()) && self.setup_future_usage == Some(storage_enums::FutureUsage::OffSession) } /// Attempts to retrieve the connector mandate reference ID as a `Result<String, Error>`. fn get_connector_mandate_request_reference_id(&self) -> Result<String, Error> { self.mandate_id .as_ref() .and_then(|mandate_ids| match &mandate_ids.mandate_reference_id { Some(payments::MandateReferenceId::ConnectorMandateId(connector_mandate_ids)) => { connector_mandate_ids.get_connector_mandate_request_reference_id() } Some(payments::MandateReferenceId::NetworkMandateId(_)) | None | Some(payments::MandateReferenceId::NetworkTokenWithNTI(_)) => None, }) .ok_or_else(missing_field_err("connector_mandate_request_reference_id")) } } pub trait PaymentsSyncRequestData { fn is_auto_capture(&self) -> Result<bool, Error>; fn get_connector_transaction_id(&self) -> CustomResult<String, errors::ConnectorError>; } impl PaymentsSyncRequestData for types::PaymentsSyncData { fn is_auto_capture(&self) -> Result<bool, Error> { match self.capture_method { Some(enums::CaptureMethod::Automatic) | None | Some(enums::CaptureMethod::SequentialAutomatic) => Ok(true), Some(enums::CaptureMethod::Manual) => Ok(false), Some(_) => Err(errors::ConnectorError::CaptureMethodNotSupported.into()), } } fn get_connector_transaction_id(&self) -> CustomResult<String, errors::ConnectorError> { match self.connector_transaction_id.clone() { ResponseId::ConnectorTransactionId(txn_id) => Ok(txn_id), _ => Err(errors::ValidationError::IncorrectValueProvided { field_name: "connector_transaction_id", }) .attach_printable("Expected connector transaction ID not found") .change_context(errors::ConnectorError::MissingConnectorTransactionID)?, } } } pub trait PaymentsPostSessionTokensRequestData { fn is_auto_capture(&self) -> Result<bool, Error>; } impl PaymentsPostSessionTokensRequestData for types::PaymentsPostSessionTokensData { fn is_auto_capture(&self) -> Result<bool, Error> { match self.capture_method { Some(enums::CaptureMethod::Automatic) | None | Some(enums::CaptureMethod::SequentialAutomatic) => Ok(true), Some(enums::CaptureMethod::Manual) => Ok(false), Some(_) => Err(errors::ConnectorError::CaptureMethodNotSupported.into()), } } } pub trait PaymentsCancelRequestData { fn get_amount(&self) -> Result<i64, Error>; fn get_currency(&self) -> Result<enums::Currency, Error>; fn get_cancellation_reason(&self) -> Result<String, Error>; fn get_browser_info(&self) -> Result<BrowserInformation, Error>; } impl PaymentsCancelRequestData for PaymentsCancelData { fn get_amount(&self) -> Result<i64, Error> { self.amount.ok_or_else(missing_field_err("amount")) } fn get_currency(&self) -> Result<enums::Currency, Error> { self.currency.ok_or_else(missing_field_err("currency")) } fn get_cancellation_reason(&self) -> Result<String, Error> { self.cancellation_reason .clone() .ok_or_else(missing_field_err("cancellation_reason")) } fn get_browser_info(&self) -> Result<BrowserInformation, Error> { self.browser_info .clone() .ok_or_else(missing_field_err("browser_info")) } } pub trait RefundsRequestData { fn get_connector_refund_id(&self) -> Result<String, Error>; fn get_webhook_url(&self) -> Result<String, Error>; fn get_browser_info(&self) -> Result<BrowserInformation, Error>; fn get_connector_metadata(&self) -> Result<serde_json::Value, Error>; } impl RefundsRequestData for types::RefundsData { #[track_caller] fn get_connector_refund_id(&self) -> Result<String, Error> { self.connector_refund_id .clone() .get_required_value("connector_refund_id") .change_context(errors::ConnectorError::MissingConnectorTransactionID) } fn get_webhook_url(&self) -> Result<String, Error> { self.webhook_url .clone() .ok_or_else(missing_field_err("webhook_url")) } fn get_browser_info(&self) -> Result<BrowserInformation, Error> { self.browser_info .clone() .ok_or_else(missing_field_err("browser_info")) } fn get_connector_metadata(&self) -> Result<serde_json::Value, Error> { self.connector_metadata .clone() .ok_or_else(missing_field_err("connector_metadata")) } } #[cfg(feature = "payouts")] pub trait PayoutsData { fn get_transfer_id(&self) -> Result<String, Error>; fn get_customer_details(&self) -> Result<types::CustomerDetails, Error>; fn get_vendor_details(&self) -> Result<PayoutVendorAccountDetails, Error>; #[cfg(feature = "payouts")] fn get_payout_type(&self) -> Result<storage_enums::PayoutType, Error>; } #[cfg(feature = "payouts")] impl PayoutsData for types::PayoutsData { fn get_transfer_id(&self) -> Result<String, Error> { self.connector_payout_id .clone() .ok_or_else(missing_field_err("transfer_id")) } fn get_customer_details(&self) -> Result<types::CustomerDetails, Error> { self.customer_details .clone() .ok_or_else(missing_field_err("customer_details")) } fn get_vendor_details(&self) -> Result<PayoutVendorAccountDetails, Error> { self.vendor_details .clone() .ok_or_else(missing_field_err("vendor_details")) } #[cfg(feature = "payouts")] fn get_payout_type(&self) -> Result<storage_enums::PayoutType, Error> { self.payout_type .to_owned() .ok_or_else(missing_field_err("payout_type")) } } static CARD_REGEX: LazyLock<HashMap<CardIssuer, Result<Regex, regex::Error>>> = LazyLock::new( || { let mut map = HashMap::new(); // Reference: https://gist.github.com/michaelkeevildown/9096cd3aac9029c4e6e05588448a8841 // [#379]: Determine card issuer from card BIN number map.insert(CardIssuer::Master, Regex::new(r"^5[1-5][0-9]{14}$")); map.insert(CardIssuer::AmericanExpress, Regex::new(r"^3[47][0-9]{13}$")); map.insert(CardIssuer::Visa, Regex::new(r"^4[0-9]{12}(?:[0-9]{3})?$")); map.insert(CardIssuer::Discover, Regex::new(r"^65[4-9][0-9]{13}|64[4-9][0-9]{13}|6011[0-9]{12}|(622(?:12[6-9]|1[3-9][0-9]|[2-8][0-9][0-9]|9[01][0-9]|92[0-5])[0-9]{10})$")); map.insert( CardIssuer::Maestro, Regex::new(r"^(5018|5020|5038|5893|6304|6759|6761|6762|6763)[0-9]{8,15}$"), ); map.insert( CardIssuer::DinersClub, Regex::new(r"^3(?:0[0-5]|[68][0-9])[0-9]{11}$"), ); map.insert( CardIssuer::JCB, Regex::new(r"^(3(?:088|096|112|158|337|5(?:2[89]|[3-8][0-9]))\d{12})$"), ); map.insert(CardIssuer::CarteBlanche, Regex::new(r"^389[0-9]{11}$")); map }, ); #[derive(Debug, Copy, Clone, strum::Display, Eq, Hash, PartialEq)] pub enum CardIssuer { AmericanExpress, Master, Maestro, Visa, Discover, DinersClub, JCB, CarteBlanche, } pub trait CardData { fn get_card_expiry_year_2_digit(&self) -> Result<Secret<String>, errors::ConnectorError>; fn get_card_issuer(&self) -> Result<CardIssuer, Error>; fn get_card_expiry_month_year_2_digit_with_delimiter( &self, delimiter: String, ) -> Result<Secret<String>, errors::ConnectorError>; fn get_expiry_date_as_yyyymm(&self, delimiter: &str) -> Secret<String>; fn get_expiry_date_as_mmyyyy(&self, delimiter: &str) -> Secret<String>; fn get_expiry_year_4_digit(&self) -> Secret<String>; fn get_expiry_date_as_yymm(&self) -> Result<Secret<String>, errors::ConnectorError>; fn get_expiry_month_as_i8(&self) -> Result<Secret<i8>, Error>; fn get_expiry_year_as_i32(&self) -> Result<Secret<i32>, Error>; } #[cfg(feature = "payouts")] impl CardData for payouts::CardPayout { fn get_card_expiry_year_2_digit(&self) -> Result<Secret<String>, errors::ConnectorError> { let binding = self.expiry_year.clone(); let year = binding.peek(); Ok(Secret::new( year.get(year.len() - 2..) .ok_or(errors::ConnectorError::RequestEncodingFailed)? .to_string(), )) } fn get_card_issuer(&self) -> Result<CardIssuer, Error> { get_card_issuer(self.card_number.peek()) } fn get_card_expiry_month_year_2_digit_with_delimiter( &self, delimiter: String, ) -> Result<Secret<String>, errors::ConnectorError> { let year = self.get_card_expiry_year_2_digit()?; Ok(Secret::new(format!( "{}{}{}", self.expiry_month.peek(), delimiter, year.peek() ))) } fn get_expiry_date_as_yyyymm(&self, delimiter: &str) -> Secret<String> { let year = self.get_expiry_year_4_digit(); Secret::new(format!( "{}{}{}", year.peek(), delimiter, self.expiry_month.peek() )) } fn get_expiry_date_as_mmyyyy(&self, delimiter: &str) -> Secret<String> { let year = self.get_expiry_year_4_digit(); Secret::new(format!( "{}{}{}", self.expiry_month.peek(), delimiter, year.peek() )) } fn get_expiry_year_4_digit(&self) -> Secret<String> { let mut year = self.expiry_year.peek().clone(); if year.len() == 2 { year = format!("20{year}"); } Secret::new(year) } fn get_expiry_date_as_yymm(&self) -> Result<Secret<String>, errors::ConnectorError> { let year = self.get_card_expiry_year_2_digit()?.expose(); let month = self.expiry_month.clone().expose(); Ok(Secret::new(format!("{year}{month}"))) } fn get_expiry_month_as_i8(&self) -> Result<Secret<i8>, Error> { self.expiry_month .peek() .clone() .parse::<i8>() .change_context(errors::ConnectorError::ResponseDeserializationFailed) .map(Secret::new) } fn get_expiry_year_as_i32(&self) -> Result<Secret<i32>, Error> { self.expiry_year .peek() .clone() .parse::<i32>() .change_context(errors::ConnectorError::ResponseDeserializationFailed) .map(Secret::new) } } impl CardData for hyperswitch_domain_models::payment_method_data::CardDetailsForNetworkTransactionId { fn get_card_expiry_year_2_digit(&self) -> Result<Secret<String>, errors::ConnectorError> { let binding = self.card_exp_year.clone(); let year = binding.peek(); Ok(Secret::new( year.get(year.len() - 2..) .ok_or(errors::ConnectorError::RequestEncodingFailed)? .to_string(), )) } fn get_card_issuer(&self) -> Result<CardIssuer, Error> { get_card_issuer(self.card_number.peek()) } fn get_card_expiry_month_year_2_digit_with_delimiter( &self, delimiter: String, ) -> Result<Secret<String>, errors::ConnectorError> { let year = self.get_card_expiry_year_2_digit()?; Ok(Secret::new(format!( "{}{}{}", self.card_exp_month.peek(), delimiter, year.peek() ))) } fn get_expiry_date_as_yyyymm(&self, delimiter: &str) -> Secret<String> { let year = self.get_expiry_year_4_digit(); Secret::new(format!( "{}{}{}", year.peek(), delimiter, self.card_exp_month.peek() )) } fn get_expiry_date_as_mmyyyy(&self, delimiter: &str) -> Secret<String> { let year = self.get_expiry_year_4_digit(); Secret::new(format!( "{}{}{}", self.card_exp_month.peek(), delimiter, year.peek() )) } fn get_expiry_year_4_digit(&self) -> Secret<String> { let mut year = self.card_exp_year.peek().clone(); if year.len() == 2 { year = format!("20{year}"); } Secret::new(year) } fn get_expiry_date_as_yymm(&self) -> Result<Secret<String>, errors::ConnectorError> { let year = self.get_card_expiry_year_2_digit()?.expose(); let month = self.card_exp_month.clone().expose(); Ok(Secret::new(format!("{year}{month}"))) } fn get_expiry_month_as_i8(&self) -> Result<Secret<i8>, Error> { self.card_exp_month .peek() .clone() .parse::<i8>() .change_context(errors::ConnectorError::ResponseDeserializationFailed) .map(Secret::new) } fn get_expiry_year_as_i32(&self) -> Result<Secret<i32>, Error> { self.card_exp_year .peek() .clone() .parse::<i32>() .change_context(errors::ConnectorError::ResponseDeserializationFailed) .map(Secret::new) } } impl CardData for domain::Card { fn get_card_expiry_year_2_digit(&self) -> Result<Secret<String>, errors::ConnectorError> { let binding = self.card_exp_year.clone(); let year = binding.peek(); Ok(Secret::new( year.get(year.len() - 2..) .ok_or(errors::ConnectorError::RequestEncodingFailed)? .to_string(), )) } fn get_card_issuer(&self) -> Result<CardIssuer, Error> { get_card_issuer(self.card_number.peek()) } fn get_card_expiry_month_year_2_digit_with_delimiter( &self, delimiter: String, ) -> Result<Secret<String>, errors::ConnectorError> { let year = self.get_card_expiry_year_2_digit()?; Ok(Secret::new(format!( "{}{}{}", self.card_exp_month.peek(), delimiter, year.peek() ))) } fn get_expiry_date_as_yyyymm(&self, delimiter: &str) -> Secret<String> { let year = self.get_expiry_year_4_digit(); Secret::new(format!( "{}{}{}", year.peek(), delimiter, self.card_exp_month.peek() )) } fn get_expiry_date_as_mmyyyy(&self, delimiter: &str) -> Secret<String> { let year = self.get_expiry_year_4_digit(); Secret::new(format!( "{}{}{}", self.card_exp_month.peek(), delimiter, year.peek() )) } fn get_expiry_year_4_digit(&self) -> Secret<String> { let mut year = self.card_exp_year.peek().clone(); if year.len() == 2 { year = format!("20{year}"); } Secret::new(year) } fn get_expiry_date_as_yymm(&self) -> Result<Secret<String>, errors::ConnectorError> { let year = self.get_card_expiry_year_2_digit()?.expose(); let month = self.card_exp_month.clone().expose(); Ok(Secret::new(format!("{year}{month}"))) } fn get_expiry_month_as_i8(&self) -> Result<Secret<i8>, Error> { self.card_exp_month .peek() .clone() .parse::<i8>() .change_context(errors::ConnectorError::ResponseDeserializationFailed) .map(Secret::new) } fn get_expiry_year_as_i32(&self) -> Result<Secret<i32>, Error> { self.card_exp_year .peek() .clone() .parse::<i32>() .change_context(errors::ConnectorError::ResponseDeserializationFailed) .map(Secret::new) } } #[track_caller] fn get_card_issuer(card_number: &str) -> Result<CardIssuer, Error> { for (k, v) in CARD_REGEX.iter() { let regex: Regex = v .clone() .change_context(errors::ConnectorError::RequestEncodingFailed)?; if regex.is_match(card_number) { return Ok(*k); } } Err(error_stack::Report::new( errors::ConnectorError::NotImplemented("Card Type".into()), )) } pub trait WalletData { fn get_wallet_token(&self) -> Result<Secret<String>, Error>; fn get_wallet_token_as_json<T>(&self, wallet_name: String) -> Result<T, Error> where T: serde::de::DeserializeOwned; fn get_encoded_wallet_token(&self) -> Result<String, Error>; } impl WalletData for domain::WalletData { fn get_wallet_token(&self) -> Result<Secret<String>, Error> { match self { Self::GooglePay(data) => Ok(data.get_googlepay_encrypted_payment_data()?), Self::ApplePay(data) => Ok(data.get_applepay_decoded_payment_data()?), Self::PaypalSdk(data) => Ok(Secret::new(data.token.clone())), _ => Err(errors::ConnectorError::InvalidWallet.into()), } } fn get_wallet_token_as_json<T>(&self, wallet_name: String) -> Result<T, Error> where T: serde::de::DeserializeOwned, { serde_json::from_str::<T>(self.get_wallet_token()?.peek()) .change_context(errors::ConnectorError::InvalidWalletToken { wallet_name }) } fn get_encoded_wallet_token(&self) -> Result<String, Error> { match self { Self::GooglePay(_) => { let json_token: serde_json::Value = self.get_wallet_token_as_json("Google Pay".to_owned())?; let token_as_vec = serde_json::to_vec(&json_token).change_context( errors::ConnectorError::InvalidWalletToken { wallet_name: "Google Pay".to_string(), }, )?; let encoded_token = consts::BASE64_ENGINE.encode(token_as_vec); Ok(encoded_token) } _ => Err( errors::ConnectorError::NotImplemented("SELECTED PAYMENT METHOD".to_owned()).into(), ), } } } pub trait ApplePay { fn get_applepay_decoded_payment_data(&self) -> Result<Secret<String>, Error>; } impl ApplePay for domain::ApplePayWalletData { fn get_applepay_decoded_payment_data(&self) -> Result<Secret<String>, Error> { let apple_pay_encrypted_data = self .payment_data .get_encrypted_apple_pay_payment_data_mandatory() .change_context(errors::ConnectorError::MissingRequiredField { field_name: "Apple pay encrypted data", })?; let token = Secret::new( String::from_utf8( consts::BASE64_ENGINE .decode(apple_pay_encrypted_data) .change_context(errors::ConnectorError::InvalidWalletToken { wallet_name: "Apple Pay".to_string(), })?, ) .change_context(errors::ConnectorError::InvalidWalletToken { wallet_name: "Apple Pay".to_string(), })?, ); Ok(token) } } pub trait GooglePay { fn get_googlepay_encrypted_payment_data(&self) -> Result<Secret<String>, Error>; } impl GooglePay for domain::GooglePayWalletData { fn get_googlepay_encrypted_payment_data(&self) -> Result<Secret<String>, Error> { let encrypted_data = self .tokenization_data .get_encrypted_google_pay_payment_data_mandatory() .change_context(errors::ConnectorError::InvalidWalletToken { wallet_name: "Google Pay".to_string(), })?; Ok(Secret::new(encrypted_data.token.clone())) } } pub trait CryptoData { fn get_pay_currency(&self) -> Result<String, Error>; } impl CryptoData for domain::CryptoData { fn get_pay_currency(&self) -> Result<String, Error> { self.pay_currency .clone() .ok_or_else(missing_field_err("crypto_data.pay_currency")) } } pub trait PhoneDetailsData { fn get_number(&self) -> Result<Secret<String>, Error>; fn get_country_code(&self) -> Result<String, Error>; fn get_number_with_country_code(&self) -> Result<Secret<String>, Error>;
crates/router/src/connector/utils.rs#chunk1
router
chunk
null
null
null
8,192
null
null
null
null
null
null
null
// Struct: RecoveryCodes // File: crates/api_models/src/user.rs // Module: api_models // Implementations: 0 pub struct RecoveryCodes
crates/api_models/src/user.rs
api_models
struct_definition
RecoveryCodes
0
[]
33
null
null
null
null
null
null
null
// Function: update_user_authentication_method // File: crates/router/src/routes/user.rs // Module: router pub fn update_user_authentication_method( state: web::Data<AppState>, req: HttpRequest, json_payload: web::Json<user_api::UpdateUserAuthenticationMethodRequest>, ) -> HttpResponse
crates/router/src/routes/user.rs
router
function_signature
null
null
null
64
update_user_authentication_method
null
null
null
null
null
null
// Implementation: impl KafkaPaymentAttemptEvent // File: crates/router/src/services/kafka/payment_attempt_event.rs // Module: router // Methods: 1 total (1 public) impl KafkaPaymentAttemptEvent
crates/router/src/services/kafka/payment_attempt_event.rs
router
impl_block
null
null
null
43
null
KafkaPaymentAttemptEvent
null
1
1
null
null
// Struct: WiseFulfillResponse // File: crates/hyperswitch_connectors/src/connectors/wise/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct WiseFulfillResponse
crates/hyperswitch_connectors/src/connectors/wise/transformers.rs
hyperswitch_connectors
struct_definition
WiseFulfillResponse
0
[]
49
null
null
null
null
null
null
null
// Trait: ToArchipelBillingAddress // File: crates/hyperswitch_connectors/src/connectors/archipel/transformers.rs // Module: hyperswitch_connectors pub trait ToArchipelBillingAddress
crates/hyperswitch_connectors/src/connectors/archipel/transformers.rs
hyperswitch_connectors
trait_definition
null
null
null
44
null
null
ToArchipelBillingAddress
null
null
null
null
// Implementation: impl ConnectorValidation for for CtpMastercard // File: crates/hyperswitch_connectors/src/connectors/ctp_mastercard.rs // Module: hyperswitch_connectors // Methods: 0 total (0 public) impl ConnectorValidation for for CtpMastercard
crates/hyperswitch_connectors/src/connectors/ctp_mastercard.rs
hyperswitch_connectors
impl_block
null
null
null
59
null
CtpMastercard
ConnectorValidation for
0
0
null
null
// Function: run_program // File: crates/euclid_wasm/src/lib.rs // Module: euclid_wasm pub fn run_program(program: JsValue, input: JsValue) -> JsResult
crates/euclid_wasm/src/lib.rs
euclid_wasm
function_signature
null
null
null
44
run_program
null
null
null
null
null
null
// Function: ephemeral_key_delete // File: crates/router/src/routes/ephemeral_key.rs // Module: router pub fn ephemeral_key_delete( state: web::Data<AppState>, req: HttpRequest, path: web::Path<String>, ) -> HttpResponse
crates/router/src/routes/ephemeral_key.rs
router
function_signature
null
null
null
59
ephemeral_key_delete
null
null
null
null
null
null
// Implementation: impl Responder // File: crates/router/src/routes/payments.rs // Module: router // Methods: 0 total (0 public) impl Responder
crates/router/src/routes/payments.rs
router
impl_block
null
null
null
36
null
Responder
null
0
0
null
null
// Module Structure // File: crates/hyperswitch_connectors/src/connectors/threedsecureio.rs // Module: hyperswitch_connectors // Public submodules: pub mod transformers;
crates/hyperswitch_connectors/src/connectors/threedsecureio.rs
hyperswitch_connectors
module_structure
null
null
null
40
null
null
null
null
null
1
0
// Function: execute_payment_method_tokenization // File: crates/router/src/core/payment_methods/cards.rs // Module: router pub fn execute_payment_method_tokenization( executor: tokenize::CardNetworkTokenizeExecutor<'_, domain::TokenizePaymentMethodRequest>, builder: tokenize::NetworkTokenizationBuilder<'_, tokenize::TokenizeWithPmId>, req: &domain::TokenizePaymentMethodRequest, ) -> errors::RouterResult<api::CardNetworkTokenizeResponse>
crates/router/src/core/payment_methods/cards.rs
router
function_signature
null
null
null
101
execute_payment_method_tokenization
null
null
null
null
null
null
// File: crates/router/src/core/connector_onboarding/paypal.rs // Module: router // Public functions: 3 use api_models::{admin::MerchantConnectorUpdate, connector_onboarding as api}; use common_utils::ext_traits::Encode; use error_stack::ResultExt; pub use external_services::http_client; use masking::{ExposeInterface, PeekInterface, Secret}; use crate::{ core::{ admin, errors::{ApiErrorResponse, RouterResult}, }, services::{ApplicationResponse, Request}, types::{self as oss_types, api as oss_api_types, api::connector_onboarding as types}, utils::connector_onboarding as utils, SessionState, }; fn build_referral_url(state: SessionState) -> String { format!( "{}v2/customer/partner-referrals", state.conf.connectors.paypal.base_url ) } async fn build_referral_request( state: SessionState, tracking_id: String, return_url: String, ) -> RouterResult<Request> { let access_token = utils::paypal::generate_access_token(state.clone()).await?; let request_body = types::paypal::PartnerReferralRequest::new(tracking_id, return_url); utils::paypal::build_paypal_post_request( build_referral_url(state), request_body, access_token.token.expose(), ) } pub async fn get_action_url_from_paypal( state: SessionState, tracking_id: String, return_url: String, ) -> RouterResult<String> { let referral_request = Box::pin(build_referral_request( state.clone(), tracking_id, return_url, )) .await?; let referral_response = http_client::send_request(&state.conf.proxy, referral_request, None) .await .change_context(ApiErrorResponse::InternalServerError) .attach_printable("Failed to send request to paypal referrals")?; let parsed_response: types::paypal::PartnerReferralResponse = referral_response .json() .await .change_context(ApiErrorResponse::InternalServerError) .attach_printable("Failed to parse paypal response")?; parsed_response.extract_action_url() } fn merchant_onboarding_status_url(state: SessionState, tracking_id: String) -> String { let partner_id = state .conf .connector_onboarding .get_inner() .paypal .partner_id .to_owned(); format!( "{}v1/customer/partners/{}/merchant-integrations?tracking_id={}", state.conf.connectors.paypal.base_url, partner_id.expose(), tracking_id ) } pub async fn sync_merchant_onboarding_status( state: SessionState, tracking_id: String, ) -> RouterResult<api::OnboardingStatus> { let access_token = utils::paypal::generate_access_token(state.clone()).await?; let Some(seller_status_response) = find_paypal_merchant_by_tracking_id(state.clone(), tracking_id, &access_token).await? else { return Ok(api::OnboardingStatus::PayPal( api::PayPalOnboardingStatus::AccountNotFound, )); }; let merchant_details_url = seller_status_response .extract_merchant_details_url(&state.conf.connectors.paypal.base_url)?; let merchant_details_request = utils::paypal::build_paypal_get_request(merchant_details_url, access_token.token.expose())?; let merchant_details_response = http_client::send_request(&state.conf.proxy, merchant_details_request, None) .await .change_context(ApiErrorResponse::InternalServerError) .attach_printable("Failed to send request to paypal merchant details")?; let parsed_response: types::paypal::SellerStatusDetailsResponse = merchant_details_response .json() .await .change_context(ApiErrorResponse::InternalServerError) .attach_printable("Failed to parse paypal merchant details response")?; let eligibity = parsed_response.get_eligibility_status().await?; Ok(api::OnboardingStatus::PayPal(eligibity)) } async fn find_paypal_merchant_by_tracking_id( state: SessionState, tracking_id: String, access_token: &oss_types::AccessToken, ) -> RouterResult<Option<types::paypal::SellerStatusResponse>> { let seller_status_request = utils::paypal::build_paypal_get_request( merchant_onboarding_status_url(state.clone(), tracking_id), access_token.token.peek().to_string(), )?; let seller_status_response = http_client::send_request(&state.conf.proxy, seller_status_request, None) .await .change_context(ApiErrorResponse::InternalServerError) .attach_printable("Failed to send request to paypal onboarding status")?; if seller_status_response.status().is_success() { return Ok(Some( seller_status_response .json() .await .change_context(ApiErrorResponse::InternalServerError) .attach_printable("Failed to parse paypal onboarding status response")?, )); } Ok(None) } pub async fn update_mca( state: &SessionState, merchant_id: common_utils::id_type::MerchantId, connector_id: common_utils::id_type::MerchantConnectorAccountId, auth_details: oss_types::ConnectorAuthType, ) -> RouterResult<oss_api_types::MerchantConnectorResponse> { let connector_auth_json = auth_details .encode_to_value() .change_context(ApiErrorResponse::InternalServerError) .attach_printable("Error while deserializing connector_account_details")?; #[cfg(feature = "v1")] let request = MerchantConnectorUpdate { connector_type: common_enums::ConnectorType::PaymentProcessor, connector_account_details: Some(Secret::new(connector_auth_json)), disabled: Some(false), status: Some(common_enums::ConnectorStatus::Active), connector_label: None, payment_methods_enabled: None, metadata: None, frm_configs: None, connector_webhook_details: None, pm_auth_config: None, test_mode: None, additional_merchant_data: None, connector_wallets_details: None, }; #[cfg(feature = "v2")] let request = MerchantConnectorUpdate { connector_type: common_enums::ConnectorType::PaymentProcessor, connector_account_details: Some(Secret::new(connector_auth_json)), disabled: Some(false), status: Some(common_enums::ConnectorStatus::Active), connector_label: None, payment_methods_enabled: None, metadata: None, frm_configs: None, connector_webhook_details: None, pm_auth_config: None, merchant_id: merchant_id.clone(), additional_merchant_data: None, connector_wallets_details: None, feature_metadata: None, }; let mca_response = admin::update_connector(state.clone(), &merchant_id, None, &connector_id, request).await?; match mca_response { ApplicationResponse::Json(mca_data) => Ok(mca_data), _ => Err(ApiErrorResponse::InternalServerError.into()), } }
crates/router/src/core/connector_onboarding/paypal.rs
router
full_file
null
null
null
1,489
null
null
null
null
null
null
null
// File: crates/router/src/core/errors/chat.rs // Module: router // Public functions: 1 #[derive(Debug, thiserror::Error)] pub enum ChatErrors { #[error("User InternalServerError")] InternalServerError, #[error("Missing Config error")] MissingConfigError, #[error("Chat response deserialization failed")] ChatResponseDeserializationFailed, #[error("Unauthorized access")] UnauthorizedAccess, } impl common_utils::errors::ErrorSwitch<api_models::errors::types::ApiErrorResponse> for ChatErrors { fn switch(&self) -> api_models::errors::types::ApiErrorResponse { use api_models::errors::types::{ApiError, ApiErrorResponse as AER}; let sub_code = "AI"; match self { Self::InternalServerError => { AER::InternalServerError(ApiError::new("HE", 0, self.get_error_message(), None)) } Self::MissingConfigError => { AER::InternalServerError(ApiError::new(sub_code, 1, self.get_error_message(), None)) } Self::ChatResponseDeserializationFailed => { AER::BadRequest(ApiError::new(sub_code, 2, self.get_error_message(), None)) } Self::UnauthorizedAccess => { AER::Unauthorized(ApiError::new(sub_code, 3, self.get_error_message(), None)) } } } } impl ChatErrors { pub fn get_error_message(&self) -> String { match self { Self::InternalServerError => "Something went wrong".to_string(), Self::MissingConfigError => "Missing webhook url".to_string(), Self::ChatResponseDeserializationFailed => "Failed to parse chat response".to_string(), Self::UnauthorizedAccess => "Not authorized to access the resource".to_string(), } } }
crates/router/src/core/errors/chat.rs
router
full_file
null
null
null
382
null
null
null
null
null
null
null
// Implementation: impl api::Payment for for Wellsfargo // File: crates/hyperswitch_connectors/src/connectors/wellsfargo.rs // Module: hyperswitch_connectors // Methods: 0 total (0 public) impl api::Payment for for Wellsfargo
crates/hyperswitch_connectors/src/connectors/wellsfargo.rs
hyperswitch_connectors
impl_block
null
null
null
59
null
Wellsfargo
api::Payment for
0
0
null
null
// Struct: AdminApiAuthWithApiKeyFallback // File: crates/router/src/services/authentication.rs // Module: router // Implementations: 0 pub struct AdminApiAuthWithApiKeyFallback
crates/router/src/services/authentication.rs
router
struct_definition
AdminApiAuthWithApiKeyFallback
0
[]
40
null
null
null
null
null
null
null
// File: crates/router/tests/connectors/moneris.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 MonerisTest; impl ConnectorActions for MonerisTest {} impl utils::Connector for MonerisTest { fn get_data(&self) -> api::ConnectorData { use router::connector::Moneris; utils::construct_connector_data_old( Box::new(Moneris::new()), types::Connector::Moneris, api::GetToken::Connector, None, ) } fn get_auth_token(&self) -> types::ConnectorAuthType { utils::to_connector_auth_type( connector_auth::ConnectorAuthentication::new() .moneris .expect("Missing connector authentication configuration") .into(), ) } fn get_name(&self) -> String { "moneris".to_string() } } static CONNECTOR: MonerisTest = MonerisTest {}; 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/moneris.rs
router
full_file
null
null
null
2,942
null
null
null
null
null
null
null
// Implementation: impl masking::SerializableSecret for for RedirectResponse // File: crates/diesel_models/src/types.rs // Module: diesel_models // Methods: 0 total (0 public) impl masking::SerializableSecret for for RedirectResponse
crates/diesel_models/src/types.rs
diesel_models
impl_block
null
null
null
49
null
RedirectResponse
masking::SerializableSecret for
0
0
null
null
// Function: get_surcharge_dsk_key // File: crates/common_utils/src/id_type/merchant.rs // Module: common_utils // Documentation: get_surcharge_dsk_key pub fn get_surcharge_dsk_key(&self) -> String
crates/common_utils/src/id_type/merchant.rs
common_utils
function_signature
null
null
null
52
get_surcharge_dsk_key
null
null
null
null
null
null
// Struct: RefundResponse // File: crates/hyperswitch_connectors/src/connectors/loonio/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct RefundResponse
crates/hyperswitch_connectors/src/connectors/loonio/transformers.rs
hyperswitch_connectors
struct_definition
RefundResponse
0
[]
48
null
null
null
null
null
null
null
// Implementation: impl api::PaymentToken for for Trustpayments // File: crates/hyperswitch_connectors/src/connectors/trustpayments.rs // Module: hyperswitch_connectors // Methods: 0 total (0 public) impl api::PaymentToken for for Trustpayments
crates/hyperswitch_connectors/src/connectors/trustpayments.rs
hyperswitch_connectors
impl_block
null
null
null
58
null
Trustpayments
api::PaymentToken for
0
0
null
null
// Function: construct_payment_router_data_for_update_metadata // File: crates/router/src/core/payments/transformers.rs // Module: router pub fn construct_payment_router_data_for_update_metadata<'a>( state: &'a SessionState, payment_data: PaymentData<api::UpdateMetadata>, connector_id: &str, merchant_context: &domain::MerchantContext, customer: &'a Option<domain::Customer>, merchant_connector_account: &helpers::MerchantConnectorAccountType, merchant_recipient_data: Option<types::MerchantRecipientData>, header_payload: Option<hyperswitch_domain_models::payments::HeaderPayload>, ) -> RouterResult< types::RouterData< api::UpdateMetadata, types::PaymentsUpdateMetadataData, types::PaymentsResponseData, >, >
crates/router/src/core/payments/transformers.rs
router
function_signature
null
null
null
170
construct_payment_router_data_for_update_metadata
null
null
null
null
null
null
// Function: decide_unified_connector_service_call // File: crates/router/src/core/payments.rs // Module: router pub fn decide_unified_connector_service_call<F, RouterDReq, ApiRequest, D>( state: &SessionState, req_state: ReqState, merchant_context: &domain::MerchantContext, connector: api::ConnectorData, operation: &BoxedOperation<'_, F, ApiRequest, D>, payment_data: &mut D, customer: &Option<domain::Customer>, call_connector_action: CallConnectorAction, validate_result: &operations::ValidateResult, schedule_time: Option<time::PrimitiveDateTime>, header_payload: HeaderPayload, frm_suggestion: Option<storage_enums::FrmSuggestion>, business_profile: &domain::Profile, is_retry_payment: bool, all_keys_required: Option<bool>, merchant_connector_account: helpers::MerchantConnectorAccountType, mut router_data: RouterData<F, RouterDReq, router_types::PaymentsResponseData>, tokenization_action: TokenizationAction, ) -> RouterResult<( RouterData<F, RouterDReq, router_types::PaymentsResponseData>, helpers::MerchantConnectorAccountType, )> where F: Send + Clone + Sync, RouterDReq: Send + Sync, // To create connector flow specific interface data D: OperationSessionGetters<F> + OperationSessionSetters<F> + Send + Sync + Clone, D: ConstructFlowSpecificData<F, RouterDReq, router_types::PaymentsResponseData>, RouterData<F, RouterDReq, router_types::PaymentsResponseData>: Feature<F, RouterDReq> + Send, // To construct connector flow specific api dyn api::Connector: services::api::ConnectorIntegration<F, RouterDReq, router_types::PaymentsResponseData>,
crates/router/src/core/payments.rs
router
function_signature
null
null
null
394
decide_unified_connector_service_call
null
null
null
null
null
null
// Function: server // File: crates/router/src/routes/app.rs // Module: router pub fn server(state: AppState) -> Scope
crates/router/src/routes/app.rs
router
function_signature
null
null
null
29
server
null
null
null
null
null
null
// Struct: RefundErrorMessageDistributionAccumulator // File: crates/analytics/src/refunds/accumulator.rs // Module: analytics // Implementations: 1 // Traits: RefundDistributionAccumulator pub struct RefundErrorMessageDistributionAccumulator
crates/analytics/src/refunds/accumulator.rs
analytics
struct_definition
RefundErrorMessageDistributionAccumulator
1
[ "RefundDistributionAccumulator" ]
55
null
null
null
null
null
null
null
// Implementation: impl Nexinets // File: crates/hyperswitch_connectors/src/connectors/nexinets.rs // Module: hyperswitch_connectors // Methods: 1 total (1 public) impl Nexinets
crates/hyperswitch_connectors/src/connectors/nexinets.rs
hyperswitch_connectors
impl_block
null
null
null
49
null
Nexinets
null
1
1
null
null
// Function: get_creds_identifier_key // File: crates/common_utils/src/id_type/merchant.rs // Module: common_utils // Documentation: get_creds_identifier_key pub fn get_creds_identifier_key(&self, creds_identifier: &str) -> String
crates/common_utils/src/id_type/merchant.rs
common_utils
function_signature
null
null
null
55
get_creds_identifier_key
null
null
null
null
null
null
// Function: tokio_mock_sleep // File: crates/router/src/routes/dummy_connector/utils.rs // Module: router pub fn tokio_mock_sleep(delay: u64, tolerance: u64)
crates/router/src/routes/dummy_connector/utils.rs
router
function_signature
null
null
null
44
tokio_mock_sleep
null
null
null
null
null
null
// Implementation: impl api::RefundExecute for for Elavon // File: crates/hyperswitch_connectors/src/connectors/elavon.rs // Module: hyperswitch_connectors // Methods: 0 total (0 public) impl api::RefundExecute for for Elavon
crates/hyperswitch_connectors/src/connectors/elavon.rs
hyperswitch_connectors
impl_block
null
null
null
62
null
Elavon
api::RefundExecute for
0
0
null
null
// Struct: PayoutsMandateReference // File: crates/api_models/src/payment_methods.rs // Module: api_models // Implementations: 0 pub struct PayoutsMandateReference
crates/api_models/src/payment_methods.rs
api_models
struct_definition
PayoutsMandateReference
0
[]
44
null
null
null
null
null
null
null
// File: crates/analytics/src/frm/core.rs // Module: analytics // Public functions: 2 #![allow(dead_code)] use std::collections::HashMap; use api_models::analytics::{ frm::{FrmDimensions, FrmMetrics, FrmMetricsBucketIdentifier, FrmMetricsBucketResponse}, AnalyticsMetadata, FrmFilterValue, FrmFiltersResponse, GetFrmFilterRequest, GetFrmMetricRequest, MetricsResponse, }; use error_stack::ResultExt; use router_env::{ logger, tracing::{self, Instrument}, }; use super::{ filters::{get_frm_filter_for_dimension, FrmFilterRow}, FrmMetricsAccumulator, }; use crate::{ errors::{AnalyticsError, AnalyticsResult}, frm::FrmMetricAccumulator, metrics, AnalyticsProvider, }; pub async fn get_metrics( pool: &AnalyticsProvider, merchant_id: &common_utils::id_type::MerchantId, req: GetFrmMetricRequest, ) -> AnalyticsResult<MetricsResponse<FrmMetricsBucketResponse>> { let mut metrics_accumulator: HashMap<FrmMetricsBucketIdentifier, FrmMetricsAccumulator> = HashMap::new(); let mut set = tokio::task::JoinSet::new(); for metric_type in req.metrics.iter().cloned() { let req = req.clone(); let pool = pool.clone(); let task_span = tracing::debug_span!("analytics_frm_query", frm_metric = metric_type.as_ref()); // Currently JoinSet works with only static lifetime references even if the task pool does not outlive the given reference // We can optimize away this clone once that is fixed let merchant_id_scoped = merchant_id.to_owned(); set.spawn( async move { let data = pool .get_frm_metrics( &metric_type, &req.group_by_names.clone(), &merchant_id_scoped, &req.filters, req.time_series.map(|t| t.granularity), &req.time_range, ) .await .change_context(AnalyticsError::UnknownError); (metric_type, data) } .instrument(task_span), ); } while let Some((metric, data)) = set .join_next() .await .transpose() .change_context(AnalyticsError::UnknownError)? { let data = data?; let attributes = router_env::metric_attributes!( ("metric_type", metric.to_string()), ("source", pool.to_string()), ); let value = u64::try_from(data.len()); if let Ok(val) = value { metrics::BUCKETS_FETCHED.record(val, attributes); logger::debug!("Attributes: {:?}, Buckets fetched: {}", attributes, val); } for (id, value) in data { logger::debug!(bucket_id=?id, bucket_value=?value, "Bucket row for metric {metric}"); let metrics_builder = metrics_accumulator.entry(id).or_default(); match metric { FrmMetrics::FrmBlockedRate => { metrics_builder.frm_blocked_rate.add_metrics_bucket(&value) } FrmMetrics::FrmTriggeredAttempts => metrics_builder .frm_triggered_attempts .add_metrics_bucket(&value), } } logger::debug!( "Analytics Accumulated Results: metric: {}, results: {:#?}", metric, metrics_accumulator ); } let query_data: Vec<FrmMetricsBucketResponse> = metrics_accumulator .into_iter() .map(|(id, val)| FrmMetricsBucketResponse { values: val.collect(), dimensions: id, }) .collect(); Ok(MetricsResponse { query_data, meta_data: [AnalyticsMetadata { current_time_range: req.time_range, }], }) } pub async fn get_filters( pool: &AnalyticsProvider, req: GetFrmFilterRequest, merchant_id: &common_utils::id_type::MerchantId, ) -> AnalyticsResult<FrmFiltersResponse> { let mut res = FrmFiltersResponse::default(); for dim in req.group_by_names { let values = match pool { AnalyticsProvider::Sqlx(pool) => { get_frm_filter_for_dimension(dim, merchant_id, &req.time_range, pool) .await } AnalyticsProvider::Clickhouse(pool) => { get_frm_filter_for_dimension(dim, merchant_id, &req.time_range, pool) .await } AnalyticsProvider::CombinedCkh(sqlx_pool, ckh_pool) => { let ckh_result = get_frm_filter_for_dimension( dim, merchant_id, &req.time_range, ckh_pool, ) .await; let sqlx_result = get_frm_filter_for_dimension( dim, merchant_id, &req.time_range, sqlx_pool, ) .await; match (&sqlx_result, &ckh_result) { (Ok(ref sqlx_res), Ok(ref ckh_res)) if sqlx_res != ckh_res => { logger::error!(clickhouse_result=?ckh_res, postgres_result=?sqlx_res, "Mismatch between clickhouse & postgres frm analytics filters") }, _ => {} }; ckh_result } AnalyticsProvider::CombinedSqlx(sqlx_pool, ckh_pool) => { let ckh_result = get_frm_filter_for_dimension( dim, merchant_id, &req.time_range, ckh_pool, ) .await; let sqlx_result = get_frm_filter_for_dimension( dim, merchant_id, &req.time_range, sqlx_pool, ) .await; match (&sqlx_result, &ckh_result) { (Ok(ref sqlx_res), Ok(ref ckh_res)) if sqlx_res != ckh_res => { logger::error!(clickhouse_result=?ckh_res, postgres_result=?sqlx_res, "Mismatch between clickhouse & postgres frm analytics filters") }, _ => {} }; sqlx_result } } .change_context(AnalyticsError::UnknownError)? .into_iter() .filter_map(|fil: FrmFilterRow| match dim { FrmDimensions::FrmStatus => fil.frm_status.map(|i| i.as_ref().to_string()), FrmDimensions::FrmName => fil.frm_name, FrmDimensions::FrmTransactionType => { fil.frm_transaction_type.map(|i| i.as_ref().to_string()) } }) .collect::<Vec<String>>(); res.query_data.push(FrmFilterValue { dimension: dim, values, }) } Ok(res) }
crates/analytics/src/frm/core.rs
analytics
full_file
null
null
null
1,423
null
null
null
null
null
null
null
// Struct: DisputeSyncResponse // File: crates/hyperswitch_domain_models/src/router_response_types/disputes.rs // Module: hyperswitch_domain_models // Implementations: 0 pub struct DisputeSyncResponse
crates/hyperswitch_domain_models/src/router_response_types/disputes.rs
hyperswitch_domain_models
struct_definition
DisputeSyncResponse
0
[]
48
null
null
null
null
null
null
null
// Struct: GpaymentsRouterData // File: crates/hyperswitch_connectors/src/connectors/gpayments/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct GpaymentsRouterData<T>
crates/hyperswitch_connectors/src/connectors/gpayments/transformers.rs
hyperswitch_connectors
struct_definition
GpaymentsRouterData
0
[]
51
null
null
null
null
null
null
null
// Implementation: impl api::PaymentSession for for Novalnet // File: crates/hyperswitch_connectors/src/connectors/novalnet.rs // Module: hyperswitch_connectors // Methods: 0 total (0 public) impl api::PaymentSession for for Novalnet
crates/hyperswitch_connectors/src/connectors/novalnet.rs
hyperswitch_connectors
impl_block
null
null
null
60
null
Novalnet
api::PaymentSession for
0
0
null
null
// Function: update_storage_scheme // File: crates/diesel_models/src/customers.rs // Module: diesel_models pub fn update_storage_scheme(&mut self, storage_scheme: common_enums::MerchantStorageScheme)
crates/diesel_models/src/customers.rs
diesel_models
function_signature
null
null
null
45
update_storage_scheme
null
null
null
null
null
null
// Function: get_connector_transaction_id // File: crates/hyperswitch_domain_models/src/router_response_types.rs // Module: hyperswitch_domain_models pub fn get_connector_transaction_id( &self, ) -> Result<String, error_stack::Report<ApiErrorResponse>>
crates/hyperswitch_domain_models/src/router_response_types.rs
hyperswitch_domain_models
function_signature
null
null
null
57
get_connector_transaction_id
null
null
null
null
null
null
// Implementation: impl api::PaymentSync for for Amazonpay // File: crates/hyperswitch_connectors/src/connectors/amazonpay.rs // Module: hyperswitch_connectors // Methods: 0 total (0 public) impl api::PaymentSync for for Amazonpay
crates/hyperswitch_connectors/src/connectors/amazonpay.rs
hyperswitch_connectors
impl_block
null
null
null
58
null
Amazonpay
api::PaymentSync for
0
0
null
null
// Function: parse_value // File: crates/router/src/utils/user.rs // Module: router pub fn parse_value<T>(value: serde_json::Value, type_name: &str) -> UserResult<T> where T: serde::de::DeserializeOwned,
crates/router/src/utils/user.rs
router
function_signature
null
null
null
57
parse_value
null
null
null
null
null
null
// File: crates/router/src/routes/payout_link.rs // Module: router // Public functions: 1 use actix_web::{web, Responder}; use api_models::payouts::PayoutLinkInitiateRequest; use router_env::Flow; use crate::{ core::{api_locking, payout_link::*}, services::{ api, authentication::{self as auth}, }, types::domain, AppState, }; #[cfg(feature = "v1")] pub async fn render_payout_link( state: web::Data<AppState>, req: actix_web::HttpRequest, path: web::Path<( common_utils::id_type::MerchantId, common_utils::id_type::PayoutId, )>, ) -> impl Responder { let flow = Flow::PayoutLinkInitiate; let (merchant_id, payout_id) = path.into_inner(); let payload = PayoutLinkInitiateRequest { merchant_id: merchant_id.clone(), payout_id, }; let headers = req.headers(); Box::pin(api::server_wrap( flow, state, &req, payload.clone(), |state, auth, req, _| { let merchant_context = domain::MerchantContext::NormalMerchant(Box::new( domain::Context(auth.merchant_account, auth.key_store), )); initiate_payout_link(state, merchant_context, req, headers) }, &auth::MerchantIdAuth(merchant_id), api_locking::LockAction::NotApplicable, )) .await }
crates/router/src/routes/payout_link.rs
router
full_file
null
null
null
333
null
null
null
null
null
null
null
// Struct: DeutschebankPaymentsResponse // File: crates/hyperswitch_connectors/src/connectors/deutschebank/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct DeutschebankPaymentsResponse
crates/hyperswitch_connectors/src/connectors/deutschebank/transformers.rs
hyperswitch_connectors
struct_definition
DeutschebankPaymentsResponse
0
[]
50
null
null
null
null
null
null
null
// Implementation: impl ConnectorSpecifications for for Bluecode // File: crates/hyperswitch_connectors/src/connectors/bluecode.rs // Module: hyperswitch_connectors // Methods: 3 total (0 public) impl ConnectorSpecifications for for Bluecode
crates/hyperswitch_connectors/src/connectors/bluecode.rs
hyperswitch_connectors
impl_block
null
null
null
53
null
Bluecode
ConnectorSpecifications for
3
0
null
null
// Function: get_pm_link_config_as_value // File: crates/api_models/src/admin.rs // Module: api_models pub fn get_pm_link_config_as_value( &self, ) -> CustomResult<Option<serde_json::Value>, errors::ParsingError>
crates/api_models/src/admin.rs
api_models
function_signature
null
null
null
56
get_pm_link_config_as_value
null
null
null
null
null
null
// Implementation: impl ConnectorValidation for for Xendit // File: crates/hyperswitch_connectors/src/connectors/xendit.rs // Module: hyperswitch_connectors // Methods: 1 total (0 public) impl ConnectorValidation for for Xendit
crates/hyperswitch_connectors/src/connectors/xendit.rs
hyperswitch_connectors
impl_block
null
null
null
56
null
Xendit
ConnectorValidation for
1
0
null
null
// Struct: PaypalLinks // File: crates/hyperswitch_connectors/src/connectors/paypal/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct PaypalLinks
crates/hyperswitch_connectors/src/connectors/paypal/transformers.rs
hyperswitch_connectors
struct_definition
PaypalLinks
0
[]
45
null
null
null
null
null
null
null
// File: crates/hyperswitch_connectors/src/connectors/vgs/transformers.rs // Module: hyperswitch_connectors // Public structs: 10 use common_utils::{ ext_traits::{Encode, StringExt}, types::StringMinorUnit, }; use error_stack::ResultExt; use hyperswitch_domain_models::{ router_data::{ConnectorAuthType, RouterData}, router_flow_types::{ExternalVaultInsertFlow, ExternalVaultRetrieveFlow}, router_request_types::VaultRequestData, router_response_types::VaultResponseData, types::VaultRouterData, vault::PaymentMethodVaultingData, }; use hyperswitch_interfaces::errors; use masking::{ExposeInterface, Secret}; use serde::{Deserialize, Serialize}; use crate::types::ResponseRouterData; pub struct VgsRouterData<T> { pub amount: StringMinorUnit, // The type of amount that a connector accepts, for example, String, i64, f64, etc. pub router_data: T, } impl<T> From<(StringMinorUnit, T)> for VgsRouterData<T> { fn from((amount, item): (StringMinorUnit, T)) -> Self { Self { amount, router_data: item, } } } const VGS_FORMAT: &str = "UUID"; const VGS_CLASSIFIER: &str = "data"; #[derive(Default, Debug, Serialize, PartialEq)] pub struct VgsTokenRequestItem { value: Secret<String>, classifiers: Vec<String>, format: String, } #[derive(Default, Debug, Serialize, PartialEq)] pub struct VgsInsertRequest { data: Vec<VgsTokenRequestItem>, } impl<F> TryFrom<&VaultRouterData<F>> for VgsInsertRequest { type Error = error_stack::Report<errors::ConnectorError>; fn try_from(item: &VaultRouterData<F>) -> Result<Self, Self::Error> { match item.request.payment_method_vaulting_data.clone() { Some(PaymentMethodVaultingData::Card(req_card)) => { let stringified_card = req_card .encode_to_string_of_json() .change_context(errors::ConnectorError::RequestEncodingFailed)?; Ok(Self { data: vec![VgsTokenRequestItem { value: Secret::new(stringified_card), classifiers: vec![VGS_CLASSIFIER.to_string()], format: VGS_FORMAT.to_string(), }], }) } _ => Err(errors::ConnectorError::NotImplemented( "Payment method apart from card".to_string(), ) .into()), } } } pub struct VgsAuthType { pub(super) username: Secret<String>, pub(super) password: Secret<String>, // vault_id is used in sessions API pub(super) _vault_id: Secret<String>, } impl TryFrom<&ConnectorAuthType> for VgsAuthType { type Error = error_stack::Report<errors::ConnectorError>; fn try_from(auth_type: &ConnectorAuthType) -> Result<Self, Self::Error> { match auth_type { ConnectorAuthType::SignatureKey { api_key, key1, api_secret, } => Ok(Self { username: api_key.to_owned(), password: key1.to_owned(), _vault_id: api_secret.to_owned(), }), _ => Err(errors::ConnectorError::FailedToObtainAuthType.into()), } } } #[derive(Default, Debug, Clone, Serialize, Deserialize, PartialEq)] pub struct VgsAliasItem { alias: String, format: String, } #[derive(Default, Debug, Clone, Serialize, Deserialize, PartialEq)] pub struct VgsTokenResponseItem { value: Secret<String>, classifiers: Vec<String>, aliases: Vec<VgsAliasItem>, created_at: Option<String>, storage: String, } #[derive(Default, Debug, Clone, Serialize, Deserialize, PartialEq)] pub struct VgsInsertResponse { data: Vec<VgsTokenResponseItem>, } #[derive(Default, Debug, Clone, Serialize, Deserialize, PartialEq)] pub struct VgsRetrieveResponse { data: Vec<VgsTokenResponseItem>, } impl TryFrom< ResponseRouterData< ExternalVaultInsertFlow, VgsInsertResponse, VaultRequestData, VaultResponseData, >, > for RouterData<ExternalVaultInsertFlow, VaultRequestData, VaultResponseData> { type Error = error_stack::Report<errors::ConnectorError>; fn try_from( item: ResponseRouterData< ExternalVaultInsertFlow, VgsInsertResponse, VaultRequestData, VaultResponseData, >, ) -> Result<Self, Self::Error> { let vgs_alias = item .response .data .first() .and_then(|val| val.aliases.first()) .ok_or(errors::ConnectorError::ResponseHandlingFailed)?; Ok(Self { status: common_enums::AttemptStatus::Started, response: Ok(VaultResponseData::ExternalVaultInsertResponse { connector_vault_id: vgs_alias.alias.clone(), fingerprint_id: vgs_alias.alias.clone(), }), ..item.data }) } } impl TryFrom< ResponseRouterData< ExternalVaultRetrieveFlow, VgsRetrieveResponse, VaultRequestData, VaultResponseData, >, > for RouterData<ExternalVaultRetrieveFlow, VaultRequestData, VaultResponseData> { type Error = error_stack::Report<errors::ConnectorError>; fn try_from( item: ResponseRouterData< ExternalVaultRetrieveFlow, VgsRetrieveResponse, VaultRequestData, VaultResponseData, >, ) -> Result<Self, Self::Error> { let token_response_item = item .response .data .first() .ok_or(errors::ConnectorError::ResponseHandlingFailed)?; let card_detail: api_models::payment_methods::CardDetail = token_response_item .value .clone() .expose() .parse_struct("CardDetail") .change_context(errors::ConnectorError::ParsingFailed)?; Ok(Self { status: common_enums::AttemptStatus::Started, response: Ok(VaultResponseData::ExternalVaultRetrieveResponse { vault_data: PaymentMethodVaultingData::Card(card_detail), }), ..item.data }) } } #[derive(Default, Debug, Serialize, Deserialize, PartialEq)] pub struct VgsErrorItem { pub status: u16, pub code: String, pub detail: Option<String>, } #[derive(Default, Debug, Serialize, Deserialize, PartialEq)] pub struct VgsErrorResponse { pub errors: Vec<VgsErrorItem>, pub trace_id: String, }
crates/hyperswitch_connectors/src/connectors/vgs/transformers.rs
hyperswitch_connectors
full_file
null
null
null
1,440
null
null
null
null
null
null
null
// Struct: RazorpayPaymentsResponse // File: crates/hyperswitch_connectors/src/connectors/razorpay/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct RazorpayPaymentsResponse
crates/hyperswitch_connectors/src/connectors/razorpay/transformers.rs
hyperswitch_connectors
struct_definition
RazorpayPaymentsResponse
0
[]
51
null
null
null
null
null
null
null
// Implementation: impl CallbackMapper // File: crates/diesel_models/src/query/callback_mapper.rs // Module: diesel_models // Methods: 2 total (0 public) impl CallbackMapper
crates/diesel_models/src/query/callback_mapper.rs
diesel_models
impl_block
null
null
null
39
null
CallbackMapper
null
2
0
null
null
// Struct: MandateGenericData // File: crates/router/src/core/mandate/helpers.rs // Module: router // Implementations: 0 pub struct MandateGenericData
crates/router/src/core/mandate/helpers.rs
router
struct_definition
MandateGenericData
0
[]
39
null
null
null
null
null
null
null
// Struct: LabelWithStatusEliminationEventResponse // File: crates/router/src/core/payments/routing/utils.rs // Module: router // Implementations: 0 pub struct LabelWithStatusEliminationEventResponse
crates/router/src/core/payments/routing/utils.rs
router
struct_definition
LabelWithStatusEliminationEventResponse
0
[]
46
null
null
null
null
null
null
null
// Struct: Invoice // File: crates/hyperswitch_connectors/src/connectors/recurly/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct Invoice
crates/hyperswitch_connectors/src/connectors/recurly/transformers.rs
hyperswitch_connectors
struct_definition
Invoice
0
[]
44
null
null
null
null
null
null
null
// Struct: CardData // File: crates/hyperswitch_connectors/src/connectors/fiserv/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct CardData
crates/hyperswitch_connectors/src/connectors/fiserv/transformers.rs
hyperswitch_connectors
struct_definition
CardData
0
[]
46
null
null
null
null
null
null
null
// Implementation: impl ConnectorValidation for for Nmi // File: crates/hyperswitch_connectors/src/connectors/nmi.rs // Module: hyperswitch_connectors // Methods: 2 total (0 public) impl ConnectorValidation for for Nmi
crates/hyperswitch_connectors/src/connectors/nmi.rs
hyperswitch_connectors
impl_block
null
null
null
53
null
Nmi
ConnectorValidation for
2
0
null
null
// Implementation: impl Event // File: crates/diesel_models/src/query/events.rs // Module: diesel_models // Methods: 11 total (0 public) impl Event
crates/diesel_models/src/query/events.rs
diesel_models
impl_block
null
null
null
37
null
Event
null
11
0
null
null
// Struct: RefundResponse // File: crates/hyperswitch_connectors/src/connectors/coinbase/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct RefundResponse
crates/hyperswitch_connectors/src/connectors/coinbase/transformers.rs
hyperswitch_connectors
struct_definition
RefundResponse
0
[]
48
null
null
null
null
null
null
null
// Trait: AccessToken // File: crates/router/src/core/connector_onboarding.rs // Module: router pub trait AccessToken
crates/router/src/core/connector_onboarding.rs
router
trait_definition
null
null
null
26
null
null
AccessToken
null
null
null
null
// Struct: ValuedComparison // File: crates/euclid/src/frontend/vir.rs // Module: euclid // Implementations: 0 pub struct ValuedComparison
crates/euclid/src/frontend/vir.rs
euclid
struct_definition
ValuedComparison
0
[]
38
null
null
null
null
null
null
null
// Struct: CommitRequest // File: crates/hyperswitch_connectors/src/connectors/nomupay/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct CommitRequest
crates/hyperswitch_connectors/src/connectors/nomupay/transformers.rs
hyperswitch_connectors
struct_definition
CommitRequest
0
[]
47
null
null
null
null
null
null
null
// Module Structure // File: crates/hyperswitch_connectors/src/connectors/forte.rs // Module: hyperswitch_connectors // Public submodules: pub mod transformers;
crates/hyperswitch_connectors/src/connectors/forte.rs
hyperswitch_connectors
module_structure
null
null
null
39
null
null
null
null
null
1
0
// Function: find_by_card_id // File: crates/diesel_models/src/query/locker_mock_up.rs // Module: diesel_models pub fn find_by_card_id(conn: &PgPooledConn, card_id: &str) -> StorageResult<Self>
crates/diesel_models/src/query/locker_mock_up.rs
diesel_models
function_signature
null
null
null
54
find_by_card_id
null
null
null
null
null
null
// Struct: RoutingEventsResponse // File: crates/router/src/core/payments/routing/utils.rs // Module: router // Implementations: 1 pub struct RoutingEventsResponse<Res>
crates/router/src/core/payments/routing/utils.rs
router
struct_definition
RoutingEventsResponse
1
[]
41
null
null
null
null
null
null
null
// Implementation: impl api::PaymentsCompleteAuthorize for for Digitalvirgo // File: crates/hyperswitch_connectors/src/connectors/digitalvirgo.rs // Module: hyperswitch_connectors // Methods: 0 total (0 public) impl api::PaymentsCompleteAuthorize for for Digitalvirgo
crates/hyperswitch_connectors/src/connectors/digitalvirgo.rs
hyperswitch_connectors
impl_block
null
null
null
63
null
Digitalvirgo
api::PaymentsCompleteAuthorize for
0
0
null
null
// Function: incoming_webhooks_wrapper // File: crates/router/src/core/webhooks/incoming.rs // Module: router pub fn incoming_webhooks_wrapper<W: types::OutgoingWebhookType>( flow: &impl router_env::types::FlowMetric, state: SessionState, req_state: ReqState, req: &actix_web::HttpRequest, merchant_context: domain::MerchantContext, connector_name_or_mca_id: &str, body: actix_web::web::Bytes, is_relay_webhook: bool, ) -> RouterResponse<serde_json::Value>
crates/router/src/core/webhooks/incoming.rs
router
function_signature
null
null
null
128
incoming_webhooks_wrapper
null
null
null
null
null
null
// Implementation: impl api::PaymentToken for for Paystack // File: crates/hyperswitch_connectors/src/connectors/paystack.rs // Module: hyperswitch_connectors // Methods: 0 total (0 public) impl api::PaymentToken for for Paystack
crates/hyperswitch_connectors/src/connectors/paystack.rs
hyperswitch_connectors
impl_block
null
null
null
57
null
Paystack
api::PaymentToken for
0
0
null
null
// Struct: MerchantAccountSetter // File: crates/diesel_models/src/merchant_account.rs // Module: diesel_models // Implementations: 0 pub struct MerchantAccountSetter
crates/diesel_models/src/merchant_account.rs
diesel_models
struct_definition
MerchantAccountSetter
0
[]
38
null
null
null
null
null
null
null
// Struct: DisputeListGetConstraints // File: crates/api_models/src/disputes.rs // Module: api_models // Implementations: 0 pub struct DisputeListGetConstraints
crates/api_models/src/disputes.rs
api_models
struct_definition
DisputeListGetConstraints
0
[]
41
null
null
null
null
null
null
null
// Struct: PlaidAuthType // File: crates/hyperswitch_connectors/src/connectors/plaid/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct PlaidAuthType
crates/hyperswitch_connectors/src/connectors/plaid/transformers.rs
hyperswitch_connectors
struct_definition
PlaidAuthType
0
[]
49
null
null
null
null
null
null
null
// Implementation: impl super::payments::filters::PaymentFilterAnalytics for for ClickhouseClient // File: crates/analytics/src/clickhouse.rs // Module: analytics // Methods: 0 total (0 public) impl super::payments::filters::PaymentFilterAnalytics for for ClickhouseClient
crates/analytics/src/clickhouse.rs
analytics
impl_block
null
null
null
61
null
ClickhouseClient
super::payments::filters::PaymentFilterAnalytics for
0
0
null
null
// Implementation: impl api::Refund for for Tokenex // File: crates/hyperswitch_connectors/src/connectors/tokenex.rs // Module: hyperswitch_connectors // Methods: 0 total (0 public) impl api::Refund for for Tokenex
crates/hyperswitch_connectors/src/connectors/tokenex.rs
hyperswitch_connectors
impl_block
null
null
null
57
null
Tokenex
api::Refund for
0
0
null
null
// Struct: OpenRouterDecideGatewayRequest // File: crates/api_models/src/open_router.rs // Module: api_models // Implementations: 0 pub struct OpenRouterDecideGatewayRequest
crates/api_models/src/open_router.rs
api_models
struct_definition
OpenRouterDecideGatewayRequest
0
[]
42
null
null
null
null
null
null
null
// Struct: Operation // File: crates/hyperswitch_connectors/src/connectors/paypal/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct Operation
crates/hyperswitch_connectors/src/connectors/paypal/transformers.rs
hyperswitch_connectors
struct_definition
Operation
0
[]
43
null
null
null
null
null
null
null
// Implementation: impl api::Refund for for Worldline // File: crates/hyperswitch_connectors/src/connectors/worldline.rs // Module: hyperswitch_connectors // Methods: 0 total (0 public) impl api::Refund for for Worldline
crates/hyperswitch_connectors/src/connectors/worldline.rs
hyperswitch_connectors
impl_block
null
null
null
57
null
Worldline
api::Refund for
0
0
null
null
// Function: new // File: crates/hyperswitch_connectors/src/connectors/gpayments.rs // Module: hyperswitch_connectors pub fn new() -> &'static Self
crates/hyperswitch_connectors/src/connectors/gpayments.rs
hyperswitch_connectors
function_signature
null
null
null
38
new
null
null
null
null
null
null
// Struct: ArchipelCardAuthorizationRequest // File: crates/hyperswitch_connectors/src/connectors/archipel/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct ArchipelCardAuthorizationRequest
crates/hyperswitch_connectors/src/connectors/archipel/transformers.rs
hyperswitch_connectors
struct_definition
ArchipelCardAuthorizationRequest
0
[]
51
null
null
null
null
null
null
null
// Struct: CaptureOptions // File: crates/hyperswitch_connectors/src/connectors/wellsfargo/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct CaptureOptions
crates/hyperswitch_connectors/src/connectors/wellsfargo/transformers.rs
hyperswitch_connectors
struct_definition
CaptureOptions
0
[]
47
null
null
null
null
null
null
null
// Struct: AuthorizedotnetPaymentsResponse // File: crates/hyperswitch_connectors/src/connectors/authorizedotnet/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct AuthorizedotnetPaymentsResponse
crates/hyperswitch_connectors/src/connectors/authorizedotnet/transformers.rs
hyperswitch_connectors
struct_definition
AuthorizedotnetPaymentsResponse
0
[]
53
null
null
null
null
null
null
null
// Implementation: impl MerchantReferenceIdForCustomer // File: crates/router/src/core/customers.rs // Module: router // Methods: 2 total (0 public) impl MerchantReferenceIdForCustomer
crates/router/src/core/customers.rs
router
impl_block
null
null
null
42
null
MerchantReferenceIdForCustomer
null
2
0
null
null
// Struct: GetSubscriptionEstimateData // File: crates/hyperswitch_domain_models/src/router_data_v2/flow_common_types.rs // Module: hyperswitch_domain_models // Implementations: 0 pub struct GetSubscriptionEstimateData
crates/hyperswitch_domain_models/src/router_data_v2/flow_common_types.rs
hyperswitch_domain_models
struct_definition
GetSubscriptionEstimateData
0
[]
52
null
null
null
null
null
null
null
// Struct: OutgoingWebhook // File: crates/api_models/src/webhooks.rs // Module: api_models // Implementations: 0 pub struct OutgoingWebhook
crates/api_models/src/webhooks.rs
api_models
struct_definition
OutgoingWebhook
0
[]
38
null
null
null
null
null
null
null
// Struct: PspTokenization // File: crates/common_types/src/payment_methods.rs // Module: common_types // Implementations: 0 pub struct PspTokenization
crates/common_types/src/payment_methods.rs
common_types
struct_definition
PspTokenization
0
[]
38
null
null
null
null
null
null
null
// Function: increment_stream_index // File: crates/drainer/src/utils.rs // Module: drainer pub fn increment_stream_index( (index, jobs_picked)
crates/drainer/src/utils.rs
drainer
function_signature
null
null
null
37
increment_stream_index
null
null
null
null
null
null
// Implementation: impl Mask for for Secret // File: crates/masking/src/maskable.rs // Module: masking // Methods: 1 total (0 public) impl Mask for for Secret
crates/masking/src/maskable.rs
masking
impl_block
null
null
null
41
null
Secret
Mask for
1
0
null
null
// Function: api_key_create // File: crates/router/src/routes/api_keys.rs // Module: router pub fn api_key_create( state: web::Data<AppState>, req: HttpRequest, path: web::Path<common_utils::id_type::MerchantId>, json_payload: web::Json<api_types::CreateApiKeyRequest>, ) -> impl Responder
crates/router/src/routes/api_keys.rs
router
function_signature
null
null
null
79
api_key_create
null
null
null
null
null
null
// Function: trigger_refund_outgoing_webhook // File: crates/router/src/utils.rs // Module: router pub fn trigger_refund_outgoing_webhook( state: &SessionState, merchant_context: &domain::MerchantContext, refund: &diesel_models::Refund, profile_id: id_type::ProfileId, ) -> RouterResult<()>
crates/router/src/utils.rs
router
function_signature
null
null
null
78
trigger_refund_outgoing_webhook
null
null
null
null
null
null
// Function: spawn_metrics_collector // File: crates/router/src/routes/metrics/bg_metrics_collector.rs // Module: router pub fn spawn_metrics_collector(metrics_collection_interval_in_secs: Option<u16>)
crates/router/src/routes/metrics/bg_metrics_collector.rs
router
function_signature
null
null
null
45
spawn_metrics_collector
null
null
null
null
null
null
// Struct: Capture // File: crates/diesel_models/src/capture.rs // Module: diesel_models // Implementations: 0 pub struct Capture
crates/diesel_models/src/capture.rs
diesel_models
struct_definition
Capture
0
[]
33
null
null
null
null
null
null
null