id stringlengths 20 153 | type stringclasses 1
value | granularity stringclasses 14
values | content stringlengths 16 84.3k | metadata dict |
|---|---|---|---|---|
hyperswitch_fn_storage_impl_-3418738701225408127 | clm | function | // hyperswitch/crates/storage_impl/src/mock_db/payouts.rs
async fn find_optional_payout_by_merchant_id_payout_id(
&self,
_merchant_id: &common_utils::id_type::MerchantId,
_payout_id: &common_utils::id_type::PayoutId,
_storage_scheme: storage_enums::MerchantStorageScheme,
) -> CustomResult<Option<Payouts>, StorageError> {
// TODO: Implement function for `MockDb`
Err(StorageError::MockDbError)?
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "find_optional_payout_by_merchant_id_payout_id",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_33595856105314836 | clm | function | // hyperswitch/crates/storage_impl/src/mock_db/payouts.rs
async fn filter_payouts_by_constraints(
&self,
_merchant_id: &common_utils::id_type::MerchantId,
_filters: &hyperswitch_domain_models::payouts::PayoutFetchConstraints,
_storage_scheme: storage_enums::MerchantStorageScheme,
) -> CustomResult<Vec<Payouts>, StorageError> {
// TODO: Implement function for `MockDb`
Err(StorageError::MockDbError)?
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "filter_payouts_by_constraints",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_3496518753388367299 | clm | function | // hyperswitch/crates/storage_impl/src/mock_db/payouts.rs
async fn filter_payouts_and_attempts(
&self,
_merchant_id: &common_utils::id_type::MerchantId,
_filters: &hyperswitch_domain_models::payouts::PayoutFetchConstraints,
_storage_scheme: storage_enums::MerchantStorageScheme,
) -> CustomResult<
Vec<(
Payouts,
PayoutAttempt,
Option<diesel_models::Customer>,
Option<diesel_models::Address>,
)>,
StorageError,
> {
// TODO: Implement function for `MockDb`
Err(StorageError::MockDbError)?
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "filter_payouts_and_attempts",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_-1955133976701307223 | clm | function | // hyperswitch/crates/storage_impl/src/mock_db/payouts.rs
async fn filter_payouts_by_time_range_constraints(
&self,
_merchant_id: &common_utils::id_type::MerchantId,
_time_range: &common_utils::types::TimeRange,
_storage_scheme: storage_enums::MerchantStorageScheme,
) -> CustomResult<Vec<Payouts>, StorageError> {
// TODO: Implement function for `MockDb`
Err(StorageError::MockDbError)?
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "filter_payouts_by_time_range_constraints",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_798785734200000408 | clm | function | // hyperswitch/crates/storage_impl/src/mock_db/payouts.rs
async fn get_total_count_of_filtered_payouts(
&self,
_merchant_id: &common_utils::id_type::MerchantId,
_active_payout_ids: &[common_utils::id_type::PayoutId],
_connector: Option<Vec<api_models::enums::PayoutConnectors>>,
_currency: Option<Vec<storage_enums::Currency>>,
_status: Option<Vec<storage_enums::PayoutStatus>>,
_payout_method: Option<Vec<storage_enums::PayoutType>>,
) -> CustomResult<i64, StorageError> {
// TODO: Implement function for `MockDb`
Err(StorageError::MockDbError)?
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_total_count_of_filtered_payouts",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_-6011478842494132644 | clm | function | // hyperswitch/crates/storage_impl/src/mock_db/payouts.rs
async fn filter_active_payout_ids_by_constraints(
&self,
_merchant_id: &common_utils::id_type::MerchantId,
_constraints: &hyperswitch_domain_models::payouts::PayoutFetchConstraints,
) -> CustomResult<Vec<common_utils::id_type::PayoutId>, StorageError> {
// TODO: Implement function for `MockDb`
Err(StorageError::MockDbError)?
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "filter_active_payout_ids_by_constraints",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_4618412341988285090 | clm | function | // hyperswitch/crates/storage_impl/src/mock_db/redis_conn.rs
fn get_redis_conn(
&self,
) -> Result<Arc<redis_interface::RedisConnectionPool>, error_stack::Report<RedisError>> {
self.redis.get_redis_conn()
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_redis_conn",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_8578117331596636815 | clm | function | // hyperswitch/crates/storage_impl/src/mock_db/payout_attempt.rs
async fn update_payout_attempt(
&self,
_this: &PayoutAttempt,
_payout_attempt_update: PayoutAttemptUpdate,
_payouts: &Payouts,
_storage_scheme: storage_enums::MerchantStorageScheme,
) -> CustomResult<PayoutAttempt, StorageError> {
// TODO: Implement function for `MockDb`
Err(StorageError::MockDbError)?
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "update_payout_attempt",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_6573434063205229791 | clm | function | // hyperswitch/crates/storage_impl/src/mock_db/payout_attempt.rs
async fn insert_payout_attempt(
&self,
_payout_attempt: PayoutAttemptNew,
_payouts: &Payouts,
_storage_scheme: storage_enums::MerchantStorageScheme,
) -> CustomResult<PayoutAttempt, StorageError> {
// TODO: Implement function for `MockDb`
Err(StorageError::MockDbError)?
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "insert_payout_attempt",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_-5153839417846742637 | clm | function | // hyperswitch/crates/storage_impl/src/mock_db/payout_attempt.rs
async fn find_payout_attempt_by_merchant_id_payout_attempt_id(
&self,
_merchant_id: &common_utils::id_type::MerchantId,
_payout_attempt_id: &str,
_storage_scheme: storage_enums::MerchantStorageScheme,
) -> CustomResult<PayoutAttempt, StorageError> {
// TODO: Implement function for `MockDb`
Err(StorageError::MockDbError)?
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "find_payout_attempt_by_merchant_id_payout_attempt_id",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_-3207833394353045550 | clm | function | // hyperswitch/crates/storage_impl/src/mock_db/payout_attempt.rs
async fn find_payout_attempt_by_merchant_id_connector_payout_id(
&self,
_merchant_id: &common_utils::id_type::MerchantId,
_connector_payout_id: &str,
_storage_scheme: storage_enums::MerchantStorageScheme,
) -> CustomResult<PayoutAttempt, StorageError> {
// TODO: Implement function for `MockDb`
Err(StorageError::MockDbError)?
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "find_payout_attempt_by_merchant_id_connector_payout_id",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_7203609410115138925 | clm | function | // hyperswitch/crates/storage_impl/src/mock_db/payout_attempt.rs
async fn get_filters_for_payouts(
&self,
_payouts: &[Payouts],
_merchant_id: &common_utils::id_type::MerchantId,
_storage_scheme: storage_enums::MerchantStorageScheme,
) -> CustomResult<
hyperswitch_domain_models::payouts::payout_attempt::PayoutListFilters,
StorageError,
> {
Err(StorageError::MockDbError)?
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_filters_for_payouts",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_4078903485375111274 | clm | function | // hyperswitch/crates/storage_impl/src/mock_db/payout_attempt.rs
async fn find_payout_attempt_by_merchant_id_merchant_order_reference_id(
&self,
_merchant_id: &common_utils::id_type::MerchantId,
_merchant_order_reference_id: &str,
_storage_scheme: storage_enums::MerchantStorageScheme,
) -> CustomResult<PayoutAttempt, StorageError> {
Err(StorageError::MockDbError)?
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "find_payout_attempt_by_merchant_id_merchant_order_reference_id",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_6725835478094412862 | clm | function | // hyperswitch/crates/storage_impl/src/mock_db/payment_intent.rs
async fn filter_payment_intent_by_constraints(
&self,
_state: &KeyManagerState,
_merchant_id: &common_utils::id_type::MerchantId,
_filters: &hyperswitch_domain_models::payments::payment_intent::PaymentIntentFetchConstraints,
_key_store: &MerchantKeyStore,
_storage_scheme: storage_enums::MerchantStorageScheme,
) -> CustomResult<Vec<PaymentIntent>, StorageError> {
// [#172]: Implement function for `MockDb`
Err(StorageError::MockDbError)?
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "filter_payment_intent_by_constraints",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_4966655599007411154 | clm | function | // hyperswitch/crates/storage_impl/src/mock_db/payment_intent.rs
async fn get_filtered_payment_intents_attempt(
&self,
_state: &KeyManagerState,
_merchant_id: &common_utils::id_type::MerchantId,
_constraints: &hyperswitch_domain_models::payments::payment_intent::PaymentIntentFetchConstraints,
_key_store: &MerchantKeyStore,
_storage_scheme: storage_enums::MerchantStorageScheme,
) -> error_stack::Result<
Vec<(
PaymentIntent,
hyperswitch_domain_models::payments::payment_attempt::PaymentAttempt,
)>,
StorageError,
> {
// [#172]: Implement function for `MockDb`
Err(StorageError::MockDbError)?
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_filtered_payment_intents_attempt",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_-5976574259748246923 | clm | function | // hyperswitch/crates/storage_impl/src/mock_db/payment_intent.rs
async fn filter_payment_intents_by_time_range_constraints(
&self,
_state: &KeyManagerState,
_merchant_id: &common_utils::id_type::MerchantId,
_time_range: &common_utils::types::TimeRange,
_key_store: &MerchantKeyStore,
_storage_scheme: storage_enums::MerchantStorageScheme,
) -> CustomResult<Vec<PaymentIntent>, StorageError> {
// [#172]: Implement function for `MockDb`
Err(StorageError::MockDbError)?
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "filter_payment_intents_by_time_range_constraints",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_4520538119879411972 | clm | function | // hyperswitch/crates/storage_impl/src/mock_db/payment_intent.rs
async fn get_intent_status_with_count(
&self,
_merchant_id: &common_utils::id_type::MerchantId,
_profile_id_list: Option<Vec<common_utils::id_type::ProfileId>>,
_time_range: &common_utils::types::TimeRange,
) -> CustomResult<Vec<(common_enums::IntentStatus, i64)>, StorageError> {
// [#172]: Implement function for `MockDb`
Err(StorageError::MockDbError)?
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_intent_status_with_count",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_4690406075957768778 | clm | function | // hyperswitch/crates/storage_impl/src/mock_db/payment_intent.rs
async fn get_filtered_active_attempt_ids_for_total_count(
&self,
_merchant_id: &common_utils::id_type::MerchantId,
_constraints: &hyperswitch_domain_models::payments::payment_intent::PaymentIntentFetchConstraints,
_storage_scheme: storage_enums::MerchantStorageScheme,
) -> error_stack::Result<Vec<Option<String>>, StorageError> {
// [#172]: Implement function for `MockDb`
Err(StorageError::MockDbError)?
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_filtered_active_attempt_ids_for_total_count",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_-3300558779797750031 | clm | function | // hyperswitch/crates/storage_impl/src/mock_db/payment_intent.rs
async fn insert_payment_intent(
&self,
_state: &KeyManagerState,
new: PaymentIntent,
_key_store: &MerchantKeyStore,
_storage_scheme: storage_enums::MerchantStorageScheme,
) -> CustomResult<PaymentIntent, StorageError> {
let mut payment_intents = self.payment_intents.lock().await;
payment_intents.push(new.clone());
Ok(new)
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "insert_payment_intent",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_4336463519460250965 | clm | function | // hyperswitch/crates/storage_impl/src/mock_db/payment_intent.rs
async fn update_payment_intent(
&self,
_state: &KeyManagerState,
_this: PaymentIntent,
_update: PaymentIntentUpdate,
_key_store: &MerchantKeyStore,
_storage_scheme: storage_enums::MerchantStorageScheme,
) -> CustomResult<PaymentIntent, StorageError> {
todo!()
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "update_payment_intent",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_1082463953299847764 | clm | function | // hyperswitch/crates/storage_impl/src/mock_db/payment_intent.rs
async fn find_payment_intent_by_payment_id_merchant_id(
&self,
_state: &KeyManagerState,
payment_id: &common_utils::id_type::PaymentId,
merchant_id: &common_utils::id_type::MerchantId,
_key_store: &MerchantKeyStore,
_storage_scheme: storage_enums::MerchantStorageScheme,
) -> CustomResult<PaymentIntent, StorageError> {
let payment_intents = self.payment_intents.lock().await;
Ok(payment_intents
.iter()
.find(|payment_intent| {
payment_intent.get_id() == payment_id && payment_intent.merchant_id.eq(merchant_id)
})
.cloned()
.unwrap())
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "find_payment_intent_by_payment_id_merchant_id",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_-4998308589675748892 | clm | function | // hyperswitch/crates/storage_impl/src/mock_db/payment_intent.rs
async fn find_payment_intent_by_id(
&self,
_state: &KeyManagerState,
id: &common_utils::id_type::GlobalPaymentId,
_merchant_key_store: &MerchantKeyStore,
_storage_scheme: storage_enums::MerchantStorageScheme,
) -> error_stack::Result<PaymentIntent, StorageError> {
let payment_intents = self.payment_intents.lock().await;
let payment_intent = payment_intents
.iter()
.find(|payment_intent| payment_intent.get_id() == id)
.ok_or(StorageError::ValueNotFound(
"PaymentIntent not found".to_string(),
))?;
Ok(payment_intent.clone())
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "find_payment_intent_by_id",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_137250852605290639 | clm | function | // hyperswitch/crates/storage_impl/src/mock_db/payment_intent.rs
async fn find_payment_intent_by_merchant_reference_id_profile_id(
&self,
_state: &KeyManagerState,
merchant_reference_id: &common_utils::id_type::PaymentReferenceId,
profile_id: &common_utils::id_type::ProfileId,
_merchant_key_store: &MerchantKeyStore,
_storage_scheme: &common_enums::MerchantStorageScheme,
) -> error_stack::Result<PaymentIntent, StorageError> {
let payment_intents = self.payment_intents.lock().await;
let payment_intent = payment_intents
.iter()
.find(|payment_intent| {
payment_intent.merchant_reference_id.as_ref() == Some(merchant_reference_id)
&& payment_intent.profile_id.eq(profile_id)
})
.ok_or(StorageError::ValueNotFound(
"PaymentIntent not found".to_string(),
))?;
Ok(payment_intent.clone())
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "find_payment_intent_by_merchant_reference_id_profile_id",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_-6016183306318528600 | clm | function | // hyperswitch/crates/storage_impl/src/payouts/payouts.rs
async fn insert_payout(
&self,
new: PayoutsNew,
_storage_scheme: MerchantStorageScheme,
) -> error_stack::Result<Payouts, StorageError> {
let conn = pg_connection_write(self).await?;
new.to_storage_model()
.insert(&conn)
.await
.map_err(|er| {
let new_err = diesel_error_to_data_error(*er.current_context());
er.change_context(new_err)
})
.map(Payouts::from_storage_model)
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "insert_payout",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_1107119064642294027 | clm | function | // hyperswitch/crates/storage_impl/src/payouts/payouts.rs
async fn update_payout(
&self,
this: &Payouts,
payout: PayoutsUpdate,
_payout_attempt: &PayoutAttempt,
_storage_scheme: MerchantStorageScheme,
) -> error_stack::Result<Payouts, StorageError> {
let conn = pg_connection_write(self).await?;
this.clone()
.to_storage_model()
.update(&conn, payout.to_storage_model())
.await
.map_err(|er| {
let new_err = diesel_error_to_data_error(*er.current_context());
er.change_context(new_err)
})
.map(Payouts::from_storage_model)
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "update_payout",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_113264790904172131 | clm | function | // hyperswitch/crates/storage_impl/src/payouts/payouts.rs
async fn find_payout_by_merchant_id_payout_id(
&self,
merchant_id: &common_utils::id_type::MerchantId,
payout_id: &common_utils::id_type::PayoutId,
_storage_scheme: MerchantStorageScheme,
) -> error_stack::Result<Payouts, StorageError> {
let conn = pg_connection_read(self).await?;
DieselPayouts::find_by_merchant_id_payout_id(&conn, merchant_id, payout_id)
.await
.map(Payouts::from_storage_model)
.map_err(|er| {
let new_err = diesel_error_to_data_error(*er.current_context());
er.change_context(new_err)
})
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "find_payout_by_merchant_id_payout_id",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_7879252443613525944 | clm | function | // hyperswitch/crates/storage_impl/src/payouts/payouts.rs
async fn find_optional_payout_by_merchant_id_payout_id(
&self,
merchant_id: &common_utils::id_type::MerchantId,
payout_id: &common_utils::id_type::PayoutId,
_storage_scheme: MerchantStorageScheme,
) -> error_stack::Result<Option<Payouts>, StorageError> {
let conn = pg_connection_read(self).await?;
DieselPayouts::find_optional_by_merchant_id_payout_id(&conn, merchant_id, payout_id)
.await
.map(|x| x.map(Payouts::from_storage_model))
.map_err(|er| {
let new_err = diesel_error_to_data_error(*er.current_context());
er.change_context(new_err)
})
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "find_optional_payout_by_merchant_id_payout_id",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_-8216732050259974939 | clm | function | // hyperswitch/crates/storage_impl/src/payouts/payouts.rs
async fn filter_payouts_by_constraints(
&self,
merchant_id: &common_utils::id_type::MerchantId,
filters: &PayoutFetchConstraints,
storage_scheme: MerchantStorageScheme,
) -> error_stack::Result<Vec<Payouts>, StorageError> {
let conn = connection::pg_connection_read(self).await?;
let conn = async_bb8_diesel::Connection::as_async_conn(&conn);
//[#350]: Replace this with Boxable Expression and pass it into generic filter
// when https://github.com/rust-lang/rust/issues/52662 becomes stable
let mut query = <DieselPayouts as HasTable>::table()
.filter(po_dsl::merchant_id.eq(merchant_id.to_owned()))
.order(po_dsl::created_at.desc())
.into_boxed();
match filters {
PayoutFetchConstraints::Single { payout_id } => {
query = query.filter(po_dsl::payout_id.eq(payout_id.to_owned()));
}
PayoutFetchConstraints::List(params) => {
if let Some(limit) = params.limit {
query = query.limit(limit.into());
}
if let Some(customer_id) = ¶ms.customer_id {
query = query.filter(po_dsl::customer_id.eq(customer_id.clone()));
}
if let Some(profile_id) = ¶ms.profile_id {
query = query.filter(po_dsl::profile_id.eq(profile_id.clone()));
}
query = match (params.starting_at, params.starting_after_id.as_ref()) {
(Some(starting_at), _) => query.filter(po_dsl::created_at.ge(starting_at)),
(None, Some(starting_after_id)) => {
// TODO: Fetch partial columns for this query since we only need some columns
let starting_at = self
.find_payout_by_merchant_id_payout_id(
merchant_id,
starting_after_id,
storage_scheme,
)
.await?
.created_at;
query.filter(po_dsl::created_at.ge(starting_at))
}
(None, None) => query,
};
query = match (params.ending_at, params.ending_before_id.as_ref()) {
(Some(ending_at), _) => query.filter(po_dsl::created_at.le(ending_at)),
(None, Some(ending_before_id)) => {
// TODO: Fetch partial columns for this query since we only need some columns
let ending_at = self
.find_payout_by_merchant_id_payout_id(
merchant_id,
ending_before_id,
storage_scheme,
)
.await?
.created_at;
query.filter(po_dsl::created_at.le(ending_at))
}
(None, None) => query,
};
query = query.offset(params.offset.into());
if let Some(currency) = ¶ms.currency {
query = query.filter(po_dsl::destination_currency.eq_any(currency.clone()));
}
if let Some(status) = ¶ms.status {
query = query.filter(po_dsl::status.eq_any(status.clone()));
}
}
}
logger::debug!(query = %diesel::debug_query::<diesel::pg::Pg,_>(&query).to_string());
db_metrics::track_database_call::<<DieselPayouts as HasTable>::Table, _, _>(
query.get_results_async::<DieselPayouts>(conn),
db_metrics::DatabaseOperation::Filter,
)
.await
.map(|payouts| {
payouts
.into_iter()
.map(Payouts::from_storage_model)
.collect::<Vec<Payouts>>()
})
.map_err(|er| {
StorageError::DatabaseError(
error_stack::report!(diesel_models::errors::DatabaseError::from(er))
.attach_printable("Error filtering payout records"),
)
.into()
})
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "filter_payouts_by_constraints",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_-4958697766019156321 | clm | function | // hyperswitch/crates/storage_impl/src/payouts/payouts.rs
async fn filter_payouts_and_attempts(
&self,
_merchant_id: &common_utils::id_type::MerchantId,
_filters: &PayoutFetchConstraints,
_storage_scheme: MerchantStorageScheme,
) -> error_stack::Result<
Vec<(
Payouts,
PayoutAttempt,
Option<DieselCustomer>,
Option<DieselAddress>,
)>,
StorageError,
> {
todo!()
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "filter_payouts_and_attempts",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_-2630289010075364211 | clm | function | // hyperswitch/crates/storage_impl/src/payouts/payouts.rs
async fn filter_payouts_by_time_range_constraints(
&self,
merchant_id: &common_utils::id_type::MerchantId,
time_range: &common_utils::types::TimeRange,
storage_scheme: MerchantStorageScheme,
) -> error_stack::Result<Vec<Payouts>, StorageError> {
let payout_filters = (*time_range).into();
self.filter_payouts_by_constraints(merchant_id, &payout_filters, storage_scheme)
.await
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "filter_payouts_by_time_range_constraints",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_-1741287060964629556 | clm | function | // hyperswitch/crates/storage_impl/src/payouts/payouts.rs
async fn get_total_count_of_filtered_payouts(
&self,
merchant_id: &common_utils::id_type::MerchantId,
active_payout_ids: &[common_utils::id_type::PayoutId],
connector: Option<Vec<PayoutConnectors>>,
currency: Option<Vec<storage_enums::Currency>>,
status: Option<Vec<storage_enums::PayoutStatus>>,
payout_type: Option<Vec<storage_enums::PayoutType>>,
) -> error_stack::Result<i64, StorageError> {
let conn = self
.db_store
.get_replica_pool()
.get()
.await
.change_context(StorageError::DatabaseConnectionError)?;
let connector_strings = connector.as_ref().map(|connectors| {
connectors
.iter()
.map(|c| c.to_string())
.collect::<Vec<String>>()
});
DieselPayouts::get_total_count_of_payouts(
&conn,
merchant_id,
active_payout_ids,
connector_strings,
currency,
status,
payout_type,
)
.await
.map_err(|er| {
let new_err = diesel_error_to_data_error(*er.current_context());
er.change_context(new_err)
})
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_total_count_of_filtered_payouts",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_-6432870451741327197 | clm | function | // hyperswitch/crates/storage_impl/src/payouts/payouts.rs
async fn filter_active_payout_ids_by_constraints(
&self,
_merchant_id: &common_utils::id_type::MerchantId,
_constraints: &PayoutFetchConstraints,
) -> error_stack::Result<Vec<common_utils::id_type::PayoutId>, StorageError> {
todo!()
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "filter_active_payout_ids_by_constraints",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_6613219219640319211 | clm | function | // hyperswitch/crates/storage_impl/src/payouts/payouts.rs
fn to_storage_model(self) -> Self::StorageModel {
match self {
Self::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,
} => DieselPayoutsUpdate::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::PayoutMethodIdUpdate { payout_method_id } => {
DieselPayoutsUpdate::PayoutMethodIdUpdate { payout_method_id }
}
Self::RecurringUpdate { recurring } => {
DieselPayoutsUpdate::RecurringUpdate { recurring }
}
Self::AttemptCountUpdate { attempt_count } => {
DieselPayoutsUpdate::AttemptCountUpdate { attempt_count }
}
Self::StatusUpdate { status } => DieselPayoutsUpdate::StatusUpdate { status },
}
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "to_storage_model",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_-640939101957407755 | clm | function | // hyperswitch/crates/storage_impl/src/payouts/payouts.rs
fn from_storage_model(_storage_model: Self::StorageModel) -> Self {
todo!("Reverse map should no longer be needed")
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "from_storage_model",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_-2901991672630011560 | clm | function | // hyperswitch/crates/storage_impl/src/payouts/payout_attempt.rs
async fn insert_payout_attempt(
&self,
new: PayoutAttemptNew,
_payouts: &Payouts,
_storage_scheme: MerchantStorageScheme,
) -> error_stack::Result<PayoutAttempt, errors::StorageError> {
let conn = pg_connection_write(self).await?;
new.to_storage_model()
.insert(&conn)
.await
.map_err(|er| {
let new_err = diesel_error_to_data_error(*er.current_context());
er.change_context(new_err)
})
.map(PayoutAttempt::from_storage_model)
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "insert_payout_attempt",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_-6613339593854280718 | clm | function | // hyperswitch/crates/storage_impl/src/payouts/payout_attempt.rs
async fn update_payout_attempt(
&self,
this: &PayoutAttempt,
payout: PayoutAttemptUpdate,
_payouts: &Payouts,
_storage_scheme: MerchantStorageScheme,
) -> error_stack::Result<PayoutAttempt, errors::StorageError> {
let conn = pg_connection_write(self).await?;
this.clone()
.to_storage_model()
.update_with_attempt_id(&conn, payout.to_storage_model())
.await
.map_err(|er| {
let new_err = diesel_error_to_data_error(*er.current_context());
er.change_context(new_err)
})
.map(PayoutAttempt::from_storage_model)
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "update_payout_attempt",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_-6863251144390190008 | clm | function | // hyperswitch/crates/storage_impl/src/payouts/payout_attempt.rs
async fn find_payout_attempt_by_merchant_id_payout_attempt_id(
&self,
merchant_id: &common_utils::id_type::MerchantId,
payout_attempt_id: &str,
_storage_scheme: MerchantStorageScheme,
) -> error_stack::Result<PayoutAttempt, errors::StorageError> {
let conn = pg_connection_read(self).await?;
DieselPayoutAttempt::find_by_merchant_id_payout_attempt_id(
&conn,
merchant_id,
payout_attempt_id,
)
.await
.map(PayoutAttempt::from_storage_model)
.map_err(|er| {
let new_err = diesel_error_to_data_error(*er.current_context());
er.change_context(new_err)
})
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "find_payout_attempt_by_merchant_id_payout_attempt_id",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_-5128880591475248851 | clm | function | // hyperswitch/crates/storage_impl/src/payouts/payout_attempt.rs
async fn find_payout_attempt_by_merchant_id_connector_payout_id(
&self,
merchant_id: &common_utils::id_type::MerchantId,
connector_payout_id: &str,
_storage_scheme: MerchantStorageScheme,
) -> error_stack::Result<PayoutAttempt, errors::StorageError> {
let conn = pg_connection_read(self).await?;
DieselPayoutAttempt::find_by_merchant_id_connector_payout_id(
&conn,
merchant_id,
connector_payout_id,
)
.await
.map(PayoutAttempt::from_storage_model)
.map_err(|er| {
let new_err = diesel_error_to_data_error(*er.current_context());
er.change_context(new_err)
})
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "find_payout_attempt_by_merchant_id_connector_payout_id",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_8542786401141454552 | clm | function | // hyperswitch/crates/storage_impl/src/payouts/payout_attempt.rs
async fn get_filters_for_payouts(
&self,
payouts: &[Payouts],
merchant_id: &common_utils::id_type::MerchantId,
_storage_scheme: MerchantStorageScheme,
) -> CustomResult<PayoutListFilters, errors::StorageError> {
let conn = pg_connection_read(self).await?;
let payouts = payouts
.iter()
.cloned()
.map(|payouts| payouts.to_storage_model())
.collect::<Vec<diesel_models::Payouts>>();
DieselPayoutAttempt::get_filters_for_payouts(&conn, payouts.as_slice(), merchant_id)
.await
.map_err(|er| {
let new_err = diesel_error_to_data_error(*er.current_context());
er.change_context(new_err)
})
.map(
|(connector, currency, status, payout_method)| PayoutListFilters {
connector: connector
.iter()
.filter_map(|c| {
PayoutConnectors::from_str(c)
.map_err(|e| {
logger::error!(
"Failed to parse payout connector '{}' - {}",
c,
e
);
})
.ok()
})
.collect(),
currency,
status,
payout_method,
},
)
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_filters_for_payouts",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_-8583168957535636855 | clm | function | // hyperswitch/crates/storage_impl/src/payouts/payout_attempt.rs
async fn find_payout_attempt_by_merchant_id_merchant_order_reference_id(
&self,
merchant_id: &common_utils::id_type::MerchantId,
merchant_order_reference_id: &str,
_storage_scheme: MerchantStorageScheme,
) -> error_stack::Result<PayoutAttempt, errors::StorageError> {
let conn = pg_connection_read(self).await?;
DieselPayoutAttempt::find_by_merchant_id_merchant_order_reference_id(
&conn,
merchant_id,
merchant_order_reference_id,
)
.await
.map(PayoutAttempt::from_storage_model)
.map_err(|er| {
let new_err = diesel_error_to_data_error(*er.current_context());
er.change_context(new_err)
})
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "find_payout_attempt_by_merchant_id_merchant_order_reference_id",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_4304252696677954256 | clm | function | // hyperswitch/crates/storage_impl/src/payouts/payout_attempt.rs
fn to_storage_model(self) -> Self::StorageModel {
match self {
Self::StatusUpdate {
connector_payout_id,
status,
error_message,
error_code,
is_eligible,
unified_code,
unified_message,
payout_connector_metadata,
} => DieselPayoutAttemptUpdate::StatusUpdate {
connector_payout_id,
status,
error_message,
error_code,
is_eligible,
unified_code,
unified_message,
payout_connector_metadata,
},
Self::PayoutTokenUpdate { payout_token } => {
DieselPayoutAttemptUpdate::PayoutTokenUpdate { payout_token }
}
Self::BusinessUpdate {
business_country,
business_label,
address_id,
customer_id,
} => DieselPayoutAttemptUpdate::BusinessUpdate {
business_country,
business_label,
address_id,
customer_id,
},
Self::UpdateRouting {
connector,
routing_info,
merchant_connector_id,
} => DieselPayoutAttemptUpdate::UpdateRouting {
connector,
routing_info,
merchant_connector_id,
},
Self::AdditionalPayoutMethodDataUpdate {
additional_payout_method_data,
} => DieselPayoutAttemptUpdate::AdditionalPayoutMethodDataUpdate {
additional_payout_method_data,
},
}
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "to_storage_model",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_-7362018816451593473 | clm | function | // hyperswitch/crates/storage_impl/src/payouts/payout_attempt.rs
fn from_storage_model(_storage_model: Self::StorageModel) -> Self {
todo!("Reverse map should no longer be needed")
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "from_storage_model",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_storage_impl_6394405516928151517 | clm | function | // hyperswitch/crates/storage_impl/src/payouts/payout_attempt.rs
async fn add_connector_payout_id_to_reverse_lookup<T: DatabaseStore>(
store: &KVRouterStore<T>,
key: &str,
merchant_id: &common_utils::id_type::MerchantId,
updated_attempt_attempt_id: &str,
connector_payout_id: &str,
storage_scheme: MerchantStorageScheme,
) -> CustomResult<ReverseLookup, errors::StorageError> {
let field = format!("poa_{updated_attempt_attempt_id}");
let reverse_lookup_new = ReverseLookupNew {
lookup_id: format!(
"po_conn_payout_{}_{}",
merchant_id.get_string_repr(),
connector_payout_id
),
pk_id: key.to_owned(),
sk_id: field.clone(),
source: "payout_attempt".to_string(),
updated_by: storage_scheme.to_string(),
};
store
.insert_reverse_lookup(reverse_lookup_new, storage_scheme)
.await
}
| {
"chunk": null,
"crate": "storage_impl",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "add_connector_payout_id_to_reverse_lookup",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_common_utils_-834684037037513639 | clm | function | // hyperswitch/crates/common_utils/tests/percentage.rs
fn invalid_range_more_than_100() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
let percentage = Percentage::<PRECISION_2>::from_string("100.01".to_string());
assert!(percentage.is_err());
if let Err(err) = percentage {
assert_eq!(
*err.current_context(),
PercentageError::InvalidPercentageValue
)
}
Ok(())
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "invalid_range_more_than_100",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_common_utils_2440691504151304346 | clm | function | // hyperswitch/crates/common_utils/tests/percentage.rs
fn invalid_range_less_than_0() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
let percentage = Percentage::<PRECISION_2>::from_string("-0.01".to_string());
assert!(percentage.is_err());
if let Err(err) = percentage {
assert_eq!(
*err.current_context(),
PercentageError::InvalidPercentageValue
)
}
Ok(())
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "invalid_range_less_than_0",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_common_utils_-4153956680423501271 | clm | function | // hyperswitch/crates/common_utils/tests/percentage.rs
fn invalid_string() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
let percentage = Percentage::<PRECISION_2>::from_string("-0.01ed".to_string());
assert!(percentage.is_err());
if let Err(err) = percentage {
assert_eq!(
*err.current_context(),
PercentageError::InvalidPercentageValue
)
}
Ok(())
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "invalid_string",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_common_utils_-3588126088231335030 | clm | function | // hyperswitch/crates/common_utils/tests/percentage.rs
fn valid_range() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
let percentage = Percentage::<PRECISION_2>::from_string("2.22".to_string());
assert!(percentage.is_ok());
if let Ok(percentage) = percentage {
assert_eq!(percentage.get_percentage(), 2.22)
}
let percentage = Percentage::<PRECISION_2>::from_string("0.05".to_string());
assert!(percentage.is_ok());
if let Ok(percentage) = percentage {
assert_eq!(percentage.get_percentage(), 0.05)
}
let percentage = Percentage::<PRECISION_2>::from_string("100.0".to_string());
assert!(percentage.is_ok());
if let Ok(percentage) = percentage {
assert_eq!(percentage.get_percentage(), 100.0)
}
Ok(())
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "valid_range",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_common_utils_-9063012227854545620 | clm | function | // hyperswitch/crates/common_utils/tests/percentage.rs
fn valid_precision() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
let percentage = Percentage::<PRECISION_2>::from_string("2.2".to_string());
assert!(percentage.is_ok());
if let Ok(percentage) = percentage {
assert_eq!(percentage.get_percentage(), 2.2)
}
let percentage = Percentage::<PRECISION_2>::from_string("2.20000".to_string());
assert!(percentage.is_ok());
if let Ok(percentage) = percentage {
assert_eq!(percentage.get_percentage(), 2.2)
}
let percentage = Percentage::<PRECISION_0>::from_string("2.0".to_string());
assert!(percentage.is_ok());
if let Ok(percentage) = percentage {
assert_eq!(percentage.get_percentage(), 2.0)
}
Ok(())
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "valid_precision",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_common_utils_-4918706204966758303 | clm | function | // hyperswitch/crates/common_utils/tests/percentage.rs
fn invalid_precision() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
let percentage = Percentage::<PRECISION_2>::from_string("2.221".to_string());
assert!(percentage.is_err());
if let Err(err) = percentage {
assert_eq!(
*err.current_context(),
PercentageError::InvalidPercentageValue
)
}
Ok(())
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "invalid_precision",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_common_utils_4239773166740359137 | clm | function | // hyperswitch/crates/common_utils/tests/percentage.rs
fn deserialization_test_ok() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
let mut decimal = 0;
let mut integer = 0;
// check for all percentage values from 0 to 100
while integer <= 100 {
let json_string = format!(
r#"
{{
"percentage" : {integer}.{decimal}
}}
"#,
);
let percentage = serde_json::from_str::<Percentage<PRECISION_2>>(&json_string);
assert!(percentage.is_ok());
if let Ok(percentage) = percentage {
assert_eq!(
percentage.get_percentage(),
format!("{integer}.{decimal}")
.parse::<f32>()
.unwrap_or_default()
)
}
if integer == 100 {
break;
}
decimal += 1;
if decimal == 100 {
decimal = 0;
integer += 1;
}
}
let json_string = r#"
{
"percentage" : 18.7
}
"#;
let percentage = serde_json::from_str::<Percentage<PRECISION_2>>(json_string);
assert!(percentage.is_ok());
if let Ok(percentage) = percentage {
assert_eq!(percentage.get_percentage(), 18.7)
}
let json_string = r#"
{
"percentage" : 12.0
}
"#;
let percentage = serde_json::from_str::<Percentage<PRECISION_0>>(json_string);
assert!(percentage.is_ok());
if let Ok(percentage) = percentage {
assert_eq!(percentage.get_percentage(), 12.0)
}
Ok(())
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "deserialization_test_ok",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_common_utils_5337262536254220566 | clm | function | // hyperswitch/crates/common_utils/tests/percentage.rs
fn deserialization_test_err() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
// invalid percentage precision
let json_string = r#"
{
"percentage" : 12.4
}
"#;
let percentage = serde_json::from_str::<Percentage<PRECISION_0>>(json_string);
assert!(percentage.is_err());
if let Err(err) = percentage {
assert_eq!(err.to_string(), "invalid value: percentage value 12.4, expected value should be a float between 0 to 100 and precise to only upto 0 decimal digits at line 4 column 9".to_string())
}
// invalid percentage value
let json_string = r#"
{
"percentage" : 123.42
}
"#;
let percentage = serde_json::from_str::<Percentage<PRECISION_2>>(json_string);
assert!(percentage.is_err());
if let Err(err) = percentage {
assert_eq!(err.to_string(), "invalid value: percentage value 123.42, expected value should be a float between 0 to 100 and precise to only upto 2 decimal digits at line 4 column 9".to_string())
}
// missing percentage field
let json_string = r#"
{
"percent": 22.0
}
"#;
let percentage = serde_json::from_str::<Percentage<PRECISION_2>>(json_string);
assert!(percentage.is_err());
if let Err(err) = percentage {
assert_eq!(
err.to_string(),
"missing field `percentage` at line 4 column 9".to_string()
)
}
Ok(())
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "deserialization_test_err",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_common_utils_-7232165505453933242 | clm | function | // hyperswitch/crates/common_utils/src/tokenization.rs
pub fn generate_token() -> String {
use nanoid::nanoid;
nanoid!(TOKEN_LENGTH)
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "generate_token",
"is_async": false,
"is_pub": true,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_common_utils_-8617583800556626167 | clm | function | // hyperswitch/crates/common_utils/src/ext_traits.rs
fn convert_and_encode<P>(&'e self) -> CustomResult<String, errors::ParsingError>
where
P: TryFrom<&'e Self> + Serialize,
Result<P, <P as TryFrom<&'e Self>>::Error>: ResultExt,
<Result<P, <P as TryFrom<&'e Self>>::Error> as ResultExt>::Ok: Serialize,
{
serde_json::to_string(
&P::try_from(self).change_context(errors::ParsingError::UnknownError)?,
)
.change_context(errors::ParsingError::EncodeError("string"))
.attach_printable_lazy(|| format!("Unable to convert {self:?} to a request"))
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "convert_and_encode",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_common_utils_4156991852041191457 | clm | function | // hyperswitch/crates/common_utils/src/ext_traits.rs
fn convert_and_url_encode<P>(&'e self) -> CustomResult<String, errors::ParsingError>
where
P: TryFrom<&'e Self> + Serialize,
Result<P, <P as TryFrom<&'e Self>>::Error>: ResultExt,
<Result<P, <P as TryFrom<&'e Self>>::Error> as ResultExt>::Ok: Serialize,
{
serde_urlencoded::to_string(
&P::try_from(self).change_context(errors::ParsingError::UnknownError)?,
)
.change_context(errors::ParsingError::EncodeError("url-encoded"))
.attach_printable_lazy(|| format!("Unable to convert {self:?} to a request"))
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "convert_and_url_encode",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_common_utils_2037682178639498819 | clm | function | // hyperswitch/crates/common_utils/src/ext_traits.rs
fn url_encode(&'e self) -> CustomResult<String, errors::ParsingError>
where
Self: Serialize,
{
serde_urlencoded::to_string(self)
.change_context(errors::ParsingError::EncodeError("url-encoded"))
.attach_printable_lazy(|| format!("Unable to convert {self:?} to a request"))
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "url_encode",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_common_utils_-7070688241586752548 | clm | function | // hyperswitch/crates/common_utils/src/ext_traits.rs
fn encode_to_string_of_json(&'e self) -> CustomResult<String, errors::ParsingError>
where
Self: Serialize,
{
serde_json::to_string(self)
.change_context(errors::ParsingError::EncodeError("json"))
.attach_printable_lazy(|| format!("Unable to convert {self:?} to a request"))
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "encode_to_string_of_json",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_common_utils_-4660244989793006262 | clm | function | // hyperswitch/crates/common_utils/src/ext_traits.rs
fn encode_to_string_of_xml(&'e self) -> CustomResult<String, errors::ParsingError>
where
Self: Serialize,
{
quick_xml::se::to_string(self)
.change_context(errors::ParsingError::EncodeError("xml"))
.attach_printable_lazy(|| format!("Unable to convert {self:?} to a request"))
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "encode_to_string_of_xml",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_common_utils_-897122775797637295 | clm | function | // hyperswitch/crates/common_utils/src/ext_traits.rs
fn encode_to_value(&'e self) -> CustomResult<serde_json::Value, errors::ParsingError>
where
Self: Serialize,
{
serde_json::to_value(self)
.change_context(errors::ParsingError::EncodeError("json-value"))
.attach_printable_lazy(|| format!("Unable to convert {self:?} to a value"))
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "encode_to_value",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_common_utils_2013411957203162119 | clm | function | // hyperswitch/crates/common_utils/src/ext_traits.rs
fn encode_to_vec(&'e self) -> CustomResult<Vec<u8>, errors::ParsingError>
where
Self: Serialize,
{
serde_json::to_vec(self)
.change_context(errors::ParsingError::EncodeError("byte-vec"))
.attach_printable_lazy(|| format!("Unable to convert {self:?} to a value"))
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "encode_to_vec",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_common_utils_1175399999970789867 | clm | function | // hyperswitch/crates/common_utils/src/ext_traits.rs
fn parse_struct<'de>(
&'de self,
type_name: &'static str,
) -> CustomResult<T, errors::ParsingError>
where
T: Deserialize<'de>,
{
serde_json::from_str::<T>(self)
.change_context(errors::ParsingError::StructParseFailure(type_name))
.attach_printable_lazy(|| {
format!(
"Unable to parse {type_name} from string {:?}",
Secret::<_, masking::JsonMaskStrategy>::new(serde_json::Value::String(
self.clone()
))
)
})
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "parse_struct",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_common_utils_5579286551322722986 | clm | function | // hyperswitch/crates/common_utils/src/ext_traits.rs
fn parse_value<U>(self, type_name: &'static str) -> CustomResult<U, errors::ParsingError>
where
T: ValueExt,
U: serde::de::DeserializeOwned,
{
let value = self
.get_required_value(type_name)
.change_context(errors::ParsingError::UnknownError)?;
value.parse_value(type_name)
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "parse_value",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_common_utils_6965768912052236578 | clm | function | // hyperswitch/crates/common_utils/src/ext_traits.rs
fn parse_enum<E>(self, enum_name: &'static str) -> CustomResult<E, errors::ParsingError>
where
T: AsRef<str>,
E: std::str::FromStr,
<E as std::str::FromStr>::Err: std::error::Error + Send + Sync + 'static,
{
let value = self
.get_required_value(enum_name)
.change_context(errors::ParsingError::UnknownError)?;
E::from_str(value.as_ref())
.change_context(errors::ParsingError::UnknownError)
.attach_printable_lazy(|| format!("Invalid {{ {enum_name}: {value:?} }} "))
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "parse_enum",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_common_utils_4791486302377412201 | clm | function | // hyperswitch/crates/common_utils/src/ext_traits.rs
async fn async_and_then<F, B, Fut>(self, func: F) -> Self::WrappedSelf<B>
where
F: FnOnce(A) -> Fut + Send,
Fut: futures::Future<Output = Self::WrappedSelf<B>> + Send,
{
match self {
Some(a) => func(a).await,
None => None,
}
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "async_and_then",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_common_utils_-3429569832375286677 | clm | function | // hyperswitch/crates/common_utils/src/ext_traits.rs
async fn async_map<F, B, Fut>(self, func: F) -> Self::WrappedSelf<B>
where
F: FnOnce(A) -> Fut + Send,
Fut: futures::Future<Output = B> + Send,
{
match self {
Some(a) => Some(func(a).await),
None => None,
}
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "async_map",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_common_utils_-733235039164208462 | clm | function | // hyperswitch/crates/common_utils/src/ext_traits.rs
async fn async_unwrap_or_else<F, Fut>(self, func: F) -> A
where
F: FnOnce() -> Fut + Send,
Fut: futures::Future<Output = A> + Send,
{
match self {
Some(a) => a,
None => func().await,
}
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "async_unwrap_or_else",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_common_utils_655025490191701346 | clm | function | // hyperswitch/crates/common_utils/src/ext_traits.rs
async fn async_or_else<F, Fut>(self, func: F) -> Self::WrappedSelf<A>
where
F: FnOnce() -> Fut + Send,
Fut: futures::Future<Output = Self::WrappedSelf<A>> + Send,
{
match self {
Some(a) => Some(a),
None => func().await,
}
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "async_or_else",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_common_utils_5447352569072226264 | clm | function | // hyperswitch/crates/common_utils/src/ext_traits.rs
fn is_default(&self) -> bool
where
T: Default + PartialEq<T>,
{
*self.peek() == T::default()
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "is_default",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_common_utils_-8988904943461901318 | clm | function | // hyperswitch/crates/common_utils/src/ext_traits.rs
fn is_default_or_empty(&self) -> bool
where
T: Default + PartialEq<T>,
{
self.peek().is_default() || self.peek().is_empty_after_trim()
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "is_default_or_empty",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_common_utils_-5721622648372322262 | clm | function | // hyperswitch/crates/common_utils/src/ext_traits.rs
fn is_empty_after_trim(&self) -> bool {
self.peek().is_empty_after_trim()
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "is_empty_after_trim",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_common_utils_5381384891294085632 | clm | function | // hyperswitch/crates/common_utils/src/ext_traits.rs
fn parse_xml<T>(self) -> Result<T, de::DeError>
where
T: serde::de::DeserializeOwned,
{
de::from_str(self)
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "parse_xml",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_common_utils_2743953837500324513 | clm | function | // hyperswitch/crates/common_utils/src/ext_traits.rs
fn check_value_present(
&self,
field_name: &'static str,
) -> CustomResult<(), errors::ValidationError> {
when(self.is_none(), || {
Err(errors::ValidationError::MissingRequiredField {
field_name: field_name.to_string(),
})
.attach_printable(format!("Missing required field {field_name} in {self:?}"))
})
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "check_value_present",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_common_utils_-3777217277313046767 | clm | function | // hyperswitch/crates/common_utils/src/ext_traits.rs
fn get_required_value(
self,
field_name: &'static str,
) -> CustomResult<T, errors::ValidationError> {
match self {
Some(v) => Ok(v),
None => Err(errors::ValidationError::MissingRequiredField {
field_name: field_name.to_string(),
})
.attach_printable(format!("Missing required field {field_name} in {self:?}")),
}
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_required_value",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_common_utils_8651681223864037098 | clm | function | // hyperswitch/crates/common_utils/src/ext_traits.rs
fn update_value(&mut self, value: Self) {
if let Some(a) = value {
*self = Some(a)
}
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "update_value",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_common_utils_-4232577406155869257 | clm | function | // hyperswitch/crates/common_utils/src/request.rs
fn default_request_headers() -> [(String, Maskable<String>); 1] {
use http::header;
[(header::VIA.to_string(), "HyperSwitch".to_string().into())]
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "default_request_headers",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_common_utils_5478618143917619286 | clm | function | // hyperswitch/crates/common_utils/src/request.rs
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(match self {
Self::Json(_) => "JsonRequestBody",
Self::FormUrlEncoded(_) => "FormUrlEncodedRequestBody",
Self::FormData(_) => "FormDataRequestBody",
Self::Xml(_) => "XmlRequestBody",
Self::RawBytes(_) => "RawBytesRequestBody",
})
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "fmt",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_common_utils_-8509272088359032231 | clm | function | // hyperswitch/crates/common_utils/src/request.rs
pub fn get_inner_value(&self) -> Secret<String> {
match self {
Self::Json(i) => serde_json::to_string(&i).unwrap_or_default().into(),
Self::FormUrlEncoded(i) => serde_urlencoded::to_string(i).unwrap_or_default().into(),
Self::Xml(i) => quick_xml::se::to_string(&i).unwrap_or_default().into(),
Self::FormData((_, i)) => serde_json::to_string(i).unwrap_or_default().into(),
Self::RawBytes(_) => String::new().into(),
}
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_inner_value",
"is_async": false,
"is_pub": true,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_common_utils_8285292431204270338 | clm | function | // hyperswitch/crates/common_utils/src/request.rs
pub fn new() -> Self {
Self {
method: Method::Get,
url: String::with_capacity(1024),
headers: std::collections::HashSet::new(),
certificate: None,
certificate_key: None,
body: None,
ca_certificate: None,
}
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "new",
"is_async": false,
"is_pub": true,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_common_utils_5153189600345391461 | clm | function | // hyperswitch/crates/common_utils/src/request.rs
pub fn set_body<T: Into<RequestContent>>(mut self, body: T) -> Self {
self.body.replace(body.into());
self
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "set_body",
"is_async": false,
"is_pub": true,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_common_utils_7672586435662127448 | clm | function | // hyperswitch/crates/common_utils/src/request.rs
pub fn add_default_headers(&mut self) {
self.headers.extend(default_request_headers());
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "add_default_headers",
"is_async": false,
"is_pub": true,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_common_utils_4048762772022445239 | clm | function | // hyperswitch/crates/common_utils/src/request.rs
pub fn add_header(&mut self, header: &str, value: Maskable<String>) {
self.headers.insert((String::from(header), value));
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "add_header",
"is_async": false,
"is_pub": true,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_common_utils_4927352385088608378 | clm | function | // hyperswitch/crates/common_utils/src/request.rs
pub fn add_certificate(mut self, certificate: Option<Secret<String>>) -> Self {
self.certificate = certificate;
self
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "add_certificate",
"is_async": false,
"is_pub": true,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_common_utils_2293593775790409263 | clm | function | // hyperswitch/crates/common_utils/src/request.rs
pub fn add_certificate_key(mut self, certificate_key: Option<Secret<String>>) -> Self {
self.certificate_key = certificate_key;
self
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "add_certificate_key",
"is_async": false,
"is_pub": true,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_common_utils_9043855953711732922 | clm | function | // hyperswitch/crates/common_utils/src/request.rs
pub fn url(mut self, url: &str) -> Self {
self.url = url.into();
self
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "url",
"is_async": false,
"is_pub": true,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_common_utils_2647553662755388522 | clm | function | // hyperswitch/crates/common_utils/src/request.rs
pub fn method(mut self, method: Method) -> Self {
self.method = method;
self
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "method",
"is_async": false,
"is_pub": true,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_common_utils_2412852149609787994 | clm | function | // hyperswitch/crates/common_utils/src/request.rs
pub fn attach_default_headers(mut self) -> Self {
self.headers.extend(default_request_headers());
self
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "attach_default_headers",
"is_async": false,
"is_pub": true,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_common_utils_2689601429799648177 | clm | function | // hyperswitch/crates/common_utils/src/request.rs
pub fn header(mut self, header: &str, value: &str) -> Self {
self.headers.insert((header.into(), value.into()));
self
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "header",
"is_async": false,
"is_pub": true,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_common_utils_7773850863697568535 | clm | function | // hyperswitch/crates/common_utils/src/request.rs
pub fn headers(mut self, headers: Vec<(String, Maskable<String>)>) -> Self {
self.headers.extend(headers);
self
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "headers",
"is_async": false,
"is_pub": true,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_common_utils_-6026976426542329518 | clm | function | // hyperswitch/crates/common_utils/src/request.rs
pub fn set_optional_body<T: Into<RequestContent>>(mut self, body: Option<T>) -> Self {
body.map(|body| self.body.replace(body.into()));
self
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "set_optional_body",
"is_async": false,
"is_pub": true,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_common_utils_7437984510578423464 | clm | function | // hyperswitch/crates/common_utils/src/request.rs
pub fn add_ca_certificate_pem(mut self, ca_certificate: Option<Secret<String>>) -> Self {
self.ca_certificate = ca_certificate;
self
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "add_ca_certificate_pem",
"is_async": false,
"is_pub": true,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_common_utils_-834654922628195200 | clm | function | // hyperswitch/crates/common_utils/src/request.rs
pub fn build(self) -> Request {
Request {
method: self.method,
url: self.url,
headers: self.headers,
certificate: self.certificate,
certificate_key: self.certificate_key,
body: self.body,
ca_certificate: self.ca_certificate,
}
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "build",
"is_async": false,
"is_pub": true,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_common_utils_8954844965709964079 | clm | function | // hyperswitch/crates/common_utils/src/request.rs
fn default() -> Self {
Self::new()
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "default",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_common_utils_-7816512856132443625 | clm | function | // hyperswitch/crates/common_utils/src/consts.rs
pub fn default_payments_list_limit() -> u32 {
10
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "default_payments_list_limit",
"is_async": false,
"is_pub": true,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_common_utils_-2746567230370100297 | clm | function | // hyperswitch/crates/common_utils/src/consts.rs
pub fn default_payouts_list_limit() -> u32 {
10
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "default_payouts_list_limit",
"is_async": false,
"is_pub": true,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_common_utils_8554076637344597657 | clm | function | // hyperswitch/crates/common_utils/src/types.rs
fn get_invalid_percentage_error_message(precision: u8) -> String {
format!(
"value should be a float between 0 to 100 and precise to only upto {precision} decimal digits",
)
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_invalid_percentage_error_message",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_common_utils_-5507717916149239789 | clm | function | // hyperswitch/crates/common_utils/src/types.rs
pub fn from_string(value: String) -> CustomResult<Self, PercentageError> {
if Self::is_valid_string_value(&value)? {
Ok(Self {
percentage: value
.parse::<f32>()
.change_context(PercentageError::InvalidPercentageValue)?,
})
} else {
Err(report!(PercentageError::InvalidPercentageValue))
.attach_printable(get_invalid_percentage_error_message(PRECISION))
}
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "from_string",
"is_async": false,
"is_pub": true,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_common_utils_2086858320613639815 | clm | function | // hyperswitch/crates/common_utils/src/types.rs
pub fn get_percentage(&self) -> f32 {
self.percentage
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_percentage",
"is_async": false,
"is_pub": true,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_common_utils_6502220327925834064 | clm | function | // hyperswitch/crates/common_utils/src/types.rs
pub fn apply_and_ceil_result(
&self,
amount: MinorUnit,
) -> CustomResult<MinorUnit, PercentageError> {
let max_amount = i64::MAX / 10000;
let amount = amount.0;
if amount > max_amount {
// value gets rounded off after i64::MAX/10000
Err(report!(PercentageError::UnableToApplyPercentage {
percentage: self.percentage,
amount: MinorUnit::new(amount),
}))
.attach_printable(format!(
"Cannot calculate percentage for amount greater than {max_amount}",
))
} else {
let percentage_f64 = f64::from(self.percentage);
let result = (amount as f64 * (percentage_f64 / 100.0)).ceil() as i64;
Ok(MinorUnit::new(result))
}
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "apply_and_ceil_result",
"is_async": false,
"is_pub": true,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_common_utils_-4445121231645022821 | clm | function | // hyperswitch/crates/common_utils/src/types.rs
fn is_valid_string_value(value: &str) -> CustomResult<bool, PercentageError> {
let float_value = Self::is_valid_float_string(value)?;
Ok(Self::is_valid_range(float_value) && Self::is_valid_precision_length(value))
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "is_valid_string_value",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_common_utils_1819555688036293783 | clm | function | // hyperswitch/crates/common_utils/src/types.rs
fn is_valid_float_string(value: &str) -> CustomResult<f32, PercentageError> {
value
.parse::<f32>()
.change_context(PercentageError::InvalidPercentageValue)
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "is_valid_float_string",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_fn_common_utils_6296223654642002532 | clm | function | // hyperswitch/crates/common_utils/src/types.rs
fn is_valid_range(value: f32) -> bool {
(0.0..=100.0).contains(&value)
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "is_valid_range",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.