id stringlengths 11 116 | type stringclasses 1 value | granularity stringclasses 4 values | content stringlengths 16 477k | metadata dict |
|---|---|---|---|---|
fn_clm_hyperswitch_connectors_payment_receipt_5376745659768866832 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/authipay/transformers
// Implementation of None for AuthipayPaymentsResponse
/// Get payment receipt (like Fiserv's payment_receipt)
pub fn payment_receipt(&self) -> AuthipayPaymentReceipt {
AuthipayPaymentReceipt {
approved_amount: self.approved_amount.clone(),
processor_response_details: Some(self.processor.clone()),
}
}
| {
"crate": "hyperswitch_connectors",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 22,
"total_crates": null
} |
fn_clm_hyperswitch_connectors_try_from_4804822784868212000 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/juspaythreedsserver/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_4804822784868212000 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/juspaythreedsserver/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_-2710058274532219601 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/barclaycard/transformers
// Implementation of PaymentInformation for TryFrom<&GooglePayWalletData>
fn try_from(google_pay_data: &GooglePayWalletData) -> Result<Self, Self::Error> {
Ok(Self::GooglePay(Box::new(GooglePayPaymentInformation {
fluid_data: FluidData {
value: Secret::from(
consts::BASE64_ENGINE.encode(
google_pay_data
.tokenization_data
.get_encrypted_google_pay_token()
.change_context(errors::ConnectorError::MissingRequiredField {
field_name: "gpay wallet_token",
})?
.clone(),
),
),
descriptor: None,
},
})))
}
| {
"crate": "hyperswitch_connectors",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 2671,
"total_crates": null
} |
fn_clm_hyperswitch_connectors_from_-2710058274532219601 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/barclaycard/transformers
// Implementation of enums::RefundStatus for From<BarclaycardRefundResponse>
fn from(item: BarclaycardRefundResponse) -> Self {
let error_reason = item
.error_information
.and_then(|error_info| error_info.reason);
match item.status {
BarclaycardRefundStatus::Succeeded | BarclaycardRefundStatus::Transmitted => {
Self::Success
}
BarclaycardRefundStatus::Cancelled
| BarclaycardRefundStatus::Failed
| BarclaycardRefundStatus::Voided => Self::Failure,
BarclaycardRefundStatus::Pending => Self::Pending,
BarclaycardRefundStatus::TwoZeroOne => {
if error_reason == Some("PROCESSOR_DECLINED".to_string()) {
Self::Failure
} else {
Self::Pending
}
}
}
}
| {
"crate": "hyperswitch_connectors",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 2604,
"total_crates": null
} |
fn_clm_hyperswitch_connectors_get_error_response_-2710058274532219601 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/barclaycard/transformers
fn get_error_response(
error_data: &Option<BarclaycardErrorInformation>,
processor_information: &Option<ClientProcessorInformation>,
risk_information: &Option<ClientRiskInformation>,
attempt_status: Option<enums::AttemptStatus>,
status_code: u16,
transaction_id: String,
) -> ErrorResponse {
let avs_message = risk_information
.clone()
.map(|client_risk_information| {
client_risk_information.rules.map(|rules| {
rules
.iter()
.map(|risk_info| {
risk_info.name.clone().map_or("".to_string(), |name| {
format!(" , {}", name.clone().expose())
})
})
.collect::<Vec<String>>()
.join("")
})
})
.unwrap_or(Some("".to_string()));
let detailed_error_info = error_data.to_owned().and_then(|error_info| {
error_info.details.map(|error_details| {
error_details
.iter()
.map(|details| format!("{} : {}", details.field, details.reason))
.collect::<Vec<_>>()
.join(", ")
})
});
let network_decline_code = processor_information
.as_ref()
.and_then(|info| info.response_code.clone());
let network_advice_code = processor_information.as_ref().and_then(|info| {
info.merchant_advice
.as_ref()
.and_then(|merchant_advice| merchant_advice.code_raw.clone())
});
let reason = get_error_reason(
error_data
.clone()
.and_then(|error_details| error_details.message),
detailed_error_info,
avs_message,
);
let error_message = error_data
.clone()
.and_then(|error_details| error_details.reason);
ErrorResponse {
code: error_message
.clone()
.unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_CODE.to_string()),
message: error_message
.clone()
.unwrap_or(hyperswitch_interfaces::consts::NO_ERROR_MESSAGE.to_string()),
reason,
status_code,
attempt_status,
connector_transaction_id: Some(transaction_id.clone()),
network_advice_code,
network_decline_code,
network_error_message: None,
connector_metadata: None,
}
}
| {
"crate": "hyperswitch_connectors",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 125,
"total_crates": null
} |
fn_clm_hyperswitch_connectors_get_error_reason_-2710058274532219601 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/barclaycard/transformers
pub fn get_error_reason(
error_info: Option<String>,
detailed_error_info: Option<String>,
avs_error_info: Option<String>,
) -> Option<String> {
match (error_info, detailed_error_info, avs_error_info) {
(Some(message), Some(details), Some(avs_message)) => Some(format!(
"{message}, detailed_error_information: {details}, avs_message: {avs_message}",
)),
(Some(message), Some(details), None) => {
Some(format!("{message}, detailed_error_information: {details}"))
}
(Some(message), None, Some(avs_message)) => {
Some(format!("{message}, avs_message: {avs_message}"))
}
(None, Some(details), Some(avs_message)) => {
Some(format!("{details}, avs_message: {avs_message}"))
}
(Some(message), None, None) => Some(message),
(None, Some(details), None) => Some(details),
(None, None, Some(avs_message)) => Some(avs_message),
(None, None, None) => None,
}
}
| {
"crate": "hyperswitch_connectors",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 58,
"total_crates": null
} |
fn_clm_hyperswitch_connectors_build_bill_to_-2710058274532219601 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/barclaycard/transformers
fn build_bill_to(
address_details: &hyperswitch_domain_models::address::AddressDetails,
email: pii::Email,
) -> Result<BillTo, error_stack::Report<errors::ConnectorError>> {
let administrative_area = address_details
.to_state_code_as_optional()
.unwrap_or_else(|_| {
address_details
.get_state()
.ok()
.map(|state| truncate_string(state, 20))
})
.ok_or_else(|| errors::ConnectorError::MissingRequiredField {
field_name: "billing_address.state",
})?;
Ok(BillTo {
first_name: address_details.get_first_name()?.clone(),
last_name: address_details.get_last_name()?.clone(),
address1: address_details.get_line1()?.clone(),
locality: address_details.get_city()?.clone(),
administrative_area,
postal_code: address_details.get_zip()?.clone(),
country: address_details.get_country()?.to_owned(),
email,
})
}
| {
"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_try_from_-3669531568098880144 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/santander/transformers
// Implementation of RefundsRouterData<F> for TryFrom<RefundsResponseRouterData<F, SantanderRefundResponse>>
fn try_from(
item: RefundsResponseRouterData<F, SantanderRefundResponse>,
) -> Result<Self, Self::Error> {
Ok(Self {
response: Ok(RefundsResponseData {
connector_refund_id: item.response.rtr_id.clone().expose(),
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": 2663,
"total_crates": null
} |
fn_clm_hyperswitch_connectors_from_-3669531568098880144 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/santander/transformers
// Implementation of enums::RefundStatus for From<SantanderRefundStatus>
fn from(item: SantanderRefundStatus) -> Self {
match item {
SantanderRefundStatus::Returned => Self::Success,
SantanderRefundStatus::NotDone => Self::Failure,
SantanderRefundStatus::InProcessing => Self::Pending,
}
}
| {
"crate": "hyperswitch_connectors",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 2600,
"total_crates": null
} |
fn_clm_hyperswitch_connectors_get_error_response_-3669531568098880144 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/santander/transformers
pub fn get_error_response(
pix_data: Box<SantanderPixQRCodePaymentsResponse>,
status_code: u16,
attempt_status: AttemptStatus,
) -> ErrorResponse {
ErrorResponse {
code: NO_ERROR_CODE.to_string(),
message: NO_ERROR_MESSAGE.to_string(),
reason: None,
status_code,
attempt_status: Some(attempt_status),
connector_transaction_id: Some(pix_data.transaction_id.clone()),
network_advice_code: None,
network_decline_code: None,
network_error_message: None,
connector_metadata: None,
}
}
| {
"crate": "hyperswitch_connectors",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 67,
"total_crates": null
} |
fn_clm_hyperswitch_connectors_get_qr_code_data_-3669531568098880144 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/santander/transformers
fn get_qr_code_data<F, T>(
item: &ResponseRouterData<F, SantanderPaymentsResponse, T, PaymentsResponseData>,
pix_data: &SantanderPixQRCodePaymentsResponse,
) -> CustomResult<Option<Value>, errors::ConnectorError> {
let santander_mca_metadata = SantanderMetadataObject::try_from(&item.data.connector_meta_data)?;
let response = pix_data.clone();
let expiration_time = response.calendar.expiration;
let expiration_i64 = i64::from(expiration_time);
let rfc3339_expiry = (OffsetDateTime::now_utc() + time::Duration::seconds(expiration_i64))
.format(&time::format_description::well_known::Rfc3339)
.map_err(|_| errors::ConnectorError::ResponseHandlingFailed)?;
let qr_expiration_duration = OffsetDateTime::parse(
rfc3339_expiry.as_str(),
&time::format_description::well_known::Rfc3339,
)
.map_err(|_| errors::ConnectorError::ResponseHandlingFailed)?
.unix_timestamp()
* 1000;
let merchant_city = santander_mca_metadata.merchant_city.as_str();
let merchant_name = santander_mca_metadata.merchant_name.as_str();
let payload_url = if let Some(location) = response.location {
location
} else {
return Err(errors::ConnectorError::ResponseHandlingFailed)?;
};
let amount_i64 = StringMajorUnitForConnector
.convert_back(response.value.original, enums::Currency::BRL)
.change_context(errors::ConnectorError::ResponseHandlingFailed)?
.get_amount_as_i64();
let amount_string = amount_i64.to_string();
let amount = amount_string.as_str();
let dynamic_pix_code = generate_emv_string(
payload_url.as_str(),
merchant_name,
merchant_city,
Some(amount),
Some(response.transaction_id.as_str()),
);
let image_data = QrImage::new_from_data(dynamic_pix_code.clone())
.change_context(errors::ConnectorError::ResponseHandlingFailed)?;
let image_data_url = Url::parse(image_data.data.clone().as_str())
.change_context(errors::ConnectorError::ResponseHandlingFailed)?;
let qr_code_info = QrCodeInformation::QrDataUrl {
image_data_url,
display_to_timestamp: Some(qr_expiration_duration),
};
Some(qr_code_info.encode_to_value())
.transpose()
.change_context(errors::ConnectorError::ResponseHandlingFailed)
}
| {
"crate": "hyperswitch_connectors",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 60,
"total_crates": null
} |
fn_clm_hyperswitch_connectors_format_emv_field_-3669531568098880144 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/santander/transformers
pub fn format_emv_field(id: &str, value: &str) -> String {
format!("{id}{:02}{value}", value.len())
}
| {
"crate": "hyperswitch_connectors",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 49,
"total_crates": null
} |
fn_clm_hyperswitch_connectors_try_from_10885249382793853 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/bitpay/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.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_10885249382793853 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/bitpay/transformers
// Implementation of enums::RefundStatus for From<RefundStatus>
fn from(item: RefundStatus) -> Self {
match item {
RefundStatus::Succeeded => Self::Success,
RefundStatus::Failed => Self::Failure,
RefundStatus::Processing => Self::Pending,
//TODO: Review mapping
}
}
| {
"crate": "hyperswitch_connectors",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 2600,
"total_crates": null
} |
fn_clm_hyperswitch_connectors_get_crypto_specific_payment_data_10885249382793853 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/bitpay/transformers
fn get_crypto_specific_payment_data(
item: &BitpayRouterData<&types::PaymentsAuthorizeRouterData>,
) -> Result<BitpayPaymentsRequest, error_stack::Report<errors::ConnectorError>> {
let price = item.amount;
let currency = item.router_data.request.currency.to_string();
let redirect_url = item.router_data.request.get_router_return_url()?;
let notification_url = item.router_data.request.get_webhook_url()?;
let transaction_speed = TransactionSpeed::Medium;
let auth_type = item.router_data.connector_auth_type.clone();
let token = match auth_type {
ConnectorAuthType::HeaderKey { api_key } => api_key,
_ => String::default().into(),
};
let order_id = item.router_data.connector_request_reference_id.clone();
Ok(BitpayPaymentsRequest {
price,
currency,
redirect_url,
notification_url,
transaction_speed,
token,
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": 14,
"total_crates": null
} |
fn_clm_hyperswitch_connectors_try_from_-2338230399169688516 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/moneris/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.refund_id.to_string(),
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": 2661,
"total_crates": null
} |
fn_clm_hyperswitch_connectors_from_-2338230399169688516 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/moneris/transformers
// Implementation of enums::RefundStatus for From<RefundStatus>
fn from(item: RefundStatus) -> Self {
match item {
RefundStatus::Succeeded => Self::Success,
RefundStatus::Declined | RefundStatus::DeclinedRetry => Self::Failure,
RefundStatus::Processing => Self::Pending,
}
}
| {
"crate": "hyperswitch_connectors",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 2600,
"total_crates": null
} |
fn_clm_hyperswitch_connectors_try_from_-9009365130619912809 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/volt/transformers
// Implementation of types::RefundsRouterData<Execute> for TryFrom<RefundsResponseRouterData<Execute, RefundResponse>>
fn try_from(
item: RefundsResponseRouterData<Execute, RefundResponse>,
) -> Result<Self, Self::Error> {
Ok(Self {
response: Ok(RefundsResponseData {
connector_refund_id: item.response.id.to_string(),
refund_status: enums::RefundStatus::Pending, //We get Refund Status only by Webhooks
}),
..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_-9009365130619912809 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/volt/transformers
// Implementation of api_models::webhooks::IncomingWebhookEvent for From<VoltWebhookBodyEventType>
fn from(status: VoltWebhookBodyEventType) -> Self {
match status {
VoltWebhookBodyEventType::Payment(payment_data) => match payment_data.status {
VoltWebhookPaymentStatus::Received => Self::PaymentIntentSuccess,
VoltWebhookPaymentStatus::Failed | VoltWebhookPaymentStatus::NotReceived => {
Self::PaymentIntentFailure
}
VoltWebhookPaymentStatus::Completed | VoltWebhookPaymentStatus::Pending => {
Self::PaymentIntentProcessing
}
},
VoltWebhookBodyEventType::Refund(refund_data) => match refund_data.status {
VoltWebhookRefundsStatus::RefundConfirmed => Self::RefundSuccess,
VoltWebhookRefundsStatus::RefundFailed => Self::RefundFailure,
},
}
}
| {
"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_attempt_status_-9009365130619912809 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/volt/transformers
fn get_attempt_status(
(item, current_status): (VoltPaymentStatus, enums::AttemptStatus),
) -> enums::AttemptStatus {
match item {
VoltPaymentStatus::Received | VoltPaymentStatus::Settled => enums::AttemptStatus::Charged,
VoltPaymentStatus::Completed | VoltPaymentStatus::DelayedAtBank => {
enums::AttemptStatus::Pending
}
VoltPaymentStatus::NewPayment
| VoltPaymentStatus::BankRedirect
| VoltPaymentStatus::AwaitingCheckoutAuthorisation => {
enums::AttemptStatus::AuthenticationPending
}
VoltPaymentStatus::RefusedByBank
| VoltPaymentStatus::RefusedByRisk
| VoltPaymentStatus::NotReceived
| VoltPaymentStatus::ErrorAtBank
| VoltPaymentStatus::CancelledByUser
| VoltPaymentStatus::AbandonedByUser
| VoltPaymentStatus::Failed => enums::AttemptStatus::Failure,
VoltPaymentStatus::Unknown => current_status,
}
}
| {
"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_new_1340926409473511001 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/noon/transformers
// Inherent implementation for NoonOrderNvp
pub fn new(metadata: &serde_json::Value) -> Self {
let metadata_as_string = metadata.to_string();
let hash_map: std::collections::BTreeMap<String, serde_json::Value> =
serde_json::from_str(&metadata_as_string).unwrap_or(std::collections::BTreeMap::new());
let inner = hash_map
.into_iter()
.enumerate()
.map(|(index, (hs_key, hs_value))| {
let noon_key = format!("{}", index + 1);
// to_string() function on serde_json::Value returns a string with "" quotes. Noon doesn't allow this. Hence get_value_as_string function
let noon_value = format!("{hs_key}={}", get_value_as_string(&hs_value));
(noon_key, Secret::new(noon_value))
})
.collect();
Self { inner }
}
| {
"crate": "hyperswitch_connectors",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 14481,
"total_crates": null
} |
fn_clm_hyperswitch_connectors_try_from_1340926409473511001 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/noon/transformers
// Implementation of RefundsRouterData<RSync> for TryFrom<RefundsResponseRouterData<RSync, RefundSyncResponse>>
fn try_from(
item: RefundsResponseRouterData<RSync, RefundSyncResponse>,
) -> Result<Self, Self::Error> {
let noon_transaction: &NoonRefundResponseTransactions = item
.response
.result
.transactions
.iter()
.find(|transaction| {
transaction
.transaction_reference
.clone()
.is_some_and(|transaction_instance| {
transaction_instance == item.data.request.refund_id
})
})
.ok_or(errors::ConnectorError::ResponseHandlingFailed)?;
let refund_status = enums::RefundStatus::from(noon_transaction.status.to_owned());
let response = if utils::is_refund_failure(refund_status) {
let response = &item.response;
Err(ErrorResponse {
status_code: item.http_code,
code: response.result_code.to_string(),
message: response.class_description.clone(),
reason: Some(response.message.clone()),
attempt_status: None,
connector_transaction_id: Some(noon_transaction.id.clone()),
network_advice_code: None,
network_decline_code: None,
network_error_message: None,
connector_metadata: None,
})
} else {
Ok(RefundsResponseData {
connector_refund_id: noon_transaction.id.to_owned(),
refund_status,
})
};
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": 2683,
"total_crates": null
} |
fn_clm_hyperswitch_connectors_from_1340926409473511001 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/noon/transformers
// Implementation of NoonPaymentsResponse for From<NoonWebhookObject>
fn from(value: NoonWebhookObject) -> Self {
Self {
result: NoonPaymentsResponseResult {
order: NoonPaymentsOrderResponse {
status: value.order_status,
id: value.order_id,
//For successful payments Noon Always populates error_code as 0.
error_code: 0,
error_message: None,
reference: None,
},
checkout_data: None,
subscription: 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": 2600,
"total_crates": null
} |
fn_clm_hyperswitch_connectors_get_value_as_string_1340926409473511001 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/noon/transformers
fn get_value_as_string(value: &serde_json::Value) -> String {
match value {
serde_json::Value::String(string) => string.to_owned(),
serde_json::Value::Null
| serde_json::Value::Bool(_)
| serde_json::Value::Number(_)
| serde_json::Value::Array(_)
| serde_json::Value::Object(_) => value.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": 4,
"total_crates": null
} |
fn_clm_hyperswitch_connectors_get_payment_status_1340926409473511001 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/noon/transformers
fn get_payment_status(data: (NoonPaymentStatus, AttemptStatus)) -> AttemptStatus {
let (item, current_status) = data;
match item {
NoonPaymentStatus::Authorized => AttemptStatus::Authorized,
NoonPaymentStatus::Captured
| NoonPaymentStatus::PartiallyCaptured
| NoonPaymentStatus::PartiallyRefunded
| NoonPaymentStatus::Refunded => AttemptStatus::Charged,
NoonPaymentStatus::Reversed | NoonPaymentStatus::PartiallyReversed => AttemptStatus::Voided,
NoonPaymentStatus::Cancelled | NoonPaymentStatus::Expired => {
AttemptStatus::AuthenticationFailed
}
NoonPaymentStatus::ThreeDsEnrollInitiated | NoonPaymentStatus::ThreeDsEnrollChecked => {
AttemptStatus::AuthenticationPending
}
NoonPaymentStatus::ThreeDsResultVerified => AttemptStatus::AuthenticationSuccessful,
NoonPaymentStatus::Failed | NoonPaymentStatus::Rejected => AttemptStatus::Failure,
NoonPaymentStatus::Pending | NoonPaymentStatus::MarkedForReview => AttemptStatus::Pending,
NoonPaymentStatus::Initiated
| NoonPaymentStatus::PaymentInfoAdded
| NoonPaymentStatus::Authenticated => AttemptStatus::Started,
NoonPaymentStatus::Locked => current_status,
}
}
| {
"crate": "hyperswitch_connectors",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 3,
"total_crates": null
} |
fn_clm_hyperswitch_connectors_try_from_6819115515883783815 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/datatrans/transformers
// Implementation of types::PaymentsCancelRouterData for TryFrom<PaymentsCancelResponseRouterData<DataTransCancelResponse>>
fn try_from(
item: PaymentsCancelResponseRouterData<DataTransCancelResponse>,
) -> Result<Self, Self::Error> {
let status = match item.response {
// Datatrans http code 204 implies Successful Cancellation
//https://api-reference.datatrans.ch/#tag/v1transactions/operation/cancel
DataTransCancelResponse::Empty => {
if item.http_code == 204 {
common_enums::AttemptStatus::Voided
} else {
common_enums::AttemptStatus::Failure
}
}
DataTransCancelResponse::Error(error) => {
if error.message == *TRANSACTION_ALREADY_CANCELLED {
common_enums::AttemptStatus::Voided
} else {
common_enums::AttemptStatus::Failure
}
}
};
Ok(Self {
status,
..item.data
})
}
| {
"crate": "hyperswitch_connectors",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 2657,
"total_crates": null
} |
fn_clm_hyperswitch_connectors_from_6819115515883783815 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/datatrans/transformers
// Implementation of enums::RefundStatus for From<SyncResponse>
fn from(item: SyncResponse) -> Self {
match item.res_type {
TransactionType::Credit => match item.status {
TransactionStatus::Settled | TransactionStatus::Transmitted => Self::Success,
TransactionStatus::ChallengeOngoing | TransactionStatus::ChallengeRequired => {
Self::Pending
}
TransactionStatus::Initialized
| TransactionStatus::Authenticated
| TransactionStatus::Authorized
| TransactionStatus::Canceled
| TransactionStatus::Failed => Self::Failure,
},
TransactionType::Payment | TransactionType::CardCheck => 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_create_card_details_6819115515883783815 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/datatrans/transformers
fn create_card_details(
item: &DatatransRouterData<&types::PaymentsAuthorizeRouterData>,
card: &Card,
) -> Result<DataTransPaymentDetails, error_stack::Report<errors::ConnectorError>> {
let mut details = PlainCardDetails {
res_type: "PLAIN".to_string(),
number: card.card_number.clone(),
expiry_month: card.card_exp_month.clone(),
expiry_year: card.get_card_expiry_year_2_digit()?,
cvv: card.card_cvc.clone(),
three_ds: None,
};
if let Some(auth_data) = &item.router_data.request.authentication_data {
details.three_ds = Some(ThreeDSecureData::Authentication(ThreeDSData {
three_ds_transaction_id: auth_data
.threeds_server_transaction_id
.clone()
.map(Secret::new),
cavv: auth_data.cavv.clone(),
eci: auth_data.eci.clone(),
xid: auth_data.ds_trans_id.clone().map(Secret::new),
three_ds_version: auth_data
.message_version
.clone()
.map(|version| version.to_string()),
authentication_response: "Y".to_string(),
}));
} else if item.router_data.is_three_ds() {
details.three_ds = Some(ThreeDSecureData::Cardholder(ThreedsInfo {
cardholder: CardHolder {
cardholder_name: item.router_data.get_billing_full_name()?,
email: item.router_data.get_billing_email()?,
},
}));
}
Ok(DataTransPaymentDetails::Cards(details))
}
| {
"crate": "hyperswitch_connectors",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 42,
"total_crates": null
} |
fn_clm_hyperswitch_connectors_get_status_6819115515883783815 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/datatrans/transformers
fn get_status(item: &DatatransResponse, is_auto_capture: bool) -> enums::AttemptStatus {
match item {
DatatransResponse::ErrorResponse(_) => enums::AttemptStatus::Failure,
DatatransResponse::TransactionResponse(_) => {
if is_auto_capture {
enums::AttemptStatus::Charged
} else {
enums::AttemptStatus::Authorized
}
}
DatatransResponse::ThreeDSResponse(_) => enums::AttemptStatus::AuthenticationPending,
}
}
| {
"crate": "hyperswitch_connectors",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 15,
"total_crates": null
} |
fn_clm_hyperswitch_connectors_create_mandate_details_6819115515883783815 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/datatrans/transformers
fn create_mandate_details(
item: &DatatransRouterData<&types::PaymentsAuthorizeRouterData>,
additional_card_details: &payments::AdditionalCardInfo,
) -> Result<DataTransPaymentDetails, error_stack::Report<errors::ConnectorError>> {
let alias = item.router_data.request.get_connector_mandate_id()?;
Ok(DataTransPaymentDetails::Mandate(MandateDetails {
res_type: "ALIAS".to_string(),
alias,
expiry_month: additional_card_details.card_exp_month.clone().ok_or(
errors::ConnectorError::MissingRequiredField {
field_name: "card_exp_month",
},
)?,
expiry_year: additional_card_details.get_card_expiry_year_2_digit()?,
}))
}
| {
"crate": "hyperswitch_connectors",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 12,
"total_crates": null
} |
fn_clm_hyperswitch_connectors_try_from_8914216065265372500 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/jpmorgan/transformers
// Implementation of RouterData<F, PaymentsCancelData, PaymentsResponseData> for TryFrom<ResponseRouterData<F, JpmorganCancelResponse, PaymentsCancelData, PaymentsResponseData>>
fn try_from(
item: ResponseRouterData<
F,
JpmorganCancelResponse,
PaymentsCancelData,
PaymentsResponseData,
>,
) -> Result<Self, Self::Error> {
let status = match item.response.response_status {
JpmorganResponseStatus::Success => common_enums::AttemptStatus::Voided,
JpmorganResponseStatus::Denied | JpmorganResponseStatus::Error => {
common_enums::AttemptStatus::Failure
}
};
Ok(Self {
status,
response: Ok(PaymentsResponseData::TransactionResponse {
resource_id: ResponseId::ConnectorTransactionId(
item.response.transaction_id.clone(),
),
redirection_data: Box::new(None),
mandate_reference: Box::new(None),
connector_metadata: None,
network_txn_id: None,
connector_response_reference_id: Some(item.response.transaction_id.clone()),
incremental_authorization_allowed: None,
charges: None,
}),
..item.data
})
}
| {
"crate": "hyperswitch_connectors",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 2667,
"total_crates": null
} |
fn_clm_hyperswitch_connectors_from_8914216065265372500 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/jpmorgan/transformers
// Implementation of RefundStatus for From<(JpmorganResponseStatus, JpmorganTransactionState)>
fn from(
(response_status, transaction_state): (JpmorganResponseStatus, JpmorganTransactionState),
) -> Self {
match response_status {
JpmorganResponseStatus::Success => match transaction_state {
JpmorganTransactionState::Voided | JpmorganTransactionState::Closed => {
Self::Succeeded
}
JpmorganTransactionState::Declined | JpmorganTransactionState::Error => {
Self::Failed
}
JpmorganTransactionState::Pending | JpmorganTransactionState::Authorized => {
Self::Processing
}
},
JpmorganResponseStatus::Denied | JpmorganResponseStatus::Error => 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_from_str_8914216065265372500 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/jpmorgan/transformers
// Implementation of ReversalReason for FromStr
fn from_str(s: &str) -> Result<Self, Self::Err> {
match s.to_uppercase().as_str() {
"NO_RESPONSE" => Ok(Self::NoResponse),
"LATE_RESPONSE" => Ok(Self::LateResponse),
"UNABLE_TO_DELIVER" => Ok(Self::UnableToDeliver),
"CARD_DECLINED" => Ok(Self::CardDeclined),
"MAC_NOT_VERIFIED" => Ok(Self::MacNotVerified),
"MAC_SYNC_ERROR" => Ok(Self::MacSyncError),
"ZEK_SYNC_ERROR" => Ok(Self::ZekSyncError),
"SYSTEM_MALFUNCTION" => Ok(Self::SystemMalfunction),
"SUSPECTED_FRAUD" => Ok(Self::SuspectedFraud),
_ => Err(report!(errors::ConnectorError::InvalidDataFormat {
field_name: "cancellation_reason",
})),
}
}
| {
"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_attempt_status_from_transaction_state_8914216065265372500 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/jpmorgan/transformers
pub fn attempt_status_from_transaction_state(
transaction_state: JpmorganTransactionState,
) -> common_enums::AttemptStatus {
match transaction_state {
JpmorganTransactionState::Authorized => common_enums::AttemptStatus::Authorized,
JpmorganTransactionState::Closed => common_enums::AttemptStatus::Charged,
JpmorganTransactionState::Declined | JpmorganTransactionState::Error => {
common_enums::AttemptStatus::Failure
}
JpmorganTransactionState::Pending => common_enums::AttemptStatus::Pending,
JpmorganTransactionState::Voided => common_enums::AttemptStatus::Voided,
}
}
| {
"crate": "hyperswitch_connectors",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 10,
"total_crates": null
} |
fn_clm_hyperswitch_connectors_map_capture_method_8914216065265372500 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/jpmorgan/transformers
fn map_capture_method(
capture_method: CaptureMethod,
) -> Result<CapMethod, error_stack::Report<errors::ConnectorError>> {
match capture_method {
CaptureMethod::Automatic => Ok(CapMethod::Now),
CaptureMethod::Manual => Ok(CapMethod::Manual),
CaptureMethod::Scheduled
| CaptureMethod::ManualMultiple
| CaptureMethod::SequentialAutomatic => {
Err(errors::ConnectorError::NotImplemented("Capture 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": 6,
"total_crates": null
} |
fn_clm_hyperswitch_connectors_try_from_1223109895731520677 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/bluesnap/transformers
// Implementation of Value for TryFrom<BluesnapWebhookObjectResource>
fn try_from(details: BluesnapWebhookObjectResource) -> Result<Self, Self::Error> {
let (card_transaction_type, processing_status, transaction_id) = match details
.transaction_type
{
BluesnapWebhookEvents::Decline | BluesnapWebhookEvents::CcChargeFailed => Ok((
BluesnapTxnType::Capture,
BluesnapProcessingStatus::Fail,
details.reference_number,
)),
BluesnapWebhookEvents::Charge => Ok((
BluesnapTxnType::Capture,
BluesnapProcessingStatus::Success,
details.reference_number,
)),
BluesnapWebhookEvents::Chargeback | BluesnapWebhookEvents::ChargebackStatusChanged => {
//It won't be consumed in dispute flow, so currently does not hold any significance
return serde_json::to_value(details)
.change_context(errors::ConnectorError::WebhookBodyDecodingFailed);
}
BluesnapWebhookEvents::Refund => Ok((
BluesnapTxnType::Refund,
BluesnapProcessingStatus::Success,
details
.reversal_ref_num
.ok_or(errors::ConnectorError::WebhookResourceObjectNotFound)?,
)),
BluesnapWebhookEvents::Unknown => {
Err(errors::ConnectorError::WebhookResourceObjectNotFound)
}
}?;
let sync_struct = BluesnapPaymentsResponse {
processing_info: ProcessingInfoResponse {
processing_status,
authorization_code: None,
network_transaction_id: None,
},
transaction_id,
card_transaction_type,
};
serde_json::to_value(sync_struct)
.change_context(errors::ConnectorError::WebhookBodyDecodingFailed)
}
| {
"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_1223109895731520677 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/bluesnap/transformers
// Implementation of utils::ErrorCodeAndMessage for From<ErrorDetails>
fn from(error: ErrorDetails) -> Self {
Self {
error_code: error.code.to_string(),
error_message: error.error_name.unwrap_or(error.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": 2604,
"total_crates": null
} |
fn_clm_hyperswitch_connectors_foreign_try_from_1223109895731520677 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/bluesnap/transformers
// Implementation of enums::AttemptStatus for ForeignTryFrom<(BluesnapTxnType, BluesnapProcessingStatus)>
fn foreign_try_from(
item: (BluesnapTxnType, BluesnapProcessingStatus),
) -> Result<Self, Self::Error> {
let (item_txn_status, item_processing_status) = item;
Ok(match item_processing_status {
BluesnapProcessingStatus::Success => match item_txn_status {
BluesnapTxnType::AuthOnly => Self::Authorized,
BluesnapTxnType::AuthReversal => Self::Voided,
BluesnapTxnType::AuthCapture | BluesnapTxnType::Capture => Self::Charged,
BluesnapTxnType::Refund => Self::Charged,
},
BluesnapProcessingStatus::Pending | BluesnapProcessingStatus::PendingMerchantReview => {
Self::Pending
}
BluesnapProcessingStatus::Fail => 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": 428,
"total_crates": null
} |
fn_clm_hyperswitch_connectors_convert_metadata_to_request_metadata_1223109895731520677 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/bluesnap/transformers
fn convert_metadata_to_request_metadata(metadata: Value) -> Vec<RequestMetadata> {
let hashmap: HashMap<Option<String>, Option<Value>> =
serde_json::from_str(&metadata.to_string()).unwrap_or(HashMap::new());
let mut vector = Vec::<RequestMetadata>::new();
for (key, value) in hashmap {
vector.push(RequestMetadata {
meta_key: key,
meta_value: value.map(|field_value| field_value.to_string()),
is_visible: Some(DISPLAY_METADATA.to_string()),
});
}
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": 18,
"total_crates": null
} |
fn_clm_hyperswitch_connectors_get_card_holder_info_1223109895731520677 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/bluesnap/transformers
fn get_card_holder_info(
address: &AddressDetails,
email: Email,
) -> CustomResult<Option<BluesnapCardHolderInfo>, errors::ConnectorError> {
let first_name = address.get_first_name()?;
Ok(Some(BluesnapCardHolderInfo {
first_name: first_name.clone(),
last_name: address.get_last_name().unwrap_or(first_name).clone(),
email,
}))
}
| {
"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_default_4025920810496437989 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/wise/transformers
// Implementation of WiseHttpStatus for Default
fn default() -> Self {
Self::String("".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": 7707,
"total_crates": null
} |
fn_clm_hyperswitch_connectors_try_from_4025920810496437989 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/wise/transformers
// Implementation of PayoutsRouterData<F> for TryFrom<PayoutsResponseRouterData<F, WisePayoutSyncResponse>>
fn try_from(
item: PayoutsResponseRouterData<F, WisePayoutSyncResponse>,
) -> Result<Self, Self::Error> {
Ok(Self {
response: Ok(PayoutsResponseData {
status: Some(PayoutStatus::from(item.response.status)),
connector_payout_id: Some(item.response.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_4025920810496437989 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/wise/transformers
// Implementation of WisePayoutSyncResponse for From<WisePayoutsWebhookData>
fn from(data: WisePayoutsWebhookData) -> Self {
Self {
id: data.resource.id,
status: data.current_state,
}
}
| {
"crate": "hyperswitch_connectors",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 2600,
"total_crates": null
} |
fn_clm_hyperswitch_connectors_get_status_4025920810496437989 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/wise/transformers
// Inherent implementation for WiseHttpStatus
pub fn get_status(&self) -> String {
match self {
Self::String(val) => val.clone(),
Self::Number(val) => val.to_string(),
}
}
| {
"crate": "hyperswitch_connectors",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 37,
"total_crates": null
} |
fn_clm_hyperswitch_connectors_get_payout_bank_details_4025920810496437989 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/wise/transformers
fn get_payout_bank_details(
payout_method_data: PayoutMethodData,
address: Option<&hyperswitch_domain_models::address::Address>,
entity_type: PayoutEntityType,
) -> Result<WiseBankDetails, ConnectorError> {
let wise_address_details = match get_payout_address_details(address) {
Some(a) => Ok(a),
None => Err(ConnectorError::MissingRequiredField {
field_name: "address",
}),
}?;
match payout_method_data {
PayoutMethodData::Bank(Bank::Ach(b)) => Ok(WiseBankDetails {
legal_type: LegalType::from(entity_type),
address: Some(wise_address_details),
account_number: Some(b.bank_account_number.to_owned()),
abartn: Some(b.bank_routing_number),
account_type: Some(AccountType::Checking),
..WiseBankDetails::default()
}),
PayoutMethodData::Bank(Bank::Bacs(b)) => Ok(WiseBankDetails {
legal_type: LegalType::from(entity_type),
address: Some(wise_address_details),
account_number: Some(b.bank_account_number.to_owned()),
sort_code: Some(b.bank_sort_code),
..WiseBankDetails::default()
}),
PayoutMethodData::Bank(Bank::Sepa(b)) => Ok(WiseBankDetails {
legal_type: LegalType::from(entity_type),
address: Some(wise_address_details),
iban: Some(b.iban.to_owned()),
bic: b.bic,
..WiseBankDetails::default()
}),
_ => Err(ConnectorError::NotImplemented(
get_unimplemented_payment_method_error_message("Wise"),
))?,
}
}
| {
"crate": "hyperswitch_connectors",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 24,
"total_crates": null
} |
fn_clm_hyperswitch_connectors_try_from_6769890325808188247 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/placetopay/transformers
// Implementation of PlacetopayNextActionRequest for TryFrom<&types::PaymentsCancelRouterData>
fn try_from(item: &types::PaymentsCancelRouterData) -> Result<Self, Self::Error> {
let auth = PlacetopayAuth::try_from(&item.connector_auth_type)?;
let internal_reference = item
.request
.connector_transaction_id
.parse::<u64>()
.change_context(errors::ConnectorError::RequestEncodingFailed)?;
let action = PlacetopayNextAction::Void;
Ok(Self {
auth,
internal_reference,
action,
})
}
| {
"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_6769890325808188247 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/placetopay/transformers
// Implementation of enums::RefundStatus for From<PlacetopayRefundStatus>
fn from(item: PlacetopayRefundStatus) -> Self {
match item {
PlacetopayRefundStatus::Ok
| PlacetopayRefundStatus::Approved
| PlacetopayRefundStatus::Refunded => Self::Success,
PlacetopayRefundStatus::Failed
| PlacetopayRefundStatus::Rejected
| PlacetopayRefundStatus::Error => Self::Failure,
PlacetopayRefundStatus::Pending
| PlacetopayRefundStatus::PendingProcess
| PlacetopayRefundStatus::PendingValidation => Self::Pending,
}
}
| {
"crate": "hyperswitch_connectors",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 2600,
"total_crates": null
} |
fn_clm_hyperswitch_connectors_try_from_-3902790815917527718 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/worldline/transformers
// Implementation of RefundsRouterData<RSync> for TryFrom<RefundsResponseRouterData<RSync, RefundResponse>>
fn try_from(
item: RefundsResponseRouterData<RSync, RefundResponse>,
) -> Result<Self, Self::Error> {
let refund_status = common_enums::enums::RefundStatus::from(item.response.status);
Ok(Self {
response: Ok(RefundsResponseData {
connector_refund_id: item.response.id.clone(),
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": 2661,
"total_crates": null
} |
fn_clm_hyperswitch_connectors_from_-3902790815917527718 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/worldline/transformers
// Implementation of common_enums::enums::RefundStatus for From<RefundStatus>
fn from(item: RefundStatus) -> Self {
match item {
RefundStatus::Refunded => Self::Success,
RefundStatus::Cancelled | RefundStatus::Rejected => 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_address_-3902790815917527718 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/worldline/transformers
fn get_address(
billing: &hyperswitch_domain_models::address::Address,
) -> Option<(
&hyperswitch_domain_models::address::Address,
&hyperswitch_domain_models::address::AddressDetails,
)> {
let address = billing.address.as_ref()?;
address.country.as_ref()?;
Some((billing, address))
}
| {
"crate": "hyperswitch_connectors",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 31,
"total_crates": null
} |
fn_clm_hyperswitch_connectors_make_bank_redirect_request_-3902790815917527718 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/worldline/transformers
fn make_bank_redirect_request(
req: &PaymentsAuthorizeRouterData,
bank_redirect: &BankRedirectData,
) -> Result<RedirectPaymentMethod, error_stack::Report<errors::ConnectorError>> {
let return_url = req.request.router_return_url.clone();
let redirection_data = RedirectionData { return_url };
let (payment_method_specific_data, payment_product_id) = match bank_redirect {
BankRedirectData::Giropay {
bank_account_iban, ..
} => (
{
PaymentMethodSpecificData::PaymentProduct816SpecificInput(Box::new(Giropay {
bank_account_iban: BankAccountIban {
account_holder_name: req.get_billing_full_name()?.to_owned(),
iban: bank_account_iban.clone(),
},
}))
},
816,
),
BankRedirectData::Ideal { bank_name, .. } => (
{
PaymentMethodSpecificData::PaymentProduct809SpecificInput(Box::new(Ideal {
issuer_id: bank_name
.map(|bank_name| WorldlineBic::try_from(&bank_name))
.transpose()?,
}))
},
809,
),
BankRedirectData::BancontactCard { .. }
| BankRedirectData::Bizum {}
| BankRedirectData::Blik { .. }
| BankRedirectData::Eft { .. }
| BankRedirectData::Eps { .. }
| BankRedirectData::Interac { .. }
| BankRedirectData::OnlineBankingCzechRepublic { .. }
| BankRedirectData::OnlineBankingFinland { .. }
| BankRedirectData::OnlineBankingPoland { .. }
| BankRedirectData::OnlineBankingSlovakia { .. }
| BankRedirectData::OpenBankingUk { .. }
| BankRedirectData::Przelewy24 { .. }
| BankRedirectData::Sofort { .. }
| BankRedirectData::Trustly { .. }
| BankRedirectData::OnlineBankingFpx { .. }
| BankRedirectData::OnlineBankingThailand { .. }
| BankRedirectData::LocalBankRedirect {} => {
return Err(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message("worldline"),
)
.into())
}
};
Ok(RedirectPaymentMethod {
payment_product_id,
redirection_data,
payment_method_specific_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": 28,
"total_crates": null
} |
fn_clm_hyperswitch_connectors_build_customer_info_-3902790815917527718 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/worldline/transformers
fn build_customer_info(
billing_address: &hyperswitch_domain_models::address::Address,
email: &Option<Email>,
) -> Result<Customer, error_stack::Report<errors::ConnectorError>> {
let (billing, address) =
get_address(billing_address).ok_or(errors::ConnectorError::MissingRequiredField {
field_name: "billing.address.country",
})?;
let number_with_country_code = billing.phone.as_ref().and_then(|phone| {
phone.number.as_ref().and_then(|number| {
phone
.country_code
.as_ref()
.map(|cc| Secret::new(format!("{}{}", cc, number.peek())))
})
});
Ok(Customer {
billing_address: BillingAddress {
..address.clone().into()
},
contact_details: Some(ContactDetails {
mobile_phone_number: number_with_country_code,
email_address: email.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": 24,
"total_crates": null
} |
fn_clm_hyperswitch_connectors_try_from_-6348956827757972426 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/deutschebank/transformers
// Implementation of RefundsRouterData<RSync> for TryFrom<RefundsResponseRouterData<RSync, DeutschebankPaymentsResponse>>
fn try_from(
item: RefundsResponseRouterData<RSync, DeutschebankPaymentsResponse>,
) -> Result<Self, Self::Error> {
let response_code = item.response.rc.clone();
let status = if is_response_success(&response_code) {
item.response
.tx_action
.and_then(|tx_action| match tx_action {
DeutschebankTXAction::Credit | DeutschebankTXAction::Refund => {
Some(enums::RefundStatus::Success)
}
DeutschebankTXAction::Preauthorization
| DeutschebankTXAction::Authorization
| DeutschebankTXAction::Capture
| DeutschebankTXAction::Reversal
| DeutschebankTXAction::RiskCheck
| DeutschebankTXAction::VerifyMop
| DeutschebankTXAction::Payment
| DeutschebankTXAction::AccountInformation => None,
})
} else {
Some(enums::RefundStatus::Failure)
};
match status {
Some(enums::RefundStatus::Failure) => Ok(Self {
status: common_enums::AttemptStatus::Failure,
response: Err(get_error_response(
response_code.clone(),
item.response.message.clone(),
item.http_code,
)),
..item.data
}),
Some(refund_status) => Ok(Self {
response: Ok(RefundsResponseData {
refund_status,
connector_refund_id: item.data.request.get_connector_refund_id()?,
}),
..item.data
}),
None => Ok(Self { ..item.data }),
}
}
| {
"crate": "hyperswitch_connectors",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 2671,
"total_crates": null
} |
fn_clm_hyperswitch_connectors_from_-6348956827757972426 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/deutschebank/transformers
// Implementation of common_enums::AttemptStatus for From<DeutschebankSEPAMandateStatus>
fn from(item: DeutschebankSEPAMandateStatus) -> Self {
match item {
DeutschebankSEPAMandateStatus::Active
| DeutschebankSEPAMandateStatus::Created
| DeutschebankSEPAMandateStatus::PendingApproval
| DeutschebankSEPAMandateStatus::PendingSecondaryApproval
| DeutschebankSEPAMandateStatus::PendingReview
| DeutschebankSEPAMandateStatus::PendingSubmission
| DeutschebankSEPAMandateStatus::Submitted => Self::AuthenticationPending,
DeutschebankSEPAMandateStatus::Failed
| DeutschebankSEPAMandateStatus::Discarded
| DeutschebankSEPAMandateStatus::Expired
| DeutschebankSEPAMandateStatus::Replaced => Self::Failure,
}
}
| {
"crate": "hyperswitch_connectors",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 2600,
"total_crates": null
} |
fn_clm_hyperswitch_connectors_get_error_response_-6348956827757972426 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/deutschebank/transformers
fn get_error_response(error_code: String, error_reason: String, status_code: u16) -> ErrorResponse {
ErrorResponse {
code: error_code.to_string(),
message: error_reason.clone(),
reason: Some(error_reason),
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_is_response_success_-6348956827757972426 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/deutschebank/transformers
fn is_response_success(rc: &String) -> bool {
rc == "0"
}
| {
"crate": "hyperswitch_connectors",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 3,
"total_crates": null
} |
fn_clm_hyperswitch_connectors_try_from_3558860583063491398 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/razorpay/transformers
// Implementation of types::RefundsRouterData<RSync> for TryFrom<RefundsResponseRouterData<RSync, RazorpayRefundResponse>>
fn try_from(
item: RefundsResponseRouterData<RSync, RazorpayRefundResponse>,
) -> 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_3558860583063491398 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/razorpay/transformers
// Implementation of enums::RefundStatus for From<RazorpayRefundStatus>
fn from(item: RazorpayRefundStatus) -> Self {
match item {
RazorpayRefundStatus::Processed => Self::Success,
RazorpayRefundStatus::Pending | RazorpayRefundStatus::Created => Self::Pending,
RazorpayRefundStatus::Failed => 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_wait_screen_metadata_3558860583063491398 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/razorpay/transformers
pub fn get_wait_screen_metadata() -> CustomResult<Option<serde_json::Value>, errors::ConnectorError>
{
let current_time = OffsetDateTime::now_utc().unix_timestamp_nanos();
Ok(Some(serde_json::json!(WaitScreenData {
display_from_timestamp: current_time,
display_to_timestamp: Some(current_time + Duration::minutes(5).whole_nanoseconds()),
poll_config: Some(PollConfig {
delay_in_secs: 5,
frequency: 5,
}),
})))
}
| {
"crate": "hyperswitch_connectors",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 17,
"total_crates": null
} |
fn_clm_hyperswitch_connectors_get_psync_razorpay_payment_status_3558860583063491398 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/razorpay/transformers
fn get_psync_razorpay_payment_status(razorpay_status: RazorpayStatus) -> enums::AttemptStatus {
match razorpay_status {
RazorpayStatus::Created => enums::AttemptStatus::Pending,
RazorpayStatus::Authorized => enums::AttemptStatus::Authorized,
RazorpayStatus::Captured | RazorpayStatus::Refunded => enums::AttemptStatus::Charged,
RazorpayStatus::Failed => enums::AttemptStatus::Failure,
}
}
| {
"crate": "hyperswitch_connectors",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 0,
"total_crates": null
} |
fn_clm_hyperswitch_connectors_try_from_709873725996752203 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/blackhawknetwork/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_709873725996752203 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/blackhawknetwork/transformers
// Implementation of common_enums::AttemptStatus for From<AccountStatus>
fn from(item: AccountStatus) -> Self {
match item {
AccountStatus::New | AccountStatus::Activated => Self::Pending,
AccountStatus::Closed => Self::Failure,
}
}
| {
"crate": "hyperswitch_connectors",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 2600,
"total_crates": null
} |
fn_clm_hyperswitch_connectors_try_from_-4849105239816572284 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/nexinets/transformers
// Implementation of RefundsRouterData<RSync> for TryFrom<RefundsResponseRouterData<RSync, NexinetsRefundResponse>>
fn try_from(
item: RefundsResponseRouterData<RSync, NexinetsRefundResponse>,
) -> 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_-4849105239816572284 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/nexinets/transformers
// Implementation of enums::RefundStatus for From<RefundStatus>
fn from(item: RefundStatus) -> Self {
match item {
RefundStatus::Success => Self::Success,
RefundStatus::Failure | RefundStatus::Declined => Self::Failure,
RefundStatus::InProgress | RefundStatus::Ok => 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_card_data_-4849105239816572284 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/nexinets/transformers
fn get_card_data(
item: &PaymentsAuthorizeRouterData,
card: &Card,
) -> Result<NexinetsPaymentDetails, errors::ConnectorError> {
let (card_data, cof_contract) = match item.request.is_mandate_payment() {
true => {
let card_data = match item.request.off_session {
Some(true) => CardDataDetails::PaymentInstrument(Box::new(PaymentInstrument {
payment_instrument_id: item.request.connector_mandate_id().map(Secret::new),
})),
_ => CardDataDetails::CardDetails(Box::new(get_card_details(card)?)),
};
let cof_contract = Some(CofContract {
recurring_type: RecurringType::Unscheduled,
});
(card_data, cof_contract)
}
false => (
CardDataDetails::CardDetails(Box::new(get_card_details(card)?)),
None,
),
};
Ok(NexinetsPaymentDetails::Card(Box::new(NexiCardDetails {
card_data,
cof_contract,
})))
}
| {
"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_payment_details_and_product_-4849105239816572284 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/nexinets/transformers
fn get_payment_details_and_product(
item: &PaymentsAuthorizeRouterData,
) -> Result<
(Option<NexinetsPaymentDetails>, NexinetsProduct),
error_stack::Report<errors::ConnectorError>,
> {
match &item.request.payment_method_data {
PaymentMethodData::Card(card) => Ok((
Some(get_card_data(item, card)?),
NexinetsProduct::Creditcard,
)),
PaymentMethodData::Wallet(wallet) => Ok(get_wallet_details(wallet)?),
PaymentMethodData::BankRedirect(bank_redirect) => match bank_redirect {
BankRedirectData::Eps { .. } => Ok((None, NexinetsProduct::Eps)),
BankRedirectData::Giropay { .. } => Ok((None, NexinetsProduct::Giropay)),
BankRedirectData::Ideal { bank_name, .. } => Ok((
Some(NexinetsPaymentDetails::BankRedirects(Box::new(
NexinetsBankRedirects {
bic: bank_name
.map(|bank_name| NexinetsBIC::try_from(&bank_name))
.transpose()?,
},
))),
NexinetsProduct::Ideal,
)),
BankRedirectData::Sofort { .. } => Ok((None, NexinetsProduct::Sofort)),
BankRedirectData::BancontactCard { .. }
| BankRedirectData::Blik { .. }
| BankRedirectData::Bizum { .. }
| BankRedirectData::Eft { .. }
| BankRedirectData::Interac { .. }
| BankRedirectData::OnlineBankingCzechRepublic { .. }
| BankRedirectData::OnlineBankingFinland { .. }
| BankRedirectData::OnlineBankingPoland { .. }
| BankRedirectData::OnlineBankingSlovakia { .. }
| BankRedirectData::OpenBankingUk { .. }
| BankRedirectData::Przelewy24 { .. }
| BankRedirectData::Trustly { .. }
| BankRedirectData::OnlineBankingFpx { .. }
| BankRedirectData::OnlineBankingThailand { .. }
| BankRedirectData::LocalBankRedirect {} => {
Err(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message("nexinets"),
))?
}
},
PaymentMethodData::CardRedirect(_)
| PaymentMethodData::PayLater(_)
| PaymentMethodData::BankDebit(_)
| PaymentMethodData::BankTransfer(_)
| PaymentMethodData::Crypto(_)
| PaymentMethodData::MandatePayment
| PaymentMethodData::Reward
| PaymentMethodData::RealTimePayment(_)
| PaymentMethodData::MobilePayment(_)
| PaymentMethodData::Upi(_)
| PaymentMethodData::Voucher(_)
| PaymentMethodData::GiftCard(_)
| PaymentMethodData::OpenBanking(_)
| PaymentMethodData::CardToken(_)
| PaymentMethodData::NetworkToken(_)
| PaymentMethodData::CardDetailsForNetworkTransactionId(_) => {
Err(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message("nexinets"),
))?
}
}
}
| {
"crate": "hyperswitch_connectors",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 22,
"total_crates": null
} |
fn_clm_hyperswitch_connectors_get_card_details_-4849105239816572284 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/nexinets/transformers
fn get_card_details(req_card: &Card) -> Result<CardDetails, errors::ConnectorError> {
Ok(CardDetails {
card_number: req_card.card_number.clone(),
expiry_month: req_card.card_exp_month.clone(),
expiry_year: req_card.get_card_expiry_year_2_digit()?,
verification: req_card.card_cvc.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": 20,
"total_crates": null
} |
fn_clm_hyperswitch_connectors_try_from_5519140550252344944 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/hyperswitch_vault/transformers
// Implementation of RouterData<F, T, PaymentsResponseData> for TryFrom<ResponseRouterData<F, HyperswitchVaultCustomerCreateResponse, T, PaymentsResponseData>>
fn try_from(
item: ResponseRouterData<
F,
HyperswitchVaultCustomerCreateResponse,
T,
PaymentsResponseData,
>,
) -> Result<Self, Self::Error> {
Ok(Self {
response: Ok(PaymentsResponseData::ConnectorCustomerResponse(
ConnectorCustomerResponseData::new_with_customer_id(item.response.id),
)),
..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_try_from_-5609781582129844522 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/plaid/transformers
// Implementation of RouterData<F, T, PaymentsResponseData> for TryFrom<ResponseRouterData<F, PlaidSyncResponse, T, PaymentsResponseData>>
fn try_from(
item: ResponseRouterData<F, PlaidSyncResponse, T, PaymentsResponseData>,
) -> Result<Self, Self::Error> {
let status = AttemptStatus::from(item.response.status.clone());
Ok(Self {
status,
response: if is_payment_failure(status) {
Err(ErrorResponse {
// populating status everywhere as plaid only sends back a status
code: item.response.status.clone().to_string(),
message: item.response.status.clone().to_string(),
reason: Some(item.response.status.to_string()),
status_code: item.http_code,
attempt_status: None,
connector_transaction_id: Some(item.response.payment_id),
network_advice_code: None,
network_decline_code: None,
network_error_message: None,
connector_metadata: None,
})
} else {
Ok(PaymentsResponseData::TransactionResponse {
resource_id: ResponseId::ConnectorTransactionId(
item.response.payment_id.clone(),
),
redirection_data: Box::new(None),
mandate_reference: Box::new(None),
connector_metadata: None,
network_txn_id: None,
connector_response_reference_id: Some(item.response.payment_id),
incremental_authorization_allowed: None,
charges: None,
})
},
..item.data
})
}
| {
"crate": "hyperswitch_connectors",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 2681,
"total_crates": null
} |
fn_clm_hyperswitch_connectors_from_-5609781582129844522 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/plaid/transformers
// Implementation of AttemptStatus for From<PlaidPaymentStatus>
fn from(item: PlaidPaymentStatus) -> Self {
match item {
PlaidPaymentStatus::PaymentStatusAuthorising => Self::Authorizing,
PlaidPaymentStatus::PaymentStatusBlocked
| PlaidPaymentStatus::PaymentStatusInsufficientFunds
| PlaidPaymentStatus::PaymentStatusRejected => Self::AuthorizationFailed,
PlaidPaymentStatus::PaymentStatusCancelled => Self::Voided,
PlaidPaymentStatus::PaymentStatusEstablished => Self::Authorized,
PlaidPaymentStatus::PaymentStatusExecuted
| PlaidPaymentStatus::PaymentStatusSettled
| PlaidPaymentStatus::PaymentStatusInitiated => Self::Charged,
PlaidPaymentStatus::PaymentStatusFailed => Self::Failure,
PlaidPaymentStatus::PaymentStatusInputNeeded => Self::AuthenticationPending,
}
}
| {
"crate": "hyperswitch_connectors",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 2600,
"total_crates": null
} |
fn_clm_hyperswitch_connectors_try_from_7420875797493696976 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/affirm/transformers
// Implementation of RouterData<F, PaymentsCancelData, PaymentsResponseData> for TryFrom<ResponseRouterData<F, AffirmCancelResponse, PaymentsCancelData, PaymentsResponseData>>
fn try_from(
item: ResponseRouterData<F, AffirmCancelResponse, PaymentsCancelData, PaymentsResponseData>,
) -> Result<Self, Self::Error> {
Ok(Self {
status: enums::AttemptStatus::from(item.response.event_type.clone()),
response: Ok(PaymentsResponseData::TransactionResponse {
resource_id: ResponseId::ConnectorTransactionId(item.response.id),
redirection_data: Box::new(None),
mandate_reference: Box::new(None),
connector_metadata: None,
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
charges: None,
}),
..item.data
})
}
| {
"crate": "hyperswitch_connectors",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 2667,
"total_crates": null
} |
fn_clm_hyperswitch_connectors_from_7420875797493696976 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/affirm/transformers
// Implementation of enums::AttemptStatus for From<AffirmEventType>
fn from(event_type: AffirmEventType) -> Self {
match event_type {
AffirmEventType::Auth => Self::Authorized,
AffirmEventType::Capture | AffirmEventType::SplitCapture | AffirmEventType::Confirm => {
Self::Charged
}
AffirmEventType::AuthExpired
| AffirmEventType::ChargeOff
| AffirmEventType::ConfirmationExpired
| AffirmEventType::ExpireAuthorization
| AffirmEventType::ExpireConfirmation => Self::Failure,
AffirmEventType::Refund | AffirmEventType::RefundVoided => Self::AutoRefunded,
AffirmEventType::Update => Self::Pending,
AffirmEventType::Void | AffirmEventType::PartialVoid => 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": 2600,
"total_crates": null
} |
fn_clm_hyperswitch_connectors_try_from_-2921701150417667404 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/trustpayments/transformers
// Implementation of RouterData<
hyperswitch_domain_models::router_flow_types::payments::PaymentMethodToken,
hyperswitch_domain_models::router_request_types::PaymentMethodTokenizationData,
PaymentsResponseData,
> for TryFrom<
ResponseRouterData<
hyperswitch_domain_models::router_flow_types::payments::PaymentMethodToken,
TrustpaymentsTokenizationResponse,
hyperswitch_domain_models::router_request_types::PaymentMethodTokenizationData,
PaymentsResponseData,
>,
>
fn try_from(
item: ResponseRouterData<
hyperswitch_domain_models::router_flow_types::payments::PaymentMethodToken,
TrustpaymentsTokenizationResponse,
hyperswitch_domain_models::router_request_types::PaymentMethodTokenizationData,
PaymentsResponseData,
>,
) -> Result<Self, Self::Error> {
let response_data = item
.response
.responses
.first()
.ok_or(errors::ConnectorError::ResponseDeserializationFailed)?;
let status = response_data.get_payment_status();
let token = response_data
.transactionreference
.clone()
.unwrap_or_else(|| "unknown".to_string());
Ok(Self {
status,
response: Ok(PaymentsResponseData::TokenizationResponse { token }),
..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": 2669,
"total_crates": null
} |
fn_clm_hyperswitch_connectors_from_-2921701150417667404 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/trustpayments/transformers
// Implementation of TrustpaymentsErrorResponse for From<TrustpaymentsPaymentResponseData>
fn from(response: TrustpaymentsPaymentResponseData) -> Self {
let error_reason = response.get_error_reason();
Self {
status_code: if response.errorcode.is_success() {
200
} else {
400
},
code: response.errorcode.to_string(),
message: response.errormessage,
reason: error_reason,
network_advice_code: None,
network_decline_code: None,
network_error_message: None,
}
}
| {
"crate": "hyperswitch_connectors",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 2606,
"total_crates": null
} |
fn_clm_hyperswitch_connectors_as_str_-2921701150417667404 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/trustpayments/transformers
// Implementation of None for TrustpaymentsErrorCode
pub fn as_str(&self) -> &str {
match self {
Self::Success => "0",
Self::InvalidCredentials => "30000",
Self::AuthenticationFailed => "30001",
Self::InvalidSiteReference => "30002",
Self::AccessDenied => "30003",
Self::InvalidUsernameOrPassword => "30004",
Self::AccountSuspended => "30005",
Self::MissingRequiredField => "50000",
Self::InvalidFieldFormat => "50001",
Self::InvalidFieldValue => "50002",
Self::FieldTooLong => "50003",
Self::FieldTooShort => "50004",
Self::InvalidCurrency => "50005",
Self::InvalidAmount => "50006",
Self::GeneralProcessingError => "60000",
Self::SystemError => "60001",
Self::CommunicationError => "60002",
Self::Timeout => "60003",
Self::Processing => "60004",
Self::InvalidRequest => "60005",
Self::NoSearchableFilter => "60019",
Self::InvalidCardNumber => "70000",
Self::InvalidExpiryDate => "70001",
Self::InvalidSecurityCode => "70002",
Self::InvalidCardType => "70003",
Self::CardExpired => "70004",
Self::InsufficientFunds => "70005",
Self::CardDeclined => "70006",
Self::CardRestricted => "70007",
Self::InvalidMerchant => "70008",
Self::TransactionNotPermitted => "70009",
Self::ExceedsWithdrawalLimit => "70010",
Self::SecurityViolation => "70011",
Self::LostOrStolenCard => "70012",
Self::SuspectedFraud => "70013",
Self::ContactCardIssuer => "70014",
Self::InvalidAmountValue => "70015",
Self::Unknown(code) => code,
}
}
| {
"crate": "hyperswitch_connectors",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 1242,
"total_crates": null
} |
fn_clm_hyperswitch_connectors_get_error_message_-2921701150417667404 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/trustpayments/transformers
// Inherent implementation for TrustpaymentsPaymentResponseData
pub fn get_error_message(&self) -> String {
if self.errorcode.is_success() {
"Success".to_string()
} else {
format!("Error {}: {}", self.errorcode, self.errormessage)
}
}
| {
"crate": "hyperswitch_connectors",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 208,
"total_crates": null
} |
fn_clm_hyperswitch_connectors_get_error_reason_-2921701150417667404 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/trustpayments/transformers
// Inherent implementation for TrustpaymentsPaymentResponseData
pub fn get_error_reason(&self) -> Option<String> {
if !self.errorcode.is_success() {
Some(self.errorcode.get_description().to_string())
} else {
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": 72,
"total_crates": null
} |
fn_clm_hyperswitch_connectors_try_from_5769741304521796125 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/nuvei/transformers
// Implementation of types::PayoutsRouterData<PoFulfill> for TryFrom<PayoutsResponseRouterData<PoFulfill, NuveiPayoutResponse>>
fn try_from(
item: PayoutsResponseRouterData<PoFulfill, NuveiPayoutResponse>,
) -> Result<Self, Self::Error> {
let response = &item.response;
match response {
NuveiPayoutResponse::NuveiPayoutSuccessResponse(response_data) => Ok(Self {
response: Ok(PayoutsResponseData {
status: Some(enums::PayoutStatus::from(
response_data.transaction_status.clone(),
)),
connector_payout_id: Some(response_data.transaction_id.clone()),
payout_eligible: None,
should_add_next_step_to_process_tracker: false,
error_code: None,
error_message: None,
payout_connector_metadata: None,
}),
..item.data
}),
NuveiPayoutResponse::NuveiPayoutErrorResponse(error_response_data) => Ok(Self {
response: Ok(PayoutsResponseData {
status: Some(enums::PayoutStatus::from(
error_response_data.status.clone(),
)),
connector_payout_id: None,
payout_eligible: None,
should_add_next_step_to_process_tracker: false,
error_code: Some(error_response_data.err_code.to_string()),
error_message: error_response_data.reason.clone(),
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": 2671,
"total_crates": null
} |
fn_clm_hyperswitch_connectors_from_5769741304521796125 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/nuvei/transformers
// Implementation of enums::PayoutStatus for From<NuveiPaymentStatus>
fn from(item: NuveiPaymentStatus) -> Self {
match item {
NuveiPaymentStatus::Success => Self::Success,
NuveiPaymentStatus::Failed | NuveiPaymentStatus::Error => Self::Failed,
NuveiPaymentStatus::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_foreign_try_from_5769741304521796125 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/nuvei/transformers
// Implementation of NuveiPaymentsRequest for ForeignTryFrom<(
AlternativePaymentMethodType,
Option<BankRedirectData>,
&RouterData<F, Req, PaymentsResponseData>,
)>
fn foreign_try_from(
data: (
AlternativePaymentMethodType,
Option<BankRedirectData>,
&RouterData<F, Req, PaymentsResponseData>,
),
) -> Result<Self, Self::Error> {
let (payment_method, redirect, item) = data;
let bank_id = match (&payment_method, redirect) {
(AlternativePaymentMethodType::Expresscheckout, _) => None,
(AlternativePaymentMethodType::Giropay, _) => None,
(AlternativePaymentMethodType::Sofort, _) | (AlternativePaymentMethodType::Eps, _) => {
let address = item.get_billing_address()?;
address.get_first_name()?;
item.request.get_email_required()?;
item.get_billing_country()?;
None
}
(
AlternativePaymentMethodType::Ideal,
Some(BankRedirectData::Ideal { bank_name, .. }),
) => {
let address = item.get_billing_address()?;
address.get_first_name()?;
item.request.get_email_required()?;
item.get_billing_country()?;
bank_name.map(NuveiBIC::try_from).transpose()?
}
_ => Err(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message("Nuvei"),
))?,
};
let billing_address: Option<BillingAddress> =
item.get_billing().ok().map(|billing| billing.into());
Ok(Self {
payment_option: PaymentOption {
alternative_payment_method: Some(AlternativePaymentMethod {
payment_method,
bank_id,
}),
..Default::default()
},
billing_address,
..Default::default()
})
}
| {
"crate": "hyperswitch_connectors",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 464,
"total_crates": null
} |
fn_clm_hyperswitch_connectors_get_card_info_5769741304521796125 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/nuvei/transformers
fn get_card_info<F, Req>(
item: &RouterData<F, Req, PaymentsResponseData>,
card_details: &payment_method_data::Card,
) -> Result<NuveiPaymentsRequest, error_stack::Report<errors::ConnectorError>>
where
Req: NuveiAuthorizePreprocessingCommon,
{
let browser_information = item.request.get_browser_info().clone();
let related_transaction_id = if item.is_three_ds() {
item.request.get_related_transaction_id().clone()
} else {
None
};
let address: Option<&AddressDetails> = item
.get_optional_billing()
.and_then(|billing_details| billing_details.address.as_ref());
if let Some(address) = address {
// mandatory fields check
address.get_first_name()?;
item.request.get_email_required()?;
item.get_billing_country()?;
}
let (is_rebilling, additional_params, user_token_id) =
match item.request.is_customer_initiated_mandate_payment() {
true => {
(
Some(IsRebilling::False), // In case of first installment, rebilling should be 0
Some(V2AdditionalParams {
rebill_expiry: Some(
time::OffsetDateTime::now_utc()
.replace_year(time::OffsetDateTime::now_utc().year() + 5)
.map_err(|_| errors::ConnectorError::DateFormattingFailed)?
.date()
.format(&time::macros::format_description!("[year][month][day]"))
.map_err(|_| errors::ConnectorError::DateFormattingFailed)?,
),
rebill_frequency: Some("0".to_string()),
challenge_window_size: Some(CHALLENGE_WINDOW_SIZE.to_string()),
challenge_preference: Some(CHALLENGE_PREFERENCE.to_string()),
}),
item.request.get_customer_id_optional(),
)
}
// non mandate transactions
false => (
None,
Some(V2AdditionalParams {
rebill_expiry: None,
rebill_frequency: None,
challenge_window_size: Some(CHALLENGE_WINDOW_SIZE.to_string()),
challenge_preference: Some(CHALLENGE_PREFERENCE.to_string()),
}),
None,
),
};
let three_d = if let Some(auth_data) = item.request.get_auth_data()? {
Some(ThreeD {
external_mpi: Some(ExternalMpi {
eci: auth_data.eci,
cavv: auth_data.cavv,
ds_trans_id: auth_data.ds_trans_id,
challenge_preference: None,
exemption_request_reason: None,
}),
..Default::default()
})
} else if item.is_three_ds() {
let browser_details = match &browser_information {
Some(browser_info) => Some(BrowserDetails {
accept_header: browser_info.get_accept_header()?,
ip: browser_info.get_ip_address()?,
java_enabled: browser_info.get_java_enabled()?.to_string().to_uppercase(),
java_script_enabled: browser_info
.get_java_script_enabled()?
.to_string()
.to_uppercase(),
language: browser_info.get_language()?,
screen_height: browser_info.get_screen_height()?,
screen_width: browser_info.get_screen_width()?,
color_depth: browser_info.get_color_depth()?,
user_agent: browser_info.get_user_agent()?,
time_zone: browser_info.get_time_zone()?,
}),
None => None,
};
Some(ThreeD {
browser_details,
v2_additional_params: additional_params,
notification_url: item.request.get_complete_authorize_url().clone(),
merchant_url: Some(item.request.get_return_url_required()?),
platform_type: Some(PlatformType::Browser),
method_completion_ind: Some(MethodCompletion::Unavailable),
..Default::default()
})
} else {
None
};
let is_moto = item.request.get_is_moto();
Ok(NuveiPaymentsRequest {
related_transaction_id,
is_rebilling,
user_token_id,
device_details: DeviceDetails::foreign_try_from(&item.request.get_browser_info().clone())?,
payment_option: PaymentOption::from(NuveiCardDetails {
card: card_details.clone(),
three_d,
card_holder_name: item.get_optional_billing_full_name(),
stored_credentials: item.request.get_is_stored_credential(),
}),
is_moto,
..Default::default()
})
}
| {
"crate": "hyperswitch_connectors",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 143,
"total_crates": null
} |
fn_clm_hyperswitch_connectors_y_from(
_5769741304521796125 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/nuvei/transformers
// Implementation of pes::RefundsRouterData<RSync>
{ for yFrom<RefundsResponseRouterData<RSync, NuveiTransactionSyncResponse>>
try_from(
item: RefundsResponseRouterData<RSync, NuveiTransactionSyncResponse>,
) -> Result<Self, Self::Error> {
let txn_id = item
.response
.transaction_details
.as_ref()
.and_then(|details| details.transaction_id.clone())
.ok_or(errors::ConnectorError::MissingConnectorTransactionID)?;
let refund_status = item
.response
.transaction_details
.as_ref()
.and_then(|details| details.transaction_status.clone())
.map(enums::RefundStatus::from)
.unwrap_or(enums::RefundStatus::Failure);
let network_decline_code = item
.response
.transaction_details
.as_ref()
.and_then(|details| details.gw_error_code.map(|e| e.to_string()));
let network_error_msg = item
.response
.transaction_details
.as_ref()
.and_then(|details| details.gw_error_reason.clone());
let refund_response = match item.response.status {
NuveiPaymentStatus::Error => Err(Box::new(get_error_response(
item.response.err_code,
item.response.reason.clone(),
item.http_code,
item.response.merchant_advice_code,
network_decline_code,
network_error_msg,
Some(txn_id.clone()),
))),
_ => match item
.response
.transaction_details
.and_then(|nuvei_response| nuvei_response.transaction_status)
{
Some(NuveiTransactionStatus::Error) => Err(Box::new(get_error_response(
item.response.err_code,
item.response.reason,
item.http_code,
item.response.merchant_advice_code,
network_decline_code,
network_error_msg,
Some(txn_id.clone()),
))),
_ => Ok(RefundsResponseData {
connector_refund_id: txn_id,
refund_status,
}),
},
};
Ok(Self {
response: refund_response.map_err(|err| *err),
..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": 70,
"total_crates": null
} |
fn_clm_hyperswitch_connectors_new_-5728647687904536538 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/nmi/transformers
// Inherent implementation for NmiMerchantDefinedField
pub fn new(metadata: &serde_json::Value) -> Self {
let metadata_as_string = metadata.to_string();
let hash_map: std::collections::BTreeMap<String, serde_json::Value> =
serde_json::from_str(&metadata_as_string).unwrap_or(std::collections::BTreeMap::new());
let inner = hash_map
.into_iter()
.enumerate()
.map(|(index, (hs_key, hs_value))| {
let nmi_key = format!("merchant_defined_field_{}", index + 1);
let nmi_value = format!("{hs_key}={hs_value}");
(nmi_key, Secret::new(nmi_value))
})
.collect();
Self { inner }
}
| {
"crate": "hyperswitch_connectors",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 14481,
"total_crates": null
} |
fn_clm_hyperswitch_connectors_try_from_-5728647687904536538 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/nmi/transformers
// Implementation of SyncResponse for TryFrom<&NmiWebhookBody>
fn try_from(item: &NmiWebhookBody) -> Result<Self, Self::Error> {
let transaction = Some(SyncTransactionResponse {
transaction_id: item.event_body.transaction_id.to_owned(),
condition: item.event_body.condition.to_owned(),
});
Ok(Self { transaction })
}
| {
"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_-5728647687904536538 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/nmi/transformers
// Implementation of NmiStatus for From<String>
fn from(value: String) -> Self {
match value.as_str() {
"abandoned" => Self::Abandoned,
"canceled" => Self::Cancelled,
"in_progress" => Self::InProgress,
"pendingsettlement" => Self::Pendingsettlement,
"complete" => Self::Complete,
"failed" => Self::Failed,
"unknown" => Self::Unknown,
// Other than above values only pending is possible, since value is a string handling this as default
_ => 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": 2602,
"total_crates": null
} |
fn_clm_hyperswitch_connectors_get_card_details_-5728647687904536538 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/nmi/transformers
fn get_card_details(
payment_method_data: Option<PaymentMethodData>,
) -> CustomResult<(CardNumber, Secret<String>, Secret<String>), ConnectorError> {
match payment_method_data {
Some(PaymentMethodData::Card(ref card_details)) => Ok((
card_details.card_number.clone(),
card_details.get_card_expiry_month_year_2_digit_with_delimiter("".to_string())?,
card_details.card_cvc.clone(),
)),
_ => Err(
ConnectorError::NotImplemented(get_unimplemented_payment_method_error_message("Nmi"))
.into(),
),
}
}
| {
"crate": "hyperswitch_connectors",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 26,
"total_crates": null
} |
fn_clm_hyperswitch_connectors_get_nmi_webhook_event_-5728647687904536538 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/nmi/transformers
pub fn get_nmi_webhook_event(status: NmiWebhookEventType) -> IncomingWebhookEvent {
match status {
NmiWebhookEventType::SaleSuccess => IncomingWebhookEvent::PaymentIntentSuccess,
NmiWebhookEventType::SaleFailure => IncomingWebhookEvent::PaymentIntentFailure,
NmiWebhookEventType::RefundSuccess => IncomingWebhookEvent::RefundSuccess,
NmiWebhookEventType::RefundFailure => IncomingWebhookEvent::RefundFailure,
NmiWebhookEventType::VoidSuccess => IncomingWebhookEvent::PaymentIntentCancelled,
NmiWebhookEventType::AuthSuccess => IncomingWebhookEvent::PaymentIntentAuthorizationSuccess,
NmiWebhookEventType::CaptureSuccess => IncomingWebhookEvent::PaymentIntentCaptureSuccess,
NmiWebhookEventType::AuthFailure => IncomingWebhookEvent::PaymentIntentAuthorizationFailure,
NmiWebhookEventType::CaptureFailure => IncomingWebhookEvent::PaymentIntentCaptureFailure,
NmiWebhookEventType::VoidFailure => IncomingWebhookEvent::PaymentIntentCancelFailure,
NmiWebhookEventType::SaleUnknown
| NmiWebhookEventType::RefundUnknown
| NmiWebhookEventType::AuthUnknown
| NmiWebhookEventType::VoidUnknown
| NmiWebhookEventType::CaptureUnknown => IncomingWebhookEvent::EventNotSupported,
}
}
| {
"crate": "hyperswitch_connectors",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": true,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 13,
"total_crates": null
} |
fn_clm_hyperswitch_connectors_try_from_8104070542787090503 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/inespay/transformers
// Implementation of RefundsRouterData<RSync> for TryFrom<RefundsResponseRouterData<RSync, InespayRSyncResponse>>
fn try_from(
item: RefundsResponseRouterData<RSync, InespayRSyncResponse>,
) -> Result<Self, Self::Error> {
let response = match item.response {
InespayRSyncResponse::InespayRSyncData(data) => Ok(RefundsResponseData {
connector_refund_id: data.refund_id,
refund_status: enums::RefundStatus::from(data.cod_status),
}),
InespayRSyncResponse::InespayRSyncWebhook(data) => Ok(RefundsResponseData {
connector_refund_id: data.refund_id,
refund_status: enums::RefundStatus::from(data.cod_status),
}),
InespayRSyncResponse::InespayRSyncError(data) => Err(ErrorResponse {
code: data.status.clone(),
message: data.status_desc.clone(),
reason: Some(data.status_desc.clone()),
attempt_status: None,
connector_transaction_id: None,
status_code: item.http_code,
network_advice_code: None,
network_decline_code: None,
network_error_message: None,
connector_metadata: None,
}),
};
Ok(Self {
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_8104070542787090503 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/inespay/transformers
// Implementation of api_models::webhooks::IncomingWebhookEvent for From<InespayWebhookEventData>
fn from(item: InespayWebhookEventData) -> Self {
match item {
InespayWebhookEventData::Payment(payment_data) => match payment_data.cod_status {
InespayPSyncStatus::Ok | InespayPSyncStatus::Settled => Self::PaymentIntentSuccess,
InespayPSyncStatus::Failed | InespayPSyncStatus::Rejected => {
Self::PaymentIntentFailure
}
InespayPSyncStatus::Created
| InespayPSyncStatus::Opened
| InespayPSyncStatus::BankSelected
| InespayPSyncStatus::Initiated
| InespayPSyncStatus::Pending
| InespayPSyncStatus::Unfinished
| InespayPSyncStatus::PartiallyAccepted => Self::PaymentIntentProcessing,
InespayPSyncStatus::Aborted
| InespayPSyncStatus::Cancelled
| InespayPSyncStatus::PartRefunded
| InespayPSyncStatus::Refunded => Self::EventNotSupported,
},
InespayWebhookEventData::Refund(refund_data) => match refund_data.cod_status {
InespayRSyncStatus::Confirmed => Self::RefundSuccess,
InespayRSyncStatus::Rejected
| InespayRSyncStatus::Denied
| InespayRSyncStatus::Reversed
| InespayRSyncStatus::Mistake => Self::RefundFailure,
InespayRSyncStatus::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_798444672850243480 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/itaubank/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.rtr_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_798444672850243480 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/itaubank/transformers
// Implementation of enums::RefundStatus for From<RefundStatus>
fn from(item: RefundStatus) -> Self {
match item {
RefundStatus::Devolvido => Self::Success,
RefundStatus::NaoRealizado => Self::Failure,
RefundStatus::EmProcessamento => 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_code_data_798444672850243480 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/itaubank/transformers
fn get_qr_code_data(
response: &ItaubankPaymentsResponse,
) -> CustomResult<Option<serde_json::Value>, errors::ConnectorError> {
let creation_time = get_timestamp_in_milliseconds(&response.calendario.criacao);
// convert expiration to milliseconds and add to creation time
let expiration_time = creation_time + (response.calendario.expiracao * 1000);
let image_data = QrImage::new_from_data(response.pix_qr_value.clone())
.change_context(errors::ConnectorError::ResponseHandlingFailed)?;
let image_data_url = Url::parse(image_data.data.clone().as_str())
.change_context(errors::ConnectorError::ResponseHandlingFailed)?;
let qr_code_info = QrCodeInformation::QrDataUrl {
image_data_url,
display_to_timestamp: Some(expiration_time),
};
Some(qr_code_info.encode_to_value())
.transpose()
.change_context(errors::ConnectorError::ResponseHandlingFailed)
}
| {
"crate": "hyperswitch_connectors",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 22,
"total_crates": null
} |
fn_clm_hyperswitch_connectors_try_from_-8107062887905205876 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/dlocal/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_-8107062887905205876 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/dlocal/transformers
// Implementation of enums::RefundStatus for From<RefundStatus>
fn from(item: RefundStatus) -> Self {
match item {
RefundStatus::Success => Self::Success,
RefundStatus::Pending => Self::Pending,
RefundStatus::Rejected => Self::ManualReview,
RefundStatus::Cancelled => 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_payer_name_-8107062887905205876 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/dlocal/transformers
fn get_payer_name(
address: &hyperswitch_domain_models::address::AddressDetails,
) -> Option<Secret<String>> {
let first_name = address
.first_name
.clone()
.map_or("".to_string(), |first_name| first_name.peek().to_string());
let last_name = address
.last_name
.clone()
.map_or("".to_string(), |last_name| last_name.peek().to_string());
let name: String = format!("{first_name} {last_name}").trim().to_string();
if !name.is_empty() {
Some(Secret::new(name))
} else {
None
}
}
| {
"crate": "hyperswitch_connectors",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 28,
"total_crates": null
} |
fn_clm_hyperswitch_connectors_get_doc_from_currency_-8107062887905205876 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/dlocal/transformers
fn get_doc_from_currency(country: String) -> Secret<String> {
let doc = match country.as_str() {
"BR" => "91483309223",
"ZA" => "2001014800086",
"BD" | "GT" | "HN" | "PK" | "SN" | "TH" => "1234567890001",
"CR" | "SV" | "VN" => "123456789",
"DO" | "NG" => "12345678901",
"EG" => "12345678901112",
"GH" | "ID" | "RW" | "UG" => "1234567890111123",
"IN" => "NHSTP6374G",
"CI" => "CA124356789",
"JP" | "MY" | "PH" => "123456789012",
"NI" => "1234567890111A",
"TZ" => "12345678912345678900",
_ => "12345678",
};
Secret::new(doc.to_string())
}
| {
"crate": "hyperswitch_connectors",
"file": null,
"file_size": null,
"is_async": false,
"is_pub": false,
"num_enums": null,
"num_structs": null,
"num_tables": null,
"score": 6,
"total_crates": null
} |
fn_clm_hyperswitch_connectors_try_from_-4167982439746898925 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/rapyd/transformers
// Implementation of RouterData<F, T, PaymentsResponseData> for TryFrom<ResponseRouterData<F, RapydPaymentsResponse, T, PaymentsResponseData>>
fn try_from(
item: ResponseRouterData<F, RapydPaymentsResponse, T, PaymentsResponseData>,
) -> Result<Self, Self::Error> {
let (status, response) = match &item.response.data {
Some(data) => {
let attempt_status =
get_status(data.status.to_owned(), data.next_action.to_owned());
match attempt_status {
enums::AttemptStatus::Failure => (
enums::AttemptStatus::Failure,
Err(ErrorResponse {
code: data
.failure_code
.to_owned()
.unwrap_or(item.response.status.error_code),
status_code: item.http_code,
message: item.response.status.status.unwrap_or_default(),
reason: data.failure_message.to_owned(),
attempt_status: None,
connector_transaction_id: None,
network_advice_code: None,
network_decline_code: None,
network_error_message: None,
connector_metadata: None,
}),
),
_ => {
let redirection_url = data
.redirect_url
.as_ref()
.filter(|redirect_str| !redirect_str.is_empty())
.map(|url| {
Url::parse(url).change_context(
errors::ConnectorError::FailedToObtainIntegrationUrl,
)
})
.transpose()?;
let redirection_data =
redirection_url.map(|url| RedirectForm::from((url, Method::Get)));
(
attempt_status,
Ok(PaymentsResponseData::TransactionResponse {
resource_id: ResponseId::ConnectorTransactionId(data.id.to_owned()), //transaction_id is also the field but this id is used to initiate a refund
redirection_data: Box::new(redirection_data),
mandate_reference: Box::new(None),
connector_metadata: None,
network_txn_id: None,
connector_response_reference_id: data
.merchant_reference_id
.to_owned(),
incremental_authorization_allowed: None,
charges: None,
}),
)
}
}
}
None => (
enums::AttemptStatus::Failure,
Err(ErrorResponse {
code: item.response.status.error_code,
status_code: item.http_code,
message: item.response.status.status.unwrap_or_default(),
reason: item.response.status.message,
attempt_status: None,
connector_transaction_id: None,
network_advice_code: None,
network_decline_code: None,
network_error_message: None,
connector_metadata: None,
}),
),
};
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": 2701,
"total_crates": null
} |
fn_clm_hyperswitch_connectors_from_-4167982439746898925 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/rapyd/transformers
// Implementation of RefundResponse for From<RefundResponseData>
fn from(value: RefundResponseData) -> Self {
Self {
status: Status {
error_code: NO_ERROR_CODE.to_owned(),
status: None,
message: None,
response_code: None,
operation_id: None,
},
data: Some(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": 2602,
"total_crates": null
} |
fn_clm_hyperswitch_connectors_get_status_-4167982439746898925 | clm | function | // Repository: hyperswitch
// Crate: hyperswitch_connectors
// Purpose: Payment provider integrations (Stripe, PayPal, etc.)
// Module: crates/hyperswitch_connectors/src/connectors/rapyd/transformers
fn get_status(status: RapydPaymentStatus, next_action: NextAction) -> enums::AttemptStatus {
match (status, next_action) {
(RapydPaymentStatus::Closed, _) => enums::AttemptStatus::Charged,
(
RapydPaymentStatus::Active,
NextAction::ThreedsVerification | NextAction::PendingConfirmation,
) => enums::AttemptStatus::AuthenticationPending,
(RapydPaymentStatus::Active, NextAction::PendingCapture | NextAction::NotApplicable) => {
enums::AttemptStatus::Authorized
}
(
RapydPaymentStatus::CanceledByClientOrBank
| RapydPaymentStatus::Expired
| RapydPaymentStatus::ReversedByRapyd,
_,
) => enums::AttemptStatus::Voided,
(RapydPaymentStatus::Error, _) => enums::AttemptStatus::Failure,
(RapydPaymentStatus::New, _) => enums::AttemptStatus::Authorizing,
}
}
| {
"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
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.