id stringlengths 11 116 | type stringclasses 1 value | granularity stringclasses 4 values | content stringlengths 16 477k | metadata dict |
|---|---|---|---|---|
fn_clm_hyperswitch_domain_models_fmt_4408191244781062600 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/subscription
// Implementation of SubscriptionStatus for std::fmt::Display
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Self::Active => write!(f, "Active"),
Self::Created => write!(f, "Created"),
Self::InActive => write!(f, "InActive"),
Self::Pending => write!(f, "Pending"),
Self::Trial => write!(f, "Trial"),
Self::Paused => write!(f, "Paused"),
Self::Unpaid => write!(f, "Unpaid"),
Self::Onetime => write!(f, "Onetime"),
Self::Cancelled => write!(f, "Cancelled"),
Self::Failed => write!(f, "Failed"),
}
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 38,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_from_9065478082691158868 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/address
// Implementation of api_models::payments::PhoneDetails for From<PhoneDetails>
fn from(phone: PhoneDetails) -> Self {
Self {
number: phone.number,
country_code: phone.country_code,
}
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 2600,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_unify_address_details_9065478082691158868 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/address
// Inherent implementation for AddressDetails
/// Unify the address details, giving priority to `self` when details are present in both
pub fn unify_address_details(&self, other: Option<&Self>) -> Self {
if let Some(other) = other {
let (first_name, last_name) = if self
.first_name
.as_ref()
.is_some_and(|first_name| !first_name.peek().trim().is_empty())
{
(self.first_name.clone(), self.last_name.clone())
} else {
(other.first_name.clone(), other.last_name.clone())
};
Self {
first_name,
last_name,
city: self.city.clone().or(other.city.clone()),
country: self.country.or(other.country),
line1: self.line1.clone().or(other.line1.clone()),
line2: self.line2.clone().or(other.line2.clone()),
line3: self.line3.clone().or(other.line3.clone()),
zip: self.zip.clone().or(other.zip.clone()),
state: self.state.clone().or(other.state.clone()),
origin_zip: self.origin_zip.clone().or(other.origin_zip.clone()),
}
} else {
self.clone()
}
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 85,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_unify_address_9065478082691158868 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/address
// Inherent implementation for Address
/// Unify the address, giving priority to `self` when details are present in both
pub fn unify_address(&self, other: Option<&Self>) -> Self {
let other_address_details = other.and_then(|address| address.address.as_ref());
Self {
address: self
.address
.as_ref()
.map(|address| address.unify_address_details(other_address_details))
.or(other_address_details.cloned()),
email: self
.email
.clone()
.or(other.and_then(|other| other.email.clone())),
phone: {
self.phone
.clone()
.and_then(|phone_details| {
if phone_details.number.is_some() {
Some(phone_details)
} else {
None
}
})
.or_else(|| other.and_then(|other| other.phone.clone()))
},
}
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 64,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_get_optional_full_name_9065478082691158868 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/address
// Inherent implementation for AddressDetails
pub fn get_optional_full_name(&self) -> Option<Secret<String>> {
match (self.first_name.as_ref(), self.last_name.as_ref()) {
(Some(first_name), Some(last_name)) => Some(Secret::new(format!(
"{} {}",
first_name.peek(),
last_name.peek()
))),
(Some(name), None) | (None, Some(name)) => Some(name.to_owned()),
_ => None,
}
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 62,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_foreign_try_from_-4955474073845608074 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/bulk_tokenization
// Implementation of payments_api::CustomerDetails for ForeignTryFrom<CustomerDetails>
fn foreign_try_from(customer: CustomerDetails) -> Result<Self, Self::Error> {
Ok(Self {
id: customer.customer_id.get_required_value("customer_id")?,
name: customer.name,
email: customer.email,
phone: customer.phone,
phone_country_code: customer.phone_country_code,
tax_registration_id: customer.tax_registration_id,
})
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 430,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_foreign_from_-4955474073845608074 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/bulk_tokenization
// Implementation of PhoneDetails for ForeignFrom<payments_api::PhoneDetails>
fn foreign_from(req: payments_api::PhoneDetails) -> Self {
Self {
number: req.number,
country_code: req.country_code,
}
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 212,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_from_5722769522255865883 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/type_encryption
// Implementation of EncryptedJsonType<T> for From<T>
fn from(value: T) -> Self {
Self(value)
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 2602,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_into_inner_5722769522255865883 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/type_encryption
// Inherent implementation for EncryptedJsonType<T>
pub fn into_inner(self) -> T {
self.0
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 2061,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_crypto_operation_5722769522255865883 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/type_encryption
pub async fn crypto_operation<T: Clone + Send, S: masking::Strategy<T>>(
state: &KeyManagerState,
table_name: &str,
operation: CryptoOperation<T, S>,
identifier: Identifier,
key: &[u8],
) -> CustomResult<CryptoOutput<T, S>, CryptoError>
where
Secret<T, S>: Send,
crypto::Encryptable<Secret<T, S>>: TypeEncryption<T, crypto::GcmAes256, S>,
{
match operation {
CryptoOperation::Encrypt(data) => {
let data = encrypt(state, data, identifier, key).await?;
Ok(CryptoOutput::Operation(data))
}
CryptoOperation::EncryptOptional(data) => {
let data = encrypt_optional(state, data, identifier, key).await?;
Ok(CryptoOutput::OptionalOperation(data))
}
CryptoOperation::Decrypt(data) => {
let data = decrypt(state, data, identifier, key).await?;
Ok(CryptoOutput::Operation(data))
}
CryptoOperation::DecryptOptional(data) => {
let data = decrypt_optional(state, data, identifier, key).await?;
Ok(CryptoOutput::OptionalOperation(data))
}
CryptoOperation::BatchEncrypt(data) => {
let data = batch_encrypt(state, data, identifier, key).await?;
Ok(CryptoOutput::BatchOperation(data))
}
CryptoOperation::BatchDecrypt(data) => {
let data = batch_decrypt(state, data, identifier, key).await?;
Ok(CryptoOutput::BatchOperation(data))
}
}
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 217,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_async_lift_5722769522255865883 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/type_encryption
// Implementation of V for AsyncLift<U>
async fn async_lift<Func, F, E, W>(self, func: Func) -> Self::OtherWrapper<W, E>
where
Func: Fn(Self::SelfWrapper<U>) -> F + Send + Sync,
F: futures::Future<Output = Self::OtherWrapper<W, E>> + Send,
{
func(self).await
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 46,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_inner_5722769522255865883 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/type_encryption
// Inherent implementation for EncryptedJsonType<T>
pub fn inner(&self) -> &T {
&self.0
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 45,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_new_-311629645661053282 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/router_data
// Inherent implementation for ConnectorResponseData
pub fn new(
additional_payment_method_data: Option<AdditionalPaymentMethodConnectorResponse>,
is_overcapture_enabled: Option<primitive_wrappers::OvercaptureEnabledBool>,
extended_authorization_response_data: Option<ExtendedAuthorizationResponseData>,
) -> Self {
Self {
additional_payment_method_data,
extended_authorization_response_data,
is_overcapture_enabled,
}
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 14463,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_default_-311629645661053282 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/router_data
// Implementation of ErrorResponse for Default
fn default() -> Self {
Self {
code: "HE_00".to_string(),
message: "Something went wrong".to_string(),
reason: None,
status_code: http::StatusCode::INTERNAL_SERVER_ERROR.as_u16(),
attempt_status: None,
connector_transaction_id: None,
network_decline_code: None,
network_advice_code: None,
network_error_message: None,
connector_metadata: None,
}
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 7709,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_try_from_-311629645661053282 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/router_data
// Implementation of common_payment_types::ApplePayPredecryptData for TryFrom<ApplePayPredecryptDataInternal>
fn try_from(data: ApplePayPredecryptDataInternal) -> Result<Self, Self::Error> {
let application_expiration_month = data.clone().get_expiry_month()?;
let application_expiration_year = data.clone().get_four_digit_expiry_year()?;
Ok(Self {
application_primary_account_number: data.application_primary_account_number.clone(),
application_expiration_month,
application_expiration_year,
payment_data: data.payment_data.into(),
})
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 2669,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_from_-311629645661053282 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/router_data
// Implementation of common_payment_types::ApplePayCryptogramData for From<ApplePayCryptogramDataInternal>
fn from(payment_data: ApplePayCryptogramDataInternal) -> Self {
Self {
online_payment_cryptogram: payment_data.online_payment_cryptogram,
eci_indicator: payment_data.eci_indicator,
}
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 2600,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_get_masked_keys_-311629645661053282 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/router_data
// Implementation of None for ConnectorAuthType
pub fn get_masked_keys(&self) -> Self {
match self {
Self::TemporaryAuth => Self::TemporaryAuth,
Self::NoKey => Self::NoKey,
Self::HeaderKey { api_key } => Self::HeaderKey {
api_key: self.mask_key(api_key.clone().expose()),
},
Self::BodyKey { api_key, key1 } => Self::BodyKey {
api_key: self.mask_key(api_key.clone().expose()),
key1: self.mask_key(key1.clone().expose()),
},
Self::SignatureKey {
api_key,
key1,
api_secret,
} => Self::SignatureKey {
api_key: self.mask_key(api_key.clone().expose()),
key1: self.mask_key(key1.clone().expose()),
api_secret: self.mask_key(api_secret.clone().expose()),
},
Self::MultiAuthKey {
api_key,
key1,
api_secret,
key2,
} => Self::MultiAuthKey {
api_key: self.mask_key(api_key.clone().expose()),
key1: self.mask_key(key1.clone().expose()),
api_secret: self.mask_key(api_secret.clone().expose()),
key2: self.mask_key(key2.clone().expose()),
},
Self::CurrencyAuthKey { auth_key_map } => Self::CurrencyAuthKey {
auth_key_map: auth_key_map.clone(),
},
Self::CertificateAuth {
certificate,
private_key,
} => Self::CertificateAuth {
certificate: self.mask_key(certificate.clone().expose()),
private_key: self.mask_key(private_key.clone().expose()),
},
}
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 92,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_try_from_-6472051039913614710 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/business_profile
// Implementation of ExternalVaultDetails for TryFrom<(Option<bool>, Option<ExternalVaultConnectorDetails>)>
fn try_from(
item: (Option<bool>, Option<ExternalVaultConnectorDetails>),
) -> Result<Self, Self::Error> {
match item {
(is_external_vault_enabled, external_vault_connector_details)
if is_external_vault_enabled.unwrap_or(false) =>
{
Ok(Self::ExternalVaultEnabled(
external_vault_connector_details
.get_required_value("ExternalVaultConnectorDetails")?,
))
}
_ => Ok(Self::Skip),
}
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 2663,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_from_-6472051039913614710 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/business_profile
// Implementation of ProfileUpdateInternal for From<ProfileUpdate>
fn from(profile_update: ProfileUpdate) -> Self {
let now = date_time::now();
match profile_update {
ProfileUpdate::Update(update) => {
let ProfileGeneralUpdate {
profile_name,
return_url,
enable_payment_response_hash,
payment_response_hash_key,
redirect_to_merchant_with_http_post,
webhook_details,
metadata,
applepay_verified_domains,
payment_link_config,
session_expiry,
authentication_connector_details,
payout_link_config,
extended_card_info_config,
use_billing_as_payment_method_billing,
collect_shipping_details_from_wallet_connector,
collect_billing_details_from_wallet_connector,
is_connector_agnostic_mit_enabled,
outgoing_webhook_custom_http_headers,
always_collect_billing_details_from_wallet_connector,
always_collect_shipping_details_from_wallet_connector,
order_fulfillment_time,
order_fulfillment_time_origin,
is_network_tokenization_enabled,
is_click_to_pay_enabled,
authentication_product_ids,
three_ds_decision_manager_config,
card_testing_guard_config,
card_testing_secret_key,
is_debit_routing_enabled,
merchant_business_country,
is_iframe_redirection_enabled,
is_external_vault_enabled,
external_vault_connector_details,
merchant_category_code,
merchant_country_code,
revenue_recovery_retry_algorithm_type,
split_txns_enabled,
billing_processor_id,
} = *update;
Self {
profile_name,
modified_at: now,
return_url,
enable_payment_response_hash,
payment_response_hash_key,
redirect_to_merchant_with_http_post,
webhook_details,
metadata,
is_recon_enabled: None,
applepay_verified_domains,
payment_link_config,
session_expiry,
authentication_connector_details,
payout_link_config,
is_extended_card_info_enabled: None,
extended_card_info_config,
is_connector_agnostic_mit_enabled,
use_billing_as_payment_method_billing,
collect_shipping_details_from_wallet_connector,
collect_billing_details_from_wallet_connector,
outgoing_webhook_custom_http_headers: outgoing_webhook_custom_http_headers
.map(Encryption::from),
routing_algorithm_id: None,
always_collect_billing_details_from_wallet_connector,
always_collect_shipping_details_from_wallet_connector,
order_fulfillment_time,
order_fulfillment_time_origin,
frm_routing_algorithm_id: None,
payout_routing_algorithm_id: None,
default_fallback_routing: None,
should_collect_cvv_during_payment: None,
tax_connector_id: None,
is_tax_connector_enabled: None,
is_l2_l3_enabled: None,
is_network_tokenization_enabled,
is_auto_retries_enabled: None,
max_auto_retries_enabled: None,
is_click_to_pay_enabled,
authentication_product_ids,
three_ds_decision_manager_config,
card_testing_guard_config,
card_testing_secret_key: card_testing_secret_key.map(Encryption::from),
is_clear_pan_retries_enabled: None,
is_debit_routing_enabled,
merchant_business_country,
revenue_recovery_retry_algorithm_type,
revenue_recovery_retry_algorithm_data: None,
is_iframe_redirection_enabled,
is_external_vault_enabled,
external_vault_connector_details,
merchant_category_code,
merchant_country_code,
split_txns_enabled,
billing_processor_id,
}
}
ProfileUpdate::RoutingAlgorithmUpdate {
routing_algorithm_id,
payout_routing_algorithm_id,
} => Self {
profile_name: None,
modified_at: now,
return_url: None,
enable_payment_response_hash: None,
payment_response_hash_key: None,
redirect_to_merchant_with_http_post: None,
webhook_details: None,
metadata: None,
is_recon_enabled: None,
applepay_verified_domains: None,
payment_link_config: None,
session_expiry: None,
authentication_connector_details: None,
payout_link_config: None,
is_extended_card_info_enabled: None,
extended_card_info_config: None,
is_connector_agnostic_mit_enabled: None,
use_billing_as_payment_method_billing: None,
collect_shipping_details_from_wallet_connector: None,
collect_billing_details_from_wallet_connector: None,
outgoing_webhook_custom_http_headers: None,
routing_algorithm_id,
always_collect_billing_details_from_wallet_connector: None,
always_collect_shipping_details_from_wallet_connector: None,
order_fulfillment_time: None,
order_fulfillment_time_origin: None,
frm_routing_algorithm_id: None,
payout_routing_algorithm_id,
default_fallback_routing: None,
should_collect_cvv_during_payment: None,
tax_connector_id: None,
is_tax_connector_enabled: None,
is_l2_l3_enabled: None,
is_network_tokenization_enabled: None,
is_auto_retries_enabled: None,
max_auto_retries_enabled: None,
is_click_to_pay_enabled: None,
authentication_product_ids: None,
three_ds_decision_manager_config: None,
card_testing_guard_config: None,
card_testing_secret_key: None,
is_clear_pan_retries_enabled: None,
is_debit_routing_enabled: None,
merchant_business_country: None,
revenue_recovery_retry_algorithm_type: None,
revenue_recovery_retry_algorithm_data: None,
is_iframe_redirection_enabled: None,
is_external_vault_enabled: None,
external_vault_connector_details: None,
merchant_category_code: None,
merchant_country_code: None,
split_txns_enabled: None,
billing_processor_id: None,
},
ProfileUpdate::ExtendedCardInfoUpdate {
is_extended_card_info_enabled,
} => Self {
profile_name: None,
modified_at: now,
return_url: None,
enable_payment_response_hash: None,
payment_response_hash_key: None,
redirect_to_merchant_with_http_post: None,
webhook_details: None,
metadata: None,
is_recon_enabled: None,
applepay_verified_domains: None,
payment_link_config: None,
session_expiry: None,
authentication_connector_details: None,
payout_link_config: None,
is_extended_card_info_enabled: Some(is_extended_card_info_enabled),
extended_card_info_config: None,
is_connector_agnostic_mit_enabled: None,
use_billing_as_payment_method_billing: None,
collect_shipping_details_from_wallet_connector: None,
collect_billing_details_from_wallet_connector: None,
outgoing_webhook_custom_http_headers: None,
always_collect_billing_details_from_wallet_connector: None,
always_collect_shipping_details_from_wallet_connector: None,
routing_algorithm_id: None,
payout_routing_algorithm_id: None,
order_fulfillment_time: None,
order_fulfillment_time_origin: None,
frm_routing_algorithm_id: None,
default_fallback_routing: None,
should_collect_cvv_during_payment: None,
tax_connector_id: None,
is_tax_connector_enabled: None,
is_l2_l3_enabled: None,
is_network_tokenization_enabled: None,
is_auto_retries_enabled: None,
max_auto_retries_enabled: None,
is_click_to_pay_enabled: None,
authentication_product_ids: None,
three_ds_decision_manager_config: None,
card_testing_guard_config: None,
card_testing_secret_key: None,
is_clear_pan_retries_enabled: None,
is_debit_routing_enabled: None,
merchant_business_country: None,
revenue_recovery_retry_algorithm_type: None,
revenue_recovery_retry_algorithm_data: None,
is_iframe_redirection_enabled: None,
is_external_vault_enabled: None,
external_vault_connector_details: None,
merchant_category_code: None,
merchant_country_code: None,
split_txns_enabled: None,
billing_processor_id: None,
},
ProfileUpdate::ConnectorAgnosticMitUpdate {
is_connector_agnostic_mit_enabled,
} => Self {
profile_name: None,
modified_at: now,
return_url: None,
enable_payment_response_hash: None,
payment_response_hash_key: None,
redirect_to_merchant_with_http_post: None,
webhook_details: None,
metadata: None,
is_recon_enabled: None,
applepay_verified_domains: None,
payment_link_config: None,
is_l2_l3_enabled: None,
session_expiry: None,
authentication_connector_details: None,
payout_link_config: None,
is_extended_card_info_enabled: None,
extended_card_info_config: None,
is_connector_agnostic_mit_enabled: Some(is_connector_agnostic_mit_enabled),
use_billing_as_payment_method_billing: None,
collect_shipping_details_from_wallet_connector: None,
collect_billing_details_from_wallet_connector: None,
outgoing_webhook_custom_http_headers: None,
always_collect_billing_details_from_wallet_connector: None,
always_collect_shipping_details_from_wallet_connector: None,
routing_algorithm_id: None,
payout_routing_algorithm_id: None,
order_fulfillment_time: None,
order_fulfillment_time_origin: None,
frm_routing_algorithm_id: None,
default_fallback_routing: None,
should_collect_cvv_during_payment: None,
tax_connector_id: None,
is_tax_connector_enabled: None,
is_network_tokenization_enabled: None,
is_auto_retries_enabled: None,
max_auto_retries_enabled: None,
is_click_to_pay_enabled: None,
authentication_product_ids: None,
three_ds_decision_manager_config: None,
card_testing_guard_config: None,
card_testing_secret_key: None,
is_clear_pan_retries_enabled: None,
is_debit_routing_enabled: None,
merchant_business_country: None,
revenue_recovery_retry_algorithm_type: None,
revenue_recovery_retry_algorithm_data: None,
is_iframe_redirection_enabled: None,
is_external_vault_enabled: None,
external_vault_connector_details: None,
merchant_category_code: None,
merchant_country_code: None,
split_txns_enabled: None,
billing_processor_id: None,
},
ProfileUpdate::DefaultRoutingFallbackUpdate {
default_fallback_routing,
} => Self {
profile_name: None,
modified_at: now,
return_url: None,
enable_payment_response_hash: None,
payment_response_hash_key: None,
redirect_to_merchant_with_http_post: None,
webhook_details: None,
metadata: None,
is_recon_enabled: None,
applepay_verified_domains: None,
is_l2_l3_enabled: None,
payment_link_config: None,
session_expiry: None,
authentication_connector_details: None,
payout_link_config: None,
is_extended_card_info_enabled: None,
extended_card_info_config: None,
is_connector_agnostic_mit_enabled: None,
use_billing_as_payment_method_billing: None,
collect_shipping_details_from_wallet_connector: None,
collect_billing_details_from_wallet_connector: None,
outgoing_webhook_custom_http_headers: None,
always_collect_billing_details_from_wallet_connector: None,
always_collect_shipping_details_from_wallet_connector: None,
routing_algorithm_id: None,
payout_routing_algorithm_id: None,
order_fulfillment_time: None,
order_fulfillment_time_origin: None,
frm_routing_algorithm_id: None,
default_fallback_routing,
should_collect_cvv_during_payment: None,
tax_connector_id: None,
is_tax_connector_enabled: None,
is_network_tokenization_enabled: None,
is_auto_retries_enabled: None,
max_auto_retries_enabled: None,
is_click_to_pay_enabled: None,
authentication_product_ids: None,
three_ds_decision_manager_config: None,
card_testing_guard_config: None,
card_testing_secret_key: None,
is_clear_pan_retries_enabled: None,
is_debit_routing_enabled: None,
merchant_business_country: None,
revenue_recovery_retry_algorithm_type: None,
revenue_recovery_retry_algorithm_data: None,
is_iframe_redirection_enabled: None,
is_external_vault_enabled: None,
external_vault_connector_details: None,
merchant_category_code: None,
merchant_country_code: None,
split_txns_enabled: None,
billing_processor_id: None,
},
ProfileUpdate::NetworkTokenizationUpdate {
is_network_tokenization_enabled,
} => Self {
profile_name: None,
modified_at: now,
return_url: None,
enable_payment_response_hash: None,
is_l2_l3_enabled: None,
payment_response_hash_key: None,
redirect_to_merchant_with_http_post: None,
webhook_details: None,
metadata: None,
is_recon_enabled: None,
applepay_verified_domains: None,
payment_link_config: None,
session_expiry: None,
authentication_connector_details: None,
payout_link_config: None,
is_extended_card_info_enabled: None,
extended_card_info_config: None,
is_connector_agnostic_mit_enabled: None,
use_billing_as_payment_method_billing: None,
collect_shipping_details_from_wallet_connector: None,
collect_billing_details_from_wallet_connector: None,
outgoing_webhook_custom_http_headers: None,
always_collect_billing_details_from_wallet_connector: None,
always_collect_shipping_details_from_wallet_connector: None,
routing_algorithm_id: None,
payout_routing_algorithm_id: None,
order_fulfillment_time: None,
order_fulfillment_time_origin: None,
frm_routing_algorithm_id: None,
default_fallback_routing: None,
should_collect_cvv_during_payment: None,
tax_connector_id: None,
is_tax_connector_enabled: None,
is_network_tokenization_enabled: Some(is_network_tokenization_enabled),
is_auto_retries_enabled: None,
max_auto_retries_enabled: None,
is_click_to_pay_enabled: None,
authentication_product_ids: None,
three_ds_decision_manager_config: None,
card_testing_guard_config: None,
card_testing_secret_key: None,
is_clear_pan_retries_enabled: None,
is_debit_routing_enabled: None,
merchant_business_country: None,
revenue_recovery_retry_algorithm_type: None,
revenue_recovery_retry_algorithm_data: None,
is_iframe_redirection_enabled: None,
is_external_vault_enabled: None,
external_vault_connector_details: None,
merchant_category_code: None,
merchant_country_code: None,
split_txns_enabled: None,
billing_processor_id: None,
},
ProfileUpdate::CollectCvvDuringPaymentUpdate {
should_collect_cvv_during_payment,
} => Self {
profile_name: None,
modified_at: now,
return_url: None,
enable_payment_response_hash: None,
payment_response_hash_key: None,
redirect_to_merchant_with_http_post: None,
webhook_details: None,
metadata: None,
is_recon_enabled: None,
applepay_verified_domains: None,
payment_link_config: None,
session_expiry: None,
authentication_connector_details: None,
payout_link_config: None,
is_extended_card_info_enabled: None,
extended_card_info_config: None,
is_connector_agnostic_mit_enabled: None,
use_billing_as_payment_method_billing: None,
collect_shipping_details_from_wallet_connector: None,
collect_billing_details_from_wallet_connector: None,
outgoing_webhook_custom_http_headers: None,
always_collect_billing_details_from_wallet_connector: None,
always_collect_shipping_details_from_wallet_connector: None,
routing_algorithm_id: None,
payout_routing_algorithm_id: None,
order_fulfillment_time: None,
order_fulfillment_time_origin: None,
frm_routing_algorithm_id: None,
default_fallback_routing: None,
should_collect_cvv_during_payment: Some(should_collect_cvv_during_payment),
tax_connector_id: None,
is_tax_connector_enabled: None,
is_network_tokenization_enabled: None,
is_auto_retries_enabled: None,
max_auto_retries_enabled: None,
is_click_to_pay_enabled: None,
authentication_product_ids: None,
is_l2_l3_enabled: None,
three_ds_decision_manager_config: None,
card_testing_guard_config: None,
card_testing_secret_key: None,
is_clear_pan_retries_enabled: None,
is_debit_routing_enabled: None,
merchant_business_country: None,
revenue_recovery_retry_algorithm_type: None,
revenue_recovery_retry_algorithm_data: None,
is_iframe_redirection_enabled: None,
is_external_vault_enabled: None,
external_vault_connector_details: None,
merchant_category_code: None,
merchant_country_code: None,
split_txns_enabled: None,
billing_processor_id: None,
},
ProfileUpdate::DecisionManagerRecordUpdate {
three_ds_decision_manager_config,
} => Self {
profile_name: None,
modified_at: now,
return_url: None,
enable_payment_response_hash: None,
payment_response_hash_key: None,
redirect_to_merchant_with_http_post: None,
webhook_details: None,
metadata: None,
is_recon_enabled: None,
applepay_verified_domains: None,
payment_link_config: None,
session_expiry: None,
authentication_connector_details: None,
payout_link_config: None,
is_extended_card_info_enabled: None,
extended_card_info_config: None,
is_connector_agnostic_mit_enabled: None,
use_billing_as_payment_method_billing: None,
collect_shipping_details_from_wallet_connector: None,
collect_billing_details_from_wallet_connector: None,
outgoing_webhook_custom_http_headers: None,
always_collect_billing_details_from_wallet_connector: None,
always_collect_shipping_details_from_wallet_connector: None,
routing_algorithm_id: None,
payout_routing_algorithm_id: None,
order_fulfillment_time: None,
order_fulfillment_time_origin: None,
frm_routing_algorithm_id: None,
default_fallback_routing: None,
should_collect_cvv_during_payment: None,
tax_connector_id: None,
is_tax_connector_enabled: None,
is_network_tokenization_enabled: None,
is_auto_retries_enabled: None,
max_auto_retries_enabled: None,
is_click_to_pay_enabled: None,
authentication_product_ids: None,
three_ds_decision_manager_config: Some(three_ds_decision_manager_config),
card_testing_guard_config: None,
card_testing_secret_key: None,
is_l2_l3_enabled: None,
is_clear_pan_retries_enabled: None,
is_debit_routing_enabled: None,
merchant_business_country: None,
revenue_recovery_retry_algorithm_type: None,
revenue_recovery_retry_algorithm_data: None,
is_iframe_redirection_enabled: None,
is_external_vault_enabled: None,
external_vault_connector_details: None,
merchant_category_code: None,
merchant_country_code: None,
split_txns_enabled: None,
billing_processor_id: None,
},
ProfileUpdate::CardTestingSecretKeyUpdate {
card_testing_secret_key,
} => Self {
profile_name: None,
modified_at: now,
return_url: None,
enable_payment_response_hash: None,
payment_response_hash_key: None,
redirect_to_merchant_with_http_post: None,
webhook_details: None,
metadata: None,
is_recon_enabled: None,
applepay_verified_domains: None,
payment_link_config: None,
session_expiry: None,
authentication_connector_details: None,
payout_link_config: None,
is_extended_card_info_enabled: None,
extended_card_info_config: None,
is_connector_agnostic_mit_enabled: None,
use_billing_as_payment_method_billing: None,
collect_shipping_details_from_wallet_connector: None,
collect_billing_details_from_wallet_connector: None,
outgoing_webhook_custom_http_headers: None,
always_collect_billing_details_from_wallet_connector: None,
always_collect_shipping_details_from_wallet_connector: None,
routing_algorithm_id: None,
payout_routing_algorithm_id: None,
order_fulfillment_time: None,
order_fulfillment_time_origin: None,
frm_routing_algorithm_id: None,
default_fallback_routing: None,
should_collect_cvv_during_payment: None,
tax_connector_id: None,
is_tax_connector_enabled: None,
is_network_tokenization_enabled: None,
is_auto_retries_enabled: None,
max_auto_retries_enabled: None,
is_click_to_pay_enabled: None,
authentication_product_ids: None,
three_ds_decision_manager_config: None,
card_testing_guard_config: None,
card_testing_secret_key: card_testing_secret_key.map(Encryption::from),
is_clear_pan_retries_enabled: None,
is_debit_routing_enabled: None,
is_l2_l3_enabled: None,
merchant_business_country: None,
revenue_recovery_retry_algorithm_type: None,
revenue_recovery_retry_algorithm_data: None,
is_iframe_redirection_enabled: None,
is_external_vault_enabled: None,
external_vault_connector_details: None,
merchant_category_code: None,
merchant_country_code: None,
split_txns_enabled: None,
billing_processor_id: None,
},
ProfileUpdate::RevenueRecoveryAlgorithmUpdate {
revenue_recovery_retry_algorithm_type,
revenue_recovery_retry_algorithm_data,
} => Self {
profile_name: None,
modified_at: now,
return_url: None,
enable_payment_response_hash: None,
payment_response_hash_key: None,
redirect_to_merchant_with_http_post: None,
webhook_details: None,
metadata: None,
is_recon_enabled: None,
applepay_verified_domains: None,
payment_link_config: None,
session_expiry: None,
authentication_connector_details: None,
payout_link_config: None,
is_extended_card_info_enabled: None,
extended_card_info_config: None,
is_connector_agnostic_mit_enabled: None,
use_billing_as_payment_method_billing: None,
collect_shipping_details_from_wallet_connector: None,
collect_billing_details_from_wallet_connector: None,
outgoing_webhook_custom_http_headers: None,
always_collect_billing_details_from_wallet_connector: None,
always_collect_shipping_details_from_wallet_connector: None,
routing_algorithm_id: None,
is_l2_l3_enabled: None,
payout_routing_algorithm_id: None,
order_fulfillment_time: None,
order_fulfillment_time_origin: None,
frm_routing_algorithm_id: None,
default_fallback_routing: None,
should_collect_cvv_during_payment: None,
tax_connector_id: None,
is_tax_connector_enabled: None,
is_network_tokenization_enabled: None,
is_auto_retries_enabled: None,
max_auto_retries_enabled: None,
is_click_to_pay_enabled: None,
authentication_product_ids: None,
three_ds_decision_manager_config: None,
card_testing_guard_config: None,
card_testing_secret_key: None,
is_clear_pan_retries_enabled: None,
is_debit_routing_enabled: None,
merchant_business_country: None,
revenue_recovery_retry_algorithm_type: Some(revenue_recovery_retry_algorithm_type),
revenue_recovery_retry_algorithm_data,
is_iframe_redirection_enabled: None,
is_external_vault_enabled: None,
external_vault_connector_details: None,
merchant_category_code: None,
merchant_country_code: None,
split_txns_enabled: None,
billing_processor_id: None,
},
}
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 2608,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_get_id_-6472051039913614710 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/business_profile
// Inherent implementation for Profile
pub fn get_id(&self) -> &common_utils::id_type::ProfileId {
&self.id
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 2472,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_convert_-6472051039913614710 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/business_profile
// Implementation of Profile for Conversion
async fn convert(self) -> CustomResult<Self::DstType, ValidationError> {
Ok(diesel_models::business_profile::Profile {
id: self.id,
merchant_id: self.merchant_id,
profile_name: self.profile_name,
created_at: self.created_at,
modified_at: self.modified_at,
return_url: self.return_url,
enable_payment_response_hash: self.enable_payment_response_hash,
payment_response_hash_key: self.payment_response_hash_key,
redirect_to_merchant_with_http_post: self.redirect_to_merchant_with_http_post,
webhook_details: self.webhook_details,
metadata: self.metadata,
is_recon_enabled: self.is_recon_enabled,
applepay_verified_domains: self.applepay_verified_domains,
payment_link_config: self.payment_link_config,
session_expiry: self.session_expiry,
authentication_connector_details: self.authentication_connector_details,
payout_link_config: self.payout_link_config,
is_extended_card_info_enabled: self.is_extended_card_info_enabled,
extended_card_info_config: self.extended_card_info_config,
is_connector_agnostic_mit_enabled: self.is_connector_agnostic_mit_enabled,
use_billing_as_payment_method_billing: self.use_billing_as_payment_method_billing,
collect_shipping_details_from_wallet_connector: self
.collect_shipping_details_from_wallet_connector,
collect_billing_details_from_wallet_connector: self
.collect_billing_details_from_wallet_connector,
outgoing_webhook_custom_http_headers: self
.outgoing_webhook_custom_http_headers
.map(Encryption::from),
routing_algorithm_id: self.routing_algorithm_id,
always_collect_billing_details_from_wallet_connector: self
.always_collect_billing_details_from_wallet_connector,
always_collect_shipping_details_from_wallet_connector: self
.always_collect_shipping_details_from_wallet_connector,
payout_routing_algorithm_id: self.payout_routing_algorithm_id,
order_fulfillment_time: self.order_fulfillment_time,
order_fulfillment_time_origin: self.order_fulfillment_time_origin,
frm_routing_algorithm_id: self.frm_routing_algorithm_id,
default_fallback_routing: self.default_fallback_routing,
should_collect_cvv_during_payment: self.should_collect_cvv_during_payment,
tax_connector_id: self.tax_connector_id,
is_tax_connector_enabled: Some(self.is_tax_connector_enabled),
version: self.version,
dynamic_routing_algorithm: None,
is_network_tokenization_enabled: self.is_network_tokenization_enabled,
is_auto_retries_enabled: None,
max_auto_retries_enabled: None,
always_request_extended_authorization: None,
is_click_to_pay_enabled: self.is_click_to_pay_enabled,
authentication_product_ids: self.authentication_product_ids,
three_ds_decision_manager_config: self.three_ds_decision_manager_config,
card_testing_guard_config: self.card_testing_guard_config,
card_testing_secret_key: self.card_testing_secret_key.map(|name| name.into()),
is_clear_pan_retries_enabled: self.is_clear_pan_retries_enabled,
force_3ds_challenge: None,
is_debit_routing_enabled: self.is_debit_routing_enabled,
merchant_business_country: self.merchant_business_country,
revenue_recovery_retry_algorithm_type: self.revenue_recovery_retry_algorithm_type,
revenue_recovery_retry_algorithm_data: self.revenue_recovery_retry_algorithm_data,
is_iframe_redirection_enabled: self.is_iframe_redirection_enabled,
is_external_vault_enabled: self.is_external_vault_enabled,
external_vault_connector_details: self.external_vault_connector_details,
three_ds_decision_rule_algorithm: None,
acquirer_config_map: None,
merchant_category_code: self.merchant_category_code,
merchant_country_code: self.merchant_country_code,
dispute_polling_interval: None,
split_txns_enabled: Some(self.split_txns_enabled),
is_manual_retry_enabled: None,
is_l2_l3_enabled: None,
always_enable_overcapture: None,
billing_processor_id: self.billing_processor_id,
})
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 368,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_convert_back_-6472051039913614710 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/business_profile
// Implementation of Profile for Conversion
async fn convert_back(
state: &keymanager::KeyManagerState,
item: Self::DstType,
key: &Secret<Vec<u8>>,
key_manager_identifier: keymanager::Identifier,
) -> CustomResult<Self, ValidationError>
where
Self: Sized,
{
async {
Ok::<Self, error_stack::Report<common_utils::errors::CryptoError>>(Self {
id: item.id,
merchant_id: item.merchant_id,
profile_name: item.profile_name,
created_at: item.created_at,
modified_at: item.modified_at,
return_url: item.return_url,
enable_payment_response_hash: item.enable_payment_response_hash,
payment_response_hash_key: item.payment_response_hash_key,
redirect_to_merchant_with_http_post: item.redirect_to_merchant_with_http_post,
webhook_details: item.webhook_details,
metadata: item.metadata,
is_recon_enabled: item.is_recon_enabled,
applepay_verified_domains: item.applepay_verified_domains,
payment_link_config: item.payment_link_config,
session_expiry: item.session_expiry,
authentication_connector_details: item.authentication_connector_details,
payout_link_config: item.payout_link_config,
is_extended_card_info_enabled: item.is_extended_card_info_enabled,
extended_card_info_config: item.extended_card_info_config,
is_connector_agnostic_mit_enabled: item.is_connector_agnostic_mit_enabled,
use_billing_as_payment_method_billing: item.use_billing_as_payment_method_billing,
collect_shipping_details_from_wallet_connector: item
.collect_shipping_details_from_wallet_connector,
collect_billing_details_from_wallet_connector: item
.collect_billing_details_from_wallet_connector,
outgoing_webhook_custom_http_headers: item
.outgoing_webhook_custom_http_headers
.async_lift(|inner| async {
crypto_operation(
state,
type_name!(Self::DstType),
CryptoOperation::DecryptOptional(inner),
key_manager_identifier.clone(),
key.peek(),
)
.await
.and_then(|val| val.try_into_optionaloperation())
})
.await?,
routing_algorithm_id: item.routing_algorithm_id,
always_collect_billing_details_from_wallet_connector: item
.always_collect_billing_details_from_wallet_connector,
always_collect_shipping_details_from_wallet_connector: item
.always_collect_shipping_details_from_wallet_connector,
order_fulfillment_time: item.order_fulfillment_time,
order_fulfillment_time_origin: item.order_fulfillment_time_origin,
frm_routing_algorithm_id: item.frm_routing_algorithm_id,
payout_routing_algorithm_id: item.payout_routing_algorithm_id,
default_fallback_routing: item.default_fallback_routing,
should_collect_cvv_during_payment: item.should_collect_cvv_during_payment,
tax_connector_id: item.tax_connector_id,
is_tax_connector_enabled: item.is_tax_connector_enabled.unwrap_or(false),
version: item.version,
is_network_tokenization_enabled: item.is_network_tokenization_enabled,
is_click_to_pay_enabled: item.is_click_to_pay_enabled,
authentication_product_ids: item.authentication_product_ids,
three_ds_decision_manager_config: item.three_ds_decision_manager_config,
card_testing_guard_config: item.card_testing_guard_config,
card_testing_secret_key: match item.card_testing_secret_key {
Some(encrypted_value) => crypto_operation(
state,
type_name!(Self::DstType),
CryptoOperation::DecryptOptional(Some(encrypted_value)),
key_manager_identifier.clone(),
key.peek(),
)
.await
.and_then(|val| val.try_into_optionaloperation())
.unwrap_or_default(),
None => None,
},
is_clear_pan_retries_enabled: item.is_clear_pan_retries_enabled,
is_debit_routing_enabled: item.is_debit_routing_enabled,
merchant_business_country: item.merchant_business_country,
revenue_recovery_retry_algorithm_type: item.revenue_recovery_retry_algorithm_type,
revenue_recovery_retry_algorithm_data: item.revenue_recovery_retry_algorithm_data,
is_iframe_redirection_enabled: item.is_iframe_redirection_enabled,
is_external_vault_enabled: item.is_external_vault_enabled,
external_vault_connector_details: item.external_vault_connector_details,
merchant_category_code: item.merchant_category_code,
merchant_country_code: item.merchant_country_code,
split_txns_enabled: item.split_txns_enabled.unwrap_or_default(),
billing_processor_id: item.billing_processor_id,
})
}
.await
.change_context(ValidationError::InvalidValue {
message: "Failed while decrypting business profile data".to_string(),
})
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 140,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_new_-2900786723891564735 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/invoice
// Inherent implementation for InvoiceUpdate
pub fn new(
payment_method_id: Option<String>,
status: Option<common_enums::connector_enums::InvoiceStatus>,
connector_invoice_id: Option<common_utils::id_type::InvoiceId>,
payment_intent_id: Option<common_utils::id_type::PaymentId>,
amount: Option<MinorUnit>,
currency: Option<String>,
) -> Self {
Self {
status,
payment_method_id,
connector_invoice_id,
modified_at: common_utils::date_time::now(),
payment_intent_id,
amount,
currency,
}
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 14465,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_from_-2900786723891564735 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/invoice
// Implementation of InvoiceUpdate for From<InvoiceUpdateRequest>
fn from(request: InvoiceUpdateRequest) -> Self {
let now = common_utils::date_time::now();
match request {
InvoiceUpdateRequest::Amount(update) => Self {
status: None,
payment_method_id: None,
connector_invoice_id: None,
modified_at: now,
payment_intent_id: None,
amount: Some(update.amount),
currency: Some(update.currency),
},
InvoiceUpdateRequest::Connector(update) => Self {
status: Some(update.status),
payment_method_id: None,
connector_invoice_id: Some(update.connector_invoice_id),
modified_at: now,
payment_intent_id: None,
amount: None,
currency: None,
},
InvoiceUpdateRequest::PaymentStatus(update) => Self {
status: Some(update.status),
payment_method_id: update
.payment_method_id
.as_ref()
.map(|id| id.peek())
.cloned(),
connector_invoice_id: update.connector_invoice_id,
modified_at: now,
payment_intent_id: update.payment_intent_id,
amount: None,
currency: None,
},
}
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 2610,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_convert_-2900786723891564735 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/invoice
// Implementation of InvoiceUpdate for super::behaviour::Conversion
async fn convert(self) -> CustomResult<Self::DstType, ValidationError> {
Ok(diesel_models::invoice::InvoiceUpdate {
status: self.status,
payment_method_id: self.payment_method_id,
connector_invoice_id: self.connector_invoice_id,
modified_at: self.modified_at,
payment_intent_id: self.payment_intent_id,
amount: self.amount,
currency: self.currency,
})
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 362,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_convert_back_-2900786723891564735 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/invoice
// Implementation of InvoiceUpdate for super::behaviour::Conversion
async fn convert_back(
_state: &KeyManagerState,
item: Self::DstType,
_key: &Secret<Vec<u8>>,
_key_manager_identifier: Identifier,
) -> CustomResult<Self, ValidationError>
where
Self: Sized,
{
Ok(Self {
status: item.status,
payment_method_id: item.payment_method_id,
connector_invoice_id: item.connector_invoice_id,
modified_at: item.modified_at,
payment_intent_id: item.payment_intent_id,
amount: item.amount,
currency: item.currency,
})
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 104,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_update_payment_and_status_-2900786723891564735 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/invoice
// Inherent implementation for InvoiceUpdateRequest
/// Create a combined payment and status update request
pub fn update_payment_and_status(
payment_method_id: Option<Secret<String>>,
payment_intent_id: Option<common_utils::id_type::PaymentId>,
status: common_enums::connector_enums::InvoiceStatus,
connector_invoice_id: Option<common_utils::id_type::InvoiceId>,
) -> Self {
Self::PaymentStatus(PaymentAndStatusUpdate {
payment_method_id,
payment_intent_id,
status,
connector_invoice_id,
})
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 26,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_from_-4052532423884865691 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/customer
// Implementation of query::CustomerListConstraints for From<CustomerListConstraints>
fn from(value: CustomerListConstraints) -> Self {
Self {
limit: i64::from(value.limit),
offset: value.offset.map(i64::from),
customer_id: value.customer_id,
time_range: value.time_range,
}
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 2604,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_get_id_-4052532423884865691 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/customer
// Implementation of None for Customer
pub fn get_id(&self) -> &id_type::GlobalCustomerId {
&self.id
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 2472,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_convert_-4052532423884865691 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/customer
// Implementation of Customer for behaviour::Conversion
async fn convert(self) -> CustomResult<Self::DstType, ValidationError> {
Ok(diesel_models::customers::Customer {
id: self.id,
merchant_reference_id: self.merchant_reference_id,
merchant_id: self.merchant_id,
name: self.name.map(Encryption::from),
email: self.email.map(Encryption::from),
phone: self.phone.map(Encryption::from),
phone_country_code: self.phone_country_code,
description: self.description,
created_at: self.created_at,
metadata: self.metadata,
modified_at: self.modified_at,
connector_customer: self.connector_customer,
default_payment_method_id: self.default_payment_method_id,
updated_by: self.updated_by,
default_billing_address: self.default_billing_address,
default_shipping_address: self.default_shipping_address,
version: self.version,
status: self.status,
tax_registration_id: self.tax_registration_id.map(Encryption::from),
})
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 370,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_convert_back_-4052532423884865691 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/customer
// Implementation of Customer for behaviour::Conversion
async fn convert_back(
state: &KeyManagerState,
item: Self::DstType,
key: &Secret<Vec<u8>>,
_key_store_ref_id: keymanager::Identifier,
) -> CustomResult<Self, ValidationError>
where
Self: Sized,
{
let decrypted = types::crypto_operation(
state,
common_utils::type_name!(Self::DstType),
types::CryptoOperation::BatchDecrypt(EncryptedCustomer::to_encryptable(
EncryptedCustomer {
name: item.name.clone(),
phone: item.phone.clone(),
email: item.email.clone(),
tax_registration_id: item.tax_registration_id.clone(),
},
)),
keymanager::Identifier::Merchant(item.merchant_id.clone()),
key.peek(),
)
.await
.and_then(|val| val.try_into_batchoperation())
.change_context(ValidationError::InvalidValue {
message: "Failed while decrypting customer data".to_string(),
})?;
let encryptable_customer = EncryptedCustomer::from_encryptable(decrypted).change_context(
ValidationError::InvalidValue {
message: "Failed while decrypting customer data".to_string(),
},
)?;
Ok(Self {
id: item.id,
merchant_reference_id: item.merchant_reference_id,
merchant_id: item.merchant_id,
name: encryptable_customer.name,
email: encryptable_customer.email.map(|email| {
let encryptable: Encryptable<Secret<String, pii::EmailStrategy>> = Encryptable::new(
email.clone().into_inner().switch_strategy(),
email.into_encrypted(),
);
encryptable
}),
phone: encryptable_customer.phone,
phone_country_code: item.phone_country_code,
description: item.description,
created_at: item.created_at,
metadata: item.metadata,
modified_at: item.modified_at,
connector_customer: item.connector_customer,
default_payment_method_id: item.default_payment_method_id,
updated_by: item.updated_by,
default_billing_address: item.default_billing_address,
default_shipping_address: item.default_shipping_address,
version: item.version,
status: item.status,
tax_registration_id: encryptable_customer.tax_registration_id,
})
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 150,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_get_connector_customer_id_-4052532423884865691 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/customer
// Implementation of None for Customer
pub fn get_connector_customer_id(
&self,
merchant_connector_account: &MerchantConnectorAccountTypeDetails,
) -> Option<&str> {
match merchant_connector_account {
MerchantConnectorAccountTypeDetails::MerchantConnectorAccount(account) => {
let connector_account_id = account.get_id();
self.connector_customer
.as_ref()?
.get(&connector_account_id)
.map(|connector_customer_id| connector_customer_id.as_str())
}
MerchantConnectorAccountTypeDetails::MerchantConnectorDetails(_) => None,
}
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 64,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_new_-5204431252008778834 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/router_response_types
// Inherent implementation for ConnectorCustomerResponseData
pub fn new(
connector_customer_id: String,
name: Option<String>,
email: Option<String>,
billing_address: Option<AddressDetails>,
) -> Self {
Self {
connector_customer_id,
name,
email,
billing_address,
}
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 14463,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_default_-5204431252008778834 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/router_response_types
// Implementation of VaultResponseData for Default
fn default() -> Self {
Self::ExternalVaultInsertResponse {
connector_vault_id: String::new(),
fingerprint_id: String::new(),
}
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 7707,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_from_-5204431252008778834 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/router_response_types
// Implementation of RedirectForm for From<diesel_models::payment_attempt::RedirectForm>
fn from(redirect_form: diesel_models::payment_attempt::RedirectForm) -> Self {
match redirect_form {
diesel_models::payment_attempt::RedirectForm::Form {
endpoint,
method,
form_fields,
} => Self::Form {
endpoint,
method,
form_fields,
},
diesel_models::payment_attempt::RedirectForm::Html { html_data } => {
Self::Html { html_data }
}
diesel_models::payment_attempt::RedirectForm::BarclaycardAuthSetup {
access_token,
ddc_url,
reference_id,
} => Self::BarclaycardAuthSetup {
access_token,
ddc_url,
reference_id,
},
diesel_models::payment_attempt::RedirectForm::BarclaycardConsumerAuth {
access_token,
step_up_url,
} => Self::BarclaycardConsumerAuth {
access_token,
step_up_url,
},
diesel_models::payment_attempt::RedirectForm::BlueSnap {
payment_fields_token,
} => Self::BlueSnap {
payment_fields_token,
},
diesel_models::payment_attempt::RedirectForm::CybersourceAuthSetup {
access_token,
ddc_url,
reference_id,
} => Self::CybersourceAuthSetup {
access_token,
ddc_url,
reference_id,
},
diesel_models::payment_attempt::RedirectForm::CybersourceConsumerAuth {
access_token,
step_up_url,
} => Self::CybersourceConsumerAuth {
access_token,
step_up_url,
},
diesel_models::RedirectForm::DeutschebankThreeDSChallengeFlow { acs_url, creq } => {
Self::DeutschebankThreeDSChallengeFlow { acs_url, creq }
}
diesel_models::payment_attempt::RedirectForm::Payme => Self::Payme,
diesel_models::payment_attempt::RedirectForm::Braintree {
client_token,
card_token,
bin,
acs_url,
} => Self::Braintree {
client_token,
card_token,
bin,
acs_url,
},
diesel_models::payment_attempt::RedirectForm::Nmi {
amount,
currency,
public_key,
customer_vault_id,
order_id,
} => Self::Nmi {
amount,
currency,
public_key,
customer_vault_id,
order_id,
},
diesel_models::payment_attempt::RedirectForm::Mifinity {
initialization_token,
} => Self::Mifinity {
initialization_token,
},
diesel_models::payment_attempt::RedirectForm::WorldpayDDCForm {
endpoint,
method,
form_fields,
collection_id,
} => Self::WorldpayDDCForm {
endpoint: endpoint.into_inner(),
method,
form_fields,
collection_id,
},
}
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 2602,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_get_connector_transaction_id_-5204431252008778834 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/router_response_types
// Inherent implementation for PaymentsResponseData
pub fn get_connector_transaction_id(
&self,
) -> Result<String, error_stack::Report<ApiErrorResponse>> {
match self {
Self::TransactionResponse {
resource_id: ResponseId::ConnectorTransactionId(txn_id),
..
} => Ok(txn_id.to_string()),
_ => Err(ApiErrorResponse::MissingRequiredField {
field_name: "ConnectorTransactionId",
}
.into()),
}
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 1273,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_add_-5204431252008778834 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/router_response_types
// Implementation of SupportedPaymentMethods for SupportedPaymentMethodsExt
fn add(
&mut self,
payment_method: common_enums::PaymentMethod,
payment_method_type: common_enums::PaymentMethodType,
payment_method_details: PaymentMethodDetails,
) {
if let Some(payment_method_data) = self.get_mut(&payment_method) {
payment_method_data.insert(payment_method_type, payment_method_details);
} else {
let mut payment_method_type_metadata = PaymentMethodTypeMetadata::new();
payment_method_type_metadata.insert(payment_method_type, payment_method_details);
self.insert(payment_method, payment_method_type_metadata);
}
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 699,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_try_from_-8958099229487661895 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/gsm
// Implementation of GatewayStatusMap for TryFrom<diesel_models::gsm::GatewayStatusMap>
fn try_from(item: diesel_models::gsm::GatewayStatusMap) -> Result<Self, Self::Error> {
let decision =
StringExt::<common_enums::GsmDecision>::parse_enum(item.decision, "GsmDecision")
.map_err(|_| ValidationError::InvalidValue {
message: "Failed to parse GsmDecision".to_string(),
})?;
let db_feature_data = item.feature_data;
// The only case where `FeatureData` can be null is for legacy records
// (i.e., records created before `FeatureData` and related features were introduced).
// At that time, the only supported feature was `Retry`, so it's safe to default to it.
let feature_data = match db_feature_data {
Some(common_types::domain::GsmFeatureData::Retry(data)) => {
common_types::domain::GsmFeatureData::Retry(data)
}
None => common_types::domain::GsmFeatureData::Retry(
common_types::domain::RetryFeatureData {
step_up_possible: item.step_up_possible,
clear_pan_possible: item.clear_pan_possible,
alternate_network_possible: false,
decision,
},
),
};
let feature = item.feature.unwrap_or(common_enums::GsmFeature::Retry);
Ok(Self {
connector: item.connector,
flow: item.flow,
sub_flow: item.sub_flow,
code: item.code,
message: item.message,
status: item.status,
router_error: item.router_error,
unified_code: item.unified_code,
unified_message: item.unified_message,
error_category: item.error_category,
feature_data,
feature,
})
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 2669,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_from_-6884595852533252866 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/revenue_recovery
// Implementation of RecoveryPaymentAttempt for From<&payments::payment_attempt::PaymentAttempt>
fn from(payment_attempt: &payments::payment_attempt::PaymentAttempt) -> Self {
Self {
attempt_id: payment_attempt.id.clone(),
attempt_status: payment_attempt.status,
feature_metadata: payment_attempt
.feature_metadata
.clone()
.map(
|feature_metadata| api_payments::PaymentAttemptFeatureMetadata {
revenue_recovery: feature_metadata.revenue_recovery.map(|recovery| {
api_payments::PaymentAttemptRevenueRecoveryData {
attempt_triggered_by: recovery.attempt_triggered_by,
charge_id: recovery.charge_id,
}
}),
},
),
amount: payment_attempt.amount_details.get_net_amount(),
network_advice_code: payment_attempt
.error
.clone()
.and_then(|error| error.network_advice_code),
network_decline_code: payment_attempt
.error
.clone()
.and_then(|error| error.network_decline_code),
error_code: payment_attempt
.error
.as_ref()
.map(|error| error.code.clone()),
created_at: payment_attempt.created_at,
}
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 2624,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_get_attempt_triggered_by_-6884595852533252866 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/revenue_recovery
// Inherent implementation for RecoveryPaymentAttempt
pub fn get_attempt_triggered_by(&self) -> Option<common_enums::TriggeredBy> {
self.feature_metadata.as_ref().and_then(|metadata| {
metadata
.revenue_recovery
.as_ref()
.map(|recovery| recovery.attempt_triggered_by)
})
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 29,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_try_from_-5854450698482158634 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/payment_method_data
// Implementation of Card for TryFrom<(
cards::CardNumber,
Option<&CardToken>,
Option<payment_methods::CoBadgedCardData>,
CardDetailsPaymentMethod,
)>
fn try_from(
value: (
cards::CardNumber,
Option<&CardToken>,
Option<payment_methods::CoBadgedCardData>,
CardDetailsPaymentMethod,
),
) -> Result<Self, Self::Error> {
let (card_number, card_token_data, co_badged_card_data, card_details) = value;
// The card_holder_name from locker retrieved card is considered if it is a non-empty string or else card_holder_name is picked
let name_on_card = if let Some(name) = card_details.card_holder_name.clone() {
if name.clone().expose().is_empty() {
card_token_data
.and_then(|token_data| token_data.card_holder_name.clone())
.or(Some(name))
} else {
Some(name)
}
} else {
card_token_data.and_then(|token_data| token_data.card_holder_name.clone())
};
Ok(Self {
card_number,
card_exp_month: card_details
.expiry_month
.get_required_value("expiry_month")?
.clone(),
card_exp_year: card_details
.expiry_year
.get_required_value("expiry_year")?
.clone(),
card_holder_name: name_on_card,
card_cvc: card_token_data
.cloned()
.unwrap_or_default()
.card_cvc
.unwrap_or_default(),
card_issuer: card_details.card_issuer,
card_network: card_details.card_network,
card_type: card_details.card_type,
card_issuing_country: card_details.issuer_country,
bank_code: None,
nick_name: card_details.nick_name,
co_badged_card_data,
})
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 2689,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_from_-5854450698482158634 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/payment_method_data
// Implementation of Card for From<(
payment_methods::CardDetail,
Option<&CardToken>,
Option<payment_methods::CoBadgedCardData>,
)>
fn from(
value: (
payment_methods::CardDetail,
Option<&CardToken>,
Option<payment_methods::CoBadgedCardData>,
),
) -> Self {
let (
payment_methods::CardDetail {
card_number,
card_exp_month,
card_exp_year,
card_holder_name,
nick_name,
card_network,
card_issuer,
card_issuing_country,
card_type,
},
card_token_data,
co_badged_card_data,
) = value;
// The card_holder_name from locker retrieved card is considered if it is a non-empty string or else card_holder_name is picked
let name_on_card = if let Some(name) = card_holder_name.clone() {
if name.clone().expose().is_empty() {
card_token_data
.and_then(|token_data| token_data.card_holder_name.clone())
.or(Some(name))
} else {
card_holder_name
}
} else {
card_token_data.and_then(|token_data| token_data.card_holder_name.clone())
};
Self {
card_number,
card_exp_month,
card_exp_year,
card_holder_name: name_on_card,
card_cvc: card_token_data
.cloned()
.unwrap_or_default()
.card_cvc
.unwrap_or_default(),
card_issuer,
card_network,
card_type,
card_issuing_country,
bank_code: None,
nick_name,
co_badged_card_data,
}
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 2624,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_get_payment_method_type_-5854450698482158634 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/payment_method_data
// Implementation of MobilePaymentData for GetPaymentMethodType
fn get_payment_method_type(&self) -> api_enums::PaymentMethodType {
match self {
Self::DirectCarrierBilling { .. } => api_enums::PaymentMethodType::DirectCarrierBilling,
}
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 119,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_get_additional_payout_method_data_-5854450698482158634 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/payment_method_data
// Implementation of None for PaymentMethodsData
pub fn get_additional_payout_method_data(
&self,
) -> Option<payout_method_utils::AdditionalPayoutMethodData> {
match self {
Self::Card(card_details) => {
router_env::logger::info!("Populating AdditionalPayoutMethodData from Card payment method data for recurring payout");
Some(payout_method_utils::AdditionalPayoutMethodData::Card(
Box::new(payout_method_utils::CardAdditionalData {
card_issuer: card_details.card_issuer.clone(),
card_network: card_details.card_network.clone(),
bank_code: None,
card_type: card_details.card_type.clone(),
card_issuing_country: card_details.issuer_country.clone(),
last4: card_details.last4_digits.clone(),
card_isin: card_details.card_isin.clone(),
card_extended_bin: None,
card_exp_month: card_details.expiry_month.clone(),
card_exp_year: card_details.expiry_year.clone(),
card_holder_name: card_details.card_holder_name.clone(),
}),
))
}
Self::BankDetails(_) | Self::WalletDetails(_) | Self::NetworkToken(_) => None,
}
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 43,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_get_issuer_country_alpha2_-5854450698482158634 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/payment_method_data
// Inherent implementation for CardDetailsPaymentMethod
pub fn get_issuer_country_alpha2(self) -> Option<common_enums::CountryAlpha2> {
self.issuer_country
.as_ref()
.map(|c| api_enums::CountryAlpha2::from_str(c))
.transpose()
.ok()
.flatten()
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 33,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_convert_-5279669172407207645 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/merchant_key_store
// Implementation of MerchantKeyStore for super::behaviour::Conversion
async fn convert(self) -> CustomResult<Self::DstType, ValidationError> {
Ok(diesel_models::merchant_key_store::MerchantKeyStore {
key: self.key.into(),
merchant_id: self.merchant_id,
created_at: self.created_at,
})
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 364,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_convert_back_-5279669172407207645 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/merchant_key_store
// Implementation of MerchantKeyStore for super::behaviour::Conversion
async fn convert_back(
state: &KeyManagerState,
item: Self::DstType,
key: &Secret<Vec<u8>>,
_key_manager_identifier: keymanager::Identifier,
) -> CustomResult<Self, ValidationError>
where
Self: Sized,
{
let identifier = keymanager::Identifier::Merchant(item.merchant_id.clone());
Ok(Self {
key: crypto_operation(
state,
type_name!(Self::DstType),
CryptoOperation::Decrypt(item.key),
identifier,
key.peek(),
)
.await
.and_then(|val| val.try_into_operation())
.change_context(ValidationError::InvalidValue {
message: "Failed while decrypting customer data".to_string(),
})?,
merchant_id: item.merchant_id,
created_at: item.created_at,
})
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 122,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_construct_new_-5279669172407207645 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/merchant_key_store
// Implementation of MerchantKeyStore for super::behaviour::Conversion
async fn construct_new(self) -> CustomResult<Self::NewDstType, ValidationError> {
Ok(diesel_models::merchant_key_store::MerchantKeyStoreNew {
merchant_id: self.merchant_id,
key: self.key.into(),
created_at: date_time::now(),
})
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 18,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_from_7275414759979710700 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/routing
// Implementation of PaymentRoutingInfoSerde for From<PaymentRoutingInfo>
fn from(value: PaymentRoutingInfo) -> Self {
Self::WithDetails(Box::new(PaymentRoutingInfoInner {
algorithm: value.algorithm,
pre_routing_results: value.pre_routing_results,
}))
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 2604,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_from_-4364040930842039770 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/mandates
// Implementation of diesel_models::PaymentsMandateReferenceRecord for From<PaymentsMandateReferenceRecord>
fn from(value: PaymentsMandateReferenceRecord) -> Self {
Self {
connector_mandate_id: value.connector_mandate_id,
payment_method_type: value.payment_method_type,
original_payment_authorized_amount: value.original_payment_authorized_amount,
original_payment_authorized_currency: value.original_payment_authorized_currency,
mandate_metadata: value.mandate_metadata,
connector_mandate_status: value.connector_mandate_status,
connector_mandate_request_reference_id: value.connector_mandate_request_reference_id,
}
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 2600,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_get_metadata_-4364040930842039770 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/mandates
// Inherent implementation for MandateAmountData
pub fn get_metadata(&self) -> Option<pii::SecretSerdeValue> {
self.metadata.clone()
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 113,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_get_mandate_details_value_-4364040930842039770 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/mandates
// Implementation of None for CommonMandateReference
pub fn get_mandate_details_value(&self) -> CustomResult<serde_json::Value, ParsingError> {
let mut payments = self
.payments
.as_ref()
.map_or_else(|| Ok(serde_json::json!({})), serde_json::to_value)
.change_context(ParsingError::StructParseFailure("payment mandate details"))?;
self.payouts
.as_ref()
.map(|payouts_mandate| {
serde_json::to_value(payouts_mandate).map(|payouts_mandate_value| {
payments.as_object_mut().map(|payments_object| {
payments_object.insert("payouts".to_string(), payouts_mandate_value);
})
})
})
.transpose()
.change_context(ParsingError::StructParseFailure("payout mandate details"))?;
Ok(payments)
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 63,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_deref_-4364040930842039770 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/mandates
// Implementation of PaymentsTokenReference for std::ops::Deref
fn deref(&self) -> &Self::Target {
&self.0
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 41,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_insert_payment_token_reference_record_-4364040930842039770 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/mandates
// Implementation of None for CommonMandateReference
/// Insert a new payment token reference for the given connector_id
pub fn insert_payment_token_reference_record(
&mut self,
connector_id: &common_utils::id_type::MerchantConnectorAccountId,
record: ConnectorTokenReferenceRecord,
) {
match self.payments {
Some(ref mut payments_reference) => {
payments_reference.insert(connector_id.clone(), record);
}
None => {
let mut payments_reference = HashMap::new();
payments_reference.insert(connector_id.clone(), record);
self.payments = Some(PaymentsTokenReference(payments_reference));
}
}
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 33,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_convert_-6749550008526123562 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/behaviour
// Implementation of T for ReverseConversion<U>
async fn convert(
self,
state: &KeyManagerState,
key: &Secret<Vec<u8>>,
key_manager_identifier: Identifier,
) -> CustomResult<U, ValidationError> {
U::convert_back(state, self, key, key_manager_identifier).await
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 364,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_fmt_-3058639404335295690 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/api
// Implementation of GenericLinksData for Display
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(
f,
"{}",
match *self {
Self::ExpiredLink(_) => "ExpiredLink",
Self::PaymentMethodCollect(_) => "PaymentMethodCollect",
Self::PayoutLink(_) => "PayoutLink",
Self::PayoutLinkStatus(_) => "PayoutLinkStatus",
Self::PaymentMethodCollectStatus(_) => "PaymentMethodCollectStatus",
Self::SecurePaymentLink(_) => "SecurePaymentLink",
}
)
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 38,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_get_json_body_-3058639404335295690 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/api
// Inherent implementation for ApplicationResponse<R>
pub fn get_json_body(
self,
) -> common_utils::errors::CustomResult<R, common_utils::errors::ValidationError> {
match self {
Self::Json(body) | Self::JsonWithHeaders((body, _)) => Ok(body),
Self::TextPlain(_)
| Self::JsonForRedirection(_)
| Self::Form(_)
| Self::PaymentLinkForm(_)
| Self::FileData(_)
| Self::GenericLinkForm(_)
| Self::StatusOk => Err(common_utils::errors::ValidationError::InvalidValue {
message: "expected either Json or JsonWithHeaders Response".to_string(),
}
.into()),
}
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 34,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_get_api_event_type_-3058639404335295690 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/api
// Implementation of ApplicationResponse<T> for ApiEventMetric
fn get_api_event_type(&self) -> Option<ApiEventsType> {
match self {
Self::Json(r) => r.get_api_event_type(),
Self::JsonWithHeaders((r, _)) => r.get_api_event_type(),
_ => None,
}
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 30,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_new_3459423804188263305 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/relay
// Inherent implementation for Relay
pub fn new(
relay_request: &api_models::relay::RelayRequest,
merchant_id: &id_type::MerchantId,
profile_id: &id_type::ProfileId,
) -> Self {
let relay_id = id_type::RelayId::generate();
Self {
id: relay_id.clone(),
connector_resource_id: relay_request.connector_resource_id.clone(),
connector_id: relay_request.connector_id.clone(),
profile_id: profile_id.clone(),
merchant_id: merchant_id.clone(),
relay_type: common_enums::RelayType::Refund,
request_data: relay_request.data.clone().map(From::from),
status: common_enums::RelayStatus::Created,
connector_reference_id: None,
error_code: None,
error_message: None,
created_at: common_utils::date_time::now(),
modified_at: common_utils::date_time::now(),
response_data: None,
}
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 14483,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_from_3459423804188263305 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/relay
// Implementation of RelayUpdateInternal for From<RelayUpdate>
fn from(value: RelayUpdate) -> Self {
match value {
RelayUpdate::ErrorUpdate {
error_code,
error_message,
status,
} => Self {
error_code: Some(error_code),
error_message: Some(error_message),
connector_reference_id: None,
status: Some(status),
modified_at: common_utils::date_time::now(),
},
RelayUpdate::StatusUpdate {
connector_reference_id,
status,
} => Self {
connector_reference_id,
status: Some(status),
error_code: None,
error_message: None,
modified_at: common_utils::date_time::now(),
},
}
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 2604,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_convert_3459423804188263305 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/relay
// Implementation of Relay for super::behaviour::Conversion
async fn convert(self) -> CustomResult<Self::DstType, ValidationError> {
Ok(diesel_models::relay::Relay {
id: self.id,
connector_resource_id: self.connector_resource_id,
connector_id: self.connector_id,
profile_id: self.profile_id,
merchant_id: self.merchant_id,
relay_type: self.relay_type,
request_data: self
.request_data
.map(|data| {
serde_json::to_value(data).change_context(ValidationError::InvalidValue {
message: "Failed while decrypting business profile data".to_string(),
})
})
.transpose()?
.map(Secret::new),
status: self.status,
connector_reference_id: self.connector_reference_id,
error_code: self.error_code,
error_message: self.error_message,
created_at: self.created_at,
modified_at: self.modified_at,
response_data: self.response_data,
})
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 374,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_convert_back_3459423804188263305 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/relay
// Implementation of Relay for super::behaviour::Conversion
async fn convert_back(
_state: &keymanager::KeyManagerState,
item: Self::DstType,
_key: &Secret<Vec<u8>>,
_key_manager_identifier: keymanager::Identifier,
) -> CustomResult<Self, ValidationError> {
Ok(Self {
id: item.id,
connector_resource_id: item.connector_resource_id,
connector_id: item.connector_id,
profile_id: item.profile_id,
merchant_id: item.merchant_id,
relay_type: enums::RelayType::Refund,
request_data: item
.request_data
.map(|data| {
serde_json::from_value(data.expose()).change_context(
ValidationError::InvalidValue {
message: "Failed while decrypting business profile data".to_string(),
},
)
})
.transpose()?,
status: item.status,
connector_reference_id: item.connector_reference_id,
error_code: item.error_code,
error_message: item.error_message,
created_at: item.created_at,
modified_at: item.modified_at,
response_data: item.response_data,
})
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 116,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_construct_new_3459423804188263305 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/relay
// Implementation of Relay for super::behaviour::Conversion
async fn construct_new(self) -> CustomResult<Self::NewDstType, ValidationError> {
Ok(diesel_models::relay::RelayNew {
id: self.id,
connector_resource_id: self.connector_resource_id,
connector_id: self.connector_id,
profile_id: self.profile_id,
merchant_id: self.merchant_id,
relay_type: self.relay_type,
request_data: self
.request_data
.map(|data| {
serde_json::to_value(data).change_context(ValidationError::InvalidValue {
message: "Failed while decrypting business profile data".to_string(),
})
})
.transpose()?
.map(Secret::new),
status: self.status,
connector_reference_id: self.connector_reference_id,
error_code: self.error_code,
error_message: self.error_message,
created_at: self.created_at,
modified_at: self.modified_at,
response_data: self.response_data,
})
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 26,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_try_from_2375544413912889798 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/vault
// Implementation of PaymentMethodVaultingData for TryFrom<payment_methods::PaymentMethodCreateData>
fn try_from(item: payment_methods::PaymentMethodCreateData) -> Result<Self, Self::Error> {
match item {
payment_methods::PaymentMethodCreateData::Card(card) => Ok(Self::Card(card)),
payment_methods::PaymentMethodCreateData::ProxyCard(card) => Err(
errors::api_error_response::ApiErrorResponse::UnprocessableEntity {
message: "Proxy Card for PaymentMethodCreateData".to_string(),
}
.into(),
),
}
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 2663,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_get_payment_methods_data_2375544413912889798 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/vault
// Inherent implementation for PaymentMethodVaultingData
pub fn get_payment_methods_data(&self) -> payment_method_data::PaymentMethodsData {
match self {
Self::Card(card) => payment_method_data::PaymentMethodsData::Card(
payment_method_data::CardDetailsPaymentMethod::from(card.clone()),
),
#[cfg(feature = "v2")]
Self::NetworkToken(network_token) => {
payment_method_data::PaymentMethodsData::NetworkToken(
payment_method_data::NetworkTokenDetailsPaymentMethod::from(
network_token.clone(),
),
)
}
Self::CardNumber(_card_number) => payment_method_data::PaymentMethodsData::Card(
payment_method_data::CardDetailsPaymentMethod {
last4_digits: None,
issuer_country: None,
expiry_month: None,
expiry_year: None,
nick_name: None,
card_holder_name: None,
card_isin: None,
card_issuer: None,
card_network: None,
card_type: None,
saved_to_locker: false,
#[cfg(feature = "v1")]
co_badged_card_data: None,
},
),
}
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 50,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_get_card_2375544413912889798 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/vault
// Inherent implementation for PaymentMethodVaultingData
pub fn get_card(&self) -> Option<&payment_methods::CardDetail> {
match self {
Self::Card(card) => Some(card),
#[cfg(feature = "v2")]
Self::NetworkToken(_) => None,
Self::CardNumber(_) => None,
}
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 24,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_get_vaulting_data_key_2375544413912889798 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/vault
// Implementation of PaymentMethodVaultingData for VaultingDataInterface
fn get_vaulting_data_key(&self) -> String {
match &self {
Self::Card(card) => card.card_number.to_string(),
#[cfg(feature = "v2")]
Self::NetworkToken(network_token) => network_token.network_token.to_string(),
Self::CardNumber(card_number) => card_number.to_string(),
}
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 14,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_new_-6528771128637277340 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/payments/payment_attempt
// Inherent implementation for NetAmount
pub fn new(
order_amount: MinorUnit,
shipping_cost: Option<MinorUnit>,
order_tax_amount: Option<MinorUnit>,
surcharge_amount: Option<MinorUnit>,
tax_on_surcharge: Option<MinorUnit>,
) -> Self {
Self {
order_amount,
shipping_cost,
order_tax_amount,
surcharge_amount,
tax_on_surcharge,
}
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 14463,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_from_-6528771128637277340 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/payments/payment_attempt
// Implementation of PaymentAttemptFeatureMetadata for From<DieselPaymentAttemptFeatureMetadata>
fn from(item: DieselPaymentAttemptFeatureMetadata) -> Self {
let revenue_recovery =
item.revenue_recovery
.map(|recovery_data| PaymentAttemptRevenueRecoveryData {
attempt_triggered_by: recovery_data.attempt_triggered_by,
charge_id: recovery_data.charge_id,
});
Self { revenue_recovery }
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 2602,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_get_id_-6528771128637277340 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/payments/payment_attempt
// Inherent implementation for PaymentAttempt
pub fn get_id(&self) -> &id_type::GlobalAttemptId {
&self.id
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 2472,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_convert_-6528771128637277340 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/payments/payment_attempt
// Implementation of PaymentAttempt for behaviour::Conversion
async fn convert(self) -> CustomResult<Self::DstType, ValidationError> {
use common_utils::encryption::Encryption;
let card_network = self
.payment_method_data
.as_ref()
.and_then(|data| data.peek().as_object())
.and_then(|card| card.get("card"))
.and_then(|data| data.as_object())
.and_then(|card| card.get("card_network"))
.and_then(|network| network.as_str())
.map(|network| network.to_string());
let Self {
payment_id,
merchant_id,
attempts_group_id,
status,
error,
amount_details,
authentication_type,
created_at,
modified_at,
last_synced,
cancellation_reason,
browser_info,
payment_token,
connector_metadata,
payment_experience,
payment_method_data,
routing_result,
preprocessing_step_id,
multiple_capture_count,
connector_response_reference_id,
updated_by,
redirection_data,
encoded_data,
merchant_connector_id,
external_three_ds_authentication_attempted,
authentication_connector,
authentication_id,
fingerprint_id,
client_source,
client_version,
customer_acceptance,
profile_id,
organization_id,
payment_method_type,
connector_payment_id,
payment_method_subtype,
authentication_applied,
external_reference_id,
id,
payment_method_id,
payment_method_billing_address,
connector,
connector_token_details,
card_discovery,
charges,
feature_metadata,
processor_merchant_id,
created_by,
connector_request_reference_id,
network_transaction_id,
authorized_amount,
} = self;
let AttemptAmountDetails {
net_amount,
tax_on_surcharge,
surcharge_amount,
order_tax_amount,
shipping_cost,
amount_capturable,
amount_to_capture,
} = amount_details;
let (connector_payment_id, connector_payment_data) = connector_payment_id
.map(ConnectorTransactionId::form_id_and_data)
.map(|(txn_id, txn_data)| (Some(txn_id), txn_data))
.unwrap_or((None, None));
let feature_metadata = feature_metadata.as_ref().map(From::from);
Ok(DieselPaymentAttempt {
payment_id,
merchant_id,
id,
status,
error_message: error.as_ref().map(|details| details.message.clone()),
payment_method_id,
payment_method_type_v2: payment_method_type,
connector_payment_id,
authentication_type,
created_at,
modified_at,
last_synced,
cancellation_reason,
amount_to_capture,
browser_info,
error_code: error.as_ref().map(|details| details.code.clone()),
payment_token,
connector_metadata,
payment_experience,
payment_method_subtype,
payment_method_data,
preprocessing_step_id,
error_reason: error.as_ref().and_then(|details| details.reason.clone()),
multiple_capture_count,
connector_response_reference_id,
amount_capturable,
updated_by,
merchant_connector_id,
redirection_data: redirection_data.map(From::from),
encoded_data,
unified_code: error
.as_ref()
.and_then(|details| details.unified_code.clone()),
unified_message: error
.as_ref()
.and_then(|details| details.unified_message.clone()),
net_amount,
external_three_ds_authentication_attempted,
authentication_connector,
authentication_id,
fingerprint_id,
client_source,
client_version,
customer_acceptance,
profile_id,
organization_id,
card_network,
order_tax_amount,
shipping_cost,
routing_result,
authentication_applied,
external_reference_id,
connector,
surcharge_amount,
tax_on_surcharge,
payment_method_billing_address: payment_method_billing_address.map(Encryption::from),
connector_payment_data,
connector_token_details,
card_discovery,
request_extended_authorization: None,
extended_authorization_applied: None,
capture_before: None,
charges,
feature_metadata,
network_advice_code: error
.as_ref()
.and_then(|details| details.network_advice_code.clone()),
network_decline_code: error
.as_ref()
.and_then(|details| details.network_decline_code.clone()),
network_error_message: error
.as_ref()
.and_then(|details| details.network_error_message.clone()),
processor_merchant_id: Some(processor_merchant_id),
created_by: created_by.map(|cb| cb.to_string()),
connector_request_reference_id,
network_transaction_id,
is_overcapture_enabled: None,
network_details: None,
attempts_group_id,
is_stored_credential: None,
authorized_amount,
})
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 456,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_get_total_amount_-6528771128637277340 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/payments/payment_attempt
// Inherent implementation for PaymentAttempt
pub fn get_total_amount(&self) -> MinorUnit {
self.net_amount.get_total_amount()
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 182,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_try_from_-5311962585219680349 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/payments/payment_intent
// Implementation of PaymentIntentFetchConstraints for TryFrom<(T, Option<Vec<id_type::ProfileId>>)>
fn try_from(
(constraints, auth_profile_id_list): (T, Option<Vec<id_type::ProfileId>>),
) -> Result<Self, Self::Error> {
let payment_intent_constraints = Self::from(constraints);
if let Self::List(mut pi_list_params) = payment_intent_constraints {
let profile_id_from_request_body = pi_list_params.profile_id;
match (profile_id_from_request_body, auth_profile_id_list) {
(None, None) => pi_list_params.profile_id = None,
(None, Some(auth_profile_id_list)) => {
pi_list_params.profile_id = Some(auth_profile_id_list)
}
(Some(profile_id_from_request_body), None) => {
pi_list_params.profile_id = Some(profile_id_from_request_body)
}
(Some(profile_id_from_request_body), Some(auth_profile_id_list)) => {
let profile_id_from_request_body_is_available_in_auth_profile_id_list =
profile_id_from_request_body
.iter()
.all(|profile_id| auth_profile_id_list.contains(profile_id));
if profile_id_from_request_body_is_available_in_auth_profile_id_list {
pi_list_params.profile_id = Some(profile_id_from_request_body)
} else {
// This scenario is very unlikely to happen
let inaccessible_profile_ids: Vec<_> = profile_id_from_request_body
.iter()
.filter(|profile_id| !auth_profile_id_list.contains(profile_id))
.collect();
return Err(error_stack::Report::new(
errors::api_error_response::ApiErrorResponse::PreconditionFailed {
message: format!(
"Access not available for the given profile_id {inaccessible_profile_ids:?}",
),
},
));
}
}
}
Ok(Self::List(pi_list_params))
} else {
Ok(payment_intent_constraints)
}
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 2677,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_from_-5311962585219680349 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/payments/payment_intent
// Implementation of PaymentIntentFetchConstraints for From<api_models::payments::PaymentListFilterConstraints>
fn from(value: api_models::payments::PaymentListFilterConstraints) -> Self {
let api_models::payments::PaymentListFilterConstraints {
payment_id,
profile_id,
customer_id,
limit,
offset,
amount_filter,
time_range,
connector,
currency,
status,
payment_method,
payment_method_type,
authentication_type,
merchant_connector_id,
order,
card_network,
card_discovery,
merchant_order_reference_id,
} = value;
if let Some(payment_intent_id) = payment_id {
Self::Single { payment_intent_id }
} else {
Self::List(Box::new(PaymentIntentListParams {
offset: offset.unwrap_or_default(),
starting_at: time_range.map(|t| t.start_time),
ending_at: time_range.and_then(|t| t.end_time),
amount_filter,
connector,
currency,
status,
payment_method,
payment_method_type,
authentication_type,
merchant_connector_id,
profile_id: profile_id.map(|profile_id| vec![profile_id]),
customer_id,
starting_after_id: None,
ending_before_id: None,
limit: Some(std::cmp::min(limit, PAYMENTS_LIST_MAX_LIMIT_V2)),
order,
card_network,
card_discovery,
merchant_order_reference_id,
}))
}
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 2614,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_convert_-5311962585219680349 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/payments/payment_intent
// Implementation of PaymentIntent for behaviour::Conversion
async fn convert(self) -> CustomResult<Self::DstType, ValidationError> {
Ok(DieselPaymentIntent {
payment_id: self.payment_id,
merchant_id: self.merchant_id,
status: self.status,
amount: self.amount,
currency: self.currency,
amount_captured: self.amount_captured,
customer_id: self.customer_id,
description: self.description,
return_url: None, // deprecated
metadata: self.metadata,
connector_id: self.connector_id,
shipping_address_id: self.shipping_address_id,
billing_address_id: self.billing_address_id,
statement_descriptor_name: self.statement_descriptor_name,
statement_descriptor_suffix: self.statement_descriptor_suffix,
created_at: self.created_at,
modified_at: self.modified_at,
last_synced: self.last_synced,
setup_future_usage: self.setup_future_usage,
off_session: self.off_session,
client_secret: self.client_secret,
active_attempt_id: self.active_attempt.get_id(),
business_country: self.business_country,
business_label: self.business_label,
order_details: self.order_details,
allowed_payment_method_types: self.allowed_payment_method_types,
connector_metadata: self.connector_metadata,
feature_metadata: self.feature_metadata,
attempt_count: self.attempt_count,
profile_id: self.profile_id,
merchant_decision: self.merchant_decision,
payment_link_id: self.payment_link_id,
payment_confirm_source: self.payment_confirm_source,
updated_by: self.updated_by,
surcharge_applicable: self.surcharge_applicable,
request_incremental_authorization: self.request_incremental_authorization,
incremental_authorization_allowed: self.incremental_authorization_allowed,
authorization_count: self.authorization_count,
fingerprint_id: self.fingerprint_id,
session_expiry: self.session_expiry,
request_external_three_ds_authentication: self.request_external_three_ds_authentication,
charges: None,
split_payments: self.split_payments,
frm_metadata: self.frm_metadata,
customer_details: self.customer_details.map(Encryption::from),
billing_details: self.billing_details.map(Encryption::from),
merchant_order_reference_id: self.merchant_order_reference_id,
shipping_details: self.shipping_details.map(Encryption::from),
is_payment_processor_token_flow: self.is_payment_processor_token_flow,
organization_id: self.organization_id,
shipping_cost: self.shipping_cost,
tax_details: self.tax_details,
skip_external_tax_calculation: self.skip_external_tax_calculation,
request_extended_authorization: self.request_extended_authorization,
psd2_sca_exemption_type: self.psd2_sca_exemption_type,
platform_merchant_id: None,
processor_merchant_id: Some(self.processor_merchant_id),
created_by: self.created_by.map(|cb| cb.to_string()),
force_3ds_challenge: self.force_3ds_challenge,
force_3ds_challenge_trigger: self.force_3ds_challenge_trigger,
is_iframe_redirection_enabled: self.is_iframe_redirection_enabled,
extended_return_url: self.return_url,
is_payment_id_from_merchant: self.is_payment_id_from_merchant,
payment_channel: self.payment_channel,
tax_status: self.tax_status,
discount_amount: self.discount_amount,
order_date: self.order_date,
shipping_amount_tax: self.shipping_amount_tax,
duty_amount: self.duty_amount,
enable_partial_authorization: self.enable_partial_authorization,
enable_overcapture: self.enable_overcapture,
mit_category: self.mit_category,
})
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 374,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_convert_back_-5311962585219680349 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/payments/payment_intent
// Implementation of PaymentIntent for behaviour::Conversion
async fn convert_back(
state: &KeyManagerState,
storage_model: Self::DstType,
key: &Secret<Vec<u8>>,
key_manager_identifier: keymanager::Identifier,
) -> CustomResult<Self, ValidationError>
where
Self: Sized,
{
async {
let decrypted_data = crypto_operation(
state,
type_name!(Self::DstType),
CryptoOperation::BatchDecrypt(super::EncryptedPaymentIntent::to_encryptable(
super::EncryptedPaymentIntent {
billing_details: storage_model.billing_details,
shipping_details: storage_model.shipping_details,
customer_details: storage_model.customer_details,
},
)),
key_manager_identifier,
key.peek(),
)
.await
.and_then(|val| val.try_into_batchoperation())?;
let data = super::EncryptedPaymentIntent::from_encryptable(decrypted_data)
.change_context(common_utils::errors::CryptoError::DecodingFailed)
.attach_printable("Invalid batch operation data")?;
Ok::<Self, error_stack::Report<common_utils::errors::CryptoError>>(Self {
payment_id: storage_model.payment_id,
merchant_id: storage_model.merchant_id.clone(),
status: storage_model.status,
amount: storage_model.amount,
currency: storage_model.currency,
amount_captured: storage_model.amount_captured,
customer_id: storage_model.customer_id,
description: storage_model.description,
return_url: storage_model
.extended_return_url
.or(storage_model.return_url), // fallback to legacy
metadata: storage_model.metadata,
connector_id: storage_model.connector_id,
shipping_address_id: storage_model.shipping_address_id,
billing_address_id: storage_model.billing_address_id,
statement_descriptor_name: storage_model.statement_descriptor_name,
statement_descriptor_suffix: storage_model.statement_descriptor_suffix,
created_at: storage_model.created_at,
modified_at: storage_model.modified_at,
last_synced: storage_model.last_synced,
setup_future_usage: storage_model.setup_future_usage,
off_session: storage_model.off_session,
client_secret: storage_model.client_secret,
active_attempt: RemoteStorageObject::ForeignID(storage_model.active_attempt_id),
business_country: storage_model.business_country,
business_label: storage_model.business_label,
order_details: storage_model.order_details,
allowed_payment_method_types: storage_model.allowed_payment_method_types,
connector_metadata: storage_model.connector_metadata,
feature_metadata: storage_model.feature_metadata,
attempt_count: storage_model.attempt_count,
profile_id: storage_model.profile_id,
merchant_decision: storage_model.merchant_decision,
payment_link_id: storage_model.payment_link_id,
payment_confirm_source: storage_model.payment_confirm_source,
updated_by: storage_model.updated_by,
surcharge_applicable: storage_model.surcharge_applicable,
request_incremental_authorization: storage_model.request_incremental_authorization,
incremental_authorization_allowed: storage_model.incremental_authorization_allowed,
authorization_count: storage_model.authorization_count,
fingerprint_id: storage_model.fingerprint_id,
session_expiry: storage_model.session_expiry,
request_external_three_ds_authentication: storage_model
.request_external_three_ds_authentication,
split_payments: storage_model.split_payments,
frm_metadata: storage_model.frm_metadata,
shipping_cost: storage_model.shipping_cost,
tax_details: storage_model.tax_details,
customer_details: data.customer_details,
billing_details: data.billing_details,
merchant_order_reference_id: storage_model.merchant_order_reference_id,
shipping_details: data.shipping_details,
is_payment_processor_token_flow: storage_model.is_payment_processor_token_flow,
organization_id: storage_model.organization_id,
skip_external_tax_calculation: storage_model.skip_external_tax_calculation,
request_extended_authorization: storage_model.request_extended_authorization,
psd2_sca_exemption_type: storage_model.psd2_sca_exemption_type,
processor_merchant_id: storage_model
.processor_merchant_id
.unwrap_or(storage_model.merchant_id),
created_by: storage_model
.created_by
.and_then(|created_by| created_by.parse::<CreatedBy>().ok()),
force_3ds_challenge: storage_model.force_3ds_challenge,
force_3ds_challenge_trigger: storage_model.force_3ds_challenge_trigger,
is_iframe_redirection_enabled: storage_model.is_iframe_redirection_enabled,
is_payment_id_from_merchant: storage_model.is_payment_id_from_merchant,
payment_channel: storage_model.payment_channel,
tax_status: storage_model.tax_status,
discount_amount: storage_model.discount_amount,
shipping_amount_tax: storage_model.shipping_amount_tax,
duty_amount: storage_model.duty_amount,
order_date: storage_model.order_date,
enable_partial_authorization: storage_model.enable_partial_authorization,
enable_overcapture: storage_model.enable_overcapture,
mit_category: storage_model.mit_category,
})
}
.await
.change_context(ValidationError::InvalidValue {
message: "Failed while decrypting payment intent".to_string(),
})
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 138,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_get_profile_id_-5311962585219680349 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/payments/payment_intent
// Inherent implementation for PaymentIntentFetchConstraints
pub fn get_profile_id(&self) -> Option<id_type::ProfileId> {
let Self::List(pi_list_params) = self;
pi_list_params.profile_id.clone()
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 29,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_new_-7430770733329085758 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/router_request_types/subscriptions
// Inherent implementation for GetSubscriptionPlansRequest
pub fn new(limit: Option<u32>, offset: Option<u32>) -> Self {
Self { limit, offset }
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 14463,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_default_-7430770733329085758 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/router_request_types/subscriptions
// Implementation of GetSubscriptionPlansRequest for Default
fn default() -> Self {
Self {
limit: Some(10),
offset: Some(0),
}
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 7703,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_get_api_event_type_-992298350805862928 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/router_request_types/fraud_check
// Implementation of FrmFulfillmentRequest for ApiEventMetric
fn get_api_event_type(&self) -> Option<ApiEventsType> {
Some(ApiEventsType::FraudCheck)
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 26,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_try_from_3758175834811391613 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/router_request_types/authentication
// Implementation of PreAuthenticationData for TryFrom<&diesel_models::authentication::Authentication>
fn try_from(
authentication: &diesel_models::authentication::Authentication,
) -> Result<Self, Self::Error> {
let error_message = ApiErrorResponse::UnprocessableEntity { message: "Pre Authentication must be completed successfully before Authentication can be performed".to_string() };
let threeds_server_transaction_id = authentication
.threeds_server_transaction_id
.clone()
.get_required_value("threeds_server_transaction_id")
.change_context(error_message.clone())?;
let message_version = authentication
.message_version
.clone()
.get_required_value("message_version")
.change_context(error_message)?;
Ok(Self {
threeds_server_transaction_id,
message_version,
acquirer_bin: authentication.acquirer_bin.clone(),
acquirer_merchant_id: authentication.acquirer_merchant_id.clone(),
connector_metadata: authentication.connector_metadata.clone(),
acquirer_country_code: authentication.acquirer_country_code.clone(),
})
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 2681,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_get_acs_url_3758175834811391613 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/router_request_types/authentication
// Inherent implementation for AuthNFlowType
pub fn get_acs_url(&self) -> Option<String> {
if let Self::Challenge(challenge_params) = self {
challenge_params.acs_url.as_ref().map(ToString::to_string)
} else {
None
}
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 28,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_get_challenge_request_3758175834811391613 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/router_request_types/authentication
// Inherent implementation for AuthNFlowType
pub fn get_challenge_request(&self) -> Option<String> {
if let Self::Challenge(challenge_params) = self {
challenge_params.challenge_request.clone()
} else {
None
}
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 26,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_get_challenge_request_key_3758175834811391613 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/router_request_types/authentication
// Inherent implementation for AuthNFlowType
pub fn get_challenge_request_key(&self) -> Option<String> {
if let Self::Challenge(challenge_params) = self {
challenge_params.challenge_request_key.clone()
} else {
None
}
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 26,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_get_acs_reference_number_3758175834811391613 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/router_request_types/authentication
// Inherent implementation for AuthNFlowType
pub fn get_acs_reference_number(&self) -> Option<String> {
if let Self::Challenge(challenge_params) = self {
challenge_params.acs_reference_number.clone()
} else {
None
}
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 26,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_from_-7346100938449076941 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/router_response_types/subscriptions
// Implementation of api_models::subscription::SubscriptionLineItem for From<SubscriptionLineItem>
fn from(value: SubscriptionLineItem) -> Self {
Self {
item_id: value.item_id,
description: value.description,
item_type: value.item_type,
amount: value.amount,
currency: value.currency,
quantity: value.quantity,
}
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 2600,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_get_api_event_type_-4153914120491836440 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/router_response_types/fraud_check
// Implementation of FraudCheckResponseData for common_utils::events::ApiEventMetric
fn get_api_event_type(&self) -> Option<common_utils::events::ApiEventsType> {
Some(common_utils::events::ApiEventsType::FraudCheck)
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 26,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_new_-889951594098861552 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/router_flow_types/webhooks
// Inherent implementation for ConnectorNetworkTxnId
pub fn new(txn_id: masking::Secret<String>) -> Self {
Self(txn_id)
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 14465,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_get_id_-889951594098861552 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/router_flow_types/webhooks
// Inherent implementation for ConnectorNetworkTxnId
pub fn get_id(&self) -> &masking::Secret<String> {
&self.0
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 2472,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_switch_4637932160390391761 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/errors/api_error_response
// Implementation of ApiErrorResponse for ErrorSwitch<api_models::errors::types::ApiErrorResponse>
fn switch(&self) -> api_models::errors::types::ApiErrorResponse {
use api_models::errors::types::{ApiError, ApiErrorResponse as AER};
match self {
Self::ExternalConnectorError {
code,
message,
connector,
reason,
status_code,
} => AER::ConnectorError(ApiError::new("CE", 0, format!("{code}: {message}"), Some(Extra {connector: Some(connector.clone()), reason: reason.to_owned(), ..Default::default()})), StatusCode::from_u16(*status_code).unwrap_or(StatusCode::INTERNAL_SERVER_ERROR)),
Self::PaymentAuthorizationFailed { data } => {
AER::BadRequest(ApiError::new("CE", 1, "Payment failed during authorization with connector. Retry payment", Some(Extra { data: data.clone(), ..Default::default()})))
}
Self::PaymentAuthenticationFailed { data } => {
AER::BadRequest(ApiError::new("CE", 2, "Payment failed during authentication with connector. Retry payment", Some(Extra { data: data.clone(), ..Default::default()})))
}
Self::PaymentCaptureFailed { data } => {
AER::BadRequest(ApiError::new("CE", 3, "Capture attempt failed while processing with connector", Some(Extra { data: data.clone(), ..Default::default()})))
}
Self::InvalidCardData { data } => AER::BadRequest(ApiError::new("CE", 4, "The card data is invalid", Some(Extra { data: data.clone(), ..Default::default()}))),
Self::CardExpired { data } => AER::BadRequest(ApiError::new("CE", 5, "The card has expired", Some(Extra { data: data.clone(), ..Default::default()}))),
Self::RefundFailed { data } => AER::BadRequest(ApiError::new("CE", 6, "Refund failed while processing with connector. Retry refund", Some(Extra { data: data.clone(), ..Default::default()}))),
Self::VerificationFailed { data } => {
AER::BadRequest(ApiError::new("CE", 7, "Verification failed while processing with connector. Retry operation", Some(Extra { data: data.clone(), ..Default::default()})))
},
Self::DisputeFailed { data } => {
AER::BadRequest(ApiError::new("CE", 8, "Dispute operation failed while processing with connector. Retry operation", Some(Extra { data: data.clone(), ..Default::default()})))
}
Self::ResourceBusy => {
AER::Unprocessable(ApiError::new("HE", 0, "There was an issue processing the webhook body", None))
}
Self::CurrencyConversionFailed => {
AER::Unprocessable(ApiError::new("HE", 0, "Failed to convert currency to minor unit", None))
}
Self::InternalServerError => {
AER::InternalServerError(ApiError::new("HE", 0, "Something went wrong", None))
},
Self::HealthCheckError { message,component } => {
AER::InternalServerError(ApiError::new("HE",0,format!("{component} health check failed with error: {message}"),None))
},
Self::DuplicateRefundRequest => AER::BadRequest(ApiError::new("HE", 1, "Duplicate refund request. Refund already attempted with the refund ID", None)),
Self::DuplicateMandate => AER::BadRequest(ApiError::new("HE", 1, "Duplicate mandate request. Mandate already attempted with the Mandate ID", None)),
Self::DuplicateMerchantAccount => AER::BadRequest(ApiError::new("HE", 1, "The merchant account with the specified details already exists in our records", None)),
Self::DuplicateMerchantConnectorAccount { profile_id, connector_label: connector_name } => {
AER::BadRequest(ApiError::new("HE", 1, format!("The merchant connector account with the specified profile_id '{profile_id}' and connector_label '{connector_name}' already exists in our records"), None))
}
Self::DuplicatePaymentMethod => AER::BadRequest(ApiError::new("HE", 1, "The payment method with the specified details already exists in our records", None)),
Self::DuplicatePayment { payment_id } => {
AER::BadRequest(ApiError::new("HE", 1, "The payment with the specified payment_id already exists in our records", Some(Extra {reason: Some(format!("{payment_id:?} already exists")), ..Default::default()})))
}
Self::DuplicatePayout { payout_id } => {
AER::BadRequest(ApiError::new("HE", 1, format!("The payout with the specified payout_id '{payout_id:?}' already exists in our records"), None))
}
Self::DuplicateConfig => {
AER::BadRequest(ApiError::new("HE", 1, "The config with the specified key already exists in our records", None))
}
Self::RefundNotFound => {
AER::NotFound(ApiError::new("HE", 2, "Refund does not exist in our records.", None))
}
Self::PaymentLinkNotFound => {
AER::NotFound(ApiError::new("HE", 2, "Payment Link does not exist in our records", None))
}
Self::CustomerNotFound => {
AER::NotFound(ApiError::new("HE", 2, "Customer does not exist in our records", None))
}
Self::ConfigNotFound => {
AER::NotFound(ApiError::new("HE", 2, "Config key does not exist in our records.", None))
},
Self::PaymentNotFound => {
AER::NotFound(ApiError::new("HE", 2, "Payment does not exist in our records", None))
}
Self::PaymentMethodNotFound => {
AER::NotFound(ApiError::new("HE", 2, "Payment method does not exist in our records", None))
}
Self::MerchantAccountNotFound => {
AER::NotFound(ApiError::new("HE", 2, "Merchant account does not exist in our records", None))
}
Self::MerchantConnectorAccountNotFound {id } => {
AER::NotFound(ApiError::new("HE", 2, "Merchant connector account does not exist in our records", Some(Extra {reason: Some(format!("{id} does not exist")), ..Default::default()})))
}
Self::ProfileNotFound { id } => {
AER::NotFound(ApiError::new("HE", 2, format!("Business profile with the given id {id} does not exist"), None))
}
Self::ProfileAcquirerNotFound { profile_acquirer_id, profile_id } => {
AER::NotFound(ApiError::new("HE", 2, format!("Profile acquirer with id '{profile_acquirer_id}' not found for profile '{profile_id}'."), None))
}
Self::PollNotFound { .. } => {
AER::NotFound(ApiError::new("HE", 2, "Poll does not exist in our records", None))
},
Self::ResourceIdNotFound => {
AER::NotFound(ApiError::new("HE", 2, "Resource ID does not exist in our records", None))
}
Self::MandateNotFound => {
AER::NotFound(ApiError::new("HE", 2, "Mandate does not exist in our records", None))
}
Self::AuthenticationNotFound { .. } => {
AER::NotFound(ApiError::new("HE", 2, "Authentication does not exist in our records", None))
},
Self::MandateUpdateFailed => {
AER::InternalServerError(ApiError::new("HE", 2, "Mandate update failed", None))
},
Self::ApiKeyNotFound => {
AER::NotFound(ApiError::new("HE", 2, "API Key does not exist in our records", None))
}
Self::PayoutNotFound => {
AER::NotFound(ApiError::new("HE", 2, "Payout does not exist in our records", None))
}
Self::EventNotFound => {
AER::NotFound(ApiError::new("HE", 2, "Event does not exist in our records", None))
}
Self::MandateSerializationFailed | Self::MandateDeserializationFailed => {
AER::InternalServerError(ApiError::new("HE", 3, "Something went wrong", None))
},
Self::ReturnUrlUnavailable => AER::NotFound(ApiError::new("HE", 3, "Return URL is not configured and not passed in payments request", None)),
Self::RefundNotPossible { connector } => {
AER::BadRequest(ApiError::new("HE", 3, format!("This refund is not possible through Hyperswitch. Please raise the refund through {connector} dashboard"), None))
}
Self::MandateValidationFailed { reason } => {
AER::BadRequest(ApiError::new("HE", 3, "Mandate Validation Failed", Some(Extra { reason: Some(reason.to_owned()), ..Default::default() })))
}
Self::PaymentNotSucceeded => AER::BadRequest(ApiError::new("HE", 3, "The payment has not succeeded yet. Please pass a successful payment to initiate refund", None)),
Self::MerchantConnectorAccountDisabled => {
AER::BadRequest(ApiError::new("HE", 3, "The selected merchant connector account is disabled", None))
}
Self::PaymentBlockedError {
message,
reason,
..
} => AER::DomainError(ApiError::new("HE", 3, message, Some(Extra { reason: Some(reason.clone()), ..Default::default() }))),
Self::FileValidationFailed { reason } => {
AER::BadRequest(ApiError::new("HE", 3, format!("File validation failed {reason}"), None))
}
Self::DisputeStatusValidationFailed { .. } => {
AER::BadRequest(ApiError::new("HE", 3, "Dispute status validation failed", None))
}
Self::SuccessfulPaymentNotFound => {
AER::NotFound(ApiError::new("HE", 4, "Successful payment not found for the given payment id", None))
}
Self::IncorrectConnectorNameGiven => {
AER::NotFound(ApiError::new("HE", 4, "The connector provided in the request is incorrect or not available", None))
}
Self::AddressNotFound => {
AER::NotFound(ApiError::new("HE", 4, "Address does not exist in our records", None))
},
Self::DisputeNotFound { .. } => {
AER::NotFound(ApiError::new("HE", 4, "Dispute does not exist in our records", None))
},
Self::FileNotFound => {
AER::NotFound(ApiError::new("HE", 4, "File does not exist in our records", None))
}
Self::FileNotAvailable => {
AER::NotFound(ApiError::new("HE", 4, "File not available", None))
}
Self::MissingTenantId => {
AER::InternalServerError(ApiError::new("HE", 5, "Missing Tenant ID in the request".to_string(), None))
}
Self::InvalidTenant { tenant_id } => {
AER::InternalServerError(ApiError::new("HE", 5, format!("Invalid Tenant {tenant_id}"), None))
}
Self::AmountConversionFailed { amount_type } => {
AER::InternalServerError(ApiError::new("HE", 6, format!("Failed to convert amount to {amount_type} type"), None))
}
Self::NotImplemented { message } => {
AER::NotImplemented(ApiError::new("IR", 0, format!("{message:?}"), None))
}
Self::Unauthorized => AER::Unauthorized(ApiError::new(
"IR",
1,
"API key not provided or invalid API key used", None
)),
Self::InvalidRequestUrl => {
AER::NotFound(ApiError::new("IR", 2, "Unrecognized request URL", None))
}
Self::InvalidHttpMethod => AER::MethodNotAllowed(ApiError::new(
"IR",
3,
"The HTTP method is not applicable for this API", None
)),
Self::MissingRequiredField { field_name } => AER::BadRequest(
ApiError::new("IR", 4, format!("Missing required param: {field_name}"), None),
),
Self::InvalidDataFormat {
field_name,
expected_format,
} => AER::Unprocessable(ApiError::new(
"IR",
5,
format!(
"{field_name} contains invalid data. Expected format is {expected_format}"
), None
)),
Self::InvalidRequestData { message } => {
AER::Unprocessable(ApiError::new("IR", 6, message.to_string(), None))
}
Self::InvalidDataValue { field_name } => AER::BadRequest(ApiError::new(
"IR",
7,
format!("Invalid value provided: {field_name}"), None
)),
Self::ClientSecretNotGiven => AER::BadRequest(ApiError::new(
"IR",
8,
"client_secret was not provided", None
)),
Self::ClientSecretExpired => AER::BadRequest(ApiError::new(
"IR",
8,
"The provided client_secret has expired", None
)),
Self::ClientSecretInvalid => {
AER::BadRequest(ApiError::new("IR", 9, "The client_secret provided does not match the client_secret associated with the Payment", None))
}
Self::MandateActive => {
AER::BadRequest(ApiError::new("IR", 10, "Customer has active mandate/subsciption", None))
}
Self::CustomerRedacted => {
AER::BadRequest(ApiError::new("IR", 11, "Customer has already been redacted", None))
}
Self::MaximumRefundCount => AER::BadRequest(ApiError::new("IR", 12, "Reached maximum refund attempts", None)),
Self::RefundAmountExceedsPaymentAmount => {
AER::BadRequest(ApiError::new("IR", 13, "The refund amount exceeds the amount captured", None))
}
Self::PaymentUnexpectedState {
current_flow,
field_name,
current_value,
states,
} => AER::BadRequest(ApiError::new("IR", 14, format!("This Payment could not be {current_flow} because it has a {field_name} of {current_value}. The expected state is {states}"), None)),
Self::InvalidEphemeralKey => AER::Unauthorized(ApiError::new("IR", 15, "Invalid Ephemeral Key for the customer", None)),
Self::PreconditionFailed { message } => {
AER::BadRequest(ApiError::new("IR", 16, message.to_string(), None))
}
Self::InvalidJwtToken => AER::Unauthorized(ApiError::new("IR", 17, "Access forbidden, invalid JWT token was used", None)),
Self::GenericUnauthorized { message } => {
AER::Unauthorized(ApiError::new("IR", 18, message.to_string(), None))
},
Self::NotSupported { message } => {
AER::BadRequest(ApiError::new("IR", 19, "Payment method type not supported", Some(Extra {reason: Some(message.to_owned()), ..Default::default()})))
},
Self::FlowNotSupported { flow, connector } => {
AER::BadRequest(ApiError::new("IR", 20, format!("{flow} flow not supported"), Some(Extra {connector: Some(connector.to_owned()), ..Default::default()}))) //FIXME: error message
}
Self::MissingRequiredFields { field_names } => AER::BadRequest(
ApiError::new("IR", 21, "Missing required params".to_string(), Some(Extra {data: Some(serde_json::json!(field_names)), ..Default::default() })),
),
Self::AccessForbidden {resource} => {
AER::ForbiddenCommonResource(ApiError::new("IR", 22, format!("Access forbidden. Not authorized to access this resource {resource}"), None))
},
Self::FileProviderNotSupported { message } => {
AER::BadRequest(ApiError::new("IR", 23, message.to_string(), None))
},
Self::InvalidWalletToken { wallet_name} => AER::Unprocessable(ApiError::new(
"IR",
24,
format!("Invalid {wallet_name} wallet token"), None
)),
Self::PaymentMethodDeleteFailed => {
AER::BadRequest(ApiError::new("IR", 25, "Cannot delete the default payment method", None))
}
Self::InvalidCookie => {
AER::BadRequest(ApiError::new("IR", 26, "Invalid Cookie", None))
}
Self::ExtendedCardInfoNotFound => {
AER::NotFound(ApiError::new("IR", 27, "Extended card info does not exist", None))
}
Self::CurrencyNotSupported { message } => {
AER::BadRequest(ApiError::new("IR", 28, message, None))
}
Self::UnprocessableEntity {message} => AER::Unprocessable(ApiError::new("IR", 29, message.to_string(), None)),
Self::InvalidConnectorConfiguration {config} => {
AER::BadRequest(ApiError::new("IR", 30, format!("Merchant connector account is configured with invalid {config}"), None))
}
Self::InvalidCardIin => AER::BadRequest(ApiError::new("IR", 31, "The provided card IIN does not exist", None)),
Self::InvalidCardIinLength => AER::BadRequest(ApiError::new("IR", 32, "The provided card IIN length is invalid, please provide an IIN with 6 digits", None)),
Self::MissingFile => {
AER::BadRequest(ApiError::new("IR", 33, "File not found in the request", None))
}
Self::MissingDisputeId => {
AER::BadRequest(ApiError::new("IR", 34, "Dispute id not found in the request", None))
}
Self::MissingFilePurpose => {
AER::BadRequest(ApiError::new("IR", 35, "File purpose not found in the request or is invalid", None))
}
Self::MissingFileContentType => {
AER::BadRequest(ApiError::new("IR", 36, "File content type not found", None))
}
Self::GenericNotFoundError { message } => {
AER::NotFound(ApiError::new("IR", 37, message, None))
},
Self::GenericDuplicateError { message } => {
AER::BadRequest(ApiError::new("IR", 38, message, None))
}
Self::IncorrectPaymentMethodConfiguration => {
AER::BadRequest(ApiError::new("IR", 39, "No eligible connector was found for the current payment method configuration", None))
}
Self::LinkConfigurationError { message } => {
AER::BadRequest(ApiError::new("IR", 40, message, None))
},
Self::PayoutFailed { data } => {
AER::BadRequest(ApiError::new("IR", 41, "Payout failed while processing with connector.", Some(Extra { data: data.clone(), ..Default::default()})))
},
Self::CookieNotFound => {
AER::Unauthorized(ApiError::new("IR", 42, "Cookies are not found in the request", None))
},
Self::ExternalVaultFailed => {
AER::BadRequest(ApiError::new("IR", 45, "External Vault failed while processing with connector.", None))
},
Self::MandatePaymentDataMismatch { fields} => {
AER::BadRequest(ApiError::new("IR", 46, format!("Field {fields} doesn't match with the ones used during mandate creation"), Some(Extra {fields: Some(fields.to_owned()), ..Default::default()}))) //FIXME: error message
}
Self::MaxFieldLengthViolated { connector, field_name, max_length, received_length} => {
AER::BadRequest(ApiError::new("IR", 47, format!("Connector '{connector}' rejected field '{field_name}': length {received_length} exceeds maximum of {max_length}"), Some(Extra {connector: Some(connector.to_string()), ..Default::default()})))
}
Self::WebhookAuthenticationFailed => {
AER::Unauthorized(ApiError::new("WE", 1, "Webhook authentication failed", None))
}
Self::WebhookBadRequest => {
AER::BadRequest(ApiError::new("WE", 2, "Bad request body received", None))
}
Self::WebhookProcessingFailure => {
AER::InternalServerError(ApiError::new("WE", 3, "There was an issue processing the webhook", None))
},
Self::WebhookResourceNotFound => {
AER::NotFound(ApiError::new("WE", 4, "Webhook resource was not found", None))
}
Self::WebhookUnprocessableEntity => {
AER::Unprocessable(ApiError::new("WE", 5, "There was an issue processing the webhook body", None))
},
Self::WebhookInvalidMerchantSecret => {
AER::BadRequest(ApiError::new("WE", 6, "Merchant Secret set for webhook source verification is invalid", None))
}
Self::IntegrityCheckFailed {
reason,
field_names,
connector_transaction_id
} => AER::InternalServerError(ApiError::new(
"IE",
0,
format!("{reason} as data mismatched for {field_names}"),
Some(Extra {
connector_transaction_id: connector_transaction_id.to_owned(),
..Default::default()
})
)),
Self::PlatformAccountAuthNotSupported => {
AER::BadRequest(ApiError::new("IR", 43, "API does not support platform operation", None))
}
Self::InvalidPlatformOperation => {
AER::Unauthorized(ApiError::new("IR", 44, "Invalid platform account operation", None))
}
Self::TokenizationRecordNotFound{ id } => {
AER::NotFound(ApiError::new("HE", 2, format!("Tokenization record not found for the given token_id '{id}' "), None))
}
Self::SubscriptionError { operation } => {
AER::BadRequest(ApiError::new("CE", 9, format!("Subscription operation: {operation} failed with connector"), None))
}
}
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 3634,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_from_4637932160390391761 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/errors/api_error_response
// Implementation of router_data::ErrorResponse for From<ApiErrorResponse>
fn from(error: ApiErrorResponse) -> Self {
Self {
code: error.error_code(),
message: error.error_message(),
reason: None,
status_code: match error {
ApiErrorResponse::ExternalConnectorError { status_code, .. } => status_code,
_ => 500,
},
attempt_status: None,
connector_transaction_id: None,
network_advice_code: None,
network_decline_code: None,
network_error_message: None,
connector_metadata: None,
}
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 2604,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_fmt_4637932160390391761 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/errors/api_error_response
// Implementation of ApiErrorResponse for ::core::fmt::Display
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(
f,
r#"{{"error":{}}}"#,
serde_json::to_string(self).unwrap_or_else(|_| "API error response".to_string())
)
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 38,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_status_code_4637932160390391761 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/errors/api_error_response
// Implementation of ApiErrorResponse for actix_web::ResponseError
fn status_code(&self) -> StatusCode {
ErrorSwitch::<api_models::errors::types::ApiErrorResponse>::switch(self).status_code()
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 30,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_error_response_4637932160390391761 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/errors/api_error_response
// Implementation of ApiErrorResponse for actix_web::ResponseError
fn error_response(&self) -> actix_web::HttpResponse {
ErrorSwitch::<api_models::errors::types::ApiErrorResponse>::switch(self).error_response()
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 24,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_from_-6190723112988813948 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/payouts/payouts
// Implementation of PayoutsUpdateInternal for From<PayoutsUpdate>
fn from(payout_update: PayoutsUpdate) -> Self {
match payout_update {
PayoutsUpdate::Update {
amount,
destination_currency,
source_currency,
description,
recurring,
auto_fulfill,
return_url,
entity_type,
metadata,
profile_id,
status,
confirm,
payout_type,
address_id,
customer_id,
} => Self {
amount: Some(amount),
destination_currency: Some(destination_currency),
source_currency: Some(source_currency),
description,
recurring: Some(recurring),
auto_fulfill: Some(auto_fulfill),
return_url,
entity_type: Some(entity_type),
metadata,
profile_id,
status,
confirm,
payout_type,
address_id,
customer_id,
..Default::default()
},
PayoutsUpdate::PayoutMethodIdUpdate { payout_method_id } => Self {
payout_method_id: Some(payout_method_id),
..Default::default()
},
PayoutsUpdate::RecurringUpdate { recurring } => Self {
recurring: Some(recurring),
..Default::default()
},
PayoutsUpdate::AttemptCountUpdate { attempt_count } => Self {
attempt_count: Some(attempt_count),
..Default::default()
},
PayoutsUpdate::StatusUpdate { status } => Self {
status: Some(status),
..Default::default()
},
}
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 2610,
"total_crates": null
} |
fn_clm_hyperswitch_domain_models_from_7350851342904321019 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_domain_models
// Purpose: Business logic data models bridging API and database layers
// Module: crates/hyperswitch_domain_models/src/payouts/payout_attempt
// Implementation of PayoutAttemptUpdateInternal for From<PayoutAttemptUpdate>
fn from(payout_update: PayoutAttemptUpdate) -> Self {
match payout_update {
PayoutAttemptUpdate::PayoutTokenUpdate { payout_token } => Self {
payout_token: Some(payout_token),
..Default::default()
},
PayoutAttemptUpdate::StatusUpdate {
connector_payout_id,
status,
error_message,
error_code,
is_eligible,
unified_code,
unified_message,
payout_connector_metadata,
} => Self {
connector_payout_id,
status: Some(status),
error_message,
error_code,
is_eligible,
unified_code,
unified_message,
payout_connector_metadata,
..Default::default()
},
PayoutAttemptUpdate::BusinessUpdate {
business_country,
business_label,
address_id,
customer_id,
} => Self {
business_country,
business_label,
address_id,
customer_id,
..Default::default()
},
PayoutAttemptUpdate::UpdateRouting {
connector,
routing_info,
merchant_connector_id,
} => Self {
connector: Some(connector),
routing_info,
merchant_connector_id,
..Default::default()
},
PayoutAttemptUpdate::AdditionalPayoutMethodDataUpdate {
additional_payout_method_data,
} => Self {
additional_payout_method_data,
..Default::default()
},
}
}
| {
"crate": "hyperswitch_domain_models",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 2610,
"total_crates": null
} |
fn_clm_hyperswitch_connectors_get_external_account_account_holder_type_2800353374662512016 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/types
// Implementation of api_models::payouts::PayoutIndividualDetails for PayoutIndividualDetailsExt
fn get_external_account_account_holder_type(&self) -> Result<String, Self::Error> {
self.external_account_account_holder_type
.clone()
.ok_or_else(crate::utils::missing_field_err(
"external_account_account_holder_type",
))
}
| {
"crate": "hyperswitch_connectors",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 14,
"total_crates": null
} |
fn_clm_hyperswitch_connectors_get_flow_type_4209139860788675543 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/default_implementations
// Implementation of connectors::DummyConnector<T> for ConnectorRedirectResponse
fn get_flow_type(
&self,
_query_params: &str,
_json_payload: Option<serde_json::Value>,
_action: PaymentAction,
) -> CustomResult<CallConnectorAction, ConnectorError> {
Ok(CallConnectorAction::Trigger)
}
| {
"crate": "hyperswitch_connectors",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 14,
"total_crates": null
} |
fn_clm_hyperswitch_connectors_try_from_2063945602217666669 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/utils
// Implementation of GooglePayWalletData for TryFrom<payment_method_data::GooglePayWalletData>
fn try_from(data: payment_method_data::GooglePayWalletData) -> Result<Self, Self::Error> {
let tokenization_data = match data.tokenization_data {
common_types::payments::GpayTokenizationData::Encrypted(encrypted_data) => {
common_types::payments::GpayTokenizationData::Encrypted(
common_types::payments::GpayEcryptedTokenizationData {
token_type: encrypted_data.token_type,
token: encrypted_data.token,
},
)
}
common_types::payments::GpayTokenizationData::Decrypted(_) => {
return Err(common_utils::errors::ValidationError::InvalidValue {
message: "Expected encrypted tokenization data, got decrypted".to_string(),
});
}
};
Ok(Self {
pm_type: data.pm_type,
description: data.description,
info: GooglePayPaymentMethodInfo {
card_network: data.info.card_network,
card_details: data.info.card_details,
assurance_details: data.info.assurance_details,
card_funding_source: data.info.card_funding_source,
},
tokenization_data,
})
}
| {
"crate": "hyperswitch_connectors",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 2661,
"total_crates": null
} |
fn_clm_hyperswitch_connectors_get_connector_transaction_id_2063945602217666669 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/utils
// Implementation of PaymentsSyncData for PaymentsSyncRequestData
fn get_connector_transaction_id(&self) -> CustomResult<String, errors::ConnectorError> {
match self.connector_transaction_id.clone() {
ResponseId::ConnectorTransactionId(txn_id) => Ok(txn_id),
_ => Err(
common_utils::errors::ValidationError::IncorrectValueProvided {
field_name: "connector_transaction_id",
},
)
.attach_printable("Expected connector transaction ID not found")
.change_context(errors::ConnectorError::MissingConnectorTransactionID)?,
}
}
| {
"crate": "hyperswitch_connectors",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 1265,
"total_crates": null
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.