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
⌀ |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
// Struct: QueryTransactionResult
// File: crates/hyperswitch_connectors/src/connectors/bamboraapac/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct QueryTransactionResult
|
crates/hyperswitch_connectors/src/connectors/bamboraapac/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
QueryTransactionResult
| 0
|
[] | 50
| null | null | null | null | null | null | null |
// Function: payments_cancel
// File: crates/openapi/src/routes/payments.rs
// Module: openapi
pub fn payments_cancel()
|
crates/openapi/src/routes/payments.rs
|
openapi
|
function_signature
| null | null | null | 29
|
payments_cancel
| null | null | null | null | null | null |
// Struct: PIISerializer
// File: crates/masking/src/serde.rs
// Module: masking
// Implementations: 2
// Traits: Clone, Serializer
pub struct PIISerializer
|
crates/masking/src/serde.rs
|
masking
|
struct_definition
|
PIISerializer
| 2
|
[
"Clone",
"Serializer"
] | 42
| null | null | null | null | null | null | null |
// Function: generate
// File: crates/common_utils/src/id_type/global_id/payment_methods.rs
// Module: common_utils
// Documentation: Create a new GlobalPaymentMethodId from cell id information
pub fn generate(cell_id: &CellId) -> error_stack::Result<Self, GlobalPaymentMethodIdError>
|
crates/common_utils/src/id_type/global_id/payment_methods.rs
|
common_utils
|
function_signature
| null | null | null | 64
|
generate
| null | null | null | null | null | null |
// Struct: CardDetail
// File: crates/api_models/src/payment_methods.rs
// Module: api_models
// Implementations: 0
pub struct CardDetail
|
crates/api_models/src/payment_methods.rs
|
api_models
|
struct_definition
|
CardDetail
| 0
|
[] | 34
| null | null | null | null | null | null | null |
// Struct: RefundWebhookLink
// File: crates/hyperswitch_connectors/src/connectors/gocardless/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct RefundWebhookLink
|
crates/hyperswitch_connectors/src/connectors/gocardless/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
RefundWebhookLink
| 0
|
[] | 52
| null | null | null | null | null | null | null |
// Implementation: impl webhooks::IncomingWebhook for for Santander
// File: crates/hyperswitch_connectors/src/connectors/santander.rs
// Module: hyperswitch_connectors
// Methods: 4 total (0 public)
impl webhooks::IncomingWebhook for for Santander
|
crates/hyperswitch_connectors/src/connectors/santander.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 62
| null |
Santander
|
webhooks::IncomingWebhook for
| 4
| 0
| null | null |
// File: crates/router/src/core/fraud_check/flows/sale_flow.rs
// Module: router
// Public functions: 1
use async_trait::async_trait;
use common_utils::{ext_traits::ValueExt, pii::Email};
use error_stack::ResultExt;
use masking::ExposeInterface;
use crate::{
core::{
errors::{ConnectorErrorExt, RouterResult},
fraud_check::{FeatureFrm, FraudCheckConnectorData, FrmData},
payments::{self, flows::ConstructFlowSpecificData, helpers},
},
errors, services,
types::{
api::fraud_check as frm_api,
domain,
fraud_check::{FraudCheckResponseData, FraudCheckSaleData, FrmSaleRouterData},
storage::enums as storage_enums,
ConnectorAuthType, MerchantRecipientData, ResponseId, RouterData,
},
SessionState,
};
#[async_trait]
impl ConstructFlowSpecificData<frm_api::Sale, FraudCheckSaleData, FraudCheckResponseData>
for FrmData
{
#[cfg(feature = "v2")]
async fn construct_router_data<'a>(
&self,
_state: &SessionState,
_connector_id: &str,
_merchant_context: &domain::MerchantContext,
_customer: &Option<domain::Customer>,
_merchant_connector_account: &domain::MerchantConnectorAccountTypeDetails,
_merchant_recipient_data: Option<MerchantRecipientData>,
_header_payload: Option<hyperswitch_domain_models::payments::HeaderPayload>,
) -> RouterResult<RouterData<frm_api::Sale, FraudCheckSaleData, FraudCheckResponseData>> {
todo!()
}
#[cfg(feature = "v1")]
async fn construct_router_data<'a>(
&self,
state: &SessionState,
connector_id: &str,
merchant_context: &domain::MerchantContext,
customer: &Option<domain::Customer>,
merchant_connector_account: &helpers::MerchantConnectorAccountType,
_merchant_recipient_data: Option<MerchantRecipientData>,
header_payload: Option<hyperswitch_domain_models::payments::HeaderPayload>,
) -> RouterResult<RouterData<frm_api::Sale, FraudCheckSaleData, FraudCheckResponseData>> {
let status = storage_enums::AttemptStatus::Pending;
let auth_type: ConnectorAuthType = merchant_connector_account
.get_connector_account_details()
.parse_value("ConnectorAuthType")
.change_context(errors::ApiErrorResponse::MerchantConnectorAccountNotFound {
id: "ConnectorAuthType".to_string(),
})?;
let customer_id = customer.to_owned().map(|customer| customer.customer_id);
let router_data = RouterData {
flow: std::marker::PhantomData,
merchant_id: merchant_context.get_merchant_account().get_id().clone(),
customer_id,
connector: connector_id.to_string(),
payment_id: self.payment_intent.payment_id.get_string_repr().to_owned(),
attempt_id: self.payment_attempt.attempt_id.clone(),
tenant_id: state.tenant.tenant_id.clone(),
status,
payment_method: self
.payment_attempt
.payment_method
.ok_or(errors::ApiErrorResponse::PaymentMethodNotFound)?,
connector_auth_type: auth_type,
description: None,
address: self.address.clone(),
auth_type: storage_enums::AuthenticationType::NoThreeDs,
connector_meta_data: None,
connector_wallets_details: None,
amount_captured: None,
minor_amount_captured: None,
request: FraudCheckSaleData {
amount: self
.payment_attempt
.net_amount
.get_total_amount()
.get_amount_as_i64(),
order_details: self.order_details.clone(),
currency: self.payment_attempt.currency,
email: customer
.clone()
.and_then(|customer_data| {
customer_data
.email
.map(|email| Email::try_from(email.into_inner().expose()))
})
.transpose()
.change_context(errors::ApiErrorResponse::InvalidDataValue {
field_name: "customer.customer_data.email",
})?,
},
response: Ok(FraudCheckResponseData::TransactionResponse {
resource_id: ResponseId::ConnectorTransactionId("".to_string()),
connector_metadata: None,
status: storage_enums::FraudCheckStatus::Pending,
score: None,
reason: None,
}),
access_token: None,
session_token: None,
reference_id: None,
payment_method_token: None,
connector_customer: None,
preprocessing_id: None,
payment_method_status: None,
connector_request_reference_id: uuid::Uuid::new_v4().to_string(),
test_mode: None,
recurring_mandate_payment_data: None,
#[cfg(feature = "payouts")]
payout_method_data: None,
#[cfg(feature = "payouts")]
quote_id: None,
payment_method_balance: None,
connector_http_status_code: None,
external_latency: None,
connector_api_version: None,
apple_pay_flow: None,
frm_metadata: self.frm_metadata.clone(),
refund_id: None,
dispute_id: None,
connector_response: None,
integrity_check: Ok(()),
additional_merchant_data: None,
header_payload,
connector_mandate_request_reference_id: None,
authentication_id: None,
psd2_sca_exemption_type: None,
raw_connector_response: None,
is_payment_id_from_merchant: None,
l2_l3_data: None,
minor_amount_capturable: None,
};
Ok(router_data)
}
}
#[async_trait]
impl FeatureFrm<frm_api::Sale, FraudCheckSaleData> for FrmSaleRouterData {
async fn decide_frm_flows<'a>(
mut self,
state: &SessionState,
connector: &FraudCheckConnectorData,
call_connector_action: payments::CallConnectorAction,
merchant_context: &domain::MerchantContext,
) -> RouterResult<Self> {
decide_frm_flow(
&mut self,
state,
connector,
call_connector_action,
merchant_context,
)
.await
}
}
pub async fn decide_frm_flow(
router_data: &mut FrmSaleRouterData,
state: &SessionState,
connector: &FraudCheckConnectorData,
call_connector_action: payments::CallConnectorAction,
_merchant_context: &domain::MerchantContext,
) -> RouterResult<FrmSaleRouterData> {
let connector_integration: services::BoxedFrmConnectorIntegrationInterface<
frm_api::Sale,
FraudCheckSaleData,
FraudCheckResponseData,
> = connector.connector.get_connector_integration();
let resp = services::execute_connector_processing_step(
state,
connector_integration,
router_data,
call_connector_action,
None,
None,
)
.await
.to_payment_failed_response()?;
Ok(resp)
}
|
crates/router/src/core/fraud_check/flows/sale_flow.rs
|
router
|
full_file
| null | null | null | 1,486
| null | null | null | null | null | null | null |
// Struct: DebitorAccount
// File: crates/hyperswitch_connectors/src/connectors/nordea/requests.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct DebitorAccount
|
crates/hyperswitch_connectors/src/connectors/nordea/requests.rs
|
hyperswitch_connectors
|
struct_definition
|
DebitorAccount
| 0
|
[] | 47
| null | null | null | null | null | null | null |
// Function: api_key_update
// File: crates/router/src/routes/api_keys.rs
// Module: router
pub fn api_key_update(
state: web::Data<AppState>,
req: HttpRequest,
path: web::Path<(
common_utils::id_type::MerchantId,
common_utils::id_type::ApiKeyId,
)
|
crates/router/src/routes/api_keys.rs
|
router
|
function_signature
| null | null | null | 73
|
api_key_update
| null | null | null | null | null | null |
// Struct: PayloadAuthType
// File: crates/hyperswitch_connectors/src/connectors/payload/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct PayloadAuthType
|
crates/hyperswitch_connectors/src/connectors/payload/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
PayloadAuthType
| 0
|
[] | 47
| null | null | null | null | null | null | null |
// Struct: WellsfargoErrorInformation
// File: crates/hyperswitch_connectors/src/connectors/wellsfargo/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct WellsfargoErrorInformation
|
crates/hyperswitch_connectors/src/connectors/wellsfargo/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
WellsfargoErrorInformation
| 0
|
[] | 53
| null | null | null | null | null | null | null |
// Struct: ChallengeAttemptCount
// File: crates/api_models/src/analytics/auth_events.rs
// Module: api_models
// Implementations: 0
pub struct ChallengeAttemptCount
|
crates/api_models/src/analytics/auth_events.rs
|
api_models
|
struct_definition
|
ChallengeAttemptCount
| 0
|
[] | 38
| null | null | null | null | null | null | null |
// Function: is_jwt_flow
// File: crates/diesel_models/src/authentication.rs
// Module: diesel_models
pub fn is_jwt_flow(&self) -> CustomResult<bool, ValidationError>
|
crates/diesel_models/src/authentication.rs
|
diesel_models
|
function_signature
| null | null | null | 39
|
is_jwt_flow
| null | null | null | null | null | null |
// Function: find_optional_by_payment_id_merchant_id
// File: crates/diesel_models/src/query/payment_intent.rs
// Module: diesel_models
pub fn find_optional_by_payment_id_merchant_id(
conn: &PgPooledConn,
payment_id: &common_utils::id_type::PaymentId,
merchant_id: &common_utils::id_type::MerchantId,
) -> StorageResult<Option<Self>>
|
crates/diesel_models/src/query/payment_intent.rs
|
diesel_models
|
function_signature
| null | null | null | 87
|
find_optional_by_payment_id_merchant_id
| null | null | null | null | null | null |
// File: crates/diesel_models/src/query/user/sample_data.rs
// Module: diesel_models
// Public functions: 9
use async_bb8_diesel::AsyncRunQueryDsl;
use diesel::{associations::HasTable, debug_query, ExpressionMethods, TextExpressionMethods};
use error_stack::ResultExt;
use router_env::logger;
#[cfg(feature = "v1")]
use crate::schema::{
payment_attempt::dsl as payment_attempt_dsl, payment_intent::dsl as payment_intent_dsl,
refund::dsl as refund_dsl,
};
#[cfg(feature = "v2")]
use crate::schema_v2::{
payment_attempt::dsl as payment_attempt_dsl, payment_intent::dsl as payment_intent_dsl,
refund::dsl as refund_dsl,
};
use crate::{
errors, schema::dispute::dsl as dispute_dsl, Dispute, DisputeNew, PaymentAttempt,
PaymentIntent, PgPooledConn, Refund, RefundNew, StorageResult,
};
#[cfg(feature = "v1")]
use crate::{user, PaymentIntentNew};
#[cfg(feature = "v1")]
pub async fn insert_payment_intents(
conn: &PgPooledConn,
batch: Vec<PaymentIntentNew>,
) -> StorageResult<Vec<PaymentIntent>> {
let query = diesel::insert_into(<PaymentIntent>::table()).values(batch);
logger::debug!(query = %debug_query::<diesel::pg::Pg,_>(&query).to_string());
query
.get_results_async(conn)
.await
.change_context(errors::DatabaseError::Others)
.attach_printable("Error while inserting payment intents")
}
#[cfg(feature = "v1")]
pub async fn insert_payment_attempts(
conn: &PgPooledConn,
batch: Vec<user::sample_data::PaymentAttemptBatchNew>,
) -> StorageResult<Vec<PaymentAttempt>> {
let query = diesel::insert_into(<PaymentAttempt>::table()).values(batch);
logger::debug!(query = %debug_query::<diesel::pg::Pg,_>(&query).to_string());
query
.get_results_async(conn)
.await
.change_context(errors::DatabaseError::Others)
.attach_printable("Error while inserting payment attempts")
}
pub async fn insert_refunds(
conn: &PgPooledConn,
batch: Vec<RefundNew>,
) -> StorageResult<Vec<Refund>> {
let query = diesel::insert_into(<Refund>::table()).values(batch);
logger::debug!(query = %debug_query::<diesel::pg::Pg,_>(&query).to_string());
query
.get_results_async(conn)
.await
.change_context(errors::DatabaseError::Others)
.attach_printable("Error while inserting refunds")
}
pub async fn insert_disputes(
conn: &PgPooledConn,
batch: Vec<DisputeNew>,
) -> StorageResult<Vec<Dispute>> {
let query = diesel::insert_into(<Dispute>::table()).values(batch);
logger::debug!(query = %debug_query::<diesel::pg::Pg,_>(&query).to_string());
query
.get_results_async(conn)
.await
.change_context(errors::DatabaseError::Others)
.attach_printable("Error while inserting disputes")
}
#[cfg(feature = "v1")]
pub async fn delete_payment_intents(
conn: &PgPooledConn,
merchant_id: &common_utils::id_type::MerchantId,
) -> StorageResult<Vec<PaymentIntent>> {
let query = diesel::delete(<PaymentIntent>::table())
.filter(payment_intent_dsl::merchant_id.eq(merchant_id.to_owned()))
.filter(payment_intent_dsl::payment_id.like("test_%"));
logger::debug!(query = %debug_query::<diesel::pg::Pg,_>(&query).to_string());
query
.get_results_async(conn)
.await
.change_context(errors::DatabaseError::Others)
.attach_printable("Error while deleting payment intents")
.and_then(|result| match result.len() {
n if n > 0 => {
logger::debug!("{n} records deleted");
Ok(result)
}
0 => Err(error_stack::report!(errors::DatabaseError::NotFound)
.attach_printable("No records deleted")),
_ => Ok(result),
})
}
#[cfg(feature = "v2")]
pub async fn delete_payment_intents(
conn: &PgPooledConn,
merchant_id: &common_utils::id_type::MerchantId,
) -> StorageResult<Vec<PaymentIntent>> {
let query = diesel::delete(<PaymentIntent>::table())
.filter(payment_intent_dsl::merchant_id.eq(merchant_id.to_owned()))
.filter(payment_intent_dsl::merchant_reference_id.like("test_%"));
logger::debug!(query = %debug_query::<diesel::pg::Pg,_>(&query).to_string());
query
.get_results_async(conn)
.await
.change_context(errors::DatabaseError::Others)
.attach_printable("Error while deleting payment intents")
.and_then(|result| match result.len() {
n if n > 0 => {
logger::debug!("{n} records deleted");
Ok(result)
}
0 => Err(error_stack::report!(errors::DatabaseError::NotFound)
.attach_printable("No records deleted")),
_ => Ok(result),
})
}
pub async fn delete_payment_attempts(
conn: &PgPooledConn,
merchant_id: &common_utils::id_type::MerchantId,
) -> StorageResult<Vec<PaymentAttempt>> {
let query = diesel::delete(<PaymentAttempt>::table())
.filter(payment_attempt_dsl::merchant_id.eq(merchant_id.to_owned()))
.filter(payment_attempt_dsl::payment_id.like("test_%"));
logger::debug!(query = %debug_query::<diesel::pg::Pg,_>(&query).to_string());
query
.get_results_async(conn)
.await
.change_context(errors::DatabaseError::Others)
.attach_printable("Error while deleting payment attempts")
.and_then(|result| match result.len() {
n if n > 0 => {
logger::debug!("{n} records deleted");
Ok(result)
}
0 => Err(error_stack::report!(errors::DatabaseError::NotFound)
.attach_printable("No records deleted")),
_ => Ok(result),
})
}
pub async fn delete_refunds(
conn: &PgPooledConn,
merchant_id: &common_utils::id_type::MerchantId,
) -> StorageResult<Vec<Refund>> {
let query = diesel::delete(<Refund>::table())
.filter(refund_dsl::merchant_id.eq(merchant_id.to_owned()))
.filter(refund_dsl::payment_id.like("test_%"));
logger::debug!(query = %debug_query::<diesel::pg::Pg,_>(&query).to_string());
query
.get_results_async(conn)
.await
.change_context(errors::DatabaseError::Others)
.attach_printable("Error while deleting refunds")
.and_then(|result| match result.len() {
n if n > 0 => {
logger::debug!("{n} records deleted");
Ok(result)
}
0 => Err(error_stack::report!(errors::DatabaseError::NotFound)
.attach_printable("No records deleted")),
_ => Ok(result),
})
}
pub async fn delete_disputes(
conn: &PgPooledConn,
merchant_id: &common_utils::id_type::MerchantId,
) -> StorageResult<Vec<Dispute>> {
let query = diesel::delete(<Dispute>::table())
.filter(dispute_dsl::merchant_id.eq(merchant_id.to_owned()))
.filter(dispute_dsl::dispute_id.like("test_%"));
logger::debug!(query = %debug_query::<diesel::pg::Pg,_>(&query).to_string());
query
.get_results_async(conn)
.await
.change_context(errors::DatabaseError::Others)
.attach_printable("Error while deleting disputes")
.and_then(|result| match result.len() {
n if n > 0 => {
logger::debug!("{n} records deleted");
Ok(result)
}
0 => Err(error_stack::report!(errors::DatabaseError::NotFound)
.attach_printable("No records deleted")),
_ => Ok(result),
})
}
|
crates/diesel_models/src/query/user/sample_data.rs
|
diesel_models
|
full_file
| null | null | null | 1,818
| null | null | null | null | null | null | null |
// Struct: RedsysEmv3DSData
// File: crates/hyperswitch_connectors/src/connectors/redsys/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct RedsysEmv3DSData
|
crates/hyperswitch_connectors/src/connectors/redsys/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
RedsysEmv3DSData
| 0
|
[] | 55
| null | null | null | null | null | null | null |
// File: crates/openapi/src/routes/payments.rs
// Module: openapi
// Public functions: 26
/// Payments - Create
///
/// Creates a payment resource, which represents a customer's intent to pay.
/// This endpoint is the starting point for various payment flows:
///
#[utoipa::path(
post,
path = "/payments",
request_body(
content = PaymentsCreateRequest,
examples(
(
"01. Create a payment with minimal fields" = (
value = json!({"amount": 6540,"currency": "USD"})
)
),
(
"02. Create a payment with customer details and metadata" = (
value = json!({
"amount": 6540,
"currency": "USD",
"payment_id": "abcdefghijklmnopqrstuvwxyz",
"customer": {
"id": "cus_abcdefgh",
"name": "John Dough",
"phone": "9123456789",
"email": "[email protected]"
},
"description": "Its my first payment request",
"statement_descriptor_name": "joseph",
"statement_descriptor_suffix": "JS",
"metadata": {
"udf1": "some-value",
"udf2": "some-value"
}
})
)
),
(
"03. Create a 3DS payment" = (
value = json!({
"amount": 6540,
"currency": "USD",
"authentication_type": "three_ds"
})
)
),
(
"04. Create a manual capture payment (basic)" = (
value = json!({
"amount": 6540,
"currency": "USD",
"capture_method": "manual"
})
)
),
(
"05. Create a setup mandate payment" = (
value = json!({
"amount": 6540,
"currency": "USD",
"confirm": true,
"customer_id": "StripeCustomer123",
"authentication_type": "no_three_ds",
"payment_method": "card",
"payment_method_data": {
"card": {
"card_number": "4242424242424242",
"card_exp_month": "10",
"card_exp_year": "25",
"card_holder_name": "joseph Doe",
"card_cvc": "123"
}
},
"setup_future_usage": "off_session",
"mandate_data": {
"customer_acceptance": {
"acceptance_type": "online",
"accepted_at": "1963-05-03T04:07:52.723Z",
"online": {
"ip_address": "127.0.0.1",
"user_agent": "amet irure esse"
}
},
"mandate_type": {
"single_use": {
"amount": 6540,
"currency": "USD"
}
}
},
"customer_acceptance": {
"acceptance_type": "online",
"accepted_at": "1963-05-03T04:07:52.723Z",
"online": {
"ip_address": "127.0.0.1",
"user_agent": "amet irure esse"
}
}
})
)
),
(
"06. Create a recurring payment with mandate_id" = (
value = json!({
"amount": 6540,
"currency": "USD",
"confirm": true,
"customer_id": "StripeCustomer",
"authentication_type": "no_three_ds",
"mandate_id": "{{mandate_id}}",
"off_session": true
})
)
),
(
"07. Create a payment and save the card" = (
value = json!({
"amount": 6540,
"currency": "USD",
"confirm": true,
"customer_id": "StripeCustomer123",
"authentication_type": "no_three_ds",
"payment_method": "card",
"payment_method_data": {
"card": {
"card_number": "4242424242424242",
"card_exp_month": "10",
"card_exp_year": "25",
"card_holder_name": "joseph Doe",
"card_cvc": "123"
}
},
"customer_acceptance": {
"acceptance_type": "online",
"accepted_at": "1963-05-03T04:07:52.723Z",
"online": {
"ip_address": "127.0.0.1",
"user_agent": "amet irure esse"
}
},
"setup_future_usage": "off_session"
})
)
),
(
"08. Create a payment using an already saved card's token" = (
value = json!({
"amount": 6540,
"currency": "USD",
"confirm": true,
"client_secret": "{{client_secret}}",
"payment_method": "card",
"payment_token": "{{payment_token}}",
"card_cvc": "123"
})
)
),
(
"09. Create a payment with billing details" = (
value = json!({
"amount": 6540,
"currency": "USD",
"customer": {
"id": "cus_abcdefgh"
},
"billing": {
"address": {
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"city": "San Fransico",
"state": "California",
"zip": "94122",
"country": "US",
"first_name": "joseph",
"last_name": "Doe"
},
"phone": {
"number": "9123456789",
"country_code": "+91"
}
}
})
)
),
(
"10. Create a Stripe Split Payments CIT call" = (
value = json!({
"amount": 200,
"currency": "USD",
"profile_id": "pro_abcdefghijklmnop",
"confirm": true,
"capture_method": "automatic",
"amount_to_capture": 200,
"customer_id": "StripeCustomer123",
"setup_future_usage": "off_session",
"customer_acceptance": {
"acceptance_type": "offline",
"accepted_at": "1963-05-03T04:07:52.723Z",
"online": {
"ip_address": "125.0.0.1",
"user_agent": "amet irure esse"
}
},
"authentication_type": "no_three_ds",
"return_url": "https://hyperswitch.io",
"name": "John Doe",
"phone": "999999999",
"phone_country_code": "+65",
"description": "Its my first payment request",
"payment_method": "card",
"payment_method_type": "debit",
"payment_method_data": {
"card": {
"card_number": "4242424242424242",
"card_exp_month": "09",
"card_exp_year": "25",
"card_holder_name": "joseph Doe",
"card_cvc": "123"
}
},
"billing": {
"address": {
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"city": "San Fransico",
"state": "California",
"zip": "94122",
"country": "US",
"first_name": "joseph",
"last_name": "Doe"
},
"phone": {
"number": "9999999999",
"country_code": "+91"
}
},
"split_payments": {
"stripe_split_payment": {
"charge_type": "direct",
"application_fees": 100,
"transfer_account_id": "acct_123456789"
}
}
})
)
),
(
"11. Create a Stripe Split Payments MIT call" = (
value = json!({
"amount": 200,
"currency": "USD",
"profile_id": "pro_abcdefghijklmnop",
"customer_id": "StripeCustomer123",
"description": "Subsequent Mandate Test Payment (MIT from New CIT Demo)",
"confirm": true,
"off_session": true,
"recurring_details": {
"type": "payment_method_id",
"data": "pm_123456789"
},
"split_payments": {
"stripe_split_payment": {
"charge_type": "direct",
"application_fees": 11,
"transfer_account_id": "acct_123456789"
}
}
})
)
),
),
),
responses(
(status = 200, description = "Payment created", body = PaymentsCreateResponseOpenApi,
examples(
("01. Response for minimal payment creation (requires payment method)" = (
value = json!({
"payment_id": "pay_syxxxxxxxxxxxx",
"merchant_id": "merchant_myyyyyyyyyyyy",
"status": "requires_payment_method",
"amount": 6540,
"currency": "USD",
"client_secret": "pay_syxxxxxxxxxxxx_secret_szzzzzzzzzzz",
"created": "2023-10-26T10:00:00Z",
"amount_capturable": 6540,
"profile_id": "pro_pzzzzzzzzzzz",
"attempt_count": 1,
"expires_on": "2023-10-26T10:15:00Z"
})
)),
("02. Response for payment with customer details (requires payment method)" = (
value = json!({
"payment_id": "pay_custmeta_xxxxxxxxxxxx",
"merchant_id": "merchant_myyyyyyyyyyyy",
"status": "requires_payment_method",
"amount": 6540,
"currency": "USD",
"customer_id": "cus_abcdefgh",
"customer": {
"id": "cus_abcdefgh",
"name": "John Dough",
"email": "[email protected]",
"phone": "9123456789"
},
"description": "Its my first payment request",
"statement_descriptor_name": "joseph",
"statement_descriptor_suffix": "JS",
"metadata": {
"udf1": "some-value",
"udf2": "some-value"
},
"client_secret": "pay_custmeta_xxxxxxxxxxxx_secret_szzzzzzzzzzz",
"created": "2023-10-26T10:05:00Z",
"ephemeral_key": {
"customer_id": "cus_abcdefgh",
"secret": "epk_ephemeralxxxxxxxxxxxx"
},
"profile_id": "pro_pzzzzzzzzzzz",
"attempt_count": 1,
"expires_on": "2023-10-26T10:20:00Z"
})
)),
("03. Response for 3DS payment creation (requires payment method)" = (
value = json!({
"payment_id": "pay_3ds_xxxxxxxxxxxx",
"merchant_id": "merchant_myyyyyyyyyyyy",
"status": "requires_payment_method",
"amount": 6540,
"currency": "USD",
"authentication_type": "three_ds",
"client_secret": "pay_3ds_xxxxxxxxxxxx_secret_szzzzzzzzzzz",
"created": "2023-10-26T10:10:00Z",
"profile_id": "pro_pzzzzzzzzzzz",
"attempt_count": 1,
"expires_on": "2023-10-26T10:25:00Z"
})
)),
("04. Response for basic manual capture payment (requires payment method)" = (
value = json!({
"payment_id": "pay_manualcap_xxxxxxxxxxxx",
"merchant_id": "merchant_myyyyyyyyyyyy",
"status": "requires_payment_method",
"amount": 6540,
"currency": "USD",
"capture_method": "manual",
"client_secret": "pay_manualcap_xxxxxxxxxxxx_secret_szzzzzzzzzzz",
"created": "2023-10-26T10:15:00Z",
"profile_id": "pro_pzzzzzzzzzzz",
"attempt_count": 1,
"expires_on": "2023-10-26T10:30:00Z"
})
)),
("05. Response for successful setup mandate payment" = (
value = json!({
"payment_id": "pay_mandatesetup_xxxxxxxxxxxx",
"merchant_id": "merchant_myyyyyyyyyyyy",
"status": "succeeded",
"amount": 6540,
"currency": "USD",
"amount_capturable": 0,
"amount_received": 6540,
"connector": "fauxpay",
"customer_id": "StripeCustomer123",
"mandate_id": "man_xxxxxxxxxxxx",
"mandate_data": {
"customer_acceptance": {
"acceptance_type": "online",
"accepted_at": "1963-05-03T04:07:52.723Z",
"online": { "ip_address": "127.0.0.1", "user_agent": "amet irure esse" }
},
"mandate_type": { "single_use": { "amount": 6540, "currency": "USD" } }
},
"setup_future_usage": "on_session",
"payment_method": "card",
"payment_method_data": {
"card": { "last4": "4242", "card_exp_month": "10", "card_exp_year": "25", "card_holder_name": "joseph Doe" }
},
"authentication_type": "no_three_ds",
"client_secret": "pay_mandatesetup_xxxxxxxxxxxx_secret_szzzzzzzzzzz",
"created": "2023-10-26T10:20:00Z",
"ephemeral_key": { "customer_id": "StripeCustomer123", "secret": "epk_ephemeralxxxxxxxxxxxx" },
"profile_id": "pro_pzzzzzzzzzzz",
"attempt_count": 1,
"merchant_connector_id": "mca_mcaconnectorxxxx",
"connector_transaction_id": "txn_connectortransidxxxx"
})
)),
("06. Response for successful recurring payment with mandate_id" = (
value = json!({
"payment_id": "pay_recurring_xxxxxxxxxxxx",
"merchant_id": "merchant_myyyyyyyyyyyy",
"status": "succeeded",
"amount": 6540,
"currency": "USD",
"amount_capturable": 0,
"amount_received": 6540,
"connector": "fauxpay",
"customer_id": "StripeCustomer",
"mandate_id": "{{mandate_id}}",
"off_session": true,
"payment_method": "card",
"authentication_type": "no_three_ds",
"client_secret": "pay_recurring_xxxxxxxxxxxx_secret_szzzzzzzzzzz",
"created": "2023-10-26T10:22:00Z",
"profile_id": "pro_pzzzzzzzzzzz",
"attempt_count": 1,
"merchant_connector_id": "mca_mcaconnectorxxxx",
"connector_transaction_id": "txn_connectortransidxxxx"
})
)),
("07. Response for successful payment with card saved" = (
value = json!({
"payment_id": "pay_savecard_xxxxxxxxxxxx",
"merchant_id": "merchant_myyyyyyyyyyyy",
"status": "succeeded",
"amount": 6540,
"currency": "USD",
"amount_capturable": 0,
"amount_received": 6540,
"connector": "fauxpay",
"customer_id": "StripeCustomer123",
"setup_future_usage": "on_session",
"payment_method": "card",
"payment_method_data": {
"card": { "last4": "4242", "card_exp_month": "10", "card_exp_year": "25", "card_holder_name": "joseph Doe" }
},
"authentication_type": "no_three_ds",
"client_secret": "pay_savecard_xxxxxxxxxxxx_secret_szzzzzzzzzzz",
"created": "2023-10-26T10:25:00Z",
"ephemeral_key": { "customer_id": "StripeCustomer123", "secret": "epk_ephemeralxxxxxxxxxxxx" },
"profile_id": "pro_pzzzzzzzzzzz",
"attempt_count": 1,
"merchant_connector_id": "mca_mcaconnectorxxxx",
"connector_transaction_id": "txn_connectortransidxxxx",
"payment_token": null // Assuming payment_token is for subsequent use, not in this response.
})
)),
("08. Response for successful payment using saved card token" = (
value = json!({
"payment_id": "pay_token_xxxxxxxxxxxx",
"merchant_id": "merchant_myyyyyyyyyyyy",
"status": "succeeded",
"amount": 6540,
"currency": "USD",
"amount_capturable": 0,
"amount_received": 6540,
"connector": "fauxpay",
"payment_method": "card",
"payment_token": "{{payment_token}}",
"client_secret": "pay_token_xxxxxxxxxxxx_secret_szzzzzzzzzzz",
"created": "2023-10-26T10:27:00Z",
"profile_id": "pro_pzzzzzzzzzzz",
"attempt_count": 1,
"merchant_connector_id": "mca_mcaconnectorxxxx",
"connector_transaction_id": "txn_connectortransidxxxx"
})
)),
("09. Response for payment with billing details (requires payment method)" = (
value = json!({
"payment_id": "pay_manualbill_xxxxxxxxxxxx",
"merchant_id": "merchant_myyyyyyyyyyyy",
"status": "requires_payment_method",
"amount": 6540,
"currency": "USD",
"customer_id": "cus_abcdefgh",
"customer": {
"id": "cus_abcdefgh",
"name": "John Dough",
"email": "[email protected]",
"phone": "9123456789"
},
"billing": {
"address": {
"line1": "1467", "line2": "Harrison Street", "city": "San Fransico",
"state": "California", "zip": "94122", "country": "US",
"first_name": "joseph", "last_name": "Doe"
},
"phone": { "number": "9123456789", "country_code": "+91" }
},
"client_secret": "pay_manualbill_xxxxxxxxxxxx_secret_szzzzzzzzzzz",
"created": "2023-10-26T10:30:00Z",
"ephemeral_key": { "customer_id": "cus_abcdefgh", "secret": "epk_ephemeralxxxxxxxxxxxx" },
"profile_id": "pro_pzzzzzzzzzzz",
"attempt_count": 1,
"expires_on": "2023-10-26T10:45:00Z"
})
)),
("10. Response for the CIT call for Stripe Split Payments" = (
value = json!({
"payment_id": "pay_manualbill_xxxxxxxxxxxx",
"merchant_id": "merchant_myyyyyyyyyyyy",
"status": "succeeded",
"amount": 200,
"currency": "USD",
"customer_id": "cus_abcdefgh",
"payment_method_id": "pm_123456789",
"connector_mandate_id": "pm_abcdefgh",
"customer": {
"id": "cus_abcdefgh",
"name": "John Dough",
"email": "[email protected]",
"phone": "9123456789"
},
"billing": {
"address": {
"line1": "1467", "line2": "Harrison Street", "city": "San Fransico",
"state": "California", "zip": "94122", "country": "US",
"first_name": "joseph", "last_name": "Doe"
},
"phone": { "number": "9123456789", "country_code": "+91" }
},
"client_secret": "pay_manualbill_xxxxxxxxxxxx_secret_szzzzzzzzzzz",
"created": "2023-10-26T10:30:00Z",
"ephemeral_key": { "customer_id": "cus_abcdefgh", "secret": "epk_ephemeralxxxxxxxxxxxx" },
"profile_id": "pro_pzzzzzzzzzzz",
"attempt_count": 1,
"expires_on": "2023-10-26T10:45:00Z"
})
)),
("11. Response for the MIT call for Stripe Split Payments" = (
value = json!({
"payment_id": "pay_manualbill_xxxxxxxxxxxx",
"merchant_id": "merchant_myyyyyyyyyyyy",
"status": "succeeded",
"amount": 200,
"currency": "USD",
"customer_id": "cus_abcdefgh",
"payment_method_id": "pm_123456789",
"connector_mandate_id": "pm_abcdefgh",
"customer": {
"id": "cus_abcdefgh",
"name": "John Dough",
"email": "[email protected]",
"phone": "9123456789"
},
"billing": {
"address": {
"line1": "1467", "line2": "Harrison Street", "city": "San Fransico",
"state": "California", "zip": "94122", "country": "US",
"first_name": "joseph", "last_name": "Doe"
},
"phone": { "number": "9123456789", "country_code": "+91" }
},
"client_secret": "pay_manualbill_xxxxxxxxxxxx_secret_szzzzzzzzzzz",
"created": "2023-10-26T10:30:00Z",
"ephemeral_key": { "customer_id": "cus_abcdefgh", "secret": "epk_ephemeralxxxxxxxxxxxx" },
"profile_id": "pro_pzzzzzzzzzzz",
"attempt_count": 1,
"expires_on": "2023-10-26T10:45:00Z"
})
))
)
),
(status = 400, description = "Missing Mandatory fields", body = GenericErrorResponseOpenApi),
),
tag = "Payments",
operation_id = "Create a Payment",
security(("api_key" = [])),
)]
pub fn payments_create() {}
/// Payments - Retrieve
///
/// Retrieves a Payment. This API can also be used to get the status of a previously initiated payment or next action for an ongoing payment
#[utoipa::path(
get,
path = "/payments/{payment_id}",
params(
("payment_id" = String, Path, description = "The identifier for payment"),
("force_sync" = Option<bool>, Query, description = "Decider to enable or disable the connector call for retrieve request"),
("client_secret" = Option<String>, Query, description = "This is a token which expires after 15 minutes, used from the client to authenticate and create sessions from the SDK"),
("expand_attempts" = Option<bool>, Query, description = "If enabled provides list of attempts linked to payment intent"),
("expand_captures" = Option<bool>, Query, description = "If enabled provides list of captures linked to latest attempt"),
),
responses(
(status = 200, description = "Gets the payment with final status", body = PaymentsResponse),
(status = 404, description = "No payment found")
),
tag = "Payments",
operation_id = "Retrieve a Payment",
security(("api_key" = []), ("publishable_key" = []))
)]
pub fn payments_retrieve() {}
/// Payments - Update
///
/// To update the properties of a *PaymentIntent* object. This may include attaching a payment method, or attaching customer object or metadata fields after the Payment is created
#[utoipa::path(
post,
path = "/payments/{payment_id}",
params(
("payment_id" = String, Path, description = "The identifier for payment")
),
request_body(
content = PaymentsUpdateRequest,
examples(
(
"Update the payment amount" = (
value = json!({
"amount": 7654,
}
)
)
),
(
"Update the shipping address" = (
value = json!(
{
"shipping": {
"address": {
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"city": "San Fransico",
"state": "California",
"zip": "94122",
"country": "US",
"first_name": "joseph",
"last_name": "Doe"
},
"phone": {
"number": "9123456789",
"country_code": "+91"
}
},
}
)
)
)
)
),
responses(
(status = 200, description = "Payment updated", body = PaymentsCreateResponseOpenApi),
(status = 400, description = "Missing mandatory fields", body = GenericErrorResponseOpenApi)
),
tag = "Payments",
operation_id = "Update a Payment",
security(("api_key" = []), ("publishable_key" = []))
)]
pub fn payments_update() {}
/// Payments - Confirm
///
/// Confirms a payment intent that was previously created with `confirm: false`. This action attempts to authorize the payment with the payment processor.
///
/// Expected status transitions after confirmation:
/// - `succeeded`: If authorization is successful and `capture_method` is `automatic`.
/// - `requires_capture`: If authorization is successful and `capture_method` is `manual`.
/// - `failed`: If authorization fails.
#[utoipa::path(
post,
path = "/payments/{payment_id}/confirm",
params(
("payment_id" = String, Path, description = "The identifier for payment")
),
request_body(
content = PaymentsConfirmRequest,
examples(
(
"Confirm a payment with payment method data" = (
value = json!({
"payment_method": "card",
"payment_method_type": "credit",
"payment_method_data": {
"card": {
"card_number": "4242424242424242",
"card_exp_month": "10",
"card_exp_year": "25",
"card_holder_name": "joseph Doe",
"card_cvc": "123"
}
},
"customer_acceptance": {
"acceptance_type": "online",
"accepted_at": "1963-05-03T04:07:52.723Z",
"online": {
"ip_address": "127.0.0.1",
"user_agent": "amet irure esse"
}
}
}
)
)
)
)
),
responses(
(status = 200, description = "Payment confirmed", body = PaymentsCreateResponseOpenApi),
(status = 400, description = "Missing mandatory fields", body = GenericErrorResponseOpenApi)
),
tag = "Payments",
operation_id = "Confirm a Payment",
security(("api_key" = []), ("publishable_key" = []))
)]
pub fn payments_confirm() {}
/// Payments - Capture
///
/// Captures the funds for a previously authorized payment intent where `capture_method` was set to `manual` and the payment is in a `requires_capture` state.
///
/// Upon successful capture, the payment status usually transitions to `succeeded`.
/// The `amount_to_capture` can be specified in the request body; it must be less than or equal to the payment's `amount_capturable`. If omitted, the full capturable amount is captured.
///
/// A payment must be in a capturable state (e.g., `requires_capture`). Attempting to capture an already `succeeded` (and fully captured) payment or one in an invalid state will lead to an error.
///
#[utoipa::path(
post,
path = "/payments/{payment_id}/capture",
params(
("payment_id" = String, Path, description = "The identifier for payment")
),
request_body (
content = PaymentsCaptureRequest,
examples(
(
"Capture the full amount" = (
value = json!({})
)
),
(
"Capture partial amount" = (
value = json!({"amount_to_capture": 654})
)
),
)
),
responses(
(status = 200, description = "Payment captured", body = PaymentsResponse),
(status = 400, description = "Missing mandatory fields", body = GenericErrorResponseOpenApi)
),
tag = "Payments",
operation_id = "Capture a Payment",
security(("api_key" = []))
)]
pub fn payments_capture() {}
#[cfg(feature = "v1")]
/// Payments - Session token
///
/// Creates a session object or a session token for wallets like Apple Pay, Google Pay, etc. These tokens are used by Hyperswitch's SDK to initiate these wallets' SDK.
#[utoipa::path(
post,
path = "/payments/session_tokens",
request_body=PaymentsSessionRequest,
responses(
(status = 200, description = "Payment session object created or session token was retrieved from wallets", body = PaymentsSessionResponse),
(status = 400, description = "Missing mandatory fields", body = GenericErrorResponseOpenApi)
),
tag = "Payments",
operation_id = "Create Session tokens for a Payment",
security(("publishable_key" = []))
)]
pub fn payments_connector_session() {}
#[cfg(feature = "v2")]
/// Payments - Session token
///
/// Creates a session object or a session token for wallets like Apple Pay, Google Pay, etc. These tokens are used by Hyperswitch's SDK to initiate these wallets' SDK.
#[utoipa::path(
post,
path = "/v2/payments/{payment_id}/create-external-sdk-tokens",
params(
("payment_id" = String, Path, description = "The identifier for payment")
),
request_body=PaymentsSessionRequest,
responses(
(status = 200, description = "Payment session object created or session token was retrieved from wallets", body = PaymentsSessionResponse),
(status = 400, description = "Missing mandatory fields", body = GenericErrorResponseOpenApi)
),
tag = "Payments",
operation_id = "Create V2 Session tokens for a Payment",
security(("publishable_key" = []))
)]
pub fn payments_connector_session() {}
/// Payments - Cancel
///
/// A Payment could can be cancelled when it is in one of these statuses: `requires_payment_method`, `requires_capture`, `requires_confirmation`, `requires_customer_action`.
#[utoipa::path(
post,
path = "/payments/{payment_id}/cancel",
request_body (
content = PaymentsCancelRequest,
examples(
(
"Cancel the payment with minimal fields" = (
value = json!({})
)
),
(
"Cancel the payment with cancellation reason" = (
value = json!({"cancellation_reason": "requested_by_customer"})
)
),
)
),
params(
("payment_id" = String, Path, description = "The identifier for payment")
),
responses(
(status = 200, description = "Payment canceled"),
(status = 400, description = "Missing mandatory fields", body = GenericErrorResponseOpenApi)
),
tag = "Payments",
operation_id = "Cancel a Payment",
security(("api_key" = []))
)]
pub fn payments_cancel() {}
/// Payments - Cancel Post Capture
///
/// A Payment could can be cancelled when it is in one of these statuses: `succeeded`, `partially_captured`, `partially_captured_and_capturable`.
#[utoipa::path(
post,
path = "/payments/{payment_id}/cancel_post_capture",
request_body (
content = PaymentsCancelPostCaptureRequest,
examples(
(
"Cancel the payment post capture with minimal fields" = (
value = json!({})
)
),
(
"Cancel the payment post capture with cancellation reason" = (
value = json!({"cancellation_reason": "requested_by_customer"})
)
),
)
),
params(
("payment_id" = String, Path, description = "The identifier for payment")
),
responses(
(status = 200, description = "Payment canceled post capture"),
(status = 400, description = "Missing mandatory fields", body = GenericErrorResponseOpenApi)
),
tag = "Payments",
operation_id = "Cancel a Payment Post Capture",
security(("api_key" = []))
)]
pub fn payments_cancel_post_capture() {}
/// Payments - List
///
/// To list the *payments*
#[cfg(feature = "v1")]
#[utoipa::path(
get,
path = "/payments/list",
params(
("customer_id" = Option<String>, Query, description = "The identifier for the customer"),
("starting_after" = Option<String>, Query, description = "A cursor for use in pagination, fetch the next list after some object"),
("ending_before" = Option<String>, Query, description = "A cursor for use in pagination, fetch the previous list before some object"),
("limit" = Option<i64>, Query, description = "Limit on the number of objects to return"),
("created" = Option<PrimitiveDateTime>, Query, description = "The time at which payment is created"),
("created_lt" = Option<PrimitiveDateTime>, Query, description = "Time less than the payment created time"),
("created_gt" = Option<PrimitiveDateTime>, Query, description = "Time greater than the payment created time"),
("created_lte" = Option<PrimitiveDateTime>, Query, description = "Time less than or equals to the payment created time"),
("created_gte" = Option<PrimitiveDateTime>, Query, description = "Time greater than or equals to the payment created time")
),
responses(
|
crates/openapi/src/routes/payments.rs#chunk0
|
openapi
|
chunk
| null | null | null | 8,180
| null | null | null | null | null | null | null |
// Function: list_orgs_for_user
// File: crates/router/src/core/user.rs
// Module: router
pub fn list_orgs_for_user(
state: SessionState,
user_from_token: auth::UserFromToken,
) -> UserResponse<Vec<user_api::ListOrgsForUserResponse>>
|
crates/router/src/core/user.rs
|
router
|
function_signature
| null | null | null | 65
|
list_orgs_for_user
| null | null | null | null | null | null |
// Trait: PaymentMetricAccumulator
// File: crates/analytics/src/payments/accumulator.rs
// Module: analytics
pub trait PaymentMetricAccumulator
|
crates/analytics/src/payments/accumulator.rs
|
analytics
|
trait_definition
| null | null | null | 34
| null | null |
PaymentMetricAccumulator
| null | null | null | null |
// Function: apple_pay_merchant_registration
// File: crates/router/src/routes/verification.rs
// Module: router
pub fn apple_pay_merchant_registration(
state: web::Data<AppState>,
req: HttpRequest,
json_payload: web::Json<verifications::ApplepayMerchantVerificationRequest>,
path: web::Path<common_utils::id_type::MerchantId>,
) -> impl Responder
|
crates/router/src/routes/verification.rs
|
router
|
function_signature
| null | null | null | 85
|
apple_pay_merchant_registration
| null | null | null | null | null | null |
// Struct: GooglePayAssuranceDetails
// File: crates/hyperswitch_domain_models/src/payment_method_data.rs
// Module: hyperswitch_domain_models
// Implementations: 0
pub struct GooglePayAssuranceDetails
|
crates/hyperswitch_domain_models/src/payment_method_data.rs
|
hyperswitch_domain_models
|
struct_definition
|
GooglePayAssuranceDetails
| 0
|
[] | 47
| null | null | null | null | null | null | null |
// Implementation: impl ConnectorResponseNew
// File: crates/diesel_models/src/query/connector_response.rs
// Module: diesel_models
// Methods: 1 total (0 public)
impl ConnectorResponseNew
|
crates/diesel_models/src/query/connector_response.rs
|
diesel_models
|
impl_block
| null | null | null | 42
| null |
ConnectorResponseNew
| null | 1
| 0
| null | null |
// Implementation: impl api::PaymentToken for for Paypal
// File: crates/hyperswitch_connectors/src/connectors/paypal.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::PaymentToken for for Paypal
|
crates/hyperswitch_connectors/src/connectors/paypal.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 55
| null |
Paypal
|
api::PaymentToken for
| 0
| 0
| null | null |
// Struct: SilverflowWebhookEvent
// File: crates/hyperswitch_connectors/src/connectors/silverflow/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct SilverflowWebhookEvent
|
crates/hyperswitch_connectors/src/connectors/silverflow/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
SilverflowWebhookEvent
| 0
|
[] | 52
| null | null | null | null | null | null | null |
// Struct: AvsResponse
// File: crates/hyperswitch_connectors/src/connectors/authipay/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct AvsResponse
|
crates/hyperswitch_connectors/src/connectors/authipay/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
AvsResponse
| 0
|
[] | 47
| null | null | null | null | null | null | null |
// Implementation: impl api::PaymentVoid for for Mpgs
// File: crates/hyperswitch_connectors/src/connectors/mpgs.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::PaymentVoid for for Mpgs
|
crates/hyperswitch_connectors/src/connectors/mpgs.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 59
| null |
Mpgs
|
api::PaymentVoid for
| 0
| 0
| null | null |
// Struct: CheckTokenStatus
// File: crates/router/src/types/payment_methods.rs
// Module: router
// Implementations: 0
pub struct CheckTokenStatus
|
crates/router/src/types/payment_methods.rs
|
router
|
struct_definition
|
CheckTokenStatus
| 0
|
[] | 35
| null | null | null | null | null | null | null |
// Implementation: impl api::Refund for for Stripebilling
// File: crates/hyperswitch_connectors/src/connectors/stripebilling.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::Refund for for Stripebilling
|
crates/hyperswitch_connectors/src/connectors/stripebilling.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 58
| null |
Stripebilling
|
api::Refund for
| 0
| 0
| null | null |
// Struct: SessionRoutingPmTypeInput
// File: crates/router/src/core/payments/routing.rs
// Module: router
// Implementations: 0
pub struct SessionRoutingPmTypeInput<'a>
|
crates/router/src/core/payments/routing.rs
|
router
|
struct_definition
|
SessionRoutingPmTypeInput
| 0
|
[] | 46
| null | null | null | null | null | null | null |
// Function: server
// File: crates/router/src/routes/app.rs
// Module: router
pub fn server(state: AppState) -> Scope
|
crates/router/src/routes/app.rs
|
router
|
function_signature
| null | null | null | 29
|
server
| null | null | null | null | null | null |
// Implementation: impl PaymentMethodUpdateInternal
// File: crates/diesel_models/src/payment_method.rs
// Module: diesel_models
// Methods: 1 total (1 public)
impl PaymentMethodUpdateInternal
|
crates/diesel_models/src/payment_method.rs
|
diesel_models
|
impl_block
| null | null | null | 42
| null |
PaymentMethodUpdateInternal
| null | 1
| 1
| null | null |
// Function: get_allowed_signals
// File: crates/common_utils/src/signals.rs
// Module: common_utils
pub fn get_allowed_signals() -> Result<DummySignal, std::io::Error>
|
crates/common_utils/src/signals.rs
|
common_utils
|
function_signature
| null | null | null | 42
|
get_allowed_signals
| null | null | null | null | null | null |
// Implementation: impl api::PaymentSessionUpdate for for Paypal
// File: crates/hyperswitch_connectors/src/connectors/paypal.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::PaymentSessionUpdate for for Paypal
|
crates/hyperswitch_connectors/src/connectors/paypal.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 57
| null |
Paypal
|
api::PaymentSessionUpdate for
| 0
| 0
| null | null |
// File: crates/openapi/src/routes/organization.rs
// Module: openapi
// Public functions: 7
#[cfg(feature = "v1")]
/// Organization - Create
///
/// Create a new organization
#[utoipa::path(
post,
path = "/organization",
request_body(
content = OrganizationCreateRequest,
examples(
(
"Create an organization with organization_name" = (
value = json!({"organization_name": "organization_abc"})
)
),
)
),
responses(
(status = 200, description = "Organization Created", body =OrganizationResponse),
(status = 400, description = "Invalid data")
),
tag = "Organization",
operation_id = "Create an Organization",
security(("admin_api_key" = []))
)]
pub async fn organization_create() {}
#[cfg(feature = "v1")]
/// Organization - Retrieve
///
/// Retrieve an existing organization
#[utoipa::path(
get,
path = "/organization/{id}",
params (("id" = String, Path, description = "The unique identifier for the Organization")),
responses(
(status = 200, description = "Organization Created", body =OrganizationResponse),
(status = 400, description = "Invalid data")
),
tag = "Organization",
operation_id = "Retrieve an Organization",
security(("admin_api_key" = []))
)]
pub async fn organization_retrieve() {}
#[cfg(feature = "v1")]
/// Organization - Update
///
/// Create a new organization for .
#[utoipa::path(
put,
path = "/organization/{id}",
request_body(
content = OrganizationUpdateRequest,
examples(
(
"Update organization_name of the organization" = (
value = json!({"organization_name": "organization_abcd"})
)
),
)
),
params (("id" = String, Path, description = "The unique identifier for the Organization")),
responses(
(status = 200, description = "Organization Created", body =OrganizationResponse),
(status = 400, description = "Invalid data")
),
tag = "Organization",
operation_id = "Update an Organization",
security(("admin_api_key" = []))
)]
pub async fn organization_update() {}
#[cfg(feature = "v2")]
/// Organization - Create
///
/// Create a new organization
#[utoipa::path(
post,
path = "/v2/organizations",
request_body(
content = OrganizationCreateRequest,
examples(
(
"Create an organization with organization_name" = (
value = json!({"organization_name": "organization_abc"})
)
),
)
),
responses(
(status = 200, description = "Organization Created", body =OrganizationResponse),
(status = 400, description = "Invalid data")
),
tag = "Organization",
operation_id = "Create an Organization",
security(("admin_api_key" = []))
)]
pub async fn organization_create() {}
#[cfg(feature = "v2")]
/// Organization - Retrieve
///
/// Retrieve an existing organization
#[utoipa::path(
get,
path = "/v2/organizations/{id}",
params (("id" = String, Path, description = "The unique identifier for the Organization")),
responses(
(status = 200, description = "Organization Created", body =OrganizationResponse),
(status = 400, description = "Invalid data")
),
tag = "Organization",
operation_id = "Retrieve an Organization",
security(("admin_api_key" = []))
)]
pub async fn organization_retrieve() {}
#[cfg(feature = "v2")]
/// Organization - Update
///
/// Create a new organization for .
#[utoipa::path(
put,
path = "/v2/organizations/{id}",
request_body(
content = OrganizationUpdateRequest,
examples(
(
"Update organization_name of the organization" = (
value = json!({"organization_name": "organization_abcd"})
)
),
)
),
params (("id" = String, Path, description = "The unique identifier for the Organization")),
responses(
(status = 200, description = "Organization Created", body =OrganizationResponse),
(status = 400, description = "Invalid data")
),
tag = "Organization",
operation_id = "Update an Organization",
security(("admin_api_key" = []))
)]
pub async fn organization_update() {}
#[cfg(feature = "v2")]
/// Organization - Merchant Account - List
///
/// List merchant accounts for an Organization
#[utoipa::path(
get,
path = "/v2/organizations/{id}/merchant-accounts",
params (("id" = String, Path, description = "The unique identifier for the Organization")),
responses(
(status = 200, description = "Merchant Account list retrieved successfully", body = Vec<MerchantAccountResponse>),
(status = 400, description = "Invalid data")
),
tag = "Organization",
operation_id = "List Merchant Accounts",
security(("admin_api_key" = []))
)]
pub async fn merchant_account_list() {}
|
crates/openapi/src/routes/organization.rs
|
openapi
|
full_file
| null | null | null | 1,120
| null | null | null | null | null | null | null |
// Implementation: impl api::Payment for for Chargebee
// File: crates/hyperswitch_connectors/src/connectors/chargebee.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::Payment for for Chargebee
|
crates/hyperswitch_connectors/src/connectors/chargebee.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 56
| null |
Chargebee
|
api::Payment for
| 0
| 0
| null | null |
// Struct: ListRolesAtEntityLevelRequest
// File: crates/api_models/src/user_role/role.rs
// Module: api_models
// Implementations: 0
pub struct ListRolesAtEntityLevelRequest
|
crates/api_models/src/user_role/role.rs
|
api_models
|
struct_definition
|
ListRolesAtEntityLevelRequest
| 0
|
[] | 44
| null | null | null | null | null | null | null |
// Struct: PaymentMethodAuthConnectorChoice
// File: crates/api_models/src/pm_auth.rs
// Module: api_models
// Implementations: 0
pub struct PaymentMethodAuthConnectorChoice
|
crates/api_models/src/pm_auth.rs
|
api_models
|
struct_definition
|
PaymentMethodAuthConnectorChoice
| 0
|
[] | 40
| null | null | null | null | null | null | null |
// Function: get_org_dispute_metrics
// File: crates/router/src/analytics.rs
// Module: router
// Documentation: Panics if `json_payload` array does not contain one `GetDisputeMetricRequest` element.
pub fn get_org_dispute_metrics(
state: web::Data<AppState>,
req: actix_web::HttpRequest,
json_payload: web::Json<[GetDisputeMetricRequest; 1]>,
) -> impl Responder
|
crates/router/src/analytics.rs
|
router
|
function_signature
| null | null | null | 98
|
get_org_dispute_metrics
| null | null | null | null | null | null |
// Function: get_transaction_id
// File: crates/hyperswitch_connectors/src/connectors/nexinets/transformers.rs
// Module: hyperswitch_connectors
pub fn get_transaction_id(
meta: &NexinetsPaymentsMetadata,
) -> Result<String, error_stack::Report<errors::ConnectorError>>
|
crates/hyperswitch_connectors/src/connectors/nexinets/transformers.rs
|
hyperswitch_connectors
|
function_signature
| null | null | null | 69
|
get_transaction_id
| null | null | null | null | null | null |
// Struct: FiservAuthType
// File: crates/hyperswitch_connectors/src/connectors/fiserv/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct FiservAuthType
|
crates/hyperswitch_connectors/src/connectors/fiserv/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
FiservAuthType
| 0
|
[] | 52
| null | null | null | null | null | null | null |
// Function: totp_begin
// File: crates/router/src/routes/user.rs
// Module: router
pub fn totp_begin(state: web::Data<AppState>, req: HttpRequest) -> HttpResponse
|
crates/router/src/routes/user.rs
|
router
|
function_signature
| null | null | null | 41
|
totp_begin
| null | null | null | null | null | null |
// Struct: TenantID
// File: crates/router/src/db/kafka_store.rs
// Module: router
// Implementations: 0
pub struct TenantID
|
crates/router/src/db/kafka_store.rs
|
router
|
struct_definition
|
TenantID
| 0
|
[] | 34
| null | null | null | null | null | null | null |
// Trait: EuclidAnalysable
// File: crates/euclid/src/dssa/types.rs
// Module: euclid
pub trait EuclidAnalysable: Sized
|
crates/euclid/src/dssa/types.rs
|
euclid
|
trait_definition
| null | null | null | 37
| null | null |
EuclidAnalysable
| null | null | null | null |
// Struct: BluecodeErrorResponse
// File: crates/hyperswitch_connectors/src/connectors/bluecode/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct BluecodeErrorResponse
|
crates/hyperswitch_connectors/src/connectors/bluecode/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
BluecodeErrorResponse
| 0
|
[] | 47
| null | null | null | null | null | null | null |
// File: crates/scheduler/src/consumer/types/batch.rs
// Module: scheduler
// Public functions: 2
// Public structs: 1
use std::collections::HashMap;
use common_utils::{errors::CustomResult, ext_traits::OptionExt};
use diesel_models::process_tracker::ProcessTracker;
use error_stack::ResultExt;
use time::PrimitiveDateTime;
use crate::errors;
#[derive(Debug, Clone)]
pub struct ProcessTrackerBatch {
pub id: String,
pub group_name: String,
pub stream_name: String,
pub connection_name: String,
pub created_time: PrimitiveDateTime,
pub rule: String, // is it required?
pub trackers: Vec<ProcessTracker>, /* FIXME: Add sized also here, list */
}
impl ProcessTrackerBatch {
pub fn to_redis_field_value_pairs(
&self,
) -> CustomResult<Vec<(&str, String)>, errors::ProcessTrackerError> {
Ok(vec![
("id", self.id.to_string()),
("group_name", self.group_name.to_string()),
("stream_name", self.stream_name.to_string()),
("connection_name", self.connection_name.to_string()),
(
"created_time",
self.created_time.assume_utc().unix_timestamp().to_string(),
),
("rule", self.rule.to_string()),
(
"trackers",
serde_json::to_string(&self.trackers)
.change_context(errors::ProcessTrackerError::SerializationFailed)
.attach_printable_lazy(|| {
format!("Unable to stringify trackers: {:?}", self.trackers)
})?,
),
])
}
pub fn from_redis_stream_entry(
entry: HashMap<String, Option<String>>,
) -> CustomResult<Self, errors::ProcessTrackerError> {
let mut entry = entry;
let id = entry
.remove("id")
.flatten()
.get_required_value("id")
.change_context(errors::ProcessTrackerError::MissingRequiredField)?;
let group_name = entry
.remove("group_name")
.flatten()
.get_required_value("group_name")
.change_context(errors::ProcessTrackerError::MissingRequiredField)?;
let stream_name = entry
.remove("stream_name")
.flatten()
.get_required_value("stream_name")
.change_context(errors::ProcessTrackerError::MissingRequiredField)?;
let connection_name = entry
.remove("connection_name")
.flatten()
.get_required_value("connection_name")
.change_context(errors::ProcessTrackerError::MissingRequiredField)?;
let created_time = entry
.remove("created_time")
.flatten()
.get_required_value("created_time")
.change_context(errors::ProcessTrackerError::MissingRequiredField)?;
//make it parser error
let created_time = {
let offset_date_time = time::OffsetDateTime::from_unix_timestamp(
created_time
.as_str()
.parse::<i64>()
.change_context(errors::ParsingError::UnknownError)
.change_context(errors::ProcessTrackerError::DeserializationFailed)?,
)
.attach_printable_lazy(|| format!("Unable to parse time {}", &created_time))
.change_context(errors::ProcessTrackerError::MissingRequiredField)?;
PrimitiveDateTime::new(offset_date_time.date(), offset_date_time.time())
};
let rule = entry
.remove("rule")
.flatten()
.get_required_value("rule")
.change_context(errors::ProcessTrackerError::MissingRequiredField)?;
let trackers = entry
.remove("trackers")
.flatten()
.get_required_value("trackers")
.change_context(errors::ProcessTrackerError::MissingRequiredField)?;
let trackers = serde_json::from_str::<Vec<ProcessTracker>>(trackers.as_str())
.change_context(errors::ParsingError::UnknownError)
.attach_printable_lazy(|| {
format!("Unable to parse trackers from JSON string: {trackers:?}")
})
.change_context(errors::ProcessTrackerError::DeserializationFailed)
.attach_printable("Error parsing ProcessTracker from redis stream entry")?;
Ok(Self {
id,
group_name,
stream_name,
connection_name,
created_time,
rule,
trackers,
})
}
}
|
crates/scheduler/src/consumer/types/batch.rs
|
scheduler
|
full_file
| null | null | null | 903
| null | null | null | null | null | null | null |
// Implementation: impl api::ConnectorAccessToken for for Bankofamerica
// File: crates/hyperswitch_connectors/src/connectors/bankofamerica.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::ConnectorAccessToken for for Bankofamerica
|
crates/hyperswitch_connectors/src/connectors/bankofamerica.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 64
| null |
Bankofamerica
|
api::ConnectorAccessToken for
| 0
| 0
| null | null |
// Function: save_in_locker_external
// File: crates/router/src/core/payments/tokenization.rs
// Module: router
pub fn save_in_locker_external(
state: &SessionState,
merchant_context: &domain::MerchantContext,
payment_method_request: api::PaymentMethodCreate,
card_detail: Option<api::CardDetail>,
external_vault_connector_details: &ExternalVaultConnectorDetails,
) -> RouterResult<(
api_models::payment_methods::PaymentMethodResponse,
Option<payment_methods::transformers::DataDuplicationCheck>,
)>
|
crates/router/src/core/payments/tokenization.rs
|
router
|
function_signature
| null | null | null | 119
|
save_in_locker_external
| null | null | null | null | null | null |
// File: crates/router/src/db/relay.rs
// Module: router
use common_utils::types::keymanager::KeyManagerState;
use diesel_models;
use error_stack::{report, ResultExt};
use hyperswitch_domain_models::behaviour::{Conversion, ReverseConversion};
use storage_impl::MockDb;
use super::domain;
use crate::{
connection,
core::errors::{self, CustomResult},
db::kafka_store::KafkaStore,
services::Store,
};
#[async_trait::async_trait]
pub trait RelayInterface {
async fn insert_relay(
&self,
key_manager_state: &KeyManagerState,
merchant_key_store: &domain::MerchantKeyStore,
new: hyperswitch_domain_models::relay::Relay,
) -> CustomResult<hyperswitch_domain_models::relay::Relay, errors::StorageError>;
async fn update_relay(
&self,
key_manager_state: &KeyManagerState,
merchant_key_store: &domain::MerchantKeyStore,
current_state: hyperswitch_domain_models::relay::Relay,
relay_update: hyperswitch_domain_models::relay::RelayUpdate,
) -> CustomResult<hyperswitch_domain_models::relay::Relay, errors::StorageError>;
async fn find_relay_by_id(
&self,
key_manager_state: &KeyManagerState,
merchant_key_store: &domain::MerchantKeyStore,
relay_id: &common_utils::id_type::RelayId,
) -> CustomResult<hyperswitch_domain_models::relay::Relay, errors::StorageError>;
async fn find_relay_by_profile_id_connector_reference_id(
&self,
key_manager_state: &KeyManagerState,
merchant_key_store: &domain::MerchantKeyStore,
profile_id: &common_utils::id_type::ProfileId,
connector_reference_id: &str,
) -> CustomResult<hyperswitch_domain_models::relay::Relay, errors::StorageError>;
}
#[async_trait::async_trait]
impl RelayInterface for Store {
async fn insert_relay(
&self,
key_manager_state: &KeyManagerState,
merchant_key_store: &domain::MerchantKeyStore,
new: hyperswitch_domain_models::relay::Relay,
) -> CustomResult<hyperswitch_domain_models::relay::Relay, errors::StorageError> {
let conn = connection::pg_connection_write(self).await?;
new.construct_new()
.await
.change_context(errors::StorageError::EncryptionError)?
.insert(&conn)
.await
.map_err(|error| report!(errors::StorageError::from(error)))?
.convert(
key_manager_state,
merchant_key_store.key.get_inner(),
merchant_key_store.merchant_id.clone().into(),
)
.await
.change_context(errors::StorageError::DecryptionError)
}
async fn update_relay(
&self,
key_manager_state: &KeyManagerState,
merchant_key_store: &domain::MerchantKeyStore,
current_state: hyperswitch_domain_models::relay::Relay,
relay_update: hyperswitch_domain_models::relay::RelayUpdate,
) -> CustomResult<hyperswitch_domain_models::relay::Relay, errors::StorageError> {
let conn = connection::pg_connection_write(self).await?;
Conversion::convert(current_state)
.await
.change_context(errors::StorageError::EncryptionError)?
.update(
&conn,
diesel_models::relay::RelayUpdateInternal::from(relay_update),
)
.await
.map_err(|error| report!(errors::StorageError::from(error)))?
.convert(
key_manager_state,
merchant_key_store.key.get_inner(),
merchant_key_store.merchant_id.clone().into(),
)
.await
.change_context(errors::StorageError::DecryptionError)
}
async fn find_relay_by_id(
&self,
key_manager_state: &KeyManagerState,
merchant_key_store: &domain::MerchantKeyStore,
relay_id: &common_utils::id_type::RelayId,
) -> CustomResult<hyperswitch_domain_models::relay::Relay, errors::StorageError> {
let conn = connection::pg_connection_read(self).await?;
diesel_models::relay::Relay::find_by_id(&conn, relay_id)
.await
.map_err(|error| report!(errors::StorageError::from(error)))?
.convert(
key_manager_state,
merchant_key_store.key.get_inner(),
merchant_key_store.merchant_id.clone().into(),
)
.await
.change_context(errors::StorageError::DecryptionError)
}
async fn find_relay_by_profile_id_connector_reference_id(
&self,
key_manager_state: &KeyManagerState,
merchant_key_store: &domain::MerchantKeyStore,
profile_id: &common_utils::id_type::ProfileId,
connector_reference_id: &str,
) -> CustomResult<hyperswitch_domain_models::relay::Relay, errors::StorageError> {
let conn = connection::pg_connection_read(self).await?;
diesel_models::relay::Relay::find_by_profile_id_connector_reference_id(
&conn,
profile_id,
connector_reference_id,
)
.await
.map_err(|error| report!(errors::StorageError::from(error)))?
.convert(
key_manager_state,
merchant_key_store.key.get_inner(),
merchant_key_store.merchant_id.clone().into(),
)
.await
.change_context(errors::StorageError::DecryptionError)
}
}
#[async_trait::async_trait]
impl RelayInterface for MockDb {
async fn insert_relay(
&self,
_key_manager_state: &KeyManagerState,
_merchant_key_store: &domain::MerchantKeyStore,
_new: hyperswitch_domain_models::relay::Relay,
) -> CustomResult<hyperswitch_domain_models::relay::Relay, errors::StorageError> {
Err(errors::StorageError::MockDbError)?
}
async fn update_relay(
&self,
_key_manager_state: &KeyManagerState,
_merchant_key_store: &domain::MerchantKeyStore,
_current_state: hyperswitch_domain_models::relay::Relay,
_relay_update: hyperswitch_domain_models::relay::RelayUpdate,
) -> CustomResult<hyperswitch_domain_models::relay::Relay, errors::StorageError> {
Err(errors::StorageError::MockDbError)?
}
async fn find_relay_by_id(
&self,
_key_manager_state: &KeyManagerState,
_merchant_key_store: &domain::MerchantKeyStore,
_relay_id: &common_utils::id_type::RelayId,
) -> CustomResult<hyperswitch_domain_models::relay::Relay, errors::StorageError> {
Err(errors::StorageError::MockDbError)?
}
async fn find_relay_by_profile_id_connector_reference_id(
&self,
_key_manager_state: &KeyManagerState,
_merchant_key_store: &domain::MerchantKeyStore,
_profile_id: &common_utils::id_type::ProfileId,
_connector_reference_id: &str,
) -> CustomResult<hyperswitch_domain_models::relay::Relay, errors::StorageError> {
Err(errors::StorageError::MockDbError)?
}
}
#[async_trait::async_trait]
impl RelayInterface for KafkaStore {
async fn insert_relay(
&self,
key_manager_state: &KeyManagerState,
merchant_key_store: &domain::MerchantKeyStore,
new: hyperswitch_domain_models::relay::Relay,
) -> CustomResult<hyperswitch_domain_models::relay::Relay, errors::StorageError> {
self.diesel_store
.insert_relay(key_manager_state, merchant_key_store, new)
.await
}
async fn update_relay(
&self,
key_manager_state: &KeyManagerState,
merchant_key_store: &domain::MerchantKeyStore,
current_state: hyperswitch_domain_models::relay::Relay,
relay_update: hyperswitch_domain_models::relay::RelayUpdate,
) -> CustomResult<hyperswitch_domain_models::relay::Relay, errors::StorageError> {
self.diesel_store
.update_relay(
key_manager_state,
merchant_key_store,
current_state,
relay_update,
)
.await
}
async fn find_relay_by_id(
&self,
key_manager_state: &KeyManagerState,
merchant_key_store: &domain::MerchantKeyStore,
relay_id: &common_utils::id_type::RelayId,
) -> CustomResult<hyperswitch_domain_models::relay::Relay, errors::StorageError> {
self.diesel_store
.find_relay_by_id(key_manager_state, merchant_key_store, relay_id)
.await
}
async fn find_relay_by_profile_id_connector_reference_id(
&self,
key_manager_state: &KeyManagerState,
merchant_key_store: &domain::MerchantKeyStore,
profile_id: &common_utils::id_type::ProfileId,
connector_reference_id: &str,
) -> CustomResult<hyperswitch_domain_models::relay::Relay, errors::StorageError> {
self.diesel_store
.find_relay_by_profile_id_connector_reference_id(
key_manager_state,
merchant_key_store,
profile_id,
connector_reference_id,
)
.await
}
}
|
crates/router/src/db/relay.rs
|
router
|
full_file
| null | null | null | 2,066
| null | null | null | null | null | null | null |
// Struct: JWTAuth
// File: crates/router/src/services/authentication.rs
// Module: router
// Implementations: 0
pub struct JWTAuth
|
crates/router/src/services/authentication.rs
|
router
|
struct_definition
|
JWTAuth
| 0
|
[] | 32
| null | null | null | null | null | null | null |
// Struct: TsysPaymentsSyncResponse
// File: crates/hyperswitch_connectors/src/connectors/tsys/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct TsysPaymentsSyncResponse
|
crates/hyperswitch_connectors/src/connectors/tsys/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
TsysPaymentsSyncResponse
| 0
|
[] | 51
| null | null | null | null | null | null | null |
// Struct: PaymentMethodIntentConfirm
// File: crates/api_models/src/payment_methods.rs
// Module: api_models
// Implementations: 1
pub struct PaymentMethodIntentConfirm
|
crates/api_models/src/payment_methods.rs
|
api_models
|
struct_definition
|
PaymentMethodIntentConfirm
| 1
|
[] | 38
| null | null | null | null | null | null | null |
// Implementation: impl ConnectorCommon for for Boku
// File: crates/hyperswitch_connectors/src/connectors/boku.rs
// Module: hyperswitch_connectors
// Methods: 4 total (0 public)
impl ConnectorCommon for for Boku
|
crates/hyperswitch_connectors/src/connectors/boku.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 53
| null |
Boku
|
ConnectorCommon for
| 4
| 0
| null | null |
// Struct: ArchipelIncrementalAuthorizationRequest
// File: crates/hyperswitch_connectors/src/connectors/archipel/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct ArchipelIncrementalAuthorizationRequest
|
crates/hyperswitch_connectors/src/connectors/archipel/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
ArchipelIncrementalAuthorizationRequest
| 0
|
[] | 53
| null | null | null | null | null | null | null |
// File: crates/router/src/db/dispute.rs
// Module: router
// Public structs: 1
use std::collections::HashMap;
use error_stack::report;
use hyperswitch_domain_models::disputes;
use router_env::{instrument, tracing};
use super::{MockDb, Store};
use crate::{
connection,
core::errors::{self, CustomResult},
types::storage::{self, DisputeDbExt},
};
#[async_trait::async_trait]
pub trait DisputeInterface {
async fn insert_dispute(
&self,
dispute: storage::DisputeNew,
) -> CustomResult<storage::Dispute, errors::StorageError>;
async fn find_by_merchant_id_payment_id_connector_dispute_id(
&self,
merchant_id: &common_utils::id_type::MerchantId,
payment_id: &common_utils::id_type::PaymentId,
connector_dispute_id: &str,
) -> CustomResult<Option<storage::Dispute>, errors::StorageError>;
async fn find_dispute_by_merchant_id_dispute_id(
&self,
merchant_id: &common_utils::id_type::MerchantId,
dispute_id: &str,
) -> CustomResult<storage::Dispute, errors::StorageError>;
async fn find_disputes_by_constraints(
&self,
merchant_id: &common_utils::id_type::MerchantId,
dispute_constraints: &disputes::DisputeListConstraints,
) -> CustomResult<Vec<storage::Dispute>, errors::StorageError>;
async fn find_disputes_by_merchant_id_payment_id(
&self,
merchant_id: &common_utils::id_type::MerchantId,
payment_id: &common_utils::id_type::PaymentId,
) -> CustomResult<Vec<storage::Dispute>, errors::StorageError>;
async fn update_dispute(
&self,
this: storage::Dispute,
dispute: storage::DisputeUpdate,
) -> CustomResult<storage::Dispute, errors::StorageError>;
async fn get_dispute_status_with_count(
&self,
merchant_id: &common_utils::id_type::MerchantId,
profile_id_list: Option<Vec<common_utils::id_type::ProfileId>>,
time_range: &common_utils::types::TimeRange,
) -> CustomResult<Vec<(common_enums::enums::DisputeStatus, i64)>, errors::StorageError>;
}
#[async_trait::async_trait]
impl DisputeInterface for Store {
#[instrument(skip_all)]
async fn insert_dispute(
&self,
dispute: storage::DisputeNew,
) -> CustomResult<storage::Dispute, errors::StorageError> {
let conn = connection::pg_connection_write(self).await?;
dispute
.insert(&conn)
.await
.map_err(|error| report!(errors::StorageError::from(error)))
}
#[instrument(skip_all)]
async fn find_by_merchant_id_payment_id_connector_dispute_id(
&self,
merchant_id: &common_utils::id_type::MerchantId,
payment_id: &common_utils::id_type::PaymentId,
connector_dispute_id: &str,
) -> CustomResult<Option<storage::Dispute>, errors::StorageError> {
let conn = connection::pg_connection_read(self).await?;
storage::Dispute::find_by_merchant_id_payment_id_connector_dispute_id(
&conn,
merchant_id,
payment_id,
connector_dispute_id,
)
.await
.map_err(|error| report!(errors::StorageError::from(error)))
}
#[instrument(skip_all)]
async fn find_dispute_by_merchant_id_dispute_id(
&self,
merchant_id: &common_utils::id_type::MerchantId,
dispute_id: &str,
) -> CustomResult<storage::Dispute, errors::StorageError> {
let conn = connection::pg_connection_read(self).await?;
storage::Dispute::find_by_merchant_id_dispute_id(&conn, merchant_id, dispute_id)
.await
.map_err(|error| report!(errors::StorageError::from(error)))
}
#[instrument(skip_all)]
async fn find_disputes_by_constraints(
&self,
merchant_id: &common_utils::id_type::MerchantId,
dispute_constraints: &disputes::DisputeListConstraints,
) -> CustomResult<Vec<storage::Dispute>, errors::StorageError> {
let conn = connection::pg_connection_read(self).await?;
storage::Dispute::filter_by_constraints(&conn, merchant_id, dispute_constraints)
.await
.map_err(|error| report!(errors::StorageError::from(error)))
}
#[instrument(skip_all)]
async fn find_disputes_by_merchant_id_payment_id(
&self,
merchant_id: &common_utils::id_type::MerchantId,
payment_id: &common_utils::id_type::PaymentId,
) -> CustomResult<Vec<storage::Dispute>, errors::StorageError> {
let conn = connection::pg_connection_read(self).await?;
storage::Dispute::find_by_merchant_id_payment_id(&conn, merchant_id, payment_id)
.await
.map_err(|error| report!(errors::StorageError::from(error)))
}
#[instrument(skip_all)]
async fn update_dispute(
&self,
this: storage::Dispute,
dispute: storage::DisputeUpdate,
) -> CustomResult<storage::Dispute, errors::StorageError> {
let conn = connection::pg_connection_write(self).await?;
this.update(&conn, dispute)
.await
.map_err(|error| report!(errors::StorageError::from(error)))
}
#[instrument(skip_all)]
async fn get_dispute_status_with_count(
&self,
merchant_id: &common_utils::id_type::MerchantId,
profile_id_list: Option<Vec<common_utils::id_type::ProfileId>>,
time_range: &common_utils::types::TimeRange,
) -> CustomResult<Vec<(common_enums::DisputeStatus, i64)>, errors::StorageError> {
let conn = connection::pg_connection_read(self).await?;
storage::Dispute::get_dispute_status_with_count(
&conn,
merchant_id,
profile_id_list,
time_range,
)
.await
.map_err(|error| report!(errors::StorageError::from(error)))
}
}
#[async_trait::async_trait]
impl DisputeInterface for MockDb {
async fn insert_dispute(
&self,
dispute: storage::DisputeNew,
) -> CustomResult<storage::Dispute, errors::StorageError> {
let evidence = dispute.evidence.ok_or(errors::StorageError::MockDbError)?;
let mut locked_disputes = self.disputes.lock().await;
if locked_disputes
.iter()
.any(|d| d.dispute_id == dispute.dispute_id)
{
Err(errors::StorageError::MockDbError)?;
}
let now = common_utils::date_time::now();
let new_dispute = storage::Dispute {
dispute_id: dispute.dispute_id,
amount: dispute.amount,
currency: dispute.currency,
dispute_stage: dispute.dispute_stage,
dispute_status: dispute.dispute_status,
payment_id: dispute.payment_id,
attempt_id: dispute.attempt_id,
merchant_id: dispute.merchant_id,
connector_status: dispute.connector_status,
connector_dispute_id: dispute.connector_dispute_id,
connector_reason: dispute.connector_reason,
connector_reason_code: dispute.connector_reason_code,
challenge_required_by: dispute.challenge_required_by,
connector_created_at: dispute.connector_created_at,
connector_updated_at: dispute.connector_updated_at,
created_at: now,
modified_at: now,
connector: dispute.connector,
profile_id: dispute.profile_id,
evidence,
merchant_connector_id: dispute.merchant_connector_id,
dispute_amount: dispute.dispute_amount,
organization_id: dispute.organization_id,
dispute_currency: dispute.dispute_currency,
};
locked_disputes.push(new_dispute.clone());
Ok(new_dispute)
}
async fn find_by_merchant_id_payment_id_connector_dispute_id(
&self,
merchant_id: &common_utils::id_type::MerchantId,
payment_id: &common_utils::id_type::PaymentId,
connector_dispute_id: &str,
) -> CustomResult<Option<storage::Dispute>, errors::StorageError> {
Ok(self
.disputes
.lock()
.await
.iter()
.find(|d| {
d.merchant_id == *merchant_id
&& d.payment_id == *payment_id
&& d.connector_dispute_id == connector_dispute_id
})
.cloned())
}
async fn find_dispute_by_merchant_id_dispute_id(
&self,
merchant_id: &common_utils::id_type::MerchantId,
dispute_id: &str,
) -> CustomResult<storage::Dispute, errors::StorageError> {
let locked_disputes = self.disputes.lock().await;
locked_disputes
.iter()
.find(|d| d.merchant_id == *merchant_id && d.dispute_id == dispute_id)
.cloned()
.ok_or(errors::StorageError::ValueNotFound(format!("No dispute available for merchant_id = {merchant_id:?} and dispute_id = {dispute_id}"))
.into())
}
async fn find_disputes_by_constraints(
&self,
merchant_id: &common_utils::id_type::MerchantId,
dispute_constraints: &disputes::DisputeListConstraints,
) -> CustomResult<Vec<storage::Dispute>, errors::StorageError> {
let locked_disputes = self.disputes.lock().await;
let limit_usize = dispute_constraints
.limit
.unwrap_or(u32::MAX)
.try_into()
.unwrap_or(usize::MAX);
let offset_usize = dispute_constraints
.offset
.unwrap_or(0)
.try_into()
.unwrap_or(usize::MIN);
let filtered_disputes: Vec<storage::Dispute> = locked_disputes
.iter()
.filter(|dispute| {
dispute.merchant_id == *merchant_id
&& dispute_constraints
.dispute_id
.as_ref()
.is_none_or(|id| &dispute.dispute_id == id)
&& dispute_constraints
.payment_id
.as_ref()
.is_none_or(|id| &dispute.payment_id == id)
&& dispute_constraints
.profile_id
.as_ref()
.is_none_or(|profile_ids| {
dispute
.profile_id
.as_ref()
.is_none_or(|id| profile_ids.contains(id))
})
&& dispute_constraints
.dispute_status
.as_ref()
.is_none_or(|statuses| statuses.contains(&dispute.dispute_status))
&& dispute_constraints
.dispute_stage
.as_ref()
.is_none_or(|stages| stages.contains(&dispute.dispute_stage))
&& dispute_constraints.reason.as_ref().is_none_or(|reason| {
dispute
.connector_reason
.as_ref()
.is_none_or(|d_reason| d_reason == reason)
})
&& dispute_constraints
.connector
.as_ref()
.is_none_or(|connectors| {
connectors
.iter()
.any(|connector| dispute.connector.as_str() == *connector)
})
&& dispute_constraints
.merchant_connector_id
.as_ref()
.is_none_or(|id| dispute.merchant_connector_id.as_ref() == Some(id))
&& dispute_constraints
.currency
.as_ref()
.is_none_or(|currencies| {
currencies.iter().any(|currency| {
dispute
.dispute_currency
.map(|dispute_currency| &dispute_currency == currency)
.unwrap_or(dispute.currency.as_str() == currency.to_string())
})
})
&& dispute_constraints.time_range.as_ref().is_none_or(|range| {
let dispute_time = dispute.created_at;
dispute_time >= range.start_time
&& range
.end_time
.is_none_or(|end_time| dispute_time <= end_time)
})
})
.skip(offset_usize)
.take(limit_usize)
.cloned()
.collect();
Ok(filtered_disputes)
}
async fn find_disputes_by_merchant_id_payment_id(
&self,
merchant_id: &common_utils::id_type::MerchantId,
payment_id: &common_utils::id_type::PaymentId,
) -> CustomResult<Vec<storage::Dispute>, errors::StorageError> {
let locked_disputes = self.disputes.lock().await;
Ok(locked_disputes
.iter()
.filter(|d| d.merchant_id == *merchant_id && d.payment_id == *payment_id)
.cloned()
.collect())
}
async fn update_dispute(
&self,
this: storage::Dispute,
dispute: storage::DisputeUpdate,
) -> CustomResult<storage::Dispute, errors::StorageError> {
let mut locked_disputes = self.disputes.lock().await;
let dispute_to_update = locked_disputes
.iter_mut()
.find(|d| d.dispute_id == this.dispute_id)
.ok_or(errors::StorageError::MockDbError)?;
let now = common_utils::date_time::now();
match dispute {
storage::DisputeUpdate::Update {
dispute_stage,
dispute_status,
connector_status,
connector_reason,
connector_reason_code,
challenge_required_by,
connector_updated_at,
} => {
if connector_reason.is_some() {
dispute_to_update.connector_reason = connector_reason;
}
if connector_reason_code.is_some() {
dispute_to_update.connector_reason_code = connector_reason_code;
}
if challenge_required_by.is_some() {
dispute_to_update.challenge_required_by = challenge_required_by;
}
if connector_updated_at.is_some() {
dispute_to_update.connector_updated_at = connector_updated_at;
}
dispute_to_update.dispute_stage = dispute_stage;
dispute_to_update.dispute_status = dispute_status;
dispute_to_update.connector_status = connector_status;
}
storage::DisputeUpdate::StatusUpdate {
dispute_status,
connector_status,
} => {
if let Some(status) = connector_status {
dispute_to_update.connector_status = status;
}
dispute_to_update.dispute_status = dispute_status;
}
storage::DisputeUpdate::EvidenceUpdate { evidence } => {
dispute_to_update.evidence = evidence;
}
}
dispute_to_update.modified_at = now;
Ok(dispute_to_update.clone())
}
async fn get_dispute_status_with_count(
&self,
merchant_id: &common_utils::id_type::MerchantId,
profile_id_list: Option<Vec<common_utils::id_type::ProfileId>>,
time_range: &common_utils::types::TimeRange,
) -> CustomResult<Vec<(common_enums::DisputeStatus, i64)>, errors::StorageError> {
let locked_disputes = self.disputes.lock().await;
let filtered_disputes_data = locked_disputes
.iter()
.filter(|d| {
d.merchant_id == *merchant_id
&& d.created_at >= time_range.start_time
&& time_range
.end_time
.as_ref()
.is_none_or(|received_end_time| received_end_time >= &d.created_at)
&& profile_id_list
.as_ref()
.zip(d.profile_id.as_ref())
.is_none_or(|(received_profile_list, received_profile_id)| {
received_profile_list.contains(received_profile_id)
})
})
.cloned()
.collect::<Vec<storage::Dispute>>();
Ok(filtered_disputes_data
.into_iter()
.fold(
HashMap::new(),
|mut acc: HashMap<common_enums::DisputeStatus, i64>, value| {
acc.entry(value.dispute_status)
.and_modify(|value| *value += 1)
.or_insert(1);
acc
},
)
.into_iter()
.collect::<Vec<(common_enums::DisputeStatus, i64)>>())
}
}
#[cfg(test)]
mod tests {
#![allow(clippy::expect_used, clippy::unwrap_used)]
mod mockdb_dispute_interface {
use std::borrow::Cow;
use common_enums::enums::Currency;
use common_utils::types::{AmountConvertor, MinorUnit, StringMinorUnitForConnector};
use diesel_models::{
dispute::DisputeNew,
enums::{DisputeStage, DisputeStatus},
};
use hyperswitch_domain_models::disputes::DisputeListConstraints;
use masking::Secret;
use redis_interface::RedisSettings;
use serde_json::Value;
use time::macros::datetime;
use crate::db::{dispute::DisputeInterface, MockDb};
pub struct DisputeNewIds {
dispute_id: String,
payment_id: common_utils::id_type::PaymentId,
attempt_id: String,
merchant_id: common_utils::id_type::MerchantId,
connector_dispute_id: String,
}
fn create_dispute_new(dispute_ids: DisputeNewIds) -> DisputeNew {
DisputeNew {
dispute_id: dispute_ids.dispute_id,
amount: StringMinorUnitForConnector::convert(
&StringMinorUnitForConnector,
MinorUnit::new(0),
Currency::USD,
)
.expect("Amount Conversion Error"),
currency: "currency".into(),
dispute_stage: DisputeStage::Dispute,
dispute_status: DisputeStatus::DisputeOpened,
payment_id: dispute_ids.payment_id,
attempt_id: dispute_ids.attempt_id,
merchant_id: dispute_ids.merchant_id,
connector_status: "connector_status".into(),
connector_dispute_id: dispute_ids.connector_dispute_id,
connector_reason: Some("connector_reason".into()),
connector_reason_code: Some("connector_reason_code".into()),
challenge_required_by: Some(datetime!(2019-01-01 0:00)),
connector_created_at: Some(datetime!(2019-01-02 0:00)),
connector_updated_at: Some(datetime!(2019-01-03 0:00)),
connector: "connector".into(),
evidence: Some(Secret::from(Value::String("evidence".into()))),
profile_id: Some(common_utils::generate_profile_id_of_default_length()),
merchant_connector_id: None,
dispute_amount: MinorUnit::new(1040),
organization_id: common_utils::id_type::OrganizationId::default(),
dispute_currency: Some(Currency::default()),
}
}
#[tokio::test]
async fn test_insert_dispute() {
let mockdb = MockDb::new(&RedisSettings::default())
.await
.expect("Failed to create a mock DB");
let merchant_id =
common_utils::id_type::MerchantId::try_from(Cow::from("merchant_1")).unwrap();
let created_dispute = mockdb
.insert_dispute(create_dispute_new(DisputeNewIds {
dispute_id: "dispute_1".into(),
attempt_id: "attempt_1".into(),
merchant_id: merchant_id.clone(),
payment_id: common_utils::id_type::PaymentId::try_from(Cow::Borrowed(
"payment_1",
))
.unwrap(),
connector_dispute_id: "connector_dispute_1".into(),
}))
.await
.unwrap();
let found_dispute = mockdb
.disputes
.lock()
.await
.iter()
.find(|d| d.dispute_id == created_dispute.dispute_id)
.cloned();
assert!(found_dispute.is_some());
assert_eq!(created_dispute, found_dispute.unwrap());
}
#[tokio::test]
async fn test_find_by_merchant_id_payment_id_connector_dispute_id() {
let merchant_id =
common_utils::id_type::MerchantId::try_from(Cow::from("merchant_1")).unwrap();
let mockdb = MockDb::new(&RedisSettings::default())
.await
.expect("Failed to create Mock store");
let created_dispute = mockdb
.insert_dispute(create_dispute_new(DisputeNewIds {
dispute_id: "dispute_1".into(),
attempt_id: "attempt_1".into(),
merchant_id: merchant_id.clone(),
payment_id: common_utils::id_type::PaymentId::try_from(Cow::Borrowed(
"payment_1",
))
.unwrap(),
connector_dispute_id: "connector_dispute_1".into(),
}))
.await
.unwrap();
let _ = mockdb
.insert_dispute(create_dispute_new(DisputeNewIds {
dispute_id: "dispute_2".into(),
attempt_id: "attempt_1".into(),
merchant_id: merchant_id.clone(),
payment_id: common_utils::id_type::PaymentId::try_from(Cow::Borrowed(
"payment_1",
))
.unwrap(),
connector_dispute_id: "connector_dispute_2".into(),
}))
.await
.unwrap();
let found_dispute = mockdb
.find_by_merchant_id_payment_id_connector_dispute_id(
&merchant_id,
&common_utils::id_type::PaymentId::try_from(Cow::Borrowed("payment_1"))
.unwrap(),
"connector_dispute_1",
)
.await
.unwrap();
assert!(found_dispute.is_some());
assert_eq!(created_dispute, found_dispute.unwrap());
}
#[tokio::test]
async fn test_find_dispute_by_merchant_id_dispute_id() {
let merchant_id =
common_utils::id_type::MerchantId::try_from(Cow::from("merchant_1")).unwrap();
let payment_id =
common_utils::id_type::PaymentId::try_from(Cow::Borrowed("payment_1")).unwrap();
let mockdb = MockDb::new(&RedisSettings::default())
.await
.expect("Failed to create Mock store");
let created_dispute = mockdb
.insert_dispute(create_dispute_new(DisputeNewIds {
dispute_id: "dispute_1".into(),
attempt_id: "attempt_1".into(),
merchant_id: merchant_id.clone(),
payment_id: payment_id.clone(),
connector_dispute_id: "connector_dispute_1".into(),
}))
.await
.unwrap();
let _ = mockdb
.insert_dispute(create_dispute_new(DisputeNewIds {
dispute_id: "dispute_2".into(),
attempt_id: "attempt_1".into(),
merchant_id: merchant_id.clone(),
payment_id: payment_id.clone(),
connector_dispute_id: "connector_dispute_1".into(),
}))
.await
.unwrap();
let found_dispute = mockdb
.find_dispute_by_merchant_id_dispute_id(&merchant_id, "dispute_1")
.await
.unwrap();
assert_eq!(created_dispute, found_dispute);
}
#[tokio::test]
async fn test_find_disputes_by_merchant_id() {
let merchant_id =
common_utils::id_type::MerchantId::try_from(Cow::from("merchant_2")).unwrap();
let payment_id =
common_utils::id_type::PaymentId::try_from(Cow::Borrowed("payment_1")).unwrap();
let mockdb = MockDb::new(&RedisSettings::default())
.await
.expect("Failed to create Mock store");
let created_dispute = mockdb
.insert_dispute(create_dispute_new(DisputeNewIds {
dispute_id: "dispute_1".into(),
attempt_id: "attempt_1".into(),
merchant_id: merchant_id.clone(),
payment_id: payment_id.clone(),
connector_dispute_id: "connector_dispute_1".into(),
}))
.await
.unwrap();
let _ = mockdb
.insert_dispute(create_dispute_new(DisputeNewIds {
dispute_id: "dispute_2".into(),
attempt_id: "attempt_1".into(),
merchant_id: merchant_id.clone(),
payment_id: payment_id.clone(),
connector_dispute_id: "connector_dispute_1".into(),
}))
.await
.unwrap();
let found_disputes = mockdb
.find_disputes_by_constraints(
&merchant_id,
&DisputeListConstraints {
dispute_id: None,
payment_id: None,
profile_id: None,
connector: None,
merchant_connector_id: None,
currency: None,
limit: None,
offset: None,
dispute_status: None,
dispute_stage: None,
reason: None,
time_range: None,
},
)
.await
.unwrap();
assert_eq!(1, found_disputes.len());
assert_eq!(created_dispute, found_disputes.first().unwrap().clone());
}
#[tokio::test]
async fn test_find_disputes_by_merchant_id_payment_id() {
let merchant_id =
common_utils::id_type::MerchantId::try_from(Cow::from("merchant_1")).unwrap();
let payment_id =
common_utils::id_type::PaymentId::try_from(Cow::Borrowed("payment_1")).unwrap();
let mockdb = MockDb::new(&RedisSettings::default())
.await
.expect("Failed to create Mock store");
let created_dispute = mockdb
.insert_dispute(create_dispute_new(DisputeNewIds {
dispute_id: "dispute_1".into(),
attempt_id: "attempt_1".into(),
merchant_id: merchant_id.clone(),
payment_id: payment_id.clone(),
connector_dispute_id: "connector_dispute_1".into(),
}))
.await
.unwrap();
let _ = mockdb
.insert_dispute(create_dispute_new(DisputeNewIds {
dispute_id: "dispute_2".into(),
attempt_id: "attempt_1".into(),
merchant_id: merchant_id.clone(),
payment_id: payment_id.clone(),
connector_dispute_id: "connector_dispute_1".into(),
}))
.await
.unwrap();
let found_disputes = mockdb
.find_disputes_by_merchant_id_payment_id(&merchant_id, &payment_id)
.await
.unwrap();
assert_eq!(1, found_disputes.len());
assert_eq!(created_dispute, found_disputes.first().unwrap().clone());
}
mod update_dispute {
use std::borrow::Cow;
use diesel_models::{
dispute::DisputeUpdate,
enums::{DisputeStage, DisputeStatus},
};
use masking::Secret;
use serde_json::Value;
use time::macros::datetime;
use crate::db::{
dispute::{
tests::mockdb_dispute_interface::{create_dispute_new, DisputeNewIds},
DisputeInterface,
},
MockDb,
};
#[tokio::test]
async fn test_update_dispute_update() {
let merchant_id =
common_utils::id_type::MerchantId::try_from(Cow::from("merchant_1")).unwrap();
let payment_id =
common_utils::id_type::PaymentId::try_from(Cow::Borrowed("payment_1")).unwrap();
let mockdb = MockDb::new(&redis_interface::RedisSettings::default())
.await
.expect("Failed to create Mock store");
let created_dispute = mockdb
.insert_dispute(create_dispute_new(DisputeNewIds {
dispute_id: "dispute_1".into(),
attempt_id: "attempt_1".into(),
merchant_id: merchant_id.clone(),
payment_id: payment_id.clone(),
connector_dispute_id: "connector_dispute_1".into(),
}))
.await
.unwrap();
let updated_dispute = mockdb
.update_dispute(
created_dispute.clone(),
DisputeUpdate::Update {
dispute_stage: DisputeStage::PreDispute,
dispute_status: DisputeStatus::DisputeAccepted,
connector_status: "updated_connector_status".into(),
connector_reason: Some("updated_connector_reason".into()),
connector_reason_code: Some("updated_connector_reason_code".into()),
challenge_required_by: Some(datetime!(2019-01-10 0:00)),
connector_updated_at: Some(datetime!(2019-01-11 0:00)),
},
)
.await
.unwrap();
assert_eq!(created_dispute.dispute_id, updated_dispute.dispute_id);
assert_eq!(created_dispute.amount, updated_dispute.amount);
assert_eq!(created_dispute.currency, updated_dispute.currency);
assert_ne!(created_dispute.dispute_stage, updated_dispute.dispute_stage);
assert_ne!(
created_dispute.dispute_status,
updated_dispute.dispute_status
);
assert_eq!(created_dispute.payment_id, updated_dispute.payment_id);
assert_eq!(created_dispute.attempt_id, updated_dispute.attempt_id);
assert_eq!(created_dispute.merchant_id, updated_dispute.merchant_id);
assert_ne!(
created_dispute.connector_status,
updated_dispute.connector_status
);
assert_eq!(
created_dispute.connector_dispute_id,
updated_dispute.connector_dispute_id
);
assert_ne!(
created_dispute.connector_reason,
updated_dispute.connector_reason
);
assert_ne!(
created_dispute.connector_reason_code,
updated_dispute.connector_reason_code
);
assert_ne!(
created_dispute.challenge_required_by,
updated_dispute.challenge_required_by
);
assert_eq!(
created_dispute.connector_created_at,
updated_dispute.connector_created_at
);
assert_ne!(
created_dispute.connector_updated_at,
updated_dispute.connector_updated_at
);
assert_eq!(created_dispute.created_at, updated_dispute.created_at);
assert_ne!(created_dispute.modified_at, updated_dispute.modified_at);
assert_eq!(created_dispute.connector, updated_dispute.connector);
assert_eq!(created_dispute.evidence, updated_dispute.evidence);
}
#[tokio::test]
async fn test_update_dispute_update_status() {
let merchant_id =
common_utils::id_type::MerchantId::try_from(Cow::from("merchant_1")).unwrap();
let payment_id =
common_utils::id_type::PaymentId::try_from(Cow::Borrowed("payment_1")).unwrap();
let mockdb = MockDb::new(&redis_interface::RedisSettings::default())
.await
.expect("Failed to create Mock store");
let created_dispute = mockdb
.insert_dispute(create_dispute_new(DisputeNewIds {
dispute_id: "dispute_1".into(),
attempt_id: "attempt_1".into(),
merchant_id: merchant_id.clone(),
payment_id: payment_id.clone(),
connector_dispute_id: "connector_dispute_1".into(),
}))
.await
.unwrap();
let updated_dispute = mockdb
.update_dispute(
created_dispute.clone(),
DisputeUpdate::StatusUpdate {
dispute_status: DisputeStatus::DisputeExpired,
connector_status: Some("updated_connector_status".into()),
},
)
.await
.unwrap();
assert_eq!(created_dispute.dispute_id, updated_dispute.dispute_id);
assert_eq!(created_dispute.amount, updated_dispute.amount);
assert_eq!(created_dispute.currency, updated_dispute.currency);
assert_eq!(created_dispute.dispute_stage, updated_dispute.dispute_stage);
assert_ne!(
created_dispute.dispute_status,
updated_dispute.dispute_status
);
assert_eq!(created_dispute.payment_id, updated_dispute.payment_id);
assert_eq!(created_dispute.attempt_id, updated_dispute.attempt_id);
assert_eq!(created_dispute.merchant_id, updated_dispute.merchant_id);
assert_ne!(
created_dispute.connector_status,
updated_dispute.connector_status
);
assert_eq!(
created_dispute.connector_dispute_id,
updated_dispute.connector_dispute_id
);
assert_eq!(
created_dispute.connector_reason,
updated_dispute.connector_reason
);
assert_eq!(
created_dispute.connector_reason_code,
updated_dispute.connector_reason_code
);
assert_eq!(
created_dispute.challenge_required_by,
updated_dispute.challenge_required_by
);
assert_eq!(
created_dispute.connector_created_at,
updated_dispute.connector_created_at
);
assert_eq!(
created_dispute.connector_updated_at,
updated_dispute.connector_updated_at
);
assert_eq!(created_dispute.created_at, updated_dispute.created_at);
assert_ne!(created_dispute.modified_at, updated_dispute.modified_at);
assert_eq!(created_dispute.connector, updated_dispute.connector);
assert_eq!(created_dispute.evidence, updated_dispute.evidence);
}
#[tokio::test]
async fn test_update_dispute_update_evidence() {
let merchant_id =
common_utils::id_type::MerchantId::try_from(Cow::from("merchant_1")).unwrap();
let payment_id =
common_utils::id_type::PaymentId::try_from(Cow::Borrowed("payment_1")).unwrap();
let mockdb = MockDb::new(&redis_interface::RedisSettings::default())
.await
.expect("Failed to create Mock store");
let created_dispute = mockdb
.insert_dispute(create_dispute_new(DisputeNewIds {
dispute_id: "dispute_1".into(),
attempt_id: "attempt_1".into(),
merchant_id: merchant_id.clone(),
payment_id: payment_id.clone(),
connector_dispute_id: "connector_dispute_1".into(),
}))
.await
.unwrap();
let updated_dispute = mockdb
.update_dispute(
created_dispute.clone(),
DisputeUpdate::EvidenceUpdate {
evidence: Secret::from(Value::String("updated_evidence".into())),
},
)
.await
.unwrap();
assert_eq!(created_dispute.dispute_id, updated_dispute.dispute_id);
assert_eq!(created_dispute.amount, updated_dispute.amount);
assert_eq!(created_dispute.currency, updated_dispute.currency);
assert_eq!(created_dispute.dispute_stage, updated_dispute.dispute_stage);
assert_eq!(
created_dispute.dispute_status,
updated_dispute.dispute_status
);
assert_eq!(created_dispute.payment_id, updated_dispute.payment_id);
assert_eq!(created_dispute.attempt_id, updated_dispute.attempt_id);
assert_eq!(created_dispute.merchant_id, updated_dispute.merchant_id);
assert_eq!(
created_dispute.connector_status,
updated_dispute.connector_status
);
assert_eq!(
created_dispute.connector_dispute_id,
updated_dispute.connector_dispute_id
);
assert_eq!(
created_dispute.connector_reason,
updated_dispute.connector_reason
);
assert_eq!(
created_dispute.connector_reason_code,
updated_dispute.connector_reason_code
);
assert_eq!(
created_dispute.challenge_required_by,
updated_dispute.challenge_required_by
);
assert_eq!(
created_dispute.connector_created_at,
updated_dispute.connector_created_at
);
assert_eq!(
created_dispute.connector_updated_at,
updated_dispute.connector_updated_at
);
assert_eq!(created_dispute.created_at, updated_dispute.created_at);
assert_ne!(created_dispute.modified_at, updated_dispute.modified_at);
assert_eq!(created_dispute.connector, updated_dispute.connector);
assert_ne!(created_dispute.evidence, updated_dispute.evidence);
}
}
}
}
|
crates/router/src/db/dispute.rs
|
router
|
full_file
| null | null | null | 7,976
| null | null | null | null | null | null | null |
// Implementation: impl Parse for for DieselEnumMeta
// File: crates/router_derive/src/macros/diesel.rs
// Module: router_derive
// Methods: 1 total (0 public)
impl Parse for for DieselEnumMeta
|
crates/router_derive/src/macros/diesel.rs
|
router_derive
|
impl_block
| null | null | null | 49
| null |
DieselEnumMeta
|
Parse for
| 1
| 0
| null | null |
// Function: update_by_unified_code_unified_message_locale
// File: crates/diesel_models/src/query/unified_translations.rs
// Module: diesel_models
pub fn update_by_unified_code_unified_message_locale(
conn: &PgPooledConn,
unified_code: String,
unified_message: String,
locale: String,
data: UnifiedTranslationsUpdate,
) -> StorageResult<Self>
|
crates/diesel_models/src/query/unified_translations.rs
|
diesel_models
|
function_signature
| null | null | null | 86
|
update_by_unified_code_unified_message_locale
| null | null | null | null | null | null |
// Struct: StripePaymentIntentRequest
// File: crates/router/src/compatibility/stripe/payment_intents/types.rs
// Module: router
// Implementations: 0
pub struct StripePaymentIntentRequest
|
crates/router/src/compatibility/stripe/payment_intents/types.rs
|
router
|
struct_definition
|
StripePaymentIntentRequest
| 0
|
[] | 43
| null | null | null | null | null | null | null |
// Implementation: impl IncomingWebhook for for Payu
// File: crates/hyperswitch_connectors/src/connectors/payu.rs
// Module: hyperswitch_connectors
// Methods: 3 total (0 public)
impl IncomingWebhook for for Payu
|
crates/hyperswitch_connectors/src/connectors/payu.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 55
| null |
Payu
|
IncomingWebhook for
| 3
| 0
| null | null |
// Function: generate_sample_data_for_user
// File: crates/router/src/core/user/sample_data.rs
// Module: router
pub fn generate_sample_data_for_user(
state: SessionState,
user_from_token: UserFromToken,
req: SampleDataRequest,
_req_state: ReqState,
) -> SampleDataApiResponse<()>
|
crates/router/src/core/user/sample_data.rs
|
router
|
function_signature
| null | null | null | 70
|
generate_sample_data_for_user
| null | null | null | null | null | null |
// Function: find_connector_ids
// File: crates/hyperswitch_connectors/src/connectors/chargebee/transformers.rs
// Module: hyperswitch_connectors
pub fn find_connector_ids(&self) -> Result<ChargebeeMandateDetails, errors::ConnectorError>
|
crates/hyperswitch_connectors/src/connectors/chargebee/transformers.rs
|
hyperswitch_connectors
|
function_signature
| null | null | null | 59
|
find_connector_ids
| null | null | null | null | null | null |
// File: crates/router/src/types/storage/mandate.rs
// Module: router
use async_bb8_diesel::AsyncRunQueryDsl;
use common_utils::errors::CustomResult;
use diesel::{associations::HasTable, ExpressionMethods, QueryDsl};
pub use diesel_models::mandate::{
Mandate, MandateNew, MandateUpdate, MandateUpdateInternal, SingleUseMandate,
};
use diesel_models::{errors, schema::mandate::dsl};
use error_stack::ResultExt;
use crate::{connection::PgPooledConn, logger};
#[async_trait::async_trait]
pub trait MandateDbExt: Sized {
async fn filter_by_constraints(
conn: &PgPooledConn,
merchant_id: &common_utils::id_type::MerchantId,
mandate_list_constraints: api_models::mandates::MandateListConstraints,
) -> CustomResult<Vec<Self>, errors::DatabaseError>;
}
#[async_trait::async_trait]
impl MandateDbExt for Mandate {
async fn filter_by_constraints(
conn: &PgPooledConn,
merchant_id: &common_utils::id_type::MerchantId,
mandate_list_constraints: api_models::mandates::MandateListConstraints,
) -> CustomResult<Vec<Self>, errors::DatabaseError> {
let mut filter = <Self as HasTable>::table()
.filter(dsl::merchant_id.eq(merchant_id.to_owned()))
.order(dsl::created_at.desc())
.into_boxed();
if let Some(created_time) = mandate_list_constraints.created_time {
filter = filter.filter(dsl::created_at.eq(created_time));
}
if let Some(created_time_lt) = mandate_list_constraints.created_time_lt {
filter = filter.filter(dsl::created_at.lt(created_time_lt));
}
if let Some(created_time_gt) = mandate_list_constraints.created_time_gt {
filter = filter.filter(dsl::created_at.gt(created_time_gt));
}
if let Some(created_time_lte) = mandate_list_constraints.created_time_lte {
filter = filter.filter(dsl::created_at.le(created_time_lte));
}
if let Some(created_time_gte) = mandate_list_constraints.created_time_gte {
filter = filter.filter(dsl::created_at.ge(created_time_gte));
}
if let Some(connector) = mandate_list_constraints.connector {
filter = filter.filter(dsl::connector.eq(connector));
}
if let Some(mandate_status) = mandate_list_constraints.mandate_status {
filter = filter.filter(dsl::mandate_status.eq(mandate_status));
}
if let Some(limit) = mandate_list_constraints.limit {
filter = filter.limit(limit);
}
if let Some(offset) = mandate_list_constraints.offset {
filter = filter.offset(offset);
}
logger::debug!(query = %diesel::debug_query::<diesel::pg::Pg, _>(&filter).to_string());
filter
.get_results_async(conn)
.await
// The query built here returns an empty Vec when no records are found, and if any error does occur,
// it would be an internal database error, due to which we are raising a DatabaseError::Unknown error
.change_context(errors::DatabaseError::Others)
.attach_printable("Error filtering mandates by specified constraints")
}
}
|
crates/router/src/types/storage/mandate.rs
|
router
|
full_file
| null | null | null | 708
| null | null | null | null | null | null | null |
// Struct: NexixpayPaymentsRequest
// File: crates/hyperswitch_connectors/src/connectors/nexixpay/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct NexixpayPaymentsRequest
|
crates/hyperswitch_connectors/src/connectors/nexixpay/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
NexixpayPaymentsRequest
| 0
|
[] | 53
| null | null | null | null | null | null | null |
// Function: is_jwt_auth
// File: crates/router/src/services/authentication.rs
// Module: router
pub fn is_jwt_auth(headers: &HeaderMap) -> bool
|
crates/router/src/services/authentication.rs
|
router
|
function_signature
| null | null | null | 35
|
is_jwt_auth
| null | null | null | null | null | null |
// Function: construct_public_and_private_db_configs
// File: crates/router/src/utils/user.rs
// Module: router
pub fn construct_public_and_private_db_configs(
state: &SessionState,
auth_config: &user_api::AuthConfig,
encryption_key: &[u8],
id: String,
) -> UserResult<(Option<Encryption>, Option<serde_json::Value>)>
|
crates/router/src/utils/user.rs
|
router
|
function_signature
| null | null | null | 82
|
construct_public_and_private_db_configs
| null | null | null | null | null | null |
// File: crates/router/src/db/customers.rs
// Module: router
pub use hyperswitch_domain_models::customer::{CustomerInterface, CustomerListConstraints};
|
crates/router/src/db/customers.rs
|
router
|
full_file
| null | null | null | 32
| null | null | null | null | null | null | null |
"cavite" | "kabite" => Ok(Self::Cavite),
"cebu" | "sebu" => Ok(Self::Cebu),
"centralluzon" | "rehiyonnggitnangluzon" => Ok(Self::CentralLuzon),
"centralvisayas" | "rehiyonnggitnangbisaya" => Ok(Self::CentralVisayas),
"cordilleraadministrativeregion" | "rehiyonngadministratibongkordilyera" => {
Ok(Self::CordilleraAdministrativeRegion)
}
"cotabato" | "kotabato" => Ok(Self::Cotabato),
"davao" | "rehiyonngdabaw" => Ok(Self::Davao),
"davaooccidental" | "kanlurangdabaw" => Ok(Self::DavaoOccidental),
"davaooriental" | "silangangdabaw" => Ok(Self::DavaoOriental),
"davaodeoro" => Ok(Self::DavaoDeOro),
"davaodelnorte" | "hilagangdabaw" => Ok(Self::DavaoDelNorte),
"davaodelsur" | "timogdabaw" => Ok(Self::DavaoDelSur),
"dinagatislands" | "pulongdinagat" => Ok(Self::DinagatIslands),
"easternsamar" | "silangangsamar" => Ok(Self::EasternSamar),
"easternvisayas" | "rehiyonngsilangangbisaya" => Ok(Self::EasternVisayas),
"guimaras" | "gimaras" => Ok(Self::Guimaras),
"hilagangiloko" | "ilocosnorte" => Ok(Self::HilagangIloko),
"hilaganglanaw" | "lanaodelnorte" => Ok(Self::HilagangLanaw),
"hilagangmagindanaw" | "maguindanaodelnorte" => Ok(Self::HilagangMagindanaw),
"hilagangsamar" | "northernsamar" => Ok(Self::HilagangSamar),
"hilagangsambuwangga" | "zamboangadelnorte" => Ok(Self::HilagangSambuwangga),
"hilagangsurigaw" | "surigaodelnorte" => Ok(Self::HilagangSurigaw),
"ifugao" | "ipugaw" => Ok(Self::Ifugao),
"ilocos" | "rehiyonngiloko" => Ok(Self::Ilocos),
"ilocossur" | "timogiloko" => Ok(Self::IlocosSur),
"iloilo" | "iloylo" => Ok(Self::Iloilo),
"isabela" => Ok(Self::Isabela),
"kalinga" => Ok(Self::Kalinga),
"kanlurangmindoro" | "mindorooccidental" => Ok(Self::KanlurangMindoro),
"kanlurangmisamis" | "misamisoriental" => Ok(Self::KanlurangMisamis),
"kanlurangnegros" | "negrosoccidental" => Ok(Self::KanlurangNegros),
"katimogangleyte" | "southernleyte" => Ok(Self::KatimogangLeyte),
"keson" | "quezon" => Ok(Self::Keson),
"kirino" | "quirino" => Ok(Self::Kirino),
"launion" => Ok(Self::LaUnion),
"laguna" => Ok(Self::Laguna),
"lalawigangbulubundukin" | "mountainprovince" => Ok(Self::LalawigangBulubundukin),
"lanaodelsur" | "timoglanaw" => Ok(Self::LanaoDelSur),
"leyte" => Ok(Self::Leyte),
"maguidanaodelsur" | "timogmaguindanao" => Ok(Self::MaguindanaoDelSur),
"marinduque" => Ok(Self::Marinduque),
"masbate" => Ok(Self::Masbate),
"mimaropa" | "rehiyonngmimaropa" => Ok(Self::Mimaropa),
"mindorooriental" | "silingangmindoro" => Ok(Self::MindoroOriental),
"misamisoccidental" | "silingangmisamis" => Ok(Self::MisamisOccidental),
"nationalcapitalregion" | "pambansangpunonglungsod" => Ok(Self::NationalCapitalRegion),
"negrosoriental" | "silingangnegros" => Ok(Self::NegrosOriental),
"northernmindanao" | "rehiyonnghilagangmindanao" => Ok(Self::NorthernMindanao),
"nuevaecija" | "nuwevaesiha" => Ok(Self::NuevaEcija),
"nuevavizcaya" => Ok(Self::NuevaVizcaya),
"palawan" => Ok(Self::Palawan),
"pampanga" => Ok(Self::Pampanga),
"pangasinan" => Ok(Self::Pangasinan),
"rehiyonngkanlurangbisaya" | "westernvisayas" => Ok(Self::RehiyonNgKanlurangBisaya),
"rehiyonngsoccsksargen" | "soccsksargen" => Ok(Self::RehiyonNgSoccsksargen),
"rehiyonngtangwayngsambuwangga" | "zamboangapeninsula" => {
Ok(Self::RehiyonNgTangwayNgSambuwangga)
}
"risal" | "rizal" => Ok(Self::Risal),
"romblon" => Ok(Self::Romblon),
"samar" => Ok(Self::Samar),
"sambales" | "zambales" => Ok(Self::Sambales),
"sambuwanggasibugay" | "zamboangasibugay" => Ok(Self::SambuwanggaSibugay),
"sarangani" => Ok(Self::Sarangani),
"siquijor" | "sikihor" => Ok(Self::Sikihor),
"sorsogon" => Ok(Self::Sorsogon),
"southcotabato" | "timogkotabato" => Ok(Self::SouthCotabato),
"sultankudarat" => Ok(Self::SultanKudarat),
"sulu" => Ok(Self::Sulu),
"surigaodelsur" | "timogsurigaw" => Ok(Self::SurigaoDelSur),
"tarlac" => Ok(Self::Tarlac),
"tawitawi" => Ok(Self::TawiTawi),
"timogsambuwangga" | "zamboangadelsur" => Ok(Self::TimogSambuwangga),
_ => Err(errors::ConnectorError::InvalidDataFormat {
field_name: "address.state",
}
.into()),
}
}
}
impl ForeignTryFrom<String> for IndiaStatesAbbreviation {
type Error = error_stack::Report<errors::ConnectorError>;
fn foreign_try_from(value: String) -> Result<Self, Self::Error> {
let state = parse_state_enum::<Self>(value, "IndiaStatesAbbreviation", "address.state")?;
match state.as_str() {
"andamanandnicobarislands" => Ok(Self::AndamanAndNicobarIslands),
"andhrapradesh" => Ok(Self::AndhraPradesh),
"arunachalpradesh" => Ok(Self::ArunachalPradesh),
"assam" => Ok(Self::Assam),
"bihar" => Ok(Self::Bihar),
"chandigarh" => Ok(Self::Chandigarh),
"chhattisgarh" => Ok(Self::Chhattisgarh),
"dadraandnagarhavelianddamananddiu" => Ok(Self::DadraAndNagarHaveliAndDamanAndDiu),
"delhi" => Ok(Self::Delhi),
"goa" => Ok(Self::Goa),
"gujarat" => Ok(Self::Gujarat),
"haryana" => Ok(Self::Haryana),
"himachalpradesh" => Ok(Self::HimachalPradesh),
"jammuandkashmir" => Ok(Self::JammuAndKashmir),
"jharkhand" => Ok(Self::Jharkhand),
"karnataka" => Ok(Self::Karnataka),
"kerala" => Ok(Self::Kerala),
"ladakh" => Ok(Self::Ladakh),
"lakshadweep" => Ok(Self::Lakshadweep),
"madhyapradesh" => Ok(Self::MadhyaPradesh),
"maharashtra" => Ok(Self::Maharashtra),
"manipur" => Ok(Self::Manipur),
"meghalaya" => Ok(Self::Meghalaya),
"mizoram" => Ok(Self::Mizoram),
"nagaland" => Ok(Self::Nagaland),
"odisha" => Ok(Self::Odisha),
"puducherry" | "pondicherry" => Ok(Self::Puducherry),
"punjab" => Ok(Self::Punjab),
"rajasthan" => Ok(Self::Rajasthan),
"sikkim" => Ok(Self::Sikkim),
"tamilnadu" => Ok(Self::TamilNadu),
"telangana" => Ok(Self::Telangana),
"tripura" => Ok(Self::Tripura),
"uttarpradesh" => Ok(Self::UttarPradesh),
"uttarakhand" => Ok(Self::Uttarakhand),
"westbengal" => Ok(Self::WestBengal),
_ => Err(errors::ConnectorError::InvalidDataFormat {
field_name: "address.state",
}
.into()),
}
}
}
impl ForeignTryFrom<String> for MoldovaStatesAbbreviation {
type Error = error_stack::Report<errors::ConnectorError>;
fn foreign_try_from(value: String) -> Result<Self, Self::Error> {
let state_abbreviation_check =
StringExt::<Self>::parse_enum(value.clone(), "MoldovaStatesAbbreviation");
match state_abbreviation_check {
Ok(state_abbreviation) => Ok(state_abbreviation),
Err(_) => match value.as_str() {
"Anenii Noi District" => Ok(Self::AneniiNoiDistrict),
"Basarabeasca District" => Ok(Self::BasarabeascaDistrict),
"Bender Municipality" => Ok(Self::BenderMunicipality),
"Briceni District" => Ok(Self::BriceniDistrict),
"Bălți Municipality" => Ok(Self::BălțiMunicipality),
"Cahul District" => Ok(Self::CahulDistrict),
"Cantemir District" => Ok(Self::CantemirDistrict),
"Chișinău Municipality" => Ok(Self::ChișinăuMunicipality),
"Cimișlia District" => Ok(Self::CimișliaDistrict),
"Criuleni District" => Ok(Self::CriuleniDistrict),
"Călărași District" => Ok(Self::CălărașiDistrict),
"Căușeni District" => Ok(Self::CăușeniDistrict),
"Dondușeni District" => Ok(Self::DondușeniDistrict),
"Drochia District" => Ok(Self::DrochiaDistrict),
"Dubăsari District" => Ok(Self::DubăsariDistrict),
"Edineț District" => Ok(Self::EdinețDistrict),
"Florești District" => Ok(Self::FloreștiDistrict),
"Fălești District" => Ok(Self::FăleștiDistrict),
"Găgăuzia" => Ok(Self::Găgăuzia),
"Glodeni District" => Ok(Self::GlodeniDistrict),
"Hîncești District" => Ok(Self::HînceștiDistrict),
"Ialoveni District" => Ok(Self::IaloveniDistrict),
"Nisporeni District" => Ok(Self::NisporeniDistrict),
"Ocnița District" => Ok(Self::OcnițaDistrict),
"Orhei District" => Ok(Self::OrheiDistrict),
"Rezina District" => Ok(Self::RezinaDistrict),
"Rîșcani District" => Ok(Self::RîșcaniDistrict),
"Soroca District" => Ok(Self::SorocaDistrict),
"Strășeni District" => Ok(Self::StrășeniDistrict),
"Sîngerei District" => Ok(Self::SîngereiDistrict),
"Taraclia District" => Ok(Self::TaracliaDistrict),
"Telenești District" => Ok(Self::TeleneștiDistrict),
"Transnistria Autonomous Territorial Unit" => {
Ok(Self::TransnistriaAutonomousTerritorialUnit)
}
"Ungheni District" => Ok(Self::UngheniDistrict),
"Șoldănești District" => Ok(Self::ȘoldăneștiDistrict),
"Ștefan Vodă District" => Ok(Self::ȘtefanVodăDistrict),
_ => Err(errors::ConnectorError::InvalidDataFormat {
field_name: "address.state",
}
.into()),
},
}
}
}
impl ForeignTryFrom<String> for LithuaniaStatesAbbreviation {
type Error = error_stack::Report<errors::ConnectorError>;
fn foreign_try_from(value: String) -> Result<Self, Self::Error> {
let state_abbreviation_check =
StringExt::<Self>::parse_enum(value.clone(), "LithuaniaStatesAbbreviation");
match state_abbreviation_check {
Ok(state_abbreviation) => Ok(state_abbreviation),
Err(_) => match value.as_str() {
"Akmenė District Municipality" => Ok(Self::AkmeneDistrictMunicipality),
"Alytus City Municipality" => Ok(Self::AlytusCityMunicipality),
"Alytus County" => Ok(Self::AlytusCounty),
"Alytus District Municipality" => Ok(Self::AlytusDistrictMunicipality),
"Birštonas Municipality" => Ok(Self::BirstonasMunicipality),
"Biržai District Municipality" => Ok(Self::BirzaiDistrictMunicipality),
"Druskininkai municipality" => Ok(Self::DruskininkaiMunicipality),
"Elektrėnai municipality" => Ok(Self::ElektrenaiMunicipality),
"Ignalina District Municipality" => Ok(Self::IgnalinaDistrictMunicipality),
"Jonava District Municipality" => Ok(Self::JonavaDistrictMunicipality),
"Joniškis District Municipality" => Ok(Self::JoniskisDistrictMunicipality),
"Jurbarkas District Municipality" => Ok(Self::JurbarkasDistrictMunicipality),
"Kaišiadorys District Municipality" => Ok(Self::KaisiadorysDistrictMunicipality),
"Kalvarija municipality" => Ok(Self::KalvarijaMunicipality),
"Kaunas City Municipality" => Ok(Self::KaunasCityMunicipality),
"Kaunas County" => Ok(Self::KaunasCounty),
"Kaunas District Municipality" => Ok(Self::KaunasDistrictMunicipality),
"Kazlų Rūda municipality" => Ok(Self::KazluRudaMunicipality),
"Kelmė District Municipality" => Ok(Self::KelmeDistrictMunicipality),
"Klaipeda City Municipality" => Ok(Self::KlaipedaCityMunicipality),
"Klaipėda County" => Ok(Self::KlaipedaCounty),
"Klaipėda District Municipality" => Ok(Self::KlaipedaDistrictMunicipality),
"Kretinga District Municipality" => Ok(Self::KretingaDistrictMunicipality),
"Kupiškis District Municipality" => Ok(Self::KupiskisDistrictMunicipality),
"Kėdainiai District Municipality" => Ok(Self::KedainiaiDistrictMunicipality),
"Lazdijai District Municipality" => Ok(Self::LazdijaiDistrictMunicipality),
"Marijampolė County" => Ok(Self::MarijampoleCounty),
"Marijampolė Municipality" => Ok(Self::MarijampoleMunicipality),
"Mažeikiai District Municipality" => Ok(Self::MazeikiaiDistrictMunicipality),
"Molėtai District Municipality" => Ok(Self::MoletaiDistrictMunicipality),
"Neringa Municipality" => Ok(Self::NeringaMunicipality),
"Pagėgiai municipality" => Ok(Self::PagegiaiMunicipality),
"Pakruojis District Municipality" => Ok(Self::PakruojisDistrictMunicipality),
"Palanga City Municipality" => Ok(Self::PalangaCityMunicipality),
"Panevėžys City Municipality" => Ok(Self::PanevezysCityMunicipality),
"Panevėžys County" => Ok(Self::PanevezysCounty),
"Panevėžys District Municipality" => Ok(Self::PanevezysDistrictMunicipality),
"Pasvalys District Municipality" => Ok(Self::PasvalysDistrictMunicipality),
"Plungė District Municipality" => Ok(Self::PlungeDistrictMunicipality),
"Prienai District Municipality" => Ok(Self::PrienaiDistrictMunicipality),
"Radviliškis District Municipality" => Ok(Self::RadviliskisDistrictMunicipality),
"Raseiniai District Municipality" => Ok(Self::RaseiniaiDistrictMunicipality),
"Rietavas municipality" => Ok(Self::RietavasMunicipality),
"Rokiškis District Municipality" => Ok(Self::RokiskisDistrictMunicipality),
"Skuodas District Municipality" => Ok(Self::SkuodasDistrictMunicipality),
"Tauragė County" => Ok(Self::TaurageCounty),
"Tauragė District Municipality" => Ok(Self::TaurageDistrictMunicipality),
"Telšiai County" => Ok(Self::TelsiaiCounty),
"Telšiai District Municipality" => Ok(Self::TelsiaiDistrictMunicipality),
"Trakai District Municipality" => Ok(Self::TrakaiDistrictMunicipality),
"Ukmergė District Municipality" => Ok(Self::UkmergeDistrictMunicipality),
"Utena County" => Ok(Self::UtenaCounty),
"Utena District Municipality" => Ok(Self::UtenaDistrictMunicipality),
"Varėna District Municipality" => Ok(Self::VarenaDistrictMunicipality),
"Vilkaviškis District Municipality" => Ok(Self::VilkaviskisDistrictMunicipality),
"Vilnius City Municipality" => Ok(Self::VilniusCityMunicipality),
"Vilnius County" => Ok(Self::VilniusCounty),
"Vilnius District Municipality" => Ok(Self::VilniusDistrictMunicipality),
"Visaginas Municipality" => Ok(Self::VisaginasMunicipality),
"Zarasai District Municipality" => Ok(Self::ZarasaiDistrictMunicipality),
"Šakiai District Municipality" => Ok(Self::SakiaiDistrictMunicipality),
"Šalčininkai District Municipality" => Ok(Self::SalcininkaiDistrictMunicipality),
"Šiauliai City Municipality" => Ok(Self::SiauliaiCityMunicipality),
"Šiauliai County" => Ok(Self::SiauliaiCounty),
"Šiauliai District Municipality" => Ok(Self::SiauliaiDistrictMunicipality),
"Šilalė District Municipality" => Ok(Self::SilaleDistrictMunicipality),
"Šilutė District Municipality" => Ok(Self::SiluteDistrictMunicipality),
"Širvintos District Municipality" => Ok(Self::SirvintosDistrictMunicipality),
"Švenčionys District Municipality" => Ok(Self::SvencionysDistrictMunicipality),
_ => Err(errors::ConnectorError::InvalidDataFormat {
field_name: "address.state",
}
.into()),
},
}
}
}
impl ForeignTryFrom<String> for LiechtensteinStatesAbbreviation {
type Error = error_stack::Report<errors::ConnectorError>;
fn foreign_try_from(value: String) -> Result<Self, Self::Error> {
let state_abbreviation_check =
StringExt::<Self>::parse_enum(value.clone(), "LiechtensteinStatesAbbreviation");
match state_abbreviation_check {
Ok(state_abbreviation) => Ok(state_abbreviation),
Err(_) => match value.as_str() {
"Balzers" => Ok(Self::Balzers),
"Eschen" => Ok(Self::Eschen),
"Gamprin" => Ok(Self::Gamprin),
"Mauren" => Ok(Self::Mauren),
"Planken" => Ok(Self::Planken),
"Ruggell" => Ok(Self::Ruggell),
"Schaan" => Ok(Self::Schaan),
"Schellenberg" => Ok(Self::Schellenberg),
"Triesen" => Ok(Self::Triesen),
"Triesenberg" => Ok(Self::Triesenberg),
"Vaduz" => Ok(Self::Vaduz),
_ => Err(errors::ConnectorError::InvalidDataFormat {
field_name: "address.state",
}
.into()),
},
}
}
}
impl ForeignTryFrom<String> for LatviaStatesAbbreviation {
type Error = error_stack::Report<errors::ConnectorError>;
fn foreign_try_from(value: String) -> Result<Self, Self::Error> {
let state_abbreviation_check =
StringExt::<Self>::parse_enum(value.clone(), "LatviaStatesAbbreviation");
match state_abbreviation_check {
Ok(state_abbreviation) => Ok(state_abbreviation),
Err(_) => match value.as_str() {
"Aglona Municipality" => Ok(Self::AglonaMunicipality),
"Aizkraukle Municipality" => Ok(Self::AizkraukleMunicipality),
"Aizpute Municipality" => Ok(Self::AizputeMunicipality),
"Aknīste Municipality" => Ok(Self::AknīsteMunicipality),
"Aloja Municipality" => Ok(Self::AlojaMunicipality),
"Alsunga Municipality" => Ok(Self::AlsungaMunicipality),
"Alūksne Municipality" => Ok(Self::AlūksneMunicipality),
"Amata Municipality" => Ok(Self::AmataMunicipality),
"Ape Municipality" => Ok(Self::ApeMunicipality),
"Auce Municipality" => Ok(Self::AuceMunicipality),
"Babīte Municipality" => Ok(Self::BabīteMunicipality),
"Baldone Municipality" => Ok(Self::BaldoneMunicipality),
"Baltinava Municipality" => Ok(Self::BaltinavaMunicipality),
"Balvi Municipality" => Ok(Self::BalviMunicipality),
"Bauska Municipality" => Ok(Self::BauskaMunicipality),
"Beverīna Municipality" => Ok(Self::BeverīnaMunicipality),
"Brocēni Municipality" => Ok(Self::BrocēniMunicipality),
"Burtnieki Municipality" => Ok(Self::BurtniekiMunicipality),
"Carnikava Municipality" => Ok(Self::CarnikavaMunicipality),
"Cesvaine Municipality" => Ok(Self::CesvaineMunicipality),
"Cibla Municipality" => Ok(Self::CiblaMunicipality),
"Cēsis Municipality" => Ok(Self::CēsisMunicipality),
"Dagda Municipality" => Ok(Self::DagdaMunicipality),
"Daugavpils" => Ok(Self::Daugavpils),
"Daugavpils Municipality" => Ok(Self::DaugavpilsMunicipality),
"Dobele Municipality" => Ok(Self::DobeleMunicipality),
"Dundaga Municipality" => Ok(Self::DundagaMunicipality),
"Durbe Municipality" => Ok(Self::DurbeMunicipality),
"Engure Municipality" => Ok(Self::EngureMunicipality),
"Garkalne Municipality" => Ok(Self::GarkalneMunicipality),
"Grobiņa Municipality" => Ok(Self::GrobiņaMunicipality),
"Gulbene Municipality" => Ok(Self::GulbeneMunicipality),
"Iecava Municipality" => Ok(Self::IecavaMunicipality),
"Ikšķile Municipality" => Ok(Self::IkšķileMunicipality),
"Ilūkste Municipalityy" => Ok(Self::IlūksteMunicipality),
"Inčukalns Municipality" => Ok(Self::InčukalnsMunicipality),
"Jaunjelgava Municipality" => Ok(Self::JaunjelgavaMunicipality),
"Jaunpiebalga Municipality" => Ok(Self::JaunpiebalgaMunicipality),
"Jaunpils Municipality" => Ok(Self::JaunpilsMunicipality),
"Jelgava" => Ok(Self::Jelgava),
"Jelgava Municipality" => Ok(Self::JelgavaMunicipality),
"Jēkabpils" => Ok(Self::Jēkabpils),
"Jēkabpils Municipality" => Ok(Self::JēkabpilsMunicipality),
"Jūrmala" => Ok(Self::Jūrmala),
"Kandava Municipality" => Ok(Self::KandavaMunicipality),
"Kocēni Municipality" => Ok(Self::KocēniMunicipality),
"Koknese Municipality" => Ok(Self::KokneseMunicipality),
"Krimulda Municipality" => Ok(Self::KrimuldaMunicipality),
"Krustpils Municipality" => Ok(Self::KrustpilsMunicipality),
"Krāslava Municipality" => Ok(Self::KrāslavaMunicipality),
"Kuldīga Municipality" => Ok(Self::KuldīgaMunicipality),
"Kārsava Municipality" => Ok(Self::KārsavaMunicipality),
"Lielvārde Municipality" => Ok(Self::LielvārdeMunicipality),
"Liepāja" => Ok(Self::Liepāja),
"Limbaži Municipality" => Ok(Self::LimbažiMunicipality),
"Lubāna Municipality" => Ok(Self::LubānaMunicipality),
"Ludza Municipality" => Ok(Self::LudzaMunicipality),
"Līgatne Municipality" => Ok(Self::LīgatneMunicipality),
"Līvāni Municipality" => Ok(Self::LīvāniMunicipality),
"Madona Municipality" => Ok(Self::MadonaMunicipality),
"Mazsalaca Municipality" => Ok(Self::MazsalacaMunicipality),
"Mālpils Municipality" => Ok(Self::MālpilsMunicipality),
"Mārupe Municipality" => Ok(Self::MārupeMunicipality),
"Mērsrags Municipality" => Ok(Self::MērsragsMunicipality),
"Naukšēni Municipality" => Ok(Self::NaukšēniMunicipality),
"Nereta Municipality" => Ok(Self::NeretaMunicipality),
"Nīca Municipality" => Ok(Self::NīcaMunicipality),
"Ogre Municipality" => Ok(Self::OgreMunicipality),
"Olaine Municipality" => Ok(Self::OlaineMunicipality),
"Ozolnieki Municipality" => Ok(Self::OzolniekiMunicipality),
"Preiļi Municipality" => Ok(Self::PreiļiMunicipality),
"Priekule Municipality" => Ok(Self::PriekuleMunicipality),
"Priekuļi Municipality" => Ok(Self::PriekuļiMunicipality),
"Pārgauja Municipality" => Ok(Self::PārgaujaMunicipality),
"Pāvilosta Municipality" => Ok(Self::PāvilostaMunicipality),
"Pļaviņas Municipality" => Ok(Self::PļaviņasMunicipality),
"Rauna Municipality" => Ok(Self::RaunaMunicipality),
"Riebiņi Municipality" => Ok(Self::RiebiņiMunicipality),
"Riga" => Ok(Self::Riga),
"Roja Municipality" => Ok(Self::RojaMunicipality),
"Ropaži Municipality" => Ok(Self::RopažiMunicipality),
"Rucava Municipality" => Ok(Self::RucavaMunicipality),
"Rugāji Municipality" => Ok(Self::RugājiMunicipality),
"Rundāle Municipality" => Ok(Self::RundāleMunicipality),
"Rēzekne" => Ok(Self::Rēzekne),
"Rēzekne Municipality" => Ok(Self::RēzekneMunicipality),
"Rūjiena Municipality" => Ok(Self::RūjienaMunicipality),
"Sala Municipality" => Ok(Self::SalaMunicipality),
"Salacgrīva Municipality" => Ok(Self::SalacgrīvaMunicipality),
"Salaspils Municipality" => Ok(Self::SalaspilsMunicipality),
"Saldus Municipality" => Ok(Self::SaldusMunicipality),
"Saulkrasti Municipality" => Ok(Self::SaulkrastiMunicipality),
"Sigulda Municipality" => Ok(Self::SiguldaMunicipality),
"Skrunda Municipality" => Ok(Self::SkrundaMunicipality),
"Skrīveri Municipality" => Ok(Self::SkrīveriMunicipality),
"Smiltene Municipality" => Ok(Self::SmilteneMunicipality),
"Stopiņi Municipality" => Ok(Self::StopiņiMunicipality),
"Strenči Municipality" => Ok(Self::StrenčiMunicipality),
"Sēja Municipality" => Ok(Self::SējaMunicipality),
_ => Err(errors::ConnectorError::InvalidDataFormat {
field_name: "address.state",
}
.into()),
},
}
}
}
impl ForeignTryFrom<String> for MaltaStatesAbbreviation {
type Error = error_stack::Report<errors::ConnectorError>;
fn foreign_try_from(value: String) -> Result<Self, Self::Error> {
let state_abbreviation_check =
StringExt::<Self>::parse_enum(value.clone(), "MaltaStatesAbbreviation");
match state_abbreviation_check {
Ok(state_abbreviation) => Ok(state_abbreviation),
Err(_) => match value.as_str() {
"Attard" => Ok(Self::Attard),
"Balzan" => Ok(Self::Balzan),
"Birgu" => Ok(Self::Birgu),
"Birkirkara" => Ok(Self::Birkirkara),
"Birżebbuġa" => Ok(Self::Birżebbuġa),
"Cospicua" => Ok(Self::Cospicua),
"Dingli" => Ok(Self::Dingli),
"Fgura" => Ok(Self::Fgura),
"Floriana" => Ok(Self::Floriana),
"Fontana" => Ok(Self::Fontana),
"Gudja" => Ok(Self::Gudja),
"Gżira" => Ok(Self::Gżira),
"Għajnsielem" => Ok(Self::Għajnsielem),
"Għarb" => Ok(Self::Għarb),
"Għargħur" => Ok(Self::Għargħur),
"Għasri" => Ok(Self::Għasri),
"Għaxaq" => Ok(Self::Għaxaq),
"Ħamrun" => Ok(Self::Ħamrun),
"Iklin" => Ok(Self::Iklin),
"Senglea" => Ok(Self::Senglea),
"Kalkara" => Ok(Self::Kalkara),
"Kerċem" => Ok(Self::Kerċem),
"Kirkop" => Ok(Self::Kirkop),
"Lija" => Ok(Self::Lija),
"Luqa" => Ok(Self::Luqa),
"Marsa" => Ok(Self::Marsa),
"Marsaskala" => Ok(Self::Marsaskala),
"Marsaxlokk" => Ok(Self::Marsaxlokk),
"Mdina" => Ok(Self::Mdina),
"Mellieħa" => Ok(Self::Mellieħa),
"Mosta" => Ok(Self::Mosta),
"Mqabba" => Ok(Self::Mqabba),
"Msida" => Ok(Self::Msida),
"Mtarfa" => Ok(Self::Mtarfa),
"Munxar" => Ok(Self::Munxar),
"Mġarr" => Ok(Self::Mġarr),
"Nadur" => Ok(Self::Nadur),
"Naxxar" => Ok(Self::Naxxar),
"Paola" => Ok(Self::Paola),
"Pembroke" => Ok(Self::Pembroke),
"Pietà" => Ok(Self::Pietà),
"Qala" => Ok(Self::Qala),
"Qormi" => Ok(Self::Qormi),
"Qrendi" => Ok(Self::Qrendi),
"Rabat" => Ok(Self::Rabat),
"Saint Lawrence" => Ok(Self::SaintLawrence),
"San Ġwann" => Ok(Self::SanĠwann),
"Sannat" => Ok(Self::Sannat),
"Santa Luċija" => Ok(Self::SantaLuċija),
"Santa Venera" => Ok(Self::SantaVenera),
"Siġġiewi" => Ok(Self::Siġġiewi),
"Sliema" => Ok(Self::Sliema),
"St. Julian's" => Ok(Self::StJulians),
"St. Paul's Bay" => Ok(Self::StPaulsBay),
"Swieqi" => Ok(Self::Swieqi),
"Ta' Xbiex" => Ok(Self::TaXbiex),
"Tarxien" => Ok(Self::Tarxien),
"Valletta" => Ok(Self::Valletta),
"Victoria" => Ok(Self::Victoria),
"Xagħra" => Ok(Self::Xagħra),
|
crates/hyperswitch_connectors/src/utils.rs#chunk5
|
hyperswitch_connectors
|
chunk
| null | null | null | 8,181
| null | null | null | null | null | null | null |
// Struct: PaysafePaymentsSyncResponse
// File: crates/hyperswitch_connectors/src/connectors/paysafe/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct PaysafePaymentsSyncResponse
|
crates/hyperswitch_connectors/src/connectors/paysafe/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
PaysafePaymentsSyncResponse
| 0
|
[] | 52
| null | null | null | null | null | null | null |
// Implementation: impl api::PaymentSync for for Katapult
// File: crates/hyperswitch_connectors/src/connectors/katapult.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::PaymentSync for for Katapult
|
crates/hyperswitch_connectors/src/connectors/katapult.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 58
| null |
Katapult
|
api::PaymentSync for
| 0
| 0
| null | null |
// Struct: ListRolesQueryParams
// File: crates/api_models/src/user_role/role.rs
// Module: api_models
// Implementations: 0
pub struct ListRolesQueryParams
|
crates/api_models/src/user_role/role.rs
|
api_models
|
struct_definition
|
ListRolesQueryParams
| 0
|
[] | 40
| null | null | null | null | null | null | null |
// Implementation: impl api::Payment for for Wellsfargopayout
// File: crates/hyperswitch_connectors/src/connectors/wellsfargopayout.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::Payment for for Wellsfargopayout
|
crates/hyperswitch_connectors/src/connectors/wellsfargopayout.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 65
| null |
Wellsfargopayout
|
api::Payment for
| 0
| 0
| null | null |
// Function: get_group_authorization_info
// File: crates/router/src/services/authorization/info.rs
// Module: router
pub fn get_group_authorization_info() -> Option<Vec<GroupInfo>>
|
crates/router/src/services/authorization/info.rs
|
router
|
function_signature
| null | null | null | 40
|
get_group_authorization_info
| null | null | null | null | null | null |
// File: crates/diesel_models/src/types.rs
// Module: diesel_models
// Public functions: 3
// Public structs: 9
#[cfg(feature = "v2")]
use common_enums::enums::PaymentConnectorTransmission;
#[cfg(feature = "v2")]
use common_utils::id_type;
use common_utils::{hashing::HashedString, pii, types::MinorUnit};
use diesel::{
sql_types::{Json, Jsonb},
AsExpression, FromSqlRow,
};
use masking::{Secret, WithType};
use serde::{self, Deserialize, Serialize};
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, FromSqlRow, AsExpression)]
#[diesel(sql_type = Jsonb)]
pub struct OrderDetailsWithAmount {
/// Name of the product that is being purchased
pub product_name: String,
/// The quantity of the product to be purchased
pub quantity: u16,
/// the amount per quantity of product
pub amount: MinorUnit,
// Does the order includes shipping
pub requires_shipping: Option<bool>,
/// The image URL of the product
pub product_img_link: Option<String>,
/// ID of the product that is being purchased
pub product_id: Option<String>,
/// Category of the product that is being purchased
pub category: Option<String>,
/// Sub category of the product that is being purchased
pub sub_category: Option<String>,
/// Brand of the product that is being purchased
pub brand: Option<String>,
/// Type of the product that is being purchased
pub product_type: Option<common_enums::ProductType>,
/// The tax code for the product
pub product_tax_code: Option<String>,
/// tax rate applicable to the product
pub tax_rate: Option<f64>,
/// total tax amount applicable to the product
pub total_tax_amount: Option<MinorUnit>,
/// description of the product
pub description: Option<String>,
/// stock keeping unit of the product
pub sku: Option<String>,
/// universal product code of the product
pub upc: Option<String>,
/// commodity code of the product
pub commodity_code: Option<String>,
/// unit of measure of the product
pub unit_of_measure: Option<String>,
/// total amount of the product
pub total_amount: Option<MinorUnit>,
/// discount amount on the unit
pub unit_discount_amount: Option<MinorUnit>,
}
impl masking::SerializableSecret for OrderDetailsWithAmount {}
common_utils::impl_to_sql_from_sql_json!(OrderDetailsWithAmount);
#[cfg(feature = "v2")]
#[derive(Debug, Default, Clone, PartialEq, Deserialize, Serialize, FromSqlRow, AsExpression)]
#[diesel(sql_type = Json)]
pub struct FeatureMetadata {
/// Redirection response coming in request as metadata field only for redirection scenarios
pub redirect_response: Option<RedirectResponse>,
/// Additional tags to be used for global search
pub search_tags: Option<Vec<HashedString<WithType>>>,
/// Recurring payment details required for apple pay Merchant Token
pub apple_pay_recurring_details: Option<ApplePayRecurringDetails>,
/// revenue recovery data for payment intent
pub payment_revenue_recovery_metadata: Option<PaymentRevenueRecoveryMetadata>,
}
#[cfg(feature = "v2")]
impl FeatureMetadata {
pub fn get_payment_method_sub_type(&self) -> Option<common_enums::PaymentMethodType> {
self.payment_revenue_recovery_metadata
.as_ref()
.map(|rrm| rrm.payment_method_subtype)
}
pub fn get_payment_method_type(&self) -> Option<common_enums::PaymentMethod> {
self.payment_revenue_recovery_metadata
.as_ref()
.map(|recovery_metadata| recovery_metadata.payment_method_type)
}
pub fn get_billing_merchant_connector_account_id(
&self,
) -> Option<id_type::MerchantConnectorAccountId> {
self.payment_revenue_recovery_metadata
.as_ref()
.map(|recovery_metadata| recovery_metadata.billing_connector_id.clone())
}
// TODO: Check search_tags for relevant payment method type
// TODO: Check redirect_response metadata if applicable
// TODO: Check apple_pay_recurring_details metadata if applicable
}
#[cfg(feature = "v1")]
#[derive(Debug, Default, Clone, PartialEq, Deserialize, Serialize, FromSqlRow, AsExpression)]
#[diesel(sql_type = Json)]
pub struct FeatureMetadata {
/// Redirection response coming in request as metadata field only for redirection scenarios
pub redirect_response: Option<RedirectResponse>,
/// Additional tags to be used for global search
pub search_tags: Option<Vec<HashedString<WithType>>>,
/// Recurring payment details required for apple pay Merchant Token
pub apple_pay_recurring_details: Option<ApplePayRecurringDetails>,
/// The system that the gateway is integrated with, e.g., `Direct`(through hyperswitch), `UnifiedConnectorService`(through ucs), etc.
pub gateway_system: Option<common_enums::GatewaySystem>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, FromSqlRow, AsExpression)]
#[diesel(sql_type = Json)]
pub struct ApplePayRecurringDetails {
/// A description of the recurring payment that Apple Pay displays to the user in the payment sheet
pub payment_description: String,
/// The regular billing cycle for the recurring payment, including start and end dates, an interval, and an interval count
pub regular_billing: ApplePayRegularBillingDetails,
/// A localized billing agreement that the payment sheet displays to the user before the user authorizes the payment
pub billing_agreement: Option<String>,
/// A URL to a web page where the user can update or delete the payment method for the recurring payment
pub management_url: common_utils::types::Url,
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, FromSqlRow, AsExpression)]
#[diesel(sql_type = Json)]
pub struct ApplePayRegularBillingDetails {
/// The label that Apple Pay displays to the user in the payment sheet with the recurring details
pub label: String,
/// The date of the first payment
#[serde(with = "common_utils::custom_serde::iso8601::option")]
pub recurring_payment_start_date: Option<time::PrimitiveDateTime>,
/// The date of the final payment
#[serde(with = "common_utils::custom_serde::iso8601::option")]
pub recurring_payment_end_date: Option<time::PrimitiveDateTime>,
/// The amount of time — in calendar units, such as day, month, or year — that represents a fraction of the total payment interval
pub recurring_payment_interval_unit: Option<RecurringPaymentIntervalUnit>,
/// The number of interval units that make up the total payment interval
pub recurring_payment_interval_count: Option<i32>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, FromSqlRow, AsExpression)]
#[diesel(sql_type = Json)]
#[serde(rename_all = "snake_case")]
pub enum RecurringPaymentIntervalUnit {
Year,
Month,
Day,
Hour,
Minute,
}
common_utils::impl_to_sql_from_sql_json!(ApplePayRecurringDetails);
common_utils::impl_to_sql_from_sql_json!(ApplePayRegularBillingDetails);
common_utils::impl_to_sql_from_sql_json!(RecurringPaymentIntervalUnit);
common_utils::impl_to_sql_from_sql_json!(FeatureMetadata);
#[derive(Default, Debug, Eq, PartialEq, Deserialize, Serialize, Clone)]
pub struct RedirectResponse {
pub param: Option<Secret<String>>,
pub json_payload: Option<pii::SecretSerdeValue>,
}
impl masking::SerializableSecret for RedirectResponse {}
common_utils::impl_to_sql_from_sql_json!(RedirectResponse);
#[cfg(feature = "v2")]
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct PaymentRevenueRecoveryMetadata {
/// Total number of billing connector + recovery retries for a payment intent.
pub total_retry_count: u16,
/// Flag for the payment connector's call
pub payment_connector_transmission: PaymentConnectorTransmission,
/// Billing Connector Id to update the invoices
pub billing_connector_id: id_type::MerchantConnectorAccountId,
/// Payment Connector Id to retry the payments
pub active_attempt_payment_connector_id: id_type::MerchantConnectorAccountId,
/// Billing Connector Payment Details
pub billing_connector_payment_details: BillingConnectorPaymentDetails,
///Payment Method Type
pub payment_method_type: common_enums::enums::PaymentMethod,
/// PaymentMethod Subtype
pub payment_method_subtype: common_enums::enums::PaymentMethodType,
/// The name of the payment connector through which the payment attempt was made.
pub connector: common_enums::connector_enums::Connector,
/// Time at which next invoice will be created
pub invoice_next_billing_time: Option<time::PrimitiveDateTime>,
/// Time at which invoice started
pub invoice_billing_started_at_time: Option<time::PrimitiveDateTime>,
/// Extra Payment Method Details that are needed to be stored
pub billing_connector_payment_method_details: Option<BillingConnectorPaymentMethodDetails>,
/// First Payment Attempt Payment Gateway Error Code
pub first_payment_attempt_pg_error_code: Option<String>,
/// First Payment Attempt Network Error Code
pub first_payment_attempt_network_decline_code: Option<String>,
/// First Payment Attempt Network Advice Code
pub first_payment_attempt_network_advice_code: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
#[cfg(feature = "v2")]
pub struct BillingConnectorPaymentDetails {
/// Payment Processor Token to process the Revenue Recovery Payment
pub payment_processor_token: String,
/// Billing Connector's Customer Id
pub connector_customer_id: String,
}
#[cfg(feature = "v2")]
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
#[serde(rename_all = "snake_case", tag = "type", content = "value")]
pub enum BillingConnectorPaymentMethodDetails {
Card(BillingConnectorAdditionalCardInfo),
}
#[cfg(feature = "v2")]
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
pub struct BillingConnectorAdditionalCardInfo {
/// Card Network
pub card_network: Option<common_enums::enums::CardNetwork>,
/// Card Issuer
pub card_issuer: Option<String>,
}
|
crates/diesel_models/src/types.rs
|
diesel_models
|
full_file
| null | null | null | 2,196
| null | null | null | null | null | null | null |
// Implementation: impl PaymentsPostProcessing for for Plaid
// File: crates/hyperswitch_connectors/src/connectors/plaid.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl PaymentsPostProcessing for for Plaid
|
crates/hyperswitch_connectors/src/connectors/plaid.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 55
| null |
Plaid
|
PaymentsPostProcessing for
| 0
| 0
| null | null |
// Trait: OutgoingWebhookLogsFilterAnalytics
// File: crates/analytics/src/outgoing_webhook_event/events.rs
// Module: analytics
pub trait OutgoingWebhookLogsFilterAnalytics: LoadRow<OutgoingWebhookLogsResult>
|
crates/analytics/src/outgoing_webhook_event/events.rs
|
analytics
|
trait_definition
| null | null | null | 51
| null | null |
OutgoingWebhookLogsFilterAnalytics
| null | null | null | null |
// Implementation: impl MerchantAccount
// File: crates/diesel_models/src/query/merchant_account.rs
// Module: diesel_models
// Methods: 9 total (0 public)
impl MerchantAccount
|
crates/diesel_models/src/query/merchant_account.rs
|
diesel_models
|
impl_block
| null | null | null | 40
| null |
MerchantAccount
| null | 9
| 0
| null | null |
// Implementation: impl Noon
// File: crates/hyperswitch_connectors/src/connectors/noon.rs
// Module: hyperswitch_connectors
// Methods: 1 total (0 public)
impl Noon
|
crates/hyperswitch_connectors/src/connectors/noon.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 43
| null |
Noon
| null | 1
| 0
| null | null |
// Module Structure
// File: crates/router/src/core/errors/user.rs
// Module: router
// Public submodules:
pub mod sample_data;
|
crates/router/src/core/errors/user.rs
|
router
|
module_structure
| null | null | null | 30
| null | null | null | null | null | 1
| 0
|
// Struct: Deutschebank
// File: crates/hyperswitch_connectors/src/connectors/deutschebank.rs
// Module: hyperswitch_connectors
// Implementations: 18
// Traits: api::Payment, api::PaymentSession, api::ConnectorAccessToken, api::MandateSetup, api::PaymentAuthorize, api::PaymentsCompleteAuthorize, api::PaymentSync, api::PaymentCapture, api::PaymentVoid, api::Refund, api::RefundExecute, api::RefundSync, api::PaymentToken, ConnectorCommon, ConnectorValidation, webhooks::IncomingWebhook, ConnectorSpecifications
pub struct Deutschebank
|
crates/hyperswitch_connectors/src/connectors/deutschebank.rs
|
hyperswitch_connectors
|
struct_definition
|
Deutschebank
| 18
|
[
"api::Payment",
"api::PaymentSession",
"api::ConnectorAccessToken",
"api::MandateSetup",
"api::PaymentAuthorize",
"api::PaymentsCompleteAuthorize",
"api::PaymentSync",
"api::PaymentCapture",
"api::PaymentVoid",
"api::Refund",
"api::RefundExecute",
"api::RefundSync",
"api::PaymentToken",
"ConnectorCommon",
"ConnectorValidation",
"webhooks::IncomingWebhook",
"ConnectorSpecifications"
] | 132
| null | null | null | null | null | null | null |
// File: crates/router/tests/connectors/custombilling.rs
// Module: router
use masking::Secret;
use router::{
types::{self, api, storage::enums,
}};
use crate::utils::{self, ConnectorActions};
use test_utils::connector_auth;
#[derive(Clone, Copy)]
struct CustombillingTest;
impl ConnectorActions for CustombillingTest {}
impl utils::Connector for CustombillingTest {
fn get_data(&self) -> api::ConnectorData {
use router::connector::Custombilling;
api::ConnectorData {
connector: Box::new(Custombilling::new()),
connector_name: types::Connector::Custombilling,
get_token: types::api::GetToken::Connector,
merchant_connector_id: None,
}
}
fn get_auth_token(&self) -> types::ConnectorAuthType {
utils::to_connector_auth_type(
connector_auth::ConnectorAuthentication::new()
.custombilling
.expect("Missing connector authentication configuration").into(),
)
}
fn get_name(&self) -> String {
"custombilling".to_string()
}
}
static CONNECTOR: CustombillingTest = CustombillingTest {};
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
// Cards Positive Tests
// Creates a payment using the manual capture flow (Non 3DS).
#[actix_web::test]
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
// Captures a payment using the manual capture flow (Non 3DS).
#[actix_web::test]
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
// Partially captures a payment using the manual capture flow (Non 3DS).
#[actix_web::test]
async fn should_partially_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(
payment_method_details(),
Some(types::PaymentsCaptureData {
amount_to_capture: 50,
..utils::PaymentCaptureType::default().0
}),
get_default_payment_info(),
)
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
// Synchronizes a payment using the manual capture flow (Non 3DS).
#[actix_web::test]
async fn should_sync_authorized_payment() {
let authorize_response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
let txn_id = utils::get_connector_transaction_id(authorize_response.response);
let response = CONNECTOR
.psync_retry_till_status_matches(
enums::AttemptStatus::Authorized,
Some(types::PaymentsSyncData {
connector_transaction_id: types::ResponseId::ConnectorTransactionId(
txn_id.unwrap(),
),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("PSync response");
assert_eq!(response.status, enums::AttemptStatus::Authorized,);
}
// Voids a payment using the manual capture flow (Non 3DS).
#[actix_web::test]
async fn should_void_authorized_payment() {
let response = CONNECTOR
.authorize_and_void_payment(
payment_method_details(),
Some(types::PaymentsCancelData {
connector_transaction_id: String::from(""),
cancellation_reason: Some("requested_by_customer".to_string()),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("Void payment response");
assert_eq!(response.status, enums::AttemptStatus::Voided);
}
// Refunds a payment using the manual capture flow (Non 3DS).
#[actix_web::test]
async fn should_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(payment_method_details(), None, None, get_default_payment_info())
.await
.unwrap();
assert_eq!(
response.response.unwrap().refund_status,
enums::RefundStatus::Success,
);
}
// Partially refunds a payment using the manual capture flow (Non 3DS).
#[actix_web::test]
async fn should_partially_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
Some(types::RefundsData {
refund_amount: 50,
..utils::PaymentRefundType::default().0
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
response.response.unwrap().refund_status,
enums::RefundStatus::Success,
);
}
// Synchronizes a refund using the manual capture flow (Non 3DS).
#[actix_web::test]
async fn should_sync_manually_captured_refund() {
let refund_response = CONNECTOR
.capture_payment_and_refund(payment_method_details(), None, None, get_default_payment_info())
.await
.unwrap();
let response = CONNECTOR
.rsync_retry_till_status_matches(
enums::RefundStatus::Success,
refund_response.response.unwrap().connector_refund_id,
None,
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
response.response.unwrap().refund_status,
enums::RefundStatus::Success,
);
}
// Creates a payment using the automatic capture flow (Non 3DS).
#[actix_web::test]
async fn should_make_payment() {
let authorize_response = CONNECTOR.make_payment(payment_method_details(), get_default_payment_info()).await.unwrap();
assert_eq!(authorize_response.status, enums::AttemptStatus::Charged);
}
// Synchronizes a payment using the automatic capture flow (Non 3DS).
#[actix_web::test]
async fn should_sync_auto_captured_payment() {
let authorize_response = CONNECTOR.make_payment(payment_method_details(), get_default_payment_info()).await.unwrap();
assert_eq!(authorize_response.status, enums::AttemptStatus::Charged);
let txn_id = utils::get_connector_transaction_id(authorize_response.response);
assert_ne!(txn_id, None, "Empty connector transaction id");
let response = CONNECTOR
.psync_retry_till_status_matches(
enums::AttemptStatus::Charged,
Some(types::PaymentsSyncData {
connector_transaction_id: types::ResponseId::ConnectorTransactionId(
txn_id.unwrap(),
),
capture_method: Some(enums::CaptureMethod::Automatic),
..Default::default()
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(response.status, enums::AttemptStatus::Charged,);
}
// Refunds a payment using the automatic capture flow (Non 3DS).
#[actix_web::test]
async fn should_refund_auto_captured_payment() {
let response = CONNECTOR
.make_payment_and_refund(payment_method_details(), None, get_default_payment_info())
.await
.unwrap();
assert_eq!(
response.response.unwrap().refund_status,
enums::RefundStatus::Success,
);
}
// Partially refunds a payment using the automatic capture flow (Non 3DS).
#[actix_web::test]
async fn should_partially_refund_succeeded_payment() {
let refund_response = CONNECTOR
.make_payment_and_refund(
payment_method_details(),
Some(types::RefundsData {
refund_amount: 50,
..utils::PaymentRefundType::default().0
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
refund_response.response.unwrap().refund_status,
enums::RefundStatus::Success,
);
}
// Creates multiple refunds against a payment using the automatic capture flow (Non 3DS).
#[actix_web::test]
async fn should_refund_succeeded_payment_multiple_times() {
CONNECTOR
.make_payment_and_multiple_refund(
payment_method_details(),
Some(types::RefundsData {
refund_amount: 50,
..utils::PaymentRefundType::default().0
}),
get_default_payment_info(),
)
.await;
}
// Synchronizes a refund using the automatic capture flow (Non 3DS).
#[actix_web::test]
async fn should_sync_refund() {
let refund_response = CONNECTOR
.make_payment_and_refund(payment_method_details(), None, get_default_payment_info())
.await
.unwrap();
let response = CONNECTOR
.rsync_retry_till_status_matches(
enums::RefundStatus::Success,
refund_response.response.unwrap().connector_refund_id,
None,
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
response.response.unwrap().refund_status,
enums::RefundStatus::Success,
);
}
// Cards Negative scenarios
// Creates a payment with incorrect CVC.
#[actix_web::test]
async fn should_fail_payment_for_incorrect_cvc() {
let response = CONNECTOR
.make_payment(
Some(types::PaymentsAuthorizeData {
payment_method_data: types::api::PaymentMethodData::Card(api::Card {
card_cvc: Secret::new("12345".to_string()),
..utils::CCardType::default().0
}),
..utils::PaymentAuthorizeType::default().0
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
response.response.unwrap_err().message,
"Your card's security code is invalid.".to_string(),
);
}
// Creates a payment with incorrect expiry month.
#[actix_web::test]
async fn should_fail_payment_for_invalid_exp_month() {
let response = CONNECTOR
.make_payment(
Some(types::PaymentsAuthorizeData {
payment_method_data: api::PaymentMethodData::Card(api::Card {
card_exp_month: Secret::new("20".to_string()),
..utils::CCardType::default().0
}),
..utils::PaymentAuthorizeType::default().0
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
response.response.unwrap_err().message,
"Your card's expiration month is invalid.".to_string(),
);
}
// Creates a payment with incorrect expiry year.
#[actix_web::test]
async fn should_fail_payment_for_incorrect_expiry_year() {
let response = CONNECTOR
.make_payment(
Some(types::PaymentsAuthorizeData {
payment_method_data: api::PaymentMethodData::Card(api::Card {
card_exp_year: Secret::new("2000".to_string()),
..utils::CCardType::default().0
}),
..utils::PaymentAuthorizeType::default().0
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
response.response.unwrap_err().message,
"Your card's expiration year is invalid.".to_string(),
);
}
// Voids a payment using automatic capture flow (Non 3DS).
#[actix_web::test]
async fn should_fail_void_payment_for_auto_capture() {
let authorize_response = CONNECTOR.make_payment(payment_method_details(), get_default_payment_info()).await.unwrap();
assert_eq!(authorize_response.status, enums::AttemptStatus::Charged);
let txn_id = utils::get_connector_transaction_id(authorize_response.response);
assert_ne!(txn_id, None, "Empty connector transaction id");
let void_response = CONNECTOR
.void_payment(txn_id.unwrap(), None, get_default_payment_info())
.await
.unwrap();
assert_eq!(
void_response.response.unwrap_err().message,
"You cannot cancel this PaymentIntent because it has a status of succeeded."
);
}
// Captures a payment using invalid connector payment id.
#[actix_web::test]
async fn should_fail_capture_for_invalid_payment() {
let capture_response = CONNECTOR
.capture_payment("123456789".to_string(), None, get_default_payment_info())
.await
.unwrap();
assert_eq!(
capture_response.response.unwrap_err().message,
String::from("No such payment_intent: '123456789'")
);
}
// Refunds a payment with refund amount higher than payment amount.
#[actix_web::test]
async fn should_fail_for_refund_amount_higher_than_payment_amount() {
let response = CONNECTOR
.make_payment_and_refund(
payment_method_details(),
Some(types::RefundsData {
refund_amount: 150,
..utils::PaymentRefundType::default().0
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
response.response.unwrap_err().message,
"Refund amount (₹1.50) is greater than charge amount (₹1.00)",
);
}
// Connector dependent test cases goes here
// [#478]: add unit tests for non 3DS, wallets & webhooks in connector tests
|
crates/router/tests/connectors/custombilling.rs
|
router
|
full_file
| null | null | null | 2,904
| null | null | null | null | null | null | null |
// Function: create_role
// File: crates/router/src/routes/user_role.rs
// Module: router
pub fn create_role(
state: web::Data<AppState>,
req: HttpRequest,
json_payload: web::Json<role_api::CreateRoleRequest>,
) -> HttpResponse
|
crates/router/src/routes/user_role.rs
|
router
|
function_signature
| null | null | null | 59
|
create_role
| null | null | null | null | null | null |
// Implementation: impl api::Payment for for Getnet
// File: crates/hyperswitch_connectors/src/connectors/getnet.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::Payment for for Getnet
|
crates/hyperswitch_connectors/src/connectors/getnet.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 55
| null |
Getnet
|
api::Payment for
| 0
| 0
| null | null |
// Implementation: impl ConnectorValidation for for Trustpayments
// File: crates/hyperswitch_connectors/src/connectors/trustpayments.rs
// Module: hyperswitch_connectors
// Methods: 2 total (0 public)
impl ConnectorValidation for for Trustpayments
|
crates/hyperswitch_connectors/src/connectors/trustpayments.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 54
| null |
Trustpayments
|
ConnectorValidation for
| 2
| 0
| null | null |
// Implementation: impl Payments
// File: crates/router/src/routes/app.rs
// Module: router
// Methods: 1 total (1 public)
impl Payments
|
crates/router/src/routes/app.rs
|
router
|
impl_block
| null | null | null | 33
| null |
Payments
| null | 1
| 1
| null | null |
// Struct: OrganizationResponse
// File: crates/api_models/src/organization.rs
// Module: api_models
// Implementations: 0
pub struct OrganizationResponse
|
crates/api_models/src/organization.rs
|
api_models
|
struct_definition
|
OrganizationResponse
| 0
|
[] | 34
| null | null | null | null | null | null | null |
// File: crates/router/src/routes/recovery_webhooks.rs
// Module: router
// Public functions: 1
use actix_web::{web, HttpRequest, Responder};
use router_env::{instrument, tracing, Flow};
use super::app::AppState;
use crate::{
core::{
api_locking,
webhooks::{self, types},
},
services::{api, authentication as auth},
types::domain,
};
#[instrument(skip_all, fields(flow = ?Flow::IncomingWebhookReceive))]
pub async fn recovery_receive_incoming_webhook<W: types::OutgoingWebhookType>(
state: web::Data<AppState>,
req: HttpRequest,
body: web::Bytes,
path: web::Path<(
common_utils::id_type::MerchantId,
common_utils::id_type::ProfileId,
common_utils::id_type::MerchantConnectorAccountId,
)>,
) -> impl Responder {
let flow = Flow::RecoveryIncomingWebhookReceive;
let (merchant_id, profile_id, connector_id) = path.into_inner();
Box::pin(api::server_wrap(
flow.clone(),
state,
&req,
(),
|state, auth, _, req_state| {
let merchant_context = domain::MerchantContext::NormalMerchant(Box::new(
domain::Context(auth.merchant_account, auth.key_store),
));
webhooks::incoming_webhooks_wrapper::<W>(
&flow,
state.to_owned(),
req_state,
&req,
merchant_context,
auth.profile,
&connector_id,
body.clone(),
false,
)
},
&auth::MerchantIdAndProfileIdAuth {
merchant_id,
profile_id,
},
api_locking::LockAction::NotApplicable,
))
.await
}
|
crates/router/src/routes/recovery_webhooks.rs
|
router
|
full_file
| null | null | null | 380
| null | null | null | null | null | null | null |
// Implementation: impl std::ops::DerefMut for for PaymentsTokenReference
// File: crates/hyperswitch_domain_models/src/mandates.rs
// Module: hyperswitch_domain_models
// Methods: 1 total (0 public)
impl std::ops::DerefMut for for PaymentsTokenReference
|
crates/hyperswitch_domain_models/src/mandates.rs
|
hyperswitch_domain_models
|
impl_block
| null | null | null | 64
| null |
PaymentsTokenReference
|
std::ops::DerefMut for
| 1
| 0
| null | null |
// File: crates/analytics/src/auth_events/metrics/authentication_funnel.rs
// Module: analytics
use std::collections::HashSet;
use api_models::analytics::{
auth_events::{AuthEventDimensions, AuthEventFilters, AuthEventMetricsBucketIdentifier},
Granularity, TimeRange,
};
use common_utils::errors::ReportSwitchExt;
use error_stack::ResultExt;
use time::PrimitiveDateTime;
use super::AuthEventMetricRow;
use crate::{
query::{
Aggregate, FilterTypes, GroupByClause, QueryBuilder, QueryFilter, SeriesBucket, ToSql,
Window,
},
types::{AnalyticsCollection, AnalyticsDataSource, MetricsError, MetricsResult},
AuthInfo,
};
#[derive(Default)]
pub(super) struct AuthenticationFunnel;
#[async_trait::async_trait]
impl<T> super::AuthEventMetric<T> for AuthenticationFunnel
where
T: AnalyticsDataSource + super::AuthEventMetricAnalytics,
PrimitiveDateTime: ToSql<T>,
AnalyticsCollection: ToSql<T>,
Granularity: GroupByClause<T>,
Aggregate<&'static str>: ToSql<T>,
Window<&'static str>: ToSql<T>,
{
async fn load_metrics(
&self,
auth: &AuthInfo,
dimensions: &[AuthEventDimensions],
filters: &AuthEventFilters,
granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(AuthEventMetricsBucketIdentifier, AuthEventMetricRow)>> {
let mut query_builder: QueryBuilder<T> =
QueryBuilder::new(AnalyticsCollection::Authentications);
for dim in dimensions.iter() {
query_builder.add_select_column(dim).switch()?;
}
query_builder
.add_select_column(Aggregate::Count {
field: None,
alias: Some("count"),
})
.switch()?;
query_builder
.add_select_column(Aggregate::Min {
field: "created_at",
alias: Some("start_bucket"),
})
.switch()?;
query_builder
.add_select_column(Aggregate::Max {
field: "created_at",
alias: Some("end_bucket"),
})
.switch()?;
query_builder
.add_custom_filter_clause(
AuthEventDimensions::TransactionStatus,
"NULL",
FilterTypes::IsNotNull,
)
.switch()?;
filters.set_filter_clause(&mut query_builder).switch()?;
time_range
.set_filter_clause(&mut query_builder)
.attach_printable("Error filtering time range")
.switch()?;
auth.set_filter_clause(&mut query_builder).switch()?;
for dim in dimensions.iter() {
query_builder
.add_group_by_clause(dim)
.attach_printable("Error grouping by dimensions")
.switch()?;
}
if let Some(granularity) = granularity {
granularity
.set_group_by_clause(&mut query_builder)
.attach_printable("Error adding granularity")
.switch()?;
}
query_builder
.execute_query::<AuthEventMetricRow, _>(pool)
.await
.change_context(MetricsError::QueryBuildingError)?
.change_context(MetricsError::QueryExecutionFailure)?
.into_iter()
.map(|i| {
Ok((
AuthEventMetricsBucketIdentifier::new(
i.authentication_status.as_ref().map(|i| i.0),
i.trans_status.as_ref().map(|i| i.0.clone()),
i.authentication_type.as_ref().map(|i| i.0),
i.error_message.clone(),
i.authentication_connector.as_ref().map(|i| i.0),
i.message_version.clone(),
i.acs_reference_number.clone(),
i.mcc.clone(),
i.currency.as_ref().map(|i| i.0),
i.merchant_country.clone(),
i.billing_country.clone(),
i.shipping_country.clone(),
i.issuer_country.clone(),
i.earliest_supported_version.clone(),
i.latest_supported_version.clone(),
i.whitelist_decision,
i.device_manufacturer.clone(),
i.device_type.clone(),
i.device_brand.clone(),
i.device_os.clone(),
i.device_display.clone(),
i.browser_name.clone(),
i.browser_version.clone(),
i.issuer_id.clone(),
i.scheme_name.clone(),
i.exemption_requested,
i.exemption_accepted,
TimeRange {
start_time: match (granularity, i.start_bucket) {
(Some(g), Some(st)) => g.clip_to_start(st)?,
_ => time_range.start_time,
},
end_time: granularity.as_ref().map_or_else(
|| Ok(time_range.end_time),
|g| i.end_bucket.map(|et| g.clip_to_end(et)).transpose(),
)?,
},
),
i,
))
})
.collect::<error_stack::Result<
HashSet<(AuthEventMetricsBucketIdentifier, AuthEventMetricRow)>,
crate::query::PostProcessingError,
>>()
.change_context(MetricsError::PostProcessingFailure)
}
}
|
crates/analytics/src/auth_events/metrics/authentication_funnel.rs
|
analytics
|
full_file
| null | null | null | 1,073
| null | null | null | null | null | null | null |
// Struct: IntoIter
// File: crates/hyperswitch_constraint_graph/src/dense_map.rs
// Module: hyperswitch_constraint_graph
// Implementations: 2
// Traits: Iterator
pub struct IntoIter<K, V>
|
crates/hyperswitch_constraint_graph/src/dense_map.rs
|
hyperswitch_constraint_graph
|
struct_definition
|
IntoIter
| 2
|
[
"Iterator"
] | 50
| null | null | null | null | null | null | null |
// Struct: TransactionSearchInput
// File: crates/hyperswitch_connectors/src/connectors/braintree/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct TransactionSearchInput
|
crates/hyperswitch_connectors/src/connectors/braintree/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
TransactionSearchInput
| 0
|
[] | 48
| null | null | null | null | null | null | null |
// File: crates/router/src/routes/dummy_connector.rs
// Module: router
// Public functions: 6
use actix_web::web;
use router_env::{instrument, tracing};
use super::app;
use crate::{
core::api_locking,
services::{api, authentication as auth},
};
mod consts;
mod core;
mod errors;
pub mod types;
mod utils;
#[cfg(all(feature = "dummy_connector", feature = "v1"))]
#[instrument(skip_all, fields(flow = ?types::Flow::DummyPaymentCreate))]
pub async fn dummy_connector_authorize_payment(
state: web::Data<app::AppState>,
req: actix_web::HttpRequest,
path: web::Path<String>,
) -> impl actix_web::Responder {
let flow = types::Flow::DummyPaymentAuthorize;
let attempt_id = path.into_inner();
let payload = types::DummyConnectorPaymentConfirmRequest { attempt_id };
api::server_wrap(
flow,
state,
&req,
payload,
|state, _: (), req, _| core::payment_authorize(state, req),
&auth::NoAuth,
api_locking::LockAction::NotApplicable,
)
.await
}
#[cfg(all(feature = "dummy_connector", feature = "v1"))]
#[instrument(skip_all, fields(flow = ?types::Flow::DummyPaymentCreate))]
pub async fn dummy_connector_complete_payment(
state: web::Data<app::AppState>,
req: actix_web::HttpRequest,
path: web::Path<String>,
json_payload: web::Query<types::DummyConnectorPaymentCompleteBody>,
) -> impl actix_web::Responder {
let flow = types::Flow::DummyPaymentComplete;
let attempt_id = path.into_inner();
let payload = types::DummyConnectorPaymentCompleteRequest {
attempt_id,
confirm: json_payload.confirm,
};
Box::pin(api::server_wrap(
flow,
state,
&req,
payload,
|state, _: (), req, _| core::payment_complete(state, req),
&auth::NoAuth,
api_locking::LockAction::NotApplicable,
))
.await
}
#[cfg(feature = "dummy_connector")]
#[instrument(skip_all, fields(flow = ?types::Flow::DummyPaymentCreate))]
pub async fn dummy_connector_payment(
state: web::Data<app::AppState>,
req: actix_web::HttpRequest,
json_payload: web::Json<types::DummyConnectorPaymentRequest>,
) -> impl actix_web::Responder {
let payload = json_payload.into_inner();
let flow = types::Flow::DummyPaymentCreate;
Box::pin(api::server_wrap(
flow,
state,
&req,
payload,
|state, _: (), req, _| core::payment(state, req),
&auth::NoAuth,
api_locking::LockAction::NotApplicable,
))
.await
}
#[cfg(feature = "dummy_connector")]
#[instrument(skip_all, fields(flow = ?types::Flow::DummyPaymentRetrieve))]
pub async fn dummy_connector_payment_data(
state: web::Data<app::AppState>,
req: actix_web::HttpRequest,
path: web::Path<String>,
) -> impl actix_web::Responder {
let flow = types::Flow::DummyPaymentRetrieve;
let payment_id = path.into_inner();
let payload = types::DummyConnectorPaymentRetrieveRequest { payment_id };
api::server_wrap(
flow,
state,
&req,
payload,
|state, _: (), req, _| core::payment_data(state, req),
&auth::NoAuth,
api_locking::LockAction::NotApplicable,
)
.await
}
#[cfg(all(feature = "dummy_connector", feature = "v1"))]
#[instrument(skip_all, fields(flow = ?types::Flow::DummyRefundCreate))]
pub async fn dummy_connector_refund(
state: web::Data<app::AppState>,
req: actix_web::HttpRequest,
json_payload: web::Json<types::DummyConnectorRefundRequest>,
path: web::Path<common_utils::id_type::PaymentId>,
) -> impl actix_web::Responder {
let flow = types::Flow::DummyRefundCreate;
let mut payload = json_payload.into_inner();
payload.payment_id = Some(path.into_inner());
Box::pin(api::server_wrap(
flow,
state,
&req,
payload,
|state, _: (), req, _| core::refund_payment(state, req),
&auth::NoAuth,
api_locking::LockAction::NotApplicable,
))
.await
}
#[cfg(all(feature = "dummy_connector", feature = "v1"))]
#[instrument(skip_all, fields(flow = ?types::Flow::DummyRefundRetrieve))]
pub async fn dummy_connector_refund_data(
state: web::Data<app::AppState>,
req: actix_web::HttpRequest,
path: web::Path<String>,
) -> impl actix_web::Responder {
let flow = types::Flow::DummyRefundRetrieve;
let refund_id = path.into_inner();
let payload = types::DummyConnectorRefundRetrieveRequest { refund_id };
api::server_wrap(
flow,
state,
&req,
payload,
|state, _: (), req, _| core::refund_data(state, req),
&auth::NoAuth,
api_locking::LockAction::NotApplicable,
)
.await
}
|
crates/router/src/routes/dummy_connector.rs
|
router
|
full_file
| null | null | null | 1,173
| null | null | null | null | null | null | null |
// Implementation: impl ConnectorCommon for for Helcim
// File: crates/hyperswitch_connectors/src/connectors/helcim.rs
// Module: hyperswitch_connectors
// Methods: 6 total (0 public)
impl ConnectorCommon for for Helcim
|
crates/hyperswitch_connectors/src/connectors/helcim.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 57
| null |
Helcim
|
ConnectorCommon for
| 6
| 0
| null | null |
// Function: is_correct_password
// File: crates/router/src/utils/user/password.rs
// Module: router
pub fn is_correct_password(
candidate: &Secret<String>,
password: &Secret<String>,
) -> CustomResult<bool, UserErrors>
|
crates/router/src/utils/user/password.rs
|
router
|
function_signature
| null | null | null | 52
|
is_correct_password
| null | null | null | null | null | null |
// Struct: HipayPaymentsRequest
// File: crates/hyperswitch_connectors/src/connectors/hipay/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct HipayPaymentsRequest
|
crates/hyperswitch_connectors/src/connectors/hipay/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
HipayPaymentsRequest
| 0
|
[] | 50
| null | null | null | null | null | null | null |
// Implementation: impl PaysafePaymentMethodDetails
// File: crates/hyperswitch_connectors/src/connectors/paysafe/transformers.rs
// Module: hyperswitch_connectors
// Methods: 7 total (7 public)
impl PaysafePaymentMethodDetails
|
crates/hyperswitch_connectors/src/connectors/paysafe/transformers.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 55
| null |
PaysafePaymentMethodDetails
| null | 7
| 7
| null | null |
// Function: update_merchant_account
// File: crates/openapi/src/routes/merchant_account.rs
// Module: openapi
pub fn update_merchant_account()
|
crates/openapi/src/routes/merchant_account.rs
|
openapi
|
function_signature
| null | null | null | 34
|
update_merchant_account
| null | null | null | null | null | null |
// Struct: SinglePurposeToken
// File: crates/router/src/services/authentication.rs
// Module: router
// Implementations: 1
pub struct SinglePurposeToken
|
crates/router/src/services/authentication.rs
|
router
|
struct_definition
|
SinglePurposeToken
| 1
|
[] | 34
| null | null | null | null | null | null | null |
// Struct: Payer
// File: crates/hyperswitch_connectors/src/connectors/dlocal/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct Payer
|
crates/hyperswitch_connectors/src/connectors/dlocal/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
Payer
| 0
|
[] | 45
| null | null | null | null | null | null | null |
// Struct: AchVerification
// File: crates/hyperswitch_connectors/src/connectors/bankofamerica/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct AchVerification
|
crates/hyperswitch_connectors/src/connectors/bankofamerica/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
AchVerification
| 0
|
[] | 48
| null | null | null | null | null | null | null |
// Function: list_user_roles_details
// File: crates/router/src/core/user.rs
// Module: router
pub fn list_user_roles_details(
state: SessionState,
user_from_token: auth::UserFromToken,
request: user_api::GetUserRoleDetailsRequest,
_req_state: ReqState,
) -> UserResponse<Vec<user_api::GetUserRoleDetailsResponseV2>>
|
crates/router/src/core/user.rs
|
router
|
function_signature
| null | null | null | 82
|
list_user_roles_details
| 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.