text
stringlengths
65
57.3k
file_path
stringlengths
22
92
module
stringclasses
38 values
type
stringclasses
7 values
struct_name
stringlengths
3
60
impl_count
int64
0
60
traits
listlengths
0
59
tokens
int64
16
8.19k
function_name
stringlengths
3
85
type_name
stringlengths
1
67
trait_name
stringclasses
573 values
method_count
int64
0
31
public_method_count
int64
0
19
submodule_count
int64
0
56
export_count
int64
0
9
// Function: contract_based_routing_update_configs // File: crates/router/src/routes/routing.rs // Module: router pub fn contract_based_routing_update_configs( state: web::Data<AppState>, req: HttpRequest, path: web::Path<routing_types::DynamicRoutingUpdateConfigQuery>, json_payload: web::Json<routing_types::ContractBasedRoutingConfig>, ) -> impl Responder
crates/router/src/routes/routing.rs
router
function_signature
null
null
null
84
contract_based_routing_update_configs
null
null
null
null
null
null
// Implementation: impl api::PayoutFulfill for for Nuvei // File: crates/hyperswitch_connectors/src/connectors/nuvei.rs // Module: hyperswitch_connectors // Methods: 0 total (0 public) impl api::PayoutFulfill for for Nuvei
crates/hyperswitch_connectors/src/connectors/nuvei.rs
hyperswitch_connectors
impl_block
null
null
null
65
null
Nuvei
api::PayoutFulfill for
0
0
null
null
// Struct: TransientBatchDecryptDataRequest // File: crates/common_utils/src/types/keymanager.rs // Module: common_utils // Implementations: 0 pub struct TransientBatchDecryptDataRequest
crates/common_utils/src/types/keymanager.rs
common_utils
struct_definition
TransientBatchDecryptDataRequest
0
[]
43
null
null
null
null
null
null
null
// Struct: PaymentMethodData // File: crates/router/src/compatibility/stripe/customers/types.rs // Module: router // Implementations: 0 pub struct PaymentMethodData
crates/router/src/compatibility/stripe/customers/types.rs
router
struct_definition
PaymentMethodData
0
[]
40
null
null
null
null
null
null
null
// Struct: CancelPaymentData // File: crates/hyperswitch_connectors/src/connectors/getnet/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct CancelPaymentData
crates/hyperswitch_connectors/src/connectors/getnet/transformers.rs
hyperswitch_connectors
struct_definition
CancelPaymentData
0
[]
47
null
null
null
null
null
null
null
// Function: get_total_charged_amount // File: crates/router/src/core/payments/types.rs // Module: router pub fn get_total_charged_amount(&self) -> common_types::MinorUnit
crates/router/src/core/payments/types.rs
router
function_signature
null
null
null
42
get_total_charged_amount
null
null
null
null
null
null
// Implementation: impl GetLockingInput for for FPaymentsApproveRequest // File: crates/router/src/routes/payments.rs // Module: router // Methods: 1 total (0 public) impl GetLockingInput for for FPaymentsApproveRequest
crates/router/src/routes/payments.rs
router
impl_block
null
null
null
54
null
FPaymentsApproveRequest
GetLockingInput for
1
0
null
null
// File: crates/hyperswitch_connectors/src/connectors/cashtocode.rs // Module: hyperswitch_connectors // Public functions: 1 // Public structs: 1 pub mod transformers; use std::sync::LazyLock; use base64::Engine; use common_enums::enums; use common_utils::{ errors::CustomResult, ext_traits::ByteSliceExt, request::{Method, Request, RequestBuilder, RequestContent}, types::{AmountConvertor, FloatMajorUnit, FloatMajorUnitForConnector}, }; use error_stack::ResultExt; use hyperswitch_domain_models::{ api::ApplicationResponse, router_data::{AccessToken, ErrorResponse, RouterData}, router_flow_types::{ access_token_auth::AccessTokenAuth, payments::{Authorize, Capture, PSync, PaymentMethodToken, Session, SetupMandate, Void}, refunds::{Execute, RSync}, }, router_request_types::{ AccessTokenRequestData, PaymentMethodTokenizationData, PaymentsAuthorizeData, PaymentsCancelData, PaymentsCaptureData, PaymentsSessionData, PaymentsSyncData, RefundsData, SetupMandateRequestData, }, router_response_types::{ ConnectorInfo, PaymentMethodDetails, PaymentsResponseData, RefundsResponseData, SupportedPaymentMethods, SupportedPaymentMethodsExt, }, types::{PaymentsAuthorizeRouterData, PaymentsSyncRouterData}, }; use hyperswitch_interfaces::{ api::{ self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorSpecifications, ConnectorValidation, }, configs::Connectors, errors, events::connector_api_logs::ConnectorEvent, types::{PaymentsAuthorizeType, Response}, webhooks::{self, IncomingWebhookFlowError}, }; use masking::{Mask, PeekInterface, Secret}; use transformers as cashtocode; use crate::{constants::headers, types::ResponseRouterData, utils}; #[derive(Clone)] pub struct Cashtocode { amount_converter: &'static (dyn AmountConvertor<Output = FloatMajorUnit> + Sync), } impl Cashtocode { pub fn new() -> &'static Self { &Self { amount_converter: &FloatMajorUnitForConnector, } } } impl api::Payment for Cashtocode {} impl api::PaymentSession for Cashtocode {} impl api::ConnectorAccessToken for Cashtocode {} impl api::MandateSetup for Cashtocode {} impl api::PaymentAuthorize for Cashtocode {} impl api::PaymentSync for Cashtocode {} impl api::PaymentCapture for Cashtocode {} impl api::PaymentVoid for Cashtocode {} impl api::PaymentToken for Cashtocode {} impl api::Refund for Cashtocode {} impl api::RefundExecute for Cashtocode {} impl api::RefundSync for Cashtocode {} fn get_b64_auth_cashtocode( payment_method_type: Option<enums::PaymentMethodType>, auth_type: &transformers::CashtocodeAuth, ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> { fn construct_basic_auth( username: Option<Secret<String>>, password: Option<Secret<String>>, ) -> Result<masking::Maskable<String>, errors::ConnectorError> { let username = username.ok_or(errors::ConnectorError::FailedToObtainAuthType)?; let password = password.ok_or(errors::ConnectorError::FailedToObtainAuthType)?; Ok(format!( "Basic {}", base64::engine::general_purpose::STANDARD.encode(format!( "{}:{}", username.peek(), password.peek() )) ) .into_masked()) } let auth_header = match payment_method_type { Some(enums::PaymentMethodType::ClassicReward) => construct_basic_auth( auth_type.username_classic.to_owned(), auth_type.password_classic.to_owned(), ), Some(enums::PaymentMethodType::Evoucher) => construct_basic_auth( auth_type.username_evoucher.to_owned(), auth_type.password_evoucher.to_owned(), ), _ => return Err(errors::ConnectorError::MissingPaymentMethodType)?, }?; Ok(vec![(headers::AUTHORIZATION.to_string(), auth_header)]) } impl ConnectorIntegration<PaymentMethodToken, PaymentMethodTokenizationData, PaymentsResponseData> for Cashtocode { // Not Implemented (R) } impl<Flow, Request, Response> ConnectorCommonExt<Flow, Request, Response> for Cashtocode where Self: ConnectorIntegration<Flow, Request, Response> { } impl ConnectorCommon for Cashtocode { fn id(&self) -> &'static str { "cashtocode" } fn common_get_content_type(&self) -> &'static str { "application/json" } fn base_url<'a>(&self, connectors: &'a Connectors) -> &'a str { connectors.cashtocode.base_url.as_ref() } fn build_error_response( &self, res: Response, event_builder: Option<&mut ConnectorEvent>, ) -> CustomResult<ErrorResponse, errors::ConnectorError> { let response: cashtocode::CashtocodeErrorResponse = res .response .parse_struct("CashtocodeErrorResponse") .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; event_builder.map(|i| i.set_error_response_body(&response)); router_env::logger::info!(connector_response=?response); Ok(ErrorResponse { status_code: res.status_code, code: response.error.to_string(), message: response.error_description.clone(), reason: Some(response.error_description), attempt_status: None, connector_transaction_id: None, network_advice_code: None, network_decline_code: None, network_error_message: None, connector_metadata: None, }) } } impl ConnectorValidation for Cashtocode {} impl ConnectorIntegration<Session, PaymentsSessionData, PaymentsResponseData> for Cashtocode { //TODO: implement sessions flow } impl ConnectorIntegration<AccessTokenAuth, AccessTokenRequestData, AccessToken> for Cashtocode {} impl ConnectorIntegration<SetupMandate, SetupMandateRequestData, PaymentsResponseData> for Cashtocode { fn build_request( &self, _req: &RouterData<SetupMandate, SetupMandateRequestData, PaymentsResponseData>, _connectors: &Connectors, ) -> CustomResult<Option<Request>, errors::ConnectorError> { Err( errors::ConnectorError::NotImplemented("Setup Mandate flow for Cashtocode".to_string()) .into(), ) } } impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData> for Cashtocode { fn get_headers( &self, req: &PaymentsAuthorizeRouterData, _connectors: &Connectors, ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> { let mut header = vec![( headers::CONTENT_TYPE.to_string(), PaymentsAuthorizeType::get_content_type(self) .to_owned() .into(), )]; let auth_type = transformers::CashtocodeAuth::try_from(( &req.connector_auth_type, &req.request.currency, ))?; let mut api_key = get_b64_auth_cashtocode(req.request.payment_method_type, &auth_type)?; header.append(&mut api_key); Ok(header) } fn get_content_type(&self) -> &'static str { self.common_get_content_type() } fn get_url( &self, _req: &PaymentsAuthorizeRouterData, connectors: &Connectors, ) -> CustomResult<String, errors::ConnectorError> { Ok(format!( "{}/merchant/paytokens", connectors.cashtocode.base_url )) } fn get_request_body( &self, req: &PaymentsAuthorizeRouterData, _connectors: &Connectors, ) -> CustomResult<RequestContent, errors::ConnectorError> { let amount = utils::convert_amount( self.amount_converter, req.request.minor_amount, req.request.currency, )?; let connector_req = cashtocode::CashtocodePaymentsRequest::try_from((req, amount))?; Ok(RequestContent::Json(Box::new(connector_req))) } fn build_request( &self, req: &PaymentsAuthorizeRouterData, connectors: &Connectors, ) -> CustomResult<Option<Request>, errors::ConnectorError> { Ok(Some( RequestBuilder::new() .method(Method::Post) .url(&PaymentsAuthorizeType::get_url(self, req, connectors)?) .attach_default_headers() .headers(PaymentsAuthorizeType::get_headers(self, req, connectors)?) .set_body(PaymentsAuthorizeType::get_request_body( self, req, connectors, )?) .build(), )) } fn handle_response( &self, data: &PaymentsAuthorizeRouterData, event_builder: Option<&mut ConnectorEvent>, res: Response, ) -> CustomResult<PaymentsAuthorizeRouterData, errors::ConnectorError> { let response: cashtocode::CashtocodePaymentsResponse = res .response .parse_struct("Cashtocode PaymentsAuthorizeResponse") .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; event_builder.map(|i| i.set_response_body(&response)); router_env::logger::info!(connector_response=?response); RouterData::try_from(ResponseRouterData { response, data: data.clone(), http_code: res.status_code, }) } fn get_error_response( &self, res: Response, event_builder: Option<&mut ConnectorEvent>, ) -> CustomResult<ErrorResponse, errors::ConnectorError> { self.build_error_response(res, event_builder) } } impl ConnectorIntegration<PSync, PaymentsSyncData, PaymentsResponseData> for Cashtocode { // default implementation of build_request method will be executed fn handle_response( &self, data: &PaymentsSyncRouterData, event_builder: Option<&mut ConnectorEvent>, res: Response, ) -> CustomResult<PaymentsSyncRouterData, errors::ConnectorError> { let response: transformers::CashtocodePaymentsSyncResponse = res .response .parse_struct("CashtocodePaymentsSyncResponse") .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; event_builder.map(|i| i.set_response_body(&response)); router_env::logger::info!(connector_response=?response); RouterData::try_from(ResponseRouterData { response, data: data.clone(), http_code: res.status_code, }) } fn get_error_response( &self, res: Response, event_builder: Option<&mut ConnectorEvent>, ) -> CustomResult<ErrorResponse, errors::ConnectorError> { self.build_error_response(res, event_builder) } } impl ConnectorIntegration<Capture, PaymentsCaptureData, PaymentsResponseData> for Cashtocode { fn build_request( &self, _req: &RouterData<Capture, PaymentsCaptureData, PaymentsResponseData>, _connectors: &Connectors, ) -> CustomResult<Option<Request>, errors::ConnectorError> { Err(errors::ConnectorError::FlowNotSupported { flow: "Capture".to_string(), connector: "Cashtocode".to_string(), } .into()) } } impl ConnectorIntegration<Void, PaymentsCancelData, PaymentsResponseData> for Cashtocode { fn build_request( &self, _req: &RouterData<Void, PaymentsCancelData, PaymentsResponseData>, _connectors: &Connectors, ) -> CustomResult<Option<Request>, errors::ConnectorError> { Err(errors::ConnectorError::FlowNotSupported { flow: "Payments Cancel".to_string(), connector: "Cashtocode".to_string(), } .into()) } } #[async_trait::async_trait] impl webhooks::IncomingWebhook for Cashtocode { fn get_webhook_source_verification_signature( &self, request: &webhooks::IncomingWebhookRequestDetails<'_>, _connector_webhook_secrets: &api_models::webhooks::ConnectorWebhookSecrets, ) -> CustomResult<Vec<u8>, errors::ConnectorError> { let base64_signature = utils::get_header_key_value("authorization", request.headers)?; let signature = base64_signature.as_bytes().to_owned(); Ok(signature) } 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: common_utils::crypto::Encryptable<Secret<serde_json::Value>>, connector_label: &str, ) -> CustomResult<bool, errors::ConnectorError> { 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 secret_auth = String::from_utf8(connector_webhook_secrets.secret.to_vec()) .change_context(errors::ConnectorError::WebhookSourceVerificationFailed) .attach_printable("Could not convert secret to UTF-8")?; let signature_auth = String::from_utf8(signature.to_vec()) .change_context(errors::ConnectorError::WebhookSourceVerificationFailed) .attach_printable("Could not convert secret to UTF-8")?; Ok(signature_auth == secret_auth) } fn get_webhook_object_reference_id( &self, request: &webhooks::IncomingWebhookRequestDetails<'_>, ) -> CustomResult<api_models::webhooks::ObjectReferenceId, errors::ConnectorError> { let webhook: transformers::CashtocodePaymentsSyncResponse = request .body .parse_struct("CashtocodePaymentsSyncResponse") .change_context(errors::ConnectorError::WebhookReferenceIdNotFound)?; Ok(api_models::webhooks::ObjectReferenceId::PaymentId( api_models::payments::PaymentIdType::ConnectorTransactionId(webhook.transaction_id), )) } fn get_webhook_event_type( &self, _request: &webhooks::IncomingWebhookRequestDetails<'_>, ) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> { Ok(api_models::webhooks::IncomingWebhookEvent::PaymentIntentSuccess) } fn get_webhook_resource_object( &self, request: &webhooks::IncomingWebhookRequestDetails<'_>, ) -> CustomResult<Box<dyn masking::ErasedMaskSerialize>, errors::ConnectorError> { let webhook: transformers::CashtocodeIncomingWebhook = request .body .parse_struct("CashtocodeIncomingWebhook") .change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?; Ok(Box::new(webhook)) } fn get_webhook_api_response( &self, request: &webhooks::IncomingWebhookRequestDetails<'_>, _error_kind: Option<IncomingWebhookFlowError>, ) -> CustomResult<ApplicationResponse<serde_json::Value>, errors::ConnectorError> { let status = "EXECUTED".to_string(); let obj: transformers::CashtocodePaymentsSyncResponse = request .body .parse_struct("CashtocodePaymentsSyncResponse") .change_context(errors::ConnectorError::WebhookReferenceIdNotFound)?; let response: serde_json::Value = serde_json::json!({ "status": status, "transactionId" : obj.transaction_id}); Ok(ApplicationResponse::Json(response)) } } impl ConnectorIntegration<Execute, RefundsData, RefundsResponseData> for Cashtocode { fn build_request( &self, _req: &RouterData<Execute, RefundsData, RefundsResponseData>, _connectors: &Connectors, ) -> CustomResult<Option<Request>, errors::ConnectorError> { Err(errors::ConnectorError::FlowNotSupported { flow: "Refunds".to_string(), connector: "Cashtocode".to_string(), } .into()) } } impl ConnectorIntegration<RSync, RefundsData, RefundsResponseData> for Cashtocode { // default implementation of build_request method will be executed } static CASHTOCODE_SUPPORTED_PAYMENT_METHODS: LazyLock<SupportedPaymentMethods> = LazyLock::new(|| { let supported_capture_methods = vec![ enums::CaptureMethod::Automatic, enums::CaptureMethod::Manual, enums::CaptureMethod::SequentialAutomatic, ]; let mut cashtocode_supported_payment_methods = SupportedPaymentMethods::new(); cashtocode_supported_payment_methods.add( enums::PaymentMethod::Reward, enums::PaymentMethodType::ClassicReward, PaymentMethodDetails { mandates: enums::FeatureStatus::NotSupported, refunds: enums::FeatureStatus::NotSupported, supported_capture_methods: supported_capture_methods.clone(), specific_features: None, }, ); cashtocode_supported_payment_methods.add( enums::PaymentMethod::Reward, enums::PaymentMethodType::Evoucher, PaymentMethodDetails { mandates: enums::FeatureStatus::NotSupported, refunds: enums::FeatureStatus::NotSupported, supported_capture_methods: supported_capture_methods.clone(), specific_features: None, }, ); cashtocode_supported_payment_methods }); static CASHTOCODE_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { display_name: "CashToCode", description: "CashToCode is a payment solution that enables users to convert cash into digital vouchers for online transactions", connector_type: enums::HyperswitchConnectorCategory::PaymentGateway, integration_status: enums::ConnectorIntegrationStatus::Live, }; static CASHTOCODE_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 1] = [enums::EventClass::Payments]; impl ConnectorSpecifications for Cashtocode { fn get_connector_about(&self) -> Option<&'static ConnectorInfo> { Some(&CASHTOCODE_CONNECTOR_INFO) } fn get_supported_payment_methods(&self) -> Option<&'static SupportedPaymentMethods> { Some(&*CASHTOCODE_SUPPORTED_PAYMENT_METHODS) } fn get_supported_webhook_flows(&self) -> Option<&'static [enums::EventClass]> { Some(&CASHTOCODE_SUPPORTED_WEBHOOK_FLOWS) } }
crates/hyperswitch_connectors/src/connectors/cashtocode.rs
hyperswitch_connectors
full_file
null
null
null
4,058
null
null
null
null
null
null
null
// Implementation: impl ConnectorValidation for for Payload // File: crates/hyperswitch_connectors/src/connectors/payload.rs // Module: hyperswitch_connectors // Methods: 1 total (0 public) impl ConnectorValidation for for Payload
crates/hyperswitch_connectors/src/connectors/payload.rs
hyperswitch_connectors
impl_block
null
null
null
51
null
Payload
ConnectorValidation for
1
0
null
null
// Implementation: impl RefundSync for for Plaid // File: crates/hyperswitch_connectors/src/connectors/plaid.rs // Module: hyperswitch_connectors // Methods: 0 total (0 public) impl RefundSync for for Plaid
crates/hyperswitch_connectors/src/connectors/plaid.rs
hyperswitch_connectors
impl_block
null
null
null
55
null
Plaid
RefundSync for
0
0
null
null
// Struct: ConnectorResponseData // File: crates/hyperswitch_domain_models/src/router_data.rs // Module: hyperswitch_domain_models // Implementations: 1 pub struct ConnectorResponseData
crates/hyperswitch_domain_models/src/router_data.rs
hyperswitch_domain_models
struct_definition
ConnectorResponseData
1
[]
42
null
null
null
null
null
null
null
// Implementation: impl api::MandateSetup for for Blackhawknetwork // File: crates/hyperswitch_connectors/src/connectors/blackhawknetwork.rs // Module: hyperswitch_connectors // Methods: 0 total (0 public) impl api::MandateSetup for for Blackhawknetwork
crates/hyperswitch_connectors/src/connectors/blackhawknetwork.rs
hyperswitch_connectors
impl_block
null
null
null
64
null
Blackhawknetwork
api::MandateSetup for
0
0
null
null
// Struct: WorldpayEventResponse // File: crates/hyperswitch_connectors/src/connectors/worldpay/response.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct WorldpayEventResponse
crates/hyperswitch_connectors/src/connectors/worldpay/response.rs
hyperswitch_connectors
struct_definition
WorldpayEventResponse
0
[]
47
null
null
null
null
null
null
null
// Struct: InputData // File: crates/hyperswitch_connectors/src/connectors/braintree/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct InputData
crates/hyperswitch_connectors/src/connectors/braintree/transformers.rs
hyperswitch_connectors
struct_definition
InputData
0
[]
46
null
null
null
null
null
null
null
// Struct: SignifydAuthType // File: crates/hyperswitch_connectors/src/connectors/signifyd/transformers/auth.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct SignifydAuthType
crates/hyperswitch_connectors/src/connectors/signifyd/transformers/auth.rs
hyperswitch_connectors
struct_definition
SignifydAuthType
0
[]
53
null
null
null
null
null
null
null
// File: crates/hyperswitch_connectors/src/connectors/razorpay.rs // Module: hyperswitch_connectors // Public functions: 1 // Public structs: 1 pub mod transformers; use base64::Engine; use common_enums::enums; use common_utils::{ errors::CustomResult, ext_traits::BytesExt, request::{Method, Request, RequestBuilder, RequestContent}, types::{AmountConvertor, MinorUnit, MinorUnitForConnector}, }; use error_stack::{report, Report, ResultExt}; use hyperswitch_domain_models::{ payment_method_data::PaymentMethodData, router_data::{AccessToken, ConnectorAuthType, ErrorResponse, RouterData}, router_flow_types::{ access_token_auth::AccessTokenAuth, payments::{ Authorize, Capture, CreateOrder, PSync, PaymentMethodToken, Session, SetupMandate, Void, }, refunds::{Execute, RSync}, }, router_request_types::{ AccessTokenRequestData, CreateOrderRequestData, PaymentMethodTokenizationData, PaymentsAuthorizeData, PaymentsCancelData, PaymentsCaptureData, PaymentsSessionData, PaymentsSyncData, RefundsData, SetupMandateRequestData, }, router_response_types::{ ConnectorInfo, PaymentMethodDetails, PaymentsResponseData, RefundsResponseData, SupportedPaymentMethods, SupportedPaymentMethodsExt, }, types::{ CreateOrderRouterData, PaymentsAuthorizeRouterData, PaymentsCaptureRouterData, PaymentsSyncRouterData, RefundSyncRouterData, RefundsRouterData, }, }; use hyperswitch_interfaces::{ api::{ self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorSpecifications, ConnectorValidation, }, configs::Connectors, consts::NO_ERROR_CODE, errors, events::connector_api_logs::ConnectorEvent, types::{self, CreateOrderType, Response}, webhooks::{IncomingWebhook, IncomingWebhookRequestDetails}, }; use lazy_static::lazy_static; use masking::{Mask, Maskable, PeekInterface}; use router_env::logger; use transformers as razorpay; use crate::{ constants::headers, types::ResponseRouterData, utils::{convert_amount, handle_json_response_deserialization_failure}, }; #[derive(Clone)] pub struct Razorpay { amount_converter: &'static (dyn AmountConvertor<Output = MinorUnit> + Sync), } impl Razorpay { pub fn new() -> &'static Self { &Self { amount_converter: &MinorUnitForConnector, } } } impl api::Payment for Razorpay {} impl api::PaymentSession for Razorpay {} impl api::ConnectorAccessToken for Razorpay {} impl api::MandateSetup for Razorpay {} impl api::PaymentAuthorize for Razorpay {} impl api::PaymentSync for Razorpay {} impl api::PaymentCapture for Razorpay {} impl api::PaymentVoid for Razorpay {} impl api::Refund for Razorpay {} impl api::RefundExecute for Razorpay {} impl api::RefundSync for Razorpay {} impl api::PaymentToken for Razorpay {} impl ConnectorIntegration<PaymentMethodToken, PaymentMethodTokenizationData, PaymentsResponseData> for Razorpay { // Not Implemented (R) } impl<Flow, Request, Response> ConnectorCommonExt<Flow, Request, Response> for Razorpay where Self: ConnectorIntegration<Flow, Request, Response>, { fn build_headers( &self, req: &RouterData<Flow, Request, Response>, _connectors: &Connectors, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { let mut header = vec![( headers::CONTENT_TYPE.to_string(), "application/json".to_string().into(), )]; let mut api_key = self.get_auth_header(&req.connector_auth_type)?; header.append(&mut api_key); Ok(header) } } impl ConnectorCommon for Razorpay { fn id(&self) -> &'static str { "razorpay" } fn get_currency_unit(&self) -> api::CurrencyUnit { api::CurrencyUnit::Base } fn common_get_content_type(&self) -> &'static str { "application/json" } fn base_url<'a>(&self, connectors: &'a Connectors) -> &'a str { connectors.razorpay.base_url.as_ref() } fn get_auth_header( &self, auth_type: &ConnectorAuthType, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { let auth = razorpay::RazorpayAuthType::try_from(auth_type) .change_context(errors::ConnectorError::FailedToObtainAuthType)?; let encoded_api_key = common_utils::consts::BASE64_ENGINE.encode(format!( "{}:{}", auth.razorpay_id.peek(), auth.razorpay_secret.peek() )); Ok(vec![( headers::AUTHORIZATION.to_string(), format!("Basic {encoded_api_key}").into_masked(), )]) } fn build_error_response( &self, res: Response, event_builder: Option<&mut ConnectorEvent>, ) -> CustomResult<ErrorResponse, errors::ConnectorError> { let response: Result<razorpay::ErrorResponse, Report<common_utils::errors::ParsingError>> = res.response.parse_struct("Razorpay ErrorResponse"); match response { Ok(response_data) => { event_builder.map(|i| i.set_error_response_body(&response_data)); router_env::logger::info!(connector_response=?response_data); match response_data { razorpay::ErrorResponse::RazorpayErrorResponse(error_response) => { Ok(ErrorResponse { status_code: res.status_code, code: error_response.error.code, message: error_response.error.description, reason: error_response.error.reason, attempt_status: None, connector_transaction_id: None, network_advice_code: None, network_decline_code: None, network_error_message: None, connector_metadata: None, }) } razorpay::ErrorResponse::RazorpayError(error_response) => Ok(ErrorResponse { status_code: res.status_code, code: error_response.message.clone(), message: error_response.message.clone(), reason: Some(error_response.message), attempt_status: None, connector_transaction_id: None, network_advice_code: None, network_decline_code: None, network_error_message: None, connector_metadata: None, }), razorpay::ErrorResponse::RazorpayStringError(error_string) => { Ok(ErrorResponse { status_code: res.status_code, code: NO_ERROR_CODE.to_string(), message: error_string.clone(), reason: Some(error_string.clone()), attempt_status: None, connector_transaction_id: None, network_advice_code: None, network_decline_code: None, network_error_message: None, connector_metadata: None, }) } } } Err(error_msg) => { event_builder.map(|event| event.set_error(serde_json::json!({"error": res.response.escape_ascii().to_string(), "status_code": res.status_code}))); logger::error!(deserialization_error =? error_msg); handle_json_response_deserialization_failure(res, "razorpay") } } } } impl ConnectorValidation for Razorpay { //TODO: implement functions when support enabled } impl ConnectorIntegration<Session, PaymentsSessionData, PaymentsResponseData> for Razorpay { //TODO: implement sessions flow } impl ConnectorIntegration<AccessTokenAuth, AccessTokenRequestData, AccessToken> for Razorpay {} impl ConnectorIntegration<SetupMandate, SetupMandateRequestData, PaymentsResponseData> for Razorpay { } impl api::PaymentsCreateOrder for Razorpay {} impl ConnectorIntegration<CreateOrder, CreateOrderRequestData, PaymentsResponseData> for Razorpay { fn get_headers( &self, req: &CreateOrderRouterData, connectors: &Connectors, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { self.build_headers(req, connectors) } fn get_content_type(&self) -> &'static str { self.common_get_content_type() } fn get_url( &self, _req: &CreateOrderRouterData, connectors: &Connectors, ) -> CustomResult<String, errors::ConnectorError> { Ok(format!("{}v1/orders", self.base_url(connectors))) } fn get_request_body( &self, req: &CreateOrderRouterData, _connectors: &Connectors, ) -> CustomResult<RequestContent, errors::ConnectorError> { let minor_amount = req.request.minor_amount; let currency = req.request.currency; let amount = convert_amount(self.amount_converter, minor_amount, currency)?; let connector_router_data = razorpay::RazorpayRouterData::try_from((amount, req))?; let connector_req = razorpay::RazorpayOrderRequest::try_from(&connector_router_data)?; Ok(RequestContent::Json(Box::new(connector_req))) } fn build_request( &self, req: &CreateOrderRouterData, connectors: &Connectors, ) -> CustomResult<Option<Request>, errors::ConnectorError> { let req = Some( RequestBuilder::new() .method(Method::Post) .attach_default_headers() .headers(CreateOrderType::get_headers(self, req, connectors)?) .url(&CreateOrderType::get_url(self, req, connectors)?) .set_body(CreateOrderType::get_request_body(self, req, connectors)?) .build(), ); Ok(req) } fn handle_response( &self, data: &CreateOrderRouterData, event_builder: Option<&mut ConnectorEvent>, res: Response, ) -> CustomResult<CreateOrderRouterData, errors::ConnectorError> { let response: razorpay::RazorpayOrderResponse = res .response .parse_struct("RazorpayOrderResponse") .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; event_builder.map(|i| i.set_response_body(&response)); router_env::logger::info!(connector_response=?response); RouterData::try_from(ResponseRouterData { response, data: data.clone(), http_code: res.status_code, }) } fn get_error_response( &self, res: Response, event_builder: Option<&mut ConnectorEvent>, ) -> CustomResult<ErrorResponse, errors::ConnectorError> { self.build_error_response(res, event_builder) } } impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData> for Razorpay { fn get_headers( &self, req: &PaymentsAuthorizeRouterData, connectors: &Connectors, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { self.build_headers(req, connectors) } fn get_content_type(&self) -> &'static str { self.common_get_content_type() } fn get_url( &self, _req: &PaymentsAuthorizeRouterData, connectors: &Connectors, ) -> CustomResult<String, errors::ConnectorError> { match _req.request.payment_method_data { PaymentMethodData::Upi(_) => Ok(format!( "{}v1/payments/create/upi", self.base_url(connectors) )), _ => Err(errors::ConnectorError::NotImplemented( "Payment method not implemented for Razorpay".to_string(), ) .into()), } } fn get_request_body( &self, req: &PaymentsAuthorizeRouterData, _connectors: &Connectors, ) -> CustomResult<RequestContent, errors::ConnectorError> { let amount = convert_amount( self.amount_converter, req.request.minor_amount, req.request.currency, )?; let connector_router_data = razorpay::RazorpayRouterData::try_from((amount, req))?; let connector_req = razorpay::RazorpayPaymentsRequest::try_from(&connector_router_data)?; Ok(RequestContent::Json(Box::new(connector_req))) } fn build_request( &self, req: &PaymentsAuthorizeRouterData, connectors: &Connectors, ) -> CustomResult<Option<Request>, errors::ConnectorError> { Ok(Some( RequestBuilder::new() .method(Method::Post) .url(&types::PaymentsAuthorizeType::get_url( self, req, connectors, )?) .attach_default_headers() .headers(types::PaymentsAuthorizeType::get_headers( self, req, connectors, )?) .set_body(types::PaymentsAuthorizeType::get_request_body( self, req, connectors, )?) .build(), )) } fn handle_response( &self, data: &PaymentsAuthorizeRouterData, event_builder: Option<&mut ConnectorEvent>, res: Response, ) -> CustomResult<PaymentsAuthorizeRouterData, errors::ConnectorError> { let response: razorpay::RazorpayPaymentsResponse = res .response .parse_struct("Razorpay PaymentsAuthorizeResponse") .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; event_builder.map(|i| i.set_response_body(&response)); router_env::logger::info!(connector_response=?response); RouterData::try_from(ResponseRouterData { response, data: data.clone(), http_code: res.status_code, }) } fn get_error_response( &self, res: Response, event_builder: Option<&mut ConnectorEvent>, ) -> CustomResult<ErrorResponse, errors::ConnectorError> { self.build_error_response(res, event_builder) } } impl ConnectorIntegration<PSync, PaymentsSyncData, PaymentsResponseData> for Razorpay { fn get_headers( &self, req: &PaymentsSyncRouterData, connectors: &Connectors, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { self.build_headers(req, connectors) } fn get_content_type(&self) -> &'static str { self.common_get_content_type() } fn get_url( &self, req: &PaymentsSyncRouterData, connectors: &Connectors, ) -> CustomResult<String, errors::ConnectorError> { let order_id = req .request .connector_reference_id .clone() .ok_or(errors::ConnectorError::RequestEncodingFailed)?; Ok(format!( "{}v1/orders/{}/payments", self.base_url(connectors), order_id, )) } fn build_request( &self, req: &PaymentsSyncRouterData, connectors: &Connectors, ) -> CustomResult<Option<Request>, errors::ConnectorError> { let request = RequestBuilder::new() .method(Method::Get) .url(&types::PaymentsSyncType::get_url(self, req, connectors)?) .attach_default_headers() .headers(types::PaymentsSyncType::get_headers(self, req, connectors)?) .set_body(types::PaymentsSyncType::get_request_body( self, req, connectors, )?) .build(); Ok(Some(request)) } fn handle_response( &self, data: &PaymentsSyncRouterData, event_builder: Option<&mut ConnectorEvent>, res: Response, ) -> CustomResult<PaymentsSyncRouterData, errors::ConnectorError> { let response: razorpay::RazorpaySyncResponse = res .response .parse_struct("razorpay PaymentsSyncResponse") .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; event_builder.map(|i| i.set_response_body(&response)); router_env::logger::info!(connector_response=?response); RouterData::try_from(ResponseRouterData { response, data: data.clone(), http_code: res.status_code, }) } fn get_error_response( &self, res: Response, event_builder: Option<&mut ConnectorEvent>, ) -> CustomResult<ErrorResponse, errors::ConnectorError> { self.build_error_response(res, event_builder) } } impl ConnectorIntegration<Capture, PaymentsCaptureData, PaymentsResponseData> for Razorpay { fn get_headers( &self, req: &PaymentsCaptureRouterData, connectors: &Connectors, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { self.build_headers(req, connectors) } fn get_content_type(&self) -> &'static str { self.common_get_content_type() } fn get_url( &self, _req: &PaymentsCaptureRouterData, _connectors: &Connectors, ) -> CustomResult<String, errors::ConnectorError> { Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into()) } fn get_request_body( &self, _req: &PaymentsCaptureRouterData, _connectors: &Connectors, ) -> CustomResult<RequestContent, errors::ConnectorError> { Err(errors::ConnectorError::NotImplemented("get_request_body method".to_string()).into()) } fn build_request( &self, req: &PaymentsCaptureRouterData, connectors: &Connectors, ) -> CustomResult<Option<Request>, errors::ConnectorError> { Ok(Some( RequestBuilder::new() .method(Method::Post) .url(&types::PaymentsCaptureType::get_url(self, req, connectors)?) .attach_default_headers() .headers(types::PaymentsCaptureType::get_headers( self, req, connectors, )?) .set_body(types::PaymentsCaptureType::get_request_body( self, req, connectors, )?) .build(), )) } fn handle_response( &self, _data: &PaymentsCaptureRouterData, _event_builder: Option<&mut ConnectorEvent>, _res: Response, ) -> CustomResult<PaymentsCaptureRouterData, errors::ConnectorError> { Err(errors::ConnectorError::NotImplemented("get_request_body method".to_string()).into()) } fn get_error_response( &self, res: Response, event_builder: Option<&mut ConnectorEvent>, ) -> CustomResult<ErrorResponse, errors::ConnectorError> { self.build_error_response(res, event_builder) } } impl ConnectorIntegration<Void, PaymentsCancelData, PaymentsResponseData> for Razorpay {} impl ConnectorIntegration<Execute, RefundsData, RefundsResponseData> for Razorpay { fn get_headers( &self, req: &RefundsRouterData<Execute>, connectors: &Connectors, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { self.build_headers(req, connectors) } fn get_content_type(&self) -> &'static str { self.common_get_content_type() } fn get_url( &self, req: &RefundsRouterData<Execute>, connectors: &Connectors, ) -> CustomResult<String, errors::ConnectorError> { Ok(format!( "{}v1/payments/{}/refund", self.base_url(connectors), req.request.connector_transaction_id, )) } fn get_request_body( &self, req: &RefundsRouterData<Execute>, _connectors: &Connectors, ) -> CustomResult<RequestContent, errors::ConnectorError> { let amount = convert_amount( self.amount_converter, req.request.minor_refund_amount, req.request.currency, )?; let connector_router_data = razorpay::RazorpayRouterData::try_from((amount, req))?; let connector_req = razorpay::RazorpayRefundRequest::try_from(&connector_router_data)?; Ok(RequestContent::Json(Box::new(connector_req))) } fn build_request( &self, req: &RefundsRouterData<Execute>, connectors: &Connectors, ) -> CustomResult<Option<Request>, errors::ConnectorError> { let request = RequestBuilder::new() .method(Method::Post) .url(&types::RefundExecuteType::get_url(self, req, connectors)?) .attach_default_headers() .headers(types::RefundExecuteType::get_headers( self, req, connectors, )?) .set_body(types::RefundExecuteType::get_request_body( self, req, connectors, )?) .build(); Ok(Some(request)) } fn handle_response( &self, data: &RefundsRouterData<Execute>, event_builder: Option<&mut ConnectorEvent>, res: Response, ) -> CustomResult<RefundsRouterData<Execute>, errors::ConnectorError> { let response: razorpay::RazorpayRefundResponse = res .response .parse_struct("razorpay RazorpayRefundResponse") .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; event_builder.map(|i| i.set_response_body(&response)); router_env::logger::info!(connector_response=?response); RouterData::try_from(ResponseRouterData { response, data: data.clone(), http_code: res.status_code, }) } fn get_error_response( &self, res: Response, event_builder: Option<&mut ConnectorEvent>, ) -> CustomResult<ErrorResponse, errors::ConnectorError> { self.build_error_response(res, event_builder) } } impl ConnectorIntegration<RSync, RefundsData, RefundsResponseData> for Razorpay { fn get_headers( &self, req: &RefundSyncRouterData, connectors: &Connectors, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { self.build_headers(req, connectors) } fn get_content_type(&self) -> &'static str { self.common_get_content_type() } fn get_url( &self, req: &RefundSyncRouterData, connectors: &Connectors, ) -> CustomResult<String, errors::ConnectorError> { let refund_id = req .request .connector_refund_id .to_owned() .ok_or(errors::ConnectorError::MissingConnectorRefundID)?; Ok(format!( "{}v1/payments/{}/refunds/{}", self.base_url(connectors), req.request.connector_transaction_id, refund_id )) } fn build_request( &self, req: &RefundSyncRouterData, connectors: &Connectors, ) -> CustomResult<Option<Request>, errors::ConnectorError> { Ok(Some( RequestBuilder::new() .method(Method::Get) .url(&types::RefundSyncType::get_url(self, req, connectors)?) .attach_default_headers() .headers(types::RefundSyncType::get_headers(self, req, connectors)?) .set_body(types::RefundSyncType::get_request_body( self, req, connectors, )?) .build(), )) } fn handle_response( &self, data: &RefundSyncRouterData, event_builder: Option<&mut ConnectorEvent>, res: Response, ) -> CustomResult<RefundSyncRouterData, errors::ConnectorError> { let response: razorpay::RazorpayRefundResponse = res .response .parse_struct("razorpay RazorpayRefundResponse") .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) } } // This code can be used later when Razorpay webhooks are implemented // #[async_trait::async_trait] // impl IncomingWebhook for Razorpay { // fn get_webhook_object_reference_id( // &self, // request: &IncomingWebhookRequestDetails<'_>, // ) -> CustomResult<webhooks::ObjectReferenceId, errors::ConnectorError> { // let webhook_resource_object: razorpay::RazorpayWebhookPayload = request // .body // .parse_struct("RazorpayWebhookPayload") // .change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?; // match webhook_resource_object.payload.refund { // Some(refund_data) => Ok(webhooks::ObjectReferenceId::RefundId( // webhooks::RefundIdType::ConnectorRefundId(refund_data.entity.id), // )), // None => Ok(webhooks::ObjectReferenceId::PaymentId( // api_models::payments::PaymentIdType::ConnectorTransactionId( // webhook_resource_object.payload.payment.entity.id, // ), // )), // } // } // async fn verify_webhook_source( // &self, // _request: &IncomingWebhookRequestDetails<'_>, // _merchant_id: &common_utils::id_type::MerchantId, // _connector_webhook_details: Option<common_utils::pii::SecretSerdeValue>, // _connector_account_details: common_utils::crypto::Encryptable< // masking::Secret<serde_json::Value>, // >, // _connector_label: &str, // ) -> CustomResult<bool, errors::ConnectorError> { // Ok(false) // } // fn get_webhook_event_type( // &self, // request: &IncomingWebhookRequestDetails<'_>, // ) -> CustomResult<IncomingWebhookEvent, errors::ConnectorError> { // let payload: razorpay::RazorpayWebhookEventType = request // .body // .parse_struct("RazorpayWebhookEventType") // .change_context(errors::ConnectorError::WebhookEventTypeNotFound)?; // Ok(IncomingWebhookEvent::try_from(payload)?) // } // fn get_webhook_resource_object( // &self, // request: &IncomingWebhookRequestDetails<'_>, // ) -> CustomResult<Box<dyn masking::ErasedMaskSerialize>, errors::ConnectorError> { // let details: razorpay::RazorpayWebhookPayload = request // .body // .parse_struct("RazorpayWebhookPayload") // .change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?; // Ok(Box::new(details)) // } // } #[async_trait::async_trait] impl IncomingWebhook for Razorpay { fn get_webhook_object_reference_id( &self, _request: &IncomingWebhookRequestDetails<'_>, ) -> CustomResult<api_models::webhooks::ObjectReferenceId, errors::ConnectorError> { Err(report!(errors::ConnectorError::WebhooksNotImplemented)) } fn get_webhook_event_type( &self, _request: &IncomingWebhookRequestDetails<'_>, ) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> { Ok(api_models::webhooks::IncomingWebhookEvent::EventNotSupported) } fn get_webhook_resource_object( &self, _request: &IncomingWebhookRequestDetails<'_>, ) -> CustomResult<Box<dyn masking::ErasedMaskSerialize>, errors::ConnectorError> { Err(report!(errors::ConnectorError::WebhooksNotImplemented)) } } lazy_static! { static ref RAZORPAY_SUPPORTED_PAYMENT_METHODS: SupportedPaymentMethods = { let supported_capture_methods = vec![enums::CaptureMethod::Automatic]; let mut razorpay_supported_payment_methods = SupportedPaymentMethods::new(); razorpay_supported_payment_methods.add( enums::PaymentMethod::Upi, enums::PaymentMethodType::UpiCollect, PaymentMethodDetails{ mandates: common_enums::FeatureStatus::NotSupported, refunds: common_enums::FeatureStatus::Supported, supported_capture_methods, specific_features: None, }, ); razorpay_supported_payment_methods }; static ref RAZORPAY_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo { display_name: "RAZORPAY", description: "Razorpay helps you accept online payments from customers across Desktop, Mobile web, Android & iOS. Additionally by using Razorpay Payment Links, you can collect payments across multiple channels like SMS, Email, Whatsapp, Chatbots & Messenger.", connector_type: enums::HyperswitchConnectorCategory::PaymentGateway, integration_status: enums::ConnectorIntegrationStatus::Sandbox, }; static ref RAZORPAY_SUPPORTED_WEBHOOK_FLOWS: Vec<enums::EventClass> = vec![enums::EventClass::Payments, enums::EventClass::Refunds]; } impl ConnectorSpecifications for Razorpay { fn get_connector_about(&self) -> Option<&'static ConnectorInfo> { Some(&*RAZORPAY_CONNECTOR_INFO) } fn get_supported_payment_methods(&self) -> Option<&'static SupportedPaymentMethods> { Some(&*RAZORPAY_SUPPORTED_PAYMENT_METHODS) } fn get_supported_webhook_flows(&self) -> Option<&'static [enums::EventClass]> { Some(&*RAZORPAY_SUPPORTED_WEBHOOK_FLOWS) } #[cfg(feature = "v2")] fn generate_connector_request_reference_id( &self, payment_intent: &hyperswitch_domain_models::payments::PaymentIntent, _payment_attempt: &hyperswitch_domain_models::payments::payment_attempt::PaymentAttempt, ) -> String { // The length of receipt for Razorpay order request should not exceed 40 characters. payment_intent .merchant_reference_id .as_ref() .map(|id| id.get_string_repr().to_owned()) .unwrap_or_else(|| uuid::Uuid::now_v7().to_string()) } }
crates/hyperswitch_connectors/src/connectors/razorpay.rs
hyperswitch_connectors
full_file
null
null
null
6,545
null
null
null
null
null
null
null
// Struct: ClientAuthSetupInfoResponse // File: crates/hyperswitch_connectors/src/connectors/barclaycard/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct ClientAuthSetupInfoResponse
crates/hyperswitch_connectors/src/connectors/barclaycard/transformers.rs
hyperswitch_connectors
struct_definition
ClientAuthSetupInfoResponse
0
[]
53
null
null
null
null
null
null
null
// Implementation: impl api::ConnectorAccessToken for for Silverflow // File: crates/hyperswitch_connectors/src/connectors/silverflow.rs // Module: hyperswitch_connectors // Methods: 0 total (0 public) impl api::ConnectorAccessToken for for Silverflow
crates/hyperswitch_connectors/src/connectors/silverflow.rs
hyperswitch_connectors
impl_block
null
null
null
58
null
Silverflow
api::ConnectorAccessToken for
0
0
null
null
// Struct: InespayAuthType // File: crates/hyperswitch_connectors/src/connectors/inespay/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct InespayAuthType
crates/hyperswitch_connectors/src/connectors/inespay/transformers.rs
hyperswitch_connectors
struct_definition
InespayAuthType
0
[]
52
null
null
null
null
null
null
null
// Struct: FacilitapayVoidResponse // File: crates/hyperswitch_connectors/src/connectors/facilitapay/responses.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct FacilitapayVoidResponse
crates/hyperswitch_connectors/src/connectors/facilitapay/responses.rs
hyperswitch_connectors
struct_definition
FacilitapayVoidResponse
0
[]
55
null
null
null
null
null
null
null
// Struct: MerchantConnectorId // File: crates/api_models/src/admin.rs // Module: api_models // Implementations: 0 pub struct MerchantConnectorId
crates/api_models/src/admin.rs
api_models
struct_definition
MerchantConnectorId
0
[]
35
null
null
null
null
null
null
null
// Implementation: impl api::RefundSync for for Santander // File: crates/hyperswitch_connectors/src/connectors/santander.rs // Module: hyperswitch_connectors // Methods: 0 total (0 public) impl api::RefundSync for for Santander
crates/hyperswitch_connectors/src/connectors/santander.rs
hyperswitch_connectors
impl_block
null
null
null
60
null
Santander
api::RefundSync for
0
0
null
null
// Implementation: impl Encryption // File: crates/common_utils/src/encryption.rs // Module: common_utils // Methods: 3 total (3 public) impl Encryption
crates/common_utils/src/encryption.rs
common_utils
impl_block
null
null
null
35
null
Encryption
null
3
3
null
null
// File: crates/router/tests/connectors/billwerk.rs // Module: router use masking::Secret; use router::types::{self, domain, storage::enums}; use test_utils::connector_auth; use crate::utils::{self, ConnectorActions}; #[derive(Clone, Copy)] struct BillwerkTest; impl ConnectorActions for BillwerkTest {} impl utils::Connector for BillwerkTest { fn get_data(&self) -> types::api::ConnectorData { use router::connector::Billwerk; utils::construct_connector_data_old( Box::new(Billwerk::new()), // Added as Dummy connector as template code is added for future usage types::Connector::DummyConnector1, types::api::GetToken::Connector, None, ) } fn get_auth_token(&self) -> types::ConnectorAuthType { utils::to_connector_auth_type( connector_auth::ConnectorAuthentication::new() .billwerk .expect("Missing connector authentication configuration") .into(), ) } fn get_name(&self) -> String { "billwerk".to_string() } } static CONNECTOR: BillwerkTest = BillwerkTest {}; 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: domain::PaymentMethodData::Card(domain::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: domain::PaymentMethodData::Card(domain::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: domain::PaymentMethodData::Card(domain::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/billwerk.rs
router
full_file
null
null
null
2,948
null
null
null
null
null
null
null
// Function: reset_password_token_only_flow // File: crates/router/src/core/user.rs // Module: router pub fn reset_password_token_only_flow( state: SessionState, user_token: auth::UserFromSinglePurposeToken, request: user_api::ResetPasswordRequest, ) -> UserResponse<()>
crates/router/src/core/user.rs
router
function_signature
null
null
null
65
reset_password_token_only_flow
null
null
null
null
null
null
// Implementation: impl api::Payouts for for Wise // File: crates/hyperswitch_connectors/src/connectors/wise.rs // Module: hyperswitch_connectors // Methods: 0 total (0 public) impl api::Payouts for for Wise
crates/hyperswitch_connectors/src/connectors/wise.rs
hyperswitch_connectors
impl_block
null
null
null
57
null
Wise
api::Payouts for
0
0
null
null
// Struct: AuthenticationErrorInformation // File: crates/hyperswitch_connectors/src/connectors/bankofamerica/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct AuthenticationErrorInformation
crates/hyperswitch_connectors/src/connectors/bankofamerica/transformers.rs
hyperswitch_connectors
struct_definition
AuthenticationErrorInformation
0
[]
50
null
null
null
null
null
null
null
// Struct: NetworkTokenErrorInfo // File: crates/router/src/types/payment_methods.rs // Module: router // Implementations: 0 pub struct NetworkTokenErrorInfo
crates/router/src/types/payment_methods.rs
router
struct_definition
NetworkTokenErrorInfo
0
[]
37
null
null
null
null
null
null
null
// Struct: PayoutsMandateReferenceRecord // File: crates/api_models/src/payment_methods.rs // Module: api_models // Implementations: 0 pub struct PayoutsMandateReferenceRecord
crates/api_models/src/payment_methods.rs
api_models
struct_definition
PayoutsMandateReferenceRecord
0
[]
46
null
null
null
null
null
null
null
// Struct: Event // File: crates/hyperswitch_connectors/src/connectors/coinbase/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct Event
crates/hyperswitch_connectors/src/connectors/coinbase/transformers.rs
hyperswitch_connectors
struct_definition
Event
0
[]
44
null
null
null
null
null
null
null
// Function: recovery_incoming_webhook_flow // File: crates/router/src/core/webhooks/recovery_incoming.rs // Module: router pub fn recovery_incoming_webhook_flow( state: SessionState, merchant_context: domain::MerchantContext, business_profile: domain::Profile, source_verified: bool, connector_enum: &connector_integration_interface::ConnectorEnum, billing_connector_account: hyperswitch_domain_models::merchant_connector_account::MerchantConnectorAccount, connector_name: &str, request_details: &hyperswitch_interfaces::webhooks::IncomingWebhookRequestDetails<'_>, event_type: webhooks::IncomingWebhookEvent, req_state: ReqState, object_ref_id: &webhooks::ObjectReferenceId, ) -> CustomResult<webhooks::WebhookResponseTracker, errors::RevenueRecoveryError>
crates/router/src/core/webhooks/recovery_incoming.rs
router
function_signature
null
null
null
178
recovery_incoming_webhook_flow
null
null
null
null
null
null
// Implementation: impl api::PaymentVoid for for UnifiedAuthenticationService // File: crates/hyperswitch_connectors/src/connectors/unified_authentication_service.rs // Module: hyperswitch_connectors // Methods: 0 total (0 public) impl api::PaymentVoid for for UnifiedAuthenticationService
crates/hyperswitch_connectors/src/connectors/unified_authentication_service.rs
hyperswitch_connectors
impl_block
null
null
null
61
null
UnifiedAuthenticationService
api::PaymentVoid for
0
0
null
null
// Implementation: impl ProxyRequestWrapper // File: crates/router/src/core/proxy/utils.rs // Module: router // Methods: 4 total (3 public) impl ProxyRequestWrapper
crates/router/src/core/proxy/utils.rs
router
impl_block
null
null
null
39
null
ProxyRequestWrapper
null
4
3
null
null
// Struct: NuveiPayoutSuccessResponse // File: crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct NuveiPayoutSuccessResponse
crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs
hyperswitch_connectors
struct_definition
NuveiPayoutSuccessResponse
0
[]
57
null
null
null
null
null
null
null
// Implementation: impl Default for for VaultResponseData // File: crates/hyperswitch_domain_models/src/router_response_types.rs // Module: hyperswitch_domain_models // Methods: 1 total (0 public) impl Default for for VaultResponseData
crates/hyperswitch_domain_models/src/router_response_types.rs
hyperswitch_domain_models
impl_block
null
null
null
52
null
VaultResponseData
Default for
1
0
null
null
// Function: api_key_update // File: crates/router/src/routes/api_keys.rs // Module: router pub fn api_key_update( state: web::Data<AppState>, req: HttpRequest, key_id: web::Path<common_utils::id_type::ApiKeyId>, json_payload: web::Json<api_types::UpdateApiKeyRequest>, ) -> impl Responder
crates/router/src/routes/api_keys.rs
router
function_signature
null
null
null
80
api_key_update
null
null
null
null
null
null
// Trait: RelayInterface // File: crates/router/src/core/relay.rs // Module: router pub trait RelayInterface
crates/router/src/core/relay.rs
router
trait_definition
null
null
null
26
null
null
RelayInterface
null
null
null
null
// Implementation: impl GrpcClientSettings // File: crates/external_services/src/grpc_client.rs // Module: external_services // Methods: 1 total (0 public) impl GrpcClientSettings
crates/external_services/src/grpc_client.rs
external_services
impl_block
null
null
null
42
null
GrpcClientSettings
null
1
0
null
null
// Struct: CybersourceNotAvailableErrorResponse // File: crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct CybersourceNotAvailableErrorResponse
crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs
hyperswitch_connectors
struct_definition
CybersourceNotAvailableErrorResponse
0
[]
55
null
null
null
null
null
null
null
// Struct: Shipments // File: crates/hyperswitch_connectors/src/connectors/signifyd/transformers/api.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct Shipments
crates/hyperswitch_connectors/src/connectors/signifyd/transformers/api.rs
hyperswitch_connectors
struct_definition
Shipments
0
[]
47
null
null
null
null
null
null
null
// Function: perform_health_check // File: crates/external_services/src/grpc_client/health_check_client.rs // Module: external_services // Documentation: Perform health check for all services involved pub fn perform_health_check( &self, config: &GrpcClientSettings, ) -> HealthCheckResult<HealthCheckMap>
crates/external_services/src/grpc_client/health_check_client.rs
external_services
function_signature
null
null
null
70
perform_health_check
null
null
null
null
null
null
// File: crates/router/src/services/kafka/authentication_event.rs // Module: router // Public functions: 1 // Public structs: 1 use diesel_models::{authentication::Authentication, enums as storage_enums}; use time::OffsetDateTime; #[serde_with::skip_serializing_none] #[derive(serde::Serialize, Debug)] pub struct KafkaAuthenticationEvent<'a> { pub authentication_id: &'a common_utils::id_type::AuthenticationId, pub merchant_id: &'a common_utils::id_type::MerchantId, pub authentication_connector: Option<&'a String>, pub connector_authentication_id: Option<&'a String>, pub authentication_data: Option<serde_json::Value>, pub payment_method_id: &'a String, pub authentication_type: Option<storage_enums::DecoupledAuthenticationType>, pub authentication_status: storage_enums::AuthenticationStatus, pub authentication_lifecycle_status: storage_enums::AuthenticationLifecycleStatus, #[serde(default, with = "time::serde::timestamp::milliseconds")] pub created_at: OffsetDateTime, #[serde(default, with = "time::serde::timestamp::milliseconds")] pub modified_at: OffsetDateTime, pub error_message: Option<&'a String>, pub error_code: Option<&'a String>, pub connector_metadata: Option<serde_json::Value>, pub maximum_supported_version: Option<common_utils::types::SemanticVersion>, pub threeds_server_transaction_id: Option<&'a String>, pub cavv: Option<&'a String>, pub authentication_flow_type: Option<&'a String>, pub message_version: Option<common_utils::types::SemanticVersion>, pub eci: Option<&'a String>, pub trans_status: Option<storage_enums::TransactionStatus>, pub acquirer_bin: Option<&'a String>, pub acquirer_merchant_id: Option<&'a String>, pub three_ds_method_data: Option<&'a String>, pub three_ds_method_url: Option<&'a String>, pub acs_url: Option<&'a String>, pub challenge_request: Option<&'a String>, pub acs_reference_number: Option<&'a String>, pub acs_trans_id: Option<&'a String>, pub acs_signed_content: Option<&'a String>, pub profile_id: &'a common_utils::id_type::ProfileId, pub payment_id: Option<&'a common_utils::id_type::PaymentId>, pub merchant_connector_id: Option<&'a common_utils::id_type::MerchantConnectorAccountId>, pub ds_trans_id: Option<&'a String>, pub directory_server_id: Option<&'a String>, pub acquirer_country_code: Option<&'a String>, pub organization_id: &'a common_utils::id_type::OrganizationId, } impl<'a> KafkaAuthenticationEvent<'a> { pub fn from_storage(authentication: &'a Authentication) -> Self { Self { created_at: authentication.created_at.assume_utc(), modified_at: authentication.modified_at.assume_utc(), authentication_id: &authentication.authentication_id, merchant_id: &authentication.merchant_id, authentication_status: authentication.authentication_status, authentication_connector: authentication.authentication_connector.as_ref(), connector_authentication_id: authentication.connector_authentication_id.as_ref(), authentication_data: authentication.authentication_data.clone(), payment_method_id: &authentication.payment_method_id, authentication_type: authentication.authentication_type, authentication_lifecycle_status: authentication.authentication_lifecycle_status, error_code: authentication.error_code.as_ref(), error_message: authentication.error_message.as_ref(), connector_metadata: authentication.connector_metadata.clone(), maximum_supported_version: authentication.maximum_supported_version.clone(), threeds_server_transaction_id: authentication.threeds_server_transaction_id.as_ref(), cavv: authentication.cavv.as_ref(), authentication_flow_type: authentication.authentication_flow_type.as_ref(), message_version: authentication.message_version.clone(), eci: authentication.eci.as_ref(), trans_status: authentication.trans_status.clone(), acquirer_bin: authentication.acquirer_bin.as_ref(), acquirer_merchant_id: authentication.acquirer_merchant_id.as_ref(), three_ds_method_data: authentication.three_ds_method_data.as_ref(), three_ds_method_url: authentication.three_ds_method_url.as_ref(), acs_url: authentication.acs_url.as_ref(), challenge_request: authentication.challenge_request.as_ref(), acs_reference_number: authentication.acs_reference_number.as_ref(), acs_trans_id: authentication.acs_trans_id.as_ref(), acs_signed_content: authentication.acs_signed_content.as_ref(), profile_id: &authentication.profile_id, payment_id: authentication.payment_id.as_ref(), merchant_connector_id: authentication.merchant_connector_id.as_ref(), ds_trans_id: authentication.ds_trans_id.as_ref(), directory_server_id: authentication.directory_server_id.as_ref(), acquirer_country_code: authentication.acquirer_country_code.as_ref(), organization_id: &authentication.organization_id, } } } impl super::KafkaMessage for KafkaAuthenticationEvent<'_> { fn key(&self) -> String { format!( "{}_{}", self.merchant_id.get_string_repr(), self.authentication_id.get_string_repr() ) } fn event_type(&self) -> crate::events::EventType { crate::events::EventType::Authentication } }
crates/router/src/services/kafka/authentication_event.rs
router
full_file
null
null
null
1,131
null
null
null
null
null
null
null
// Implementation: impl api::Payment for for Digitalvirgo // File: crates/hyperswitch_connectors/src/connectors/digitalvirgo.rs // Module: hyperswitch_connectors // Methods: 0 total (0 public) impl api::Payment for for Digitalvirgo
crates/hyperswitch_connectors/src/connectors/digitalvirgo.rs
hyperswitch_connectors
impl_block
null
null
null
59
null
Digitalvirgo
api::Payment for
0
0
null
null
// Struct: ItaubankErrorResponse // File: crates/hyperswitch_connectors/src/connectors/itaubank/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct ItaubankErrorResponse
crates/hyperswitch_connectors/src/connectors/itaubank/transformers.rs
hyperswitch_connectors
struct_definition
ItaubankErrorResponse
0
[]
51
null
null
null
null
null
null
null
// Struct: CybersourceConsumerAuthInformationRequest // File: crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct CybersourceConsumerAuthInformationRequest
crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs
hyperswitch_connectors
struct_definition
CybersourceConsumerAuthInformationRequest
0
[]
57
null
null
null
null
null
null
null
// Function: get_id_type_by_key_from_headers // File: crates/router/src/services/authentication.rs // Module: router pub fn get_id_type_by_key_from_headers<T: FromStr>( key: String, headers: &HeaderMap, ) -> RouterResult<Option<T>>
crates/router/src/services/authentication.rs
router
function_signature
null
null
null
59
get_id_type_by_key_from_headers
null
null
null
null
null
null
// File: crates/common_utils/src/id_type/customer.rs // Module: common_utils crate::id_type!( CustomerId, "A type for customer_id that can be used for customer ids" ); crate::impl_id_type_methods!(CustomerId, "customer_id"); // This is to display the `CustomerId` as CustomerId(abcd) crate::impl_debug_id_type!(CustomerId); crate::impl_default_id_type!(CustomerId, "cus"); crate::impl_try_from_cow_str_id_type!(CustomerId, "customer_id"); crate::impl_generate_id_id_type!(CustomerId, "cus"); crate::impl_serializable_secret_id_type!(CustomerId); crate::impl_queryable_id_type!(CustomerId); crate::impl_to_sql_from_sql_id_type!(CustomerId); #[cfg(feature = "v1")] impl crate::events::ApiEventMetric for CustomerId { fn get_api_event_type(&self) -> Option<crate::events::ApiEventsType> { Some(crate::events::ApiEventsType::Customer { customer_id: self.clone(), }) } }
crates/common_utils/src/id_type/customer.rs
common_utils
full_file
null
null
null
220
null
null
null
null
null
null
null
// Struct: GlobalpayWebhookObjectId // File: crates/hyperswitch_connectors/src/connectors/globalpay/response.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct GlobalpayWebhookObjectId
crates/hyperswitch_connectors/src/connectors/globalpay/response.rs
hyperswitch_connectors
struct_definition
GlobalpayWebhookObjectId
0
[]
49
null
null
null
null
null
null
null
// Function: new // File: crates/common_types/src/payments.rs // Module: common_types // Documentation: Creates a new `MerchantCountryCode` instance from a string. pub fn new(country_code: String) -> Self
crates/common_types/src/payments.rs
common_types
function_signature
null
null
null
48
new
null
null
null
null
null
null
// Implementation: impl Default for for RevenueRecoveryPaymentProcessTrackerMapping // File: crates/scheduler/src/consumer/types/process_data.rs // Module: scheduler // Methods: 1 total (0 public) impl Default for for RevenueRecoveryPaymentProcessTrackerMapping
crates/scheduler/src/consumer/types/process_data.rs
scheduler
impl_block
null
null
null
55
null
RevenueRecoveryPaymentProcessTrackerMapping
Default for
1
0
null
null
// Struct: CardExpirationYear // File: crates/cards/src/lib.rs // Module: cards // Implementations: 2 // Traits: Deref pub struct CardExpirationYear
crates/cards/src/lib.rs
cards
struct_definition
CardExpirationYear
2
[ "Deref" ]
39
null
null
null
null
null
null
null
// Implementation: impl webhooks::IncomingWebhook for for Hyperwallet // File: crates/hyperswitch_connectors/src/connectors/hyperwallet.rs // Module: hyperswitch_connectors // Methods: 3 total (0 public) impl webhooks::IncomingWebhook for for Hyperwallet
crates/hyperswitch_connectors/src/connectors/hyperwallet.rs
hyperswitch_connectors
impl_block
null
null
null
62
null
Hyperwallet
webhooks::IncomingWebhook for
3
0
null
null
// Function: mock_delete_card_hs // File: crates/router/src/core/payment_methods/cards.rs // Module: router pub fn mock_delete_card_hs<'a>( db: &dyn db::StorageInterface, card_id: &'a str, ) -> errors::CustomResult<payment_methods::DeleteCardResp, errors::VaultError>
crates/router/src/core/payment_methods/cards.rs
router
function_signature
null
null
null
71
mock_delete_card_hs
null
null
null
null
null
null
// Struct: PaymentProcessedAmount // File: crates/api_models/src/analytics/payments.rs // Module: api_models // Implementations: 0 pub struct PaymentProcessedAmount
crates/api_models/src/analytics/payments.rs
api_models
struct_definition
PaymentProcessedAmount
0
[]
38
null
null
null
null
null
null
null
// Struct: BatchEncryptDataResponse // File: crates/common_utils/src/types/keymanager.rs // Module: common_utils // Implementations: 0 pub struct BatchEncryptDataResponse
crates/common_utils/src/types/keymanager.rs
common_utils
struct_definition
BatchEncryptDataResponse
0
[]
39
null
null
null
null
null
null
null
// Function: find_by_profile_name_merchant_id // File: crates/diesel_models/src/query/business_profile.rs // Module: diesel_models pub fn find_by_profile_name_merchant_id( conn: &PgPooledConn, profile_name: &str, merchant_id: &common_utils::id_type::MerchantId, ) -> StorageResult<Self>
crates/diesel_models/src/query/business_profile.rs
diesel_models
function_signature
null
null
null
77
find_by_profile_name_merchant_id
null
null
null
null
null
null
// Implementation: impl api::Refund for for Tsys // File: crates/hyperswitch_connectors/src/connectors/tsys.rs // Module: hyperswitch_connectors // Methods: 0 total (0 public) impl api::Refund for for Tsys
crates/hyperswitch_connectors/src/connectors/tsys.rs
hyperswitch_connectors
impl_block
null
null
null
57
null
Tsys
api::Refund for
0
0
null
null
// Implementation: impl scheduler::SchedulerAppState for for AppState // File: crates/router/src/routes/app.rs // Module: router // Methods: 1 total (0 public) impl scheduler::SchedulerAppState for for AppState
crates/router/src/routes/app.rs
router
impl_block
null
null
null
45
null
AppState
scheduler::SchedulerAppState for
1
0
null
null
// Function: validate // File: crates/router_derive/src/macros/misc.rs // Module: router_derive // Documentation: Validates that the configuration provided for the `parent_field` does not contain empty or default values pub fn validate(&self, parent_field: &str) -> Result<(), ApplicationError>
crates/router_derive/src/macros/misc.rs
router_derive
function_signature
null
null
null
65
validate
null
null
null
null
null
null
// Struct: ConnectorResponse // File: crates/router/src/types.rs // Module: router // Implementations: 0 pub struct ConnectorResponse
crates/router/src/types.rs
router
struct_definition
ConnectorResponse
0
[]
31
null
null
null
null
null
null
null
// File: crates/hyperswitch_connectors/src/connectors/rapyd/transformers.rs // Module: hyperswitch_connectors // Public structs: 17 use common_enums::enums; use common_utils::{ ext_traits::OptionExt, request::Method, types::{FloatMajorUnit, MinorUnit}, }; use error_stack::ResultExt; use hyperswitch_domain_models::{ payment_method_data::{PaymentMethodData, WalletData}, router_data::{ConnectorAuthType, ErrorResponse, RouterData}, router_flow_types::refunds::{Execute, RSync}, router_request_types::ResponseId, router_response_types::{PaymentsResponseData, RedirectForm, RefundsResponseData}, types, }; use hyperswitch_interfaces::{consts::NO_ERROR_CODE, errors}; use masking::Secret; use serde::{Deserialize, Serialize}; use time::PrimitiveDateTime; use url::Url; use crate::{ types::{RefundsResponseRouterData, ResponseRouterData}, utils::{PaymentsAuthorizeRequestData, RouterData as _}, }; #[derive(Debug, Serialize)] pub struct RapydRouterData<T> { pub amount: FloatMajorUnit, pub router_data: T, } impl<T> From<(FloatMajorUnit, T)> for RapydRouterData<T> { fn from((amount, router_data): (FloatMajorUnit, T)) -> Self { Self { amount, router_data, } } } #[derive(Default, Debug, Serialize)] pub struct RapydPaymentsRequest { pub amount: FloatMajorUnit, pub currency: enums::Currency, pub payment_method: PaymentMethod, pub payment_method_options: Option<PaymentMethodOptions>, pub merchant_reference_id: Option<String>, pub capture: Option<bool>, pub description: Option<String>, pub complete_payment_url: Option<String>, pub error_payment_url: Option<String>, } #[derive(Default, Debug, Serialize)] pub struct PaymentMethodOptions { #[serde(rename = "3d_required")] pub three_ds: bool, } #[derive(Default, Debug, Serialize)] pub struct PaymentMethod { #[serde(rename = "type")] pub pm_type: String, pub fields: Option<PaymentFields>, pub address: Option<Address>, pub digital_wallet: Option<RapydWallet>, } #[derive(Default, Debug, Serialize)] pub struct PaymentFields { pub number: cards::CardNumber, pub expiration_month: Secret<String>, pub expiration_year: Secret<String>, pub name: Secret<String>, pub cvv: Secret<String>, } #[derive(Default, Debug, Serialize)] pub struct Address { name: Secret<String>, line_1: Secret<String>, line_2: Option<Secret<String>>, line_3: Option<Secret<String>>, city: Option<String>, state: Option<Secret<String>>, country: Option<String>, zip: Option<Secret<String>>, phone_number: Option<Secret<String>>, } #[derive(Debug, Clone, Serialize, Deserialize)] pub struct RapydWallet { #[serde(rename = "type")] payment_type: String, #[serde(rename = "details")] token: Option<Secret<String>>, } impl TryFrom<&RapydRouterData<&types::PaymentsAuthorizeRouterData>> for RapydPaymentsRequest { type Error = error_stack::Report<errors::ConnectorError>; fn try_from( item: &RapydRouterData<&types::PaymentsAuthorizeRouterData>, ) -> Result<Self, Self::Error> { let (capture, payment_method_options) = match item.router_data.payment_method { enums::PaymentMethod::Card => { let three_ds_enabled = matches!( item.router_data.auth_type, enums::AuthenticationType::ThreeDs ); let payment_method_options = PaymentMethodOptions { three_ds: three_ds_enabled, }; ( Some(matches!( item.router_data.request.capture_method, Some(enums::CaptureMethod::Automatic) | Some(enums::CaptureMethod::SequentialAutomatic) | None )), Some(payment_method_options), ) } _ => (None, None), }; let payment_method = match item.router_data.request.payment_method_data { PaymentMethodData::Card(ref ccard) => { Some(PaymentMethod { pm_type: "in_amex_card".to_owned(), //[#369] Map payment method type based on country fields: Some(PaymentFields { number: ccard.card_number.to_owned(), expiration_month: ccard.card_exp_month.to_owned(), expiration_year: ccard.card_exp_year.to_owned(), name: item .router_data .get_optional_billing_full_name() .to_owned() .unwrap_or(Secret::new("".to_string())), cvv: ccard.card_cvc.to_owned(), }), address: None, digital_wallet: None, }) } PaymentMethodData::Wallet(ref wallet_data) => { let digital_wallet = match wallet_data { WalletData::GooglePay(data) => Some(RapydWallet { payment_type: "google_pay".to_string(), token: Some(Secret::new( data.tokenization_data .get_encrypted_google_pay_token() .change_context(errors::ConnectorError::MissingRequiredField { field_name: "gpay wallet_token", })? .to_owned(), )), }), WalletData::ApplePay(data) => { let apple_pay_encrypted_data = data .payment_data .get_encrypted_apple_pay_payment_data_mandatory() .change_context(errors::ConnectorError::MissingRequiredField { field_name: "Apple pay encrypted data", })?; Some(RapydWallet { payment_type: "apple_pay".to_string(), token: Some(Secret::new(apple_pay_encrypted_data.to_string())), }) } _ => None, }; Some(PaymentMethod { pm_type: "by_visa_card".to_string(), //[#369] fields: None, address: None, digital_wallet, }) } _ => None, } .get_required_value("payment_method not implemented") .change_context(errors::ConnectorError::NotImplemented( "payment_method".to_owned(), ))?; let return_url = item.router_data.request.get_router_return_url()?; Ok(Self { amount: item.amount, currency: item.router_data.request.currency, payment_method, capture, payment_method_options, merchant_reference_id: Some(item.router_data.connector_request_reference_id.clone()), description: None, error_payment_url: Some(return_url.clone()), complete_payment_url: Some(return_url), }) } } #[derive(Debug, Deserialize)] pub struct RapydAuthType { pub access_key: Secret<String>, pub secret_key: Secret<String>, } impl TryFrom<&ConnectorAuthType> for RapydAuthType { type Error = error_stack::Report<errors::ConnectorError>; fn try_from(auth_type: &ConnectorAuthType) -> Result<Self, Self::Error> { if let ConnectorAuthType::BodyKey { api_key, key1 } = auth_type { Ok(Self { access_key: api_key.to_owned(), secret_key: key1.to_owned(), }) } else { Err(errors::ConnectorError::FailedToObtainAuthType)? } } } #[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq)] #[allow(clippy::upper_case_acronyms)] pub enum RapydPaymentStatus { #[serde(rename = "ACT")] Active, #[serde(rename = "CAN")] CanceledByClientOrBank, #[serde(rename = "CLO")] Closed, #[serde(rename = "ERR")] Error, #[serde(rename = "EXP")] Expired, #[serde(rename = "REV")] ReversedByRapyd, #[default] #[serde(rename = "NEW")] New, } fn get_status(status: RapydPaymentStatus, next_action: NextAction) -> enums::AttemptStatus { match (status, next_action) { (RapydPaymentStatus::Closed, _) => enums::AttemptStatus::Charged, ( RapydPaymentStatus::Active, NextAction::ThreedsVerification | NextAction::PendingConfirmation, ) => enums::AttemptStatus::AuthenticationPending, (RapydPaymentStatus::Active, NextAction::PendingCapture | NextAction::NotApplicable) => { enums::AttemptStatus::Authorized } ( RapydPaymentStatus::CanceledByClientOrBank | RapydPaymentStatus::Expired | RapydPaymentStatus::ReversedByRapyd, _, ) => enums::AttemptStatus::Voided, (RapydPaymentStatus::Error, _) => enums::AttemptStatus::Failure, (RapydPaymentStatus::New, _) => enums::AttemptStatus::Authorizing, } } #[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] pub struct RapydPaymentsResponse { pub status: Status, pub data: Option<ResponseData>, } #[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] pub struct Status { pub error_code: String, pub status: Option<String>, pub message: Option<String>, pub response_code: Option<String>, pub operation_id: Option<String>, } #[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] pub enum NextAction { #[serde(rename = "3d_verification")] ThreedsVerification, #[serde(rename = "pending_capture")] PendingCapture, #[serde(rename = "not_applicable")] NotApplicable, #[serde(rename = "pending_confirmation")] PendingConfirmation, } #[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] pub struct ResponseData { pub id: String, pub amount: i64, pub status: RapydPaymentStatus, pub next_action: NextAction, pub redirect_url: Option<String>, pub original_amount: Option<i64>, pub is_partial: Option<bool>, pub currency_code: Option<enums::Currency>, pub country_code: Option<String>, pub captured: Option<bool>, pub transaction_id: String, pub merchant_reference_id: Option<String>, pub paid: Option<bool>, pub failure_code: Option<String>, pub failure_message: Option<String>, } #[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] pub struct DisputeResponseData { pub id: String, pub amount: MinorUnit, pub currency: api_models::enums::Currency, pub token: String, pub dispute_reason_description: String, #[serde(default, with = "common_utils::custom_serde::timestamp::option")] pub due_date: Option<PrimitiveDateTime>, pub status: RapydWebhookDisputeStatus, #[serde(default, with = "common_utils::custom_serde::timestamp::option")] pub created_at: Option<PrimitiveDateTime>, #[serde(default, with = "common_utils::custom_serde::timestamp::option")] pub updated_at: Option<PrimitiveDateTime>, pub original_transaction_id: String, } #[derive(Default, Debug, Serialize)] pub struct RapydRefundRequest { pub payment: String, pub amount: Option<FloatMajorUnit>, pub currency: Option<enums::Currency>, } impl<F> TryFrom<&RapydRouterData<&types::RefundsRouterData<F>>> for RapydRefundRequest { type Error = error_stack::Report<errors::ConnectorError>; fn try_from(item: &RapydRouterData<&types::RefundsRouterData<F>>) -> Result<Self, Self::Error> { Ok(Self { payment: item .router_data .request .connector_transaction_id .to_string(), amount: Some(item.amount), currency: Some(item.router_data.request.currency), }) } } #[allow(dead_code)] #[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq)] pub enum RefundStatus { Completed, Error, Rejected, #[default] Pending, } impl From<RefundStatus> for enums::RefundStatus { fn from(item: RefundStatus) -> Self { match item { RefundStatus::Completed => Self::Success, RefundStatus::Error | RefundStatus::Rejected => Self::Failure, RefundStatus::Pending => Self::Pending, } } } #[derive(Debug, Clone, Serialize, Deserialize)] pub struct RefundResponse { pub status: Status, pub data: Option<RefundResponseData>, } #[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] pub struct RefundResponseData { //Some field related to foreign exchange and split payment can be added as and when implemented pub id: String, pub payment: String, pub amount: i64, pub currency: enums::Currency, pub status: RefundStatus, pub created_at: Option<i64>, pub failure_reason: Option<String>, } impl TryFrom<RefundsResponseRouterData<Execute, RefundResponse>> for types::RefundsRouterData<Execute> { type Error = error_stack::Report<errors::ConnectorError>; fn try_from( item: RefundsResponseRouterData<Execute, RefundResponse>, ) -> Result<Self, Self::Error> { let (connector_refund_id, refund_status) = match item.response.data { Some(data) => (data.id, enums::RefundStatus::from(data.status)), None => ( item.response.status.error_code, enums::RefundStatus::Failure, ), }; Ok(Self { response: Ok(RefundsResponseData { connector_refund_id, refund_status, }), ..item.data }) } } impl TryFrom<RefundsResponseRouterData<RSync, RefundResponse>> for types::RefundsRouterData<RSync> { type Error = error_stack::Report<errors::ConnectorError>; fn try_from( item: RefundsResponseRouterData<RSync, RefundResponse>, ) -> Result<Self, Self::Error> { let (connector_refund_id, refund_status) = match item.response.data { Some(data) => (data.id, enums::RefundStatus::from(data.status)), None => ( item.response.status.error_code, enums::RefundStatus::Failure, ), }; Ok(Self { response: Ok(RefundsResponseData { connector_refund_id, refund_status, }), ..item.data }) } } #[derive(Debug, Serialize, Clone)] pub struct CaptureRequest { amount: Option<FloatMajorUnit>, receipt_email: Option<Secret<String>>, statement_descriptor: Option<String>, } impl TryFrom<&RapydRouterData<&types::PaymentsCaptureRouterData>> for CaptureRequest { type Error = error_stack::Report<errors::ConnectorError>; fn try_from( item: &RapydRouterData<&types::PaymentsCaptureRouterData>, ) -> Result<Self, Self::Error> { Ok(Self { amount: Some(item.amount), receipt_email: None, statement_descriptor: None, }) } } impl<F, T> TryFrom<ResponseRouterData<F, RapydPaymentsResponse, T, PaymentsResponseData>> for RouterData<F, T, PaymentsResponseData> { type Error = error_stack::Report<errors::ConnectorError>; fn try_from( item: ResponseRouterData<F, RapydPaymentsResponse, T, PaymentsResponseData>, ) -> Result<Self, Self::Error> { let (status, response) = match &item.response.data { Some(data) => { let attempt_status = get_status(data.status.to_owned(), data.next_action.to_owned()); match attempt_status { enums::AttemptStatus::Failure => ( enums::AttemptStatus::Failure, Err(ErrorResponse { code: data .failure_code .to_owned() .unwrap_or(item.response.status.error_code), status_code: item.http_code, message: item.response.status.status.unwrap_or_default(), reason: data.failure_message.to_owned(), attempt_status: None, connector_transaction_id: None, network_advice_code: None, network_decline_code: None, network_error_message: None, connector_metadata: None, }), ), _ => { let redirection_url = data .redirect_url .as_ref() .filter(|redirect_str| !redirect_str.is_empty()) .map(|url| { Url::parse(url).change_context( errors::ConnectorError::FailedToObtainIntegrationUrl, ) }) .transpose()?; let redirection_data = redirection_url.map(|url| RedirectForm::from((url, Method::Get))); ( attempt_status, Ok(PaymentsResponseData::TransactionResponse { resource_id: ResponseId::ConnectorTransactionId(data.id.to_owned()), //transaction_id is also the field but this id is used to initiate a refund redirection_data: Box::new(redirection_data), mandate_reference: Box::new(None), connector_metadata: None, network_txn_id: None, connector_response_reference_id: data .merchant_reference_id .to_owned(), incremental_authorization_allowed: None, charges: None, }), ) } } } None => ( enums::AttemptStatus::Failure, Err(ErrorResponse { code: item.response.status.error_code, status_code: item.http_code, message: item.response.status.status.unwrap_or_default(), reason: item.response.status.message, attempt_status: None, connector_transaction_id: None, network_advice_code: None, network_decline_code: None, network_error_message: None, connector_metadata: None, }), ), }; Ok(Self { status, response, ..item.data }) } } #[derive(Debug, Deserialize)] pub struct RapydIncomingWebhook { pub id: String, #[serde(rename = "type")] pub webhook_type: RapydWebhookObjectEventType, pub data: WebhookData, pub trigger_operation_id: Option<String>, pub status: String, pub created_at: i64, } #[derive(Debug, Deserialize)] #[serde(rename_all = "SCREAMING_SNAKE_CASE")] pub enum RapydWebhookObjectEventType { PaymentCompleted, PaymentCaptured, PaymentFailed, RefundCompleted, PaymentRefundRejected, PaymentRefundFailed, PaymentDisputeCreated, PaymentDisputeUpdated, #[serde(other)] Unknown, } #[derive(Debug, Clone, Deserialize, Serialize, PartialEq, strum::Display)] pub enum RapydWebhookDisputeStatus { #[serde(rename = "ACT")] Active, #[serde(rename = "RVW")] Review, #[serde(rename = "LOS")] Lose, #[serde(rename = "WIN")] Win, #[serde(other)] Unknown, } impl From<RapydWebhookDisputeStatus> for api_models::webhooks::IncomingWebhookEvent { fn from(value: RapydWebhookDisputeStatus) -> Self { match value { RapydWebhookDisputeStatus::Active => Self::DisputeOpened, RapydWebhookDisputeStatus::Review => Self::DisputeChallenged, RapydWebhookDisputeStatus::Lose => Self::DisputeLost, RapydWebhookDisputeStatus::Win => Self::DisputeWon, RapydWebhookDisputeStatus::Unknown => Self::EventNotSupported, } } } #[derive(Debug, Deserialize)] #[serde(untagged)] pub enum WebhookData { Payment(ResponseData), Refund(RefundResponseData), Dispute(DisputeResponseData), } impl From<ResponseData> for RapydPaymentsResponse { fn from(value: ResponseData) -> Self { Self { status: Status { error_code: NO_ERROR_CODE.to_owned(), status: None, message: None, response_code: None, operation_id: None, }, data: Some(value), } } } impl From<RefundResponseData> for RefundResponse { fn from(value: RefundResponseData) -> Self { Self { status: Status { error_code: NO_ERROR_CODE.to_owned(), status: None, message: None, response_code: None, operation_id: None, }, data: Some(value), } } }
crates/hyperswitch_connectors/src/connectors/rapyd/transformers.rs
hyperswitch_connectors
full_file
null
null
null
4,450
null
null
null
null
null
null
null
// File: crates/common_utils/src/id_type/invoice.rs // Module: common_utils crate::id_type!( InvoiceId, " A type for invoice_id that can be used for invoice ids" ); crate::impl_id_type_methods!(InvoiceId, "invoice_id"); // This is to display the `InvoiceId` as InvoiceId(subs) crate::impl_debug_id_type!(InvoiceId); crate::impl_try_from_cow_str_id_type!(InvoiceId, "invoice_id"); crate::impl_generate_id_id_type!(InvoiceId, "invoice"); crate::impl_serializable_secret_id_type!(InvoiceId); crate::impl_queryable_id_type!(InvoiceId); crate::impl_to_sql_from_sql_id_type!(InvoiceId); impl crate::events::ApiEventMetric for InvoiceId { fn get_api_event_type(&self) -> Option<crate::events::ApiEventsType> { Some(crate::events::ApiEventsType::Invoice) } }
crates/common_utils/src/id_type/invoice.rs
common_utils
full_file
null
null
null
200
null
null
null
null
null
null
null
// Struct: StripebillingInvoiceData // File: crates/hyperswitch_connectors/src/connectors/stripebilling/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct StripebillingInvoiceData
crates/hyperswitch_connectors/src/connectors/stripebilling/transformers.rs
hyperswitch_connectors
struct_definition
StripebillingInvoiceData
0
[]
50
null
null
null
null
null
null
null
// Implementation: impl IncomingWebhook for for ConnectorEnum // File: crates/hyperswitch_interfaces/src/connector_integration_interface.rs // Module: hyperswitch_interfaces // Methods: 18 total (0 public) impl IncomingWebhook for for ConnectorEnum
crates/hyperswitch_interfaces/src/connector_integration_interface.rs
hyperswitch_interfaces
impl_block
null
null
null
54
null
ConnectorEnum
IncomingWebhook for
18
0
null
null
// Function: insert_pm_collect_link // File: crates/diesel_models/src/query/generic_link.rs // Module: diesel_models pub fn insert_pm_collect_link( self, conn: &PgPooledConn, ) -> StorageResult<PaymentMethodCollectLink>
crates/diesel_models/src/query/generic_link.rs
diesel_models
function_signature
null
null
null
58
insert_pm_collect_link
null
null
null
null
null
null
// Implementation: impl api::MandateSetup for for Nomupay // File: crates/hyperswitch_connectors/src/connectors/nomupay.rs // Module: hyperswitch_connectors // Methods: 0 total (0 public) impl api::MandateSetup for for Nomupay
crates/hyperswitch_connectors/src/connectors/nomupay.rs
hyperswitch_connectors
impl_block
null
null
null
65
null
Nomupay
api::MandateSetup for
0
0
null
null
// Function: emit // File: crates/events/src/lib.rs // Module: events // Documentation: Emit the event and log any errors. pub fn emit(self)
crates/events/src/lib.rs
events
function_signature
null
null
null
35
emit
null
null
null
null
null
null
// Struct: PaypalRedirectResponse // File: crates/hyperswitch_connectors/src/connectors/paypal/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct PaypalRedirectResponse
crates/hyperswitch_connectors/src/connectors/paypal/transformers.rs
hyperswitch_connectors
struct_definition
PaypalRedirectResponse
0
[]
47
null
null
null
null
null
null
null
// Implementation: impl IncomingWebhook for for Archipel // File: crates/hyperswitch_connectors/src/connectors/archipel.rs // Module: hyperswitch_connectors // Methods: 3 total (0 public) impl IncomingWebhook for for Archipel
crates/hyperswitch_connectors/src/connectors/archipel.rs
hyperswitch_connectors
impl_block
null
null
null
55
null
Archipel
IncomingWebhook for
3
0
null
null
// Function: if_statement // File: crates/euclid/src/frontend/ast/parser.rs // Module: euclid pub fn if_statement(input: &str) -> ParseResult<&str, ast::IfStatement>
crates/euclid/src/frontend/ast/parser.rs
euclid
function_signature
null
null
null
46
if_statement
null
null
null
null
null
null
// Struct: SquareRefundRequest // File: crates/hyperswitch_connectors/src/connectors/square/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct SquareRefundRequest
crates/hyperswitch_connectors/src/connectors/square/transformers.rs
hyperswitch_connectors
struct_definition
SquareRefundRequest
0
[]
49
null
null
null
null
null
null
null
// Implementation: impl ConnectorSpecifications for for Tesouro // File: crates/hyperswitch_connectors/src/connectors/tesouro.rs // Module: hyperswitch_connectors // Methods: 3 total (0 public) impl ConnectorSpecifications for for Tesouro
crates/hyperswitch_connectors/src/connectors/tesouro.rs
hyperswitch_connectors
impl_block
null
null
null
54
null
Tesouro
ConnectorSpecifications for
3
0
null
null
// Function: find_by_merchant_id // File: crates/diesel_models/src/query/payment_method.rs // Module: diesel_models pub fn find_by_merchant_id( conn: &PgPooledConn, merchant_id: &common_utils::id_type::MerchantId, ) -> StorageResult<Vec<Self>>
crates/diesel_models/src/query/payment_method.rs
diesel_models
function_signature
null
null
null
67
find_by_merchant_id
null
null
null
null
null
null
// Function: get_http_status_code_type // File: crates/router/src/utils.rs // Module: router pub fn get_http_status_code_type( status_code: u16, ) -> CustomResult<String, errors::ApiErrorResponse>
crates/router/src/utils.rs
router
function_signature
null
null
null
50
get_http_status_code_type
null
null
null
null
null
null
// Implementation: impl ProcessTrackerBatch // File: crates/scheduler/src/consumer/types/batch.rs // Module: scheduler // Methods: 2 total (2 public) impl ProcessTrackerBatch
crates/scheduler/src/consumer/types/batch.rs
scheduler
impl_block
null
null
null
41
null
ProcessTrackerBatch
null
2
2
null
null
// Struct: SiftRefundRequest // File: crates/hyperswitch_connectors/src/connectors/sift/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct SiftRefundRequest
crates/hyperswitch_connectors/src/connectors/sift/transformers.rs
hyperswitch_connectors
struct_definition
SiftRefundRequest
0
[]
51
null
null
null
null
null
null
null
// Implementation: impl Responder // File: crates/router/src/routes/webhooks.rs // Module: router // Methods: 0 total (0 public) impl Responder
crates/router/src/routes/webhooks.rs
router
impl_block
null
null
null
36
null
Responder
null
0
0
null
null
// Function: get_total_payment_method_count_core // File: crates/router/src/core/payment_methods.rs // Module: router pub fn get_total_payment_method_count_core( state: &SessionState, merchant_context: &domain::MerchantContext, ) -> RouterResult<api::TotalPaymentMethodCountResponse>
crates/router/src/core/payment_methods.rs
router
function_signature
null
null
null
65
get_total_payment_method_count_core
null
null
null
null
null
null
// Function: output // File: crates/euclid/src/frontend/ast/parser.rs // Module: euclid pub fn output<O: EuclidParsable>(input: &str) -> ParseResult<&str, O>
crates/euclid/src/frontend/ast/parser.rs
euclid
function_signature
null
null
null
49
output
null
null
null
null
null
null
// Implementation: impl Blocklist // File: crates/diesel_models/src/query/blocklist.rs // Module: diesel_models // Methods: 4 total (0 public) impl Blocklist
crates/diesel_models/src/query/blocklist.rs
diesel_models
impl_block
null
null
null
39
null
Blocklist
null
4
0
null
null
// Implementation: impl Mandates // File: crates/router/src/routes/app.rs // Module: router // Methods: 1 total (1 public) impl Mandates
crates/router/src/routes/app.rs
router
impl_block
null
null
null
35
null
Mandates
null
1
1
null
null
// Function: get_surcharge_details // File: crates/router/src/core/payments/types.rs // Module: router pub fn get_surcharge_details(&self, surcharge_key: SurchargeKey) -> Option<&SurchargeDetails>
crates/router/src/core/payments/types.rs
router
function_signature
null
null
null
49
get_surcharge_details
null
null
null
null
null
null
// File: crates/pm_auth/src/types/api/auth_service.rs // Module: pm_auth // Public structs: 4 use crate::types::{ BankAccountCredentialsRequest, BankAccountCredentialsResponse, ExchangeTokenRequest, ExchangeTokenResponse, LinkTokenRequest, LinkTokenResponse, RecipientCreateRequest, RecipientCreateResponse, }; pub trait AuthService: super::ConnectorCommon + AuthServiceLinkToken + AuthServiceExchangeToken + AuthServiceBankAccountCredentials { } pub trait PaymentInitiation: super::ConnectorCommon + PaymentInitiationRecipientCreate {} #[derive(Debug, Clone)] pub struct LinkToken; pub trait AuthServiceLinkToken: super::ConnectorIntegration<LinkToken, LinkTokenRequest, LinkTokenResponse> { } #[derive(Debug, Clone)] pub struct ExchangeToken; pub trait AuthServiceExchangeToken: super::ConnectorIntegration<ExchangeToken, ExchangeTokenRequest, ExchangeTokenResponse> { } #[derive(Debug, Clone)] pub struct BankAccountCredentials; pub trait AuthServiceBankAccountCredentials: super::ConnectorIntegration< BankAccountCredentials, BankAccountCredentialsRequest, BankAccountCredentialsResponse, > { } #[derive(Debug, Clone)] pub struct RecipientCreate; pub trait PaymentInitiationRecipientCreate: super::ConnectorIntegration<RecipientCreate, RecipientCreateRequest, RecipientCreateResponse> { }
crates/pm_auth/src/types/api/auth_service.rs
pm_auth
full_file
null
null
null
276
null
null
null
null
null
null
null
// Struct: CheckoutProcessing // File: crates/hyperswitch_connectors/src/connectors/checkout/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct CheckoutProcessing
crates/hyperswitch_connectors/src/connectors/checkout/transformers.rs
hyperswitch_connectors
struct_definition
CheckoutProcessing
0
[]
45
null
null
null
null
null
null
null
// Struct: LastPaymentError // File: crates/router/src/compatibility/stripe/setup_intents/types.rs // Module: router // Implementations: 0 pub struct LastPaymentError
crates/router/src/compatibility/stripe/setup_intents/types.rs
router
struct_definition
LastPaymentError
0
[]
41
null
null
null
null
null
null
null
// Struct: ResultCode // File: crates/hyperswitch_connectors/src/connectors/aci/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct ResultCode
crates/hyperswitch_connectors/src/connectors/aci/transformers.rs
hyperswitch_connectors
struct_definition
ResultCode
0
[]
45
null
null
null
null
null
null
null
// Struct: BluecodeRefundRequest // File: crates/hyperswitch_connectors/src/connectors/bluecode/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct BluecodeRefundRequest
crates/hyperswitch_connectors/src/connectors/bluecode/transformers.rs
hyperswitch_connectors
struct_definition
BluecodeRefundRequest
0
[]
51
null
null
null
null
null
null
null
// Function: get_webhook_config_disabled_events_key // File: crates/common_utils/src/id_type/merchant.rs // Module: common_utils // Documentation: get_webhook_config_disabled_events_key pub fn get_webhook_config_disabled_events_key(&self, connector_id: &str) -> String
crates/common_utils/src/id_type/merchant.rs
common_utils
function_signature
null
null
null
61
get_webhook_config_disabled_events_key
null
null
null
null
null
null
// Struct: PaystackPSyncResponseData // File: crates/hyperswitch_connectors/src/connectors/paystack/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct PaystackPSyncResponseData
crates/hyperswitch_connectors/src/connectors/paystack/transformers.rs
hyperswitch_connectors
struct_definition
PaystackPSyncResponseData
0
[]
53
null
null
null
null
null
null
null
// Struct: NmiReferenceBody // File: crates/hyperswitch_connectors/src/connectors/nmi/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct NmiReferenceBody
crates/hyperswitch_connectors/src/connectors/nmi/transformers.rs
hyperswitch_connectors
struct_definition
NmiReferenceBody
0
[]
49
null
null
null
null
null
null
null
// Struct: KatapultRouterData // File: crates/hyperswitch_connectors/src/connectors/katapult/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct KatapultRouterData<T>
crates/hyperswitch_connectors/src/connectors/katapult/transformers.rs
hyperswitch_connectors
struct_definition
KatapultRouterData
0
[]
52
null
null
null
null
null
null
null
// Function: generate_authorization_token // File: crates/hyperswitch_connectors/src/connectors/worldline.rs // Module: hyperswitch_connectors pub fn generate_authorization_token( &self, auth: worldline::WorldlineAuthType, http_method: Method, content_type: &str, date: &str, endpoint: &str, ) -> CustomResult<String, errors::ConnectorError>
crates/hyperswitch_connectors/src/connectors/worldline.rs
hyperswitch_connectors
function_signature
null
null
null
92
generate_authorization_token
null
null
null
null
null
null
// Function: get_payment_filters // File: crates/router/src/routes/payments.rs // Module: router pub fn get_payment_filters( state: web::Data<app::AppState>, req: actix_web::HttpRequest, ) -> impl Responder
crates/router/src/routes/payments.rs
router
function_signature
null
null
null
54
get_payment_filters
null
null
null
null
null
null
// Struct: NmiCompleteRequest // File: crates/hyperswitch_connectors/src/connectors/nmi/transformers.rs // Module: hyperswitch_connectors // Implementations: 0 pub struct NmiCompleteRequest
crates/hyperswitch_connectors/src/connectors/nmi/transformers.rs
hyperswitch_connectors
struct_definition
NmiCompleteRequest
0
[]
49
null
null
null
null
null
null
null
// Implementation: impl FraudCheckNew // File: crates/diesel_models/src/query/fraud_check.rs // Module: diesel_models // Methods: 1 total (0 public) impl FraudCheckNew
crates/diesel_models/src/query/fraud_check.rs
diesel_models
impl_block
null
null
null
42
null
FraudCheckNew
null
1
0
null
null
// Struct: PaymentMethodSessionRequest // File: crates/api_models/src/payment_methods.rs // Module: api_models // Implementations: 0 pub struct PaymentMethodSessionRequest
crates/api_models/src/payment_methods.rs
api_models
struct_definition
PaymentMethodSessionRequest
0
[]
38
null
null
null
null
null
null
null
// Implementation: impl api::PaymentCapture for for Fiserv // File: crates/hyperswitch_connectors/src/connectors/fiserv.rs // Module: hyperswitch_connectors // Methods: 0 total (0 public) impl api::PaymentCapture for for Fiserv
crates/hyperswitch_connectors/src/connectors/fiserv.rs
hyperswitch_connectors
impl_block
null
null
null
60
null
Fiserv
api::PaymentCapture for
0
0
null
null
// Function: merge_metadata // File: crates/hyperswitch_domain_models/src/payments.rs // Module: hyperswitch_domain_models pub fn merge_metadata( &self, request_metadata: Value, ) -> Result<Value, common_utils::errors::ParsingError>
crates/hyperswitch_domain_models/src/payments.rs
hyperswitch_domain_models
function_signature
null
null
null
58
merge_metadata
null
null
null
null
null
null
// File: crates/external_services/src/managers.rs // Module: external_services //! Config and client managers pub mod encryption_management; pub mod secrets_management;
crates/external_services/src/managers.rs
external_services
full_file
null
null
null
34
null
null
null
null
null
null
null
// Function: update_theme // File: crates/router/src/core/user/theme.rs // Module: router pub fn update_theme( state: SessionState, theme_id: String, request: theme_api::UpdateThemeRequest, ) -> UserResponse<theme_api::GetThemeResponse>
crates/router/src/core/user/theme.rs
router
function_signature
null
null
null
61
update_theme
null
null
null
null
null
null