id
stringlengths 20
153
| type
stringclasses 1
value | granularity
stringclasses 14
values | content
stringlengths 16
84.3k
| metadata
dict |
|---|---|---|---|---|
connector-service_snippet_-8407711303800421270_0_15
|
clm
|
snippet
|
// connector-service/backend/interfaces/src/routing.rs
use common_enums::RoutableConnectors;
use utoipa::ToSchema;
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)]
#[serde(from = "RoutableChoiceSerde", into = "RoutableChoiceSerde")]
pub struct RoutableConnectorChoice {
#[serde(skip)]
pub choice_kind: RoutableChoiceKind,
pub connector: RoutableConnectors,
#[schema(value_type = Option<String>)]
pub merchant_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,
}
#[derive(Debug, Clone, serde::Deserialize, serde::Serialize, ToSchema, PartialEq)]
pub enum RoutableChoiceKind {
|
{
"chunk": null,
"crate": "interfaces",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 15,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 0,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-8407711303800421270_0_30
|
clm
|
snippet
|
// connector-service/backend/interfaces/src/routing.rs
use common_enums::RoutableConnectors;
use utoipa::ToSchema;
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)]
#[serde(from = "RoutableChoiceSerde", into = "RoutableChoiceSerde")]
pub struct RoutableConnectorChoice {
#[serde(skip)]
pub choice_kind: RoutableChoiceKind,
pub connector: RoutableConnectors,
#[schema(value_type = Option<String>)]
pub merchant_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,
}
#[derive(Debug, Clone, serde::Deserialize, serde::Serialize, ToSchema, PartialEq)]
pub enum RoutableChoiceKind {
OnlyConnector,
FullStruct,
}
#[derive(Debug, serde::Deserialize, serde::Serialize)]
#[serde(untagged)]
pub enum RoutableChoiceSerde {
OnlyConnector(Box<RoutableConnectors>),
FullStruct {
connector: RoutableConnectors,
merchant_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,
},
}
impl From<RoutableChoiceSerde> for RoutableConnectorChoice {
|
{
"chunk": null,
"crate": "interfaces",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 30,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 0,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-8407711303800421270_0_50
|
clm
|
snippet
|
// connector-service/backend/interfaces/src/routing.rs
use common_enums::RoutableConnectors;
use utoipa::ToSchema;
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)]
#[serde(from = "RoutableChoiceSerde", into = "RoutableChoiceSerde")]
pub struct RoutableConnectorChoice {
#[serde(skip)]
pub choice_kind: RoutableChoiceKind,
pub connector: RoutableConnectors,
#[schema(value_type = Option<String>)]
pub merchant_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,
}
#[derive(Debug, Clone, serde::Deserialize, serde::Serialize, ToSchema, PartialEq)]
pub enum RoutableChoiceKind {
OnlyConnector,
FullStruct,
}
#[derive(Debug, serde::Deserialize, serde::Serialize)]
#[serde(untagged)]
pub enum RoutableChoiceSerde {
OnlyConnector(Box<RoutableConnectors>),
FullStruct {
connector: RoutableConnectors,
merchant_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,
},
}
impl From<RoutableChoiceSerde> for RoutableConnectorChoice {
fn from(value: RoutableChoiceSerde) -> Self {
match value {
RoutableChoiceSerde::OnlyConnector(connector) => Self {
choice_kind: RoutableChoiceKind::OnlyConnector,
connector: *connector,
merchant_connector_id: None,
},
RoutableChoiceSerde::FullStruct {
connector,
merchant_connector_id,
} => Self {
choice_kind: RoutableChoiceKind::FullStruct,
connector,
merchant_connector_id,
},
}
}
}
|
{
"chunk": null,
"crate": "interfaces",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 50,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 0,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-8407711303800421270_25_15
|
clm
|
snippet
|
// connector-service/backend/interfaces/src/routing.rs
merchant_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,
},
}
impl From<RoutableChoiceSerde> for RoutableConnectorChoice {
fn from(value: RoutableChoiceSerde) -> Self {
match value {
RoutableChoiceSerde::OnlyConnector(connector) => Self {
choice_kind: RoutableChoiceKind::OnlyConnector,
connector: *connector,
merchant_connector_id: None,
},
RoutableChoiceSerde::FullStruct {
connector,
|
{
"chunk": null,
"crate": "interfaces",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 15,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 25,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-8407711303800421270_25_30
|
clm
|
snippet
|
// connector-service/backend/interfaces/src/routing.rs
merchant_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,
},
}
impl From<RoutableChoiceSerde> for RoutableConnectorChoice {
fn from(value: RoutableChoiceSerde) -> Self {
match value {
RoutableChoiceSerde::OnlyConnector(connector) => Self {
choice_kind: RoutableChoiceKind::OnlyConnector,
connector: *connector,
merchant_connector_id: None,
},
RoutableChoiceSerde::FullStruct {
connector,
merchant_connector_id,
} => Self {
choice_kind: RoutableChoiceKind::FullStruct,
connector,
merchant_connector_id,
},
}
}
}
impl From<RoutableConnectorChoice> for RoutableChoiceSerde {
fn from(value: RoutableConnectorChoice) -> Self {
match value.choice_kind {
RoutableChoiceKind::OnlyConnector => Self::OnlyConnector(Box::new(value.connector)),
RoutableChoiceKind::FullStruct => Self::FullStruct {
|
{
"chunk": null,
"crate": "interfaces",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 30,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 25,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-8407711303800421270_25_50
|
clm
|
snippet
|
// connector-service/backend/interfaces/src/routing.rs
merchant_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,
},
}
impl From<RoutableChoiceSerde> for RoutableConnectorChoice {
fn from(value: RoutableChoiceSerde) -> Self {
match value {
RoutableChoiceSerde::OnlyConnector(connector) => Self {
choice_kind: RoutableChoiceKind::OnlyConnector,
connector: *connector,
merchant_connector_id: None,
},
RoutableChoiceSerde::FullStruct {
connector,
merchant_connector_id,
} => Self {
choice_kind: RoutableChoiceKind::FullStruct,
connector,
merchant_connector_id,
},
}
}
}
impl From<RoutableConnectorChoice> for RoutableChoiceSerde {
fn from(value: RoutableConnectorChoice) -> Self {
match value.choice_kind {
RoutableChoiceKind::OnlyConnector => Self::OnlyConnector(Box::new(value.connector)),
RoutableChoiceKind::FullStruct => Self::FullStruct {
connector: value.connector,
merchant_connector_id: value.merchant_connector_id,
},
}
}
}
|
{
"chunk": null,
"crate": "interfaces",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 36,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 25,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-8407711303800421270_50_15
|
clm
|
snippet
|
// connector-service/backend/interfaces/src/routing.rs
impl From<RoutableConnectorChoice> for RoutableChoiceSerde {
fn from(value: RoutableConnectorChoice) -> Self {
match value.choice_kind {
RoutableChoiceKind::OnlyConnector => Self::OnlyConnector(Box::new(value.connector)),
RoutableChoiceKind::FullStruct => Self::FullStruct {
connector: value.connector,
merchant_connector_id: value.merchant_connector_id,
},
}
}
}
|
{
"chunk": null,
"crate": "interfaces",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 11,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 50,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-8407711303800421270_50_30
|
clm
|
snippet
|
// connector-service/backend/interfaces/src/routing.rs
impl From<RoutableConnectorChoice> for RoutableChoiceSerde {
fn from(value: RoutableConnectorChoice) -> Self {
match value.choice_kind {
RoutableChoiceKind::OnlyConnector => Self::OnlyConnector(Box::new(value.connector)),
RoutableChoiceKind::FullStruct => Self::FullStruct {
connector: value.connector,
merchant_connector_id: value.merchant_connector_id,
},
}
}
}
|
{
"chunk": null,
"crate": "interfaces",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 11,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 50,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-8407711303800421270_50_50
|
clm
|
snippet
|
// connector-service/backend/interfaces/src/routing.rs
impl From<RoutableConnectorChoice> for RoutableChoiceSerde {
fn from(value: RoutableConnectorChoice) -> Self {
match value.choice_kind {
RoutableChoiceKind::OnlyConnector => Self::OnlyConnector(Box::new(value.connector)),
RoutableChoiceKind::FullStruct => Self::FullStruct {
connector: value.connector,
merchant_connector_id: value.merchant_connector_id,
},
}
}
}
|
{
"chunk": null,
"crate": "interfaces",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 11,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 50,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_6351965063930718391_0_15
|
clm
|
snippet
|
// connector-service/backend/interfaces/src/api.rs
use common_enums::CurrencyUnit;
use common_utils::{
consts::{NO_ERROR_CODE, NO_ERROR_MESSAGE},
events, CustomResult,
};
use domain_types::{
api::{GenericLinks, PaymentLinkAction, RedirectionFormData},
payment_address::RedirectionResponse,
router_data::{ConnectorAuthType, ErrorResponse},
types::Connectors,
};
use hyperswitch_masking;
pub trait ConnectorCommon {
/// Name of the connector (in lowercase).
|
{
"chunk": null,
"crate": "interfaces",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 15,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 0,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_6351965063930718391_0_30
|
clm
|
snippet
|
// connector-service/backend/interfaces/src/api.rs
use common_enums::CurrencyUnit;
use common_utils::{
consts::{NO_ERROR_CODE, NO_ERROR_MESSAGE},
events, CustomResult,
};
use domain_types::{
api::{GenericLinks, PaymentLinkAction, RedirectionFormData},
payment_address::RedirectionResponse,
router_data::{ConnectorAuthType, ErrorResponse},
types::Connectors,
};
use hyperswitch_masking;
pub trait ConnectorCommon {
/// Name of the connector (in lowercase).
fn id(&self) -> &'static str;
/// Connector accepted currency unit as either "Base" or "Minor"
fn get_currency_unit(&self) -> CurrencyUnit {
CurrencyUnit::Minor // Default implementation should be remove once it is implemented in all connectors
}
/// HTTP header used for authorization.
fn get_auth_header(
&self,
_auth_type: &ConnectorAuthType,
) -> CustomResult<
Vec<(String, hyperswitch_masking::Maskable<String>)>,
domain_types::errors::ConnectorError,
> {
|
{
"chunk": null,
"crate": "interfaces",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 30,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 0,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_6351965063930718391_0_50
|
clm
|
snippet
|
// connector-service/backend/interfaces/src/api.rs
use common_enums::CurrencyUnit;
use common_utils::{
consts::{NO_ERROR_CODE, NO_ERROR_MESSAGE},
events, CustomResult,
};
use domain_types::{
api::{GenericLinks, PaymentLinkAction, RedirectionFormData},
payment_address::RedirectionResponse,
router_data::{ConnectorAuthType, ErrorResponse},
types::Connectors,
};
use hyperswitch_masking;
pub trait ConnectorCommon {
/// Name of the connector (in lowercase).
fn id(&self) -> &'static str;
/// Connector accepted currency unit as either "Base" or "Minor"
fn get_currency_unit(&self) -> CurrencyUnit {
CurrencyUnit::Minor // Default implementation should be remove once it is implemented in all connectors
}
/// HTTP header used for authorization.
fn get_auth_header(
&self,
_auth_type: &ConnectorAuthType,
) -> CustomResult<
Vec<(String, hyperswitch_masking::Maskable<String>)>,
domain_types::errors::ConnectorError,
> {
Ok(Vec::new())
}
/// HTTP `Content-Type` to be used for POST requests.
/// Defaults to `application/json`.
fn common_get_content_type(&self) -> &'static str {
"application/json"
}
// FIXME write doc - think about this
// fn headers(&self) -> Vec<(&str, &str)>;
/// The base URL for interacting with the connector's API.
fn base_url<'a>(&self, connectors: &'a Connectors) -> &'a str;
/// common error response for a connector if it is same in all case
fn build_error_response(
&self,
res: domain_types::router_response_types::Response,
_event_builder: Option<&mut events::Event>,
|
{
"chunk": null,
"crate": "interfaces",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 50,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 0,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_6351965063930718391_25_15
|
clm
|
snippet
|
// connector-service/backend/interfaces/src/api.rs
_auth_type: &ConnectorAuthType,
) -> CustomResult<
Vec<(String, hyperswitch_masking::Maskable<String>)>,
domain_types::errors::ConnectorError,
> {
Ok(Vec::new())
}
/// HTTP `Content-Type` to be used for POST requests.
/// Defaults to `application/json`.
fn common_get_content_type(&self) -> &'static str {
"application/json"
}
// FIXME write doc - think about this
|
{
"chunk": null,
"crate": "interfaces",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 15,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 25,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_6351965063930718391_25_30
|
clm
|
snippet
|
// connector-service/backend/interfaces/src/api.rs
_auth_type: &ConnectorAuthType,
) -> CustomResult<
Vec<(String, hyperswitch_masking::Maskable<String>)>,
domain_types::errors::ConnectorError,
> {
Ok(Vec::new())
}
/// HTTP `Content-Type` to be used for POST requests.
/// Defaults to `application/json`.
fn common_get_content_type(&self) -> &'static str {
"application/json"
}
// FIXME write doc - think about this
// fn headers(&self) -> Vec<(&str, &str)>;
/// The base URL for interacting with the connector's API.
fn base_url<'a>(&self, connectors: &'a Connectors) -> &'a str;
/// common error response for a connector if it is same in all case
fn build_error_response(
&self,
res: domain_types::router_response_types::Response,
_event_builder: Option<&mut events::Event>,
) -> CustomResult<ErrorResponse, domain_types::errors::ConnectorError> {
Ok(ErrorResponse {
status_code: res.status_code,
code: NO_ERROR_CODE.to_string(),
message: NO_ERROR_MESSAGE.to_string(),
|
{
"chunk": null,
"crate": "interfaces",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 30,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 25,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_6351965063930718391_25_50
|
clm
|
snippet
|
// connector-service/backend/interfaces/src/api.rs
_auth_type: &ConnectorAuthType,
) -> CustomResult<
Vec<(String, hyperswitch_masking::Maskable<String>)>,
domain_types::errors::ConnectorError,
> {
Ok(Vec::new())
}
/// HTTP `Content-Type` to be used for POST requests.
/// Defaults to `application/json`.
fn common_get_content_type(&self) -> &'static str {
"application/json"
}
// FIXME write doc - think about this
// fn headers(&self) -> Vec<(&str, &str)>;
/// The base URL for interacting with the connector's API.
fn base_url<'a>(&self, connectors: &'a Connectors) -> &'a str;
/// common error response for a connector if it is same in all case
fn build_error_response(
&self,
res: domain_types::router_response_types::Response,
_event_builder: Option<&mut events::Event>,
) -> CustomResult<ErrorResponse, domain_types::errors::ConnectorError> {
Ok(ErrorResponse {
status_code: res.status_code,
code: NO_ERROR_CODE.to_string(),
message: NO_ERROR_MESSAGE.to_string(),
reason: None,
attempt_status: None,
connector_transaction_id: None,
network_advice_code: None,
network_decline_code: None,
network_error_message: None,
})
}
}
#[derive(Debug, Eq, PartialEq)]
pub enum ApplicationResponse<R> {
Json(R),
StatusOk,
TextPlain(String),
JsonForRedirection(RedirectionResponse),
Form(Box<RedirectionFormData>),
PaymentLinkForm(Box<PaymentLinkAction>),
FileData((Vec<u8>, mime::Mime)),
JsonWithHeaders((R, Vec<(String, hyperswitch_masking::Maskable<String>)>)),
|
{
"chunk": null,
"crate": "interfaces",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 50,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 25,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_6351965063930718391_50_15
|
clm
|
snippet
|
// connector-service/backend/interfaces/src/api.rs
) -> CustomResult<ErrorResponse, domain_types::errors::ConnectorError> {
Ok(ErrorResponse {
status_code: res.status_code,
code: NO_ERROR_CODE.to_string(),
message: NO_ERROR_MESSAGE.to_string(),
reason: None,
attempt_status: None,
connector_transaction_id: None,
network_advice_code: None,
network_decline_code: None,
network_error_message: None,
})
}
}
|
{
"chunk": null,
"crate": "interfaces",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 15,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 50,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_6351965063930718391_50_30
|
clm
|
snippet
|
// connector-service/backend/interfaces/src/api.rs
) -> CustomResult<ErrorResponse, domain_types::errors::ConnectorError> {
Ok(ErrorResponse {
status_code: res.status_code,
code: NO_ERROR_CODE.to_string(),
message: NO_ERROR_MESSAGE.to_string(),
reason: None,
attempt_status: None,
connector_transaction_id: None,
network_advice_code: None,
network_decline_code: None,
network_error_message: None,
})
}
}
#[derive(Debug, Eq, PartialEq)]
pub enum ApplicationResponse<R> {
Json(R),
StatusOk,
TextPlain(String),
JsonForRedirection(RedirectionResponse),
Form(Box<RedirectionFormData>),
PaymentLinkForm(Box<PaymentLinkAction>),
FileData((Vec<u8>, mime::Mime)),
JsonWithHeaders((R, Vec<(String, hyperswitch_masking::Maskable<String>)>)),
GenericLinkForm(Box<GenericLinks>),
}
|
{
"chunk": null,
"crate": "interfaces",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 27,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 50,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_6351965063930718391_50_50
|
clm
|
snippet
|
// connector-service/backend/interfaces/src/api.rs
) -> CustomResult<ErrorResponse, domain_types::errors::ConnectorError> {
Ok(ErrorResponse {
status_code: res.status_code,
code: NO_ERROR_CODE.to_string(),
message: NO_ERROR_MESSAGE.to_string(),
reason: None,
attempt_status: None,
connector_transaction_id: None,
network_advice_code: None,
network_decline_code: None,
network_error_message: None,
})
}
}
#[derive(Debug, Eq, PartialEq)]
pub enum ApplicationResponse<R> {
Json(R),
StatusOk,
TextPlain(String),
JsonForRedirection(RedirectionResponse),
Form(Box<RedirectionFormData>),
PaymentLinkForm(Box<PaymentLinkAction>),
FileData((Vec<u8>, mime::Mime)),
JsonWithHeaders((R, Vec<(String, hyperswitch_masking::Maskable<String>)>)),
GenericLinkForm(Box<GenericLinks>),
}
|
{
"chunk": null,
"crate": "interfaces",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 27,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 50,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-1715344998119786497_0_15
|
clm
|
snippet
|
// connector-service/backend/interfaces/src/events/routing_api_logs.rs
//! Routing API logs interface
use std::fmt;
use common_utils::request::Method;
use serde::Serialize;
use serde_json::json;
use time::OffsetDateTime;
use tracing_actix_web::RequestId;
use crate::routing::RoutableConnectorChoice;
/// RoutingEngine enum
#[derive(Debug, Clone, Copy, Serialize)]
#[serde(rename_all = "snake_case")]
|
{
"chunk": null,
"crate": "interfaces",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 15,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 0,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-1715344998119786497_0_30
|
clm
|
snippet
|
// connector-service/backend/interfaces/src/events/routing_api_logs.rs
//! Routing API logs interface
use std::fmt;
use common_utils::request::Method;
use serde::Serialize;
use serde_json::json;
use time::OffsetDateTime;
use tracing_actix_web::RequestId;
use crate::routing::RoutableConnectorChoice;
/// RoutingEngine enum
#[derive(Debug, Clone, Copy, Serialize)]
#[serde(rename_all = "snake_case")]
pub enum RoutingEngine {
/// Dynamo for routing
IntelligentRouter,
/// Decision engine for routing
DecisionEngine,
}
/// Method type enum
#[derive(Debug, Clone, Copy, Serialize)]
#[serde(rename_all = "snake_case")]
pub enum ApiMethod {
/// grpc call
Grpc,
/// Rest call
Rest(Method),
|
{
"chunk": null,
"crate": "interfaces",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 30,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 0,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-1715344998119786497_0_50
|
clm
|
snippet
|
// connector-service/backend/interfaces/src/events/routing_api_logs.rs
//! Routing API logs interface
use std::fmt;
use common_utils::request::Method;
use serde::Serialize;
use serde_json::json;
use time::OffsetDateTime;
use tracing_actix_web::RequestId;
use crate::routing::RoutableConnectorChoice;
/// RoutingEngine enum
#[derive(Debug, Clone, Copy, Serialize)]
#[serde(rename_all = "snake_case")]
pub enum RoutingEngine {
/// Dynamo for routing
IntelligentRouter,
/// Decision engine for routing
DecisionEngine,
}
/// Method type enum
#[derive(Debug, Clone, Copy, Serialize)]
#[serde(rename_all = "snake_case")]
pub enum ApiMethod {
/// grpc call
Grpc,
/// Rest call
Rest(Method),
}
impl fmt::Display for ApiMethod {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::Grpc => write!(f, "Grpc"),
Self::Rest(method) => write!(f, "Rest ({method})"),
}
}
}
#[derive(Debug, Serialize)]
/// RoutingEvent type
pub struct RoutingEvent {
// tenant_id: common_utils::id_type::TenantId,
routable_connectors: String,
payment_connector: Option<String>,
flow: String,
request: String,
response: Option<String>,
|
{
"chunk": null,
"crate": "interfaces",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 50,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 0,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-1715344998119786497_25_15
|
clm
|
snippet
|
// connector-service/backend/interfaces/src/events/routing_api_logs.rs
pub enum ApiMethod {
/// grpc call
Grpc,
/// Rest call
Rest(Method),
}
impl fmt::Display for ApiMethod {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::Grpc => write!(f, "Grpc"),
Self::Rest(method) => write!(f, "Rest ({method})"),
}
}
}
|
{
"chunk": null,
"crate": "interfaces",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 15,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 25,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-1715344998119786497_25_30
|
clm
|
snippet
|
// connector-service/backend/interfaces/src/events/routing_api_logs.rs
pub enum ApiMethod {
/// grpc call
Grpc,
/// Rest call
Rest(Method),
}
impl fmt::Display for ApiMethod {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::Grpc => write!(f, "Grpc"),
Self::Rest(method) => write!(f, "Rest ({method})"),
}
}
}
#[derive(Debug, Serialize)]
/// RoutingEvent type
pub struct RoutingEvent {
// tenant_id: common_utils::id_type::TenantId,
routable_connectors: String,
payment_connector: Option<String>,
flow: String,
request: String,
response: Option<String>,
error: Option<String>,
url: String,
method: String,
payment_id: String,
profile_id: common_utils::id_type::ProfileId,
|
{
"chunk": null,
"crate": "interfaces",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 30,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 25,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-1715344998119786497_25_50
|
clm
|
snippet
|
// connector-service/backend/interfaces/src/events/routing_api_logs.rs
pub enum ApiMethod {
/// grpc call
Grpc,
/// Rest call
Rest(Method),
}
impl fmt::Display for ApiMethod {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::Grpc => write!(f, "Grpc"),
Self::Rest(method) => write!(f, "Rest ({method})"),
}
}
}
#[derive(Debug, Serialize)]
/// RoutingEvent type
pub struct RoutingEvent {
// tenant_id: common_utils::id_type::TenantId,
routable_connectors: String,
payment_connector: Option<String>,
flow: String,
request: String,
response: Option<String>,
error: Option<String>,
url: String,
method: String,
payment_id: String,
profile_id: common_utils::id_type::ProfileId,
merchant_id: common_utils::id_type::MerchantId,
created_at: i128,
status_code: Option<u16>,
request_id: String,
routing_engine: RoutingEngine,
routing_approach: Option<String>,
}
impl RoutingEvent {
/// fn new RoutingEvent
#[allow(clippy::too_many_arguments)]
pub fn new(
// tenant_id: common_utils::id_type::TenantId,
routable_connectors: String,
flow: &str,
request: serde_json::Value,
url: String,
method: ApiMethod,
payment_id: String,
profile_id: common_utils::id_type::ProfileId,
|
{
"chunk": null,
"crate": "interfaces",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 50,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 25,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-1715344998119786497_50_15
|
clm
|
snippet
|
// connector-service/backend/interfaces/src/events/routing_api_logs.rs
error: Option<String>,
url: String,
method: String,
payment_id: String,
profile_id: common_utils::id_type::ProfileId,
merchant_id: common_utils::id_type::MerchantId,
created_at: i128,
status_code: Option<u16>,
request_id: String,
routing_engine: RoutingEngine,
routing_approach: Option<String>,
}
impl RoutingEvent {
/// fn new RoutingEvent
|
{
"chunk": null,
"crate": "interfaces",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 15,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 50,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-1715344998119786497_50_30
|
clm
|
snippet
|
// connector-service/backend/interfaces/src/events/routing_api_logs.rs
error: Option<String>,
url: String,
method: String,
payment_id: String,
profile_id: common_utils::id_type::ProfileId,
merchant_id: common_utils::id_type::MerchantId,
created_at: i128,
status_code: Option<u16>,
request_id: String,
routing_engine: RoutingEngine,
routing_approach: Option<String>,
}
impl RoutingEvent {
/// fn new RoutingEvent
#[allow(clippy::too_many_arguments)]
pub fn new(
// tenant_id: common_utils::id_type::TenantId,
routable_connectors: String,
flow: &str,
request: serde_json::Value,
url: String,
method: ApiMethod,
payment_id: String,
profile_id: common_utils::id_type::ProfileId,
merchant_id: common_utils::id_type::MerchantId,
request_id: Option<RequestId>,
routing_engine: RoutingEngine,
) -> Self {
Self {
|
{
"chunk": null,
"crate": "interfaces",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 30,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 50,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-1715344998119786497_50_50
|
clm
|
snippet
|
// connector-service/backend/interfaces/src/events/routing_api_logs.rs
error: Option<String>,
url: String,
method: String,
payment_id: String,
profile_id: common_utils::id_type::ProfileId,
merchant_id: common_utils::id_type::MerchantId,
created_at: i128,
status_code: Option<u16>,
request_id: String,
routing_engine: RoutingEngine,
routing_approach: Option<String>,
}
impl RoutingEvent {
/// fn new RoutingEvent
#[allow(clippy::too_many_arguments)]
pub fn new(
// tenant_id: common_utils::id_type::TenantId,
routable_connectors: String,
flow: &str,
request: serde_json::Value,
url: String,
method: ApiMethod,
payment_id: String,
profile_id: common_utils::id_type::ProfileId,
merchant_id: common_utils::id_type::MerchantId,
request_id: Option<RequestId>,
routing_engine: RoutingEngine,
) -> Self {
Self {
// tenant_id,
routable_connectors,
flow: flow.to_string(),
request: request.to_string(),
response: None,
error: None,
url,
method: method.to_string(),
payment_id,
profile_id,
merchant_id,
created_at: OffsetDateTime::now_utc().unix_timestamp_nanos(),
status_code: None,
request_id: request_id
.map(|i| i.as_hyphenated().to_string())
.unwrap_or("NO_REQUEST_ID".to_string()),
routing_engine,
payment_connector: None,
routing_approach: None,
}
|
{
"chunk": null,
"crate": "interfaces",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 50,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 50,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-1715344998119786497_75_15
|
clm
|
snippet
|
// connector-service/backend/interfaces/src/events/routing_api_logs.rs
merchant_id: common_utils::id_type::MerchantId,
request_id: Option<RequestId>,
routing_engine: RoutingEngine,
) -> Self {
Self {
// tenant_id,
routable_connectors,
flow: flow.to_string(),
request: request.to_string(),
response: None,
error: None,
url,
method: method.to_string(),
payment_id,
profile_id,
|
{
"chunk": null,
"crate": "interfaces",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 15,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 75,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-1715344998119786497_75_30
|
clm
|
snippet
|
// connector-service/backend/interfaces/src/events/routing_api_logs.rs
merchant_id: common_utils::id_type::MerchantId,
request_id: Option<RequestId>,
routing_engine: RoutingEngine,
) -> Self {
Self {
// tenant_id,
routable_connectors,
flow: flow.to_string(),
request: request.to_string(),
response: None,
error: None,
url,
method: method.to_string(),
payment_id,
profile_id,
merchant_id,
created_at: OffsetDateTime::now_utc().unix_timestamp_nanos(),
status_code: None,
request_id: request_id
.map(|i| i.as_hyphenated().to_string())
.unwrap_or("NO_REQUEST_ID".to_string()),
routing_engine,
payment_connector: None,
routing_approach: None,
}
}
/// fn set_response_body
pub fn set_response_body<T: Serialize>(&mut self, response: &T) {
match hyperswitch_masking::masked_serialize(response) {
|
{
"chunk": null,
"crate": "interfaces",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 30,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 75,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-1715344998119786497_75_50
|
clm
|
snippet
|
// connector-service/backend/interfaces/src/events/routing_api_logs.rs
merchant_id: common_utils::id_type::MerchantId,
request_id: Option<RequestId>,
routing_engine: RoutingEngine,
) -> Self {
Self {
// tenant_id,
routable_connectors,
flow: flow.to_string(),
request: request.to_string(),
response: None,
error: None,
url,
method: method.to_string(),
payment_id,
profile_id,
merchant_id,
created_at: OffsetDateTime::now_utc().unix_timestamp_nanos(),
status_code: None,
request_id: request_id
.map(|i| i.as_hyphenated().to_string())
.unwrap_or("NO_REQUEST_ID".to_string()),
routing_engine,
payment_connector: None,
routing_approach: None,
}
}
/// fn set_response_body
pub fn set_response_body<T: Serialize>(&mut self, response: &T) {
match hyperswitch_masking::masked_serialize(response) {
Ok(masked) => {
self.response = Some(masked.to_string());
}
Err(er) => self.set_error(json!({"error": er.to_string()})),
}
}
/// fn set_error_response_body
pub fn set_error_response_body<T: Serialize>(&mut self, response: &T) {
match hyperswitch_masking::masked_serialize(response) {
Ok(masked) => {
self.error = Some(masked.to_string());
}
Err(er) => self.set_error(json!({"error": er.to_string()})),
}
}
/// fn set_error
pub fn set_error(&mut self, error: serde_json::Value) {
self.error = Some(error.to_string());
|
{
"chunk": null,
"crate": "interfaces",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 50,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 75,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-1715344998119786497_100_15
|
clm
|
snippet
|
// connector-service/backend/interfaces/src/events/routing_api_logs.rs
}
/// fn set_response_body
pub fn set_response_body<T: Serialize>(&mut self, response: &T) {
match hyperswitch_masking::masked_serialize(response) {
Ok(masked) => {
self.response = Some(masked.to_string());
}
Err(er) => self.set_error(json!({"error": er.to_string()})),
}
}
/// fn set_error_response_body
pub fn set_error_response_body<T: Serialize>(&mut self, response: &T) {
match hyperswitch_masking::masked_serialize(response) {
|
{
"chunk": null,
"crate": "interfaces",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 15,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 100,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-1715344998119786497_100_30
|
clm
|
snippet
|
// connector-service/backend/interfaces/src/events/routing_api_logs.rs
}
/// fn set_response_body
pub fn set_response_body<T: Serialize>(&mut self, response: &T) {
match hyperswitch_masking::masked_serialize(response) {
Ok(masked) => {
self.response = Some(masked.to_string());
}
Err(er) => self.set_error(json!({"error": er.to_string()})),
}
}
/// fn set_error_response_body
pub fn set_error_response_body<T: Serialize>(&mut self, response: &T) {
match hyperswitch_masking::masked_serialize(response) {
Ok(masked) => {
self.error = Some(masked.to_string());
}
Err(er) => self.set_error(json!({"error": er.to_string()})),
}
}
/// fn set_error
pub fn set_error(&mut self, error: serde_json::Value) {
self.error = Some(error.to_string());
}
/// set response status code
pub fn set_status_code(&mut self, code: u16) {
self.status_code = Some(code);
|
{
"chunk": null,
"crate": "interfaces",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 30,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 100,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-1715344998119786497_100_50
|
clm
|
snippet
|
// connector-service/backend/interfaces/src/events/routing_api_logs.rs
}
/// fn set_response_body
pub fn set_response_body<T: Serialize>(&mut self, response: &T) {
match hyperswitch_masking::masked_serialize(response) {
Ok(masked) => {
self.response = Some(masked.to_string());
}
Err(er) => self.set_error(json!({"error": er.to_string()})),
}
}
/// fn set_error_response_body
pub fn set_error_response_body<T: Serialize>(&mut self, response: &T) {
match hyperswitch_masking::masked_serialize(response) {
Ok(masked) => {
self.error = Some(masked.to_string());
}
Err(er) => self.set_error(json!({"error": er.to_string()})),
}
}
/// fn set_error
pub fn set_error(&mut self, error: serde_json::Value) {
self.error = Some(error.to_string());
}
/// set response status code
pub fn set_status_code(&mut self, code: u16) {
self.status_code = Some(code);
}
/// set response status code
pub fn set_routable_connectors(&mut self, connectors: Vec<RoutableConnectorChoice>) {
let connectors = connectors
.into_iter()
.map(|c| {
format!(
"{:?}:{:?}",
c.connector,
c.merchant_connector_id
.map(|id| id.get_string_repr().to_string())
.unwrap_or(String::from(""))
)
})
.collect::<Vec<_>>()
.join(",");
self.routable_connectors = connectors;
}
|
{
"chunk": null,
"crate": "interfaces",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 50,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 100,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-1715344998119786497_125_15
|
clm
|
snippet
|
// connector-service/backend/interfaces/src/events/routing_api_logs.rs
}
/// set response status code
pub fn set_status_code(&mut self, code: u16) {
self.status_code = Some(code);
}
/// set response status code
pub fn set_routable_connectors(&mut self, connectors: Vec<RoutableConnectorChoice>) {
let connectors = connectors
.into_iter()
.map(|c| {
format!(
"{:?}:{:?}",
c.connector,
|
{
"chunk": null,
"crate": "interfaces",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 15,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 125,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-1715344998119786497_125_30
|
clm
|
snippet
|
// connector-service/backend/interfaces/src/events/routing_api_logs.rs
}
/// set response status code
pub fn set_status_code(&mut self, code: u16) {
self.status_code = Some(code);
}
/// set response status code
pub fn set_routable_connectors(&mut self, connectors: Vec<RoutableConnectorChoice>) {
let connectors = connectors
.into_iter()
.map(|c| {
format!(
"{:?}:{:?}",
c.connector,
c.merchant_connector_id
.map(|id| id.get_string_repr().to_string())
.unwrap_or(String::from(""))
)
})
.collect::<Vec<_>>()
.join(",");
self.routable_connectors = connectors;
}
/// set payment connector
pub fn set_payment_connector(&mut self, connector: RoutableConnectorChoice) {
self.payment_connector = Some(format!(
"{:?}:{:?}",
connector.connector,
|
{
"chunk": null,
"crate": "interfaces",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 30,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 125,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-1715344998119786497_125_50
|
clm
|
snippet
|
// connector-service/backend/interfaces/src/events/routing_api_logs.rs
}
/// set response status code
pub fn set_status_code(&mut self, code: u16) {
self.status_code = Some(code);
}
/// set response status code
pub fn set_routable_connectors(&mut self, connectors: Vec<RoutableConnectorChoice>) {
let connectors = connectors
.into_iter()
.map(|c| {
format!(
"{:?}:{:?}",
c.connector,
c.merchant_connector_id
.map(|id| id.get_string_repr().to_string())
.unwrap_or(String::from(""))
)
})
.collect::<Vec<_>>()
.join(",");
self.routable_connectors = connectors;
}
/// set payment connector
pub fn set_payment_connector(&mut self, connector: RoutableConnectorChoice) {
self.payment_connector = Some(format!(
"{:?}:{:?}",
connector.connector,
connector
.merchant_connector_id
.map(|id| id.get_string_repr().to_string())
.unwrap_or(String::from(""))
));
}
/// set routing approach
pub fn set_routing_approach(&mut self, approach: String) {
self.routing_approach = Some(approach);
}
/// Returns the request ID of the event.
pub fn get_request_id(&self) -> &str {
&self.request_id
}
/// Returns the merchant ID of the event.
pub fn get_merchant_id(&self) -> &str {
self.merchant_id.get_string_repr()
|
{
"chunk": null,
"crate": "interfaces",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 50,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 125,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-1715344998119786497_150_15
|
clm
|
snippet
|
// connector-service/backend/interfaces/src/events/routing_api_logs.rs
/// set payment connector
pub fn set_payment_connector(&mut self, connector: RoutableConnectorChoice) {
self.payment_connector = Some(format!(
"{:?}:{:?}",
connector.connector,
connector
.merchant_connector_id
.map(|id| id.get_string_repr().to_string())
.unwrap_or(String::from(""))
));
}
/// set routing approach
pub fn set_routing_approach(&mut self, approach: String) {
self.routing_approach = Some(approach);
|
{
"chunk": null,
"crate": "interfaces",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 15,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 150,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-1715344998119786497_150_30
|
clm
|
snippet
|
// connector-service/backend/interfaces/src/events/routing_api_logs.rs
/// set payment connector
pub fn set_payment_connector(&mut self, connector: RoutableConnectorChoice) {
self.payment_connector = Some(format!(
"{:?}:{:?}",
connector.connector,
connector
.merchant_connector_id
.map(|id| id.get_string_repr().to_string())
.unwrap_or(String::from(""))
));
}
/// set routing approach
pub fn set_routing_approach(&mut self, approach: String) {
self.routing_approach = Some(approach);
}
/// Returns the request ID of the event.
pub fn get_request_id(&self) -> &str {
&self.request_id
}
/// Returns the merchant ID of the event.
pub fn get_merchant_id(&self) -> &str {
self.merchant_id.get_string_repr()
}
/// Returns the payment ID of the event.
pub fn get_payment_id(&self) -> &str {
&self.payment_id
}
|
{
"chunk": null,
"crate": "interfaces",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 30,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 150,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-1715344998119786497_150_50
|
clm
|
snippet
|
// connector-service/backend/interfaces/src/events/routing_api_logs.rs
/// set payment connector
pub fn set_payment_connector(&mut self, connector: RoutableConnectorChoice) {
self.payment_connector = Some(format!(
"{:?}:{:?}",
connector.connector,
connector
.merchant_connector_id
.map(|id| id.get_string_repr().to_string())
.unwrap_or(String::from(""))
));
}
/// set routing approach
pub fn set_routing_approach(&mut self, approach: String) {
self.routing_approach = Some(approach);
}
/// Returns the request ID of the event.
pub fn get_request_id(&self) -> &str {
&self.request_id
}
/// Returns the merchant ID of the event.
pub fn get_merchant_id(&self) -> &str {
self.merchant_id.get_string_repr()
}
/// Returns the payment ID of the event.
pub fn get_payment_id(&self) -> &str {
&self.payment_id
}
/// Returns the profile ID of the event.
pub fn get_profile_id(&self) -> &str {
self.profile_id.get_string_repr()
}
}
|
{
"chunk": null,
"crate": "interfaces",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 36,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 150,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-1715344998119786497_175_15
|
clm
|
snippet
|
// connector-service/backend/interfaces/src/events/routing_api_logs.rs
}
/// Returns the payment ID of the event.
pub fn get_payment_id(&self) -> &str {
&self.payment_id
}
/// Returns the profile ID of the event.
pub fn get_profile_id(&self) -> &str {
self.profile_id.get_string_repr()
}
}
|
{
"chunk": null,
"crate": "interfaces",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 11,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 175,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-1715344998119786497_175_30
|
clm
|
snippet
|
// connector-service/backend/interfaces/src/events/routing_api_logs.rs
}
/// Returns the payment ID of the event.
pub fn get_payment_id(&self) -> &str {
&self.payment_id
}
/// Returns the profile ID of the event.
pub fn get_profile_id(&self) -> &str {
self.profile_id.get_string_repr()
}
}
|
{
"chunk": null,
"crate": "interfaces",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 11,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 175,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-1715344998119786497_175_50
|
clm
|
snippet
|
// connector-service/backend/interfaces/src/events/routing_api_logs.rs
}
/// Returns the payment ID of the event.
pub fn get_payment_id(&self) -> &str {
&self.payment_id
}
/// Returns the profile ID of the event.
pub fn get_profile_id(&self) -> &str {
self.profile_id.get_string_repr()
}
}
|
{
"chunk": null,
"crate": "interfaces",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 11,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 175,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-4718366131698857213_0_15
|
clm
|
snippet
|
// connector-service/backend/interfaces/src/events/connector_api_logs.rs
//! Connector API logs interface
use common_utils::request::Method;
use serde::Serialize;
use serde_json::json;
use time::OffsetDateTime;
use tracing_actix_web::RequestId;
/// struct ConnectorEvent
#[derive(Debug, Serialize)]
pub struct ConnectorEvent {
// tenant_id: common_utils::id_type::TenantId,
connector_name: String,
flow: String,
request: String,
|
{
"chunk": null,
"crate": "interfaces",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 15,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 0,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-4718366131698857213_0_30
|
clm
|
snippet
|
// connector-service/backend/interfaces/src/events/connector_api_logs.rs
//! Connector API logs interface
use common_utils::request::Method;
use serde::Serialize;
use serde_json::json;
use time::OffsetDateTime;
use tracing_actix_web::RequestId;
/// struct ConnectorEvent
#[derive(Debug, Serialize)]
pub struct ConnectorEvent {
// tenant_id: common_utils::id_type::TenantId,
connector_name: String,
flow: String,
request: String,
masked_response: Option<String>,
error: Option<String>,
url: String,
method: String,
payment_id: String,
merchant_id: common_utils::id_type::MerchantId,
created_at: i128,
/// Connector Event Request ID
pub request_id: String,
latency: u128,
refund_id: Option<String>,
dispute_id: Option<String>,
status_code: u16,
}
|
{
"chunk": null,
"crate": "interfaces",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 30,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 0,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-4718366131698857213_0_50
|
clm
|
snippet
|
// connector-service/backend/interfaces/src/events/connector_api_logs.rs
//! Connector API logs interface
use common_utils::request::Method;
use serde::Serialize;
use serde_json::json;
use time::OffsetDateTime;
use tracing_actix_web::RequestId;
/// struct ConnectorEvent
#[derive(Debug, Serialize)]
pub struct ConnectorEvent {
// tenant_id: common_utils::id_type::TenantId,
connector_name: String,
flow: String,
request: String,
masked_response: Option<String>,
error: Option<String>,
url: String,
method: String,
payment_id: String,
merchant_id: common_utils::id_type::MerchantId,
created_at: i128,
/// Connector Event Request ID
pub request_id: String,
latency: u128,
refund_id: Option<String>,
dispute_id: Option<String>,
status_code: u16,
}
impl ConnectorEvent {
/// fn new ConnectorEvent
#[allow(clippy::too_many_arguments)]
pub fn new(
// tenant_id: common_utils::id_type::TenantId,
connector_name: String,
flow: &str,
request: serde_json::Value,
url: String,
method: Method,
payment_id: String,
merchant_id: common_utils::id_type::MerchantId,
request_id: Option<&RequestId>,
latency: u128,
refund_id: Option<String>,
dispute_id: Option<String>,
status_code: u16,
) -> Self {
Self {
// tenant_id,
|
{
"chunk": null,
"crate": "interfaces",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 50,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 0,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-4718366131698857213_25_15
|
clm
|
snippet
|
// connector-service/backend/interfaces/src/events/connector_api_logs.rs
refund_id: Option<String>,
dispute_id: Option<String>,
status_code: u16,
}
impl ConnectorEvent {
/// fn new ConnectorEvent
#[allow(clippy::too_many_arguments)]
pub fn new(
// tenant_id: common_utils::id_type::TenantId,
connector_name: String,
flow: &str,
request: serde_json::Value,
url: String,
method: Method,
|
{
"chunk": null,
"crate": "interfaces",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 15,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 25,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-4718366131698857213_25_30
|
clm
|
snippet
|
// connector-service/backend/interfaces/src/events/connector_api_logs.rs
refund_id: Option<String>,
dispute_id: Option<String>,
status_code: u16,
}
impl ConnectorEvent {
/// fn new ConnectorEvent
#[allow(clippy::too_many_arguments)]
pub fn new(
// tenant_id: common_utils::id_type::TenantId,
connector_name: String,
flow: &str,
request: serde_json::Value,
url: String,
method: Method,
payment_id: String,
merchant_id: common_utils::id_type::MerchantId,
request_id: Option<&RequestId>,
latency: u128,
refund_id: Option<String>,
dispute_id: Option<String>,
status_code: u16,
) -> Self {
Self {
// tenant_id,
connector_name,
flow: flow
.rsplit_once("::")
.map(|(_, s)| s)
.unwrap_or(flow)
|
{
"chunk": null,
"crate": "interfaces",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 30,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 25,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-4718366131698857213_25_50
|
clm
|
snippet
|
// connector-service/backend/interfaces/src/events/connector_api_logs.rs
refund_id: Option<String>,
dispute_id: Option<String>,
status_code: u16,
}
impl ConnectorEvent {
/// fn new ConnectorEvent
#[allow(clippy::too_many_arguments)]
pub fn new(
// tenant_id: common_utils::id_type::TenantId,
connector_name: String,
flow: &str,
request: serde_json::Value,
url: String,
method: Method,
payment_id: String,
merchant_id: common_utils::id_type::MerchantId,
request_id: Option<&RequestId>,
latency: u128,
refund_id: Option<String>,
dispute_id: Option<String>,
status_code: u16,
) -> Self {
Self {
// tenant_id,
connector_name,
flow: flow
.rsplit_once("::")
.map(|(_, s)| s)
.unwrap_or(flow)
.to_string(),
request: request.to_string(),
masked_response: None,
error: None,
url,
method: method.to_string(),
payment_id,
merchant_id,
created_at: OffsetDateTime::now_utc().unix_timestamp_nanos() / 1_000_000,
request_id: request_id
.map(|i| i.as_hyphenated().to_string())
.unwrap_or("NO_REQUEST_ID".to_string()),
latency,
refund_id,
dispute_id,
status_code,
}
}
/// fn set_response_body
|
{
"chunk": null,
"crate": "interfaces",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 50,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 25,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-4718366131698857213_50_15
|
clm
|
snippet
|
// connector-service/backend/interfaces/src/events/connector_api_logs.rs
connector_name,
flow: flow
.rsplit_once("::")
.map(|(_, s)| s)
.unwrap_or(flow)
.to_string(),
request: request.to_string(),
masked_response: None,
error: None,
url,
method: method.to_string(),
payment_id,
merchant_id,
created_at: OffsetDateTime::now_utc().unix_timestamp_nanos() / 1_000_000,
request_id: request_id
|
{
"chunk": null,
"crate": "interfaces",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 15,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 50,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-4718366131698857213_50_30
|
clm
|
snippet
|
// connector-service/backend/interfaces/src/events/connector_api_logs.rs
connector_name,
flow: flow
.rsplit_once("::")
.map(|(_, s)| s)
.unwrap_or(flow)
.to_string(),
request: request.to_string(),
masked_response: None,
error: None,
url,
method: method.to_string(),
payment_id,
merchant_id,
created_at: OffsetDateTime::now_utc().unix_timestamp_nanos() / 1_000_000,
request_id: request_id
.map(|i| i.as_hyphenated().to_string())
.unwrap_or("NO_REQUEST_ID".to_string()),
latency,
refund_id,
dispute_id,
status_code,
}
}
/// fn set_response_body
pub fn set_response_body<T: Serialize>(&mut self, response: &T) {
match hyperswitch_masking::masked_serialize(response) {
Ok(masked) => {
self.masked_response = Some(masked.to_string());
}
|
{
"chunk": null,
"crate": "interfaces",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 30,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 50,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-4718366131698857213_50_50
|
clm
|
snippet
|
// connector-service/backend/interfaces/src/events/connector_api_logs.rs
connector_name,
flow: flow
.rsplit_once("::")
.map(|(_, s)| s)
.unwrap_or(flow)
.to_string(),
request: request.to_string(),
masked_response: None,
error: None,
url,
method: method.to_string(),
payment_id,
merchant_id,
created_at: OffsetDateTime::now_utc().unix_timestamp_nanos() / 1_000_000,
request_id: request_id
.map(|i| i.as_hyphenated().to_string())
.unwrap_or("NO_REQUEST_ID".to_string()),
latency,
refund_id,
dispute_id,
status_code,
}
}
/// fn set_response_body
pub fn set_response_body<T: Serialize>(&mut self, response: &T) {
match hyperswitch_masking::masked_serialize(response) {
Ok(masked) => {
self.masked_response = Some(masked.to_string());
}
Err(er) => self.set_error(json!({"error": er.to_string()})),
}
}
/// fn set_error_response_body
pub fn set_error_response_body<T: Serialize>(&mut self, response: &T) {
match hyperswitch_masking::masked_serialize(response) {
Ok(masked) => {
self.error = Some(masked.to_string());
}
Err(er) => self.set_error(json!({"error": er.to_string()})),
}
}
/// fn set_error
pub fn set_error(&mut self, error: serde_json::Value) {
self.error = Some(error.to_string());
}
}
|
{
"chunk": null,
"crate": "interfaces",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 49,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 50,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-4718366131698857213_75_15
|
clm
|
snippet
|
// connector-service/backend/interfaces/src/events/connector_api_logs.rs
pub fn set_response_body<T: Serialize>(&mut self, response: &T) {
match hyperswitch_masking::masked_serialize(response) {
Ok(masked) => {
self.masked_response = Some(masked.to_string());
}
Err(er) => self.set_error(json!({"error": er.to_string()})),
}
}
/// fn set_error_response_body
pub fn set_error_response_body<T: Serialize>(&mut self, response: &T) {
match hyperswitch_masking::masked_serialize(response) {
Ok(masked) => {
self.error = Some(masked.to_string());
}
|
{
"chunk": null,
"crate": "interfaces",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 15,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 75,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-4718366131698857213_75_30
|
clm
|
snippet
|
// connector-service/backend/interfaces/src/events/connector_api_logs.rs
pub fn set_response_body<T: Serialize>(&mut self, response: &T) {
match hyperswitch_masking::masked_serialize(response) {
Ok(masked) => {
self.masked_response = Some(masked.to_string());
}
Err(er) => self.set_error(json!({"error": er.to_string()})),
}
}
/// fn set_error_response_body
pub fn set_error_response_body<T: Serialize>(&mut self, response: &T) {
match hyperswitch_masking::masked_serialize(response) {
Ok(masked) => {
self.error = Some(masked.to_string());
}
Err(er) => self.set_error(json!({"error": er.to_string()})),
}
}
/// fn set_error
pub fn set_error(&mut self, error: serde_json::Value) {
self.error = Some(error.to_string());
}
}
|
{
"chunk": null,
"crate": "interfaces",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 24,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 75,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-4718366131698857213_75_50
|
clm
|
snippet
|
// connector-service/backend/interfaces/src/events/connector_api_logs.rs
pub fn set_response_body<T: Serialize>(&mut self, response: &T) {
match hyperswitch_masking::masked_serialize(response) {
Ok(masked) => {
self.masked_response = Some(masked.to_string());
}
Err(er) => self.set_error(json!({"error": er.to_string()})),
}
}
/// fn set_error_response_body
pub fn set_error_response_body<T: Serialize>(&mut self, response: &T) {
match hyperswitch_masking::masked_serialize(response) {
Ok(masked) => {
self.error = Some(masked.to_string());
}
Err(er) => self.set_error(json!({"error": er.to_string()})),
}
}
/// fn set_error
pub fn set_error(&mut self, error: serde_json::Value) {
self.error = Some(error.to_string());
}
}
|
{
"chunk": null,
"crate": "interfaces",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 24,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 75,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_3032402600771296028_0_15
|
clm
|
snippet
|
// connector-service/examples/example-cli/src/bin/jus.rs
// src/main.rs
// --- Imports ---
use anyhow::{Context, Result, anyhow};
use clap::{Args, Parser, Subcommand};
use serde::{Deserialize, Serialize};
use std::fs::File;
use std::io::BufReader;
use std::path::PathBuf;
use strum::{EnumString, EnumVariantNames}; // For parsing enums
use tonic::transport::{Channel, Endpoint}; // For client connection
use tonic::metadata::MetadataMap;
use tonic::Extensions;
use tonic::Request;
use tonic::transport::Channel as TonicChannel;
|
{
"chunk": null,
"crate": "example-cli",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 15,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 0,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_3032402600771296028_0_30
|
clm
|
snippet
|
// connector-service/examples/example-cli/src/bin/jus.rs
// src/main.rs
// --- Imports ---
use anyhow::{Context, Result, anyhow};
use clap::{Args, Parser, Subcommand};
use serde::{Deserialize, Serialize};
use std::fs::File;
use std::io::BufReader;
use std::path::PathBuf;
use strum::{EnumString, EnumVariantNames}; // For parsing enums
use tonic::transport::{Channel, Endpoint}; // For client connection
use tonic::metadata::MetadataMap;
use tonic::Extensions;
use tonic::Request;
use tonic::transport::Channel as TonicChannel;
// --- Use gRPC types from the crate ---
use grpc_api_types::payments;
use grpc_api_types::payments::payment_service_client::PaymentServiceClient;
// --- Type Aliases ---
type PaymentClient = PaymentServiceClient<TonicChannel>;
// --- Constants ---
const X_CONNECTOR: &str = "x-connector";
const X_AUTH: &str = "x-auth";
const X_API_KEY: &str = "x-api-key";
const X_KEY1: &str = "x-key1";
const X_API_SECRET: &str = "x-api-secret";
|
{
"chunk": null,
"crate": "example-cli",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 30,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 0,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_3032402600771296028_0_50
|
clm
|
snippet
|
// connector-service/examples/example-cli/src/bin/jus.rs
// src/main.rs
// --- Imports ---
use anyhow::{Context, Result, anyhow};
use clap::{Args, Parser, Subcommand};
use serde::{Deserialize, Serialize};
use std::fs::File;
use std::io::BufReader;
use std::path::PathBuf;
use strum::{EnumString, EnumVariantNames}; // For parsing enums
use tonic::transport::{Channel, Endpoint}; // For client connection
use tonic::metadata::MetadataMap;
use tonic::Extensions;
use tonic::Request;
use tonic::transport::Channel as TonicChannel;
// --- Use gRPC types from the crate ---
use grpc_api_types::payments;
use grpc_api_types::payments::payment_service_client::PaymentServiceClient;
// --- Type Aliases ---
type PaymentClient = PaymentServiceClient<TonicChannel>;
// --- Constants ---
const X_CONNECTOR: &str = "x-connector";
const X_AUTH: &str = "x-auth";
const X_API_KEY: &str = "x-api-key";
const X_KEY1: &str = "x-key1";
const X_API_SECRET: &str = "x-api-secret";
// --- Enums ---
#[derive(
Debug,
Clone,
Copy,
EnumString,
EnumVariantNames,
PartialEq,
clap::ValueEnum,
Serialize,
Deserialize,
)]
#[strum(serialize_all = "snake_case")]
#[serde(rename_all = "snake_case")]
enum ConnectorChoice {
Adyen,
Razorpay,
}
impl std::fmt::Display for ConnectorChoice {
|
{
"chunk": null,
"crate": "example-cli",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 50,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 0,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_3032402600771296028_25_15
|
clm
|
snippet
|
// connector-service/examples/example-cli/src/bin/jus.rs
const X_AUTH: &str = "x-auth";
const X_API_KEY: &str = "x-api-key";
const X_KEY1: &str = "x-key1";
const X_API_SECRET: &str = "x-api-secret";
// --- Enums ---
#[derive(
Debug,
Clone,
Copy,
EnumString,
EnumVariantNames,
PartialEq,
clap::ValueEnum,
Serialize,
|
{
"chunk": null,
"crate": "example-cli",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 15,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 25,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_3032402600771296028_25_30
|
clm
|
snippet
|
// connector-service/examples/example-cli/src/bin/jus.rs
const X_AUTH: &str = "x-auth";
const X_API_KEY: &str = "x-api-key";
const X_KEY1: &str = "x-key1";
const X_API_SECRET: &str = "x-api-secret";
// --- Enums ---
#[derive(
Debug,
Clone,
Copy,
EnumString,
EnumVariantNames,
PartialEq,
clap::ValueEnum,
Serialize,
Deserialize,
)]
#[strum(serialize_all = "snake_case")]
#[serde(rename_all = "snake_case")]
enum ConnectorChoice {
Adyen,
Razorpay,
}
impl std::fmt::Display for ConnectorChoice {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
ConnectorChoice::Adyen => write!(f, "adyen"),
ConnectorChoice::Razorpay => write!(f, "razorpay"),
}
|
{
"chunk": null,
"crate": "example-cli",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 30,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 25,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_3032402600771296028_25_50
|
clm
|
snippet
|
// connector-service/examples/example-cli/src/bin/jus.rs
const X_AUTH: &str = "x-auth";
const X_API_KEY: &str = "x-api-key";
const X_KEY1: &str = "x-key1";
const X_API_SECRET: &str = "x-api-secret";
// --- Enums ---
#[derive(
Debug,
Clone,
Copy,
EnumString,
EnumVariantNames,
PartialEq,
clap::ValueEnum,
Serialize,
Deserialize,
)]
#[strum(serialize_all = "snake_case")]
#[serde(rename_all = "snake_case")]
enum ConnectorChoice {
Adyen,
Razorpay,
}
impl std::fmt::Display for ConnectorChoice {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
ConnectorChoice::Adyen => write!(f, "adyen"),
ConnectorChoice::Razorpay => write!(f, "razorpay"),
}
}
}
// --- Auth Details ---
#[derive(Debug, Args, Clone, Serialize, Deserialize, Default)]
struct AuthDetails {
/// API key for authentication
#[arg(long, required = false)]
#[serde(default)]
api_key: String,
/// Key1 for authentication (used in BodyKey and SignatureKey auth)
#[arg(long, required = false)]
#[serde(default)]
key1: Option<String>,
/// API secret for authentication (used in SignatureKey auth)
#[arg(long, required = false)]
#[serde(default)]
api_secret: Option<String>,
|
{
"chunk": null,
"crate": "example-cli",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 50,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 25,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_3032402600771296028_50_15
|
clm
|
snippet
|
// connector-service/examples/example-cli/src/bin/jus.rs
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
ConnectorChoice::Adyen => write!(f, "adyen"),
ConnectorChoice::Razorpay => write!(f, "razorpay"),
}
}
}
// --- Auth Details ---
#[derive(Debug, Args, Clone, Serialize, Deserialize, Default)]
struct AuthDetails {
/// API key for authentication
#[arg(long, required = false)]
#[serde(default)]
api_key: String,
|
{
"chunk": null,
"crate": "example-cli",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 15,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 50,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_3032402600771296028_50_30
|
clm
|
snippet
|
// connector-service/examples/example-cli/src/bin/jus.rs
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
ConnectorChoice::Adyen => write!(f, "adyen"),
ConnectorChoice::Razorpay => write!(f, "razorpay"),
}
}
}
// --- Auth Details ---
#[derive(Debug, Args, Clone, Serialize, Deserialize, Default)]
struct AuthDetails {
/// API key for authentication
#[arg(long, required = false)]
#[serde(default)]
api_key: String,
/// Key1 for authentication (used in BodyKey and SignatureKey auth)
#[arg(long, required = false)]
#[serde(default)]
key1: Option<String>,
/// API secret for authentication (used in SignatureKey auth)
#[arg(long, required = false)]
#[serde(default)]
api_secret: Option<String>,
/// Authentication type (bodykey, headerkey, signaturekey)
#[arg(long, value_enum, required = false)]
#[serde(default)]
auth_type: AuthType,
|
{
"chunk": null,
"crate": "example-cli",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 30,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 50,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_3032402600771296028_50_50
|
clm
|
snippet
|
// connector-service/examples/example-cli/src/bin/jus.rs
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
ConnectorChoice::Adyen => write!(f, "adyen"),
ConnectorChoice::Razorpay => write!(f, "razorpay"),
}
}
}
// --- Auth Details ---
#[derive(Debug, Args, Clone, Serialize, Deserialize, Default)]
struct AuthDetails {
/// API key for authentication
#[arg(long, required = false)]
#[serde(default)]
api_key: String,
/// Key1 for authentication (used in BodyKey and SignatureKey auth)
#[arg(long, required = false)]
#[serde(default)]
key1: Option<String>,
/// API secret for authentication (used in SignatureKey auth)
#[arg(long, required = false)]
#[serde(default)]
api_secret: Option<String>,
/// Authentication type (bodykey, headerkey, signaturekey)
#[arg(long, value_enum, required = false)]
#[serde(default)]
auth_type: AuthType,
}
#[derive(Debug, Clone, Copy, clap::ValueEnum, Serialize, Deserialize, PartialEq, Eq)]
#[serde(rename_all = "snake_case")]
enum AuthType {
/// Use body key authentication
BodyKey,
/// Use header key authentication
HeaderKey,
/// Use signature key authentication
SignatureKey,
}
impl Default for AuthType {
fn default() -> Self {
AuthType::HeaderKey // Using HeaderKey as default since it requires the least parameters
}
}
|
{
"chunk": null,
"crate": "example-cli",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 50,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 50,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_3032402600771296028_75_15
|
clm
|
snippet
|
// connector-service/examples/example-cli/src/bin/jus.rs
/// Authentication type (bodykey, headerkey, signaturekey)
#[arg(long, value_enum, required = false)]
#[serde(default)]
auth_type: AuthType,
}
#[derive(Debug, Clone, Copy, clap::ValueEnum, Serialize, Deserialize, PartialEq, Eq)]
#[serde(rename_all = "snake_case")]
enum AuthType {
/// Use body key authentication
BodyKey,
/// Use header key authentication
HeaderKey,
|
{
"chunk": null,
"crate": "example-cli",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 15,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 75,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_3032402600771296028_75_30
|
clm
|
snippet
|
// connector-service/examples/example-cli/src/bin/jus.rs
/// Authentication type (bodykey, headerkey, signaturekey)
#[arg(long, value_enum, required = false)]
#[serde(default)]
auth_type: AuthType,
}
#[derive(Debug, Clone, Copy, clap::ValueEnum, Serialize, Deserialize, PartialEq, Eq)]
#[serde(rename_all = "snake_case")]
enum AuthType {
/// Use body key authentication
BodyKey,
/// Use header key authentication
HeaderKey,
/// Use signature key authentication
SignatureKey,
}
impl Default for AuthType {
fn default() -> Self {
AuthType::HeaderKey // Using HeaderKey as default since it requires the least parameters
}
}
// --- Card Args ---
#[derive(Debug, Args, Clone, Serialize, Deserialize, Default)]
struct CardArgs {
/// Card number
|
{
"chunk": null,
"crate": "example-cli",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 30,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 75,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_3032402600771296028_75_50
|
clm
|
snippet
|
// connector-service/examples/example-cli/src/bin/jus.rs
/// Authentication type (bodykey, headerkey, signaturekey)
#[arg(long, value_enum, required = false)]
#[serde(default)]
auth_type: AuthType,
}
#[derive(Debug, Clone, Copy, clap::ValueEnum, Serialize, Deserialize, PartialEq, Eq)]
#[serde(rename_all = "snake_case")]
enum AuthType {
/// Use body key authentication
BodyKey,
/// Use header key authentication
HeaderKey,
/// Use signature key authentication
SignatureKey,
}
impl Default for AuthType {
fn default() -> Self {
AuthType::HeaderKey // Using HeaderKey as default since it requires the least parameters
}
}
// --- Card Args ---
#[derive(Debug, Args, Clone, Serialize, Deserialize, Default)]
struct CardArgs {
/// Card number
#[arg(long, required = false)]
#[serde(default)]
number: String,
/// Card expiry month
#[arg(long, required = false)]
#[serde(default)]
exp_month: String,
/// Card expiry year
#[arg(long, required = false)]
#[serde(default)]
exp_year: String,
/// Card CVC
#[arg(long, required = false)]
#[serde(default)]
cvc: String,
}
|
{
"chunk": null,
"crate": "example-cli",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 50,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 75,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_3032402600771296028_100_15
|
clm
|
snippet
|
// connector-service/examples/example-cli/src/bin/jus.rs
// --- Card Args ---
#[derive(Debug, Args, Clone, Serialize, Deserialize, Default)]
struct CardArgs {
/// Card number
#[arg(long, required = false)]
#[serde(default)]
number: String,
/// Card expiry month
#[arg(long, required = false)]
#[serde(default)]
exp_month: String,
/// Card expiry year
|
{
"chunk": null,
"crate": "example-cli",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 15,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 100,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_3032402600771296028_100_30
|
clm
|
snippet
|
// connector-service/examples/example-cli/src/bin/jus.rs
// --- Card Args ---
#[derive(Debug, Args, Clone, Serialize, Deserialize, Default)]
struct CardArgs {
/// Card number
#[arg(long, required = false)]
#[serde(default)]
number: String,
/// Card expiry month
#[arg(long, required = false)]
#[serde(default)]
exp_month: String,
/// Card expiry year
#[arg(long, required = false)]
#[serde(default)]
exp_year: String,
/// Card CVC
#[arg(long, required = false)]
#[serde(default)]
cvc: String,
}
// --- Credential file structure ---
#[derive(Debug, Clone, Serialize, Deserialize)]
struct CredentialData {
pub connector: ConnectorChoice,
pub auth: AuthDetails,
|
{
"chunk": null,
"crate": "example-cli",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 30,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 100,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_3032402600771296028_100_50
|
clm
|
snippet
|
// connector-service/examples/example-cli/src/bin/jus.rs
// --- Card Args ---
#[derive(Debug, Args, Clone, Serialize, Deserialize, Default)]
struct CardArgs {
/// Card number
#[arg(long, required = false)]
#[serde(default)]
number: String,
/// Card expiry month
#[arg(long, required = false)]
#[serde(default)]
exp_month: String,
/// Card expiry year
#[arg(long, required = false)]
#[serde(default)]
exp_year: String,
/// Card CVC
#[arg(long, required = false)]
#[serde(default)]
cvc: String,
}
// --- Credential file structure ---
#[derive(Debug, Clone, Serialize, Deserialize)]
struct CredentialData {
pub connector: ConnectorChoice,
pub auth: AuthDetails,
}
// --- Payment data file structure ---
#[derive(Debug, Clone, Serialize, Deserialize)]
struct PaymentData {
pub amount: i64,
pub currency: String,
pub email: Option<String>,
pub card: CardArgs,
}
// --- Sync data file structure ---
#[derive(Debug, Clone, Serialize, Deserialize)]
struct GetData {
pub payment_id: String,
}
// --- Subcommands ---
#[derive(Debug, Subcommand, Clone)]
enum Command {
|
{
"chunk": null,
"crate": "example-cli",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 50,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 100,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_3032402600771296028_125_15
|
clm
|
snippet
|
// connector-service/examples/example-cli/src/bin/jus.rs
// --- Credential file structure ---
#[derive(Debug, Clone, Serialize, Deserialize)]
struct CredentialData {
pub connector: ConnectorChoice,
pub auth: AuthDetails,
}
// --- Payment data file structure ---
#[derive(Debug, Clone, Serialize, Deserialize)]
struct PaymentData {
pub amount: i64,
pub currency: String,
pub email: Option<String>,
pub card: CardArgs,
}
|
{
"chunk": null,
"crate": "example-cli",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 15,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 125,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_3032402600771296028_125_30
|
clm
|
snippet
|
// connector-service/examples/example-cli/src/bin/jus.rs
// --- Credential file structure ---
#[derive(Debug, Clone, Serialize, Deserialize)]
struct CredentialData {
pub connector: ConnectorChoice,
pub auth: AuthDetails,
}
// --- Payment data file structure ---
#[derive(Debug, Clone, Serialize, Deserialize)]
struct PaymentData {
pub amount: i64,
pub currency: String,
pub email: Option<String>,
pub card: CardArgs,
}
// --- Sync data file structure ---
#[derive(Debug, Clone, Serialize, Deserialize)]
struct GetData {
pub payment_id: String,
}
// --- Subcommands ---
#[derive(Debug, Subcommand, Clone)]
enum Command {
/// Create a payment
Pay(PayArgs),
/// Get payment status
Get(GetArgs),
|
{
"chunk": null,
"crate": "example-cli",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 30,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 125,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_3032402600771296028_125_50
|
clm
|
snippet
|
// connector-service/examples/example-cli/src/bin/jus.rs
// --- Credential file structure ---
#[derive(Debug, Clone, Serialize, Deserialize)]
struct CredentialData {
pub connector: ConnectorChoice,
pub auth: AuthDetails,
}
// --- Payment data file structure ---
#[derive(Debug, Clone, Serialize, Deserialize)]
struct PaymentData {
pub amount: i64,
pub currency: String,
pub email: Option<String>,
pub card: CardArgs,
}
// --- Sync data file structure ---
#[derive(Debug, Clone, Serialize, Deserialize)]
struct GetData {
pub payment_id: String,
}
// --- Subcommands ---
#[derive(Debug, Subcommand, Clone)]
enum Command {
/// Create a payment
Pay(PayArgs),
/// Get payment status
Get(GetArgs),
}
// --- Command Args ---
#[derive(Debug, Args, Clone)]
struct PayArgs {
/// URL of the gRPC server
#[arg(long)]
url: String,
/// Connector to use (can be provided via cred_file)
#[arg(long, value_enum)]
connector: Option<ConnectorChoice>,
/// Amount to charge (can be provided via payment_file)
#[arg(long)]
amount: Option<i64>,
/// Currency to use (usd, gbp, eur) (can be provided via payment_file)
#[arg(long)]
currency: Option<String>,
|
{
"chunk": null,
"crate": "example-cli",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 50,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 125,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_3032402600771296028_150_15
|
clm
|
snippet
|
// connector-service/examples/example-cli/src/bin/jus.rs
/// Create a payment
Pay(PayArgs),
/// Get payment status
Get(GetArgs),
}
// --- Command Args ---
#[derive(Debug, Args, Clone)]
struct PayArgs {
/// URL of the gRPC server
#[arg(long)]
url: String,
/// Connector to use (can be provided via cred_file)
|
{
"chunk": null,
"crate": "example-cli",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 15,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 150,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_3032402600771296028_150_30
|
clm
|
snippet
|
// connector-service/examples/example-cli/src/bin/jus.rs
/// Create a payment
Pay(PayArgs),
/// Get payment status
Get(GetArgs),
}
// --- Command Args ---
#[derive(Debug, Args, Clone)]
struct PayArgs {
/// URL of the gRPC server
#[arg(long)]
url: String,
/// Connector to use (can be provided via cred_file)
#[arg(long, value_enum)]
connector: Option<ConnectorChoice>,
/// Amount to charge (can be provided via payment_file)
#[arg(long)]
amount: Option<i64>,
/// Currency to use (usd, gbp, eur) (can be provided via payment_file)
#[arg(long)]
currency: Option<String>,
/// Email address (can be provided via payment_file)
#[arg(long)]
email: Option<String>,
|
{
"chunk": null,
"crate": "example-cli",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 30,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 150,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_3032402600771296028_150_50
|
clm
|
snippet
|
// connector-service/examples/example-cli/src/bin/jus.rs
/// Create a payment
Pay(PayArgs),
/// Get payment status
Get(GetArgs),
}
// --- Command Args ---
#[derive(Debug, Args, Clone)]
struct PayArgs {
/// URL of the gRPC server
#[arg(long)]
url: String,
/// Connector to use (can be provided via cred_file)
#[arg(long, value_enum)]
connector: Option<ConnectorChoice>,
/// Amount to charge (can be provided via payment_file)
#[arg(long)]
amount: Option<i64>,
/// Currency to use (usd, gbp, eur) (can be provided via payment_file)
#[arg(long)]
currency: Option<String>,
/// Email address (can be provided via payment_file)
#[arg(long)]
email: Option<String>,
/// Path to credential file (contains connector and auth details)
#[arg(long)]
cred_file: Option<PathBuf>,
/// Path to payment data file (contains payment details)
#[arg(long)]
payment_file: Option<PathBuf>,
/// Capture method (automatic, manual, manual_multiple, scheduled, sequential_automatic)
#[arg(long)]
capture_method: Option<String>,
/// Return URL for redirect flows
#[arg(long)]
return_url: Option<String>,
/// Webhook URL for notifications
#[arg(long)]
webhook_url: Option<String>,
|
{
"chunk": null,
"crate": "example-cli",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 50,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 150,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_3032402600771296028_175_15
|
clm
|
snippet
|
// connector-service/examples/example-cli/src/bin/jus.rs
/// Email address (can be provided via payment_file)
#[arg(long)]
email: Option<String>,
/// Path to credential file (contains connector and auth details)
#[arg(long)]
cred_file: Option<PathBuf>,
/// Path to payment data file (contains payment details)
#[arg(long)]
payment_file: Option<PathBuf>,
/// Capture method (automatic, manual, manual_multiple, scheduled, sequential_automatic)
#[arg(long)]
|
{
"chunk": null,
"crate": "example-cli",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 15,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 175,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_3032402600771296028_175_30
|
clm
|
snippet
|
// connector-service/examples/example-cli/src/bin/jus.rs
/// Email address (can be provided via payment_file)
#[arg(long)]
email: Option<String>,
/// Path to credential file (contains connector and auth details)
#[arg(long)]
cred_file: Option<PathBuf>,
/// Path to payment data file (contains payment details)
#[arg(long)]
payment_file: Option<PathBuf>,
/// Capture method (automatic, manual, manual_multiple, scheduled, sequential_automatic)
#[arg(long)]
capture_method: Option<String>,
/// Return URL for redirect flows
#[arg(long)]
return_url: Option<String>,
/// Webhook URL for notifications
#[arg(long)]
webhook_url: Option<String>,
/// Complete authorize URL
#[arg(long)]
complete_authorize_url: Option<String>,
/// Future usage (off_session, on_session)
|
{
"chunk": null,
"crate": "example-cli",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 30,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 175,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_3032402600771296028_175_50
|
clm
|
snippet
|
// connector-service/examples/example-cli/src/bin/jus.rs
/// Email address (can be provided via payment_file)
#[arg(long)]
email: Option<String>,
/// Path to credential file (contains connector and auth details)
#[arg(long)]
cred_file: Option<PathBuf>,
/// Path to payment data file (contains payment details)
#[arg(long)]
payment_file: Option<PathBuf>,
/// Capture method (automatic, manual, manual_multiple, scheduled, sequential_automatic)
#[arg(long)]
capture_method: Option<String>,
/// Return URL for redirect flows
#[arg(long)]
return_url: Option<String>,
/// Webhook URL for notifications
#[arg(long)]
webhook_url: Option<String>,
/// Complete authorize URL
#[arg(long)]
complete_authorize_url: Option<String>,
/// Future usage (off_session, on_session)
#[arg(long)]
future_usage: Option<String>,
/// Whether the payment is off session
#[arg(long)]
off_session: Option<bool>,
/// Order category
#[arg(long)]
order_category: Option<String>,
/// Whether enrolled for 3DS
#[arg(long)]
enrolled_for_3ds: Option<bool>,
/// Payment experience (redirect_to_url, invoke_sdk_client, etc.)
#[arg(long)]
payment_experience: Option<String>,
/// Payment method type
|
{
"chunk": null,
"crate": "example-cli",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 50,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 175,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_3032402600771296028_200_15
|
clm
|
snippet
|
// connector-service/examples/example-cli/src/bin/jus.rs
/// Complete authorize URL
#[arg(long)]
complete_authorize_url: Option<String>,
/// Future usage (off_session, on_session)
#[arg(long)]
future_usage: Option<String>,
/// Whether the payment is off session
#[arg(long)]
off_session: Option<bool>,
/// Order category
#[arg(long)]
order_category: Option<String>,
|
{
"chunk": null,
"crate": "example-cli",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 15,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 200,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_3032402600771296028_200_30
|
clm
|
snippet
|
// connector-service/examples/example-cli/src/bin/jus.rs
/// Complete authorize URL
#[arg(long)]
complete_authorize_url: Option<String>,
/// Future usage (off_session, on_session)
#[arg(long)]
future_usage: Option<String>,
/// Whether the payment is off session
#[arg(long)]
off_session: Option<bool>,
/// Order category
#[arg(long)]
order_category: Option<String>,
/// Whether enrolled for 3DS
#[arg(long)]
enrolled_for_3ds: Option<bool>,
/// Payment experience (redirect_to_url, invoke_sdk_client, etc.)
#[arg(long)]
payment_experience: Option<String>,
/// Payment method type
#[arg(long)]
payment_method_type: Option<String>,
/// Whether to request incremental authorization
#[arg(long)]
|
{
"chunk": null,
"crate": "example-cli",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 30,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 200,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_3032402600771296028_200_50
|
clm
|
snippet
|
// connector-service/examples/example-cli/src/bin/jus.rs
/// Complete authorize URL
#[arg(long)]
complete_authorize_url: Option<String>,
/// Future usage (off_session, on_session)
#[arg(long)]
future_usage: Option<String>,
/// Whether the payment is off session
#[arg(long)]
off_session: Option<bool>,
/// Order category
#[arg(long)]
order_category: Option<String>,
/// Whether enrolled for 3DS
#[arg(long)]
enrolled_for_3ds: Option<bool>,
/// Payment experience (redirect_to_url, invoke_sdk_client, etc.)
#[arg(long)]
payment_experience: Option<String>,
/// Payment method type
#[arg(long)]
payment_method_type: Option<String>,
/// Whether to request incremental authorization
#[arg(long)]
request_incremental_authorization: Option<bool>,
/// Whether to request extended authorization
#[arg(long)]
request_extended_authorization: Option<bool>,
/// Merchant order reference ID
#[arg(long)]
merchant_order_reference_id: Option<String>,
/// Shipping cost
#[arg(long)]
shipping_cost: Option<i64>,
#[command(flatten)]
auth: Option<AuthDetails>,
#[command(flatten)]
card: Option<CardArgs>,
}
|
{
"chunk": null,
"crate": "example-cli",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 50,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 200,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_3032402600771296028_225_15
|
clm
|
snippet
|
// connector-service/examples/example-cli/src/bin/jus.rs
#[arg(long)]
payment_method_type: Option<String>,
/// Whether to request incremental authorization
#[arg(long)]
request_incremental_authorization: Option<bool>,
/// Whether to request extended authorization
#[arg(long)]
request_extended_authorization: Option<bool>,
/// Merchant order reference ID
#[arg(long)]
merchant_order_reference_id: Option<String>,
|
{
"chunk": null,
"crate": "example-cli",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 15,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 225,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_3032402600771296028_225_30
|
clm
|
snippet
|
// connector-service/examples/example-cli/src/bin/jus.rs
#[arg(long)]
payment_method_type: Option<String>,
/// Whether to request incremental authorization
#[arg(long)]
request_incremental_authorization: Option<bool>,
/// Whether to request extended authorization
#[arg(long)]
request_extended_authorization: Option<bool>,
/// Merchant order reference ID
#[arg(long)]
merchant_order_reference_id: Option<String>,
/// Shipping cost
#[arg(long)]
shipping_cost: Option<i64>,
#[command(flatten)]
auth: Option<AuthDetails>,
#[command(flatten)]
card: Option<CardArgs>,
}
#[derive(Debug, Args, Clone)]
struct GetArgs {
/// URL of the gRPC server
#[arg(long)]
|
{
"chunk": null,
"crate": "example-cli",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 30,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 225,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_3032402600771296028_225_50
|
clm
|
snippet
|
// connector-service/examples/example-cli/src/bin/jus.rs
#[arg(long)]
payment_method_type: Option<String>,
/// Whether to request incremental authorization
#[arg(long)]
request_incremental_authorization: Option<bool>,
/// Whether to request extended authorization
#[arg(long)]
request_extended_authorization: Option<bool>,
/// Merchant order reference ID
#[arg(long)]
merchant_order_reference_id: Option<String>,
/// Shipping cost
#[arg(long)]
shipping_cost: Option<i64>,
#[command(flatten)]
auth: Option<AuthDetails>,
#[command(flatten)]
card: Option<CardArgs>,
}
#[derive(Debug, Args, Clone)]
struct GetArgs {
/// URL of the gRPC server
#[arg(long)]
url: String,
/// Connector to use (can be provided via cred_file)
#[arg(long, value_enum)]
connector: Option<ConnectorChoice>,
/// Resource ID to sync (can be provided via get_file)
#[arg(long)]
payment_id: Option<String>,
/// Path to credential file (contains connector and auth details)
#[arg(long)]
cred_file: Option<PathBuf>,
/// Path to sync data file (contains sync details)
#[arg(long)]
get_file: Option<PathBuf>,
#[command(flatten)]
auth: Option<AuthDetails>,
|
{
"chunk": null,
"crate": "example-cli",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 50,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 225,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_3032402600771296028_250_15
|
clm
|
snippet
|
// connector-service/examples/example-cli/src/bin/jus.rs
#[derive(Debug, Args, Clone)]
struct GetArgs {
/// URL of the gRPC server
#[arg(long)]
url: String,
/// Connector to use (can be provided via cred_file)
#[arg(long, value_enum)]
connector: Option<ConnectorChoice>,
/// Resource ID to sync (can be provided via get_file)
#[arg(long)]
payment_id: Option<String>,
|
{
"chunk": null,
"crate": "example-cli",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 15,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 250,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_3032402600771296028_250_30
|
clm
|
snippet
|
// connector-service/examples/example-cli/src/bin/jus.rs
#[derive(Debug, Args, Clone)]
struct GetArgs {
/// URL of the gRPC server
#[arg(long)]
url: String,
/// Connector to use (can be provided via cred_file)
#[arg(long, value_enum)]
connector: Option<ConnectorChoice>,
/// Resource ID to sync (can be provided via get_file)
#[arg(long)]
payment_id: Option<String>,
/// Path to credential file (contains connector and auth details)
#[arg(long)]
cred_file: Option<PathBuf>,
/// Path to sync data file (contains sync details)
#[arg(long)]
get_file: Option<PathBuf>,
#[command(flatten)]
auth: Option<AuthDetails>,
}
// --- Main CLI Args ---
#[derive(Debug, Parser, Clone)]
#[command(name = "example-cli")]
|
{
"chunk": null,
"crate": "example-cli",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 30,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 250,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_3032402600771296028_250_50
|
clm
|
snippet
|
// connector-service/examples/example-cli/src/bin/jus.rs
#[derive(Debug, Args, Clone)]
struct GetArgs {
/// URL of the gRPC server
#[arg(long)]
url: String,
/// Connector to use (can be provided via cred_file)
#[arg(long, value_enum)]
connector: Option<ConnectorChoice>,
/// Resource ID to sync (can be provided via get_file)
#[arg(long)]
payment_id: Option<String>,
/// Path to credential file (contains connector and auth details)
#[arg(long)]
cred_file: Option<PathBuf>,
/// Path to sync data file (contains sync details)
#[arg(long)]
get_file: Option<PathBuf>,
#[command(flatten)]
auth: Option<AuthDetails>,
}
// --- Main CLI Args ---
#[derive(Debug, Parser, Clone)]
#[command(name = "example-cli")]
#[command(about = "gRPC Payment CLI Client", long_about = None)]
struct Cli {
#[command(subcommand)]
command: Command,
}
// --- gRPC Client Helper ---
async fn connect_client(url: &str) -> Result<PaymentClient> {
println!("Attempting to connect to gRPC server at: {}", url);
// Validate URL format
if !url.starts_with("http://") && !url.starts_with("https://") {
return Err(anyhow!("URL must start with http:// or https://"));
}
let endpoint = Endpoint::try_from(url.to_string())
.with_context(|| format!("Failed to create endpoint for URL: {}", url))?;
// Add connection timeout
let endpoint = endpoint.connect_timeout(std::time::Duration::from_secs(5));
|
{
"chunk": null,
"crate": "example-cli",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 50,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 250,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_3032402600771296028_275_15
|
clm
|
snippet
|
// connector-service/examples/example-cli/src/bin/jus.rs
}
// --- Main CLI Args ---
#[derive(Debug, Parser, Clone)]
#[command(name = "example-cli")]
#[command(about = "gRPC Payment CLI Client", long_about = None)]
struct Cli {
#[command(subcommand)]
command: Command,
}
// --- gRPC Client Helper ---
async fn connect_client(url: &str) -> Result<PaymentClient> {
println!("Attempting to connect to gRPC server at: {}", url);
|
{
"chunk": null,
"crate": "example-cli",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 15,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 275,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_3032402600771296028_275_30
|
clm
|
snippet
|
// connector-service/examples/example-cli/src/bin/jus.rs
}
// --- Main CLI Args ---
#[derive(Debug, Parser, Clone)]
#[command(name = "example-cli")]
#[command(about = "gRPC Payment CLI Client", long_about = None)]
struct Cli {
#[command(subcommand)]
command: Command,
}
// --- gRPC Client Helper ---
async fn connect_client(url: &str) -> Result<PaymentClient> {
println!("Attempting to connect to gRPC server at: {}", url);
// Validate URL format
if !url.starts_with("http://") && !url.starts_with("https://") {
return Err(anyhow!("URL must start with http:// or https://"));
}
let endpoint = Endpoint::try_from(url.to_string())
.with_context(|| format!("Failed to create endpoint for URL: {}", url))?;
// Add connection timeout
let endpoint = endpoint.connect_timeout(std::time::Duration::from_secs(5));
println!("Connecting to server...");
let channel = match endpoint.connect().await {
Ok(channel) => {
println!("Successfully connected to gRPC server");
|
{
"chunk": null,
"crate": "example-cli",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 30,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 275,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_3032402600771296028_275_50
|
clm
|
snippet
|
// connector-service/examples/example-cli/src/bin/jus.rs
}
// --- Main CLI Args ---
#[derive(Debug, Parser, Clone)]
#[command(name = "example-cli")]
#[command(about = "gRPC Payment CLI Client", long_about = None)]
struct Cli {
#[command(subcommand)]
command: Command,
}
// --- gRPC Client Helper ---
async fn connect_client(url: &str) -> Result<PaymentClient> {
println!("Attempting to connect to gRPC server at: {}", url);
// Validate URL format
if !url.starts_with("http://") && !url.starts_with("https://") {
return Err(anyhow!("URL must start with http:// or https://"));
}
let endpoint = Endpoint::try_from(url.to_string())
.with_context(|| format!("Failed to create endpoint for URL: {}", url))?;
// Add connection timeout
let endpoint = endpoint.connect_timeout(std::time::Duration::from_secs(5));
println!("Connecting to server...");
let channel = match endpoint.connect().await {
Ok(channel) => {
println!("Successfully connected to gRPC server");
channel
}
Err(err) => {
println!("Connection error: {}", err);
println!("Troubleshooting tips:");
println!("1. Make sure the server is running on the specified host and port");
println!("2. Check if the URL format is correct (e.g., http://localhost:8080)");
println!("3. Verify that the server is accepting gRPC connections");
println!(
"4. Check if there are any network issues or firewalls blocking the connection"
);
return Err(anyhow!("Failed to connect to gRPC server: {}", err));
}
};
Ok(PaymentClient::new(channel))
}
// --- Get Auth Details ---
fn get_auth_details(auth: &AuthDetails) -> Result<Vec<(String, String)>> {
|
{
"chunk": null,
"crate": "example-cli",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 50,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 275,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_3032402600771296028_300_15
|
clm
|
snippet
|
// connector-service/examples/example-cli/src/bin/jus.rs
println!("Connecting to server...");
let channel = match endpoint.connect().await {
Ok(channel) => {
println!("Successfully connected to gRPC server");
channel
}
Err(err) => {
println!("Connection error: {}", err);
println!("Troubleshooting tips:");
println!("1. Make sure the server is running on the specified host and port");
println!("2. Check if the URL format is correct (e.g., http://localhost:8080)");
println!("3. Verify that the server is accepting gRPC connections");
println!(
"4. Check if there are any network issues or firewalls blocking the connection"
|
{
"chunk": null,
"crate": "example-cli",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 15,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 300,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_3032402600771296028_300_30
|
clm
|
snippet
|
// connector-service/examples/example-cli/src/bin/jus.rs
println!("Connecting to server...");
let channel = match endpoint.connect().await {
Ok(channel) => {
println!("Successfully connected to gRPC server");
channel
}
Err(err) => {
println!("Connection error: {}", err);
println!("Troubleshooting tips:");
println!("1. Make sure the server is running on the specified host and port");
println!("2. Check if the URL format is correct (e.g., http://localhost:8080)");
println!("3. Verify that the server is accepting gRPC connections");
println!(
"4. Check if there are any network issues or firewalls blocking the connection"
);
return Err(anyhow!("Failed to connect to gRPC server: {}", err));
}
};
Ok(PaymentClient::new(channel))
}
// --- Get Auth Details ---
fn get_auth_details(auth: &AuthDetails) -> Result<Vec<(String, String)>> {
match auth.auth_type {
AuthType::BodyKey => {
let key1 = auth
.key1
.clone()
|
{
"chunk": null,
"crate": "example-cli",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 30,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 300,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_3032402600771296028_300_50
|
clm
|
snippet
|
// connector-service/examples/example-cli/src/bin/jus.rs
println!("Connecting to server...");
let channel = match endpoint.connect().await {
Ok(channel) => {
println!("Successfully connected to gRPC server");
channel
}
Err(err) => {
println!("Connection error: {}", err);
println!("Troubleshooting tips:");
println!("1. Make sure the server is running on the specified host and port");
println!("2. Check if the URL format is correct (e.g., http://localhost:8080)");
println!("3. Verify that the server is accepting gRPC connections");
println!(
"4. Check if there are any network issues or firewalls blocking the connection"
);
return Err(anyhow!("Failed to connect to gRPC server: {}", err));
}
};
Ok(PaymentClient::new(channel))
}
// --- Get Auth Details ---
fn get_auth_details(auth: &AuthDetails) -> Result<Vec<(String, String)>> {
match auth.auth_type {
AuthType::BodyKey => {
let key1 = auth
.key1
.clone()
.ok_or_else(|| anyhow!("key1 is required for BodyKey authentication"))?;
Ok(payments::AuthType {
auth_details: Some(payments::auth_type::AuthDetails::BodyKey(
payments::BodyKey {
api_key: auth.api_key.clone(),
key1,
},
)),
})
}
AuthType::HeaderKey => Ok(payments::AuthType {
auth_details: Some(payments::auth_type::AuthDetails::HeaderKey(
payments::HeaderKey {
api_key: auth.api_key.clone(),
},
)),
}),
AuthType::SignatureKey => {
let key1 = auth
|
{
"chunk": null,
"crate": "example-cli",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 50,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 300,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_3032402600771296028_325_15
|
clm
|
snippet
|
// connector-service/examples/example-cli/src/bin/jus.rs
match auth.auth_type {
AuthType::BodyKey => {
let key1 = auth
.key1
.clone()
.ok_or_else(|| anyhow!("key1 is required for BodyKey authentication"))?;
Ok(payments::AuthType {
auth_details: Some(payments::auth_type::AuthDetails::BodyKey(
payments::BodyKey {
api_key: auth.api_key.clone(),
key1,
},
)),
})
|
{
"chunk": null,
"crate": "example-cli",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 15,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 325,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_3032402600771296028_325_30
|
clm
|
snippet
|
// connector-service/examples/example-cli/src/bin/jus.rs
match auth.auth_type {
AuthType::BodyKey => {
let key1 = auth
.key1
.clone()
.ok_or_else(|| anyhow!("key1 is required for BodyKey authentication"))?;
Ok(payments::AuthType {
auth_details: Some(payments::auth_type::AuthDetails::BodyKey(
payments::BodyKey {
api_key: auth.api_key.clone(),
key1,
},
)),
})
}
AuthType::HeaderKey => Ok(payments::AuthType {
auth_details: Some(payments::auth_type::AuthDetails::HeaderKey(
payments::HeaderKey {
api_key: auth.api_key.clone(),
},
)),
}),
AuthType::SignatureKey => {
let key1 = auth
.key1
.clone()
.ok_or_else(|| anyhow!("key1 is required for SignatureKey authentication"))?;
let api_secret = auth
.api_secret
|
{
"chunk": null,
"crate": "example-cli",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 30,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 325,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_3032402600771296028_325_50
|
clm
|
snippet
|
// connector-service/examples/example-cli/src/bin/jus.rs
match auth.auth_type {
AuthType::BodyKey => {
let key1 = auth
.key1
.clone()
.ok_or_else(|| anyhow!("key1 is required for BodyKey authentication"))?;
Ok(payments::AuthType {
auth_details: Some(payments::auth_type::AuthDetails::BodyKey(
payments::BodyKey {
api_key: auth.api_key.clone(),
key1,
},
)),
})
}
AuthType::HeaderKey => Ok(payments::AuthType {
auth_details: Some(payments::auth_type::AuthDetails::HeaderKey(
payments::HeaderKey {
api_key: auth.api_key.clone(),
},
)),
}),
AuthType::SignatureKey => {
let key1 = auth
.key1
.clone()
.ok_or_else(|| anyhow!("key1 is required for SignatureKey authentication"))?;
let api_secret = auth
.api_secret
.clone()
.ok_or_else(|| anyhow!("api_secret is required for SignatureKey authentication"))?;
Ok(payments::AuthType {
auth_details: Some(payments::auth_type::AuthDetails::SignatureKey(
payments::SignatureKey {
api_key: auth.api_key.clone(),
key1,
api_secret,
},
)),
})
}
}
}
// --- Parse Currency ---
fn parse_currency(currency_str: &str) -> Result<i32> {
match currency_str.to_lowercase().as_str() {
"usd" => Ok(payments::Currency::Usd as i32),
|
{
"chunk": null,
"crate": "example-cli",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 50,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 325,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_3032402600771296028_350_15
|
clm
|
snippet
|
// connector-service/examples/example-cli/src/bin/jus.rs
.key1
.clone()
.ok_or_else(|| anyhow!("key1 is required for SignatureKey authentication"))?;
let api_secret = auth
.api_secret
.clone()
.ok_or_else(|| anyhow!("api_secret is required for SignatureKey authentication"))?;
Ok(payments::AuthType {
auth_details: Some(payments::auth_type::AuthDetails::SignatureKey(
payments::SignatureKey {
api_key: auth.api_key.clone(),
key1,
api_secret,
},
|
{
"chunk": null,
"crate": "example-cli",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 15,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 350,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_3032402600771296028_350_30
|
clm
|
snippet
|
// connector-service/examples/example-cli/src/bin/jus.rs
.key1
.clone()
.ok_or_else(|| anyhow!("key1 is required for SignatureKey authentication"))?;
let api_secret = auth
.api_secret
.clone()
.ok_or_else(|| anyhow!("api_secret is required for SignatureKey authentication"))?;
Ok(payments::AuthType {
auth_details: Some(payments::auth_type::AuthDetails::SignatureKey(
payments::SignatureKey {
api_key: auth.api_key.clone(),
key1,
api_secret,
},
)),
})
}
}
}
// --- Parse Currency ---
fn parse_currency(currency_str: &str) -> Result<i32> {
match currency_str.to_lowercase().as_str() {
"usd" => Ok(payments::Currency::Usd as i32),
"gbp" => Ok(payments::Currency::Gbp as i32),
"eur" => Ok(payments::Currency::Eur as i32),
_ => Err(anyhow!(
"Unsupported currency: {}. Use usd, gbp, eur",
currency_str
|
{
"chunk": null,
"crate": "example-cli",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 30,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 350,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_3032402600771296028_350_50
|
clm
|
snippet
|
// connector-service/examples/example-cli/src/bin/jus.rs
.key1
.clone()
.ok_or_else(|| anyhow!("key1 is required for SignatureKey authentication"))?;
let api_secret = auth
.api_secret
.clone()
.ok_or_else(|| anyhow!("api_secret is required for SignatureKey authentication"))?;
Ok(payments::AuthType {
auth_details: Some(payments::auth_type::AuthDetails::SignatureKey(
payments::SignatureKey {
api_key: auth.api_key.clone(),
key1,
api_secret,
},
)),
})
}
}
}
// --- Parse Currency ---
fn parse_currency(currency_str: &str) -> Result<i32> {
match currency_str.to_lowercase().as_str() {
"usd" => Ok(payments::Currency::Usd as i32),
"gbp" => Ok(payments::Currency::Gbp as i32),
"eur" => Ok(payments::Currency::Eur as i32),
_ => Err(anyhow!(
"Unsupported currency: {}. Use usd, gbp, eur",
currency_str
)),
}
}
// --- Command Handlers ---
// --- File Loading Functions ---
fn load_credential_file(file_path: &PathBuf) -> Result<CredentialData> {
println!("Loading credential data from: {}", file_path.display());
let file = File::open(file_path)
.with_context(|| format!("Failed to open credential file: {}", file_path.display()))?;
let reader = BufReader::new(file);
let cred_data: CredentialData = serde_json::from_reader(reader)
.with_context(|| format!("Failed to parse credential file: {}", file_path.display()))?;
Ok(cred_data)
}
fn load_payment_file(file_path: &PathBuf) -> Result<PaymentData> {
println!("Loading payment data from: {}", file_path.display());
|
{
"chunk": null,
"crate": "example-cli",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 50,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 350,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_3032402600771296028_375_15
|
clm
|
snippet
|
// connector-service/examples/example-cli/src/bin/jus.rs
"gbp" => Ok(payments::Currency::Gbp as i32),
"eur" => Ok(payments::Currency::Eur as i32),
_ => Err(anyhow!(
"Unsupported currency: {}. Use usd, gbp, eur",
currency_str
)),
}
}
// --- Command Handlers ---
// --- File Loading Functions ---
fn load_credential_file(file_path: &PathBuf) -> Result<CredentialData> {
println!("Loading credential data from: {}", file_path.display());
let file = File::open(file_path)
.with_context(|| format!("Failed to open credential file: {}", file_path.display()))?;
|
{
"chunk": null,
"crate": "example-cli",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 15,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 375,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.