id
stringlengths
20
153
type
stringclasses
1 value
granularity
stringclasses
14 values
content
stringlengths
16
84.3k
metadata
dict
connector-service_fn_connector-integration_-4037744963478676863
clm
function
// connector-service/backend/connector-integration/src/connectors/razorpay/transformers.rs fn get_authorization_razorpay_payment_status_from_action( is_manual_capture: bool, has_next_action: bool, ) -> AttemptStatus { if has_next_action { AttemptStatus::AuthenticationPending } else if is_manual_capture { AttemptStatus::Authorized } else { AttemptStatus::Charged } }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_authorization_razorpay_payment_status_from_action", "is_async": false, "is_pub": false, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_fn_connector-integration_-6631758940601854582
clm
function
// connector-service/backend/connector-integration/src/connectors/razorpay/transformers.rs fn get_psync_razorpay_payment_status( is_manual_capture: bool, razorpay_status: RazorpayStatus, ) -> AttemptStatus { match razorpay_status { RazorpayStatus::Created => AttemptStatus::Pending, RazorpayStatus::Authorized => { if is_manual_capture { AttemptStatus::Authorized } else { AttemptStatus::Charged } } RazorpayStatus::Captured => AttemptStatus::Charged, RazorpayStatus::Refunded => AttemptStatus::AutoRefunded, RazorpayStatus::Failed => AttemptStatus::Failure, } }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_psync_razorpay_payment_status", "is_async": false, "is_pub": false, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_fn_connector-integration_-3972311658588693386
clm
function
// connector-service/backend/connector-integration/src/connectors/razorpay/transformers.rs pub fn get_webhook_object_from_body( body: Vec<u8>, ) -> Result<Payload, error_stack::Report<errors::ConnectorError>> { let webhook: RazorpayWebhook = body .parse_struct("RazorpayWebhook") .change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?; Ok(webhook.payload) }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_webhook_object_from_body", "is_async": false, "is_pub": true, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_fn_connector-integration_-8908402265636698198
clm
function
// connector-service/backend/connector-integration/src/connectors/razorpay/transformers.rs pub(crate) fn get_razorpay_payment_webhook_status( entity: RazorpayEntity, status: RazorpayPaymentStatus, ) -> Result<AttemptStatus, errors::ConnectorError> { match entity { RazorpayEntity::Payment => match status { RazorpayPaymentStatus::Authorized => Ok(AttemptStatus::Authorized), RazorpayPaymentStatus::Captured => Ok(AttemptStatus::Charged), RazorpayPaymentStatus::Failed => Ok(AttemptStatus::AuthorizationFailed), }, RazorpayEntity::Refund => Err(errors::ConnectorError::RequestEncodingFailed), } }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_razorpay_payment_webhook_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_connector-integration_-2901555541874008960
clm
function
// connector-service/backend/connector-integration/src/connectors/razorpay/transformers.rs pub(crate) fn get_razorpay_refund_webhook_status( entity: RazorpayEntity, status: RazorpayRefundStatus, ) -> Result<common_enums::RefundStatus, errors::ConnectorError> { match entity { RazorpayEntity::Refund => match status { RazorpayRefundStatus::Processed => Ok(common_enums::RefundStatus::Success), RazorpayRefundStatus::Created | RazorpayRefundStatus::Pending => { Ok(common_enums::RefundStatus::Pending) } RazorpayRefundStatus::Failed => Ok(common_enums::RefundStatus::Failure), }, RazorpayEntity::Payment => Err(errors::ConnectorError::RequestEncodingFailed), } }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_razorpay_refund_webhook_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_connector-integration_-1636434888078594297
clm
function
// connector-service/backend/connector-integration/src/connectors/nexinets/transformers.rs fn try_from( item: ResponseRouterData<NexinetsRefundResponse, Self>, ) -> Result<Self, Self::Error> { Ok(Self { response: Ok(RefundsResponseData { connector_refund_id: item.response.transaction_id, refund_status: enums::RefundStatus::from(item.response.status), status_code: item.http_code, }), ..item.router_data }) }
{ "chunk": null, "crate": "connector-integration", "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_connector-integration_8550670897078209958
clm
function
// connector-service/backend/connector-integration/src/connectors/nexinets/transformers.rs fn get_status(status: NexinetsPaymentStatus, method: NexinetsTransactionType) -> AttemptStatus { match status { NexinetsPaymentStatus::Success => match method { NexinetsTransactionType::Preauth => AttemptStatus::Authorized, NexinetsTransactionType::Debit | NexinetsTransactionType::Capture => { AttemptStatus::Charged } NexinetsTransactionType::Cancel => AttemptStatus::Voided, }, NexinetsPaymentStatus::Declined | NexinetsPaymentStatus::Failure | NexinetsPaymentStatus::Expired | NexinetsPaymentStatus::Aborted => match method { NexinetsTransactionType::Preauth => AttemptStatus::AuthorizationFailed, NexinetsTransactionType::Debit | NexinetsTransactionType::Capture => { AttemptStatus::CaptureFailed } NexinetsTransactionType::Cancel => AttemptStatus::VoidFailed, }, NexinetsPaymentStatus::Ok => match method { NexinetsTransactionType::Preauth => AttemptStatus::Authorized, _ => AttemptStatus::Pending, }, NexinetsPaymentStatus::Pending => AttemptStatus::AuthenticationPending, NexinetsPaymentStatus::InProgress => AttemptStatus::Pending, } }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_status", "is_async": false, "is_pub": false, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_fn_connector-integration_3537089937280467251
clm
function
// connector-service/backend/connector-integration/src/connectors/nexinets/transformers.rs fn from(item: RefundStatus) -> Self { match item { RefundStatus::Success => Self::Success, RefundStatus::Failure | RefundStatus::Declined => Self::Failure, RefundStatus::InProgress | RefundStatus::Ok => Self::Pending, } }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "from", "is_async": false, "is_pub": false, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_fn_connector-integration_-2322373070182054017
clm
function
// connector-service/backend/connector-integration/src/connectors/nexinets/transformers.rs fn get_payment_details_and_product< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, >( item: &RouterDataV2<Authorize, PaymentFlowData, PaymentsAuthorizeData<T>, PaymentsResponseData>, ) -> Result< (Option<NexinetsPaymentDetails<T>>, NexinetsProduct), error_stack::Report<errors::ConnectorError>, > { match &item.request.payment_method_data { PaymentMethodData::Card(card) => Ok(( Some(get_card_data(item, card)?), NexinetsProduct::Creditcard, )), PaymentMethodData::Wallet(wallet) => Ok(get_wallet_details(wallet)?), PaymentMethodData::BankRedirect(bank_redirect) => match bank_redirect { BankRedirectData::Eps { .. } => Ok((None, NexinetsProduct::Eps)), BankRedirectData::Giropay { .. } => Ok((None, NexinetsProduct::Giropay)), BankRedirectData::Ideal { bank_name, .. } => Ok(( Some(NexinetsPaymentDetails::BankRedirects(Box::new( NexinetsBankRedirects { bic: bank_name .map(|bank_name| NexinetsBIC::try_from(&bank_name)) .transpose()?, }, ))), NexinetsProduct::Ideal, )), BankRedirectData::Sofort { .. } => Ok((None, NexinetsProduct::Sofort)), BankRedirectData::BancontactCard { .. } | BankRedirectData::Blik { .. } | BankRedirectData::Bizum { .. } | BankRedirectData::Eft { .. } | BankRedirectData::Interac { .. } | BankRedirectData::OnlineBankingCzechRepublic { .. } | BankRedirectData::OnlineBankingFinland { .. } | BankRedirectData::OnlineBankingPoland { .. } | BankRedirectData::OnlineBankingSlovakia { .. } | BankRedirectData::OpenBankingUk { .. } | BankRedirectData::Przelewy24 { .. } | BankRedirectData::Trustly { .. } | BankRedirectData::OnlineBankingFpx { .. } | BankRedirectData::OnlineBankingThailand { .. } | BankRedirectData::LocalBankRedirect {} => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("nexinets"), ))? } }, PaymentMethodData::CardRedirect(_) | PaymentMethodData::PayLater(_) | PaymentMethodData::BankDebit(_) | PaymentMethodData::BankTransfer(_) | PaymentMethodData::Crypto(_) | PaymentMethodData::MandatePayment | PaymentMethodData::Reward | PaymentMethodData::RealTimePayment(_) | PaymentMethodData::MobilePayment(_) | PaymentMethodData::Upi(_) | PaymentMethodData::Voucher(_) | PaymentMethodData::GiftCard(_) | PaymentMethodData::OpenBanking(_) | PaymentMethodData::CardToken(_) | PaymentMethodData::NetworkToken(_) | PaymentMethodData::CardDetailsForNetworkTransactionId(_) => { Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("nexinets"), ))? } } }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_payment_details_and_product", "is_async": false, "is_pub": false, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_fn_connector-integration_2241953456805645297
clm
function
// connector-service/backend/connector-integration/src/connectors/nexinets/transformers.rs fn get_card_data< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, >( item: &RouterDataV2<Authorize, PaymentFlowData, PaymentsAuthorizeData<T>, PaymentsResponseData>, card: &Card<T>, ) -> Result<NexinetsPaymentDetails<T>, errors::ConnectorError> { let (card_data, cof_contract) = match is_mandate_payment(&item.request) { true => { let card_data = match item.request.off_session { Some(true) => CardDataDetails::PaymentInstrument(Box::new(PaymentInstrument { payment_instrument_id: item.request.connector_mandate_id().map(Secret::new), })), _ => CardDataDetails::CardDetails(Box::new(get_card_details(card)?)), }; let cof_contract = Some(CofContract { recurring_type: RecurringType::Unscheduled, }); (card_data, cof_contract) } false => ( CardDataDetails::CardDetails(Box::new(get_card_details(card)?)), None, ), }; Ok(NexinetsPaymentDetails::Card(Box::new(NexiCardDetails { card_data, cof_contract, }))) }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_card_data", "is_async": false, "is_pub": false, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_fn_connector-integration_-2901233954996636942
clm
function
// connector-service/backend/connector-integration/src/connectors/nexinets/transformers.rs fn get_applepay_details( wallet_data: &WalletData, applepay_data: &ApplePayWalletData, ) -> CustomResult<ApplePayDetails, errors::ConnectorError> { let payment_data = WalletData::get_wallet_token_as_json(wallet_data, "Apple Pay".to_string())?; Ok(ApplePayDetails { payment_data, payment_method: ApplepayPaymentMethod { display_name: applepay_data.payment_method.display_name.to_owned(), network: applepay_data.payment_method.network.to_owned(), token_type: applepay_data.payment_method.pm_type.to_owned(), }, transaction_identifier: applepay_data.transaction_identifier.to_owned(), }) }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_applepay_details", "is_async": false, "is_pub": false, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_fn_connector-integration_-6177214858470529762
clm
function
// connector-service/backend/connector-integration/src/connectors/nexinets/transformers.rs fn get_card_details< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, >( req_card: &Card<T>, ) -> Result<CardDetails<T>, errors::ConnectorError> { Ok(CardDetails { card_number: req_card.card_number.clone(), expiry_month: req_card.card_exp_month.clone(), expiry_year: req_card.card_exp_year.clone(), verification: req_card.card_cvc.clone(), }) }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_card_details", "is_async": false, "is_pub": false, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_fn_connector-integration_3485731755972331756
clm
function
// connector-service/backend/connector-integration/src/connectors/nexinets/transformers.rs fn get_wallet_details< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, >( wallet: &WalletData, ) -> Result< (Option<NexinetsPaymentDetails<T>>, NexinetsProduct), error_stack::Report<errors::ConnectorError>, > { match wallet { WalletData::PaypalRedirect(_) => Ok((None, NexinetsProduct::Paypal)), WalletData::ApplePay(applepay_data) => Ok(( Some(NexinetsPaymentDetails::Wallet(Box::new( NexinetsWalletDetails::ApplePayToken(Box::new(get_applepay_details( wallet, applepay_data, )?)), ))), NexinetsProduct::Applepay, )), WalletData::AliPayQr(_) | WalletData::BluecodeRedirect { .. } | WalletData::AliPayRedirect(_) | WalletData::AliPayHkRedirect(_) | WalletData::AmazonPayRedirect(_) | WalletData::MomoRedirect(_) | WalletData::KakaoPayRedirect(_) | WalletData::GoPayRedirect(_) | WalletData::GcashRedirect(_) | WalletData::ApplePayRedirect(_) | WalletData::ApplePayThirdPartySdk(_) | WalletData::DanaRedirect { .. } | WalletData::GooglePay(_) | WalletData::GooglePayRedirect(_) | WalletData::GooglePayThirdPartySdk(_) | WalletData::MbWayRedirect(_) | WalletData::MobilePayRedirect(_) | WalletData::PaypalSdk(_) | WalletData::Paze(_) | WalletData::SamsungPay(_) | WalletData::TwintRedirect { .. } | WalletData::VippsRedirect { .. } | WalletData::TouchNGoRedirect(_) | WalletData::WeChatPayRedirect(_) | WalletData::WeChatPayQr(_) | WalletData::CashappQr(_) | WalletData::SwishQr(_) | WalletData::Mifinity(_) | WalletData::RevolutPay(_) => Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("nexinets"), ))?, } }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_wallet_details", "is_async": false, "is_pub": false, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_fn_connector-integration_-2834110669664230917
clm
function
// connector-service/backend/connector-integration/src/connectors/nexinets/transformers.rs pub fn get_order_id( meta: &NexinetsPaymentsMetadata, ) -> Result<String, error_stack::Report<errors::ConnectorError>> { let order_id = meta.order_id.clone().ok_or( errors::ConnectorError::MissingConnectorRelatedTransactionID { id: "order_id".to_string(), }, )?; Ok(order_id) }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_order_id", "is_async": false, "is_pub": true, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_fn_connector-integration_-2064561617091103254
clm
function
// connector-service/backend/connector-integration/src/connectors/nexinets/transformers.rs pub fn get_transaction_id( meta: &NexinetsPaymentsMetadata, ) -> Result<String, error_stack::Report<errors::ConnectorError>> { let transaction_id = meta.transaction_id.clone().ok_or( errors::ConnectorError::MissingConnectorRelatedTransactionID { id: "transaction_id".to_string(), }, )?; Ok(transaction_id) }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_transaction_id", "is_async": false, "is_pub": true, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_fn_connector-integration_4959836677832181844
clm
function
// connector-service/backend/connector-integration/src/connectors/nexinets/transformers.rs fn is_mandate_payment< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, >( item: &PaymentsAuthorizeData<T>, ) -> bool { (item.setup_future_usage == Some(common_enums::enums::FutureUsage::OffSession)) || item .mandate_id .as_ref() .and_then(|mandate_ids| mandate_ids.mandate_reference_id.as_ref()) .is_some() }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "is_mandate_payment", "is_async": false, "is_pub": false, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_fn_connector-integration_-7118840584028584861
clm
function
// connector-service/backend/connector-integration/src/connectors/cashfree/test.rs fn test_cashfree_connector_creation() { // Basic test to ensure connector can be created let connector: &connectors::cashfree::Cashfree<DefaultPCIHolder> = super::super::Cashfree::new(); assert_eq!(connector.id(), "cashfree"); }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "test_cashfree_connector_creation", "is_async": false, "is_pub": false, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_fn_connector-integration_-913117386941814465
clm
function
// connector-service/backend/connector-integration/src/connectors/cashfree/transformers.rs fn try_from( item: ResponseRouterData< CashfreePaymentResponse, RouterDataV2< Authorize, PaymentFlowData, PaymentsAuthorizeData<T>, PaymentsResponseData, >, >, ) -> Result<Self, Self::Error> { let response = item.response; let (status, redirection_data) = match response.channel.as_str() { "link" => { // Intent flow - extract deep link from payload._default let deep_link = response.data.payload.map(|p| p.default_link).ok_or( ConnectorError::MissingRequiredField { field_name: "intent_link", }, )?; // Trim deep link at "?" as per Haskell: truncateIntentLink "?" link let trimmed_link = if let Some(pos) = deep_link.find('?') { &deep_link[(pos + 1)..] } else { &deep_link }; // Create UPI intent redirection let redirection_data = Some(Box::new(Some( domain_types::router_response_types::RedirectForm::Uri { uri: trimmed_link.to_string(), }, ))); ( common_enums::AttemptStatus::AuthenticationPending, redirection_data, ) } "collect" => { // Collect flow - return without redirection, status Pending (common_enums::AttemptStatus::Pending, None) } _ => (common_enums::AttemptStatus::Failure, None), }; Ok(Self { response: Ok(PaymentsResponseData::TransactionResponse { resource_id: ResponseId::ConnectorTransactionId( response .cf_payment_id .as_ref() .map(|id| id.to_string()) .unwrap_or_default(), ), redirection_data: redirection_data.and_then(|data| *data).map(Box::new), mandate_reference: None, connector_metadata: None, network_txn_id: None, connector_response_reference_id: response.cf_payment_id.map(|id| id.to_string()), incremental_authorization_allowed: None, status_code: item.http_code, }), resource_common_data: PaymentFlowData { status, ..item.router_data.resource_common_data }, ..item.router_data }) }
{ "chunk": null, "crate": "connector-integration", "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_connector-integration_-4267907141106082030
clm
function
// connector-service/backend/connector-integration/src/connectors/cashfree/transformers.rs fn secret_is_empty(secret: &Secret<String>) -> bool { secret.peek().is_empty() }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "secret_is_empty", "is_async": false, "is_pub": false, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_fn_connector-integration_3976411639051272969
clm
function
// connector-service/backend/connector-integration/src/connectors/cashfree/transformers.rs fn get_cashfree_payment_method_data< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, >( payment_method_data: &PaymentMethodData<T>, ) -> Result<CashfreePaymentMethod, ConnectorError> { match payment_method_data { PaymentMethodData::Upi(upi_data) => { match upi_data { domain_types::payment_method_data::UpiData::UpiCollect(collect_data) => { // Extract VPA for collect flow - maps to upi_id field in Cashfree let vpa = collect_data .vpa_id .as_ref() .map(|vpa| vpa.peek().to_string()) .unwrap_or_default(); if vpa.is_empty() { return Err(ConnectorError::MissingRequiredField { field_name: "vpa_id for UPI collect", }); } Ok(CashfreePaymentMethod { upi: Some(CashfreeUpiDetails { channel: "collect".to_string(), upi_id: Secret::new(vpa), }), app: None, netbanking: None, card: None, emi: None, paypal: None, paylater: None, cardless_emi: None, }) } domain_types::payment_method_data::UpiData::UpiIntent(_) | domain_types::payment_method_data::UpiData::UpiQr(_) => { // Intent flow: channel = "link", no UPI ID needed Ok(CashfreePaymentMethod { upi: Some(CashfreeUpiDetails { channel: "link".to_string(), upi_id: Secret::new("".to_string()), }), app: None, netbanking: None, card: None, emi: None, paypal: None, paylater: None, cardless_emi: None, }) } } } _ => Err(ConnectorError::NotSupported { message: "Only UPI payment methods are supported for Cashfree V3".to_string(), connector: "Cashfree", }), } }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_cashfree_payment_method_data", "is_async": false, "is_pub": false, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_fn_connector-integration_4556260266317788542
clm
function
// connector-service/backend/connector-integration/src/connectors/dlocal/transformers.rs fn try_from(item: ResponseRouterData<RefundResponse, Self>) -> Result<Self, Self::Error> { let refund_status = common_enums::RefundStatus::from(item.response.status); Ok(Self { response: Ok(RefundsResponseData { connector_refund_id: item.response.id, refund_status, status_code: item.http_code, }), ..item.router_data }) }
{ "chunk": null, "crate": "connector-integration", "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_connector-integration_3421055711721102464
clm
function
// connector-service/backend/connector-integration/src/connectors/dlocal/transformers.rs fn get_payer_name(address: &AddressDetails) -> Option<Secret<String>> { let first_name = address .first_name .clone() .map_or("".to_string(), |first_name| first_name.peek().to_string()); let last_name = address .last_name .clone() .map_or("".to_string(), |last_name| last_name.peek().to_string()); let name: String = format!("{first_name} {last_name}").trim().to_string(); if !name.is_empty() { Some(Secret::new(name)) } else { None } }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_payer_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_connector-integration_-5799409836123546819
clm
function
// connector-service/backend/connector-integration/src/connectors/dlocal/transformers.rs fn from(item: RefundStatus) -> Self { match item { RefundStatus::Success => Self::Success, RefundStatus::Pending => Self::Pending, RefundStatus::Rejected => Self::ManualReview, RefundStatus::Cancelled => Self::Failure, } }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "from", "is_async": false, "is_pub": false, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_fn_connector-integration_8581464554531103985
clm
function
// connector-service/backend/connector-integration/src/connectors/dlocal/transformers.rs fn get_doc_from_currency(country: String) -> Secret<String> { let doc = match country.as_str() { "BR" => "91483309223", "ZA" => "2001014800086", "BD" | "GT" | "HN" | "PK" | "SN" | "TH" => "1234567890001", "CR" | "SV" | "VN" => "123456789", "DO" | "NG" => "12345678901", "EG" => "12345678901112", "GH" | "ID" | "RW" | "UG" => "1234567890111123", "IN" => "NHSTP6374G", "CI" => "CA124356789", "JP" | "MY" | "PH" => "123456789012", "NI" => "1234567890111A", "TZ" => "12345678912345678900", _ => "12345678", }; Secret::new(doc.to_string()) }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_doc_from_currency", "is_async": false, "is_pub": false, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_fn_connector-integration_7689147486421063469
clm
function
// connector-service/backend/connector-integration/src/connectors/rapyd/transformers.rs fn try_from(item: ResponseRouterData<RefundResponse, Self>) -> Result<Self, Self::Error> { let (connector_refund_id, refund_status) = match item.response.data { Some(data) => (data.id, common_enums::RefundStatus::from(data.status)), None => ( item.response.status.error_code, common_enums::RefundStatus::Failure, ), }; Ok(Self { response: Ok(RefundsResponseData { connector_refund_id, refund_status, status_code: item.http_code, }), ..item.router_data }) }
{ "chunk": null, "crate": "connector-integration", "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_connector-integration_-1598684213023246236
clm
function
// connector-service/backend/connector-integration/src/connectors/rapyd/transformers.rs fn get_status(status: RapydPaymentStatus, next_action: NextAction) -> common_enums::AttemptStatus { match (status, next_action) { (RapydPaymentStatus::Closed, _) => common_enums::AttemptStatus::Charged, ( RapydPaymentStatus::Active, NextAction::ThreedsVerification | NextAction::PendingConfirmation, ) => common_enums::AttemptStatus::AuthenticationPending, (RapydPaymentStatus::Active, NextAction::PendingCapture | NextAction::NotApplicable) => { common_enums::AttemptStatus::Authorized } ( RapydPaymentStatus::CanceledByClientOrBank | RapydPaymentStatus::Expired | RapydPaymentStatus::ReversedByRapyd, _, ) => common_enums::AttemptStatus::Voided, (RapydPaymentStatus::Error, _) => common_enums::AttemptStatus::Failure, (RapydPaymentStatus::New, _) => common_enums::AttemptStatus::Authorizing, } }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_status", "is_async": false, "is_pub": false, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_fn_connector-integration_377161422644771364
clm
function
// connector-service/backend/connector-integration/src/connectors/rapyd/transformers.rs fn from(item: RefundStatus) -> Self { match item { RefundStatus::Completed => Self::Success, RefundStatus::Error | RefundStatus::Rejected => Self::Failure, RefundStatus::Pending => Self::Pending, } }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "from", "is_async": false, "is_pub": false, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_fn_connector-integration_4119764694675366801
clm
function
// connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs fn try_from(auth_type: &ConnectorAuthType) -> Result<Self, Self::Error> { match auth_type { ConnectorAuthType::SignatureKey { api_key, key1, api_secret, } => { Ok(Self { merchant_id: api_key.to_owned(), // merchant_id merchant_key: key1.to_owned(), // signing key website: api_secret.to_owned(), // website name channel_id: constants::CHANNEL_ID.to_string(), client_id: None, // None as specified }) } _ => Err(errors::ConnectorError::FailedToObtainAuthType.into()), } }
{ "chunk": null, "crate": "connector-integration", "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_connector-integration_-3185481980065317347
clm
function
// connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs pub fn determine_upi_flow<T: domain_types::payment_method_data::PaymentMethodDataTypes>( payment_method_data: &PaymentMethodData<T>, ) -> CustomResult<UpiFlowType, errors::ConnectorError> { match payment_method_data { PaymentMethodData::Upi(upi_data) => { match upi_data { UpiData::UpiCollect(collect_data) => { // If VPA is provided, it's a collect flow if collect_data.vpa_id.is_some() { Ok(UpiFlowType::Collect) } else { // If no VPA provided, default to Intent Ok(UpiFlowType::Intent) } } UpiData::UpiIntent(_) | UpiData::UpiQr(_) => Ok(UpiFlowType::Intent), } } _ => { // Default to Intent for non-UPI specific payment methods Ok(UpiFlowType::Intent) } } }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "determine_upi_flow", "is_async": false, "is_pub": true, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_fn_connector-integration_-7439446151973128045
clm
function
// connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs pub fn extract_upi_vpa<T: domain_types::payment_method_data::PaymentMethodDataTypes>( payment_method_data: &PaymentMethodData<T>, ) -> CustomResult<Option<String>, errors::ConnectorError> { match payment_method_data { PaymentMethodData::Upi(UpiData::UpiCollect(collect_data)) => { if let Some(vpa_id) = &collect_data.vpa_id { let vpa = vpa_id.peek().to_string(); if vpa.contains('@') && vpa.len() > 3 { Ok(Some(vpa)) } else { Err(errors::ConnectorError::RequestEncodingFailedWithReason( constants::ERROR_INVALID_VPA.to_string(), ) .into()) } } else { Err(errors::ConnectorError::MissingRequiredField { field_name: "vpa_id", } .into()) } } _ => Ok(None), } }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "extract_upi_vpa", "is_async": false, "is_pub": true, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_fn_connector-integration_-6957289705848226931
clm
function
// connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs pub fn generate_paytm_signature( payload: &str, merchant_key: &str, ) -> CustomResult<String, errors::ConnectorError> { // Step 1: Generate random salt bytes using ring (same logic, different implementation) let rng = SystemRandom::new(); let mut salt_bytes = [0u8; constants::SALT_LENGTH]; rng.fill(&mut salt_bytes).map_err(|_| { errors::ConnectorError::RequestEncodingFailedWithReason( constants::ERROR_SALT_GENERATION.to_string(), ) })?; // Step 2: Convert salt to Base64 (same logic) let salt_b64 = general_purpose::STANDARD.encode(salt_bytes); // Step 3: Create hash input: payload + "|" + base64_salt (same logic) let hash_input = format!("{payload}|{salt_b64}"); // Step 4: SHA-256 hash using ring (same logic, different implementation) let hash_digest = digest::digest(&digest::SHA256, hash_input.as_bytes()); let sha256_hash = hex::encode(hash_digest.as_ref()); // Step 5: Create checksum: sha256_hash + base64_salt (same logic) let checksum = format!("{sha256_hash}{salt_b64}"); // Step 6: AES encrypt checksum with merchant key (same logic) let signature = aes_encrypt(&checksum, merchant_key)?; Ok(signature) }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "generate_paytm_signature", "is_async": false, "is_pub": true, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_fn_connector-integration_-5853728846929343125
clm
function
// connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs _encrypt(data: &str, key: &str) -> CustomResult<String, errors::ConnectorError> { // PayTM uses fixed IV as specified in PayTMv1 implementation let iv = get_paytm_iv(); let key_bytes = key.as_bytes(); let data_bytes = data.as_bytes(); // Determine AES variant based on key length (following PayTMv1 Haskell implementation) match key_bytes.len() { constants::AES_128_KEY_LENGTH => { // AES-128-CBC with PKCS7 padding type Aes128CbcEnc = Encryptor<Aes128>; let mut key_array = [0u8; constants::AES_128_KEY_LENGTH]; key_array.copy_from_slice(key_bytes); let encryptor = Aes128CbcEnc::new(&key_array.into(), &iv.into()); // Encrypt with proper buffer management let mut buffer = Vec::with_capacity(data_bytes.len() + constants::AES_BUFFER_PADDING); buffer.extend_from_slice(data_bytes); buffer.resize(buffer.len() + constants::AES_BUFFER_PADDING, 0); let encrypted_len = encryptor .encrypt_padded_mut::<Pkcs7>(&mut buffer, data_bytes.len()) .map_err(|_| { errors::ConnectorError::RequestEncodingFailedWithReason( constants::ERROR_AES_128_ENCRYPTION.to_string(), ) })? .len(); buffer.truncate(encrypted_len); Ok(general_purpose::STANDARD.encode(&buffer)) } constants::AES_192_KEY_LENGTH => { // AES-192-CBC with PKCS7 padding type Aes192CbcEnc = Encryptor<Aes192>; let mut key_array = [0u8; constants::AES_192_KEY_LENGTH]; key_array.copy_from_slice(key_bytes); let encryptor = Aes192CbcEnc::new(&key_array.into(), &iv.into()); let mut buffer = Vec::with_capacity(data_bytes.len() + constants::AES_BUFFER_PADDING); buffer.extend_from_slice(data_bytes); buffer.resize(buffer.len() + constants::AES_BUFFER_PADDING, 0); let encrypted_len = encryptor .encrypt_padded_mut::<Pkcs7>(&mut buffer, data_bytes.len()) .map_err(|_| { errors::ConnectorError::RequestEncodingFailedWithReason( constants::ERROR_AES_192_ENCRYPTION.to_string(), ) })? .len(); buffer.truncate(encrypted_len); Ok(general_purpose::STANDARD.encode(&buffer)) } _ => { // Default to AES-256-CBC with PKCS7 padding (for any other key length) type Aes256CbcEnc = Encryptor<Aes256>; // For AES-256, we need exactly 32 bytes, so pad or truncate the key let mut aes256_key = [0u8; constants::AES_256_KEY_LENGTH]; let copy_len = cmp::min(key_bytes.len(), constants::AES_256_KEY_LENGTH); aes256_key[..copy_len].copy_from_slice(&key_bytes[..copy_len]); let encryptor = Aes256CbcEnc::new(&aes256_key.into(), &iv.into()); let mut buffer = Vec::with_capacity(data_bytes.len() + constants::AES_BUFFER_PADDING); buffer.extend_from_slice(data_bytes); buffer.resize(buffer.len() + constants::AES_BUFFER_PADDING, 0); let encrypted_len = encryptor .encrypt_padded_mut::<Pkcs7>(&mut buffer, data_bytes.len()) .map_err(|_| { errors::ConnectorError::RequestEncodingFailedWithReason( constants::ERROR_AES_256_ENCRYPTION.to_string(), ) })? .len(); buffer.truncate(encrypted_len); Ok(general_purpose::STANDARD.encode(&buffer)) } } } // F
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "crypt(data:", "is_async": false, "is_pub": false, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_fn_connector-integration_-3913032980729359843
clm
function
// connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs _paytm_iv() -> [u8; 16] { // This is the exact IV used by PayTM v2 as found in the Haskell codebase *constants::PAYTM_IV } pub
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "ytm_iv() -> ", "is_async": false, "is_pub": false, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_fn_connector-integration_-6797924368998403143
clm
function
// connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs create_paytm_header( request_body: &impl serde::Serialize, auth: &PaytmAuthType, ) -> CustomResult<PaytmRequestHeader, errors::ConnectorError> { let _payload = serde_json::to_string(request_body) .change_context(errors::ConnectorError::RequestEncodingFailed)?; let signature = generate_paytm_signature(&_payload, auth.merchant_key.peek())?; let timestamp = SystemTime::now() .duration_since(UNIX_EPOCH) .unwrap() .as_secs() .to_string(); Ok(PaytmRequestHeader { client_id: auth.client_id.clone(), // None version: constants::API_VERSION.to_string(), request_timestamp: timestamp, channel_id: auth.channel_id.clone(), // "WEB" signature: Secret::new(signature), }) } // H
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "_paytm_header(\n ", "is_async": false, "is_pub": false, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_fn_connector-integration_-1354961511510201592
clm
function
// connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs try_from_with_converter( item: &RouterDataV2< Authorize, PaymentFlowData, PaymentsAuthorizeData<T>, PaymentsResponseData, >, amount_converter: &dyn AmountConvertor<Output = StringMajorUnit>, ) -> Result<Self, error_stack::Report<errors::ConnectorError>> { let amount = amount_converter .convert(item.request.minor_amount, item.request.currency) .change_context(errors::ConnectorError::AmountConversionFailed)?; let customer_id = item .resource_common_data .get_customer_id() .ok() .map(|id| id.get_string_repr().to_string()); let email = item.resource_common_data.get_optional_billing_email(); let phone = item .resource_common_data .get_optional_billing_phone_number(); let first_name = item.resource_common_data.get_optional_billing_first_name(); let last_name = item.resource_common_data.get_optional_billing_last_name(); // Extract session token from previous session token response let session_token = item.resource_common_data.get_session_token()?; Ok(Self { amount, currency: item.request.currency, payment_id: item .resource_common_data .connector_request_reference_id .clone(), session_token: Secret::new(session_token), payment_method_data: item.request.payment_method_data.clone(), customer_id, email, phone, first_name, last_name, return_url: item.resource_common_data.get_return_url(), }) } } //
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "om_with_converter(\n ", "is_async": false, "is_pub": false, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_fn_connector-integration_5259596103797085652
clm
function
// connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs try_from_with_auth( item: &PaytmSyncRouterData, auth: &PaytmAuthType, ) -> CustomResult<Self, errors::ConnectorError> { let body = PaytmTransactionStatusReqBody { mid: Secret::new(auth.merchant_id.peek().to_string()), order_id: item.payment_id.clone(), txn_type: item.txn_type.clone(), }; // Create header with actual signature let head = create_paytm_header(&body, auth)?; Ok(Self { head, body }) } } //
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "om_with_auth(\n ", "is_async": false, "is_pub": false, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_fn_connector-integration_9052962118483078786
clm
function
// connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs try_from_with_auth<T: domain_types::payment_method_data::PaymentMethodDataTypes>( item: &PaytmAuthorizeRouterData<T>, auth: &PaytmAuthType, ) -> CustomResult<Self, errors::ConnectorError> { // Extract UPI VPA for collect flow let vpa = extract_upi_vpa(&item.payment_method_data)?.ok_or( errors::ConnectorError::MissingRequiredField { field_name: "vpa_id", }, )?; let head = PaytmTxnTokenType { txn_token: item.session_token.clone(), }; let body = PaytmNativeProcessRequestBody { request_type: constants::REQUEST_TYPE_NATIVE.to_string(), mid: Secret::new(auth.merchant_id.peek().to_string()), order_id: item.payment_id.clone(), payment_mode: constants::PAYMENT_MODE_UPI.to_string(), payer_account: Some(vpa), channel_code: Some("collect".to_string()), // Gateway code if needed channel_id: auth.channel_id.clone(), txn_token: item.session_token.clone(), auth_mode: None, }; Ok(Self { head, body }) } } //
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "om_with_auth<T: do", "is_async": false, "is_pub": false, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_fn_connector-integration_-2773304284711643439
clm
function
// connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs _from( item: ResponseRouterData< PaytmTransactionStatusResponse, RouterDataV2<PSync, PaymentFlowData, PaymentsSyncData, PaymentsResponseData>, >, ) -> Result<Self, Self::Error> { let response = &item.response; let mut router_data = item.router_data; // Handle both success and failure cases from the enum body let (resource_id, connector_txn_id) = match &response.body { PaytmTransactionStatusRespBodyTypes::SuccessBody(success_body) => { let order_id = success_body.order_id.clone().unwrap_or_else(|| { router_data .resource_common_data .connector_request_reference_id .clone() }); let resource_id = ResponseId::ConnectorTransactionId(order_id); let connector_txn_id = success_body.txn_id.clone(); (resource_id, connector_txn_id) } PaytmTransactionStatusRespBodyTypes::FailureBody(_failure_body) => { let resource_id = ResponseId::ConnectorTransactionId( router_data .resource_common_data .connector_request_reference_id .clone(), ); (resource_id, None) } }; // Get result code for status mapping let result_code = match &response.body { PaytmTransactionStatusRespBodyTypes::SuccessBody(success_body) => { &success_body.result_info.result_code } PaytmTransactionStatusRespBodyTypes::FailureBody(failure_body) => { &failure_body.result_info.result_code } }; // Map status and set response accordingly let attempt_status = map_paytm_status_to_attempt_status(result_code); // Update the status using the new setter function router_data.resource_common_data.set_status(attempt_status); router_data.response = match attempt_status { AttemptStatus::Failure => Err(domain_types::router_data::ErrorResponse { code: result_code.clone(), message: match &response.body { PaytmTransactionStatusRespBodyTypes::SuccessBody(body) => { body.result_info.result_msg.clone() } PaytmTransactionStatusRespBodyTypes::FailureBody(body) => { body.result_info.result_msg.clone() } }, reason: None, status_code: item.http_code, attempt_status: Some(attempt_status), connector_transaction_id: connector_txn_id.clone(), network_decline_code: None, network_advice_code: None, network_error_message: None, }), _ => Ok(PaymentsResponseData::TransactionResponse { resource_id, redirection_data: None, mandate_reference: None, connector_metadata: None, network_txn_id: None, connector_response_reference_id: connector_txn_id, incremental_authorization_allowed: None, status_code: item.http_code, }), }; Ok(router_data) } }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "om(\n ", "is_async": false, "is_pub": false, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_fn_connector-integration_4077306061252374201
clm
function
// connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs map_paytm_status_to_attempt_status(result_code: &str) -> AttemptStatus { match result_code { // Success "01" => AttemptStatus::Charged, // TXN_SUCCESS "0000" => AttemptStatus::AuthenticationPending, // Success - waiting for authentication // Pending cases "400" | "402" => AttemptStatus::Pending, // PENDING, PENDING_BANK_CONFIRM "331" => AttemptStatus::Pending, // NO_RECORD_FOUND // Failure cases "227" | "235" | "295" | "334" | "335" | "401" | "501" | "810" | "843" | "820" | "267" => { AttemptStatus::Failure } // Default to failure for unknown codes (WILL NEVER HAPPEN) _ => AttemptStatus::Pending, } } // A
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "ytm_status_to_attempt_status(resul", "is_async": false, "is_pub": false, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_fn_connector-integration_2054285568921142490
clm
function
// connector-service/backend/connector-integration/src/connectors/mifinity/transformers.rs fn try_from( item: ResponseRouterData<MifinityPsyncResponse, Self>, ) -> Result<Self, Self::Error> { let payload = item.response.payload.first(); match payload { Some(payload) => { let status = payload.status.clone(); let payment_response = payload.payment_response.clone(); match payment_response { Some(payment_response) => { let transaction_reference = payment_response.transaction_reference.clone(); Ok(Self { response: Ok(PaymentsResponseData::TransactionResponse { resource_id: ResponseId::ConnectorTransactionId( transaction_reference, ), redirection_data: None, mandate_reference: None, connector_metadata: None, network_txn_id: None, connector_response_reference_id: None, incremental_authorization_allowed: None, status_code: item.http_code, }), resource_common_data: PaymentFlowData { status: enums::AttemptStatus::from(status), ..item.router_data.resource_common_data }, ..item.router_data }) } None => Ok(Self { response: Ok(PaymentsResponseData::TransactionResponse { resource_id: ResponseId::NoResponseId, redirection_data: None, mandate_reference: None, connector_metadata: None, network_txn_id: None, connector_response_reference_id: None, incremental_authorization_allowed: None, status_code: item.http_code, }), resource_common_data: PaymentFlowData { status: enums::AttemptStatus::from(status), ..item.router_data.resource_common_data }, ..item.router_data }), } } None => Ok(Self { response: Ok(PaymentsResponseData::TransactionResponse { resource_id: ResponseId::NoResponseId, redirection_data: None, mandate_reference: None, connector_metadata: None, network_txn_id: None, connector_response_reference_id: None, incremental_authorization_allowed: None, status_code: item.http_code, }), resource_common_data: PaymentFlowData { status: item.router_data.resource_common_data.status, ..item.router_data.resource_common_data }, ..item.router_data }), } }
{ "chunk": null, "crate": "connector-integration", "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_connector-integration_-2217055865063992973
clm
function
// connector-service/backend/connector-integration/src/connectors/mifinity/transformers.rs fn from(item: MifinityPaymentStatus) -> Self { match item { MifinityPaymentStatus::Successful => Self::Charged, MifinityPaymentStatus::Failed => Self::Failure, MifinityPaymentStatus::NotCompleted => Self::AuthenticationPending, MifinityPaymentStatus::Pending => Self::Pending, } }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "from", "is_async": false, "is_pub": false, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_fn_connector-integration_1024659069897724651
clm
function
// connector-service/backend/connector-integration/src/connectors/stripe/transformers.rs fn get_request_incremental_authorization(&self) -> Option<bool> { None }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_request_incremental_authorization", "is_async": false, "is_pub": false, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_fn_connector-integration_-3994609864851356532
clm
function
// connector-service/backend/connector-integration/src/connectors/stripe/transformers.rs fn try_from( value: StripeRouterData< RouterDataV2<RepeatPayment, PaymentFlowData, RepeatPaymentData, PaymentsResponseData>, T, >, ) -> Result<Self, Self::Error> { let item = value.router_data; let mandate_metadata = match &item.request.mandate_reference { MandateReferenceId::ConnectorMandateId(mandate_data) => { Some(mandate_data.get_mandate_metadata()) } _ => None, }; let (transfer_account_id, charge_type, application_fees) = match mandate_metadata.as_ref().and_then(|s| s.as_ref()) { Some(secret_value) => { let json_value = secret_value.clone().expose(); let parsed: Result<StripeSplitPaymentRequest, _> = serde_json::from_value(json_value); match parsed { Ok(data) => ( data.transfer_account_id, data.charge_type, data.application_fees, ), Err(_) => (None, None, None), } } None => (None, None, None), }; let payment_method_token = match &item.request.split_payments { Some(domain_types::connector_types::SplitPaymentsRequest::StripeSplitPayment(_)) => { match item.resource_common_data.payment_method_token.clone() { Some(domain_types::router_data::PaymentMethodToken::Token(secret)) => { Some(secret) } _ => None, } } _ => None, }; let amount = StripeAmountConvertor::convert(item.request.minor_amount, item.request.currency)?; let order_id = item .resource_common_data .connector_request_reference_id .clone(); let shipping_address = match payment_method_token { Some(_) => None, None => Some(StripeShippingAddress { city: item.resource_common_data.get_optional_shipping_city(), country: item.resource_common_data.get_optional_shipping_country(), line1: item.resource_common_data.get_optional_shipping_line1(), line2: item.resource_common_data.get_optional_shipping_line2(), zip: item.resource_common_data.get_optional_shipping_zip(), state: item.resource_common_data.get_optional_shipping_state(), name: item.resource_common_data.get_optional_shipping_full_name(), phone: item .resource_common_data .get_optional_shipping_phone_number(), }), }; let ( mut payment_data, payment_method, billing_address, payment_method_types, setup_future_usage, ) = if payment_method_token.is_some() { (None, None, StripeBillingAddress::default(), None, None) } else { match &item.request.mandate_reference { MandateReferenceId::ConnectorMandateId(connector_mandate_ids) => ( None, connector_mandate_ids.get_connector_mandate_id(), StripeBillingAddress::default(), get_payment_method_type_for_saved_payment_method_payment(&item)?, None, ), MandateReferenceId::NetworkMandateId(_) | MandateReferenceId::NetworkTokenWithNTI(_) => { Err(ConnectorError::NotSupported { message: "This Mandate type is not yet supported".to_string(), connector: "Stripe", })? } } }; if payment_method_token.is_some() { payment_data = None }; let meta_data = get_transaction_metadata(item.request.metadata.clone(), order_id); // We pass browser_info only when payment_data exists. // Hence, we're pass Null during recurring payments as payment_method_data[type] is not passed let browser_info = if payment_data.is_some() && payment_method_token.is_none() { item.request .browser_info .clone() .map(StripeBrowserInformation::from) } else { None }; let charges = match &item.request.split_payments { Some(domain_types::connector_types::SplitPaymentsRequest::StripeSplitPayment( stripe_split_payment, )) => match &stripe_split_payment.charge_type { common_enums::PaymentChargeType::Stripe(charge_type) => match charge_type { common_enums::StripeChargeType::Direct => Some(IntentCharges { application_fee_amount: stripe_split_payment.application_fees, destination_account_id: None, }), common_enums::StripeChargeType::Destination => Some(IntentCharges { application_fee_amount: stripe_split_payment.application_fees, destination_account_id: Some(Secret::new( stripe_split_payment.transfer_account_id.clone(), )), }), }, }, None => None, }; let charges_in = if charges.is_none() { match charge_type { Some(common_enums::PaymentChargeType::Stripe( common_enums::StripeChargeType::Direct, )) => Some(IntentCharges { application_fee_amount: application_fees, // default to 0 if None destination_account_id: None, }), Some(common_enums::PaymentChargeType::Stripe( common_enums::StripeChargeType::Destination, )) => Some(IntentCharges { application_fee_amount: application_fees, destination_account_id: transfer_account_id, }), _ => None, } } else { charges }; let pm = match (payment_method, payment_method_token.clone()) { (Some(method), _) => Some(Secret::new(method)), (None, Some(token)) => Some(token), (None, None) => None, }; Ok(Self { amount, //hopefully we don't loose some cents here currency: item.request.currency.to_string(), //we need to copy the value and not transfer ownership statement_descriptor_suffix: None, statement_descriptor: None, meta_data, return_url: item .request .router_return_url .clone() .unwrap_or_else(|| "https://juspay.in/".to_string()), confirm: true, // Stripe requires confirm to be true if return URL is present description: item.resource_common_data.description.clone(), shipping: shipping_address, billing: billing_address, capture_method: StripeCaptureMethod::from(item.request.capture_method), payment_data, payment_method_options: None, payment_method: pm, customer: item .resource_common_data .connector_customer .clone() .map(Secret::new), setup_mandate_details: None, off_session: item.request.off_session, setup_future_usage, payment_method_types, expand: Some(ExpandableObjects::LatestCharge), browser_info, charges: charges_in, }) }
{ "chunk": null, "crate": "connector-integration", "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_connector-integration_1173613580111018141
clm
function
// connector-service/backend/connector-integration/src/connectors/stripe/transformers.rs fn from(item: RefundStatus) -> Self { match item { RefundStatus::Succeeded => Self::Success, RefundStatus::Failed => Self::Failure, RefundStatus::Pending => Self::Pending, RefundStatus::RequiresAction => Self::ManualReview, } }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "from", "is_async": false, "is_pub": false, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_fn_connector-integration_8518057686944955326
clm
function
// connector-service/backend/connector-integration/src/connectors/stripe/transformers.rs fn validate_shipping_address_against_payment_method( shipping_address: &Option<StripeShippingAddress>, payment_method: Option<&StripePaymentMethodType>, ) -> Result<(), error_stack::Report<ConnectorError>> { match payment_method { Some(StripePaymentMethodType::AfterpayClearpay) => match shipping_address { Some(address) => { let missing_fields = collect_missing_value_keys!( ("shipping.address.line1", address.line1), ("shipping.address.country", address.country), ("shipping.address.zip", address.zip) ); if !missing_fields.is_empty() { return Err(ConnectorError::MissingRequiredFields { field_names: missing_fields, } .into()); } Ok(()) } None => Err(ConnectorError::MissingRequiredField { field_name: "shipping.address", } .into()), }, _ => Ok(()), } }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "validate_shipping_address_against_payment_method", "is_async": false, "is_pub": false, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_fn_connector-integration_-8850820069584541922
clm
function
// connector-service/backend/connector-integration/src/connectors/stripe/transformers.rs fn get_stripe_payment_method_type_from_wallet_data( wallet_data: &WalletData, ) -> Result<Option<StripePaymentMethodType>, ConnectorError> { match wallet_data { WalletData::AliPayRedirect(_) => Ok(Some(StripePaymentMethodType::Alipay)), WalletData::ApplePay(_) => Ok(None), WalletData::GooglePay(_) => Ok(Some(StripePaymentMethodType::Card)), WalletData::WeChatPayQr(_) => Ok(Some(StripePaymentMethodType::Wechatpay)), WalletData::CashappQr(_) => Ok(Some(StripePaymentMethodType::Cashapp)), WalletData::AmazonPayRedirect(_) => Ok(Some(StripePaymentMethodType::AmazonPay)), WalletData::RevolutPay(_) => Ok(Some(StripePaymentMethodType::RevolutPay)), WalletData::MobilePayRedirect(_) => Err(ConnectorError::NotImplemented( get_unimplemented_payment_method_error_message("stripe"), )), WalletData::PaypalRedirect(_) | WalletData::AliPayQr(_) | WalletData::BluecodeRedirect {} | WalletData::AliPayHkRedirect(_) | WalletData::MomoRedirect(_) | WalletData::KakaoPayRedirect(_) | WalletData::GoPayRedirect(_) | WalletData::GcashRedirect(_) | WalletData::ApplePayRedirect(_) | WalletData::ApplePayThirdPartySdk(_) | WalletData::DanaRedirect {} | WalletData::GooglePayRedirect(_) | WalletData::GooglePayThirdPartySdk(_) | WalletData::MbWayRedirect(_) | WalletData::PaypalSdk(_) | WalletData::Paze(_) | WalletData::SamsungPay(_) | WalletData::TwintRedirect {} | WalletData::VippsRedirect {} | WalletData::TouchNGoRedirect(_) | WalletData::SwishQr(_) | WalletData::WeChatPayRedirect(_) | WalletData::Mifinity(_) => Err(ConnectorError::NotImplemented( get_unimplemented_payment_method_error_message("stripe"), )), } }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_stripe_payment_method_type_from_wallet_data", "is_async": false, "is_pub": false, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_fn_connector-integration_-5598417203105720999
clm
function
// connector-service/backend/connector-integration/src/connectors/stripe/transformers.rs fn get_bank_debit_data( bank_debit_data: &payment_method_data::BankDebitData, ) -> (StripePaymentMethodType, BankDebitData) { match bank_debit_data { payment_method_data::BankDebitData::AchBankDebit { account_number, routing_number, .. } => { let ach_data = BankDebitData::Ach { account_holder_type: "individual".to_string(), account_number: account_number.to_owned(), routing_number: routing_number.to_owned(), }; (StripePaymentMethodType::Ach, ach_data) } payment_method_data::BankDebitData::SepaBankDebit { iban, .. } => { let sepa_data: BankDebitData = BankDebitData::Sepa { iban: iban.to_owned(), }; (StripePaymentMethodType::Sepa, sepa_data) } payment_method_data::BankDebitData::BecsBankDebit { account_number, bsb_number, .. } => { let becs_data = BankDebitData::Becs { account_number: account_number.to_owned(), bsb_number: bsb_number.to_owned(), }; (StripePaymentMethodType::Becs, becs_data) } payment_method_data::BankDebitData::BacsBankDebit { account_number, sort_code, .. } => { let bacs_data = BankDebitData::Bacs { account_number: account_number.to_owned(), sort_code: Secret::new(sort_code.clone().expose().replace('-', "")), }; (StripePaymentMethodType::Bacs, bacs_data) } } }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_bank_debit_data", "is_async": false, "is_pub": false, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_fn_connector-integration_-8522391454159232776
clm
function
// connector-service/backend/connector-integration/src/connectors/stripe/transformers.rs fn create_stripe_payment_method< T: PaymentMethodDataTypes + std::fmt::Debug + std::marker::Sync + std::marker::Send + 'static + Serialize, >( payment_method_data: &PaymentMethodData<T>, payment_request_details: PaymentRequestDetails, ) -> Result< ( StripePaymentMethodData<T>, Option<StripePaymentMethodType>, StripeBillingAddress, ), error_stack::Report<ConnectorError>, > { match payment_method_data { PaymentMethodData::Card(card_details) => { let payment_method_auth_type = match payment_request_details.auth_type { common_enums::AuthenticationType::ThreeDs => Auth3ds::Any, common_enums::AuthenticationType::NoThreeDs => Auth3ds::Automatic, }; Ok(( StripePaymentMethodData::try_from(( card_details, payment_method_auth_type, payment_request_details.request_incremental_authorization, payment_request_details.request_extended_authorization, payment_request_details.request_overcapture, ))?, Some(StripePaymentMethodType::Card), payment_request_details.billing_address, )) } PaymentMethodData::PayLater(pay_later_data) => { let stripe_pm_type = StripePaymentMethodType::try_from(pay_later_data)?; Ok(( StripePaymentMethodData::PayLater(StripePayLaterData { payment_method_data_type: stripe_pm_type, }), Some(stripe_pm_type), payment_request_details.billing_address, )) } PaymentMethodData::BankRedirect(bank_redirect_data) => { let billing_address = if payment_request_details.is_customer_initiated_mandate_payment == Some(true) { mandatory_parameters_for_sepa_bank_debit_mandates( &Some(payment_request_details.billing_address.to_owned()), payment_request_details.is_customer_initiated_mandate_payment, )? } else { payment_request_details.billing_address }; let pm_type = StripePaymentMethodType::try_from(bank_redirect_data)?; let bank_redirect_data = StripePaymentMethodData::try_from(bank_redirect_data)?; Ok((bank_redirect_data, Some(pm_type), billing_address)) } PaymentMethodData::Wallet(wallet_data) => { let pm_type = get_stripe_payment_method_type_from_wallet_data(wallet_data)?; let wallet_specific_data = StripePaymentMethodData::try_from(( wallet_data, payment_request_details.payment_method_token, ))?; Ok(( wallet_specific_data, pm_type, StripeBillingAddress::default(), )) } PaymentMethodData::BankDebit(bank_debit_data) => { let (pm_type, bank_debit_data) = get_bank_debit_data(bank_debit_data); let pm_data = StripePaymentMethodData::BankDebit(StripeBankDebitData { bank_specific_data: bank_debit_data, }); Ok(( pm_data, Some(pm_type), payment_request_details.billing_address, )) } PaymentMethodData::BankTransfer(bank_transfer_data) => match bank_transfer_data.deref() { payment_method_data::BankTransferData::AchBankTransfer {} => Ok(( StripePaymentMethodData::BankTransfer(StripeBankTransferData::AchBankTransfer( Box::new(AchTransferData { payment_method_data_type: StripePaymentMethodType::CustomerBalance, bank_transfer_type: StripeCreditTransferTypes::AchCreditTransfer, payment_method_type: StripePaymentMethodType::CustomerBalance, balance_funding_type: BankTransferType::BankTransfers, }), )), None, StripeBillingAddress::default(), )), payment_method_data::BankTransferData::MultibancoBankTransfer {} => Ok(( StripePaymentMethodData::BankTransfer( StripeBankTransferData::MultibancoBankTransfers(Box::new( MultibancoTransferData { payment_method_data_type: StripeCreditTransferTypes::Multibanco, payment_method_type: StripeCreditTransferTypes::Multibanco, email: payment_request_details.billing_address.email.ok_or( ConnectorError::MissingRequiredField { field_name: "billing_address.email", }, )?, }, )), ), None, StripeBillingAddress::default(), )), payment_method_data::BankTransferData::SepaBankTransfer {} => Ok(( StripePaymentMethodData::BankTransfer(StripeBankTransferData::SepaBankTransfer( Box::new(SepaBankTransferData { payment_method_data_type: StripePaymentMethodType::CustomerBalance, bank_transfer_type: BankTransferType::EuBankTransfer, balance_funding_type: BankTransferType::BankTransfers, payment_method_type: StripePaymentMethodType::CustomerBalance, country: payment_request_details.billing_address.country.ok_or( ConnectorError::MissingRequiredField { field_name: "billing_address.country", }, )?, }), )), Some(StripePaymentMethodType::CustomerBalance), payment_request_details.billing_address, )), payment_method_data::BankTransferData::BacsBankTransfer {} => Ok(( StripePaymentMethodData::BankTransfer(StripeBankTransferData::BacsBankTransfers( Box::new(BacsBankTransferData { payment_method_data_type: StripePaymentMethodType::CustomerBalance, bank_transfer_type: BankTransferType::GbBankTransfer, balance_funding_type: BankTransferType::BankTransfers, payment_method_type: StripePaymentMethodType::CustomerBalance, }), )), Some(StripePaymentMethodType::CustomerBalance), payment_request_details.billing_address, )), payment_method_data::BankTransferData::Pix { .. } => Err( ConnectorError::NotImplemented(get_unimplemented_payment_method_error_message( "stripe", )) .into(), ), payment_method_data::BankTransferData::Pse {} | payment_method_data::BankTransferData::LocalBankTransfer { .. } | payment_method_data::BankTransferData::InstantBankTransfer {} | payment_method_data::BankTransferData::InstantBankTransferFinland { .. } | payment_method_data::BankTransferData::InstantBankTransferPoland { .. } | payment_method_data::BankTransferData::PermataBankTransfer { .. } | payment_method_data::BankTransferData::BcaBankTransfer { .. } | payment_method_data::BankTransferData::BniVaBankTransfer { .. } | payment_method_data::BankTransferData::BriVaBankTransfer { .. } | payment_method_data::BankTransferData::CimbVaBankTransfer { .. } | payment_method_data::BankTransferData::DanamonVaBankTransfer { .. } | payment_method_data::BankTransferData::MandiriVaBankTransfer { .. } => Err( ConnectorError::NotImplemented(get_unimplemented_payment_method_error_message( "stripe", )) .into(), ), }, PaymentMethodData::Crypto(_) => Err(ConnectorError::NotImplemented( get_unimplemented_payment_method_error_message("stripe"), ) .into()), PaymentMethodData::GiftCard(giftcard_data) => match giftcard_data.deref() { GiftCardData::Givex(_) | GiftCardData::PaySafeCard {} => Err( ConnectorError::NotImplemented(get_unimplemented_payment_method_error_message( "stripe", )) .into(), ), }, PaymentMethodData::CardRedirect(cardredirect_data) => match cardredirect_data { CardRedirectData::Knet {} | CardRedirectData::Benefit {} | CardRedirectData::MomoAtm {} | CardRedirectData::CardRedirect {} => Err(ConnectorError::NotImplemented( get_unimplemented_payment_method_error_message("stripe"), ) .into()), }, PaymentMethodData::Reward => Err(ConnectorError::NotImplemented( get_unimplemented_payment_method_error_message("stripe"), ) .into()), PaymentMethodData::Voucher(voucher_data) => match voucher_data { VoucherData::Boleto(_) | VoucherData::Oxxo => Err(ConnectorError::NotImplemented( get_unimplemented_payment_method_error_message("stripe"), ) .into()), VoucherData::Alfamart(_) | VoucherData::Efecty | VoucherData::PagoEfectivo | VoucherData::RedCompra | VoucherData::RedPagos | VoucherData::Indomaret(_) | VoucherData::SevenEleven(_) | VoucherData::Lawson(_) | VoucherData::MiniStop(_) | VoucherData::FamilyMart(_) | VoucherData::Seicomart(_) | VoucherData::PayEasy(_) => Err(ConnectorError::NotImplemented( get_unimplemented_payment_method_error_message("stripe"), ) .into()), }, PaymentMethodData::Upi(_) | PaymentMethodData::RealTimePayment(_) | PaymentMethodData::MobilePayment(_) | PaymentMethodData::MandatePayment | PaymentMethodData::OpenBanking(_) | PaymentMethodData::CardToken(_) | PaymentMethodData::NetworkToken(_) | PaymentMethodData::CardDetailsForNetworkTransactionId(_) => Err( ConnectorError::NotImplemented(get_unimplemented_payment_method_error_message( "stripe", )) .into(), ), } }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "create_stripe_payment_method", "is_async": false, "is_pub": false, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_fn_connector-integration_-4635542134191482774
clm
function
// connector-service/backend/connector-integration/src/connectors/stripe/transformers.rs fn get_stripe_card_network(card_network: common_enums::CardNetwork) -> Option<StripeCardNetwork> { match card_network { common_enums::CardNetwork::Visa => Some(StripeCardNetwork::Visa), common_enums::CardNetwork::Mastercard => Some(StripeCardNetwork::Mastercard), common_enums::CardNetwork::CartesBancaires => Some(StripeCardNetwork::CartesBancaires), common_enums::CardNetwork::AmericanExpress | common_enums::CardNetwork::JCB | common_enums::CardNetwork::DinersClub | common_enums::CardNetwork::Discover | common_enums::CardNetwork::UnionPay | common_enums::CardNetwork::Interac | common_enums::CardNetwork::RuPay | common_enums::CardNetwork::Maestro | common_enums::CardNetwork::Star | common_enums::CardNetwork::Accel | common_enums::CardNetwork::Pulse | common_enums::CardNetwork::Nyce => None, } }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_stripe_card_network", "is_async": false, "is_pub": false, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_fn_connector-integration_7891244608112781997
clm
function
// connector-service/backend/connector-integration/src/connectors/stripe/transformers.rs fn get_stripe_overcapture_request( enable_overcapture: bool, ) -> Option<StripeRequestOvercaptureBool> { match enable_overcapture { true => Some(StripeRequestOvercaptureBool::IfAvailable), false => None, } }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_stripe_overcapture_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_connector-integration_-8968230207100467703
clm
function
// connector-service/backend/connector-integration/src/connectors/stripe/transformers.rs pub fn get_overcapture_status(&self) -> Option<bool> { match self { Self::ChargeObject(charge_object) => charge_object .payment_method_details .as_ref() .and_then(|payment_method_details| match payment_method_details { StripePaymentMethodDetailsResponse::Card { card } => card .overcapture .as_ref() .and_then(|overcapture| match overcapture.status { Some(StripeOvercaptureStatus::Available) => Some(true), Some(StripeOvercaptureStatus::Unavailable) => Some(false), None => None, }), _ => None, }), _ => None, } }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_overcapture_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_connector-integration_-6203313107654536436
clm
function
// connector-service/backend/connector-integration/src/connectors/stripe/transformers.rs pub fn get_maximum_capturable_amount(&self) -> Option<MinorUnit> { match self { Self::ChargeObject(charge_object) => { if let Some(payment_method_details) = charge_object.payment_method_details.as_ref() { match payment_method_details { StripePaymentMethodDetailsResponse::Card { card } => card .overcapture .as_ref() .and_then(|overcapture| overcapture.maximum_amount_capturable), _ => None, } } else { None } } _ => None, } }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_maximum_capturable_amount", "is_async": false, "is_pub": true, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_fn_connector-integration_6025635716755371410
clm
function
// connector-service/backend/connector-integration/src/connectors/stripe/transformers.rs fn deref(&self) -> &Self::Target { &self.setup_intent_fields }
{ "chunk": null, "crate": "connector-integration", "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_connector-integration_6531673111307194203
clm
function
// connector-service/backend/connector-integration/src/connectors/stripe/transformers.rs pub fn get_additional_payment_method_data(&self) -> Option<AdditionalPaymentMethodDetails> { match self { Self::Card { card } => Some(AdditionalPaymentMethodDetails { payment_checks: card.checks.clone(), authentication_details: card.three_d_secure.clone(), extended_authorization: card.extended_authorization.clone(), capture_before: card.capture_before, }), Self::Ideal { .. } | Self::Bancontact { .. } | Self::Blik | Self::Eps | Self::Fpx | Self::Giropay | Self::Przelewy24 | Self::Klarna | Self::Affirm | Self::AfterpayClearpay | Self::AmazonPay | Self::ApplePay | Self::Ach | Self::Sepa | Self::Becs | Self::Bacs | Self::Wechatpay | Self::Alipay | Self::CustomerBalance | Self::RevolutPay | Self::Cashapp { .. } => None, } }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_additional_payment_method_data", "is_async": false, "is_pub": true, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_fn_connector-integration_-6852380513523657294
clm
function
// connector-service/backend/connector-integration/src/connectors/stripe/transformers.rs fn extract_payment_method_connector_response_from_latest_charge( stripe_charge_enum: &StripeChargeEnum, ) -> Option<ConnectorResponseData> { let is_overcapture_enabled = stripe_charge_enum.get_overcapture_status(); let additional_payment_method_details = if let StripeChargeEnum::ChargeObject(charge_object) = stripe_charge_enum { charge_object .payment_method_details .as_ref() .and_then(StripePaymentMethodDetailsResponse::get_additional_payment_method_data) } else { None }; let additional_payment_method_data = additional_payment_method_details .as_ref() .map(AdditionalPaymentMethodConnectorResponse::from); let extended_authorization_data = additional_payment_method_details .as_ref() .map(ExtendedAuthorizationResponseData::from); if additional_payment_method_data.is_some() || extended_authorization_data.is_some() || is_overcapture_enabled.is_some() { Some(ConnectorResponseData::new( additional_payment_method_data, is_overcapture_enabled, extended_authorization_data, )) } else { None } }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "extract_payment_method_connector_response_from_latest_charge", "is_async": false, "is_pub": false, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_fn_connector-integration_1369774013258447293
clm
function
// connector-service/backend/connector-integration/src/connectors/stripe/transformers.rs pub fn get_connector_metadata( next_action: Option<&StripeNextActionResponse>, amount: MinorUnit, ) -> CustomResult<Option<Value>, ConnectorError> { let next_action_response = next_action .and_then(|next_action_response| match next_action_response { StripeNextActionResponse::DisplayBankTransferInstructions(response) => { match response.financial_addresses.clone() { FinancialInformation::StripeFinancialInformation(financial_addresses) => { let bank_instructions = financial_addresses.first(); let (sepa_bank_instructions, bacs_bank_instructions) = bank_instructions .map_or((None, None), |financial_address| { ( financial_address.iban.to_owned().map( |sepa_financial_details| SepaFinancialDetails { account_holder_name: sepa_financial_details .account_holder_name, bic: sepa_financial_details.bic, country: sepa_financial_details.country, iban: sepa_financial_details.iban, reference: response.reference.to_owned(), }, ), financial_address.sort_code.to_owned(), ) }); let bank_transfer_instructions = SepaAndBacsBankTransferInstructions { sepa_bank_instructions, bacs_bank_instructions, receiver: SepaAndBacsReceiver { amount_received: amount - response.amount_remaining, amount_remaining: response.amount_remaining, }, }; Some(bank_transfer_instructions.encode_to_value()) } FinancialInformation::AchFinancialInformation(financial_addresses) => { let mut ach_financial_information = HashMap::new(); for address in financial_addresses { match address.financial_details { AchFinancialDetails::Aba(aba_details) => { ach_financial_information .insert("account_number", aba_details.account_number); ach_financial_information .insert("bank_name", aba_details.bank_name); ach_financial_information .insert("routing_number", aba_details.routing_number); } AchFinancialDetails::Swift(swift_details) => { ach_financial_information .insert("swift_code", swift_details.swift_code); } } } let ach_financial_information_value = serde_json::to_value(ach_financial_information).ok()?; let ach_transfer_instruction = serde_json::from_value::<AchTransfer>(ach_financial_information_value) .ok()?; let bank_transfer_instructions = BankTransferNextStepsData { bank_transfer_instructions: BankTransferInstructions::AchCreditTransfer( Box::new(ach_transfer_instruction), ), receiver: None, }; Some(bank_transfer_instructions.encode_to_value()) } } } StripeNextActionResponse::WechatPayDisplayQrCode(response) => { let wechat_pay_instructions = QrCodeNextInstructions { image_data_url: response.image_data_url.to_owned(), display_to_timestamp: None, }; Some(wechat_pay_instructions.encode_to_value()) } StripeNextActionResponse::CashappHandleRedirectOrDisplayQrCode(response) => { let cashapp_qr_instructions: QrCodeNextInstructions = QrCodeNextInstructions { image_data_url: response.qr_code.image_url_png.to_owned(), display_to_timestamp: response.qr_code.expires_at.to_owned(), }; Some(cashapp_qr_instructions.encode_to_value()) } StripeNextActionResponse::MultibancoDisplayDetails(response) => { let multibanco_bank_transfer_instructions = BankTransferNextStepsData { bank_transfer_instructions: BankTransferInstructions::Multibanco(Box::new( MultibancoTransferInstructions { reference: response.clone().reference, entity: response.clone().entity.expose(), }, )), receiver: None, }; Some(multibanco_bank_transfer_instructions.encode_to_value()) } _ => None, }) .transpose() .change_context(ConnectorError::ResponseHandlingFailed)?; Ok(next_action_response) }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_connector_metadata", "is_async": false, "is_pub": true, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_fn_connector-integration_8571177012977070044
clm
function
// connector-service/backend/connector-integration/src/connectors/stripe/transformers.rs pub fn get_payment_method_id( latest_charge: Option<StripeChargeEnum>, payment_method_id_from_intent_root: Secret<String>, ) -> String { match latest_charge { Some(StripeChargeEnum::ChargeObject(charge)) => match charge.payment_method_details { Some(StripePaymentMethodDetailsResponse::Bancontact { bancontact }) => bancontact .attached_payment_method .map(|attached_payment_method| attached_payment_method.expose()) .unwrap_or(payment_method_id_from_intent_root.expose()), Some(StripePaymentMethodDetailsResponse::Ideal { ideal }) => ideal .attached_payment_method .map(|attached_payment_method| attached_payment_method.expose()) .unwrap_or(payment_method_id_from_intent_root.expose()), Some(StripePaymentMethodDetailsResponse::Blik) | Some(StripePaymentMethodDetailsResponse::Eps) | Some(StripePaymentMethodDetailsResponse::Fpx) | Some(StripePaymentMethodDetailsResponse::Giropay) | Some(StripePaymentMethodDetailsResponse::Przelewy24) | Some(StripePaymentMethodDetailsResponse::Card { .. }) | Some(StripePaymentMethodDetailsResponse::Klarna) | Some(StripePaymentMethodDetailsResponse::Affirm) | Some(StripePaymentMethodDetailsResponse::AfterpayClearpay) | Some(StripePaymentMethodDetailsResponse::AmazonPay) | Some(StripePaymentMethodDetailsResponse::ApplePay) | Some(StripePaymentMethodDetailsResponse::Ach) | Some(StripePaymentMethodDetailsResponse::Sepa) | Some(StripePaymentMethodDetailsResponse::Becs) | Some(StripePaymentMethodDetailsResponse::Bacs) | Some(StripePaymentMethodDetailsResponse::Wechatpay) | Some(StripePaymentMethodDetailsResponse::Alipay) | Some(StripePaymentMethodDetailsResponse::CustomerBalance) | Some(StripePaymentMethodDetailsResponse::Cashapp { .. }) | Some(StripePaymentMethodDetailsResponse::RevolutPay) | None => payment_method_id_from_intent_root.expose(), }, Some(StripeChargeEnum::ChargeId(_)) | None => payment_method_id_from_intent_root.expose(), } }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_payment_method_id", "is_async": false, "is_pub": true, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_fn_connector-integration_-4318103245275833434
clm
function
// connector-service/backend/connector-integration/src/connectors/stripe/transformers.rs fn extract_payment_method_connector_response_from_latest_attempt( stripe_latest_attempt: &LatestAttempt, ) -> Option<ConnectorResponseData> { if let LatestAttempt::PaymentIntentAttempt(intent_attempt) = stripe_latest_attempt { intent_attempt .payment_method_details .as_ref() .and_then(StripePaymentMethodDetailsResponse::get_additional_payment_method_data) } else { None } .as_ref() .map(AdditionalPaymentMethodConnectorResponse::from) .map(ConnectorResponseData::with_additional_payment_method_data) }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "extract_payment_method_connector_response_from_latest_attempt", "is_async": false, "is_pub": false, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_fn_connector-integration_-1974308769895143293
clm
function
// connector-service/backend/connector-integration/src/connectors/stripe/transformers.rs pub fn stripe_opt_latest_attempt_to_opt_string( latest_attempt: Option<LatestAttempt>, ) -> Option<String> { match latest_attempt { Some(LatestAttempt::PaymentIntentAttempt(attempt)) => attempt .payment_method_options .and_then(|payment_method_options| match payment_method_options { StripePaymentMethodOptions::Card { network_transaction_id, .. } => network_transaction_id.map(|network_id| network_id.expose()), _ => None, }), _ => None, } }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "stripe_opt_latest_attempt_to_opt_string", "is_async": false, "is_pub": true, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_fn_connector-integration_-3003017068298081302
clm
function
// connector-service/backend/connector-integration/src/connectors/stripe/transformers.rs fn get_url(&self) -> Option<url::Url> { match self { Self::RedirectToUrl(redirect_to_url) | Self::AlipayHandleRedirect(redirect_to_url) => { Some(redirect_to_url.url.to_owned()) } Self::WechatPayDisplayQrCode(_) => None, Self::VerifyWithMicrodeposits(verify_with_microdeposits) => { Some(verify_with_microdeposits.hosted_verification_url.to_owned()) } Self::CashappHandleRedirectOrDisplayQrCode(_) => None, Self::DisplayBankTransferInstructions(_) => None, Self::MultibancoDisplayDetails(_) => None, Self::NoNextActionBody => None, } }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_url", "is_async": false, "is_pub": false, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_fn_connector-integration_-9207417217826604558
clm
function
// connector-service/backend/connector-integration/src/connectors/stripe/transformers.rs fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> { #[derive(Deserialize)] struct Wrapper { #[serde(rename = "type")] _ignore: String, #[serde(flatten, with = "StripeNextActionResponse")] inner: StripeNextActionResponse, } // There is some exception in the stripe next action, it usually sends : // "next_action": { // "redirect_to_url": { "return_url": "...", "url": "..." }, // "type": "redirect_to_url" // }, // But there is a case where it only sends the type and not other field named as it's type let stripe_next_action_response = Wrapper::deserialize(deserializer).map_or(Self::NoNextActionBody, |w| w.inner); Ok(stripe_next_action_response) }
{ "chunk": null, "crate": "connector-integration", "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_connector-integration_-4265241655935995837
clm
function
// connector-service/backend/connector-integration/src/connectors/stripe/transformers.rs fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where S: serde::Serializer, { match *self { Self::CashappHandleRedirectOrDisplayQrCode(ref i) => { Serialize::serialize(i, serializer) } Self::RedirectToUrl(ref i) => Serialize::serialize(i, serializer), Self::AlipayHandleRedirect(ref i) => Serialize::serialize(i, serializer), Self::VerifyWithMicrodeposits(ref i) => Serialize::serialize(i, serializer), Self::WechatPayDisplayQrCode(ref i) => Serialize::serialize(i, serializer), Self::DisplayBankTransferInstructions(ref i) => Serialize::serialize(i, serializer), Self::MultibancoDisplayDetails(ref i) => Serialize::serialize(i, serializer), Self::NoNextActionBody => Serialize::serialize("NoNextActionBody", serializer), } }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "serialize", "is_async": false, "is_pub": false, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_fn_connector-integration_5655059225716532881
clm
function
// connector-service/backend/connector-integration/src/connectors/stripe/transformers.rs fn mandatory_parameters_for_sepa_bank_debit_mandates( billing_details: &Option<StripeBillingAddress>, is_customer_initiated_mandate_payment: Option<bool>, ) -> Result<StripeBillingAddress, ConnectorError> { let billing_name = billing_details .clone() .and_then(|billing_data| billing_data.name.clone()); let billing_email = billing_details .clone() .and_then(|billing_data| billing_data.email.clone()); match is_customer_initiated_mandate_payment { Some(true) => Ok(StripeBillingAddress { name: Some(billing_name.ok_or(ConnectorError::MissingRequiredField { field_name: "billing_name", })?), email: Some(billing_email.ok_or(ConnectorError::MissingRequiredField { field_name: "billing_email", })?), ..StripeBillingAddress::default() }), Some(false) | None => Ok(StripeBillingAddress { name: billing_name, email: billing_email, ..StripeBillingAddress::default() }), } }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "mandatory_parameters_for_sepa_bank_debit_mandates", "is_async": false, "is_pub": false, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_fn_connector-integration_8735047973494365850
clm
function
// connector-service/backend/connector-integration/src/connectors/stripe/transformers.rs fn get_transaction_metadata( merchant_metadata: Option<Secret<Value>>, order_id: String, ) -> HashMap<String, String> { let mut meta_data = HashMap::from([("metadata[order_id]".to_string(), order_id)]); let mut request_hash_map = HashMap::new(); if let Some(metadata) = merchant_metadata { let hashmap: HashMap<String, Value> = serde_json::from_str(&metadata.peek().to_string()).unwrap_or(HashMap::new()); for (key, value) in hashmap { request_hash_map.insert(format!("metadata[{key}]"), value.to_string()); } meta_data.extend(request_hash_map) }; meta_data }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_transaction_metadata", "is_async": false, "is_pub": false, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_fn_connector-integration_3511277782673471065
clm
function
// connector-service/backend/connector-integration/src/connectors/stripe/transformers.rs fn get_stripe_payments_response_data( response: &Option<ErrorDetails>, http_code: u16, response_id: String, ) -> Box<Result<PaymentsResponseData, domain_types::router_data::ErrorResponse>> { let (code, error_message) = match response { Some(error_details) => ( error_details .code .to_owned() .unwrap_or_else(|| consts::NO_ERROR_CODE.to_string()), error_details .message .to_owned() .unwrap_or_else(|| consts::NO_ERROR_MESSAGE.to_string()), ), None => ( consts::NO_ERROR_CODE.to_string(), consts::NO_ERROR_MESSAGE.to_string(), ), }; Box::new(Err(domain_types::router_data::ErrorResponse { code, message: error_message.clone(), reason: response.clone().and_then(|res| { res.decline_code .clone() .map(|decline_code| { format!("message - {error_message}, decline_code - {decline_code}") }) .or(Some(error_message.clone())) }), status_code: http_code, attempt_status: None, connector_transaction_id: Some(response_id), network_advice_code: response .as_ref() .and_then(|res| res.network_advice_code.clone()), network_decline_code: response .as_ref() .and_then(|res| res.network_decline_code.clone()), network_error_message: response .as_ref() .and_then(|res| res.decline_code.clone().or(res.advice_code.clone())), })) }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_stripe_payments_response_data", "is_async": false, "is_pub": false, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_fn_connector-integration_-7552552949357001475
clm
function
// connector-service/backend/connector-integration/src/connectors/stripe/transformers.rs pub fn construct_charge_response<T>( charge_id: String, request: &T, ) -> Option<domain_types::connector_types::ConnectorChargeResponseData> where T: SplitPaymentData, { let charge_request = request.get_split_payment_data(); if let Some(domain_types::connector_types::SplitPaymentsRequest::StripeSplitPayment( stripe_split_payment, )) = charge_request { let stripe_charge_response = domain_types::connector_types::StripeChargeResponseData { charge_id: Some(charge_id), charge_type: stripe_split_payment.charge_type, application_fees: stripe_split_payment.application_fees, transfer_account_id: stripe_split_payment.transfer_account_id, }; Some( domain_types::connector_types::ConnectorChargeResponseData::StripeSplitPayment( stripe_charge_response, ), ) } else { None } }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "construct_charge_response", "is_async": false, "is_pub": true, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_fn_connector-integration_5659715827989969682
clm
function
// connector-service/backend/connector-integration/src/connectors/stripe/transformers.rs pub(super) fn transform_headers_for_connect_platform( charge_type: common_enums::PaymentChargeType, transfer_account_id: Secret<String>, header: &mut Vec<(String, Maskable<String>)>, ) { if let common_enums::PaymentChargeType::Stripe(common_enums::StripeChargeType::Direct) = charge_type { let mut customer_account_header = vec![( STRIPE_COMPATIBLE_CONNECT_ACCOUNT.to_string(), transfer_account_id.into_masked(), )]; header.append(&mut customer_account_header); } }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "transform_headers_for_connect_platform", "is_async": false, "is_pub": true, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_fn_connector-integration_5162255066699953247
clm
function
// connector-service/backend/connector-integration/src/connectors/stripe/transformers.rs fn get_payment_method_type_for_saved_payment_method_payment( item: &RouterDataV2<RepeatPayment, PaymentFlowData, RepeatPaymentData, PaymentsResponseData>, ) -> Result<Option<StripePaymentMethodType>, error_stack::Report<ConnectorError>> { if item.resource_common_data.payment_method == common_enums::PaymentMethod::Card { Ok(Some(StripePaymentMethodType::Card)) //stripe takes ["Card"] as default } else { let stripe_payment_method_type = match item .resource_common_data .recurring_mandate_payment_data .clone() { Some(recurring_payment_method_data) => { match recurring_payment_method_data.payment_method_type { Some(payment_method_type) => { StripePaymentMethodType::try_from(payment_method_type) } None => Err(ConnectorError::MissingRequiredField { field_name: "payment_method_type", } .into()), } } None => Err(ConnectorError::MissingRequiredField { field_name: "recurring_mandate_payment_data", } .into()), }?; match stripe_payment_method_type { //Stripe converts Ideal, Bancontact & Sofort Bank redirect methods to Sepa direct debit and attaches to the customer for future usage StripePaymentMethodType::Ideal | StripePaymentMethodType::Bancontact | StripePaymentMethodType::Sofort => Ok(Some(StripePaymentMethodType::Sepa)), _ => Ok(Some(stripe_payment_method_type)), } } }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "get_payment_method_type_for_saved_payment_method_payment", "is_async": false, "is_pub": false, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_fn_connector-integration_1303099440923219256
clm
function
// connector-service/backend/connector-integration/src/utils/xml_utils.rs pub fn preprocess_xml_response_bytes(xml_data: Bytes) -> Result<Bytes, errors::ConnectorError> { // Log raw bytes for debugging tracing::info!(bytes=?xml_data, "Raw XML bytes received for preprocessing"); // Convert to UTF-8 string let response_str = std::str::from_utf8(&xml_data) .map_err(|_| errors::ConnectorError::ResponseDeserializationFailed)? .trim(); // Handle XML declarations by removing them if present let cleaned_response = if response_str.starts_with("<?xml") { // Find the end of the XML declaration and skip it match response_str.find("?>") { Some(pos) => { let substring = &response_str[pos + 2..]; let cleaned = substring.trim(); tracing::info!("Removed XML declaration: {}", cleaned); cleaned } None => { tracing::warn!("XML declaration start found but no closing '?>' tag"); response_str } } } else { tracing::info!("No XML declaration found, using as-is"); response_str }; // Ensure the XML has a txn wrapper if needed let final_xml = if !cleaned_response.starts_with("<txn>") && (cleaned_response.contains("<ssl_") || cleaned_response.contains("<error")) { format!("<txn>{cleaned_response}</txn>") } else { cleaned_response.to_string() }; // Parse XML to a generic JSON Value let json_value: Value = match quick_xml::de::from_str(&final_xml) { Ok(val) => { tracing::info!("Successfully converted XML to JSON structure"); val } Err(err) => { tracing::error!(error=?err, "Failed to parse XML to JSON structure"); // Create a basic JSON structure with error information return Err(errors::ConnectorError::ResponseDeserializationFailed); } }; // Extract and flatten the JSON structure let flattened_json = flatten_json_structure(json_value); // Convert JSON Value to string and then to bytes let json_string = serde_json::to_string(&flattened_json).map_err(|e| { tracing::error!(error=?e, "Failed to convert to JSON string"); errors::ConnectorError::ResponseDeserializationFailed })?; tracing::info!(json=?json_string, "Flattened JSON structure"); // Return JSON as bytes Ok(Bytes::from(json_string.into_bytes())) }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "preprocess_xml_response_bytes", "is_async": false, "is_pub": true, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_fn_connector-integration_4550111238108691031
clm
function
// connector-service/backend/connector-integration/src/utils/xml_utils.rs pub fn flatten_json_structure(json_value: Value) -> Value { let mut flattened = Map::new(); // Extract txn object if present let txn_obj = if let Some(obj) = json_value.as_object() { if let Some(txn) = obj.get("txn") { txn.as_object() } else { Some(obj) } } else { None }; // Process the fields if let Some(obj) = txn_obj { for (key, value) in obj { // Handle nested "$text" fields if let Some(value_obj) = value.as_object() { if let Some(text_value) = value_obj.get("$text") { // Extract the value from "$text" field flattened.insert(key.clone(), text_value.clone()); } else if value_obj.is_empty() { // Empty object, insert empty string flattened.insert(key.clone(), Value::String("".to_string())); } else { // Use the value as is flattened.insert(key.clone(), value.clone()); } } else { // Use the value as is flattened.insert(key.clone(), value.clone()); } } } Value::Object(flattened) }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "flatten_json_structure", "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_-2040736929169419118
clm
function
// connector-service/backend/tracing-kafka/src/lib.rs pub fn init() { tracing::warn!("Kafka metrics feature is not enabled. Metrics will not be collected."); }
{ "chunk": null, "crate": "tracing-kafka", "enum_name": null, "file_size": null, "for_type": null, "function_name": "init", "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_5072961068641949251
clm
function
// connector-service/backend/tracing-kafka/src/metrics.rs pub fn initialize_all_metrics() { // Force evaluation of all lazy metrics to fail fast if registration fails. let _ = &*KAFKA_LOGS_SENT; let _ = &*KAFKA_LOGS_DROPPED; let _ = &*KAFKA_QUEUE_SIZE; let _ = &*KAFKA_DROPS_QUEUE_FULL; let _ = &*KAFKA_DROPS_MSG_TOO_LARGE; let _ = &*KAFKA_DROPS_TIMEOUT; let _ = &*KAFKA_DROPS_OTHER; let _ = &*KAFKA_AUDIT_EVENTS_SENT; let _ = &*KAFKA_AUDIT_EVENTS_DROPPED; let _ = &*KAFKA_AUDIT_EVENT_QUEUE_SIZE; let _ = &*KAFKA_AUDIT_DROPS_QUEUE_FULL; let _ = &*KAFKA_AUDIT_DROPS_MSG_TOO_LARGE; let _ = &*KAFKA_AUDIT_DROPS_TIMEOUT; let _ = &*KAFKA_AUDIT_DROPS_OTHER; }
{ "chunk": null, "crate": "tracing-kafka", "enum_name": null, "file_size": null, "for_type": null, "function_name": "initialize_all_metrics", "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_-1568421221257796721
clm
function
// connector-service/backend/tracing-kafka/src/writer.rs fn delivery(&self, delivery_result: &DeliveryResult<'_>, opaque: Self::DeliveryOpaque) { let message_type = *opaque; let is_success = delivery_result.is_ok(); #[cfg(feature = "kafka-metrics")] { match (message_type, is_success) { (KafkaMessageType::Event, true) => KAFKA_AUDIT_EVENTS_SENT.inc(), (KafkaMessageType::Event, false) => KAFKA_AUDIT_EVENTS_DROPPED.inc(), (KafkaMessageType::Log, true) => KAFKA_LOGS_SENT.inc(), (KafkaMessageType::Log, false) => KAFKA_LOGS_DROPPED.inc(), } } if let Err((kafka_error, _)) = delivery_result { #[cfg(feature = "kafka-metrics")] match (message_type, &kafka_error) { ( KafkaMessageType::Event, KafkaError::MessageProduction(RDKafkaErrorCode::QueueFull), ) => { KAFKA_AUDIT_DROPS_QUEUE_FULL.inc(); } ( KafkaMessageType::Event, KafkaError::MessageProduction(RDKafkaErrorCode::MessageSizeTooLarge), ) => { KAFKA_AUDIT_DROPS_MSG_TOO_LARGE.inc(); } ( KafkaMessageType::Event, KafkaError::MessageProduction(RDKafkaErrorCode::MessageTimedOut), ) => { KAFKA_AUDIT_DROPS_TIMEOUT.inc(); } (KafkaMessageType::Event, _) => { KAFKA_AUDIT_DROPS_OTHER.inc(); } ( KafkaMessageType::Log, KafkaError::MessageProduction(RDKafkaErrorCode::QueueFull), ) => { KAFKA_DROPS_QUEUE_FULL.inc(); } ( KafkaMessageType::Log, KafkaError::MessageProduction(RDKafkaErrorCode::MessageSizeTooLarge), ) => { KAFKA_DROPS_MSG_TOO_LARGE.inc(); } ( KafkaMessageType::Log, KafkaError::MessageProduction(RDKafkaErrorCode::MessageTimedOut), ) => { KAFKA_DROPS_TIMEOUT.inc(); } (KafkaMessageType::Log, _) => { KAFKA_DROPS_OTHER.inc(); } } } }
{ "chunk": null, "crate": "tracing-kafka", "enum_name": null, "file_size": null, "for_type": null, "function_name": "delivery", "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_tracing-kafka_-274270537329133485
clm
function
// connector-service/backend/tracing-kafka/src/writer.rs fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { f.debug_struct("KafkaWriter") .field("topic", &self.topic) .finish() }
{ "chunk": null, "crate": "tracing-kafka", "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_tracing-kafka_290730444913273393
clm
function
// connector-service/backend/tracing-kafka/src/writer.rs pub fn new( brokers: Vec<String>, topic: String, batch_size: Option<usize>, linger_ms: Option<u64>, queue_buffering_max_messages: Option<usize>, queue_buffering_max_kbytes: Option<usize>, reconnect_backoff_min_ms: Option<u64>, reconnect_backoff_max_ms: Option<u64>, ) -> Result<Self, KafkaWriterError> { let mut config = ClientConfig::new(); config.set("bootstrap.servers", brokers.join(",")); if let Some(min_backoff) = reconnect_backoff_min_ms { config.set("reconnect.backoff.ms", min_backoff.to_string()); } if let Some(max_backoff) = reconnect_backoff_max_ms { config.set("reconnect.backoff.max.ms", max_backoff.to_string()); } if let Some(max_messages) = queue_buffering_max_messages { config.set("queue.buffering.max.messages", max_messages.to_string()); } if let Some(max_kbytes) = queue_buffering_max_kbytes { config.set("queue.buffering.max.kbytes", max_kbytes.to_string()); } if let Some(size) = batch_size { config.set("batch.size", size.to_string()); } if let Some(ms) = linger_ms { config.set("linger.ms", ms.to_string()); } let producer: ThreadedProducer<MetricsProducerContext> = config .create_with_context(MetricsProducerContext) .map_err(KafkaWriterError::ProducerCreation)?; producer .client() .fetch_metadata(Some(&topic), Duration::from_secs(5)) .map_err(KafkaWriterError::MetadataFetch)?; Ok(Self { producer: Arc::new(producer), topic, }) }
{ "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_7845295661283135444
clm
function
// connector-service/backend/tracing-kafka/src/writer.rs pub fn publish_event( &self, topic: &str, key: Option<&str>, payload: &[u8], headers: Option<OwnedHeaders>, ) -> Result<(), KafkaError> { #[cfg(feature = "kafka-metrics")] { let queue_size = self.producer.in_flight_count(); KAFKA_AUDIT_EVENT_QUEUE_SIZE.set(queue_size.into()); } let mut record = BaseRecord::with_opaque_to(topic, Box::new(KafkaMessageType::Event)) .payload(payload) .timestamp( std::time::SystemTime::now() .duration_since(std::time::UNIX_EPOCH) .map(|d| d.as_millis().try_into().unwrap_or(0)) .unwrap_or(0), ); if let Some(k) = key { record = record.key(k); } if let Some(h) = headers { record = record.headers(h); } match self.producer.send(record) { Ok(_) => Ok(()), Err((kafka_error, _)) => { #[cfg(feature = "kafka-metrics")] { KAFKA_AUDIT_EVENTS_DROPPED.inc(); // Only QUEUE_FULL can happen during send() - others happen during delivery match &kafka_error { KafkaError::MessageProduction(RDKafkaErrorCode::QueueFull) => { KAFKA_AUDIT_DROPS_QUEUE_FULL.inc(); } _ => { KAFKA_AUDIT_DROPS_OTHER.inc(); } } } Err(kafka_error) } } }
{ "chunk": null, "crate": "tracing-kafka", "enum_name": null, "file_size": null, "for_type": null, "function_name": "publish_event", "is_async": false, "is_pub": true, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_fn_tracing-kafka_-6789315670939671809
clm
function
// connector-service/backend/tracing-kafka/src/writer.rs pub fn builder() -> crate::builder::KafkaWriterBuilder { crate::builder::KafkaWriterBuilder::new() }
{ "chunk": null, "crate": "tracing-kafka", "enum_name": null, "file_size": null, "for_type": null, "function_name": "builder", "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_5832403107327964822
clm
function
// connector-service/backend/tracing-kafka/src/writer.rs fn write(&mut self, buf: &[u8]) -> io::Result<usize> { #[cfg(feature = "kafka-metrics")] { let queue_size = self.producer.in_flight_count(); KAFKA_QUEUE_SIZE.set(queue_size.into()); } let record = BaseRecord::with_opaque_to(&self.topic, Box::new(KafkaMessageType::Log)) .payload(buf) .timestamp( std::time::SystemTime::now() .duration_since(std::time::UNIX_EPOCH) .map(|d| d.as_millis().try_into().unwrap_or(0)) .unwrap_or(0), ); if let Err((kafka_error, _)) = self.producer.send::<(), [u8]>(record) { #[cfg(feature = "kafka-metrics")] { KAFKA_LOGS_DROPPED.inc(); match &kafka_error { KafkaError::MessageProduction(RDKafkaErrorCode::QueueFull) => { KAFKA_DROPS_QUEUE_FULL.inc(); } _ => { KAFKA_DROPS_OTHER.inc(); } } } } // Return Ok to not block the application. The actual delivery result // is handled by the callback in the background. Ok(buf.len()) }
{ "chunk": null, "crate": "tracing-kafka", "enum_name": null, "file_size": null, "for_type": null, "function_name": "write", "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_tracing-kafka_2916428861070231651
clm
function
// connector-service/backend/tracing-kafka/src/writer.rs fn flush(&mut self) -> io::Result<()> { self.producer .flush(rdkafka::util::Timeout::After(Duration::from_secs(5))) .map_err(|e: KafkaError| io::Error::other(format!("Kafka flush failed: {e}"))) }
{ "chunk": null, "crate": "tracing-kafka", "enum_name": null, "file_size": null, "for_type": null, "function_name": "flush", "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_tracing-kafka_-7679242722153340298
clm
function
// connector-service/backend/tracing-kafka/src/writer.rs fn make_writer(&'a self) -> Self::Writer { self.clone() }
{ "chunk": null, "crate": "tracing-kafka", "enum_name": null, "file_size": null, "for_type": null, "function_name": "make_writer", "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_tracing-kafka_-3597087384805780269
clm
function
// connector-service/backend/tracing-kafka/src/writer.rs fn drop(&mut self) { // Only flush if this is the last reference to the producer if Arc::strong_count(&self.producer) == 1 { // Try to flush pending messages with a 5 second timeout let _ = self .producer .flush(rdkafka::util::Timeout::After(Duration::from_secs(5))); } }
{ "chunk": null, "crate": "tracing-kafka", "enum_name": null, "file_size": null, "for_type": null, "function_name": "drop", "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_tracing-kafka_5456896285394689685
clm
function
// connector-service/backend/tracing-kafka/src/layer.rs pub fn builder() -> KafkaLayerBuilder { KafkaLayerBuilder::new() }
{ "chunk": null, "crate": "tracing-kafka", "enum_name": null, "file_size": null, "for_type": null, "function_name": "builder", "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_451995750384660228
clm
function
// connector-service/backend/tracing-kafka/src/layer.rs pub(crate) fn from_writer( kafka_writer: KafkaWriter, static_fields: HashMap<String, serde_json::Value>, ) -> Result<Self, KafkaLayerError> { let config = JsonFormattingLayerConfig { static_top_level_fields: static_fields, top_level_keys: HashSet::new(), log_span_lifecycles: true, additional_fields_placement: AdditionalFieldsPlacement::TopLevel, }; let inner: JsonFormattingLayer<KafkaWriter, serde_json::ser::CompactFormatter> = JsonFormattingLayer::new(config, kafka_writer, serde_json::ser::CompactFormatter)?; Ok(Self { inner }) }
{ "chunk": null, "crate": "tracing-kafka", "enum_name": null, "file_size": null, "for_type": null, "function_name": "from_writer", "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_-8964400548346369063
clm
function
// connector-service/backend/tracing-kafka/src/layer.rs fn on_event(&self, event: &tracing::Event<'_>, ctx: tracing_subscriber::layer::Context<'_, S>) { self.inner.on_event(event, ctx); }
{ "chunk": null, "crate": "tracing-kafka", "enum_name": null, "file_size": null, "for_type": null, "function_name": "on_event", "is_async": false, "is_pub": false, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_fn_tracing-kafka_-5720071337815993310
clm
function
// connector-service/backend/tracing-kafka/src/layer.rs fn on_new_span( &self, attrs: &tracing::span::Attributes<'_>, id: &tracing::span::Id, ctx: tracing_subscriber::layer::Context<'_, S>, ) { self.inner.on_new_span(attrs, id, ctx); }
{ "chunk": null, "crate": "tracing-kafka", "enum_name": null, "file_size": null, "for_type": null, "function_name": "on_new_span", "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_tracing-kafka_5490819592268354578
clm
function
// connector-service/backend/tracing-kafka/src/layer.rs fn on_enter(&self, id: &tracing::span::Id, ctx: tracing_subscriber::layer::Context<'_, S>) { self.inner.on_enter(id, ctx); }
{ "chunk": null, "crate": "tracing-kafka", "enum_name": null, "file_size": null, "for_type": null, "function_name": "on_enter", "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_tracing-kafka_-1354729165230843960
clm
function
// connector-service/backend/tracing-kafka/src/layer.rs fn on_exit(&self, id: &tracing::span::Id, ctx: tracing_subscriber::layer::Context<'_, S>) { self.inner.on_exit(id, ctx); }
{ "chunk": null, "crate": "tracing-kafka", "enum_name": null, "file_size": null, "for_type": null, "function_name": "on_exit", "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_tracing-kafka_-1268945382296505586
clm
function
// connector-service/backend/tracing-kafka/src/layer.rs fn on_close(&self, id: tracing::span::Id, ctx: tracing_subscriber::layer::Context<'_, S>) { self.inner.on_close(id, ctx); }
{ "chunk": null, "crate": "tracing-kafka", "enum_name": null, "file_size": null, "for_type": null, "function_name": "on_close", "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_tracing-kafka_5327567524250763169
clm
function
// connector-service/backend/tracing-kafka/src/layer.rs pub fn boxed<S>(self) -> Box<dyn Layer<S> + Send + Sync + 'static> where Self: Layer<S> + Sized + Send + Sync + 'static, S: Subscriber + for<'span> tracing_subscriber::registry::LookupSpan<'span>, { Box::new(self) }
{ "chunk": null, "crate": "tracing-kafka", "enum_name": null, "file_size": null, "for_type": null, "function_name": "boxed", "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_-9065344722904039829
clm
function
// connector-service/backend/tracing-kafka/src/layer.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_3885294031497186191
clm
function
// connector-service/backend/tracing-kafka/src/layer.rs pub fn brokers(mut self, brokers: &[&str]) -> Self { self.writer_builder = self .writer_builder .brokers(brokers.iter().map(|s| s.to_string()).collect()); 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_-1422168367590455550
clm
function
// connector-service/backend/tracing-kafka/src/layer.rs pub fn topic(mut self, topic: impl Into<String>) -> Self { self.writer_builder = self.writer_builder.topic(topic); 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_5840137523398782753
clm
function
// connector-service/backend/tracing-kafka/src/layer.rs pub fn batch_size(mut self, size: usize) -> Self { self.writer_builder = self.writer_builder.batch_size(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_3346422533023196657
clm
function
// connector-service/backend/tracing-kafka/src/layer.rs pub fn linger_ms(mut self, ms: u64) -> Self { self.writer_builder = self.writer_builder.linger_ms(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_2562631204209332343
clm
function
// connector-service/backend/tracing-kafka/src/layer.rs pub fn linger(mut self, duration: Duration) -> Self { self.writer_builder = self.writer_builder.linger(duration); 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_-8683759213552624078
clm
function
// connector-service/backend/tracing-kafka/src/layer.rs pub fn queue_buffering_max_messages(mut self, size: usize) -> Self { self.writer_builder = self.writer_builder.queue_buffering_max_messages(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_7474325781935482254
clm
function
// connector-service/backend/tracing-kafka/src/layer.rs pub fn queue_buffering_max_kbytes(mut self, size: usize) -> Self { self.writer_builder = self.writer_builder.queue_buffering_max_kbytes(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_517302336154124806
clm
function
// connector-service/backend/tracing-kafka/src/layer.rs pub fn reconnect_backoff(mut self, min: Duration, max: Duration) -> Self { self.writer_builder = self.writer_builder.reconnect_backoff(min, max); 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_7399523621511478274
clm
function
// connector-service/backend/tracing-kafka/src/layer.rs pub fn static_fields(mut self, fields: HashMap<String, serde_json::Value>) -> Self { self.static_fields = fields; self }
{ "chunk": null, "crate": "tracing-kafka", "enum_name": null, "file_size": null, "for_type": null, "function_name": "static_fields", "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_-4753496756026263773
clm
function
// connector-service/backend/tracing-kafka/src/layer.rs pub fn add_static_field(mut self, key: String, value: serde_json::Value) -> Self { self.static_fields.insert(key, value); self }
{ "chunk": null, "crate": "tracing-kafka", "enum_name": null, "file_size": null, "for_type": null, "function_name": "add_static_field", "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 }