text
stringlengths 65
57.3k
| file_path
stringlengths 22
92
| module
stringclasses 38
values | type
stringclasses 7
values | struct_name
stringlengths 3
60
⌀ | impl_count
int64 0
60
⌀ | traits
listlengths 0
59
⌀ | tokens
int64 16
8.19k
| function_name
stringlengths 3
85
⌀ | type_name
stringlengths 1
67
⌀ | trait_name
stringclasses 573
values | method_count
int64 0
31
⌀ | public_method_count
int64 0
19
⌀ | submodule_count
int64 0
56
⌀ | export_count
int64 0
9
⌀ |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
// Function: is_terminal_state
// File: crates/common_enums/src/enums.rs
// Module: common_enums
pub fn is_terminal_state(self) -> bool
|
crates/common_enums/src/enums.rs
|
common_enums
|
function_signature
| null | null | null | 35
|
is_terminal_state
| null | null | null | null | null | null |
// Function: parse_jwt_payload
// File: crates/router/src/services/authentication.rs
// Module: router
pub fn parse_jwt_payload<A, T>(headers: &HeaderMap, state: &A) -> RouterResult<T>
where
T: serde::de::DeserializeOwned,
A: SessionStateInfo + Sync,
|
crates/router/src/services/authentication.rs
|
router
|
function_signature
| null | null | null | 68
|
parse_jwt_payload
| null | null | null | null | null | null |
// Struct: PayoutAttemptNew
// File: crates/diesel_models/src/payout_attempt.rs
// Module: diesel_models
// Implementations: 0
pub struct PayoutAttemptNew
|
crates/diesel_models/src/payout_attempt.rs
|
diesel_models
|
struct_definition
|
PayoutAttemptNew
| 0
|
[] | 40
| null | null | null | null | null | null | null |
// Struct: MifinityAddress
// File: crates/hyperswitch_connectors/src/connectors/mifinity/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct MifinityAddress
|
crates/hyperswitch_connectors/src/connectors/mifinity/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
MifinityAddress
| 0
|
[] | 50
| null | null | null | null | null | null | null |
// File: crates/router/tests/services.rs
// Module: router
use std::sync::{atomic, Arc};
use router::{configs::settings::Settings, routes, services};
mod utils;
#[tokio::test]
#[should_panic]
#[allow(clippy::unwrap_used)]
async fn get_redis_conn_failure() {
// Arrange
utils::setup().await;
let (tx, _) = tokio::sync::oneshot::channel();
let app_state = Box::pin(routes::AppState::new(
Settings::default(),
tx,
Box::new(services::MockApiClient),
))
.await;
let state = Arc::new(app_state)
.get_session_state(
&common_utils::id_type::TenantId::try_from_string("public".to_string()).unwrap(),
None,
|| {},
)
.unwrap();
let _ = state.store.get_redis_conn().map(|conn| {
conn.is_redis_available
.store(false, atomic::Ordering::SeqCst)
});
// Act
let _ = state.store.get_redis_conn();
// Assert
// based on #[should_panic] attribute
}
#[tokio::test]
#[allow(clippy::unwrap_used)]
async fn get_redis_conn_success() {
// Arrange
Box::pin(utils::setup()).await;
let (tx, _) = tokio::sync::oneshot::channel();
let app_state = Box::pin(routes::AppState::new(
Settings::default(),
tx,
Box::new(services::MockApiClient),
))
.await;
let state = Arc::new(app_state)
.get_session_state(
&common_utils::id_type::TenantId::try_from_string("public".to_string()).unwrap(),
None,
|| {},
)
.unwrap();
// Act
let result = state.store.get_redis_conn();
// Assert
assert!(result.is_ok())
}
|
crates/router/tests/services.rs
|
router
|
full_file
| null | null | null | 416
| null | null | null | null | null | null | null |
// Function: get_org_refund_metrics
// File: crates/router/src/analytics.rs
// Module: router
// Documentation: Panics if `json_payload` array does not contain one `GetRefundMetricRequest` element.
pub fn get_org_refund_metrics(
state: web::Data<AppState>,
req: actix_web::HttpRequest,
json_payload: web::Json<[GetRefundMetricRequest; 1]>,
) -> impl Responder
|
crates/router/src/analytics.rs
|
router
|
function_signature
| null | null | null | 98
|
get_org_refund_metrics
| null | null | null | null | null | null |
// Implementation: impl api::PaymentsCompleteAuthorize for for Paypal
// File: crates/hyperswitch_connectors/src/connectors/paypal.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::PaymentsCompleteAuthorize for for Paypal
|
crates/hyperswitch_connectors/src/connectors/paypal.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 57
| null |
Paypal
|
api::PaymentsCompleteAuthorize for
| 0
| 0
| null | null |
// File: crates/hyperswitch_connectors/src/connectors/billwerk/transformers.rs
// Module: hyperswitch_connectors
// Public structs: 11
use common_enums::enums;
use common_utils::{
id_type,
pii::{Email, SecretSerdeValue},
types::MinorUnit,
};
use hyperswitch_domain_models::{
payment_method_data::PaymentMethodData,
router_data::{ConnectorAuthType, ErrorResponse, PaymentMethodToken, RouterData},
router_flow_types::{
payments,
refunds::{Execute, RSync},
},
router_request_types::ResponseId,
router_response_types::{PaymentsResponseData, RefundsResponseData},
types,
};
use hyperswitch_interfaces::{
consts::{NO_ERROR_CODE, NO_ERROR_MESSAGE},
errors,
};
use masking::{ExposeInterface, Secret};
use serde::{Deserialize, Serialize};
use crate::{
types::{RefundsResponseRouterData, ResponseRouterData},
utils::{self, CardData as _, PaymentsAuthorizeRequestData, RouterData as _},
};
pub struct BillwerkRouterData<T> {
pub amount: MinorUnit,
pub router_data: T,
}
impl<T> TryFrom<(MinorUnit, T)> for BillwerkRouterData<T> {
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from((amount, item): (MinorUnit, T)) -> Result<Self, Self::Error> {
Ok(Self {
amount,
router_data: item,
})
}
}
pub struct BillwerkAuthType {
pub(super) api_key: Secret<String>,
pub(super) public_api_key: Secret<String>,
}
impl TryFrom<&ConnectorAuthType> for BillwerkAuthType {
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(auth_type: &ConnectorAuthType) -> Result<Self, Self::Error> {
match auth_type {
ConnectorAuthType::BodyKey { api_key, key1 } => Ok(Self {
api_key: api_key.to_owned(),
public_api_key: key1.to_owned(),
}),
_ => Err(errors::ConnectorError::FailedToObtainAuthType.into()),
}
}
}
#[derive(Debug, Serialize)]
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
pub enum BillwerkTokenRequestIntent {
ChargeAndStore,
}
#[derive(Debug, Serialize)]
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
pub enum BillwerkStrongAuthRule {
UseScaIfAvailableAuth,
}
#[derive(Debug, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct BillwerkTokenRequest {
number: cards::CardNumber,
month: Secret<String>,
year: Secret<String>,
cvv: Secret<String>,
pkey: Secret<String>,
recurring: Option<bool>,
intent: Option<BillwerkTokenRequestIntent>,
strong_authentication_rule: Option<BillwerkStrongAuthRule>,
}
impl TryFrom<&types::TokenizationRouterData> for BillwerkTokenRequest {
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(item: &types::TokenizationRouterData) -> Result<Self, Self::Error> {
match item.request.payment_method_data.clone() {
PaymentMethodData::Card(ccard) => {
let connector_auth = &item.connector_auth_type;
let auth_type = BillwerkAuthType::try_from(connector_auth)?;
Ok(Self {
number: ccard.card_number.clone(),
month: ccard.card_exp_month.clone(),
year: ccard.get_card_expiry_year_2_digit()?,
cvv: ccard.card_cvc,
pkey: auth_type.public_api_key,
recurring: None,
intent: None,
strong_authentication_rule: None,
})
}
PaymentMethodData::Wallet(_)
| PaymentMethodData::CardRedirect(_)
| PaymentMethodData::PayLater(_)
| PaymentMethodData::BankRedirect(_)
| PaymentMethodData::BankDebit(_)
| PaymentMethodData::BankTransfer(_)
| PaymentMethodData::Crypto(_)
| PaymentMethodData::MandatePayment
| PaymentMethodData::Reward
| PaymentMethodData::RealTimePayment(_)
| PaymentMethodData::MobilePayment(_)
| PaymentMethodData::Upi(_)
| PaymentMethodData::Voucher(_)
| PaymentMethodData::GiftCard(_)
| PaymentMethodData::OpenBanking(_)
| PaymentMethodData::CardToken(_)
| PaymentMethodData::NetworkToken(_)
| PaymentMethodData::CardDetailsForNetworkTransactionId(_) => {
Err(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message("billwerk"),
)
.into())
}
}
}
}
#[derive(Debug, Deserialize, Serialize)]
pub struct BillwerkTokenResponse {
id: Secret<String>,
recurring: Option<bool>,
}
impl<T>
TryFrom<
ResponseRouterData<
payments::PaymentMethodToken,
BillwerkTokenResponse,
T,
PaymentsResponseData,
>,
> for RouterData<payments::PaymentMethodToken, T, PaymentsResponseData>
{
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(
item: ResponseRouterData<
payments::PaymentMethodToken,
BillwerkTokenResponse,
T,
PaymentsResponseData,
>,
) -> Result<Self, Self::Error> {
Ok(Self {
response: Ok(PaymentsResponseData::TokenizationResponse {
token: item.response.id.expose(),
}),
..item.data
})
}
}
#[derive(Debug, Serialize)]
pub struct BillwerkCustomerObject {
handle: Option<id_type::CustomerId>,
email: Option<Email>,
address: Option<Secret<String>>,
address2: Option<Secret<String>>,
city: Option<String>,
country: Option<common_enums::CountryAlpha2>,
first_name: Option<Secret<String>>,
last_name: Option<Secret<String>>,
}
#[derive(Debug, Serialize)]
pub struct BillwerkPaymentsRequest {
handle: String,
amount: MinorUnit,
source: Secret<String>,
currency: common_enums::Currency,
customer: BillwerkCustomerObject,
metadata: Option<SecretSerdeValue>,
settle: bool,
}
impl TryFrom<&BillwerkRouterData<&types::PaymentsAuthorizeRouterData>> for BillwerkPaymentsRequest {
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(
item: &BillwerkRouterData<&types::PaymentsAuthorizeRouterData>,
) -> Result<Self, Self::Error> {
if item.router_data.is_three_ds() {
return Err(errors::ConnectorError::NotImplemented(
"Three_ds payments through Billwerk".to_string(),
)
.into());
};
let source = match item.router_data.get_payment_method_token()? {
PaymentMethodToken::Token(pm_token) => Ok(pm_token),
_ => Err(errors::ConnectorError::MissingRequiredField {
field_name: "payment_method_token",
}),
}?;
Ok(Self {
handle: item.router_data.connector_request_reference_id.clone(),
amount: item.amount,
source,
currency: item.router_data.request.currency,
customer: BillwerkCustomerObject {
handle: item.router_data.customer_id.clone(),
email: item.router_data.request.email.clone(),
address: item.router_data.get_optional_billing_line1(),
address2: item.router_data.get_optional_billing_line2(),
city: item.router_data.get_optional_billing_city(),
country: item.router_data.get_optional_billing_country(),
first_name: item.router_data.get_optional_billing_first_name(),
last_name: item.router_data.get_optional_billing_last_name(),
},
metadata: item.router_data.request.metadata.clone().map(Into::into),
settle: item.router_data.request.is_auto_capture()?,
})
}
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "lowercase")]
pub enum BillwerkPaymentState {
Created,
Authorized,
Pending,
Settled,
Failed,
Cancelled,
}
impl From<BillwerkPaymentState> for enums::AttemptStatus {
fn from(item: BillwerkPaymentState) -> Self {
match item {
BillwerkPaymentState::Created | BillwerkPaymentState::Pending => Self::Pending,
BillwerkPaymentState::Authorized => Self::Authorized,
BillwerkPaymentState::Settled => Self::Charged,
BillwerkPaymentState::Failed => Self::Failure,
BillwerkPaymentState::Cancelled => Self::Voided,
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct BillwerkPaymentsResponse {
state: BillwerkPaymentState,
handle: String,
error: Option<String>,
error_state: Option<String>,
}
impl<F, T> TryFrom<ResponseRouterData<F, BillwerkPaymentsResponse, T, PaymentsResponseData>>
for RouterData<F, T, PaymentsResponseData>
{
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(
item: ResponseRouterData<F, BillwerkPaymentsResponse, T, PaymentsResponseData>,
) -> Result<Self, Self::Error> {
let error_response = if item.response.error.is_some() || item.response.error_state.is_some()
{
Some(ErrorResponse {
code: item
.response
.error_state
.clone()
.unwrap_or(NO_ERROR_CODE.to_string()),
message: item
.response
.error_state
.unwrap_or(NO_ERROR_MESSAGE.to_string()),
reason: item.response.error,
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: Some(item.response.handle.clone()),
network_advice_code: None,
network_decline_code: None,
network_error_message: None,
connector_metadata: None,
})
} else {
None
};
let payments_response = PaymentsResponseData::TransactionResponse {
resource_id: ResponseId::ConnectorTransactionId(item.response.handle.clone()),
redirection_data: Box::new(None),
mandate_reference: Box::new(None),
connector_metadata: None,
network_txn_id: None,
connector_response_reference_id: Some(item.response.handle),
incremental_authorization_allowed: None,
charges: None,
};
Ok(Self {
status: enums::AttemptStatus::from(item.response.state),
response: error_response.map_or_else(|| Ok(payments_response), Err),
..item.data
})
}
}
#[derive(Debug, Serialize)]
pub struct BillwerkCaptureRequest {
amount: MinorUnit,
}
impl TryFrom<&BillwerkRouterData<&types::PaymentsCaptureRouterData>> for BillwerkCaptureRequest {
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(
item: &BillwerkRouterData<&types::PaymentsCaptureRouterData>,
) -> Result<Self, Self::Error> {
Ok(Self {
amount: item.amount,
})
}
}
// Type definition for RefundRequest
#[derive(Debug, Serialize)]
pub struct BillwerkRefundRequest {
pub invoice: String,
pub amount: MinorUnit,
pub text: Option<String>,
}
impl<F> TryFrom<&BillwerkRouterData<&types::RefundsRouterData<F>>> for BillwerkRefundRequest {
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(
item: &BillwerkRouterData<&types::RefundsRouterData<F>>,
) -> Result<Self, Self::Error> {
Ok(Self {
amount: item.amount,
invoice: item.router_data.request.connector_transaction_id.clone(),
text: item.router_data.request.reason.clone(),
})
}
}
// Type definition for Refund Response
#[derive(Debug, Serialize, Deserialize)]
#[serde(rename_all = "lowercase")]
pub enum RefundState {
Refunded,
Failed,
Processing,
}
impl From<RefundState> for enums::RefundStatus {
fn from(item: RefundState) -> Self {
match item {
RefundState::Refunded => Self::Success,
RefundState::Failed => Self::Failure,
RefundState::Processing => Self::Pending,
}
}
}
#[derive(Debug, Serialize, Deserialize)]
pub struct RefundResponse {
id: String,
state: RefundState,
}
impl TryFrom<RefundsResponseRouterData<Execute, RefundResponse>>
for types::RefundsRouterData<Execute>
{
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(
item: RefundsResponseRouterData<Execute, RefundResponse>,
) -> Result<Self, Self::Error> {
Ok(Self {
response: Ok(RefundsResponseData {
connector_refund_id: item.response.id.to_string(),
refund_status: enums::RefundStatus::from(item.response.state),
}),
..item.data
})
}
}
impl TryFrom<RefundsResponseRouterData<RSync, RefundResponse>> for types::RefundsRouterData<RSync> {
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(
item: RefundsResponseRouterData<RSync, RefundResponse>,
) -> Result<Self, Self::Error> {
Ok(Self {
response: Ok(RefundsResponseData {
connector_refund_id: item.response.id.to_string(),
refund_status: enums::RefundStatus::from(item.response.state),
}),
..item.data
})
}
}
#[derive(Debug, Serialize, Deserialize)]
pub struct BillwerkErrorResponse {
pub code: Option<i32>,
pub error: String,
pub message: Option<String>,
}
|
crates/hyperswitch_connectors/src/connectors/billwerk/transformers.rs
|
hyperswitch_connectors
|
full_file
| null | null | null | 2,936
| null | null | null | null | null | null | null |
// File: crates/router/src/types/storage/enums.rs
// Module: router
pub use diesel_models::enums::*;
|
crates/router/src/types/storage/enums.rs
|
router
|
full_file
| null | null | null | 24
| null | null | null | null | null | null | null |
// Implementation: impl api::ConnectorAccessToken for for Tokenex
// File: crates/hyperswitch_connectors/src/connectors/tokenex.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::ConnectorAccessToken for for Tokenex
|
crates/hyperswitch_connectors/src/connectors/tokenex.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 57
| null |
Tokenex
|
api::ConnectorAccessToken for
| 0
| 0
| null | null |
// Implementation: impl api::Refund for for Bluesnap
// File: crates/hyperswitch_connectors/src/connectors/bluesnap.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::Refund for for Bluesnap
|
crates/hyperswitch_connectors/src/connectors/bluesnap.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 58
| null |
Bluesnap
|
api::Refund for
| 0
| 0
| null | null |
// Implementation: impl ApiEventMetric for for BlocklistResponse
// File: crates/api_models/src/blocklist.rs
// Module: api_models
// Methods: 0 total (0 public)
impl ApiEventMetric for for BlocklistResponse
|
crates/api_models/src/blocklist.rs
|
api_models
|
impl_block
| null | null | null | 49
| null |
BlocklistResponse
|
ApiEventMetric for
| 0
| 0
| null | null |
// File: crates/drainer/src/secrets_transformers.rs
// Module: drainer
// Public functions: 1
use common_utils::errors::CustomResult;
use hyperswitch_interfaces::secrets_interface::{
secret_handler::SecretsHandler,
secret_state::{RawSecret, SecretStateContainer, SecuredSecret},
SecretManagementInterface, SecretsManagementError,
};
use crate::settings::{Database, Settings};
#[async_trait::async_trait]
impl SecretsHandler for Database {
async fn convert_to_raw_secret(
value: SecretStateContainer<Self, SecuredSecret>,
secret_management_client: &dyn SecretManagementInterface,
) -> CustomResult<SecretStateContainer<Self, RawSecret>, SecretsManagementError> {
let secured_db_config = value.get_inner();
let raw_db_password = secret_management_client
.get_secret(secured_db_config.password.clone())
.await?;
Ok(value.transition_state(|db| Self {
password: raw_db_password,
..db
}))
}
}
/// # Panics
///
/// Will panic even if fetching raw secret fails for at least one config value
pub async fn fetch_raw_secrets(
conf: Settings<SecuredSecret>,
secret_management_client: &dyn SecretManagementInterface,
) -> Settings<RawSecret> {
#[allow(clippy::expect_used)]
let database = Database::convert_to_raw_secret(conf.master_database, secret_management_client)
.await
.expect("Failed to decrypt database password");
Settings {
server: conf.server,
master_database: database,
redis: conf.redis,
log: conf.log,
drainer: conf.drainer,
encryption_management: conf.encryption_management,
secrets_management: conf.secrets_management,
multitenancy: conf.multitenancy,
}
}
|
crates/drainer/src/secrets_transformers.rs
|
drainer
|
full_file
| null | null | null | 375
| null | null | null | null | null | null | null |
// Function: setup_intents_update
// File: crates/router/src/compatibility/stripe/setup_intents.rs
// Module: router
pub fn setup_intents_update(
state: web::Data<routes::AppState>,
qs_config: web::Data<serde_qs::Config>,
req: HttpRequest,
form_payload: web::Bytes,
path: web::Path<common_utils::id_type::PaymentId>,
) -> HttpResponse
|
crates/router/src/compatibility/stripe/setup_intents.rs
|
router
|
function_signature
| null | null | null | 92
|
setup_intents_update
| null | null | null | null | null | null |
// Struct: BankFee
// File: crates/hyperswitch_connectors/src/connectors/nordea/responses.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct BankFee
|
crates/hyperswitch_connectors/src/connectors/nordea/responses.rs
|
hyperswitch_connectors
|
struct_definition
|
BankFee
| 0
|
[] | 45
| null | null | null | null | null | null | null |
// Struct: CardTokenData
// File: crates/router/src/types/storage/payment_method.rs
// Module: router
// Implementations: 0
pub struct CardTokenData
|
crates/router/src/types/storage/payment_method.rs
|
router
|
struct_definition
|
CardTokenData
| 0
|
[] | 36
| null | null | null | null | null | null | null |
// Struct: SepaBankDebitAdditionalData
// File: crates/api_models/src/payments/additional_info.rs
// Module: api_models
// Implementations: 0
pub struct SepaBankDebitAdditionalData
|
crates/api_models/src/payments/additional_info.rs
|
api_models
|
struct_definition
|
SepaBankDebitAdditionalData
| 0
|
[] | 47
| null | null | null | null | null | null | null |
// Implementation: impl Tesouro
// File: crates/hyperswitch_connectors/src/connectors/tesouro.rs
// Module: hyperswitch_connectors
// Methods: 1 total (1 public)
impl Tesouro
|
crates/hyperswitch_connectors/src/connectors/tesouro.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 46
| null |
Tesouro
| null | 1
| 1
| null | null |
// File: crates/external_services/src/aws_kms/implementers.rs
// Module: external_services
//! Trait implementations for aws kms client
use common_utils::errors::CustomResult;
use error_stack::ResultExt;
use hyperswitch_interfaces::{
encryption_interface::{EncryptionError, EncryptionManagementInterface},
secrets_interface::{SecretManagementInterface, SecretsManagementError},
};
use masking::{PeekInterface, Secret};
use crate::aws_kms::core::AwsKmsClient;
#[async_trait::async_trait]
impl EncryptionManagementInterface for AwsKmsClient {
async fn encrypt(&self, input: &[u8]) -> CustomResult<Vec<u8>, EncryptionError> {
self.encrypt(input)
.await
.change_context(EncryptionError::EncryptionFailed)
.map(|val| val.into_bytes())
}
async fn decrypt(&self, input: &[u8]) -> CustomResult<Vec<u8>, EncryptionError> {
self.decrypt(input)
.await
.change_context(EncryptionError::DecryptionFailed)
.map(|val| val.into_bytes())
}
}
#[async_trait::async_trait]
impl SecretManagementInterface for AwsKmsClient {
async fn get_secret(
&self,
input: Secret<String>,
) -> CustomResult<Secret<String>, SecretsManagementError> {
self.decrypt(input.peek())
.await
.change_context(SecretsManagementError::FetchSecretFailed)
.map(Into::into)
}
}
|
crates/external_services/src/aws_kms/implementers.rs
|
external_services
|
full_file
| null | null | null | 311
| null | null | null | null | null | null | null |
// Struct: ConditionalConfigReq
// File: crates/api_models/src/conditional_configs.rs
// Module: api_models
// Implementations: 0
pub struct ConditionalConfigReq
|
crates/api_models/src/conditional_configs.rs
|
api_models
|
struct_definition
|
ConditionalConfigReq
| 0
|
[] | 37
| null | null | null | null | null | null | null |
// Module Structure
// File: crates/router/src/services/kafka.rs
// Module: router
// Public submodules:
pub mod payout;
pub mod revenue_recovery;
|
crates/router/src/services/kafka.rs
|
router
|
module_structure
| null | null | null | 34
| null | null | null | null | null | 2
| 0
|
// Function: is_prod_email_required
// File: crates/router/src/utils/user/dashboard_metadata.rs
// Module: router
pub fn is_prod_email_required(data: &ProdIntent, user_email: String) -> bool
|
crates/router/src/utils/user/dashboard_metadata.rs
|
router
|
function_signature
| null | null | null | 44
|
is_prod_email_required
| null | null | null | null | null | null |
// Function: new_token
// File: crates/router/src/services/email/types.rs
// Module: router
pub fn new_token(
email: domain::UserEmail,
entity: Option<Entity>,
flow: domain::Origin,
settings: &configs::Settings,
) -> UserResult<String>
|
crates/router/src/services/email/types.rs
|
router
|
function_signature
| null | null | null | 63
|
new_token
| null | null | null | null | null | null |
// Implementation: impl Responder
// File: crates/router/src/routes/payments.rs
// Module: router
// Methods: 0 total (0 public)
impl Responder
|
crates/router/src/routes/payments.rs
|
router
|
impl_block
| null | null | null | 36
| null |
Responder
| null | 0
| 0
| null | null |
// Struct: Http400RequestDetailsLogger
// File: crates/router/src/middleware.rs
// Module: router
// Implementations: 0
// Documentation: Middleware for Logging request_details of HTTP 400 Bad Requests
pub struct Http400RequestDetailsLogger
|
crates/router/src/middleware.rs
|
router
|
struct_definition
|
Http400RequestDetailsLogger
| 0
|
[] | 59
| null | null | null | null | null | null | null |
// Implementation: impl api::PaymentSync for for Custombilling
// File: crates/hyperswitch_connectors/src/connectors/custombilling.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::PaymentSync for for Custombilling
|
crates/hyperswitch_connectors/src/connectors/custombilling.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 57
| null |
Custombilling
|
api::PaymentSync for
| 0
| 0
| null | null |
// Struct: StripeConnectReversalResponse
// File: crates/hyperswitch_connectors/src/connectors/stripe/transformers/connect.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct StripeConnectReversalResponse
|
crates/hyperswitch_connectors/src/connectors/stripe/transformers/connect.rs
|
hyperswitch_connectors
|
struct_definition
|
StripeConnectReversalResponse
| 0
|
[] | 54
| null | null | null | null | null | null | null |
connectors::Payu,
connectors::Peachpayments,
connectors::Phonepe,
connectors::Plaid,
connectors::Placetopay,
connectors::Powertranz,
connectors::Prophetpay,
connectors::Rapyd,
connectors::Razorpay,
connectors::Recurly,
connectors::Redsys,
connectors::Riskified,
connectors::Santander,
connectors::Shift4,
connectors::Sift,
connectors::Signifyd,
connectors::Silverflow,
connectors::Square,
connectors::Stax,
connectors::Stripe,
connectors::Stripebilling,
connectors::Taxjar,
connectors::Tesouro,
connectors::Threedsecureio,
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
connectors::UnifiedAuthenticationService,
connectors::Vgs,
connectors::Volt,
connectors::Wellsfargo,
connectors::Wellsfargopayout,
connectors::Wise,
connectors::Worldline,
connectors::Worldpay,
connectors::Worldpayvantiv,
connectors::Worldpayxml,
connectors::Xendit,
connectors::Zen,
connectors::Zsl
);
macro_rules! default_imp_for_new_connector_integration_dispute_sync {
($($path:ident::$connector:ident),*) => {
$(
impl DisputeSyncV2 for $path::$connector {}
impl
ConnectorIntegrationV2<
Dsync,
DisputesFlowData,
DisputeSyncData,
DisputeSyncResponse,
> for $path::$connector
{}
)*
};
}
default_imp_for_new_connector_integration_dispute_sync!(
connectors::Aci,
connectors::Adyen,
connectors::Adyenplatform,
connectors::Affirm,
connectors::Airwallex,
connectors::Amazonpay,
connectors::Archipel,
connectors::Authipay,
connectors::Authorizedotnet,
connectors::Bambora,
connectors::Bamboraapac,
connectors::Bankofamerica,
connectors::Barclaycard,
connectors::Billwerk,
connectors::Bitpay,
connectors::Blackhawknetwork,
connectors::Bluecode,
connectors::Bluesnap,
connectors::Boku,
connectors::Braintree,
connectors::Breadpay,
connectors::Cashtocode,
connectors::Celero,
connectors::Chargebee,
connectors::Checkbook,
connectors::Checkout,
connectors::Coinbase,
connectors::Coingate,
connectors::Cryptopay,
connectors::CtpMastercard,
connectors::Custombilling,
connectors::Cybersource,
connectors::Datatrans,
connectors::Deutschebank,
connectors::Digitalvirgo,
connectors::Dlocal,
connectors::Dwolla,
connectors::Ebanx,
connectors::Elavon,
connectors::Facilitapay,
connectors::Finix,
connectors::Fiserv,
connectors::Fiservemea,
connectors::Fiuu,
connectors::Flexiti,
connectors::Forte,
connectors::Getnet,
connectors::Gigadat,
connectors::Globalpay,
connectors::Globepay,
connectors::Gocardless,
connectors::Gpayments,
connectors::Helcim,
connectors::Hipay,
connectors::HyperswitchVault,
connectors::Hyperwallet,
connectors::Iatapay,
connectors::Inespay,
connectors::Itaubank,
connectors::Jpmorgan,
connectors::Juspaythreedsserver,
connectors::Katapult,
connectors::Klarna,
connectors::Loonio,
connectors::Mifinity,
connectors::Mollie,
connectors::Moneris,
connectors::Mpgs,
connectors::Multisafepay,
connectors::Netcetera,
connectors::Nexinets,
connectors::Nexixpay,
connectors::Nmi,
connectors::Nomupay,
connectors::Noon,
connectors::Nordea,
connectors::Novalnet,
connectors::Nuvei,
connectors::Opayo,
connectors::Opennode,
connectors::Paybox,
connectors::Payeezy,
connectors::Payload,
connectors::Payme,
connectors::Payone,
connectors::Paypal,
connectors::Paysafe,
connectors::Paystack,
connectors::Paytm,
connectors::Payu,
connectors::Peachpayments,
connectors::Phonepe,
connectors::Plaid,
connectors::Placetopay,
connectors::Powertranz,
connectors::Prophetpay,
connectors::Rapyd,
connectors::Razorpay,
connectors::Recurly,
connectors::Redsys,
connectors::Riskified,
connectors::Santander,
connectors::Shift4,
connectors::Sift,
connectors::Signifyd,
connectors::Silverflow,
connectors::Square,
connectors::Stax,
connectors::Stripe,
connectors::Stripebilling,
connectors::Taxjar,
connectors::Tesouro,
connectors::Threedsecureio,
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
connectors::UnifiedAuthenticationService,
connectors::Vgs,
connectors::Volt,
connectors::Wellsfargo,
connectors::Wellsfargopayout,
connectors::Wise,
connectors::Worldline,
connectors::Worldpay,
connectors::Worldpayvantiv,
connectors::Worldpayxml,
connectors::Xendit,
connectors::Zen,
connectors::Zsl
);
macro_rules! default_imp_for_new_connector_integration_defend_dispute {
($($path:ident::$connector:ident),*) => {
$(
impl DefendDisputeV2 for $path::$connector {}
impl
ConnectorIntegrationV2<
Defend,
DisputesFlowData,
DefendDisputeRequestData,
DefendDisputeResponse,
> for $path::$connector
{}
)*
};
}
default_imp_for_new_connector_integration_defend_dispute!(
connectors::Vgs,
connectors::Aci,
connectors::Adyen,
connectors::Adyenplatform,
connectors::Affirm,
connectors::Airwallex,
connectors::Amazonpay,
connectors::Authipay,
connectors::Authorizedotnet,
connectors::Bambora,
connectors::Bamboraapac,
connectors::Bankofamerica,
connectors::Barclaycard,
connectors::Billwerk,
connectors::Bitpay,
connectors::Blackhawknetwork,
connectors::Bluecode,
connectors::Bluesnap,
connectors::Braintree,
connectors::Boku,
connectors::Breadpay,
connectors::Cashtocode,
connectors::Celero,
connectors::Chargebee,
connectors::Checkbook,
connectors::Checkout,
connectors::Coinbase,
connectors::Coingate,
connectors::Cryptopay,
connectors::CtpMastercard,
connectors::Custombilling,
connectors::Cybersource,
connectors::Datatrans,
connectors::Deutschebank,
connectors::Digitalvirgo,
connectors::Dlocal,
connectors::Dwolla,
connectors::Ebanx,
connectors::Elavon,
connectors::Facilitapay,
connectors::Finix,
connectors::Fiserv,
connectors::Fiservemea,
connectors::Fiuu,
connectors::Flexiti,
connectors::Forte,
connectors::Getnet,
connectors::Gigadat,
connectors::Globalpay,
connectors::Globepay,
connectors::Gocardless,
connectors::Gpayments,
connectors::Hipay,
connectors::Helcim,
connectors::HyperswitchVault,
connectors::Hyperwallet,
connectors::Iatapay,
connectors::Inespay,
connectors::Itaubank,
connectors::Jpmorgan,
connectors::Juspaythreedsserver,
connectors::Katapult,
connectors::Klarna,
connectors::Loonio,
connectors::Nomupay,
connectors::Noon,
connectors::Nordea,
connectors::Novalnet,
connectors::Netcetera,
connectors::Nexinets,
connectors::Nexixpay,
connectors::Nmi,
connectors::Payone,
connectors::Opayo,
connectors::Opennode,
connectors::Nuvei,
connectors::Paybox,
connectors::Payeezy,
connectors::Payload,
connectors::Payme,
connectors::Paypal,
connectors::Paysafe,
connectors::Paystack,
connectors::Paytm,
connectors::Payu,
connectors::Peachpayments,
connectors::Phonepe,
connectors::Placetopay,
connectors::Plaid,
connectors::Powertranz,
connectors::Prophetpay,
connectors::Mifinity,
connectors::Mollie,
connectors::Moneris,
connectors::Mpgs,
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
connectors::Recurly,
connectors::Redsys,
connectors::Riskified,
connectors::Santander,
connectors::Shift4,
connectors::Sift,
connectors::Silverflow,
connectors::Signifyd,
connectors::Stax,
connectors::Stripe,
connectors::Square,
connectors::Stripebilling,
connectors::Taxjar,
connectors::Tesouro,
connectors::Threedsecureio,
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
connectors::UnifiedAuthenticationService,
connectors::Wise,
connectors::Worldline,
connectors::Volt,
connectors::Worldpay,
connectors::Worldpayvantiv,
connectors::Worldpayxml,
connectors::Wellsfargo,
connectors::Wellsfargopayout,
connectors::Xendit,
connectors::Zen,
connectors::Zsl
);
macro_rules! default_imp_for_new_connector_integration_submit_evidence {
($($path:ident::$connector:ident),*) => {
$(
impl SubmitEvidenceV2 for $path::$connector {}
impl
ConnectorIntegrationV2<
Evidence,
DisputesFlowData,
SubmitEvidenceRequestData,
SubmitEvidenceResponse,
> for $path::$connector
{}
)*
};
}
default_imp_for_new_connector_integration_submit_evidence!(
connectors::Vgs,
connectors::Aci,
connectors::Adyen,
connectors::Adyenplatform,
connectors::Affirm,
connectors::Airwallex,
connectors::Amazonpay,
connectors::Authipay,
connectors::Authorizedotnet,
connectors::Bambora,
connectors::Bamboraapac,
connectors::Bankofamerica,
connectors::Barclaycard,
connectors::Billwerk,
connectors::Bitpay,
connectors::Bluesnap,
connectors::Bluecode,
connectors::Blackhawknetwork,
connectors::Braintree,
connectors::Breadpay,
connectors::Boku,
connectors::Cashtocode,
connectors::Celero,
connectors::Chargebee,
connectors::Checkbook,
connectors::Checkout,
connectors::Coinbase,
connectors::Coingate,
connectors::Cryptopay,
connectors::CtpMastercard,
connectors::Custombilling,
connectors::Datatrans,
connectors::Deutschebank,
connectors::Digitalvirgo,
connectors::Dlocal,
connectors::Dwolla,
connectors::Ebanx,
connectors::Elavon,
connectors::Facilitapay,
connectors::Finix,
connectors::Fiserv,
connectors::Fiservemea,
connectors::Fiuu,
connectors::Flexiti,
connectors::Forte,
connectors::Getnet,
connectors::Gigadat,
connectors::Globalpay,
connectors::Globepay,
connectors::Gocardless,
connectors::Gpayments,
connectors::Hipay,
connectors::Helcim,
connectors::HyperswitchVault,
connectors::Hyperwallet,
connectors::Iatapay,
connectors::Inespay,
connectors::Itaubank,
connectors::Jpmorgan,
connectors::Juspaythreedsserver,
connectors::Klarna,
connectors::Loonio,
connectors::Katapult,
connectors::Nomupay,
connectors::Noon,
connectors::Nordea,
connectors::Novalnet,
connectors::Netcetera,
connectors::Nexinets,
connectors::Nexixpay,
connectors::Nmi,
connectors::Payone,
connectors::Opayo,
connectors::Opennode,
connectors::Nuvei,
connectors::Paybox,
connectors::Payeezy,
connectors::Payload,
connectors::Payme,
connectors::Paypal,
connectors::Paysafe,
connectors::Paystack,
connectors::Payu,
connectors::Peachpayments,
connectors::Paytm,
connectors::Placetopay,
connectors::Plaid,
connectors::Phonepe,
connectors::Powertranz,
connectors::Prophetpay,
connectors::Mifinity,
connectors::Mollie,
connectors::Moneris,
connectors::Mpgs,
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
connectors::Recurly,
connectors::Redsys,
connectors::Riskified,
connectors::Santander,
connectors::Shift4,
connectors::Sift,
connectors::Silverflow,
connectors::Signifyd,
connectors::Stax,
connectors::Stripe,
connectors::Square,
connectors::Stripebilling,
connectors::Taxjar,
connectors::Tesouro,
connectors::Threedsecureio,
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
connectors::UnifiedAuthenticationService,
connectors::Wise,
connectors::Worldline,
connectors::Volt,
connectors::Worldpay,
connectors::Worldpayvantiv,
connectors::Worldpayxml,
connectors::Wellsfargo,
connectors::Wellsfargopayout,
connectors::Xendit,
connectors::Zen,
connectors::Zsl
);
macro_rules! default_imp_for_new_connector_integration_file_upload {
($($path:ident::$connector:ident),*) => {
$(
impl FileUploadV2 for $path::$connector {}
impl UploadFileV2 for $path::$connector {}
impl
ConnectorIntegrationV2<
Upload,
FilesFlowData,
UploadFileRequestData,
UploadFileResponse,
> for $path::$connector
{}
impl RetrieveFileV2 for $path::$connector {}
impl
ConnectorIntegrationV2<
Retrieve,
FilesFlowData,
RetrieveFileRequestData,
RetrieveFileResponse,
> for $path::$connector
{}
)*
};
}
default_imp_for_new_connector_integration_file_upload!(
connectors::Vgs,
connectors::Aci,
connectors::Adyen,
connectors::Adyenplatform,
connectors::Affirm,
connectors::Airwallex,
connectors::Amazonpay,
connectors::Authipay,
connectors::Authorizedotnet,
connectors::Bambora,
connectors::Bamboraapac,
connectors::Bankofamerica,
connectors::Barclaycard,
connectors::Billwerk,
connectors::Bitpay,
connectors::Blackhawknetwork,
connectors::Bluecode,
connectors::Bluesnap,
connectors::Braintree,
connectors::Boku,
connectors::Breadpay,
connectors::Cashtocode,
connectors::Celero,
connectors::Chargebee,
connectors::Checkbook,
connectors::Checkout,
connectors::Coinbase,
connectors::Coingate,
connectors::Cryptopay,
connectors::CtpMastercard,
connectors::Custombilling,
connectors::Cybersource,
connectors::Datatrans,
connectors::Deutschebank,
connectors::Digitalvirgo,
connectors::Dlocal,
connectors::Dwolla,
connectors::Ebanx,
connectors::Elavon,
connectors::Facilitapay,
connectors::Finix,
connectors::Fiserv,
connectors::Fiservemea,
connectors::Fiuu,
connectors::Flexiti,
connectors::Forte,
connectors::Getnet,
connectors::Gigadat,
connectors::Globalpay,
connectors::Globepay,
connectors::Gocardless,
connectors::Gpayments,
connectors::Hipay,
connectors::Helcim,
connectors::HyperswitchVault,
connectors::Hyperwallet,
connectors::Iatapay,
connectors::Inespay,
connectors::Itaubank,
connectors::Jpmorgan,
connectors::Juspaythreedsserver,
connectors::Katapult,
connectors::Klarna,
connectors::Loonio,
connectors::Nomupay,
connectors::Noon,
connectors::Nordea,
connectors::Novalnet,
connectors::Netcetera,
connectors::Nexinets,
connectors::Nexixpay,
connectors::Nmi,
connectors::Nuvei,
connectors::Opayo,
connectors::Opennode,
connectors::Payone,
connectors::Paybox,
connectors::Payeezy,
connectors::Payload,
connectors::Payme,
connectors::Paypal,
connectors::Paysafe,
connectors::Paystack,
connectors::Paytm,
connectors::Payu,
connectors::Peachpayments,
connectors::Phonepe,
connectors::Placetopay,
connectors::Plaid,
connectors::Powertranz,
connectors::Prophetpay,
connectors::Mifinity,
connectors::Mollie,
connectors::Moneris,
connectors::Mpgs,
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
connectors::Recurly,
connectors::Redsys,
connectors::Riskified,
connectors::Santander,
connectors::Shift4,
connectors::Sift,
connectors::Silverflow,
connectors::Signifyd,
connectors::Stax,
connectors::Stripe,
connectors::Square,
connectors::Stripebilling,
connectors::Taxjar,
connectors::Tesouro,
connectors::Threedsecureio,
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
connectors::UnifiedAuthenticationService,
connectors::Wise,
connectors::Worldline,
connectors::Volt,
connectors::Worldpay,
connectors::Worldpayvantiv,
connectors::Worldpayxml,
connectors::Wellsfargo,
connectors::Wellsfargopayout,
connectors::Xendit,
connectors::Zen,
connectors::Zsl
);
#[cfg(feature = "payouts")]
macro_rules! default_imp_for_new_connector_integration_payouts_create {
($($path:ident::$connector:ident),*) => {
$(
impl PayoutCreateV2 for $path::$connector {}
impl
ConnectorIntegrationV2<
PoCreate,
PayoutFlowData,
PayoutsData,
PayoutsResponseData,
> for $path::$connector
{}
)*
};
}
#[cfg(feature = "payouts")]
default_imp_for_new_connector_integration_payouts_create!(
connectors::Vgs,
connectors::Aci,
connectors::Adyen,
connectors::Adyenplatform,
connectors::Affirm,
connectors::Airwallex,
connectors::Amazonpay,
connectors::Authipay,
connectors::Authorizedotnet,
connectors::Bambora,
connectors::Bamboraapac,
connectors::Bankofamerica,
connectors::Barclaycard,
connectors::Billwerk,
connectors::Bitpay,
connectors::Blackhawknetwork,
connectors::Bluecode,
connectors::Bluesnap,
connectors::Braintree,
connectors::Boku,
connectors::Breadpay,
connectors::Cashtocode,
connectors::Celero,
connectors::Chargebee,
connectors::Checkbook,
connectors::Checkout,
connectors::Coinbase,
connectors::Coingate,
connectors::Cryptopay,
connectors::CtpMastercard,
connectors::Custombilling,
connectors::Cybersource,
connectors::Datatrans,
connectors::Deutschebank,
connectors::Digitalvirgo,
connectors::Dlocal,
connectors::Dwolla,
connectors::Ebanx,
connectors::Elavon,
connectors::Facilitapay,
connectors::Finix,
connectors::Fiserv,
connectors::Fiservemea,
connectors::Fiuu,
connectors::Flexiti,
connectors::Forte,
connectors::Getnet,
connectors::Gigadat,
connectors::Globalpay,
connectors::Globepay,
connectors::Gocardless,
connectors::Gpayments,
connectors::Hipay,
connectors::Helcim,
connectors::HyperswitchVault,
connectors::Hyperwallet,
connectors::Iatapay,
connectors::Inespay,
connectors::Itaubank,
connectors::Jpmorgan,
connectors::Juspaythreedsserver,
connectors::Katapult,
connectors::Klarna,
connectors::Loonio,
connectors::Nomupay,
connectors::Noon,
connectors::Nordea,
connectors::Novalnet,
connectors::Netcetera,
connectors::Nexinets,
connectors::Nexixpay,
connectors::Opayo,
connectors::Opennode,
connectors::Nuvei,
connectors::Nmi,
connectors::Payone,
connectors::Paybox,
connectors::Payeezy,
connectors::Payload,
connectors::Payme,
connectors::Paypal,
connectors::Paysafe,
connectors::Paystack,
connectors::Paytm,
connectors::Payu,
connectors::Peachpayments,
connectors::Phonepe,
connectors::Placetopay,
connectors::Plaid,
connectors::Powertranz,
connectors::Prophetpay,
connectors::Mifinity,
connectors::Mollie,
connectors::Moneris,
connectors::Mpgs,
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
connectors::Recurly,
connectors::Redsys,
connectors::Riskified,
connectors::Santander,
connectors::Shift4,
connectors::Sift,
connectors::Silverflow,
connectors::Signifyd,
connectors::Stax,
connectors::Stripe,
connectors::Square,
connectors::Stripebilling,
connectors::Taxjar,
connectors::Tesouro,
connectors::Threedsecureio,
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
connectors::UnifiedAuthenticationService,
connectors::Wise,
connectors::Worldline,
connectors::Volt,
connectors::Worldpay,
connectors::Worldpayvantiv,
connectors::Worldpayxml,
connectors::Wellsfargo,
connectors::Wellsfargopayout,
connectors::Xendit,
connectors::Zen,
connectors::Zsl
);
#[cfg(feature = "payouts")]
macro_rules! default_imp_for_new_connector_integration_payouts_eligibility {
($($path:ident::$connector:ident),*) => {
$(
impl PayoutEligibilityV2 for $path::$connector {}
impl
ConnectorIntegrationV2<
PoEligibility,
PayoutFlowData,
PayoutsData,
PayoutsResponseData,
> for $path::$connector
{}
)*
};
}
#[cfg(feature = "payouts")]
default_imp_for_new_connector_integration_payouts_eligibility!(
connectors::Vgs,
connectors::Aci,
connectors::Adyen,
connectors::Adyenplatform,
connectors::Affirm,
connectors::Airwallex,
connectors::Amazonpay,
connectors::Authipay,
connectors::Authorizedotnet,
connectors::Bambora,
connectors::Bamboraapac,
connectors::Bankofamerica,
connectors::Barclaycard,
connectors::Billwerk,
connectors::Bitpay,
connectors::Blackhawknetwork,
connectors::Bluecode,
connectors::Bluesnap,
connectors::Braintree,
connectors::Boku,
connectors::Breadpay,
connectors::Cashtocode,
connectors::Celero,
connectors::Chargebee,
connectors::Checkbook,
connectors::Checkout,
connectors::Coinbase,
connectors::Coingate,
connectors::Cryptopay,
connectors::CtpMastercard,
connectors::Custombilling,
connectors::Cybersource,
connectors::Datatrans,
connectors::Deutschebank,
connectors::Digitalvirgo,
connectors::Dlocal,
connectors::Dwolla,
connectors::Ebanx,
connectors::Elavon,
connectors::Facilitapay,
connectors::Finix,
connectors::Fiserv,
connectors::Fiservemea,
connectors::Fiuu,
connectors::Flexiti,
connectors::Forte,
connectors::Getnet,
connectors::Gigadat,
connectors::Globalpay,
connectors::Globepay,
connectors::Gocardless,
connectors::Gpayments,
connectors::Hipay,
connectors::Helcim,
connectors::HyperswitchVault,
connectors::Hyperwallet,
connectors::Iatapay,
connectors::Inespay,
connectors::Itaubank,
connectors::Jpmorgan,
connectors::Juspaythreedsserver,
connectors::Katapult,
connectors::Klarna,
connectors::Loonio,
connectors::Nomupay,
connectors::Noon,
connectors::Nordea,
connectors::Novalnet,
connectors::Netcetera,
connectors::Nexinets,
connectors::Nexixpay,
connectors::Nmi,
connectors::Payone,
connectors::Opayo,
connectors::Opennode,
connectors::Nuvei,
connectors::Paybox,
connectors::Payeezy,
connectors::Payload,
connectors::Payme,
connectors::Paypal,
connectors::Paysafe,
connectors::Paystack,
connectors::Paytm,
connectors::Payu,
connectors::Peachpayments,
connectors::Phonepe,
connectors::Placetopay,
connectors::Plaid,
connectors::Powertranz,
connectors::Prophetpay,
connectors::Mifinity,
connectors::Mollie,
connectors::Moneris,
connectors::Mpgs,
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
connectors::Recurly,
connectors::Redsys,
connectors::Riskified,
connectors::Santander,
connectors::Shift4,
connectors::Sift,
connectors::Silverflow,
connectors::Signifyd,
connectors::Stax,
connectors::Stripe,
connectors::Square,
connectors::Stripebilling,
connectors::Taxjar,
connectors::Tesouro,
connectors::Threedsecureio,
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
connectors::UnifiedAuthenticationService,
connectors::Wise,
connectors::Worldline,
connectors::Volt,
connectors::Worldpay,
connectors::Worldpayvantiv,
connectors::Worldpayxml,
connectors::Wellsfargo,
connectors::Wellsfargopayout,
connectors::Xendit,
connectors::Zen,
connectors::Zsl
);
#[cfg(feature = "payouts")]
macro_rules! default_imp_for_new_connector_integration_payouts_fulfill {
($($path:ident::$connector:ident),*) => {
$(
impl PayoutFulfillV2 for $path::$connector {}
impl
ConnectorIntegrationV2<
PoFulfill,
PayoutFlowData,
PayoutsData,
PayoutsResponseData,
> for $path::$connector
{}
)*
};
}
#[cfg(feature = "payouts")]
default_imp_for_new_connector_integration_payouts_fulfill!(
connectors::Vgs,
connectors::Aci,
connectors::Adyen,
connectors::Adyenplatform,
connectors::Affirm,
connectors::Airwallex,
connectors::Amazonpay,
connectors::Authipay,
connectors::Authorizedotnet,
connectors::Bambora,
connectors::Bamboraapac,
connectors::Bankofamerica,
connectors::Barclaycard,
connectors::Billwerk,
connectors::Bitpay,
connectors::Blackhawknetwork,
connectors::Bluecode,
connectors::Bluesnap,
connectors::Braintree,
connectors::Boku,
connectors::Breadpay,
connectors::Cashtocode,
connectors::Celero,
connectors::Chargebee,
connectors::Checkbook,
connectors::Checkout,
connectors::Coinbase,
connectors::Coingate,
connectors::Cryptopay,
connectors::CtpMastercard,
connectors::Custombilling,
connectors::Cybersource,
connectors::Datatrans,
connectors::Deutschebank,
connectors::Digitalvirgo,
connectors::Dlocal,
connectors::Dwolla,
connectors::Ebanx,
connectors::Elavon,
connectors::Facilitapay,
connectors::Finix,
connectors::Fiserv,
connectors::Fiservemea,
connectors::Fiuu,
connectors::Flexiti,
connectors::Forte,
connectors::Getnet,
connectors::Gigadat,
connectors::Globalpay,
connectors::Globepay,
connectors::Gocardless,
connectors::Gpayments,
connectors::Hipay,
connectors::Helcim,
connectors::HyperswitchVault,
connectors::Hyperwallet,
connectors::Iatapay,
connectors::Inespay,
connectors::Itaubank,
connectors::Jpmorgan,
connectors::Juspaythreedsserver,
connectors::Katapult,
connectors::Klarna,
connectors::Loonio,
connectors::Nomupay,
connectors::Noon,
connectors::Nordea,
connectors::Novalnet,
connectors::Netcetera,
connectors::Nexinets,
connectors::Nexixpay,
connectors::Nmi,
connectors::Payone,
connectors::Opayo,
connectors::Opennode,
connectors::Nuvei,
connectors::Paybox,
connectors::Payeezy,
connectors::Payload,
connectors::Payme,
connectors::Paypal,
connectors::Paysafe,
connectors::Paystack,
connectors::Paytm,
connectors::Payu,
connectors::Peachpayments,
connectors::Phonepe,
connectors::Placetopay,
connectors::Plaid,
connectors::Powertranz,
connectors::Prophetpay,
connectors::Mifinity,
connectors::Mollie,
connectors::Moneris,
connectors::Mpgs,
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
connectors::Recurly,
connectors::Redsys,
connectors::Riskified,
connectors::Santander,
connectors::Shift4,
connectors::Sift,
connectors::Silverflow,
connectors::Signifyd,
connectors::Stax,
connectors::Stripe,
connectors::Square,
connectors::Stripebilling,
connectors::Taxjar,
connectors::Tesouro,
connectors::Threedsecureio,
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
connectors::UnifiedAuthenticationService,
connectors::Wise,
connectors::Worldline,
connectors::Volt,
connectors::Worldpay,
connectors::Worldpayvantiv,
connectors::Worldpayxml,
connectors::Wellsfargo,
connectors::Wellsfargopayout,
connectors::Xendit,
connectors::Zen,
connectors::Zsl
);
#[cfg(feature = "payouts")]
macro_rules! default_imp_for_new_connector_integration_payouts_cancel {
($($path:ident::$connector:ident),*) => {
$(
impl PayoutCancelV2 for $path::$connector {}
impl
ConnectorIntegrationV2<
PoCancel,
PayoutFlowData,
PayoutsData,
PayoutsResponseData,
> for $path::$connector
{}
)*
};
}
#[cfg(feature = "payouts")]
default_imp_for_new_connector_integration_payouts_cancel!(
connectors::Vgs,
connectors::Aci,
connectors::Adyen,
connectors::Adyenplatform,
connectors::Affirm,
connectors::Airwallex,
connectors::Amazonpay,
connectors::Authipay,
connectors::Authorizedotnet,
connectors::Bambora,
connectors::Bamboraapac,
connectors::Bankofamerica,
connectors::Barclaycard,
connectors::Billwerk,
connectors::Bitpay,
connectors::Blackhawknetwork,
connectors::Bluecode,
connectors::Bluesnap,
connectors::Braintree,
connectors::Boku,
connectors::Breadpay,
connectors::Cashtocode,
connectors::Celero,
connectors::Chargebee,
connectors::Checkbook,
connectors::Checkout,
connectors::Coinbase,
connectors::Coingate,
connectors::Cryptopay,
connectors::CtpMastercard,
connectors::Custombilling,
connectors::Cybersource,
connectors::Datatrans,
connectors::Deutschebank,
connectors::Digitalvirgo,
connectors::Dlocal,
connectors::Dwolla,
connectors::Ebanx,
connectors::Elavon,
connectors::Facilitapay,
connectors::Finix,
connectors::Fiserv,
connectors::Fiservemea,
connectors::Fiuu,
connectors::Flexiti,
connectors::Forte,
connectors::Getnet,
connectors::Gigadat,
connectors::Globalpay,
connectors::Globepay,
connectors::Gocardless,
connectors::Gpayments,
connectors::Hipay,
connectors::Helcim,
connectors::HyperswitchVault,
connectors::Hyperwallet,
connectors::Iatapay,
connectors::Inespay,
connectors::Itaubank,
connectors::Jpmorgan,
connectors::Juspaythreedsserver,
connectors::Katapult,
connectors::Klarna,
connectors::Loonio,
connectors::Nomupay,
connectors::Noon,
connectors::Nordea,
connectors::Novalnet,
connectors::Netcetera,
connectors::Nexinets,
connectors::Nexixpay,
connectors::Nmi,
connectors::Payone,
connectors::Opayo,
connectors::Opennode,
connectors::Nuvei,
connectors::Paybox,
connectors::Payeezy,
connectors::Payload,
connectors::Payme,
connectors::Paypal,
connectors::Paysafe,
connectors::Paystack,
connectors::Paytm,
connectors::Payu,
connectors::Peachpayments,
connectors::Phonepe,
connectors::Placetopay,
connectors::Plaid,
connectors::Powertranz,
connectors::Prophetpay,
connectors::Mifinity,
connectors::Mollie,
connectors::Moneris,
connectors::Mpgs,
connectors::Multisafepay,
connectors::Rapyd,
connectors::Razorpay,
connectors::Recurly,
connectors::Redsys,
connectors::Riskified,
connectors::Santander,
connectors::Shift4,
connectors::Sift,
connectors::Silverflow,
connectors::Signifyd,
connectors::Stax,
connectors::Stripe,
connectors::Square,
connectors::Stripebilling,
connectors::Taxjar,
connectors::Tesouro,
connectors::Threedsecureio,
connectors::Thunes,
connectors::Tokenex,
connectors::Tokenio,
connectors::Trustpay,
connectors::Trustpayments,
connectors::Tsys,
connectors::UnifiedAuthenticationService,
|
crates/hyperswitch_connectors/src/default_implementations_v2.rs#chunk1
|
hyperswitch_connectors
|
chunk
| null | null | null | 8,192
| null | null | null | null | null | null | null |
// Struct: VoltPaymentsWebhookBodyEventType
// File: crates/hyperswitch_connectors/src/connectors/volt/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct VoltPaymentsWebhookBodyEventType
|
crates/hyperswitch_connectors/src/connectors/volt/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
VoltPaymentsWebhookBodyEventType
| 0
|
[] | 53
| null | null | null | null | null | null | null |
// File: crates/router/src/db/file.rs
// Module: router
use error_stack::report;
use router_env::{instrument, tracing};
use super::{MockDb, Store};
use crate::{
connection,
core::errors::{self, CustomResult},
types::storage,
};
#[async_trait::async_trait]
pub trait FileMetadataInterface {
async fn insert_file_metadata(
&self,
file: storage::FileMetadataNew,
) -> CustomResult<storage::FileMetadata, errors::StorageError>;
async fn find_file_metadata_by_merchant_id_file_id(
&self,
merchant_id: &common_utils::id_type::MerchantId,
file_id: &str,
) -> CustomResult<storage::FileMetadata, errors::StorageError>;
async fn delete_file_metadata_by_merchant_id_file_id(
&self,
merchant_id: &common_utils::id_type::MerchantId,
file_id: &str,
) -> CustomResult<bool, errors::StorageError>;
async fn update_file_metadata(
&self,
this: storage::FileMetadata,
file_metadata: storage::FileMetadataUpdate,
) -> CustomResult<storage::FileMetadata, errors::StorageError>;
}
#[async_trait::async_trait]
impl FileMetadataInterface for Store {
#[instrument(skip_all)]
async fn insert_file_metadata(
&self,
file: storage::FileMetadataNew,
) -> CustomResult<storage::FileMetadata, errors::StorageError> {
let conn = connection::pg_connection_write(self).await?;
file.insert(&conn)
.await
.map_err(|error| report!(errors::StorageError::from(error)))
}
#[instrument(skip_all)]
async fn find_file_metadata_by_merchant_id_file_id(
&self,
merchant_id: &common_utils::id_type::MerchantId,
file_id: &str,
) -> CustomResult<storage::FileMetadata, errors::StorageError> {
let conn = connection::pg_connection_read(self).await?;
storage::FileMetadata::find_by_merchant_id_file_id(&conn, merchant_id, file_id)
.await
.map_err(|error| report!(errors::StorageError::from(error)))
}
#[instrument(skip_all)]
async fn delete_file_metadata_by_merchant_id_file_id(
&self,
merchant_id: &common_utils::id_type::MerchantId,
file_id: &str,
) -> CustomResult<bool, errors::StorageError> {
let conn = connection::pg_connection_write(self).await?;
storage::FileMetadata::delete_by_merchant_id_file_id(&conn, merchant_id, file_id)
.await
.map_err(|error| report!(errors::StorageError::from(error)))
}
#[instrument(skip_all)]
async fn update_file_metadata(
&self,
this: storage::FileMetadata,
file_metadata: storage::FileMetadataUpdate,
) -> CustomResult<storage::FileMetadata, errors::StorageError> {
let conn = connection::pg_connection_write(self).await?;
this.update(&conn, file_metadata)
.await
.map_err(|error| report!(errors::StorageError::from(error)))
}
}
#[async_trait::async_trait]
impl FileMetadataInterface for MockDb {
async fn insert_file_metadata(
&self,
_file: storage::FileMetadataNew,
) -> CustomResult<storage::FileMetadata, errors::StorageError> {
// TODO: Implement function for `MockDb`
Err(errors::StorageError::MockDbError)?
}
async fn find_file_metadata_by_merchant_id_file_id(
&self,
_merchant_id: &common_utils::id_type::MerchantId,
_file_id: &str,
) -> CustomResult<storage::FileMetadata, errors::StorageError> {
// TODO: Implement function for `MockDb`
Err(errors::StorageError::MockDbError)?
}
async fn delete_file_metadata_by_merchant_id_file_id(
&self,
_merchant_id: &common_utils::id_type::MerchantId,
_file_id: &str,
) -> CustomResult<bool, errors::StorageError> {
// TODO: Implement function for `MockDb`
Err(errors::StorageError::MockDbError)?
}
async fn update_file_metadata(
&self,
_this: storage::FileMetadata,
_file_metadata: storage::FileMetadataUpdate,
) -> CustomResult<storage::FileMetadata, errors::StorageError> {
// TODO: Implement function for `MockDb`
Err(errors::StorageError::MockDbError)?
}
}
|
crates/router/src/db/file.rs
|
router
|
full_file
| null | null | null | 997
| null | null | null | null | null | null | null |
// Function: refund_to_refund_core_workflow_model
// File: crates/router/src/core/refunds_v2.rs
// Module: router
pub fn refund_to_refund_core_workflow_model(
refund: &diesel_refund::Refund,
) -> diesel_refund::RefundCoreWorkflow
|
crates/router/src/core/refunds_v2.rs
|
router
|
function_signature
| null | null | null | 61
|
refund_to_refund_core_workflow_model
| null | null | null | null | null | null |
// Struct: ChallengeSuccessCount
// File: crates/api_models/src/analytics/auth_events.rs
// Module: api_models
// Implementations: 0
pub struct ChallengeSuccessCount
|
crates/api_models/src/analytics/auth_events.rs
|
api_models
|
struct_definition
|
ChallengeSuccessCount
| 0
|
[] | 38
| null | null | null | null | null | null | null |
// Struct: FiservOrderRequest
// File: crates/hyperswitch_connectors/src/connectors/fiserv/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct FiservOrderRequest
|
crates/hyperswitch_connectors/src/connectors/fiserv/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
FiservOrderRequest
| 0
|
[] | 52
| null | null | null | null | null | null | null |
// File: crates/router/src/types/pm_auth.rs
// Module: router
use std::str::FromStr;
use error_stack::ResultExt;
use pm_auth::{
connector::plaid,
types::{
self as pm_auth_types,
api::{BoxedPaymentAuthConnector, PaymentAuthConnectorData},
},
};
use crate::core::{
errors::{self, ApiErrorResponse},
pm_auth::helpers::PaymentAuthConnectorDataExt,
};
impl PaymentAuthConnectorDataExt for PaymentAuthConnectorData {
fn get_connector_by_name(name: &str) -> errors::CustomResult<Self, ApiErrorResponse> {
let connector_name = pm_auth_types::PaymentMethodAuthConnectors::from_str(name)
.change_context(ApiErrorResponse::IncorrectConnectorNameGiven)
.attach_printable_lazy(|| {
format!("unable to parse connector: {:?}", name.to_string())
})?;
let connector = Self::convert_connector(connector_name.clone())?;
Ok(Self {
connector,
connector_name,
})
}
fn convert_connector(
connector_name: pm_auth_types::PaymentMethodAuthConnectors,
) -> errors::CustomResult<BoxedPaymentAuthConnector, ApiErrorResponse> {
match connector_name {
pm_auth_types::PaymentMethodAuthConnectors::Plaid => Ok(Box::new(&plaid::Plaid)),
}
}
}
|
crates/router/src/types/pm_auth.rs
|
router
|
full_file
| null | null | null | 283
| null | null | null | null | null | null | null |
// Implementation: impl api::PaymentToken for for Peachpayments
// File: crates/hyperswitch_connectors/src/connectors/peachpayments.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::PaymentToken for for Peachpayments
|
crates/hyperswitch_connectors/src/connectors/peachpayments.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 59
| null |
Peachpayments
|
api::PaymentToken for
| 0
| 0
| null | null |
// Module Structure
// File: crates/hyperswitch_connectors/src/connectors/globepay.rs
// Module: hyperswitch_connectors
// Public submodules:
pub mod transformers;
|
crates/hyperswitch_connectors/src/connectors/globepay.rs
|
hyperswitch_connectors
|
module_structure
| null | null | null | 40
| null | null | null | null | null | 1
| 0
|
// Implementation: impl api::PayoutQuote for for Ebanx
// File: crates/hyperswitch_connectors/src/connectors/ebanx.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::PayoutQuote for for Ebanx
|
crates/hyperswitch_connectors/src/connectors/ebanx.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 63
| null |
Ebanx
|
api::PayoutQuote for
| 0
| 0
| null | null |
// Implementation: impl api::Payment for for Stripe
// File: crates/hyperswitch_connectors/src/connectors/stripe.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::Payment for for Stripe
|
crates/hyperswitch_connectors/src/connectors/stripe.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 53
| null |
Stripe
|
api::Payment for
| 0
| 0
| null | null |
// Implementation: impl OrganizationNew
// File: crates/diesel_models/src/query/organization.rs
// Module: diesel_models
// Methods: 1 total (0 public)
impl OrganizationNew
|
crates/diesel_models/src/query/organization.rs
|
diesel_models
|
impl_block
| null | null | null | 39
| null |
OrganizationNew
| null | 1
| 0
| null | null |
"statement_descriptor_suffix": null,
"created_at": "2024-02-01T12:00:00Z",
"modified_at": "2024-02-01T12:00:00Z",
"last_synced": null,
"setup_future_usage": null,
"off_session": null,
"client_secret": "sec_abcdef1234567890",
"active_attempt_id": "attempt_123",
"business_country": "US",
"business_label": null,
"order_details": null,
"allowed_payment_method_types": "credit",
"connector_metadata": null,
"feature_metadata": null,
"attempt_count": 1,
"profile_id": null,
"merchant_decision": null,
"payment_link_id": null,
"payment_confirm_source": null,
"updated_by": "admin",
"surcharge_applicable": null,
"request_incremental_authorization": null,
"incremental_authorization_allowed": null,
"authorization_count": null,
"session_expiry": null,
"fingerprint_id": null,
"frm_metadata": null
}"#;
let deserialized_payment_intent =
serde_json::from_str::<super::PaymentIntent>(serialized_payment_intent);
assert!(deserialized_payment_intent.is_ok());
}
}
|
crates/diesel_models/src/payment_intent.rs#chunk2
|
diesel_models
|
chunk
| null | null | null | 309
| null | null | null | null | null | null | null |
// Implementation: impl webhooks::IncomingWebhook for for Taxjar
// File: crates/hyperswitch_connectors/src/connectors/taxjar.rs
// Module: hyperswitch_connectors
// Methods: 3 total (0 public)
impl webhooks::IncomingWebhook for for Taxjar
|
crates/hyperswitch_connectors/src/connectors/taxjar.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 62
| null |
Taxjar
|
webhooks::IncomingWebhook for
| 3
| 0
| null | null |
// Struct: AccountHolder
// File: crates/hyperswitch_connectors/src/connectors/getnet/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct AccountHolder
|
crates/hyperswitch_connectors/src/connectors/getnet/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
AccountHolder
| 0
|
[] | 45
| null | null | null | null | null | null | null |
/// The identifier for profile. This must be used for creating merchant accounts, payments and payouts
#[schema(max_length = 64, value_type = String, example = "pro_abcdefghijklmnopqrstuvwxyz")]
pub profile_id: id_type::ProfileId,
/// Name of the profile
#[schema(max_length = 64)]
pub profile_name: String,
/// The URL to redirect after the completion of the operation
#[schema(value_type = Option<String>, max_length = 255, example = "https://www.example.com/success")]
pub return_url: Option<String>,
/// A boolean value to indicate if payment response hash needs to be enabled
#[schema(default = true, example = true)]
pub enable_payment_response_hash: bool,
/// Refers to the hash key used for calculating the signature for webhooks and redirect response. If the value is not provided, a value is automatically generated.
pub payment_response_hash_key: Option<String>,
/// A boolean value to indicate if redirect to merchant with http post needs to be enabled
#[schema(default = false, example = true)]
pub redirect_to_merchant_with_http_post: bool,
/// Webhook related details
pub webhook_details: Option<WebhookDetails>,
/// Metadata is useful for storing additional, unstructured information on an object.
#[schema(value_type = Option<Object>, example = r#"{ "city": "NY", "unit": "245" }"#)]
pub metadata: Option<pii::SecretSerdeValue>,
/// The routing algorithm to be used for routing payments to desired connectors
#[schema(value_type = Option<Object>,example = json!({"type": "single", "data": "stripe"}))]
pub routing_algorithm: Option<serde_json::Value>,
/// Will be used to determine the time till which your payment will be active once the payment session starts
#[schema(example = 900)]
pub intent_fulfillment_time: Option<i64>,
/// The routing algorithm to be used to process the incoming request from merchant to outgoing payment processor or payment method. The default is 'Custom'
#[schema(value_type = Option<Object>,example = json!({"type": "single", "data": "signifyd"}))]
pub frm_routing_algorithm: Option<serde_json::Value>,
/// The routing algorithm to be used to process the incoming request from merchant to outgoing payment processor or payment method. The default is 'Custom'
#[cfg(feature = "payouts")]
#[schema(value_type = Option<StaticRoutingAlgorithm>,example = json!({"type": "single", "data": "wise"}))]
pub payout_routing_algorithm: Option<serde_json::Value>,
/// Verified Apple Pay domains for a particular profile
pub applepay_verified_domains: Option<Vec<String>>,
/// Client Secret Default expiry for all payments created under this profile
#[schema(example = 900)]
pub session_expiry: Option<i64>,
/// Default Payment Link config for all payment links created under this profile
#[schema(value_type = Option<BusinessPaymentLinkConfig>)]
pub payment_link_config: Option<BusinessPaymentLinkConfig>,
/// External 3DS authentication details
pub authentication_connector_details: Option<AuthenticationConnectorDetails>,
// Whether to use the billing details passed when creating the intent as payment method billing
pub use_billing_as_payment_method_billing: Option<bool>,
/// Merchant's config to support extended card info feature
pub extended_card_info_config: Option<ExtendedCardInfoConfig>,
/// A boolean value to indicate if customer shipping details needs to be collected from wallet
/// connector only if it is required field for connector (Eg. Apple Pay, Google Pay etc)
#[schema(default = false, example = false)]
pub collect_shipping_details_from_wallet_connector: Option<bool>,
/// A boolean value to indicate if customer billing details needs to be collected from wallet
/// connector only if it is required field for connector (Eg. Apple Pay, Google Pay etc)
#[schema(default = false, example = false)]
pub collect_billing_details_from_wallet_connector: Option<bool>,
/// A boolean value to indicate if customer shipping details needs to be collected from wallet
/// connector irrespective of connector required fields (Eg. Apple pay, Google pay etc)
#[schema(default = false, example = false)]
pub always_collect_shipping_details_from_wallet_connector: Option<bool>,
/// A boolean value to indicate if customer billing details needs to be collected from wallet
/// connector irrespective of connector required fields (Eg. Apple pay, Google pay etc)
#[schema(default = false, example = false)]
pub always_collect_billing_details_from_wallet_connector: Option<bool>,
/// Indicates if the MIT (merchant initiated transaction) payments can be made connector
/// agnostic, i.e., MITs may be processed through different connector than CIT (customer
/// initiated transaction) based on the routing rules.
/// If set to `false`, MIT will go through the same connector as the CIT.
pub is_connector_agnostic_mit_enabled: Option<bool>,
/// Default payout link config
#[schema(value_type = Option<BusinessPayoutLinkConfig>)]
pub payout_link_config: Option<BusinessPayoutLinkConfig>,
/// These key-value pairs are sent as additional custom headers in the outgoing webhook request.
#[schema(value_type = Option<Object>, example = r#"{ "key1": "value-1", "key2": "value-2" }"#)]
pub outgoing_webhook_custom_http_headers: Option<MaskedHeaders>,
/// Merchant Connector id to be stored for tax_calculator connector
#[schema(value_type = Option<String>)]
pub tax_connector_id: Option<id_type::MerchantConnectorAccountId>,
/// Indicates if tax_calculator connector is enabled or not.
/// If set to `true` tax_connector_id will be checked.
pub is_tax_connector_enabled: bool,
/// Indicates if network tokenization is enabled or not.
#[schema(default = false, example = false)]
pub is_network_tokenization_enabled: bool,
/// Indicates if is_auto_retries_enabled is enabled or not.
#[schema(default = false, example = false)]
pub is_auto_retries_enabled: bool,
/// Maximum number of auto retries allowed for a payment
pub max_auto_retries_enabled: Option<i16>,
/// Bool indicating if extended authentication must be requested for all payments
#[schema(value_type = Option<bool>)]
pub always_request_extended_authorization:
Option<primitive_wrappers::AlwaysRequestExtendedAuthorization>,
/// Indicates if click to pay is enabled or not.
#[schema(default = false, example = false)]
pub is_click_to_pay_enabled: bool,
/// Product authentication ids
#[schema(value_type = Option<Object>, example = r#"{ "click_to_pay": "mca_ushduqwhdohwd", "netcetera": "mca_kwqhudqwd" }"#)]
pub authentication_product_ids:
Option<common_types::payments::AuthenticationConnectorAccountMap>,
/// Card Testing Guard Configs
pub card_testing_guard_config: Option<CardTestingGuardConfig>,
///Indicates if clear pan retries is enabled or not.
pub is_clear_pan_retries_enabled: bool,
/// Indicates if 3ds challenge is forced
pub force_3ds_challenge: bool,
/// Indicates if debit routing is enabled or not
#[schema(value_type = Option<bool>)]
pub is_debit_routing_enabled: Option<bool>,
//Merchant country for the profile
#[schema(value_type = Option<CountryAlpha2>, example = "US")]
pub merchant_business_country: Option<api_enums::CountryAlpha2>,
/// Indicates if pre network tokenization is enabled or not
#[schema(default = false, example = false)]
pub is_pre_network_tokenization_enabled: bool,
/// Acquirer configs
#[schema(value_type = Option<Vec<ProfileAcquirerResponse>>)]
pub acquirer_configs: Option<Vec<ProfileAcquirerResponse>>,
/// Indicates if the redirection has to open in the iframe
#[schema(example = false)]
pub is_iframe_redirection_enabled: Option<bool>,
/// Four-digit code assigned based on business type to determine processing fees and risk level
#[schema(value_type = Option<MerchantCategoryCode>, example = "5411")]
pub merchant_category_code: Option<api_enums::MerchantCategoryCode>,
/// Merchant country code.
/// This is a 3-digit ISO 3166-1 numeric country code that represents the country in which the merchant is registered or operates.
/// Merchants typically receive this value based on their business registration information or during onboarding via payment processors or acquiring banks.
/// It is used in payment processing, fraud detection, and regulatory compliance to determine regional rules and routing behavior.
#[schema(value_type = Option<MerchantCountryCode>, example = "840")]
pub merchant_country_code: Option<common_types::payments::MerchantCountryCode>,
/// Time interval (in hours) for polling the connector to check dispute statuses
#[schema(value_type = Option<u32>, example = 2)]
pub dispute_polling_interval: Option<primitive_wrappers::DisputePollingIntervalInHours>,
/// Indicates if manual retry for payment is enabled or not
pub is_manual_retry_enabled: Option<bool>,
/// Bool indicating if overcapture must be requested for all payments
#[schema(value_type = Option<bool>)]
pub always_enable_overcapture: Option<primitive_wrappers::AlwaysEnableOvercaptureBool>,
/// Indicates if external vault is enabled or not.
#[schema(value_type = Option<ExternalVaultEnabled>, example = "Enable")]
pub is_external_vault_enabled: Option<common_enums::ExternalVaultEnabled>,
/// External Vault Connector Details
pub external_vault_connector_details: Option<ExternalVaultConnectorDetails>,
/// Merchant Connector id to be stored for billing_processor connector
#[schema(value_type = Option<String>)]
pub billing_processor_id: Option<id_type::MerchantConnectorAccountId>,
}
#[cfg(feature = "v2")]
#[derive(Clone, Debug, ToSchema, Serialize)]
pub struct ProfileResponse {
/// The identifier for Merchant Account
#[schema(max_length = 64, example = "y3oqhf46pyzuxjbcn2giaqnb44", value_type = String)]
pub merchant_id: id_type::MerchantId,
/// The identifier for profile. This must be used for creating merchant accounts, payments and payouts
#[schema(max_length = 64, value_type = String, example = "pro_abcdefghijklmnopqrstuvwxyz")]
pub id: id_type::ProfileId,
/// Name of the profile
#[schema(max_length = 64)]
pub profile_name: String,
/// The URL to redirect after the completion of the operation
#[schema(value_type = Option<String>, max_length = 255, example = "https://www.example.com/success")]
pub return_url: Option<common_utils::types::Url>,
/// A boolean value to indicate if payment response hash needs to be enabled
#[schema(default = true, example = true)]
pub enable_payment_response_hash: bool,
/// Refers to the hash key used for calculating the signature for webhooks and redirect response. If the value is not provided, a value is automatically generated.
pub payment_response_hash_key: Option<String>,
/// A boolean value to indicate if redirect to merchant with http post needs to be enabled
#[schema(default = false, example = true)]
pub redirect_to_merchant_with_http_post: bool,
/// Webhook related details
pub webhook_details: Option<WebhookDetails>,
/// Metadata is useful for storing additional, unstructured information on an object.
#[schema(value_type = Option<Object>, example = r#"{ "city": "NY", "unit": "245" }"#)]
pub metadata: Option<pii::SecretSerdeValue>,
/// Verified Apple Pay domains for a particular profile
pub applepay_verified_domains: Option<Vec<String>>,
/// Client Secret Default expiry for all payments created under this profile
#[schema(example = 900)]
pub session_expiry: Option<i64>,
/// Default Payment Link config for all payment links created under this profile
#[schema(value_type = Option<BusinessPaymentLinkConfig>)]
pub payment_link_config: Option<BusinessPaymentLinkConfig>,
/// External 3DS authentication details
pub authentication_connector_details: Option<AuthenticationConnectorDetails>,
// Whether to use the billing details passed when creating the intent as payment method billing
pub use_billing_as_payment_method_billing: Option<bool>,
/// Merchant's config to support extended card info feature
pub extended_card_info_config: Option<ExtendedCardInfoConfig>,
/// A boolean value to indicate if customer shipping details needs to be collected from wallet
/// connector only if it is required field for connector (Eg. Apple Pay, Google Pay etc)
#[schema(default = false, example = false)]
pub collect_shipping_details_from_wallet_connector_if_required: Option<bool>,
/// A boolean value to indicate if customer billing details needs to be collected from wallet
/// connector only if it is required field for connector (Eg. Apple Pay, Google Pay etc)
#[schema(default = false, example = false)]
pub collect_billing_details_from_wallet_connector_if_required: Option<bool>,
/// A boolean value to indicate if customer shipping details needs to be collected from wallet
/// connector irrespective of connector required fields (Eg. Apple pay, Google pay etc)
#[schema(default = false, example = false)]
pub always_collect_shipping_details_from_wallet_connector: Option<bool>,
/// A boolean value to indicate if customer billing details needs to be collected from wallet
/// connector irrespective of connector required fields (Eg. Apple pay, Google pay etc)
#[schema(default = false, example = false)]
pub always_collect_billing_details_from_wallet_connector: Option<bool>,
/// Indicates if the MIT (merchant initiated transaction) payments can be made connector
/// agnostic, i.e., MITs may be processed through different connector than CIT (customer
/// initiated transaction) based on the routing rules.
/// If set to `false`, MIT will go through the same connector as the CIT.
pub is_connector_agnostic_mit_enabled: Option<bool>,
/// Default payout link config
#[schema(value_type = Option<BusinessPayoutLinkConfig>)]
pub payout_link_config: Option<BusinessPayoutLinkConfig>,
/// These key-value pairs are sent as additional custom headers in the outgoing webhook request.
#[schema(value_type = Option<Object>, example = r#"{ "key1": "value-1", "key2": "value-2" }"#)]
pub outgoing_webhook_custom_http_headers: Option<MaskedHeaders>,
/// Will be used to determine the time till which your payment will be active once the payment session starts
#[schema(value_type = Option<u32>, example = 900)]
pub order_fulfillment_time: Option<OrderFulfillmentTime>,
/// Whether the order fulfillment time is calculated from the origin or the time of creating the payment, or confirming the payment
#[schema(value_type = Option<OrderFulfillmentTimeOrigin>, example = "create")]
pub order_fulfillment_time_origin: Option<api_enums::OrderFulfillmentTimeOrigin>,
/// Merchant Connector id to be stored for tax_calculator connector
#[schema(value_type = Option<String>)]
pub tax_connector_id: Option<id_type::MerchantConnectorAccountId>,
/// Indicates if tax_calculator connector is enabled or not.
/// If set to `true` tax_connector_id will be checked.
pub is_tax_connector_enabled: bool,
/// Indicates if network tokenization is enabled or not.
#[schema(default = false, example = false)]
pub is_network_tokenization_enabled: bool,
/// Indicates if CVV should be collected during payment or not.
#[schema(value_type = Option<bool>)]
pub should_collect_cvv_during_payment:
Option<primitive_wrappers::ShouldCollectCvvDuringPayment>,
/// Indicates if click to pay is enabled or not.
#[schema(default = false, example = false)]
pub is_click_to_pay_enabled: bool,
/// Product authentication ids
#[schema(value_type = Option<Object>, example = r#"{ "click_to_pay": "mca_ushduqwhdohwd", "netcetera": "mca_kwqhudqwd" }"#)]
pub authentication_product_ids:
Option<common_types::payments::AuthenticationConnectorAccountMap>,
/// Card Testing Guard Configs
pub card_testing_guard_config: Option<CardTestingGuardConfig>,
///Indicates if clear pan retries is enabled or not.
pub is_clear_pan_retries_enabled: bool,
/// Indicates if debit routing is enabled or not
#[schema(value_type = Option<bool>)]
pub is_debit_routing_enabled: Option<bool>,
//Merchant country for the profile
#[schema(value_type = Option<CountryAlpha2>, example = "US")]
pub merchant_business_country: Option<api_enums::CountryAlpha2>,
/// Indicates if the redirection has to open in the iframe
#[schema(example = false)]
pub is_iframe_redirection_enabled: Option<bool>,
/// Indicates if external vault is enabled or not.
pub is_external_vault_enabled: Option<bool>,
/// External Vault Connector Details
pub external_vault_connector_details: Option<ExternalVaultConnectorDetails>,
/// Four-digit code assigned based on business type to determine processing fees and risk level
#[schema(value_type = Option<MerchantCategoryCode>, example = "5411")]
pub merchant_category_code: Option<api_enums::MerchantCategoryCode>,
/// Merchant country code.
/// This is a 3-digit ISO 3166-1 numeric country code that represents the country in which the merchant is registered or operates.
/// Merchants typically receive this value based on their business registration information or during onboarding via payment processors or acquiring banks.
/// It is used in payment processing, fraud detection, and regulatory compliance to determine regional rules and routing behavior.
#[schema(value_type = Option<MerchantCountryCode>, example = "840")]
pub merchant_country_code: Option<common_types::payments::MerchantCountryCode>,
/// Enable split payments, i.e., split the amount between multiple payment methods
#[schema(value_type = SplitTxnsEnabled, default = "skip")]
pub split_txns_enabled: common_enums::SplitTxnsEnabled,
/// Indicates the state of revenue recovery algorithm type
#[schema(value_type = Option<RevenueRecoveryAlgorithmType>, example = "cascading")]
pub revenue_recovery_retry_algorithm_type:
Option<common_enums::enums::RevenueRecoveryAlgorithmType>,
/// Merchant Connector id to be stored for billing_processor connector
#[schema(value_type = Option<String>)]
pub billing_processor_id: Option<id_type::MerchantConnectorAccountId>,
}
#[cfg(feature = "v1")]
#[derive(Clone, Debug, Deserialize, ToSchema, Serialize)]
#[serde(deny_unknown_fields)]
pub struct ProfileUpdate {
/// The name of profile
#[schema(max_length = 64)]
pub profile_name: Option<String>,
/// The URL to redirect after the completion of the operation
#[schema(value_type = Option<String>, max_length = 255, example = "https://www.example.com/success")]
pub return_url: Option<url::Url>,
/// A boolean value to indicate if payment response hash needs to be enabled
#[schema(default = true, example = true)]
pub enable_payment_response_hash: Option<bool>,
/// Refers to the hash key used for calculating the signature for webhooks and redirect response.
pub payment_response_hash_key: Option<String>,
/// A boolean value to indicate if redirect to merchant with http post needs to be enabled
#[schema(default = false, example = true)]
pub redirect_to_merchant_with_http_post: Option<bool>,
/// Webhook related details
pub webhook_details: Option<WebhookDetails>,
/// Metadata is useful for storing additional, unstructured information on an object.
#[schema(value_type = Option<Object>, example = r#"{ "city": "NY", "unit": "245" }"#)]
pub metadata: Option<pii::SecretSerdeValue>,
/// The routing algorithm to be used for routing payments to desired connectors
#[schema(value_type = Option<Object>,example = json!({"type": "single", "data": "stripe"}))]
pub routing_algorithm: Option<serde_json::Value>,
/// Will be used to determine the time till which your payment will be active once the payment session starts
#[schema(example = 900)]
pub intent_fulfillment_time: Option<u32>,
/// The frm routing algorithm to be used for routing payments to desired FRM's
#[schema(value_type = Option<Object>,example = json!({"type": "single", "data": "signifyd"}))]
pub frm_routing_algorithm: Option<serde_json::Value>,
/// The routing algorithm to be used to process the incoming request from merchant to outgoing payment processor or payment method. The default is 'Custom'
#[cfg(feature = "payouts")]
#[schema(value_type = Option<StaticRoutingAlgorithm>,example = json!({"type": "single", "data": "wise"}))]
pub payout_routing_algorithm: Option<serde_json::Value>,
/// Verified Apple Pay domains for a particular profile
pub applepay_verified_domains: Option<Vec<String>>,
/// Client Secret Default expiry for all payments created under this profile
#[schema(example = 900)]
pub session_expiry: Option<u32>,
/// Default Payment Link config for all payment links created under this profile
pub payment_link_config: Option<BusinessPaymentLinkConfig>,
/// External 3DS authentication details
pub authentication_connector_details: Option<AuthenticationConnectorDetails>,
/// Merchant's config to support extended card info feature
pub extended_card_info_config: Option<ExtendedCardInfoConfig>,
// Whether to use the billing details passed when creating the intent as payment method billing
pub use_billing_as_payment_method_billing: Option<bool>,
/// A boolean value to indicate if customer shipping details needs to be collected from wallet
/// connector only if it is required field for connector (Eg. Apple Pay, Google Pay etc)
#[schema(default = false, example = false)]
pub collect_shipping_details_from_wallet_connector: Option<bool>,
/// A boolean value to indicate if customer billing details needs to be collected from wallet
/// connector only if it is required field for connector (Eg. Apple Pay, Google Pay etc)
#[schema(default = false, example = false)]
pub collect_billing_details_from_wallet_connector: Option<bool>,
/// A boolean value to indicate if customer shipping details needs to be collected from wallet
/// connector irrespective of connector required fields (Eg. Apple pay, Google pay etc)
#[schema(default = false, example = false)]
pub always_collect_shipping_details_from_wallet_connector: Option<bool>,
/// A boolean value to indicate if customer billing details needs to be collected from wallet
/// connector irrespective of connector required fields (Eg. Apple pay, Google pay etc)
#[schema(default = false, example = false)]
pub always_collect_billing_details_from_wallet_connector: Option<bool>,
/// Bool indicating if extended authentication must be requested for all payments
#[schema(value_type = Option<bool>)]
pub always_request_extended_authorization:
Option<primitive_wrappers::AlwaysRequestExtendedAuthorization>,
/// Indicates if the MIT (merchant initiated transaction) payments can be made connector
/// agnostic, i.e., MITs may be processed through different connector than CIT (customer
/// initiated transaction) based on the routing rules.
/// If set to `false`, MIT will go through the same connector as the CIT.
pub is_connector_agnostic_mit_enabled: Option<bool>,
/// Default payout link config
#[schema(value_type = Option<BusinessPayoutLinkConfig>)]
pub payout_link_config: Option<BusinessPayoutLinkConfig>,
/// These key-value pairs are sent as additional custom headers in the outgoing webhook request. It is recommended not to use more than four key-value pairs.
#[schema(value_type = Option<Object>, example = r#"{ "key1": "value-1", "key2": "value-2" }"#)]
pub outgoing_webhook_custom_http_headers: Option<HashMap<String, String>>,
/// Merchant Connector id to be stored for tax_calculator connector
#[schema(value_type = Option<String>)]
pub tax_connector_id: Option<id_type::MerchantConnectorAccountId>,
/// Indicates if tax_calculator connector is enabled or not.
/// If set to `true` tax_connector_id will be checked.
pub is_tax_connector_enabled: Option<bool>,
/// Indicates if dynamic routing is enabled or not.
#[serde(default)]
pub dynamic_routing_algorithm: Option<serde_json::Value>,
/// Indicates if network tokenization is enabled or not.
pub is_network_tokenization_enabled: Option<bool>,
/// Indicates if is_auto_retries_enabled is enabled or not.
pub is_auto_retries_enabled: Option<bool>,
/// Maximum number of auto retries allowed for a payment
pub max_auto_retries_enabled: Option<u8>,
/// Indicates if click to pay is enabled or not.
#[schema(default = false, example = false)]
pub is_click_to_pay_enabled: Option<bool>,
/// Product authentication ids
#[schema(value_type = Option<Object>, example = r#"{ "click_to_pay": "mca_ushduqwhdohwd", "netcetera": "mca_kwqhudqwd" }"#)]
pub authentication_product_ids:
Option<common_types::payments::AuthenticationConnectorAccountMap>,
/// Card Testing Guard Configs
pub card_testing_guard_config: Option<CardTestingGuardConfig>,
///Indicates if clear pan retries is enabled or not.
pub is_clear_pan_retries_enabled: Option<bool>,
/// Indicates if 3ds challenge is forced
pub force_3ds_challenge: Option<bool>,
/// Indicates if debit routing is enabled or not
#[schema(value_type = Option<bool>)]
pub is_debit_routing_enabled: Option<bool>,
//Merchant country for the profile
#[schema(value_type = Option<CountryAlpha2>, example = "US")]
pub merchant_business_country: Option<api_enums::CountryAlpha2>,
/// Indicates if the redirection has to open in the iframe
#[schema(example = false)]
pub is_iframe_redirection_enabled: Option<bool>,
/// Indicates if pre network tokenization is enabled or not
#[schema(default = false, example = false)]
pub is_pre_network_tokenization_enabled: Option<bool>,
/// Four-digit code assigned based on business type to determine processing fees and risk level
#[schema(value_type = Option<MerchantCategoryCode>, example = "5411")]
pub merchant_category_code: Option<api_enums::MerchantCategoryCode>,
/// Merchant country code.
/// This is a 3-digit ISO 3166-1 numeric country code that represents the country in which the merchant is registered or operates.
/// Merchants typically receive this value based on their business registration information or during onboarding via payment processors or acquiring banks.
/// It is used in payment processing, fraud detection, and regulatory compliance to determine regional rules and routing behavior.
#[schema(value_type = Option<MerchantCountryCode>, example = "840")]
pub merchant_country_code: Option<common_types::payments::MerchantCountryCode>,
/// Time interval (in hours) for polling the connector to check for new disputes
#[schema(value_type = Option<u32>, example = 2)]
pub dispute_polling_interval: Option<primitive_wrappers::DisputePollingIntervalInHours>,
/// Indicates if manual retry for payment is enabled or not
pub is_manual_retry_enabled: Option<bool>,
/// Bool indicating if overcapture must be requested for all payments
#[schema(value_type = Option<bool>)]
pub always_enable_overcapture: Option<primitive_wrappers::AlwaysEnableOvercaptureBool>,
/// Indicates if external vault is enabled or not.
#[schema(value_type = Option<ExternalVaultEnabled>, example = "Enable")]
pub is_external_vault_enabled: Option<common_enums::ExternalVaultEnabled>,
/// External Vault Connector Details
pub external_vault_connector_details: Option<ExternalVaultConnectorDetails>,
/// Merchant Connector id to be stored for billing_processor connector
#[schema(value_type = Option<String>)]
pub billing_processor_id: Option<id_type::MerchantConnectorAccountId>,
}
#[cfg(feature = "v2")]
#[derive(Clone, Debug, Deserialize, ToSchema, Serialize)]
#[serde(deny_unknown_fields)]
pub struct ProfileUpdate {
/// The name of profile
#[schema(max_length = 64)]
pub profile_name: Option<String>,
/// The URL to redirect after the completion of the operation
#[schema(value_type = Option<String>, max_length = 255, example = "https://www.example.com/success")]
pub return_url: Option<common_utils::types::Url>,
/// A boolean value to indicate if payment response hash needs to be enabled
#[schema(default = true, example = true)]
pub enable_payment_response_hash: Option<bool>,
/// Refers to the hash key used for calculating the signature for webhooks and redirect response. If the value is not provided, a value is automatically generated.
pub payment_response_hash_key: Option<String>,
/// A boolean value to indicate if redirect to merchant with http post needs to be enabled
#[schema(default = false, example = true)]
pub redirect_to_merchant_with_http_post: Option<bool>,
/// Webhook related details
pub webhook_details: Option<WebhookDetails>,
/// Metadata is useful for storing additional, unstructured information on an object.
#[schema(value_type = Option<Object>, example = r#"{ "city": "NY", "unit": "245" }"#)]
pub metadata: Option<pii::SecretSerdeValue>,
/// Will be used to determine the time till which your payment will be active once the payment session starts
#[schema(value_type = Option<u32>, example = 900)]
pub order_fulfillment_time: Option<OrderFulfillmentTime>,
/// Whether the order fulfillment time is calculated from the origin or the time of creating the payment, or confirming the payment
#[schema(value_type = Option<OrderFulfillmentTimeOrigin>, example = "create")]
pub order_fulfillment_time_origin: Option<api_enums::OrderFulfillmentTimeOrigin>,
/// Verified Apple Pay domains for a particular profile
pub applepay_verified_domains: Option<Vec<String>>,
/// Client Secret Default expiry for all payments created under this profile
#[schema(example = 900)]
pub session_expiry: Option<u32>,
/// Default Payment Link config for all payment links created under this profile
pub payment_link_config: Option<BusinessPaymentLinkConfig>,
/// External 3DS authentication details
pub authentication_connector_details: Option<AuthenticationConnectorDetails>,
/// Merchant's config to support extended card info feature
pub extended_card_info_config: Option<ExtendedCardInfoConfig>,
// Whether to use the billing details passed when creating the intent as payment method billing
pub use_billing_as_payment_method_billing: Option<bool>,
/// A boolean value to indicate if customer shipping details needs to be collected from wallet
/// connector only if it is required field for connector (Eg. Apple Pay, Google Pay etc)
#[schema(default = false, example = false)]
pub collect_shipping_details_from_wallet_connector_if_required: Option<bool>,
/// A boolean value to indicate if customer billing details needs to be collected from wallet
/// connector only if it is required field for connector (Eg. Apple Pay, Google Pay etc)
#[schema(default = false, example = false)]
pub collect_billing_details_from_wallet_connector_if_required: Option<bool>,
/// A boolean value to indicate if customer shipping details needs to be collected from wallet
/// connector irrespective of connector required fields (Eg. Apple pay, Google pay etc)
#[schema(default = false, example = false)]
pub always_collect_shipping_details_from_wallet_connector: Option<bool>,
/// A boolean value to indicate if customer billing details needs to be collected from wallet
/// connector irrespective of connector required fields (Eg. Apple pay, Google pay etc)
#[schema(default = false, example = false)]
pub always_collect_billing_details_from_wallet_connector: Option<bool>,
/// Indicates if the MIT (merchant initiated transaction) payments can be made connector
/// agnostic, i.e., MITs may be processed through different connector than CIT (customer
/// initiated transaction) based on the routing rules.
/// If set to `false`, MIT will go through the same connector as the CIT.
pub is_connector_agnostic_mit_enabled: Option<bool>,
/// Default payout link config
#[schema(value_type = Option<BusinessPayoutLinkConfig>)]
pub payout_link_config: Option<BusinessPayoutLinkConfig>,
/// These key-value pairs are sent as additional custom headers in the outgoing webhook request. It is recommended not to use more than four key-value pairs.
#[schema(value_type = Option<Object>, example = r#"{ "key1": "value-1", "key2": "value-2" }"#)]
pub outgoing_webhook_custom_http_headers: Option<HashMap<String, String>>,
/// Merchant Connector id to be stored for tax_calculator connector
#[schema(value_type = Option<String>)]
pub tax_connector_id: Option<id_type::MerchantConnectorAccountId>,
/// Indicates if tax_calculator connector is enabled or not.
/// If set to `true` tax_connector_id will be checked.
pub is_tax_connector_enabled: Option<bool>,
/// Indicates if network tokenization is enabled or not.
pub is_network_tokenization_enabled: Option<bool>,
/// Indicates if click to pay is enabled or not.
#[schema(default = false, example = false)]
pub is_click_to_pay_enabled: Option<bool>,
/// Product authentication ids
#[schema(value_type = Option<Object>, example = r#"{ "click_to_pay": "mca_ushduqwhdohwd", "netcetera": "mca_kwqhudqwd" }"#)]
pub authentication_product_ids:
Option<common_types::payments::AuthenticationConnectorAccountMap>,
/// Card Testing Guard Configs
pub card_testing_guard_config: Option<CardTestingGuardConfig>,
///Indicates if clear pan retries is enabled or not.
pub is_clear_pan_retries_enabled: Option<bool>,
/// Indicates if debit routing is enabled or not
#[schema(value_type = Option<bool>)]
pub is_debit_routing_enabled: Option<bool>,
//Merchant country for the profile
#[schema(value_type = Option<CountryAlpha2>, example = "US")]
pub merchant_business_country: Option<api_enums::CountryAlpha2>,
/// Indicates if external vault is enabled or not.
pub is_external_vault_enabled: Option<bool>,
/// External Vault Connector Details
pub external_vault_connector_details: Option<ExternalVaultConnectorDetails>,
/// Four-digit code assigned based on business type to determine processing fees and risk level
#[schema(value_type = Option<MerchantCategoryCode>, example = "5411")]
pub merchant_category_code: Option<api_enums::MerchantCategoryCode>,
/// Merchant country code.
/// This is a 3-digit ISO 3166-1 numeric country code that represents the country in which the merchant is registered or operates.
/// Merchants typically receive this value based on their business registration information or during onboarding via payment processors or acquiring banks.
/// It is used in payment processing, fraud detection, and regulatory compliance to determine regional rules and routing behavior.
#[schema(value_type = Option<MerchantCountryCode>, example = "840")]
pub merchant_country_code: Option<common_types::payments::MerchantCountryCode>,
/// Indicates the state of revenue recovery algorithm type
#[schema(value_type = Option<RevenueRecoveryAlgorithmType>, example = "cascading")]
pub revenue_recovery_retry_algorithm_type:
Option<common_enums::enums::RevenueRecoveryAlgorithmType>,
/// Enable split payments, i.e., split the amount between multiple payment methods
#[schema(value_type = Option<SplitTxnsEnabled>, default = "skip")]
pub split_txns_enabled: Option<common_enums::SplitTxnsEnabled>,
/// Merchant Connector id to be stored for billing_processor connector
#[schema(value_type = Option<String>)]
pub billing_processor_id: Option<id_type::MerchantConnectorAccountId>,
}
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct BusinessCollectLinkConfig {
#[serde(flatten)]
pub config: BusinessGenericLinkConfig,
/// List of payment methods shown on collect UI
#[schema(value_type = Vec<EnabledPaymentMethod>, example = r#"[{"payment_method": "bank_transfer", "payment_method_types": ["ach", "bacs", "sepa"]}]"#)]
pub enabled_payment_methods: Vec<link_utils::EnabledPaymentMethod>,
}
|
crates/api_models/src/admin.rs#chunk3
|
api_models
|
chunk
| null | null | null | 8,180
| null | null | null | null | null | null | null |
// Struct: ComprehensiveCardData
// File: crates/api_models/src/revenue_recovery_data_backfill.rs
// Module: api_models
// Implementations: 0
pub struct ComprehensiveCardData
|
crates/api_models/src/revenue_recovery_data_backfill.rs
|
api_models
|
struct_definition
|
ComprehensiveCardData
| 0
|
[] | 40
| null | null | null | null | null | null | null |
// Function: construct_external_vault_proxy_router_data_v2
// File: crates/router/src/core/payments/transformers.rs
// Module: router
pub fn construct_external_vault_proxy_router_data_v2<'a>(
state: &'a SessionState,
merchant_account: &domain::MerchantAccount,
merchant_connector_account: &domain::MerchantConnectorAccountTypeDetails,
payment_data: &hyperswitch_domain_models::payments::PaymentConfirmData<api::ExternalVaultProxy>,
request: types::ExternalVaultProxyPaymentsData,
connector_request_reference_id: String,
connector_customer_id: Option<String>,
customer_id: Option<common_utils::id_type::CustomerId>,
header_payload: Option<hyperswitch_domain_models::payments::HeaderPayload>,
) -> RouterResult<
RouterDataV2<
api::ExternalVaultProxy,
hyperswitch_domain_models::router_data_v2::ExternalVaultProxyFlowData,
types::ExternalVaultProxyPaymentsData,
types::PaymentsResponseData,
>,
>
|
crates/router/src/core/payments/transformers.rs
|
router
|
function_signature
| null | null | null | 214
|
construct_external_vault_proxy_router_data_v2
| null | null | null | null | null | null |
// Struct: BitpayPaymentResponseData
// File: crates/hyperswitch_connectors/src/connectors/bitpay/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct BitpayPaymentResponseData
|
crates/hyperswitch_connectors/src/connectors/bitpay/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
BitpayPaymentResponseData
| 0
|
[] | 51
| null | null | null | null | null | null | null |
// Struct: CardDetails
// File: crates/hyperswitch_connectors/src/connectors/paypal/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct CardDetails
|
crates/hyperswitch_connectors/src/connectors/paypal/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
CardDetails
| 0
|
[] | 45
| null | null | null | null | null | null | null |
// Function: validate_role_name
// File: crates/router/src/utils/user_role.rs
// Module: router
pub fn validate_role_name(
state: &SessionState,
role_name: &domain::RoleName,
merchant_id: &id_type::MerchantId,
org_id: &id_type::OrganizationId,
tenant_id: &id_type::TenantId,
profile_id: &id_type::ProfileId,
entity_type: &EntityType,
) -> UserResult<()>
|
crates/router/src/utils/user_role.rs
|
router
|
function_signature
| null | null | null | 102
|
validate_role_name
| null | null | null | null | null | null |
// Implementation: impl api::PaymentSync for for Bankofamerica
// File: crates/hyperswitch_connectors/src/connectors/bankofamerica.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::PaymentSync for for Bankofamerica
|
crates/hyperswitch_connectors/src/connectors/bankofamerica.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 64
| null |
Bankofamerica
|
api::PaymentSync for
| 0
| 0
| null | null |
// File: crates/router/src/core/payment_methods/migration.rs
// Module: router
// Public functions: 3
// Public structs: 1
use actix_multipart::form::{self, bytes, text};
use api_models::payment_methods as pm_api;
use common_utils::{errors::CustomResult, id_type};
use csv::Reader;
use error_stack::ResultExt;
use hyperswitch_domain_models::{
api::ApplicationResponse, errors::api_error_response as errors, merchant_context,
payment_methods::PaymentMethodUpdate,
};
use masking::PeekInterface;
use rdkafka::message::ToBytes;
use router_env::logger;
use crate::{core::errors::StorageErrorExt, routes::SessionState};
type PmMigrationResult<T> = CustomResult<ApplicationResponse<T>, errors::ApiErrorResponse>;
#[cfg(feature = "v1")]
pub async fn update_payment_methods(
state: &SessionState,
payment_methods: Vec<pm_api::UpdatePaymentMethodRecord>,
merchant_id: &id_type::MerchantId,
merchant_context: &merchant_context::MerchantContext,
) -> PmMigrationResult<Vec<pm_api::PaymentMethodUpdateResponse>> {
let mut result = Vec::with_capacity(payment_methods.len());
for record in payment_methods {
let update_res =
update_payment_method_record(state, record.clone(), merchant_id, merchant_context)
.await;
let res = match update_res {
Ok(ApplicationResponse::Json(response)) => Ok(response),
Err(e) => Err(e.to_string()),
_ => Err("Failed to update payment method".to_string()),
};
result.push(pm_api::PaymentMethodUpdateResponse::from((res, record)));
}
Ok(ApplicationResponse::Json(result))
}
#[cfg(feature = "v1")]
pub async fn update_payment_method_record(
state: &SessionState,
req: pm_api::UpdatePaymentMethodRecord,
merchant_id: &id_type::MerchantId,
merchant_context: &merchant_context::MerchantContext,
) -> CustomResult<
ApplicationResponse<pm_api::PaymentMethodRecordUpdateResponse>,
errors::ApiErrorResponse,
> {
use std::collections::HashMap;
use common_enums::enums;
use common_utils::pii;
use hyperswitch_domain_models::mandates::{
CommonMandateReference, PaymentsMandateReference, PaymentsMandateReferenceRecord,
PayoutsMandateReference, PayoutsMandateReferenceRecord,
};
let db = &*state.store;
let payment_method_id = req.payment_method_id.clone();
let network_transaction_id = req.network_transaction_id.clone();
let status = req.status;
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
.to_not_found_response(errors::ApiErrorResponse::PaymentMethodNotFound)?;
if payment_method.merchant_id != *merchant_id {
return Err(errors::ApiErrorResponse::InvalidRequestData {
message: "Merchant ID in the request does not match the Merchant ID in the payment method record.".to_string(),
}.into());
}
// Process mandate details when both payment_instrument_id and merchant_connector_id are present
let pm_update = match (&req.payment_instrument_id, &req.merchant_connector_id) {
(Some(payment_instrument_id), Some(merchant_connector_id)) => {
let mandate_details = payment_method
.get_common_mandate_reference()
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Failed to deserialize to Payment Mandate Reference ")?;
let mca = db
.find_by_merchant_connector_account_merchant_id_merchant_connector_id(
&state.into(),
merchant_context.get_merchant_account().get_id(),
merchant_connector_id,
merchant_context.get_merchant_key_store(),
)
.await
.to_not_found_response(
errors::ApiErrorResponse::MerchantConnectorAccountNotFound {
id: merchant_connector_id.get_string_repr().to_string(),
},
)?;
let updated_connector_mandate_details = match mca.connector_type {
enums::ConnectorType::PayoutProcessor => {
// Handle PayoutsMandateReference
let mut existing_payouts_mandate = mandate_details
.payouts
.unwrap_or_else(|| PayoutsMandateReference(HashMap::new()));
// Create new payout mandate record
let new_payout_record = PayoutsMandateReferenceRecord {
transfer_method_id: Some(payment_instrument_id.peek().to_string()),
};
// Check if record exists for this merchant_connector_id
if let Some(existing_record) =
existing_payouts_mandate.0.get_mut(merchant_connector_id)
{
if let Some(transfer_method_id) = &new_payout_record.transfer_method_id {
existing_record.transfer_method_id = Some(transfer_method_id.clone());
}
} else {
// Insert new record in connector_mandate_details
existing_payouts_mandate
.0
.insert(merchant_connector_id.clone(), new_payout_record);
}
// Create updated CommonMandateReference preserving payments section
CommonMandateReference {
payments: mandate_details.payments,
payouts: Some(existing_payouts_mandate),
}
}
_ => {
// Handle PaymentsMandateReference
let mut existing_payments_mandate = mandate_details
.payments
.unwrap_or_else(|| PaymentsMandateReference(HashMap::new()));
// Check if record exists for this merchant_connector_id
if let Some(existing_record) =
existing_payments_mandate.0.get_mut(merchant_connector_id)
{
existing_record.connector_mandate_id =
payment_instrument_id.peek().to_string();
} else {
// Insert new record in connector_mandate_details
existing_payments_mandate.0.insert(
merchant_connector_id.clone(),
PaymentsMandateReferenceRecord {
connector_mandate_id: payment_instrument_id.peek().to_string(),
payment_method_type: None,
original_payment_authorized_amount: None,
original_payment_authorized_currency: None,
mandate_metadata: None,
connector_mandate_status: None,
connector_mandate_request_reference_id: None,
},
);
}
// Create updated CommonMandateReference preserving payouts section
CommonMandateReference {
payments: Some(existing_payments_mandate),
payouts: mandate_details.payouts,
}
}
};
let connector_mandate_details_value = updated_connector_mandate_details
.get_mandate_details_value()
.map_err(|err| {
logger::error!("Failed to get get_mandate_details_value : {:?}", err);
errors::ApiErrorResponse::MandateUpdateFailed
})?;
PaymentMethodUpdate::ConnectorNetworkTransactionIdStatusAndMandateDetailsUpdate {
connector_mandate_details: Some(pii::SecretSerdeValue::new(
connector_mandate_details_value,
)),
network_transaction_id,
status,
}
}
_ => {
// Update only network_transaction_id and status
PaymentMethodUpdate::NetworkTransactionIdAndStatusUpdate {
network_transaction_id,
status,
}
}
};
let response = db
.update_payment_method(
&state.into(),
merchant_context.get_merchant_key_store(),
payment_method,
pm_update,
merchant_context.get_merchant_account().storage_scheme,
)
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable(format!(
"Failed to update payment method for existing pm_id: {payment_method_id:?} in db",
))?;
logger::debug!("Payment method updated in db");
Ok(ApplicationResponse::Json(
pm_api::PaymentMethodRecordUpdateResponse {
payment_method_id: response.payment_method_id,
status: response.status,
network_transaction_id: response.network_transaction_id,
connector_mandate_details: response
.connector_mandate_details
.map(pii::SecretSerdeValue::new),
},
))
}
#[derive(Debug, form::MultipartForm)]
pub struct PaymentMethodsUpdateForm {
#[multipart(limit = "1MB")]
pub file: bytes::Bytes,
pub merchant_id: text::Text<id_type::MerchantId>,
}
fn parse_update_csv(data: &[u8]) -> csv::Result<Vec<pm_api::UpdatePaymentMethodRecord>> {
let mut csv_reader = Reader::from_reader(data);
let mut records = Vec::new();
let mut id_counter = 0;
for result in csv_reader.deserialize() {
let mut record: pm_api::UpdatePaymentMethodRecord = result?;
id_counter += 1;
record.line_number = Some(id_counter);
records.push(record);
}
Ok(records)
}
type UpdateValidationResult =
Result<(id_type::MerchantId, Vec<pm_api::UpdatePaymentMethodRecord>), errors::ApiErrorResponse>;
impl PaymentMethodsUpdateForm {
pub fn validate_and_get_payment_method_records(self) -> UpdateValidationResult {
let records = parse_update_csv(self.file.data.to_bytes()).map_err(|e| {
errors::ApiErrorResponse::PreconditionFailed {
message: e.to_string(),
}
})?;
Ok((self.merchant_id.clone(), records))
}
}
|
crates/router/src/core/payment_methods/migration.rs
|
router
|
full_file
| null | null | null | 2,019
| null | null | null | null | null | null | null |
// File: crates/drainer/src/utils.rs
// Module: drainer
// Public functions: 2
use std::sync::{atomic, Arc};
use error_stack::report;
use redis_interface as redis;
use serde::de::Deserialize;
use crate::{
errors, kv, metrics,
stream::{StreamEntries, StreamReadResult},
};
pub fn parse_stream_entries<'a>(
read_result: &'a StreamReadResult,
stream_name: &str,
) -> errors::DrainerResult<&'a StreamEntries> {
read_result.get(stream_name).ok_or_else(|| {
report!(errors::DrainerError::RedisError(report!(
redis::errors::RedisError::NotFound
)))
})
}
pub(crate) fn deserialize_i64<'de, D>(deserializer: D) -> Result<i64, D::Error>
where
D: serde::Deserializer<'de>,
{
let s = serde_json::Value::deserialize(deserializer)?;
match s {
serde_json::Value::String(str_val) => str_val.parse().map_err(serde::de::Error::custom),
serde_json::Value::Number(num_val) => match num_val.as_i64() {
Some(val) => Ok(val),
None => Err(serde::de::Error::custom(format!(
"could not convert {num_val:?} to i64"
))),
},
other => Err(serde::de::Error::custom(format!(
"unexpected data format - expected string or number, got: {other:?}"
))),
}
}
pub(crate) fn deserialize_db_op<'de, D>(deserializer: D) -> Result<kv::DBOperation, D::Error>
where
D: serde::Deserializer<'de>,
{
let s = serde_json::Value::deserialize(deserializer)?;
match s {
serde_json::Value::String(str_val) => {
serde_json::from_str(&str_val).map_err(serde::de::Error::custom)
}
other => Err(serde::de::Error::custom(format!(
"unexpected data format - expected string got: {other:?}"
))),
}
}
// Here the output is in the format (stream_index, jobs_picked),
// similar to the first argument of the function
#[inline(always)]
pub async fn increment_stream_index(
(index, jobs_picked): (u8, Arc<atomic::AtomicU8>),
total_streams: u8,
) -> u8 {
if index == total_streams - 1 {
match jobs_picked.load(atomic::Ordering::SeqCst) {
0 => metrics::CYCLES_COMPLETED_UNSUCCESSFULLY.add(1, &[]),
_ => metrics::CYCLES_COMPLETED_SUCCESSFULLY.add(1, &[]),
}
jobs_picked.store(0, atomic::Ordering::SeqCst);
0
} else {
index + 1
}
}
|
crates/drainer/src/utils.rs
|
drainer
|
full_file
| null | null | null | 634
| null | null | null | null | null | null | null |
// Struct: RefundResponse
// File: crates/hyperswitch_connectors/src/connectors/chargebee/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct RefundResponse
|
crates/hyperswitch_connectors/src/connectors/chargebee/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
RefundResponse
| 0
|
[] | 48
| null | null | null | null | null | null | null |
// Implementation: impl api::PaymentToken for for Paytm
// File: crates/hyperswitch_connectors/src/connectors/paytm.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::PaymentToken for for Paytm
|
crates/hyperswitch_connectors/src/connectors/paytm.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 57
| null |
Paytm
|
api::PaymentToken for
| 0
| 0
| null | null |
// File: crates/router/src/core/user.rs
// Module: router
// Public functions: 46
use std::{
collections::{HashMap, HashSet},
ops::Not,
};
use api_models::{
payments::RedirectionResponse,
user::{self as user_api, InviteMultipleUserResponse, NameIdUnit},
};
use common_enums::{connector_enums, EntityType, UserAuthType};
use common_utils::{
fp_utils, type_name,
types::{keymanager::Identifier, user::LineageContext},
};
#[cfg(feature = "email")]
use diesel_models::user_role::UserRoleUpdate;
use diesel_models::{
enums::{TotpStatus, UserRoleVersion, UserStatus},
organization::OrganizationBridge,
user as storage_user,
user_authentication_method::{UserAuthenticationMethodNew, UserAuthenticationMethodUpdate},
};
use error_stack::{report, ResultExt};
use masking::{ExposeInterface, PeekInterface, Secret};
#[cfg(feature = "email")]
use router_env::env;
use router_env::logger;
use storage_impl::errors::StorageError;
#[cfg(not(feature = "email"))]
use user_api::dashboard_metadata::SetMetaDataRequest;
#[cfg(feature = "v1")]
use super::admin;
use super::errors::{StorageErrorExt, UserErrors, UserResponse, UserResult};
#[cfg(feature = "v1")]
use crate::types::transformers::ForeignFrom;
use crate::{
consts,
core::encryption::send_request_to_key_service_for_user,
db::{
domain::user_authentication_method::DEFAULT_USER_AUTH_METHOD,
user_role::ListUserRolesByUserIdPayload,
},
routes::{app::ReqState, SessionState},
services::{authentication as auth, authorization::roles, openidconnect, ApplicationResponse},
types::{domain, transformers::ForeignInto},
utils::{
self,
user::{theme as theme_utils, two_factor_auth as tfa_utils},
},
};
#[cfg(feature = "email")]
use crate::{services::email::types as email_types, utils::user as user_utils};
pub mod dashboard_metadata;
#[cfg(feature = "dummy_connector")]
pub mod sample_data;
pub mod theme;
#[cfg(feature = "email")]
pub async fn signup_with_merchant_id(
state: SessionState,
request: user_api::SignUpWithMerchantIdRequest,
auth_id: Option<String>,
theme_id: Option<String>,
) -> UserResponse<user_api::SignUpWithMerchantIdResponse> {
let new_user = domain::NewUser::try_from(request.clone())?;
new_user
.get_new_merchant()
.get_new_organization()
.insert_org_in_db(state.clone())
.await?;
let user_from_db = new_user
.insert_user_and_merchant_in_db(state.clone())
.await?;
let _user_role = new_user
.insert_org_level_user_role_in_db(
state.clone(),
common_utils::consts::ROLE_ID_ORGANIZATION_ADMIN.to_string(),
UserStatus::Active,
)
.await?;
let theme = theme_utils::get_theme_using_optional_theme_id(&state, theme_id).await?;
let email_contents = email_types::ResetPassword {
recipient_email: user_from_db.get_email().try_into()?,
user_name: domain::UserName::new(user_from_db.get_name())?,
settings: state.conf.clone(),
auth_id,
theme_id: theme.as_ref().map(|theme| theme.theme_id.clone()),
theme_config: theme
.map(|theme| theme.email_config())
.unwrap_or(state.conf.theme.email_config.clone()),
};
let send_email_result = state
.email_client
.compose_and_send_email(
user_utils::get_base_url(&state),
Box::new(email_contents),
state.conf.proxy.https_url.as_ref(),
)
.await;
logger::info!(?send_email_result);
Ok(ApplicationResponse::Json(user_api::AuthorizeResponse {
is_email_sent: send_email_result.is_ok(),
user_id: user_from_db.get_user_id().to_string(),
}))
}
pub async fn get_user_details(
state: SessionState,
user_from_token: auth::UserFromToken,
) -> UserResponse<user_api::GetUserDetailsResponse> {
let user = user_from_token.get_user_from_db(&state).await?;
let verification_days_left = utils::user::get_verification_days_left(&state, &user)?;
let role_info = roles::RoleInfo::from_role_id_org_id_tenant_id(
&state,
&user_from_token.role_id,
&user_from_token.org_id,
user_from_token
.tenant_id
.as_ref()
.unwrap_or(&state.tenant.tenant_id),
)
.await
.change_context(UserErrors::InternalServerError)
.attach_printable("Failed to retrieve role information")?;
let key_manager_state = &(&state).into();
let merchant_key_store = state
.store
.get_merchant_key_store_by_merchant_id(
key_manager_state,
&user_from_token.merchant_id,
&state.store.get_master_key().to_vec().into(),
)
.await;
let version = if let Ok(merchant_key_store) = merchant_key_store {
let merchant_account = state
.store
.find_merchant_account_by_merchant_id(
key_manager_state,
&user_from_token.merchant_id,
&merchant_key_store,
)
.await;
if let Ok(merchant_account) = merchant_account {
merchant_account.version
} else if merchant_account
.as_ref()
.map_err(|e| e.current_context().is_db_not_found())
.err()
.unwrap_or(false)
{
common_enums::ApiVersion::V2
} else {
Err(merchant_account
.err()
.map(|e| e.change_context(UserErrors::InternalServerError))
.unwrap_or(UserErrors::InternalServerError.into()))?
}
} else if merchant_key_store
.as_ref()
.map_err(|e| e.current_context().is_db_not_found())
.err()
.unwrap_or(false)
{
common_enums::ApiVersion::V2
} else {
Err(merchant_key_store
.err()
.map(|e| e.change_context(UserErrors::InternalServerError))
.unwrap_or(UserErrors::InternalServerError.into()))?
};
let theme = theme_utils::get_most_specific_theme_using_token_and_min_entity(
&state,
&user_from_token,
EntityType::Profile,
)
.await?;
Ok(ApplicationResponse::Json(
user_api::GetUserDetailsResponse {
merchant_id: user_from_token.merchant_id,
name: user.get_name(),
email: user.get_email(),
user_id: user.get_user_id().to_string(),
verification_days_left,
role_id: user_from_token.role_id,
org_id: user_from_token.org_id,
is_two_factor_auth_setup: user.get_totp_status() == TotpStatus::Set,
recovery_codes_left: user.get_recovery_codes().map(|codes| codes.len()),
profile_id: user_from_token.profile_id,
entity_type: role_info.get_entity_type(),
theme_id: theme.map(|theme| theme.theme_id),
version,
},
))
}
pub async fn signup_token_only_flow(
state: SessionState,
request: user_api::SignUpRequest,
) -> UserResponse<user_api::TokenResponse> {
let user_email = domain::UserEmail::from_pii_email(request.email.clone())?;
utils::user::validate_email_domain_auth_type_using_db(
&state,
&user_email,
UserAuthType::Password,
)
.await?;
let new_user = domain::NewUser::try_from(request)?;
new_user
.get_new_merchant()
.get_new_organization()
.insert_org_in_db(state.clone())
.await?;
let user_from_db = new_user
.insert_user_and_merchant_in_db(state.clone())
.await?;
let user_role = new_user
.insert_org_level_user_role_in_db(
state.clone(),
common_utils::consts::ROLE_ID_ORGANIZATION_ADMIN.to_string(),
UserStatus::Active,
)
.await?;
let next_flow =
domain::NextFlow::from_origin(domain::Origin::SignUp, user_from_db.clone(), &state).await?;
let token = next_flow
.get_token_with_user_role(&state, &user_role)
.await?;
let response = user_api::TokenResponse {
token: token.clone(),
token_type: next_flow.get_flow().into(),
};
auth::cookies::set_cookie_response(response, token)
}
pub async fn signin_token_only_flow(
state: SessionState,
request: user_api::SignInRequest,
) -> UserResponse<user_api::TokenResponse> {
let user_email = domain::UserEmail::from_pii_email(request.email)?;
utils::user::validate_email_domain_auth_type_using_db(
&state,
&user_email,
UserAuthType::Password,
)
.await?;
let user_from_db: domain::UserFromStorage = state
.global_store
.find_user_by_email(&user_email)
.await
.to_not_found_response(UserErrors::InvalidCredentials)?
.into();
user_from_db.compare_password(&request.password)?;
let next_flow =
domain::NextFlow::from_origin(domain::Origin::SignIn, user_from_db.clone(), &state).await?;
let token = next_flow.get_token(&state).await?;
let response = user_api::TokenResponse {
token: token.clone(),
token_type: next_flow.get_flow().into(),
};
auth::cookies::set_cookie_response(response, token)
}
#[cfg(feature = "email")]
pub async fn connect_account(
state: SessionState,
request: user_api::ConnectAccountRequest,
auth_id: Option<String>,
theme_id: Option<String>,
) -> UserResponse<user_api::ConnectAccountResponse> {
let user_email = domain::UserEmail::from_pii_email(request.email.clone())?;
utils::user::validate_email_domain_auth_type_using_db(
&state,
&user_email,
UserAuthType::MagicLink,
)
.await?;
let find_user = state.global_store.find_user_by_email(&user_email).await;
if let Ok(found_user) = find_user {
let user_from_db: domain::UserFromStorage = found_user.into();
let theme = theme_utils::get_theme_using_optional_theme_id(&state, theme_id).await?;
let email_contents = email_types::MagicLink {
recipient_email: domain::UserEmail::from_pii_email(user_from_db.get_email())?,
settings: state.conf.clone(),
user_name: domain::UserName::new(user_from_db.get_name())?,
auth_id,
theme_id: theme.as_ref().map(|theme| theme.theme_id.clone()),
theme_config: theme
.map(|theme| theme.email_config())
.unwrap_or(state.conf.theme.email_config.clone()),
};
let send_email_result = state
.email_client
.compose_and_send_email(
user_utils::get_base_url(&state),
Box::new(email_contents),
state.conf.proxy.https_url.as_ref(),
)
.await;
logger::info!(?send_email_result);
Ok(ApplicationResponse::Json(
user_api::ConnectAccountResponse {
is_email_sent: send_email_result.is_ok(),
user_id: user_from_db.get_user_id().to_string(),
},
))
} else if find_user
.as_ref()
.map_err(|e| e.current_context().is_db_not_found())
.err()
.unwrap_or(false)
{
if matches!(env::which(), env::Env::Production) {
return Err(report!(UserErrors::InvalidCredentials));
}
let new_user = domain::NewUser::try_from(request)?;
let _ = new_user
.get_new_merchant()
.get_new_organization()
.insert_org_in_db(state.clone())
.await?;
let user_from_db = new_user
.insert_user_and_merchant_in_db(state.clone())
.await?;
let _user_role = new_user
.insert_org_level_user_role_in_db(
state.clone(),
common_utils::consts::ROLE_ID_ORGANIZATION_ADMIN.to_string(),
UserStatus::Active,
)
.await?;
let theme = theme_utils::get_theme_using_optional_theme_id(&state, theme_id).await?;
let magic_link_email = email_types::VerifyEmail {
recipient_email: domain::UserEmail::from_pii_email(user_from_db.get_email())?,
settings: state.conf.clone(),
auth_id,
theme_id: theme.as_ref().map(|theme| theme.theme_id.clone()),
theme_config: theme
.map(|theme| theme.email_config())
.unwrap_or(state.conf.theme.email_config.clone()),
};
let magic_link_result = state
.email_client
.compose_and_send_email(
user_utils::get_base_url(&state),
Box::new(magic_link_email),
state.conf.proxy.https_url.as_ref(),
)
.await;
logger::info!(?magic_link_result);
if state.tenant.tenant_id.get_string_repr() == common_utils::consts::DEFAULT_TENANT {
let welcome_to_community_email = email_types::WelcomeToCommunity {
recipient_email: domain::UserEmail::from_pii_email(user_from_db.get_email())?,
};
let welcome_email_result = state
.email_client
.compose_and_send_email(
user_utils::get_base_url(&state),
Box::new(welcome_to_community_email),
state.conf.proxy.https_url.as_ref(),
)
.await;
logger::info!(?welcome_email_result);
}
Ok(ApplicationResponse::Json(
user_api::ConnectAccountResponse {
is_email_sent: magic_link_result.is_ok(),
user_id: user_from_db.get_user_id().to_string(),
},
))
} else {
Err(find_user
.err()
.map(|e| e.change_context(UserErrors::InternalServerError))
.unwrap_or(UserErrors::InternalServerError.into()))
}
}
pub async fn signout(
state: SessionState,
user_from_token: auth::UserIdFromAuth,
) -> UserResponse<()> {
tfa_utils::delete_totp_from_redis(&state, &user_from_token.user_id).await?;
tfa_utils::delete_recovery_code_from_redis(&state, &user_from_token.user_id).await?;
tfa_utils::delete_totp_secret_from_redis(&state, &user_from_token.user_id).await?;
auth::blacklist::insert_user_in_blacklist(&state, &user_from_token.user_id).await?;
auth::cookies::remove_cookie_response()
}
pub async fn change_password(
state: SessionState,
request: user_api::ChangePasswordRequest,
user_from_token: auth::UserFromToken,
) -> UserResponse<()> {
let user: domain::UserFromStorage = state
.global_store
.find_user_by_id(&user_from_token.user_id)
.await
.change_context(UserErrors::InternalServerError)?
.into();
user.compare_password(&request.old_password)
.change_context(UserErrors::InvalidOldPassword)?;
if request.old_password == request.new_password {
return Err(UserErrors::ChangePasswordError.into());
}
let new_password = domain::UserPassword::new(request.new_password)?;
let new_password_hash =
utils::user::password::generate_password_hash(new_password.get_secret())?;
let _ = state
.global_store
.update_user_by_user_id(
user.get_user_id(),
diesel_models::user::UserUpdate::PasswordUpdate {
password: new_password_hash,
},
)
.await
.change_context(UserErrors::InternalServerError)?;
let _ = auth::blacklist::insert_user_in_blacklist(&state, user.get_user_id())
.await
.map_err(|error| logger::error!(?error));
#[cfg(not(feature = "email"))]
{
state
.store
.delete_user_scoped_dashboard_metadata_by_merchant_id_data_key(
&user_from_token.user_id,
&user_from_token.merchant_id,
diesel_models::enums::DashboardMetadata::IsChangePasswordRequired,
)
.await
.map_err(|e| logger::error!("Error while deleting dashboard metadata {e:?}"))
.ok();
}
Ok(ApplicationResponse::StatusOk)
}
#[cfg(feature = "email")]
pub async fn forgot_password(
state: SessionState,
request: user_api::ForgotPasswordRequest,
auth_id: Option<String>,
theme_id: Option<String>,
) -> UserResponse<()> {
let user_email = domain::UserEmail::from_pii_email(request.email)?;
utils::user::validate_email_domain_auth_type_using_db(
&state,
&user_email,
UserAuthType::Password,
)
.await?;
let user_from_db = state
.global_store
.find_user_by_email(&user_email)
.await
.map_err(|e| {
if e.current_context().is_db_not_found() {
e.change_context(UserErrors::UserNotFound)
} else {
e.change_context(UserErrors::InternalServerError)
}
})
.map(domain::UserFromStorage::from)?;
let theme = theme_utils::get_theme_using_optional_theme_id(&state, theme_id).await?;
let email_contents = email_types::ResetPassword {
recipient_email: domain::UserEmail::from_pii_email(user_from_db.get_email())?,
settings: state.conf.clone(),
user_name: domain::UserName::new(user_from_db.get_name())?,
auth_id,
theme_id: theme.as_ref().map(|theme| theme.theme_id.clone()),
theme_config: theme
.map(|theme| theme.email_config())
.unwrap_or(state.conf.theme.email_config.clone()),
};
state
.email_client
.compose_and_send_email(
user_utils::get_base_url(&state),
Box::new(email_contents),
state.conf.proxy.https_url.as_ref(),
)
.await
.map_err(|e| e.change_context(UserErrors::InternalServerError))?;
Ok(ApplicationResponse::StatusOk)
}
pub async fn rotate_password(
state: SessionState,
user_token: auth::UserFromSinglePurposeToken,
request: user_api::RotatePasswordRequest,
_req_state: ReqState,
) -> UserResponse<()> {
let user: domain::UserFromStorage = state
.global_store
.find_user_by_id(&user_token.user_id)
.await
.change_context(UserErrors::InternalServerError)?
.into();
let password = domain::UserPassword::new(request.password.to_owned())?;
let hash_password = utils::user::password::generate_password_hash(password.get_secret())?;
if user.compare_password(&request.password).is_ok() {
return Err(UserErrors::ChangePasswordError.into());
}
let user = state
.global_store
.update_user_by_user_id(
&user_token.user_id,
storage_user::UserUpdate::PasswordUpdate {
password: hash_password,
},
)
.await
.change_context(UserErrors::InternalServerError)?;
let _ = auth::blacklist::insert_user_in_blacklist(&state, &user.user_id)
.await
.map_err(|error| logger::error!(?error));
auth::cookies::remove_cookie_response()
}
#[cfg(feature = "email")]
pub async fn reset_password_token_only_flow(
state: SessionState,
user_token: auth::UserFromSinglePurposeToken,
request: user_api::ResetPasswordRequest,
) -> UserResponse<()> {
let token = request.token.expose();
let email_token = auth::decode_jwt::<email_types::EmailToken>(&token, &state)
.await
.change_context(UserErrors::LinkInvalid)?;
auth::blacklist::check_email_token_in_blacklist(&state, &token).await?;
let user_from_db: domain::UserFromStorage = state
.global_store
.find_user_by_email(&email_token.get_email()?)
.await
.change_context(UserErrors::InternalServerError)?
.into();
if user_from_db.get_user_id() != user_token.user_id {
return Err(UserErrors::LinkInvalid.into());
}
let password = domain::UserPassword::new(request.password)?;
let hash_password = utils::user::password::generate_password_hash(password.get_secret())?;
let user = state
.global_store
.update_user_by_user_id(
user_from_db.get_user_id(),
storage_user::UserUpdate::PasswordUpdate {
password: hash_password,
},
)
.await
.change_context(UserErrors::InternalServerError)?;
if !user_from_db.is_verified() {
let _ = state
.global_store
.update_user_by_user_id(
user_from_db.get_user_id(),
storage_user::UserUpdate::VerifyUser,
)
.await
.map_err(|error| logger::error!(?error));
}
let _ = auth::blacklist::insert_email_token_in_blacklist(&state, &token)
.await
.map_err(|error| logger::error!(?error));
let _ = auth::blacklist::insert_user_in_blacklist(&state, &user.user_id)
.await
.map_err(|error| logger::error!(?error));
auth::cookies::remove_cookie_response()
}
pub async fn invite_multiple_user(
state: SessionState,
user_from_token: auth::UserFromToken,
requests: Vec<user_api::InviteUserRequest>,
req_state: ReqState,
auth_id: Option<String>,
) -> UserResponse<Vec<InviteMultipleUserResponse>> {
if requests.len() > 10 {
return Err(report!(UserErrors::MaxInvitationsError))
.attach_printable("Number of invite requests must not exceed 10");
}
let responses = futures::future::join_all(requests.into_iter().map(|request| async {
match handle_invitation(&state, &user_from_token, &request, &req_state, &auth_id).await {
Ok(response) => response,
Err(error) => {
logger::error!(invite_error=?error);
InviteMultipleUserResponse {
email: request.email,
is_email_sent: false,
password: None,
error: Some(error.current_context().get_error_message().to_string()),
}
}
}
}))
.await;
Ok(ApplicationResponse::Json(responses))
}
async fn handle_invitation(
state: &SessionState,
user_from_token: &auth::UserFromToken,
request: &user_api::InviteUserRequest,
req_state: &ReqState,
auth_id: &Option<String>,
) -> UserResult<InviteMultipleUserResponse> {
let inviter_user = user_from_token.get_user_from_db(state).await?;
if inviter_user.get_email() == request.email {
return Err(UserErrors::InvalidRoleOperationWithMessage(
"User Inviting themselves".to_string(),
)
.into());
}
let role_info = roles::RoleInfo::from_role_id_in_lineage(
state,
&request.role_id,
&user_from_token.merchant_id,
&user_from_token.org_id,
&user_from_token.profile_id,
user_from_token
.tenant_id
.as_ref()
.unwrap_or(&state.tenant.tenant_id),
)
.await
.to_not_found_response(UserErrors::InvalidRoleId)?;
if !role_info.is_invitable() {
return Err(report!(UserErrors::InvalidRoleId))
.attach_printable(format!("role_id = {} is not invitable", request.role_id));
}
let invitee_email = domain::UserEmail::from_pii_email(request.email.clone())?;
let invitee_user = state.global_store.find_user_by_email(&invitee_email).await;
if let Ok(invitee_user) = invitee_user {
handle_existing_user_invitation(
state,
user_from_token,
request,
invitee_user.into(),
role_info,
auth_id,
)
.await
} else if invitee_user
.as_ref()
.map_err(|e| e.current_context().is_db_not_found())
.err()
.unwrap_or(false)
{
handle_new_user_invitation(
state,
user_from_token,
request,
role_info,
req_state.clone(),
auth_id,
)
.await
} else {
Err(UserErrors::InternalServerError.into())
}
}
#[allow(unused_variables)]
async fn handle_existing_user_invitation(
state: &SessionState,
user_from_token: &auth::UserFromToken,
request: &user_api::InviteUserRequest,
invitee_user_from_db: domain::UserFromStorage,
role_info: roles::RoleInfo,
auth_id: &Option<String>,
) -> UserResult<InviteMultipleUserResponse> {
let now = common_utils::date_time::now();
if state
.global_store
.find_user_role_by_user_id_and_lineage(
invitee_user_from_db.get_user_id(),
user_from_token
.tenant_id
.as_ref()
.unwrap_or(&state.tenant.tenant_id),
&user_from_token.org_id,
&user_from_token.merchant_id,
&user_from_token.profile_id,
UserRoleVersion::V1,
)
.await
.is_err_and(|err| err.current_context().is_db_not_found())
.not()
{
return Err(UserErrors::UserExists.into());
}
if state
.global_store
.find_user_role_by_user_id_and_lineage(
invitee_user_from_db.get_user_id(),
user_from_token
.tenant_id
.as_ref()
.unwrap_or(&state.tenant.tenant_id),
&user_from_token.org_id,
&user_from_token.merchant_id,
&user_from_token.profile_id,
UserRoleVersion::V2,
)
.await
.is_err_and(|err| err.current_context().is_db_not_found())
.not()
{
return Err(UserErrors::UserExists.into());
}
let (org_id, merchant_id, profile_id) = match role_info.get_entity_type() {
EntityType::Tenant => {
return Err(UserErrors::InvalidRoleOperationWithMessage(
"Tenant roles are not allowed for this operation".to_string(),
)
.into());
}
EntityType::Organization => (Some(&user_from_token.org_id), None, None),
EntityType::Merchant => (
Some(&user_from_token.org_id),
Some(&user_from_token.merchant_id),
None,
),
EntityType::Profile => (
Some(&user_from_token.org_id),
Some(&user_from_token.merchant_id),
Some(&user_from_token.profile_id),
),
};
if state
.global_store
.list_user_roles_by_user_id(ListUserRolesByUserIdPayload {
user_id: invitee_user_from_db.get_user_id(),
tenant_id: user_from_token
.tenant_id
.as_ref()
.unwrap_or(&state.tenant.tenant_id),
org_id,
merchant_id,
profile_id,
entity_id: None,
version: None,
status: None,
limit: Some(1),
})
.await
.is_ok_and(|data| data.is_empty().not())
{
return Err(UserErrors::UserExists.into());
}
let user_role = domain::NewUserRole {
user_id: invitee_user_from_db.get_user_id().to_owned(),
role_id: request.role_id.clone(),
status: {
if cfg!(feature = "email") {
UserStatus::InvitationSent
} else {
UserStatus::Active
}
},
created_by: user_from_token.user_id.clone(),
last_modified_by: user_from_token.user_id.clone(),
created_at: now,
last_modified: now,
entity: domain::NoLevel,
};
let _user_role = match role_info.get_entity_type() {
EntityType::Tenant => {
return Err(UserErrors::InvalidRoleOperationWithMessage(
"Tenant roles are not allowed for this operation".to_string(),
)
.into());
}
EntityType::Organization => {
user_role
.add_entity(domain::OrganizationLevel {
tenant_id: user_from_token
.tenant_id
.clone()
.unwrap_or(state.tenant.tenant_id.clone()),
org_id: user_from_token.org_id.clone(),
})
.insert_in_v2(state)
.await?
}
EntityType::Merchant => {
user_role
.add_entity(domain::MerchantLevel {
tenant_id: user_from_token
.tenant_id
.clone()
.unwrap_or(state.tenant.tenant_id.clone()),
org_id: user_from_token.org_id.clone(),
merchant_id: user_from_token.merchant_id.clone(),
})
.insert_in_v2(state)
.await?
}
EntityType::Profile => {
user_role
.add_entity(domain::ProfileLevel {
tenant_id: user_from_token
.tenant_id
.clone()
.unwrap_or(state.tenant.tenant_id.clone()),
org_id: user_from_token.org_id.clone(),
merchant_id: user_from_token.merchant_id.clone(),
profile_id: user_from_token.profile_id.clone(),
})
.insert_in_v2(state)
.await?
}
};
let is_email_sent;
#[cfg(feature = "email")]
{
let invitee_email = domain::UserEmail::from_pii_email(request.email.clone())?;
let entity = match role_info.get_entity_type() {
EntityType::Tenant => {
return Err(UserErrors::InvalidRoleOperationWithMessage(
"Tenant roles are not allowed for this operation".to_string(),
)
.into());
}
EntityType::Organization => email_types::Entity {
entity_id: user_from_token.org_id.get_string_repr().to_owned(),
entity_type: EntityType::Organization,
},
EntityType::Merchant => email_types::Entity {
entity_id: user_from_token.merchant_id.get_string_repr().to_owned(),
entity_type: EntityType::Merchant,
},
EntityType::Profile => email_types::Entity {
entity_id: user_from_token.profile_id.get_string_repr().to_owned(),
entity_type: EntityType::Profile,
},
};
let theme = theme_utils::get_most_specific_theme_using_token_and_min_entity(
state,
user_from_token,
role_info.get_entity_type(),
)
.await?;
let email_contents = email_types::InviteUser {
recipient_email: invitee_email,
user_name: domain::UserName::new(invitee_user_from_db.get_name())?,
settings: state.conf.clone(),
entity,
auth_id: auth_id.clone(),
theme_id: theme.as_ref().map(|theme| theme.theme_id.clone()),
theme_config: theme
.map(|theme| theme.email_config())
.unwrap_or(state.conf.theme.email_config.clone()),
};
is_email_sent = state
.email_client
.compose_and_send_email(
user_utils::get_base_url(state),
Box::new(email_contents),
state.conf.proxy.https_url.as_ref(),
)
.await
.map(|email_result| logger::info!(?email_result))
.map_err(|email_result| logger::error!(?email_result))
.is_ok();
}
#[cfg(not(feature = "email"))]
{
is_email_sent = false;
}
Ok(InviteMultipleUserResponse {
email: request.email.clone(),
is_email_sent,
password: None,
error: None,
})
}
#[allow(unused_variables)]
async fn handle_new_user_invitation(
state: &SessionState,
user_from_token: &auth::UserFromToken,
request: &user_api::InviteUserRequest,
role_info: roles::RoleInfo,
req_state: ReqState,
auth_id: &Option<String>,
) -> UserResult<InviteMultipleUserResponse> {
let new_user = domain::NewUser::try_from((request.clone(), user_from_token.clone()))?;
new_user
.insert_user_in_db(state.global_store.as_ref())
.await
.change_context(UserErrors::InternalServerError)?;
let invitation_status = if cfg!(feature = "email") {
UserStatus::InvitationSent
} else {
UserStatus::Active
};
let now = common_utils::date_time::now();
let user_role = domain::NewUserRole {
user_id: new_user.get_user_id().to_owned(),
role_id: request.role_id.clone(),
status: invitation_status,
created_by: user_from_token.user_id.clone(),
last_modified_by: user_from_token.user_id.clone(),
created_at: now,
last_modified: now,
entity: domain::NoLevel,
};
let _user_role = match role_info.get_entity_type() {
EntityType::Tenant => {
return Err(UserErrors::InvalidRoleOperationWithMessage(
"Tenant roles are not allowed for this operation".to_string(),
)
.into());
}
EntityType::Organization => {
user_role
.add_entity(domain::OrganizationLevel {
tenant_id: user_from_token
.tenant_id
.clone()
.unwrap_or(state.tenant.tenant_id.clone()),
org_id: user_from_token.org_id.clone(),
})
.insert_in_v2(state)
.await?
}
EntityType::Merchant => {
user_role
.add_entity(domain::MerchantLevel {
tenant_id: user_from_token
.tenant_id
.clone()
.unwrap_or(state.tenant.tenant_id.clone()),
org_id: user_from_token.org_id.clone(),
merchant_id: user_from_token.merchant_id.clone(),
})
.insert_in_v2(state)
.await?
}
EntityType::Profile => {
user_role
.add_entity(domain::ProfileLevel {
tenant_id: user_from_token
.tenant_id
.clone()
.unwrap_or(state.tenant.tenant_id.clone()),
org_id: user_from_token.org_id.clone(),
merchant_id: user_from_token.merchant_id.clone(),
profile_id: user_from_token.profile_id.clone(),
})
.insert_in_v2(state)
.await?
}
};
let is_email_sent;
#[cfg(feature = "email")]
{
// TODO: Adding this to avoid clippy lints
// Will be adding actual usage for this variable later
let _ = req_state.clone();
let invitee_email = domain::UserEmail::from_pii_email(request.email.clone())?;
let entity = match role_info.get_entity_type() {
EntityType::Tenant => {
return Err(UserErrors::InvalidRoleOperationWithMessage(
"Tenant roles are not allowed for this operation".to_string(),
)
.into());
}
EntityType::Organization => email_types::Entity {
entity_id: user_from_token.org_id.get_string_repr().to_owned(),
entity_type: EntityType::Organization,
},
EntityType::Merchant => email_types::Entity {
entity_id: user_from_token.merchant_id.get_string_repr().to_owned(),
entity_type: EntityType::Merchant,
},
EntityType::Profile => email_types::Entity {
entity_id: user_from_token.profile_id.get_string_repr().to_owned(),
entity_type: EntityType::Profile,
},
};
let theme = theme_utils::get_most_specific_theme_using_token_and_min_entity(
state,
user_from_token,
role_info.get_entity_type(),
)
.await?;
let email_contents = email_types::InviteUser {
recipient_email: invitee_email,
user_name: domain::UserName::new(new_user.get_name())?,
settings: state.conf.clone(),
entity,
auth_id: auth_id.clone(),
theme_id: theme.as_ref().map(|theme| theme.theme_id.clone()),
theme_config: theme
.map(|theme| theme.email_config())
.unwrap_or(state.conf.theme.email_config.clone()),
};
let send_email_result = state
.email_client
.compose_and_send_email(
user_utils::get_base_url(state),
Box::new(email_contents),
state.conf.proxy.https_url.as_ref(),
)
.await;
logger::info!(?send_email_result);
is_email_sent = send_email_result.is_ok();
}
#[cfg(not(feature = "email"))]
{
is_email_sent = false;
let invited_user_token = auth::UserFromToken {
user_id: new_user.get_user_id(),
merchant_id: user_from_token.merchant_id.clone(),
org_id: user_from_token.org_id.clone(),
role_id: request.role_id.clone(),
profile_id: user_from_token.profile_id.clone(),
tenant_id: user_from_token.tenant_id.clone(),
};
let set_metadata_request = SetMetaDataRequest::IsChangePasswordRequired;
dashboard_metadata::set_metadata(
state.clone(),
invited_user_token,
set_metadata_request,
req_state,
)
.await?;
}
Ok(InviteMultipleUserResponse {
is_email_sent,
password: new_user
.get_password()
.map(|password| password.get_secret()),
|
crates/router/src/core/user.rs#chunk0
|
router
|
chunk
| null | null | null | 8,188
| null | null | null | null | null | null | null |
// Function: get_sankey_data
// File: crates/analytics/src/auth_events/sankey.rs
// Module: analytics
pub fn get_sankey_data(
clickhouse_client: &ClickhouseClient,
auth: &AuthInfo,
time_range: &TimeRange,
) -> MetricsResult<Vec<SankeyRow>>
|
crates/analytics/src/auth_events/sankey.rs
|
analytics
|
function_signature
| null | null | null | 69
|
get_sankey_data
| null | null | null | null | null | null |
// Struct: VoltErrorList
// File: crates/hyperswitch_connectors/src/connectors/volt/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct VoltErrorList
|
crates/hyperswitch_connectors/src/connectors/volt/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
VoltErrorList
| 0
|
[] | 47
| null | null | null | null | null | null | null |
// Struct: LoonioRedirectUrl
// File: crates/hyperswitch_connectors/src/connectors/loonio/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct LoonioRedirectUrl
|
crates/hyperswitch_connectors/src/connectors/loonio/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
LoonioRedirectUrl
| 0
|
[] | 50
| null | null | null | null | null | null | null |
// Struct: Address
// File: crates/hyperswitch_connectors/src/connectors/signifyd/transformers/api.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct Address
|
crates/hyperswitch_connectors/src/connectors/signifyd/transformers/api.rs
|
hyperswitch_connectors
|
struct_definition
|
Address
| 0
|
[] | 45
| null | null | null | null | null | null | null |
// Struct: PurchaseUnitItem
// File: crates/hyperswitch_connectors/src/connectors/paypal/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct PurchaseUnitItem
|
crates/hyperswitch_connectors/src/connectors/paypal/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
PurchaseUnitItem
| 0
|
[] | 47
| null | null | null | null | null | null | null |
// Struct: UpiCollectAdditionalData
// File: crates/api_models/src/payments/additional_info.rs
// Module: api_models
// Implementations: 0
pub struct UpiCollectAdditionalData
|
crates/api_models/src/payments/additional_info.rs
|
api_models
|
struct_definition
|
UpiCollectAdditionalData
| 0
|
[] | 43
| null | null | null | null | null | null | null |
// Struct: PixInfo
// File: crates/hyperswitch_connectors/src/connectors/facilitapay/responses.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct PixInfo
|
crates/hyperswitch_connectors/src/connectors/facilitapay/responses.rs
|
hyperswitch_connectors
|
struct_definition
|
PixInfo
| 0
|
[] | 47
| null | null | null | null | null | null | null |
// Function: get_request_extended_authorization_bool_if_connector_supports
// File: crates/hyperswitch_domain_models/src/payments.rs
// Module: hyperswitch_domain_models
pub fn get_request_extended_authorization_bool_if_connector_supports(
&self,
connector: common_enums::connector_enums::Connector,
always_request_extended_authorization_optional: Option<AlwaysRequestExtendedAuthorization>,
payment_method_optional: Option<common_enums::PaymentMethod>,
payment_method_type_optional: Option<common_enums::PaymentMethodType>,
) -> Option<RequestExtendedAuthorizationBool>
|
crates/hyperswitch_domain_models/src/payments.rs
|
hyperswitch_domain_models
|
function_signature
| null | null | null | 122
|
get_request_extended_authorization_bool_if_connector_supports
| null | null | null | null | null | null |
// Struct: StripebillingPaymentsResponse
// File: crates/hyperswitch_connectors/src/connectors/stripebilling/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct StripebillingPaymentsResponse
|
crates/hyperswitch_connectors/src/connectors/stripebilling/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
StripebillingPaymentsResponse
| 0
|
[] | 50
| null | null | null | null | null | null | null |
// Implementation: impl fmt::Debug for for DenseMap
// File: crates/hyperswitch_constraint_graph/src/dense_map.rs
// Module: hyperswitch_constraint_graph
// Methods: 1 total (0 public)
impl fmt::Debug for for DenseMap
|
crates/hyperswitch_constraint_graph/src/dense_map.rs
|
hyperswitch_constraint_graph
|
impl_block
| null | null | null | 54
| null |
DenseMap
|
fmt::Debug for
| 1
| 0
| null | null |
// Implementation: impl api::ExternalVaultRetrieve for for Tokenex
// File: crates/hyperswitch_connectors/src/connectors/tokenex.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::ExternalVaultRetrieve for for Tokenex
|
crates/hyperswitch_connectors/src/connectors/tokenex.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 59
| null |
Tokenex
|
api::ExternalVaultRetrieve for
| 0
| 0
| null | null |
// Implementation: impl api::ExternalVaultInsert for for Tokenex
// File: crates/hyperswitch_connectors/src/connectors/tokenex.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::ExternalVaultInsert for for Tokenex
|
crates/hyperswitch_connectors/src/connectors/tokenex.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 59
| null |
Tokenex
|
api::ExternalVaultInsert for
| 0
| 0
| null | null |
// Implementation: impl MergedEnabledPaymentMethodTypes
// File: crates/router/src/core/payments/payment_methods.rs
// Module: router
// Methods: 1 total (0 public)
impl MergedEnabledPaymentMethodTypes
|
crates/router/src/core/payments/payment_methods.rs
|
router
|
impl_block
| null | null | null | 46
| null |
MergedEnabledPaymentMethodTypes
| null | 1
| 0
| null | null |
// Struct: CheckoutRequest
// File: crates/hyperswitch_connectors/src/connectors/zen/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct CheckoutRequest
|
crates/hyperswitch_connectors/src/connectors/zen/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
CheckoutRequest
| 0
|
[] | 45
| null | null | null | null | null | null | null |
// Function: check_token_status_with_tokenization_service
// File: crates/router/src/core/payment_methods/network_tokenization.rs
// Module: router
pub fn check_token_status_with_tokenization_service(
_state: &routes::SessionState,
_customer_id: &id_type::GlobalCustomerId,
_network_token_requestor_reference_id: String,
_tokenization_service: &settings::NetworkTokenizationService,
) -> CustomResult<(Option<Secret<String>>, Option<Secret<String>>), errors::NetworkTokenizationError>
|
crates/router/src/core/payment_methods/network_tokenization.rs
|
router
|
function_signature
| null | null | null | 110
|
check_token_status_with_tokenization_service
| null | null | null | null | null | null |
// Struct: TesouroPaymentsResponse
// File: crates/hyperswitch_connectors/src/connectors/tesouro/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct TesouroPaymentsResponse
|
crates/hyperswitch_connectors/src/connectors/tesouro/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
TesouroPaymentsResponse
| 0
|
[] | 50
| null | null | null | null | null | null | null |
// Struct: DebitRoutingRequestData
// File: crates/api_models/src/open_router.rs
// Module: api_models
// Implementations: 0
pub struct DebitRoutingRequestData
|
crates/api_models/src/open_router.rs
|
api_models
|
struct_definition
|
DebitRoutingRequestData
| 0
|
[] | 40
| null | null | null | null | null | null | null |
// Function: combine
// File: crates/hyperswitch_constraint_graph/src/graph.rs
// Module: hyperswitch_constraint_graph
pub fn combine(g1: &Self, g2: &Self) -> Result<Self, GraphError<V>>
|
crates/hyperswitch_constraint_graph/src/graph.rs
|
hyperswitch_constraint_graph
|
function_signature
| null | null | null | 50
|
combine
| null | null | null | null | null | null |
// Struct: PaymentMethodsSessionUpdateRequest
// File: crates/api_models/src/payment_methods.rs
// Module: api_models
// Implementations: 0
pub struct PaymentMethodsSessionUpdateRequest
|
crates/api_models/src/payment_methods.rs
|
api_models
|
struct_definition
|
PaymentMethodsSessionUpdateRequest
| 0
|
[] | 40
| null | null | null | null | null | null | null |
// File: crates/router/src/workflows/refund_router.rs
// Module: router
// Public structs: 1
use scheduler::consumer::workflows::ProcessTrackerWorkflow;
#[cfg(feature = "v1")]
use crate::core::refunds as refund_flow;
use crate::{errors, logger::error, routes::SessionState, types::storage};
pub struct RefundWorkflowRouter;
#[async_trait::async_trait]
impl ProcessTrackerWorkflow<SessionState> for RefundWorkflowRouter {
#[cfg(feature = "v1")]
async fn execute_workflow<'a>(
&'a self,
state: &'a SessionState,
process: storage::ProcessTracker,
) -> Result<(), errors::ProcessTrackerError> {
Ok(Box::pin(refund_flow::start_refund_workflow(state, &process)).await?)
}
#[cfg(feature = "v2")]
async fn execute_workflow<'a>(
&'a self,
_state: &'a SessionState,
_process: storage::ProcessTracker,
) -> Result<(), errors::ProcessTrackerError> {
todo!()
}
async fn error_handler<'a>(
&'a self,
_state: &'a SessionState,
process: storage::ProcessTracker,
_error: errors::ProcessTrackerError,
) -> errors::CustomResult<(), errors::ProcessTrackerError> {
error!(%process.id, "Failed while executing workflow");
Ok(())
}
}
|
crates/router/src/workflows/refund_router.rs
|
router
|
full_file
| null | null | null | 306
| null | null | null | null | null | null | null |
// Function: profile_id
// File: crates/common_utils/src/types/user/theme.rs
// Module: common_utils
// Documentation: Get the profile_id from the lineage
pub fn profile_id(&self) -> Option<&id_type::ProfileId>
|
crates/common_utils/src/types/user/theme.rs
|
common_utils
|
function_signature
| null | null | null | 51
|
profile_id
| null | null | null | null | null | null |
// Function: find_by_profile_id_connector_name
// File: crates/diesel_models/src/query/merchant_connector_account.rs
// Module: diesel_models
pub fn find_by_profile_id_connector_name(
conn: &PgPooledConn,
profile_id: &common_utils::id_type::ProfileId,
connector_name: &str,
) -> StorageResult<Self>
|
crates/diesel_models/src/query/merchant_connector_account.rs
|
diesel_models
|
function_signature
| null | null | null | 77
|
find_by_profile_id_connector_name
| null | null | null | null | null | null |
// Function: transfer_user_key_store_keymanager
// File: crates/router/src/core/user.rs
// Module: router
pub fn transfer_user_key_store_keymanager(
state: SessionState,
req: user_api::UserKeyTransferRequest,
) -> UserResponse<user_api::UserTransferKeyResponse>
|
crates/router/src/core/user.rs
|
router
|
function_signature
| null | null | null | 64
|
transfer_user_key_store_keymanager
| null | null | null | null | null | null |
// Function: master_key
// File: crates/storage_impl/src/kv_router_store.rs
// Module: storage_impl
pub fn master_key(&self) -> &StrongSecret<Vec<u8>>
|
crates/storage_impl/src/kv_router_store.rs
|
storage_impl
|
function_signature
| null | null | null | 40
|
master_key
| null | null | null | null | null | null |
// Function: validate
// File: crates/analytics/src/opensearch.rs
// Module: analytics
pub fn validate(&self) -> Result<(), ApplicationError>
|
crates/analytics/src/opensearch.rs
|
analytics
|
function_signature
| null | null | null | 34
|
validate
| null | null | null | null | null | null |
// Implementation: impl GetRequestIncrementalAuthorization for for PaymentsSyncData
// File: crates/hyperswitch_connectors/src/connectors/paypal/transformers.rs
// Module: hyperswitch_connectors
// Methods: 1 total (0 public)
impl GetRequestIncrementalAuthorization for for PaymentsSyncData
|
crates/hyperswitch_connectors/src/connectors/paypal/transformers.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 64
| null |
PaymentsSyncData
|
GetRequestIncrementalAuthorization for
| 1
| 0
| null | null |
// File: crates/api_models/src/connector_enums.rs
// Module: api_models
pub use common_enums::connector_enums::Connector;
|
crates/api_models/src/connector_enums.rs
|
api_models
|
full_file
| null | null | null | 31
| null | null | null | null | null | null | null |
// Implementation: impl ContractBasedRoutingConfig
// File: crates/api_models/src/routing.rs
// Module: api_models
// Methods: 1 total (1 public)
impl ContractBasedRoutingConfig
|
crates/api_models/src/routing.rs
|
api_models
|
impl_block
| null | null | null | 41
| null |
ContractBasedRoutingConfig
| null | 1
| 1
| null | null |
// Struct: CountAccumulator
// File: crates/analytics/src/auth_events/accumulator.rs
// Module: analytics
// Implementations: 1
// Traits: AuthEventMetricAccumulator
pub struct CountAccumulator
|
crates/analytics/src/auth_events/accumulator.rs
|
analytics
|
struct_definition
|
CountAccumulator
| 1
|
[
"AuthEventMetricAccumulator"
] | 49
| null | null | null | null | null | null | null |
// Struct: BankOfAmericaConsumerAuthInformation
// File: crates/hyperswitch_connectors/src/connectors/bankofamerica/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct BankOfAmericaConsumerAuthInformation
|
crates/hyperswitch_connectors/src/connectors/bankofamerica/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
BankOfAmericaConsumerAuthInformation
| 0
|
[] | 56
| null | null | null | null | null | null | null |
path: web::Path<common_utils::id_type::PaymentId>,
) -> impl Responder {
let flow = Flow::PaymentsExternalAuthentication;
let mut payload = json_payload.into_inner();
let payment_id = path.into_inner();
tracing::Span::current().record("payment_id", payment_id.get_string_repr());
payload.payment_id = payment_id;
let locking_action = payload.get_locking_input(flow.clone());
Box::pin(api::server_wrap(
flow,
state,
&req,
payload,
|state, auth: auth::AuthenticationData, req, _| {
let merchant_context = domain::MerchantContext::NormalMerchant(Box::new(
domain::Context(auth.merchant_account, auth.key_store),
));
payments::payment_external_authentication::<
hyperswitch_domain_models::router_flow_types::Authenticate,
>(state, merchant_context, req)
},
&auth::HeaderAuth(auth::PublishableKeyAuth),
locking_action,
))
.await
}
#[cfg(feature = "v1")]
#[instrument(skip_all, fields(flow = ?Flow::PaymentsAuthorize, payment_id))]
pub async fn post_3ds_payments_authorize(
state: web::Data<app::AppState>,
req: actix_web::HttpRequest,
json_payload: Option<web::Form<serde_json::Value>>,
path: web::Path<(
common_utils::id_type::PaymentId,
common_utils::id_type::MerchantId,
String,
)>,
) -> impl Responder {
let flow = Flow::PaymentsAuthorize;
let (payment_id, merchant_id, connector) = path.into_inner();
tracing::Span::current().record("payment_id", payment_id.get_string_repr());
let param_string = req.query_string();
let payload = payments::PaymentsRedirectResponseData {
resource_id: payment_types::PaymentIdType::PaymentIntentId(payment_id),
merchant_id: Some(merchant_id.clone()),
force_sync: true,
json_payload: json_payload.map(|payload| payload.0),
param: Some(param_string.to_string()),
connector: Some(connector),
creds_identifier: None,
};
let locking_action = payload.get_locking_input(flow.clone());
Box::pin(api::server_wrap(
flow,
state,
&req,
payload,
|state, auth: auth::AuthenticationData, req, req_state| {
let merchant_context = domain::MerchantContext::NormalMerchant(Box::new(
domain::Context(auth.merchant_account, auth.key_store),
));
<payments::PaymentAuthenticateCompleteAuthorize as PaymentRedirectFlow>::handle_payments_redirect_response(
&payments::PaymentAuthenticateCompleteAuthorize {},
state,
req_state,
merchant_context,
req,
)
},
&auth::MerchantIdAuth(merchant_id),
locking_action,
))
.await
}
#[cfg(all(feature = "olap", feature = "v1"))]
pub async fn payments_manual_update(
state: web::Data<app::AppState>,
req: actix_web::HttpRequest,
json_payload: web::Json<payment_types::PaymentsManualUpdateRequest>,
path: web::Path<common_utils::id_type::PaymentId>,
) -> impl Responder {
let flow = Flow::PaymentsManualUpdate;
let mut payload = json_payload.into_inner();
let payment_id = path.into_inner();
let locking_action = payload.get_locking_input(flow.clone());
tracing::Span::current().record("payment_id", payment_id.get_string_repr());
payload.payment_id = payment_id;
Box::pin(api::server_wrap(
flow,
state,
&req,
payload,
|state, _auth, req, _req_state| payments::payments_manual_update(state, req),
&auth::AdminApiAuthWithMerchantIdFromHeader,
locking_action,
))
.await
}
#[cfg(feature = "v1")]
/// Retrieve endpoint for merchant to fetch the encrypted customer payment method data
#[instrument(skip_all, fields(flow = ?Flow::GetExtendedCardInfo, payment_id))]
pub async fn retrieve_extended_card_info(
state: web::Data<app::AppState>,
req: actix_web::HttpRequest,
path: web::Path<common_utils::id_type::PaymentId>,
) -> impl Responder {
let flow = Flow::GetExtendedCardInfo;
let payment_id = path.into_inner();
Box::pin(api::server_wrap(
flow,
state,
&req,
payment_id,
|state, auth: auth::AuthenticationData, payment_id, _| {
let merchant_context = domain::MerchantContext::NormalMerchant(Box::new(
domain::Context(auth.merchant_account, auth.key_store),
));
payments::get_extended_card_info(
state,
merchant_context.get_merchant_account().get_id().to_owned(),
payment_id,
)
},
&auth::HeaderAuth(auth::ApiKeyAuth {
is_connected_allowed: false,
is_platform_allowed: true,
}),
api_locking::LockAction::NotApplicable,
))
.await
}
#[cfg(feature = "v1")]
pub fn get_or_generate_payment_id(
payload: &mut payment_types::PaymentsRequest,
) -> errors::RouterResult<()> {
let given_payment_id = payload
.payment_id
.clone()
.map(|payment_id| {
payment_id
.get_payment_intent_id()
.map_err(|err| err.change_context(errors::ApiErrorResponse::PaymentNotFound))
})
.transpose()?;
let payment_id = given_payment_id.unwrap_or(common_utils::id_type::PaymentId::default());
payload.is_payment_id_from_merchant = matches!(
&payload.payment_id,
Some(payment_types::PaymentIdType::PaymentIntentId(_))
);
payload.payment_id = Some(api_models::payments::PaymentIdType::PaymentIntentId(
payment_id,
));
Ok(())
}
#[cfg(feature = "v1")]
impl GetLockingInput for payment_types::PaymentsRequest {
fn get_locking_input<F>(&self, flow: F) -> api_locking::LockAction
where
F: types::FlowMetric,
lock_utils::ApiIdentifier: From<F>,
{
match self.payment_id {
Some(payment_types::PaymentIdType::PaymentIntentId(ref id)) => {
let api_identifier = lock_utils::ApiIdentifier::from(flow);
let intent_id_locking_input = api_locking::LockingInput {
unique_locking_key: id.get_string_repr().to_owned(),
api_identifier: api_identifier.clone(),
override_lock_retries: None,
};
if let Some(customer_id) = self
.customer_id
.as_ref()
.or(self.customer.as_ref().map(|customer| &customer.id))
{
api_locking::LockAction::HoldMultiple {
inputs: vec![
intent_id_locking_input,
api_locking::LockingInput {
unique_locking_key: customer_id.get_string_repr().to_owned(),
api_identifier,
override_lock_retries: None,
},
],
}
} else {
api_locking::LockAction::Hold {
input: intent_id_locking_input,
}
}
}
_ => api_locking::LockAction::NotApplicable,
}
}
}
#[cfg(feature = "v1")]
impl GetLockingInput for payment_types::PaymentsStartRequest {
fn get_locking_input<F>(&self, flow: F) -> api_locking::LockAction
where
F: types::FlowMetric,
lock_utils::ApiIdentifier: From<F>,
{
api_locking::LockAction::Hold {
input: api_locking::LockingInput {
unique_locking_key: self.payment_id.get_string_repr().to_owned(),
api_identifier: lock_utils::ApiIdentifier::from(flow),
override_lock_retries: None,
},
}
}
}
#[cfg(feature = "v1")]
impl GetLockingInput for payment_types::PaymentsRetrieveRequest {
fn get_locking_input<F>(&self, flow: F) -> api_locking::LockAction
where
F: types::FlowMetric,
lock_utils::ApiIdentifier: From<F>,
{
match self.resource_id {
payment_types::PaymentIdType::PaymentIntentId(ref id) if self.force_sync => {
api_locking::LockAction::Hold {
input: api_locking::LockingInput {
unique_locking_key: id.get_string_repr().to_owned(),
api_identifier: lock_utils::ApiIdentifier::from(flow),
override_lock_retries: None,
},
}
}
_ => api_locking::LockAction::NotApplicable,
}
}
}
#[cfg(feature = "v1")]
impl GetLockingInput for payment_types::PaymentsSessionRequest {
fn get_locking_input<F>(&self, flow: F) -> api_locking::LockAction
where
F: types::FlowMetric,
lock_utils::ApiIdentifier: From<F>,
{
api_locking::LockAction::Hold {
input: api_locking::LockingInput {
unique_locking_key: self.payment_id.get_string_repr().to_owned(),
api_identifier: lock_utils::ApiIdentifier::from(flow),
override_lock_retries: None,
},
}
}
}
#[cfg(feature = "v2")]
impl GetLockingInput for payment_types::PaymentsSessionRequest {
fn get_locking_input<F>(&self, flow: F) -> api_locking::LockAction
where
F: types::FlowMetric,
{
api_locking::LockAction::NotApplicable
}
}
#[cfg(feature = "v1")]
impl GetLockingInput for payment_types::PaymentsDynamicTaxCalculationRequest {
fn get_locking_input<F>(&self, flow: F) -> api_locking::LockAction
where
F: types::FlowMetric,
lock_utils::ApiIdentifier: From<F>,
{
api_locking::LockAction::Hold {
input: api_locking::LockingInput {
unique_locking_key: self.payment_id.get_string_repr().to_owned(),
api_identifier: lock_utils::ApiIdentifier::from(flow),
override_lock_retries: None,
},
}
}
}
#[cfg(feature = "v1")]
impl GetLockingInput for payment_types::PaymentsPostSessionTokensRequest {
fn get_locking_input<F>(&self, flow: F) -> api_locking::LockAction
where
F: types::FlowMetric,
lock_utils::ApiIdentifier: From<F>,
{
api_locking::LockAction::Hold {
input: api_locking::LockingInput {
unique_locking_key: self.payment_id.get_string_repr().to_owned(),
api_identifier: lock_utils::ApiIdentifier::from(flow),
override_lock_retries: None,
},
}
}
}
#[cfg(feature = "v1")]
impl GetLockingInput for payment_types::PaymentsUpdateMetadataRequest {
fn get_locking_input<F>(&self, flow: F) -> api_locking::LockAction
where
F: types::FlowMetric,
lock_utils::ApiIdentifier: From<F>,
{
api_locking::LockAction::Hold {
input: api_locking::LockingInput {
unique_locking_key: self.payment_id.get_string_repr().to_owned(),
api_identifier: lock_utils::ApiIdentifier::from(flow),
override_lock_retries: None,
},
}
}
}
#[cfg(feature = "v1")]
impl GetLockingInput for payments::PaymentsRedirectResponseData {
fn get_locking_input<F>(&self, flow: F) -> api_locking::LockAction
where
F: types::FlowMetric,
lock_utils::ApiIdentifier: From<F>,
{
match self.resource_id {
payment_types::PaymentIdType::PaymentIntentId(ref id) => {
api_locking::LockAction::Hold {
input: api_locking::LockingInput {
unique_locking_key: id.get_string_repr().to_owned(),
api_identifier: lock_utils::ApiIdentifier::from(flow),
override_lock_retries: None,
},
}
}
_ => api_locking::LockAction::NotApplicable,
}
}
}
#[cfg(feature = "v2")]
impl GetLockingInput for payments::PaymentsRedirectResponseData {
fn get_locking_input<F>(&self, flow: F) -> api_locking::LockAction
where
F: types::FlowMetric,
lock_utils::ApiIdentifier: From<F>,
{
api_locking::LockAction::Hold {
input: api_locking::LockingInput {
unique_locking_key: self.payment_id.get_string_repr().to_owned(),
api_identifier: lock_utils::ApiIdentifier::from(flow),
override_lock_retries: None,
},
}
}
}
#[cfg(feature = "v1")]
impl GetLockingInput for payment_types::PaymentsCompleteAuthorizeRequest {
fn get_locking_input<F>(&self, flow: F) -> api_locking::LockAction
where
F: types::FlowMetric,
lock_utils::ApiIdentifier: From<F>,
{
api_locking::LockAction::Hold {
input: api_locking::LockingInput {
unique_locking_key: self.payment_id.get_string_repr().to_owned(),
api_identifier: lock_utils::ApiIdentifier::from(flow),
override_lock_retries: None,
},
}
}
}
#[cfg(feature = "v1")]
impl GetLockingInput for payment_types::PaymentsCancelRequest {
fn get_locking_input<F>(&self, flow: F) -> api_locking::LockAction
where
F: types::FlowMetric,
lock_utils::ApiIdentifier: From<F>,
{
api_locking::LockAction::Hold {
input: api_locking::LockingInput {
unique_locking_key: self.payment_id.get_string_repr().to_owned(),
api_identifier: lock_utils::ApiIdentifier::from(flow),
override_lock_retries: None,
},
}
}
}
#[cfg(feature = "v1")]
impl GetLockingInput for payment_types::PaymentsCancelPostCaptureRequest {
fn get_locking_input<F>(&self, flow: F) -> api_locking::LockAction
where
F: types::FlowMetric,
lock_utils::ApiIdentifier: From<F>,
{
api_locking::LockAction::Hold {
input: api_locking::LockingInput {
unique_locking_key: self.payment_id.get_string_repr().to_owned(),
api_identifier: lock_utils::ApiIdentifier::from(flow),
override_lock_retries: None,
},
}
}
}
#[cfg(feature = "v1")]
impl GetLockingInput for payment_types::PaymentsCaptureRequest {
fn get_locking_input<F>(&self, flow: F) -> api_locking::LockAction
where
F: types::FlowMetric,
lock_utils::ApiIdentifier: From<F>,
{
api_locking::LockAction::Hold {
input: api_locking::LockingInput {
unique_locking_key: self.payment_id.get_string_repr().to_owned(),
api_identifier: lock_utils::ApiIdentifier::from(flow),
override_lock_retries: None,
},
}
}
}
#[cfg(feature = "oltp")]
struct FPaymentsApproveRequest<'a>(&'a payment_types::PaymentsApproveRequest);
#[cfg(feature = "oltp")]
impl GetLockingInput for FPaymentsApproveRequest<'_> {
fn get_locking_input<F>(&self, flow: F) -> api_locking::LockAction
where
F: types::FlowMetric,
lock_utils::ApiIdentifier: From<F>,
{
api_locking::LockAction::Hold {
input: api_locking::LockingInput {
unique_locking_key: self.0.payment_id.get_string_repr().to_owned(),
api_identifier: lock_utils::ApiIdentifier::from(flow),
override_lock_retries: None,
},
}
}
}
#[cfg(feature = "oltp")]
struct FPaymentsRejectRequest<'a>(&'a payment_types::PaymentsRejectRequest);
#[cfg(feature = "oltp")]
impl GetLockingInput for FPaymentsRejectRequest<'_> {
fn get_locking_input<F>(&self, flow: F) -> api_locking::LockAction
where
F: types::FlowMetric,
lock_utils::ApiIdentifier: From<F>,
{
api_locking::LockAction::Hold {
input: api_locking::LockingInput {
unique_locking_key: self.0.payment_id.get_string_repr().to_owned(),
api_identifier: lock_utils::ApiIdentifier::from(flow),
override_lock_retries: None,
},
}
}
}
#[cfg(feature = "v1")]
impl GetLockingInput for payment_types::PaymentsIncrementalAuthorizationRequest {
fn get_locking_input<F>(&self, flow: F) -> api_locking::LockAction
where
F: types::FlowMetric,
lock_utils::ApiIdentifier: From<F>,
{
api_locking::LockAction::Hold {
input: api_locking::LockingInput {
unique_locking_key: self.payment_id.get_string_repr().to_owned(),
api_identifier: lock_utils::ApiIdentifier::from(flow),
override_lock_retries: None,
},
}
}
}
#[cfg(feature = "v1")]
impl GetLockingInput for payment_types::PaymentsExternalAuthenticationRequest {
fn get_locking_input<F>(&self, flow: F) -> api_locking::LockAction
where
F: types::FlowMetric,
lock_utils::ApiIdentifier: From<F>,
{
api_locking::LockAction::Hold {
input: api_locking::LockingInput {
unique_locking_key: self.payment_id.get_string_repr().to_owned(),
api_identifier: lock_utils::ApiIdentifier::from(flow),
override_lock_retries: None,
},
}
}
}
#[cfg(feature = "v1")]
impl GetLockingInput for payment_types::PaymentsManualUpdateRequest {
fn get_locking_input<F>(&self, flow: F) -> api_locking::LockAction
where
F: types::FlowMetric,
lock_utils::ApiIdentifier: From<F>,
{
api_locking::LockAction::Hold {
input: api_locking::LockingInput {
unique_locking_key: self.payment_id.get_string_repr().to_owned(),
api_identifier: lock_utils::ApiIdentifier::from(flow),
override_lock_retries: None,
},
}
}
}
#[instrument(skip_all, fields(flow = ?Flow::PaymentsAggregate))]
#[cfg(all(feature = "olap", feature = "v1"))]
pub async fn get_payments_aggregates_profile(
state: web::Data<app::AppState>,
req: actix_web::HttpRequest,
payload: web::Query<common_utils::types::TimeRange>,
) -> impl Responder {
let flow = Flow::PaymentsAggregate;
let payload = payload.into_inner();
Box::pin(api::server_wrap(
flow,
state,
&req,
payload,
|state, auth: auth::AuthenticationData, req, _| {
let merchant_context = domain::MerchantContext::NormalMerchant(Box::new(
domain::Context(auth.merchant_account, auth.key_store),
));
payments::get_aggregates_for_payments(
state,
merchant_context,
auth.profile_id.map(|profile_id| vec![profile_id]),
req,
)
},
&auth::JWTAuth {
permission: Permission::ProfilePaymentRead,
},
api_locking::LockAction::NotApplicable,
))
.await
}
#[instrument(skip_all, fields(flow = ?Flow::PaymentsAggregate))]
#[cfg(all(feature = "olap", feature = "v2"))]
pub async fn get_payments_aggregates_profile(
state: web::Data<app::AppState>,
req: actix_web::HttpRequest,
payload: web::Query<common_utils::types::TimeRange>,
) -> impl Responder {
let flow = Flow::PaymentsAggregate;
let payload = payload.into_inner();
Box::pin(api::server_wrap(
flow,
state,
&req,
payload,
|state, auth: auth::AuthenticationData, req, _| {
let merchant_context = domain::MerchantContext::NormalMerchant(Box::new(
domain::Context(auth.merchant_account, auth.key_store),
));
payments::get_aggregates_for_payments(
state,
merchant_context,
Some(vec![auth.profile.get_id().clone()]),
req,
)
},
&auth::JWTAuth {
permission: Permission::ProfilePaymentRead,
},
api_locking::LockAction::NotApplicable,
))
.await
}
#[cfg(feature = "v2")]
/// A private module to hold internal types to be used in route handlers.
/// This is because we will need to implement certain traits on these types which will have the resource id
/// But the api payload will not contain the resource id
/// So these types can hold the resource id along with actual api payload, on which api event and locking action traits can be implemented
mod internal_payload_types {
use super::*;
// Serialize is implemented because of api events
#[derive(Debug, serde::Serialize)]
pub struct PaymentsGenericRequestWithResourceId<T: serde::Serialize> {
pub global_payment_id: common_utils::id_type::GlobalPaymentId,
#[serde(flatten)]
pub payload: T,
}
impl<T: serde::Serialize> GetLockingInput for PaymentsGenericRequestWithResourceId<T> {
fn get_locking_input<F>(&self, flow: F) -> api_locking::LockAction
where
F: types::FlowMetric,
lock_utils::ApiIdentifier: From<F>,
{
api_locking::LockAction::Hold {
input: api_locking::LockingInput {
unique_locking_key: self.global_payment_id.get_string_repr().to_owned(),
api_identifier: lock_utils::ApiIdentifier::from(flow),
override_lock_retries: None,
},
}
}
}
impl<T: serde::Serialize> common_utils::events::ApiEventMetric
for PaymentsGenericRequestWithResourceId<T>
{
fn get_api_event_type(&self) -> Option<common_utils::events::ApiEventsType> {
Some(common_utils::events::ApiEventsType::Payment {
payment_id: self.global_payment_id.clone(),
})
}
}
}
#[cfg(feature = "v2")]
#[instrument(skip_all, fields(flow = ?Flow::PaymentStartRedirection, payment_id))]
pub async fn payments_start_redirection(
state: web::Data<app::AppState>,
req: actix_web::HttpRequest,
payload: web::Query<api_models::payments::PaymentStartRedirectionParams>,
path: web::Path<common_utils::id_type::GlobalPaymentId>,
) -> impl Responder {
let flow = Flow::PaymentStartRedirection;
let global_payment_id = path.into_inner();
tracing::Span::current().record("payment_id", global_payment_id.get_string_repr());
let publishable_key = &payload.publishable_key;
let profile_id = &payload.profile_id;
let payment_start_redirection_request = api_models::payments::PaymentStartRedirectionRequest {
id: global_payment_id.clone(),
};
let internal_payload = internal_payload_types::PaymentsGenericRequestWithResourceId {
global_payment_id: global_payment_id.clone(),
payload: payment_start_redirection_request.clone(),
};
let locking_action = internal_payload.get_locking_input(flow.clone());
Box::pin(api::server_wrap(
flow,
state,
&req,
payment_start_redirection_request.clone(),
|state, auth: auth::AuthenticationData, _req, req_state| async {
let merchant_context = domain::MerchantContext::NormalMerchant(Box::new(
domain::Context(auth.merchant_account, auth.key_store),
));
payments::payment_start_redirection(
state,
merchant_context,
payment_start_redirection_request.clone(),
)
.await
},
&auth::PublishableKeyAndProfileIdAuth {
publishable_key: publishable_key.clone(),
profile_id: profile_id.clone(),
},
locking_action,
))
.await
}
#[cfg(feature = "v2")]
#[instrument(skip_all, fields(flow = ?Flow::PaymentsConfirmIntent, payment_id))]
pub async fn payment_confirm_intent(
state: web::Data<app::AppState>,
req: actix_web::HttpRequest,
json_payload: web::Json<api_models::payments::PaymentsConfirmIntentRequest>,
path: web::Path<common_utils::id_type::GlobalPaymentId>,
) -> impl Responder {
use hyperswitch_domain_models::payments::PaymentConfirmData;
let flow = Flow::PaymentsConfirmIntent;
// TODO: Populate browser information into the payload
// if let Err(err) = helpers::populate_ip_into_browser_info(&req, &mut payload) {
// return api::log_and_return_error_response(err);
// }
let global_payment_id = path.into_inner();
tracing::Span::current().record("payment_id", global_payment_id.get_string_repr());
let internal_payload = internal_payload_types::PaymentsGenericRequestWithResourceId {
global_payment_id: global_payment_id.clone(),
payload: json_payload.into_inner(),
};
let header_payload = match HeaderPayload::foreign_try_from(req.headers()) {
Ok(headers) => headers,
Err(err) => {
return api::log_and_return_error_response(err);
}
};
let locking_action = internal_payload.get_locking_input(flow.clone());
Box::pin(api::server_wrap(
flow,
state,
&req,
internal_payload,
|state, auth: auth::AuthenticationData, req, req_state| async {
let payment_id = req.global_payment_id;
let request = req.payload;
let operation = payments::operations::PaymentIntentConfirm;
let merchant_context = domain::MerchantContext::NormalMerchant(Box::new(
domain::Context(auth.merchant_account, auth.key_store),
));
Box::pin(payments::payments_core::<
api_types::Authorize,
api_models::payments::PaymentsResponse,
_,
_,
_,
PaymentConfirmData<api_types::Authorize>,
>(
state,
req_state,
merchant_context,
auth.profile,
operation,
request,
payment_id,
payments::CallConnectorAction::Trigger,
header_payload.clone(),
))
.await
},
auth::api_or_client_auth(
&auth::V2ApiKeyAuth {
is_connected_allowed: false,
is_platform_allowed: false,
},
&auth::V2ClientAuth(common_utils::types::authentication::ResourceId::Payment(
global_payment_id,
)),
req.headers(),
),
locking_action,
))
.await
}
#[cfg(feature = "v2")]
#[instrument(skip_all, fields(flow = ?Flow::GiftCardBalanceCheck, payment_id))]
pub async fn payment_check_gift_card_balance(
state: web::Data<app::AppState>,
req: actix_web::HttpRequest,
json_payload: web::Json<api_models::payments::PaymentsGiftCardBalanceCheckRequest>,
path: web::Path<common_utils::id_type::GlobalPaymentId>,
) -> impl Responder {
let flow = Flow::GiftCardBalanceCheck;
let global_payment_id = path.into_inner();
tracing::Span::current().record("payment_id", global_payment_id.get_string_repr());
let internal_payload = internal_payload_types::PaymentsGenericRequestWithResourceId {
global_payment_id: global_payment_id.clone(),
payload: json_payload.into_inner(),
};
let header_payload = match HeaderPayload::foreign_try_from(req.headers()) {
Ok(headers) => headers,
Err(err) => {
return api::log_and_return_error_response(err);
}
};
Box::pin(api::server_wrap(
flow,
state,
&req,
internal_payload,
|state, auth: auth::AuthenticationData, req, req_state| async {
let payment_id = req.global_payment_id;
let request = req.payload;
let merchant_context = domain::MerchantContext::NormalMerchant(Box::new(
domain::Context(auth.merchant_account, auth.key_store),
));
Box::pin(gift_card::payments_check_gift_card_balance_core(
state,
merchant_context,
auth.profile,
req_state,
request,
header_payload.clone(),
payment_id,
))
.await
},
auth::api_or_client_auth(
&auth::V2ApiKeyAuth {
is_connected_allowed: false,
is_platform_allowed: false,
},
&auth::V2ClientAuth(common_utils::types::authentication::ResourceId::Payment(
global_payment_id,
)),
req.headers(),
),
api_locking::LockAction::NotApplicable,
))
.await
}
#[cfg(feature = "v2")]
#[instrument(skip_all, fields(flow = ?Flow::ProxyConfirmIntent, payment_id))]
pub async fn proxy_confirm_intent(
state: web::Data<app::AppState>,
req: actix_web::HttpRequest,
json_payload: web::Json<api_models::payments::ProxyPaymentsRequest>,
path: web::Path<common_utils::id_type::GlobalPaymentId>,
) -> impl Responder {
use hyperswitch_domain_models::payments::PaymentConfirmData;
let flow = Flow::ProxyConfirmIntent;
// Extract the payment ID from the path
let global_payment_id = path.into_inner();
tracing::Span::current().record("payment_id", global_payment_id.get_string_repr());
// Parse and validate headers
let header_payload = match HeaderPayload::foreign_try_from(req.headers()) {
Ok(headers) => headers,
Err(err) => {
return api::log_and_return_error_response(err);
}
};
// Prepare the internal payload
let internal_payload = internal_payload_types::PaymentsGenericRequestWithResourceId {
global_payment_id,
payload: json_payload.into_inner(),
};
// Determine the locking action, if required
let locking_action = internal_payload.get_locking_input(flow.clone());
Box::pin(api::server_wrap(
flow,
state,
&req,
internal_payload,
|state, auth: auth::AuthenticationData, req, req_state| {
let payment_id = req.global_payment_id;
let request = req.payload;
// Define the operation for proxy payments intent
let operation = payments::operations::proxy_payments_intent::PaymentProxyIntent;
let merchant_context = domain::MerchantContext::NormalMerchant(Box::new(
domain::Context(auth.merchant_account, auth.key_store),
));
// Call the core proxy logic
Box::pin(payments::proxy_for_payments_core::<
api_types::Authorize,
api_models::payments::PaymentsResponse,
_,
_,
_,
PaymentConfirmData<api_types::Authorize>,
>(
state,
req_state,
merchant_context,
auth.profile,
operation,
request,
payment_id,
payments::CallConnectorAction::Trigger,
header_payload.clone(),
None,
))
},
&auth::V2ApiKeyAuth {
is_connected_allowed: false,
is_platform_allowed: false,
},
locking_action,
))
.await
}
#[cfg(feature = "v2")]
#[instrument(skip_all, fields(flow = ?Flow::ProxyConfirmIntent, payment_id))]
pub async fn confirm_intent_with_external_vault_proxy(
state: web::Data<app::AppState>,
req: actix_web::HttpRequest,
json_payload: web::Json<api_models::payments::ExternalVaultProxyPaymentsRequest>,
path: web::Path<common_utils::id_type::GlobalPaymentId>,
) -> impl Responder {
use hyperswitch_domain_models::payments::PaymentConfirmData;
let flow = Flow::ProxyConfirmIntent;
// Extract the payment ID from the path
let global_payment_id = path.into_inner();
tracing::Span::current().record("payment_id", global_payment_id.get_string_repr());
// Parse and validate headers
let header_payload = match HeaderPayload::foreign_try_from(req.headers()) {
Ok(headers) => headers,
Err(err) => {
return api::log_and_return_error_response(err);
}
};
// Prepare the internal payload
let internal_payload = internal_payload_types::PaymentsGenericRequestWithResourceId {
global_payment_id: global_payment_id.clone(),
payload: json_payload.into_inner(),
};
// Determine the locking action, if required
let locking_action = internal_payload.get_locking_input(flow.clone());
Box::pin(api::server_wrap(
flow,
state,
&req,
internal_payload,
|state, auth: auth::AuthenticationData, req, req_state| {
let payment_id = req.global_payment_id;
let request = req.payload;
// Define the operation for proxy payments intent
let operation = payments::operations::external_vault_proxy_payment_intent::ExternalVaultProxyPaymentIntent;
let merchant_context = domain::MerchantContext::NormalMerchant(Box::new(
domain::Context(auth.merchant_account, auth.key_store),
));
// Call the core proxy logic
Box::pin(payments::external_vault_proxy_for_payments_core::<
api_types::ExternalVaultProxy,
api_models::payments::PaymentsResponse,
_,
_,
_,
PaymentConfirmData<api_types::ExternalVaultProxy>,
>(
state,
req_state,
merchant_context,
auth.profile,
operation,
request,
payment_id,
payments::CallConnectorAction::Trigger,
header_payload.clone(),
None,
))
},
auth::api_or_client_auth(
&auth::V2ApiKeyAuth {
is_connected_allowed: false,
is_platform_allowed: false,
},
&auth::V2ClientAuth(common_utils::types::authentication::ResourceId::Payment(
global_payment_id,
)),
req.headers(),
),
locking_action,
))
.await
}
#[cfg(feature = "v2")]
#[instrument(skip(state, req), fields(flow, payment_id))]
pub async fn payment_status(
state: web::Data<app::AppState>,
req: actix_web::HttpRequest,
payload: web::Query<api_models::payments::PaymentsStatusRequest>,
path: web::Path<common_utils::id_type::GlobalPaymentId>,
) -> impl Responder {
use hyperswitch_domain_models::payments::PaymentStatusData;
let flow = match payload.force_sync {
true => Flow::PaymentsRetrieveForceSync,
false => Flow::PaymentsRetrieve,
};
let global_payment_id = path.into_inner();
tracing::Span::current().record("payment_id", global_payment_id.get_string_repr());
let payload = payment_types::PaymentsRetrieveRequest {
force_sync: payload.force_sync,
expand_attempts: payload.expand_attempts,
param: payload.param.clone(),
return_raw_connector_response: payload.return_raw_connector_response,
merchant_connector_details: None,
};
let internal_payload = internal_payload_types::PaymentsGenericRequestWithResourceId {
global_payment_id,
payload,
};
let header_payload = match HeaderPayload::foreign_try_from(req.headers()) {
Ok(headers) => headers,
Err(err) => {
return api::log_and_return_error_response(err);
}
};
let locking_action = internal_payload.get_locking_input(flow.clone());
Box::pin(api::server_wrap(
flow,
state,
&req,
internal_payload,
|state, auth: auth::AuthenticationData, req, req_state| async {
let payment_id = req.global_payment_id;
let request = req.payload;
let operation = payments::operations::PaymentGet;
let merchant_context = domain::MerchantContext::NormalMerchant(Box::new(
domain::Context(auth.merchant_account, auth.key_store),
));
Box::pin(payments::payments_core::<
api_types::PSync,
api_models::payments::PaymentsResponse,
_,
_,
_,
PaymentStatusData<api_types::PSync>,
>(
state,
req_state,
merchant_context,
auth.profile,
operation,
request,
payment_id,
payments::CallConnectorAction::Trigger,
header_payload.clone(),
))
.await
},
auth::auth_type(
&auth::V2ApiKeyAuth {
is_connected_allowed: false,
is_platform_allowed: false,
},
&auth::JWTAuth {
permission: Permission::ProfilePaymentRead,
},
req.headers(),
),
locking_action,
))
.await
}
#[cfg(feature = "v2")]
#[instrument(skip(state, req), fields(flow, payment_id))]
pub async fn payments_status_with_gateway_creds(
state: web::Data<app::AppState>,
req: actix_web::HttpRequest,
payload: web::Json<api_models::payments::PaymentsRetrieveRequest>,
path: web::Path<common_utils::id_type::GlobalPaymentId>,
) -> impl Responder {
use hyperswitch_domain_models::payments::PaymentStatusData;
let flow = match payload.force_sync {
true => Flow::PaymentsRetrieveForceSync,
false => Flow::PaymentsRetrieve,
};
tracing::Span::current().record("flow", flow.to_string());
let global_payment_id = path.into_inner();
tracing::Span::current().record("payment_id", global_payment_id.get_string_repr());
|
crates/router/src/routes/payments.rs#chunk2
|
router
|
chunk
| null | null | null | 8,191
| null | null | null | null | null | null | null |
// Function: build_pm_collect_link_status_html
// File: crates/router/src/services/api/generic_link_response.rs
// Module: router
pub fn build_pm_collect_link_status_html(
link_data: &GenericLinkStatusData,
) -> CustomResult<String, errors::ApiErrorResponse>
|
crates/router/src/services/api/generic_link_response.rs
|
router
|
function_signature
| null | null | null | 59
|
build_pm_collect_link_status_html
| null | null | null | null | null | null |
// Struct: NuveiPaymentRequestData
// File: crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct NuveiPaymentRequestData
|
crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
NuveiPaymentRequestData
| 0
|
[] | 55
| null | null | null | null | null | null | null |
// Function: migrate_payment_methods
// File: crates/payment_methods/src/core/migration.rs
// Module: payment_methods
pub fn migrate_payment_methods(
state: &state::PaymentMethodsState,
payment_methods: Vec<pm_api::PaymentMethodRecord>,
merchant_id: &common_utils::id_type::MerchantId,
merchant_context: &merchant_context::MerchantContext,
mca_ids: Option<Vec<common_utils::id_type::MerchantConnectorAccountId>>,
controller: &dyn pm::PaymentMethodsController,
) -> PmMigrationResult<Vec<pm_api::PaymentMethodMigrationResponse>>
|
crates/payment_methods/src/core/migration.rs
|
payment_methods
|
function_signature
| null | null | null | 124
|
migrate_payment_methods
| null | null | null | null | null | null |
// Struct: MetricsResponse
// File: crates/api_models/src/analytics.rs
// Module: api_models
// Implementations: 0
pub struct MetricsResponse<T>
|
crates/api_models/src/analytics.rs
|
api_models
|
struct_definition
|
MetricsResponse
| 0
|
[] | 36
| null | null | null | null | null | null | null |
// Struct: TokenizationNew
// File: crates/hyperswitch_domain_models/src/tokenization.rs
// Module: hyperswitch_domain_models
// Implementations: 0
pub struct TokenizationNew
|
crates/hyperswitch_domain_models/src/tokenization.rs
|
hyperswitch_domain_models
|
struct_definition
|
TokenizationNew
| 0
|
[] | 42
| null | null | null | null | null | null | null |
// Function: get_forex_rates
// File: crates/router/src/utils/currency.rs
// Module: router
pub fn get_forex_rates(
state: &SessionState,
data_expiration_delay: u32,
) -> CustomResult<FxExchangeRatesCacheEntry, ForexError>
|
crates/router/src/utils/currency.rs
|
router
|
function_signature
| null | null | null | 62
|
get_forex_rates
| null | null | null | null | null | null |
// File: crates/router/src/configs.rs
// Module: router
use hyperswitch_interfaces::secrets_interface::secret_state::RawSecret;
pub(crate) mod defaults;
pub mod secrets_transformers;
pub mod settings;
mod validations;
pub type Settings = settings::Settings<RawSecret>;
|
crates/router/src/configs.rs
|
router
|
full_file
| null | null | null | 60
| null | null | null | null | null | null | null |
// Function: get_mandate
// File: crates/router/src/core/mandate.rs
// Module: router
pub fn get_mandate(
state: SessionState,
merchant_context: domain::MerchantContext,
req: mandates::MandateId,
) -> RouterResponse<mandates::MandateResponse>
|
crates/router/src/core/mandate.rs
|
router
|
function_signature
| null | null | null | 70
|
get_mandate
| null | null | null | null | null | null |
// Implementation: impl std::fmt::Display for for RoutingApproach
// File: crates/api_models/src/routing.rs
// Module: api_models
// Methods: 1 total (0 public)
impl std::fmt::Display for for RoutingApproach
|
crates/api_models/src/routing.rs
|
api_models
|
impl_block
| null | null | null | 53
| null |
RoutingApproach
|
std::fmt::Display for
| 1
| 0
| null | null |
// Implementation: impl api::PaymentSession for for Worldpayvantiv
// File: crates/hyperswitch_connectors/src/connectors/worldpayvantiv.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::PaymentSession for for Worldpayvantiv
|
crates/hyperswitch_connectors/src/connectors/worldpayvantiv.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 63
| null |
Worldpayvantiv
|
api::PaymentSession for
| 0
| 0
| null | null |
// Function: get_payment_method_type
// File: crates/diesel_models/src/types.rs
// Module: diesel_models
pub fn get_payment_method_type(&self) -> Option<common_enums::PaymentMethod>
|
crates/diesel_models/src/types.rs
|
diesel_models
|
function_signature
| null | null | null | 44
|
get_payment_method_type
| null | null | null | null | null | null |
// Function: mandate_procedure
// File: crates/router/src/core/mandate.rs
// Module: router
pub fn mandate_procedure<F, FData>(
state: &SessionState,
resp: &types::RouterData<F, FData, types::PaymentsResponseData>,
customer_id: &Option<id_type::CustomerId>,
pm_id: Option<String>,
merchant_connector_id: Option<id_type::MerchantConnectorAccountId>,
storage_scheme: MerchantStorageScheme,
payment_id: &id_type::PaymentId,
) -> errors::RouterResult<Option<String>>
where
FData: MandateBehaviour,
|
crates/router/src/core/mandate.rs
|
router
|
function_signature
| null | null | null | 131
|
mandate_procedure
| null | null | null | null | null | null |
// File: crates/diesel_models/src/reverse_lookup.rs
// Module: diesel_models
// Public structs: 2
use diesel::{Identifiable, Insertable, Queryable, Selectable};
use crate::schema::reverse_lookup;
/// This reverse lookup table basically looks up id's and get result_id that you want. This is
/// useful for KV where you can't lookup without key
#[derive(
Clone,
Debug,
serde::Serialize,
serde::Deserialize,
Identifiable,
Queryable,
Selectable,
Eq,
PartialEq,
)]
#[diesel(table_name = reverse_lookup, primary_key(lookup_id), check_for_backend(diesel::pg::Pg))]
pub struct ReverseLookup {
/// Primary key. The key id.
pub lookup_id: String,
/// the `field` in KV database. Which is used to differentiate between two same keys
pub sk_id: String,
/// the value id. i.e the id you want to access KV table.
pub pk_id: String,
/// the source of insertion for reference
pub source: String,
pub updated_by: String,
}
#[derive(
Clone,
Debug,
Insertable,
router_derive::DebugAsDisplay,
Eq,
PartialEq,
serde::Serialize,
serde::Deserialize,
)]
#[diesel(table_name = reverse_lookup)]
pub struct ReverseLookupNew {
pub lookup_id: String,
pub pk_id: String,
pub sk_id: String,
pub source: String,
pub updated_by: String,
}
impl From<ReverseLookupNew> for ReverseLookup {
fn from(new: ReverseLookupNew) -> Self {
Self {
lookup_id: new.lookup_id,
sk_id: new.sk_id,
pk_id: new.pk_id,
source: new.source,
updated_by: new.updated_by,
}
}
}
|
crates/diesel_models/src/reverse_lookup.rs
|
diesel_models
|
full_file
| null | null | null | 398
| null | null | null | null | null | null | null |
// Implementation: impl api::PaymentSession for for Payload
// File: crates/hyperswitch_connectors/src/connectors/payload.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::PaymentSession for for Payload
|
crates/hyperswitch_connectors/src/connectors/payload.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 55
| null |
Payload
|
api::PaymentSession for
| 0
| 0
| null | null |
// Function: disable_algorithm_id
// File: crates/api_models/src/routing.rs
// Module: api_models
pub fn disable_algorithm_id(&mut self, dynamic_routing_type: DynamicRoutingType)
|
crates/api_models/src/routing.rs
|
api_models
|
function_signature
| null | null | null | 41
|
disable_algorithm_id
| 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.