text
stringlengths 65
57.3k
| file_path
stringlengths 22
92
| module
stringclasses 38
values | type
stringclasses 7
values | struct_name
stringlengths 3
60
⌀ | impl_count
int64 0
60
⌀ | traits
listlengths 0
59
⌀ | tokens
int64 16
8.19k
| function_name
stringlengths 3
85
⌀ | type_name
stringlengths 1
67
⌀ | trait_name
stringclasses 573
values | method_count
int64 0
31
⌀ | public_method_count
int64 0
19
⌀ | submodule_count
int64 0
56
⌀ | export_count
int64 0
9
⌀ |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
// Implementation: impl api::PaymentVoid for for Stax
// File: crates/hyperswitch_connectors/src/connectors/stax.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::PaymentVoid for for Stax
|
crates/hyperswitch_connectors/src/connectors/stax.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 57
| null |
Stax
|
api::PaymentVoid for
| 0
| 0
| null | null |
// Struct: MessagesResponseData
// File: crates/hyperswitch_connectors/src/connectors/redsys/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct MessagesResponseData
|
crates/hyperswitch_connectors/src/connectors/redsys/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
MessagesResponseData
| 0
|
[] | 47
| null | null | null | null | null | null | null |
// Function: get_payment_processor_token_using_token_id
// File: crates/router/src/types/storage/revenue_recovery_redis_operation.rs
// Module: router
pub fn get_payment_processor_token_using_token_id(
state: &SessionState,
connector_customer_id: &str,
payment_processor_token: &str,
) -> CustomResult<Option<PaymentProcessorTokenStatus>, errors::StorageError>
|
crates/router/src/types/storage/revenue_recovery_redis_operation.rs
|
router
|
function_signature
| null | null | null | 81
|
get_payment_processor_token_using_token_id
| null | null | null | null | null | null |
// File: crates/hsdev/src/input_file.rs
// Module: hsdev
// Public functions: 2
// Public structs: 1
use std::string::String;
use serde::Deserialize;
use toml::Value;
#[derive(Deserialize)]
pub struct InputData {
username: String,
password: String,
dbname: String,
host: String,
port: u16,
}
impl InputData {
pub fn read(db_table: &Value) -> Result<Self, toml::de::Error> {
db_table.clone().try_into()
}
pub fn postgres_url(&self) -> String {
format!(
"postgres://{}:{}@{}:{}/{}",
self.username, self.password, self.host, self.port, self.dbname
)
}
}
|
crates/hsdev/src/input_file.rs
|
hsdev
|
full_file
| null | null | null | 172
| null | null | null | null | null | null | null |
// Implementation: impl RevenueRecoveryOutgoingWebhook
// File: crates/router/src/core/revenue_recovery/types.rs
// Module: router
// Methods: 1 total (0 public)
impl RevenueRecoveryOutgoingWebhook
|
crates/router/src/core/revenue_recovery/types.rs
|
router
|
impl_block
| null | null | null | 48
| null |
RevenueRecoveryOutgoingWebhook
| null | 1
| 0
| null | null |
// File: crates/router/src/routes/dummy_connector/utils.rs
// Module: router
// Public functions: 9
use std::fmt::Debug;
use common_utils::ext_traits::AsyncExt;
use error_stack::{report, ResultExt};
use masking::PeekInterface;
use maud::html;
use rand::{distributions::Uniform, prelude::Distribution};
use tokio::time as tokio;
use super::{
consts, errors,
types::{self, GetPaymentMethodDetails},
};
use crate::{
configs::settings,
routes::{dummy_connector::types::DummyConnectors, SessionState},
};
pub async fn tokio_mock_sleep(delay: u64, tolerance: u64) {
let mut rng = rand::thread_rng();
// TODO: change this to `Uniform::try_from`
// this would require changing the fn signature
// to return a Result
let effective_delay = Uniform::from((delay - tolerance)..(delay + tolerance));
tokio::sleep(tokio::Duration::from_millis(
effective_delay.sample(&mut rng),
))
.await
}
pub async fn store_data_in_redis(
state: &SessionState,
key: String,
data: impl serde::Serialize + Debug,
ttl: i64,
) -> types::DummyConnectorResult<()> {
let redis_conn = state
.store
.get_redis_conn()
.change_context(errors::DummyConnectorErrors::InternalServerError)
.attach_printable("Failed to get redis connection")?;
redis_conn
.serialize_and_set_key_with_expiry(&key.into(), data, ttl)
.await
.change_context(errors::DummyConnectorErrors::PaymentStoringError)
.attach_printable("Failed to add data in redis")?;
Ok(())
}
pub async fn get_payment_data_from_payment_id(
state: &SessionState,
payment_id: String,
) -> types::DummyConnectorResult<types::DummyConnectorPaymentData> {
let redis_conn = state
.store
.get_redis_conn()
.change_context(errors::DummyConnectorErrors::InternalServerError)
.attach_printable("Failed to get redis connection")?;
redis_conn
.get_and_deserialize_key::<types::DummyConnectorPaymentData>(
&payment_id.as_str().into(),
"types DummyConnectorPaymentData",
)
.await
.change_context(errors::DummyConnectorErrors::PaymentNotFound)
}
pub async fn get_payment_data_by_attempt_id(
state: &SessionState,
attempt_id: String,
) -> types::DummyConnectorResult<types::DummyConnectorPaymentData> {
let redis_conn = state
.store
.get_redis_conn()
.change_context(errors::DummyConnectorErrors::InternalServerError)
.attach_printable("Failed to get redis connection")?;
redis_conn
.get_and_deserialize_key::<String>(&attempt_id.as_str().into(), "String")
.await
.async_and_then(|payment_id| async move {
redis_conn
.get_and_deserialize_key::<types::DummyConnectorPaymentData>(
&payment_id.as_str().into(),
"DummyConnectorPaymentData",
)
.await
})
.await
.change_context(errors::DummyConnectorErrors::PaymentNotFound)
}
pub fn get_authorize_page(
payment_data: types::DummyConnectorPaymentData,
return_url: String,
dummy_connector_conf: &settings::DummyConnector,
) -> String {
let mode = payment_data.payment_method_type.get_name();
let image = payment_data
.payment_method_type
.get_image_link(dummy_connector_conf.assets_base_url.as_str());
let connector_image = payment_data
.connector
.get_connector_image_link(dummy_connector_conf.assets_base_url.as_str());
let currency = payment_data.currency.to_string();
html! {
head {
title { "Authorize Payment" }
style { (consts::THREE_DS_CSS) }
link rel="icon" href=(connector_image) {}
}
body {
div.heading {
img.logo src="https://app.hyperswitch.io/assets/Dark/hyperswitchLogoIconWithText.svg" alt="Hyperswitch Logo" {}
h1 { "Test Payment Page" }
}
div.container {
div.payment_details {
img src=(image) {}
div.border_horizontal {}
img src=(connector_image) {}
}
(maud::PreEscaped(
format!(r#"
<p class="disclaimer">
This is a test payment of <span id="amount"></span> {} using {}
<script>
document.getElementById("amount").innerHTML = ({} / 100).toFixed(2);
</script>
</p>
"#, currency, mode, payment_data.amount)
)
)
p { b { "Real money will not be debited for the payment." } " \
You can choose to simulate successful or failed payment while testing this payment." }
div.user_action {
button.authorize onclick=(format!("window.location.href='{}?confirm=true'", return_url))
{ "Complete Payment" }
button.reject onclick=(format!("window.location.href='{}?confirm=false'", return_url))
{ "Reject Payment" }
}
}
div.container {
p.disclaimer { "What is this page?" }
p { "This page is just a simulation for integration and testing purpose. \
In live mode, this page will not be displayed and the user will be taken to \
the Bank page (or) Google Pay cards popup (or) original payment method's page. \
Contact us for any queries."
}
div.contact {
div.contact_item.hover_cursor onclick=(dummy_connector_conf.slack_invite_url) {
img src="https://hyperswitch.io/logos/logo_slack.svg" alt="Slack Logo" {}
}
div.contact_item.hover_cursor onclick=(dummy_connector_conf.discord_invite_url) {
img src="https://hyperswitch.io/logos/logo_discord.svg" alt="Discord Logo" {}
}
div.border_vertical {}
div.contact_item.email {
p { "Or email us at" }
a href="mailto:hyperswitch@juspay.in" { "hyperswitch@juspay.in" }
}
}
}
}
}
.into_string()
}
pub fn get_expired_page(dummy_connector_conf: &settings::DummyConnector) -> String {
html! {
head {
title { "Authorize Payment" }
style { (consts::THREE_DS_CSS) }
link rel="icon" href="https://app.hyperswitch.io/HyperswitchFavicon.png" {}
}
body {
div.heading {
img.logo src="https://app.hyperswitch.io/assets/Dark/hyperswitchLogoIconWithText.svg" alt="Hyperswitch Logo" {}
h1 { "Test Payment Page" }
}
div.container {
p.disclaimer { "This link is not valid or it is expired" }
}
div.container {
p.disclaimer { "What is this page?" }
p { "This page is just a simulation for integration and testing purpose.\
In live mode, this is not visible. Contact us for any queries."
}
div.contact {
div.contact_item.hover_cursor onclick=(dummy_connector_conf.slack_invite_url) {
img src="https://hyperswitch.io/logos/logo_slack.svg" alt="Slack Logo" {}
}
div.contact_item.hover_cursor onclick=(dummy_connector_conf.discord_invite_url) {
img src="https://hyperswitch.io/logos/logo_discord.svg" alt="Discord Logo" {}
}
div.border_vertical {}
div.contact_item.email {
p { "Or email us at" }
a href="mailto:hyperswitch@juspay.in" { "hyperswitch@juspay.in" }
}
}
}
}
}
.into_string()
}
pub trait ProcessPaymentAttempt {
fn build_payment_data_from_payment_attempt(
self,
payment_attempt: types::DummyConnectorPaymentAttempt,
redirect_url: String,
) -> types::DummyConnectorResult<types::DummyConnectorPaymentData>;
}
impl ProcessPaymentAttempt for types::DummyConnectorCard {
fn build_payment_data_from_payment_attempt(
self,
payment_attempt: types::DummyConnectorPaymentAttempt,
redirect_url: String,
) -> types::DummyConnectorResult<types::DummyConnectorPaymentData> {
match self.get_flow_from_card_number(payment_attempt.payment_request.connector.clone())? {
types::DummyConnectorCardFlow::NoThreeDS(status, error) => {
if let Some(error) = error {
Err(error)?;
}
Ok(payment_attempt.build_payment_data(status, None, None))
}
types::DummyConnectorCardFlow::ThreeDS(_, _) => {
Ok(payment_attempt.clone().build_payment_data(
types::DummyConnectorStatus::Processing,
Some(types::DummyConnectorNextAction::RedirectToUrl(redirect_url)),
payment_attempt.payment_request.return_url,
))
}
}
}
}
impl ProcessPaymentAttempt for types::DummyConnectorUpiCollect {
fn build_payment_data_from_payment_attempt(
self,
payment_attempt: types::DummyConnectorPaymentAttempt,
redirect_url: String,
) -> types::DummyConnectorResult<types::DummyConnectorPaymentData> {
let upi_collect_response = self.get_flow_from_upi_collect()?;
if let Some(error) = upi_collect_response.error {
Err(error)?;
}
let next_action = upi_collect_response
.is_next_action_required
.then_some(types::DummyConnectorNextAction::RedirectToUrl(redirect_url));
let return_url = payment_attempt.payment_request.return_url.clone();
Ok(
payment_attempt.build_payment_data(
upi_collect_response.status,
next_action,
return_url,
),
)
}
}
impl types::DummyConnectorUpiCollect {
pub fn get_flow_from_upi_collect(
self,
) -> types::DummyConnectorResult<types::DummyConnectorUpiFlow> {
let vpa_id = self.vpa_id.peek();
match vpa_id.as_str() {
consts::DUMMY_CONNECTOR_UPI_FAILURE_VPA_ID => Ok(types::DummyConnectorUpiFlow {
status: types::DummyConnectorStatus::Failed,
error: errors::DummyConnectorErrors::PaymentNotSuccessful.into(),
is_next_action_required: false,
}),
consts::DUMMY_CONNECTOR_UPI_SUCCESS_VPA_ID => Ok(types::DummyConnectorUpiFlow {
status: types::DummyConnectorStatus::Processing,
error: None,
is_next_action_required: true,
}),
_ => Ok(types::DummyConnectorUpiFlow {
status: types::DummyConnectorStatus::Failed,
error: Some(errors::DummyConnectorErrors::PaymentDeclined {
message: "Invalid Upi id",
}),
is_next_action_required: false,
}),
}
}
}
impl types::DummyConnectorCard {
pub fn get_flow_from_card_number(
self,
connector: DummyConnectors,
) -> types::DummyConnectorResult<types::DummyConnectorCardFlow> {
let card_number = self.number.peek();
match card_number.as_str() {
"4111111111111111" | "4242424242424242" | "5555555555554444" | "38000000000006"
| "378282246310005" | "6011111111111117" => {
Ok(types::DummyConnectorCardFlow::NoThreeDS(
types::DummyConnectorStatus::Succeeded,
None,
))
}
"5105105105105100" | "4000000000000002" => {
Ok(types::DummyConnectorCardFlow::NoThreeDS(
types::DummyConnectorStatus::Failed,
Some(errors::DummyConnectorErrors::PaymentDeclined {
message: "Card declined",
}),
))
}
"4000000000009995" => {
if connector == DummyConnectors::StripeTest {
Ok(types::DummyConnectorCardFlow::NoThreeDS(
types::DummyConnectorStatus::Succeeded,
None,
))
} else {
Ok(types::DummyConnectorCardFlow::NoThreeDS(
types::DummyConnectorStatus::Failed,
Some(errors::DummyConnectorErrors::PaymentDeclined {
message: "Internal Server Error from Connector, Please try again later",
}),
))
}
}
"4000000000009987" => Ok(types::DummyConnectorCardFlow::NoThreeDS(
types::DummyConnectorStatus::Failed,
Some(errors::DummyConnectorErrors::PaymentDeclined {
message: "Lost card",
}),
)),
"4000000000009979" => Ok(types::DummyConnectorCardFlow::NoThreeDS(
types::DummyConnectorStatus::Failed,
Some(errors::DummyConnectorErrors::PaymentDeclined {
message: "Stolen card",
}),
)),
"4000003800000446" => Ok(types::DummyConnectorCardFlow::ThreeDS(
types::DummyConnectorStatus::Succeeded,
None,
)),
_ => Err(report!(errors::DummyConnectorErrors::CardNotSupported)
.attach_printable("The card is not supported")),
}
}
}
impl ProcessPaymentAttempt for types::DummyConnectorWallet {
fn build_payment_data_from_payment_attempt(
self,
payment_attempt: types::DummyConnectorPaymentAttempt,
redirect_url: String,
) -> types::DummyConnectorResult<types::DummyConnectorPaymentData> {
Ok(payment_attempt.clone().build_payment_data(
types::DummyConnectorStatus::Processing,
Some(types::DummyConnectorNextAction::RedirectToUrl(redirect_url)),
payment_attempt.payment_request.return_url,
))
}
}
impl ProcessPaymentAttempt for types::DummyConnectorPayLater {
fn build_payment_data_from_payment_attempt(
self,
payment_attempt: types::DummyConnectorPaymentAttempt,
redirect_url: String,
) -> types::DummyConnectorResult<types::DummyConnectorPaymentData> {
Ok(payment_attempt.clone().build_payment_data(
types::DummyConnectorStatus::Processing,
Some(types::DummyConnectorNextAction::RedirectToUrl(redirect_url)),
payment_attempt.payment_request.return_url,
))
}
}
impl ProcessPaymentAttempt for types::DummyConnectorPaymentMethodData {
fn build_payment_data_from_payment_attempt(
self,
payment_attempt: types::DummyConnectorPaymentAttempt,
redirect_url: String,
) -> types::DummyConnectorResult<types::DummyConnectorPaymentData> {
match self {
Self::Card(card) => {
card.build_payment_data_from_payment_attempt(payment_attempt, redirect_url)
}
Self::Upi(upi_data) => match upi_data {
types::DummyConnectorUpi::UpiCollect(upi_collect) => upi_collect
.build_payment_data_from_payment_attempt(payment_attempt, redirect_url),
},
Self::Wallet(wallet) => {
wallet.build_payment_data_from_payment_attempt(payment_attempt, redirect_url)
}
Self::PayLater(pay_later) => {
pay_later.build_payment_data_from_payment_attempt(payment_attempt, redirect_url)
}
}
}
}
impl types::DummyConnectorPaymentData {
pub fn process_payment_attempt(
state: &SessionState,
payment_attempt: types::DummyConnectorPaymentAttempt,
) -> types::DummyConnectorResult<Self> {
let redirect_url = format!(
"{}/dummy-connector/authorize/{}",
state.base_url, payment_attempt.attempt_id
);
payment_attempt
.clone()
.payment_request
.payment_method_data
.build_payment_data_from_payment_attempt(payment_attempt, redirect_url)
}
}
|
crates/router/src/routes/dummy_connector/utils.rs
|
router
|
full_file
| null | null | null | 3,499
| null | null | null | null | null | null | null |
// File: crates/hyperswitch_connectors/src/connectors/custombilling/transformers.rs
// Module: hyperswitch_connectors
// Public structs: 7
use common_enums::enums;
use common_utils::types::StringMinorUnit;
use hyperswitch_domain_models::{
payment_method_data::PaymentMethodData,
router_data::RouterData,
router_flow_types::refunds::{Execute, RSync},
router_request_types::ResponseId,
router_response_types::{PaymentsResponseData, RefundsResponseData},
types::{PaymentsAuthorizeRouterData, RefundsRouterData},
};
use hyperswitch_interfaces::errors;
use masking::Secret;
use serde::{Deserialize, Serialize};
use crate::{
types::{RefundsResponseRouterData, ResponseRouterData},
utils::PaymentsAuthorizeRequestData,
};
//TODO: Fill the struct with respective fields
pub struct CustombillingRouterData<T> {
pub amount: StringMinorUnit, // The type of amount that a connector accepts, for example, String, i64, f64, etc.
pub router_data: T,
}
impl<T> From<(StringMinorUnit, T)> for CustombillingRouterData<T> {
fn from((amount, item): (StringMinorUnit, T)) -> Self {
//Todo : use utils to convert the amount to the type of amount that a connector accepts
Self {
amount,
router_data: item,
}
}
}
//TODO: Fill the struct with respective fields
#[derive(Default, Debug, Serialize, PartialEq)]
pub struct CustombillingPaymentsRequest {
amount: StringMinorUnit,
card: CustombillingCard,
}
#[derive(Default, Debug, Serialize, Eq, PartialEq)]
pub struct CustombillingCard {
number: cards::CardNumber,
expiry_month: Secret<String>,
expiry_year: Secret<String>,
cvc: Secret<String>,
complete: bool,
}
impl TryFrom<&CustombillingRouterData<&PaymentsAuthorizeRouterData>>
for CustombillingPaymentsRequest
{
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(
item: &CustombillingRouterData<&PaymentsAuthorizeRouterData>,
) -> Result<Self, Self::Error> {
match item.router_data.request.payment_method_data.clone() {
PaymentMethodData::Card(req_card) => {
let card = CustombillingCard {
number: req_card.card_number,
expiry_month: req_card.card_exp_month,
expiry_year: req_card.card_exp_year,
cvc: req_card.card_cvc,
complete: item.router_data.request.is_auto_capture()?,
};
Ok(Self {
amount: item.amount.clone(),
card,
})
}
_ => Err(errors::ConnectorError::NotImplemented("Payment method".to_string()).into()),
}
}
}
// PaymentsResponse
//TODO: Append the remaining status flags
#[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "lowercase")]
pub enum CustombillingPaymentStatus {
Succeeded,
Failed,
#[default]
Processing,
}
impl From<CustombillingPaymentStatus> for common_enums::AttemptStatus {
fn from(item: CustombillingPaymentStatus) -> Self {
match item {
CustombillingPaymentStatus::Succeeded => Self::Charged,
CustombillingPaymentStatus::Failed => Self::Failure,
CustombillingPaymentStatus::Processing => Self::Authorizing,
}
}
}
//TODO: Fill the struct with respective fields
#[derive(Default, Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct CustombillingPaymentsResponse {
status: CustombillingPaymentStatus,
id: String,
}
impl<F, T> TryFrom<ResponseRouterData<F, CustombillingPaymentsResponse, T, PaymentsResponseData>>
for RouterData<F, T, PaymentsResponseData>
{
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(
item: ResponseRouterData<F, CustombillingPaymentsResponse, T, PaymentsResponseData>,
) -> Result<Self, Self::Error> {
Ok(Self {
status: common_enums::AttemptStatus::from(item.response.status),
response: Ok(PaymentsResponseData::TransactionResponse {
resource_id: ResponseId::ConnectorTransactionId(item.response.id),
redirection_data: Box::new(None),
mandate_reference: Box::new(None),
connector_metadata: None,
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
charges: None,
}),
..item.data
})
}
}
//TODO: Fill the struct with respective fields
// REFUND :
// Type definition for RefundRequest
#[derive(Default, Debug, Serialize)]
pub struct CustombillingRefundRequest {
pub amount: StringMinorUnit,
}
impl<F> TryFrom<&CustombillingRouterData<&RefundsRouterData<F>>> for CustombillingRefundRequest {
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(
item: &CustombillingRouterData<&RefundsRouterData<F>>,
) -> Result<Self, Self::Error> {
Ok(Self {
amount: item.amount.to_owned(),
})
}
}
// Type definition for Refund Response
#[allow(dead_code)]
#[derive(Debug, Serialize, Default, Deserialize, Clone)]
pub enum RefundStatus {
Succeeded,
Failed,
#[default]
Processing,
}
impl From<RefundStatus> for enums::RefundStatus {
fn from(item: RefundStatus) -> Self {
match item {
RefundStatus::Succeeded => Self::Success,
RefundStatus::Failed => Self::Failure,
RefundStatus::Processing => Self::Pending,
//TODO: Review mapping
}
}
}
//TODO: Fill the struct with respective fields
#[derive(Default, Debug, Clone, Serialize, Deserialize)]
pub struct RefundResponse {
id: String,
status: RefundStatus,
}
impl TryFrom<RefundsResponseRouterData<Execute, RefundResponse>> for RefundsRouterData<Execute> {
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(
item: RefundsResponseRouterData<Execute, RefundResponse>,
) -> Result<Self, Self::Error> {
Ok(Self {
response: Ok(RefundsResponseData {
connector_refund_id: item.response.id.to_string(),
refund_status: enums::RefundStatus::from(item.response.status),
}),
..item.data
})
}
}
impl TryFrom<RefundsResponseRouterData<RSync, RefundResponse>> for RefundsRouterData<RSync> {
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(
item: RefundsResponseRouterData<RSync, RefundResponse>,
) -> Result<Self, Self::Error> {
Ok(Self {
response: Ok(RefundsResponseData {
connector_refund_id: item.response.id.to_string(),
refund_status: enums::RefundStatus::from(item.response.status),
}),
..item.data
})
}
}
//TODO: Fill the struct with respective fields
#[derive(Default, Debug, Serialize, Deserialize, PartialEq)]
pub struct CustombillingErrorResponse {
pub status_code: u16,
pub code: String,
pub message: String,
pub reason: Option<String>,
}
|
crates/hyperswitch_connectors/src/connectors/custombilling/transformers.rs
|
hyperswitch_connectors
|
full_file
| null | null | null | 1,566
| null | null | null | null | null | null | null |
// Struct: PaymentSessionIntent
// File: crates/router/src/core/payments/operations/payment_session_intent.rs
// Module: router
// Implementations: 1
// Traits: ValidateStatusForOperation
pub struct PaymentSessionIntent
|
crates/router/src/core/payments/operations/payment_session_intent.rs
|
router
|
struct_definition
|
PaymentSessionIntent
| 1
|
[
"ValidateStatusForOperation"
] | 48
| null | null | null | null | null | null | null |
// Function: switch_merchant_for_user_in_org
// File: crates/router/src/core/user.rs
// Module: router
pub fn switch_merchant_for_user_in_org(
state: SessionState,
request: user_api::SwitchMerchantRequest,
user_from_token: auth::UserFromToken,
) -> UserResponse<user_api::TokenResponse>
|
crates/router/src/core/user.rs
|
router
|
function_signature
| null | null | null | 74
|
switch_merchant_for_user_in_org
| null | null | null | null | null | null |
// Function: get_merchant_sankey
// File: crates/router/src/analytics.rs
// Module: router
pub fn get_merchant_sankey(
state: web::Data<AppState>,
req: actix_web::HttpRequest,
json_payload: web::Json<TimeRange>,
) -> impl Responder
|
crates/router/src/analytics.rs
|
router
|
function_signature
| null | null | null | 67
|
get_merchant_sankey
| null | null | null | null | null | null |
// Implementation: impl GetRequestIncrementalAuthorization for for PaymentsAuthorizeData
// File: crates/hyperswitch_connectors/src/connectors/paypal/transformers.rs
// Module: hyperswitch_connectors
// Methods: 1 total (0 public)
impl GetRequestIncrementalAuthorization for for PaymentsAuthorizeData
|
crates/hyperswitch_connectors/src/connectors/paypal/transformers.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 64
| null |
PaymentsAuthorizeData
|
GetRequestIncrementalAuthorization for
| 1
| 0
| null | null |
// Struct: Address
// File: crates/hyperswitch_connectors/src/connectors/affirm/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct Address
|
crates/hyperswitch_connectors/src/connectors/affirm/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
Address
| 0
|
[] | 44
| null | null | null | null | null | null | null |
// Function: update_profile_acquirer_config
// File: crates/router/src/core/profile_acquirer.rs
// Module: router
pub fn update_profile_acquirer_config(
state: SessionState,
profile_id: common_utils::id_type::ProfileId,
profile_acquirer_id: common_utils::id_type::ProfileAcquirerId,
request: profile_acquirer::ProfileAcquirerUpdate,
merchant_context: domain::MerchantContext,
) -> RouterResponse<profile_acquirer::ProfileAcquirerResponse>
|
crates/router/src/core/profile_acquirer.rs
|
router
|
function_signature
| null | null | null | 105
|
update_profile_acquirer_config
| null | null | null | null | null | null |
// Function: list_all_merchant_accounts
// File: crates/diesel_models/src/query/merchant_account.rs
// Module: diesel_models
pub fn list_all_merchant_accounts(
conn: &PgPooledConn,
limit: u32,
offset: Option<u32>,
) -> StorageResult<Vec<Self>>
|
crates/diesel_models/src/query/merchant_account.rs
|
diesel_models
|
function_signature
| null | null | null | 69
|
list_all_merchant_accounts
| null | null | null | null | null | null |
// Implementation: impl RecoveryDeciderClientInterface for for DeciderClient
// File: crates/external_services/src/grpc_client/revenue_recovery/recovery_decider_client.rs
// Module: external_services
// Methods: 1 total (0 public)
impl RecoveryDeciderClientInterface for for DeciderClient
|
crates/external_services/src/grpc_client/revenue_recovery/recovery_decider_client.rs
|
external_services
|
impl_block
| null | null | null | 62
| null |
DeciderClient
|
RecoveryDeciderClientInterface for
| 1
| 0
| null | null |
// Implementation: impl RecordMigrationStatusBuilder
// File: crates/payment_methods/src/core/migration.rs
// Module: payment_methods
// Methods: 6 total (6 public)
impl RecordMigrationStatusBuilder
|
crates/payment_methods/src/core/migration.rs
|
payment_methods
|
impl_block
| null | null | null | 42
| null |
RecordMigrationStatusBuilder
| null | 6
| 6
| null | null |
// File: crates/api_models/src/events/customer.rs
// Module: api_models
use common_utils::events::{ApiEventMetric, ApiEventsType};
use crate::customers::{
CustomerDeleteResponse, CustomerRequest, CustomerResponse, CustomerUpdateRequestInternal,
};
#[cfg(feature = "v1")]
impl ApiEventMetric for CustomerDeleteResponse {
fn get_api_event_type(&self) -> Option<ApiEventsType> {
Some(ApiEventsType::Customer {
customer_id: self.customer_id.clone(),
})
}
}
#[cfg(feature = "v2")]
impl ApiEventMetric for CustomerDeleteResponse {
fn get_api_event_type(&self) -> Option<ApiEventsType> {
Some(ApiEventsType::Customer {
customer_id: Some(self.id.clone()),
})
}
}
#[cfg(feature = "v1")]
impl ApiEventMetric for CustomerRequest {
fn get_api_event_type(&self) -> Option<ApiEventsType> {
self.get_merchant_reference_id()
.clone()
.map(|cid| ApiEventsType::Customer { customer_id: cid })
}
}
#[cfg(feature = "v2")]
impl ApiEventMetric for CustomerRequest {
fn get_api_event_type(&self) -> Option<ApiEventsType> {
Some(ApiEventsType::Customer { customer_id: None })
}
}
#[cfg(feature = "v1")]
impl ApiEventMetric for CustomerResponse {
fn get_api_event_type(&self) -> Option<ApiEventsType> {
self.get_merchant_reference_id()
.clone()
.map(|cid| ApiEventsType::Customer { customer_id: cid })
}
}
#[cfg(feature = "v2")]
impl ApiEventMetric for CustomerResponse {
fn get_api_event_type(&self) -> Option<ApiEventsType> {
Some(ApiEventsType::Customer {
customer_id: Some(self.id.clone()),
})
}
}
#[cfg(feature = "v1")]
impl ApiEventMetric for CustomerUpdateRequestInternal {
fn get_api_event_type(&self) -> Option<ApiEventsType> {
Some(ApiEventsType::Customer {
customer_id: self.customer_id.clone(),
})
}
}
#[cfg(feature = "v2")]
impl ApiEventMetric for CustomerUpdateRequestInternal {
fn get_api_event_type(&self) -> Option<ApiEventsType> {
Some(ApiEventsType::Customer {
customer_id: Some(self.id.clone()),
})
}
}
|
crates/api_models/src/events/customer.rs
|
api_models
|
full_file
| null | null | null | 513
| null | null | null | null | null | null | null |
// Struct: ProfileAcquirerResponse
// File: crates/api_models/src/profile_acquirer.rs
// Module: api_models
// Implementations: 1
// Traits: common_utils::events::ApiEventMetric
pub struct ProfileAcquirerResponse
|
crates/api_models/src/profile_acquirer.rs
|
api_models
|
struct_definition
|
ProfileAcquirerResponse
| 1
|
[
"common_utils::events::ApiEventMetric"
] | 51
| null | null | null | null | null | null | null |
// Struct: ResponsePaymentMethodIntermediate
// File: crates/api_models/src/payment_methods.rs
// Module: api_models
// Implementations: 1
pub struct ResponsePaymentMethodIntermediate
|
crates/api_models/src/payment_methods.rs
|
api_models
|
struct_definition
|
ResponsePaymentMethodIntermediate
| 1
|
[] | 38
| 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(
_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 | 75
|
payment_external_authentication
| null | null | null | null | null | null |
// File: crates/analytics/src/refunds/metrics/sessionized_metrics/refund_success_count.rs
// Module: analytics
use std::collections::HashSet;
use api_models::analytics::{
refunds::{RefundDimensions, RefundFilters, RefundMetricsBucketIdentifier},
Granularity, TimeRange,
};
use common_utils::errors::ReportSwitchExt;
use diesel_models::enums as storage_enums;
use error_stack::ResultExt;
use time::PrimitiveDateTime;
use super::RefundMetricRow;
use crate::{
enums::AuthInfo,
query::{Aggregate, GroupByClause, QueryBuilder, QueryFilter, SeriesBucket, ToSql, Window},
types::{AnalyticsCollection, AnalyticsDataSource, MetricsError, MetricsResult},
};
#[derive(Default)]
pub(crate) struct RefundSuccessCount {}
#[async_trait::async_trait]
impl<T> super::RefundMetric<T> for RefundSuccessCount
where
T: AnalyticsDataSource + super::RefundMetricAnalytics,
PrimitiveDateTime: ToSql<T>,
AnalyticsCollection: ToSql<T>,
Granularity: GroupByClause<T>,
Aggregate<&'static str>: ToSql<T>,
Window<&'static str>: ToSql<T>,
{
async fn load_metrics(
&self,
dimensions: &[RefundDimensions],
auth: &AuthInfo,
filters: &RefundFilters,
granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(RefundMetricsBucketIdentifier, RefundMetricRow)>>
where
T: AnalyticsDataSource + super::RefundMetricAnalytics,
{
let mut query_builder = QueryBuilder::new(AnalyticsCollection::RefundSessionized);
for dim in dimensions.iter() {
query_builder.add_select_column(dim).switch()?;
}
query_builder
.add_select_column(Aggregate::Count {
field: None,
alias: Some("count"),
})
.switch()?;
query_builder
.add_select_column(Aggregate::Min {
field: "created_at",
alias: Some("start_bucket"),
})
.switch()?;
query_builder
.add_select_column(Aggregate::Max {
field: "created_at",
alias: Some("end_bucket"),
})
.switch()?;
filters.set_filter_clause(&mut query_builder).switch()?;
auth.set_filter_clause(&mut query_builder).switch()?;
time_range.set_filter_clause(&mut query_builder).switch()?;
for dim in dimensions.iter() {
query_builder.add_group_by_clause(dim).switch()?;
}
if let Some(granularity) = granularity {
granularity
.set_group_by_clause(&mut query_builder)
.switch()?;
}
query_builder
.add_filter_clause(
RefundDimensions::RefundStatus,
storage_enums::RefundStatus::Success,
)
.switch()?;
query_builder
.execute_query::<RefundMetricRow, _>(pool)
.await
.change_context(MetricsError::QueryBuildingError)?
.change_context(MetricsError::QueryExecutionFailure)?
.into_iter()
.map(|i| {
Ok((
RefundMetricsBucketIdentifier::new(
i.currency.as_ref().map(|i| i.0),
None,
i.connector.clone(),
i.refund_type.as_ref().map(|i| i.0.to_string()),
i.profile_id.clone(),
i.refund_reason.clone(),
i.refund_error_message.clone(),
TimeRange {
start_time: match (granularity, i.start_bucket) {
(Some(g), Some(st)) => g.clip_to_start(st)?,
_ => time_range.start_time,
},
end_time: granularity.as_ref().map_or_else(
|| Ok(time_range.end_time),
|g| i.end_bucket.map(|et| g.clip_to_end(et)).transpose(),
)?,
},
),
i,
))
})
.collect::<error_stack::Result<
HashSet<(RefundMetricsBucketIdentifier, RefundMetricRow)>,
crate::query::PostProcessingError,
>>()
.change_context(MetricsError::PostProcessingFailure)
}
}
|
crates/analytics/src/refunds/metrics/sessionized_metrics/refund_success_count.rs
|
analytics
|
full_file
| null | null | null | 896
| null | null | null | null | null | null | null |
// Struct: CardInfoMigrationResponse
// File: crates/api_models/src/cards_info.rs
// Module: api_models
// Implementations: 1
// Traits: ApiEventMetric
pub struct CardInfoMigrationResponse
|
crates/api_models/src/cards_info.rs
|
api_models
|
struct_definition
|
CardInfoMigrationResponse
| 1
|
[
"ApiEventMetric"
] | 45
| null | null | null | null | null | null | null |
// Struct: LogSpanInitializer
// File: crates/router/src/middleware.rs
// Module: router
// Implementations: 0
// Documentation: Middleware to build a TOP level domain span for each request.
pub struct LogSpanInitializer
|
crates/router/src/middleware.rs
|
router
|
struct_definition
|
LogSpanInitializer
| 0
|
[] | 49
| null | null | null | null | null | null | null |
// Implementation: impl api::PaymentSession for for Deutschebank
// File: crates/hyperswitch_connectors/src/connectors/deutschebank.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::PaymentSession for for Deutschebank
|
crates/hyperswitch_connectors/src/connectors/deutschebank.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 58
| null |
Deutschebank
|
api::PaymentSession for
| 0
| 0
| null | null |
// Implementation: impl ValidateStatusForOperation for for PaymentAttemptRecord
// File: crates/router/src/core/payments/operations/payment_attempt_record.rs
// Module: router
// Methods: 1 total (0 public)
impl ValidateStatusForOperation for for PaymentAttemptRecord
|
crates/router/src/core/payments/operations/payment_attempt_record.rs
|
router
|
impl_block
| null | null | null | 55
| null |
PaymentAttemptRecord
|
ValidateStatusForOperation for
| 1
| 0
| null | null |
// Function: is_external_vault_enabled
// File: crates/hyperswitch_domain_models/src/business_profile.rs
// Module: hyperswitch_domain_models
pub fn is_external_vault_enabled(&self) -> bool
|
crates/hyperswitch_domain_models/src/business_profile.rs
|
hyperswitch_domain_models
|
function_signature
| null | null | null | 44
|
is_external_vault_enabled
| null | null | null | null | null | null |
// Struct: PaymentVoidResponse
// File: crates/hyperswitch_connectors/src/connectors/checkout/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct PaymentVoidResponse
|
crates/hyperswitch_connectors/src/connectors/checkout/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
PaymentVoidResponse
| 0
|
[] | 47
| null | null | null | null | null | null | null |
#[async_trait::async_trait]
impl webhooks::IncomingWebhook for Nordea {
fn get_webhook_object_reference_id(
&self,
_request: &webhooks::IncomingWebhookRequestDetails<'_>,
) -> CustomResult<api_models::webhooks::ObjectReferenceId, errors::ConnectorError> {
Err(report!(errors::ConnectorError::WebhooksNotImplemented))
}
fn get_webhook_event_type(
&self,
_request: &webhooks::IncomingWebhookRequestDetails<'_>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
Err(report!(errors::ConnectorError::WebhooksNotImplemented))
}
fn get_webhook_resource_object(
&self,
_request: &webhooks::IncomingWebhookRequestDetails<'_>,
) -> CustomResult<Box<dyn masking::ErasedMaskSerialize>, errors::ConnectorError> {
Err(report!(errors::ConnectorError::WebhooksNotImplemented))
}
}
lazy_static! {
static ref NORDEA_CONNECTOR_INFO: ConnectorInfo = ConnectorInfo {
display_name:
"Nordea",
description:
"Nordea is one of the leading financial services group in the Nordics and the preferred choice for millions across the region.",
connector_type: enums::HyperswitchConnectorCategory::PaymentGateway,
integration_status: common_enums::ConnectorIntegrationStatus::Beta,
};
static ref NORDEA_SUPPORTED_PAYMENT_METHODS: SupportedPaymentMethods = {
let nordea_supported_capture_methods = vec![
enums::CaptureMethod::Automatic,
enums::CaptureMethod::SequentialAutomatic,
];
let mut nordea_supported_payment_methods = SupportedPaymentMethods::new();
nordea_supported_payment_methods.add(
enums::PaymentMethod::BankDebit,
enums::PaymentMethodType::Sepa,
PaymentMethodDetails {
mandates: common_enums::FeatureStatus::NotSupported,
// Supported only in corporate API (corporate accounts)
refunds: common_enums::FeatureStatus::NotSupported,
supported_capture_methods: nordea_supported_capture_methods.clone(),
specific_features: None,
},
);
nordea_supported_payment_methods
};
static ref NORDEA_SUPPORTED_WEBHOOK_FLOWS: Vec<enums::EventClass> = Vec::new();
}
impl ConnectorSpecifications for Nordea {
fn get_connector_about(&self) -> Option<&'static ConnectorInfo> {
Some(&*NORDEA_CONNECTOR_INFO)
}
fn get_supported_payment_methods(&self) -> Option<&'static SupportedPaymentMethods> {
Some(&*NORDEA_SUPPORTED_PAYMENT_METHODS)
}
fn get_supported_webhook_flows(&self) -> Option<&'static [enums::EventClass]> {
Some(&*NORDEA_SUPPORTED_WEBHOOK_FLOWS)
}
fn authentication_token_for_token_creation(&self) -> bool {
// Nordea requires authentication token for access token creation
true
}
}
|
crates/hyperswitch_connectors/src/connectors/nordea.rs#chunk1
|
hyperswitch_connectors
|
chunk
| null | null | null | 647
| null | null | null | null | null | null | null |
// Implementation: impl api::Refund for for Zsl
// File: crates/hyperswitch_connectors/src/connectors/zsl.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::Refund for for Zsl
|
crates/hyperswitch_connectors/src/connectors/zsl.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 57
| null |
Zsl
|
api::Refund for
| 0
| 0
| null | null |
// Struct: RoutingAlgorithmRecord
// File: crates/router/src/core/payments/routing/utils.rs
// Module: router
// Implementations: 0
pub struct RoutingAlgorithmRecord
|
crates/router/src/core/payments/routing/utils.rs
|
router
|
struct_definition
|
RoutingAlgorithmRecord
| 0
|
[] | 38
| null | null | null | null | null | null | null |
}
#[cfg(feature = "v1")]
pub async fn save_in_locker_external(
state: &SessionState,
merchant_context: &domain::MerchantContext,
payment_method_request: api::PaymentMethodCreate,
card_detail: Option<api::CardDetail>,
external_vault_connector_details: &ExternalVaultConnectorDetails,
) -> RouterResult<(
api_models::payment_methods::PaymentMethodResponse,
Option<payment_methods::transformers::DataDuplicationCheck>,
)> {
let customer_id = payment_method_request
.customer_id
.clone()
.get_required_value("customer_id")?;
// For external vault, we need to convert the card data to PaymentMethodVaultingData
if let Some(card) = card_detail {
let payment_method_vaulting_data =
hyperswitch_domain_models::vault::PaymentMethodVaultingData::Card(card.clone());
let external_vault_mca_id = external_vault_connector_details.vault_connector_id.clone();
let key_manager_state = &state.into();
let merchant_connector_account_details = state
.store
.find_by_merchant_connector_account_merchant_id_merchant_connector_id(
key_manager_state,
merchant_context.get_merchant_account().get_id(),
&external_vault_mca_id,
merchant_context.get_merchant_key_store(),
)
.await
.to_not_found_response(errors::ApiErrorResponse::MerchantConnectorAccountNotFound {
id: external_vault_mca_id.get_string_repr().to_string(),
})?;
// Call vault_payment_method_external_v1
let vault_response = vault_payment_method_external_v1(
state,
&payment_method_vaulting_data,
merchant_context.get_merchant_account(),
merchant_connector_account_details,
)
.await?;
let payment_method_id = vault_response.vault_id.to_string().to_owned();
let card_detail = CardDetailFromLocker::from(card);
let pm_resp = api::PaymentMethodResponse {
merchant_id: merchant_context.get_merchant_account().get_id().to_owned(),
customer_id: Some(customer_id),
payment_method_id,
payment_method: payment_method_request.payment_method,
payment_method_type: payment_method_request.payment_method_type,
card: Some(card_detail),
recurring_enabled: Some(false),
installment_payment_enabled: Some(false),
payment_experience: Some(vec![api_models::enums::PaymentExperience::RedirectToUrl]),
metadata: None,
created: Some(common_utils::date_time::now()),
#[cfg(feature = "payouts")]
bank_transfer: None,
last_used_at: Some(common_utils::date_time::now()),
client_secret: None,
};
Ok((pm_resp, None))
} else {
//Similar implementation is done for save in locker internal
let pm_id = common_utils::generate_id(consts::ID_LENGTH, "pm");
let payment_method_response = api::PaymentMethodResponse {
merchant_id: merchant_context.get_merchant_account().get_id().to_owned(),
customer_id: Some(customer_id),
payment_method_id: pm_id,
payment_method: payment_method_request.payment_method,
payment_method_type: payment_method_request.payment_method_type,
#[cfg(feature = "payouts")]
bank_transfer: None,
card: None,
metadata: None,
created: Some(common_utils::date_time::now()),
recurring_enabled: Some(false),
installment_payment_enabled: Some(false),
payment_experience: Some(vec![api_models::enums::PaymentExperience::RedirectToUrl]), //[#219]
last_used_at: Some(common_utils::date_time::now()),
client_secret: None,
};
Ok((payment_method_response, None))
}
}
#[cfg(feature = "v2")]
pub async fn save_in_locker_internal(
_state: &SessionState,
_merchant_context: &domain::MerchantContext,
_payment_method_request: api::PaymentMethodCreate,
) -> RouterResult<(
api_models::payment_methods::PaymentMethodResponse,
Option<payment_methods::transformers::DataDuplicationCheck>,
)> {
todo!()
}
#[cfg(feature = "v2")]
pub async fn save_network_token_in_locker(
_state: &SessionState,
_merchant_context: &domain::MerchantContext,
_card_data: &domain::Card,
_payment_method_request: api::PaymentMethodCreate,
) -> RouterResult<(
Option<api_models::payment_methods::PaymentMethodResponse>,
Option<payment_methods::transformers::DataDuplicationCheck>,
Option<String>,
)> {
todo!()
}
#[cfg(feature = "v1")]
pub async fn save_network_token_in_locker(
state: &SessionState,
merchant_context: &domain::MerchantContext,
card_data: &payment_method_data::Card,
network_token_data: Option<api::CardDetail>,
payment_method_request: api::PaymentMethodCreate,
) -> RouterResult<(
Option<api_models::payment_methods::PaymentMethodResponse>,
Option<payment_methods::transformers::DataDuplicationCheck>,
Option<String>,
)> {
let customer_id = payment_method_request
.customer_id
.clone()
.get_required_value("customer_id")?;
let network_tokenization_supported_card_networks = &state
.conf
.network_tokenization_supported_card_networks
.card_networks;
match network_token_data {
Some(nt_data) => {
let (res, dc) = Box::pin(
PmCards {
state,
merchant_context,
}
.add_card_to_locker(
payment_method_request,
&nt_data,
&customer_id,
None,
),
)
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Add Network Token Failed")?;
Ok((Some(res), dc, None))
}
None => {
if card_data
.card_network
.as_ref()
.filter(|cn| network_tokenization_supported_card_networks.contains(cn))
.is_some()
{
let optional_card_cvc = Some(card_data.card_cvc.clone());
match network_tokenization::make_card_network_tokenization_request(
state,
&domain::CardDetail::from(card_data),
optional_card_cvc,
&customer_id,
)
.await
{
Ok((token_response, network_token_requestor_ref_id)) => {
// Only proceed if the tokenization was successful
let network_token_data = api::CardDetail {
card_number: token_response.token.clone(),
card_exp_month: token_response.token_expiry_month.clone(),
card_exp_year: token_response.token_expiry_year.clone(),
card_holder_name: None,
nick_name: None,
card_issuing_country: None,
card_network: Some(token_response.card_brand.clone()),
card_issuer: None,
card_type: None,
};
let (res, dc) = Box::pin(
PmCards {
state,
merchant_context,
}
.add_card_to_locker(
payment_method_request,
&network_token_data,
&customer_id,
None,
),
)
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Add Network Token Failed")?;
Ok((Some(res), dc, network_token_requestor_ref_id))
}
Err(err) => {
logger::error!("Failed to tokenize card: {:?}", err);
Ok((None, None, None)) //None will be returned in case of error when calling network tokenization service
}
}
} else {
Ok((None, None, None)) //None will be returned in case of unsupported card network.
}
}
}
}
pub fn handle_tokenization_response<F, Req>(
resp: &mut types::RouterData<F, Req, types::PaymentsResponseData>,
) {
let response = resp.response.clone();
if let Err(err) = response {
if let Some(secret_metadata) = &err.connector_metadata {
let metadata = secret_metadata.clone().expose();
if let Some(token) = metadata
.get("payment_method_token")
.and_then(|t| t.as_str())
{
resp.response = Ok(types::PaymentsResponseData::TokenizationResponse {
token: token.to_string(),
});
}
}
}
}
pub fn create_payment_method_metadata(
metadata: Option<&pii::SecretSerdeValue>,
connector_token: Option<(String, String)>,
) -> RouterResult<Option<serde_json::Value>> {
let mut meta = match metadata {
None => serde_json::Map::new(),
Some(meta) => {
let metadata = meta.clone().expose();
let existing_metadata: serde_json::Map<String, serde_json::Value> = metadata
.parse_value("Map<String, Value>")
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Failed to parse the metadata")?;
existing_metadata
}
};
Ok(connector_token.and_then(|connector_and_token| {
meta.insert(
connector_and_token.0,
serde_json::Value::String(connector_and_token.1),
)
}))
}
pub async fn add_payment_method_token<F: Clone, T: types::Tokenizable + Clone>(
state: &SessionState,
connector: &api::ConnectorData,
tokenization_action: &payments::TokenizationAction,
router_data: &mut types::RouterData<F, T, types::PaymentsResponseData>,
pm_token_request_data: types::PaymentMethodTokenizationData,
should_continue_payment: bool,
) -> RouterResult<types::PaymentMethodTokenResult> {
if should_continue_payment {
match tokenization_action {
payments::TokenizationAction::TokenizeInConnector => {
let connector_integration: services::BoxedPaymentConnectorIntegrationInterface<
api::PaymentMethodToken,
types::PaymentMethodTokenizationData,
types::PaymentsResponseData,
> = connector.connector.get_connector_integration();
let pm_token_response_data: Result<
types::PaymentsResponseData,
types::ErrorResponse,
> = Err(types::ErrorResponse::default());
let pm_token_router_data =
helpers::router_data_type_conversion::<_, api::PaymentMethodToken, _, _, _, _>(
router_data.clone(),
pm_token_request_data,
pm_token_response_data,
);
router_data
.request
.set_session_token(pm_token_router_data.session_token.clone());
let mut resp = services::execute_connector_processing_step(
state,
connector_integration,
&pm_token_router_data,
payments::CallConnectorAction::Trigger,
None,
None,
)
.await
.to_payment_failed_response()?;
// checks for metadata in the ErrorResponse, if present bypasses it and constructs an Ok response
handle_tokenization_response(&mut resp);
metrics::CONNECTOR_PAYMENT_METHOD_TOKENIZATION.add(
1,
router_env::metric_attributes!(
("connector", connector.connector_name.to_string()),
("payment_method", router_data.payment_method.to_string()),
),
);
let payment_token_resp = resp.response.map(|res| {
if let types::PaymentsResponseData::TokenizationResponse { token } = res {
Some(token)
} else {
None
}
});
Ok(types::PaymentMethodTokenResult {
payment_method_token_result: payment_token_resp,
is_payment_method_tokenization_performed: true,
connector_response: resp.connector_response.clone(),
})
}
_ => Ok(types::PaymentMethodTokenResult {
payment_method_token_result: Ok(None),
is_payment_method_tokenization_performed: false,
connector_response: None,
}),
}
} else {
logger::debug!("Skipping connector tokenization based on should_continue_payment flag");
Ok(types::PaymentMethodTokenResult {
payment_method_token_result: Ok(None),
is_payment_method_tokenization_performed: false,
connector_response: None,
})
}
}
pub fn update_router_data_with_payment_method_token_result<F: Clone, T>(
payment_method_token_result: types::PaymentMethodTokenResult,
router_data: &mut types::RouterData<F, T, types::PaymentsResponseData>,
is_retry_payment: bool,
should_continue_further: bool,
) -> bool {
if payment_method_token_result.is_payment_method_tokenization_performed {
match payment_method_token_result.payment_method_token_result {
Ok(pm_token_result) => {
router_data.payment_method_token = pm_token_result.map(|pm_token| {
hyperswitch_domain_models::router_data::PaymentMethodToken::Token(Secret::new(
pm_token,
))
});
if router_data.connector_response.is_none() {
router_data.connector_response =
payment_method_token_result.connector_response.clone();
}
true
}
Err(err) => {
if is_retry_payment {
router_data.response = Err(err);
false
} else {
logger::debug!(payment_method_tokenization_error=?err);
true
}
}
}
} else {
should_continue_further
}
}
#[cfg(feature = "v1")]
pub fn add_connector_mandate_details_in_payment_method(
payment_method_type: Option<storage_enums::PaymentMethodType>,
authorized_amount: Option<i64>,
authorized_currency: Option<storage_enums::Currency>,
merchant_connector_id: Option<id_type::MerchantConnectorAccountId>,
connector_mandate_id: Option<String>,
mandate_metadata: Option<Secret<serde_json::Value>>,
connector_mandate_request_reference_id: Option<String>,
) -> Option<CommonMandateReference> {
let mut mandate_details = HashMap::new();
if let Some((mca_id, connector_mandate_id)) =
merchant_connector_id.clone().zip(connector_mandate_id)
{
mandate_details.insert(
mca_id,
PaymentsMandateReferenceRecord {
connector_mandate_id,
payment_method_type,
original_payment_authorized_amount: authorized_amount,
original_payment_authorized_currency: authorized_currency,
mandate_metadata,
connector_mandate_status: Some(ConnectorMandateStatus::Active),
connector_mandate_request_reference_id,
},
);
Some(CommonMandateReference {
payments: Some(PaymentsMandateReference(mandate_details)),
payouts: None,
})
} else {
None
}
}
#[allow(clippy::too_many_arguments)]
#[cfg(feature = "v1")]
pub fn update_connector_mandate_details(
mandate_details: Option<CommonMandateReference>,
payment_method_type: Option<storage_enums::PaymentMethodType>,
authorized_amount: Option<i64>,
authorized_currency: Option<storage_enums::Currency>,
merchant_connector_id: Option<id_type::MerchantConnectorAccountId>,
connector_mandate_id: Option<String>,
mandate_metadata: Option<Secret<serde_json::Value>>,
connector_mandate_request_reference_id: Option<String>,
) -> RouterResult<Option<CommonMandateReference>> {
let mandate_reference = match mandate_details
.as_ref()
.and_then(|common_mandate| common_mandate.payments.clone())
{
Some(mut payment_mandate_reference) => {
if let Some((mca_id, connector_mandate_id)) =
merchant_connector_id.clone().zip(connector_mandate_id)
{
let updated_record = PaymentsMandateReferenceRecord {
connector_mandate_id: connector_mandate_id.clone(),
payment_method_type,
original_payment_authorized_amount: authorized_amount,
original_payment_authorized_currency: authorized_currency,
mandate_metadata: mandate_metadata.clone(),
connector_mandate_status: Some(ConnectorMandateStatus::Active),
connector_mandate_request_reference_id: connector_mandate_request_reference_id
.clone(),
};
payment_mandate_reference
.entry(mca_id)
.and_modify(|pm| *pm = updated_record)
.or_insert(PaymentsMandateReferenceRecord {
connector_mandate_id,
payment_method_type,
original_payment_authorized_amount: authorized_amount,
original_payment_authorized_currency: authorized_currency,
mandate_metadata: mandate_metadata.clone(),
connector_mandate_status: Some(ConnectorMandateStatus::Active),
connector_mandate_request_reference_id,
});
let payout_data = mandate_details.and_then(|common_mandate| common_mandate.payouts);
Some(CommonMandateReference {
payments: Some(payment_mandate_reference),
payouts: payout_data,
})
} else {
None
}
}
None => add_connector_mandate_details_in_payment_method(
payment_method_type,
authorized_amount,
authorized_currency,
merchant_connector_id,
connector_mandate_id,
mandate_metadata,
connector_mandate_request_reference_id,
),
};
Ok(mandate_reference)
}
#[cfg(feature = "v1")]
pub fn update_connector_mandate_details_status(
merchant_connector_id: id_type::MerchantConnectorAccountId,
mut payment_mandate_reference: PaymentsMandateReference,
status: ConnectorMandateStatus,
) -> RouterResult<Option<CommonMandateReference>> {
let mandate_reference = {
payment_mandate_reference
.entry(merchant_connector_id)
.and_modify(|pm| {
let update_rec = PaymentsMandateReferenceRecord {
connector_mandate_id: pm.connector_mandate_id.clone(),
payment_method_type: pm.payment_method_type,
original_payment_authorized_amount: pm.original_payment_authorized_amount,
original_payment_authorized_currency: pm.original_payment_authorized_currency,
mandate_metadata: pm.mandate_metadata.clone(),
connector_mandate_status: Some(status),
connector_mandate_request_reference_id: pm
.connector_mandate_request_reference_id
.clone(),
};
*pm = update_rec
});
Some(payment_mandate_reference)
};
Ok(Some(CommonMandateReference {
payments: mandate_reference,
payouts: None,
}))
}
#[cfg(feature = "v2")]
pub async fn add_token_for_payment_method(
router_data: &mut types::RouterData<
api::PaymentMethodToken,
types::PaymentMethodTokenizationData,
types::PaymentsResponseData,
>,
payment_method_data_request: types::PaymentMethodTokenizationData,
state: SessionState,
merchant_connector_account_details: &hyperswitch_domain_models::merchant_connector_account::MerchantConnectorAccount,
) -> RouterResult<types::PspTokenResult> {
let connector_id = merchant_connector_account_details.id.clone();
let connector_data = api::ConnectorData::get_connector_by_name(
&(state.conf.connectors),
&merchant_connector_account_details
.connector_name
.to_string(),
api::GetToken::Connector,
Some(connector_id.clone()),
)?;
let connector_integration: services::BoxedPaymentConnectorIntegrationInterface<
api::PaymentMethodToken,
types::PaymentMethodTokenizationData,
types::PaymentsResponseData,
> = connector_data.connector.get_connector_integration();
let payment_method_token_response_data_type: Result<
types::PaymentsResponseData,
types::ErrorResponse,
> = Err(types::ErrorResponse::default());
let payment_method_token_router_data =
helpers::router_data_type_conversion::<_, api::PaymentMethodToken, _, _, _, _>(
router_data.clone(),
payment_method_data_request.clone(),
payment_method_token_response_data_type,
);
let connector_integration_response = services::execute_connector_processing_step(
&state,
connector_integration,
&payment_method_token_router_data,
payments::CallConnectorAction::Trigger,
None,
None,
)
.await
.to_payment_failed_response()?;
let payment_token_response = connector_integration_response.response.map(|res| {
if let types::PaymentsResponseData::TokenizationResponse { token } = res {
Ok(token)
} else {
Err(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Failed to get token from connector")
}
});
match payment_token_response {
Ok(token) => Ok(types::PspTokenResult { token: Ok(token?) }),
Err(error_response) => Ok(types::PspTokenResult {
token: Err(error_response),
}),
}
}
#[cfg(feature = "v1")]
#[allow(clippy::too_many_arguments)]
pub async fn save_card_and_network_token_in_locker(
state: &SessionState,
customer_id: id_type::CustomerId,
payment_method_status: common_enums::PaymentMethodStatus,
payment_method_data: domain::PaymentMethodData,
vault_operation: Option<hyperswitch_domain_models::payments::VaultOperation>,
payment_method_info: Option<domain::PaymentMethod>,
merchant_context: &domain::MerchantContext,
payment_method_create_request: api::PaymentMethodCreate,
is_network_tokenization_enabled: bool,
business_profile: &domain::Profile,
) -> RouterResult<(
(
api_models::payment_methods::PaymentMethodResponse,
Option<payment_methods::transformers::DataDuplicationCheck>,
Option<String>,
),
Option<api_models::payment_methods::PaymentMethodResponse>,
)> {
let network_token_requestor_reference_id = payment_method_info
.and_then(|pm_info| pm_info.network_token_requestor_reference_id.clone());
match vault_operation {
Some(hyperswitch_domain_models::payments::VaultOperation::SaveCardData(card)) => {
let card_data = api::CardDetail::from(card.card_data.clone());
if let (Some(nt_ref_id), Some(tokenization_service)) = (
card.network_token_req_ref_id.clone(),
&state.conf.network_tokenization_service,
) {
let _ = record_operation_time(
async {
network_tokenization::delete_network_token_from_tokenization_service(
state,
nt_ref_id.clone(),
&customer_id,
tokenization_service.get_inner(),
)
.await
},
&metrics::DELETE_NETWORK_TOKEN_TIME,
&[],
)
.await;
}
let (res, dc) = Box::pin(save_in_locker(
state,
merchant_context,
payment_method_create_request.to_owned(),
Some(card_data),
business_profile,
))
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Add Card In Locker Failed")?;
Ok(((res, dc, None), None))
}
Some(hyperswitch_domain_models::payments::VaultOperation::SaveCardAndNetworkTokenData(
save_card_and_network_token_data,
)) => {
let card_data =
api::CardDetail::from(save_card_and_network_token_data.card_data.clone());
let network_token_data = api::CardDetail::from(
save_card_and_network_token_data
.network_token
.network_token_data
.clone(),
);
if payment_method_status == common_enums::PaymentMethodStatus::Active {
let (res, dc) = Box::pin(save_in_locker_internal(
state,
merchant_context,
payment_method_create_request.to_owned(),
Some(card_data),
))
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Add Card In Locker Failed")?;
let (network_token_resp, _dc, _) = Box::pin(save_network_token_in_locker(
state,
merchant_context,
&save_card_and_network_token_data.card_data,
Some(network_token_data),
payment_method_create_request.clone(),
))
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Add Network Token In Locker Failed")?;
Ok((
(res, dc, network_token_requestor_reference_id),
network_token_resp,
))
} else {
if let (Some(nt_ref_id), Some(tokenization_service)) = (
network_token_requestor_reference_id.clone(),
&state.conf.network_tokenization_service,
) {
let _ = record_operation_time(
async {
network_tokenization::delete_network_token_from_tokenization_service(
state,
nt_ref_id.clone(),
&customer_id,
tokenization_service.get_inner(),
)
.await
},
&metrics::DELETE_NETWORK_TOKEN_TIME,
&[],
)
.await;
}
let (res, dc) = Box::pin(save_in_locker_internal(
state,
merchant_context,
payment_method_create_request.to_owned(),
Some(card_data),
))
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Add Card In Locker Failed")?;
Ok(((res, dc, None), None))
}
}
_ => {
let card_data = payment_method_create_request.card.clone();
let (res, dc) = Box::pin(save_in_locker(
state,
merchant_context,
payment_method_create_request.to_owned(),
card_data,
business_profile,
))
.await
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Add Card In Locker Failed")?;
if is_network_tokenization_enabled {
match &payment_method_data {
domain::PaymentMethodData::Card(card) => {
let (
network_token_resp,
_network_token_duplication_check, //the duplication check is discarded, since each card has only one token, handling card duplication check will be suffice
network_token_requestor_ref_id,
) = Box::pin(save_network_token_in_locker(
state,
merchant_context,
card,
None,
payment_method_create_request.clone(),
))
.await?;
Ok((
(res, dc, network_token_requestor_ref_id),
network_token_resp,
))
}
_ => Ok(((res, dc, None), None)), //network_token_resp is None in case of other payment methods
}
} else {
Ok(((res, dc, None), None))
}
}
}
}
|
crates/router/src/core/payments/tokenization.rs#chunk1
|
router
|
chunk
| null | null | null | 5,617
| null | null | null | null | null | null | null |
// Function: new
// File: crates/hyperswitch_connectors/src/connectors/bamboraapac.rs
// Module: hyperswitch_connectors
pub fn new() -> &'static Self
|
crates/hyperswitch_connectors/src/connectors/bamboraapac.rs
|
hyperswitch_connectors
|
function_signature
| null | null | null | 41
|
new
| null | null | null | null | null | null |
// Implementation: impl api::PaymentSession for for Nomupay
// File: crates/hyperswitch_connectors/src/connectors/nomupay.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::PaymentSession for for Nomupay
|
crates/hyperswitch_connectors/src/connectors/nomupay.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 61
| null |
Nomupay
|
api::PaymentSession for
| 0
| 0
| null | null |
// Struct: Mistercash
// File: crates/hyperswitch_connectors/src/connectors/multisafepay/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct Mistercash
|
crates/hyperswitch_connectors/src/connectors/multisafepay/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
Mistercash
| 0
|
[] | 49
| null | null | null | null | null | null | null |
// Function: get_vault_data
// File: crates/router/src/core/proxy/utils.rs
// Module: router
pub fn get_vault_data(
&self,
state: &SessionState,
merchant_context: domain::MerchantContext,
) -> RouterResult<Value>
|
crates/router/src/core/proxy/utils.rs
|
router
|
function_signature
| null | null | null | 59
|
get_vault_data
| null | null | null | null | null | null |
// Function: call_decision_manager
// File: crates/router/src/core/payments.rs
// Module: router
pub fn call_decision_manager<F, D>(
state: &SessionState,
merchant_context: &domain::MerchantContext,
_business_profile: &domain::Profile,
payment_data: &D,
) -> RouterResult<Option<enums::AuthenticationType>>
where
F: Clone,
D: OperationSessionGetters<F>,
|
crates/router/src/core/payments.rs
|
router
|
function_signature
| null | null | null | 93
|
call_decision_manager
| null | null | null | null | null | null |
// Function: refund_payment
// File: crates/router/src/routes/dummy_connector/core.rs
// Module: router
pub fn refund_payment(
state: SessionState,
req: types::DummyConnectorRefundRequest,
) -> types::DummyConnectorResponse<types::DummyConnectorRefundResponse>
|
crates/router/src/routes/dummy_connector/core.rs
|
router
|
function_signature
| null | null | null | 62
|
refund_payment
| null | null | null | null | null | null |
// Struct: EnhancedAuthResponse
// File: crates/hyperswitch_connectors/src/connectors/worldpayvantiv/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct EnhancedAuthResponse
|
crates/hyperswitch_connectors/src/connectors/worldpayvantiv/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
EnhancedAuthResponse
| 0
|
[] | 49
| null | null | null | null | null | null | null |
// Struct: References
// File: crates/hyperswitch_connectors/src/connectors/trustpay/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct References
|
crates/hyperswitch_connectors/src/connectors/trustpay/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
References
| 0
|
[] | 44
| null | null | null | null | null | null | null |
// Struct: PaymentIntentMetricRow
// File: crates/analytics/src/payment_intents/metrics.rs
// Module: analytics
// Implementations: 0
pub struct PaymentIntentMetricRow
|
crates/analytics/src/payment_intents/metrics.rs
|
analytics
|
struct_definition
|
PaymentIntentMetricRow
| 0
|
[] | 40
| null | null | null | null | null | null | null |
// Implementation: impl api::PaymentToken for for Gpayments
// File: crates/hyperswitch_connectors/src/connectors/gpayments.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::PaymentToken for for Gpayments
|
crates/hyperswitch_connectors/src/connectors/gpayments.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 57
| null |
Gpayments
|
api::PaymentToken for
| 0
| 0
| null | null |
// Function: get_header_value_by_key
// File: crates/router/src/services/authentication.rs
// Module: router
pub fn get_header_value_by_key(key: String, headers: &HeaderMap) -> RouterResult<Option<&str>>
|
crates/router/src/services/authentication.rs
|
router
|
function_signature
| null | null | null | 48
|
get_header_value_by_key
| null | null | null | null | null | null |
maud::html! {
(maud::DOCTYPE)
html {
head {
meta name="viewport" content="width=device-width, initial-scale=1";
}
body style="background-color: #ffffff; padding: 20px; font-family: Arial, Helvetica, Sans-Serif;" {
div id="loader1" class="lottie" style="height: 150px; display: block; position: relative; margin-top: 150px; margin-left: auto; margin-right: auto;" { "" }
(PreEscaped(r#"<script src="https://cdnjs.cloudflare.com/ajax/libs/bodymovin/5.7.4/lottie.min.js"></script>"#))
(PreEscaped(r#"
<script>
var anime = bodymovin.loadAnimation({
container: document.getElementById('loader1'),
renderer: 'svg',
loop: true,
autoplay: true,
name: 'hyperswitch loader',
animationData: {"v":"4.8.0","meta":{"g":"LottieFiles AE 3.1.1","a":"","k":"","d":"","tc":""},"fr":29.9700012207031,"ip":0,"op":31.0000012626559,"w":400,"h":250,"nm":"loader_shape","ddd":0,"assets":[],"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"circle 2","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[278.25,202.671,0],"ix":2},"a":{"a":0,"k":[23.72,23.72,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[12.935,0],[0,-12.936],[-12.935,0],[0,12.935]],"o":[[-12.952,0],[0,12.935],[12.935,0],[0,-12.936]],"v":[[0,-23.471],[-23.47,0.001],[0,23.471],[23.47,0.001]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[0,0.427451010311,0.976470648074,1],"ix":4},"o":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":10,"s":[10]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":19.99,"s":[100]},{"t":29.9800012211104,"s":[10]}],"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[23.72,23.721],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":48.0000019550801,"st":0,"bm":0},{"ddd":0,"ind":2,"ty":4,"nm":"square 2","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[196.25,201.271,0],"ix":2},"a":{"a":0,"k":[22.028,22.03,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[1.914,0],[0,0],[0,-1.914],[0,0],[-1.914,0],[0,0],[0,1.914],[0,0]],"o":[[0,0],[-1.914,0],[0,0],[0,1.914],[0,0],[1.914,0],[0,0],[0,-1.914]],"v":[[18.313,-21.779],[-18.312,-21.779],[-21.779,-18.313],[-21.779,18.314],[-18.312,21.779],[18.313,21.779],[21.779,18.314],[21.779,-18.313]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[0,0.427451010311,0.976470648074,1],"ix":4},"o":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":5,"s":[10]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":14.99,"s":[100]},{"t":24.9800010174563,"s":[10]}],"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[22.028,22.029],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":47.0000019143492,"st":0,"bm":0},{"ddd":0,"ind":3,"ty":4,"nm":"Triangle 2","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[116.25,200.703,0],"ix":2},"a":{"a":0,"k":[27.11,21.243,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[0.558,-0.879],[0,0],[-1.133,0],[0,0],[0.609,0.947],[0,0]],"o":[[-0.558,-0.879],[0,0],[-0.609,0.947],[0,0],[1.133,0],[0,0],[0,0]],"v":[[1.209,-20.114],[-1.192,-20.114],[-26.251,18.795],[-25.051,20.993],[25.051,20.993],[26.251,18.795],[1.192,-20.114]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[0,0.427451010311,0.976470648074,1],"ix":4},"o":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":0,"s":[10]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":9.99,"s":[100]},{"t":19.9800008138021,"s":[10]}],"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[27.11,21.243],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":48.0000019550801,"st":0,"bm":0}],"markers":[]}
})
</script>
"#))
h3 style="text-align: center;" { "Please wait while we process your payment..." }
}
// This is the iframe recommended by cybersource but the redirection happens inside this iframe once otp
// is received and we lose control of the redirection on user client browser, so to avoid that we have removed this iframe and directly consumed it.
// (PreEscaped(r#"<iframe id="step_up_iframe" style="border: none; margin-left: auto; margin-right: auto; display: block" height="800px" width="400px" name="stepUpIframe"></iframe>"#))
(PreEscaped(format!("<form id=\"step-up-form\" method=\"POST\" action=\"{step_up_url}\">
<input type=\"hidden\" name=\"JWT\" value=\"{access_token}\">
</form>")))
(PreEscaped(format!("<script>
{logging_template}
window.onload = function() {{
var stepUpForm = document.querySelector('#step-up-form'); if(stepUpForm) stepUpForm.submit();
}}
</script>")))
}}
}
RedirectForm::BlueSnap {
payment_fields_token,
} => {
let card_details = if let Some(PaymentMethodData::Card(ccard)) = payment_method_data {
format!(
"var saveCardDirectly={{cvv: \"{}\",amount: {},currency: \"{}\"}};",
ccard.card_cvc.peek(),
amount,
currency
)
} else {
"".to_string()
};
let bluesnap_sdk_url = config.connectors.bluesnap.secondary_base_url;
maud::html! {
(maud::DOCTYPE)
html {
head {
meta name="viewport" content="width=device-width, initial-scale=1";
(PreEscaped(format!("<script src=\"{bluesnap_sdk_url}web-sdk/5/bluesnap.js\"></script>")))
}
body style="background-color: #ffffff; padding: 20px; font-family: Arial, Helvetica, Sans-Serif;" {
div id="loader1" class="lottie" style="height: 150px; display: block; position: relative; margin-top: 150px; margin-left: auto; margin-right: auto;" { "" }
(PreEscaped(r#"<script src="https://cdnjs.cloudflare.com/ajax/libs/bodymovin/5.7.4/lottie.min.js"></script>"#))
(PreEscaped(r#"
<script>
var anime = bodymovin.loadAnimation({
container: document.getElementById('loader1'),
renderer: 'svg',
loop: true,
autoplay: true,
name: 'hyperswitch loader',
animationData: {"v":"4.8.0","meta":{"g":"LottieFiles AE 3.1.1","a":"","k":"","d":"","tc":""},"fr":29.9700012207031,"ip":0,"op":31.0000012626559,"w":400,"h":250,"nm":"loader_shape","ddd":0,"assets":[],"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"circle 2","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[278.25,202.671,0],"ix":2},"a":{"a":0,"k":[23.72,23.72,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[12.935,0],[0,-12.936],[-12.935,0],[0,12.935]],"o":[[-12.952,0],[0,12.935],[12.935,0],[0,-12.936]],"v":[[0,-23.471],[-23.47,0.001],[0,23.471],[23.47,0.001]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[0,0.427451010311,0.976470648074,1],"ix":4},"o":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":10,"s":[10]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":19.99,"s":[100]},{"t":29.9800012211104,"s":[10]}],"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[23.72,23.721],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":48.0000019550801,"st":0,"bm":0},{"ddd":0,"ind":2,"ty":4,"nm":"square 2","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[196.25,201.271,0],"ix":2},"a":{"a":0,"k":[22.028,22.03,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[1.914,0],[0,0],[0,-1.914],[0,0],[-1.914,0],[0,0],[0,1.914],[0,0]],"o":[[0,0],[-1.914,0],[0,0],[0,1.914],[0,0],[1.914,0],[0,0],[0,-1.914]],"v":[[18.313,-21.779],[-18.312,-21.779],[-21.779,-18.313],[-21.779,18.314],[-18.312,21.779],[18.313,21.779],[21.779,18.314],[21.779,-18.313]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[0,0.427451010311,0.976470648074,1],"ix":4},"o":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":5,"s":[10]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":14.99,"s":[100]},{"t":24.9800010174563,"s":[10]}],"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[22.028,22.029],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":47.0000019143492,"st":0,"bm":0},{"ddd":0,"ind":3,"ty":4,"nm":"Triangle 2","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[116.25,200.703,0],"ix":2},"a":{"a":0,"k":[27.11,21.243,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[0.558,-0.879],[0,0],[-1.133,0],[0,0],[0.609,0.947],[0,0]],"o":[[-0.558,-0.879],[0,0],[-0.609,0.947],[0,0],[1.133,0],[0,0],[0,0]],"v":[[1.209,-20.114],[-1.192,-20.114],[-26.251,18.795],[-25.051,20.993],[25.051,20.993],[26.251,18.795],[1.192,-20.114]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[0,0.427451010311,0.976470648074,1],"ix":4},"o":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":0,"s":[10]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":9.99,"s":[100]},{"t":19.9800008138021,"s":[10]}],"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[27.11,21.243],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":48.0000019550801,"st":0,"bm":0}],"markers":[]}
})
</script>
"#))
h3 style="text-align: center;" { "Please wait while we process your payment..." }
}
(PreEscaped(format!("<script>
{logging_template}
bluesnap.threeDsPaymentsSetup(\"{payment_fields_token}\",
function(sdkResponse) {{
// console.log(sdkResponse);
var f = document.createElement('form');
f.action=window.location.pathname.replace(/payments\\/redirect\\/(\\w+)\\/(\\w+)\\/\\w+/, \"payments/$1/$2/redirect/complete/bluesnap?paymentToken={payment_fields_token}\");
f.method='POST';
var i=document.createElement('input');
i.type='hidden';
i.name='authentication_response';
i.value=JSON.stringify(sdkResponse);
f.appendChild(i);
document.body.appendChild(f);
f.submit();
}});
{card_details}
bluesnap.threeDsPaymentsSubmitData(saveCardDirectly);
</script>
")))
}}
}
RedirectForm::CybersourceAuthSetup {
access_token,
ddc_url,
reference_id,
} => {
maud::html! {
(maud::DOCTYPE)
html {
head {
meta name="viewport" content="width=device-width, initial-scale=1";
}
body style="background-color: #ffffff; padding: 20px; font-family: Arial, Helvetica, Sans-Serif;" {
div id="loader1" class="lottie" style="height: 150px; display: block; position: relative; margin-top: 150px; margin-left: auto; margin-right: auto;" { "" }
(PreEscaped(r#"<script src="https://cdnjs.cloudflare.com/ajax/libs/bodymovin/5.7.4/lottie.min.js"></script>"#))
(PreEscaped(r#"
<script>
var anime = bodymovin.loadAnimation({
container: document.getElementById('loader1'),
renderer: 'svg',
loop: true,
autoplay: true,
name: 'hyperswitch loader',
|
crates/router/src/services/api.rs#chunk2
|
router
|
chunk
| null | null | null | 6,138
| null | null | null | null | null | null | null |
// Implementation: impl api::PaymentCapture for for Sift
// File: crates/hyperswitch_connectors/src/connectors/sift.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::PaymentCapture for for Sift
|
crates/hyperswitch_connectors/src/connectors/sift.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 57
| null |
Sift
|
api::PaymentCapture for
| 0
| 0
| null | null |
// Implementation: impl Default for for ZeroMandates
// File: crates/payment_methods/src/configs/payment_connector_required_fields.rs
// Module: payment_methods
// Methods: 1 total (0 public)
impl Default for for ZeroMandates
|
crates/payment_methods/src/configs/payment_connector_required_fields.rs
|
payment_methods
|
impl_block
| null | null | null | 51
| null |
ZeroMandates
|
Default for
| 1
| 0
| null | null |
// Function: parse_and_log_keys_in_url_encoded_response
// File: crates/hyperswitch_connectors/src/connectors/fiuu.rs
// Module: hyperswitch_connectors
pub fn parse_and_log_keys_in_url_encoded_response<T>(data: &[u8])
|
crates/hyperswitch_connectors/src/connectors/fiuu.rs
|
hyperswitch_connectors
|
function_signature
| null | null | null | 56
|
parse_and_log_keys_in_url_encoded_response
| null | null | null | null | null | null |
// File: crates/hyperswitch_connectors/src/connectors/finix/transformers.rs
// Module: hyperswitch_connectors
// Public structs: 8
use common_enums::enums;
use common_utils::types::MinorUnit;
use hyperswitch_domain_models::{
payment_method_data::PaymentMethodData,
router_data::{ConnectorAuthType, RouterData},
router_flow_types::refunds::{Execute, RSync},
router_request_types::ResponseId,
router_response_types::{PaymentsResponseData, RefundsResponseData},
types::{PaymentsAuthorizeRouterData, RefundsRouterData},
};
use hyperswitch_interfaces::errors;
use masking::Secret;
use serde::{Deserialize, Serialize};
use crate::types::{RefundsResponseRouterData, ResponseRouterData};
//TODO: Fill the struct with respective fields
pub struct FinixRouterData<T> {
pub amount: MinorUnit, // The type of amount that a connector accepts, for example, String, i64, f64, etc.
pub router_data: T,
}
impl<T> From<(MinorUnit, T)> for FinixRouterData<T> {
fn from((amount, item): (MinorUnit, T)) -> Self {
//Todo : use utils to convert the amount to the type of amount that a connector accepts
Self {
amount,
router_data: item,
}
}
}
//TODO: Fill the struct with respective fields
#[derive(Default, Debug, Serialize, PartialEq)]
pub struct FinixPaymentsRequest {
amount: MinorUnit,
card: FinixCard,
}
#[derive(Default, Debug, Serialize, Eq, PartialEq)]
pub struct FinixCard {
number: cards::CardNumber,
expiry_month: Secret<String>,
expiry_year: Secret<String>,
cvc: Secret<String>,
complete: bool,
}
impl TryFrom<&FinixRouterData<&PaymentsAuthorizeRouterData>> for FinixPaymentsRequest {
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(item: &FinixRouterData<&PaymentsAuthorizeRouterData>) -> Result<Self, Self::Error> {
match item.router_data.request.payment_method_data.clone() {
PaymentMethodData::Card(_) => Err(errors::ConnectorError::NotImplemented(
"Card payment method not implemented".to_string(),
)
.into()),
_ => Err(errors::ConnectorError::NotImplemented("Payment method".to_string()).into()),
}
}
}
//TODO: Fill the struct with respective fields
// Auth Struct
pub struct FinixAuthType {
pub(super) api_key: Secret<String>,
}
impl TryFrom<&ConnectorAuthType> for FinixAuthType {
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(auth_type: &ConnectorAuthType) -> Result<Self, Self::Error> {
match auth_type {
ConnectorAuthType::HeaderKey { api_key } => Ok(Self {
api_key: api_key.to_owned(),
}),
_ => Err(errors::ConnectorError::FailedToObtainAuthType.into()),
}
}
}
// PaymentsResponse
//TODO: Append the remaining status flags
#[derive(Debug, Clone, Copy, Default, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "lowercase")]
pub enum FinixPaymentStatus {
Succeeded,
Failed,
#[default]
Processing,
}
impl From<FinixPaymentStatus> for common_enums::AttemptStatus {
fn from(item: FinixPaymentStatus) -> Self {
match item {
FinixPaymentStatus::Succeeded => Self::Charged,
FinixPaymentStatus::Failed => Self::Failure,
FinixPaymentStatus::Processing => Self::Authorizing,
}
}
}
//TODO: Fill the struct with respective fields
#[derive(Default, Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct FinixPaymentsResponse {
status: FinixPaymentStatus,
id: String,
}
impl<F, T> TryFrom<ResponseRouterData<F, FinixPaymentsResponse, T, PaymentsResponseData>>
for RouterData<F, T, PaymentsResponseData>
{
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(
item: ResponseRouterData<F, FinixPaymentsResponse, T, PaymentsResponseData>,
) -> Result<Self, Self::Error> {
Ok(Self {
status: common_enums::AttemptStatus::from(item.response.status),
response: Ok(PaymentsResponseData::TransactionResponse {
resource_id: ResponseId::ConnectorTransactionId(item.response.id),
redirection_data: Box::new(None),
mandate_reference: Box::new(None),
connector_metadata: None,
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
charges: None,
}),
..item.data
})
}
}
//TODO: Fill the struct with respective fields
// REFUND :
// Type definition for RefundRequest
#[derive(Default, Debug, Serialize)]
pub struct FinixRefundRequest {
pub amount: MinorUnit,
}
impl<F> TryFrom<&FinixRouterData<&RefundsRouterData<F>>> for FinixRefundRequest {
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(item: &FinixRouterData<&RefundsRouterData<F>>) -> Result<Self, Self::Error> {
Ok(Self {
amount: item.amount.to_owned(),
})
}
}
// Type definition for Refund Response
#[allow(dead_code)]
#[derive(Debug, Copy, Serialize, Default, Deserialize, Clone)]
pub enum RefundStatus {
Succeeded,
Failed,
#[default]
Processing,
}
impl From<RefundStatus> for enums::RefundStatus {
fn from(item: RefundStatus) -> Self {
match item {
RefundStatus::Succeeded => Self::Success,
RefundStatus::Failed => Self::Failure,
RefundStatus::Processing => Self::Pending,
//TODO: Review mapping
}
}
}
//TODO: Fill the struct with respective fields
#[derive(Default, Debug, Clone, Serialize, Deserialize)]
pub struct RefundResponse {
id: String,
status: RefundStatus,
}
impl TryFrom<RefundsResponseRouterData<Execute, RefundResponse>> for RefundsRouterData<Execute> {
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(
item: RefundsResponseRouterData<Execute, RefundResponse>,
) -> Result<Self, Self::Error> {
Ok(Self {
response: Ok(RefundsResponseData {
connector_refund_id: item.response.id.to_string(),
refund_status: enums::RefundStatus::from(item.response.status),
}),
..item.data
})
}
}
impl TryFrom<RefundsResponseRouterData<RSync, RefundResponse>> for RefundsRouterData<RSync> {
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(
item: RefundsResponseRouterData<RSync, RefundResponse>,
) -> Result<Self, Self::Error> {
Ok(Self {
response: Ok(RefundsResponseData {
connector_refund_id: item.response.id.to_string(),
refund_status: enums::RefundStatus::from(item.response.status),
}),
..item.data
})
}
}
//TODO: Fill the struct with respective fields
#[derive(Default, Debug, Serialize, Deserialize, PartialEq)]
pub struct FinixErrorResponse {
pub status_code: u16,
pub code: String,
pub message: String,
pub reason: Option<String>,
pub network_advice_code: Option<String>,
pub network_decline_code: Option<String>,
pub network_error_message: Option<String>,
}
|
crates/hyperswitch_connectors/src/connectors/finix/transformers.rs
|
hyperswitch_connectors
|
full_file
| null | null | null | 1,657
| null | null | null | null | null | null | null |
// Function: get_payment_status_for_sync
// File: crates/hyperswitch_connectors/src/connectors/trustpayments/transformers.rs
// Module: hyperswitch_connectors
pub fn get_payment_status_for_sync(&self) -> common_enums::AttemptStatus
|
crates/hyperswitch_connectors/src/connectors/trustpayments/transformers.rs
|
hyperswitch_connectors
|
function_signature
| null | null | null | 55
|
get_payment_status_for_sync
| null | null | null | null | null | null |
// Implementation: impl Hash for for ApiEventMetricsBucketIdentifier
// File: crates/api_models/src/analytics/api_event.rs
// Module: api_models
// Methods: 1 total (0 public)
impl Hash for for ApiEventMetricsBucketIdentifier
|
crates/api_models/src/analytics/api_event.rs
|
api_models
|
impl_block
| null | null | null | 51
| null |
ApiEventMetricsBucketIdentifier
|
Hash for
| 1
| 0
| null | null |
// Implementation: impl api::PaymentsCompleteAuthorize for for Payme
// File: crates/hyperswitch_connectors/src/connectors/payme.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::PaymentsCompleteAuthorize for for Payme
|
crates/hyperswitch_connectors/src/connectors/payme.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 59
| null |
Payme
|
api::PaymentsCompleteAuthorize for
| 0
| 0
| null | null |
// Function: insert_org_in_db
// File: crates/router/src/types/domain/user.rs
// Module: router
pub fn insert_org_in_db(self, state: SessionState) -> UserResult<Organization>
|
crates/router/src/types/domain/user.rs
|
router
|
function_signature
| null | null | null | 43
|
insert_org_in_db
| null | null | null | null | null | null |
// Struct: CybersourceAuthValidateRequest
// File: crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct CybersourceAuthValidateRequest
|
crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
CybersourceAuthValidateRequest
| 0
|
[] | 55
| null | null | null | null | null | null | null |
// Function: get_should_call_gsm_key
// File: crates/common_utils/src/id_type/merchant.rs
// Module: common_utils
// Documentation: Get should call gsm key for payment
pub fn get_should_call_gsm_key(&self) -> String
|
crates/common_utils/src/id_type/merchant.rs
|
common_utils
|
function_signature
| null | null | null | 54
|
get_should_call_gsm_key
| null | null | null | null | null | null |
// Struct: BankOfAmericaRouterData
// File: crates/hyperswitch_connectors/src/connectors/bankofamerica/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct BankOfAmericaRouterData<T>
|
crates/hyperswitch_connectors/src/connectors/bankofamerica/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
BankOfAmericaRouterData
| 0
|
[] | 56
| null | null | null | null | null | null | null |
// Struct: GsmDeleteResponse
// File: crates/api_models/src/gsm.rs
// Module: api_models
// Implementations: 0
pub struct GsmDeleteResponse
|
crates/api_models/src/gsm.rs
|
api_models
|
struct_definition
|
GsmDeleteResponse
| 0
|
[] | 38
| null | null | null | null | null | null | null |
// Function: check_two_factor_auth_status
// File: crates/router/src/routes/user.rs
// Module: router
pub fn check_two_factor_auth_status(
state: web::Data<AppState>,
req: HttpRequest,
) -> HttpResponse
|
crates/router/src/routes/user.rs
|
router
|
function_signature
| null | null | null | 49
|
check_two_factor_auth_status
| null | null | null | null | null | null |
// Function: contract_based_routing_update_configs
// File: crates/router/src/core/routing.rs
// Module: router
pub fn contract_based_routing_update_configs(
state: SessionState,
request: routing_types::ContractBasedRoutingConfig,
merchant_context: domain::MerchantContext,
algorithm_id: common_utils::id_type::RoutingId,
profile_id: common_utils::id_type::ProfileId,
) -> RouterResponse<routing_types::RoutingDictionaryRecord>
|
crates/router/src/core/routing.rs
|
router
|
function_signature
| null | null | null | 97
|
contract_based_routing_update_configs
| null | null | null | null | null | null |
// Module Structure
// File: crates/hyperswitch_connectors/src/connectors/payload.rs
// Module: hyperswitch_connectors
// Public submodules:
pub mod transformers;
|
crates/hyperswitch_connectors/src/connectors/payload.rs
|
hyperswitch_connectors
|
module_structure
| null | null | null | 38
| null | null | null | null | null | 1
| 0
|
// File: crates/api_models/src/blocklist.rs
// Module: api_models
// Public structs: 7
use common_enums::enums;
use common_utils::events::ApiEventMetric;
use masking::StrongSecret;
use utoipa::ToSchema;
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)]
#[serde(rename_all = "snake_case", tag = "type", content = "data")]
pub enum BlocklistRequest {
CardBin(String),
Fingerprint(String),
ExtendedCardBin(String),
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)]
pub struct GenerateFingerprintRequest {
pub card: Card,
pub hash_key: StrongSecret<String>,
}
#[derive(Debug, Clone, serde::Deserialize, serde::Serialize)]
pub struct Card {
pub card_number: StrongSecret<String>,
}
pub type AddToBlocklistRequest = BlocklistRequest;
pub type DeleteFromBlocklistRequest = BlocklistRequest;
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)]
pub struct BlocklistResponse {
pub fingerprint_id: String,
#[schema(value_type = BlocklistDataKind)]
pub data_kind: enums::BlocklistDataKind,
#[serde(with = "common_utils::custom_serde::iso8601")]
pub created_at: time::PrimitiveDateTime,
}
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
#[serde(rename_all = "snake_case")]
pub struct GenerateFingerprintResponsePayload {
pub card_fingerprint: String,
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)]
pub struct ToggleBlocklistResponse {
pub blocklist_guard_status: String,
}
pub type AddToBlocklistResponse = BlocklistResponse;
pub type DeleteFromBlocklistResponse = BlocklistResponse;
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)]
pub struct ListBlocklistQuery {
#[schema(value_type = BlocklistDataKind)]
pub data_kind: enums::BlocklistDataKind,
#[serde(default = "default_list_limit")]
pub limit: u16,
#[serde(default)]
pub offset: u16,
pub client_secret: Option<String>,
}
fn default_list_limit() -> u16 {
10
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)]
pub struct ToggleBlocklistQuery {
#[schema(value_type = BlocklistDataKind)]
pub status: bool,
}
impl ApiEventMetric for BlocklistRequest {}
impl ApiEventMetric for BlocklistResponse {}
impl ApiEventMetric for ToggleBlocklistResponse {}
impl ApiEventMetric for ListBlocklistQuery {}
impl ApiEventMetric for GenerateFingerprintRequest {}
impl ApiEventMetric for ToggleBlocklistQuery {}
impl ApiEventMetric for GenerateFingerprintResponsePayload {}
impl ApiEventMetric for Card {}
|
crates/api_models/src/blocklist.rs
|
api_models
|
full_file
| null | null | null | 608
| null | null | null | null | null | null | null |
// Function: handle_unified_connector_service_response_for_payment_get
// File: crates/router/src/core/unified_connector_service.rs
// Module: router
pub fn handle_unified_connector_service_response_for_payment_get(
response: payments_grpc::PaymentServiceGetResponse,
) -> UnifiedConnectorServiceResult
|
crates/router/src/core/unified_connector_service.rs
|
router
|
function_signature
| null | null | null | 61
|
handle_unified_connector_service_response_for_payment_get
| null | null | null | null | null | null |
// Struct: Address
// File: crates/hyperswitch_connectors/src/connectors/shift4/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct Address
|
crates/hyperswitch_connectors/src/connectors/shift4/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
Address
| 0
|
[] | 44
| null | null | null | null | null | null | null |
// Implementation: impl DisputeMetricAccumulator for for DisputedAmountAccumulator
// File: crates/analytics/src/disputes/accumulators.rs
// Module: analytics
// Methods: 2 total (0 public)
impl DisputeMetricAccumulator for for DisputedAmountAccumulator
|
crates/analytics/src/disputes/accumulators.rs
|
analytics
|
impl_block
| null | null | null | 64
| null |
DisputedAmountAccumulator
|
DisputeMetricAccumulator for
| 2
| 0
| null | null |
// Implementation: impl api::RefundExecute for for Rapyd
// File: crates/hyperswitch_connectors/src/connectors/rapyd.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::RefundExecute for for Rapyd
|
crates/hyperswitch_connectors/src/connectors/rapyd.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 62
| null |
Rapyd
|
api::RefundExecute for
| 0
| 0
| null | null |
// Function: create_merchant_account
// File: crates/router/src/core/admin.rs
// Module: router
pub fn create_merchant_account(
state: SessionState,
req: api::MerchantAccountCreate,
org_data_from_auth: Option<authentication::AuthenticationDataWithOrg>,
) -> RouterResponse<api::MerchantAccountResponse>
|
crates/router/src/core/admin.rs
|
router
|
function_signature
| null | null | null | 71
|
create_merchant_account
| null | null | null | null | null | null |
// Struct: PaypalRedirectionStruct
// File: crates/hyperswitch_connectors/src/connectors/paypal/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct PaypalRedirectionStruct
|
crates/hyperswitch_connectors/src/connectors/paypal/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
PaypalRedirectionStruct
| 0
|
[] | 49
| null | null | null | null | null | null | null |
// Implementation: impl IncomingWebhook for for Adyenplatform
// File: crates/hyperswitch_connectors/src/connectors/adyenplatform.rs
// Module: hyperswitch_connectors
// Methods: 8 total (0 public)
impl IncomingWebhook for for Adyenplatform
|
crates/hyperswitch_connectors/src/connectors/adyenplatform.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 59
| null |
Adyenplatform
|
IncomingWebhook for
| 8
| 0
| null | null |
// Function: get_api_key
// File: crates/router/src/services/authentication.rs
// Module: router
pub fn get_api_key(headers: &HeaderMap) -> RouterResult<&str>
|
crates/router/src/services/authentication.rs
|
router
|
function_signature
| null | null | null | 39
|
get_api_key
| null | null | null | null | null | null |
// Struct: PaypalAdditionalData
// File: crates/common_utils/src/payout_method_utils.rs
// Module: common_utils
// Implementations: 0
pub struct PaypalAdditionalData
|
crates/common_utils/src/payout_method_utils.rs
|
common_utils
|
struct_definition
|
PaypalAdditionalData
| 0
|
[] | 38
| null | null | null | null | null | null | null |
// Implementation: impl api::PaymentToken for for Digitalvirgo
// File: crates/hyperswitch_connectors/src/connectors/digitalvirgo.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::PaymentToken for for Digitalvirgo
|
crates/hyperswitch_connectors/src/connectors/digitalvirgo.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 61
| null |
Digitalvirgo
|
api::PaymentToken for
| 0
| 0
| null | null |
// Struct: Customer
// File: crates/hyperswitch_domain_models/src/customer.rs
// Module: hyperswitch_domain_models
// Implementations: 3
// Traits: behaviour::Conversion, behaviour::Conversion
pub struct Customer
|
crates/hyperswitch_domain_models/src/customer.rs
|
hyperswitch_domain_models
|
struct_definition
|
Customer
| 3
|
[
"behaviour::Conversion",
"behaviour::Conversion"
] | 48
| null | null | null | null | null | null | null |
// Implementation: impl RecoveryPaymentTuple
// File: crates/router/src/core/webhooks/recovery_incoming.rs
// Module: router
// Methods: 2 total (1 public)
impl RecoveryPaymentTuple
|
crates/router/src/core/webhooks/recovery_incoming.rs
|
router
|
impl_block
| null | null | null | 42
| null |
RecoveryPaymentTuple
| null | 2
| 1
| null | null |
// Struct: Log
// File: crates/router_env/src/logger/config.rs
// Module: router_env
// Implementations: 0
pub struct Log
|
crates/router_env/src/logger/config.rs
|
router_env
|
struct_definition
|
Log
| 0
|
[] | 32
| null | null | null | null | null | null | null |
// File: crates/hyperswitch_interfaces/src/webhooks.rs
// Module: hyperswitch_interfaces
// Public structs: 1
//! Webhooks interface
use common_utils::{crypto, errors::CustomResult, ext_traits::ValueExt};
use error_stack::ResultExt;
use hyperswitch_domain_models::{
api::ApplicationResponse, errors::api_error_response::ApiErrorResponse,
};
use masking::{ExposeInterface, Secret};
use crate::{api::ConnectorCommon, errors};
/// struct IncomingWebhookRequestDetails
#[derive(Debug)]
pub struct IncomingWebhookRequestDetails<'a> {
/// method
pub method: http::Method,
/// uri
pub uri: http::Uri,
/// headers
pub headers: &'a actix_web::http::header::HeaderMap,
/// body
pub body: &'a [u8],
/// query_params
pub query_params: String,
}
/// IncomingWebhookFlowError enum defining the error type for incoming webhook
#[derive(Debug)]
pub enum IncomingWebhookFlowError {
/// Resource not found for the webhook
ResourceNotFound,
/// Internal error for the webhook
InternalError,
}
impl From<&ApiErrorResponse> for IncomingWebhookFlowError {
fn from(api_error_response: &ApiErrorResponse) -> Self {
match api_error_response {
ApiErrorResponse::WebhookResourceNotFound
| ApiErrorResponse::DisputeNotFound { .. }
| ApiErrorResponse::PayoutNotFound
| ApiErrorResponse::MandateNotFound
| ApiErrorResponse::PaymentNotFound
| ApiErrorResponse::RefundNotFound
| ApiErrorResponse::AuthenticationNotFound { .. } => Self::ResourceNotFound,
_ => Self::InternalError,
}
}
}
/// Trait defining incoming webhook
#[async_trait::async_trait]
pub trait IncomingWebhook: ConnectorCommon + Sync {
/// fn get_webhook_body_decoding_algorithm
fn get_webhook_body_decoding_algorithm(
&self,
_request: &IncomingWebhookRequestDetails<'_>,
) -> CustomResult<Box<dyn crypto::DecodeMessage + Send>, errors::ConnectorError> {
Ok(Box::new(crypto::NoAlgorithm))
}
/// fn get_webhook_body_decoding_message
fn get_webhook_body_decoding_message(
&self,
request: &IncomingWebhookRequestDetails<'_>,
) -> CustomResult<Vec<u8>, errors::ConnectorError> {
Ok(request.body.to_vec())
}
/// fn decode_webhook_body
async fn decode_webhook_body(
&self,
request: &IncomingWebhookRequestDetails<'_>,
merchant_id: &common_utils::id_type::MerchantId,
connector_webhook_details: Option<common_utils::pii::SecretSerdeValue>,
connector_name: &str,
) -> CustomResult<Vec<u8>, errors::ConnectorError> {
let algorithm = self.get_webhook_body_decoding_algorithm(request)?;
let message = self
.get_webhook_body_decoding_message(request)
.change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?;
let secret = self
.get_webhook_source_verification_merchant_secret(
merchant_id,
connector_name,
connector_webhook_details,
)
.await
.change_context(errors::ConnectorError::WebhookSourceVerificationFailed)?;
algorithm
.decode_message(&secret.secret, message.into())
.change_context(errors::ConnectorError::WebhookBodyDecodingFailed)
}
/// fn get_webhook_source_verification_algorithm
fn get_webhook_source_verification_algorithm(
&self,
_request: &IncomingWebhookRequestDetails<'_>,
) -> CustomResult<Box<dyn crypto::VerifySignature + Send>, errors::ConnectorError> {
Ok(Box::new(crypto::NoAlgorithm))
}
/// fn get_webhook_source_verification_merchant_secret
async fn get_webhook_source_verification_merchant_secret(
&self,
merchant_id: &common_utils::id_type::MerchantId,
connector_name: &str,
connector_webhook_details: Option<common_utils::pii::SecretSerdeValue>,
) -> CustomResult<api_models::webhooks::ConnectorWebhookSecrets, errors::ConnectorError> {
let debug_suffix =
format!("For merchant_id: {merchant_id:?}, and connector_name: {connector_name}");
let default_secret = "default_secret".to_string();
let merchant_secret = match connector_webhook_details {
Some(merchant_connector_webhook_details) => {
let connector_webhook_details = merchant_connector_webhook_details
.parse_value::<api_models::admin::MerchantConnectorWebhookDetails>(
"MerchantConnectorWebhookDetails",
)
.change_context_lazy(|| errors::ConnectorError::WebhookSourceVerificationFailed)
.attach_printable_lazy(|| {
format!(
"Deserializing MerchantConnectorWebhookDetails failed {debug_suffix}",
)
})?;
api_models::webhooks::ConnectorWebhookSecrets {
secret: connector_webhook_details
.merchant_secret
.expose()
.into_bytes(),
additional_secret: connector_webhook_details.additional_secret,
}
}
None => api_models::webhooks::ConnectorWebhookSecrets {
secret: default_secret.into_bytes(),
additional_secret: None,
},
};
//need to fetch merchant secret from config table with caching in future for enhanced performance
//If merchant has not set the secret for webhook source verification, "default_secret" is returned.
//So it will fail during verification step and goes to psync flow.
Ok(merchant_secret)
}
/// fn get_webhook_source_verification_signature
fn get_webhook_source_verification_signature(
&self,
_request: &IncomingWebhookRequestDetails<'_>,
_connector_webhook_secrets: &api_models::webhooks::ConnectorWebhookSecrets,
) -> CustomResult<Vec<u8>, errors::ConnectorError> {
Ok(Vec::new())
}
/// fn get_webhook_source_verification_message
fn get_webhook_source_verification_message(
&self,
_request: &IncomingWebhookRequestDetails<'_>,
_merchant_id: &common_utils::id_type::MerchantId,
_connector_webhook_secrets: &api_models::webhooks::ConnectorWebhookSecrets,
) -> CustomResult<Vec<u8>, errors::ConnectorError> {
Ok(Vec::new())
}
/// fn verify_webhook_source
async fn verify_webhook_source(
&self,
request: &IncomingWebhookRequestDetails<'_>,
merchant_id: &common_utils::id_type::MerchantId,
connector_webhook_details: Option<common_utils::pii::SecretSerdeValue>,
_connector_account_details: crypto::Encryptable<Secret<serde_json::Value>>,
connector_name: &str,
) -> CustomResult<bool, errors::ConnectorError> {
let algorithm = self
.get_webhook_source_verification_algorithm(request)
.change_context(errors::ConnectorError::WebhookSourceVerificationFailed)?;
let connector_webhook_secrets = self
.get_webhook_source_verification_merchant_secret(
merchant_id,
connector_name,
connector_webhook_details,
)
.await
.change_context(errors::ConnectorError::WebhookSourceVerificationFailed)?;
let signature = self
.get_webhook_source_verification_signature(request, &connector_webhook_secrets)
.change_context(errors::ConnectorError::WebhookSourceVerificationFailed)?;
let message = self
.get_webhook_source_verification_message(
request,
merchant_id,
&connector_webhook_secrets,
)
.change_context(errors::ConnectorError::WebhookSourceVerificationFailed)?;
algorithm
.verify_signature(&connector_webhook_secrets.secret, &signature, &message)
.change_context(errors::ConnectorError::WebhookSourceVerificationFailed)
}
/// fn get_webhook_object_reference_id
fn get_webhook_object_reference_id(
&self,
_request: &IncomingWebhookRequestDetails<'_>,
) -> CustomResult<api_models::webhooks::ObjectReferenceId, errors::ConnectorError>;
/// fn get_webhook_event_type
fn get_webhook_event_type(
&self,
_request: &IncomingWebhookRequestDetails<'_>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError>;
/// fn get_webhook_resource_object
fn get_webhook_resource_object(
&self,
_request: &IncomingWebhookRequestDetails<'_>,
) -> CustomResult<Box<dyn masking::ErasedMaskSerialize>, errors::ConnectorError>;
/// fn get_webhook_api_response
fn get_webhook_api_response(
&self,
_request: &IncomingWebhookRequestDetails<'_>,
_error_kind: Option<IncomingWebhookFlowError>,
) -> CustomResult<ApplicationResponse<serde_json::Value>, errors::ConnectorError> {
Ok(ApplicationResponse::StatusOk)
}
/// fn get_dispute_details
fn get_dispute_details(
&self,
_request: &IncomingWebhookRequestDetails<'_>,
) -> CustomResult<crate::disputes::DisputePayload, errors::ConnectorError> {
Err(errors::ConnectorError::NotImplemented("get_dispute_details method".to_string()).into())
}
/// fn get_external_authentication_details
fn get_external_authentication_details(
&self,
_request: &IncomingWebhookRequestDetails<'_>,
) -> CustomResult<crate::authentication::ExternalAuthenticationPayload, errors::ConnectorError>
{
Err(errors::ConnectorError::NotImplemented(
"get_external_authentication_details method".to_string(),
)
.into())
}
/// fn get_mandate_details
fn get_mandate_details(
&self,
_request: &IncomingWebhookRequestDetails<'_>,
) -> CustomResult<
Option<hyperswitch_domain_models::router_flow_types::ConnectorMandateDetails>,
errors::ConnectorError,
> {
Ok(None)
}
/// fn get_network_txn_id
fn get_network_txn_id(
&self,
_request: &IncomingWebhookRequestDetails<'_>,
) -> CustomResult<
Option<hyperswitch_domain_models::router_flow_types::ConnectorNetworkTxnId>,
errors::ConnectorError,
> {
Ok(None)
}
#[cfg(all(feature = "revenue_recovery", feature = "v2"))]
/// get revenue recovery invoice details
fn get_revenue_recovery_attempt_details(
&self,
_request: &IncomingWebhookRequestDetails<'_>,
) -> CustomResult<
hyperswitch_domain_models::revenue_recovery::RevenueRecoveryAttemptData,
errors::ConnectorError,
> {
Err(errors::ConnectorError::NotImplemented(
"get_revenue_recovery_attempt_details method".to_string(),
)
.into())
}
#[cfg(all(feature = "revenue_recovery", feature = "v2"))]
/// get revenue recovery transaction details
fn get_revenue_recovery_invoice_details(
&self,
_request: &IncomingWebhookRequestDetails<'_>,
) -> CustomResult<
hyperswitch_domain_models::revenue_recovery::RevenueRecoveryInvoiceData,
errors::ConnectorError,
> {
Err(errors::ConnectorError::NotImplemented(
"get_revenue_recovery_invoice_details method".to_string(),
)
.into())
}
}
|
crates/hyperswitch_interfaces/src/webhooks.rs
|
hyperswitch_interfaces
|
full_file
| null | null | null | 2,452
| null | null | null | null | null | null | null |
// Function: get_expiry_date_as_mmyy
// File: crates/common_types/src/payments.rs
// Module: common_types
// Documentation: Get the expiry date in MMYY format from the Google Pay pre-decrypt data
pub fn get_expiry_date_as_mmyy(&self) -> Result<Secret<String>, errors::ValidationError>
|
crates/common_types/src/payments.rs
|
common_types
|
function_signature
| null | null | null | 70
|
get_expiry_date_as_mmyy
| null | null | null | null | null | null |
// Implementation: impl webhooks::IncomingWebhook for for Inespay
// File: crates/hyperswitch_connectors/src/connectors/inespay.rs
// Module: hyperswitch_connectors
// Methods: 7 total (0 public)
impl webhooks::IncomingWebhook for for Inespay
|
crates/hyperswitch_connectors/src/connectors/inespay.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 64
| null |
Inespay
|
webhooks::IncomingWebhook for
| 7
| 0
| null | null |
// Struct: ZenWebhookBody
// File: crates/hyperswitch_connectors/src/connectors/zen/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct ZenWebhookBody
|
crates/hyperswitch_connectors/src/connectors/zen/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
ZenWebhookBody
| 0
|
[] | 49
| null | null | null | null | null | null | null |
// Implementation: impl api::PaymentCapture for for Stax
// File: crates/hyperswitch_connectors/src/connectors/stax.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::PaymentCapture for for Stax
|
crates/hyperswitch_connectors/src/connectors/stax.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 57
| null |
Stax
|
api::PaymentCapture for
| 0
| 0
| null | null |
// Struct: ServiceSessionIds
// File: crates/hyperswitch_connectors/src/connectors/unified_authentication_service/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct ServiceSessionIds
|
crates/hyperswitch_connectors/src/connectors/unified_authentication_service/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
ServiceSessionIds
| 0
|
[] | 49
| null | null | null | null | null | null | null |
// Struct: DwollaAccessTokenResponse
// File: crates/hyperswitch_connectors/src/connectors/dwolla/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct DwollaAccessTokenResponse
|
crates/hyperswitch_connectors/src/connectors/dwolla/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
DwollaAccessTokenResponse
| 0
|
[] | 50
| null | null | null | null | null | null | null |
// Implementation: impl api::Payment for for Breadpay
// File: crates/hyperswitch_connectors/src/connectors/breadpay.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::Payment for for Breadpay
|
crates/hyperswitch_connectors/src/connectors/breadpay.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 56
| null |
Breadpay
|
api::Payment for
| 0
| 0
| null | null |
// Implementation: impl api::Refund for for Barclaycard
// File: crates/hyperswitch_connectors/src/connectors/barclaycard.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::Refund for for Barclaycard
|
crates/hyperswitch_connectors/src/connectors/barclaycard.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 61
| null |
Barclaycard
|
api::Refund for
| 0
| 0
| null | null |
// Struct: ResetPassword
// File: crates/router/src/services/email/types.rs
// Module: router
// Implementations: 1
// Traits: EmailData
pub struct ResetPassword
|
crates/router/src/services/email/types.rs
|
router
|
struct_definition
|
ResetPassword
| 1
|
[
"EmailData"
] | 39
| null | null | null | null | null | null | null |
// Implementation: impl api::MandateSetup for for Opennode
// File: crates/hyperswitch_connectors/src/connectors/opennode.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::MandateSetup for for Opennode
|
crates/hyperswitch_connectors/src/connectors/opennode.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 63
| null |
Opennode
|
api::MandateSetup for
| 0
| 0
| null | null |
// Struct: BillwerkCaptureRequest
// File: crates/hyperswitch_connectors/src/connectors/billwerk/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct BillwerkCaptureRequest
|
crates/hyperswitch_connectors/src/connectors/billwerk/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
BillwerkCaptureRequest
| 0
|
[] | 50
| null | null | null | null | null | null | null |
// Function: merchant_account_retrieve
// File: crates/openapi/src/routes/merchant_account.rs
// Module: openapi
pub fn merchant_account_retrieve()
|
crates/openapi/src/routes/merchant_account.rs
|
openapi
|
function_signature
| null | null | null | 34
|
merchant_account_retrieve
| null | null | null | null | null | null |
// Implementation: impl api::payments::PaymentsCompleteAuthorize for for Prophetpay
// File: crates/hyperswitch_connectors/src/connectors/prophetpay.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::payments::PaymentsCompleteAuthorize for for Prophetpay
|
crates/hyperswitch_connectors/src/connectors/prophetpay.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 64
| null |
Prophetpay
|
api::payments::PaymentsCompleteAuthorize for
| 0
| 0
| null | null |
// Function: new
// File: crates/storage_impl/src/mock_db.rs
// Module: storage_impl
pub fn new(redis: &RedisSettings) -> error_stack::Result<Self, StorageError>
|
crates/storage_impl/src/mock_db.rs
|
storage_impl
|
function_signature
| null | null | null | 41
|
new
| null | null | null | null | null | null |
// Function: list_invitations_for_user
// File: crates/router/src/routes/user_role.rs
// Module: router
pub fn list_invitations_for_user(
state: web::Data<AppState>,
req: HttpRequest,
) -> HttpResponse
|
crates/router/src/routes/user_role.rs
|
router
|
function_signature
| null | null | null | 50
|
list_invitations_for_user
| null | null | null | null | null | null |
// File: crates/hyperswitch_connectors/src/connectors/worldpay/response.rs
// Module: hyperswitch_connectors
// Public functions: 5
// Public structs: 30
use error_stack::ResultExt;
use hyperswitch_interfaces::errors;
use masking::Secret;
use serde::{Deserialize, Serialize};
use url::Url;
use super::requests::*;
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct WorldpayPaymentsResponse {
pub outcome: PaymentOutcome,
pub transaction_reference: Option<String>,
#[serde(flatten)]
pub other_fields: Option<WorldpayPaymentResponseFields>,
}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(untagged)]
pub enum WorldpayPaymentResponseFields {
RefusedResponse(RefusedResponse),
DDCResponse(DDCResponse),
ThreeDsChallenged(ThreeDsChallengedResponse),
FraudHighRisk(FraudHighRiskResponse),
AuthorizedResponse(Box<AuthorizedResponse>),
}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct AuthorizedResponse {
pub payment_instrument: PaymentsResPaymentInstrument,
#[serde(skip_serializing_if = "Option::is_none")]
pub issuer: Option<Issuer>,
#[serde(skip_serializing_if = "Option::is_none")]
pub scheme: Option<PaymentsResponseScheme>,
#[serde(rename = "_links", skip_serializing_if = "Option::is_none")]
pub links: Option<SelfLink>,
#[serde(rename = "_actions")]
pub actions: Option<ActionLinks>,
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
pub risk_factors: Option<Vec<RiskFactorsInner>>,
pub fraud: Option<Fraud>,
/// Mandate's token
pub token: Option<MandateToken>,
/// Network transaction ID
pub scheme_reference: Option<Secret<String>>,
}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct MandateToken {
pub href: Secret<String>,
pub token_id: String,
pub token_expiry_date_time: String,
}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct FraudHighRiskResponse {
pub score: f32,
pub reason: Vec<String>,
}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct RefusedResponse {
pub refusal_description: String,
// Access Worldpay returns a raw response code in the refusalCode field (if enabled) containing the unmodified response code received either directly from the card scheme for Worldpay-acquired transactions, or from third party acquirers.
pub refusal_code: String,
pub risk_factors: Option<Vec<RiskFactorsInner>>,
pub fraud: Option<Fraud>,
#[serde(rename = "threeDS")]
pub three_ds: Option<ThreeDsResponse>,
pub advice: Option<Advice>,
}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct Advice {
pub code: Option<String>,
}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ThreeDsResponse {
pub outcome: String,
pub issuer_response: IssuerResponse,
}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ThreeDsChallengedResponse {
pub authentication: AuthenticationResponse,
pub challenge: ThreeDsChallenge,
#[serde(rename = "_actions")]
pub actions: CompleteThreeDsActionLink,
}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct AuthenticationResponse {
pub version: String,
}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct ThreeDsChallenge {
pub reference: String,
pub url: Url,
pub jwt: Secret<String>,
pub payload: Secret<String>,
}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct CompleteThreeDsActionLink {
#[serde(rename = "complete3dsChallenge")]
pub complete_three_ds_challenge: ActionLink,
}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "lowercase")]
pub enum IssuerResponse {
Challenged,
Frictionless,
}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct DDCResponse {
pub device_data_collection: DDCToken,
#[serde(rename = "_actions")]
pub actions: DDCActionLink,
}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct DDCToken {
pub jwt: Secret<String>,
pub url: Url,
pub bin: Secret<String>,
}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct DDCActionLink {
#[serde(rename = "supply3dsDeviceData")]
supply_ddc_data: ActionLink,
}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum PaymentOutcome {
#[serde(alias = "authorized", alias = "Authorized")]
Authorized,
Refused,
SentForSettlement,
SentForRefund,
FraudHighRisk,
#[serde(alias = "3dsDeviceDataRequired")]
ThreeDsDeviceDataRequired,
SentForCancellation,
#[serde(alias = "3dsAuthenticationFailed")]
ThreeDsAuthenticationFailed,
SentForPartialRefund,
#[serde(alias = "3dsChallenged")]
ThreeDsChallenged,
#[serde(alias = "3dsUnavailable")]
ThreeDsUnavailable,
}
impl std::fmt::Display for PaymentOutcome {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Self::Authorized => write!(f, "authorized"),
Self::Refused => write!(f, "refused"),
Self::SentForSettlement => write!(f, "sentForSettlement"),
Self::SentForRefund => write!(f, "sentForRefund"),
Self::FraudHighRisk => write!(f, "fraudHighRisk"),
Self::ThreeDsDeviceDataRequired => write!(f, "3dsDeviceDataRequired"),
Self::SentForCancellation => write!(f, "sentForCancellation"),
Self::ThreeDsAuthenticationFailed => write!(f, "3dsAuthenticationFailed"),
Self::SentForPartialRefund => write!(f, "sentForPartialRefund"),
Self::ThreeDsChallenged => write!(f, "3dsChallenged"),
Self::ThreeDsUnavailable => write!(f, "3dsUnavailable"),
}
}
}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct SelfLink {
#[serde(rename = "self")]
pub self_link: SelfLinkInner,
}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct SelfLinkInner {
pub href: String,
}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ActionLinks {
supply_3ds_device_data: Option<ActionLink>,
settle_payment: Option<ActionLink>,
partially_settle_payment: Option<ActionLink>,
refund_payment: Option<ActionLink>,
partially_refund_payment: Option<ActionLink>,
cancel_payment: Option<ActionLink>,
}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct ActionLink {
pub href: String,
pub method: String,
}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct Fraud {
pub outcome: FraudOutcome,
pub score: f32,
}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum FraudOutcome {
LowRisk,
HighRisk,
}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct WorldpayEventResponse {
pub last_event: EventType,
#[serde(rename = "_links", skip_serializing_if = "Option::is_none")]
pub links: Option<EventLinks>,
}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum EventType {
SentForAuthorization,
#[serde(alias = "Authorized")]
Authorized,
#[serde(alias = "Sent for Settlement")]
SentForSettlement,
Settled,
SettlementFailed,
Cancelled,
Error,
Expired,
Refused,
#[serde(alias = "Sent for Refund")]
SentForRefund,
Refunded,
RefundFailed,
#[serde(other)]
Unknown,
}
#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
pub struct EventLinks {
#[serde(rename = "payments:events", skip_serializing_if = "Option::is_none")]
pub events: Option<String>,
}
pub fn get_resource_id<T, F>(
response: WorldpayPaymentsResponse,
connector_transaction_id: Option<String>,
transform_fn: F,
) -> Result<T, error_stack::Report<errors::ConnectorError>>
where
F: Fn(String) -> T,
{
let optional_reference_id = response
.other_fields
.as_ref()
.and_then(|other_fields| match other_fields {
WorldpayPaymentResponseFields::AuthorizedResponse(res) => res
.links
.as_ref()
.and_then(|link| link.self_link.href.rsplit_once('/').map(|(_, h)| h)),
WorldpayPaymentResponseFields::DDCResponse(res) => {
res.actions.supply_ddc_data.href.split('/').nth_back(1)
}
WorldpayPaymentResponseFields::ThreeDsChallenged(res) => res
.actions
.complete_three_ds_challenge
.href
.split('/')
.nth_back(1),
WorldpayPaymentResponseFields::FraudHighRisk(_)
| WorldpayPaymentResponseFields::RefusedResponse(_) => None,
})
.map(|href| {
urlencoding::decode(href)
.map(|s| transform_fn(s.into_owned()))
.change_context(errors::ConnectorError::ResponseHandlingFailed)
})
.transpose()?;
optional_reference_id
.or_else(|| connector_transaction_id.map(transform_fn))
.ok_or_else(|| {
errors::ConnectorError::MissingRequiredField {
field_name: "_links.self.href",
}
.into()
})
}
pub struct ResponseIdStr {
pub id: String,
}
#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Issuer {
pub authorization_code: Secret<String>,
}
impl Issuer {
pub fn new(code: String) -> Self {
Self {
authorization_code: Secret::new(code),
}
}
}
#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct PaymentsResPaymentInstrument {
#[serde(rename = "type")]
pub payment_instrument_type: String,
pub card_bin: Option<String>,
pub last_four: Option<String>,
pub expiry_date: Option<ExpiryDate>,
pub card_brand: Option<String>,
pub funding_type: Option<String>,
pub category: Option<String>,
pub issuer_name: Option<String>,
pub payment_account_reference: Option<String>,
}
#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct RiskFactorsInner {
#[serde(rename = "type")]
pub risk_type: RiskType,
#[serde(skip_serializing_if = "Option::is_none")]
pub detail: Option<Detail>,
pub risk: Risk,
}
impl RiskFactorsInner {
pub fn new(risk_type: RiskType, risk: Risk) -> Self {
Self {
risk_type,
detail: None,
risk,
}
}
}
#[derive(
Clone, Copy, Default, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize,
)]
#[serde(rename_all = "camelCase")]
pub enum RiskType {
#[default]
Avs,
Cvc,
RiskProfile,
}
#[derive(
Clone, Copy, Default, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize,
)]
#[serde(rename_all = "lowercase")]
pub enum Detail {
#[default]
Address,
Postcode,
}
#[derive(
Clone, Copy, Default, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize,
)]
#[serde(rename_all = "camelCase")]
pub enum Risk {
#[default]
NotChecked,
NotMatched,
NotSupplied,
VerificationFailed,
}
#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
pub struct PaymentsResponseScheme {
pub reference: String,
}
impl PaymentsResponseScheme {
pub fn new(reference: String) -> Self {
Self { reference }
}
}
#[derive(Debug, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct WorldpayErrorResponse {
pub error_name: String,
pub message: String,
pub validation_errors: Option<serde_json::Value>,
}
impl WorldpayErrorResponse {
pub fn default(status_code: u16) -> Self {
match status_code {
code @ 404 => Self {
error_name: format!("{code} Not found"),
message: "Resource not found".to_string(),
validation_errors: None,
},
code => Self {
error_name: code.to_string(),
message: "Unknown error".to_string(),
validation_errors: None,
},
}
}
}
#[derive(Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct WorldpayWebhookTransactionId {
pub event_details: EventDetails,
}
#[derive(Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct EventDetails {
#[serde(rename = "type")]
pub event_type: EventType,
pub transaction_reference: String,
/// Mandate's token
pub token: Option<MandateToken>,
/// Network transaction ID
pub scheme_reference: Option<Secret<String>>,
}
#[derive(Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct WorldpayWebhookEventType {
pub event_id: String,
pub event_timestamp: String,
pub event_details: EventDetails,
}
/// Worldpay's unique reference ID for a request
pub(super) const WP_CORRELATION_ID: &str = "WP-CorrelationId";
|
crates/hyperswitch_connectors/src/connectors/worldpay/response.rs
|
hyperswitch_connectors
|
full_file
| null | null | null | 3,126
| null | null | null | null | null | null | null |
// Struct: DeleteUserRoleRequest
// File: crates/api_models/src/user_role.rs
// Module: api_models
// Implementations: 0
pub struct DeleteUserRoleRequest
|
crates/api_models/src/user_role.rs
|
api_models
|
struct_definition
|
DeleteUserRoleRequest
| 0
|
[] | 36
| null | null | null | null | null | null | null |
// Struct: ErrorObject
// File: crates/hyperswitch_connectors/src/connectors/braintree/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct ErrorObject
|
crates/hyperswitch_connectors/src/connectors/braintree/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
ErrorObject
| 0
|
[] | 46
| null | null | null | null | null | null | null |
// Struct: OpensearchHits
// File: crates/api_models/src/analytics/search.rs
// Module: api_models
// Implementations: 0
pub struct OpensearchHits
|
crates/api_models/src/analytics/search.rs
|
api_models
|
struct_definition
|
OpensearchHits
| 0
|
[] | 39
| null | null | null | null | null | null | null |
// File: connector-template/transformers.rs
// Module: connector-template
// Public structs: 1
use common_enums::enums;
use serde::{Deserialize, Serialize};
use masking::Secret;
use common_utils::types::{StringMinorUnit};
use hyperswitch_domain_models::{
payment_method_data::PaymentMethodData,
router_data::{ConnectorAuthType, RouterData},
router_flow_types::refunds::{Execute, RSync},
router_request_types::ResponseId,
router_response_types::{PaymentsResponseData, RefundsResponseData},
types::{PaymentsAuthorizeRouterData, RefundsRouterData},
};
use hyperswitch_interfaces::errors;
use crate::types::{RefundsResponseRouterData, ResponseRouterData};
//TODO: Fill the struct with respective fields
pub struct {{project-name | downcase | pascal_case}}RouterData<T> {
pub amount: StringMinorUnit, // The type of amount that a connector accepts, for example, String, i64, f64, etc.
pub router_data: T,
}
impl<T>
From<(
StringMinorUnit,
T,
)> for {{project-name | downcase | pascal_case}}RouterData<T>
{
fn from(
(amount, item): (
StringMinorUnit,
T,
),
) -> Self {
//Todo : use utils to convert the amount to the type of amount that a connector accepts
Self {
amount,
router_data: item,
}
}
}
//TODO: Fill the struct with respective fields
#[derive(Default, Debug, Serialize, PartialEq)]
pub struct {{project-name | downcase | pascal_case}}PaymentsRequest {
amount: StringMinorUnit,
card: {{project-name | downcase | pascal_case}}Card
}
#[derive(Default, Debug, Serialize, Eq, PartialEq)]
pub struct {{project-name | downcase | pascal_case}}Card {
number: cards::CardNumber,
expiry_month: Secret<String>,
expiry_year: Secret<String>,
cvc: Secret<String>,
complete: bool,
}
impl TryFrom<&{{project-name | downcase | pascal_case}}RouterData<&PaymentsAuthorizeRouterData>> for {{project-name | downcase | pascal_case}}PaymentsRequest {
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(item: &{{project-name | downcase | pascal_case}}RouterData<&PaymentsAuthorizeRouterData>) -> Result<Self,Self::Error> {
match item.router_data.request.payment_method_data.clone() {
PaymentMethodData::Card(_) => {
Err(errors::ConnectorError::NotImplemented("Card payment method not implemented".to_string()).into())
},
_ => Err(errors::ConnectorError::NotImplemented("Payment method".to_string()).into()),
}
}
}
//TODO: Fill the struct with respective fields
// Auth Struct
pub struct {{project-name | downcase | pascal_case}}AuthType {
pub(super) api_key: Secret<String>
}
impl TryFrom<&ConnectorAuthType> for {{project-name | downcase | pascal_case}}AuthType {
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(auth_type: &ConnectorAuthType) -> Result<Self, Self::Error> {
match auth_type {
ConnectorAuthType::HeaderKey { api_key } => Ok(Self {
api_key: api_key.to_owned(),
}),
_ => Err(errors::ConnectorError::FailedToObtainAuthType.into()),
}
}
}
// PaymentsResponse
//TODO: Append the remaining status flags
#[derive(Debug, Clone, Copy, Default, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "lowercase")]
pub enum {{project-name | downcase | pascal_case}}PaymentStatus {
Succeeded,
Failed,
#[default]
Processing,
}
impl From<{{project-name | downcase | pascal_case}}PaymentStatus> for common_enums::AttemptStatus {
fn from(item: {{project-name | downcase | pascal_case}}PaymentStatus) -> Self {
match item {
{{project-name | downcase | pascal_case}}PaymentStatus::Succeeded => Self::Charged,
{{project-name | downcase | pascal_case}}PaymentStatus::Failed => Self::Failure,
{{project-name | downcase | pascal_case}}PaymentStatus::Processing => Self::Authorizing,
}
}
}
//TODO: Fill the struct with respective fields
#[derive(Default, Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct {{project-name | downcase | pascal_case}}PaymentsResponse {
status: {{project-name | downcase | pascal_case}}PaymentStatus,
id: String,
}
impl<F,T> TryFrom<ResponseRouterData<F, {{project-name | downcase | pascal_case}}PaymentsResponse, T, PaymentsResponseData>> for RouterData<F, T, PaymentsResponseData> {
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(item: ResponseRouterData<F, {{project-name | downcase | pascal_case}}PaymentsResponse, T, PaymentsResponseData>) -> Result<Self,Self::Error> {
Ok(Self {
status: common_enums::AttemptStatus::from(item.response.status),
response: Ok(PaymentsResponseData::TransactionResponse {
resource_id: ResponseId::ConnectorTransactionId(item.response.id),
redirection_data: Box::new(None),
mandate_reference: Box::new(None),
connector_metadata: None,
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
charges: None,
}),
..item.data
})
}
}
//TODO: Fill the struct with respective fields
// REFUND :
// Type definition for RefundRequest
#[derive(Default, Debug, Serialize)]
pub struct {{project-name | downcase | pascal_case}}RefundRequest {
pub amount: StringMinorUnit
}
impl<F> TryFrom<&{{project-name | downcase | pascal_case}}RouterData<&RefundsRouterData<F>>> for {{project-name | downcase | pascal_case}}RefundRequest {
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(item: &{{project-name | downcase | pascal_case}}RouterData<&RefundsRouterData<F>>) -> Result<Self,Self::Error> {
Ok(Self {
amount: item.amount.to_owned(),
})
}
}
// Type definition for Refund Response
#[allow(dead_code)]
#[derive(Debug, Copy, Serialize, Default, Deserialize, Clone)]
pub enum RefundStatus {
Succeeded,
Failed,
#[default]
Processing,
}
impl From<RefundStatus> for enums::RefundStatus {
fn from(item: RefundStatus) -> Self {
match item {
RefundStatus::Succeeded => Self::Success,
RefundStatus::Failed => Self::Failure,
RefundStatus::Processing => Self::Pending,
//TODO: Review mapping
}
}
}
//TODO: Fill the struct with respective fields
#[derive(Default, Debug, Clone, Serialize, Deserialize)]
pub struct RefundResponse {
id: String,
status: RefundStatus
}
impl TryFrom<RefundsResponseRouterData<Execute, RefundResponse>>
for RefundsRouterData<Execute>
{
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(
item: RefundsResponseRouterData<Execute, RefundResponse>,
) -> Result<Self, Self::Error> {
Ok(Self {
response: Ok(RefundsResponseData {
connector_refund_id: item.response.id.to_string(),
refund_status: enums::RefundStatus::from(item.response.status),
}),
..item.data
})
}
}
impl TryFrom<RefundsResponseRouterData<RSync, RefundResponse>> for RefundsRouterData<RSync>
{
type Error = error_stack::Report<errors::ConnectorError>;
fn try_from(item: RefundsResponseRouterData<RSync, RefundResponse>) -> Result<Self,Self::Error> {
Ok(Self {
response: Ok(RefundsResponseData {
connector_refund_id: item.response.id.to_string(),
refund_status: enums::RefundStatus::from(item.response.status),
}),
..item.data
})
}
}
//TODO: Fill the struct with respective fields
#[derive(Default, Debug, Serialize, Deserialize, PartialEq)]
pub struct {{project-name | downcase | pascal_case}}ErrorResponse {
pub status_code: u16,
pub code: String,
pub message: String,
pub reason: Option<String>,
pub network_advice_code: Option<String>,
pub network_decline_code: Option<String>,
pub network_error_message: Option<String>,
}
|
connector-template/transformers.rs
|
connector-template
|
full_file
| null | null | null | 1,881
| null | null | null | null | null | null | null |
// Implementation: impl Profile
// File: crates/router/src/routes/app.rs
// Module: router
// Methods: 1 total (1 public)
impl Profile
|
crates/router/src/routes/app.rs
|
router
|
impl_block
| null | null | null | 33
| null |
Profile
| null | 1
| 1
| null | null |
// Implementation: impl api::PaymentCapture for for Tesouro
// File: crates/hyperswitch_connectors/src/connectors/tesouro.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)
impl api::PaymentCapture for for Tesouro
|
crates/hyperswitch_connectors/src/connectors/tesouro.rs
|
hyperswitch_connectors
|
impl_block
| null | null | null | 58
| null |
Tesouro
|
api::PaymentCapture for
| 0
| 0
| null | null |
// Function: get_metadata_as_secret
// File: crates/api_models/src/admin.rs
// Module: api_models
pub fn get_metadata_as_secret(
&self,
) -> CustomResult<Option<pii::SecretSerdeValue>, errors::ParsingError>
|
crates/api_models/src/admin.rs
|
api_models
|
function_signature
| null | null | null | 54
|
get_metadata_as_secret
| null | null | null | null | null | null |
// Struct: GetSubscriptionPlansData
// File: crates/hyperswitch_domain_models/src/router_data_v2/flow_common_types.rs
// Module: hyperswitch_domain_models
// Implementations: 0
pub struct GetSubscriptionPlansData
|
crates/hyperswitch_domain_models/src/router_data_v2/flow_common_types.rs
|
hyperswitch_domain_models
|
struct_definition
|
GetSubscriptionPlansData
| 0
|
[] | 50
| null | null | null | null | null | null | null |
// Function: customer_update
// File: crates/router/src/compatibility/stripe/customers.rs
// Module: router
pub fn customer_update(
state: web::Data<routes::AppState>,
qs_config: web::Data<serde_qs::Config>,
req: HttpRequest,
path: web::Path<id_type::CustomerId>,
form_payload: web::Bytes,
) -> HttpResponse
|
crates/router/src/compatibility/stripe/customers.rs
|
router
|
function_signature
| null | null | null | 83
|
customer_update
| null | null | null | null | null | null |
// Struct: RapydIncomingWebhook
// File: crates/hyperswitch_connectors/src/connectors/rapyd/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0
pub struct RapydIncomingWebhook
|
crates/hyperswitch_connectors/src/connectors/rapyd/transformers.rs
|
hyperswitch_connectors
|
struct_definition
|
RapydIncomingWebhook
| 0
|
[] | 54
| null | null | null | null | null | null | null |
// Trait: PaymentIntentMetricAccumulator
// File: crates/analytics/src/payment_intents/accumulator.rs
// Module: analytics
pub trait PaymentIntentMetricAccumulator
|
crates/analytics/src/payment_intents/accumulator.rs
|
analytics
|
trait_definition
| null | null | null | 37
| null | null |
PaymentIntentMetricAccumulator
| null | null | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.