id
stringlengths
20
153
type
stringclasses
1 value
granularity
stringclasses
14 values
content
stringlengths
16
84.3k
metadata
dict
hyperswitch_fn_common_utils_-1741485201900811387
clm
function
// hyperswitch/crates/common_utils/src/types.rs fn is_valid_precision_length(value: &str) -> bool { if value.contains('.') { // if string has '.' then take the decimal part and verify precision length match value.split('.').next_back() { Some(decimal_part) => { decimal_part.trim_end_matches('0').len() <= <u8 as Into<usize>>::into(PRECISION) } // will never be None None => false, } } else { // if there is no '.' then it is a whole number with no decimal part. So return true true } }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "is_valid_precision_length", "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_8364446601482133808
clm
function
// hyperswitch/crates/common_utils/src/types.rs fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { formatter.write_str("Percentage object") }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "expecting", "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_6958704692808180933
clm
function
// hyperswitch/crates/common_utils/src/types.rs fn visit_map<A>(self, mut map: A) -> Result<Self::Value, A::Error> where A: serde::de::MapAccess<'de>, { let mut percentage_value = None; while let Some(key) = map.next_key::<String>()? { if key.eq("percentage") { if percentage_value.is_some() { return Err(serde::de::Error::duplicate_field("percentage")); } percentage_value = Some(map.next_value::<serde_json::Value>()?); } else { // Ignore unknown fields let _: serde::de::IgnoredAny = map.next_value()?; } } if let Some(value) = percentage_value { let string_value = value.to_string(); Ok(Percentage::from_string(string_value.clone()).map_err(|_| { serde::de::Error::invalid_value( serde::de::Unexpected::Other(&format!("percentage value {string_value}")), &&*get_invalid_percentage_error_message(PRECISION), ) })?) } else { Err(serde::de::Error::missing_field("percentage")) } }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "visit_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_-3490521784023959965
clm
function
// hyperswitch/crates/common_utils/src/types.rs fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where D: Deserializer<'de>, { let deserialized_string = String::deserialize(deserializer)?; Self::from(deserialized_string.into()).map_err(serde::de::Error::custom) }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "deserialize", "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_-5553685065989366361
clm
function
// hyperswitch/crates/common_utils/src/types.rs pub fn get_major(&self) -> u64 { self.0.major }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_major", "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_-63157211058676087
clm
function
// hyperswitch/crates/common_utils/src/types.rs pub fn get_minor(&self) -> u64 { self.0.minor }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_minor", "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_8438398405772821905
clm
function
// hyperswitch/crates/common_utils/src/types.rs fn new(value: String) -> Self { Self(value) }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "new", "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_7732865453422847491
clm
function
// hyperswitch/crates/common_utils/src/types.rs fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!(f, "{}", self.0) }
{ "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_101490830520075634
clm
function
// hyperswitch/crates/common_utils/src/types.rs fn from_str(s: &str) -> Result<Self, Self::Err> { Ok(Self(Version::from_str(s).change_context( ParsingError::StructParseFailure("SemanticVersion"), )?)) }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "from_str", "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_7635413721213709738
clm
function
// hyperswitch/crates/common_utils/src/types.rs fn convert( &self, amount: MinorUnit, _currency: enums::Currency, ) -> Result<Self::Output, error_stack::Report<ParsingError>> { Ok(amount) }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "convert", "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_-5029910261583022239
clm
function
// hyperswitch/crates/common_utils/src/types.rs fn convert_back( &self, amount: MinorUnit, _currency: enums::Currency, ) -> Result<MinorUnit, error_stack::Report<ParsingError>> { Ok(amount) }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "convert_back", "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_6846638989576679228
clm
function
// hyperswitch/crates/common_utils/src/types.rs pub fn get_amount_as_i64(self) -> i64 { self.0 }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_amount_as_i64", "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_9151824760930857611
clm
function
// hyperswitch/crates/common_utils/src/types.rs pub fn zero() -> Self { Self("0".to_string()) }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "zero", "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_4691613754221351193
clm
function
// hyperswitch/crates/common_utils/src/types.rs pub fn is_greater_than(&self, value: i64) -> bool { self.get_amount_as_i64() > value }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "is_greater_than", "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_7631360409694054251
clm
function
// hyperswitch/crates/common_utils/src/types.rs fn to_major_unit_as_string( self, currency: enums::Currency, ) -> Result<StringMajorUnit, error_stack::Report<ParsingError>> { let amount_f64 = self.to_major_unit_as_f64(currency)?; let amount_string = if currency.is_zero_decimal_currency() { amount_f64.0.to_string() } else if currency.is_three_decimal_currency() { format!("{:.3}", amount_f64.0) } else { format!("{:.2}", amount_f64.0) }; Ok(StringMajorUnit::new(amount_string)) }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "to_major_unit_as_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_9200430484153658143
clm
function
// hyperswitch/crates/common_utils/src/types.rs fn to_major_unit_as_f64( self, currency: enums::Currency, ) -> Result<FloatMajorUnit, error_stack::Report<ParsingError>> { let amount_decimal = Decimal::from_i64(self.0).ok_or(ParsingError::I64ToDecimalConversionFailure)?; let amount = if currency.is_zero_decimal_currency() { amount_decimal } else if currency.is_three_decimal_currency() { amount_decimal / Decimal::from(1000) } else { amount_decimal / Decimal::from(100) }; let amount_f64 = amount .to_f64() .ok_or(ParsingError::FloatToDecimalConversionFailure)?; Ok(FloatMajorUnit::new(amount_f64)) }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "to_major_unit_as_f64", "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_-5708887142126426642
clm
function
// hyperswitch/crates/common_utils/src/types.rs fn to_minor_unit_as_string(self) -> Result<StringMinorUnit, error_stack::Report<ParsingError>> { Ok(StringMinorUnit::new(self.0.to_string())) }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "to_minor_unit_as_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_-7932745770527279426
clm
function
// hyperswitch/crates/common_utils/src/types.rs fn from(src: String) -> Self { // ID already hashed if src.starts_with("hs_hash_") { Self::HashedData(src) // Hash connector's transaction ID } else if src.len() > 128 { let mut hasher = blake3::Hasher::new(); let mut output = [0u8; consts::CONNECTOR_TRANSACTION_ID_HASH_BYTES]; hasher.update(src.as_bytes()); hasher.finalize_xof().fill(&mut output); let hash = hex::encode(output); Self::HashedData(format!("hs_hash_{hash}")) // Default } else { Self::TxnId(src) } }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "from", "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_-2430624070524262074
clm
function
// hyperswitch/crates/common_utils/src/types.rs fn from_sql(bytes: DB::RawValue<'_>) -> deserialize::Result<Self> { let val = LengthString::<PUBLISHABLE_KEY_LENGTH, PUBLISHABLE_KEY_LENGTH>::from_sql(bytes)?; Ok(Self(val)) }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "from_sql", "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_6830574615680571497
clm
function
// hyperswitch/crates/common_utils/src/types.rs fn to_sql<'b>(&'b self, out: &mut Output<'b, '_, DB>) -> diesel::serialize::Result { self.0.to_sql(out) }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "to_sql", "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_-7693666672227966164
clm
function
// hyperswitch/crates/common_utils/src/types.rs fn build(row: Self::Row) -> deserialize::Result<Self> { Ok(row) }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "build", "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_-5093871804935212259
clm
function
// hyperswitch/crates/common_utils/src/types.rs fn add(self, a2: Self) -> Self { Self(self.0 + a2.0) }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "add", "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_-868544869318008449
clm
function
// hyperswitch/crates/common_utils/src/types.rs fn sub(self, a2: Self) -> Self { Self(self.0 - a2.0) }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "sub", "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_-2874071800569055977
clm
function
// hyperswitch/crates/common_utils/src/types.rs fn mul(self, a2: u16) -> Self::Output { Self(self.0 * i64::from(a2)) }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "mul", "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_9210129217847134312
clm
function
// hyperswitch/crates/common_utils/src/types.rs fn sum<I: Iterator<Item = Self>>(iter: I) -> Self { iter.fold(Self(0), |a, b| a + b) }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "sum", "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_-7612629618367385039
clm
function
// hyperswitch/crates/common_utils/src/types.rs fn to_minor_unit_as_i64( &self, currency: enums::Currency, ) -> Result<MinorUnit, error_stack::Report<ParsingError>> { let amount_decimal = Decimal::from_str(&self.0).map_err(|e| { ParsingError::StringToDecimalConversionFailure { error: e.to_string(), } })?; let amount = if currency.is_zero_decimal_currency() { amount_decimal } else if currency.is_three_decimal_currency() { amount_decimal * Decimal::from(1000) } else { amount_decimal * Decimal::from(100) }; let amount_i64 = amount .to_i64() .ok_or(ParsingError::DecimalToI64ConversionFailure)?; Ok(MinorUnit::new(amount_i64)) }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "to_minor_unit_as_i64", "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_2145240076294125961
clm
function
// hyperswitch/crates/common_utils/src/types.rs pub fn get_amount_as_string(&self) -> String { self.0.clone() }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_amount_as_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_-1934391922785366760
clm
function
// hyperswitch/crates/common_utils/src/types.rs pub fn get_string_repr(&self) -> &str { &self.0 .0 }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_string_repr", "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_8490301700553999434
clm
function
// hyperswitch/crates/common_utils/src/types.rs pub fn wrap(url: url::Url) -> Self { Self(url) }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "wrap", "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_-5122383507843713599
clm
function
// hyperswitch/crates/common_utils/src/types.rs pub fn into_inner(self) -> url::Url { self.0 }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "into_inner", "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_2079048715097480824
clm
function
// hyperswitch/crates/common_utils/src/types.rs pub fn add_query_params(mut self, (key, value): (&str, &str)) -> Self { let url = self .0 .query_pairs_mut() .append_pair(key, value) .finish() .clone(); Self(url) }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "add_query_params", "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_-8101849502630115270
clm
function
// hyperswitch/crates/common_utils/src/types.rs fn amount_conversion_to_float_major_unit() { let request_amount = MinorUnit::new(999999999); let required_conversion = FloatMajorUnitForConnector; // Two decimal currency conversions let converted_amount = required_conversion .convert(request_amount, TWO_DECIMAL_CURRENCY) .unwrap(); assert_eq!(converted_amount.0, 9999999.99); let converted_back_amount = required_conversion .convert_back(converted_amount, TWO_DECIMAL_CURRENCY) .unwrap(); assert_eq!(converted_back_amount, request_amount); // Three decimal currency conversions let converted_amount = required_conversion .convert(request_amount, THREE_DECIMAL_CURRENCY) .unwrap(); assert_eq!(converted_amount.0, 999999.999); let converted_back_amount = required_conversion .convert_back(converted_amount, THREE_DECIMAL_CURRENCY) .unwrap(); assert_eq!(converted_back_amount, request_amount); // Zero decimal currency conversions let converted_amount = required_conversion .convert(request_amount, ZERO_DECIMAL_CURRENCY) .unwrap(); assert_eq!(converted_amount.0, 999999999.0); let converted_back_amount = required_conversion .convert_back(converted_amount, ZERO_DECIMAL_CURRENCY) .unwrap(); assert_eq!(converted_back_amount, request_amount); }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "amount_conversion_to_float_major_unit", "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_-7358369894577971171
clm
function
// hyperswitch/crates/common_utils/src/types.rs fn amount_conversion_to_string_major_unit() { let request_amount = MinorUnit::new(999999999); let required_conversion = StringMajorUnitForConnector; // Two decimal currency conversions let converted_amount_two_decimal_currency = required_conversion .convert(request_amount, TWO_DECIMAL_CURRENCY) .unwrap(); assert_eq!( converted_amount_two_decimal_currency.0, "9999999.99".to_string() ); let converted_back_amount = required_conversion .convert_back(converted_amount_two_decimal_currency, TWO_DECIMAL_CURRENCY) .unwrap(); assert_eq!(converted_back_amount, request_amount); // Three decimal currency conversions let converted_amount_three_decimal_currency = required_conversion .convert(request_amount, THREE_DECIMAL_CURRENCY) .unwrap(); assert_eq!( converted_amount_three_decimal_currency.0, "999999.999".to_string() ); let converted_back_amount = required_conversion .convert_back( converted_amount_three_decimal_currency, THREE_DECIMAL_CURRENCY, ) .unwrap(); assert_eq!(converted_back_amount, request_amount); // Zero decimal currency conversions let converted_amount = required_conversion .convert(request_amount, ZERO_DECIMAL_CURRENCY) .unwrap(); assert_eq!(converted_amount.0, "999999999".to_string()); let converted_back_amount = required_conversion .convert_back(converted_amount, ZERO_DECIMAL_CURRENCY) .unwrap(); assert_eq!(converted_back_amount, request_amount); }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "amount_conversion_to_string_major_unit", "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_-3600661850535497633
clm
function
// hyperswitch/crates/common_utils/src/types.rs fn amount_conversion_to_string_minor_unit() { let request_amount = MinorUnit::new(999999999); let currency = TWO_DECIMAL_CURRENCY; let required_conversion = StringMinorUnitForConnector; let converted_amount = required_conversion .convert(request_amount, currency) .unwrap(); assert_eq!(converted_amount.0, "999999999".to_string()); let converted_back_amount = required_conversion .convert_back(converted_amount, currency) .unwrap(); assert_eq!(converted_back_amount, request_amount); }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "amount_conversion_to_string_minor_unit", "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_2098983638314807285
clm
function
// hyperswitch/crates/common_utils/src/types.rs pub(crate) fn new_unchecked(input_string: String) -> Self { Self(input_string) }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "new_unchecked", "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_-134548670371377788
clm
function
// hyperswitch/crates/common_utils/src/types.rs pub fn from_str_unchecked(input_str: &'static str) -> Self { Self(LengthString::new_unchecked(input_str.to_owned())) }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "from_str_unchecked", "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_-2697887034494860924
clm
function
// hyperswitch/crates/common_utils/src/types.rs fn try_from(src: String) -> Result<Self, Self::Error> { if src.len() > 1024 { Err(report!(ValidationError::InvalidValue { message: "unified_message's length should not exceed 1024 characters".to_string() })) } else { Ok(Self(src)) } }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "try_from", "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_-1369707164310714596
clm
function
// hyperswitch/crates/common_utils/src/types.rs pub fn get_id(&self) -> &String { match self { Self::TxnId(id) | Self::HashedData(id) => id, } }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_id", "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_-4755954061940310400
clm
function
// hyperswitch/crates/common_utils/src/types.rs pub fn form_id_and_data(src: String) -> (Self, Option<String>) { let txn_id = Self::from(src.clone()); match txn_id { Self::TxnId(_) => (txn_id, None), Self::HashedData(_) => (txn_id, Some(src)), } }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "form_id_and_data", "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_7497742797840220165
clm
function
// hyperswitch/crates/common_utils/src/types.rs pub fn extract_hashed_data(&self) -> Option<String> { match self { Self::TxnId(_) => None, Self::HashedData(src) => Some(src.clone()), } }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "extract_hashed_data", "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_-9131761394117318578
clm
function
// hyperswitch/crates/common_utils/src/types.rs pub fn get_txn_id<'a>( &'a self, txn_data: Option<&'a String>, ) -> Result<&'a String, error_stack::Report<ValidationError>> { match (self, txn_data) { (Self::TxnId(id), _) => Ok(id), (Self::HashedData(_), Some(id)) => Ok(id), (Self::HashedData(id), None) => Err(report!(ValidationError::InvalidValue { message: "processor_transaction_data is empty for HashedData variant".to_string(), }) .attach_printable(format!( "processor_transaction_data is empty for connector_transaction_id {id}", ))), } }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_txn_id", "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_2301709131529265351
clm
function
// hyperswitch/crates/common_utils/src/types.rs fn get_optional_connector_transaction_id(&self) -> Option<&String> { None }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_optional_connector_transaction_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_common_utils_8517680121183664022
clm
function
// hyperswitch/crates/common_utils/src/types.rs fn get_connector_transaction_id(&self) -> &String { self.get_optional_connector_transaction_id() .unwrap_or_else(|| { static EMPTY_STRING: String = String::new(); &EMPTY_STRING }) }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_connector_transaction_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_common_utils_6133944852939216622
clm
function
// hyperswitch/crates/common_utils/src/types.rs fn get_optional_connector_refund_id(&self) -> Option<&String> { self.get_optional_connector_transaction_id() }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_optional_connector_refund_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_common_utils_-3307122167751631916
clm
function
// hyperswitch/crates/common_utils/src/types.rs pub fn generate(env_prefix: &'static str) -> Self { let publishable_key_string = format!("pk_{env_prefix}_{}", uuid::Uuid::now_v7().simple()); Self(LengthString::new_unchecked(publishable_key_string)) }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "generate", "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_1394097377286280710
clm
function
// hyperswitch/crates/common_utils/src/events.rs fn get_api_event_type(&self) -> Option<ApiEventsType> { T::get_api_event_type(self) }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_api_event_type", "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_-3738844919746103447
clm
function
// hyperswitch/crates/common_utils/src/encryption.rs fn from_sql(bytes: DB::RawValue<'_>) -> deserialize::Result<Self> { <Secret<Vec<u8>, EncryptionStrategy>>::from_sql(bytes).map(Self::new) }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "from_sql", "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_7177037809709948600
clm
function
// hyperswitch/crates/common_utils/src/encryption.rs fn to_sql<'b>( &'b self, out: &mut diesel::serialize::Output<'b, '_, DB>, ) -> diesel::serialize::Result { self.get_inner().to_sql(out) }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "to_sql", "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_1252244624819238597
clm
function
// hyperswitch/crates/common_utils/src/encryption.rs fn build(row: Self::Row) -> deserialize::Result<Self> { Ok(Self { inner: row }) }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "build", "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_-928831564542467876
clm
function
// hyperswitch/crates/common_utils/src/encryption.rs fn from(value: Encryptable<T>) -> Self { Self::new(value.into_encrypted()) }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "from", "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_6392519850635673299
clm
function
// hyperswitch/crates/common_utils/src/encryption.rs pub fn new(item: Secret<Vec<u8>, EncryptionStrategy>) -> Self { Self { inner: item } }
{ "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_1878408090187466866
clm
function
// hyperswitch/crates/common_utils/src/encryption.rs pub fn into_inner(self) -> Secret<Vec<u8>, EncryptionStrategy> { self.inner }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "into_inner", "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_-4089412426449662052
clm
function
// hyperswitch/crates/common_utils/src/encryption.rs pub fn get_inner(&self) -> &Secret<Vec<u8>, EncryptionStrategy> { &self.inner }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_inner", "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_1760642138303449038
clm
function
// hyperswitch/crates/common_utils/src/lib.rs pub fn now() -> PrimitiveDateTime { let utc_date_time = OffsetDateTime::now_utc(); PrimitiveDateTime::new(utc_date_time.date(), utc_date_time.time()) }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "now", "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_369213625221334764
clm
function
// hyperswitch/crates/common_utils/src/lib.rs pub fn convert_to_pdt(offset_time: OffsetDateTime) -> PrimitiveDateTime { PrimitiveDateTime::new(offset_time.date(), offset_time.time()) }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "convert_to_pdt", "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_-5263425177211555601
clm
function
// hyperswitch/crates/common_utils/src/lib.rs pub fn now_unix_timestamp() -> i64 { OffsetDateTime::now_utc().unix_timestamp() }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "now_unix_timestamp", "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_8873526635384714480
clm
function
// hyperswitch/crates/common_utils/src/lib.rs pub async fn time_it<T, Fut: futures::Future<Output = T>, F: FnOnce() -> Fut>( block: F, ) -> (T, f64) { let start = Instant::now(); let result = block().await; (result, start.elapsed().as_secs_f64() * 1000f64) }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "time_it", "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_7417787718370165597
clm
function
// hyperswitch/crates/common_utils/src/lib.rs pub fn format_date( date: PrimitiveDateTime, format: DateFormat, ) -> Result<String, time::error::Format> { let format = <&[BorrowedFormatItem<'_>]>::from(format); date.format(&format) }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "format_date", "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_3700042356259833995
clm
function
// hyperswitch/crates/common_utils/src/lib.rs pub fn date_as_yyyymmddthhmmssmmmz() -> Result<String, time::error::Format> { const ISO_CONFIG: EncodedConfig = Config::DEFAULT .set_time_precision(TimePrecision::Second { decimal_digits: NonZeroU8::new(3), }) .encode(); now().assume_utc().format(&Iso8601::<ISO_CONFIG>) }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "date_as_yyyymmddthhmmssmmmz", "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_5186401057176078872
clm
function
// hyperswitch/crates/common_utils/src/lib.rs pub fn now_rfc7231_http_date() -> Result<String, time::error::Format> { let now_utc = OffsetDateTime::now_utc(); // Desired format: ddd, DD MMM YYYY HH:mm:ss GMT // Example: Fri, 23 May 2025 06:19:35 GMT let format = time::macros::format_description!( "[weekday repr:short], [day padding:zero] [month repr:short] [year repr:full] [hour padding:zero repr:24]:[minute padding:zero]:[second padding:zero] GMT" ); now_utc.format(&format) }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "now_rfc7231_http_date", "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_-6837786650717842481
clm
function
// hyperswitch/crates/common_utils/src/lib.rs fn from(value: PrimitiveDateTime) -> Self { Self { inner: PhantomData, value, } }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "from", "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_4906042829189097557
clm
function
// hyperswitch/crates/common_utils/src/lib.rs fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where S: serde::Serializer, { serializer.collect_str(self) }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "serialize", "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_-8794207405135772410
clm
function
// hyperswitch/crates/common_utils/src/lib.rs fn fmt(input: &PrimitiveDateTime, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { let year = input.year(); #[allow(clippy::as_conversions)] let month = input.month() as u8; let day = input.day(); let hour = input.hour(); let minute = input.minute(); let second = input.second(); let output = format!("{year}{month:02}{day:02}{hour:02}{minute:02}{second:02}"); f.write_str(&output) }
{ "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_635261389922444948
clm
function
// hyperswitch/crates/common_utils/src/lib.rs pub fn generate_id(length: usize, prefix: &str) -> String { format!("{}_{}", prefix, nanoid::nanoid!(length, &consts::ALPHABETS)) }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "generate_id", "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_-4010446965545629016
clm
function
// hyperswitch/crates/common_utils/src/lib.rs fn generate_ref_id_with_default_length<const MAX_LENGTH: u8, const MIN_LENGTH: u8>( prefix: &str, ) -> id_type::LengthId<MAX_LENGTH, MIN_LENGTH> { id_type::LengthId::<MAX_LENGTH, MIN_LENGTH>::new(prefix) }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "generate_ref_id_with_default_length", "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_-6605434993276113735
clm
function
// hyperswitch/crates/common_utils/src/lib.rs pub fn generate_customer_id_of_default_length() -> id_type::CustomerId { use id_type::GenerateId; id_type::CustomerId::generate() }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "generate_customer_id_of_default_length", "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_-5192094865952192749
clm
function
// hyperswitch/crates/common_utils/src/lib.rs pub fn generate_organization_id_of_default_length() -> id_type::OrganizationId { use id_type::GenerateId; id_type::OrganizationId::generate() }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "generate_organization_id_of_default_length", "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_6697655694509449675
clm
function
// hyperswitch/crates/common_utils/src/lib.rs pub fn generate_profile_id_of_default_length() -> id_type::ProfileId { use id_type::GenerateId; id_type::ProfileId::generate() }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "generate_profile_id_of_default_length", "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_4169167442803060354
clm
function
// hyperswitch/crates/common_utils/src/lib.rs pub fn generate_routing_id_of_default_length() -> id_type::RoutingId { use id_type::GenerateId; id_type::RoutingId::generate() }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "generate_routing_id_of_default_length", "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_6602452510940505390
clm
function
// hyperswitch/crates/common_utils/src/lib.rs pub fn generate_merchant_connector_account_id_of_default_length( ) -> id_type::MerchantConnectorAccountId { use id_type::GenerateId; id_type::MerchantConnectorAccountId::generate() }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "generate_merchant_connector_account_id_of_default_length", "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_4414979275121562149
clm
function
// hyperswitch/crates/common_utils/src/lib.rs pub fn generate_profile_acquirer_id_of_default_length() -> id_type::ProfileAcquirerId { use id_type::GenerateId; id_type::ProfileAcquirerId::generate() }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "generate_profile_acquirer_id_of_default_length", "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_-5889840312016220525
clm
function
// hyperswitch/crates/common_utils/src/lib.rs pub fn generate_id_with_default_len(prefix: &str) -> String { let len: usize = consts::ID_LENGTH; format!("{}_{}", prefix, nanoid::nanoid!(len, &consts::ALPHABETS)) }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "generate_id_with_default_len", "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_-6023804170423918701
clm
function
// hyperswitch/crates/common_utils/src/lib.rs pub fn generate_time_ordered_id(prefix: &str) -> String { format!("{prefix}_{}", uuid::Uuid::now_v7().as_simple()) }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "generate_time_ordered_id", "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_2998115733635396494
clm
function
// hyperswitch/crates/common_utils/src/lib.rs pub fn generate_time_ordered_id_without_prefix() -> String { uuid::Uuid::now_v7().as_simple().to_string() }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "generate_time_ordered_id_without_prefix", "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_5062904216576580833
clm
function
// hyperswitch/crates/common_utils/src/lib.rs pub fn generate_id_with_len(length: usize) -> String { nanoid::nanoid!(length, &consts::ALPHABETS) }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "generate_id_with_len", "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_-7382635243774035049
clm
function
// hyperswitch/crates/common_utils/src/lib.rs fn get_database_url(&self, schema: &str) -> String { format!( "postgres://{}:{}@{}:{}/{}?application_name={}&options=-c%20search_path%3D{}", self.get_username(), self.get_password().peek(), self.get_host(), self.get_port(), self.get_dbname(), schema, schema, ) }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_database_url", "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_8603423689488152911
clm
function
// hyperswitch/crates/common_utils/src/lib.rs fn test_generate_id_with_alphanumeric_id() { let alphanumeric_id = AlphaNumericId::from(generate_id(10, "def").into()); assert!(alphanumeric_id.is_ok()) }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "test_generate_id_with_alphanumeric_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_common_utils_283306045548526353
clm
function
// hyperswitch/crates/common_utils/src/lib.rs fn test_generate_merchant_ref_id_with_default_length() { let ref_id = id_type::LengthId::< MAX_ALLOWED_MERCHANT_REFERENCE_ID_LENGTH, MIN_REQUIRED_MERCHANT_REFERENCE_ID_LENGTH, >::from(generate_id_with_default_len("def").into()); assert!(ref_id.is_ok()) }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "test_generate_merchant_ref_id_with_default_length", "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_-5879345393320313669
clm
function
// hyperswitch/crates/common_utils/src/new_type.rs fn apply_mask(val: &str, unmasked_char_count: usize, min_masked_char_count: usize) -> String { let len = val.len(); if len <= unmasked_char_count { return val.to_string(); } let mask_start_index = // For showing only last `unmasked_char_count` characters if len < (unmasked_char_count * 2 + min_masked_char_count) { 0 // For showing first and last `unmasked_char_count` characters } else { unmasked_char_count }; let mask_end_index = len - unmasked_char_count - 1; let range = mask_start_index..=mask_end_index; val.chars() .enumerate() .fold(String::new(), |mut acc, (index, ch)| { if ch.is_alphanumeric() && range.contains(&index) { acc.push('*'); } else { acc.push(ch); } acc }) }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "apply_mask", "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_-8017783915114519832
clm
function
// hyperswitch/crates/common_utils/src/new_type.rs fn from(secret: Secret<String>) -> Self { Self::from(secret.expose()) }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "from", "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_-7761270929698393558
clm
function
// hyperswitch/crates/common_utils/src/new_type.rs fn foreign_from(email: Email) -> Self { let email_value: String = email.expose().peek().to_owned(); Self::from(email_value) }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "foreign_from", "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_-7112012430554330862
clm
function
// hyperswitch/crates/common_utils/src/new_type.rs fn test_masked_types() { let sort_code = MaskedSortCode::from("110011".to_string()); let routing_number = MaskedRoutingNumber::from("056008849".to_string()); let bank_account = MaskedBankAccount::from("12345678901234".to_string()); let iban = MaskedIban::from("NL02ABNA0123456789".to_string()); let upi_vpa = MaskedUpiVpaId::from("someusername@okhdfcbank".to_string()); // Standard masked data tests assert_eq!(sort_code.0.peek().to_owned(), "11**11".to_string()); assert_eq!(routing_number.0.peek().to_owned(), "056***849".to_string()); assert_eq!( bank_account.0.peek().to_owned(), "1234******1234".to_string() ); assert_eq!(iban.0.peek().to_owned(), "NL02A********56789".to_string()); assert_eq!( upi_vpa.0.peek().to_owned(), "so**********@okhdfcbank".to_string() ); }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "test_masked_types", "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_-8190698348912669714
clm
function
// hyperswitch/crates/common_utils/src/new_type.rs fn test_apply_mask_fn() { let value = "12345678901".to_string(); // Generic masked tests assert_eq!(apply_mask(&value, 2, 2), "12*******01".to_string()); assert_eq!(apply_mask(&value, 3, 2), "123*****901".to_string()); assert_eq!(apply_mask(&value, 3, 3), "123*****901".to_string()); assert_eq!(apply_mask(&value, 4, 3), "1234***8901".to_string()); assert_eq!(apply_mask(&value, 4, 4), "*******8901".to_string()); assert_eq!(apply_mask(&value, 5, 4), "******78901".to_string()); assert_eq!(apply_mask(&value, 5, 5), "******78901".to_string()); assert_eq!(apply_mask(&value, 6, 5), "*****678901".to_string()); assert_eq!(apply_mask(&value, 6, 6), "*****678901".to_string()); assert_eq!(apply_mask(&value, 7, 6), "****5678901".to_string()); assert_eq!(apply_mask(&value, 7, 7), "****5678901".to_string()); assert_eq!(apply_mask(&value, 8, 7), "***45678901".to_string()); assert_eq!(apply_mask(&value, 8, 8), "***45678901".to_string()); }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "test_apply_mask_fn", "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_-6757557464086276955
clm
function
// hyperswitch/crates/common_utils/src/fp_utils.rs fn pure(v: R) -> Self::WrappedSelf<R> { Ok(v) }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "pure", "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_3906721107302889149
clm
function
// hyperswitch/crates/common_utils/src/fp_utils.rs pub fn when<W: Applicative<(), WrappedSelf<()> = W>, F>(predicate: bool, f: F) -> W where F: FnOnce() -> W, { if predicate { f() } else { W::pure(()) } }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "when", "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_-4085611501257529443
clm
function
// hyperswitch/crates/common_utils/src/signals.rs pub async fn signal_handler(_sig: DummySignal, _sender: mpsc::Sender<()>) {}
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "signal_handler", "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_328770922526164306
clm
function
// hyperswitch/crates/common_utils/src/signals.rs pub fn get_allowed_signals() -> Result<DummySignal, std::io::Error> { Ok(DummySignal) }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_allowed_signals", "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_2029985608076635644
clm
function
// hyperswitch/crates/common_utils/src/signals.rs pub fn handle(&self) -> Self { self.clone() }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "handle", "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_-7805258416554858960
clm
function
// hyperswitch/crates/common_utils/src/signals.rs pub fn close(self) {}
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "close", "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_8765121724063034264
clm
function
// hyperswitch/crates/common_utils/src/access_token.rs pub fn create_access_token_key( merchant_id: &id_type::MerchantId, merchant_connector_id_or_connector_name: impl Display, ) -> String { merchant_id.get_access_token_key(merchant_connector_id_or_connector_name) }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "create_access_token_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_-383161112348886339
clm
function
// hyperswitch/crates/common_utils/src/hashing.rs fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where S: Serializer, { let hashed_value = blake3::hash(self.0.peek().as_bytes()).to_hex(); hashed_value.serialize(serializer) }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "serialize", "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_1604105948874759420
clm
function
// hyperswitch/crates/common_utils/src/hashing.rs fn from(value: Secret<String, T>) -> Self { Self(value) }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "from", "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_7085797892885085443
clm
function
// hyperswitch/crates/common_utils/src/validation.rs pub fn validate_phone_number(phone_number: &str) -> Result<(), ValidationError> { let _ = phonenumber::parse(None, phone_number).map_err(|e| ValidationError::InvalidValue { message: format!("Could not parse phone number: {phone_number}, because: {e:?}"), })?; Ok(()) }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "validate_phone_number", "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_-5238745863880947237
clm
function
// hyperswitch/crates/common_utils/src/validation.rs pub fn validate_email(email: &str) -> CustomResult<(), ValidationError> { #[deny(clippy::invalid_regex)] static EMAIL_REGEX: LazyLock<Option<Regex>> = LazyLock::new(|| { #[allow(unknown_lints)] #[allow(clippy::manual_ok_err)] match Regex::new( r"^(?i)[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)+$", ) { Ok(regex) => Some(regex), Err(_error) => { #[cfg(feature = "logs")] logger::error!(?_error); None } } }); let email_regex = match EMAIL_REGEX.as_ref() { Some(regex) => Ok(regex), None => Err(report!(ValidationError::InvalidValue { message: "Invalid regex expression".into() })), }?; const EMAIL_MAX_LENGTH: usize = 319; if email.is_empty() || email.chars().count() > EMAIL_MAX_LENGTH { return Err(report!(ValidationError::InvalidValue { message: "Email address is either empty or exceeds maximum allowed length".into() })); } if !email_regex.is_match(email) { return Err(report!(ValidationError::InvalidValue { message: "Invalid email address format".into() })); } Ok(()) }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "validate_email", "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_8305088450866837969
clm
function
// hyperswitch/crates/common_utils/src/validation.rs pub fn validate_domain_against_allowed_domains( domain: &str, allowed_domains: HashSet<String>, ) -> bool { allowed_domains.iter().any(|allowed_domain| { Glob::new(allowed_domain) .map(|glob| glob.compile_matcher().is_match(domain)) .map_err(|err| { let err_msg = format!( "Invalid glob pattern for configured allowed_domain [{allowed_domain:?}]! - {err:?}", ); #[cfg(feature = "logs")] logger::error!(err_msg); err_msg }) .unwrap_or(false) }) }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "validate_domain_against_allowed_domains", "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_8010974222987917437
clm
function
// hyperswitch/crates/common_utils/src/validation.rs pub fn contains_potential_xss_or_sqli(input: &str) -> bool { let decoded = urlencoding::decode(input).unwrap_or_else(|_| input.into()); // Check for suspicious percent-encoded patterns static PERCENT_ENCODED: LazyLock<Option<Regex>> = LazyLock::new(|| { Regex::new(r"%[0-9A-Fa-f]{2}") .map_err(|_err| { #[cfg(feature = "logs")] logger::error!(?_err); }) .ok() }); if decoded.contains('%') { match PERCENT_ENCODED.as_ref() { Some(regex) => { if regex.is_match(&decoded) { return true; } } None => return true, } } if ammonia::is_html(&decoded) { return true; } static XSS: LazyLock<Option<Regex>> = LazyLock::new(|| { Regex::new( r"(?is)\bon[a-z]+\s*=|\bjavascript\s*:|\bdata\s*:\s*text/html|\b(alert|prompt|confirm|eval)\s*\(", ) .map_err(|_err| { #[cfg(feature = "logs")] logger::error!(?_err); }) .ok() }); static SQLI: LazyLock<Option<Regex>> = LazyLock::new(|| { Regex::new( r"(?is)(?:')\s*or\s*'?\d+'?=?\d*|union\s+select|insert\s+into|drop\s+table|information_schema|sleep\s*\(|--|;", ) .map_err(|_err| { #[cfg(feature = "logs")] logger::error!(?_err); }) .ok() }); match XSS.as_ref() { Some(regex) => { if regex.is_match(&decoded) { return true; } } None => return true, } match SQLI.as_ref() { Some(regex) => { if regex.is_match(&decoded) { return true; } } None => return true, } false }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "contains_potential_xss_or_sqli", "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_-6156233554664668973
clm
function
// hyperswitch/crates/common_utils/src/validation.rs fn new_tree(&self, _runner: &mut TestRunner) -> NewTree<Self> { Ok(Just(SafeEmail().fake())) }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "new_tree", "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_3966441132745452081
clm
function
// hyperswitch/crates/common_utils/src/validation.rs fn test_validate_email() { let result = validate_email("abc@example.com"); assert!(result.is_ok()); let result = validate_email("abc+123@example.com"); assert!(result.is_ok()); let result = validate_email(""); assert!(result.is_err()); }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "test_validate_email", "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_-7685211183262096071
clm
function
// hyperswitch/crates/common_utils/src/validation.rs fn test_validate_phone_number(phone_number: &str) { assert!(validate_phone_number(phone_number).is_ok()); }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "test_validate_phone_number", "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_7785469730954609359
clm
function
// hyperswitch/crates/common_utils/src/validation.rs fn test_invalid_phone_number(phone_number: &str) { let res = validate_phone_number(phone_number); assert!(res.is_err()); }
{ "chunk": null, "crate": "common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "test_invalid_phone_number", "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 }