text
stringlengths 65
57.3k
| file_path
stringlengths 22
92
| module
stringclasses 38
values | type
stringclasses 7
values | struct_name
stringlengths 3
60
⌀ | impl_count
int64 0
60
⌀ | traits
listlengths 0
59
⌀ | tokens
int64 16
8.19k
| function_name
stringlengths 3
85
⌀ | type_name
stringlengths 1
67
⌀ | trait_name
stringclasses 573
values | method_count
int64 0
31
⌀ | public_method_count
int64 0
19
⌀ | submodule_count
int64 0
56
⌀ | export_count
int64 0
9
⌀ |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
// Struct: MerchantConnectorListResponse
// File: crates/api_models/src/admin.rs
// Module: api_models
// Implementations: 2
pub struct MerchantConnectorListResponse
|
crates/api_models/src/admin.rs
|
api_models
|
struct_definition
|
MerchantConnectorListResponse
| 2
|
[] | 37
| null | null | null | null | null | null | null |
// Struct: AccessTokenFlowData
// File: crates/hyperswitch_domain_models/src/router_data_v2/flow_common_types.rs
// Module: hyperswitch_domain_models
// Implementations: 0
pub struct AccessTokenFlowData
|
crates/hyperswitch_domain_models/src/router_data_v2/flow_common_types.rs
|
hyperswitch_domain_models
|
struct_definition
|
AccessTokenFlowData
| 0
|
[] | 48
| null | null | null | null | null | null | null |
// Struct: JpmorganRefundRequest
// File: crates/hyperswitch_connectors/src/connectors/jpmorgan/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct JpmorganRefundRequest
|
crates/hyperswitch_connectors/src/connectors/jpmorgan/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
JpmorganRefundRequest
| 0
|
[] | 54
| null | null | null | null | null | null | null |
// Struct: PoCancel
// File: crates/hyperswitch_domain_models/src/router_flow_types/payouts.rs
// Module: hyperswitch_domain_models
// Implementations: 0
pub struct PoCancel
|
crates/hyperswitch_domain_models/src/router_flow_types/payouts.rs
|
hyperswitch_domain_models
|
struct_definition
|
PoCancel
| 0
|
[] | 44
| null | null | null | null | null | null | null |
// Function: merchant_account_create
// File: crates/router/src/routes/admin.rs
// Module: router
pub fn merchant_account_create(
state: web::Data<AppState>,
req: HttpRequest,
json_payload: web::Json<admin::MerchantAccountCreate>,
) -> HttpResponse
|
crates/router/src/routes/admin.rs
|
router
|
function_signature
| null | null | null | 59
|
merchant_account_create
| null | null | null | null | null | null |
// Struct: FortePaymentsSyncResponse
// File: crates/hyperswitch_connectors/src/connectors/forte/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct FortePaymentsSyncResponse
|
crates/hyperswitch_connectors/src/connectors/forte/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
FortePaymentsSyncResponse
| 0
|
[] | 52
| null | null | null | null | null | null | null |
// Struct: ProphetpayRefundRequest
// File: crates/hyperswitch_connectors/src/connectors/prophetpay/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct ProphetpayRefundRequest
|
crates/hyperswitch_connectors/src/connectors/prophetpay/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
ProphetpayRefundRequest
| 0
|
[] | 52
| null | null | null | null | null | null | null |
// Implementation: impl behaviour::Conversion for for PaymentIntent
// File: crates/hyperswitch_domain_models/src/payments/payment_intent.rs
// Module: hyperswitch_domain_models
// Methods: 3 total (0 public)
impl behaviour::Conversion for for PaymentIntent
|
crates/hyperswitch_domain_models/src/payments/payment_intent.rs
|
hyperswitch_domain_models
|
impl_block
| null | null | null | 55
| null |
PaymentIntent
|
behaviour::Conversion for
| 3
| 0
| null | null |
// Struct: PaymentMetaData
// File: crates/hyperswitch_connectors/src/connectors/gocardless/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct PaymentMetaData
|
crates/hyperswitch_connectors/src/connectors/gocardless/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
PaymentMetaData
| 0
|
[] | 46
| null | null | null | null | null | null | null |
// Function: delete_user_role
// File: crates/router/src/core/user_role.rs
// Module: router
pub fn delete_user_role(
state: SessionState,
user_from_token: auth::UserFromToken,
request: user_role_api::DeleteUserRoleRequest,
_req_state: ReqState,
) -> UserResponse<()>
|
crates/router/src/core/user_role.rs
|
router
|
function_signature
| null | null | null | 70
|
delete_user_role
| null | null | null | null | null | null |
// Implementation: impl utils::MultipleCaptureSyncResponse for for ActionResponse
// File: crates/hyperswitch_connectors/src/connectors/checkout/transformers.rs
// Module: hyperswitch_connectors
// Methods: 5 total (0 public)
impl utils::MultipleCaptureSyncResponse for for ActionResponse
|
crates/hyperswitch_connectors/src/connectors/checkout/transformers.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 64
| null |
ActionResponse
|
utils::MultipleCaptureSyncResponse for
| 5
| 0
| null | null |
// Implementation: impl OrganizationNew
// File: crates/diesel_models/src/organization.rs
// Module: diesel_models
// Methods: 1 total (1 public)
impl OrganizationNew
|
crates/diesel_models/src/organization.rs
|
diesel_models
|
impl_block
| null | null | null | 38
| null |
OrganizationNew
| null | 1
| 1
| null | null |
// Function: from_string
// File: crates/redis_interface/src/types.rs
// Module: redis_interface
pub fn from_string(value: String) -> Self
|
crates/redis_interface/src/types.rs
|
redis_interface
|
function_signature
| null | null | null | 33
|
from_string
| null | null | null | null | null | null |
// Implementation: impl RequiredFieldsForEnabledPaymentMethodTypes
// File: crates/router/src/core/payments/payment_methods.rs
// Module: router
// Methods: 1 total (0 public)
impl RequiredFieldsForEnabledPaymentMethodTypes
|
crates/router/src/core/payments/payment_methods.rs
|
router
|
impl_block
| null | null | null | 48
| null |
RequiredFieldsForEnabledPaymentMethodTypes
| null | 1
| 0
| null | null |
// Implementation: impl super::api_event::filters::ApiEventFilterAnalytics for for ClickhouseClient
// File: crates/analytics/src/clickhouse.rs
// Module: analytics
// Methods: 0 total (0 public)
impl super::api_event::filters::ApiEventFilterAnalytics for for ClickhouseClient
|
crates/analytics/src/clickhouse.rs
|
analytics
|
impl_block
| null | null | null | 65
| null |
ClickhouseClient
|
super::api_event::filters::ApiEventFilterAnalytics for
| 0
| 0
| null | null |
// Struct: PaymentMethodSession
// File: crates/diesel_models/src/payment_methods_session.rs
// Module: diesel_models
// Implementations: 1
pub struct PaymentMethodSession
|
crates/diesel_models/src/payment_methods_session.rs
|
diesel_models
|
struct_definition
|
PaymentMethodSession
| 1
|
[] | 38
| null | null | null | null | null | null | null |
// Implementation: impl api::Refund for for Airwallex
// File: crates/hyperswitch_connectors/src/connectors/airwallex.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::Refund for for Airwallex
|
crates/hyperswitch_connectors/src/connectors/airwallex.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 61
| null |
Airwallex
|
api::Refund for
| 0
| 0
| null | null |
// Trait: LoadRow
// File: crates/analytics/src/types.rs
// Module: analytics
pub trait LoadRow<T>
|
crates/analytics/src/types.rs
|
analytics
|
trait_definition
| null | null | null | 27
| null | null |
LoadRow
| null | null | null | null |
// Struct: MigrateNetworkTokenData
// File: crates/api_models/src/payment_methods.rs
// Module: api_models
// Implementations: 0
pub struct MigrateNetworkTokenData
|
crates/api_models/src/payment_methods.rs
|
api_models
|
struct_definition
|
MigrateNetworkTokenData
| 0
|
[] | 40
| null | null | null | null | null | null | null |
// Implementation: impl api::Payment for for Checkbook
// File: crates/hyperswitch_connectors/src/connectors/checkbook.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::Payment for for Checkbook
|
crates/hyperswitch_connectors/src/connectors/checkbook.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 55
| null |
Checkbook
|
api::Payment for
| 0
| 0
| null | null |
// Struct: RequestId
// File: crates/router/src/middleware.rs
// Module: router
// Implementations: 0
// Documentation: Middleware to include request ID in response header.
pub struct RequestId
|
crates/router/src/middleware.rs
|
router
|
struct_definition
|
RequestId
| 0
|
[] | 44
| null | null | null | null | null | null | null |
// File: crates/router/tests/connectors/payload.rs
// Module: router
use masking::Secret;
use router::types::{self, api, domain, storage::enums};
use test_utils::connector_auth;
use crate::utils::{self, ConnectorActions};
#[derive(Clone, Copy)]
struct PayloadTest;
impl ConnectorActions for PayloadTest {}
impl utils::Connector for PayloadTest {
fn get_data(&self) -> api::ConnectorData {
use router::connector::Payload;
utils::construct_connector_data_old(
Box::new(Payload::new()),
types::Connector::DummyConnector1,
api::GetToken::Connector,
None,
)
}
fn get_auth_token(&self) -> types::ConnectorAuthType {
utils::to_connector_auth_type(
connector_auth::ConnectorAuthentication::new()
.payload
.expect("Missing connector authentication configuration")
.into(),
)
}
fn get_name(&self) -> String {
"payload".to_string()
}
}
static CONNECTOR: PayloadTest = PayloadTest {};
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/payload.rs
|
router
|
full_file
| null | null | null | 2,921
| null | null | null | null | null | null | null |
// Struct: ResponseMessage
// File: crates/hyperswitch_connectors/src/connectors/authorizedotnet/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct ResponseMessage
|
crates/hyperswitch_connectors/src/connectors/authorizedotnet/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
ResponseMessage
| 0
|
[] | 47
| null | null | null | null | null | null | null |
// Implementation: impl EmailData for for ResetPassword
// File: crates/router/src/services/email/types.rs
// Module: router
// Methods: 1 total (0 public)
impl EmailData for for ResetPassword
|
crates/router/src/services/email/types.rs
|
router
|
impl_block
| null | null | null | 44
| null |
ResetPassword
|
EmailData for
| 1
| 0
| null | null |
// Struct: TsysCaptureRequest
// File: crates/hyperswitch_connectors/src/connectors/tsys/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct TsysCaptureRequest
|
crates/hyperswitch_connectors/src/connectors/tsys/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
TsysCaptureRequest
| 0
|
[] | 49
| null | null | null | null | null | null | null |
// Implementation: impl api::Refund for for Gocardless
// File: crates/hyperswitch_connectors/src/connectors/gocardless.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::Refund for for Gocardless
|
crates/hyperswitch_connectors/src/connectors/gocardless.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 60
| null |
Gocardless
|
api::Refund for
| 0
| 0
| null | null |
// File: crates/router/src/types/storage/unified_translations.rs
// Module: router
pub use diesel_models::unified_translations::{
UnifiedTranslations, UnifiedTranslationsNew, UnifiedTranslationsUpdate,
UnifiedTranslationsUpdateInternal,
};
|
crates/router/src/types/storage/unified_translations.rs
|
router
|
full_file
| null | null | null | 48
| null | null | null | null | null | null | null |
// Function: get_parent_group_info
// File: crates/router/src/core/user_role.rs
// Module: router
pub fn get_parent_group_info(
state: SessionState,
user_from_token: auth::UserFromToken,
request: role_api::GetParentGroupsInfoQueryParams,
) -> UserResponse<Vec<role_api::ParentGroupInfo>>
|
crates/router/src/core/user_role.rs
|
router
|
function_signature
| null | null | null | 74
|
get_parent_group_info
| null | null | null | null | null | null |
// Struct: RetriesAmountAccumulator
// File: crates/analytics/src/payments/accumulator.rs
// Module: analytics
// Implementations: 1
// Traits: PaymentMetricAccumulator
pub struct RetriesAmountAccumulator
|
crates/analytics/src/payments/accumulator.rs
|
analytics
|
struct_definition
|
RetriesAmountAccumulator
| 1
|
[
"PaymentMetricAccumulator"
] | 52
| null | null | null | null | null | null | null |
// Implementation: impl api::PaymentToken for for Barclaycard
// File: crates/hyperswitch_connectors/src/connectors/barclaycard.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::PaymentToken for for Barclaycard
|
crates/hyperswitch_connectors/src/connectors/barclaycard.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 61
| null |
Barclaycard
|
api::PaymentToken for
| 0
| 0
| null | null |
// Trait: AsSchedulerInterface
// File: crates/scheduler/src/scheduler.rs
// Module: scheduler
pub trait AsSchedulerInterface
|
crates/scheduler/src/scheduler.rs
|
scheduler
|
trait_definition
| null | null | null | 28
| null | null |
AsSchedulerInterface
| null | null | null | null |
// Function: add_dispute_list_task_to_pt
// File: crates/router/src/core/disputes.rs
// Module: router
pub fn add_dispute_list_task_to_pt(
db: &dyn StorageInterface,
connector_name: &str,
merchant_id: common_utils::id_type::MerchantId,
merchant_connector_id: common_utils::id_type::MerchantConnectorAccountId,
profile_id: common_utils::id_type::ProfileId,
fetch_request: FetchDisputesRequestData,
) -> common_utils::errors::CustomResult<(), errors::StorageError>
|
crates/router/src/core/disputes.rs
|
router
|
function_signature
| null | null | null | 120
|
add_dispute_list_task_to_pt
| null | null | null | null | null | null |
// Struct: TokenizedCardData
// File: crates/hyperswitch_connectors/src/connectors/archipel/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct TokenizedCardData
|
crates/hyperswitch_connectors/src/connectors/archipel/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
TokenizedCardData
| 0
|
[] | 49
| null | null | null | null | null | null | null |
// Implementation: impl api::PaymentAuthorize for for Iatapay
// File: crates/hyperswitch_connectors/src/connectors/iatapay.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::PaymentAuthorize for for Iatapay
|
crates/hyperswitch_connectors/src/connectors/iatapay.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 63
| null |
Iatapay
|
api::PaymentAuthorize for
| 0
| 0
| null | null |
// Struct: NoonWebhookEvent
// File: crates/hyperswitch_connectors/src/connectors/noon/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct NoonWebhookEvent
|
crates/hyperswitch_connectors/src/connectors/noon/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
NoonWebhookEvent
| 0
|
[] | 49
| null | null | null | null | null | null | null |
// Struct: ExternalVaultDeleteFlow
// File: crates/hyperswitch_domain_models/src/router_flow_types/vault.rs
// Module: hyperswitch_domain_models
// Implementations: 0
pub struct ExternalVaultDeleteFlow
|
crates/hyperswitch_domain_models/src/router_flow_types/vault.rs
|
hyperswitch_domain_models
|
struct_definition
|
ExternalVaultDeleteFlow
| 0
|
[] | 47
| null | null | null | null | null | null | null |
// Function: batch_insert
// File: crates/diesel_models/src/query/reverse_lookup.rs
// Module: diesel_models
pub fn batch_insert(
reverse_lookups: Vec<Self>,
conn: &PgPooledConn,
) -> StorageResult<()>
|
crates/diesel_models/src/query/reverse_lookup.rs
|
diesel_models
|
function_signature
| null | null | null | 54
|
batch_insert
| null | null | null | null | null | null |
// File: crates/analytics/src/outgoing_webhook_event.rs
// Module: analytics
mod core;
pub mod events;
pub trait OutgoingWebhookEventAnalytics: events::OutgoingWebhookLogsFilterAnalytics {}
pub use self::core::outgoing_webhook_events_core;
|
crates/analytics/src/outgoing_webhook_event.rs
|
analytics
|
full_file
| null | null | null | 58
| null | null | null | null | null | null | null |
// Struct: CurrencyConversionResponse
// File: crates/api_models/src/currency.rs
// Module: api_models
// Implementations: 1
// Traits: ApiEventMetric
pub struct CurrencyConversionResponse
|
crates/api_models/src/currency.rs
|
api_models
|
struct_definition
|
CurrencyConversionResponse
| 1
|
[
"ApiEventMetric"
] | 43
| null | null | null | null | null | null | null |
// Implementation: impl api::ConnectorAccessToken for for Bambora
// File: crates/hyperswitch_connectors/src/connectors/bambora.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::ConnectorAccessToken for for Bambora
|
crates/hyperswitch_connectors/src/connectors/bambora.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 60
| null |
Bambora
|
api::ConnectorAccessToken for
| 0
| 0
| null | null |
// File: crates/hyperswitch_connectors/src/connectors/plaid/transformers.rs
// Module: hyperswitch_connectors
// Public structs: 15
use api_models::payments::OpenBankingSessionToken;
use common_enums::{AttemptStatus, Currency};
use common_utils::types::FloatMajorUnit;
use hyperswitch_domain_models::{
payment_method_data::{OpenBankingData, PaymentMethodData},
router_data::{ConnectorAuthType, ErrorResponse, RouterData},
router_request_types::ResponseId,
router_response_types::PaymentsResponseData,
types::{PaymentsAuthorizeRouterData, PaymentsSyncRouterData},
};
use hyperswitch_interfaces::errors::ConnectorError;
use masking::{PeekInterface, Secret};
use serde::{Deserialize, Serialize};
use crate::{
types::{PaymentsPostProcessingRouterData, ResponseRouterData},
utils::is_payment_failure,
};
pub struct PlaidRouterData<T> {
pub amount: FloatMajorUnit,
pub router_data: T,
}
impl<T> From<(FloatMajorUnit, T)> for PlaidRouterData<T> {
fn from((amount, item): (FloatMajorUnit, T)) -> Self {
Self {
amount,
router_data: item,
}
}
}
#[derive(Default, Debug, Serialize)]
pub struct PlaidPaymentsRequest {
amount: PlaidAmount,
recipient_id: String,
reference: String,
#[serde(skip_serializing_if = "Option::is_none")]
schedule: Option<PlaidSchedule>,
#[serde(skip_serializing_if = "Option::is_none")]
options: Option<PlaidOptions>,
}
#[derive(Default, Debug, Serialize, Deserialize)]
pub struct PlaidAmount {
currency: Currency,
value: FloatMajorUnit,
}
#[derive(Default, Debug, Serialize, Deserialize)]
pub struct PlaidSchedule {
interval: String,
interval_execution_day: String,
start_date: String,
end_date: Option<String>,
adjusted_start_date: Option<String>,
}
#[derive(Default, Debug, Serialize, Deserialize)]
pub struct PlaidOptions {
request_refund_details: bool,
iban: Option<Secret<String>>,
bacs: Option<PlaidBacs>,
scheme: String,
}
#[derive(Default, Debug, Serialize, Deserialize)]
pub struct PlaidBacs {
account: Secret<String>,
sort_code: Secret<String>,
}
#[derive(Default, Debug, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub struct PlaidLinkTokenRequest {
client_name: String,
country_codes: Vec<String>,
language: String,
products: Vec<String>,
user: User,
payment_initiation: PlaidPaymentInitiation,
redirect_uri: Option<String>,
android_package_name: Option<String>,
}
#[derive(Default, Debug, Serialize, Deserialize)]
pub struct User {
pub client_user_id: String,
}
#[derive(Default, Debug, Serialize, Deserialize)]
pub struct PlaidPaymentInitiation {
payment_id: String,
}
impl TryFrom<&PlaidRouterData<&PaymentsAuthorizeRouterData>> for PlaidPaymentsRequest {
type Error = error_stack::Report<ConnectorError>;
fn try_from(item: &PlaidRouterData<&PaymentsAuthorizeRouterData>) -> Result<Self, Self::Error> {
match item.router_data.request.payment_method_data.clone() {
PaymentMethodData::OpenBanking(ref data) => match data {
OpenBankingData::OpenBankingPIS { .. } => {
let amount = item.amount;
let currency = item.router_data.request.currency;
let payment_id = item.router_data.payment_id.clone();
let id_len = payment_id.len();
let reference = if id_len > 18 {
payment_id.get(id_len - 18..id_len).map(|id| id.to_string())
} else {
Some(payment_id)
}
.ok_or(ConnectorError::MissingRequiredField {
field_name: "payment_id",
})?;
let recipient_type = item
.router_data
.additional_merchant_data
.as_ref()
.map(|merchant_data| match merchant_data {
api_models::admin::AdditionalMerchantData::OpenBankingRecipientData(
data,
) => data.clone(),
})
.ok_or(ConnectorError::MissingRequiredField {
field_name: "additional_merchant_data",
})?;
let recipient_id = match recipient_type {
api_models::admin::MerchantRecipientData::ConnectorRecipientId(id) => {
Ok(id.peek().to_string())
}
_ => Err(ConnectorError::MissingRequiredField {
field_name: "ConnectorRecipientId",
}),
}?;
Ok(Self {
amount: PlaidAmount {
currency,
value: amount,
},
reference,
recipient_id,
schedule: None,
options: None,
})
}
},
_ => Err(ConnectorError::NotImplemented("Payment methods".to_string()).into()),
}
}
}
impl TryFrom<&PaymentsSyncRouterData> for PlaidSyncRequest {
type Error = error_stack::Report<ConnectorError>;
fn try_from(item: &PaymentsSyncRouterData) -> Result<Self, Self::Error> {
match item.request.connector_transaction_id {
ResponseId::ConnectorTransactionId(ref id) => Ok(Self {
payment_id: id.clone(),
}),
_ => Err((ConnectorError::MissingConnectorTransactionID).into()),
}
}
}
impl TryFrom<&PaymentsPostProcessingRouterData> for PlaidLinkTokenRequest {
type Error = error_stack::Report<ConnectorError>;
fn try_from(item: &PaymentsPostProcessingRouterData) -> Result<Self, Self::Error> {
match item.request.payment_method_data {
PaymentMethodData::OpenBanking(ref data) => match data {
OpenBankingData::OpenBankingPIS { .. } => {
let headers = item.header_payload.clone();
let platform = headers
.as_ref()
.and_then(|headers| headers.x_client_platform.clone());
let (is_android, is_ios) = match platform {
Some(common_enums::ClientPlatform::Android) => (true, false),
Some(common_enums::ClientPlatform::Ios) => (false, true),
_ => (false, false),
};
Ok(Self {
client_name: "Hyperswitch".to_string(),
country_codes: item
.request
.country
.map(|code| vec![code.to_string()])
.ok_or(ConnectorError::MissingRequiredField {
field_name: "billing.address.country",
})?,
language: "en".to_string(),
products: vec!["payment_initiation".to_string()],
user: User {
client_user_id: item
.request
.customer_id
.clone()
.map(|id| id.get_string_repr().to_string())
.unwrap_or("default cust".to_string()),
},
payment_initiation: PlaidPaymentInitiation {
payment_id: item
.request
.connector_transaction_id
.clone()
.ok_or(ConnectorError::MissingConnectorTransactionID)?,
},
android_package_name: if is_android {
headers
.as_ref()
.and_then(|headers| headers.x_app_id.clone())
} else {
None
},
redirect_uri: if is_ios {
headers
.as_ref()
.and_then(|headers| headers.x_redirect_uri.clone())
} else {
None
},
})
}
},
_ => Err(ConnectorError::NotImplemented("Payment methods".to_string()).into()),
}
}
}
pub struct PlaidAuthType {
pub client_id: Secret<String>,
pub secret: Secret<String>,
}
impl TryFrom<&ConnectorAuthType> for PlaidAuthType {
type Error = error_stack::Report<ConnectorError>;
fn try_from(auth_type: &ConnectorAuthType) -> Result<Self, Self::Error> {
match auth_type {
ConnectorAuthType::BodyKey { api_key, key1 } => Ok(Self {
client_id: api_key.to_owned(),
secret: key1.to_owned(),
}),
_ => Err(ConnectorError::FailedToObtainAuthType.into()),
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
#[derive(strum::Display)]
pub enum PlaidPaymentStatus {
PaymentStatusInputNeeded,
PaymentStatusInitiated,
PaymentStatusInsufficientFunds,
PaymentStatusFailed,
PaymentStatusBlocked,
PaymentStatusCancelled,
PaymentStatusExecuted,
PaymentStatusSettled,
PaymentStatusEstablished,
PaymentStatusRejected,
PaymentStatusAuthorising,
}
impl From<PlaidPaymentStatus> for AttemptStatus {
fn from(item: PlaidPaymentStatus) -> Self {
match item {
PlaidPaymentStatus::PaymentStatusAuthorising => Self::Authorizing,
PlaidPaymentStatus::PaymentStatusBlocked
| PlaidPaymentStatus::PaymentStatusInsufficientFunds
| PlaidPaymentStatus::PaymentStatusRejected => Self::AuthorizationFailed,
PlaidPaymentStatus::PaymentStatusCancelled => Self::Voided,
PlaidPaymentStatus::PaymentStatusEstablished => Self::Authorized,
PlaidPaymentStatus::PaymentStatusExecuted
| PlaidPaymentStatus::PaymentStatusSettled
| PlaidPaymentStatus::PaymentStatusInitiated => Self::Charged,
PlaidPaymentStatus::PaymentStatusFailed => Self::Failure,
PlaidPaymentStatus::PaymentStatusInputNeeded => Self::AuthenticationPending,
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct PlaidPaymentsResponse {
status: PlaidPaymentStatus,
payment_id: String,
}
impl<F, T> TryFrom<ResponseRouterData<F, PlaidPaymentsResponse, T, PaymentsResponseData>>
for RouterData<F, T, PaymentsResponseData>
{
type Error = error_stack::Report<ConnectorError>;
fn try_from(
item: ResponseRouterData<F, PlaidPaymentsResponse, T, PaymentsResponseData>,
) -> Result<Self, Self::Error> {
let status = AttemptStatus::from(item.response.status.clone());
Ok(Self {
status,
response: if is_payment_failure(status) {
Err(ErrorResponse {
// populating status everywhere as plaid only sends back a status
code: item.response.status.clone().to_string(),
message: item.response.status.clone().to_string(),
reason: Some(item.response.status.to_string()),
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: Some(item.response.payment_id),
network_advice_code: None,
network_decline_code: None,
network_error_message: None,
connector_metadata: None,
})
} else {
Ok(PaymentsResponseData::TransactionResponse {
resource_id: ResponseId::ConnectorTransactionId(
item.response.payment_id.clone(),
),
redirection_data: Box::new(None),
mandate_reference: Box::new(None),
connector_metadata: None,
network_txn_id: None,
connector_response_reference_id: Some(item.response.payment_id),
incremental_authorization_allowed: None,
charges: None,
})
},
..item.data
})
}
}
#[derive(Default, Debug, Serialize, Deserialize)]
pub struct PlaidLinkTokenResponse {
link_token: String,
}
impl<F, T> TryFrom<ResponseRouterData<F, PlaidLinkTokenResponse, T, PaymentsResponseData>>
for RouterData<F, T, PaymentsResponseData>
{
type Error = error_stack::Report<ConnectorError>;
fn try_from(
item: ResponseRouterData<F, PlaidLinkTokenResponse, T, PaymentsResponseData>,
) -> Result<Self, Self::Error> {
let session_token = Some(OpenBankingSessionToken {
open_banking_session_token: item.response.link_token,
});
Ok(Self {
status: AttemptStatus::AuthenticationPending,
response: Ok(PaymentsResponseData::PostProcessingResponse { session_token }),
..item.data
})
}
}
#[derive(Default, Debug, Serialize, Deserialize)]
pub struct PlaidSyncRequest {
payment_id: String,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct PlaidSyncResponse {
payment_id: String,
amount: PlaidAmount,
status: PlaidPaymentStatus,
recipient_id: String,
reference: String,
last_status_update: String,
adjusted_reference: Option<String>,
schedule: Option<PlaidSchedule>,
iban: Option<Secret<String>>,
bacs: Option<PlaidBacs>,
scheme: Option<String>,
adjusted_scheme: Option<String>,
request_id: String,
}
impl<F, T> TryFrom<ResponseRouterData<F, PlaidSyncResponse, T, PaymentsResponseData>>
for RouterData<F, T, PaymentsResponseData>
{
type Error = error_stack::Report<ConnectorError>;
fn try_from(
item: ResponseRouterData<F, PlaidSyncResponse, T, PaymentsResponseData>,
) -> Result<Self, Self::Error> {
let status = AttemptStatus::from(item.response.status.clone());
Ok(Self {
status,
response: if is_payment_failure(status) {
Err(ErrorResponse {
// populating status everywhere as plaid only sends back a status
code: item.response.status.clone().to_string(),
message: item.response.status.clone().to_string(),
reason: Some(item.response.status.to_string()),
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: Some(item.response.payment_id),
network_advice_code: None,
network_decline_code: None,
network_error_message: None,
connector_metadata: None,
})
} else {
Ok(PaymentsResponseData::TransactionResponse {
resource_id: ResponseId::ConnectorTransactionId(
item.response.payment_id.clone(),
),
redirection_data: Box::new(None),
mandate_reference: Box::new(None),
connector_metadata: None,
network_txn_id: None,
connector_response_reference_id: Some(item.response.payment_id),
incremental_authorization_allowed: None,
charges: None,
})
},
..item.data
})
}
}
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq)]
#[serde(rename_all = "snake_case")]
pub struct PlaidErrorResponse {
pub display_message: Option<String>,
pub error_code: Option<String>,
pub error_message: String,
pub error_type: Option<String>,
}
|
crates/hyperswitch_connectors/src/connectors/plaid/transformers.rs
|
hyperswitch_connectors
|
full_file
| null | null | null | 3,117
| null | null | null | null | null | null | null |
// Struct: MandateRevoke
// File: crates/hyperswitch_domain_models/src/router_flow_types/mandate_revoke.rs
// Module: hyperswitch_domain_models
// Implementations: 0
pub struct MandateRevoke
|
crates/hyperswitch_domain_models/src/router_flow_types/mandate_revoke.rs
|
hyperswitch_domain_models
|
struct_definition
|
MandateRevoke
| 0
|
[] | 50
| null | null | null | null | null | null | null |
// Struct: DwollaMetaData
// File: crates/hyperswitch_connectors/src/connectors/dwolla/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct DwollaMetaData
|
crates/hyperswitch_connectors/src/connectors/dwolla/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
DwollaMetaData
| 0
|
[] | 48
| null | null | null | null | null | null | null |
// Struct: RecurlyLineItems
// File: crates/hyperswitch_connectors/src/connectors/recurly/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct RecurlyLineItems
|
crates/hyperswitch_connectors/src/connectors/recurly/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
RecurlyLineItems
| 0
|
[] | 52
| null | null | null | null | null | null | null |
// File: crates/openapi/src/routes/profile.rs
// Module: openapi
// Public functions: 14
// ******************************************** V1 profile routes ******************************************** //
#[cfg(feature = "v1")]
/// Profile - Create
///
/// Creates a new *profile* for a merchant
#[utoipa::path(
post,
path = "/account/{account_id}/business_profile",
params (
("account_id" = String, Path, description = "The unique identifier for the merchant account")
),
request_body(
content = ProfileCreate,
examples(
(
"Create a profile with minimal fields" = (
value = json!({})
)
),
(
"Create a profile with profile name" = (
value = json!({
"profile_name": "shoe_business"
})
)
)
)
),
responses(
(status = 200, description = "Profile Created", body = ProfileResponse),
(status = 400, description = "Invalid data")
),
tag = "Profile",
operation_id = "Create A Profile",
security(("api_key" = []))
)]
pub async fn profile_create() {}
#[cfg(feature = "v1")]
/// Profile - Update
///
/// Update the *profile*
#[utoipa::path(
post,
path = "/account/{account_id}/business_profile/{profile_id}",
params(
("account_id" = String, Path, description = "The unique identifier for the merchant account"),
("profile_id" = String, Path, description = "The unique identifier for the profile")
),
request_body(
content = ProfileCreate,
examples(
(
"Update profile with profile name fields" = (
value = json!({
"profile_name" : "shoe_business"
})
)
)
)),
responses(
(status = 200, description = "Profile Updated", body = ProfileResponse),
(status = 400, description = "Invalid data")
),
tag = "Profile",
operation_id = "Update a Profile",
security(("api_key" = []))
)]
pub async fn profile_update() {}
#[cfg(feature = "v1")]
/// Profile - Retrieve
///
/// Retrieve existing *profile*
#[utoipa::path(
get,
path = "/account/{account_id}/business_profile/{profile_id}",
params(
("account_id" = String, Path, description = "The unique identifier for the merchant account"),
("profile_id" = String, Path, description = "The unique identifier for the profile")
),
responses(
(status = 200, description = "Profile Updated", body = ProfileResponse),
(status = 400, description = "Invalid data")
),
tag = "Profile",
operation_id = "Retrieve a Profile",
security(("api_key" = []))
)]
pub async fn profile_retrieve() {}
// ******************************************** Common profile routes ******************************************** //
/// Profile - Delete
///
/// Delete the *profile*
#[utoipa::path(
delete,
path = "/account/{account_id}/business_profile/{profile_id}",
params(
("account_id" = String, Path, description = "The unique identifier for the merchant account"),
("profile_id" = String, Path, description = "The unique identifier for the profile")
),
responses(
(status = 200, description = "Profiles Deleted", body = bool),
(status = 400, description = "Invalid data")
),
tag = "Profile",
operation_id = "Delete the Profile",
security(("admin_api_key" = []))
)]
pub async fn profile_delete() {}
/// Profile - List
///
/// Lists all the *profiles* under a merchant
#[utoipa::path(
get,
path = "/account/{account_id}/business_profile",
params (
("account_id" = String, Path, description = "Merchant Identifier"),
),
responses(
(status = 200, description = "Profiles Retrieved", body = Vec<ProfileResponse>)
),
tag = "Profile",
operation_id = "List Profiles",
security(("api_key" = []))
)]
pub async fn profile_list() {}
// ******************************************** V2 profile routes ******************************************** //
#[cfg(feature = "v2")]
/// Profile - Create
///
/// Creates a new *profile* for a merchant
#[utoipa::path(
post,
path = "/v2/profiles",
params(
(
"X-Merchant-Id" = String, Header,
description = "Merchant ID of the profile.",
example = json!({"X-Merchant-Id": "abc_iG5VNjsN9xuCg7Xx0uWh"})
),
),
request_body(
content = ProfileCreate,
examples(
(
"Create a profile with profile name" = (
value = json!({
"profile_name": "shoe_business"
})
)
)
)
),
responses(
(status = 200, description = "Account Created", body = ProfileResponse),
(status = 400, description = "Invalid data")
),
tag = "Profile",
operation_id = "Create A Profile",
security(("admin_api_key" = []))
)]
pub async fn profile_create() {}
#[cfg(feature = "v2")]
/// Profile - Update
///
/// Update the *profile*
#[utoipa::path(
put,
path = "/v2/profiles/{id}",
params(
("id" = String, Path, description = "The unique identifier for the profile"),
(
"X-Merchant-Id" = String, Header,
description = "Merchant ID of the profile.",
example = json!({"X-Merchant-Id": "abc_iG5VNjsN9xuCg7Xx0uWh"})
),
),
request_body(
content = ProfileCreate,
examples(
(
"Update profile with profile name fields" = (
value = json!({
"profile_name" : "shoe_business"
})
)
)
)),
responses(
(status = 200, description = "Profile Updated", body = ProfileResponse),
(status = 400, description = "Invalid data")
),
tag = "Profile",
operation_id = "Update a Profile",
security(("admin_api_key" = []))
)]
pub async fn profile_update() {}
#[cfg(feature = "v2")]
/// Profile - Activate routing algorithm
///
/// Activates a routing algorithm under a profile
#[utoipa::path(
patch,
path = "/v2/profiles/{id}/activate-routing-algorithm",
request_body ( content = RoutingAlgorithmId,
examples( (
"Activate a routing algorithm" = (
value = json!({
"routing_algorithm_id": "routing_algorithm_123"
})
)
))),
params(
("id" = String, Path, description = "The unique identifier for the profile"),
),
responses(
(status = 200, description = "Routing Algorithm is activated", body = RoutingDictionaryRecord),
(status = 500, description = "Internal server error"),
(status = 404, description = "Resource missing"),
(status = 400, description = "Bad request")
),
tag = "Profile",
operation_id = "Activates a routing algorithm under a profile",
security(("api_key" = []), ("jwt_key" = []))
)]
pub async fn routing_link_config() {}
#[cfg(feature = "v2")]
/// Profile - Deactivate routing algorithm
///
/// Deactivates a routing algorithm under a profile
#[utoipa::path(
patch,
path = "/v2/profiles/{id}/deactivate-routing-algorithm",
params(
("id" = String, Path, description = "The unique identifier for the profile"),
),
responses(
(status = 200, description = "Successfully deactivated routing config", body = RoutingDictionaryRecord),
(status = 500, description = "Internal server error"),
(status = 400, description = "Malformed request"),
(status = 403, description = "Malformed request"),
(status = 422, description = "Unprocessable request")
),
tag = "Profile",
operation_id = " Deactivates a routing algorithm under a profile",
security(("api_key" = []), ("jwt_key" = []))
)]
pub async fn routing_unlink_config() {}
#[cfg(feature = "v2")]
/// Profile - Update Default Fallback Routing Algorithm
///
/// Update the default fallback routing algorithm for the profile
#[utoipa::path(
patch,
path = "/v2/profiles/{id}/fallback-routing",
request_body = Vec<RoutableConnectorChoice>,
params(
("id" = String, Path, description = "The unique identifier for the profile"),
),
responses(
(status = 200, description = "Successfully updated the default fallback routing algorithm", body = Vec<RoutableConnectorChoice>),
(status = 500, description = "Internal server error"),
(status = 400, description = "Malformed request"),
(status = 422, description = "Unprocessable request")
),
tag = "Profile",
operation_id = "Update the default fallback routing algorithm for the profile",
security(("api_key" = []), ("jwt_key" = []))
)]
pub async fn routing_update_default_config() {}
#[cfg(feature = "v2")]
/// Profile - Retrieve
///
/// Retrieve existing *profile*
#[utoipa::path(
get,
path = "/v2/profiles/{id}",
params(
("id" = String, Path, description = "The unique identifier for the profile"),
(
"X-Merchant-Id" = String, Header,
description = "Merchant ID of the profile.",
example = json!({"X-Merchant-Id": "abc_iG5VNjsN9xuCg7Xx0uWh"})
),
),
responses(
(status = 200, description = "Profile Updated", body = ProfileResponse),
(status = 400, description = "Invalid data")
),
tag = "Profile",
operation_id = "Retrieve a Profile",
security(("admin_api_key" = []))
)]
pub async fn profile_retrieve() {}
#[cfg(feature = "v2")]
/// Profile - Retrieve Active Routing Algorithm
///_
/// Retrieve active routing algorithm under the profile
#[utoipa::path(
get,
path = "/v2/profiles/{id}/routing-algorithm",
params(
("id" = String, Path, description = "The unique identifier for the profile"),
("limit" = Option<u16>, Query, description = "The number of records of the algorithms to be returned"),
("offset" = Option<u8>, Query, description = "The record offset of the algorithm from which to start gathering the results")),
responses(
(status = 200, description = "Successfully retrieved active config", body = LinkedRoutingConfigRetrieveResponse),
(status = 500, description = "Internal server error"),
(status = 404, description = "Resource missing"),
(status = 403, description = "Forbidden")
),
tag = "Profile",
operation_id = "Retrieve the active routing algorithm under the profile",
security(("api_key" = []), ("jwt_key" = []))
)]
pub async fn routing_retrieve_linked_config() {}
#[cfg(feature = "v2")]
/// Profile - Retrieve Default Fallback Routing Algorithm
///
/// Retrieve the default fallback routing algorithm for the profile
#[utoipa::path(
get,
path = "/v2/profiles/{id}/fallback-routing",
params(
("id" = String, Path, description = "The unique identifier for the profile"),
),
responses(
(status = 200, description = "Successfully retrieved default fallback routing algorithm", body = Vec<RoutableConnectorChoice>),
(status = 500, description = "Internal server error")
),
tag = "Profile",
operation_id = "Retrieve the default fallback routing algorithm for the profile",
security(("api_key" = []), ("jwt_key" = []))
)]
pub async fn routing_retrieve_default_config() {}
/// Profile - Connector Accounts List
///
/// List Connector Accounts for the profile
#[utoipa::path(
get,
path = "/v2/profiles/{id}/connector-accounts",
params(
("id" = String, Path, description = "The unique identifier for the business profile"),
(
"X-Merchant-Id" = String, Header,
description = "Merchant ID of the profile.",
example = json!({"X-Merchant-Id": "abc_iG5VNjsN9xuCg7Xx0uWh"})
),
),
responses(
(status = 200, description = "Merchant Connector list retrieved successfully", body = Vec<MerchantConnectorResponse>),
(status = 404, description = "Merchant Connector does not exist in records"),
(status = 401, description = "Unauthorized request")
),
tag = "Business Profile",
operation_id = "List all Merchant Connectors for Profile",
security(("admin_api_key" = []))
)]
#[cfg(feature = "v2")]
pub async fn connector_list() {}
|
crates/openapi/src/routes/profile.rs
|
openapi
|
full_file
| null | null | null | 2,933
| null | null | null | null | null | null | null |
// Struct: AdyenSplitItem
// File: crates/common_types/src/domain.rs
// Module: common_types
// Implementations: 0
// Documentation: Data for the split items
pub struct AdyenSplitItem
|
crates/common_types/src/domain.rs
|
common_types
|
struct_definition
|
AdyenSplitItem
| 0
|
[] | 46
| null | null | null | null | null | null | null |
// Struct: ArchipelPaymentsCancelRequest
// File: crates/hyperswitch_connectors/src/connectors/archipel/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct ArchipelPaymentsCancelRequest
|
crates/hyperswitch_connectors/src/connectors/archipel/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
ArchipelPaymentsCancelRequest
| 0
|
[] | 51
| null | null | null | null | null | null | null |
// File: crates/router/src/routes/cache.rs
// Module: router
// Public functions: 1
use actix_web::{web, HttpRequest, Responder};
use router_env::{instrument, tracing, Flow};
use super::AppState;
use crate::{
core::{api_locking, cache},
services::{api, authentication as auth},
};
#[instrument(skip_all)]
pub async fn invalidate(
state: web::Data<AppState>,
req: HttpRequest,
key: web::Path<String>,
) -> impl Responder {
let flow = Flow::CacheInvalidate;
let key = key.into_inner().to_owned();
api::server_wrap(
flow,
state,
&req,
&key,
|state, _, key, _| cache::invalidate(state, key),
&auth::AdminApiAuth,
api_locking::LockAction::NotApplicable,
)
.await
}
|
crates/router/src/routes/cache.rs
|
router
|
full_file
| null | null | null | 192
| null | null | null | null | null | null | null |
// Function: routing_retrieve_linked_config
// File: crates/openapi/src/routes/profile.rs
// Module: openapi
pub fn routing_retrieve_linked_config()
|
crates/openapi/src/routes/profile.rs
|
openapi
|
function_signature
| null | null | null | 34
|
routing_retrieve_linked_config
| null | null | null | null | null | null |
// Implementation: impl ConnectorValidation for for Stripe
// File: crates/hyperswitch_connectors/src/connectors/stripe.rs
// Module: hyperswitch_connectors
// Methods: 2 total (0 public)
impl ConnectorValidation for for Stripe
|
crates/hyperswitch_connectors/src/connectors/stripe.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 51
| null |
Stripe
|
ConnectorValidation for
| 2
| 0
| null | null |
// Struct: PaymentMethodsMigrateForm
// File: crates/payment_methods/src/core/migration.rs
// Module: payment_methods
// Implementations: 1
pub struct PaymentMethodsMigrateForm
|
crates/payment_methods/src/core/migration.rs
|
payment_methods
|
struct_definition
|
PaymentMethodsMigrateForm
| 1
|
[] | 41
| null | null | null | null | null | null | null |
// Struct: NovalnetResponseCustomer
// File: crates/hyperswitch_connectors/src/connectors/novalnet/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct NovalnetResponseCustomer
|
crates/hyperswitch_connectors/src/connectors/novalnet/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
NovalnetResponseCustomer
| 0
|
[] | 52
| null | null | null | null | null | null | null |
// Function: validate
// File: crates/external_services/src/crm.rs
// Module: external_services
// Documentation: Validates Hubspot configuration
pub fn validate(&self) -> Result<(), InvalidCrmConfig>
|
crates/external_services/src/crm.rs
|
external_services
|
function_signature
| null | null | null | 45
|
validate
| null | null | null | null | null | null |
// Implementation: impl Mandate
// File: crates/diesel_models/src/mandate.rs
// Module: diesel_models
// Methods: 1 total (1 public)
impl Mandate
|
crates/diesel_models/src/mandate.rs
|
diesel_models
|
impl_block
| null | null | null | 39
| null |
Mandate
| null | 1
| 1
| null | null |
// Struct: ZslPaymentsRequest
// File: crates/hyperswitch_connectors/src/connectors/zsl/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct ZslPaymentsRequest
|
crates/hyperswitch_connectors/src/connectors/zsl/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
ZslPaymentsRequest
| 0
|
[] | 49
| null | null | null | null | null | null | null |
// Struct: Organization
// File: crates/diesel_models/src/organization.rs
// Module: diesel_models
// Implementations: 4
// Traits: OrganizationBridge, OrganizationBridge
pub struct Organization
|
crates/diesel_models/src/organization.rs
|
diesel_models
|
struct_definition
|
Organization
| 4
|
[
"OrganizationBridge",
"OrganizationBridge"
] | 42
| null | null | null | null | null | null | null |
// Struct: AffirmCompleteAuthorizeResponse
// File: crates/hyperswitch_connectors/src/connectors/affirm/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct AffirmCompleteAuthorizeResponse
|
crates/hyperswitch_connectors/src/connectors/affirm/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
AffirmCompleteAuthorizeResponse
| 0
|
[] | 52
| null | null | null | null | null | null | null |
// Function: form_payment_link_data
// File: crates/router/src/core/payment_link.rs
// Module: router
pub fn form_payment_link_data(
state: &SessionState,
merchant_context: domain::MerchantContext,
merchant_id: common_utils::id_type::MerchantId,
payment_id: common_utils::id_type::PaymentId,
) -> RouterResult<(PaymentLink, PaymentLinkData, PaymentLinkConfig)>
|
crates/router/src/core/payment_link.rs
|
router
|
function_signature
| null | null | null | 89
|
form_payment_link_data
| null | null | null | null | null | null |
// Struct: JpmorganErrorResponse
// File: crates/hyperswitch_connectors/src/connectors/jpmorgan/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct JpmorganErrorResponse
|
crates/hyperswitch_connectors/src/connectors/jpmorgan/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
JpmorganErrorResponse
| 0
|
[] | 50
| null | null | null | null | null | null | null |
// Struct: BluesnapWebhookObjectResource
// File: crates/hyperswitch_connectors/src/connectors/bluesnap/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct BluesnapWebhookObjectResource
|
crates/hyperswitch_connectors/src/connectors/bluesnap/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
BluesnapWebhookObjectResource
| 0
|
[] | 54
| null | null | null | null | null | null | null |
// Struct: CeleroCaptureResponse
// File: crates/hyperswitch_connectors/src/connectors/celero/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct CeleroCaptureResponse
|
crates/hyperswitch_connectors/src/connectors/celero/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
CeleroCaptureResponse
| 0
|
[] | 50
| null | null | null | null | null | null | null |
// File: crates/router/tests/connectors/payeezy.rs
// Module: router
use std::str::FromStr;
use cards::CardNumber;
use hyperswitch_domain_models::address::{Address, AddressDetails};
use masking::Secret;
use router::{
core::errors,
types::{self, storage::enums, PaymentsAuthorizeData},
};
use crate::{
connector_auth,
utils::{self, ConnectorActions, PaymentInfo},
};
#[derive(Clone, Copy)]
struct PayeezyTest;
impl ConnectorActions for PayeezyTest {}
static CONNECTOR: PayeezyTest = PayeezyTest {};
impl utils::Connector for PayeezyTest {
fn get_data(&self) -> types::api::ConnectorData {
use router::connector::Payeezy;
utils::construct_connector_data_old(
Box::new(&Payeezy),
// Remove `dummy_connector` feature gate from module in `main.rs` when updating this to use actual connector variant
types::Connector::DummyConnector1,
types::api::GetToken::Connector,
None,
)
}
fn get_auth_token(&self) -> types::ConnectorAuthType {
utils::to_connector_auth_type(
connector_auth::ConnectorAuthentication::new()
.payeezy
.expect("Missing connector authentication configuration")
.into(),
)
}
fn get_name(&self) -> String {
"payeezy".to_string()
}
}
impl PayeezyTest {
fn get_payment_data() -> Option<PaymentsAuthorizeData> {
Some(PaymentsAuthorizeData {
payment_method_data: types::domain::PaymentMethodData::Card(types::domain::Card {
card_number: CardNumber::from_str("4012000033330026").unwrap(),
..utils::CCardType::default().0
}),
..utils::PaymentAuthorizeType::default().0
})
}
fn get_payment_info() -> Option<PaymentInfo> {
Some(PaymentInfo {
address: Some(types::PaymentAddress::new(
None,
Some(Address {
address: Some(AddressDetails {
..Default::default()
}),
phone: None,
email: None,
}),
None,
None,
)),
..Default::default()
})
}
fn get_request_interval(self) -> u64 {
20
}
}
// 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(PayeezyTest::get_payment_data(), None)
.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_payment(PayeezyTest::get_payment_data(), None)
.await
.unwrap();
assert_eq!(response.status, enums::AttemptStatus::Authorized);
let connector_payment_id =
utils::get_connector_transaction_id(response.response.clone()).unwrap_or_default();
let connector_meta = utils::get_connector_metadata(response.response);
let capture_data = types::PaymentsCaptureData {
connector_meta,
..utils::PaymentCaptureType::default().0
};
let capture_response = CONNECTOR
.capture_payment(connector_payment_id, Some(capture_data), None)
.await
.unwrap();
assert_eq!(capture_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_payment(PayeezyTest::get_payment_data(), None)
.await
.unwrap();
assert_eq!(response.status, enums::AttemptStatus::Authorized);
let connector_payment_id =
utils::get_connector_transaction_id(response.response.clone()).unwrap_or_default();
let connector_meta = utils::get_connector_metadata(response.response);
let capture_data = types::PaymentsCaptureData {
connector_meta,
amount_to_capture: 50,
..utils::PaymentCaptureType::default().0
};
let capture_response = CONNECTOR
.capture_payment(connector_payment_id, Some(capture_data), None)
.await
.unwrap();
assert_eq!(capture_response.status, enums::AttemptStatus::Charged);
}
// Synchronizes a payment using the manual capture flow (Non 3DS).
#[actix_web::test]
#[ignore]
async fn should_sync_authorized_payment() {}
// Voids a payment using the manual capture flow (Non 3DS).
#[actix_web::test]
async fn should_void_authorized_payment() {
let response = CONNECTOR
.authorize_payment(PayeezyTest::get_payment_data(), None)
.await
.unwrap();
assert_eq!(response.status, enums::AttemptStatus::Authorized);
let connector_payment_id =
utils::get_connector_transaction_id(response.response.clone()).unwrap_or_default();
let connector_meta = utils::get_connector_metadata(response.response);
tokio::time::sleep(std::time::Duration::from_secs(
CONNECTOR.get_request_interval(),
))
.await; // to avoid 404 error
let response = CONNECTOR
.void_payment(
connector_payment_id,
Some(types::PaymentsCancelData {
connector_meta,
amount: Some(100),
currency: Some(diesel_models::enums::Currency::USD),
..utils::PaymentCancelType::default().0
}),
None,
)
.await
.unwrap();
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 authorize_response = CONNECTOR
.authorize_payment(
PayeezyTest::get_payment_data(),
PayeezyTest::get_payment_info(),
)
.await
.expect("Authorize payment response");
let txn_id = utils::get_connector_transaction_id(authorize_response.response.clone()).unwrap();
let capture_connector_meta = utils::get_connector_metadata(authorize_response.response);
let capture_response = CONNECTOR
.capture_payment(
txn_id.clone(),
Some(types::PaymentsCaptureData {
connector_meta: capture_connector_meta,
..utils::PaymentCaptureType::default().0
}),
PayeezyTest::get_payment_info(),
)
.await
.expect("Capture payment response");
let capture_txn_id =
utils::get_connector_transaction_id(capture_response.response.clone()).unwrap();
let refund_connector_metadata = utils::get_connector_metadata(capture_response.response);
let response = CONNECTOR
.refund_payment(
capture_txn_id.clone(),
Some(types::RefundsData {
connector_transaction_id: capture_txn_id,
connector_metadata: refund_connector_metadata,
..utils::PaymentRefundType::default().0
}),
PayeezyTest::get_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 authorize_response = CONNECTOR
.authorize_payment(
PayeezyTest::get_payment_data(),
PayeezyTest::get_payment_info(),
)
.await
.expect("Authorize payment response");
let txn_id = utils::get_connector_transaction_id(authorize_response.response.clone()).unwrap();
let capture_connector_meta = utils::get_connector_metadata(authorize_response.response);
let capture_response = CONNECTOR
.capture_payment(
txn_id.clone(),
Some(types::PaymentsCaptureData {
connector_meta: capture_connector_meta,
..utils::PaymentCaptureType::default().0
}),
PayeezyTest::get_payment_info(),
)
.await
.expect("Capture payment response");
let capture_txn_id =
utils::get_connector_transaction_id(capture_response.response.clone()).unwrap();
let refund_connector_metadata = utils::get_connector_metadata(capture_response.response);
let response = CONNECTOR
.refund_payment(
capture_txn_id.clone(),
Some(types::RefundsData {
refund_amount: 50,
connector_transaction_id: capture_txn_id,
connector_metadata: refund_connector_metadata,
..utils::PaymentRefundType::default().0
}),
PayeezyTest::get_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]
#[ignore]
async fn should_sync_manually_captured_refund() {}
// Creates a payment using the automatic capture flow (Non 3DS).
#[actix_web::test]
async fn should_make_payment() {
let authorize_response = CONNECTOR
.make_payment(
PayeezyTest::get_payment_data(),
PayeezyTest::get_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]
#[ignore]
async fn should_sync_auto_captured_payment() {}
// Refunds a payment using the automatic capture flow (Non 3DS).
#[actix_web::test]
async fn should_refund_auto_captured_payment() {
let captured_response = CONNECTOR.make_payment(None, None).await.unwrap();
assert_eq!(captured_response.status, enums::AttemptStatus::Charged);
let txn_id = utils::get_connector_transaction_id(captured_response.response.clone());
let connector_meta = utils::get_connector_metadata(captured_response.response);
let response = CONNECTOR
.refund_payment(
txn_id.clone().unwrap(),
Some(types::RefundsData {
refund_amount: 100,
connector_transaction_id: txn_id.unwrap(),
connector_metadata: connector_meta,
..utils::PaymentRefundType::default().0
}),
PayeezyTest::get_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 captured_response = CONNECTOR.make_payment(None, None).await.unwrap();
assert_eq!(captured_response.status, enums::AttemptStatus::Charged);
let txn_id = utils::get_connector_transaction_id(captured_response.response.clone());
let connector_meta = utils::get_connector_metadata(captured_response.response);
let response = CONNECTOR
.refund_payment(
txn_id.clone().unwrap(),
Some(types::RefundsData {
refund_amount: 50,
connector_transaction_id: txn_id.unwrap(),
connector_metadata: connector_meta,
..utils::PaymentRefundType::default().0
}),
PayeezyTest::get_payment_info(),
)
.await
.unwrap();
assert_eq!(
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() {
let captured_response = CONNECTOR.make_payment(None, None).await.unwrap();
assert_eq!(captured_response.status, enums::AttemptStatus::Charged);
let txn_id = utils::get_connector_transaction_id(captured_response.response.clone());
let connector_meta = utils::get_connector_metadata(captured_response.response);
for _x in 0..2 {
let refund_response = CONNECTOR
.refund_payment(
txn_id.clone().unwrap(),
Some(types::RefundsData {
connector_metadata: connector_meta.clone(),
connector_transaction_id: txn_id.clone().unwrap(),
refund_amount: 50,
..utils::PaymentRefundType::default().0
}),
PayeezyTest::get_payment_info(),
)
.await
.unwrap();
assert_eq!(
refund_response.response.unwrap().refund_status,
enums::RefundStatus::Success,
);
}
}
// Synchronizes a refund using the automatic capture flow (Non 3DS).
#[actix_web::test]
#[ignore]
async fn should_sync_refund() {}
// Cards Negative scenarios
// Creates a payment with incorrect card issuer.
#[actix_web::test]
async fn should_throw_not_implemented_for_unsupported_issuer() {
let authorize_data = Some(PaymentsAuthorizeData {
payment_method_data: types::domain::PaymentMethodData::Card(types::domain::Card {
card_number: CardNumber::from_str("630495060000000000").unwrap(),
..utils::CCardType::default().0
}),
capture_method: Some(enums::CaptureMethod::Automatic),
..utils::PaymentAuthorizeType::default().0
});
let response = CONNECTOR
.make_payment(authorize_data, PayeezyTest::get_payment_info())
.await;
assert_eq!(
*response.unwrap_err().current_context(),
errors::ConnectorError::NotSupported {
message: "card".to_string(),
connector: "Payeezy",
}
)
}
// Creates a payment with incorrect CVC.
#[actix_web::test]
async fn should_fail_payment_for_incorrect_cvc() {
let response = CONNECTOR
.make_payment(
Some(PaymentsAuthorizeData {
payment_method_data: types::domain::PaymentMethodData::Card(types::domain::Card {
card_cvc: Secret::new("12345d".to_string()),
..utils::CCardType::default().0
}),
..utils::PaymentAuthorizeType::default().0
}),
None,
)
.await
.unwrap();
assert_eq!(
*response.response.unwrap_err().message,
"The cvv provided must be numeric".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(PaymentsAuthorizeData {
payment_method_data: types::domain::PaymentMethodData::Card(types::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,
"Bad Request (25) - Invalid Expiry Date".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(PaymentsAuthorizeData {
payment_method_data: types::domain::PaymentMethodData::Card(types::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,
"Expiry Date is invalid".to_string(),
);
}
// Voids a payment using automatic capture flow (Non 3DS).
#[actix_web::test]
#[ignore]
async fn should_fail_void_payment_for_auto_capture() {}
// Captures a payment using invalid connector payment id.
#[actix_web::test]
async fn should_fail_capture_for_invalid_payment() {
let connector_payment_id = "12345678".to_string();
let capture_response = CONNECTOR
.capture_payment(
connector_payment_id,
Some(types::PaymentsCaptureData {
connector_meta: Some(
serde_json::json!({"transaction_tag" : "10069306640".to_string()}),
),
amount_to_capture: 50,
..utils::PaymentCaptureType::default().0
}),
None,
)
.await
.unwrap();
assert_eq!(
capture_response.response.unwrap_err().message,
String::from("Bad Request (69) - Invalid Transaction Tag")
);
}
// 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 captured_response = CONNECTOR.make_payment(None, None).await.unwrap();
assert_eq!(captured_response.status, enums::AttemptStatus::Charged);
let txn_id = utils::get_connector_transaction_id(captured_response.response.clone());
let connector_meta = utils::get_connector_metadata(captured_response.response);
let response = CONNECTOR
.refund_payment(
txn_id.clone().unwrap(),
Some(types::RefundsData {
refund_amount: 1500,
connector_transaction_id: txn_id.unwrap(),
connector_metadata: connector_meta,
..utils::PaymentRefundType::default().0
}),
PayeezyTest::get_payment_info(),
)
.await
.unwrap();
assert_eq!(
response.response.unwrap_err().message,
String::from("Bad Request (64) - Invalid Refund"),
);
}
|
crates/router/tests/connectors/payeezy.rs
|
router
|
full_file
| null | null | null | 3,896
| null | null | null | null | null | null | null |
// Implementation: impl api::PaymentSession for for Chargebee
// File: crates/hyperswitch_connectors/src/connectors/chargebee.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::PaymentSession for for Chargebee
|
crates/hyperswitch_connectors/src/connectors/chargebee.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 58
| null |
Chargebee
|
api::PaymentSession for
| 0
| 0
| null | null |
// Struct: WebhookResponse
// File: crates/router/src/core/webhooks/types.rs
// Module: router
// Implementations: 1
pub struct WebhookResponse
|
crates/router/src/core/webhooks/types.rs
|
router
|
struct_definition
|
WebhookResponse
| 1
|
[] | 36
| null | null | null | null | null | null | null |
// Struct: CoingateRefundResponse
// File: crates/hyperswitch_connectors/src/connectors/coingate/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct CoingateRefundResponse
|
crates/hyperswitch_connectors/src/connectors/coingate/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
CoingateRefundResponse
| 0
|
[] | 54
| null | null | null | null | null | null | null |
// Implementation: impl Bluesnap
// File: crates/hyperswitch_connectors/src/connectors/bluesnap.rs
// Module: hyperswitch_connectors
// Methods: 1 total (1 public)
impl Bluesnap
|
crates/hyperswitch_connectors/src/connectors/bluesnap.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 46
| null |
Bluesnap
| null | 1
| 1
| null | null |
// Function: refunds_metadata_update
// File: crates/openapi/src/routes/refunds.rs
// Module: openapi
pub fn refunds_metadata_update()
|
crates/openapi/src/routes/refunds.rs
|
openapi
|
function_signature
| null | null | null | 31
|
refunds_metadata_update
| null | null | null | null | null | null |
// Function: keys
// File: crates/hyperswitch_constraint_graph/src/dense_map.rs
// Module: hyperswitch_constraint_graph
pub fn keys(&self) -> Keys<K>
|
crates/hyperswitch_constraint_graph/src/dense_map.rs
|
hyperswitch_constraint_graph
|
function_signature
| null | null | null | 39
|
keys
| null | null | null | null | null | null |
// Function: map_notification_to_event
// File: crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs
// Module: hyperswitch_connectors
pub fn map_notification_to_event(
status: DmnStatus,
transaction_type: NuveiTransactionType,
) -> Result<api_models::webhooks::IncomingWebhookEvent, error_stack::Report<errors::ConnectorError>>
|
crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs
|
hyperswitch_connectors
|
function_signature
| null | null | null | 87
|
map_notification_to_event
| null | null | null | null | null | null |
// Struct: MandateDetails
// File: crates/hyperswitch_domain_models/src/mandates.rs
// Module: hyperswitch_domain_models
// Implementations: 0
pub struct MandateDetails
|
crates/hyperswitch_domain_models/src/mandates.rs
|
hyperswitch_domain_models
|
struct_definition
|
MandateDetails
| 0
|
[] | 43
| null | null | null | null | null | null | null |
// Function: log_applepay_verification_response_if_error
// File: crates/router/src/core/verification/utils.rs
// Module: router
pub fn log_applepay_verification_response_if_error(
response: &Result<Result<types::Response, types::Response>, Report<errors::ApiClientError>>,
)
|
crates/router/src/core/verification/utils.rs
|
router
|
function_signature
| null | null | null | 63
|
log_applepay_verification_response_if_error
| null | null | null | null | null | null |
// File: crates/hyperswitch_connectors/src/connectors/bluecode.rs
// Module: hyperswitch_connectors
// Public functions: 1
// Public structs: 1
pub mod transformers;
use std::sync::LazyLock;
use common_enums::enums;
use common_utils::{
crypto,
errors::CustomResult,
ext_traits::BytesExt,
request::{Method, Request, RequestBuilder, RequestContent},
types::{AmountConvertor, FloatMajorUnit, FloatMajorUnitForConnector},
};
use error_stack::ResultExt;
use hyperswitch_domain_models::{
payment_method_data::PaymentMethodData,
router_data::{AccessToken, ConnectorAuthType, ErrorResponse, RouterData},
router_flow_types::{
access_token_auth::AccessTokenAuth,
payments::{Authorize, Capture, PSync, PaymentMethodToken, Session, SetupMandate, Void},
refunds::{Execute, RSync},
},
router_request_types::{
AccessTokenRequestData, PaymentMethodTokenizationData, PaymentsAuthorizeData,
PaymentsCancelData, PaymentsCaptureData, PaymentsSessionData, PaymentsSyncData,
RefundsData, SetupMandateRequestData,
},
router_response_types::{
ConnectorInfo, PaymentMethodDetails, PaymentsResponseData, RefundsResponseData,
SupportedPaymentMethods, SupportedPaymentMethodsExt,
},
types::{
PaymentsAuthorizeRouterData, PaymentsCaptureRouterData, PaymentsSyncRouterData,
RefundSyncRouterData, RefundsRouterData,
},
};
use hyperswitch_interfaces::{
api::{
self, ConnectorCommon, ConnectorCommonExt, ConnectorIntegration, ConnectorSpecifications,
ConnectorValidation,
},
configs::Connectors,
consts, errors,
events::connector_api_logs::ConnectorEvent,
types::{self, Response},
webhooks,
};
use masking::{ExposeInterface, Mask, Secret};
use ring::hmac;
use serde_json::Value;
use transformers as bluecode;
use crate::{constants::headers, types::ResponseRouterData, utils};
const BLUECODE_API_VERSION: &str = "v1";
#[derive(Clone)]
pub struct Bluecode {
amount_converter: &'static (dyn AmountConvertor<Output = FloatMajorUnit> + Sync),
}
impl Bluecode {
pub fn new() -> &'static Self {
&Self {
amount_converter: &FloatMajorUnitForConnector,
}
}
}
impl api::Payment for Bluecode {}
impl api::PaymentSession for Bluecode {}
impl api::ConnectorAccessToken for Bluecode {}
impl api::MandateSetup for Bluecode {}
impl api::PaymentAuthorize for Bluecode {}
impl api::PaymentSync for Bluecode {}
impl api::PaymentCapture for Bluecode {}
impl api::PaymentVoid for Bluecode {}
impl api::Refund for Bluecode {}
impl api::RefundExecute for Bluecode {}
impl api::RefundSync for Bluecode {}
impl api::PaymentToken for Bluecode {}
impl ConnectorIntegration<PaymentMethodToken, PaymentMethodTokenizationData, PaymentsResponseData>
for Bluecode
{
// Not Implemented (R)
}
impl<Flow, Request, Response> ConnectorCommonExt<Flow, Request, Response> for Bluecode
where
Self: ConnectorIntegration<Flow, Request, Response>,
{
fn build_headers(
&self,
req: &RouterData<Flow, Request, Response>,
_connectors: &Connectors,
) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
let mut header = vec![(
headers::CONTENT_TYPE.to_string(),
self.get_content_type().to_string().into(),
)];
let mut api_key = self.get_auth_header(&req.connector_auth_type)?;
header.append(&mut api_key);
Ok(header)
}
}
impl ConnectorCommon for Bluecode {
fn id(&self) -> &'static str {
"bluecode"
}
fn get_currency_unit(&self) -> api::CurrencyUnit {
api::CurrencyUnit::Base
}
fn common_get_content_type(&self) -> &'static str {
"application/json"
}
fn base_url<'a>(&self, connectors: &'a Connectors) -> &'a str {
connectors.bluecode.base_url.as_ref()
}
fn get_auth_header(
&self,
auth_type: &ConnectorAuthType,
) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
let auth = bluecode::BluecodeAuthType::try_from(auth_type)
.change_context(errors::ConnectorError::FailedToObtainAuthType)?;
Ok(vec![(
headers::AUTHORIZATION.to_string(),
format!("token {}", auth.api_key.expose()).into_masked(),
)])
}
fn build_error_response(
&self,
res: Response,
event_builder: Option<&mut ConnectorEvent>,
) -> CustomResult<ErrorResponse, errors::ConnectorError> {
let response: bluecode::BluecodeErrorResponse = res
.response
.parse_struct("BluecodeErrorResponse")
.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: consts::NO_ERROR_CODE.to_string(),
message: response.message.clone(),
reason: Some(response.message),
attempt_status: None,
connector_transaction_id: None,
network_advice_code: None,
network_decline_code: None,
network_error_message: None,
connector_metadata: None,
})
}
}
impl ConnectorValidation for Bluecode {
fn validate_mandate_payment(
&self,
_pm_type: Option<enums::PaymentMethodType>,
pm_data: PaymentMethodData,
) -> CustomResult<(), errors::ConnectorError> {
match pm_data {
PaymentMethodData::Card(_) => Err(errors::ConnectorError::NotImplemented(
"validate_mandate_payment does not support cards".to_string(),
)
.into()),
_ => Ok(()),
}
}
fn validate_psync_reference_id(
&self,
_data: &PaymentsSyncData,
_is_three_ds: bool,
_status: enums::AttemptStatus,
_connector_meta_data: Option<common_utils::pii::SecretSerdeValue>,
) -> CustomResult<(), errors::ConnectorError> {
Ok(())
}
}
impl ConnectorIntegration<Session, PaymentsSessionData, PaymentsResponseData> for Bluecode {}
impl ConnectorIntegration<AccessTokenAuth, AccessTokenRequestData, AccessToken> for Bluecode {}
impl ConnectorIntegration<SetupMandate, SetupMandateRequestData, PaymentsResponseData>
for Bluecode
{
}
impl ConnectorIntegration<Authorize, PaymentsAuthorizeData, PaymentsResponseData> for Bluecode {
fn get_headers(
&self,
req: &PaymentsAuthorizeRouterData,
connectors: &Connectors,
) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
self.build_headers(req, connectors)
}
fn get_content_type(&self) -> &'static str {
self.common_get_content_type()
}
fn get_url(
&self,
_req: &PaymentsAuthorizeRouterData,
connectors: &Connectors,
) -> CustomResult<String, errors::ConnectorError> {
Ok(format!(
"{}api/{}/order/payin/start",
self.base_url(connectors),
BLUECODE_API_VERSION
))
}
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 = bluecode::BluecodeRouterData::from((amount, req));
let connector_req = bluecode::BluecodePaymentsRequest::try_from(&connector_router_data)?;
Ok(RequestContent::Json(Box::new(connector_req)))
}
fn build_request(
&self,
req: &PaymentsAuthorizeRouterData,
connectors: &Connectors,
) -> CustomResult<Option<Request>, errors::ConnectorError> {
Ok(Some(
RequestBuilder::new()
.method(Method::Post)
.url(&types::PaymentsAuthorizeType::get_url(
self, req, connectors,
)?)
.attach_default_headers()
.headers(types::PaymentsAuthorizeType::get_headers(
self, req, connectors,
)?)
.set_body(types::PaymentsAuthorizeType::get_request_body(
self, req, connectors,
)?)
.build(),
))
}
fn handle_response(
&self,
data: &PaymentsAuthorizeRouterData,
event_builder: Option<&mut ConnectorEvent>,
res: Response,
) -> CustomResult<PaymentsAuthorizeRouterData, errors::ConnectorError> {
let response: bluecode::BluecodePaymentsResponse = res
.response
.parse_struct("Bluecode PaymentsAuthorizeResponse")
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
event_builder.map(|i| i.set_response_body(&response));
router_env::logger::info!(connector_response=?response);
let response_integrity_object = utils::get_authorise_integrity_object(
self.amount_converter,
response.amount,
response.currency.to_string(),
)?;
let new_router_data = RouterData::try_from(ResponseRouterData {
response,
data: data.clone(),
http_code: res.status_code,
});
new_router_data
.change_context(errors::ConnectorError::ResponseHandlingFailed)
.map(|mut router_data| {
router_data.request.integrity_object = Some(response_integrity_object);
router_data
})
}
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 Bluecode {
fn get_headers(
&self,
req: &PaymentsSyncRouterData,
connectors: &Connectors,
) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
self.build_headers(req, connectors)
}
fn get_content_type(&self) -> &'static str {
self.common_get_content_type()
}
fn get_url(
&self,
req: &PaymentsSyncRouterData,
connectors: &Connectors,
) -> CustomResult<String, errors::ConnectorError> {
let connector_transaction_id = req
.request
.connector_transaction_id
.get_connector_transaction_id()
.change_context(errors::ConnectorError::MissingConnectorTransactionID)?;
Ok(format!(
"{}api/{}/order/{}/status",
self.base_url(connectors),
BLUECODE_API_VERSION,
connector_transaction_id
))
}
fn build_request(
&self,
req: &PaymentsSyncRouterData,
connectors: &Connectors,
) -> CustomResult<Option<Request>, errors::ConnectorError> {
Ok(Some(
RequestBuilder::new()
.method(Method::Get)
.url(&types::PaymentsSyncType::get_url(self, req, connectors)?)
.attach_default_headers()
.headers(types::PaymentsSyncType::get_headers(self, req, connectors)?)
.build(),
))
}
fn handle_response(
&self,
data: &PaymentsSyncRouterData,
event_builder: Option<&mut ConnectorEvent>,
res: Response,
) -> CustomResult<PaymentsSyncRouterData, errors::ConnectorError> {
let response: bluecode::BluecodeSyncResponse = res
.response
.parse_struct("bluecode PaymentsSyncResponse")
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
event_builder.map(|i| i.set_response_body(&response));
router_env::logger::info!(connector_response=?response);
let response_integrity_object = utils::get_sync_integrity_object(
self.amount_converter,
response.amount,
response.currency.to_string(),
)?;
let new_router_data = RouterData::try_from(ResponseRouterData {
response,
data: data.clone(),
http_code: res.status_code,
});
new_router_data
.change_context(errors::ConnectorError::ResponseHandlingFailed)
.map(|mut router_data| {
router_data.request.integrity_object = Some(response_integrity_object);
router_data
})
}
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 Bluecode {
fn get_headers(
&self,
req: &PaymentsCaptureRouterData,
connectors: &Connectors,
) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
self.build_headers(req, connectors)
}
fn get_content_type(&self) -> &'static str {
self.common_get_content_type()
}
fn get_url(
&self,
_req: &PaymentsCaptureRouterData,
_connectors: &Connectors,
) -> CustomResult<String, errors::ConnectorError> {
Err(errors::ConnectorError::FlowNotSupported {
flow: "Capture".to_string(),
connector: "Bluecode".to_string(),
}
.into())
}
fn get_request_body(
&self,
_req: &PaymentsCaptureRouterData,
_connectors: &Connectors,
) -> CustomResult<RequestContent, errors::ConnectorError> {
Err(errors::ConnectorError::FlowNotSupported {
flow: "Capture".to_string(),
connector: "Bluecode".to_string(),
}
.into())
}
fn build_request(
&self,
req: &PaymentsCaptureRouterData,
connectors: &Connectors,
) -> CustomResult<Option<Request>, errors::ConnectorError> {
Ok(Some(
RequestBuilder::new()
.method(Method::Post)
.url(&types::PaymentsCaptureType::get_url(self, req, connectors)?)
.attach_default_headers()
.headers(types::PaymentsCaptureType::get_headers(
self, req, connectors,
)?)
.set_body(types::PaymentsCaptureType::get_request_body(
self, req, connectors,
)?)
.build(),
))
}
fn handle_response(
&self,
data: &PaymentsCaptureRouterData,
event_builder: Option<&mut ConnectorEvent>,
res: Response,
) -> CustomResult<PaymentsCaptureRouterData, errors::ConnectorError> {
let response: bluecode::BluecodePaymentsResponse = res
.response
.parse_struct("Bluecode 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 Bluecode {}
impl ConnectorIntegration<Execute, RefundsData, RefundsResponseData> for Bluecode {
fn get_headers(
&self,
req: &RefundsRouterData<Execute>,
connectors: &Connectors,
) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
self.build_headers(req, connectors)
}
fn get_content_type(&self) -> &'static str {
self.common_get_content_type()
}
fn get_url(
&self,
_req: &RefundsRouterData<Execute>,
_connectors: &Connectors,
) -> CustomResult<String, errors::ConnectorError> {
Err(errors::ConnectorError::FlowNotSupported {
flow: "Refund".to_string(),
connector: "Bluecode".to_string(),
}
.into())
}
fn get_request_body(
&self,
_req: &RefundsRouterData<Execute>,
_connectors: &Connectors,
) -> CustomResult<RequestContent, errors::ConnectorError> {
Err(errors::ConnectorError::FlowNotSupported {
flow: "Refund".to_string(),
connector: "Bluecode".to_string(),
}
.into())
}
fn build_request(
&self,
req: &RefundsRouterData<Execute>,
connectors: &Connectors,
) -> CustomResult<Option<Request>, errors::ConnectorError> {
let request = RequestBuilder::new()
.method(Method::Post)
.url(&types::RefundExecuteType::get_url(self, req, connectors)?)
.attach_default_headers()
.headers(types::RefundExecuteType::get_headers(
self, req, connectors,
)?)
.set_body(types::RefundExecuteType::get_request_body(
self, req, connectors,
)?)
.build();
Ok(Some(request))
}
fn handle_response(
&self,
data: &RefundsRouterData<Execute>,
event_builder: Option<&mut ConnectorEvent>,
res: Response,
) -> CustomResult<RefundsRouterData<Execute>, errors::ConnectorError> {
let response: bluecode::RefundResponse = res
.response
.parse_struct("bluecode RefundResponse")
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
event_builder.map(|i| i.set_response_body(&response));
router_env::logger::info!(connector_response=?response);
RouterData::try_from(ResponseRouterData {
response,
data: data.clone(),
http_code: res.status_code,
})
}
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 Bluecode {
fn get_headers(
&self,
req: &RefundSyncRouterData,
connectors: &Connectors,
) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
self.build_headers(req, connectors)
}
fn get_content_type(&self) -> &'static str {
self.common_get_content_type()
}
fn get_url(
&self,
_req: &RefundSyncRouterData,
_connectors: &Connectors,
) -> CustomResult<String, errors::ConnectorError> {
Err(errors::ConnectorError::FlowNotSupported {
flow: "RSync".to_string(),
connector: "Bluecode".to_string(),
}
.into())
}
fn build_request(
&self,
_req: &RefundSyncRouterData,
_connectors: &Connectors,
) -> CustomResult<Option<Request>, errors::ConnectorError> {
Err(errors::ConnectorError::FlowNotSupported {
flow: "RSync".to_string(),
connector: "Bluecode".to_string(),
}
.into())
}
fn handle_response(
&self,
data: &RefundSyncRouterData,
event_builder: Option<&mut ConnectorEvent>,
res: Response,
) -> CustomResult<RefundSyncRouterData, errors::ConnectorError> {
let response: bluecode::RefundResponse = res
.response
.parse_struct("bluecode RefundSyncResponse")
.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 Bluecode {
fn get_webhook_source_verification_algorithm(
&self,
_request: &webhooks::IncomingWebhookRequestDetails<'_>,
) -> CustomResult<Box<dyn crypto::VerifySignature + Send>, errors::ConnectorError> {
Ok(Box::new(crypto::HmacSha512))
}
fn get_webhook_source_verification_signature(
&self,
request: &webhooks::IncomingWebhookRequestDetails<'_>,
_connector_webhook_secrets: &api_models::webhooks::ConnectorWebhookSecrets,
) -> CustomResult<Vec<u8>, errors::ConnectorError> {
let security_header = request
.headers
.get("x-eorder-webhook-signature")
.map(|header_value| {
header_value
.to_str()
.map(String::from)
.map_err(|_| errors::ConnectorError::WebhookSignatureNotFound)
})
.ok_or(errors::ConnectorError::WebhookSignatureNotFound)??;
hex::decode(security_header)
.change_context(errors::ConnectorError::WebhookSignatureNotFound)
}
async fn verify_webhook_source(
&self,
request: &webhooks::IncomingWebhookRequestDetails<'_>,
merchant_id: &common_utils::id_type::MerchantId,
connector_webhook_details: Option<common_utils::pii::SecretSerdeValue>,
_connector_account_details: crypto::Encryptable<Secret<Value>>,
connector_name: &str,
) -> CustomResult<bool, errors::ConnectorError> {
let connector_webhook_secrets = self
.get_webhook_source_verification_merchant_secret(
merchant_id,
connector_name,
connector_webhook_details,
)
.await?;
let signature = self
.get_webhook_source_verification_signature(request, &connector_webhook_secrets)
.change_context(errors::ConnectorError::WebhookSignatureNotFound)?;
let secret_bytes = connector_webhook_secrets.secret.as_ref();
let parsed: Value = serde_json::from_slice(request.body)
.map_err(|_| errors::ConnectorError::WebhookSourceVerificationFailed)?;
let sorted_payload = bluecode::sort_and_minify_json(&parsed)?;
let key = hmac::Key::new(hmac::HMAC_SHA512, secret_bytes);
let verify = hmac::verify(&key, sorted_payload.as_bytes(), &signature)
.map(|_| true)
.map_err(|_| errors::ConnectorError::WebhookSourceVerificationFailed)?;
Ok(verify)
}
fn get_webhook_object_reference_id(
&self,
request: &webhooks::IncomingWebhookRequestDetails<'_>,
) -> CustomResult<api_models::webhooks::ObjectReferenceId, errors::ConnectorError> {
let webhook_body = transformers::get_webhook_object_from_body(request.body)
.change_context(errors::ConnectorError::WebhookReferenceIdNotFound)?;
Ok(api_models::webhooks::ObjectReferenceId::PaymentId(
api_models::payments::PaymentIdType::ConnectorTransactionId(webhook_body.order_id),
))
}
fn get_webhook_event_type(
&self,
request: &webhooks::IncomingWebhookRequestDetails<'_>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
let webhook_body = transformers::get_webhook_object_from_body(request.body)
.change_context(errors::ConnectorError::WebhookEventTypeNotFound)?;
Ok(transformers::get_bluecode_webhook_event(
webhook_body.status,
))
}
fn get_webhook_resource_object(
&self,
request: &webhooks::IncomingWebhookRequestDetails<'_>,
) -> CustomResult<Box<dyn masking::ErasedMaskSerialize>, errors::ConnectorError> {
let webhook_body = transformers::get_webhook_object_from_body(request.body)
.change_context(errors::ConnectorError::WebhookEventTypeNotFound)?;
Ok(Box::new(webhook_body))
}
}
static BLUECODE_SUPPORTED_PAYMENT_METHODS: LazyLock<SupportedPaymentMethods> =
LazyLock::new(|| {
let supported_capture_methods = vec![enums::CaptureMethod::Automatic];
let mut santander_supported_payment_methods = SupportedPaymentMethods::new();
santander_supported_payment_methods.add(
enums::PaymentMethod::Wallet,
enums::PaymentMethodType::Bluecode,
PaymentMethodDetails {
mandates: enums::FeatureStatus::NotSupported,
refunds: enums::FeatureStatus::NotSupported,
supported_capture_methods,
specific_features: None,
},
);
santander_supported_payment_methods
});
static BLUECODE_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo {
display_name: "Bluecode",
description: "Bluecode is building a global payment network that combines Alipay+, Discover and EMPSA and enables seamless payments in 75 countries. With over 160 million acceptance points, payments are processed according to the highest European security and data protection standards to make Europe less dependent on international players.",
connector_type: enums::HyperswitchConnectorCategory::AlternativePaymentMethod,
integration_status: enums::ConnectorIntegrationStatus::Alpha,
};
static BLUECODE_SUPPORTED_WEBHOOK_FLOWS: [enums::EventClass; 1] = [enums::EventClass::Payments];
impl ConnectorSpecifications for Bluecode {
fn get_connector_about(&self) -> Option<&'static ConnectorInfo> {
Some(&BLUECODE_CONNECTOR_INFO)
}
fn get_supported_payment_methods(&self) -> Option<&'static SupportedPaymentMethods> {
Some(&*BLUECODE_SUPPORTED_PAYMENT_METHODS)
}
fn get_supported_webhook_flows(&self) -> Option<&'static [enums::EventClass]> {
Some(&BLUECODE_SUPPORTED_WEBHOOK_FLOWS)
}
}
|
crates/hyperswitch_connectors/src/connectors/bluecode.rs
|
hyperswitch_connectors
|
full_file
| null | null | null | 5,699
| null | null | null | null | null | null | null |
// Struct: StripebillingRecoveryDetailsData
// File: crates/hyperswitch_connectors/src/connectors/stripebilling/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct StripebillingRecoveryDetailsData
|
crates/hyperswitch_connectors/src/connectors/stripebilling/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
StripebillingRecoveryDetailsData
| 0
|
[] | 54
| null | null | null | null | null | null | null |
// Struct: FraudCheckUpdateInternal
// File: crates/diesel_models/src/fraud_check.rs
// Module: diesel_models
// Implementations: 0
pub struct FraudCheckUpdateInternal
|
crates/diesel_models/src/fraud_check.rs
|
diesel_models
|
struct_definition
|
FraudCheckUpdateInternal
| 0
|
[] | 40
| null | null | null | null | null | null | null |
// Struct: AuthorizeSessionToken
// File: crates/hyperswitch_domain_models/src/router_flow_types/payments.rs
// Module: hyperswitch_domain_models
// Implementations: 0
pub struct AuthorizeSessionToken
|
crates/hyperswitch_domain_models/src/router_flow_types/payments.rs
|
hyperswitch_domain_models
|
struct_definition
|
AuthorizeSessionToken
| 0
|
[] | 47
| null | null | null | null | null | null | null |
amount_capturable: None,
merchant_connector_id: None,
authentication_data: None,
encoded_data: None,
external_three_ds_authentication_attempted: None,
authentication_connector: None,
authentication_id: None,
fingerprint_id: None,
payment_method_billing_address_id: None,
client_source: None,
client_version: None,
customer_acceptance: None,
card_network: None,
shipping_cost: None,
capture_before: None,
extended_authorization_applied: None,
order_tax_amount: None,
connector_mandate_detail: None,
card_discovery: None,
charges: None,
issuer_error_code: None,
issuer_error_message: None,
setup_future_usage_applied: None,
routing_approach: None,
connector_request_reference_id: None,
network_transaction_id: None,
is_overcapture_enabled: None,
network_details: None,
is_stored_credential: None,
request_extended_authorization: None,
}
}
PaymentAttemptUpdate::PostSessionTokensUpdate {
updated_by,
connector_metadata,
} => Self {
status: None,
error_code: None,
modified_at: common_utils::date_time::now(),
error_message: None,
error_reason: None,
updated_by,
unified_code: None,
unified_message: None,
amount: None,
net_amount: None,
currency: None,
connector_transaction_id: None,
amount_to_capture: None,
connector: None,
authentication_type: None,
payment_method: None,
payment_method_id: None,
cancellation_reason: None,
mandate_id: None,
browser_info: None,
payment_token: None,
connector_metadata,
payment_method_data: None,
payment_method_type: None,
payment_experience: None,
business_sub_label: None,
straight_through_algorithm: None,
preprocessing_step_id: None,
capture_method: None,
connector_response_reference_id: None,
multiple_capture_count: None,
surcharge_amount: None,
tax_amount: None,
amount_capturable: None,
merchant_connector_id: None,
authentication_data: None,
encoded_data: None,
external_three_ds_authentication_attempted: None,
authentication_connector: None,
authentication_id: None,
fingerprint_id: None,
payment_method_billing_address_id: None,
client_source: None,
client_version: None,
customer_acceptance: None,
card_network: None,
shipping_cost: None,
order_tax_amount: None,
capture_before: None,
extended_authorization_applied: None,
processor_transaction_data: None,
connector_mandate_detail: None,
card_discovery: None,
charges: None,
issuer_error_code: None,
issuer_error_message: None,
setup_future_usage_applied: None,
routing_approach: None,
connector_request_reference_id: None,
network_transaction_id: None,
is_overcapture_enabled: None,
network_details: None,
is_stored_credential: None,
request_extended_authorization: None,
},
}
}
}
#[derive(Eq, PartialEq, Clone, Debug, Deserialize, Serialize, diesel::AsExpression)]
#[diesel(sql_type = diesel::sql_types::Jsonb)]
pub enum RedirectForm {
Form {
endpoint: String,
method: common_utils::request::Method,
form_fields: std::collections::HashMap<String, String>,
},
Html {
html_data: String,
},
BarclaycardAuthSetup {
access_token: String,
ddc_url: String,
reference_id: String,
},
BarclaycardConsumerAuth {
access_token: String,
step_up_url: String,
},
BlueSnap {
payment_fields_token: String,
},
CybersourceAuthSetup {
access_token: String,
ddc_url: String,
reference_id: String,
},
CybersourceConsumerAuth {
access_token: String,
step_up_url: String,
},
DeutschebankThreeDSChallengeFlow {
acs_url: String,
creq: String,
},
Payme,
Braintree {
client_token: String,
card_token: String,
bin: String,
acs_url: String,
},
Nmi {
amount: String,
currency: common_enums::Currency,
public_key: masking::Secret<String>,
customer_vault_id: String,
order_id: String,
},
Mifinity {
initialization_token: String,
},
WorldpayDDCForm {
endpoint: common_utils::types::Url,
method: common_utils::request::Method,
form_fields: std::collections::HashMap<String, String>,
collection_id: Option<String>,
},
}
common_utils::impl_to_sql_from_sql_json!(RedirectForm);
#[cfg(feature = "v2")]
#[derive(
Clone, Debug, serde::Deserialize, serde::Serialize, Eq, PartialEq, diesel::AsExpression,
)]
#[diesel(sql_type = diesel::pg::sql_types::Jsonb)]
pub struct PaymentAttemptFeatureMetadata {
pub revenue_recovery: Option<PaymentAttemptRecoveryData>,
}
#[cfg(feature = "v2")]
#[derive(
Clone, Debug, serde::Deserialize, serde::Serialize, Eq, PartialEq, diesel::AsExpression,
)]
#[diesel(sql_type = diesel::pg::sql_types::Jsonb)]
pub struct PaymentAttemptRecoveryData {
pub attempt_triggered_by: common_enums::TriggeredBy,
// stripe specific field used to identify duplicate attempts.
pub charge_id: Option<String>,
}
#[cfg(feature = "v2")]
common_utils::impl_to_sql_from_sql_json!(PaymentAttemptFeatureMetadata);
mod tests {
#[test]
fn test_backwards_compatibility() {
let serialized_payment_attempt = r#"{
"payment_id": "PMT123456789",
"merchant_id": "M123456789",
"attempt_id": "ATMPT123456789",
"status": "pending",
"amount": 10000,
"currency": "USD",
"save_to_locker": true,
"connector": "stripe",
"error_message": null,
"offer_amount": 9500,
"surcharge_amount": 500,
"tax_amount": 800,
"payment_method_id": "CRD123456789",
"payment_method": "card",
"connector_transaction_id": "CNTR123456789",
"capture_method": "automatic",
"capture_on": "2022-09-10T10:11:12Z",
"confirm": false,
"authentication_type": "no_three_ds",
"created_at": "2024-02-26T12:00:00Z",
"modified_at": "2024-02-26T12:00:00Z",
"last_synced": null,
"cancellation_reason": null,
"amount_to_capture": 10000,
"mandate_id": null,
"browser_info": {
"user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
"accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
"language": "nl-NL",
"color_depth": 24,
"screen_height": 723,
"screen_width": 1536,
"time_zone": 0,
"java_enabled": true,
"java_script_enabled": true,
"ip_address": "127.0.0.1"
},
"error_code": null,
"payment_token": "TOKEN123456789",
"connector_metadata": null,
"payment_experience": "redirect_to_url",
"payment_method_type": "credit",
"payment_method_data": {
"card": {
"card_number": "4242424242424242",
"card_exp_month": "10",
"card_cvc": "123",
"card_exp_year": "2024",
"card_holder_name": "John Doe"
}
},
"business_sub_label": "Premium",
"straight_through_algorithm": null,
"preprocessing_step_id": null,
"mandate_details": null,
"error_reason": null,
"multiple_capture_count": 0,
"connector_response_reference_id": null,
"amount_capturable": 10000,
"updated_by": "redis_kv",
"merchant_connector_id": "MCN123456789",
"authentication_data": null,
"encoded_data": null,
"unified_code": null,
"unified_message": null,
"net_amount": 10200,
"mandate_data": {
"customer_acceptance": {
"acceptance_type": "offline",
"accepted_at": "1963-05-03T04:07:52.723Z",
"online": {
"ip_address": "127.0.0.1",
"user_agent": "amet irure esse"
}
},
"single_use": {
"amount": 6540,
"currency": "USD"
}
}
},
"fingerprint_id": null
}"#;
let deserialized =
serde_json::from_str::<super::PaymentAttempt>(serialized_payment_attempt);
assert!(deserialized.is_ok());
}
}
|
crates/diesel_models/src/payment_attempt.rs#chunk4
|
diesel_models
|
chunk
| null | null | null | 2,211
| null | null | null | null | null | null | null |
// Struct: StaxPaymentsRequest
// File: crates/hyperswitch_connectors/src/connectors/stax/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct StaxPaymentsRequest
|
crates/hyperswitch_connectors/src/connectors/stax/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
StaxPaymentsRequest
| 0
|
[] | 49
| null | null | null | null | null | null | null |
// Struct: CurrencyFactors
// File: crates/currency_conversion/src/types.rs
// Module: currency_conversion
// Implementations: 1
pub struct CurrencyFactors
|
crates/currency_conversion/src/types.rs
|
currency_conversion
|
struct_definition
|
CurrencyFactors
| 1
|
[] | 34
| null | null | null | null | null | null | null |
// Function: get_analysis_trace
// File: crates/hyperswitch_constraint_graph/src/error.rs
// Module: hyperswitch_constraint_graph
pub fn get_analysis_trace(self) -> Result<Weak<AnalysisTrace<V>>, Self>
|
crates/hyperswitch_constraint_graph/src/error.rs
|
hyperswitch_constraint_graph
|
function_signature
| null | null | null | 47
|
get_analysis_trace
| null | null | null | null | null | null |
// Implementation: impl api::PaymentSession for for HyperswitchVault
// File: crates/hyperswitch_connectors/src/connectors/hyperswitch_vault.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::PaymentSession for for HyperswitchVault
|
crates/hyperswitch_connectors/src/connectors/hyperswitch_vault.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 65
| null |
HyperswitchVault
|
api::PaymentSession for
| 0
| 0
| null | null |
// Struct: TokenexErrorResponse
// File: crates/hyperswitch_connectors/src/connectors/tokenex/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct TokenexErrorResponse
|
crates/hyperswitch_connectors/src/connectors/tokenex/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
TokenexErrorResponse
| 0
|
[] | 47
| null | null | null | null | null | null | null |
// Struct: NoonBilling
// File: crates/hyperswitch_connectors/src/connectors/noon/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct NoonBilling
|
crates/hyperswitch_connectors/src/connectors/noon/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
NoonBilling
| 0
|
[] | 45
| null | null | null | null | null | null | null |
// File: crates/router/src/core/files.rs
// Module: router
// Public functions: 3
pub mod helpers;
use api_models::files;
use error_stack::ResultExt;
use super::errors::{self, RouterResponse};
use crate::{
consts,
routes::SessionState,
services::ApplicationResponse,
types::{api, domain},
};
pub async fn files_create_core(
state: SessionState,
merchant_context: domain::MerchantContext,
create_file_request: api::CreateFileRequest,
) -> RouterResponse<files::CreateFileResponse> {
helpers::validate_file_upload(
&state,
merchant_context.clone(),
create_file_request.clone(),
)
.await?;
let file_id = common_utils::generate_id(consts::ID_LENGTH, "file");
let file_key = format!(
"{}/{}",
merchant_context
.get_merchant_account()
.get_id()
.get_string_repr(),
file_id
);
let file_new: diesel_models::FileMetadataNew = diesel_models::file::FileMetadataNew {
file_id: file_id.clone(),
merchant_id: merchant_context.get_merchant_account().get_id().clone(),
file_name: create_file_request.file_name.clone(),
file_size: create_file_request.file_size,
file_type: create_file_request.file_type.to_string(),
provider_file_id: None,
file_upload_provider: None,
available: false,
connector_label: None,
profile_id: None,
merchant_connector_id: None,
};
let file_metadata_object = state
.store
.insert_file_metadata(file_new)
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Unable to insert file_metadata")?;
let (provider_file_id, file_upload_provider, profile_id, merchant_connector_id) = Box::pin(
helpers::upload_and_get_provider_provider_file_id_profile_id(
&state,
&merchant_context,
&create_file_request,
file_key.clone(),
),
)
.await?;
// Update file metadata
let update_file_metadata = diesel_models::file::FileMetadataUpdate::Update {
provider_file_id: Some(provider_file_id),
file_upload_provider: Some(file_upload_provider),
available: true,
profile_id,
merchant_connector_id,
};
state
.store
.as_ref()
.update_file_metadata(file_metadata_object, update_file_metadata)
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable_lazy(|| {
format!("Unable to update file_metadata with file_id: {file_id}")
})?;
Ok(ApplicationResponse::Json(files::CreateFileResponse {
file_id,
}))
}
pub async fn files_delete_core(
state: SessionState,
merchant_context: domain::MerchantContext,
req: api::FileId,
) -> RouterResponse<serde_json::Value> {
helpers::delete_file_using_file_id(&state, req.file_id.clone(), &merchant_context).await?;
state
.store
.as_ref()
.delete_file_metadata_by_merchant_id_file_id(
merchant_context.get_merchant_account().get_id(),
&req.file_id,
)
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Unable to delete file_metadata")?;
Ok(ApplicationResponse::StatusOk)
}
pub async fn files_retrieve_core(
state: SessionState,
merchant_context: domain::MerchantContext,
req: api::FileRetrieveRequest,
) -> RouterResponse<serde_json::Value> {
let file_metadata_object = state
.store
.as_ref()
.find_file_metadata_by_merchant_id_file_id(
merchant_context.get_merchant_account().get_id(),
&req.file_id,
)
.await
.change_context(errors::ApiErrorResponse::FileNotFound)
.attach_printable("Unable to retrieve file_metadata")?;
let file_info = helpers::retrieve_file_and_provider_file_id_from_file_id(
&state,
Some(req.file_id),
req.dispute_id,
&merchant_context,
api::FileDataRequired::Required,
)
.await?;
let content_type = file_metadata_object
.file_type
.parse::<mime::Mime>()
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Failed to parse file content type")?;
Ok(ApplicationResponse::FileData((
file_info
.file_data
.ok_or(errors::ApiErrorResponse::FileNotAvailable)
.attach_printable("File data not found")?,
content_type,
)))
}
|
crates/router/src/core/files.rs
|
router
|
full_file
| null | null | null | 996
| null | null | null | null | null | null | null |
// Struct: Shift4ThreeDsResponse
// File: crates/hyperswitch_connectors/src/connectors/shift4/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct Shift4ThreeDsResponse
|
crates/hyperswitch_connectors/src/connectors/shift4/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
Shift4ThreeDsResponse
| 0
|
[] | 52
| null | null | null | null | null | null | null |
// Function: is_sso_auth_type
// File: crates/router/src/utils/user.rs
// Module: router
pub fn is_sso_auth_type(auth_type: UserAuthType) -> bool
|
crates/router/src/utils/user.rs
|
router
|
function_signature
| null | null | null | 40
|
is_sso_auth_type
| null | null | null | null | null | null |
// File: crates/router/src/compatibility/stripe/refunds.rs
// Module: router
// Public functions: 4
pub mod types;
use actix_web::{web, HttpRequest, HttpResponse};
use error_stack::report;
use router_env::{instrument, tracing, Flow, Tag};
use crate::{
compatibility::{stripe::errors, wrap},
core::{api_locking, refunds},
db::domain,
logger, routes,
services::{api, authentication as auth},
types::api::refunds as refund_types,
};
#[instrument(skip_all, fields(flow = ?Flow::RefundsCreate, payment_id))]
pub async fn refund_create(
state: web::Data<routes::AppState>,
qs_config: web::Data<serde_qs::Config>,
req: HttpRequest,
form_payload: web::Bytes,
) -> HttpResponse {
let payload: types::StripeCreateRefundRequest = match qs_config
.deserialize_bytes(&form_payload)
.map_err(|err| report!(errors::StripeErrorCode::from(err)))
{
Ok(p) => p,
Err(err) => return api::log_and_return_error_response(err),
};
tracing::Span::current().record("payment_id", payload.payment_intent.get_string_repr());
logger::info!(tag = ?Tag::CompatibilityLayerRequest, payload = ?payload);
let create_refund_req: refund_types::RefundRequest = payload.into();
let flow = Flow::RefundsCreate;
Box::pin(wrap::compatibility_api_wrap::<
_,
_,
_,
_,
_,
types::StripeRefundResponse,
errors::StripeErrorCode,
_,
>(
flow,
state.into_inner(),
&req,
create_refund_req,
|state, auth: auth::AuthenticationData, req, _| {
let merchant_context = domain::MerchantContext::NormalMerchant(Box::new(
domain::Context(auth.merchant_account, auth.key_store),
));
refunds::refund_create_core(state, merchant_context, None, req)
},
&auth::HeaderAuth(auth::ApiKeyAuth {
is_connected_allowed: false,
is_platform_allowed: false,
}),
api_locking::LockAction::NotApplicable,
))
.await
}
#[instrument(skip_all, fields(flow))]
pub async fn refund_retrieve_with_gateway_creds(
state: web::Data<routes::AppState>,
qs_config: web::Data<serde_qs::Config>,
req: HttpRequest,
form_payload: web::Bytes,
) -> HttpResponse {
let refund_request: refund_types::RefundsRetrieveRequest = match qs_config
.deserialize_bytes(&form_payload)
.map_err(|err| report!(errors::StripeErrorCode::from(err)))
{
Ok(payload) => payload,
Err(err) => return api::log_and_return_error_response(err),
};
let flow = match refund_request.force_sync {
Some(true) => Flow::RefundsRetrieveForceSync,
_ => Flow::RefundsRetrieve,
};
tracing::Span::current().record("flow", flow.to_string());
Box::pin(wrap::compatibility_api_wrap::<
_,
_,
_,
_,
_,
types::StripeRefundResponse,
errors::StripeErrorCode,
_,
>(
flow,
state.into_inner(),
&req,
refund_request,
|state, auth: auth::AuthenticationData, refund_request, _| {
let merchant_context = domain::MerchantContext::NormalMerchant(Box::new(
domain::Context(auth.merchant_account, auth.key_store),
));
refunds::refund_response_wrapper(
state,
merchant_context,
None,
refund_request,
refunds::refund_retrieve_core_with_refund_id,
)
},
&auth::HeaderAuth(auth::ApiKeyAuth {
is_connected_allowed: false,
is_platform_allowed: false,
}),
api_locking::LockAction::NotApplicable,
))
.await
}
#[instrument(skip_all, fields(flow = ?Flow::RefundsRetrieveForceSync))]
pub async fn refund_retrieve(
state: web::Data<routes::AppState>,
req: HttpRequest,
path: web::Path<String>,
) -> HttpResponse {
let refund_request = refund_types::RefundsRetrieveRequest {
refund_id: path.into_inner(),
force_sync: Some(true),
merchant_connector_details: None,
};
let flow = Flow::RefundsRetrieveForceSync;
Box::pin(wrap::compatibility_api_wrap::<
_,
_,
_,
_,
_,
types::StripeRefundResponse,
errors::StripeErrorCode,
_,
>(
flow,
state.into_inner(),
&req,
refund_request,
|state, auth: auth::AuthenticationData, refund_request, _| {
let merchant_context = domain::MerchantContext::NormalMerchant(Box::new(
domain::Context(auth.merchant_account, auth.key_store),
));
refunds::refund_response_wrapper(
state,
merchant_context,
None,
refund_request,
refunds::refund_retrieve_core_with_refund_id,
)
},
&auth::HeaderAuth(auth::ApiKeyAuth {
is_connected_allowed: false,
is_platform_allowed: false,
}),
api_locking::LockAction::NotApplicable,
))
.await
}
#[instrument(skip_all, fields(flow = ?Flow::RefundsUpdate))]
pub async fn refund_update(
state: web::Data<routes::AppState>,
req: HttpRequest,
path: web::Path<String>,
form_payload: web::Form<types::StripeUpdateRefundRequest>,
) -> HttpResponse {
let mut payload = form_payload.into_inner();
payload.refund_id = path.into_inner();
let create_refund_update_req: refund_types::RefundUpdateRequest = payload.into();
let flow = Flow::RefundsUpdate;
Box::pin(wrap::compatibility_api_wrap::<
_,
_,
_,
_,
_,
types::StripeRefundResponse,
errors::StripeErrorCode,
_,
>(
flow,
state.into_inner(),
&req,
create_refund_update_req,
|state, auth: auth::AuthenticationData, req, _| {
let merchant_context = domain::MerchantContext::NormalMerchant(Box::new(
domain::Context(auth.merchant_account, auth.key_store),
));
refunds::refund_update_core(state, merchant_context, req)
},
&auth::HeaderAuth(auth::ApiKeyAuth {
is_connected_allowed: false,
is_platform_allowed: false,
}),
api_locking::LockAction::NotApplicable,
))
.await
}
|
crates/router/src/compatibility/stripe/refunds.rs
|
router
|
full_file
| null | null | null | 1,438
| null | null | null | null | null | null | null |
// Function: payment_external_authentication
// File: crates/router/src/core/payments.rs
// Module: router
pub fn payment_external_authentication<F: Clone + Sync>(
state: SessionState,
merchant_context: domain::MerchantContext,
req: api_models::payments::PaymentsExternalAuthenticationRequest,
) -> RouterResponse<api_models::payments::PaymentsExternalAuthenticationResponse>
|
crates/router/src/core/payments.rs
|
router
|
function_signature
| null | null | null | 77
|
payment_external_authentication
| null | null | null | null | null | null |
// Struct: ProphetpayCompleteRequest
// File: crates/hyperswitch_connectors/src/connectors/prophetpay/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct ProphetpayCompleteRequest
|
crates/hyperswitch_connectors/src/connectors/prophetpay/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
ProphetpayCompleteRequest
| 0
|
[] | 50
| null | null | null | null | null | null | null |
// Struct: ClientReferenceInformation
// File: crates/hyperswitch_connectors/src/connectors/bankofamerica/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct ClientReferenceInformation
|
crates/hyperswitch_connectors/src/connectors/bankofamerica/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
ClientReferenceInformation
| 0
|
[] | 50
| null | null | null | null | null | null | null |
// Implementation: impl api::Refund for for Bitpay
// File: crates/hyperswitch_connectors/src/connectors/bitpay.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::Refund for for Bitpay
|
crates/hyperswitch_connectors/src/connectors/bitpay.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 57
| null |
Bitpay
|
api::Refund for
| 0
| 0
| null | null |
// Struct: AuthenticationSyncResponse
// File: crates/api_models/src/authentication.rs
// Module: api_models
// Implementations: 1
// Traits: ApiEventMetric
pub struct AuthenticationSyncResponse
|
crates/api_models/src/authentication.rs
|
api_models
|
struct_definition
|
AuthenticationSyncResponse
| 1
|
[
"ApiEventMetric"
] | 42
| null | null | null | null | null | null | null |
// Implementation: impl api::PaymentVoid for for Novalnet
// File: crates/hyperswitch_connectors/src/connectors/novalnet.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::PaymentVoid for for Novalnet
|
crates/hyperswitch_connectors/src/connectors/novalnet.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 60
| null |
Novalnet
|
api::PaymentVoid for
| 0
| 0
| null | null |
// Struct: Plaid
// File: crates/pm_auth/src/connector/plaid.rs
// Module: pm_auth
// Implementations: 7
// Traits: ConnectorCommon, auth_service::AuthService, auth_service::PaymentInitiationRecipientCreate, auth_service::PaymentInitiation, auth_service::AuthServiceLinkToken, auth_service::AuthServiceExchangeToken, auth_service::AuthServiceBankAccountCredentials
pub struct Plaid
|
crates/pm_auth/src/connector/plaid.rs
|
pm_auth
|
struct_definition
|
Plaid
| 7
|
[
"ConnectorCommon",
"auth_service::AuthService",
"auth_service::PaymentInitiationRecipientCreate",
"auth_service::PaymentInitiation",
"auth_service::AuthServiceLinkToken",
"auth_service::AuthServiceExchangeToken",
"auth_service::AuthServiceBankAccountCredentials"
] | 85
| null | null | null | null | null | null | null |
// Struct: DisputeListFilters
// File: crates/api_models/src/disputes.rs
// Module: api_models
// Implementations: 0
pub struct DisputeListFilters
|
crates/api_models/src/disputes.rs
|
api_models
|
struct_definition
|
DisputeListFilters
| 0
|
[] | 39
| null | null | null | null | null | null | null |
// Function: delete_gsm_rule
// File: crates/router/src/core/gsm.rs
// Module: router
pub fn delete_gsm_rule(
state: SessionState,
gsm_request: gsm_api_types::GsmDeleteRequest,
) -> RouterResponse<gsm_api_types::GsmDeleteResponse>
|
crates/router/src/core/gsm.rs
|
router
|
function_signature
| null | null | null | 66
|
delete_gsm_rule
| null | null | null | null | null | null |
// File: crates/router/tests/connectors/digitalvirgo.rs
// Module: router
use masking::Secret;
use router::{
types::{self, api, storage::enums,
}};
use crate::utils::{self, ConnectorActions};
use test_utils::connector_auth;
#[derive(Clone, Copy)]
struct DigitalvirgoTest;
impl ConnectorActions for DigitalvirgoTest {}
impl utils::Connector for DigitalvirgoTest {
fn get_data(&self) -> api::ConnectorData {
use router::connector::Digitalvirgo;
api::ConnectorData {
connector: Box::new(Digitalvirgo::new()),
connector_name: types::Connector::Digitalvirgo,
get_token: types::api::GetToken::Connector,
merchant_connector_id: None,
}
}
fn get_auth_token(&self) -> types::ConnectorAuthType {
utils::to_connector_auth_type(
connector_auth::ConnectorAuthentication::new()
.digitalvirgo
.expect("Missing connector authentication configuration").into(),
)
}
fn get_name(&self) -> String {
"digitalvirgo".to_string()
}
}
static CONNECTOR: DigitalvirgoTest = DigitalvirgoTest {};
fn get_default_payment_info() -> Option<utils::PaymentInfo> {
None
}
fn payment_method_details() -> Option<types::PaymentsAuthorizeData> {
None
}
// Cards Positive Tests
// Creates a payment using the manual capture flow (Non 3DS).
#[actix_web::test]
async fn should_only_authorize_payment() {
let response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
assert_eq!(response.status, enums::AttemptStatus::Authorized);
}
// Captures a payment using the manual capture flow (Non 3DS).
#[actix_web::test]
async fn should_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(payment_method_details(), None, get_default_payment_info())
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
// Partially captures a payment using the manual capture flow (Non 3DS).
#[actix_web::test]
async fn should_partially_capture_authorized_payment() {
let response = CONNECTOR
.authorize_and_capture_payment(
payment_method_details(),
Some(types::PaymentsCaptureData {
amount_to_capture: 50,
..utils::PaymentCaptureType::default().0
}),
get_default_payment_info(),
)
.await
.expect("Capture payment response");
assert_eq!(response.status, enums::AttemptStatus::Charged);
}
// Synchronizes a payment using the manual capture flow (Non 3DS).
#[actix_web::test]
async fn should_sync_authorized_payment() {
let authorize_response = CONNECTOR
.authorize_payment(payment_method_details(), get_default_payment_info())
.await
.expect("Authorize payment response");
let txn_id = utils::get_connector_transaction_id(authorize_response.response);
let response = CONNECTOR
.psync_retry_till_status_matches(
enums::AttemptStatus::Authorized,
Some(types::PaymentsSyncData {
connector_transaction_id: types::ResponseId::ConnectorTransactionId(
txn_id.unwrap(),
),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("PSync response");
assert_eq!(response.status, enums::AttemptStatus::Authorized,);
}
// Voids a payment using the manual capture flow (Non 3DS).
#[actix_web::test]
async fn should_void_authorized_payment() {
let response = CONNECTOR
.authorize_and_void_payment(
payment_method_details(),
Some(types::PaymentsCancelData {
connector_transaction_id: String::from(""),
cancellation_reason: Some("requested_by_customer".to_string()),
..Default::default()
}),
get_default_payment_info(),
)
.await
.expect("Void payment response");
assert_eq!(response.status, enums::AttemptStatus::Voided);
}
// Refunds a payment using the manual capture flow (Non 3DS).
#[actix_web::test]
async fn should_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(payment_method_details(), None, None, get_default_payment_info())
.await
.unwrap();
assert_eq!(
response.response.unwrap().refund_status,
enums::RefundStatus::Success,
);
}
// Partially refunds a payment using the manual capture flow (Non 3DS).
#[actix_web::test]
async fn should_partially_refund_manually_captured_payment() {
let response = CONNECTOR
.capture_payment_and_refund(
payment_method_details(),
None,
Some(types::RefundsData {
refund_amount: 50,
..utils::PaymentRefundType::default().0
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
response.response.unwrap().refund_status,
enums::RefundStatus::Success,
);
}
// Synchronizes a refund using the manual capture flow (Non 3DS).
#[actix_web::test]
async fn should_sync_manually_captured_refund() {
let refund_response = CONNECTOR
.capture_payment_and_refund(payment_method_details(), None, None, get_default_payment_info())
.await
.unwrap();
let response = CONNECTOR
.rsync_retry_till_status_matches(
enums::RefundStatus::Success,
refund_response.response.unwrap().connector_refund_id,
None,
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
response.response.unwrap().refund_status,
enums::RefundStatus::Success,
);
}
// Creates a payment using the automatic capture flow (Non 3DS).
#[actix_web::test]
async fn should_make_payment() {
let authorize_response = CONNECTOR.make_payment(payment_method_details(), get_default_payment_info()).await.unwrap();
assert_eq!(authorize_response.status, enums::AttemptStatus::Charged);
}
// Synchronizes a payment using the automatic capture flow (Non 3DS).
#[actix_web::test]
async fn should_sync_auto_captured_payment() {
let authorize_response = CONNECTOR.make_payment(payment_method_details(), get_default_payment_info()).await.unwrap();
assert_eq!(authorize_response.status, enums::AttemptStatus::Charged);
let txn_id = utils::get_connector_transaction_id(authorize_response.response);
assert_ne!(txn_id, None, "Empty connector transaction id");
let response = CONNECTOR
.psync_retry_till_status_matches(
enums::AttemptStatus::Charged,
Some(types::PaymentsSyncData {
connector_transaction_id: types::ResponseId::ConnectorTransactionId(
txn_id.unwrap(),
),
capture_method: Some(enums::CaptureMethod::Automatic),
..Default::default()
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(response.status, enums::AttemptStatus::Charged,);
}
// Refunds a payment using the automatic capture flow (Non 3DS).
#[actix_web::test]
async fn should_refund_auto_captured_payment() {
let response = CONNECTOR
.make_payment_and_refund(payment_method_details(), None, get_default_payment_info())
.await
.unwrap();
assert_eq!(
response.response.unwrap().refund_status,
enums::RefundStatus::Success,
);
}
// Partially refunds a payment using the automatic capture flow (Non 3DS).
#[actix_web::test]
async fn should_partially_refund_succeeded_payment() {
let refund_response = CONNECTOR
.make_payment_and_refund(
payment_method_details(),
Some(types::RefundsData {
refund_amount: 50,
..utils::PaymentRefundType::default().0
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
refund_response.response.unwrap().refund_status,
enums::RefundStatus::Success,
);
}
// Creates multiple refunds against a payment using the automatic capture flow (Non 3DS).
#[actix_web::test]
async fn should_refund_succeeded_payment_multiple_times() {
CONNECTOR
.make_payment_and_multiple_refund(
payment_method_details(),
Some(types::RefundsData {
refund_amount: 50,
..utils::PaymentRefundType::default().0
}),
get_default_payment_info(),
)
.await;
}
// Synchronizes a refund using the automatic capture flow (Non 3DS).
#[actix_web::test]
async fn should_sync_refund() {
let refund_response = CONNECTOR
.make_payment_and_refund(payment_method_details(), None, get_default_payment_info())
.await
.unwrap();
let response = CONNECTOR
.rsync_retry_till_status_matches(
enums::RefundStatus::Success,
refund_response.response.unwrap().connector_refund_id,
None,
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
response.response.unwrap().refund_status,
enums::RefundStatus::Success,
);
}
// Cards Negative scenarios
// Creates a payment with incorrect CVC.
#[actix_web::test]
async fn should_fail_payment_for_incorrect_cvc() {
let response = CONNECTOR
.make_payment(
Some(types::PaymentsAuthorizeData {
payment_method_data: types::api::PaymentMethodData::Card(api::Card {
card_cvc: Secret::new("12345".to_string()),
..utils::CCardType::default().0
}),
..utils::PaymentAuthorizeType::default().0
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
response.response.unwrap_err().message,
"Your card's security code is invalid.".to_string(),
);
}
// Creates a payment with incorrect expiry month.
#[actix_web::test]
async fn should_fail_payment_for_invalid_exp_month() {
let response = CONNECTOR
.make_payment(
Some(types::PaymentsAuthorizeData {
payment_method_data: api::PaymentMethodData::Card(api::Card {
card_exp_month: Secret::new("20".to_string()),
..utils::CCardType::default().0
}),
..utils::PaymentAuthorizeType::default().0
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
response.response.unwrap_err().message,
"Your card's expiration month is invalid.".to_string(),
);
}
// Creates a payment with incorrect expiry year.
#[actix_web::test]
async fn should_fail_payment_for_incorrect_expiry_year() {
let response = CONNECTOR
.make_payment(
Some(types::PaymentsAuthorizeData {
payment_method_data: api::PaymentMethodData::Card(api::Card {
card_exp_year: Secret::new("2000".to_string()),
..utils::CCardType::default().0
}),
..utils::PaymentAuthorizeType::default().0
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
response.response.unwrap_err().message,
"Your card's expiration year is invalid.".to_string(),
);
}
// Voids a payment using automatic capture flow (Non 3DS).
#[actix_web::test]
async fn should_fail_void_payment_for_auto_capture() {
let authorize_response = CONNECTOR.make_payment(payment_method_details(), get_default_payment_info()).await.unwrap();
assert_eq!(authorize_response.status, enums::AttemptStatus::Charged);
let txn_id = utils::get_connector_transaction_id(authorize_response.response);
assert_ne!(txn_id, None, "Empty connector transaction id");
let void_response = CONNECTOR
.void_payment(txn_id.unwrap(), None, get_default_payment_info())
.await
.unwrap();
assert_eq!(
void_response.response.unwrap_err().message,
"You cannot cancel this PaymentIntent because it has a status of succeeded."
);
}
// Captures a payment using invalid connector payment id.
#[actix_web::test]
async fn should_fail_capture_for_invalid_payment() {
let capture_response = CONNECTOR
.capture_payment("123456789".to_string(), None, get_default_payment_info())
.await
.unwrap();
assert_eq!(
capture_response.response.unwrap_err().message,
String::from("No such payment_intent: '123456789'")
);
}
// Refunds a payment with refund amount higher than payment amount.
#[actix_web::test]
async fn should_fail_for_refund_amount_higher_than_payment_amount() {
let response = CONNECTOR
.make_payment_and_refund(
payment_method_details(),
Some(types::RefundsData {
refund_amount: 150,
..utils::PaymentRefundType::default().0
}),
get_default_payment_info(),
)
.await
.unwrap();
assert_eq!(
response.response.unwrap_err().message,
"Refund amount (₹1.50) is greater than charge amount (₹1.00)",
);
}
// Connector dependent test cases goes here
// [#478]: add unit tests for non 3DS, wallets & webhooks in connector tests
|
crates/router/tests/connectors/digitalvirgo.rs
|
router
|
full_file
| null | null | null | 2,916
| null | null | null | null | null | null | null |
// Function: insert
// File: crates/diesel_models/src/query/user/theme.rs
// Module: diesel_models
pub fn insert(self, conn: &PgPooledConn) -> StorageResult<Theme>
|
crates/diesel_models/src/query/user/theme.rs
|
diesel_models
|
function_signature
| null | null | null | 43
|
insert
| null | null | null | null | null | null |
// Struct: Santander
// File: crates/hyperswitch_connectors/src/connectors/santander.rs
// Module: hyperswitch_connectors
// Implementations: 17
// Traits: api::Payment, api::PaymentSession, api::ConnectorAccessToken, api::MandateSetup, api::PaymentAuthorize, api::PaymentSync, api::PaymentCapture, api::PaymentVoid, api::Refund, api::RefundExecute, api::RefundSync, api::PaymentToken, ConnectorCommon, ConnectorValidation, webhooks::IncomingWebhook, ConnectorSpecifications
pub struct Santander
|
crates/hyperswitch_connectors/src/connectors/santander.rs
|
hyperswitch_connectors
|
struct_definition
|
Santander
| 17
|
[
"api::Payment",
"api::PaymentSession",
"api::ConnectorAccessToken",
"api::MandateSetup",
"api::PaymentAuthorize",
"api::PaymentSync",
"api::PaymentCapture",
"api::PaymentVoid",
"api::Refund",
"api::RefundExecute",
"api::RefundSync",
"api::PaymentToken",
"ConnectorCommon",
"ConnectorValidation",
"webhooks::IncomingWebhook",
"ConnectorSpecifications"
] | 126
| null | null | null | null | null | null | null |
// Struct: RetrieveCardRespPayload
// File: crates/router/src/core/payment_methods/transformers.rs
// Module: router
// Implementations: 0
pub struct RetrieveCardRespPayload
|
crates/router/src/core/payment_methods/transformers.rs
|
router
|
struct_definition
|
RetrieveCardRespPayload
| 0
|
[] | 40
| null | null | null | null | null | null | null |
// Struct: SubmitSingleCaptureResponse
// File: crates/hyperswitch_connectors/src/connectors/bamboraapac/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct SubmitSingleCaptureResponse
|
crates/hyperswitch_connectors/src/connectors/bamboraapac/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
SubmitSingleCaptureResponse
| 0
|
[] | 52
| 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.