id
stringlengths
11
116
type
stringclasses
1 value
granularity
stringclasses
4 values
content
stringlengths
16
477k
metadata
dict
fn_clm_hyperswitch_connectors_new_-8127091485089311828
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/redsys/transformers // Inherent implementation for EmvThreedsData pub fn new(three_d_s_info: RedsysThreeDsInfo) -> Self { Self { three_d_s_info, protocol_version: None, browser_accept_header: None, browser_user_agent: None, browser_java_enabled: None, browser_javascript_enabled: None, browser_language: None, browser_color_depth: None, browser_screen_height: None, browser_screen_width: None, browser_t_z: None, browser_i_p: None, three_d_s_server_trans_i_d: None, notification_u_r_l: None, three_d_s_comp_ind: None, cres: None, billing_data: None, shipping_data: None, } }
{ "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_try_from_-8127091485089311828
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/redsys/transformers // Implementation of RefundsRouterData<RSync> for TryFrom<RefundsResponseRouterData<RSync, RedsysSyncResponse>> fn try_from( item: RefundsResponseRouterData<RSync, RedsysSyncResponse>, ) -> Result<Self, Self::Error> { let message_data = item .response .body .consultaoperacionesresponse .consultaoperacionesreturn .messages .version .message; let response = match (message_data.response, message_data.errormsg) { (None, Some(errormsg)) => { let error_code = errormsg.ds_errorcode.clone(); Err(ErrorResponse { code: error_code.clone(), message: error_code.clone(), reason: Some(error_code), 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, }) } (Some(response), None) => { if let Some(ds_response) = response.ds_response { let refund_status = enums::RefundStatus::try_from(ds_response.clone())?; if connector_utils::is_refund_failure(refund_status) { Err(ErrorResponse { status_code: item.http_code, code: ds_response.0.clone(), message: ds_response.0.clone(), reason: Some(ds_response.0.clone()), attempt_status: None, connector_transaction_id: None, network_advice_code: None, network_decline_code: None, network_error_message: None, connector_metadata: None, }) } else { Ok(RefundsResponseData { connector_refund_id: response.ds_order, refund_status, }) } } else { // When the refund is pending Ok(RefundsResponseData { connector_refund_id: response.ds_order, refund_status: enums::RefundStatus::Pending, }) } } (Some(_), Some(_)) | (None, None) => { Err(errors::ConnectorError::ResponseHandlingFailed)? } }; 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": 2675, "total_crates": null }
fn_clm_hyperswitch_connectors_from_-8127091485089311828
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/redsys/transformers // Implementation of ThreeDSCompInd for From<api_models::payments::ThreeDsCompletionIndicator> fn from(threeds_compl_flag: api_models::payments::ThreeDsCompletionIndicator) -> Self { match threeds_compl_flag { api_models::payments::ThreeDsCompletionIndicator::Success => Self::Y, api_models::payments::ThreeDsCompletionIndicator::Failure | api_models::payments::ThreeDsCompletionIndicator::NotAvailable => Self::N, } }
{ "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_set_billing_data_-8127091485089311828
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/redsys/transformers // Inherent implementation for EmvThreedsData pub fn set_billing_data(mut self, address: Option<&Address>) -> Result<Self, Error> { self.billing_data = address .and_then(|address| { address.address.as_ref().map(|address_details| { let state = address_details .get_optional_state() .map(Self::get_state_code) .transpose(); match state { Ok(bill_addr_state) => Ok(BillingData { bill_addr_city: address_details.get_optional_city(), bill_addr_country: address_details.get_optional_country().map( |country| { common_enums::CountryAlpha2::from_alpha2_to_alpha3(country) .to_string() }, ), bill_addr_line1: address_details.get_optional_line1(), bill_addr_line2: address_details.get_optional_line2(), bill_addr_line3: address_details.get_optional_line3(), bill_addr_postal_code: address_details.get_optional_zip(), bill_addr_state, }), Err(err) => Err(err), } }) }) .transpose()?; Ok(self) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 50, "total_crates": null }
fn_clm_hyperswitch_connectors_set_shipping_data_-8127091485089311828
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/redsys/transformers // Inherent implementation for EmvThreedsData pub fn set_shipping_data(mut self, address: Option<&Address>) -> Result<Self, Error> { self.shipping_data = address .and_then(|address| { address.address.as_ref().map(|address_details| { let state = address_details .get_optional_state() .map(Self::get_state_code) .transpose(); match state { Ok(ship_addr_state) => Ok(ShippingData { ship_addr_city: address_details.get_optional_city(), ship_addr_country: address_details.get_optional_country().map( |country| { common_enums::CountryAlpha2::from_alpha2_to_alpha3(country) .to_string() }, ), ship_addr_line1: address_details.get_optional_line1(), ship_addr_line2: address_details.get_optional_line2(), ship_addr_line3: address_details.get_optional_line3(), ship_addr_postal_code: address_details.get_optional_zip(), ship_addr_state, }), Err(err) => Err(err), } }) }) .transpose()?; Ok(self) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 50, "total_crates": null }
fn_clm_hyperswitch_connectors_try_from_-4286141884463701156
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/facilitapay/transformers // Implementation of FacilitapayPaymentsRequest for TryFrom<&FacilitapayRouterData<&types::PaymentsAuthorizeRouterData>> fn try_from( item: &FacilitapayRouterData<&types::PaymentsAuthorizeRouterData>, ) -> Result<Self, Self::Error> { let metadata = FacilitapayConnectorMetadataObject::try_from(&item.router_data.connector_meta_data)?; match item.router_data.request.payment_method_data.clone() { PaymentMethodData::BankTransfer(bank_transfer_data) => match *bank_transfer_data { BankTransferData::Pix { source_bank_account_id, .. } => { // Set expiry time to 15 minutes from now let dynamic_pix_expires_at = { let now = time::OffsetDateTime::now_utc(); let expires_at = now + time::Duration::minutes(15); PrimitiveDateTime::new(expires_at.date(), expires_at.time()) }; let transaction_data = FacilitapayTransactionRequest::Pix(PixTransactionRequest { // subject id must be generated by pre-process step and link with customer id // might require discussions to be done subject_id: item.router_data.get_connector_customer_id()?.into(), from_bank_account_id: source_bank_account_id.clone().ok_or( errors::ConnectorError::MissingRequiredField { field_name: "source bank account id", }, )?, to_bank_account_id: metadata.destination_account_number, currency: item.router_data.request.currency, exchange_currency: item.router_data.request.currency, value: item.amount.clone(), use_dynamic_pix: true, // Format: YYYY-MM-DDThh:mm:ssZ dynamic_pix_expires_at, }); Ok(Self { transaction: transaction_data, }) } BankTransferData::AchBankTransfer {} | BankTransferData::SepaBankTransfer {} | BankTransferData::BacsBankTransfer {} | BankTransferData::MultibancoBankTransfer {} | BankTransferData::PermataBankTransfer {} | BankTransferData::BcaBankTransfer {} | BankTransferData::BniVaBankTransfer {} | BankTransferData::BriVaBankTransfer {} | BankTransferData::CimbVaBankTransfer {} | BankTransferData::DanamonVaBankTransfer {} | BankTransferData::MandiriVaBankTransfer {} | BankTransferData::Pse {} | BankTransferData::InstantBankTransfer {} | BankTransferData::InstantBankTransferFinland {} | BankTransferData::InstantBankTransferPoland {} | BankTransferData::IndonesianBankTransfer { .. } | BankTransferData::LocalBankTransfer { .. } => { Err(errors::ConnectorError::NotImplemented( "Selected payment method through Facilitapay".to_string(), ) .into()) } }, PaymentMethodData::Card(_) | PaymentMethodData::CardRedirect(_) | PaymentMethodData::Wallet(_) | PaymentMethodData::PayLater(_) | PaymentMethodData::BankRedirect(_) | PaymentMethodData::BankDebit(_) | PaymentMethodData::Crypto(_) | PaymentMethodData::MandatePayment | PaymentMethodData::Reward | PaymentMethodData::RealTimePayment(_) | PaymentMethodData::MobilePayment(_) | PaymentMethodData::Upi(_) | PaymentMethodData::Voucher(_) | PaymentMethodData::GiftCard(_) | PaymentMethodData::CardToken(_) | PaymentMethodData::OpenBanking(_) | PaymentMethodData::NetworkToken(_) | PaymentMethodData::CardDetailsForNetworkTransactionId(_) => { Err(errors::ConnectorError::NotImplemented( "Selected payment method through Facilitapay".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": 2695, "total_crates": null }
fn_clm_hyperswitch_connectors_from_-4286141884463701156
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/facilitapay/transformers // Implementation of FacilitapayRouterData<T> for From<(StringMajorUnit, T)> fn from((amount, item): (StringMajorUnit, 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__code_data( _-4286141884463701156
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/facilitapay/transformers _qr_code_data( response: &FacilitapayPaymentsResponse, ) -> CustomResult<Option<serde_json::Value>, errors::ConnectorError> { let expiration_time: i64 = if let Some(meta) = &response.data.meta { if let Some(due_date_str) = meta .get("dynamic_pix_due_date") .and_then(|due_date_value| due_date_value.as_str()) { let datetime = time::OffsetDateTime::parse( due_date_str, &time::format_description::well_known::Rfc3339, ) .map_err(|_| errors::ConnectorError::ResponseHandlingFailed)?; datetime.unix_timestamp() * 1000 } else { // If dynamic_pix_due_date isn't present, use current time + 15 minutes let now = time::OffsetDateTime::now_utc(); let expires_at = now + time::Duration::minutes(15); expires_at.unix_timestamp() * 1000 } } else { // If meta is null, use current time + 15 minutes let now = time::OffsetDateTime::now_utc(); let expires_at = now + time::Duration::minutes(15); expires_at.unix_timestamp() * 1000 }; let dynamic_pix_code = response.data.dynamic_pix_code.as_ref().ok_or_else(|| { errors::ConnectorError::MissingRequiredField { field_name: "dynamic_pix_code", } })?; let image_data = QrImage::new_from_data(dynamic_pix_code.clone()) .change_context(errors::ConnectorError::ResponseHandlingFailed)?; let image_data_url = Url::parse(image_data.data.clone().as_str()) .change_context(errors::ConnectorError::ResponseHandlingFailed)?; let qr_code_info = QrCodeInformation::QrDataUrl { image_data_url, display_to_timestamp: Some(expiration_time), }; Some(qr_code_info.encode_to_value()) .transpose() .change_context(errors::ConnectorError::ResponseHandlingFailed) } impl
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 52, "total_crates": null }
fn_clm_hyperswitch_connectors_om(item:_-4286141884463701156
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/facilitapay/transformers // Implementation of tapayCustomerRequest { for m<&types::ConnectorCustomerRouterData> for F _from(item: &types::ConnectorCustomerRouterData) -> Result<Self, Self::Error> { let email = item.request.email.clone(); let social_name = item.get_billing_full_name()?; let (document_type, document_number) = match item.request.payment_method_data.clone() { Some(PaymentMethodData::BankTransfer(bank_transfer_data)) => { match *bank_transfer_data { BankTransferData::Pix { cpf, .. } => { // Extract only digits from the CPF string let document_number = cpf.ok_or_else(missing_field_err("cpf"))?.map(|cpf_number| { cpf_number .chars() .filter(|chars| chars.is_ascii_digit()) .collect::<String>() }); let document_type = convert_to_document_type("cpf")?; (document_type, document_number) } _ => { return Err(errors::ConnectorError::NotImplemented( "Selected payment method through Facilitapay".to_string(), ) .into()) } } } _ => { return Err(errors::ConnectorError::NotImplemented( "Selected payment method through Facilitapay".to_string(), ) .into()) } }; let fiscal_country = item.get_billing_country()?; let person = FacilitapayPerson { document_number, document_type, social_name, fiscal_country, email, birth_date: None, phone_country_code: None, phone_area_code: None, phone_number: None, address_city: None, address_state: None, address_complement: None, address_country: None, address_number: None, address_postal_code: None, address_street: None, net_monthly_average_income: None, }; Ok(Self { person }) } } im
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 48, "total_crates": null }
fn_clm_hyperswitch_connectors_t_message_from_json(json:_-4286141884463701156
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/facilitapay/transformers ract_message_from_json(json: &serde_json::Value) -> String { if let Some(obj) = json.as_object() { if let Some(error) = obj.get("error").and_then(|e| e.as_str()) { return error.to_string(); } if obj.contains_key("errors") { return "Validation error occurred".to_string(); } if !obj.is_empty() { return obj .iter() .next() .map(|(k, v)| format!("{k}: {v}")) .unwrap_or_else(|| "Unknown error".to_string()); } } else if let Some(s) = json.as_str() { return s.to_string(); } "Unknown error format".to_string() } impl
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 32, "total_crates": null }
fn_clm_hyperswitch_connectors_try_from_714321921595777212
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/digitalvirgo/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_714321921595777212
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/digitalvirgo/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, } }
{ "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_2347951226758992754
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/breadpay/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_2347951226758992754
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/breadpay/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_1993412805084344543
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/dummyconnector/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: 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_1993412805084344543
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/dummyconnector/transformers // Implementation of RefundStatus for From<DummyRefundStatus> fn from(item: DummyRefundStatus) -> Self { match item { DummyRefundStatus::Succeeded => Self::Success, DummyRefundStatus::Failed => Self::Failure, DummyRefundStatus::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_get_url_1993412805084344543
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/dummyconnector/transformers // Inherent implementation for DummyConnectorNextAction fn get_url(&self) -> Option<Url> { match self { Self::RedirectToUrl(redirect_to_url) => Some(redirect_to_url.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": 409, "total_crates": null }
fn_clm_hyperswitch_connectors_get_dummy_connector_id_1993412805084344543
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/dummyconnector/transformers // Inherent implementation for DummyConnectors pub fn get_dummy_connector_id(self) -> &'static str { match self { Self::PhonyPay => "phonypay", Self::FauxPay => "fauxpay", Self::PretendPay => "pretendpay", Self::StripeTest => "stripe_test", Self::AdyenTest => "adyen_test", Self::CheckoutTest => "checkout_test", Self::PaypalTest => "paypal_test", } }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 21, "total_crates": null }
fn_clm_hyperswitch_connectors_try_from_-5117334320765268996
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/bankofamerica/transformers // Implementation of PaymentInformation for TryFrom<&GooglePayWalletData> fn try_from(google_pay_data: &GooglePayWalletData) -> Result<Self, Self::Error> { Ok(Self::GooglePay(Box::new(GooglePayPaymentInformation { fluid_data: FluidData { value: Secret::from( consts::BASE64_ENGINE.encode( google_pay_data .tokenization_data .get_encrypted_google_pay_token() .change_context(errors::ConnectorError::MissingRequiredField { field_name: "gpay wallet_token", })? .clone(), ), ), descriptor: 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": 2671, "total_crates": null }
fn_clm_hyperswitch_connectors_from_-5117334320765268996
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/bankofamerica/transformers // Implementation of enums::RefundStatus for From<BankOfAmericaRefundResponse> fn from(item: BankOfAmericaRefundResponse) -> Self { let error_reason = item .error_information .and_then(|error_info| error_info.reason); match item.status { BankofamericaRefundStatus::Succeeded | BankofamericaRefundStatus::Transmitted => { Self::Success } BankofamericaRefundStatus::Cancelled | BankofamericaRefundStatus::Failed | BankofamericaRefundStatus::Voided => Self::Failure, BankofamericaRefundStatus::Pending => Self::Pending, BankofamericaRefundStatus::TwoZeroOne => { if error_reason == Some("PROCESSOR_DECLINED".to_string()) { Self::Failure } else { 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": 2604, "total_crates": null }
fn_clm_hyperswitch_connectors_get_error_response_-5117334320765268996
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/bankofamerica/transformers fn get_error_response( error_data: &Option<BankOfAmericaErrorInformation>, processor_information: &Option<ClientProcessorInformation>, risk_information: &Option<ClientRiskInformation>, attempt_status: Option<enums::AttemptStatus>, status_code: u16, transaction_id: String, ) -> ErrorResponse { let avs_message = risk_information .clone() .map(|client_risk_information| { client_risk_information.rules.map(|rules| { rules .iter() .map(|risk_info| { risk_info.name.clone().map_or("".to_string(), |name| { format!(" , {}", name.clone().expose()) }) }) .collect::<Vec<String>>() .join("") }) }) .unwrap_or(Some("".to_string())); let detailed_error_info = error_data.to_owned().and_then(|error_info| { error_info.details.map(|error_details| { error_details .iter() .map(|details| format!("{} : {}", details.field, details.reason)) .collect::<Vec<_>>() .join(", ") }) }); let network_decline_code = processor_information .as_ref() .and_then(|info| info.response_code.clone()); let network_advice_code = processor_information.as_ref().and_then(|info| { info.merchant_advice .as_ref() .and_then(|merchant_advice| merchant_advice.code_raw.clone()) }); let reason = get_error_reason( error_data .clone() .and_then(|error_details| error_details.message), detailed_error_info, avs_message, ); let error_message = error_data .clone() .and_then(|error_details| error_details.reason); ErrorResponse { code: error_message .clone() .unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_CODE.to_string()), message: error_message .clone() .unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_MESSAGE.to_string()), reason, status_code, attempt_status, connector_transaction_id: Some(transaction_id.clone()), network_advice_code, network_decline_code, 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": 125, "total_crates": null }
fn_clm_hyperswitch_connectors_get_error_reason_-5117334320765268996
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/bankofamerica/transformers pub fn get_error_reason( error_info: Option<String>, detailed_error_info: Option<String>, avs_error_info: Option<String>, ) -> Option<String> { match (error_info, detailed_error_info, avs_error_info) { (Some(message), Some(details), Some(avs_message)) => Some(format!( "{message}, detailed_error_information: {details}, avs_message: {avs_message}", )), (Some(message), Some(details), None) => { Some(format!("{message}, detailed_error_information: {details}")) } (Some(message), None, Some(avs_message)) => { Some(format!("{message}, avs_message: {avs_message}")) } (None, Some(details), Some(avs_message)) => { Some(format!("{details}, avs_message: {avs_message}")) } (Some(message), None, None) => Some(message), (None, Some(details), None) => Some(details), (None, None, Some(avs_message)) => Some(avs_message), (None, None, None) => None, } }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 58, "total_crates": null }
fn_clm_hyperswitch_connectors_get_samsung_pay_fluid_data_value_-5117334320765268996
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/bankofamerica/transformers fn get_samsung_pay_fluid_data_value( samsung_pay_token_data: &hyperswitch_domain_models::payment_method_data::SamsungPayTokenData, ) -> Result<SamsungPayFluidDataValue, error_stack::Report<errors::ConnectorError>> { let samsung_pay_header = josekit::jwt::decode_header(samsung_pay_token_data.data.clone().peek()) .change_context(errors::ConnectorError::RequestEncodingFailed) .attach_printable("Failed to decode samsung pay header")?; let samsung_pay_kid_optional = samsung_pay_header.claim("kid").and_then(|kid| kid.as_str()); let samsung_pay_fluid_data_value = SamsungPayFluidDataValue { public_key_hash: Secret::new( samsung_pay_kid_optional .get_required_value("samsung pay public_key_hash") .change_context(errors::ConnectorError::RequestEncodingFailed)? .to_string(), ), version: samsung_pay_token_data.version.clone(), data: Secret::new(consts::BASE64_ENGINE.encode(samsung_pay_token_data.data.peek())), }; Ok(samsung_pay_fluid_data_value) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 35, "total_crates": null }
fn_clm_hyperswitch_connectors_try_from_6289704655890281144
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/nomupay/transformers // Implementation of PayoutsRouterData<F> for TryFrom<PayoutsResponseRouterData<F, NomupayPaymentResponse>> fn try_from( item: PayoutsResponseRouterData<F, NomupayPaymentResponse>, ) -> Result<Self, Self::Error> { let response: NomupayPaymentResponse = item.response; Ok(Self { response: Ok(PayoutsResponseData { status: Some(PayoutStatus::from(response.status)), connector_payout_id: Some(response.id), payout_eligible: None, should_add_next_step_to_process_tracker: false, error_code: None, error_message: None, payout_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": 2659, "total_crates": null }
fn_clm_hyperswitch_connectors_from_6289704655890281144
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/nomupay/transformers // Implementation of PayoutStatus for From<NomupayPaymentStatus> fn from(item: NomupayPaymentStatus) -> Self { match item { NomupayPaymentStatus::Processed => Self::Success, NomupayPaymentStatus::Failed => Self::Failed, NomupayPaymentStatus::Processing | NomupayPaymentStatus::Pending | NomupayPaymentStatus::Scheduled | NomupayPaymentStatus::PendingAccountActivation | NomupayPaymentStatus::PendingTransferMethodCreation | NomupayPaymentStatus::PendingAccountKyc => 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_get_profile_6289704655890281144
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/nomupay/transformers fn get_profile<F>( item: &PayoutsRouterData<F>, entity_type: PayoutEntityType, ) -> Result<Profile, error_stack::Report<errors::ConnectorError>> { let my_address = Address { country: item.get_billing_country()?, state_province: item.get_billing_state()?, street: item.get_billing_line1()?, city: item.get_billing_city()?, postal_code: item.get_billing_zip()?, }; Ok(Profile { profile_type: ProfileType::from(entity_type), first_name: item.get_billing_first_name()?, last_name: item.get_billing_last_name()?, date_of_birth: Secret::new("1991-01-01".to_string()), // Query raised with Nomupay regarding why this field is required gender: NomupayGender::Other, // Query raised with Nomupay regarding why this field is required email_address: item.get_billing_email()?, phone_number_country_code: item .get_billing_phone() .map(|phone| phone.country_code.clone())?, phone_number: Some(item.get_billing_phone_number()?), address: my_address, }) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 30, "total_crates": null }
fn_clm_hyperswitch_connectors_try_from_-2354562891247476970
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/wellsfargo/transformers // Implementation of RefundsRouterData<RSync> for TryFrom<RefundsResponseRouterData<RSync, WellsfargoRsyncResponse>> fn try_from( item: RefundsResponseRouterData<RSync, WellsfargoRsyncResponse>, ) -> Result<Self, Self::Error> { let response = match item .response .application_information .and_then(|application_information| application_information.status) { Some(status) => { let refund_status = enums::RefundStatus::from(status.clone()); if utils::is_refund_failure(refund_status) { if status == WellsfargoRefundStatus::Voided { Err(get_error_response( &Some(WellsfargoErrorInformation { message: Some(constants::REFUND_VOIDED.to_string()), reason: Some(constants::REFUND_VOIDED.to_string()), details: None, }), &None, None, item.http_code, item.response.id.clone(), )) } else { Err(get_error_response( &item.response.error_information, &None, None, item.http_code, item.response.id.clone(), )) } } else { Ok(RefundsResponseData { connector_refund_id: item.response.id, refund_status, }) } } None => Ok(RefundsResponseData { connector_refund_id: item.response.id.clone(), refund_status: match item.data.response { Ok(response) => response.refund_status, Err(_) => common_enums::RefundStatus::Pending, }, }), }; 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": 2679, "total_crates": null }
fn_clm_hyperswitch_connectors_from_-2354562891247476970
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/wellsfargo/transformers // Implementation of enums::RefundStatus for From<WellsfargoRefundStatus> fn from(item: WellsfargoRefundStatus) -> Self { match item { WellsfargoRefundStatus::Succeeded | WellsfargoRefundStatus::Transmitted => { Self::Success } WellsfargoRefundStatus::Cancelled | WellsfargoRefundStatus::Failed | WellsfargoRefundStatus::Voided => Self::Failure, WellsfargoRefundStatus::Pending => 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_get_error_response_-2354562891247476970
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/wellsfargo/transformers pub fn get_error_response( error_data: &Option<WellsfargoErrorInformation>, risk_information: &Option<ClientRiskInformation>, attempt_status: Option<enums::AttemptStatus>, status_code: u16, transaction_id: String, ) -> ErrorResponse { let avs_message = risk_information .clone() .map(|client_risk_information| { client_risk_information.rules.map(|rules| { rules .iter() .map(|risk_info| { risk_info.name.clone().map_or("".to_string(), |name| { format!(" , {}", name.clone().expose()) }) }) .collect::<Vec<String>>() .join("") }) }) .unwrap_or(Some("".to_string())); let detailed_error_info = error_data .clone() .map(|error_data| match error_data.details { Some(details) => details .iter() .map(|details| format!("{} : {}", details.field, details.reason)) .collect::<Vec<_>>() .join(", "), None => "".to_string(), }); let reason = get_error_reason( error_data.clone().and_then(|error_info| error_info.message), detailed_error_info, avs_message, ); let error_message = error_data.clone().and_then(|error_info| error_info.reason); ErrorResponse { code: error_message .clone() .unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_CODE.to_string()), message: error_message .clone() .unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_MESSAGE.to_string()), reason, status_code, attempt_status, connector_transaction_id: Some(transaction_id.clone()), 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": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 119, "total_crates": null }
fn_clm_hyperswitch_connectors_get_error_reason_-2354562891247476970
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/wellsfargo/transformers pub fn get_error_reason( error_info: Option<String>, detailed_error_info: Option<String>, avs_error_info: Option<String>, ) -> Option<String> { match (error_info, detailed_error_info, avs_error_info) { (Some(message), Some(details), Some(avs_message)) => Some(format!( "{message}, detailed_error_information: {details}, avs_message: {avs_message}", )), (Some(message), Some(details), None) => { Some(format!("{message}, detailed_error_information: {details}")) } (Some(message), None, Some(avs_message)) => { Some(format!("{message}, avs_message: {avs_message}")) } (None, Some(details), Some(avs_message)) => { Some(format!("{details}, avs_message: {avs_message}")) } (Some(message), None, None) => Some(message), (None, Some(details), None) => Some(details), (None, None, Some(avs_message)) => Some(avs_message), (None, None, None) => None, } }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 58, "total_crates": null }
fn_clm_hyperswitch_connectors_get_payment_response_-2354562891247476970
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/wellsfargo/transformers fn get_payment_response( (info_response, status, http_code): (&WellsfargoPaymentsResponse, enums::AttemptStatus, u16), ) -> Result<PaymentsResponseData, Box<ErrorResponse>> { let error_response = get_error_response_if_failure((info_response, status, http_code)); match error_response { Some(error) => Err(Box::new(error)), None => { let incremental_authorization_allowed = Some(status == enums::AttemptStatus::Authorized); let mandate_reference = info_response .token_information .clone() .map(|token_info| MandateReference { connector_mandate_id: token_info .payment_instrument .map(|payment_instrument| payment_instrument.id.expose()), payment_method_id: None, mandate_metadata: None, connector_mandate_request_reference_id: None, }); Ok(PaymentsResponseData::TransactionResponse { resource_id: ResponseId::ConnectorTransactionId(info_response.id.clone()), redirection_data: Box::new(None), mandate_reference: Box::new(mandate_reference), connector_metadata: None, network_txn_id: info_response.processor_information.as_ref().and_then( |processor_information| processor_information.network_transaction_id.clone(), ), connector_response_reference_id: Some( info_response .client_reference_information .clone() .and_then(|client_reference_information| client_reference_information.code) .unwrap_or(info_response.id.clone()), ), incremental_authorization_allowed, 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": 34, "total_crates": null }
fn_clm_hyperswitch_connectors_try_from_-5574727325025469026
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/hipay/transformers // Implementation of PaymentsSyncRouterData for TryFrom<PaymentsSyncResponseRouterData<HipaySyncResponse>> fn try_from( item: PaymentsSyncResponseRouterData<HipaySyncResponse>, ) -> Result<Self, Self::Error> { match item.response { HipaySyncResponse::Error { message, code } => { let response = Err(ErrorResponse { code: code.to_string(), message: message.clone(), reason: Some(message.clone()), attempt_status: None, connector_transaction_id: None, status_code: item.http_code, network_advice_code: None, network_decline_code: None, network_error_message: None, connector_metadata: None, }); Ok(Self { status: enums::AttemptStatus::Failure, response, ..item.data }) } HipaySyncResponse::Response { status, reason } => { let status = get_sync_status(status); let response = if status == enums::AttemptStatus::Failure { let error_code = reason .code .map_or(NO_ERROR_CODE.to_string(), |c| c.to_string()); let error_message = reason .reason .clone() .unwrap_or_else(|| NO_ERROR_MESSAGE.to_owned()); Err(ErrorResponse { code: error_code, message: error_message.clone(), reason: Some(error_message), 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, }) } else { Ok(PaymentsResponseData::TransactionResponse { resource_id: ResponseId::NoResponseId, redirection_data: Box::new(None), mandate_reference: Box::new(None), connector_metadata: None, network_txn_id: None, connector_response_reference_id: None, incremental_authorization_allowed: None, charges: None, }) }; Ok(Self { status, 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": 2683, "total_crates": null }
fn_clm_hyperswitch_connectors_from_-5574727325025469026
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/hipay/transformers // Implementation of common_enums::AttemptStatus for From<HipayPaymentStatus> fn from(status: HipayPaymentStatus) -> Self { match status { HipayPaymentStatus::AuthenticationFailed => Self::AuthenticationFailed, HipayPaymentStatus::Blocked | HipayPaymentStatus::Refused | HipayPaymentStatus::Expired | HipayPaymentStatus::Denied => Self::Failure, HipayPaymentStatus::AuthorizedAndPending => Self::Pending, HipayPaymentStatus::Cancelled => Self::Voided, HipayPaymentStatus::Authorized => Self::Authorized, HipayPaymentStatus::CaptureRequested => Self::CaptureInitiated, HipayPaymentStatus::Captured => Self::Charged, HipayPaymentStatus::PartiallyCaptured => Self::PartialCharged, HipayPaymentStatus::CaptureRefused => Self::CaptureFailed, HipayPaymentStatus::AwaitingTerminal => Self::Pending, HipayPaymentStatus::AuthorizationCancellationRequested => Self::VoidInitiated, HipayPaymentStatus::ChallengeRequested => Self::AuthenticationPending, HipayPaymentStatus::SoftDeclined => Self::Failure, HipayPaymentStatus::PendingPayment => Self::Pending, HipayPaymentStatus::ChargedBack => Self::Failure, HipayPaymentStatus::Created => Self::Started, HipayPaymentStatus::UnableToAuthenticate | HipayPaymentStatus::CouldNotAuthenticate => { Self::AuthenticationFailed } HipayPaymentStatus::CardholderAuthenticated => Self::Pending, HipayPaymentStatus::AuthenticationAttempted => Self::AuthenticationPending, HipayPaymentStatus::Collected | HipayPaymentStatus::PartiallySettled | HipayPaymentStatus::PartiallyCollected | HipayPaymentStatus::Settled => Self::Charged, HipayPaymentStatus::AuthenticationRequested => Self::AuthenticationPending, HipayPaymentStatus::Authenticated => Self::AuthenticationSuccessful, HipayPaymentStatus::AcquirerNotFound => Self::Failure, HipayPaymentStatus::RiskAccepted => Self::Pending, HipayPaymentStatus::AuthorizationRefused => 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_sync_status_-5574727325025469026
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/hipay/transformers fn get_sync_status(state: i32) -> enums::AttemptStatus { match state { 9 => enums::AttemptStatus::AuthenticationFailed, 10 => enums::AttemptStatus::Failure, 11 => enums::AttemptStatus::Failure, 12 => enums::AttemptStatus::Pending, 13 => enums::AttemptStatus::Failure, 14 => enums::AttemptStatus::Failure, 15 => enums::AttemptStatus::Voided, 16 => enums::AttemptStatus::Authorized, 17 => enums::AttemptStatus::CaptureInitiated, 18 => enums::AttemptStatus::Charged, 19 => enums::AttemptStatus::PartialCharged, 29 => enums::AttemptStatus::Failure, 73 => enums::AttemptStatus::CaptureFailed, 74 => enums::AttemptStatus::Pending, 75 => enums::AttemptStatus::VoidInitiated, 77 => enums::AttemptStatus::AuthenticationPending, 78 => enums::AttemptStatus::Failure, 200 => enums::AttemptStatus::Pending, 1 => enums::AttemptStatus::Started, 5 => enums::AttemptStatus::AuthenticationFailed, 6 => enums::AttemptStatus::Pending, 7 => enums::AttemptStatus::AuthenticationPending, 8 => enums::AttemptStatus::AuthenticationFailed, 20 => enums::AttemptStatus::Charged, 21 => enums::AttemptStatus::Charged, 22 => enums::AttemptStatus::Charged, 23 => enums::AttemptStatus::Charged, 40 => enums::AttemptStatus::AuthenticationPending, 41 => enums::AttemptStatus::AuthenticationSuccessful, 51 => enums::AttemptStatus::Failure, 61 => enums::AttemptStatus::Pending, 63 => enums::AttemptStatus::Failure, _ => 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": 3, "total_crates": null }
fn_clm_hyperswitch_connectors_try_from_157214189068228480
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/cashtocode/transformers // Implementation of RouterData<F, T, PaymentsResponseData> for TryFrom<ResponseRouterData<F, CashtocodePaymentsSyncResponse, T, PaymentsResponseData>> fn try_from( item: ResponseRouterData<F, CashtocodePaymentsSyncResponse, T, PaymentsResponseData>, ) -> Result<Self, Self::Error> { Ok(Self { status: enums::AttemptStatus::Charged, // Charged status is hardcoded because cashtocode do not support Psync, and we only receive webhooks when payment is succeeded, this tryFrom is used for CallConnectorAction. response: Ok(PaymentsResponseData::TransactionResponse { resource_id: ResponseId::ConnectorTransactionId( item.data.attempt_id.clone(), //in response they only send PayUrl, so we use attempt_id as connector_transaction_id ), redirection_data: Box::new(None), mandate_reference: Box::new(None), connector_metadata: None, network_txn_id: None, connector_response_reference_id: None, incremental_authorization_allowed: None, charges: 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": 2665, "total_crates": null }
fn_clm_hyperswitch_connectors_from_157214189068228480
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/cashtocode/transformers // Implementation of enums::AttemptStatus for From<CashtocodePaymentStatus> fn from(item: CashtocodePaymentStatus) -> Self { match item { CashtocodePaymentStatus::Succeeded => Self::Charged, CashtocodePaymentStatus::Processing => Self::AuthenticationPending, } }
{ "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_redirect_form_data_157214189068228480
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/cashtocode/transformers fn get_redirect_form_data( payment_method_type: enums::PaymentMethodType, response_data: CashtocodePaymentsResponseData, ) -> CustomResult<RedirectForm, errors::ConnectorError> { match payment_method_type { enums::PaymentMethodType::ClassicReward => Ok(RedirectForm::Form { //redirect form is manually constructed because the connector for this pm type expects query params in the url endpoint: response_data.pay_url.to_string(), method: Method::Post, form_fields: Default::default(), }), enums::PaymentMethodType::Evoucher => Ok(RedirectForm::from(( //here the pay url gets parsed, and query params are sent as formfields as the connector expects response_data.pay_url, Method::Get, ))), _ => Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("CashToCode"), ))?, } }
{ "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_mid_157214189068228480
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/cashtocode/transformers fn get_mid( connector_auth_type: &ConnectorAuthType, payment_method_type: Option<enums::PaymentMethodType>, currency: enums::Currency, ) -> Result<Secret<String>, errors::ConnectorError> { match CashtocodeAuth::try_from((connector_auth_type, &currency)) { Ok(cashtocode_auth) => match payment_method_type { Some(enums::PaymentMethodType::ClassicReward) => Ok(cashtocode_auth .merchant_id_classic .ok_or(errors::ConnectorError::FailedToObtainAuthType)?), Some(enums::PaymentMethodType::Evoucher) => Ok(cashtocode_auth .merchant_id_evoucher .ok_or(errors::ConnectorError::FailedToObtainAuthType)?), _ => Err(errors::ConnectorError::FailedToObtainAuthType), }, Err(_) => Err(errors::ConnectorError::FailedToObtainAuthType)?, } }
{ "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_8272230309861978062
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/cybersource/transformers // Implementation of PayoutsRouterData<F> for TryFrom<PayoutsResponseRouterData<F, CybersourceFulfillResponse>> fn try_from( item: PayoutsResponseRouterData<F, CybersourceFulfillResponse>, ) -> Result<Self, Self::Error> { Ok(Self { response: Ok(PayoutsResponseData { status: Some(map_payout_status(item.response.status)), connector_payout_id: Some(item.response.id), payout_eligible: None, should_add_next_step_to_process_tracker: false, error_code: None, error_message: None, payout_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": 2659, "total_crates": null }
fn_clm_hyperswitch_connectors_from_8272230309861978062
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/cybersource/transformers // Implementation of enums::RefundStatus for From<CybersourceRefundStatus> fn from(item: CybersourceRefundStatus) -> Self { match item { CybersourceRefundStatus::Succeeded | CybersourceRefundStatus::Transmitted => { Self::Success } CybersourceRefundStatus::Cancelled | CybersourceRefundStatus::Failed | CybersourceRefundStatus::Voided => Self::Failure, CybersourceRefundStatus::Pending => 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_get_error_response_8272230309861978062
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/cybersource/transformers pub fn get_error_response( error_data: &Option<CybersourceErrorInformation>, processor_information: &Option<ClientProcessorInformation>, risk_information: &Option<ClientRiskInformation>, attempt_status: Option<enums::AttemptStatus>, status_code: u16, transaction_id: String, ) -> ErrorResponse { let avs_message = risk_information .clone() .map(|client_risk_information| { client_risk_information.rules.map(|rules| { rules .iter() .map(|risk_info| { risk_info.name.clone().map_or("".to_string(), |name| { format!(" , {}", name.clone().expose()) }) }) .collect::<Vec<String>>() .join("") }) }) .unwrap_or(Some("".to_string())); let detailed_error_info = error_data.as_ref().and_then(|error_data| { error_data.details.as_ref().map(|details| { details .iter() .map(|detail| format!("{} : {}", detail.field, detail.reason)) .collect::<Vec<_>>() .join(", ") }) }); let network_decline_code = processor_information .as_ref() .and_then(|info| info.response_code.clone()); let network_advice_code = processor_information.as_ref().and_then(|info| { info.merchant_advice .as_ref() .and_then(|merchant_advice| merchant_advice.code_raw.clone()) }); let reason = get_error_reason( error_data .as_ref() .and_then(|error_info| error_info.message.clone()), detailed_error_info, avs_message, ); let error_message = error_data .as_ref() .and_then(|error_info| error_info.reason.clone()); ErrorResponse { code: error_message .clone() .unwrap_or_else(|| hyperswitch_interfaces::consts::NO_ERROR_CODE.to_string()), message: error_message .unwrap_or_else(|| hyperswitch_interfaces::consts::NO_ERROR_MESSAGE.to_string()), reason, status_code, attempt_status, connector_transaction_id: Some(transaction_id), network_advice_code, network_decline_code, network_error_message: None, connector_metadata: None, } }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 137, "total_crates": null }
fn_clm_hyperswitch_connectors_get_error_reason_8272230309861978062
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/cybersource/transformers pub fn get_error_reason( error_info: Option<String>, detailed_error_info: Option<String>, avs_error_info: Option<String>, ) -> Option<String> { match (error_info, detailed_error_info, avs_error_info) { (Some(message), Some(details), Some(avs_message)) => Some(format!( "{message}, detailed_error_information: {details}, avs_message: {avs_message}", )), (Some(message), Some(details), None) => { Some(format!("{message}, detailed_error_information: {details}")) } (Some(message), None, Some(avs_message)) => { Some(format!("{message}, avs_message: {avs_message}")) } (None, Some(details), Some(avs_message)) => { Some(format!("{details}, avs_message: {avs_message}")) } (Some(message), None, None) => Some(message), (None, Some(details), None) => Some(details), (None, None, Some(avs_message)) => Some(avs_message), (None, None, None) => None, } }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 58, "total_crates": null }
fn_clm_hyperswitch_connectors_get_samsung_pay_fluid_data_value_8272230309861978062
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/cybersource/transformers fn get_samsung_pay_fluid_data_value( samsung_pay_token_data: &hyperswitch_domain_models::payment_method_data::SamsungPayTokenData, ) -> Result<SamsungPayFluidDataValue, error_stack::Report<errors::ConnectorError>> { let samsung_pay_header = josekit::jwt::decode_header(samsung_pay_token_data.data.clone().peek()) .change_context(errors::ConnectorError::RequestEncodingFailed) .attach_printable("Failed to decode samsung pay header")?; let samsung_pay_kid_optional = samsung_pay_header.claim("kid").and_then(|kid| kid.as_str()); let samsung_pay_fluid_data_value = SamsungPayFluidDataValue { public_key_hash: Secret::new( samsung_pay_kid_optional .get_required_value("samsung pay public_key_hash") .change_context(errors::ConnectorError::RequestEncodingFailed)? .to_string(), ), version: samsung_pay_token_data.version.clone(), data: Secret::new(consts::BASE64_ENGINE.encode(samsung_pay_token_data.data.peek())), }; Ok(samsung_pay_fluid_data_value) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 35, "total_crates": null }
fn_clm_hyperswitch_connectors_try_from_-4675600069399835888
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/cryptopay/transformers // Implementation of CryptopayAuthType for TryFrom<&ConnectorAuthType> fn try_from(auth_type: &ConnectorAuthType) -> Result<Self, Self::Error> { if let ConnectorAuthType::BodyKey { api_key, key1 } = auth_type { Ok(Self { api_key: api_key.to_owned(), api_secret: key1.to_owned(), }) } else { Err(errors::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": 2663, "total_crates": null }
fn_clm_hyperswitch_connectors_from_-4675600069399835888
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/cryptopay/transformers // Implementation of enums::AttemptStatus for From<CryptopayPaymentStatus> fn from(item: CryptopayPaymentStatus) -> Self { match item { CryptopayPaymentStatus::New => Self::AuthenticationPending, CryptopayPaymentStatus::Completed => Self::Charged, CryptopayPaymentStatus::Cancelled => Self::Failure, CryptopayPaymentStatus::Unresolved | CryptopayPaymentStatus::Refunded => { Self::Unresolved } //mapped refunded to Unresolved because refund api is not available, also merchant has done the action on the connector dashboard. } }
{ "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_foreign_try_from_-4675600069399835888
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/cryptopay/transformers // Implementation of RouterData<F, T, PaymentsResponseData> for ForeignTryFrom<( ResponseRouterData<F, CryptopayPaymentsResponse, T, PaymentsResponseData>, Option<MinorUnit>, )> fn foreign_try_from( (item, amount_captured_in_minor_units): ( ResponseRouterData<F, CryptopayPaymentsResponse, T, PaymentsResponseData>, Option<MinorUnit>, ), ) -> Result<Self, Self::Error> { let status = enums::AttemptStatus::from(item.response.data.status.clone()); let response = if utils::is_payment_failure(status) { let payment_response = &item.response.data; Err(ErrorResponse { code: payment_response .name .clone() .unwrap_or(consts::NO_ERROR_CODE.to_string()), message: payment_response .status_context .clone() .unwrap_or(consts::NO_ERROR_MESSAGE.to_string()), reason: payment_response.status_context.clone(), status_code: item.http_code, attempt_status: None, connector_transaction_id: Some(payment_response.id.clone()), network_advice_code: None, network_decline_code: None, network_error_message: None, connector_metadata: None, }) } else { let redirection_data = item .response .data .hosted_page_url .map(|x| RedirectForm::from((x, common_utils::request::Method::Get))); Ok(PaymentsResponseData::TransactionResponse { resource_id: ResponseId::ConnectorTransactionId(item.response.data.id.clone()), redirection_data: Box::new(redirection_data), mandate_reference: Box::new(None), connector_metadata: None, network_txn_id: None, connector_response_reference_id: item .response .data .custom_id .or(Some(item.response.data.id)), incremental_authorization_allowed: None, charges: None, }) }; match (amount_captured_in_minor_units, status) { (Some(minor_amount), enums::AttemptStatus::Charged) => { let amount_captured = Some(minor_amount.get_amount_as_i64()); Ok(Self { status, response, amount_captured, minor_amount_captured: amount_captured_in_minor_units, ..item.data }) } _ => Ok(Self { status, 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": 466, "total_crates": null }
fn_clm_hyperswitch_connectors_try_from_-2305927346225083559
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/paystack/transformers // Implementation of RefundsRouterData<RSync> for TryFrom<RefundsResponseRouterData<RSync, PaystackRefundsResponse>> fn try_from( item: RefundsResponseRouterData<RSync, PaystackRefundsResponse>, ) -> Result<Self, Self::Error> { match item.response { PaystackRefundsResponse::PaystackRefundsData(resp) => Ok(Self { response: Ok(RefundsResponseData { connector_refund_id: resp.data.id.to_string(), refund_status: enums::RefundStatus::from(resp.data.status), }), ..item.data }), PaystackRefundsResponse::PaystackRSyncWebhook(resp) => Ok(Self { response: Ok(RefundsResponseData { connector_refund_id: resp.id, refund_status: enums::RefundStatus::from(resp.status), }), ..item.data }), PaystackRefundsResponse::PaystackRefundsError(err) => { let err_msg = get_error_message(err.clone()); Ok(Self { response: Err(ErrorResponse { code: err.code, message: err_msg.clone(), reason: Some(err_msg.clone()), attempt_status: None, connector_transaction_id: None, status_code: item.http_code, 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": 2671, "total_crates": null }
fn_clm_hyperswitch_connectors_from_-2305927346225083559
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/paystack/transformers // Implementation of api_models::webhooks::IncomingWebhookEvent for From<PaystackWebhookEventData> fn from(item: PaystackWebhookEventData) -> Self { match item { PaystackWebhookEventData::Payment(payment_data) => match payment_data.status { PaystackPSyncStatus::Success => Self::PaymentIntentSuccess, PaystackPSyncStatus::Failed => Self::PaymentIntentFailure, PaystackPSyncStatus::Abandoned | PaystackPSyncStatus::Ongoing | PaystackPSyncStatus::Pending | PaystackPSyncStatus::Processing | PaystackPSyncStatus::Queued => Self::PaymentIntentProcessing, PaystackPSyncStatus::Reversed => Self::EventNotSupported, }, PaystackWebhookEventData::Refund(refund_data) => match refund_data.status { PaystackRefundStatus::Processed => Self::RefundSuccess, PaystackRefundStatus::Failed => Self::RefundFailure, PaystackRefundStatus::Processing | PaystackRefundStatus::Pending => { Self::EventNotSupported } }, } }
{ "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_message_-2305927346225083559
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/paystack/transformers pub fn get_error_message(response: PaystackErrorResponse) -> String { if let Some(serde_json::Value::Object(err_map)) = response.data { err_map.get("message").map(|msg| msg.clone().to_string()) } else { None } .unwrap_or(response.message) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 206, "total_crates": null }
fn_clm_hyperswitch_connectors_try_from_-8779964222814310890
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/calida/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_-8779964222814310890
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/calida/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_get_webhook_object_from_body_-8779964222814310890
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/calida/transformers pub(crate) fn get_webhook_object_from_body( body: &[u8], ) -> CustomResult<CalidaSyncResponse, common_utils::errors::ParsingError> { let webhook: CalidaSyncResponse = body.parse_struct("CalidaIncomingWebhook")?; Ok(webhook) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 132, "total_crates": null }
fn_clm_hyperswitch_connectors_sort_and_minify_json_-8779964222814310890
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/calida/transformers pub fn sort_and_minify_json(value: &Value) -> Result<String, errors::ConnectorError> { fn sort_value(val: &Value) -> Value { match val { Value::Object(map) => { let mut entries: Vec<_> = map.iter().collect(); entries.sort_by_key(|(k, _)| k.to_owned()); let sorted_map: Map<String, Value> = entries .into_iter() .map(|(k, v)| (k.clone(), sort_value(v))) .collect(); Value::Object(sorted_map) } Value::Array(arr) => Value::Array(arr.iter().map(sort_value).collect()), _ => val.clone(), } } let sorted_value = sort_value(value); serde_json::to_string(&sorted_value) .map_err(|_| errors::ConnectorError::WebhookBodyDecodingFailed) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 49, "total_crates": null }
fn_clm_hyperswitch_connectors_sort_value_-8779964222814310890
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/calida/transformers fn sort_value(val: &Value) -> Value { match val { Value::Object(map) => { let mut entries: Vec<_> = map.iter().collect(); entries.sort_by_key(|(k, _)| k.to_owned()); let sorted_map: Map<String, Value> = entries .into_iter() .map(|(k, v)| (k.clone(), sort_value(v))) .collect(); Value::Object(sorted_map) } Value::Array(arr) => Value::Array(arr.iter().map(sort_value).collect()), _ => val.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": 39, "total_crates": null }
fn_clm_hyperswitch_connectors_try_from_-687387306099387943
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/tokenio/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_-687387306099387943
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/tokenio/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_from_bytes_-687387306099387943
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/tokenio/transformers // Inherent implementation for TokenioErrorResponse pub fn from_bytes(bytes: &[u8]) -> Self { // First try to parse as JSON if let Ok(json_response) = serde_json::from_slice::<Self>(bytes) { json_response } else { // If JSON parsing fails, treat as plain text let text = String::from_utf8_lossy(bytes).to_string(); Self::Text(text) } }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 42, "total_crates": null }
fn_clm_hyperswitch_connectors_get_message_-687387306099387943
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/tokenio/transformers // Inherent implementation for TokenioErrorResponse pub fn get_message(&self) -> String { match self { Self::Json { message, error_code, } => message .as_deref() .or(error_code.as_deref()) .unwrap_or(NO_ERROR_MESSAGE) .to_string(), Self::Text(text) => text.clone(), } }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 39, "total_crates": null }
fn_clm_hyperswitch_connectors_get_error_code_-687387306099387943
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/tokenio/transformers // Inherent implementation for TokenioErrorResponse pub fn get_error_code(&self) -> String { match self { Self::Json { error_code, .. } => { error_code.as_deref().unwrap_or(NO_ERROR_CODE).to_string() } Self::Text(_) => NO_ERROR_CODE.to_string(), } }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 35, "total_crates": null }
fn_clm_hyperswitch_connectors_try_from_540810311548407488
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/recurly/transformers // Implementation of recovery_router_data_types::BillingConnectorInvoiceSyncRouterDataV2 for TryFrom< ResponseRouterDataV2< recovery_router_flows::BillingConnectorInvoiceSync, RecurlyInvoiceSyncResponse, recovery_flow_common_types::BillingConnectorInvoiceSyncFlowData, recovery_request_types::BillingConnectorInvoiceSyncRequest, recovery_response_types::BillingConnectorInvoiceSyncResponse, >, > fn try_from( item: ResponseRouterDataV2< recovery_router_flows::BillingConnectorInvoiceSync, RecurlyInvoiceSyncResponse, recovery_flow_common_types::BillingConnectorInvoiceSyncFlowData, recovery_request_types::BillingConnectorInvoiceSyncRequest, recovery_response_types::BillingConnectorInvoiceSyncResponse, >, ) -> Result<Self, Self::Error> { #[allow(clippy::as_conversions)] // No of retries never exceeds u16 in recurly. So its better to suppress the clippy warning let retry_count = item.response.transactions.len() as u16; let merchant_reference_id = id_type::PaymentReferenceId::from_str(&item.response.id) .change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?; Ok(Self { response: Ok( recovery_response_types::BillingConnectorInvoiceSyncResponse { amount: utils::convert_back_amount_to_minor_units( &FloatMajorUnitForConnector, item.response.total, item.response.currency, )?, currency: item.response.currency, merchant_reference_id, retry_count: Some(retry_count), billing_address: Some(api_models::payments::Address { address: Some(api_models::payments::AddressDetails { city: item .response .address .clone() .and_then(|address| address.city), state: item .response .address .clone() .and_then(|address| address.region), country: item .response .address .clone() .and_then(|address| address.country), line1: item .response .address .clone() .and_then(|address| address.street1), line2: item .response .address .clone() .and_then(|address| address.street2), line3: None, zip: item .response .address .clone() .and_then(|address| address.postal_code), first_name: None, last_name: None, origin_zip: None, }), phone: None, email: None, }), created_at: item.response.line_items.first().map(|line| line.start_date), ends_at: item.response.line_items.first().map(|line| line.end_date), }, ), ..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": 2697, "total_crates": null }
fn_clm_hyperswitch_connectors_from_540810311548407488
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/recurly/transformers // Implementation of common_enums::PaymentMethod for From<RecurlyPaymentObject> fn from(funding: RecurlyPaymentObject) -> Self { match funding { RecurlyPaymentObject::CreditCard => Self::Card, } }
{ "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_webhook_object_from_body_540810311548407488
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/recurly/transformers // Inherent implementation for RecurlyWebhookBody pub fn get_webhook_object_from_body(body: &[u8]) -> CustomResult<Self, errors::ConnectorError> { let webhook_body = body .parse_struct::<Self>("RecurlyWebhookBody") .change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?; Ok(webhook_body) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 140, "total_crates": null }
fn_clm_hyperswitch_connectors_try_from_-1523328595957151502
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/prophetpay/transformers // Implementation of ProphetpayRefundSyncRequest for TryFrom<&types::RefundSyncRouterData> fn try_from(item: &types::RefundSyncRouterData) -> Result<Self, Self::Error> { let auth_data = ProphetpayAuthType::try_from(&item.connector_auth_type)?; Ok(Self { transaction_id: item.request.connector_transaction_id.clone(), ref_info: item.connector_request_reference_id.to_owned(), inquiry_reference: item.connector_request_reference_id.clone(), profile: auth_data.profile_id, action_type: ProphetpayActionType::get_action_type(&ProphetpayActionType::Inquiry), }) }
{ "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_get_card_token_-1523328595957151502
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/prophetpay/transformers fn get_card_token( response: Option<CompleteAuthorizeRedirectResponse>, ) -> CustomResult<String, errors::ConnectorError> { let res = response.ok_or(errors::ConnectorError::MissingRequiredField { field_name: "redirect_response", })?; let queries_params = res .params .map(|param| { let mut queries = HashMap::<String, String>::new(); let values = param.peek().split('&').collect::<Vec<&str>>(); for value in values { let pair = value.split('=').collect::<Vec<&str>>(); queries.insert( pair.first() .ok_or(errors::ConnectorError::ResponseDeserializationFailed)? .to_string(), pair.get(1) .ok_or(errors::ConnectorError::ResponseDeserializationFailed)? .to_string(), ); } Ok::<_, errors::ConnectorError>(queries) }) .transpose()? .ok_or(errors::ConnectorError::ResponseDeserializationFailed)?; for (key, val) in queries_params { if key.as_str() == PROPHETPAY_TOKEN { return Ok(val); } } Err(errors::ConnectorError::MissingRequiredField { field_name: "card_token", } .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": 34, "total_crates": null }
fn_clm_hyperswitch_connectors_get_redirect_url_form_-1523328595957151502
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/prophetpay/transformers fn get_redirect_url_form( mut redirect_url: Url, complete_auth_url: Option<String>, ) -> CustomResult<RedirectForm, errors::ConnectorError> { let mut form_fields = HashMap::<String, String>::new(); form_fields.insert( String::from("redirectUrl"), complete_auth_url.ok_or(errors::ConnectorError::MissingRequiredField { field_name: "complete_auth_url", })?, ); // Do not include query params in the endpoint redirect_url.set_query(None); Ok(RedirectForm::Form { endpoint: redirect_url.to_string(), method: Method::Get, form_fields, }) }
{ "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_action_type_-1523328595957151502
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/prophetpay/transformers // Inherent implementation for ProphetpayActionType fn get_action_type(&self) -> i8 { match self { Self::Charge => 1, Self::Refund => 3, Self::Inquiry => 7, } }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 11, "total_crates": null }
fn_clm_hyperswitch_connectors_get_entry_method_-1523328595957151502
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/prophetpay/transformers // Inherent implementation for ProphetpayEntryMethod fn get_entry_method(&self) -> i8 { match self { Self::ManualEntry => 1, Self::CardSwipe => 2, } }
{ "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_5773236165648365824
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/getnet/transformers // Implementation of RouterData<F, PaymentsCancelData, PaymentsResponseData> for TryFrom<ResponseRouterData<F, GetnetCancelResponse, PaymentsCancelData, PaymentsResponseData>> fn try_from( item: ResponseRouterData<F, GetnetCancelResponse, PaymentsCancelData, PaymentsResponseData>, ) -> Result<Self, Self::Error> { Ok(Self { status: cancel_status_from_transaction_state(item.response.payment.transaction_state), response: Ok(PaymentsResponseData::TransactionResponse { resource_id: ResponseId::ConnectorTransactionId( item.response.payment.transaction_id, ), redirection_data: Box::new(None), mandate_reference: Box::new(None), connector_metadata: None, network_txn_id: None, connector_response_reference_id: None, incremental_authorization_allowed: None, charges: 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": 2665, "total_crates": null }
fn_clm_hyperswitch_connectors_from_5773236165648365824
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/getnet/transformers // Implementation of enums::RefundStatus for From<RefundStatus> fn from(item: RefundStatus) -> Self { match item { RefundStatus::Success => Self::Success, RefundStatus::Failed => Self::Failure, RefundStatus::InProgress => 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_get_webhook_object_from_body_5773236165648365824
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/getnet/transformers pub fn get_webhook_object_from_body( body: &[u8], ) -> CustomResult<GetnetWebhookNotificationResponseBody, errors::ConnectorError> { let body_bytes = bytes::Bytes::copy_from_slice(body); let parsed_param: GetnetWebhookNotificationResponse = parse_url_encoded_to_struct(body_bytes) .change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?; let response_base64 = &parsed_param.response_base64.peek(); let decoded_response = BASE64_ENGINE .decode(response_base64) .change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?; let getnet_webhook_notification_response: GetnetWebhookNotificationResponseBody = match serde_json::from_slice::<GetnetWebhookNotificationResponseBody>(&decoded_response) { Ok(response) => response, Err(_e) => { return Err(errors::ConnectorError::WebhookBodyDecodingFailed)?; } }; Ok(getnet_webhook_notification_response) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 142, "total_crates": null }
fn_clm_hyperswitch_connectors_is_refund_event_5773236165648365824
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/getnet/transformers pub fn is_refund_event(transaction_type: &GetnetTransactionType) -> bool { matches!( transaction_type, GetnetTransactionType::RefundPurchase | GetnetTransactionType::RefundCapture ) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 31, "total_crates": null }
fn_clm_hyperswitch_connectors_get_webhook_response_5773236165648365824
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/getnet/transformers pub fn get_webhook_response( body: &[u8], ) -> CustomResult<GetnetWebhookNotificationResponse, errors::ConnectorError> { let body_bytes = bytes::Bytes::copy_from_slice(body); let parsed_param: GetnetWebhookNotificationResponse = parse_url_encoded_to_struct(body_bytes) .change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?; Ok(parsed_param) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 25, "total_crates": null }
fn_clm_hyperswitch_connectors_try_from_4407750431995004495
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/paypal/transformers // Implementation of PaypalSourceVerificationRequest for TryFrom<&VerifyWebhookSourceRequestData> fn try_from(req: &VerifyWebhookSourceRequestData) -> Result<Self, Self::Error> { let req_body = serde_json::from_slice(&req.webhook_body) .change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?; Ok(Self { transmission_id: get_headers( &req.webhook_headers, webhook_headers::PAYPAL_TRANSMISSION_ID, ) .change_context(errors::ConnectorError::WebhookSourceVerificationFailed)?, transmission_time: get_headers( &req.webhook_headers, webhook_headers::PAYPAL_TRANSMISSION_TIME, )?, cert_url: get_headers(&req.webhook_headers, webhook_headers::PAYPAL_CERT_URL)?, transmission_sig: get_headers( &req.webhook_headers, webhook_headers::PAYPAL_TRANSMISSION_SIG, )?, auth_algo: get_headers(&req.webhook_headers, webhook_headers::PAYPAL_AUTH_ALGO)?, webhook_id: String::from_utf8(req.merchant_secret.secret.to_vec()) .change_context(errors::ConnectorError::WebhookVerificationSecretNotFound) .attach_printable("Could not convert secret to UTF-8")?, webhook_event: req_body, }) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 2681, "total_crates": null }
fn_clm_hyperswitch_connectors_from_4407750431995004495
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/paypal/transformers // Implementation of utils::ErrorCodeAndMessage for From<ErrorDetails> fn from(error: ErrorDetails) -> Self { Self { error_code: error.issue.to_string(), error_message: error.issue.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": 2604, "total_crates": null }
fn_clm_hyperswitch_connectors_foreign_try_from_4407750431995004495
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/paypal/transformers // Implementation of RouterData<F, T, PaymentsResponseData> for ForeignTryFrom<( ResponseRouterData<F, PaypalRedirectResponse, T, PaymentsResponseData>, Option<common_enums::PaymentExperience>, )> fn foreign_try_from( (item, payment_experience): ( ResponseRouterData<F, PaypalRedirectResponse, T, PaymentsResponseData>, Option<common_enums::PaymentExperience>, ), ) -> Result<Self, Self::Error> { let status = get_order_status(item.response.clone().status, item.response.intent.clone()); let link = get_redirect_url(item.response.links.clone())?; // For Paypal SDK flow, we need to trigger SDK client and then complete authorize let next_action = if let Some(common_enums::PaymentExperience::InvokeSdkClient) = payment_experience { Some(api_models::payments::NextActionCall::CompleteAuthorize) } else { None }; let connector_meta = serde_json::json!(PaypalMeta { authorize_id: None, capture_id: None, incremental_authorization_id: None, psync_flow: item.response.intent, next_action, order_id: None, }); let purchase_units = item.response.purchase_units.first(); Ok(Self { status, response: Ok(PaymentsResponseData::TransactionResponse { resource_id: ResponseId::ConnectorTransactionId(item.response.id.clone()), redirection_data: Box::new(Some(RedirectForm::from(( link.ok_or(errors::ConnectorError::ResponseDeserializationFailed)?, Method::Get, )))), mandate_reference: Box::new(None), connector_metadata: Some(connector_meta), network_txn_id: None, connector_response_reference_id: Some( purchase_units.map_or(item.response.id, |item| item.invoice_id.clone()), ), incremental_authorization_allowed: None, charges: 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": 456, "total_crates": null }
fn_clm_hyperswitch_connectors_get_headers_4407750431995004495
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/paypal/transformers fn get_headers( header: &actix_web::http::header::HeaderMap, key: &'static str, ) -> CustomResult<String, errors::ConnectorError> { let header_value = header .get(key) .map(|value| value.to_str()) .ok_or(errors::ConnectorError::MissingRequiredField { field_name: key })? .change_context(errors::ConnectorError::InvalidDataFormat { field_name: key })? .to_owned(); Ok(header_value) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 384, "total_crates": null }
fn_clm_hyperswitch_connectors_get_payment_source_4407750431995004495
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/paypal/transformers fn get_payment_source( item: &PaymentsAuthorizeRouterData, bank_redirection_data: &BankRedirectData, ) -> Result<PaymentSourceItem, error_stack::Report<errors::ConnectorError>> { match bank_redirection_data { BankRedirectData::Eps { bank_name: _, .. } => Ok(PaymentSourceItem::Eps(RedirectRequest { name: item.get_billing_full_name()?, country_code: item.get_billing_country()?, experience_context: ContextStruct { return_url: item.request.complete_authorize_url.clone(), cancel_url: item.request.complete_authorize_url.clone(), shipping_preference: if item.get_optional_shipping_country().is_some() { ShippingPreference::SetProvidedAddress } else { ShippingPreference::GetFromFile }, user_action: Some(UserAction::PayNow), }, })), BankRedirectData::Giropay { .. } => Ok(PaymentSourceItem::Giropay(RedirectRequest { name: item.get_billing_full_name()?, country_code: item.get_billing_country()?, experience_context: ContextStruct { return_url: item.request.complete_authorize_url.clone(), cancel_url: item.request.complete_authorize_url.clone(), shipping_preference: if item.get_optional_shipping_country().is_some() { ShippingPreference::SetProvidedAddress } else { ShippingPreference::GetFromFile }, user_action: Some(UserAction::PayNow), }, })), BankRedirectData::Ideal { bank_name: _, .. } => { Ok(PaymentSourceItem::IDeal(RedirectRequest { name: item.get_billing_full_name()?, country_code: item.get_billing_country()?, experience_context: ContextStruct { return_url: item.request.complete_authorize_url.clone(), cancel_url: item.request.complete_authorize_url.clone(), shipping_preference: if item.get_optional_shipping_country().is_some() { ShippingPreference::SetProvidedAddress } else { ShippingPreference::GetFromFile }, user_action: Some(UserAction::PayNow), }, })) } BankRedirectData::Sofort { preferred_language: _, .. } => Ok(PaymentSourceItem::Sofort(RedirectRequest { name: item.get_billing_full_name()?, country_code: item.get_billing_country()?, experience_context: ContextStruct { return_url: item.request.complete_authorize_url.clone(), cancel_url: item.request.complete_authorize_url.clone(), shipping_preference: if item.get_optional_shipping_country().is_some() { ShippingPreference::SetProvidedAddress } else { ShippingPreference::GetFromFile }, user_action: Some(UserAction::PayNow), }, })), BankRedirectData::BancontactCard { .. } | BankRedirectData::Blik { .. } | BankRedirectData::Przelewy24 { .. } => Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("Paypal"), ) .into()), BankRedirectData::Bizum {} | BankRedirectData::Eft { .. } | BankRedirectData::Interac { .. } | BankRedirectData::OnlineBankingCzechRepublic { .. } | BankRedirectData::OnlineBankingFinland { .. } | BankRedirectData::OnlineBankingPoland { .. } | BankRedirectData::OnlineBankingSlovakia { .. } | BankRedirectData::OpenBankingUk { .. } | BankRedirectData::Trustly { .. } | BankRedirectData::OnlineBankingFpx { .. } | BankRedirectData::OnlineBankingThailand { .. } | BankRedirectData::LocalBankRedirect {} => Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("Paypal"), ))?, } }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 66, "total_crates": null }
fn_clm_hyperswitch_connectors_try_from_-4127183475283564423
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/tokenex/transformers // Implementation of RouterData<ExternalVaultRetrieveFlow, VaultRequestData, VaultResponseData> for TryFrom< ResponseRouterData< ExternalVaultRetrieveFlow, TokenexRetrieveResponse, VaultRequestData, VaultResponseData, >, > fn try_from( item: ResponseRouterData< ExternalVaultRetrieveFlow, TokenexRetrieveResponse, VaultRequestData, VaultResponseData, >, ) -> Result<Self, Self::Error> { let resp = item.response; match resp.success && resp.error.is_empty() { true => { let data = resp .value .clone() .ok_or(errors::ConnectorError::ResponseDeserializationFailed) .attach_printable("Card number is missing in tokenex response")?; Ok(Self { status: common_enums::AttemptStatus::Started, response: Ok(VaultResponseData::ExternalVaultRetrieveResponse { vault_data: PaymentMethodVaultingData::CardNumber(data), }), ..item.data }) } false => { let (code, message) = resp.error.split_once(':').unwrap_or(("", "")); let response = Err(ErrorResponse { code: code.to_string(), message: message.to_string(), reason: resp.message, status_code: item.http_code, attempt_status: None, connector_transaction_id: None, network_decline_code: None, network_advice_code: None, network_error_message: None, connector_metadata: None, }); 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": 2675, "total_crates": null }
fn_clm_hyperswitch_connectors_from_-4127183475283564423
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/tokenex/transformers // Implementation of TokenexRouterData<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_try_from_5157702252129392943
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/mollie/transformers // Implementation of types::RefundsRouterData<T> for TryFrom<RefundsResponseRouterData<T, RefundResponse>> fn try_from(item: RefundsResponseRouterData<T, RefundResponse>) -> Result<Self, Self::Error> { Ok(Self { response: Ok(RefundsResponseData { connector_refund_id: item.response.id, 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": 2659, "total_crates": null }
fn_clm_hyperswitch_connectors_from_5157702252129392943
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/mollie/transformers // Implementation of enums::RefundStatus for From<MollieRefundStatus> fn from(item: MollieRefundStatus) -> Self { match item { MollieRefundStatus::Queued | MollieRefundStatus::Pending | MollieRefundStatus::Processing => Self::Pending, MollieRefundStatus::Refunded => Self::Success, MollieRefundStatus::Failed | MollieRefundStatus::Canceled => 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_payment_method_for_wallet_5157702252129392943
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/mollie/transformers fn get_payment_method_for_wallet( item: &types::PaymentsAuthorizeRouterData, wallet_data: &WalletData, ) -> Result<MolliePaymentMethodData, Error> { match wallet_data { WalletData::PaypalRedirect { .. } => Ok(MolliePaymentMethodData::Paypal(Box::new( PaypalMethodData { billing_address: get_billing_details(item)?, shipping_address: get_shipping_details(item)?, }, ))), WalletData::ApplePay(applepay_wallet_data) => { let apple_pay_encrypted_data = applepay_wallet_data .payment_data .get_encrypted_apple_pay_payment_data_mandatory() .change_context(errors::ConnectorError::MissingRequiredField { field_name: "Apple pay encrypted data", })?; Ok(MolliePaymentMethodData::Applepay(Box::new( ApplePayMethodData { apple_pay_payment_token: Secret::new(apple_pay_encrypted_data.to_owned()), }, ))) } _ => Err(errors::ConnectorError::NotImplemented("Payment 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": 26, "total_crates": null }
fn_clm_hyperswitch_connectors_get_address_details_5157702252129392943
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/mollie/transformers fn get_address_details( address: Option<&hyperswitch_domain_models::address::AddressDetails>, ) -> Result<Option<Address>, Error> { let address_details = match address { Some(address) => { let street_and_number = address.get_combined_address_line()?; let postal_code = address.get_zip()?.to_owned(); let city = address.get_city()?.to_owned(); let region = None; let country = address.get_country()?.to_owned(); Some(Address { street_and_number, postal_code, city, region, country, }) } None => None, }; Ok(address_details) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 20, "total_crates": null }
fn_clm_hyperswitch_connectors_get_billing_details_5157702252129392943
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/mollie/transformers fn get_billing_details( item: &types::PaymentsAuthorizeRouterData, ) -> Result<Option<Address>, Error> { let billing_address = item .get_optional_billing() .and_then(|billing| billing.address.as_ref()); get_address_details(billing_address) }
{ "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_-7953974567043544264
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/adyenplatform/transformers // Implementation of AdyenPlatformRouterData<T> for TryFrom<(MinorUnit, T)> fn try_from((amount, item): (MinorUnit, T)) -> Result<Self, Self::Error> { Ok(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": 2657, "total_crates": null }
fn_clm_hyperswitch_connectors_try_from_-6390067689107406781
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/adyenplatform/transformers/payouts // Implementation of AdyenPayoutMethod for TryFrom<enums::PayoutType> fn try_from(payout_type: enums::PayoutType) -> Result<Self, Self::Error> { match payout_type { enums::PayoutType::Bank => Ok(Self::Bank), enums::PayoutType::Card => Ok(Self::Card), enums::PayoutType::Wallet | enums::PayoutType::BankRedirect => { Err(report!(ConnectorError::NotSupported { message: "Bakredirect or wallet payouts".to_string(), connector: "Adyenplatform", })) } } }
{ "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_-6390067689107406781
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/adyenplatform/transformers/payouts // Implementation of AdyenPayoutPriority for From<enums::PayoutSendPriority> fn from(entity: enums::PayoutSendPriority) -> Self { match entity { enums::PayoutSendPriority::Instant => Self::Instant, enums::PayoutSendPriority::Fast => Self::Fast, enums::PayoutSendPriority::Regular => Self::Regular, enums::PayoutSendPriority::Wire => Self::Wire, enums::PayoutSendPriority::CrossBorder => Self::CrossBorder, enums::PayoutSendPriority::Internal => Self::Internal, } }
{ "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_adyen_payout_webhook_event_-6390067689107406781
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/adyenplatform/transformers/payouts pub fn get_adyen_payout_webhook_event( event_type: AdyenplatformWebhookEventType, status: AdyenplatformWebhookStatus, tracking_data: Option<AdyenplatformTrackingData>, ) -> webhooks::IncomingWebhookEvent { match (event_type, status, tracking_data) { (AdyenplatformWebhookEventType::PayoutCreated, _, _) => { webhooks::IncomingWebhookEvent::PayoutCreated } (AdyenplatformWebhookEventType::PayoutUpdated, _, Some(tracking_data)) => { match tracking_data.status { TrackingStatus::Credited | TrackingStatus::Accepted => { webhooks::IncomingWebhookEvent::PayoutSuccess } TrackingStatus::Pending => webhooks::IncomingWebhookEvent::PayoutProcessing, } } (AdyenplatformWebhookEventType::PayoutUpdated, status, _) => match status { AdyenplatformWebhookStatus::Authorised | AdyenplatformWebhookStatus::Received => { webhooks::IncomingWebhookEvent::PayoutCreated } AdyenplatformWebhookStatus::Booked | AdyenplatformWebhookStatus::Pending => { webhooks::IncomingWebhookEvent::PayoutProcessing } AdyenplatformWebhookStatus::Failed => webhooks::IncomingWebhookEvent::PayoutFailure, AdyenplatformWebhookStatus::Returned => webhooks::IncomingWebhookEvent::PayoutReversed, }, } }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 13, "total_crates": null }
fn_clm_hyperswitch_connectors_try_from_6384906536131784992
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/trustpay/transformers // Implementation of enums::RefundStatus for TryFrom<WebhookStatus> fn try_from(item: WebhookStatus) -> Result<Self, Self::Error> { match item { WebhookStatus::Paid => Ok(Self::Success), WebhookStatus::Refunded => Ok(Self::Success), WebhookStatus::Rejected => Ok(Self::Failure), _ => Err(errors::ConnectorError::WebhookEventTypeNotFound), } }
{ "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_6384906536131784992
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/trustpay/transformers // Implementation of utils::ErrorCodeAndMessage for From<Errors> fn from(error: Errors) -> Self { Self { error_code: error.code.to_string(), error_message: error.description, } }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 2602, "total_crates": null }
fn_clm_hyperswitch_connectors_get_card_request_data_6384906536131784992
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/trustpay/transformers fn get_card_request_data( item: &PaymentsAuthorizeRouterData, browser_info: &BrowserInformation, params: TrustpayMandatoryParams, amount: StringMajorUnit, ccard: &Card, return_url: String, ) -> Result<TrustpayPaymentsRequest, Error> { let email = item.request.get_email()?; let customer_ip_address = browser_info.get_ip_address()?; let billing_last_name = item .get_billing()? .address .as_ref() .and_then(|address| address.last_name.clone()); Ok(TrustpayPaymentsRequest::CardsPaymentRequest(Box::new( PaymentRequestCards { amount, currency: item.request.currency.to_string(), pan: ccard.card_number.clone(), cvv: ccard.card_cvc.clone(), expiry_date: ccard.get_card_expiry_month_year_2_digit_with_delimiter("/".to_owned())?, cardholder: get_full_name(params.billing_first_name, billing_last_name), reference: item.connector_request_reference_id.clone(), redirect_url: return_url, billing_city: params.billing_city, billing_country: params.billing_country, billing_street1: params.billing_street1, billing_postcode: params.billing_postcode, customer_email: email, customer_ip_address, browser_accept_header: browser_info.get_accept_header()?, browser_language: browser_info.get_language()?, browser_screen_height: browser_info.get_screen_height()?.to_string(), browser_screen_width: browser_info.get_screen_width()?.to_string(), browser_timezone: browser_info.get_time_zone()?.to_string(), browser_user_agent: browser_info.get_user_agent()?, browser_java_enabled: browser_info.get_java_enabled()?.to_string(), browser_java_script_enabled: browser_info.get_java_script_enabled()?.to_string(), browser_screen_color_depth: browser_info.get_color_depth()?.to_string(), browser_challenge_window: "1".to_string(), payment_action: None, payment_type: "Plain".to_string(), descriptor: item.request.statement_descriptor.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": 66, "total_crates": null }
fn_clm_hyperswitch_connectors_handle_cards_response_6384906536131784992
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/trustpay/transformers fn handle_cards_response( response: PaymentsResponseCards, status_code: u16, ) -> CustomResult< ( enums::AttemptStatus, Option<ErrorResponse>, PaymentsResponseData, ), errors::ConnectorError, > { let (status, msg) = get_transaction_status( response.payment_status.to_owned(), response.redirect_url.to_owned(), )?; let form_fields = response.redirect_params.unwrap_or_default(); let redirection_data = response.redirect_url.map(|url| RedirectForm::Form { endpoint: url.to_string(), method: Method::Post, form_fields, }); let error = if msg.is_some() { Some(ErrorResponse { code: response .payment_status .unwrap_or_else(|| consts::NO_ERROR_CODE.to_string()), message: msg .clone() .unwrap_or_else(|| consts::NO_ERROR_MESSAGE.to_string()), reason: msg, status_code, attempt_status: None, connector_transaction_id: Some(response.instance_id.clone()), network_advice_code: None, network_decline_code: None, network_error_message: None, connector_metadata: None, }) } else { None }; let payment_response_data = PaymentsResponseData::TransactionResponse { resource_id: ResponseId::ConnectorTransactionId(response.instance_id.clone()), redirection_data: Box::new(redirection_data), mandate_reference: Box::new(None), connector_metadata: None, network_txn_id: None, connector_response_reference_id: None, incremental_authorization_allowed: None, charges: None, }; Ok((status, error, payment_response_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": 37, "total_crates": null }
fn_clm_hyperswitch_connectors_handle_webhook_response_6384906536131784992
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/trustpay/transformers pub fn handle_webhook_response( payment_information: WebhookPaymentInformation, status_code: u16, ) -> CustomResult< ( enums::AttemptStatus, Option<ErrorResponse>, PaymentsResponseData, ), errors::ConnectorError, > { let status = enums::AttemptStatus::try_from(payment_information.status)?; let error = if utils::is_payment_failure(status) { let reason_info = payment_information .status_reason_information .unwrap_or_default(); Some(ErrorResponse { code: reason_info .reason .code .clone() .unwrap_or(consts::NO_ERROR_CODE.to_string()), // message vary for the same code, so relying on code alone as it is unique message: reason_info .reason .code .unwrap_or(consts::NO_ERROR_MESSAGE.to_string()), reason: reason_info.reason.reject_reason, status_code, attempt_status: None, connector_transaction_id: payment_information.references.payment_request_id.clone(), network_advice_code: None, network_decline_code: None, network_error_message: None, connector_metadata: None, }) } else { None }; let payment_response_data = PaymentsResponseData::TransactionResponse { resource_id: ResponseId::NoResponseId, redirection_data: Box::new(None), mandate_reference: Box::new(None), connector_metadata: None, network_txn_id: None, connector_response_reference_id: None, incremental_authorization_allowed: None, charges: None, }; Ok((status, error, payment_response_data)) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 35, "total_crates": null }
fn_clm_hyperswitch_connectors_try_from_634925919391547017
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/xendit/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_634925919391547017
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/xendit/transformers // Implementation of enums::RefundStatus for From<RefundStatus> fn from(item: RefundStatus) -> Self { match item { RefundStatus::Succeeded => Self::Success, RefundStatus::Failed | RefundStatus::Cancelled => Self::Failure, RefundStatus::Pending | RefundStatus::RequiresAction => 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_map_payment_response_to_attempt_status_634925919391547017
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/xendit/transformers fn map_payment_response_to_attempt_status( response: XenditPaymentResponse, is_auto_capture: bool, ) -> enums::AttemptStatus { match response.status { PaymentStatus::Failed => enums::AttemptStatus::Failure, PaymentStatus::Succeeded | PaymentStatus::Verified => { if is_auto_capture { enums::AttemptStatus::Charged } else { enums::AttemptStatus::Authorized } } PaymentStatus::Pending => enums::AttemptStatus::Pending, PaymentStatus::RequiresAction => enums::AttemptStatus::AuthenticationPending, PaymentStatus::AwaitingCapture => enums::AttemptStatus::Authorized, } }
{ "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_5376745659768866832
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/authipay/transformers // Implementation of RefundsRouterData<RSync> for TryFrom<RefundsResponseRouterData<RSync, RefundResponse>> fn try_from( item: RefundsResponseRouterData<RSync, RefundResponse>, ) -> Result<Self, Self::Error> { let refund_status = if item.response.transaction_type == "RETURN" { match item.response.transaction_result.as_deref() { Some("APPROVED") => RefundStatus::Succeeded, Some("DECLINED") | Some("FAILED") => RefundStatus::Failed, _ => RefundStatus::Processing, } } else { RefundStatus::Processing }; Ok(Self { response: Ok(RefundsResponseData { connector_refund_id: item.response.ipg_transaction_id.to_string(), refund_status: enums::RefundStatus::from(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": 2663, "total_crates": null }
fn_clm_hyperswitch_connectors_from_5376745659768866832
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/authipay/transformers // Implementation of ErrorResponse for From<&AuthipayErrorResponse> fn from(item: &AuthipayErrorResponse) -> Self { Self { status_code: 500, // Default to Internal Server Error, will be overridden by actual HTTP status code: item.error.code.clone().unwrap_or_default(), message: item.error.message.clone(), reason: None, 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": 2606, "total_crates": null }
fn_clm_hyperswitch_connectors_get_transaction_status_5376745659768866832
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/authipay/transformers // Implementation of None for AuthipayPaymentsResponse /// Determine the transaction status based on transaction type and various status fields (like Fiserv) fn get_transaction_status(&self) -> AuthipayTransactionStatus { match self.transaction_type.as_str() { "RETURN" => { // Refund transaction - use transaction_result match self.transaction_result.as_deref() { Some("APPROVED") => AuthipayTransactionStatus::Captured, Some("DECLINED") | Some("FAILED") => AuthipayTransactionStatus::Failed, _ => AuthipayTransactionStatus::Processing, } } "VOID" => { // Void transaction - use transaction_result, fallback to transaction_state match self.transaction_result.as_deref() { Some("APPROVED") => AuthipayTransactionStatus::Voided, Some("DECLINED") | Some("FAILED") => AuthipayTransactionStatus::Failed, Some("PENDING") | Some("PROCESSING") => AuthipayTransactionStatus::Processing, _ => { // Fallback to transaction_state for void operations match self.transaction_state.as_deref() { Some("VOIDED") => AuthipayTransactionStatus::Voided, Some("FAILED") | Some("DECLINED") => AuthipayTransactionStatus::Failed, _ => AuthipayTransactionStatus::Voided, // Default assumption for void requests } } } } _ => { // Payment transaction - prioritize transaction_state over transaction_status match self.transaction_state.as_deref() { Some("AUTHORIZED") => AuthipayTransactionStatus::Authorized, Some("CAPTURED") => AuthipayTransactionStatus::Captured, Some("VOIDED") => AuthipayTransactionStatus::Voided, Some("DECLINED") | Some("FAILED") => AuthipayTransactionStatus::Failed, _ => { // Fallback to transaction_status with transaction_type context match ( self.transaction_type.as_str(), self.transaction_status.as_deref(), ) { // For PREAUTH transactions, "APPROVED" means authorized and awaiting capture ("PREAUTH", Some("APPROVED")) => AuthipayTransactionStatus::Authorized, // For POSTAUTH transactions, "APPROVED" means successfully captured ("POSTAUTH", Some("APPROVED")) => AuthipayTransactionStatus::Captured, // For SALE transactions, "APPROVED" means completed payment ("SALE", Some("APPROVED")) => AuthipayTransactionStatus::Captured, // For VOID transactions, "APPROVED" means successfully voided ("VOID", Some("APPROVED")) => AuthipayTransactionStatus::Voided, // Generic status mappings for other cases (_, Some("APPROVED")) => AuthipayTransactionStatus::Captured, (_, Some("AUTHORIZED")) => AuthipayTransactionStatus::Authorized, (_, Some("DECLINED") | Some("FAILED")) => { AuthipayTransactionStatus::Failed } _ => AuthipayTransactionStatus::Processing, } } } } } }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 28, "total_crates": null }
fn_clm_hyperswitch_connectors_gateway_response_5376745659768866832
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/authipay/transformers // Implementation of None for AuthipayPaymentsResponse /// Get gateway response (like Fiserv's gateway_response) pub fn gateway_response(&self) -> AuthipayGatewayResponse { AuthipayGatewayResponse { transaction_state: self.get_transaction_status(), transaction_processing_details: AuthipayTransactionProcessingDetails { order_id: self.order_id.clone(), transaction_id: self.ipg_transaction_id.clone(), }, } }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 24, "total_crates": null }