text
stringlengths 65
57.3k
| file_path
stringlengths 22
92
| module
stringclasses 38
values | type
stringclasses 7
values | struct_name
stringlengths 3
60
⌀ | impl_count
int64 0
60
⌀ | traits
listlengths 0
59
⌀ | tokens
int64 16
8.19k
| function_name
stringlengths 3
85
⌀ | type_name
stringlengths 1
67
⌀ | trait_name
stringclasses 573
values | method_count
int64 0
31
⌀ | public_method_count
int64 0
19
⌀ | submodule_count
int64 0
56
⌀ | export_count
int64 0
9
⌀ |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
// Function: get_theme_using_lineage
// File: crates/router/src/routes/user/theme.rs
// Module: router
pub fn get_theme_using_lineage(
state: web::Data<AppState>,
req: HttpRequest,
query: web::Query<ThemeLineage>,
) -> HttpResponse
|
crates/router/src/routes/user/theme.rs
|
router
|
function_signature
| null | null | null | 61
|
get_theme_using_lineage
| null | null | null | null | null | null |
// Implementation: impl api::PaymentSession for for Fiuu
// File: crates/hyperswitch_connectors/src/connectors/fiuu.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::PaymentSession for for Fiuu
|
crates/hyperswitch_connectors/src/connectors/fiuu.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 60
| null |
Fiuu
|
api::PaymentSession for
| 0
| 0
| null | null |
// Implementation: impl ConnectorAuthentication for for Threedsecureio
// File: crates/hyperswitch_connectors/src/connectors/threedsecureio.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl ConnectorAuthentication for for Threedsecureio
|
crates/hyperswitch_connectors/src/connectors/threedsecureio.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 59
| null |
Threedsecureio
|
ConnectorAuthentication for
| 0
| 0
| null | null |
// Function: get_cards_bin_records
// File: crates/router/src/core/cards_info.rs
// Module: router
pub fn get_cards_bin_records(
form: CardsInfoUpdateForm,
) -> Result<Vec<cards_info_api_types::CardInfoUpdateRequest>, errors::ApiErrorResponse>
|
crates/router/src/core/cards_info.rs
|
router
|
function_signature
| null | null | null | 59
|
get_cards_bin_records
| null | null | null | null | null | null |
// Function: list_by_organization_id
// File: crates/diesel_models/src/query/merchant_account.rs
// Module: diesel_models
pub fn list_by_organization_id(
conn: &PgPooledConn,
organization_id: &common_utils::id_type::OrganizationId,
) -> StorageResult<Vec<Self>>
|
crates/diesel_models/src/query/merchant_account.rs
|
diesel_models
|
function_signature
| null | null | null | 66
|
list_by_organization_id
| null | null | null | null | null | null |
// Struct: SenderInformation
// File: crates/hyperswitch_connectors/src/connectors/bankofamerica/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct SenderInformation
|
crates/hyperswitch_connectors/src/connectors/bankofamerica/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
SenderInformation
| 0
|
[] | 48
| null | null | null | null | null | null | null |
// Function: get_cookie_header
// File: crates/router/src/services/authentication/cookies.rs
// Module: router
pub fn get_cookie_header() -> String
|
crates/router/src/services/authentication/cookies.rs
|
router
|
function_signature
| null | null | null | 32
|
get_cookie_header
| null | null | null | null | null | null |
// Struct: FiservSyncRequest
// File: crates/hyperswitch_connectors/src/connectors/fiserv/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct FiservSyncRequest
|
crates/hyperswitch_connectors/src/connectors/fiserv/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
FiservSyncRequest
| 0
|
[] | 52
| null | null | null | null | null | null | null |
// Struct: EmailThemeConfig
// File: crates/common_utils/src/types/user/theme.rs
// Module: common_utils
// Implementations: 0
pub struct EmailThemeConfig
|
crates/common_utils/src/types/user/theme.rs
|
common_utils
|
struct_definition
|
EmailThemeConfig
| 0
|
[] | 37
| null | null | null | null | null | null | null |
// Trait: EuclidBackend
// File: crates/euclid/src/backend.rs
// Module: euclid
pub trait EuclidBackend<O>: Sized
|
crates/euclid/src/backend.rs
|
euclid
|
trait_definition
| null | null | null | 32
| null | null |
EuclidBackend
| null | null | null | null |
// Implementation: impl api::ConnectorAccessToken for for Globepay
// File: crates/hyperswitch_connectors/src/connectors/globepay.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::ConnectorAccessToken for for Globepay
|
crates/hyperswitch_connectors/src/connectors/globepay.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 61
| null |
Globepay
|
api::ConnectorAccessToken for
| 0
| 0
| null | null |
// Struct: PaymentResponse
// File: crates/hyperswitch_connectors/src/connectors/mifinity/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct PaymentResponse
|
crates/hyperswitch_connectors/src/connectors/mifinity/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
PaymentResponse
| 0
|
[] | 46
| null | null | null | null | null | null | null |
// File: crates/common_utils/src/id_type/payout.rs
// Module: common_utils
crate::id_type!(
PayoutId,
"A domain type for payout_id that can be used for payout ids"
);
crate::impl_id_type_methods!(PayoutId, "payout_id");
crate::impl_debug_id_type!(PayoutId);
crate::impl_try_from_cow_str_id_type!(PayoutId, "payout_id");
crate::impl_generate_id_id_type!(PayoutId, "payout");
crate::impl_queryable_id_type!(PayoutId);
crate::impl_to_sql_from_sql_id_type!(PayoutId);
|
crates/common_utils/src/id_type/payout.rs
|
common_utils
|
full_file
| null | null | null | 135
| null | null | null | null | null | null | null |
// Struct: MandateData
// File: crates/hyperswitch_domain_models/src/mandates.rs
// Module: hyperswitch_domain_models
// Implementations: 0
pub struct MandateData
|
crates/hyperswitch_domain_models/src/mandates.rs
|
hyperswitch_domain_models
|
struct_definition
|
MandateData
| 0
|
[] | 43
| null | null | null | null | null | null | null |
// Implementation: impl api::PaymentSession for for Gocardless
// File: crates/hyperswitch_connectors/src/connectors/gocardless.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::PaymentSession for for Gocardless
|
crates/hyperswitch_connectors/src/connectors/gocardless.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 60
| null |
Gocardless
|
api::PaymentSession for
| 0
| 0
| null | null |
// Function: server
// File: crates/router/src/routes/app.rs
// Module: router
pub fn server(state: AppState) -> Scope
|
crates/router/src/routes/app.rs
|
router
|
function_signature
| null | null | null | 29
|
server
| null | null | null | null | null | null |
// Struct: ApiKeys
// File: crates/router/src/routes/app.rs
// Module: router
// Implementations: 2
pub struct ApiKeys
|
crates/router/src/routes/app.rs
|
router
|
struct_definition
|
ApiKeys
| 2
|
[] | 32
| null | null | null | null | null | null | null |
// Struct: Browser
// File: crates/hyperswitch_connectors/src/connectors/netcetera/netcetera_types.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct Browser
|
crates/hyperswitch_connectors/src/connectors/netcetera/netcetera_types.rs
|
hyperswitch_connectors
|
struct_definition
|
Browser
| 0
|
[] | 47
| null | null | null | null | null | null | null |
// Function: customers_create
// File: crates/router/src/routes/customers.rs
// Module: router
pub fn customers_create(
state: web::Data<AppState>,
req: HttpRequest,
json_payload: web::Json<customers::CustomerRequest>,
) -> HttpResponse
|
crates/router/src/routes/customers.rs
|
router
|
function_signature
| null | null | null | 57
|
customers_create
| null | null | null | null | null | null |
// Struct: TransactionTiming
// File: crates/hyperswitch_connectors/src/connectors/braintree/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct TransactionTiming
|
crates/hyperswitch_connectors/src/connectors/braintree/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
TransactionTiming
| 0
|
[] | 46
| null | null | null | null | null | null | null |
// Struct: PayboxSyncResponse
// File: crates/hyperswitch_connectors/src/connectors/paybox/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct PayboxSyncResponse
|
crates/hyperswitch_connectors/src/connectors/paybox/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
PayboxSyncResponse
| 0
|
[] | 49
| null | null | null | null | null | null | null |
// Function: add_certificate_key
// File: crates/common_utils/src/request.rs
// Module: common_utils
pub fn add_certificate_key(&mut self, certificate_key: Option<Secret<String>>)
|
crates/common_utils/src/request.rs
|
common_utils
|
function_signature
| null | null | null | 40
|
add_certificate_key
| null | null | null | null | null | null |
// Implementation: impl api::ConnectorAccessToken for for Dwolla
// File: crates/hyperswitch_connectors/src/connectors/dwolla.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::ConnectorAccessToken for for Dwolla
|
crates/hyperswitch_connectors/src/connectors/dwolla.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 58
| null |
Dwolla
|
api::ConnectorAccessToken for
| 0
| 0
| null | null |
// Struct: BarclaycardAuthenticationErrorResponse
// File: crates/hyperswitch_connectors/src/connectors/barclaycard/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct BarclaycardAuthenticationErrorResponse
|
crates/hyperswitch_connectors/src/connectors/barclaycard/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
BarclaycardAuthenticationErrorResponse
| 0
|
[] | 53
| null | null | null | null | null | null | null |
// File: crates/router/tests/payments.rs
// Module: router
#![allow(
clippy::expect_used,
clippy::unwrap_in_result,
clippy::unwrap_used,
clippy::print_stdout
)]
mod utils;
use std::{borrow::Cow, sync::Arc};
use common_utils::{id_type, types::MinorUnit};
use router::{
configs,
core::payments,
db::StorageImpl,
routes, services,
types::{
self,
api::{self, enums as api_enums},
},
};
use time::macros::datetime;
use tokio::sync::oneshot;
use uuid::Uuid;
// setting the connector in environment variables doesn't work when run in parallel. Neither does passing the paymentid
// do we'll test refund and payment in same tests and later implement thread_local variables.
// When test-connector feature is enabled, you can pass the connector name in description
#[actix_web::test]
#[ignore]
// verify the API-KEY/merchant id has stripe as first choice
async fn payments_create_stripe() {
Box::pin(utils::setup()).await;
let payment_id = format!("test_{}", Uuid::new_v4());
let api_key = ("API-KEY", "MySecretApiKey");
let request = serde_json::json!({
"payment_id" : payment_id,
"merchant_id" : "jarnura",
"amount" : 1000,
"currency" : "USD",
"amount_to_capture" : 1000,
"confirm" : true,
"customer" : "test_customer",
"customer_email" : "test@gmail.com",
"customer_name" : "Test",
"description" : "stripe",
"return_url" : "https://juspay.in/",
"payment_method_data" : {"card" : {"card_number":"4242424242424242","card_exp_month":"12","card_exp_year":"29","card_holder_name":"JohnDoe","card_cvc":"123"}},
"payment_method" : "card",
"statement_descriptor_name" : "Test Merchant",
"statement_descriptor_suffix" : "US"
});
let refund_req = serde_json::json!({
"amount" : 1000,
"currency" : "USD",
"refund_id" : "refund_123",
"payment_id" : payment_id,
"merchant_id" : "jarnura",
});
let client = awc::Client::default();
let mut create_response = client
.post("http://127.0.0.1:8080/payments/create")
.insert_header(api_key)
.send_json(&request)
.await
.unwrap();
let create_response_body = create_response.body().await;
println!("{create_response:?} : {create_response_body:?}");
assert_eq!(create_response.status(), awc::http::StatusCode::OK);
let mut retrieve_response = client
.get("http://127.0.0.1:8080/payments/retrieve")
.insert_header(api_key)
.send_json(&request)
.await
.unwrap();
let retrieve_response_body = retrieve_response.body().await;
println!("{retrieve_response:?} =:= {retrieve_response_body:?}");
assert_eq!(retrieve_response.status(), awc::http::StatusCode::OK);
let mut refund_response = client
.post("http://127.0.0.1:8080/refunds/create")
.insert_header(api_key)
.send_json(&refund_req)
.await
.unwrap();
let refund_response_body = refund_response.body().await;
println!("{refund_response:?} =:= {refund_response_body:?}");
assert_eq!(refund_response.status(), awc::http::StatusCode::OK);
}
#[actix_web::test]
#[ignore]
// verify the API-KEY/merchant id has adyen as first choice
async fn payments_create_adyen() {
Box::pin(utils::setup()).await;
let payment_id = format!("test_{}", Uuid::new_v4());
let api_key = ("API-KEY", "321");
let request = serde_json::json!({
"payment_id" : payment_id,
"merchant_id" : "jarnura",
"amount" : 1000,
"currency" : "USD",
"amount_to_capture" : 1000,
"confirm" : true,
"customer" : "test_customer",
"customer_email" : "test@gmail.com",
"customer_name" : "Test",
"description" : "adyen",
"return_url" : "https://juspay.in/",
"payment_method_data" : {"card" : {"card_number":"5555 3412 4444 1115","card_exp_month":"03","card_exp_year":"2030","card_holder_name":"JohnDoe","card_cvc":"737"}},
"payment_method" : "card",
"statement_descriptor_name" : "Test Merchant",
"statement_descriptor_suffix" : "US"
});
let refund_req = serde_json::json!({
"amount" : 1000,
"currency" : "USD",
"refund_id" : "refund_123",
"payment_id" : payment_id,
"merchant_id" : "jarnura",
});
let client = awc::Client::default();
let mut create_response = client
.post("http://127.0.0.1:8080/payments/create")
.insert_header(api_key) //API Key must have adyen as first choice
.send_json(&request)
.await
.unwrap();
let create_response_body = create_response.body().await;
println!("{create_response:?} : {create_response_body:?}");
assert_eq!(create_response.status(), awc::http::StatusCode::OK);
let mut retrieve_response = client
.get("http://127.0.0.1:8080/payments/retrieve")
.insert_header(api_key)
.send_json(&request)
.await
.unwrap();
let retrieve_response_body = retrieve_response.body().await;
println!("{retrieve_response:?} =:= {retrieve_response_body:?}");
assert_eq!(retrieve_response.status(), awc::http::StatusCode::OK);
let mut refund_response = client
.post("http://127.0.0.1:8080/refunds/create")
.insert_header(api_key)
.send_json(&refund_req)
.await
.unwrap();
let refund_response_body = refund_response.body().await;
println!("{refund_response:?} =:= {refund_response_body:?}");
assert_eq!(refund_response.status(), awc::http::StatusCode::OK);
}
#[actix_web::test]
// verify the API-KEY/merchant id has stripe as first choice
#[ignore]
async fn payments_create_fail() {
Box::pin(utils::setup()).await;
let payment_id = format!("test_{}", Uuid::new_v4());
let api_key = ("API-KEY", "MySecretApiKey");
let invalid_request = serde_json::json!({
"description" : "stripe",
});
let request = serde_json::json!({
"payment_id" : payment_id,
"merchant_id" : "jarnura",
"amount" : 1000,
"currency" : "USD",
"amount_to_capture" : 1000,
"confirm" : true,
"customer" : "test_customer",
"customer_email" : "test@gmail.com",
"customer_name" : "Test",
"description" : "adyen",
"return_url" : "https://juspay.in/",
"payment_method_data" : {"card" : {"card_number":"5555 3412 4444 1115","card_exp_month":"03","card_exp_year":"2030","card_holder_name":"JohnDoe","card_cvc":"737"}},
"payment_method" : "card",
"statement_descriptor_name" : "Test Merchant",
"statement_descriptor_suffix" : "US"
});
let client = awc::Client::default();
let mut invalid_response = client
.post("http://127.0.0.1:8080/payments/create")
.insert_header(api_key)
.send_json(&invalid_request)
.await
.unwrap();
let invalid_response_body = invalid_response.body().await;
println!("{invalid_response:?} : {invalid_response_body:?}");
assert_eq!(
invalid_response.status(),
awc::http::StatusCode::BAD_REQUEST
);
let mut api_key_response = client
.get("http://127.0.0.1:8080/payments/retrieve")
// .insert_header(api_key)
.send_json(&request)
.await
.unwrap();
let api_key_response_body = api_key_response.body().await;
println!("{api_key_response:?} =:= {api_key_response_body:?}");
assert_eq!(
api_key_response.status(),
awc::http::StatusCode::UNAUTHORIZED
);
}
#[actix_web::test]
#[ignore]
async fn payments_todo() {
Box::pin(utils::setup()).await;
let client = awc::Client::default();
let mut response;
let mut response_body;
let _post_endpoints = ["123/update", "123/confirm", "cancel"];
let get_endpoints = vec!["list"];
for endpoint in get_endpoints {
response = client
.get(format!("http://127.0.0.1:8080/payments/{endpoint}"))
.insert_header(("API-KEY", "MySecretApiKey"))
.send()
.await
.unwrap();
response_body = response.body().await;
println!("{endpoint} =:= {response:?} : {response_body:?}");
assert_eq!(response.status(), awc::http::StatusCode::OK);
}
// for endpoint in post_endpoints {
// response = client
// .post(format!("http://127.0.0.1:8080/payments/{}", endpoint))
// .send()
// .await
// .unwrap();
// response_body = response.body().await;
// println!("{} =:= {:?} : {:?}", endpoint, response, response_body);
// assert_eq!(response.status(), awc::http::StatusCode::OK);
// }
}
#[test]
fn connector_list() {
let connector_list = types::ConnectorsList {
connectors: vec![String::from("stripe"), "adyen".to_string()],
};
let json = serde_json::to_string(&connector_list).unwrap();
println!("{}", &json);
let newlist: types::ConnectorsList = serde_json::from_str(&json).unwrap();
println!("{newlist:#?}");
assert_eq!(true, true);
}
#[cfg(feature = "v1")]
#[actix_rt::test]
#[ignore] // AWS
async fn payments_create_core() {
use configs::settings::Settings;
use hyperswitch_domain_models::merchant_context::{Context, MerchantContext};
let conf = Settings::new().expect("invalid settings");
let tx: oneshot::Sender<()> = oneshot::channel().0;
let app_state = Box::pin(routes::AppState::with_storage(
conf,
StorageImpl::PostgresqlTest,
tx,
Box::new(services::MockApiClient),
))
.await;
let merchant_id = id_type::MerchantId::try_from(Cow::from("juspay_merchant")).unwrap();
let state = Arc::new(app_state)
.get_session_state(
&id_type::TenantId::try_from_string("public".to_string()).unwrap(),
None,
|| {},
)
.unwrap();
let key_manager_state = &(&state).into();
let key_store = state
.store
.get_merchant_key_store_by_merchant_id(
key_manager_state,
&merchant_id,
&state.store.get_master_key().to_vec().into(),
)
.await
.unwrap();
let merchant_account = state
.store
.find_merchant_account_by_merchant_id(key_manager_state, &merchant_id, &key_store)
.await
.unwrap();
let merchant_context = MerchantContext::NormalMerchant(Box::new(Context(
merchant_account.clone(),
key_store.clone(),
)));
let payment_id =
id_type::PaymentId::try_from(Cow::Borrowed("pay_mbabizu24mvu3mela5njyhpit10")).unwrap();
let req = api::PaymentsRequest {
payment_id: Some(api::PaymentIdType::PaymentIntentId(payment_id.clone())),
merchant_id: Some(merchant_id.clone()),
amount: Some(MinorUnit::new(6540).into()),
currency: Some(api_enums::Currency::USD),
capture_method: Some(api_enums::CaptureMethod::Automatic),
amount_to_capture: Some(MinorUnit::new(6540)),
capture_on: Some(datetime!(2022-09-10 11:12)),
confirm: Some(true),
customer_id: None,
email: None,
name: None,
description: Some("Its my first payment request".to_string()),
return_url: Some(url::Url::parse("http://example.com/payments").unwrap()),
setup_future_usage: Some(api_enums::FutureUsage::OnSession),
authentication_type: Some(api_enums::AuthenticationType::NoThreeDs),
payment_method_data: Some(api::PaymentMethodDataRequest {
payment_method_data: Some(api::PaymentMethodData::Card(api::Card {
card_number: "4242424242424242".to_string().try_into().unwrap(),
card_exp_month: "10".to_string().into(),
card_exp_year: "35".to_string().into(),
card_holder_name: Some(masking::Secret::new("Arun Raj".to_string())),
card_cvc: "123".to_string().into(),
card_issuer: None,
card_network: None,
card_type: None,
card_issuing_country: None,
bank_code: None,
nick_name: Some(masking::Secret::new("nick_name".into())),
})),
billing: None,
}),
payment_method: Some(api_enums::PaymentMethod::Card),
shipping: Some(api::Address {
address: None,
phone: None,
email: None,
}),
billing: Some(api::Address {
address: None,
phone: None,
email: None,
}),
statement_descriptor_name: Some("Hyperswtich".to_string()),
statement_descriptor_suffix: Some("Hyperswitch".to_string()),
..Default::default()
};
let expected_response = api::PaymentsResponse {
payment_id,
status: api_enums::IntentStatus::Succeeded,
amount: MinorUnit::new(6540),
amount_capturable: MinorUnit::new(0),
amount_received: None,
client_secret: None,
created: None,
currency: "USD".to_string(),
customer_id: None,
description: Some("Its my first payment request".to_string()),
refunds: None,
mandate_id: None,
merchant_id,
net_amount: MinorUnit::new(6540),
connector: None,
customer: None,
disputes: None,
attempts: None,
captures: None,
mandate_data: None,
setup_future_usage: None,
off_session: None,
capture_on: None,
capture_method: None,
payment_method: None,
payment_method_data: None,
payment_token: None,
shipping: None,
billing: None,
order_details: None,
email: None,
name: None,
phone: None,
return_url: None,
authentication_type: None,
statement_descriptor_name: None,
statement_descriptor_suffix: None,
next_action: None,
cancellation_reason: None,
error_code: None,
error_message: None,
unified_code: None,
unified_message: None,
payment_experience: None,
payment_method_type: None,
connector_label: None,
business_country: None,
business_label: None,
business_sub_label: None,
allowed_payment_method_types: None,
ephemeral_key: None,
manual_retry_allowed: None,
connector_transaction_id: None,
frm_message: None,
metadata: None,
connector_metadata: None,
feature_metadata: None,
reference_id: None,
payment_link: None,
profile_id: None,
surcharge_details: None,
attempt_count: 1,
merchant_decision: None,
merchant_connector_id: None,
incremental_authorization_allowed: None,
authorization_count: None,
incremental_authorizations: None,
external_authentication_details: None,
external_3ds_authentication_attempted: None,
expires_on: None,
fingerprint: None,
browser_info: None,
payment_method_id: None,
payment_method_status: None,
updated: None,
split_payments: None,
frm_metadata: None,
merchant_order_reference_id: None,
capture_before: None,
extended_authorization_applied: None,
order_tax_amount: None,
connector_mandate_id: None,
shipping_cost: None,
card_discovery: None,
force_3ds_challenge: None,
force_3ds_challenge_trigger: None,
issuer_error_code: None,
issuer_error_message: None,
is_iframe_redirection_enabled: None,
whole_connector_response: None,
payment_channel: None,
network_transaction_id: None,
enable_partial_authorization: None,
is_overcapture_enabled: None,
enable_overcapture: None,
network_details: None,
is_stored_credential: None,
request_extended_authorization: None,
};
let expected_response =
services::ApplicationResponse::JsonWithHeaders((expected_response, vec![]));
let actual_response = Box::pin(payments::payments_core::<
api::Authorize,
api::PaymentsResponse,
_,
_,
_,
payments::PaymentData<api::Authorize>,
>(
state.clone(),
state.get_req_state(),
merchant_context,
None,
payments::PaymentCreate,
req,
services::AuthFlow::Merchant,
payments::CallConnectorAction::Trigger,
None,
hyperswitch_domain_models::payments::HeaderPayload::default(),
))
.await
.unwrap();
assert_eq!(expected_response, actual_response);
}
// #[actix_rt::test]
// async fn payments_start_core_stripe_redirect() {
// use configs::settings::Settings;
// let conf = Settings::new().expect("invalid settings");
// let state = routes::AppState {
// flow_name: String::from("default"),
// pg_conn: connection::pg_connection_read(&conf),
// redis_conn: connection::redis_connection(&conf).await,
// };
// let customer_id = format!("cust_{}", Uuid::new_v4());
// let merchant_id = "jarnura".to_string();
// let payment_id = "pay_mbabizu24mvu3mela5njyhpit10".to_string();
// let customer_data = api::CreateCustomerRequest {
// customer_id: customer_id.clone(),
// merchant_id: merchant_id.clone(),
// ..api::CreateCustomerRequest::default()
// };
// let _customer = customer_data.insert(&state.pg_conn).unwrap();
// let merchant_account = services::authenticate(&state, "MySecretApiKey").unwrap();
// let payment_attempt = storage::PaymentAttempt::find_by_payment_id_merchant_id(
// &state.pg_conn,
// &payment_id,
// &merchant_id,
// )
// .unwrap();
// let payment_intent = storage::PaymentIntent::find_by_payment_id_merchant_id(
// &state.pg_conn,
// &payment_id,
// &merchant_id,
// )
// .unwrap();
// let payment_intent_update = storage::PaymentIntentUpdate::ReturnUrlUpdate {
// return_url: "http://example.com/payments".to_string(),
// status: None,
// };
// payment_intent
// .update(&state.pg_conn, payment_intent_update)
// .unwrap();
// let expected_response = services::ApplicationResponse::Form(services::RedirectForm {
// url: "http://example.com/payments".to_string(),
// method: services::Method::Post,
// form_fields: HashMap::from([("payment_id".to_string(), payment_id.clone())]),
// });
// let actual_response = payments_start_core(
// &state,
// merchant_account,
// api::PaymentsStartRequest {
// payment_id,
// merchant_id,
// txn_id: payment_attempt.txn_id.to_owned(),
// },
// )
// .await
// .unwrap();
// assert_eq!(expected_response, actual_response);
// }
#[cfg(feature = "v1")]
#[actix_rt::test]
#[ignore]
async fn payments_create_core_adyen_no_redirect() {
use hyperswitch_domain_models::merchant_context::{Context, MerchantContext};
use crate::configs::settings::Settings;
let conf = Settings::new().expect("invalid settings");
let tx: oneshot::Sender<()> = oneshot::channel().0;
let app_state = Box::pin(routes::AppState::with_storage(
conf,
StorageImpl::PostgresqlTest,
tx,
Box::new(services::MockApiClient),
))
.await;
let state = Arc::new(app_state)
.get_session_state(
&id_type::TenantId::try_from_string("public".to_string()).unwrap(),
None,
|| {},
)
.unwrap();
let payment_id =
id_type::PaymentId::try_from(Cow::Borrowed("pay_mbabizu24mvu3mela5njyhpit10")).unwrap();
let customer_id = format!("cust_{}", Uuid::new_v4());
let merchant_id = id_type::MerchantId::try_from(Cow::from("juspay_merchant")).unwrap();
let key_manager_state = &(&state).into();
let key_store = state
.store
.get_merchant_key_store_by_merchant_id(
key_manager_state,
&merchant_id,
&state.store.get_master_key().to_vec().into(),
)
.await
.unwrap();
let merchant_account = state
.store
.find_merchant_account_by_merchant_id(key_manager_state, &merchant_id, &key_store)
.await
.unwrap();
let merchant_context = MerchantContext::NormalMerchant(Box::new(Context(
merchant_account.clone(),
key_store.clone(),
)));
let req = api::PaymentsRequest {
payment_id: Some(api::PaymentIdType::PaymentIntentId(payment_id.clone())),
merchant_id: Some(merchant_id.clone()),
amount: Some(MinorUnit::new(6540).into()),
currency: Some(api_enums::Currency::USD),
capture_method: Some(api_enums::CaptureMethod::Automatic),
amount_to_capture: Some(MinorUnit::new(6540)),
capture_on: Some(datetime!(2022-09-10 10:11:12)),
confirm: Some(true),
customer_id: Some(id_type::CustomerId::try_from(Cow::from(customer_id)).unwrap()),
description: Some("Its my first payment request".to_string()),
return_url: Some(url::Url::parse("http://example.com/payments").unwrap()),
setup_future_usage: Some(api_enums::FutureUsage::OnSession),
authentication_type: Some(api_enums::AuthenticationType::NoThreeDs),
payment_method_data: Some(api::PaymentMethodDataRequest {
payment_method_data: Some(api::PaymentMethodData::Card(api::Card {
card_number: "5555 3412 4444 1115".to_string().try_into().unwrap(),
card_exp_month: "03".to_string().into(),
card_exp_year: "2030".to_string().into(),
card_holder_name: Some(masking::Secret::new("JohnDoe".to_string())),
card_cvc: "737".to_string().into(),
card_issuer: None,
card_network: None,
card_type: None,
card_issuing_country: None,
bank_code: None,
nick_name: Some(masking::Secret::new("nick_name".into())),
})),
billing: None,
}),
payment_method: Some(api_enums::PaymentMethod::Card),
shipping: Some(api::Address {
address: None,
phone: None,
email: None,
}),
billing: Some(api::Address {
address: None,
phone: None,
email: None,
}),
statement_descriptor_name: Some("Juspay".to_string()),
statement_descriptor_suffix: Some("Router".to_string()),
..Default::default()
};
let expected_response = services::ApplicationResponse::JsonWithHeaders((
api::PaymentsResponse {
payment_id: payment_id.clone(),
status: api_enums::IntentStatus::Processing,
amount: MinorUnit::new(6540),
amount_capturable: MinorUnit::new(0),
amount_received: None,
client_secret: None,
created: None,
currency: "USD".to_string(),
customer_id: None,
description: Some("Its my first payment request".to_string()),
refunds: None,
mandate_id: None,
merchant_id,
net_amount: MinorUnit::new(6540),
connector: None,
customer: None,
disputes: None,
attempts: None,
captures: None,
mandate_data: None,
setup_future_usage: None,
off_session: None,
capture_on: None,
capture_method: None,
payment_method: None,
payment_method_data: None,
payment_token: None,
shipping: None,
billing: None,
order_details: None,
email: None,
name: None,
phone: None,
return_url: None,
authentication_type: None,
statement_descriptor_name: None,
statement_descriptor_suffix: None,
next_action: None,
cancellation_reason: None,
error_code: None,
error_message: None,
unified_code: None,
unified_message: None,
payment_experience: None,
payment_method_type: None,
connector_label: None,
business_country: None,
business_label: None,
business_sub_label: None,
allowed_payment_method_types: None,
ephemeral_key: None,
manual_retry_allowed: None,
connector_transaction_id: None,
frm_message: None,
metadata: None,
connector_metadata: None,
feature_metadata: None,
reference_id: None,
payment_link: None,
profile_id: None,
surcharge_details: None,
attempt_count: 1,
merchant_decision: None,
merchant_connector_id: None,
incremental_authorization_allowed: None,
authorization_count: None,
incremental_authorizations: None,
external_authentication_details: None,
external_3ds_authentication_attempted: None,
expires_on: None,
fingerprint: None,
browser_info: None,
payment_method_id: None,
payment_method_status: None,
updated: None,
split_payments: None,
frm_metadata: None,
merchant_order_reference_id: None,
capture_before: None,
extended_authorization_applied: None,
order_tax_amount: None,
connector_mandate_id: None,
shipping_cost: None,
card_discovery: None,
force_3ds_challenge: None,
force_3ds_challenge_trigger: None,
issuer_error_code: None,
issuer_error_message: None,
is_iframe_redirection_enabled: None,
whole_connector_response: None,
payment_channel: None,
network_transaction_id: None,
enable_partial_authorization: None,
is_overcapture_enabled: None,
enable_overcapture: None,
network_details: None,
is_stored_credential: None,
request_extended_authorization: None,
},
vec![],
));
let actual_response = Box::pin(payments::payments_core::<
api::Authorize,
api::PaymentsResponse,
_,
_,
_,
payments::PaymentData<api::Authorize>,
>(
state.clone(),
state.get_req_state(),
merchant_context,
None,
payments::PaymentCreate,
req,
services::AuthFlow::Merchant,
payments::CallConnectorAction::Trigger,
None,
hyperswitch_domain_models::payments::HeaderPayload::default(),
))
.await
.unwrap();
assert_eq!(expected_response, actual_response);
}
|
crates/router/tests/payments.rs
|
router
|
full_file
| null | null | null | 6,463
| null | null | null | null | null | null | null |
// Struct: PmCards
// File: crates/router/src/core/payment_methods/cards.rs
// Module: router
// Implementations: 1
// Traits: PaymentMethodsController
pub struct PmCards<'a>
|
crates/router/src/core/payment_methods/cards.rs
|
router
|
struct_definition
|
PmCards
| 1
|
[
"PaymentMethodsController"
] | 46
| null | null | null | null | null | null | null |
// Struct: PaymentMethodDetails
// File: crates/hyperswitch_domain_models/src/router_response_types.rs
// Module: hyperswitch_domain_models
// Implementations: 0
pub struct PaymentMethodDetails
|
crates/hyperswitch_domain_models/src/router_response_types.rs
|
hyperswitch_domain_models
|
struct_definition
|
PaymentMethodDetails
| 0
|
[] | 43
| null | null | null | null | null | null | null |
// Function: perform_post_authentication
// File: crates/router/src/core/authentication.rs
// Module: router
pub fn perform_post_authentication(
state: &SessionState,
key_store: &domain::MerchantKeyStore,
business_profile: domain::Profile,
authentication_id: common_utils::id_type::AuthenticationId,
payment_id: &common_utils::id_type::PaymentId,
) -> CustomResult<
hyperswitch_domain_models::router_request_types::authentication::AuthenticationStore,
ApiErrorResponse,
>
|
crates/router/src/core/authentication.rs
|
router
|
function_signature
| null | null | null | 106
|
perform_post_authentication
| null | null | null | null | null | null |
// Struct: DisputeEvidence
// File: crates/router/src/types/api/disputes.rs
// Module: router
// Implementations: 0
pub struct DisputeEvidence
|
crates/router/src/types/api/disputes.rs
|
router
|
struct_definition
|
DisputeEvidence
| 0
|
[] | 37
| null | null | null | null | null | null | null |
// Function: api_key_create
// File: crates/router/src/routes/api_keys.rs
// Module: router
pub fn api_key_create(
state: web::Data<AppState>,
req: HttpRequest,
json_payload: web::Json<api_types::CreateApiKeyRequest>,
) -> impl Responder
|
crates/router/src/routes/api_keys.rs
|
router
|
function_signature
| null | null | null | 63
|
api_key_create
| null | null | null | null | null | null |
// Module Structure
// File: crates/router/src/services/api/generic_link_response.rs
// Module: router
// Public submodules:
pub mod context;
|
crates/router/src/services/api/generic_link_response.rs
|
router
|
module_structure
| null | null | null | 32
| null | null | null | null | null | 1
| 0
|
// Implementation: impl api::ConnectorAccessToken for for Volt
// File: crates/hyperswitch_connectors/src/connectors/volt.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::ConnectorAccessToken for for Volt
|
crates/hyperswitch_connectors/src/connectors/volt.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 55
| null |
Volt
|
api::ConnectorAccessToken for
| 0
| 0
| null | null |
// Struct: VoucherRequest
// File: crates/hyperswitch_connectors/src/connectors/shift4/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct VoucherRequest
|
crates/hyperswitch_connectors/src/connectors/shift4/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
VoucherRequest
| 0
|
[] | 48
| null | null | null | null | null | null | null |
// Implementation: impl RefundMetricAccumulator for for RefundReasonAccumulator
// File: crates/analytics/src/refunds/accumulator.rs
// Module: analytics
// Methods: 2 total (0 public)
impl RefundMetricAccumulator for for RefundReasonAccumulator
|
crates/analytics/src/refunds/accumulator.rs
|
analytics
|
impl_block
| null | null | null | 62
| null |
RefundReasonAccumulator
|
RefundMetricAccumulator for
| 2
| 0
| null | null |
// Struct: OutgoingWebhookPayloadWithSignature
// File: crates/router/src/core/webhooks/types.rs
// Module: router
// Implementations: 0
pub struct OutgoingWebhookPayloadWithSignature
|
crates/router/src/core/webhooks/types.rs
|
router
|
struct_definition
|
OutgoingWebhookPayloadWithSignature
| 0
|
[] | 44
| null | null | null | null | null | null | null |
// File: crates/hyperswitch_interfaces/src/api/files.rs
// Module: hyperswitch_interfaces
//! Files interface
use hyperswitch_domain_models::{
router_flow_types::files::{Retrieve, Upload},
router_request_types::{RetrieveFileRequestData, UploadFileRequestData},
router_response_types::{RetrieveFileResponse, UploadFileResponse},
};
use crate::{
api::{ConnectorCommon, ConnectorIntegration},
errors,
};
/// enum FilePurpose
#[derive(Debug, serde::Deserialize, strum::Display, Clone, serde::Serialize)]
#[serde(rename_all = "snake_case")]
#[strum(serialize_all = "snake_case")]
pub enum FilePurpose {
/// DisputeEvidence
DisputeEvidence,
}
/// trait UploadFile
pub trait UploadFile:
ConnectorIntegration<Upload, UploadFileRequestData, UploadFileResponse>
{
}
/// trait RetrieveFile
pub trait RetrieveFile:
ConnectorIntegration<Retrieve, RetrieveFileRequestData, RetrieveFileResponse>
{
}
/// trait FileUpload
pub trait FileUpload: ConnectorCommon + Sync + UploadFile + RetrieveFile {
/// fn validate_file_upload
fn validate_file_upload(
&self,
_purpose: FilePurpose,
_file_size: i32,
_file_type: mime::Mime,
) -> common_utils::errors::CustomResult<(), errors::ConnectorError> {
Err(errors::ConnectorError::FileValidationFailed {
reason: "".to_owned(),
}
.into())
}
}
|
crates/hyperswitch_interfaces/src/api/files.rs
|
hyperswitch_interfaces
|
full_file
| null | null | null | 310
| null | null | null | null | null | null | null |
// Struct: Comparison
// File: crates/euclid/src/frontend/ast.rs
// Module: euclid
// Implementations: 0
pub struct Comparison
|
crates/euclid/src/frontend/ast.rs
|
euclid
|
struct_definition
|
Comparison
| 0
|
[] | 34
| null | null | null | null | null | null | null |
// File: crates/router/tests/connectors/authorizedotnet.rs
// Module: router
use std::str::FromStr;
use masking::Secret;
use router::types::{self, domain, storage::enums};
use crate::{
connector_auth,
utils::{self, ConnectorActions, PaymentInfo},
};
#[derive(Clone, Copy)]
struct AuthorizedotnetTest;
impl ConnectorActions for AuthorizedotnetTest {}
impl utils::Connector for AuthorizedotnetTest {
fn get_data(&self) -> types::api::ConnectorData {
use router::connector::Authorizedotnet;
utils::construct_connector_data_old(
Box::new(Authorizedotnet::new()),
types::Connector::Authorizedotnet,
types::api::GetToken::Connector,
None,
)
}
fn get_auth_token(&self) -> types::ConnectorAuthType {
utils::to_connector_auth_type(
connector_auth::ConnectorAuthentication::new()
.authorizedotnet
.expect("Missing connector authentication configuration")
.into(),
)
}
fn get_name(&self) -> String {
"authorizedotnet".to_string()
}
}
static CONNECTOR: AuthorizedotnetTest = AuthorizedotnetTest {};
fn get_payment_method_data() -> domain::Card {
domain::Card {
card_number: cards::CardNumber::from_str("5424000000000015").unwrap(),
card_exp_month: Secret::new("02".to_string()),
card_exp_year: Secret::new("2035".to_string()),
card_cvc: Secret::new("123".to_string()),
..Default::default()
}
}
// Cards Positive Tests
// Creates a payment using the manual capture flow (Non 3DS).
#[actix_web::test]
async fn should_only_authorize_payment() {
let authorize_response = CONNECTOR
.authorize_payment(
Some(types::PaymentsAuthorizeData {
amount: 300,
payment_method_data: domain::PaymentMethodData::Card(get_payment_method_data()),
capture_method: Some(diesel_models::enums::CaptureMethod::Manual),
..utils::PaymentAuthorizeType::default().0
}),
Some(PaymentInfo::with_default_billing_name()),
)
.await
.expect("Authorize payment response");
assert_eq!(authorize_response.status, enums::AttemptStatus::Pending);
let txn_id =
utils::get_connector_transaction_id(authorize_response.response).unwrap_or_default();
let psync_response = CONNECTOR
.psync_retry_till_status_matches(
enums::AttemptStatus::Authorized,
Some(types::PaymentsSyncData {
connector_transaction_id: types::ResponseId::ConnectorTransactionId(txn_id),
encoded_data: None,
capture_method: None,
..Default::default()
}),
None,
)
.await
.expect("PSync response");
assert_eq!(psync_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 authorize_response = CONNECTOR
.authorize_payment(
Some(types::PaymentsAuthorizeData {
amount: 301,
payment_method_data: domain::PaymentMethodData::Card(get_payment_method_data()),
capture_method: Some(diesel_models::enums::CaptureMethod::Manual),
..utils::PaymentAuthorizeType::default().0
}),
Some(PaymentInfo::with_default_billing_name()),
)
.await
.expect("Authorize payment response");
assert_eq!(authorize_response.status, enums::AttemptStatus::Pending);
let txn_id =
utils::get_connector_transaction_id(authorize_response.response).unwrap_or_default();
let psync_response = CONNECTOR
.psync_retry_till_status_matches(
enums::AttemptStatus::Authorized,
Some(types::PaymentsSyncData {
connector_transaction_id: types::ResponseId::ConnectorTransactionId(txn_id.clone()),
encoded_data: None,
capture_method: None,
..Default::default()
}),
None,
)
.await
.expect("PSync response");
assert_eq!(psync_response.status, enums::AttemptStatus::Authorized);
let cap_response = CONNECTOR
.capture_payment(
txn_id.clone(),
Some(types::PaymentsCaptureData {
amount_to_capture: 301,
..utils::PaymentCaptureType::default().0
}),
None,
)
.await
.expect("Capture payment response");
assert_eq!(cap_response.status, enums::AttemptStatus::Pending);
let response = CONNECTOR
.psync_retry_till_status_matches(
enums::AttemptStatus::CaptureInitiated,
Some(types::PaymentsSyncData {
connector_transaction_id: types::ResponseId::ConnectorTransactionId(txn_id),
encoded_data: None,
capture_method: None,
..Default::default()
}),
None,
)
.await
.expect("PSync response");
assert_eq!(response.status, enums::AttemptStatus::CaptureInitiated);
}
// Partially captures a payment using the manual capture flow (Non 3DS).
#[actix_web::test]
async fn should_partially_capture_authorized_payment() {
let authorize_response = CONNECTOR
.authorize_payment(
Some(types::PaymentsAuthorizeData {
amount: 302,
payment_method_data: domain::PaymentMethodData::Card(get_payment_method_data()),
capture_method: Some(diesel_models::enums::CaptureMethod::Manual),
..utils::PaymentAuthorizeType::default().0
}),
Some(PaymentInfo::with_default_billing_name()),
)
.await
.expect("Authorize payment response");
assert_eq!(authorize_response.status, enums::AttemptStatus::Pending);
let txn_id =
utils::get_connector_transaction_id(authorize_response.response).unwrap_or_default();
let psync_response = CONNECTOR
.psync_retry_till_status_matches(
enums::AttemptStatus::Authorized,
Some(types::PaymentsSyncData {
connector_transaction_id: types::ResponseId::ConnectorTransactionId(txn_id.clone()),
encoded_data: None,
capture_method: None,
..Default::default()
}),
None,
)
.await
.expect("PSync response");
assert_eq!(psync_response.status, enums::AttemptStatus::Authorized);
let cap_response = CONNECTOR
.capture_payment(
txn_id.clone(),
Some(types::PaymentsCaptureData {
amount_to_capture: 150,
..utils::PaymentCaptureType::default().0
}),
None,
)
.await
.expect("Capture payment response");
assert_eq!(cap_response.status, enums::AttemptStatus::Pending);
let response = CONNECTOR
.psync_retry_till_status_matches(
enums::AttemptStatus::CaptureInitiated,
Some(types::PaymentsSyncData {
connector_transaction_id: types::ResponseId::ConnectorTransactionId(txn_id),
encoded_data: None,
capture_method: None,
..Default::default()
}),
None,
)
.await
.expect("PSync response");
assert_eq!(response.status, enums::AttemptStatus::CaptureInitiated);
}
// 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(
Some(types::PaymentsAuthorizeData {
amount: 303,
payment_method_data: domain::PaymentMethodData::Card(get_payment_method_data()),
capture_method: Some(diesel_models::enums::CaptureMethod::Manual),
..utils::PaymentAuthorizeType::default().0
}),
Some(PaymentInfo::with_default_billing_name()),
)
.await
.expect("Authorize payment response");
assert_eq!(authorize_response.status, enums::AttemptStatus::Pending);
let txn_id =
utils::get_connector_transaction_id(authorize_response.response).unwrap_or_default();
let response = CONNECTOR
.psync_retry_till_status_matches(
enums::AttemptStatus::Authorized,
Some(types::PaymentsSyncData {
connector_transaction_id: types::ResponseId::ConnectorTransactionId(txn_id),
encoded_data: None,
capture_method: None,
..Default::default()
}),
None,
)
.await
.expect("PSync response");
assert_eq!(response.status, enums::AttemptStatus::Authorized,);
}
// Voids a payment using the manual capture flow (Non 3DS).x
#[actix_web::test]
async fn should_void_authorized_payment() {
let authorize_response = CONNECTOR
.authorize_payment(
Some(types::PaymentsAuthorizeData {
amount: 304,
payment_method_data: domain::PaymentMethodData::Card(get_payment_method_data()),
capture_method: Some(diesel_models::enums::CaptureMethod::Manual),
..utils::PaymentAuthorizeType::default().0
}),
Some(PaymentInfo::with_default_billing_name()),
)
.await
.expect("Authorize payment response");
assert_eq!(authorize_response.status, enums::AttemptStatus::Pending);
let txn_id =
utils::get_connector_transaction_id(authorize_response.response).unwrap_or_default();
let psync_response = CONNECTOR
.psync_retry_till_status_matches(
enums::AttemptStatus::Authorized,
Some(types::PaymentsSyncData {
connector_transaction_id: types::ResponseId::ConnectorTransactionId(txn_id.clone()),
encoded_data: None,
capture_method: None,
..Default::default()
}),
None,
)
.await
.expect("PSync response");
assert_eq!(psync_response.status, enums::AttemptStatus::Authorized);
let void_response = CONNECTOR
.void_payment(
txn_id,
Some(types::PaymentsCancelData {
amount: Some(304),
..utils::PaymentCancelType::default().0
}),
None,
)
.await
.expect("Void response");
assert_eq!(void_response.status, enums::AttemptStatus::VoidInitiated)
}
// Creates a payment using the automatic capture flow (Non 3DS).
#[actix_web::test]
async fn should_make_payment() {
let cap_response = CONNECTOR
.make_payment(
Some(types::PaymentsAuthorizeData {
amount: 310,
payment_method_data: domain::PaymentMethodData::Card(get_payment_method_data()),
capture_method: Some(diesel_models::enums::CaptureMethod::Manual),
..utils::PaymentAuthorizeType::default().0
}),
None,
)
.await
.unwrap();
assert_eq!(cap_response.status, enums::AttemptStatus::Pending);
let txn_id = utils::get_connector_transaction_id(cap_response.response).unwrap_or_default();
let psync_response = CONNECTOR
.psync_retry_till_status_matches(
enums::AttemptStatus::CaptureInitiated,
Some(types::PaymentsSyncData {
connector_transaction_id: types::ResponseId::ConnectorTransactionId(txn_id.clone()),
encoded_data: None,
capture_method: None,
..Default::default()
}),
None,
)
.await
.expect("PSync response");
assert_eq!(
psync_response.status,
enums::AttemptStatus::CaptureInitiated
);
}
// 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(
Some(types::PaymentsAuthorizeData {
amount: 311,
payment_method_data: domain::PaymentMethodData::Card(get_payment_method_data()),
capture_method: Some(diesel_models::enums::CaptureMethod::Manual),
..utils::PaymentAuthorizeType::default().0
}),
None,
)
.await
.unwrap();
assert_eq!(authorize_response.status, enums::AttemptStatus::Pending);
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::Pending,
Some(types::PaymentsSyncData {
connector_transaction_id: types::ResponseId::ConnectorTransactionId(
txn_id.unwrap(),
),
encoded_data: None,
capture_method: None,
..Default::default()
}),
None,
)
.await
.unwrap();
assert_eq!(response.status, enums::AttemptStatus::CaptureInitiated);
}
// Synchronizes a refund using the automatic capture flow (Non 3DS).
#[actix_web::test]
async fn should_sync_refund() {
let response = CONNECTOR
.rsync_retry_till_status_matches(
enums::RefundStatus::Success,
"60217566768".to_string(),
None,
None,
)
.await
.unwrap();
assert_eq!(
response.response.unwrap().refund_status,
enums::RefundStatus::Success,
);
}
// Creates a payment with empty card number.
#[actix_web::test]
async fn should_fail_payment_for_empty_card_number() {
let response = CONNECTOR
.make_payment(
Some(types::PaymentsAuthorizeData {
payment_method_data: domain::PaymentMethodData::Card(domain::Card {
card_number: cards::CardNumber::from_str("").unwrap(),
..utils::CCardType::default().0
}),
..utils::PaymentAuthorizeType::default().0
}),
None,
)
.await
.unwrap();
let x = response.response.unwrap_err();
assert_eq!(
x.message,
"The 'AnetApi/xml/v1/schema/AnetApiSchema.xsd:cardNumber' element is invalid - The value XX is invalid according to its datatype 'String' - The actual length is less than the MinLength value.",
);
}
// 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: domain::PaymentMethodData::Card(domain::Card {
card_cvc: Secret::new("12345".to_string()),
..utils::CCardType::default().0
}),
..utils::PaymentAuthorizeType::default().0
}),
None,
)
.await
.unwrap();
assert_eq!(
response.response.unwrap_err().message,
"The 'AnetApi/xml/v1/schema/AnetApiSchema.xsd:cardCode' element is invalid - The value XXXXXXX is invalid according to its datatype 'AnetApi/xml/v1/schema/AnetApiSchema.xsd:cardCode' - The actual length is greater than the MaxLength value.".to_string(),
);
}
// todo()
// 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: domain::PaymentMethodData::Card(domain::Card {
card_exp_month: Secret::new("20".to_string()),
..utils::CCardType::default().0
}),
..utils::PaymentAuthorizeType::default().0
}),
None,
)
.await
.unwrap();
assert_eq!(
response.response.unwrap_err().message,
"Credit card expiration date 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: domain::PaymentMethodData::Card(domain::Card {
card_exp_year: Secret::new("2000".to_string()),
..utils::CCardType::default().0
}),
..utils::PaymentAuthorizeType::default().0
}),
None,
)
.await
.unwrap();
assert_eq!(
response.response.unwrap_err().message,
"The credit card has expired.".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(
Some(types::PaymentsAuthorizeData {
amount: 307,
payment_method_data: domain::PaymentMethodData::Card(get_payment_method_data()),
capture_method: Some(diesel_models::enums::CaptureMethod::Manual),
..utils::PaymentAuthorizeType::default().0
}),
None,
)
.await
.unwrap();
let txn_id = utils::get_connector_transaction_id(authorize_response.response);
let void_response = CONNECTOR
.void_payment(txn_id.unwrap(), None, None)
.await
.unwrap();
assert_eq!(
void_response.response.unwrap_err().message,
"The 'AnetApi/xml/v1/schema/AnetApiSchema.xsd:amount' element is invalid - The value '' is invalid according to its datatype 'http://www.w3.org/2001/XMLSchema:decimal' - The string '' is not a valid Decimal value."
);
}
// 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, None)
.await
.unwrap();
assert_eq!(
capture_response.response.unwrap_err().message,
"The transaction cannot be found."
);
}
#[actix_web::test]
#[ignore = "refunds tests are ignored for this connector because it takes one day for a payment to be settled."]
async fn should_partially_refund_manually_captured_payment() {}
#[actix_web::test]
#[ignore = "refunds tests are ignored for this connector because it takes one day for a payment to be settled."]
async fn should_refund_manually_captured_payment() {}
#[actix_web::test]
#[ignore = "refunds tests are ignored for this connector because it takes one day for a payment to be settled."]
async fn should_sync_manually_captured_refund() {}
#[actix_web::test]
#[ignore = "refunds tests are ignored for this connector because it takes one day for a payment to be settled."]
async fn should_refund_auto_captured_payment() {}
#[actix_web::test]
#[ignore = "refunds tests are ignored for this connector because it takes one day for a payment to be settled."]
async fn should_partially_refund_succeeded_payment() {}
#[actix_web::test]
#[ignore = "refunds tests are ignored for this connector because it takes one day for a payment to be settled."]
async fn should_refund_succeeded_payment_multiple_times() {}
#[actix_web::test]
#[ignore = "refunds tests are ignored for this connector because it takes one day for a payment to be settled."]
async fn should_fail_for_refund_amount_higher_than_payment_amount() {}
// Connector dependent test cases goes here
// [#478]: add unit tests for non 3DS, wallets & webhooks in connector tests
|
crates/router/tests/connectors/authorizedotnet.rs
|
router
|
full_file
| null | null | null | 4,231
| null | null | null | null | null | null | null |
// Function: calculate_net_amount
// File: crates/hyperswitch_domain_models/src/payments.rs
// Module: hyperswitch_domain_models
// Documentation: Calculate the net amount for the order
pub fn calculate_net_amount(&self) -> MinorUnit
|
crates/hyperswitch_domain_models/src/payments.rs
|
hyperswitch_domain_models
|
function_signature
| null | null | null | 52
|
calculate_net_amount
| null | null | null | null | null | null |
// Struct: PaymentMethodSessionConfirmRequest
// File: crates/api_models/src/payment_methods.rs
// Module: api_models
// Implementations: 0
pub struct PaymentMethodSessionConfirmRequest
|
crates/api_models/src/payment_methods.rs
|
api_models
|
struct_definition
|
PaymentMethodSessionConfirmRequest
| 0
|
[] | 40
| null | null | null | null | null | null | null |
// Struct: ShippingMethod
// File: crates/hyperswitch_connectors/src/connectors/amazonpay/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct ShippingMethod
|
crates/hyperswitch_connectors/src/connectors/amazonpay/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
ShippingMethod
| 0
|
[] | 46
| null | null | null | null | null | null | null |
// Struct: ArchipelOrderResponse
// File: crates/hyperswitch_connectors/src/connectors/archipel/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct ArchipelOrderResponse
|
crates/hyperswitch_connectors/src/connectors/archipel/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
ArchipelOrderResponse
| 0
|
[] | 49
| null | null | null | null | null | null | null |
// Struct: DummyConnectorErrorResponse
// File: crates/hyperswitch_connectors/src/connectors/dummyconnector/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct DummyConnectorErrorResponse
|
crates/hyperswitch_connectors/src/connectors/dummyconnector/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
DummyConnectorErrorResponse
| 0
|
[] | 48
| null | null | null | null | null | null | null |
// Implementation: impl MerchantAccountUpdate
// File: crates/api_models/src/admin.rs
// Module: api_models
// Methods: 7 total (7 public)
impl MerchantAccountUpdate
|
crates/api_models/src/admin.rs
|
api_models
|
impl_block
| null | null | null | 38
| null |
MerchantAccountUpdate
| null | 7
| 7
| null | null |
// Struct: ConnectAccountRequest
// File: crates/api_models/src/user.rs
// Module: api_models
// Implementations: 0
pub struct ConnectAccountRequest
|
crates/api_models/src/user.rs
|
api_models
|
struct_definition
|
ConnectAccountRequest
| 0
|
[] | 35
| null | null | null | null | null | null | null |
// Struct: BlocklistNew
// File: crates/diesel_models/src/blocklist.rs
// Module: diesel_models
// Implementations: 0
pub struct BlocklistNew
|
crates/diesel_models/src/blocklist.rs
|
diesel_models
|
struct_definition
|
BlocklistNew
| 0
|
[] | 37
| null | null | null | null | null | null | null |
// Function: get_all_payout_keys
// File: crates/euclid_wasm/src/lib.rs
// Module: euclid_wasm
pub fn get_all_payout_keys() -> JsResult
|
crates/euclid_wasm/src/lib.rs
|
euclid_wasm
|
function_signature
| null | null | null | 41
|
get_all_payout_keys
| null | null | null | null | null | null |
// File: crates/test_utils/src/newman_runner.rs
// Module: test_utils
// Public functions: 8
// Public structs: 2
use std::{
env,
fs::{self, OpenOptions},
io::{self, Write},
path::Path,
process::{exit, Command},
};
use anyhow::{Context, Result};
use clap::{arg, command, Parser, ValueEnum};
use masking::PeekInterface;
use regex::Regex;
use crate::connector_auth::{
ConnectorAuthType, ConnectorAuthentication, ConnectorAuthenticationMap,
};
#[derive(ValueEnum, Clone, Copy)]
pub enum Module {
Connector,
Users,
}
#[derive(Parser)]
#[command(version, about = "Postman collection runner using newman!", long_about = None)]
pub struct Args {
/// Admin API Key of the environment
#[arg(short, long)]
admin_api_key: String,
/// Base URL of the Hyperswitch environment
#[arg(short, long)]
base_url: String,
/// Name of the connector
#[arg(short, long)]
connector_name: Option<String>,
/// Name of the module
#[arg(short, long)]
module_name: Option<Module>,
/// Custom headers
#[arg(short = 'H', long = "header")]
custom_headers: Option<Vec<String>>,
/// Minimum delay in milliseconds to be added before sending a request
/// By default, 7 milliseconds will be the delay
#[arg(short, long, default_value_t = 7)]
delay_request: u32,
/// Folder name of specific tests
#[arg(short, long = "folder")]
folders: Option<String>,
/// Optional Verbose logs
#[arg(short, long)]
verbose: bool,
}
impl Args {
/// Getter for the `module_name` field
pub fn get_module_name(&self) -> Option<Module> {
self.module_name
}
}
pub struct ReturnArgs {
pub newman_command: Command,
pub modified_file_paths: Vec<Option<String>>,
pub collection_path: String,
}
// Generates the name of the collection JSON file for the specified connector.
// Example: CONNECTOR_NAME="stripe" -> OUTPUT: postman/collection-json/stripe.postman_collection.json
#[inline]
fn get_collection_path(name: impl AsRef<str>) -> String {
format!(
"postman/collection-json/{}.postman_collection.json",
name.as_ref()
)
}
// Generates the name of the collection directory for the specified connector.
// Example: CONNECTOR_NAME="stripe" -> OUTPUT: postman/collection-dir/stripe
#[inline]
fn get_dir_path(name: impl AsRef<str>) -> String {
format!("postman/collection-dir/{}", name.as_ref())
}
// This function currently allows you to add only custom headers.
// In future, as we scale, this can be modified based on the need
fn insert_content<T, U>(dir: T, content_to_insert: U) -> io::Result<()>
where
T: AsRef<Path>,
U: AsRef<str>,
{
let file_name = "event.prerequest.js";
let file_path = dir.as_ref().join(file_name);
// Open the file in write mode or create it if it doesn't exist
let mut file = OpenOptions::new()
.append(true)
.create(true)
.open(file_path)?;
write!(file, "{}", content_to_insert.as_ref())?;
Ok(())
}
// This function gives runner for connector or a module
pub fn generate_runner() -> Result<ReturnArgs> {
let args = Args::parse();
match args.get_module_name() {
Some(Module::Users) => generate_newman_command_for_users(),
Some(Module::Connector) => generate_newman_command_for_connector(),
// Running connector tests when no module is passed to keep the previous test behavior same
None => generate_newman_command_for_connector(),
}
}
pub fn generate_newman_command_for_users() -> Result<ReturnArgs> {
let args = Args::parse();
let base_url = args.base_url;
let admin_api_key = args.admin_api_key;
let path = env::var("CONNECTOR_AUTH_FILE_PATH")
.with_context(|| "connector authentication file path not set")?;
let authentication: ConnectorAuthentication = toml::from_str(
&fs::read_to_string(path)
.with_context(|| "connector authentication config file not found")?,
)
.with_context(|| "connector authentication file path not set")?;
let users_configs = authentication
.users
.with_context(|| "user configs not found in authentication file")?;
let collection_path = get_collection_path("users");
let mut newman_command = Command::new("newman");
newman_command.args(["run", &collection_path]);
newman_command.args(["--env-var", &format!("admin_api_key={admin_api_key}")]);
newman_command.args(["--env-var", &format!("baseUrl={base_url}")]);
newman_command.args([
"--env-var",
&format!("user_email={}", users_configs.user_email),
]);
newman_command.args([
"--env-var",
&format!(
"user_base_email_for_signup={}",
users_configs.user_base_email_for_signup
),
]);
newman_command.args([
"--env-var",
&format!(
"user_domain_for_signup={}",
users_configs.user_domain_for_signup
),
]);
newman_command.args([
"--env-var",
&format!("user_password={}", users_configs.user_password),
]);
newman_command.args([
"--env-var",
&format!("wrong_password={}", users_configs.wrong_password),
]);
newman_command.args([
"--delay-request",
format!("{}", &args.delay_request).as_str(),
]);
newman_command.arg("--color").arg("on");
if args.verbose {
newman_command.arg("--verbose");
}
Ok(ReturnArgs {
newman_command,
modified_file_paths: vec![],
collection_path,
})
}
pub fn generate_newman_command_for_connector() -> Result<ReturnArgs> {
let args = Args::parse();
let connector_name = args
.connector_name
.with_context(|| "invalid parameters: connector/module name not found in arguments")?;
let base_url = args.base_url;
let admin_api_key = args.admin_api_key;
let collection_path = get_collection_path(&connector_name);
let collection_dir_path = get_dir_path(&connector_name);
let auth_map = ConnectorAuthenticationMap::new();
let inner_map = auth_map.inner();
/*
Newman runner
Certificate keys are added through secrets in CI, so there's no need to explicitly pass it as arguments.
It can be overridden by explicitly passing certificates as arguments.
If the collection requires certificates (Stripe collection for example) during the merchant connector account create step,
then Stripe's certificates will be passed implicitly (for now).
If any other connector requires certificates to be passed, that has to be passed explicitly for now.
*/
let mut newman_command = Command::new("newman");
newman_command.args(["run", &collection_path]);
newman_command.args(["--env-var", &format!("admin_api_key={admin_api_key}")]);
newman_command.args(["--env-var", &format!("baseUrl={base_url}")]);
let custom_header_exist = check_for_custom_headers(args.custom_headers, &collection_dir_path);
// validation of connector is needed here as a work around to the limitation of the fork of newman that Hyperswitch uses
let (connector_name, modified_collection_file_paths) =
check_connector_for_dynamic_amount(&connector_name);
if let Some(auth_type) = inner_map.get(connector_name) {
match auth_type {
ConnectorAuthType::HeaderKey { api_key } => {
newman_command.args([
"--env-var",
&format!("connector_api_key={}", api_key.peek()),
]);
}
ConnectorAuthType::BodyKey { api_key, key1 } => {
newman_command.args([
"--env-var",
&format!("connector_api_key={}", api_key.peek()),
"--env-var",
&format!("connector_key1={}", key1.peek()),
]);
}
ConnectorAuthType::SignatureKey {
api_key,
key1,
api_secret,
} => {
newman_command.args([
"--env-var",
&format!("connector_api_key={}", api_key.peek()),
"--env-var",
&format!("connector_key1={}", key1.peek()),
"--env-var",
&format!("connector_api_secret={}", api_secret.peek()),
]);
}
ConnectorAuthType::MultiAuthKey {
api_key,
key1,
key2,
api_secret,
} => {
newman_command.args([
"--env-var",
&format!("connector_api_key={}", api_key.peek()),
"--env-var",
&format!("connector_key1={}", key1.peek()),
"--env-var",
&format!("connector_key2={}", key2.peek()),
"--env-var",
&format!("connector_api_secret={}", api_secret.peek()),
]);
}
// Handle other ConnectorAuthType variants
_ => {
eprintln!("Invalid authentication type.");
}
}
} else {
eprintln!("Connector not found.");
}
// Add additional environment variables if present
if let Ok(gateway_merchant_id) = env::var("GATEWAY_MERCHANT_ID") {
newman_command.args([
"--env-var",
&format!("gateway_merchant_id={gateway_merchant_id}"),
]);
}
if let Ok(gpay_certificate) = env::var("GPAY_CERTIFICATE") {
newman_command.args(["--env-var", &format!("certificate={gpay_certificate}")]);
}
if let Ok(gpay_certificate_keys) = env::var("GPAY_CERTIFICATE_KEYS") {
newman_command.args([
"--env-var",
&format!("certificate_keys={gpay_certificate_keys}"),
]);
}
if let Ok(merchant_api_key) = env::var("MERCHANT_API_KEY") {
newman_command.args(["--env-var", &format!("merchant_api_key={merchant_api_key}")]);
}
newman_command.args([
"--delay-request",
format!("{}", &args.delay_request).as_str(),
]);
newman_command.arg("--color").arg("on");
// Add flags for running specific folders
if let Some(folders) = &args.folders {
let folder_names: Vec<String> = folders.split(',').map(|s| s.trim().to_string()).collect();
for folder_name in folder_names {
if !folder_name.contains("QuickStart") {
// This is a quick fix, "QuickStart" is intentional to have merchant account and API keys set up
// This will be replaced by a more robust and efficient account creation or reuse existing old account
newman_command.args(["--folder", "QuickStart"]);
}
newman_command.args(["--folder", &folder_name]);
}
}
if args.verbose {
newman_command.arg("--verbose");
}
Ok(ReturnArgs {
newman_command,
modified_file_paths: vec![modified_collection_file_paths, custom_header_exist],
collection_path,
})
}
pub fn check_for_custom_headers(headers: Option<Vec<String>>, path: &str) -> Option<String> {
if let Some(headers) = &headers {
for header in headers {
if let Some((key, value)) = header.split_once(':') {
let content_to_insert =
format!(r#"pm.request.headers.add({{key: "{key}", value: "{value}"}});"#);
if let Err(err) = insert_content(path, &content_to_insert) {
eprintln!("An error occurred while inserting the custom header: {err}");
}
} else {
eprintln!("Invalid header format: {header}");
}
}
return Some(format!("{path}/event.prerequest.js"));
}
None
}
// If the connector name exists in dynamic_amount_connectors,
// the corresponding collection is modified at runtime to remove double quotes
pub fn check_connector_for_dynamic_amount(connector_name: &str) -> (&str, Option<String>) {
let collection_dir_path = get_dir_path(connector_name);
let dynamic_amount_connectors = ["nmi", "powertranz"];
if dynamic_amount_connectors.contains(&connector_name) {
return remove_quotes_for_integer_values(connector_name).unwrap_or((connector_name, None));
}
/*
If connector name does not exist in dynamic_amount_connectors but we want to run it with custom headers,
since we're running from collections directly, we'll have to export the collection again and it is much simpler.
We could directly inject the custom-headers using regex, but it is not encouraged as it is hard
to determine the place of edit.
*/
export_collection(connector_name, collection_dir_path);
(connector_name, None)
}
/*
Existing issue with the fork of newman is that, it requires you to pass variables like `{{value}}` within
double quotes without which it fails to execute.
For integer values like `amount`, this is a bummer as it flags the value stating it is of type
string and not integer.
Refactoring is done in 2 steps:
- Export the collection to json (although the json will be up-to-date, we export it again for safety)
- Use regex to replace the values which removes double quotes from integer values
Ex: \"{{amount}}\" -> {{amount}}
*/
pub fn remove_quotes_for_integer_values(
connector_name: &str,
) -> Result<(&str, Option<String>), io::Error> {
let collection_path = get_collection_path(connector_name);
let collection_dir_path = get_dir_path(connector_name);
let values_to_replace = [
"amount",
"another_random_number",
"capture_amount",
"random_number",
"refund_amount",
];
export_collection(connector_name, collection_dir_path);
let mut contents = fs::read_to_string(&collection_path)?;
for value_to_replace in values_to_replace {
if let Ok(re) = Regex::new(&format!(
r#"\\"(?P<field>\{{\{{{value_to_replace}\}}\}})\\""#,
)) {
contents = re.replace_all(&contents, "$field").to_string();
} else {
eprintln!("Regex validation failed.");
}
let mut file = OpenOptions::new()
.write(true)
.truncate(true)
.open(&collection_path)?;
file.write_all(contents.as_bytes())?;
}
Ok((connector_name, Some(collection_path)))
}
pub fn export_collection(connector_name: &str, collection_dir_path: String) {
let collection_path = get_collection_path(connector_name);
let mut newman_command = Command::new("newman");
newman_command.args([
"dir-import".to_owned(),
collection_dir_path,
"-o".to_owned(),
collection_path.clone(),
]);
match newman_command.spawn().and_then(|mut child| child.wait()) {
Ok(exit_status) => {
if exit_status.success() {
println!("Conversion of collection from directory structure to json successful!");
} else {
eprintln!("Conversion of collection from directory structure to json failed!");
exit(exit_status.code().unwrap_or(1));
}
}
Err(err) => {
eprintln!("Failed to execute dir-import: {err:?}");
exit(1);
}
}
}
|
crates/test_utils/src/newman_runner.rs
|
test_utils
|
full_file
| null | null | null | 3,345
| null | null | null | null | null | null | null |
// Function: insert_payment_token_reference_record
// File: crates/hyperswitch_domain_models/src/mandates.rs
// Module: hyperswitch_domain_models
// Documentation: Insert a new payment token reference for the given connector_id
pub fn insert_payment_token_reference_record(
&mut self,
connector_id: &common_utils::id_type::MerchantConnectorAccountId,
record: ConnectorTokenReferenceRecord,
)
|
crates/hyperswitch_domain_models/src/mandates.rs
|
hyperswitch_domain_models
|
function_signature
| null | null | null | 86
|
insert_payment_token_reference_record
| null | null | null | null | null | null |
// Struct: PaypalThreeDsParams
// File: crates/hyperswitch_connectors/src/connectors/paypal/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct PaypalThreeDsParams
|
crates/hyperswitch_connectors/src/connectors/paypal/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
PaypalThreeDsParams
| 0
|
[] | 49
| null | null | null | null | null | null | null |
// Struct: GpaymentsAuthenticationRequest
// File: crates/hyperswitch_connectors/src/connectors/gpayments/gpayments_types.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct GpaymentsAuthenticationRequest
|
crates/hyperswitch_connectors/src/connectors/gpayments/gpayments_types.rs
|
hyperswitch_connectors
|
struct_definition
|
GpaymentsAuthenticationRequest
| 0
|
[] | 49
| null | null | null | null | null | null | null |
// Struct: SubscriptionEstimate
// File: crates/hyperswitch_connectors/src/connectors/chargebee/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct SubscriptionEstimate
|
crates/hyperswitch_connectors/src/connectors/chargebee/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
SubscriptionEstimate
| 0
|
[] | 48
| null | null | null | null | null | null | null |
// Function: is_platform_account
// File: crates/hyperswitch_domain_models/src/merchant_account.rs
// Module: hyperswitch_domain_models
// Documentation: Check whether the merchant account is a platform account
pub fn is_platform_account(&self) -> bool
|
crates/hyperswitch_domain_models/src/merchant_account.rs
|
hyperswitch_domain_models
|
function_signature
| null | null | null | 54
|
is_platform_account
| null | null | null | null | null | null |
// Function: get_surcharge_details_redis_hashset_key
// File: crates/router/src/core/payments/types.rs
// Module: router
pub fn get_surcharge_details_redis_hashset_key(surcharge_key: &SurchargeKey) -> String
|
crates/router/src/core/payments/types.rs
|
router
|
function_signature
| null | null | null | 51
|
get_surcharge_details_redis_hashset_key
| null | null | null | null | null | null |
// Function: list_by_profile_id
// File: crates/diesel_models/src/query/merchant_connector_account.rs
// Module: diesel_models
pub fn list_by_profile_id(
conn: &PgPooledConn,
profile_id: &common_utils::id_type::ProfileId,
) -> StorageResult<Vec<Self>>
|
crates/diesel_models/src/query/merchant_connector_account.rs
|
diesel_models
|
function_signature
| null | null | null | 67
|
list_by_profile_id
| null | null | null | null | null | null |
// Function: toggle_success_based_routing
// File: crates/openapi/src/routes/routing.rs
// Module: openapi
pub fn toggle_success_based_routing()
|
crates/openapi/src/routes/routing.rs
|
openapi
|
function_signature
| null | null | null | 33
|
toggle_success_based_routing
| null | null | null | null | null | null |
// File: crates/storage_impl/src/config.rs
// Module: storage_impl
// Public structs: 1
use common_utils::{id_type, DbConnectionParams};
use masking::Secret;
#[derive(Debug, Clone, serde::Deserialize)]
pub struct Database {
pub username: String,
pub password: Secret<String>,
pub host: String,
pub port: u16,
pub dbname: String,
pub pool_size: u32,
pub connection_timeout: u64,
pub queue_strategy: QueueStrategy,
pub min_idle: Option<u32>,
pub max_lifetime: Option<u64>,
}
impl DbConnectionParams for Database {
fn get_username(&self) -> &str {
&self.username
}
fn get_password(&self) -> Secret<String> {
self.password.clone()
}
fn get_host(&self) -> &str {
&self.host
}
fn get_port(&self) -> u16 {
self.port
}
fn get_dbname(&self) -> &str {
&self.dbname
}
}
pub trait TenantConfig: Send + Sync {
fn get_tenant_id(&self) -> &id_type::TenantId;
fn get_schema(&self) -> &str;
fn get_accounts_schema(&self) -> &str;
fn get_redis_key_prefix(&self) -> &str;
fn get_clickhouse_database(&self) -> &str;
}
#[derive(Debug, serde::Deserialize, Clone, Copy, Default)]
#[serde(rename_all = "PascalCase")]
pub enum QueueStrategy {
#[default]
Fifo,
Lifo,
}
impl From<QueueStrategy> for bb8::QueueStrategy {
fn from(value: QueueStrategy) -> Self {
match value {
QueueStrategy::Fifo => Self::Fifo,
QueueStrategy::Lifo => Self::Lifo,
}
}
}
impl Default for Database {
fn default() -> Self {
Self {
username: String::new(),
password: Secret::<String>::default(),
host: "localhost".into(),
port: 5432,
dbname: String::new(),
pool_size: 5,
connection_timeout: 10,
queue_strategy: QueueStrategy::default(),
min_idle: None,
max_lifetime: None,
}
}
}
|
crates/storage_impl/src/config.rs
|
storage_impl
|
full_file
| null | null | null | 505
| null | null | null | null | null | null | null |
// Function: wallet_token
// File: crates/router/src/types/storage/payment_method.rs
// Module: router
pub fn wallet_token(payment_method_id: String) -> Self
|
crates/router/src/types/storage/payment_method.rs
|
router
|
function_signature
| null | null | null | 35
|
wallet_token
| null | null | null | null | null | null |
// Function: delete_profile
// File: crates/router/src/core/admin.rs
// Module: router
pub fn delete_profile(
state: SessionState,
profile_id: id_type::ProfileId,
merchant_id: &id_type::MerchantId,
) -> RouterResponse<bool>
|
crates/router/src/core/admin.rs
|
router
|
function_signature
| null | null | null | 59
|
delete_profile
| null | null | null | null | null | null |
// Struct: ProfileNew
// File: crates/diesel_models/src/business_profile.rs
// Module: diesel_models
// Implementations: 0
pub struct ProfileNew
|
crates/diesel_models/src/business_profile.rs
|
diesel_models
|
struct_definition
|
ProfileNew
| 0
|
[] | 35
| null | null | null | null | null | null | null |
// Function: get_profile_auth_event_metrics
// File: crates/router/src/analytics.rs
// Module: router
// Documentation: Panics if `json_payload` array does not contain one `GetAuthEventMetricRequest` element.
pub fn get_profile_auth_event_metrics(
state: web::Data<AppState>,
req: actix_web::HttpRequest,
json_payload: web::Json<[GetAuthEventMetricRequest; 1]>,
) -> impl Responder
|
crates/router/src/analytics.rs
|
router
|
function_signature
| null | null | null | 98
|
get_profile_auth_event_metrics
| null | null | null | null | null | null |
// Implementation: impl RecoveryDeciderClientConfig
// File: crates/external_services/src/grpc_client/revenue_recovery/recovery_decider_client.rs
// Module: external_services
// Methods: 2 total (2 public)
impl RecoveryDeciderClientConfig
|
crates/external_services/src/grpc_client/revenue_recovery/recovery_decider_client.rs
|
external_services
|
impl_block
| null | null | null | 52
| null |
RecoveryDeciderClientConfig
| null | 2
| 2
| null | null |
// Struct: SilverflowVoidResponse
// File: crates/hyperswitch_connectors/src/connectors/silverflow/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct SilverflowVoidResponse
|
crates/hyperswitch_connectors/src/connectors/silverflow/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
SilverflowVoidResponse
| 0
|
[] | 50
| null | null | null | null | null | null | null |
// Struct: JWTAuthMerchantFromHeader
// File: crates/router/src/services/authentication.rs
// Module: router
// Implementations: 0
pub struct JWTAuthMerchantFromHeader
|
crates/router/src/services/authentication.rs
|
router
|
struct_definition
|
JWTAuthMerchantFromHeader
| 0
|
[] | 38
| null | null | null | null | null | null | null |
// Implementation: impl BillingConnectorInvoiceSyncFlowRouterData
// File: crates/router/src/core/webhooks/recovery_incoming.rs
// Module: router
// Methods: 2 total (0 public)
impl BillingConnectorInvoiceSyncFlowRouterData
|
crates/router/src/core/webhooks/recovery_incoming.rs
|
router
|
impl_block
| null | null | null | 50
| null |
BillingConnectorInvoiceSyncFlowRouterData
| null | 2
| 0
| null | null |
// Function: payouts_list_by_filter_profile
// File: crates/router/src/routes/payouts.rs
// Module: router
pub fn payouts_list_by_filter_profile(
state: web::Data<AppState>,
req: HttpRequest,
json_payload: web::Json<payout_types::PayoutListFilterConstraints>,
) -> HttpResponse
|
crates/router/src/routes/payouts.rs
|
router
|
function_signature
| null | null | null | 68
|
payouts_list_by_filter_profile
| null | null | null | null | null | null |
// Struct: BarclaycardRefundResponse
// File: crates/hyperswitch_connectors/src/connectors/barclaycard/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct BarclaycardRefundResponse
|
crates/hyperswitch_connectors/src/connectors/barclaycard/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
BarclaycardRefundResponse
| 0
|
[] | 55
| null | null | null | null | null | null | null |
// File: crates/hyperswitch_connectors/src/connectors/fiuu.rs
// Module: hyperswitch_connectors
// Public functions: 3
// Public structs: 1
pub mod transformers;
use std::{
any::type_name,
borrow::Cow,
collections::{HashMap, HashSet},
sync::LazyLock,
};
use common_enums::{CaptureMethod, PaymentMethod, PaymentMethodType};
use common_utils::{
crypto::{self, GenerateDigest},
errors::{self as common_errors, CustomResult},
ext_traits::{ByteSliceExt, BytesExt},
request::{Method, Request, RequestBuilder, RequestContent},
types::{AmountConvertor, StringMajorUnit, StringMajorUnitForConnector},
};
use error_stack::ResultExt;
use hyperswitch_domain_models::{
payment_method_data::PaymentMethodData,
router_data::{AccessToken, ErrorResponse, RouterData},
router_flow_types::{
access_token_auth::AccessTokenAuth,
payments::{Authorize, Capture, PSync, PaymentMethodToken, Session, SetupMandate, Void},
refunds::{Execute, RSync},
},
router_request_types::{
AccessTokenRequestData, PaymentMethodTokenizationData, PaymentsAuthorizeData,
PaymentsCancelData, PaymentsCaptureData, PaymentsSessionData, PaymentsSyncData,
RefundsData, SetupMandateRequestData,
},
router_response_types::{
ConnectorInfo, PaymentMethodDetails, PaymentsResponseData, RefundsResponseData,
SupportedPaymentMethods, SupportedPaymentMethodsExt,
},
types::{
PaymentsAuthorizeRouterData, PaymentsCancelRouterData, PaymentsCaptureRouterData,
PaymentsSyncRouterData, RefundSyncRouterData, RefundsRouterData,
},
};
use hyperswitch_interfaces::{
api::{
self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorSpecifications,
ConnectorValidation,
},
configs::Connectors,
errors,
events::connector_api_logs::ConnectorEvent,
types::{self, Response},
webhooks,
};
use masking::{ExposeInterface, PeekInterface, Secret};
use reqwest::multipart::Form;
use serde::{Deserialize, Serialize};
use serde_json::Value;
use transformers::{self as fiuu, ExtraParameters, FiuuWebhooksResponse};
use crate::{
constants::headers,
types::ResponseRouterData,
utils::{self, PaymentMethodDataType},
};
pub fn parse_and_log_keys_in_url_encoded_response<T>(data: &[u8]) {
match std::str::from_utf8(data) {
Ok(query_str) => {
let loggable_keys = [
"status",
"orderid",
"tranID",
"nbcb",
"amount",
"currency",
"paydate",
"channel",
"error_desc",
"error_code",
"extraP",
];
let keys: Vec<(Cow<'_, str>, String)> =
url::form_urlencoded::parse(query_str.as_bytes())
.map(|(key, value)| {
if loggable_keys.contains(&key.to_string().as_str()) {
(key, value.to_string())
} else {
(key, "SECRET".to_string())
}
})
.collect();
router_env::logger::info!("Keys in {} response\n{:?}", type_name::<T>(), keys);
}
Err(err) => {
router_env::logger::error!("Failed to convert bytes to string: {:?}", err);
}
}
}
fn parse_response<T>(data: &[u8]) -> Result<T, errors::ConnectorError>
where
T: for<'de> Deserialize<'de>,
{
let response_str = String::from_utf8(data.to_vec()).map_err(|e| {
router_env::logger::error!("Error in Deserializing Response Data: {:?}", e);
errors::ConnectorError::ResponseDeserializationFailed
})?;
let mut json = serde_json::Map::new();
let mut miscellaneous: HashMap<String, Secret<String>> = HashMap::new();
for line in response_str.lines() {
if let Some((key, value)) = line.split_once('=') {
if key.trim().is_empty() {
router_env::logger::error!("Null or empty key encountered in response.");
continue;
}
if let Some(old_value) = json.insert(key.to_string(), Value::String(value.to_string()))
{
router_env::logger::warn!("Repeated key encountered: {}", key);
miscellaneous.insert(key.to_string(), Secret::new(old_value.to_string()));
}
}
}
if !miscellaneous.is_empty() {
let misc_value = serde_json::to_value(miscellaneous).map_err(|e| {
router_env::logger::error!("Error serializing miscellaneous data: {:?}", e);
errors::ConnectorError::ResponseDeserializationFailed
})?;
json.insert("miscellaneous".to_string(), misc_value);
}
// TODO: Remove this after debugging
let loggable_keys = [
"StatCode",
"StatName",
"TranID",
"ErrorCode",
"ErrorDesc",
"miscellaneous",
];
let keys: Vec<(&str, Value)> = json
.iter()
.map(|(key, value)| {
if loggable_keys.contains(&key.as_str()) {
(key.as_str(), value.to_owned())
} else {
(key.as_str(), Value::String("SECRET".to_string()))
}
})
.collect();
router_env::logger::info!("Keys in response for type {}\n{:?}", type_name::<T>(), keys);
let response: T = serde_json::from_value(Value::Object(json)).map_err(|e| {
router_env::logger::error!("Error in Deserializing Response Data: {:?}", e);
errors::ConnectorError::ResponseDeserializationFailed
})?;
Ok(response)
}
#[derive(Clone)]
pub struct Fiuu {
amount_converter: &'static (dyn AmountConvertor<Output = StringMajorUnit> + Sync),
}
impl Fiuu {
pub fn new() -> &'static Self {
&Self {
amount_converter: &StringMajorUnitForConnector,
}
}
}
impl api::Payment for Fiuu {}
impl api::PaymentSession for Fiuu {}
impl api::ConnectorAccessToken for Fiuu {}
impl api::MandateSetup for Fiuu {}
impl api::PaymentAuthorize for Fiuu {}
impl api::PaymentSync for Fiuu {}
impl api::PaymentCapture for Fiuu {}
impl api::PaymentVoid for Fiuu {}
impl api::Refund for Fiuu {}
impl api::RefundExecute for Fiuu {}
impl api::RefundSync for Fiuu {}
impl api::PaymentToken for Fiuu {}
impl ConnectorIntegration<PaymentMethodToken, PaymentMethodTokenizationData, PaymentsResponseData>
for Fiuu
{
// Not Implemented (R)
}
impl<Flow, Request, Response> ConnectorCommonExt<Flow, Request, Response> for Fiuu
where
Self: ConnectorIntegration<Flow, Request, Response>,
{
fn build_headers(
&self,
_req: &RouterData<Flow, Request, Response>,
_connectors: &Connectors,
) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
let header = vec![(
headers::CONTENT_TYPE.to_string(),
self.get_content_type().to_string().into(),
)];
Ok(header)
}
}
impl ConnectorCommon for Fiuu {
fn id(&self) -> &'static str {
"fiuu"
}
fn get_currency_unit(&self) -> api::CurrencyUnit {
api::CurrencyUnit::Base
}
fn base_url<'a>(&self, connectors: &'a Connectors) -> &'a str {
connectors.fiuu.base_url.as_ref()
}
fn build_error_response(
&self,
res: Response,
event_builder: Option<&mut ConnectorEvent>,
) -> CustomResult<ErrorResponse, errors::ConnectorError> {
let response: fiuu::FiuuErrorResponse = res
.response
.parse_struct("FiuuErrorResponse")
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
event_builder.map(|i| i.set_response_body(&response));
router_env::logger::info!(connector_response=?response);
Ok(ErrorResponse {
status_code: res.status_code,
code: response.error_code.clone(),
message: response.error_desc.clone(),
reason: Some(response.error_desc.clone()),
attempt_status: None,
connector_transaction_id: None,
network_advice_code: None,
network_decline_code: None,
network_error_message: None,
connector_metadata: None,
})
}
}
pub fn build_form_from_struct<T: Serialize>(data: T) -> Result<Form, common_errors::ParsingError> {
let mut form = Form::new();
let serialized = serde_json::to_value(&data).map_err(|e| {
router_env::logger::error!("Error serializing data to JSON value: {:?}", e);
common_errors::ParsingError::EncodeError("json-value")
})?;
let serialized_object = serialized.as_object().ok_or_else(|| {
router_env::logger::error!("Error: Expected JSON object but got something else");
common_errors::ParsingError::EncodeError("Expected object")
})?;
for (key, values) in serialized_object {
let value = match values {
Value::String(s) => s.clone(),
Value::Number(n) => n.to_string(),
Value::Bool(b) => b.to_string(),
Value::Array(_) | Value::Object(_) | Value::Null => {
router_env::logger::error!(serialization_error =? "Form Construction Failed.");
"".to_string()
}
};
form = form.text(key.clone(), value.clone());
}
Ok(form)
}
impl ConnectorValidation for Fiuu {
fn validate_mandate_payment(
&self,
pm_type: Option<PaymentMethodType>,
pm_data: PaymentMethodData,
) -> CustomResult<(), errors::ConnectorError> {
let mandate_supported_pmd: HashSet<PaymentMethodDataType> =
HashSet::from([PaymentMethodDataType::Card]);
utils::is_mandate_supported(pm_data, pm_type, mandate_supported_pmd, self.id())
}
}
impl ConnectorIntegration<Session, PaymentsSessionData, PaymentsResponseData> for Fiuu {
//TODO: implement sessions flow
}
impl ConnectorIntegration<AccessTokenAuth, AccessTokenRequestData, AccessToken> for Fiuu {}
impl ConnectorIntegration<SetupMandate, SetupMandateRequestData, PaymentsResponseData> for Fiuu {}
impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData> for Fiuu {
fn get_headers(
&self,
req: &PaymentsAuthorizeRouterData,
connectors: &Connectors,
) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
self.build_headers(req, connectors)
}
fn get_url(
&self,
req: &PaymentsAuthorizeRouterData,
connectors: &Connectors,
) -> CustomResult<String, errors::ConnectorError> {
let optional_is_mit_flow = req.request.off_session;
let optional_is_nti_flow = req
.request
.mandate_id
.as_ref()
.map(|mandate_id| mandate_id.is_network_transaction_id_flow());
let url = match (optional_is_mit_flow, optional_is_nti_flow) {
(Some(true), Some(false)) => format!(
"{}/RMS/API/Recurring/input_v7.php",
self.base_url(connectors)
),
_ => {
format!(
"{}RMS/API/Direct/1.4.0/index.php",
self.base_url(connectors)
)
}
};
Ok(url)
}
fn get_request_body(
&self,
req: &PaymentsAuthorizeRouterData,
_connectors: &Connectors,
) -> CustomResult<RequestContent, errors::ConnectorError> {
let amount = utils::convert_amount(
self.amount_converter,
req.request.minor_amount,
req.request.currency,
)?;
let connector_router_data = fiuu::FiuuRouterData::from((amount, req));
let optional_is_mit_flow = req.request.off_session;
let optional_is_nti_flow = req
.request
.mandate_id
.as_ref()
.map(|mandate_id| mandate_id.is_network_transaction_id_flow());
let connector_req = match (optional_is_mit_flow, optional_is_nti_flow) {
(Some(true), Some(false)) => {
let recurring_request = fiuu::FiuuMandateRequest::try_from(&connector_router_data)?;
build_form_from_struct(recurring_request)
.change_context(errors::ConnectorError::ParsingFailed)?
}
_ => {
let payment_request = fiuu::FiuuPaymentRequest::try_from(&connector_router_data)?;
build_form_from_struct(payment_request)
.change_context(errors::ConnectorError::ParsingFailed)?
}
};
Ok(RequestContent::FormData(connector_req))
}
fn build_request(
&self,
req: &PaymentsAuthorizeRouterData,
connectors: &Connectors,
) -> CustomResult<Option<Request>, errors::ConnectorError> {
Ok(Some(
RequestBuilder::new()
.method(Method::Post)
.url(&types::PaymentsAuthorizeType::get_url(
self, req, connectors,
)?)
.attach_default_headers()
.set_body(types::PaymentsAuthorizeType::get_request_body(
self, req, connectors,
)?)
.build(),
))
}
fn handle_response(
&self,
data: &PaymentsAuthorizeRouterData,
event_builder: Option<&mut ConnectorEvent>,
res: Response,
) -> CustomResult<PaymentsAuthorizeRouterData, errors::ConnectorError> {
let response: fiuu::FiuuPaymentsResponse = res
.response
.parse_struct("Fiuu FiuuPaymentsResponse")
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
event_builder.map(|i| i.set_response_body(&response));
router_env::logger::info!(connector_response=?response);
RouterData::try_from(ResponseRouterData {
response,
data: data.clone(),
http_code: res.status_code,
})
}
fn get_error_response(
&self,
res: Response,
event_builder: Option<&mut ConnectorEvent>,
) -> CustomResult<ErrorResponse, errors::ConnectorError> {
self.build_error_response(res, event_builder)
}
}
impl ConnectorIntegration<PSync, PaymentsSyncData, PaymentsResponseData> for Fiuu {
fn get_headers(
&self,
req: &PaymentsSyncRouterData,
connectors: &Connectors,
) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
self.build_headers(req, connectors)
}
fn get_url(
&self,
_req: &PaymentsSyncRouterData,
connectors: &Connectors,
) -> CustomResult<String, errors::ConnectorError> {
let base_url = connectors.fiuu.secondary_base_url.clone();
Ok(format!("{base_url}RMS/API/gate-query/index.php"))
}
fn get_request_body(
&self,
req: &PaymentsSyncRouterData,
_connectors: &Connectors,
) -> CustomResult<RequestContent, errors::ConnectorError> {
let sync_request = fiuu::FiuuPaymentSyncRequest::try_from(req)?;
let connector_req = build_form_from_struct(sync_request)
.change_context(errors::ConnectorError::ParsingFailed)?;
Ok(RequestContent::FormData(connector_req))
}
fn build_request(
&self,
req: &PaymentsSyncRouterData,
connectors: &Connectors,
) -> CustomResult<Option<Request>, errors::ConnectorError> {
Ok(Some(
RequestBuilder::new()
.method(Method::Post)
.url(&types::PaymentsSyncType::get_url(self, req, connectors)?)
.set_body(types::PaymentsSyncType::get_request_body(
self, req, connectors,
)?)
.attach_default_headers()
.build(),
))
}
fn handle_response(
&self,
data: &PaymentsSyncRouterData,
event_builder: Option<&mut ConnectorEvent>,
res: Response,
) -> CustomResult<PaymentsSyncRouterData, errors::ConnectorError> {
match res.headers {
Some(headers) => {
let content_header = utils::get_http_header("Content-type", &headers)
.attach_printable("Missing content type in headers")
.change_context(errors::ConnectorError::ResponseHandlingFailed)?;
let response: fiuu::FiuuPaymentResponse = if content_header
== "text/plain;charset=UTF-8"
{
parse_response(&res.response)
} else {
Err(errors::ConnectorError::ResponseDeserializationFailed)
.attach_printable(format!("Expected content type to be text/plain;charset=UTF-8 , but received different content type as {content_header} in response"))?
}?;
event_builder.map(|i| i.set_response_body(&response));
router_env::logger::info!(connector_response=?response);
RouterData::try_from(ResponseRouterData {
response,
data: data.clone(),
http_code: res.status_code,
})
.change_context(errors::ConnectorError::ResponseHandlingFailed)
}
None => {
// We don't get headers for payment webhook response handling
let response: fiuu::FiuuPaymentResponse = res
.response
.parse_struct("fiuu::FiuuPaymentResponse")
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
event_builder.map(|i| i.set_response_body(&response));
router_env::logger::info!(connector_response=?response);
RouterData::try_from(ResponseRouterData {
response,
data: data.clone(),
http_code: res.status_code,
})
.change_context(errors::ConnectorError::ResponseHandlingFailed)
}
}
}
fn get_error_response(
&self,
res: Response,
event_builder: Option<&mut ConnectorEvent>,
) -> CustomResult<ErrorResponse, errors::ConnectorError> {
self.build_error_response(res, event_builder)
}
}
impl ConnectorIntegration<Capture, PaymentsCaptureData, PaymentsResponseData> for Fiuu {
fn get_url(
&self,
_req: &PaymentsCaptureRouterData,
connectors: &Connectors,
) -> CustomResult<String, errors::ConnectorError> {
let base_url = connectors.fiuu.secondary_base_url.clone();
Ok(format!("{base_url}RMS/API/capstxn/index.php"))
}
fn get_request_body(
&self,
req: &PaymentsCaptureRouterData,
_connectors: &Connectors,
) -> CustomResult<RequestContent, errors::ConnectorError> {
let amount = utils::convert_amount(
self.amount_converter,
req.request.minor_amount_to_capture,
req.request.currency,
)?;
let connector_router_data = fiuu::FiuuRouterData::from((amount, req));
let connector_req = build_form_from_struct(fiuu::PaymentCaptureRequest::try_from(
&connector_router_data,
)?)
.change_context(errors::ConnectorError::ParsingFailed)?;
Ok(RequestContent::FormData(connector_req))
}
fn build_request(
&self,
req: &PaymentsCaptureRouterData,
connectors: &Connectors,
) -> CustomResult<Option<Request>, errors::ConnectorError> {
Ok(Some(
RequestBuilder::new()
.method(Method::Post)
.url(&types::PaymentsCaptureType::get_url(self, req, connectors)?)
.attach_default_headers()
.set_body(types::PaymentsCaptureType::get_request_body(
self, req, connectors,
)?)
.build(),
))
}
fn handle_response(
&self,
data: &PaymentsCaptureRouterData,
event_builder: Option<&mut ConnectorEvent>,
res: Response,
) -> CustomResult<PaymentsCaptureRouterData, errors::ConnectorError> {
let response: fiuu::PaymentCaptureResponse = res
.response
.parse_struct("Fiuu PaymentsCaptureResponse")
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
event_builder.map(|i| i.set_response_body(&response));
router_env::logger::info!(connector_response=?response);
RouterData::try_from(ResponseRouterData {
response,
data: data.clone(),
http_code: res.status_code,
})
}
fn get_error_response(
&self,
res: Response,
event_builder: Option<&mut ConnectorEvent>,
) -> CustomResult<ErrorResponse, errors::ConnectorError> {
self.build_error_response(res, event_builder)
}
}
impl ConnectorIntegration<Void, PaymentsCancelData, PaymentsResponseData> for Fiuu {
fn get_url(
&self,
_req: &PaymentsCancelRouterData,
connectors: &Connectors,
) -> CustomResult<String, errors::ConnectorError> {
let base_url = connectors.fiuu.secondary_base_url.clone();
Ok(format!("{base_url}RMS/API/refundAPI/refund.php"))
}
fn get_request_body(
&self,
req: &PaymentsCancelRouterData,
_connectors: &Connectors,
) -> CustomResult<RequestContent, errors::ConnectorError> {
let connector_req = build_form_from_struct(fiuu::FiuuPaymentCancelRequest::try_from(req)?)
.change_context(errors::ConnectorError::ParsingFailed)?;
Ok(RequestContent::FormData(connector_req))
}
fn build_request(
&self,
req: &PaymentsCancelRouterData,
connectors: &Connectors,
) -> CustomResult<Option<Request>, errors::ConnectorError> {
let request = Some(
RequestBuilder::new()
.method(Method::Post)
.url(&types::PaymentsVoidType::get_url(self, req, connectors)?)
.attach_default_headers()
.set_body(types::PaymentsVoidType::get_request_body(
self, req, connectors,
)?)
.build(),
);
Ok(request)
}
fn handle_response(
&self,
data: &PaymentsCancelRouterData,
event_builder: Option<&mut ConnectorEvent>,
res: Response,
) -> CustomResult<PaymentsCancelRouterData, errors::ConnectorError> {
let response: fiuu::FiuuPaymentCancelResponse = parse_response(&res.response)?;
event_builder.map(|i| i.set_response_body(&response));
router_env::logger::info!(connector_response=?response);
RouterData::try_from(ResponseRouterData {
response,
data: data.clone(),
http_code: res.status_code,
})
.change_context(errors::ConnectorError::ResponseHandlingFailed)
}
fn get_error_response(
&self,
res: Response,
event_builder: Option<&mut ConnectorEvent>,
) -> CustomResult<ErrorResponse, errors::ConnectorError> {
self.build_error_response(res, event_builder)
}
}
impl ConnectorIntegration<Execute, RefundsData, RefundsResponseData> for Fiuu {
fn get_url(
&self,
_req: &RefundsRouterData<Execute>,
connectors: &Connectors,
) -> CustomResult<String, errors::ConnectorError> {
let base_url = connectors.fiuu.secondary_base_url.clone();
Ok(format!("{base_url}RMS/API/refundAPI/index.php"))
}
fn get_request_body(
&self,
req: &RefundsRouterData<Execute>,
_connectors: &Connectors,
) -> CustomResult<RequestContent, errors::ConnectorError> {
let refund_amount = utils::convert_amount(
self.amount_converter,
req.request.minor_refund_amount,
req.request.currency,
)?;
let connector_router_data = fiuu::FiuuRouterData::from((refund_amount, req));
let connector_req =
build_form_from_struct(fiuu::FiuuRefundRequest::try_from(&connector_router_data)?)
.change_context(errors::ConnectorError::ParsingFailed)?;
Ok(RequestContent::FormData(connector_req))
}
fn build_request(
&self,
req: &RefundsRouterData<Execute>,
connectors: &Connectors,
) -> CustomResult<Option<Request>, errors::ConnectorError> {
let request = RequestBuilder::new()
.method(Method::Post)
.url(&types::RefundExecuteType::get_url(self, req, connectors)?)
.attach_default_headers()
.set_body(types::RefundExecuteType::get_request_body(
self, req, connectors,
)?)
.build();
Ok(Some(request))
}
fn handle_response(
&self,
data: &RefundsRouterData<Execute>,
event_builder: Option<&mut ConnectorEvent>,
res: Response,
) -> CustomResult<RefundsRouterData<Execute>, errors::ConnectorError> {
let response: fiuu::FiuuRefundResponse = res
.response
.parse_struct("fiuu FiuuRefundResponse")
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
event_builder.map(|i| i.set_response_body(&response));
router_env::logger::info!(connector_response=?response);
RouterData::try_from(ResponseRouterData {
response,
data: data.clone(),
http_code: res.status_code,
})
}
fn get_error_response(
&self,
res: Response,
event_builder: Option<&mut ConnectorEvent>,
) -> CustomResult<ErrorResponse, errors::ConnectorError> {
self.build_error_response(res, event_builder)
}
}
impl ConnectorIntegration<RSync, RefundsData, RefundsResponseData> for Fiuu {
fn get_url(
&self,
_req: &RefundSyncRouterData,
connectors: &Connectors,
) -> CustomResult<String, errors::ConnectorError> {
let base_url = connectors.fiuu.secondary_base_url.clone();
Ok(format!("{base_url}RMS/API/refundAPI/q_by_txn.php"))
}
fn get_request_body(
&self,
req: &RefundSyncRouterData,
_connectors: &Connectors,
) -> CustomResult<RequestContent, errors::ConnectorError> {
let connector_req = build_form_from_struct(fiuu::FiuuRefundSyncRequest::try_from(req)?)
.change_context(errors::ConnectorError::ParsingFailed)?;
Ok(RequestContent::FormData(connector_req))
}
fn build_request(
&self,
req: &RefundSyncRouterData,
connectors: &Connectors,
) -> CustomResult<Option<Request>, errors::ConnectorError> {
Ok(Some(
RequestBuilder::new()
.method(Method::Post)
.url(&types::RefundSyncType::get_url(self, req, connectors)?)
.attach_default_headers()
.set_body(types::RefundSyncType::get_request_body(
self, req, connectors,
)?)
.build(),
))
}
fn handle_response(
&self,
data: &RefundSyncRouterData,
event_builder: Option<&mut ConnectorEvent>,
res: Response,
) -> CustomResult<RefundSyncRouterData, errors::ConnectorError> {
let response: fiuu::FiuuRefundSyncResponse = res
.response
.parse_struct("fiuu FiuuRefundSyncResponse")
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
event_builder.map(|i| i.set_response_body(&response));
router_env::logger::info!(connector_response=?response);
RouterData::try_from(ResponseRouterData {
response,
data: data.clone(),
http_code: res.status_code,
})
}
fn get_error_response(
&self,
res: Response,
event_builder: Option<&mut ConnectorEvent>,
) -> CustomResult<ErrorResponse, errors::ConnectorError> {
self.build_error_response(res, event_builder)
}
}
#[async_trait::async_trait]
impl webhooks::IncomingWebhook for Fiuu {
fn get_webhook_source_verification_algorithm(
&self,
_request: &webhooks::IncomingWebhookRequestDetails<'_>,
) -> CustomResult<Box<dyn crypto::VerifySignature + Send>, errors::ConnectorError> {
Ok(Box::new(crypto::Md5))
}
fn get_webhook_source_verification_signature(
&self,
request: &webhooks::IncomingWebhookRequestDetails<'_>,
_connector_webhook_secrets: &api_models::webhooks::ConnectorWebhookSecrets,
) -> CustomResult<Vec<u8>, errors::ConnectorError> {
let header = utils::get_header_key_value("content-type", request.headers)?;
let resource: FiuuWebhooksResponse = if header == "application/x-www-form-urlencoded" {
parse_and_log_keys_in_url_encoded_response::<FiuuWebhooksResponse>(request.body);
serde_urlencoded::from_bytes::<FiuuWebhooksResponse>(request.body)
.change_context(errors::ConnectorError::WebhookSourceVerificationFailed)?
} else {
request
.body
.parse_struct("fiuu::FiuuWebhooksResponse")
.change_context(errors::ConnectorError::WebhookSourceVerificationFailed)?
};
let signature = match resource {
FiuuWebhooksResponse::FiuuWebhookPaymentResponse(webhooks_payment_response) => {
webhooks_payment_response.skey
}
FiuuWebhooksResponse::FiuuWebhookRefundResponse(webhooks_refunds_response) => {
webhooks_refunds_response.signature
}
};
hex::decode(signature.expose())
.change_context(errors::ConnectorError::WebhookVerificationSecretInvalid)
}
fn get_webhook_source_verification_message(
&self,
request: &webhooks::IncomingWebhookRequestDetails<'_>,
_merchant_id: &common_utils::id_type::MerchantId,
connector_webhook_secrets: &api_models::webhooks::ConnectorWebhookSecrets,
) -> CustomResult<Vec<u8>, errors::ConnectorError> {
let header = utils::get_header_key_value("content-type", request.headers)?;
let resource: FiuuWebhooksResponse = if header == "application/x-www-form-urlencoded" {
parse_and_log_keys_in_url_encoded_response::<FiuuWebhooksResponse>(request.body);
serde_urlencoded::from_bytes::<FiuuWebhooksResponse>(request.body)
.change_context(errors::ConnectorError::WebhookSourceVerificationFailed)?
} else {
request
.body
.parse_struct("fiuu::FiuuWebhooksResponse")
.change_context(errors::ConnectorError::WebhookSourceVerificationFailed)?
};
let verification_message = match resource {
FiuuWebhooksResponse::FiuuWebhookPaymentResponse(webhooks_payment_response) => {
let key0 = format!(
"{}{}{}{}{}{}",
webhooks_payment_response.tran_id,
webhooks_payment_response.order_id,
webhooks_payment_response.status,
webhooks_payment_response.domain.clone().peek(),
webhooks_payment_response.amount.get_amount_as_string(),
webhooks_payment_response.currency
);
let md5_key0 = hex::encode(
crypto::Md5
.generate_digest(key0.as_bytes())
.change_context(errors::ConnectorError::RequestEncodingFailed)?,
);
let key1 = format!(
"{}{}{}{}{}",
webhooks_payment_response.paydate,
webhooks_payment_response.domain.peek(),
md5_key0,
webhooks_payment_response
.appcode
.map_or("".to_string(), |appcode| appcode.expose()),
String::from_utf8_lossy(&connector_webhook_secrets.secret)
);
key1
}
FiuuWebhooksResponse::FiuuWebhookRefundResponse(webhooks_refunds_response) => {
format!(
"{}{}{}{}{}{}{}{}",
webhooks_refunds_response.refund_type,
webhooks_refunds_response.merchant_id.peek(),
webhooks_refunds_response.ref_id,
webhooks_refunds_response.refund_id,
webhooks_refunds_response.txn_id,
webhooks_refunds_response.amount.get_amount_as_string(),
webhooks_refunds_response.status,
String::from_utf8_lossy(&connector_webhook_secrets.secret)
)
}
};
Ok(verification_message.as_bytes().to_vec())
}
fn get_webhook_object_reference_id(
&self,
request: &webhooks::IncomingWebhookRequestDetails<'_>,
) -> CustomResult<api_models::webhooks::ObjectReferenceId, errors::ConnectorError> {
let header = utils::get_header_key_value("content-type", request.headers)?;
let resource: FiuuWebhooksResponse = if header == "application/x-www-form-urlencoded" {
parse_and_log_keys_in_url_encoded_response::<FiuuWebhooksResponse>(request.body);
serde_urlencoded::from_bytes::<FiuuWebhooksResponse>(request.body)
.change_context(errors::ConnectorError::WebhookReferenceIdNotFound)?
} else {
request
.body
.parse_struct("fiuu::FiuuWebhooksResponse")
.change_context(errors::ConnectorError::WebhookReferenceIdNotFound)?
};
let resource_id = match resource {
FiuuWebhooksResponse::FiuuWebhookPaymentResponse(webhooks_payment_response) => {
api_models::webhooks::ObjectReferenceId::PaymentId(
api_models::payments::PaymentIdType::PaymentAttemptId(
webhooks_payment_response.order_id,
),
)
}
FiuuWebhooksResponse::FiuuWebhookRefundResponse(webhooks_refunds_response) => {
api_models::webhooks::ObjectReferenceId::RefundId(
api_models::webhooks::RefundIdType::ConnectorRefundId(
webhooks_refunds_response.refund_id,
),
)
}
};
Ok(resource_id)
}
fn get_webhook_event_type(
&self,
request: &webhooks::IncomingWebhookRequestDetails<'_>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
let header = utils::get_header_key_value("content-type", request.headers)?;
let resource: FiuuWebhooksResponse = if header == "application/x-www-form-urlencoded" {
parse_and_log_keys_in_url_encoded_response::<FiuuWebhooksResponse>(request.body);
serde_urlencoded::from_bytes::<FiuuWebhooksResponse>(request.body)
.change_context(errors::ConnectorError::WebhookEventTypeNotFound)?
} else {
request
.body
.parse_struct("fiuu::FiuuWebhooksResponse")
.change_context(errors::ConnectorError::WebhookEventTypeNotFound)?
};
match resource {
FiuuWebhooksResponse::FiuuWebhookPaymentResponse(webhooks_payment_response) => Ok(
api_models::webhooks::IncomingWebhookEvent::from(webhooks_payment_response.status),
),
FiuuWebhooksResponse::FiuuWebhookRefundResponse(webhooks_refunds_response) => Ok(
api_models::webhooks::IncomingWebhookEvent::from(webhooks_refunds_response.status),
),
}
}
fn get_webhook_resource_object(
&self,
request: &webhooks::IncomingWebhookRequestDetails<'_>,
) -> CustomResult<Box<dyn masking::ErasedMaskSerialize>, errors::ConnectorError> {
let header = utils::get_header_key_value("content-type", request.headers)?;
let payload: FiuuWebhooksResponse = if header == "application/x-www-form-urlencoded" {
parse_and_log_keys_in_url_encoded_response::<FiuuWebhooksResponse>(request.body);
serde_urlencoded::from_bytes::<FiuuWebhooksResponse>(request.body)
.change_context(errors::ConnectorError::WebhookResourceObjectNotFound)?
} else {
request
.body
.parse_struct("fiuu::FiuuWebhooksResponse")
.change_context(errors::ConnectorError::WebhookResourceObjectNotFound)?
};
match payload.clone() {
FiuuWebhooksResponse::FiuuWebhookPaymentResponse(webhook_payment_response) => Ok(
Box::new(fiuu::FiuuPaymentResponse::FiuuWebhooksPaymentResponse(
webhook_payment_response,
)),
),
FiuuWebhooksResponse::FiuuWebhookRefundResponse(webhook_refund_response) => {
Ok(Box::new(fiuu::FiuuRefundSyncResponse::Webhook(
webhook_refund_response,
)))
}
}
}
fn get_mandate_details(
&self,
request: &webhooks::IncomingWebhookRequestDetails<'_>,
) -> CustomResult<
Option<hyperswitch_domain_models::router_flow_types::ConnectorMandateDetails>,
errors::ConnectorError,
> {
parse_and_log_keys_in_url_encoded_response::<transformers::FiuuWebhooksPaymentResponse>(
request.body,
);
let webhook_payment_response: transformers::FiuuWebhooksPaymentResponse =
|
crates/hyperswitch_connectors/src/connectors/fiuu.rs#chunk0
|
hyperswitch_connectors
|
chunk
| null | null | null | 8,171
| null | null | null | null | null | null | null |
// Struct: MonerisCard
// File: crates/hyperswitch_connectors/src/connectors/moneris/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct MonerisCard
|
crates/hyperswitch_connectors/src/connectors/moneris/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
MonerisCard
| 0
|
[] | 51
| null | null | null | null | null | null | null |
// Function: apply_changeset
// File: crates/diesel_models/src/payment_method.rs
// Module: diesel_models
pub fn apply_changeset(self, source: PaymentMethod) -> PaymentMethod
|
crates/diesel_models/src/payment_method.rs
|
diesel_models
|
function_signature
| null | null | null | 40
|
apply_changeset
| null | null | null | null | null | null |
// Struct: ConfirmIntentResponseUpdate
// File: crates/hyperswitch_domain_models/src/payments/payment_attempt.rs
// Module: hyperswitch_domain_models
// Implementations: 0
pub struct ConfirmIntentResponseUpdate
|
crates/hyperswitch_domain_models/src/payments/payment_attempt.rs
|
hyperswitch_domain_models
|
struct_definition
|
ConfirmIntentResponseUpdate
| 0
|
[] | 46
| null | null | null | null | null | null | null |
// Implementation: impl Responder
// File: crates/router/src/analytics.rs
// Module: router
// Methods: 0 total (0 public)
impl Responder
|
crates/router/src/analytics.rs
|
router
|
impl_block
| null | null | null | 35
| null |
Responder
| null | 0
| 0
| null | null |
// Function: refund_retrieve_core_with_refund_id
// File: crates/router/src/core/refunds.rs
// Module: router
pub fn refund_retrieve_core_with_refund_id(
state: SessionState,
merchant_context: domain::MerchantContext,
profile_id: Option<common_utils::id_type::ProfileId>,
request: refunds::RefundsRetrieveRequest,
) -> RouterResult<diesel_refund::Refund>
|
crates/router/src/core/refunds.rs
|
router
|
function_signature
| null | null | null | 91
|
refund_retrieve_core_with_refund_id
| null | null | null | null | null | null |
// Implementation: impl api::UasAuthenticationV2 for for Recurly
// File: crates/hyperswitch_connectors/src/connectors/recurly.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::UasAuthenticationV2 for for Recurly
|
crates/hyperswitch_connectors/src/connectors/recurly.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 66
| null |
Recurly
|
api::UasAuthenticationV2 for
| 0
| 0
| null | null |
// Struct: NovalnetSyncTransaction
// File: crates/hyperswitch_connectors/src/connectors/novalnet/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct NovalnetSyncTransaction
|
crates/hyperswitch_connectors/src/connectors/novalnet/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
NovalnetSyncTransaction
| 0
|
[] | 52
| null | null | null | null | null | null | null |
// Struct: RedirectionAuthResponse
// File: crates/hyperswitch_connectors/src/connectors/paybox/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct RedirectionAuthResponse
|
crates/hyperswitch_connectors/src/connectors/paybox/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
RedirectionAuthResponse
| 0
|
[] | 49
| null | null | null | null | null | null | null |
// Function: from_storage
// File: crates/router/src/services/kafka/authentication.rs
// Module: router
pub fn from_storage(authentication: &'a Authentication) -> Self
|
crates/router/src/services/kafka/authentication.rs
|
router
|
function_signature
| null | null | null | 36
|
from_storage
| null | null | null | null | null | null |
// File: crates/router/tests/connectors/mifinity.rs
// Module: router
use masking::Secret;
use router::types::{self, domain, storage::enums};
use test_utils::connector_auth;
use crate::utils::{self, ConnectorActions};
#[derive(Clone, Copy)]
struct MifinityTest;
impl ConnectorActions for MifinityTest {}
impl utils::Connector for MifinityTest {
fn get_data(&self) -> types::api::ConnectorData {
use router::connector::Mifinity;
utils::construct_connector_data_old(
Box::new(Mifinity::new()),
types::Connector::Mifinity,
types::api::GetToken::Connector,
None,
)
}
fn get_auth_token(&self) -> types::ConnectorAuthType {
utils::to_connector_auth_type(
connector_auth::ConnectorAuthentication::new()
.mifinity
.expect("Missing connector authentication configuration")
.into(),
)
}
fn get_name(&self) -> String {
"mifinity".to_string()
}
}
static CONNECTOR: MifinityTest = MifinityTest {};
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: domain::PaymentMethodData::Card(domain::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: domain::PaymentMethodData::Card(domain::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: domain::PaymentMethodData::Card(domain::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/mifinity.rs
|
router
|
full_file
| null | null | null | 2,941
| null | null | null | null | null | null | null |
// Function: get_total_amount
// File: crates/hyperswitch_domain_models/src/payments/payment_attempt.rs
// Module: hyperswitch_domain_models
pub fn get_total_amount(&self) -> MinorUnit
|
crates/hyperswitch_domain_models/src/payments/payment_attempt.rs
|
hyperswitch_domain_models
|
function_signature
| null | null | null | 43
|
get_total_amount
| null | null | null | null | null | null |
// Implementation: impl ForexMetric for for PaymentMetrics
// File: crates/api_models/src/analytics/payments.rs
// Module: api_models
// Methods: 1 total (0 public)
impl ForexMetric for for PaymentMetrics
|
crates/api_models/src/analytics/payments.rs
|
api_models
|
impl_block
| null | null | null | 47
| null |
PaymentMetrics
|
ForexMetric for
| 1
| 0
| null | null |
// Struct: RefundResponse
// File: crates/hyperswitch_connectors/src/connectors/gigadat/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct RefundResponse
|
crates/hyperswitch_connectors/src/connectors/gigadat/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
RefundResponse
| 0
|
[] | 49
| null | null | null | null | null | null | null |
// Function: get_password
// File: crates/router/src/types/domain/user.rs
// Module: router
pub fn get_password(&self) -> Option<UserPassword>
|
crates/router/src/types/domain/user.rs
|
router
|
function_signature
| null | null | null | 34
|
get_password
| null | null | null | null | null | null |
// Struct: TokenizationUpdateInternal
// File: crates/diesel_models/src/tokenization.rs
// Module: diesel_models
// Implementations: 0
pub struct TokenizationUpdateInternal
|
crates/diesel_models/src/tokenization.rs
|
diesel_models
|
struct_definition
|
TokenizationUpdateInternal
| 0
|
[] | 39
| null | null | null | null | null | null | null |
// File: crates/api_models/src/payments/additional_info.rs
// Module: api_models
// Public structs: 13
use common_utils::new_type::{
MaskedBankAccount, MaskedIban, MaskedRoutingNumber, MaskedSortCode, MaskedUpiVpaId,
};
use masking::Secret;
use utoipa::ToSchema;
use crate::enums as api_enums;
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
#[serde(rename_all = "snake_case")]
pub enum BankDebitAdditionalData {
Ach(Box<AchBankDebitAdditionalData>),
Bacs(Box<BacsBankDebitAdditionalData>),
Becs(Box<BecsBankDebitAdditionalData>),
Sepa(Box<SepaBankDebitAdditionalData>),
}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct AchBankDebitAdditionalData {
/// Partially masked account number for ach bank debit payment
#[schema(value_type = String, example = "0001****3456")]
pub account_number: MaskedBankAccount,
/// Partially masked routing number for ach bank debit payment
#[schema(value_type = String, example = "110***000")]
pub routing_number: MaskedRoutingNumber,
/// Card holder's name
#[schema(value_type = Option<String>, example = "John Doe")]
pub card_holder_name: Option<Secret<String>>,
/// Bank account's owner name
#[schema(value_type = Option<String>, example = "John Doe")]
pub bank_account_holder_name: Option<Secret<String>>,
/// Name of the bank
#[schema(value_type = Option<BankNames>, example = "ach")]
pub bank_name: Option<common_enums::BankNames>,
/// Bank account type
#[schema(value_type = Option<BankType>, example = "checking")]
pub bank_type: Option<common_enums::BankType>,
/// Bank holder entity type
#[schema(value_type = Option<BankHolderType>, example = "personal")]
pub bank_holder_type: Option<common_enums::BankHolderType>,
}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct BacsBankDebitAdditionalData {
/// Partially masked account number for Bacs payment method
#[schema(value_type = String, example = "0001****3456")]
pub account_number: MaskedBankAccount,
/// Partially masked sort code for Bacs payment method
#[schema(value_type = String, example = "108800")]
pub sort_code: MaskedSortCode,
/// Bank account's owner name
#[schema(value_type = Option<String>, example = "John Doe")]
pub bank_account_holder_name: Option<Secret<String>>,
}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct BecsBankDebitAdditionalData {
/// Partially masked account number for Becs payment method
#[schema(value_type = String, example = "0001****3456")]
pub account_number: MaskedBankAccount,
/// Bank-State-Branch (bsb) number
#[schema(value_type = String, example = "000000")]
pub bsb_number: Secret<String>,
/// Bank account's owner name
#[schema(value_type = Option<String>, example = "John Doe")]
pub bank_account_holder_name: Option<Secret<String>>,
}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct SepaBankDebitAdditionalData {
/// Partially masked international bank account number (iban) for SEPA
#[schema(value_type = String, example = "DE8937******013000")]
pub iban: MaskedIban,
/// Bank account's owner name
#[schema(value_type = Option<String>, example = "John Doe")]
pub bank_account_holder_name: Option<Secret<String>>,
}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
pub enum BankRedirectDetails {
BancontactCard(Box<BancontactBankRedirectAdditionalData>),
Blik(Box<BlikBankRedirectAdditionalData>),
Giropay(Box<GiropayBankRedirectAdditionalData>),
}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct BancontactBankRedirectAdditionalData {
/// Last 4 digits of the card number
#[schema(value_type = Option<String>, example = "4242")]
pub last4: Option<String>,
/// The card's expiry month
#[schema(value_type = Option<String>, example = "12")]
pub card_exp_month: Option<Secret<String>>,
/// The card's expiry year
#[schema(value_type = Option<String>, example = "24")]
pub card_exp_year: Option<Secret<String>>,
/// The card holder's name
#[schema(value_type = Option<String>, example = "John Test")]
pub card_holder_name: Option<Secret<String>>,
}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct BlikBankRedirectAdditionalData {
#[schema(value_type = Option<String>, example = "3GD9MO")]
pub blik_code: Option<String>,
}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct GiropayBankRedirectAdditionalData {
#[schema(value_type = Option<String>)]
/// Masked bank account bic code
pub bic: Option<MaskedSortCode>,
/// Partially masked international bank account number (iban) for SEPA
#[schema(value_type = Option<String>)]
pub iban: Option<MaskedIban>,
/// Country for bank payment
#[schema(value_type = Option<CountryAlpha2>, example = "US")]
pub country: Option<api_enums::CountryAlpha2>,
}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
#[serde(rename_all = "snake_case")]
pub enum BankTransferAdditionalData {
Ach {},
Sepa {},
Bacs {},
Multibanco {},
Permata {},
Bca {},
BniVa {},
BriVa {},
CimbVa {},
DanamonVa {},
MandiriVa {},
Pix(Box<PixBankTransferAdditionalData>),
Pse {},
LocalBankTransfer(Box<LocalBankTransferAdditionalData>),
InstantBankTransfer {},
InstantBankTransferFinland {},
InstantBankTransferPoland {},
IndonesianBankTransfer {
#[schema(value_type = Option<BankNames>, example = "bri")]
bank_name: Option<common_enums::BankNames>,
},
}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct PixBankTransferAdditionalData {
/// Partially masked unique key for pix transfer
#[schema(value_type = Option<String>, example = "a1f4102e ****** 6fa48899c1d1")]
pub pix_key: Option<MaskedBankAccount>,
/// Partially masked CPF - CPF is a Brazilian tax identification number
#[schema(value_type = Option<String>, example = "**** 124689")]
pub cpf: Option<MaskedBankAccount>,
/// Partially masked CNPJ - CNPJ is a Brazilian company tax identification number
#[schema(value_type = Option<String>, example = "**** 417312")]
pub cnpj: Option<MaskedBankAccount>,
/// Partially masked source bank account number
#[schema(value_type = Option<String>, example = "********-****-4073-****-9fa964d08bc5")]
pub source_bank_account_id: Option<MaskedBankAccount>,
/// Partially masked destination bank account number _Deprecated: Will be removed in next stable release._
#[schema(value_type = Option<String>, example = "********-****-460b-****-f23b4e71c97b", deprecated)]
pub destination_bank_account_id: Option<MaskedBankAccount>,
/// The expiration date and time for the Pix QR code in ISO 8601 format
#[schema(value_type = Option<String>, example = "2025-09-10T10:11:12Z")]
#[serde(default, with = "common_utils::custom_serde::iso8601::option")]
pub expiry_date: Option<time::PrimitiveDateTime>,
}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct LocalBankTransferAdditionalData {
/// Partially masked bank code
#[schema(value_type = Option<String>, example = "**** OA2312")]
pub bank_code: Option<MaskedBankAccount>,
}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
#[serde(rename_all = "snake_case")]
pub enum GiftCardAdditionalData {
Givex(Box<GivexGiftCardAdditionalData>),
PaySafeCard {},
BhnCardNetwork {},
}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct GivexGiftCardAdditionalData {
/// Last 4 digits of the gift card number
#[schema(value_type = String, example = "4242")]
pub last4: Secret<String>,
}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct CardTokenAdditionalData {
/// The card holder's name
#[schema(value_type = String, example = "John Test")]
pub card_holder_name: Option<Secret<String>>,
}
#[derive(Debug, Clone, Eq, PartialEq, serde::Deserialize, serde::Serialize, ToSchema)]
#[serde(rename_all = "snake_case")]
pub enum UpiAdditionalData {
UpiCollect(Box<UpiCollectAdditionalData>),
#[schema(value_type = UpiIntentData)]
UpiIntent(Box<super::UpiIntentData>),
}
#[derive(Debug, Clone, Eq, PartialEq, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct UpiCollectAdditionalData {
/// Masked VPA ID
#[schema(value_type = Option<String>, example = "ab********@okhdfcbank")]
pub vpa_id: Option<MaskedUpiVpaId>,
}
#[derive(Debug, Clone, Eq, PartialEq, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct WalletAdditionalDataForCard {
/// Last 4 digits of the card number
pub last4: String,
/// The information of the payment method
pub card_network: String,
/// The type of payment method
#[serde(rename = "type")]
pub card_type: Option<String>,
}
|
crates/api_models/src/payments/additional_info.rs
|
api_models
|
full_file
| null | null | null | 2,434
| null | null | null | null | null | null | null |
// Implementation: impl api::PaymentSync for for Checkbook
// File: crates/hyperswitch_connectors/src/connectors/checkbook.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::PaymentSync for for Checkbook
|
crates/hyperswitch_connectors/src/connectors/checkbook.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 57
| null |
Checkbook
|
api::PaymentSync for
| 0
| 0
| null | null |
// File: crates/analytics/src/payments/distribution.rs
// Module: analytics
// Public structs: 1
use api_models::analytics::{
payments::{
PaymentDimensions, PaymentDistributions, PaymentFilters, PaymentMetricsBucketIdentifier,
},
Granularity, PaymentDistributionBody, TimeRange,
};
use diesel_models::enums as storage_enums;
use time::PrimitiveDateTime;
use crate::{
enums::AuthInfo,
query::{Aggregate, GroupByClause, ToSql, Window},
types::{AnalyticsCollection, AnalyticsDataSource, DBEnumWrapper, LoadRow, MetricsResult},
};
mod payment_error_message;
use payment_error_message::PaymentErrorMessage;
#[derive(Debug, PartialEq, Eq, serde::Deserialize)]
pub struct PaymentDistributionRow {
pub currency: Option<DBEnumWrapper<storage_enums::Currency>>,
pub status: Option<DBEnumWrapper<storage_enums::AttemptStatus>>,
pub connector: Option<String>,
pub authentication_type: Option<DBEnumWrapper<storage_enums::AuthenticationType>>,
pub payment_method: Option<String>,
pub payment_method_type: Option<String>,
pub client_source: Option<String>,
pub client_version: Option<String>,
pub profile_id: Option<String>,
pub card_network: Option<String>,
pub merchant_id: Option<String>,
pub card_last_4: Option<String>,
pub card_issuer: Option<String>,
pub error_reason: Option<String>,
pub first_attempt: Option<bool>,
pub total: Option<bigdecimal::BigDecimal>,
pub count: Option<i64>,
pub error_message: Option<String>,
pub routing_approach: Option<DBEnumWrapper<storage_enums::RoutingApproach>>,
pub signature_network: Option<String>,
pub is_issuer_regulated: Option<bool>,
pub is_debit_routed: Option<bool>,
#[serde(with = "common_utils::custom_serde::iso8601::option")]
pub start_bucket: Option<PrimitiveDateTime>,
#[serde(with = "common_utils::custom_serde::iso8601::option")]
pub end_bucket: Option<PrimitiveDateTime>,
}
pub trait PaymentDistributionAnalytics: LoadRow<PaymentDistributionRow> {}
#[async_trait::async_trait]
pub trait PaymentDistribution<T>
where
T: AnalyticsDataSource + PaymentDistributionAnalytics,
{
#[allow(clippy::too_many_arguments)]
async fn load_distribution(
&self,
distribution: &PaymentDistributionBody,
dimensions: &[PaymentDimensions],
auth: &AuthInfo,
filters: &PaymentFilters,
granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<Vec<(PaymentMetricsBucketIdentifier, PaymentDistributionRow)>>;
}
#[async_trait::async_trait]
impl<T> PaymentDistribution<T> for PaymentDistributions
where
T: AnalyticsDataSource + PaymentDistributionAnalytics,
PrimitiveDateTime: ToSql<T>,
AnalyticsCollection: ToSql<T>,
Granularity: GroupByClause<T>,
Aggregate<&'static str>: ToSql<T>,
Window<&'static str>: ToSql<T>,
{
async fn load_distribution(
&self,
distribution: &PaymentDistributionBody,
dimensions: &[PaymentDimensions],
auth: &AuthInfo,
filters: &PaymentFilters,
granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<Vec<(PaymentMetricsBucketIdentifier, PaymentDistributionRow)>> {
match self {
Self::PaymentErrorMessage => {
PaymentErrorMessage
.load_distribution(
distribution,
dimensions,
auth,
filters,
granularity,
time_range,
pool,
)
.await
}
}
}
}
|
crates/analytics/src/payments/distribution.rs
|
analytics
|
full_file
| null | null | null | 786
| null | null | null | null | null | null | null |
// Implementation: impl webhooks::IncomingWebhook for for UnifiedAuthenticationService
// File: crates/hyperswitch_connectors/src/connectors/unified_authentication_service.rs
// Module: hyperswitch_connectors
// Methods: 3 total (0 public)
impl webhooks::IncomingWebhook for for UnifiedAuthenticationService
|
crates/hyperswitch_connectors/src/connectors/unified_authentication_service.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 65
| null |
UnifiedAuthenticationService
|
webhooks::IncomingWebhook for
| 3
| 0
| null | null |
// Function: get_tax_processor_config
// File: crates/euclid_wasm/src/lib.rs
// Module: euclid_wasm
pub fn get_tax_processor_config(key: &str) -> JsResult
|
crates/euclid_wasm/src/lib.rs
|
euclid_wasm
|
function_signature
| null | null | null | 43
|
get_tax_processor_config
| null | null | null | null | null | null |
// Implementation: impl std::ops::DerefMut for for PaymentsMandateReference
// File: crates/diesel_models/src/payment_method.rs
// Module: diesel_models
// Methods: 1 total (0 public)
impl std::ops::DerefMut for for PaymentsMandateReference
|
crates/diesel_models/src/payment_method.rs
|
diesel_models
|
impl_block
| null | null | null | 62
| null |
PaymentsMandateReference
|
std::ops::DerefMut for
| 1
| 0
| null | null |
// Implementation: impl RefundSync for for Wise
// File: crates/hyperswitch_connectors/src/connectors/wise.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl RefundSync for for Wise
|
crates/hyperswitch_connectors/src/connectors/wise.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 53
| null |
Wise
|
RefundSync for
| 0
| 0
| null | null |
// File: crates/router/src/types/storage/api_keys.rs
// Module: router
#[cfg(feature = "email")]
pub use diesel_models::api_keys::ApiKeyExpiryTrackingData;
pub use diesel_models::api_keys::{ApiKey, ApiKeyNew, ApiKeyUpdate, HashedApiKey};
|
crates/router/src/types/storage/api_keys.rs
|
router
|
full_file
| null | null | null | 60
| null | null | null | null | null | null | null |
// Struct: CoinbaseAuthType
// File: crates/hyperswitch_connectors/src/connectors/coinbase/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct CoinbaseAuthType
|
crates/hyperswitch_connectors/src/connectors/coinbase/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
CoinbaseAuthType
| 0
|
[] | 48
| null | null | null | null | null | null | null |
// Function: find_payment_merchant_connector_account
// File: crates/router/src/core/webhooks/recovery_incoming.rs
// Module: router
pub fn find_payment_merchant_connector_account(
&self,
state: &SessionState,
key_store: &domain::MerchantKeyStore,
billing_connector_account: &domain::MerchantConnectorAccount,
) -> CustomResult<Option<domain::MerchantConnectorAccount>, errors::RevenueRecoveryError>
|
crates/router/src/core/webhooks/recovery_incoming.rs
|
router
|
function_signature
| null | null | null | 93
|
find_payment_merchant_connector_account
| null | null | null | null | null | null |
// Implementation: impl api::RefundSync for for Paystack
// File: crates/hyperswitch_connectors/src/connectors/paystack.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::RefundSync for for Paystack
|
crates/hyperswitch_connectors/src/connectors/paystack.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 59
| null |
Paystack
|
api::RefundSync for
| 0
| 0
| null | null |
// Struct: CardResponse
// File: crates/hyperswitch_connectors/src/connectors/forte/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct CardResponse
|
crates/hyperswitch_connectors/src/connectors/forte/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
CardResponse
| 0
|
[] | 46
| null | null | null | null | null | null | null |
// Struct: ConnectorCustomerMap
// File: crates/common_types/src/customers.rs
// Module: common_types
// Implementations: 3
// Traits: std::ops::Deref, std::ops::DerefMut
pub struct ConnectorCustomerMap
|
crates/common_types/src/customers.rs
|
common_types
|
struct_definition
|
ConnectorCustomerMap
| 3
|
[
"std::ops::Deref",
"std::ops::DerefMut"
] | 54
| null | null | null | null | null | null | null |
// Implementation: impl Hash for for RefundMetricsBucketIdentifier
// File: crates/api_models/src/analytics/refunds.rs
// Module: api_models
// Methods: 1 total (0 public)
impl Hash for for RefundMetricsBucketIdentifier
|
crates/api_models/src/analytics/refunds.rs
|
api_models
|
impl_block
| null | null | null | 51
| null |
RefundMetricsBucketIdentifier
|
Hash for
| 1
| 0
| null | null |
// Function: find_by_merchant_id_connector_transaction_id
// File: crates/diesel_models/src/query/refund.rs
// Module: diesel_models
pub fn find_by_merchant_id_connector_transaction_id(
conn: &PgPooledConn,
merchant_id: &common_utils::id_type::MerchantId,
connector_transaction_id: &str,
) -> StorageResult<Vec<Self>>
|
crates/diesel_models/src/query/refund.rs
|
diesel_models
|
function_signature
| null | null | null | 81
|
find_by_merchant_id_connector_transaction_id
| null | null | null | null | null | null |
// Struct: DynamicDescriptor
// File: crates/hyperswitch_connectors/src/connectors/silverflow/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct DynamicDescriptor
|
crates/hyperswitch_connectors/src/connectors/silverflow/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
DynamicDescriptor
| 0
|
[] | 46
| null | null | null | null | null | null | null |
// Struct: PaymentsDistributionAccumulator
// File: crates/analytics/src/payments/accumulator.rs
// Module: analytics
// Implementations: 1
// Traits: PaymentMetricAccumulator
pub struct PaymentsDistributionAccumulator
|
crates/analytics/src/payments/accumulator.rs
|
analytics
|
struct_definition
|
PaymentsDistributionAccumulator
| 1
|
[
"PaymentMetricAccumulator"
] | 50
| null | null | null | null | null | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.