text
stringlengths 65
57.3k
| file_path
stringlengths 22
92
| module
stringclasses 38
values | type
stringclasses 7
values | struct_name
stringlengths 3
60
⌀ | impl_count
int64 0
60
⌀ | traits
listlengths 0
59
⌀ | tokens
int64 16
8.19k
| function_name
stringlengths 3
85
⌀ | type_name
stringlengths 1
67
⌀ | trait_name
stringclasses 573
values | method_count
int64 0
31
⌀ | public_method_count
int64 0
19
⌀ | submodule_count
int64 0
56
⌀ | export_count
int64 0
9
⌀ |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
// Implementation: impl LineageIds
// File: crates/external_services/src/grpc_client.rs
// Module: external_services
// Methods: 2 total (2 public)
impl LineageIds
|
crates/external_services/src/grpc_client.rs
|
external_services
|
impl_block
| null | null | null | 40
| null |
LineageIds
| null | 2
| 2
| null | null |
// Implementation: impl common_utils::events::ApiEventMetric for for ProfileAcquirerResponse
// File: crates/api_models/src/profile_acquirer.rs
// Module: api_models
// Methods: 0 total (0 public)
impl common_utils::events::ApiEventMetric for for ProfileAcquirerResponse
|
crates/api_models/src/profile_acquirer.rs
|
api_models
|
impl_block
| null | null | null | 62
| null |
ProfileAcquirerResponse
|
common_utils::events::ApiEventMetric for
| 0
| 0
| null | null |
// Struct: FileRetrieveQuery
// File: crates/api_models/src/files.rs
// Module: api_models
// Implementations: 0
pub struct FileRetrieveQuery
|
crates/api_models/src/files.rs
|
api_models
|
struct_definition
|
FileRetrieveQuery
| 0
|
[] | 35
| null | null | null | null | null | null | null |
// Implementation: impl api::RefundSync for for Tesouro
// File: crates/hyperswitch_connectors/src/connectors/tesouro.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::RefundSync for for Tesouro
|
crates/hyperswitch_connectors/src/connectors/tesouro.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 60
| null |
Tesouro
|
api::RefundSync for
| 0
| 0
| null | null |
// Function: update_connector_mandate_details_status
// File: crates/router/src/core/payments/tokenization.rs
// Module: router
pub fn update_connector_mandate_details_status(
merchant_connector_id: id_type::MerchantConnectorAccountId,
mut payment_mandate_reference: PaymentsMandateReference,
status: ConnectorMandateStatus,
) -> RouterResult<Option<CommonMandateReference>>
|
crates/router/src/core/payments/tokenization.rs
|
router
|
function_signature
| null | null | null | 86
|
update_connector_mandate_details_status
| null | null | null | null | null | null |
// Struct: BluesnapCardHolderInfo
// File: crates/hyperswitch_connectors/src/connectors/bluesnap/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct BluesnapCardHolderInfo
|
crates/hyperswitch_connectors/src/connectors/bluesnap/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
BluesnapCardHolderInfo
| 0
|
[] | 52
| null | null | null | null | null | null | null |
// Struct: VoltRefundsWebhookBodyEventType
// File: crates/hyperswitch_connectors/src/connectors/volt/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct VoltRefundsWebhookBodyEventType
|
crates/hyperswitch_connectors/src/connectors/volt/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
VoltRefundsWebhookBodyEventType
| 0
|
[] | 55
| null | null | null | null | null | null | null |
// File: crates/diesel_models/src/query/blocklist.rs
// Module: diesel_models
// Public functions: 5
use diesel::{associations::HasTable, BoolExpressionMethods, ExpressionMethods};
use super::generics;
use crate::{
blocklist::{Blocklist, BlocklistNew},
schema::blocklist::dsl,
PgPooledConn, StorageResult,
};
impl BlocklistNew {
pub async fn insert(self, conn: &PgPooledConn) -> StorageResult<Blocklist> {
generics::generic_insert(conn, self).await
}
}
impl Blocklist {
pub async fn find_by_merchant_id_fingerprint_id(
conn: &PgPooledConn,
merchant_id: &common_utils::id_type::MerchantId,
fingerprint_id: &str,
) -> StorageResult<Self> {
generics::generic_find_one::<<Self as HasTable>::Table, _, _>(
conn,
dsl::merchant_id
.eq(merchant_id.to_owned())
.and(dsl::fingerprint_id.eq(fingerprint_id.to_owned())),
)
.await
}
pub async fn list_by_merchant_id_data_kind(
conn: &PgPooledConn,
merchant_id: &common_utils::id_type::MerchantId,
data_kind: common_enums::BlocklistDataKind,
limit: i64,
offset: i64,
) -> StorageResult<Vec<Self>> {
generics::generic_filter::<<Self as HasTable>::Table, _, _, _>(
conn,
dsl::merchant_id
.eq(merchant_id.to_owned())
.and(dsl::data_kind.eq(data_kind.to_owned())),
Some(limit),
Some(offset),
Some(dsl::created_at.desc()),
)
.await
}
pub async fn list_by_merchant_id(
conn: &PgPooledConn,
merchant_id: &common_utils::id_type::MerchantId,
) -> StorageResult<Vec<Self>> {
generics::generic_filter::<<Self as HasTable>::Table, _, _, _>(
conn,
dsl::merchant_id.eq(merchant_id.to_owned()),
None,
None,
Some(dsl::created_at.desc()),
)
.await
}
pub async fn delete_by_merchant_id_fingerprint_id(
conn: &PgPooledConn,
merchant_id: &common_utils::id_type::MerchantId,
fingerprint_id: &str,
) -> StorageResult<Self> {
generics::generic_delete_one_with_result::<<Self as HasTable>::Table, _, _>(
conn,
dsl::merchant_id
.eq(merchant_id.to_owned())
.and(dsl::fingerprint_id.eq(fingerprint_id.to_owned())),
)
.await
}
}
|
crates/diesel_models/src/query/blocklist.rs
|
diesel_models
|
full_file
| null | null | null | 598
| null | null | null | null | null | null | null |
// Struct: AccountNumber
// File: crates/hyperswitch_connectors/src/connectors/nordea/requests.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct AccountNumber
|
crates/hyperswitch_connectors/src/connectors/nordea/requests.rs
|
hyperswitch_connectors
|
struct_definition
|
AccountNumber
| 0
|
[] | 45
| null | null | null | null | null | null | null |
// Function: update_default_routing_config
// File: crates/router/src/core/routing.rs
// Module: router
pub fn update_default_routing_config(
state: SessionState,
merchant_context: domain::MerchantContext,
updated_config: Vec<routing_types::RoutableConnectorChoice>,
transaction_type: &enums::TransactionType,
) -> RouterResponse<Vec<routing_types::RoutableConnectorChoice>>
|
crates/router/src/core/routing.rs
|
router
|
function_signature
| null | null | null | 86
|
update_default_routing_config
| null | null | null | null | null | null |
// File: crates/router/src/core/payouts/validator.rs
// Module: router
// Public functions: 5
use std::collections::HashSet;
use actix_web::http::header;
#[cfg(feature = "olap")]
use common_utils::errors::CustomResult;
use common_utils::{
id_type::{self, GenerateId},
validation::validate_domain_against_allowed_domains,
};
use diesel_models::generic_link::PayoutLink;
use error_stack::{report, ResultExt};
use hyperswitch_domain_models::payment_methods::PaymentMethod;
use router_env::{instrument, tracing, which as router_env_which, Env};
use url::Url;
use super::helpers;
#[cfg(feature = "v1")]
use crate::core::payment_methods::cards::get_pm_list_context;
use crate::{
core::{
errors::{self, RouterResult},
utils as core_utils,
},
db::StorageInterface,
errors::StorageError,
routes::SessionState,
types::{api::payouts, domain, storage},
utils,
utils::OptionExt,
};
#[instrument(skip(db))]
pub async fn validate_uniqueness_of_payout_id_against_merchant_id(
db: &dyn StorageInterface,
payout_id: &id_type::PayoutId,
merchant_id: &id_type::MerchantId,
storage_scheme: storage::enums::MerchantStorageScheme,
) -> RouterResult<Option<storage::Payouts>> {
let maybe_payouts = db
.find_optional_payout_by_merchant_id_payout_id(merchant_id, payout_id, storage_scheme)
.await;
match maybe_payouts {
Err(err) => {
let storage_err = err.current_context();
match storage_err {
StorageError::ValueNotFound(_) => Ok(None),
_ => Err(err
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Failed while finding payout_attempt, database error")),
}
}
Ok(payout) => Ok(payout),
}
}
#[cfg(feature = "v2")]
pub async fn validate_create_request(
_state: &SessionState,
_merchant_context: &domain::MerchantContext,
_req: &payouts::PayoutCreateRequest,
) -> RouterResult<(
String,
Option<payouts::PayoutMethodData>,
String,
Option<domain::Customer>,
Option<PaymentMethod>,
)> {
todo!()
}
/// Validates the request on below checks
/// - merchant_id passed is same as the one in merchant_account table
/// - payout_id is unique against merchant_id
/// - payout_token provided is legitimate
#[cfg(feature = "v1")]
pub async fn validate_create_request(
state: &SessionState,
merchant_context: &domain::MerchantContext,
req: &payouts::PayoutCreateRequest,
) -> RouterResult<(
id_type::PayoutId,
Option<payouts::PayoutMethodData>,
id_type::ProfileId,
Option<domain::Customer>,
Option<PaymentMethod>,
)> {
if req.payout_method_id.is_some() && req.confirm != Some(true) {
return Err(report!(errors::ApiErrorResponse::InvalidRequestData {
message: "Confirm must be true for recurring payouts".to_string(),
}));
}
let merchant_id = merchant_context.get_merchant_account().get_id();
if let Some(payout_link) = &req.payout_link {
if *payout_link {
validate_payout_link_request(req)?;
}
};
// Merchant ID
let predicate = req.merchant_id.as_ref().map(|mid| mid != merchant_id);
utils::when(predicate.unwrap_or(false), || {
Err(report!(errors::ApiErrorResponse::InvalidDataFormat {
field_name: "merchant_id".to_string(),
expected_format: "merchant_id from merchant account".to_string(),
})
.attach_printable("invalid merchant_id in request"))
})?;
// Payout ID
let db: &dyn StorageInterface = &*state.store;
let payout_id = match req.payout_id.as_ref() {
Some(provided_payout_id) => provided_payout_id.clone(),
None => id_type::PayoutId::generate(),
};
match validate_uniqueness_of_payout_id_against_merchant_id(
db,
&payout_id,
merchant_id,
merchant_context.get_merchant_account().storage_scheme,
)
.await
.attach_printable_lazy(|| {
format!(
"Unique violation while checking payout_id: {payout_id:?} against merchant_id: {merchant_id:?}"
)
})? {
Some(_) => Err(report!(errors::ApiErrorResponse::DuplicatePayout {
payout_id: payout_id.clone()
})),
None => Ok(()),
}?;
// Fetch customer details (merge of loose fields + customer object) and create DB entry
let customer_in_request = helpers::get_customer_details_from_request(req);
let customer = if customer_in_request.customer_id.is_some()
|| customer_in_request.name.is_some()
|| customer_in_request.email.is_some()
|| customer_in_request.phone.is_some()
|| customer_in_request.phone_country_code.is_some()
{
helpers::get_or_create_customer_details(state, &customer_in_request, merchant_context)
.await?
} else {
None
};
#[cfg(feature = "v1")]
let profile_id = core_utils::get_profile_id_from_business_details(
&state.into(),
req.business_country,
req.business_label.as_ref(),
merchant_context,
req.profile_id.as_ref(),
&*state.store,
false,
)
.await?;
#[cfg(feature = "v2")]
// Profile id will be mandatory in v2 in the request / headers
let profile_id = req
.profile_id
.clone()
.ok_or(errors::ApiErrorResponse::MissingRequiredField {
field_name: "profile_id",
})
.attach_printable("Profile id is a mandatory parameter")?;
let payment_method: Option<PaymentMethod> =
match (req.payout_token.as_ref(), req.payout_method_id.clone()) {
(Some(_), Some(_)) => Err(report!(errors::ApiErrorResponse::InvalidRequestData {
message: "Only one of payout_method_id or payout_token should be provided."
.to_string(),
})),
(None, Some(payment_method_id)) => match customer.as_ref() {
Some(customer) => {
let payment_method = db
.find_payment_method(
&state.into(),
merchant_context.get_merchant_key_store(),
&payment_method_id,
merchant_context.get_merchant_account().storage_scheme,
)
.await
.change_context(errors::ApiErrorResponse::PaymentMethodNotFound)
.attach_printable("Unable to find payment method")?;
utils::when(payment_method.customer_id != customer.customer_id, || {
Err(report!(errors::ApiErrorResponse::InvalidRequestData {
message: "Payment method does not belong to this customer_id".to_string(),
})
.attach_printable(
"customer_id in payment_method does not match with customer_id in request",
))
})?;
Ok(Some(payment_method))
}
None => Err(report!(errors::ApiErrorResponse::MissingRequiredField {
field_name: "customer_id when payment_method_id is passed",
})),
},
_ => Ok(None),
}?;
// payout_token
let payout_method_data = match (
req.payout_token.as_ref(),
customer.as_ref(),
payment_method.as_ref(),
) {
(Some(_), None, _) => Err(report!(errors::ApiErrorResponse::MissingRequiredField {
field_name: "customer or customer_id when payout_token is provided"
})),
(Some(payout_token), Some(customer), _) => {
helpers::make_payout_method_data(
state,
req.payout_method_data.as_ref(),
Some(payout_token),
&customer.customer_id,
merchant_context.get_merchant_account().get_id(),
req.payout_type,
merchant_context.get_merchant_key_store(),
None,
merchant_context.get_merchant_account().storage_scheme,
)
.await
}
(_, Some(_), Some(payment_method)) => {
// Check if we have a stored transfer_method_id first
if payment_method
.get_common_mandate_reference()
.ok()
.and_then(|common_mandate_ref| common_mandate_ref.payouts)
.map(|payouts_mandate_ref| !payouts_mandate_ref.0.is_empty())
.unwrap_or(false)
{
Ok(None)
} else {
// No transfer_method_id available, proceed with vault fetch for raw card details
match get_pm_list_context(
state,
payment_method
.payment_method
.as_ref()
.get_required_value("payment_method_id")?,
merchant_context.get_merchant_key_store(),
payment_method,
None,
false,
true,
merchant_context,
)
.await?
{
Some(pm) => match (pm.card_details, pm.bank_transfer_details) {
(Some(card), _) => Ok(Some(payouts::PayoutMethodData::Card(
api_models::payouts::CardPayout {
card_number: card.card_number.get_required_value("card_number")?,
card_holder_name: card.card_holder_name,
expiry_month: card
.expiry_month
.get_required_value("expiry_month")?,
expiry_year: card.expiry_year.get_required_value("expiry_year")?,
},
))),
(_, Some(bank)) => Ok(Some(payouts::PayoutMethodData::Bank(bank))),
_ => Ok(None),
},
None => Ok(None),
}
}
}
_ => Ok(None),
}?;
Ok((
payout_id,
payout_method_data,
profile_id,
customer,
payment_method,
))
}
pub fn validate_payout_link_request(
req: &payouts::PayoutCreateRequest,
) -> Result<(), errors::ApiErrorResponse> {
if req.confirm.unwrap_or(false) {
return Err(errors::ApiErrorResponse::InvalidRequestData {
message: "cannot confirm a payout while creating a payout link".to_string(),
});
}
if req.customer_id.is_none() {
return Err(errors::ApiErrorResponse::MissingRequiredField {
field_name: "customer or customer_id when payout_link is true",
});
}
Ok(())
}
#[cfg(feature = "olap")]
pub(super) fn validate_payout_list_request(
req: &payouts::PayoutListConstraints,
) -> CustomResult<(), errors::ApiErrorResponse> {
use common_utils::consts::PAYOUTS_LIST_MAX_LIMIT_GET;
utils::when(
req.limit > PAYOUTS_LIST_MAX_LIMIT_GET || req.limit < 1,
|| {
Err(errors::ApiErrorResponse::InvalidRequestData {
message: format!("limit should be in between 1 and {PAYOUTS_LIST_MAX_LIMIT_GET}"),
})
},
)?;
Ok(())
}
#[cfg(feature = "olap")]
pub(super) fn validate_payout_list_request_for_joins(
limit: u32,
) -> CustomResult<(), errors::ApiErrorResponse> {
use common_utils::consts::PAYOUTS_LIST_MAX_LIMIT_POST;
utils::when(!(1..=PAYOUTS_LIST_MAX_LIMIT_POST).contains(&limit), || {
Err(errors::ApiErrorResponse::InvalidRequestData {
message: format!("limit should be in between 1 and {PAYOUTS_LIST_MAX_LIMIT_POST}"),
})
})?;
Ok(())
}
pub fn validate_payout_link_render_request_and_get_allowed_domains(
request_headers: &header::HeaderMap,
payout_link: &PayoutLink,
) -> RouterResult<HashSet<String>> {
let link_id = payout_link.link_id.to_owned();
let link_data = payout_link.link_data.to_owned();
let is_test_mode_enabled = link_data.test_mode.unwrap_or(false);
match (router_env_which(), is_test_mode_enabled) {
// Throw error in case test_mode was enabled in production
(Env::Production, true) => Err(report!(errors::ApiErrorResponse::LinkConfigurationError {
message: "test_mode cannot be true for rendering payout_links in production"
.to_string()
})),
// Skip all validations when test mode is enabled in non prod env
(_, true) => Ok(HashSet::new()),
// Otherwise, perform validations
(_, false) => {
// Fetch destination is "iframe"
match request_headers.get("sec-fetch-dest").and_then(|v| v.to_str().ok()) {
Some("iframe") => Ok(()),
Some(requestor) => Err(report!(errors::ApiErrorResponse::AccessForbidden {
resource: "payout_link".to_string(),
}))
.attach_printable_lazy(|| {
format!(
"Access to payout_link [{link_id}] is forbidden when requested through {requestor}",
)
}),
None => Err(report!(errors::ApiErrorResponse::AccessForbidden {
resource: "payout_link".to_string(),
}))
.attach_printable_lazy(|| {
format!(
"Access to payout_link [{link_id}] is forbidden when sec-fetch-dest is not present in request headers",
)
}),
}?;
// Validate origin / referer
let domain_in_req = {
let origin_or_referer = request_headers
.get("origin")
.or_else(|| request_headers.get("referer"))
.and_then(|v| v.to_str().ok())
.ok_or_else(|| {
report!(errors::ApiErrorResponse::AccessForbidden {
resource: "payout_link".to_string(),
})
})
.attach_printable_lazy(|| {
format!(
"Access to payout_link [{link_id}] is forbidden when origin or referer is not present in request headers",
)
})?;
let url = Url::parse(origin_or_referer)
.map_err(|_| {
report!(errors::ApiErrorResponse::AccessForbidden {
resource: "payout_link".to_string(),
})
})
.attach_printable_lazy(|| {
format!("Invalid URL found in request headers {origin_or_referer}")
})?;
url.host_str()
.and_then(|host| url.port().map(|port| format!("{host}:{port}")))
.or_else(|| url.host_str().map(String::from))
.ok_or_else(|| {
report!(errors::ApiErrorResponse::AccessForbidden {
resource: "payout_link".to_string(),
})
})
.attach_printable_lazy(|| {
format!("host or port not found in request headers {url:?}")
})?
};
if validate_domain_against_allowed_domains(
&domain_in_req,
link_data.allowed_domains.clone(),
) {
Ok(link_data.allowed_domains)
} else {
Err(report!(errors::ApiErrorResponse::AccessForbidden {
resource: "payout_link".to_string(),
}))
.attach_printable_lazy(|| {
format!(
"Access to payout_link [{link_id}] is forbidden from requestor - {domain_in_req}",
)
})
}
}
}
}
|
crates/router/src/core/payouts/validator.rs
|
router
|
full_file
| null | null | null | 3,270
| null | null | null | null | null | null | null |
// Implementation: impl api::Refund for for Breadpay
// File: crates/hyperswitch_connectors/src/connectors/breadpay.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::Refund for for Breadpay
|
crates/hyperswitch_connectors/src/connectors/breadpay.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 58
| null |
Breadpay
|
api::Refund for
| 0
| 0
| null | null |
// Implementation: impl api::PaymentsCompleteAuthorize for for Deutschebank
// File: crates/hyperswitch_connectors/src/connectors/deutschebank.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::PaymentsCompleteAuthorize for for Deutschebank
|
crates/hyperswitch_connectors/src/connectors/deutschebank.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 60
| null |
Deutschebank
|
api::PaymentsCompleteAuthorize for
| 0
| 0
| null | null |
// Struct: PaymentMethodMetadata
// File: crates/router/src/core/payment_methods/transformers.rs
// Module: router
// Implementations: 0
pub struct PaymentMethodMetadata
|
crates/router/src/core/payment_methods/transformers.rs
|
router
|
struct_definition
|
PaymentMethodMetadata
| 0
|
[] | 38
| null | null | null | null | null | null | null |
// Implementation: impl AccountsStorageInterface for for Store
// File: crates/router/src/db.rs
// Module: router
// Methods: 0 total (0 public)
impl AccountsStorageInterface for for Store
|
crates/router/src/db.rs
|
router
|
impl_block
| null | null | null | 42
| null |
Store
|
AccountsStorageInterface for
| 0
| 0
| null | null |
// Struct: NmiWebhookBody
// File: crates/hyperswitch_connectors/src/connectors/nmi/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct NmiWebhookBody
|
crates/hyperswitch_connectors/src/connectors/nmi/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
NmiWebhookBody
| 0
|
[] | 51
| null | null | null | null | null | null | null |
// Struct: ExternalVaultConnectorDetails
// File: crates/diesel_models/src/business_profile.rs
// Module: diesel_models
// Implementations: 0
pub struct ExternalVaultConnectorDetails
|
crates/diesel_models/src/business_profile.rs
|
diesel_models
|
struct_definition
|
ExternalVaultConnectorDetails
| 0
|
[] | 39
| null | null | null | null | null | null | null |
// Implementation: impl api::PaymentAuthorize for for Trustpay
// File: crates/hyperswitch_connectors/src/connectors/trustpay.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::PaymentAuthorize for for Trustpay
|
crates/hyperswitch_connectors/src/connectors/trustpay.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 58
| null |
Trustpay
|
api::PaymentAuthorize for
| 0
| 0
| null | null |
// Struct: Capture
// File: crates/hyperswitch_domain_models/src/router_flow_types/payments.rs
// Module: hyperswitch_domain_models
// Implementations: 0
pub struct Capture
|
crates/hyperswitch_domain_models/src/router_flow_types/payments.rs
|
hyperswitch_domain_models
|
struct_definition
|
Capture
| 0
|
[] | 41
| null | null | null | null | null | null | null |
// Struct: SilverflowCardData
// File: crates/hyperswitch_connectors/src/connectors/silverflow/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct SilverflowCardData
|
crates/hyperswitch_connectors/src/connectors/silverflow/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
SilverflowCardData
| 0
|
[] | 50
| null | null | null | null | null | null | null |
// Struct: KafkaFraudCheck
// File: crates/router/src/services/kafka/fraud_check.rs
// Module: router
// Implementations: 2
// Traits: super::KafkaMessage
pub struct KafkaFraudCheck<'a>
|
crates/router/src/services/kafka/fraud_check.rs
|
router
|
struct_definition
|
KafkaFraudCheck
| 2
|
[
"super::KafkaMessage"
] | 52
| null | null | null | null | null | null | null |
// Struct: OnboardingSurvey
// File: crates/api_models/src/user/dashboard_metadata.rs
// Module: api_models
// Implementations: 0
pub struct OnboardingSurvey
|
crates/api_models/src/user/dashboard_metadata.rs
|
api_models
|
struct_definition
|
OnboardingSurvey
| 0
|
[] | 37
| null | null | null | null | null | null | null |
// Implementation: impl ConnectorValidation for for Tesouro
// File: crates/hyperswitch_connectors/src/connectors/tesouro.rs
// Module: hyperswitch_connectors
// Methods: 2 total (0 public)
impl ConnectorValidation for for Tesouro
|
crates/hyperswitch_connectors/src/connectors/tesouro.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 54
| null |
Tesouro
|
ConnectorValidation for
| 2
| 0
| null | null |
// Struct: AVSDetails
// File: crates/hyperswitch_connectors/src/connectors/bambora/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct AVSDetails
|
crates/hyperswitch_connectors/src/connectors/bambora/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
AVSDetails
| 0
|
[] | 48
| null | null | null | null | null | null | null |
// Function: proxy_for_payments_core
// File: crates/router/src/core/payments.rs
// Module: router
pub fn proxy_for_payments_core<F, Res, Req, Op, FData, D>(
state: SessionState,
req_state: ReqState,
merchant_context: domain::MerchantContext,
profile_id: Option<id_type::ProfileId>,
operation: Op,
req: Req,
auth_flow: services::AuthFlow,
call_connector_action: CallConnectorAction,
header_payload: HeaderPayload,
return_raw_connector_response: Option<bool>,
) -> RouterResponse<Res>
where
F: Send + Clone + Sync,
FData: Send + Sync + Clone,
Op: Operation<F, Req, Data = D> + Send + Sync + Clone,
Req: Debug + Authenticate + Clone,
D: OperationSessionGetters<F> + OperationSessionSetters<F> + Send + Sync + Clone,
Res: transformers::ToResponse<F, D, Op>,
// To create connector flow specific interface data
D: ConstructFlowSpecificData<F, FData, router_types::PaymentsResponseData>,
RouterData<F, FData, router_types::PaymentsResponseData>: Feature<F, FData>,
// To construct connector flow specific api
dyn api::Connector:
services::api::ConnectorIntegration<F, FData, router_types::PaymentsResponseData>,
// To perform router related operation for PaymentResponse
PaymentResponse: Operation<F, FData, Data = D>,
|
crates/router/src/core/payments.rs
|
router
|
function_signature
| null | null | null | 324
|
proxy_for_payments_core
| null | null | null | null | null | null |
// File: crates/router/tests/connectors/redsys.rs
// Module: router
use hyperswitch_domain_models::payment_method_data::{Card, PaymentMethodData};
use masking::Secret;
use router::types::{self, api, storage::enums};
use test_utils::connector_auth;
use crate::utils::{self, ConnectorActions};
#[derive(Clone, Copy)]
struct RedsysTest;
impl ConnectorActions for RedsysTest {}
impl utils::Connector for RedsysTest {
fn get_data(&self) -> api::ConnectorData {
use router::connector::Redsys;
utils::construct_connector_data_old(
Box::new(Redsys::new()),
types::Connector::Plaid,
api::GetToken::Connector,
None,
)
}
fn get_auth_token(&self) -> types::ConnectorAuthType {
utils::to_connector_auth_type(
connector_auth::ConnectorAuthentication::new()
.redsys
.expect("Missing connector authentication configuration")
.into(),
)
}
fn get_name(&self) -> String {
"redsys".to_string()
}
}
static CONNECTOR: RedsysTest = RedsysTest {};
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
// Cards Positive Tests
// Creates a payment using the manual capture flow (Non 3DS).
#[actix_web::test]
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
// Captures a payment using the manual capture flow (Non 3DS).
#[actix_web::test]
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
// Partially captures a payment using the manual capture flow (Non 3DS).
#[actix_web::test]
async fn should_partially_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(
payment_method_details(),
Some(types::PaymentsCaptureData {
amount_to_capture: 50,
..utils::PaymentCaptureType::default().0
}),
get_default_payment_info(),
)
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
// Synchronizes a payment using the manual capture flow (Non 3DS).
#[actix_web::test]
async fn should_sync_authorized_payment() {
let authorize_response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
let txn_id = utils::get_connector_transaction_id(authorize_response.response);
let response = CONNECTOR
.psync_retry_till_status_matches(
enums::AttemptStatus::Authorized,
Some(types::PaymentsSyncData {
connector_transaction_id: types::ResponseId::ConnectorTransactionId(
txn_id.unwrap(),
),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("PSync response");
assert_eq!(response.status, enums::AttemptStatus::Authorized,);
}
// Voids a payment using the manual capture flow (Non 3DS).
#[actix_web::test]
async fn should_void_authorized_payment() {
let response = CONNECTOR
.authorize_and_void_payment(
payment_method_details(),
Some(types::PaymentsCancelData {
connector_transaction_id: String::from(""),
cancellation_reason: Some("requested_by_customer".to_string()),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("Void payment response");
assert_eq!(response.status, enums::AttemptStatus::Voided);
}
// Refunds a payment using the manual capture flow (Non 3DS).
#[actix_web::test]
async fn should_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
None,
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
response.response.unwrap().refund_status,
enums::RefundStatus::Success,
);
}
// Partially refunds a payment using the manual capture flow (Non 3DS).
#[actix_web::test]
async fn should_partially_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
Some(types::RefundsData {
refund_amount: 50,
..utils::PaymentRefundType::default().0
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
response.response.unwrap().refund_status,
enums::RefundStatus::Success,
);
}
// Synchronizes a refund using the manual capture flow (Non 3DS).
#[actix_web::test]
async fn should_sync_manually_captured_refund() {
let refund_response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
None,
get_default_payment_info(),
)
.await
.unwrap();
let response = CONNECTOR
.rsync_retry_till_status_matches(
enums::RefundStatus::Success,
refund_response.response.unwrap().connector_refund_id,
None,
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
response.response.unwrap().refund_status,
enums::RefundStatus::Success,
);
}
// Creates a payment using the automatic capture flow (Non 3DS).
#[actix_web::test]
async fn should_make_payment() {
let authorize_response = CONNECTOR
.make_payment(payment_method_details(), get_default_payment_info())
.await
.unwrap();
assert_eq!(authorize_response.status, enums::AttemptStatus::Charged);
}
// Synchronizes a payment using the automatic capture flow (Non 3DS).
#[actix_web::test]
async fn should_sync_auto_captured_payment() {
let authorize_response = CONNECTOR
.make_payment(payment_method_details(), get_default_payment_info())
.await
.unwrap();
assert_eq!(authorize_response.status, enums::AttemptStatus::Charged);
let txn_id = utils::get_connector_transaction_id(authorize_response.response);
assert_ne!(txn_id, None, "Empty connector transaction id");
let response = CONNECTOR
.psync_retry_till_status_matches(
enums::AttemptStatus::Charged,
Some(types::PaymentsSyncData {
connector_transaction_id: types::ResponseId::ConnectorTransactionId(
txn_id.unwrap(),
),
capture_method: Some(enums::CaptureMethod::Automatic),
..Default::default()
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(response.status, enums::AttemptStatus::Charged,);
}
// Refunds a payment using the automatic capture flow (Non 3DS).
#[actix_web::test]
async fn should_refund_auto_captured_payment() {
let response = CONNECTOR
.make_payment_and_refund(payment_method_details(), None, get_default_payment_info())
.await
.unwrap();
assert_eq!(
response.response.unwrap().refund_status,
enums::RefundStatus::Success,
);
}
// Partially refunds a payment using the automatic capture flow (Non 3DS).
#[actix_web::test]
async fn should_partially_refund_succeeded_payment() {
let refund_response = CONNECTOR
.make_payment_and_refund(
payment_method_details(),
Some(types::RefundsData {
refund_amount: 50,
..utils::PaymentRefundType::default().0
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
refund_response.response.unwrap().refund_status,
enums::RefundStatus::Success,
);
}
// Creates multiple refunds against a payment using the automatic capture flow (Non 3DS).
#[actix_web::test]
async fn should_refund_succeeded_payment_multiple_times() {
CONNECTOR
.make_payment_and_multiple_refund(
payment_method_details(),
Some(types::RefundsData {
refund_amount: 50,
..utils::PaymentRefundType::default().0
}),
get_default_payment_info(),
)
.await;
}
// Synchronizes a refund using the automatic capture flow (Non 3DS).
#[actix_web::test]
async fn should_sync_refund() {
let refund_response = CONNECTOR
.make_payment_and_refund(payment_method_details(), None, get_default_payment_info())
.await
.unwrap();
let response = CONNECTOR
.rsync_retry_till_status_matches(
enums::RefundStatus::Success,
refund_response.response.unwrap().connector_refund_id,
None,
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
response.response.unwrap().refund_status,
enums::RefundStatus::Success,
);
}
// Cards Negative scenarios
// Creates a payment with incorrect CVC.
#[actix_web::test]
async fn should_fail_payment_for_incorrect_cvc() {
let response = CONNECTOR
.make_payment(
Some(types::PaymentsAuthorizeData {
payment_method_data: PaymentMethodData::Card(Card {
card_cvc: Secret::new("12345".to_string()),
..utils::CCardType::default().0
}),
..utils::PaymentAuthorizeType::default().0
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
response.response.unwrap_err().message,
"Your card's security code is invalid.".to_string(),
);
}
// Creates a payment with incorrect expiry month.
#[actix_web::test]
async fn should_fail_payment_for_invalid_exp_month() {
let response = CONNECTOR
.make_payment(
Some(types::PaymentsAuthorizeData {
payment_method_data: PaymentMethodData::Card(Card {
card_exp_month: Secret::new("20".to_string()),
..utils::CCardType::default().0
}),
..utils::PaymentAuthorizeType::default().0
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
response.response.unwrap_err().message,
"Your card's expiration month is invalid.".to_string(),
);
}
// Creates a payment with incorrect expiry year.
#[actix_web::test]
async fn should_fail_payment_for_incorrect_expiry_year() {
let response = CONNECTOR
.make_payment(
Some(types::PaymentsAuthorizeData {
payment_method_data: PaymentMethodData::Card(Card {
card_exp_year: Secret::new("2000".to_string()),
..utils::CCardType::default().0
}),
..utils::PaymentAuthorizeType::default().0
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
response.response.unwrap_err().message,
"Your card's expiration year is invalid.".to_string(),
);
}
// Voids a payment using automatic capture flow (Non 3DS).
#[actix_web::test]
async fn should_fail_void_payment_for_auto_capture() {
let authorize_response = CONNECTOR
.make_payment(payment_method_details(), get_default_payment_info())
.await
.unwrap();
assert_eq!(authorize_response.status, enums::AttemptStatus::Charged);
let txn_id = utils::get_connector_transaction_id(authorize_response.response);
assert_ne!(txn_id, None, "Empty connector transaction id");
let void_response = CONNECTOR
.void_payment(txn_id.unwrap(), None, get_default_payment_info())
.await
.unwrap();
assert_eq!(
void_response.response.unwrap_err().message,
"You cannot cancel this PaymentIntent because it has a status of succeeded."
);
}
// Captures a payment using invalid connector payment id.
#[actix_web::test]
async fn should_fail_capture_for_invalid_payment() {
let capture_response = CONNECTOR
.capture_payment("123456789".to_string(), None, get_default_payment_info())
.await
.unwrap();
assert_eq!(
capture_response.response.unwrap_err().message,
String::from("No such payment_intent: '123456789'")
);
}
// Refunds a payment with refund amount higher than payment amount.
#[actix_web::test]
async fn should_fail_for_refund_amount_higher_than_payment_amount() {
let response = CONNECTOR
.make_payment_and_refund(
payment_method_details(),
Some(types::RefundsData {
refund_amount: 150,
..utils::PaymentRefundType::default().0
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
response.response.unwrap_err().message,
"Refund amount (₹1.50) is greater than charge amount (₹1.00)",
);
}
// Connector dependent test cases goes here
// [#478]: add unit tests for non 3DS, wallets & webhooks in connector tests
|
crates/router/tests/connectors/redsys.rs
|
router
|
full_file
| null | null | null | 2,931
| null | null | null | null | null | null | null |
// Implementation: impl api::Refund for for Checkout
// File: crates/hyperswitch_connectors/src/connectors/checkout.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::Refund for for Checkout
|
crates/hyperswitch_connectors/src/connectors/checkout.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 55
| null |
Checkout
|
api::Refund for
| 0
| 0
| null | null |
// Function: default_payments_list_limit
// File: crates/common_utils/src/consts.rs
// Module: common_utils
// Documentation: Default limit for payments list API
pub fn default_payments_list_limit() -> u32
|
crates/common_utils/src/consts.rs
|
common_utils
|
function_signature
| null | null | null | 46
|
default_payments_list_limit
| null | null | null | null | null | null |
// Function: get_revenue_recovery_attempt
// File: crates/router/src/core/webhooks/recovery_incoming.rs
// Module: router
pub fn get_revenue_recovery_attempt(
payment_intent: &domain_payments::PaymentIntent,
revenue_recovery_metadata: &api_payments::PaymentRevenueRecoveryMetadata,
billing_connector_account: &domain::MerchantConnectorAccount,
card_info: api_payments::AdditionalCardInfo,
payment_processor_token: &str,
) -> CustomResult<Self, errors::RevenueRecoveryError>
|
crates/router/src/core/webhooks/recovery_incoming.rs
|
router
|
function_signature
| null | null | null | 108
|
get_revenue_recovery_attempt
| null | null | null | null | null | null |
// Function: generate_jwt_auth_token_with_attributes
// File: crates/router/src/utils/user.rs
// Module: router
pub fn generate_jwt_auth_token_with_attributes(
state: &SessionState,
user_id: String,
merchant_id: id_type::MerchantId,
org_id: id_type::OrganizationId,
role_id: String,
profile_id: id_type::ProfileId,
tenant_id: Option<id_type::TenantId>,
) -> UserResult<Secret<String>>
|
crates/router/src/utils/user.rs
|
router
|
function_signature
| null | null | null | 103
|
generate_jwt_auth_token_with_attributes
| null | null | null | null | null | null |
// Struct: TokenioRouterData
// File: crates/hyperswitch_connectors/src/connectors/tokenio/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct TokenioRouterData<T>
|
crates/hyperswitch_connectors/src/connectors/tokenio/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
TokenioRouterData
| 0
|
[] | 51
| null | null | null | null | null | null | null |
// Function: apply
// File: crates/api_models/src/payment_methods.rs
// Module: api_models
pub fn apply(&self, card_data_from_locker: Card) -> CardDetail
|
crates/api_models/src/payment_methods.rs
|
api_models
|
function_signature
| null | null | null | 39
|
apply
| null | null | null | null | null | null |
// Struct: PaymentInitiation
// File: crates/hyperswitch_connectors/src/connectors/tokenio/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct PaymentInitiation
|
crates/hyperswitch_connectors/src/connectors/tokenio/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
PaymentInitiation
| 0
|
[] | 47
| null | null | null | null | null | null | null |
// Struct: StripeSplitPaymentRequest
// File: crates/common_types/src/payments.rs
// Module: common_types
// Implementations: 0
// Documentation: Fee information for Split Payments to be charged on the payment being collected for Stripe
pub struct StripeSplitPaymentRequest
|
crates/common_types/src/payments.rs
|
common_types
|
struct_definition
|
StripeSplitPaymentRequest
| 0
|
[] | 57
| null | null | null | null | null | null | null |
// Implementation: impl PayoutsNew
// File: crates/diesel_models/src/query/payouts.rs
// Module: diesel_models
// Methods: 1 total (0 public)
impl PayoutsNew
|
crates/diesel_models/src/query/payouts.rs
|
diesel_models
|
impl_block
| null | null | null | 44
| null |
PayoutsNew
| null | 1
| 0
| null | null |
// Function: open_router_config_default
// File: crates/api_models/src/routing.rs
// Module: api_models
pub fn open_router_config_default() -> Self
|
crates/api_models/src/routing.rs
|
api_models
|
function_signature
| null | null | null | 34
|
open_router_config_default
| null | null | null | null | null | null |
// Implementation: impl ConnectorCommon for for Plaid
// File: crates/pm_auth/src/connector/plaid.rs
// Module: pm_auth
// Methods: 5 total (0 public)
impl ConnectorCommon for for Plaid
|
crates/pm_auth/src/connector/plaid.rs
|
pm_auth
|
impl_block
| null | null | null | 47
| null |
Plaid
|
ConnectorCommon for
| 5
| 0
| null | null |
// File: crates/cards/tests/basic.rs
// Module: cards
#![allow(clippy::unwrap_used, clippy::expect_used)]
use cards::{CardExpiration, CardExpirationMonth, CardExpirationYear, CardSecurityCode};
use common_utils::date_time;
use masking::PeekInterface;
#[test]
fn test_card_security_code() {
// no panic
let valid_card_security_code = CardSecurityCode::try_from(1234).unwrap();
assert_eq!(*valid_card_security_code.peek(), 1234);
let serialized = serde_json::to_string(&valid_card_security_code).unwrap();
assert_eq!(serialized, "1234");
let derialized = serde_json::from_str::<CardSecurityCode>(&serialized).unwrap();
assert_eq!(*derialized.peek(), 1234);
let invalid_deserialization = serde_json::from_str::<CardSecurityCode>("00");
assert!(invalid_deserialization.is_err());
}
#[test]
fn test_card_expiration_month() {
// no panic
let card_exp_month = CardExpirationMonth::try_from(12).unwrap();
// will panic on unwrap
let invalid_card_exp_month = CardExpirationMonth::try_from(13);
assert_eq!(*card_exp_month.peek(), 12);
assert!(invalid_card_exp_month.is_err());
let serialized = serde_json::to_string(&card_exp_month).unwrap();
assert_eq!(serialized, "12");
let derialized = serde_json::from_str::<CardExpirationMonth>(&serialized).unwrap();
assert_eq!(*derialized.peek(), 12);
let invalid_deserialization = serde_json::from_str::<CardExpirationMonth>("13");
assert!(invalid_deserialization.is_err());
}
#[test]
fn test_card_expiration_year() {
let curr_date = date_time::now();
let curr_year = u16::try_from(curr_date.year()).expect("valid year");
// no panic
let card_exp_year = CardExpirationYear::try_from(curr_year).unwrap();
// will panic on unwrap
let invalid_card_exp_year = CardExpirationYear::try_from(curr_year - 1);
assert_eq!(*card_exp_year.peek(), curr_year);
assert!(invalid_card_exp_year.is_err());
let serialized = serde_json::to_string(&card_exp_year).unwrap();
assert_eq!(serialized, curr_year.to_string());
let derialized = serde_json::from_str::<CardExpirationYear>(&serialized).unwrap();
assert_eq!(*derialized.peek(), curr_year);
let invalid_deserialization = serde_json::from_str::<CardExpirationYear>("123");
assert!(invalid_deserialization.is_err());
}
#[test]
fn test_card_expiration() {
let curr_date = date_time::now();
let curr_year = u16::try_from(curr_date.year()).expect("valid year");
let curr_month = u8::from(curr_date.month());
// no panic
let card_exp = CardExpiration::try_from((curr_month, curr_year)).unwrap();
// will panic on unwrap
let invalid_card_exp = CardExpiration::try_from((13, curr_year));
assert_eq!(*card_exp.get_month().peek(), curr_month);
assert_eq!(*card_exp.get_year().peek(), curr_year);
assert!(!card_exp.is_expired().unwrap());
assert!(invalid_card_exp.is_err());
let serialized = serde_json::to_string(&card_exp).unwrap();
let expected_string = format!(r#"{{"month":{},"year":{}}}"#, 3, curr_year);
assert_eq!(serialized, expected_string);
let derialized = serde_json::from_str::<CardExpiration>(&serialized).unwrap();
assert_eq!(*derialized.get_month().peek(), 3);
assert_eq!(*derialized.get_year().peek(), curr_year);
let invalid_serialized_string = r#"{"month":13,"year":123}"#;
let invalid_deserialization = serde_json::from_str::<CardExpiration>(invalid_serialized_string);
assert!(invalid_deserialization.is_err());
}
|
crates/cards/tests/basic.rs
|
cards
|
full_file
| null | null | null | 878
| null | null | null | null | null | null | null |
// Function: create_grpc_request
// File: crates/external_services/src/grpc_client.rs
// Module: external_services
pub fn create_grpc_request<T: Debug>(message: T, headers: GrpcHeaders) -> tonic::Request<T>
|
crates/external_services/src/grpc_client.rs
|
external_services
|
function_signature
| null | null | null | 52
|
create_grpc_request
| null | null | null | null | null | null |
// Function: record_value
// File: crates/router_env/src/logger/storage.rs
// Module: router_env
pub fn record_value(&mut self, key: &'a str, value: serde_json::Value)
|
crates/router_env/src/logger/storage.rs
|
router_env
|
function_signature
| null | null | null | 44
|
record_value
| null | null | null | null | null | null |
// Function: dummy_connector_complete_payment
// File: crates/router/src/routes/dummy_connector.rs
// Module: router
pub fn dummy_connector_complete_payment(
state: web::Data<app::AppState>,
req: actix_web::HttpRequest,
path: web::Path<String>,
json_payload: web::Query<types::DummyConnectorPaymentCompleteBody>,
) -> impl actix_web::Responder
|
crates/router/src/routes/dummy_connector.rs
|
router
|
function_signature
| null | null | null | 84
|
dummy_connector_complete_payment
| null | null | null | null | null | null |
// Function: is_external_vault_enabled
// File: crates/hyperswitch_domain_models/src/business_profile.rs
// Module: hyperswitch_domain_models
pub fn is_external_vault_enabled(&self) -> bool
|
crates/hyperswitch_domain_models/src/business_profile.rs
|
hyperswitch_domain_models
|
function_signature
| null | null | null | 44
|
is_external_vault_enabled
| null | null | null | null | null | null |
// Struct: CardAdditionalData
// File: crates/common_utils/src/payout_method_utils.rs
// Module: common_utils
// Implementations: 0
pub struct CardAdditionalData
|
crates/common_utils/src/payout_method_utils.rs
|
common_utils
|
struct_definition
|
CardAdditionalData
| 0
|
[] | 38
| null | null | null | null | null | null | null |
// Struct: AffirmCaptureRequest
// File: crates/hyperswitch_connectors/src/connectors/affirm/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct AffirmCaptureRequest
|
crates/hyperswitch_connectors/src/connectors/affirm/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
AffirmCaptureRequest
| 0
|
[] | 50
| null | null | null | null | null | null | null |
// File: crates/hyperswitch_connectors/src/metrics.rs
// Module: hyperswitch_connectors
//! Metrics interface
use router_env::{counter_metric, global_meter};
global_meter!(GLOBAL_METER, "ROUTER_API");
counter_metric!(CONNECTOR_RESPONSE_DESERIALIZATION_FAILURE, GLOBAL_METER);
|
crates/hyperswitch_connectors/src/metrics.rs
|
hyperswitch_connectors
|
full_file
| null | null | null | 65
| null | null | null | null | null | null | null |
// Function: diesel_make_pg_pool
// File: crates/drainer/src/connection.rs
// Module: drainer
pub fn diesel_make_pg_pool(
database: &Database,
_test_transaction: bool,
schema: &str,
) -> PgPool
|
crates/drainer/src/connection.rs
|
drainer
|
function_signature
| null | null | null | 54
|
diesel_make_pg_pool
| null | null | null | null | null | null |
// Struct: AdyenplatformInstantStatus
// File: crates/hyperswitch_connectors/src/connectors/adyenplatform/transformers/payouts.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct AdyenplatformInstantStatus
|
crates/hyperswitch_connectors/src/connectors/adyenplatform/transformers/payouts.rs
|
hyperswitch_connectors
|
struct_definition
|
AdyenplatformInstantStatus
| 0
|
[] | 56
| null | null | null | null | null | null | null |
// Struct: ChangePasswordRequest
// File: crates/api_models/src/user.rs
// Module: api_models
// Implementations: 0
pub struct ChangePasswordRequest
|
crates/api_models/src/user.rs
|
api_models
|
struct_definition
|
ChangePasswordRequest
| 0
|
[] | 35
| null | null | null | null | null | null | null |
// Trait: KafkaMessage
// File: crates/router/src/services/kafka.rs
// Module: router
pub trait KafkaMessage
|
crates/router/src/services/kafka.rs
|
router
|
trait_definition
| null | null | null | 26
| null | null |
KafkaMessage
| null | null | null | null |
// Implementation: impl api::PaymentsCreateOrder for for Razorpay
// File: crates/hyperswitch_connectors/src/connectors/razorpay.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::PaymentsCreateOrder for for Razorpay
|
crates/hyperswitch_connectors/src/connectors/razorpay.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 61
| null |
Razorpay
|
api::PaymentsCreateOrder for
| 0
| 0
| null | null |
// Struct: RiskifiedWebhookBody
// File: crates/hyperswitch_connectors/src/connectors/riskified/transformers/api.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct RiskifiedWebhookBody
|
crates/hyperswitch_connectors/src/connectors/riskified/transformers/api.rs
|
hyperswitch_connectors
|
struct_definition
|
RiskifiedWebhookBody
| 0
|
[] | 53
| null | null | null | null | null | null | null |
// File: crates/storage_impl/src/payment_method.rs
// Module: storage_impl
pub use diesel_models::payment_method::PaymentMethod;
use crate::redis::kv_store::KvStorePartition;
impl KvStorePartition for PaymentMethod {}
use common_enums::enums::MerchantStorageScheme;
use common_utils::{errors::CustomResult, id_type, types::keymanager::KeyManagerState};
#[cfg(feature = "v1")]
use diesel_models::kv;
use diesel_models::payment_method::{PaymentMethodUpdate, PaymentMethodUpdateInternal};
use error_stack::ResultExt;
#[cfg(feature = "v1")]
use hyperswitch_domain_models::behaviour::ReverseConversion;
use hyperswitch_domain_models::{
behaviour::Conversion,
merchant_key_store::MerchantKeyStore,
payment_methods::{PaymentMethod as DomainPaymentMethod, PaymentMethodInterface},
};
use router_env::{instrument, tracing};
use super::MockDb;
use crate::{
diesel_error_to_data_error, errors,
kv_router_store::{FindResourceBy, KVRouterStore},
utils::{pg_connection_read, pg_connection_write},
DatabaseStore, RouterStore,
};
#[cfg(feature = "v1")]
use crate::{
kv_router_store::{FilterResourceParams, InsertResourceParams, UpdateResourceParams},
redis::kv_store::{Op, PartitionKey},
};
#[async_trait::async_trait]
impl<T: DatabaseStore> PaymentMethodInterface for KVRouterStore<T> {
type Error = errors::StorageError;
#[cfg(feature = "v1")]
#[instrument(skip_all)]
async fn find_payment_method(
&self,
state: &KeyManagerState,
key_store: &MerchantKeyStore,
payment_method_id: &str,
storage_scheme: MerchantStorageScheme,
) -> CustomResult<DomainPaymentMethod, errors::StorageError> {
let conn = pg_connection_read(self).await?;
self.find_resource_by_id(
state,
key_store,
storage_scheme,
PaymentMethod::find_by_payment_method_id(&conn, payment_method_id),
FindResourceBy::LookupId(format!("payment_method_{payment_method_id}")),
)
.await
}
#[cfg(feature = "v2")]
#[instrument(skip_all)]
async fn find_payment_method(
&self,
state: &KeyManagerState,
key_store: &MerchantKeyStore,
payment_method_id: &id_type::GlobalPaymentMethodId,
storage_scheme: MerchantStorageScheme,
) -> CustomResult<DomainPaymentMethod, errors::StorageError> {
let conn = pg_connection_read(self).await?;
self.find_resource_by_id(
state,
key_store,
storage_scheme,
PaymentMethod::find_by_id(&conn, payment_method_id),
FindResourceBy::LookupId(format!(
"payment_method_{}",
payment_method_id.get_string_repr()
)),
)
.await
}
#[cfg(feature = "v1")]
#[instrument(skip_all)]
async fn find_payment_method_by_locker_id(
&self,
state: &KeyManagerState,
key_store: &MerchantKeyStore,
locker_id: &str,
storage_scheme: MerchantStorageScheme,
) -> CustomResult<DomainPaymentMethod, errors::StorageError> {
let conn = pg_connection_read(self).await?;
self.find_resource_by_id(
state,
key_store,
storage_scheme,
PaymentMethod::find_by_locker_id(&conn, locker_id),
FindResourceBy::LookupId(format!("payment_method_locker_{locker_id}")),
)
.await
}
// not supported in kv
#[cfg(feature = "v1")]
#[instrument(skip_all)]
async fn get_payment_method_count_by_customer_id_merchant_id_status(
&self,
customer_id: &id_type::CustomerId,
merchant_id: &id_type::MerchantId,
status: common_enums::PaymentMethodStatus,
) -> CustomResult<i64, errors::StorageError> {
self.router_store
.get_payment_method_count_by_customer_id_merchant_id_status(
customer_id,
merchant_id,
status,
)
.await
}
#[instrument(skip_all)]
async fn get_payment_method_count_by_merchant_id_status(
&self,
merchant_id: &id_type::MerchantId,
status: common_enums::PaymentMethodStatus,
) -> CustomResult<i64, errors::StorageError> {
self.router_store
.get_payment_method_count_by_merchant_id_status(merchant_id, status)
.await
}
#[cfg(feature = "v2")]
#[instrument(skip_all)]
async fn insert_payment_method(
&self,
state: &KeyManagerState,
key_store: &MerchantKeyStore,
payment_method: DomainPaymentMethod,
storage_scheme: MerchantStorageScheme,
) -> CustomResult<DomainPaymentMethod, errors::StorageError> {
self.router_store
.insert_payment_method(state, key_store, payment_method, storage_scheme)
.await
}
#[cfg(feature = "v1")]
#[instrument(skip_all)]
async fn insert_payment_method(
&self,
state: &KeyManagerState,
key_store: &MerchantKeyStore,
payment_method: DomainPaymentMethod,
storage_scheme: MerchantStorageScheme,
) -> CustomResult<DomainPaymentMethod, errors::StorageError> {
let conn = pg_connection_write(self).await?;
let mut payment_method_new = payment_method
.construct_new()
.await
.change_context(errors::StorageError::DecryptionError)?;
payment_method_new.update_storage_scheme(storage_scheme);
let key = PartitionKey::MerchantIdCustomerId {
merchant_id: &payment_method_new.merchant_id.clone(),
customer_id: &payment_method_new.customer_id.clone(),
};
let identifier = format!("payment_method_id_{}", payment_method_new.get_id());
let lookup_id1 = format!("payment_method_{}", payment_method_new.get_id());
let mut reverse_lookups = vec![lookup_id1];
if let Some(locker_id) = &payment_method_new.locker_id {
reverse_lookups.push(format!("payment_method_locker_{locker_id}"))
}
let payment_method = (&payment_method_new.clone()).into();
self.insert_resource(
state,
key_store,
storage_scheme,
payment_method_new.clone().insert(&conn),
payment_method,
InsertResourceParams {
insertable: kv::Insertable::PaymentMethod(payment_method_new.clone()),
reverse_lookups,
key,
identifier,
resource_type: "payment_method",
},
)
.await
}
#[cfg(feature = "v1")]
#[instrument(skip_all)]
async fn update_payment_method(
&self,
state: &KeyManagerState,
key_store: &MerchantKeyStore,
payment_method: DomainPaymentMethod,
payment_method_update: PaymentMethodUpdate,
storage_scheme: MerchantStorageScheme,
) -> CustomResult<DomainPaymentMethod, errors::StorageError> {
let payment_method = Conversion::convert(payment_method)
.await
.change_context(errors::StorageError::DecryptionError)?;
let merchant_id = payment_method.merchant_id.clone();
let customer_id = payment_method.customer_id.clone();
let key = PartitionKey::MerchantIdCustomerId {
merchant_id: &merchant_id,
customer_id: &customer_id,
};
let conn = pg_connection_write(self).await?;
let field = format!("payment_method_id_{}", payment_method.get_id().clone());
let p_update: PaymentMethodUpdateInternal =
payment_method_update.convert_to_payment_method_update(storage_scheme);
let updated_payment_method = p_update.clone().apply_changeset(payment_method.clone());
self.update_resource(
state,
key_store,
storage_scheme,
payment_method
.clone()
.update_with_payment_method_id(&conn, p_update.clone()),
updated_payment_method,
UpdateResourceParams {
updateable: kv::Updateable::PaymentMethodUpdate(Box::new(
kv::PaymentMethodUpdateMems {
orig: payment_method.clone(),
update_data: p_update.clone(),
},
)),
operation: Op::Update(
key.clone(),
&field,
payment_method.clone().updated_by.as_deref(),
),
},
)
.await
}
#[cfg(feature = "v2")]
#[instrument(skip_all)]
async fn update_payment_method(
&self,
state: &KeyManagerState,
key_store: &MerchantKeyStore,
payment_method: DomainPaymentMethod,
payment_method_update: PaymentMethodUpdate,
storage_scheme: MerchantStorageScheme,
) -> CustomResult<DomainPaymentMethod, errors::StorageError> {
self.router_store
.update_payment_method(
state,
key_store,
payment_method,
payment_method_update,
storage_scheme,
)
.await
}
#[cfg(feature = "v1")]
#[instrument(skip_all)]
async fn find_payment_method_by_customer_id_merchant_id_list(
&self,
state: &KeyManagerState,
key_store: &MerchantKeyStore,
customer_id: &id_type::CustomerId,
merchant_id: &id_type::MerchantId,
limit: Option<i64>,
) -> CustomResult<Vec<DomainPaymentMethod>, errors::StorageError> {
self.router_store
.find_payment_method_by_customer_id_merchant_id_list(
state,
key_store,
customer_id,
merchant_id,
limit,
)
.await
}
#[cfg(feature = "v2")]
async fn find_payment_method_list_by_global_customer_id(
&self,
state: &KeyManagerState,
key_store: &MerchantKeyStore,
customer_id: &id_type::GlobalCustomerId,
limit: Option<i64>,
) -> CustomResult<Vec<DomainPaymentMethod>, errors::StorageError> {
self.router_store
.find_payment_method_list_by_global_customer_id(state, key_store, customer_id, limit)
.await
}
#[cfg(feature = "v1")]
#[instrument(skip_all)]
async fn find_payment_method_by_customer_id_merchant_id_status(
&self,
state: &KeyManagerState,
key_store: &MerchantKeyStore,
customer_id: &id_type::CustomerId,
merchant_id: &id_type::MerchantId,
status: common_enums::PaymentMethodStatus,
limit: Option<i64>,
storage_scheme: MerchantStorageScheme,
) -> CustomResult<Vec<DomainPaymentMethod>, errors::StorageError> {
let conn = pg_connection_read(self).await?;
self.filter_resources(
state,
key_store,
storage_scheme,
PaymentMethod::find_by_customer_id_merchant_id_status(
&conn,
customer_id,
merchant_id,
status,
limit,
),
|pm| pm.status == status,
FilterResourceParams {
key: PartitionKey::MerchantIdCustomerId {
merchant_id,
customer_id,
},
pattern: "payment_method_id_*",
limit,
},
)
.await
}
#[cfg(feature = "v2")]
#[instrument(skip_all)]
async fn find_payment_method_by_global_customer_id_merchant_id_status(
&self,
state: &KeyManagerState,
key_store: &MerchantKeyStore,
customer_id: &id_type::GlobalCustomerId,
merchant_id: &id_type::MerchantId,
status: common_enums::PaymentMethodStatus,
limit: Option<i64>,
storage_scheme: MerchantStorageScheme,
) -> CustomResult<Vec<DomainPaymentMethod>, errors::StorageError> {
self.router_store
.find_payment_method_by_global_customer_id_merchant_id_status(
state,
key_store,
customer_id,
merchant_id,
status,
limit,
storage_scheme,
)
.await
}
#[cfg(feature = "v1")]
async fn delete_payment_method_by_merchant_id_payment_method_id(
&self,
state: &KeyManagerState,
key_store: &MerchantKeyStore,
merchant_id: &id_type::MerchantId,
payment_method_id: &str,
) -> CustomResult<DomainPaymentMethod, errors::StorageError> {
self.router_store
.delete_payment_method_by_merchant_id_payment_method_id(
state,
key_store,
merchant_id,
payment_method_id,
)
.await
}
// Soft delete, Check if KV stuff is needed here
#[cfg(feature = "v2")]
async fn delete_payment_method(
&self,
state: &KeyManagerState,
key_store: &MerchantKeyStore,
payment_method: DomainPaymentMethod,
) -> CustomResult<DomainPaymentMethod, errors::StorageError> {
self.router_store
.delete_payment_method(state, key_store, payment_method)
.await
}
// Check if KV stuff is needed here
#[cfg(feature = "v2")]
async fn find_payment_method_by_fingerprint_id(
&self,
state: &KeyManagerState,
key_store: &MerchantKeyStore,
fingerprint_id: &str,
) -> CustomResult<DomainPaymentMethod, errors::StorageError> {
self.router_store
.find_payment_method_by_fingerprint_id(state, key_store, fingerprint_id)
.await
}
}
#[async_trait::async_trait]
impl<T: DatabaseStore> PaymentMethodInterface for RouterStore<T> {
type Error = errors::StorageError;
#[instrument(skip_all)]
#[cfg(feature = "v1")]
async fn find_payment_method(
&self,
state: &KeyManagerState,
key_store: &MerchantKeyStore,
payment_method_id: &str,
_storage_scheme: MerchantStorageScheme,
) -> CustomResult<DomainPaymentMethod, errors::StorageError> {
let conn = pg_connection_read(self).await?;
self.call_database(
state,
key_store,
PaymentMethod::find_by_payment_method_id(&conn, payment_method_id),
)
.await
}
#[cfg(feature = "v2")]
async fn find_payment_method(
&self,
state: &KeyManagerState,
key_store: &MerchantKeyStore,
payment_method_id: &id_type::GlobalPaymentMethodId,
_storage_scheme: MerchantStorageScheme,
) -> CustomResult<DomainPaymentMethod, errors::StorageError> {
let conn = pg_connection_read(self).await?;
self.call_database(
state,
key_store,
PaymentMethod::find_by_id(&conn, payment_method_id),
)
.await
}
#[cfg(feature = "v1")]
#[instrument(skip_all)]
async fn find_payment_method_by_locker_id(
&self,
state: &KeyManagerState,
key_store: &MerchantKeyStore,
locker_id: &str,
_storage_scheme: MerchantStorageScheme,
) -> CustomResult<DomainPaymentMethod, errors::StorageError> {
let conn = pg_connection_read(self).await?;
self.call_database(
state,
key_store,
PaymentMethod::find_by_locker_id(&conn, locker_id),
)
.await
}
#[cfg(feature = "v1")]
#[instrument(skip_all)]
async fn get_payment_method_count_by_customer_id_merchant_id_status(
&self,
customer_id: &id_type::CustomerId,
merchant_id: &id_type::MerchantId,
status: common_enums::PaymentMethodStatus,
) -> CustomResult<i64, errors::StorageError> {
let conn = pg_connection_read(self).await?;
PaymentMethod::get_count_by_customer_id_merchant_id_status(
&conn,
customer_id,
merchant_id,
status,
)
.await
.map_err(|error| {
let new_err = diesel_error_to_data_error(*error.current_context());
error.change_context(new_err)
})
}
#[instrument(skip_all)]
async fn get_payment_method_count_by_merchant_id_status(
&self,
merchant_id: &id_type::MerchantId,
status: common_enums::PaymentMethodStatus,
) -> CustomResult<i64, errors::StorageError> {
let conn = pg_connection_read(self).await?;
PaymentMethod::get_count_by_merchant_id_status(&conn, merchant_id, status)
.await
.map_err(|error| {
let new_err = diesel_error_to_data_error(*error.current_context());
error.change_context(new_err)
})
}
#[instrument(skip_all)]
async fn insert_payment_method(
&self,
state: &KeyManagerState,
key_store: &MerchantKeyStore,
payment_method: DomainPaymentMethod,
_storage_scheme: MerchantStorageScheme,
) -> CustomResult<DomainPaymentMethod, errors::StorageError> {
let payment_method_new = payment_method
.construct_new()
.await
.change_context(errors::StorageError::DecryptionError)?;
let conn = pg_connection_write(self).await?;
self.call_database(state, key_store, payment_method_new.insert(&conn))
.await
}
#[cfg(feature = "v1")]
#[instrument(skip_all)]
async fn update_payment_method(
&self,
state: &KeyManagerState,
key_store: &MerchantKeyStore,
payment_method: DomainPaymentMethod,
payment_method_update: PaymentMethodUpdate,
_storage_scheme: MerchantStorageScheme,
) -> CustomResult<DomainPaymentMethod, errors::StorageError> {
let payment_method = Conversion::convert(payment_method)
.await
.change_context(errors::StorageError::DecryptionError)?;
let conn = pg_connection_write(self).await?;
self.call_database(
state,
key_store,
payment_method.update_with_payment_method_id(&conn, payment_method_update.into()),
)
.await
}
#[cfg(feature = "v2")]
#[instrument(skip_all)]
async fn update_payment_method(
&self,
state: &KeyManagerState,
key_store: &MerchantKeyStore,
payment_method: DomainPaymentMethod,
payment_method_update: PaymentMethodUpdate,
_storage_scheme: MerchantStorageScheme,
) -> CustomResult<DomainPaymentMethod, errors::StorageError> {
let payment_method = Conversion::convert(payment_method)
.await
.change_context(errors::StorageError::DecryptionError)?;
let conn = pg_connection_write(self).await?;
self.call_database(
state,
key_store,
payment_method.update_with_id(&conn, payment_method_update.into()),
)
.await
}
#[cfg(feature = "v1")]
#[instrument(skip_all)]
async fn find_payment_method_by_customer_id_merchant_id_list(
&self,
state: &KeyManagerState,
key_store: &MerchantKeyStore,
customer_id: &id_type::CustomerId,
merchant_id: &id_type::MerchantId,
limit: Option<i64>,
) -> CustomResult<Vec<DomainPaymentMethod>, errors::StorageError> {
let conn = pg_connection_read(self).await?;
self.find_resources(
state,
key_store,
PaymentMethod::find_by_customer_id_merchant_id(&conn, customer_id, merchant_id, limit),
)
.await
}
// Need to fix this once we move to payment method for customer
#[cfg(feature = "v2")]
#[instrument(skip_all)]
async fn find_payment_method_list_by_global_customer_id(
&self,
state: &KeyManagerState,
key_store: &MerchantKeyStore,
id: &id_type::GlobalCustomerId,
limit: Option<i64>,
) -> CustomResult<Vec<DomainPaymentMethod>, errors::StorageError> {
let conn = pg_connection_read(self).await?;
self.find_resources(
state,
key_store,
PaymentMethod::find_by_global_customer_id(&conn, id, limit),
)
.await
}
#[cfg(feature = "v1")]
#[instrument(skip_all)]
async fn find_payment_method_by_customer_id_merchant_id_status(
&self,
state: &KeyManagerState,
key_store: &MerchantKeyStore,
customer_id: &id_type::CustomerId,
merchant_id: &id_type::MerchantId,
status: common_enums::PaymentMethodStatus,
limit: Option<i64>,
_storage_scheme: MerchantStorageScheme,
) -> CustomResult<Vec<DomainPaymentMethod>, errors::StorageError> {
let conn = pg_connection_read(self).await?;
self.find_resources(
state,
key_store,
PaymentMethod::find_by_customer_id_merchant_id_status(
&conn,
customer_id,
merchant_id,
status,
limit,
),
)
.await
}
#[cfg(feature = "v2")]
#[instrument(skip_all)]
async fn find_payment_method_by_global_customer_id_merchant_id_status(
&self,
state: &KeyManagerState,
key_store: &MerchantKeyStore,
customer_id: &id_type::GlobalCustomerId,
merchant_id: &id_type::MerchantId,
status: common_enums::PaymentMethodStatus,
limit: Option<i64>,
_storage_scheme: MerchantStorageScheme,
) -> CustomResult<Vec<DomainPaymentMethod>, errors::StorageError> {
let conn = pg_connection_read(self).await?;
self.find_resources(
state,
key_store,
PaymentMethod::find_by_global_customer_id_merchant_id_status(
&conn,
customer_id,
merchant_id,
status,
limit,
),
)
.await
}
#[cfg(feature = "v1")]
async fn delete_payment_method_by_merchant_id_payment_method_id(
&self,
state: &KeyManagerState,
key_store: &MerchantKeyStore,
merchant_id: &id_type::MerchantId,
payment_method_id: &str,
) -> CustomResult<DomainPaymentMethod, errors::StorageError> {
let conn = pg_connection_write(self).await?;
self.call_database(
state,
key_store,
PaymentMethod::delete_by_merchant_id_payment_method_id(
&conn,
merchant_id,
payment_method_id,
),
)
.await
}
#[cfg(feature = "v2")]
async fn delete_payment_method(
&self,
state: &KeyManagerState,
key_store: &MerchantKeyStore,
payment_method: DomainPaymentMethod,
) -> CustomResult<DomainPaymentMethod, errors::StorageError> {
let payment_method = Conversion::convert(payment_method)
.await
.change_context(errors::StorageError::DecryptionError)?;
let conn = pg_connection_write(self).await?;
let payment_method_update = PaymentMethodUpdate::StatusUpdate {
status: Some(common_enums::PaymentMethodStatus::Inactive),
};
self.call_database(
state,
key_store,
payment_method.update_with_id(&conn, payment_method_update.into()),
)
.await
}
#[cfg(feature = "v2")]
async fn find_payment_method_by_fingerprint_id(
&self,
state: &KeyManagerState,
key_store: &MerchantKeyStore,
fingerprint_id: &str,
) -> CustomResult<DomainPaymentMethod, errors::StorageError> {
let conn = pg_connection_read(self).await?;
self.call_database(
state,
key_store,
PaymentMethod::find_by_fingerprint_id(&conn, fingerprint_id),
)
.await
}
}
#[async_trait::async_trait]
impl PaymentMethodInterface for MockDb {
type Error = errors::StorageError;
#[cfg(feature = "v1")]
async fn find_payment_method(
&self,
state: &KeyManagerState,
key_store: &MerchantKeyStore,
payment_method_id: &str,
_storage_scheme: MerchantStorageScheme,
) -> CustomResult<DomainPaymentMethod, errors::StorageError> {
let payment_methods = self.payment_methods.lock().await;
self.get_resource::<PaymentMethod, _>(
state,
key_store,
payment_methods,
|pm| pm.get_id() == payment_method_id,
"cannot find payment method".to_string(),
)
.await
}
#[cfg(feature = "v2")]
async fn find_payment_method(
&self,
state: &KeyManagerState,
key_store: &MerchantKeyStore,
payment_method_id: &id_type::GlobalPaymentMethodId,
_storage_scheme: MerchantStorageScheme,
) -> CustomResult<DomainPaymentMethod, errors::StorageError> {
let payment_methods = self.payment_methods.lock().await;
self.get_resource::<PaymentMethod, _>(
state,
key_store,
payment_methods,
|pm| pm.get_id() == payment_method_id,
"cannot find payment method".to_string(),
)
.await
}
#[cfg(feature = "v1")]
async fn find_payment_method_by_locker_id(
&self,
state: &KeyManagerState,
key_store: &MerchantKeyStore,
locker_id: &str,
_storage_scheme: MerchantStorageScheme,
) -> CustomResult<DomainPaymentMethod, errors::StorageError> {
let payment_methods = self.payment_methods.lock().await;
self.get_resource::<PaymentMethod, _>(
state,
key_store,
payment_methods,
|pm| pm.locker_id == Some(locker_id.to_string()),
"cannot find payment method".to_string(),
)
.await
}
#[cfg(feature = "v1")]
async fn get_payment_method_count_by_customer_id_merchant_id_status(
&self,
customer_id: &id_type::CustomerId,
merchant_id: &id_type::MerchantId,
status: common_enums::PaymentMethodStatus,
) -> CustomResult<i64, errors::StorageError> {
let payment_methods = self.payment_methods.lock().await;
let count = payment_methods
.iter()
.filter(|pm| {
pm.customer_id == *customer_id
&& pm.merchant_id == *merchant_id
&& pm.status == status
})
.count();
i64::try_from(count).change_context(errors::StorageError::MockDbError)
}
async fn get_payment_method_count_by_merchant_id_status(
&self,
merchant_id: &id_type::MerchantId,
status: common_enums::PaymentMethodStatus,
) -> CustomResult<i64, errors::StorageError> {
let payment_methods = self.payment_methods.lock().await;
let count = payment_methods
.iter()
.filter(|pm| pm.merchant_id == *merchant_id && pm.status == status)
.count();
i64::try_from(count).change_context(errors::StorageError::MockDbError)
}
async fn insert_payment_method(
&self,
_state: &KeyManagerState,
_key_store: &MerchantKeyStore,
payment_method: DomainPaymentMethod,
_storage_scheme: MerchantStorageScheme,
) -> CustomResult<DomainPaymentMethod, errors::StorageError> {
let mut payment_methods = self.payment_methods.lock().await;
let pm = Conversion::convert(payment_method.clone())
.await
.change_context(errors::StorageError::DecryptionError)?;
payment_methods.push(pm);
Ok(payment_method)
}
#[cfg(feature = "v1")]
async fn find_payment_method_by_customer_id_merchant_id_list(
&self,
state: &KeyManagerState,
key_store: &MerchantKeyStore,
customer_id: &id_type::CustomerId,
merchant_id: &id_type::MerchantId,
_limit: Option<i64>,
) -> CustomResult<Vec<DomainPaymentMethod>, errors::StorageError> {
let payment_methods = self.payment_methods.lock().await;
self.get_resources(
state,
key_store,
payment_methods,
|pm| pm.customer_id == *customer_id && pm.merchant_id == *merchant_id,
"cannot find payment method".to_string(),
)
.await
}
// Need to fix this once we complete v2 payment method
#[cfg(feature = "v2")]
async fn find_payment_method_list_by_global_customer_id(
&self,
_state: &KeyManagerState,
_key_store: &MerchantKeyStore,
_id: &id_type::GlobalCustomerId,
_limit: Option<i64>,
) -> CustomResult<Vec<DomainPaymentMethod>, errors::StorageError> {
todo!()
}
#[cfg(feature = "v1")]
async fn find_payment_method_by_customer_id_merchant_id_status(
&self,
state: &KeyManagerState,
key_store: &MerchantKeyStore,
customer_id: &id_type::CustomerId,
merchant_id: &id_type::MerchantId,
status: common_enums::PaymentMethodStatus,
_limit: Option<i64>,
_storage_scheme: MerchantStorageScheme,
) -> CustomResult<Vec<DomainPaymentMethod>, errors::StorageError> {
let payment_methods = self.payment_methods.lock().await;
self.get_resources(
state,
key_store,
payment_methods,
|pm| {
pm.customer_id == *customer_id
&& pm.merchant_id == *merchant_id
&& pm.status == status
},
"cannot find payment method".to_string(),
)
.await
}
#[cfg(feature = "v2")]
async fn find_payment_method_by_global_customer_id_merchant_id_status(
&self,
state: &KeyManagerState,
key_store: &MerchantKeyStore,
customer_id: &id_type::GlobalCustomerId,
merchant_id: &id_type::MerchantId,
status: common_enums::PaymentMethodStatus,
_limit: Option<i64>,
_storage_scheme: MerchantStorageScheme,
) -> CustomResult<Vec<DomainPaymentMethod>, errors::StorageError> {
let payment_methods = self.payment_methods.lock().await;
let find_pm_by = |pm: &&PaymentMethod| {
pm.customer_id == *customer_id && pm.merchant_id == *merchant_id && pm.status == status
};
let error_message = "cannot find payment method".to_string();
self.get_resources(state, key_store, payment_methods, find_pm_by, error_message)
.await
}
#[cfg(feature = "v1")]
async fn delete_payment_method_by_merchant_id_payment_method_id(
&self,
state: &KeyManagerState,
key_store: &MerchantKeyStore,
merchant_id: &id_type::MerchantId,
payment_method_id: &str,
) -> CustomResult<DomainPaymentMethod, errors::StorageError> {
let mut payment_methods = self.payment_methods.lock().await;
match payment_methods
.iter()
.position(|pm| pm.merchant_id == *merchant_id && pm.get_id() == payment_method_id)
{
Some(index) => {
let deleted_payment_method = payment_methods.remove(index);
Ok(deleted_payment_method
.convert(
state,
key_store.key.get_inner(),
key_store.merchant_id.clone().into(),
)
.await
.change_context(errors::StorageError::DecryptionError)?)
}
None => Err(errors::StorageError::ValueNotFound(
"cannot find payment method to delete".to_string(),
)
.into()),
}
}
async fn update_payment_method(
&self,
state: &KeyManagerState,
key_store: &MerchantKeyStore,
payment_method: DomainPaymentMethod,
payment_method_update: PaymentMethodUpdate,
_storage_scheme: MerchantStorageScheme,
) -> CustomResult<DomainPaymentMethod, errors::StorageError> {
let payment_method_updated = PaymentMethodUpdateInternal::from(payment_method_update)
.apply_changeset(
Conversion::convert(payment_method.clone())
.await
.change_context(errors::StorageError::EncryptionError)?,
);
self.update_resource::<PaymentMethod, _>(
state,
key_store,
self.payment_methods.lock().await,
payment_method_updated,
|pm| pm.get_id() == payment_method.get_id(),
"cannot update payment method".to_string(),
)
.await
}
#[cfg(feature = "v2")]
async fn delete_payment_method(
&self,
state: &KeyManagerState,
key_store: &MerchantKeyStore,
payment_method: DomainPaymentMethod,
) -> CustomResult<DomainPaymentMethod, errors::StorageError> {
let payment_method_update = PaymentMethodUpdate::StatusUpdate {
status: Some(common_enums::PaymentMethodStatus::Inactive),
};
let payment_method_updated = PaymentMethodUpdateInternal::from(payment_method_update)
.apply_changeset(
Conversion::convert(payment_method.clone())
.await
.change_context(errors::StorageError::EncryptionError)?,
);
self.update_resource::<PaymentMethod, _>(
state,
key_store,
self.payment_methods.lock().await,
payment_method_updated,
|pm| pm.get_id() == payment_method.get_id(),
"cannot find payment method".to_string(),
)
.await
}
#[cfg(feature = "v2")]
async fn find_payment_method_by_fingerprint_id(
&self,
state: &KeyManagerState,
key_store: &MerchantKeyStore,
fingerprint_id: &str,
) -> CustomResult<DomainPaymentMethod, errors::StorageError> {
let payment_methods = self.payment_methods.lock().await;
self.get_resource::<PaymentMethod, _>(
state,
key_store,
payment_methods,
|pm| pm.locker_fingerprint_id == Some(fingerprint_id.to_string()),
"cannot find payment method".to_string(),
)
.await
}
}
|
crates/storage_impl/src/payment_method.rs
|
storage_impl
|
full_file
| null | null | null | 7,314
| null | null | null | null | null | null | null |
// Struct: VoltRefundRequest
// File: crates/hyperswitch_connectors/src/connectors/volt/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct VoltRefundRequest
|
crates/hyperswitch_connectors/src/connectors/volt/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
VoltRefundRequest
| 0
|
[] | 49
| null | null | null | null | null | null | null |
// Function: iter_mut
// File: crates/hyperswitch_constraint_graph/src/dense_map.rs
// Module: hyperswitch_constraint_graph
pub fn iter_mut(&mut self) -> IterMut<'_, K, V>
|
crates/hyperswitch_constraint_graph/src/dense_map.rs
|
hyperswitch_constraint_graph
|
function_signature
| null | null | null | 47
|
iter_mut
| null | null | null | null | null | null |
// Implementation: impl api::PaymentAuthorize for for Barclaycard
// File: crates/hyperswitch_connectors/src/connectors/barclaycard.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::PaymentAuthorize for for Barclaycard
|
crates/hyperswitch_connectors/src/connectors/barclaycard.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 61
| null |
Barclaycard
|
api::PaymentAuthorize for
| 0
| 0
| null | null |
// Implementation: impl Display for for InvalidFileStorageConfig
// File: crates/external_services/src/file_storage.rs
// Module: external_services
// Methods: 1 total (0 public)
impl Display for for InvalidFileStorageConfig
|
crates/external_services/src/file_storage.rs
|
external_services
|
impl_block
| null | null | null | 48
| null |
InvalidFileStorageConfig
|
Display for
| 1
| 0
| null | null |
// Struct: CheckoutShipping
// File: crates/hyperswitch_connectors/src/connectors/checkout/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct CheckoutShipping
|
crates/hyperswitch_connectors/src/connectors/checkout/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
CheckoutShipping
| 0
|
[] | 45
| null | null | null | null | null | null | null |
// Implementation: impl ApiErrorResponse
// File: crates/api_models/src/errors/types.rs
// Module: api_models
// Methods: 3 total (1 public)
impl ApiErrorResponse
|
crates/api_models/src/errors/types.rs
|
api_models
|
impl_block
| null | null | null | 37
| null |
ApiErrorResponse
| null | 3
| 1
| null | null |
// Struct: NoonApplePay
// File: crates/hyperswitch_connectors/src/connectors/noon/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct NoonApplePay
|
crates/hyperswitch_connectors/src/connectors/noon/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
NoonApplePay
| 0
|
[] | 47
| null | null | null | null | null | null | null |
// Struct: WellsfargoPaymentsRequest
// File: crates/hyperswitch_connectors/src/connectors/wellsfargo/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct WellsfargoPaymentsRequest
|
crates/hyperswitch_connectors/src/connectors/wellsfargo/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
WellsfargoPaymentsRequest
| 0
|
[] | 53
| null | null | null | null | null | null | null |
// Implementation: impl Itaubank
// File: crates/hyperswitch_connectors/src/connectors/itaubank.rs
// Module: hyperswitch_connectors
// Methods: 1 total (1 public)
impl Itaubank
|
crates/hyperswitch_connectors/src/connectors/itaubank.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 49
| null |
Itaubank
| null | 1
| 1
| null | null |
// Struct: BluecodeSyncResponse
// File: crates/hyperswitch_connectors/src/connectors/bluecode/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct BluecodeSyncResponse
|
crates/hyperswitch_connectors/src/connectors/bluecode/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
BluecodeSyncResponse
| 0
|
[] | 49
| null | null | null | null | null | null | null |
// Function: update_payment_method
// File: crates/router/src/core/payment_methods.rs
// Module: router
pub fn update_payment_method(
state: SessionState,
merchant_context: domain::MerchantContext,
profile: domain::Profile,
req: api::PaymentMethodUpdate,
payment_method_id: &id_type::GlobalPaymentMethodId,
) -> RouterResponse<api::PaymentMethodResponse>
|
crates/router/src/core/payment_methods.rs
|
router
|
function_signature
| null | null | null | 85
|
update_payment_method
| null | null | null | null | null | null |
// Implementation: impl api::PaymentsCompleteAuthorize for for Barclaycard
// File: crates/hyperswitch_connectors/src/connectors/barclaycard.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::PaymentsCompleteAuthorize for for Barclaycard
|
crates/hyperswitch_connectors/src/connectors/barclaycard.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 63
| null |
Barclaycard
|
api::PaymentsCompleteAuthorize for
| 0
| 0
| null | null |
// Struct: AtomeDetails
// File: crates/hyperswitch_connectors/src/connectors/airwallex/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct AtomeDetails
|
crates/hyperswitch_connectors/src/connectors/airwallex/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
AtomeDetails
| 0
|
[] | 49
| null | null | null | null | null | null | null |
// Struct: ActionLinks
// File: crates/hyperswitch_connectors/src/connectors/worldpay/response.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct ActionLinks
|
crates/hyperswitch_connectors/src/connectors/worldpay/response.rs
|
hyperswitch_connectors
|
struct_definition
|
ActionLinks
| 0
|
[] | 43
| null | null | null | null | null | null | null |
// Implementation: impl super::refunds::filters::RefundFilterAnalytics for for ClickhouseClient
// File: crates/analytics/src/clickhouse.rs
// Module: analytics
// Methods: 0 total (0 public)
impl super::refunds::filters::RefundFilterAnalytics for for ClickhouseClient
|
crates/analytics/src/clickhouse.rs
|
analytics
|
impl_block
| null | null | null | 65
| null |
ClickhouseClient
|
super::refunds::filters::RefundFilterAnalytics for
| 0
| 0
| null | null |
// Function: create_specific_dynamic_routing
// File: crates/router/src/core/routing.rs
// Module: router
pub fn create_specific_dynamic_routing(
state: SessionState,
merchant_context: domain::MerchantContext,
feature_to_enable: routing::DynamicRoutingFeatures,
profile_id: common_utils::id_type::ProfileId,
dynamic_routing_type: routing::DynamicRoutingType,
payload: routing_types::DynamicRoutingPayload,
) -> RouterResponse<routing_types::RoutingDictionaryRecord>
|
crates/router/src/core/routing.rs
|
router
|
function_signature
| null | null | null | 103
|
create_specific_dynamic_routing
| null | null | null | null | null | null |
// Implementation: impl Getnet
// File: crates/hyperswitch_connectors/src/connectors/getnet.rs
// Module: hyperswitch_connectors
// Methods: 1 total (1 public)
impl Getnet
|
crates/hyperswitch_connectors/src/connectors/getnet.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 45
| null |
Getnet
| null | 1
| 1
| null | null |
// Implementation: impl api::PaymentSession for for Noon
// File: crates/hyperswitch_connectors/src/connectors/noon.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::PaymentSession for for Noon
|
crates/hyperswitch_connectors/src/connectors/noon.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 55
| null |
Noon
|
api::PaymentSession for
| 0
| 0
| null | null |
// Struct: PlaidErrorResponse
// File: crates/pm_auth/src/connector/plaid/transformers.rs
// Module: pm_auth
// Implementations: 0
pub struct PlaidErrorResponse
|
crates/pm_auth/src/connector/plaid/transformers.rs
|
pm_auth
|
struct_definition
|
PlaidErrorResponse
| 0
|
[] | 41
| null | null | null | null | null | null | null |
// Implementation: impl api::RefundSync for for Taxjar
// File: crates/hyperswitch_connectors/src/connectors/taxjar.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::RefundSync for for Taxjar
|
crates/hyperswitch_connectors/src/connectors/taxjar.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 60
| null |
Taxjar
|
api::RefundSync for
| 0
| 0
| null | null |
// Struct: VgsAliasItem
// File: crates/hyperswitch_connectors/src/connectors/vgs/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct VgsAliasItem
|
crates/hyperswitch_connectors/src/connectors/vgs/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
VgsAliasItem
| 0
|
[] | 49
| null | null | null | null | null | null | null |
// Struct: GooglePayTokenizedCard
// File: crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct GooglePayTokenizedCard
|
crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
GooglePayTokenizedCard
| 0
|
[] | 53
| null | null | null | null | null | null | null |
// File: crates/hyperswitch_connectors/src/connectors/worldpayxml.rs
// Module: hyperswitch_connectors
// Public functions: 1
// Public structs: 1
pub mod transformers;
use std::sync::LazyLock;
use base64::Engine;
use common_utils::{
errors::CustomResult,
request::{Method, Request, RequestBuilder, RequestContent},
types::{AmountConvertor, StringMinorUnit, StringMinorUnitForConnector},
};
use error_stack::{report, ResultExt};
use hyperswitch_domain_models::{
payment_method_data::PaymentMethodData,
router_data::{AccessToken, ConnectorAuthType, ErrorResponse, RouterData},
router_flow_types::{
access_token_auth::AccessTokenAuth,
payments::{Authorize, Capture, 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, ConnectorCommonExt, ConnectorIntegration, ConnectorSpecifications,
ConnectorValidation,
},
configs::Connectors,
consts, errors,
events::connector_api_logs::ConnectorEvent,
types::{self, Response},
webhooks,
};
use masking::{ExposeInterface, Mask};
use transformers as worldpayxml;
use crate::{constants::headers, types::ResponseRouterData, utils};
#[derive(Clone)]
pub struct Worldpayxml {
amount_converter: &'static (dyn AmountConvertor<Output = StringMinorUnit> + Sync),
}
impl Worldpayxml {
pub fn new() -> &'static Self {
&Self {
amount_converter: &StringMinorUnitForConnector,
}
}
}
impl api::Payment for Worldpayxml {}
impl api::PaymentSession for Worldpayxml {}
impl api::ConnectorAccessToken for Worldpayxml {}
impl api::MandateSetup for Worldpayxml {}
impl api::PaymentAuthorize for Worldpayxml {}
impl api::PaymentSync for Worldpayxml {}
impl api::PaymentCapture for Worldpayxml {}
impl api::PaymentVoid for Worldpayxml {}
impl api::Refund for Worldpayxml {}
impl api::RefundExecute for Worldpayxml {}
impl api::RefundSync for Worldpayxml {}
impl api::PaymentToken for Worldpayxml {}
impl ConnectorIntegration<PaymentMethodToken, PaymentMethodTokenizationData, PaymentsResponseData>
for Worldpayxml
{
// Not Implemented (R)
}
impl<Flow, Request, Response> ConnectorCommonExt<Flow, Request, Response> for Worldpayxml
where
Self: ConnectorIntegration<Flow, Request, Response>,
{
fn build_headers(
&self,
req: &RouterData<Flow, Request, Response>,
_connectors: &Connectors,
) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
let mut header = vec![(
headers::CONTENT_TYPE.to_string(),
self.common_get_content_type().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 Worldpayxml {
fn id(&self) -> &'static str {
"worldpayxml"
}
fn get_currency_unit(&self) -> api::CurrencyUnit {
api::CurrencyUnit::Minor
}
fn common_get_content_type(&self) -> &'static str {
"text/xml"
}
fn base_url<'a>(&self, connectors: &'a Connectors) -> &'a str {
connectors.worldpayxml.base_url.as_ref()
}
fn get_auth_header(
&self,
auth_type: &ConnectorAuthType,
) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
let auth = worldpayxml::WorldpayxmlAuthType::try_from(auth_type)
.change_context(errors::ConnectorError::FailedToObtainAuthType)?;
let basic_auth_value = format!(
"Basic {}",
common_utils::consts::BASE64_ENGINE.encode(format!(
"{}:{}",
auth.api_username.expose(),
auth.api_password.expose()
))
);
Ok(vec![(
headers::AUTHORIZATION.to_string(),
Mask::into_masked(basic_auth_value),
)])
}
fn build_error_response(
&self,
res: Response,
event_builder: Option<&mut ConnectorEvent>,
) -> CustomResult<ErrorResponse, errors::ConnectorError> {
let response: Result<worldpayxml::PaymentService, _> =
utils::deserialize_xml_to_struct(&res.response);
match response {
Ok(response_data) => {
event_builder.map(|i| i.set_error_response_body(&response_data));
router_env::logger::info!(connector_response=?response_data);
let (error_code, error_msg) = response_data
.reply
.as_ref()
.and_then(|reply| {
reply
.error
.as_ref()
.map(|error| (Some(error.code.clone()), Some(error.message.clone())))
})
.unwrap_or((None, None));
Ok(ErrorResponse {
status_code: res.status_code,
code: error_code.unwrap_or(consts::NO_ERROR_CODE.to_string()),
message: error_msg
.clone()
.unwrap_or(consts::NO_ERROR_MESSAGE.to_string()),
reason: error_msg.clone(),
attempt_status: None,
connector_transaction_id: None,
network_advice_code: None,
network_decline_code: None,
network_error_message: None,
connector_metadata: None,
})
}
Err(error_msg) => {
event_builder.map(|event| event.set_error(serde_json::json!({"error": res.response.escape_ascii().to_string(), "status_code": res.status_code})));
router_env::logger::error!(deserialization_error =? error_msg);
utils::handle_json_response_deserialization_failure(res, "worldpayxml")
}
}
}
}
impl ConnectorValidation for Worldpayxml {
fn validate_mandate_payment(
&self,
_pm_type: Option<common_enums::PaymentMethodType>,
_pm_data: PaymentMethodData,
) -> CustomResult<(), errors::ConnectorError> {
Err(errors::ConnectorError::NotSupported {
message: "mandate payment".to_string(),
connector: "worldpayxml",
}
.into())
}
}
impl ConnectorIntegration<Session, PaymentsSessionData, PaymentsResponseData> for Worldpayxml {
//TODO: implement sessions flow
}
impl ConnectorIntegration<AccessTokenAuth, AccessTokenRequestData, AccessToken> for Worldpayxml {}
impl ConnectorIntegration<SetupMandate, SetupMandateRequestData, PaymentsResponseData>
for Worldpayxml
{
// Not Implemented (R)
fn build_request(
&self,
_req: &RouterData<SetupMandate, SetupMandateRequestData, PaymentsResponseData>,
_connectors: &Connectors,
) -> CustomResult<Option<Request>, errors::ConnectorError> {
Err(errors::ConnectorError::NotImplemented(
"Setup Mandate flow for Worldpayxml".to_string(),
)
.into())
}
}
impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData> for Worldpayxml {
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(self.base_url(connectors).to_owned())
}
fn get_request_body(
&self,
req: &PaymentsAuthorizeRouterData,
_connectors: &Connectors,
) -> CustomResult<RequestContent, errors::ConnectorError> {
let amount = utils::convert_amount(
self.amount_converter,
req.request.minor_amount,
req.request.currency,
)?;
let connector_router_data = worldpayxml::WorldpayxmlRouterData::from((amount, req));
let connector_req_object = worldpayxml::PaymentService::try_from(&connector_router_data)?;
let connector_req = utils::XmlSerializer::serialize_to_xml_bytes(
&connector_req_object,
worldpayxml::worldpayxml_constants::XML_VERSION,
Some(worldpayxml::worldpayxml_constants::XML_ENCODING),
None,
Some(worldpayxml::worldpayxml_constants::WORLDPAYXML_DOC_TYPE),
)?;
Ok(RequestContent::RawBytes(connector_req))
}
fn build_request(
&self,
req: &PaymentsAuthorizeRouterData,
connectors: &Connectors,
) -> CustomResult<Option<Request>, errors::ConnectorError> {
Ok(Some(
RequestBuilder::new()
.method(Method::Post)
.url(&types::PaymentsAuthorizeType::get_url(
self, req, connectors,
)?)
.attach_default_headers()
.headers(types::PaymentsAuthorizeType::get_headers(
self, req, connectors,
)?)
.set_body(types::PaymentsAuthorizeType::get_request_body(
self, req, connectors,
)?)
.build(),
))
}
fn handle_response(
&self,
data: &PaymentsAuthorizeRouterData,
event_builder: Option<&mut ConnectorEvent>,
res: Response,
) -> CustomResult<PaymentsAuthorizeRouterData, errors::ConnectorError> {
let response: worldpayxml::PaymentService =
utils::deserialize_xml_to_struct(&res.response)?;
event_builder.map(|i| i.set_response_body(&response));
router_env::logger::info!(connector_response=?response);
RouterData::try_from(ResponseRouterData {
response,
data: data.clone(),
http_code: res.status_code,
})
}
fn get_error_response(
&self,
res: Response,
event_builder: Option<&mut ConnectorEvent>,
) -> CustomResult<ErrorResponse, errors::ConnectorError> {
self.build_error_response(res, event_builder)
}
}
impl ConnectorIntegration<PSync, PaymentsSyncData, PaymentsResponseData> for Worldpayxml {
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> {
Ok(self.base_url(connectors).to_owned())
}
fn get_request_body(
&self,
req: &PaymentsSyncRouterData,
_connectors: &Connectors,
) -> CustomResult<RequestContent, errors::ConnectorError> {
let connector_req_object = worldpayxml::PaymentService::try_from(req)?;
let connector_req = utils::XmlSerializer::serialize_to_xml_bytes(
&connector_req_object,
worldpayxml::worldpayxml_constants::XML_VERSION,
Some(worldpayxml::worldpayxml_constants::XML_ENCODING),
None,
Some(worldpayxml::worldpayxml_constants::WORLDPAYXML_DOC_TYPE),
)?;
Ok(RequestContent::RawBytes(connector_req))
}
fn build_request(
&self,
req: &PaymentsSyncRouterData,
connectors: &Connectors,
) -> CustomResult<Option<Request>, errors::ConnectorError> {
Ok(Some(
RequestBuilder::new()
.method(Method::Post)
.url(&types::PaymentsSyncType::get_url(self, req, connectors)?)
.attach_default_headers()
.headers(types::PaymentsSyncType::get_headers(self, req, connectors)?)
.set_body(types::PaymentsSyncType::get_request_body(
self, req, connectors,
)?)
.build(),
))
}
fn handle_response(
&self,
data: &PaymentsSyncRouterData,
event_builder: Option<&mut ConnectorEvent>,
res: Response,
) -> CustomResult<PaymentsSyncRouterData, errors::ConnectorError> {
let response: worldpayxml::PaymentService =
utils::deserialize_xml_to_struct(&res.response)?;
event_builder.map(|i| i.set_response_body(&response));
router_env::logger::info!(connector_response=?response);
RouterData::try_from(ResponseRouterData {
response,
data: data.clone(),
http_code: res.status_code,
})
}
fn get_error_response(
&self,
res: Response,
event_builder: Option<&mut ConnectorEvent>,
) -> CustomResult<ErrorResponse, errors::ConnectorError> {
self.build_error_response(res, event_builder)
}
}
impl ConnectorIntegration<Capture, PaymentsCaptureData, PaymentsResponseData> for Worldpayxml {
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(self.base_url(connectors).to_owned())
}
fn get_request_body(
&self,
req: &PaymentsCaptureRouterData,
_connectors: &Connectors,
) -> CustomResult<RequestContent, errors::ConnectorError> {
let amount = utils::convert_amount(
self.amount_converter,
req.request.minor_amount_to_capture,
req.request.currency,
)?;
let connector_router_data = worldpayxml::WorldpayxmlRouterData::from((amount, req));
let connector_req_object = worldpayxml::PaymentService::try_from(&connector_router_data)?;
let connector_req = utils::XmlSerializer::serialize_to_xml_bytes(
&connector_req_object,
worldpayxml::worldpayxml_constants::XML_VERSION,
Some(worldpayxml::worldpayxml_constants::XML_ENCODING),
None,
Some(worldpayxml::worldpayxml_constants::WORLDPAYXML_DOC_TYPE),
)?;
Ok(RequestContent::RawBytes(connector_req))
}
fn build_request(
&self,
req: &PaymentsCaptureRouterData,
connectors: &Connectors,
) -> CustomResult<Option<Request>, errors::ConnectorError> {
Ok(Some(
RequestBuilder::new()
.method(Method::Post)
.url(&types::PaymentsCaptureType::get_url(self, req, connectors)?)
.attach_default_headers()
.headers(types::PaymentsCaptureType::get_headers(
self, req, connectors,
)?)
.set_body(types::PaymentsCaptureType::get_request_body(
self, req, connectors,
)?)
.build(),
))
}
fn handle_response(
&self,
data: &PaymentsCaptureRouterData,
event_builder: Option<&mut ConnectorEvent>,
res: Response,
) -> CustomResult<PaymentsCaptureRouterData, errors::ConnectorError> {
let response: worldpayxml::PaymentService =
utils::deserialize_xml_to_struct(&res.response)?;
event_builder.map(|i| i.set_response_body(&response));
router_env::logger::info!(connector_response=?response);
RouterData::try_from(ResponseRouterData {
response,
data: data.clone(),
http_code: res.status_code,
})
}
fn get_error_response(
&self,
res: Response,
event_builder: Option<&mut ConnectorEvent>,
) -> CustomResult<ErrorResponse, errors::ConnectorError> {
self.build_error_response(res, event_builder)
}
}
impl ConnectorIntegration<Void, PaymentsCancelData, PaymentsResponseData> for Worldpayxml {
fn get_headers(
&self,
req: &PaymentsCancelRouterData,
connectors: &Connectors,
) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
self.build_headers(req, connectors)
}
fn get_url(
&self,
_req: &PaymentsCancelRouterData,
connectors: &Connectors,
) -> CustomResult<String, errors::ConnectorError> {
Ok(self.base_url(connectors).to_owned())
}
fn get_content_type(&self) -> &'static str {
self.common_get_content_type()
}
fn get_request_body(
&self,
req: &PaymentsCancelRouterData,
_connectors: &Connectors,
) -> CustomResult<RequestContent, errors::ConnectorError> {
let connector_req_object = worldpayxml::PaymentService::try_from(req)?;
let connector_req = utils::XmlSerializer::serialize_to_xml_bytes(
&connector_req_object,
worldpayxml::worldpayxml_constants::XML_VERSION,
Some(worldpayxml::worldpayxml_constants::XML_ENCODING),
None,
Some(worldpayxml::worldpayxml_constants::WORLDPAYXML_DOC_TYPE),
)?;
Ok(RequestContent::RawBytes(connector_req))
}
fn build_request(
&self,
req: &PaymentsCancelRouterData,
connectors: &Connectors,
) -> CustomResult<Option<Request>, errors::ConnectorError> {
Ok(Some(
RequestBuilder::new()
.method(Method::Post)
.url(&types::PaymentsVoidType::get_url(self, req, connectors)?)
.attach_default_headers()
.headers(types::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: worldpayxml::PaymentService =
utils::deserialize_xml_to_struct(&res.response)?;
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<Execute, RefundsData, RefundsResponseData> for Worldpayxml {
fn get_headers(
&self,
req: &RefundsRouterData<Execute>,
connectors: &Connectors,
) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
self.build_headers(req, connectors)
}
fn get_content_type(&self) -> &'static str {
self.common_get_content_type()
}
fn get_url(
&self,
_req: &RefundsRouterData<Execute>,
connectors: &Connectors,
) -> CustomResult<String, errors::ConnectorError> {
Ok(self.base_url(connectors).to_owned())
}
fn get_request_body(
&self,
req: &RefundsRouterData<Execute>,
_connectors: &Connectors,
) -> CustomResult<RequestContent, errors::ConnectorError> {
let refund_amount = utils::convert_amount(
self.amount_converter,
req.request.minor_refund_amount,
req.request.currency,
)?;
let connector_router_data = worldpayxml::WorldpayxmlRouterData::from((refund_amount, req));
let connector_req_object = worldpayxml::PaymentService::try_from(&connector_router_data)?;
let connector_req = utils::XmlSerializer::serialize_to_xml_bytes(
&connector_req_object,
worldpayxml::worldpayxml_constants::XML_VERSION,
Some(worldpayxml::worldpayxml_constants::XML_ENCODING),
None,
Some(worldpayxml::worldpayxml_constants::WORLDPAYXML_DOC_TYPE),
)?;
Ok(RequestContent::RawBytes(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: worldpayxml::PaymentService =
utils::deserialize_xml_to_struct(&res.response)?;
event_builder.map(|i| i.set_response_body(&response));
router_env::logger::info!(connector_response=?response);
RouterData::try_from(ResponseRouterData {
response,
data: data.clone(),
http_code: res.status_code,
})
}
fn get_error_response(
&self,
res: Response,
event_builder: Option<&mut ConnectorEvent>,
) -> CustomResult<ErrorResponse, errors::ConnectorError> {
self.build_error_response(res, event_builder)
}
}
impl ConnectorIntegration<RSync, RefundsData, RefundsResponseData> for Worldpayxml {
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> {
Ok(self.base_url(connectors).to_owned())
}
fn get_request_body(
&self,
req: &RefundSyncRouterData,
_connectors: &Connectors,
) -> CustomResult<RequestContent, errors::ConnectorError> {
let connector_req_object = worldpayxml::PaymentService::try_from(req)?;
let connector_req = utils::XmlSerializer::serialize_to_xml_bytes(
&connector_req_object,
worldpayxml::worldpayxml_constants::XML_VERSION,
Some(worldpayxml::worldpayxml_constants::XML_ENCODING),
None,
Some(worldpayxml::worldpayxml_constants::WORLDPAYXML_DOC_TYPE),
)?;
Ok(RequestContent::RawBytes(connector_req))
}
fn build_request(
&self,
req: &RefundSyncRouterData,
connectors: &Connectors,
) -> CustomResult<Option<Request>, errors::ConnectorError> {
Ok(Some(
RequestBuilder::new()
.method(Method::Post)
.url(&types::RefundSyncType::get_url(self, req, connectors)?)
.attach_default_headers()
.headers(types::RefundSyncType::get_headers(self, req, connectors)?)
.set_body(types::RefundSyncType::get_request_body(
self, req, connectors,
)?)
.build(),
))
}
fn handle_response(
&self,
data: &RefundSyncRouterData,
event_builder: Option<&mut ConnectorEvent>,
res: Response,
) -> CustomResult<RefundSyncRouterData, errors::ConnectorError> {
let response: worldpayxml::PaymentService =
utils::deserialize_xml_to_struct(&res.response)?;
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)
}
}
#[async_trait::async_trait]
impl webhooks::IncomingWebhook for Worldpayxml {
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> {
Err(report!(errors::ConnectorError::WebhooksNotImplemented))
}
fn get_webhook_resource_object(
&self,
_request: &webhooks::IncomingWebhookRequestDetails<'_>,
) -> CustomResult<Box<dyn masking::ErasedMaskSerialize>, errors::ConnectorError> {
Err(report!(errors::ConnectorError::WebhooksNotImplemented))
}
}
static WORLDPAYXML_SUPPORTED_PAYMENT_METHODS: LazyLock<SupportedPaymentMethods> =
LazyLock::new(|| {
let supported_capture_methods = vec![
common_enums::CaptureMethod::Automatic,
common_enums::CaptureMethod::Manual,
common_enums::CaptureMethod::SequentialAutomatic,
];
let supported_card_network = vec![
common_enums::CardNetwork::AmericanExpress,
common_enums::CardNetwork::CartesBancaires,
common_enums::CardNetwork::DinersClub,
common_enums::CardNetwork::JCB,
common_enums::CardNetwork::Maestro,
common_enums::CardNetwork::Mastercard,
common_enums::CardNetwork::Visa,
];
let mut worldpayxml_supported_payment_methods = SupportedPaymentMethods::new();
worldpayxml_supported_payment_methods.add(
common_enums::PaymentMethod::Card,
common_enums::PaymentMethodType::Credit,
PaymentMethodDetails {
mandates: common_enums::FeatureStatus::NotSupported,
refunds: common_enums::FeatureStatus::Supported,
supported_capture_methods: supported_capture_methods.clone(),
specific_features: Some(
api_models::feature_matrix::PaymentMethodSpecificFeatures::Card({
api_models::feature_matrix::CardSpecificFeatures {
three_ds: common_enums::FeatureStatus::NotSupported,
no_three_ds: common_enums::FeatureStatus::Supported,
supported_card_networks: supported_card_network.clone(),
}
}),
),
},
);
worldpayxml_supported_payment_methods.add(
common_enums::PaymentMethod::Card,
common_enums::PaymentMethodType::Debit,
PaymentMethodDetails {
mandates: common_enums::FeatureStatus::NotSupported,
refunds: common_enums::FeatureStatus::Supported,
supported_capture_methods: supported_capture_methods.clone(),
specific_features: Some(
api_models::feature_matrix::PaymentMethodSpecificFeatures::Card({
api_models::feature_matrix::CardSpecificFeatures {
three_ds: common_enums::FeatureStatus::NotSupported,
no_three_ds: common_enums::FeatureStatus::Supported,
supported_card_networks: supported_card_network.clone(),
}
}),
),
},
);
worldpayxml_supported_payment_methods
});
static WORLDPAYXML_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo {
display_name: "Worldpay XML",
description: "Worldpay is a payment gateway and PSP enabling secure online transactions",
connector_type: common_enums::HyperswitchConnectorCategory::PaymentGateway,
integration_status: common_enums::ConnectorIntegrationStatus::Sandbox,
};
static WORLDPAYXML_SUPPORTED_WEBHOOK_FLOWS: [common_enums::EventClass; 0] = [];
impl ConnectorSpecifications for Worldpayxml {
fn get_connector_about(&self) -> Option<&'static ConnectorInfo> {
Some(&WORLDPAYXML_CONNECTOR_INFO)
}
fn get_supported_payment_methods(&self) -> Option<&'static SupportedPaymentMethods> {
Some(&*WORLDPAYXML_SUPPORTED_PAYMENT_METHODS)
}
fn get_supported_webhook_flows(&self) -> Option<&'static [common_enums::EventClass]> {
Some(&WORLDPAYXML_SUPPORTED_WEBHOOK_FLOWS)
}
}
|
crates/hyperswitch_connectors/src/connectors/worldpayxml.rs
|
hyperswitch_connectors
|
full_file
| null | null | null | 6,460
| null | null | null | null | null | null | null |
// Struct: JpmorganCancelRequest
// File: crates/hyperswitch_connectors/src/connectors/jpmorgan/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct JpmorganCancelRequest
|
crates/hyperswitch_connectors/src/connectors/jpmorgan/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
JpmorganCancelRequest
| 0
|
[] | 52
| null | null | null | null | null | null | null |
// Function: get_total_saved_payment_methods_for_merchant
// File: crates/router/src/core/payment_methods.rs
// Module: router
pub fn get_total_saved_payment_methods_for_merchant(
state: SessionState,
merchant_context: domain::MerchantContext,
) -> RouterResponse<api::TotalPaymentMethodCountResponse>
|
crates/router/src/core/payment_methods.rs
|
router
|
function_signature
| null | null | null | 67
|
get_total_saved_payment_methods_for_merchant
| null | null | null | null | null | null |
// Implementation: impl ConnectorCommon for for Mollie
// File: crates/hyperswitch_connectors/src/connectors/mollie.rs
// Module: hyperswitch_connectors
// Methods: 5 total (0 public)
impl ConnectorCommon for for Mollie
|
crates/hyperswitch_connectors/src/connectors/mollie.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 56
| null |
Mollie
|
ConnectorCommon for
| 5
| 0
| null | null |
// Implementation: impl api::PayoutsV2 for for Recurly
// File: crates/hyperswitch_connectors/src/connectors/recurly.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::PayoutsV2 for for Recurly
|
crates/hyperswitch_connectors/src/connectors/recurly.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 66
| null |
Recurly
|
api::PayoutsV2 for
| 0
| 0
| null | null |
// Struct: Error
// File: crates/hyperswitch_connectors/src/connectors/gocardless/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct Error
|
crates/hyperswitch_connectors/src/connectors/gocardless/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
Error
| 0
|
[] | 44
| null | null | null | null | null | null | null |
// Struct: CustomerRequest
// File: crates/api_models/src/customers.rs
// Module: api_models
// Implementations: 2
pub struct CustomerRequest
|
crates/api_models/src/customers.rs
|
api_models
|
struct_definition
|
CustomerRequest
| 2
|
[] | 34
| null | null | null | null | null | null | null |
// Implementation: impl SinglePurposeToken
// File: crates/router/src/services/authentication.rs
// Module: router
// Methods: 1 total (0 public)
impl SinglePurposeToken
|
crates/router/src/services/authentication.rs
|
router
|
impl_block
| null | null | null | 37
| null |
SinglePurposeToken
| null | 1
| 0
| null | null |
// Struct: DigitalvirgoPaymentSyncResponse
// File: crates/hyperswitch_connectors/src/connectors/digitalvirgo/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct DigitalvirgoPaymentSyncResponse
|
crates/hyperswitch_connectors/src/connectors/digitalvirgo/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
DigitalvirgoPaymentSyncResponse
| 0
|
[] | 55
| null | null | null | null | null | null | null |
// Function: from_payment_connectors_list
// File: crates/hyperswitch_domain_models/src/merchant_connector_account.rs
// Module: hyperswitch_domain_models
// Documentation: Retains the connector name and payment method in every flattened element
pub fn from_payment_connectors_list(payment_connectors: Vec<MerchantConnectorAccount>) -> Self
|
crates/hyperswitch_domain_models/src/merchant_connector_account.rs
|
hyperswitch_domain_models
|
function_signature
| null | null | null | 69
|
from_payment_connectors_list
| null | null | null | null | null | null |
common_enums::BankNames::BankiSpoldzielcze => Ok(Self::BankiSpoldzielcze),
common_enums::BankNames::PayWithInteligo => Ok(Self::PayWithInteligo),
common_enums::BankNames::BNPParibasPoland => Ok(Self::BNPParibasPoland),
common_enums::BankNames::BankNowySA => Ok(Self::BankNowySA),
common_enums::BankNames::CreditAgricole => Ok(Self::CreditAgricole),
common_enums::BankNames::PayWithBOS => Ok(Self::PayWithBOS),
common_enums::BankNames::PayWithCitiHandlowy => Ok(Self::PayWithCitiHandlowy),
common_enums::BankNames::PayWithPlusBank => Ok(Self::PayWithPlusBank),
common_enums::BankNames::ToyotaBank => Ok(Self::ToyotaBank),
common_enums::BankNames::VeloBank => Ok(Self::VeloBank),
common_enums::BankNames::ETransferPocztowy24 => Ok(Self::ETransferPocztowy24),
_ => Err(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message("Adyen"),
))?,
}
}
}
#[derive(Debug, Clone, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct OnlineBankingSlovakiaData {
issuer: OnlineBankingSlovakiaBanks,
}
#[derive(Debug, Clone, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct OnlineBankingFpxData {
issuer: OnlineBankingFpxIssuer,
}
#[derive(Debug, Clone, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct OnlineBankingThailandData {
issuer: OnlineBankingThailandIssuer,
}
#[derive(Debug, Clone, Serialize)]
pub struct OpenBankingUKData {
issuer: Option<OpenBankingUKIssuer>,
}
#[derive(Debug, Clone, Serialize)]
#[serde(rename_all = "lowercase")]
pub enum OnlineBankingSlovakiaBanks {
Vub,
Posto,
Sporo,
Tatra,
Viamo,
}
impl TryFrom<&common_enums::BankNames> for OnlineBankingSlovakiaBanks {
type Error = Error;
fn try_from(bank_name: &common_enums::BankNames) -> Result<Self, Self::Error> {
match bank_name {
common_enums::BankNames::EPlatbyVUB => Ok(Self::Vub),
common_enums::BankNames::PostovaBanka => Ok(Self::Posto),
common_enums::BankNames::SporoPay => Ok(Self::Sporo),
common_enums::BankNames::TatraPay => Ok(Self::Tatra),
common_enums::BankNames::Viamo => Ok(Self::Viamo),
_ => Err(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message("Adyen"),
))?,
}
}
}
impl TryFrom<&common_enums::BankNames> for OnlineBankingFpxIssuer {
type Error = Error;
fn try_from(bank_name: &common_enums::BankNames) -> Result<Self, Self::Error> {
match bank_name {
common_enums::BankNames::AffinBank => Ok(Self::FpxAbb),
common_enums::BankNames::AgroBank => Ok(Self::FpxAgrobank),
common_enums::BankNames::AllianceBank => Ok(Self::FpxAbmb),
common_enums::BankNames::AmBank => Ok(Self::FpxAmb),
common_enums::BankNames::BankIslam => Ok(Self::FpxBimb),
common_enums::BankNames::BankMuamalat => Ok(Self::FpxBmmb),
common_enums::BankNames::BankRakyat => Ok(Self::FpxBkrm),
common_enums::BankNames::BankSimpananNasional => Ok(Self::FpxBsn),
common_enums::BankNames::CimbBank => Ok(Self::FpxCimbclicks),
common_enums::BankNames::HongLeongBank => Ok(Self::FpxHlb),
common_enums::BankNames::HsbcBank => Ok(Self::FpxHsbc),
common_enums::BankNames::KuwaitFinanceHouse => Ok(Self::FpxKfh),
common_enums::BankNames::Maybank => Ok(Self::FpxMb2u),
common_enums::BankNames::OcbcBank => Ok(Self::FpxOcbc),
common_enums::BankNames::PublicBank => Ok(Self::FpxPbb),
common_enums::BankNames::RhbBank => Ok(Self::FpxRhb),
common_enums::BankNames::StandardCharteredBank => Ok(Self::FpxScb),
common_enums::BankNames::UobBank => Ok(Self::FpxUob),
_ => Err(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message("Adyen"),
))?,
}
}
}
impl TryFrom<&common_enums::BankNames> for OnlineBankingThailandIssuer {
type Error = Error;
fn try_from(bank_name: &common_enums::BankNames) -> Result<Self, Self::Error> {
match bank_name {
common_enums::BankNames::BangkokBank => Ok(Self::Bangkokbank),
common_enums::BankNames::KrungsriBank => Ok(Self::Krungsribank),
common_enums::BankNames::KrungThaiBank => Ok(Self::Krungthaibank),
common_enums::BankNames::TheSiamCommercialBank => Ok(Self::Siamcommercialbank),
common_enums::BankNames::KasikornBank => Ok(Self::Kbank),
_ => Err(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message("Adyen"),
))?,
}
}
}
impl TryFrom<&common_enums::BankNames> for OpenBankingUKIssuer {
type Error = Error;
fn try_from(bank_name: &common_enums::BankNames) -> Result<Self, Self::Error> {
match bank_name {
common_enums::BankNames::OpenBankSuccess => Ok(Self::RedirectSuccess),
common_enums::BankNames::OpenBankFailure => Ok(Self::RedirectFailure),
common_enums::BankNames::OpenBankCancelled => Ok(Self::RedirectCancelled),
common_enums::BankNames::Aib => Ok(Self::Aib),
common_enums::BankNames::BankOfScotland => Ok(Self::BankOfScotland),
common_enums::BankNames::Barclays => Ok(Self::Barclays),
common_enums::BankNames::DanskeBank => Ok(Self::DanskeBank),
common_enums::BankNames::FirstDirect => Ok(Self::FirstDirect),
common_enums::BankNames::FirstTrust => Ok(Self::FirstTrust),
common_enums::BankNames::HsbcBank => Ok(Self::HsbcBank),
common_enums::BankNames::Halifax => Ok(Self::Halifax),
common_enums::BankNames::Lloyds => Ok(Self::Lloyds),
common_enums::BankNames::Monzo => Ok(Self::Monzo),
common_enums::BankNames::NatWest => Ok(Self::NatWest),
common_enums::BankNames::NationwideBank => Ok(Self::NationwideBank),
common_enums::BankNames::Revolut => Ok(Self::Revolut),
common_enums::BankNames::RoyalBankOfScotland => Ok(Self::RoyalBankOfScotland),
common_enums::BankNames::SantanderPrzelew24 => Ok(Self::SantanderPrzelew24),
common_enums::BankNames::Starling => Ok(Self::Starling),
common_enums::BankNames::TsbBank => Ok(Self::TsbBank),
common_enums::BankNames::TescoBank => Ok(Self::TescoBank),
common_enums::BankNames::UlsterBank => Ok(Self::UlsterBank),
common_enums::BankNames::AmericanExpress
| common_enums::BankNames::AffinBank
| common_enums::BankNames::AgroBank
| common_enums::BankNames::AllianceBank
| common_enums::BankNames::AmBank
| common_enums::BankNames::BankOfAmerica
| common_enums::BankNames::BankOfChina
| common_enums::BankNames::BankIslam
| common_enums::BankNames::BankMuamalat
| common_enums::BankNames::BankRakyat
| common_enums::BankNames::BankSimpananNasional
| common_enums::BankNames::BlikPSP
| common_enums::BankNames::CapitalOne
| common_enums::BankNames::Chase
| common_enums::BankNames::Citi
| common_enums::BankNames::CimbBank
| common_enums::BankNames::Discover
| common_enums::BankNames::NavyFederalCreditUnion
| common_enums::BankNames::PentagonFederalCreditUnion
| common_enums::BankNames::SynchronyBank
| common_enums::BankNames::WellsFargo
| common_enums::BankNames::AbnAmro
| common_enums::BankNames::AsnBank
| common_enums::BankNames::Bunq
| common_enums::BankNames::Handelsbanken
| common_enums::BankNames::HongLeongBank
| common_enums::BankNames::Ing
| common_enums::BankNames::Knab
| common_enums::BankNames::KuwaitFinanceHouse
| common_enums::BankNames::Moneyou
| common_enums::BankNames::Rabobank
| common_enums::BankNames::Regiobank
| common_enums::BankNames::SnsBank
| common_enums::BankNames::TriodosBank
| common_enums::BankNames::VanLanschot
| common_enums::BankNames::ArzteUndApothekerBank
| common_enums::BankNames::AustrianAnadiBankAg
| common_enums::BankNames::BankAustria
| common_enums::BankNames::Bank99Ag
| common_enums::BankNames::BankhausCarlSpangler
| common_enums::BankNames::BankhausSchelhammerUndSchatteraAg
| common_enums::BankNames::BankMillennium
| common_enums::BankNames::BankPEKAOSA
| common_enums::BankNames::BawagPskAg
| common_enums::BankNames::BksBankAg
| common_enums::BankNames::BrullKallmusBankAg
| common_enums::BankNames::BtvVierLanderBank
| common_enums::BankNames::CapitalBankGraweGruppeAg
| common_enums::BankNames::CeskaSporitelna
| common_enums::BankNames::Dolomitenbank
| common_enums::BankNames::EasybankAg
| common_enums::BankNames::EPlatbyVUB
| common_enums::BankNames::ErsteBankUndSparkassen
| common_enums::BankNames::FrieslandBank
| common_enums::BankNames::HypoAlpeadriabankInternationalAg
| common_enums::BankNames::HypoNoeLbFurNiederosterreichUWien
| common_enums::BankNames::HypoOberosterreichSalzburgSteiermark
| common_enums::BankNames::HypoTirolBankAg
| common_enums::BankNames::HypoVorarlbergBankAg
| common_enums::BankNames::HypoBankBurgenlandAktiengesellschaft
| common_enums::BankNames::KomercniBanka
| common_enums::BankNames::MBank
| common_enums::BankNames::MarchfelderBank
| common_enums::BankNames::Maybank
| common_enums::BankNames::OberbankAg
| common_enums::BankNames::OsterreichischeArzteUndApothekerbank
| common_enums::BankNames::OcbcBank
| common_enums::BankNames::PayWithING
| common_enums::BankNames::PlaceZIPKO
| common_enums::BankNames::PlatnoscOnlineKartaPlatnicza
| common_enums::BankNames::PosojilnicaBankEGen
| common_enums::BankNames::PostovaBanka
| common_enums::BankNames::PublicBank
| common_enums::BankNames::RaiffeisenBankengruppeOsterreich
| common_enums::BankNames::RhbBank
| common_enums::BankNames::SchelhammerCapitalBankAg
| common_enums::BankNames::StandardCharteredBank
| common_enums::BankNames::SchoellerbankAg
| common_enums::BankNames::SpardaBankWien
| common_enums::BankNames::SporoPay
| common_enums::BankNames::TatraPay
| common_enums::BankNames::Viamo
| common_enums::BankNames::VolksbankGruppe
| common_enums::BankNames::VolkskreditbankAg
| common_enums::BankNames::VrBankBraunau
| common_enums::BankNames::UobBank
| common_enums::BankNames::PayWithAliorBank
| common_enums::BankNames::BankiSpoldzielcze
| common_enums::BankNames::PayWithInteligo
| common_enums::BankNames::BNPParibasPoland
| common_enums::BankNames::BankNowySA
| common_enums::BankNames::CreditAgricole
| common_enums::BankNames::PayWithBOS
| common_enums::BankNames::PayWithCitiHandlowy
| common_enums::BankNames::PayWithPlusBank
| common_enums::BankNames::ToyotaBank
| common_enums::BankNames::VeloBank
| common_enums::BankNames::ETransferPocztowy24
| common_enums::BankNames::PlusBank
| common_enums::BankNames::EtransferPocztowy24
| common_enums::BankNames::BankiSpbdzielcze
| common_enums::BankNames::BankNowyBfgSa
| common_enums::BankNames::GetinBank
| common_enums::BankNames::Blik
| common_enums::BankNames::NoblePay
| common_enums::BankNames::IdeaBank
| common_enums::BankNames::EnveloBank
| common_enums::BankNames::NestPrzelew
| common_enums::BankNames::MbankMtransfer
| common_enums::BankNames::Inteligo
| common_enums::BankNames::PbacZIpko
| common_enums::BankNames::BnpParibas
| common_enums::BankNames::BankPekaoSa
| common_enums::BankNames::VolkswagenBank
| common_enums::BankNames::AliorBank
| common_enums::BankNames::Boz
| common_enums::BankNames::BangkokBank
| common_enums::BankNames::KrungsriBank
| common_enums::BankNames::KrungThaiBank
| common_enums::BankNames::TheSiamCommercialBank
| common_enums::BankNames::Yoursafe
| common_enums::BankNames::N26
| common_enums::BankNames::NationaleNederlanden
| common_enums::BankNames::KasikornBank => {
Err(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message("Adyen"),
))?
}
}
}
}
#[derive(Debug, Clone, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct BlikRedirectionData {
blik_code: Secret<String>,
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct BankRedirectionWithIssuer<'a> {
issuer: Option<&'a str>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct AdyenMandate {
#[serde(rename = "type")]
payment_type: PaymentType,
stored_payment_method_id: Secret<String>,
holder_name: Option<Secret<String>>,
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct AdyenCard {
number: CardNumber,
expiry_month: Secret<String>,
expiry_year: Secret<String>,
cvc: Option<Secret<String>>,
holder_name: Option<Secret<String>>,
brand: Option<CardBrand>, //Mandatory for mandate using network_txns_id
network_payment_reference: Option<Secret<String>>,
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct AdyenPazeData {
number: NetworkTokenNumber,
expiry_month: Secret<String>,
expiry_year: Secret<String>,
cvc: Option<Secret<String>>,
holder_name: Option<Secret<String>>,
brand: Option<CardBrand>, //Mandatory for mandate using network_txns_id
network_payment_reference: Option<Secret<String>>,
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct AdyenApplePayDecryptData {
number: CardNumber,
expiry_month: Secret<String>,
expiry_year: Secret<String>,
brand: String,
#[serde(rename = "type")]
payment_type: PaymentType,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "lowercase")]
pub enum CardBrand {
Visa,
MC,
Amex,
Accel,
Argencard,
Bcmc,
Bijcard,
Cabal,
Cartebancaire,
Codensa,
Cup,
Dankort,
Diners,
Discover,
Electron,
Elo,
Forbrugsforeningen,
Hiper,
Hipercard,
Jcb,
Karenmillen,
Laser,
Maestro,
Maestrouk,
Mcalphabankbonus,
Mir,
Naranja,
Oasis,
Pulse,
Rupay,
Shopping,
Star,
Solo,
Troy,
Uatp,
Visaalphabankbonus,
Visadankort,
Nyce,
Warehouse,
}
#[derive(Default, Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct AdyenCancelRequest {
merchant_account: Secret<String>,
reference: String,
}
#[derive(Default, Debug, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct AdyenCancelResponse {
payment_psp_reference: String,
status: CancelStatus,
reference: String,
}
#[derive(Default, Debug, Deserialize, Serialize)]
#[serde(rename_all = "lowercase")]
pub enum CancelStatus {
Received,
#[default]
Processing,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct GoPayData {}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct KakaoPayData {}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct GcashData {}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct MomoData {}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct TouchNGoData {}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct AdyenGPay {
#[serde(rename = "googlePayToken")]
google_pay_token: Secret<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct AdyenApplePay {
#[serde(rename = "applePayToken")]
apple_pay_token: Secret<String>,
}
#[serde_with::skip_serializing_none]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct AdyenNetworkTokenData {
number: NetworkTokenNumber,
expiry_month: Secret<String>,
expiry_year: Secret<String>,
holder_name: Option<Secret<String>>,
brand: Option<CardBrand>, //Mandatory for mandate using network_txns_id
network_payment_reference: Option<Secret<String>>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct DokuBankData {
first_name: Secret<String>,
last_name: Option<Secret<String>>,
shopper_email: Email,
}
// Refunds Request and Response
#[serde_with::skip_serializing_none]
#[derive(Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct AdyenRefundRequest {
merchant_account: Secret<String>,
amount: Amount,
merchant_refund_reason: Option<AdyenRefundRequestReason>,
reference: String,
splits: Option<Vec<AdyenSplitData>>,
store: Option<String>,
}
#[derive(Debug, Serialize, Deserialize)]
pub enum AdyenRefundRequestReason {
FRAUD,
#[serde(rename = "CUSTOMER REQUEST")]
CUSTOMERREQUEST,
RETURN,
DUPLICATE,
OTHER,
}
impl FromStr for AdyenRefundRequestReason {
type Err = error_stack::Report<errors::ConnectorError>;
fn from_str(s: &str) -> Result<Self, Self::Err> {
match s.to_uppercase().as_str() {
"FRAUD" => Ok(Self::FRAUD),
"CUSTOMER REQUEST" | "CUSTOMERREQUEST" => Ok(Self::CUSTOMERREQUEST),
"RETURN" => Ok(Self::RETURN),
"DUPLICATE" => Ok(Self::DUPLICATE),
"OTHER" => Ok(Self::OTHER),
_ => Ok(Self::OTHER),
}
}
}
#[derive(Default, Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct AdyenRefundResponse {
merchant_account: Secret<String>,
psp_reference: String,
payment_psp_reference: String,
reference: String,
status: String,
}
pub struct AdyenAuthType {
pub(super) api_key: Secret<String>,
pub(super) merchant_account: Secret<String>,
#[allow(dead_code)]
pub(super) review_key: Option<Secret<String>>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "lowercase")]
pub enum PaymentType {
Affirm,
Afterpaytouch,
Alipay,
#[serde(rename = "alipay_hk")]
AlipayHk,
#[serde(rename = "doku_alfamart")]
Alfamart,
Alma,
Applepay,
Bizum,
Atome,
Blik,
#[serde(rename = "boletobancario")]
BoletoBancario,
ClearPay,
Dana,
Eps,
Gcash,
Googlepay,
#[serde(rename = "gopay_wallet")]
GoPay,
Ideal,
#[serde(rename = "doku_indomaret")]
Indomaret,
Klarna,
Kakaopay,
Mbway,
MobilePay,
#[serde(rename = "momo_wallet")]
Momo,
#[serde(rename = "momo_atm")]
MomoAtm,
#[serde(rename = "onlineBanking_CZ")]
OnlineBankingCzechRepublic,
#[serde(rename = "ebanking_FI")]
OnlineBankingFinland,
#[serde(rename = "onlineBanking_PL")]
OnlineBankingPoland,
#[serde(rename = "onlineBanking_SK")]
OnlineBankingSlovakia,
#[serde(rename = "molpay_ebanking_fpx_MY")]
OnlineBankingFpx,
#[serde(rename = "molpay_ebanking_TH")]
OnlineBankingThailand,
#[serde(rename = "paybybank")]
OpenBankingUK,
#[serde(rename = "oxxo")]
Oxxo,
#[serde(rename = "paysafecard")]
PaySafeCard,
PayBright,
Paypal,
Scheme,
#[serde(rename = "networkToken")]
NetworkToken,
#[serde(rename = "trustly")]
Trustly,
#[serde(rename = "touchngo")]
TouchNGo,
Walley,
#[serde(rename = "wechatpayWeb")]
WeChatPayWeb,
#[serde(rename = "ach")]
AchDirectDebit,
SepaDirectDebit,
#[serde(rename = "directdebit_GB")]
BacsDirectDebit,
Samsungpay,
Twint,
Vipps,
Giftcard,
Knet,
Benefit,
Swish,
#[serde(rename = "doku_permata_lite_atm")]
PermataBankTransfer,
#[serde(rename = "doku_bca_va")]
BcaBankTransfer,
#[serde(rename = "doku_bni_va")]
BniVa,
#[serde(rename = "doku_bri_va")]
BriVa,
#[serde(rename = "doku_cimb_va")]
CimbVa,
#[serde(rename = "doku_danamon_va")]
DanamonVa,
#[serde(rename = "doku_mandiri_va")]
MandiriVa,
#[serde(rename = "econtext_seven_eleven")]
SevenEleven,
#[serde(rename = "econtext_stores")]
JapaneseConvenienceStores,
Pix,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "lowercase")]
pub enum GiftCardBrand {
Givex,
Auriga,
Babygiftcard,
}
#[derive(Debug, Eq, PartialEq, Serialize, Clone)]
#[serde(rename_all = "snake_case")]
pub enum OnlineBankingFpxIssuer {
FpxAbb,
FpxAgrobank,
FpxAbmb,
FpxAmb,
FpxBimb,
FpxBmmb,
FpxBkrm,
FpxBsn,
FpxCimbclicks,
FpxHlb,
FpxHsbc,
FpxKfh,
FpxMb2u,
FpxOcbc,
FpxPbb,
FpxRhb,
FpxScb,
FpxUob,
}
#[derive(Debug, Eq, PartialEq, Serialize, Clone)]
pub enum OnlineBankingThailandIssuer {
#[serde(rename = "molpay_bangkokbank")]
Bangkokbank,
#[serde(rename = "molpay_krungsribank")]
Krungsribank,
#[serde(rename = "molpay_krungthaibank")]
Krungthaibank,
#[serde(rename = "molpay_siamcommercialbank")]
Siamcommercialbank,
#[serde(rename = "molpay_kbank")]
Kbank,
}
#[derive(Debug, Eq, PartialEq, Serialize, Clone)]
pub enum OpenBankingUKIssuer {
#[serde(rename = "uk-test-open-banking-redirect")]
RedirectSuccess,
#[serde(rename = "uk-test-open-banking-redirect-failed")]
RedirectFailure,
#[serde(rename = "uk-test-open-banking-redirect-cancelled")]
RedirectCancelled,
#[serde(rename = "uk-aib-oauth2")]
Aib,
#[serde(rename = "uk-bankofscotland-oauth2")]
BankOfScotland,
#[serde(rename = "uk-barclays-oauth2")]
Barclays,
#[serde(rename = "uk-danskebank-oauth2")]
DanskeBank,
#[serde(rename = "uk-firstdirect-oauth2")]
FirstDirect,
#[serde(rename = "uk-firsttrust-oauth2")]
FirstTrust,
#[serde(rename = "uk-hsbc-oauth2")]
HsbcBank,
#[serde(rename = "uk-halifax-oauth2")]
Halifax,
#[serde(rename = "uk-lloyds-oauth2")]
Lloyds,
#[serde(rename = "uk-monzo-oauth2")]
Monzo,
#[serde(rename = "uk-natwest-oauth2")]
NatWest,
#[serde(rename = "uk-nationwide-oauth2")]
NationwideBank,
#[serde(rename = "uk-revolut-oauth2")]
Revolut,
#[serde(rename = "uk-rbs-oauth2")]
RoyalBankOfScotland,
#[serde(rename = "uk-santander-oauth2")]
SantanderPrzelew24,
#[serde(rename = "uk-starling-oauth2")]
Starling,
#[serde(rename = "uk-tsb-oauth2")]
TsbBank,
#[serde(rename = "uk-tesco-oauth2")]
TescoBank,
#[serde(rename = "uk-ulster-oauth2")]
UlsterBank,
}
pub struct AdyenTestBankNames<'a>(&'a str);
impl TryFrom<&common_enums::BankNames> for AdyenTestBankNames<'_> {
type Error = Error;
fn try_from(bank: &common_enums::BankNames) -> Result<Self, Self::Error> {
Ok(match bank {
common_enums::BankNames::AbnAmro => Self("1121"),
common_enums::BankNames::AsnBank => Self("1151"),
common_enums::BankNames::Bunq => Self("1152"),
common_enums::BankNames::Ing => Self("1154"),
common_enums::BankNames::Knab => Self("1155"),
common_enums::BankNames::N26 => Self("1156"),
common_enums::BankNames::NationaleNederlanden => Self("1157"),
common_enums::BankNames::Rabobank => Self("1157"),
common_enums::BankNames::Regiobank => Self("1158"),
common_enums::BankNames::Revolut => Self("1159"),
common_enums::BankNames::SnsBank => Self("1159"),
common_enums::BankNames::TriodosBank => Self("1159"),
common_enums::BankNames::VanLanschot => Self("1159"),
common_enums::BankNames::Yoursafe => Self("1159"),
common_enums::BankNames::BankAustria => Self("e6819e7a-f663-414b-92ec-cf7c82d2f4e5"),
common_enums::BankNames::BawagPskAg => Self("ba7199cc-f057-42f2-9856-2378abf21638"),
common_enums::BankNames::Dolomitenbank => Self("d5d5b133-1c0d-4c08-b2be-3c9b116dc326"),
common_enums::BankNames::EasybankAg => Self("eff103e6-843d-48b7-a6e6-fbd88f511b11"),
common_enums::BankNames::ErsteBankUndSparkassen => {
Self("3fdc41fc-3d3d-4ee3-a1fe-cd79cfd58ea3")
}
common_enums::BankNames::HypoTirolBankAg => {
Self("6765e225-a0dc-4481-9666-e26303d4f221")
}
common_enums::BankNames::PosojilnicaBankEGen => {
Self("65ef4682-4944-499f-828f-5d74ad288376")
}
common_enums::BankNames::RaiffeisenBankengruppeOsterreich => {
Self("ee9fc487-ebe0-486c-8101-17dce5141a67")
}
common_enums::BankNames::SchoellerbankAg => {
Self("1190c4d1-b37a-487e-9355-e0a067f54a9f")
}
common_enums::BankNames::SpardaBankWien => Self("8b0bfeea-fbb0-4337-b3a1-0e25c0f060fc"),
common_enums::BankNames::VolksbankGruppe => {
Self("e2e97aaa-de4c-4e18-9431-d99790773433")
}
common_enums::BankNames::VolkskreditbankAg => {
Self("4a0a975b-0594-4b40-9068-39f77b3a91f9")
}
_ => Err(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message("Adyen"),
))?,
})
}
}
impl TryFrom<&ConnectorAuthType> for AdyenAuthType {
type Error = Error;
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_account: key1.to_owned(),
review_key: None,
}),
ConnectorAuthType::SignatureKey {
api_key,
key1,
api_secret,
} => Ok(Self {
api_key: api_key.to_owned(),
merchant_account: key1.to_owned(),
review_key: Some(api_secret.to_owned()),
}),
_ => Err(errors::ConnectorError::FailedToObtainAuthType)?,
}
}
}
impl TryFrom<&AdyenRouterData<&PaymentsAuthorizeRouterData>> for AdyenPaymentRequest<'_> {
type Error = Error;
fn try_from(item: &AdyenRouterData<&PaymentsAuthorizeRouterData>) -> Result<Self, Self::Error> {
match item
.router_data
.request
.mandate_id
.to_owned()
.and_then(|mandate_ids| mandate_ids.mandate_reference_id)
{
Some(mandate_ref) => AdyenPaymentRequest::try_from((item, mandate_ref)),
None => match item.router_data.request.payment_method_data {
PaymentMethodData::Card(ref card) => AdyenPaymentRequest::try_from((item, card)),
PaymentMethodData::Wallet(ref wallet) => {
AdyenPaymentRequest::try_from((item, wallet))
}
PaymentMethodData::PayLater(ref pay_later) => {
AdyenPaymentRequest::try_from((item, pay_later))
}
PaymentMethodData::BankRedirect(ref bank_redirect) => {
AdyenPaymentRequest::try_from((item, bank_redirect))
}
PaymentMethodData::BankDebit(ref bank_debit) => {
AdyenPaymentRequest::try_from((item, bank_debit))
}
PaymentMethodData::BankTransfer(ref bank_transfer) => {
AdyenPaymentRequest::try_from((item, bank_transfer.as_ref()))
}
PaymentMethodData::CardRedirect(ref card_redirect_data) => {
AdyenPaymentRequest::try_from((item, card_redirect_data))
}
PaymentMethodData::Voucher(ref voucher_data) => {
AdyenPaymentRequest::try_from((item, voucher_data))
}
PaymentMethodData::GiftCard(ref gift_card_data) => {
AdyenPaymentRequest::try_from((item, gift_card_data.as_ref()))
}
PaymentMethodData::NetworkToken(ref token_data) => {
AdyenPaymentRequest::try_from((item, token_data))
}
PaymentMethodData::Crypto(_)
| PaymentMethodData::MandatePayment
| PaymentMethodData::Reward
| PaymentMethodData::RealTimePayment(_)
| PaymentMethodData::MobilePayment(_)
| PaymentMethodData::Upi(_)
| PaymentMethodData::OpenBanking(_)
| PaymentMethodData::CardToken(_)
| PaymentMethodData::CardDetailsForNetworkTransactionId(_) => {
Err(errors::ConnectorError::NotImplemented(
|
crates/hyperswitch_connectors/src/connectors/adyen/transformers.rs#chunk1
|
hyperswitch_connectors
|
chunk
| null | null | null | 8,182
| null | null | null | null | null | null | null |
// File: crates/openapi/src/routes/authentication.rs
// Module: openapi
// Public functions: 1
/// Authentication - Create
///
/// Create a new authentication for accessing our APIs from your servers.
///
#[utoipa::path(
post,
path = "/authentication",
request_body = AuthenticationCreateRequest,
responses(
(status = 200, description = "Authentication created", body = AuthenticationResponse),
(status = 400, description = "Invalid data")
),
tag = "Authentication",
operation_id = "Create an Authentication",
security(("api_key" = []))
)]
pub async fn authentication_create() {}
|
crates/openapi/src/routes/authentication.rs
|
openapi
|
full_file
| null | null | null | 139
| null | null | null | null | null | null | null |
// Struct: NexixpayAuthType
// File: crates/hyperswitch_connectors/src/connectors/nexixpay/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct NexixpayAuthType
|
crates/hyperswitch_connectors/src/connectors/nexixpay/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
NexixpayAuthType
| 0
|
[] | 53
| null | null | null | null | null | null | null |
// Implementation: impl ConnectorSpecifications for for Santander
// File: crates/hyperswitch_connectors/src/connectors/santander.rs
// Module: hyperswitch_connectors
// Methods: 3 total (0 public)
impl ConnectorSpecifications for for Santander
|
crates/hyperswitch_connectors/src/connectors/santander.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 54
| null |
Santander
|
ConnectorSpecifications for
| 3
| 0
| null | null |
// Function: to_json_string
// File: crates/router/src/core/payments/routing/utils.rs
// Module: router
pub fn to_json_string<T: Serialize>(value: &T) -> String
|
crates/router/src/core/payments/routing/utils.rs
|
router
|
function_signature
| null | null | null | 42
|
to_json_string
| null | null | null | null | null | null |
// Trait: EmailData
// File: crates/external_services/src/email.rs
// Module: external_services
pub trait EmailData
|
crates/external_services/src/email.rs
|
external_services
|
trait_definition
| null | null | null | 27
| null | null |
EmailData
| null | null | null | null |
// Function: is_operation_confirm
// File: crates/router/src/core/payments.rs
// Module: router
pub fn is_operation_confirm<Op: Debug>(operation: &Op) -> bool
|
crates/router/src/core/payments.rs
|
router
|
function_signature
| null | null | null | 40
|
is_operation_confirm
| null | null | null | null | null | null |
// Module Structure
// File: crates/hyperswitch_connectors/src/connectors/facilitapay.rs
// Module: hyperswitch_connectors
// Public submodules:
pub mod transformers;
|
crates/hyperswitch_connectors/src/connectors/facilitapay.rs
|
hyperswitch_connectors
|
module_structure
| null | null | null | 41
| null | null | null | null | null | 1
| 0
|
// Implementation: impl api::PaymentSession for for UnifiedAuthenticationService
// File: crates/hyperswitch_connectors/src/connectors/unified_authentication_service.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::PaymentSession for for UnifiedAuthenticationService
|
crates/hyperswitch_connectors/src/connectors/unified_authentication_service.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 61
| null |
UnifiedAuthenticationService
|
api::PaymentSession for
| 0
| 0
| null | null |
// Implementation: impl GetAuthType for for ApiKeyAuthWithMerchantIdFromRoute
// File: crates/router/src/services/authentication.rs
// Module: router
// Methods: 1 total (0 public)
impl GetAuthType for for ApiKeyAuthWithMerchantIdFromRoute
|
crates/router/src/services/authentication.rs
|
router
|
impl_block
| null | null | null | 57
| null |
ApiKeyAuthWithMerchantIdFromRoute
|
GetAuthType for
| 1
| 0
| null | null |
// Struct: PayoutCreatePayoutLinkConfig
// File: crates/api_models/src/payouts.rs
// Module: api_models
// Implementations: 0
pub struct PayoutCreatePayoutLinkConfig
|
crates/api_models/src/payouts.rs
|
api_models
|
struct_definition
|
PayoutCreatePayoutLinkConfig
| 0
|
[] | 45
| null | null | null | null | null | null | null |
// Implementation: impl api::PaymentAuthorize for for Stripebilling
// File: crates/hyperswitch_connectors/src/connectors/stripebilling.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::PaymentAuthorize for for Stripebilling
|
crates/hyperswitch_connectors/src/connectors/stripebilling.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 58
| null |
Stripebilling
|
api::PaymentAuthorize for
| 0
| 0
| null | null |
// Function: server
// File: crates/router/src/routes/app.rs
// Module: router
pub fn server(state: AppState) -> Scope
|
crates/router/src/routes/app.rs
|
router
|
function_signature
| null | null | null | 29
|
server
| null | null | null | null | null | null |
// Implementation: impl api::ConnectorAccessToken for for Digitalvirgo
// File: crates/hyperswitch_connectors/src/connectors/digitalvirgo.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::ConnectorAccessToken for for Digitalvirgo
|
crates/hyperswitch_connectors/src/connectors/digitalvirgo.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 61
| null |
Digitalvirgo
|
api::ConnectorAccessToken for
| 0
| 0
| null | null |
// Implementation: impl PaymentAuthorize for for Payone
// File: crates/hyperswitch_connectors/src/connectors/payone.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl PaymentAuthorize for for Payone
|
crates/hyperswitch_connectors/src/connectors/payone.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 53
| null |
Payone
|
PaymentAuthorize for
| 0
| 0
| null | null |
// Function: get_browser_information
// File: crates/api_models/src/authentication.rs
// Module: api_models
pub fn get_browser_information(&self) -> Option<BrowserInformation>
|
crates/api_models/src/authentication.rs
|
api_models
|
function_signature
| null | null | null | 37
|
get_browser_information
| 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.