id
stringlengths
11
116
type
stringclasses
1 value
granularity
stringclasses
4 values
content
stringlengths
16
477k
metadata
dict
fn_clm_hyperswitch_connectors_get_url_7730652214272320598
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/wise // Implementation of Wise for ConnectorIntegration<PoFulfill, PayoutsData, PayoutsResponseData> fn get_url( &self, req: &PayoutsRouterData<PoFulfill>, connectors: &Connectors, ) -> CustomResult<String, ConnectorError> { let auth = wise::WiseAuthType::try_from(&req.connector_auth_type) .change_context(ConnectorError::FailedToObtainAuthType)?; let transfer_id = req.request.connector_payout_id.to_owned().ok_or( ConnectorError::MissingRequiredField { field_name: "transfer_id", }, )?; Ok(format!( "{}v3/profiles/{}/transfers/{}/payments", connectors.wise.base_url, auth.profile_id.peek(), transfer_id )) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 415, "total_crates": null }
fn_clm_hyperswitch_connectors_get_headers_7730652214272320598
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/wise // Implementation of Wise for ConnectorIntegration<PoFulfill, PayoutsData, PayoutsResponseData> fn get_headers( &self, req: &PayoutsRouterData<PoFulfill>, connectors: &Connectors, ) -> CustomResult<Vec<(String, Maskable<String>)>, ConnectorError> { self.build_headers(req, connectors) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 382, "total_crates": null }
fn_clm_hyperswitch_connectors_build_headers_7730652214272320598
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/wise // Implementation of Wise for ConnectorCommonExt<Flow, Request, Response> fn build_headers( &self, req: &RouterData<Flow, Request, Response>, _connectors: &Connectors, ) -> CustomResult<Vec<(String, Maskable<String>)>, ConnectorError> { use masking::Mask as _; let mut header = vec![( headers::CONTENT_TYPE.to_string(), PayoutQuoteType::get_content_type(self).to_string().into(), )]; let auth = wise::WiseAuthType::try_from(&req.connector_auth_type) .change_context(ConnectorError::FailedToObtainAuthType)?; let mut api_key = vec![( headers::AUTHORIZATION.to_string(), auth.api_key.into_masked(), )]; header.append(&mut api_key); Ok(header) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 374, "total_crates": null }
fn_clm_hyperswitch_connectors_new_589194642155462418
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/payload // Inherent implementation for Payload pub fn new() -> &'static Self { &Self { amount_converter: &StringMajorUnitForConnector, } }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 14463, "total_crates": null }
fn_clm_hyperswitch_connectors_build_error_response_589194642155462418
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/payload // Implementation of Payload for ConnectorCommon fn build_error_response( &self, res: Response, event_builder: Option<&mut ConnectorEvent>, ) -> CustomResult<ErrorResponse, errors::ConnectorError> { let response: responses::PayloadErrorResponse = res .response .parse_struct("PayloadErrorResponse") .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; event_builder.map(|i| i.set_response_body(&response)); router_env::logger::info!(connector_response=?response); Ok(ErrorResponse { status_code: res.status_code, code: response.error_type, message: response.error_description, reason: response .details .as_ref() .map(|details_value| details_value.to_string()), attempt_status: None, connector_transaction_id: None, network_advice_code: None, network_decline_code: None, network_error_message: None, connector_metadata: None, }) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 445, "total_crates": null }
fn_clm_hyperswitch_connectors_get_url_589194642155462418
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/payload // Implementation of Payload for ConnectorIntegration<RSync, RefundsData, RefundsResponseData> fn get_url( &self, req: &RefundSyncRouterData, connectors: &Connectors, ) -> CustomResult<String, errors::ConnectorError> { let connector_refund_id = req .request .connector_refund_id .as_ref() .ok_or_else(|| errors::ConnectorError::MissingConnectorRefundID)?; Ok(format!( "{}/transactions/{}", self.base_url(connectors), connector_refund_id )) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 411, "total_crates": null }
fn_clm_hyperswitch_connectors_get_headers_589194642155462418
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/payload // Implementation of Payload for ConnectorIntegration<RSync, RefundsData, RefundsResponseData> fn get_headers( &self, req: &RefundSyncRouterData, connectors: &Connectors, ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> { self.build_headers(req, connectors) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 382, "total_crates": null }
fn_clm_hyperswitch_connectors_common_get_content_type_589194642155462418
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/payload // Implementation of Payload for ConnectorCommon fn common_get_content_type(&self) -> &'static str { "application/x-www-form-urlencoded" }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 377, "total_crates": null }
fn_clm_hyperswitch_connectors_new_7335488958534813018
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/mpgs // Inherent implementation for Mpgs pub fn new() -> &'static Self { &Self { amount_converter: &StringMinorUnitForConnector, } }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 14463, "total_crates": null }
fn_clm_hyperswitch_connectors_build_error_response_7335488958534813018
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/mpgs // Implementation of Mpgs for ConnectorCommon fn build_error_response( &self, res: Response, event_builder: Option<&mut ConnectorEvent>, ) -> CustomResult<ErrorResponse, errors::ConnectorError> { let response: mpgs::MpgsErrorResponse = res .response .parse_struct("MpgsErrorResponse") .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; event_builder.map(|i| i.set_response_body(&response)); router_env::logger::info!(connector_response=?response); Ok(ErrorResponse { status_code: res.status_code, code: response.code, message: response.message, reason: response.reason, attempt_status: None, connector_transaction_id: None, network_advice_code: None, network_decline_code: None, network_error_message: None, connector_metadata: None, }) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 439, "total_crates": null }
fn_clm_hyperswitch_connectors_get_url_7335488958534813018
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/mpgs // Implementation of Mpgs for ConnectorIntegration<RSync, RefundsData, RefundsResponseData> fn get_url( &self, _req: &RefundSyncRouterData, _connectors: &Connectors, ) -> CustomResult<String, errors::ConnectorError> { Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into()) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 413, "total_crates": null }
fn_clm_hyperswitch_connectors_get_headers_7335488958534813018
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/mpgs // Implementation of Mpgs for ConnectorIntegration<RSync, RefundsData, RefundsResponseData> fn get_headers( &self, req: &RefundSyncRouterData, connectors: &Connectors, ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> { self.build_headers(req, connectors) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 382, "total_crates": null }
fn_clm_hyperswitch_connectors_common_get_content_type_7335488958534813018
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/mpgs // Implementation of Mpgs for ConnectorCommon fn common_get_content_type(&self) -> &'static str { "application/json" }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 377, "total_crates": null }
fn_clm_hyperswitch_connectors_new_1046487541936808712
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/trustpay // Inherent implementation for Trustpay pub fn new() -> &'static Self { &Self { amount_converter: &StringMajorUnitForConnector, amount_converter_to_float_major_unit: &FloatMajorUnitForConnector, amount_converter_to_string_minor_unit: &StringMinorUnitForConnector, } }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 14463, "total_crates": null }
fn_clm_hyperswitch_connectors_build_error_response_1046487541936808712
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/trustpay // Implementation of Trustpay for ConnectorCommon fn build_error_response( &self, res: Response, event_builder: Option<&mut ConnectorEvent>, ) -> CustomResult<ErrorResponse, errors::ConnectorError> { let response: Result< trustpay::TrustpayErrorResponse, Report<common_utils::errors::ParsingError>, > = res.response.parse_struct("trustpay ErrorResponse"); match response { Ok(response_data) => { event_builder.map(|i| i.set_error_response_body(&response_data)); router_env::logger::info!(connector_response=?response_data); let error_list = response_data.errors.clone().unwrap_or_default(); let option_error_code_message = utils::get_error_code_error_message_based_on_priority( self.clone(), error_list.into_iter().map(|errors| errors.into()).collect(), ); let reason = response_data.errors.map(|errors| { errors .iter() .map(|error| error.description.clone()) .collect::<Vec<String>>() .join(" & ") }); Ok(ErrorResponse { status_code: res.status_code, code: option_error_code_message .clone() .map(|error_code_message| error_code_message.error_code) .unwrap_or(consts::NO_ERROR_CODE.to_string()), // message vary for the same code, so relying on code alone as it is unique message: option_error_code_message .map(|error_code_message| error_code_message.error_code) .unwrap_or(consts::NO_ERROR_MESSAGE.to_string()), reason: reason .or(response_data.description) .or(response_data.payment_description), attempt_status: None, connector_transaction_id: response_data.instance_id, network_advice_code: None, network_decline_code: None, network_error_message: None, connector_metadata: None, }) } Err(error_msg) => { event_builder.map(|event| event.set_error(serde_json::json!({"error": res.response.escape_ascii().to_string(), "status_code": res.status_code}))); router_env::logger::error!(deserialization_error =? error_msg); utils::handle_json_response_deserialization_failure(res, "trustpay") } } }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 487, "total_crates": null }
fn_clm_hyperswitch_connectors_get_url_1046487541936808712
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/trustpay // Implementation of Trustpay for ConnectorIntegration<RSync, RefundsData, RefundsResponseData> fn get_url( &self, req: &RefundSyncRouterData, connectors: &Connectors, ) -> CustomResult<String, errors::ConnectorError> { let id = req .request .connector_refund_id .to_owned() .ok_or(errors::ConnectorError::MissingConnectorRefundID)?; match req.payment_method { enums::PaymentMethod::BankRedirect | enums::PaymentMethod::BankTransfer => Ok(format!( "{}{}/{}", connectors.trustpay.base_url_bank_redirects, "api/Payments/Payment", id )), _ => Ok(format!( "{}{}/{}", self.base_url(connectors), "api/v1/instance", id )), } }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 411, "total_crates": null }
fn_clm_hyperswitch_connectors_get_headers_1046487541936808712
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/trustpay // Implementation of Trustpay for ConnectorIntegration<RSync, RefundsData, RefundsResponseData> fn get_headers( &self, req: &RefundSyncRouterData, connectors: &Connectors, ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> { self.build_headers(req, connectors) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 382, "total_crates": null }
fn_clm_hyperswitch_connectors_common_get_content_type_1046487541936808712
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/trustpay // Implementation of Trustpay for ConnectorCommon fn common_get_content_type(&self) -> &'static str { "application/x-www-form-urlencoded" }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 377, "total_crates": null }
fn_clm_hyperswitch_connectors_new_2696809393874753023
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/placetopay // Inherent implementation for Placetopay pub fn new() -> &'static Self { &Self { amount_converter: &MinorUnitForConnector, } }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 14463, "total_crates": null }
fn_clm_hyperswitch_connectors_build_error_response_2696809393874753023
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/placetopay // Implementation of Placetopay for ConnectorCommon fn build_error_response( &self, res: Response, event_builder: Option<&mut ConnectorEvent>, ) -> CustomResult<ErrorResponse, errors::ConnectorError> { let response: placetopay::PlacetopayErrorResponse = res .response .parse_struct("PlacetopayErrorResponse") .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; event_builder.map(|i| i.set_error_response_body(&response)); router_env::logger::info!(connector_response=?response); Ok(ErrorResponse { status_code: res.status_code, code: response.status.reason.to_owned(), message: response.status.message.to_owned(), reason: Some(response.status.message), attempt_status: None, connector_transaction_id: None, network_advice_code: None, network_decline_code: None, network_error_message: None, connector_metadata: None, }) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 443, "total_crates": null }
fn_clm_hyperswitch_connectors_get_url_2696809393874753023
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/placetopay // Implementation of Placetopay for ConnectorIntegration<RSync, RefundsData, RefundsResponseData> fn get_url( &self, _req: &RefundSyncRouterData, connectors: &Connectors, ) -> CustomResult<String, errors::ConnectorError> { Ok(format!("{}/query", self.base_url(connectors))) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 407, "total_crates": null }
fn_clm_hyperswitch_connectors_get_headers_2696809393874753023
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/placetopay // Implementation of Placetopay for ConnectorIntegration<RSync, RefundsData, RefundsResponseData> fn get_headers( &self, req: &RefundSyncRouterData, connectors: &Connectors, ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> { self.build_headers(req, connectors) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 382, "total_crates": null }
fn_clm_hyperswitch_connectors_common_get_content_type_2696809393874753023
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/placetopay // Implementation of Placetopay for ConnectorCommon fn common_get_content_type(&self) -> &'static str { "application/json" }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 377, "total_crates": null }
fn_clm_hyperswitch_connectors_new_-9168401276809948367
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/checkbook // Inherent implementation for Checkbook pub fn new() -> &'static Self { &Self { amount_converter: &FloatMajorUnitForConnector, } }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 14463, "total_crates": null }
fn_clm_hyperswitch_connectors_build_error_response_-9168401276809948367
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/checkbook // Implementation of Checkbook for ConnectorCommon fn build_error_response( &self, res: Response, event_builder: Option<&mut ConnectorEvent>, ) -> CustomResult<ErrorResponse, errors::ConnectorError> { let response: checkbook::CheckbookErrorResponse = res .response .parse_struct("CheckbookErrorResponse") .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; event_builder.map(|i| i.set_response_body(&response)); router_env::logger::info!(connector_response=?response); Ok(ErrorResponse { status_code: res.status_code, code: response.code, message: response.message, reason: response.reason, attempt_status: None, connector_transaction_id: None, network_advice_code: None, network_decline_code: None, network_error_message: None, connector_metadata: None, }) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 439, "total_crates": null }
fn_clm_hyperswitch_connectors_get_url_-9168401276809948367
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/checkbook // Implementation of Checkbook for ConnectorIntegration<RSync, RefundsData, RefundsResponseData> fn get_url( &self, _req: &RefundSyncRouterData, _connectors: &Connectors, ) -> CustomResult<String, errors::ConnectorError> { Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into()) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 413, "total_crates": null }
fn_clm_hyperswitch_connectors_get_headers_-9168401276809948367
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/checkbook // Implementation of Checkbook for ConnectorIntegration<RSync, RefundsData, RefundsResponseData> fn get_headers( &self, req: &RefundSyncRouterData, connectors: &Connectors, ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> { self.build_headers(req, connectors) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 382, "total_crates": null }
fn_clm_hyperswitch_connectors_common_get_content_type_-9168401276809948367
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/checkbook // Implementation of Checkbook for ConnectorCommon fn common_get_content_type(&self) -> &'static str { "application/json" }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 377, "total_crates": null }
fn_clm_hyperswitch_connectors_new_4133134821148767362
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/santander // Inherent implementation for Santander pub fn new() -> &'static Self { &Self { amount_converter: &StringMajorUnitForConnector, } }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 14463, "total_crates": null }
fn_clm_hyperswitch_connectors_build_error_response_4133134821148767362
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/santander // Implementation of Santander for ConnectorCommon fn build_error_response( &self, res: Response, event_builder: Option<&mut ConnectorEvent>, ) -> CustomResult<ErrorResponse, errors::ConnectorError> { let response: santander::SantanderErrorResponse = res .response .parse_struct("SantanderErrorResponse") .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; event_builder.map(|i| i.set_response_body(&response)); router_env::logger::info!(connector_response=?response); match response { santander::SantanderErrorResponse::PixQrCode(response) => { let message = response .detail .as_ref() .cloned() .unwrap_or_else(|| NO_ERROR_MESSAGE.to_string()); Ok(ErrorResponse { status_code: res.status_code, code: response.status.to_string(), message, reason: response.detail.clone(), attempt_status: None, connector_transaction_id: None, network_advice_code: None, network_decline_code: None, network_error_message: None, connector_metadata: None, }) } santander::SantanderErrorResponse::Boleto(response) => Ok(ErrorResponse { status_code: res.status_code, code: response.error_code.to_string(), message: response.error_message.clone(), reason: Some( response .errors .as_ref() .and_then(|v| v.first()) .map(|e| e.message.clone()) .unwrap_or_else(|| NO_ERROR_MESSAGE.to_string()), ), attempt_status: None, connector_transaction_id: None, network_advice_code: None, network_decline_code: None, network_error_message: None, connector_metadata: None, }), } }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 469, "total_crates": null }
fn_clm_hyperswitch_connectors_get_url_4133134821148767362
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/santander // Implementation of Santander for ConnectorIntegration<RSync, RefundsData, RefundsResponseData> fn get_url( &self, req: &RefundSyncRouterData, connectors: &Connectors, ) -> CustomResult<String, errors::ConnectorError> { let connector_metadata = req.request.connector_metadata.clone(); let end_to_end_id = match &connector_metadata { Some(metadata) => match metadata.get("end_to_end_id") { Some(val) => val.as_str().map(|id| id.to_string()), None => None, }, None => None, } .ok_or_else(|| errors::ConnectorError::MissingRequiredField { field_name: "end_to_end_id", })?; Ok(format!( "{}{}{}{}{}", self.base_url(connectors), "pix/", end_to_end_id, "/return/", req.request.get_connector_refund_id()? )) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 419, "total_crates": null }
fn_clm_hyperswitch_connectors_get_headers_4133134821148767362
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/santander // Implementation of Santander for ConnectorIntegration<RSync, RefundsData, RefundsResponseData> fn get_headers( &self, req: &RefundSyncRouterData, connectors: &Connectors, ) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> { self.build_headers(req, connectors) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 382, "total_crates": null }
fn_clm_hyperswitch_connectors_common_get_content_type_4133134821148767362
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/santander // Implementation of Santander for ConnectorCommon fn common_get_content_type(&self) -> &'static str { "application/json" }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 377, "total_crates": null }
fn_clm_hyperswitch_connectors_new_-3489247841212587655
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/tokenio // Implementation of None for Tokenio pub fn new() -> &'static Self { &Self { amount_converter: &StringMajorUnitForConnector, } }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 14463, "total_crates": null }
fn_clm_hyperswitch_connectors_build_error_response_-3489247841212587655
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/tokenio // Implementation of Tokenio for ConnectorCommon fn build_error_response( &self, res: Response, event_builder: Option<&mut ConnectorEvent>, ) -> CustomResult<ErrorResponse, errors::ConnectorError> { let response: tokenio::TokenioErrorResponse = res .response .parse_struct("TokenioErrorResponse") .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; event_builder.map(|i| i.set_response_body(&response)); router_env::logger::info!(connector_response=?response); Ok(ErrorResponse { status_code: res.status_code, code: response.get_error_code(), message: response.get_message(), reason: Some(response.get_message()), attempt_status: None, connector_transaction_id: None, network_decline_code: None, network_advice_code: None, network_error_message: None, connector_metadata: None, }) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 445, "total_crates": null }
fn_clm_hyperswitch_connectors_get_url_-3489247841212587655
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/tokenio // Implementation of Tokenio for ConnectorIntegration<PSync, PaymentsSyncData, PaymentsResponseData> fn get_url( &self, req: &PaymentsSyncRouterData, connectors: &Connectors, ) -> CustomResult<String, errors::ConnectorError> { let connector_payment_id = req .request .connector_transaction_id .get_connector_transaction_id() .change_context(errors::ConnectorError::MissingConnectorTransactionID)?; let base_url = self.base_url(connectors); Ok(format!("{base_url}/v2/payments/{connector_payment_id}")) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 413, "total_crates": null }
fn_clm_hyperswitch_connectors_get_headers_-3489247841212587655
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/tokenio // Implementation of Tokenio for ConnectorIntegration<PSync, PaymentsSyncData, PaymentsResponseData> fn get_headers( &self, req: &PaymentsSyncRouterData, connectors: &Connectors, ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> { // For GET requests, we need JWT with detached format (no body) let auth = tokenio::TokenioAuthType::try_from(&req.connector_auth_type) .change_context(errors::ConnectorError::FailedToObtainAuthType)?; // Use empty RequestContent for GET requests - the create_jwt_token method // will handle this properly by creating detached JWT let empty_body = RequestContent::Json(Box::new(serde_json::json!({}))); let path = format!( "/v2/payments/{}", req.request .connector_transaction_id .get_connector_transaction_id() .change_context(errors::ConnectorError::MissingConnectorTransactionID)? ); let jwt = self.create_jwt_token(&auth, "GET", &path, &empty_body, connectors)?; let headers = vec![ ( headers::CONTENT_TYPE.to_string(), "application/json".to_string().into(), ), ( headers::AUTHORIZATION.to_string(), format!("Bearer {jwt}").into_masked(), ), ]; Ok(headers) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 390, "total_crates": null }
fn_clm_hyperswitch_connectors_common_get_content_type_-3489247841212587655
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/tokenio // Implementation of Tokenio for ConnectorCommon fn common_get_content_type(&self) -> &'static str { "application/json" }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 377, "total_crates": null }
fn_clm_hyperswitch_connectors_build_error_response_6332386781940503677
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/vgs // Implementation of Vgs for ConnectorCommon fn build_error_response( &self, res: Response, event_builder: Option<&mut ConnectorEvent>, ) -> CustomResult<ErrorResponse, errors::ConnectorError> { let response: vgs::VgsErrorResponse = res .response .parse_struct("VgsErrorResponse") .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; event_builder.map(|i| i.set_response_body(&response)); router_env::logger::info!(connector_response=?response); let error = response .errors .first() .ok_or(errors::ConnectorError::ResponseHandlingFailed)?; Ok(ErrorResponse { status_code: res.status_code, code: error.code.clone(), message: error.code.clone(), reason: error.detail.clone(), attempt_status: None, connector_transaction_id: None, network_decline_code: None, network_advice_code: None, network_error_message: None, connector_metadata: None, }) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 449, "total_crates": null }
fn_clm_hyperswitch_connectors_get_url_6332386781940503677
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/vgs // Implementation of Vgs for ConnectorIntegration<ExternalVaultRetrieveFlow, VaultRequestData, VaultResponseData> fn get_url( &self, req: &VaultRouterData<ExternalVaultRetrieveFlow>, connectors: &Connectors, ) -> CustomResult<String, errors::ConnectorError> { let alias = req.request.connector_vault_id.clone().ok_or( errors::ConnectorError::MissingRequiredField { field_name: "connector_vault_id", }, )?; Ok(format!("{}aliases/{alias}", self.base_url(connectors))) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 411, "total_crates": null }
fn_clm_hyperswitch_connectors_get_headers_6332386781940503677
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/vgs // Implementation of Vgs for ConnectorIntegration<ExternalVaultRetrieveFlow, VaultRequestData, VaultResponseData> fn get_headers( &self, req: &VaultRouterData<ExternalVaultRetrieveFlow>, connectors: &Connectors, ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> { self.build_headers(req, connectors) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 382, "total_crates": null }
fn_clm_hyperswitch_connectors_common_get_content_type_6332386781940503677
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/vgs // Implementation of Vgs for ConnectorCommon fn common_get_content_type(&self) -> &'static str { "application/json" }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 377, "total_crates": null }
fn_clm_hyperswitch_connectors_build_headers_6332386781940503677
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/vgs // Implementation of Vgs for ConnectorCommonExt<Flow, Request, Response> fn build_headers( &self, req: &RouterData<Flow, Request, Response>, _connectors: &Connectors, ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> { let auth = vgs::VgsAuthType::try_from(&req.connector_auth_type) .change_context(errors::ConnectorError::FailedToObtainAuthType)?; let auth_value = auth .username .zip(auth.password) .map(|(username, password)| { format!( "Basic {}", common_utils::consts::BASE64_ENGINE.encode(format!("{username}:{password}")) ) }); Ok(vec![( headers::AUTHORIZATION.to_string(), auth_value.into_masked(), )]) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 376, "total_crates": null }
fn_clm_hyperswitch_connectors_new_-3299704211476279884
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/bamboraapac // Inherent implementation for Bamboraapac pub const fn new() -> &'static Self { &Self { amount_converter: &MinorUnitForConnector, } }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 14463, "total_crates": null }
fn_clm_hyperswitch_connectors_build_error_response_-3299704211476279884
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/bamboraapac // Implementation of Bamboraapac for ConnectorCommon fn build_error_response( &self, res: Response, event_builder: Option<&mut ConnectorEvent>, ) -> CustomResult<ErrorResponse, errors::ConnectorError> { let response: Result< bamboraapac::BamboraapacErrorResponse, Report<common_utils::errors::ParsingError>, > = res.response.parse_struct("BamboraapacErrorResponse"); match response { Ok(response_data) => { event_builder.map(|i| i.set_error_response_body(&response_data)); router_env::logger::info!(connector_response=?response_data); Ok(ErrorResponse { status_code: res.status_code, code: response_data .declined_code .unwrap_or(NO_ERROR_CODE.to_string()), message: response_data .declined_message .clone() .unwrap_or(NO_ERROR_MESSAGE.to_string()), reason: response_data.declined_message, attempt_status: None, connector_transaction_id: None, network_advice_code: None, network_decline_code: None, network_error_message: None, connector_metadata: None, }) } Err(error_msg) => { event_builder.map(|event| event.set_error(serde_json::json!({"error": res.response.escape_ascii().to_string(), "status_code": res.status_code}))); router_env::logger::error!(deserialization_error =? error_msg); utils::handle_json_response_deserialization_failure(res, "bamboaraapac") } } }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 453, "total_crates": null }
fn_clm_hyperswitch_connectors_get_url_-3299704211476279884
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/bamboraapac // Implementation of Bamboraapac for ConnectorIntegration<RSync, RefundsData, RefundsResponseData> fn get_url( &self, _req: &RefundSyncRouterData, connectors: &Connectors, ) -> CustomResult<String, errors::ConnectorError> { Ok(format!("{}/dts.asmx", self.base_url(connectors))) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 407, "total_crates": null }
fn_clm_hyperswitch_connectors_get_headers_-3299704211476279884
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/bamboraapac // Implementation of Bamboraapac for ConnectorIntegration<RSync, RefundsData, RefundsResponseData> fn get_headers( &self, req: &RefundSyncRouterData, connectors: &Connectors, ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> { self.build_headers(req, connectors) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 382, "total_crates": null }
fn_clm_hyperswitch_connectors_common_get_content_type_-3299704211476279884
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/bamboraapac // Implementation of Bamboraapac for ConnectorCommon fn common_get_content_type(&self) -> &'static str { "text/xml" }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 377, "total_crates": null }
fn_clm_hyperswitch_connectors_new_-4477031656249590711
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/gpayments // Inherent implementation for Gpayments pub fn new() -> &'static Self { &Self { _amount_converter: &MinorUnitForConnector, } }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 14463, "total_crates": null }
fn_clm_hyperswitch_connectors_build_error_response_-4477031656249590711
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/gpayments // Implementation of Gpayments for ConnectorCommon fn build_error_response( &self, res: Response, event_builder: Option<&mut ConnectorEvent>, ) -> CustomResult<ErrorResponse, ConnectorError> { let response: gpayments_types::TDS2ApiError = res .response .parse_struct("gpayments_types TDS2ApiError") .change_context(ConnectorError::ResponseDeserializationFailed)?; event_builder.map(|i| i.set_response_body(&response)); router_env::logger::info!(connector_response=?response); Ok(ErrorResponse { status_code: res.status_code, code: response.error_code, message: response.error_description, reason: response.error_detail, attempt_status: None, connector_transaction_id: None, network_advice_code: None, network_decline_code: None, network_error_message: None, connector_metadata: None, }) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 439, "total_crates": null }
fn_clm_hyperswitch_connectors_get_url_-4477031656249590711
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/gpayments // Implementation of Gpayments for ConnectorIntegration< PreAuthenticationVersionCall, PreAuthNRequestData, AuthenticationResponseData, > fn get_url( &self, req: &PreAuthNVersionCallRouterData, connectors: &Connectors, ) -> CustomResult<String, ConnectorError> { let base_url = build_endpoint(self.base_url(connectors), &req.connector_meta_data)?; Ok(format!("{base_url}/api/v2/auth/enrol")) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 411, "total_crates": null }
fn_clm_hyperswitch_connectors_get_headers_-4477031656249590711
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/gpayments // Implementation of Gpayments for ConnectorIntegration< PreAuthenticationVersionCall, PreAuthNRequestData, AuthenticationResponseData, > fn get_headers( &self, req: &PreAuthNVersionCallRouterData, connectors: &Connectors, ) -> CustomResult<Vec<(String, Maskable<String>)>, ConnectorError> { self.build_headers(req, connectors) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 382, "total_crates": null }
fn_clm_hyperswitch_connectors_common_get_content_type_-4477031656249590711
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/gpayments // Implementation of Gpayments for ConnectorCommon fn common_get_content_type(&self) -> &'static str { "application/json" }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 377, "total_crates": null }
fn_clm_hyperswitch_connectors_new_-7684643110463353787
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/moneris // Inherent implementation for Moneris pub fn new() -> &'static Self { &Self { amount_converter: &MinorUnitForConnector, } }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 14463, "total_crates": null }
fn_clm_hyperswitch_connectors_build_error_response_-7684643110463353787
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/moneris // Implementation of Moneris for ConnectorCommon fn build_error_response( &self, res: Response, event_builder: Option<&mut ConnectorEvent>, ) -> CustomResult<ErrorResponse, errors::ConnectorError> { let response: moneris::MonerisErrorResponse = res .response .parse_struct("MonerisErrorResponse") .change_context(errors::ConnectorError::ResponseDeserializationFailed)?; event_builder.map(|i| i.set_response_body(&response)); router_env::logger::info!(connector_response=?response); let reason = match &response.errors { Some(error_list) => error_list .iter() .map(|error| error.parameter_name.clone()) .collect::<Vec<String>>() .join(" & "), None => response.title.clone(), }; Ok(ErrorResponse { status_code: res.status_code, code: response.category, message: response.title, reason: Some(reason), attempt_status: None, connector_transaction_id: None, network_advice_code: None, network_decline_code: None, network_error_message: None, connector_metadata: None, }) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 449, "total_crates": null }
fn_clm_hyperswitch_connectors_get_url_-7684643110463353787
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/moneris // Implementation of Moneris for ConnectorIntegration<RSync, RefundsData, RefundsResponseData> fn get_url( &self, req: &RefundSyncRouterData, connectors: &Connectors, ) -> CustomResult<String, errors::ConnectorError> { let refund_id = req.request.get_connector_refund_id()?; Ok(format!("{}/refunds/{refund_id}", self.base_url(connectors))) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 409, "total_crates": null }
fn_clm_hyperswitch_connectors_build_headers_-7684643110463353787
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/moneris // Implementation of Moneris for ConnectorCommonExt<Flow, Request, Response> fn build_headers( &self, req: &RouterData<Flow, Request, Response>, _connectors: &Connectors, ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> { let auth = moneris::MonerisAuthType::try_from(&req.connector_auth_type) .change_context(errors::ConnectorError::FailedToObtainAuthType)?; let mut header = vec![ ( headers::CONTENT_TYPE.to_string(), self.get_content_type().to_string().into(), ), ( moneris::auth_headers::API_VERSION.to_string(), "2024-09-17".to_string().into(), ), ( moneris::auth_headers::X_MERCHANT_ID.to_string(), auth.merchant_id.expose().into_masked(), ), ]; let access_token = req .access_token .clone() .ok_or(errors::ConnectorError::FailedToObtainAuthType)?; let auth_header = ( headers::AUTHORIZATION.to_string(), format!("Bearer {}", access_token.token.peek()).into_masked(), ); header.push(auth_header); Ok(header) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 382, "total_crates": null }
fn_clm_hyperswitch_connectors_get_headers_-7684643110463353787
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/moneris // Implementation of Moneris for ConnectorIntegration<RSync, RefundsData, RefundsResponseData> fn get_headers( &self, req: &RefundSyncRouterData, connectors: &Connectors, ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> { self.build_headers(req, connectors) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 382, "total_crates": null }
fn_clm_hyperswitch_connectors_build_error_response_-9098220487621272568
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/threedsecureio // Implementation of Threedsecureio for ConnectorCommon fn build_error_response( &self, res: Response, event_builder: Option<&mut ConnectorEvent>, ) -> CustomResult<ErrorResponse, ConnectorError> { let response_result: Result< threedsecureio::ThreedsecureioErrorResponse, error_stack::Report<common_utils::errors::ParsingError>, > = res.response.parse_struct("ThreedsecureioErrorResponse"); match response_result { Ok(response) => { event_builder.map(|i| i.set_error_response_body(&response)); router_env::logger::info!(connector_response=?response); Ok(ErrorResponse { status_code: res.status_code, code: response.error_code, message: response .error_description .clone() .unwrap_or(NO_ERROR_MESSAGE.to_owned()), reason: response.error_description, attempt_status: None, connector_transaction_id: None, network_advice_code: None, network_decline_code: None, network_error_message: None, connector_metadata: None, }) } Err(err) => { router_env::logger::error!(deserialization_error =? err); handle_json_response_deserialization_failure(res, "threedsecureio") } } }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 445, "total_crates": null }
fn_clm_hyperswitch_connectors_get_url_-9098220487621272568
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/threedsecureio // Implementation of Threedsecureio for ConnectorIntegration< PostAuthentication, ConnectorPostAuthenticationRequestData, AuthenticationResponseData, > fn get_url( &self, _req: &ConnectorPostAuthenticationRouterData, connectors: &Connectors, ) -> CustomResult<String, ConnectorError> { Ok(format!("{}/postauth", self.base_url(connectors),)) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 407, "total_crates": null }
fn_clm_hyperswitch_connectors_get_headers_-9098220487621272568
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/threedsecureio // Implementation of Threedsecureio for ConnectorIntegration< PostAuthentication, ConnectorPostAuthenticationRequestData, AuthenticationResponseData, > fn get_headers( &self, req: &ConnectorPostAuthenticationRouterData, connectors: &Connectors, ) -> CustomResult<Vec<(String, Maskable<String>)>, ConnectorError> { self.build_headers(req, connectors) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 382, "total_crates": null }
fn_clm_hyperswitch_connectors_common_get_content_type_-9098220487621272568
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/threedsecureio // Implementation of Threedsecureio for ConnectorCommon fn common_get_content_type(&self) -> &'static str { "application/json" }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 377, "total_crates": null }
fn_clm_hyperswitch_connectors_build_headers_-9098220487621272568
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/threedsecureio // Implementation of Threedsecureio for ConnectorCommonExt<Flow, Request, Response> fn build_headers( &self, req: &RouterData<Flow, Request, Response>, _connectors: &Connectors, ) -> CustomResult<Vec<(String, Maskable<String>)>, ConnectorError> { let mut header = vec![( headers::CONTENT_TYPE.to_string(), "application/json; charset=utf-8".to_string().into(), )]; let mut api_key = self.get_auth_header(&req.connector_auth_type)?; header.append(&mut api_key); Ok(header) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 372, "total_crates": null }
fn_clm_hyperswitch_connectors_new_-7616916608740747107
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/nexixpay // Inherent implementation for Nexixpay pub fn new() -> &'static Self { &Self { amount_converter: &StringMinorUnitForConnector, } }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 14463, "total_crates": null }
fn_clm_hyperswitch_connectors_build_error_response_-7616916608740747107
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/nexixpay // Implementation of Nexixpay for ConnectorCommon fn build_error_response( &self, res: Response, event_builder: Option<&mut ConnectorEvent>, ) -> CustomResult<ErrorResponse, errors::ConnectorError> { let response: nexixpay::NexixpayErrorResponse = match res.status_code { 401 => nexixpay::NexixpayErrorResponse { errors: vec![nexixpay::NexixpayErrorBody { code: Some(consts::NO_ERROR_CODE.to_string()), description: Some("UNAUTHORIZED".to_string()), }], }, 404 => nexixpay::NexixpayErrorResponse { errors: vec![nexixpay::NexixpayErrorBody { code: Some(consts::NO_ERROR_CODE.to_string()), description: Some("NOT FOUND".to_string()), }], }, _ => res .response .parse_struct("NexixpayErrorResponse") .change_context(errors::ConnectorError::ResponseDeserializationFailed)?, }; let concatenated_descriptions: Option<String> = { let descriptions: Vec<String> = response .errors .iter() .filter_map(|error| error.description.as_ref()) .cloned() .collect(); if descriptions.is_empty() { None } else { Some(descriptions.join(", ")) } }; event_builder.map(|i| i.set_response_body(&response)); router_env::logger::info!(connector_response=?response); Ok(ErrorResponse { status_code: res.status_code, code: response .errors .first() .and_then(|error| error.code.clone()) .unwrap_or(consts::NO_ERROR_CODE.to_string()), message: response .errors .first() .and_then(|error| error.description.clone()) .unwrap_or(consts::NO_ERROR_MESSAGE.to_string()), reason: concatenated_descriptions, attempt_status: None, connector_transaction_id: None, network_advice_code: None, network_decline_code: None, network_error_message: None, connector_metadata: None, }) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 473, "total_crates": null }
fn_clm_hyperswitch_connectors_get_url_-7616916608740747107
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/nexixpay // Implementation of Nexixpay for ConnectorIntegration<RSync, RefundsData, RefundsResponseData> fn get_url( &self, req: &RefundSyncRouterData, connectors: &Connectors, ) -> CustomResult<String, errors::ConnectorError> { let connector_refund_id = req.request.get_connector_refund_id()?; Ok(format!( "{}/operations/{}", self.base_url(connectors), connector_refund_id )) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 409, "total_crates": null }
fn_clm_hyperswitch_connectors_get_headers_-7616916608740747107
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/nexixpay // Implementation of Nexixpay for ConnectorIntegration<RSync, RefundsData, RefundsResponseData> fn get_headers( &self, req: &RefundSyncRouterData, connectors: &Connectors, ) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> { self.build_headers(req, connectors) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 382, "total_crates": null }
fn_clm_hyperswitch_connectors_common_get_content_type_-7616916608740747107
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/nexixpay // Implementation of Nexixpay for ConnectorCommon fn common_get_content_type(&self) -> &'static str { "application/json" }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 377, "total_crates": null }
fn_clm_hyperswitch_connectors_try_from_-6425304996702821458
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/powertranz/transformers // Implementation of RefundsRouterData<Execute> for TryFrom<RefundsResponseRouterData<Execute, PowertranzBaseResponse>> fn try_from( item: RefundsResponseRouterData<Execute, PowertranzBaseResponse>, ) -> Result<Self, Self::Error> { let error_response = build_error_response(&item.response, item.http_code); let response = error_response.map_or( Ok(RefundsResponseData { connector_refund_id: item.response.transaction_identifier.to_string(), refund_status: match item.response.approved { true => enums::RefundStatus::Success, false => enums::RefundStatus::Failure, }, }), Err, ); Ok(Self { response, ..item.data }) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 2663, "total_crates": null }
fn_clm_hyperswitch_connectors_build_error_response_-6425304996702821458
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/powertranz/transformers fn build_error_response(item: &PowertranzBaseResponse, status_code: u16) -> Option<ErrorResponse> { // errors object has highest precedence to get error message and code let error_response = if item.errors.is_some() { item.errors.as_ref().map(|errors| { let first_error = errors.first(); let code = first_error.map(|error| error.code.clone()); let message = first_error.map(|error| error.message.clone()); ErrorResponse { status_code, code: code.unwrap_or_else(|| consts::NO_ERROR_CODE.to_string()), message: message.unwrap_or_else(|| consts::NO_ERROR_MESSAGE.to_string()), reason: Some( errors .iter() .map(|error| format!("{} : {}", error.code, error.message)) .collect::<Vec<_>>() .join(", "), ), attempt_status: None, connector_transaction_id: None, network_advice_code: None, network_decline_code: None, network_error_message: None, connector_metadata: None, } }) } else if !ISO_SUCCESS_CODES.contains(&item.iso_response_code.as_str()) { // Incase error object is not present the error message and code should be propagated based on iso_response_code Some(ErrorResponse { status_code, code: item.iso_response_code.clone(), message: item.response_message.clone(), reason: Some(item.response_message.clone()), attempt_status: None, connector_transaction_id: None, network_advice_code: None, network_decline_code: None, network_error_message: None, connector_metadata: None, }) } else { None }; error_response }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 463, "total_crates": null }
fn_clm_hyperswitch_connectors_get_status_-6425304996702821458
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/powertranz/transformers fn get_status((transaction_type, approved, is_3ds): (u8, bool, bool)) -> enums::AttemptStatus { match transaction_type { // Auth 1 => match approved { true => enums::AttemptStatus::Authorized, false => match is_3ds { true => enums::AttemptStatus::AuthenticationPending, false => enums::AttemptStatus::Failure, }, }, // Sale 2 => match approved { true => enums::AttemptStatus::Charged, false => match is_3ds { true => enums::AttemptStatus::AuthenticationPending, false => enums::AttemptStatus::Failure, }, }, // Capture 3 => match approved { true => enums::AttemptStatus::Charged, false => enums::AttemptStatus::Failure, }, // Void 4 => match approved { true => enums::AttemptStatus::Voided, false => enums::AttemptStatus::VoidFailed, }, // Refund 5 => match approved { true => enums::AttemptStatus::AutoRefunded, false => enums::AttemptStatus::Failure, }, // Risk Management _ => match approved { true => enums::AttemptStatus::Pending, false => enums::AttemptStatus::Failure, }, } }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 15, "total_crates": null }
fn_clm_hyperswitch_connectors_is_3ds_payment_-6425304996702821458
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/powertranz/transformers fn is_3ds_payment(response_code: String) -> bool { matches!(response_code.as_str(), "SP4") }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 0, "total_crates": null }
fn_clm_hyperswitch_connectors_try_from_-2656875145764927889
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/stax/transformers // Implementation of types::RefundsRouterData<RSync> for TryFrom<RefundsResponseRouterData<RSync, RefundResponse>> fn try_from( item: RefundsResponseRouterData<RSync, RefundResponse>, ) -> Result<Self, Self::Error> { let refund_status = match item.response.success { true => enums::RefundStatus::Success, false => enums::RefundStatus::Failure, }; Ok(Self { response: Ok(RefundsResponseData { connector_refund_id: item.response.id, refund_status, }), ..item.data }) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 2657, "total_crates": null }
fn_clm_hyperswitch_connectors_try_from_-1202786162308323514
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/tesouro/transformers // Implementation of RefundsRouterData<RSync> for TryFrom<RefundsResponseRouterData<RSync, TesouroSyncResponse>> fn try_from( item: RefundsResponseRouterData<RSync, TesouroSyncResponse>, ) -> Result<Self, Self::Error> { match item.response { TesouroApiResponse::TesouroApiSuccessResponse(response) => { let status = match response.data.payment_transaction.typename { TesouroSyncStatus::ApprovedRefund => enums::RefundStatus::Success, TesouroSyncStatus::DeclinedRefund | TesouroSyncStatus::DeclinedRefundAuthorization => { enums::RefundStatus::Failure } TesouroSyncStatus::GenericPaymentTransaction | TesouroSyncStatus::Refund | TesouroSyncStatus::RefundAuthorization | TesouroSyncStatus::ApprovedRefundAuthorization => { enums::RefundStatus::Pending } _ => { return Err(errors::ConnectorError::UnexpectedResponseError( bytes::Bytes::from("Invalid Status Recieved".to_string()), ) .into()) } }; if connector_utils::is_refund_failure(status) { let error_code = response .data .payment_transaction .processor_response_code .unwrap_or(NO_ERROR_CODE.to_string()); let error_message = response .data .payment_transaction .processor_response_message .unwrap_or(NO_ERROR_CODE.to_string()); Ok(Self { response: Err(ErrorResponse { code: error_code.clone(), message: error_message.clone(), reason: Some(error_message.clone()), status_code: item.http_code, attempt_status: None, connector_transaction_id: None, network_advice_code: None, network_decline_code: None, network_error_message: None, connector_metadata: None, }), ..item.data }) } else { Ok(Self { response: Ok(RefundsResponseData { connector_refund_id: response.data.payment_transaction.id, refund_status: enums::RefundStatus::Success, }), ..item.data }) } } TesouroApiResponse::TesouroErrorResponse(error_response) => { let message = error_response .errors .iter() .map(|error| error.message.to_string()) .collect::<Vec<String>>(); let error_message = match !message.is_empty() { true => Some(message.join(" ")), false => None, }; Ok(Self { response: Err(ErrorResponse { code: NO_ERROR_CODE.to_string(), message: error_message .clone() .unwrap_or(NO_ERROR_MESSAGE.to_string()), reason: error_message.clone(), status_code: item.http_code, attempt_status: None, connector_transaction_id: None, network_advice_code: None, network_decline_code: None, network_error_message: None, connector_metadata: None, }), ..item.data }) } } }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 2701, "total_crates": null }
fn_clm_hyperswitch_connectors_from_-1202786162308323514
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/tesouro/transformers // Implementation of BillToAddress for From<&PaymentsAuthorizeRouterData> fn from(router_data: &PaymentsAuthorizeRouterData) -> Self { Self { address1: router_data.get_optional_billing_line1(), address2: router_data.get_optional_billing_line2(), address3: router_data.get_optional_billing_line3(), city: router_data.get_optional_billing_city(), country_code: router_data .get_optional_billing_country() .map(|billing_country| { common_enums::CountryAlpha2::from_alpha2_to_alpha3(billing_country) }), first_name: router_data.get_optional_billing_first_name(), last_name: router_data.get_optional_billing_last_name(), postal_code: router_data.get_optional_billing_zip(), state: router_data.get_optional_billing_state(), } }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 2622, "total_crates": null }
fn_clm_hyperswitch_connectors_get_valid_transaction_id_-1202786162308323514
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/tesouro/transformers fn get_valid_transaction_id( id: String, ) -> Result<String, error_stack::Report<errors::ConnectorError>> { if id.len() <= tesouro_constants::MAX_PAYMENT_REFERENCE_ID_LENGTH { Ok(id.clone()) } else { Err(errors::ConnectorError::MaxFieldLengthViolated { connector: "Tesouro".to_string(), field_name: "transaction_reference".to_string(), max_length: tesouro_constants::MAX_PAYMENT_REFERENCE_ID_LENGTH, received_length: id.len(), } .into()) } }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 12, "total_crates": null }
fn_clm_hyperswitch_connectors_get_acceptor_id_-1202786162308323514
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/tesouro/transformers // Inherent implementation for TesouroAuthType fn get_acceptor_id(&self) -> Secret<String> { self.acceptor_id.clone() }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 10, "total_crates": null }
fn_clm_hyperswitch_connectors_get_payment_attempt_status_-1202786162308323514
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/tesouro/transformers fn get_payment_attempt_status( status: TesouroSyncStatus, is_auto_capture: bool, previous_status: enums::AttemptStatus, ) -> Result<enums::AttemptStatus, errors::ConnectorError> { match status { TesouroSyncStatus::AcceptedSale | TesouroSyncStatus::ApprovedCapture => { Ok(enums::AttemptStatus::Charged) } TesouroSyncStatus::ApprovedAuthorization => { if is_auto_capture { Ok(enums::AttemptStatus::Charged) } else { Ok(enums::AttemptStatus::Authorized) } } TesouroSyncStatus::DeclinedAuthorization => { if is_auto_capture { Ok(enums::AttemptStatus::AuthorizationFailed) } else { Ok(enums::AttemptStatus::Failure) } } TesouroSyncStatus::ApprovedReversal => Ok(enums::AttemptStatus::Voided), TesouroSyncStatus::DeclinedCapture => Ok(enums::AttemptStatus::Failure), TesouroSyncStatus::DeclinedReversal => Ok(enums::AttemptStatus::VoidFailed), TesouroSyncStatus::GenericPaymentTransaction => Ok(previous_status), TesouroSyncStatus::Authorization => Ok(enums::AttemptStatus::Authorizing), TesouroSyncStatus::Capture => Ok(enums::AttemptStatus::CaptureInitiated), TesouroSyncStatus::Reversal => Ok(enums::AttemptStatus::VoidInitiated), TesouroSyncStatus::ApprovedRefund | TesouroSyncStatus::ApprovedRefundAuthorization | TesouroSyncStatus::DeclinedRefund | TesouroSyncStatus::DeclinedRefundAuthorization | TesouroSyncStatus::Refund | TesouroSyncStatus::RefundAuthorization => { Err(errors::ConnectorError::UnexpectedResponseError( bytes::Bytes::from("Invalid Status Recieved".to_string()), )) } } }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 6, "total_crates": null }
fn_clm_hyperswitch_connectors_try_from_4006676247965242892
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/sift/transformers // Implementation of RefundsRouterData<RSync> for TryFrom<RefundsResponseRouterData<RSync, RefundResponse>> fn try_from( item: RefundsResponseRouterData<RSync, RefundResponse>, ) -> Result<Self, Self::Error> { Ok(Self { response: Ok(RefundsResponseData { connector_refund_id: item.response.id.to_string(), refund_status: enums::RefundStatus::from(item.response.status), }), ..item.data }) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 2661, "total_crates": null }
fn_clm_hyperswitch_connectors_from_4006676247965242892
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/sift/transformers // Implementation of enums::RefundStatus for From<RefundStatus> fn from(item: RefundStatus) -> Self { match item { RefundStatus::Succeeded => Self::Success, RefundStatus::Failed => Self::Failure, RefundStatus::Processing => Self::Pending, //TODO: Review mapping } }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 2600, "total_crates": null }
fn_clm_hyperswitch_connectors_try_from_-6542515552520612117
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/worldpayxml/transformers // Implementation of PaymentService for TryFrom<&RefundSyncRouterData> fn try_from(item: &RefundSyncRouterData) -> Result<Self, Self::Error> { let auth = WorldpayxmlAuthType::try_from(&item.connector_auth_type) .change_context(errors::ConnectorError::FailedToObtainAuthType)?; let order_code = item.request.connector_transaction_id.clone(); let inquiry = Some(Inquiry { order_inquiry: OrderInquiry { order_code }, }); Ok(Self { version: worldpayxml_constants::WORLDPAYXML_VERSION.to_string(), merchant_code: auth.merchant_code.clone(), submit: None, reply: None, inquiry, modify: None, }) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 2667, "total_crates": null }
fn_clm_hyperswitch_connectors_from_-6542515552520612117
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/worldpayxml/transformers // Implementation of WorldpayxmlRouterData<T> for From<(StringMinorUnit, T)> fn from((amount, item): (StringMinorUnit, T)) -> Self { Self { amount, router_data: item, } }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 2600, "total_crates": null }
fn_clm_hyperswitch_connectors_process_payment_response_-6542515552520612117
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/worldpayxml/transformers fn process_payment_response( status: common_enums::AttemptStatus, payment_data: &Payment, http_code: u16, order_code: String, ) -> Result<PaymentsResponseData, Box<ErrorResponse>> { if connector_utils::is_payment_failure(status) { let error_code = payment_data .return_code .as_ref() .map(|code| code.code.clone()); let error_message = payment_data .return_code .as_ref() .map(|code| code.description.clone()); Err(Box::new(ErrorResponse { code: error_code.unwrap_or(consts::NO_ERROR_CODE.to_string()), message: error_message.unwrap_or(consts::NO_ERROR_MESSAGE.to_string()), reason: None, status_code: http_code, attempt_status: None, connector_transaction_id: Some(order_code.clone()), network_advice_code: None, network_decline_code: None, network_error_message: None, connector_metadata: None, })) } else { Ok(PaymentsResponseData::TransactionResponse { resource_id: ResponseId::ConnectorTransactionId(order_code.clone()), redirection_data: Box::new(None), mandate_reference: Box::new(None), connector_metadata: None, network_txn_id: None, connector_response_reference_id: Some(order_code.clone()), incremental_authorization_allowed: None, charges: None, }) } }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 36, "total_crates": null }
fn_clm_hyperswitch_connectors_get_attempt_status_-6542515552520612117
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/worldpayxml/transformers fn get_attempt_status( is_auto_capture: bool, last_event: LastEvent, previous_status: Option<&common_enums::AttemptStatus>, ) -> Result<common_enums::AttemptStatus, errors::ConnectorError> { match last_event { LastEvent::Authorised => { if is_auto_capture { Ok(common_enums::AttemptStatus::Pending) } else if previous_status == Some(&common_enums::AttemptStatus::CaptureInitiated) && !is_auto_capture { Ok(common_enums::AttemptStatus::CaptureInitiated) } else if previous_status == Some(&common_enums::AttemptStatus::VoidInitiated) && !is_auto_capture { Ok(common_enums::AttemptStatus::VoidInitiated) } else { Ok(common_enums::AttemptStatus::Authorized) } } LastEvent::Refused => Ok(common_enums::AttemptStatus::Failure), LastEvent::Cancelled => Ok(common_enums::AttemptStatus::Voided), LastEvent::Captured | LastEvent::Settled => Ok(common_enums::AttemptStatus::Charged), LastEvent::SentForAuthorisation => Ok(common_enums::AttemptStatus::Authorizing), LastEvent::Refunded | LastEvent::SentForRefund | LastEvent::RefundRequested | LastEvent::RefundFailed => Err(errors::ConnectorError::UnexpectedResponseError( bytes::Bytes::from("Invalid LastEvent".to_string()), )), } }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 21, "total_crates": null }
fn_clm_hyperswitch_connectors_validate_reply_-6542515552520612117
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/worldpayxml/transformers fn validate_reply(reply: &Reply) -> Result<(), errors::ConnectorError> { if (reply.error.is_some() && reply.order_status.is_some()) || (reply.error.is_none() && reply.order_status.is_none()) { Err(errors::ConnectorError::UnexpectedResponseError( bytes::Bytes::from( "Either reply.error_data or reply.order_data must be present in the response" .to_string(), ), )) } else { Ok(()) } }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 14, "total_crates": null }
fn_clm_hyperswitch_connectors_try_from_-1872629660610137086
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/coingate/transformers // Implementation of RefundsRouterData<RSync> for TryFrom<RefundsResponseRouterData<RSync, CoingateRefundResponse>> fn try_from( item: RefundsResponseRouterData<RSync, CoingateRefundResponse>, ) -> Result<Self, Self::Error> { Ok(Self { response: Ok(RefundsResponseData { connector_refund_id: item.response.id.to_string(), refund_status: enums::RefundStatus::from(item.response.status), }), ..item.data }) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 2661, "total_crates": null }
fn_clm_hyperswitch_connectors_from_-1872629660610137086
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/coingate/transformers // Implementation of common_enums::RefundStatus for From<CoingateRefundStatus> fn from(item: CoingateRefundStatus) -> Self { match item { CoingateRefundStatus::Pending => Self::Pending, CoingateRefundStatus::Completed => Self::Success, CoingateRefundStatus::Rejected => Self::Failure, CoingateRefundStatus::Processing => Self::Pending, } }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 2600, "total_crates": null }
fn_clm_hyperswitch_connectors_try_from_-6191293800730549167
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/tsys/transformers // Implementation of RefundsRouterData<RSync> for TryFrom<RefundsResponseRouterData<RSync, TsysSyncResponse>> fn try_from( item: RefundsResponseRouterData<RSync, TsysSyncResponse>, ) -> Result<Self, Self::Error> { let tsys_search_response = item.response.search_transaction_response; let response = match tsys_search_response { SearchResponseTypes::SuccessResponse(search_response) => Ok(RefundsResponseData { connector_refund_id: search_response.transaction_details.transaction_id.clone(), refund_status: enums::RefundStatus::from(search_response.transaction_details), }), SearchResponseTypes::ErrorResponse(connector_response) => { Err(get_error_response(connector_response, item.http_code)) } }; Ok(Self { response, ..item.data }) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 2663, "total_crates": null }
fn_clm_hyperswitch_connectors_from_-6191293800730549167
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/tsys/transformers // Implementation of enums::RefundStatus for From<TsysTransactionDetails> fn from(item: TsysTransactionDetails) -> Self { match item.transaction_status { TsysTransactionStatus::Approved => Self::Pending, //Connector calls refunds as Void TsysTransactionStatus::Void => Self::Success, TsysTransactionStatus::Declined => Self::Failure, } }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 2600, "total_crates": null }
fn_clm_hyperswitch_connectors_get_error_response_-6191293800730549167
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/tsys/transformers fn get_error_response( connector_response: TsysErrorResponse, status_code: u16, ) -> router_data::ErrorResponse { router_data::ErrorResponse { code: connector_response.response_code, message: connector_response.response_message.clone(), reason: Some(connector_response.response_message), status_code, attempt_status: None, connector_transaction_id: None, network_advice_code: None, network_decline_code: None, network_error_message: None, connector_metadata: None, } }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 53, "total_crates": null }
fn_clm_hyperswitch_connectors_get_payments_sync_response_-6191293800730549167
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/tsys/transformers fn get_payments_sync_response( connector_response: &TsysPaymentsSyncResponse, ) -> PaymentsResponseData { PaymentsResponseData::TransactionResponse { resource_id: ResponseId::ConnectorTransactionId( connector_response .transaction_details .transaction_id .clone(), ), redirection_data: Box::new(None), mandate_reference: Box::new(None), connector_metadata: None, network_txn_id: None, connector_response_reference_id: Some( connector_response .transaction_details .transaction_id .clone(), ), incremental_authorization_allowed: None, charges: None, } }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 10, "total_crates": null }
fn_clm_hyperswitch_connectors_get_payments_response_-6191293800730549167
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/tsys/transformers fn get_payments_response(connector_response: TsysResponse) -> PaymentsResponseData { PaymentsResponseData::TransactionResponse { resource_id: ResponseId::ConnectorTransactionId(connector_response.transaction_id.clone()), redirection_data: Box::new(None), mandate_reference: Box::new(None), connector_metadata: None, network_txn_id: None, connector_response_reference_id: Some(connector_response.transaction_id), incremental_authorization_allowed: None, charges: None, } }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 8, "total_crates": null }
fn_clm_hyperswitch_connectors_try_from_3593454886791297904
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/riskified/transformers/auth // Implementation of RiskifiedAuthType for TryFrom<&ConnectorAuthType> fn try_from(auth_type: &ConnectorAuthType) -> Result<Self, Self::Error> { match auth_type { ConnectorAuthType::BodyKey { api_key, key1 } => Ok(Self { secret_token: api_key.to_owned(), domain_name: key1.to_owned().expose(), }), _ => Err(ConnectorError::FailedToObtainAuthType.into()), } }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 2665, "total_crates": null }
fn_clm_hyperswitch_connectors_try_from_5253111912830208614
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/riskified/transformers/api // Implementation of OrderAddress for TryFrom<&hyperswitch_domain_models::address::Address> fn try_from( address_info: &hyperswitch_domain_models::address::Address, ) -> Result<Self, Self::Error> { let address = address_info .clone() .address .ok_or(ConnectorError::MissingRequiredField { field_name: "address", })?; Ok(Self { first_name: address.first_name.clone(), last_name: address.last_name.clone(), address1: address.line1.clone(), country_code: address.country, city: address.city.clone(), province: address.state.clone(), zip: address.zip.clone(), phone: address_info .phone .clone() .and_then(|phone_data| phone_data.number), }) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 2677, "total_crates": null }
fn_clm_hyperswitch_connectors_from_5253111912830208614
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/riskified/transformers/api // Implementation of IncomingWebhookEvent for From<RiskifiedWebhookStatus> fn from(value: RiskifiedWebhookStatus) -> Self { match value { RiskifiedWebhookStatus::Declined => Self::FrmRejected, RiskifiedWebhookStatus::Approved => Self::FrmApproved, } }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 2600, "total_crates": null }
fn_clm_hyperswitch_connectors_get_fulfillment_status_5253111912830208614
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/riskified/transformers/api fn get_fulfillment_status(status: FulfillmentStatus) -> Option<FulfillmentRequestStatus> { match status { FulfillmentStatus::COMPLETE => Some(FulfillmentRequestStatus::Success), FulfillmentStatus::CANCELED => Some(FulfillmentRequestStatus::Cancelled), FulfillmentStatus::PARTIAL | FulfillmentStatus::REPLACEMENT => None, } }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 0, "total_crates": null }
fn_clm_hyperswitch_connectors_try_from_4163975418731467342
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/klarna/transformers // Implementation of types::RefundsRouterData<RSync> for TryFrom<RefundsResponseRouterData<RSync, KlarnaRefundSyncResponse>> fn try_from( item: RefundsResponseRouterData<RSync, KlarnaRefundSyncResponse>, ) -> Result<Self, Self::Error> { // https://docs.klarna.com/api/ordermanagement/#operation/get // If 200 status code, then Refund is Successful, other status codes are handled by the error handler let status = if item.http_code == 200 { enums::RefundStatus::Success } else { enums::RefundStatus::Failure }; Ok(Self { response: Ok(RefundsResponseData { connector_refund_id: item.response.refund_id, refund_status: status, }), ..item.data }) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 2657, "total_crates": null }
fn_clm_hyperswitch_connectors_from_4163975418731467342
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/klarna/transformers // Implementation of enums::AttemptStatus for From<KlarnaPaymentStatus> fn from(item: KlarnaPaymentStatus) -> Self { match item { KlarnaPaymentStatus::Authorized => Self::Authorized, KlarnaPaymentStatus::PartCaptured => Self::PartialCharged, KlarnaPaymentStatus::Captured => Self::Charged, KlarnaPaymentStatus::Cancelled => Self::Voided, KlarnaPaymentStatus::Expired | KlarnaPaymentStatus::Closed => Self::Failure, } }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 2600, "total_crates": null }
fn_clm_hyperswitch_connectors_get_address_info_4163975418731467342
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/klarna/transformers fn get_address_info( address: Option<&hyperswitch_domain_models::address::Address>, ) -> Option<Result<KlarnaShippingAddress, error_stack::Report<errors::ConnectorError>>> { address.and_then(|add| { add.address.as_ref().map( |address_details| -> Result<KlarnaShippingAddress, error_stack::Report<errors::ConnectorError>> { Ok(KlarnaShippingAddress { city: address_details.get_city()?.to_owned(), country: address_details.get_country()?.to_owned(), email: add.get_email()?.to_owned(), postal_code: address_details.get_zip()?.to_owned(), region: address_details.to_state_code()?.to_owned(), street_address: address_details.get_line1()?.to_owned(), street_address2: address_details.get_optional_line2(), given_name: address_details.get_first_name()?.to_owned(), family_name: address_details.get_last_name()?.to_owned(), phone: add.get_phone_with_country_code()?.to_owned(), }) }, ) }) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 50, "total_crates": null }
fn_clm_hyperswitch_connectors_get_fraud_status_4163975418731467342
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/klarna/transformers fn get_fraud_status( klarna_status: KlarnaFraudStatus, is_auto_capture: bool, ) -> common_enums::AttemptStatus { match klarna_status { KlarnaFraudStatus::Accepted => { if is_auto_capture { common_enums::AttemptStatus::Charged } else { common_enums::AttemptStatus::Authorized } } KlarnaFraudStatus::Pending => common_enums::AttemptStatus::Pending, KlarnaFraudStatus::Rejected => common_enums::AttemptStatus::Failure, } }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 0, "total_crates": null }