text
stringlengths 65
57.3k
| file_path
stringlengths 22
92
| module
stringclasses 38
values | type
stringclasses 7
values | struct_name
stringlengths 3
60
⌀ | impl_count
int64 0
60
⌀ | traits
listlengths 0
59
⌀ | tokens
int64 16
8.19k
| function_name
stringlengths 3
85
⌀ | type_name
stringlengths 1
67
⌀ | trait_name
stringclasses 573
values | method_count
int64 0
31
⌀ | public_method_count
int64 0
19
⌀ | submodule_count
int64 0
56
⌀ | export_count
int64 0
9
⌀ |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
// Function: perform_static_routing_v1
// File: crates/router/src/core/payments/routing.rs
// Module: router
pub fn perform_static_routing_v1(
state: &SessionState,
merchant_id: &common_utils::id_type::MerchantId,
algorithm_id: Option<&common_utils::id_type::RoutingId>,
business_profile: &domain::Profile,
transaction_data: &routing::TransactionData<'_>,
) -> RoutingResult<(
Vec<routing_types::RoutableConnectorChoice>,
Option<common_enums::RoutingApproach>,
)>
|
crates/router/src/core/payments/routing.rs
|
router
|
function_signature
| null | null | null | 122
|
perform_static_routing_v1
| null | null | null | null | null | null |
// Implementation: impl api::PaymentToken for for Datatrans
// File: crates/hyperswitch_connectors/src/connectors/datatrans.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::PaymentToken for for Datatrans
|
crates/hyperswitch_connectors/src/connectors/datatrans.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 60
| null |
Datatrans
|
api::PaymentToken for
| 0
| 0
| null | null |
// Struct: StripePaymentListConstraints
// File: crates/router/src/compatibility/stripe/payment_intents/types.rs
// Module: router
// Implementations: 0
pub struct StripePaymentListConstraints
|
crates/router/src/compatibility/stripe/payment_intents/types.rs
|
router
|
struct_definition
|
StripePaymentListConstraints
| 0
|
[] | 43
| null | null | null | null | null | null | null |
// Struct: BluesnapAuthErrorResponse
// File: crates/hyperswitch_connectors/src/connectors/bluesnap/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct BluesnapAuthErrorResponse
|
crates/hyperswitch_connectors/src/connectors/bluesnap/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
BluesnapAuthErrorResponse
| 0
|
[] | 50
| null | null | null | null | null | null | null |
// Struct: MonerisPaymentsRequest
// File: crates/hyperswitch_connectors/src/connectors/moneris/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct MonerisPaymentsRequest
|
crates/hyperswitch_connectors/src/connectors/moneris/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
MonerisPaymentsRequest
| 0
|
[] | 53
| null | null | null | null | null | null | null |
// Implementation: impl Webhooks
// File: crates/router/src/routes/app.rs
// Module: router
// Methods: 1 total (1 public)
impl Webhooks
|
crates/router/src/routes/app.rs
|
router
|
impl_block
| null | null | null | 35
| null |
Webhooks
| null | 1
| 1
| null | null |
// Function: get_total_count_of_attempts
// File: crates/diesel_models/src/query/payment_attempt.rs
// Module: diesel_models
pub fn get_total_count_of_attempts(
conn: &PgPooledConn,
merchant_id: &common_utils::id_type::MerchantId,
active_attempt_ids: &[String],
connector: Option<Vec<String>>,
payment_method: Option<Vec<enums::PaymentMethod>>,
payment_method_type: Option<Vec<enums::PaymentMethodType>>,
authentication_type: Option<Vec<enums::AuthenticationType>>,
merchant_connector_id: Option<Vec<common_utils::id_type::MerchantConnectorAccountId>>,
card_network: Option<Vec<enums::CardNetwork>>,
card_discovery: Option<Vec<enums::CardDiscovery>>,
) -> StorageResult<i64>
|
crates/diesel_models/src/query/payment_attempt.rs
|
diesel_models
|
function_signature
| null | null | null | 164
|
get_total_count_of_attempts
| null | null | null | null | null | null |
// File: crates/hyperswitch_connectors/src/connectors/bambora.rs
// Module: hyperswitch_connectors
// Public functions: 1
// Public structs: 1
pub mod transformers;
use common_enums::enums;
use common_utils::{
errors::CustomResult,
ext_traits::BytesExt,
request::{Method, Request, RequestBuilder, RequestContent},
types::{AmountConvertor, FloatMajorUnit, FloatMajorUnitForConnector},
};
use error_stack::{report, 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},
CompleteAuthorize,
},
router_request_types::{
AccessTokenRequestData, CompleteAuthorizeData, PaymentMethodTokenizationData,
PaymentsAuthorizeData, PaymentsCancelData, PaymentsCaptureData, PaymentsSessionData,
PaymentsSyncData, RefundsData, SetupMandateRequestData,
},
router_response_types::{
ConnectorInfo, PaymentMethodDetails, PaymentsResponseData, RefundsResponseData,
SupportedPaymentMethods, SupportedPaymentMethodsExt,
},
types::{
PaymentsAuthorizeRouterData, PaymentsCancelRouterData, PaymentsCaptureRouterData,
PaymentsCompleteAuthorizeRouterData, PaymentsSyncRouterData, RefundSyncRouterData,
RefundsRouterData,
},
};
use hyperswitch_interfaces::{
api::{
self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorRedirectResponse,
ConnectorSpecifications, ConnectorValidation,
},
configs::Connectors,
errors,
events::connector_api_logs::ConnectorEvent,
types::{
self, PaymentsAuthorizeType, PaymentsCaptureType, PaymentsCompleteAuthorizeType,
PaymentsSyncType, PaymentsVoidType, Response,
},
webhooks,
};
use lazy_static::lazy_static;
use masking::Mask;
use transformers as bambora;
use crate::{
connectors::bambora::transformers::BamboraRouterData,
constants::headers,
types::ResponseRouterData,
utils::{self, convert_amount, RefundsRequestData},
};
#[derive(Clone)]
pub struct Bambora {
amount_convertor: &'static (dyn AmountConvertor<Output = FloatMajorUnit> + Sync),
}
impl Bambora {
pub fn new() -> &'static Self {
&Self {
amount_convertor: &FloatMajorUnitForConnector,
}
}
}
impl api::Payment for Bambora {}
impl api::PaymentToken for Bambora {}
impl api::PaymentAuthorize for Bambora {}
impl api::PaymentVoid for Bambora {}
impl api::MandateSetup for Bambora {}
impl api::ConnectorAccessToken for Bambora {}
impl api::PaymentSync for Bambora {}
impl api::PaymentCapture for Bambora {}
impl api::PaymentSession for Bambora {}
impl api::Refund for Bambora {}
impl api::RefundExecute for Bambora {}
impl api::RefundSync for Bambora {}
impl api::PaymentsCompleteAuthorize for Bambora {}
impl<Flow, Request, Response> ConnectorCommonExt<Flow, Request, Response> for Bambora
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(),
PaymentsAuthorizeType::get_content_type(self)
.to_string()
.into(),
)];
let mut api_key = self.get_auth_header(&req.connector_auth_type)?;
header.append(&mut api_key);
Ok(header)
}
}
impl ConnectorCommon for Bambora {
fn id(&self) -> &'static str {
"bambora"
}
fn get_currency_unit(&self) -> api::CurrencyUnit {
api::CurrencyUnit::Base
}
fn common_get_content_type(&self) -> &'static str {
"application/json"
}
fn base_url<'a>(&self, connectors: &'a Connectors) -> &'a str {
connectors.bambora.base_url.as_ref()
}
fn get_auth_header(
&self,
auth_type: &ConnectorAuthType,
) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
let auth = bambora::BamboraAuthType::try_from(auth_type)
.change_context(errors::ConnectorError::FailedToObtainAuthType)?;
Ok(vec![(
headers::AUTHORIZATION.to_string(),
auth.api_key.into_masked(),
)])
}
fn build_error_response(
&self,
res: Response,
event_builder: Option<&mut ConnectorEvent>,
) -> CustomResult<ErrorResponse, errors::ConnectorError> {
let response: bambora::BamboraErrorResponse = res
.response
.parse_struct("BamboraErrorResponse")
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
event_builder.map(|i| i.set_error_response_body(&response));
router_env::logger::info!(connector_response=?response);
Ok(ErrorResponse {
status_code: res.status_code,
code: response.code.to_string(),
message: serde_json::to_string(&response.details)
.unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_MESSAGE.to_string()),
reason: Some(response.message),
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 Bambora {}
impl ConnectorIntegration<PaymentMethodToken, PaymentMethodTokenizationData, PaymentsResponseData>
for Bambora
{
// Not Implemented (R)
}
impl ConnectorIntegration<AccessTokenAuth, AccessTokenRequestData, AccessToken> for Bambora {}
impl ConnectorIntegration<Session, PaymentsSessionData, PaymentsResponseData> for Bambora {
//TODO: implement sessions flow
}
impl ConnectorIntegration<SetupMandate, SetupMandateRequestData, PaymentsResponseData> for Bambora {
fn build_request(
&self,
_req: &RouterData<SetupMandate, SetupMandateRequestData, PaymentsResponseData>,
_connectors: &Connectors,
) -> CustomResult<Option<Request>, errors::ConnectorError> {
Err(
errors::ConnectorError::NotImplemented("Setup Mandate flow for Bambora".to_string())
.into(),
)
}
}
impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData> for Bambora {
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!("{}{}", self.base_url(connectors), "/v1/payments"))
}
fn get_request_body(
&self,
req: &PaymentsAuthorizeRouterData,
_connectors: &Connectors,
) -> CustomResult<RequestContent, errors::ConnectorError> {
let amount = convert_amount(
self.amount_convertor,
req.request.minor_amount,
req.request.currency,
)?;
let connector_router_data = BamboraRouterData::try_from((amount, req))?;
let connector_req = bambora::BamboraPaymentsRequest::try_from(connector_router_data)?;
Ok(RequestContent::Json(Box::new(connector_req)))
}
fn build_request(
&self,
req: &PaymentsAuthorizeRouterData,
connectors: &Connectors,
) -> CustomResult<Option<Request>, errors::ConnectorError> {
Ok(Some(
RequestBuilder::new()
.method(Method::Post)
.url(&PaymentsAuthorizeType::get_url(self, req, connectors)?)
.attach_default_headers()
.headers(PaymentsAuthorizeType::get_headers(self, req, connectors)?)
.set_body(PaymentsAuthorizeType::get_request_body(
self, req, connectors,
)?)
.build(),
))
}
fn handle_response(
&self,
data: &PaymentsAuthorizeRouterData,
event_builder: Option<&mut ConnectorEvent>,
res: Response,
) -> CustomResult<PaymentsAuthorizeRouterData, errors::ConnectorError> {
let response: bambora::BamboraResponse = res
.response
.parse_struct("PaymentIntentResponse")
.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<CompleteAuthorize, CompleteAuthorizeData, PaymentsResponseData>
for Bambora
{
fn get_headers(
&self,
req: &PaymentsCompleteAuthorizeRouterData,
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: &PaymentsCompleteAuthorizeRouterData,
connectors: &Connectors,
) -> CustomResult<String, errors::ConnectorError> {
let meta: bambora::BamboraMeta =
utils::to_connector_meta(req.request.connector_meta.clone())?;
Ok(format!(
"{}/v1/payments/{}{}",
self.base_url(connectors),
meta.three_d_session_data,
"/continue"
))
}
fn get_request_body(
&self,
req: &PaymentsCompleteAuthorizeRouterData,
_connectors: &Connectors,
) -> CustomResult<RequestContent, errors::ConnectorError> {
let connector_req = bambora::BamboraThreedsContinueRequest::try_from(&req.request)?;
Ok(RequestContent::Json(Box::new(connector_req)))
}
fn build_request(
&self,
req: &PaymentsCompleteAuthorizeRouterData,
connectors: &Connectors,
) -> CustomResult<Option<Request>, errors::ConnectorError> {
let request = RequestBuilder::new()
.method(Method::Post)
.url(&PaymentsCompleteAuthorizeType::get_url(
self, req, connectors,
)?)
.attach_default_headers()
.headers(PaymentsCompleteAuthorizeType::get_headers(
self, req, connectors,
)?)
.set_body(PaymentsCompleteAuthorizeType::get_request_body(
self, req, connectors,
)?)
.build();
Ok(Some(request))
}
fn handle_response(
&self,
data: &PaymentsCompleteAuthorizeRouterData,
event_builder: Option<&mut ConnectorEvent>,
res: Response,
) -> CustomResult<PaymentsCompleteAuthorizeRouterData, errors::ConnectorError> {
let response: bambora::BamboraPaymentsResponse = res
.response
.parse_struct("BamboraPaymentsResponse")
.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,
})
.change_context(errors::ConnectorError::ResponseHandlingFailed)
}
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 Bambora {
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!(
"{}/v1/payments/{connector_payment_id}",
self.base_url(connectors),
))
}
fn build_request(
&self,
req: &PaymentsSyncRouterData,
connectors: &Connectors,
) -> CustomResult<Option<Request>, errors::ConnectorError> {
Ok(Some(
RequestBuilder::new()
.method(Method::Get)
.url(&PaymentsSyncType::get_url(self, req, connectors)?)
.attach_default_headers()
.headers(PaymentsSyncType::get_headers(self, req, connectors)?)
.build(),
))
}
fn get_error_response(
&self,
res: Response,
event_builder: Option<&mut ConnectorEvent>,
) -> CustomResult<ErrorResponse, errors::ConnectorError> {
self.build_error_response(res, event_builder)
}
fn handle_response(
&self,
data: &PaymentsSyncRouterData,
event_builder: Option<&mut ConnectorEvent>,
res: Response,
) -> CustomResult<PaymentsSyncRouterData, errors::ConnectorError> {
let response: bambora::BamboraPaymentsResponse = res
.response
.parse_struct("bambora PaymentsResponse")
.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,
})
.change_context(errors::ConnectorError::ResponseHandlingFailed)
}
}
impl ConnectorIntegration<Capture, PaymentsCaptureData, PaymentsResponseData> for Bambora {
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> {
Ok(format!(
"{}/v1/payments/{}/completions",
self.base_url(connectors),
req.request.connector_transaction_id,
))
}
fn get_request_body(
&self,
req: &PaymentsCaptureRouterData,
_connectors: &Connectors,
) -> CustomResult<RequestContent, errors::ConnectorError> {
let amount = convert_amount(
self.amount_convertor,
req.request.minor_amount_to_capture,
req.request.currency,
)?;
let connector_router_data = BamboraRouterData::try_from((amount, req))?;
let connector_req =
bambora::BamboraPaymentsCaptureRequest::try_from(connector_router_data)?;
Ok(RequestContent::Json(Box::new(connector_req)))
}
fn build_request(
&self,
req: &PaymentsCaptureRouterData,
connectors: &Connectors,
) -> CustomResult<Option<Request>, errors::ConnectorError> {
Ok(Some(
RequestBuilder::new()
.method(Method::Post)
.url(&PaymentsCaptureType::get_url(self, req, connectors)?)
.attach_default_headers()
.headers(PaymentsCaptureType::get_headers(self, req, connectors)?)
.set_body(self.get_request_body(req, connectors)?)
.build(),
))
}
fn handle_response(
&self,
data: &PaymentsCaptureRouterData,
event_builder: Option<&mut ConnectorEvent>,
res: Response,
) -> CustomResult<PaymentsCaptureRouterData, errors::ConnectorError> {
let response: bambora::BamboraPaymentsResponse = res
.response
.parse_struct("Bambora PaymentsResponse")
.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,
})
.change_context(errors::ConnectorError::ResponseHandlingFailed)
}
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 Bambora {
fn get_headers(
&self,
req: &PaymentsCancelRouterData,
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: &PaymentsCancelRouterData,
connectors: &Connectors,
) -> CustomResult<String, errors::ConnectorError> {
let connector_payment_id = req.request.connector_transaction_id.clone();
Ok(format!(
"{}/v1/payments/{}/void",
self.base_url(connectors),
connector_payment_id,
))
}
fn get_request_body(
&self,
req: &PaymentsCancelRouterData,
_connectors: &Connectors,
) -> CustomResult<RequestContent, errors::ConnectorError> {
let currency =
req.request
.currency
.ok_or(errors::ConnectorError::MissingRequiredField {
field_name: "Currency",
})?;
let minor_amount =
req.request
.minor_amount
.ok_or(errors::ConnectorError::MissingRequiredField {
field_name: "Amount",
})?;
let amount = convert_amount(self.amount_convertor, minor_amount, currency)?;
let connector_router_data = BamboraRouterData::try_from((amount, req))?;
let connector_req = bambora::BamboraVoidRequest::try_from(connector_router_data)?;
Ok(RequestContent::Json(Box::new(connector_req)))
}
fn build_request(
&self,
req: &PaymentsCancelRouterData,
connectors: &Connectors,
) -> CustomResult<Option<Request>, errors::ConnectorError> {
Ok(Some(
RequestBuilder::new()
.method(Method::Post)
.url(&PaymentsVoidType::get_url(self, req, connectors)?)
.attach_default_headers()
.headers(PaymentsVoidType::get_headers(self, req, connectors)?)
.set_body(self.get_request_body(req, connectors)?)
.build(),
))
}
fn handle_response(
&self,
data: &PaymentsCancelRouterData,
event_builder: Option<&mut ConnectorEvent>,
res: Response,
) -> CustomResult<PaymentsCancelRouterData, errors::ConnectorError> {
let response: bambora::BamboraPaymentsResponse = res
.response
.parse_struct("bambora PaymentsResponse")
.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,
})
.change_context(errors::ConnectorError::ResponseHandlingFailed)
}
fn get_error_response(
&self,
res: Response,
event_builder: Option<&mut ConnectorEvent>,
) -> CustomResult<ErrorResponse, errors::ConnectorError> {
self.build_error_response(res, event_builder)
}
}
impl ConnectorRedirectResponse for Bambora {
fn get_flow_type(
&self,
_query_params: &str,
_json_payload: Option<serde_json::Value>,
action: enums::PaymentAction,
) -> CustomResult<enums::CallConnectorAction, errors::ConnectorError> {
match action {
enums::PaymentAction::PSync
| enums::PaymentAction::CompleteAuthorize
| enums::PaymentAction::PaymentAuthenticateCompleteAuthorize => {
Ok(enums::CallConnectorAction::Trigger)
}
}
}
}
impl ConnectorIntegration<Execute, RefundsData, RefundsResponseData> for Bambora {
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> {
let connector_payment_id = req.request.connector_transaction_id.clone();
Ok(format!(
"{}/v1/payments/{}/returns",
self.base_url(connectors),
connector_payment_id,
))
}
fn get_request_body(
&self,
req: &RefundsRouterData<Execute>,
_connectors: &Connectors,
) -> CustomResult<RequestContent, errors::ConnectorError> {
let amount = convert_amount(
self.amount_convertor,
req.request.minor_refund_amount,
req.request.currency,
)?;
let connector_router_data = BamboraRouterData::try_from((amount, req))?;
let connector_req = bambora::BamboraRefundRequest::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: bambora::RefundResponse = res
.response
.parse_struct("bambora RefundResponse")
.change_context(errors::ConnectorError::RequestEncodingFailed)?;
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,
})
.change_context(errors::ConnectorError::ResponseHandlingFailed)
}
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 Bambora {
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_payment_id = req.request.connector_transaction_id.clone();
let connector_refund_id = req.request.get_connector_refund_id()?;
Ok(format!(
"{}/v1/payments/{}",
self.base_url(connectors),
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)?)
.build(),
))
}
fn handle_response(
&self,
data: &RefundSyncRouterData,
event_builder: Option<&mut ConnectorEvent>,
res: Response,
) -> CustomResult<RefundSyncRouterData, errors::ConnectorError> {
let response: bambora::RefundResponse = res
.response
.parse_struct("bambora RefundResponse")
.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,
})
.change_context(errors::ConnectorError::ResponseHandlingFailed)
}
fn get_error_response(
&self,
res: Response,
event_builder: Option<&mut ConnectorEvent>,
) -> CustomResult<ErrorResponse, errors::ConnectorError> {
self.build_error_response(res, event_builder)
}
}
#[async_trait::async_trait]
impl webhooks::IncomingWebhook for Bambora {
fn get_webhook_object_reference_id(
&self,
_request: &webhooks::IncomingWebhookRequestDetails<'_>,
) -> CustomResult<api_models::webhooks::ObjectReferenceId, errors::ConnectorError> {
Err(report!(errors::ConnectorError::WebhooksNotImplemented))
}
fn get_webhook_event_type(
&self,
_request: &webhooks::IncomingWebhookRequestDetails<'_>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
Ok(api_models::webhooks::IncomingWebhookEvent::EventNotSupported)
}
fn get_webhook_resource_object(
&self,
_request: &webhooks::IncomingWebhookRequestDetails<'_>,
) -> CustomResult<Box<dyn masking::ErasedMaskSerialize>, errors::ConnectorError> {
Err(report!(errors::ConnectorError::WebhooksNotImplemented))
}
}
lazy_static! {
static ref BAMBORA_SUPPORTED_PAYMENT_METHODS: SupportedPaymentMethods = {
let default_capture_methods = vec![
enums::CaptureMethod::Automatic,
enums::CaptureMethod::Manual,
enums::CaptureMethod::SequentialAutomatic,
];
let supported_card_network = vec![
common_enums::CardNetwork::Visa,
common_enums::CardNetwork::Mastercard,
common_enums::CardNetwork::AmericanExpress,
common_enums::CardNetwork::Discover,
common_enums::CardNetwork::JCB,
common_enums::CardNetwork::DinersClub,
];
let mut bambora_supported_payment_methods = SupportedPaymentMethods::new();
bambora_supported_payment_methods.add(
enums::PaymentMethod::Card,
enums::PaymentMethodType::Credit,
PaymentMethodDetails {
mandates: common_enums::FeatureStatus::NotSupported,
refunds: common_enums::FeatureStatus::Supported,
supported_capture_methods: default_capture_methods.clone(),
specific_features: Some(
api_models::feature_matrix::PaymentMethodSpecificFeatures::Card({
api_models::feature_matrix::CardSpecificFeatures {
three_ds: common_enums::FeatureStatus::Supported,
no_three_ds: common_enums::FeatureStatus::Supported,
supported_card_networks: supported_card_network.clone(),
}
}),
),
},
);
bambora_supported_payment_methods
};
static ref BAMBORA_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo {
display_name: "Bambora",
description: "Bambora is a leading online payment provider in Canada and United States.",
connector_type: enums::HyperswitchConnectorCategory::PaymentGateway,
integration_status: enums::ConnectorIntegrationStatus::Sandbox,
};
static ref BAMBORA_SUPPORTED_WEBHOOK_FLOWS: Vec<enums::EventClass> = Vec::new();
}
impl ConnectorSpecifications for Bambora {
fn get_connector_about(&self) -> Option<&'static ConnectorInfo> {
Some(&*BAMBORA_CONNECTOR_INFO)
}
fn get_supported_payment_methods(&self) -> Option<&'static SupportedPaymentMethods> {
Some(&*BAMBORA_SUPPORTED_PAYMENT_METHODS)
}
fn get_supported_webhook_flows(&self) -> Option<&'static [enums::EventClass]> {
Some(&*BAMBORA_SUPPORTED_WEBHOOK_FLOWS)
}
}
|
crates/hyperswitch_connectors/src/connectors/bambora.rs
|
hyperswitch_connectors
|
full_file
| null | null | null | 6,638
| null | null | null | null | null | null | null |
// Struct: Merchant
// File: crates/hyperswitch_connectors/src/connectors/worldpay/requests.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct Merchant
|
crates/hyperswitch_connectors/src/connectors/worldpay/requests.rs
|
hyperswitch_connectors
|
struct_definition
|
Merchant
| 0
|
[] | 42
| null | null | null | null | null | null | null |
// Implementation: impl SchedulerInterface for for KafkaStore
// File: crates/router/src/db/kafka_store.rs
// Module: router
// Methods: 0 total (0 public)
impl SchedulerInterface for for KafkaStore
|
crates/router/src/db/kafka_store.rs
|
router
|
impl_block
| null | null | null | 45
| null |
KafkaStore
|
SchedulerInterface for
| 0
| 0
| null | null |
// Struct: VoltAuthType
// File: crates/hyperswitch_connectors/src/connectors/volt/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct VoltAuthType
|
crates/hyperswitch_connectors/src/connectors/volt/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
VoltAuthType
| 0
|
[] | 47
| null | null | null | null | null | null | null |
// Function: payments_connector_session
// File: crates/openapi/src/routes/payments.rs
// Module: openapi
pub fn payments_connector_session()
|
crates/openapi/src/routes/payments.rs
|
openapi
|
function_signature
| null | null | null | 31
|
payments_connector_session
| null | null | null | null | null | null |
// Function: add_apple_pay_payment_status_metrics
// File: crates/router/src/utils.rs
// Module: router
pub fn add_apple_pay_payment_status_metrics(
payment_attempt_status: enums::AttemptStatus,
apple_pay_flow: Option<domain::ApplePayFlow>,
connector: Option<String>,
merchant_id: id_type::MerchantId,
)
|
crates/router/src/utils.rs
|
router
|
function_signature
| null | null | null | 75
|
add_apple_pay_payment_status_metrics
| null | null | null | null | null | null |
// Struct: XenditCaptureResponse
// File: crates/hyperswitch_connectors/src/connectors/xendit/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct XenditCaptureResponse
|
crates/hyperswitch_connectors/src/connectors/xendit/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
XenditCaptureResponse
| 0
|
[] | 52
| null | null | null | null | null | null | null |
// Implementation: impl api::PaymentToken for for Airwallex
// File: crates/hyperswitch_connectors/src/connectors/airwallex.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::PaymentToken for for Airwallex
|
crates/hyperswitch_connectors/src/connectors/airwallex.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 61
| null |
Airwallex
|
api::PaymentToken for
| 0
| 0
| null | null |
// Struct: ProphetpayAuthType
// File: crates/hyperswitch_connectors/src/connectors/prophetpay/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct ProphetpayAuthType
|
crates/hyperswitch_connectors/src/connectors/prophetpay/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
ProphetpayAuthType
| 0
|
[] | 50
| null | null | null | null | null | null | null |
// Implementation: impl api::PaymentVoid for for Coingate
// File: crates/hyperswitch_connectors/src/connectors/coingate.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::PaymentVoid for for Coingate
|
crates/hyperswitch_connectors/src/connectors/coingate.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 60
| null |
Coingate
|
api::PaymentVoid for
| 0
| 0
| null | null |
// Implementation: impl NoEmailClient
// File: crates/external_services/src/email/no_email.rs
// Module: external_services
// Methods: 1 total (0 public)
impl NoEmailClient
|
crates/external_services/src/email/no_email.rs
|
external_services
|
impl_block
| null | null | null | 41
| null |
NoEmailClient
| null | 1
| 0
| null | null |
// Implementation: impl api::PaymentToken for for CtpMastercard
// File: crates/hyperswitch_connectors/src/connectors/ctp_mastercard.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::PaymentToken for for CtpMastercard
|
crates/hyperswitch_connectors/src/connectors/ctp_mastercard.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 63
| null |
CtpMastercard
|
api::PaymentToken for
| 0
| 0
| null | null |
// Struct: KlarnaPaymentsRequest
// File: crates/hyperswitch_connectors/src/connectors/klarna/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct KlarnaPaymentsRequest
|
crates/hyperswitch_connectors/src/connectors/klarna/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
KlarnaPaymentsRequest
| 0
|
[] | 50
| null | null | null | null | null | null | null |
// Implementation: impl UserFlow
// File: crates/router/src/types/domain/user/decision_manager.rs
// Module: router
// Methods: 1 total (0 public)
impl UserFlow
|
crates/router/src/types/domain/user/decision_manager.rs
|
router
|
impl_block
| null | null | null | 39
| null |
UserFlow
| null | 1
| 0
| null | null |
// Struct: Apm
// File: crates/hyperswitch_connectors/src/connectors/globalpay/response.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct Apm
|
crates/hyperswitch_connectors/src/connectors/globalpay/response.rs
|
hyperswitch_connectors
|
struct_definition
|
Apm
| 0
|
[] | 43
| null | null | null | null | null | null | null |
// File: crates/router/src/routes/process_tracker.rs
// Module: router
#[cfg(feature = "v2")]
pub mod revenue_recovery;
|
crates/router/src/routes/process_tracker.rs
|
router
|
full_file
| null | null | null | 29
| null | null | null | null | null | null | null |
// Function: get_sdk_event_dimensions
// File: crates/analytics/src/utils.rs
// Module: analytics
pub fn get_sdk_event_dimensions() -> Vec<NameDescription>
|
crates/analytics/src/utils.rs
|
analytics
|
function_signature
| null | null | null | 36
|
get_sdk_event_dimensions
| null | null | null | null | null | null |
// Function: get_user_theme_using_theme_id
// File: crates/router/src/core/user/theme.rs
// Module: router
pub fn get_user_theme_using_theme_id(
state: SessionState,
user_from_token: UserFromToken,
theme_id: String,
) -> UserResponse<theme_api::GetThemeResponse>
|
crates/router/src/core/user/theme.rs
|
router
|
function_signature
| null | null | null | 68
|
get_user_theme_using_theme_id
| null | null | null | null | null | null |
// Struct: FlexitiAccessTokenResponse
// File: crates/hyperswitch_connectors/src/connectors/flexiti/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct FlexitiAccessTokenResponse
|
crates/hyperswitch_connectors/src/connectors/flexiti/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
FlexitiAccessTokenResponse
| 0
|
[] | 50
| null | null | null | null | null | null | null |
// Implementation: impl HubspotRequest
// File: crates/external_services/src/hubspot_proxy.rs
// Module: external_services
// Methods: 1 total (1 public)
impl HubspotRequest
|
crates/external_services/src/hubspot_proxy.rs
|
external_services
|
impl_block
| null | null | null | 42
| null |
HubspotRequest
| null | 1
| 1
| null | null |
// Function: get_mut
// File: crates/hyperswitch_constraint_graph/src/dense_map.rs
// Module: hyperswitch_constraint_graph
pub fn get_mut(&mut self, idx: K) -> Option<&mut V>
|
crates/hyperswitch_constraint_graph/src/dense_map.rs
|
hyperswitch_constraint_graph
|
function_signature
| null | null | null | 48
|
get_mut
| null | null | null | null | null | null |
// Implementation: impl api::PaymentSync for for Fiuu
// File: crates/hyperswitch_connectors/src/connectors/fiuu.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::PaymentSync for for Fiuu
|
crates/hyperswitch_connectors/src/connectors/fiuu.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 60
| null |
Fiuu
|
api::PaymentSync for
| 0
| 0
| null | null |
// Struct: MerchantInitiatedTransaction
// File: crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct MerchantInitiatedTransaction
|
crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
MerchantInitiatedTransaction
| 0
|
[] | 51
| null | null | null | null | null | null | null |
// File: crates/api_models/src/pm_auth.rs
// Module: api_models
// Public structs: 6
use common_enums::{PaymentMethod, PaymentMethodType};
use common_utils::{
events::{ApiEventMetric, ApiEventsType},
id_type, impl_api_event_type,
};
#[derive(Debug, Clone, serde::Deserialize, serde::Serialize)]
#[serde(rename_all = "snake_case")]
pub struct LinkTokenCreateRequest {
pub language: Option<String>, // optional language field to be passed
pub client_secret: Option<String>, // client secret to be passed in req body
pub payment_id: id_type::PaymentId, // payment_id to be passed in req body for redis pm_auth connector name fetch
pub payment_method: PaymentMethod, // payment_method to be used for filtering pm_auth connector
pub payment_method_type: PaymentMethodType, // payment_method_type to be used for filtering pm_auth connector
}
#[derive(Debug, Clone, serde::Serialize)]
pub struct LinkTokenCreateResponse {
pub link_token: String, // link_token received in response
pub connector: String, // pm_auth connector name in response
}
#[derive(Debug, Clone, serde::Deserialize, serde::Serialize)]
#[serde(rename_all = "snake_case")]
pub struct ExchangeTokenCreateRequest {
pub public_token: String,
pub client_secret: Option<String>,
pub payment_id: id_type::PaymentId,
pub payment_method: PaymentMethod,
pub payment_method_type: PaymentMethodType,
}
#[derive(Debug, Clone, serde::Serialize)]
pub struct ExchangeTokenCreateResponse {
pub access_token: String,
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
pub struct PaymentMethodAuthConfig {
pub enabled_payment_methods: Vec<PaymentMethodAuthConnectorChoice>,
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
pub struct PaymentMethodAuthConnectorChoice {
pub payment_method: PaymentMethod,
pub payment_method_type: PaymentMethodType,
pub connector_name: String,
pub mca_id: id_type::MerchantConnectorAccountId,
}
impl_api_event_type!(
Miscellaneous,
(
LinkTokenCreateRequest,
LinkTokenCreateResponse,
ExchangeTokenCreateRequest,
ExchangeTokenCreateResponse
)
);
|
crates/api_models/src/pm_auth.rs
|
api_models
|
full_file
| null | null | null | 478
| null | null | null | null | null | null | null |
// File: crates/router/src/types/storage/payouts.rs
// Module: router
pub use diesel_models::payouts::{Payouts, PayoutsNew, PayoutsUpdate, PayoutsUpdateInternal};
|
crates/router/src/types/storage/payouts.rs
|
router
|
full_file
| null | null | null | 47
| null | null | null | null | null | null | null |
// Struct: SsoSignInRequest
// File: crates/api_models/src/user.rs
// Module: api_models
// Implementations: 0
pub struct SsoSignInRequest
|
crates/api_models/src/user.rs
|
api_models
|
struct_definition
|
SsoSignInRequest
| 0
|
[] | 37
| null | null | null | null | null | null | null |
// Implementation: impl api::ConnectorAccessToken for for Adyen
// File: crates/hyperswitch_connectors/src/connectors/adyen.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::ConnectorAccessToken for for Adyen
|
crates/hyperswitch_connectors/src/connectors/adyen.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 58
| null |
Adyen
|
api::ConnectorAccessToken for
| 0
| 0
| null | null |
// Implementation: impl Address
// File: crates/diesel_models/src/query/address.rs
// Module: diesel_models
// Methods: 7 total (0 public)
impl Address
|
crates/diesel_models/src/query/address.rs
|
diesel_models
|
impl_block
| null | null | null | 36
| null |
Address
| null | 7
| 0
| null | null |
// Struct: ListUsersInEntityRequest
// File: crates/api_models/src/user_role.rs
// Module: api_models
// Implementations: 0
pub struct ListUsersInEntityRequest
|
crates/api_models/src/user_role.rs
|
api_models
|
struct_definition
|
ListUsersInEntityRequest
| 0
|
[] | 40
| null | null | null | null | null | null | null |
// Implementation: impl api::MandateSetup for for Zsl
// File: crates/hyperswitch_connectors/src/connectors/zsl.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::MandateSetup for for Zsl
|
crates/hyperswitch_connectors/src/connectors/zsl.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 61
| null |
Zsl
|
api::MandateSetup for
| 0
| 0
| null | null |
// Struct: CardResponse
// File: crates/hyperswitch_connectors/src/connectors/bambora/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct CardResponse
|
crates/hyperswitch_connectors/src/connectors/bambora/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
CardResponse
| 0
|
[] | 46
| null | null | null | null | null | null | null |
// Implementation: impl api::PayoutEligibility for for Wise
// File: crates/hyperswitch_connectors/src/connectors/wise.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::PayoutEligibility for for Wise
|
crates/hyperswitch_connectors/src/connectors/wise.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 61
| null |
Wise
|
api::PayoutEligibility for
| 0
| 0
| null | null |
// Struct: ExtendedCardInfoChoice
// File: crates/api_models/src/admin.rs
// Module: api_models
// Implementations: 1
// Traits: common_utils::events::ApiEventMetric
pub struct ExtendedCardInfoChoice
|
crates/api_models/src/admin.rs
|
api_models
|
struct_definition
|
ExtendedCardInfoChoice
| 1
|
[
"common_utils::events::ApiEventMetric"
] | 49
| null | null | null | null | null | null | null |
// File: crates/analytics/src/api_event/metrics.rs
// Module: analytics
// Public structs: 1
use api_models::analytics::{
api_event::{
ApiEventDimensions, ApiEventFilters, ApiEventMetrics, ApiEventMetricsBucketIdentifier,
},
Granularity, TimeRange,
};
use time::PrimitiveDateTime;
use crate::{
query::{Aggregate, GroupByClause, ToSql, Window},
types::{AnalyticsCollection, AnalyticsDataSource, LoadRow, MetricsResult},
};
mod api_count;
pub mod latency;
mod status_code_count;
use std::collections::HashSet;
use api_count::ApiCount;
use latency::MaxLatency;
use status_code_count::StatusCodeCount;
use self::latency::LatencyAvg;
#[derive(Debug, PartialEq, Eq, serde::Deserialize, Hash)]
pub struct ApiEventMetricRow {
pub latency: Option<u64>,
pub api_count: Option<u64>,
pub status_code_count: Option<u64>,
#[serde(with = "common_utils::custom_serde::iso8601::option")]
pub start_bucket: Option<PrimitiveDateTime>,
#[serde(with = "common_utils::custom_serde::iso8601::option")]
pub end_bucket: Option<PrimitiveDateTime>,
}
pub trait ApiEventMetricAnalytics: LoadRow<ApiEventMetricRow> + LoadRow<LatencyAvg> {}
#[async_trait::async_trait]
pub trait ApiEventMetric<T>
where
T: AnalyticsDataSource + ApiEventMetricAnalytics,
{
async fn load_metrics(
&self,
dimensions: &[ApiEventDimensions],
merchant_id: &common_utils::id_type::MerchantId,
filters: &ApiEventFilters,
granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(ApiEventMetricsBucketIdentifier, ApiEventMetricRow)>>;
}
#[async_trait::async_trait]
impl<T> ApiEventMetric<T> for ApiEventMetrics
where
T: AnalyticsDataSource + ApiEventMetricAnalytics,
PrimitiveDateTime: ToSql<T>,
AnalyticsCollection: ToSql<T>,
Granularity: GroupByClause<T>,
Aggregate<&'static str>: ToSql<T>,
Window<&'static str>: ToSql<T>,
{
async fn load_metrics(
&self,
dimensions: &[ApiEventDimensions],
merchant_id: &common_utils::id_type::MerchantId,
filters: &ApiEventFilters,
granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(ApiEventMetricsBucketIdentifier, ApiEventMetricRow)>> {
match self {
Self::Latency => {
MaxLatency
.load_metrics(
dimensions,
merchant_id,
filters,
granularity,
time_range,
pool,
)
.await
}
Self::ApiCount => {
ApiCount
.load_metrics(
dimensions,
merchant_id,
filters,
granularity,
time_range,
pool,
)
.await
}
Self::StatusCodeCount => {
StatusCodeCount
.load_metrics(
dimensions,
merchant_id,
filters,
granularity,
time_range,
pool,
)
.await
}
}
}
}
|
crates/analytics/src/api_event/metrics.rs
|
analytics
|
full_file
| null | null | null | 709
| null | null | null | null | null | null | null |
))?,
PaymentMethodData::BankRedirect(BankRedirectData::Interac { .. }) => {
let payment_method = PaysafePaymentMethod::Interac {
interac_etransfer: InteracBankRedirect {
consumer_id: item.router_data.get_billing_email()?,
},
};
let payment_type = PaysafePaymentType::InteracEtransfer;
let account_id = metadata.account_id.get_interac_account_id(currency_code)?;
let profile = Some(PaysafeProfile {
first_name: item.router_data.get_billing_first_name()?,
last_name: item.router_data.get_billing_last_name()?,
email: item.router_data.get_billing_email()?,
});
(payment_method, payment_type, account_id, None, profile)
}
PaymentMethodData::BankRedirect(_) => Err(errors::ConnectorError::NotImplemented(
"Payment Method".to_string(),
))?,
PaymentMethodData::GiftCard(gift_card_data) => match gift_card_data.as_ref() {
GiftCardData::PaySafeCard {} => {
let payment_method = PaysafePaymentMethod::PaysafeCard {
pay_safe_card: PaysafeGiftCard {
consumer_id: item.router_data.get_customer_id()?,
},
};
let payment_type = PaysafePaymentType::Paysafecard;
let account_id = metadata
.account_id
.get_paysafe_gift_card_account_id(currency_code)?;
(payment_method, payment_type, account_id, None, None)
}
_ => Err(errors::ConnectorError::NotImplemented(
"Payment Method".to_string(),
))?,
},
_ => Err(errors::ConnectorError::NotImplemented(
"Payment Method".to_string(),
))?,
};
Ok(Self {
merchant_ref_num: item.router_data.connector_request_reference_id.clone(),
amount,
settle_with_auth,
payment_method,
currency_code,
payment_type,
transaction_type,
return_links,
account_id,
three_ds,
profile,
})
}
}
impl TryFrom<&PaysafeRouterData<&PaymentsCompleteAuthorizeRouterData>> for PaysafePaymentsRequest {
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(
item: &PaysafeRouterData<&PaymentsCompleteAuthorizeRouterData>,
) -> Result<Self, Self::Error> {
let paysafe_meta: PaysafeMeta = to_connector_meta(
item.router_data.request.connector_meta.clone(),
)
.change_context(errors::ConnectorError::InvalidConnectorConfig {
config: "connector_metadata",
})?;
let payment_handle_token = paysafe_meta.payment_handle_token;
let amount = item.amount;
let customer_ip = Some(
item.router_data
.request
.get_browser_info()?
.get_ip_address()?,
);
Ok(Self {
merchant_ref_num: item.router_data.connector_request_reference_id.clone(),
payment_handle_token,
amount,
settle_with_auth: item.router_data.request.is_auto_capture()?,
currency_code: item.router_data.request.currency,
customer_ip,
})
}
}
impl<F>
TryFrom<
ResponseRouterData<F, PaysafePaymentsResponse, CompleteAuthorizeData, PaymentsResponseData>,
> for RouterData<F, CompleteAuthorizeData, PaymentsResponseData>
{
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(
item: ResponseRouterData<
F,
PaysafePaymentsResponse,
CompleteAuthorizeData,
PaymentsResponseData,
>,
) -> Result<Self, Self::Error> {
Ok(Self {
status: get_paysafe_payment_status(
item.response.status,
item.data.request.capture_method,
),
response: Ok(PaymentsResponseData::TransactionResponse {
resource_id: ResponseId::ConnectorTransactionId(item.response.id),
redirection_data: Box::new(None),
mandate_reference: Box::new(None),
connector_metadata: None,
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
charges: None,
}),
..item.data
})
}
}
pub struct PaysafeAuthType {
pub(super) username: Secret<String>,
pub(super) password: Secret<String>,
}
impl TryFrom<&ConnectorAuthType> for PaysafeAuthType {
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(auth_type: &ConnectorAuthType) -> Result<Self, Self::Error> {
match auth_type {
ConnectorAuthType::BodyKey { api_key, key1 } => Ok(Self {
username: api_key.to_owned(),
password: key1.to_owned(),
}),
_ => Err(errors::ConnectorError::FailedToObtainAuthType.into()),
}
}
}
// Paysafe Payment Status
#[derive(Debug, Clone, Copy, Default, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "UPPERCASE")]
pub enum PaysafePaymentStatus {
Received,
Completed,
Held,
Failed,
#[default]
Pending,
Cancelled,
Processing,
}
pub fn get_paysafe_payment_status(
status: PaysafePaymentStatus,
capture_method: Option<common_enums::CaptureMethod>,
) -> common_enums::AttemptStatus {
match status {
PaysafePaymentStatus::Completed => match capture_method {
Some(common_enums::CaptureMethod::Manual) => common_enums::AttemptStatus::Authorized,
Some(common_enums::CaptureMethod::Automatic) | None => {
common_enums::AttemptStatus::Charged
}
Some(common_enums::CaptureMethod::SequentialAutomatic)
| Some(common_enums::CaptureMethod::ManualMultiple)
| Some(common_enums::CaptureMethod::Scheduled) => {
common_enums::AttemptStatus::Unresolved
}
},
PaysafePaymentStatus::Failed => common_enums::AttemptStatus::Failure,
PaysafePaymentStatus::Pending
| PaysafePaymentStatus::Processing
| PaysafePaymentStatus::Received
| PaysafePaymentStatus::Held => common_enums::AttemptStatus::Pending,
PaysafePaymentStatus::Cancelled => common_enums::AttemptStatus::Voided,
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum PaysafeSyncResponse {
Payments(PaysafePaymentsSyncResponse),
PaymentHandles(PaysafePaymentHandlesSyncResponse),
}
// Paysafe Payments Response Structure
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct PaysafePaymentsSyncResponse {
pub payments: Vec<PaysafePaymentsResponse>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct PaysafePaymentHandlesSyncResponse {
pub payment_handles: Vec<PaysafePaymentHandleResponse>,
}
// Paysafe Payments Response Structure
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct PaysafePaymentsResponse {
pub id: String,
pub merchant_ref_num: Option<String>,
pub status: PaysafePaymentStatus,
pub error: Option<Error>,
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct PaysafeSettlementResponse {
pub merchant_ref_num: Option<String>,
pub id: String,
pub status: PaysafeSettlementStatus,
}
impl<F> TryFrom<ResponseRouterData<F, PaysafeSyncResponse, PaymentsSyncData, PaymentsResponseData>>
for RouterData<F, PaymentsSyncData, PaymentsResponseData>
{
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(
item: ResponseRouterData<F, PaysafeSyncResponse, PaymentsSyncData, PaymentsResponseData>,
) -> Result<Self, Self::Error> {
let status = match &item.response {
PaysafeSyncResponse::Payments(sync_response) => {
let payment_response = sync_response
.payments
.first()
.ok_or(errors::ConnectorError::ResponseDeserializationFailed)?;
get_paysafe_payment_status(
payment_response.status,
item.data.request.capture_method,
)
}
PaysafeSyncResponse::PaymentHandles(sync_response) => {
let payment_handle_response = sync_response
.payment_handles
.first()
.ok_or(errors::ConnectorError::ResponseDeserializationFailed)?;
common_enums::AttemptStatus::try_from(payment_handle_response.status)?
}
};
let response = if utils::is_payment_failure(status) {
let (code, message, reason, connector_transaction_id) = match &item.response {
PaysafeSyncResponse::Payments(sync_response) => {
let payment_response = sync_response
.payments
.first()
.ok_or(errors::ConnectorError::ResponseDeserializationFailed)?;
match &payment_response.error {
Some(err) => (
err.code.clone(),
err.message.clone(),
err.details
.as_ref()
.and_then(|d| d.first().cloned())
.or_else(|| Some(err.message.clone())),
payment_response.id.clone(),
),
None => (
consts::NO_ERROR_CODE.to_string(),
consts::NO_ERROR_MESSAGE.to_string(),
None,
payment_response.id.clone(),
),
}
}
PaysafeSyncResponse::PaymentHandles(sync_response) => {
let payment_handle_response = sync_response
.payment_handles
.first()
.ok_or(errors::ConnectorError::ResponseDeserializationFailed)?;
match &payment_handle_response.error {
Some(err) => (
err.code.clone(),
err.message.clone(),
err.details
.as_ref()
.and_then(|d| d.first().cloned())
.or_else(|| Some(err.message.clone())),
payment_handle_response.id.clone(),
),
None => (
consts::NO_ERROR_CODE.to_string(),
consts::NO_ERROR_MESSAGE.to_string(),
None,
payment_handle_response.id.clone(),
),
}
}
};
Err(hyperswitch_domain_models::router_data::ErrorResponse {
code,
message,
reason,
attempt_status: None,
connector_transaction_id: Some(connector_transaction_id),
status_code: item.http_code,
network_advice_code: None,
network_decline_code: None,
network_error_message: None,
connector_metadata: None,
})
} else {
Ok(PaymentsResponseData::TransactionResponse {
resource_id: ResponseId::NoResponseId,
redirection_data: Box::new(None),
mandate_reference: Box::new(None),
connector_metadata: None,
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
charges: None,
})
};
Ok(Self {
status,
response,
..item.data
})
}
}
#[derive(Debug, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct PaysafeCaptureRequest {
pub merchant_ref_num: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub amount: Option<MinorUnit>,
}
impl TryFrom<&PaysafeRouterData<&PaymentsCaptureRouterData>> for PaysafeCaptureRequest {
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(item: &PaysafeRouterData<&PaymentsCaptureRouterData>) -> Result<Self, Self::Error> {
let amount = Some(item.amount);
Ok(Self {
merchant_ref_num: item.router_data.connector_request_reference_id.clone(),
amount,
})
}
}
#[derive(Debug, Clone, Copy, Default, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "UPPERCASE")]
pub enum PaysafeSettlementStatus {
Received,
Initiated,
Completed,
Expired,
Failed,
#[default]
Pending,
Cancelled,
}
impl From<PaysafeSettlementStatus> for common_enums::AttemptStatus {
fn from(item: PaysafeSettlementStatus) -> Self {
match item {
PaysafeSettlementStatus::Completed
| PaysafeSettlementStatus::Pending
| PaysafeSettlementStatus::Received => Self::Charged,
PaysafeSettlementStatus::Failed | PaysafeSettlementStatus::Expired => Self::Failure,
PaysafeSettlementStatus::Cancelled => Self::Voided,
PaysafeSettlementStatus::Initiated => Self::Pending,
}
}
}
impl<F, T> TryFrom<ResponseRouterData<F, PaysafeSettlementResponse, T, PaymentsResponseData>>
for RouterData<F, T, PaymentsResponseData>
{
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(
item: ResponseRouterData<F, PaysafeSettlementResponse, T, PaymentsResponseData>,
) -> Result<Self, Self::Error> {
Ok(Self {
status: common_enums::AttemptStatus::from(item.response.status),
response: Ok(PaymentsResponseData::TransactionResponse {
resource_id: ResponseId::ConnectorTransactionId(item.response.id.clone()),
redirection_data: Box::new(None),
mandate_reference: Box::new(None),
connector_metadata: None,
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
charges: None,
}),
..item.data
})
}
}
impl TryFrom<&PaysafeRouterData<&PaymentsCancelRouterData>> for PaysafeCaptureRequest {
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(item: &PaysafeRouterData<&PaymentsCancelRouterData>) -> Result<Self, Self::Error> {
let amount = Some(item.amount);
Ok(Self {
merchant_ref_num: item.router_data.connector_request_reference_id.clone(),
amount,
})
}
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct VoidResponse {
pub merchant_ref_num: Option<String>,
pub id: String,
pub status: PaysafeVoidStatus,
}
#[derive(Debug, Clone, Copy, Default, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "UPPERCASE")]
pub enum PaysafeVoidStatus {
Received,
Completed,
Held,
Failed,
#[default]
Pending,
Cancelled,
}
impl From<PaysafeVoidStatus> for common_enums::AttemptStatus {
fn from(item: PaysafeVoidStatus) -> Self {
match item {
PaysafeVoidStatus::Completed
| PaysafeVoidStatus::Pending
| PaysafeVoidStatus::Received => Self::Voided,
PaysafeVoidStatus::Failed | PaysafeVoidStatus::Held => Self::Failure,
PaysafeVoidStatus::Cancelled => Self::Voided,
}
}
}
impl<F, T> TryFrom<ResponseRouterData<F, VoidResponse, T, PaymentsResponseData>>
for RouterData<F, T, PaymentsResponseData>
{
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(
item: ResponseRouterData<F, VoidResponse, T, PaymentsResponseData>,
) -> Result<Self, Self::Error> {
Ok(Self {
status: common_enums::AttemptStatus::from(item.response.status),
response: Ok(PaymentsResponseData::TransactionResponse {
resource_id: ResponseId::NoResponseId,
redirection_data: Box::new(None),
mandate_reference: Box::new(None),
connector_metadata: None,
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
charges: None,
}),
..item.data
})
}
}
#[derive(Debug, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct PaysafeRefundRequest {
pub merchant_ref_num: String,
pub amount: MinorUnit,
}
impl<F> TryFrom<&PaysafeRouterData<&RefundsRouterData<F>>> for PaysafeRefundRequest {
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(item: &PaysafeRouterData<&RefundsRouterData<F>>) -> Result<Self, Self::Error> {
let amount = item.amount;
Ok(Self {
merchant_ref_num: item.router_data.request.refund_id.clone(),
amount,
})
}
}
// Type definition for Refund Response
#[derive(Debug, Copy, Serialize, Default, Deserialize, Clone)]
#[serde(rename_all = "UPPERCASE")]
pub enum RefundStatus {
Received,
Initiated,
Completed,
Expired,
Failed,
#[default]
Pending,
Cancelled,
}
impl From<RefundStatus> for enums::RefundStatus {
fn from(item: RefundStatus) -> Self {
match item {
RefundStatus::Received | RefundStatus::Completed => Self::Success,
RefundStatus::Failed | RefundStatus::Cancelled | RefundStatus::Expired => Self::Failure,
RefundStatus::Pending | RefundStatus::Initiated => Self::Pending,
}
}
}
#[derive(Default, Debug, Clone, Serialize, Deserialize)]
pub struct RefundResponse {
id: String,
status: RefundStatus,
}
impl TryFrom<RefundsResponseRouterData<Execute, RefundResponse>> for RefundsRouterData<Execute> {
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(
item: RefundsResponseRouterData<Execute, RefundResponse>,
) -> Result<Self, Self::Error> {
Ok(Self {
response: Ok(RefundsResponseData {
connector_refund_id: item.response.id.to_string(),
refund_status: enums::RefundStatus::from(item.response.status),
}),
..item.data
})
}
}
impl TryFrom<RefundsResponseRouterData<RSync, RefundResponse>> for RefundsRouterData<RSync> {
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(
item: RefundsResponseRouterData<RSync, RefundResponse>,
) -> Result<Self, Self::Error> {
Ok(Self {
response: Ok(RefundsResponseData {
connector_refund_id: item.response.id.to_string(),
refund_status: enums::RefundStatus::from(item.response.status),
}),
..item.data
})
}
}
#[derive(Debug, Serialize, Deserialize)]
pub struct PaysafeErrorResponse {
pub error: Error,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Error {
pub code: String,
pub message: String,
pub details: Option<Vec<String>>,
#[serde(rename = "fieldErrors")]
pub field_errors: Option<Vec<FieldError>>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct FieldError {
pub field: Option<String>,
pub error: String,
}
|
crates/hyperswitch_connectors/src/connectors/paysafe/transformers.rs#chunk1
|
hyperswitch_connectors
|
chunk
| null | null | null | 4,067
| null | null | null | null | null | null | null |
// Module Structure
// File: crates/router/src/core/three_ds_decision_rule.rs
// Module: router
// Public submodules:
pub mod utils;
|
crates/router/src/core/three_ds_decision_rule.rs
|
router
|
module_structure
| null | null | null | 32
| null | null | null | null | null | 1
| 0
|
// Module Structure
// File: crates/router/src/core/payment_methods.rs
// Module: router
// Public submodules:
pub mod cards;
pub mod migration;
pub mod network_tokenization;
pub mod surcharge_decision_configs;
pub mod tokenize;
pub mod transformers;
pub mod utils;
pub mod vault;
// Public exports:
pub use api_models::enums as api_enums;
pub use api_models::enums::Connector;
pub use api_models::{enums::PayoutConnectors, payouts as payout_types};
|
crates/router/src/core/payment_methods.rs
|
router
|
module_structure
| null | null | null | 103
| null | null | null | null | null | 8
| 3
|
// File: crates/payment_methods/src/lib.rs
// Module: payment_methods
pub mod configs;
pub mod controller;
pub mod core;
pub mod helpers;
pub mod state;
|
crates/payment_methods/src/lib.rs
|
payment_methods
|
full_file
| null | null | null | 36
| null | null | null | null | null | null | null |
// Function: payment_method_session_update_saved_payment_method
// File: crates/openapi/src/routes/payment_method.rs
// Module: openapi
pub fn payment_method_session_update_saved_payment_method()
|
crates/openapi/src/routes/payment_method.rs
|
openapi
|
function_signature
| null | null | null | 39
|
payment_method_session_update_saved_payment_method
| null | null | null | null | null | null |
// Function: server
// File: crates/router/src/compatibility/stripe.rs
// Module: router
pub fn server(state: routes::AppState) -> Scope
|
crates/router/src/compatibility/stripe.rs
|
router
|
function_signature
| null | null | null | 34
|
server
| null | null | null | null | null | null |
// Struct: AdditionalAmount
// File: crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct AdditionalAmount
|
crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
AdditionalAmount
| 0
|
[] | 47
| null | null | null | null | null | null | null |
// Function: list_merchant_account
// File: crates/router/src/core/admin.rs
// Module: router
pub fn list_merchant_account(
state: SessionState,
req: api_models::admin::MerchantAccountListRequest,
org_data_from_auth: Option<authentication::AuthenticationDataWithOrg>,
) -> RouterResponse<Vec<api::MerchantAccountResponse>>
|
crates/router/src/core/admin.rs
|
router
|
function_signature
| null | null | null | 76
|
list_merchant_account
| null | null | null | null | null | null |
// Function: insert
// File: crates/diesel_models/src/query/user.rs
// Module: diesel_models
pub fn insert(self, conn: &PgPooledConn) -> StorageResult<User>
|
crates/diesel_models/src/query/user.rs
|
diesel_models
|
function_signature
| null | null | null | 41
|
insert
| null | null | null | null | null | null |
// File: crates/hyperswitch_connectors/src/connectors/coingate/transformers.rs
// Module: hyperswitch_connectors
// Public structs: 10
use std::collections::HashMap;
use common_enums::{enums, Currency};
use common_utils::{ext_traits::OptionExt, pii, request::Method, types::StringMajorUnit};
use error_stack::ResultExt;
use hyperswitch_domain_models::{
payment_method_data::PaymentMethodData,
router_data::{ConnectorAuthType, RouterData},
router_flow_types::refunds::{Execute, RSync},
router_request_types::ResponseId,
router_response_types::{PaymentsResponseData, RedirectForm, RefundsResponseData},
types::{PaymentsAuthorizeRouterData, PaymentsSyncRouterData, RefundsRouterData},
};
use hyperswitch_interfaces::errors;
use masking::{ExposeInterface, Secret};
use serde::{Deserialize, Serialize};
use crate::{
types::{PaymentsSyncResponseRouterData, RefundsResponseRouterData, ResponseRouterData},
utils::{self, PaymentsAuthorizeRequestData},
};
pub struct CoingateRouterData<T> {
pub amount: StringMajorUnit,
pub router_data: T,
}
impl<T> From<(StringMajorUnit, T)> for CoingateRouterData<T> {
fn from((amount, item): (StringMajorUnit, T)) -> Self {
Self {
amount,
router_data: item,
}
}
}
#[derive(Debug, Serialize, Deserialize)]
pub struct CoingateConnectorMetadataObject {
pub currency_id: i32,
pub platform_id: i32,
pub ledger_account_id: Secret<String>,
}
impl TryFrom<&Option<pii::SecretSerdeValue>> for CoingateConnectorMetadataObject {
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(meta_data: &Option<pii::SecretSerdeValue>) -> Result<Self, Self::Error> {
let metadata: Self = utils::to_connector_meta_from_secret::<Self>(meta_data.clone())
.change_context(errors::ConnectorError::InvalidConnectorConfig {
config: "metadata",
})?;
Ok(metadata)
}
}
#[derive(Default, Debug, Serialize, PartialEq)]
pub struct CoingatePaymentsRequest {
price_amount: StringMajorUnit,
price_currency: Currency,
receive_currency: String,
callback_url: String,
success_url: Option<String>,
cancel_url: Option<String>,
title: String,
token: Secret<String>,
}
impl TryFrom<&CoingateRouterData<&PaymentsAuthorizeRouterData>> for CoingatePaymentsRequest {
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(
item: &CoingateRouterData<&PaymentsAuthorizeRouterData>,
) -> Result<Self, Self::Error> {
let auth = CoingateAuthType::try_from(&item.router_data.connector_auth_type)?;
Ok(match item.router_data.request.payment_method_data {
PaymentMethodData::Crypto(_) => Ok(Self {
price_amount: item.amount.clone(),
price_currency: item.router_data.request.currency,
receive_currency: "DO_NOT_CONVERT".to_string(),
callback_url: item.router_data.request.get_webhook_url()?,
success_url: item.router_data.request.router_return_url.clone(),
cancel_url: item.router_data.request.router_return_url.clone(),
title: item.router_data.connector_request_reference_id.clone(),
token: auth.merchant_token,
}),
_ => Err(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message("Coingate"),
)),
}?)
}
}
#[derive(Debug, Serialize, Deserialize)]
pub struct CoingateSyncResponse {
status: CoingatePaymentStatus,
id: i64,
}
impl TryFrom<PaymentsSyncResponseRouterData<CoingateSyncResponse>> for PaymentsSyncRouterData {
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(
item: PaymentsSyncResponseRouterData<CoingateSyncResponse>,
) -> Result<Self, Self::Error> {
Ok(Self {
status: enums::AttemptStatus::from(item.response.status.clone()),
response: Ok(PaymentsResponseData::TransactionResponse {
resource_id: ResponseId::ConnectorTransactionId(item.response.id.to_string()),
redirection_data: Box::new(None),
mandate_reference: Box::new(None),
connector_metadata: None,
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
charges: None,
}),
..item.data
})
}
}
pub struct CoingateAuthType {
pub(super) api_key: Secret<String>,
pub(super) merchant_token: Secret<String>,
}
impl TryFrom<&ConnectorAuthType> for CoingateAuthType {
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(auth_type: &ConnectorAuthType) -> Result<Self, Self::Error> {
match auth_type {
ConnectorAuthType::BodyKey { api_key, key1 } => Ok(Self {
api_key: api_key.to_owned(),
merchant_token: key1.to_owned(),
}),
_ => Err(errors::ConnectorError::FailedToObtainAuthType.into()),
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "lowercase")]
pub enum CoingatePaymentStatus {
New,
Pending,
Confirming,
Paid,
Invalid,
Expired,
Canceled,
}
impl From<CoingatePaymentStatus> for common_enums::AttemptStatus {
fn from(item: CoingatePaymentStatus) -> Self {
match item {
CoingatePaymentStatus::Paid => Self::Charged,
CoingatePaymentStatus::Canceled
| CoingatePaymentStatus::Expired
| CoingatePaymentStatus::Invalid => Self::Failure,
CoingatePaymentStatus::Confirming | CoingatePaymentStatus::New => {
Self::AuthenticationPending
}
CoingatePaymentStatus::Pending => Self::Pending,
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct CoingatePaymentsResponse {
status: CoingatePaymentStatus,
id: i64,
payment_url: Option<String>,
order_id: Option<String>,
}
impl<F, T> TryFrom<ResponseRouterData<F, CoingatePaymentsResponse, T, PaymentsResponseData>>
for RouterData<F, T, PaymentsResponseData>
{
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(
item: ResponseRouterData<F, CoingatePaymentsResponse, T, PaymentsResponseData>,
) -> Result<Self, Self::Error> {
Ok(Self {
status: enums::AttemptStatus::from(item.response.status.clone()),
response: Ok(PaymentsResponseData::TransactionResponse {
resource_id: ResponseId::ConnectorTransactionId(item.response.id.to_string()),
redirection_data: Box::new(Some(RedirectForm::Form {
endpoint: item.response.payment_url.clone().ok_or(
errors::ConnectorError::MissingRequiredField {
field_name: "payment_url",
},
)?,
method: Method::Get,
form_fields: HashMap::new(),
})),
mandate_reference: Box::new(None),
connector_metadata: None,
network_txn_id: None,
connector_response_reference_id: item.response.order_id.clone(),
incremental_authorization_allowed: None,
charges: None,
}),
..item.data
})
}
}
#[derive(Default, Debug, Serialize)]
pub struct CoingateRefundRequest {
pub amount: StringMajorUnit,
pub address: Secret<String>,
pub currency_id: i32,
pub platform_id: i32,
pub reason: String,
pub email: pii::Email,
pub ledger_account_id: Secret<String>,
}
impl<F> TryFrom<&CoingateRouterData<&RefundsRouterData<F>>> for CoingateRefundRequest {
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(item: &CoingateRouterData<&RefundsRouterData<F>>) -> Result<Self, Self::Error> {
let metadata: CoingateConnectorMetadataObject =
utils::to_connector_meta_from_secret(item.router_data.connector_meta_data.clone())
.change_context(errors::ConnectorError::InvalidConnectorConfig {
config: "merchant_connector_account.metadata",
})?;
let refund_metadata = item
.router_data
.request
.refund_connector_metadata
.as_ref()
.get_required_value("refund_connector_metadata")
.change_context(errors::ConnectorError::MissingRequiredField {
field_name: "refund_connector_metadata",
})?
.clone()
.expose();
let address: Secret<String> = serde_json::from_value::<Secret<String>>(
refund_metadata.get("address").cloned().ok_or_else(|| {
errors::ConnectorError::MissingRequiredField {
field_name: "address",
}
})?,
)
.change_context(errors::ConnectorError::MissingRequiredField {
field_name: "address",
})?;
let email: pii::Email = serde_json::from_value::<pii::Email>(
refund_metadata.get("email").cloned().ok_or_else(|| {
errors::ConnectorError::MissingRequiredField {
field_name: "email",
}
})?,
)
.change_context(errors::ConnectorError::MissingRequiredField {
field_name: "email",
})?;
Ok(Self {
amount: item.amount.clone(),
address,
currency_id: metadata.currency_id,
platform_id: metadata.platform_id,
reason: item.router_data.request.reason.clone().ok_or(
errors::ConnectorError::MissingRequiredField {
field_name: "refund.reason",
},
)?,
email,
ledger_account_id: metadata.ledger_account_id,
})
}
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct CoingateRefundResponse {
pub status: CoingateRefundStatus,
pub id: i64,
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "lowercase")]
pub enum CoingateRefundStatus {
Pending,
Completed,
Rejected,
Processing,
}
impl TryFrom<RefundsResponseRouterData<Execute, CoingateRefundResponse>>
for RefundsRouterData<Execute>
{
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(
item: RefundsResponseRouterData<Execute, CoingateRefundResponse>,
) -> Result<Self, Self::Error> {
Ok(Self {
response: Ok(RefundsResponseData {
connector_refund_id: item.response.id.to_string(),
refund_status: enums::RefundStatus::from(item.response.status),
}),
..item.data
})
}
}
impl TryFrom<RefundsResponseRouterData<RSync, CoingateRefundResponse>>
for RefundsRouterData<RSync>
{
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(
item: RefundsResponseRouterData<RSync, CoingateRefundResponse>,
) -> Result<Self, Self::Error> {
Ok(Self {
response: Ok(RefundsResponseData {
connector_refund_id: item.response.id.to_string(),
refund_status: enums::RefundStatus::from(item.response.status),
}),
..item.data
})
}
}
impl From<CoingateRefundStatus> for common_enums::RefundStatus {
fn from(item: CoingateRefundStatus) -> Self {
match item {
CoingateRefundStatus::Pending => Self::Pending,
CoingateRefundStatus::Completed => Self::Success,
CoingateRefundStatus::Rejected => Self::Failure,
CoingateRefundStatus::Processing => Self::Pending,
}
}
}
#[derive(Default, Debug, Serialize, Deserialize, PartialEq)]
pub struct CoingateErrorResponse {
pub message: String,
pub reason: String,
pub errors: Option<Vec<String>>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct CoingateWebhookBody {
pub token: Secret<String>,
pub status: CoingatePaymentStatus,
pub id: i64,
}
|
crates/hyperswitch_connectors/src/connectors/coingate/transformers.rs
|
hyperswitch_connectors
|
full_file
| null | null | null | 2,648
| null | null | null | null | null | null | null |
// Trait: IncomingWebhook
// File: crates/hyperswitch_interfaces/src/webhooks.rs
// Module: hyperswitch_interfaces
pub trait IncomingWebhook: ConnectorCommon + Sync
|
crates/hyperswitch_interfaces/src/webhooks.rs
|
hyperswitch_interfaces
|
trait_definition
| null | null | null | 38
| null | null |
IncomingWebhook
| null | null | null | null |
// Function: set_offset_n_count
// File: crates/analytics/src/opensearch.rs
// Module: analytics
pub fn set_offset_n_count(&mut self, offset: i64, count: i64) -> QueryResult<()>
|
crates/analytics/src/opensearch.rs
|
analytics
|
function_signature
| null | null | null | 51
|
set_offset_n_count
| null | null | null | null | null | null |
// Implementation: impl Gsm
// File: crates/router/src/routes/app.rs
// Module: router
// Methods: 1 total (1 public)
impl Gsm
|
crates/router/src/routes/app.rs
|
router
|
impl_block
| null | null | null | 35
| null |
Gsm
| null | 1
| 1
| null | null |
// Implementation: impl DummyConnectors
// File: crates/hyperswitch_connectors/src/connectors/dummyconnector/transformers.rs
// Module: hyperswitch_connectors
// Methods: 1 total (1 public)
impl DummyConnectors
|
crates/hyperswitch_connectors/src/connectors/dummyconnector/transformers.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 51
| null |
DummyConnectors
| null | 1
| 1
| null | null |
// Function: call_capture_request
// File: crates/router/src/core/payments/flows.rs
// Module: router
// Documentation: Executes a capture request by building a connector-specific request and deciding the appropriate flow to send it to the payment connector.
pub fn call_capture_request(
mut capture_router_data: types::RouterData<
api::Capture,
PaymentsCaptureData,
types::PaymentsResponseData,
>,
state: &SessionState,
connector: &api::ConnectorData,
call_connector_action: payments::CallConnectorAction,
business_profile: &domain::Profile,
header_payload: domain_payments::HeaderPayload,
) -> RouterResult<types::RouterData<api::Capture, PaymentsCaptureData, types::PaymentsResponseData>>
|
crates/router/src/core/payments/flows.rs
|
router
|
function_signature
| null | null | null | 158
|
call_capture_request
| null | null | null | null | null | null |
// Struct: CardValidation
// File: crates/hyperswitch_connectors/src/connectors/bambora/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct CardValidation
|
crates/hyperswitch_connectors/src/connectors/bambora/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
CardValidation
| 0
|
[] | 46
| null | null | null | null | null | null | null |
// Function: get_refund_dimensions
// File: crates/analytics/src/utils.rs
// Module: analytics
pub fn get_refund_dimensions() -> Vec<NameDescription>
|
crates/analytics/src/utils.rs
|
analytics
|
function_signature
| null | null | null | 36
|
get_refund_dimensions
| null | null | null | null | null | null |
// Implementation: impl OpenSearchConfig
// File: crates/analytics/src/opensearch.rs
// Module: analytics
// Methods: 2 total (1 public)
impl OpenSearchConfig
|
crates/analytics/src/opensearch.rs
|
analytics
|
impl_block
| null | null | null | 39
| null |
OpenSearchConfig
| null | 2
| 1
| null | null |
// Function: get_total_surcharge_amount
// File: crates/hyperswitch_domain_models/src/payments/payment_attempt.rs
// Module: hyperswitch_domain_models
pub fn get_total_surcharge_amount(&self) -> Option<MinorUnit>
|
crates/hyperswitch_domain_models/src/payments/payment_attempt.rs
|
hyperswitch_domain_models
|
function_signature
| null | null | null | 50
|
get_total_surcharge_amount
| null | null | null | null | null | null |
// Function: post_payment_frm_core
// File: crates/router/src/core/fraud_check.rs
// Module: router
pub fn post_payment_frm_core<F, D>(
state: &SessionState,
req_state: ReqState,
merchant_context: &domain::MerchantContext,
payment_data: &mut D,
frm_info: &mut FrmInfo<F, D>,
frm_configs: FrmConfigsObject,
customer: &Option<domain::Customer>,
should_continue_capture: &mut bool,
) -> RouterResult<Option<FrmData>>
where
F: Send + Clone,
D: payments::OperationSessionGetters<F>
+ payments::OperationSessionSetters<F>
+ Send
+ Sync
+ Clone,
|
crates/router/src/core/fraud_check.rs
|
router
|
function_signature
| null | null | null | 157
|
post_payment_frm_core
| null | null | null | null | null | null |
// Function: from_storage
// File: crates/router/src/services/kafka/payment_attempt_event.rs
// Module: router
pub fn from_storage(attempt: &'a PaymentAttempt) -> Self
|
crates/router/src/services/kafka/payment_attempt_event.rs
|
router
|
function_signature
| null | null | null | 39
|
from_storage
| null | null | null | null | null | null |
// Implementation: impl api::PaymentSync for for Placetopay
// File: crates/hyperswitch_connectors/src/connectors/placetopay.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::PaymentSync for for Placetopay
|
crates/hyperswitch_connectors/src/connectors/placetopay.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 63
| null |
Placetopay
|
api::PaymentSync for
| 0
| 0
| null | null |
// Struct: AmazonpayErrorResponse
// File: crates/hyperswitch_connectors/src/connectors/amazonpay/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct AmazonpayErrorResponse
|
crates/hyperswitch_connectors/src/connectors/amazonpay/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
AmazonpayErrorResponse
| 0
|
[] | 48
| null | null | null | null | null | null | null |
// Implementation: impl api::Refund for for Affirm
// File: crates/hyperswitch_connectors/src/connectors/affirm.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::Refund for for Affirm
|
crates/hyperswitch_connectors/src/connectors/affirm.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 58
| null |
Affirm
|
api::Refund for
| 0
| 0
| null | null |
// Function: get_gsm_record
// File: crates/router/src/core/payouts/helpers.rs
// Module: router
pub fn get_gsm_record(
state: &SessionState,
error_code: Option<String>,
error_message: Option<String>,
connector_name: Option<String>,
flow: &str,
) -> Option<hyperswitch_domain_models::gsm::GatewayStatusMap>
|
crates/router/src/core/payouts/helpers.rs
|
router
|
function_signature
| null | null | null | 84
|
get_gsm_record
| null | null | null | null | null | null |
// Struct: CardInfoUpdate
// File: crates/router/src/core/cards_info.rs
// Module: router
// Implementations: 1
// Traits: State
pub struct CardInfoUpdate
|
crates/router/src/core/cards_info.rs
|
router
|
struct_definition
|
CardInfoUpdate
| 1
|
[
"State"
] | 40
| null | null | null | null | null | null | null |
// File: crates/hyperswitch_connectors/src/connectors/rapyd.rs
// Module: hyperswitch_connectors
// Public functions: 2
// Public structs: 1
pub mod transformers;
use std::sync::LazyLock;
use api_models::webhooks::IncomingWebhookEvent;
use base64::Engine;
use common_enums::enums;
use common_utils::{
consts::BASE64_ENGINE_URL_SAFE,
crypto, date_time,
errors::CustomResult,
ext_traits::{ByteSliceExt, BytesExt, Encode, StringExt},
request::{Method, Request, RequestBuilder, RequestContent},
types::{
AmountConvertor, FloatMajorUnit, FloatMajorUnitForConnector, StringMinorUnit,
StringMinorUnitForConnector,
},
};
use error_stack::{Report, 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, PaymentsCancelRouterData, PaymentsCaptureRouterData,
PaymentsSyncRouterData, RefundSyncRouterData, RefundsRouterData,
},
};
use hyperswitch_interfaces::{
api::{
self, ConnectorCommon, ConnectorIntegration, ConnectorSpecifications, ConnectorValidation,
},
configs::Connectors,
disputes::DisputePayload,
errors,
events::connector_api_logs::ConnectorEvent,
types::{self, Response},
webhooks::{IncomingWebhook, IncomingWebhookRequestDetails},
};
use masking::{ExposeInterface, Mask, PeekInterface, Secret};
use rand::distributions::{Alphanumeric, DistString};
use ring::hmac;
use router_env::logger;
use transformers as rapyd;
use crate::{
constants::headers,
types::ResponseRouterData,
utils::{self, convert_amount, get_header_key_value},
};
#[derive(Clone)]
pub struct Rapyd {
amount_converter: &'static (dyn AmountConvertor<Output = FloatMajorUnit> + Sync),
amount_converter_webhooks: &'static (dyn AmountConvertor<Output = StringMinorUnit> + Sync),
}
impl Rapyd {
pub fn new() -> &'static Self {
&Self {
amount_converter: &FloatMajorUnitForConnector,
amount_converter_webhooks: &StringMinorUnitForConnector,
}
}
}
impl Rapyd {
pub fn generate_signature(
&self,
auth: &rapyd::RapydAuthType,
http_method: &str,
url_path: &str,
body: &str,
timestamp: i64,
salt: &str,
) -> CustomResult<String, errors::ConnectorError> {
let rapyd::RapydAuthType {
access_key,
secret_key,
} = auth;
let to_sign = format!(
"{http_method}{url_path}{salt}{timestamp}{}{}{body}",
access_key.peek(),
secret_key.peek()
);
let key = hmac::Key::new(hmac::HMAC_SHA256, secret_key.peek().as_bytes());
let tag = hmac::sign(&key, to_sign.as_bytes());
let hmac_sign = hex::encode(tag);
let signature_value = BASE64_ENGINE_URL_SAFE.encode(hmac_sign);
Ok(signature_value)
}
}
impl ConnectorCommon for Rapyd {
fn id(&self) -> &'static str {
"rapyd"
}
fn get_currency_unit(&self) -> api::CurrencyUnit {
api::CurrencyUnit::Base
}
fn common_get_content_type(&self) -> &'static str {
"application/json"
}
fn base_url<'a>(&self, connectors: &'a Connectors) -> &'a str {
connectors.rapyd.base_url.as_ref()
}
fn get_auth_header(
&self,
_auth_type: &ConnectorAuthType,
) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
Ok(vec![])
}
fn build_error_response(
&self,
res: Response,
event_builder: Option<&mut ConnectorEvent>,
) -> CustomResult<ErrorResponse, errors::ConnectorError> {
let response: Result<
rapyd::RapydPaymentsResponse,
Report<common_utils::errors::ParsingError>,
> = res.response.parse_struct("Rapyd ErrorResponse");
match response {
Ok(response_data) => {
event_builder.map(|i| i.set_error_response_body(&response_data));
router_env::logger::info!(connector_response=?response_data);
Ok(ErrorResponse {
status_code: res.status_code,
code: response_data.status.error_code,
message: response_data.status.status.unwrap_or_default(),
reason: response_data.status.message,
attempt_status: None,
connector_transaction_id: None,
network_advice_code: None,
network_decline_code: None,
network_error_message: None,
connector_metadata: None,
})
}
Err(error_msg) => {
event_builder.map(|event| event.set_error(serde_json::json!({"error": res.response.escape_ascii().to_string(), "status_code": res.status_code})));
logger::error!(deserialization_error =? error_msg);
utils::handle_json_response_deserialization_failure(res, "rapyd")
}
}
}
}
impl ConnectorValidation for Rapyd {}
impl api::ConnectorAccessToken for Rapyd {}
impl api::PaymentToken for Rapyd {}
impl ConnectorIntegration<PaymentMethodToken, PaymentMethodTokenizationData, PaymentsResponseData>
for Rapyd
{
// Not Implemented (R)
}
impl ConnectorIntegration<AccessTokenAuth, AccessTokenRequestData, AccessToken> for Rapyd {}
impl api::PaymentAuthorize for Rapyd {}
impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData> for Rapyd {
fn get_headers(
&self,
_req: &PaymentsAuthorizeRouterData,
_connectors: &Connectors,
) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
Ok(vec![(
headers::CONTENT_TYPE.to_string(),
types::PaymentsAuthorizeType::get_content_type(self)
.to_string()
.into(),
)])
}
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!("{}/v1/payments", self.base_url(connectors)))
}
fn get_request_body(
&self,
req: &PaymentsAuthorizeRouterData,
_connectors: &Connectors,
) -> CustomResult<RequestContent, errors::ConnectorError> {
let amount = convert_amount(
self.amount_converter,
req.request.minor_amount,
req.request.currency,
)?;
let connector_router_data = rapyd::RapydRouterData::from((amount, req));
let connector_req = rapyd::RapydPaymentsRequest::try_from(&connector_router_data)?;
Ok(RequestContent::Json(Box::new(connector_req)))
}
fn build_request(
&self,
req: &RouterData<Authorize, PaymentsAuthorizeData, PaymentsResponseData>,
connectors: &Connectors,
) -> CustomResult<Option<Request>, errors::ConnectorError> {
let timestamp = date_time::now_unix_timestamp();
let salt = Alphanumeric.sample_string(&mut rand::thread_rng(), 12);
let auth: rapyd::RapydAuthType = rapyd::RapydAuthType::try_from(&req.connector_auth_type)?;
let body = types::PaymentsAuthorizeType::get_request_body(self, req, connectors)?;
let req_body = body.get_inner_value().expose();
let signature =
self.generate_signature(&auth, "post", "/v1/payments", &req_body, timestamp, &salt)?;
let headers = vec![
("access_key".to_string(), auth.access_key.into_masked()),
("salt".to_string(), salt.into_masked()),
("timestamp".to_string(), timestamp.to_string().into()),
("signature".to_string(), signature.into_masked()),
];
let request = RequestBuilder::new()
.method(Method::Post)
.url(&types::PaymentsAuthorizeType::get_url(
self, req, connectors,
)?)
.attach_default_headers()
.headers(types::PaymentsAuthorizeType::get_headers(
self, req, connectors,
)?)
.headers(headers)
.set_body(types::PaymentsAuthorizeType::get_request_body(
self, req, connectors,
)?)
.build();
Ok(Some(request))
}
fn handle_response(
&self,
data: &PaymentsAuthorizeRouterData,
event_builder: Option<&mut ConnectorEvent>,
res: Response,
) -> CustomResult<PaymentsAuthorizeRouterData, errors::ConnectorError> {
let response: rapyd::RapydPaymentsResponse = res
.response
.parse_struct("Rapyd PaymentResponse")
.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,
})
.change_context(errors::ConnectorError::ResponseHandlingFailed)
}
fn get_error_response(
&self,
res: Response,
event_builder: Option<&mut ConnectorEvent>,
) -> CustomResult<ErrorResponse, errors::ConnectorError> {
self.build_error_response(res, event_builder)
}
}
impl api::Payment for Rapyd {}
impl api::MandateSetup for Rapyd {}
impl ConnectorIntegration<SetupMandate, SetupMandateRequestData, PaymentsResponseData> for Rapyd {
fn build_request(
&self,
_req: &RouterData<SetupMandate, SetupMandateRequestData, PaymentsResponseData>,
_connectors: &Connectors,
) -> CustomResult<Option<Request>, errors::ConnectorError> {
Err(
errors::ConnectorError::NotImplemented("Setup Mandate flow for Rapyd".to_string())
.into(),
)
}
}
impl api::PaymentVoid for Rapyd {}
impl ConnectorIntegration<Void, PaymentsCancelData, PaymentsResponseData> for Rapyd {
fn get_headers(
&self,
_req: &PaymentsCancelRouterData,
_connectors: &Connectors,
) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
Ok(vec![(
headers::CONTENT_TYPE.to_string(),
types::PaymentsVoidType::get_content_type(self)
.to_string()
.into(),
)])
}
fn get_content_type(&self) -> &'static str {
self.common_get_content_type()
}
fn get_url(
&self,
req: &PaymentsCancelRouterData,
connectors: &Connectors,
) -> CustomResult<String, errors::ConnectorError> {
Ok(format!(
"{}/v1/payments/{}",
self.base_url(connectors),
req.request.connector_transaction_id
))
}
fn build_request(
&self,
req: &PaymentsCancelRouterData,
connectors: &Connectors,
) -> CustomResult<Option<Request>, errors::ConnectorError> {
let timestamp = date_time::now_unix_timestamp();
let salt = Alphanumeric.sample_string(&mut rand::thread_rng(), 12);
let auth: rapyd::RapydAuthType = rapyd::RapydAuthType::try_from(&req.connector_auth_type)?;
let url_path = format!("/v1/payments/{}", req.request.connector_transaction_id);
let signature =
self.generate_signature(&auth, "delete", &url_path, "", timestamp, &salt)?;
let headers = vec![
("access_key".to_string(), auth.access_key.into_masked()),
("salt".to_string(), salt.into_masked()),
("timestamp".to_string(), timestamp.to_string().into()),
("signature".to_string(), signature.into_masked()),
];
let request = RequestBuilder::new()
.method(Method::Delete)
.url(&types::PaymentsVoidType::get_url(self, req, connectors)?)
.attach_default_headers()
.headers(types::PaymentsVoidType::get_headers(self, req, connectors)?)
.headers(headers)
.build();
Ok(Some(request))
}
fn handle_response(
&self,
data: &PaymentsCancelRouterData,
event_builder: Option<&mut ConnectorEvent>,
res: Response,
) -> CustomResult<PaymentsCancelRouterData, errors::ConnectorError> {
let response: rapyd::RapydPaymentsResponse = res
.response
.parse_struct("Rapyd PaymentResponse")
.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,
})
.change_context(errors::ConnectorError::ResponseHandlingFailed)
}
fn get_error_response(
&self,
res: Response,
event_builder: Option<&mut ConnectorEvent>,
) -> CustomResult<ErrorResponse, errors::ConnectorError> {
self.build_error_response(res, event_builder)
}
}
impl api::PaymentSync for Rapyd {}
impl ConnectorIntegration<PSync, PaymentsSyncData, PaymentsResponseData> for Rapyd {
fn get_headers(
&self,
_req: &PaymentsSyncRouterData,
_connectors: &Connectors,
) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
Ok(vec![(
headers::CONTENT_TYPE.to_string(),
types::PaymentsSyncType::get_content_type(self)
.to_string()
.into(),
)])
}
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 id = req.request.connector_transaction_id.clone();
Ok(format!(
"{}/v1/payments/{}",
self.base_url(connectors),
id.get_connector_transaction_id()
.change_context(errors::ConnectorError::MissingConnectorTransactionID)?
))
}
fn build_request(
&self,
req: &PaymentsSyncRouterData,
connectors: &Connectors,
) -> CustomResult<Option<Request>, errors::ConnectorError> {
let timestamp = date_time::now_unix_timestamp();
let salt = Alphanumeric.sample_string(&mut rand::thread_rng(), 12);
let auth: rapyd::RapydAuthType = rapyd::RapydAuthType::try_from(&req.connector_auth_type)?;
let response_id = req.request.connector_transaction_id.clone();
let url_path = format!(
"/v1/payments/{}",
response_id
.get_connector_transaction_id()
.change_context(errors::ConnectorError::MissingConnectorTransactionID)?
);
let signature = self.generate_signature(&auth, "get", &url_path, "", timestamp, &salt)?;
let headers = vec![
("access_key".to_string(), auth.access_key.into_masked()),
("salt".to_string(), salt.into_masked()),
("timestamp".to_string(), timestamp.to_string().into()),
("signature".to_string(), signature.into_masked()),
];
let request = RequestBuilder::new()
.method(Method::Get)
.url(&types::PaymentsSyncType::get_url(self, req, connectors)?)
.attach_default_headers()
.headers(types::PaymentsSyncType::get_headers(self, req, connectors)?)
.headers(headers)
.build();
Ok(Some(request))
}
fn get_error_response(
&self,
res: Response,
event_builder: Option<&mut ConnectorEvent>,
) -> CustomResult<ErrorResponse, errors::ConnectorError> {
self.build_error_response(res, event_builder)
}
fn handle_response(
&self,
data: &PaymentsSyncRouterData,
event_builder: Option<&mut ConnectorEvent>,
res: Response,
) -> CustomResult<PaymentsSyncRouterData, errors::ConnectorError> {
let response: rapyd::RapydPaymentsResponse = res
.response
.parse_struct("Rapyd PaymentResponse")
.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,
})
.change_context(errors::ConnectorError::ResponseHandlingFailed)
}
}
impl api::PaymentCapture for Rapyd {}
impl ConnectorIntegration<Capture, PaymentsCaptureData, PaymentsResponseData> for Rapyd {
fn get_headers(
&self,
_req: &PaymentsCaptureRouterData,
_connectors: &Connectors,
) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
Ok(vec![(
headers::CONTENT_TYPE.to_string(),
types::PaymentsCaptureType::get_content_type(self)
.to_string()
.into(),
)])
}
fn get_content_type(&self) -> &'static str {
self.common_get_content_type()
}
fn get_request_body(
&self,
req: &PaymentsCaptureRouterData,
_connectors: &Connectors,
) -> CustomResult<RequestContent, errors::ConnectorError> {
let amount = convert_amount(
self.amount_converter,
req.request.minor_amount_to_capture,
req.request.currency,
)?;
let connector_router_data = rapyd::RapydRouterData::from((amount, req));
let connector_req = rapyd::CaptureRequest::try_from(&connector_router_data)?;
Ok(RequestContent::Json(Box::new(connector_req)))
}
fn build_request(
&self,
req: &PaymentsCaptureRouterData,
connectors: &Connectors,
) -> CustomResult<Option<Request>, errors::ConnectorError> {
let timestamp = date_time::now_unix_timestamp();
let salt = Alphanumeric.sample_string(&mut rand::thread_rng(), 12);
let auth: rapyd::RapydAuthType = rapyd::RapydAuthType::try_from(&req.connector_auth_type)?;
let url_path = format!(
"/v1/payments/{}/capture",
req.request.connector_transaction_id
);
let body = types::PaymentsCaptureType::get_request_body(self, req, connectors)?;
let req_body = body.get_inner_value().expose();
let signature =
self.generate_signature(&auth, "post", &url_path, &req_body, timestamp, &salt)?;
let headers = vec![
("access_key".to_string(), auth.access_key.into_masked()),
("salt".to_string(), salt.into_masked()),
("timestamp".to_string(), timestamp.to_string().into()),
("signature".to_string(), signature.into_masked()),
];
let request = RequestBuilder::new()
.method(Method::Post)
.url(&types::PaymentsCaptureType::get_url(self, req, connectors)?)
.attach_default_headers()
.headers(types::PaymentsCaptureType::get_headers(
self, req, connectors,
)?)
.headers(headers)
.set_body(types::PaymentsCaptureType::get_request_body(
self, req, connectors,
)?)
.build();
Ok(Some(request))
}
fn handle_response(
&self,
data: &PaymentsCaptureRouterData,
event_builder: Option<&mut ConnectorEvent>,
res: Response,
) -> CustomResult<PaymentsCaptureRouterData, errors::ConnectorError> {
let response: rapyd::RapydPaymentsResponse = res
.response
.parse_struct("RapydPaymentResponse")
.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,
})
.change_context(errors::ConnectorError::ResponseHandlingFailed)
}
fn get_url(
&self,
req: &PaymentsCaptureRouterData,
connectors: &Connectors,
) -> CustomResult<String, errors::ConnectorError> {
Ok(format!(
"{}/v1/payments/{}/capture",
self.base_url(connectors),
req.request.connector_transaction_id
))
}
fn get_error_response(
&self,
res: Response,
event_builder: Option<&mut ConnectorEvent>,
) -> CustomResult<ErrorResponse, errors::ConnectorError> {
self.build_error_response(res, event_builder)
}
}
impl api::PaymentSession for Rapyd {}
impl ConnectorIntegration<Session, PaymentsSessionData, PaymentsResponseData> for Rapyd {
//TODO: implement sessions flow
}
impl api::Refund for Rapyd {}
impl api::RefundExecute for Rapyd {}
impl api::RefundSync for Rapyd {}
impl ConnectorIntegration<Execute, RefundsData, RefundsResponseData> for Rapyd {
fn get_headers(
&self,
_req: &RefundsRouterData<Execute>,
_connectors: &Connectors,
) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
Ok(vec![(
headers::CONTENT_TYPE.to_string(),
types::RefundExecuteType::get_content_type(self)
.to_string()
.into(),
)])
}
fn get_content_type(&self) -> &'static str {
ConnectorCommon::common_get_content_type(self)
}
fn get_url(
&self,
_req: &RefundsRouterData<Execute>,
connectors: &Connectors,
) -> CustomResult<String, errors::ConnectorError> {
Ok(format!("{}/v1/refunds", self.base_url(connectors)))
}
fn get_request_body(
&self,
req: &RefundsRouterData<Execute>,
_connectors: &Connectors,
) -> CustomResult<RequestContent, errors::ConnectorError> {
let amount = convert_amount(
self.amount_converter,
req.request.minor_refund_amount,
req.request.currency,
)?;
let connector_router_data = rapyd::RapydRouterData::from((amount, req));
let connector_req = rapyd::RapydRefundRequest::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 timestamp = date_time::now_unix_timestamp();
let salt = Alphanumeric.sample_string(&mut rand::thread_rng(), 12);
let body = types::RefundExecuteType::get_request_body(self, req, connectors)?;
let req_body = body.get_inner_value().expose();
let auth: rapyd::RapydAuthType = rapyd::RapydAuthType::try_from(&req.connector_auth_type)?;
let signature =
self.generate_signature(&auth, "post", "/v1/refunds", &req_body, timestamp, &salt)?;
let headers = vec![
("access_key".to_string(), auth.access_key.into_masked()),
("salt".to_string(), salt.into_masked()),
("timestamp".to_string(), timestamp.to_string().into()),
("signature".to_string(), signature.into_masked()),
];
let request = RequestBuilder::new()
.method(Method::Post)
.url(&types::RefundExecuteType::get_url(self, req, connectors)?)
.attach_default_headers()
.headers(headers)
.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: rapyd::RefundResponse = res
.response
.parse_struct("rapyd RefundResponse")
.change_context(errors::ConnectorError::RequestEncodingFailed)?;
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,
})
.change_context(errors::ConnectorError::ResponseHandlingFailed)
}
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 Rapyd {
// default implementation of build_request method will be executed
fn handle_response(
&self,
data: &RefundSyncRouterData,
event_builder: Option<&mut ConnectorEvent>,
res: Response,
) -> CustomResult<RefundSyncRouterData, errors::ConnectorError> {
let response: rapyd::RefundResponse = res
.response
.parse_struct("rapyd RefundResponse")
.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,
})
.change_context(errors::ConnectorError::ResponseHandlingFailed)
}
}
#[async_trait::async_trait]
impl IncomingWebhook for Rapyd {
fn get_webhook_source_verification_algorithm(
&self,
_request: &IncomingWebhookRequestDetails<'_>,
) -> CustomResult<Box<dyn crypto::VerifySignature + Send>, errors::ConnectorError> {
Ok(Box::new(crypto::HmacSha256))
}
fn get_webhook_source_verification_signature(
&self,
request: &IncomingWebhookRequestDetails<'_>,
_connector_webhook_secrets: &api_models::webhooks::ConnectorWebhookSecrets,
) -> CustomResult<Vec<u8>, errors::ConnectorError> {
let base64_signature = get_header_key_value("signature", request.headers)?;
let signature = BASE64_ENGINE_URL_SAFE
.decode(base64_signature.as_bytes())
.change_context(errors::ConnectorError::WebhookSourceVerificationFailed)?;
Ok(signature)
}
fn get_webhook_source_verification_message(
&self,
request: &IncomingWebhookRequestDetails<'_>,
merchant_id: &common_utils::id_type::MerchantId,
connector_webhook_secrets: &api_models::webhooks::ConnectorWebhookSecrets,
) -> CustomResult<Vec<u8>, errors::ConnectorError> {
let host = get_header_key_value("host", request.headers)?;
let connector = self.id();
let url_path = format!(
"https://{host}/webhooks/{}/{connector}",
merchant_id.get_string_repr()
);
let salt = get_header_key_value("salt", request.headers)?;
let timestamp = get_header_key_value("timestamp", request.headers)?;
let stringify_auth = String::from_utf8(connector_webhook_secrets.secret.to_vec())
.change_context(errors::ConnectorError::WebhookSourceVerificationFailed)
.attach_printable("Could not convert secret to UTF-8")?;
let auth: transformers::RapydAuthType = stringify_auth
.parse_struct("RapydAuthType")
.change_context(errors::ConnectorError::WebhookSourceVerificationFailed)?;
let access_key = auth.access_key;
let secret_key = auth.secret_key;
let body_string = String::from_utf8(request.body.to_vec())
.change_context(errors::ConnectorError::WebhookSourceVerificationFailed)
.attach_printable("Could not convert body to UTF-8")?;
let to_sign = format!(
"{url_path}{salt}{timestamp}{}{}{body_string}",
access_key.peek(),
secret_key.peek()
);
Ok(to_sign.into_bytes())
}
async fn verify_webhook_source(
&self,
request: &IncomingWebhookRequestDetails<'_>,
merchant_id: &common_utils::id_type::MerchantId,
connector_webhook_details: Option<common_utils::pii::SecretSerdeValue>,
_connector_account_details: crypto::Encryptable<Secret<serde_json::Value>>,
connector_label: &str,
) -> CustomResult<bool, errors::ConnectorError> {
let connector_webhook_secrets = self
.get_webhook_source_verification_merchant_secret(
merchant_id,
connector_label,
connector_webhook_details,
)
.await
.change_context(errors::ConnectorError::WebhookSourceVerificationFailed)?;
let signature = self
.get_webhook_source_verification_signature(request, &connector_webhook_secrets)
.change_context(errors::ConnectorError::WebhookSourceVerificationFailed)?;
let message = self
.get_webhook_source_verification_message(
request,
merchant_id,
&connector_webhook_secrets,
)
.change_context(errors::ConnectorError::WebhookSourceVerificationFailed)?;
let stringify_auth = String::from_utf8(connector_webhook_secrets.secret.to_vec())
.change_context(errors::ConnectorError::WebhookSourceVerificationFailed)
.attach_printable("Could not convert secret to UTF-8")?;
let auth: transformers::RapydAuthType = stringify_auth
.parse_struct("RapydAuthType")
.change_context(errors::ConnectorError::WebhookSourceVerificationFailed)?;
let secret_key = auth.secret_key;
let key = hmac::Key::new(hmac::HMAC_SHA256, secret_key.peek().as_bytes());
let tag = hmac::sign(&key, &message);
let hmac_sign = hex::encode(tag);
Ok(hmac_sign.as_bytes().eq(&signature))
}
fn get_webhook_object_reference_id(
&self,
request: &IncomingWebhookRequestDetails<'_>,
) -> CustomResult<api_models::webhooks::ObjectReferenceId, errors::ConnectorError> {
let webhook: transformers::RapydIncomingWebhook = request
.body
.parse_struct("RapydIncomingWebhook")
.change_context(errors::ConnectorError::WebhookEventTypeNotFound)?;
Ok(match webhook.data {
transformers::WebhookData::Payment(payment_data) => {
api_models::webhooks::ObjectReferenceId::PaymentId(
api_models::payments::PaymentIdType::ConnectorTransactionId(payment_data.id),
)
}
transformers::WebhookData::Refund(refund_data) => {
api_models::webhooks::ObjectReferenceId::RefundId(
api_models::webhooks::RefundIdType::ConnectorRefundId(refund_data.id),
)
}
transformers::WebhookData::Dispute(dispute_data) => {
api_models::webhooks::ObjectReferenceId::PaymentId(
api_models::payments::PaymentIdType::ConnectorTransactionId(
dispute_data.original_transaction_id,
),
)
}
})
}
fn get_webhook_event_type(
&self,
request: &IncomingWebhookRequestDetails<'_>,
) -> CustomResult<IncomingWebhookEvent, errors::ConnectorError> {
let webhook: transformers::RapydIncomingWebhook = request
.body
.parse_struct("RapydIncomingWebhook")
.change_context(errors::ConnectorError::WebhookEventTypeNotFound)?;
Ok(match webhook.webhook_type {
rapyd::RapydWebhookObjectEventType::PaymentCompleted
| rapyd::RapydWebhookObjectEventType::PaymentCaptured => {
IncomingWebhookEvent::PaymentIntentSuccess
}
rapyd::RapydWebhookObjectEventType::PaymentFailed => {
IncomingWebhookEvent::PaymentIntentFailure
}
rapyd::RapydWebhookObjectEventType::PaymentRefundFailed
| rapyd::RapydWebhookObjectEventType::PaymentRefundRejected => {
IncomingWebhookEvent::RefundFailure
}
rapyd::RapydWebhookObjectEventType::RefundCompleted => {
IncomingWebhookEvent::RefundSuccess
}
rapyd::RapydWebhookObjectEventType::PaymentDisputeCreated => {
IncomingWebhookEvent::DisputeOpened
}
rapyd::RapydWebhookObjectEventType::Unknown => IncomingWebhookEvent::EventNotSupported,
rapyd::RapydWebhookObjectEventType::PaymentDisputeUpdated => match webhook.data {
rapyd::WebhookData::Dispute(data) => IncomingWebhookEvent::from(data.status),
_ => IncomingWebhookEvent::EventNotSupported,
},
})
}
fn get_webhook_resource_object(
&self,
request: &IncomingWebhookRequestDetails<'_>,
) -> CustomResult<Box<dyn masking::ErasedMaskSerialize>, errors::ConnectorError> {
let webhook: transformers::RapydIncomingWebhook = request
.body
.parse_struct("RapydIncomingWebhook")
.change_context(errors::ConnectorError::WebhookEventTypeNotFound)?;
let res_json = match webhook.data {
transformers::WebhookData::Payment(payment_data) => {
let rapyd_response: transformers::RapydPaymentsResponse = payment_data.into();
rapyd_response
.encode_to_value()
.change_context(errors::ConnectorError::WebhookResourceObjectNotFound)?
}
transformers::WebhookData::Refund(refund_data) => refund_data
.encode_to_value()
.change_context(errors::ConnectorError::WebhookResourceObjectNotFound)?,
transformers::WebhookData::Dispute(dispute_data) => dispute_data
.encode_to_value()
.change_context(errors::ConnectorError::WebhookResourceObjectNotFound)?,
};
Ok(Box::new(res_json))
}
fn get_dispute_details(
&self,
request: &IncomingWebhookRequestDetails<'_>,
) -> CustomResult<DisputePayload, errors::ConnectorError> {
let webhook: transformers::RapydIncomingWebhook = request
.body
.parse_struct("RapydIncomingWebhook")
.change_context(errors::ConnectorError::WebhookEventTypeNotFound)?;
let webhook_dispute_data = match webhook.data {
transformers::WebhookData::Dispute(dispute_data) => Ok(dispute_data),
_ => Err(errors::ConnectorError::WebhookBodyDecodingFailed),
}?;
Ok(DisputePayload {
amount: convert_amount(
self.amount_converter_webhooks,
webhook_dispute_data.amount,
webhook_dispute_data.currency,
)?,
currency: webhook_dispute_data.currency,
dispute_stage: api_models::enums::DisputeStage::Dispute,
connector_dispute_id: webhook_dispute_data.token,
connector_reason: Some(webhook_dispute_data.dispute_reason_description),
connector_reason_code: None,
challenge_required_by: webhook_dispute_data.due_date,
connector_status: webhook_dispute_data.status.to_string(),
created_at: webhook_dispute_data.created_at,
updated_at: webhook_dispute_data.updated_at,
})
}
}
static RAPYD_SUPPORTED_PAYMENT_METHODS: LazyLock<SupportedPaymentMethods> = LazyLock::new(|| {
let supported_capture_methods = vec![
enums::CaptureMethod::Automatic,
enums::CaptureMethod::Manual,
enums::CaptureMethod::SequentialAutomatic,
];
let supported_card_network = vec![
common_enums::CardNetwork::AmericanExpress,
common_enums::CardNetwork::Visa,
common_enums::CardNetwork::JCB,
common_enums::CardNetwork::DinersClub,
common_enums::CardNetwork::UnionPay,
common_enums::CardNetwork::Mastercard,
common_enums::CardNetwork::Discover,
];
let mut rapyd_supported_payment_methods = SupportedPaymentMethods::new();
rapyd_supported_payment_methods.add(
|
crates/hyperswitch_connectors/src/connectors/rapyd.rs#chunk0
|
hyperswitch_connectors
|
chunk
| null | null | null | 8,192
| null | null | null | null | null | null | null |
Err(errors::ConnectorError::NotSupported {
message: format!("{} for {}", $capture_method, $payment_method_type),
connector: $connector,
}
.into())
};
}
#[macro_export]
macro_rules! get_formatted_date_time {
($date_format:tt) => {{
let format = time::macros::format_description!($date_format);
time::OffsetDateTime::now_utc()
.format(&format)
.change_context(ConnectorError::InvalidDateFormat)
}};
}
#[macro_export]
macro_rules! unimplemented_payment_method {
($payment_method:expr, $connector:expr) => {
hyperswitch_interfaces::errors::ConnectorError::NotImplemented(format!(
"{} through {}",
$payment_method, $connector
))
};
($payment_method:expr, $flow:expr, $connector:expr) => {
hyperswitch_interfaces::errors::ConnectorError::NotImplemented(format!(
"{} {} through {}",
$payment_method, $flow, $connector
))
};
}
impl ForeignTryFrom<String> for UsStatesAbbreviation {
type Error = error_stack::Report<errors::ConnectorError>;
fn foreign_try_from(value: String) -> Result<Self, Self::Error> {
let state_abbreviation_check =
StringExt::<Self>::parse_enum(value.to_uppercase().clone(), "UsStatesAbbreviation");
match state_abbreviation_check {
Ok(state_abbreviation) => Ok(state_abbreviation),
Err(_) => {
let binding = value.as_str().to_lowercase();
let state = binding.as_str();
match state {
"alabama" => Ok(Self::AL),
"alaska" => Ok(Self::AK),
"american samoa" => Ok(Self::AS),
"arizona" => Ok(Self::AZ),
"arkansas" => Ok(Self::AR),
"california" => Ok(Self::CA),
"colorado" => Ok(Self::CO),
"connecticut" => Ok(Self::CT),
"delaware" => Ok(Self::DE),
"district of columbia" | "columbia" => Ok(Self::DC),
"federated states of micronesia" | "micronesia" => Ok(Self::FM),
"florida" => Ok(Self::FL),
"georgia" => Ok(Self::GA),
"guam" => Ok(Self::GU),
"hawaii" => Ok(Self::HI),
"idaho" => Ok(Self::ID),
"illinois" => Ok(Self::IL),
"indiana" => Ok(Self::IN),
"iowa" => Ok(Self::IA),
"kansas" => Ok(Self::KS),
"kentucky" => Ok(Self::KY),
"louisiana" => Ok(Self::LA),
"maine" => Ok(Self::ME),
"marshall islands" => Ok(Self::MH),
"maryland" => Ok(Self::MD),
"massachusetts" => Ok(Self::MA),
"michigan" => Ok(Self::MI),
"minnesota" => Ok(Self::MN),
"mississippi" => Ok(Self::MS),
"missouri" => Ok(Self::MO),
"montana" => Ok(Self::MT),
"nebraska" => Ok(Self::NE),
"nevada" => Ok(Self::NV),
"new hampshire" => Ok(Self::NH),
"new jersey" => Ok(Self::NJ),
"new mexico" => Ok(Self::NM),
"new york" => Ok(Self::NY),
"north carolina" => Ok(Self::NC),
"north dakota" => Ok(Self::ND),
"northern mariana islands" => Ok(Self::MP),
"ohio" => Ok(Self::OH),
"oklahoma" => Ok(Self::OK),
"oregon" => Ok(Self::OR),
"palau" => Ok(Self::PW),
"pennsylvania" => Ok(Self::PA),
"puerto rico" => Ok(Self::PR),
"rhode island" => Ok(Self::RI),
"south carolina" => Ok(Self::SC),
"south dakota" => Ok(Self::SD),
"tennessee" => Ok(Self::TN),
"texas" => Ok(Self::TX),
"utah" => Ok(Self::UT),
"vermont" => Ok(Self::VT),
"virgin islands" => Ok(Self::VI),
"virginia" => Ok(Self::VA),
"washington" => Ok(Self::WA),
"west virginia" => Ok(Self::WV),
"wisconsin" => Ok(Self::WI),
"wyoming" => Ok(Self::WY),
_ => Err(errors::ConnectorError::InvalidDataFormat {
field_name: "address.state",
}
.into()),
}
}
}
}
}
impl ForeignTryFrom<String> for CanadaStatesAbbreviation {
type Error = error_stack::Report<errors::ConnectorError>;
fn foreign_try_from(value: String) -> Result<Self, Self::Error> {
let state_abbreviation_check =
StringExt::<Self>::parse_enum(value.to_uppercase().clone(), "CanadaStatesAbbreviation");
match state_abbreviation_check {
Ok(state_abbreviation) => Ok(state_abbreviation),
Err(_) => {
let binding = value.as_str().to_lowercase();
let state = binding.as_str();
match state {
"alberta" => Ok(Self::AB),
"british columbia" => Ok(Self::BC),
"manitoba" => Ok(Self::MB),
"new brunswick" => Ok(Self::NB),
"newfoundland and labrador" | "newfoundland & labrador" => Ok(Self::NL),
"northwest territories" => Ok(Self::NT),
"nova scotia" => Ok(Self::NS),
"nunavut" => Ok(Self::NU),
"ontario" => Ok(Self::ON),
"prince edward island" => Ok(Self::PE),
"quebec" => Ok(Self::QC),
"saskatchewan" => Ok(Self::SK),
"yukon" => Ok(Self::YT),
_ => Err(errors::ConnectorError::InvalidDataFormat {
field_name: "address.state",
}
.into()),
}
}
}
}
}
impl ForeignTryFrom<String> for AustraliaStatesAbbreviation {
type Error = error_stack::Report<errors::ConnectorError>;
fn foreign_try_from(value: String) -> Result<Self, Self::Error> {
let state =
parse_state_enum::<Self>(value, "AustraliaStatesAbbreviation", "address.state")?;
match state.as_str() {
"newsouthwales" => Ok(Self::NSW),
"queensland" => Ok(Self::QLD),
"southaustralia" => Ok(Self::SA),
"westernaustralia" => Ok(Self::WA),
"victoria" => Ok(Self::VIC),
"northernterritory" => Ok(Self::NT),
"australiancapitalterritory" => Ok(Self::ACT),
"tasmania" => Ok(Self::TAS),
_ => Err(errors::ConnectorError::InvalidDataFormat {
field_name: "address.state",
}
.into()),
}
}
}
impl ForeignTryFrom<String> for PolandStatesAbbreviation {
type Error = error_stack::Report<errors::ConnectorError>;
fn foreign_try_from(value: String) -> Result<Self, Self::Error> {
let state_abbreviation_check =
StringExt::<Self>::parse_enum(value.clone(), "PolandStatesAbbreviation");
match state_abbreviation_check {
Ok(state_abbreviation) => Ok(state_abbreviation),
Err(_) => match value.as_str() {
"Greater Poland" => Ok(Self::GreaterPoland),
"Holy Cross" => Ok(Self::HolyCross),
"Kuyavia-Pomerania" => Ok(Self::KuyaviaPomerania),
"Lesser Poland" => Ok(Self::LesserPoland),
"Lower Silesia" => Ok(Self::LowerSilesia),
"Lublin" => Ok(Self::Lublin),
"Lubusz" => Ok(Self::Lubusz),
"Łódź" => Ok(Self::Łódź),
"Mazovia" => Ok(Self::Mazovia),
"Podlaskie" => Ok(Self::Podlaskie),
"Pomerania" => Ok(Self::Pomerania),
"Silesia" => Ok(Self::Silesia),
"Subcarpathia" => Ok(Self::Subcarpathia),
"Upper Silesia" => Ok(Self::UpperSilesia),
"Warmia-Masuria" => Ok(Self::WarmiaMasuria),
"West Pomerania" => Ok(Self::WestPomerania),
_ => Err(errors::ConnectorError::InvalidDataFormat {
field_name: "address.state",
}
.into()),
},
}
}
}
impl ForeignTryFrom<String> for FranceStatesAbbreviation {
type Error = error_stack::Report<errors::ConnectorError>;
fn foreign_try_from(value: String) -> Result<Self, Self::Error> {
let state_abbreviation_check =
StringExt::<Self>::parse_enum(value.clone(), "FranceStatesAbbreviation");
match state_abbreviation_check {
Ok(state_abbreviation) => Ok(state_abbreviation),
Err(_) => match value.as_str() {
"Ain" => Ok(Self::Ain),
"Aisne" => Ok(Self::Aisne),
"Allier" => Ok(Self::Allier),
"Alpes-de-Haute-Provence" => Ok(Self::AlpesDeHauteProvence),
"Alpes-Maritimes" => Ok(Self::AlpesMaritimes),
"Alsace" => Ok(Self::Alsace),
"Ardèche" => Ok(Self::Ardeche),
"Ardennes" => Ok(Self::Ardennes),
"Ariège" => Ok(Self::Ariege),
"Aube" => Ok(Self::Aube),
"Aude" => Ok(Self::Aude),
"Auvergne-Rhône-Alpes" => Ok(Self::AuvergneRhoneAlpes),
"Aveyron" => Ok(Self::Aveyron),
"Bas-Rhin" => Ok(Self::BasRhin),
"Bouches-du-Rhône" => Ok(Self::BouchesDuRhone),
"Bourgogne-Franche-Comté" => Ok(Self::BourgogneFrancheComte),
"Bretagne" => Ok(Self::Bretagne),
"Calvados" => Ok(Self::Calvados),
"Cantal" => Ok(Self::Cantal),
"Centre-Val de Loire" => Ok(Self::CentreValDeLoire),
"Charente" => Ok(Self::Charente),
"Charente-Maritime" => Ok(Self::CharenteMaritime),
"Cher" => Ok(Self::Cher),
"Clipperton" => Ok(Self::Clipperton),
"Corrèze" => Ok(Self::Correze),
"Corse" => Ok(Self::Corse),
"Corse-du-Sud" => Ok(Self::CorseDuSud),
"Côte-d'Or" => Ok(Self::CoteDor),
"Côtes-d'Armor" => Ok(Self::CotesDarmor),
"Creuse" => Ok(Self::Creuse),
"Deux-Sèvres" => Ok(Self::DeuxSevres),
"Dordogne" => Ok(Self::Dordogne),
"Doubs" => Ok(Self::Doubs),
"Drôme" => Ok(Self::Drome),
"Essonne" => Ok(Self::Essonne),
"Eure" => Ok(Self::Eure),
"Eure-et-Loir" => Ok(Self::EureEtLoir),
"Finistère" => Ok(Self::Finistere),
"French Guiana" => Ok(Self::FrenchGuiana),
"French Polynesia" => Ok(Self::FrenchPolynesia),
"French Southern and Antarctic Lands" => Ok(Self::FrenchSouthernAndAntarcticLands),
"Gard" => Ok(Self::Gard),
"Gers" => Ok(Self::Gers),
"Gironde" => Ok(Self::Gironde),
"Grand-Est" => Ok(Self::GrandEst),
"Guadeloupe" => Ok(Self::Guadeloupe),
"Haut-Rhin" => Ok(Self::HautRhin),
"Haute-Corse" => Ok(Self::HauteCorse),
"Haute-Garonne" => Ok(Self::HauteGaronne),
"Haute-Loire" => Ok(Self::HauteLoire),
"Haute-Marne" => Ok(Self::HauteMarne),
"Haute-Saône" => Ok(Self::HauteSaone),
"Haute-Savoie" => Ok(Self::HauteSavoie),
"Haute-Vienne" => Ok(Self::HauteVienne),
"Hautes-Alpes" => Ok(Self::HautesAlpes),
"Hautes-Pyrénées" => Ok(Self::HautesPyrenees),
"Hauts-de-France" => Ok(Self::HautsDeFrance),
"Hauts-de-Seine" => Ok(Self::HautsDeSeine),
"Hérault" => Ok(Self::Herault),
"Île-de-France" => Ok(Self::IleDeFrance),
"Ille-et-Vilaine" => Ok(Self::IlleEtVilaine),
"Indre" => Ok(Self::Indre),
"Indre-et-Loire" => Ok(Self::IndreEtLoire),
"Isère" => Ok(Self::Isere),
"Jura" => Ok(Self::Jura),
"La Réunion" => Ok(Self::LaReunion),
"Landes" => Ok(Self::Landes),
"Loir-et-Cher" => Ok(Self::LoirEtCher),
"Loire" => Ok(Self::Loire),
"Loire-Atlantique" => Ok(Self::LoireAtlantique),
"Loiret" => Ok(Self::Loiret),
"Lot" => Ok(Self::Lot),
"Lot-et-Garonne" => Ok(Self::LotEtGaronne),
"Lozère" => Ok(Self::Lozere),
"Maine-et-Loire" => Ok(Self::MaineEtLoire),
"Manche" => Ok(Self::Manche),
"Marne" => Ok(Self::Marne),
"Martinique" => Ok(Self::Martinique),
"Mayenne" => Ok(Self::Mayenne),
"Mayotte" => Ok(Self::Mayotte),
"Métropole de Lyon" => Ok(Self::MetropoleDeLyon),
"Meurthe-et-Moselle" => Ok(Self::MeurtheEtMoselle),
"Meuse" => Ok(Self::Meuse),
"Morbihan" => Ok(Self::Morbihan),
"Moselle" => Ok(Self::Moselle),
"Nièvre" => Ok(Self::Nievre),
"Nord" => Ok(Self::Nord),
"Normandie" => Ok(Self::Normandie),
"Nouvelle-Aquitaine" => Ok(Self::NouvelleAquitaine),
"Occitanie" => Ok(Self::Occitanie),
"Oise" => Ok(Self::Oise),
"Orne" => Ok(Self::Orne),
"Paris" => Ok(Self::Paris),
"Pas-de-Calais" => Ok(Self::PasDeCalais),
"Pays-de-la-Loire" => Ok(Self::PaysDeLaLoire),
"Provence-Alpes-Côte-d'Azur" => Ok(Self::ProvenceAlpesCoteDazur),
"Puy-de-Dôme" => Ok(Self::PuyDeDome),
"Pyrénées-Atlantiques" => Ok(Self::PyreneesAtlantiques),
"Pyrénées-Orientales" => Ok(Self::PyreneesOrientales),
"Rhône" => Ok(Self::Rhone),
"Saint Pierre and Miquelon" => Ok(Self::SaintPierreAndMiquelon),
"Saint-Barthélemy" => Ok(Self::SaintBarthelemy),
"Saint-Martin" => Ok(Self::SaintMartin),
"Saône-et-Loire" => Ok(Self::SaoneEtLoire),
"Sarthe" => Ok(Self::Sarthe),
"Savoie" => Ok(Self::Savoie),
"Seine-et-Marne" => Ok(Self::SeineEtMarne),
"Seine-Maritime" => Ok(Self::SeineMaritime),
"Seine-Saint-Denis" => Ok(Self::SeineSaintDenis),
"Somme" => Ok(Self::Somme),
"Tarn" => Ok(Self::Tarn),
"Tarn-et-Garonne" => Ok(Self::TarnEtGaronne),
"Territoire de Belfort" => Ok(Self::TerritoireDeBelfort),
"Val-d'Oise" => Ok(Self::ValDoise),
"Val-de-Marne" => Ok(Self::ValDeMarne),
"Var" => Ok(Self::Var),
"Vaucluse" => Ok(Self::Vaucluse),
"Vendée" => Ok(Self::Vendee),
"Vienne" => Ok(Self::Vienne),
"Vosges" => Ok(Self::Vosges),
"Wallis and Futuna" => Ok(Self::WallisAndFutuna),
"Yonne" => Ok(Self::Yonne),
"Yvelines" => Ok(Self::Yvelines),
_ => Err(errors::ConnectorError::InvalidDataFormat {
field_name: "address.state",
}
.into()),
},
}
}
}
impl ForeignTryFrom<String> for GermanyStatesAbbreviation {
type Error = error_stack::Report<errors::ConnectorError>;
fn foreign_try_from(value: String) -> Result<Self, Self::Error> {
let state_abbreviation_check =
StringExt::<Self>::parse_enum(value.clone(), "GermanyStatesAbbreviation");
match state_abbreviation_check {
Ok(state_abbreviation) => Ok(state_abbreviation),
Err(_) => match value.as_str() {
"Baden-Württemberg" => Ok(Self::BW),
"Bavaria" => Ok(Self::BY),
"Berlin" => Ok(Self::BE),
"Brandenburg" => Ok(Self::BB),
"Bremen" => Ok(Self::HB),
"Hamburg" => Ok(Self::HH),
"Hessen" => Ok(Self::HE),
"Lower Saxony" => Ok(Self::NI),
"Mecklenburg-Vorpommern" => Ok(Self::MV),
"North Rhine-Westphalia" => Ok(Self::NW),
"Rhineland-Palatinate" => Ok(Self::RP),
"Saarland" => Ok(Self::SL),
"Saxony" => Ok(Self::SN),
"Saxony-Anhalt" => Ok(Self::ST),
"Schleswig-Holstein" => Ok(Self::SH),
"Thuringia" => Ok(Self::TH),
_ => Err(errors::ConnectorError::InvalidDataFormat {
field_name: "address.state",
}
.into()),
},
}
}
}
impl ForeignTryFrom<String> for SpainStatesAbbreviation {
type Error = error_stack::Report<errors::ConnectorError>;
fn foreign_try_from(value: String) -> Result<Self, Self::Error> {
let state_abbreviation_check =
StringExt::<Self>::parse_enum(value.clone(), "SpainStatesAbbreviation");
match state_abbreviation_check {
Ok(state_abbreviation) => Ok(state_abbreviation),
Err(_) => match value.as_str() {
"A Coruña Province" => Ok(Self::ACorunaProvince),
"Albacete Province" => Ok(Self::AlbaceteProvince),
"Alicante Province" => Ok(Self::AlicanteProvince),
"Almería Province" => Ok(Self::AlmeriaProvince),
"Andalusia" => Ok(Self::Andalusia),
"Araba / Álava" => Ok(Self::ArabaAlava),
"Aragon" => Ok(Self::Aragon),
"Badajoz Province" => Ok(Self::BadajozProvince),
"Balearic Islands" => Ok(Self::BalearicIslands),
"Barcelona Province" => Ok(Self::BarcelonaProvince),
"Basque Country" => Ok(Self::BasqueCountry),
"Biscay" => Ok(Self::Biscay),
"Burgos Province" => Ok(Self::BurgosProvince),
"Canary Islands" => Ok(Self::CanaryIslands),
"Cantabria" => Ok(Self::Cantabria),
"Castellón Province" => Ok(Self::CastellonProvince),
"Castile and León" => Ok(Self::CastileAndLeon),
"Castilla-La Mancha" => Ok(Self::CastileLaMancha),
"Catalonia" => Ok(Self::Catalonia),
"Ceuta" => Ok(Self::Ceuta),
"Ciudad Real Province" => Ok(Self::CiudadRealProvince),
"Community of Madrid" => Ok(Self::CommunityOfMadrid),
"Cuenca Province" => Ok(Self::CuencaProvince),
"Cáceres Province" => Ok(Self::CaceresProvince),
"Cádiz Province" => Ok(Self::CadizProvince),
"Córdoba Province" => Ok(Self::CordobaProvince),
"Extremadura" => Ok(Self::Extremadura),
"Galicia" => Ok(Self::Galicia),
"Gipuzkoa" => Ok(Self::Gipuzkoa),
"Girona Province" => Ok(Self::GironaProvince),
"Granada Province" => Ok(Self::GranadaProvince),
"Guadalajara Province" => Ok(Self::GuadalajaraProvince),
"Huelva Province" => Ok(Self::HuelvaProvince),
"Huesca Province" => Ok(Self::HuescaProvince),
"Jaén Province" => Ok(Self::JaenProvince),
"La Rioja" => Ok(Self::LaRioja),
"Las Palmas Province" => Ok(Self::LasPalmasProvince),
"León Province" => Ok(Self::LeonProvince),
"Lleida Province" => Ok(Self::LleidaProvince),
"Lugo Province" => Ok(Self::LugoProvince),
"Madrid Province" => Ok(Self::MadridProvince),
"Melilla" => Ok(Self::Melilla),
"Murcia Province" => Ok(Self::MurciaProvince),
"Málaga Province" => Ok(Self::MalagaProvince),
"Navarre" => Ok(Self::Navarre),
"Ourense Province" => Ok(Self::OurenseProvince),
"Palencia Province" => Ok(Self::PalenciaProvince),
"Pontevedra Province" => Ok(Self::PontevedraProvince),
"Province of Asturias" => Ok(Self::ProvinceOfAsturias),
"Province of Ávila" => Ok(Self::ProvinceOfAvila),
"Region of Murcia" => Ok(Self::RegionOfMurcia),
"Salamanca Province" => Ok(Self::SalamancaProvince),
"Santa Cruz de Tenerife Province" => Ok(Self::SantaCruzDeTenerifeProvince),
"Segovia Province" => Ok(Self::SegoviaProvince),
"Seville Province" => Ok(Self::SevilleProvince),
"Soria Province" => Ok(Self::SoriaProvince),
"Tarragona Province" => Ok(Self::TarragonaProvince),
"Teruel Province" => Ok(Self::TeruelProvince),
"Toledo Province" => Ok(Self::ToledoProvince),
"Valencia Province" => Ok(Self::ValenciaProvince),
"Valencian Community" => Ok(Self::ValencianCommunity),
"Valladolid Province" => Ok(Self::ValladolidProvince),
"Zamora Province" => Ok(Self::ZamoraProvince),
"Zaragoza Province" => Ok(Self::ZaragozaProvince),
_ => Err(errors::ConnectorError::InvalidDataFormat {
field_name: "address.state",
}
.into()),
},
}
}
}
impl ForeignTryFrom<String> for ItalyStatesAbbreviation {
type Error = error_stack::Report<errors::ConnectorError>;
fn foreign_try_from(value: String) -> Result<Self, Self::Error> {
let state_abbreviation_check =
StringExt::<Self>::parse_enum(value.clone(), "ItalyStatesAbbreviation");
match state_abbreviation_check {
Ok(state_abbreviation) => Ok(state_abbreviation),
Err(_) => match value.as_str() {
"Abruzzo" => Ok(Self::Abruzzo),
"Aosta Valley" => Ok(Self::AostaValley),
"Apulia" => Ok(Self::Apulia),
"Basilicata" => Ok(Self::Basilicata),
"Benevento Province" => Ok(Self::BeneventoProvince),
"Calabria" => Ok(Self::Calabria),
"Campania" => Ok(Self::Campania),
"Emilia-Romagna" => Ok(Self::EmiliaRomagna),
"Friuli–Venezia Giulia" => Ok(Self::FriuliVeneziaGiulia),
"Lazio" => Ok(Self::Lazio),
"Liguria" => Ok(Self::Liguria),
"Lombardy" => Ok(Self::Lombardy),
"Marche" => Ok(Self::Marche),
"Molise" => Ok(Self::Molise),
"Piedmont" => Ok(Self::Piedmont),
"Sardinia" => Ok(Self::Sardinia),
"Sicily" => Ok(Self::Sicily),
"Trentino-South Tyrol" => Ok(Self::TrentinoSouthTyrol),
"Tuscany" => Ok(Self::Tuscany),
"Umbria" => Ok(Self::Umbria),
"Veneto" => Ok(Self::Veneto),
"Libero consorzio comunale di Agrigento" => Ok(Self::Agrigento),
"Libero consorzio comunale di Caltanissetta" => Ok(Self::Caltanissetta),
"Libero consorzio comunale di Enna" => Ok(Self::Enna),
"Libero consorzio comunale di Ragusa" => Ok(Self::Ragusa),
"Libero consorzio comunale di Siracusa" => Ok(Self::Siracusa),
"Libero consorzio comunale di Trapani" => Ok(Self::Trapani),
"Metropolitan City of Bari" => Ok(Self::Bari),
"Metropolitan City of Bologna" => Ok(Self::Bologna),
"Metropolitan City of Cagliari" => Ok(Self::Cagliari),
"Metropolitan City of Catania" => Ok(Self::Catania),
"Metropolitan City of Florence" => Ok(Self::Florence),
"Metropolitan City of Genoa" => Ok(Self::Genoa),
"Metropolitan City of Messina" => Ok(Self::Messina),
"Metropolitan City of Milan" => Ok(Self::Milan),
"Metropolitan City of Naples" => Ok(Self::Naples),
"Metropolitan City of Palermo" => Ok(Self::Palermo),
"Metropolitan City of Reggio Calabria" => Ok(Self::ReggioCalabria),
"Metropolitan City of Rome" => Ok(Self::Rome),
"Metropolitan City of Turin" => Ok(Self::Turin),
"Metropolitan City of Venice" => Ok(Self::Venice),
_ => Err(errors::ConnectorError::InvalidDataFormat {
field_name: "address.state",
}
.into()),
},
}
}
}
impl ForeignTryFrom<String> for JapanStatesAbbreviation {
type Error = error_stack::Report<errors::ConnectorError>;
fn foreign_try_from(value: String) -> Result<Self, Self::Error> {
let state = parse_state_enum::<Self>(value, "JapanStatesAbbreviation", "address.state")?;
match state.as_str() {
"aichi" => Ok(Self::Aichi),
"akita" => Ok(Self::Akita),
"aomori" => Ok(Self::Aomori),
"chiba" => Ok(Self::Chiba),
"ehime" => Ok(Self::Ehime),
"fukui" => Ok(Self::Fukui),
"fukuoka" => Ok(Self::Fukuoka),
"fukushima" | "hukusima" => Ok(Self::Fukushima),
"gifu" => Ok(Self::Gifu),
"gunma" => Ok(Self::Gunma),
"hiroshima" => Ok(Self::Hiroshima),
"hokkaido" => Ok(Self::Hokkaido),
"hyogo" => Ok(Self::Hyogo),
"ibaraki" => Ok(Self::Ibaraki),
"ishikawa" => Ok(Self::Ishikawa),
"iwate" => Ok(Self::Iwate),
"kagawa" => Ok(Self::Kagawa),
"kagoshima" => Ok(Self::Kagoshima),
"kanagawa" => Ok(Self::Kanagawa),
"kochi" => Ok(Self::Kochi),
"kumamoto" => Ok(Self::Kumamoto),
"kyoto" => Ok(Self::Kyoto),
"mie" => Ok(Self::Mie),
"miyagi" => Ok(Self::Miyagi),
"miyazaki" => Ok(Self::Miyazaki),
"nagano" => Ok(Self::Nagano),
"nagasaki" => Ok(Self::Nagasaki),
"nara" => Ok(Self::Nara),
"niigata" => Ok(Self::Niigata),
"oita" => Ok(Self::Oita),
"okayama" => Ok(Self::Okayama),
"okinawa" => Ok(Self::Okinawa),
"osaka" => Ok(Self::Osaka),
"saga" => Ok(Self::Saga),
"saitama" => Ok(Self::Saitama),
"shiga" => Ok(Self::Shiga),
"shimane" => Ok(Self::Shimane),
"shizuoka" => Ok(Self::Shizuoka),
"tochigi" => Ok(Self::Tochigi),
"tokushima" | "tokusima" => Ok(Self::Tokusima),
"tokyo" => Ok(Self::Tokyo),
"tottori" => Ok(Self::Tottori),
"toyama" => Ok(Self::Toyama),
"wakayama" => Ok(Self::Wakayama),
"yamagata" => Ok(Self::Yamagata),
"yamaguchi" => Ok(Self::Yamaguchi),
"yamanashi" => Ok(Self::Yamanashi),
_ => Err(errors::ConnectorError::InvalidDataFormat {
field_name: "address.state",
}
.into()),
}
}
}
impl ForeignTryFrom<String> for ThailandStatesAbbreviation {
type Error = error_stack::Report<errors::ConnectorError>;
fn foreign_try_from(value: String) -> Result<Self, Self::Error> {
let state = parse_state_enum::<Self>(value, "ThailandStatesAbbreviation", "address.state")?;
match state.as_str() {
"amnatcharoen" => Ok(Self::AmnatCharoen),
"angthong" => Ok(Self::AngThong),
"bangkok" => Ok(Self::Bangkok),
"buengkan" => Ok(Self::BuengKan),
"buriram" => Ok(Self::BuriRam),
"chachoengsao" => Ok(Self::Chachoengsao),
"chainat" => Ok(Self::ChaiNat),
"chaiyaphum" => Ok(Self::Chaiyaphum),
"chanthaburi" => Ok(Self::Chanthaburi),
"chiangmai" => Ok(Self::ChiangMai),
"chiangrai" => Ok(Self::ChiangRai),
"chonburi" => Ok(Self::ChonBuri),
"chumphon" => Ok(Self::Chumphon),
"kalasin" => Ok(Self::Kalasin),
"kamphaengphet" => Ok(Self::KamphaengPhet),
"kanchanaburi" => Ok(Self::Kanchanaburi),
"khonkaen" => Ok(Self::KhonKaen),
"krabi" => Ok(Self::Krabi),
"lampang" => Ok(Self::Lampang),
"lamphun" => Ok(Self::Lamphun),
"loei" => Ok(Self::Loei),
"lopburi" => Ok(Self::LopBuri),
"maehongson" => Ok(Self::MaeHongSon),
"mahasarakham" => Ok(Self::MahaSarakham),
"mukdahan" => Ok(Self::Mukdahan),
"nakhonnayok" => Ok(Self::NakhonNayok),
"nakhonpathom" => Ok(Self::NakhonPathom),
"nakhonphanom" => Ok(Self::NakhonPhanom),
"nakhonratchasima" => Ok(Self::NakhonRatchasima),
"nakhonsawan" => Ok(Self::NakhonSawan),
"nakhonsithammarat" => Ok(Self::NakhonSiThammarat),
"nan" => Ok(Self::Nan),
"narathiwat" => Ok(Self::Narathiwat),
"nongbualamphu" => Ok(Self::NongBuaLamPhu),
"nongkhai" => Ok(Self::NongKhai),
"nonthaburi" => Ok(Self::Nonthaburi),
"pathumthani" => Ok(Self::PathumThani),
"pattani" => Ok(Self::Pattani),
"phangnga" => Ok(Self::Phangnga),
"phatthalung" => Ok(Self::Phatthalung),
"phayao" => Ok(Self::Phayao),
"phatthaya" => Ok(Self::Phatthaya),
"phetchabun" => Ok(Self::Phetchabun),
"phetchaburi" => Ok(Self::Phetchaburi),
"phichit" => Ok(Self::Phichit),
"phitsanulok" => Ok(Self::Phitsanulok),
"phrae" => Ok(Self::Phrae),
"phuket" => Ok(Self::Phuket),
"prachinburi" => Ok(Self::PrachinBuri),
"phranakhonsiayutthaya" => Ok(Self::PhraNakhonSiAyutthaya),
"prachuapkhirikhan" => Ok(Self::PrachuapKhiriKhan),
"ranong" => Ok(Self::Ranong),
"ratchaburi" => Ok(Self::Ratchaburi),
"rayong" => Ok(Self::Rayong),
"roiet" => Ok(Self::RoiEt),
"sakaeo" => Ok(Self::SaKaeo),
"sakonnakhon" => Ok(Self::SakonNakhon),
"samutprakan" => Ok(Self::SamutPrakan),
"samutsakhon" => Ok(Self::SamutSakhon),
"samutsongkhram" => Ok(Self::SamutSongkhram),
"saraburi" => Ok(Self::Saraburi),
"satun" => Ok(Self::Satun),
"sisaket" => Ok(Self::SiSaKet),
"singburi" => Ok(Self::SingBuri),
"songkhla" => Ok(Self::Songkhla),
"sukhothai" => Ok(Self::Sukhothai),
|
crates/hyperswitch_connectors/src/utils.rs#chunk3
|
hyperswitch_connectors
|
chunk
| null | null | null | 8,191
| null | null | null | null | null | null | null |
// Struct: DeutschebankThreeDSInitializeRequestCreditCardExpiry
// File: crates/hyperswitch_connectors/src/connectors/deutschebank/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct DeutschebankThreeDSInitializeRequestCreditCardExpiry
|
crates/hyperswitch_connectors/src/connectors/deutschebank/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
DeutschebankThreeDSInitializeRequestCreditCardExpiry
| 0
|
[] | 62
| null | null | null | null | null | null | null |
// Function: generate_digest
// File: crates/hyperswitch_connectors/src/connectors/bankofamerica.rs
// Module: hyperswitch_connectors
pub fn generate_digest(&self, payload: &[u8]) -> String
|
crates/hyperswitch_connectors/src/connectors/bankofamerica.rs
|
hyperswitch_connectors
|
function_signature
| null | null | null | 49
|
generate_digest
| null | null | null | null | null | null |
// Implementation: impl ConnectorCommon for for Multisafepay
// File: crates/hyperswitch_connectors/src/connectors/multisafepay.rs
// Module: hyperswitch_connectors
// Methods: 6 total (0 public)
impl ConnectorCommon for for Multisafepay
|
crates/hyperswitch_connectors/src/connectors/multisafepay.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 63
| null |
Multisafepay
|
ConnectorCommon for
| 6
| 0
| null | null |
// Implementation: impl ConnectorCommon for for Recurly
// File: crates/hyperswitch_connectors/src/connectors/recurly.rs
// Module: hyperswitch_connectors
// Methods: 6 total (0 public)
impl ConnectorCommon for for Recurly
|
crates/hyperswitch_connectors/src/connectors/recurly.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 56
| null |
Recurly
|
ConnectorCommon for
| 6
| 0
| null | null |
// Function: get_or_create_custom_recovery_intent
// File: crates/router/src/core/webhooks/recovery_incoming.rs
// Module: router
pub fn get_or_create_custom_recovery_intent(
data: api_models::payments::RecoveryPaymentsCreate,
state: &SessionState,
req_state: &ReqState,
merchant_context: &domain::MerchantContext,
profile: &domain::Profile,
) -> CustomResult<revenue_recovery::RecoveryPaymentIntent, errors::RevenueRecoveryError>
|
crates/router/src/core/webhooks/recovery_incoming.rs
|
router
|
function_signature
| null | null | null | 107
|
get_or_create_custom_recovery_intent
| null | null | null | null | null | null |
// Implementation: impl GetPaymentMethodType for for PayLaterData
// File: crates/hyperswitch_domain_models/src/payment_method_data.rs
// Module: hyperswitch_domain_models
// Methods: 1 total (0 public)
impl GetPaymentMethodType for for PayLaterData
|
crates/hyperswitch_domain_models/src/payment_method_data.rs
|
hyperswitch_domain_models
|
impl_block
| null | null | null | 58
| null |
PayLaterData
|
GetPaymentMethodType for
| 1
| 0
| null | null |
// Struct: WebhookDeliveryRetryRequestInternal
// File: crates/api_models/src/webhook_events.rs
// Module: api_models
// Implementations: 1
// Traits: common_utils::events::ApiEventMetric
pub struct WebhookDeliveryRetryRequestInternal
|
crates/api_models/src/webhook_events.rs
|
api_models
|
struct_definition
|
WebhookDeliveryRetryRequestInternal
| 1
|
[
"common_utils::events::ApiEventMetric"
] | 55
| null | null | null | null | null | null | null |
// Function: get_refunds_aggregates
// File: crates/router/src/routes/refunds.rs
// Module: router
pub fn get_refunds_aggregates(
state: web::Data<AppState>,
req: HttpRequest,
query_params: web::Query<common_utils::types::TimeRange>,
) -> HttpResponse
|
crates/router/src/routes/refunds.rs
|
router
|
function_signature
| null | null | null | 68
|
get_refunds_aggregates
| null | null | null | null | null | null |
// Implementation: impl Parse for for FieldMeta
// File: crates/router_derive/src/macros/to_encryptable.rs
// Module: router_derive
// Methods: 1 total (0 public)
impl Parse for for FieldMeta
|
crates/router_derive/src/macros/to_encryptable.rs
|
router_derive
|
impl_block
| null | null | null | 48
| null |
FieldMeta
|
Parse for
| 1
| 0
| null | null |
// Function: get_payout_connector_config
// File: crates/euclid_wasm/src/lib.rs
// Module: euclid_wasm
pub fn get_payout_connector_config(key: &str) -> JsResult
|
crates/euclid_wasm/src/lib.rs
|
euclid_wasm
|
function_signature
| null | null | null | 45
|
get_payout_connector_config
| null | null | null | null | null | null |
// Function: get_frm_config_as_secret
// File: crates/api_models/src/admin.rs
// Module: api_models
pub fn get_frm_config_as_secret(&self) -> Option<Vec<Secret<serde_json::Value>>>
|
crates/api_models/src/admin.rs
|
api_models
|
function_signature
| null | null | null | 46
|
get_frm_config_as_secret
| null | null | null | null | null | null |
// File: crates/diesel_models/src/configs.rs
// Module: diesel_models
// Public functions: 1
// Public structs: 3
use std::convert::From;
use diesel::{AsChangeset, Identifiable, Insertable, Queryable, Selectable};
use serde::{Deserialize, Serialize};
use crate::schema::configs;
#[derive(Default, Clone, Debug, Insertable, Serialize, Deserialize)]
#[diesel(table_name = configs)]
pub struct ConfigNew {
pub key: String,
pub config: String,
}
#[derive(Default, Clone, Debug, Identifiable, Queryable, Selectable, Deserialize, Serialize)]
#[diesel(table_name = configs, primary_key(key), check_for_backend(diesel::pg::Pg))]
pub struct Config {
pub key: String,
pub config: String,
}
#[derive(Debug)]
pub enum ConfigUpdate {
Update { config: Option<String> },
}
#[derive(Clone, Debug, AsChangeset, Default)]
#[diesel(table_name = configs)]
pub struct ConfigUpdateInternal {
config: Option<String>,
}
impl ConfigUpdateInternal {
pub fn create_config(self, source: Config) -> Config {
Config { ..source }
}
}
impl From<ConfigUpdate> for ConfigUpdateInternal {
fn from(config_update: ConfigUpdate) -> Self {
match config_update {
ConfigUpdate::Update { config } => Self { config },
}
}
}
impl From<ConfigNew> for Config {
fn from(config_new: ConfigNew) -> Self {
Self {
key: config_new.key,
config: config_new.config,
}
}
}
|
crates/diesel_models/src/configs.rs
|
diesel_models
|
full_file
| null | null | null | 342
| null | null | null | null | null | null | null |
// Implementation: impl api::RefundExecute for for Facilitapay
// File: crates/hyperswitch_connectors/src/connectors/facilitapay.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::RefundExecute for for Facilitapay
|
crates/hyperswitch_connectors/src/connectors/facilitapay.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 66
| null |
Facilitapay
|
api::RefundExecute for
| 0
| 0
| null | null |
// Struct: ActivePaymentsMetricsBucketIdentifier
// File: crates/api_models/src/analytics/active_payments.rs
// Module: api_models
// Implementations: 3
// Traits: Hash, PartialEq
pub struct ActivePaymentsMetricsBucketIdentifier
|
crates/api_models/src/analytics/active_payments.rs
|
api_models
|
struct_definition
|
ActivePaymentsMetricsBucketIdentifier
| 3
|
[
"Hash",
"PartialEq"
] | 50
| null | null | null | null | null | null | null |
// Function: find_by_global_customer_id
// File: crates/diesel_models/src/query/mandate.rs
// Module: diesel_models
pub fn find_by_global_customer_id(
conn: &PgPooledConn,
customer_id: &common_utils::id_type::GlobalCustomerId,
) -> StorageResult<Vec<Self>>
|
crates/diesel_models/src/query/mandate.rs
|
diesel_models
|
function_signature
| null | null | null | 68
|
find_by_global_customer_id
| null | null | null | null | null | null |
// Function: customers_list
// File: crates/openapi/src/routes/customers.rs
// Module: openapi
pub fn customers_list()
|
crates/openapi/src/routes/customers.rs
|
openapi
|
function_signature
| null | null | null | 29
|
customers_list
| null | null | null | null | null | null |
// Function: server
// File: crates/router/src/routes/app.rs
// Module: router
pub fn server(state: AppState) -> Scope
|
crates/router/src/routes/app.rs
|
router
|
function_signature
| null | null | null | 29
|
server
| null | null | null | null | null | null |
// Implementation: impl Profile
// File: crates/hyperswitch_domain_models/src/business_profile.rs
// Module: hyperswitch_domain_models
// Methods: 2 total (2 public)
impl Profile
|
crates/hyperswitch_domain_models/src/business_profile.rs
|
hyperswitch_domain_models
|
impl_block
| null | null | null | 41
| null |
Profile
| null | 2
| 2
| null | null |
// Implementation: impl api::Payment for for Fiuu
// File: crates/hyperswitch_connectors/src/connectors/fiuu.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::Payment for for Fiuu
|
crates/hyperswitch_connectors/src/connectors/fiuu.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 58
| null |
Fiuu
|
api::Payment for
| 0
| 0
| null | null |
// Struct: ChargebeeSubscriptionEstimateRequest
// File: crates/hyperswitch_connectors/src/connectors/chargebee/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct ChargebeeSubscriptionEstimateRequest
|
crates/hyperswitch_connectors/src/connectors/chargebee/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
ChargebeeSubscriptionEstimateRequest
| 0
|
[] | 54
| null | null | null | null | null | null | null |
// Struct: PaymentsResponse
// File: crates/hyperswitch_connectors/src/connectors/klarna/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct PaymentsResponse
|
crates/hyperswitch_connectors/src/connectors/klarna/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
PaymentsResponse
| 0
|
[] | 46
| null | null | null | null | null | null | null |
// Implementation: impl CustomerResponse
// File: crates/api_models/src/customers.rs
// Module: api_models
// Methods: 1 total (1 public)
impl CustomerResponse
|
crates/api_models/src/customers.rs
|
api_models
|
impl_block
| null | null | null | 37
| null |
CustomerResponse
| null | 1
| 1
| null | null |
// File: crates/diesel_models/src/query/role.rs
// Module: diesel_models
// Public functions: 8
use async_bb8_diesel::AsyncRunQueryDsl;
use common_enums::EntityType;
use common_utils::id_type;
use diesel::{
associations::HasTable, debug_query, pg::Pg, result::Error as DieselError,
BoolExpressionMethods, ExpressionMethods, QueryDsl,
};
use error_stack::{report, ResultExt};
use strum::IntoEnumIterator;
use crate::{
enums::RoleScope, errors, query::generics, role::*, schema::roles::dsl, PgPooledConn,
StorageResult,
};
impl RoleNew {
pub async fn insert(self, conn: &PgPooledConn) -> StorageResult<Role> {
generics::generic_insert(conn, self).await
}
}
impl Role {
fn get_entity_list(
current_entity: EntityType,
is_lineage_data_required: bool,
) -> Vec<EntityType> {
is_lineage_data_required
.then(|| {
EntityType::iter()
.filter(|variant| *variant <= current_entity)
.collect()
})
.unwrap_or(vec![current_entity])
}
pub async fn find_by_role_id(conn: &PgPooledConn, role_id: &str) -> StorageResult<Self> {
generics::generic_find_one::<<Self as HasTable>::Table, _, _>(
conn,
dsl::role_id.eq(role_id.to_owned()),
)
.await
}
pub async fn find_by_role_id_in_lineage(
conn: &PgPooledConn,
role_id: &str,
merchant_id: &id_type::MerchantId,
org_id: &id_type::OrganizationId,
profile_id: &id_type::ProfileId,
tenant_id: &id_type::TenantId,
) -> StorageResult<Self> {
generics::generic_find_one::<<Self as HasTable>::Table, _, _>(
conn,
dsl::role_id
.eq(role_id.to_owned())
.and(dsl::tenant_id.eq(tenant_id.to_owned()))
.and(dsl::org_id.eq(org_id.to_owned()))
.and(
dsl::scope
.eq(RoleScope::Organization)
.or(dsl::merchant_id
.eq(merchant_id.to_owned())
.and(dsl::scope.eq(RoleScope::Merchant)))
.or(dsl::profile_id
.eq(profile_id.to_owned())
.and(dsl::scope.eq(RoleScope::Profile))),
),
)
.await
}
pub async fn find_by_role_id_org_id_tenant_id(
conn: &PgPooledConn,
role_id: &str,
org_id: &id_type::OrganizationId,
tenant_id: &id_type::TenantId,
) -> StorageResult<Self> {
generics::generic_find_one::<<Self as HasTable>::Table, _, _>(
conn,
dsl::role_id
.eq(role_id.to_owned())
.and(dsl::tenant_id.eq(tenant_id.to_owned()))
.and(dsl::org_id.eq(org_id.to_owned())),
)
.await
}
pub async fn update_by_role_id(
conn: &PgPooledConn,
role_id: &str,
role_update: RoleUpdate,
) -> StorageResult<Self> {
generics::generic_update_with_unique_predicate_get_result::<
<Self as HasTable>::Table,
_,
_,
_,
>(
conn,
dsl::role_id.eq(role_id.to_owned()),
RoleUpdateInternal::from(role_update),
)
.await
}
pub async fn delete_by_role_id(conn: &PgPooledConn, role_id: &str) -> StorageResult<Self> {
generics::generic_delete_one_with_result::<<Self as HasTable>::Table, _, _>(
conn,
dsl::role_id.eq(role_id.to_owned()),
)
.await
}
//TODO: Remove once generic_list_roles_by_entity_type is stable
pub async fn generic_roles_list_for_org(
conn: &PgPooledConn,
tenant_id: id_type::TenantId,
org_id: id_type::OrganizationId,
merchant_id: Option<id_type::MerchantId>,
entity_type: Option<EntityType>,
limit: Option<u32>,
) -> StorageResult<Vec<Self>> {
let mut query = <Self as HasTable>::table()
.filter(dsl::tenant_id.eq(tenant_id).and(dsl::org_id.eq(org_id)))
.into_boxed();
if let Some(merchant_id) = merchant_id {
query = query.filter(
(dsl::merchant_id
.eq(merchant_id)
.and(dsl::scope.eq(RoleScope::Merchant)))
.or(dsl::scope.eq(RoleScope::Organization)),
);
}
if let Some(entity_type) = entity_type {
query = query.filter(dsl::entity_type.eq(entity_type))
}
if let Some(limit) = limit {
query = query.limit(limit.into());
}
router_env::logger::debug!(query = %debug_query::<Pg,_>(&query).to_string());
match generics::db_metrics::track_database_call::<Self, _, _>(
query.get_results_async(conn),
generics::db_metrics::DatabaseOperation::Filter,
)
.await
{
Ok(value) => Ok(value),
Err(err) => match err {
DieselError::NotFound => {
Err(report!(err)).change_context(errors::DatabaseError::NotFound)
}
_ => Err(report!(err)).change_context(errors::DatabaseError::Others),
},
}
}
pub async fn generic_list_roles_by_entity_type(
conn: &PgPooledConn,
payload: ListRolesByEntityPayload,
is_lineage_data_required: bool,
tenant_id: id_type::TenantId,
org_id: id_type::OrganizationId,
) -> StorageResult<Vec<Self>> {
let mut query = <Self as HasTable>::table()
.into_boxed()
.filter(dsl::tenant_id.eq(tenant_id))
.filter(dsl::org_id.eq(org_id));
match payload {
ListRolesByEntityPayload::Organization => {
let entity_in_vec =
Self::get_entity_list(EntityType::Organization, is_lineage_data_required);
query = query.filter(dsl::entity_type.eq_any(entity_in_vec))
}
ListRolesByEntityPayload::Merchant(merchant_id) => {
let entity_in_vec =
Self::get_entity_list(EntityType::Merchant, is_lineage_data_required);
query = query
.filter(
dsl::scope
.eq(RoleScope::Organization)
.or(dsl::merchant_id.eq(merchant_id)),
)
.filter(dsl::entity_type.eq_any(entity_in_vec))
}
ListRolesByEntityPayload::Profile(merchant_id, profile_id) => {
let entity_in_vec =
Self::get_entity_list(EntityType::Profile, is_lineage_data_required);
query = query
.filter(
dsl::scope
.eq(RoleScope::Organization)
.or(dsl::scope
.eq(RoleScope::Merchant)
.and(dsl::merchant_id.eq(merchant_id.clone())))
.or(dsl::profile_id.eq(profile_id)),
)
.filter(dsl::entity_type.eq_any(entity_in_vec))
}
};
router_env::logger::debug!(query = %debug_query::<Pg,_>(&query).to_string());
match generics::db_metrics::track_database_call::<Self, _, _>(
query.get_results_async(conn),
generics::db_metrics::DatabaseOperation::Filter,
)
.await
{
Ok(value) => Ok(value),
Err(err) => Err(report!(err)).change_context(errors::DatabaseError::Others),
}
}
}
|
crates/diesel_models/src/query/role.rs
|
diesel_models
|
full_file
| null | null | null | 1,716
| null | null | null | null | null | null | null |
// Implementation: impl MerchantConnectorAccount
// File: crates/diesel_models/src/merchant_connector_account.rs
// Module: diesel_models
// Methods: 1 total (1 public)
impl MerchantConnectorAccount
|
crates/diesel_models/src/merchant_connector_account.rs
|
diesel_models
|
impl_block
| null | null | null | 42
| null |
MerchantConnectorAccount
| null | 1
| 1
| null | null |
// Function: list_payment_method_api
// File: crates/openapi/src/routes/payment_method.rs
// Module: openapi
pub fn list_payment_method_api()
|
crates/openapi/src/routes/payment_method.rs
|
openapi
|
function_signature
| null | null | null | 33
|
list_payment_method_api
| null | null | null | null | null | null |
// Struct: ExecutePcrWorkflow
// File: crates/router/src/workflows/revenue_recovery.rs
// Module: router
// Implementations: 0
pub struct ExecutePcrWorkflow
|
crates/router/src/workflows/revenue_recovery.rs
|
router
|
struct_definition
|
ExecutePcrWorkflow
| 0
|
[] | 39
| null | null | null | null | null | null | null |
// Implementation: impl api::Payment for for Noon
// File: crates/hyperswitch_connectors/src/connectors/noon.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::Payment for for Noon
|
crates/hyperswitch_connectors/src/connectors/noon.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 53
| null |
Noon
|
api::Payment for
| 0
| 0
| null | null |
// Trait: ConnectorIntegrationInterface
// File: crates/hyperswitch_interfaces/src/connector_integration_interface.rs
// Module: hyperswitch_interfaces
// Documentation: Trait representing the connector integration interface This trait defines the methods required for a connector integration interface.
pub trait ConnectorIntegrationInterface<F, ResourceCommonData, Req, Resp>: Send + Sync
|
crates/hyperswitch_interfaces/src/connector_integration_interface.rs
|
hyperswitch_interfaces
|
trait_definition
| null | null | null | 70
| null | null |
ConnectorIntegrationInterface
| null | null | null | null |
// Function: insert
// File: crates/diesel_models/src/query/merchant_connector_account.rs
// Module: diesel_models
pub fn insert(self, conn: &PgPooledConn) -> StorageResult<MerchantConnectorAccount>
|
crates/diesel_models/src/query/merchant_connector_account.rs
|
diesel_models
|
function_signature
| null | null | null | 47
|
insert
| null | null | null | null | null | null |
// Implementation: impl MerchantKeyStoreInterface for for KafkaStore
// File: crates/router/src/db/kafka_store.rs
// Module: router
// Methods: 5 total (0 public)
impl MerchantKeyStoreInterface for for KafkaStore
|
crates/router/src/db/kafka_store.rs
|
router
|
impl_block
| null | null | null | 49
| null |
KafkaStore
|
MerchantKeyStoreInterface for
| 5
| 0
| null | null |
// Struct: UpdateNexixpayConnectorMetaData
// File: crates/hyperswitch_connectors/src/connectors/nexixpay/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct UpdateNexixpayConnectorMetaData
|
crates/hyperswitch_connectors/src/connectors/nexixpay/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
UpdateNexixpayConnectorMetaData
| 0
|
[] | 57
| null | null | null | null | null | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.