id
stringlengths
20
153
type
stringclasses
1 value
granularity
stringclasses
14 values
content
stringlengths
16
84.3k
metadata
dict
connector-service_body_connector-integration_4630970440140951762
clm
function_body
// connector-service/backend/connector-integration/src/connectors/razorpay/test.rs // Function: test_handle_error_response_missing_error_field { let http_response = Response { headers: None, response: br#"{ "message": "Some generic message", "status": "failed" }"# .to_vec() .into(), status_code: 400, }; let connector: BoxedConnector<DefaultPCIHolder> = Box::new(Razorpay::new()); let result = <dyn ConnectorServiceTrait<DefaultPCIHolder> + Sync as ConnectorIntegrationV2< domain_types::connector_flow::CreateOrder, domain_types::connector_types::PaymentFlowData, domain_types::connector_types::PaymentCreateOrderData, domain_types::connector_types::PaymentCreateOrderResponse, >>::get_error_response_v2(&**connector, http_response, None) .unwrap(); let actual_json = to_value(&result).unwrap(); let expected_json = json!({ "code": "ROUTE_ERROR", "message": "Some generic message", "reason": "Some generic message", "status_code": 400, "attempt_status": "failure", "connector_transaction_id": null, "network_advice_code": null, "network_decline_code": null, "network_error_message": null }); assert_eq!(actual_json, expected_json); }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "test_handle_error_response_missing_error_field", "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_connector-integration_-9078528393221723888
clm
function_body
// connector-service/backend/connector-integration/src/connectors/razorpay/transformers.rs // Function: try_from { use domain_types::payment_method_data::{PaymentMethodData, UpiData}; use hyperswitch_masking::PeekInterface; // Determine flow type and extract VPA based on UPI payment method let (flow_type, vpa) = match &item.router_data.request.payment_method_data { PaymentMethodData::Upi(UpiData::UpiCollect(collect_data)) => { let vpa = collect_data .vpa_id .as_ref() .ok_or(errors::ConnectorError::MissingRequiredField { field_name: "vpa_id", })? .peek() .to_string(); (None, Some(vpa)) } PaymentMethodData::Upi(UpiData::UpiIntent(_)) | PaymentMethodData::Upi(UpiData::UpiQr(_)) => (Some("intent"), None), _ => (None, None), // Default fallback }; // Get order_id from the CreateOrder response (stored in reference_id) let order_id = item .router_data .resource_common_data .reference_id .as_ref() .ok_or(errors::ConnectorError::MissingRequiredField { field_name: "order_id (reference_id)", })? .clone(); // Extract metadata as a HashMap let metadata_map = item .router_data .request .metadata .as_ref() .and_then(|metadata| metadata.as_object()) .map(|obj| { obj.iter() .map(|(k, v)| (k.clone(), v.as_str().unwrap_or_default().to_string())) .collect::<HashMap<String, String>>() }) .unwrap_or_default(); Ok(Self { currency: item.router_data.request.currency.to_string(), amount: item.amount, email: item .router_data .resource_common_data .get_billing_email() .ok(), order_id: order_id.to_string(), contact: item .router_data .resource_common_data .get_billing_phone_number() .ok(), method: match &item.router_data.request.payment_method_data { PaymentMethodData::Upi(_) => "upi".to_string(), PaymentMethodData::Card(_) => "card".to_string(), _ => "card".to_string(), // Default to card }, vpa: vpa.clone().map(Secret::new), __notes_91_txn_uuid_93_: metadata_map.get("__notes_91_txn_uuid_93_").cloned(), __notes_91_transaction_id_93_: metadata_map .get("__notes_91_transaction_id_93_") .cloned(), callback_url: item.router_data.request.get_router_return_url()?, ip: item .router_data .request .get_ip_address_as_optional() .map(|ip| Secret::new(ip.expose())) .unwrap_or_else(|| Secret::new("127.0.0.1".to_string())), referer: item .router_data .request .browser_info .as_ref() .and_then(|info| info.get_referer().ok()) .unwrap_or_else(|| "https://example.com".to_string()), user_agent: item .router_data .request .browser_info .as_ref() .and_then(|info| info.get_user_agent().ok()) .unwrap_or_else(|| "Mozilla/5.0".to_string()), description: Some("".to_string()), flow: flow_type.map(|s| s.to_string()), __notes_91_cust_id_93_: metadata_map.get("__notes_91_cust_id_93_").cloned(), __notes_91_cust_name_93_: metadata_map.get("__notes_91_cust_name_93_").cloned(), __upi_91_flow_93_: metadata_map.get("__upi_91_flow_93_").cloned(), __upi_91_type_93_: metadata_map.get("__upi_91_type_93_").cloned(), __upi_91_end_date_93_: metadata_map .get("__upi_91_end_date_93_") .and_then(|v| v.parse::<i64>().ok()), __upi_91_vpa_93_: metadata_map.get("__upi_91_vpa_93_").cloned(), recurring: None, customer_id: None, __upi_91_expiry_time_93_: metadata_map .get("__upi_91_expiry_time_93_") .and_then(|v| v.parse::<i64>().ok()), fee: None, __notes_91_booking_id_93: metadata_map.get("__notes_91_booking_id_93").cloned(), __notes_91_pnr_93: metadata_map.get("__notes_91_pnr_93").cloned(), __notes_91_payment_id_93: metadata_map.get("__notes_91_payment_id_93").cloned(), __notes_91_lob_93_: metadata_map.get("__notes_91_lob_93_").cloned(), __notes_91_credit_line_id_93_: metadata_map .get("__notes_91_credit_line_id_93_") .cloned(), __notes_91_loan_id_93_: metadata_map.get("__notes_91_loan_id_93_").cloned(), __notes_91_transaction_type_93_: metadata_map .get("__notes_91_transaction_type_93_") .cloned(), __notes_91_loan_product_code_93_: metadata_map .get("__notes_91_loan_product_code_93_") .cloned(), __notes_91_pg_flow_93_: metadata_map.get("__notes_91_pg_flow_93_").cloned(), __notes_91_tid_93: metadata_map.get("__notes_91_tid_93").cloned(), account_id: None, }) }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "try_from", "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_connector-integration_5939746031037116638
clm
function_body
// connector-service/backend/connector-integration/src/connectors/razorpay/transformers.rs // Function: generate_authorization_header { let auth_type_name = match self { RazorpayAuthType::AuthToken(_) => "AuthToken", RazorpayAuthType::ApiKeySecret { .. } => "ApiKeySecret", }; info!("Type of auth Token is {}", auth_type_name); match self { RazorpayAuthType::AuthToken(token) => format!("Bearer {}", token.peek()), RazorpayAuthType::ApiKeySecret { api_key, api_secret, } => { let credentials = format!("{}:{}", api_key.peek(), api_secret.peek()); let encoded = STANDARD.encode(credentials); format!("Basic {encoded}") } } }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "generate_authorization_header", "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_connector-integration_-7098095553287580584
clm
function_body
// connector-service/backend/connector-integration/src/connectors/razorpay/transformers.rs // Function: extract_payment_method_and_data { match payment_method_data { PaymentMethodData::Card(card_data) => { let card_holder_name = customer_name.clone(); let card = PaymentMethodSpecificData::Card(CardDetails { number: card_data.card_number.clone(), name: card_holder_name.map(Secret::new), expiry_month: Some(card_data.card_exp_month.clone()), expiry_year: card_data.card_exp_year.clone(), cvv: Some(card_data.card_cvc.clone()), }); Ok((PaymentMethodType::Card, card)) } PaymentMethodData::CardRedirect(_) | PaymentMethodData::Wallet(_) | PaymentMethodData::PayLater(_) | PaymentMethodData::BankRedirect(_) | PaymentMethodData::BankDebit(_) | PaymentMethodData::BankTransfer(_) | PaymentMethodData::Crypto(_) | PaymentMethodData::MandatePayment | PaymentMethodData::Reward | PaymentMethodData::RealTimePayment(_) | PaymentMethodData::Upi(_) | PaymentMethodData::Voucher(_) | PaymentMethodData::GiftCard(_) | PaymentMethodData::CardToken(_) | PaymentMethodData::CardDetailsForNetworkTransactionId(_) | PaymentMethodData::NetworkToken(_) | PaymentMethodData::MobilePayment(_) | PaymentMethodData::OpenBanking(_) => { Err(domain_types::errors::ConnectorError::NotImplemented( "Only Card payment method is supported for Razorpay".to_string(), )) } } }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "extract_payment_method_and_data", "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_connector-integration_-7952878649503609795
clm
function_body
// connector-service/backend/connector-integration/src/connectors/razorpay/transformers.rs // Function: foreign_try_from { let (transaction_id, redirection_data) = match upi_response { RazorpayUpiPaymentsResponse::SuccessIntent { razorpay_payment_id, link, } => { let redirect_form = domain_types::router_response_types::RedirectForm::Uri { uri: link }; ( ResponseId::ConnectorTransactionId(razorpay_payment_id), Some(redirect_form), ) } RazorpayUpiPaymentsResponse::SuccessCollect { razorpay_payment_id, } => { // For UPI Collect, there's no link, so no redirection data ( ResponseId::ConnectorTransactionId(razorpay_payment_id), None, ) } RazorpayUpiPaymentsResponse::NullResponse { razorpay_payment_id, } => { // Handle null response - likely an error condition match razorpay_payment_id { Some(payment_id) => (ResponseId::ConnectorTransactionId(payment_id), None), None => { // Payment ID is null, this is likely an error return Err(domain_types::errors::ConnectorError::ResponseHandlingFailed); } } } RazorpayUpiPaymentsResponse::Error { error: _ } => { // Handle error case - this should probably return an error instead return Err(domain_types::errors::ConnectorError::ResponseHandlingFailed); } }; let payments_response_data = PaymentsResponseData::TransactionResponse { resource_id: transaction_id, redirection_data: redirection_data.map(Box::new), connector_metadata: None, mandate_reference: None, network_txn_id: None, connector_response_reference_id: data.resource_common_data.reference_id.clone(), incremental_authorization_allowed: None, status_code: _status_code, }; Ok(RouterDataV2 { response: Ok(payments_response_data), resource_common_data: PaymentFlowData { status: AttemptStatus::AuthenticationPending, ..data.resource_common_data }, ..data }) }
{ "chunk": null, "crate": "connector-integration", "enum_name": null, "file_size": null, "for_type": null, "function_name": "foreign_try_from", "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_connector-integration_-4037744963478676863
clm
function_body
// connector-service/backend/connector-integration/src/connectors/razorpay/transformers.rs // Function: get_authorization_razorpay_payment_status_from_action { 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": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_connector-integration_-6631758940601854582
clm
function_body
// connector-service/backend/connector-integration/src/connectors/razorpay/transformers.rs // Function: get_psync_razorpay_payment_status { 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": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_connector-integration_-3972311658588693386
clm
function_body
// connector-service/backend/connector-integration/src/connectors/razorpay/transformers.rs // Function: get_webhook_object_from_body { 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": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_connector-integration_-8908402265636698198
clm
function_body
// connector-service/backend/connector-integration/src/connectors/razorpay/transformers.rs // Function: get_razorpay_payment_webhook_status { 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": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_connector-integration_-2901555541874008960
clm
function_body
// connector-service/backend/connector-integration/src/connectors/razorpay/transformers.rs // Function: get_razorpay_refund_webhook_status { 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": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_connector-integration_-1636434888078594297
clm
function_body
// connector-service/backend/connector-integration/src/connectors/nexinets/transformers.rs // Function: try_from { 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": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_connector-integration_8550670897078209958
clm
function_body
// connector-service/backend/connector-integration/src/connectors/nexinets/transformers.rs // Function: get_status { 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": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_connector-integration_3537089937280467251
clm
function_body
// connector-service/backend/connector-integration/src/connectors/nexinets/transformers.rs // Function: from { 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": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_connector-integration_-2322373070182054017
clm
function_body
// connector-service/backend/connector-integration/src/connectors/nexinets/transformers.rs // Function: get_payment_details_and_product { 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": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_connector-integration_2241953456805645297
clm
function_body
// connector-service/backend/connector-integration/src/connectors/nexinets/transformers.rs // Function: get_card_data { 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": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_connector-integration_-2901233954996636942
clm
function_body
// connector-service/backend/connector-integration/src/connectors/nexinets/transformers.rs // Function: get_applepay_details { 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": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_connector-integration_-6177214858470529762
clm
function_body
// connector-service/backend/connector-integration/src/connectors/nexinets/transformers.rs // Function: get_card_details { 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": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_connector-integration_3485731755972331756
clm
function_body
// connector-service/backend/connector-integration/src/connectors/nexinets/transformers.rs // Function: get_wallet_details { 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": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_connector-integration_-2834110669664230917
clm
function_body
// connector-service/backend/connector-integration/src/connectors/nexinets/transformers.rs // Function: get_order_id { 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": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_connector-integration_-2064561617091103254
clm
function_body
// connector-service/backend/connector-integration/src/connectors/nexinets/transformers.rs // Function: get_transaction_id { 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": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_connector-integration_4959836677832181844
clm
function_body
// connector-service/backend/connector-integration/src/connectors/nexinets/transformers.rs // Function: is_mandate_payment { (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": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_connector-integration_-7118840584028584861
clm
function_body
// connector-service/backend/connector-integration/src/connectors/cashfree/test.rs // Function: 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": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_connector-integration_-913117386941814465
clm
function_body
// connector-service/backend/connector-integration/src/connectors/cashfree/transformers.rs // Function: try_from { 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": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_connector-integration_3976411639051272969
clm
function_body
// connector-service/backend/connector-integration/src/connectors/cashfree/transformers.rs // Function: get_cashfree_payment_method_data { 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": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_connector-integration_4556260266317788542
clm
function_body
// connector-service/backend/connector-integration/src/connectors/dlocal/transformers.rs // Function: try_from { 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": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_connector-integration_3421055711721102464
clm
function_body
// connector-service/backend/connector-integration/src/connectors/dlocal/transformers.rs // Function: get_payer_name { 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": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_connector-integration_-5799409836123546819
clm
function_body
// connector-service/backend/connector-integration/src/connectors/dlocal/transformers.rs // Function: from { 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": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_connector-integration_8581464554531103985
clm
function_body
// connector-service/backend/connector-integration/src/connectors/dlocal/transformers.rs // Function: get_doc_from_currency { 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": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_connector-integration_7689147486421063469
clm
function_body
// connector-service/backend/connector-integration/src/connectors/rapyd/transformers.rs // Function: try_from { 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": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_connector-integration_-1598684213023246236
clm
function_body
// connector-service/backend/connector-integration/src/connectors/rapyd/transformers.rs // Function: get_status { 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": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_connector-integration_377161422644771364
clm
function_body
// connector-service/backend/connector-integration/src/connectors/rapyd/transformers.rs // Function: from { 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": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_connector-integration_4119764694675366801
clm
function_body
// connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs // Function: try_from { 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": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_connector-integration_-3185481980065317347
clm
function_body
// connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs // Function: determine_upi_flow { 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": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_connector-integration_-7439446151973128045
clm
function_body
// connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs // Function: extract_upi_vpa { 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": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_connector-integration_-6957289705848226931
clm
function_body
// connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs // Function: generate_paytm_signature { // 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": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_connector-integration_-5853728846929343125
clm
function_body
// connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs // Function: crypt(data: // 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": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_connector-integration_-3913032980729359843
clm
function_body
// connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs // Function: ytm_iv() -> // 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": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_connector-integration_-6797924368998403143
clm
function_body
// connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs // Function: _paytm_header( 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": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_connector-integration_-1354961511510201592
clm
function_body
// connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs // Function: om_with_converter( 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": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_connector-integration_5259596103797085652
clm
function_body
// connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs // Function: om_with_auth( 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": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_connector-integration_9052962118483078786
clm
function_body
// connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs // Function: om_with_auth<T: do // 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": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_connector-integration_-2773304284711643439
clm
function_body
// connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs // Function: om( 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": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_connector-integration_4077306061252374201
clm
function_body
// connector-service/backend/connector-integration/src/connectors/paytm/transformers.rs // Function: ytm_status_to_attempt_status(resul 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": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_connector-integration_2054285568921142490
clm
function_body
// connector-service/backend/connector-integration/src/connectors/mifinity/transformers.rs // Function: try_from { 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": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_connector-integration_-2217055865063992973
clm
function_body
// connector-service/backend/connector-integration/src/connectors/mifinity/transformers.rs // Function: from { 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": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_connector-integration_-3994609864851356532
clm
function_body
// connector-service/backend/connector-integration/src/connectors/stripe/transformers.rs // Function: try_from { 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": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_connector-integration_1173613580111018141
clm
function_body
// connector-service/backend/connector-integration/src/connectors/stripe/transformers.rs // Function: from { 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": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_connector-integration_8518057686944955326
clm
function_body
// connector-service/backend/connector-integration/src/connectors/stripe/transformers.rs // Function: validate_shipping_address_against_payment_method { 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": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_connector-integration_-8850820069584541922
clm
function_body
// connector-service/backend/connector-integration/src/connectors/stripe/transformers.rs // Function: get_stripe_payment_method_type_from_wallet_data { 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": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_connector-integration_-5598417203105720999
clm
function_body
// connector-service/backend/connector-integration/src/connectors/stripe/transformers.rs // Function: get_bank_debit_data { 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": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_connector-integration_-8522391454159232776
clm
function_body
// connector-service/backend/connector-integration/src/connectors/stripe/transformers.rs // Function: create_stripe_payment_method { 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": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_connector-integration_-4635542134191482774
clm
function_body
// connector-service/backend/connector-integration/src/connectors/stripe/transformers.rs // Function: get_stripe_card_network { 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": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_connector-integration_7891244608112781997
clm
function_body
// connector-service/backend/connector-integration/src/connectors/stripe/transformers.rs // Function: get_stripe_overcapture_request { 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": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_connector-integration_-8968230207100467703
clm
function_body
// connector-service/backend/connector-integration/src/connectors/stripe/transformers.rs // Function: get_overcapture_status { 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": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_connector-integration_-6203313107654536436
clm
function_body
// connector-service/backend/connector-integration/src/connectors/stripe/transformers.rs // Function: get_maximum_capturable_amount { 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": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_connector-integration_6531673111307194203
clm
function_body
// connector-service/backend/connector-integration/src/connectors/stripe/transformers.rs // Function: get_additional_payment_method_data { 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": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_connector-integration_-6852380513523657294
clm
function_body
// connector-service/backend/connector-integration/src/connectors/stripe/transformers.rs // Function: extract_payment_method_connector_response_from_latest_charge { 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": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_connector-integration_1369774013258447293
clm
function_body
// connector-service/backend/connector-integration/src/connectors/stripe/transformers.rs // Function: get_connector_metadata { 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": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_connector-integration_8571177012977070044
clm
function_body
// connector-service/backend/connector-integration/src/connectors/stripe/transformers.rs // Function: get_payment_method_id { 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": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_connector-integration_-4318103245275833434
clm
function_body
// connector-service/backend/connector-integration/src/connectors/stripe/transformers.rs // Function: extract_payment_method_connector_response_from_latest_attempt { 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": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_connector-integration_-1974308769895143293
clm
function_body
// connector-service/backend/connector-integration/src/connectors/stripe/transformers.rs // Function: stripe_opt_latest_attempt_to_opt_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": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_connector-integration_-3003017068298081302
clm
function_body
// connector-service/backend/connector-integration/src/connectors/stripe/transformers.rs // Function: get_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": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_connector-integration_-9207417217826604558
clm
function_body
// connector-service/backend/connector-integration/src/connectors/stripe/transformers.rs // Function: deserialize { #[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": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_connector-integration_-4265241655935995837
clm
function_body
// connector-service/backend/connector-integration/src/connectors/stripe/transformers.rs // Function: serialize { 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": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_connector-integration_5655059225716532881
clm
function_body
// connector-service/backend/connector-integration/src/connectors/stripe/transformers.rs // Function: mandatory_parameters_for_sepa_bank_debit_mandates { 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": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_connector-integration_8735047973494365850
clm
function_body
// connector-service/backend/connector-integration/src/connectors/stripe/transformers.rs // Function: get_transaction_metadata { 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": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_connector-integration_3511277782673471065
clm
function_body
// connector-service/backend/connector-integration/src/connectors/stripe/transformers.rs // Function: get_stripe_payments_response_data { 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": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_connector-integration_-7552552949357001475
clm
function_body
// connector-service/backend/connector-integration/src/connectors/stripe/transformers.rs // Function: construct_charge_response { 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": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_connector-integration_5659715827989969682
clm
function_body
// connector-service/backend/connector-integration/src/connectors/stripe/transformers.rs // Function: transform_headers_for_connect_platform { 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": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_connector-integration_5162255066699953247
clm
function_body
// connector-service/backend/connector-integration/src/connectors/stripe/transformers.rs // Function: get_payment_method_type_for_saved_payment_method_payment { 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": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_connector-integration_1303099440923219256
clm
function_body
// connector-service/backend/connector-integration/src/utils/xml_utils.rs // Function: preprocess_xml_response_bytes { // 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": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_connector-integration_4550111238108691031
clm
function_body
// connector-service/backend/connector-integration/src/utils/xml_utils.rs // Function: flatten_json_structure { 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": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_tracing-kafka_5072961068641949251
clm
function_body
// connector-service/backend/tracing-kafka/src/metrics.rs // Function: 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": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_tracing-kafka_-1568421221257796721
clm
function_body
// connector-service/backend/tracing-kafka/src/writer.rs // Function: delivery { 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": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_tracing-kafka_-274270537329133485
clm
function_body
// connector-service/backend/tracing-kafka/src/writer.rs // Function: fmt { 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": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_tracing-kafka_290730444913273393
clm
function_body
// connector-service/backend/tracing-kafka/src/writer.rs // Function: new { 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": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_tracing-kafka_7845295661283135444
clm
function_body
// connector-service/backend/tracing-kafka/src/writer.rs // Function: publish_event { #[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": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_tracing-kafka_5832403107327964822
clm
function_body
// connector-service/backend/tracing-kafka/src/writer.rs // Function: write { #[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": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_tracing-kafka_2916428861070231651
clm
function_body
// connector-service/backend/tracing-kafka/src/writer.rs // Function: flush { 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": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_tracing-kafka_-3597087384805780269
clm
function_body
// connector-service/backend/tracing-kafka/src/writer.rs // Function: drop { // 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": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_tracing-kafka_451995750384660228
clm
function_body
// connector-service/backend/tracing-kafka/src/layer.rs // Function: from_writer { 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": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_tracing-kafka_3885294031497186191
clm
function_body
// connector-service/backend/tracing-kafka/src/layer.rs // Function: brokers { 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": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_tracing-kafka_-8683759213552624078
clm
function_body
// connector-service/backend/tracing-kafka/src/layer.rs // Function: queue_buffering_max_messages { 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": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_tracing-kafka_7474325781935482254
clm
function_body
// connector-service/backend/tracing-kafka/src/layer.rs // Function: queue_buffering_max_kbytes { 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": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_tracing-kafka_-6882464342109674018
clm
function_body
// connector-service/backend/tracing-kafka/src/layer.rs // Function: build { let kafka_writer = self.writer_builder.build()?; KafkaLayer::from_writer(kafka_writer, self.static_fields) }
{ "chunk": null, "crate": "tracing-kafka", "enum_name": null, "file_size": null, "for_type": null, "function_name": "build", "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_tracing-kafka_-512760633133803525
clm
function_body
// connector-service/backend/tracing-kafka/src/builder.rs // Function: reconnect_backoff { self.reconnect_backoff_min_ms = min.as_millis().try_into().ok(); self.reconnect_backoff_max_ms = max.as_millis().try_into().ok(); self }
{ "chunk": null, "crate": "tracing-kafka", "enum_name": null, "file_size": null, "for_type": null, "function_name": "reconnect_backoff", "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_tracing-kafka_108416459605169019
clm
function_body
// connector-service/backend/tracing-kafka/src/builder.rs // Function: build { let brokers = self.brokers.ok_or_else(|| { KafkaWriterError::ProducerCreation(rdkafka::error::KafkaError::ClientCreation( "No brokers specified. Use .brokers()".to_string(), )) })?; let topic = self.topic.ok_or_else(|| { KafkaWriterError::ProducerCreation(rdkafka::error::KafkaError::ClientCreation( "No topic specified. Use .topic()".to_string(), )) })?; KafkaWriter::new( brokers, topic, self.batch_size, self.linger_ms, self.queue_buffering_max_messages, self.queue_buffering_max_kbytes, self.reconnect_backoff_min_ms, self.reconnect_backoff_max_ms, ) }
{ "chunk": null, "crate": "tracing-kafka", "enum_name": null, "file_size": null, "for_type": null, "function_name": "build", "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_ucs_common_enums_1302335836922554835
clm
function_body
// connector-service/backend/common_enums/src/enums.rs // Function: to_currency_base_unit { let amount_f64 = self.to_currency_base_unit_asf64(amount)?; Ok(format!("{amount_f64:.2}")) }
{ "chunk": null, "crate": "ucs_common_enums", "enum_name": null, "file_size": null, "for_type": null, "function_name": "to_currency_base_unit", "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_ucs_common_enums_6717620428198109433
clm
function_body
// connector-service/backend/common_enums/src/enums.rs // Function: to_currency_base_unit_asf64 { let exponent = self.number_of_digits_after_decimal_point()?; let divisor = 10_u32.pow(exponent.into()); let amount_f64 = amount as f64 / f64::from(divisor); Ok(amount_f64) }
{ "chunk": null, "crate": "ucs_common_enums", "enum_name": null, "file_size": null, "for_type": null, "function_name": "to_currency_base_unit_asf64", "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_ucs_common_enums_1935645549446957743
clm
function_body
// connector-service/backend/common_enums/src/enums.rs // Function: to_currency_lower_unit { let amount_decimal = amount .parse::<f64>() .map_err(|_| CurrencyError::UnsupportedCurrency { currency: format!("Invalid amount format: {amount}"), })?; let exponent = self.number_of_digits_after_decimal_point()?; let multiplier = 10_u32.pow(exponent.into()); let final_amount = amount_decimal * f64::from(multiplier); Ok(final_amount.to_string()) }
{ "chunk": null, "crate": "ucs_common_enums", "enum_name": null, "file_size": null, "for_type": null, "function_name": "to_currency_lower_unit", "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_ucs_common_enums_-6063022065528235099
clm
function_body
// connector-service/backend/common_enums/src/enums.rs // Function: to_currency_base_unit_with_zero_decimal_check { if self.is_zero_decimal_currency() { Ok(amount.to_string()) } else { self.to_currency_base_unit(amount) } }
{ "chunk": null, "crate": "ucs_common_enums", "enum_name": null, "file_size": null, "for_type": null, "function_name": "to_currency_base_unit_with_zero_decimal_check", "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_ucs_common_enums_-7698180591797718585
clm
function_body
// connector-service/backend/common_enums/src/enums.rs // Function: iso_4217 { match self { Self::AED => "784", Self::AFN => "971", Self::ALL => "008", Self::AMD => "051", Self::ANG => "532", Self::AOA => "973", Self::ARS => "032", Self::AUD => "036", Self::AWG => "533", Self::AZN => "944", Self::BAM => "977", Self::BBD => "052", Self::BDT => "050", Self::BGN => "975", Self::BHD => "048", Self::BIF => "108", Self::BMD => "060", Self::BND => "096", Self::BOB => "068", Self::BRL => "986", Self::BSD => "044", Self::BTN => "064", Self::BWP => "072", Self::BYN => "933", Self::BZD => "084", Self::CAD => "124", Self::CDF => "976", Self::CHF => "756", Self::CLF => "990", Self::CLP => "152", Self::CNY => "156", Self::COP => "170", Self::CRC => "188", Self::CUC => "931", Self::CUP => "192", Self::CVE => "132", Self::CZK => "203", Self::DJF => "262", Self::DKK => "208", Self::DOP => "214", Self::DZD => "012", Self::EGP => "818", Self::ERN => "232", Self::ETB => "230", Self::EUR => "978", Self::FJD => "242", Self::FKP => "238", Self::GBP => "826", Self::GEL => "981", Self::GHS => "936", Self::GIP => "292", Self::GMD => "270", Self::GNF => "324", Self::GTQ => "320", Self::GYD => "328", Self::HKD => "344", Self::HNL => "340", Self::HRK => "191", Self::HTG => "332", Self::HUF => "348", Self::IDR => "360", Self::ILS => "376", Self::INR => "356", Self::IQD => "368", Self::IRR => "364", Self::ISK => "352", Self::JMD => "388", Self::JOD => "400", Self::JPY => "392", Self::KES => "404", Self::KGS => "417", Self::KHR => "116", Self::KMF => "174", Self::KPW => "408", Self::KRW => "410", Self::KWD => "414", Self::KYD => "136", Self::KZT => "398", Self::LAK => "418", Self::LBP => "422", Self::LKR => "144", Self::LRD => "430", Self::LSL => "426", Self::LYD => "434", Self::MAD => "504", Self::MDL => "498", Self::MGA => "969", Self::MKD => "807", Self::MMK => "104", Self::MNT => "496", Self::MOP => "446", Self::MRU => "929", Self::MUR => "480", Self::MVR => "462", Self::MWK => "454", Self::MXN => "484", Self::MYR => "458", Self::MZN => "943", Self::NAD => "516", Self::NGN => "566", Self::NIO => "558", Self::NOK => "578", Self::NPR => "524", Self::NZD => "554", Self::OMR => "512", Self::PAB => "590", Self::PEN => "604", Self::PGK => "598", Self::PHP => "608", Self::PKR => "586", Self::PLN => "985", Self::PYG => "600", Self::QAR => "634", Self::RON => "946", Self::RSD => "941", Self::RUB => "643", Self::RWF => "646", Self::SAR => "682", Self::SBD => "090", Self::SCR => "690", Self::SDG => "938", Self::SEK => "752", Self::SGD => "702", Self::SHP => "654", Self::SLE => "925", Self::SLL => "694", Self::SOS => "706", Self::SRD => "968", Self::SSP => "728", Self::STD => "678", Self::STN => "930", Self::SVC => "222", Self::SYP => "760", Self::SZL => "748", Self::THB => "764", Self::TJS => "972", Self::TMT => "934", Self::TND => "788", Self::TOP => "776", Self::TRY => "949", Self::TTD => "780", Self::TWD => "901", Self::TZS => "834", Self::UAH => "980", Self::UGX => "800", Self::USD => "840", Self::UYU => "858", Self::UZS => "860", Self::VES => "928", Self::VND => "704", Self::VUV => "548", Self::WST => "882", Self::XAF => "950", Self::XCD => "951", Self::XOF => "952", Self::XPF => "953", Self::YER => "886", Self::ZAR => "710", Self::ZMW => "967", Self::ZWL => "932", } }
{ "chunk": null, "crate": "ucs_common_enums", "enum_name": null, "file_size": null, "for_type": null, "function_name": "iso_4217", "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_ucs_common_enums_1863457751328752310
clm
function_body
// connector-service/backend/common_enums/src/enums.rs // Function: is_zero_decimal_currency { matches!( self, Self::BIF | Self::CLP | Self::DJF | Self::GNF | Self::JPY | Self::KMF | Self::KRW | Self::MGA | Self::PYG | Self::RWF | Self::UGX | Self::VND | Self::VUV | Self::XAF | Self::XOF | Self::XPF ) }
{ "chunk": null, "crate": "ucs_common_enums", "enum_name": null, "file_size": null, "for_type": null, "function_name": "is_zero_decimal_currency", "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_ucs_common_enums_4729465804705572647
clm
function_body
// connector-service/backend/common_enums/src/enums.rs // Function: is_three_decimal_currency { matches!( self, Self::BHD | Self::JOD | Self::KWD | Self::OMR | Self::TND ) }
{ "chunk": null, "crate": "ucs_common_enums", "enum_name": null, "file_size": null, "for_type": null, "function_name": "is_three_decimal_currency", "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_ucs_common_enums_5162897720359370202
clm
function_body
// connector-service/backend/common_enums/src/enums.rs // Function: number_of_digits_after_decimal_point { if self.is_zero_decimal_currency() { Ok(0) } else if self.is_three_decimal_currency() { Ok(3) } else if self.is_four_decimal_currency() { Ok(4) } else if self.is_two_decimal_currency() { Ok(2) } else { Err(CurrencyError::UnsupportedCurrency { currency: format!("{self:?}"), }) } }
{ "chunk": null, "crate": "ucs_common_enums", "enum_name": null, "file_size": null, "for_type": null, "function_name": "number_of_digits_after_decimal_point", "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_ucs_common_enums_2898546609219124294
clm
function_body
// connector-service/backend/common_enums/src/enums.rs // Function: is_two_decimal_currency { matches!( self, Self::AED | Self::AFN | Self::ALL | Self::AMD | Self::ANG | Self::AOA | Self::ARS | Self::AUD | Self::AWG | Self::AZN | Self::BAM | Self::BBD | Self::BDT | Self::BGN | Self::BMD | Self::BND | Self::BOB | Self::BRL | Self::BSD | Self::BTN | Self::BWP | Self::BYN | Self::BZD | Self::CAD | Self::CDF | Self::CHF | Self::CNY | Self::COP | Self::CRC | Self::CUC | Self::CUP | Self::CVE | Self::CZK | Self::DKK | Self::DOP | Self::DZD | Self::EGP | Self::ERN | Self::ETB | Self::EUR | Self::FJD | Self::FKP | Self::GBP | Self::GEL | Self::GHS | Self::GIP | Self::GMD | Self::GTQ | Self::GYD | Self::HKD | Self::HNL | Self::HRK | Self::HTG | Self::HUF | Self::IDR | Self::ILS | Self::INR | Self::IQD | Self::IRR | Self::ISK | Self::JMD | Self::KES | Self::KGS | Self::KHR | Self::KPW | Self::KYD | Self::KZT | Self::LAK | Self::LBP | Self::LKR | Self::LRD | Self::LSL | Self::LYD | Self::MAD | Self::MDL | Self::MKD | Self::MMK | Self::MNT | Self::MOP | Self::MRU | Self::MUR | Self::MVR | Self::MWK | Self::MXN | Self::MYR | Self::MZN | Self::NAD | Self::NGN | Self::NIO | Self::NOK | Self::NPR | Self::NZD | Self::PAB | Self::PEN | Self::PGK | Self::PHP | Self::PKR | Self::PLN | Self::QAR | Self::RON | Self::RSD | Self::RUB | Self::SAR | Self::SBD | Self::SCR | Self::SDG | Self::SEK | Self::SGD | Self::SHP | Self::SLE | Self::SLL | Self::SOS | Self::SRD | Self::SSP | Self::STD | Self::STN | Self::SVC | Self::SYP | Self::SZL | Self::THB | Self::TJS | Self::TMT | Self::TOP | Self::TRY | Self::TTD | Self::TWD | Self::TZS | Self::UAH | Self::USD | Self::UYU | Self::UZS | Self::VES | Self::WST | Self::XCD | Self::YER | Self::ZAR | Self::ZMW | Self::ZWL ) }
{ "chunk": null, "crate": "ucs_common_enums", "enum_name": null, "file_size": null, "for_type": null, "function_name": "is_two_decimal_currency", "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_ucs_common_enums_952033036474932759
clm
function_body
// connector-service/backend/common_enums/src/enums.rs // Function: to_display_name { match self { Self::ApplePay => "Apple Pay".to_string(), Self::GooglePay => "Google Pay".to_string(), Self::SamsungPay => "Samsung Pay".to_string(), Self::AliPay => "AliPay".to_string(), Self::WeChatPay => "WeChat Pay".to_string(), Self::KakaoPay => "Kakao Pay".to_string(), Self::GoPay => "GoPay".to_string(), Self::Gcash => "GCash".to_string(), _ => format!("{self:?}"), } }
{ "chunk": null, "crate": "ucs_common_enums", "enum_name": null, "file_size": null, "for_type": null, "function_name": "to_display_name", "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_ucs_common_enums_-734669285405537828
clm
function_body
// connector-service/backend/common_enums/src/enums.rs // Function: try_from { Ok(match value { 1 => AttemptStatus::Started, 2 => AttemptStatus::AuthenticationFailed, 3 => AttemptStatus::RouterDeclined, 4 => AttemptStatus::AuthenticationPending, 5 => AttemptStatus::AuthenticationSuccessful, 6 => AttemptStatus::Authorized, 7 => AttemptStatus::AuthorizationFailed, 8 => AttemptStatus::Charged, 9 => AttemptStatus::Authorizing, 10 => AttemptStatus::CodInitiated, 11 => AttemptStatus::Voided, 12 => AttemptStatus::VoidedPostCapture, 13 => AttemptStatus::VoidInitiated, 14 => AttemptStatus::VoidPostCaptureInitiated, 15 => AttemptStatus::CaptureInitiated, 16 => AttemptStatus::CaptureFailed, 17 => AttemptStatus::VoidFailed, 18 => AttemptStatus::AutoRefunded, 19 => AttemptStatus::PartialCharged, 20 => AttemptStatus::PartialChargedAndChargeable, 21 => AttemptStatus::Unresolved, 22 => AttemptStatus::Pending, 23 => AttemptStatus::Failure, 24 => AttemptStatus::PaymentMethodAwaited, 25 => AttemptStatus::ConfirmationAwaited, 26 => AttemptStatus::DeviceDataCollectionPending, _ => AttemptStatus::Unknown, }) }
{ "chunk": null, "crate": "ucs_common_enums", "enum_name": null, "file_size": null, "for_type": null, "function_name": "try_from", "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_ucs_common_enums_-2103179282539849872
clm
function_body
// connector-service/backend/common_enums/src/enums.rs // Function: is_terminal_status { matches!( self, Self::Charged | Self::AutoRefunded | Self::Voided | Self::VoidedPostCapture | Self::PartialCharged | Self::AuthenticationFailed | Self::AuthorizationFailed | Self::VoidFailed | Self::CaptureFailed | Self::Failure | Self::IntegrityFailure ) }
{ "chunk": null, "crate": "ucs_common_enums", "enum_name": null, "file_size": null, "for_type": null, "function_name": "is_terminal_status", "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }
connector-service_body_ucs_common_enums_1659218272502078584
clm
function_body
// connector-service/backend/common_enums/src/enums.rs // Function: is_global_network { matches!( self, Self::Visa | Self::Mastercard | Self::AmericanExpress | Self::JCB | Self::DinersClub | Self::Discover | Self::CartesBancaires | Self::UnionPay ) }
{ "chunk": null, "crate": "ucs_common_enums", "enum_name": null, "file_size": null, "for_type": null, "function_name": "is_global_network", "is_async": null, "is_pub": null, "lines": null, "method_name": null, "num_enums": null, "num_items": null, "num_structs": null, "repo": "connector-service", "start_line": null, "struct_name": null, "total_crates": null, "trait_name": null }