id
stringlengths
11
116
type
stringclasses
1 value
granularity
stringclasses
4 values
content
stringlengths
16
477k
metadata
dict
fn_clm_hyperswitch_connectors_try_from_-7743521158616300153
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/opennode/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_-7743521158616300153
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/opennode/transformers // Implementation of enums::RefundStatus for From<RefundStatus> fn from(item: RefundStatus) -> Self { match item { RefundStatus::Refunded => Self::Success, 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_get_crypto_specific_payment_data_-7743521158616300153
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/opennode/transformers fn get_crypto_specific_payment_data( item: &OpennodeRouterData<&PaymentsAuthorizeRouterData>, ) -> Result<OpennodePaymentsRequest, error_stack::Report<errors::ConnectorError>> { let amount = item.amount; let currency = item.router_data.request.currency.to_string(); let description = item.router_data.get_description()?; let auto_settle = true; let success_url = item.router_data.request.get_router_return_url()?; let callback_url = item.router_data.request.get_webhook_url()?; let order_id = item.router_data.connector_request_reference_id.clone(); Ok(OpennodePaymentsRequest { amount, currency, description, auto_settle, success_url, callback_url, order_id, }) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 10, "total_crates": null }
fn_clm_hyperswitch_connectors_try_from_6713765241466604523
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/fiservemea/transformers // Implementation of RefundsRouterData<RSync> for TryFrom<RefundsResponseRouterData<RSync, FiservemeaPaymentsResponse>> fn try_from( item: RefundsResponseRouterData<RSync, FiservemeaPaymentsResponse>, ) -> Result<Self, Self::Error> { Ok(Self { response: Ok(RefundsResponseData { connector_refund_id: item.response.ipg_transaction_id, refund_status: map_refund_status( item.response.transaction_status, item.response.transaction_result, )?, }), ..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_6713765241466604523
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/fiservemea/transformers // Implementation of FiservemeaRouterData<T> for From<(StringMajorUnit, T)> fn from((amount, item): (StringMajorUnit, T)) -> Self { //Todo : use utils to convert the amount to the type of amount that a connector accepts 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_map_refund_status_6713765241466604523
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/fiservemea/transformers fn map_refund_status( fiservemea_status: Option<FiservemeaPaymentStatus>, fiservemea_result: Option<FiservemeaPaymentResult>, ) -> Result<enums::RefundStatus, errors::ConnectorError> { match fiservemea_status { Some(status) => match status { FiservemeaPaymentStatus::Approved => Ok(enums::RefundStatus::Success), FiservemeaPaymentStatus::Partial | FiservemeaPaymentStatus::Waiting => { Ok(enums::RefundStatus::Pending) } FiservemeaPaymentStatus::ValidationFailed | FiservemeaPaymentStatus::ProcessingFailed | FiservemeaPaymentStatus::Declined => Ok(enums::RefundStatus::Failure), }, None => match fiservemea_result { Some(result) => match result { FiservemeaPaymentResult::Approved => Ok(enums::RefundStatus::Success), FiservemeaPaymentResult::Partial | FiservemeaPaymentResult::Waiting => { Ok(enums::RefundStatus::Pending) } FiservemeaPaymentResult::Declined | FiservemeaPaymentResult::Failed | FiservemeaPaymentResult::Fraud => Ok(enums::RefundStatus::Failure), }, None => Err(errors::ConnectorError::MissingRequiredField { field_name: "transactionResult", }), }, } }
{ "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_map_status_6713765241466604523
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/fiservemea/transformers fn map_status( fiservemea_status: Option<FiservemeaPaymentStatus>, fiservemea_result: Option<FiservemeaPaymentResult>, transaction_type: FiservemeaTransactionType, ) -> common_enums::AttemptStatus { match fiservemea_status { Some(status) => match status { FiservemeaPaymentStatus::Approved => match transaction_type { FiservemeaTransactionType::Preauth => common_enums::AttemptStatus::Authorized, FiservemeaTransactionType::Void => common_enums::AttemptStatus::Voided, FiservemeaTransactionType::Sale | FiservemeaTransactionType::Postauth => { common_enums::AttemptStatus::Charged } FiservemeaTransactionType::Credit | FiservemeaTransactionType::ForcedTicket | FiservemeaTransactionType::Return | FiservemeaTransactionType::PayerAuth | FiservemeaTransactionType::Disbursement => common_enums::AttemptStatus::Failure, }, FiservemeaPaymentStatus::Waiting => common_enums::AttemptStatus::Pending, FiservemeaPaymentStatus::Partial => common_enums::AttemptStatus::PartialCharged, FiservemeaPaymentStatus::ValidationFailed | FiservemeaPaymentStatus::ProcessingFailed | FiservemeaPaymentStatus::Declined => common_enums::AttemptStatus::Failure, }, None => match fiservemea_result { Some(result) => match result { FiservemeaPaymentResult::Approved => match transaction_type { FiservemeaTransactionType::Preauth => common_enums::AttemptStatus::Authorized, FiservemeaTransactionType::Void => common_enums::AttemptStatus::Voided, FiservemeaTransactionType::Sale | FiservemeaTransactionType::Postauth => { common_enums::AttemptStatus::Charged } FiservemeaTransactionType::Credit | FiservemeaTransactionType::ForcedTicket | FiservemeaTransactionType::Return | FiservemeaTransactionType::PayerAuth | FiservemeaTransactionType::Disbursement => { common_enums::AttemptStatus::Failure } }, FiservemeaPaymentResult::Waiting => common_enums::AttemptStatus::Pending, FiservemeaPaymentResult::Partial => common_enums::AttemptStatus::PartialCharged, FiservemeaPaymentResult::Declined | FiservemeaPaymentResult::Failed | FiservemeaPaymentResult::Fraud => common_enums::AttemptStatus::Failure, }, None => common_enums::AttemptStatus::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": 0, "total_crates": null }
fn_clm_hyperswitch_connectors_try_from_4467449741102079101
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/boku/transformers // Implementation of RefundsRouterData<RSync> for TryFrom<RefundsResponseRouterData<RSync, BokuRsyncResponse>> fn try_from( item: RefundsResponseRouterData<RSync, BokuRsyncResponse>, ) -> Result<Self, Self::Error> { Ok(Self { response: Ok(RefundsResponseData { connector_refund_id: item.response.refunds.refund.refund_id, refund_status: get_refund_status(item.response.refunds.refund.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": 2659, "total_crates": null }
fn_clm_hyperswitch_connectors_from_4467449741102079101
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/boku/transformers // Implementation of BokuRouterData<T> for From<(MinorUnit, T)> fn from((amount, router_data): (MinorUnit, T)) -> Self { Self { amount, router_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": 2600, "total_crates": null }
fn_clm_hyperswitch_connectors_fmt_4467449741102079101
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/boku/transformers // Implementation of BokuRefundReasonCode for fmt::Display fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { Self::NonFulfillment => write!(f, "8"), } }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 38, "total_crates": null }
fn_clm_hyperswitch_connectors_get_wallet_type_4467449741102079101
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/boku/transformers fn get_wallet_type(wallet_data: &WalletData) -> Result<String, errors::ConnectorError> { match wallet_data { WalletData::DanaRedirect { .. } => Ok(BokuPaymentType::Dana.to_string()), WalletData::MomoRedirect { .. } => Ok(BokuPaymentType::Momo.to_string()), WalletData::GcashRedirect { .. } => Ok(BokuPaymentType::Gcash.to_string()), WalletData::GoPayRedirect { .. } => Ok(BokuPaymentType::GoPay.to_string()), WalletData::KakaoPayRedirect { .. } => Ok(BokuPaymentType::Kakaopay.to_string()), WalletData::AliPayQr(_) | WalletData::AliPayRedirect(_) | WalletData::AliPayHkRedirect(_) | WalletData::AmazonPay(_) | WalletData::AmazonPayRedirect(_) | WalletData::Paysera(_) | WalletData::Skrill(_) | WalletData::BluecodeRedirect {} | WalletData::ApplePay(_) | WalletData::ApplePayRedirect(_) | WalletData::ApplePayThirdPartySdk(_) | WalletData::GooglePay(_) | WalletData::GooglePayRedirect(_) | WalletData::GooglePayThirdPartySdk(_) | WalletData::MbWayRedirect(_) | WalletData::MobilePayRedirect(_) | WalletData::PaypalRedirect(_) | WalletData::PaypalSdk(_) | WalletData::Paze(_) | WalletData::SamsungPay(_) | WalletData::TwintRedirect {} | WalletData::VippsRedirect {} | WalletData::TouchNGoRedirect(_) | WalletData::WeChatPayRedirect(_) | WalletData::WeChatPayQr(_) | WalletData::CashappQr(_) | WalletData::SwishQr(_) | WalletData::Mifinity(_) | WalletData::RevolutPay(_) => Err(errors::ConnectorError::NotImplemented( utils::get_unimplemented_payment_method_error_message("boku"), )), } }
{ "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_get_response_status_4467449741102079101
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/boku/transformers fn get_response_status(status: String) -> enums::AttemptStatus { match status.as_str() { "Success" => enums::AttemptStatus::Charged, "Failure" => enums::AttemptStatus::Failure, _ => enums::AttemptStatus::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": 8, "total_crates": null }
fn_clm_hyperswitch_connectors_try_from_4866403365132289505
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/coinbase/transformers // Implementation of CoinbaseConnectorMeta for TryFrom<&Option<pii::SecretSerdeValue>> fn try_from(meta_data: &Option<pii::SecretSerdeValue>) -> Result<Self, Self::Error> { utils::to_connector_meta_from_secret(meta_data.clone()) .change_context(errors::ConnectorError::InvalidConnectorConfig { config: "metadata" }) }
{ "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_4866403365132289505
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/coinbase/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_get_crypto_specific_payment_data_4866403365132289505
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/coinbase/transformers fn get_crypto_specific_payment_data( item: &CoinbaseRouterData<&PaymentsAuthorizeRouterData>, ) -> Result<CoinbasePaymentsRequest, error_stack::Report<errors::ConnectorError>> { let billing_address = item .router_data .get_billing() .ok() .and_then(|billing_address| billing_address.address.as_ref()); let name = billing_address.and_then(|add| add.get_first_name().ok().map(|name| name.to_owned())); let description = item.router_data.get_description().ok(); let connector_meta = CoinbaseConnectorMeta::try_from(&item.router_data.connector_meta_data) .change_context(errors::ConnectorError::InvalidConnectorConfig { config: "Merchant connector account metadata", })?; let pricing_type = connector_meta.pricing_type; let local_price = get_local_price(item); let redirect_url = item.router_data.request.get_router_return_url()?; let cancel_url = item.router_data.request.get_router_return_url()?; Ok(CoinbasePaymentsRequest { name, description, pricing_type, local_price, redirect_url, cancel_url, }) }
{ "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_get_local_price_4866403365132289505
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/coinbase/transformers fn get_local_price(item: &CoinbaseRouterData<&PaymentsAuthorizeRouterData>) -> LocalPrice { LocalPrice { amount: item.amount.clone(), currency: item.router_data.request.currency.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": 7, "total_crates": null }
fn_clm_hyperswitch_connectors_try_from_7959583863945630763
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/zsl/transformers // Implementation of ZslResponseStatus for TryFrom<String> fn try_from(status: String) -> Result<Self, Self::Error> { match status.as_str() { "0" => Ok(Self::Normal), "1000" => Ok(Self::InternalError), "1001" => Ok(Self::BreakDownMessageError), "1002" => Ok(Self::FormatError), "1004" => Ok(Self::InvalidTransaction), "1005" => Ok(Self::TransactionCountryNotFound), "1006" => Ok(Self::MerchantIdNotFound), "1007" => Ok(Self::AccountDisabled), "1008" => Ok(Self::DuplicateMerchantReference), "1009" => Ok(Self::InvalidPayAmount), "1010" => Ok(Self::PayAmountNotFound), "1011" => Ok(Self::InvalidCurrencyCode), "1012" => Ok(Self::CurrencyCodeNotFound), "1013" => Ok(Self::ReferenceNotFound), "1014" => Ok(Self::TransmissionTimeNotFound), "1015" => Ok(Self::PayMethodNotFound), "1016" => Ok(Self::BankCodeNotFound), "1017" => Ok(Self::InvalidShowPayPage), "1018" => Ok(Self::ShowPayPageNotFound), "1019" => Ok(Self::SuccessUrlNotFound), "1020" => Ok(Self::SuccessCallbackUrlNotFound), "1021" => Ok(Self::FailUrlNotFound), "1022" => Ok(Self::FailCallbackUrlNotFound), "1023" => Ok(Self::MacNotFound), "1025" => Ok(Self::OriginalTransactionNotFound), "1026" => Ok(Self::DeblockDataError), "1028" => Ok(Self::PspAckNotYetReturn), "1029" => Ok(Self::BankBranchNameNotFound), "1030" => Ok(Self::BankAccountIDNotFound), "1031" => Ok(Self::BankAccountNameNotFound), "1032" => Ok(Self::IdentityIDNotFound), "1033" => Ok(Self::ErrorConnectingToPsp), "1034" => Ok(Self::CountryPspNotAvailable), "1035" => Ok(Self::UnsupportedPayAmount), "1036" => Ok(Self::RecordMismatch), "1037" => Ok(Self::NoRecord), "1038" => Ok(Self::PspError), "1039" => Ok(Self::UnsupportedEncryptionType), "1040" => Ok(Self::ExceedTransactionLimitCount), "1041" => Ok(Self::ExceedTransactionLimitAmount), "1042" => Ok(Self::ExceedTransactionAccountLimitCount), "1043" => Ok(Self::ExceedTransactionAccountLimitAmount), "1044" => Ok(Self::ExchangeRateError), "1045" => Ok(Self::InvalidEncoding), "1046" => Ok(Self::CustomerNameNotFound), "1047" => Ok(Self::CustomerFamilyNameNotFound), "1048" => Ok(Self::CustomerTelPhoneNotFound), "1049" => Ok(Self::InsufficientFund), "1050" => Ok(Self::ServiceCodeIsMissing), "1051" => Ok(Self::CurrencyIdNotMatch), "1052" => Ok(Self::NoPendingRecord), "1053" => Ok(Self::NoLoadBalancerRuleDefineForTransaction), "1054" => Ok(Self::NoPaymentProviderAvailable), "1055" => Ok(Self::UnsupportedPayMethod), "1056" => Ok(Self::PendingTransaction), "1057" => Ok(Self::OtherError1059), "1058" => Ok(Self::OtherError1058), "1059" => Ok(Self::OtherError1059), "1084" => Ok(Self::InvalidRequestId), "5043" => Ok(Self::BeneficiaryBankAccountIsNotAvailable), "5053" => Ok(Self::BaidNotFound), "5057" => Ok(Self::InvalidBaid), "5059" => Ok(Self::InvalidBaidStatus), "5107" => Ok(Self::AutoUploadBankDisabled), "5108" => Ok(Self::InvalidNature), "5109" => Ok(Self::SmsCreateDateNotFound), "5110" => Ok(Self::InvalidSmsCreateDate), "5111" => Ok(Self::RecordNotFound), "5112" => Ok(Self::InsufficientBaidAvailableBalance), "5113" => Ok(Self::ExceedTxnAmountLimit), "5114" => Ok(Self::BaidBalanceNotFound), "5115" => Ok(Self::AutoUploadIndicatorNotFound), "5116" => Ok(Self::InvalidBankAcctStatus), "5117" => Ok(Self::InvalidAutoUploadIndicator), "5118" => Ok(Self::InvalidPidStatus), "5119" => Ok(Self::InvalidProviderStatus), "5120" => Ok(Self::InvalidBankAccountSystemSwitchEnabled), "5121" => Ok(Self::AutoUploadProviderDisabled), "5122" => Ok(Self::AutoUploadBankNotFound), "5123" => Ok(Self::AutoUploadBankAcctNotFound), "5124" => Ok(Self::AutoUploadProviderNotFound), "5125" => Ok(Self::UnsupportedBankCode), "5126" => Ok(Self::BalanceOverrideIndicatorNotFound), "5127" => Ok(Self::InvalidBalanceOverrideIndicator), "10000" => Ok(Self::VernoInvalid), "10001" => Ok(Self::ServiceCodeInvalid), "10002" => Ok(Self::PspResponseSignatureIsNotValid), "10003" => Ok(Self::ProcessTypeNotFound), "10004" => Ok(Self::ProcessCodeNotFound), "10005" => Ok(Self::EnctypeNotFound), "10006" => Ok(Self::VernoNotFound), "10007" => Ok(Self::DepositBankNotFound), "10008" => Ok(Self::DepositFlowNotFound), "10009" => Ok(Self::CustDepositDateNotFound), "10010" => Ok(Self::CustTagNotFound), "10011" => Ok(Self::CountryValueInvalid), "10012" => Ok(Self::CurrencyCodeValueInvalid), "10013" => Ok(Self::MerTxnDateInvalid), "10014" => Ok(Self::CustDepositDateInvalid), "10015" => Ok(Self::TxnAmtInvalid), "10016" => Ok(Self::SuccessCallbackUrlInvalid), "10017" => Ok(Self::DepositFlowInvalid), "10018" => Ok(Self::ProcessTypeInvalid), "10019" => Ok(Self::ProcessCodeInvalid), "10020" => Ok(Self::UnsupportedMerRefLength), "10021" => Ok(Self::DepositBankLengthOverLimit), "10022" => Ok(Self::CustTagLengthOverLimit), "10023" => Ok(Self::SignatureLengthOverLimit), "10024" => Ok(Self::RequestContainInvalidTag), "10025" => Ok(Self::RequestSignatureNotMatch), "10026" => Ok(Self::InvalidCustomer), "10027" => Ok(Self::SchemeNotFound), "10028" => Ok(Self::PspResponseFieldsMissing), "10029" => Ok(Self::PspResponseMerRefNotMatchWithRequestMerRef), "10030" => Ok(Self::PspResponseMerIdNotMatchWithRequestMerId), "10031" => Ok(Self::UpdateDepositFailAfterResponse), "10032" => Ok(Self::UpdateUsedLimitTransactionCountFailAfterSuccessResponse), "10033" => Ok(Self::UpdateCustomerLastDepositRecordAfterSuccessResponse), "10034" => Ok(Self::CreateDepositFail), "10035" => Ok(Self::CreateDepositMsgFail), "10036" => Ok(Self::UpdateStatusSubStatusFail), "10037" => Ok(Self::AddDepositRecordToSchemeAccount), "10038" => Ok(Self::EmptyResponse), "10039" => Ok(Self::AubConfirmErrorFromPh), "10040" => Ok(Self::ProviderEmailAddressNotFound), "10041" => Ok(Self::AubConnectionTimeout), "10042" => Ok(Self::AubConnectionIssue), "10043" => Ok(Self::AubMsgTypeMissing), "10044" => Ok(Self::AubMsgCodeMissing), "10045" => Ok(Self::AubVersionMissing), "10046" => Ok(Self::AubEncTypeMissing), "10047" => Ok(Self::AubSignMissing), "10048" => Ok(Self::AubInfoMissing), "10049" => Ok(Self::AubErrorCodeMissing), "10050" => Ok(Self::AubMsgTypeInvalid), "10051" => Ok(Self::AubMsgCodeInvalid), "10052" => Ok(Self::AubBaidMissing), "10053" => Ok(Self::AubResponseSignNotMatch), "10054" => Ok(Self::SmsConnectionTimeout), "10055" => Ok(Self::SmsConnectionIssue), "10056" => Ok(Self::SmsConfirmErrorFromPh), "10057" => Ok(Self::SmsMsgTypeMissing), "10058" => Ok(Self::SmsMsgCodeMissing), "10059" => Ok(Self::SmsVersionMissing), "10060" => Ok(Self::SmsEncTypeMissing), "10061" => Ok(Self::SmsSignMissing), "10062" => Ok(Self::SmsInfoMissing), "10063" => Ok(Self::SmsErrorCodeMissing), "10064" => Ok(Self::SmsMsgTypeInvalid), "10065" => Ok(Self::SmsMsgCodeInvalid), "10066" => Ok(Self::SmsResponseSignNotMatch), "10067" => Ok(Self::SmsRequestReachMaximumLimit), "10068" => Ok(Self::SyncConnectionTimeout), "10069" => Ok(Self::SyncConnectionIssue), "10070" => Ok(Self::SyncConfirmErrorFromPh), "10071" => Ok(Self::SyncMsgTypeMissing), "10072" => Ok(Self::SyncMsgCodeMissing), "10073" => Ok(Self::SyncVersionMissing), "10074" => Ok(Self::SyncEncTypeMissing), "10075" => Ok(Self::SyncSignMissing), "10076" => Ok(Self::SyncInfoMissing), "10077" => Ok(Self::SyncErrorCodeMissing), "10078" => Ok(Self::SyncMsgTypeInvalid), "10079" => Ok(Self::SyncMsgCodeInvalid), "10080" => Ok(Self::SyncResponseSignNotMatch), "10081" => Ok(Self::AccountExpired), "10082" => Ok(Self::ExceedMaxMinAmount), "10083" => Ok(Self::WholeNumberAmountLessThanOne), "10084" => Ok(Self::AddDepositRecordToSchemeChannel), "10085" => Ok(Self::UpdateUtilizedAmountFailAfterSuccessResponse), "10086" => Ok(Self::PidResponseInvalidFormat), "10087" => Ok(Self::PspNameNotFound), "10088" => Ok(Self::LangIsMissing), "10089" => Ok(Self::FailureCallbackUrlInvalid), "10090" => Ok(Self::SuccessRedirectUrlInvalid), "10091" => Ok(Self::FailureRedirectUrlInvalid), "10092" => Ok(Self::LangValueInvalid), "10093" => Ok(Self::OnlineDepositSessionTimeout), "10094" => Ok(Self::AccessPaymentPageRouteFieldMissing), "10095" => Ok(Self::AmountNotMatch), "10096" => Ok(Self::PidCallbackFieldsMissing), "10097" => Ok(Self::TokenNotMatch), "10098" => Ok(Self::OperationDuplicated), "10099" => Ok(Self::PayPageDomainNotAvailable), "10100" => Ok(Self::PayPageConfirmSignatureNotMatch), "10101" => Ok(Self::PaymentPageConfirmationFieldMissing), "10102" => Ok(Self::MultipleCallbackFromPsp), "10103" => Ok(Self::PidNotAvailable), "10104" => Ok(Self::PidDepositUrlNotValidOrEmp), "10105" => Ok(Self::PspSelfRedirectTagNotValid), "20000" => Ok(Self::InternalError20000), "20001" => Ok(Self::DepositTimeout), _ => Err(errors::ConnectorError::ResponseHandlingFailed.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": 2661, "total_crates": null }
fn_clm_hyperswitch_connectors_get_status_7959583863945630763
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/zsl/transformers pub(crate) fn get_status(status: String) -> api_models::webhooks::IncomingWebhookEvent { match status.as_str() { //any response with status != 0 are a failed deposit transaction "0" => api_models::webhooks::IncomingWebhookEvent::PaymentIntentSuccess, _ => api_models::webhooks::IncomingWebhookEvent::PaymentIntentFailure, } }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 27, "total_crates": null }
fn_clm_hyperswitch_connectors_calculate_signature_7959583863945630763
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/zsl/transformers pub fn calculate_signature( enctype: EncodingType, signature_data: ZslSignatureType, ) -> Result<Secret<String>, error_stack::Report<errors::ConnectorError>> { let signature_data = match signature_data { ZslSignatureType::RequestSignature { txn_amt, ccy, mer_ref, mer_id, mer_txn_date, key, } => format!("{txn_amt}{ccy}{mer_ref}{mer_id}{mer_txn_date}{key}"), ZslSignatureType::ResponseSignature { status, txn_url, mer_ref, mer_id, key, } => { format!("{status}{txn_url}{mer_ref}{mer_id}{key}") } ZslSignatureType::WebhookSignature { status, txn_id, txn_date, paid_ccy, paid_amt, mer_ref, mer_id, key, } => format!("{status}{txn_id}{txn_date}{paid_ccy}{paid_amt}{mer_ref}{mer_id}{key}"), }; let message = signature_data.as_bytes(); let encoded_data = match enctype { EncodingType::MD5 => hex::encode( common_utils::crypto::Md5 .generate_digest(message) .change_context(errors::ConnectorError::RequestEncodingFailed)?, ), EncodingType::Sha1 => { hex::encode(digest::digest(&digest::SHA1_FOR_LEGACY_USE_ONLY, message)) } }; Ok(Secret::new(encoded_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": 27, "total_crates": null }
fn_clm_hyperswitch_connectors_try_from_1784917271221423779
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/iatapay/transformers // Implementation of IncomingWebhookEvent for TryFrom<IatapayWebhookResponse> fn try_from(payload: IatapayWebhookResponse) -> CustomResult<Self, errors::ConnectorError> { match payload { IatapayWebhookResponse::IatapayPaymentWebhookBody(wh_body) => match wh_body.status { IatapayWebhookStatus::Authorized | IatapayWebhookStatus::Settled => { Ok(Self::PaymentIntentSuccess) } IatapayWebhookStatus::Initiated => Ok(Self::PaymentIntentProcessing), IatapayWebhookStatus::Failed => Ok(Self::PaymentIntentFailure), IatapayWebhookStatus::Created | IatapayWebhookStatus::Cleared | IatapayWebhookStatus::Tobeinvestigated | IatapayWebhookStatus::Blocked | IatapayWebhookStatus::UnexpectedSettled | IatapayWebhookStatus::Unknown => Ok(Self::EventNotSupported), }, IatapayWebhookResponse::IatapayRefundWebhookBody(wh_body) => match wh_body.status { IatapayRefundWebhookStatus::Cleared | IatapayRefundWebhookStatus::Authorized | IatapayRefundWebhookStatus::Settled => Ok(Self::RefundSuccess), IatapayRefundWebhookStatus::Failed => Ok(Self::RefundFailure), IatapayRefundWebhookStatus::Created | IatapayRefundWebhookStatus::Locked | IatapayRefundWebhookStatus::Initiated | IatapayRefundWebhookStatus::Unknown => Ok(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": 2657, "total_crates": null }
fn_clm_hyperswitch_connectors_from_1784917271221423779
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/iatapay/transformers // Implementation of enums::RefundStatus for From<RefundStatus> fn from(item: RefundStatus) -> Self { match item { RefundStatus::Created => Self::Pending, RefundStatus::Failed => Self::Failure, RefundStatus::Locked => Self::Pending, RefundStatus::Initiated => Self::Pending, RefundStatus::Authorized => Self::Pending, RefundStatus::Settled => Self::Success, RefundStatus::Cleared => Self::Success, } }
{ "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_iatpay_response_1784917271221423779
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/iatapay/transformers fn get_iatpay_response( response: IatapayPaymentsResponse, status_code: u16, ) -> CustomResult< ( enums::AttemptStatus, Option<ErrorResponse>, PaymentsResponseData, ), errors::ConnectorError, > { let status = enums::AttemptStatus::from(response.status); let error = if is_payment_failure(status) { Some(ErrorResponse { code: response .failure_code .unwrap_or_else(|| NO_ERROR_CODE.to_string()), message: response .failure_details .clone() .unwrap_or_else(|| NO_ERROR_MESSAGE.to_string()), reason: response.failure_details, status_code, attempt_status: Some(status), connector_transaction_id: response.iata_payment_id.clone(), network_advice_code: None, network_decline_code: None, network_error_message: None, connector_metadata: None, }) } else { None }; let form_fields = HashMap::new(); let id = match response.iata_payment_id.clone() { Some(s) => ResponseId::ConnectorTransactionId(s), None => ResponseId::NoResponseId, }; let connector_response_reference_id = response.merchant_payment_id.or(response.iata_payment_id); let payment_response_data = match response.checkout_methods { Some(checkout_methods) => { let (connector_metadata, redirection_data) = match checkout_methods.redirect.redirect_url.ends_with("qr") { true => { let qr_code_info = api_models::payments::FetchQrCodeInformation { qr_code_fetch_url: url::Url::parse( &checkout_methods.redirect.redirect_url, ) .change_context(errors::ConnectorError::ResponseHandlingFailed)?, }; ( Some(qr_code_info.encode_to_value()) .transpose() .change_context(errors::ConnectorError::ResponseHandlingFailed)?, None, ) } false => ( None, Some(RedirectForm::Form { endpoint: checkout_methods.redirect.redirect_url, method: Method::Get, form_fields, }), ), }; PaymentsResponseData::TransactionResponse { resource_id: id, redirection_data: Box::new(redirection_data), mandate_reference: Box::new(None), connector_metadata, network_txn_id: None, connector_response_reference_id: connector_response_reference_id.clone(), incremental_authorization_allowed: None, charges: None, } } None => PaymentsResponseData::TransactionResponse { resource_id: id.clone(), redirection_data: Box::new(None), mandate_reference: Box::new(None), connector_metadata: None, network_txn_id: None, connector_response_reference_id: connector_response_reference_id.clone(), 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": 50, "total_crates": null }
fn_clm_hyperswitch_connectors_get_redirect_url_1784917271221423779
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/iatapay/transformers fn get_redirect_url(return_url: String) -> RedirectUrls { RedirectUrls { success_url: return_url.clone(), failure_url: return_url, } }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 5, "total_crates": null }
fn_clm_hyperswitch_connectors_try_from_1962064001865084087
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/square/transformers // Implementation of types::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.refund.id, refund_status: enums::RefundStatus::from(item.response.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": 2659, "total_crates": null }
fn_clm_hyperswitch_connectors_from_1962064001865084087
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/square/transformers // Implementation of IncomingWebhookEvent for From<SquareWebhookObject> fn from(item: SquareWebhookObject) -> Self { match item { SquareWebhookObject::Payment(payment_data) => match payment_data.status { SquarePaymentStatus::Completed => Self::PaymentIntentSuccess, SquarePaymentStatus::Failed => Self::PaymentIntentFailure, SquarePaymentStatus::Pending => Self::PaymentIntentProcessing, SquarePaymentStatus::Approved | SquarePaymentStatus::Canceled => { Self::EventNotSupported } }, SquareWebhookObject::Refund(refund_data) => match refund_data.status { RefundStatus::Completed => Self::RefundSuccess, RefundStatus::Failed | RefundStatus::Rejected => Self::RefundFailure, RefundStatus::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_try_from_2563518058797483625
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/payone/transformers // Implementation of PayoutsRouterData<F> for TryFrom<PayoutsResponseRouterData<F, PayonePayoutFulfillResponse>> fn try_from( item: PayoutsResponseRouterData<F, PayonePayoutFulfillResponse>, ) -> Result<Self, Self::Error> { let response: PayonePayoutFulfillResponse = item.response; Ok(Self { response: Ok(PayoutsResponseData { status: Some(PayoutStatus::foreign_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_2563518058797483625
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/payone/transformers // Implementation of ErrorCodeAndMessage for From<SubError> fn from(error: SubError) -> Self { Self { error_code: error.code.to_string(), error_message: error.code.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_from_2563518058797483625
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/payone/transformers // Implementation of PayoutStatus for ForeignFrom<PayoneStatus> fn foreign_from(payone_status: PayoneStatus) -> Self { match payone_status { PayoneStatus::AccountCredited => Self::Success, PayoneStatus::RejectedCredit | PayoneStatus::Rejected => Self::Failed, PayoneStatus::Cancelled | PayoneStatus::Reversed => Self::Cancelled, PayoneStatus::Created | PayoneStatus::PendingApproval | PayoneStatus::PayoutRequested => 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": 212, "total_crates": null }
fn_clm_hyperswitch_connectors_try_from_1723027322584682625
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/worldpayvantiv/transformers // Implementation of RouterData<Retrieve, RetrieveFileRequestData, RetrieveFileResponse> for TryFrom< ResponseRouterData< Retrieve, ChargebackDocumentUploadResponse, RetrieveFileRequestData, RetrieveFileResponse, >, > fn try_from( item: ResponseRouterData< Retrieve, ChargebackDocumentUploadResponse, RetrieveFileRequestData, RetrieveFileResponse, >, ) -> Result<Self, Self::Error> { Ok(RetrieveFileRouterData { response: Err(ErrorResponse { code: item.response.response_code.to_string(), message: item.response.response_message.clone(), reason: Some(item.response.response_message.clone()), status_code: item.http_code, attempt_status: None, connector_transaction_id: None, network_advice_code: None, network_decline_code: None, network_error_message: None, connector_metadata: None, }), ..item.data.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": 2665, "total_crates": null }
fn_clm_hyperswitch_connectors_from_1723027322584682625
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/worldpayvantiv/transformers // Implementation of ChargebackUpdateRequest for From<&AcceptDisputeRouterData> fn from(_item: &AcceptDisputeRouterData) -> Self { Self { xmlns: worldpayvantiv_constants::XML_CHARGEBACK.to_string(), activity_type: ActivityType::MerchantAcceptsLiability, } }
{ "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_vantiv_card_data_1723027322584682625
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/worldpayvantiv/transformers fn get_vantiv_card_data( payment_method_data: &PaymentMethodData, payment_method_token: Option<hyperswitch_domain_models::router_data::PaymentMethodToken>, ) -> Result< ( Option<WorldpayvantivCardData>, Option<CardholderAuthentication>, ), error_stack::Report<errors::ConnectorError>, > { match payment_method_data { PaymentMethodData::Card(card) => { let card_type = match card.card_network.clone() { Some(card_type) => WorldpayvativCardType::try_from(card_type)?, None => WorldpayvativCardType::try_from(&card.get_card_issuer()?)?, }; let exp_date = card.get_expiry_date_as_mmyy()?; Ok(( Some(WorldpayvantivCardData { card_type, number: card.card_number.clone(), exp_date, card_validation_num: Some(card.card_cvc.clone()), }), None, )) } PaymentMethodData::CardDetailsForNetworkTransactionId(card_data) => { let card_type = match card_data.card_network.clone() { Some(card_type) => WorldpayvativCardType::try_from(card_type)?, None => WorldpayvativCardType::try_from(&card_data.get_card_issuer()?)?, }; let exp_date = card_data.get_expiry_date_as_mmyy()?; Ok(( Some(WorldpayvantivCardData { card_type, number: card_data.card_number.clone(), exp_date, card_validation_num: None, }), None, )) } PaymentMethodData::MandatePayment => Ok((None, None)), PaymentMethodData::Wallet(wallet_data) => match wallet_data { hyperswitch_domain_models::payment_method_data::WalletData::ApplePay( apple_pay_data, ) => match payment_method_token.clone() { Some( hyperswitch_domain_models::router_data::PaymentMethodToken::ApplePayDecrypt( apple_pay_decrypted_data, ), ) => { let number = apple_pay_decrypted_data .application_primary_account_number .clone(); let exp_date = apple_pay_decrypted_data .get_expiry_date_as_mmyy() .change_context(errors::ConnectorError::InvalidDataFormat { field_name: "payment_method_data.card.card_exp_month", })?; let cardholder_authentication = CardholderAuthentication { authentication_value: apple_pay_decrypted_data .payment_data .online_payment_cryptogram .clone(), }; let apple_pay_network = apple_pay_data .payment_method .network .parse::<WorldPayVativApplePayNetwork>() .map_err(|_| { error_stack::Report::new(errors::ConnectorError::NotSupported { message: format!( "Invalid Apple Pay network '{}'. Supported networks: Visa,MasterCard,AmEx,Discover,DinersClub,JCB,UnionPay", apple_pay_data.payment_method.network ), connector: "worldpay_vativ" }) })?; Ok(( (Some(WorldpayvantivCardData { card_type: apple_pay_network.into(), number, exp_date, card_validation_num: None, })), Some(cardholder_authentication), )) } _ => Err( errors::ConnectorError::NotImplemented("Payment method type".to_string()) .into(), ), }, hyperswitch_domain_models::payment_method_data::WalletData::GooglePay( google_pay_data, ) => match payment_method_token.clone() { Some( hyperswitch_domain_models::router_data::PaymentMethodToken::GooglePayDecrypt( google_pay_decrypted_data, ), ) => { let number = google_pay_decrypted_data .application_primary_account_number .clone(); let exp_date = google_pay_decrypted_data .get_expiry_date_as_mmyy() .change_context(errors::ConnectorError::InvalidDataFormat { field_name: "payment_method_data.card.card_exp_month", })?; let cardholder_authentication = CardholderAuthentication { authentication_value: google_pay_decrypted_data .cryptogram .clone() .ok_or_else(|| errors::ConnectorError::MissingRequiredField { field_name: "cryptogram", })?, }; let google_pay_network = google_pay_data .info .card_network .parse::<WorldPayVativGooglePayNetwork>() .map_err(|_| { error_stack::Report::new(errors::ConnectorError::NotSupported { message: format!( "Invalid Google Pay card network '{}'. Supported networks: VISA, MASTERCARD, AMEX, DISCOVER, JCB, UNIONPAY", google_pay_data.info.card_network ), connector: "worldpay_vativ" }) })?; Ok(( (Some(WorldpayvantivCardData { card_type: google_pay_network.into(), number, exp_date, card_validation_num: None, })), Some(cardholder_authentication), )) } _ => { Err(errors::ConnectorError::NotImplemented("Payment method".to_string()).into()) } }, _ => Err(errors::ConnectorError::NotImplemented("Payment method".to_string()).into()), }, _ => 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": 84, "total_crates": null }
fn_clm_hyperswitch_connectors_get_enhanced_data_1723027322584682625
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/worldpayvantiv/transformers fn get_enhanced_data<T>( item: &T, ) -> Result<Option<EnhancedData>, error_stack::Report<errors::ConnectorError>> where T: UtilsRouterData, { let l2_l3_data = item.get_optional_l2_l3_data(); if let Some(l2_l3_data) = l2_l3_data { let line_item_data = l2_l3_data.order_details.as_ref().map(|order_details| { order_details .iter() .enumerate() .map(|(i, order)| LineItemData { item_sequence_number: Some((i + 1).to_string()), item_description: order .description .as_ref() .map(|desc| desc.chars().take(19).collect::<String>()), product_code: order.product_id.clone(), quantity: Some(order.quantity.to_string().clone()), unit_of_measure: order.unit_of_measure.clone(), tax_amount: order.total_tax_amount, line_item_total: Some(order.amount), line_item_total_with_tax: order.total_tax_amount.map(|tax| tax + order.amount), item_discount_amount: order.unit_discount_amount, commodity_code: order.commodity_code.clone(), unit_cost: Some(order.amount), }) .collect() }); let tax_exempt = match l2_l3_data.tax_status { Some(common_enums::TaxStatus::Exempt) => Some(true), Some(common_enums::TaxStatus::Taxable) => Some(false), None => None, }; let customer_reference = get_vantiv_customer_reference(&l2_l3_data.merchant_order_reference_id); let detail_tax: Option<DetailTax> = if l2_l3_data.merchant_tax_registration_id.is_some() && l2_l3_data.order_details.is_some() { Some(DetailTax { tax_included_in_total: match tax_exempt { Some(false) => Some(true), Some(true) | None => Some(false), }, card_acceptor_tax_id: l2_l3_data.merchant_tax_registration_id.clone(), tax_amount: l2_l3_data.order_details.as_ref().map(|orders| { orders .iter() .filter_map(|order| order.total_tax_amount) .fold(MinorUnit::zero(), |acc, tax| acc + tax) }), }) } else { None }; let enhanced_data = EnhancedData { customer_reference, sales_tax: l2_l3_data.order_tax_amount, tax_exempt, discount_amount: l2_l3_data.discount_amount, shipping_amount: l2_l3_data.shipping_cost, duty_amount: l2_l3_data.duty_amount, ship_from_postal_code: l2_l3_data.get_shipping_origin_zip(), destination_postal_code: l2_l3_data.get_shipping_zip(), destination_country_code: l2_l3_data.get_shipping_country(), detail_tax, line_item_data, }; Ok(Some(enhanced_data)) } else { Ok(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": 62, "total_crates": null }
fn_clm_hyperswitch_connectors_get_dispute_status_1723027322584682625
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/worldpayvantiv/transformers pub fn get_dispute_status( dispute_cycle: String, dispute_activities: Vec<Activity>, ) -> Result<common_enums::DisputeStatus, error_stack::Report<errors::ConnectorError>> { if let Some(activity) = get_last_non_auxiliary_activity_type(dispute_activities) { match activity.as_ref() { "Merchant Accept" | "Issuer Accepted Pre-Arbitration" | "Vantiv Accept" | "Sent Credit" => Ok(common_enums::DisputeStatus::DisputeAccepted), "Merchant Represent" | "Respond to Dispute" | "Respond to PreArb" | "Request Arbitration" | "Request Pre-Arbitration" | "Create Arbitration" | "Record Arbitration" | "Create Pre-Arbitration" | "File Arbitration" | "File Pre-Arbitration" | "File Visa Pre-Arbitration" | "Send Representment" | "Send Response" | "Arbitration" | "Arbitration (Mastercard)" | "Arbitration Chargeback" | "Issuer Declined Pre-Arbitration" | "Issuer Arbitration" | "Request Response to Pre-Arbitration" | "Vantiv Represent" | "Vantiv Respond" | "Auto Represent" | "Arbitration Ruling" => Ok(common_enums::DisputeStatus::DisputeChallenged), "Arbitration Lost" | "Unsuccessful Arbitration" | "Unsuccessful Pre-Arbitration" => { Ok(common_enums::DisputeStatus::DisputeLost) } "Arbitration Won" | "Arbitration Split" | "Successful Arbitration" | "Successful Pre-Arbitration" => Ok(common_enums::DisputeStatus::DisputeWon), "Chargeback Reversal" => Ok(common_enums::DisputeStatus::DisputeCancelled), "Receive Network Transaction" => Ok(common_enums::DisputeStatus::DisputeOpened), "Unaccept" | "Unrepresent" => Ok(common_enums::DisputeStatus::DisputeOpened), unexpected_activity => Err(errors::ConnectorError::UnexpectedResponseError( bytes::Bytes::from(format!("Dispute Activity: {unexpected_activity})")), ) .into()), } } else { match connector_utils::normalize_string(dispute_cycle.clone()) .change_context(errors::ConnectorError::RequestEncodingFailed)? .as_str() { "arbitration" | "arbitrationmastercard" | "arbitrationsplit" | "representment" | "issuerarbitration" | "prearbitration" | "responsetoissuerarbitration" | "arbitrationchargeback" => Ok(api_models::enums::DisputeStatus::DisputeChallenged), "chargebackreversal" | "issueracceptedprearbitration" | "arbitrationwon" => { Ok(api_models::enums::DisputeStatus::DisputeWon) } "arbitrationlost" | "issuerdeclinedprearbitration" => { Ok(api_models::enums::DisputeStatus::DisputeLost) } "firstchargeback" | "retrievalrequest" | "rapiddisputeresolution" => { Ok(api_models::enums::DisputeStatus::DisputeOpened) } dispute_cycle => Err(errors::ConnectorError::UnexpectedResponseError( bytes::Bytes::from(format!("Dispute Stage: {dispute_cycle}")), ) .into()), } } }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 34, "total_crates": null }
fn_clm_hyperswitch_connectors_try_from_-3641347251989984912
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/opayo/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_-3641347251989984912
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/opayo/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_4678807260941715594
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/gpayments/transformers // Implementation of PreAuthNRouterData for TryFrom< ResponseRouterData< PreAuthentication, gpayments_types::GpaymentsPreAuthenticationResponse, PreAuthNRequestData, AuthenticationResponseData, >, > fn try_from( item: ResponseRouterData< PreAuthentication, gpayments_types::GpaymentsPreAuthenticationResponse, PreAuthNRequestData, AuthenticationResponseData, >, ) -> Result<Self, Self::Error> { let threeds_method_response = item.response; let three_ds_method_data = threeds_method_response .three_ds_method_url .as_ref() .map(|_| { let three_ds_method_data_json = serde_json::json!({ "threeDSServerTransID": threeds_method_response.three_ds_server_trans_id, "threeDSMethodNotificationURL": "https://webhook.site/bd06863d-82c2-42ea-b35b-5ffd5ecece71" }); to_string(&three_ds_method_data_json) .change_context(ConnectorError::ResponseDeserializationFailed) .attach_printable("error while constructing three_ds_method_data_str") .map(|three_ds_method_data_string| { Engine::encode(&BASE64_ENGINE, three_ds_method_data_string) }) }) .transpose()?; let connector_metadata = Some(serde_json::json!( gpayments_types::GpaymentsConnectorMetaData { authentication_url: threeds_method_response.auth_url, three_ds_requestor_trans_id: None, } )); let response: Result<AuthenticationResponseData, ErrorResponse> = Ok( AuthenticationResponseData::PreAuthThreeDsMethodCallResponse { threeds_server_transaction_id: threeds_method_response .three_ds_server_trans_id .clone(), three_ds_method_data, three_ds_method_url: threeds_method_response.three_ds_method_url, connector_metadata, }, ); Ok(Self { response, ..item.data.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": 2677, "total_crates": null }
fn_clm_hyperswitch_connectors_from_4678807260941715594
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/gpayments/transformers // Implementation of GpaymentsRouterData<T> for From<(MinorUnit, T)> fn from((amount, item): (MinorUnit, 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_from_3637800210030207808
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/gpayments/gpayments_types // Implementation of common_enums::TransactionStatus for From<AuthStatus> fn from(value: AuthStatus) -> Self { match value { AuthStatus::Y => Self::Success, AuthStatus::N => Self::Failure, AuthStatus::U => Self::VerificationNotPerformed, AuthStatus::A => Self::NotVerified, AuthStatus::R => Self::Rejected, AuthStatus::C => Self::ChallengeRequired, } }
{ "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_8964714542231434193
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/authorizedotnet/transformers // Implementation of CancelOrCaptureTransactionRequest for TryFrom<&AuthorizedotnetRouterData<&PaymentsCaptureRouterData>> fn try_from( item: &AuthorizedotnetRouterData<&PaymentsCaptureRouterData>, ) -> Result<Self, Self::Error> { let transaction_request = TransactionVoidOrCaptureRequest { amount: Some(item.amount), transaction_type: TransactionType::Capture, ref_trans_id: item .router_data .request .connector_transaction_id .to_string(), }; let merchant_authentication = AuthorizedotnetAuthType::try_from(&item.router_data.connector_auth_type)?; Ok(Self { create_transaction_request: AuthorizedotnetPaymentCancelOrCaptureRequest { merchant_authentication, transaction_request, }, }) }
{ "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_8964714542231434193
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/authorizedotnet/transformers // Implementation of enums::AttemptStatus for From<AuthorizedotnetVoidStatus> fn from(item: AuthorizedotnetVoidStatus) -> Self { match item { AuthorizedotnetVoidStatus::Approved => Self::Voided, AuthorizedotnetVoidStatus::Declined | AuthorizedotnetVoidStatus::Error => { Self::VoidFailed } AuthorizedotnetVoidStatus::HeldForReview => Self::VoidInitiated, } }
{ "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_8964714542231434193
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/authorizedotnet/transformers // Implementation of Vec<UserField> for ForeignTryFrom<Value> fn foreign_try_from(metadata: Value) -> Result<Self, Self::Error> { let hashmap: BTreeMap<String, Value> = serde_json::from_str(&metadata.to_string()) .change_context(errors::ConnectorError::RequestEncodingFailedWithReason( "Failed to serialize request metadata".to_owned(), )) .attach_printable("")?; let mut vector: Self = Self::new(); for (key, value) in hashmap { vector.push(UserField { name: key, value: value.to_string(), }); } Ok(vector) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 446, "total_crates": null }
fn_clm_hyperswitch_connectors_reign_try_from( _8964714542231434193
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/authorizedotnet/transformers // Implementation of uterData<F, T, PaymentsResponseData> { for reignTryFrom<( ResponseRouterData<F, AuthorizedotnetPaymentsResponse, T, PaymentsResponseData>, bool, )> f foreign_try_from( (item, is_auto_capture): ( ResponseRouterData<F, AuthorizedotnetPaymentsResponse, T, PaymentsResponseData>, bool, ), ) -> Result<Self, Self::Error> { match &item.response.transaction_response { Some(TransactionResponse::AuthorizedotnetTransactionResponse(transaction_response)) => { let status = get_payment_status(( transaction_response.response_code.clone(), is_auto_capture, )); let error = transaction_response.errors.as_ref().and_then(|errors| { errors.iter().next().map(|error| ErrorResponse { code: error.error_code.clone(), message: error.error_text.clone(), reason: Some(error.error_text.clone()), status_code: item.http_code, attempt_status: None, connector_transaction_id: Some(transaction_response.transaction_id.clone()), network_advice_code: None, network_decline_code: None, network_error_message: None, connector_metadata: None, }) }); let metadata = transaction_response .account_number .as_ref() .map(|acc_no| { construct_refund_payment_details(PaymentDetailAccountNumber::Masked( acc_no.clone().expose(), )) .encode_to_value() }) .transpose() .change_context(errors::ConnectorError::MissingRequiredField { field_name: "connector_metadata", })?; let connector_response_data = convert_to_additional_payment_method_connector_response(transaction_response) .map(ConnectorResponseData::with_additional_payment_method_data); let url = transaction_response .secure_acceptance .as_ref() .and_then(|x| x.secure_acceptance_url.to_owned()); let redirection_data = url.map(|url| RedirectForm::from((url, Method::Get))); let mandate_reference = item.response.profile_response.map(|profile_response| { let payment_profile_id = profile_response .customer_payment_profile_id_list .and_then(|customer_payment_profile_id_list| { customer_payment_profile_id_list.first().cloned() }); MandateReference { connector_mandate_id: profile_response.customer_profile_id.and_then( |customer_profile_id| { payment_profile_id.map(|payment_profile_id| { format!("{customer_profile_id}-{payment_profile_id}") }) }, ), payment_method_id: None, mandate_metadata: None, connector_mandate_request_reference_id: None, } }); Ok(Self { status, response: match error { Some(err) => Err(err), None => Ok(PaymentsResponseData::TransactionResponse { resource_id: ResponseId::ConnectorTransactionId( transaction_response.transaction_id.clone(), ), redirection_data: Box::new(redirection_data), mandate_reference: Box::new(mandate_reference), connector_metadata: metadata, network_txn_id: transaction_response .network_trans_id .clone() .map(|network_trans_id| network_trans_id.expose()), connector_response_reference_id: Some( transaction_response.transaction_id.clone(), ), incremental_authorization_allowed: None, charges: None, }), }, connector_response: connector_response_data, ..item.data }) } Some(TransactionResponse::AuthorizedotnetTransactionResponseError(_)) | None => { Ok(Self { status: enums::AttemptStatus::Failure, response: Err(get_err_response(item.http_code, item.response.messages)?), ..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": 108, "total_crates": null }
fn_clm_hyperswitch_connectors_y_from( _8964714542231434193
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/authorizedotnet/transformers // Implementation of ypalConfirmRequest { for yFrom<&AuthorizedotnetRouterData<&PaymentsCompleteAuthorizeRouterData>> try_from( item: &AuthorizedotnetRouterData<&PaymentsCompleteAuthorizeRouterData>, ) -> Result<Self, Self::Error> { let params = item .router_data .request .redirect_response .as_ref() .and_then(|redirect_response| redirect_response.params.as_ref()) .ok_or(errors::ConnectorError::ResponseDeserializationFailed)?; let query_params: PaypalQueryParams = serde_urlencoded::from_str(params.peek()) .change_context(errors::ConnectorError::ResponseDeserializationFailed) .attach_printable("Failed to parse connector response")?; let payer_id = query_params.payer_id; let transaction_type = match item.router_data.request.capture_method { Some(enums::CaptureMethod::Manual) => Ok(TransactionType::ContinueAuthorization), Some(enums::CaptureMethod::SequentialAutomatic) | Some(enums::CaptureMethod::Automatic) | None => Ok(TransactionType::ContinueCapture), Some(enums::CaptureMethod::ManualMultiple) => { Err(errors::ConnectorError::NotSupported { message: enums::CaptureMethod::ManualMultiple.to_string(), connector: "authorizedotnet", }) } Some(enums::CaptureMethod::Scheduled) => Err(errors::ConnectorError::NotSupported { message: enums::CaptureMethod::Scheduled.to_string(), connector: "authorizedotnet", }), }?; let transaction_request = TransactionConfirmRequest { transaction_type, payment: PaypalPaymentConfirm { pay_pal: Paypal { payer_id }, }, ref_trans_id: item.router_data.request.connector_transaction_id.clone(), }; let merchant_authentication = AuthorizedotnetAuthType::try_from(&item.router_data.connector_auth_type)?; Ok(Self { create_transaction_request: PaypalConfirmTransactionRequest { merchant_authentication, transaction_request, }, }) } }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 42, "total_crates": null }
fn_clm_hyperswitch_connectors_try_from_4446831899238177156
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/archipel/transformers // Implementation of ArchipelCard for TryFrom<(Option<Secret<String>>, Option<ArchipelCardHolder>, &Card)> fn try_from( (card_holder_name, card_holder_billing, ccard): ( Option<Secret<String>>, Option<ArchipelCardHolder>, &Card, ), ) -> Result<Self, Self::Error> { // NOTE: Archipel does not accept `card.card_holder_name` field without `cardholder` field. // So if `card_holder` is None, `card.card_holder_name` must also be None. // However, the reverse is allowed — the `cardholder` field can exist without `card.card_holder_name`. let card_holder_name = card_holder_billing .as_ref() .and_then(|_| ccard.card_holder_name.clone().or(card_holder_name.clone())); let scheme: ArchipelCardScheme = ccard.get_card_issuer().ok().into(); Ok(Self { number: ccard.card_number.clone(), expiry: CardExpiryDate { month: ccard.card_exp_month.clone(), year: ccard.get_card_expiry_year_2_digit()?, }, security_code: Some(ccard.card_cvc.clone()), application_selection_indicator: ApplicationSelectionIndicator::ByDefault, card_holder_name, scheme, }) } }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 2685, "total_crates": null }
fn_clm_hyperswitch_connectors_from_4446831899238177156
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/archipel/transformers // Implementation of ArchipelCardHolder for From<Option<ArchipelBillingAddress>> fn from(value: Option<ArchipelBillingAddress>) -> Self { Self { billing_address: 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": 2600, "total_crates": null }
fn_clm_hyperswitch_connectors_ _4446831899238177156
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/archipel/transformers // Implementation of ponse { f for hipelErrorMessageWithHttpCode> for Err ArchipelErrorMessageWithHttpCode { error_message, http_code, }: ArchipelErrorMessageWithHttpCode, ) -> Self { Self { status_code: http_code, code: error_message.code, attempt_status: None, connector_transaction_id: None, message: error_message .description .clone() .unwrap_or(consts::NO_ERROR_MESSAGE.to_string()), reason: error_message.description, 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": 164, "total_crates": null }
fn_clm_hyperswitch_connectors_from( _4446831899238177156
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/archipel/transformers // Implementation of ipelPaymentInformation { for rom<(MinorUnit, &PaymentsAuthorizeRouterData)> for ry_from( (amount, router_data): (MinorUnit, &PaymentsAuthorizeRouterData), ) -> Result<Self, Self::Error> { let is_recurring_payment = router_data .request .mandate_id .as_ref() .and_then(|mandate_ids| mandate_ids.mandate_id.as_ref()) .is_some(); let is_subsequent_trx = router_data .request .mandate_id .as_ref() .and_then(|mandate_ids| mandate_ids.mandate_reference_id.as_ref()) .is_some(); let is_saved_card_payment = (router_data.request.is_mandate_payment()) | (router_data.request.setup_future_usage == Some(FutureUsage::OnSession)) | (router_data.payment_method_status == Some(PaymentMethodStatus::Active)); let certainty = if router_data.request.request_incremental_authorization { if is_recurring_payment { ArchipelPaymentCertainty::Final } else { ArchipelPaymentCertainty::Estimated } } else { ArchipelPaymentCertainty::Final }; let transaction_initiator = if is_recurring_payment { ArchipelPaymentInitiator::Merchant } else { ArchipelPaymentInitiator::Customer }; let order = ArchipelOrderRequest { amount, currency: router_data.request.currency.to_string(), certainty, initiator: transaction_initiator.clone(), }; let cardholder = router_data .get_billing_address() .ok() .and_then(|address| address.to_archipel_billing_address()) .map(|billing_address| ArchipelCardHolder { billing_address: Some(billing_address), }); // NOTE: Archipel does not accept `card.card_holder_name` field without `cardholder` field. // So if `card_holder` is None, `card.card_holder_name` must also be None. // However, the reverse is allowed — the `cardholder` field can exist without `card.card_holder_name`. let card_holder_name = cardholder.as_ref().and_then(|_| { router_data .get_billing() .ok() .and_then(|billing| billing.get_optional_full_name()) }); let indicator_status = if is_subsequent_trx { ArchipelCredentialIndicatorStatus::Subsequent } else { ArchipelCredentialIndicatorStatus::Initial }; let stored_on_file = is_saved_card_payment | router_data.request.is_customer_initiated_mandate_payment(); let credential_indicator = stored_on_file.then(|| ArchipelCredentialIndicator { status: indicator_status.clone(), recurring: Some(is_recurring_payment), transaction_id: match indicator_status { ArchipelCredentialIndicatorStatus::Initial => None, ArchipelCredentialIndicatorStatus::Subsequent => { router_data.request.get_optional_network_transaction_id() } }, }); Ok(Self { order, cardholder, card_holder_name, credential_indicator, stored_on_file, }) } } 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": 70, "total_crates": null }
fn_clm_hyperswitch_connectors_err_4446831899238177156
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/archipel/transformers // Inherent implementation for ipelErrorMessageWithHttpCode { ew(error_message: ArchipelErrorMessage, http_code: u16) -> Self { Self { error_message, http_code, } } }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 53, "total_crates": null }
fn_clm_hyperswitch_connectors_try_from_-3129571917591910516
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/payload/transformers // Implementation of RefundsRouterData<RSync> for TryFrom<RefundsResponseRouterData<RSync, responses::PayloadRefundResponse>> fn try_from( item: RefundsResponseRouterData<RSync, responses::PayloadRefundResponse>, ) -> Result<Self, Self::Error> { Ok(Self { response: Ok(RefundsResponseData { connector_refund_id: item.response.transaction_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_-3129571917591910516
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/payload/transformers // Implementation of IncomingWebhookEvent for From<responses::PayloadWebhooksTrigger> fn from(trigger: responses::PayloadWebhooksTrigger) -> Self { match trigger { // Payment Success Events responses::PayloadWebhooksTrigger::Processed => Self::PaymentIntentSuccess, responses::PayloadWebhooksTrigger::Authorized => { Self::PaymentIntentAuthorizationSuccess } // Payment Processing Events responses::PayloadWebhooksTrigger::Payment | responses::PayloadWebhooksTrigger::AutomaticPayment => Self::PaymentIntentProcessing, // Payment Failure Events responses::PayloadWebhooksTrigger::Decline | responses::PayloadWebhooksTrigger::Reject | responses::PayloadWebhooksTrigger::BankAccountReject => Self::PaymentIntentFailure, responses::PayloadWebhooksTrigger::Void | responses::PayloadWebhooksTrigger::Reversal => Self::PaymentIntentCancelled, // Refund Events responses::PayloadWebhooksTrigger::Refund => Self::RefundSuccess, // Dispute Events responses::PayloadWebhooksTrigger::Chargeback => Self::DisputeOpened, responses::PayloadWebhooksTrigger::ChargebackReversal => Self::DisputeWon, // Other payment-related events // Events not supported by our standard flows responses::PayloadWebhooksTrigger::PaymentActivationStatus | responses::PayloadWebhooksTrigger::Credit | responses::PayloadWebhooksTrigger::Deposit | responses::PayloadWebhooksTrigger::PaymentLinkStatus | responses::PayloadWebhooksTrigger::ProcessingStatus | responses::PayloadWebhooksTrigger::TransactionOperation | responses::PayloadWebhooksTrigger::TransactionOperationClear => { 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_build_payload_cards_request_data_-3129571917591910516
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/payload/transformers fn build_payload_cards_request_data( payment_method_data: &PaymentMethodData, connector_auth_type: &ConnectorAuthType, currency: enums::Currency, amount: StringMajorUnit, billing_address: &AddressDetails, capture_method: Option<enums::CaptureMethod>, is_mandate: bool, ) -> Result<requests::PayloadCardsRequestData, Error> { if let PaymentMethodData::Card(req_card) = payment_method_data { let payload_auth = PayloadAuth::try_from((connector_auth_type, currency))?; let card = requests::PayloadCard { number: req_card.clone().card_number, expiry: req_card .clone() .get_card_expiry_month_year_2_digit_with_delimiter("/".to_owned())?, cvc: req_card.card_cvc.clone(), }; let city = billing_address.get_city()?.to_owned(); let country = billing_address.get_country()?.to_owned(); let postal_code = billing_address.get_zip()?.to_owned(); let state_province = billing_address.get_state()?.to_owned(); let street_address = billing_address.get_line1()?.to_owned(); let billing_address = requests::BillingAddress { city, country, postal_code, state_province, street_address, }; // For manual capture, set status to "authorized" let status = if is_manual_capture(capture_method) { Some(responses::PayloadPaymentStatus::Authorized) } else { None }; Ok(requests::PayloadCardsRequestData { amount, card, transaction_types: requests::TransactionTypes::Payment, payment_method_type: "card".to_string(), status, billing_address, processing_id: payload_auth.processing_account_id, keep_active: is_mandate, }) } else { Err( errors::ConnectorError::NotImplemented(get_unimplemented_payment_method_error_message( "Payload", )) .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": 42, "total_crates": null }
fn_clm_hyperswitch_connectors_try_from_1097660557368563565
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/wellsfargopayout/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_1097660557368563565
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/wellsfargopayout/transformers // Implementation of RefundStatus for From<WellsfargopayoutRefundStatus> fn from(item: WellsfargopayoutRefundStatus) -> Self { match item { WellsfargopayoutRefundStatus::Succeeded => Self::Success, WellsfargopayoutRefundStatus::Failed => Self::Failure, WellsfargopayoutRefundStatus::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_-43422292295708445
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/globepay/transformers // Implementation of RefundsRouterData<T> for TryFrom<RefundsResponseRouterData<T, GlobepayRefundResponse>> fn try_from( item: RefundsResponseRouterData<T, GlobepayRefundResponse>, ) -> Result<Self, Self::Error> { if item.response.return_code == GlobepayReturnCode::Success { let globepay_refund_id = item .response .refund_id .ok_or(errors::ConnectorError::ResponseHandlingFailed)?; let globepay_refund_status = item .response .result_code .ok_or(errors::ConnectorError::ResponseHandlingFailed)?; Ok(Self { response: Ok(RefundsResponseData { connector_refund_id: globepay_refund_id, refund_status: enums::RefundStatus::from(globepay_refund_status), }), ..item.data }) } else { Ok(Self { response: Err(get_error_response( item.response.return_code, item.response.return_msg, item.http_code, )), ..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_-43422292295708445
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/globepay/transformers // Implementation of enums::RefundStatus for From<GlobepayRefundStatus> fn from(item: GlobepayRefundStatus) -> Self { match item { GlobepayRefundStatus::Finished => Self::Success, //FINISHED: Refund success(funds has already been returned to user's account) GlobepayRefundStatus::Failed | GlobepayRefundStatus::CreateFailed | GlobepayRefundStatus::Change => Self::Failure, //CHANGE: Refund can not return to user's account. Manual operation is required GlobepayRefundStatus::Waiting | GlobepayRefundStatus::Success => Self::Pending, // SUCCESS: Submission succeeded, but refund is not yet complete. Waiting = Submission succeeded, but refund is not yet complete. } }
{ "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_-43422292295708445
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/globepay/transformers fn get_error_response( return_code: GlobepayReturnCode, return_msg: Option<String>, status_code: u16, ) -> ErrorResponse { ErrorResponse { code: return_code.to_string(), message: consts::NO_ERROR_MESSAGE.to_string(), reason: return_msg, status_code, attempt_status: None, connector_transaction_id: None, network_advice_code: None, network_decline_code: None, network_error_message: None, connector_metadata: None, } }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 55, "total_crates": null }
fn_clm_hyperswitch_connectors_try_from_-76852081183156603
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/forte/transformers // Implementation of types::RefundsRouterData<RSync> for TryFrom<RefundsResponseRouterData<RSync, RefundSyncResponse>> fn try_from( item: RefundsResponseRouterData<RSync, RefundSyncResponse>, ) -> Result<Self, Self::Error> { Ok(Self { response: Ok(RefundsResponseData { connector_refund_id: item.response.transaction_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_-76852081183156603
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/forte/transformers // Implementation of enums::RefundStatus for From<ForteResponseCode> fn from(item: ForteResponseCode) -> Self { match item { ForteResponseCode::A01 | ForteResponseCode::A05 | ForteResponseCode::A06 => { Self::Pending } _ => 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_status_-76852081183156603
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/forte/transformers fn get_status(response_code: ForteResponseCode, action: ForteAction) -> enums::AttemptStatus { match response_code { ForteResponseCode::A01 => match action { ForteAction::Authorize => enums::AttemptStatus::Authorized, ForteAction::Sale => enums::AttemptStatus::Pending, ForteAction::Verify | ForteAction::Capture => enums::AttemptStatus::Charged, }, ForteResponseCode::A05 | ForteResponseCode::A06 => enums::AttemptStatus::Authorizing, _ => enums::AttemptStatus::Failure, } }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 15, "total_crates": null }
fn_clm_hyperswitch_connectors_try_from_652096011794957997
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/fiuu/transformers // Implementation of RefundsRouterData<RSync> for TryFrom<RefundsResponseRouterData<RSync, FiuuRefundSyncResponse>> fn try_from( item: RefundsResponseRouterData<RSync, FiuuRefundSyncResponse>, ) -> Result<Self, Self::Error> { match item.response { FiuuRefundSyncResponse::Error(error) => Ok(Self { response: Err(ErrorResponse { code: error.error_code.clone(), message: error.error_desc.clone(), reason: Some(error.error_desc), status_code: item.http_code, attempt_status: None, connector_transaction_id: None, network_advice_code: None, network_decline_code: None, network_error_message: None, connector_metadata: None, }), ..item.data }), FiuuRefundSyncResponse::Success(refund_data) => { let refund = refund_data .iter() .find(|refund| { Some(refund.refund_id.clone()) == item.data.request.connector_refund_id }) .ok_or_else(|| errors::ConnectorError::MissingConnectorRefundID)?; Ok(Self { response: Ok(RefundsResponseData { connector_refund_id: refund.refund_id.clone(), refund_status: enums::RefundStatus::from(refund.status.clone()), }), ..item.data }) } FiuuRefundSyncResponse::Webhook(fiuu_webhooks_refund_response) => Ok(Self { response: Ok(RefundsResponseData { connector_refund_id: fiuu_webhooks_refund_response.refund_id, refund_status: enums::RefundStatus::from( fiuu_webhooks_refund_response.status.clone(), ), }), ..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_652096011794957997
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/fiuu/transformers // Implementation of enums::RefundStatus for From<FiuuRefundsWebhookStatus> fn from(value: FiuuRefundsWebhookStatus) -> Self { match value { FiuuRefundsWebhookStatus::RefundFailure => Self::Failure, FiuuRefundsWebhookStatus::RefundSuccess => Self::Success, FiuuRefundsWebhookStatus::RefundPending => 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_qr_metadata_652096011794957997
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/fiuu/transformers pub fn get_qr_metadata( response: &DuitNowQrCodeResponse, ) -> CustomResult<Option<serde_json::Value>, errors::ConnectorError> { let image_data = QrImage::new_colored_from_data( response.txn_data.request_data.qr_data.peek().clone(), constants::DUIT_NOW_BRAND_COLOR, ) .change_context(errors::ConnectorError::ResponseHandlingFailed)?; let image_data_url = Url::parse(image_data.data.clone().as_str()).ok(); let display_to_timestamp = None; if let Some(color_image_data_url) = image_data_url { let qr_code_info = payments::QrCodeInformation::QrColorDataUrl { color_image_data_url, display_to_timestamp, display_text: Some(constants::DUIT_NOW_BRAND_TEXT.to_string()), border_color: Some(constants::DUIT_NOW_BRAND_COLOR.to_string()), }; Some(qr_code_info.encode_to_value()) .transpose() .change_context(errors::ConnectorError::ResponseHandlingFailed) } else { Ok(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": 39, "total_crates": null }
fn_clm_hyperswitch_connectors_calculate_signature_652096011794957997
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/fiuu/transformers pub fn calculate_signature( signature_data: String, ) -> Result<Secret<String>, Report<errors::ConnectorError>> { let message = signature_data.as_bytes(); let encoded_data = hex::encode( crypto::Md5 .generate_digest(message) .change_context(errors::ConnectorError::RequestEncodingFailed)?, ); Ok(Secret::new(encoded_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": 23, "total_crates": null }
fn_clm_hyperswitch_connectors_calculate_check_sum_652096011794957997
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/fiuu/transformers pub fn calculate_check_sum( req: FiuuRecurringRequest, ) -> CustomResult<Secret<String>, errors::ConnectorError> { let formatted_string = format!( "{}{}{}{}{}{}{}", req.record_type, req.merchant_id.peek(), req.token.peek(), req.order_id, req.currency, req.amount.get_amount_as_string(), req.verify_key.peek() ); Ok(Secret::new(hex::encode( crypto::Md5 .generate_digest(formatted_string.as_bytes()) .change_context(errors::ConnectorError::RequestEncodingFailed)?, ))) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 20, "total_crates": null }
fn_clm_hyperswitch_connectors_try_from_2407319112982825693
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/peachpayments/transformers // Implementation of PeachpaymentsErrorResponse for TryFrom<ErrorResponse> fn try_from(error_response: ErrorResponse) -> Result<Self, Self::Error> { Ok(Self { error_ref: error_response.code, message: error_response.message, }) }
{ "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_2407319112982825693
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/peachpayments/transformers // Implementation of common_enums::RefundStatus for From<PeachpaymentsRefundStatus> fn from(item: PeachpaymentsRefundStatus) -> Self { match item { PeachpaymentsRefundStatus::ApprovedConfirmed => Self::Success, PeachpaymentsRefundStatus::Failed | PeachpaymentsRefundStatus::Declined => { Self::Failure } } }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 2600, "total_crates": null }
fn_clm_hyperswitch_connectors_from_str_2407319112982825693
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/peachpayments/transformers // Implementation of FailureReason for FromStr fn from_str(value: &str) -> Result<Self, Self::Err> { match value.to_lowercase().as_str() { "unable_to_send" => Ok(Self::UnableToSend), "timeout" => Ok(Self::Timeout), "security_error" => Ok(Self::SecurityError), "issuer_unavailable" => Ok(Self::IssuerUnavailable), "too_late_response" => Ok(Self::TooLateResponse), "malfunction" => Ok(Self::Malfunction), "unable_to_complete" => Ok(Self::UnableToComplete), "online_declined" => Ok(Self::OnlineDeclined), "suspected_fraud" => Ok(Self::SuspectedFraud), "card_declined" => Ok(Self::CardDeclined), "partial" => Ok(Self::Partial), "offline_declined" => Ok(Self::OfflineDeclined), "customer_cancel" => Ok(Self::CustomerCancel), _ => Ok(Self::Timeout), } }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 783, "total_crates": null }
fn_clm_hyperswitch_connectors_get_error_message_2407319112982825693
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/peachpayments/transformers fn get_error_message(response_code: Option<&ResponseCode>) -> String { response_code .and_then(|code| code.description()) .map(|desc| desc.to_string()) .unwrap_or( response_code .and_then(|code| code.as_text()) .map(|text| text.to_string()) .unwrap_or(NO_ERROR_MESSAGE.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": 208, "total_crates": null }
fn_clm_hyperswitch_connectors_value_2407319112982825693
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/peachpayments/transformers // Inherent implementation for ResponseCode pub fn value(&self) -> Option<&String> { match self { Self::Structured { value, .. } => Some(value), _ => 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": 123, "total_crates": null }
fn_clm_hyperswitch_connectors_try_from_3538487722642435899
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/aci/transformers // Implementation of RouterData<SetupMandate, SetupMandateRequestData, PaymentsResponseData> for TryFrom< ResponseRouterData< SetupMandate, AciMandateResponse, SetupMandateRequestData, PaymentsResponseData, >, > fn try_from( item: ResponseRouterData< SetupMandate, AciMandateResponse, SetupMandateRequestData, PaymentsResponseData, >, ) -> Result<Self, Self::Error> { let mandate_reference = Some(MandateReference { connector_mandate_id: Some(item.response.id.clone()), payment_method_id: None, mandate_metadata: None, connector_mandate_request_reference_id: None, }); let status = if SUCCESSFUL_CODES.contains(&item.response.result.code.as_str()) { enums::AttemptStatus::Charged } else if FAILURE_CODES.contains(&item.response.result.code.as_str()) { enums::AttemptStatus::Failure } else { enums::AttemptStatus::Pending }; let response = if status == enums::AttemptStatus::Failure { Err(ErrorResponse { code: item.response.result.code.clone(), message: item.response.result.description.clone(), reason: Some(item.response.result.description), status_code: item.http_code, attempt_status: Some(status), connector_transaction_id: Some(item.response.id.clone()), network_decline_code: None, network_advice_code: None, network_error_message: None, connector_metadata: None, }) } else { Ok(PaymentsResponseData::TransactionResponse { resource_id: ResponseId::ConnectorTransactionId(item.response.id.clone()), redirection_data: Box::new(None), mandate_reference: Box::new(mandate_reference), connector_metadata: None, network_txn_id: None, connector_response_reference_id: Some(item.response.id), 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": 2681, "total_crates": null }
fn_clm_hyperswitch_connectors_from_3538487722642435899
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/aci/transformers // Implementation of enums::RefundStatus for From<AciRefundStatus> fn from(item: AciRefundStatus) -> Self { match item { AciRefundStatus::Succeeded => Self::Success, AciRefundStatus::Failed => Self::Failure, AciRefundStatus::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_from_str_3538487722642435899
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/aci/transformers // Implementation of AciRefundStatus for FromStr fn from_str(s: &str) -> Result<Self, Self::Err> { if FAILURE_CODES.contains(&s) { Ok(Self::Failed) } else if PENDING_CODES.contains(&s) { Ok(Self::Pending) } else if SUCCESSFUL_CODES.contains(&s) { Ok(Self::Succeeded) } else { Err(report!(errors::ConnectorError::UnexpectedResponseError( bytes::Bytes::from(s.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": 785, "total_crates": null }
fn_clm_hyperswitch_connectors_get_capture_method_3538487722642435899
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/aci/transformers // Implementation of PaymentsCancelData for GetCaptureMethod fn get_capture_method(&self) -> Option<enums::CaptureMethod> { None }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 8, "total_crates": null }
fn_clm_hyperswitch_connectors_get_transaction_details_3538487722642435899
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/aci/transformers fn get_transaction_details( item: &AciRouterData<&PaymentsAuthorizeRouterData>, ) -> Result<TransactionDetails, error_stack::Report<errors::ConnectorError>> { let auth = AciAuthType::try_from(&item.router_data.connector_auth_type)?; let payment_type = if item.router_data.request.is_auto_capture()? { AciPaymentType::Debit } else { AciPaymentType::Preauthorization }; Ok(TransactionDetails { entity_id: auth.entity_id, amount: item.amount.to_owned(), currency: item.router_data.request.currency.to_string(), payment_type, }) }
{ "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_3578143789223109406
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/loonio/transformers // Implementation of PayoutsRouterData<F> for TryFrom<PayoutsResponseRouterData<F, LoonioPayoutSyncResponse>> fn try_from( item: PayoutsResponseRouterData<F, LoonioPayoutSyncResponse>, ) -> Result<Self, Self::Error> { Ok(Self { response: Ok(PayoutsResponseData { status: Some(enums::PayoutStatus::from(item.response.state)), connector_payout_id: Some(item.response.transaction_id.to_string()), 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": 2661, "total_crates": null }
fn_clm_hyperswitch_connectors_from_3578143789223109406
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/loonio/transformers // Implementation of enums::PayoutStatus for From<LoonioPayoutStatus> fn from(item: LoonioPayoutStatus) -> Self { match item { LoonioPayoutStatus::Created | LoonioPayoutStatus::Prepared => Self::Initiated, LoonioPayoutStatus::Pending => Self::Pending, LoonioPayoutStatus::Settled | LoonioPayoutStatus::Available => Self::Success, LoonioPayoutStatus::Rejected | LoonioPayoutStatus::Abandoned | LoonioPayoutStatus::ConnectedAbandoned | LoonioPayoutStatus::ConnectedInsufficientFunds | LoonioPayoutStatus::Failed | LoonioPayoutStatus::Nsf | LoonioPayoutStatus::Returned | LoonioPayoutStatus::Rollback => Self::Failed, } }
{ "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_7510904950075062206
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/fiserv/transformers // Implementation of types::RefundsRouterData<RSync> for TryFrom<RefundsResponseRouterData<RSync, FiservSyncResponse>> fn try_from( item: RefundsResponseRouterData<RSync, FiservSyncResponse>, ) -> Result<Self, Self::Error> { let gateway_resp = item .response .sync_responses .first() .ok_or(errors::ConnectorError::ResponseHandlingFailed)?; let transaction_id = match gateway_resp { FiservPaymentsResponse::Charges(res) => { &res.gateway_response .transaction_processing_details .transaction_id } FiservPaymentsResponse::Checkout(res) => { &res.gateway_response .transaction_processing_details .transaction_id } }; let transaction_state = match gateway_resp { FiservPaymentsResponse::Charges(res) => &res.gateway_response.transaction_state, FiservPaymentsResponse::Checkout(res) => &res.gateway_response.transaction_state, }; Ok(Self { response: Ok(RefundsResponseData { connector_refund_id: transaction_id.clone(), refund_status: enums::RefundStatus::from(transaction_state.clone()), }), ..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": 2667, "total_crates": null }
fn_clm_hyperswitch_connectors_from_7510904950075062206
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/fiserv/transformers // Implementation of enums::RefundStatus for From<FiservPaymentStatus> fn from(item: FiservPaymentStatus) -> Self { match item { FiservPaymentStatus::Succeeded | FiservPaymentStatus::Authorized | FiservPaymentStatus::Captured => Self::Success, FiservPaymentStatus::Declined | FiservPaymentStatus::Failed => Self::Failure, FiservPaymentStatus::Voided | FiservPaymentStatus::Processing | FiservPaymentStatus::Created => 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_serialize_7510904950075062206
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/fiserv/transformers // Implementation of FiservCheckoutChargesRequest for Serialize fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where S: Serializer, { match self { Self::Checkout(inner) => inner.serialize(serializer), Self::Charges(inner) => inner.serialize(serializer), } }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 87, "total_crates": null }
fn_clm_hyperswitch_connectors_parse_googlepay_token_safely_7510904950075062206
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/fiserv/transformers pub fn parse_googlepay_token_safely(token_json_str: &str) -> FullyParsedGooglePayToken { let mut result = FullyParsedGooglePayToken::default(); if let Ok(raw_token) = serde_json::from_str::<RawGooglePayToken>(token_json_str) { result.signature = raw_token.signature; result.protocol_version = raw_token.protocol_version; result.signatures = raw_token .intermediate_signing_key .signatures .into_iter() .map(|s| s.expose().to_owned()) .collect(); if let Ok(key) = serde_json::from_str::<SignedKey>( &raw_token.intermediate_signing_key.signed_key.expose(), ) { result.key_value = key.key_value; result.key_expiration = key.key_expiration; } if let Ok(message) = serde_json::from_str::<SignedMessage>(&raw_token.signed_message.expose()) { result.encrypted_message = message.encrypted_message; result.ephemeral_public_key = message.ephemeral_public_key; result.tag = message.tag; } } result }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 26, "total_crates": null }
fn_clm_hyperswitch_connectors_try_from_-6135341582233913153
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/shift4/transformers // Implementation of RefundsRouterData<RSync> for TryFrom<RefundsResponseRouterData<RSync, RefundResponse>> fn try_from( item: RefundsResponseRouterData<RSync, RefundResponse>, ) -> Result<Self, Self::Error> { let refund_status = enums::RefundStatus::from(item.response.status); Ok(Self { response: Ok(RefundsResponseData { connector_refund_id: item.response.id, refund_status, }), ..item.data }) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 2659, "total_crates": null }
fn_clm_hyperswitch_connectors_from_-6135341582233913153
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/shift4/transformers // Implementation of IncomingWebhookEvent for From<Shift4WebhookEvent> fn from(event: Shift4WebhookEvent) -> Self { match event { Shift4WebhookEvent::ChargeSucceeded | Shift4WebhookEvent::ChargeUpdated => { //reference : https://dev.shift4.com/docs/api#event-types Self::PaymentIntentProcessing } Shift4WebhookEvent::ChargeCaptured => Self::PaymentIntentSuccess, Shift4WebhookEvent::ChargeFailed => Self::PaymentIntentFailure, Shift4WebhookEvent::ChargeRefunded => Self::RefundSuccess, Shift4WebhookEvent::Unknown => 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_metadata_-6135341582233913153
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/shift4/transformers // Implementation of PaymentsPreProcessingData for Shift4AuthorizePreprocessingCommon fn get_metadata( &self, ) -> Result<Option<serde_json::Value>, error_stack::Report<errors::ConnectorError>> { Ok(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": 101, "total_crates": null }
fn_clm_hyperswitch_connectors_get_router_return_url_-6135341582233913153
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/shift4/transformers // Implementation of PaymentsPreProcessingData for Shift4AuthorizePreprocessingCommon fn get_router_return_url(&self) -> Option<String> { self.router_return_url.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": 34, "total_crates": null }
fn_clm_hyperswitch_connectors_is_refund_event_-6135341582233913153
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/shift4/transformers pub fn is_refund_event(event: &Shift4WebhookEvent) -> bool { matches!(event, Shift4WebhookEvent::ChargeRefunded) }
{ "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_try_from_8814440794261893214
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/checkout/transformers // Implementation of Evidence for TryFrom<&SubmitEvidenceRouterData> fn try_from(item: &SubmitEvidenceRouterData) -> Result<Self, Self::Error> { let submit_evidence_request_data = item.request.clone(); Ok(Self { proof_of_delivery_or_service_file: submit_evidence_request_data .shipping_documentation_provider_file_id, invoice_or_receipt_file: submit_evidence_request_data.receipt_provider_file_id, invoice_showing_distinct_transactions_file: submit_evidence_request_data .invoice_showing_distinct_transactions_provider_file_id, customer_communication_file: submit_evidence_request_data .customer_communication_provider_file_id, refund_or_cancellation_policy_file: submit_evidence_request_data .refund_policy_provider_file_id, recurring_transaction_agreement_file: submit_evidence_request_data .recurring_transaction_agreement_provider_file_id, additional_evidence_file: submit_evidence_request_data .uncategorized_file_provider_file_id, }) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 2659, "total_crates": null }
fn_clm_hyperswitch_connectors_from_8814440794261893214
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/checkout/transformers // Implementation of utils::ErrorCodeAndMessage for From<String> fn from(error: String) -> Self { Self { error_code: error.clone(), error_message: error, } }
{ "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_construct_file_upload_request_8814440794261893214
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/checkout/transformers pub fn construct_file_upload_request( file_upload_router_data: UploadFileRouterData, ) -> CustomResult<RequestContent, errors::ConnectorError> { let request = file_upload_router_data.request; let checkout_file_request = CheckoutFileRequest { purpose: "dispute_evidence", file: request.file.clone(), file_key: request.file_key.clone(), file_type: request.file_type.to_string(), }; let mut multipart = reqwest::multipart::Form::new(); multipart = multipart.text("purpose", "dispute_evidence"); let file_data = reqwest::multipart::Part::bytes(request.file) .file_name(format!( "{}.{}", request.file_key, request .file_type .as_ref() .split('/') .next_back() .unwrap_or_default() )) .mime_str(request.file_type.as_ref()) .change_context(errors::ConnectorError::RequestEncodingFailed) .attach_printable("Failure in constructing file data")?; multipart = multipart.part("file", file_data); Ok(RequestContent::FormData(( multipart, Box::new(checkout_file_request), ))) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 38, "total_crates": null }
fn_clm_hyperswitch_connectors_is_refund_event_8814440794261893214
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/checkout/transformers pub fn is_refund_event(event_code: &CheckoutWebhookEventType) -> bool { matches!( event_code, CheckoutWebhookEventType::PaymentRefunded | CheckoutWebhookEventType::PaymentRefundDeclined ) }
{ "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_split_account_holder_name_8814440794261893214
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/checkout/transformers fn split_account_holder_name( card_holder_name: Option<Secret<String>>, ) -> (Option<Secret<String>>, Option<Secret<String>>) { let account_holder_name = card_holder_name .as_ref() .map(|name| name.clone().expose().trim().to_string()); match account_holder_name { Some(name) if !name.is_empty() => match name.rsplit_once(' ') { Some((first, last)) => ( Some(Secret::new(first.to_string())), Some(Secret::new(last.to_string())), ), None => (Some(Secret::new(name)), None), }, _ => (None, 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": 26, "total_crates": null }
fn_clm_hyperswitch_connectors_try_from_9039017765785911006
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/katapult/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_9039017765785911006
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/katapult/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_6250994768110582929
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/zen/transformers // Implementation of types::RefundsRouterData<RSync> for TryFrom<RefundsResponseRouterData<RSync, RefundResponse>> fn try_from( item: RefundsResponseRouterData<RSync, RefundResponse>, ) -> Result<Self, Self::Error> { let refund_status = enums::RefundStatus::from(item.response.status); Ok(Self { response: Ok(RefundsResponseData { connector_refund_id: item.response.id, refund_status, }), ..item.data }) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 2659, "total_crates": null }
fn_clm_hyperswitch_connectors_from_6250994768110582929
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/zen/transformers // Implementation of enums::RefundStatus for From<RefundStatus> fn from(item: RefundStatus) -> Self { match item { RefundStatus::Accepted => Self::Success, RefundStatus::Pending | RefundStatus::Authorized => Self::Pending, RefundStatus::Rejected => 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_foreign_try_from_6250994768110582929
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/zen/transformers // Implementation of enums::AttemptStatus for ForeignTryFrom<(ZenPaymentStatus, Option<ZenActions>)> fn foreign_try_from(item: (ZenPaymentStatus, Option<ZenActions>)) -> Result<Self, Self::Error> { let (item_txn_status, item_action_status) = item; Ok(match item_txn_status { // Payment has been authorized at connector end, They will send webhook when it gets accepted ZenPaymentStatus::Authorized => Self::Pending, ZenPaymentStatus::Accepted => Self::Charged, ZenPaymentStatus::Pending => { item_action_status.map_or(Self::Pending, |action| match action { ZenActions::Redirect => Self::AuthenticationPending, }) } ZenPaymentStatus::Rejected => Self::Failure, ZenPaymentStatus::Canceled => Self::Voided, }) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 430, "total_crates": null }
fn_clm_hyperswitch_connectors_get_browser_details_6250994768110582929
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/zen/transformers fn get_browser_details( browser_info: &BrowserInformation, ) -> CustomResult<ZenBrowserDetails, errors::ConnectorError> { let screen_height = browser_info .screen_height .get_required_value("screen_height") .change_context(errors::ConnectorError::MissingRequiredField { field_name: "screen_height", })?; let screen_width = browser_info .screen_width .get_required_value("screen_width") .change_context(errors::ConnectorError::MissingRequiredField { field_name: "screen_width", })?; let window_size = match (screen_height, screen_width) { (250, 400) => "01", (390, 400) => "02", (500, 600) => "03", (600, 400) => "04", _ => "05", } .to_string(); Ok(ZenBrowserDetails { color_depth: browser_info.get_color_depth()?.to_string(), java_enabled: browser_info.get_java_enabled()?, lang: browser_info.get_language()?, screen_height: screen_height.to_string(), screen_width: screen_width.to_string(), timezone: browser_info.get_time_zone()?.to_string(), accept_header: browser_info.get_accept_header()?, user_agent: browser_info.get_user_agent()?, window_size, }) }
{ "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_get_signature_data_6250994768110582929
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/zen/transformers /// Fields should be in alphabetical order fn get_signature_data( checkout_request: &CheckoutRequest, ) -> Result<String, errors::ConnectorError> { let specified_payment_channel = match checkout_request.specified_payment_channel { ZenPaymentChannels::PclCard => "pcl_card", ZenPaymentChannels::PclGooglepay => "pcl_googlepay", ZenPaymentChannels::PclApplepay => "pcl_applepay", ZenPaymentChannels::PclBoacompraBoleto => "pcl_boacompra_boleto", ZenPaymentChannels::PclBoacompraEfecty => "pcl_boacompra_efecty", ZenPaymentChannels::PclBoacompraMultibanco => "pcl_boacompra_multibanco", ZenPaymentChannels::PclBoacompraPagoefectivo => "pcl_boacompra_pagoefectivo", ZenPaymentChannels::PclBoacompraPix => "pcl_boacompra_pix", ZenPaymentChannels::PclBoacompraPse => "pcl_boacompra_pse", ZenPaymentChannels::PclBoacompraRedcompra => "pcl_boacompra_redcompra", ZenPaymentChannels::PclBoacompraRedpagos => "pcl_boacompra_redpagos", }; let mut signature_data = vec![ format!("amount={}", checkout_request.amount), format!("currency={}", checkout_request.currency), format!("customipnurl={}", checkout_request.custom_ipn_url), ]; for index in 0..checkout_request.items.len() { let prefix = format!("items[{index}]."); let checkout_request_items = checkout_request .items .get(index) .ok_or(errors::ConnectorError::RequestEncodingFailed)?; signature_data.push(format!( "{prefix}lineamounttotal={}", checkout_request_items.line_amount_total )); signature_data.push(format!("{prefix}name={}", checkout_request_items.name)); signature_data.push(format!("{prefix}price={}", checkout_request_items.price)); signature_data.push(format!( "{prefix}quantity={}", checkout_request_items.quantity )); } signature_data.push(format!( "merchanttransactionid={}", checkout_request.merchant_transaction_id )); signature_data.push(format!( "specifiedpaymentchannel={specified_payment_channel}" )); signature_data.push(format!( "terminaluuid={}", checkout_request.terminal_uuid.peek() )); signature_data.push(format!("urlredirect={}", checkout_request.url_redirect)); let signature = signature_data.join("&"); Ok(signature.to_lowercase()) }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": false, "num_enums": null, "num_structs": null, "num_tables": null, "score": 29, "total_crates": null }
fn_clm_hyperswitch_connectors_try_from_8062601374987234488
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/unified_authentication_service/transformers // Implementation of RouterData<F, T, UasAuthenticationResponseData> for TryFrom< ResponseRouterData< F, UnifiedAuthenticationServiceAuthenticateResponse, T, UasAuthenticationResponseData, >, > fn try_from( item: ResponseRouterData< F, UnifiedAuthenticationServiceAuthenticateResponse, T, UasAuthenticationResponseData, >, ) -> Result<Self, Self::Error> { let response = match item.response { UnifiedAuthenticationServiceAuthenticateResponse::Success(auth_response) => { let authn_flow_type = match auth_response.three_ds_auth_response.trans_status { common_enums::TransactionStatus::ChallengeRequired => { AuthNFlowType::Challenge(Box::new(ChallengeParams { acs_url: auth_response.three_ds_auth_response.acs_url.clone(), challenge_request: auth_response .three_ds_auth_response .challenge_request, challenge_request_key: auth_response .three_ds_auth_response .challenge_request_key, acs_reference_number: Some( auth_response.three_ds_auth_response.acs_reference_number, ), acs_trans_id: Some(auth_response.three_ds_auth_response.acs_trans_id), three_dsserver_trans_id: Some( auth_response .three_ds_auth_response .three_ds_server_trans_id, ), acs_signed_content: auth_response .three_ds_auth_response .acs_signed_content, })) } _ => AuthNFlowType::Frictionless, }; Ok(UasAuthenticationResponseData::Authentication { authentication_details: hyperswitch_domain_models::router_request_types::unified_authentication_service::AuthenticationDetails { authn_flow_type, authentication_value: auth_response.three_ds_auth_response.authentication_value, trans_status: auth_response.three_ds_auth_response.trans_status, connector_metadata: None, ds_trans_id: Some(auth_response.three_ds_auth_response.ds_trans_id), eci: auth_response.three_ds_auth_response.eci, challenge_code: auth_response.three_ds_auth_response.challenge_code, challenge_cancel: auth_response.three_ds_auth_response.challenge_cancel, challenge_code_reason: auth_response.three_ds_auth_response.challenge_code_reason, message_extension: auth_response.three_ds_auth_response.message_extension, }, }) } UnifiedAuthenticationServiceAuthenticateResponse::Failure(error_response) => { Err(hyperswitch_domain_models::router_data::ErrorResponse { code: hyperswitch_interfaces::consts::NO_ERROR_CODE.to_string(), message: error_response.error.clone(), reason: None, 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, }) } }; 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": 2667, "total_crates": null }
fn_clm_hyperswitch_connectors_from_8062601374987234488
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/unified_authentication_service/transformers // Implementation of UnifiedAuthenticationServiceRouterData<T> for From<(FloatMajorUnit, T)> fn from((amount, item): (FloatMajorUnit, T)) -> Self { //Todo : use utils to convert the amount to the type of amount that a connector accepts 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_get_max_acs_protocol_version_if_available_8062601374987234488
clm
function
// Repository: hyperswitch // Crate: hyperswitch_connectors // Purpose: Payment provider integrations (Stripe, PayPal, etc.) // Module: crates/hyperswitch_connectors/src/connectors/unified_authentication_service/transformers // Inherent implementation for ThreeDsEligibilityResponse pub fn get_max_acs_protocol_version_if_available(&self) -> Option<AcsProtocolVersion> { let max_acs_version = self.acs_protocol_versions .as_ref() .and_then(|acs_protocol_versions| { acs_protocol_versions .iter() .max_by_key(|acs_protocol_versions| acs_protocol_versions.version.clone()) }); max_acs_version.cloned() }
{ "crate": "hyperswitch_connectors", "file": null, "file_size": null, "is_async": false, "is_pub": true, "num_enums": null, "num_structs": null, "num_tables": null, "score": 30, "total_crates": null }