id stringlengths 20 153 | type stringclasses 1
value | granularity stringclasses 14
values | content stringlengths 16 84.3k | metadata dict |
|---|---|---|---|---|
connector-service_fn_domain_types_-5362745961345584718 | clm | function | // connector-service/backend/domain_types/src/router_request_types.rs
pub fn get_email(&self) -> Result<Email, Error> {
self.email
.clone()
.ok_or_else(utils::missing_field_err("email"))
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_email",
"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_domain_types_5936836728972859051 | clm | function | // connector-service/backend/domain_types/src/types.rs
fn extract_headers_from_metadata(
metadata: &MaskedMetadata,
) -> Option<HashMap<String, Secret<String>>> {
let mut vault_headers = HashMap::new();
if let Some(vault_creds) = metadata.get(X_EXTERNAL_VAULT_METADATA) {
vault_headers.insert(X_EXTERNAL_VAULT_METADATA.to_string(), vault_creds);
}
if vault_headers.is_empty() {
None
} else {
Some(vault_headers)
}
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "extract_headers_from_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_domain_types_-5648428159486731419 | clm | function | // connector-service/backend/domain_types/src/types.rs
pub fn new(base_url: String, dispute_base_url: Option<String>) -> Self {
Self {
base_url,
dispute_base_url,
secondary_base_url: None,
}
}
| {
"chunk": null,
"crate": "domain_types",
"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_domain_types_-6191848103981654705 | clm | function | // connector-service/backend/domain_types/src/types.rs
fn connectors(&self) -> &Connectors {
&self.connectors
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "connectors",
"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_domain_types_1345813950335438908 | clm | function | // connector-service/backend/domain_types/src/types.rs
fn foreign_try_from(
(value, connectors, metadata): (
grpc_api_types::payments::PaymentServicePostAuthenticateRequest,
Connectors,
&common_utils::metadata::MaskedMetadata,
),
) -> Result<Self, error_stack::Report<Self::Error>> {
let address = match &value.address {
Some(address_value) => {
payment_address::PaymentAddress::foreign_try_from((*address_value).clone())?
}
None => {
return Err(ApplicationErrorResponse::BadRequest(ApiError {
sub_code: "INVALID_ADDRESS".to_owned(),
error_identifier: 400,
error_message: "Address is required".to_owned(),
error_object: None,
}))?
}
};
let merchant_id_from_header = extract_merchant_id_from_metadata(metadata)?;
let vault_headers = extract_headers_from_metadata(metadata);
Ok(Self {
merchant_id: merchant_id_from_header,
payment_id: "IRRELEVANT_PAYMENT_ID".to_string(),
attempt_id: "IRRELEVANT_ATTEMPT_ID".to_string(),
status: common_enums::AttemptStatus::Pending,
payment_method: common_enums::PaymentMethod::foreign_try_from(
value.payment_method.unwrap_or_default(),
)?,
address,
auth_type: common_enums::AuthenticationType::ThreeDs, // Post-auth uses 3DS
connector_request_reference_id: extract_connector_request_reference_id(
&value.request_ref_id,
),
customer_id: None,
connector_customer: None,
description: value.metadata.get("description").cloned(),
return_url: value.return_url.clone(),
connector_meta_data: {
(!value.merchant_account_metadata.is_empty())
.then(|| {
serde_json::to_value(&value.merchant_account_metadata)
.map(common_utils::pii::SecretSerdeValue::new)
.map_err(|_| {
error_stack::Report::new(
ApplicationErrorResponse::InternalServerError(
crate::errors::ApiError {
sub_code: "SERDE_JSON_ERROR".to_owned(),
error_identifier: 500,
error_message:
"Failed to serialize merchant_account_metadata"
.to_owned(),
error_object: None,
},
),
)
})
})
.transpose()?
},
amount_captured: None,
minor_amount_captured: None,
access_token: None,
session_token: None,
reference_id: None,
payment_method_token: None,
preprocessing_id: None,
connector_api_version: None,
test_mode: None,
connector_http_status_code: None,
external_latency: None,
connectors,
raw_connector_response: None,
connector_response_headers: None,
vault_headers,
raw_connector_request: None,
minor_amount_capturable: None,
connector_response: None,
recurring_mandate_payment_data: None,
})
}
| {
"chunk": null,
"crate": "domain_types",
"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_domain_types_5406251786367767754 | clm | function | // connector-service/backend/domain_types/src/types.rs
fn convert_card_details(
card: grpc_api_types::payments::CardDetails,
) -> Result<
payment_method_data::Card<VaultTokenHolder>,
error_stack::Report<ApplicationErrorResponse>,
> {
Ok(payment_method_data::Card {
card_number: RawCardNumber(
card.card_number
.ok_or(ApplicationErrorResponse::BadRequest(ApiError {
sub_code: "MISSING_CARD_NUMBER".to_owned(),
error_identifier: 400,
error_message: "Missing card number".to_owned(),
error_object: None,
}))
.map(|cn| cn.get_card_no())?,
),
card_exp_month: card
.card_exp_month
.ok_or(ApplicationErrorResponse::BadRequest(ApiError {
sub_code: "MISSING_EXP_MONTH".to_owned(),
error_identifier: 400,
error_message: "Missing Card Expiry Month".to_owned(),
error_object: None,
}))?,
card_exp_year: card
.card_exp_year
.ok_or(ApplicationErrorResponse::BadRequest(ApiError {
sub_code: "MISSING_EXP_YEAR".to_owned(),
error_identifier: 400,
error_message: "Missing Card Expiry Year".to_owned(),
error_object: None,
}))?,
card_cvc: card
.card_cvc
.ok_or(ApplicationErrorResponse::BadRequest(ApiError {
sub_code: "MISSING_CVC".to_owned(),
error_identifier: 400,
error_message: "Missing CVC".to_owned(),
error_object: None,
}))?,
card_issuer: card.card_issuer,
card_network: None,
card_type: card.card_type,
card_issuing_country: card.card_issuing_country_alpha2,
bank_code: card.bank_code,
nick_name: card.nick_name.map(|name| name.into()),
card_holder_name: card.card_holder_name,
co_badged_card_data: None,
})
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "convert_card_details",
"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_domain_types_-3204081330955907656 | clm | function | // connector-service/backend/domain_types/src/types.rs
fn foreign_from(method: common_utils::Method) -> Self {
match method {
common_utils::Method::Post => Self::Post,
common_utils::Method::Get => Self::Get,
common_utils::Method::Put => Self::Put,
common_utils::Method::Delete => Self::Delete,
common_utils::Method::Patch => Self::Post, // Patch is not defined in gRPC, using Post
// as a fallback
}
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "foreign_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_domain_types_-8607865889522121409 | clm | function | // connector-service/backend/domain_types/src/types.rs
pub fn generate_create_order_response(
router_data_v2: RouterDataV2<
CreateOrder,
PaymentFlowData,
PaymentCreateOrderData,
PaymentCreateOrderResponse,
>,
) -> Result<PaymentServiceAuthorizeResponse, error_stack::Report<ApplicationErrorResponse>> {
let transaction_response = router_data_v2.response;
let status = router_data_v2.resource_common_data.status;
let grpc_status = grpc_api_types::payments::PaymentStatus::foreign_from(status);
let raw_connector_response = router_data_v2
.resource_common_data
.get_raw_connector_response();
let raw_connector_request = router_data_v2
.resource_common_data
.get_raw_connector_request();
let response = match transaction_response {
Ok(response) => {
// For successful order creation, return basic success response
PaymentServiceAuthorizeResponse {
transaction_id: Some(grpc_api_types::payments::Identifier {
id_type: Some(grpc_api_types::payments::identifier::IdType::Id(
response.order_id,
)),
}),
redirection_data: None,
network_txn_id: None,
response_ref_id: None,
incremental_authorization_allowed: None,
status: grpc_status as i32,
error_message: None,
error_code: None,
status_code: 200,
raw_connector_response,
raw_connector_request,
response_headers: router_data_v2
.resource_common_data
.get_connector_response_headers_as_map(),
connector_metadata: std::collections::HashMap::new(),
state: None,
captured_amount: None,
minor_captured_amount: None,
minor_amount_capturable: None,
mandate_reference: None,
connector_response: None,
}
}
Err(err) => {
let status = err
.attempt_status
.map(grpc_api_types::payments::PaymentStatus::foreign_from)
.unwrap_or_default();
PaymentServiceAuthorizeResponse {
transaction_id: Some(grpc_api_types::payments::Identifier {
id_type: Some(
grpc_api_types::payments::identifier::IdType::NoResponseIdMarker(()),
),
}),
redirection_data: None,
network_txn_id: None,
response_ref_id: err.connector_transaction_id.map(|id| {
grpc_api_types::payments::Identifier {
id_type: Some(grpc_api_types::payments::identifier::IdType::Id(id)),
}
}),
incremental_authorization_allowed: None,
status: status as i32,
error_message: Some(err.message),
error_code: Some(err.code),
status_code: err.status_code as u32,
response_headers: router_data_v2
.resource_common_data
.get_connector_response_headers_as_map(),
connector_metadata: std::collections::HashMap::new(),
raw_connector_response,
raw_connector_request,
state: None,
captured_amount: None,
minor_captured_amount: None,
minor_amount_capturable: None,
mandate_reference: None,
connector_response: None,
}
}
};
Ok(response)
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "generate_create_order_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_domain_types_5307564993304475998 | clm | function | // connector-service/backend/domain_types/src/types.rs
pub fn generate_payment_authorize_response<T: PaymentMethodDataTypes>(
router_data_v2: RouterDataV2<
Authorize,
PaymentFlowData,
PaymentsAuthorizeData<T>,
PaymentsResponseData,
>,
) -> Result<PaymentServiceAuthorizeResponse, error_stack::Report<ApplicationErrorResponse>> {
let transaction_response = router_data_v2.response;
let status = router_data_v2.resource_common_data.status;
info!("Payment authorize response status: {:?}", status);
let order_id = router_data_v2.resource_common_data.reference_id.clone();
let response_headers = router_data_v2
.resource_common_data
.get_connector_response_headers_as_map();
let grpc_status = grpc_api_types::payments::PaymentStatus::foreign_from(status);
let raw_connector_response = router_data_v2
.resource_common_data
.get_raw_connector_response();
let raw_connector_request = router_data_v2
.resource_common_data
.get_raw_connector_request();
// Create state if either access token or connector customer is available
let state = if router_data_v2.resource_common_data.access_token.is_some()
|| router_data_v2
.resource_common_data
.connector_customer
.is_some()
{
Some(ConnectorState {
access_token: router_data_v2
.resource_common_data
.access_token
.as_ref()
.map(|token_data| grpc_api_types::payments::AccessToken {
token: token_data.access_token.clone(),
expires_in_seconds: token_data.expires_in,
token_type: token_data.token_type.clone(),
}),
connector_customer_id: router_data_v2
.resource_common_data
.connector_customer
.clone(),
})
} else {
None
};
let connector_response = router_data_v2
.resource_common_data
.connector_response
.as_ref()
.map(|connector_response_data| {
grpc_api_types::payments::ConnectorResponseData::foreign_try_from(
connector_response_data.clone(),
)
})
.transpose()?;
let response = match transaction_response {
Ok(response) => match response {
PaymentsResponseData::TransactionResponse {
resource_id,
redirection_data,
connector_metadata,
network_txn_id,
connector_response_reference_id,
incremental_authorization_allowed,
mandate_reference,
status_code,
} => {
let mandate_reference_grpc =
mandate_reference.map(|m| grpc_api_types::payments::MandateReference {
mandate_id: m.connector_mandate_id,
payment_method_id: m.payment_method_id,
});
PaymentServiceAuthorizeResponse {
transaction_id: Some(grpc_api_types::payments::Identifier::foreign_try_from(resource_id)?),
redirection_data: redirection_data.map(
|form| {
match *form {
crate::router_response_types::RedirectForm::Form { endpoint, method, form_fields } => {
Ok::<grpc_api_types::payments::RedirectForm, ApplicationErrorResponse>(grpc_api_types::payments::RedirectForm {
form_type: Some(grpc_api_types::payments::redirect_form::FormType::Form(
grpc_api_types::payments::FormData {
endpoint,
method: grpc_api_types::payments::HttpMethod::foreign_from(method) as i32,
form_fields, //TODO
}
))
})
},
router_response_types::RedirectForm::Html { html_data } => {
Ok(grpc_api_types::payments::RedirectForm {
form_type: Some(grpc_api_types::payments::redirect_form::FormType::Html(
grpc_api_types::payments::HtmlData {
html_data,
}
))
})
},
router_response_types::RedirectForm::Uri { uri } => {
Ok(grpc_api_types::payments::RedirectForm {
form_type: Some(grpc_api_types::payments::redirect_form::FormType::Uri(
grpc_api_types::payments::UriData {
uri,
}
))
})
},
crate::router_response_types::RedirectForm::Mifinity { initialization_token } => {
Ok(grpc_api_types::payments::RedirectForm {
form_type: Some(grpc_api_types::payments::redirect_form::FormType::Uri(
grpc_api_types::payments::UriData {
uri: initialization_token,
}
))
})
},
_ => Err(
ApplicationErrorResponse::BadRequest(ApiError {
sub_code: "INVALID_RESPONSE".to_owned(),
error_identifier: 400,
error_message: "Invalid response from connector".to_owned(),
error_object: None,
}))?,
}
}
).transpose()?,
connector_metadata: connector_metadata
.and_then(|value| value.as_object().cloned())
.map(|map| {map.into_iter().filter_map(|(k, v)| v.as_str()
.map(|s| (k, s.to_string())))
.collect::<HashMap<_, _>>()}).unwrap_or_default(),
network_txn_id,
response_ref_id: connector_response_reference_id.map(|id| grpc_api_types::payments::Identifier {
id_type: Some(grpc_api_types::payments::identifier::IdType::Id(id)),
}),
mandate_reference: mandate_reference_grpc,
incremental_authorization_allowed,
status: grpc_status as i32,
error_message: None,
error_code: None,
raw_connector_response,
raw_connector_request,
status_code: status_code as u32,
response_headers,
state,
captured_amount: router_data_v2.resource_common_data.amount_captured,
minor_captured_amount: router_data_v2
.resource_common_data
.minor_amount_captured
.map(|amount_captured| amount_captured.get_amount_as_i64()),
minor_amount_capturable: router_data_v2
.resource_common_data
.minor_amount_capturable
.map(|amount_capturable| amount_capturable.get_amount_as_i64()),
connector_response,
}
}
_ => Err(ApplicationErrorResponse::BadRequest(ApiError {
sub_code: "INVALID_RESPONSE".to_owned(),
error_identifier: 400,
error_message: "Invalid response from connector".to_owned(),
error_object: None,
}))?,
},
Err(err) => {
let status = err
.attempt_status
.map(grpc_api_types::payments::PaymentStatus::foreign_from)
.unwrap_or_default();
PaymentServiceAuthorizeResponse {
transaction_id: Some(grpc_api_types::payments::Identifier {
id_type: Some(
grpc_api_types::payments::identifier::IdType::NoResponseIdMarker(()),
),
}),
redirection_data: None,
network_txn_id: None,
response_ref_id: order_id.map(|id| grpc_api_types::payments::Identifier {
id_type: Some(grpc_api_types::payments::identifier::IdType::Id(id)),
}),
mandate_reference: None,
incremental_authorization_allowed: None,
status: status as i32,
error_message: Some(err.message),
error_code: Some(err.code),
status_code: err.status_code as u32,
response_headers,
raw_connector_response,
raw_connector_request,
connector_metadata: std::collections::HashMap::new(),
state,
captured_amount: None,
minor_captured_amount: None,
minor_amount_capturable: None,
connector_response: None,
}
}
};
Ok(response)
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "generate_payment_authorize_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_domain_types_7637267764714927020 | clm | function | // connector-service/backend/domain_types/src/types.rs
pub fn generate_payment_void_response(
router_data_v2: RouterDataV2<Void, PaymentFlowData, PaymentVoidData, PaymentsResponseData>,
) -> Result<PaymentServiceVoidResponse, error_stack::Report<ApplicationErrorResponse>> {
let transaction_response = router_data_v2.response;
// Create state if either access token or connector customer is available
let state = if router_data_v2.resource_common_data.access_token.is_some()
|| router_data_v2
.resource_common_data
.connector_customer
.is_some()
{
Some(ConnectorState {
access_token: router_data_v2
.resource_common_data
.access_token
.as_ref()
.map(|token_data| grpc_api_types::payments::AccessToken {
token: token_data.access_token.clone(),
expires_in_seconds: token_data.expires_in,
token_type: token_data.token_type.clone(),
}),
connector_customer_id: router_data_v2
.resource_common_data
.connector_customer
.clone(),
})
} else {
None
};
let raw_connector_request = router_data_v2
.resource_common_data
.get_raw_connector_request();
match transaction_response {
Ok(response) => match response {
PaymentsResponseData::TransactionResponse {
resource_id,
redirection_data: _,
connector_metadata: _,
network_txn_id: _,
connector_response_reference_id,
incremental_authorization_allowed,
mandate_reference,
status_code,
} => {
let status = router_data_v2.resource_common_data.status;
let grpc_status = grpc_api_types::payments::PaymentStatus::foreign_from(status);
let grpc_resource_id =
grpc_api_types::payments::Identifier::foreign_try_from(resource_id)?;
let mandate_reference_grpc =
mandate_reference.map(|m| grpc_api_types::payments::MandateReference {
mandate_id: m.connector_mandate_id,
payment_method_id: m.payment_method_id,
});
Ok(PaymentServiceVoidResponse {
transaction_id: Some(grpc_resource_id),
status: grpc_status.into(),
response_ref_id: connector_response_reference_id.map(|id| {
grpc_api_types::payments::Identifier {
id_type: Some(grpc_api_types::payments::identifier::IdType::Id(id)),
}
}),
error_code: None,
error_message: None,
status_code: u32::from(status_code),
response_headers: router_data_v2
.resource_common_data
.get_connector_response_headers_as_map(),
raw_connector_request,
state,
mandate_reference: mandate_reference_grpc,
incremental_authorization_allowed,
})
}
_ => Err(report!(ApplicationErrorResponse::InternalServerError(
ApiError {
sub_code: "INVALID_RESPONSE_TYPE".to_owned(),
error_identifier: 500,
error_message: "Invalid response type received from connector".to_owned(),
error_object: None,
}
))),
},
Err(e) => {
let status = e
.attempt_status
.map(grpc_api_types::payments::PaymentStatus::foreign_from)
.unwrap_or_default();
Ok(PaymentServiceVoidResponse {
transaction_id: Some(grpc_api_types::payments::Identifier {
id_type: Some(
grpc_api_types::payments::identifier::IdType::NoResponseIdMarker(()),
),
}),
response_ref_id: e.connector_transaction_id.map(|id| {
grpc_api_types::payments::Identifier {
id_type: Some(grpc_api_types::payments::identifier::IdType::Id(id)),
}
}),
status: status as i32,
error_message: Some(e.message),
error_code: Some(e.code),
status_code: e.status_code as u32,
response_headers: router_data_v2
.resource_common_data
.get_connector_response_headers_as_map(),
state: None,
raw_connector_request,
mandate_reference: None,
incremental_authorization_allowed: None,
})
}
}
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "generate_payment_void_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_domain_types_-4370289689367593198 | clm | function | // connector-service/backend/domain_types/src/types.rs
pub fn generate_payment_void_post_capture_response(
router_data_v2: RouterDataV2<
VoidPC,
PaymentFlowData,
crate::connector_types::PaymentsCancelPostCaptureData,
PaymentsResponseData,
>,
) -> Result<PaymentServiceVoidPostCaptureResponse, error_stack::Report<ApplicationErrorResponse>> {
let transaction_response = router_data_v2.response;
// If there's an access token in PaymentFlowData, it must be newly generated (needs caching)
let _state = router_data_v2
.resource_common_data
.access_token
.as_ref()
.map(|token_data| ConnectorState {
access_token: Some(grpc_api_types::payments::AccessToken {
token: token_data.access_token.clone(),
expires_in_seconds: token_data.expires_in,
token_type: token_data.token_type.clone(),
}),
connector_customer_id: router_data_v2
.resource_common_data
.connector_customer
.clone(),
});
match transaction_response {
Ok(response) => match response {
PaymentsResponseData::TransactionResponse {
resource_id,
redirection_data: _,
connector_metadata: _,
network_txn_id: _,
connector_response_reference_id,
incremental_authorization_allowed: _,
mandate_reference: _,
status_code,
} => {
let status = router_data_v2.resource_common_data.status;
let grpc_status = grpc_api_types::payments::PaymentStatus::foreign_from(status);
let grpc_resource_id =
grpc_api_types::payments::Identifier::foreign_try_from(resource_id)?;
Ok(PaymentServiceVoidPostCaptureResponse {
transaction_id: Some(grpc_resource_id),
status: grpc_status.into(),
response_ref_id: connector_response_reference_id.map(|id| {
grpc_api_types::payments::Identifier {
id_type: Some(grpc_api_types::payments::identifier::IdType::Id(id)),
}
}),
error_code: None,
error_message: None,
status_code: u32::from(status_code),
response_headers: router_data_v2
.resource_common_data
.get_connector_response_headers_as_map(),
})
}
_ => Err(report!(ApplicationErrorResponse::InternalServerError(
ApiError {
sub_code: "INVALID_RESPONSE_TYPE".to_owned(),
error_identifier: 500,
error_message: "Invalid response type received from connector".to_owned(),
error_object: None,
}
))),
},
Err(e) => {
let status = e
.attempt_status
.map(grpc_api_types::payments::PaymentStatus::foreign_from)
.unwrap_or_default();
Ok(PaymentServiceVoidPostCaptureResponse {
transaction_id: Some(grpc_api_types::payments::Identifier {
id_type: Some(
grpc_api_types::payments::identifier::IdType::NoResponseIdMarker(()),
),
}),
status: status.into(),
response_ref_id: e.connector_transaction_id.map(|id| {
grpc_api_types::payments::Identifier {
id_type: Some(grpc_api_types::payments::identifier::IdType::Id(id)),
}
}),
error_code: Some(e.code),
error_message: Some(e.message),
status_code: u32::from(e.status_code),
response_headers: router_data_v2
.resource_common_data
.get_connector_response_headers_as_map(),
})
}
}
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "generate_payment_void_post_capture_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_domain_types_7097838368851244234 | clm | function | // connector-service/backend/domain_types/src/types.rs
pub fn generate_payment_sync_response(
router_data_v2: RouterDataV2<PSync, PaymentFlowData, PaymentsSyncData, PaymentsResponseData>,
) -> Result<PaymentServiceGetResponse, error_stack::Report<ApplicationErrorResponse>> {
let transaction_response = router_data_v2.response;
let raw_connector_response = router_data_v2
.resource_common_data
.get_raw_connector_response();
// Create state if either access token or connector customer is available
let state = if router_data_v2.resource_common_data.access_token.is_some()
|| router_data_v2
.resource_common_data
.connector_customer
.is_some()
{
Some(ConnectorState {
access_token: router_data_v2
.resource_common_data
.access_token
.as_ref()
.map(|token_data| grpc_api_types::payments::AccessToken {
token: token_data.access_token.clone(),
expires_in_seconds: token_data.expires_in,
token_type: token_data.token_type.clone(),
}),
connector_customer_id: router_data_v2
.resource_common_data
.connector_customer
.clone(),
})
} else {
None
};
let raw_connector_request = router_data_v2
.resource_common_data
.get_raw_connector_request();
let connector_response = router_data_v2
.resource_common_data
.connector_response
.as_ref()
.map(|connector_response_data| {
grpc_api_types::payments::ConnectorResponseData::foreign_try_from(
connector_response_data.clone(),
)
})
.transpose()?;
match transaction_response {
Ok(response) => match response {
PaymentsResponseData::TransactionResponse {
resource_id,
redirection_data: _,
connector_metadata: _,
network_txn_id,
connector_response_reference_id,
incremental_authorization_allowed: _,
mandate_reference,
status_code,
} => {
let status = router_data_v2.resource_common_data.status;
let grpc_status = grpc_api_types::payments::PaymentStatus::foreign_from(status);
let grpc_resource_id =
grpc_api_types::payments::Identifier::foreign_try_from(resource_id)?;
let mandate_reference_grpc =
mandate_reference.map(|m| grpc_api_types::payments::MandateReference {
mandate_id: m.connector_mandate_id,
payment_method_id: m.payment_method_id,
});
Ok(PaymentServiceGetResponse {
transaction_id: Some(grpc_resource_id),
status: grpc_status as i32,
mandate_reference: mandate_reference_grpc,
error_code: None,
error_message: None,
network_txn_id,
response_ref_id: connector_response_reference_id.map(|id| {
grpc_api_types::payments::Identifier {
id_type: Some(grpc_api_types::payments::identifier::IdType::Id(id)),
}
}),
amount: None,
minor_amount: None,
currency: None,
captured_amount: router_data_v2.resource_common_data.amount_captured,
minor_captured_amount: router_data_v2
.resource_common_data
.minor_amount_captured
.map(|amount_captured| amount_captured.get_amount_as_i64()),
payment_method_type: None,
capture_method: None,
auth_type: None,
created_at: None,
updated_at: None,
authorized_at: None,
captured_at: None,
customer_name: None,
email: None,
connector_customer_id: None,
merchant_order_reference_id: None,
metadata: std::collections::HashMap::new(),
status_code: status_code as u32,
raw_connector_response,
response_headers: router_data_v2
.resource_common_data
.get_connector_response_headers_as_map(),
state,
raw_connector_request,
connector_response,
})
}
_ => Err(report!(ApplicationErrorResponse::InternalServerError(
ApiError {
sub_code: "INVALID_RESPONSE_TYPE".to_owned(),
error_identifier: 500,
error_message: "Invalid response type received from connector".to_owned(),
error_object: None,
}
))),
},
Err(e) => {
let status = e
.attempt_status
.map(grpc_api_types::payments::PaymentStatus::foreign_from)
.unwrap_or_default();
Ok(PaymentServiceGetResponse {
transaction_id: Some(grpc_api_types::payments::Identifier {
id_type: Some(if let Some(txn_id) = e.connector_transaction_id {
grpc_api_types::payments::identifier::IdType::Id(txn_id)
} else {
grpc_api_types::payments::identifier::IdType::NoResponseIdMarker(())
}),
}),
mandate_reference: None,
status: status as i32,
error_message: Some(e.message),
error_code: Some(e.code),
network_txn_id: None,
response_ref_id: None,
amount: None,
minor_amount: None,
currency: None,
captured_amount: None,
minor_captured_amount: None,
payment_method_type: None,
capture_method: None,
auth_type: None,
created_at: None,
updated_at: None,
authorized_at: None,
captured_at: None,
customer_name: None,
email: None,
connector_customer_id: None,
merchant_order_reference_id: None,
metadata: std::collections::HashMap::new(),
raw_connector_response,
status_code: e.status_code as u32,
response_headers: router_data_v2
.resource_common_data
.get_connector_response_headers_as_map(),
state,
raw_connector_request,
connector_response: None,
})
}
}
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "generate_payment_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_domain_types_4327484497991821407 | clm | function | // connector-service/backend/domain_types/src/types.rs
pub fn generate_accept_dispute_response(
router_data_v2: RouterDataV2<Accept, DisputeFlowData, AcceptDisputeData, DisputeResponseData>,
) -> Result<AcceptDisputeResponse, error_stack::Report<ApplicationErrorResponse>> {
let dispute_response = router_data_v2.response;
let response_headers = router_data_v2
.resource_common_data
.get_connector_response_headers_as_map();
let raw_connector_request = router_data_v2
.resource_common_data
.get_raw_connector_request();
match dispute_response {
Ok(response) => {
let grpc_status =
grpc_api_types::payments::DisputeStatus::foreign_from(response.dispute_status);
Ok(AcceptDisputeResponse {
dispute_status: grpc_status.into(),
dispute_id: response.connector_dispute_id,
connector_status_code: None,
error_message: None,
error_code: None,
response_ref_id: None,
status_code: response.status_code as u32,
response_headers,
raw_connector_request,
})
}
Err(e) => {
let grpc_dispute_status = grpc_api_types::payments::DisputeStatus::default();
Ok(AcceptDisputeResponse {
dispute_status: grpc_dispute_status as i32,
dispute_id: e.connector_transaction_id.unwrap_or_default(),
connector_status_code: None,
error_message: Some(e.message),
error_code: Some(e.code),
response_ref_id: None,
status_code: e.status_code as u32,
response_headers,
raw_connector_request,
})
}
}
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "generate_accept_dispute_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_domain_types_3597507176957991578 | clm | function | // connector-service/backend/domain_types/src/types.rs
pub fn generate_submit_evidence_response(
router_data_v2: RouterDataV2<
SubmitEvidence,
DisputeFlowData,
SubmitEvidenceData,
DisputeResponseData,
>,
) -> Result<DisputeServiceSubmitEvidenceResponse, error_stack::Report<ApplicationErrorResponse>> {
let dispute_response = router_data_v2.response;
let response_headers = router_data_v2
.resource_common_data
.get_connector_response_headers_as_map();
let raw_connector_request = router_data_v2
.resource_common_data
.get_raw_connector_request();
match dispute_response {
Ok(response) => {
let grpc_status =
grpc_api_types::payments::DisputeStatus::foreign_from(response.dispute_status);
Ok(DisputeServiceSubmitEvidenceResponse {
dispute_status: grpc_status.into(),
dispute_id: Some(response.connector_dispute_id),
submitted_evidence_ids: vec![],
connector_status_code: None,
error_message: None,
error_code: None,
response_ref_id: None,
status_code: response.status_code as u32,
response_headers,
raw_connector_request,
})
}
Err(e) => {
let grpc_attempt_status = e
.attempt_status
.map(grpc_api_types::payments::PaymentStatus::foreign_from)
.unwrap_or_default();
Ok(DisputeServiceSubmitEvidenceResponse {
dispute_status: grpc_attempt_status.into(),
dispute_id: e.connector_transaction_id,
submitted_evidence_ids: vec![],
connector_status_code: None,
error_message: Some(e.message),
error_code: Some(e.code),
response_ref_id: None,
status_code: e.status_code as u32,
response_headers,
raw_connector_request,
})
}
}
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "generate_submit_evidence_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_domain_types_92883177999497284 | clm | function | // connector-service/backend/domain_types/src/types.rs
pub fn generate_refund_sync_response(
router_data_v2: RouterDataV2<RSync, RefundFlowData, RefundSyncData, RefundsResponseData>,
) -> Result<RefundResponse, error_stack::Report<ApplicationErrorResponse>> {
let refunds_response = router_data_v2.response;
let raw_connector_response = router_data_v2
.resource_common_data
.get_raw_connector_response();
let raw_connector_request = router_data_v2
.resource_common_data
.get_raw_connector_request();
match refunds_response {
Ok(response) => {
let status = response.refund_status;
let grpc_status = grpc_api_types::payments::RefundStatus::foreign_from(status);
let response_headers = router_data_v2
.resource_common_data
.get_connector_response_headers_as_map();
Ok(RefundResponse {
transaction_id: Some(grpc_api_types::payments::Identifier::default()),
refund_id: response.connector_refund_id.clone(),
status: grpc_status as i32,
response_ref_id: Some(grpc_api_types::payments::Identifier {
id_type: Some(grpc_api_types::payments::identifier::IdType::Id(
response.connector_refund_id.clone(),
)),
}),
error_code: None,
error_message: None,
refund_amount: None,
minor_refund_amount: None,
refund_currency: None,
payment_amount: None,
minor_payment_amount: None,
refund_reason: None,
created_at: None,
updated_at: None,
processed_at: None,
customer_name: None,
email: None,
merchant_order_reference_id: None,
metadata: std::collections::HashMap::new(),
refund_metadata: std::collections::HashMap::new(),
raw_connector_response,
status_code: response.status_code as u32,
response_headers,
state: None,
raw_connector_request,
})
}
Err(e) => {
let status = e
.attempt_status
.map(grpc_api_types::payments::PaymentStatus::foreign_from)
.unwrap_or_default();
let response_headers = router_data_v2
.resource_common_data
.get_connector_response_headers_as_map();
Ok(RefundResponse {
transaction_id: Some(
e.connector_transaction_id
.as_ref()
.map(|id| grpc_api_types::payments::Identifier {
id_type: Some(grpc_api_types::payments::identifier::IdType::Id(
id.clone(),
)),
})
.unwrap_or_default(),
),
refund_id: String::new(),
status: status as i32,
response_ref_id: e.connector_transaction_id.map(|id| {
grpc_api_types::payments::Identifier {
id_type: Some(grpc_api_types::payments::identifier::IdType::Id(id)),
}
}),
error_code: Some(e.code),
error_message: Some(e.message),
refund_amount: None,
minor_refund_amount: None,
refund_currency: None,
payment_amount: None,
minor_payment_amount: None,
refund_reason: None,
created_at: None,
updated_at: None,
processed_at: None,
customer_name: None,
email: None,
raw_connector_response,
merchant_order_reference_id: None,
metadata: std::collections::HashMap::new(),
refund_metadata: std::collections::HashMap::new(),
status_code: e.status_code as u32,
response_headers,
state: None,
raw_connector_request,
})
}
}
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "generate_refund_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_domain_types_-5473603701916895073 | clm | function | // connector-service/backend/domain_types/src/types.rs
pub fn generate_refund_response(
router_data_v2: RouterDataV2<Refund, RefundFlowData, RefundsData, RefundsResponseData>,
) -> Result<RefundResponse, error_stack::Report<ApplicationErrorResponse>> {
let refund_response = router_data_v2.response;
let raw_connector_response = router_data_v2
.resource_common_data
.get_raw_connector_response();
// RefundFlowData doesn't have access_token field, so no state to return
let state = None;
let raw_connector_request = router_data_v2
.resource_common_data
.get_raw_connector_request();
match refund_response {
Ok(response) => {
let status = response.refund_status;
let grpc_status = grpc_api_types::payments::RefundStatus::foreign_from(status);
Ok(RefundResponse {
transaction_id: Some(grpc_api_types::payments::Identifier::default()),
refund_id: response.connector_refund_id,
status: grpc_status as i32,
response_ref_id: None,
error_code: None,
error_message: None,
refund_amount: None,
minor_refund_amount: None,
refund_currency: None,
payment_amount: None,
minor_payment_amount: None,
refund_reason: None,
created_at: None,
updated_at: None,
processed_at: None,
customer_name: None,
email: None,
merchant_order_reference_id: None,
raw_connector_response,
metadata: std::collections::HashMap::new(),
refund_metadata: std::collections::HashMap::new(),
status_code: response.status_code as u32,
response_headers: router_data_v2
.resource_common_data
.get_connector_response_headers_as_map(),
state,
raw_connector_request,
})
}
Err(e) => {
let status = e
.attempt_status
.map(grpc_api_types::payments::PaymentStatus::foreign_from)
.unwrap_or_default();
Ok(RefundResponse {
transaction_id: Some(
e.connector_transaction_id
.map(|id| grpc_api_types::payments::Identifier {
id_type: Some(grpc_api_types::payments::identifier::IdType::Id(id)),
})
.unwrap_or_default(),
),
refund_id: String::new(),
status: status as i32,
response_ref_id: None,
error_code: Some(e.code),
error_message: Some(e.message),
refund_amount: None,
minor_refund_amount: None,
refund_currency: None,
payment_amount: None,
minor_payment_amount: None,
refund_reason: None,
created_at: None,
updated_at: None,
processed_at: None,
customer_name: None,
email: None,
raw_connector_response,
merchant_order_reference_id: None,
metadata: std::collections::HashMap::new(),
refund_metadata: std::collections::HashMap::new(),
status_code: e.status_code as u32,
response_headers: router_data_v2
.resource_common_data
.get_connector_response_headers_as_map(),
state,
raw_connector_request,
})
}
}
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "generate_refund_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_domain_types_5063655948150355455 | clm | function | // connector-service/backend/domain_types/src/types.rs
pub fn generate_payment_capture_response(
router_data_v2: RouterDataV2<
Capture,
PaymentFlowData,
PaymentsCaptureData,
PaymentsResponseData,
>,
) -> Result<PaymentServiceCaptureResponse, error_stack::Report<ApplicationErrorResponse>> {
let transaction_response = router_data_v2.response;
// Create state if either access token or connector customer is available
let state = if router_data_v2.resource_common_data.access_token.is_some()
|| router_data_v2
.resource_common_data
.connector_customer
.is_some()
{
Some(ConnectorState {
access_token: router_data_v2
.resource_common_data
.access_token
.as_ref()
.map(|token_data| grpc_api_types::payments::AccessToken {
token: token_data.access_token.clone(),
expires_in_seconds: token_data.expires_in,
token_type: token_data.token_type.clone(),
}),
connector_customer_id: router_data_v2
.resource_common_data
.connector_customer
.clone(),
})
} else {
None
};
let raw_connector_request = router_data_v2
.resource_common_data
.get_raw_connector_request();
match transaction_response {
Ok(response) => match response {
PaymentsResponseData::TransactionResponse {
resource_id,
redirection_data: _,
connector_metadata: _,
network_txn_id: _,
connector_response_reference_id,
incremental_authorization_allowed,
mandate_reference,
status_code,
} => {
let status = router_data_v2.resource_common_data.status;
let grpc_status = grpc_api_types::payments::PaymentStatus::foreign_from(status);
let grpc_resource_id =
grpc_api_types::payments::Identifier::foreign_try_from(resource_id)?;
let mandate_reference_grpc =
mandate_reference.map(|m| grpc_api_types::payments::MandateReference {
mandate_id: m.connector_mandate_id,
payment_method_id: m.payment_method_id,
});
Ok(PaymentServiceCaptureResponse {
transaction_id: Some(grpc_resource_id),
response_ref_id: connector_response_reference_id.map(|id| {
grpc_api_types::payments::Identifier {
id_type: Some(grpc_api_types::payments::identifier::IdType::Id(id)),
}
}),
error_code: None,
error_message: None,
status: grpc_status.into(),
status_code: status_code as u32,
response_headers: router_data_v2
.resource_common_data
.get_connector_response_headers_as_map(),
state,
raw_connector_request,
incremental_authorization_allowed,
mandate_reference: mandate_reference_grpc,
captured_amount: router_data_v2.resource_common_data.amount_captured,
minor_captured_amount: router_data_v2
.resource_common_data
.minor_amount_captured
.map(|amount_captured| amount_captured.get_amount_as_i64()),
})
}
_ => Err(report!(ApplicationErrorResponse::InternalServerError(
ApiError {
sub_code: "INVALID_RESPONSE_TYPE".to_owned(),
error_identifier: 500,
error_message: "Invalid response type received from connector".to_owned(),
error_object: None,
}
))),
},
Err(e) => {
let status = e
.attempt_status
.map(grpc_api_types::payments::PaymentStatus::foreign_from)
.unwrap_or_default();
Ok(PaymentServiceCaptureResponse {
transaction_id: Some(grpc_api_types::payments::Identifier {
id_type: Some(
grpc_api_types::payments::identifier::IdType::NoResponseIdMarker(()),
),
}),
response_ref_id: e.connector_transaction_id.map(|id| {
grpc_api_types::payments::Identifier {
id_type: Some(grpc_api_types::payments::identifier::IdType::Id(id)),
}
}),
status: status.into(),
error_message: Some(e.message),
error_code: Some(e.code),
status_code: e.status_code as u32,
response_headers: router_data_v2
.resource_common_data
.get_connector_response_headers_as_map(),
state,
raw_connector_request,
incremental_authorization_allowed: None,
mandate_reference: None,
captured_amount: None,
minor_captured_amount: None,
})
}
}
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "generate_payment_capture_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_domain_types_-6035007039868011658 | clm | function | // connector-service/backend/domain_types/src/types.rs
pub fn generate_setup_mandate_response<T: PaymentMethodDataTypes>(
router_data_v2: RouterDataV2<
SetupMandate,
PaymentFlowData,
SetupMandateRequestData<T>,
PaymentsResponseData,
>,
) -> Result<PaymentServiceRegisterResponse, error_stack::Report<ApplicationErrorResponse>> {
let transaction_response = router_data_v2.response;
let status = router_data_v2.resource_common_data.status;
let grpc_status = grpc_api_types::payments::PaymentStatus::foreign_from(status);
// Create state if either access token or connector customer is available
let state = if router_data_v2.resource_common_data.access_token.is_some()
|| router_data_v2
.resource_common_data
.connector_customer
.is_some()
{
Some(ConnectorState {
access_token: router_data_v2
.resource_common_data
.access_token
.as_ref()
.map(|token_data| grpc_api_types::payments::AccessToken {
token: token_data.access_token.clone(),
expires_in_seconds: token_data.expires_in,
token_type: token_data.token_type.clone(),
}),
connector_customer_id: router_data_v2
.resource_common_data
.connector_customer
.clone(),
})
} else {
None
};
let raw_connector_request = router_data_v2
.resource_common_data
.get_raw_connector_request();
let connector_response = router_data_v2
.resource_common_data
.connector_response
.as_ref()
.map(|connector_response_data| {
grpc_api_types::payments::ConnectorResponseData::foreign_try_from(
connector_response_data.clone(),
)
})
.transpose()?;
let response = match transaction_response {
Ok(response) => match response {
PaymentsResponseData::TransactionResponse {
resource_id,
redirection_data,
connector_metadata: _,
network_txn_id,
connector_response_reference_id,
incremental_authorization_allowed,
mandate_reference,
status_code,
} => {
PaymentServiceRegisterResponse {
registration_id: Some(grpc_api_types::payments::Identifier::foreign_try_from(resource_id)?),
redirection_data: redirection_data.map(
|form| {
match *form {
router_response_types::RedirectForm::Form { endpoint, method, form_fields: _ } => {
Ok::<grpc_api_types::payments::RedirectForm, ApplicationErrorResponse>(grpc_api_types::payments::RedirectForm {
form_type: Some(grpc_api_types::payments::redirect_form::FormType::Form(
grpc_api_types::payments::FormData {
endpoint,
method: match method {
Method::Get => 1,
Method::Post => 2,
Method::Put => 3,
Method::Delete => 4,
_ => 0,
},
form_fields: HashMap::default(), //TODO
}
))
})
},
router_response_types::RedirectForm::Html { html_data } => {
Ok(grpc_api_types::payments::RedirectForm {
form_type: Some(grpc_api_types::payments::redirect_form::FormType::Html(
grpc_api_types::payments::HtmlData {
html_data,
}
))
})
},
_ => Err(
ApplicationErrorResponse::BadRequest(ApiError {
sub_code: "INVALID_RESPONSE".to_owned(),
error_identifier: 400,
error_message: "Invalid response from connector".to_owned(),
error_object: None,
}))?,
}
}
).transpose()?,
network_txn_id,
response_ref_id: connector_response_reference_id.map(|id| grpc_api_types::payments::Identifier {
id_type: Some(grpc_api_types::payments::identifier::IdType::Id(id)),
}),
status: grpc_status as i32,
mandate_reference: Some(grpc_api_types::payments::MandateReference {
mandate_id: mandate_reference.clone().and_then(|m| m.connector_mandate_id),
payment_method_id: mandate_reference.and_then(|m| m.payment_method_id),
}),
incremental_authorization_allowed,
error_message: None,
error_code: None,
status_code: status_code as u32,
response_headers: router_data_v2
.resource_common_data
.get_connector_response_headers_as_map(),
state,
raw_connector_request,
connector_response,
}
}
_ => Err(ApplicationErrorResponse::BadRequest(ApiError {
sub_code: "INVALID_RESPONSE".to_owned(),
error_identifier: 400,
error_message: "Invalid response from connector".to_owned(),
error_object: None,
}))?,
},
Err(err) => PaymentServiceRegisterResponse {
registration_id: Some(grpc_api_types::payments::Identifier {
id_type: Some(grpc_api_types::payments::identifier::IdType::NoResponseIdMarker(())),
}),
redirection_data: None,
network_txn_id: None,
response_ref_id: err.connector_transaction_id.map(|id| {
grpc_api_types::payments::Identifier {
id_type: Some(grpc_api_types::payments::identifier::IdType::Id(id)),
}
}),
status: grpc_status as i32,
mandate_reference: None,
incremental_authorization_allowed: None,
error_message: Some(err.message),
error_code: Some(err.code),
status_code: err.status_code as u32,
response_headers: router_data_v2
.resource_common_data
.get_connector_response_headers_as_map(),
state,
raw_connector_request,
connector_response: None,
},
};
Ok(response)
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "generate_setup_mandate_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_domain_types_8387549574810344720 | clm | function | // connector-service/backend/domain_types/src/types.rs
pub fn generate_defend_dispute_response(
router_data_v2: RouterDataV2<
DefendDispute,
DisputeFlowData,
DisputeDefendData,
DisputeResponseData,
>,
) -> Result<DisputeDefendResponse, error_stack::Report<ApplicationErrorResponse>> {
let defend_dispute_response = router_data_v2.response;
let raw_connector_request = router_data_v2
.resource_common_data
.get_raw_connector_request();
match defend_dispute_response {
Ok(response) => Ok(DisputeDefendResponse {
dispute_id: response.connector_dispute_id,
dispute_status: response.dispute_status as i32,
connector_status_code: None,
error_message: None,
error_code: None,
response_ref_id: None,
status_code: response.status_code as u32,
response_headers: router_data_v2
.resource_common_data
.get_connector_response_headers_as_map(),
raw_connector_request,
}),
Err(e) => Ok(DisputeDefendResponse {
dispute_id: e
.connector_transaction_id
.unwrap_or_else(|| NO_ERROR_CODE.to_string()),
dispute_status: common_enums::DisputeStatus::DisputeLost as i32,
connector_status_code: None,
error_message: Some(e.message),
error_code: Some(e.code),
response_ref_id: None,
status_code: e.status_code as u32,
response_headers: router_data_v2
.resource_common_data
.get_connector_response_headers_as_map(),
raw_connector_request,
}),
}
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "generate_defend_dispute_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_domain_types_-1003705216086411148 | clm | function | // connector-service/backend/domain_types/src/types.rs
pub fn generate_session_token_response(
router_data_v2: RouterDataV2<
CreateSessionToken,
PaymentFlowData,
SessionTokenRequestData,
SessionTokenResponseData,
>,
) -> Result<String, error_stack::Report<ApplicationErrorResponse>> {
let session_token_response = router_data_v2.response;
match session_token_response {
Ok(response) => Ok(response.session_token),
Err(e) => Err(report!(ApplicationErrorResponse::InternalServerError(
ApiError {
sub_code: "SESSION_TOKEN_ERROR".to_string(),
error_identifier: 500,
error_message: format!("Session token creation failed: {}", e.message),
error_object: None,
}
))),
}
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "generate_session_token_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_domain_types_8307721890582249058 | clm | function | // connector-service/backend/domain_types/src/types.rs
pub fn generate_payment_method_token_response<T: PaymentMethodDataTypes>(
router_data_v2: RouterDataV2<
PaymentMethodToken,
PaymentFlowData,
PaymentMethodTokenizationData<T>,
PaymentMethodTokenResponse,
>,
) -> Result<String, error_stack::Report<ApplicationErrorResponse>> {
let payment_method_token_response = router_data_v2.response;
match payment_method_token_response {
Ok(response) => Ok(response.token),
Err(e) => Err(report!(ApplicationErrorResponse::InternalServerError(
ApiError {
sub_code: "PAYMENT_METHOD_TOKEN_ERROR".to_string(),
error_identifier: 500,
error_message: format!("Payment method token creation failed: {}", e.message),
error_object: None,
}
))),
}
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "generate_payment_method_token_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_domain_types_2484801577035817352 | clm | function | // connector-service/backend/domain_types/src/types.rs
pub fn generate_repeat_payment_response(
router_data_v2: RouterDataV2<
RepeatPayment,
PaymentFlowData,
RepeatPaymentData,
PaymentsResponseData,
>,
) -> Result<
grpc_api_types::payments::PaymentServiceRepeatEverythingResponse,
error_stack::Report<ApplicationErrorResponse>,
> {
let transaction_response = router_data_v2.response;
let status = router_data_v2.resource_common_data.status;
let grpc_status = grpc_api_types::payments::PaymentStatus::foreign_from(status);
// Create state if either access token or connector customer is available
let state = if router_data_v2.resource_common_data.access_token.is_some()
|| router_data_v2
.resource_common_data
.connector_customer
.is_some()
{
Some(ConnectorState {
access_token: router_data_v2
.resource_common_data
.access_token
.as_ref()
.map(|token_data| grpc_api_types::payments::AccessToken {
token: token_data.access_token.clone(),
expires_in_seconds: token_data.expires_in,
token_type: token_data.token_type.clone(),
}),
connector_customer_id: router_data_v2
.resource_common_data
.connector_customer
.clone(),
})
} else {
None
};
let raw_connector_response = router_data_v2
.resource_common_data
.get_raw_connector_response();
let raw_connector_request = router_data_v2
.resource_common_data
.get_raw_connector_request();
match transaction_response {
Ok(response) => match response {
PaymentsResponseData::TransactionResponse {
resource_id,
network_txn_id,
connector_response_reference_id,
connector_metadata,
mandate_reference,
status_code,
..
} => Ok(
grpc_api_types::payments::PaymentServiceRepeatEverythingResponse {
transaction_id: Some(grpc_api_types::payments::Identifier::foreign_try_from(
resource_id,
)?),
status: grpc_status as i32,
error_code: None,
error_message: None,
network_txn_id,
response_ref_id: connector_response_reference_id.map(|id| {
grpc_api_types::payments::Identifier {
id_type: Some(grpc_api_types::payments::identifier::IdType::Id(id)),
}
}),
connector_metadata: connector_metadata
.and_then(|value| value.as_object().cloned())
.map(|map| {
map.into_iter()
.filter_map(|(k, v)| v.as_str().map(|s| (k, s.to_string())))
.collect::<HashMap<_, _>>()
})
.unwrap_or_default(),
mandate_reference: mandate_reference.map(|m| {
grpc_api_types::payments::MandateReference {
mandate_id: m.connector_mandate_id,
payment_method_id: m.payment_method_id,
}
}),
status_code: status_code as u32,
raw_connector_response,
response_headers: router_data_v2
.resource_common_data
.get_connector_response_headers_as_map(),
state,
raw_connector_request,
connector_response: router_data_v2
.resource_common_data
.connector_response
.and_then(|data| {
grpc_api_types::payments::ConnectorResponseData::foreign_try_from(data)
.ok()
}),
captured_amount: router_data_v2.resource_common_data.amount_captured,
minor_captured_amount: router_data_v2
.resource_common_data
.minor_amount_captured
.map(|amount_captured| amount_captured.get_amount_as_i64()),
},
),
_ => Err(ApplicationErrorResponse::BadRequest(ApiError {
sub_code: "INVALID_RESPONSE".to_owned(),
error_identifier: 400,
error_message: "Invalid response from connector".to_owned(),
error_object: None,
}))?,
},
Err(err) => {
let status = err
.attempt_status
.map(grpc_api_types::payments::PaymentStatus::foreign_from)
.unwrap_or_default();
Ok(
grpc_api_types::payments::PaymentServiceRepeatEverythingResponse {
transaction_id: Some(grpc_api_types::payments::Identifier {
id_type: Some(
grpc_api_types::payments::identifier::IdType::NoResponseIdMarker(()),
),
}),
status: status as i32,
error_code: Some(err.code),
error_message: Some(err.message),
network_txn_id: None,
response_ref_id: err.connector_transaction_id.map(|id| {
grpc_api_types::payments::Identifier {
id_type: Some(grpc_api_types::payments::identifier::IdType::Id(id)),
}
}),
connector_metadata: HashMap::new(),
raw_connector_response: None,
status_code: err.status_code as u32,
response_headers: router_data_v2
.resource_common_data
.get_connector_response_headers_as_map(),
state,
mandate_reference: None,
raw_connector_request,
connector_response: None,
captured_amount: None,
minor_captured_amount: None,
},
)
}
}
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "generate_repeat_payment_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_domain_types_-3235651235271002766 | clm | function | // connector-service/backend/domain_types/src/payment_address.rs
pub fn new(
shipping: Option<Address>,
billing: Option<Address>,
payment_method_billing: Option<Address>,
should_unify_address: Option<bool>,
) -> Self {
// billing -> .billing, this is the billing details passed in the root of payments request
// payment_method_billing -> .payment_method_data.billing
let unified_payment_method_billing = if should_unify_address.unwrap_or(true) {
// Merge the billing details field from both `payment.billing` and `payment.payment_method_data.billing`
// The unified payment_method_billing will be used as billing address and passed to the connector module
// This unification is required in order to provide backwards compatibility
// so that if `payment.billing` is passed it should be sent to the connector module
// Unify the billing details with `payment_method_data.billing`
payment_method_billing
.as_ref()
.map(|payment_method_billing| {
payment_method_billing
.clone()
.unify_address(billing.as_ref())
})
.or(billing.clone())
} else {
payment_method_billing.clone()
};
Self {
shipping,
billing,
unified_payment_method_billing,
payment_method_billing,
}
}
| {
"chunk": null,
"crate": "domain_types",
"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_domain_types_4549804406867883116 | clm | function | // connector-service/backend/domain_types/src/payment_address.rs
pub fn get_shipping(&self) -> Option<&Address> {
self.shipping.as_ref()
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_shipping",
"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_domain_types_8729759986521979108 | clm | function | // connector-service/backend/domain_types/src/payment_address.rs
pub fn get_payment_method_billing(&self) -> Option<&Address> {
self.unified_payment_method_billing.as_ref()
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_payment_method_billing",
"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_domain_types_2955161330460120233 | clm | function | // connector-service/backend/domain_types/src/payment_address.rs
pub fn unify_with_payment_method_data_billing(
self,
payment_method_data_billing: Option<Address>,
) -> Self {
// Unify the billing details with `payment_method_data.billing_details`
let unified_payment_method_billing = payment_method_data_billing
.map(|payment_method_data_billing| {
payment_method_data_billing.unify_address(self.get_payment_method_billing())
})
.or(self.get_payment_method_billing().cloned());
Self {
shipping: self.shipping,
billing: self.billing,
unified_payment_method_billing,
payment_method_billing: self.payment_method_billing,
}
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "unify_with_payment_method_data_billing",
"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_domain_types_4790789609103632715 | clm | function | // connector-service/backend/domain_types/src/payment_address.rs
pub fn get_request_payment_method_billing(&self) -> Option<&Address> {
self.payment_method_billing.as_ref()
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_request_payment_method_billing",
"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_domain_types_-6435192767146978892 | clm | function | // connector-service/backend/domain_types/src/payment_address.rs
pub fn get_payment_billing(&self) -> Option<&Address> {
self.billing.as_ref()
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_payment_billing",
"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_domain_types_-3323115700721975692 | clm | function | // connector-service/backend/domain_types/src/payment_address.rs
pub fn unify_address(self, other: Option<&Self>) -> Self {
let other_address_details = other.and_then(|address| address.address.as_ref());
Self {
address: self
.address
.map(|address| address.unify_address_details(other_address_details))
.or(other_address_details.cloned()),
email: self.email.or(other.and_then(|other| other.email.clone())),
phone: self.phone.or(other.and_then(|other| other.phone.clone())),
}
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "unify_address",
"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_domain_types_7340563582193184686 | clm | function | // connector-service/backend/domain_types/src/payment_address.rs
pub fn get_email(&self) -> Result<Email, Error> {
self.email.clone().ok_or_else(missing_field_err("email"))
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_email",
"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_domain_types_-6475035949860880325 | clm | function | // connector-service/backend/domain_types/src/payment_address.rs
pub fn get_phone_with_country_code(
&self,
) -> Result<Secret<String>, error_stack::Report<crate::errors::ConnectorError>> {
self.phone
.clone()
.map(|phone_details| phone_details.get_number_with_country_code())
.transpose()?
.ok_or_else(missing_field_err("phone"))
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_phone_with_country_code",
"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_domain_types_-6118481421014423971 | clm | function | // connector-service/backend/domain_types/src/payment_address.rs
pub fn get_optional_country(&self) -> Option<common_enums::CountryAlpha2> {
self.country
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_optional_country",
"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_domain_types_-7792149512651628040 | clm | function | // connector-service/backend/domain_types/src/payment_address.rs
pub fn get_optional_full_name(&self) -> Option<Secret<String>> {
match (self.first_name.as_ref(), self.last_name.as_ref()) {
(Some(first_name), Some(last_name)) => Some(Secret::new(format!(
"{} {}",
first_name.peek(),
last_name.peek()
))),
(Some(name), None) | (None, Some(name)) => Some(name.to_owned()),
_ => None,
}
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_optional_full_name",
"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_domain_types_2120199168005856053 | clm | function | // connector-service/backend/domain_types/src/payment_address.rs
pub fn get_optional_first_name(&self) -> Option<Secret<String>> {
self.first_name.clone()
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_optional_first_name",
"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_domain_types_7084570311698814317 | clm | function | // connector-service/backend/domain_types/src/payment_address.rs
pub fn get_optional_last_name(&self) -> Option<Secret<String>> {
self.last_name.clone()
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_optional_last_name",
"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_domain_types_-5766534633677495448 | clm | function | // connector-service/backend/domain_types/src/payment_address.rs
pub fn unify_address_details(self, other: Option<&Self>) -> Self {
if let Some(other) = other {
let (first_name, last_name) = if self
.first_name
.as_ref()
.is_some_and(|first_name| !first_name.is_empty_after_trim())
{
(self.first_name, self.last_name)
} else {
(other.first_name.clone(), other.last_name.clone())
};
Self {
first_name,
last_name,
city: self.city.or(other.city.clone()),
country: self.country.or(other.country),
line1: self.line1.or(other.line1.clone()),
line2: self.line2.or(other.line2.clone()),
line3: self.line3.or(other.line3.clone()),
zip: self.zip.or(other.zip.clone()),
state: self.state.or(other.state.clone()),
}
} else {
self
}
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "unify_address_details",
"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_domain_types_3436067376799441037 | clm | function | // connector-service/backend/domain_types/src/payment_address.rs
pub fn get_first_name(&self) -> Result<&Secret<String>, Error> {
self.first_name
.as_ref()
.ok_or_else(missing_field_err("address.first_name"))
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_first_name",
"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_domain_types_-6935447366986556910 | clm | function | // connector-service/backend/domain_types/src/payment_address.rs
pub fn get_last_name(&self) -> Result<&Secret<String>, Error> {
self.last_name
.as_ref()
.ok_or_else(missing_field_err("address.last_name"))
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_last_name",
"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_domain_types_4183921000471658802 | clm | function | // connector-service/backend/domain_types/src/payment_address.rs
pub fn get_full_name(&self) -> Result<Secret<String>, Error> {
let first_name = self.get_first_name()?.peek().to_owned();
let last_name = self
.get_last_name()
.ok()
.cloned()
.unwrap_or(Secret::new("".to_string()));
let last_name = last_name.peek();
let full_name = format!("{first_name} {last_name}").trim().to_string();
Ok(Secret::new(full_name))
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_full_name",
"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_domain_types_-3786522604797827136 | clm | function | // connector-service/backend/domain_types/src/payment_address.rs
pub fn get_line1(&self) -> Result<&Secret<String>, Error> {
self.line1
.as_ref()
.ok_or_else(missing_field_err("address.line1"))
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_line1",
"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_domain_types_7165983519105187303 | clm | function | // connector-service/backend/domain_types/src/payment_address.rs
pub fn get_city(&self) -> Result<&String, Error> {
self.city
.as_ref()
.ok_or_else(missing_field_err("address.city"))
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_city",
"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_domain_types_-8732517709561973306 | clm | function | // connector-service/backend/domain_types/src/payment_address.rs
pub fn get_state(&self) -> Result<&Secret<String>, Error> {
self.state
.as_ref()
.ok_or_else(missing_field_err("address.state"))
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_state",
"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_domain_types_-6411560175852186816 | clm | function | // connector-service/backend/domain_types/src/payment_address.rs
pub fn get_line2(&self) -> Result<&Secret<String>, Error> {
self.line2
.as_ref()
.ok_or_else(missing_field_err("address.line2"))
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_line2",
"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_domain_types_3039805038005019255 | clm | function | // connector-service/backend/domain_types/src/payment_address.rs
pub fn get_zip(&self) -> Result<&Secret<String>, Error> {
self.zip
.as_ref()
.ok_or_else(missing_field_err("address.zip"))
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_zip",
"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_domain_types_-49677851189454821 | clm | function | // connector-service/backend/domain_types/src/payment_address.rs
pub fn get_country(&self) -> Result<&common_enums::CountryAlpha2, Error> {
self.country
.as_ref()
.ok_or_else(missing_field_err("address.country"))
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_country",
"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_domain_types_-6032862379470059663 | clm | function | // connector-service/backend/domain_types/src/payment_address.rs
pub fn get_combined_address_line(&self) -> Result<Secret<String>, Error> {
Ok(Secret::new(format!(
"{},{}",
self.get_line1()?.peek(),
self.get_line2()?.peek()
)))
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_combined_address_line",
"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_domain_types_-398369088339614409 | clm | function | // connector-service/backend/domain_types/src/payment_address.rs
pub fn get_optional_line2(&self) -> Option<Secret<String>> {
self.line2.clone()
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_optional_line2",
"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_domain_types_892611390386466067 | clm | function | // connector-service/backend/domain_types/src/payment_address.rs
pub fn to_state_code(&self) -> Result<Secret<String>, Error> {
let country = self.get_country()?;
let state = self.get_state()?;
match country {
common_enums::CountryAlpha2::US => Ok(Secret::new(
convert_us_state_to_code(&state.peek().to_string()).to_string(),
)),
_ => Ok(state.clone()),
}
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "to_state_code",
"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_domain_types_1880273672394021769 | clm | function | // connector-service/backend/domain_types/src/payment_address.rs
pub fn to_state_code_as_optional(&self) -> Result<Option<Secret<String>>, Error> {
self.state
.as_ref()
.map(|state| {
if state.peek().len() == 2 {
Ok(state.to_owned())
} else {
self.to_state_code()
}
})
.transpose()
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "to_state_code_as_optional",
"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_domain_types_-4496827198293862672 | clm | function | // connector-service/backend/domain_types/src/payment_address.rs
pub fn get_country_code(&self) -> Result<String, Error> {
self.country_code
.clone()
.ok_or_else(missing_field_err("billing.phone.country_code"))
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_country_code",
"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_domain_types_-2838860010243520851 | clm | function | // connector-service/backend/domain_types/src/payment_address.rs
pub fn extract_country_code(&self) -> Result<String, Error> {
self.get_country_code()
.map(|cc| cc.trim_start_matches('+').to_string())
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "extract_country_code",
"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_domain_types_6140352177073431464 | clm | function | // connector-service/backend/domain_types/src/payment_address.rs
pub fn get_number(&self) -> Result<Secret<String>, Error> {
self.number
.clone()
.ok_or_else(missing_field_err("billing.phone.number"))
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_number",
"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_domain_types_-6937353415402565242 | clm | function | // connector-service/backend/domain_types/src/payment_address.rs
pub fn get_number_with_country_code(&self) -> Result<Secret<String>, Error> {
let number = self.get_number()?;
let country_code = self.get_country_code()?;
Ok(Secret::new(format!("{}{}", country_code, number.peek())))
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_number_with_country_code",
"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_domain_types_-4810755106811170471 | clm | function | // connector-service/backend/domain_types/src/payment_address.rs
pub fn get_number_with_hash_country_code(&self) -> Result<Secret<String>, Error> {
let number = self.get_number()?;
let country_code = self.get_country_code()?;
let number_without_plus = country_code.trim_start_matches('+');
Ok(Secret::new(format!(
"{}#{}",
number_without_plus,
number.peek()
)))
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_number_with_hash_country_code",
"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_domain_types_776626725897399639 | clm | function | // connector-service/backend/domain_types/src/connector_types.rs
fn foreign_try_from(
value: grpc_api_types::payments::WebhookSecrets,
) -> Result<Self, error_stack::Report<Self::Error>> {
Ok(Self {
secret: value.secret.into(),
additional_secret: value.additional_secret.map(Secret::new),
})
}
| {
"chunk": null,
"crate": "domain_types",
"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_domain_types_4139114646262505786 | clm | function | // connector-service/backend/domain_types/src/connector_types.rs
pub fn new(mandate_id: String) -> Self {
Self {
mandate_id: Some(mandate_id),
mandate_reference_id: None,
}
}
| {
"chunk": null,
"crate": "domain_types",
"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_domain_types_8207677139003584981 | clm | function | // connector-service/backend/domain_types/src/connector_types.rs
pub fn get_connector_mandate_id(&self) -> Result<String, Error> {
self.connector_mandate_id()
.ok_or_else(missing_field_err("connector_mandate_id"))
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_connector_mandate_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_domain_types_452713037617513875 | clm | function | // connector-service/backend/domain_types/src/connector_types.rs
pub fn get_payment_method_id(&self) -> Option<&String> {
self.payment_method_id.as_ref()
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_payment_method_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_domain_types_-4584818308156221744 | clm | function | // connector-service/backend/domain_types/src/connector_types.rs
pub fn get_update_history(&self) -> Option<&Vec<UpdateHistory>> {
self.update_history.as_ref()
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_update_history",
"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_domain_types_-1109685657662727015 | clm | function | // connector-service/backend/domain_types/src/connector_types.rs
pub fn get_mandate_metadata(&self) -> Option<SecretSerdeValue> {
self.mandate_metadata.clone()
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_mandate_metadata",
"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_domain_types_70657510891108322 | clm | function | // connector-service/backend/domain_types/src/connector_types.rs
fn get_connector_response_headers_as_map(&self) -> std::collections::HashMap<String, String> {
self.get_connector_response_headers()
.map(|headers| {
headers
.iter()
.filter_map(|(name, value)| {
value
.to_str()
.ok()
.map(|v| (name.to_string(), v.to_string()))
})
.collect()
})
.unwrap_or_default()
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_connector_response_headers_as_map",
"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_domain_types_-7379997537691508000 | clm | function | // connector-service/backend/domain_types/src/connector_types.rs
pub fn is_network_transaction_id_flow(&self) -> bool {
matches!(
self.mandate_reference_id,
Some(MandateReferenceId::NetworkMandateId(_))
)
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "is_network_transaction_id_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_domain_types_89666938454832942 | clm | function | // connector-service/backend/domain_types/src/connector_types.rs
pub fn is_auto_capture(&self) -> Result<bool, Error> {
match self.capture_method {
Some(common_enums::CaptureMethod::Automatic)
| None
| Some(common_enums::CaptureMethod::SequentialAutomatic) => Ok(true),
Some(common_enums::CaptureMethod::Manual) => Ok(false),
Some(_) => Err(ConnectorError::CaptureMethodNotSupported.into()),
}
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "is_auto_capture",
"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_domain_types_-4799798181554254157 | clm | function | // connector-service/backend/domain_types/src/connector_types.rs
pub fn get_connector_transaction_id(&self) -> CustomResult<String, ConnectorError> {
match self.connector_transaction_id.clone() {
ResponseId::ConnectorTransactionId(txn_id) => Ok(txn_id),
_ => Err(errors::ValidationError::IncorrectValueProvided {
field_name: "connector_transaction_id",
})
.attach_printable("Expected connector transaction ID not found")
.change_context(ConnectorError::MissingConnectorTransactionID)?,
}
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_connector_transaction_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_domain_types_6382480853516434230 | clm | function | // connector-service/backend/domain_types/src/connector_types.rs
pub fn set_status(&mut self, status: AttemptStatus) {
self.status = status;
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "set_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_domain_types_-966994562169315467 | clm | function | // connector-service/backend/domain_types/src/connector_types.rs
pub fn get_billing(&self) -> Result<&Address, Error> {
self.address
.get_payment_method_billing()
.ok_or_else(missing_field_err("billing"))
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_billing",
"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_domain_types_3401401561671002032 | clm | function | // connector-service/backend/domain_types/src/connector_types.rs
pub fn get_billing_country(&self) -> Result<common_enums::CountryAlpha2, Error> {
self.address
.get_payment_method_billing()
.and_then(|a| a.address.as_ref())
.and_then(|ad| ad.country)
.ok_or_else(missing_field_err(
"payment_method_data.billing.address.country",
))
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_billing_country",
"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_domain_types_-3293798215897544194 | clm | function | // connector-service/backend/domain_types/src/connector_types.rs
pub fn get_billing_phone(&self) -> Result<&PhoneDetails, Error> {
self.address
.get_payment_method_billing()
.and_then(|a| a.phone.as_ref())
.ok_or_else(missing_field_err("billing.phone"))
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_billing_phone",
"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_domain_types_-7236009309370425397 | clm | function | // connector-service/backend/domain_types/src/connector_types.rs
pub fn get_optional_billing(&self) -> Option<&Address> {
self.address.get_payment_method_billing()
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_optional_billing",
"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_domain_types_3986025839829246328 | clm | function | // connector-service/backend/domain_types/src/connector_types.rs
pub fn get_optional_shipping(&self) -> Option<&Address> {
self.address.get_shipping()
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_optional_shipping",
"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_domain_types_-2014831765456345070 | clm | function | // connector-service/backend/domain_types/src/connector_types.rs
pub fn get_optional_shipping_first_name(&self) -> Option<Secret<String>> {
self.address.get_shipping().and_then(|shipping_address| {
shipping_address
.clone()
.address
.and_then(|shipping_details| shipping_details.first_name)
})
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_optional_shipping_first_name",
"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_domain_types_3534152685534776541 | clm | function | // connector-service/backend/domain_types/src/connector_types.rs
pub fn get_optional_shipping_last_name(&self) -> Option<Secret<String>> {
self.address.get_shipping().and_then(|shipping_address| {
shipping_address
.clone()
.address
.and_then(|shipping_details| shipping_details.last_name)
})
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_optional_shipping_last_name",
"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_domain_types_-1905117755916986601 | clm | function | // connector-service/backend/domain_types/src/connector_types.rs
pub fn get_optional_shipping_line1(&self) -> Option<Secret<String>> {
self.address.get_shipping().and_then(|shipping_address| {
shipping_address
.clone()
.address
.and_then(|shipping_details| shipping_details.line1)
})
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_optional_shipping_line1",
"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_domain_types_7773814086468011015 | clm | function | // connector-service/backend/domain_types/src/connector_types.rs
pub fn get_optional_shipping_line2(&self) -> Option<Secret<String>> {
self.address.get_shipping().and_then(|shipping_address| {
shipping_address
.clone()
.address
.and_then(|shipping_details| shipping_details.line2)
})
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_optional_shipping_line2",
"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_domain_types_-5603064479063025934 | clm | function | // connector-service/backend/domain_types/src/connector_types.rs
pub fn get_optional_shipping_city(&self) -> Option<String> {
self.address.get_shipping().and_then(|shipping_address| {
shipping_address
.clone()
.address
.and_then(|shipping_details| shipping_details.city)
})
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_optional_shipping_city",
"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_domain_types_-6436611847654519614 | clm | function | // connector-service/backend/domain_types/src/connector_types.rs
pub fn get_optional_shipping_state(&self) -> Option<Secret<String>> {
self.address.get_shipping().and_then(|shipping_address| {
shipping_address
.clone()
.address
.and_then(|shipping_details| shipping_details.state)
})
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_optional_shipping_state",
"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_domain_types_-4002048920916596523 | clm | function | // connector-service/backend/domain_types/src/connector_types.rs
pub fn get_optional_shipping_full_name(&self) -> Option<Secret<String>> {
self.get_optional_shipping()
.and_then(|shipping_details| shipping_details.address.as_ref())
.and_then(|shipping_address| shipping_address.get_optional_full_name())
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_optional_shipping_full_name",
"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_domain_types_-8385105568946553673 | clm | function | // connector-service/backend/domain_types/src/connector_types.rs
pub fn get_optional_shipping_country(&self) -> Option<common_enums::CountryAlpha2> {
self.address.get_shipping().and_then(|shipping_address| {
shipping_address
.clone()
.address
.and_then(|shipping_details| shipping_details.country)
})
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_optional_shipping_country",
"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_domain_types_4355828662775791664 | clm | function | // connector-service/backend/domain_types/src/connector_types.rs
pub fn get_optional_shipping_zip(&self) -> Option<Secret<String>> {
self.address.get_shipping().and_then(|shipping_address| {
shipping_address
.clone()
.address
.and_then(|shipping_details| shipping_details.zip)
})
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_optional_shipping_zip",
"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_domain_types_-4234576473929396340 | clm | function | // connector-service/backend/domain_types/src/connector_types.rs
pub fn get_optional_shipping_email(&self) -> Option<Email> {
self.address
.get_shipping()
.and_then(|shipping_address| shipping_address.clone().email)
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_optional_shipping_email",
"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_domain_types_-4263862963006985999 | clm | function | // connector-service/backend/domain_types/src/connector_types.rs
pub fn get_optional_shipping_phone_number(&self) -> Option<Secret<String>> {
self.address
.get_shipping()
.and_then(|shipping_address| shipping_address.clone().phone)
.and_then(|phone_details| phone_details.get_number_with_country_code().ok())
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_optional_shipping_phone_number",
"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_domain_types_-4552560703704187127 | clm | function | // connector-service/backend/domain_types/src/connector_types.rs
pub fn get_description(&self) -> Result<String, Error> {
self.description
.clone()
.ok_or_else(missing_field_err("description"))
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_description",
"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_domain_types_5206768300726470997 | clm | function | // connector-service/backend/domain_types/src/connector_types.rs
pub fn get_billing_address(&self) -> Result<&AddressDetails, Error> {
self.address
.get_payment_method_billing()
.as_ref()
.and_then(|a| a.address.as_ref())
.ok_or_else(missing_field_err("billing.address"))
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_billing_address",
"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_domain_types_6703124560039674307 | clm | function | // connector-service/backend/domain_types/src/connector_types.rs
pub fn get_connector_meta(&self) -> Result<SecretSerdeValue, Error> {
self.connector_meta_data
.clone()
.ok_or_else(missing_field_err("connector_meta_data"))
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_connector_meta",
"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_domain_types_5471400039066862771 | clm | function | // connector-service/backend/domain_types/src/connector_types.rs
pub fn get_session_token(&self) -> Result<String, Error> {
self.session_token
.clone()
.ok_or_else(missing_field_err("session_token"))
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_session_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_domain_types_-6186462142279055496 | clm | function | // connector-service/backend/domain_types/src/connector_types.rs
pub fn get_access_token(&self) -> Result<String, Error> {
self.access_token
.as_ref()
.map(|token_data| token_data.access_token.clone())
.ok_or_else(missing_field_err("access_token"))
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_access_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_domain_types_5900299536488433743 | clm | function | // connector-service/backend/domain_types/src/connector_types.rs
pub fn get_access_token_data(&self) -> Result<AccessTokenResponseData, Error> {
self.access_token
.clone()
.ok_or_else(missing_field_err("access_token"))
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_access_token_data",
"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_domain_types_6229761077622113931 | clm | function | // connector-service/backend/domain_types/src/connector_types.rs
pub fn set_access_token(mut self, access_token: Option<String>) -> Self {
self.access_token = access_token.map(|token| AccessTokenResponseData {
access_token: token,
token_type: None,
expires_in: None,
});
self
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "set_access_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_domain_types_7801418542237957251 | clm | function | // connector-service/backend/domain_types/src/connector_types.rs
pub fn get_billing_first_name(&self) -> Result<Secret<String>, Error> {
self.address
.get_payment_method_billing()
.and_then(|billing_address| {
billing_address
.clone()
.address
.and_then(|billing_details| billing_details.first_name.clone())
})
.ok_or_else(missing_field_err(
"payment_method_data.billing.address.first_name",
))
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_billing_first_name",
"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_domain_types_5913353481883121668 | clm | function | // connector-service/backend/domain_types/src/connector_types.rs
pub fn get_billing_full_name(&self) -> Result<Secret<String>, Error> {
self.get_optional_billing()
.and_then(|billing_details| billing_details.address.as_ref())
.and_then(|billing_address| billing_address.get_optional_full_name())
.ok_or_else(missing_field_err(
"payment_method_data.billing.address.first_name",
))
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_billing_full_name",
"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_domain_types_-2375263040673845793 | clm | function | // connector-service/backend/domain_types/src/connector_types.rs
pub fn get_billing_last_name(&self) -> Result<Secret<String>, Error> {
self.address
.get_payment_method_billing()
.and_then(|billing_address| {
billing_address
.clone()
.address
.and_then(|billing_details| billing_details.last_name.clone())
})
.ok_or_else(missing_field_err(
"payment_method_data.billing.address.last_name",
))
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_billing_last_name",
"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_domain_types_1087480952548095832 | clm | function | // connector-service/backend/domain_types/src/connector_types.rs
pub fn get_billing_line1(&self) -> Result<Secret<String>, Error> {
self.address
.get_payment_method_billing()
.and_then(|billing_address| {
billing_address
.clone()
.address
.and_then(|billing_details| billing_details.line1.clone())
})
.ok_or_else(missing_field_err(
"payment_method_data.billing.address.line1",
))
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_billing_line1",
"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_domain_types_-7255204118002518910 | clm | function | // connector-service/backend/domain_types/src/connector_types.rs
pub fn get_billing_city(&self) -> Result<String, Error> {
self.address
.get_payment_method_billing()
.and_then(|billing_address| {
billing_address
.clone()
.address
.and_then(|billing_details| billing_details.city)
})
.ok_or_else(missing_field_err(
"payment_method_data.billing.address.city",
))
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_billing_city",
"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_domain_types_6518054762634149119 | clm | function | // connector-service/backend/domain_types/src/connector_types.rs
pub fn get_billing_email(&self) -> Result<Email, Error> {
self.address
.get_payment_method_billing()
.and_then(|billing_address| billing_address.email.clone())
.ok_or_else(missing_field_err("payment_method_data.billing.email"))
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_billing_email",
"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_domain_types_2771912941421390423 | clm | function | // connector-service/backend/domain_types/src/connector_types.rs
pub fn get_billing_phone_number(&self) -> Result<Secret<String>, Error> {
self.address
.get_payment_method_billing()
.and_then(|billing_address| billing_address.clone().phone)
.map(|phone_details| phone_details.get_number_with_country_code())
.transpose()?
.ok_or_else(missing_field_err("payment_method_data.billing.phone"))
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_billing_phone_number",
"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_domain_types_2275198248095075252 | clm | function | // connector-service/backend/domain_types/src/connector_types.rs
pub fn get_optional_billing_line1(&self) -> Option<Secret<String>> {
self.address
.get_payment_method_billing()
.and_then(|billing_address| {
billing_address
.clone()
.address
.and_then(|billing_details| billing_details.line1)
})
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_optional_billing_line1",
"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_domain_types_2516068012485683742 | clm | function | // connector-service/backend/domain_types/src/connector_types.rs
pub fn get_optional_billing_line2(&self) -> Option<Secret<String>> {
self.address
.get_payment_method_billing()
.and_then(|billing_address| {
billing_address
.clone()
.address
.and_then(|billing_details| billing_details.line2)
})
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_optional_billing_line2",
"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_domain_types_4926693305364150762 | clm | function | // connector-service/backend/domain_types/src/connector_types.rs
pub fn get_optional_billing_city(&self) -> Option<String> {
self.address
.get_payment_method_billing()
.and_then(|billing_address| {
billing_address
.clone()
.address
.and_then(|billing_details| billing_details.city)
})
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_optional_billing_city",
"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_domain_types_7079135549445615868 | clm | function | // connector-service/backend/domain_types/src/connector_types.rs
pub fn get_optional_billing_country(&self) -> Option<common_enums::CountryAlpha2> {
self.address
.get_payment_method_billing()
.and_then(|billing_address| {
billing_address
.clone()
.address
.and_then(|billing_details| billing_details.country)
})
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_optional_billing_country",
"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_domain_types_6567533402359864207 | clm | function | // connector-service/backend/domain_types/src/connector_types.rs
pub fn get_optional_billing_zip(&self) -> Option<Secret<String>> {
self.address
.get_payment_method_billing()
.and_then(|billing_address| {
billing_address
.clone()
.address
.and_then(|billing_details| billing_details.zip)
})
}
| {
"chunk": null,
"crate": "domain_types",
"enum_name": null,
"file_size": null,
"for_type": null,
"function_name": "get_optional_billing_zip",
"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.