text
stringlengths
65
57.3k
file_path
stringlengths
22
92
module
stringclasses
38 values
type
stringclasses
7 values
struct_name
stringlengths
3
60
impl_count
int64
0
60
traits
listlengths
0
59
tokens
int64
16
8.19k
function_name
stringlengths
3
85
type_name
stringlengths
1
67
trait_name
stringclasses
573 values
method_count
int64
0
31
public_method_count
int64
0
19
submodule_count
int64
0
56
export_count
int64
0
9
// Struct: AutoSettlement // File: crates/hyperswitch_connectors/src/connectors/worldpay/requests.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct AutoSettlement
crates/hyperswitch_connectors/src/connectors/worldpay/requests.rs
hyperswitch_connectors
struct_definition
AutoSettlement
0
[]
46
null
null
null
null
null
null
null
// Function: to_merchant_connector_info // File: crates/api_models/src/admin.rs // Module: api_models pub fn to_merchant_connector_info(&self, connector_label: &String) -> MerchantConnectorInfo
crates/api_models/src/admin.rs
api_models
function_signature
null
null
null
45
to_merchant_connector_info
null
null
null
null
null
null
// Module Structure // File: crates/hyperswitch_connectors/src/connectors/wellsfargopayout.rs // Module: hyperswitch_connectors // Public submodules: pub mod transformers;
crates/hyperswitch_connectors/src/connectors/wellsfargopayout.rs
hyperswitch_connectors
module_structure
null
null
null
42
null
null
null
null
null
1
0
// Function: get_id // File: crates/diesel_models/src/payment_method.rs // Module: diesel_models pub fn get_id(&self) -> &common_utils::id_type::GlobalPaymentMethodId
crates/diesel_models/src/payment_method.rs
diesel_models
function_signature
null
null
null
43
get_id
null
null
null
null
null
null
// Implementation: impl api::MandateSetup for for Aci // File: crates/hyperswitch_connectors/src/connectors/aci.rs // Module: hyperswitch_connectors // Methods: 0 total (0 public) impl api::MandateSetup for for Aci
crates/hyperswitch_connectors/src/connectors/aci.rs
hyperswitch_connectors
impl_block
null
null
null
61
null
Aci
api::MandateSetup for
0
0
null
null
// Struct: ChargeAmount // File: crates/hyperswitch_connectors/src/connectors/amazonpay/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct ChargeAmount
crates/hyperswitch_connectors/src/connectors/amazonpay/transformers.rs
hyperswitch_connectors
struct_definition
ChargeAmount
0
[]
46
null
null
null
null
null
null
null
// Function: update_enabled_features // File: crates/api_models/src/routing.rs // Module: api_models pub fn update_enabled_features(&mut self, feature_to_enable: DynamicRoutingFeatures)
crates/api_models/src/routing.rs
api_models
function_signature
null
null
null
41
update_enabled_features
null
null
null
null
null
null
// Implementation: impl Responder // File: crates/router/src/routes/payments.rs // Module: router // Methods: 0 total (0 public) impl Responder
crates/router/src/routes/payments.rs
router
impl_block
null
null
null
36
null
Responder
null
0
0
null
null
// Function: get_pm_link_config_as_value // File: crates/api_models/src/admin.rs // Module: api_models pub fn get_pm_link_config_as_value( &self, ) -> CustomResult<Option<serde_json::Value>, errors::ParsingError>
crates/api_models/src/admin.rs
api_models
function_signature
null
null
null
56
get_pm_link_config_as_value
null
null
null
null
null
null
// Implementation: impl api::PaymentSession for for Payu // File: crates/hyperswitch_connectors/src/connectors/payu.rs // Module: hyperswitch_connectors // Methods: 0 total (0 public) impl api::PaymentSession for for Payu
crates/hyperswitch_connectors/src/connectors/payu.rs
hyperswitch_connectors
impl_block
null
null
null
57
null
Payu
api::PaymentSession for
0
0
null
null
// File: crates/hyperswitch_connectors/src/connectors/datatrans/transformers.rs // Module: hyperswitch_connectors // Public structs: 21 use std::collections::HashMap; use api_models::payments::{self, AdditionalPaymentData}; use common_enums::enums; use common_utils::{pii::Email, request::Method, types::MinorUnit}; use hyperswitch_domain_models::{ payment_method_data::{Card, PaymentMethodData}, router_data::{ConnectorAuthType, ErrorResponse, RouterData}, router_flow_types::refunds::{Execute, RSync}, router_request_types::{PaymentsAuthorizeData, ResponseId, SetupMandateRequestData}, router_response_types::{ MandateReference, PaymentsResponseData, RedirectForm, RefundsResponseData, }, types, }; use hyperswitch_interfaces::{ consts::{NO_ERROR_CODE, NO_ERROR_MESSAGE}, errors, }; use masking::Secret; use serde::{Deserialize, Serialize}; use crate::{ types::{ PaymentsCancelResponseRouterData, PaymentsCaptureResponseRouterData, PaymentsSyncResponseRouterData, RefundsResponseRouterData, ResponseRouterData, }, utils::{ get_unimplemented_payment_method_error_message, AdditionalCardInfo, CardData as _, PaymentsAuthorizeRequestData, RouterData as _, }, }; const TRANSACTION_ALREADY_CANCELLED: &str = "transaction already canceled"; const TRANSACTION_ALREADY_SETTLED: &str = "already settled"; const REDIRECTION_SBX_URL: &str = "https://pay.sandbox.datatrans.com"; const REDIRECTION_PROD_URL: &str = "https://pay.datatrans.com"; #[derive(Default, Debug, Clone, Serialize, Deserialize)] pub struct DatatransErrorResponse { pub error: DatatransError, } pub struct DatatransAuthType { pub(super) merchant_id: Secret<String>, pub(super) passcode: Secret<String>, } pub struct DatatransRouterData<T> { pub amount: MinorUnit, pub router_data: T, } #[derive(Debug, Serialize, Clone)] #[serde(rename_all = "camelCase")] pub struct DatatransPaymentsRequest { pub amount: Option<MinorUnit>, pub currency: enums::Currency, pub card: DataTransPaymentDetails, pub refno: String, pub auto_settle: bool, #[serde(skip_serializing_if = "Option::is_none")] pub redirect: Option<RedirectUrls>, pub option: Option<DataTransCreateAlias>, } #[derive(Debug, Serialize, Clone)] #[serde(rename_all = "camelCase")] pub struct DataTransCreateAlias { pub create_alias: bool, } #[derive(Debug, Serialize, Clone)] #[serde(rename_all = "camelCase")] pub struct RedirectUrls { pub success_url: Option<String>, pub cancel_url: Option<String>, pub error_url: Option<String>, } #[derive(Debug, Deserialize, Clone, Serialize)] #[serde(rename_all = "snake_case")] pub enum TransactionType { Payment, Credit, CardCheck, } #[derive(Debug, Deserialize, Clone, Serialize)] #[serde(rename_all = "snake_case")] pub enum TransactionStatus { Initialized, Authenticated, Authorized, Settled, Canceled, Transmitted, Failed, ChallengeOngoing, ChallengeRequired, } #[derive(Debug, Deserialize, Clone, Serialize)] #[serde(untagged)] pub enum DatatransSyncResponse { Error(DatatransError), Response(SyncResponse), } #[derive(Debug, Deserialize, Serialize)] pub enum DataTransCaptureResponse { Error(DatatransError), Empty, } #[derive(Debug, Deserialize, Serialize)] pub enum DataTransCancelResponse { Error(DatatransError), Empty, } #[derive(Serialize, Deserialize, Clone, Debug)] #[serde(rename_all = "camelCase")] pub struct SyncResponse { pub transaction_id: String, #[serde(rename = "type")] pub res_type: TransactionType, pub status: TransactionStatus, pub detail: SyncDetails, pub card: Option<SyncCardDetails>, } #[derive(Serialize, Deserialize, Clone, Debug)] #[serde(rename_all = "camelCase")] pub struct SyncCardDetails { pub alias: Option<String>, } #[derive(Serialize, Deserialize, Clone, Debug)] #[serde(rename_all = "camelCase")] pub struct SyncDetails { fail: Option<FailDetails>, } #[derive(Serialize, Deserialize, Clone, Debug)] #[serde(rename_all = "camelCase")] pub struct FailDetails { reason: Option<String>, message: Option<String>, } #[derive(Serialize, Clone, Debug)] #[serde(rename_all = "camelCase")] #[serde(untagged)] pub enum DataTransPaymentDetails { Cards(PlainCardDetails), Mandate(MandateDetails), } #[derive(Serialize, Clone, Debug)] #[serde(rename_all = "camelCase")] pub struct PlainCardDetails { #[serde(rename = "type")] pub res_type: String, pub number: cards::CardNumber, pub expiry_month: Secret<String>, pub expiry_year: Secret<String>, pub cvv: Secret<String>, #[serde(skip_serializing_if = "Option::is_none")] #[serde(rename = "3D")] pub three_ds: Option<ThreeDSecureData>, } #[derive(Serialize, Clone, Debug)] #[serde(rename_all = "camelCase")] pub struct MandateDetails { #[serde(rename = "type")] pub res_type: String, pub alias: String, pub expiry_month: Secret<String>, pub expiry_year: Secret<String>, } #[derive(Serialize, Clone, Debug)] pub struct ThreedsInfo { cardholder: CardHolder, } #[derive(Serialize, Clone, Debug)] #[serde(untagged)] pub enum ThreeDSecureData { Cardholder(ThreedsInfo), Authentication(ThreeDSData), } #[derive(Debug, Serialize, Clone)] #[serde(rename_all = "camelCase")] pub struct ThreeDSData { #[serde(rename = "threeDSTransactionId")] pub three_ds_transaction_id: Option<Secret<String>>, pub cavv: Secret<String>, pub eci: Option<String>, pub xid: Option<Secret<String>>, #[serde(rename = "threeDSVersion")] pub three_ds_version: Option<String>, #[serde(rename = "authenticationResponse")] pub authentication_response: String, } #[derive(Debug, Serialize, Clone, Deserialize)] #[serde(rename_all = "camelCase")] pub struct CardHolder { cardholder_name: Secret<String>, email: Email, } #[derive(Debug, Clone, Serialize, Default, Deserialize)] pub struct DatatransError { pub code: String, pub message: String, } #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum DatatransResponse { TransactionResponse(DatatransSuccessResponse), ErrorResponse(DatatransError), ThreeDSResponse(Datatrans3DSResponse), } #[derive(Default, Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct DatatransSuccessResponse { pub transaction_id: String, pub acquirer_authorization_code: String, } #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum DatatransRefundsResponse { Success(DatatransSuccessResponse), Error(DatatransError), } #[derive(Default, Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct Datatrans3DSResponse { pub transaction_id: String, #[serde(rename = "3D")] pub three_ds_enrolled: ThreeDSEnolled, } #[derive(Default, Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct ThreeDSEnolled { pub enrolled: bool, } #[derive(Default, Debug, Serialize)] pub struct DatatransRefundRequest { pub amount: MinorUnit, pub currency: enums::Currency, pub refno: String, } #[derive(Debug, Serialize, Clone)] pub struct DataPaymentCaptureRequest { pub amount: MinorUnit, pub currency: enums::Currency, pub refno: String, } impl<T> TryFrom<(MinorUnit, T)> for DatatransRouterData<T> { type Error = error_stack::Report<errors::ConnectorError>; fn try_from((amount, item): (MinorUnit, T)) -> Result<Self, Self::Error> { Ok(Self { amount, router_data: item, }) } } impl TryFrom<&types::SetupMandateRouterData> for DatatransPaymentsRequest { type Error = error_stack::Report<errors::ConnectorError>; fn try_from(item: &types::SetupMandateRouterData) -> Result<Self, Self::Error> { match item.request.payment_method_data.clone() { PaymentMethodData::Card(req_card) => Ok(Self { amount: None, currency: item.request.currency, card: DataTransPaymentDetails::Cards(PlainCardDetails { res_type: "PLAIN".to_string(), number: req_card.card_number.clone(), expiry_month: req_card.card_exp_month.clone(), expiry_year: req_card.get_card_expiry_year_2_digit()?, cvv: req_card.card_cvc.clone(), three_ds: Some(ThreeDSecureData::Cardholder(ThreedsInfo { cardholder: CardHolder { cardholder_name: item.get_billing_full_name()?, email: item.get_billing_email()?, }, })), }), refno: item.connector_request_reference_id.clone(), auto_settle: true, // zero auth doesn't support manual capture option: Some(DataTransCreateAlias { create_alias: true }), redirect: Some(RedirectUrls { success_url: item.request.router_return_url.clone(), cancel_url: item.request.router_return_url.clone(), error_url: item.request.router_return_url.clone(), }), }), PaymentMethodData::Wallet(_) | PaymentMethodData::PayLater(_) | PaymentMethodData::BankRedirect(_) | PaymentMethodData::BankDebit(_) | PaymentMethodData::BankTransfer(_) | PaymentMethodData::MandatePayment | PaymentMethodData::Crypto(_) | PaymentMethodData::Reward | PaymentMethodData::RealTimePayment(_) | PaymentMethodData::MobilePayment(_) | PaymentMethodData::Upi(_) | PaymentMethodData::CardRedirect(_) | PaymentMethodData::Voucher(_) | PaymentMethodData::GiftCard(_) | PaymentMethodData::OpenBanking(_) | PaymentMethodData::CardToken(_) | PaymentMethodData::NetworkToken(_) | PaymentMethodData::CardDetailsForNetworkTransactionId(_) => { Err(errors::ConnectorError::NotImplemented( get_unimplemented_payment_method_error_message("Datatrans"), ))? } } } } impl TryFrom<&DatatransRouterData<&types::PaymentsAuthorizeRouterData>> for DatatransPaymentsRequest { type Error = error_stack::Report<errors::ConnectorError>; fn try_from( item: &DatatransRouterData<&types::PaymentsAuthorizeRouterData>, ) -> Result<Self, Self::Error> { match item.router_data.request.payment_method_data.clone() { PaymentMethodData::Card(req_card) => { let is_mandate_payment = item.router_data.request.is_mandate_payment(); let option = is_mandate_payment.then_some(DataTransCreateAlias { create_alias: true }); // provides return url for only mandate payment(CIT) or 3ds through datatrans let redirect = if is_mandate_payment || (item.router_data.is_three_ds() && item.router_data.request.authentication_data.is_none()) { Some(RedirectUrls { success_url: item.router_data.request.router_return_url.clone(), cancel_url: item.router_data.request.router_return_url.clone(), error_url: item.router_data.request.router_return_url.clone(), }) } else { None }; Ok(Self { amount: Some(item.amount), currency: item.router_data.request.currency, card: create_card_details(item, &req_card)?, refno: item.router_data.connector_request_reference_id.clone(), auto_settle: item.router_data.request.is_auto_capture()?, option, redirect, }) } PaymentMethodData::MandatePayment => { let additional_payment_data = match item .router_data .request .additional_payment_method_data .clone() .ok_or(errors::ConnectorError::MissingRequiredField { field_name: "additional_payment_method_data", })? { AdditionalPaymentData::Card(card) => *card, _ => Err(errors::ConnectorError::NotSupported { message: "Payment Method Not Supported".to_string(), connector: "DataTrans", })?, }; Ok(Self { amount: Some(item.amount), currency: item.router_data.request.currency, card: create_mandate_details(item, &additional_payment_data)?, refno: item.router_data.connector_request_reference_id.clone(), auto_settle: item.router_data.request.is_auto_capture()?, option: None, redirect: None, }) } PaymentMethodData::Wallet(_) | PaymentMethodData::PayLater(_) | PaymentMethodData::BankRedirect(_) | PaymentMethodData::BankDebit(_) | PaymentMethodData::BankTransfer(_) | PaymentMethodData::Crypto(_) | PaymentMethodData::Reward | PaymentMethodData::RealTimePayment(_) | PaymentMethodData::MobilePayment(_) | PaymentMethodData::Upi(_) | PaymentMethodData::CardRedirect(_) | PaymentMethodData::Voucher(_) | PaymentMethodData::GiftCard(_) | PaymentMethodData::OpenBanking(_) | PaymentMethodData::CardToken(_) | PaymentMethodData::NetworkToken(_) | PaymentMethodData::CardDetailsForNetworkTransactionId(_) => { Err(errors::ConnectorError::NotImplemented( get_unimplemented_payment_method_error_message("Datatrans"), ))? } } } } impl TryFrom<&ConnectorAuthType> for DatatransAuthType { type Error = error_stack::Report<errors::ConnectorError>; fn try_from(auth_type: &ConnectorAuthType) -> Result<Self, Self::Error> { match auth_type { ConnectorAuthType::BodyKey { api_key, key1 } => Ok(Self { merchant_id: key1.clone(), passcode: api_key.clone(), }), _ => Err(errors::ConnectorError::FailedToObtainAuthType.into()), } } } fn get_status(item: &DatatransResponse, is_auto_capture: bool) -> enums::AttemptStatus { match item { DatatransResponse::ErrorResponse(_) => enums::AttemptStatus::Failure, DatatransResponse::TransactionResponse(_) => { if is_auto_capture { enums::AttemptStatus::Charged } else { enums::AttemptStatus::Authorized } } DatatransResponse::ThreeDSResponse(_) => enums::AttemptStatus::AuthenticationPending, } } fn create_card_details( item: &DatatransRouterData<&types::PaymentsAuthorizeRouterData>, card: &Card, ) -> Result<DataTransPaymentDetails, error_stack::Report<errors::ConnectorError>> { let mut details = PlainCardDetails { res_type: "PLAIN".to_string(), number: card.card_number.clone(), expiry_month: card.card_exp_month.clone(), expiry_year: card.get_card_expiry_year_2_digit()?, cvv: card.card_cvc.clone(), three_ds: None, }; if let Some(auth_data) = &item.router_data.request.authentication_data { details.three_ds = Some(ThreeDSecureData::Authentication(ThreeDSData { three_ds_transaction_id: auth_data .threeds_server_transaction_id .clone() .map(Secret::new), cavv: auth_data.cavv.clone(), eci: auth_data.eci.clone(), xid: auth_data.ds_trans_id.clone().map(Secret::new), three_ds_version: auth_data .message_version .clone() .map(|version| version.to_string()), authentication_response: "Y".to_string(), })); } else if item.router_data.is_three_ds() { details.three_ds = Some(ThreeDSecureData::Cardholder(ThreedsInfo { cardholder: CardHolder { cardholder_name: item.router_data.get_billing_full_name()?, email: item.router_data.get_billing_email()?, }, })); } Ok(DataTransPaymentDetails::Cards(details)) } fn create_mandate_details( item: &DatatransRouterData<&types::PaymentsAuthorizeRouterData>, additional_card_details: &payments::AdditionalCardInfo, ) -> Result<DataTransPaymentDetails, error_stack::Report<errors::ConnectorError>> { let alias = item.router_data.request.get_connector_mandate_id()?; Ok(DataTransPaymentDetails::Mandate(MandateDetails { res_type: "ALIAS".to_string(), alias, expiry_month: additional_card_details.card_exp_month.clone().ok_or( errors::ConnectorError::MissingRequiredField { field_name: "card_exp_month", }, )?, expiry_year: additional_card_details.get_card_expiry_year_2_digit()?, })) } impl From<SyncResponse> for enums::AttemptStatus { fn from(item: SyncResponse) -> Self { match item.res_type { TransactionType::Payment => match item.status { TransactionStatus::Authorized => Self::Authorized, TransactionStatus::Settled | TransactionStatus::Transmitted => Self::Charged, TransactionStatus::ChallengeOngoing | TransactionStatus::ChallengeRequired => { Self::AuthenticationPending } TransactionStatus::Canceled => Self::Voided, TransactionStatus::Failed => Self::Failure, TransactionStatus::Initialized | TransactionStatus::Authenticated => Self::Pending, }, TransactionType::CardCheck => match item.status { TransactionStatus::Settled | TransactionStatus::Transmitted | TransactionStatus::Authorized => Self::Charged, TransactionStatus::ChallengeOngoing | TransactionStatus::ChallengeRequired => { Self::AuthenticationPending } TransactionStatus::Canceled => Self::Voided, TransactionStatus::Failed => Self::Failure, TransactionStatus::Initialized | TransactionStatus::Authenticated => Self::Pending, }, TransactionType::Credit => Self::Failure, } } } impl From<SyncResponse> for enums::RefundStatus { fn from(item: SyncResponse) -> Self { match item.res_type { TransactionType::Credit => match item.status { TransactionStatus::Settled | TransactionStatus::Transmitted => Self::Success, TransactionStatus::ChallengeOngoing | TransactionStatus::ChallengeRequired => { Self::Pending } TransactionStatus::Initialized | TransactionStatus::Authenticated | TransactionStatus::Authorized | TransactionStatus::Canceled | TransactionStatus::Failed => Self::Failure, }, TransactionType::Payment | TransactionType::CardCheck => Self::Failure, } } } impl<F> TryFrom<ResponseRouterData<F, DatatransResponse, PaymentsAuthorizeData, PaymentsResponseData>> for RouterData<F, PaymentsAuthorizeData, PaymentsResponseData> { type Error = error_stack::Report<errors::ConnectorError>; fn try_from( item: ResponseRouterData<F, DatatransResponse, PaymentsAuthorizeData, PaymentsResponseData>, ) -> Result<Self, Self::Error> { let status = get_status(&item.response, item.data.request.is_auto_capture()?); let response = match &item.response { DatatransResponse::ErrorResponse(error) => Err(ErrorResponse { code: error.code.clone(), message: error.message.clone(), reason: Some(error.message.clone()), attempt_status: None, connector_transaction_id: None, status_code: item.http_code, network_advice_code: None, network_decline_code: None, network_error_message: None, connector_metadata: None, }), DatatransResponse::TransactionResponse(response) => { Ok(PaymentsResponseData::TransactionResponse { resource_id: ResponseId::ConnectorTransactionId( response.transaction_id.clone(), ), redirection_data: Box::new(None), mandate_reference: Box::new(None), connector_metadata: None, network_txn_id: None, connector_response_reference_id: None, incremental_authorization_allowed: None, charges: None, }) } DatatransResponse::ThreeDSResponse(response) => { let redirection_link = match item.data.test_mode { Some(true) => format!("{REDIRECTION_SBX_URL}/v1/start"), Some(false) | None => format!("{REDIRECTION_PROD_URL}/v1/start"), }; Ok(PaymentsResponseData::TransactionResponse { resource_id: ResponseId::ConnectorTransactionId( response.transaction_id.clone(), ), redirection_data: Box::new(Some(RedirectForm::Form { endpoint: format!("{}/{}", redirection_link, response.transaction_id), method: Method::Get, form_fields: HashMap::new(), })), mandate_reference: Box::new(None), connector_metadata: None, network_txn_id: None, connector_response_reference_id: None, incremental_authorization_allowed: None, charges: None, }) } }; Ok(Self { status, response, ..item.data }) } } impl<F> TryFrom<ResponseRouterData<F, DatatransResponse, SetupMandateRequestData, PaymentsResponseData>> for RouterData<F, SetupMandateRequestData, PaymentsResponseData> { type Error = error_stack::Report<errors::ConnectorError>; fn try_from( item: ResponseRouterData< F, DatatransResponse, SetupMandateRequestData, PaymentsResponseData, >, ) -> Result<Self, Self::Error> { // zero auth doesn't support manual capture let status = get_status(&item.response, true); let response = match &item.response { DatatransResponse::ErrorResponse(error) => Err(ErrorResponse { code: error.code.clone(), message: error.message.clone(), reason: Some(error.message.clone()), attempt_status: None, connector_transaction_id: None, status_code: item.http_code, network_advice_code: None, network_decline_code: None, network_error_message: None, connector_metadata: None, }), DatatransResponse::TransactionResponse(response) => { Ok(PaymentsResponseData::TransactionResponse { resource_id: ResponseId::ConnectorTransactionId( response.transaction_id.clone(), ), redirection_data: Box::new(None), mandate_reference: Box::new(None), connector_metadata: None, network_txn_id: None, connector_response_reference_id: None, incremental_authorization_allowed: None, charges: None, }) } DatatransResponse::ThreeDSResponse(response) => { let redirection_link = match item.data.test_mode { Some(true) => format!("{REDIRECTION_SBX_URL}/v1/start"), Some(false) | None => format!("{REDIRECTION_PROD_URL}/v1/start"), }; Ok(PaymentsResponseData::TransactionResponse { resource_id: ResponseId::ConnectorTransactionId( response.transaction_id.clone(), ), redirection_data: Box::new(Some(RedirectForm::Form { endpoint: format!("{}/{}", redirection_link, response.transaction_id), method: Method::Get, form_fields: HashMap::new(), })), mandate_reference: Box::new(None), connector_metadata: None, network_txn_id: None, connector_response_reference_id: None, incremental_authorization_allowed: None, charges: None, }) } }; Ok(Self { status, response, ..item.data }) } } impl<F> TryFrom<&DatatransRouterData<&types::RefundsRouterData<F>>> for DatatransRefundRequest { type Error = error_stack::Report<errors::ConnectorError>; fn try_from( item: &DatatransRouterData<&types::RefundsRouterData<F>>, ) -> Result<Self, Self::Error> { Ok(Self { amount: item.amount.to_owned(), currency: item.router_data.request.currency, refno: item.router_data.request.refund_id.clone(), }) } } impl TryFrom<RefundsResponseRouterData<Execute, DatatransRefundsResponse>> for types::RefundsRouterData<Execute> { type Error = error_stack::Report<errors::ConnectorError>; fn try_from( item: RefundsResponseRouterData<Execute, DatatransRefundsResponse>, ) -> Result<Self, Self::Error> { match item.response { DatatransRefundsResponse::Error(error) => Ok(Self { response: Err(ErrorResponse { code: error.code.clone(), message: error.message.clone(), reason: Some(error.message), attempt_status: None, connector_transaction_id: None, status_code: item.http_code, network_advice_code: None, network_decline_code: None, network_error_message: None, connector_metadata: None, }), ..item.data }), DatatransRefundsResponse::Success(response) => Ok(Self { response: Ok(RefundsResponseData { connector_refund_id: response.transaction_id, refund_status: enums::RefundStatus::Success, }), ..item.data }), } } } impl TryFrom<RefundsResponseRouterData<RSync, DatatransSyncResponse>> for types::RefundsRouterData<RSync> { type Error = error_stack::Report<errors::ConnectorError>; fn try_from( item: RefundsResponseRouterData<RSync, DatatransSyncResponse>, ) -> Result<Self, Self::Error> { let response = match item.response { DatatransSyncResponse::Error(error) => Err(ErrorResponse { code: error.code.clone(), message: error.message.clone(), reason: Some(error.message), attempt_status: None, connector_transaction_id: None, status_code: item.http_code, network_advice_code: None, network_decline_code: None, network_error_message: None, connector_metadata: None, }), DatatransSyncResponse::Response(response) => Ok(RefundsResponseData { connector_refund_id: response.transaction_id.to_string(), refund_status: enums::RefundStatus::from(response), }), }; Ok(Self { response, ..item.data }) } } impl TryFrom<PaymentsSyncResponseRouterData<DatatransSyncResponse>> for types::PaymentsSyncRouterData { type Error = error_stack::Report<errors::ConnectorError>; fn try_from( item: PaymentsSyncResponseRouterData<DatatransSyncResponse>, ) -> Result<Self, Self::Error> { match item.response { DatatransSyncResponse::Error(error) => { let response = Err(ErrorResponse { code: error.code.clone(), message: error.message.clone(), reason: Some(error.message), attempt_status: None, connector_transaction_id: None, status_code: item.http_code, network_advice_code: None, network_decline_code: None, network_error_message: None, connector_metadata: None, }); Ok(Self { response, ..item.data }) } DatatransSyncResponse::Response(sync_response) => { let status = enums::AttemptStatus::from(sync_response.clone()); let response = if status == enums::AttemptStatus::Failure { let (code, message) = match sync_response.detail.fail { Some(fail_details) => ( fail_details.reason.unwrap_or(NO_ERROR_CODE.to_string()), fail_details.message.unwrap_or(NO_ERROR_MESSAGE.to_string()), ), None => (NO_ERROR_CODE.to_string(), NO_ERROR_MESSAGE.to_string()), }; Err(ErrorResponse { code, message: message.clone(), reason: Some(message), status_code: item.http_code, attempt_status: None, connector_transaction_id: None, network_advice_code: None, network_decline_code: None, network_error_message: None, connector_metadata: None, }) } else { let mandate_reference = sync_response .card .as_ref() .and_then(|card| card.alias.as_ref()) .map(|alias| MandateReference { connector_mandate_id: Some(alias.clone()), payment_method_id: None, mandate_metadata: None, connector_mandate_request_reference_id: None, }); Ok(PaymentsResponseData::TransactionResponse { resource_id: ResponseId::ConnectorTransactionId( sync_response.transaction_id.to_string(), ), redirection_data: Box::new(None), mandate_reference: Box::new(mandate_reference), connector_metadata: None, network_txn_id: None, connector_response_reference_id: None, incremental_authorization_allowed: None, charges: None, }) }; Ok(Self { status, response, ..item.data }) } } } } impl TryFrom<&DatatransRouterData<&types::PaymentsCaptureRouterData>> for DataPaymentCaptureRequest { type Error = error_stack::Report<errors::ConnectorError>; fn try_from( item: &DatatransRouterData<&types::PaymentsCaptureRouterData>, ) -> Result<Self, Self::Error> { Ok(Self { amount: item.amount, currency: item.router_data.request.currency, refno: item.router_data.connector_request_reference_id.clone(), }) } } impl TryFrom<PaymentsCaptureResponseRouterData<DataTransCaptureResponse>> for types::PaymentsCaptureRouterData { type Error = error_stack::Report<errors::ConnectorError>; fn try_from( item: PaymentsCaptureResponseRouterData<DataTransCaptureResponse>, ) -> Result<Self, Self::Error> { let status = match item.response { DataTransCaptureResponse::Error(error) => { if error.message == *TRANSACTION_ALREADY_SETTLED { common_enums::AttemptStatus::Charged } else { common_enums::AttemptStatus::Failure } } // Datatrans http code 204 implies Successful Capture //https://api-reference.datatrans.ch/#tag/v1transactions/operation/settle DataTransCaptureResponse::Empty => { if item.http_code == 204 { common_enums::AttemptStatus::Charged } else { common_enums::AttemptStatus::Failure } } }; Ok(Self { status, ..item.data }) } } impl TryFrom<PaymentsCancelResponseRouterData<DataTransCancelResponse>> for types::PaymentsCancelRouterData { type Error = error_stack::Report<errors::ConnectorError>; fn try_from( item: PaymentsCancelResponseRouterData<DataTransCancelResponse>, ) -> Result<Self, Self::Error> { let status = match item.response { // Datatrans http code 204 implies Successful Cancellation //https://api-reference.datatrans.ch/#tag/v1transactions/operation/cancel DataTransCancelResponse::Empty => { if item.http_code == 204 { common_enums::AttemptStatus::Voided } else { common_enums::AttemptStatus::Failure } } DataTransCancelResponse::Error(error) => { if error.message == *TRANSACTION_ALREADY_CANCELLED { common_enums::AttemptStatus::Voided } else { common_enums::AttemptStatus::Failure } } }; Ok(Self { status, ..item.data }) } }
crates/hyperswitch_connectors/src/connectors/datatrans/transformers.rs
hyperswitch_connectors
full_file
null
null
null
6,927
null
null
null
null
null
null
null
// File: crates/router/tests/connectors/nexixpay.rs // Module: router use hyperswitch_domain_models::payment_method_data::{Card, PaymentMethodData}; use masking::Secret; use router::types::{self, api, storage::enums}; use test_utils::connector_auth; use crate::utils::{self, ConnectorActions}; #[derive(Clone, Copy)] struct NexixpayTest; impl ConnectorActions for NexixpayTest {} impl utils::Connector for NexixpayTest { fn get_data(&self) -> api::ConnectorData { use router::connector::Nexixpay; utils::construct_connector_data_old( Box::new(Nexixpay::new()), types::Connector::Plaid, api::GetToken::Connector, None, ) } fn get_auth_token(&self) -> types::ConnectorAuthType { utils::to_connector_auth_type( connector_auth::ConnectorAuthentication::new() .nexixpay .expect("Missing connector authentication configuration") .into(), ) } fn get_name(&self) -> String { "nexixpay".to_string() } } static CONNECTOR: NexixpayTest = NexixpayTest {}; fn get_default_payment_info() -> Option<utils::PaymentInfo> { None } fn payment_method_details() -> Option<types::PaymentsAuthorizeData> { None } // Cards Positive Tests // Creates a payment using the manual capture flow (Non 3DS). #[actix_web::test] async fn should_only_authorize_payment() { let response = CONNECTOR .authorize_payment(payment_method_details(), get_default_payment_info()) .await .expect("Authorize payment response"); assert_eq!(response.status, enums::AttemptStatus::Authorized); } // Captures a payment using the manual capture flow (Non 3DS). #[actix_web::test] async fn should_capture_authorized_payment() { let response = CONNECTOR .authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info()) .await .expect("Capture payment response"); assert_eq!(response.status, enums::AttemptStatus::Charged); } // Partially captures a payment using the manual capture flow (Non 3DS). #[actix_web::test] async fn should_partially_capture_authorized_payment() { let response = CONNECTOR .authorize_and_capture_payment( payment_method_details(), Some(types::PaymentsCaptureData { amount_to_capture: 50, ..utils::PaymentCaptureType::default().0 }), get_default_payment_info(), ) .await .expect("Capture payment response"); assert_eq!(response.status, enums::AttemptStatus::Charged); } // Synchronizes a payment using the manual capture flow (Non 3DS). #[actix_web::test] async fn should_sync_authorized_payment() { let authorize_response = CONNECTOR .authorize_payment(payment_method_details(), get_default_payment_info()) .await .expect("Authorize payment response"); let txn_id = utils::get_connector_transaction_id(authorize_response.response); let response = CONNECTOR .psync_retry_till_status_matches( enums::AttemptStatus::Authorized, Some(types::PaymentsSyncData { connector_transaction_id: types::ResponseId::ConnectorTransactionId( txn_id.unwrap(), ), ..Default::default() }), get_default_payment_info(), ) .await .expect("PSync response"); assert_eq!(response.status, enums::AttemptStatus::Authorized,); } // Voids a payment using the manual capture flow (Non 3DS). #[actix_web::test] async fn should_void_authorized_payment() { let response = CONNECTOR .authorize_and_void_payment( payment_method_details(), Some(types::PaymentsCancelData { connector_transaction_id: String::from(""), cancellation_reason: Some("requested_by_customer".to_string()), ..Default::default() }), get_default_payment_info(), ) .await .expect("Void payment response"); assert_eq!(response.status, enums::AttemptStatus::Voided); } // Refunds a payment using the manual capture flow (Non 3DS). #[actix_web::test] async fn should_refund_manually_captured_payment() { let response = CONNECTOR .capture_payment_and_refund( payment_method_details(), None, None, get_default_payment_info(), ) .await .unwrap(); assert_eq!( response.response.unwrap().refund_status, enums::RefundStatus::Success, ); } // Partially refunds a payment using the manual capture flow (Non 3DS). #[actix_web::test] async fn should_partially_refund_manually_captured_payment() { let response = CONNECTOR .capture_payment_and_refund( payment_method_details(), None, Some(types::RefundsData { refund_amount: 50, ..utils::PaymentRefundType::default().0 }), get_default_payment_info(), ) .await .unwrap(); assert_eq!( response.response.unwrap().refund_status, enums::RefundStatus::Success, ); } // Synchronizes a refund using the manual capture flow (Non 3DS). #[actix_web::test] async fn should_sync_manually_captured_refund() { let refund_response = CONNECTOR .capture_payment_and_refund( payment_method_details(), None, None, get_default_payment_info(), ) .await .unwrap(); let response = CONNECTOR .rsync_retry_till_status_matches( enums::RefundStatus::Success, refund_response.response.unwrap().connector_refund_id, None, get_default_payment_info(), ) .await .unwrap(); assert_eq!( response.response.unwrap().refund_status, enums::RefundStatus::Success, ); } // Creates a payment using the automatic capture flow (Non 3DS). #[actix_web::test] async fn should_make_payment() { let authorize_response = CONNECTOR .make_payment(payment_method_details(), get_default_payment_info()) .await .unwrap(); assert_eq!(authorize_response.status, enums::AttemptStatus::Charged); } // Synchronizes a payment using the automatic capture flow (Non 3DS). #[actix_web::test] async fn should_sync_auto_captured_payment() { let authorize_response = CONNECTOR .make_payment(payment_method_details(), get_default_payment_info()) .await .unwrap(); assert_eq!(authorize_response.status, enums::AttemptStatus::Charged); let txn_id = utils::get_connector_transaction_id(authorize_response.response); assert_ne!(txn_id, None, "Empty connector transaction id"); let response = CONNECTOR .psync_retry_till_status_matches( enums::AttemptStatus::Charged, Some(types::PaymentsSyncData { connector_transaction_id: types::ResponseId::ConnectorTransactionId( txn_id.unwrap(), ), capture_method: Some(enums::CaptureMethod::Automatic), ..Default::default() }), get_default_payment_info(), ) .await .unwrap(); assert_eq!(response.status, enums::AttemptStatus::Charged,); } // Refunds a payment using the automatic capture flow (Non 3DS). #[actix_web::test] async fn should_refund_auto_captured_payment() { let response = CONNECTOR .make_payment_and_refund(payment_method_details(), None, get_default_payment_info()) .await .unwrap(); assert_eq!( response.response.unwrap().refund_status, enums::RefundStatus::Success, ); } // Partially refunds a payment using the automatic capture flow (Non 3DS). #[actix_web::test] async fn should_partially_refund_succeeded_payment() { let refund_response = CONNECTOR .make_payment_and_refund( payment_method_details(), Some(types::RefundsData { refund_amount: 50, ..utils::PaymentRefundType::default().0 }), get_default_payment_info(), ) .await .unwrap(); assert_eq!( refund_response.response.unwrap().refund_status, enums::RefundStatus::Success, ); } // Creates multiple refunds against a payment using the automatic capture flow (Non 3DS). #[actix_web::test] async fn should_refund_succeeded_payment_multiple_times() { CONNECTOR .make_payment_and_multiple_refund( payment_method_details(), Some(types::RefundsData { refund_amount: 50, ..utils::PaymentRefundType::default().0 }), get_default_payment_info(), ) .await; } // Synchronizes a refund using the automatic capture flow (Non 3DS). #[actix_web::test] async fn should_sync_refund() { let refund_response = CONNECTOR .make_payment_and_refund(payment_method_details(), None, get_default_payment_info()) .await .unwrap(); let response = CONNECTOR .rsync_retry_till_status_matches( enums::RefundStatus::Success, refund_response.response.unwrap().connector_refund_id, None, get_default_payment_info(), ) .await .unwrap(); assert_eq!( response.response.unwrap().refund_status, enums::RefundStatus::Success, ); } // Cards Negative scenarios // Creates a payment with incorrect CVC. #[actix_web::test] async fn should_fail_payment_for_incorrect_cvc() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { payment_method_data: PaymentMethodData::Card(Card { card_cvc: Secret::new("12345".to_string()), ..utils::CCardType::default().0 }), ..utils::PaymentAuthorizeType::default().0 }), get_default_payment_info(), ) .await .unwrap(); assert_eq!( response.response.unwrap_err().message, "Your card's security code is invalid.".to_string(), ); } // Creates a payment with incorrect expiry month. #[actix_web::test] async fn should_fail_payment_for_invalid_exp_month() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { payment_method_data: PaymentMethodData::Card(Card { card_exp_month: Secret::new("20".to_string()), ..utils::CCardType::default().0 }), ..utils::PaymentAuthorizeType::default().0 }), get_default_payment_info(), ) .await .unwrap(); assert_eq!( response.response.unwrap_err().message, "Your card's expiration month is invalid.".to_string(), ); } // Creates a payment with incorrect expiry year. #[actix_web::test] async fn should_fail_payment_for_incorrect_expiry_year() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { payment_method_data: PaymentMethodData::Card(Card { card_exp_year: Secret::new("2000".to_string()), ..utils::CCardType::default().0 }), ..utils::PaymentAuthorizeType::default().0 }), get_default_payment_info(), ) .await .unwrap(); assert_eq!( response.response.unwrap_err().message, "Your card's expiration year is invalid.".to_string(), ); } // Voids a payment using automatic capture flow (Non 3DS). #[actix_web::test] async fn should_fail_void_payment_for_auto_capture() { let authorize_response = CONNECTOR .make_payment(payment_method_details(), get_default_payment_info()) .await .unwrap(); assert_eq!(authorize_response.status, enums::AttemptStatus::Charged); let txn_id = utils::get_connector_transaction_id(authorize_response.response); assert_ne!(txn_id, None, "Empty connector transaction id"); let void_response = CONNECTOR .void_payment(txn_id.unwrap(), None, get_default_payment_info()) .await .unwrap(); assert_eq!( void_response.response.unwrap_err().message, "You cannot cancel this PaymentIntent because it has a status of succeeded." ); } // Captures a payment using invalid connector payment id. #[actix_web::test] async fn should_fail_capture_for_invalid_payment() { let capture_response = CONNECTOR .capture_payment("123456789".to_string(), None, get_default_payment_info()) .await .unwrap(); assert_eq!( capture_response.response.unwrap_err().message, String::from("No such payment_intent: '123456789'") ); } // Refunds a payment with refund amount higher than payment amount. #[actix_web::test] async fn should_fail_for_refund_amount_higher_than_payment_amount() { let response = CONNECTOR .make_payment_and_refund( payment_method_details(), Some(types::RefundsData { refund_amount: 150, ..utils::PaymentRefundType::default().0 }), get_default_payment_info(), ) .await .unwrap(); assert_eq!( response.response.unwrap_err().message, "Refund amount (₹1.50) is greater than charge amount (₹1.00)", ); } // Connector dependent test cases goes here // [#478]: add unit tests for non 3DS, wallets & webhooks in connector tests
crates/router/tests/connectors/nexixpay.rs
router
full_file
null
null
null
2,943
null
null
null
null
null
null
null
// Function: generate_merchant_refund_report // File: crates/router/src/analytics.rs // Module: router pub fn generate_merchant_refund_report( state: web::Data<AppState>, req: actix_web::HttpRequest, json_payload: web::Json<ReportRequest>, ) -> impl Responder
crates/router/src/analytics.rs
router
function_signature
null
null
null
69
generate_merchant_refund_report
null
null
null
null
null
null
// Function: refund_create_core // File: crates/router/src/core/refunds_v2.rs // Module: router pub fn refund_create_core( state: SessionState, merchant_context: domain::MerchantContext, req: refunds::RefundsCreateRequest, global_refund_id: id_type::GlobalRefundId, ) -> errors::RouterResponse<refunds::RefundResponse>
crates/router/src/core/refunds_v2.rs
router
function_signature
null
null
null
84
refund_create_core
null
null
null
null
null
null
// Struct: PayloadRefundResponse // File: crates/hyperswitch_connectors/src/connectors/payload/responses.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct PayloadRefundResponse
crates/hyperswitch_connectors/src/connectors/payload/responses.rs
hyperswitch_connectors
struct_definition
PayloadRefundResponse
0
[]
48
null
null
null
null
null
null
null
// Implementation: impl api::Refund for for Ebanx // File: crates/hyperswitch_connectors/src/connectors/ebanx.rs // Module: hyperswitch_connectors // Methods: 0 total (0 public) impl api::Refund for for Ebanx
crates/hyperswitch_connectors/src/connectors/ebanx.rs
hyperswitch_connectors
impl_block
null
null
null
61
null
Ebanx
api::Refund for
0
0
null
null
// Implementation: impl Relay // File: crates/diesel_models/src/query/relay.rs // Module: diesel_models // Methods: 3 total (0 public) impl Relay
crates/diesel_models/src/query/relay.rs
diesel_models
impl_block
null
null
null
37
null
Relay
null
3
0
null
null
// Implementation: impl ConnectorRedirectResponse for for Globalpay // File: crates/hyperswitch_connectors/src/connectors/globalpay.rs // Module: hyperswitch_connectors // Methods: 1 total (0 public) impl ConnectorRedirectResponse for for Globalpay
crates/hyperswitch_connectors/src/connectors/globalpay.rs
hyperswitch_connectors
impl_block
null
null
null
55
null
Globalpay
ConnectorRedirectResponse for
1
0
null
null
// Implementation: impl IncomingWebhook for for Gpayments // File: crates/hyperswitch_connectors/src/connectors/gpayments.rs // Module: hyperswitch_connectors // Methods: 3 total (0 public) impl IncomingWebhook for for Gpayments
crates/hyperswitch_connectors/src/connectors/gpayments.rs
hyperswitch_connectors
impl_block
null
null
null
55
null
Gpayments
IncomingWebhook for
3
0
null
null
// Struct: AuthenticationSyncRequest // File: crates/api_models/src/authentication.rs // Module: api_models // Implementations: 1 // Traits: ApiEventMetric pub struct AuthenticationSyncRequest
crates/api_models/src/authentication.rs
api_models
struct_definition
AuthenticationSyncRequest
1
[ "ApiEventMetric" ]
42
null
null
null
null
null
null
null
// Implementation: impl api::RefundSync for for Getnet // File: crates/hyperswitch_connectors/src/connectors/getnet.rs // Module: hyperswitch_connectors // Methods: 0 total (0 public) impl api::RefundSync for for Getnet
crates/hyperswitch_connectors/src/connectors/getnet.rs
hyperswitch_connectors
impl_block
null
null
null
59
null
Getnet
api::RefundSync for
0
0
null
null
// Implementation: impl api::PaymentCapture for for Zsl // File: crates/hyperswitch_connectors/src/connectors/zsl.rs // Module: hyperswitch_connectors // Methods: 0 total (0 public) impl api::PaymentCapture for for Zsl
crates/hyperswitch_connectors/src/connectors/zsl.rs
hyperswitch_connectors
impl_block
null
null
null
57
null
Zsl
api::PaymentCapture for
0
0
null
null
// Struct: VoltPaymentsResponse // File: crates/hyperswitch_connectors/src/connectors/volt/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct VoltPaymentsResponse
crates/hyperswitch_connectors/src/connectors/volt/transformers.rs
hyperswitch_connectors
struct_definition
VoltPaymentsResponse
0
[]
47
null
null
null
null
null
null
null
// Struct: TouchNGoRedirection // File: crates/hyperswitch_domain_models/src/payment_method_data.rs // Module: hyperswitch_domain_models // Implementations: 0 pub struct TouchNGoRedirection
crates/hyperswitch_domain_models/src/payment_method_data.rs
hyperswitch_domain_models
struct_definition
TouchNGoRedirection
0
[]
47
null
null
null
null
null
null
null
// Function: update_payment_intent_api // File: crates/router/src/core/revenue_recovery/api.rs // Module: router pub fn update_payment_intent_api( state: &SessionState, global_payment_id: id_type::GlobalPaymentId, revenue_recovery_payment_data: &storage::revenue_recovery::RevenueRecoveryPaymentData, update_req: payments_api::PaymentsUpdateIntentRequest, ) -> RouterResult<payments_domain::PaymentIntentData<api_types::PaymentUpdateIntent>>
crates/router/src/core/revenue_recovery/api.rs
router
function_signature
null
null
null
103
update_payment_intent_api
null
null
null
null
null
null
// Implementation: impl ConnectorCommon for for Paybox // File: crates/hyperswitch_connectors/src/connectors/paybox.rs // Module: hyperswitch_connectors // Methods: 5 total (0 public) impl ConnectorCommon for for Paybox
crates/hyperswitch_connectors/src/connectors/paybox.rs
hyperswitch_connectors
impl_block
null
null
null
53
null
Paybox
ConnectorCommon for
5
0
null
null
// Struct: GocardlessWebhookEvent // File: crates/hyperswitch_connectors/src/connectors/gocardless/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct GocardlessWebhookEvent
crates/hyperswitch_connectors/src/connectors/gocardless/transformers.rs
hyperswitch_connectors
struct_definition
GocardlessWebhookEvent
0
[]
54
null
null
null
null
null
null
null
// Implementation: impl Analytics // File: crates/router/src/analytics.rs // Module: router // Methods: 2 total (2 public) impl Analytics
crates/router/src/analytics.rs
router
impl_block
null
null
null
33
null
Analytics
null
2
2
null
null
// File: crates/diesel_models/src/subscription.rs // Module: diesel_models // Public functions: 3 // Public structs: 3 use common_utils::{generate_id_with_default_len, pii::SecretSerdeValue}; use diesel::{AsChangeset, Identifiable, Insertable, Queryable, Selectable}; use masking::Secret; use serde::{Deserialize, Serialize}; use crate::schema::subscription; #[derive(Clone, Debug, Eq, Insertable, PartialEq, Serialize, Deserialize)] #[diesel(table_name = subscription)] pub struct SubscriptionNew { id: common_utils::id_type::SubscriptionId, status: String, billing_processor: Option<String>, payment_method_id: Option<String>, merchant_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>, client_secret: Option<String>, connector_subscription_id: Option<String>, merchant_id: common_utils::id_type::MerchantId, customer_id: common_utils::id_type::CustomerId, metadata: Option<SecretSerdeValue>, created_at: time::PrimitiveDateTime, modified_at: time::PrimitiveDateTime, profile_id: common_utils::id_type::ProfileId, merchant_reference_id: Option<String>, } #[derive( Clone, Debug, Eq, PartialEq, Identifiable, Queryable, Selectable, Deserialize, Serialize, )] #[diesel(table_name = subscription, primary_key(id), check_for_backend(diesel::pg::Pg))] pub struct Subscription { pub id: common_utils::id_type::SubscriptionId, pub status: String, pub billing_processor: Option<String>, pub payment_method_id: Option<String>, pub merchant_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>, pub client_secret: Option<String>, pub connector_subscription_id: Option<String>, pub merchant_id: common_utils::id_type::MerchantId, pub customer_id: common_utils::id_type::CustomerId, pub metadata: Option<serde_json::Value>, pub created_at: time::PrimitiveDateTime, pub modified_at: time::PrimitiveDateTime, pub profile_id: common_utils::id_type::ProfileId, pub merchant_reference_id: Option<String>, } #[derive(Clone, Debug, Eq, PartialEq, AsChangeset, router_derive::DebugAsDisplay, Deserialize)] #[diesel(table_name = subscription)] pub struct SubscriptionUpdate { pub payment_method_id: Option<String>, pub status: Option<String>, pub modified_at: time::PrimitiveDateTime, } impl SubscriptionNew { #[allow(clippy::too_many_arguments)] pub fn new( id: common_utils::id_type::SubscriptionId, status: String, billing_processor: Option<String>, payment_method_id: Option<String>, merchant_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>, client_secret: Option<String>, connector_subscription_id: Option<String>, merchant_id: common_utils::id_type::MerchantId, customer_id: common_utils::id_type::CustomerId, metadata: Option<SecretSerdeValue>, profile_id: common_utils::id_type::ProfileId, merchant_reference_id: Option<String>, ) -> Self { let now = common_utils::date_time::now(); Self { id, status, billing_processor, payment_method_id, merchant_connector_id, client_secret, connector_subscription_id, merchant_id, customer_id, metadata, created_at: now, modified_at: now, profile_id, merchant_reference_id, } } pub fn generate_and_set_client_secret(&mut self) -> Secret<String> { let client_secret = generate_id_with_default_len(&format!("{}_secret", self.id.get_string_repr())); self.client_secret = Some(client_secret.clone()); Secret::new(client_secret) } } impl SubscriptionUpdate { pub fn new(payment_method_id: Option<String>, status: Option<String>) -> Self { Self { payment_method_id, status, modified_at: common_utils::date_time::now(), } } }
crates/diesel_models/src/subscription.rs
diesel_models
full_file
null
null
null
860
null
null
null
null
null
null
null
// Struct: ProfileAcquirerConfigs // File: crates/router/src/types/api/admin.rs // Module: router // Implementations: 0 pub struct ProfileAcquirerConfigs
crates/router/src/types/api/admin.rs
router
struct_definition
ProfileAcquirerConfigs
0
[]
37
null
null
null
null
null
null
null
// Struct: FiuuRouterData // File: crates/hyperswitch_connectors/src/connectors/fiuu/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct FiuuRouterData<T>
crates/hyperswitch_connectors/src/connectors/fiuu/transformers.rs
hyperswitch_connectors
struct_definition
FiuuRouterData
0
[]
54
null
null
null
null
null
null
null
// File: crates/hyperswitch_interfaces/src/api/refunds_v2.rs // Module: hyperswitch_interfaces //! Refunds V2 interface use hyperswitch_domain_models::{ router_data_v2::flow_common_types::RefundFlowData, router_flow_types::refunds::{Execute, RSync}, router_request_types::RefundsData, router_response_types::RefundsResponseData, }; use crate::api::{ConnectorCommon, ConnectorIntegrationV2}; /// trait RefundExecuteV2 pub trait RefundExecuteV2: ConnectorIntegrationV2<Execute, RefundFlowData, RefundsData, RefundsResponseData> { } /// trait RefundSyncV2 pub trait RefundSyncV2: ConnectorIntegrationV2<RSync, RefundFlowData, RefundsData, RefundsResponseData> { } /// trait RefundV2 pub trait RefundV2: ConnectorCommon + RefundExecuteV2 + RefundSyncV2 {}
crates/hyperswitch_interfaces/src/api/refunds_v2.rs
hyperswitch_interfaces
full_file
null
null
null
208
null
null
null
null
null
null
null
// Struct: TrustpayGooglePayResponse // File: crates/hyperswitch_connectors/src/connectors/trustpay/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct TrustpayGooglePayResponse
crates/hyperswitch_connectors/src/connectors/trustpay/transformers.rs
hyperswitch_connectors
struct_definition
TrustpayGooglePayResponse
0
[]
52
null
null
null
null
null
null
null
// File: crates/router/src/core/card_testing_guard.rs // Module: router pub mod utils; use crate::core::errors;
crates/router/src/core/card_testing_guard.rs
router
full_file
null
null
null
28
null
null
null
null
null
null
null
// Implementation: impl api::RefundExecute for for Dlocal // File: crates/hyperswitch_connectors/src/connectors/dlocal.rs // Module: hyperswitch_connectors // Methods: 0 total (0 public) impl api::RefundExecute for for Dlocal
crates/hyperswitch_connectors/src/connectors/dlocal.rs
hyperswitch_connectors
impl_block
null
null
null
59
null
Dlocal
api::RefundExecute for
0
0
null
null
// Implementation: impl EncryptedJsonType // File: crates/hyperswitch_domain_models/src/type_encryption.rs // Module: hyperswitch_domain_models // Methods: 2 total (0 public) impl EncryptedJsonType
crates/hyperswitch_domain_models/src/type_encryption.rs
hyperswitch_domain_models
impl_block
null
null
null
48
null
EncryptedJsonType
null
2
0
null
null
// Struct: PaymentResponseData // File: crates/api_models/src/subscription.rs // Module: api_models // Implementations: 0 pub struct PaymentResponseData
crates/api_models/src/subscription.rs
api_models
struct_definition
PaymentResponseData
0
[]
36
null
null
null
null
null
null
null
// File: crates/storage_impl/src/reverse_lookup.rs // Module: storage_impl use diesel_models::reverse_lookup::ReverseLookup; use crate::redis::kv_store::KvStorePartition; impl KvStorePartition for ReverseLookup {}
crates/storage_impl/src/reverse_lookup.rs
storage_impl
full_file
null
null
null
49
null
null
null
null
null
null
null
// Function: server // File: crates/drainer/src/health_check.rs // Module: drainer pub fn server(conf: Settings, stores: HashMap<id_type::TenantId, Arc<Store>>) -> Scope
crates/drainer/src/health_check.rs
drainer
function_signature
null
null
null
46
server
null
null
null
null
null
null
// Function: complete_payout_retrieve // File: crates/router/src/core/payouts.rs // Module: router pub fn complete_payout_retrieve( state: &SessionState, merchant_context: &domain::MerchantContext, connector_call_type: api::ConnectorCallType, payout_data: &mut PayoutData, ) -> RouterResult<()>
crates/router/src/core/payouts.rs
router
function_signature
null
null
null
77
complete_payout_retrieve
null
null
null
null
null
null
// Struct: RefundStatusDetails // File: crates/hyperswitch_connectors/src/connectors/amazonpay/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct RefundStatusDetails
crates/hyperswitch_connectors/src/connectors/amazonpay/transformers.rs
hyperswitch_connectors
struct_definition
RefundStatusDetails
0
[]
50
null
null
null
null
null
null
null
// Function: create_merchant_connector_account // File: crates/diesel_models/src/merchant_connector_account.rs // Module: diesel_models pub fn create_merchant_connector_account( self, source: MerchantConnectorAccount, ) -> MerchantConnectorAccount
crates/diesel_models/src/merchant_connector_account.rs
diesel_models
function_signature
null
null
null
53
create_merchant_connector_account
null
null
null
null
null
null
// Implementation: impl PaymentAuthorize for for Netcetera // File: crates/hyperswitch_connectors/src/connectors/netcetera.rs // Module: hyperswitch_connectors // Methods: 0 total (0 public) impl PaymentAuthorize for for Netcetera
crates/hyperswitch_connectors/src/connectors/netcetera.rs
hyperswitch_connectors
impl_block
null
null
null
59
null
Netcetera
PaymentAuthorize for
0
0
null
null
// Function: server // File: crates/router/src/routes/app.rs // Module: router pub fn server(state: AppState) -> Scope
crates/router/src/routes/app.rs
router
function_signature
null
null
null
29
server
null
null
null
null
null
null
// File: crates/router/src/types/storage/role.rs // Module: router pub use diesel_models::role::*;
crates/router/src/types/storage/role.rs
router
full_file
null
null
null
24
null
null
null
null
null
null
null
// File: crates/external_services/src/file_storage/file_system.rs // Module: external_services //! Module for local file system storage operations use std::{ fs::{remove_file, File}, io::{Read, Write}, path::PathBuf, }; use common_utils::errors::CustomResult; use error_stack::ResultExt; use crate::file_storage::{FileStorageError, FileStorageInterface}; /// Constructs the file path for a given file key within the file system. /// The file path is generated based on the workspace path and the provided file key. fn get_file_path(file_key: impl AsRef<str>) -> PathBuf { let mut file_path = PathBuf::new(); file_path.push(std::env::current_dir().unwrap_or(".".into())); file_path.push("files"); file_path.push(file_key.as_ref()); file_path } /// Represents a file system for storing and managing files locally. #[derive(Debug, Clone)] pub(super) struct FileSystem; impl FileSystem { /// Saves the provided file data to the file system under the specified file key. async fn upload_file( &self, file_key: &str, file: Vec<u8>, ) -> CustomResult<(), FileSystemStorageError> { let file_path = get_file_path(file_key); // Ignore the file name and create directories in the `file_path` if not exists std::fs::create_dir_all( file_path .parent() .ok_or(FileSystemStorageError::CreateDirFailed) .attach_printable("Failed to obtain parent directory")?, ) .change_context(FileSystemStorageError::CreateDirFailed)?; let mut file_handler = File::create(file_path).change_context(FileSystemStorageError::CreateFailure)?; file_handler .write_all(&file) .change_context(FileSystemStorageError::WriteFailure)?; Ok(()) } /// Deletes the file associated with the specified file key from the file system. async fn delete_file(&self, file_key: &str) -> CustomResult<(), FileSystemStorageError> { let file_path = get_file_path(file_key); remove_file(file_path).change_context(FileSystemStorageError::DeleteFailure)?; Ok(()) } /// Retrieves the file content associated with the specified file key from the file system. async fn retrieve_file(&self, file_key: &str) -> CustomResult<Vec<u8>, FileSystemStorageError> { let mut received_data: Vec<u8> = Vec::new(); let file_path = get_file_path(file_key); let mut file = File::open(file_path).change_context(FileSystemStorageError::FileOpenFailure)?; file.read_to_end(&mut received_data) .change_context(FileSystemStorageError::ReadFailure)?; Ok(received_data) } } #[async_trait::async_trait] impl FileStorageInterface for FileSystem { /// Saves the provided file data to the file system under the specified file key. async fn upload_file( &self, file_key: &str, file: Vec<u8>, ) -> CustomResult<(), FileStorageError> { self.upload_file(file_key, file) .await .change_context(FileStorageError::UploadFailed)?; Ok(()) } /// Deletes the file associated with the specified file key from the file system. async fn delete_file(&self, file_key: &str) -> CustomResult<(), FileStorageError> { self.delete_file(file_key) .await .change_context(FileStorageError::DeleteFailed)?; Ok(()) } /// Retrieves the file content associated with the specified file key from the file system. async fn retrieve_file(&self, file_key: &str) -> CustomResult<Vec<u8>, FileStorageError> { Ok(self .retrieve_file(file_key) .await .change_context(FileStorageError::RetrieveFailed)?) } } /// Represents an error that can occur during local file system storage operations. #[derive(Debug, thiserror::Error)] enum FileSystemStorageError { /// Error indicating opening a file failed #[error("Failed while opening the file")] FileOpenFailure, /// Error indicating file creation failed. #[error("Failed to create file")] CreateFailure, /// Error indicating reading a file failed. #[error("Failed while reading the file")] ReadFailure, /// Error indicating writing to a file failed. #[error("Failed while writing into file")] WriteFailure, /// Error indicating file deletion failed. #[error("Failed while deleting the file")] DeleteFailure, /// Error indicating directory creation failed #[error("Failed while creating a directory")] CreateDirFailed, }
crates/external_services/src/file_storage/file_system.rs
external_services
full_file
null
null
null
994
null
null
null
null
null
null
null
// Struct: CaptureResponse // File: crates/hyperswitch_connectors/src/connectors/worldpayvantiv/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct CaptureResponse
crates/hyperswitch_connectors/src/connectors/worldpayvantiv/transformers.rs
hyperswitch_connectors
struct_definition
CaptureResponse
0
[]
47
null
null
null
null
null
null
null
Ok(Some(request)) } fn handle_response( &self, data: &RouterData<RSync, RefundsData, RefundsResponseData>, event_builder: Option<&mut ConnectorEvent>, res: Response, ) -> CustomResult<RouterData<RSync, RefundsData, RefundsResponseData>, errors::ConnectorError> where RSync: Clone, RefundsData: Clone, RefundsResponseData: Clone, { let response: payme::PaymeQueryTransactionResponse = res .response .parse_struct("GetSalesResponse") .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; event_builder.map(|i| i.set_response_body(&response)); router_env::logger::info!(connector_response=?response); RouterData::try_from(ResponseRouterData { response, data: data.clone(), http_code: res.status_code, }) } fn get_error_response( &self, res: Response, event_builder: Option<&mut ConnectorEvent>, ) -> CustomResult<ErrorResponse, errors::ConnectorError> { self.build_error_response(res, event_builder) } fn get_5xx_error_response( &self, res: Response, event_builder: Option<&mut ConnectorEvent>, ) -> CustomResult<ErrorResponse, errors::ConnectorError> { // we are always getting 500 in error scenarios self.build_error_response(res, event_builder) } } #[async_trait::async_trait] impl webhooks::IncomingWebhook for Payme { fn get_webhook_source_verification_algorithm( &self, _request: &webhooks::IncomingWebhookRequestDetails<'_>, ) -> CustomResult<Box<dyn crypto::VerifySignature + Send>, errors::ConnectorError> { Ok(Box::new(crypto::Md5)) } fn get_webhook_source_verification_signature( &self, request: &webhooks::IncomingWebhookRequestDetails<'_>, _connector_webhook_secrets: &api_models::webhooks::ConnectorWebhookSecrets, ) -> CustomResult<Vec<u8>, errors::ConnectorError> { let resource = serde_urlencoded::from_bytes::<payme::WebhookEventDataResourceSignature>(request.body) .change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?; Ok(resource.payme_signature.expose().into_bytes()) } fn get_webhook_source_verification_message( &self, request: &webhooks::IncomingWebhookRequestDetails<'_>, _merchant_id: &common_utils::id_type::MerchantId, connector_webhook_secrets: &api_models::webhooks::ConnectorWebhookSecrets, ) -> CustomResult<Vec<u8>, errors::ConnectorError> { let resource = serde_urlencoded::from_bytes::<payme::WebhookEventDataResource>(request.body) .change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?; Ok(format!( "{}{}{}", String::from_utf8_lossy(&connector_webhook_secrets.secret), resource.payme_transaction_id, resource.payme_sale_id ) .as_bytes() .to_vec()) } async fn verify_webhook_source( &self, request: &webhooks::IncomingWebhookRequestDetails<'_>, merchant_id: &common_utils::id_type::MerchantId, connector_webhook_details: Option<common_utils::pii::SecretSerdeValue>, _connector_account_details: crypto::Encryptable<Secret<serde_json::Value>>, connector_label: &str, ) -> CustomResult<bool, errors::ConnectorError> { let algorithm = self .get_webhook_source_verification_algorithm(request) .change_context(errors::ConnectorError::WebhookSourceVerificationFailed)?; let connector_webhook_secrets = self .get_webhook_source_verification_merchant_secret( merchant_id, connector_label, connector_webhook_details, ) .await .change_context(errors::ConnectorError::WebhookSourceVerificationFailed)?; let signature = self .get_webhook_source_verification_signature(request, &connector_webhook_secrets) .change_context(errors::ConnectorError::WebhookSourceVerificationFailed)?; let mut message = self .get_webhook_source_verification_message( request, merchant_id, &connector_webhook_secrets, ) .change_context(errors::ConnectorError::WebhookSourceVerificationFailed)?; let mut message_to_verify = connector_webhook_secrets .additional_secret .ok_or(errors::ConnectorError::WebhookSourceVerificationFailed) .attach_printable("Failed to get additional secrets")? .expose() .as_bytes() .to_vec(); message_to_verify.append(&mut message); let signature_to_verify = hex::decode(signature) .change_context(errors::ConnectorError::WebhookResponseEncodingFailed)?; algorithm .verify_signature( &connector_webhook_secrets.secret, &signature_to_verify, &message_to_verify, ) .change_context(errors::ConnectorError::WebhookSourceVerificationFailed) } fn get_webhook_object_reference_id( &self, request: &webhooks::IncomingWebhookRequestDetails<'_>, ) -> CustomResult<api_models::webhooks::ObjectReferenceId, errors::ConnectorError> { let resource = serde_urlencoded::from_bytes::<payme::WebhookEventDataResource>(request.body) .change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?; let id = match resource.notify_type { transformers::NotifyType::SaleComplete | transformers::NotifyType::SaleAuthorized | transformers::NotifyType::SaleFailure | transformers::NotifyType::SaleChargeback | transformers::NotifyType::SaleChargebackRefund => { api_models::webhooks::ObjectReferenceId::PaymentId( api_models::payments::PaymentIdType::ConnectorTransactionId( resource.payme_sale_id, ), ) } transformers::NotifyType::Refund => api_models::webhooks::ObjectReferenceId::RefundId( api_models::webhooks::RefundIdType::ConnectorRefundId( resource.payme_transaction_id, ), ), }; Ok(id) } fn get_webhook_event_type( &self, request: &webhooks::IncomingWebhookRequestDetails<'_>, ) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> { let resource = serde_urlencoded::from_bytes::<payme::WebhookEventDataResourceEvent>(request.body) .change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?; Ok(api_models::webhooks::IncomingWebhookEvent::from( resource.notify_type, )) } fn get_webhook_resource_object( &self, request: &webhooks::IncomingWebhookRequestDetails<'_>, ) -> CustomResult<Box<dyn masking::ErasedMaskSerialize>, errors::ConnectorError> { let resource = serde_urlencoded::from_bytes::<payme::WebhookEventDataResource>(request.body) .change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?; match resource.notify_type { transformers::NotifyType::SaleComplete | transformers::NotifyType::SaleAuthorized | transformers::NotifyType::SaleFailure => { Ok(Box::new(payme::PaymePaySaleResponse::from(resource))) } transformers::NotifyType::Refund => Ok(Box::new( payme::PaymeQueryTransactionResponse::from(resource), )), transformers::NotifyType::SaleChargeback | transformers::NotifyType::SaleChargebackRefund => Ok(Box::new(resource)), } } fn get_dispute_details( &self, request: &webhooks::IncomingWebhookRequestDetails<'_>, ) -> CustomResult<DisputePayload, errors::ConnectorError> { let webhook_object = serde_urlencoded::from_bytes::<payme::WebhookEventDataResource>(request.body) .change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?; Ok(DisputePayload { amount: utils::convert_amount( self.amount_converter_webhooks, webhook_object.price, webhook_object.currency, )?, currency: webhook_object.currency, dispute_stage: api_models::enums::DisputeStage::Dispute, connector_dispute_id: webhook_object.payme_transaction_id, connector_reason: None, connector_reason_code: None, challenge_required_by: None, connector_status: webhook_object.sale_status.to_string(), created_at: None, updated_at: None, }) } } static PAYME_SUPPORTED_PAYMENT_METHODS: LazyLock<SupportedPaymentMethods> = LazyLock::new(|| { let supported_capture_methods = vec![ enums::CaptureMethod::Automatic, enums::CaptureMethod::Manual, enums::CaptureMethod::SequentialAutomatic, ]; let supported_card_network = vec![ common_enums::CardNetwork::AmericanExpress, common_enums::CardNetwork::DinersClub, common_enums::CardNetwork::Discover, common_enums::CardNetwork::JCB, common_enums::CardNetwork::Mastercard, common_enums::CardNetwork::Visa, ]; let mut payme_supported_payment_methods = SupportedPaymentMethods::new(); payme_supported_payment_methods.add( enums::PaymentMethod::Card, enums::PaymentMethodType::Credit, PaymentMethodDetails { mandates: enums::FeatureStatus::Supported, refunds: enums::FeatureStatus::Supported, supported_capture_methods: supported_capture_methods.clone(), specific_features: Some( api_models::feature_matrix::PaymentMethodSpecificFeatures::Card({ api_models::feature_matrix::CardSpecificFeatures { three_ds: common_enums::FeatureStatus::Supported, no_three_ds: common_enums::FeatureStatus::Supported, supported_card_networks: supported_card_network.clone(), } }), ), }, ); payme_supported_payment_methods.add( enums::PaymentMethod::Card, enums::PaymentMethodType::Debit, PaymentMethodDetails { mandates: enums::FeatureStatus::Supported, refunds: enums::FeatureStatus::Supported, supported_capture_methods: supported_capture_methods.clone(), specific_features: Some( api_models::feature_matrix::PaymentMethodSpecificFeatures::Card({ api_models::feature_matrix::CardSpecificFeatures { three_ds: common_enums::FeatureStatus::Supported, no_three_ds: common_enums::FeatureStatus::Supported, supported_card_networks: supported_card_network.clone(), } }), ), }, ); payme_supported_payment_methods.add( enums::PaymentMethod::Wallet, enums::PaymentMethodType::ApplePay, PaymentMethodDetails { mandates: enums::FeatureStatus::Supported, refunds: enums::FeatureStatus::Supported, supported_capture_methods: supported_capture_methods.clone(), specific_features: None, }, ); payme_supported_payment_methods }); static PAYME_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { display_name: "Payme", description: "Payme is a payment gateway enabling secure online transactions", connector_type: enums::HyperswitchConnectorCategory::PaymentGateway, integration_status: enums::ConnectorIntegrationStatus::Live, }; static PAYME_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 3] = [ enums::EventClass::Payments, enums::EventClass::Refunds, enums::EventClass::Disputes, ]; impl ConnectorSpecifications for Payme { fn get_connector_about(&self) -> Option<&'static ConnectorInfo> { Some(&PAYME_CONNECTOR_INFO) } fn get_supported_payment_methods(&self) -> Option<&'static SupportedPaymentMethods> { Some(&*PAYME_SUPPORTED_PAYMENT_METHODS) } fn get_supported_webhook_flows(&self) -> Option<&'static [enums::EventClass]> { Some(&PAYME_SUPPORTED_WEBHOOK_FLOWS) } }
crates/hyperswitch_connectors/src/connectors/payme.rs#chunk1
hyperswitch_connectors
chunk
null
null
null
2,631
null
null
null
null
null
null
null
// Struct: MerchantInitiatedTransaction // File: crates/hyperswitch_connectors/src/connectors/wellsfargo/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct MerchantInitiatedTransaction
crates/hyperswitch_connectors/src/connectors/wellsfargo/transformers.rs
hyperswitch_connectors
struct_definition
MerchantInitiatedTransaction
0
[]
51
null
null
null
null
null
null
null
// File: crates/router/src/types/api/connector_mapping.rs // Module: router // Public functions: 4 // Public structs: 1 use std::str::FromStr; use error_stack::{report, ResultExt}; use hyperswitch_connectors::connectors::{Paytm, Phonepe}; use crate::{ configs::settings::Connectors, connector, core::errors::{self, CustomResult}, services::connector_integration_interface::ConnectorEnum, types::{self, api::enums}, }; /// Routing algorithm will output merchant connector identifier instead of connector name /// In order to support backwards compatibility for older routing algorithms and merchant accounts /// the support for connector name is retained #[derive(Clone, Debug)] pub struct ConnectorData { pub connector: ConnectorEnum, pub connector_name: types::Connector, pub get_token: GetToken, pub merchant_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>, } // Normal flow will call the connector and follow the flow specific operations (capture, authorize) // SessionTokenFromMetadata will avoid calling the connector instead create the session token ( for sdk ) #[derive(Clone, Eq, PartialEq, Debug)] pub enum GetToken { GpayMetadata, SamsungPayMetadata, AmazonPayMetadata, ApplePayMetadata, PaypalSdkMetadata, PazeMetadata, Connector, } impl ConnectorData { pub fn get_connector_by_name( _connectors: &Connectors, name: &str, connector_type: GetToken, connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>, ) -> CustomResult<Self, errors::ApiErrorResponse> { let connector = Self::convert_connector(name)?; let connector_name = enums::Connector::from_str(name) .change_context(errors::ConnectorError::InvalidConnectorName) .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable_lazy(|| format!("unable to parse connector name {name}"))?; Ok(Self { connector, connector_name, get_token: connector_type, merchant_connector_id: connector_id, }) } #[cfg(feature = "payouts")] pub fn get_payout_connector_by_name( _connectors: &Connectors, name: &str, connector_type: GetToken, connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>, ) -> CustomResult<Self, errors::ApiErrorResponse> { let connector = Self::convert_connector(name)?; let payout_connector_name = enums::PayoutConnectors::from_str(name) .change_context(errors::ConnectorError::InvalidConnectorName) .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable_lazy(|| format!("unable to parse payout connector name {name}"))?; let connector_name = enums::Connector::from(payout_connector_name); Ok(Self { connector, connector_name, get_token: connector_type, merchant_connector_id: connector_id, }) } pub fn get_external_vault_connector_by_name( _connectors: &Connectors, connector: String, connector_type: GetToken, connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>, ) -> CustomResult<Self, errors::ApiErrorResponse> { let connector_enum = Self::convert_connector(&connector)?; let external_vault_connector_name = enums::VaultConnectors::from_str(&connector) .change_context(errors::ConnectorError::InvalidConnectorName) .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable_lazy(|| { format!("unable to parse external vault connector name {connector:?}") })?; let connector_name = enums::Connector::from(external_vault_connector_name); Ok(Self { connector: connector_enum, connector_name, get_token: connector_type, merchant_connector_id: connector_id, }) } pub fn convert_connector( connector_name: &str, ) -> CustomResult<ConnectorEnum, errors::ApiErrorResponse> { match enums::Connector::from_str(connector_name) { Ok(name) => match name { enums::Connector::Aci => Ok(ConnectorEnum::Old(Box::new(connector::Aci::new()))), enums::Connector::Adyen => { Ok(ConnectorEnum::Old(Box::new(connector::Adyen::new()))) } enums::Connector::Affirm => { Ok(ConnectorEnum::Old(Box::new(connector::Affirm::new()))) } enums::Connector::Adyenplatform => Ok(ConnectorEnum::Old(Box::new( connector::Adyenplatform::new(), ))), enums::Connector::Airwallex => { Ok(ConnectorEnum::Old(Box::new(connector::Airwallex::new()))) } enums::Connector::Amazonpay => { Ok(ConnectorEnum::Old(Box::new(connector::Amazonpay::new()))) } enums::Connector::Archipel => { Ok(ConnectorEnum::Old(Box::new(connector::Archipel::new()))) } enums::Connector::Authipay => { Ok(ConnectorEnum::Old(Box::new(connector::Authipay::new()))) } enums::Connector::Authorizedotnet => Ok(ConnectorEnum::Old(Box::new( connector::Authorizedotnet::new(), ))), enums::Connector::Bambora => { Ok(ConnectorEnum::Old(Box::new(connector::Bambora::new()))) } enums::Connector::Bamboraapac => { Ok(ConnectorEnum::Old(Box::new(connector::Bamboraapac::new()))) } enums::Connector::Bankofamerica => Ok(ConnectorEnum::Old(Box::new( connector::Bankofamerica::new(), ))), enums::Connector::Barclaycard => { Ok(ConnectorEnum::Old(Box::new(connector::Barclaycard::new()))) } enums::Connector::Billwerk => { Ok(ConnectorEnum::Old(Box::new(connector::Billwerk::new()))) } enums::Connector::Bitpay => { Ok(ConnectorEnum::Old(Box::new(connector::Bitpay::new()))) } enums::Connector::Blackhawknetwork => Ok(ConnectorEnum::Old(Box::new( connector::Blackhawknetwork::new(), ))), enums::Connector::Bluesnap => { Ok(ConnectorEnum::Old(Box::new(connector::Bluesnap::new()))) } enums::Connector::Bluecode => { Ok(ConnectorEnum::Old(Box::new(connector::Bluecode::new()))) } enums::Connector::Boku => Ok(ConnectorEnum::Old(Box::new(connector::Boku::new()))), enums::Connector::Braintree => { Ok(ConnectorEnum::Old(Box::new(connector::Braintree::new()))) } enums::Connector::Breadpay => { Ok(ConnectorEnum::Old(Box::new(connector::Breadpay::new()))) } enums::Connector::Cashtocode => { Ok(ConnectorEnum::Old(Box::new(connector::Cashtocode::new()))) } enums::Connector::Celero => { Ok(ConnectorEnum::Old(Box::new(connector::Celero::new()))) } enums::Connector::Chargebee => { Ok(ConnectorEnum::Old(Box::new(connector::Chargebee::new()))) } enums::Connector::Checkbook => { Ok(ConnectorEnum::Old(Box::new(connector::Checkbook::new()))) } enums::Connector::Checkout => { Ok(ConnectorEnum::Old(Box::new(connector::Checkout::new()))) } enums::Connector::Coinbase => { Ok(ConnectorEnum::Old(Box::new(connector::Coinbase::new()))) } enums::Connector::Coingate => { Ok(ConnectorEnum::Old(Box::new(connector::Coingate::new()))) } enums::Connector::Cryptopay => { Ok(ConnectorEnum::Old(Box::new(connector::Cryptopay::new()))) } enums::Connector::CtpMastercard => { Ok(ConnectorEnum::Old(Box::new(&connector::CtpMastercard))) } enums::Connector::Custombilling => Ok(ConnectorEnum::Old(Box::new( connector::Custombilling::new(), ))), enums::Connector::CtpVisa => Ok(ConnectorEnum::Old(Box::new( connector::UnifiedAuthenticationService::new(), ))), enums::Connector::Cybersource => { Ok(ConnectorEnum::Old(Box::new(connector::Cybersource::new()))) } enums::Connector::Datatrans => { Ok(ConnectorEnum::Old(Box::new(connector::Datatrans::new()))) } enums::Connector::Deutschebank => { Ok(ConnectorEnum::Old(Box::new(connector::Deutschebank::new()))) } enums::Connector::Digitalvirgo => { Ok(ConnectorEnum::Old(Box::new(connector::Digitalvirgo::new()))) } enums::Connector::Dlocal => { Ok(ConnectorEnum::Old(Box::new(connector::Dlocal::new()))) } #[cfg(feature = "dummy_connector")] enums::Connector::DummyConnector1 => Ok(ConnectorEnum::Old(Box::new( connector::DummyConnector::<1>::new(), ))), #[cfg(feature = "dummy_connector")] enums::Connector::DummyConnector2 => Ok(ConnectorEnum::Old(Box::new( connector::DummyConnector::<2>::new(), ))), #[cfg(feature = "dummy_connector")] enums::Connector::DummyConnector3 => Ok(ConnectorEnum::Old(Box::new( connector::DummyConnector::<3>::new(), ))), #[cfg(feature = "dummy_connector")] enums::Connector::DummyConnector4 => Ok(ConnectorEnum::Old(Box::new( connector::DummyConnector::<4>::new(), ))), #[cfg(feature = "dummy_connector")] enums::Connector::DummyConnector5 => Ok(ConnectorEnum::Old(Box::new( connector::DummyConnector::<5>::new(), ))), #[cfg(feature = "dummy_connector")] enums::Connector::DummyConnector6 => Ok(ConnectorEnum::Old(Box::new( connector::DummyConnector::<6>::new(), ))), #[cfg(feature = "dummy_connector")] enums::Connector::DummyConnector7 => Ok(ConnectorEnum::Old(Box::new( connector::DummyConnector::<7>::new(), ))), #[cfg(feature = "dummy_connector")] enums::Connector::DummyBillingConnector => Ok(ConnectorEnum::Old(Box::new( connector::DummyConnector::<8>::new(), ))), enums::Connector::Dwolla => { Ok(ConnectorEnum::Old(Box::new(connector::Dwolla::new()))) } enums::Connector::Ebanx => { Ok(ConnectorEnum::Old(Box::new(connector::Ebanx::new()))) } enums::Connector::Elavon => { Ok(ConnectorEnum::Old(Box::new(connector::Elavon::new()))) } enums::Connector::Facilitapay => { Ok(ConnectorEnum::Old(Box::new(connector::Facilitapay::new()))) } enums::Connector::Fiserv => { Ok(ConnectorEnum::Old(Box::new(connector::Fiserv::new()))) } enums::Connector::Fiservemea => { Ok(ConnectorEnum::Old(Box::new(connector::Fiservemea::new()))) } enums::Connector::Fiuu => Ok(ConnectorEnum::Old(Box::new(connector::Fiuu::new()))), enums::Connector::Flexiti => { Ok(ConnectorEnum::Old(Box::new(connector::Flexiti::new()))) } enums::Connector::Forte => { Ok(ConnectorEnum::Old(Box::new(connector::Forte::new()))) } enums::Connector::Getnet => { Ok(ConnectorEnum::Old(Box::new(connector::Getnet::new()))) } enums::Connector::Gigadat => { Ok(ConnectorEnum::Old(Box::new(connector::Gigadat::new()))) } enums::Connector::Globalpay => { Ok(ConnectorEnum::Old(Box::new(connector::Globalpay::new()))) } enums::Connector::Globepay => { Ok(ConnectorEnum::Old(Box::new(connector::Globepay::new()))) } enums::Connector::Gocardless => { Ok(ConnectorEnum::Old(Box::new(connector::Gocardless::new()))) } enums::Connector::Hipay => { Ok(ConnectorEnum::Old(Box::new(connector::Hipay::new()))) } enums::Connector::Helcim => { Ok(ConnectorEnum::Old(Box::new(connector::Helcim::new()))) } enums::Connector::HyperswitchVault => { Ok(ConnectorEnum::Old(Box::new(&connector::HyperswitchVault))) } enums::Connector::Iatapay => { Ok(ConnectorEnum::Old(Box::new(connector::Iatapay::new()))) } enums::Connector::Inespay => { Ok(ConnectorEnum::Old(Box::new(connector::Inespay::new()))) } enums::Connector::Itaubank => { Ok(ConnectorEnum::Old(Box::new(connector::Itaubank::new()))) } enums::Connector::Jpmorgan => { Ok(ConnectorEnum::Old(Box::new(connector::Jpmorgan::new()))) } enums::Connector::Juspaythreedsserver => Ok(ConnectorEnum::Old(Box::new( connector::Juspaythreedsserver::new(), ))), enums::Connector::Klarna => { Ok(ConnectorEnum::Old(Box::new(connector::Klarna::new()))) } enums::Connector::Loonio => { Ok(ConnectorEnum::Old(Box::new(connector::Loonio::new()))) } enums::Connector::Mollie => { // enums::Connector::Moneris => Ok(ConnectorEnum::Old(Box::new(connector::Moneris))), Ok(ConnectorEnum::Old(Box::new(connector::Mollie::new()))) } enums::Connector::Moneris => { Ok(ConnectorEnum::Old(Box::new(connector::Moneris::new()))) } enums::Connector::Nexixpay => { Ok(ConnectorEnum::Old(Box::new(connector::Nexixpay::new()))) } enums::Connector::Nmi => Ok(ConnectorEnum::Old(Box::new(connector::Nmi::new()))), enums::Connector::Nomupay => { Ok(ConnectorEnum::Old(Box::new(connector::Nomupay::new()))) } enums::Connector::Noon => Ok(ConnectorEnum::Old(Box::new(connector::Noon::new()))), enums::Connector::Nordea => { Ok(ConnectorEnum::Old(Box::new(connector::Nordea::new()))) } enums::Connector::Novalnet => { Ok(ConnectorEnum::Old(Box::new(connector::Novalnet::new()))) } enums::Connector::Nuvei => { Ok(ConnectorEnum::Old(Box::new(connector::Nuvei::new()))) } enums::Connector::Opennode => { Ok(ConnectorEnum::Old(Box::new(connector::Opennode::new()))) } enums::Connector::Paybox => { Ok(ConnectorEnum::Old(Box::new(connector::Paybox::new()))) } // "payeezy" => Ok(ConnectorIntegrationEnum::Old(Box::new(&connector::Payeezy)), As psync and rsync are not supported by this connector, it is added as template code for future usage // enums::Connector::Payload => { // Ok(ConnectorEnum::Old(Box::new(connector::Paybload::new()))) // } enums::Connector::Payload => { Ok(ConnectorEnum::Old(Box::new(connector::Payload::new()))) } enums::Connector::Payme => { Ok(ConnectorEnum::Old(Box::new(connector::Payme::new()))) } enums::Connector::Payone => { Ok(ConnectorEnum::Old(Box::new(connector::Payone::new()))) } enums::Connector::Payu => Ok(ConnectorEnum::Old(Box::new(connector::Payu::new()))), enums::Connector::Peachpayments => Ok(ConnectorEnum::Old(Box::new( hyperswitch_connectors::connectors::Peachpayments::new(), ))), enums::Connector::Placetopay => { Ok(ConnectorEnum::Old(Box::new(connector::Placetopay::new()))) } enums::Connector::Powertranz => { Ok(ConnectorEnum::Old(Box::new(&connector::Powertranz))) } enums::Connector::Prophetpay => { Ok(ConnectorEnum::Old(Box::new(&connector::Prophetpay))) } enums::Connector::Razorpay => { Ok(ConnectorEnum::Old(Box::new(connector::Razorpay::new()))) } enums::Connector::Rapyd => { Ok(ConnectorEnum::Old(Box::new(connector::Rapyd::new()))) } enums::Connector::Recurly => { Ok(ConnectorEnum::New(Box::new(connector::Recurly::new()))) } enums::Connector::Redsys => { Ok(ConnectorEnum::Old(Box::new(connector::Redsys::new()))) } enums::Connector::Santander => { Ok(ConnectorEnum::Old(Box::new(connector::Santander::new()))) } enums::Connector::Shift4 => { Ok(ConnectorEnum::Old(Box::new(connector::Shift4::new()))) } enums::Connector::Silverflow => { Ok(ConnectorEnum::Old(Box::new(connector::Silverflow::new()))) } enums::Connector::Square => Ok(ConnectorEnum::Old(Box::new(&connector::Square))), enums::Connector::Stax => Ok(ConnectorEnum::Old(Box::new(&connector::Stax))), enums::Connector::Stripe => { Ok(ConnectorEnum::Old(Box::new(connector::Stripe::new()))) } enums::Connector::Stripebilling => Ok(ConnectorEnum::Old(Box::new( connector::Stripebilling::new(), ))), enums::Connector::Wise => Ok(ConnectorEnum::Old(Box::new(connector::Wise::new()))), enums::Connector::Worldline => { Ok(ConnectorEnum::Old(Box::new(&connector::Worldline))) } enums::Connector::Worldpay => { Ok(ConnectorEnum::Old(Box::new(connector::Worldpay::new()))) } enums::Connector::Worldpayvantiv => Ok(ConnectorEnum::Old(Box::new( connector::Worldpayvantiv::new(), ))), enums::Connector::Worldpayxml => { Ok(ConnectorEnum::Old(Box::new(connector::Worldpayxml::new()))) } enums::Connector::Xendit => { Ok(ConnectorEnum::Old(Box::new(connector::Xendit::new()))) } enums::Connector::Mifinity => { Ok(ConnectorEnum::Old(Box::new(connector::Mifinity::new()))) } enums::Connector::Multisafepay => { Ok(ConnectorEnum::Old(Box::new(connector::Multisafepay::new()))) } enums::Connector::Netcetera => { Ok(ConnectorEnum::Old(Box::new(&connector::Netcetera))) } enums::Connector::Nexinets => { Ok(ConnectorEnum::Old(Box::new(&connector::Nexinets))) } // enums::Connector::Nexixpay => { // Ok(ConnectorEnum::Old(Box::new(&connector::Nexixpay))) // } enums::Connector::Paypal => { Ok(ConnectorEnum::Old(Box::new(connector::Paypal::new()))) } enums::Connector::Paysafe => { Ok(ConnectorEnum::Old(Box::new(connector::Paysafe::new()))) } enums::Connector::Paystack => { Ok(ConnectorEnum::Old(Box::new(connector::Paystack::new()))) } // enums::Connector::Thunes => Ok(ConnectorEnum::Old(Box::new(connector::Thunes))), enums::Connector::Tokenex => Ok(ConnectorEnum::Old(Box::new(&connector::Tokenex))), enums::Connector::Tokenio => { Ok(ConnectorEnum::Old(Box::new(connector::Tokenio::new()))) } enums::Connector::Trustpay => { Ok(ConnectorEnum::Old(Box::new(connector::Trustpay::new()))) } enums::Connector::Trustpayments => Ok(ConnectorEnum::Old(Box::new( connector::Trustpayments::new(), ))), enums::Connector::Tsys => Ok(ConnectorEnum::Old(Box::new(connector::Tsys::new()))), // enums::Connector::UnifiedAuthenticationService => Ok(ConnectorEnum::Old(Box::new( // connector::UnifiedAuthenticationService, // ))), enums::Connector::Vgs => Ok(ConnectorEnum::Old(Box::new(&connector::Vgs))), enums::Connector::Volt => Ok(ConnectorEnum::Old(Box::new(connector::Volt::new()))), enums::Connector::Wellsfargo => { Ok(ConnectorEnum::Old(Box::new(connector::Wellsfargo::new()))) } // enums::Connector::Wellsfargopayout => { // Ok(Box::new(connector::Wellsfargopayout::new())) // } enums::Connector::Zen => Ok(ConnectorEnum::Old(Box::new(&connector::Zen))), enums::Connector::Zsl => Ok(ConnectorEnum::Old(Box::new(&connector::Zsl))), enums::Connector::Plaid => { Ok(ConnectorEnum::Old(Box::new(connector::Plaid::new()))) } enums::Connector::Signifyd | enums::Connector::Riskified | enums::Connector::Gpayments | enums::Connector::Threedsecureio | enums::Connector::Cardinal | enums::Connector::Taxjar => { Err(report!(errors::ConnectorError::InvalidConnectorName) .attach_printable(format!("invalid connector name: {connector_name}"))) .change_context(errors::ApiErrorResponse::InternalServerError) } enums::Connector::Phonepe => Ok(ConnectorEnum::Old(Box::new(Phonepe::new()))), enums::Connector::Paytm => Ok(ConnectorEnum::Old(Box::new(Paytm::new()))), }, Err(_) => Err(report!(errors::ConnectorError::InvalidConnectorName) .attach_printable(format!("invalid connector name: {connector_name}"))) .change_context(errors::ApiErrorResponse::InternalServerError), } } }
crates/router/src/types/api/connector_mapping.rs
router
full_file
null
null
null
5,058
null
null
null
null
null
null
null
// Implementation: impl api::RefundExecute for for Tesouro // File: crates/hyperswitch_connectors/src/connectors/tesouro.rs // Module: hyperswitch_connectors // Methods: 0 total (0 public) impl api::RefundExecute for for Tesouro
crates/hyperswitch_connectors/src/connectors/tesouro.rs
hyperswitch_connectors
impl_block
null
null
null
60
null
Tesouro
api::RefundExecute for
0
0
null
null
// Struct: NetworkTokenizedCard // File: crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct NetworkTokenizedCard
crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs
hyperswitch_connectors
struct_definition
NetworkTokenizedCard
0
[]
51
null
null
null
null
null
null
null
// Function: start_tokenize_data_workflow // File: crates/router/src/core/payment_methods/vault.rs // Module: router pub fn start_tokenize_data_workflow( state: &routes::SessionState, tokenize_tracker: &storage::ProcessTracker, ) -> Result<(), errors::ProcessTrackerError>
crates/router/src/core/payment_methods/vault.rs
router
function_signature
null
null
null
62
start_tokenize_data_workflow
null
null
null
null
null
null
// Struct: BitpayAuthType // File: crates/hyperswitch_connectors/src/connectors/bitpay/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct BitpayAuthType
crates/hyperswitch_connectors/src/connectors/bitpay/transformers.rs
hyperswitch_connectors
struct_definition
BitpayAuthType
0
[]
49
null
null
null
null
null
null
null
// Implementation: impl api::PaymentSession for for Opennode // File: crates/hyperswitch_connectors/src/connectors/opennode.rs // Module: hyperswitch_connectors // Methods: 0 total (0 public) impl api::PaymentSession for for Opennode
crates/hyperswitch_connectors/src/connectors/opennode.rs
hyperswitch_connectors
impl_block
null
null
null
59
null
Opennode
api::PaymentSession for
0
0
null
null
// File: crates/analytics/src/refunds/metrics/sessionized_metrics/refund_error_message.rs // Module: analytics use std::collections::HashSet; use api_models::analytics::{ refunds::{RefundDimensions, RefundFilters, RefundMetricsBucketIdentifier}, Granularity, TimeRange, }; use common_utils::errors::ReportSwitchExt; use diesel_models::enums as storage_enums; use error_stack::ResultExt; use time::PrimitiveDateTime; use super::RefundMetricRow; use crate::{ enums::AuthInfo, query::{ Aggregate, FilterTypes, GroupByClause, Order, QueryBuilder, QueryFilter, SeriesBucket, ToSql, Window, }, types::{AnalyticsCollection, AnalyticsDataSource, MetricsError, MetricsResult}, }; #[derive(Default)] pub(crate) struct RefundErrorMessage; #[async_trait::async_trait] impl<T> super::RefundMetric<T> for RefundErrorMessage where T: AnalyticsDataSource + super::RefundMetricAnalytics, PrimitiveDateTime: ToSql<T>, AnalyticsCollection: ToSql<T>, Granularity: GroupByClause<T>, Aggregate<&'static str>: ToSql<T>, Window<&'static str>: ToSql<T>, { async fn load_metrics( &self, dimensions: &[RefundDimensions], auth: &AuthInfo, filters: &RefundFilters, granularity: Option<Granularity>, time_range: &TimeRange, pool: &T, ) -> MetricsResult<HashSet<(RefundMetricsBucketIdentifier, RefundMetricRow)>> { let mut inner_query_builder: QueryBuilder<T> = QueryBuilder::new(AnalyticsCollection::RefundSessionized); inner_query_builder .add_select_column("sum(sign_flag)") .switch()?; inner_query_builder .add_custom_filter_clause( RefundDimensions::RefundErrorMessage, "NULL", FilterTypes::IsNotNull, ) .switch()?; time_range .set_filter_clause(&mut inner_query_builder) .attach_printable("Error filtering time range for inner query") .switch()?; let inner_query_string = inner_query_builder .build_query() .attach_printable("Error building inner query") .change_context(MetricsError::QueryBuildingError)?; let mut outer_query_builder: QueryBuilder<T> = QueryBuilder::new(AnalyticsCollection::RefundSessionized); for dim in dimensions.iter() { outer_query_builder.add_select_column(dim).switch()?; } outer_query_builder .add_select_column("sum(sign_flag) AS count") .switch()?; outer_query_builder .add_select_column(format!("({inner_query_string}) AS total")) .switch()?; outer_query_builder .add_select_column(Aggregate::Min { field: "created_at", alias: Some("start_bucket"), }) .switch()?; outer_query_builder .add_select_column(Aggregate::Max { field: "created_at", alias: Some("end_bucket"), }) .switch()?; filters .set_filter_clause(&mut outer_query_builder) .switch()?; auth.set_filter_clause(&mut outer_query_builder).switch()?; time_range .set_filter_clause(&mut outer_query_builder) .attach_printable("Error filtering time range for outer query") .switch()?; outer_query_builder .add_filter_clause( RefundDimensions::RefundStatus, storage_enums::RefundStatus::Failure, ) .switch()?; outer_query_builder .add_custom_filter_clause( RefundDimensions::RefundErrorMessage, "NULL", FilterTypes::IsNotNull, ) .switch()?; for dim in dimensions.iter() { outer_query_builder .add_group_by_clause(dim) .attach_printable("Error grouping by dimensions") .switch()?; } if let Some(granularity) = granularity { granularity .set_group_by_clause(&mut outer_query_builder) .attach_printable("Error adding granularity") .switch()?; } outer_query_builder .add_order_by_clause("count", Order::Descending) .attach_printable("Error adding order by clause") .switch()?; let filtered_dimensions: Vec<&RefundDimensions> = dimensions .iter() .filter(|&&dim| dim != RefundDimensions::RefundErrorMessage) .collect(); for dim in &filtered_dimensions { outer_query_builder .add_order_by_clause(*dim, Order::Ascending) .attach_printable("Error adding order by clause") .switch()?; } outer_query_builder .execute_query::<RefundMetricRow, _>(pool) .await .change_context(MetricsError::QueryBuildingError)? .change_context(MetricsError::QueryExecutionFailure)? .into_iter() .map(|i| { Ok(( RefundMetricsBucketIdentifier::new( i.currency.as_ref().map(|i| i.0), None, i.connector.clone(), i.refund_type.as_ref().map(|i| i.0.to_string()), i.profile_id.clone(), i.refund_reason.clone(), i.refund_error_message.clone(), TimeRange { start_time: match (granularity, i.start_bucket) { (Some(g), Some(st)) => g.clip_to_start(st)?, _ => time_range.start_time, }, end_time: granularity.as_ref().map_or_else( || Ok(time_range.end_time), |g| i.end_bucket.map(|et| g.clip_to_end(et)).transpose(), )?, }, ), i, )) }) .collect::<error_stack::Result< HashSet<(RefundMetricsBucketIdentifier, RefundMetricRow)>, crate::query::PostProcessingError, >>() .change_context(MetricsError::PostProcessingFailure) } }
crates/analytics/src/refunds/metrics/sessionized_metrics/refund_error_message.rs
analytics
full_file
null
null
null
1,283
null
null
null
null
null
null
null
// Function: payment_processor_token_retry_info // File: crates/router/src/types/storage/revenue_recovery_redis_operation.rs // Module: router // Documentation: Calculate retry counts for exactly the last 30 days pub fn payment_processor_token_retry_info( state: &SessionState, token: &PaymentProcessorTokenStatus, today: Date, network_type: Option<CardNetwork>, ) -> TokenRetryInfo
crates/router/src/types/storage/revenue_recovery_redis_operation.rs
router
function_signature
null
null
null
87
payment_processor_token_retry_info
null
null
null
null
null
null
// Implementation: impl api::PaymentVoid for for Katapult // File: crates/hyperswitch_connectors/src/connectors/katapult.rs // Module: hyperswitch_connectors // Methods: 0 total (0 public) impl api::PaymentVoid for for Katapult
crates/hyperswitch_connectors/src/connectors/katapult.rs
hyperswitch_connectors
impl_block
null
null
null
58
null
Katapult
api::PaymentVoid for
0
0
null
null
// Function: new // File: crates/currency_conversion/src/types.rs // Module: currency_conversion pub fn new(to_factor: Decimal, from_factor: Decimal) -> Self
crates/currency_conversion/src/types.rs
currency_conversion
function_signature
null
null
null
37
new
null
null
null
null
null
null
// Implementation: impl api::PaymentAuthorize for for Authipay // File: crates/hyperswitch_connectors/src/connectors/authipay.rs // Module: hyperswitch_connectors // Methods: 0 total (0 public) impl api::PaymentAuthorize for for Authipay
crates/hyperswitch_connectors/src/connectors/authipay.rs
hyperswitch_connectors
impl_block
null
null
null
57
null
Authipay
api::PaymentAuthorize for
0
0
null
null
// Struct: CaptureNew // File: crates/diesel_models/src/capture.rs // Module: diesel_models // Implementations: 0 pub struct CaptureNew
crates/diesel_models/src/capture.rs
diesel_models
struct_definition
CaptureNew
0
[]
35
null
null
null
null
null
null
null
// Implementation: impl api::PaymentAuthorize for for Inespay // File: crates/hyperswitch_connectors/src/connectors/inespay.rs // Module: hyperswitch_connectors // Methods: 0 total (0 public) impl api::PaymentAuthorize for for Inespay
crates/hyperswitch_connectors/src/connectors/inespay.rs
hyperswitch_connectors
impl_block
null
null
null
60
null
Inespay
api::PaymentAuthorize for
0
0
null
null
// File: crates/router/tests/connectors/mpgs.rs // Module: router use hyperswitch_domain_models::payment_method_data::{Card, PaymentMethodData}; use masking::Secret; use router::types::{self, api, storage::enums}; use test_utils::connector_auth; use crate::utils::{self, ConnectorActions}; #[derive(Clone, Copy)] struct MpgsTest; impl ConnectorActions for MpgsTest {} impl utils::Connector for MpgsTest { fn get_data(&self) -> api::ConnectorData { use router::connector::Mpgs; utils::construct_connector_data_old( Box::new(Mpgs::new()), types::Connector::Plaid, api::GetToken::Connector, None, ) } fn get_auth_token(&self) -> types::ConnectorAuthType { utils::to_connector_auth_type( connector_auth::ConnectorAuthentication::new() .mpgs .expect("Missing connector authentication configuration") .into(), ) } fn get_name(&self) -> String { "mpgs".to_string() } } static CONNECTOR: MpgsTest = MpgsTest {}; fn get_default_payment_info() -> Option<utils::PaymentInfo> { None } fn payment_method_details() -> Option<types::PaymentsAuthorizeData> { None } // Cards Positive Tests // Creates a payment using the manual capture flow (Non 3DS). #[actix_web::test] async fn should_only_authorize_payment() { let response = CONNECTOR .authorize_payment(payment_method_details(), get_default_payment_info()) .await .expect("Authorize payment response"); assert_eq!(response.status, enums::AttemptStatus::Authorized); } // Captures a payment using the manual capture flow (Non 3DS). #[actix_web::test] async fn should_capture_authorized_payment() { let response = CONNECTOR .authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info()) .await .expect("Capture payment response"); assert_eq!(response.status, enums::AttemptStatus::Charged); } // Partially captures a payment using the manual capture flow (Non 3DS). #[actix_web::test] async fn should_partially_capture_authorized_payment() { let response = CONNECTOR .authorize_and_capture_payment( payment_method_details(), Some(types::PaymentsCaptureData { amount_to_capture: 50, ..utils::PaymentCaptureType::default().0 }), get_default_payment_info(), ) .await .expect("Capture payment response"); assert_eq!(response.status, enums::AttemptStatus::Charged); } // Synchronizes a payment using the manual capture flow (Non 3DS). #[actix_web::test] async fn should_sync_authorized_payment() { let authorize_response = CONNECTOR .authorize_payment(payment_method_details(), get_default_payment_info()) .await .expect("Authorize payment response"); let txn_id = utils::get_connector_transaction_id(authorize_response.response); let response = CONNECTOR .psync_retry_till_status_matches( enums::AttemptStatus::Authorized, Some(types::PaymentsSyncData { connector_transaction_id: types::ResponseId::ConnectorTransactionId( txn_id.unwrap(), ), ..Default::default() }), get_default_payment_info(), ) .await .expect("PSync response"); assert_eq!(response.status, enums::AttemptStatus::Authorized,); } // Voids a payment using the manual capture flow (Non 3DS). #[actix_web::test] async fn should_void_authorized_payment() { let response = CONNECTOR .authorize_and_void_payment( payment_method_details(), Some(types::PaymentsCancelData { connector_transaction_id: String::from(""), cancellation_reason: Some("requested_by_customer".to_string()), ..Default::default() }), get_default_payment_info(), ) .await .expect("Void payment response"); assert_eq!(response.status, enums::AttemptStatus::Voided); } // Refunds a payment using the manual capture flow (Non 3DS). #[actix_web::test] async fn should_refund_manually_captured_payment() { let response = CONNECTOR .capture_payment_and_refund( payment_method_details(), None, None, get_default_payment_info(), ) .await .unwrap(); assert_eq!( response.response.unwrap().refund_status, enums::RefundStatus::Success, ); } // Partially refunds a payment using the manual capture flow (Non 3DS). #[actix_web::test] async fn should_partially_refund_manually_captured_payment() { let response = CONNECTOR .capture_payment_and_refund( payment_method_details(), None, Some(types::RefundsData { refund_amount: 50, ..utils::PaymentRefundType::default().0 }), get_default_payment_info(), ) .await .unwrap(); assert_eq!( response.response.unwrap().refund_status, enums::RefundStatus::Success, ); } // Synchronizes a refund using the manual capture flow (Non 3DS). #[actix_web::test] async fn should_sync_manually_captured_refund() { let refund_response = CONNECTOR .capture_payment_and_refund( payment_method_details(), None, None, get_default_payment_info(), ) .await .unwrap(); let response = CONNECTOR .rsync_retry_till_status_matches( enums::RefundStatus::Success, refund_response.response.unwrap().connector_refund_id, None, get_default_payment_info(), ) .await .unwrap(); assert_eq!( response.response.unwrap().refund_status, enums::RefundStatus::Success, ); } // Creates a payment using the automatic capture flow (Non 3DS). #[actix_web::test] async fn should_make_payment() { let authorize_response = CONNECTOR .make_payment(payment_method_details(), get_default_payment_info()) .await .unwrap(); assert_eq!(authorize_response.status, enums::AttemptStatus::Charged); } // Synchronizes a payment using the automatic capture flow (Non 3DS). #[actix_web::test] async fn should_sync_auto_captured_payment() { let authorize_response = CONNECTOR .make_payment(payment_method_details(), get_default_payment_info()) .await .unwrap(); assert_eq!(authorize_response.status, enums::AttemptStatus::Charged); let txn_id = utils::get_connector_transaction_id(authorize_response.response); assert_ne!(txn_id, None, "Empty connector transaction id"); let response = CONNECTOR .psync_retry_till_status_matches( enums::AttemptStatus::Charged, Some(types::PaymentsSyncData { connector_transaction_id: types::ResponseId::ConnectorTransactionId( txn_id.unwrap(), ), capture_method: Some(enums::CaptureMethod::Automatic), ..Default::default() }), get_default_payment_info(), ) .await .unwrap(); assert_eq!(response.status, enums::AttemptStatus::Charged,); } // Refunds a payment using the automatic capture flow (Non 3DS). #[actix_web::test] async fn should_refund_auto_captured_payment() { let response = CONNECTOR .make_payment_and_refund(payment_method_details(), None, get_default_payment_info()) .await .unwrap(); assert_eq!( response.response.unwrap().refund_status, enums::RefundStatus::Success, ); } // Partially refunds a payment using the automatic capture flow (Non 3DS). #[actix_web::test] async fn should_partially_refund_succeeded_payment() { let refund_response = CONNECTOR .make_payment_and_refund( payment_method_details(), Some(types::RefundsData { refund_amount: 50, ..utils::PaymentRefundType::default().0 }), get_default_payment_info(), ) .await .unwrap(); assert_eq!( refund_response.response.unwrap().refund_status, enums::RefundStatus::Success, ); } // Creates multiple refunds against a payment using the automatic capture flow (Non 3DS). #[actix_web::test] async fn should_refund_succeeded_payment_multiple_times() { CONNECTOR .make_payment_and_multiple_refund( payment_method_details(), Some(types::RefundsData { refund_amount: 50, ..utils::PaymentRefundType::default().0 }), get_default_payment_info(), ) .await; } // Synchronizes a refund using the automatic capture flow (Non 3DS). #[actix_web::test] async fn should_sync_refund() { let refund_response = CONNECTOR .make_payment_and_refund(payment_method_details(), None, get_default_payment_info()) .await .unwrap(); let response = CONNECTOR .rsync_retry_till_status_matches( enums::RefundStatus::Success, refund_response.response.unwrap().connector_refund_id, None, get_default_payment_info(), ) .await .unwrap(); assert_eq!( response.response.unwrap().refund_status, enums::RefundStatus::Success, ); } // Cards Negative scenarios // Creates a payment with incorrect CVC. #[actix_web::test] async fn should_fail_payment_for_incorrect_cvc() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { payment_method_data: PaymentMethodData::Card(Card { card_cvc: Secret::new("12345".to_string()), ..utils::CCardType::default().0 }), ..utils::PaymentAuthorizeType::default().0 }), get_default_payment_info(), ) .await .unwrap(); assert_eq!( response.response.unwrap_err().message, "Your card's security code is invalid.".to_string(), ); } // Creates a payment with incorrect expiry month. #[actix_web::test] async fn should_fail_payment_for_invalid_exp_month() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { payment_method_data: PaymentMethodData::Card(Card { card_exp_month: Secret::new("20".to_string()), ..utils::CCardType::default().0 }), ..utils::PaymentAuthorizeType::default().0 }), get_default_payment_info(), ) .await .unwrap(); assert_eq!( response.response.unwrap_err().message, "Your card's expiration month is invalid.".to_string(), ); } // Creates a payment with incorrect expiry year. #[actix_web::test] async fn should_fail_payment_for_incorrect_expiry_year() { let response = CONNECTOR .make_payment( Some(types::PaymentsAuthorizeData { payment_method_data: PaymentMethodData::Card(Card { card_exp_year: Secret::new("2000".to_string()), ..utils::CCardType::default().0 }), ..utils::PaymentAuthorizeType::default().0 }), get_default_payment_info(), ) .await .unwrap(); assert_eq!( response.response.unwrap_err().message, "Your card's expiration year is invalid.".to_string(), ); } // Voids a payment using automatic capture flow (Non 3DS). #[actix_web::test] async fn should_fail_void_payment_for_auto_capture() { let authorize_response = CONNECTOR .make_payment(payment_method_details(), get_default_payment_info()) .await .unwrap(); assert_eq!(authorize_response.status, enums::AttemptStatus::Charged); let txn_id = utils::get_connector_transaction_id(authorize_response.response); assert_ne!(txn_id, None, "Empty connector transaction id"); let void_response = CONNECTOR .void_payment(txn_id.unwrap(), None, get_default_payment_info()) .await .unwrap(); assert_eq!( void_response.response.unwrap_err().message, "You cannot cancel this PaymentIntent because it has a status of succeeded." ); } // Captures a payment using invalid connector payment id. #[actix_web::test] async fn should_fail_capture_for_invalid_payment() { let capture_response = CONNECTOR .capture_payment("123456789".to_string(), None, get_default_payment_info()) .await .unwrap(); assert_eq!( capture_response.response.unwrap_err().message, String::from("No such payment_intent: '123456789'") ); } // Refunds a payment with refund amount higher than payment amount. #[actix_web::test] async fn should_fail_for_refund_amount_higher_than_payment_amount() { let response = CONNECTOR .make_payment_and_refund( payment_method_details(), Some(types::RefundsData { refund_amount: 150, ..utils::PaymentRefundType::default().0 }), get_default_payment_info(), ) .await .unwrap(); assert_eq!( response.response.unwrap_err().message, "Refund amount (₹1.50) is greater than charge amount (₹1.00)", ); } // Connector dependent test cases goes here // [#478]: add unit tests for non 3DS, wallets & webhooks in connector tests
crates/router/tests/connectors/mpgs.rs
router
full_file
null
null
null
2,937
null
null
null
null
null
null
null
// Implementation: impl api::PayoutRecipientAccount for for Nomupay // File: crates/hyperswitch_connectors/src/connectors/nomupay.rs // Module: hyperswitch_connectors // Methods: 0 total (0 public) impl api::PayoutRecipientAccount for for Nomupay
crates/hyperswitch_connectors/src/connectors/nomupay.rs
hyperswitch_connectors
impl_block
null
null
null
65
null
Nomupay
api::PayoutRecipientAccount for
0
0
null
null
// Implementation: impl api::PaymentCapture for for Multisafepay // File: crates/hyperswitch_connectors/src/connectors/multisafepay.rs // Module: hyperswitch_connectors // Methods: 0 total (0 public) impl api::PaymentCapture for for Multisafepay
crates/hyperswitch_connectors/src/connectors/multisafepay.rs
hyperswitch_connectors
impl_block
null
null
null
67
null
Multisafepay
api::PaymentCapture for
0
0
null
null
// Function: format_emv_field // File: crates/hyperswitch_connectors/src/connectors/santander/transformers.rs // Module: hyperswitch_connectors pub fn format_emv_field(id: &str, value: &str) -> String
crates/hyperswitch_connectors/src/connectors/santander/transformers.rs
hyperswitch_connectors
function_signature
null
null
null
55
format_emv_field
null
null
null
null
null
null
// Function: get_connector_customer_payment_processor_tokens // File: crates/router/src/types/storage/revenue_recovery_redis_operation.rs // Module: router pub fn get_connector_customer_payment_processor_tokens( state: &SessionState, connector_customer_id: &str, ) -> CustomResult<HashMap<String, PaymentProcessorTokenStatus>, errors::StorageError>
crates/router/src/types/storage/revenue_recovery_redis_operation.rs
router
function_signature
null
null
null
72
get_connector_customer_payment_processor_tokens
null
null
null
null
null
null
// Struct: StripebillingRouterData // File: crates/hyperswitch_connectors/src/connectors/stripebilling/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct StripebillingRouterData<T>
crates/hyperswitch_connectors/src/connectors/stripebilling/transformers.rs
hyperswitch_connectors
struct_definition
StripebillingRouterData
0
[]
52
null
null
null
null
null
null
null
// Struct: MerchantConnectorUpdate // File: crates/api_models/src/admin.rs // Module: api_models // Implementations: 1 pub struct MerchantConnectorUpdate
crates/api_models/src/admin.rs
api_models
struct_definition
MerchantConnectorUpdate
1
[]
35
null
null
null
null
null
null
null
// Struct: Store // File: crates/drainer/src/services.rs // Module: drainer // Implementations: 1 pub struct Store
crates/drainer/src/services.rs
drainer
struct_definition
Store
1
[]
31
null
null
null
null
null
null
null
// Struct: Forex // File: crates/router/src/routes/app.rs // Module: router // Implementations: 1 pub struct Forex
crates/router/src/routes/app.rs
router
struct_definition
Forex
1
[]
30
null
null
null
null
null
null
null
// Implementation: impl api::MandateSetup for for Worldpayvantiv // File: crates/hyperswitch_connectors/src/connectors/worldpayvantiv.rs // Module: hyperswitch_connectors // Methods: 0 total (0 public) impl api::MandateSetup for for Worldpayvantiv
crates/hyperswitch_connectors/src/connectors/worldpayvantiv.rs
hyperswitch_connectors
impl_block
null
null
null
67
null
Worldpayvantiv
api::MandateSetup for
0
0
null
null
// Function: is_dispute_event // File: crates/hyperswitch_connectors/src/connectors/airwallex/transformers.rs // Module: hyperswitch_connectors pub fn is_dispute_event(event_code: &AirwallexWebhookEventType) -> bool
crates/hyperswitch_connectors/src/connectors/airwallex/transformers.rs
hyperswitch_connectors
function_signature
null
null
null
57
is_dispute_event
null
null
null
null
null
null
// Struct: PaymentAuthRouterData // File: crates/pm_auth/src/types.rs // Module: pm_auth // Implementations: 0 pub struct PaymentAuthRouterData<F, Request, Response>
crates/pm_auth/src/types.rs
pm_auth
struct_definition
PaymentAuthRouterData
0
[]
43
null
null
null
null
null
null
null
// Struct: AdyenAddress // File: crates/hyperswitch_connectors/src/connectors/adyenplatform/transformers/payouts.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct AdyenAddress
crates/hyperswitch_connectors/src/connectors/adyenplatform/transformers/payouts.rs
hyperswitch_connectors
struct_definition
AdyenAddress
0
[]
52
null
null
null
null
null
null
null
// Function: list_invitable_roles_at_entity_level // File: crates/router/src/routes/user_role.rs // Module: router pub fn list_invitable_roles_at_entity_level( state: web::Data<AppState>, req: HttpRequest, query: web::Query<role_api::ListRolesAtEntityLevelRequest>, ) -> HttpResponse
crates/router/src/routes/user_role.rs
router
function_signature
null
null
null
71
list_invitable_roles_at_entity_level
null
null
null
null
null
null
// File: crates/router/src/events/api_logs.rs // Module: router // Public functions: 1 // Public structs: 1 use actix_web::HttpRequest; pub use common_utils::events::{ApiEventMetric, ApiEventsType}; use common_utils::impl_api_event_type; use router_env::{tracing_actix_web::RequestId, types::FlowMetric}; use serde::Serialize; use time::OffsetDateTime; use super::EventType; #[cfg(feature = "dummy_connector")] use crate::routes::dummy_connector::types::{ DummyConnectorPaymentCompleteRequest, DummyConnectorPaymentConfirmRequest, DummyConnectorPaymentRequest, DummyConnectorPaymentResponse, DummyConnectorPaymentRetrieveRequest, DummyConnectorRefundRequest, DummyConnectorRefundResponse, DummyConnectorRefundRetrieveRequest, }; use crate::{ core::payments::PaymentsRedirectResponseData, services::{authentication::AuthenticationType, kafka::KafkaMessage}, types::api::{ AttachEvidenceRequest, Config, ConfigUpdate, CreateFileRequest, DisputeFetchQueryData, DisputeId, FileId, FileRetrieveRequest, PollId, }, }; #[derive(Clone, Debug, Eq, PartialEq, Serialize)] #[serde(rename_all = "snake_case")] pub struct ApiEvent { tenant_id: common_utils::id_type::TenantId, merchant_id: Option<common_utils::id_type::MerchantId>, api_flow: String, created_at_timestamp: i128, request_id: String, latency: u128, status_code: i64, #[serde(flatten)] auth_type: AuthenticationType, request: String, user_agent: Option<String>, ip_addr: Option<String>, url_path: String, response: Option<String>, error: Option<serde_json::Value>, #[serde(flatten)] event_type: ApiEventsType, hs_latency: Option<u128>, http_method: String, #[serde(flatten)] infra_components: Option<serde_json::Value>, } impl ApiEvent { #[allow(clippy::too_many_arguments)] pub fn new( tenant_id: common_utils::id_type::TenantId, merchant_id: Option<common_utils::id_type::MerchantId>, api_flow: &impl FlowMetric, request_id: &RequestId, latency: u128, status_code: i64, request: serde_json::Value, response: Option<serde_json::Value>, hs_latency: Option<u128>, auth_type: AuthenticationType, error: Option<serde_json::Value>, event_type: ApiEventsType, http_req: &HttpRequest, http_method: &http::Method, infra_components: Option<serde_json::Value>, ) -> Self { Self { tenant_id, merchant_id, api_flow: api_flow.to_string(), created_at_timestamp: OffsetDateTime::now_utc().unix_timestamp_nanos() / 1_000_000, request_id: request_id.as_hyphenated().to_string(), latency, status_code, request: request.to_string(), response: response.map(|resp| resp.to_string()), auth_type, error, ip_addr: http_req .connection_info() .realip_remote_addr() .map(ToOwned::to_owned), user_agent: http_req .headers() .get("user-agent") .and_then(|user_agent_value| user_agent_value.to_str().ok().map(ToOwned::to_owned)), url_path: http_req.path().to_string(), event_type, hs_latency, http_method: http_method.to_string(), infra_components, } } } impl KafkaMessage for ApiEvent { fn event_type(&self) -> EventType { EventType::ApiLogs } fn key(&self) -> String { self.request_id.clone() } } impl_api_event_type!( Miscellaneous, ( Config, CreateFileRequest, FileId, FileRetrieveRequest, AttachEvidenceRequest, DisputeFetchQueryData, ConfigUpdate ) ); #[cfg(feature = "dummy_connector")] impl_api_event_type!( Miscellaneous, ( DummyConnectorPaymentCompleteRequest, DummyConnectorPaymentRequest, DummyConnectorPaymentResponse, DummyConnectorPaymentRetrieveRequest, DummyConnectorPaymentConfirmRequest, DummyConnectorRefundRetrieveRequest, DummyConnectorRefundResponse, DummyConnectorRefundRequest ) ); #[cfg(feature = "v1")] impl ApiEventMetric for PaymentsRedirectResponseData { fn get_api_event_type(&self) -> Option<ApiEventsType> { Some(ApiEventsType::PaymentRedirectionResponse { connector: self.connector.clone(), payment_id: match &self.resource_id { api_models::payments::PaymentIdType::PaymentIntentId(id) => Some(id.clone()), _ => None, }, }) } } #[cfg(feature = "v2")] impl ApiEventMetric for PaymentsRedirectResponseData { fn get_api_event_type(&self) -> Option<ApiEventsType> { Some(ApiEventsType::PaymentRedirectionResponse { payment_id: self.payment_id.clone(), }) } } impl ApiEventMetric for DisputeId { fn get_api_event_type(&self) -> Option<ApiEventsType> { Some(ApiEventsType::Dispute { dispute_id: self.dispute_id.clone(), }) } } impl ApiEventMetric for PollId { fn get_api_event_type(&self) -> Option<ApiEventsType> { Some(ApiEventsType::Poll { poll_id: self.poll_id.clone(), }) } }
crates/router/src/events/api_logs.rs
router
full_file
null
null
null
1,214
null
null
null
null
null
null
null
// Function: new // File: crates/hyperswitch_interfaces/src/events/routing_api_logs.rs // Module: hyperswitch_interfaces pub fn new( tenant_id: common_utils::id_type::TenantId, routable_connectors: String, flow: &str, request: serde_json::Value, url: String, method: ApiMethod, payment_id: String, profile_id: common_utils::id_type::ProfileId, merchant_id: common_utils::id_type::MerchantId, request_id: Option<RequestId>, routing_engine: RoutingEngine, ) -> Self
crates/hyperswitch_interfaces/src/events/routing_api_logs.rs
hyperswitch_interfaces
function_signature
null
null
null
130
new
null
null
null
null
null
null
// Function: try_redis_get_else_try_database_get // File: crates/router/src/utils/db_utils.rs // Module: router pub fn try_redis_get_else_try_database_get<F, RFut, DFut, T>( redis_fut: RFut, database_call_closure: F, ) -> error_stack::Result<T, errors::StorageError> where F: FnOnce() -> DFut, RFut: futures::Future<Output = error_stack::Result<T, redis_interface::errors::RedisError>>, DFut: futures::Future<Output = error_stack::Result<T, errors::StorageError>>,
crates/router/src/utils/db_utils.rs
router
function_signature
null
null
null
131
try_redis_get_else_try_database_get
null
null
null
null
null
null
// Struct: KlarnaMeta // File: crates/hyperswitch_connectors/src/connectors/klarna/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct KlarnaMeta
crates/hyperswitch_connectors/src/connectors/klarna/transformers.rs
hyperswitch_connectors
struct_definition
KlarnaMeta
0
[]
48
null
null
null
null
null
null
null
// Function: scope // File: crates/router_derive/src/macros/generate_permissions.rs // Module: router_derive pub fn scope(&self) -> PermissionScope
crates/router_derive/src/macros/generate_permissions.rs
router_derive
function_signature
null
null
null
36
scope
null
null
null
null
null
null
// Struct: RazorpayOrderResponse // File: crates/hyperswitch_connectors/src/connectors/razorpay/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct RazorpayOrderResponse
crates/hyperswitch_connectors/src/connectors/razorpay/transformers.rs
hyperswitch_connectors
struct_definition
RazorpayOrderResponse
0
[]
51
null
null
null
null
null
null
null
// Struct: Bambora3DsResponse // File: crates/hyperswitch_connectors/src/connectors/bambora/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct Bambora3DsResponse
crates/hyperswitch_connectors/src/connectors/bambora/transformers.rs
hyperswitch_connectors
struct_definition
Bambora3DsResponse
0
[]
54
null
null
null
null
null
null
null
)) } } impl PaymentUpdate { fn populate_payment_attempt_with_request( payment_attempt: &mut storage::PaymentAttempt, request: &api::PaymentsRequest, ) { request .business_sub_label .clone() .map(|bsl| payment_attempt.business_sub_label.replace(bsl)); request .payment_method_type .map(|pmt| payment_attempt.payment_method_type.replace(pmt)); request .payment_experience .map(|experience| payment_attempt.payment_experience.replace(experience)); payment_attempt.amount_to_capture = request .amount_to_capture .or(payment_attempt.amount_to_capture); request .capture_method .map(|i| payment_attempt.capture_method.replace(i)); } fn populate_payment_intent_with_request( payment_intent: &mut storage::PaymentIntent, request: &api::PaymentsRequest, ) { request .return_url .clone() .map(|i| payment_intent.return_url.replace(i.to_string())); payment_intent.business_country = request.business_country; payment_intent .business_label .clone_from(&request.business_label); request .description .clone() .map(|i| payment_intent.description.replace(i)); request .statement_descriptor_name .clone() .map(|i| payment_intent.statement_descriptor_name.replace(i)); request .statement_descriptor_suffix .clone() .map(|i| payment_intent.statement_descriptor_suffix.replace(i)); request .client_secret .clone() .map(|i| payment_intent.client_secret.replace(i)); } }
crates/router/src/core/payments/operations/payment_update.rs#chunk1
router
chunk
null
null
null
362
null
null
null
null
null
null
null
// Struct: PaymentLinkBackgroundImageConfig // File: crates/api_models/src/admin.rs // Module: api_models // Implementations: 0 pub struct PaymentLinkBackgroundImageConfig
crates/api_models/src/admin.rs
api_models
struct_definition
PaymentLinkBackgroundImageConfig
0
[]
39
null
null
null
null
null
null
null
// Function: get_event_handler // File: crates/router/src/events.rs // Module: router pub fn get_event_handler(&self) -> StorageResult<EventsHandler>
crates/router/src/events.rs
router
function_signature
null
null
null
36
get_event_handler
null
null
null
null
null
null
// Struct: Fiserv // File: crates/hyperswitch_connectors/src/connectors/fiserv.rs // Module: hyperswitch_connectors // Implementations: 17 // Traits: ConnectorCommon, api::ConnectorAccessToken, ConnectorValidation, api::Payment, api::PaymentToken, api::MandateSetup, api::PaymentVoid, api::PaymentSync, api::PaymentCapture, api::PaymentSession, api::PaymentAuthorize, api::Refund, api::RefundExecute, api::RefundSync, webhooks::IncomingWebhook, ConnectorSpecifications pub struct Fiserv
crates/hyperswitch_connectors/src/connectors/fiserv.rs
hyperswitch_connectors
struct_definition
Fiserv
17
[ "ConnectorCommon", "api::ConnectorAccessToken", "ConnectorValidation", "api::Payment", "api::PaymentToken", "api::MandateSetup", "api::PaymentVoid", "api::PaymentSync", "api::PaymentCapture", "api::PaymentSession", "api::PaymentAuthorize", "api::Refund", "api::RefundExecute", "api::RefundSync", "webhooks::IncomingWebhook", "ConnectorSpecifications" ]
128
null
null
null
null
null
null
null
// Implementation: impl Multisafepay // File: crates/hyperswitch_connectors/src/connectors/multisafepay.rs // Module: hyperswitch_connectors // Methods: 1 total (1 public) impl Multisafepay
crates/hyperswitch_connectors/src/connectors/multisafepay.rs
hyperswitch_connectors
impl_block
null
null
null
55
null
Multisafepay
null
1
1
null
null
// Function: call_unified_connector_service_for_webhook // File: crates/router/src/core/unified_connector_service.rs // Module: router // Documentation: High-level abstraction for calling UCS webhook transformation This provides a clean interface similar to payment flow UCS calls pub fn call_unified_connector_service_for_webhook( state: &SessionState, merchant_context: &MerchantContext, connector_name: &str, body: &actix_web::web::Bytes, request_details: &hyperswitch_interfaces::webhooks::IncomingWebhookRequestDetails<'_>, merchant_connector_account: Option< &hyperswitch_domain_models::merchant_connector_account::MerchantConnectorAccount, >, ) -> RouterResult<( api_models::webhooks::IncomingWebhookEvent, bool, WebhookTransformData, )>
crates/router/src/core/unified_connector_service.rs
router
function_signature
null
null
null
173
call_unified_connector_service_for_webhook
null
null
null
null
null
null
// File: crates/diesel_models/src/payment_intent.rs // Module: diesel_models // Public functions: 4 // Public structs: 14 use common_enums::{PaymentMethodType, RequestIncrementalAuthorization}; use common_types::primitive_wrappers::{ EnablePartialAuthorizationBool, RequestExtendedAuthorizationBool, }; use common_utils::{encryption::Encryption, pii, types::MinorUnit}; use diesel::{AsChangeset, Identifiable, Insertable, Queryable, Selectable}; use masking::ExposeInterface; use serde::{Deserialize, Serialize}; use time::PrimitiveDateTime; #[cfg(feature = "v1")] use crate::schema::payment_intent; #[cfg(feature = "v2")] use crate::schema_v2::payment_intent; #[cfg(feature = "v2")] use crate::types::{FeatureMetadata, OrderDetailsWithAmount}; #[cfg(feature = "v2")] use crate::RequiredFromNullable; use crate::{business_profile::PaymentLinkBackgroundImageConfig, enums as storage_enums}; #[cfg(feature = "v2")] #[derive(Clone, Debug, PartialEq, Identifiable, Queryable, Serialize, Deserialize, Selectable)] #[diesel(table_name = payment_intent, primary_key(id), check_for_backend(diesel::pg::Pg))] pub struct PaymentIntent { pub merchant_id: common_utils::id_type::MerchantId, pub status: storage_enums::IntentStatus, pub amount: MinorUnit, #[diesel(deserialize_as = RequiredFromNullable<storage_enums::Currency>)] pub currency: storage_enums::Currency, pub amount_captured: Option<MinorUnit>, pub customer_id: Option<common_utils::id_type::GlobalCustomerId>, pub description: Option<common_utils::types::Description>, pub return_url: Option<common_utils::types::Url>, pub metadata: Option<pii::SecretSerdeValue>, #[serde(with = "common_utils::custom_serde::iso8601")] pub created_at: PrimitiveDateTime, #[serde(with = "common_utils::custom_serde::iso8601")] pub modified_at: PrimitiveDateTime, #[serde(default, with = "common_utils::custom_serde::iso8601::option")] pub last_synced: Option<PrimitiveDateTime>, pub setup_future_usage: Option<storage_enums::FutureUsage>, pub active_attempt_id: Option<common_utils::id_type::GlobalAttemptId>, #[diesel(deserialize_as = super::OptionalDieselArray<masking::Secret<OrderDetailsWithAmount>>)] pub order_details: Option<Vec<masking::Secret<OrderDetailsWithAmount>>>, pub allowed_payment_method_types: Option<pii::SecretSerdeValue>, pub connector_metadata: Option<pii::SecretSerdeValue>, pub feature_metadata: Option<FeatureMetadata>, pub attempt_count: i16, #[diesel(deserialize_as = RequiredFromNullable<common_utils::id_type::ProfileId>)] pub profile_id: common_utils::id_type::ProfileId, pub payment_link_id: Option<String>, pub updated_by: String, pub surcharge_applicable: Option<bool>, pub request_incremental_authorization: Option<RequestIncrementalAuthorization>, pub authorization_count: Option<i32>, #[diesel(deserialize_as = RequiredFromNullable<PrimitiveDateTime>)] pub session_expiry: PrimitiveDateTime, pub request_external_three_ds_authentication: Option<bool>, pub frm_metadata: Option<pii::SecretSerdeValue>, pub customer_details: Option<Encryption>, pub shipping_cost: Option<MinorUnit>, pub organization_id: common_utils::id_type::OrganizationId, pub tax_details: Option<TaxDetails>, pub skip_external_tax_calculation: Option<bool>, pub request_extended_authorization: Option<RequestExtendedAuthorizationBool>, pub psd2_sca_exemption_type: Option<storage_enums::ScaExemptionType>, pub split_payments: Option<common_types::payments::SplitPaymentsRequest>, pub platform_merchant_id: Option<common_utils::id_type::MerchantId>, pub force_3ds_challenge: Option<bool>, pub force_3ds_challenge_trigger: Option<bool>, pub processor_merchant_id: Option<common_utils::id_type::MerchantId>, pub created_by: Option<String>, pub is_iframe_redirection_enabled: Option<bool>, pub is_payment_id_from_merchant: Option<bool>, pub payment_channel: Option<common_enums::PaymentChannel>, pub tax_status: Option<common_enums::TaxStatus>, pub discount_amount: Option<MinorUnit>, pub shipping_amount_tax: Option<MinorUnit>, pub duty_amount: Option<MinorUnit>, pub order_date: Option<PrimitiveDateTime>, pub enable_partial_authorization: Option<EnablePartialAuthorizationBool>, pub enable_overcapture: Option<common_types::primitive_wrappers::EnableOvercaptureBool>, pub merchant_reference_id: Option<common_utils::id_type::PaymentReferenceId>, pub billing_address: Option<Encryption>, pub shipping_address: Option<Encryption>, pub capture_method: Option<storage_enums::CaptureMethod>, pub authentication_type: Option<common_enums::AuthenticationType>, pub prerouting_algorithm: Option<serde_json::Value>, pub surcharge_amount: Option<MinorUnit>, pub tax_on_surcharge: Option<MinorUnit>, // Denotes the action(approve or reject) taken by merchant in case of manual review. // Manual review can occur when the transaction is marked as risky by the frm_processor, payment processor or when there is underpayment/over payment incase of crypto payment pub frm_merchant_decision: Option<common_enums::MerchantDecision>, pub statement_descriptor: Option<common_utils::types::StatementDescriptor>, pub enable_payment_link: Option<bool>, pub apply_mit_exemption: Option<bool>, pub customer_present: Option<bool>, pub routing_algorithm_id: Option<common_utils::id_type::RoutingId>, pub payment_link_config: Option<PaymentLinkConfigRequestForPayments>, pub id: common_utils::id_type::GlobalPaymentId, pub split_txns_enabled: Option<common_enums::SplitTxnsEnabled>, pub active_attempts_group_id: Option<String>, pub active_attempt_id_type: Option<common_enums::ActiveAttemptIDType>, } #[cfg(feature = "v1")] #[derive(Clone, Debug, PartialEq, Identifiable, Queryable, Serialize, Deserialize, Selectable)] #[diesel(table_name = payment_intent, primary_key(payment_id, merchant_id), check_for_backend(diesel::pg::Pg))] pub struct PaymentIntent { pub payment_id: common_utils::id_type::PaymentId, pub merchant_id: common_utils::id_type::MerchantId, pub status: storage_enums::IntentStatus, pub amount: MinorUnit, pub currency: Option<storage_enums::Currency>, pub amount_captured: Option<MinorUnit>, pub customer_id: Option<common_utils::id_type::CustomerId>, pub description: Option<String>, pub return_url: Option<String>, pub metadata: Option<serde_json::Value>, pub connector_id: Option<String>, pub shipping_address_id: Option<String>, pub billing_address_id: Option<String>, pub statement_descriptor_name: Option<String>, pub statement_descriptor_suffix: Option<String>, #[serde(with = "common_utils::custom_serde::iso8601")] pub created_at: PrimitiveDateTime, #[serde(with = "common_utils::custom_serde::iso8601")] pub modified_at: PrimitiveDateTime, #[serde(default, with = "common_utils::custom_serde::iso8601::option")] pub last_synced: Option<PrimitiveDateTime>, pub setup_future_usage: Option<storage_enums::FutureUsage>, pub off_session: Option<bool>, pub client_secret: Option<String>, pub active_attempt_id: String, pub business_country: Option<storage_enums::CountryAlpha2>, pub business_label: Option<String>, #[diesel(deserialize_as = super::OptionalDieselArray<pii::SecretSerdeValue>)] pub order_details: Option<Vec<pii::SecretSerdeValue>>, pub allowed_payment_method_types: Option<serde_json::Value>, pub connector_metadata: Option<serde_json::Value>, pub feature_metadata: Option<serde_json::Value>, pub attempt_count: i16, pub profile_id: Option<common_utils::id_type::ProfileId>, // Denotes the action(approve or reject) taken by merchant in case of manual review. // Manual review can occur when the transaction is marked as risky by the frm_processor, payment processor or when there is underpayment/over payment incase of crypto payment pub merchant_decision: Option<String>, pub payment_link_id: Option<String>, pub payment_confirm_source: Option<storage_enums::PaymentSource>, pub updated_by: String, pub surcharge_applicable: Option<bool>, pub request_incremental_authorization: Option<RequestIncrementalAuthorization>, pub incremental_authorization_allowed: Option<bool>, pub authorization_count: Option<i32>, pub session_expiry: Option<PrimitiveDateTime>, pub fingerprint_id: Option<String>, pub request_external_three_ds_authentication: Option<bool>, pub charges: Option<pii::SecretSerdeValue>, pub frm_metadata: Option<pii::SecretSerdeValue>, pub customer_details: Option<Encryption>, pub billing_details: Option<Encryption>, pub merchant_order_reference_id: Option<String>, pub shipping_details: Option<Encryption>, pub is_payment_processor_token_flow: Option<bool>, pub shipping_cost: Option<MinorUnit>, pub organization_id: common_utils::id_type::OrganizationId, pub tax_details: Option<TaxDetails>, pub skip_external_tax_calculation: Option<bool>, pub request_extended_authorization: Option<RequestExtendedAuthorizationBool>, pub psd2_sca_exemption_type: Option<storage_enums::ScaExemptionType>, pub split_payments: Option<common_types::payments::SplitPaymentsRequest>, pub platform_merchant_id: Option<common_utils::id_type::MerchantId>, pub force_3ds_challenge: Option<bool>, pub force_3ds_challenge_trigger: Option<bool>, pub processor_merchant_id: Option<common_utils::id_type::MerchantId>, pub created_by: Option<String>, pub is_iframe_redirection_enabled: Option<bool>, pub extended_return_url: Option<String>, pub is_payment_id_from_merchant: Option<bool>, pub payment_channel: Option<common_enums::PaymentChannel>, pub tax_status: Option<common_enums::TaxStatus>, pub discount_amount: Option<MinorUnit>, pub shipping_amount_tax: Option<MinorUnit>, pub duty_amount: Option<MinorUnit>, pub order_date: Option<PrimitiveDateTime>, pub enable_partial_authorization: Option<EnablePartialAuthorizationBool>, pub enable_overcapture: Option<common_types::primitive_wrappers::EnableOvercaptureBool>, } #[derive(Clone, Debug, serde::Deserialize, serde::Serialize, diesel::AsExpression, PartialEq)] #[diesel(sql_type = diesel::sql_types::Jsonb)] pub struct PaymentLinkConfigRequestForPayments { /// custom theme for the payment link pub theme: Option<String>, /// merchant display logo pub logo: Option<String>, /// Custom merchant name for payment link pub seller_name: Option<String>, /// Custom layout for sdk pub sdk_layout: Option<String>, /// Display only the sdk for payment link pub display_sdk_only: Option<bool>, /// Enable saved payment method option for payment link pub enabled_saved_payment_method: Option<bool>, /// Hide card nickname field option for payment link pub hide_card_nickname_field: Option<bool>, /// Show card form by default for payment link pub show_card_form_by_default: Option<bool>, /// Dynamic details related to merchant to be rendered in payment link pub transaction_details: Option<Vec<PaymentLinkTransactionDetails>>, /// Configurations for the background image for details section pub background_image: Option<PaymentLinkBackgroundImageConfig>, /// Custom layout for details section pub details_layout: Option<common_enums::PaymentLinkDetailsLayout>, /// Text for payment link's handle confirm button pub payment_button_text: Option<String>, /// Skip the status screen after payment completion pub skip_status_screen: Option<bool>, /// Text for customizing message for card terms pub custom_message_for_card_terms: Option<String>, /// Custom background colour for payment link's handle confirm button pub payment_button_colour: Option<String>, /// Custom text colour for payment link's handle confirm button pub payment_button_text_colour: Option<String>, /// Custom background colour for the payment link pub background_colour: Option<String>, /// SDK configuration rules pub sdk_ui_rules: Option<std::collections::HashMap<String, std::collections::HashMap<String, String>>>, /// Payment link configuration rules pub payment_link_ui_rules: Option<std::collections::HashMap<String, std::collections::HashMap<String, String>>>, /// Flag to enable the button only when the payment form is ready for submission pub enable_button_only_on_form_ready: Option<bool>, /// Optional header for the SDK's payment form pub payment_form_header_text: Option<String>, /// Label type in the SDK's payment form pub payment_form_label_type: Option<common_enums::PaymentLinkSdkLabelType>, /// Boolean for controlling whether or not to show the explicit consent for storing cards pub show_card_terms: Option<common_enums::PaymentLinkShowSdkTerms>, /// Boolean to control payment button text for setup mandate calls pub is_setup_mandate_flow: Option<bool>, /// Hex color for the CVC icon during error state pub color_icon_card_cvc_error: Option<String>, } common_utils::impl_to_sql_from_sql_json!(PaymentLinkConfigRequestForPayments); #[derive(Clone, Debug, serde::Deserialize, serde::Serialize, PartialEq)] pub struct PaymentLinkTransactionDetails { /// Key for the transaction details pub key: String, /// Value for the transaction details pub value: String, /// UI configuration for the transaction details pub ui_configuration: Option<TransactionDetailsUiConfiguration>, } common_utils::impl_to_sql_from_sql_json!(PaymentLinkTransactionDetails); #[derive(Clone, Debug, serde::Deserialize, serde::Serialize, PartialEq)] pub struct TransactionDetailsUiConfiguration { /// Position of the key-value pair in the UI pub position: Option<i8>, /// Whether the key should be bold pub is_key_bold: Option<bool>, /// Whether the value should be bold pub is_value_bold: Option<bool>, } common_utils::impl_to_sql_from_sql_json!(TransactionDetailsUiConfiguration); #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, diesel::AsExpression)] #[diesel(sql_type = diesel::sql_types::Jsonb)] pub struct TaxDetails { /// This is the tax related information that is calculated irrespective of any payment method. /// This is calculated when the order is created with shipping details pub default: Option<DefaultTax>, /// This is the tax related information that is calculated based on the payment method /// This is calculated when calling the /calculate_tax API pub payment_method_type: Option<PaymentMethodTypeTax>, } impl TaxDetails { /// Get the tax amount /// If default tax is present, return the default tax amount /// If default tax is not present, return the tax amount based on the payment method if it matches the provided payment method type pub fn get_tax_amount(&self, payment_method: Option<PaymentMethodType>) -> Option<MinorUnit> { self.payment_method_type .as_ref() .zip(payment_method) .filter(|(payment_method_type_tax, payment_method)| { payment_method_type_tax.pmt == *payment_method }) .map(|(payment_method_type_tax, _)| payment_method_type_tax.order_tax_amount) .or_else(|| self.get_default_tax_amount()) } /// Get the default tax amount pub fn get_default_tax_amount(&self) -> Option<MinorUnit> { self.default .as_ref() .map(|default_tax_details| default_tax_details.order_tax_amount) } } common_utils::impl_to_sql_from_sql_json!(TaxDetails); #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct PaymentMethodTypeTax { pub order_tax_amount: MinorUnit, pub pmt: PaymentMethodType, } #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct DefaultTax { pub order_tax_amount: MinorUnit, } #[cfg(feature = "v2")] #[derive( Clone, Debug, PartialEq, Insertable, router_derive::DebugAsDisplay, Serialize, Deserialize, )] #[diesel(table_name = payment_intent)] pub struct PaymentIntentNew { pub merchant_id: common_utils::id_type::MerchantId, pub status: storage_enums::IntentStatus, pub amount: MinorUnit, pub currency: storage_enums::Currency, pub amount_captured: Option<MinorUnit>, pub customer_id: Option<common_utils::id_type::GlobalCustomerId>, pub description: Option<common_utils::types::Description>, pub return_url: Option<common_utils::types::Url>, pub metadata: Option<pii::SecretSerdeValue>, #[serde(with = "common_utils::custom_serde::iso8601")] pub created_at: PrimitiveDateTime, #[serde(with = "common_utils::custom_serde::iso8601")] pub modified_at: PrimitiveDateTime, #[serde(default, with = "common_utils::custom_serde::iso8601::option")] pub last_synced: Option<PrimitiveDateTime>, pub setup_future_usage: Option<storage_enums::FutureUsage>, pub active_attempt_id: Option<common_utils::id_type::GlobalAttemptId>, #[diesel(deserialize_as = super::OptionalDieselArray<masking::Secret<OrderDetailsWithAmount>>)] pub order_details: Option<Vec<masking::Secret<OrderDetailsWithAmount>>>, pub allowed_payment_method_types: Option<pii::SecretSerdeValue>, pub connector_metadata: Option<pii::SecretSerdeValue>, pub feature_metadata: Option<FeatureMetadata>, pub attempt_count: i16, pub profile_id: common_utils::id_type::ProfileId, pub payment_link_id: Option<String>, pub updated_by: String, pub surcharge_applicable: Option<bool>, pub request_incremental_authorization: Option<RequestIncrementalAuthorization>, pub authorization_count: Option<i32>, #[serde(with = "common_utils::custom_serde::iso8601")] pub session_expiry: PrimitiveDateTime, pub request_external_three_ds_authentication: Option<bool>, pub frm_metadata: Option<pii::SecretSerdeValue>, pub customer_details: Option<Encryption>, pub shipping_cost: Option<MinorUnit>, pub organization_id: common_utils::id_type::OrganizationId, pub tax_details: Option<TaxDetails>, pub skip_external_tax_calculation: Option<bool>, pub enable_partial_authorization: Option<EnablePartialAuthorizationBool>, pub split_txns_enabled: Option<common_enums::SplitTxnsEnabled>, pub merchant_reference_id: Option<common_utils::id_type::PaymentReferenceId>, pub billing_address: Option<Encryption>, pub shipping_address: Option<Encryption>, pub capture_method: Option<storage_enums::CaptureMethod>, pub authentication_type: Option<common_enums::AuthenticationType>, pub prerouting_algorithm: Option<serde_json::Value>, pub surcharge_amount: Option<MinorUnit>, pub tax_on_surcharge: Option<MinorUnit>, pub frm_merchant_decision: Option<common_enums::MerchantDecision>, pub statement_descriptor: Option<common_utils::types::StatementDescriptor>, pub enable_payment_link: Option<bool>, pub apply_mit_exemption: Option<bool>, pub id: common_utils::id_type::GlobalPaymentId, pub platform_merchant_id: Option<common_utils::id_type::MerchantId>, pub force_3ds_challenge: Option<bool>, pub force_3ds_challenge_trigger: Option<bool>, pub processor_merchant_id: Option<common_utils::id_type::MerchantId>, pub routing_algorithm_id: Option<common_utils::id_type::RoutingId>, pub created_by: Option<String>, pub is_iframe_redirection_enabled: Option<bool>, pub is_payment_id_from_merchant: Option<bool>, pub payment_channel: Option<common_enums::PaymentChannel>, pub tax_status: Option<common_enums::TaxStatus>, pub discount_amount: Option<MinorUnit>, pub shipping_amount_tax: Option<MinorUnit>, pub duty_amount: Option<MinorUnit>, pub order_date: Option<PrimitiveDateTime>, } #[cfg(feature = "v1")] #[derive( Clone, Debug, PartialEq, Insertable, router_derive::DebugAsDisplay, Serialize, Deserialize, )] #[diesel(table_name = payment_intent)] pub struct PaymentIntentNew { pub payment_id: common_utils::id_type::PaymentId, pub merchant_id: common_utils::id_type::MerchantId, pub status: storage_enums::IntentStatus, pub amount: MinorUnit, pub currency: Option<storage_enums::Currency>, pub amount_captured: Option<MinorUnit>, pub customer_id: Option<common_utils::id_type::CustomerId>, pub description: Option<String>, pub return_url: Option<String>, pub metadata: Option<serde_json::Value>, pub connector_id: Option<String>, pub shipping_address_id: Option<String>, pub billing_address_id: Option<String>, pub statement_descriptor_name: Option<String>, pub statement_descriptor_suffix: Option<String>, #[serde(with = "common_utils::custom_serde::iso8601")] pub created_at: PrimitiveDateTime, #[serde(with = "common_utils::custom_serde::iso8601")] pub modified_at: PrimitiveDateTime, #[serde(default, with = "common_utils::custom_serde::iso8601::option")] pub last_synced: Option<PrimitiveDateTime>, pub setup_future_usage: Option<storage_enums::FutureUsage>, pub off_session: Option<bool>, pub client_secret: Option<String>, pub active_attempt_id: String, pub business_country: Option<storage_enums::CountryAlpha2>, pub business_label: Option<String>, #[diesel(deserialize_as = super::OptionalDieselArray<pii::SecretSerdeValue>)] pub order_details: Option<Vec<pii::SecretSerdeValue>>, pub allowed_payment_method_types: Option<serde_json::Value>, pub connector_metadata: Option<serde_json::Value>, pub feature_metadata: Option<serde_json::Value>, pub attempt_count: i16, pub profile_id: Option<common_utils::id_type::ProfileId>, pub merchant_decision: Option<String>, pub payment_link_id: Option<String>, pub payment_confirm_source: Option<storage_enums::PaymentSource>, pub updated_by: String, pub surcharge_applicable: Option<bool>, pub request_incremental_authorization: Option<RequestIncrementalAuthorization>, pub incremental_authorization_allowed: Option<bool>, pub authorization_count: Option<i32>, #[serde(with = "common_utils::custom_serde::iso8601::option")] pub session_expiry: Option<PrimitiveDateTime>, pub fingerprint_id: Option<String>, pub request_external_three_ds_authentication: Option<bool>, pub charges: Option<pii::SecretSerdeValue>, pub frm_metadata: Option<pii::SecretSerdeValue>, pub customer_details: Option<Encryption>, pub billing_details: Option<Encryption>, pub merchant_order_reference_id: Option<String>, pub shipping_details: Option<Encryption>, pub is_payment_processor_token_flow: Option<bool>, pub shipping_cost: Option<MinorUnit>, pub organization_id: common_utils::id_type::OrganizationId, pub tax_details: Option<TaxDetails>, pub skip_external_tax_calculation: Option<bool>, pub request_extended_authorization: Option<RequestExtendedAuthorizationBool>, pub psd2_sca_exemption_type: Option<storage_enums::ScaExemptionType>, pub split_payments: Option<common_types::payments::SplitPaymentsRequest>, pub platform_merchant_id: Option<common_utils::id_type::MerchantId>, pub force_3ds_challenge: Option<bool>, pub force_3ds_challenge_trigger: Option<bool>, pub processor_merchant_id: Option<common_utils::id_type::MerchantId>, pub created_by: Option<String>, pub is_iframe_redirection_enabled: Option<bool>, pub extended_return_url: Option<String>, pub is_payment_id_from_merchant: Option<bool>, pub payment_channel: Option<common_enums::PaymentChannel>, pub tax_status: Option<common_enums::TaxStatus>, pub discount_amount: Option<MinorUnit>, pub order_date: Option<PrimitiveDateTime>, pub shipping_amount_tax: Option<MinorUnit>, pub duty_amount: Option<MinorUnit>, pub enable_partial_authorization: Option<EnablePartialAuthorizationBool>, pub enable_overcapture: Option<common_types::primitive_wrappers::EnableOvercaptureBool>, } #[cfg(feature = "v2")] #[derive(Debug, Clone, Serialize, Deserialize)] pub enum PaymentIntentUpdate { /// Update the payment intent details on payment intent confirmation, before calling the connector ConfirmIntent { status: storage_enums::IntentStatus, active_attempt_id: common_utils::id_type::GlobalAttemptId, updated_by: String, }, /// Update the payment intent details on payment intent confirmation, after calling the connector ConfirmIntentPostUpdate { status: storage_enums::IntentStatus, amount_captured: Option<MinorUnit>, updated_by: String, }, } #[cfg(feature = "v1")] #[derive(Debug, Clone, Serialize, Deserialize)] pub enum PaymentIntentUpdate { ResponseUpdate { status: storage_enums::IntentStatus, amount_captured: Option<MinorUnit>, fingerprint_id: Option<String>, updated_by: String, incremental_authorization_allowed: Option<bool>, feature_metadata: Option<masking::Secret<serde_json::Value>>, }, MetadataUpdate { metadata: serde_json::Value, updated_by: String, }, Update(Box<PaymentIntentUpdateFields>), PaymentCreateUpdate { return_url: Option<String>, status: Option<storage_enums::IntentStatus>, customer_id: Option<common_utils::id_type::CustomerId>, shipping_address_id: Option<String>, billing_address_id: Option<String>, customer_details: Option<Encryption>, updated_by: String, }, MerchantStatusUpdate { status: storage_enums::IntentStatus, shipping_address_id: Option<String>, billing_address_id: Option<String>, updated_by: String, }, PGStatusUpdate { status: storage_enums::IntentStatus, updated_by: String, incremental_authorization_allowed: Option<bool>, feature_metadata: Option<masking::Secret<serde_json::Value>>, }, PaymentAttemptAndAttemptCountUpdate { active_attempt_id: String, attempt_count: i16, updated_by: String, }, StatusAndAttemptUpdate { status: storage_enums::IntentStatus, active_attempt_id: String, attempt_count: i16, updated_by: String, }, ApproveUpdate { status: storage_enums::IntentStatus, merchant_decision: Option<String>, updated_by: String, }, RejectUpdate { status: storage_enums::IntentStatus, merchant_decision: Option<String>, updated_by: String, }, SurchargeApplicableUpdate { surcharge_applicable: Option<bool>, updated_by: String, }, IncrementalAuthorizationAmountUpdate { amount: MinorUnit, }, AuthorizationCountUpdate { authorization_count: i32, }, CompleteAuthorizeUpdate { shipping_address_id: Option<String>, }, ManualUpdate { status: Option<storage_enums::IntentStatus>, updated_by: String, }, SessionResponseUpdate { tax_details: TaxDetails, shipping_address_id: Option<String>, updated_by: String, shipping_details: Option<Encryption>, }, } #[cfg(feature = "v2")] #[derive(Debug, Clone, Serialize, Deserialize)] pub struct PaymentIntentUpdateFields { pub amount: MinorUnit, pub currency: storage_enums::Currency, pub setup_future_usage: Option<storage_enums::FutureUsage>, pub status: storage_enums::IntentStatus, pub customer_id: Option<common_utils::id_type::CustomerId>, pub shipping_address: Option<Encryption>, pub billing_address: Option<Encryption>, pub return_url: Option<String>, pub description: Option<String>, pub statement_descriptor: Option<String>, pub order_details: Option<Vec<pii::SecretSerdeValue>>, pub metadata: Option<pii::SecretSerdeValue>, pub payment_confirm_source: Option<storage_enums::PaymentSource>, pub updated_by: String, pub session_expiry: Option<PrimitiveDateTime>, pub request_external_three_ds_authentication: Option<bool>, pub frm_metadata: Option<pii::SecretSerdeValue>, pub customer_details: Option<Encryption>, pub merchant_order_reference_id: Option<String>, pub is_payment_processor_token_flow: Option<bool>, pub force_3ds_challenge: Option<bool>, pub is_iframe_redirection_enabled: Option<bool>, pub payment_channel: Option<Option<common_enums::PaymentChannel>>, } #[cfg(feature = "v1")] #[derive(Debug, Clone, Serialize, Deserialize)] pub struct PaymentIntentUpdateFields { pub amount: MinorUnit, pub currency: storage_enums::Currency, pub setup_future_usage: Option<storage_enums::FutureUsage>, pub status: storage_enums::IntentStatus, pub customer_id: Option<common_utils::id_type::CustomerId>, pub shipping_address_id: Option<String>, pub billing_address_id: Option<String>, pub return_url: Option<String>, pub business_country: Option<storage_enums::CountryAlpha2>, pub business_label: Option<String>, pub description: Option<String>, pub statement_descriptor_name: Option<String>, pub statement_descriptor_suffix: Option<String>, pub order_details: Option<Vec<pii::SecretSerdeValue>>, pub metadata: Option<serde_json::Value>, pub payment_confirm_source: Option<storage_enums::PaymentSource>, pub updated_by: String, pub session_expiry: Option<PrimitiveDateTime>, pub fingerprint_id: Option<String>, pub request_external_three_ds_authentication: Option<bool>, pub frm_metadata: Option<pii::SecretSerdeValue>, pub customer_details: Option<Encryption>, pub billing_details: Option<Encryption>, pub merchant_order_reference_id: Option<String>, pub shipping_details: Option<Encryption>, pub is_payment_processor_token_flow: Option<bool>, pub tax_details: Option<TaxDetails>, pub force_3ds_challenge: Option<bool>, pub is_iframe_redirection_enabled: Option<bool>, pub payment_channel: Option<common_enums::PaymentChannel>, pub feature_metadata: Option<masking::Secret<serde_json::Value>>, pub tax_status: Option<common_enums::TaxStatus>, pub discount_amount: Option<MinorUnit>, pub order_date: Option<PrimitiveDateTime>, pub shipping_amount_tax: Option<MinorUnit>, pub duty_amount: Option<MinorUnit>, pub enable_partial_authorization: Option<EnablePartialAuthorizationBool>, pub enable_overcapture: Option<common_types::primitive_wrappers::EnableOvercaptureBool>, } // TODO: uncomment fields as necessary #[cfg(feature = "v2")] #[derive(Clone, Debug, AsChangeset, router_derive::DebugAsDisplay, Serialize, Deserialize)] #[diesel(table_name = payment_intent)] pub struct PaymentIntentUpdateInternal { pub status: Option<storage_enums::IntentStatus>, pub prerouting_algorithm: Option<serde_json::Value>, pub amount_captured: Option<MinorUnit>, pub modified_at: PrimitiveDateTime, pub active_attempt_id: Option<Option<common_utils::id_type::GlobalAttemptId>>, pub amount: Option<MinorUnit>, pub currency: Option<storage_enums::Currency>, pub shipping_cost: Option<MinorUnit>, pub tax_details: Option<TaxDetails>, pub skip_external_tax_calculation: Option<bool>, pub surcharge_applicable: Option<bool>, pub surcharge_amount: Option<MinorUnit>, pub tax_on_surcharge: Option<MinorUnit>, pub routing_algorithm_id: Option<common_utils::id_type::RoutingId>, pub capture_method: Option<common_enums::CaptureMethod>, pub authentication_type: Option<common_enums::AuthenticationType>, pub billing_address: Option<Encryption>, pub shipping_address: Option<Encryption>, pub customer_present: Option<bool>, pub description: Option<common_utils::types::Description>, pub return_url: Option<common_utils::types::Url>, pub setup_future_usage: Option<storage_enums::FutureUsage>, pub apply_mit_exemption: Option<bool>, pub statement_descriptor: Option<common_utils::types::StatementDescriptor>, pub order_details: Option<Vec<masking::Secret<OrderDetailsWithAmount>>>, pub allowed_payment_method_types: Option<pii::SecretSerdeValue>, pub metadata: Option<pii::SecretSerdeValue>, pub connector_metadata: Option<pii::SecretSerdeValue>, pub feature_metadata: Option<FeatureMetadata>, pub payment_link_config: Option<PaymentLinkConfigRequestForPayments>, pub request_incremental_authorization: Option<RequestIncrementalAuthorization>, pub session_expiry: Option<PrimitiveDateTime>, pub frm_metadata: Option<pii::SecretSerdeValue>, pub request_external_three_ds_authentication: Option<bool>, pub updated_by: String, pub force_3ds_challenge: Option<bool>, pub is_iframe_redirection_enabled: Option<bool>, pub enable_partial_authorization: Option<EnablePartialAuthorizationBool>, } #[cfg(feature = "v2")] impl PaymentIntentUpdateInternal { pub fn apply_changeset(self, source: PaymentIntent) -> PaymentIntent { let Self { status, prerouting_algorithm, amount_captured, modified_at: _, // This will be ignored from self active_attempt_id, amount, currency, shipping_cost, tax_details, skip_external_tax_calculation, surcharge_applicable, surcharge_amount, tax_on_surcharge, routing_algorithm_id, capture_method, authentication_type, billing_address, shipping_address, customer_present, description, return_url, setup_future_usage, apply_mit_exemption, statement_descriptor, order_details, allowed_payment_method_types, metadata, connector_metadata, feature_metadata, payment_link_config, request_incremental_authorization, session_expiry, frm_metadata, request_external_three_ds_authentication, updated_by, force_3ds_challenge, is_iframe_redirection_enabled, enable_partial_authorization, } = self; PaymentIntent { status: status.unwrap_or(source.status), prerouting_algorithm: prerouting_algorithm.or(source.prerouting_algorithm), amount_captured: amount_captured.or(source.amount_captured), modified_at: common_utils::date_time::now(), active_attempt_id: match active_attempt_id { Some(v_option) => v_option, None => source.active_attempt_id, }, amount: amount.unwrap_or(source.amount), currency: currency.unwrap_or(source.currency), shipping_cost: shipping_cost.or(source.shipping_cost), tax_details: tax_details.or(source.tax_details), skip_external_tax_calculation: skip_external_tax_calculation .or(source.skip_external_tax_calculation), surcharge_applicable: surcharge_applicable.or(source.surcharge_applicable), surcharge_amount: surcharge_amount.or(source.surcharge_amount), tax_on_surcharge: tax_on_surcharge.or(source.tax_on_surcharge), routing_algorithm_id: routing_algorithm_id.or(source.routing_algorithm_id), capture_method: capture_method.or(source.capture_method), authentication_type: authentication_type.or(source.authentication_type), billing_address: billing_address.or(source.billing_address), shipping_address: shipping_address.or(source.shipping_address), customer_present: customer_present.or(source.customer_present), description: description.or(source.description), return_url: return_url.or(source.return_url), setup_future_usage: setup_future_usage.or(source.setup_future_usage), apply_mit_exemption: apply_mit_exemption.or(source.apply_mit_exemption), statement_descriptor: statement_descriptor.or(source.statement_descriptor), order_details: order_details.or(source.order_details), allowed_payment_method_types: allowed_payment_method_types .or(source.allowed_payment_method_types), metadata: metadata.or(source.metadata), connector_metadata: connector_metadata.or(source.connector_metadata), feature_metadata: feature_metadata.or(source.feature_metadata), payment_link_config: payment_link_config.or(source.payment_link_config), request_incremental_authorization: request_incremental_authorization .or(source.request_incremental_authorization), session_expiry: session_expiry.unwrap_or(source.session_expiry), frm_metadata: frm_metadata.or(source.frm_metadata), request_external_three_ds_authentication: request_external_three_ds_authentication .or(source.request_external_three_ds_authentication), updated_by, force_3ds_challenge: force_3ds_challenge.or(source.force_3ds_challenge), is_iframe_redirection_enabled: is_iframe_redirection_enabled .or(source.is_iframe_redirection_enabled), // Fields from source merchant_id: source.merchant_id, customer_id: source.customer_id,
crates/diesel_models/src/payment_intent.rs#chunk0
diesel_models
chunk
null
null
null
8,192
null
null
null
null
null
null
null
// Implementation: impl VerifyConnectorData // File: crates/router/src/types/api/verify_connector.rs // Module: router // Methods: 2 total (0 public) impl VerifyConnectorData
crates/router/src/types/api/verify_connector.rs
router
impl_block
null
null
null
40
null
VerifyConnectorData
null
2
0
null
null
// Struct: NexinetsPaymentsMetadata // File: crates/hyperswitch_connectors/src/connectors/nexinets/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct NexinetsPaymentsMetadata
crates/hyperswitch_connectors/src/connectors/nexinets/transformers.rs
hyperswitch_connectors
struct_definition
NexinetsPaymentsMetadata
0
[]
53
null
null
null
null
null
null
null
// Implementation: impl api::PaymentCapture for for Bambora // File: crates/hyperswitch_connectors/src/connectors/bambora.rs // Module: hyperswitch_connectors // Methods: 0 total (0 public) impl api::PaymentCapture for for Bambora
crates/hyperswitch_connectors/src/connectors/bambora.rs
hyperswitch_connectors
impl_block
null
null
null
60
null
Bambora
api::PaymentCapture for
0
0
null
null
// Implementation: impl api::MandateSetup for for Gpayments // File: crates/hyperswitch_connectors/src/connectors/gpayments.rs // Module: hyperswitch_connectors // Methods: 0 total (0 public) impl api::MandateSetup for for Gpayments
crates/hyperswitch_connectors/src/connectors/gpayments.rs
hyperswitch_connectors
impl_block
null
null
null
61
null
Gpayments
api::MandateSetup for
0
0
null
null
// Implementation: impl GetPaymentMethodType for for MobilePaymentData // File: crates/hyperswitch_domain_models/src/payment_method_data.rs // Module: hyperswitch_domain_models // Methods: 1 total (0 public) impl GetPaymentMethodType for for MobilePaymentData
crates/hyperswitch_domain_models/src/payment_method_data.rs
hyperswitch_domain_models
impl_block
null
null
null
58
null
MobilePaymentData
GetPaymentMethodType for
1
0
null
null
// Function: payments_list_by_filter // File: crates/router/src/routes/payments.rs // Module: router pub fn payments_list_by_filter( state: web::Data<app::AppState>, req: actix_web::HttpRequest, payload: web::Json<payment_types::PaymentListFilterConstraints>, ) -> impl Responder
crates/router/src/routes/payments.rs
router
function_signature
null
null
null
71
payments_list_by_filter
null
null
null
null
null
null
// Implementation: impl api::RefundSync for for Square // File: crates/hyperswitch_connectors/src/connectors/square.rs // Module: hyperswitch_connectors // Methods: 0 total (0 public) impl api::RefundSync for for Square
crates/hyperswitch_connectors/src/connectors/square.rs
hyperswitch_connectors
impl_block
null
null
null
57
null
Square
api::RefundSync for
0
0
null
null
// Implementation: impl api::Payment for for Iatapay // File: crates/hyperswitch_connectors/src/connectors/iatapay.rs // Module: hyperswitch_connectors // Methods: 0 total (0 public) impl api::Payment for for Iatapay
crates/hyperswitch_connectors/src/connectors/iatapay.rs
hyperswitch_connectors
impl_block
null
null
null
61
null
Iatapay
api::Payment for
0
0
null
null
// Function: get_total_amount // File: crates/hyperswitch_domain_models/src/payments/payment_attempt.rs // Module: hyperswitch_domain_models pub fn get_total_amount(&self) -> MinorUnit
crates/hyperswitch_domain_models/src/payments/payment_attempt.rs
hyperswitch_domain_models
function_signature
null
null
null
43
get_total_amount
null
null
null
null
null
null
// File: crates/router/src/types/storage/fraud_check.rs // Module: router pub use diesel_models::fraud_check::{ FraudCheck, FraudCheckNew, FraudCheckUpdate, FraudCheckUpdateInternal, };
crates/router/src/types/storage/fraud_check.rs
router
full_file
null
null
null
45
null
null
null
null
null
null
null