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
⌀ |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
// Implementation: impl PaymentIntentFetchConstraints
// File: crates/hyperswitch_domain_models/src/payments/payment_intent.rs
// Module: hyperswitch_domain_models
// Methods: 1 total (1 public)
impl PaymentIntentFetchConstraints
|
crates/hyperswitch_domain_models/src/payments/payment_intent.rs
|
hyperswitch_domain_models
|
impl_block
| null | null | null | 49
| null |
PaymentIntentFetchConstraints
| null | 1
| 1
| null | null |
// Struct: CreateRoleRequest
// File: crates/api_models/src/user_role/role.rs
// Module: api_models
// Implementations: 0
pub struct CreateRoleRequest
|
crates/api_models/src/user_role/role.rs
|
api_models
|
struct_definition
|
CreateRoleRequest
| 0
|
[] | 38
| null | null | null | null | null | null | null |
// Implementation: impl Responder
// File: crates/router/src/routes/payments.rs
// Module: router
// Methods: 0 total (0 public)
impl Responder
|
crates/router/src/routes/payments.rs
|
router
|
impl_block
| null | null | null | 36
| null |
Responder
| null | 0
| 0
| null | null |
// Implementation: impl Coinbase
// File: crates/hyperswitch_connectors/src/connectors/coinbase.rs
// Module: hyperswitch_connectors
// Methods: 1 total (1 public)
impl Coinbase
|
crates/hyperswitch_connectors/src/connectors/coinbase.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 44
| null |
Coinbase
| null | 1
| 1
| null | null |
// Implementation: impl ConnectorValidation for for Cryptopay
// File: crates/hyperswitch_connectors/src/connectors/cryptopay.rs
// Module: hyperswitch_connectors
// Methods: 1 total (0 public)
impl ConnectorValidation for for Cryptopay
|
crates/hyperswitch_connectors/src/connectors/cryptopay.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 57
| null |
Cryptopay
|
ConnectorValidation for
| 1
| 0
| null | null |
// Implementation: impl api::Refund for for Klarna
// File: crates/hyperswitch_connectors/src/connectors/klarna.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::Refund for for Klarna
|
crates/hyperswitch_connectors/src/connectors/klarna.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 58
| null |
Klarna
|
api::Refund for
| 0
| 0
| null | null |
// File: crates/hyperswitch_connectors/src/connectors/inespay.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::{
consts::BASE64_ENGINE,
crypto,
errors::CustomResult,
ext_traits::{ByteSliceExt, BytesExt},
request::{Method, Request, RequestBuilder, RequestContent},
types::{AmountConvertor, StringMinorUnit, StringMinorUnitForConnector},
};
use error_stack::ResultExt;
use hyperswitch_domain_models::{
router_data::{AccessToken, ConnectorAuthType, 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, PaymentsCaptureRouterData, PaymentsSyncRouterData,
RefundSyncRouterData, RefundsRouterData,
},
};
use hyperswitch_interfaces::{
api::{
self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorSpecifications,
ConnectorValidation,
},
configs::Connectors,
errors,
events::connector_api_logs::ConnectorEvent,
types::{self, Response},
webhooks,
};
use masking::{ExposeInterface, Mask, Secret};
use ring::hmac;
use transformers as inespay;
use crate::{constants::headers, types::ResponseRouterData, utils};
#[derive(Clone)]
pub struct Inespay {
amount_converter: &'static (dyn AmountConvertor<Output = StringMinorUnit> + Sync),
}
impl Inespay {
pub fn new() -> &'static Self {
&Self {
amount_converter: &StringMinorUnitForConnector,
}
}
}
impl api::Payment for Inespay {}
impl api::PaymentSession for Inespay {}
impl api::ConnectorAccessToken for Inespay {}
impl api::MandateSetup for Inespay {}
impl api::PaymentAuthorize for Inespay {}
impl api::PaymentSync for Inespay {}
impl api::PaymentCapture for Inespay {}
impl api::PaymentVoid for Inespay {}
impl api::Refund for Inespay {}
impl api::RefundExecute for Inespay {}
impl api::RefundSync for Inespay {}
impl api::PaymentToken for Inespay {}
impl ConnectorIntegration<PaymentMethodToken, PaymentMethodTokenizationData, PaymentsResponseData>
for Inespay
{
// Not Implemented (R)
}
impl<Flow, Request, Response> ConnectorCommonExt<Flow, Request, Response> for Inespay
where
Self: ConnectorIntegration<Flow, Request, Response>,
{
fn build_headers(
&self,
req: &RouterData<Flow, Request, Response>,
_connectors: &Connectors,
) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
let mut header = vec![(
headers::CONTENT_TYPE.to_string(),
self.get_content_type().to_string().into(),
)];
let mut auth_headers = self.get_auth_header(&req.connector_auth_type)?;
header.append(&mut auth_headers);
Ok(header)
}
}
impl ConnectorCommon for Inespay {
fn id(&self) -> &'static str {
"inespay"
}
fn get_currency_unit(&self) -> api::CurrencyUnit {
api::CurrencyUnit::Minor
}
fn common_get_content_type(&self) -> &'static str {
"application/json"
}
fn base_url<'a>(&self, connectors: &'a Connectors) -> &'a str {
connectors.inespay.base_url.as_ref()
}
fn get_auth_header(
&self,
auth_type: &ConnectorAuthType,
) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
let auth = inespay::InespayAuthType::try_from(auth_type)
.change_context(errors::ConnectorError::FailedToObtainAuthType)?;
Ok(vec![
(
headers::AUTHORIZATION.to_string(),
auth.authorization.expose().into_masked(),
),
(
headers::X_API_KEY.to_string(),
auth.api_key.expose().into_masked(),
),
])
}
fn build_error_response(
&self,
res: Response,
event_builder: Option<&mut ConnectorEvent>,
) -> CustomResult<ErrorResponse, errors::ConnectorError> {
let response: inespay::InespayErrorResponse = res
.response
.parse_struct("InespayErrorResponse")
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
event_builder.map(|i| i.set_response_body(&response));
router_env::logger::info!(connector_response=?response);
Ok(ErrorResponse {
status_code: res.status_code,
code: response.status,
message: response.status_desc,
reason: None,
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 Inespay {
//TODO: implement functions when support enabled
}
impl ConnectorIntegration<Session, PaymentsSessionData, PaymentsResponseData> for Inespay {
//TODO: implement sessions flow
}
impl ConnectorIntegration<AccessTokenAuth, AccessTokenRequestData, AccessToken> for Inespay {}
impl ConnectorIntegration<SetupMandate, SetupMandateRequestData, PaymentsResponseData> for Inespay {}
impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData> for Inespay {
fn get_headers(
&self,
req: &PaymentsAuthorizeRouterData,
connectors: &Connectors,
) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
self.build_headers(req, connectors)
}
fn get_content_type(&self) -> &'static str {
self.common_get_content_type()
}
fn get_url(
&self,
_req: &PaymentsAuthorizeRouterData,
connectors: &Connectors,
) -> CustomResult<String, errors::ConnectorError> {
Ok(format!("{}/payins/single/init", self.base_url(connectors)))
}
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,
)?;
match req.request.currency {
common_enums::Currency::EUR => {
let connector_router_data = inespay::InespayRouterData::from((amount, req));
let connector_req =
inespay::InespayPaymentsRequest::try_from(&connector_router_data)?;
Ok(RequestContent::Json(Box::new(connector_req)))
}
_ => Err(errors::ConnectorError::CurrencyNotSupported {
message: req.request.currency.to_string(),
connector: "Inespay",
}
.into()),
}
}
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: inespay::InespayPaymentsResponse = res
.response
.parse_struct("Inespay 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 Inespay {
fn get_headers(
&self,
req: &PaymentsSyncRouterData,
connectors: &Connectors,
) -> CustomResult<Vec<(String, masking::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 connector_payment_id = req
.request
.connector_transaction_id
.get_connector_transaction_id()
.change_context(errors::ConnectorError::MissingConnectorTransactionID)?;
Ok(format!(
"{}{}{}",
self.base_url(connectors),
"/payins/single/",
connector_payment_id,
))
}
fn build_request(
&self,
req: &PaymentsSyncRouterData,
connectors: &Connectors,
) -> CustomResult<Option<Request>, errors::ConnectorError> {
Ok(Some(
RequestBuilder::new()
.method(Method::Get)
.url(&types::PaymentsSyncType::get_url(self, req, connectors)?)
.attach_default_headers()
.headers(types::PaymentsSyncType::get_headers(self, req, connectors)?)
.build(),
))
}
fn handle_response(
&self,
data: &PaymentsSyncRouterData,
event_builder: Option<&mut ConnectorEvent>,
res: Response,
) -> CustomResult<PaymentsSyncRouterData, errors::ConnectorError> {
let response: inespay::InespayPSyncResponse = res
.response
.parse_struct("inespay 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 Inespay {
fn get_headers(
&self,
req: &PaymentsCaptureRouterData,
connectors: &Connectors,
) -> CustomResult<Vec<(String, masking::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> {
let response: inespay::InespayPaymentsResponse = res
.response
.parse_struct("Inespay PaymentsCaptureResponse")
.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<Void, PaymentsCancelData, PaymentsResponseData> for Inespay {}
impl ConnectorIntegration<Execute, RefundsData, RefundsResponseData> for Inespay {
fn get_headers(
&self,
req: &RefundsRouterData<Execute>,
connectors: &Connectors,
) -> CustomResult<Vec<(String, masking::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!("{}/refunds/init", self.base_url(connectors)))
}
fn get_request_body(
&self,
req: &RefundsRouterData<Execute>,
_connectors: &Connectors,
) -> CustomResult<RequestContent, errors::ConnectorError> {
let refund_amount = utils::convert_amount(
self.amount_converter,
req.request.minor_refund_amount,
req.request.currency,
)?;
let connector_router_data = inespay::InespayRouterData::from((refund_amount, req));
let connector_req = inespay::InespayRefundRequest::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: inespay::InespayRefundsResponse = res
.response
.parse_struct("inespay InespayRefundsResponse")
.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 Inespay {
fn get_headers(
&self,
req: &RefundSyncRouterData,
connectors: &Connectors,
) -> CustomResult<Vec<(String, masking::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 connector_refund_id = req
.request
.connector_refund_id
.clone()
.ok_or(errors::ConnectorError::MissingConnectorRefundID)?;
Ok(format!(
"{}{}{}",
self.base_url(connectors),
"/refunds/",
connector_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: inespay::InespayRSyncResponse = res
.response
.parse_struct("inespay RefundSyncResponse")
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
event_builder.map(|i| i.set_response_body(&response));
router_env::logger::info!(connector_response=?response);
RouterData::try_from(ResponseRouterData {
response,
data: data.clone(),
http_code: res.status_code,
})
}
fn get_error_response(
&self,
res: Response,
event_builder: Option<&mut ConnectorEvent>,
) -> CustomResult<ErrorResponse, errors::ConnectorError> {
self.build_error_response(res, event_builder)
}
}
fn get_webhook_body(
body: &[u8],
) -> CustomResult<inespay::InespayWebhookEventData, errors::ConnectorError> {
let notif_item: inespay::InespayWebhookEvent =
serde_urlencoded::from_bytes::<inespay::InespayWebhookEvent>(body)
.change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?;
let encoded_data_return = notif_item.data_return;
let decoded_data_return = BASE64_ENGINE
.decode(encoded_data_return)
.change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?;
let data_return: inespay::InespayWebhookEventData = decoded_data_return
.parse_struct("inespay InespayWebhookEventData")
.change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?;
Ok(data_return)
}
#[async_trait::async_trait]
impl webhooks::IncomingWebhook for Inespay {
fn get_webhook_source_verification_algorithm(
&self,
_request: &webhooks::IncomingWebhookRequestDetails<'_>,
) -> CustomResult<Box<dyn crypto::VerifySignature + Send>, errors::ConnectorError> {
Ok(Box::new(crypto::HmacSha256))
}
fn get_webhook_source_verification_signature(
&self,
request: &webhooks::IncomingWebhookRequestDetails<'_>,
_connector_webhook_secrets: &api_models::webhooks::ConnectorWebhookSecrets,
) -> CustomResult<Vec<u8>, errors::ConnectorError> {
let notif_item = serde_urlencoded::from_bytes::<inespay::InespayWebhookEvent>(request.body)
.change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?;
Ok(notif_item.signature_data_return.as_bytes().to_owned())
}
fn get_webhook_source_verification_message(
&self,
request: &webhooks::IncomingWebhookRequestDetails<'_>,
_merchant_id: &common_utils::id_type::MerchantId,
_connector_webhook_secrets: &api_models::webhooks::ConnectorWebhookSecrets,
) -> CustomResult<Vec<u8>, errors::ConnectorError> {
let notif_item = serde_urlencoded::from_bytes::<inespay::InespayWebhookEvent>(request.body)
.change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?;
Ok(notif_item.data_return.into_bytes())
}
async fn verify_webhook_source(
&self,
request: &webhooks::IncomingWebhookRequestDetails<'_>,
merchant_id: &common_utils::id_type::MerchantId,
connector_webhook_details: Option<common_utils::pii::SecretSerdeValue>,
_connector_account_details: crypto::Encryptable<Secret<serde_json::Value>>,
connector_label: &str,
) -> CustomResult<bool, errors::ConnectorError> {
let connector_webhook_secrets = self
.get_webhook_source_verification_merchant_secret(
merchant_id,
connector_label,
connector_webhook_details,
)
.await?;
let signature =
self.get_webhook_source_verification_signature(request, &connector_webhook_secrets)?;
let message = self.get_webhook_source_verification_message(
request,
merchant_id,
&connector_webhook_secrets,
)?;
let secret = connector_webhook_secrets.secret;
let signing_key = hmac::Key::new(hmac::HMAC_SHA256, &secret);
let signed_message = hmac::sign(&signing_key, &message);
let computed_signature = hex::encode(signed_message.as_ref());
let payload_sign = BASE64_ENGINE.encode(computed_signature);
Ok(payload_sign.as_bytes().eq(&signature))
}
fn get_webhook_object_reference_id(
&self,
request: &webhooks::IncomingWebhookRequestDetails<'_>,
) -> CustomResult<api_models::webhooks::ObjectReferenceId, errors::ConnectorError> {
let data_return = get_webhook_body(request.body)
.change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?;
match data_return {
inespay::InespayWebhookEventData::Payment(data) => {
Ok(api_models::webhooks::ObjectReferenceId::PaymentId(
api_models::payments::PaymentIdType::ConnectorTransactionId(
data.single_payin_id,
),
))
}
inespay::InespayWebhookEventData::Refund(data) => {
Ok(api_models::webhooks::ObjectReferenceId::RefundId(
api_models::webhooks::RefundIdType::ConnectorRefundId(data.refund_id),
))
}
}
}
fn get_webhook_event_type(
&self,
request: &webhooks::IncomingWebhookRequestDetails<'_>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
let data_return = get_webhook_body(request.body)
.change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?;
Ok(api_models::webhooks::IncomingWebhookEvent::from(
data_return,
))
}
fn get_webhook_resource_object(
&self,
request: &webhooks::IncomingWebhookRequestDetails<'_>,
) -> CustomResult<Box<dyn masking::ErasedMaskSerialize>, errors::ConnectorError> {
let data_return = get_webhook_body(request.body)
.change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?;
Ok(match data_return {
inespay::InespayWebhookEventData::Payment(payment_webhook_data) => {
Box::new(payment_webhook_data)
}
inespay::InespayWebhookEventData::Refund(refund_webhook_data) => {
Box::new(refund_webhook_data)
}
})
}
}
static INESPAY_SUPPORTED_PAYMENT_METHODS: LazyLock<SupportedPaymentMethods> = LazyLock::new(|| {
let supported_capture_methods = vec![enums::CaptureMethod::Automatic];
let mut inespay_supported_payment_methods = SupportedPaymentMethods::new();
inespay_supported_payment_methods.add(
enums::PaymentMethod::BankDebit,
enums::PaymentMethodType::Sepa,
PaymentMethodDetails {
mandates: enums::FeatureStatus::NotSupported,
refunds: enums::FeatureStatus::Supported,
supported_capture_methods: supported_capture_methods.clone(),
specific_features: None,
},
);
inespay_supported_payment_methods
});
static INESPAY_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo {
display_name: "Inespay",
description:
"INESPAY is a payment method system that allows online shops to receive money in their bank accounts through a SEPA bank transfer ",
connector_type: enums::HyperswitchConnectorCategory::BankAcquirer,
integration_status: enums::ConnectorIntegrationStatus::Sandbox,
};
static INESPAY_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 2] =
[enums::EventClass::Payments, enums::EventClass::Refunds];
impl ConnectorSpecifications for Inespay {
fn get_connector_about(&self) -> Option<&'static ConnectorInfo> {
Some(&INESPAY_CONNECTOR_INFO)
}
fn get_supported_payment_methods(&self) -> Option<&'static SupportedPaymentMethods> {
Some(&*INESPAY_SUPPORTED_PAYMENT_METHODS)
}
fn get_supported_webhook_flows(&self) -> Option<&'static [enums::EventClass]> {
Some(&INESPAY_SUPPORTED_WEBHOOK_FLOWS)
}
}
|
crates/hyperswitch_connectors/src/connectors/inespay.rs
|
hyperswitch_connectors
|
full_file
| null | null | null | 5,943
| null | null | null | null | null | null | null |
// Function: psync_response_handler
// File: crates/router/src/core/revenue_recovery/types.rs
// Module: router
pub fn psync_response_handler(
&self,
state: &SessionState,
payment_intent: &PaymentIntent,
psync_task_process: &storage::ProcessTracker,
revenue_recovery_metadata: &mut PaymentRevenueRecoveryMetadata,
revenue_recovery_payment_data: &storage::revenue_recovery::RevenueRecoveryPaymentData,
) -> Result<(), errors::ProcessTrackerError>
|
crates/router/src/core/revenue_recovery/types.rs
|
router
|
function_signature
| null | null | null | 107
|
psync_response_handler
| null | null | null | null | null | null |
// File: crates/router/src/routes/lock_utils.rs
// Module: router
use router_env::Flow;
#[derive(Clone, Debug, strum::Display)]
#[strum(serialize_all = "snake_case")]
pub enum ApiIdentifier {
Payments,
Refunds,
Webhooks,
Organization,
MerchantAccount,
MerchantConnector,
Configs,
Customers,
Ephemeral,
Health,
Mandates,
PaymentMethods,
PaymentMethodAuth,
Payouts,
Disputes,
CardsInfo,
Files,
Cache,
Profile,
Verification,
ApiKeys,
PaymentLink,
Routing,
Subscription,
Blocklist,
Forex,
RustLockerMigration,
Gsm,
Role,
User,
UserRole,
ConnectorOnboarding,
Recon,
AiWorkflow,
Poll,
ApplePayCertificatesMigration,
Relay,
Documentation,
CardNetworkTokenization,
Hypersense,
PaymentMethodSession,
ProcessTracker,
Authentication,
Proxy,
ProfileAcquirer,
ThreeDsDecisionRule,
GenericTokenization,
RecoveryDataBackfill,
}
impl From<Flow> for ApiIdentifier {
fn from(flow: Flow) -> Self {
match flow {
Flow::MerchantsAccountCreate
| Flow::MerchantsAccountRetrieve
| Flow::MerchantsAccountUpdate
| Flow::MerchantsAccountDelete
| Flow::MerchantTransferKey
| Flow::MerchantAccountList
| Flow::EnablePlatformAccount => Self::MerchantAccount,
Flow::OrganizationCreate | Flow::OrganizationRetrieve | Flow::OrganizationUpdate => {
Self::Organization
}
Flow::RoutingCreateConfig
| Flow::RoutingLinkConfig
| Flow::RoutingUnlinkConfig
| Flow::RoutingRetrieveConfig
| Flow::RoutingRetrieveActiveConfig
| Flow::RoutingRetrieveDefaultConfig
| Flow::RoutingRetrieveDictionary
| Flow::RoutingUpdateConfig
| Flow::RoutingUpdateDefaultConfig
| Flow::RoutingDeleteConfig
| Flow::DecisionManagerDeleteConfig
| Flow::DecisionManagerRetrieveConfig
| Flow::ToggleDynamicRouting
| Flow::CreateDynamicRoutingConfig
| Flow::UpdateDynamicRoutingConfigs
| Flow::DecisionManagerUpsertConfig
| Flow::RoutingEvaluateRule
| Flow::DecisionEngineRuleMigration
| Flow::VolumeSplitOnRoutingType
| Flow::DecisionEngineDecideGatewayCall
| Flow::DecisionEngineGatewayFeedbackCall => Self::Routing,
Flow::CreateSubscription | Flow::ConfirmSubscription => Self::Subscription,
Flow::RetrieveForexFlow => Self::Forex,
Flow::AddToBlocklist => Self::Blocklist,
Flow::DeleteFromBlocklist => Self::Blocklist,
Flow::ListBlocklist => Self::Blocklist,
Flow::ToggleBlocklistGuard => Self::Blocklist,
Flow::MerchantConnectorsCreate
| Flow::MerchantConnectorsRetrieve
| Flow::MerchantConnectorsUpdate
| Flow::MerchantConnectorsDelete
| Flow::MerchantConnectorsList => Self::MerchantConnector,
Flow::ConfigKeyCreate
| Flow::ConfigKeyFetch
| Flow::ConfigKeyUpdate
| Flow::ConfigKeyDelete
| Flow::CreateConfigKey => Self::Configs,
Flow::CustomersCreate
| Flow::CustomersRetrieve
| Flow::CustomersUpdate
| Flow::CustomersDelete
| Flow::CustomersGetMandates
| Flow::CustomersList => Self::Customers,
Flow::EphemeralKeyCreate | Flow::EphemeralKeyDelete => Self::Ephemeral,
Flow::DeepHealthCheck | Flow::HealthCheck => Self::Health,
Flow::MandatesRetrieve | Flow::MandatesRevoke | Flow::MandatesList => Self::Mandates,
Flow::PaymentMethodsCreate
| Flow::PaymentMethodsMigrate
| Flow::PaymentMethodsBatchUpdate
| Flow::PaymentMethodsList
| Flow::CustomerPaymentMethodsList
| Flow::GetPaymentMethodTokenData
| Flow::PaymentMethodsRetrieve
| Flow::PaymentMethodsUpdate
| Flow::PaymentMethodsDelete
| Flow::PaymentMethodCollectLink
| Flow::ValidatePaymentMethod
| Flow::ListCountriesCurrencies
| Flow::DefaultPaymentMethodsSet
| Flow::PaymentMethodSave
| Flow::TotalPaymentMethodCount => Self::PaymentMethods,
Flow::PmAuthLinkTokenCreate | Flow::PmAuthExchangeToken => Self::PaymentMethodAuth,
Flow::PaymentsCreate
| Flow::PaymentsRetrieve
| Flow::PaymentsRetrieveForceSync
| Flow::PaymentsUpdate
| Flow::PaymentsConfirm
| Flow::PaymentsCapture
| Flow::PaymentsCancel
| Flow::PaymentsCancelPostCapture
| Flow::PaymentsApprove
| Flow::PaymentsReject
| Flow::PaymentsSessionToken
| Flow::PaymentsStart
| Flow::PaymentsList
| Flow::PaymentsFilters
| Flow::PaymentsAggregate
| Flow::PaymentsRedirect
| Flow::PaymentsIncrementalAuthorization
| Flow::PaymentsExternalAuthentication
| Flow::PaymentsAuthorize
| Flow::GetExtendedCardInfo
| Flow::PaymentsCompleteAuthorize
| Flow::PaymentsManualUpdate
| Flow::SessionUpdateTaxCalculation
| Flow::PaymentsConfirmIntent
| Flow::PaymentsCreateIntent
| Flow::PaymentsGetIntent
| Flow::GiftCardBalanceCheck
| Flow::PaymentsPostSessionTokens
| Flow::PaymentsUpdateMetadata
| Flow::PaymentsUpdateIntent
| Flow::PaymentsCreateAndConfirmIntent
| Flow::PaymentStartRedirection
| Flow::ProxyConfirmIntent
| Flow::PaymentsRetrieveUsingMerchantReferenceId
| Flow::PaymentAttemptsList
| Flow::RecoveryPaymentsCreate => Self::Payments,
Flow::PayoutsCreate
| Flow::PayoutsRetrieve
| Flow::PayoutsUpdate
| Flow::PayoutsCancel
| Flow::PayoutsFulfill
| Flow::PayoutsList
| Flow::PayoutsFilter
| Flow::PayoutsAccounts
| Flow::PayoutsConfirm
| Flow::PayoutLinkInitiate => Self::Payouts,
Flow::RefundsCreate
| Flow::RefundsRetrieve
| Flow::RefundsRetrieveForceSync
| Flow::RefundsUpdate
| Flow::RefundsList
| Flow::RefundsFilters
| Flow::RefundsAggregate
| Flow::RefundsManualUpdate => Self::Refunds,
Flow::Relay | Flow::RelayRetrieve => Self::Relay,
Flow::FrmFulfillment
| Flow::IncomingWebhookReceive
| Flow::IncomingRelayWebhookReceive
| Flow::WebhookEventInitialDeliveryAttemptList
| Flow::WebhookEventDeliveryAttemptList
| Flow::WebhookEventDeliveryRetry
| Flow::RecoveryIncomingWebhookReceive
| Flow::IncomingNetworkTokenWebhookReceive => Self::Webhooks,
Flow::ApiKeyCreate
| Flow::ApiKeyRetrieve
| Flow::ApiKeyUpdate
| Flow::ApiKeyRevoke
| Flow::ApiKeyList => Self::ApiKeys,
Flow::DisputesRetrieve
| Flow::DisputesList
| Flow::DisputesFilters
| Flow::DisputesEvidenceSubmit
| Flow::AttachDisputeEvidence
| Flow::RetrieveDisputeEvidence
| Flow::DisputesAggregate
| Flow::DeleteDisputeEvidence => Self::Disputes,
Flow::CardsInfo
| Flow::CardsInfoCreate
| Flow::CardsInfoUpdate
| Flow::CardsInfoMigrate => Self::CardsInfo,
Flow::CreateFile | Flow::DeleteFile | Flow::RetrieveFile => Self::Files,
Flow::CacheInvalidate => Self::Cache,
Flow::ProfileCreate
| Flow::ProfileUpdate
| Flow::ProfileRetrieve
| Flow::ProfileDelete
| Flow::ProfileList
| Flow::ToggleExtendedCardInfo
| Flow::ToggleConnectorAgnosticMit => Self::Profile,
Flow::PaymentLinkRetrieve
| Flow::PaymentLinkInitiate
| Flow::PaymentSecureLinkInitiate
| Flow::PaymentLinkList
| Flow::PaymentLinkStatus => Self::PaymentLink,
Flow::Verification => Self::Verification,
Flow::RustLockerMigration => Self::RustLockerMigration,
Flow::GsmRuleCreate
| Flow::GsmRuleRetrieve
| Flow::GsmRuleUpdate
| Flow::GsmRuleDelete => Self::Gsm,
Flow::ApplePayCertificatesMigration => Self::ApplePayCertificatesMigration,
Flow::UserConnectAccount
| Flow::UserSignUp
| Flow::UserSignIn
| Flow::Signout
| Flow::ChangePassword
| Flow::SetDashboardMetadata
| Flow::GetMultipleDashboardMetadata
| Flow::VerifyPaymentConnector
| Flow::InternalUserSignup
| Flow::TenantUserCreate
| Flow::SwitchOrg
| Flow::SwitchMerchantV2
| Flow::SwitchProfile
| Flow::CreatePlatformAccount
| Flow::UserOrgMerchantCreate
| Flow::UserMerchantAccountCreate
| Flow::GenerateSampleData
| Flow::DeleteSampleData
| Flow::GetUserDetails
| Flow::GetUserRoleDetails
| Flow::ForgotPassword
| Flow::ResetPassword
| Flow::RotatePassword
| Flow::InviteMultipleUser
| Flow::ReInviteUser
| Flow::UserSignUpWithMerchantId
| Flow::VerifyEmail
| Flow::AcceptInviteFromEmail
| Flow::VerifyEmailRequest
| Flow::UpdateUserAccountDetails
| Flow::TotpBegin
| Flow::TotpReset
| Flow::TotpVerify
| Flow::TotpUpdate
| Flow::RecoveryCodeVerify
| Flow::RecoveryCodesGenerate
| Flow::TerminateTwoFactorAuth
| Flow::TwoFactorAuthStatus
| Flow::CreateUserAuthenticationMethod
| Flow::UpdateUserAuthenticationMethod
| Flow::ListUserAuthenticationMethods
| Flow::UserTransferKey
| Flow::GetSsoAuthUrl
| Flow::SignInWithSso
| Flow::ListOrgForUser
| Flow::ListMerchantsForUserInOrg
| Flow::ListProfileForUserInOrgAndMerchant
| Flow::ListInvitationsForUser
| Flow::AuthSelect
| Flow::GetThemeUsingLineage
| Flow::GetThemeUsingThemeId
| Flow::UploadFileToThemeStorage
| Flow::CreateTheme
| Flow::UpdateTheme
| Flow::DeleteTheme
| Flow::CreateUserTheme
| Flow::UpdateUserTheme
| Flow::DeleteUserTheme
| Flow::GetUserThemeUsingThemeId
| Flow::UploadFileToUserThemeStorage
| Flow::GetUserThemeUsingLineage
| Flow::ListAllThemesInLineage
| Flow::CloneConnector => Self::User,
Flow::GetDataFromHyperswitchAiFlow | Flow::ListAllChatInteractions => Self::AiWorkflow,
Flow::ListRolesV2
| Flow::ListInvitableRolesAtEntityLevel
| Flow::ListUpdatableRolesAtEntityLevel
| Flow::GetRole
| Flow::GetRoleV2
| Flow::GetRoleFromToken
| Flow::GetRoleFromTokenV2
| Flow::UpdateUserRole
| Flow::GetAuthorizationInfo
| Flow::GetRolesInfo
| Flow::GetParentGroupInfo
| Flow::AcceptInvitationsV2
| Flow::AcceptInvitationsPreAuth
| Flow::DeleteUserRole
| Flow::CreateRole
| Flow::CreateRoleV2
| Flow::UpdateRole
| Flow::UserFromEmail
| Flow::ListUsersInLineage => Self::UserRole,
Flow::GetActionUrl | Flow::SyncOnboardingStatus | Flow::ResetTrackingId => {
Self::ConnectorOnboarding
}
Flow::ReconMerchantUpdate
| Flow::ReconTokenRequest
| Flow::ReconServiceRequest
| Flow::ReconVerifyToken => Self::Recon,
Flow::RetrievePollStatus => Self::Poll,
Flow::FeatureMatrix => Self::Documentation,
Flow::TokenizeCard
| Flow::TokenizeCardUsingPaymentMethodId
| Flow::TokenizeCardBatch => Self::CardNetworkTokenization,
Flow::HypersenseTokenRequest
| Flow::HypersenseVerifyToken
| Flow::HypersenseSignoutToken => Self::Hypersense,
Flow::PaymentMethodSessionCreate
| Flow::PaymentMethodSessionRetrieve
| Flow::PaymentMethodSessionConfirm
| Flow::PaymentMethodSessionUpdateSavedPaymentMethod
| Flow::PaymentMethodSessionDeleteSavedPaymentMethod
| Flow::PaymentMethodSessionUpdate => Self::PaymentMethodSession,
Flow::RevenueRecoveryRetrieve | Flow::RevenueRecoveryResume => Self::ProcessTracker,
Flow::AuthenticationCreate
| Flow::AuthenticationEligibility
| Flow::AuthenticationSync
| Flow::AuthenticationSyncPostUpdate
| Flow::AuthenticationAuthenticate => Self::Authentication,
Flow::Proxy => Self::Proxy,
Flow::ProfileAcquirerCreate | Flow::ProfileAcquirerUpdate => Self::ProfileAcquirer,
Flow::ThreeDsDecisionRuleExecute => Self::ThreeDsDecisionRule,
Flow::TokenizationCreate | Flow::TokenizationRetrieve | Flow::TokenizationDelete => {
Self::GenericTokenization
}
Flow::RecoveryDataBackfill => Self::RecoveryDataBackfill,
}
}
}
|
crates/router/src/routes/lock_utils.rs
|
router
|
full_file
| null | null | null | 3,049
| null | null | null | null | null | null | null |
// Function: f64_histogram_buckets
// File: crates/router_env/src/metrics.rs
// Module: router_env
pub fn f64_histogram_buckets() -> Vec<f64>
|
crates/router_env/src/metrics.rs
|
router_env
|
function_signature
| null | null | null | 40
|
f64_histogram_buckets
| null | null | null | null | null | null |
// File: crates/common_utils/src/id_type/payment.rs
// Module: common_utils
// Public functions: 8
use crate::{
errors::{CustomResult, ValidationError},
generate_id_with_default_len,
id_type::{AlphaNumericId, LengthId},
};
crate::id_type!(
PaymentId,
"A type for payment_id that can be used for payment ids"
);
crate::impl_id_type_methods!(PaymentId, "payment_id");
// This is to display the `PaymentId` as PaymentId(abcd)
crate::impl_debug_id_type!(PaymentId);
crate::impl_default_id_type!(PaymentId, "pay");
crate::impl_try_from_cow_str_id_type!(PaymentId, "payment_id");
// Database related implementations so that this field can be used directly in the database tables
crate::impl_queryable_id_type!(PaymentId);
crate::impl_to_sql_from_sql_id_type!(PaymentId);
impl PaymentId {
/// Get the hash key to be stored in redis
pub fn get_hash_key_for_kv_store(&self) -> String {
format!("pi_{}", self.0 .0 .0)
}
// This function should be removed once we have a better way to handle mandatory payment id in other flows
/// Get payment id in the format of irrelevant_payment_id_in_{flow}
pub fn get_irrelevant_id(flow: &str) -> Self {
let alphanumeric_id =
AlphaNumericId::new_unchecked(format!("irrelevant_payment_id_in_{flow}"));
let id = LengthId::new_unchecked(alphanumeric_id);
Self(id)
}
/// Get the attempt id for the payment id based on the attempt count
pub fn get_attempt_id(&self, attempt_count: i16) -> String {
format!("{}_{attempt_count}", self.get_string_repr())
}
/// Generate a client id for the payment id
pub fn generate_client_secret(&self) -> String {
generate_id_with_default_len(&format!("{}_secret", self.get_string_repr()))
}
/// Generate a key for pm_auth
pub fn get_pm_auth_key(&self) -> String {
format!("pm_auth_{}", self.get_string_repr())
}
/// Get external authentication request poll id
pub fn get_external_authentication_request_poll_id(&self) -> String {
format!("external_authentication_{}", self.get_string_repr())
}
/// Generate a test payment id with prefix test_
pub fn generate_test_payment_id_for_sample_data() -> Self {
let id = generate_id_with_default_len("test");
let alphanumeric_id = AlphaNumericId::new_unchecked(id);
let id = LengthId::new_unchecked(alphanumeric_id);
Self(id)
}
/// Wrap a string inside PaymentId
pub fn wrap(payment_id_string: String) -> CustomResult<Self, ValidationError> {
Self::try_from(std::borrow::Cow::from(payment_id_string))
}
}
crate::id_type!(PaymentReferenceId, "A type for payment_reference_id");
crate::impl_id_type_methods!(PaymentReferenceId, "payment_reference_id");
// This is to display the `PaymentReferenceId` as PaymentReferenceId(abcd)
crate::impl_debug_id_type!(PaymentReferenceId);
crate::impl_try_from_cow_str_id_type!(PaymentReferenceId, "payment_reference_id");
// Database related implementations so that this field can be used directly in the database tables
crate::impl_queryable_id_type!(PaymentReferenceId);
crate::impl_to_sql_from_sql_id_type!(PaymentReferenceId);
// This is implemented so that we can use payment id directly as attribute in metrics
#[cfg(feature = "metrics")]
impl From<PaymentId> for router_env::opentelemetry::Value {
fn from(val: PaymentId) -> Self {
Self::from(val.0 .0 .0)
}
}
impl std::str::FromStr for PaymentReferenceId {
type Err = error_stack::Report<ValidationError>;
fn from_str(s: &str) -> Result<Self, Self::Err> {
let cow_string = std::borrow::Cow::Owned(s.to_string());
Self::try_from(cow_string)
}
}
|
crates/common_utils/src/id_type/payment.rs
|
common_utils
|
full_file
| null | null | null | 879
| null | null | null | null | null | null | null |
// Struct: PaymentMethodResponseItem
// File: crates/api_models/src/payment_methods.rs
// Module: api_models
// Implementations: 0
pub struct PaymentMethodResponseItem
|
crates/api_models/src/payment_methods.rs
|
api_models
|
struct_definition
|
PaymentMethodResponseItem
| 0
|
[] | 38
| null | null | null | null | null | null | null |
// Implementation: impl CtxValueKind
// File: crates/euclid/src/dssa/types.rs
// Module: euclid
// Methods: 3 total (3 public)
impl CtxValueKind
|
crates/euclid/src/dssa/types.rs
|
euclid
|
impl_block
| null | null | null | 43
| null |
CtxValueKind
| null | 3
| 3
| null | null |
// Implementation: impl ChargebeeWebhookBody
// File: crates/hyperswitch_connectors/src/connectors/chargebee/transformers.rs
// Module: hyperswitch_connectors
// Methods: 1 total (1 public)
impl ChargebeeWebhookBody
|
crates/hyperswitch_connectors/src/connectors/chargebee/transformers.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 55
| null |
ChargebeeWebhookBody
| null | 1
| 1
| null | null |
// Struct: PaymentsSuccessRateAccumulator
// File: crates/analytics/src/payment_intents/accumulator.rs
// Module: analytics
// Implementations: 1
// Traits: PaymentIntentMetricAccumulator
pub struct PaymentsSuccessRateAccumulator
|
crates/analytics/src/payment_intents/accumulator.rs
|
analytics
|
struct_definition
|
PaymentsSuccessRateAccumulator
| 1
|
[
"PaymentIntentMetricAccumulator"
] | 54
| null | null | null | null | null | null | null |
// Implementation: impl Payments
// File: crates/router/src/routes/app.rs
// Module: router
// Methods: 1 total (1 public)
impl Payments
|
crates/router/src/routes/app.rs
|
router
|
impl_block
| null | null | null | 33
| null |
Payments
| null | 1
| 1
| null | null |
// Function: payment_method_session_confirm
// File: crates/openapi/src/routes/payment_method.rs
// Module: openapi
pub fn payment_method_session_confirm()
|
crates/openapi/src/routes/payment_method.rs
|
openapi
|
function_signature
| null | null | null | 33
|
payment_method_session_confirm
| null | null | null | null | null | null |
// Implementation: impl masking::SerializableSecret for for CustomerAcceptance
// File: crates/common_types/src/payments.rs
// Module: common_types
// Methods: 0 total (0 public)
impl masking::SerializableSecret for for CustomerAcceptance
|
crates/common_types/src/payments.rs
|
common_types
|
impl_block
| null | null | null | 51
| null |
CustomerAcceptance
|
masking::SerializableSecret for
| 0
| 0
| null | null |
// Struct: RazorpayRouterData
// File: crates/hyperswitch_connectors/src/connectors/razorpay/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct RazorpayRouterData<T>
|
crates/hyperswitch_connectors/src/connectors/razorpay/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
RazorpayRouterData
| 0
|
[] | 53
| null | null | null | null | null | null | null |
// Implementation: impl auth_service::AuthService for for Plaid
// File: crates/pm_auth/src/connector/plaid.rs
// Module: pm_auth
// Methods: 0 total (0 public)
impl auth_service::AuthService for for Plaid
|
crates/pm_auth/src/connector/plaid.rs
|
pm_auth
|
impl_block
| null | null | null | 51
| null |
Plaid
|
auth_service::AuthService for
| 0
| 0
| null | null |
// Struct: ShippingInformation
// File: crates/hyperswitch_connectors/src/connectors/flexiti/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct ShippingInformation
|
crates/hyperswitch_connectors/src/connectors/flexiti/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
ShippingInformation
| 0
|
[] | 46
| null | null | null | null | null | null | null |
// File: crates/hyperswitch_interfaces/src/types.rs
// Module: hyperswitch_interfaces
// Public structs: 2
//! Types interface
use hyperswitch_domain_models::{
router_data::{AccessToken, AccessTokenAuthenticationResponse},
router_data_v2::flow_common_types,
router_flow_types::{
access_token_auth::AccessTokenAuth,
dispute::{Accept, Defend, Dsync, Evidence, Fetch},
files::{Retrieve, Upload},
mandate_revoke::MandateRevoke,
payments::{
Authorize, AuthorizeSessionToken, Balance, CalculateTax, Capture, CompleteAuthorize,
CreateConnectorCustomer, CreateOrder, IncrementalAuthorization, InitPayment, PSync,
PaymentMethodToken, PostCaptureVoid, PostProcessing, PostSessionTokens, PreProcessing,
SdkSessionUpdate, Session, SetupMandate, UpdateMetadata, Void,
},
refunds::{Execute, RSync},
revenue_recovery::{BillingConnectorPaymentsSync, InvoiceRecordBack},
subscriptions::{
GetSubscriptionEstimate, GetSubscriptionPlanPrices, GetSubscriptionPlans,
SubscriptionCreate,
},
unified_authentication_service::{
Authenticate, AuthenticationConfirmation, PostAuthenticate, PreAuthenticate,
},
vault::{
ExternalVaultCreateFlow, ExternalVaultDeleteFlow, ExternalVaultInsertFlow,
ExternalVaultRetrieveFlow,
},
webhooks::VerifyWebhookSource,
AccessTokenAuthentication, BillingConnectorInvoiceSync, GiftCardBalanceCheck,
},
router_request_types::{
revenue_recovery::{
BillingConnectorInvoiceSyncRequest, BillingConnectorPaymentsSyncRequest,
InvoiceRecordBackRequest,
},
subscriptions::{
GetSubscriptionEstimateRequest, GetSubscriptionPlanPricesRequest,
GetSubscriptionPlansRequest, SubscriptionCreateRequest,
},
unified_authentication_service::{
UasAuthenticationRequestData, UasAuthenticationResponseData,
UasConfirmationRequestData, UasPostAuthenticationRequestData,
UasPreAuthenticationRequestData,
},
AcceptDisputeRequestData, AccessTokenAuthenticationRequestData, AccessTokenRequestData,
AuthorizeSessionTokenData, CompleteAuthorizeData, ConnectorCustomerData,
CreateOrderRequestData, DefendDisputeRequestData, DisputeSyncData,
FetchDisputesRequestData, GiftCardBalanceCheckRequestData, MandateRevokeRequestData,
PaymentMethodTokenizationData, PaymentsAuthenticateData, PaymentsAuthorizeData,
PaymentsCancelData, PaymentsCancelPostCaptureData, PaymentsCaptureData,
PaymentsIncrementalAuthorizationData, PaymentsPostAuthenticateData,
PaymentsPostProcessingData, PaymentsPostSessionTokensData, PaymentsPreAuthenticateData,
PaymentsPreProcessingData, PaymentsSessionData, PaymentsSyncData,
PaymentsTaxCalculationData, PaymentsUpdateMetadataData, RefundsData,
RetrieveFileRequestData, SdkPaymentsSessionUpdateData, SetupMandateRequestData,
SubmitEvidenceRequestData, UploadFileRequestData, VaultRequestData,
VerifyWebhookSourceRequestData,
},
router_response_types::{
revenue_recovery::{
BillingConnectorInvoiceSyncResponse, BillingConnectorPaymentsSyncResponse,
InvoiceRecordBackResponse,
},
subscriptions::{
GetSubscriptionEstimateResponse, GetSubscriptionPlanPricesResponse,
GetSubscriptionPlansResponse, SubscriptionCreateResponse,
},
AcceptDisputeResponse, DefendDisputeResponse, DisputeSyncResponse, FetchDisputesResponse,
GiftCardBalanceCheckResponseData, MandateRevokeResponseData, PaymentsResponseData,
RefundsResponseData, RetrieveFileResponse, SubmitEvidenceResponse,
TaxCalculationResponseData, UploadFileResponse, VaultResponseData,
VerifyWebhookSourceResponseData,
},
};
#[cfg(feature = "payouts")]
use hyperswitch_domain_models::{
router_flow_types::payouts::{
PoCancel, PoCreate, PoEligibility, PoFulfill, PoQuote, PoRecipient, PoRecipientAccount,
PoSync,
},
router_request_types::PayoutsData,
router_response_types::PayoutsResponseData,
};
use crate::{api::ConnectorIntegration, connector_integration_v2::ConnectorIntegrationV2};
/// struct Response
#[derive(Clone, Debug)]
pub struct Response {
/// headers
pub headers: Option<http::HeaderMap>,
/// response
pub response: bytes::Bytes,
/// status code
pub status_code: u16,
}
/// Type alias for `ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData>`
pub type PaymentsAuthorizeType =
dyn ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData>;
/// Type alias for `ConnectorIntegration<CalculateTax, PaymentsTaxCalculationData, TaxCalculationResponseData>`
pub type PaymentsTaxCalculationType =
dyn ConnectorIntegration<CalculateTax, PaymentsTaxCalculationData, TaxCalculationResponseData>;
/// Type alias for `ConnectorIntegration<PostSessionTokens, PaymentsPostSessionTokensData, PaymentsResponseData>`
pub type PaymentsPostSessionTokensType = dyn ConnectorIntegration<
PostSessionTokens,
PaymentsPostSessionTokensData,
PaymentsResponseData,
>;
/// Type alias for `ConnectorIntegration<UpdateMetadata, PaymentsUpdateMetadataData, PaymentsResponseData>`
pub type PaymentsUpdateMetadataType =
dyn ConnectorIntegration<UpdateMetadata, PaymentsUpdateMetadataData, PaymentsResponseData>;
/// Type alias for `ConnectorIntegration<SdkSessionUpdate, SdkPaymentsSessionUpdateData, PaymentsResponseData>`
pub type SdkSessionUpdateType =
dyn ConnectorIntegration<SdkSessionUpdate, SdkPaymentsSessionUpdateData, PaymentsResponseData>;
/// Type alias for `ConnectorIntegration<SetupMandate, SetupMandateRequestData, PaymentsResponseData>`
pub type SetupMandateType =
dyn ConnectorIntegration<SetupMandate, SetupMandateRequestData, PaymentsResponseData>;
/// Type alias for `ConnectorIntegration<MandateRevoke, MandateRevokeRequestData, MandateRevokeResponseData>`
pub type MandateRevokeType =
dyn ConnectorIntegration<MandateRevoke, MandateRevokeRequestData, MandateRevokeResponseData>;
/// Type alias for `ConnectorIntegration<CreateOrder, CreateOrderRequestData, PaymentsResponseData>`
pub type CreateOrderType =
dyn ConnectorIntegration<CreateOrder, CreateOrderRequestData, PaymentsResponseData>;
/// Type alias for `ConnectorIntegration<PreProcessing, PaymentsPreProcessingData, PaymentsResponseData>`
pub type PaymentsPreProcessingType =
dyn ConnectorIntegration<PreProcessing, PaymentsPreProcessingData, PaymentsResponseData>;
/// Type alias for `ConnectorIntegration<PreAuthenticate, PaymentsPreAuthenticateData, PaymentsResponseData>`
pub type PaymentsPreAuthenticateType =
dyn ConnectorIntegration<PreAuthenticate, PaymentsPreAuthenticateData, PaymentsResponseData>;
/// Type alias for `ConnectorIntegration<Authenticate, PaymentsAuthenticateData, PaymentsResponseData>`
pub type PaymentsAuthenticateType =
dyn ConnectorIntegration<Authenticate, PaymentsAuthenticateData, PaymentsResponseData>;
/// Type alias for `ConnectorIntegration<PostAuthenticate, PaymentsPostAuthenticateData, PaymentsResponseData>`
pub type PaymentsPostAuthenticateType =
dyn ConnectorIntegration<PostAuthenticate, PaymentsPostAuthenticateData, PaymentsResponseData>;
/// Type alias for `ConnectorIntegration<PostProcessing, PaymentsPostProcessingData, PaymentsResponseData>`
pub type PaymentsPostProcessingType =
dyn ConnectorIntegration<PostProcessing, PaymentsPostProcessingData, PaymentsResponseData>;
/// Type alias for `ConnectorIntegration<CompleteAuthorize, CompleteAuthorizeData, PaymentsResponseData>`
pub type PaymentsCompleteAuthorizeType =
dyn ConnectorIntegration<CompleteAuthorize, CompleteAuthorizeData, PaymentsResponseData>;
/// Type alias for `ConnectorIntegration<AuthorizeSessionToken, AuthorizeSessionTokenData, PaymentsResponseData>`
pub type PaymentsPreAuthorizeType = dyn ConnectorIntegration<
AuthorizeSessionToken,
AuthorizeSessionTokenData,
PaymentsResponseData,
>;
/// Type alias for `ConnectorIntegration<GiftCardBalanceCheck, GiftCardBalanceCheckRequestData, GiftCardBalanceCheckResponseData>`
pub type PaymentsGiftCardBalanceCheckType = dyn ConnectorIntegration<
GiftCardBalanceCheck,
GiftCardBalanceCheckRequestData,
GiftCardBalanceCheckResponseData,
>;
/// Type alias for `ConnectorIntegration<InitPayment, PaymentsAuthorizeData, PaymentsResponseData>`
pub type PaymentsInitType =
dyn ConnectorIntegration<InitPayment, PaymentsAuthorizeData, PaymentsResponseData>;
/// Type alias for `ConnectorIntegration<Balance, PaymentsAuthorizeData, PaymentsResponseData`
pub type PaymentsBalanceType =
dyn ConnectorIntegration<Balance, PaymentsAuthorizeData, PaymentsResponseData>;
/// Type alias for `PaymentsSyncType = dyn ConnectorIntegration<PSync, PaymentsSyncData, PaymentsResponseData>`
pub type PaymentsSyncType = dyn ConnectorIntegration<PSync, PaymentsSyncData, PaymentsResponseData>;
/// Type alias for `ConnectorIntegration<Capture, PaymentsCaptureData, PaymentsResponseData>`
pub type PaymentsCaptureType =
dyn ConnectorIntegration<Capture, PaymentsCaptureData, PaymentsResponseData>;
/// Type alias for `ConnectorIntegration<Session, PaymentsSessionData, PaymentsResponseData>`
pub type PaymentsSessionType =
dyn ConnectorIntegration<Session, PaymentsSessionData, PaymentsResponseData>;
/// Type alias for `ConnectorIntegration<Void, PaymentsCancelData, PaymentsResponseData>`
pub type PaymentsVoidType =
dyn ConnectorIntegration<Void, PaymentsCancelData, PaymentsResponseData>;
/// Type alias for `ConnectorIntegration<PostCaptureVoid, PaymentsCancelPostCaptureData, PaymentsResponseData>`
pub type PaymentsPostCaptureVoidType =
dyn ConnectorIntegration<PostCaptureVoid, PaymentsCancelPostCaptureData, PaymentsResponseData>;
/// Type alias for `ConnectorIntegration<PaymentMethodToken, PaymentMethodTokenizationData, PaymentsResponseData>`
pub type TokenizationType = dyn ConnectorIntegration<
PaymentMethodToken,
PaymentMethodTokenizationData,
PaymentsResponseData,
>;
/// Type alias for `ConnectorIntegration<IncrementalAuthorization, PaymentsIncrementalAuthorizationData, PaymentsResponseData>`
pub type IncrementalAuthorizationType = dyn ConnectorIntegration<
IncrementalAuthorization,
PaymentsIncrementalAuthorizationData,
PaymentsResponseData,
>;
/// Type alias for ConnectorIntegration<GetSubscriptionPlanPrices, GetSubscriptionPlanPricesRequest, GetSubscriptionPlanPricesResponse>
pub type GetSubscriptionPlanPricesType = dyn ConnectorIntegration<
GetSubscriptionPlanPrices,
GetSubscriptionPlanPricesRequest,
GetSubscriptionPlanPricesResponse,
>;
/// Type alias for `ConnectorIntegration<CreateConnectorCustomer, ConnectorCustomerData, PaymentsResponseData>`
pub type ConnectorCustomerType =
dyn ConnectorIntegration<CreateConnectorCustomer, ConnectorCustomerData, PaymentsResponseData>;
/// Type alias for `ConnectorIntegration<Execute, RefundsData, RefundsResponseData>`
pub type RefundExecuteType = dyn ConnectorIntegration<Execute, RefundsData, RefundsResponseData>;
/// Type alias for `ConnectorIntegration<RSync, RefundsData, RefundsResponseData>`
pub type RefundSyncType = dyn ConnectorIntegration<RSync, RefundsData, RefundsResponseData>;
/// Type alias for `ConnectorIntegration<PoCancel, PayoutsData, PayoutsResponseData>`
#[cfg(feature = "payouts")]
pub type PayoutCancelType = dyn ConnectorIntegration<PoCancel, PayoutsData, PayoutsResponseData>;
/// Type alias for `ConnectorIntegration<PoCreate, PayoutsData, PayoutsResponseData>`
#[cfg(feature = "payouts")]
pub type PayoutCreateType = dyn ConnectorIntegration<PoCreate, PayoutsData, PayoutsResponseData>;
/// Type alias for `ConnectorIntegration<PoEligibility, PayoutsData, PayoutsResponseData>`
#[cfg(feature = "payouts")]
pub type PayoutEligibilityType =
dyn ConnectorIntegration<PoEligibility, PayoutsData, PayoutsResponseData>;
/// Type alias for `ConnectorIntegration<PoFulfill, PayoutsData, PayoutsResponseData>`
#[cfg(feature = "payouts")]
pub type PayoutFulfillType = dyn ConnectorIntegration<PoFulfill, PayoutsData, PayoutsResponseData>;
/// Type alias for `ConnectorIntegration<PoRecipient, PayoutsData, PayoutsResponseData>`
#[cfg(feature = "payouts")]
pub type PayoutRecipientType =
dyn ConnectorIntegration<PoRecipient, PayoutsData, PayoutsResponseData>;
/// Type alias for `ConnectorIntegration<PoRecipientAccount, PayoutsData, PayoutsResponseData>`
#[cfg(feature = "payouts")]
pub type PayoutRecipientAccountType =
dyn ConnectorIntegration<PoRecipientAccount, PayoutsData, PayoutsResponseData>;
/// Type alias for `ConnectorIntegration<PoQuote, PayoutsData, PayoutsResponseData>`
#[cfg(feature = "payouts")]
pub type PayoutQuoteType = dyn ConnectorIntegration<PoQuote, PayoutsData, PayoutsResponseData>;
/// Type alias for `ConnectorIntegration<PoSync, PayoutsData, PayoutsResponseData>`
#[cfg(feature = "payouts")]
pub type PayoutSyncType = dyn ConnectorIntegration<PoSync, PayoutsData, PayoutsResponseData>;
/// Type alias for `ConnectorIntegration<AccessTokenAuthentication, AccessTokenAuthenticationRequestData, AccessTokenAuthenticationResponse>`
pub type AuthenticationTokenType = dyn ConnectorIntegration<
AccessTokenAuthentication,
AccessTokenAuthenticationRequestData,
AccessTokenAuthenticationResponse,
>;
/// Type alias for `ConnectorIntegration<AccessTokenAuth, AccessTokenRequestData, AccessToken>`
pub type RefreshTokenType =
dyn ConnectorIntegration<AccessTokenAuth, AccessTokenRequestData, AccessToken>;
/// Type alias for `ConnectorIntegration<Accept, AcceptDisputeRequestData, AcceptDisputeResponse>`
pub type AcceptDisputeType =
dyn ConnectorIntegration<Accept, AcceptDisputeRequestData, AcceptDisputeResponse>;
/// Type alias for `ConnectorIntegration<VerifyWebhookSource, VerifyWebhookSourceRequestData, VerifyWebhookSourceResponseData>`
pub type VerifyWebhookSourceType = dyn ConnectorIntegration<
VerifyWebhookSource,
VerifyWebhookSourceRequestData,
VerifyWebhookSourceResponseData,
>;
/// Type alias for `ConnectorIntegration<Evidence, SubmitEvidenceRequestData, SubmitEvidenceResponse>`
pub type SubmitEvidenceType =
dyn ConnectorIntegration<Evidence, SubmitEvidenceRequestData, SubmitEvidenceResponse>;
/// Type alias for `ConnectorIntegration<Upload, UploadFileRequestData, UploadFileResponse>`
pub type UploadFileType =
dyn ConnectorIntegration<Upload, UploadFileRequestData, UploadFileResponse>;
/// Type alias for `ConnectorIntegration<Retrieve, RetrieveFileRequestData, RetrieveFileResponse>`
pub type RetrieveFileType =
dyn ConnectorIntegration<Retrieve, RetrieveFileRequestData, RetrieveFileResponse>;
/// Type alias for `ConnectorIntegration<Defend, DefendDisputeRequestData, DefendDisputeResponse>`
pub type DefendDisputeType =
dyn ConnectorIntegration<Defend, DefendDisputeRequestData, DefendDisputeResponse>;
/// Type alias for `ConnectorIntegration<Fetch, FetchDisputesRequestData, FetchDisputesResponse>`
pub type FetchDisputesType =
dyn ConnectorIntegration<Fetch, FetchDisputesRequestData, FetchDisputesResponse>;
/// Type alias for `ConnectorIntegration<Dsync, DisputeSyncData, DisputeSyncResponse>`
pub type DisputeSyncType = dyn ConnectorIntegration<Dsync, DisputeSyncData, DisputeSyncResponse>;
/// Type alias for `ConnectorIntegration<PreAuthenticate, UasPreAuthenticationRequestData, UasAuthenticationResponseData>`
pub type UasPreAuthenticationType = dyn ConnectorIntegration<
PreAuthenticate,
UasPreAuthenticationRequestData,
UasAuthenticationResponseData,
>;
/// Type alias for `ConnectorIntegration<PostAuthenticate, UasPostAuthenticationRequestData, UasAuthenticationResponseData>`
pub type UasPostAuthenticationType = dyn ConnectorIntegration<
PostAuthenticate,
UasPostAuthenticationRequestData,
UasAuthenticationResponseData,
>;
/// Type alias for `ConnectorIntegration<Confirmation, UasConfirmationRequestData, UasAuthenticationResponseData>`
pub type UasAuthenticationConfirmationType = dyn ConnectorIntegration<
AuthenticationConfirmation,
UasConfirmationRequestData,
UasAuthenticationResponseData,
>;
/// Type alias for `ConnectorIntegration<Authenticate, UasAuthenticationRequestData, UasAuthenticationResponseData>`
pub type UasAuthenticationType = dyn ConnectorIntegration<
Authenticate,
UasAuthenticationRequestData,
UasAuthenticationResponseData,
>;
/// Type alias for `ConnectorIntegration<InvoiceRecordBack, InvoiceRecordBackRequest, InvoiceRecordBackResponse>`
pub type InvoiceRecordBackType = dyn ConnectorIntegration<
InvoiceRecordBack,
InvoiceRecordBackRequest,
InvoiceRecordBackResponse,
>;
/// Type alias for `ConnectorIntegration<SubscriptionCreate, SubscriptionCreateRequest, SubscriptionCreateResponse>`
pub type SubscriptionCreateType = dyn ConnectorIntegration<
SubscriptionCreate,
SubscriptionCreateRequest,
SubscriptionCreateResponse,
>;
/// Type alias for `ConnectorIntegration<BillingConnectorPaymentsSync, BillingConnectorPaymentsSyncRequest, BillingConnectorPaymentsSyncResponse>`
pub type BillingConnectorPaymentsSyncType = dyn ConnectorIntegration<
BillingConnectorPaymentsSync,
BillingConnectorPaymentsSyncRequest,
BillingConnectorPaymentsSyncResponse,
>;
/// Type alias for `ConnectorIntegration<BillingConnectorInvoiceSync, BillingConnectorInvoiceSyncRequest, BillingConnectorInvoiceSyncResponse>`
pub type BillingConnectorInvoiceSyncType = dyn ConnectorIntegration<
BillingConnectorInvoiceSync,
BillingConnectorInvoiceSyncRequest,
BillingConnectorInvoiceSyncResponse,
>;
/// Type alias for `ConnectorIntegrationV2<InvoiceRecordBack, InvoiceRecordBackData, InvoiceRecordBackRequest, InvoiceRecordBackResponse>`
pub type InvoiceRecordBackTypeV2 = dyn ConnectorIntegrationV2<
InvoiceRecordBack,
flow_common_types::InvoiceRecordBackData,
InvoiceRecordBackRequest,
InvoiceRecordBackResponse,
>;
/// Type alias for `ConnectorIntegrationV2<BillingConnectorPaymentsSync, BillingConnectorPaymentsSyncRequest, BillingConnectorPaymentsSyncResponse>`
pub type BillingConnectorPaymentsSyncTypeV2 = dyn ConnectorIntegrationV2<
BillingConnectorPaymentsSync,
flow_common_types::BillingConnectorPaymentsSyncFlowData,
BillingConnectorPaymentsSyncRequest,
BillingConnectorPaymentsSyncResponse,
>;
/// Type alias for `ConnectorIntegrationV2<BillingConnectorInvoiceSync, BillingConnectorInvoiceSyncFlowData, BillingConnectorInvoiceSyncRequest, BillingConnectorInvoiceSyncResponse>`
pub type BillingConnectorInvoiceSyncTypeV2 = dyn ConnectorIntegrationV2<
BillingConnectorInvoiceSync,
flow_common_types::BillingConnectorInvoiceSyncFlowData,
BillingConnectorInvoiceSyncRequest,
BillingConnectorInvoiceSyncResponse,
>;
/// Type alias for `ConnectorIntegration<GetSubscriptionPlans, GetSubscriptionPlansRequest, GetSubscriptionPlansResponse>`
pub type GetSubscriptionPlansType = dyn ConnectorIntegration<
GetSubscriptionPlans,
GetSubscriptionPlansRequest,
GetSubscriptionPlansResponse,
>;
/// Type alias for `ConnectorIntegration<GetSubscriptionEstimate, GetSubscriptionEstimateRequest, GetSubscriptionEstimateResponse>`
pub type GetSubscriptionEstimateType = dyn ConnectorIntegration<
GetSubscriptionEstimate,
GetSubscriptionEstimateRequest,
GetSubscriptionEstimateResponse,
>;
/// Type alias for `ConnectorIntegration<ExternalVaultInsertFlow, VaultRequestData, VaultResponseData>`
pub type ExternalVaultInsertType =
dyn ConnectorIntegration<ExternalVaultInsertFlow, VaultRequestData, VaultResponseData>;
/// Type alias for `ConnectorIntegration<ExternalVaultRetrieveFlow, VaultRequestData, VaultResponseData>`
pub type ExternalVaultRetrieveType =
dyn ConnectorIntegration<ExternalVaultRetrieveFlow, VaultRequestData, VaultResponseData>;
/// Type alias for `ConnectorIntegration<ExternalVaultDeleteFlow, VaultRequestData, VaultResponseData>`
pub type ExternalVaultDeleteType =
dyn ConnectorIntegration<ExternalVaultDeleteFlow, VaultRequestData, VaultResponseData>;
/// Type alias for `ConnectorIntegration<ExternalVaultCreateFlow, VaultRequestData, VaultResponseData>`
pub type ExternalVaultCreateType =
dyn ConnectorIntegration<ExternalVaultCreateFlow, VaultRequestData, VaultResponseData>;
/// Proxy configuration structure
#[derive(Debug, serde::Deserialize, Clone)]
#[serde(default)]
pub struct Proxy {
/// The URL of the HTTP proxy server.
pub http_url: Option<String>,
/// The URL of the HTTPS proxy server.
pub https_url: Option<String>,
/// The timeout duration (in seconds) for idle connections in the proxy pool.
pub idle_pool_connection_timeout: Option<u64>,
/// A comma-separated list of hosts that should bypass the proxy.
pub bypass_proxy_hosts: Option<String>,
}
impl Default for Proxy {
fn default() -> Self {
Self {
http_url: Default::default(),
https_url: Default::default(),
idle_pool_connection_timeout: Some(90),
bypass_proxy_hosts: Default::default(),
}
}
}
/// Type alias for `ConnectorIntegrationV2<CreateConnectorCustomer, PaymentFlowData, ConnectorCustomerData, PaymentsResponseData>`
pub type CreateCustomerTypeV2 = dyn ConnectorIntegrationV2<
CreateConnectorCustomer,
flow_common_types::PaymentFlowData,
ConnectorCustomerData,
PaymentsResponseData,
>;
|
crates/hyperswitch_interfaces/src/types.rs
|
hyperswitch_interfaces
|
full_file
| null | null | null | 4,331
| null | null | null | null | null | null | null |
// Struct: PaymentMethodsEnabled
// File: crates/common_types/src/payment_methods.rs
// Module: common_types
// Implementations: 1
pub struct PaymentMethodsEnabled
|
crates/common_types/src/payment_methods.rs
|
common_types
|
struct_definition
|
PaymentMethodsEnabled
| 1
|
[] | 36
| null | null | null | null | null | null | null |
// File: crates/router/src/routes/blocklist.rs
// Module: router
// Public functions: 4
use actix_web::{web, HttpRequest, HttpResponse};
use api_models::blocklist as api_blocklist;
use error_stack::report;
use router_env::Flow;
use crate::{
core::{api_locking, blocklist},
routes::AppState,
services::{api, authentication as auth, authorization::permissions::Permission},
types::domain,
};
#[utoipa::path(
post,
path = "/blocklist",
request_body = BlocklistRequest,
responses(
(status = 200, description = "Fingerprint Blocked", body = BlocklistResponse),
(status = 400, description = "Invalid Data")
),
tag = "Blocklist",
operation_id = "Block a Fingerprint",
security(("api_key" = []))
)]
pub async fn add_entry_to_blocklist(
state: web::Data<AppState>,
req: HttpRequest,
json_payload: web::Json<api_blocklist::AddToBlocklistRequest>,
) -> HttpResponse {
let flow = Flow::AddToBlocklist;
Box::pin(api::server_wrap(
flow,
state,
&req,
json_payload.into_inner(),
|state, auth: auth::AuthenticationData, body, _| {
let merchant_context = domain::MerchantContext::NormalMerchant(Box::new(
domain::Context(auth.merchant_account, auth.key_store),
));
blocklist::add_entry_to_blocklist(state, merchant_context, body)
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
is_connected_allowed: false,
is_platform_allowed: false,
}),
&auth::JWTAuth {
permission: Permission::MerchantAccountWrite,
},
req.headers(),
),
api_locking::LockAction::NotApplicable,
))
.await
}
#[utoipa::path(
delete,
path = "/blocklist",
request_body = BlocklistRequest,
responses(
(status = 200, description = "Fingerprint Unblocked", body = BlocklistResponse),
(status = 400, description = "Invalid Data")
),
tag = "Blocklist",
operation_id = "Unblock a Fingerprint",
security(("api_key" = []))
)]
pub async fn remove_entry_from_blocklist(
state: web::Data<AppState>,
req: HttpRequest,
json_payload: web::Json<api_blocklist::DeleteFromBlocklistRequest>,
) -> HttpResponse {
let flow = Flow::DeleteFromBlocklist;
Box::pin(api::server_wrap(
flow,
state,
&req,
json_payload.into_inner(),
|state, auth: auth::AuthenticationData, body, _| {
let merchant_context = domain::MerchantContext::NormalMerchant(Box::new(
domain::Context(auth.merchant_account, auth.key_store),
));
blocklist::remove_entry_from_blocklist(state, merchant_context, body)
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
is_connected_allowed: false,
is_platform_allowed: false,
}),
&auth::JWTAuth {
permission: Permission::MerchantAccountWrite,
},
req.headers(),
),
api_locking::LockAction::NotApplicable,
))
.await
}
#[utoipa::path(
get,
path = "/blocklist",
params (
("data_kind" = BlocklistDataKind, Query, description = "Kind of the fingerprint list requested"),
),
responses(
(status = 200, description = "Blocked Fingerprints", body = BlocklistResponse),
(status = 400, description = "Invalid Data")
),
tag = "Blocklist",
operation_id = "List Blocked fingerprints of a particular kind",
security(("api_key" = []))
)]
pub async fn list_blocked_payment_methods(
state: web::Data<AppState>,
req: HttpRequest,
query_payload: web::Query<api_blocklist::ListBlocklistQuery>,
) -> HttpResponse {
let flow = Flow::ListBlocklist;
let payload = query_payload.into_inner();
let api_auth = auth::ApiKeyAuth {
is_connected_allowed: false,
is_platform_allowed: false,
};
let (auth_type, _) =
match auth::check_client_secret_and_get_auth(req.headers(), &payload, api_auth) {
Ok(auth) => auth,
Err(err) => return api::log_and_return_error_response(report!(err)),
};
Box::pin(api::server_wrap(
flow,
state,
&req,
payload,
|state, auth: auth::AuthenticationData, query, _| {
let merchant_context = domain::MerchantContext::NormalMerchant(Box::new(
domain::Context(auth.merchant_account, auth.key_store),
));
blocklist::list_blocklist_entries(state, merchant_context, query)
},
auth::auth_type(
&*auth_type,
&auth::JWTAuth {
permission: Permission::MerchantAccountRead,
},
req.headers(),
),
api_locking::LockAction::NotApplicable,
))
.await
}
#[utoipa::path(
post,
path = "/blocklist/toggle",
params (
("status" = bool, Query, description = "Boolean value to enable/disable blocklist"),
),
responses(
(status = 200, description = "Blocklist guard enabled/disabled", body = ToggleBlocklistResponse),
(status = 400, description = "Invalid Data")
),
tag = "Blocklist",
operation_id = "Toggle blocklist guard for a particular merchant",
security(("api_key" = []))
)]
pub async fn toggle_blocklist_guard(
state: web::Data<AppState>,
req: HttpRequest,
query_payload: web::Query<api_blocklist::ToggleBlocklistQuery>,
) -> HttpResponse {
let flow = Flow::ListBlocklist;
Box::pin(api::server_wrap(
flow,
state,
&req,
query_payload.into_inner(),
|state, auth: auth::AuthenticationData, query, _| {
let merchant_context = domain::MerchantContext::NormalMerchant(Box::new(
domain::Context(auth.merchant_account, auth.key_store),
));
blocklist::toggle_blocklist_guard(state, merchant_context, query)
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
is_connected_allowed: false,
is_platform_allowed: false,
}),
&auth::JWTAuth {
permission: Permission::MerchantAccountWrite,
},
req.headers(),
),
api_locking::LockAction::NotApplicable,
))
.await
}
|
crates/router/src/routes/blocklist.rs
|
router
|
full_file
| null | null | null | 1,461
| null | null | null | null | null | null | null |
// Struct: JpmorganPaymentsRequest
// File: crates/hyperswitch_connectors/src/connectors/jpmorgan/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct JpmorganPaymentsRequest
|
crates/hyperswitch_connectors/src/connectors/jpmorgan/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
JpmorganPaymentsRequest
| 0
|
[] | 52
| null | null | null | null | null | null | null |
// File: crates/common_utils/src/id_type/refunds.rs
// Module: common_utils
crate::id_type!(RefundReferenceId, "A type for refund_reference_id");
crate::impl_id_type_methods!(RefundReferenceId, "refund_reference_id");
// This is to display the `RefundReferenceId` as RefundReferenceId(abcd)
crate::impl_debug_id_type!(RefundReferenceId);
crate::impl_try_from_cow_str_id_type!(RefundReferenceId, "refund_reference_id");
// Database related implementations so that this field can be used directly in the database tables
crate::impl_queryable_id_type!(RefundReferenceId);
crate::impl_to_sql_from_sql_id_type!(RefundReferenceId);
|
crates/common_utils/src/id_type/refunds.rs
|
common_utils
|
full_file
| null | null | null | 152
| null | null | null | null | null | null | null |
// Struct: RefundFilters
// File: crates/api_models/src/analytics/refunds.rs
// Module: api_models
// Implementations: 0
pub struct RefundFilters
|
crates/api_models/src/analytics/refunds.rs
|
api_models
|
struct_definition
|
RefundFilters
| 0
|
[] | 38
| null | null | null | null | null | null | null |
// File: crates/router/src/utils/user/theme.rs
// Module: router
// Public functions: 10
use std::path::PathBuf;
use common_enums::EntityType;
use common_utils::{ext_traits::AsyncExt, id_type, types::user::ThemeLineage};
use diesel_models::user::theme::Theme;
use error_stack::ResultExt;
use hyperswitch_domain_models::merchant_key_store::MerchantKeyStore;
use crate::{
core::errors::{StorageErrorExt, UserErrors, UserResult},
routes::SessionState,
services::authentication::UserFromToken,
};
fn get_theme_dir_key(theme_id: &str) -> PathBuf {
["themes", theme_id].iter().collect()
}
pub fn get_specific_file_key(theme_id: &str, file_name: &str) -> PathBuf {
let mut path = get_theme_dir_key(theme_id);
path.push(file_name);
path
}
pub fn get_theme_file_key(theme_id: &str) -> PathBuf {
get_specific_file_key(theme_id, "theme.json")
}
fn path_buf_to_str(path: &PathBuf) -> UserResult<&str> {
path.to_str()
.ok_or(UserErrors::InternalServerError)
.attach_printable(format!("Failed to convert path {path:#?} to string"))
}
pub async fn retrieve_file_from_theme_bucket(
state: &SessionState,
path: &PathBuf,
) -> UserResult<Vec<u8>> {
state
.theme_storage_client
.retrieve_file(path_buf_to_str(path)?)
.await
.change_context(UserErrors::ErrorRetrievingFile)
}
pub async fn upload_file_to_theme_bucket(
state: &SessionState,
path: &PathBuf,
data: Vec<u8>,
) -> UserResult<()> {
state
.theme_storage_client
.upload_file(path_buf_to_str(path)?, data)
.await
.change_context(UserErrors::ErrorUploadingFile)
}
pub async fn validate_lineage(state: &SessionState, lineage: &ThemeLineage) -> UserResult<()> {
match lineage {
ThemeLineage::Tenant { tenant_id } => {
validate_tenant(state, tenant_id)?;
Ok(())
}
ThemeLineage::Organization { tenant_id, org_id } => {
validate_tenant(state, tenant_id)?;
validate_org(state, org_id).await?;
Ok(())
}
ThemeLineage::Merchant {
tenant_id,
org_id,
merchant_id,
} => {
validate_tenant(state, tenant_id)?;
validate_org(state, org_id).await?;
validate_merchant(state, org_id, merchant_id).await?;
Ok(())
}
ThemeLineage::Profile {
tenant_id,
org_id,
merchant_id,
profile_id,
} => {
validate_tenant(state, tenant_id)?;
validate_org(state, org_id).await?;
let key_store = validate_merchant_and_get_key_store(state, org_id, merchant_id).await?;
validate_profile(state, profile_id, merchant_id, &key_store).await?;
Ok(())
}
}
}
fn validate_tenant(state: &SessionState, tenant_id: &id_type::TenantId) -> UserResult<()> {
if &state.tenant.tenant_id != tenant_id {
return Err(UserErrors::InvalidThemeLineage("tenant_id".to_string()).into());
}
Ok(())
}
async fn validate_org(state: &SessionState, org_id: &id_type::OrganizationId) -> UserResult<()> {
state
.accounts_store
.find_organization_by_org_id(org_id)
.await
.to_not_found_response(UserErrors::InvalidThemeLineage("org_id".to_string()))
.map(|_| ())
}
async fn validate_merchant_and_get_key_store(
state: &SessionState,
org_id: &id_type::OrganizationId,
merchant_id: &id_type::MerchantId,
) -> UserResult<MerchantKeyStore> {
let key_store = state
.store
.get_merchant_key_store_by_merchant_id(
&state.into(),
merchant_id,
&state.store.get_master_key().to_vec().into(),
)
.await
.to_not_found_response(UserErrors::InvalidThemeLineage("merchant_id".to_string()))?;
let merchant_account = state
.store
.find_merchant_account_by_merchant_id(&state.into(), merchant_id, &key_store)
.await
.to_not_found_response(UserErrors::InvalidThemeLineage("merchant_id".to_string()))?;
if &merchant_account.organization_id != org_id {
return Err(UserErrors::InvalidThemeLineage("merchant_id".to_string()).into());
}
Ok(key_store)
}
async fn validate_merchant(
state: &SessionState,
org_id: &id_type::OrganizationId,
merchant_id: &id_type::MerchantId,
) -> UserResult<()> {
validate_merchant_and_get_key_store(state, org_id, merchant_id)
.await
.map(|_| ())
}
async fn validate_profile(
state: &SessionState,
profile_id: &id_type::ProfileId,
merchant_id: &id_type::MerchantId,
key_store: &MerchantKeyStore,
) -> UserResult<()> {
state
.store
.find_business_profile_by_merchant_id_profile_id(
&state.into(),
key_store,
merchant_id,
profile_id,
)
.await
.to_not_found_response(UserErrors::InvalidThemeLineage("profile_id".to_string()))
.map(|_| ())
}
pub async fn get_most_specific_theme_using_token_and_min_entity(
state: &SessionState,
user_from_token: &UserFromToken,
min_entity: EntityType,
) -> UserResult<Option<Theme>> {
get_most_specific_theme_using_lineage(
state,
ThemeLineage::new(
min_entity,
user_from_token
.tenant_id
.clone()
.unwrap_or(state.tenant.tenant_id.clone()),
user_from_token.org_id.clone(),
user_from_token.merchant_id.clone(),
user_from_token.profile_id.clone(),
),
)
.await
}
pub async fn get_most_specific_theme_using_lineage(
state: &SessionState,
lineage: ThemeLineage,
) -> UserResult<Option<Theme>> {
match state
.store
.find_most_specific_theme_in_lineage(lineage)
.await
{
Ok(theme) => Ok(Some(theme)),
Err(e) => {
if e.current_context().is_db_not_found() {
Ok(None)
} else {
Err(e.change_context(UserErrors::InternalServerError))
}
}
}
}
pub async fn get_theme_using_optional_theme_id(
state: &SessionState,
theme_id: Option<String>,
) -> UserResult<Option<Theme>> {
match theme_id
.async_map(|theme_id| state.store.find_theme_by_theme_id(theme_id))
.await
.transpose()
{
Ok(theme) => Ok(theme),
Err(e) => {
if e.current_context().is_db_not_found() {
Ok(None)
} else {
Err(e.change_context(UserErrors::InternalServerError))
}
}
}
}
pub async fn get_theme_lineage_from_user_token(
user_from_token: &UserFromToken,
state: &SessionState,
request_entity_type: &EntityType,
) -> UserResult<ThemeLineage> {
let tenant_id = user_from_token
.tenant_id
.clone()
.unwrap_or(state.tenant.tenant_id.clone());
let org_id = user_from_token.org_id.clone();
let merchant_id = user_from_token.merchant_id.clone();
let profile_id = user_from_token.profile_id.clone();
Ok(ThemeLineage::new(
*request_entity_type,
tenant_id,
org_id,
merchant_id,
profile_id,
))
}
pub async fn can_user_access_theme(
user: &UserFromToken,
user_entity_type: &EntityType,
theme: &Theme,
) -> UserResult<()> {
if user_entity_type < &theme.entity_type {
return Err(UserErrors::ThemeNotFound.into());
}
match theme.entity_type {
EntityType::Tenant => {
if user.tenant_id.as_ref() == Some(&theme.tenant_id)
&& theme.org_id.is_none()
&& theme.merchant_id.is_none()
&& theme.profile_id.is_none()
{
Ok(())
} else {
Err(UserErrors::ThemeNotFound.into())
}
}
EntityType::Organization => {
if user.tenant_id.as_ref() == Some(&theme.tenant_id)
&& theme.org_id.as_ref() == Some(&user.org_id)
&& theme.merchant_id.is_none()
&& theme.profile_id.is_none()
{
Ok(())
} else {
Err(UserErrors::ThemeNotFound.into())
}
}
EntityType::Merchant => {
if user.tenant_id.as_ref() == Some(&theme.tenant_id)
&& theme.org_id.as_ref() == Some(&user.org_id)
&& theme.merchant_id.as_ref() == Some(&user.merchant_id)
&& theme.profile_id.is_none()
{
Ok(())
} else {
Err(UserErrors::ThemeNotFound.into())
}
}
EntityType::Profile => {
if user.tenant_id.as_ref() == Some(&theme.tenant_id)
&& theme.org_id.as_ref() == Some(&user.org_id)
&& theme.merchant_id.as_ref() == Some(&user.merchant_id)
&& theme.profile_id.as_ref() == Some(&user.profile_id)
{
Ok(())
} else {
Err(UserErrors::ThemeNotFound.into())
}
}
}
}
|
crates/router/src/utils/user/theme.rs
|
router
|
full_file
| null | null | null | 2,103
| null | null | null | null | null | null | null |
// Struct: LoonioPaymentsResponse
// File: crates/hyperswitch_connectors/src/connectors/loonio/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct LoonioPaymentsResponse
|
crates/hyperswitch_connectors/src/connectors/loonio/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
LoonioPaymentsResponse
| 0
|
[] | 50
| null | null | null | null | null | null | null |
// Struct: BrowserInformation
// File: crates/hyperswitch_domain_models/src/router_request_types.rs
// Module: hyperswitch_domain_models
// Implementations: 0
pub struct BrowserInformation
|
crates/hyperswitch_domain_models/src/router_request_types.rs
|
hyperswitch_domain_models
|
struct_definition
|
BrowserInformation
| 0
|
[] | 41
| null | null | null | null | null | null | null |
// Implementation: impl api::PaymentToken for for Vgs
// File: crates/hyperswitch_connectors/src/connectors/vgs.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::PaymentToken for for Vgs
|
crates/hyperswitch_connectors/src/connectors/vgs.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 57
| null |
Vgs
|
api::PaymentToken for
| 0
| 0
| null | null |
// Struct: AirwallexPLShippingAddress
// File: crates/hyperswitch_connectors/src/connectors/airwallex/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct AirwallexPLShippingAddress
|
crates/hyperswitch_connectors/src/connectors/airwallex/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
AirwallexPLShippingAddress
| 0
|
[] | 55
| null | null | null | null | null | null | null |
// File: crates/router/tests/connectors/nomupay.rs
// Module: router
use api_models::payments::{Address, AddressDetails};
use masking::Secret;
use router::types::{self, api, storage::enums, PaymentAddress};
use test_utils::connector_auth;
use crate::utils::{self, ConnectorActions, PaymentInfo};
#[derive(Clone, Copy)]
struct NomupayTest;
impl ConnectorActions for NomupayTest {}
impl utils::Connector for NomupayTest {
fn get_data(&self) -> api::ConnectorData {
use router::connector::Nomupay;
utils::construct_connector_data_old(
Box::new(Nomupay::new()),
types::Connector::Plaid,
api::GetToken::Connector,
None,
)
}
fn get_auth_token(&self) -> types::ConnectorAuthType {
utils::to_connector_auth_type(
connector_auth::ConnectorAuthentication::new()
.nomupay
.expect("Missing connector authentication configuration")
.into(),
)
}
fn get_name(&self) -> String {
"nomupay".to_string()
}
}
impl NomupayTest {
fn get_payout_info() -> Option<PaymentInfo> {
Some(PaymentInfo {
currency: Some(enums::Currency::GBP),
address: Some(PaymentAddress::new(
None,
Some(
Address {
address: Some(AddressDetails {
country: Some(api_models::enums::CountryAlpha2::GB),
city: Some("London".to_string()),
zip: Some(Secret::new("10025".to_string())),
line1: Some(Secret::new("50 Branson Ave".to_string())),
..Default::default()
}),
phone: None,
email: None,
}
.into(),
),
None,
None,
)),
payout_method_data: Some(api::PayoutMethodData::Bank(api::payouts::BankPayout::Sepa(
api::SepaBankTransfer {
bank_name: Some("Deutsche Bank".to_string()),
bank_country_code: Some(enums::CountryAlpha2::DE),
bank_city: Some("Munich".to_string()),
iban: Secret::new("DE57331060435647542639".to_string()),
bic: Some(Secret::new("DEUTDE5M551".to_string())),
},
))),
..Default::default()
})
}
}
static CONNECTOR: NomupayTest = NomupayTest {};
/******************** Payouts test cases ********************/
// Creates a recipient at connector's end
#[actix_web::test]
async fn should_create_payout_recipient() {
let payout_type = enums::PayoutType::Bank;
let payment_info = NomupayTest::get_payout_info();
let response = CONNECTOR
.create_payout_recipient(payout_type, payment_info)
.await
.expect("Payout recipient creation response");
assert_eq!(
response.status.unwrap(),
enums::PayoutStatus::RequiresCreation
);
}
// Create SEPA payout
#[actix_web::test]
async fn should_create_bacs_payout() {
let payout_type = enums::PayoutType::Bank;
let payout_info = NomupayTest::get_payout_info();
// Create recipient
let recipient_res = CONNECTOR
.create_payout_recipient(payout_type.to_owned(), payout_info.to_owned())
.await
.expect("Payout recipient response");
assert_eq!(
recipient_res.status.unwrap(),
enums::PayoutStatus::RequiresCreation
);
// Create payout
let create_res: types::PayoutsResponseData = CONNECTOR
.create_payout(recipient_res.connector_payout_id, payout_type, payout_info)
.await
.expect("Payout bank creation response");
assert_eq!(
create_res.status.unwrap(),
enums::PayoutStatus::RequiresFulfillment
);
}
// Create and fulfill SEPA payout
#[actix_web::test]
async fn should_create_and_fulfill_bacs_payout() {
let payout_type = enums::PayoutType::Bank;
let payout_info = NomupayTest::get_payout_info();
// Create recipient
let recipient_res = CONNECTOR
.create_payout_recipient(payout_type.to_owned(), payout_info.to_owned())
.await
.expect("Payout recipient response");
assert_eq!(
recipient_res.status.unwrap(),
enums::PayoutStatus::RequiresCreation
);
let response = CONNECTOR
.create_and_fulfill_payout(recipient_res.connector_payout_id, payout_type, payout_info)
.await
.expect("Payout bank creation and fulfill response");
assert_eq!(response.status.unwrap(), enums::PayoutStatus::Success);
}
|
crates/router/tests/connectors/nomupay.rs
|
router
|
full_file
| null | null | null | 1,064
| null | null | null | null | null | null | null |
// Struct: RequestMetadata
// File: crates/hyperswitch_connectors/src/connectors/bluesnap/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct RequestMetadata
|
crates/hyperswitch_connectors/src/connectors/bluesnap/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
RequestMetadata
| 0
|
[] | 46
| null | null | null | null | null | null | null |
// Function: new
// File: crates/hyperswitch_connectors/src/connectors/payload.rs
// Module: hyperswitch_connectors
pub fn new() -> &'static Self
|
crates/hyperswitch_connectors/src/connectors/payload.rs
|
hyperswitch_connectors
|
function_signature
| null | null | null | 38
|
new
| null | null | null | null | null | null |
// Implementation: impl api::PaymentSession for for Forte
// File: crates/hyperswitch_connectors/src/connectors/forte.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::PaymentSession for for Forte
|
crates/hyperswitch_connectors/src/connectors/forte.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 58
| null |
Forte
|
api::PaymentSession for
| 0
| 0
| null | null |
// Struct: PaymentStart
// File: crates/router/src/core/payments/operations/payment_start.rs
// Module: router
// Implementations: 0
pub struct PaymentStart
|
crates/router/src/core/payments/operations/payment_start.rs
|
router
|
struct_definition
|
PaymentStart
| 0
|
[] | 37
| null | null | null | null | null | null | null |
// Implementation: impl api::ConnectorAccessToken for for Paystack
// File: crates/hyperswitch_connectors/src/connectors/paystack.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::ConnectorAccessToken for for Paystack
|
crates/hyperswitch_connectors/src/connectors/paystack.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 57
| null |
Paystack
|
api::ConnectorAccessToken for
| 0
| 0
| null | null |
// Implementation: impl ConnectorSpecifications for for Nexinets
// File: crates/hyperswitch_connectors/src/connectors/nexinets.rs
// Module: hyperswitch_connectors
// Methods: 3 total (0 public)
impl ConnectorSpecifications for for Nexinets
|
crates/hyperswitch_connectors/src/connectors/nexinets.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 57
| null |
Nexinets
|
ConnectorSpecifications for
| 3
| 0
| null | null |
// Implementation: impl ConnectorCommon for for Adyen
// File: crates/hyperswitch_connectors/src/connectors/adyen.rs
// Module: hyperswitch_connectors
// Methods: 5 total (0 public)
impl ConnectorCommon for for Adyen
|
crates/hyperswitch_connectors/src/connectors/adyen.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 54
| null |
Adyen
|
ConnectorCommon for
| 5
| 0
| null | null |
// File: crates/external_services/src/http_client/client.rs
// Module: external_services
// Public functions: 4
use std::time::Duration;
use base64::Engine;
use common_utils::consts::BASE64_ENGINE;
pub use common_utils::errors::CustomResult;
use error_stack::ResultExt;
use hyperswitch_interfaces::{errors::HttpClientError, types::Proxy};
use masking::ExposeInterface;
use once_cell::sync::OnceCell;
static DEFAULT_CLIENT: OnceCell<reqwest::Client> = OnceCell::new();
use router_env::logger;
// We may need to use outbound proxy to connect to external world.
// Precedence will be the environment variables, followed by the config.
#[allow(missing_docs)]
pub fn create_client(
proxy_config: &Proxy,
client_certificate: Option<masking::Secret<String>>,
client_certificate_key: Option<masking::Secret<String>>,
ca_certificate: Option<masking::Secret<String>>,
) -> CustomResult<reqwest::Client, HttpClientError> {
// Case 1: Mutual TLS with client certificate and key
if let (Some(encoded_certificate), Some(encoded_certificate_key)) =
(client_certificate.clone(), client_certificate_key.clone())
{
if ca_certificate.is_some() {
logger::warn!("All of client certificate, client key, and CA certificate are provided. CA certificate will be ignored in mutual TLS setup.");
}
logger::debug!("Creating HTTP client with mutual TLS (client cert + key)");
let client_builder = get_client_builder(proxy_config)?;
let identity = create_identity_from_certificate_and_key(
encoded_certificate.clone(),
encoded_certificate_key,
)?;
let certificate_list = create_certificate(encoded_certificate)?;
let client_builder = certificate_list
.into_iter()
.fold(client_builder, |client_builder, certificate| {
client_builder.add_root_certificate(certificate)
});
return client_builder
.identity(identity)
.use_rustls_tls()
.build()
.change_context(HttpClientError::ClientConstructionFailed)
.attach_printable("Failed to construct client with certificate and certificate key");
}
// Case 2: Use provided CA certificate for server authentication only (one-way TLS)
if let Some(ca_pem) = ca_certificate {
logger::debug!("Creating HTTP client with one-way TLS (CA certificate)");
let pem = ca_pem.expose().replace("\\r\\n", "\n"); // Fix escaped newlines
let cert = reqwest::Certificate::from_pem(pem.as_bytes())
.change_context(HttpClientError::ClientConstructionFailed)
.attach_printable("Failed to parse CA certificate PEM block")?;
let client_builder = get_client_builder(proxy_config)?.add_root_certificate(cert);
return client_builder
.use_rustls_tls()
.build()
.change_context(HttpClientError::ClientConstructionFailed)
.attach_printable("Failed to construct client with CA certificate");
}
// Case 3: Default client (no certs)
logger::debug!("Creating default HTTP client (no client or CA certificates)");
get_base_client(proxy_config)
}
#[allow(missing_docs)]
pub fn get_client_builder(
proxy_config: &Proxy,
) -> CustomResult<reqwest::ClientBuilder, HttpClientError> {
let mut client_builder = reqwest::Client::builder()
.redirect(reqwest::redirect::Policy::none())
.pool_idle_timeout(Duration::from_secs(
proxy_config
.idle_pool_connection_timeout
.unwrap_or_default(),
));
let proxy_exclusion_config =
reqwest::NoProxy::from_string(&proxy_config.bypass_proxy_hosts.clone().unwrap_or_default());
// Proxy all HTTPS traffic through the configured HTTPS proxy
if let Some(url) = proxy_config.https_url.as_ref() {
client_builder = client_builder.proxy(
reqwest::Proxy::https(url)
.change_context(HttpClientError::InvalidProxyConfiguration)
.attach_printable("HTTPS proxy configuration error")?
.no_proxy(proxy_exclusion_config.clone()),
);
}
// Proxy all HTTP traffic through the configured HTTP proxy
if let Some(url) = proxy_config.http_url.as_ref() {
client_builder = client_builder.proxy(
reqwest::Proxy::http(url)
.change_context(HttpClientError::InvalidProxyConfiguration)
.attach_printable("HTTP proxy configuration error")?
.no_proxy(proxy_exclusion_config),
);
}
Ok(client_builder)
}
#[allow(missing_docs)]
pub fn create_identity_from_certificate_and_key(
encoded_certificate: masking::Secret<String>,
encoded_certificate_key: masking::Secret<String>,
) -> Result<reqwest::Identity, error_stack::Report<HttpClientError>> {
let decoded_certificate = BASE64_ENGINE
.decode(encoded_certificate.expose())
.change_context(HttpClientError::CertificateDecodeFailed)?;
let decoded_certificate_key = BASE64_ENGINE
.decode(encoded_certificate_key.expose())
.change_context(HttpClientError::CertificateDecodeFailed)?;
let certificate = String::from_utf8(decoded_certificate)
.change_context(HttpClientError::CertificateDecodeFailed)?;
let certificate_key = String::from_utf8(decoded_certificate_key)
.change_context(HttpClientError::CertificateDecodeFailed)?;
let key_chain = format!("{certificate_key}{certificate}");
reqwest::Identity::from_pem(key_chain.as_bytes())
.change_context(HttpClientError::CertificateDecodeFailed)
}
#[allow(missing_docs)]
pub fn create_certificate(
encoded_certificate: masking::Secret<String>,
) -> Result<Vec<reqwest::Certificate>, error_stack::Report<HttpClientError>> {
let decoded_certificate = BASE64_ENGINE
.decode(encoded_certificate.expose())
.change_context(HttpClientError::CertificateDecodeFailed)?;
let certificate = String::from_utf8(decoded_certificate)
.change_context(HttpClientError::CertificateDecodeFailed)?;
reqwest::Certificate::from_pem_bundle(certificate.as_bytes())
.change_context(HttpClientError::CertificateDecodeFailed)
}
fn get_base_client(proxy_config: &Proxy) -> CustomResult<reqwest::Client, HttpClientError> {
Ok(DEFAULT_CLIENT
.get_or_try_init(|| {
get_client_builder(proxy_config)?
.build()
.change_context(HttpClientError::ClientConstructionFailed)
.attach_printable("Failed to construct base client")
})?
.clone())
}
|
crates/external_services/src/http_client/client.rs
|
external_services
|
full_file
| null | null | null | 1,353
| null | null | null | null | null | null | null |
// Function: with_storage
// File: crates/router/src/routes/app.rs
// Module: router
// Documentation: Panics if Store can't be created or JWE decryption fails
pub fn with_storage(
conf: settings::Settings<SecuredSecret>,
storage_impl: StorageImpl,
shut_down_signal: oneshot::Sender<()
|
crates/router/src/routes/app.rs
|
router
|
function_signature
| null | null | null | 73
|
with_storage
| null | null | null | null | null | null |
// Struct: Inespay
// File: crates/hyperswitch_connectors/src/connectors/inespay.rs
// Module: hyperswitch_connectors
// Implementations: 17
// Traits: api::Payment, api::PaymentSession, api::ConnectorAccessToken, api::MandateSetup, api::PaymentAuthorize, api::PaymentSync, api::PaymentCapture, api::PaymentVoid, api::Refund, api::RefundExecute, api::RefundSync, api::PaymentToken, ConnectorCommon, ConnectorValidation, webhooks::IncomingWebhook, ConnectorSpecifications
pub struct Inespay
|
crates/hyperswitch_connectors/src/connectors/inespay.rs
|
hyperswitch_connectors
|
struct_definition
|
Inespay
| 17
|
[
"api::Payment",
"api::PaymentSession",
"api::ConnectorAccessToken",
"api::MandateSetup",
"api::PaymentAuthorize",
"api::PaymentSync",
"api::PaymentCapture",
"api::PaymentVoid",
"api::Refund",
"api::RefundExecute",
"api::RefundSync",
"api::PaymentToken",
"ConnectorCommon",
"ConnectorValidation",
"webhooks::IncomingWebhook",
"ConnectorSpecifications"
] | 128
| null | null | null | null | null | null | null |
// Function: get_external_authentication_request_poll_id
// File: crates/common_utils/src/id_type/payment.rs
// Module: common_utils
// Documentation: Get external authentication request poll id
pub fn get_external_authentication_request_poll_id(&self) -> String
|
crates/common_utils/src/id_type/payment.rs
|
common_utils
|
function_signature
| null | null | null | 51
|
get_external_authentication_request_poll_id
| null | null | null | null | null | null |
// Struct: RecipientCreate
// File: crates/pm_auth/src/types/api/auth_service.rs
// Module: pm_auth
// Implementations: 0
pub struct RecipientCreate
|
crates/pm_auth/src/types/api/auth_service.rs
|
pm_auth
|
struct_definition
|
RecipientCreate
| 0
|
[] | 38
| null | null | null | null | null | null | null |
// Function: handle_unified_connector_service_response_for_payment_register
// File: crates/router/src/core/unified_connector_service.rs
// Module: router
pub fn handle_unified_connector_service_response_for_payment_register(
response: payments_grpc::PaymentServiceRegisterResponse,
) -> UnifiedConnectorServiceResult
|
crates/router/src/core/unified_connector_service.rs
|
router
|
function_signature
| null | null | null | 61
|
handle_unified_connector_service_response_for_payment_register
| null | null | null | null | null | null |
// Implementation: impl api::RefundExecute for for Worldline
// File: crates/hyperswitch_connectors/src/connectors/worldline.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::RefundExecute for for Worldline
|
crates/hyperswitch_connectors/src/connectors/worldline.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 59
| null |
Worldline
|
api::RefundExecute for
| 0
| 0
| null | null |
// Function: update_token_expiry_based_on_schedule_time
// File: crates/router/src/workflows/revenue_recovery.rs
// Module: router
pub fn update_token_expiry_based_on_schedule_time(
state: &SessionState,
connector_customer_id: &str,
delayed_schedule_time: Option<time::PrimitiveDateTime>,
) -> CustomResult<(), errors::ProcessTrackerError>
|
crates/router/src/workflows/revenue_recovery.rs
|
router
|
function_signature
| null | null | null | 77
|
update_token_expiry_based_on_schedule_time
| null | null | null | null | null | null |
// Struct: NexinetsAsyncDetails
// File: crates/hyperswitch_connectors/src/connectors/nexinets/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct NexinetsAsyncDetails
|
crates/hyperswitch_connectors/src/connectors/nexinets/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
NexinetsAsyncDetails
| 0
|
[] | 53
| null | null | null | null | null | null | null |
// Implementation: impl ConnectorSpecifications for for Archipel
// File: crates/hyperswitch_connectors/src/connectors/archipel.rs
// Module: hyperswitch_connectors
// Methods: 3 total (0 public)
impl ConnectorSpecifications for for Archipel
|
crates/hyperswitch_connectors/src/connectors/archipel.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 53
| null |
Archipel
|
ConnectorSpecifications for
| 3
| 0
| null | null |
// Struct: MerchantKeyStoreNew
// File: crates/diesel_models/src/merchant_key_store.rs
// Module: diesel_models
// Implementations: 0
pub struct MerchantKeyStoreNew
|
crates/diesel_models/src/merchant_key_store.rs
|
diesel_models
|
struct_definition
|
MerchantKeyStoreNew
| 0
|
[] | 41
| null | null | null | null | null | null | null |
// Function: get_storage_type
// File: crates/router_derive/src/macros/diesel.rs
// Module: router_derive
pub fn get_storage_type(&self) -> &StorageType
|
crates/router_derive/src/macros/diesel.rs
|
router_derive
|
function_signature
| null | null | null | 40
|
get_storage_type
| null | null | null | null | null | null |
samsung_pay: None,
}))
}
domain::WalletData::GooglePay(google_pay_pm_data) => {
Ok(Some(api_models::payments::AdditionalPaymentData::Wallet {
apple_pay: None,
google_pay: Some(payment_additional_types::WalletAdditionalDataForCard {
last4: google_pay_pm_data.info.card_details.clone(),
card_network: google_pay_pm_data.info.card_network.clone(),
card_type: Some(google_pay_pm_data.pm_type.clone()),
}),
samsung_pay: None,
}))
}
domain::WalletData::SamsungPay(samsung_pay_pm_data) => {
Ok(Some(api_models::payments::AdditionalPaymentData::Wallet {
apple_pay: None,
google_pay: None,
samsung_pay: Some(payment_additional_types::WalletAdditionalDataForCard {
last4: samsung_pay_pm_data
.payment_credential
.card_last_four_digits
.clone(),
card_network: samsung_pay_pm_data
.payment_credential
.card_brand
.to_string(),
card_type: None,
}),
}))
}
_ => Ok(Some(api_models::payments::AdditionalPaymentData::Wallet {
apple_pay: None,
google_pay: None,
samsung_pay: None,
})),
},
domain::PaymentMethodData::PayLater(_) => Ok(Some(
api_models::payments::AdditionalPaymentData::PayLater { klarna_sdk: None },
)),
domain::PaymentMethodData::BankTransfer(bank_transfer) => Ok(Some(
api_models::payments::AdditionalPaymentData::BankTransfer {
details: Some((*(bank_transfer.to_owned())).into()),
},
)),
domain::PaymentMethodData::Crypto(crypto) => {
Ok(Some(api_models::payments::AdditionalPaymentData::Crypto {
details: Some(crypto.to_owned().into()),
}))
}
domain::PaymentMethodData::BankDebit(bank_debit) => Ok(Some(
api_models::payments::AdditionalPaymentData::BankDebit {
details: Some(bank_debit.to_owned().into()),
},
)),
domain::PaymentMethodData::MandatePayment => Ok(Some(
api_models::payments::AdditionalPaymentData::MandatePayment {},
)),
domain::PaymentMethodData::Reward => {
Ok(Some(api_models::payments::AdditionalPaymentData::Reward {}))
}
domain::PaymentMethodData::RealTimePayment(realtime_payment) => Ok(Some(
api_models::payments::AdditionalPaymentData::RealTimePayment {
details: Some((*(realtime_payment.to_owned())).into()),
},
)),
domain::PaymentMethodData::Upi(upi) => {
Ok(Some(api_models::payments::AdditionalPaymentData::Upi {
details: Some(upi.to_owned().into()),
}))
}
domain::PaymentMethodData::CardRedirect(card_redirect) => Ok(Some(
api_models::payments::AdditionalPaymentData::CardRedirect {
details: Some(card_redirect.to_owned().into()),
},
)),
domain::PaymentMethodData::Voucher(voucher) => {
Ok(Some(api_models::payments::AdditionalPaymentData::Voucher {
details: Some(voucher.to_owned().into()),
}))
}
domain::PaymentMethodData::GiftCard(gift_card) => Ok(Some(
api_models::payments::AdditionalPaymentData::GiftCard {
details: Some((*(gift_card.to_owned())).into()),
},
)),
domain::PaymentMethodData::CardToken(card_token) => Ok(Some(
api_models::payments::AdditionalPaymentData::CardToken {
details: Some(card_token.to_owned().into()),
},
)),
domain::PaymentMethodData::OpenBanking(open_banking) => Ok(Some(
api_models::payments::AdditionalPaymentData::OpenBanking {
details: Some(open_banking.to_owned().into()),
},
)),
domain::PaymentMethodData::CardDetailsForNetworkTransactionId(card_data) => {
let card_isin = Some(card_data.card_number.get_card_isin());
let enable_extended_bin =db
.find_config_by_key_unwrap_or(
format!("{}_enable_extended_card_bin", profile_id.get_string_repr()).as_str(),
Some("false".to_string()))
.await.map_err(|err| services::logger::error!(message="Failed to fetch the config", extended_card_bin_error=?err)).ok();
let card_extended_bin = match enable_extended_bin {
Some(config) if config.config == "true" => {
Some(card_data.card_number.get_extended_card_bin())
}
_ => None,
};
let card_network = match card_data
.card_number
.is_cobadged_card()
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable(
"Card cobadge check failed due to an invalid card network regex",
)? {
true => card_data.card_network.clone(),
false => None,
};
let last4 = Some(card_data.card_number.get_last4());
if card_data.card_issuer.is_some()
&& card_network.is_some()
&& card_data.card_type.is_some()
&& card_data.card_issuing_country.is_some()
&& card_data.bank_code.is_some()
{
Ok(Some(api_models::payments::AdditionalPaymentData::Card(
Box::new(api_models::payments::AdditionalCardInfo {
card_issuer: card_data.card_issuer.to_owned(),
card_network,
card_type: card_data.card_type.to_owned(),
card_issuing_country: card_data.card_issuing_country.to_owned(),
bank_code: card_data.bank_code.to_owned(),
card_exp_month: Some(card_data.card_exp_month.clone()),
card_exp_year: Some(card_data.card_exp_year.clone()),
card_holder_name: card_data.card_holder_name.clone(),
last4: last4.clone(),
card_isin: card_isin.clone(),
card_extended_bin: card_extended_bin.clone(),
// These are filled after calling the processor / connector
payment_checks: None,
authentication_data: None,
is_regulated: None,
signature_network: None,
}),
)))
} else {
let card_info = card_isin
.clone()
.async_and_then(|card_isin| async move {
db.get_card_info(&card_isin)
.await
.map_err(|error| services::logger::warn!(card_info_error=?error))
.ok()
})
.await
.flatten()
.map(|card_info| {
api_models::payments::AdditionalPaymentData::Card(Box::new(
api_models::payments::AdditionalCardInfo {
card_issuer: card_info.card_issuer,
card_network: card_network.clone().or(card_info.card_network),
bank_code: card_info.bank_code,
card_type: card_info.card_type,
card_issuing_country: card_info.card_issuing_country,
last4: last4.clone(),
card_isin: card_isin.clone(),
card_extended_bin: card_extended_bin.clone(),
card_exp_month: Some(card_data.card_exp_month.clone()),
card_exp_year: Some(card_data.card_exp_year.clone()),
card_holder_name: card_data.card_holder_name.clone(),
// These are filled after calling the processor / connector
payment_checks: None,
authentication_data: None,
is_regulated: None,
signature_network: None,
},
))
});
Ok(Some(card_info.unwrap_or_else(|| {
api_models::payments::AdditionalPaymentData::Card(Box::new(
api_models::payments::AdditionalCardInfo {
card_issuer: None,
card_network,
bank_code: None,
card_type: None,
card_issuing_country: None,
last4,
card_isin,
card_extended_bin,
card_exp_month: Some(card_data.card_exp_month.clone()),
card_exp_year: Some(card_data.card_exp_year.clone()),
card_holder_name: card_data.card_holder_name.clone(),
// These are filled after calling the processor / connector
payment_checks: None,
authentication_data: None,
is_regulated: None,
signature_network: None,
},
))
})))
}
}
domain::PaymentMethodData::MobilePayment(mobile_payment) => Ok(Some(
api_models::payments::AdditionalPaymentData::MobilePayment {
details: Some(mobile_payment.to_owned().into()),
},
)),
domain::PaymentMethodData::NetworkToken(_) => Ok(None),
}
}
#[cfg(feature = "v1")]
pub fn validate_customer_access(
payment_intent: &PaymentIntent,
auth_flow: services::AuthFlow,
request: &api::PaymentsRequest,
) -> Result<(), errors::ApiErrorResponse> {
if auth_flow == services::AuthFlow::Client && request.get_customer_id().is_some() {
let is_same_customer = request.get_customer_id() == payment_intent.customer_id.as_ref();
if !is_same_customer {
Err(errors::ApiErrorResponse::GenericUnauthorized {
message: "Unauthorised access to update customer".to_string(),
})?;
}
}
Ok(())
}
pub fn is_apple_pay_simplified_flow(
connector_metadata: Option<pii::SecretSerdeValue>,
connector_name: Option<&String>,
) -> CustomResult<bool, errors::ApiErrorResponse> {
let option_apple_pay_metadata = get_applepay_metadata(connector_metadata)
.map_err(|error| {
logger::info!(
"Apple pay metadata parsing for {:?} in is_apple_pay_simplified_flow {:?}",
connector_name,
error
)
})
.ok();
// return true only if the apple flow type is simplified
Ok(matches!(
option_apple_pay_metadata,
Some(
api_models::payments::ApplepaySessionTokenMetadata::ApplePayCombined(
api_models::payments::ApplePayCombinedMetadata::Simplified { .. }
)
)
))
}
// This function will return the encrypted connector wallets details with Apple Pay certificates
// Currently apple pay certifiactes are stored in the metadata which is not encrypted.
// In future we want those certificates to be encrypted and stored in the connector_wallets_details.
// As part of migration fallback this function checks apple pay details are present in connector_wallets_details
// If yes, it will encrypt connector_wallets_details and store it in the database.
// If no, it will check if apple pay details are present in metadata and merge it with connector_wallets_details, encrypt and store it.
pub async fn get_connector_wallets_details_with_apple_pay_certificates(
connector_metadata: &Option<masking::Secret<tera::Value>>,
connector_wallets_details_optional: &Option<api_models::admin::ConnectorWalletDetails>,
) -> RouterResult<Option<masking::Secret<serde_json::Value>>> {
let connector_wallet_details_with_apple_pay_metadata_optional =
get_apple_pay_metadata_if_needed(connector_metadata, connector_wallets_details_optional)
.await?;
let connector_wallets_details = connector_wallet_details_with_apple_pay_metadata_optional
.map(|details| {
serde_json::to_value(details)
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Failed to serialize Apple Pay metadata as JSON")
})
.transpose()?
.map(masking::Secret::new);
Ok(connector_wallets_details)
}
async fn get_apple_pay_metadata_if_needed(
connector_metadata: &Option<masking::Secret<tera::Value>>,
connector_wallets_details_optional: &Option<api_models::admin::ConnectorWalletDetails>,
) -> RouterResult<Option<api_models::admin::ConnectorWalletDetails>> {
if let Some(connector_wallets_details) = connector_wallets_details_optional {
if connector_wallets_details.apple_pay_combined.is_some()
|| connector_wallets_details.apple_pay.is_some()
{
return Ok(Some(connector_wallets_details.clone()));
}
// Otherwise, merge Apple Pay metadata
return get_and_merge_apple_pay_metadata(
connector_metadata.clone(),
Some(connector_wallets_details.clone()),
)
.await;
}
// If connector_wallets_details_optional is None, attempt to get Apple Pay metadata
get_and_merge_apple_pay_metadata(connector_metadata.clone(), None).await
}
async fn get_and_merge_apple_pay_metadata(
connector_metadata: Option<masking::Secret<tera::Value>>,
connector_wallets_details_optional: Option<api_models::admin::ConnectorWalletDetails>,
) -> RouterResult<Option<api_models::admin::ConnectorWalletDetails>> {
let apple_pay_metadata_optional = get_applepay_metadata(connector_metadata)
.map_err(|error| {
logger::error!(
"Apple Pay metadata parsing failed in get_encrypted_connector_wallets_details_with_apple_pay_certificates {:?}",
error
);
})
.ok();
if let Some(apple_pay_metadata) = apple_pay_metadata_optional {
let updated_wallet_details = match apple_pay_metadata {
api_models::payments::ApplepaySessionTokenMetadata::ApplePayCombined(
apple_pay_combined_metadata,
) => {
let combined_metadata_json = serde_json::to_value(apple_pay_combined_metadata)
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Failed to serialize Apple Pay combined metadata as JSON")?;
api_models::admin::ConnectorWalletDetails {
apple_pay_combined: Some(masking::Secret::new(combined_metadata_json)),
apple_pay: connector_wallets_details_optional
.as_ref()
.and_then(|d| d.apple_pay.clone()),
amazon_pay: connector_wallets_details_optional
.as_ref()
.and_then(|d| d.amazon_pay.clone()),
samsung_pay: connector_wallets_details_optional
.as_ref()
.and_then(|d| d.samsung_pay.clone()),
paze: connector_wallets_details_optional
.as_ref()
.and_then(|d| d.paze.clone()),
google_pay: connector_wallets_details_optional
.as_ref()
.and_then(|d| d.google_pay.clone()),
}
}
api_models::payments::ApplepaySessionTokenMetadata::ApplePay(apple_pay_metadata) => {
let metadata_json = serde_json::to_value(apple_pay_metadata)
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Failed to serialize Apple Pay metadata as JSON")?;
api_models::admin::ConnectorWalletDetails {
apple_pay: Some(masking::Secret::new(metadata_json)),
apple_pay_combined: connector_wallets_details_optional
.as_ref()
.and_then(|d| d.apple_pay_combined.clone()),
amazon_pay: connector_wallets_details_optional
.as_ref()
.and_then(|d| d.amazon_pay.clone()),
samsung_pay: connector_wallets_details_optional
.as_ref()
.and_then(|d| d.samsung_pay.clone()),
paze: connector_wallets_details_optional
.as_ref()
.and_then(|d| d.paze.clone()),
google_pay: connector_wallets_details_optional
.as_ref()
.and_then(|d| d.google_pay.clone()),
}
}
};
return Ok(Some(updated_wallet_details));
}
// Return connector_wallets_details if no Apple Pay metadata was found
Ok(connector_wallets_details_optional)
}
pub fn get_applepay_metadata(
connector_metadata: Option<pii::SecretSerdeValue>,
) -> RouterResult<api_models::payments::ApplepaySessionTokenMetadata> {
connector_metadata
.clone()
.parse_value::<api_models::payments::ApplepayCombinedSessionTokenData>(
"ApplepayCombinedSessionTokenData",
)
.map(|combined_metadata| {
api_models::payments::ApplepaySessionTokenMetadata::ApplePayCombined(
combined_metadata.apple_pay_combined,
)
})
.or_else(|_| {
connector_metadata
.parse_value::<api_models::payments::ApplepaySessionTokenData>(
"ApplepaySessionTokenData",
)
.map(|old_metadata| {
api_models::payments::ApplepaySessionTokenMetadata::ApplePay(
old_metadata.apple_pay,
)
})
})
.change_context(errors::ApiErrorResponse::InvalidDataFormat {
field_name: "connector_metadata".to_string(),
expected_format: "applepay_metadata_format".to_string(),
})
}
pub fn calculate_debit_routing_savings(net_amount: i64, saving_percentage: f64) -> MinorUnit {
logger::debug!(
?net_amount,
?saving_percentage,
"Calculating debit routing saving amount"
);
let net_decimal = Decimal::from_i64(net_amount).unwrap_or_else(|| {
logger::warn!(?net_amount, "Invalid net_amount, using 0");
Decimal::ZERO
});
let percentage_decimal = Decimal::from_f64(saving_percentage).unwrap_or_else(|| {
logger::warn!(?saving_percentage, "Invalid saving_percentage, using 0");
Decimal::ZERO
});
let savings_decimal = net_decimal * percentage_decimal / Decimal::from(100);
let rounded_savings = savings_decimal.round();
let savings_int = rounded_savings.to_i64().unwrap_or_else(|| {
logger::warn!(
?rounded_savings,
"Debit routing savings calculation overflowed when converting to i64"
);
0
});
MinorUnit::new(savings_int)
}
pub fn get_debit_routing_savings_amount(
payment_method_data: &domain::PaymentMethodData,
payment_attempt: &PaymentAttempt,
) -> Option<MinorUnit> {
let card_network = payment_attempt.extract_card_network()?;
let saving_percentage =
payment_method_data.extract_debit_routing_saving_percentage(&card_network)?;
let net_amount = payment_attempt.get_total_amount().get_amount_as_i64();
Some(calculate_debit_routing_savings(
net_amount,
saving_percentage,
))
}
#[cfg(all(feature = "retry", feature = "v1"))]
pub async fn get_apple_pay_retryable_connectors<F, D>(
state: &SessionState,
merchant_context: &domain::MerchantContext,
payment_data: &D,
pre_routing_connector_data_list: &[api::ConnectorRoutingData],
merchant_connector_id: Option<&id_type::MerchantConnectorAccountId>,
business_profile: domain::Profile,
) -> CustomResult<Option<Vec<api::ConnectorRoutingData>>, errors::ApiErrorResponse>
where
F: Send + Clone,
D: payments::OperationSessionGetters<F> + Send,
{
let profile_id = business_profile.get_id();
let pre_decided_connector_data_first = pre_routing_connector_data_list
.first()
.ok_or(errors::ApiErrorResponse::IncorrectPaymentMethodConfiguration)?;
let merchant_connector_account_type = get_merchant_connector_account(
state,
merchant_context.get_merchant_account().get_id(),
payment_data.get_creds_identifier(),
merchant_context.get_merchant_key_store(),
profile_id,
&pre_decided_connector_data_first
.connector_data
.connector_name
.to_string(),
merchant_connector_id,
)
.await?;
let connector_data_list = if is_apple_pay_simplified_flow(
merchant_connector_account_type.get_metadata(),
merchant_connector_account_type
.get_connector_name()
.as_ref(),
)? {
let merchant_connector_account_list = state
.store
.find_merchant_connector_account_by_merchant_id_and_disabled_list(
&state.into(),
merchant_context.get_merchant_account().get_id(),
false,
merchant_context.get_merchant_key_store(),
)
.await
.to_not_found_response(errors::ApiErrorResponse::InternalServerError)?;
let profile_specific_merchant_connector_account_list = merchant_connector_account_list
.filter_based_on_profile_and_connector_type(
profile_id,
ConnectorType::PaymentProcessor,
);
let mut connector_data_list = vec![pre_decided_connector_data_first.clone()];
for merchant_connector_account in profile_specific_merchant_connector_account_list {
if is_apple_pay_simplified_flow(
merchant_connector_account.metadata.clone(),
Some(&merchant_connector_account.connector_name),
)? {
let routing_data: api::ConnectorRoutingData =
api::ConnectorData::get_connector_by_name(
&state.conf.connectors,
&merchant_connector_account.connector_name.to_string(),
api::GetToken::Connector,
Some(merchant_connector_account.get_id()),
)
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Invalid connector name received")?
.into();
if !connector_data_list.iter().any(|connector_details| {
connector_details.connector_data.merchant_connector_id
== routing_data.connector_data.merchant_connector_id
}) {
connector_data_list.push(routing_data)
}
}
}
#[cfg(feature = "v1")]
let fallback_connetors_list = crate::core::routing::helpers::get_merchant_default_config(
&*state.clone().store,
profile_id.get_string_repr(),
&api_enums::TransactionType::Payment,
)
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Failed to get merchant default fallback connectors config")?;
let mut routing_connector_data_list = Vec::new();
pre_routing_connector_data_list.iter().for_each(|pre_val| {
routing_connector_data_list.push(pre_val.connector_data.merchant_connector_id.clone())
});
fallback_connetors_list.iter().for_each(|fallback_val| {
routing_connector_data_list
.iter()
.all(|val| *val != fallback_val.merchant_connector_id)
.then(|| {
routing_connector_data_list.push(fallback_val.merchant_connector_id.clone())
});
});
// connector_data_list is the list of connectors for which Apple Pay simplified flow is configured.
// This list is arranged in the same order as the merchant's connectors routingconfiguration.
let mut ordered_connector_data_list = Vec::new();
routing_connector_data_list
.iter()
.for_each(|merchant_connector_id| {
let connector_data = connector_data_list.iter().find(|connector_data| {
*merchant_connector_id == connector_data.connector_data.merchant_connector_id
});
if let Some(connector_data_details) = connector_data {
ordered_connector_data_list.push(connector_data_details.clone());
}
});
Some(ordered_connector_data_list)
} else {
None
};
Ok(connector_data_list)
}
#[derive(Debug, Serialize, Deserialize)]
pub struct ApplePayData {
version: masking::Secret<String>,
data: masking::Secret<String>,
signature: masking::Secret<String>,
header: ApplePayHeader,
}
#[derive(Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ApplePayHeader {
ephemeral_public_key: masking::Secret<String>,
public_key_hash: masking::Secret<String>,
transaction_id: masking::Secret<String>,
}
impl ApplePayData {
pub fn token_json(
wallet_data: domain::WalletData,
) -> CustomResult<Self, errors::ConnectorError> {
let json_wallet_data: Self = connector::utils::WalletData::get_wallet_token_as_json(
&wallet_data,
"Apple Pay".to_string(),
)?;
Ok(json_wallet_data)
}
pub async fn decrypt(
&self,
payment_processing_certificate: &masking::Secret<String>,
payment_processing_certificate_key: &masking::Secret<String>,
) -> CustomResult<serde_json::Value, errors::ApplePayDecryptionError> {
let merchant_id = self.merchant_id(payment_processing_certificate)?;
let shared_secret = self.shared_secret(payment_processing_certificate_key)?;
let symmetric_key = self.symmetric_key(&merchant_id, &shared_secret)?;
let decrypted = self.decrypt_ciphertext(&symmetric_key)?;
let parsed_decrypted: serde_json::Value = serde_json::from_str(&decrypted)
.change_context(errors::ApplePayDecryptionError::DecryptionFailed)?;
Ok(parsed_decrypted)
}
pub fn merchant_id(
&self,
payment_processing_certificate: &masking::Secret<String>,
) -> CustomResult<String, errors::ApplePayDecryptionError> {
let cert_data = payment_processing_certificate.clone().expose();
let base64_decode_cert_data = BASE64_ENGINE
.decode(cert_data)
.change_context(errors::ApplePayDecryptionError::Base64DecodingFailed)?;
// Parsing the certificate using x509-parser
let (_, certificate) = parse_x509_certificate(&base64_decode_cert_data)
.change_context(errors::ApplePayDecryptionError::CertificateParsingFailed)
.attach_printable("Error parsing apple pay PPC")?;
// Finding the merchant ID extension
let apple_pay_m_id = certificate
.extensions()
.iter()
.find(|extension| {
extension
.oid
.to_string()
.eq(consts::MERCHANT_ID_FIELD_EXTENSION_ID)
})
.map(|ext| {
let merchant_id = String::from_utf8_lossy(ext.value)
.trim()
.trim_start_matches('@')
.to_string();
merchant_id
})
.ok_or(errors::ApplePayDecryptionError::MissingMerchantId)
.attach_printable("Unable to find merchant ID extension in the certificate")?;
Ok(apple_pay_m_id)
}
pub fn shared_secret(
&self,
payment_processing_certificate_key: &masking::Secret<String>,
) -> CustomResult<Vec<u8>, errors::ApplePayDecryptionError> {
let public_ec_bytes = BASE64_ENGINE
.decode(self.header.ephemeral_public_key.peek().as_bytes())
.change_context(errors::ApplePayDecryptionError::Base64DecodingFailed)?;
let public_key = PKey::public_key_from_der(&public_ec_bytes)
.change_context(errors::ApplePayDecryptionError::KeyDeserializationFailed)
.attach_printable("Failed to deserialize the public key")?;
let decrypted_apple_pay_ppc_key = payment_processing_certificate_key.clone().expose();
// Create PKey objects from EcKey
let private_key = PKey::private_key_from_pem(decrypted_apple_pay_ppc_key.as_bytes())
.change_context(errors::ApplePayDecryptionError::KeyDeserializationFailed)
.attach_printable("Failed to deserialize the private key")?;
// Create the Deriver object and set the peer public key
let mut deriver = Deriver::new(&private_key)
.change_context(errors::ApplePayDecryptionError::DerivingSharedSecretKeyFailed)
.attach_printable("Failed to create a deriver for the private key")?;
deriver
.set_peer(&public_key)
.change_context(errors::ApplePayDecryptionError::DerivingSharedSecretKeyFailed)
.attach_printable("Failed to set the peer key for the secret derivation")?;
// Compute the shared secret
let shared_secret = deriver
.derive_to_vec()
.change_context(errors::ApplePayDecryptionError::DerivingSharedSecretKeyFailed)
.attach_printable("Final key derivation failed")?;
Ok(shared_secret)
}
pub fn symmetric_key(
&self,
merchant_id: &str,
shared_secret: &[u8],
) -> CustomResult<Vec<u8>, errors::ApplePayDecryptionError> {
let kdf_algorithm = b"\x0did-aes256-GCM";
let kdf_party_v = hex::decode(merchant_id)
.change_context(errors::ApplePayDecryptionError::Base64DecodingFailed)?;
let kdf_party_u = b"Apple";
let kdf_info = [&kdf_algorithm[..], kdf_party_u, &kdf_party_v[..]].concat();
let mut hash = openssl::sha::Sha256::new();
hash.update(b"\x00\x00\x00");
hash.update(b"\x01");
hash.update(shared_secret);
hash.update(&kdf_info[..]);
let symmetric_key = hash.finish();
Ok(symmetric_key.to_vec())
}
pub fn decrypt_ciphertext(
&self,
symmetric_key: &[u8],
) -> CustomResult<String, errors::ApplePayDecryptionError> {
logger::info!("Decrypt apple pay token");
let data = BASE64_ENGINE
.decode(self.data.peek().as_bytes())
.change_context(errors::ApplePayDecryptionError::Base64DecodingFailed)?;
let iv = [0u8; 16]; //Initialization vector IV is typically used in AES-GCM (Galois/Counter Mode) encryption for randomizing the encryption process.
let ciphertext = data
.get(..data.len() - 16)
.ok_or(errors::ApplePayDecryptionError::DecryptionFailed)?;
let tag = data
.get(data.len() - 16..)
.ok_or(errors::ApplePayDecryptionError::DecryptionFailed)?;
let cipher = Cipher::aes_256_gcm();
let decrypted_data = decrypt_aead(cipher, symmetric_key, Some(&iv), &[], ciphertext, tag)
.change_context(errors::ApplePayDecryptionError::DecryptionFailed)?;
let decrypted = String::from_utf8(decrypted_data)
.change_context(errors::ApplePayDecryptionError::DecryptionFailed)?;
Ok(decrypted)
}
}
// Structs for keys and the main decryptor
pub struct GooglePayTokenDecryptor {
root_signing_keys: Vec<GooglePayRootSigningKey>,
recipient_id: masking::Secret<String>,
private_key: PKey<openssl::pkey::Private>,
}
#[derive(Debug, Clone, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct EncryptedData {
signature: String,
intermediate_signing_key: IntermediateSigningKey,
protocol_version: GooglePayProtocolVersion,
#[serde(with = "common_utils::custom_serde::json_string")]
signed_message: GooglePaySignedMessage,
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct GooglePaySignedMessage {
#[serde(with = "common_utils::Base64Serializer")]
encrypted_message: masking::Secret<Vec<u8>>,
#[serde(with = "common_utils::Base64Serializer")]
ephemeral_public_key: masking::Secret<Vec<u8>>,
#[serde(with = "common_utils::Base64Serializer")]
tag: masking::Secret<Vec<u8>>,
}
#[derive(Debug, Clone, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct IntermediateSigningKey {
signed_key: masking::Secret<String>,
signatures: Vec<masking::Secret<String>>,
}
#[derive(Debug, Clone, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct GooglePaySignedKey {
key_value: masking::Secret<String>,
key_expiration: String,
}
#[derive(Debug, Clone, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct GooglePayRootSigningKey {
key_value: masking::Secret<String>,
key_expiration: String,
protocol_version: GooglePayProtocolVersion,
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, Eq, PartialEq)]
pub enum GooglePayProtocolVersion {
#[serde(rename = "ECv2")]
EcProtocolVersion2,
}
// Check expiration date validity
fn check_expiration_date_is_valid(
expiration: &str,
) -> CustomResult<bool, errors::GooglePayDecryptionError> {
let expiration_ms = expiration
.parse::<i128>()
.change_context(errors::GooglePayDecryptionError::InvalidExpirationTime)?;
// convert milliseconds to nanoseconds (1 millisecond = 1_000_000 nanoseconds) to create OffsetDateTime
let expiration_time =
time::OffsetDateTime::from_unix_timestamp_nanos(expiration_ms * 1_000_000)
.change_context(errors::GooglePayDecryptionError::InvalidExpirationTime)?;
let now = time::OffsetDateTime::now_utc();
Ok(expiration_time > now)
}
// Construct little endian format of u32
fn get_little_endian_format(number: u32) -> Vec<u8> {
number.to_le_bytes().to_vec()
}
// Filter and parse the root signing keys based on protocol version and expiration time
fn filter_root_signing_keys(
root_signing_keys: Vec<GooglePayRootSigningKey>,
) -> CustomResult<Vec<GooglePayRootSigningKey>, errors::GooglePayDecryptionError> {
let filtered_root_signing_keys = root_signing_keys
.iter()
.filter(|key| {
key.protocol_version == GooglePayProtocolVersion::EcProtocolVersion2
&& matches!(
check_expiration_date_is_valid(&key.key_expiration).inspect_err(
|err| logger::warn!(
"Failed to check expirattion due to invalid format: {:?}",
err
)
),
Ok(true)
)
})
.cloned()
.collect::<Vec<GooglePayRootSigningKey>>();
logger::info!(
"Filtered {} out of {} root signing keys",
filtered_root_signing_keys.len(),
root_signing_keys.len()
);
Ok(filtered_root_signing_keys)
}
impl GooglePayTokenDecryptor {
pub fn new(
root_keys: masking::Secret<String>,
recipient_id: masking::Secret<String>,
private_key: masking::Secret<String>,
) -> CustomResult<Self, errors::GooglePayDecryptionError> {
// base64 decode the private key
let decoded_key = BASE64_ENGINE
.decode(private_key.expose())
.change_context(errors::GooglePayDecryptionError::Base64DecodingFailed)?;
// base64 decode the root signing keys
let decoded_root_signing_keys = BASE64_ENGINE
.decode(root_keys.expose())
.change_context(errors::GooglePayDecryptionError::Base64DecodingFailed)?;
// create a private key from the decoded key
let private_key = PKey::private_key_from_pkcs8(&decoded_key)
.change_context(errors::GooglePayDecryptionError::KeyDeserializationFailed)
.attach_printable("cannot convert private key from decode_key")?;
// parse the root signing keys
let root_keys_vector: Vec<GooglePayRootSigningKey> = decoded_root_signing_keys
.parse_struct("GooglePayRootSigningKey")
.change_context(errors::GooglePayDecryptionError::DeserializationFailed)?;
// parse and filter the root signing keys by protocol version
let filtered_root_signing_keys = filter_root_signing_keys(root_keys_vector)?;
Ok(Self {
root_signing_keys: filtered_root_signing_keys,
recipient_id,
private_key,
})
}
// Decrypt the Google pay token
pub fn decrypt_token(
&self,
data: String,
should_verify_signature: bool,
) -> CustomResult<
hyperswitch_domain_models::router_data::GooglePayPredecryptDataInternal,
errors::GooglePayDecryptionError,
> {
// parse the encrypted data
let encrypted_data: EncryptedData = data
.parse_struct("EncryptedData")
.change_context(errors::GooglePayDecryptionError::DeserializationFailed)?;
// verify the signature if required
if should_verify_signature {
self.verify_signature(&encrypted_data)?;
}
let ephemeral_public_key = encrypted_data.signed_message.ephemeral_public_key.peek();
let tag = encrypted_data.signed_message.tag.peek();
let encrypted_message = encrypted_data.signed_message.encrypted_message.peek();
// derive the shared key
let shared_key = self.get_shared_key(ephemeral_public_key)?;
// derive the symmetric encryption key and MAC key
let derived_key = self.derive_key(ephemeral_public_key, &shared_key)?;
// First 32 bytes for AES-256 and Remaining bytes for HMAC
let (symmetric_encryption_key, mac_key) = derived_key
.split_at_checked(32)
.ok_or(errors::GooglePayDecryptionError::ParsingFailed)?;
// verify the HMAC of the message
self.verify_hmac(mac_key, tag, encrypted_message)?;
// decrypt the message
let decrypted = self.decrypt_message(symmetric_encryption_key, encrypted_message)?;
// parse the decrypted data
let decrypted_data: hyperswitch_domain_models::router_data::GooglePayPredecryptDataInternal =
decrypted
.parse_struct("GooglePayPredecryptDataInternal")
.change_context(errors::GooglePayDecryptionError::DeserializationFailed)?;
// check the expiration date of the decrypted data
if matches!(
check_expiration_date_is_valid(&decrypted_data.message_expiration),
Ok(true)
) {
Ok(decrypted_data)
} else {
Err(errors::GooglePayDecryptionError::DecryptedTokenExpired.into())
}
}
// Verify the signature of the token
fn verify_signature(
&self,
encrypted_data: &EncryptedData,
) -> CustomResult<(), errors::GooglePayDecryptionError> {
// check the protocol version
if encrypted_data.protocol_version != GooglePayProtocolVersion::EcProtocolVersion2 {
return Err(errors::GooglePayDecryptionError::InvalidProtocolVersion.into());
}
// verify the intermediate signing key
self.verify_intermediate_signing_key(encrypted_data)?;
// validate and fetch the signed key
let signed_key = self.validate_signed_key(&encrypted_data.intermediate_signing_key)?;
// verify the signature of the token
self.verify_message_signature(encrypted_data, &signed_key)
}
|
crates/router/src/core/payments/helpers.rs#chunk5
|
router
|
chunk
| null | null | null | 8,190
| null | null | null | null | null | null | null |
// File: crates/router/src/consts/user_role.rs
// Module: router
// User Roles
pub const ROLE_ID_MERCHANT_ADMIN: &str = "merchant_admin";
pub const ROLE_ID_MERCHANT_VIEW_ONLY: &str = "merchant_view_only";
pub const ROLE_ID_MERCHANT_IAM_ADMIN: &str = "merchant_iam_admin";
pub const ROLE_ID_MERCHANT_DEVELOPER: &str = "merchant_developer";
pub const ROLE_ID_MERCHANT_OPERATOR: &str = "merchant_operator";
pub const ROLE_ID_MERCHANT_CUSTOMER_SUPPORT: &str = "merchant_customer_support";
pub const ROLE_ID_PROFILE_ADMIN: &str = "profile_admin";
pub const ROLE_ID_PROFILE_VIEW_ONLY: &str = "profile_view_only";
pub const ROLE_ID_PROFILE_IAM_ADMIN: &str = "profile_iam_admin";
pub const ROLE_ID_PROFILE_DEVELOPER: &str = "profile_developer";
pub const ROLE_ID_PROFILE_OPERATOR: &str = "profile_operator";
pub const ROLE_ID_PROFILE_CUSTOMER_SUPPORT: &str = "profile_customer_support";
pub const INTERNAL_USER_MERCHANT_ID: &str = "juspay000";
pub const MAX_ROLE_NAME_LENGTH: usize = 64;
|
crates/router/src/consts/user_role.rs
|
router
|
full_file
| null | null | null | 249
| null | null | null | null | null | null | null |
// Trait: SdkEventMetricAccumulator
// File: crates/analytics/src/sdk_events/accumulator.rs
// Module: analytics
pub trait SdkEventMetricAccumulator
|
crates/analytics/src/sdk_events/accumulator.rs
|
analytics
|
trait_definition
| null | null | null | 38
| null | null |
SdkEventMetricAccumulator
| null | null | null | null |
// Function: add_payment_method_status_update_task
// File: crates/router/src/core/payment_methods.rs
// Module: router
pub fn add_payment_method_status_update_task(
db: &dyn StorageInterface,
payment_method: &domain::PaymentMethod,
prev_status: enums::PaymentMethodStatus,
curr_status: enums::PaymentMethodStatus,
merchant_id: &id_type::MerchantId,
) -> Result<(), ProcessTrackerError>
|
crates/router/src/core/payment_methods.rs
|
router
|
function_signature
| null | null | null | 92
|
add_payment_method_status_update_task
| null | null | null | null | null | null |
// Implementation: impl api::PaymentSync for for Moneris
// File: crates/hyperswitch_connectors/src/connectors/moneris.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::PaymentSync for for Moneris
|
crates/hyperswitch_connectors/src/connectors/moneris.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 61
| null |
Moneris
|
api::PaymentSync for
| 0
| 0
| null | null |
// Struct: FeatureMatrixRequest
// File: crates/api_models/src/feature_matrix.rs
// Module: api_models
// Implementations: 1
// Traits: common_utils::events::ApiEventMetric
pub struct FeatureMatrixRequest
|
crates/api_models/src/feature_matrix.rs
|
api_models
|
struct_definition
|
FeatureMatrixRequest
| 1
|
[
"common_utils::events::ApiEventMetric"
] | 49
| null | null | null | null | null | null | null |
// Struct: EcommerceCardPaymentOnlyResponseData
// File: crates/hyperswitch_connectors/src/connectors/peachpayments/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct EcommerceCardPaymentOnlyResponseData
|
crates/hyperswitch_connectors/src/connectors/peachpayments/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
EcommerceCardPaymentOnlyResponseData
| 0
|
[] | 57
| null | null | null | null | null | null | null |
// Implementation: impl Responder
// File: crates/router/src/routes/payments.rs
// Module: router
// Methods: 0 total (0 public)
impl Responder
|
crates/router/src/routes/payments.rs
|
router
|
impl_block
| null | null | null | 36
| null |
Responder
| null | 0
| 0
| null | null |
// Implementation: impl api::PaymentCapture for for Gigadat
// File: crates/hyperswitch_connectors/src/connectors/gigadat.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::PaymentCapture for for Gigadat
|
crates/hyperswitch_connectors/src/connectors/gigadat.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 61
| null |
Gigadat
|
api::PaymentCapture for
| 0
| 0
| null | null |
// Struct: IatapayAuthUpdateResponse
// File: crates/hyperswitch_connectors/src/connectors/iatapay/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct IatapayAuthUpdateResponse
|
crates/hyperswitch_connectors/src/connectors/iatapay/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
IatapayAuthUpdateResponse
| 0
|
[] | 57
| null | null | null | null | null | null | null |
// Struct: MandateResponseBody
// File: crates/hyperswitch_connectors/src/connectors/bamboraapac/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct MandateResponseBody
|
crates/hyperswitch_connectors/src/connectors/bamboraapac/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
MandateResponseBody
| 0
|
[] | 50
| null | null | null | null | null | null | null |
// Function: validate
// File: crates/external_services/src/grpc_client/revenue_recovery/recovery_decider_client.rs
// Module: external_services
// Documentation: Validate the configuration
pub fn validate(&self) -> Result<(), RecoveryDeciderError>
|
crates/external_services/src/grpc_client/revenue_recovery/recovery_decider_client.rs
|
external_services
|
function_signature
| null | null | null | 52
|
validate
| null | null | null | null | null | null |
// Struct: IatapayAccessTokenErrorResponse
// File: crates/hyperswitch_connectors/src/connectors/iatapay/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct IatapayAccessTokenErrorResponse
|
crates/hyperswitch_connectors/src/connectors/iatapay/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
IatapayAccessTokenErrorResponse
| 0
|
[] | 55
| null | null | null | null | null | null | null |
// Function: generate_digest
// File: crates/hyperswitch_connectors/src/connectors/wellsfargo.rs
// Module: hyperswitch_connectors
pub fn generate_digest(&self, payload: &[u8]) -> String
|
crates/hyperswitch_connectors/src/connectors/wellsfargo.rs
|
hyperswitch_connectors
|
function_signature
| null | null | null | 48
|
generate_digest
| null | null | null | null | null | null |
// Struct: FrmFulfillmentSignifydRequest
// File: crates/hyperswitch_connectors/src/connectors/signifyd/transformers/api.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct FrmFulfillmentSignifydRequest
|
crates/hyperswitch_connectors/src/connectors/signifyd/transformers/api.rs
|
hyperswitch_connectors
|
struct_definition
|
FrmFulfillmentSignifydRequest
| 0
|
[] | 59
| null | null | null | null | null | null | null |
// Implementation: impl api::RefundSync for for Datatrans
// File: crates/hyperswitch_connectors/src/connectors/datatrans.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::RefundSync for for Datatrans
|
crates/hyperswitch_connectors/src/connectors/datatrans.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 62
| null |
Datatrans
|
api::RefundSync for
| 0
| 0
| null | null |
// File: crates/router/src/core/currency.rs
// Module: router
// Public functions: 3
use analytics::errors::AnalyticsError;
use common_utils::errors::CustomResult;
use currency_conversion::types::ExchangeRates;
use error_stack::ResultExt;
use router_env::logger;
use crate::{
consts::DEFAULT_ANALYTICS_FOREX_RETRY_ATTEMPTS,
core::errors::ApiErrorResponse,
services::ApplicationResponse,
utils::currency::{self, convert_currency, get_forex_rates, ForexError as ForexCacheError},
SessionState,
};
pub async fn retrieve_forex(
state: SessionState,
) -> CustomResult<ApplicationResponse<currency::FxExchangeRatesCacheEntry>, ApiErrorResponse> {
let forex_api = state.conf.forex_api.get_inner();
Ok(ApplicationResponse::Json(
get_forex_rates(&state, forex_api.data_expiration_delay_in_seconds)
.await
.change_context(ApiErrorResponse::GenericNotFoundError {
message: "Unable to fetch forex rates".to_string(),
})?,
))
}
pub async fn convert_forex(
state: SessionState,
amount: i64,
to_currency: String,
from_currency: String,
) -> CustomResult<
ApplicationResponse<api_models::currency::CurrencyConversionResponse>,
ApiErrorResponse,
> {
Ok(ApplicationResponse::Json(
Box::pin(convert_currency(
state.clone(),
amount,
to_currency,
from_currency,
))
.await
.change_context(ApiErrorResponse::InternalServerError)?,
))
}
pub async fn get_forex_exchange_rates(
state: SessionState,
) -> CustomResult<ExchangeRates, AnalyticsError> {
let forex_api = state.conf.forex_api.get_inner();
let mut attempt = 1;
logger::info!("Starting forex exchange rates fetch");
loop {
logger::info!("Attempting to fetch forex rates - Attempt {attempt} of {DEFAULT_ANALYTICS_FOREX_RETRY_ATTEMPTS}");
match get_forex_rates(&state, forex_api.data_expiration_delay_in_seconds).await {
Ok(rates) => {
logger::info!("Successfully fetched forex rates");
return Ok((*rates.data).clone());
}
Err(error) => {
let is_retryable = matches!(
error.current_context(),
ForexCacheError::CouldNotAcquireLock
| ForexCacheError::EntryNotFound
| ForexCacheError::ForexDataUnavailable
| ForexCacheError::LocalReadError
| ForexCacheError::LocalWriteError
| ForexCacheError::RedisConnectionError
| ForexCacheError::RedisLockReleaseFailed
| ForexCacheError::RedisWriteError
| ForexCacheError::WriteLockNotAcquired
);
if !is_retryable {
return Err(error.change_context(AnalyticsError::ForexFetchFailed));
}
if attempt >= DEFAULT_ANALYTICS_FOREX_RETRY_ATTEMPTS {
logger::error!("Failed to fetch forex rates after {DEFAULT_ANALYTICS_FOREX_RETRY_ATTEMPTS} attempts");
return Err(error.change_context(AnalyticsError::ForexFetchFailed));
}
logger::warn!(
"Forex rates fetch failed with retryable error, retrying in {attempt} seconds"
);
tokio::time::sleep(std::time::Duration::from_secs(attempt * 2)).await;
attempt += 1;
}
}
}
}
|
crates/router/src/core/currency.rs
|
router
|
full_file
| null | null | null | 723
| null | null | null | null | null | null | null |
// Implementation: impl PaymentMethod
// File: crates/diesel_models/src/payment_method.rs
// Module: diesel_models
// Methods: 2 total (2 public)
impl PaymentMethod
|
crates/diesel_models/src/payment_method.rs
|
diesel_models
|
impl_block
| null | null | null | 38
| null |
PaymentMethod
| null | 2
| 2
| null | null |
// Struct: ResetTrackingIdRequest
// File: crates/api_models/src/connector_onboarding.rs
// Module: api_models
// Implementations: 0
pub struct ResetTrackingIdRequest
|
crates/api_models/src/connector_onboarding.rs
|
api_models
|
struct_definition
|
ResetTrackingIdRequest
| 0
|
[] | 40
| null | null | null | null | null | null | null |
// Module Structure
// File: crates/hyperswitch_connectors/src/connectors/paysafe.rs
// Module: hyperswitch_connectors
// Public submodules:
pub mod transformers;
|
crates/hyperswitch_connectors/src/connectors/paysafe.rs
|
hyperswitch_connectors
|
module_structure
| null | null | null | 39
| null | null | null | null | null | 1
| 0
|
// Struct: CustomerBody
// File: crates/hyperswitch_connectors/src/connectors/braintree/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct CustomerBody
|
crates/hyperswitch_connectors/src/connectors/braintree/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
CustomerBody
| 0
|
[] | 46
| null | null | null | null | null | null | null |
// File: crates/router/src/compatibility/stripe/webhooks.rs
// Module: router
// Public structs: 4
#[cfg(feature = "payouts")]
use api_models::payouts as payout_models;
use api_models::{
enums::{Currency, DisputeStatus, MandateStatus},
webhooks::{self as api},
};
use common_utils::{crypto::SignMessage, date_time, ext_traits::Encode};
#[cfg(feature = "payouts")]
use common_utils::{
id_type,
pii::{self, Email},
};
use error_stack::ResultExt;
use router_env::logger;
use serde::Serialize;
use super::{
payment_intents::types::StripePaymentIntentResponse, refunds::types::StripeRefundResponse,
};
use crate::{
core::{
errors,
webhooks::types::{OutgoingWebhookPayloadWithSignature, OutgoingWebhookType},
},
headers,
services::request::Maskable,
};
#[derive(Serialize, Debug)]
pub struct StripeOutgoingWebhook {
id: String,
#[serde(rename = "type")]
stype: &'static str,
object: &'static str,
data: StripeWebhookObject,
created: u64,
// api_version: "2019-11-05", // not used
}
impl OutgoingWebhookType for StripeOutgoingWebhook {
fn get_outgoing_webhooks_signature(
&self,
payment_response_hash_key: Option<impl AsRef<[u8]>>,
) -> errors::CustomResult<OutgoingWebhookPayloadWithSignature, errors::WebhooksFlowError> {
let timestamp = self.created;
let payment_response_hash_key = payment_response_hash_key
.ok_or(errors::WebhooksFlowError::MerchantConfigNotFound)
.attach_printable("For stripe compatibility payment_response_hash_key is mandatory")?;
let webhook_signature_payload = self
.encode_to_string_of_json()
.change_context(errors::WebhooksFlowError::OutgoingWebhookEncodingFailed)
.attach_printable("failed encoding outgoing webhook payload")?;
let new_signature_payload = format!("{timestamp}.{webhook_signature_payload}");
let v1 = hex::encode(
common_utils::crypto::HmacSha256::sign_message(
&common_utils::crypto::HmacSha256,
payment_response_hash_key.as_ref(),
new_signature_payload.as_bytes(),
)
.change_context(errors::WebhooksFlowError::OutgoingWebhookSigningFailed)
.attach_printable("Failed to sign the message")?,
);
let t = timestamp;
let signature = Some(format!("t={t},v1={v1}"));
Ok(OutgoingWebhookPayloadWithSignature {
payload: webhook_signature_payload.into(),
signature,
})
}
fn add_webhook_header(header: &mut Vec<(String, Maskable<String>)>, signature: String) {
header.push((
headers::STRIPE_COMPATIBLE_WEBHOOK_SIGNATURE.to_string(),
signature.into(),
))
}
}
#[derive(Serialize, Debug)]
#[serde(tag = "type", content = "object", rename_all = "snake_case")]
pub enum StripeWebhookObject {
PaymentIntent(Box<StripePaymentIntentResponse>),
Refund(StripeRefundResponse),
Dispute(StripeDisputeResponse),
Mandate(StripeMandateResponse),
#[cfg(feature = "payouts")]
Payout(StripePayoutResponse),
}
#[derive(Serialize, Debug)]
pub struct StripeDisputeResponse {
pub id: String,
pub amount: String,
pub currency: Currency,
pub payment_intent: id_type::PaymentId,
pub reason: Option<String>,
pub status: StripeDisputeStatus,
}
#[derive(Serialize, Debug)]
pub struct StripeMandateResponse {
pub mandate_id: String,
pub status: StripeMandateStatus,
pub payment_method_id: String,
pub payment_method: String,
}
#[cfg(feature = "payouts")]
#[derive(Clone, Serialize, Debug)]
pub struct StripePayoutResponse {
pub id: id_type::PayoutId,
pub amount: i64,
pub currency: String,
pub payout_type: Option<common_enums::PayoutType>,
pub status: StripePayoutStatus,
pub name: Option<masking::Secret<String>>,
pub email: Option<Email>,
pub phone: Option<masking::Secret<String>>,
pub phone_country_code: Option<String>,
pub created: Option<i64>,
pub metadata: Option<pii::SecretSerdeValue>,
pub entity_type: common_enums::PayoutEntityType,
pub recurring: bool,
pub error_message: Option<String>,
pub error_code: Option<String>,
}
#[cfg(feature = "payouts")]
#[derive(Clone, Serialize, Debug)]
#[serde(rename_all = "snake_case")]
pub enum StripePayoutStatus {
PayoutSuccess,
PayoutFailure,
PayoutProcessing,
PayoutCancelled,
PayoutInitiated,
PayoutExpired,
PayoutReversed,
}
#[cfg(feature = "payouts")]
impl From<common_enums::PayoutStatus> for StripePayoutStatus {
fn from(status: common_enums::PayoutStatus) -> Self {
match status {
common_enums::PayoutStatus::Success => Self::PayoutSuccess,
common_enums::PayoutStatus::Failed => Self::PayoutFailure,
common_enums::PayoutStatus::Cancelled => Self::PayoutCancelled,
common_enums::PayoutStatus::Initiated => Self::PayoutInitiated,
common_enums::PayoutStatus::Expired => Self::PayoutExpired,
common_enums::PayoutStatus::Reversed => Self::PayoutReversed,
common_enums::PayoutStatus::Pending
| common_enums::PayoutStatus::Ineligible
| common_enums::PayoutStatus::RequiresCreation
| common_enums::PayoutStatus::RequiresFulfillment
| common_enums::PayoutStatus::RequiresPayoutMethodData
| common_enums::PayoutStatus::RequiresVendorAccountCreation
| common_enums::PayoutStatus::RequiresConfirmation => Self::PayoutProcessing,
}
}
}
#[cfg(feature = "payouts")]
impl From<payout_models::PayoutCreateResponse> for StripePayoutResponse {
fn from(res: payout_models::PayoutCreateResponse) -> Self {
let (name, email, phone, phone_country_code) = match res.customer {
Some(customer) => (
customer.name,
customer.email,
customer.phone,
customer.phone_country_code,
),
None => (None, None, None, None),
};
Self {
id: res.payout_id,
amount: res.amount.get_amount_as_i64(),
currency: res.currency.to_string(),
payout_type: res.payout_type,
status: StripePayoutStatus::from(res.status),
name,
email,
phone,
phone_country_code,
created: res.created.map(|t| t.assume_utc().unix_timestamp()),
metadata: res.metadata,
entity_type: res.entity_type,
recurring: res.recurring,
error_message: res.error_message,
error_code: res.error_code,
}
}
}
#[derive(Serialize, Debug)]
#[serde(rename_all = "snake_case")]
pub enum StripeMandateStatus {
Active,
Inactive,
Pending,
}
#[derive(Serialize, Debug)]
#[serde(rename_all = "snake_case")]
pub enum StripeDisputeStatus {
WarningNeedsResponse,
WarningUnderReview,
WarningClosed,
NeedsResponse,
UnderReview,
ChargeRefunded,
Won,
Lost,
}
impl From<api_models::disputes::DisputeResponse> for StripeDisputeResponse {
fn from(res: api_models::disputes::DisputeResponse) -> Self {
Self {
id: res.dispute_id,
amount: res.amount.to_string(),
currency: res.currency,
payment_intent: res.payment_id,
reason: res.connector_reason,
status: StripeDisputeStatus::from(res.dispute_status),
}
}
}
impl From<api_models::mandates::MandateResponse> for StripeMandateResponse {
fn from(res: api_models::mandates::MandateResponse) -> Self {
Self {
mandate_id: res.mandate_id,
payment_method: res.payment_method,
payment_method_id: res.payment_method_id,
status: StripeMandateStatus::from(res.status),
}
}
}
impl From<MandateStatus> for StripeMandateStatus {
fn from(status: MandateStatus) -> Self {
match status {
MandateStatus::Active => Self::Active,
MandateStatus::Inactive | MandateStatus::Revoked => Self::Inactive,
MandateStatus::Pending => Self::Pending,
}
}
}
impl From<DisputeStatus> for StripeDisputeStatus {
fn from(status: DisputeStatus) -> Self {
match status {
DisputeStatus::DisputeOpened => Self::WarningNeedsResponse,
DisputeStatus::DisputeExpired => Self::Lost,
DisputeStatus::DisputeAccepted => Self::Lost,
DisputeStatus::DisputeCancelled => Self::WarningClosed,
DisputeStatus::DisputeChallenged => Self::WarningUnderReview,
DisputeStatus::DisputeWon => Self::Won,
DisputeStatus::DisputeLost => Self::Lost,
}
}
}
fn get_stripe_event_type(event_type: api_models::enums::EventType) -> &'static str {
match event_type {
api_models::enums::EventType::PaymentSucceeded => "payment_intent.succeeded",
api_models::enums::EventType::PaymentFailed => "payment_intent.payment_failed",
api_models::enums::EventType::PaymentProcessing
| api_models::enums::EventType::PaymentPartiallyAuthorized => "payment_intent.processing",
api_models::enums::EventType::PaymentCancelled
| api_models::enums::EventType::PaymentCancelledPostCapture
| api_models::enums::EventType::PaymentExpired => "payment_intent.canceled",
// the below are not really stripe compatible because stripe doesn't provide this
api_models::enums::EventType::ActionRequired => "action.required",
api_models::enums::EventType::RefundSucceeded => "refund.succeeded",
api_models::enums::EventType::RefundFailed => "refund.failed",
api_models::enums::EventType::DisputeOpened => "dispute.failed",
api_models::enums::EventType::DisputeExpired => "dispute.expired",
api_models::enums::EventType::DisputeAccepted => "dispute.accepted",
api_models::enums::EventType::DisputeCancelled => "dispute.cancelled",
api_models::enums::EventType::DisputeChallenged => "dispute.challenged",
api_models::enums::EventType::DisputeWon => "dispute.won",
api_models::enums::EventType::DisputeLost => "dispute.lost",
api_models::enums::EventType::MandateActive => "mandate.active",
api_models::enums::EventType::MandateRevoked => "mandate.revoked",
// as per this doc https://stripe.com/docs/api/events/types#event_types-payment_intent.amount_capturable_updated
api_models::enums::EventType::PaymentAuthorized => {
"payment_intent.amount_capturable_updated"
}
// stripe treats partially captured payments as succeeded.
api_models::enums::EventType::PaymentCaptured => "payment_intent.succeeded",
api_models::enums::EventType::PayoutSuccess => "payout.paid",
api_models::enums::EventType::PayoutFailed => "payout.failed",
api_models::enums::EventType::PayoutInitiated => "payout.created",
api_models::enums::EventType::PayoutCancelled => "payout.canceled",
api_models::enums::EventType::PayoutProcessing => "payout.created",
api_models::enums::EventType::PayoutExpired => "payout.failed",
api_models::enums::EventType::PayoutReversed => "payout.reconciliation_completed",
}
}
impl From<api::OutgoingWebhook> for StripeOutgoingWebhook {
fn from(value: api::OutgoingWebhook) -> Self {
Self {
id: value.event_id,
stype: get_stripe_event_type(value.event_type),
data: StripeWebhookObject::from(value.content),
object: "event",
// put this conversion it into a function
created: u64::try_from(value.timestamp.assume_utc().unix_timestamp()).unwrap_or_else(
|error| {
logger::error!(
%error,
"incorrect value for `webhook.timestamp` provided {}", value.timestamp
);
// Current timestamp converted to Unix timestamp should have a positive value
// for many years to come
u64::try_from(date_time::now().assume_utc().unix_timestamp())
.unwrap_or_default()
},
),
}
}
}
impl From<api::OutgoingWebhookContent> for StripeWebhookObject {
fn from(value: api::OutgoingWebhookContent) -> Self {
match value {
api::OutgoingWebhookContent::PaymentDetails(payment) => {
Self::PaymentIntent(Box::new((*payment).into()))
}
api::OutgoingWebhookContent::RefundDetails(refund) => Self::Refund((*refund).into()),
api::OutgoingWebhookContent::DisputeDetails(dispute) => {
Self::Dispute((*dispute).into())
}
api::OutgoingWebhookContent::MandateDetails(mandate) => {
Self::Mandate((*mandate).into())
}
#[cfg(feature = "payouts")]
api::OutgoingWebhookContent::PayoutDetails(payout) => Self::Payout((*payout).into()),
}
}
}
|
crates/router/src/compatibility/stripe/webhooks.rs
|
router
|
full_file
| null | null | null | 3,021
| null | null | null | null | null | null | null |
// Trait: StorageModel
// File: crates/storage_impl/src/kv_router_store.rs
// Module: storage_impl
// Documentation: Storage model with all required capabilities for KV operations
pub trait StorageModel<D: Conversion>: de::DeserializeOwned
+ serde::Serialize
+ Debug
+ KvStorePartition
+ UniqueConstraints
+ Sync
+ Send
+ ReverseConversion<D>
|
crates/storage_impl/src/kv_router_store.rs
|
storage_impl
|
trait_definition
| null | null | null | 86
| null | null |
StorageModel
| null | null | null | null |
// Struct: GetSubscriptionEstimate
// File: crates/hyperswitch_domain_models/src/router_flow_types/subscriptions.rs
// Module: hyperswitch_domain_models
// Implementations: 0
pub struct GetSubscriptionEstimate
|
crates/hyperswitch_domain_models/src/router_flow_types/subscriptions.rs
|
hyperswitch_domain_models
|
struct_definition
|
GetSubscriptionEstimate
| 0
|
[] | 47
| null | null | null | null | null | null | null |
// Function: connector_create
// File: crates/router/src/routes/admin.rs
// Module: router
pub fn connector_create(
state: web::Data<AppState>,
req: HttpRequest,
path: web::Path<common_utils::id_type::MerchantId>,
json_payload: web::Json<admin::MerchantConnectorCreate>,
) -> HttpResponse
|
crates/router/src/routes/admin.rs
|
router
|
function_signature
| null | null | null | 73
|
connector_create
| null | null | null | null | null | null |
// Struct: ThreeDsSettings
// File: crates/hyperswitch_connectors/src/connectors/payme/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct ThreeDsSettings
|
crates/hyperswitch_connectors/src/connectors/payme/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
ThreeDsSettings
| 0
|
[] | 47
| null | null | null | null | null | null | null |
// Function: get_forex_exchange_rates
// File: crates/router/src/core/currency.rs
// Module: router
pub fn get_forex_exchange_rates(
state: SessionState,
) -> CustomResult<ExchangeRates, AnalyticsError>
|
crates/router/src/core/currency.rs
|
router
|
function_signature
| null | null | null | 50
|
get_forex_exchange_rates
| null | null | null | null | null | null |
// Function: get_token
// File: crates/hyperswitch_connectors/src/connectors/novalnet/transformers.rs
// Module: hyperswitch_connectors
pub fn get_token(transaction_data: Option<&Self>) -> Option<String>
|
crates/hyperswitch_connectors/src/connectors/novalnet/transformers.rs
|
hyperswitch_connectors
|
function_signature
| null | null | null | 50
|
get_token
| null | null | null | null | null | null |
// Function: perform_volume_split
// File: crates/router/src/core/payments/routing.rs
// Module: router
pub fn perform_volume_split(
mut splits: Vec<routing_types::ConnectorVolumeSplit>,
) -> RoutingResult<Vec<routing_types::RoutableConnectorChoice>>
|
crates/router/src/core/payments/routing.rs
|
router
|
function_signature
| null | null | null | 59
|
perform_volume_split
| null | null | null | null | null | null |
// Implementation: impl ExternalAuthentication for for Netcetera
// File: crates/hyperswitch_connectors/src/connectors/netcetera.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl ExternalAuthentication for for Netcetera
|
crates/hyperswitch_connectors/src/connectors/netcetera.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 59
| null |
Netcetera
|
ExternalAuthentication for
| 0
| 0
| null | null |
// Implementation: impl api::PaymentToken for for Forte
// File: crates/hyperswitch_connectors/src/connectors/forte.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::PaymentToken for for Forte
|
crates/hyperswitch_connectors/src/connectors/forte.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 58
| null |
Forte
|
api::PaymentToken for
| 0
| 0
| null | null |
// Function: insert
// File: crates/diesel_models/src/query/merchant_account.rs
// Module: diesel_models
pub fn insert(self, conn: &PgPooledConn) -> StorageResult<MerchantAccount>
|
crates/diesel_models/src/query/merchant_account.rs
|
diesel_models
|
function_signature
| null | null | null | 45
|
insert
| null | null | null | null | null | null |
// Implementation: impl ConnectorValidation for for Boku
// File: crates/hyperswitch_connectors/src/connectors/boku.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl ConnectorValidation for for Boku
|
crates/hyperswitch_connectors/src/connectors/boku.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 53
| null |
Boku
|
ConnectorValidation for
| 0
| 0
| null | null |
// Struct: RecipientBankAccountRequest
// File: crates/hyperswitch_connectors/src/connectors/stripe/transformers/connect.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct RecipientBankAccountRequest
|
crates/hyperswitch_connectors/src/connectors/stripe/transformers/connect.rs
|
hyperswitch_connectors
|
struct_definition
|
RecipientBankAccountRequest
| 0
|
[] | 52
| null | null | null | null | null | null | null |
// File: crates/analytics/src/lambda_utils.rs
// Module: analytics
// Public functions: 1
use aws_config::{self, meta::region::RegionProviderChain, Region};
use aws_sdk_lambda::{types::InvocationType::Event, Client};
use aws_smithy_types::Blob;
use common_utils::errors::CustomResult;
use error_stack::{report, ResultExt};
use crate::errors::AnalyticsError;
async fn get_aws_client(region: String) -> Client {
let region_provider = RegionProviderChain::first_try(Region::new(region));
let sdk_config = aws_config::from_env().region(region_provider).load().await;
Client::new(&sdk_config)
}
pub async fn invoke_lambda(
function_name: &str,
region: &str,
json_bytes: &[u8],
) -> CustomResult<(), AnalyticsError> {
get_aws_client(region.to_string())
.await
.invoke()
.function_name(function_name)
.invocation_type(Event)
.payload(Blob::new(json_bytes.to_owned()))
.send()
.await
.map_err(|er| {
let er_rep = format!("{er:?}");
report!(er).attach_printable(er_rep)
})
.change_context(AnalyticsError::UnknownError)
.attach_printable("Lambda invocation failed")?;
Ok(())
}
|
crates/analytics/src/lambda_utils.rs
|
analytics
|
full_file
| null | null | null | 291
| null | null | null | null | null | null | null |
// Function: refunds_update
// File: crates/openapi/src/routes/refunds.rs
// Module: openapi
pub fn refunds_update()
|
crates/openapi/src/routes/refunds.rs
|
openapi
|
function_signature
| null | null | null | 29
|
refunds_update
| null | null | null | null | null | null |
// Struct: User
// File: crates/router_derive/src/lib.rs
// Module: router_derive
// Implementations: 0
pub struct User
|
crates/router_derive/src/lib.rs
|
router_derive
|
struct_definition
|
User
| 0
|
[] | 33
| null | null | null | null | null | null | null |
// Implementation: impl Globepay
// File: crates/hyperswitch_connectors/src/connectors/globepay.rs
// Module: hyperswitch_connectors
// Methods: 1 total (1 public)
impl Globepay
|
crates/hyperswitch_connectors/src/connectors/globepay.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 49
| null |
Globepay
| null | 1
| 1
| null | null |
// Function: get_payout_attempt_id
// File: crates/router/src/utils.rs
// Module: router
pub fn get_payout_attempt_id(payout_id: &str, attempt_count: i16) -> String
|
crates/router/src/utils.rs
|
router
|
function_signature
| null | null | null | 46
|
get_payout_attempt_id
| null | null | null | null | null | null |
// Implementation: impl MerchantConnectorListResponse
// File: crates/api_models/src/admin.rs
// Module: api_models
// Methods: 2 total (2 public)
impl MerchantConnectorListResponse
|
crates/api_models/src/admin.rs
|
api_models
|
impl_block
| null | null | null | 40
| null |
MerchantConnectorListResponse
| null | 2
| 2
| null | null |
// Struct: ShippingData
// File: crates/hyperswitch_connectors/src/connectors/redsys/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct ShippingData
|
crates/hyperswitch_connectors/src/connectors/redsys/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
ShippingData
| 0
|
[] | 45
| null | null | null | null | null | null | null |
// Struct: SyncResponse
// File: crates/hyperswitch_connectors/src/connectors/bamboraapac/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct SyncResponse
|
crates/hyperswitch_connectors/src/connectors/bamboraapac/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
SyncResponse
| 0
|
[] | 48
| null | null | null | null | null | null | null |
// Implementation: impl Context
// File: crates/euclid/src/backend/vir_interpreter/types.rs
// Module: euclid
// Methods: 2 total (2 public)
impl Context
|
crates/euclid/src/backend/vir_interpreter/types.rs
|
euclid
|
impl_block
| null | null | null | 40
| null |
Context
| null | 2
| 2
| null | null |
// Struct: CardDetailFromLocker
// File: crates/api_models/src/payment_methods.rs
// Module: api_models
// Implementations: 0
pub struct CardDetailFromLocker
|
crates/api_models/src/payment_methods.rs
|
api_models
|
struct_definition
|
CardDetailFromLocker
| 0
|
[] | 38
| null | null | null | null | null | null | null |
// File: crates/diesel_models/src/merchant_key_store.rs
// Module: diesel_models
// Public structs: 3
use common_utils::{custom_serde, encryption::Encryption};
use diesel::{AsChangeset, Identifiable, Insertable, Queryable, Selectable};
use time::PrimitiveDateTime;
use crate::schema::merchant_key_store;
#[derive(
Clone,
Debug,
serde::Serialize,
serde::Deserialize,
Identifiable,
Queryable,
Selectable,
router_derive::DebugAsDisplay,
)]
#[diesel(table_name = merchant_key_store, primary_key(merchant_id), check_for_backend(diesel::pg::Pg))]
pub struct MerchantKeyStore {
pub merchant_id: common_utils::id_type::MerchantId,
pub key: Encryption,
#[serde(with = "custom_serde::iso8601")]
pub created_at: PrimitiveDateTime,
}
#[derive(
Clone, Debug, serde::Serialize, serde::Deserialize, Insertable, router_derive::DebugAsDisplay,
)]
#[diesel(table_name = merchant_key_store)]
pub struct MerchantKeyStoreNew {
pub merchant_id: common_utils::id_type::MerchantId,
pub key: Encryption,
pub created_at: PrimitiveDateTime,
}
#[derive(
Clone, Debug, serde::Serialize, serde::Deserialize, AsChangeset, router_derive::DebugAsDisplay,
)]
#[diesel(table_name = merchant_key_store)]
pub struct MerchantKeyStoreUpdateInternal {
pub merchant_id: common_utils::id_type::MerchantId,
pub key: Encryption,
}
|
crates/diesel_models/src/merchant_key_store.rs
|
diesel_models
|
full_file
| null | null | null | 333
| null | null | null | null | null | null | null |
// Function: generic_delete
// File: crates/diesel_models/src/query/generics.rs
// Module: diesel_models
pub fn generic_delete<T, P>(conn: &PgPooledConn, predicate: P) -> StorageResult<bool>
where
T: FilterDsl<P> + HasTable<Table = T> + Table + 'static,
Filter<T, P>: IntoUpdateTarget,
DeleteStatement<
<Filter<T, P> as HasTable>::Table,
<Filter<T, P> as IntoUpdateTarget>::WhereClause,
>: AsQuery + QueryFragment<Pg> + QueryId + Send + 'static,
|
crates/diesel_models/src/query/generics.rs
|
diesel_models
|
function_signature
| null | null | null | 137
|
generic_delete
| null | null | null | null | null | null |
// Struct: RequiredFieldFinal
// File: crates/payment_methods/src/configs/settings.rs
// Module: payment_methods
// Implementations: 0
pub struct RequiredFieldFinal
|
crates/payment_methods/src/configs/settings.rs
|
payment_methods
|
struct_definition
|
RequiredFieldFinal
| 0
|
[] | 37
| null | null | null | null | null | null | null |
// Implementation: impl Responder
// File: crates/router/src/routes/api_keys.rs
// Module: router
// Methods: 0 total (0 public)
impl Responder
|
crates/router/src/routes/api_keys.rs
|
router
|
impl_block
| null | null | null | 36
| null |
Responder
| null | 0
| 0
| null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.