id stringlengths 20 153 | type stringclasses 1
value | granularity stringclasses 14
values | content stringlengths 16 84.3k | metadata dict |
|---|---|---|---|---|
connector-service_fn_connector-integration_-2019515051918346346 | clm | function | // connector-service/backend/connector-integration/src/connectors/aci.rs
fn common_get_content_type(&self) -> &'static str {
"application/x-www-form-urlencoded"
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "common_get_content_type",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_-3057837550438087634 | clm | function | // connector-service/backend/connector-integration/src/connectors/aci.rs
fn base_url<'a>(&self, connectors: &'a Connectors) -> &'a str {
connectors.aci.base_url.as_ref()
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "base_url",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_-3255286691494576199 | clm | function | // connector-service/backend/connector-integration/src/connectors/aci.rs
fn get_auth_header(
&self,
auth_type: &ConnectorAuthType,
) -> CustomResult<Vec<(String, hyperswitch_masking::Maskable<String>)>, errors::ConnectorError>
{
let auth = aci::AciAuthType::try_from(auth_type)
.change_context(errors::ConnectorError::FailedToObtainAuthType)?;
Ok(vec![(
headers::AUTHORIZATION.to_string(),
format!("Bearer {}", auth.api_key.peek()).into_masked(),
)])
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_auth_header",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_641024712665909102 | clm | function | // connector-service/backend/connector-integration/src/connectors/aci.rs
fn build_error_response(
&self,
res: Response,
event_builder: Option<&mut events::Event>,
) -> CustomResult<ErrorResponse, errors::ConnectorError> {
let response: aci::AciErrorResponse = res
.response
.parse_struct("AciErrorResponse")
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
with_error_response_body!(event_builder, response);
Ok(ErrorResponse {
status_code: res.status_code,
code: response.result.code,
message: response.result.description,
reason: response.result.parameter_errors.map(|errors| {
errors
.into_iter()
.map(|error_description| {
format!(
"Field is {} and the message is {}",
error_description.name, error_description.message
)
})
.collect::<Vec<String>>()
.join("; ")
}),
attempt_status: None,
connector_transaction_id: None,
network_advice_code: None,
network_decline_code: None,
network_error_message: None,
})
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "build_error_response",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_-6029226692251725325 | clm | function | // connector-service/backend/connector-integration/src/connectors/elavon.rs
fn id(&self) -> &'static str {
"elavon"
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "id",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_-8425554736732828180 | clm | function | // connector-service/backend/connector-integration/src/connectors/elavon.rs
fn common_get_content_type(&self) -> &'static str {
"application/x-www-form-urlencoded"
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "common_get_content_type",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_-6639360752081888295 | clm | function | // connector-service/backend/connector-integration/src/connectors/elavon.rs
fn get_auth_header(
&self,
_auth_type: &ConnectorAuthType,
) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> {
Ok(Vec::new())
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_auth_header",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_6307542240414880029 | clm | function | // connector-service/backend/connector-integration/src/connectors/elavon.rs
fn base_url<'a>(&self, _connectors: &'a Connectors) -> &'a str {
"https://api.demo.convergepay.com/VirtualMerchantDemo/"
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "base_url",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_-1860421272076504246 | clm | function | // connector-service/backend/connector-integration/src/connectors/elavon.rs
fn build_error_response(
&self,
res: Response,
event_builder: Option<&mut events::Event>,
) -> CustomResult<ErrorResponse, errors::ConnectorError> {
match res
.response
.parse_struct::<elavon::ElavonPaymentsResponse>("ElavonPaymentsResponse")
.map_err(|_| errors::ConnectorError::ResponseDeserializationFailed)
{
Ok(elavon_response) => {
with_error_response_body!(event_builder, elavon_response);
match elavon_response.result {
elavon::ElavonResult::Error(error_payload) => Ok(ErrorResponse {
status_code: res.status_code,
code: error_payload.error_code.unwrap_or_else(|| "".to_string()),
message: error_payload.error_message,
reason: error_payload.error_name,
attempt_status: Some(common_enums::AttemptStatus::Failure),
connector_transaction_id: error_payload.ssl_txn_id,
network_decline_code: None,
network_advice_code: None,
network_error_message: None,
}),
elavon::ElavonResult::Success(success_payload) => Ok(ErrorResponse {
status_code: res.status_code,
code: "".to_string(),
message: "Received success response in error flow".to_string(),
reason: Some(format!(
"Unexpected success: {:?}",
success_payload.ssl_result_message
)),
attempt_status: Some(common_enums::AttemptStatus::Failure),
connector_transaction_id: Some(success_payload.ssl_txn_id),
network_decline_code: None,
network_advice_code: None,
network_error_message: None,
}),
}
}
Err(_parsing_error) => {
let (message, reason) = match res.status_code {
500..=599 => (
"Elavon server error".to_string(),
Some(String::from_utf8_lossy(&res.response).into_owned()),
),
_ => (
"Elavon error response".to_string(),
Some(String::from_utf8_lossy(&res.response).into_owned()),
),
};
Ok(ErrorResponse {
status_code: res.status_code,
code: "".to_string(),
message,
reason,
attempt_status: Some(common_enums::AttemptStatus::Failure),
connector_transaction_id: None,
network_decline_code: None,
network_advice_code: None,
network_error_message: None,
})
}
}
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "build_error_response",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_-3527896192969994057 | clm | function | // connector-service/backend/connector-integration/src/connectors/authorizedotnet.rs
fn should_create_connector_customer(&self) -> bool {
true
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "should_create_connector_customer",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_-1019376945297712761 | clm | function | // connector-service/backend/connector-integration/src/connectors/authorizedotnet.rs
fn verify_webhook_source(
&self,
request: RequestDetails,
connector_webhook_secret: Option<ConnectorWebhookSecrets>,
_connector_account_details: Option<ConnectorAuthType>,
) -> Result<bool, error_stack::Report<ConnectorError>> {
// If no webhook secret is provided, cannot verify
let webhook_secret = match connector_webhook_secret {
Some(secrets) => secrets.secret,
None => return Ok(false),
};
// Extract X-ANET-Signature header (case-insensitive)
let signature_header = match request
.headers
.get("X-ANET-Signature")
.or_else(|| request.headers.get("x-anet-signature"))
{
Some(header) => header,
None => {
tracing::warn!(
target: "authorizedotnet_webhook",
"Missing X-ANET-Signature header in webhook request from Authorize.Net - verification failed but continuing processing"
);
return Ok(false); // Missing signature -> verification fails but continue processing
}
};
// Parse "sha512=<hex>" format
let signature_hex = match signature_header.strip_prefix("sha512=") {
Some(hex) => hex,
None => {
tracing::warn!(
target: "authorizedotnet_webhook",
"Invalid signature format in X-ANET-Signature header, expected 'sha512=<hex>' but got: '{}' - verification failed but continuing processing",
signature_header
);
return Ok(false); // Invalid format -> verification fails but continue processing
}
};
// Decode hex signature
let expected_signature = match hex::decode(signature_hex) {
Ok(sig) => sig,
Err(hex_error) => {
tracing::warn!(
target: "authorizedotnet_webhook",
"Failed to decode hex signature from X-ANET-Signature header: '{}', error: {} - verification failed but continuing processing",
signature_hex,
hex_error
);
return Ok(false); // Invalid hex -> verification fails but continue processing
}
};
// Compute HMAC-SHA512 of request body
use common_utils::crypto::{HmacSha512, SignMessage};
let crypto_algorithm = HmacSha512;
let computed_signature = match crypto_algorithm.sign_message(&webhook_secret, &request.body)
{
Ok(sig) => sig,
Err(crypto_error) => {
tracing::error!(
target: "authorizedotnet_webhook",
"Failed to compute HMAC-SHA512 signature for webhook verification, error: {:?} - verification failed but continuing processing",
crypto_error
);
return Ok(false); // Crypto error -> verification fails but continue processing
}
};
// Constant-time comparison to prevent timing attacks
Ok(computed_signature == expected_signature)
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "verify_webhook_source",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_-6429782132288584706 | clm | function | // connector-service/backend/connector-integration/src/connectors/authorizedotnet.rs
fn get_event_type(
&self,
request: RequestDetails,
_connector_webhook_secret: Option<ConnectorWebhookSecrets>,
_connector_account_details: Option<ConnectorAuthType>,
) -> Result<EventType, error_stack::Report<ConnectorError>> {
let webhook_body: AuthorizedotnetWebhookEventType = request
.body
.parse_struct("AuthorizedotnetWebhookEventType")
.change_context(ConnectorError::WebhookEventTypeNotFound)
.attach_printable_lazy(|| {
"Failed to parse webhook event type from Authorize.Net webhook body"
})?;
Ok(match webhook_body.event_type {
transformers::AuthorizedotnetIncomingWebhookEventType::AuthorizationCreated => {
EventType::PaymentIntentAuthorizationSuccess
}
transformers::AuthorizedotnetIncomingWebhookEventType::PriorAuthCapture
| transformers::AuthorizedotnetIncomingWebhookEventType::CaptureCreated => {
EventType::PaymentIntentCaptureSuccess
}
transformers::AuthorizedotnetIncomingWebhookEventType::AuthCapCreated => {
EventType::PaymentIntentSuccess // Combined auth+capture
}
transformers::AuthorizedotnetIncomingWebhookEventType::VoidCreated => {
EventType::PaymentIntentCancelled
}
transformers::AuthorizedotnetIncomingWebhookEventType::RefundCreated => {
EventType::RefundSuccess
}
transformers::AuthorizedotnetIncomingWebhookEventType::CustomerCreated
| transformers::AuthorizedotnetIncomingWebhookEventType::CustomerPaymentProfileCreated => {
EventType::MandateActive
}
transformers::AuthorizedotnetIncomingWebhookEventType::Unknown => {
tracing::warn!(
target: "authorizedotnet_webhook",
"Received unknown webhook event type from Authorize.Net - rejecting webhook"
);
return Err(
error_stack::report!(ConnectorError::WebhookEventTypeNotFound)
.attach_printable("Unknown webhook event type"),
)
}
})
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_event_type",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_-2219996987668904238 | clm | function | // connector-service/backend/connector-integration/src/connectors/authorizedotnet.rs
fn process_payment_webhook(
&self,
request: RequestDetails,
_connector_webhook_secret: Option<ConnectorWebhookSecrets>,
_connector_account_details: Option<ConnectorAuthType>,
) -> Result<WebhookDetailsResponse, error_stack::Report<ConnectorError>> {
let request_body_copy = request.body.clone();
let webhook_body: AuthorizedotnetWebhookObjectId = request
.body
.parse_struct("AuthorizedotnetWebhookObjectId")
.change_context(ConnectorError::WebhookResourceObjectNotFound)
.attach_printable_lazy(|| {
"Failed to parse Authorize.Net payment webhook body structure"
})?;
let transaction_id = get_trans_id(&webhook_body).attach_printable_lazy(|| {
format!(
"Failed to extract transaction ID from payment webhook for event: {:?}",
webhook_body.event_type
)
})?;
let status = transformers::SyncStatus::from(webhook_body.event_type.clone());
Ok(WebhookDetailsResponse {
resource_id: Some(ResponseId::ConnectorTransactionId(transaction_id.clone())),
status: common_enums::AttemptStatus::from(status),
status_code: 200,
mandate_reference: None,
connector_response_reference_id: Some(transaction_id),
error_code: None,
error_message: None,
raw_connector_response: Some(String::from_utf8_lossy(&request_body_copy).to_string()),
response_headers: None,
minor_amount_captured: None,
amount_captured: None,
error_reason: None,
network_txn_id: None,
transformation_status: common_enums::WebhookTransformationStatus::Complete,
})
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "process_payment_webhook",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_-2292690856165331702 | clm | function | // connector-service/backend/connector-integration/src/connectors/authorizedotnet.rs
fn process_refund_webhook(
&self,
request: RequestDetails,
_connector_webhook_secret: Option<ConnectorWebhookSecrets>,
_connector_account_details: Option<ConnectorAuthType>,
) -> Result<RefundWebhookDetailsResponse, error_stack::Report<ConnectorError>> {
let request_body_copy = request.body.clone();
let webhook_body: AuthorizedotnetWebhookObjectId = request
.body
.parse_struct("AuthorizedotnetWebhookObjectId")
.change_context(ConnectorError::WebhookResourceObjectNotFound)
.attach_printable_lazy(|| {
"Failed to parse Authorize.Net refund webhook body structure"
})?;
let transaction_id = get_trans_id(&webhook_body).attach_printable_lazy(|| {
format!(
"Failed to extract transaction ID from refund webhook for event: {:?}",
webhook_body.event_type
)
})?;
Ok(RefundWebhookDetailsResponse {
connector_refund_id: Some(transaction_id.clone()),
status: common_enums::RefundStatus::Success, // Authorize.Net only sends successful refund webhooks
status_code: 200,
connector_response_reference_id: Some(transaction_id),
error_code: None,
error_message: None,
raw_connector_response: Some(String::from_utf8_lossy(&request_body_copy).to_string()),
response_headers: None,
})
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "process_refund_webhook",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_-126431805346899605 | clm | function | // connector-service/backend/connector-integration/src/connectors/authorizedotnet.rs
fn id(&self) -> &'static str {
"authorizedotnet"
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "id",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_5874240626007061497 | clm | function | // connector-service/backend/connector-integration/src/connectors/authorizedotnet.rs
fn common_get_content_type(&self) -> &'static str {
"application/json"
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "common_get_content_type",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_5336726504462421116 | clm | function | // connector-service/backend/connector-integration/src/connectors/authorizedotnet.rs
fn base_url<'a>(&self, connectors: &'a Connectors) -> &'a str {
connectors.authorizedotnet.base_url.as_ref()
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "base_url",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_4332481879722836047 | clm | function | // connector-service/backend/connector-integration/src/connectors/authorizedotnet.rs
fn build_error_response(
&self,
res: Response,
event_builder: Option<&mut events::Event>,
) -> CustomResult<ErrorResponse, errors::ConnectorError> {
let response: transformers::ResponseMessages = res
.response
.parse_struct("ResponseMessages")
.map_err(|_| ConnectorError::ResponseDeserializationFailed)?;
with_response_body!(event_builder, response);
Ok(ErrorResponse {
status_code: res.status_code,
code: response
.message
.first()
.map(|m| m.code.clone())
.unwrap_or_else(|| consts::NO_ERROR_CODE.to_string()),
message: response
.message
.first()
.map(|m| m.text.clone())
.unwrap_or_else(|| consts::NO_ERROR_MESSAGE.to_string()),
reason: None,
attempt_status: None,
connector_transaction_id: None,
network_decline_code: None,
network_advice_code: None,
network_error_message: None,
})
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "build_error_response",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_4140498276727739960 | clm | function | // connector-service/backend/connector-integration/src/connectors/authorizedotnet.rs
fn get_currency_unit(&self) -> common_enums::CurrencyUnit {
common_enums::CurrencyUnit::Base
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_currency_unit",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_3939562608700818205 | clm | function | // connector-service/backend/connector-integration/src/connectors/authorizedotnet.rs
fn get_headers(
&self,
req: &RouterDataV2<Refund, RefundFlowData, RefundsData, RefundsResponseData>,
) -> CustomResult<Vec<(String, Maskable<String>)>, ConnectorError> {
self.build_headers(req)
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_headers",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_9138131862061350303 | clm | function | // connector-service/backend/connector-integration/src/connectors/authorizedotnet.rs
fn get_content_type(&self) -> &'static str {
self.common_get_content_type()
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_content_type",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_5607154051975171092 | clm | function | // connector-service/backend/connector-integration/src/connectors/authorizedotnet.rs
fn get_url(
&self,
req: &RouterDataV2<Refund, RefundFlowData, RefundsData, RefundsResponseData>,
) -> CustomResult<String, ConnectorError> {
Ok(self.connector_base_url_refunds(req).to_string())
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_url",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_3297076432563105908 | clm | function | // connector-service/backend/connector-integration/src/connectors/authorizedotnet.rs
fn get_request_body(
&self,
_req: &RouterDataV2<Refund, RefundFlowData, RefundsData, RefundsResponseData>,
) -> CustomResult<Option<RequestContent>, ConnectorError> {
// This is a placeholder implementation
// The actual refund logic should be handled by specific implementations
Err(ConnectorError::NotImplemented("Refund not implemented for generic type".into()).into())
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_request_body",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_7141503223258602691 | clm | function | // connector-service/backend/connector-integration/src/connectors/payload.rs
fn id(&self) -> &'static str {
"payload"
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "id",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_1037135046517735987 | clm | function | // connector-service/backend/connector-integration/src/connectors/payload.rs
fn get_currency_unit(&self) -> CurrencyUnit {
CurrencyUnit::Minor
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_currency_unit",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_-2487526971560241232 | clm | function | // connector-service/backend/connector-integration/src/connectors/payload.rs
fn common_get_content_type(&self) -> &'static str {
"application/x-www-form-urlencoded"
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "common_get_content_type",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_8395558240708385682 | clm | function | // connector-service/backend/connector-integration/src/connectors/payload.rs
fn base_url<'a>(&self, connectors: &'a Connectors) -> &'a str {
connectors.payload.base_url.as_ref()
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "base_url",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_1149203201784082838 | clm | function | // connector-service/backend/connector-integration/src/connectors/payload.rs
fn get_auth_header(
&self,
auth_type: &ConnectorAuthType,
) -> CustomResult<Vec<(String, Maskable<String>)>, errors::ConnectorError> {
let auth = payload::PayloadAuthType::try_from(auth_type)
.change_context(errors::ConnectorError::FailedToObtainAuthType)?;
// The API key is the same for all currencies, so we can take any.
let api_key = auth
.auths
.values()
.next()
.ok_or(errors::ConnectorError::FailedToObtainAuthType)?
.api_key
.clone();
let encoded_api_key = BASE64_ENGINE.encode(format!("{}:", api_key.expose()));
Ok(vec![(
headers::AUTHORIZATION.to_string(),
format!("Basic {encoded_api_key}").into_masked(),
)])
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_auth_header",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_4305318005823475314 | clm | function | // connector-service/backend/connector-integration/src/connectors/payload.rs
fn build_error_response(
&self,
res: Response,
event_builder: Option<&mut events::Event>,
) -> CustomResult<ErrorResponse, errors::ConnectorError> {
let response: PayloadErrorResponse = res
.response
.parse_struct("PayloadErrorResponse")
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
with_error_response_body!(event_builder, response);
Ok(ErrorResponse {
status_code: res.status_code,
code: response.error_type,
message: response.error_description,
reason: response
.details
.as_ref()
.map(|details_value| details_value.to_string()),
attempt_status: None,
connector_transaction_id: None,
network_advice_code: None,
network_decline_code: None,
network_error_message: None,
})
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "build_error_response",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_-7458802218834735305 | clm | function | // connector-service/backend/connector-integration/src/connectors/payload.rs
fn get_webhook_source_verification_signature(
&self,
request: &domain_types::connector_types::RequestDetails,
_connector_webhook_secret: &domain_types::connector_types::ConnectorWebhookSecrets,
) -> Result<Vec<u8>, error_stack::Report<errors::ConnectorError>> {
let signature = request
.headers
.get(headers::X_PAYLOAD_SIGNATURE)
.map(|header_value| header_value.as_bytes().to_vec())
.ok_or(errors::ConnectorError::WebhookSourceVerificationFailed)?;
Ok(signature)
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_webhook_source_verification_signature",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_4770382284486995872 | clm | function | // connector-service/backend/connector-integration/src/connectors/payload.rs
fn get_webhook_source_verification_message(
&self,
request: &domain_types::connector_types::RequestDetails,
_connector_webhook_secret: &domain_types::connector_types::ConnectorWebhookSecrets,
) -> Result<Vec<u8>, error_stack::Report<errors::ConnectorError>> {
Ok(request.body.to_vec())
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_webhook_source_verification_message",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_-3825368285375067169 | clm | function | // connector-service/backend/connector-integration/src/connectors/payload.rs
fn verify_webhook_source(
&self,
request: domain_types::connector_types::RequestDetails,
connector_webhook_secret: Option<domain_types::connector_types::ConnectorWebhookSecrets>,
_connector_account_details: Option<ConnectorAuthType>,
) -> Result<bool, error_stack::Report<errors::ConnectorError>> {
let algorithm = common_utils::crypto::Sha256;
let connector_webhook_secrets = match connector_webhook_secret {
Some(secrets) => secrets,
None => {
return Ok(false);
}
};
let signature = self
.get_webhook_source_verification_signature(&request, &connector_webhook_secrets)
.change_context(errors::ConnectorError::WebhookSourceVerificationFailed)?;
let message = self
.get_webhook_source_verification_message(&request, &connector_webhook_secrets)
.change_context(errors::ConnectorError::WebhookSourceVerificationFailed)?;
algorithm
.verify_signature(&connector_webhook_secrets.secret, &signature, &message)
.change_context(errors::ConnectorError::WebhookSourceVerificationFailed)
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "verify_webhook_source",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_-6117839938170545747 | clm | function | // connector-service/backend/connector-integration/src/connectors/payload.rs
fn get_event_type(
&self,
request: domain_types::connector_types::RequestDetails,
_connector_webhook_secret: Option<domain_types::connector_types::ConnectorWebhookSecrets>,
_connector_account_details: Option<ConnectorAuthType>,
) -> Result<domain_types::connector_types::EventType, error_stack::Report<errors::ConnectorError>>
{
let webhook_body: transformers::PayloadWebhookEvent = request
.body
.parse_struct("PayloadWebhookEvent")
.change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?;
Ok(transformers::get_event_type_from_trigger(
webhook_body.trigger,
))
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_event_type",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_3679372211755775360 | clm | function | // connector-service/backend/connector-integration/src/connectors/payload.rs
fn get_webhook_resource_object(
&self,
request: domain_types::connector_types::RequestDetails,
) -> Result<
Box<dyn hyperswitch_masking::ErasedMaskSerialize>,
error_stack::Report<errors::ConnectorError>,
> {
let webhook_body: transformers::PayloadWebhookEvent = request
.body
.parse_struct("PayloadWebhookEvent")
.change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?;
Ok(Box::new(webhook_body))
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_webhook_resource_object",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_-7940660144733689831 | clm | function | // connector-service/backend/connector-integration/src/connectors/trustpay.rs
fn should_do_access_token(&self) -> bool {
true
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "should_do_access_token",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_4208215477745098540 | clm | function | // connector-service/backend/connector-integration/src/connectors/trustpay.rs
fn id(&self) -> &'static str {
"trustpay"
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "id",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_8891255174600848831 | clm | function | // connector-service/backend/connector-integration/src/connectors/trustpay.rs
fn common_get_content_type(&self) -> &'static str {
"application/x-www-form-urlencoded"
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "common_get_content_type",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_807180579979121777 | clm | function | // connector-service/backend/connector-integration/src/connectors/trustpay.rs
fn base_url<'a>(&self, connectors: &'a Connectors) -> &'a str {
connectors.trustpay.base_url.as_ref()
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "base_url",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_-8584907116032210648 | clm | function | // connector-service/backend/connector-integration/src/connectors/trustpay.rs
fn build_error_response(
&self,
res: Response,
event_builder: Option<&mut events::Event>,
) -> CustomResult<ErrorResponse, errors::ConnectorError> {
let response: Result<TrustpayErrorResponse, Report<common_utils::errors::ParsingError>> =
res.response.parse_struct("trustpay ErrorResponse");
match response {
Ok(response_data) => {
if let Some(i) = event_builder {
i.set_connector_response(&response_data);
}
let reason = response_data.errors.map(|errors| {
errors
.iter()
.map(|error| error.description.clone())
.collect::<Vec<String>>()
.join(" & ")
});
Ok(ErrorResponse {
status_code: res.status_code,
code: consts::NO_ERROR_CODE.to_string(),
message: consts::NO_ERROR_CODE.to_string(),
reason: reason
.or(response_data.description)
.or(response_data.payment_description),
attempt_status: None,
connector_transaction_id: response_data.instance_id,
network_advice_code: None,
network_decline_code: None,
network_error_message: None,
})
}
Err(error_msg) => {
if let Some(event) = event_builder {
event.set_connector_response(&serde_json::json!({"error": "Error response parsing failed", "status_code": res.status_code}))
};
tracing::error!(deserialization_error =? error_msg);
domain_types::utils::handle_json_response_deserialization_failure(res, "trustpay")
}
}
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "build_error_response",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_7598527540892620905 | clm | function | // connector-service/backend/connector-integration/src/connectors/placetopay.rs
fn id(&self) -> &'static str {
"placetopay"
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "id",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_6405220610932090539 | clm | function | // connector-service/backend/connector-integration/src/connectors/placetopay.rs
fn get_currency_unit(&self) -> common_enums::CurrencyUnit {
common_enums::CurrencyUnit::Minor
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_currency_unit",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_4106783491020100973 | clm | function | // connector-service/backend/connector-integration/src/connectors/placetopay.rs
fn base_url<'a>(&self, connectors: &'a Connectors) -> &'a str {
connectors.placetopay.base_url.as_ref()
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "base_url",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_8439462769836917282 | clm | function | // connector-service/backend/connector-integration/src/connectors/placetopay.rs
fn build_error_response(
&self,
res: Response,
event_builder: Option<&mut events::Event>,
) -> CustomResult<ErrorResponse, errors::ConnectorError> {
let response: placetopay::PlacetopayErrorResponse = res
.response
.parse_struct("PlacetopayErrorResponse")
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
with_error_response_body!(event_builder, response);
Ok(ErrorResponse {
status_code: res.status_code,
code: response
.status
.reason
.unwrap_or_else(|| NO_ERROR_CODE.to_string()),
message: response
.status
.message
.clone()
.unwrap_or_else(|| NO_ERROR_MESSAGE.to_string()),
reason: response.status.message,
attempt_status: None,
connector_transaction_id: None,
network_decline_code: None,
network_advice_code: None,
network_error_message: None,
})
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "build_error_response",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_-4538026060445534962 | clm | function | // connector-service/backend/connector-integration/src/connectors/helcim/transformers.rs
pub fn check_currency(
currency: common_enums::Currency,
) -> Result<common_enums::Currency, errors::ConnectorError> {
if currency == common_enums::Currency::USD {
Ok(currency)
} else {
Err(errors::ConnectorError::NotSupported {
message: format!("currency {currency} is not supported for this merchant account"),
connector: "Helcim",
})?
}
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "check_currency",
"is_async": false,
"is_pub": true,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_-6984681284988699009 | clm | function | // connector-service/backend/connector-integration/src/connectors/helcim/transformers.rs
fn try_from(item: ResponseRouterData<RefundResponse, Self>) -> Result<Self, Self::Error> {
Ok(Self {
response: Ok(RefundsResponseData {
connector_refund_id: item.response.transaction_id.to_string(),
refund_status: common_enums::RefundStatus::from(item.response),
status_code: item.http_code,
}),
..item.router_data
})
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "try_from",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_3422008630065729510 | clm | function | // connector-service/backend/connector-integration/src/connectors/helcim/transformers.rs
fn from(item: RefundResponse) -> Self {
match item.transaction_type {
HelcimRefundTransactionType::Refund => match item.status {
HelcimPaymentStatus::Approved => Self::Success,
HelcimPaymentStatus::Declined => Self::Failure,
},
}
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "from",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_-4321416530944177081 | clm | function | // connector-service/backend/connector-integration/src/connectors/braintree/transformers.rs
fn try_from(
(item, metadata): (
BraintreeRouterData<
RouterDataV2<
Authorize,
PaymentFlowData,
PaymentsAuthorizeData<T>,
PaymentsResponseData,
>,
T,
>,
BraintreeMeta,
),
) -> Result<Self, Self::Error> {
let reference_id = Some(
item.router_data
.resource_common_data
.connector_request_reference_id
.clone(),
);
let order_id = reference_id.ok_or(
errors::ConnectorError::MissingConnectorRelatedTransactionID {
id: "order_id".to_string(),
},
)?;
let amount = item
.connector
.amount_converter
.convert(
item.router_data.request.minor_amount,
item.router_data.request.currency,
)
.change_context(ConnectorError::AmountConversionFailed)?;
let (query, transaction_body) = if item.router_data.request.is_mandate_payment() {
(
if item.router_data.request.is_auto_capture()? {
constants::CHARGE_AND_VAULT_TRANSACTION_MUTATION.to_string()
} else {
constants::AUTHORIZE_AND_VAULT_CREDIT_CARD_MUTATION.to_string()
},
TransactionBody::Vault(VaultTransactionBody {
amount,
merchant_account_id: metadata.merchant_account_id,
vault_payment_method_after_transacting: TransactionTiming {
when: "ALWAYS".to_string(),
},
customer_details: item
.router_data
.resource_common_data
.get_billing_email()
.ok()
.map(|email| CustomerBody { email }),
order_id,
}),
)
} else {
(
if item.router_data.request.is_auto_capture()? {
constants::CHARGE_CREDIT_CARD_MUTATION.to_string()
} else {
constants::AUTHORIZE_CREDIT_CARD_MUTATION.to_string()
},
TransactionBody::Regular(RegularTransactionBody {
amount,
merchant_account_id: metadata.merchant_account_id,
channel: constants::CHANNEL_CODE.to_string(),
customer_details: item
.router_data
.resource_common_data
.get_billing_email()
.ok()
.map(|email| CustomerBody { email }),
order_id,
}),
)
};
Ok(Self {
query,
variables: VariablePaymentInput {
input: PaymentInput {
payment_method_id: match item
.router_data
.resource_common_data
.get_payment_method_token()?
{
PaymentMethodTokenFlow::Token(token) => token,
PaymentMethodTokenFlow::ApplePayDecrypt(_) => Err(
unimplemented_payment_method!("Apple Pay", "Simplified", "Braintree"),
)?,
PaymentMethodTokenFlow::PazeDecrypt(_) => {
Err(unimplemented_payment_method!("Paze", "Braintree"))?
}
PaymentMethodTokenFlow::GooglePayDecrypt(_) => {
Err(unimplemented_payment_method!("Google Pay", "Braintree"))?
}
},
transaction: transaction_body,
},
},
})
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "try_from",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_1904185500043067894 | clm | function | // connector-service/backend/connector-integration/src/connectors/braintree/transformers.rs
fn build_error_response<T>(
response: &[ErrorDetails],
http_code: u16,
) -> Result<T, Box<domain_types::router_data::ErrorResponse>> {
let error_messages = response
.iter()
.map(|error| error.message.to_string())
.collect::<Vec<String>>();
let reason = match !error_messages.is_empty() {
true => Some(error_messages.join(" ")),
false => None,
};
get_error_response(
response
.first()
.and_then(|err_details| err_details.extensions.as_ref())
.and_then(|extensions| extensions.legacy_code.clone()),
response
.first()
.map(|err_details| err_details.message.clone()),
reason,
http_code,
)
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "build_error_response",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_-6761038712963536350 | clm | function | // connector-service/backend/connector-integration/src/connectors/braintree/transformers.rs
fn get_error_response<T>(
error_code: Option<String>,
error_msg: Option<String>,
error_reason: Option<String>,
http_code: u16,
) -> Result<T, Box<domain_types::router_data::ErrorResponse>> {
Err(Box::new(domain_types::router_data::ErrorResponse {
code: error_code.unwrap_or_else(|| NO_ERROR_CODE.to_string()),
message: error_msg.unwrap_or_else(|| NO_ERROR_MESSAGE.to_string()),
reason: error_reason,
status_code: http_code,
attempt_status: None,
connector_transaction_id: None,
network_advice_code: None,
network_decline_code: None,
network_error_message: None,
}))
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_error_response",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_-7817174023340429534 | clm | function | // connector-service/backend/connector-integration/src/connectors/braintree/transformers.rs
fn create_failure_error_response<T: ToString>(
status: T,
connector_id: Option<String>,
http_code: u16,
) -> domain_types::router_data::ErrorResponse {
let status_string = status.to_string();
domain_types::router_data::ErrorResponse {
code: status_string.clone(),
message: status_string.clone(),
reason: Some(status_string),
attempt_status: None,
connector_transaction_id: connector_id,
status_code: http_code,
network_advice_code: None,
network_decline_code: None,
network_error_message: None,
}
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "create_failure_error_response",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_-8268771788428002779 | clm | function | // connector-service/backend/connector-integration/src/connectors/braintree/transformers.rs
fn from(item: BraintreeRefundStatus) -> Self {
match item {
BraintreeRefundStatus::Settled
| BraintreeRefundStatus::Settling
| BraintreeRefundStatus::SubmittedForSettlement
| BraintreeRefundStatus::SettlementPending => Self::Success,
BraintreeRefundStatus::Failed => Self::Failure,
}
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "from",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_483564631913249337 | clm | function | // connector-service/backend/connector-integration/src/connectors/braintree/transformers.rs
fn extract_metadata_field<T>(
metadata: &Option<pii::SecretSerdeValue>,
field_name: &'static str,
) -> Result<T, error_stack::Report<errors::ConnectorError>>
where
T: std::str::FromStr,
T::Err: std::fmt::Debug,
{
metadata
.as_ref()
.and_then(|metadata| {
let exposed = metadata.clone().expose();
exposed
.get(field_name)
.and_then(|v| v.as_str())
.and_then(|s| s.parse().ok())
})
.ok_or_else(|| errors::ConnectorError::MissingRequiredField { field_name }.into())
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "extract_metadata_field",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_3195557981787106941 | clm | function | // connector-service/backend/connector-integration/src/connectors/braintree/transformers.rs
fn extract_metadata_string_field(
metadata: &Option<pii::SecretSerdeValue>,
field_name: &'static str,
) -> Result<Secret<String>, error_stack::Report<errors::ConnectorError>> {
metadata
.as_ref()
.and_then(|metadata| {
let exposed = metadata.clone().expose();
exposed
.get(field_name)
.and_then(|v| v.as_str())
.map(|s| Secret::new(s.to_string()))
})
.ok_or_else(|| errors::ConnectorError::MissingRequiredField { field_name }.into())
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "extract_metadata_string_field",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_8831325716289253065 | clm | function | // connector-service/backend/connector-integration/src/connectors/braintree/transformers.rs
fn get_card_isin_from_payment_method_data<T>(
card_details: &PaymentMethodData<T>,
) -> Result<String, error_stack::Report<errors::ConnectorError>>
where
T: PaymentMethodDataTypes
+ std::fmt::Debug
+ std::marker::Sync
+ std::marker::Send
+ 'static
+ Serialize,
{
match card_details {
PaymentMethodData::Card(card_data) => {
let card_number_str = format!("{:?}", card_data.card_number.0);
let cleaned_number = card_number_str
.chars()
.filter(|c| c.is_ascii_digit())
.take(6)
.collect::<String>();
Ok(cleaned_number)
}
_ => Err(errors::ConnectorError::NotImplemented("given payment method".to_owned()).into()),
}
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_card_isin_from_payment_method_data",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_660694642381827870 | clm | function | // connector-service/backend/connector-integration/src/connectors/braintree/transformers.rs
fn get_braintree_redirect_form<
T: PaymentMethodDataTypes
+ std::fmt::Debug
+ std::marker::Sync
+ std::marker::Send
+ 'static
+ Serialize,
>(
client_token_data: ClientTokenResponse,
payment_method_token: PaymentMethodTokenFlow,
card_details: PaymentMethodData<T>,
complete_authorize_url: String,
) -> Result<RedirectForm, error_stack::Report<errors::ConnectorError>> {
Ok(RedirectForm::Braintree {
client_token: client_token_data
.data
.create_client_token
.client_token
.expose(),
card_token: match payment_method_token {
PaymentMethodTokenFlow::Token(token) => token.expose(),
PaymentMethodTokenFlow::ApplePayDecrypt(_) => Err(unimplemented_payment_method!(
"Apple Pay",
"Simplified",
"Braintree"
))?,
PaymentMethodTokenFlow::PazeDecrypt(_) => {
Err(unimplemented_payment_method!("Paze", "Braintree"))?
}
PaymentMethodTokenFlow::GooglePayDecrypt(_) => {
Err(unimplemented_payment_method!("Google Pay", "Braintree"))?
}
},
bin: match card_details {
PaymentMethodData::Card(_) => get_card_isin_from_payment_method_data(&card_details)?,
PaymentMethodData::CardRedirect(_)
| PaymentMethodData::Wallet(_)
| PaymentMethodData::PayLater(_)
| PaymentMethodData::BankRedirect(_)
| PaymentMethodData::BankDebit(_)
| PaymentMethodData::BankTransfer(_)
| PaymentMethodData::Crypto(_)
| PaymentMethodData::MandatePayment
| PaymentMethodData::OpenBanking(_)
| PaymentMethodData::Reward
| PaymentMethodData::RealTimePayment(_)
| PaymentMethodData::MobilePayment(_)
| PaymentMethodData::Upi(_)
| PaymentMethodData::Voucher(_)
| PaymentMethodData::GiftCard(_)
| PaymentMethodData::CardToken(_)
| PaymentMethodData::NetworkToken(_)
| PaymentMethodData::CardDetailsForNetworkTransactionId(_) => Err(
errors::ConnectorError::NotImplemented("given payment method".to_owned()),
)?,
},
acs_url: complete_authorize_url,
})
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_braintree_redirect_form",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_-4509922505890427308 | clm | function | // connector-service/backend/connector-integration/src/connectors/braintree/transformers.rs
fn validate_currency(
request_currency: enums::Currency,
merchant_config_currency: Option<enums::Currency>,
) -> Result<(), errors::ConnectorError> {
let merchant_config_currency =
merchant_config_currency.ok_or(errors::ConnectorError::NoConnectorMetaData)?;
if request_currency != merchant_config_currency {
Err(errors::ConnectorError::NotSupported {
message: format!(
"currency {request_currency} is not supported for this merchant account",
),
connector: "Braintree",
})?
}
Ok(())
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "validate_currency",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_-3077146323451367751 | clm | function | // connector-service/backend/connector-integration/src/connectors/worldpay/response.rs
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Self::Authorized => write!(f, "authorized"),
Self::Refused => write!(f, "refused"),
Self::SentForSettlement => write!(f, "sentForSettlement"),
Self::SentForRefund => write!(f, "sentForRefund"),
Self::FraudHighRisk => write!(f, "fraudHighRisk"),
Self::ThreeDsDeviceDataRequired => write!(f, "3dsDeviceDataRequired"),
Self::SentForCancellation => write!(f, "sentForCancellation"),
Self::ThreeDsAuthenticationFailed => write!(f, "3dsAuthenticationFailed"),
Self::SentForPartialRefund => write!(f, "sentForPartialRefund"),
Self::ThreeDsChallenged => write!(f, "3dsChallenged"),
Self::ThreeDsUnavailable => write!(f, "3dsUnavailable"),
}
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "fmt",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_-3524783540640719383 | clm | function | // connector-service/backend/connector-integration/src/connectors/worldpay/response.rs
pub fn get_resource_id<T, F>(
response: WorldpayPaymentsResponse,
connector_transaction_id: Option<String>,
transform_fn: F,
) -> Result<T, error_stack::Report<errors::ConnectorError>>
where
F: Fn(String) -> T,
{
// First check top-level _links (for capture, authorize, etc.)
let optional_reference_id = response
.links
.as_ref()
.and_then(|link| link.self_link.href.rsplit_once('/').map(|(_, h)| h))
.or_else(|| {
// Fallback to variant-specific logic for DDC and 3DS challenges
response
.other_fields
.as_ref()
.and_then(|other_fields| match other_fields {
WorldpayPaymentResponseFields::DDCResponse(res) => {
res.actions.supply_ddc_data.href.split('/').nth_back(1)
}
WorldpayPaymentResponseFields::ThreeDsChallenged(res) => res
.actions
.complete_three_ds_challenge
.href
.split('/')
.nth_back(1),
_ => None,
})
})
.map(|href| {
urlencoding::decode(href)
.map(|s| transform_fn(s.into_owned()))
.change_context(errors::ConnectorError::ResponseHandlingFailed)
})
.transpose()?;
optional_reference_id
.or_else(|| response.transaction_reference.map(&transform_fn))
.or_else(|| connector_transaction_id.map(&transform_fn))
.ok_or_else(|| {
errors::ConnectorError::MissingRequiredField {
field_name: "_links.self.href or transactionReference",
}
.into()
})
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_resource_id",
"is_async": false,
"is_pub": true,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_-5966574990451940024 | clm | function | // connector-service/backend/connector-integration/src/connectors/worldpay/response.rs
pub fn new(reference: String) -> Self {
Self { reference }
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "new",
"is_async": false,
"is_pub": true,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_-8949055349067764251 | clm | function | // connector-service/backend/connector-integration/src/connectors/worldpay/response.rs
pub fn default(status_code: u16) -> Self {
match status_code {
code @ 404 => Self {
error_name: format!("{code} Not found"),
message: "Resource not found".to_string(),
validation_errors: None,
},
code => Self {
error_name: code.to_string(),
message: "Unknown error".to_string(),
validation_errors: None,
},
}
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "default",
"is_async": false,
"is_pub": true,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_-6870044579557088761 | clm | function | // connector-service/backend/connector-integration/src/connectors/worldpay/transformers.rs
fn try_from(
item: ResponseRouterData<WorldpayPaymentsResponse, Self>,
) -> Result<Self, Self::Error> {
let status = enums::AttemptStatus::from(item.response.outcome.clone());
let (_redirection_data, connector_response_reference_id) =
extract_redirection_data(&item.response)?;
let _connector_metadata = extract_three_ds_metadata(&item.response);
let response = Ok(PaymentsResponseData::PostAuthenticateResponse {
authentication_data: None,
connector_response_reference_id,
status_code: item.http_code,
});
Ok(Self {
resource_common_data: PaymentFlowData {
status,
..item.router_data.resource_common_data
},
response,
..item.router_data
})
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "try_from",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_5057857530063268768 | clm | function | // connector-service/backend/connector-integration/src/connectors/worldpay/transformers.rs
fn fetch_payment_instrument<
T: PaymentMethodDataTypes
+ std::fmt::Debug
+ std::marker::Sync
+ std::marker::Send
+ 'static
+ Serialize,
>(
payment_method: PaymentMethodData<T>,
billing_address: Option<&domain_types::payment_address::Address>,
) -> CustomResult<PaymentInstrument<T>, errors::ConnectorError> {
match payment_method {
PaymentMethodData::Card(card) => {
// Extract expiry month and year using helper functions
let expiry_month_i8 = card.get_expiry_month_as_i8()?;
let expiry_year_4_digit = card.get_expiry_year_4_digit();
let expiry_year: i32 = expiry_year_4_digit
.peek()
.parse::<i32>()
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
Ok(PaymentInstrument::Card(CardPayment {
raw_card_details: RawCardDetails {
payment_type: PaymentType::Plain,
expiry_date: ExpiryDate {
month: expiry_month_i8,
year: Secret::new(expiry_year),
},
card_number: card.card_number,
},
cvc: card.card_cvc,
card_holder_name: billing_address
.and_then(|address| address.get_optional_full_name()),
billing_address: billing_address
.and_then(|addr| addr.address.clone())
.and_then(|address| {
match (address.line1, address.city, address.zip, address.country) {
(Some(address1), Some(city), Some(postal_code), Some(country_code)) => {
Some(BillingAddress {
address1,
address2: address.line2,
address3: address.line3,
city,
state: address.state,
postal_code,
country_code,
})
}
_ => None,
}
}),
}))
}
PaymentMethodData::CardDetailsForNetworkTransactionId(raw_card_details) => {
// Extract expiry month and year using helper functions
let expiry_month_i8 = raw_card_details.get_expiry_month_as_i8()?;
let expiry_year_4_digit = raw_card_details.get_expiry_year_4_digit();
let expiry_year: i32 = expiry_year_4_digit
.peek()
.parse::<i32>()
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
Ok(PaymentInstrument::RawCardForNTI(RawCardDetails {
payment_type: PaymentType::Plain,
expiry_date: ExpiryDate {
month: expiry_month_i8,
year: Secret::new(expiry_year),
},
card_number: RawCardNumber(raw_card_details.card_number),
}))
}
PaymentMethodData::MandatePayment => {
Err(errors::ConnectorError::NotImplemented(
"MandatePayment should not be used in Authorize flow - use RepeatPayment flow for MIT transactions".to_string()
).into())
}
PaymentMethodData::Wallet(wallet) => match wallet {
WalletDataPaymentMethod::GooglePay(data) => {
Ok(PaymentInstrument::Googlepay(WalletPayment {
payment_type: PaymentType::Encrypted,
wallet_token: Secret::new(
data.tokenization_data
.get_encrypted_google_pay_token()
.change_context(errors::ConnectorError::MissingRequiredField {
field_name: "gpay wallet_token",
})?,
),
..WalletPayment::default()
}))
}
WalletDataPaymentMethod::ApplePay(data) => {
Ok(PaymentInstrument::Applepay(WalletPayment {
payment_type: PaymentType::Encrypted,
wallet_token: data.get_applepay_decoded_payment_data()?,
..WalletPayment::default()
}))
}
WalletDataPaymentMethod::AliPayQr(_)
| WalletDataPaymentMethod::AliPayRedirect(_)
| WalletDataPaymentMethod::AliPayHkRedirect(_)
| WalletDataPaymentMethod::AmazonPayRedirect(_)
| WalletDataPaymentMethod::MomoRedirect(_)
| WalletDataPaymentMethod::KakaoPayRedirect(_)
| WalletDataPaymentMethod::GoPayRedirect(_)
| WalletDataPaymentMethod::GcashRedirect(_)
| WalletDataPaymentMethod::ApplePayRedirect(_)
| WalletDataPaymentMethod::ApplePayThirdPartySdk(_)
| WalletDataPaymentMethod::DanaRedirect {}
| WalletDataPaymentMethod::GooglePayRedirect(_)
| WalletDataPaymentMethod::GooglePayThirdPartySdk(_)
| WalletDataPaymentMethod::MbWayRedirect(_)
| WalletDataPaymentMethod::MobilePayRedirect(_)
| WalletDataPaymentMethod::PaypalRedirect(_)
| WalletDataPaymentMethod::PaypalSdk(_)
| WalletDataPaymentMethod::Paze(_)
| WalletDataPaymentMethod::SamsungPay(_)
| WalletDataPaymentMethod::TwintRedirect {}
| WalletDataPaymentMethod::VippsRedirect {}
| WalletDataPaymentMethod::TouchNGoRedirect(_)
| WalletDataPaymentMethod::WeChatPayRedirect(_)
| WalletDataPaymentMethod::CashappQr(_)
| WalletDataPaymentMethod::SwishQr(_)
| WalletDataPaymentMethod::WeChatPayQr(_)
| WalletDataPaymentMethod::Mifinity(_)
| WalletDataPaymentMethod::RevolutPay(_)
| WalletDataPaymentMethod::BluecodeRedirect {} => {
Err(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message("worldpay"),
)
.into())
}
},
PaymentMethodData::PayLater(_)
| PaymentMethodData::BankRedirect(_)
| PaymentMethodData::BankDebit(_)
| PaymentMethodData::BankTransfer(_)
| PaymentMethodData::Crypto(_)
| PaymentMethodData::Reward
| PaymentMethodData::RealTimePayment(_)
| PaymentMethodData::MobilePayment(_)
| PaymentMethodData::Upi(_)
| PaymentMethodData::Voucher(_)
| PaymentMethodData::CardRedirect(_)
| PaymentMethodData::GiftCard(_)
| PaymentMethodData::OpenBanking(_)
| PaymentMethodData::CardToken(_)
| PaymentMethodData::NetworkToken(_) => Err(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message("worldpay"),
)
.into()),
}
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "fetch_payment_instrument",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_2092038884879643199 | clm | function | // connector-service/backend/connector-integration/src/connectors/worldpay/transformers.rs
fn create_three_ds_request<
T: PaymentMethodDataTypes
+ std::fmt::Debug
+ std::marker::Sync
+ std::marker::Send
+ 'static
+ Serialize,
>(
router_data: &RouterDataV2<
Authorize,
PaymentFlowData,
PaymentsAuthorizeData<T>,
PaymentsResponseData,
>,
is_mandate_payment: bool,
) -> Result<Option<ThreeDSRequest>, error_stack::Report<errors::ConnectorError>> {
match (
&router_data.resource_common_data.auth_type,
&router_data.request.payment_method_data,
) {
// 3DS for NTI flow
(_, PaymentMethodData::CardDetailsForNetworkTransactionId(_)) => Ok(None),
// 3DS for regular payments
(enums::AuthenticationType::ThreeDs, _) => {
let browser_info = router_data.request.browser_info.as_ref().ok_or(
errors::ConnectorError::MissingRequiredField {
field_name: "browser_info",
},
)?;
let accept_header = browser_info
.accept_header
.clone()
.get_required_value("accept_header")
.change_context(errors::ConnectorError::MissingRequiredField {
field_name: "accept_header",
})?;
let user_agent_header = browser_info
.user_agent
.clone()
.get_required_value("user_agent")
.change_context(errors::ConnectorError::MissingRequiredField {
field_name: "user_agent",
})?;
let channel = Some(ThreeDSRequestChannel::Browser);
Ok(Some(ThreeDSRequest {
three_ds_type: super::requests::THREE_DS_TYPE.to_string(),
mode: super::requests::THREE_DS_MODE.to_string(),
device_data: ThreeDSRequestDeviceData {
accept_header,
user_agent_header,
browser_language: browser_info.language.clone(),
browser_screen_width: browser_info.screen_width,
browser_screen_height: browser_info.screen_height,
browser_color_depth: browser_info.color_depth.map(|depth| depth.to_string()),
time_zone: browser_info.time_zone.map(|tz| tz.to_string()),
browser_java_enabled: browser_info.java_enabled,
browser_javascript_enabled: browser_info.java_script_enabled,
channel,
},
challenge: ThreeDSRequestChallenge {
return_url: router_data.request.get_complete_authorize_url()?,
preference: if is_mandate_payment {
Some(super::requests::THREE_DS_CHALLENGE_PREFERENCE.to_string())
} else {
None
},
},
}))
}
// Non 3DS
_ => Ok(None),
}
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "create_three_ds_request",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_-7406223009684672156 | clm | function | // connector-service/backend/connector-integration/src/connectors/worldpay/transformers.rs
fn get_settlement_info<
T: PaymentMethodDataTypes
+ std::fmt::Debug
+ std::marker::Sync
+ std::marker::Send
+ 'static
+ Serialize,
>(
router_data: &RouterDataV2<
Authorize,
PaymentFlowData,
PaymentsAuthorizeData<T>,
PaymentsResponseData,
>,
amount: MinorUnit,
) -> Option<AutoSettlement> {
match router_data.request.capture_method.unwrap_or_default() {
_ if amount == MinorUnit::zero() => None,
enums::CaptureMethod::Automatic | enums::CaptureMethod::SequentialAutomatic => {
Some(AutoSettlement { auto: true })
}
enums::CaptureMethod::Manual | enums::CaptureMethod::ManualMultiple => {
Some(AutoSettlement { auto: false })
}
_ => None,
}
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_settlement_info",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_-6268339382331430753 | clm | function | // connector-service/backend/connector-integration/src/connectors/worldpay/transformers.rs
fn get_token_and_agreement<
T: PaymentMethodDataTypes
+ std::fmt::Debug
+ std::marker::Sync
+ std::marker::Send
+ 'static
+ Serialize,
>(
payment_method_data: &PaymentMethodData<T>,
setup_future_usage: Option<enums::FutureUsage>,
off_session: Option<bool>,
mandate_ids: Option<MandateIds>,
) -> (Option<TokenCreation>, Option<CustomerAgreement>) {
match (payment_method_data, setup_future_usage, off_session) {
// CIT - Setup for future usage (creates token for future MIT via RepeatPayment)
(PaymentMethodData::Card(_), Some(enums::FutureUsage::OffSession), _) => (
Some(TokenCreation {
token_type: TokenCreationType::Worldpay,
}),
Some(CustomerAgreement {
agreement_type: CustomerAgreementType::Subscription,
stored_card_usage: Some(StoredCardUsageType::First),
scheme_reference: None,
}),
),
// NTI with raw card data
(PaymentMethodData::CardDetailsForNetworkTransactionId(_), _, _) => (
None,
mandate_ids.and_then(|mandate_ids| {
mandate_ids
.mandate_reference_id
.and_then(|mandate_id| match mandate_id {
MandateReferenceId::NetworkMandateId(network_transaction_id) => {
Some(CustomerAgreement {
agreement_type: CustomerAgreementType::Unscheduled,
scheme_reference: Some(network_transaction_id.into()),
stored_card_usage: None,
})
}
_ => None,
})
}),
),
_ => (None, None),
}
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_token_and_agreement",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_4046033018174556701 | clm | function | // connector-service/backend/connector-integration/src/connectors/worldpay/transformers.rs
fn from(value: EventType) -> Self {
match value {
EventType::Refunded | EventType::SentForRefund => Self::Success,
EventType::RefundFailed => Self::Failure,
EventType::Authorized
| EventType::Cancelled
| EventType::Settled
| EventType::Refused
| EventType::Error
| EventType::SentForSettlement
| EventType::SentForAuthorization
| EventType::SettlementFailed
| EventType::Expired
| EventType::Unknown => Self::Pending,
}
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "from",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_1170316344125573515 | clm | function | // connector-service/backend/connector-integration/src/connectors/worldpay/transformers.rs
fn foreign_try_from(
item: (WorldpayPaymentsResponse, Option<String>),
) -> Result<Self, Self::Error> {
get_resource_id(item.0, item.1, Self::ConnectorTransactionId)
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "foreign_try_from",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_4513066018639816036 | clm | function | // connector-service/backend/connector-integration/src/connectors/worldpay/transformers.rs
fn extract_redirection_data(
response: &WorldpayPaymentsResponse,
) -> Result<(Option<RedirectForm>, Option<String>), error_stack::Report<errors::ConnectorError>> {
match &response.other_fields {
Some(WorldpayPaymentResponseFields::ThreeDsChallenged(challenged)) => {
let redirect_form = RedirectForm::Form {
endpoint: challenged.challenge.url.to_string(),
method: common_utils::request::Method::Post,
form_fields: std::collections::HashMap::from([(
"JWT".to_string(),
challenged.challenge.jwt.clone().expose(),
)]),
};
Ok((
Some(redirect_form),
Some(challenged.challenge.reference.clone()),
))
}
Some(WorldpayPaymentResponseFields::DDCResponse(ddc)) => {
let link_data = ddc
.actions
.supply_ddc_data
.href
.split('/')
.nth_back(1)
.map(|s| s.to_string());
let redirect_form = RedirectForm::WorldpayDDCForm {
endpoint: ddc.device_data_collection.url.clone(),
method: common_utils::request::Method::Post,
collection_id: link_data,
form_fields: std::collections::HashMap::from([
(
FORM_FIELD_BIN.to_string(),
ddc.device_data_collection.bin.clone().expose(),
),
(
FORM_FIELD_JWT.to_string(),
ddc.device_data_collection.jwt.clone().expose(),
),
]),
};
Ok((
Some(redirect_form),
Some(METADATA_DDC_REFERENCE.to_string()),
))
}
_ => Ok((None, None)),
}
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "extract_redirection_data",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_5018237074213886487 | clm | function | // connector-service/backend/connector-integration/src/connectors/worldpay/transformers.rs
fn extract_three_ds_metadata(response: &WorldpayPaymentsResponse) -> Option<serde_json::Value> {
match &response.other_fields {
Some(WorldpayPaymentResponseFields::RefusedResponse(refused)) => {
// Check for 3DS data in refused response
if let Some(three_ds) = &refused.three_ds {
let mut metadata = serde_json::Map::new();
if let Some(version) = &three_ds.version {
metadata.insert(
METADATA_3DS_VERSION.to_string(),
serde_json::Value::String(version.clone()),
);
}
if let Some(eci) = &three_ds.eci {
metadata.insert(
METADATA_ECI.to_string(),
serde_json::Value::String(eci.clone()),
);
}
if let Some(applied) = &three_ds.applied {
metadata.insert(
METADATA_AUTH_APPLIED.to_string(),
serde_json::Value::String(applied.clone()),
);
}
if !metadata.is_empty() {
return Some(serde_json::Value::Object(metadata));
}
}
None
}
Some(WorldpayPaymentResponseFields::ThreeDsChallenged(challenged)) => {
let mut metadata = serde_json::Map::new();
metadata.insert(
METADATA_3DS_VERSION.to_string(),
serde_json::Value::String(challenged.authentication.version.clone()),
);
if let Some(eci) = &challenged.authentication.eci {
metadata.insert(
METADATA_ECI.to_string(),
serde_json::Value::String(eci.clone()),
);
}
// Extract linkData and stage for Authenticate response with 3DS challenge
if let Some(link_data) = challenged
.actions
.complete_three_ds_challenge
.href
.split('/')
.nth_back(1)
{
metadata.insert(
"link_data".to_string(),
serde_json::Value::String(link_data.to_string()),
);
metadata.insert(
"3ds_stage".to_string(),
serde_json::Value::String("challenge".to_string()),
);
}
Some(serde_json::Value::Object(metadata))
}
Some(WorldpayPaymentResponseFields::DDCResponse(ddc)) => {
// Extract linkData and stage for Authenticate response with DDC
let mut metadata = serde_json::Map::new();
if let Some(link_data) = ddc.actions.supply_ddc_data.href.split('/').nth_back(1) {
metadata.insert(
"link_data".to_string(),
serde_json::Value::String(link_data.to_string()),
);
metadata.insert(
"3ds_stage".to_string(),
serde_json::Value::String("ddc".to_string()),
);
}
if !metadata.is_empty() {
Some(serde_json::Value::Object(metadata))
} else {
None
}
}
_ => None,
}
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "extract_three_ds_metadata",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_-2123970909380419765 | clm | function | // connector-service/backend/connector-integration/src/connectors/payu/transformers.rs
fn deserialize_payu_status<'de, D>(deserializer: D) -> Result<Option<PayuStatusValue>, D::Error>
where
D: serde::Deserializer<'de>,
{
use serde_json::Value;
let value: Option<Value> = Option::deserialize(deserializer)?;
match value {
Some(Value::Number(n)) => {
if let Some(i) = n.as_i64() {
Ok(Some(PayuStatusValue::IntStatus(i as i32)))
} else {
Ok(None)
}
}
Some(Value::String(s)) => Ok(Some(PayuStatusValue::StringStatus(s))),
_ => Ok(None),
}
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "deserialize_payu_status",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_2420171303857288176 | clm | function | // connector-service/backend/connector-integration/src/connectors/payu/transformers.rs
fn try_from(
item: ResponseRouterData<
PayuSyncResponse,
RouterDataV2<PSync, PaymentFlowData, PaymentsSyncData, PaymentsResponseData>,
>,
) -> Result<Self, Self::Error> {
let response = item.response;
let error_message = response
.msg
.unwrap_or_else(|| "PayU PSync error".to_string());
// Check PayU status field - 0 means error, 1 means success response structure
match (response.status, response.transaction_details) {
(Some(1), Some(transaction_details)) => {
// PayU returned success status, check transaction_details
// Try to find the transaction in the response by iterating through all transactions
// Since PayU returns transaction details as a map with txnid as key
let txn_detail = transaction_details.values().next();
let connector_transaction_id = txn_detail.and_then(|detail| detail.txnid.clone());
match (txn_detail, connector_transaction_id) {
(Some(txn_detail), Some(connector_transaction_id)) => {
// Found transaction details, map status
let attempt_status = map_payu_sync_status(&txn_detail.status, txn_detail);
let payment_response_data = PaymentsResponseData::TransactionResponse {
resource_id: ResponseId::ConnectorTransactionId(
connector_transaction_id.clone(),
),
redirection_data: None,
mandate_reference: None,
connector_metadata: None,
network_txn_id: txn_detail.field1.clone(), // UPI transaction ID
connector_response_reference_id: txn_detail.mihpayid.clone(),
incremental_authorization_allowed: None,
status_code: item.http_code,
};
Ok(Self {
response: Ok(payment_response_data),
resource_common_data: PaymentFlowData {
status: attempt_status,
..item.router_data.resource_common_data
},
..item.router_data
})
}
_ => {
// Transaction not found in PayU response
let error_response = ErrorResponse {
status_code: item.http_code,
code: "TRANSACTION_NOT_FOUND".to_string(),
message: error_message,
reason: None,
attempt_status: Some(AttemptStatus::Failure),
connector_transaction_id: None,
network_error_message: None,
network_advice_code: None,
network_decline_code: None,
};
Ok(Self {
response: Err(error_response),
resource_common_data: PaymentFlowData {
status: AttemptStatus::Failure,
..item.router_data.resource_common_data
},
..item.router_data
})
}
}
}
_ => {
// PayU returned error status
let error_response = ErrorResponse {
status_code: item.http_code,
code: "PAYU_SYNC_ERROR".to_string(),
message: error_message,
reason: None,
attempt_status: Some(AttemptStatus::Failure),
connector_transaction_id: None,
network_error_message: None,
network_advice_code: None,
network_decline_code: None,
};
Ok(Self {
response: Err(error_response),
resource_common_data: PaymentFlowData {
status: AttemptStatus::Failure,
..item.router_data.resource_common_data
},
..item.router_data
})
}
}
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "try_from",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_4643251440628525040 | clm | function | // connector-service/backend/connector-integration/src/connectors/payu/transformers.rs
fn generate_payu_verify_hash(
request: &PayuSyncRequest,
merchant_salt: &Secret<String>,
) -> Result<String, ConnectorError> {
use sha2::{Digest, Sha512};
// PayU verify hash format: key|command|var1|salt
let hash_fields = [
request.key.clone(),
request.command.clone(),
request.var1.clone(),
merchant_salt.peek().to_string(),
];
// Join with pipe separator
let hash_string = hash_fields.join("|");
// Log hash string for debugging (remove in production)
#[cfg(debug_assertions)]
{
let masked_hash = format!(
"{}|***MASKED***",
hash_fields[..hash_fields.len() - 1].join("|")
);
tracing::debug!("PayU verify hash string (salt masked): {}", masked_hash);
tracing::debug!("PayU verify expected format: key|command|var1|salt");
}
// Generate SHA-512 hash
let mut hasher = Sha512::new();
hasher.update(hash_string.as_bytes());
let result = hasher.finalize();
Ok(hex::encode(result))
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "generate_payu_verify_hash",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_6892969105233692280 | clm | function | // connector-service/backend/connector-integration/src/connectors/payu/transformers.rs
fn generate_udf_fields<
T: PaymentMethodDataTypes
+ std::fmt::Debug
+ std::marker::Sync
+ std::marker::Send
+ 'static
+ Serialize,
>(
payment_id: &str,
merchant_id: &str,
router_data: &RouterDataV2<
Authorize,
PaymentFlowData,
PaymentsAuthorizeData<T>,
PaymentsResponseData,
>,
) -> [Option<String>; 10] {
// Based on Haskell implementation:
// udf1-udf5 come from PayuMetaData (if available) or default values
// udf6-udf9 come from orderReference fields
// udf10 is always empty string
// Extract metadata from request
let metadata = router_data.request.metadata.as_ref();
// Helper function to get string value from metadata
let get_metadata_field = |field: &str| -> Option<String> {
metadata
.and_then(|m| m.get(field))
.and_then(|v| v.as_str())
.map(|s| s.to_string())
};
[
// udf1: From metadata "udf1" or default to transaction ID
get_metadata_field("udf1").or(Some(payment_id.to_string())),
// udf2: From metadata "udf2" or default to merchant ID
get_metadata_field("udf2").or(Some(merchant_id.to_string())),
// udf3: From metadata "udf3" or empty
get_metadata_field("udf3"),
// udf4: From metadata "udf4" or empty
get_metadata_field("udf4"),
// udf5: From metadata "udf5" or empty
get_metadata_field("udf5"),
// udf6: From metadata "udf6" or empty
get_metadata_field("udf6"),
// udf7: From metadata "udf7" or empty
get_metadata_field("udf7"),
// udf8: From metadata "udf8" or empty
get_metadata_field("udf8"),
// udf9: From metadata "udf9" or empty
get_metadata_field("udf9"),
// udf9: From metadata "udf10" or empty
get_metadata_field("udf10"),
]
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "generate_udf_fields",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_2289989151232074751 | clm | function | // connector-service/backend/connector-integration/src/connectors/payu/transformers.rs
fn determine_upi_app_name<
T: PaymentMethodDataTypes
+ std::fmt::Debug
+ std::marker::Sync
+ std::marker::Send
+ 'static
+ Serialize,
>(
request: &PaymentsAuthorizeData<T>,
) -> Result<Option<String>, ConnectorError> {
// From Haskell getUpiAppName implementation:
// getUpiAppName txnDetail = case getJuspayBankCodeFromInternalMetadata txnDetail of
// Just "JP_PHONEPE" -> "phonepe"
// Just "JP_GOOGLEPAY" -> "googlepay"
// Just "JP_BHIM" -> "bhim"
// Just "JP_PAYTM" -> "paytm"
// Just "JP_CRED" -> "cred"
// Just "JP_AMAZONPAY" -> "amazonpay"
// Just "JP_WHATSAPP" -> "whatsapp"
// _ -> "genericintent"
match &request.payment_method_data {
PaymentMethodData::Upi(upi_data) => {
match upi_data {
UpiData::UpiIntent(_) | UpiData::UpiQr(_) => {
// For UPI Intent and UPI QR, return generic intent as fallback
// TODO: Extract bank code from metadata if available
Ok(None)
}
UpiData::UpiCollect(upi_collect_data) => {
// UPI Collect doesn't typically use app name
Ok(upi_collect_data.vpa_id.clone().map(|vpa| vpa.expose()))
}
}
}
_ => Ok(None),
}
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "determine_upi_app_name",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_8900165179528914744 | clm | function | // connector-service/backend/connector-integration/src/connectors/payu/transformers.rs
fn determine_upi_flow<
T: PaymentMethodDataTypes
+ std::fmt::Debug
+ std::marker::Sync
+ std::marker::Send
+ 'static
+ Serialize,
>(
request: &PaymentsAuthorizeData<T>,
) -> Result<(Option<String>, Option<String>, Option<String>, String), ConnectorError> {
// Based on Haskell implementation:
// getTxnS2SType :: Bool -> Bool -> Bool -> Bool -> Bool -> Maybe Text
// getTxnS2SType isTxnS2SFlow4Enabled s2sEnabled isDirectOTPTxn isEmandateRegister isDirectAuthorization
match &request.payment_method_data {
PaymentMethodData::Upi(upi_data) => {
match upi_data {
UpiData::UpiCollect(collect_data) => {
if let Some(vpa) = &collect_data.vpa_id {
// UPI Collect flow - based on Haskell implementation
// For UPI Collect: pg = UPI, bankcode = UPI, VPA required
// The key is that VPA must be populated for sourceObject == "UPI_COLLECT"
Ok((
Some(constants::UPI_PG.to_string()),
Some(constants::UPI_COLLECT_BANKCODE.to_string()),
Some(vpa.peek().to_string()),
constants::UPI_S2S_FLOW.to_string(), // UPI Collect typically uses S2S flow "2"
))
} else {
// Missing VPA for UPI Collect - this should be an error
Err(ConnectorError::MissingRequiredField {
field_name: "vpa_id",
})
}
}
UpiData::UpiIntent(_) | UpiData::UpiQr(_) => {
// UPI Intent flow - uses S2S flow "2" for intent-based transactions
// pg=UPI, bankcode=INTENT for intent flows
Ok((
Some(constants::UPI_PG.to_string()),
Some(constants::UPI_INTENT_BANKCODE.to_string()),
None,
constants::UPI_S2S_FLOW.to_string(),
))
}
}
}
_ => Err(ConnectorError::NotSupported {
message: "Payment method not supported by PayU. Only UPI payments are supported"
.to_string(),
connector: "PayU",
}),
}
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "determine_upi_flow",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_3597595834915444626 | clm | function | // connector-service/backend/connector-integration/src/connectors/payu/transformers.rs
pub fn is_upi_collect_flow<
T: PaymentMethodDataTypes
+ std::fmt::Debug
+ std::marker::Sync
+ std::marker::Send
+ 'static
+ Serialize,
>(
request: &PaymentsAuthorizeData<T>,
) -> bool {
// Check if the payment method is UPI Collect
matches!(
request.payment_method_data,
PaymentMethodData::Upi(UpiData::UpiCollect(_))
)
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "is_upi_collect_flow",
"is_async": false,
"is_pub": true,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_-3675838075248781401 | clm | function | // connector-service/backend/connector-integration/src/connectors/payu/transformers.rs
fn generate_payu_hash(
request: &PayuPaymentRequest,
merchant_salt: &Secret<String>,
) -> Result<String, ConnectorError> {
use sha2::{Digest, Sha512};
// Build hash fields array exactly as PayU expects based on Haskell implementation
// Pattern from Haskell: key|txnid|amount|productinfo|firstname|email|udf1|udf2|udf3|udf4|udf5|udf6|udf7|udf8|udf9|udf10|salt
let hash_fields = vec![
request.key.clone(), // key
request.txnid.clone(), // txnid
request.amount.get_amount_as_string(), // amount
request.productinfo.clone(), // productinfo
request.firstname.peek().clone(), // firstname
request.email.peek().clone(), // email
request.udf1.as_deref().unwrap_or("").to_string(), // udf1
request.udf2.as_deref().unwrap_or("").to_string(), // udf2
request.udf3.as_deref().unwrap_or("").to_string(), // udf3
request.udf4.as_deref().unwrap_or("").to_string(), // udf4
request.udf5.as_deref().unwrap_or("").to_string(), // udf5
request.udf6.as_deref().unwrap_or("").to_string(), // udf6
request.udf7.as_deref().unwrap_or("").to_string(), // udf7
request.udf8.as_deref().unwrap_or("").to_string(), // udf8
request.udf9.as_deref().unwrap_or("").to_string(), // udf9
request.udf10.as_deref().unwrap_or("").to_string(), // udf10
merchant_salt.peek().to_string(), // salt
];
// Join with pipe separator as PayU expects
let hash_string = hash_fields.join("|");
// Log hash string for debugging (remove in production)
#[cfg(debug_assertions)]
{
let masked_hash = format!(
"{}|***MASKED***",
hash_fields[..hash_fields.len() - 1].join("|")
);
tracing::debug!("PayU hash string (salt masked): {}", masked_hash);
tracing::debug!("PayU expected format from Haskell: key|txnid|amount|productinfo|firstname|email|udf1|udf2|udf3|udf4|udf5|udf6|udf7|udf8|udf9|udf10|salt");
}
// Generate SHA-512 hash as PayU expects
let mut hasher = Sha512::new();
hasher.update(hash_string.as_bytes());
let result = hasher.finalize();
Ok(hex::encode(result))
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "generate_payu_hash",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_-2560433793100919787 | clm | function | // connector-service/backend/connector-integration/src/connectors/payu/transformers.rs
fn map_payu_sync_status(payu_status: &str, txn_detail: &PayuTransactionDetail) -> AttemptStatus {
match payu_status.to_lowercase().as_str() {
"success" => {
// For success, check if it's captured or just authorized
// Based on Haskell: "success" + "captured" -> CHARGED, "success" + "auth" -> AUTHORIZED
if txn_detail.field3.as_deref() == Some("captured") {
AttemptStatus::Charged
} else if txn_detail.field3.as_deref() == Some("auth") {
AttemptStatus::Authorized
} else {
// Default success case - treat as charged for UPI
AttemptStatus::Charged
}
}
"pending" => {
// Pending status - typically for UPI Collect waiting for customer approval
AttemptStatus::AuthenticationPending
}
"failure" | "failed" | "cancel" | "cancelled" => {
// Transaction failed
AttemptStatus::Failure
}
_ => {
// Unknown status - treat as failure for safety
AttemptStatus::Failure
}
}
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "map_payu_sync_status",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_2732015306476645324 | clm | function | // connector-service/backend/connector-integration/src/connectors/elavon/transformers.rs
fn try_from(value: ResponseRouterData<ElavonPSyncResponse, Self>) -> Result<Self, Self::Error> {
let ResponseRouterData {
response,
router_data,
http_code: _,
} = value;
let final_status = match response.ssl_trans_status {
TransactionSyncStatus::STL => match response.ssl_transaction_type {
SyncTransactionType::Sale => HyperswitchAttemptStatus::Charged,
SyncTransactionType::AuthOnly => HyperswitchAttemptStatus::Charged,
SyncTransactionType::Return => HyperswitchAttemptStatus::Pending,
},
TransactionSyncStatus::OPN => match response.ssl_transaction_type {
SyncTransactionType::AuthOnly => HyperswitchAttemptStatus::Authorized,
SyncTransactionType::Sale => HyperswitchAttemptStatus::Pending,
SyncTransactionType::Return => HyperswitchAttemptStatus::Pending,
},
TransactionSyncStatus::PEN | TransactionSyncStatus::REV => {
HyperswitchAttemptStatus::Pending
}
TransactionSyncStatus::PST
| TransactionSyncStatus::FPR
| TransactionSyncStatus::PRE => {
if response.ssl_transaction_type == SyncTransactionType::AuthOnly
&& response.ssl_trans_status == TransactionSyncStatus::PRE
{
HyperswitchAttemptStatus::AuthenticationFailed
} else {
HyperswitchAttemptStatus::Failure
}
}
};
let payments_response_data = PaymentsResponseData::TransactionResponse {
resource_id: DomainResponseId::ConnectorTransactionId(response.ssl_txn_id.clone()),
redirection_data: None,
connector_metadata: Some(serde_json::json!(response)),
network_txn_id: None,
connector_response_reference_id: None,
incremental_authorization_allowed: None,
mandate_reference: None,
status_code: value.http_code,
};
Ok(RouterDataV2 {
response: Ok(payments_response_data),
resource_common_data: PaymentFlowData {
status: final_status,
..router_data.resource_common_data
},
..router_data
})
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "try_from",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_-1702963613683631798 | clm | function | // connector-service/backend/connector-integration/src/connectors/elavon/transformers.rs
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
let value = match self {
TransactionType::CcSale => "ccsale",
TransactionType::CcAuthOnly => "ccauthonly",
TransactionType::CcComplete => "cccomplete",
TransactionType::CcReturn => "ccreturn",
TransactionType::TxnQuery => "txnquery",
};
serializer.serialize_str(value)
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "serialize",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_-3064796422281063914 | clm | function | // connector-service/backend/connector-integration/src/connectors/elavon/transformers.rs
fn get_avs_details_from_payment_address(
payment_address: Option<&PaymentAddress>,
) -> (Option<Secret<String>>, Option<Secret<String>>) {
payment_address
.and_then(|addr| {
addr.get_payment_billing()
.as_ref()
.and_then(|billing_api_address| {
billing_api_address
.address
.as_ref()
.map(|detailed_address| {
(detailed_address.line1.clone(), detailed_address.zip.clone())
})
})
})
.unwrap_or((None, None))
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_avs_details_from_payment_address",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_-2823517166006697268 | clm | function | // connector-service/backend/connector-integration/src/connectors/elavon/transformers.rs
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: Deserializer<'de>,
{
#[derive(Deserialize, Debug)]
#[serde(rename = "txn")]
struct XmlIshResponse {
#[serde(default)]
error_code: Option<String>,
#[serde(default)]
error_message: Option<String>,
#[serde(default)]
error_name: Option<String>,
#[serde(default)]
ssl_result: Option<String>,
#[serde(default)]
ssl_txn_id: Option<String>,
#[serde(default)]
ssl_result_message: Option<String>,
#[serde(default)]
ssl_token: Option<Secret<String>>,
#[serde(default)]
ssl_token_response: Option<Secret<String>>,
#[serde(default)]
ssl_approval_code: Option<String>,
#[serde(default)]
ssl_transaction_type: Option<String>,
#[serde(default)]
ssl_cvv2_response: Option<Secret<String>>,
#[serde(default)]
ssl_avs_response: Option<String>,
}
let flat_res = XmlIshResponse::deserialize(deserializer)?;
let result = {
if flat_res.ssl_result.as_deref() == Some("0") {
ElavonResult::Success(PaymentResponse {
ssl_result: SslResult::try_from(
flat_res
.ssl_result
.expect("ssl_result checked to be Some(\\\"0\\\")"),
)
.map_err(de::Error::custom)?,
ssl_txn_id: flat_res
.ssl_txn_id
.ok_or_else(|| de::Error::missing_field("ssl_txn_id"))?,
ssl_result_message: flat_res
.ssl_result_message
.ok_or_else(|| de::Error::missing_field("ssl_result_message"))?,
ssl_token: flat_res.ssl_token,
ssl_approval_code: flat_res.ssl_approval_code,
ssl_transaction_type: flat_res.ssl_transaction_type.clone(),
ssl_cvv2_response: flat_res.ssl_cvv2_response,
ssl_avs_response: flat_res.ssl_avs_response,
ssl_token_response: flat_res.ssl_token_response.map(|s| s.expose()),
})
} else if flat_res.error_message.is_some() {
ElavonResult::Error(ElavonErrorResponse {
error_code: flat_res.error_code.or(flat_res.ssl_result.clone()),
error_message: flat_res.error_message.expect("error_message checked"),
error_name: flat_res.error_name,
ssl_txn_id: flat_res.ssl_txn_id,
})
} else if flat_res.ssl_result.is_some() {
ElavonResult::Error(ElavonErrorResponse {
error_code: flat_res.ssl_result.clone(),
error_message: flat_res
.ssl_result_message
.unwrap_or_else(|| "Transaction resulted in an error".to_string()),
error_name: None,
ssl_txn_id: flat_res.ssl_txn_id,
})
} else {
return Err(de::Error::custom(
"Invalid Response from Elavon - cannot determine success or error state, missing critical fields.",
));
}
};
Ok(Self { result })
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "deserialize",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_6917755796682060175 | clm | function | // connector-service/backend/connector-integration/src/connectors/elavon/transformers.rs
pub fn get_elavon_attempt_status(
elavon_result: &ElavonResult,
http_code: u16,
) -> (HyperswitchAttemptStatus, Option<ErrorResponse>) {
match elavon_result {
ElavonResult::Success(payment_response) => {
let status = match payment_response.ssl_transaction_type.as_deref() {
Some("ccauthonly") | Some("AUTHONLY") => HyperswitchAttemptStatus::Authorized,
Some("ccsale") | Some("cccomplete") | Some("SALE") | Some("COMPLETE") => {
HyperswitchAttemptStatus::Charged
}
_ => match payment_response.ssl_result {
SslResult::Approved => HyperswitchAttemptStatus::Charged,
_ => HyperswitchAttemptStatus::Failure,
},
};
(status, None)
}
ElavonResult::Error(error_resp) => (
HyperswitchAttemptStatus::Failure,
Some(ErrorResponse {
status_code: http_code,
code: error_resp
.error_code
.clone()
.unwrap_or_else(|| NO_ERROR_CODE.to_string()),
message: error_resp.error_message.clone(),
reason: error_resp.error_name.clone(),
attempt_status: Some(HyperswitchAttemptStatus::Failure),
connector_transaction_id: error_resp.ssl_txn_id.clone(),
network_decline_code: None,
network_advice_code: None,
network_error_message: None,
}),
),
}
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_elavon_attempt_status",
"is_async": false,
"is_pub": true,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_9130526359630749664 | clm | function | // connector-service/backend/connector-integration/src/connectors/elavon/transformers.rs
pub fn get_refund_status_from_elavon_sync_response(
elavon_response: &ElavonRSyncResponse,
) -> common_enums::RefundStatus {
match elavon_response.ssl_transaction_type {
SyncTransactionType::Return => match elavon_response.ssl_trans_status {
TransactionSyncStatus::STL => common_enums::RefundStatus::Success,
TransactionSyncStatus::PEN => common_enums::RefundStatus::Pending,
TransactionSyncStatus::OPN => common_enums::RefundStatus::Pending,
TransactionSyncStatus::REV => common_enums::RefundStatus::ManualReview,
TransactionSyncStatus::PST
| TransactionSyncStatus::FPR
| TransactionSyncStatus::PRE => common_enums::RefundStatus::Failure,
},
_ => common_enums::RefundStatus::Pending,
}
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_refund_status_from_elavon_sync_response",
"is_async": false,
"is_pub": true,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_-8228531986439733495 | clm | function | // connector-service/backend/connector-integration/src/connectors/phonepe/transformers.rs
fn default_error_message() -> String {
"Payment processing failed".to_string()
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "default_error_message",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_9063887338537186068 | clm | function | // connector-service/backend/connector-integration/src/connectors/phonepe/transformers.rs
fn default_sync_error_message() -> String {
"Payment sync failed".to_string()
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "default_sync_error_message",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_2575278218298512298 | clm | function | // connector-service/backend/connector-integration/src/connectors/phonepe/transformers.rs
fn try_from(
item: ResponseRouterData<
PhonepeSyncResponse,
RouterDataV2<PSync, PaymentFlowData, PaymentsSyncData, PaymentsResponseData>,
>,
) -> Result<Self, Self::Error> {
let response = &item.response;
if response.success {
if let Some(data) = &response.data {
// Check if we have required fields for a successful transaction
if let (Some(merchant_transaction_id), Some(transaction_id)) =
(&data.merchant_transaction_id, &data.transaction_id)
{
// Map PhonePe response codes to payment statuses based on documentation
let status = match response.code.as_str() {
"PAYMENT_SUCCESS" => common_enums::AttemptStatus::Charged,
"PAYMENT_PENDING" => common_enums::AttemptStatus::Pending,
"PAYMENT_ERROR" | "PAYMENT_DECLINED" | "TIMED_OUT" => {
common_enums::AttemptStatus::Failure
}
"BAD_REQUEST" | "AUTHORIZATION_FAILED" | "TRANSACTION_NOT_FOUND" => {
common_enums::AttemptStatus::Failure
}
"INTERNAL_SERVER_ERROR" => common_enums::AttemptStatus::Pending, // Requires retry per docs
_ => common_enums::AttemptStatus::Pending, // Default to pending for unknown codes
};
Ok(Self {
response: Ok(PaymentsResponseData::TransactionResponse {
resource_id: ResponseId::ConnectorTransactionId(transaction_id.clone()),
redirection_data: None,
mandate_reference: None,
connector_metadata: None,
network_txn_id: None,
connector_response_reference_id: Some(merchant_transaction_id.clone()),
incremental_authorization_allowed: None,
status_code: item.http_code,
}),
resource_common_data: PaymentFlowData {
status,
..item.router_data.resource_common_data
},
..item.router_data
})
} else {
// Data object exists but missing required fields - treat as error
Ok(Self {
response: Err(domain_types::router_data::ErrorResponse {
code: response.code.clone(),
message: response.message.clone(),
reason: None,
status_code: item.http_code,
attempt_status: Some(common_enums::AttemptStatus::Failure),
connector_transaction_id: data.transaction_id.clone(),
network_decline_code: None,
network_advice_code: None,
network_error_message: None,
}),
..item.router_data
})
}
} else {
Err(errors::ConnectorError::ResponseDeserializationFailed.into())
}
} else {
// Error response from sync API - handle specific PhonePe error codes
let error_message = response.message.clone();
let error_code = response.code.clone();
// Map PhonePe error codes to attempt status
let attempt_status = get_phonepe_error_status(&error_code);
Ok(Self {
response: Err(domain_types::router_data::ErrorResponse {
code: error_code,
message: error_message,
reason: None,
status_code: item.http_code,
attempt_status,
connector_transaction_id: response
.data
.as_ref()
.and_then(|data| data.transaction_id.clone()),
network_decline_code: None,
network_advice_code: None,
network_error_message: None,
}),
..item.router_data
})
}
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "try_from",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_6457933934134066336 | clm | function | // connector-service/backend/connector-integration/src/connectors/phonepe/transformers.rs
fn generate_phonepe_checksum(
base64_payload: &str,
api_path: &str,
salt_key: &Secret<String>,
key_index: &str,
) -> Result<String, Error> {
// PhonePe checksum algorithm: SHA256(base64Payload + apiPath + saltKey) + "###" + keyIndex
let checksum_input = format!("{}{}{}", base64_payload, api_path, salt_key.peek());
let sha256 = crypto::Sha256;
let hash_bytes = sha256
.generate_digest(checksum_input.as_bytes())
.change_context(errors::ConnectorError::RequestEncodingFailed)?;
let hash = hash_bytes.iter().fold(String::new(), |mut acc, byte| {
use std::fmt::Write;
write!(&mut acc, "{byte:02x}").unwrap();
acc
});
// Format: hash###keyIndex
Ok(format!(
"{}{}{}",
hash,
constants::CHECKSUM_SEPARATOR,
key_index
))
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "generate_phonepe_checksum",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_2939302677369426907 | clm | function | // connector-service/backend/connector-integration/src/connectors/phonepe/transformers.rs
fn generate_phonepe_sync_checksum(
api_path: &str,
salt_key: &Secret<String>,
key_index: &str,
) -> Result<String, Error> {
// PhonePe sync checksum algorithm: SHA256(apiPath + saltKey) + "###" + keyIndex
let checksum_input = format!("{}{}", api_path, salt_key.peek());
let sha256 = crypto::Sha256;
let hash_bytes = sha256
.generate_digest(checksum_input.as_bytes())
.change_context(errors::ConnectorError::RequestEncodingFailed)?;
let hash = hash_bytes.iter().fold(String::new(), |mut acc, byte| {
use std::fmt::Write;
write!(&mut acc, "{byte:02x}").unwrap();
acc
});
// Format: hash###keyIndex
Ok(format!(
"{}{}{}",
hash,
constants::CHECKSUM_SEPARATOR,
key_index
))
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "generate_phonepe_sync_checksum",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_1109601933934871398 | clm | function | // connector-service/backend/connector-integration/src/connectors/phonepe/transformers.rs
pub fn get_phonepe_error_status(error_code: &str) -> Option<common_enums::AttemptStatus> {
match error_code {
"TRANSACTION_NOT_FOUND" => Some(common_enums::AttemptStatus::Failure),
"401" => Some(common_enums::AttemptStatus::AuthenticationFailed),
"400" | "BAD_REQUEST" => Some(common_enums::AttemptStatus::Failure),
"PAYMENT_ERROR" | "PAYMENT_DECLINED" | "TIMED_OUT" => {
Some(common_enums::AttemptStatus::Failure)
}
"AUTHORIZATION_FAILED" => Some(common_enums::AttemptStatus::AuthenticationFailed),
_ => None,
}
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_phonepe_error_status",
"is_async": false,
"is_pub": true,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_-423506458149436971 | clm | function | // connector-service/backend/connector-integration/src/connectors/novalnet/transformers.rs
fn get_test_mode(item: Option<bool>) -> i8 {
match item {
Some(true) => TEST_MODE_ENABLED,
Some(false) | None => TEST_MODE_DISABLED,
}
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_test_mode",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_8971430297847553901 | clm | function | // connector-service/backend/connector-integration/src/connectors/novalnet/transformers.rs
fn try_from(notif: NovalnetWebhookNotificationResponseRefunds) -> Result<Self, Self::Error> {
match notif.result.status {
NovalnetAPIStatus::Success => {
let refund_id = notif
.transaction
.refund
.tid
.map(|tid| tid.expose().to_string())
.ok_or(errors::ConnectorError::ResponseHandlingFailed)?;
let transaction_status = notif.transaction.status;
Ok(Self {
connector_refund_id: Some(refund_id),
status: common_enums::RefundStatus::from(transaction_status),
status_code: 200,
connector_response_reference_id: None,
error_code: None,
error_message: None,
raw_connector_response: None,
response_headers: None,
})
}
NovalnetAPIStatus::Failure => Ok(Self {
status: common_enums::RefundStatus::Failure,
connector_refund_id: None,
status_code: 200,
connector_response_reference_id: None,
error_code: Some(notif.result.status.to_string()),
error_message: Some(notif.result.status_text),
raw_connector_response: None,
response_headers: None,
}),
}
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "try_from",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_7149848726103475960 | clm | function | // connector-service/backend/connector-integration/src/connectors/novalnet/transformers.rs
fn from(item: NovalnetTransactionStatus) -> Self {
match item {
NovalnetTransactionStatus::Success | NovalnetTransactionStatus::Confirmed => {
Self::Success
}
NovalnetTransactionStatus::Pending => Self::Pending,
NovalnetTransactionStatus::Failure
| NovalnetTransactionStatus::OnHold
| NovalnetTransactionStatus::Deactivated
| NovalnetTransactionStatus::Progress => Self::Failure,
}
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "from",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_8414870376191667064 | clm | function | // connector-service/backend/connector-integration/src/connectors/novalnet/transformers.rs
pub fn get_error_response(result: ResultData, status_code: u16) -> ErrorResponse {
let error_code = result.status;
let error_reason = result.status_text.clone();
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,
}
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_error_response",
"is_async": false,
"is_pub": true,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_6459422468261500668 | clm | function | // connector-service/backend/connector-integration/src/connectors/novalnet/transformers.rs
pub fn get_token(transaction_data: Option<&Self>) -> Option<String> {
if let Some(data) = transaction_data {
match &data.payment_data {
Some(NovalnetResponsePaymentData::Card(card_data)) => {
card_data.token.clone().map(|token| token.expose())
}
Some(NovalnetResponsePaymentData::Paypal(paypal_data)) => {
paypal_data.token.clone().map(|token| token.expose())
}
None => None,
}
} else {
None
}
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_token",
"is_async": false,
"is_pub": true,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_-3398383852508239363 | clm | function | // connector-service/backend/connector-integration/src/connectors/novalnet/transformers.rs
pub fn is_refund_event(event_code: &WebhookEventType) -> bool {
matches!(event_code, WebhookEventType::TransactionRefund)
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "is_refund_event",
"is_async": false,
"is_pub": true,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_-8627989450281061670 | clm | function | // connector-service/backend/connector-integration/src/connectors/novalnet/transformers.rs
pub fn reverse_string(s: &str) -> String {
s.chars().rev().collect()
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "reverse_string",
"is_async": false,
"is_pub": true,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_-2304903721614685179 | clm | function | // connector-service/backend/connector-integration/src/connectors/novalnet/transformers.rs
pub fn get_novalnet_dispute_status(status: WebhookEventType) -> WebhookDisputeStatus {
match status {
WebhookEventType::Chargeback => WebhookDisputeStatus::DisputeOpened,
WebhookEventType::Credit => WebhookDisputeStatus::DisputeWon,
_ => WebhookDisputeStatus::Unknown,
}
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_novalnet_dispute_status",
"is_async": false,
"is_pub": true,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_-8263213910061241151 | clm | function | // connector-service/backend/connector-integration/src/connectors/novalnet/transformers.rs
fn foreign_try_from(value: WebhookDisputeStatus) -> error_stack::Result<Self, Self::Error> {
match value {
WebhookDisputeStatus::DisputeOpened => Ok(Self::DisputeOpened),
WebhookDisputeStatus::DisputeWon => Ok(Self::DisputeWon),
WebhookDisputeStatus::Unknown => Err(ConnectorError::WebhookBodyDecodingFailed)?,
}
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "foreign_try_from",
"is_async": false,
"is_pub": false,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
connector-service_fn_connector-integration_1783837891154918143 | clm | function | // connector-service/backend/connector-integration/src/connectors/novalnet/transformers.rs
pub fn option_to_result<T>(opt: Option<T>) -> Result<T, errors::ConnectorError> {
opt.ok_or(errors::ConnectorError::WebhookBodyDecodingFailed)
}
| {
"chunk": null,
"crate": "connector-integration",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "option_to_result",
"is_async": false,
"is_pub": true,
"lines": null,
"method_name": null,
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "connector-service",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.