id
stringlengths 20
153
| type
stringclasses 1
value | granularity
stringclasses 14
values | content
stringlengths 16
84.3k
| metadata
dict |
|---|---|---|---|---|
connector-service_snippet_-4017303140956931129_725_30
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/payment_method_data.rs
/// Get the token type from Google Pay tokenization data
/// Returns the token_type string if encrypted data exists, otherwise returns an error
pub fn get_encrypted_token_type(&self) -> error_stack::Result<String, ValidationError> {
Ok(self
.get_encrypted_google_pay_payment_data_mandatory()?
.token_type
.clone())
}
}
impl GPayPredecryptData {
/// Get the four-digit expiration year from the Google Pay pre-decrypt data
pub fn get_four_digit_expiry_year(
&self,
) -> error_stack::Result<Secret<String>, ValidationError> {
let mut year = self.card_exp_year.peek().clone();
// If it's a 2-digit year, convert to 4-digit
if year.len() == 2 {
year = format!("20{year}");
} else if year.len() != 4 {
return Err(ValidationError::InvalidValue {
message: format!(
"Invalid expiry year length: {}. Must be 2 or 4 digits",
year.len()
),
}
.into());
}
Ok(Secret::new(year))
|
{
"chunk": null,
"crate": "domain_types",
"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": 725,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-4017303140956931129_725_50
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/payment_method_data.rs
/// Get the token type from Google Pay tokenization data
/// Returns the token_type string if encrypted data exists, otherwise returns an error
pub fn get_encrypted_token_type(&self) -> error_stack::Result<String, ValidationError> {
Ok(self
.get_encrypted_google_pay_payment_data_mandatory()?
.token_type
.clone())
}
}
impl GPayPredecryptData {
/// Get the four-digit expiration year from the Google Pay pre-decrypt data
pub fn get_four_digit_expiry_year(
&self,
) -> error_stack::Result<Secret<String>, ValidationError> {
let mut year = self.card_exp_year.peek().clone();
// If it's a 2-digit year, convert to 4-digit
if year.len() == 2 {
year = format!("20{year}");
} else if year.len() != 4 {
return Err(ValidationError::InvalidValue {
message: format!(
"Invalid expiry year length: {}. Must be 2 or 4 digits",
year.len()
),
}
.into());
}
Ok(Secret::new(year))
}
/// Get the 2-digit expiration year from the Google Pay pre-decrypt data
pub fn get_two_digit_expiry_year(
&self,
) -> error_stack::Result<Secret<String>, ValidationError> {
let binding = self.card_exp_year.clone();
let year = binding.peek();
Ok(Secret::new(
year.get(year.len() - 2..)
.ok_or(ValidationError::InvalidValue {
message: "Invalid two-digit year".to_string(),
})?
.to_string(),
))
}
/// Get the expiry date in MMYY format from the Google Pay pre-decrypt data
pub fn get_expiry_date_as_mmyy(&self) -> error_stack::Result<Secret<String>, ValidationError> {
let year = self.get_two_digit_expiry_year()?.expose();
let month = self.get_expiry_month()?.clone().expose();
Ok(Secret::new(format!("{month}{year}")))
|
{
"chunk": null,
"crate": "domain_types",
"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": 725,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-4017303140956931129_750_15
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/payment_method_data.rs
),
}
.into());
}
Ok(Secret::new(year))
}
/// Get the 2-digit expiration year from the Google Pay pre-decrypt data
pub fn get_two_digit_expiry_year(
&self,
) -> error_stack::Result<Secret<String>, ValidationError> {
let binding = self.card_exp_year.clone();
let year = binding.peek();
Ok(Secret::new(
year.get(year.len() - 2..)
.ok_or(ValidationError::InvalidValue {
|
{
"chunk": null,
"crate": "domain_types",
"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": 750,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-4017303140956931129_750_30
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/payment_method_data.rs
),
}
.into());
}
Ok(Secret::new(year))
}
/// Get the 2-digit expiration year from the Google Pay pre-decrypt data
pub fn get_two_digit_expiry_year(
&self,
) -> error_stack::Result<Secret<String>, ValidationError> {
let binding = self.card_exp_year.clone();
let year = binding.peek();
Ok(Secret::new(
year.get(year.len() - 2..)
.ok_or(ValidationError::InvalidValue {
message: "Invalid two-digit year".to_string(),
})?
.to_string(),
))
}
/// Get the expiry date in MMYY format from the Google Pay pre-decrypt data
pub fn get_expiry_date_as_mmyy(&self) -> error_stack::Result<Secret<String>, ValidationError> {
let year = self.get_two_digit_expiry_year()?.expose();
let month = self.get_expiry_month()?.clone().expose();
Ok(Secret::new(format!("{month}{year}")))
}
/// Get the expiration month from the Google Pay pre-decrypt data
pub fn get_expiry_month(&self) -> error_stack::Result<Secret<String>, ValidationError> {
let month_str = self.card_exp_month.peek();
|
{
"chunk": null,
"crate": "domain_types",
"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": 750,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-4017303140956931129_750_50
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/payment_method_data.rs
),
}
.into());
}
Ok(Secret::new(year))
}
/// Get the 2-digit expiration year from the Google Pay pre-decrypt data
pub fn get_two_digit_expiry_year(
&self,
) -> error_stack::Result<Secret<String>, ValidationError> {
let binding = self.card_exp_year.clone();
let year = binding.peek();
Ok(Secret::new(
year.get(year.len() - 2..)
.ok_or(ValidationError::InvalidValue {
message: "Invalid two-digit year".to_string(),
})?
.to_string(),
))
}
/// Get the expiry date in MMYY format from the Google Pay pre-decrypt data
pub fn get_expiry_date_as_mmyy(&self) -> error_stack::Result<Secret<String>, ValidationError> {
let year = self.get_two_digit_expiry_year()?.expose();
let month = self.get_expiry_month()?.clone().expose();
Ok(Secret::new(format!("{month}{year}")))
}
/// Get the expiration month from the Google Pay pre-decrypt data
pub fn get_expiry_month(&self) -> error_stack::Result<Secret<String>, ValidationError> {
let month_str = self.card_exp_month.peek();
let month = month_str
.parse::<u8>()
.map_err(|_| ValidationError::InvalidValue {
message: format!("Failed to parse expiry month: {month_str}"),
})?;
if !(1..=12).contains(&month) {
return Err(ValidationError::InvalidValue {
message: format!("Invalid expiry month: {month}. Must be between 1 and 12"),
}
.into());
}
Ok(self.card_exp_month.clone())
}
}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize)]
pub struct GooglePayPaymentMethodInfo {
/// The name of the card network
pub card_network: String,
|
{
"chunk": null,
"crate": "domain_types",
"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": 750,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-4017303140956931129_775_15
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/payment_method_data.rs
}
/// Get the expiration month from the Google Pay pre-decrypt data
pub fn get_expiry_month(&self) -> error_stack::Result<Secret<String>, ValidationError> {
let month_str = self.card_exp_month.peek();
let month = month_str
.parse::<u8>()
.map_err(|_| ValidationError::InvalidValue {
message: format!("Failed to parse expiry month: {month_str}"),
})?;
if !(1..=12).contains(&month) {
return Err(ValidationError::InvalidValue {
message: format!("Invalid expiry month: {month}. Must be between 1 and 12"),
}
|
{
"chunk": null,
"crate": "domain_types",
"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": 775,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-4017303140956931129_775_30
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/payment_method_data.rs
}
/// Get the expiration month from the Google Pay pre-decrypt data
pub fn get_expiry_month(&self) -> error_stack::Result<Secret<String>, ValidationError> {
let month_str = self.card_exp_month.peek();
let month = month_str
.parse::<u8>()
.map_err(|_| ValidationError::InvalidValue {
message: format!("Failed to parse expiry month: {month_str}"),
})?;
if !(1..=12).contains(&month) {
return Err(ValidationError::InvalidValue {
message: format!("Invalid expiry month: {month}. Must be between 1 and 12"),
}
.into());
}
Ok(self.card_exp_month.clone())
}
}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize)]
pub struct GooglePayPaymentMethodInfo {
/// The name of the card network
pub card_network: String,
/// The details of the card
pub card_details: String,
//assurance_details of the card
pub assurance_details: Option<GooglePayAssuranceDetails>,
}
|
{
"chunk": null,
"crate": "domain_types",
"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": 775,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-4017303140956931129_775_50
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/payment_method_data.rs
}
/// Get the expiration month from the Google Pay pre-decrypt data
pub fn get_expiry_month(&self) -> error_stack::Result<Secret<String>, ValidationError> {
let month_str = self.card_exp_month.peek();
let month = month_str
.parse::<u8>()
.map_err(|_| ValidationError::InvalidValue {
message: format!("Failed to parse expiry month: {month_str}"),
})?;
if !(1..=12).contains(&month) {
return Err(ValidationError::InvalidValue {
message: format!("Invalid expiry month: {month}. Must be between 1 and 12"),
}
.into());
}
Ok(self.card_exp_month.clone())
}
}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize)]
pub struct GooglePayPaymentMethodInfo {
/// The name of the card network
pub card_network: String,
/// The details of the card
pub card_details: String,
//assurance_details of the card
pub assurance_details: Option<GooglePayAssuranceDetails>,
}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize)]
#[serde(rename_all = "snake_case")]
pub struct GooglePayAssuranceDetails {
///indicates that Cardholder possession validation has been performed
pub card_holder_authenticated: bool,
/// indicates that identification and verifications (ID&V) was performed
pub account_verified: bool,
}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct GooglePayRedirectData {}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct ApplePayThirdPartySdkData {}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct ApplePayRedirectData {}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
|
{
"chunk": null,
"crate": "domain_types",
"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": 775,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-4017303140956931129_800_15
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/payment_method_data.rs
/// The details of the card
pub card_details: String,
//assurance_details of the card
pub assurance_details: Option<GooglePayAssuranceDetails>,
}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize)]
#[serde(rename_all = "snake_case")]
pub struct GooglePayAssuranceDetails {
///indicates that Cardholder possession validation has been performed
pub card_holder_authenticated: bool,
/// indicates that identification and verifications (ID&V) was performed
pub account_verified: bool,
}
|
{
"chunk": null,
"crate": "domain_types",
"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": 800,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-4017303140956931129_800_30
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/payment_method_data.rs
/// The details of the card
pub card_details: String,
//assurance_details of the card
pub assurance_details: Option<GooglePayAssuranceDetails>,
}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize)]
#[serde(rename_all = "snake_case")]
pub struct GooglePayAssuranceDetails {
///indicates that Cardholder possession validation has been performed
pub card_holder_authenticated: bool,
/// indicates that identification and verifications (ID&V) was performed
pub account_verified: bool,
}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct GooglePayRedirectData {}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct ApplePayThirdPartySdkData {}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct ApplePayRedirectData {}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct ApplepayPaymentMethod {
/// The name to be displayed on Apple Pay button
pub display_name: String,
/// The network of the Apple pay payment method
pub network: String,
|
{
"chunk": null,
"crate": "domain_types",
"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": 800,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-4017303140956931129_800_50
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/payment_method_data.rs
/// The details of the card
pub card_details: String,
//assurance_details of the card
pub assurance_details: Option<GooglePayAssuranceDetails>,
}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize)]
#[serde(rename_all = "snake_case")]
pub struct GooglePayAssuranceDetails {
///indicates that Cardholder possession validation has been performed
pub card_holder_authenticated: bool,
/// indicates that identification and verifications (ID&V) was performed
pub account_verified: bool,
}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct GooglePayRedirectData {}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct ApplePayThirdPartySdkData {}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct ApplePayRedirectData {}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct ApplepayPaymentMethod {
/// The name to be displayed on Apple Pay button
pub display_name: String,
/// The network of the Apple pay payment method
pub network: String,
/// The type of the payment method
#[serde(rename = "type")]
pub pm_type: String,
}
#[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, ToSchema)]
#[serde(rename_all = "snake_case")]
/// This struct represents the decrypted Apple Pay payment data
pub struct ApplePayPredecryptData {
/// The primary account number
pub application_primary_account_number: cards::CardNumber,
/// The application expiration date (PAN expiry month)
pub application_expiration_month: Secret<String>,
/// The application expiration date (PAN expiry year)
pub application_expiration_year: Secret<String>,
/// The payment data, which contains the cryptogram and ECI indicator
pub payment_data: ApplePayCryptogramData,
}
#[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, ToSchema)]
|
{
"chunk": null,
"crate": "domain_types",
"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": 800,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-4017303140956931129_825_15
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/payment_method_data.rs
pub struct ApplepayPaymentMethod {
/// The name to be displayed on Apple Pay button
pub display_name: String,
/// The network of the Apple pay payment method
pub network: String,
/// The type of the payment method
#[serde(rename = "type")]
pub pm_type: String,
}
#[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, ToSchema)]
#[serde(rename_all = "snake_case")]
/// This struct represents the decrypted Apple Pay payment data
pub struct ApplePayPredecryptData {
/// The primary account number
|
{
"chunk": null,
"crate": "domain_types",
"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": 825,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-4017303140956931129_825_30
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/payment_method_data.rs
pub struct ApplepayPaymentMethod {
/// The name to be displayed on Apple Pay button
pub display_name: String,
/// The network of the Apple pay payment method
pub network: String,
/// The type of the payment method
#[serde(rename = "type")]
pub pm_type: String,
}
#[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, ToSchema)]
#[serde(rename_all = "snake_case")]
/// This struct represents the decrypted Apple Pay payment data
pub struct ApplePayPredecryptData {
/// The primary account number
pub application_primary_account_number: cards::CardNumber,
/// The application expiration date (PAN expiry month)
pub application_expiration_month: Secret<String>,
/// The application expiration date (PAN expiry year)
pub application_expiration_year: Secret<String>,
/// The payment data, which contains the cryptogram and ECI indicator
pub payment_data: ApplePayCryptogramData,
}
#[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, ToSchema)]
#[serde(rename_all = "snake_case")]
/// This struct represents the cryptogram data for Apple Pay transactions
pub struct ApplePayCryptogramData {
/// The online payment cryptogram
pub online_payment_cryptogram: Secret<String>,
|
{
"chunk": null,
"crate": "domain_types",
"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": 825,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-4017303140956931129_825_50
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/payment_method_data.rs
pub struct ApplepayPaymentMethod {
/// The name to be displayed on Apple Pay button
pub display_name: String,
/// The network of the Apple pay payment method
pub network: String,
/// The type of the payment method
#[serde(rename = "type")]
pub pm_type: String,
}
#[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, ToSchema)]
#[serde(rename_all = "snake_case")]
/// This struct represents the decrypted Apple Pay payment data
pub struct ApplePayPredecryptData {
/// The primary account number
pub application_primary_account_number: cards::CardNumber,
/// The application expiration date (PAN expiry month)
pub application_expiration_month: Secret<String>,
/// The application expiration date (PAN expiry year)
pub application_expiration_year: Secret<String>,
/// The payment data, which contains the cryptogram and ECI indicator
pub payment_data: ApplePayCryptogramData,
}
#[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, ToSchema)]
#[serde(rename_all = "snake_case")]
/// This struct represents the cryptogram data for Apple Pay transactions
pub struct ApplePayCryptogramData {
/// The online payment cryptogram
pub online_payment_cryptogram: Secret<String>,
/// The ECI (Electronic Commerce Indicator) value
pub eci_indicator: Option<String>,
}
#[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, ToSchema)]
#[serde(rename_all = "snake_case")]
#[serde(untagged)]
/// This enum is used to represent the Apple Pay payment data, which can either be encrypted or decrypted.
pub enum ApplePayPaymentData {
/// This variant contains the decrypted Apple Pay payment data as a structured object.
Decrypted(ApplePayPredecryptData),
/// This variant contains the encrypted Apple Pay payment data as a string.
Encrypted(String),
}
impl ApplePayPaymentData {
/// Get the encrypted Apple Pay payment data if it exists
pub fn get_encrypted_apple_pay_payment_data_optional(&self) -> Option<&String> {
match self {
Self::Encrypted(encrypted_data) => Some(encrypted_data),
|
{
"chunk": null,
"crate": "domain_types",
"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": 825,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-4017303140956931129_850_15
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/payment_method_data.rs
#[serde(rename_all = "snake_case")]
/// This struct represents the cryptogram data for Apple Pay transactions
pub struct ApplePayCryptogramData {
/// The online payment cryptogram
pub online_payment_cryptogram: Secret<String>,
/// The ECI (Electronic Commerce Indicator) value
pub eci_indicator: Option<String>,
}
#[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, ToSchema)]
#[serde(rename_all = "snake_case")]
#[serde(untagged)]
/// This enum is used to represent the Apple Pay payment data, which can either be encrypted or decrypted.
pub enum ApplePayPaymentData {
/// This variant contains the decrypted Apple Pay payment data as a structured object.
|
{
"chunk": null,
"crate": "domain_types",
"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": 850,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-4017303140956931129_850_30
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/payment_method_data.rs
#[serde(rename_all = "snake_case")]
/// This struct represents the cryptogram data for Apple Pay transactions
pub struct ApplePayCryptogramData {
/// The online payment cryptogram
pub online_payment_cryptogram: Secret<String>,
/// The ECI (Electronic Commerce Indicator) value
pub eci_indicator: Option<String>,
}
#[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, ToSchema)]
#[serde(rename_all = "snake_case")]
#[serde(untagged)]
/// This enum is used to represent the Apple Pay payment data, which can either be encrypted or decrypted.
pub enum ApplePayPaymentData {
/// This variant contains the decrypted Apple Pay payment data as a structured object.
Decrypted(ApplePayPredecryptData),
/// This variant contains the encrypted Apple Pay payment data as a string.
Encrypted(String),
}
impl ApplePayPaymentData {
/// Get the encrypted Apple Pay payment data if it exists
pub fn get_encrypted_apple_pay_payment_data_optional(&self) -> Option<&String> {
match self {
Self::Encrypted(encrypted_data) => Some(encrypted_data),
Self::Decrypted(_) => None,
}
}
/// Get the decrypted Apple Pay payment data if it exists
|
{
"chunk": null,
"crate": "domain_types",
"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": 850,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-4017303140956931129_850_50
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/payment_method_data.rs
#[serde(rename_all = "snake_case")]
/// This struct represents the cryptogram data for Apple Pay transactions
pub struct ApplePayCryptogramData {
/// The online payment cryptogram
pub online_payment_cryptogram: Secret<String>,
/// The ECI (Electronic Commerce Indicator) value
pub eci_indicator: Option<String>,
}
#[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, ToSchema)]
#[serde(rename_all = "snake_case")]
#[serde(untagged)]
/// This enum is used to represent the Apple Pay payment data, which can either be encrypted or decrypted.
pub enum ApplePayPaymentData {
/// This variant contains the decrypted Apple Pay payment data as a structured object.
Decrypted(ApplePayPredecryptData),
/// This variant contains the encrypted Apple Pay payment data as a string.
Encrypted(String),
}
impl ApplePayPaymentData {
/// Get the encrypted Apple Pay payment data if it exists
pub fn get_encrypted_apple_pay_payment_data_optional(&self) -> Option<&String> {
match self {
Self::Encrypted(encrypted_data) => Some(encrypted_data),
Self::Decrypted(_) => None,
}
}
/// Get the decrypted Apple Pay payment data if it exists
pub fn get_decrypted_apple_pay_payment_data_optional(&self) -> Option<&ApplePayPredecryptData> {
match self {
Self::Encrypted(_) => None,
Self::Decrypted(decrypted_data) => Some(decrypted_data),
}
}
/// Get the encrypted Apple Pay payment data, returning an error if it does not exist
pub fn get_encrypted_apple_pay_payment_data_mandatory(
&self,
) -> error_stack::Result<&String, ValidationError> {
self.get_encrypted_apple_pay_payment_data_optional()
.get_required_value("Encrypted Apple Pay payment data")
.attach_printable("Encrypted Apple Pay payment data is mandatory")
}
/// Get the decrypted Apple Pay payment data, returning an error if it does not exist
pub fn get_decrypted_apple_pay_payment_data_mandatory(
&self,
) -> error_stack::Result<&ApplePayPredecryptData, ValidationError> {
|
{
"chunk": null,
"crate": "domain_types",
"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": 850,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-4017303140956931129_875_15
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/payment_method_data.rs
Self::Decrypted(_) => None,
}
}
/// Get the decrypted Apple Pay payment data if it exists
pub fn get_decrypted_apple_pay_payment_data_optional(&self) -> Option<&ApplePayPredecryptData> {
match self {
Self::Encrypted(_) => None,
Self::Decrypted(decrypted_data) => Some(decrypted_data),
}
}
/// Get the encrypted Apple Pay payment data, returning an error if it does not exist
pub fn get_encrypted_apple_pay_payment_data_mandatory(
&self,
|
{
"chunk": null,
"crate": "domain_types",
"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": 875,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-4017303140956931129_875_30
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/payment_method_data.rs
Self::Decrypted(_) => None,
}
}
/// Get the decrypted Apple Pay payment data if it exists
pub fn get_decrypted_apple_pay_payment_data_optional(&self) -> Option<&ApplePayPredecryptData> {
match self {
Self::Encrypted(_) => None,
Self::Decrypted(decrypted_data) => Some(decrypted_data),
}
}
/// Get the encrypted Apple Pay payment data, returning an error if it does not exist
pub fn get_encrypted_apple_pay_payment_data_mandatory(
&self,
) -> error_stack::Result<&String, ValidationError> {
self.get_encrypted_apple_pay_payment_data_optional()
.get_required_value("Encrypted Apple Pay payment data")
.attach_printable("Encrypted Apple Pay payment data is mandatory")
}
/// Get the decrypted Apple Pay payment data, returning an error if it does not exist
pub fn get_decrypted_apple_pay_payment_data_mandatory(
&self,
) -> error_stack::Result<&ApplePayPredecryptData, ValidationError> {
self.get_decrypted_apple_pay_payment_data_optional()
.get_required_value("Decrypted Apple Pay payment data")
.attach_printable("Decrypted Apple Pay payment data is mandatory")
}
}
|
{
"chunk": null,
"crate": "domain_types",
"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": 875,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-4017303140956931129_875_50
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/payment_method_data.rs
Self::Decrypted(_) => None,
}
}
/// Get the decrypted Apple Pay payment data if it exists
pub fn get_decrypted_apple_pay_payment_data_optional(&self) -> Option<&ApplePayPredecryptData> {
match self {
Self::Encrypted(_) => None,
Self::Decrypted(decrypted_data) => Some(decrypted_data),
}
}
/// Get the encrypted Apple Pay payment data, returning an error if it does not exist
pub fn get_encrypted_apple_pay_payment_data_mandatory(
&self,
) -> error_stack::Result<&String, ValidationError> {
self.get_encrypted_apple_pay_payment_data_optional()
.get_required_value("Encrypted Apple Pay payment data")
.attach_printable("Encrypted Apple Pay payment data is mandatory")
}
/// Get the decrypted Apple Pay payment data, returning an error if it does not exist
pub fn get_decrypted_apple_pay_payment_data_mandatory(
&self,
) -> error_stack::Result<&ApplePayPredecryptData, ValidationError> {
self.get_decrypted_apple_pay_payment_data_optional()
.get_required_value("Decrypted Apple Pay payment data")
.attach_printable("Decrypted Apple Pay payment data is mandatory")
}
}
impl ApplePayPredecryptData {
/// Get the four-digit expiration year from the Apple Pay pre-decrypt data
pub fn get_two_digit_expiry_year(
&self,
) -> error_stack::Result<Secret<String>, ValidationError> {
let binding = self.application_expiration_year.clone();
let year = binding.peek();
Ok(Secret::new(
year.get(year.len() - 2..)
.ok_or(ValidationError::InvalidValue {
message: "Invalid two-digit year".to_string(),
})?
.to_string(),
))
}
/// Get the four-digit expiration year from the Apple Pay pre-decrypt data
pub fn get_four_digit_expiry_year(&self) -> Secret<String> {
let mut year = self.application_expiration_year.peek().clone();
|
{
"chunk": null,
"crate": "domain_types",
"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": 875,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-4017303140956931129_900_15
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/payment_method_data.rs
self.get_decrypted_apple_pay_payment_data_optional()
.get_required_value("Decrypted Apple Pay payment data")
.attach_printable("Decrypted Apple Pay payment data is mandatory")
}
}
impl ApplePayPredecryptData {
/// Get the four-digit expiration year from the Apple Pay pre-decrypt data
pub fn get_two_digit_expiry_year(
&self,
) -> error_stack::Result<Secret<String>, ValidationError> {
let binding = self.application_expiration_year.clone();
let year = binding.peek();
Ok(Secret::new(
year.get(year.len() - 2..)
|
{
"chunk": null,
"crate": "domain_types",
"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": 900,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-4017303140956931129_900_30
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/payment_method_data.rs
self.get_decrypted_apple_pay_payment_data_optional()
.get_required_value("Decrypted Apple Pay payment data")
.attach_printable("Decrypted Apple Pay payment data is mandatory")
}
}
impl ApplePayPredecryptData {
/// Get the four-digit expiration year from the Apple Pay pre-decrypt data
pub fn get_two_digit_expiry_year(
&self,
) -> error_stack::Result<Secret<String>, ValidationError> {
let binding = self.application_expiration_year.clone();
let year = binding.peek();
Ok(Secret::new(
year.get(year.len() - 2..)
.ok_or(ValidationError::InvalidValue {
message: "Invalid two-digit year".to_string(),
})?
.to_string(),
))
}
/// Get the four-digit expiration year from the Apple Pay pre-decrypt data
pub fn get_four_digit_expiry_year(&self) -> Secret<String> {
let mut year = self.application_expiration_year.peek().clone();
if year.len() == 2 {
year = format!("20{year}");
}
Secret::new(year)
}
|
{
"chunk": null,
"crate": "domain_types",
"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": 900,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-4017303140956931129_900_50
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/payment_method_data.rs
self.get_decrypted_apple_pay_payment_data_optional()
.get_required_value("Decrypted Apple Pay payment data")
.attach_printable("Decrypted Apple Pay payment data is mandatory")
}
}
impl ApplePayPredecryptData {
/// Get the four-digit expiration year from the Apple Pay pre-decrypt data
pub fn get_two_digit_expiry_year(
&self,
) -> error_stack::Result<Secret<String>, ValidationError> {
let binding = self.application_expiration_year.clone();
let year = binding.peek();
Ok(Secret::new(
year.get(year.len() - 2..)
.ok_or(ValidationError::InvalidValue {
message: "Invalid two-digit year".to_string(),
})?
.to_string(),
))
}
/// Get the four-digit expiration year from the Apple Pay pre-decrypt data
pub fn get_four_digit_expiry_year(&self) -> Secret<String> {
let mut year = self.application_expiration_year.peek().clone();
if year.len() == 2 {
year = format!("20{year}");
}
Secret::new(year)
}
/// Get the expiration month from the Apple Pay pre-decrypt data
pub fn get_expiry_month(&self) -> Secret<String> {
self.application_expiration_month.clone()
}
/// Get the expiry date in MMYY format from the Apple Pay pre-decrypt data
pub fn get_expiry_date_as_mmyy(&self) -> error_stack::Result<Secret<String>, ValidationError> {
let year = self.get_two_digit_expiry_year()?.expose();
let month = self.application_expiration_month.clone().expose();
Ok(Secret::new(format!("{month}{year}")))
}
}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct ApplePayWalletData {
/// The payment data of Apple pay
pub payment_data: ApplePayPaymentData,
/// The payment method of Apple pay
pub payment_method: ApplepayPaymentMethod,
|
{
"chunk": null,
"crate": "domain_types",
"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": 900,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-4017303140956931129_925_15
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/payment_method_data.rs
if year.len() == 2 {
year = format!("20{year}");
}
Secret::new(year)
}
/// Get the expiration month from the Apple Pay pre-decrypt data
pub fn get_expiry_month(&self) -> Secret<String> {
self.application_expiration_month.clone()
}
/// Get the expiry date in MMYY format from the Apple Pay pre-decrypt data
pub fn get_expiry_date_as_mmyy(&self) -> error_stack::Result<Secret<String>, ValidationError> {
let year = self.get_two_digit_expiry_year()?.expose();
let month = self.application_expiration_month.clone().expose();
|
{
"chunk": null,
"crate": "domain_types",
"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": 925,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-4017303140956931129_925_30
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/payment_method_data.rs
if year.len() == 2 {
year = format!("20{year}");
}
Secret::new(year)
}
/// Get the expiration month from the Apple Pay pre-decrypt data
pub fn get_expiry_month(&self) -> Secret<String> {
self.application_expiration_month.clone()
}
/// Get the expiry date in MMYY format from the Apple Pay pre-decrypt data
pub fn get_expiry_date_as_mmyy(&self) -> error_stack::Result<Secret<String>, ValidationError> {
let year = self.get_two_digit_expiry_year()?.expose();
let month = self.application_expiration_month.clone().expose();
Ok(Secret::new(format!("{month}{year}")))
}
}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct ApplePayWalletData {
/// The payment data of Apple pay
pub payment_data: ApplePayPaymentData,
/// The payment method of Apple pay
pub payment_method: ApplepayPaymentMethod,
/// The unique identifier for the transaction
pub transaction_identifier: String,
}
impl ApplePayWalletData {
|
{
"chunk": null,
"crate": "domain_types",
"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": 925,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-4017303140956931129_925_50
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/payment_method_data.rs
if year.len() == 2 {
year = format!("20{year}");
}
Secret::new(year)
}
/// Get the expiration month from the Apple Pay pre-decrypt data
pub fn get_expiry_month(&self) -> Secret<String> {
self.application_expiration_month.clone()
}
/// Get the expiry date in MMYY format from the Apple Pay pre-decrypt data
pub fn get_expiry_date_as_mmyy(&self) -> error_stack::Result<Secret<String>, ValidationError> {
let year = self.get_two_digit_expiry_year()?.expose();
let month = self.application_expiration_month.clone().expose();
Ok(Secret::new(format!("{month}{year}")))
}
}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct ApplePayWalletData {
/// The payment data of Apple pay
pub payment_data: ApplePayPaymentData,
/// The payment method of Apple pay
pub payment_method: ApplepayPaymentMethod,
/// The unique identifier for the transaction
pub transaction_identifier: String,
}
impl ApplePayWalletData {
pub fn get_applepay_decoded_payment_data(&self) -> Result<Secret<String>, Error> {
let apple_pay_encrypted_data = self
.payment_data
.get_encrypted_apple_pay_payment_data_mandatory()
.change_context(crate::errors::ConnectorError::MissingRequiredField {
field_name: "Apple pay encrypted data",
})?;
let token = Secret::new(
String::from_utf8(
base64::engine::general_purpose::STANDARD
.decode(apple_pay_encrypted_data)
.change_context(crate::errors::ConnectorError::InvalidWalletToken {
wallet_name: "Apple Pay".to_string(),
})?,
)
.change_context(crate::errors::ConnectorError::InvalidWalletToken {
wallet_name: "Apple Pay".to_string(),
})?,
);
Ok(token)
|
{
"chunk": null,
"crate": "domain_types",
"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": 925,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-4017303140956931129_950_15
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/payment_method_data.rs
/// The unique identifier for the transaction
pub transaction_identifier: String,
}
impl ApplePayWalletData {
pub fn get_applepay_decoded_payment_data(&self) -> Result<Secret<String>, Error> {
let apple_pay_encrypted_data = self
.payment_data
.get_encrypted_apple_pay_payment_data_mandatory()
.change_context(crate::errors::ConnectorError::MissingRequiredField {
field_name: "Apple pay encrypted data",
})?;
let token = Secret::new(
String::from_utf8(
base64::engine::general_purpose::STANDARD
|
{
"chunk": null,
"crate": "domain_types",
"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": 950,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-4017303140956931129_950_30
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/payment_method_data.rs
/// The unique identifier for the transaction
pub transaction_identifier: String,
}
impl ApplePayWalletData {
pub fn get_applepay_decoded_payment_data(&self) -> Result<Secret<String>, Error> {
let apple_pay_encrypted_data = self
.payment_data
.get_encrypted_apple_pay_payment_data_mandatory()
.change_context(crate::errors::ConnectorError::MissingRequiredField {
field_name: "Apple pay encrypted data",
})?;
let token = Secret::new(
String::from_utf8(
base64::engine::general_purpose::STANDARD
.decode(apple_pay_encrypted_data)
.change_context(crate::errors::ConnectorError::InvalidWalletToken {
wallet_name: "Apple Pay".to_string(),
})?,
)
.change_context(crate::errors::ConnectorError::InvalidWalletToken {
wallet_name: "Apple Pay".to_string(),
})?,
);
Ok(token)
}
}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize)]
pub struct GoPayRedirection {}
|
{
"chunk": null,
"crate": "domain_types",
"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": 950,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-4017303140956931129_950_50
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/payment_method_data.rs
/// The unique identifier for the transaction
pub transaction_identifier: String,
}
impl ApplePayWalletData {
pub fn get_applepay_decoded_payment_data(&self) -> Result<Secret<String>, Error> {
let apple_pay_encrypted_data = self
.payment_data
.get_encrypted_apple_pay_payment_data_mandatory()
.change_context(crate::errors::ConnectorError::MissingRequiredField {
field_name: "Apple pay encrypted data",
})?;
let token = Secret::new(
String::from_utf8(
base64::engine::general_purpose::STANDARD
.decode(apple_pay_encrypted_data)
.change_context(crate::errors::ConnectorError::InvalidWalletToken {
wallet_name: "Apple Pay".to_string(),
})?,
)
.change_context(crate::errors::ConnectorError::InvalidWalletToken {
wallet_name: "Apple Pay".to_string(),
})?,
);
Ok(token)
}
}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize)]
pub struct GoPayRedirection {}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize)]
pub struct GcashRedirection {}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize)]
pub struct MobilePayRedirection {}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize)]
pub struct MbWayRedirection {}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize)]
pub struct KakaoPayRedirection {}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize)]
pub struct MomoRedirection {}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize)]
pub struct AliPayHkRedirection {}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize)]
|
{
"chunk": null,
"crate": "domain_types",
"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": 950,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-4017303140956931129_975_15
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/payment_method_data.rs
}
}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize)]
pub struct GoPayRedirection {}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize)]
pub struct GcashRedirection {}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize)]
pub struct MobilePayRedirection {}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize)]
pub struct MbWayRedirection {}
|
{
"chunk": null,
"crate": "domain_types",
"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": 975,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-4017303140956931129_975_30
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/payment_method_data.rs
}
}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize)]
pub struct GoPayRedirection {}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize)]
pub struct GcashRedirection {}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize)]
pub struct MobilePayRedirection {}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize)]
pub struct MbWayRedirection {}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize)]
pub struct KakaoPayRedirection {}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize)]
pub struct MomoRedirection {}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize)]
pub struct AliPayHkRedirection {}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize)]
pub struct AliPayRedirection {}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize)]
pub struct AliPayQr {}
|
{
"chunk": null,
"crate": "domain_types",
"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": 975,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-4017303140956931129_975_50
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/payment_method_data.rs
}
}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize)]
pub struct GoPayRedirection {}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize)]
pub struct GcashRedirection {}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize)]
pub struct MobilePayRedirection {}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize)]
pub struct MbWayRedirection {}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize)]
pub struct KakaoPayRedirection {}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize)]
pub struct MomoRedirection {}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize)]
pub struct AliPayHkRedirection {}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize)]
pub struct AliPayRedirection {}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize)]
pub struct AliPayQr {}
#[derive(Eq, PartialEq, Clone, Debug, Serialize, Deserialize)]
pub enum CardRedirectData {
Knet {},
Benefit {},
MomoAtm {},
CardRedirect {},
}
#[derive(Eq, PartialEq, Clone, Debug, Serialize, Deserialize, Default)]
pub struct CardDetailsForNetworkTransactionId {
pub card_number: cards::CardNumber,
pub card_exp_month: Secret<String>,
pub card_exp_year: Secret<String>,
pub card_issuer: Option<String>,
pub card_network: Option<common_enums::CardNetwork>,
pub card_type: Option<String>,
pub card_issuing_country: Option<String>,
pub bank_code: Option<String>,
pub nick_name: Option<Secret<String>>,
pub card_holder_name: Option<Secret<String>>,
|
{
"chunk": null,
"crate": "domain_types",
"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": 975,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-4017303140956931129_1000_15
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/payment_method_data.rs
pub struct AliPayRedirection {}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize)]
pub struct AliPayQr {}
#[derive(Eq, PartialEq, Clone, Debug, Serialize, Deserialize)]
pub enum CardRedirectData {
Knet {},
Benefit {},
MomoAtm {},
CardRedirect {},
}
#[derive(Eq, PartialEq, Clone, Debug, Serialize, Deserialize, Default)]
pub struct CardDetailsForNetworkTransactionId {
|
{
"chunk": null,
"crate": "domain_types",
"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": 1000,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-4017303140956931129_1000_30
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/payment_method_data.rs
pub struct AliPayRedirection {}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize)]
pub struct AliPayQr {}
#[derive(Eq, PartialEq, Clone, Debug, Serialize, Deserialize)]
pub enum CardRedirectData {
Knet {},
Benefit {},
MomoAtm {},
CardRedirect {},
}
#[derive(Eq, PartialEq, Clone, Debug, Serialize, Deserialize, Default)]
pub struct CardDetailsForNetworkTransactionId {
pub card_number: cards::CardNumber,
pub card_exp_month: Secret<String>,
pub card_exp_year: Secret<String>,
pub card_issuer: Option<String>,
pub card_network: Option<common_enums::CardNetwork>,
pub card_type: Option<String>,
pub card_issuing_country: Option<String>,
pub bank_code: Option<String>,
pub nick_name: Option<Secret<String>>,
pub card_holder_name: Option<Secret<String>>,
}
impl CardDetailsForNetworkTransactionId {
pub fn get_card_expiry_year_2_digit(
&self,
|
{
"chunk": null,
"crate": "domain_types",
"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": 1000,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-4017303140956931129_1000_50
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/payment_method_data.rs
pub struct AliPayRedirection {}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize)]
pub struct AliPayQr {}
#[derive(Eq, PartialEq, Clone, Debug, Serialize, Deserialize)]
pub enum CardRedirectData {
Knet {},
Benefit {},
MomoAtm {},
CardRedirect {},
}
#[derive(Eq, PartialEq, Clone, Debug, Serialize, Deserialize, Default)]
pub struct CardDetailsForNetworkTransactionId {
pub card_number: cards::CardNumber,
pub card_exp_month: Secret<String>,
pub card_exp_year: Secret<String>,
pub card_issuer: Option<String>,
pub card_network: Option<common_enums::CardNetwork>,
pub card_type: Option<String>,
pub card_issuing_country: Option<String>,
pub bank_code: Option<String>,
pub nick_name: Option<Secret<String>>,
pub card_holder_name: Option<Secret<String>>,
}
impl CardDetailsForNetworkTransactionId {
pub fn get_card_expiry_year_2_digit(
&self,
) -> Result<Secret<String>, crate::errors::ConnectorError> {
let binding = self.card_exp_year.clone();
let year = binding.peek();
Ok(Secret::new(
year.get(year.len() - 2..)
.ok_or(crate::errors::ConnectorError::RequestEncodingFailed)?
.to_string(),
))
}
pub fn get_card_issuer(&self) -> Result<CardIssuer, Error> {
get_card_issuer(self.card_number.peek())
}
pub fn get_card_expiry_month_year_2_digit_with_delimiter(
&self,
delimiter: String,
) -> Result<Secret<String>, crate::errors::ConnectorError> {
let year = self.get_card_expiry_year_2_digit()?;
Ok(Secret::new(format!(
"{}{}{}",
self.card_exp_month.peek(),
|
{
"chunk": null,
"crate": "domain_types",
"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": 1000,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-4017303140956931129_1025_15
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/payment_method_data.rs
}
impl CardDetailsForNetworkTransactionId {
pub fn get_card_expiry_year_2_digit(
&self,
) -> Result<Secret<String>, crate::errors::ConnectorError> {
let binding = self.card_exp_year.clone();
let year = binding.peek();
Ok(Secret::new(
year.get(year.len() - 2..)
.ok_or(crate::errors::ConnectorError::RequestEncodingFailed)?
.to_string(),
))
}
pub fn get_card_issuer(&self) -> Result<CardIssuer, Error> {
|
{
"chunk": null,
"crate": "domain_types",
"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": 1025,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-4017303140956931129_1025_30
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/payment_method_data.rs
}
impl CardDetailsForNetworkTransactionId {
pub fn get_card_expiry_year_2_digit(
&self,
) -> Result<Secret<String>, crate::errors::ConnectorError> {
let binding = self.card_exp_year.clone();
let year = binding.peek();
Ok(Secret::new(
year.get(year.len() - 2..)
.ok_or(crate::errors::ConnectorError::RequestEncodingFailed)?
.to_string(),
))
}
pub fn get_card_issuer(&self) -> Result<CardIssuer, Error> {
get_card_issuer(self.card_number.peek())
}
pub fn get_card_expiry_month_year_2_digit_with_delimiter(
&self,
delimiter: String,
) -> Result<Secret<String>, crate::errors::ConnectorError> {
let year = self.get_card_expiry_year_2_digit()?;
Ok(Secret::new(format!(
"{}{}{}",
self.card_exp_month.peek(),
delimiter,
year.peek()
)))
}
pub fn get_expiry_date_as_yyyymm(&self, delimiter: &str) -> Secret<String> {
|
{
"chunk": null,
"crate": "domain_types",
"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": 1025,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-4017303140956931129_1025_50
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/payment_method_data.rs
}
impl CardDetailsForNetworkTransactionId {
pub fn get_card_expiry_year_2_digit(
&self,
) -> Result<Secret<String>, crate::errors::ConnectorError> {
let binding = self.card_exp_year.clone();
let year = binding.peek();
Ok(Secret::new(
year.get(year.len() - 2..)
.ok_or(crate::errors::ConnectorError::RequestEncodingFailed)?
.to_string(),
))
}
pub fn get_card_issuer(&self) -> Result<CardIssuer, Error> {
get_card_issuer(self.card_number.peek())
}
pub fn get_card_expiry_month_year_2_digit_with_delimiter(
&self,
delimiter: String,
) -> Result<Secret<String>, crate::errors::ConnectorError> {
let year = self.get_card_expiry_year_2_digit()?;
Ok(Secret::new(format!(
"{}{}{}",
self.card_exp_month.peek(),
delimiter,
year.peek()
)))
}
pub fn get_expiry_date_as_yyyymm(&self, delimiter: &str) -> Secret<String> {
let year = self.get_expiry_year_4_digit();
Secret::new(format!(
"{}{}{}",
year.peek(),
delimiter,
self.card_exp_month.peek()
))
}
pub fn get_expiry_date_as_mmyyyy(&self, delimiter: &str) -> Secret<String> {
let year = self.get_expiry_year_4_digit();
Secret::new(format!(
"{}{}{}",
self.card_exp_month.peek(),
delimiter,
year.peek()
))
}
pub fn get_expiry_year_4_digit(&self) -> Secret<String> {
let mut year = self.card_exp_year.peek().clone();
if year.len() == 2 {
|
{
"chunk": null,
"crate": "domain_types",
"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": 1025,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-4017303140956931129_1050_15
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/payment_method_data.rs
delimiter,
year.peek()
)))
}
pub fn get_expiry_date_as_yyyymm(&self, delimiter: &str) -> Secret<String> {
let year = self.get_expiry_year_4_digit();
Secret::new(format!(
"{}{}{}",
year.peek(),
delimiter,
self.card_exp_month.peek()
))
}
pub fn get_expiry_date_as_mmyyyy(&self, delimiter: &str) -> Secret<String> {
let year = self.get_expiry_year_4_digit();
|
{
"chunk": null,
"crate": "domain_types",
"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": 1050,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-4017303140956931129_1050_30
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/payment_method_data.rs
delimiter,
year.peek()
)))
}
pub fn get_expiry_date_as_yyyymm(&self, delimiter: &str) -> Secret<String> {
let year = self.get_expiry_year_4_digit();
Secret::new(format!(
"{}{}{}",
year.peek(),
delimiter,
self.card_exp_month.peek()
))
}
pub fn get_expiry_date_as_mmyyyy(&self, delimiter: &str) -> Secret<String> {
let year = self.get_expiry_year_4_digit();
Secret::new(format!(
"{}{}{}",
self.card_exp_month.peek(),
delimiter,
year.peek()
))
}
pub fn get_expiry_year_4_digit(&self) -> Secret<String> {
let mut year = self.card_exp_year.peek().clone();
if year.len() == 2 {
year = format!("20{year}");
}
Secret::new(year)
}
pub fn get_expiry_date_as_yymm(&self) -> Result<Secret<String>, crate::errors::ConnectorError> {
|
{
"chunk": null,
"crate": "domain_types",
"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": 1050,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-4017303140956931129_1050_50
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/payment_method_data.rs
delimiter,
year.peek()
)))
}
pub fn get_expiry_date_as_yyyymm(&self, delimiter: &str) -> Secret<String> {
let year = self.get_expiry_year_4_digit();
Secret::new(format!(
"{}{}{}",
year.peek(),
delimiter,
self.card_exp_month.peek()
))
}
pub fn get_expiry_date_as_mmyyyy(&self, delimiter: &str) -> Secret<String> {
let year = self.get_expiry_year_4_digit();
Secret::new(format!(
"{}{}{}",
self.card_exp_month.peek(),
delimiter,
year.peek()
))
}
pub fn get_expiry_year_4_digit(&self) -> Secret<String> {
let mut year = self.card_exp_year.peek().clone();
if year.len() == 2 {
year = format!("20{year}");
}
Secret::new(year)
}
pub fn get_expiry_date_as_yymm(&self) -> Result<Secret<String>, crate::errors::ConnectorError> {
let year = self.get_card_expiry_year_2_digit()?.expose();
let month = self.card_exp_month.clone().expose();
Ok(Secret::new(format!("{year}{month}")))
}
pub fn get_expiry_month_as_i8(&self) -> Result<Secret<i8>, Error> {
self.card_exp_month
.peek()
.clone()
.parse::<i8>()
.change_context(crate::errors::ConnectorError::ResponseDeserializationFailed)
.map(Secret::new)
}
pub fn get_expiry_year_as_i32(&self) -> Result<Secret<i32>, Error> {
self.card_exp_year
.peek()
.clone()
.parse::<i32>()
.change_context(crate::errors::ConnectorError::ResponseDeserializationFailed)
.map(Secret::new)
}
|
{
"chunk": null,
"crate": "domain_types",
"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": 1050,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-4017303140956931129_1075_15
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/payment_method_data.rs
year = format!("20{year}");
}
Secret::new(year)
}
pub fn get_expiry_date_as_yymm(&self) -> Result<Secret<String>, crate::errors::ConnectorError> {
let year = self.get_card_expiry_year_2_digit()?.expose();
let month = self.card_exp_month.clone().expose();
Ok(Secret::new(format!("{year}{month}")))
}
pub fn get_expiry_month_as_i8(&self) -> Result<Secret<i8>, Error> {
self.card_exp_month
.peek()
.clone()
.parse::<i8>()
.change_context(crate::errors::ConnectorError::ResponseDeserializationFailed)
|
{
"chunk": null,
"crate": "domain_types",
"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": 1075,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-4017303140956931129_1075_30
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/payment_method_data.rs
year = format!("20{year}");
}
Secret::new(year)
}
pub fn get_expiry_date_as_yymm(&self) -> Result<Secret<String>, crate::errors::ConnectorError> {
let year = self.get_card_expiry_year_2_digit()?.expose();
let month = self.card_exp_month.clone().expose();
Ok(Secret::new(format!("{year}{month}")))
}
pub fn get_expiry_month_as_i8(&self) -> Result<Secret<i8>, Error> {
self.card_exp_month
.peek()
.clone()
.parse::<i8>()
.change_context(crate::errors::ConnectorError::ResponseDeserializationFailed)
.map(Secret::new)
}
pub fn get_expiry_year_as_i32(&self) -> Result<Secret<i32>, Error> {
self.card_exp_year
.peek()
.clone()
.parse::<i32>()
.change_context(crate::errors::ConnectorError::ResponseDeserializationFailed)
.map(Secret::new)
}
}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
#[serde(rename_all = "snake_case")]
pub struct SamsungPayWebWalletData {
|
{
"chunk": null,
"crate": "domain_types",
"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": 1075,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-4017303140956931129_1075_50
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/payment_method_data.rs
year = format!("20{year}");
}
Secret::new(year)
}
pub fn get_expiry_date_as_yymm(&self) -> Result<Secret<String>, crate::errors::ConnectorError> {
let year = self.get_card_expiry_year_2_digit()?.expose();
let month = self.card_exp_month.clone().expose();
Ok(Secret::new(format!("{year}{month}")))
}
pub fn get_expiry_month_as_i8(&self) -> Result<Secret<i8>, Error> {
self.card_exp_month
.peek()
.clone()
.parse::<i8>()
.change_context(crate::errors::ConnectorError::ResponseDeserializationFailed)
.map(Secret::new)
}
pub fn get_expiry_year_as_i32(&self) -> Result<Secret<i32>, Error> {
self.card_exp_year
.peek()
.clone()
.parse::<i32>()
.change_context(crate::errors::ConnectorError::ResponseDeserializationFailed)
.map(Secret::new)
}
}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
#[serde(rename_all = "snake_case")]
pub struct SamsungPayWebWalletData {
/// Specifies authentication method used
pub method: Option<String>,
/// Value if credential is enabled for recurring payment
pub recurring_payment: Option<bool>,
/// Brand of the payment card
pub card_brand: SamsungPayCardBrand,
/// Last 4 digits of the card number
#[serde(rename = "card_last4digits")]
pub card_last_four_digits: String,
/// Samsung Pay token data
#[serde(rename = "3_d_s")]
pub token_data: SamsungPayTokenData,
}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct AmazonPayRedirectData {}
#[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize)]
pub struct CoBadgedCardData {
pub co_badged_card_networks: Vec<CardNetwork>,
|
{
"chunk": null,
"crate": "domain_types",
"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": 1075,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-4017303140956931129_1100_15
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/payment_method_data.rs
}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
#[serde(rename_all = "snake_case")]
pub struct SamsungPayWebWalletData {
/// Specifies authentication method used
pub method: Option<String>,
/// Value if credential is enabled for recurring payment
pub recurring_payment: Option<bool>,
/// Brand of the payment card
pub card_brand: SamsungPayCardBrand,
/// Last 4 digits of the card number
#[serde(rename = "card_last4digits")]
pub card_last_four_digits: String,
/// Samsung Pay token data
|
{
"chunk": null,
"crate": "domain_types",
"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": 1100,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-4017303140956931129_1100_30
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/payment_method_data.rs
}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
#[serde(rename_all = "snake_case")]
pub struct SamsungPayWebWalletData {
/// Specifies authentication method used
pub method: Option<String>,
/// Value if credential is enabled for recurring payment
pub recurring_payment: Option<bool>,
/// Brand of the payment card
pub card_brand: SamsungPayCardBrand,
/// Last 4 digits of the card number
#[serde(rename = "card_last4digits")]
pub card_last_four_digits: String,
/// Samsung Pay token data
#[serde(rename = "3_d_s")]
pub token_data: SamsungPayTokenData,
}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct AmazonPayRedirectData {}
#[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize)]
pub struct CoBadgedCardData {
pub co_badged_card_networks: Vec<CardNetwork>,
pub issuer_country_code: CountryAlpha2,
pub is_regulated: bool,
pub regulated_name: Option<RegulatedName>,
}
|
{
"chunk": null,
"crate": "domain_types",
"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": 1100,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-4017303140956931129_1100_50
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/payment_method_data.rs
}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
#[serde(rename_all = "snake_case")]
pub struct SamsungPayWebWalletData {
/// Specifies authentication method used
pub method: Option<String>,
/// Value if credential is enabled for recurring payment
pub recurring_payment: Option<bool>,
/// Brand of the payment card
pub card_brand: SamsungPayCardBrand,
/// Last 4 digits of the card number
#[serde(rename = "card_last4digits")]
pub card_last_four_digits: String,
/// Samsung Pay token data
#[serde(rename = "3_d_s")]
pub token_data: SamsungPayTokenData,
}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct AmazonPayRedirectData {}
#[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize)]
pub struct CoBadgedCardData {
pub co_badged_card_networks: Vec<CardNetwork>,
pub issuer_country_code: CountryAlpha2,
pub is_regulated: bool,
pub regulated_name: Option<RegulatedName>,
}
#[derive(
Debug,
serde::Deserialize,
serde::Serialize,
Clone,
ToSchema,
strum::EnumString,
strum::Display,
Eq,
PartialEq,
)]
#[serde(rename_all = "snake_case")]
pub enum CardType {
Credit,
Debit,
}
#[derive(Clone, Debug, Eq, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct BankTransferNextStepsData {
/// The instructions for performing a bank transfer
|
{
"chunk": null,
"crate": "domain_types",
"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": 1100,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-4017303140956931129_1125_15
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/payment_method_data.rs
pub issuer_country_code: CountryAlpha2,
pub is_regulated: bool,
pub regulated_name: Option<RegulatedName>,
}
#[derive(
Debug,
serde::Deserialize,
serde::Serialize,
Clone,
ToSchema,
strum::EnumString,
strum::Display,
Eq,
PartialEq,
|
{
"chunk": null,
"crate": "domain_types",
"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": 1125,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-4017303140956931129_1125_30
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/payment_method_data.rs
pub issuer_country_code: CountryAlpha2,
pub is_regulated: bool,
pub regulated_name: Option<RegulatedName>,
}
#[derive(
Debug,
serde::Deserialize,
serde::Serialize,
Clone,
ToSchema,
strum::EnumString,
strum::Display,
Eq,
PartialEq,
)]
#[serde(rename_all = "snake_case")]
pub enum CardType {
Credit,
Debit,
}
#[derive(Clone, Debug, Eq, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct BankTransferNextStepsData {
/// The instructions for performing a bank transfer
#[serde(flatten)]
pub bank_transfer_instructions: BankTransferInstructions,
/// The details received by the receiver
pub receiver: Option<ReceiverDetails>,
}
|
{
"chunk": null,
"crate": "domain_types",
"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": 1125,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-4017303140956931129_1125_50
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/payment_method_data.rs
pub issuer_country_code: CountryAlpha2,
pub is_regulated: bool,
pub regulated_name: Option<RegulatedName>,
}
#[derive(
Debug,
serde::Deserialize,
serde::Serialize,
Clone,
ToSchema,
strum::EnumString,
strum::Display,
Eq,
PartialEq,
)]
#[serde(rename_all = "snake_case")]
pub enum CardType {
Credit,
Debit,
}
#[derive(Clone, Debug, Eq, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct BankTransferNextStepsData {
/// The instructions for performing a bank transfer
#[serde(flatten)]
pub bank_transfer_instructions: BankTransferInstructions,
/// The details received by the receiver
pub receiver: Option<ReceiverDetails>,
}
#[derive(Clone, Debug, Eq, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum BankTransferInstructions {
/// The credit transfer for ACH transactions
AchCreditTransfer(Box<AchTransfer>),
/// The instructions for Multibanco bank transactions
Multibanco(Box<MultibancoTransferInstructions>),
}
#[derive(Clone, Debug, Eq, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct AchTransfer {
pub account_number: Secret<String>,
pub bank_name: String,
pub routing_number: Secret<String>,
pub swift_code: Secret<String>,
}
#[derive(Clone, Debug, Eq, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct MultibancoTransferInstructions {
|
{
"chunk": null,
"crate": "domain_types",
"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": 1125,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-4017303140956931129_1150_15
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/payment_method_data.rs
#[serde(flatten)]
pub bank_transfer_instructions: BankTransferInstructions,
/// The details received by the receiver
pub receiver: Option<ReceiverDetails>,
}
#[derive(Clone, Debug, Eq, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum BankTransferInstructions {
/// The credit transfer for ACH transactions
AchCreditTransfer(Box<AchTransfer>),
/// The instructions for Multibanco bank transactions
Multibanco(Box<MultibancoTransferInstructions>),
}
|
{
"chunk": null,
"crate": "domain_types",
"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": 1150,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-4017303140956931129_1150_30
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/payment_method_data.rs
#[serde(flatten)]
pub bank_transfer_instructions: BankTransferInstructions,
/// The details received by the receiver
pub receiver: Option<ReceiverDetails>,
}
#[derive(Clone, Debug, Eq, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum BankTransferInstructions {
/// The credit transfer for ACH transactions
AchCreditTransfer(Box<AchTransfer>),
/// The instructions for Multibanco bank transactions
Multibanco(Box<MultibancoTransferInstructions>),
}
#[derive(Clone, Debug, Eq, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct AchTransfer {
pub account_number: Secret<String>,
pub bank_name: String,
pub routing_number: Secret<String>,
pub swift_code: Secret<String>,
}
#[derive(Clone, Debug, Eq, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct MultibancoTransferInstructions {
pub reference: Secret<String>,
pub entity: String,
}
#[derive(Clone, Debug, Eq, PartialEq, serde::Serialize, serde::Deserialize)]
|
{
"chunk": null,
"crate": "domain_types",
"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": 1150,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-4017303140956931129_1150_50
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/payment_method_data.rs
#[serde(flatten)]
pub bank_transfer_instructions: BankTransferInstructions,
/// The details received by the receiver
pub receiver: Option<ReceiverDetails>,
}
#[derive(Clone, Debug, Eq, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum BankTransferInstructions {
/// The credit transfer for ACH transactions
AchCreditTransfer(Box<AchTransfer>),
/// The instructions for Multibanco bank transactions
Multibanco(Box<MultibancoTransferInstructions>),
}
#[derive(Clone, Debug, Eq, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct AchTransfer {
pub account_number: Secret<String>,
pub bank_name: String,
pub routing_number: Secret<String>,
pub swift_code: Secret<String>,
}
#[derive(Clone, Debug, Eq, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct MultibancoTransferInstructions {
pub reference: Secret<String>,
pub entity: String,
}
#[derive(Clone, Debug, Eq, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct ReceiverDetails {
/// The amount received by receiver
amount_received: i64,
/// The amount charged by ACH
amount_charged: Option<i64>,
/// The amount remaining to be sent via ACH
amount_remaining: Option<i64>,
}
|
{
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 38,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 1150,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-4017303140956931129_1175_15
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/payment_method_data.rs
pub reference: Secret<String>,
pub entity: String,
}
#[derive(Clone, Debug, Eq, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct ReceiverDetails {
/// The amount received by receiver
amount_received: i64,
/// The amount charged by ACH
amount_charged: Option<i64>,
/// The amount remaining to be sent via ACH
amount_remaining: Option<i64>,
}
|
{
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 13,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 1175,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-4017303140956931129_1175_30
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/payment_method_data.rs
pub reference: Secret<String>,
pub entity: String,
}
#[derive(Clone, Debug, Eq, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct ReceiverDetails {
/// The amount received by receiver
amount_received: i64,
/// The amount charged by ACH
amount_charged: Option<i64>,
/// The amount remaining to be sent via ACH
amount_remaining: Option<i64>,
}
|
{
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 13,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 1175,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-4017303140956931129_1175_50
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/payment_method_data.rs
pub reference: Secret<String>,
pub entity: String,
}
#[derive(Clone, Debug, Eq, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct ReceiverDetails {
/// The amount received by receiver
amount_received: i64,
/// The amount charged by ACH
amount_charged: Option<i64>,
/// The amount remaining to be sent via ACH
amount_remaining: Option<i64>,
}
|
{
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 13,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": 1175,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-9203487555415585328_0_15
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/mandates.rs
use common_enums::Currency;
use common_utils::{date_time, pii::IpAddress, SecretSerdeValue};
use error_stack::ResultExt;
use hyperswitch_masking::Secret;
use time::PrimitiveDateTime;
use crate::utils::{missing_field_err, Error};
#[derive(Default, Eq, PartialEq, Debug, Clone, serde::Deserialize, serde::Serialize)]
pub struct CustomerAcceptance {
/// Type of acceptance provided by the
pub acceptance_type: AcceptanceType,
/// Specifying when the customer acceptance was provided
#[serde(with = "common_utils::custom_serde::iso8601::option")]
pub accepted_at: Option<PrimitiveDateTime>,
|
{
"chunk": null,
"crate": "domain_types",
"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_-9203487555415585328_0_30
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/mandates.rs
use common_enums::Currency;
use common_utils::{date_time, pii::IpAddress, SecretSerdeValue};
use error_stack::ResultExt;
use hyperswitch_masking::Secret;
use time::PrimitiveDateTime;
use crate::utils::{missing_field_err, Error};
#[derive(Default, Eq, PartialEq, Debug, Clone, serde::Deserialize, serde::Serialize)]
pub struct CustomerAcceptance {
/// Type of acceptance provided by the
pub acceptance_type: AcceptanceType,
/// Specifying when the customer acceptance was provided
#[serde(with = "common_utils::custom_serde::iso8601::option")]
pub accepted_at: Option<PrimitiveDateTime>,
/// Information required for online mandate generation
pub online: Option<OnlineMandate>,
}
#[derive(Default, Eq, PartialEq, Debug, Clone, serde::Deserialize, serde::Serialize)]
pub struct OnlineMandate {
/// Ip address of the customer machine from which the mandate was created
#[serde(skip_deserializing)]
pub ip_address: Option<Secret<String, IpAddress>>,
/// The user-agent of the customer's browser
pub user_agent: String,
}
#[derive(Default, Eq, PartialEq, Debug, Clone, serde::Serialize)]
pub struct MandateData {
|
{
"chunk": null,
"crate": "domain_types",
"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_-9203487555415585328_0_50
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/mandates.rs
use common_enums::Currency;
use common_utils::{date_time, pii::IpAddress, SecretSerdeValue};
use error_stack::ResultExt;
use hyperswitch_masking::Secret;
use time::PrimitiveDateTime;
use crate::utils::{missing_field_err, Error};
#[derive(Default, Eq, PartialEq, Debug, Clone, serde::Deserialize, serde::Serialize)]
pub struct CustomerAcceptance {
/// Type of acceptance provided by the
pub acceptance_type: AcceptanceType,
/// Specifying when the customer acceptance was provided
#[serde(with = "common_utils::custom_serde::iso8601::option")]
pub accepted_at: Option<PrimitiveDateTime>,
/// Information required for online mandate generation
pub online: Option<OnlineMandate>,
}
#[derive(Default, Eq, PartialEq, Debug, Clone, serde::Deserialize, serde::Serialize)]
pub struct OnlineMandate {
/// Ip address of the customer machine from which the mandate was created
#[serde(skip_deserializing)]
pub ip_address: Option<Secret<String, IpAddress>>,
/// The user-agent of the customer's browser
pub user_agent: String,
}
#[derive(Default, Eq, PartialEq, Debug, Clone, serde::Serialize)]
pub struct MandateData {
/// A way to update the mandate's payment method details
pub update_mandate_id: Option<String>,
/// A consent from the customer to store the payment method
pub customer_acceptance: Option<CustomerAcceptance>,
/// A way to select the type of mandate used
pub mandate_type: Option<MandateDataType>,
}
#[derive(Default, Debug, PartialEq, Eq, Clone, serde::Deserialize, serde::Serialize)]
#[serde(rename_all = "lowercase")]
pub enum AcceptanceType {
Online,
#[default]
Offline,
}
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
#[serde(rename_all = "snake_case")]
pub enum MandateDataType {
SingleUse(MandateAmountData),
|
{
"chunk": null,
"crate": "domain_types",
"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_-9203487555415585328_25_15
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/mandates.rs
pub user_agent: String,
}
#[derive(Default, Eq, PartialEq, Debug, Clone, serde::Serialize)]
pub struct MandateData {
/// A way to update the mandate's payment method details
pub update_mandate_id: Option<String>,
/// A consent from the customer to store the payment method
pub customer_acceptance: Option<CustomerAcceptance>,
/// A way to select the type of mandate used
pub mandate_type: Option<MandateDataType>,
}
#[derive(Default, Debug, PartialEq, Eq, Clone, serde::Deserialize, serde::Serialize)]
#[serde(rename_all = "lowercase")]
|
{
"chunk": null,
"crate": "domain_types",
"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_-9203487555415585328_25_30
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/mandates.rs
pub user_agent: String,
}
#[derive(Default, Eq, PartialEq, Debug, Clone, serde::Serialize)]
pub struct MandateData {
/// A way to update the mandate's payment method details
pub update_mandate_id: Option<String>,
/// A consent from the customer to store the payment method
pub customer_acceptance: Option<CustomerAcceptance>,
/// A way to select the type of mandate used
pub mandate_type: Option<MandateDataType>,
}
#[derive(Default, Debug, PartialEq, Eq, Clone, serde::Deserialize, serde::Serialize)]
#[serde(rename_all = "lowercase")]
pub enum AcceptanceType {
Online,
#[default]
Offline,
}
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
#[serde(rename_all = "snake_case")]
pub enum MandateDataType {
SingleUse(MandateAmountData),
MultiUse(Option<MandateAmountData>),
}
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize, PartialEq, Eq)]
pub struct MandateAmountData {
|
{
"chunk": null,
"crate": "domain_types",
"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_-9203487555415585328_25_50
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/mandates.rs
pub user_agent: String,
}
#[derive(Default, Eq, PartialEq, Debug, Clone, serde::Serialize)]
pub struct MandateData {
/// A way to update the mandate's payment method details
pub update_mandate_id: Option<String>,
/// A consent from the customer to store the payment method
pub customer_acceptance: Option<CustomerAcceptance>,
/// A way to select the type of mandate used
pub mandate_type: Option<MandateDataType>,
}
#[derive(Default, Debug, PartialEq, Eq, Clone, serde::Deserialize, serde::Serialize)]
#[serde(rename_all = "lowercase")]
pub enum AcceptanceType {
Online,
#[default]
Offline,
}
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
#[serde(rename_all = "snake_case")]
pub enum MandateDataType {
SingleUse(MandateAmountData),
MultiUse(Option<MandateAmountData>),
}
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize, PartialEq, Eq)]
pub struct MandateAmountData {
pub amount: common_utils::types::MinorUnit,
pub currency: Currency,
pub start_date: Option<PrimitiveDateTime>,
pub end_date: Option<PrimitiveDateTime>,
pub metadata: Option<SecretSerdeValue>,
}
impl MandateAmountData {
pub fn get_end_date(&self, format: date_time::DateFormat) -> Result<String, Error> {
let date = self.end_date.ok_or_else(missing_field_err(
"mandate_data.mandate_type.{multi_use|single_use}.end_date",
))?;
date_time::format_date(date, format)
.change_context(crate::errors::ConnectorError::DateFormattingFailed)
}
pub fn get_metadata(&self) -> Result<SecretSerdeValue, Error> {
self.metadata.clone().ok_or_else(missing_field_err(
"mandate_data.mandate_type.{multi_use|single_use}.metadata",
))
}
|
{
"chunk": null,
"crate": "domain_types",
"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_-9203487555415585328_50_15
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/mandates.rs
MultiUse(Option<MandateAmountData>),
}
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize, PartialEq, Eq)]
pub struct MandateAmountData {
pub amount: common_utils::types::MinorUnit,
pub currency: Currency,
pub start_date: Option<PrimitiveDateTime>,
pub end_date: Option<PrimitiveDateTime>,
pub metadata: Option<SecretSerdeValue>,
}
impl MandateAmountData {
pub fn get_end_date(&self, format: date_time::DateFormat) -> Result<String, Error> {
let date = self.end_date.ok_or_else(missing_field_err(
|
{
"chunk": null,
"crate": "domain_types",
"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_-9203487555415585328_50_30
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/mandates.rs
MultiUse(Option<MandateAmountData>),
}
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize, PartialEq, Eq)]
pub struct MandateAmountData {
pub amount: common_utils::types::MinorUnit,
pub currency: Currency,
pub start_date: Option<PrimitiveDateTime>,
pub end_date: Option<PrimitiveDateTime>,
pub metadata: Option<SecretSerdeValue>,
}
impl MandateAmountData {
pub fn get_end_date(&self, format: date_time::DateFormat) -> Result<String, Error> {
let date = self.end_date.ok_or_else(missing_field_err(
"mandate_data.mandate_type.{multi_use|single_use}.end_date",
))?;
date_time::format_date(date, format)
.change_context(crate::errors::ConnectorError::DateFormattingFailed)
}
pub fn get_metadata(&self) -> Result<SecretSerdeValue, Error> {
self.metadata.clone().ok_or_else(missing_field_err(
"mandate_data.mandate_type.{multi_use|single_use}.metadata",
))
}
}
|
{
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 26,
"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_-9203487555415585328_50_50
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/mandates.rs
MultiUse(Option<MandateAmountData>),
}
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize, PartialEq, Eq)]
pub struct MandateAmountData {
pub amount: common_utils::types::MinorUnit,
pub currency: Currency,
pub start_date: Option<PrimitiveDateTime>,
pub end_date: Option<PrimitiveDateTime>,
pub metadata: Option<SecretSerdeValue>,
}
impl MandateAmountData {
pub fn get_end_date(&self, format: date_time::DateFormat) -> Result<String, Error> {
let date = self.end_date.ok_or_else(missing_field_err(
"mandate_data.mandate_type.{multi_use|single_use}.end_date",
))?;
date_time::format_date(date, format)
.change_context(crate::errors::ConnectorError::DateFormattingFailed)
}
pub fn get_metadata(&self) -> Result<SecretSerdeValue, Error> {
self.metadata.clone().ok_or_else(missing_field_err(
"mandate_data.mandate_type.{multi_use|single_use}.metadata",
))
}
}
|
{
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 26,
"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_-8256841136792189831_0_15
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/api.rs
use std::collections::HashSet;
use crate::{
payment_method_data::{DefaultPCIHolder, PaymentMethodData},
router_response_types::RedirectForm,
};
#[derive(Debug, Eq, PartialEq)]
pub struct RedirectionFormData {
pub redirect_form: RedirectForm,
pub payment_method_data: Option<PaymentMethodData<DefaultPCIHolder>>,
pub amount: String,
pub currency: String,
}
|
{
"chunk": null,
"crate": "domain_types",
"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_-8256841136792189831_0_30
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/api.rs
use std::collections::HashSet;
use crate::{
payment_method_data::{DefaultPCIHolder, PaymentMethodData},
router_response_types::RedirectForm,
};
#[derive(Debug, Eq, PartialEq)]
pub struct RedirectionFormData {
pub redirect_form: RedirectForm,
pub payment_method_data: Option<PaymentMethodData<DefaultPCIHolder>>,
pub amount: String,
pub currency: String,
}
#[derive(Debug, Eq, PartialEq)]
pub enum PaymentLinkAction {
PaymentLinkFormData(PaymentLinkFormData),
PaymentLinkStatus(PaymentLinkStatusData),
}
#[derive(Debug, Eq, PartialEq, Clone, serde::Serialize, serde::Deserialize)]
pub struct PaymentLinkFormData {
pub js_script: String,
pub css_script: String,
pub sdk_url: url::Url,
pub html_meta_tags: String,
}
#[derive(Debug, Eq, PartialEq, Clone, serde::Serialize, serde::Deserialize)]
|
{
"chunk": null,
"crate": "domain_types",
"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_-8256841136792189831_0_50
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/api.rs
use std::collections::HashSet;
use crate::{
payment_method_data::{DefaultPCIHolder, PaymentMethodData},
router_response_types::RedirectForm,
};
#[derive(Debug, Eq, PartialEq)]
pub struct RedirectionFormData {
pub redirect_form: RedirectForm,
pub payment_method_data: Option<PaymentMethodData<DefaultPCIHolder>>,
pub amount: String,
pub currency: String,
}
#[derive(Debug, Eq, PartialEq)]
pub enum PaymentLinkAction {
PaymentLinkFormData(PaymentLinkFormData),
PaymentLinkStatus(PaymentLinkStatusData),
}
#[derive(Debug, Eq, PartialEq, Clone, serde::Serialize, serde::Deserialize)]
pub struct PaymentLinkFormData {
pub js_script: String,
pub css_script: String,
pub sdk_url: url::Url,
pub html_meta_tags: String,
}
#[derive(Debug, Eq, PartialEq, Clone, serde::Serialize, serde::Deserialize)]
pub struct PaymentLinkStatusData {
pub js_script: String,
pub css_script: String,
}
#[derive(Debug, Eq, PartialEq)]
pub struct GenericLinks {
pub allowed_domains: HashSet<String>,
pub data: GenericLinksData,
pub locale: String,
}
#[derive(Debug, Eq, PartialEq)]
pub enum GenericLinksData {
ExpiredLink(GenericExpiredLinkData),
PaymentMethodCollect(GenericLinkFormData),
PayoutLink(GenericLinkFormData),
PayoutLinkStatus(GenericLinkStatusData),
PaymentMethodCollectStatus(GenericLinkStatusData),
SecurePaymentLink(PaymentLinkFormData),
|
{
"chunk": null,
"crate": "domain_types",
"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_-8256841136792189831_25_15
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/api.rs
pub sdk_url: url::Url,
pub html_meta_tags: String,
}
#[derive(Debug, Eq, PartialEq, Clone, serde::Serialize, serde::Deserialize)]
pub struct PaymentLinkStatusData {
pub js_script: String,
pub css_script: String,
}
#[derive(Debug, Eq, PartialEq)]
pub struct GenericLinks {
pub allowed_domains: HashSet<String>,
pub data: GenericLinksData,
pub locale: String,
|
{
"chunk": null,
"crate": "domain_types",
"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_-8256841136792189831_25_30
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/api.rs
pub sdk_url: url::Url,
pub html_meta_tags: String,
}
#[derive(Debug, Eq, PartialEq, Clone, serde::Serialize, serde::Deserialize)]
pub struct PaymentLinkStatusData {
pub js_script: String,
pub css_script: String,
}
#[derive(Debug, Eq, PartialEq)]
pub struct GenericLinks {
pub allowed_domains: HashSet<String>,
pub data: GenericLinksData,
pub locale: String,
}
#[derive(Debug, Eq, PartialEq)]
pub enum GenericLinksData {
ExpiredLink(GenericExpiredLinkData),
PaymentMethodCollect(GenericLinkFormData),
PayoutLink(GenericLinkFormData),
PayoutLinkStatus(GenericLinkStatusData),
PaymentMethodCollectStatus(GenericLinkStatusData),
SecurePaymentLink(PaymentLinkFormData),
}
#[derive(Debug, Eq, PartialEq, Clone, serde::Serialize, serde::Deserialize)]
pub struct GenericExpiredLinkData {
pub title: String,
|
{
"chunk": null,
"crate": "domain_types",
"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_-8256841136792189831_25_50
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/api.rs
pub sdk_url: url::Url,
pub html_meta_tags: String,
}
#[derive(Debug, Eq, PartialEq, Clone, serde::Serialize, serde::Deserialize)]
pub struct PaymentLinkStatusData {
pub js_script: String,
pub css_script: String,
}
#[derive(Debug, Eq, PartialEq)]
pub struct GenericLinks {
pub allowed_domains: HashSet<String>,
pub data: GenericLinksData,
pub locale: String,
}
#[derive(Debug, Eq, PartialEq)]
pub enum GenericLinksData {
ExpiredLink(GenericExpiredLinkData),
PaymentMethodCollect(GenericLinkFormData),
PayoutLink(GenericLinkFormData),
PayoutLinkStatus(GenericLinkStatusData),
PaymentMethodCollectStatus(GenericLinkStatusData),
SecurePaymentLink(PaymentLinkFormData),
}
#[derive(Debug, Eq, PartialEq, Clone, serde::Serialize, serde::Deserialize)]
pub struct GenericExpiredLinkData {
pub title: String,
pub message: String,
pub theme: String,
}
#[derive(Debug, Eq, PartialEq, Clone, serde::Serialize, serde::Deserialize)]
pub struct GenericLinkFormData {
pub js_data: String,
pub css_data: String,
pub sdk_url: url::Url,
pub html_meta_tags: String,
}
#[derive(Debug, Eq, PartialEq, Clone, serde::Serialize, serde::Deserialize)]
pub struct GenericLinkStatusData {
pub js_data: String,
pub css_data: String,
}
|
{
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 47,
"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_-8256841136792189831_50_15
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/api.rs
}
#[derive(Debug, Eq, PartialEq, Clone, serde::Serialize, serde::Deserialize)]
pub struct GenericExpiredLinkData {
pub title: String,
pub message: String,
pub theme: String,
}
#[derive(Debug, Eq, PartialEq, Clone, serde::Serialize, serde::Deserialize)]
pub struct GenericLinkFormData {
pub js_data: String,
pub css_data: String,
pub sdk_url: url::Url,
pub html_meta_tags: String,
|
{
"chunk": null,
"crate": "domain_types",
"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_-8256841136792189831_50_30
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/api.rs
}
#[derive(Debug, Eq, PartialEq, Clone, serde::Serialize, serde::Deserialize)]
pub struct GenericExpiredLinkData {
pub title: String,
pub message: String,
pub theme: String,
}
#[derive(Debug, Eq, PartialEq, Clone, serde::Serialize, serde::Deserialize)]
pub struct GenericLinkFormData {
pub js_data: String,
pub css_data: String,
pub sdk_url: url::Url,
pub html_meta_tags: String,
}
#[derive(Debug, Eq, PartialEq, Clone, serde::Serialize, serde::Deserialize)]
pub struct GenericLinkStatusData {
pub js_data: String,
pub css_data: String,
}
|
{
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 22,
"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_-8256841136792189831_50_50
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/api.rs
}
#[derive(Debug, Eq, PartialEq, Clone, serde::Serialize, serde::Deserialize)]
pub struct GenericExpiredLinkData {
pub title: String,
pub message: String,
pub theme: String,
}
#[derive(Debug, Eq, PartialEq, Clone, serde::Serialize, serde::Deserialize)]
pub struct GenericLinkFormData {
pub js_data: String,
pub css_data: String,
pub sdk_url: url::Url,
pub html_meta_tags: String,
}
#[derive(Debug, Eq, PartialEq, Clone, serde::Serialize, serde::Deserialize)]
pub struct GenericLinkStatusData {
pub js_data: String,
pub css_data: String,
}
|
{
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": 22,
"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_-4703749612792602811_0_15
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/connector_flow.rs
#[derive(Debug, Clone)]
pub struct CreateOrder;
#[derive(Debug, Clone)]
pub struct Authorize;
#[derive(Debug, Clone)]
pub struct PSync;
#[derive(Debug, Clone)]
pub struct Void;
#[derive(Debug, Clone)]
pub struct RSync;
|
{
"chunk": null,
"crate": "domain_types",
"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_-4703749612792602811_0_30
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/connector_flow.rs
#[derive(Debug, Clone)]
pub struct CreateOrder;
#[derive(Debug, Clone)]
pub struct Authorize;
#[derive(Debug, Clone)]
pub struct PSync;
#[derive(Debug, Clone)]
pub struct Void;
#[derive(Debug, Clone)]
pub struct RSync;
#[derive(Debug, Clone)]
pub struct Refund;
#[derive(Debug, Clone)]
pub struct Capture;
#[derive(Debug, Clone)]
pub struct SetupMandate;
#[derive(Debug, Clone)]
pub struct RepeatPayment;
#[derive(Debug, Clone)]
pub struct Accept;
|
{
"chunk": null,
"crate": "domain_types",
"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_-4703749612792602811_0_50
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/connector_flow.rs
#[derive(Debug, Clone)]
pub struct CreateOrder;
#[derive(Debug, Clone)]
pub struct Authorize;
#[derive(Debug, Clone)]
pub struct PSync;
#[derive(Debug, Clone)]
pub struct Void;
#[derive(Debug, Clone)]
pub struct RSync;
#[derive(Debug, Clone)]
pub struct Refund;
#[derive(Debug, Clone)]
pub struct Capture;
#[derive(Debug, Clone)]
pub struct SetupMandate;
#[derive(Debug, Clone)]
pub struct RepeatPayment;
#[derive(Debug, Clone)]
pub struct Accept;
#[derive(Debug, Clone)]
pub struct SubmitEvidence;
#[derive(Debug, Clone)]
pub struct DefendDispute;
#[derive(Debug, Clone)]
pub struct CreateSessionToken;
#[derive(Debug, Clone)]
pub struct CreateAccessToken;
#[derive(Debug, Clone)]
pub struct CreateConnectorCustomer;
#[derive(Debug, Clone)]
pub struct PaymentMethodToken;
#[derive(Debug, Clone)]
pub struct PreAuthenticate;
|
{
"chunk": null,
"crate": "domain_types",
"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_-4703749612792602811_25_15
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/connector_flow.rs
pub struct RepeatPayment;
#[derive(Debug, Clone)]
pub struct Accept;
#[derive(Debug, Clone)]
pub struct SubmitEvidence;
#[derive(Debug, Clone)]
pub struct DefendDispute;
#[derive(Debug, Clone)]
pub struct CreateSessionToken;
#[derive(Debug, Clone)]
|
{
"chunk": null,
"crate": "domain_types",
"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_-4703749612792602811_25_30
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/connector_flow.rs
pub struct RepeatPayment;
#[derive(Debug, Clone)]
pub struct Accept;
#[derive(Debug, Clone)]
pub struct SubmitEvidence;
#[derive(Debug, Clone)]
pub struct DefendDispute;
#[derive(Debug, Clone)]
pub struct CreateSessionToken;
#[derive(Debug, Clone)]
pub struct CreateAccessToken;
#[derive(Debug, Clone)]
pub struct CreateConnectorCustomer;
#[derive(Debug, Clone)]
pub struct PaymentMethodToken;
#[derive(Debug, Clone)]
pub struct PreAuthenticate;
#[derive(Debug, Clone)]
pub struct Authenticate;
#[derive(Debug, Clone)]
|
{
"chunk": null,
"crate": "domain_types",
"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_-4703749612792602811_25_50
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/connector_flow.rs
pub struct RepeatPayment;
#[derive(Debug, Clone)]
pub struct Accept;
#[derive(Debug, Clone)]
pub struct SubmitEvidence;
#[derive(Debug, Clone)]
pub struct DefendDispute;
#[derive(Debug, Clone)]
pub struct CreateSessionToken;
#[derive(Debug, Clone)]
pub struct CreateAccessToken;
#[derive(Debug, Clone)]
pub struct CreateConnectorCustomer;
#[derive(Debug, Clone)]
pub struct PaymentMethodToken;
#[derive(Debug, Clone)]
pub struct PreAuthenticate;
#[derive(Debug, Clone)]
pub struct Authenticate;
#[derive(Debug, Clone)]
pub struct PostAuthenticate;
#[derive(Debug, Clone)]
pub struct VoidPC;
#[derive(strum::Display)]
#[strum(serialize_all = "snake_case")]
pub enum FlowName {
Authorize,
Refund,
Rsync,
Psync,
Void,
VoidPc,
SetupMandate,
RepeatPayment,
Capture,
AcceptDispute,
SubmitEvidence,
DefendDispute,
|
{
"chunk": null,
"crate": "domain_types",
"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_-4703749612792602811_50_15
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/connector_flow.rs
#[derive(Debug, Clone)]
pub struct Authenticate;
#[derive(Debug, Clone)]
pub struct PostAuthenticate;
#[derive(Debug, Clone)]
pub struct VoidPC;
#[derive(strum::Display)]
#[strum(serialize_all = "snake_case")]
pub enum FlowName {
Authorize,
Refund,
|
{
"chunk": null,
"crate": "domain_types",
"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_-4703749612792602811_50_30
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/connector_flow.rs
#[derive(Debug, Clone)]
pub struct Authenticate;
#[derive(Debug, Clone)]
pub struct PostAuthenticate;
#[derive(Debug, Clone)]
pub struct VoidPC;
#[derive(strum::Display)]
#[strum(serialize_all = "snake_case")]
pub enum FlowName {
Authorize,
Refund,
Rsync,
Psync,
Void,
VoidPc,
SetupMandate,
RepeatPayment,
Capture,
AcceptDispute,
SubmitEvidence,
DefendDispute,
CreateOrder,
IncomingWebhook,
Dsync,
CreateSessionToken,
CreateAccessToken,
|
{
"chunk": null,
"crate": "domain_types",
"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_-4703749612792602811_50_50
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/connector_flow.rs
#[derive(Debug, Clone)]
pub struct Authenticate;
#[derive(Debug, Clone)]
pub struct PostAuthenticate;
#[derive(Debug, Clone)]
pub struct VoidPC;
#[derive(strum::Display)]
#[strum(serialize_all = "snake_case")]
pub enum FlowName {
Authorize,
Refund,
Rsync,
Psync,
Void,
VoidPc,
SetupMandate,
RepeatPayment,
Capture,
AcceptDispute,
SubmitEvidence,
DefendDispute,
CreateOrder,
IncomingWebhook,
Dsync,
CreateSessionToken,
CreateAccessToken,
CreateConnectorCustomer,
PaymentMethodToken,
PreAuthenticate,
Authenticate,
PostAuthenticate,
}
|
{
"chunk": null,
"crate": "domain_types",
"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": 50,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-4703749612792602811_75_15
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/connector_flow.rs
CreateOrder,
IncomingWebhook,
Dsync,
CreateSessionToken,
CreateAccessToken,
CreateConnectorCustomer,
PaymentMethodToken,
PreAuthenticate,
Authenticate,
PostAuthenticate,
}
|
{
"chunk": null,
"crate": "domain_types",
"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": 75,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-4703749612792602811_75_30
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/connector_flow.rs
CreateOrder,
IncomingWebhook,
Dsync,
CreateSessionToken,
CreateAccessToken,
CreateConnectorCustomer,
PaymentMethodToken,
PreAuthenticate,
Authenticate,
PostAuthenticate,
}
|
{
"chunk": null,
"crate": "domain_types",
"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": 75,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_-4703749612792602811_75_50
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/connector_flow.rs
CreateOrder,
IncomingWebhook,
Dsync,
CreateSessionToken,
CreateAccessToken,
CreateConnectorCustomer,
PaymentMethodToken,
PreAuthenticate,
Authenticate,
PostAuthenticate,
}
|
{
"chunk": null,
"crate": "domain_types",
"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": 75,
"struct_name": null,
"total_crates": null,
"trait_name": null
}
|
connector-service_snippet_1919096225770533635_0_15
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/utils.rs
use std::{
collections::{HashMap, HashSet},
sync::LazyLock,
};
use base64::Engine;
use common_enums::{CurrencyUnit, PaymentMethodType};
use common_utils::{consts, metadata::MaskedMetadata, AmountConvertor, CustomResult, MinorUnit};
use error_stack::{report, Result, ResultExt};
use hyperswitch_masking::ExposeInterface;
use regex::Regex;
use serde::Serialize;
use serde_json::Value;
use time::PrimitiveDateTime;
|
{
"chunk": null,
"crate": "domain_types",
"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_1919096225770533635_0_30
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/utils.rs
use std::{
collections::{HashMap, HashSet},
sync::LazyLock,
};
use base64::Engine;
use common_enums::{CurrencyUnit, PaymentMethodType};
use common_utils::{consts, metadata::MaskedMetadata, AmountConvertor, CustomResult, MinorUnit};
use error_stack::{report, Result, ResultExt};
use hyperswitch_masking::ExposeInterface;
use regex::Regex;
use serde::Serialize;
use serde_json::Value;
use time::PrimitiveDateTime;
use crate::{
errors::{self, ApiError, ApplicationErrorResponse, ParsingError},
payment_method_data::{Card, PaymentMethodData, PaymentMethodDataTypes},
router_data::ErrorResponse,
router_response_types::Response,
types::PaymentMethodDataType,
};
pub type Error = error_stack::Report<errors::ConnectorError>;
/// Trait for converting from one foreign type to another
pub trait ForeignTryFrom<F>: Sized {
/// Custom error for conversion failure
type Error;
|
{
"chunk": null,
"crate": "domain_types",
"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_1919096225770533635_0_50
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/utils.rs
use std::{
collections::{HashMap, HashSet},
sync::LazyLock,
};
use base64::Engine;
use common_enums::{CurrencyUnit, PaymentMethodType};
use common_utils::{consts, metadata::MaskedMetadata, AmountConvertor, CustomResult, MinorUnit};
use error_stack::{report, Result, ResultExt};
use hyperswitch_masking::ExposeInterface;
use regex::Regex;
use serde::Serialize;
use serde_json::Value;
use time::PrimitiveDateTime;
use crate::{
errors::{self, ApiError, ApplicationErrorResponse, ParsingError},
payment_method_data::{Card, PaymentMethodData, PaymentMethodDataTypes},
router_data::ErrorResponse,
router_response_types::Response,
types::PaymentMethodDataType,
};
pub type Error = error_stack::Report<errors::ConnectorError>;
/// Trait for converting from one foreign type to another
pub trait ForeignTryFrom<F>: Sized {
/// Custom error for conversion failure
type Error;
/// Convert from a foreign type to the current type and return an error if the conversion fails
fn foreign_try_from(from: F) -> Result<Self, Self::Error>;
}
pub trait ForeignFrom<F>: Sized {
/// Convert from a foreign type to the current type and return an error if the conversion fails
fn foreign_from(from: F) -> Self;
}
pub trait ValueExt {
/// Convert `serde_json::Value` into type `<T>` by using `serde::Deserialize`
fn parse_value<T>(self, type_name: &'static str) -> Result<T, ParsingError>
where
T: serde::de::DeserializeOwned;
}
impl ValueExt for serde_json::Value {
fn parse_value<T>(self, type_name: &'static str) -> Result<T, ParsingError>
where
T: serde::de::DeserializeOwned,
|
{
"chunk": null,
"crate": "domain_types",
"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_1919096225770533635_25_15
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/utils.rs
/// Trait for converting from one foreign type to another
pub trait ForeignTryFrom<F>: Sized {
/// Custom error for conversion failure
type Error;
/// Convert from a foreign type to the current type and return an error if the conversion fails
fn foreign_try_from(from: F) -> Result<Self, Self::Error>;
}
pub trait ForeignFrom<F>: Sized {
/// Convert from a foreign type to the current type and return an error if the conversion fails
fn foreign_from(from: F) -> Self;
}
pub trait ValueExt {
|
{
"chunk": null,
"crate": "domain_types",
"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_1919096225770533635_25_30
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/utils.rs
/// Trait for converting from one foreign type to another
pub trait ForeignTryFrom<F>: Sized {
/// Custom error for conversion failure
type Error;
/// Convert from a foreign type to the current type and return an error if the conversion fails
fn foreign_try_from(from: F) -> Result<Self, Self::Error>;
}
pub trait ForeignFrom<F>: Sized {
/// Convert from a foreign type to the current type and return an error if the conversion fails
fn foreign_from(from: F) -> Self;
}
pub trait ValueExt {
/// Convert `serde_json::Value` into type `<T>` by using `serde::Deserialize`
fn parse_value<T>(self, type_name: &'static str) -> Result<T, ParsingError>
where
T: serde::de::DeserializeOwned;
}
impl ValueExt for serde_json::Value {
fn parse_value<T>(self, type_name: &'static str) -> Result<T, ParsingError>
where
T: serde::de::DeserializeOwned,
{
let debug = format!(
"Unable to parse {type_name} from serde_json::Value: {:?}",
&self
);
|
{
"chunk": null,
"crate": "domain_types",
"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_1919096225770533635_25_50
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/utils.rs
/// Trait for converting from one foreign type to another
pub trait ForeignTryFrom<F>: Sized {
/// Custom error for conversion failure
type Error;
/// Convert from a foreign type to the current type and return an error if the conversion fails
fn foreign_try_from(from: F) -> Result<Self, Self::Error>;
}
pub trait ForeignFrom<F>: Sized {
/// Convert from a foreign type to the current type and return an error if the conversion fails
fn foreign_from(from: F) -> Self;
}
pub trait ValueExt {
/// Convert `serde_json::Value` into type `<T>` by using `serde::Deserialize`
fn parse_value<T>(self, type_name: &'static str) -> Result<T, ParsingError>
where
T: serde::de::DeserializeOwned;
}
impl ValueExt for serde_json::Value {
fn parse_value<T>(self, type_name: &'static str) -> Result<T, ParsingError>
where
T: serde::de::DeserializeOwned,
{
let debug = format!(
"Unable to parse {type_name} from serde_json::Value: {:?}",
&self
);
serde_json::from_value::<T>(self)
.change_context(ParsingError::StructParseFailure(type_name))
.attach_printable_lazy(|| debug)
}
}
pub trait Encode<'e>
where
Self: 'e + std::fmt::Debug,
{
fn encode_to_value(&'e self) -> Result<serde_json::Value, ParsingError>
where
Self: Serialize;
}
impl<'e, A> Encode<'e> for A
where
Self: 'e + std::fmt::Debug,
{
fn encode_to_value(&'e self) -> Result<serde_json::Value, ParsingError>
|
{
"chunk": null,
"crate": "domain_types",
"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_1919096225770533635_50_15
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/utils.rs
{
let debug = format!(
"Unable to parse {type_name} from serde_json::Value: {:?}",
&self
);
serde_json::from_value::<T>(self)
.change_context(ParsingError::StructParseFailure(type_name))
.attach_printable_lazy(|| debug)
}
}
pub trait Encode<'e>
where
Self: 'e + std::fmt::Debug,
{
|
{
"chunk": null,
"crate": "domain_types",
"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_1919096225770533635_50_30
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/utils.rs
{
let debug = format!(
"Unable to parse {type_name} from serde_json::Value: {:?}",
&self
);
serde_json::from_value::<T>(self)
.change_context(ParsingError::StructParseFailure(type_name))
.attach_printable_lazy(|| debug)
}
}
pub trait Encode<'e>
where
Self: 'e + std::fmt::Debug,
{
fn encode_to_value(&'e self) -> Result<serde_json::Value, ParsingError>
where
Self: Serialize;
}
impl<'e, A> Encode<'e> for A
where
Self: 'e + std::fmt::Debug,
{
fn encode_to_value(&'e self) -> Result<serde_json::Value, ParsingError>
where
Self: Serialize,
{
serde_json::to_value(self)
.change_context(ParsingError::EncodeError("json-value"))
|
{
"chunk": null,
"crate": "domain_types",
"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_1919096225770533635_50_50
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/utils.rs
{
let debug = format!(
"Unable to parse {type_name} from serde_json::Value: {:?}",
&self
);
serde_json::from_value::<T>(self)
.change_context(ParsingError::StructParseFailure(type_name))
.attach_printable_lazy(|| debug)
}
}
pub trait Encode<'e>
where
Self: 'e + std::fmt::Debug,
{
fn encode_to_value(&'e self) -> Result<serde_json::Value, ParsingError>
where
Self: Serialize;
}
impl<'e, A> Encode<'e> for A
where
Self: 'e + std::fmt::Debug,
{
fn encode_to_value(&'e self) -> Result<serde_json::Value, ParsingError>
where
Self: Serialize,
{
serde_json::to_value(self)
.change_context(ParsingError::EncodeError("json-value"))
.attach_printable_lazy(|| format!("Unable to convert {self:?} to a value"))
}
}
pub fn handle_json_response_deserialization_failure(
res: Response,
_: &'static str,
) -> CustomResult<ErrorResponse, crate::errors::ConnectorError> {
let response_data = String::from_utf8(res.response.to_vec())
.change_context(crate::errors::ConnectorError::ResponseDeserializationFailed)?;
// check for whether the response is in json format
match serde_json::from_str::<Value>(&response_data) {
// in case of unexpected response but in json format
Ok(_) => Err(crate::errors::ConnectorError::ResponseDeserializationFailed)?,
// in case of unexpected response but in html or string format
Err(_) => Ok(ErrorResponse {
status_code: res.status_code,
code: consts::NO_ERROR_CODE.to_string(),
message: consts::UNSUPPORTED_ERROR_MESSAGE.to_string(),
|
{
"chunk": null,
"crate": "domain_types",
"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_1919096225770533635_75_15
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/utils.rs
where
Self: Serialize,
{
serde_json::to_value(self)
.change_context(ParsingError::EncodeError("json-value"))
.attach_printable_lazy(|| format!("Unable to convert {self:?} to a value"))
}
}
pub fn handle_json_response_deserialization_failure(
res: Response,
_: &'static str,
) -> CustomResult<ErrorResponse, crate::errors::ConnectorError> {
let response_data = String::from_utf8(res.response.to_vec())
.change_context(crate::errors::ConnectorError::ResponseDeserializationFailed)?;
|
{
"chunk": null,
"crate": "domain_types",
"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_1919096225770533635_75_30
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/utils.rs
where
Self: Serialize,
{
serde_json::to_value(self)
.change_context(ParsingError::EncodeError("json-value"))
.attach_printable_lazy(|| format!("Unable to convert {self:?} to a value"))
}
}
pub fn handle_json_response_deserialization_failure(
res: Response,
_: &'static str,
) -> CustomResult<ErrorResponse, crate::errors::ConnectorError> {
let response_data = String::from_utf8(res.response.to_vec())
.change_context(crate::errors::ConnectorError::ResponseDeserializationFailed)?;
// check for whether the response is in json format
match serde_json::from_str::<Value>(&response_data) {
// in case of unexpected response but in json format
Ok(_) => Err(crate::errors::ConnectorError::ResponseDeserializationFailed)?,
// in case of unexpected response but in html or string format
Err(_) => Ok(ErrorResponse {
status_code: res.status_code,
code: consts::NO_ERROR_CODE.to_string(),
message: consts::UNSUPPORTED_ERROR_MESSAGE.to_string(),
reason: Some(response_data.clone()),
attempt_status: None,
connector_transaction_id: None,
network_advice_code: None,
network_decline_code: None,
|
{
"chunk": null,
"crate": "domain_types",
"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_1919096225770533635_75_50
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/utils.rs
where
Self: Serialize,
{
serde_json::to_value(self)
.change_context(ParsingError::EncodeError("json-value"))
.attach_printable_lazy(|| format!("Unable to convert {self:?} to a value"))
}
}
pub fn handle_json_response_deserialization_failure(
res: Response,
_: &'static str,
) -> CustomResult<ErrorResponse, crate::errors::ConnectorError> {
let response_data = String::from_utf8(res.response.to_vec())
.change_context(crate::errors::ConnectorError::ResponseDeserializationFailed)?;
// check for whether the response is in json format
match serde_json::from_str::<Value>(&response_data) {
// in case of unexpected response but in json format
Ok(_) => Err(crate::errors::ConnectorError::ResponseDeserializationFailed)?,
// in case of unexpected response but in html or string format
Err(_) => Ok(ErrorResponse {
status_code: res.status_code,
code: consts::NO_ERROR_CODE.to_string(),
message: consts::UNSUPPORTED_ERROR_MESSAGE.to_string(),
reason: Some(response_data.clone()),
attempt_status: None,
connector_transaction_id: None,
network_advice_code: None,
network_decline_code: None,
network_error_message: None,
}),
}
}
pub fn generate_random_bytes(length: usize) -> Vec<u8> {
// returns random bytes of length n
let mut rng = rand::thread_rng();
(0..length).map(|_| rand::Rng::gen(&mut rng)).collect()
}
pub fn missing_field_err(
message: &'static str,
) -> Box<dyn Fn() -> error_stack::Report<errors::ConnectorError> + 'static> {
Box::new(move || {
errors::ConnectorError::MissingRequiredField {
field_name: message,
}
.into()
})
|
{
"chunk": null,
"crate": "domain_types",
"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_1919096225770533635_100_15
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/utils.rs
reason: Some(response_data.clone()),
attempt_status: None,
connector_transaction_id: None,
network_advice_code: None,
network_decline_code: None,
network_error_message: None,
}),
}
}
pub fn generate_random_bytes(length: usize) -> Vec<u8> {
// returns random bytes of length n
let mut rng = rand::thread_rng();
(0..length).map(|_| rand::Rng::gen(&mut rng)).collect()
}
|
{
"chunk": null,
"crate": "domain_types",
"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_1919096225770533635_100_30
|
clm
|
snippet
|
// connector-service/backend/domain_types/src/utils.rs
reason: Some(response_data.clone()),
attempt_status: None,
connector_transaction_id: None,
network_advice_code: None,
network_decline_code: None,
network_error_message: None,
}),
}
}
pub fn generate_random_bytes(length: usize) -> Vec<u8> {
// returns random bytes of length n
let mut rng = rand::thread_rng();
(0..length).map(|_| rand::Rng::gen(&mut rng)).collect()
}
pub fn missing_field_err(
message: &'static str,
) -> Box<dyn Fn() -> error_stack::Report<errors::ConnectorError> + 'static> {
Box::new(move || {
errors::ConnectorError::MissingRequiredField {
field_name: message,
}
.into()
})
}
pub fn construct_not_supported_error_report(
capture_method: common_enums::CaptureMethod,
connector_name: &'static str,
|
{
"chunk": null,
"crate": "domain_types",
"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
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.