id
stringlengths
20
153
type
stringclasses
1 value
granularity
stringclasses
14 values
content
stringlengths
16
84.3k
metadata
dict
connector-service_fn_tracing-kafka_-6882464342109674018
clm
function
// connector-service/backend/tracing-kafka/src/layer.rs pub fn build(self) -> Result<KafkaLayer, KafkaLayerError> { let kafka_writer = self.writer_builder.build()?; KafkaLayer::from_writer(kafka_writer, self.static_fields) }
{ "chunk": null, "crate": "tracing-kafka", "enum_name": null, "file_size": null, "for_type": null, "function_name": "build", "is_async": false, "is_pub": true, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_fn_tracing-kafka_-904112888219053227
clm
function
// connector-service/backend/tracing-kafka/src/builder.rs pub fn new() -> Self { Self::default() }
{ "chunk": null, "crate": "tracing-kafka", "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_tracing-kafka_3951351347771769512
clm
function
// connector-service/backend/tracing-kafka/src/builder.rs pub fn brokers(mut self, brokers: Vec<String>) -> Self { self.brokers = Some(brokers); self }
{ "chunk": null, "crate": "tracing-kafka", "enum_name": null, "file_size": null, "for_type": null, "function_name": "brokers", "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_tracing-kafka_1810747260735642073
clm
function
// connector-service/backend/tracing-kafka/src/builder.rs pub fn topic(mut self, topic: impl Into<String>) -> Self { self.topic = Some(topic.into()); self }
{ "chunk": null, "crate": "tracing-kafka", "enum_name": null, "file_size": null, "for_type": null, "function_name": "topic", "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_tracing-kafka_6179666361871653349
clm
function
// connector-service/backend/tracing-kafka/src/builder.rs pub fn batch_size(mut self, size: usize) -> Self { self.batch_size = Some(size); self }
{ "chunk": null, "crate": "tracing-kafka", "enum_name": null, "file_size": null, "for_type": null, "function_name": "batch_size", "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_tracing-kafka_-1010434576358735223
clm
function
// connector-service/backend/tracing-kafka/src/builder.rs pub fn linger_ms(mut self, ms: u64) -> Self { self.linger_ms = Some(ms); self }
{ "chunk": null, "crate": "tracing-kafka", "enum_name": null, "file_size": null, "for_type": null, "function_name": "linger_ms", "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_tracing-kafka_9155797755654983498
clm
function
// connector-service/backend/tracing-kafka/src/builder.rs pub fn linger(mut self, duration: Duration) -> Self { self.linger_ms = duration.as_millis().try_into().ok(); self }
{ "chunk": null, "crate": "tracing-kafka", "enum_name": null, "file_size": null, "for_type": null, "function_name": "linger", "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_tracing-kafka_7979908548232576046
clm
function
// connector-service/backend/tracing-kafka/src/builder.rs pub fn queue_buffering_max_messages(mut self, size: usize) -> Self { self.queue_buffering_max_messages = Some(size); self }
{ "chunk": null, "crate": "tracing-kafka", "enum_name": null, "file_size": null, "for_type": null, "function_name": "queue_buffering_max_messages", "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_tracing-kafka_-2671718408570035361
clm
function
// connector-service/backend/tracing-kafka/src/builder.rs pub fn queue_buffering_max_kbytes(mut self, size: usize) -> Self { self.queue_buffering_max_kbytes = Some(size); self }
{ "chunk": null, "crate": "tracing-kafka", "enum_name": null, "file_size": null, "for_type": null, "function_name": "queue_buffering_max_kbytes", "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_tracing-kafka_-512760633133803525
clm
function
// connector-service/backend/tracing-kafka/src/builder.rs pub fn reconnect_backoff(mut self, min: Duration, max: Duration) -> Self { self.reconnect_backoff_min_ms = min.as_millis().try_into().ok(); self.reconnect_backoff_max_ms = max.as_millis().try_into().ok(); self }
{ "chunk": null, "crate": "tracing-kafka", "enum_name": null, "file_size": null, "for_type": null, "function_name": "reconnect_backoff", "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_tracing-kafka_108416459605169019
clm
function
// connector-service/backend/tracing-kafka/src/builder.rs pub fn build(self) -> Result<KafkaWriter, KafkaWriterError> { let brokers = self.brokers.ok_or_else(|| { KafkaWriterError::ProducerCreation(rdkafka::error::KafkaError::ClientCreation( "No brokers specified. Use .brokers()".to_string(), )) })?; let topic = self.topic.ok_or_else(|| { KafkaWriterError::ProducerCreation(rdkafka::error::KafkaError::ClientCreation( "No topic specified. Use .topic()".to_string(), )) })?; KafkaWriter::new( brokers, topic, self.batch_size, self.linger_ms, self.queue_buffering_max_messages, self.queue_buffering_max_kbytes, self.reconnect_backoff_min_ms, self.reconnect_backoff_max_ms, ) }
{ "chunk": null, "crate": "tracing-kafka", "enum_name": null, "file_size": null, "for_type": null, "function_name": "build", "is_async": false, "is_pub": true, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_fn_ucs_common_enums_1302335836922554835
clm
function
// connector-service/backend/common_enums/src/enums.rs pub fn to_currency_base_unit(self, amount: i64) -> Result<String, CurrencyError> { let amount_f64 = self.to_currency_base_unit_asf64(amount)?; Ok(format!("{amount_f64:.2}")) }
{ "chunk": null, "crate": "ucs_common_enums", "enum_name": null, "file_size": null, "for_type": null, "function_name": "to_currency_base_unit", "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_enums_6717620428198109433
clm
function
// connector-service/backend/common_enums/src/enums.rs pub fn to_currency_base_unit_asf64(self, amount: i64) -> Result<f64, CurrencyError> { let exponent = self.number_of_digits_after_decimal_point()?; let divisor = 10_u32.pow(exponent.into()); let amount_f64 = amount as f64 / f64::from(divisor); Ok(amount_f64) }
{ "chunk": null, "crate": "ucs_common_enums", "enum_name": null, "file_size": null, "for_type": null, "function_name": "to_currency_base_unit_asf64", "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_enums_1935645549446957743
clm
function
// connector-service/backend/common_enums/src/enums.rs pub fn to_currency_lower_unit(self, amount: String) -> Result<String, CurrencyError> { let amount_decimal = amount .parse::<f64>() .map_err(|_| CurrencyError::UnsupportedCurrency { currency: format!("Invalid amount format: {amount}"), })?; let exponent = self.number_of_digits_after_decimal_point()?; let multiplier = 10_u32.pow(exponent.into()); let final_amount = amount_decimal * f64::from(multiplier); Ok(final_amount.to_string()) }
{ "chunk": null, "crate": "ucs_common_enums", "enum_name": null, "file_size": null, "for_type": null, "function_name": "to_currency_lower_unit", "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_enums_-6063022065528235099
clm
function
// connector-service/backend/common_enums/src/enums.rs pub fn to_currency_base_unit_with_zero_decimal_check( self, amount: i64, ) -> Result<String, CurrencyError> { if self.is_zero_decimal_currency() { Ok(amount.to_string()) } else { self.to_currency_base_unit(amount) } }
{ "chunk": null, "crate": "ucs_common_enums", "enum_name": null, "file_size": null, "for_type": null, "function_name": "to_currency_base_unit_with_zero_decimal_check", "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_enums_-7698180591797718585
clm
function
// connector-service/backend/common_enums/src/enums.rs pub fn iso_4217(self) -> &'static str { match self { Self::AED => "784", Self::AFN => "971", Self::ALL => "008", Self::AMD => "051", Self::ANG => "532", Self::AOA => "973", Self::ARS => "032", Self::AUD => "036", Self::AWG => "533", Self::AZN => "944", Self::BAM => "977", Self::BBD => "052", Self::BDT => "050", Self::BGN => "975", Self::BHD => "048", Self::BIF => "108", Self::BMD => "060", Self::BND => "096", Self::BOB => "068", Self::BRL => "986", Self::BSD => "044", Self::BTN => "064", Self::BWP => "072", Self::BYN => "933", Self::BZD => "084", Self::CAD => "124", Self::CDF => "976", Self::CHF => "756", Self::CLF => "990", Self::CLP => "152", Self::CNY => "156", Self::COP => "170", Self::CRC => "188", Self::CUC => "931", Self::CUP => "192", Self::CVE => "132", Self::CZK => "203", Self::DJF => "262", Self::DKK => "208", Self::DOP => "214", Self::DZD => "012", Self::EGP => "818", Self::ERN => "232", Self::ETB => "230", Self::EUR => "978", Self::FJD => "242", Self::FKP => "238", Self::GBP => "826", Self::GEL => "981", Self::GHS => "936", Self::GIP => "292", Self::GMD => "270", Self::GNF => "324", Self::GTQ => "320", Self::GYD => "328", Self::HKD => "344", Self::HNL => "340", Self::HRK => "191", Self::HTG => "332", Self::HUF => "348", Self::IDR => "360", Self::ILS => "376", Self::INR => "356", Self::IQD => "368", Self::IRR => "364", Self::ISK => "352", Self::JMD => "388", Self::JOD => "400", Self::JPY => "392", Self::KES => "404", Self::KGS => "417", Self::KHR => "116", Self::KMF => "174", Self::KPW => "408", Self::KRW => "410", Self::KWD => "414", Self::KYD => "136", Self::KZT => "398", Self::LAK => "418", Self::LBP => "422", Self::LKR => "144", Self::LRD => "430", Self::LSL => "426", Self::LYD => "434", Self::MAD => "504", Self::MDL => "498", Self::MGA => "969", Self::MKD => "807", Self::MMK => "104", Self::MNT => "496", Self::MOP => "446", Self::MRU => "929", Self::MUR => "480", Self::MVR => "462", Self::MWK => "454", Self::MXN => "484", Self::MYR => "458", Self::MZN => "943", Self::NAD => "516", Self::NGN => "566", Self::NIO => "558", Self::NOK => "578", Self::NPR => "524", Self::NZD => "554", Self::OMR => "512", Self::PAB => "590", Self::PEN => "604", Self::PGK => "598", Self::PHP => "608", Self::PKR => "586", Self::PLN => "985", Self::PYG => "600", Self::QAR => "634", Self::RON => "946", Self::RSD => "941", Self::RUB => "643", Self::RWF => "646", Self::SAR => "682", Self::SBD => "090", Self::SCR => "690", Self::SDG => "938", Self::SEK => "752", Self::SGD => "702", Self::SHP => "654", Self::SLE => "925", Self::SLL => "694", Self::SOS => "706", Self::SRD => "968", Self::SSP => "728", Self::STD => "678", Self::STN => "930", Self::SVC => "222", Self::SYP => "760", Self::SZL => "748", Self::THB => "764", Self::TJS => "972", Self::TMT => "934", Self::TND => "788", Self::TOP => "776", Self::TRY => "949", Self::TTD => "780", Self::TWD => "901", Self::TZS => "834", Self::UAH => "980", Self::UGX => "800", Self::USD => "840", Self::UYU => "858", Self::UZS => "860", Self::VES => "928", Self::VND => "704", Self::VUV => "548", Self::WST => "882", Self::XAF => "950", Self::XCD => "951", Self::XOF => "952", Self::XPF => "953", Self::YER => "886", Self::ZAR => "710", Self::ZMW => "967", Self::ZWL => "932", } }
{ "chunk": null, "crate": "ucs_common_enums", "enum_name": null, "file_size": null, "for_type": null, "function_name": "iso_4217", "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_enums_1863457751328752310
clm
function
// connector-service/backend/common_enums/src/enums.rs pub fn is_zero_decimal_currency(self) -> bool { matches!( self, Self::BIF | Self::CLP | Self::DJF | Self::GNF | Self::JPY | Self::KMF | Self::KRW | Self::MGA | Self::PYG | Self::RWF | Self::UGX | Self::VND | Self::VUV | Self::XAF | Self::XOF | Self::XPF ) }
{ "chunk": null, "crate": "ucs_common_enums", "enum_name": null, "file_size": null, "for_type": null, "function_name": "is_zero_decimal_currency", "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_enums_4729465804705572647
clm
function
// connector-service/backend/common_enums/src/enums.rs pub fn is_three_decimal_currency(self) -> bool { matches!( self, Self::BHD | Self::JOD | Self::KWD | Self::OMR | Self::TND ) }
{ "chunk": null, "crate": "ucs_common_enums", "enum_name": null, "file_size": null, "for_type": null, "function_name": "is_three_decimal_currency", "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_enums_2655594376738791316
clm
function
// connector-service/backend/common_enums/src/enums.rs pub fn is_four_decimal_currency(self) -> bool { matches!(self, Self::CLF) }
{ "chunk": null, "crate": "ucs_common_enums", "enum_name": null, "file_size": null, "for_type": null, "function_name": "is_four_decimal_currency", "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_enums_5162897720359370202
clm
function
// connector-service/backend/common_enums/src/enums.rs pub fn number_of_digits_after_decimal_point(self) -> Result<u8, CurrencyError> { if self.is_zero_decimal_currency() { Ok(0) } else if self.is_three_decimal_currency() { Ok(3) } else if self.is_four_decimal_currency() { Ok(4) } else if self.is_two_decimal_currency() { Ok(2) } else { Err(CurrencyError::UnsupportedCurrency { currency: format!("{self:?}"), }) } }
{ "chunk": null, "crate": "ucs_common_enums", "enum_name": null, "file_size": null, "for_type": null, "function_name": "number_of_digits_after_decimal_point", "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_enums_2898546609219124294
clm
function
// connector-service/backend/common_enums/src/enums.rs pub fn is_two_decimal_currency(self) -> bool { matches!( self, Self::AED | Self::AFN | Self::ALL | Self::AMD | Self::ANG | Self::AOA | Self::ARS | Self::AUD | Self::AWG | Self::AZN | Self::BAM | Self::BBD | Self::BDT | Self::BGN | Self::BMD | Self::BND | Self::BOB | Self::BRL | Self::BSD | Self::BTN | Self::BWP | Self::BYN | Self::BZD | Self::CAD | Self::CDF | Self::CHF | Self::CNY | Self::COP | Self::CRC | Self::CUC | Self::CUP | Self::CVE | Self::CZK | Self::DKK | Self::DOP | Self::DZD | Self::EGP | Self::ERN | Self::ETB | Self::EUR | Self::FJD | Self::FKP | Self::GBP | Self::GEL | Self::GHS | Self::GIP | Self::GMD | Self::GTQ | Self::GYD | Self::HKD | Self::HNL | Self::HRK | Self::HTG | Self::HUF | Self::IDR | Self::ILS | Self::INR | Self::IQD | Self::IRR | Self::ISK | Self::JMD | Self::KES | Self::KGS | Self::KHR | Self::KPW | Self::KYD | Self::KZT | Self::LAK | Self::LBP | Self::LKR | Self::LRD | Self::LSL | Self::LYD | Self::MAD | Self::MDL | Self::MKD | Self::MMK | Self::MNT | Self::MOP | Self::MRU | Self::MUR | Self::MVR | Self::MWK | Self::MXN | Self::MYR | Self::MZN | Self::NAD | Self::NGN | Self::NIO | Self::NOK | Self::NPR | Self::NZD | Self::PAB | Self::PEN | Self::PGK | Self::PHP | Self::PKR | Self::PLN | Self::QAR | Self::RON | Self::RSD | Self::RUB | Self::SAR | Self::SBD | Self::SCR | Self::SDG | Self::SEK | Self::SGD | Self::SHP | Self::SLE | Self::SLL | Self::SOS | Self::SRD | Self::SSP | Self::STD | Self::STN | Self::SVC | Self::SYP | Self::SZL | Self::THB | Self::TJS | Self::TMT | Self::TOP | Self::TRY | Self::TTD | Self::TWD | Self::TZS | Self::UAH | Self::USD | Self::UYU | Self::UZS | Self::VES | Self::WST | Self::XCD | Self::YER | Self::ZAR | Self::ZMW | Self::ZWL ) }
{ "chunk": null, "crate": "ucs_common_enums", "enum_name": null, "file_size": null, "for_type": null, "function_name": "is_two_decimal_currency", "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_enums_329954598092754521
clm
function
// connector-service/backend/common_enums/src/enums.rs pub fn should_check_for_customer_saved_payment_method_type(self) -> bool { matches!(self, Self::Credit | Self::Debit) }
{ "chunk": null, "crate": "ucs_common_enums", "enum_name": null, "file_size": null, "for_type": null, "function_name": "should_check_for_customer_saved_payment_method_type", "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_enums_952033036474932759
clm
function
// connector-service/backend/common_enums/src/enums.rs pub fn to_display_name(&self) -> String { match self { Self::ApplePay => "Apple Pay".to_string(), Self::GooglePay => "Google Pay".to_string(), Self::SamsungPay => "Samsung Pay".to_string(), Self::AliPay => "AliPay".to_string(), Self::WeChatPay => "WeChat Pay".to_string(), Self::KakaoPay => "Kakao Pay".to_string(), Self::GoPay => "GoPay".to_string(), Self::Gcash => "GCash".to_string(), _ => format!("{self:?}"), } }
{ "chunk": null, "crate": "ucs_common_enums", "enum_name": null, "file_size": null, "for_type": null, "function_name": "to_display_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_ucs_common_enums_-734669285405537828
clm
function
// connector-service/backend/common_enums/src/enums.rs fn try_from(value: u32) -> Result<Self, Self::Error> { Ok(match value { 1 => AttemptStatus::Started, 2 => AttemptStatus::AuthenticationFailed, 3 => AttemptStatus::RouterDeclined, 4 => AttemptStatus::AuthenticationPending, 5 => AttemptStatus::AuthenticationSuccessful, 6 => AttemptStatus::Authorized, 7 => AttemptStatus::AuthorizationFailed, 8 => AttemptStatus::Charged, 9 => AttemptStatus::Authorizing, 10 => AttemptStatus::CodInitiated, 11 => AttemptStatus::Voided, 12 => AttemptStatus::VoidedPostCapture, 13 => AttemptStatus::VoidInitiated, 14 => AttemptStatus::VoidPostCaptureInitiated, 15 => AttemptStatus::CaptureInitiated, 16 => AttemptStatus::CaptureFailed, 17 => AttemptStatus::VoidFailed, 18 => AttemptStatus::AutoRefunded, 19 => AttemptStatus::PartialCharged, 20 => AttemptStatus::PartialChargedAndChargeable, 21 => AttemptStatus::Unresolved, 22 => AttemptStatus::Pending, 23 => AttemptStatus::Failure, 24 => AttemptStatus::PaymentMethodAwaited, 25 => AttemptStatus::ConfirmationAwaited, 26 => AttemptStatus::DeviceDataCollectionPending, _ => AttemptStatus::Unknown, }) }
{ "chunk": null, "crate": "ucs_common_enums", "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_enums_-2103179282539849872
clm
function
// connector-service/backend/common_enums/src/enums.rs pub fn is_terminal_status(self) -> bool { matches!( self, Self::Charged | Self::AutoRefunded | Self::Voided | Self::VoidedPostCapture | Self::PartialCharged | Self::AuthenticationFailed | Self::AuthorizationFailed | Self::VoidFailed | Self::CaptureFailed | Self::Failure | Self::IntegrityFailure ) }
{ "chunk": null, "crate": "ucs_common_enums", "enum_name": null, "file_size": null, "for_type": null, "function_name": "is_terminal_status", "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_enums_1659218272502078584
clm
function
// connector-service/backend/common_enums/src/enums.rs pub fn is_global_network(&self) -> bool { matches!( self, Self::Visa | Self::Mastercard | Self::AmericanExpress | Self::JCB | Self::DinersClub | Self::Discover | Self::CartesBancaires | Self::UnionPay ) }
{ "chunk": null, "crate": "ucs_common_enums", "enum_name": null, "file_size": null, "for_type": null, "function_name": "is_global_network", "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_enums_-983148764886243149
clm
function
// connector-service/backend/common_enums/src/enums.rs pub fn is_us_local_network(&self) -> bool { matches!(self, Self::Star | Self::Pulse | Self::Accel | Self::Nyce) }
{ "chunk": null, "crate": "ucs_common_enums", "enum_name": null, "file_size": null, "for_type": null, "function_name": "is_us_local_network", "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_enums_-5070012085545350169
clm
function
// connector-service/backend/common_enums/src/enums.rs pub fn is_upstream_timeout(&self) -> bool { self == &Self::RequestTimeoutReceived }
{ "chunk": null, "crate": "ucs_common_enums", "enum_name": null, "file_size": null, "for_type": null, "function_name": "is_upstream_timeout", "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_enums_-7146556930746267567
clm
function
// connector-service/backend/common_enums/src/enums.rs pub fn is_connection_closed_before_message_could_complete(&self) -> bool { self == &Self::ConnectionClosedIncompleteMessage }
{ "chunk": null, "crate": "ucs_common_enums", "enum_name": null, "file_size": null, "for_type": null, "function_name": "is_connection_closed_before_message_could_complete", "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_cards_3408096430227936569
clm
function
// connector-service/backend/cards/src/validate.rs pub fn get_card_isin(&self) -> String { self.0.peek().chars().take(6).collect::<String>() }
{ "chunk": null, "crate": "ucs_cards", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_card_isin", "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_cards_-2142728885588291919
clm
function
// connector-service/backend/cards/src/validate.rs pub fn get_extended_card_bin(&self) -> String { self.0.peek().chars().take(8).collect::<String>() }
{ "chunk": null, "crate": "ucs_cards", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_extended_card_bin", "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_cards_4759594768536609650
clm
function
// connector-service/backend/cards/src/validate.rs pub fn get_card_no(&self) -> String { self.0.peek().chars().collect::<String>() }
{ "chunk": null, "crate": "ucs_cards", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_card_no", "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_cards_-8250640920232975802
clm
function
// connector-service/backend/cards/src/validate.rs pub fn get_last4(&self) -> String { self.0 .peek() .chars() .rev() .take(4) .collect::<String>() .chars() .rev() .collect::<String>() }
{ "chunk": null, "crate": "ucs_cards", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_last4", "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_cards_7140463363829715490
clm
function
// connector-service/backend/cards/src/validate.rs pub fn is_cobadged_card(&self) -> Result<bool, error_stack::Report<ValidationError>> { /// Regex to identify card networks static CARD_NETWORK_REGEX: LazyLock<HashMap<&str, Result<Regex, regex::Error>>> = LazyLock::new(|| { let mut map = HashMap::new(); map.insert( "Mastercard", Regex::new(r"^(222[1-9]|22[3-9][0-9]|2[3-6][0-9]{2}|27[0-1][0-9]|2720|5[1-5])"), ); map.insert("American Express", Regex::new(r"^3[47]")); map.insert("Visa", Regex::new(r"^4")); map.insert( "Discover", Regex::new( r"^(6011|64[4-9]|65|622126|622[1-9][0-9][0-9]|6229[0-1][0-9]|622925)", ), ); map.insert( "Maestro", Regex::new(r"^(5018|5081|5044|504681|504993|5020|502260|5038|5893|603845|603123|6304|6759|676[1-3]|6220|504834|504817|504645|504775|600206|627741)"), ); map.insert( "RuPay", Regex::new(r"^(508227|508[5-9]|603741|60698[5-9]|60699|607[0-8]|6079[0-7]|60798[0-4]|60800[1-9]|6080[1-9]|608[1-4]|608500|6521[5-9]|652[2-9]|6530|6531[0-4]|817290|817368|817378|353800|82)"), ); map.insert("Diners Club", Regex::new(r"^(36|38|39|30[0-5])")); map.insert("JCB", Regex::new(r"^35(2[89]|[3-8][0-9])")); map.insert("CarteBlanche", Regex::new(r"^389[0-9]{11}$")); map.insert("Sodex", Regex::new(r"^(637513)")); map.insert("BAJAJ", Regex::new(r"^(203040)")); map.insert("CartesBancaires", Regex::new(r"^(401(005|006|581)|4021(01|02)|403550|405936|406572|41(3849|4819|50(56|59|62|71|74)|6286|65(37|79)|71[7])|420110|423460|43(47(21|22)|50(48|49|50|51|52)|7875|95(09|11|15|39|98)|96(03|18|19|20|22|72))|4424(48|49|50|51|52|57)|448412|4505(19|60)|45(33|56[6-8]|61|62[^3]|6955|7452|7717|93[02379])|46(099|54(76|77)|6258|6575|98[023])|47(4107|71(73|74|86)|72(65|93)|9619)|48(1091|3622|6519)|49(7|83[5-9]|90(0[1-6]|1[0-6]|2[0-3]|3[0-3]|4[0-3]|5[0-2]|68|9[256789]))|5075(89|90|93|94|97)|51(0726|3([0-7]|8[56]|9(00|38))|5214|62(07|36)|72(22|43)|73(65|66)|7502|7647|8101|9920)|52(0993|1662|3718|7429|9227|93(13|14|31)|94(14|21|30|40|47|55|56|[6-9])|9542)|53(0901|10(28|30)|1195|23(4[4-7])|2459|25(09|34|54|56)|3801|41(02|05|11)|50(29|66)|5324|61(07|15)|71(06|12)|8011)|54(2848|5157|9538|98(5[89]))|55(39(79|93)|42(05|60)|4965|7008|88(67|82)|89(29|4[23])|9618|98(09|10))|56(0408|12(0[2-6]|4[134]|5[04678]))|58(17(0[0-7]|15|2[14]|3[16789]|4[0-9]|5[016]|6[269]|7[3789]|8[0-7]|9[017])|55(0[2-5]|7[7-9]|8[0-2])))")); map }); let mut no_of_supported_card_networks = 0; let card_number_str = self.get_card_no(); for (_, regex) in CARD_NETWORK_REGEX.iter() { let card_regex = match regex.as_ref() { Ok(regex) => Ok(regex), Err(_) => Err(report!(ValidationError::InvalidValue { message: "Invalid regex expression".into(), })), }?; if card_regex.is_match(&card_number_str) { no_of_supported_card_networks += 1; if no_of_supported_card_networks > 1 { break; } } } Ok(no_of_supported_card_networks > 1) }
{ "chunk": null, "crate": "ucs_cards", "enum_name": null, "file_size": null, "for_type": null, "function_name": "is_cobadged_card", "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_cards_-4529903721819221078
clm
function
// connector-service/backend/cards/src/validate.rs fn from_str(network_token: &str) -> Result<Self, Self::Err> { // Valid test cards for threedsecureio let valid_test_network_tokens = [ "4000100511112003", "6000100611111203", "3000100811111072", "9000100111111111", ]; let network_token = network_token.split_whitespace().collect::<String>(); let is_network_token_valid = sanitize_card_number(&network_token)?; if valid_test_network_tokens.contains(&network_token.as_str()) || is_network_token_valid { Ok(Self(StrongSecret::new(network_token))) } else { Err(CardNumberValidationErr("network token invalid")) } }
{ "chunk": null, "crate": "ucs_cards", "enum_name": null, "file_size": null, "for_type": null, "function_name": "from_str", "is_async": false, "is_pub": false, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_fn_ucs_cards_4090719509907874803
clm
function
// connector-service/backend/cards/src/validate.rs pub fn sanitize_card_number(card_number: &str) -> Result<bool, CardNumberValidationErr> { let is_card_number_valid = Ok(card_number) .and_then(validate_card_number_chars) .and_then(validate_card_number_length) .map(|number| luhn(&number))?; Ok(is_card_number_valid) }
{ "chunk": null, "crate": "ucs_cards", "enum_name": null, "file_size": null, "for_type": null, "function_name": "sanitize_card_number", "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_cards_5770649892114254562
clm
function
// connector-service/backend/cards/src/validate.rs pub fn validate_card_number_chars(number: &str) -> Result<Vec<u8>, CardNumberValidationErr> { let data = number.chars().try_fold( Vec::with_capacity(MAX_CARD_NUMBER_LENGTH), |mut data, character| { data.push( #[allow(clippy::expect_used)] character .to_digit(10) .ok_or(CardNumberValidationErr( "invalid character found in card number", ))? .try_into() .expect("error while converting a single character to u8"), // safety, a single character will never be greater `u8` ); Ok::<Vec<u8>, CardNumberValidationErr>(data) }, )?; Ok(data) }
{ "chunk": null, "crate": "ucs_cards", "enum_name": null, "file_size": null, "for_type": null, "function_name": "validate_card_number_chars", "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_cards_-4684749551525406764
clm
function
// connector-service/backend/cards/src/validate.rs pub fn validate_card_number_length(number: Vec<u8>) -> Result<Vec<u8>, CardNumberValidationErr> { if number.len() >= MIN_CARD_NUMBER_LENGTH && number.len() <= MAX_CARD_NUMBER_LENGTH { Ok(number) } else { Err(CardNumberValidationErr("invalid card number length")) } }
{ "chunk": null, "crate": "ucs_cards", "enum_name": null, "file_size": null, "for_type": null, "function_name": "validate_card_number_length", "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_cards_1392407872263454969
clm
function
// connector-service/backend/cards/src/validate.rs pub fn luhn(number: &[u8]) -> bool { number .iter() .rev() .enumerate() .map(|(idx, element)| { ((*element * 2) / 10 + (*element * 2) % 10) * ((idx as u8) % 2) + (*element) * (((idx + 1) as u8) % 2) }) .sum::<u8>() % 10 == 0 }
{ "chunk": null, "crate": "ucs_cards", "enum_name": null, "file_size": null, "for_type": null, "function_name": "luhn", "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_cards_-8969722543016351626
clm
function
// connector-service/backend/cards/src/validate.rs fn try_from(year: u16) -> Result<Self, Self::Error> { let curr_year = u16::try_from(date_time::now().year()).map_err(|_| { report!(ValidationError::InvalidValue { message: "invalid year".to_string() }) })?; if year >= curr_year { Ok(Self(StrongSecret::<u16>::new(year))) } else { Err(report!(ValidationError::InvalidValue { message: "invalid card expiration year".to_string() })) } }
{ "chunk": null, "crate": "ucs_cards", "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_cards_-1390363599573439946
clm
function
// connector-service/backend/cards/src/validate.rs fn deref(&self) -> &StrongSecret<String, CardNumberStrategy> { &self.0 }
{ "chunk": null, "crate": "ucs_cards", "enum_name": null, "file_size": null, "for_type": null, "function_name": "deref", "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_cards_-6403422563303116448
clm
function
// connector-service/backend/cards/src/validate.rs fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where D: serde::Deserializer<'de>, { let year = u16::deserialize(deserializer)?; year.try_into().map_err(de::Error::custom) }
{ "chunk": null, "crate": "ucs_cards", "enum_name": null, "file_size": null, "for_type": null, "function_name": "deserialize", "is_async": false, "is_pub": false, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_fn_ucs_cards_-4070326131862386617
clm
function
// connector-service/backend/cards/src/validate.rs fn fmt(val: &T, f: &mut fmt::Formatter<'_>) -> fmt::Result { let val_str: &str = val.as_ref(); if val_str.len() < 15 || val_str.len() > 19 { return WithType::fmt(val, f); } if let Some(value) = val_str.get(..6) { write!(f, "{}{}", value, "*".repeat(val_str.len() - 6)) } else { WithType::fmt(val, f) } }
{ "chunk": null, "crate": "ucs_cards", "enum_name": null, "file_size": null, "for_type": null, "function_name": "fmt", "is_async": false, "is_pub": false, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_fn_ucs_cards_2724232053419439141
clm
function
// connector-service/backend/cards/src/validate.rs fn encode_raw(&self, buf: &mut impl bytes::BufMut) { if !self.0.peek().is_empty() { prost::encoding::string::encode(1, self.0.peek(), buf); } }
{ "chunk": null, "crate": "ucs_cards", "enum_name": null, "file_size": null, "for_type": null, "function_name": "encode_raw", "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_cards_3787932175087580209
clm
function
// connector-service/backend/cards/src/validate.rs fn merge_field( &mut self, tag: u32, wire_type: prost::encoding::WireType, buf: &mut impl bytes::Buf, ctx: prost::encoding::DecodeContext, ) -> Result<(), prost::DecodeError> { if tag == 1 { let mut temp_string = String::new(); prost::encoding::string::merge(wire_type, &mut temp_string, buf, ctx)?; *self = CardNumber(StrongSecret::new(temp_string)); Ok(()) } else { prost::encoding::skip_field(wire_type, tag, buf, ctx) } }
{ "chunk": null, "crate": "ucs_cards", "enum_name": null, "file_size": null, "for_type": null, "function_name": "merge_field", "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_cards_-3390198332579866782
clm
function
// connector-service/backend/cards/src/validate.rs fn encoded_len(&self) -> usize { if !self.0.peek().is_empty() { prost::encoding::string::encoded_len(1, self.0.peek()) } else { 0 } }
{ "chunk": null, "crate": "ucs_cards", "enum_name": null, "file_size": null, "for_type": null, "function_name": "encoded_len", "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_cards_6370662991721619193
clm
function
// connector-service/backend/cards/src/validate.rs fn clear(&mut self) { *self = CardNumber::default(); }
{ "chunk": null, "crate": "ucs_cards", "enum_name": null, "file_size": null, "for_type": null, "function_name": "clear", "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_cards_6710905094482211648
clm
function
// connector-service/backend/cards/src/validate.rs fn valid_card_number() { let s = "371449635398431"; assert_eq!( CardNumber::from_str(s).unwrap(), CardNumber(StrongSecret::from_str(s).unwrap()) ); }
{ "chunk": null, "crate": "ucs_cards", "enum_name": null, "file_size": null, "for_type": null, "function_name": "valid_card_number", "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_cards_6534007621610457218
clm
function
// connector-service/backend/cards/src/validate.rs fn invalid_card_number_length() { let s = "371446"; assert_eq!( CardNumber::from_str(s).unwrap_err().to_string(), "invalid card number length".to_string() ); }
{ "chunk": null, "crate": "ucs_cards", "enum_name": null, "file_size": null, "for_type": null, "function_name": "invalid_card_number_length", "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_cards_4482378709883041225
clm
function
// connector-service/backend/cards/src/validate.rs fn card_number_with_non_digit_character() { let s = "371446431 A"; assert_eq!( CardNumber::from_str(s).unwrap_err().to_string(), "invalid character found in card number".to_string() ); }
{ "chunk": null, "crate": "ucs_cards", "enum_name": null, "file_size": null, "for_type": null, "function_name": "card_number_with_non_digit_character", "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_cards_5522451283480828457
clm
function
// connector-service/backend/cards/src/validate.rs fn invalid_card_number() { let s = "371446431"; assert_eq!( CardNumber::from_str(s).unwrap_err().to_string(), "card number invalid".to_string() ); }
{ "chunk": null, "crate": "ucs_cards", "enum_name": null, "file_size": null, "for_type": null, "function_name": "invalid_card_number", "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_cards_7523401176785001644
clm
function
// connector-service/backend/cards/src/validate.rs fn card_number_no_whitespace() { let s = "3714 4963 5398 431"; assert_eq!( CardNumber::from_str(s).unwrap().to_string(), "371449*********" ); }
{ "chunk": null, "crate": "ucs_cards", "enum_name": null, "file_size": null, "for_type": null, "function_name": "card_number_no_whitespace", "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_cards_-2635707241033700750
clm
function
// connector-service/backend/cards/src/validate.rs fn test_valid_card_number_masking() { let secret: Secret<String, CardNumberStrategy> = Secret::new("1234567890987654".to_string()); assert_eq!("123456**********", format!("{secret:?}")); }
{ "chunk": null, "crate": "ucs_cards", "enum_name": null, "file_size": null, "for_type": null, "function_name": "test_valid_card_number_masking", "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_cards_6345511159147623403
clm
function
// connector-service/backend/cards/src/validate.rs fn test_invalid_card_number_masking() { let secret: Secret<String, CardNumberStrategy> = Secret::new("9123456789".to_string()); assert_eq!("*** alloc::string::String ***", format!("{secret:?}")); }
{ "chunk": null, "crate": "ucs_cards", "enum_name": null, "file_size": null, "for_type": null, "function_name": "test_invalid_card_number_masking", "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_cards_2247840550772808069
clm
function
// connector-service/backend/cards/src/validate.rs fn test_valid_card_number_strong_secret_masking() { let card_number = CardNumber::from_str("3714 4963 5398 431").unwrap(); let secret = &(*card_number); assert_eq!("371449*********", format!("{secret:?}")); }
{ "chunk": null, "crate": "ucs_cards", "enum_name": null, "file_size": null, "for_type": null, "function_name": "test_valid_card_number_strong_secret_masking", "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_cards_223984684510692136
clm
function
// connector-service/backend/cards/src/validate.rs fn test_valid_card_number_deserialization() { let card_number = serde_json::from_str::<CardNumber>(r#""3714 4963 5398 431""#).unwrap(); let secret = card_number.to_string(); assert_eq!(r#""371449*********""#, format!("{secret:?}")); }
{ "chunk": null, "crate": "ucs_cards", "enum_name": null, "file_size": null, "for_type": null, "function_name": "test_valid_card_number_deserialization", "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_cards_4400803078422626555
clm
function
// connector-service/backend/cards/src/validate.rs fn test_invalid_card_number_deserialization() { let card_number = serde_json::from_str::<CardNumber>(r#""1234 5678""#); let error_msg = card_number.unwrap_err().to_string(); assert_eq!(error_msg, "card number invalid".to_string()); }
{ "chunk": null, "crate": "ucs_cards", "enum_name": null, "file_size": null, "for_type": null, "function_name": "test_invalid_card_number_deserialization", "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_cards_5706602275361713339
clm
function
// connector-service/backend/cards/src/validate.rs pub fn two_digits(&self) -> String { format!("{:02}", self.0.peek()) }
{ "chunk": null, "crate": "ucs_cards", "enum_name": null, "file_size": null, "for_type": null, "function_name": "two_digits", "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_cards_347107886954716264
clm
function
// connector-service/backend/cards/src/validate.rs pub fn get_year(&self) -> u16 { *self.0.peek() }
{ "chunk": null, "crate": "ucs_cards", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_year", "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_external-services_8449754451265106065
clm
function
// connector-service/backend/external-services/src/shared_metrics.rs pub fn new(inner: S) -> Self { Self { inner } }
{ "chunk": null, "crate": "external-services", "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_external-services_-3442421208888960543
clm
function
// connector-service/backend/external-services/src/shared_metrics.rs fn layer(&self, service: S) -> Self::Service { GrpcMetricsService::new(service) }
{ "chunk": null, "crate": "external-services", "enum_name": null, "file_size": null, "for_type": null, "function_name": "layer", "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_external-services_5271605082232485778
clm
function
// connector-service/backend/external-services/src/shared_metrics.rs fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> { self.inner.poll_ready(cx) }
{ "chunk": null, "crate": "external-services", "enum_name": null, "file_size": null, "for_type": null, "function_name": "poll_ready", "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_external-services_-6602466564389153354
clm
function
// connector-service/backend/external-services/src/shared_metrics.rs fn call(&mut self, mut req: hyper::Request<B>) -> Self::Future { let clone = self.inner.clone(); let mut inner = std::mem::replace(&mut self.inner, clone); let start_time = Instant::now(); // Extract method name from gRPC path let method_name = extract_grpc_method_name(&req); let service_name = extract_grpc_service_name(&req); // Extract connector from request headers/metadata let connector = extract_connector_from_request(&req); // Increment total requests counter GRPC_SERVER_REQUESTS_TOTAL .with_label_values(&[&method_name, &service_name, &connector]) .inc(); req.extensions_mut().insert(service_name.clone()); Box::pin(async move { let result = inner.call(req).await; // Record metrics based on response match &result { Ok(response) => { // Check gRPC status from response if is_grpc_success(response) { GRPC_SERVER_REQUESTS_SUCCESSFUL .with_label_values(&[&method_name, &service_name, &connector]) .inc(); } } Err(_) => { // Network/transport level error } } // Record latency let duration = start_time.elapsed().as_secs_f64(); GRPC_SERVER_REQUEST_LATENCY .with_label_values(&[&method_name, &service_name, &connector]) .observe(duration); result }) }
{ "chunk": null, "crate": "external-services", "enum_name": null, "file_size": null, "for_type": null, "function_name": "call", "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_external-services_503263431121531102
clm
function
// connector-service/backend/external-services/src/shared_metrics.rs fn extract_grpc_method_name<B>(req: &hyper::Request<B>) -> String { let path = req.uri().path(); if let Some(method) = path.rfind('/') { let method_name = &path[method + 1..]; if !method_name.is_empty() { return method_name.to_string(); } } "unknown_method".to_string() }
{ "chunk": null, "crate": "external-services", "enum_name": null, "file_size": null, "for_type": null, "function_name": "extract_grpc_method_name", "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_external-services_8088297729169909433
clm
function
// connector-service/backend/external-services/src/shared_metrics.rs fn extract_grpc_service_name<B>(req: &hyper::Request<B>) -> String { let path = req.uri().path(); if let Some(pos) = path.rfind('/') { let full_service = &path[1..pos]; if let Some(service_name) = full_service.rsplit('.').next() { return service_name.to_string(); } } "unknown_service".to_string() }
{ "chunk": null, "crate": "external-services", "enum_name": null, "file_size": null, "for_type": null, "function_name": "extract_grpc_service_name", "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_external-services_1980720506448655783
clm
function
// connector-service/backend/external-services/src/shared_metrics.rs fn extract_connector_from_request<B>(req: &hyper::Request<B>) -> String { if let Some(connector) = req.headers().get("x-connector") { if let Ok(connector_str) = connector.to_str() { return connector_str.to_string(); } } "unknown".to_string() }
{ "chunk": null, "crate": "external-services", "enum_name": null, "file_size": null, "for_type": null, "function_name": "extract_connector_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_external-services_-5623872648773061171
clm
function
// connector-service/backend/external-services/src/shared_metrics.rs fn is_grpc_success<B>(response: &hyper::Response<B>) -> bool { // gRPC success is based on grpc-status header, not HTTP status if let Some(grpc_status) = response.headers().get("grpc-status") { if let Ok(status_str) = grpc_status.to_str() { if let Ok(status_code) = status_str.parse::<i32>() { if status_code == 0 { return true; // gRPC OK } else { return false; } } else { return false; } } else { return false; } } true }
{ "chunk": null, "crate": "external-services", "enum_name": null, "file_size": null, "for_type": null, "function_name": "is_grpc_success", "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_external-services_7238490995989900839
clm
function
// connector-service/backend/external-services/src/shared_metrics.rs pub async fn metrics_handler() -> error_stack::Result<String, MetricsError> { let mut buffer = Vec::new(); let encoder = TextEncoder::new(); let metric_families = prometheus::gather(); encoder .encode(&metric_families, &mut buffer) .change_context(MetricsError::EncodingError)?; String::from_utf8(buffer).change_context(MetricsError::Utf8Error) }
{ "chunk": null, "crate": "external-services", "enum_name": null, "file_size": null, "for_type": null, "function_name": "metrics_handler", "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_external-services_-8594073624758035393
clm
function
// connector-service/backend/external-services/src/service.rs fn get_connector_request_reference_id(&self) -> &str { &self.connector_request_reference_id }
{ "chunk": null, "crate": "external-services", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_connector_request_reference_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_external-services_2267813616633871197
clm
function
// connector-service/backend/external-services/src/service.rs fn get_vault_headers(&self) -> Option<&HashMap<String, Secret<String>>> { // DisputeFlowData might not have vault_headers, so return None None }
{ "chunk": null, "crate": "external-services", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_vault_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_external-services_4172114858272677039
clm
function
// connector-service/backend/external-services/src/service.rs fn to_http_method(&self) -> HttpMethod { match self { Self::Get => HttpMethod::GET, Self::Post => HttpMethod::POST, Self::Put => HttpMethod::PUT, Self::Patch => HttpMethod::PATCH, Self::Delete => HttpMethod::DELETE, } }
{ "chunk": null, "crate": "external-services", "enum_name": null, "file_size": null, "for_type": null, "function_name": "to_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_external-services_-5961039244651565098
clm
function
// connector-service/backend/external-services/src/service.rs pub async fn execute_connector_processing_step<T, F, ResourceCommonData, Req, Resp>( proxy: &Proxy, connector: BoxedConnectorIntegrationV2<'static, F, ResourceCommonData, Req, Resp>, router_data: RouterDataV2<F, ResourceCommonData, Req, Resp>, all_keys_required: Option<bool>, event_params: EventProcessingParams<'_>, token_data: Option<TokenData>, call_connector_action: common_enums::CallConnectorAction, ) -> CustomResult<RouterDataV2<F, ResourceCommonData, Req, Resp>, ConnectorError> where F: Clone + 'static, T: FlowIntegrity, Req: Clone + 'static + std::fmt::Debug + GetIntegrityObject<T> + CheckIntegrity<Req, T>, Resp: Clone + 'static + std::fmt::Debug, ResourceCommonData: Clone + 'static + RawConnectorRequestResponse + ConnectorResponseHeaders + ConnectorRequestReference + AdditionalHeaders, { let start = tokio::time::Instant::now(); let result = match call_connector_action { common_enums::CallConnectorAction::HandleResponse(res) => { let body = Response { headers: None, response: res.into(), status_code: 200, }; let status_code = body.status_code; tracing::Span::current().record("status_code", tracing::field::display(status_code)); if let Ok(response) = parse_json_with_bom_handling(&body.response) { tracing::Span::current().record( "response.body", tracing::field::display(response.masked_serialize().unwrap_or( json!({ "error": "failed to mask serialize connector response"}), )), ); } // Set raw_connector_response BEFORE calling the transformer let mut updated_router_data = router_data.clone(); if all_keys_required.unwrap_or(true) { let raw_response_string = strip_bom_and_convert_to_string(&body.response); updated_router_data .resource_common_data .set_raw_connector_response(raw_response_string.map(Into::into)); } let handle_response_result = connector.handle_response_v2(&updated_router_data, None, body.clone()); let response = match handle_response_result { Ok(data) => { tracing::info!("Transformer completed successfully"); Ok(data) } Err(err) => Err(err), }?; Ok(response) } common_enums::CallConnectorAction::Trigger => { let mut connector_request = connector.build_request_v2(&router_data.clone())?; let mut updated_router_data = router_data.clone(); updated_router_data = match &connector_request { Some(request) => { updated_router_data .resource_common_data .set_raw_connector_request(Some( extract_raw_connector_request(request).into(), )); updated_router_data } None => updated_router_data, }; connector_request = connector_request.map(|mut req| { if event_params.shadow_mode { req.add_header( consts::X_REQUEST_ID, Maskable::Masked(Secret::new(event_params.request_id.to_string())), ); req.add_header( consts::X_SOURCE_NAME, Maskable::Masked(Secret::new(consts::X_CONNECTOR_SERVICE.to_string())), ); req.add_header( consts::X_FLOW_NAME, Maskable::Masked(Secret::new(event_params.flow_name.to_string())), ); req.add_header( consts::X_CONNECTOR_NAME, Maskable::Masked(Secret::new(event_params.connector_name.to_string())), ); } req }); let headers = connector_request .as_ref() .map(|connector_request| connector_request.headers.clone()) .unwrap_or_default(); tracing::info!(?headers, "headers of connector request"); let event_headers: HashMap<String, String> = headers .iter() .map(|(k, v)| (k.clone(), format!("{v:?}"))) .collect(); let masked_headers = headers .iter() .fold(serde_json::Map::new(), |mut acc, (k, v)| { let value = match v { Maskable::Masked(_) => { serde_json::Value::String("*** alloc::string::String ***".to_string()) } Maskable::Normal(iv) => serde_json::Value::String(iv.to_owned()), }; acc.insert(k.clone(), value); acc }); let headers = serde_json::Value::Object(masked_headers); tracing::Span::current().record("request.headers", tracing::field::display(&headers)); let req = connector_request.as_ref().map(|connector_request| { let masked_request = match connector_request.body.as_ref() { Some(request) => match request { RequestContent::Json(i) | RequestContent::FormUrlEncoded(i) | RequestContent::Xml(i) => (**i).masked_serialize().unwrap_or( json!({ "error": "failed to mask serialize connector request"}), ), RequestContent::FormData(_) => json!({"request_type": "FORM_DATA"}), RequestContent::RawBytes(_) => json!({"request_type": "RAW_BYTES"}), }, None => serde_json::Value::Null, }; tracing::info!(request=?masked_request, "request of connector"); tracing::Span::current() .record("request.body", tracing::field::display(&masked_request)); masked_request }); match connector_request { Some(request) => { let url = request.url.clone(); let method = request.method; metrics::EXTERNAL_SERVICE_TOTAL_API_CALLS .with_label_values(&[ &method.to_string(), event_params.service_name, event_params.connector_name, ]) .inc(); let external_service_start_latency = tokio::time::Instant::now(); tracing::Span::current().record("request.url", tracing::field::display(&url)); tracing::Span::current() .record("request.method", tracing::field::display(method)); let request_id = event_params.request_id.to_string(); let response = if let Some(token_data) = token_data { tracing::debug!( "Creating injector request with token data using unified API" ); // Extract template and combine headers let template = request .body .as_ref() .ok_or(ConnectorError::RequestEncodingFailed)? .get_inner_value() .expose() .to_string(); let headers = request .headers .iter() .map(|(key, value)| { ( key.clone(), Secret::new(match value { Maskable::Normal(val) => val.clone(), Maskable::Masked(val) => val.clone().expose().to_string(), }), ) }) .chain( updated_router_data .resource_common_data .get_vault_headers() .map(|headers| { headers.iter().map(|(k, v)| (k.clone(), v.clone())) }) .into_iter() .flatten(), ) .collect(); // Create injector request let injector_request = injector::InjectorRequest::new( request.url.clone(), request.method.to_http_method(), template, token_data, Some(headers), proxy .https_url .as_ref() .or(proxy.http_url.as_ref()) .map(|url| Secret::new(url.clone())), None, None, None, ); // New injector handles HTTP request internally and returns enhanced response let injector_response = injector_core(injector_request) .await .change_context(ConnectorError::RequestEncodingFailed)?; // Convert injector response to connector service Response format let response_bytes = serde_json::to_vec(&injector_response.response) .map_err(|_| ConnectorError::ResponseHandlingFailed)?; // Convert headers from HashMap<String, String> to reqwest::HeaderMap if present let headers = injector_response.headers.map(|h| { let mut header_map = reqwest::header::HeaderMap::new(); for (key, value) in h { if let (Ok(header_name), Ok(header_value)) = ( reqwest::header::HeaderName::from_bytes(key.as_bytes()), reqwest::header::HeaderValue::from_str(&value), ) { header_map.insert(header_name, header_value); } } header_map }); Ok(Ok(Response { headers, response: response_bytes.into(), status_code: injector_response.status_code, // Use actual status code from connector })) } else { call_connector_api(proxy, request, "execute_connector_processing_step") .await .change_context(ConnectorError::RequestEncodingFailed) .inspect_err(|err| { info_log( "NETWORK_ERROR", &json!(format!( "Failed getting response from connector. Error: {:?}", err )), ); }) }; let external_service_elapsed = external_service_start_latency.elapsed(); metrics::EXTERNAL_SERVICE_API_CALLS_LATENCY .with_label_values(&[ &method.to_string(), event_params.service_name, event_params.connector_name, ]) .observe(external_service_elapsed.as_secs_f64()); tracing::info!(?response, "response from connector"); // Extract status code BEFORE creating event - one liner let status_code = response.as_ref().ok().map(|result| match result { Ok(body) | Err(body) => i32::from(body.status_code), }); // Construct masked request for event let masked_request_data = req.as_ref().and_then(|r| { MaskedSerdeValue::from_masked_optional(r, "connector_request") }); let latency = u64::try_from(external_service_elapsed.as_millis()).unwrap_or(u64::MAX); // Create single event (response_data will be set by connector) let mut event = Event { request_id: request_id.to_string(), timestamp: chrono::Utc::now().timestamp().into(), flow_type: event_params.flow_name, connector: event_params.connector_name.to_string(), url: Some(url.clone()), stage: EventStage::ConnectorCall, latency_ms: Some(latency), status_code, request_data: masked_request_data, response_data: None, // Will be set by connector via set_response_body headers: event_headers, additional_fields: HashMap::new(), lineage_ids: event_params.lineage_ids.to_owned(), }; event.add_reference_id(event_params.reference_id.as_deref()); let result = match response { Ok(body) => { let response = match body { Ok(body) => { let status_code = body.status_code; tracing::Span::current().record( "status_code", tracing::field::display(status_code), ); let is_source_verified = connector.verify(&updated_router_data, interfaces::verification::ConnectorSourceVerificationSecrets::AuthHeaders(updated_router_data.connector_auth_type.clone()), &body.response)?; if !is_source_verified { return Err(error_stack::report!( ConnectorError::SourceVerificationFailed )); } if all_keys_required.unwrap_or(true) { let raw_response_string = strip_bom_and_convert_to_string(&body.response); updated_router_data .resource_common_data .set_raw_connector_response( raw_response_string.map(Into::into), ); // Set response headers if available updated_router_data .resource_common_data .set_connector_response_headers(body.headers.clone()); } let handle_response_result = connector.handle_response_v2( &updated_router_data, Some(&mut event), body.clone(), ); // Log response body and headers using properly masked data from connector if let Some(response_data) = &event.response_data { tracing::Span::current().record( "response.body", tracing::field::display(response_data.inner()), ); } // Log response headers from event (already masked) tracing::Span::current().record( "response.headers", tracing::field::debug(&event.headers), ); match handle_response_result { Ok(data) => { tracing::info!("Transformer completed successfully"); Ok(data) } Err(err) => Err(err), }? } Err(body) => { metrics::EXTERNAL_SERVICE_API_CALLS_ERRORS .with_label_values(&[ &method.to_string(), event_params.service_name, event_params.connector_name, body.status_code.to_string().as_str(), ]) .inc(); if all_keys_required.unwrap_or(true) { let raw_response_string = strip_bom_and_convert_to_string(&body.response); updated_router_data .resource_common_data .set_raw_connector_response( raw_response_string.map(Into::into), ); updated_router_data .resource_common_data .set_connector_response_headers(body.headers.clone()); } let error = match body.status_code { 500..=511 => connector.get_5xx_error_response( body.clone(), Some(&mut event), )?, _ => connector.get_error_response_v2( body.clone(), Some(&mut event), )?, }; tracing::Span::current().record( "response.error_message", tracing::field::display(&error.message), ); tracing::Span::current().record( "response.status_code", tracing::field::display(error.status_code), ); updated_router_data.response = Err(error); updated_router_data } }; Ok(response) } Err(err) => { tracing::Span::current().record("url", tracing::field::display(url)); Err(err.change_context(ConnectorError::ProcessingStepFailed(None))) } }; emit_event_with_config(event, event_params.event_config); result } None => Ok(router_data), } } }; let result_with_integrity_check = match result { Ok(data) => { data.request .check_integrity(&data.request.clone(), None) .map_err(|err| ConnectorError::IntegrityCheckFailed { field_names: err.field_names, connector_transaction_id: err.connector_transaction_id, })?; Ok(data) } Err(err) => Err(err), }; let elapsed = start.elapsed().as_millis(); tracing::Span::current().record("latency", elapsed); tracing::info!(tag = ?Tag::OutgoingApi, log_type = "api", "Outgoing Request completed"); result_with_integrity_check }
{ "chunk": null, "crate": "external-services", "enum_name": null, "file_size": null, "for_type": null, "function_name": "execute_connector_processing_step", "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_external-services_-2260444341298051893
clm
function
// connector-service/backend/external-services/src/service.rs pub async fn call_connector_api( proxy: &Proxy, request: Request, _flow_name: &str, ) -> CustomResult<Result<Response, Response>, ApiClientError> { let url = reqwest::Url::parse(&request.url).change_context(ApiClientError::UrlEncodingFailed)?; let should_bypass_proxy = proxy.bypass_proxy_urls.contains(&url.to_string()); let client = create_client( proxy, should_bypass_proxy, request.certificate, request.certificate_key, )?; let headers = request.headers.construct_header_map()?; // Process and log the request body based on content type let request = { match request.method { Method::Get => client.get(url), Method::Post => { let client = client.post(url); match request.body { Some(RequestContent::Json(payload)) => client.json(&payload), Some(RequestContent::FormUrlEncoded(payload)) => client.form(&payload), Some(RequestContent::Xml(payload)) => { // For XML content, we need to extract the XML string properly // The payload implements a custom Serialize that generates XML content let body = serde_json::to_string(&payload) .change_context(ApiClientError::UrlEncodingFailed)?; // Properly deserialize the JSON string to extract clean XML let xml_body = if body.starts_with('"') && body.ends_with('"') { // This is a JSON-encoded string, deserialize it properly serde_json::from_str::<String>(&body) .change_context(ApiClientError::UrlEncodingFailed)? } else { // This is already the raw body content body }; client.body(xml_body).header("Content-Type", "text/xml") } Some(RequestContent::FormData(form)) => client.multipart(form), _ => client, } } Method::Put => { let client = client.put(url); match request.body { Some(RequestContent::Json(payload)) => client.json(&payload), Some(RequestContent::FormUrlEncoded(payload)) => client.form(&payload), Some(RequestContent::Xml(payload)) => { let body = serde_json::to_string(&payload) .change_context(ApiClientError::UrlEncodingFailed)?; let xml_body = if body.starts_with('"') && body.ends_with('"') { serde_json::from_str::<String>(&body) .change_context(ApiClientError::UrlEncodingFailed)? } else { body }; client.body(xml_body).header("Content-Type", "text/xml") } Some(RequestContent::FormData(form)) => client.multipart(form), _ => client, } } Method::Patch => { let client = client.patch(url); match request.body { Some(RequestContent::Json(payload)) => client.json(&payload), Some(RequestContent::FormUrlEncoded(payload)) => client.form(&payload), Some(RequestContent::Xml(payload)) => { let body = serde_json::to_string(&payload) .change_context(ApiClientError::UrlEncodingFailed)?; let xml_body = if body.starts_with('"') && body.ends_with('"') { serde_json::from_str::<String>(&body) .change_context(ApiClientError::UrlEncodingFailed)? } else { body }; client.body(xml_body).header("Content-Type", "text/xml") } Some(RequestContent::FormData(form)) => client.multipart(form), _ => client, } } Method::Delete => { let client = client.delete(url); match request.body { Some(RequestContent::Json(payload)) => client.json(&payload), Some(RequestContent::FormUrlEncoded(payload)) => client.form(&payload), Some(RequestContent::Xml(payload)) => { let body = serde_json::to_string(&payload) .change_context(ApiClientError::UrlEncodingFailed)?; let xml_body = if body.starts_with('"') && body.ends_with('"') { serde_json::from_str::<String>(&body) .change_context(ApiClientError::UrlEncodingFailed)? } else { body }; client.body(xml_body).header("Content-Type", "text/xml") } Some(RequestContent::FormData(form)) => client.multipart(form), _ => client, } } } .add_headers(headers) }; let send_request = async { request.send().await.map_err(|error| { let api_error = match error { error if error.is_timeout() => ApiClientError::RequestTimeoutReceived, _ => ApiClientError::RequestNotSent(error.to_string()), }; info_log( "REQUEST_FAILURE", &json!(format!("Unable to send request to connector.",)), ); report!(api_error) }) }; let response = send_request.await; handle_response(response).await }
{ "chunk": null, "crate": "external-services", "enum_name": null, "file_size": null, "for_type": null, "function_name": "call_connector_api", "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_external-services_-7005820752609541274
clm
function
// connector-service/backend/external-services/src/service.rs pub fn create_client( proxy_config: &Proxy, should_bypass_proxy: bool, _client_certificate: Option<Secret<String>>, _client_certificate_key: Option<Secret<String>>, ) -> CustomResult<Client, ApiClientError> { get_base_client(proxy_config, should_bypass_proxy) // match (client_certificate, client_certificate_key) { // (Some(encoded_certificate), Some(encoded_certificate_key)) => { // let client_builder = get_client_builder(proxy_config, should_bypass_proxy)?; // let identity = create_identity_from_certificate_and_key( // encoded_certificate.clone(), // encoded_certificate_key, // )?; // let certificate_list = create_certificate(encoded_certificate)?; // let client_builder = certificate_list // .into_iter() // .fold(client_builder, |client_builder, certificate| { // client_builder.add_root_certificate(certificate) // }); // client_builder // .identity(identity) // .use_rustls_tls() // .build() // .change_context(ApiClientError::ClientConstructionFailed) // .inspect_err(|err| { // info_log( // "ERROR", // &json!(format!( // "Failed to construct client with certificate and certificate key. Error: {:?}", // err // )), // ); // }) // } // _ => , // } }
{ "chunk": null, "crate": "external-services", "enum_name": null, "file_size": null, "for_type": null, "function_name": "create_client", "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_external-services_-8424277478848662049
clm
function
// connector-service/backend/external-services/src/service.rs fn get_base_client( proxy_config: &Proxy, should_bypass_proxy: bool, ) -> CustomResult<Client, ApiClientError> { Ok(if should_bypass_proxy || (proxy_config.http_url.is_none() && proxy_config.https_url.is_none()) { &NON_PROXIED_CLIENT } else { &PROXIED_CLIENT } .get_or_try_init(|| { get_client_builder(proxy_config, should_bypass_proxy)? .build() .change_context(ApiClientError::ClientConstructionFailed) .inspect_err(|err| { info_log( "ERROR", &json!(format!("Failed to construct base client. Error: {:?}", err)), ); }) })? .clone()) }
{ "chunk": null, "crate": "external-services", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_base_client", "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_external-services_-4767538265721295944
clm
function
// connector-service/backend/external-services/src/service.rs fn load_custom_ca_certificate_from_content( mut client_builder: reqwest::ClientBuilder, cert_content: &str, ) -> CustomResult<reqwest::ClientBuilder, ApiClientError> { let certificate = reqwest::Certificate::from_pem(cert_content.as_bytes()) .change_context(ApiClientError::InvalidProxyConfiguration) .attach_printable("Failed to parse certificate PEM from provided content")?; client_builder = client_builder.add_root_certificate(certificate); Ok(client_builder) }
{ "chunk": null, "crate": "external-services", "enum_name": null, "file_size": null, "for_type": null, "function_name": "load_custom_ca_certificate_from_content", "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_external-services_-7191740770390109649
clm
function
// connector-service/backend/external-services/src/service.rs fn get_client_builder( proxy_config: &Proxy, should_bypass_proxy: bool, ) -> CustomResult<reqwest::ClientBuilder, ApiClientError> { let mut client_builder = Client::builder() .redirect(reqwest::redirect::Policy::none()) .pool_idle_timeout(Duration::from_secs( proxy_config .idle_pool_connection_timeout .unwrap_or_default(), )); if should_bypass_proxy { return Ok(client_builder); } // Attach MITM certificate if enabled if proxy_config.mitm_proxy_enabled { if let Some(cert_content) = &proxy_config.mitm_ca_cert { if !cert_content.trim().is_empty() { client_builder = load_custom_ca_certificate_from_content(client_builder, cert_content.trim())?; } } } // Proxy all HTTPS traffic through the configured HTTPS proxy if let Some(url) = proxy_config.https_url.as_ref() { client_builder = client_builder.proxy( reqwest::Proxy::https(url) .change_context(ApiClientError::InvalidProxyConfiguration) .inspect_err(|err| { info_log( "PROXY_ERROR", &json!(format!("HTTPS proxy configuration error. Error: {:?}", err)), ); })?, ); } // Proxy all HTTP traffic through the configured HTTP proxy if let Some(url) = proxy_config.http_url.as_ref() { client_builder = client_builder.proxy( reqwest::Proxy::http(url) .change_context(ApiClientError::InvalidProxyConfiguration) .inspect_err(|err| { info_log( "PROXY_ERROR", &json!(format!("HTTP proxy configuration error. Error: {:?}", err)), ); })?, ); } Ok(client_builder) }
{ "chunk": null, "crate": "external-services", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_client_builder", "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_external-services_-7860840419646094093
clm
function
// connector-service/backend/external-services/src/service.rs async fn handle_response( response: CustomResult<reqwest::Response, ApiClientError>, ) -> CustomResult<Result<Response, Response>, ApiClientError> { response .async_map(|resp| async { let status_code = resp.status().as_u16(); let headers = Some(resp.headers().to_owned()); match status_code { 200..=202 | 302 | 204 => { let response = resp .bytes() .await .change_context(ApiClientError::ResponseDecodingFailed)?; Ok(Ok(Response { headers, response, status_code, })) } 500..=599 => { let bytes = resp.bytes().await.map_err(|error| { report!(error).change_context(ApiClientError::ResponseDecodingFailed) })?; Ok(Err(Response { headers, response: bytes, status_code, })) } 400..=499 => { let bytes = resp.bytes().await.map_err(|error| { report!(error).change_context(ApiClientError::ResponseDecodingFailed) })?; Ok(Err(Response { headers, response: bytes, status_code, })) } _ => { info_log( "UNEXPECTED_RESPONSE", &json!("Unexpected response from server."), ); Err(report!(ApiClientError::UnexpectedServerResponse)) } } }) .await? }
{ "chunk": null, "crate": "external-services", "enum_name": null, "file_size": null, "for_type": null, "function_name": "handle_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_external-services_-1959449871651696467
clm
function
// connector-service/backend/external-services/src/service.rs fn strip_bom_and_convert_to_string(response_bytes: &[u8]) -> Option<String> { String::from_utf8(response_bytes.to_vec()).ok().map(|s| { // Remove BOM if present (UTF-8 BOM is 0xEF, 0xBB, 0xBF) if s.starts_with('\u{FEFF}') { s.trim_start_matches('\u{FEFF}').to_string() } else { s } }) }
{ "chunk": null, "crate": "external-services", "enum_name": null, "file_size": null, "for_type": null, "function_name": "strip_bom_and_convert_to_string", "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_external-services_7848620400928568688
clm
function
// connector-service/backend/external-services/src/service.rs fn extract_raw_connector_request(connector_request: &Request) -> String { // Extract actual body content let body_content = match connector_request.body.as_ref() { Some(request) => { let inner_value = request.get_inner_value(); serde_json::from_str(&inner_value.expose()).unwrap_or_else(|_| { tracing::warn!("failed to parse JSON body in extract_raw_connector_request"); json!({ "error": "failed to parse JSON body" }) }) } None => serde_json::Value::Null, }; // Extract unmasked headers let headers_content = connector_request .headers .iter() .map(|(k, v)| { let value = match v { Maskable::Normal(val) => val.clone(), Maskable::Masked(val) => val.clone().expose().to_string(), }; (k.clone(), value) }) .collect::<HashMap<_, _>>(); // Create complete request with actual content json!({ "url": connector_request.url, "method": connector_request.method.to_string(), "headers": headers_content, "body": body_content }) .to_string() }
{ "chunk": null, "crate": "external-services", "enum_name": null, "file_size": null, "for_type": null, "function_name": "extract_raw_connector_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_external-services_3523581762954642757
clm
function
// connector-service/backend/external-services/src/service.rs fn parse_json_with_bom_handling( response_bytes: &[u8], ) -> Result<serde_json::Value, serde_json::Error> { // Try direct parsing first (most common case) match serde_json::from_slice::<serde_json::Value>(response_bytes) { Ok(value) => Ok(value), Err(_) => { // If direct parsing fails, try after removing BOM let cleaned_response = if response_bytes.starts_with(&[0xEF, 0xBB, 0xBF]) { // UTF-8 BOM detected, remove it #[allow(clippy::indexing_slicing)] &response_bytes[3..] } else { response_bytes }; serde_json::from_slice::<serde_json::Value>(cleaned_response) } } }
{ "chunk": null, "crate": "external-services", "enum_name": null, "file_size": null, "for_type": null, "function_name": "parse_json_with_bom_handling", "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_external-services_6696056494800711017
clm
function
// connector-service/backend/external-services/src/service.rs fn construct_header_map(self) -> CustomResult<reqwest::header::HeaderMap, ApiClientError> { use reqwest::header::{HeaderMap, HeaderName, HeaderValue}; self.into_iter().try_fold( HeaderMap::new(), |mut header_map, (header_name, header_value)| { let header_name = HeaderName::from_str(&header_name) .change_context(ApiClientError::HeaderMapConstructionFailed)?; let header_value = header_value.into_inner(); let header_value = HeaderValue::from_str(&header_value) .change_context(ApiClientError::HeaderMapConstructionFailed)?; header_map.append(header_name, header_value); Ok(header_map) }, ) }
{ "chunk": null, "crate": "external-services", "enum_name": null, "file_size": null, "for_type": null, "function_name": "construct_header_map", "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_external-services_4352089627165859511
clm
function
// connector-service/backend/external-services/src/service.rs fn add_headers(mut self, headers: reqwest::header::HeaderMap) -> Self { self = self.headers(headers); self }
{ "chunk": null, "crate": "external-services", "enum_name": null, "file_size": null, "for_type": null, "function_name": "add_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_external-services_-711957062976547950
clm
function
// connector-service/backend/external-services/src/service.rs pub fn debug_log(action: &str, message: &serde_json::Value) { tracing::debug!(tags = %action, json_value= %message); }
{ "chunk": null, "crate": "external-services", "enum_name": null, "file_size": null, "for_type": null, "function_name": "debug_log", "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_external-services_-4932864402846642158
clm
function
// connector-service/backend/external-services/src/service.rs pub fn info_log(action: &str, message: &serde_json::Value) { tracing::info!(tags = %action, json_value= %message); }
{ "chunk": null, "crate": "external-services", "enum_name": null, "file_size": null, "for_type": null, "function_name": "info_log", "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_external-services_-1325471569585394889
clm
function
// connector-service/backend/external-services/src/service.rs pub fn error_log(action: &str, message: &serde_json::Value) { tracing::error!(tags = %action, json_value= %message); }
{ "chunk": null, "crate": "external-services", "enum_name": null, "file_size": null, "for_type": null, "function_name": "error_log", "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_external-services_240304190117327602
clm
function
// connector-service/backend/external-services/src/service.rs pub fn warn_log(action: &str, message: &serde_json::Value) { tracing::warn!(tags = %action, json_value= %message); }
{ "chunk": null, "crate": "external-services", "enum_name": null, "file_size": null, "for_type": null, "function_name": "warn_log", "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_domain_types_-7209444786323127603
clm
function
// connector-service/backend/domain_types/src/router_request_types.rs pub fn get_ip_address(&self) -> Result<Secret<String, IpAddress>, Error> { let ip_address = self .ip_address .ok_or_else(utils::missing_field_err("browser_info.ip_address"))?; Ok(Secret::new(ip_address.to_string())) }
{ "chunk": null, "crate": "domain_types", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_ip_address", "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_domain_types_7945571125934558495
clm
function
// connector-service/backend/domain_types/src/router_request_types.rs pub fn get_accept_header(&self) -> Result<String, Error> { self.accept_header .clone() .ok_or_else(utils::missing_field_err("browser_info.accept_header")) }
{ "chunk": null, "crate": "domain_types", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_accept_header", "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_domain_types_-7429259318831095021
clm
function
// connector-service/backend/domain_types/src/router_request_types.rs pub fn get_language(&self) -> Result<String, Error> { self.language .clone() .ok_or_else(utils::missing_field_err("browser_info.language")) }
{ "chunk": null, "crate": "domain_types", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_language", "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_domain_types_-806592399312115496
clm
function
// connector-service/backend/domain_types/src/router_request_types.rs pub fn get_screen_height(&self) -> Result<u32, Error> { self.screen_height .ok_or_else(utils::missing_field_err("browser_info.screen_height")) }
{ "chunk": null, "crate": "domain_types", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_screen_height", "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_domain_types_-6423875530982077210
clm
function
// connector-service/backend/domain_types/src/router_request_types.rs pub fn get_screen_width(&self) -> Result<u32, Error> { self.screen_width .ok_or_else(utils::missing_field_err("browser_info.screen_width")) }
{ "chunk": null, "crate": "domain_types", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_screen_width", "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_domain_types_8416886961401014088
clm
function
// connector-service/backend/domain_types/src/router_request_types.rs pub fn get_color_depth(&self) -> Result<u8, Error> { self.color_depth .ok_or_else(utils::missing_field_err("browser_info.color_depth")) }
{ "chunk": null, "crate": "domain_types", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_color_depth", "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_domain_types_4917793438521297491
clm
function
// connector-service/backend/domain_types/src/router_request_types.rs pub fn get_user_agent(&self) -> Result<String, Error> { self.user_agent .clone() .ok_or_else(utils::missing_field_err("browser_info.user_agent")) }
{ "chunk": null, "crate": "domain_types", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_user_agent", "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_domain_types_7327789699829497671
clm
function
// connector-service/backend/domain_types/src/router_request_types.rs pub fn get_time_zone(&self) -> Result<i32, Error> { self.time_zone .ok_or_else(utils::missing_field_err("browser_info.time_zone")) }
{ "chunk": null, "crate": "domain_types", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_time_zone", "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_domain_types_6855290060646537424
clm
function
// connector-service/backend/domain_types/src/router_request_types.rs pub fn get_java_enabled(&self) -> Result<bool, Error> { self.java_enabled .ok_or_else(utils::missing_field_err("browser_info.java_enabled")) }
{ "chunk": null, "crate": "domain_types", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_java_enabled", "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_domain_types_3428299074299688718
clm
function
// connector-service/backend/domain_types/src/router_request_types.rs pub fn get_java_script_enabled(&self) -> Result<bool, Error> { self.java_script_enabled .ok_or_else(utils::missing_field_err("browser_info.java_script_enabled")) }
{ "chunk": null, "crate": "domain_types", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_java_script_enabled", "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_domain_types_-6577527412679990216
clm
function
// connector-service/backend/domain_types/src/router_request_types.rs pub fn get_referer(&self) -> Result<String, Error> { self.referer .clone() .ok_or_else(utils::missing_field_err("browser_info.referer")) }
{ "chunk": null, "crate": "domain_types", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_referer", "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_domain_types_-2535516207904136444
clm
function
// connector-service/backend/domain_types/src/router_request_types.rs fn try_from(value: payments::AuthenticationData) -> Result<Self, Self::Error> { let payments::AuthenticationData { eci, cavv, threeds_server_transaction_id, message_version, ds_transaction_id, trans_status, acs_transaction_id, transaction_id, ucaf_collection_indicator, } = value; let threeds_server_transaction_id = utils::extract_optional_connector_request_reference_id(&threeds_server_transaction_id); let message_version = message_version.map(|message_version|{ SemanticVersion::from_str(&message_version).change_context(errors::ApplicationErrorResponse::BadRequest(errors::ApiError{ sub_code: "INVALID_SEMANTIC_VERSION_DATA".to_owned(), error_identifier: 400, error_message: "Invalid semantic version format. Expected format: 'major.minor.patch' (e.g., '2.1.0')".to_string(), error_object: Some(serde_json::json!({ "field": "message_version", "provided_value": message_version, "expected_format": "major.minor.patch", "examples": ["1.0.0", "2.1.0", "2.2.0"], "validation_rule": "Must be in format X.Y.Z where X, Y, Z are non-negative integers" })), })) }).transpose()?; let trans_status = trans_status.map(|trans_status|{ grpc_api_types::payments::TransactionStatus::try_from(trans_status).change_context(errors::ApplicationErrorResponse::BadRequest(errors::ApiError{ sub_code: "INVALID_TRANSACTION_STATUS".to_owned(), error_identifier: 400, error_message: "Invalid transaction status format. Expected one of the valid 3DS transaction status values".to_string(), error_object: Some(serde_json::json!({ "field": "transaction_status", "provided_value": trans_status, "expected_values": [ "Y (Success)", "N (Failure)", "U (Verification Not Performed)", "A (Not Verified)", "R (Rejected)", "C (Challenge Required)", "D (Challenge Required - Decoupled Authentication)", "I (Information Only)" ], "validation_rule": "Must be one of the valid 3DS transaction status codes (Y, N, U, A, R, C, D, I)", "description": "Transaction status represents the result of 3D Secure authentication/verification process" })), }))}).transpose()?.map(common_enums::TransactionStatus::foreign_from); Ok(Self { ucaf_collection_indicator, trans_status, eci, cavv: cavv.map(Secret::new), threeds_server_transaction_id, message_version, ds_trans_id: ds_transaction_id, acs_transaction_id, transaction_id, }) }
{ "chunk": null, "crate": "domain_types", "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_domain_types_1896942585621761364
clm
function
// connector-service/backend/domain_types/src/router_request_types.rs fn foreign_from(value: AuthenticationData) -> Self { use hyperswitch_masking::ExposeInterface; Self { ucaf_collection_indicator: value.ucaf_collection_indicator, eci: value.eci, cavv: value.cavv.map(|cavv| cavv.expose()), threeds_server_transaction_id: value.threeds_server_transaction_id.map(|id| { payments::Identifier { id_type: Some(payments::identifier::IdType::Id(id)), } }), message_version: value.message_version.map(|v| v.to_string()), ds_transaction_id: value.ds_trans_id, trans_status: value .trans_status .map(payments::TransactionStatus::foreign_from) .map(i32::from), acs_transaction_id: value.acs_transaction_id, transaction_id: value.transaction_id, } }
{ "chunk": null, "crate": "domain_types", "enum_name": null, "file_size": null, "for_type": null, "function_name": "foreign_from", "is_async": false, "is_pub": false, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }