id stringlengths 20 153 | type stringclasses 1
value | granularity stringclasses 14
values | content stringlengths 16 84.3k | metadata dict |
|---|---|---|---|---|
connector-service_body_ucs_common_utils_-636367039352094853 | clm | function_body | // connector-service/backend/common_utils/src/crypto.rs
// Function: generate_cryptographically_secure_random_bytes
{
use rand::RngCore;
let mut bytes = [0; N];
rand::rngs::OsRng.fill_bytes(&mut bytes);
bytes
}
| {
"chunk": null,
"crate": "ucs_common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "generate_cryptographically_secure_random_bytes",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_ucs_common_utils_3298394782767671249 | clm | function_body | // connector-service/backend/common_utils/src/crypto.rs
// Function: deserialize_inner_value
{
let inner = self.inner;
let encrypted = self.encrypted;
let inner = f(inner)?;
Ok(Encryptable { inner, encrypted })
}
| {
"chunk": null,
"crate": "ucs_common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "deserialize_inner_value",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_ucs_common_utils_-5021712908686650781 | clm | function_body | // connector-service/backend/common_utils/src/crypto.rs
// Function: map
{
let encrypted_data = self.encrypted;
let masked_data = f(self.inner);
Encryptable {
inner: masked_data,
encrypted: encrypted_data,
}
}
| {
"chunk": null,
"crate": "ucs_common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "map",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_ucs_common_utils_1881263485851017443 | clm | function_body | // connector-service/backend/common_utils/src/crypto.rs
// Function: test_hmac_sha256_sign_message
{
let message = r#"{"type":"payment_intent"}"#.as_bytes();
let secret = "hmac_secret_1234".as_bytes();
let right_signature =
hex::decode("d5550730377011948f12cc28889bee590d2a5434d6f54b87562f2dbc2657823e")
.expect("Right signature decoding");
let signature = super::HmacSha256
.sign_message(secret, message)
.expect("Signature");
assert_eq!(signature, right_signature);
}
| {
"chunk": null,
"crate": "ucs_common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "test_hmac_sha256_sign_message",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_ucs_common_utils_6519156019437952426 | clm | function_body | // connector-service/backend/common_utils/src/crypto.rs
// Function: test_hmac_sha256_verify_signature
{
let right_signature =
hex::decode("d5550730377011948f12cc28889bee590d2a5434d6f54b87562f2dbc2657823e")
.expect("Right 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::HmacSha256
.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": "ucs_common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "test_hmac_sha256_verify_signature",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_ucs_common_utils_-6394162407448093879 | clm | function_body | // connector-service/backend/common_utils/src/crypto.rs
// Function: test_sha256_verify_signature
{
let right_signature =
hex::decode("123250a72f4e961f31661dbcee0fec0f4714715dc5ae1b573f908a0a5381ddba")
.expect("Right signature decoding");
let wrong_signature =
hex::decode("123250a72f4e961f31661dbcee0fec0f4714715dc5ae1b573f908a0a5381ddbb")
.expect("Wrong signature decoding");
let secret = "".as_bytes();
let data = r#"AJHFH9349JASFJHADJ9834115USD2020-11-13.13:22:34711000000021406655APPROVED12345product_id"#.as_bytes();
let right_verified = super::Sha256
.verify_signature(secret, &right_signature, data)
.expect("Right signature verification result");
assert!(right_verified);
let wrong_verified = super::Sha256
.verify_signature(secret, &wrong_signature, data)
.expect("Wrong signature verification result");
assert!(!wrong_verified);
}
| {
"chunk": null,
"crate": "ucs_common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "test_sha256_verify_signature",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_ucs_common_utils_6498358116768427645 | clm | function_body | // connector-service/backend/common_utils/src/crypto.rs
// Function: 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": "ucs_common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "test_hmac_sha512_sign_message",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_ucs_common_utils_-2895863274137072745 | clm | function_body | // connector-service/backend/common_utils/src/crypto.rs
// Function: 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": "ucs_common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "test_hmac_sha512_verify_signature",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_ucs_common_utils_1580068267330498258 | clm | function_body | // connector-service/backend/common_utils/src/crypto.rs
// Function: 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": "ucs_common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "test_gcm_aes_256_encode_message",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_ucs_common_utils_2556422336950555415 | clm | function_body | // connector-service/backend/common_utils/src/crypto.rs
// Function: 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": "ucs_common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "test_gcm_aes_256_decode_message",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_ucs_common_utils_5382989544976180449 | clm | function_body | // connector-service/backend/common_utils/src/crypto.rs
// Function: test_md5_digest
{
let message = "abcdefghijklmnopqrstuvwxyz".as_bytes();
assert_eq!(
format!(
"{}",
hex::encode(super::Md5.generate_digest(message).expect("Digest"))
),
"c3fcd3d76192e4007dfb496cca67e13b"
);
}
| {
"chunk": null,
"crate": "ucs_common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "test_md5_digest",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_ucs_common_utils_6013931804491974890 | clm | function_body | // connector-service/backend/common_utils/src/crypto.rs
// Function: 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": "ucs_common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "test_md5_verify_signature",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_ucs_common_utils_-4083661615617742322 | clm | function_body | // connector-service/backend/common_utils/src/event_publisher.rs
// Function: new
{
// Validate configuration before attempting to create writer
if config.brokers.is_empty() {
return Err(error_stack::Report::new(
EventPublisherError::InvalidConfiguration {
message: "brokers list cannot be empty".to_string(),
},
));
}
if config.topic.is_empty() {
return Err(error_stack::Report::new(
EventPublisherError::InvalidConfiguration {
message: "topic cannot be empty".to_string(),
},
));
}
tracing::debug!(
brokers = ?config.brokers,
topic = %config.topic,
"Creating EventPublisher with configuration"
);
let writer = KafkaWriterBuilder::new()
.brokers(config.brokers.clone())
.topic(config.topic.clone())
.build()
.map_err(|e| {
error_stack::Report::new(EventPublisherError::KafkaWriterInitializationFailed)
.attach_printable(format!("KafkaWriter build failed: {e}"))
.attach_printable(format!(
"Brokers: {:?}, Topic: {}",
config.brokers, config.topic
))
})?;
tracing::info!("EventPublisher created successfully");
Ok(Self {
writer: Arc::new(writer),
config: config.clone(),
})
}
| {
"chunk": null,
"crate": "ucs_common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "new",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_ucs_common_utils_3435722944313440304 | clm | function_body | // connector-service/backend/common_utils/src/event_publisher.rs
// Function: publish_event
{
let metadata = OwnedHeaders::new();
self.publish_event_with_metadata(event, topic, partition_key_field, metadata)
}
| {
"chunk": null,
"crate": "ucs_common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "publish_event",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_ucs_common_utils_1132078949388734795 | clm | function_body | // connector-service/backend/common_utils/src/event_publisher.rs
// Function: publish_event_with_metadata
{
tracing::debug!(
topic = %topic,
partition_key_field = %partition_key_field,
"Starting event publication to Kafka"
);
let mut headers = metadata;
let key = if let Some(partition_key_value) =
event.get(partition_key_field).and_then(|v| v.as_str())
{
headers = headers.insert(Header {
key: PARTITION_KEY_METADATA,
value: Some(partition_key_value.as_bytes()),
});
Some(partition_key_value)
} else {
tracing::warn!(
partition_key_field = %partition_key_field,
"Partition key field not found in event, message will be published without key"
);
None
};
let event_bytes = serde_json::to_vec(&event).map_err(|e| {
error_stack::Report::new(EventPublisherError::EventSerializationFailed)
.attach_printable(format!("Failed to serialize Event to JSON bytes: {e}"))
})?;
self.writer
.publish_event(&self.config.topic, key, &event_bytes, Some(headers))
.map_err(|e| {
let event_json = serde_json::to_string(&event).unwrap_or_default();
error_stack::Report::new(EventPublisherError::EventPublishFailed)
.attach_printable(format!("Kafka publish failed: {e}"))
.attach_printable(format!(
"Topic: {}, Event size: {} bytes",
self.config.topic,
event_bytes.len()
))
.attach_printable(format!("Failed event: {event_json}"))
})?;
let event_json = serde_json::to_string(&event).unwrap_or_default();
tracing::info!(
full_event = %event_json,
"Event successfully published to Kafka"
);
Ok(())
}
| {
"chunk": null,
"crate": "ucs_common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "publish_event_with_metadata",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_ucs_common_utils_-7541796757593474637 | clm | function_body | // connector-service/backend/common_utils/src/event_publisher.rs
// Function: emit_event_with_config
{
if !config.enabled {
tracing::info!("Event publishing disabled");
return;
}
// just log the error if publishing fails
let _ = get_event_publisher(config)
.and_then(|publisher| publisher.emit_event_with_config(event, config))
.inspect_err(|e| {
tracing::error!(error = ?e, "Failed to emit event");
});
}
| {
"chunk": null,
"crate": "ucs_common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "emit_event_with_config",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_ucs_common_utils_-2795403797790120625 | clm | function_body | // connector-service/backend/common_utils/src/event_publisher.rs
// Function: build_kafka_metadata
{
let mut headers = OwnedHeaders::new();
// Add lineage headers from Event.lineage_ids
for (key, value) in event.lineage_ids.inner() {
headers = headers.insert(Header {
key: &key,
value: Some(value.as_bytes()),
});
}
let ref_id_option = event
.additional_fields
.get("reference_id")
.and_then(|ref_id_value| ref_id_value.inner().as_str());
// Add reference_id from Event.additional_fields
if let Some(ref_id_str) = ref_id_option {
headers = headers.insert(Header {
key: "reference_id",
value: Some(ref_id_str.as_bytes()),
});
}
headers
}
| {
"chunk": null,
"crate": "ucs_common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "build_kafka_metadata",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_ucs_common_utils_-1747581733485610389 | clm | function_body | // connector-service/backend/common_utils/src/event_publisher.rs
// Function: process_event
{
let mut result = event.masked_serialize().map_err(|e| {
error_stack::Report::new(EventPublisherError::EventSerializationFailed)
.attach_printable(format!("Event masked serialization failed: {e}"))
})?;
// Process transformations
for (target_path, source_field) in &self.config.transformations {
if let Some(value) = result.get(source_field).cloned() {
// Replace _DOT_ and _dot_ with . to support nested keys in environment variables
let normalized_path = target_path.replace("_DOT_", ".").replace("_dot_", ".");
if let Err(e) = self.set_nested_value(&mut result, &normalized_path, value) {
tracing::warn!(
target_path = %target_path,
normalized_path = %normalized_path,
source_field = %source_field,
error = %e,
"Failed to set transformation, continuing with event processing"
);
}
}
}
// Process static values - log warnings but continue processing
for (target_path, static_value) in &self.config.static_values {
// Replace _DOT_ and _dot_ with . to support nested keys in environment variables
let normalized_path = target_path.replace("_DOT_", ".").replace("_dot_", ".");
let value = serde_json::json!(static_value);
if let Err(e) = self.set_nested_value(&mut result, &normalized_path, value) {
tracing::warn!(
target_path = %target_path,
normalized_path = %normalized_path,
static_value = %static_value,
error = %e,
"Failed to set static value, continuing with event processing"
);
}
}
// Process extraction
for (target_path, extraction_path) in &self.config.extractions {
if let Some(value) = self.extract_from_request(&result, extraction_path) {
// Replace _DOT_ and _dot_ with . to support nested keys in environment variables
let normalized_path = target_path.replace("_DOT_", ".").replace("_dot_", ".");
if let Err(e) = self.set_nested_value(&mut result, &normalized_path, value) {
tracing::warn!(
target_path = %target_path,
normalized_path = %normalized_path,
extraction_path = %extraction_path,
error = %e,
"Failed to set extraction, continuing with event processing"
);
}
}
}
Ok(result)
}
| {
"chunk": null,
"crate": "ucs_common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "process_event",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_ucs_common_utils_8100928521203693048 | clm | function_body | // connector-service/backend/common_utils/src/event_publisher.rs
// Function: extract_from_request
{
let mut path_parts = extraction_path.split('.');
let first_part = path_parts.next()?;
let source = match first_part {
"req" => event_value.get("request_data")?.clone(),
_ => return None,
};
let mut current = &source;
for part in path_parts {
current = current.get(part)?;
}
Some(current.clone())
}
| {
"chunk": null,
"crate": "ucs_common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "extract_from_request",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_ucs_common_utils_4906031500946221235 | clm | function_body | // connector-service/backend/common_utils/src/event_publisher.rs
// Function: set_nested_value
{
let path_parts: Vec<&str> = path.split('.').filter(|s| !s.is_empty()).collect();
if path_parts.is_empty() {
return Err(error_stack::Report::new(EventPublisherError::InvalidPath {
path: path.to_string(),
}));
}
if path_parts.len() == 1 {
if let Some(key) = path_parts.first() {
target[*key] = value;
return Ok(());
}
}
let result = path_parts.iter().enumerate().try_fold(
target,
|current,
(index, &part)|
-> CustomResult<&mut serde_json::Value, EventPublisherError> {
if index == path_parts.len() - 1 {
current[part] = value.clone();
Ok(current)
} else {
if !current[part].is_object() {
current[part] = serde_json::json!({});
}
current.get_mut(part).ok_or_else(|| {
error_stack::Report::new(EventPublisherError::InvalidPath {
path: format!("{path}.{part}"),
})
})
}
},
);
result.map(|_| ())
}
| {
"chunk": null,
"crate": "ucs_common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "set_nested_value",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_ucs_common_utils_7861734111288528443 | clm | function_body | // connector-service/backend/common_utils/src/event_publisher.rs
// Function: init_event_publisher
{
tracing::info!(
enabled = config.enabled,
"Initializing global EventPublisher"
);
let publisher = EventPublisher::new(config)?;
EVENT_PUBLISHER.set(publisher).map_err(|failed_publisher| {
error_stack::Report::new(EventPublisherError::AlreadyInitialized)
.attach_printable("EventPublisher was already initialized")
.attach_printable(format!(
"Existing config: brokers={:?}, topic={}",
failed_publisher.config.brokers, failed_publisher.config.topic
))
.attach_printable(format!(
"New config: brokers={:?}, topic={}",
config.brokers, config.topic
))
})?;
tracing::info!("Global EventPublisher initialized successfully");
Ok(())
}
| {
"chunk": null,
"crate": "ucs_common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "init_event_publisher",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_ucs_common_utils_-6632605894475009172 | clm | function_body | // connector-service/backend/common_utils/src/custom_serde.rs
// Function: serialize
{
date_time
.map(|date_time| date_time.assume_utc().unix_timestamp())
.serialize(serializer)
}
| {
"chunk": null,
"crate": "ucs_common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "serialize",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_ucs_common_utils_-33963666864823970 | clm | function_body | // connector-service/backend/common_utils/src/custom_serde.rs
// Function: deserialize
{
timestamp::option::deserialize(deserializer).map(|option_offset_date_time| {
option_offset_date_time.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": "ucs_common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "deserialize",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_ucs_common_utils_-8123122103564071794 | clm | function_body | // connector-service/backend/common_utils/src/global_id/payment_methods.rs
// Function: generate
{
let global_id = GlobalId::generate(cell_id, GlobalEntity::PaymentMethod);
Ok(Self(global_id))
}
| {
"chunk": null,
"crate": "ucs_common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "generate",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_ucs_common_utils_341577664082095980 | clm | function_body | // connector-service/backend/common_utils/src/global_id/payment_methods.rs
// Function: get_api_event_type
{
Some(crate::events::ApiEventsType::PaymentMethodSession {
payment_method_session_id: self.clone(),
})
}
| {
"chunk": null,
"crate": "ucs_common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_api_event_type",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_ucs_common_utils_7702380798656341830 | clm | function_body | // connector-service/backend/common_utils/src/global_id/payment_methods.rs
// Function: generate_from_string
{
let id = GlobalId::from_string(value.into())
.change_context(GlobalPaymentMethodIdError::ConstructionError)?;
Ok(Self(id))
}
| {
"chunk": null,
"crate": "ucs_common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "generate_from_string",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_ucs_common_utils_605693455615224175 | clm | function_body | // connector-service/backend/common_utils/src/global_id/refunds.rs
// Function: generate
{
let global_id = super::GlobalId::generate(cell_id, super::GlobalEntity::Refund);
Self(global_id)
}
| {
"chunk": null,
"crate": "ucs_common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "generate",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_ucs_common_utils_-4663655852224184920 | clm | function_body | // connector-service/backend/common_utils/src/global_id/refunds.rs
// Function: try_from
{
let merchant_ref_id = super::GlobalId::from_string(value).change_context(
errors::ValidationError::IncorrectValueProvided {
field_name: "refund_id",
},
)?;
Ok(Self(merchant_ref_id))
}
| {
"chunk": null,
"crate": "ucs_common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "try_from",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_ucs_common_utils_-6810754769394780743 | clm | function_body | // connector-service/backend/common_utils/src/global_id/token.rs
// Function: generate
{
let global_id = super::GlobalId::generate(cell_id, super::GlobalEntity::Token);
Self(global_id)
}
| {
"chunk": null,
"crate": "ucs_common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "generate",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_ucs_common_utils_3812160403284082718 | clm | function_body | // connector-service/backend/common_utils/src/global_id/token.rs
// Function: get_api_event_type
{
Some(crate::events::ApiEventsType::Token {
token_id: Some(self.clone()),
})
}
| {
"chunk": null,
"crate": "ucs_common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_api_event_type",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_ucs_common_utils_-3260622327463639465 | clm | function_body | // connector-service/backend/common_utils/src/global_id/payment.rs
// Function: generate
{
let global_id = super::GlobalId::generate(cell_id, super::GlobalEntity::Attempt);
Self(global_id)
}
| {
"chunk": null,
"crate": "ucs_common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "generate",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_ucs_common_utils_-3301347038015199109 | clm | function_body | // connector-service/backend/common_utils/src/global_id/payment.rs
// Function: try_from
{
let global_attempt_id = super::GlobalId::from_string(value).change_context(
errors::ValidationError::IncorrectValueProvided {
field_name: "payment_id",
},
)?;
Ok(Self(global_attempt_id))
}
| {
"chunk": null,
"crate": "ucs_common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "try_from",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_ucs_common_utils_-7852817296421188670 | clm | function_body | // connector-service/backend/common_utils/src/global_id/customer.rs
// Function: generate
{
let global_id = super::GlobalId::generate(cell_id, super::GlobalEntity::Customer);
Self(global_id)
}
| {
"chunk": null,
"crate": "ucs_common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "generate",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_ucs_common_utils_-3844874386441837858 | clm | function_body | // connector-service/backend/common_utils/src/global_id/customer.rs
// Function: get_api_event_type
{
Some(crate::events::ApiEventsType::Customer {
customer_id: Some(self.clone()),
})
}
| {
"chunk": null,
"crate": "ucs_common_utils",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_api_event_type",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_connector-integration_-3000302630736617794 | clm | function_body | // connector-service/backend/connector-integration/src/types.rs
// Function: get_connector_by_name
{
let connector = Self::convert_connector(*connector_name);
Self {
connector,
connector_name: *connector_name,
}
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_connector_by_name",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_connector-integration_95147426377412800 | clm | function_body | // connector-service/backend/connector-integration/src/types.rs
// Function: convert_connector
{
match connector_name {
ConnectorEnum::Adyen => Box::new(Adyen::new()),
ConnectorEnum::Razorpay => Box::new(Razorpay::new()),
ConnectorEnum::RazorpayV2 => Box::new(RazorpayV2::new()),
ConnectorEnum::Fiserv => Box::new(Fiserv::new()),
ConnectorEnum::Elavon => Box::new(Elavon::new()),
ConnectorEnum::Xendit => Box::new(Xendit::new()),
ConnectorEnum::Checkout => Box::new(Checkout::new()),
ConnectorEnum::Authorizedotnet => Box::new(Authorizedotnet::new()),
ConnectorEnum::Mifinity => Box::new(Mifinity::new()),
ConnectorEnum::Phonepe => Box::new(Phonepe::new()),
ConnectorEnum::Cashfree => Box::new(Cashfree::new()),
ConnectorEnum::Fiuu => Box::new(Fiuu::new()),
ConnectorEnum::Payu => Box::new(Payu::new()),
ConnectorEnum::Paytm => Box::new(Paytm::new()),
ConnectorEnum::Cashtocode => Box::new(Cashtocode::new()),
ConnectorEnum::Novalnet => Box::new(Novalnet::new()),
ConnectorEnum::Nexinets => Box::new(Nexinets::new()),
ConnectorEnum::Noon => Box::new(Noon::new()),
ConnectorEnum::Volt => Box::new(Volt::new()),
ConnectorEnum::Braintree => Box::new(Braintree::new()),
ConnectorEnum::Bluecode => Box::new(Bluecode::new()),
ConnectorEnum::Cryptopay => Box::new(Cryptopay::new()),
ConnectorEnum::Helcim => Box::new(Helcim::new()),
ConnectorEnum::Dlocal => Box::new(Dlocal::new()),
ConnectorEnum::Placetopay => Box::new(Placetopay::new()),
ConnectorEnum::Rapyd => Box::new(Rapyd::new()),
ConnectorEnum::Aci => Box::new(Aci::new()),
ConnectorEnum::Trustpay => Box::new(Trustpay::new()),
ConnectorEnum::Stripe => Box::new(Stripe::new()),
ConnectorEnum::Cybersource => Box::new(Cybersource::new()),
ConnectorEnum::Worldpay => Box::new(Worldpay::new()),
ConnectorEnum::Worldpayvantiv => Box::new(Worldpayvantiv::new()),
ConnectorEnum::Payload => Box::new(Payload::new()),
}
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "convert_connector",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_connector-integration_470705526634439353 | clm | function_body | // connector-service/backend/connector-integration/src/utils.rs
// Function: get_router_return_url
{
self.router_return_url
.clone()
.ok_or_else(missing_field_err("return_url"))
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_router_return_url",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_connector-integration_675342960875132202 | clm | function_body | // connector-service/backend/connector-integration/src/utils.rs
// Function: missing_field_err
{
Box::new(move || {
errors::ConnectorError::MissingRequiredField {
field_name: message,
}
.into()
})
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "missing_field_err",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_connector-integration_5640531032303249449 | clm | function_body | // connector-service/backend/connector-integration/src/utils.rs
// Function: to_connector_meta_from_secret
{
let connector_meta_secret =
connector_meta.ok_or_else(missing_field_err("connector_meta_data"))?;
let json_value = connector_meta_secret.expose();
let parsed: T = match json_value {
Value::String(json_str) => serde_json::from_str(&json_str)
.map_err(Report::from)
.change_context(errors::ConnectorError::InvalidConnectorConfig {
config: "merchant_connector_account.metadata",
})?,
_ => serde_json::from_value(json_value.clone())
.map_err(Report::from)
.change_context(errors::ConnectorError::InvalidConnectorConfig {
config: "merchant_connector_account.metadata",
})?,
};
Ok(parsed)
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "to_connector_meta_from_secret",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_connector-integration_-1478864235017962661 | clm | function_body | // connector-service/backend/connector-integration/src/utils.rs
// Function: handle_json_response_deserialization_failure
{
let response_data = String::from_utf8(res.response.to_vec())
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
// check for whether the response is in json format
match serde_json::from_str::<Value>(&response_data) {
// in case of unexpected response but in json format
Ok(_) => Err(errors::ConnectorError::ResponseDeserializationFailed)?,
// in case of unexpected response but in html or string format
Err(_error_msg) => Ok(ErrorResponse {
status_code: res.status_code,
code: "No error code".to_string(),
message: "Unsupported response type".to_string(),
reason: Some(response_data),
attempt_status: None,
connector_transaction_id: None,
network_advice_code: None,
network_decline_code: None,
network_error_message: None,
}),
}
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "handle_json_response_deserialization_failure",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_connector-integration_-3580005504110592529 | clm | function_body | // connector-service/backend/connector-integration/src/utils.rs
// Function: is_refund_failure
{
match status {
common_enums::RefundStatus::Failure | common_enums::RefundStatus::TransactionFailure => {
true
}
common_enums::RefundStatus::ManualReview
| common_enums::RefundStatus::Pending
| common_enums::RefundStatus::Success => false,
}
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "is_refund_failure",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_connector-integration_-1223816876361158047 | clm | function_body | // connector-service/backend/connector-integration/src/utils.rs
// Function: deserialize_zero_minor_amount_as_none
{
let amount = Option::<MinorUnit>::deserialize(deserializer)?;
match amount {
Some(value) if value.get_amount_as_i64() == 0 => Ok(None),
_ => Ok(amount),
}
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "deserialize_zero_minor_amount_as_none",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_connector-integration_-3932832299040430370 | clm | function_body | // connector-service/backend/connector-integration/src/utils.rs
// Function: convert_uppercase
{
use serde::de::Error;
let output = <&str>::deserialize(v)?;
output.to_uppercase().parse::<T>().map_err(D::Error::custom)
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "convert_uppercase",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_connector-integration_-6286963244239753163 | clm | function_body | // connector-service/backend/connector-integration/src/utils.rs
// Function: serialize_to_xml_string_with_root
{
let xml_content = quick_xml::se::to_string_with_root(root_name, data)
.change_context(errors::ConnectorError::RequestEncodingFailed)
.attach_printable("Failed to serialize XML with root")?;
let full_xml = format!("<?xml version=\"1.0\" encoding=\"UTF-8\"?>{}", xml_content);
Ok(full_xml)
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "serialize_to_xml_string_with_root",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_connector-integration_904565359718142124 | clm | function_body | // connector-service/backend/connector-integration/src/connectors/nexinets.rs
// Function: get_auth_header
{
let auth = nexinets::NexinetsAuthType::try_from(auth_type)
.change_context(errors::ConnectorError::FailedToObtainAuthType)?;
Ok(vec![(
headers::AUTHORIZATION.to_string(),
auth.api_key.into_masked(),
)])
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_auth_header",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_connector-integration_6609482388069251506 | clm | function_body | // connector-service/backend/connector-integration/src/connectors/nexinets.rs
// Function: build_error_response
{
let response: NexinetsErrorResponse = res
.response
.parse_struct("NexinetsErrorResponse")
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
with_error_response_body!(event_builder, response);
let errors = response.errors;
let mut message = String::new();
let mut static_message = String::new();
for error in errors.iter() {
let field = error.field.to_owned().unwrap_or_default();
let mut msg = String::new();
if !field.is_empty() {
msg.push_str(format!("{} : {}", field, error.message).as_str());
} else {
error.message.clone_into(&mut msg)
}
if message.is_empty() {
message.push_str(&msg);
static_message.push_str(&msg);
} else {
message.push_str(format!(", {msg}").as_str());
}
}
let connector_reason = format!("reason : {} , message : {}", response.message, message);
Ok(ErrorResponse {
status_code: response.status,
code: response.code.to_string(),
message: static_message,
reason: Some(connector_reason),
attempt_status: None,
connector_transaction_id: None,
network_advice_code: None,
network_decline_code: None,
network_error_message: None,
})
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "build_error_response",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_connector-integration_3823782437163760842 | clm | function_body | // connector-service/backend/connector-integration/src/connectors/braintree.rs
// Function: get_auth_header
{
let auth = braintree::BraintreeAuthType::try_from(auth_type)
.change_context(errors::ConnectorError::FailedToObtainAuthType)?;
let auth_key = format!("{}:{}", auth.public_key.peek(), auth.private_key.peek());
let auth_header = format!("Basic {}", BASE64_ENGINE.encode(auth_key));
Ok(vec![(
headers::AUTHORIZATION.to_string(),
auth_header.into_masked(),
)])
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_auth_header",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_connector-integration_4876611073761413646 | clm | function_body | // connector-service/backend/connector-integration/src/connectors/braintree.rs
// Function: build_error_response
{
let response: Result<braintree::ErrorResponses, Report<ParsingError>> =
res.response.parse_struct("Braintree Error Response");
match response {
Ok(braintree::ErrorResponses::BraintreeApiErrorResponse(response)) => {
with_error_response_body!(event_builder, response);
let error_object = response.api_error_response.errors;
let error = error_object.errors.first().or(error_object
.transaction
.as_ref()
.and_then(|transaction_error| {
transaction_error.errors.first().or(transaction_error
.credit_card
.as_ref()
.and_then(|credit_card_error| credit_card_error.errors.first()))
}));
let (code, message) = error.map_or(
(NO_ERROR_CODE.to_string(), NO_ERROR_MESSAGE.to_string()),
|error| (error.code.clone(), error.message.clone()),
);
Ok(ErrorResponse {
status_code: res.status_code,
code,
message,
reason: Some(response.api_error_response.message),
attempt_status: None,
connector_transaction_id: None,
network_advice_code: None,
network_decline_code: None,
network_error_message: None,
})
}
Ok(braintree::ErrorResponses::BraintreeErrorResponse(response)) => {
with_error_response_body!(event_builder, response);
Ok(ErrorResponse {
status_code: res.status_code,
code: NO_ERROR_CODE.to_string(),
message: NO_ERROR_MESSAGE.to_string(),
reason: Some(response.errors),
attempt_status: None,
connector_transaction_id: None,
network_advice_code: None,
network_decline_code: None,
network_error_message: None,
})
}
Err(_) => {
if let Some(event) = event_builder {
event.set_connector_response(&serde_json::json!({"error": "Error response parsing failed", "status_code": res.status_code}));
}
domain_types::utils::handle_json_response_deserialization_failure(res, "braintree")
}
}
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "build_error_response",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_connector-integration_5311678581769713501 | clm | function_body | // connector-service/backend/connector-integration/src/connectors/noon.rs
// Function: get_webhook_source_verification_signature
{
let webhook_body: noon::NoonWebhookSignature = request
.body
.parse_struct("NoonWebhookSignature")
.change_context(errors::ConnectorError::WebhookSignatureNotFound)
.attach_printable("Missing incoming webhook signature for noon")?;
let signature = webhook_body.signature;
BASE64_ENGINE
.decode(signature)
.change_context(errors::ConnectorError::WebhookSignatureNotFound)
.attach_printable("Missing incoming webhook signature for noon")
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_webhook_source_verification_signature",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_connector-integration_-8773605878443720959 | clm | function_body | // connector-service/backend/connector-integration/src/connectors/noon.rs
// Function: get_webhook_source_verification_message
{
let webhook_body: noon::NoonWebhookBody = request
.body
.parse_struct("NoonWebhookBody")
.change_context(errors::ConnectorError::WebhookSignatureNotFound)
.attach_printable("Missing incoming webhook signature for noon")?;
let message = format!(
"{},{},{},{},{}",
webhook_body.order_id,
webhook_body.order_status,
webhook_body.event_id,
webhook_body.event_type,
webhook_body.time_stamp,
);
Ok(message.into_bytes())
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_webhook_source_verification_message",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_connector-integration_-4080692132823228647 | clm | function_body | // connector-service/backend/connector-integration/src/connectors/noon.rs
// Function: get_event_type
{
let details: noon::NoonWebhookEvent = request
.body
.parse_struct("NoonWebhookEvent")
.change_context(errors::ConnectorError::WebhookEventTypeNotFound)
.attach_printable("Failed to parse webhook event type from Noon webhook body")?;
Ok(match &details.event_type {
noon::NoonWebhookEventTypes::Sale | noon::NoonWebhookEventTypes::Capture => {
match &details.order_status {
noon::NoonPaymentStatus::Captured => EventType::PaymentIntentSuccess,
_ => Err(errors::ConnectorError::WebhookEventTypeNotFound)?,
}
}
noon::NoonWebhookEventTypes::Fail => EventType::PaymentIntentFailure,
noon::NoonWebhookEventTypes::Authorize
| noon::NoonWebhookEventTypes::Authenticate
| noon::NoonWebhookEventTypes::Refund
| noon::NoonWebhookEventTypes::Unknown => EventType::IncomingWebhookEventUnspecified,
})
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_event_type",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_connector-integration_-4433385732719072211 | clm | function_body | // connector-service/backend/connector-integration/src/connectors/noon.rs
// Function: verify_webhook_source
{
let algorithm = crypto::HmacSha512;
let connector_webhook_secrets = match connector_webhook_secret {
Some(secrets) => secrets,
None => Err(domain_types::errors::ConnectorError::WebhookSourceVerificationFailed)?,
};
let signature =
self.get_webhook_source_verification_signature(&request, &connector_webhook_secrets)?;
let message =
self.get_webhook_source_verification_message(&request, &connector_webhook_secrets)?;
algorithm
.verify_signature(&connector_webhook_secrets.secret, &signature, &message)
.change_context(errors::ConnectorError::WebhookSourceVerificationFailed)
.attach_printable("Noon webhook signature verification failed")
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "verify_webhook_source",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_connector-integration_5170877420409555955 | clm | function_body | // connector-service/backend/connector-integration/src/connectors/noon.rs
// Function: process_payment_webhook
{
Ok(domain_types::connector_types::WebhookDetailsResponse {
resource_id: None,
status: common_enums::AttemptStatus::Unknown,
connector_response_reference_id: None,
error_code: None,
error_message: None,
raw_connector_response: None,
status_code: 200,
response_headers: None,
mandate_reference: None,
amount_captured: None,
minor_amount_captured: None,
error_reason: None,
network_txn_id: None,
transformation_status: common_enums::WebhookTransformationStatus::Incomplete,
})
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "process_payment_webhook",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_connector-integration_-5196709009876329560 | clm | function_body | // connector-service/backend/connector-integration/src/connectors/noon.rs
// Function: get_webhook_resource_object
{
let resource: noon::NoonWebhookObject = request
.body
.parse_struct("NoonWebhookObject")
.change_context(errors::ConnectorError::WebhookResourceObjectNotFound)
.attach_printable("Failed to parse webhook resource object from Noon webhook body")?;
Ok(Box::new(noon::NoonPaymentsResponse::from(resource)))
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_webhook_resource_object",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_connector-integration_-5802074331334774013 | clm | function_body | // connector-service/backend/connector-integration/src/connectors/noon.rs
// Function: build_error_response
{
let response: NoonErrorResponse = res
.response
.parse_struct("NoonErrorResponse")
.map_err(|_| errors::ConnectorError::ResponseDeserializationFailed)?;
with_error_response_body!(event_builder, response);
// Adding in case of timeouts, if psync gives 4xx with this code, fail the payment
let attempt_status = if response.result_code == 19001 {
Some(AttemptStatus::Failure)
} else {
None
};
Ok(ErrorResponse {
status_code: res.status_code,
code: response.result_code.to_string(),
message: response.class_description.clone(),
reason: Some(response.message.clone()),
attempt_status,
connector_transaction_id: None,
network_advice_code: None,
network_decline_code: None,
network_error_message: None,
})
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "build_error_response",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_connector-integration_-974138978700468121 | clm | function_body | // connector-service/backend/connector-integration/src/connectors/worldpayvantiv.rs
// Function: build_error_response
{
let response_str = std::str::from_utf8(&res.response)
.map_err(|_| ConnectorError::ResponseDeserializationFailed)?;
let response: transformers::CnpOnlineResponse = deserialize_xml_to_struct(response_str)
.map_err(|_parse_error| ConnectorError::ResponseDeserializationFailed)?;
with_response_body!(event_builder, response);
Ok(ErrorResponse {
status_code: res.status_code,
code: response.response_code,
message: response.message.clone(),
reason: Some(response.message),
attempt_status: None,
connector_transaction_id: None,
network_decline_code: None,
network_advice_code: None,
network_error_message: None,
})
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "build_error_response",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_connector-integration_-1124267742953916698 | clm | function_body | // connector-service/backend/connector-integration/src/connectors/worldpayvantiv.rs
// Function: get_url
{
let refund_id = req.request.connector_refund_id.clone();
let secondary_base_url = req
.resource_common_data
.connectors
.worldpayvantiv
.secondary_base_url
.as_ref()
.unwrap_or(&req.resource_common_data.connectors.worldpayvantiv.base_url);
Ok(format!(
"{}/reports/dtrPaymentStatus/{}",
secondary_base_url, refund_id
))
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_url",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_connector-integration_4669416719405753293 | clm | function_body | // connector-service/backend/connector-integration/src/connectors/worldpayvantiv.rs
// Function: handle_response_v2
{
let response: VantivSyncResponse = res
.response
.parse_struct("VantivSyncResponse")
.change_context(ConnectorError::ResponseDeserializationFailed)?;
if let Some(i) = event_builder {
i.set_connector_response(&response)
}
RouterDataV2::try_from(ResponseRouterData {
response,
router_data: data.clone(),
http_code: res.status_code,
})
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "handle_response_v2",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_connector-integration_-1226765768116923587 | clm | function_body | // connector-service/backend/connector-integration/src/connectors/xendit.rs
// Function: get_auth_header
{
let auth = xendit::XenditAuthType::try_from(auth_type)
.change_context(errors::ConnectorError::FailedToObtainAuthType)?;
let encoded_api_key = BASE64_ENGINE.encode(format!("{}:", auth.api_key.peek()));
Ok(vec![(
headers::AUTHORIZATION.to_string(),
format!("Basic {encoded_api_key}").into_masked(),
)])
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_auth_header",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_connector-integration_8823207903440648571 | clm | function_body | // connector-service/backend/connector-integration/src/connectors/xendit.rs
// Function: build_error_response
{
let response: XenditErrorResponse = res
.response
.parse_struct("XenditErrorResponse")
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
with_error_response_body!(event_builder, response);
Ok(ErrorResponse {
status_code: res.status_code,
code: response
.error_code
.unwrap_or_else(|| NO_ERROR_CODE.to_string()),
message: response
.message
.unwrap_or_else(|| NO_ERROR_MESSAGE.to_string()),
reason: response.reason,
attempt_status: None,
connector_transaction_id: None,
network_advice_code: None,
network_decline_code: None,
network_error_message: None,
})
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "build_error_response",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_connector-integration_4883855435181155118 | clm | function_body | // connector-service/backend/connector-integration/src/connectors/adyen.rs
// Function: get_auth_header
{
let auth = adyen::AdyenAuthType::try_from(auth_type)
.map_err(|_| errors::ConnectorError::FailedToObtainAuthType)?;
Ok(vec![(
headers::X_API_KEY.to_string(),
auth.api_key.into_masked(),
)])
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_auth_header",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_connector-integration_2330983820339227565 | clm | function_body | // connector-service/backend/connector-integration/src/connectors/adyen.rs
// Function: build_error_response
{
let response: adyen::AdyenErrorResponse = res
.response
.parse_struct("ErrorResponse")
.map_err(|_| errors::ConnectorError::ResponseDeserializationFailed)?;
with_error_response_body!(event_builder, response);
Ok(ErrorResponse {
status_code: res.status_code,
code: response.error_code,
message: response.message.to_owned(),
reason: Some(response.message),
attempt_status: None,
connector_transaction_id: response.psp_reference,
network_decline_code: None,
network_advice_code: None,
network_error_message: None,
})
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "build_error_response",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_connector-integration_-4622464088701001147 | clm | function_body | // connector-service/backend/connector-integration/src/connectors/adyen.rs
// Function: get_event_type
{
let notif: AdyenNotificationRequestItemWH =
transformers::get_webhook_object_from_body(request.body).map_err(|err| {
report!(errors::ConnectorError::WebhookBodyDecodingFailed)
.attach_printable(format!("error while decoding webhook body {err}"))
})?;
Ok(transformers::get_adyen_webhook_event_type(notif.event_code))
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_event_type",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_connector-integration_-8842442788950255542 | clm | function_body | // connector-service/backend/connector-integration/src/connectors/adyen.rs
// Function: process_payment_webhook
{
let request_body_copy = request.body.clone();
let notif: AdyenNotificationRequestItemWH =
transformers::get_webhook_object_from_body(request.body).map_err(|err| {
report!(errors::ConnectorError::WebhookBodyDecodingFailed)
.attach_printable(format!("error while decoding webhook body {err}"))
})?;
Ok(WebhookDetailsResponse {
resource_id: Some(ResponseId::ConnectorTransactionId(
notif.psp_reference.clone(),
)),
status: transformers::get_adyen_payment_webhook_event(notif.event_code, notif.success)?,
connector_response_reference_id: Some(notif.psp_reference),
error_code: notif.reason.clone(),
mandate_reference: None,
error_message: notif.reason,
raw_connector_response: Some(String::from_utf8_lossy(&request_body_copy).to_string()),
status_code: 200,
response_headers: None,
transformation_status: common_enums::WebhookTransformationStatus::Complete,
minor_amount_captured: None,
amount_captured: None,
error_reason: None,
network_txn_id: None,
})
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "process_payment_webhook",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_connector-integration_-794727520549150336 | clm | function_body | // connector-service/backend/connector-integration/src/connectors/adyen.rs
// Function: process_refund_webhook
{
let request_body_copy = request.body.clone();
let notif: AdyenNotificationRequestItemWH =
transformers::get_webhook_object_from_body(request.body).map_err(|err| {
report!(errors::ConnectorError::WebhookBodyDecodingFailed)
.attach_printable(format!("error while decoding webhook body {err}"))
})?;
Ok(RefundWebhookDetailsResponse {
connector_refund_id: Some(notif.psp_reference.clone()),
status: transformers::get_adyen_refund_webhook_event(notif.event_code, notif.success)?,
connector_response_reference_id: Some(notif.psp_reference.clone()),
error_code: notif.reason.clone(),
error_message: notif.reason,
raw_connector_response: Some(String::from_utf8_lossy(&request_body_copy).to_string()),
status_code: 200,
response_headers: None,
})
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "process_refund_webhook",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_connector-integration_-9179422800267180449 | clm | function_body | // connector-service/backend/connector-integration/src/connectors/adyen.rs
// Function: process_dispute_webhook
{
let request_body_copy = request.body.clone();
let notif: AdyenNotificationRequestItemWH =
transformers::get_webhook_object_from_body(request.body).map_err(|err| {
report!(errors::ConnectorError::WebhookBodyDecodingFailed)
.attach_printable(format!("error while decoding webhook body {err}"))
})?;
let (stage, status) = transformers::get_dispute_stage_and_status(
notif.event_code,
notif.additional_data.dispute_status,
);
let amount = utils::convert_amount(
self.amount_converter_webhooks,
notif.amount.value,
notif.amount.currency,
)?;
Ok(
domain_types::connector_types::DisputeWebhookDetailsResponse {
amount,
currency: notif.amount.currency,
dispute_id: notif.psp_reference.clone(),
stage,
status,
connector_response_reference_id: Some(notif.psp_reference.clone()),
dispute_message: notif.reason,
connector_reason_code: notif.additional_data.chargeback_reason_code,
raw_connector_response: Some(
String::from_utf8_lossy(&request_body_copy).to_string(),
),
status_code: 200,
response_headers: None,
},
)
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "process_dispute_webhook",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_connector-integration_2041210500582876320 | clm | function_body | // connector-service/backend/connector-integration/src/connectors/adyen.rs
// Function: validate_mandate_payment
{
let mandate_supported_pmd = std::collections::HashSet::from([PaymentMethodDataType::Card]);
is_mandate_supported(pm_data, pm_type, mandate_supported_pmd, self.id())
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "validate_mandate_payment",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_connector-integration_-8135647123821425564 | clm | function_body | // connector-service/backend/connector-integration/src/connectors/adyen.rs
// Function: validate_psync_reference_id
{
if data.encoded_data.is_some() {
return Ok(());
}
Err(errors::ConnectorError::MissingRequiredField {
field_name: "encoded_data",
}
.into())
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "validate_psync_reference_id",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_connector-integration_-4375660230284631030 | clm | function_body | // connector-service/backend/connector-integration/src/connectors/cybersource.rs
// Function: build_error_response
{
let response: Result<
cybersource::CybersourceErrorResponse,
Report<common_utils::errors::ParsingError>,
> = res.response.parse_struct("Cybersource ErrorResponse");
let error_message = if res.status_code == 401 {
headers::CONNECTOR_UNAUTHORIZED_ERROR.to_string()
} else {
NO_ERROR_MESSAGE.to_string()
};
match response {
Ok(transformers::CybersourceErrorResponse::StandardError(response)) => {
with_error_response_body!(event_builder, response);
let (code, message, reason) = match response.error_information {
Some(ref error_info) => {
let detailed_error_info = error_info.details.as_ref().map(|details| {
details
.iter()
.map(|det| format!("{} : {}", det.field, det.reason))
.collect::<Vec<_>>()
.join(", ")
});
(
error_info.reason.clone(),
error_info.reason.clone(),
transformers::get_error_reason(
Some(error_info.message.clone()),
detailed_error_info,
None,
),
)
}
None => {
let detailed_error_info = response.details.map(|details| {
details
.iter()
.map(|det| format!("{} : {}", det.field, det.reason))
.collect::<Vec<_>>()
.join(", ")
});
(
response
.reason
.clone()
.map_or(NO_ERROR_CODE.to_string(), |reason| reason.to_string()),
response
.reason
.map_or(error_message.to_string(), |reason| reason.to_string()),
transformers::get_error_reason(
response.message,
detailed_error_info,
None,
),
)
}
};
Ok(ErrorResponse {
status_code: res.status_code,
code,
message,
reason,
attempt_status: None,
connector_transaction_id: None,
network_advice_code: None,
network_decline_code: None,
network_error_message: None,
})
}
Ok(transformers::CybersourceErrorResponse::AuthenticationError(response)) => {
with_error_response_body!(event_builder, response);
Ok(ErrorResponse {
status_code: res.status_code,
code: NO_ERROR_CODE.to_string(),
message: response.response.rmsg.clone(),
reason: Some(response.response.rmsg),
attempt_status: None,
connector_transaction_id: None,
network_advice_code: None,
network_decline_code: None,
network_error_message: None,
})
}
Ok(transformers::CybersourceErrorResponse::NotAvailableError(response)) => {
with_error_response_body!(event_builder, response);
let error_response = response
.errors
.iter()
.map(|error_info| {
format!(
"{}: {}",
error_info.error_type.clone().unwrap_or("".to_string()),
error_info.message.clone().unwrap_or("".to_string())
)
})
.collect::<Vec<String>>()
.join(" & ");
Ok(ErrorResponse {
status_code: res.status_code,
code: NO_ERROR_CODE.to_string(),
message: error_response.clone(),
reason: Some(error_response),
attempt_status: None,
connector_transaction_id: None,
network_advice_code: None,
network_decline_code: None,
network_error_message: None,
})
}
Err(error_msg) => {
if let Some(event) = event_builder {
event.set_connector_response(&serde_json::json!({"error": "Error response parsing failed", "status_code": res.status_code}))
};
tracing::error!(deserialization_error =? error_msg);
domain_types::utils::handle_json_response_deserialization_failure(
res,
"cybersource",
)
}
}
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "build_error_response",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_connector-integration_-5771820151120783810 | clm | function_body | // connector-service/backend/connector-integration/src/connectors/dlocal.rs
// Function: build_error_response
{
let response: dlocal::DlocalErrorResponse = res
.response
.parse_struct("Dlocal ErrorResponse")
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
with_error_response_body!(event_builder, response);
Ok(ErrorResponse {
status_code: res.status_code,
code: response.code.to_string(),
message: response.message,
reason: response.param,
attempt_status: None,
connector_transaction_id: None,
network_advice_code: None,
network_decline_code: None,
network_error_message: None,
})
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "build_error_response",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_connector-integration_-1387528626997304021 | clm | function_body | // connector-service/backend/connector-integration/src/connectors/novalnet.rs
// Function: get_auth_header
{
let auth = novalnet::NovalnetAuthType::try_from(auth_type)
.change_context(errors::ConnectorError::FailedToObtainAuthType)?;
let api_key: String = auth.payment_access_key.expose();
let encoded_api_key = BASE64_ENGINE.encode(api_key);
Ok(vec![(
headers::X_NN_ACCESS_KEY.to_string(),
encoded_api_key.into_masked(),
)])
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_auth_header",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_connector-integration_-880653618020223408 | clm | function_body | // connector-service/backend/connector-integration/src/connectors/novalnet.rs
// Function: build_error_response
{
let response: novalnet::NovalnetErrorResponse = res
.response
.parse_struct("NovalnetErrorResponse")
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
with_error_response_body!(event_builder, response);
Ok(ErrorResponse {
status_code: res.status_code,
code: response.code,
message: response.message,
reason: response.reason,
attempt_status: None,
connector_transaction_id: None,
network_advice_code: None,
network_decline_code: None,
network_error_message: None,
})
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "build_error_response",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_connector-integration_-7637495665408726987 | clm | function_body | // connector-service/backend/connector-integration/src/connectors/novalnet.rs
// Function: get_webhook_source_verification_signature
{
let notif_item = get_webhook_object_from_body(&request.body)
.change_context(errors::ConnectorError::WebhookSourceVerificationFailed)?;
hex::decode(notif_item.event.checksum)
.change_context(errors::ConnectorError::WebhookVerificationSecretInvalid)
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_webhook_source_verification_signature",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_connector-integration_8665213253403137272 | clm | function_body | // connector-service/backend/connector-integration/src/connectors/novalnet.rs
// Function: get_webhook_source_verification_message
{
let notif = get_webhook_object_from_body(&request.body)
.change_context(errors::ConnectorError::WebhookSourceVerificationFailed)?;
let (amount, currency) = match notif.transaction {
novalnet::NovalnetWebhookTransactionData::CaptureTransactionData(data) => {
(data.amount, data.currency)
}
novalnet::NovalnetWebhookTransactionData::CancelTransactionData(data) => {
(data.amount, data.currency)
}
novalnet::NovalnetWebhookTransactionData::RefundsTransactionData(data) => {
(data.amount, data.currency)
}
novalnet::NovalnetWebhookTransactionData::SyncTransactionData(data) => {
(data.amount, data.currency)
}
};
let amount = amount
.map(|amount| amount.to_string())
.unwrap_or("".to_string());
let currency = currency
.map(|amount| amount.to_string())
.unwrap_or("".to_string());
let secret_auth = String::from_utf8(connector_webhook_secrets.secret.to_vec())
.change_context(errors::ConnectorError::WebhookVerificationSecretInvalid)
.attach_printable("Could not convert webhook secret auth to UTF-8")?;
let reversed_secret_auth = novalnet::reverse_string(&secret_auth);
let message = format!(
"{}{}{}{}{}{}",
notif.event.tid,
notif.event.event_type,
notif.result.status,
amount,
currency,
reversed_secret_auth
);
Ok(message.into_bytes())
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_webhook_source_verification_message",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_connector-integration_-1238370011948383919 | clm | function_body | // connector-service/backend/connector-integration/src/connectors/novalnet.rs
// Function: verify_webhook_source
{
let algorithm = crypto::Sha256;
let connector_webhook_secrets = match connector_webhook_secret {
Some(secrets) => secrets,
None => {
tracing::warn!(
target: "novalnet_webhook",
"Missing webhook secret for Novalnet webhook verification - verification failed but continuing processing"
);
return Ok(false);
}
};
let signature = match self
.get_webhook_source_verification_signature(&request, &connector_webhook_secrets)
{
Ok(sig) => sig,
Err(error) => {
tracing::warn!(
target: "novalnet_webhook",
"Failed to get webhook source verification signature for Novalnet: {} - verification failed but continuing processing",
error
);
return Ok(false);
}
};
let message = match self
.get_webhook_source_verification_message(&request, &connector_webhook_secrets)
{
Ok(msg) => msg,
Err(error) => {
tracing::warn!(
target: "novalnet_webhook",
"Failed to get webhook source verification message for Novalnet: {} - verification failed but continuing processing",
error
);
return Ok(false);
}
};
match algorithm.verify_signature(&connector_webhook_secrets.secret, &signature, &message) {
Ok(is_verified) => Ok(is_verified),
Err(error) => {
tracing::warn!(
target: "novalnet_webhook",
"Failed to verify webhook signature for Novalnet: {} - verification failed but continuing processing",
error
);
Ok(false)
}
}
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "verify_webhook_source",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_connector-integration_3979534059268530545 | clm | function_body | // connector-service/backend/connector-integration/src/connectors/novalnet.rs
// Function: get_event_type
{
let notif = get_webhook_object_from_body(&request.body)
.change_context(errors::ConnectorError::WebhookEventTypeNotFound)?;
let optional_transaction_status = match notif.transaction {
novalnet::NovalnetWebhookTransactionData::CaptureTransactionData(data) => {
Some(data.status)
}
novalnet::NovalnetWebhookTransactionData::CancelTransactionData(data) => data.status,
novalnet::NovalnetWebhookTransactionData::RefundsTransactionData(data) => {
Some(data.status)
}
novalnet::NovalnetWebhookTransactionData::SyncTransactionData(data) => {
Some(data.status)
}
};
let transaction_status =
optional_transaction_status.ok_or(errors::ConnectorError::MissingRequiredField {
field_name: "transaction_status",
})?;
// NOTE: transaction_status will always be present for Webhooks
// But we are handling optional type here, since we are reusing TransactionData Struct from NovalnetPaymentsResponseTransactionData for Webhooks response too
// In NovalnetPaymentsResponseTransactionData, transaction_status is optional
let incoming_webhook_event =
novalnet::get_incoming_webhook_event(notif.event.event_type, transaction_status);
Ok(incoming_webhook_event)
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_event_type",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_connector-integration_5546290293285480254 | clm | function_body | // connector-service/backend/connector-integration/src/connectors/novalnet.rs
// Function: process_payment_webhook
{
let notif = get_webhook_object_from_body(&request.body)
.change_context(errors::ConnectorError::WebhookReferenceIdNotFound)?;
let response = WebhookDetailsResponse::try_from(notif)
.change_context(errors::ConnectorError::WebhookBodyDecodingFailed);
response.map(|mut response| {
response.raw_connector_response =
Some(String::from_utf8_lossy(&request.body).to_string());
response
})
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "process_payment_webhook",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_connector-integration_-291295604774287227 | clm | function_body | // connector-service/backend/connector-integration/src/connectors/novalnet.rs
// Function: process_refund_webhook
{
let notif: novalnet::NovalnetWebhookNotificationResponseRefunds = request
.body
.parse_struct("NovalnetWebhookNotificationResponse")
.change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?;
let response = RefundWebhookDetailsResponse::try_from(notif)
.change_context(errors::ConnectorError::WebhookBodyDecodingFailed);
response.map(|mut response| {
response.raw_connector_response =
Some(String::from_utf8_lossy(&request.body).to_string());
response
})
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "process_refund_webhook",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_connector-integration_3171191250136151920 | clm | function_body | // connector-service/backend/connector-integration/src/connectors/novalnet.rs
// Function: process_dispute_webhook
{
let notif: transformers::NovalnetWebhookNotificationResponse =
get_webhook_object_from_body(&request.body)
.change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?;
let (amount, currency, reason, reason_code) = match notif.transaction {
novalnet::NovalnetWebhookTransactionData::CaptureTransactionData(data) => {
(data.amount, data.currency, None, None)
}
novalnet::NovalnetWebhookTransactionData::CancelTransactionData(data) => {
(data.amount, data.currency, None, None)
}
novalnet::NovalnetWebhookTransactionData::RefundsTransactionData(data) => {
(data.amount, data.currency, None, None)
}
novalnet::NovalnetWebhookTransactionData::SyncTransactionData(data) => {
(data.amount, data.currency, data.reason, data.reason_code)
}
};
let dispute_status = novalnet::get_novalnet_dispute_status(notif.event.event_type);
Ok(DisputeWebhookDetailsResponse {
amount: utils::convert_amount(
self.amount_converter,
amount.ok_or(errors::ConnectorError::AmountConversionFailed)?,
novalnet::option_to_result(currency)?,
)?,
currency: novalnet::option_to_result(currency)?,
stage: common_enums::DisputeStage::Dispute,
dispute_id: notif.event.tid.to_string(),
connector_reason_code: reason_code,
status: common_enums::DisputeStatus::foreign_try_from(dispute_status)?,
connector_response_reference_id: None,
dispute_message: reason,
raw_connector_response: Some(String::from_utf8_lossy(&request.body).to_string()),
status_code: 200,
response_headers: None,
})
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "process_dispute_webhook",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_connector-integration_507789816101636557 | clm | function_body | // connector-service/backend/connector-integration/src/connectors/novalnet.rs
// Function: get_webhook_object_from_body
{
let novalnet_webhook_notification_response = body
.parse_struct("NovalnetWebhookNotificationResponse")
.change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?;
Ok(novalnet_webhook_notification_response)
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_webhook_object_from_body",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_connector-integration_-6095257603708414705 | clm | function_body | // connector-service/backend/connector-integration/src/connectors/cashtocode.rs
// Function: verify_webhook_source
{
let webhook_secret = match connector_webhook_secrets.clone() {
Some(secrets) => secrets,
None => return Ok(false),
};
let base64_signature = request
.headers
.get("authorization")
.ok_or(errors::ConnectorError::WebhookSignatureNotFound)?;
let signature = base64_signature.as_bytes();
let secret_auth = String::from_utf8(webhook_secret.secret.to_vec())
.change_context(errors::ConnectorError::WebhookSourceVerificationFailed)
.attach_printable("Could not convert secret to UTF-8")?;
let signature_auth = String::from_utf8(signature.to_vec())
.change_context(errors::ConnectorError::WebhookSourceVerificationFailed)
.attach_printable("Could not convert secret to UTF-8")?;
Ok(signature_auth == secret_auth)
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "verify_webhook_source",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_connector-integration_6211293150269463608 | clm | function_body | // connector-service/backend/connector-integration/src/connectors/cashtocode.rs
// Function: process_payment_webhook
{
let webhook: transformers::CashtocodePaymentsSyncResponse = request
.body
.parse_struct("CashtocodePaymentsSyncResponse")
.change_context(errors::ConnectorError::WebhookResourceObjectNotFound)?;
Ok(domain_types::connector_types::WebhookDetailsResponse {
resource_id: Some(
domain_types::connector_types::ResponseId::ConnectorTransactionId(
webhook.transaction_id.clone(),
),
),
status: common_enums::AttemptStatus::Charged,
status_code: 200,
mandate_reference: None,
connector_response_reference_id: None,
error_code: None,
error_message: None,
raw_connector_response: Some(String::from_utf8_lossy(&request.body).to_string()),
response_headers: None,
minor_amount_captured: None,
amount_captured: None,
error_reason: None,
network_txn_id: None,
transformation_status: common_enums::WebhookTransformationStatus::Complete,
})
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "process_payment_webhook",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_connector-integration_1786011987835833901 | clm | function_body | // connector-service/backend/connector-integration/src/connectors/cashtocode.rs
// Function: build_error_response
{
let response: cashtocode::CashtocodeErrorResponse = res
.response
.parse_struct("CashtocodeErrorResponse")
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
with_error_response_body!(event_builder, response);
Ok(ErrorResponse {
status_code: res.status_code,
code: response.error.to_string(),
message: response.error_description.clone(),
reason: Some(response.error_description),
attempt_status: None,
connector_transaction_id: None,
network_advice_code: None,
network_decline_code: None,
network_error_message: None,
})
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "build_error_response",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_connector-integration_-4845444871733179140 | clm | function_body | // connector-service/backend/connector-integration/src/connectors/cashtocode.rs
// Function: get_b64_auth_cashtocode
{
fn construct_basic_auth(
username: Option<Secret<String>>,
password: Option<Secret<String>>,
) -> Result<Maskable<String>, errors::ConnectorError> {
let username = username.ok_or(errors::ConnectorError::FailedToObtainAuthType)?;
let password = password.ok_or(errors::ConnectorError::FailedToObtainAuthType)?;
Ok(format!(
"Basic {}",
base64::engine::general_purpose::STANDARD.encode(format!(
"{}:{}",
username.peek(),
password.peek()
))
)
.into_masked())
}
let auth_header = match payment_method_type {
Some(common_enums::PaymentMethodType::ClassicReward) => construct_basic_auth(
auth_type.username_classic.to_owned(),
auth_type.password_classic.to_owned(),
),
Some(common_enums::PaymentMethodType::Evoucher) => construct_basic_auth(
auth_type.username_evoucher.to_owned(),
auth_type.password_evoucher.to_owned(),
),
_ => return Err(errors::ConnectorError::MissingPaymentMethodType)?,
}?;
Ok(vec![(headers::AUTHORIZATION.to_string(), auth_header)])
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_b64_auth_cashtocode",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_connector-integration_1459366519062108457 | clm | function_body | // connector-service/backend/connector-integration/src/connectors/cashtocode.rs
// Function: construct_basic_auth
{
let username = username.ok_or(errors::ConnectorError::FailedToObtainAuthType)?;
let password = password.ok_or(errors::ConnectorError::FailedToObtainAuthType)?;
Ok(format!(
"Basic {}",
base64::engine::general_purpose::STANDARD.encode(format!(
"{}:{}",
username.peek(),
password.peek()
))
)
.into_masked())
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "construct_basic_auth",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_connector-integration_7654781979638642124 | clm | function_body | // connector-service/backend/connector-integration/src/connectors/cashfree.rs
// Function: get_auth_header
{
let auth = cashfree::CashfreeAuthType::try_from(auth_type)?;
Ok(vec![
(headers::X_CLIENT_ID.to_string(), auth.app_id.into_masked()),
(
headers::X_CLIENT_SECRET.to_string(),
auth.secret_key.into_masked(),
),
(
headers::X_API_VERSION.to_string(),
"2022-09-01".to_string().into(),
),
(
headers::CONTENT_TYPE.to_string(),
"application/json".to_string().into(),
),
])
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_auth_header",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_connector-integration_8586393468395642134 | clm | function_body | // connector-service/backend/connector-integration/src/connectors/cashfree.rs
// Function: build_error_response
{
let response: cashfree::CashfreeErrorResponse = res
.response
.parse_struct("CashfreeErrorResponse")
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
with_response_body!(event_builder, response);
let attempt_status = match response.code.as_str() {
"AUTHENTICATION_ERROR" => AttemptStatus::AuthenticationFailed,
"AUTHORIZATION_ERROR" => AttemptStatus::AuthorizationFailed,
"INVALID_REQUEST_ERROR" => AttemptStatus::Failure,
"GATEWAY_ERROR" => AttemptStatus::Failure,
"SERVER_ERROR" => AttemptStatus::Pending,
_ => AttemptStatus::Failure,
};
Ok(ErrorResponse {
status_code: res.status_code,
code: response.code.clone(),
message: response.message.clone(),
reason: Some(response.message),
attempt_status: Some(attempt_status),
connector_transaction_id: None,
network_decline_code: None,
network_advice_code: None,
network_error_message: None,
})
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "build_error_response",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_connector-integration_-2544871358526764091 | clm | function_body | // connector-service/backend/connector-integration/src/connectors/payu.rs
// Function: get_auth_header
{
let _auth = PayuAuthType::try_from(auth_type)?;
// Payu uses form-based authentication, not headers
Ok(vec![])
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_auth_header",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_connector-integration_3457153233891251015 | clm | function_body | // connector-service/backend/connector-integration/src/connectors/payu.rs
// Function: get_secrets
{
// STUB: Return empty secrets - will be implemented in Phase 10
Ok(Vec::new())
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_secrets",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_connector-integration_-1789153327933568838 | clm | function_body | // connector-service/backend/connector-integration/src/connectors/payu.rs
// Function: get_algorithm
{
// STUB: Use NoAlgorithm - will be replaced with actual algorithm in Phase 10
Ok(Box::new(crypto::NoAlgorithm))
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_algorithm",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_connector-integration_-2276389806856865094 | clm | function_body | // connector-service/backend/connector-integration/src/connectors/payu.rs
// Function: get_signature
{
// STUB: Return empty signature - will extract actual signature in Phase 10
Ok(Vec::new())
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_signature",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_connector-integration_3807066981639053750 | clm | function_body | // connector-service/backend/connector-integration/src/connectors/payu.rs
// Function: get_message
{
// STUB: Return payload as-is - will implement gateway-specific message format in Phase 10
Ok(payload.to_owned())
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_message",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_connector-integration_2792967379784044779 | clm | function_body | // connector-service/backend/connector-integration/src/connectors/paytm.rs
// Function: get_auth_header
{
Ok(vec![(
constants::CONTENT_TYPE_HEADER.to_string(),
constants::CONTENT_TYPE_JSON.into(),
)])
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_auth_header",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_connector-integration_8318001565313828400 | clm | function_body | // connector-service/backend/connector-integration/src/connectors/fiserv.rs
// Function: get_auth_header
{
let auth: self::transformers::FiservAuthType =
self::transformers::FiservAuthType::try_from(auth_type)
.change_context(errors::ConnectorError::FailedToObtainAuthType)?;
Ok(vec![(
headers::API_KEY.to_string(),
auth.api_key.clone().into_masked(),
)])
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_auth_header",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_connector-integration_-7270457011149030212 | clm | function_body | // connector-service/backend/connector-integration/src/connectors/fiserv.rs
// Function: build_error_response
{
let response: self::transformers::FiservErrorResponse = res
.response
.parse_struct("FiservErrorResponse")
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
with_error_response_body!(event_builder, response);
let first_error_detail = response
.error
.as_ref()
.or(response.details.as_ref())
.and_then(|e| e.first());
Ok(ErrorResponse {
status_code: res.status_code,
code: first_error_detail
.and_then(|e| e.code.clone())
.unwrap_or_else(|| NO_ERROR_CODE.to_string()),
message: first_error_detail.map_or(NO_ERROR_MESSAGE.to_string(), |e| e.message.clone()),
reason: first_error_detail.and_then(|e| e.field.clone()),
attempt_status: None,
connector_transaction_id: None,
network_decline_code: None,
network_advice_code: None,
network_error_message: None,
})
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "build_error_response",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_connector-integration_-126662598465333842 | clm | function_body | // connector-service/backend/connector-integration/src/connectors/razorpay.rs
// Function: new
{
&Self {
amount_converter: &common_utils::types::MinorUnitForConnector,
_phantom: std::marker::PhantomData,
}
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "new",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_connector-integration_-3386464018855910875 | clm | function_body | // connector-service/backend/connector-integration/src/connectors/razorpay.rs
// Function: get_auth_header
{
let auth = razorpay::RazorpayAuthType::try_from(auth_type)
.change_context(errors::ConnectorError::FailedToObtainAuthType)?;
Ok(vec![(
headers::AUTHORIZATION.to_string(),
auth.generate_authorization_header().into_masked(),
)])
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_auth_header",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_connector-integration_7436883970611137841 | clm | function_body | // connector-service/backend/connector-integration/src/connectors/razorpay.rs
// Function: build_error_response
{
let response: razorpay::RazorpayErrorResponse = res
.response
.parse_struct("ErrorResponse")
.map_err(|_| errors::ConnectorError::ResponseDeserializationFailed)?;
with_error_response_body!(event_builder, response);
let (code, message, reason, attempt_status) = match response {
razorpay::RazorpayErrorResponse::StandardError { error } => {
let attempt_status = match error.code.as_str() {
"BAD_REQUEST_ERROR" => AttemptStatus::Failure,
"GATEWAY_ERROR" => AttemptStatus::Failure,
"AUTHENTICATION_ERROR" => AttemptStatus::AuthenticationFailed,
"AUTHORIZATION_ERROR" => AttemptStatus::AuthorizationFailed,
"SERVER_ERROR" => AttemptStatus::Pending,
_ => AttemptStatus::Pending,
};
(error.code, error.description, error.reason, attempt_status)
}
razorpay::RazorpayErrorResponse::SimpleError { message } => {
// For simple error messages like "no Route matched with those values"
// Default to a generic error code
(
"ROUTE_ERROR".to_string(),
message.clone(),
Some(message.clone()),
AttemptStatus::Failure,
)
}
};
Ok(ErrorResponse {
status_code: res.status_code,
code,
message: message.clone(),
reason,
attempt_status: Some(attempt_status),
connector_transaction_id: None,
network_decline_code: None,
network_advice_code: None,
network_error_message: None,
})
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "build_error_response",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_connector-integration_-70412278914474262 | clm | function_body | // connector-service/backend/connector-integration/src/connectors/razorpay.rs
// Function: get_headers
{
let mut header = vec![(
headers::CONTENT_TYPE.to_string(),
"application/json".to_string().into(),
)];
let mut api_key = self.get_auth_header(&req.connector_auth_type)?;
header.append(&mut api_key);
Ok(header)
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_headers",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_body_connector-integration_5194237044899276173 | clm | function_body | // connector-service/backend/connector-integration/src/connectors/razorpay.rs
// Function: get_url
{
let id = match &req.request.connector_transaction_id {
ResponseId::ConnectorTransactionId(id) => id,
_ => {
return Err(errors::ConnectorError::MissingConnectorTransactionID.into());
}
};
Ok(format!(
"{}v1/payments/{}/capture",
req.resource_common_data.connectors.razorpay.base_url, id
))
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_url",
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"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.