id
stringlengths 11
116
| type
stringclasses 1
value | granularity
stringclasses 4
values | content
stringlengths 16
477k
| metadata
dict |
|---|---|---|---|---|
fn_clm_router_check_permission_-3606878052487424315
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/authorization
pub fn check_permission(
required_permission: permissions::Permission,
role_info: &roles::RoleInfo,
) -> RouterResult<()> {
role_info
.check_permission_exists(required_permission)
.then_some(())
.ok_or(
ApiErrorResponse::AccessForbidden {
resource: required_permission.to_string(),
}
.into(),
)
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 23,
"total_crates": null
}
|
fn_clm_router_execute_connector_processing_step_-8356980880924239169
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/pm_auth
pub async fn execute_connector_processing_step<'b, T, Req, Resp>(
state: &'b SessionState,
connector_integration: BoxedConnectorIntegration<'_, T, Req, Resp>,
req: &'b PaymentAuthRouterData<T, Req, Resp>,
connector: &pm_auth_types::PaymentMethodAuthConnectors,
) -> errors::CustomResult<PaymentAuthRouterData<T, Req, Resp>, ConnectorError>
where
T: Clone + 'static,
Req: Clone + 'static,
Resp: Clone + 'static,
{
let mut router_data = req.clone();
let connector_request = connector_integration.build_request(req, connector)?;
match connector_request {
Some(request) => {
logger::debug!(connector_request=?request);
let response = services::api::call_connector_api(
state,
request,
"execute_connector_processing_step",
)
.await;
logger::debug!(connector_response=?response);
match response {
Ok(body) => {
let response = match body {
Ok(body) => {
let body = pm_auth_types::Response {
headers: body.headers,
response: body.response,
status_code: body.status_code,
};
let connector_http_status_code = Some(body.status_code);
let mut data =
connector_integration.handle_response(&router_data, body)?;
data.connector_http_status_code = connector_http_status_code;
data
}
Err(body) => {
let body = pm_auth_types::Response {
headers: body.headers,
response: body.response,
status_code: body.status_code,
};
router_data.connector_http_status_code = Some(body.status_code);
let error = match body.status_code {
500..=511 => connector_integration.get_5xx_error_response(body)?,
_ => connector_integration.get_error_response(body)?,
};
router_data.response = Err(error);
router_data
}
};
Ok(response)
}
Err(error) => {
if error.current_context().is_upstream_timeout() {
let error_response = pm_auth_types::ErrorResponse {
code: consts::REQUEST_TIMEOUT_ERROR_CODE.to_string(),
message: consts::REQUEST_TIMEOUT_ERROR_MESSAGE.to_string(),
reason: Some(consts::REQUEST_TIMEOUT_ERROR_MESSAGE.to_string()),
status_code: 504,
};
router_data.response = Err(error_response);
router_data.connector_http_status_code = Some(504);
Ok(router_data)
} else {
Err(error.change_context(ConnectorError::ProcessingStepFailed(None)))
}
}
}
}
None => Ok(router_data),
}
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 285,
"total_crates": null
}
|
fn_clm_router_from_storage_-6202511076173494062
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/kafka/refund_event
// Inherent implementation for KafkaRefundEvent<'a>
pub fn from_storage(refund: &'a Refund) -> Self {
let Refund {
payment_id,
merchant_id,
connector_transaction_id,
connector,
connector_refund_id,
external_reference_id,
refund_type,
total_amount,
currency,
refund_amount,
refund_status,
sent_to_gateway,
refund_error_message,
metadata,
refund_arn,
created_at,
modified_at,
description,
attempt_id,
refund_reason,
refund_error_code,
profile_id,
updated_by,
charges,
organization_id,
split_refunds,
unified_code,
unified_message,
processor_refund_data,
processor_transaction_data,
id,
merchant_reference_id,
connector_id,
} = refund;
Self {
refund_id: id,
merchant_reference_id,
payment_id,
merchant_id,
connector_transaction_id,
connector,
connector_refund_id: connector_refund_id.as_ref(),
external_reference_id: external_reference_id.as_ref(),
refund_type,
total_amount,
currency,
refund_amount,
refund_status,
sent_to_gateway,
refund_error_message: refund_error_message.as_ref(),
refund_arn: refund_arn.as_ref(),
created_at: created_at.assume_utc(),
modified_at: modified_at.assume_utc(),
description: description.as_ref(),
attempt_id,
refund_reason: refund_reason.as_ref(),
refund_error_code: refund_error_code.as_ref(),
profile_id: profile_id.as_ref(),
organization_id,
metadata: metadata.as_ref(),
updated_by,
merchant_connector_id: connector_id.as_ref(),
charges: charges.as_ref(),
connector_refund_data: processor_refund_data.as_ref(),
connector_transaction_data: processor_transaction_data.as_ref(),
split_refunds: split_refunds.as_ref(),
unified_code: unified_code.as_ref(),
unified_message: unified_message.as_ref(),
processor_refund_data: processor_refund_data.as_ref(),
processor_transaction_data: processor_transaction_data.as_ref(),
}
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 139,
"total_crates": null
}
|
fn_clm_router_key_-6202511076173494062
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/kafka/refund_event
// Implementation of KafkaRefundEvent<'_> for super::KafkaMessage
fn key(&self) -> String {
format!(
"{}_{}_{}_{}",
self.merchant_id.get_string_repr(),
self.payment_id.get_string_repr(),
self.attempt_id.get_string_repr(),
self.merchant_reference_id.get_string_repr()
)
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 29,
"total_crates": null
}
|
fn_clm_router_event_type_-6202511076173494062
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/kafka/refund_event
// Implementation of KafkaRefundEvent<'_> for super::KafkaMessage
fn event_type(&self) -> events::EventType {
events::EventType::Refund
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 14,
"total_crates": null
}
|
fn_clm_router_from_storage_-5759961059049571007
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/kafka/dispute
// Inherent implementation for KafkaDispute<'a>
pub fn from_storage(dispute: &'a Dispute) -> Self {
let currency = dispute.dispute_currency.unwrap_or(
dispute
.currency
.to_uppercase()
.parse_enum("Currency")
.unwrap_or_default(),
);
Self {
dispute_id: &dispute.dispute_id,
dispute_amount: StringMinorUnitForConnector::convert_back(
&StringMinorUnitForConnector,
dispute.amount.clone(),
currency,
)
.unwrap_or_else(|e| {
router_env::logger::error!("Failed to convert dispute amount: {e:?}");
MinorUnit::new(0)
}),
currency,
dispute_stage: &dispute.dispute_stage,
dispute_status: &dispute.dispute_status,
payment_id: &dispute.payment_id,
attempt_id: &dispute.attempt_id,
merchant_id: &dispute.merchant_id,
connector_status: &dispute.connector_status,
connector_dispute_id: &dispute.connector_dispute_id,
connector_reason: dispute.connector_reason.as_ref(),
connector_reason_code: dispute.connector_reason_code.as_ref(),
challenge_required_by: dispute.challenge_required_by.map(|i| i.assume_utc()),
connector_created_at: dispute.connector_created_at.map(|i| i.assume_utc()),
connector_updated_at: dispute.connector_updated_at.map(|i| i.assume_utc()),
created_at: dispute.created_at.assume_utc(),
modified_at: dispute.modified_at.assume_utc(),
connector: &dispute.connector,
evidence: &dispute.evidence,
profile_id: dispute.profile_id.as_ref(),
merchant_connector_id: dispute.merchant_connector_id.as_ref(),
organization_id: &dispute.organization_id,
}
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 139,
"total_crates": null
}
|
fn_clm_router_key_-5759961059049571007
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/kafka/dispute
// Implementation of KafkaDispute<'_> for super::KafkaMessage
fn key(&self) -> String {
format!(
"{}_{}_{}",
self.merchant_id.get_string_repr(),
self.payment_id.get_string_repr(),
self.dispute_id
)
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 29,
"total_crates": null
}
|
fn_clm_router_event_type_-5759961059049571007
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/kafka/dispute
// Implementation of KafkaDispute<'_> for super::KafkaMessage
fn event_type(&self) -> crate::events::EventType {
crate::events::EventType::Dispute
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 14,
"total_crates": null
}
|
fn_clm_router_from_storage_8044199831957936498
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/kafka/payment_attempt
// Inherent implementation for KafkaPaymentAttempt<'a>
pub fn from_storage(attempt: &'a PaymentAttempt) -> Self {
use masking::PeekInterface;
let PaymentAttempt {
payment_id,
merchant_id,
attempts_group_id,
amount_details,
status,
connector,
error,
authentication_type,
created_at,
modified_at,
last_synced,
cancellation_reason,
browser_info,
payment_token,
connector_metadata,
payment_experience,
payment_method_data,
routing_result,
preprocessing_step_id,
multiple_capture_count,
connector_response_reference_id,
updated_by,
redirection_data,
encoded_data,
merchant_connector_id,
external_three_ds_authentication_attempted,
authentication_connector,
authentication_id,
fingerprint_id,
client_source,
client_version,
customer_acceptance,
profile_id,
organization_id,
payment_method_type,
payment_method_id,
connector_payment_id,
payment_method_subtype,
authentication_applied,
external_reference_id,
payment_method_billing_address,
id,
connector_token_details,
card_discovery,
charges,
feature_metadata,
processor_merchant_id,
created_by,
connector_request_reference_id,
network_transaction_id: _,
authorized_amount: _,
} = attempt;
let (connector_payment_id, connector_payment_data) = connector_payment_id
.clone()
.map(types::ConnectorTransactionId::form_id_and_data)
.map(|(txn_id, txn_data)| (Some(txn_id), txn_data))
.unwrap_or((None, None));
Self {
payment_id,
merchant_id,
attempt_id: id,
attempts_group_id: attempts_group_id.as_ref(),
status: *status,
amount: amount_details.get_net_amount(),
connector: connector.as_ref(),
error_message: error.as_ref().map(|error_details| &error_details.message),
surcharge_amount: amount_details.get_surcharge_amount(),
tax_amount: amount_details.get_tax_on_surcharge(),
payment_method_id: payment_method_id.as_ref(),
payment_method: *payment_method_type,
connector_transaction_id: connector_response_reference_id.as_ref(),
authentication_type: *authentication_type,
created_at: created_at.assume_utc(),
modified_at: modified_at.assume_utc(),
last_synced: last_synced.map(|i| i.assume_utc()),
cancellation_reason: cancellation_reason.as_ref(),
amount_to_capture: amount_details.get_amount_to_capture(),
browser_info: browser_info.as_ref(),
error_code: error.as_ref().map(|error_details| &error_details.code),
connector_metadata: connector_metadata.as_ref().map(|v| v.peek().to_string()),
payment_experience: payment_experience.as_ref(),
payment_method_type: payment_method_subtype,
payment_method_data: payment_method_data.as_ref().map(|v| v.peek().to_string()),
error_reason: error
.as_ref()
.and_then(|error_details| error_details.reason.as_ref()),
multiple_capture_count: *multiple_capture_count,
amount_capturable: amount_details.get_amount_capturable(),
merchant_connector_id: merchant_connector_id.as_ref(),
net_amount: amount_details.get_net_amount(),
unified_code: error
.as_ref()
.and_then(|error_details| error_details.unified_code.as_ref()),
unified_message: error
.as_ref()
.and_then(|error_details| error_details.unified_message.as_ref()),
client_source: client_source.as_ref(),
client_version: client_version.as_ref(),
profile_id,
organization_id,
card_network: payment_method_data
.as_ref()
.map(|data| data.peek())
.and_then(|data| data.as_object())
.and_then(|pm| pm.get("card"))
.and_then(|data| data.as_object())
.and_then(|card| card.get("card_network"))
.and_then(|network| network.as_str())
.map(|network| network.to_string()),
card_discovery: card_discovery.map(|discovery| discovery.to_string()),
payment_token: payment_token.clone(),
preprocessing_step_id: preprocessing_step_id.clone(),
connector_response_reference_id: connector_response_reference_id.clone(),
updated_by,
encoded_data: encoded_data.as_ref(),
external_three_ds_authentication_attempted: *external_three_ds_authentication_attempted,
authentication_connector: authentication_connector.clone(),
authentication_id: authentication_id
.as_ref()
.map(|id| id.get_string_repr().to_string().clone()),
fingerprint_id: fingerprint_id.clone(),
customer_acceptance: customer_acceptance.as_ref(),
shipping_cost: amount_details.get_shipping_cost(),
order_tax_amount: amount_details.get_order_tax_amount(),
charges: charges.clone(),
processor_merchant_id,
created_by: created_by.as_ref(),
payment_method_type_v2: *payment_method_type,
connector_payment_id: connector_payment_id.as_ref().cloned(),
payment_method_subtype: *payment_method_subtype,
routing_result: routing_result.clone(),
authentication_applied: *authentication_applied,
external_reference_id: external_reference_id.clone(),
tax_on_surcharge: amount_details.get_tax_on_surcharge(),
payment_method_billing_address: payment_method_billing_address
.as_ref()
.map(|v| masking::Secret::new(v.get_inner())),
redirection_data: redirection_data.as_ref(),
connector_payment_data,
connector_token_details: connector_token_details.as_ref(),
feature_metadata: feature_metadata.as_ref(),
network_advice_code: error
.as_ref()
.and_then(|details| details.network_advice_code.clone()),
network_decline_code: error
.as_ref()
.and_then(|details| details.network_decline_code.clone()),
network_error_message: error
.as_ref()
.and_then(|details| details.network_error_message.clone()),
connector_request_reference_id: connector_request_reference_id.clone(),
}
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 299,
"total_crates": null
}
|
fn_clm_router_key_8044199831957936498
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/kafka/payment_attempt
// Implementation of KafkaPaymentAttempt<'_> for super::KafkaMessage
fn key(&self) -> String {
format!(
"{}_{}_{}",
self.merchant_id.get_string_repr(),
self.payment_id.get_string_repr(),
self.attempt_id.get_string_repr()
)
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 29,
"total_crates": null
}
|
fn_clm_router_event_type_8044199831957936498
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/kafka/payment_attempt
// Implementation of KafkaPaymentAttempt<'_> for super::KafkaMessage
fn event_type(&self) -> crate::events::EventType {
crate::events::EventType::PaymentAttempt
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 14,
"total_crates": null
}
|
fn_clm_router_from_storage_6752585629902162321
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/kafka/payout
// Inherent implementation for KafkaPayout<'a>
pub fn from_storage(payouts: &'a Payouts, payout_attempt: &'a PayoutAttempt) -> Self {
Self {
payout_id: &payouts.payout_id,
payout_attempt_id: &payout_attempt.payout_attempt_id,
merchant_id: &payouts.merchant_id,
customer_id: payouts.customer_id.as_ref(),
address_id: payouts.address_id.as_ref(),
profile_id: &payouts.profile_id,
payout_method_id: payouts.payout_method_id.as_ref(),
payout_type: payouts.payout_type,
amount: payouts.amount,
destination_currency: payouts.destination_currency,
source_currency: payouts.source_currency,
description: payouts.description.as_ref(),
recurring: payouts.recurring,
auto_fulfill: payouts.auto_fulfill,
return_url: payouts.return_url.as_ref(),
entity_type: payouts.entity_type,
metadata: payouts.metadata.clone(),
created_at: payouts.created_at.assume_utc(),
last_modified_at: payouts.last_modified_at.assume_utc(),
attempt_count: payouts.attempt_count,
status: payouts.status,
priority: payouts.priority,
connector: payout_attempt.connector.as_ref(),
connector_payout_id: payout_attempt.connector_payout_id.as_ref(),
is_eligible: payout_attempt.is_eligible,
error_message: payout_attempt.error_message.as_ref(),
error_code: payout_attempt.error_code.as_ref(),
business_country: payout_attempt.business_country,
business_label: payout_attempt.business_label.as_ref(),
merchant_connector_id: payout_attempt.merchant_connector_id.as_ref(),
}
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 127,
"total_crates": null
}
|
fn_clm_router_key_6752585629902162321
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/kafka/payout
// Implementation of KafkaPayout<'_> for super::KafkaMessage
fn key(&self) -> String {
format!(
"{}_{}",
self.merchant_id.get_string_repr(),
self.payout_attempt_id
)
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 29,
"total_crates": null
}
|
fn_clm_router_event_type_6752585629902162321
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/kafka/payout
// Implementation of KafkaPayout<'_> for super::KafkaMessage
fn event_type(&self) -> crate::events::EventType {
crate::events::EventType::Payout
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 14,
"total_crates": null
}
|
fn_clm_router_from_storage_-6859222842490958533
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/kafka/fraud_check
// Inherent implementation for KafkaFraudCheck<'a>
pub fn from_storage(check: &'a FraudCheck) -> Self {
Self {
frm_id: &check.frm_id,
payment_id: &check.payment_id,
merchant_id: &check.merchant_id,
attempt_id: &check.attempt_id,
created_at: check.created_at.assume_utc(),
frm_name: &check.frm_name,
frm_transaction_id: check.frm_transaction_id.as_ref(),
frm_transaction_type: check.frm_transaction_type,
frm_status: check.frm_status,
frm_score: check.frm_score,
frm_reason: check.frm_reason.clone(),
frm_error: check.frm_error.as_ref(),
payment_details: check.payment_details.clone(),
metadata: check.metadata.clone(),
modified_at: check.modified_at.assume_utc(),
last_step: check.last_step,
payment_capture_method: check.payment_capture_method,
}
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 113,
"total_crates": null
}
|
fn_clm_router_key_-6859222842490958533
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/kafka/fraud_check
// Implementation of KafkaFraudCheck<'_> for super::KafkaMessage
fn key(&self) -> String {
format!(
"{}_{}_{}_{}",
self.merchant_id.get_string_repr(),
self.payment_id.get_string_repr(),
self.attempt_id,
self.frm_id
)
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 29,
"total_crates": null
}
|
fn_clm_router_event_type_-6859222842490958533
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/kafka/fraud_check
// Implementation of KafkaFraudCheck<'_> for super::KafkaMessage
fn event_type(&self) -> crate::events::EventType {
crate::events::EventType::FraudCheck
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 14,
"total_crates": null
}
|
fn_clm_router_from_storage_5930194058699797777
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/kafka/dispute_event
// Inherent implementation for KafkaDisputeEvent<'a>
pub fn from_storage(dispute: &'a Dispute) -> Self {
let currency = dispute.dispute_currency.unwrap_or(
dispute
.currency
.to_uppercase()
.parse_enum("Currency")
.unwrap_or_default(),
);
Self {
dispute_id: &dispute.dispute_id,
dispute_amount: StringMinorUnitForConnector::convert_back(
&StringMinorUnitForConnector,
dispute.amount.clone(),
currency,
)
.unwrap_or_else(|e| {
router_env::logger::error!("Failed to convert dispute amount: {e:?}");
MinorUnit::new(0)
}),
currency,
dispute_stage: &dispute.dispute_stage,
dispute_status: &dispute.dispute_status,
payment_id: &dispute.payment_id,
attempt_id: &dispute.attempt_id,
merchant_id: &dispute.merchant_id,
connector_status: &dispute.connector_status,
connector_dispute_id: &dispute.connector_dispute_id,
connector_reason: dispute.connector_reason.as_ref(),
connector_reason_code: dispute.connector_reason_code.as_ref(),
challenge_required_by: dispute.challenge_required_by.map(|i| i.assume_utc()),
connector_created_at: dispute.connector_created_at.map(|i| i.assume_utc()),
connector_updated_at: dispute.connector_updated_at.map(|i| i.assume_utc()),
created_at: dispute.created_at.assume_utc(),
modified_at: dispute.modified_at.assume_utc(),
connector: &dispute.connector,
evidence: &dispute.evidence,
profile_id: dispute.profile_id.as_ref(),
merchant_connector_id: dispute.merchant_connector_id.as_ref(),
organization_id: &dispute.organization_id,
}
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 139,
"total_crates": null
}
|
fn_clm_router_key_5930194058699797777
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/kafka/dispute_event
// Implementation of KafkaDisputeEvent<'_> for super::KafkaMessage
fn key(&self) -> String {
format!(
"{}_{}_{}",
self.merchant_id.get_string_repr(),
self.payment_id.get_string_repr(),
self.dispute_id
)
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 29,
"total_crates": null
}
|
fn_clm_router_event_type_5930194058699797777
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/kafka/dispute_event
// Implementation of KafkaDisputeEvent<'_> for super::KafkaMessage
fn event_type(&self) -> crate::events::EventType {
crate::events::EventType::Dispute
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 14,
"total_crates": null
}
|
fn_clm_router_from_storage_1901526986090957901
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/kafka/payment_attempt_event
// Inherent implementation for KafkaPaymentAttemptEvent<'a>
pub fn from_storage(attempt: &'a PaymentAttempt) -> Self {
use masking::PeekInterface;
let PaymentAttempt {
payment_id,
merchant_id,
attempts_group_id,
amount_details,
status,
connector,
error,
authentication_type,
created_at,
modified_at,
last_synced,
cancellation_reason,
browser_info,
payment_token,
connector_metadata,
payment_experience,
payment_method_data,
routing_result,
preprocessing_step_id,
multiple_capture_count,
connector_response_reference_id,
updated_by,
redirection_data,
encoded_data,
merchant_connector_id,
external_three_ds_authentication_attempted,
authentication_connector,
authentication_id,
fingerprint_id,
client_source,
client_version,
customer_acceptance,
profile_id,
organization_id,
payment_method_type,
payment_method_id,
connector_payment_id,
payment_method_subtype,
authentication_applied,
external_reference_id,
payment_method_billing_address,
id,
connector_token_details,
card_discovery,
charges,
feature_metadata,
processor_merchant_id,
created_by,
connector_request_reference_id,
network_transaction_id: _,
authorized_amount: _,
} = attempt;
let (connector_payment_id, connector_payment_data) = connector_payment_id
.clone()
.map(types::ConnectorTransactionId::form_id_and_data)
.map(|(txn_id, txn_data)| (Some(txn_id), txn_data))
.unwrap_or((None, None));
Self {
payment_id,
merchant_id,
attempt_id: id,
attempts_group_id: attempts_group_id.as_ref(),
status: *status,
amount: amount_details.get_net_amount(),
connector: connector.as_ref(),
error_message: error.as_ref().map(|error_details| &error_details.message),
surcharge_amount: amount_details.get_surcharge_amount(),
tax_amount: amount_details.get_tax_on_surcharge(),
payment_method_id: payment_method_id.as_ref(),
payment_method: *payment_method_type,
connector_transaction_id: connector_response_reference_id.as_ref(),
authentication_type: *authentication_type,
created_at: created_at.assume_utc(),
modified_at: modified_at.assume_utc(),
last_synced: last_synced.map(|i| i.assume_utc()),
cancellation_reason: cancellation_reason.as_ref(),
amount_to_capture: amount_details.get_amount_to_capture(),
browser_info: browser_info.as_ref(),
error_code: error.as_ref().map(|error_details| &error_details.code),
connector_metadata: connector_metadata.as_ref().map(|v| v.peek().to_string()),
payment_experience: payment_experience.as_ref(),
payment_method_type: payment_method_subtype,
payment_method_data: payment_method_data.as_ref().map(|v| v.peek().to_string()),
error_reason: error
.as_ref()
.and_then(|error_details| error_details.reason.as_ref()),
multiple_capture_count: *multiple_capture_count,
amount_capturable: amount_details.get_amount_capturable(),
merchant_connector_id: merchant_connector_id.as_ref(),
net_amount: amount_details.get_net_amount(),
unified_code: error
.as_ref()
.and_then(|error_details| error_details.unified_code.as_ref()),
unified_message: error
.as_ref()
.and_then(|error_details| error_details.unified_message.as_ref()),
client_source: client_source.as_ref(),
client_version: client_version.as_ref(),
profile_id,
organization_id,
card_network: payment_method_data
.as_ref()
.map(|data| data.peek())
.and_then(|data| data.as_object())
.and_then(|pm| pm.get("card"))
.and_then(|data| data.as_object())
.and_then(|card| card.get("card_network"))
.and_then(|network| network.as_str())
.map(|network| network.to_string()),
card_discovery: card_discovery.map(|discovery| discovery.to_string()),
payment_token: payment_token.clone(),
preprocessing_step_id: preprocessing_step_id.clone(),
connector_response_reference_id: connector_response_reference_id.clone(),
updated_by,
encoded_data: encoded_data.as_ref(),
external_three_ds_authentication_attempted: *external_three_ds_authentication_attempted,
authentication_connector: authentication_connector.clone(),
authentication_id: authentication_id
.as_ref()
.map(|id| id.get_string_repr().to_string()),
fingerprint_id: fingerprint_id.clone(),
customer_acceptance: customer_acceptance.as_ref(),
shipping_cost: amount_details.get_shipping_cost(),
order_tax_amount: amount_details.get_order_tax_amount(),
charges: charges.clone(),
processor_merchant_id,
created_by: created_by.as_ref(),
payment_method_type_v2: *payment_method_type,
connector_payment_id: connector_payment_id.as_ref().cloned(),
payment_method_subtype: *payment_method_subtype,
routing_result: routing_result.clone(),
authentication_applied: *authentication_applied,
external_reference_id: external_reference_id.clone(),
tax_on_surcharge: amount_details.get_tax_on_surcharge(),
payment_method_billing_address: payment_method_billing_address
.as_ref()
.map(|v| masking::Secret::new(v.get_inner())),
redirection_data: redirection_data.as_ref(),
connector_payment_data,
connector_token_details: connector_token_details.as_ref(),
feature_metadata: feature_metadata.as_ref(),
network_advice_code: error
.as_ref()
.and_then(|details| details.network_advice_code.clone()),
network_decline_code: error
.as_ref()
.and_then(|details| details.network_decline_code.clone()),
network_error_message: error
.as_ref()
.and_then(|details| details.network_error_message.clone()),
connector_request_reference_id: connector_request_reference_id.clone(),
}
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 297,
"total_crates": null
}
|
fn_clm_router_key_1901526986090957901
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/kafka/payment_attempt_event
// Implementation of KafkaPaymentAttemptEvent<'_> for super::KafkaMessage
fn key(&self) -> String {
format!(
"{}_{}_{}",
self.merchant_id.get_string_repr(),
self.payment_id.get_string_repr(),
self.attempt_id.get_string_repr()
)
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 29,
"total_crates": null
}
|
fn_clm_router_event_type_1901526986090957901
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/kafka/payment_attempt_event
// Implementation of KafkaPaymentAttemptEvent<'_> for super::KafkaMessage
fn event_type(&self) -> crate::events::EventType {
crate::events::EventType::PaymentAttempt
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 14,
"total_crates": null
}
|
fn_clm_router_from_storage_2810732472216628166
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/kafka/fraud_check_event
// Inherent implementation for KafkaFraudCheckEvent<'a>
pub fn from_storage(check: &'a FraudCheck) -> Self {
Self {
frm_id: &check.frm_id,
payment_id: &check.payment_id,
merchant_id: &check.merchant_id,
attempt_id: &check.attempt_id,
created_at: check.created_at.assume_utc(),
frm_name: &check.frm_name,
frm_transaction_id: check.frm_transaction_id.as_ref(),
frm_transaction_type: check.frm_transaction_type,
frm_status: check.frm_status,
frm_score: check.frm_score,
frm_reason: check.frm_reason.clone(),
frm_error: check.frm_error.as_ref(),
payment_details: check.payment_details.clone(),
metadata: check.metadata.clone(),
modified_at: check.modified_at.assume_utc(),
last_step: check.last_step,
payment_capture_method: check.payment_capture_method,
}
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 113,
"total_crates": null
}
|
fn_clm_router_key_2810732472216628166
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/kafka/fraud_check_event
// Implementation of KafkaFraudCheckEvent<'_> for super::KafkaMessage
fn key(&self) -> String {
format!(
"{}_{}_{}_{}",
self.merchant_id.get_string_repr(),
self.payment_id.get_string_repr(),
self.attempt_id,
self.frm_id
)
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 29,
"total_crates": null
}
|
fn_clm_router_event_type_2810732472216628166
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/kafka/fraud_check_event
// Implementation of KafkaFraudCheckEvent<'_> for super::KafkaMessage
fn event_type(&self) -> crate::events::EventType {
crate::events::EventType::FraudCheck
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 14,
"total_crates": null
}
|
fn_clm_router_from_storage_2176666053484711321
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/kafka/refund
// Inherent implementation for KafkaRefund<'a>
pub fn from_storage(refund: &'a Refund) -> Self {
let Refund {
payment_id,
merchant_id,
connector_transaction_id,
connector,
connector_refund_id,
external_reference_id,
refund_type,
total_amount,
currency,
refund_amount,
refund_status,
sent_to_gateway,
refund_error_message,
metadata,
refund_arn,
created_at,
modified_at,
description,
attempt_id,
refund_reason,
refund_error_code,
profile_id,
updated_by,
charges,
organization_id,
split_refunds,
unified_code,
unified_message,
processor_refund_data,
processor_transaction_data,
id,
merchant_reference_id,
connector_id,
} = refund;
Self {
refund_id: id,
merchant_reference_id,
payment_id,
merchant_id,
connector_transaction_id,
connector,
connector_refund_id: connector_refund_id.as_ref(),
external_reference_id: external_reference_id.as_ref(),
refund_type,
total_amount,
currency,
refund_amount,
refund_status,
sent_to_gateway,
refund_error_message: refund_error_message.as_ref(),
refund_arn: refund_arn.as_ref(),
created_at: created_at.assume_utc(),
modified_at: modified_at.assume_utc(),
description: description.as_ref(),
attempt_id,
refund_reason: refund_reason.as_ref(),
refund_error_code: refund_error_code.as_ref(),
profile_id: profile_id.as_ref(),
organization_id,
metadata: metadata.as_ref(),
updated_by,
merchant_connector_id: connector_id.as_ref(),
charges: charges.as_ref(),
connector_refund_data: processor_refund_data.as_ref(),
connector_transaction_data: processor_transaction_data.as_ref(),
split_refunds: split_refunds.as_ref(),
unified_code: unified_code.as_ref(),
unified_message: unified_message.as_ref(),
processor_refund_data: processor_refund_data.as_ref(),
processor_transaction_data: processor_transaction_data.as_ref(),
}
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 139,
"total_crates": null
}
|
fn_clm_router_key_2176666053484711321
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/kafka/refund
// Implementation of KafkaRefund<'_> for super::KafkaMessage
fn key(&self) -> String {
format!(
"{}_{}_{}_{}",
self.merchant_id.get_string_repr(),
self.payment_id.get_string_repr(),
self.attempt_id.get_string_repr(),
self.merchant_reference_id.get_string_repr()
)
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 29,
"total_crates": null
}
|
fn_clm_router_event_type_2176666053484711321
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/kafka/refund
// Implementation of KafkaRefund<'_> for super::KafkaMessage
fn event_type(&self) -> events::EventType {
events::EventType::Refund
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 14,
"total_crates": null
}
|
fn_clm_router_get_id_-1119827669581783510
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/kafka/payment_intent_event
// Inherent implementation for KafkaPaymentIntentEvent<'_>
pub fn get_id(&self) -> &id_type::GlobalPaymentId {
self.payment_id
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 2472,
"total_crates": null
}
|
fn_clm_router_from_storage_-1119827669581783510
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/kafka/payment_intent_event
// Inherent implementation for KafkaPaymentIntentEvent<'a>
pub fn from_storage(intent: &'a PaymentIntent, infra_values: Option<Value>) -> Self {
let PaymentIntent {
id,
merchant_id,
status,
amount_details,
amount_captured,
customer_id,
description,
return_url,
metadata,
statement_descriptor,
created_at,
modified_at,
last_synced,
setup_future_usage,
active_attempt_id,
active_attempt_id_type,
active_attempts_group_id,
order_details,
allowed_payment_method_types,
connector_metadata,
feature_metadata,
attempt_count,
profile_id,
payment_link_id,
frm_merchant_decision,
updated_by,
request_incremental_authorization,
split_txns_enabled,
authorization_count,
session_expiry,
request_external_three_ds_authentication,
frm_metadata,
customer_details,
merchant_reference_id,
billing_address,
shipping_address,
capture_method,
authentication_type,
prerouting_algorithm,
organization_id,
enable_payment_link,
apply_mit_exemption,
customer_present,
payment_link_config,
routing_algorithm_id,
split_payments,
force_3ds_challenge,
force_3ds_challenge_trigger,
processor_merchant_id,
created_by,
is_iframe_redirection_enabled,
is_payment_id_from_merchant,
enable_partial_authorization,
} = intent;
Self {
payment_id: id,
merchant_id,
status: *status,
amount: amount_details.order_amount,
currency: amount_details.currency,
amount_captured: *amount_captured,
customer_id: customer_id.as_ref(),
description: description.as_ref(),
return_url: return_url.as_ref(),
metadata: metadata.as_ref(),
statement_descriptor: statement_descriptor.as_ref(),
created_at: created_at.assume_utc(),
modified_at: modified_at.assume_utc(),
last_synced: last_synced.map(|t| t.assume_utc()),
setup_future_usage: *setup_future_usage,
off_session: setup_future_usage.is_off_session(),
active_attempt_id: active_attempt_id.as_ref(),
active_attempt_id_type: *active_attempt_id_type,
active_attempts_group_id: active_attempts_group_id.as_ref(),
attempt_count: *attempt_count,
profile_id,
customer_email: None,
feature_metadata: feature_metadata.as_ref(),
organization_id,
order_details: order_details.as_ref(),
allowed_payment_method_types: allowed_payment_method_types.as_ref(),
connector_metadata: connector_metadata.as_ref(),
payment_link_id: payment_link_id.as_ref(),
updated_by,
surcharge_applicable: None,
request_incremental_authorization: *request_incremental_authorization,
split_txns_enabled: *split_txns_enabled,
authorization_count: *authorization_count,
session_expiry: session_expiry.assume_utc(),
request_external_three_ds_authentication: *request_external_three_ds_authentication,
frm_metadata: frm_metadata
.as_ref()
.map(|frm_metadata| frm_metadata.as_ref()),
customer_details: customer_details
.as_ref()
.map(|customer_details| customer_details.get_inner().as_ref()),
shipping_cost: amount_details.shipping_cost,
tax_details: amount_details.tax_details.clone(),
skip_external_tax_calculation: amount_details.get_external_tax_action_as_bool(),
request_extended_authorization: None,
psd2_sca_exemption_type: None,
split_payments: split_payments.as_ref(),
platform_merchant_id: None,
force_3ds_challenge: *force_3ds_challenge,
force_3ds_challenge_trigger: *force_3ds_challenge_trigger,
processor_merchant_id,
created_by: created_by.as_ref(),
is_iframe_redirection_enabled: *is_iframe_redirection_enabled,
merchant_reference_id: merchant_reference_id.as_ref(),
billing_address: billing_address
.as_ref()
.map(|billing_address| Secret::new(billing_address.get_inner())),
shipping_address: shipping_address
.as_ref()
.map(|shipping_address| Secret::new(shipping_address.get_inner())),
capture_method: *capture_method,
authentication_type: *authentication_type,
prerouting_algorithm: prerouting_algorithm.as_ref(),
surcharge_amount: amount_details.surcharge_amount,
tax_on_surcharge: amount_details.tax_on_surcharge,
frm_merchant_decision: *frm_merchant_decision,
enable_payment_link: *enable_payment_link,
apply_mit_exemption: *apply_mit_exemption,
customer_present: *customer_present,
routing_algorithm_id: routing_algorithm_id.as_ref(),
payment_link_config: payment_link_config.as_ref(),
infra_values,
enable_partial_authorization: *enable_partial_authorization,
}
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 181,
"total_crates": null
}
|
fn_clm_router_key_-1119827669581783510
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/kafka/payment_intent_event
// Implementation of KafkaPaymentIntentEvent<'_> for super::KafkaMessage
fn key(&self) -> String {
format!(
"{}_{}",
self.merchant_id.get_string_repr(),
self.get_id().get_string_repr(),
)
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 29,
"total_crates": null
}
|
fn_clm_router_event_type_-1119827669581783510
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/kafka/payment_intent_event
// Implementation of KafkaPaymentIntentEvent<'_> for super::KafkaMessage
fn event_type(&self) -> crate::events::EventType {
crate::events::EventType::PaymentIntent
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 14,
"total_crates": null
}
|
fn_clm_router_from_storage_-1108559714339526583
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/kafka/authentication_event
// Inherent implementation for KafkaAuthenticationEvent<'a>
pub fn from_storage(authentication: &'a Authentication) -> Self {
Self {
created_at: authentication.created_at.assume_utc(),
modified_at: authentication.modified_at.assume_utc(),
authentication_id: &authentication.authentication_id,
merchant_id: &authentication.merchant_id,
authentication_status: authentication.authentication_status,
authentication_connector: authentication.authentication_connector.as_ref(),
connector_authentication_id: authentication.connector_authentication_id.as_ref(),
authentication_data: authentication.authentication_data.clone(),
payment_method_id: &authentication.payment_method_id,
authentication_type: authentication.authentication_type,
authentication_lifecycle_status: authentication.authentication_lifecycle_status,
error_code: authentication.error_code.as_ref(),
error_message: authentication.error_message.as_ref(),
connector_metadata: authentication.connector_metadata.clone(),
maximum_supported_version: authentication.maximum_supported_version.clone(),
threeds_server_transaction_id: authentication.threeds_server_transaction_id.as_ref(),
cavv: authentication.cavv.as_ref(),
authentication_flow_type: authentication.authentication_flow_type.as_ref(),
message_version: authentication.message_version.clone(),
eci: authentication.eci.as_ref(),
trans_status: authentication.trans_status.clone(),
acquirer_bin: authentication.acquirer_bin.as_ref(),
acquirer_merchant_id: authentication.acquirer_merchant_id.as_ref(),
three_ds_method_data: authentication.three_ds_method_data.as_ref(),
three_ds_method_url: authentication.three_ds_method_url.as_ref(),
acs_url: authentication.acs_url.as_ref(),
challenge_request: authentication.challenge_request.as_ref(),
acs_reference_number: authentication.acs_reference_number.as_ref(),
acs_trans_id: authentication.acs_trans_id.as_ref(),
acs_signed_content: authentication.acs_signed_content.as_ref(),
profile_id: &authentication.profile_id,
payment_id: authentication.payment_id.as_ref(),
merchant_connector_id: authentication.merchant_connector_id.as_ref(),
ds_trans_id: authentication.ds_trans_id.as_ref(),
directory_server_id: authentication.directory_server_id.as_ref(),
acquirer_country_code: authentication.acquirer_country_code.as_ref(),
organization_id: &authentication.organization_id,
}
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 157,
"total_crates": null
}
|
fn_clm_router_key_-1108559714339526583
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/kafka/authentication_event
// Implementation of KafkaAuthenticationEvent<'_> for super::KafkaMessage
fn key(&self) -> String {
format!(
"{}_{}",
self.merchant_id.get_string_repr(),
self.authentication_id.get_string_repr()
)
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 29,
"total_crates": null
}
|
fn_clm_router_event_type_-1108559714339526583
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/kafka/authentication_event
// Implementation of KafkaAuthenticationEvent<'_> for super::KafkaMessage
fn event_type(&self) -> crate::events::EventType {
crate::events::EventType::Authentication
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 14,
"total_crates": null
}
|
fn_clm_router_key_-2365277547488289896
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/kafka/revenue_recovery
// Implementation of RevenueRecovery<'_> for super::KafkaMessage
fn key(&self) -> String {
self.merchant_id.get_string_repr().to_string()
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 33,
"total_crates": null
}
|
fn_clm_router_event_type_-2365277547488289896
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/kafka/revenue_recovery
// Implementation of RevenueRecovery<'_> for super::KafkaMessage
fn event_type(&self) -> crate::events::EventType {
crate::events::EventType::RevenueRecovery
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 14,
"total_crates": null
}
|
fn_clm_router_from_storage_-8895265804082928729
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/kafka/authentication
// Inherent implementation for KafkaAuthentication<'a>
pub fn from_storage(authentication: &'a Authentication) -> Self {
Self {
created_at: authentication.created_at.assume_utc(),
modified_at: authentication.modified_at.assume_utc(),
authentication_id: &authentication.authentication_id,
merchant_id: &authentication.merchant_id,
authentication_status: authentication.authentication_status,
authentication_connector: authentication.authentication_connector.as_ref(),
connector_authentication_id: authentication.connector_authentication_id.as_ref(),
authentication_data: authentication.authentication_data.clone(),
payment_method_id: &authentication.payment_method_id,
authentication_type: authentication.authentication_type,
authentication_lifecycle_status: authentication.authentication_lifecycle_status,
error_code: authentication.error_code.as_ref(),
error_message: authentication.error_message.as_ref(),
connector_metadata: authentication.connector_metadata.clone(),
maximum_supported_version: authentication.maximum_supported_version.clone(),
threeds_server_transaction_id: authentication.threeds_server_transaction_id.as_ref(),
cavv: authentication.cavv.as_ref(),
authentication_flow_type: authentication.authentication_flow_type.as_ref(),
message_version: authentication.message_version.clone(),
eci: authentication.eci.as_ref(),
trans_status: authentication.trans_status.clone(),
acquirer_bin: authentication.acquirer_bin.as_ref(),
acquirer_merchant_id: authentication.acquirer_merchant_id.as_ref(),
three_ds_method_data: authentication.three_ds_method_data.as_ref(),
three_ds_method_url: authentication.three_ds_method_url.as_ref(),
acs_url: authentication.acs_url.as_ref(),
challenge_request: authentication.challenge_request.as_ref(),
acs_reference_number: authentication.acs_reference_number.as_ref(),
acs_trans_id: authentication.acs_trans_id.as_ref(),
acs_signed_content: authentication.acs_signed_content.as_ref(),
profile_id: &authentication.profile_id,
payment_id: authentication.payment_id.as_ref(),
merchant_connector_id: authentication.merchant_connector_id.as_ref(),
ds_trans_id: authentication.ds_trans_id.as_ref(),
directory_server_id: authentication.directory_server_id.as_ref(),
acquirer_country_code: authentication.acquirer_country_code.as_ref(),
organization_id: &authentication.organization_id,
}
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 157,
"total_crates": null
}
|
fn_clm_router_key_-8895265804082928729
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/kafka/authentication
// Implementation of KafkaAuthentication<'_> for super::KafkaMessage
fn key(&self) -> String {
format!(
"{}_{}",
self.merchant_id.get_string_repr(),
self.authentication_id.get_string_repr()
)
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 29,
"total_crates": null
}
|
fn_clm_router_event_type_-8895265804082928729
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/kafka/authentication
// Implementation of KafkaAuthentication<'_> for super::KafkaMessage
fn event_type(&self) -> crate::events::EventType {
crate::events::EventType::Authentication
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 14,
"total_crates": null
}
|
fn_clm_router_get_id_-6235054241365800764
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/kafka/payment_intent
// Inherent implementation for KafkaPaymentIntent<'_>
fn get_id(&self) -> &id_type::GlobalPaymentId {
self.payment_id
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 2462,
"total_crates": null
}
|
fn_clm_router_from_storage_-6235054241365800764
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/kafka/payment_intent
// Inherent implementation for KafkaPaymentIntent<'a>
pub fn from_storage(intent: &'a PaymentIntent, infra_values: Option<Value>) -> Self {
let PaymentIntent {
id,
merchant_id,
status,
amount_details,
amount_captured,
customer_id,
description,
return_url,
metadata,
statement_descriptor,
created_at,
modified_at,
last_synced,
setup_future_usage,
active_attempt_id,
active_attempt_id_type,
active_attempts_group_id,
order_details,
allowed_payment_method_types,
connector_metadata,
feature_metadata,
attempt_count,
profile_id,
payment_link_id,
frm_merchant_decision,
updated_by,
request_incremental_authorization,
split_txns_enabled,
authorization_count,
session_expiry,
request_external_three_ds_authentication,
frm_metadata,
customer_details,
merchant_reference_id,
billing_address,
shipping_address,
capture_method,
authentication_type,
prerouting_algorithm,
organization_id,
enable_payment_link,
apply_mit_exemption,
customer_present,
payment_link_config,
routing_algorithm_id,
split_payments,
force_3ds_challenge,
force_3ds_challenge_trigger,
processor_merchant_id,
created_by,
is_iframe_redirection_enabled,
is_payment_id_from_merchant,
enable_partial_authorization,
} = intent;
Self {
payment_id: id,
merchant_id,
status: *status,
amount: amount_details.order_amount,
currency: amount_details.currency,
amount_captured: *amount_captured,
customer_id: customer_id.as_ref(),
description: description.as_ref(),
return_url: return_url.as_ref(),
metadata: metadata.as_ref(),
statement_descriptor: statement_descriptor.as_ref(),
created_at: created_at.assume_utc(),
modified_at: modified_at.assume_utc(),
last_synced: last_synced.map(|t| t.assume_utc()),
setup_future_usage: *setup_future_usage,
off_session: setup_future_usage.is_off_session(),
active_attempt_id: active_attempt_id.as_ref(),
active_attempt_id_type: *active_attempt_id_type,
active_attempts_group_id: active_attempts_group_id.as_ref(),
attempt_count: *attempt_count,
profile_id,
customer_email: None,
feature_metadata: feature_metadata.as_ref(),
organization_id,
order_details: order_details.as_ref(),
allowed_payment_method_types: allowed_payment_method_types.as_ref(),
connector_metadata: connector_metadata.as_ref(),
payment_link_id: payment_link_id.as_ref(),
updated_by,
surcharge_applicable: None,
request_incremental_authorization: *request_incremental_authorization,
split_txns_enabled: *split_txns_enabled,
authorization_count: *authorization_count,
session_expiry: session_expiry.assume_utc(),
request_external_three_ds_authentication: *request_external_three_ds_authentication,
frm_metadata: frm_metadata
.as_ref()
.map(|frm_metadata| frm_metadata.as_ref()),
customer_details: customer_details
.as_ref()
.map(|customer_details| customer_details.get_inner().as_ref()),
shipping_cost: amount_details.shipping_cost,
tax_details: amount_details.tax_details.clone(),
skip_external_tax_calculation: amount_details.get_external_tax_action_as_bool(),
request_extended_authorization: None,
psd2_sca_exemption_type: None,
split_payments: split_payments.as_ref(),
platform_merchant_id: None,
force_3ds_challenge: *force_3ds_challenge,
force_3ds_challenge_trigger: *force_3ds_challenge_trigger,
processor_merchant_id,
created_by: created_by.as_ref(),
is_iframe_redirection_enabled: *is_iframe_redirection_enabled,
merchant_reference_id: merchant_reference_id.as_ref(),
billing_address: billing_address
.as_ref()
.map(|billing_address| Secret::new(billing_address.get_inner())),
shipping_address: shipping_address
.as_ref()
.map(|shipping_address| Secret::new(shipping_address.get_inner())),
capture_method: *capture_method,
authentication_type: *authentication_type,
prerouting_algorithm: prerouting_algorithm.as_ref(),
surcharge_amount: amount_details.surcharge_amount,
tax_on_surcharge: amount_details.tax_on_surcharge,
frm_merchant_decision: *frm_merchant_decision,
enable_payment_link: *enable_payment_link,
apply_mit_exemption: *apply_mit_exemption,
customer_present: *customer_present,
routing_algorithm_id: routing_algorithm_id.as_ref(),
payment_link_config: payment_link_config.as_ref(),
infra_values,
enable_partial_authorization: *enable_partial_authorization,
}
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 181,
"total_crates": null
}
|
fn_clm_router_key_-6235054241365800764
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/kafka/payment_intent
// Implementation of KafkaPaymentIntent<'_> for super::KafkaMessage
fn key(&self) -> String {
format!(
"{}_{}",
self.merchant_id.get_string_repr(),
self.get_id().get_string_repr(),
)
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 29,
"total_crates": null
}
|
fn_clm_router_event_type_-6235054241365800764
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/kafka/payment_intent
// Implementation of KafkaPaymentIntent<'_> for super::KafkaMessage
fn event_type(&self) -> crate::events::EventType {
crate::events::EventType::PaymentIntent
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 14,
"total_crates": null
}
|
fn_clm_router_new_-7504805892016300793
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/api/client
// Inherent implementation for ProxyClient
pub fn new(proxy_config: &Proxy) -> CustomResult<Self, ApiClientError> {
let client = client::get_client_builder(proxy_config)
.switch()?
.build()
.change_context(ApiClientError::InvalidProxyConfiguration)?;
Ok(Self {
proxy_config: proxy_config.clone(),
client,
request_id: None,
})
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 14473,
"total_crates": null
}
|
fn_clm_router_send_-7504805892016300793
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/api/client
// Implementation of RouterRequestBuilder for RequestBuilder
fn send(
self,
) -> CustomResult<
Box<dyn core::future::Future<Output = Result<reqwest::Response, reqwest::Error>> + 'static>,
ApiClientError,
> {
Ok(Box::new(
self.inner.ok_or(ApiClientError::UnexpectedState)?.send(),
))
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 110,
"total_crates": null
}
|
fn_clm_router_header_-7504805892016300793
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/api/client
// Implementation of RouterRequestBuilder for RequestBuilder
fn header(&mut self, key: String, value: Maskable<String>) -> CustomResult<(), ApiClientError> {
let header_value = match value {
Maskable::Masked(hvalue) => HeaderValue::from_str(hvalue.peek()).map(|mut h| {
h.set_sensitive(true);
h
}),
Maskable::Normal(hvalue) => HeaderValue::from_str(&hvalue),
}
.change_context(ApiClientError::HeaderMapConstructionFailed)?;
self.inner = self.inner.take().map(|r| r.header(key, header_value));
Ok(())
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 68,
"total_crates": null
}
|
fn_clm_router_json_-7504805892016300793
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/api/client
// Implementation of RouterRequestBuilder for RequestBuilder
fn json(&mut self, body: serde_json::Value) {
self.inner = self.inner.take().map(|r| r.json(&body));
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 59,
"total_crates": null
}
|
fn_clm_router_send_request_-7504805892016300793
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/api/client
// Implementation of MockApiClient for ApiClient
async fn send_request(
&self,
_state: &dyn ApiClientWrapper,
_request: Request,
_option_timeout_secs: Option<u64>,
_forward_to_kafka: bool,
) -> CustomResult<reqwest::Response, ApiClientError> {
// [#2066]: Add Mock implementation for ApiClient
Err(ApiClientError::UnexpectedState.into())
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 52,
"total_crates": null
}
|
fn_clm_router_build_payout_link_status_html_6725008146278823294
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/api/generic_link_response
pub fn build_payout_link_status_html(
link_data: &GenericLinkStatusData,
locale: &str,
) -> CustomResult<String, errors::ApiErrorResponse> {
let mut tera = Tera::default();
let mut context = Context::new();
// Insert dynamic context in CSS
let css_dynamic_context = "{{ color_scheme }}";
let css_template =
include_str!("../../core/generic_link/payout_link/status/styles.css").to_string();
let final_css = format!("{css_dynamic_context}\n{css_template}");
let _ = tera.add_raw_template("payout_link_status_styles", &final_css);
context.insert("color_scheme", &link_data.css_data);
let css_style_tag = tera
.render("payout_link_status_styles", &context)
.map(|css| format!("<style>{css}</style>"))
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Failed to render payout link status CSS template")?;
// Insert dynamic context in JS
let js_dynamic_context = "{{ script_data }}";
let js_template =
include_str!("../../core/generic_link/payout_link/status/script.js").to_string();
let final_js = format!("{js_dynamic_context}\n{js_template}");
let _ = tera.add_raw_template("payout_link_status_script", &final_js);
context.insert("script_data", &link_data.js_data);
context::insert_locales_in_context_for_payout_link_status(&mut context, locale);
let js_script_tag = tera
.render("payout_link_status_script", &context)
.map(|js| format!("<script>{js}</script>"))
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Failed to render payout link status JS template")?;
// Build HTML
let html_template =
include_str!("../../core/generic_link/payout_link/status/index.html").to_string();
let _ = tera.add_raw_template("payout_status_link", &html_template);
context.insert("css_style_tag", &css_style_tag);
context.insert("js_script_tag", &js_script_tag);
tera.render("payout_status_link", &context)
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Failed to render payout link status HTML template")
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 61,
"total_crates": null
}
|
fn_clm_router_build_pm_collect_link_status_html_6725008146278823294
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/api/generic_link_response
pub fn build_pm_collect_link_status_html(
link_data: &GenericLinkStatusData,
) -> CustomResult<String, errors::ApiErrorResponse> {
let mut tera = Tera::default();
let mut context = Context::new();
// Insert dynamic context in CSS
let css_dynamic_context = "{{ color_scheme }}";
let css_template =
include_str!("../../core/generic_link/payment_method_collect/status/styles.css")
.to_string();
let final_css = format!("{css_dynamic_context}\n{css_template}");
let _ = tera.add_raw_template("pm_collect_link_status_styles", &final_css);
context.insert("color_scheme", &link_data.css_data);
let css_style_tag = tera
.render("pm_collect_link_status_styles", &context)
.map(|css| format!("<style>{css}</style>"))
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Failed to render payment method collect link status CSS template")?;
// Insert dynamic context in JS
let js_dynamic_context = "{{ collect_link_status_context }}";
let js_template =
include_str!("../../core/generic_link/payment_method_collect/status/script.js").to_string();
let final_js = format!("{js_dynamic_context}\n{js_template}");
let _ = tera.add_raw_template("pm_collect_link_status_script", &final_js);
context.insert("collect_link_status_context", &link_data.js_data);
let js_script_tag = tera
.render("pm_collect_link_status_script", &context)
.map(|js| format!("<script>{js}</script>"))
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Failed to render payment method collect link status JS template")?;
// Build HTML
let html_template =
include_str!("../../core/generic_link/payment_method_collect/status/index.html")
.to_string();
let _ = tera.add_raw_template("payment_method_collect_status_link", &html_template);
context.insert("css_style_tag", &css_style_tag);
context.insert("js_script_tag", &js_script_tag);
tera.render("payment_method_collect_status_link", &context)
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Failed to render payment method collect link status HTML template")
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 59,
"total_crates": null
}
|
fn_clm_router_build_payout_link_html_6725008146278823294
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/api/generic_link_response
pub fn build_payout_link_html(
link_data: &GenericLinkFormData,
locale: &str,
) -> CustomResult<String, errors::ApiErrorResponse> {
let document = include_str!("../../core/generic_link/payout_link/initiate/index.html");
let styles = include_str!("../../core/generic_link/payout_link/initiate/styles.css");
let (mut tera, mut context) = build_html_template(link_data, document, styles)
.attach_printable("Failed to build context for payout link's HTML template")?;
// Insert dynamic context in JS
let script = include_str!("../../core/generic_link/payout_link/initiate/script.js");
let js_template = script.to_string();
let js_dynamic_context = "{{ script_data }}";
let final_js = format!("{js_dynamic_context}\n{js_template}");
let _ = tera.add_raw_template("document_scripts", &final_js);
context.insert("script_data", &link_data.js_data);
context::insert_locales_in_context_for_payout_link(&mut context, locale);
let js_script_tag = tera
.render("document_scripts", &context)
.map(|js| format!("<script>{js}</script>"))
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Failed to render JS template")?;
context.insert("js_script_tag", &js_script_tag);
context.insert(
"hyper_sdk_loader_script_tag",
&format!(
r#"<script src="{}" onload="initializePayoutSDK()"></script>"#,
link_data.sdk_url
),
);
// Render HTML template
tera.render("html_template", &context)
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Failed to render payout link's HTML template")
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 43,
"total_crates": null
}
|
fn_clm_router_build_pm_collect_link_html_6725008146278823294
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/api/generic_link_response
pub fn build_pm_collect_link_html(
link_data: &GenericLinkFormData,
) -> CustomResult<String, errors::ApiErrorResponse> {
let document =
include_str!("../../core/generic_link/payment_method_collect/initiate/index.html");
let styles = include_str!("../../core/generic_link/payment_method_collect/initiate/styles.css");
let (mut tera, mut context) = build_html_template(link_data, document, styles)
.attach_printable(
"Failed to build context for payment method collect link's HTML template",
)?;
// Insert dynamic context in JS
let script = include_str!("../../core/generic_link/payment_method_collect/initiate/script.js");
let js_template = script.to_string();
let js_dynamic_context = "{{ script_data }}";
let final_js = format!("{js_dynamic_context}\n{js_template}");
let _ = tera.add_raw_template("document_scripts", &final_js);
context.insert("script_data", &link_data.js_data);
let js_script_tag = tera
.render("document_scripts", &context)
.map(|js| format!("<script>{js}</script>"))
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Failed to render JS template")?;
context.insert("js_script_tag", &js_script_tag);
context.insert(
"hyper_sdk_loader_script_tag",
&format!(
r#"<script src="{}" onload="initializeCollectSDK()"></script>"#,
link_data.sdk_url
),
);
// Render HTML template
tera.render("html_template", &context)
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Failed to render payment method collect link's HTML template")
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 41,
"total_crates": null
}
|
fn_clm_router_build_generic_expired_link_html_6725008146278823294
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/api/generic_link_response
pub fn build_generic_expired_link_html(
link_data: &GenericExpiredLinkData,
) -> CustomResult<String, errors::ApiErrorResponse> {
let mut tera = Tera::default();
let mut context = Context::new();
// Build HTML
let html_template = include_str!("../../core/generic_link/expired_link/index.html").to_string();
let _ = tera.add_raw_template("generic_expired_link", &html_template);
context.insert("title", &link_data.title);
context.insert("message", &link_data.message);
context.insert("theme", &link_data.theme);
tera.render("generic_expired_link", &context)
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Failed to render expired link HTML template")
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 33,
"total_crates": null
}
|
fn_clm_router_get_language_-8187178242449434989
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/api/generic_link_response/context
fn get_language(locale_str: &str) -> String {
let lowercase_str = locale_str.to_lowercase();
let primary_locale = lowercase_str.split(',').next().unwrap_or("").trim();
if primary_locale.is_empty() {
return DEFAULT_LOCALE.to_string();
}
let parts = primary_locale.split('-').collect::<Vec<&str>>();
let language = *parts.first().unwrap_or(&DEFAULT_LOCALE);
let country = parts.get(1).copied();
match (language, country) {
("en", Some("gb")) => "en_gb".to_string(),
("fr", Some("be")) => "fr_be".to_string(),
(lang, _) => lang.to_string(),
}
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 57,
"total_crates": null
}
|
fn_clm_router_insert_locales_in_context_for_payout_link_-8187178242449434989
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/api/generic_link_response/context
pub fn insert_locales_in_context_for_payout_link(context: &mut Context, locale: &str) {
let language = get_language(locale);
let locale = language.as_str();
let i18n_payout_link_title = t!("payout_link.initiate.title", locale = locale);
let i18n_january = t!("months.january", locale = locale);
let i18n_february = t!("months.february", locale = locale);
let i18n_march = t!("months.march", locale = locale);
let i18n_april = t!("months.april", locale = locale);
let i18n_may = t!("months.may", locale = locale);
let i18n_june = t!("months.june", locale = locale);
let i18n_july = t!("months.july", locale = locale);
let i18n_august = t!("months.august", locale = locale);
let i18n_september = t!("months.september", locale = locale);
let i18n_october = t!("months.october", locale = locale);
let i18n_november = t!("months.november", locale = locale);
let i18n_december = t!("months.december", locale = locale);
let i18n_not_allowed = t!("payout_link.initiate.not_allowed", locale = locale);
let i18n_am = t!("time.am", locale = locale);
let i18n_pm = t!("time.pm", locale = locale);
context.insert("i18n_payout_link_title", &i18n_payout_link_title);
context.insert("i18n_january", &i18n_january);
context.insert("i18n_february", &i18n_february);
context.insert("i18n_march", &i18n_march);
context.insert("i18n_april", &i18n_april);
context.insert("i18n_may", &i18n_may);
context.insert("i18n_june", &i18n_june);
context.insert("i18n_july", &i18n_july);
context.insert("i18n_august", &i18n_august);
context.insert("i18n_september", &i18n_september);
context.insert("i18n_october", &i18n_october);
context.insert("i18n_november", &i18n_november);
context.insert("i18n_december", &i18n_december);
context.insert("i18n_not_allowed", &i18n_not_allowed);
context.insert("i18n_am", &i18n_am);
context.insert("i18n_pm", &i18n_pm);
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 49,
"total_crates": null
}
|
fn_clm_router_insert_locales_in_context_for_payout_link_status_-8187178242449434989
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/api/generic_link_response/context
pub fn insert_locales_in_context_for_payout_link_status(context: &mut Context, locale: &str) {
let language = get_language(locale);
let locale = language.as_str();
let i18n_payout_link_status_title = t!("payout_link.status.title", locale = locale);
let i18n_success_text = t!("payout_link.status.text.success", locale = locale);
let i18n_success_message = t!("payout_link.status.message.success", locale = locale);
let i18n_pending_text = t!("payout_link.status.text.processing", locale = locale);
let i18n_pending_message = t!("payout_link.status.message.processing", locale = locale);
let i18n_failed_text = t!("payout_link.status.text.failed", locale = locale);
let i18n_failed_message = t!("payout_link.status.message.failed", locale = locale);
let i18n_ref_id_text = t!("payout_link.status.info.ref_id", locale = locale);
let i18n_error_code_text = t!("payout_link.status.info.error_code", locale = locale);
let i18n_error_message = t!("payout_link.status.info.error_message", locale = locale);
let i18n_redirecting_text = t!(
"payout_link.status.redirection_text.redirecting",
locale = locale
);
let i18n_redirecting_in_text = t!(
"payout_link.status.redirection_text.redirecting_in",
locale = locale
);
let i18n_seconds_text = t!(
"payout_link.status.redirection_text.seconds",
locale = locale
);
context.insert(
"i18n_payout_link_status_title",
&i18n_payout_link_status_title,
);
context.insert("i18n_success_text", &i18n_success_text);
context.insert("i18n_success_message", &i18n_success_message);
context.insert("i18n_pending_text", &i18n_pending_text);
context.insert("i18n_pending_message", &i18n_pending_message);
context.insert("i18n_failed_text", &i18n_failed_text);
context.insert("i18n_failed_message", &i18n_failed_message);
context.insert("i18n_ref_id_text", &i18n_ref_id_text);
context.insert("i18n_error_code_text", &i18n_error_code_text);
context.insert("i18n_error_message", &i18n_error_message);
context.insert("i18n_redirecting_text", &i18n_redirecting_text);
context.insert("i18n_redirecting_in_text", &i18n_redirecting_in_text);
context.insert("i18n_seconds_text", &i18n_seconds_text);
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 43,
"total_crates": null
}
|
fn_clm_router_from_3399215930443595964
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/authorization/roles
// Implementation of RoleInfo for From<diesel_models::role::Role>
fn from(role: diesel_models::role::Role) -> Self {
Self {
role_id: role.role_id,
role_name: role.role_name,
groups: role.groups,
scope: role.scope,
entity_type: role.entity_type,
is_invitable: true,
is_deletable: true,
is_updatable: true,
is_internal: false,
}
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 2600,
"total_crates": null
}
|
fn_clm_router_get_entity_type_3399215930443595964
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/authorization/roles
// Implementation of None for RoleInfo
pub fn get_entity_type(&self) -> EntityType {
self.entity_type
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 195,
"total_crates": null
}
|
fn_clm_router_from_role_id_org_id_tenant_id_3399215930443595964
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/authorization/roles
// Implementation of None for RoleInfo
pub async fn from_role_id_org_id_tenant_id(
state: &SessionState,
role_id: &str,
org_id: &id_type::OrganizationId,
tenant_id: &id_type::TenantId,
) -> CustomResult<Self, errors::StorageError> {
if let Some(role) = predefined_roles::PREDEFINED_ROLES.get(role_id) {
Ok(role.clone())
} else {
state
.global_store
.find_by_role_id_org_id_tenant_id(role_id, org_id, tenant_id)
.await
.map(Self::from)
}
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 107,
"total_crates": null
}
|
fn_clm_router_get_permission_groups_3399215930443595964
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/authorization/roles
// Implementation of None for RoleInfo
pub fn get_permission_groups(&self) -> Vec<PermissionGroup> {
self.groups
.iter()
.flat_map(|group| group.accessible_groups())
.collect::<HashSet<_>>()
.into_iter()
.collect()
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 73,
"total_crates": null
}
|
fn_clm_router_get_recon_acl_3399215930443595964
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/authorization/roles
// Implementation of None for RoleInfo
pub fn get_recon_acl(&self) -> HashMap<Resource, ReconPermissionScope> {
let mut acl: HashMap<Resource, ReconPermissionScope> = HashMap::new();
let mut recon_resources = RECON_OPS.to_vec();
recon_resources.extend(RECON_REPORTS);
let recon_internal_resources = [Resource::ReconToken];
self.get_permission_groups()
.iter()
.for_each(|permission_group| {
permission_group.resources().iter().for_each(|resource| {
if recon_resources.contains(resource)
&& !recon_internal_resources.contains(resource)
{
let scope = match resource {
Resource::ReconAndSettlementAnalytics => ReconPermissionScope::Read,
_ => ReconPermissionScope::from(permission_group.scope()),
};
acl.entry(*resource)
.and_modify(|curr_scope| {
*curr_scope = if (*curr_scope) < scope {
scope
} else {
*curr_scope
}
})
.or_insert(scope);
}
})
});
acl
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 53,
"total_crates": null
}
|
fn_clm_router_scope_8654316667041386256
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/authorization/permission_groups
// Implementation of PermissionGroup for PermissionGroupExt
fn scope(&self) -> PermissionScope {
match self {
Self::OperationsView
| Self::ConnectorsView
| Self::WorkflowsView
| Self::AnalyticsView
| Self::UsersView
| Self::AccountView
| Self::ReconOpsView
| Self::ReconReportsView
| Self::ThemeView => PermissionScope::Read,
Self::OperationsManage
| Self::ConnectorsManage
| Self::WorkflowsManage
| Self::UsersManage
| Self::AccountManage
| Self::ReconOpsManage
| Self::ReconReportsManage
| Self::InternalManage
| Self::ThemeManage => PermissionScope::Write,
}
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 74,
"total_crates": null
}
|
fn_clm_router_parent_8654316667041386256
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/authorization/permission_groups
// Implementation of PermissionGroup for PermissionGroupExt
fn parent(&self) -> ParentGroup {
match self {
Self::OperationsView | Self::OperationsManage => ParentGroup::Operations,
Self::ConnectorsView | Self::ConnectorsManage => ParentGroup::Connectors,
Self::WorkflowsView | Self::WorkflowsManage => ParentGroup::Workflows,
Self::AnalyticsView => ParentGroup::Analytics,
Self::UsersView | Self::UsersManage => ParentGroup::Users,
Self::AccountView | Self::AccountManage => ParentGroup::Account,
Self::ThemeView | Self::ThemeManage => ParentGroup::Theme,
Self::ReconOpsView | Self::ReconOpsManage => ParentGroup::ReconOps,
Self::ReconReportsView | Self::ReconReportsManage => ParentGroup::ReconReports,
Self::InternalManage => ParentGroup::Internal,
}
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 47,
"total_crates": null
}
|
fn_clm_router_resources_8654316667041386256
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/authorization/permission_groups
// Implementation of ParentGroup for ParentGroupExt
fn resources(&self) -> Vec<Resource> {
match self {
Self::Operations => OPERATIONS.to_vec(),
Self::Connectors => CONNECTORS.to_vec(),
Self::Workflows => WORKFLOWS.to_vec(),
Self::Analytics => ANALYTICS.to_vec(),
Self::Users => USERS.to_vec(),
Self::Account => ACCOUNT.to_vec(),
Self::ReconOps => RECON_OPS.to_vec(),
Self::ReconReports => RECON_REPORTS.to_vec(),
Self::Internal => INTERNAL.to_vec(),
Self::Theme => THEME.to_vec(),
}
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 46,
"total_crates": null
}
|
fn_clm_router_get_descriptions_for_groups_8654316667041386256
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/authorization/permission_groups
// Implementation of ParentGroup for ParentGroupExt
fn get_descriptions_for_groups(
entity_type: EntityType,
groups: Vec<PermissionGroup>,
) -> Option<HashMap<Self, String>> {
let descriptions_map = Self::iter()
.filter_map(|parent| {
if !groups.iter().any(|group| group.parent() == parent) {
return None;
}
let filtered_resources =
permissions::filter_resources_by_entity_type(parent.resources(), entity_type)?;
let description = filtered_resources
.iter()
.map(|res| permissions::get_resource_name(*res, entity_type))
.collect::<Option<Vec<_>>>()?
.join(", ");
Some((parent, description))
})
.collect::<HashMap<_, _>>();
descriptions_map
.is_empty()
.not()
.then_some(descriptions_map)
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 42,
"total_crates": null
}
|
fn_clm_router_get_available_scopes_8654316667041386256
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/authorization/permission_groups
// Implementation of ParentGroup for ParentGroupExt
fn get_available_scopes(&self) -> Vec<PermissionScope> {
PermissionGroup::iter()
.filter(|group| group.parent() == *self)
.map(|group| group.scope())
.collect()
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 23,
"total_crates": null
}
|
fn_clm_router_get_group_authorization_info_7950082625284054422
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/authorization/info
pub fn get_group_authorization_info() -> Option<Vec<GroupInfo>> {
let groups = PermissionGroup::iter()
.filter_map(get_group_info_from_permission_group)
.collect::<Vec<_>>();
groups.is_empty().not().then_some(groups)
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 23,
"total_crates": null
}
|
fn_clm_router_get_parent_group_description_7950082625284054422
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/authorization/info
pub fn get_parent_group_description(group: ParentGroup) -> Option<&'static str> {
match group {
ParentGroup::Operations => Some("Payments, Refunds, Payouts, Mandates, Disputes and Customers"),
ParentGroup::Connectors => Some("Create, modify and delete connectors like Payment Processors, Payout Processors and Fraud & Risk Manager"),
ParentGroup::Workflows => Some("Create, modify and delete Routing, 3DS Decision Manager, Surcharge Decision Manager"),
ParentGroup::Analytics => Some("View Analytics"),
ParentGroup::Users => Some("Manage and invite Users to the Team"),
ParentGroup::Account => Some("Create, modify and delete Merchant Details like api keys, webhooks, etc"),
ParentGroup::ReconOps => Some("View, manage reconciliation operations like upload and process files, run reconciliation etc"),
ParentGroup::ReconReports => Some("View, manage reconciliation reports and analytics"),
ParentGroup::Theme => Some("Manage and view themes for the organization"),
ParentGroup::Internal => None, // Internal group, no user-facing description
}
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 13,
"total_crates": null
}
|
fn_clm_router_get_group_description_7950082625284054422
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/authorization/info
fn get_group_description(group: PermissionGroup) -> Option<&'static str> {
match group {
PermissionGroup::OperationsView => {
Some("View Payments, Refunds, Payouts, Mandates, Disputes and Customers")
}
PermissionGroup::OperationsManage => {
Some("Create, modify and delete Payments, Refunds, Payouts, Mandates, Disputes and Customers")
}
PermissionGroup::ConnectorsView => {
Some("View connected Payment Processors, Payout Processors and Fraud & Risk Manager details")
}
PermissionGroup::ConnectorsManage => Some("Create, modify and delete connectors like Payment Processors, Payout Processors and Fraud & Risk Manager"),
PermissionGroup::WorkflowsView => {
Some("View Routing, 3DS Decision Manager, Surcharge Decision Manager")
}
PermissionGroup::WorkflowsManage => {
Some("Create, modify and delete Routing, 3DS Decision Manager, Surcharge Decision Manager")
}
PermissionGroup::AnalyticsView => Some("View Analytics"),
PermissionGroup::UsersView => Some("View Users"),
PermissionGroup::UsersManage => Some("Manage and invite Users to the Team"),
PermissionGroup::AccountView => Some("View Merchant Details"),
PermissionGroup::AccountManage => Some("Create, modify and delete Merchant Details like api keys, webhooks, etc"),
PermissionGroup::ReconReportsView => Some("View reconciliation reports and analytics"),
PermissionGroup::ReconReportsManage => Some("Manage reconciliation reports"),
PermissionGroup::ReconOpsView => Some("View and access all reconciliation operations including reports and analytics"),
PermissionGroup::ReconOpsManage => Some("Manage all reconciliation operations including reports and analytics"),
PermissionGroup::ThemeView => Some("View Themes"),
PermissionGroup::ThemeManage => Some("Manage Themes"),
PermissionGroup::InternalManage => None, // Internal group, no user-facing description
}
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 3,
"total_crates": null
}
|
fn_clm_router_get_group_info_from_permission_group_7950082625284054422
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/authorization/info
fn get_group_info_from_permission_group(group: PermissionGroup) -> Option<GroupInfo> {
let description = get_group_description(group)?;
Some(GroupInfo { group, description })
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 2,
"total_crates": null
}
|
fn_clm_router_filter_resources_by_entity_type_-5487432612745326073
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/authorization/permissions
pub fn filter_resources_by_entity_type(
resources: Vec<Resource>,
entity_type: EntityType,
) -> Option<Vec<Resource>> {
let filtered: Vec<Resource> = resources
.into_iter()
.filter(|res| res.entities().iter().any(|entity| entity <= &entity_type))
.collect();
(!filtered.is_empty()).then_some(filtered)
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 35,
"total_crates": null
}
|
fn_clm_router_get_resource_name_-5487432612745326073
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/authorization/permissions
pub fn get_resource_name(resource: Resource, entity_type: EntityType) -> Option<&'static str> {
match (resource, entity_type) {
(Resource::Payment, _) => Some("Payments"),
(Resource::Refund, _) => Some("Refunds"),
(Resource::Dispute, _) => Some("Disputes"),
(Resource::Mandate, _) => Some("Mandates"),
(Resource::Customer, _) => Some("Customers"),
(Resource::Payout, _) => Some("Payouts"),
(Resource::ApiKey, _) => Some("Api Keys"),
(Resource::Connector, _) => {
Some("Payment Processors, Payout Processors, Fraud & Risk Managers")
}
(Resource::Routing, _) => Some("Routing"),
(Resource::Subscription, _) => Some("Subscription"),
(Resource::RevenueRecovery, _) => Some("Revenue Recovery"),
(Resource::ThreeDsDecisionManager, _) => Some("3DS Decision Manager"),
(Resource::SurchargeDecisionManager, _) => Some("Surcharge Decision Manager"),
(Resource::Analytics, _) => Some("Analytics"),
(Resource::Report, _) => Some("Operation Reports"),
(Resource::User, _) => Some("Users"),
(Resource::WebhookEvent, _) => Some("Webhook Events"),
(Resource::ReconUpload, _) => Some("Reconciliation File Upload"),
(Resource::RunRecon, _) => Some("Run Reconciliation Process"),
(Resource::ReconConfig, _) => Some("Reconciliation Configurations"),
(Resource::ReconToken, _) => Some("Generate & Verify Reconciliation Token"),
(Resource::ReconFiles, _) => Some("Reconciliation Process Manager"),
(Resource::ReconReports, _) => Some("Reconciliation Reports"),
(Resource::ReconAndSettlementAnalytics, _) => Some("Reconciliation Analytics"),
(Resource::Account, EntityType::Profile) => Some("Business Profile Account"),
(Resource::Account, EntityType::Merchant) => Some("Merchant Account"),
(Resource::Account, EntityType::Organization) => Some("Organization Account"),
(Resource::Account, EntityType::Tenant) => Some("Tenant Account"),
(Resource::Theme, _) => Some("Themes"),
(Resource::InternalConnector, _) => None,
}
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 16,
"total_crates": null
}
|
fn_clm_router_get_scope_name_-5487432612745326073
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/authorization/permissions
pub fn get_scope_name(scope: PermissionScope) -> &'static str {
match scope {
PermissionScope::Read => "View",
PermissionScope::Write => "View and Manage",
}
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 10,
"total_crates": null
}
|
fn_clm_router_revoke_api_key_-4403341658741672088
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/authentication/decision
pub async fn revoke_api_key(
state: &SessionState,
api_key: Secret<String>,
) -> CustomResult<(), ApiClientError> {
let decision_config = if let Some(config) = &state.conf.decision {
config
} else {
return Ok(());
};
let rule = RuleDeleteRequest {
tag: state.tenant.schema.clone(),
variant: AuthType::ApiKey { api_key },
};
call_decision_service(state, decision_config, rule, RULE_DELETE_METHOD).await
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 35,
"total_crates": null
}
|
fn_clm_router_spawn_tracked_job_-4403341658741672088
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/authentication/decision
pub fn spawn_tracked_job<E, F>(future: F, request_type: &'static str)
where
E: std::fmt::Debug,
F: futures::Future<Output = Result<(), E>> + Send + 'static,
{
metrics::API_KEY_REQUEST_INITIATED
.add(1, router_env::metric_attributes!(("type", request_type)));
tokio::spawn(async move {
match future.await {
Ok(_) => {
metrics::API_KEY_REQUEST_COMPLETED
.add(1, router_env::metric_attributes!(("type", request_type)));
}
Err(e) => {
router_env::error!("Error in tracked job: {:?}", e);
}
}
});
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 31,
"total_crates": null
}
|
fn_clm_router_call_decision_service_-4403341658741672088
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/authentication/decision
async fn call_decision_service<T: ErasedMaskSerialize + Send + 'static>(
state: &SessionState,
decision_config: &DecisionConfig,
rule: T,
method: common_utils::request::Method,
) -> CustomResult<(), ApiClientError> {
let mut request = common_utils::request::Request::new(
method,
&(decision_config.base_url.clone() + DECISION_ENDPOINT),
);
request.set_body(RequestContent::Json(Box::new(rule)));
request.add_default_headers();
let response = state
.api_client
.send_request(state, request, None, false)
.await;
match response {
Err(error) => {
router_env::error!("Failed while calling the decision service: {:?}", error);
Err(error)
}
Ok(response) => {
router_env::info!("Decision service response: {:?}", response);
Ok(())
}
}
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 23,
"total_crates": null
}
|
fn_clm_router_add_publishable_key_-4403341658741672088
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/authentication/decision
pub async fn add_publishable_key(
state: &SessionState,
api_key: Secret<String>,
merchant_id: common_utils::id_type::MerchantId,
expiry: Option<u64>,
) -> CustomResult<(), ApiClientError> {
let decision_config = if let Some(config) = &state.conf.decision {
config
} else {
return Ok(());
};
let rule = RuleRequest {
tag: state.tenant.schema.clone(),
expiry,
variant: AuthRuleType::ApiKey {
api_key,
identifiers: Identifiers::PublishableKey {
merchant_id: merchant_id.get_string_repr().to_owned(),
},
},
};
call_decision_service(state, decision_config, rule, RULE_ADD_METHOD).await
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 21,
"total_crates": null
}
|
fn_clm_router_add_api_key_-4403341658741672088
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/authentication/decision
pub async fn add_api_key(
state: &SessionState,
api_key: Secret<String>,
merchant_id: common_utils::id_type::MerchantId,
key_id: common_utils::id_type::ApiKeyId,
expiry: Option<u64>,
) -> CustomResult<(), ApiClientError> {
let decision_config = if let Some(config) = &state.conf.decision {
config
} else {
return Ok(());
};
let rule = RuleRequest {
tag: state.tenant.schema.clone(),
expiry,
variant: AuthRuleType::ApiKey {
api_key,
identifiers: Identifiers::ApiKey {
merchant_id,
key_id,
},
},
};
call_decision_service(state, decision_config, rule, RULE_ADD_METHOD).await
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 20,
"total_crates": null
}
|
fn_clm_router_from_headers_4857145866923893051
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/authentication/detached
// Inherent implementation for ExtractedPayload
pub fn from_headers(headers: &HeaderMap) -> RouterResult<Self> {
let merchant_id = headers
.get(HEADER_MERCHANT_ID)
.and_then(|value| value.to_str().ok())
.ok_or_else(|| ApiErrorResponse::InvalidRequestData {
message: format!("`{HEADER_MERCHANT_ID}` header is invalid or not present"),
})
.map_err(error_stack::Report::from)
.and_then(|merchant_id| {
MerchantId::try_from(Cow::from(merchant_id.to_string())).change_context(
ApiErrorResponse::InvalidRequestData {
message: format!(
"`{HEADER_MERCHANT_ID}` header is invalid or not present",
),
},
)
})?;
let auth_type: PayloadType = headers
.get(HEADER_AUTH_TYPE)
.and_then(|inner| inner.to_str().ok())
.ok_or_else(|| ApiErrorResponse::InvalidRequestData {
message: format!("`{HEADER_AUTH_TYPE}` header not present"),
})?
.parse::<PayloadType>()
.change_context(ApiErrorResponse::InvalidRequestData {
message: format!("`{HEADER_AUTH_TYPE}` header not present"),
})?;
let key_id = headers
.get(HEADER_KEY_ID)
.and_then(|value| value.to_str().ok())
.map(|key_id| ApiKeyId::try_from(Cow::from(key_id.to_string())))
.transpose()
.change_context(ApiErrorResponse::InvalidRequestData {
message: format!("`{HEADER_KEY_ID}` header is invalid or not present"),
})?;
Ok(Self {
payload_type: auth_type,
merchant_id: Some(merchant_id),
key_id,
})
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 72,
"total_crates": null
}
|
fn_clm_router_verify_checksum_4857145866923893051
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/authentication/detached
// Inherent implementation for ExtractedPayload
pub fn verify_checksum(
&self,
headers: &HeaderMap,
algo: impl VerifySignature,
secret: &[u8],
) -> bool {
let output = || {
let checksum = headers.get(HEADER_CHECKSUM)?.to_str().ok()?;
let payload = self.generate_payload();
algo.verify_signature(secret, &hex::decode(checksum).ok()?, payload.as_bytes())
.ok()
};
output().unwrap_or(false)
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 40,
"total_crates": null
}
|
fn_clm_router_generate_payload_4857145866923893051
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/authentication/detached
// Inherent implementation for ExtractedPayload
fn generate_payload(&self) -> String {
append_option(
&self.payload_type.to_string(),
&self
.merchant_id
.as_ref()
.map(|inner| append_api_key(inner.get_string_repr(), &self.key_id)),
)
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 23,
"total_crates": null
}
|
fn_clm_router_append_option_4857145866923893051
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/authentication/detached
fn append_option(prefix: &str, data: &Option<String>) -> String {
match data {
Some(inner) => format!("{prefix}:{inner}"),
None => prefix.to_string(),
}
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 5,
"total_crates": null
}
|
fn_clm_router_append_api_key_4857145866923893051
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/authentication/detached
fn append_api_key(prefix: &str, data: &Option<ApiKeyId>) -> String {
match data {
Some(inner) => format!("{}:{}", prefix, inner.get_string_repr()),
None => prefix.to_string(),
}
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 5,
"total_crates": null
}
|
fn_clm_router_set_cookie_response_4827811314934294956
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/authentication/cookies
pub fn set_cookie_response<R>(response: R, token: Secret<String>) -> UserResponse<R> {
let jwt_expiry_in_seconds = JWT_TOKEN_TIME_IN_SECS
.try_into()
.map_err(|_| UserErrors::InternalServerError)?;
let (expiry, max_age) = get_expiry_and_max_age_from_seconds(jwt_expiry_in_seconds);
let header_value = create_cookie(token, expiry, max_age)
.to_string()
.into_masked();
let header_key = get_set_cookie_header();
let header = vec![(header_key, header_value)];
Ok(ApplicationResponse::JsonWithHeaders((response, header)))
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 62,
"total_crates": null
}
|
fn_clm_router_remove_cookie_response_4827811314934294956
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/authentication/cookies
pub fn remove_cookie_response() -> UserResponse<()> {
let (expiry, max_age) = get_expiry_and_max_age_from_seconds(0);
let header_key = get_set_cookie_header();
let header_value = create_cookie("".to_string().into(), expiry, max_age)
.to_string()
.into_masked();
let header = vec![(header_key, header_value)];
Ok(ApplicationResponse::JsonWithHeaders(((), header)))
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 35,
"total_crates": null
}
|
fn_clm_router_get_jwt_from_cookies_4827811314934294956
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/authentication/cookies
pub fn get_jwt_from_cookies(cookies: &str) -> RouterResult<String> {
Cookie::split_parse(cookies)
.find_map(|cookie| {
cookie
.ok()
.filter(|parsed_cookie| parsed_cookie.name() == JWT_TOKEN_COOKIE_NAME)
.map(|parsed_cookie| parsed_cookie.value().to_owned())
})
.ok_or(report!(ApiErrorResponse::InvalidJwtToken))
.attach_printable("Unable to find JWT token in cookies")
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 30,
"total_crates": null
}
|
fn_clm_router_create_cookie_4827811314934294956
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/authentication/cookies
fn create_cookie<'c>(
token: Secret<String>,
expires: OffsetDateTime,
max_age: Duration,
) -> Cookie<'c> {
Cookie::build((JWT_TOKEN_COOKIE_NAME, token.expose()))
.http_only(true)
.secure(true)
.same_site(SameSite::Strict)
.path("/")
.expires(expires)
.max_age(max_age)
.build()
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 24,
"total_crates": null
}
|
fn_clm_router_get_cookie_header_4827811314934294956
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/authentication/cookies
pub fn get_cookie_header() -> String {
actix_http::header::COOKIE.to_string()
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 15,
"total_crates": null
}
|
fn_clm_router_get_redis_connection_for_global_tenant_1322407110064381943
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/authentication/blacklist
fn get_redis_connection_for_global_tenant<A: SessionStateInfo>(
state: &A,
) -> RouterResult<Arc<RedisConnectionPool>> {
state
.global_store()
.get_redis_conn()
.change_context(ApiErrorResponse::InternalServerError)
.attach_printable("Failed to get redis connection")
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 92,
"total_crates": null
}
|
fn_clm_router_insert_user_in_blacklist_1322407110064381943
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/authentication/blacklist
pub async fn insert_user_in_blacklist(state: &SessionState, user_id: &str) -> UserResult<()> {
let user_blacklist_key = format!("{USER_BLACKLIST_PREFIX}{user_id}");
let expiry =
expiry_to_i64(JWT_TOKEN_TIME_IN_SECS).change_context(UserErrors::InternalServerError)?;
let redis_conn = get_redis_connection_for_global_tenant(state)
.change_context(UserErrors::InternalServerError)?;
redis_conn
.set_key_with_expiry(
&user_blacklist_key.as_str().into(),
date_time::now_unix_timestamp(),
expiry,
)
.await
.change_context(UserErrors::InternalServerError)
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 49,
"total_crates": null
}
|
fn_clm_router_insert_role_in_blacklist_1322407110064381943
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/authentication/blacklist
pub async fn insert_role_in_blacklist(state: &SessionState, role_id: &str) -> UserResult<()> {
let role_blacklist_key = format!("{ROLE_BLACKLIST_PREFIX}{role_id}");
let expiry =
expiry_to_i64(JWT_TOKEN_TIME_IN_SECS).change_context(UserErrors::InternalServerError)?;
let redis_conn = get_redis_connection_for_global_tenant(state)
.change_context(UserErrors::InternalServerError)?;
redis_conn
.set_key_with_expiry(
&role_blacklist_key.as_str().into(),
date_time::now_unix_timestamp(),
expiry,
)
.await
.change_context(UserErrors::InternalServerError)?;
invalidate_role_cache(state, role_id)
.await
.change_context(UserErrors::InternalServerError)
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 35,
"total_crates": null
}
|
fn_clm_router_insert_email_token_in_blacklist_1322407110064381943
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/authentication/blacklist
pub async fn insert_email_token_in_blacklist(state: &SessionState, token: &str) -> UserResult<()> {
let redis_conn = get_redis_connection_for_global_tenant(state)
.change_context(UserErrors::InternalServerError)?;
let blacklist_key = format!("{EMAIL_TOKEN_BLACKLIST_PREFIX}{token}");
let expiry =
expiry_to_i64(EMAIL_TOKEN_TIME_IN_SECS).change_context(UserErrors::InternalServerError)?;
redis_conn
.set_key_with_expiry(&blacklist_key.as_str().into(), true, expiry)
.await
.change_context(UserErrors::InternalServerError)
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 35,
"total_crates": null
}
|
fn_clm_router_check_email_token_in_blacklist_1322407110064381943
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/authentication/blacklist
pub async fn check_email_token_in_blacklist(state: &SessionState, token: &str) -> UserResult<()> {
let redis_conn = get_redis_connection_for_global_tenant(state)
.change_context(UserErrors::InternalServerError)?;
let blacklist_key = format!("{EMAIL_TOKEN_BLACKLIST_PREFIX}{token}");
let key_exists = redis_conn
.exists::<()>(&blacklist_key.as_str().into())
.await
.change_context(UserErrors::InternalServerError)?;
if key_exists {
return Err(UserErrors::LinkInvalid.into());
}
Ok(())
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 34,
"total_crates": null
}
|
fn_clm_router_new_6866749279729978299
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/email/types
// Inherent implementation for BizEmailProd
pub fn new(
state: &SessionState,
data: ProdIntent,
theme_id: Option<String>,
theme_config: EmailThemeConfig,
) -> UserResult<Self> {
Ok(Self {
recipient_email: domain::UserEmail::from_pii_email(
state.conf.email.prod_intent_recipient_email.clone(),
)?,
settings: state.conf.clone(),
user_name: data
.poc_name
.map(|s| Secret::new(s.peek().clone().into_inner()))
.unwrap_or_default(),
poc_email: data
.poc_email
.map(|s| Secret::new(s.peek().clone()))
.unwrap_or_default(),
legal_business_name: data
.legal_business_name
.map(|s| s.into_inner())
.unwrap_or_default(),
business_location: data
.business_location
.unwrap_or(common_enums::CountryAlpha2::AD)
.to_string(),
business_website: data
.business_website
.map(|s| s.into_inner())
.unwrap_or_default(),
theme_id,
theme_config,
product_type: data.product_type,
})
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 14507,
"total_crates": null
}
|
fn_clm_router_get_entity_type_6866749279729978299
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/email/types
// Inherent implementation for Entity
pub fn get_entity_type(&self) -> EntityType {
self.entity_type
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 195,
"total_crates": null
}
|
fn_clm_router_get_email_6866749279729978299
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/email/types
// Inherent implementation for EmailToken
pub fn get_email(&self) -> UserResult<domain::UserEmail> {
pii::Email::try_from(self.email.clone())
.change_context(UserErrors::InternalServerError)
.and_then(domain::UserEmail::from_pii_email)
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 101,
"total_crates": null
}
|
fn_clm_router_get_flow_6866749279729978299
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/email/types
// Inherent implementation for EmailToken
pub fn get_flow(&self) -> domain::Origin {
self.flow.clone()
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 56,
"total_crates": null
}
|
fn_clm_router_new_token_6866749279729978299
|
clm
|
function
|
// Repository: hyperswitch
// Crate: router
// Purpose: Main application server handling HTTP requests, authentication, and business logic orchestration
// Module: crates/router/src/services/email/types
// Inherent implementation for EmailToken
pub async fn new_token(
email: domain::UserEmail,
entity: Option<Entity>,
flow: domain::Origin,
settings: &configs::Settings,
) -> UserResult<String> {
let expiration_duration = std::time::Duration::from_secs(consts::EMAIL_TOKEN_TIME_IN_SECS);
let exp = jwt::generate_exp(expiration_duration)?.as_secs();
let token_payload = Self {
email: email.get_secret().expose(),
flow,
exp,
entity,
};
jwt::generate_jwt(&token_payload, settings).await
}
|
{
"crate": "router",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 45,
"total_crates": null
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.