id
stringlengths
20
153
type
stringclasses
1 value
granularity
stringclasses
14 values
content
stringlengths
16
84.3k
metadata
dict
connector-service_fn_ucs_common_utils_6013931804491974890
clm
function
// connector-service/backend/common_utils/src/crypto.rs fn test_md5_verify_signature() { let right_signature = hex::decode("c3fcd3d76192e4007dfb496cca67e13b").expect("signature decoding"); let wrong_signature = hex::decode("d5550730377011948f12cc28889bee590d2a5434d6f54b87562f2dbc2657823f") .expect("Wrong signature decoding"); let secret = "".as_bytes(); let data = "abcdefghijklmnopqrstuvwxyz".as_bytes(); let right_verified = super::Md5 .verify_signature(secret, &right_signature, data) .expect("Right signature verification result"); assert!(right_verified); let wrong_verified = super::Md5 .verify_signature(secret, &wrong_signature, data) .expect("Wrong signature verification result"); assert!(!wrong_verified); }
{ "chunk": null, "crate": "ucs_common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "test_md5_verify_signature", "is_async": false, "is_pub": false, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_fn_ucs_common_utils_-4083661615617742322
clm
function
// connector-service/backend/common_utils/src/event_publisher.rs pub fn new(config: &EventConfig) -> CustomResult<Self, EventPublisherError> { // 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": false, "is_pub": true, "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_fn_ucs_common_utils_3435722944313440304
clm
function
// connector-service/backend/common_utils/src/event_publisher.rs pub fn publish_event( &self, event: serde_json::Value, topic: &str, partition_key_field: &str, ) -> CustomResult<(), EventPublisherError> { 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": false, "is_pub": true, "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_fn_ucs_common_utils_1132078949388734795
clm
function
// connector-service/backend/common_utils/src/event_publisher.rs pub fn publish_event_with_metadata( &self, event: serde_json::Value, topic: &str, partition_key_field: &str, metadata: OwnedHeaders, ) -> CustomResult<(), EventPublisherError> { 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": false, "is_pub": true, "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_fn_ucs_common_utils_-7541796757593474637
clm
function
// connector-service/backend/common_utils/src/event_publisher.rs pub fn emit_event_with_config(event: Event, config: &EventConfig) { 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": false, "is_pub": true, "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_fn_ucs_common_utils_-2795403797790120625
clm
function
// connector-service/backend/common_utils/src/event_publisher.rs fn build_kafka_metadata(&self, event: &Event) -> OwnedHeaders { 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": false, "is_pub": false, "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_fn_ucs_common_utils_-1747581733485610389
clm
function
// connector-service/backend/common_utils/src/event_publisher.rs fn process_event(&self, event: &Event) -> CustomResult<serde_json::Value, EventPublisherError> { 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": false, "is_pub": false, "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_fn_ucs_common_utils_8100928521203693048
clm
function
// connector-service/backend/common_utils/src/event_publisher.rs fn extract_from_request( &self, event_value: &serde_json::Value, extraction_path: &str, ) -> Option<serde_json::Value> { 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": false, "is_pub": false, "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_fn_ucs_common_utils_4906031500946221235
clm
function
// connector-service/backend/common_utils/src/event_publisher.rs fn set_nested_value( &self, target: &mut serde_json::Value, path: &str, value: serde_json::Value, ) -> CustomResult<(), EventPublisherError> { 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": false, "is_pub": false, "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_fn_ucs_common_utils_7861734111288528443
clm
function
// connector-service/backend/common_utils/src/event_publisher.rs pub fn init_event_publisher(config: &EventConfig) -> CustomResult<(), EventPublisherError> { 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": false, "is_pub": true, "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_fn_ucs_common_utils_584183334121170421
clm
function
// connector-service/backend/common_utils/src/event_publisher.rs fn get_event_publisher( config: &EventConfig, ) -> CustomResult<&'static EventPublisher, EventPublisherError> { EVENT_PUBLISHER.get_or_try_init(|| EventPublisher::new(config)) }
{ "chunk": null, "crate": "ucs_common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_event_publisher", "is_async": false, "is_pub": false, "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_fn_ucs_common_utils_-6632605894475009172
clm
function
// connector-service/backend/common_utils/src/custom_serde.rs pub fn serialize<S>( date_time: &Option<PrimitiveDateTime>, serializer: S, ) -> Result<S::Ok, S::Error> where S: Serializer, { 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": false, "is_pub": true, "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_fn_ucs_common_utils_-33963666864823970
clm
function
// connector-service/backend/common_utils/src/custom_serde.rs pub fn deserialize<'a, D>(deserializer: D) -> Result<Option<PrimitiveDateTime>, D::Error> where D: Deserializer<'a>, { 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": false, "is_pub": true, "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_fn_ucs_common_utils_-8123122103564071794
clm
function
// connector-service/backend/common_utils/src/global_id/payment_methods.rs pub fn generate(cell_id: &CellId) -> error_stack::Result<Self, GlobalPaymentMethodIdError> { 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": false, "is_pub": true, "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_fn_ucs_common_utils_-329674564897026216
clm
function
// connector-service/backend/common_utils/src/global_id/payment_methods.rs pub fn get_string_repr(&self) -> &str { self.0.get_string_repr() }
{ "chunk": null, "crate": "ucs_common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_string_repr", "is_async": false, "is_pub": true, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_fn_ucs_common_utils_1205245359861423661
clm
function
// connector-service/backend/common_utils/src/global_id/payment_methods.rs pub fn get_redis_key(&self) -> String { format!("payment_method_session:{}", self.get_string_repr()) }
{ "chunk": null, "crate": "ucs_common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_redis_key", "is_async": false, "is_pub": true, "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_fn_ucs_common_utils_341577664082095980
clm
function
// connector-service/backend/common_utils/src/global_id/payment_methods.rs fn get_api_event_type(&self) -> Option<crate::events::ApiEventsType> { 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": false, "is_pub": false, "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_fn_ucs_common_utils_7702380798656341830
clm
function
// connector-service/backend/common_utils/src/global_id/payment_methods.rs pub fn generate_from_string(value: String) -> CustomResult<Self, GlobalPaymentMethodIdError> { 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": false, "is_pub": true, "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_fn_ucs_common_utils_-200598699187489449
clm
function
// connector-service/backend/common_utils/src/global_id/refunds.rs pub fn get_string_repr(&self) -> &str { self.0.get_string_repr() }
{ "chunk": null, "crate": "ucs_common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_string_repr", "is_async": false, "is_pub": true, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_fn_ucs_common_utils_605693455615224175
clm
function
// connector-service/backend/common_utils/src/global_id/refunds.rs pub fn generate(cell_id: &CellId) -> Self { 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": false, "is_pub": true, "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_fn_ucs_common_utils_-4663655852224184920
clm
function
// connector-service/backend/common_utils/src/global_id/refunds.rs fn try_from(value: std::borrow::Cow<'static, str>) -> Result<Self, Self::Error> { 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": false, "is_pub": false, "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_fn_ucs_common_utils_-3825713077941306132
clm
function
// connector-service/backend/common_utils/src/global_id/token.rs pub fn get_string_repr(&self) -> &str { self.0.get_string_repr() }
{ "chunk": null, "crate": "ucs_common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_string_repr", "is_async": false, "is_pub": true, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_fn_ucs_common_utils_-6810754769394780743
clm
function
// connector-service/backend/common_utils/src/global_id/token.rs pub fn generate(cell_id: &CellId) -> Self { 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": false, "is_pub": true, "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_fn_ucs_common_utils_3812160403284082718
clm
function
// connector-service/backend/common_utils/src/global_id/token.rs fn get_api_event_type(&self) -> Option<crate::events::ApiEventsType> { 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": false, "is_pub": false, "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_fn_ucs_common_utils_-3502092611553707837
clm
function
// connector-service/backend/common_utils/src/global_id/payment.rs pub fn get_string_repr(&self) -> &str { self.0.get_string_repr() }
{ "chunk": null, "crate": "ucs_common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_string_repr", "is_async": false, "is_pub": true, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_fn_ucs_common_utils_-3260622327463639465
clm
function
// connector-service/backend/common_utils/src/global_id/payment.rs pub fn generate(cell_id: &CellId) -> Self { 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": false, "is_pub": true, "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_fn_ucs_common_utils_-3260392004691908853
clm
function
// connector-service/backend/common_utils/src/global_id/payment.rs pub fn get_execute_revenue_recovery_id( &self, task: &str, runner: enums::ProcessTrackerRunner, ) -> String { format!("{runner}_{task}_{}", self.get_string_repr()) }
{ "chunk": null, "crate": "ucs_common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_execute_revenue_recovery_id", "is_async": false, "is_pub": true, "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_fn_ucs_common_utils_-3301347038015199109
clm
function
// connector-service/backend/common_utils/src/global_id/payment.rs fn try_from(value: std::borrow::Cow<'static, str>) -> Result<Self, Self::Error> { 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": false, "is_pub": false, "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_fn_ucs_common_utils_-9177439300551726091
clm
function
// connector-service/backend/common_utils/src/global_id/payment.rs pub fn get_psync_revenue_recovery_id( &self, task: &str, runner: enums::ProcessTrackerRunner, ) -> String { format!("{runner}_{task}_{}", self.get_string_repr()) }
{ "chunk": null, "crate": "ucs_common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_psync_revenue_recovery_id", "is_async": false, "is_pub": true, "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_fn_ucs_common_utils_-1691645809654883903
clm
function
// connector-service/backend/common_utils/src/global_id/customer.rs pub fn get_string_repr(&self) -> &str { self.0.get_string_repr() }
{ "chunk": null, "crate": "ucs_common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_string_repr", "is_async": false, "is_pub": true, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_fn_ucs_common_utils_-7852817296421188670
clm
function
// connector-service/backend/common_utils/src/global_id/customer.rs pub fn generate(cell_id: &CellId) -> Self { 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": false, "is_pub": true, "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_fn_ucs_common_utils_931993288206201104
clm
function
// connector-service/backend/common_utils/src/global_id/customer.rs fn try_from(value: GlobalCustomerId) -> Result<Self, Self::Error> { Self::try_from(std::borrow::Cow::from(value.get_string_repr().to_owned())) }
{ "chunk": null, "crate": "ucs_common_utils", "enum_name": null, "file_size": null, "for_type": null, "function_name": "try_from", "is_async": false, "is_pub": false, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_fn_ucs_common_utils_-3844874386441837858
clm
function
// connector-service/backend/common_utils/src/global_id/customer.rs fn get_api_event_type(&self) -> Option<crate::events::ApiEventsType> { 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": false, "is_pub": false, "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_fn_connector-integration_-3000302630736617794
clm
function
// connector-service/backend/connector-integration/src/types.rs pub fn get_connector_by_name(connector_name: &ConnectorEnum) -> Self { 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": false, "is_pub": true, "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_fn_connector-integration_95147426377412800
clm
function
// connector-service/backend/connector-integration/src/types.rs fn convert_connector(connector_name: ConnectorEnum) -> BoxedConnector<T> { 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": false, "is_pub": false, "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_fn_connector-integration_470705526634439353
clm
function
// connector-service/backend/connector-integration/src/utils.rs fn get_router_return_url(&self) -> Result<String, Error> { 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": false, "is_pub": false, "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_fn_connector-integration_675342960875132202
clm
function
// connector-service/backend/connector-integration/src/utils.rs pub fn missing_field_err( message: &'static str, ) -> Box<dyn Fn() -> error_stack::Report<errors::ConnectorError> + 'static> { 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": false, "is_pub": true, "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_fn_connector-integration_-7548307451147039770
clm
function
// connector-service/backend/connector-integration/src/utils.rs pub(crate) fn get_unimplemented_payment_method_error_message(connector: &str) -> String { format!("Selected payment method through {connector}") }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_unimplemented_payment_method_error_message", "is_async": false, "is_pub": true, "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_fn_connector-integration_5640531032303249449
clm
function
// connector-service/backend/connector-integration/src/utils.rs pub(crate) fn to_connector_meta_from_secret<T>( connector_meta: Option<Secret<Value>>, ) -> Result<T, Error> where T: serde::de::DeserializeOwned, { 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": false, "is_pub": true, "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_fn_connector-integration_-1478864235017962661
clm
function
// connector-service/backend/connector-integration/src/utils.rs pub(crate) fn handle_json_response_deserialization_failure( res: Response, _connector: &'static str, ) -> CustomResult<ErrorResponse, errors::ConnectorError> { 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": false, "is_pub": true, "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_fn_connector-integration_-3580005504110592529
clm
function
// connector-service/backend/connector-integration/src/utils.rs pub fn is_refund_failure(status: enums::RefundStatus) -> bool { 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": false, "is_pub": true, "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_fn_connector-integration_-1223816876361158047
clm
function
// connector-service/backend/connector-integration/src/utils.rs pub fn deserialize_zero_minor_amount_as_none<'de, D>( deserializer: D, ) -> Result<Option<MinorUnit>, D::Error> where D: serde::de::Deserializer<'de>, { 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": false, "is_pub": true, "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_fn_connector-integration_-3932832299040430370
clm
function
// connector-service/backend/connector-integration/src/utils.rs pub fn convert_uppercase<'de, D, T>(v: D) -> Result<T, D::Error> where D: serde::Deserializer<'de>, T: FromStr, <T as FromStr>::Err: std::fmt::Debug + std::fmt::Display + std::error::Error, { 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": false, "is_pub": true, "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_fn_connector-integration_4618798157365645130
clm
function
// connector-service/backend/connector-integration/src/utils.rs fn get_split_payment_data( &self, ) -> Option<domain_types::connector_types::SplitPaymentsRequest> { None }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_split_payment_data", "is_async": false, "is_pub": false, "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_fn_connector-integration_-6286963244239753163
clm
function
// connector-service/backend/connector-integration/src/utils.rs pub fn serialize_to_xml_string_with_root<T: Serialize>( root_name: &str, data: &T, ) -> Result<String, Error> { 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": false, "is_pub": true, "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_fn_connector-integration_7300232737768602902
clm
function
// connector-service/backend/connector-integration/src/connectors/nexinets.rs fn id(&self) -> &'static str { "nexinets" }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "id", "is_async": false, "is_pub": false, "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_fn_connector-integration_687078170919409388
clm
function
// connector-service/backend/connector-integration/src/connectors/nexinets.rs fn common_get_content_type(&self) -> &'static str { "application/json" }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "common_get_content_type", "is_async": false, "is_pub": false, "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_fn_connector-integration_904565359718142124
clm
function
// connector-service/backend/connector-integration/src/connectors/nexinets.rs fn get_auth_header( &self, auth_type: &ConnectorAuthType, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { 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": false, "is_pub": false, "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_fn_connector-integration_7510918784495995475
clm
function
// connector-service/backend/connector-integration/src/connectors/nexinets.rs fn base_url<'a>(&self, connectors: &'a Connectors) -> &'a str { connectors.nexinets.base_url.as_ref() }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "base_url", "is_async": false, "is_pub": false, "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_fn_connector-integration_6609482388069251506
clm
function
// connector-service/backend/connector-integration/src/connectors/nexinets.rs fn build_error_response( &self, res: Response, event_builder: Option<&mut events::Event>, ) -> CustomResult<ErrorResponse, errors::ConnectorError> { 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": false, "is_pub": false, "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_fn_connector-integration_-7192109272682467707
clm
function
// connector-service/backend/connector-integration/src/connectors/braintree.rs fn id(&self) -> &'static str { "braintree" }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "id", "is_async": false, "is_pub": false, "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_fn_connector-integration_-6258088273174346898
clm
function
// connector-service/backend/connector-integration/src/connectors/braintree.rs fn get_currency_unit(&self) -> CurrencyUnit { CurrencyUnit::Base }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_currency_unit", "is_async": false, "is_pub": false, "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_fn_connector-integration_-2650852827900665450
clm
function
// connector-service/backend/connector-integration/src/connectors/braintree.rs fn base_url<'a>(&self, connectors: &'a Connectors) -> &'a str { connectors.braintree.base_url.as_ref() }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "base_url", "is_async": false, "is_pub": false, "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_fn_connector-integration_3823782437163760842
clm
function
// connector-service/backend/connector-integration/src/connectors/braintree.rs fn get_auth_header( &self, auth_type: &ConnectorAuthType, ) -> CustomResult<Vec<(String, hyperswitch_masking::Maskable<String>)>, errors::ConnectorError> { 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": false, "is_pub": false, "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_fn_connector-integration_4876611073761413646
clm
function
// connector-service/backend/connector-integration/src/connectors/braintree.rs fn build_error_response( &self, res: Response, event_builder: Option<&mut events::Event>, ) -> CustomResult<ErrorResponse, errors::ConnectorError> { 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": false, "is_pub": false, "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_fn_connector-integration_-495725974290382849
clm
function
// connector-service/backend/connector-integration/src/connectors/braintree.rs fn should_do_payment_method_token(&self) -> bool { true }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "should_do_payment_method_token", "is_async": false, "is_pub": false, "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_fn_connector-integration_5311678581769713501
clm
function
// connector-service/backend/connector-integration/src/connectors/noon.rs fn get_webhook_source_verification_signature( &self, request: &RequestDetails, _connector_webhook_secret: &ConnectorWebhookSecrets, ) -> CustomResult<Vec<u8>, errors::ConnectorError> { 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": false, "is_pub": false, "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_fn_connector-integration_-8773605878443720959
clm
function
// connector-service/backend/connector-integration/src/connectors/noon.rs fn get_webhook_source_verification_message( &self, request: &RequestDetails, _connector_webhook_secrets: &ConnectorWebhookSecrets, ) -> CustomResult<Vec<u8>, errors::ConnectorError> { 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": false, "is_pub": false, "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_fn_connector-integration_-4080692132823228647
clm
function
// connector-service/backend/connector-integration/src/connectors/noon.rs fn get_event_type( &self, request: RequestDetails, _connector_webhook_secret: Option<ConnectorWebhookSecrets>, _connector_account_details: Option<ConnectorAuthType>, ) -> Result<EventType, error_stack::Report<domain_types::errors::ConnectorError>> { 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": false, "is_pub": false, "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_fn_connector-integration_-4433385732719072211
clm
function
// connector-service/backend/connector-integration/src/connectors/noon.rs fn verify_webhook_source( &self, request: RequestDetails, connector_webhook_secret: Option<ConnectorWebhookSecrets>, _connector_account_details: Option<ConnectorAuthType>, ) -> Result<bool, error_stack::Report<domain_types::errors::ConnectorError>> { 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": false, "is_pub": false, "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_fn_connector-integration_5170877420409555955
clm
function
// connector-service/backend/connector-integration/src/connectors/noon.rs fn process_payment_webhook( &self, _request: RequestDetails, _connector_webhook_secret: Option<ConnectorWebhookSecrets>, _connector_account_details: Option<ConnectorAuthType>, ) -> Result< domain_types::connector_types::WebhookDetailsResponse, error_stack::Report<domain_types::errors::ConnectorError>, > { 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": false, "is_pub": false, "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_fn_connector-integration_-5196709009876329560
clm
function
// connector-service/backend/connector-integration/src/connectors/noon.rs fn get_webhook_resource_object( &self, request: RequestDetails, ) -> CustomResult<Box<dyn hyperswitch_masking::ErasedMaskSerialize>, errors::ConnectorError> { 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": false, "is_pub": false, "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_fn_connector-integration_408393668506081512
clm
function
// connector-service/backend/connector-integration/src/connectors/noon.rs fn id(&self) -> &'static str { "noon" }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "id", "is_async": false, "is_pub": false, "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_fn_connector-integration_2012810026449938024
clm
function
// connector-service/backend/connector-integration/src/connectors/noon.rs fn common_get_content_type(&self) -> &'static str { "application/json" }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "common_get_content_type", "is_async": false, "is_pub": false, "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_fn_connector-integration_539243876017425482
clm
function
// connector-service/backend/connector-integration/src/connectors/noon.rs fn base_url<'a>(&self, connectors: &'a Connectors) -> &'a str { connectors.noon.base_url.as_ref() }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "base_url", "is_async": false, "is_pub": false, "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_fn_connector-integration_-5802074331334774013
clm
function
// connector-service/backend/connector-integration/src/connectors/noon.rs fn build_error_response( &self, res: Response, event_builder: Option<&mut events::Event>, ) -> CustomResult<ErrorResponse, errors::ConnectorError> { 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": false, "is_pub": false, "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_fn_connector-integration_-2882289908072006079
clm
function
// connector-service/backend/connector-integration/src/connectors/worldpayvantiv.rs fn verify_webhook_source( &self, _request: RequestDetails, _connector_webhook_secret: Option<ConnectorWebhookSecrets>, _connector_account_details: Option<ConnectorAuthType>, ) -> Result<bool, error_stack::Report<ConnectorError>> { Ok(false) // WorldpayVantiv doesn't support webhooks }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "verify_webhook_source", "is_async": false, "is_pub": false, "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_fn_connector-integration_8588311719895974799
clm
function
// connector-service/backend/connector-integration/src/connectors/worldpayvantiv.rs fn get_event_type( &self, _request: RequestDetails, _connector_webhook_secret: Option<ConnectorWebhookSecrets>, _connector_account_details: Option<ConnectorAuthType>, ) -> Result<EventType, error_stack::Report<ConnectorError>> { Err(error_stack::report!(ConnectorError::WebhooksNotImplemented)) }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_event_type", "is_async": false, "is_pub": false, "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_fn_connector-integration_8175484518056972685
clm
function
// connector-service/backend/connector-integration/src/connectors/worldpayvantiv.rs fn process_payment_webhook( &self, _request: RequestDetails, _connector_webhook_secret: Option<ConnectorWebhookSecrets>, _connector_account_details: Option<ConnectorAuthType>, ) -> Result<WebhookDetailsResponse, error_stack::Report<ConnectorError>> { Err(error_stack::report!(ConnectorError::WebhooksNotImplemented)) }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "process_payment_webhook", "is_async": false, "is_pub": false, "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_fn_connector-integration_-4863185090405161938
clm
function
// connector-service/backend/connector-integration/src/connectors/worldpayvantiv.rs fn process_refund_webhook( &self, _request: RequestDetails, _connector_webhook_secret: Option<ConnectorWebhookSecrets>, _connector_account_details: Option<ConnectorAuthType>, ) -> Result<RefundWebhookDetailsResponse, error_stack::Report<ConnectorError>> { Err(error_stack::report!(ConnectorError::WebhooksNotImplemented)) }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "process_refund_webhook", "is_async": false, "is_pub": false, "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_fn_connector-integration_8999099304115799803
clm
function
// connector-service/backend/connector-integration/src/connectors/worldpayvantiv.rs fn id(&self) -> &'static str { "worldpayvantiv" }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "id", "is_async": false, "is_pub": false, "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_fn_connector-integration_6226629507007010045
clm
function
// connector-service/backend/connector-integration/src/connectors/worldpayvantiv.rs fn common_get_content_type(&self) -> &'static str { "text/xml" }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "common_get_content_type", "is_async": false, "is_pub": false, "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_fn_connector-integration_-1999270322531257603
clm
function
// connector-service/backend/connector-integration/src/connectors/worldpayvantiv.rs fn base_url<'a>(&self, connectors: &'a Connectors) -> &'a str { connectors.worldpayvantiv.base_url.as_ref() }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "base_url", "is_async": false, "is_pub": false, "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_fn_connector-integration_-974138978700468121
clm
function
// connector-service/backend/connector-integration/src/connectors/worldpayvantiv.rs fn build_error_response( &self, res: Response, event_builder: Option<&mut events::Event>, ) -> CustomResult<ErrorResponse, errors::ConnectorError> { 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": false, "is_pub": false, "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_fn_connector-integration_6324660544642704136
clm
function
// connector-service/backend/connector-integration/src/connectors/worldpayvantiv.rs fn get_currency_unit(&self) -> common_enums::CurrencyUnit { common_enums::CurrencyUnit::Minor }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_currency_unit", "is_async": false, "is_pub": false, "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_fn_connector-integration_-1687468523137774549
clm
function
// connector-service/backend/connector-integration/src/connectors/worldpayvantiv.rs fn get_headers( &self, req: &RouterDataV2<RSync, RefundFlowData, RefundSyncData, RefundsResponseData>, ) -> CustomResult<Vec<(String, Maskable<String>)>, ConnectorError> { self.get_auth_header(&req.connector_auth_type) }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_headers", "is_async": false, "is_pub": false, "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_fn_connector-integration_5080222575621842262
clm
function
// connector-service/backend/connector-integration/src/connectors/worldpayvantiv.rs fn get_content_type(&self) -> &'static str { "application/json" }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_content_type", "is_async": false, "is_pub": false, "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_fn_connector-integration_-1124267742953916698
clm
function
// connector-service/backend/connector-integration/src/connectors/worldpayvantiv.rs fn get_url( &self, req: &RouterDataV2<RSync, RefundFlowData, RefundSyncData, RefundsResponseData>, ) -> CustomResult<String, ConnectorError> { 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": false, "is_pub": false, "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_fn_connector-integration_-4675992654129030335
clm
function
// connector-service/backend/connector-integration/src/connectors/worldpayvantiv.rs fn get_request_body( &self, _req: &RouterDataV2<RSync, RefundFlowData, RefundSyncData, RefundsResponseData>, ) -> CustomResult<Option<RequestContent>, ConnectorError> { // GET request doesn't need a body Ok(None) }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_request_body", "is_async": false, "is_pub": false, "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_fn_connector-integration_4669416719405753293
clm
function
// connector-service/backend/connector-integration/src/connectors/worldpayvantiv.rs fn handle_response_v2( &self, data: &RouterDataV2<RSync, RefundFlowData, RefundSyncData, RefundsResponseData>, event_builder: Option<&mut events::Event>, res: Response, ) -> CustomResult< RouterDataV2<RSync, RefundFlowData, RefundSyncData, RefundsResponseData>, ConnectorError, > { 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": false, "is_pub": false, "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_fn_connector-integration_-5013213994734884627
clm
function
// connector-service/backend/connector-integration/src/connectors/worldpayvantiv.rs fn get_error_response_v2( &self, res: Response, event_builder: Option<&mut events::Event>, ) -> CustomResult<ErrorResponse, ConnectorError> { self.build_error_response(res, event_builder) }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_error_response_v2", "is_async": false, "is_pub": false, "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_fn_connector-integration_4877908357286924272
clm
function
// connector-service/backend/connector-integration/src/connectors/worldpayvantiv.rs fn get_http_method(&self) -> common_utils::request::Method { common_utils::request::Method::Get }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_http_method", "is_async": false, "is_pub": false, "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_fn_connector-integration_7503334479910134463
clm
function
// connector-service/backend/connector-integration/src/connectors/xendit.rs fn id(&self) -> &'static str { "xendit" }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "id", "is_async": false, "is_pub": false, "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_fn_connector-integration_-2869265949716133953
clm
function
// connector-service/backend/connector-integration/src/connectors/xendit.rs fn get_currency_unit(&self) -> CurrencyUnit { CurrencyUnit::Base }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_currency_unit", "is_async": false, "is_pub": false, "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_fn_connector-integration_-6365358677128161811
clm
function
// connector-service/backend/connector-integration/src/connectors/xendit.rs fn common_get_content_type(&self) -> &'static str { "application/json" }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "common_get_content_type", "is_async": false, "is_pub": false, "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_fn_connector-integration_-1226765768116923587
clm
function
// connector-service/backend/connector-integration/src/connectors/xendit.rs fn get_auth_header( &self, auth_type: &ConnectorAuthType, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { 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": false, "is_pub": false, "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_fn_connector-integration_-3354030779745385525
clm
function
// connector-service/backend/connector-integration/src/connectors/xendit.rs fn base_url<'a>(&self, _connectors: &'a Connectors) -> &'a str { "" }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "base_url", "is_async": false, "is_pub": false, "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_fn_connector-integration_8823207903440648571
clm
function
// connector-service/backend/connector-integration/src/connectors/xendit.rs fn build_error_response( &self, res: Response, event_builder: Option<&mut events::Event>, ) -> CustomResult<ErrorResponse, errors::ConnectorError> { 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": false, "is_pub": false, "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_fn_connector-integration_3331087718263453263
clm
function
// connector-service/backend/connector-integration/src/connectors/adyen.rs fn id(&self) -> &'static str { "adyen" }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "id", "is_async": false, "is_pub": false, "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_fn_connector-integration_-7440191075336407040
clm
function
// connector-service/backend/connector-integration/src/connectors/adyen.rs fn get_currency_unit(&self) -> common_enums::CurrencyUnit { common_enums::CurrencyUnit::Minor }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_currency_unit", "is_async": false, "is_pub": false, "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_fn_connector-integration_4883855435181155118
clm
function
// connector-service/backend/connector-integration/src/connectors/adyen.rs fn get_auth_header( &self, auth_type: &ConnectorAuthType, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { 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": false, "is_pub": false, "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_fn_connector-integration_672322764263471488
clm
function
// connector-service/backend/connector-integration/src/connectors/adyen.rs fn base_url<'a>(&self, connectors: &'a Connectors) -> &'a str { connectors.adyen.base_url.as_ref() }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "base_url", "is_async": false, "is_pub": false, "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_fn_connector-integration_2330983820339227565
clm
function
// connector-service/backend/connector-integration/src/connectors/adyen.rs fn build_error_response( &self, res: Response, event_builder: Option<&mut events::Event>, ) -> CustomResult<ErrorResponse, errors::ConnectorError> { 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": false, "is_pub": false, "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_fn_connector-integration_-4622464088701001147
clm
function
// connector-service/backend/connector-integration/src/connectors/adyen.rs fn get_event_type( &self, request: RequestDetails, _connector_webhook_secret: Option<ConnectorWebhookSecrets>, _connector_account_details: Option<ConnectorAuthType>, ) -> Result<domain_types::connector_types::EventType, error_stack::Report<errors::ConnectorError>> { 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": false, "is_pub": false, "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_fn_connector-integration_-8842442788950255542
clm
function
// connector-service/backend/connector-integration/src/connectors/adyen.rs fn process_payment_webhook( &self, request: RequestDetails, _connector_webhook_secret: Option<ConnectorWebhookSecrets>, _connector_account_details: Option<ConnectorAuthType>, ) -> Result<WebhookDetailsResponse, error_stack::Report<errors::ConnectorError>> { 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": false, "is_pub": false, "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_fn_connector-integration_-794727520549150336
clm
function
// connector-service/backend/connector-integration/src/connectors/adyen.rs fn process_refund_webhook( &self, request: RequestDetails, _connector_webhook_secret: Option<ConnectorWebhookSecrets>, _connector_account_details: Option<ConnectorAuthType>, ) -> Result< domain_types::connector_types::RefundWebhookDetailsResponse, error_stack::Report<errors::ConnectorError>, > { 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": false, "is_pub": false, "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_fn_connector-integration_-9179422800267180449
clm
function
// connector-service/backend/connector-integration/src/connectors/adyen.rs fn process_dispute_webhook( &self, request: RequestDetails, _connector_webhook_secret: Option<ConnectorWebhookSecrets>, _connector_account_details: Option<ConnectorAuthType>, ) -> Result< domain_types::connector_types::DisputeWebhookDetailsResponse, error_stack::Report<errors::ConnectorError>, > { 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": false, "is_pub": false, "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_fn_connector-integration_3865006106555561242
clm
function
// connector-service/backend/connector-integration/src/connectors/adyen.rs fn get_connector_about(&self) -> Option<&'static ConnectorInfo> { Some(&ADYEN_CONNECTOR_INFO) }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_connector_about", "is_async": false, "is_pub": false, "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_fn_connector-integration_-5662866922495959878
clm
function
// connector-service/backend/connector-integration/src/connectors/adyen.rs fn get_supported_payment_methods(&self) -> Option<&'static SupportedPaymentMethods> { Some(&ADYEN_SUPPORTED_PAYMENT_METHODS) }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_supported_payment_methods", "is_async": false, "is_pub": false, "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_fn_connector-integration_-5059519621510379087
clm
function
// connector-service/backend/connector-integration/src/connectors/adyen.rs fn get_supported_webhook_flows(&self) -> Option<&'static [EventClass]> { Some(ADYEN_SUPPORTED_WEBHOOK_FLOWS) }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_supported_webhook_flows", "is_async": false, "is_pub": false, "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 }