id stringlengths 20 153 | type stringclasses 1
value | granularity stringclasses 14
values | content stringlengths 16 84.3k | metadata dict |
|---|---|---|---|---|
hyperswitch_fn_common_utils_-4453453830444470264 | clm | function | // hyperswitch/crates/common_utils/src/crypto.rs
fn test_hmac_sha512_sign_message() {
let message = r#"{"type":"payment_intent"}"#.as_bytes();
let secret = "hmac_secret_1234".as_bytes();
let right_signature = hex::decode("38b0bc1ea66b14793e39cd58e93d37b799a507442d0dd8d37443fa95dec58e57da6db4742636fea31201c48e57a66e73a308a2e5a5c6bb831e4e39fe2227c00f")
.expect("signature decoding");
let signature = super::HmacSha512
.sign_message(secret, message)
.expect("Signature");
assert_eq!(signature, right_signature);
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "test_hmac_sha512_sign_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_8153322500079127715 | clm | function | // hyperswitch/crates/common_utils/src/crypto.rs
fn test_hmac_sha512_verify_signature() {
let right_signature = hex::decode("38b0bc1ea66b14793e39cd58e93d37b799a507442d0dd8d37443fa95dec58e57da6db4742636fea31201c48e57a66e73a308a2e5a5c6bb831e4e39fe2227c00f")
.expect("signature decoding");
let wrong_signature =
hex::decode("d5550730377011948f12cc28889bee590d2a5434d6f54b87562f2dbc2657823f")
.expect("Wrong signature decoding");
let secret = "hmac_secret_1234".as_bytes();
let data = r#"{"type":"payment_intent"}"#.as_bytes();
let right_verified = super::HmacSha512
.verify_signature(secret, &right_signature, data)
.expect("Right signature verification result");
assert!(right_verified);
let wrong_verified = super::HmacSha256
.verify_signature(secret, &wrong_signature, data)
.expect("Wrong signature verification result");
assert!(!wrong_verified);
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "test_hmac_sha512_verify_signature",
"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_6770041629364579902 | clm | function | // hyperswitch/crates/common_utils/src/crypto.rs
fn test_gcm_aes_256_encode_message() {
let message = r#"{"type":"PAYMENT"}"#.as_bytes();
let secret =
hex::decode("000102030405060708090a0b0c0d0e0f000102030405060708090a0b0c0d0e0f")
.expect("Secret decoding");
let algorithm = super::GcmAes256;
let encoded_message = algorithm
.encode_message(&secret, message)
.expect("Encoded message and tag");
assert_eq!(
algorithm
.decode_message(&secret, encoded_message.into())
.expect("Decode Failed"),
message
);
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "test_gcm_aes_256_encode_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_2467697842976882351 | clm | function | // hyperswitch/crates/common_utils/src/crypto.rs
fn test_gcm_aes_256_decode_message() {
// Inputs taken from AES GCM test vectors provided by NIST
// https://github.com/briansmith/ring/blob/95948b3977013aed16db92ae32e6b8384496a740/tests/aead_aes_256_gcm_tests.txt#L447-L452
let right_secret =
hex::decode("feffe9928665731c6d6a8f9467308308feffe9928665731c6d6a8f9467308308")
.expect("Secret decoding");
let wrong_secret =
hex::decode("feffe9928665731c6d6a8f9467308308feffe9928665731c6d6a8f9467308309")
.expect("Secret decoding");
let message =
// The three parts of the message are the nonce, ciphertext and tag from the test vector
hex::decode(
"cafebabefacedbaddecaf888\
522dc1f099567d07f47f37a32a84427d643a8cdcbfe5c0c97598a2bd2555d1aa8cb08e48590dbb3da7b08b1056828838c5f61e6393ba7a0abcc9f662898015ad\
b094dac5d93471bdec1a502270e3cc6c"
).expect("Message decoding");
let algorithm = super::GcmAes256;
let decoded = algorithm
.decode_message(&right_secret, message.clone().into())
.expect("Decoded message");
assert_eq!(
decoded,
hex::decode("d9313225f88406e5a55909c5aff5269a86a7a9531534f7da2e4c303d8a318a721c3c0c95956809532fcf0e2449a6b525b16aedf5aa0de657ba637b391aafd255")
.expect("Decoded plaintext message")
);
let err_decoded = algorithm.decode_message(&wrong_secret, message.into());
assert!(err_decoded.is_err());
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "test_gcm_aes_256_decode_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_8602161198749846621 | clm | function | // hyperswitch/crates/common_utils/src/crypto.rs
fn test_md5_digest() {
let message = "abcdefghijklmnopqrstuvwxyz".as_bytes();
assert_eq!(
format!(
"{}",
hex::encode(super::Md5.generate_digest(message).expect("Digest"))
),
"c3fcd3d76192e4007dfb496cca67e13b"
);
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "test_md5_digest",
"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_1610967810659478433 | clm | function | // hyperswitch/crates/common_utils/src/crypto.rs
fn test_md5_verify_signature() {
let right_signature =
hex::decode("c3fcd3d76192e4007dfb496cca67e13b").expect("signature decoding");
let wrong_signature =
hex::decode("d5550730377011948f12cc28889bee590d2a5434d6f54b87562f2dbc2657823f")
.expect("Wrong signature decoding");
let secret = "".as_bytes();
let data = "abcdefghijklmnopqrstuvwxyz".as_bytes();
let right_verified = super::Md5
.verify_signature(secret, &right_signature, data)
.expect("Right signature verification result");
assert!(right_verified);
let wrong_verified = super::Md5
.verify_signature(secret, &wrong_signature, data)
.expect("Wrong signature verification result");
assert!(!wrong_verified);
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "test_md5_verify_signature",
"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_3717899294010640332 | clm | function | // hyperswitch/crates/common_utils/src/crypto.rs
fn test_rsa_pss_sha256_verify_signature() {
let signer = crate::crypto::RsaPssSha256;
let message = b"abcdefghijklmnopqrstuvwxyz";
let private_key_pem_bytes =
std::fs::read("../../private_key.pem").expect("Failed to read private key");
let parsed_pem = pem::parse(&private_key_pem_bytes).expect("Failed to parse PEM");
let private_key_der = parsed_pem.contents();
let signature = signer
.sign_message(&private_key_pem_bytes, message)
.expect("Signing failed");
let key_pair = crate::crypto::RsaKeyPair::from_pkcs8(private_key_der)
.expect("Failed to parse DER key");
let public_key_der = key_pair.public().as_ref().to_vec();
let public_key = UnparsedPublicKey::new(&RSA_PSS_2048_8192_SHA256, &public_key_der);
assert!(
public_key.verify(message, &signature).is_ok(),
"Right signature should verify"
);
let mut wrong_signature = signature.clone();
if let Some(byte) = wrong_signature.first_mut() {
*byte ^= 0xFF;
}
assert!(
public_key.verify(message, &wrong_signature).is_err(),
"Wrong signature should not verify"
);
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "test_rsa_pss_sha256_verify_signature",
"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_1001274107431935490 | clm | function | // hyperswitch/crates/common_utils/src/crypto.rs
fn test_rsasha256_verify_signature() {
use base64::Engine;
use rand::rngs::OsRng;
use rsa::{
pkcs8::EncodePublicKey,
signature::{RandomizedSigner, SignatureEncoding},
};
use crate::consts::BASE64_ENGINE;
let mut rng = OsRng;
let bits = 2048;
let private_key = rsa::RsaPrivateKey::new(&mut rng, bits).expect("keygen failed");
let signing_key = rsa::pkcs1v15::SigningKey::<rsa::sha2::Sha256>::new(private_key.clone());
let message = "{ This is a test message :) }".as_bytes();
let signature = signing_key.sign_with_rng(&mut rng, message);
let encoded_signature = BASE64_ENGINE.encode(signature.to_bytes());
let rsa_public_key = private_key.to_public_key();
let pem_format_public_key = rsa_public_key
.to_public_key_pem(rsa::pkcs8::LineEnding::LF)
.expect("transformation failed");
let encoded_pub_key = BASE64_ENGINE.encode(&pem_format_public_key[..]);
let right_verified = super::RsaSha256
.verify_signature(
encoded_pub_key.as_bytes(),
encoded_signature.as_bytes(),
message,
)
.expect("Right signature verification result");
assert!(right_verified);
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "test_rsasha256_verify_signature",
"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_8537717784958924921 | clm | function | // hyperswitch/crates/common_utils/src/custom_serde.rs
pub fn serialize<S>(date_time: &PrimitiveDateTime, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
{
date_time
.assume_utc()
.format(&Iso8601::<FORMAT_CONFIG>)
.map_err(S::Error::custom)?
.replace('T', " ")
.replace('Z', "")
.serialize(serializer)
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "serialize",
"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_-1984472708766268208 | clm | function | // hyperswitch/crates/common_utils/src/custom_serde.rs
pub fn deserialize<'a, D>(deserializer: D) -> Result<PrimitiveDateTime, D::Error>
where
D: Deserializer<'a>,
{
iso8601::deserialize(deserializer).map(|offset_date_time| {
let utc_date_time = offset_date_time.to_offset(UtcOffset::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": "deserialize",
"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_525478253941055410 | clm | function | // hyperswitch/crates/common_utils/src/custom_serde.rs
fn test_leap_second_parse() {
#[derive(Serialize, Deserialize)]
struct Try {
#[serde(with = "crate::custom_serde::iso8601")]
f: time::PrimitiveDateTime,
}
let leap_second_date_time = json!({"f": "2023-12-31T23:59:60.000Z"});
let deser = serde_json::from_value::<Try>(leap_second_date_time);
assert!(deser.is_ok())
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "test_leap_second_parse",
"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_6989736795435734968 | clm | function | // hyperswitch/crates/common_utils/src/metrics/utils.rs
pub async fn time_future<F, R>(future: F) -> (R, time::Duration)
where
F: futures::Future<Output = R>,
{
let start = time::Instant::now();
let result = future.await;
let time_spent = start.elapsed();
(result, time_spent)
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "time_future",
"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_6681531734296796781 | clm | function | // hyperswitch/crates/common_utils/src/metrics/utils.rs
pub async fn record_operation_time<F, R>(
future: F,
metric: &opentelemetry::metrics::Histogram<f64>,
key_value: &[opentelemetry::KeyValue],
) -> R
where
F: futures::Future<Output = R>,
{
let (result, time) = time_future(future).await;
metric.record(time.as_secs_f64(), key_value);
result
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "record_operation_time",
"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_-8582481584214270061 | clm | function | // hyperswitch/crates/common_utils/src/types/primitive_wrappers.rs
fn from(value: bool) -> 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_-8578123079919910539 | clm | function | // hyperswitch/crates/common_utils/src/types/primitive_wrappers.rs
fn to_sql<'b>(
&'b self,
out: &mut diesel::serialize::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_6821629771878202110 | clm | function | // hyperswitch/crates/common_utils/src/types/primitive_wrappers.rs
fn from_sql(value: DB::RawValue<'_>) -> diesel::deserialize::Result<Self> {
bool::from_sql(value).map(Self)
}
| {
"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_-7816326324277902211 | clm | function | // hyperswitch/crates/common_utils/src/types/primitive_wrappers.rs
pub fn is_true(&self) -> bool {
self.0
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "is_true",
"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_4812972558461668114 | clm | function | // hyperswitch/crates/common_utils/src/types/keymanager.rs
pub fn add_confirm_value_in_infra_values(
&self,
is_confirm_operation: bool,
) -> Option<serde_json::Value> {
self.infra_values.clone().map(|mut infra_values| {
if is_confirm_operation {
infra_values.as_object_mut().map(|obj| {
obj.insert(
"is_confirm_operation".to_string(),
serde_json::Value::Bool(true),
)
});
}
infra_values
})
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "add_confirm_value_in_infra_values",
"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_-4483462235767465691 | clm | function | // hyperswitch/crates/common_utils/src/types/keymanager.rs
fn from((map, identifier): (FxHashMap<String, Encryption>, Identifier)) -> Self {
let data = map
.into_iter()
.map(|(k, v)| (k, StrongSecret::new(v.clone().into_inner().expose())))
.collect();
Self { data, identifier }
}
| {
"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_3751262129646971362 | clm | function | // hyperswitch/crates/common_utils/src/types/keymanager.rs
fn foreign_from((masked_data, response): (Secret<T, S>, EncryptDataResponse)) -> Self {
Self::new(masked_data, response.data.data.peek().clone().into())
}
| {
"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_6937633486146342000 | clm | function | // hyperswitch/crates/common_utils/src/types/keymanager.rs
fn convert(
value: &DecryptedData,
encryption: Encryption,
) -> CustomResult<Self, errors::CryptoError> {
Ok(Self::new(
Secret::new(value.clone().inner().peek().clone()),
encryption.clone().into_inner(),
))
}
| {
"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_-7617339861157489241 | clm | function | // hyperswitch/crates/common_utils/src/types/keymanager.rs
fn foreign_try_from(
(mut encrypted_data, response): (FxHashMap<String, Encryption>, BatchDecryptDataResponse),
) -> Result<Self, Self::Error> {
response
.data
.0
.into_iter()
.map(|(k, v)| match encrypted_data.remove(&k) {
Some(encrypted) => Ok((k.clone(), Encryptable::convert(&v, encrypted.clone())?)),
None => Err(errors::CryptoError::DecodingFailed)?,
})
.collect()
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "foreign_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_-8135298152753783576 | clm | function | // hyperswitch/crates/common_utils/src/types/keymanager.rs
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
let data = String::from_utf8(self.data.peek().clone()).map_err(ser::Error::custom)?;
serializer.serialize_str(data.as_str())
}
| {
"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_5597106223677332771 | clm | function | // hyperswitch/crates/common_utils/src/types/keymanager.rs
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: Deserializer<'de>,
{
struct EncryptedDataVisitor;
impl Visitor<'_> for EncryptedDataVisitor {
type Value = EncryptedData;
fn expecting(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
formatter.write_str("string of the format {version}:{base64_encoded_data}'")
}
fn visit_str<E>(self, value: &str) -> Result<EncryptedData, E>
where
E: de::Error,
{
Ok(EncryptedData {
data: StrongSecret::new(value.as_bytes().to_vec()),
})
}
}
deserializer.deserialize_str(EncryptedDataVisitor)
}
| {
"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_8706310636256227211 | clm | function | // hyperswitch/crates/common_utils/src/types/keymanager.rs
fn expecting(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
formatter.write_str("string of the format {version}:{base64_encoded_data}'")
}
| {
"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_-8468766631251603016 | clm | function | // hyperswitch/crates/common_utils/src/types/keymanager.rs
fn visit_str<E>(self, value: &str) -> Result<EncryptedData, E>
where
E: de::Error,
{
Ok(EncryptedData {
data: StrongSecret::new(value.as_bytes().to_vec()),
})
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "visit_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_704240067774130312 | clm | function | // hyperswitch/crates/common_utils/src/types/keymanager.rs
pub fn from_data(data: StrongSecret<Vec<u8>>) -> Self {
Self(data)
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "from_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_6434805966463429144 | clm | function | // hyperswitch/crates/common_utils/src/types/keymanager.rs
pub fn inner(self) -> StrongSecret<Vec<u8>> {
self.0
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "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_4677179443844518655 | clm | function | // hyperswitch/crates/common_utils/src/types/authentication.rs
pub fn to_str(&self) -> &str {
match self {
Self::Payment(id) => id.get_string_repr(),
Self::Customer(id) => id.get_string_repr(),
Self::PaymentMethodSession(id) => id.get_string_repr(),
}
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "to_str",
"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_4717903004904997847 | clm | function | // hyperswitch/crates/common_utils/src/types/user/theme.rs
pub fn new(
entity_type: EntityType,
tenant_id: id_type::TenantId,
org_id: id_type::OrganizationId,
merchant_id: id_type::MerchantId,
profile_id: id_type::ProfileId,
) -> Self {
match entity_type {
EntityType::Tenant => Self::Tenant { tenant_id },
EntityType::Organization => Self::Organization { tenant_id, org_id },
EntityType::Merchant => Self::Merchant {
tenant_id,
org_id,
merchant_id,
},
EntityType::Profile => Self::Profile {
tenant_id,
org_id,
merchant_id,
profile_id,
},
}
}
| {
"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_1634939280835617305 | clm | function | // hyperswitch/crates/common_utils/src/types/user/theme.rs
pub fn entity_type(&self) -> EntityType {
match self {
Self::Tenant { .. } => EntityType::Tenant,
Self::Organization { .. } => EntityType::Organization,
Self::Merchant { .. } => EntityType::Merchant,
Self::Profile { .. } => EntityType::Profile,
}
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "entity_type",
"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_-7669000790214720803 | clm | function | // hyperswitch/crates/common_utils/src/types/user/theme.rs
pub fn tenant_id(&self) -> &id_type::TenantId {
match self {
Self::Tenant { tenant_id }
| Self::Organization { tenant_id, .. }
| Self::Merchant { tenant_id, .. }
| Self::Profile { tenant_id, .. } => tenant_id,
}
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "tenant_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_-6707748582223697056 | clm | function | // hyperswitch/crates/common_utils/src/types/user/theme.rs
pub fn org_id(&self) -> Option<&id_type::OrganizationId> {
match self {
Self::Tenant { .. } => None,
Self::Organization { org_id, .. }
| Self::Merchant { org_id, .. }
| Self::Profile { org_id, .. } => Some(org_id),
}
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "org_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_7006148067983015279 | clm | function | // hyperswitch/crates/common_utils/src/types/user/theme.rs
pub fn merchant_id(&self) -> Option<&id_type::MerchantId> {
match self {
Self::Tenant { .. } | Self::Organization { .. } => None,
Self::Merchant { merchant_id, .. } | Self::Profile { merchant_id, .. } => {
Some(merchant_id)
}
}
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "merchant_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_-1545706869748298818 | clm | function | // hyperswitch/crates/common_utils/src/types/user/theme.rs
pub fn profile_id(&self) -> Option<&id_type::ProfileId> {
match self {
Self::Tenant { .. } | Self::Organization { .. } | Self::Merchant { .. } => None,
Self::Profile { profile_id, .. } => Some(profile_id),
}
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "profile_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_-1943576273058681588 | clm | function | // hyperswitch/crates/common_utils/src/types/user/theme.rs
pub fn get_same_and_higher_lineages(self) -> Vec<Self> {
match &self {
Self::Tenant { .. } => vec![self],
Self::Organization { tenant_id, .. } => vec![
Self::Tenant {
tenant_id: tenant_id.clone(),
},
self,
],
Self::Merchant {
tenant_id, org_id, ..
} => vec![
Self::Tenant {
tenant_id: tenant_id.clone(),
},
Self::Organization {
tenant_id: tenant_id.clone(),
org_id: org_id.clone(),
},
self,
],
Self::Profile {
tenant_id,
org_id,
merchant_id,
..
} => vec![
Self::Tenant {
tenant_id: tenant_id.clone(),
},
Self::Organization {
tenant_id: tenant_id.clone(),
org_id: org_id.clone(),
},
Self::Merchant {
tenant_id: tenant_id.clone(),
org_id: org_id.clone(),
merchant_id: merchant_id.clone(),
},
self,
],
}
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_same_and_higher_lineages",
"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_3453504767227805221 | clm | function | // hyperswitch/crates/common_utils/src/id_type/organization.rs
pub fn try_from_string(org_id: String) -> CustomResult<Self, ValidationError> {
Self::try_from(std::borrow::Cow::from(org_id))
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "try_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_8054502238849810480 | clm | function | // hyperswitch/crates/common_utils/src/id_type/profile.rs
fn get_api_event_type(&self) -> Option<crate::events::ApiEventsType> {
Some(crate::events::ApiEventsType::BusinessProfile {
profile_id: self.clone(),
})
}
| {
"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_685951020744068615 | clm | function | // hyperswitch/crates/common_utils/src/id_type/profile.rs
fn from_str(s: &str) -> Result<Self, Self::Err> {
let cow_string = std::borrow::Cow::Owned(s.to_string());
Self::try_from(cow_string)
}
| {
"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_-6593132450939240015 | clm | function | // hyperswitch/crates/common_utils/src/id_type/profile.rs
fn from(val: ProfileId) -> Self {
Self::from(val.0 .0 .0)
}
| {
"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_-8125112302465644839 | clm | function | // hyperswitch/crates/common_utils/src/id_type/tenant.rs
pub fn get_default_global_tenant_id() -> Self {
Self(super::LengthId::new_unchecked(
super::AlphaNumericId::new_unchecked(DEFAULT_GLOBAL_TENANT_ID.to_string()),
))
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_default_global_tenant_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_8117129265669179376 | clm | function | // hyperswitch/crates/common_utils/src/id_type/tenant.rs
pub fn try_from_string(tenant_id: String) -> CustomResult<Self, ValidationError> {
Self::try_from(std::borrow::Cow::from(tenant_id))
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "try_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_-7725579326051280939 | clm | function | // hyperswitch/crates/common_utils/src/id_type/merchant_connector_account.rs
pub fn wrap(merchant_connector_account_id: String) -> CustomResult<Self, ValidationError> {
Self::try_from(std::borrow::Cow::from(merchant_connector_account_id))
}
| {
"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_8592408594266001760 | clm | function | // hyperswitch/crates/common_utils/src/id_type/merchant_connector_account.rs
fn from_str(s: &str) -> Result<Self, Self::Err> {
Self::try_from(std::borrow::Cow::Owned(s.to_string())).map_err(|_| std::fmt::Error)
}
| {
"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_-5470177138056659973 | clm | function | // hyperswitch/crates/common_utils/src/id_type/client_secret.rs
fn get_api_event_type(&self) -> Option<crate::events::ApiEventsType> {
Some(crate::events::ApiEventsType::ClientSecret {
key_id: self.clone(),
})
}
| {
"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_-1048578444799233049 | clm | function | // hyperswitch/crates/common_utils/src/id_type/client_secret.rs
pub fn generate_redis_key(&self) -> String {
format!("cs_{}", self.get_string_repr())
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "generate_redis_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_4502404661819779140 | clm | function | // hyperswitch/crates/common_utils/src/id_type/global_id.rs
fn prefix(self) -> &'static str {
match self {
Self::Customer => "cus",
Self::Payment => "pay",
Self::PaymentMethod => "pm",
Self::Attempt => "att",
Self::Refund => "ref",
Self::PaymentMethodSession => "pms",
Self::Token => "tok",
}
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "prefix",
"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_-5196145518566569103 | clm | function | // hyperswitch/crates/common_utils/src/id_type/global_id.rs
fn from(error: AlphaNumericIdError) -> Self {
Self::InvalidCellIdFormat(error)
}
| {
"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_5563827408671553401 | clm | function | // hyperswitch/crates/common_utils/src/id_type/global_id.rs
fn from_str(cell_id_string: impl AsRef<str>) -> Result<Self, CellIdError> {
let trimmed_input_string = cell_id_string.as_ref().trim().to_string();
let alphanumeric_id = AlphaNumericId::from(trimmed_input_string.into())?;
let length_id = LengthId::from_alphanumeric_id(alphanumeric_id)?;
Ok(Self(length_id))
}
| {
"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_8925618761543818590 | clm | function | // hyperswitch/crates/common_utils/src/id_type/global_id.rs
pub(crate) fn from_string(
input_string: std::borrow::Cow<'static, str>,
) -> Result<Self, GlobalIdError> {
let length_id = LengthId::from(input_string)?;
let input_string = &length_id.0 .0;
let (cell_id, _remaining) = input_string
.split_once("_")
.ok_or(GlobalIdError::InvalidIdFormat)?;
CellId::from_str(cell_id)?;
Ok(Self(length_id))
}
| {
"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_-1807774406499901244 | clm | function | // hyperswitch/crates/common_utils/src/id_type/global_id.rs
pub(crate) fn get_string_repr(&self) -> &str {
&self.0 .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_-1532907427899551553 | clm | function | // hyperswitch/crates/common_utils/src/id_type/global_id.rs
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
let deserialized_string = String::deserialize(deserializer)?;
Self::from_string(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_-3742040920088136437 | clm | function | // hyperswitch/crates/common_utils/src/id_type/global_id.rs
pub fn generate(cell_id: &CellId, entity: GlobalEntity) -> Self {
let prefix = format!("{}_{}", cell_id.get_string_repr(), entity.prefix());
let id = generate_time_ordered_id(&prefix);
let alphanumeric_id = AlphaNumericId::new_unchecked(id);
Self(LengthId::new_unchecked(alphanumeric_id))
}
| {
"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_-708425468351909738 | clm | function | // hyperswitch/crates/common_utils/src/id_type/global_id.rs
fn to_sql<'b>(
&'b self,
out: &mut diesel::serialize::Output<'b, '_, DB>,
) -> diesel::serialize::Result {
self.0 .0 .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_-5008478399388402122 | clm | function | // hyperswitch/crates/common_utils/src/id_type/global_id.rs
fn from_sql(value: DB::RawValue<'_>) -> diesel::deserialize::Result<Self> {
let string_val = String::from_sql(value)?;
let alphanumeric_id = AlphaNumericId::from(string_val.into())?;
let length_id = LengthId::from_alphanumeric_id(alphanumeric_id)?;
Ok(Self(length_id))
}
| {
"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_-1340366728542301817 | clm | function | // hyperswitch/crates/common_utils/src/id_type/global_id.rs
fn test_cell_id_from_str() {
let cell_id_string = "12345";
let cell_id = CellId::from_str(cell_id_string).unwrap();
assert_eq!(cell_id.get_string_repr(), cell_id_string);
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "test_cell_id_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_900903774357621150 | clm | function | // hyperswitch/crates/common_utils/src/id_type/global_id.rs
fn test_global_id_generate() {
let cell_id_string = "12345";
let entity = GlobalEntity::Customer;
let cell_id = CellId::from_str(cell_id_string).unwrap();
let global_id = GlobalId::generate(&cell_id, entity);
// Generate a regex for globalid
// Eg - 12abc_cus_abcdefghijklmnopqrstuvwxyz1234567890
let regex = regex::Regex::new(r"[a-z0-9]{5}_cus_[a-z0-9]{32}").unwrap();
assert!(regex.is_match(&global_id.0 .0 .0));
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "test_global_id_generate",
"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_5631245872203926028 | clm | function | // hyperswitch/crates/common_utils/src/id_type/global_id.rs
fn test_global_id_from_string() {
let input_string = "12345_cus_abcdefghijklmnopqrstuvwxyz1234567890";
let global_id = GlobalId::from_string(input_string.into()).unwrap();
assert_eq!(global_id.0 .0 .0, input_string);
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "test_global_id_from_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_973468289785115259 | clm | function | // hyperswitch/crates/common_utils/src/id_type/global_id.rs
fn test_global_id_deser() {
let input_string_for_serde_json_conversion =
r#""12345_cus_abcdefghijklmnopqrstuvwxyz1234567890""#;
let input_string = "12345_cus_abcdefghijklmnopqrstuvwxyz1234567890";
let global_id =
serde_json::from_str::<GlobalId>(input_string_for_serde_json_conversion).unwrap();
assert_eq!(global_id.0 .0 .0, input_string);
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "test_global_id_deser",
"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_8365387254899908805 | clm | function | // hyperswitch/crates/common_utils/src/id_type/global_id.rs
fn test_global_id_deser_error() {
let input_string_for_serde_json_conversion =
r#""123_45_cus_abcdefghijklmnopqrstuvwxyz1234567890""#;
let global_id = serde_json::from_str::<GlobalId>(input_string_for_serde_json_conversion);
assert!(global_id.is_err());
let expected_error_message = format!(
"cell id error: the minimum required length for this field is {CELL_IDENTIFIER_LENGTH}"
);
let error_message = global_id.unwrap_err().to_string();
assert_eq!(error_message, expected_error_message);
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "test_global_id_deser_error",
"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_7406691229218939890 | clm | function | // hyperswitch/crates/common_utils/src/id_type/subscription.rs
fn get_api_event_type(&self) -> Option<crate::events::ApiEventsType> {
Some(crate::events::ApiEventsType::Subscription)
}
| {
"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_8352776946624168065 | clm | function | // hyperswitch/crates/common_utils/src/id_type/merchant.rs
fn from(value: MerchantId) -> Self {
Self::Merchant(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_6222583095532708036 | clm | function | // hyperswitch/crates/common_utils/src/id_type/merchant.rs
pub fn from_merchant_name(merchant_name: MerchantName) -> Self {
let merchant_name_string = merchant_name.into_inner();
let merchant_id_prefix = merchant_name_string.trim().to_lowercase().replace(' ', "");
let alphanumeric_id =
AlphaNumericId::new_unchecked(generate_id_with_default_len(&merchant_id_prefix));
let length_id = LengthId::new_unchecked(alphanumeric_id);
Self(length_id)
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "from_merchant_name",
"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_2342178073738609977 | clm | function | // hyperswitch/crates/common_utils/src/id_type/merchant.rs
pub fn get_merchant_id_not_found() -> Self {
let alphanumeric_id = AlphaNumericId::new_unchecked("MERCHANT_ID_NOT_FOUND".to_string());
let length_id = LengthId::new_unchecked(alphanumeric_id);
Self(length_id)
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_merchant_id_not_found",
"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_-7212444424400543604 | clm | function | // hyperswitch/crates/common_utils/src/id_type/merchant.rs
pub fn get_internal_user_merchant_id(merchant_id: &str) -> Self {
let alphanumeric_id = AlphaNumericId::new_unchecked(merchant_id.to_string());
let length_id = LengthId::new_unchecked(alphanumeric_id);
Self(length_id)
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_internal_user_merchant_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_-1604676171687166179 | clm | function | // hyperswitch/crates/common_utils/src/id_type/merchant.rs
pub fn new_from_unix_timestamp() -> Self {
let merchant_id = format!("merchant_{}", date_time::now_unix_timestamp());
let alphanumeric_id = AlphaNumericId::new_unchecked(merchant_id);
let length_id = LengthId::new_unchecked(alphanumeric_id);
Self(length_id)
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "new_from_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_-1379874019843284166 | clm | function | // hyperswitch/crates/common_utils/src/id_type/merchant.rs
pub fn get_irrelevant_merchant_id() -> Self {
let alphanumeric_id = AlphaNumericId::new_unchecked("irrelevant_merchant_id".to_string());
let length_id = LengthId::new_unchecked(alphanumeric_id);
Self(length_id)
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_irrelevant_merchant_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_-3758785609607091334 | clm | function | // hyperswitch/crates/common_utils/src/id_type/merchant.rs
pub fn wrap(merchant_id: String) -> CustomResult<Self, ValidationError> {
Self::try_from(std::borrow::Cow::from(merchant_id))
}
| {
"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_6032344127460046245 | clm | function | // hyperswitch/crates/common_utils/src/id_type/merchant.rs
pub fn get_step_up_enabled_key(&self) -> String {
format!("step_up_enabled_{}", self.get_string_repr())
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_step_up_enabled_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_7393428088056190518 | clm | function | // hyperswitch/crates/common_utils/src/id_type/merchant.rs
pub fn get_max_auto_retries_enabled(&self) -> String {
format!("max_auto_retries_enabled_{}", self.get_string_repr())
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_max_auto_retries_enabled",
"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_8838372922210007386 | clm | function | // hyperswitch/crates/common_utils/src/id_type/merchant.rs
pub fn get_requires_cvv_key(&self) -> String {
format!("{}_requires_cvv", self.get_string_repr())
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_requires_cvv_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_-1508397476934871434 | clm | function | // hyperswitch/crates/common_utils/src/id_type/merchant.rs
pub fn get_pm_filters_cgraph_key(&self) -> String {
format!("pm_filters_cgraph_{}", self.get_string_repr())
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_pm_filters_cgraph_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_-42271122706709660 | clm | function | // hyperswitch/crates/common_utils/src/id_type/merchant.rs
pub fn get_blocklist_guard_key(&self) -> String {
format!("guard_blocklist_for_{}", self.get_string_repr())
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_blocklist_guard_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_5184256572537747641 | clm | function | // hyperswitch/crates/common_utils/src/id_type/merchant.rs
pub fn get_merchant_fingerprint_secret_key(&self) -> String {
format!("fingerprint_secret_{}", self.get_string_repr())
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_merchant_fingerprint_secret_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_-7400191782506113979 | clm | function | // hyperswitch/crates/common_utils/src/id_type/merchant.rs
pub fn get_surcharge_dsk_key(&self) -> String {
format!("surcharge_dsl_{}", self.get_string_repr())
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_surcharge_dsk_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_8971011966348798512 | clm | function | // hyperswitch/crates/common_utils/src/id_type/merchant.rs
pub fn get_dsl_config(&self) -> String {
format!("dsl_{}", self.get_string_repr())
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_dsl_config",
"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_-6199718419399485322 | clm | function | // hyperswitch/crates/common_utils/src/id_type/merchant.rs
pub fn get_creds_identifier_key(&self, creds_identifier: &str) -> String {
format!("mcd_{}_{creds_identifier}", self.get_string_repr())
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_creds_identifier_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_-3181703898354978426 | clm | function | // hyperswitch/crates/common_utils/src/id_type/merchant.rs
pub fn get_poll_id(&self, unique_id: &str) -> String {
format!("poll_{}_{unique_id}", self.get_string_repr())
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_poll_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_-1847963784259448249 | clm | function | // hyperswitch/crates/common_utils/src/id_type/merchant.rs
pub fn get_access_token_key(
&self,
merchant_connector_id_or_connector_name: impl Display,
) -> String {
format!(
"access_token_{}_{merchant_connector_id_or_connector_name}",
self.get_string_repr()
)
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_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_-197489832351846881 | clm | function | // hyperswitch/crates/common_utils/src/id_type/merchant.rs
pub fn get_skip_saving_wallet_at_connector_key(&self) -> String {
format!("skip_saving_wallet_at_connector_{}", self.get_string_repr())
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_skip_saving_wallet_at_connector_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_8686490962428553100 | clm | function | // hyperswitch/crates/common_utils/src/id_type/merchant.rs
pub fn get_payment_config_routing_id(&self) -> String {
format!("payment_config_id_{}", self.get_string_repr())
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_payment_config_routing_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_-3986553922094639545 | clm | function | // hyperswitch/crates/common_utils/src/id_type/merchant.rs
pub fn get_payment_method_surcharge_routing_id(&self) -> String {
format!("payment_method_surcharge_id_{}", self.get_string_repr())
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_payment_method_surcharge_routing_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_-4978203239648280554 | clm | function | // hyperswitch/crates/common_utils/src/id_type/merchant.rs
pub fn get_webhook_config_disabled_events_key(&self, connector_id: &str) -> String {
format!(
"whconf_disabled_events_{}_{connector_id}",
self.get_string_repr()
)
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_webhook_config_disabled_events_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_3403277484207545142 | clm | function | // hyperswitch/crates/common_utils/src/id_type/merchant.rs
pub fn get_should_call_gsm_payout_key(
&self,
payout_retry_type: common_enums::PayoutRetryType,
) -> String {
match payout_retry_type {
common_enums::PayoutRetryType::SingleConnector => format!(
"should_call_gsm_single_connector_payout_{}",
self.get_string_repr()
),
common_enums::PayoutRetryType::MultiConnector => format!(
"should_call_gsm_multiple_connector_payout_{}",
self.get_string_repr()
),
}
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_should_call_gsm_payout_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_254130537214241823 | clm | function | // hyperswitch/crates/common_utils/src/id_type/merchant.rs
pub fn get_should_call_gsm_key(&self) -> String {
format!("should_call_gsm_{}", self.get_string_repr())
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_should_call_gsm_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_-4536871692513820040 | clm | function | // hyperswitch/crates/common_utils/src/id_type/merchant.rs
pub fn get_max_auto_single_connector_payout_retries_enabled(
&self,
payout_retry_type: common_enums::PayoutRetryType,
) -> String {
match payout_retry_type {
common_enums::PayoutRetryType::SingleConnector => format!(
"max_auto_single_connector_payout_retries_enabled_{}",
self.get_string_repr()
),
common_enums::PayoutRetryType::MultiConnector => format!(
"max_auto_multiple_connector_payout_retries_enabled_{}",
self.get_string_repr()
),
}
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_max_auto_single_connector_payout_retries_enabled",
"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_5067639597484833704 | clm | function | // hyperswitch/crates/common_utils/src/id_type/merchant.rs
pub fn get_payment_update_enabled_for_client_auth_key(&self) -> String {
format!(
"payment_update_enabled_for_client_auth_{}",
self.get_string_repr()
)
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_payment_update_enabled_for_client_auth_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_8765780390209784355 | clm | function | // hyperswitch/crates/common_utils/src/id_type/payment.rs
pub fn get_hash_key_for_kv_store(&self) -> String {
format!("pi_{}", self.0 .0 .0)
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_hash_key_for_kv_store",
"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_-2630133593200212404 | clm | function | // hyperswitch/crates/common_utils/src/id_type/payment.rs
pub fn get_irrelevant_id(flow: &str) -> Self {
let alphanumeric_id =
AlphaNumericId::new_unchecked(format!("irrelevant_payment_id_in_{flow}"));
let id = LengthId::new_unchecked(alphanumeric_id);
Self(id)
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_irrelevant_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_-9115511856915912566 | clm | function | // hyperswitch/crates/common_utils/src/id_type/payment.rs
pub fn get_attempt_id(&self, attempt_count: i16) -> String {
format!("{}_{attempt_count}", self.get_string_repr())
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_attempt_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_-8982962076345744456 | clm | function | // hyperswitch/crates/common_utils/src/id_type/payment.rs
pub fn generate_client_secret(&self) -> String {
generate_id_with_default_len(&format!("{}_secret", self.get_string_repr()))
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "generate_client_secret",
"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_-2844304810431728572 | clm | function | // hyperswitch/crates/common_utils/src/id_type/payment.rs
pub fn get_pm_auth_key(&self) -> String {
format!("pm_auth_{}", self.get_string_repr())
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_pm_auth_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_8798852581474341275 | clm | function | // hyperswitch/crates/common_utils/src/id_type/payment.rs
pub fn get_external_authentication_request_poll_id(&self) -> String {
format!("external_authentication_{}", self.get_string_repr())
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_external_authentication_request_poll_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_7078238245242055830 | clm | function | // hyperswitch/crates/common_utils/src/id_type/payment.rs
pub fn generate_test_payment_id_for_sample_data() -> Self {
let id = generate_id_with_default_len("test");
let alphanumeric_id = AlphaNumericId::new_unchecked(id);
let id = LengthId::new_unchecked(alphanumeric_id);
Self(id)
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "generate_test_payment_id_for_sample_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_3177557333229489612 | clm | function | // hyperswitch/crates/common_utils/src/id_type/payment.rs
pub fn wrap(payment_id_string: String) -> CustomResult<Self, ValidationError> {
Self::try_from(std::borrow::Cow::from(payment_id_string))
}
| {
"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_8028776922228369195 | clm | function | // hyperswitch/crates/common_utils/src/id_type/payment.rs
fn from(val: PaymentId) -> Self {
Self::from(val.0 .0 .0)
}
| {
"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_-2121269146596539300 | clm | function | // hyperswitch/crates/common_utils/src/id_type/payment.rs
fn from_str(s: &str) -> Result<Self, Self::Err> {
let cow_string = std::borrow::Cow::Owned(s.to_string());
Self::try_from(cow_string)
}
| {
"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_-5672480083556257350 | clm | function | // hyperswitch/crates/common_utils/src/id_type/invoice.rs
fn get_api_event_type(&self) -> Option<crate::events::ApiEventsType> {
Some(crate::events::ApiEventsType::Invoice)
}
| {
"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_-8926088536085738322 | clm | function | // hyperswitch/crates/common_utils/src/id_type/customer.rs
fn get_api_event_type(&self) -> Option<crate::events::ApiEventsType> {
Some(crate::events::ApiEventsType::Customer {
customer_id: self.clone(),
})
}
| {
"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_1625204342559260353 | clm | function | // hyperswitch/crates/common_utils/src/id_type/profile_acquirer.rs
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
self.0 .0 .0.cmp(&other.0 .0 .0)
}
| {
"chunk": null,
"crate": "common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "cmp",
"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.