id stringlengths 20 153 | type stringclasses 1
value | granularity stringclasses 14
values | content stringlengths 16 84.3k | metadata dict |
|---|---|---|---|---|
hyperswitch_method_diesel_models_AuthenticationUpdateInternal_apply_changeset | clm | method | // hyperswitch/crates/diesel_models/src/authentication.rs
// impl for AuthenticationUpdateInternal
pub fn apply_changeset(self, source: Authentication) -> Authentication {
let Self {
connector_authentication_id,
payment_method_id,
authentication_type,
authentication_status,
authentication_lifecycle_status,
modified_at: _,
error_code,
error_message,
connector_metadata,
maximum_supported_version,
threeds_server_transaction_id,
authentication_flow_type,
message_version,
eci,
trans_status,
acquirer_bin,
acquirer_merchant_id,
three_ds_method_data,
three_ds_method_url,
acs_url,
challenge_request,
acs_reference_number,
acs_trans_id,
acs_signed_content,
ds_trans_id,
directory_server_id,
acquirer_country_code,
service_details,
force_3ds_challenge,
psd2_sca_exemption_type,
billing_address,
shipping_address,
browser_info,
email,
profile_acquirer_id,
challenge_code,
challenge_cancel,
challenge_code_reason,
message_extension,
challenge_request_key,
} = self;
Authentication {
connector_authentication_id: connector_authentication_id
.or(source.connector_authentication_id),
payment_method_id: payment_method_id.unwrap_or(source.payment_method_id),
authentication_type: authentication_type.or(source.authentication_type),
authentication_status: authentication_status.unwrap_or(source.authentication_status),
authentication_lifecycle_status: authentication_lifecycle_status
.unwrap_or(source.authentication_lifecycle_status),
modified_at: common_utils::date_time::now(),
error_code: error_code.or(source.error_code),
error_message: error_message.or(source.error_message),
connector_metadata: connector_metadata.or(source.connector_metadata),
maximum_supported_version: maximum_supported_version
.or(source.maximum_supported_version),
threeds_server_transaction_id: threeds_server_transaction_id
.or(source.threeds_server_transaction_id),
authentication_flow_type: authentication_flow_type.or(source.authentication_flow_type),
message_version: message_version.or(source.message_version),
eci: eci.or(source.eci),
trans_status: trans_status.or(source.trans_status),
acquirer_bin: acquirer_bin.or(source.acquirer_bin),
acquirer_merchant_id: acquirer_merchant_id.or(source.acquirer_merchant_id),
three_ds_method_data: three_ds_method_data.or(source.three_ds_method_data),
three_ds_method_url: three_ds_method_url.or(source.three_ds_method_url),
acs_url: acs_url.or(source.acs_url),
challenge_request: challenge_request.or(source.challenge_request),
acs_reference_number: acs_reference_number.or(source.acs_reference_number),
acs_trans_id: acs_trans_id.or(source.acs_trans_id),
acs_signed_content: acs_signed_content.or(source.acs_signed_content),
ds_trans_id: ds_trans_id.or(source.ds_trans_id),
directory_server_id: directory_server_id.or(source.directory_server_id),
acquirer_country_code: acquirer_country_code.or(source.acquirer_country_code),
service_details: service_details.or(source.service_details),
force_3ds_challenge: force_3ds_challenge.or(source.force_3ds_challenge),
psd2_sca_exemption_type: psd2_sca_exemption_type.or(source.psd2_sca_exemption_type),
billing_address: billing_address.or(source.billing_address),
shipping_address: shipping_address.or(source.shipping_address),
browser_info: browser_info.or(source.browser_info),
email: email.or(source.email),
profile_acquirer_id: profile_acquirer_id.or(source.profile_acquirer_id),
challenge_code: challenge_code.or(source.challenge_code),
challenge_cancel: challenge_cancel.or(source.challenge_cancel),
challenge_code_reason: challenge_code_reason.or(source.challenge_code_reason),
message_extension: message_extension.or(source.message_extension),
challenge_request_key: challenge_request_key.or(source.challenge_request_key),
..source
}
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "AuthenticationUpdateInternal",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "apply_changeset",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_ClientSecretType_generate_secret_key | clm | method | // hyperswitch/crates/diesel_models/src/ephemeral_key.rs
// impl for ClientSecretType
pub fn generate_secret_key(&self) -> String {
format!("cs_{}", self.secret.peek())
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "ClientSecretType",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "generate_secret_key",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_Mandate_get_user_agent_extended | clm | method | // hyperswitch/crates/diesel_models/src/mandate.rs
// impl for Mandate
pub fn get_user_agent_extended(&self) -> Option<String> {
self.customer_user_agent_extended
.clone()
.or_else(|| self.customer_user_agent.clone())
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "Mandate",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "get_user_agent_extended",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_MandateNew_update_storage_scheme | clm | method | // hyperswitch/crates/diesel_models/src/mandate.rs
// impl for MandateNew
pub fn update_storage_scheme(&mut self, storage_scheme: MerchantStorageScheme) {
self.updated_by = Some(storage_scheme.to_string());
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "MandateNew",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "update_storage_scheme",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_MandateNew_get_customer_user_agent_extended | clm | method | // hyperswitch/crates/diesel_models/src/mandate.rs
// impl for MandateNew
pub fn get_customer_user_agent_extended(&self) -> Option<String> {
self.customer_user_agent_extended
.clone()
.or_else(|| self.customer_user_agent.clone())
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "MandateNew",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "get_customer_user_agent_extended",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_MandateUpdate_convert_to_mandate_update | clm | method | // hyperswitch/crates/diesel_models/src/mandate.rs
// impl for MandateUpdate
pub fn convert_to_mandate_update(
self,
storage_scheme: MerchantStorageScheme,
) -> MandateUpdateInternal {
let mut updated_object = MandateUpdateInternal::from(self);
updated_object.updated_by = Some(storage_scheme.to_string());
updated_object
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "MandateUpdate",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "convert_to_mandate_update",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_MandateUpdateInternal_apply_changeset | clm | method | // hyperswitch/crates/diesel_models/src/mandate.rs
// impl for MandateUpdateInternal
pub fn apply_changeset(self, source: Mandate) -> Mandate {
let Self {
mandate_status,
amount_captured,
connector_mandate_ids,
connector_mandate_id,
payment_method_id,
original_payment_id,
updated_by,
} = self;
Mandate {
mandate_status: mandate_status.unwrap_or(source.mandate_status),
amount_captured: amount_captured.map_or(source.amount_captured, Some),
connector_mandate_ids: connector_mandate_ids.map_or(source.connector_mandate_ids, Some),
connector_mandate_id: connector_mandate_id.map_or(source.connector_mandate_id, Some),
payment_method_id: payment_method_id.unwrap_or(source.payment_method_id),
original_payment_id: original_payment_id.map_or(source.original_payment_id, Some),
updated_by: updated_by.map_or(source.updated_by, Some),
..source
}
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "MandateUpdateInternal",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "apply_changeset",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_TaxDetails_get_tax_amount | clm | method | // hyperswitch/crates/diesel_models/src/payment_intent.rs
// impl for TaxDetails
pub fn get_tax_amount(&self, payment_method: Option<PaymentMethodType>) -> Option<MinorUnit> {
self.payment_method_type
.as_ref()
.zip(payment_method)
.filter(|(payment_method_type_tax, payment_method)| {
payment_method_type_tax.pmt == *payment_method
})
.map(|(payment_method_type_tax, _)| payment_method_type_tax.order_tax_amount)
.or_else(|| self.get_default_tax_amount())
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "TaxDetails",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "get_tax_amount",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_TaxDetails_get_default_tax_amount | clm | method | // hyperswitch/crates/diesel_models/src/payment_intent.rs
// impl for TaxDetails
pub fn get_default_tax_amount(&self) -> Option<MinorUnit> {
self.default
.as_ref()
.map(|default_tax_details| default_tax_details.order_tax_amount)
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "TaxDetails",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "get_default_tax_amount",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_PaymentIntentUpdate_apply_changeset | clm | method | // hyperswitch/crates/diesel_models/src/payment_intent.rs
// impl for PaymentIntentUpdate
pub fn apply_changeset(self, source: PaymentIntent) -> PaymentIntent {
let PaymentIntentUpdateInternal {
amount,
currency,
status,
amount_captured,
customer_id,
return_url,
setup_future_usage,
off_session,
metadata,
billing_address_id,
shipping_address_id,
modified_at: _,
active_attempt_id,
business_country,
business_label,
description,
statement_descriptor_name,
statement_descriptor_suffix,
order_details,
attempt_count,
merchant_decision,
payment_confirm_source,
updated_by,
surcharge_applicable,
incremental_authorization_allowed,
authorization_count,
session_expiry,
fingerprint_id,
request_external_three_ds_authentication,
frm_metadata,
customer_details,
billing_details,
merchant_order_reference_id,
shipping_details,
is_payment_processor_token_flow,
tax_details,
force_3ds_challenge,
is_iframe_redirection_enabled,
extended_return_url,
payment_channel,
feature_metadata,
tax_status,
discount_amount,
order_date,
shipping_amount_tax,
duty_amount,
enable_partial_authorization,
enable_overcapture,
} = self.into();
PaymentIntent {
amount: amount.unwrap_or(source.amount),
currency: currency.or(source.currency),
status: status.unwrap_or(source.status),
amount_captured: amount_captured.or(source.amount_captured),
customer_id: customer_id.or(source.customer_id),
return_url: return_url.or(source.return_url),
setup_future_usage: setup_future_usage.or(source.setup_future_usage),
off_session: off_session.or(source.off_session),
metadata: metadata.or(source.metadata),
billing_address_id: billing_address_id.or(source.billing_address_id),
shipping_address_id: shipping_address_id.or(source.shipping_address_id),
modified_at: common_utils::date_time::now(),
active_attempt_id: active_attempt_id.unwrap_or(source.active_attempt_id),
business_country: business_country.or(source.business_country),
business_label: business_label.or(source.business_label),
description: description.or(source.description),
statement_descriptor_name: statement_descriptor_name
.or(source.statement_descriptor_name),
statement_descriptor_suffix: statement_descriptor_suffix
.or(source.statement_descriptor_suffix),
order_details: order_details.or(source.order_details),
attempt_count: attempt_count.unwrap_or(source.attempt_count),
merchant_decision: merchant_decision.or(source.merchant_decision),
payment_confirm_source: payment_confirm_source.or(source.payment_confirm_source),
updated_by,
surcharge_applicable: surcharge_applicable.or(source.surcharge_applicable),
incremental_authorization_allowed: incremental_authorization_allowed
.or(source.incremental_authorization_allowed),
authorization_count: authorization_count.or(source.authorization_count),
fingerprint_id: fingerprint_id.or(source.fingerprint_id),
session_expiry: session_expiry.or(source.session_expiry),
request_external_three_ds_authentication: request_external_three_ds_authentication
.or(source.request_external_three_ds_authentication),
frm_metadata: frm_metadata.or(source.frm_metadata),
customer_details: customer_details.or(source.customer_details),
billing_details: billing_details.or(source.billing_details),
merchant_order_reference_id: merchant_order_reference_id
.or(source.merchant_order_reference_id),
shipping_details: shipping_details.or(source.shipping_details),
is_payment_processor_token_flow: is_payment_processor_token_flow
.or(source.is_payment_processor_token_flow),
tax_details: tax_details.or(source.tax_details),
force_3ds_challenge: force_3ds_challenge.or(source.force_3ds_challenge),
is_iframe_redirection_enabled: is_iframe_redirection_enabled
.or(source.is_iframe_redirection_enabled),
extended_return_url: extended_return_url.or(source.extended_return_url),
payment_channel: payment_channel.or(source.payment_channel),
feature_metadata: feature_metadata
.map(|value| value.expose())
.or(source.feature_metadata),
tax_status: tax_status.or(source.tax_status),
discount_amount: discount_amount.or(source.discount_amount),
order_date: order_date.or(source.order_date),
shipping_amount_tax: shipping_amount_tax.or(source.shipping_amount_tax),
duty_amount: duty_amount.or(source.duty_amount),
enable_partial_authorization: enable_partial_authorization
.or(source.enable_partial_authorization),
enable_overcapture: enable_overcapture.or(source.enable_overcapture),
..source
}
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "PaymentIntentUpdate",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "apply_changeset",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_CaptureUpdate_apply_changeset | clm | method | // hyperswitch/crates/diesel_models/src/capture.rs
// impl for CaptureUpdate
pub fn apply_changeset(self, source: Capture) -> Capture {
let CaptureUpdateInternal {
status,
error_message,
error_code,
error_reason,
modified_at: _,
connector_capture_id,
connector_response_reference_id,
processor_capture_data,
} = self.into();
Capture {
status: status.unwrap_or(source.status),
error_message: error_message.or(source.error_message),
error_code: error_code.or(source.error_code),
error_reason: error_reason.or(source.error_reason),
modified_at: common_utils::date_time::now(),
connector_capture_id: connector_capture_id.or(source.connector_capture_id),
connector_response_reference_id: connector_response_reference_id
.or(source.connector_response_reference_id),
processor_capture_data: processor_capture_data.or(source.processor_capture_data),
..source
}
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "CaptureUpdate",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "apply_changeset",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_AuthorizationUpdateInternal_create_authorization | clm | method | // hyperswitch/crates/diesel_models/src/authorization.rs
// impl for AuthorizationUpdateInternal
pub fn create_authorization(self, source: Authorization) -> Authorization {
Authorization {
status: self.status.unwrap_or(source.status),
error_code: self.error_code.or(source.error_code),
error_message: self.error_message.or(source.error_message),
modified_at: self.modified_at.unwrap_or(common_utils::date_time::now()),
connector_authorization_id: self
.connector_authorization_id
.or(source.connector_authorization_id),
..source
}
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "AuthorizationUpdateInternal",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "create_authorization",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_PaymentMethodSession_apply_changeset | clm | method | // hyperswitch/crates/hyperswitch_domain_models/src/payment_methods.rs
// impl for PaymentMethodSession
pub fn apply_changeset(self, update_session: PaymentMethodsSessionUpdateInternal) -> Self {
let Self {
id,
customer_id,
billing,
psp_tokenization,
network_tokenization,
tokenization_data,
expires_at,
return_url,
associated_payment_methods,
associated_payment,
associated_token_id,
} = self;
Self {
id,
customer_id,
billing: update_session.billing.or(billing),
psp_tokenization: update_session.psp_tokenization.or(psp_tokenization),
network_tokenization: update_session.network_tokenization.or(network_tokenization),
tokenization_data: update_session.tokenization_data.or(tokenization_data),
expires_at,
return_url,
associated_payment_methods: update_session
.associated_payment_methods
.or(associated_payment_methods),
associated_payment,
associated_token_id,
}
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "PaymentMethodSession",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "apply_changeset",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_PaymentMethodSession_apply_changeset | clm | method | // hyperswitch/crates/diesel_models/src/payment_methods_session.rs
// impl for PaymentMethodSession
pub fn apply_changeset(self, update_session: PaymentMethodsSessionUpdateInternal) -> Self {
let Self {
id,
customer_id,
billing,
psp_tokenization,
network_tokenization,
tokenization_data,
expires_at,
return_url,
associated_payment_methods,
associated_payment,
associated_token_id,
} = self;
Self {
id,
customer_id,
billing: update_session.billing.or(billing),
psp_tokenization: update_session.psp_tokenization.or(psp_tokenization),
network_tokenization: update_session.network_tokenization.or(network_tokenization),
tokenization_data: update_session.tokenzation_data.or(tokenization_data),
expires_at,
return_url,
associated_payment_methods,
associated_payment,
associated_token_id,
}
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "PaymentMethodSession",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "apply_changeset",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_ThemeNew_new | clm | method | // hyperswitch/crates/diesel_models/src/user/theme.rs
// impl for ThemeNew
pub fn new(
theme_id: String,
theme_name: String,
lineage: ThemeLineage,
email_config: EmailThemeConfig,
) -> Self {
let now = date_time::now();
Self {
theme_id,
theme_name,
tenant_id: lineage.tenant_id().to_owned(),
org_id: lineage.org_id().cloned(),
merchant_id: lineage.merchant_id().cloned(),
profile_id: lineage.profile_id().cloned(),
entity_type: lineage.entity_type(),
created_at: now,
last_modified_at: now,
email_primary_color: email_config.primary_color,
email_foreground_color: email_config.foreground_color,
email_background_color: email_config.background_color,
email_entity_name: email_config.entity_name,
email_entity_logo_url: email_config.entity_logo_url,
}
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "ThemeNew",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "new",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_Theme_email_config | clm | method | // hyperswitch/crates/diesel_models/src/user/theme.rs
// impl for Theme
pub fn email_config(&self) -> EmailThemeConfig {
EmailThemeConfig {
primary_color: self.email_primary_color.clone(),
foreground_color: self.email_foreground_color.clone(),
background_color: self.email_background_color.clone(),
entity_name: self.email_entity_name.clone(),
entity_logo_url: self.email_entity_logo_url.clone(),
}
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "Theme",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "email_config",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_PaymentAttemptBatchNew_convert_into_normal_attempt_insert | clm | method | // hyperswitch/crates/diesel_models/src/user/sample_data.rs
// impl for PaymentAttemptBatchNew
fn convert_into_normal_attempt_insert(self) -> PaymentAttemptNew {
PaymentAttemptNew {
payment_id: self.payment_id,
merchant_id: self.merchant_id,
attempt_id: self.attempt_id,
status: self.status,
amount: self.amount,
currency: self.currency,
save_to_locker: self.save_to_locker,
connector: self.connector,
error_message: self.error_message,
offer_amount: self.offer_amount,
surcharge_amount: self.surcharge_amount,
tax_amount: self.tax_amount,
payment_method_id: self.payment_method_id,
payment_method: self.payment_method,
capture_method: self.capture_method,
capture_on: self.capture_on,
confirm: self.confirm,
authentication_type: self.authentication_type,
created_at: self.created_at,
modified_at: self.modified_at,
last_synced: self.last_synced,
cancellation_reason: self.cancellation_reason,
amount_to_capture: self.amount_to_capture,
mandate_id: self.mandate_id,
browser_info: self.browser_info,
payment_token: self.payment_token,
error_code: self.error_code,
connector_metadata: self.connector_metadata,
payment_experience: self.payment_experience,
payment_method_type: self.payment_method_type,
card_network: self
.payment_method_data
.as_ref()
.and_then(|data| data.as_object())
.and_then(|card| card.get("card"))
.and_then(|v| v.as_object())
.and_then(|v| v.get("card_network"))
.and_then(|network| network.as_str())
.map(|network| network.to_string()),
payment_method_data: self.payment_method_data,
business_sub_label: self.business_sub_label,
straight_through_algorithm: self.straight_through_algorithm,
preprocessing_step_id: self.preprocessing_step_id,
mandate_details: self.mandate_details,
error_reason: self.error_reason,
multiple_capture_count: self.multiple_capture_count,
connector_response_reference_id: self.connector_response_reference_id,
amount_capturable: self.amount_capturable,
updated_by: self.updated_by,
merchant_connector_id: self.merchant_connector_id,
authentication_data: self.authentication_data,
encoded_data: self.encoded_data,
unified_code: self.unified_code,
unified_message: self.unified_message,
net_amount: self.net_amount,
external_three_ds_authentication_attempted: self
.external_three_ds_authentication_attempted,
authentication_connector: self.authentication_connector,
authentication_id: self.authentication_id,
mandate_data: self.mandate_data,
payment_method_billing_address_id: self.payment_method_billing_address_id,
fingerprint_id: self.fingerprint_id,
client_source: self.client_source,
client_version: self.client_version,
customer_acceptance: self.customer_acceptance,
profile_id: self.profile_id,
organization_id: self.organization_id,
shipping_cost: self.shipping_cost,
order_tax_amount: self.order_tax_amount,
connector_mandate_detail: self.connector_mandate_detail,
request_extended_authorization: self.request_extended_authorization,
extended_authorization_applied: self.extended_authorization_applied,
capture_before: self.capture_before,
card_discovery: self.card_discovery,
processor_merchant_id: self.processor_merchant_id,
created_by: self.created_by,
setup_future_usage_applied: self.setup_future_usage_applied,
routing_approach: self.routing_approach,
connector_request_reference_id: self.connector_request_reference_id,
network_transaction_id: self.network_transaction_id,
network_details: self.network_details,
is_stored_credential: self.is_stored_credential,
authorized_amount: self.authorized_amount,
}
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "PaymentAttemptBatchNew",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "convert_into_normal_attempt_insert",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_DynamicRoutingStatsNew_insert | clm | method | // hyperswitch/crates/diesel_models/src/query/dynamic_routing_stats.rs
// impl for DynamicRoutingStatsNew
pub async fn insert(self, conn: &PgPooledConn) -> StorageResult<DynamicRoutingStats> {
generics::generic_insert(conn, self).await
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "DynamicRoutingStatsNew",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "insert",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_DynamicRoutingStats_find_optional_by_attempt_id_merchant_id | clm | method | // hyperswitch/crates/diesel_models/src/query/dynamic_routing_stats.rs
// impl for DynamicRoutingStats
pub async fn find_optional_by_attempt_id_merchant_id(
conn: &PgPooledConn,
attempt_id: String,
merchant_id: &common_utils::id_type::MerchantId,
) -> StorageResult<Option<Self>> {
generics::generic_find_one_optional::<<Self as HasTable>::Table, _, _>(
conn,
dsl::merchant_id
.eq(merchant_id.to_owned())
.and(dsl::attempt_id.eq(attempt_id.to_owned())),
)
.await
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "DynamicRoutingStats",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "find_optional_by_attempt_id_merchant_id",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_DynamicRoutingStats_update | clm | method | // hyperswitch/crates/diesel_models/src/query/dynamic_routing_stats.rs
// impl for DynamicRoutingStats
pub async fn update(
conn: &PgPooledConn,
attempt_id: String,
merchant_id: &common_utils::id_type::MerchantId,
dynamic_routing_stat: DynamicRoutingStatsUpdate,
) -> StorageResult<Self> {
generics::generic_update_with_results::<
<Self as HasTable>::Table,
DynamicRoutingStatsUpdate,
_,
_,
>(
conn,
dsl::merchant_id
.eq(merchant_id.to_owned())
.and(dsl::attempt_id.eq(attempt_id.to_owned())),
dynamic_routing_stat,
)
.await?
.first()
.cloned()
.ok_or_else(|| {
report!(errors::DatabaseError::NotFound)
.attach_printable("Error while updating dynamic_routing_stats entry")
})
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "DynamicRoutingStats",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "update",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_tokenization_diesel::Tokenization_insert | clm | method | // hyperswitch/crates/diesel_models/src/query/tokenization.rs
// impl for tokenization_diesel::Tokenization
pub async fn insert(self, conn: &PgPooledConn) -> StorageResult<Self> {
generics::generic_insert(conn, self).await
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "tokenization_diesel::Tokenization",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "insert",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_tokenization_diesel::Tokenization_find_by_id | clm | method | // hyperswitch/crates/diesel_models/src/query/tokenization.rs
// impl for tokenization_diesel::Tokenization
pub async fn find_by_id(
conn: &PgPooledConn,
id: &common_utils::id_type::GlobalTokenId,
) -> StorageResult<Self> {
generics::generic_find_one::<<Self as HasTable>::Table, _, _>(
conn,
tokenization::dsl::id.eq(id.to_owned()),
)
.await
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "tokenization_diesel::Tokenization",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "find_by_id",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_tokenization_diesel::Tokenization_update_with_id | clm | method | // hyperswitch/crates/diesel_models/src/query/tokenization.rs
// impl for tokenization_diesel::Tokenization
pub async fn update_with_id(
self,
conn: &PgPooledConn,
tokenization_record: tokenization_diesel::TokenizationUpdateInternal,
) -> StorageResult<Self> {
match generics::generic_update_with_unique_predicate_get_result::<
<Self as HasTable>::Table,
_,
_,
_,
>(
conn,
tokenization::dsl::id.eq(self.id.to_owned()),
tokenization_record,
)
.await
{
Err(error) => match error.current_context() {
errors::DatabaseError::NoFieldsToUpdate => Ok(self),
_ => Err(error),
},
result => result,
}
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "tokenization_diesel::Tokenization",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "update_with_id",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_DisputeNew_insert | clm | method | // hyperswitch/crates/diesel_models/src/query/dispute.rs
// impl for DisputeNew
pub async fn insert(self, conn: &PgPooledConn) -> StorageResult<Dispute> {
generics::generic_insert(conn, self).await
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "DisputeNew",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "insert",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_Dispute_find_by_merchant_id_payment_id_connector_dispute_id | clm | method | // hyperswitch/crates/diesel_models/src/query/dispute.rs
// impl for Dispute
pub async fn find_by_merchant_id_payment_id_connector_dispute_id(
conn: &PgPooledConn,
merchant_id: &common_utils::id_type::MerchantId,
payment_id: &common_utils::id_type::PaymentId,
connector_dispute_id: &str,
) -> StorageResult<Option<Self>> {
generics::generic_find_one_optional::<<Self as HasTable>::Table, _, _>(
conn,
dsl::merchant_id
.eq(merchant_id.to_owned())
.and(dsl::payment_id.eq(payment_id.to_owned()))
.and(dsl::connector_dispute_id.eq(connector_dispute_id.to_owned())),
)
.await
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "Dispute",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "find_by_merchant_id_payment_id_connector_dispute_id",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_Dispute_find_by_merchant_id_dispute_id | clm | method | // hyperswitch/crates/diesel_models/src/query/dispute.rs
// impl for Dispute
pub async fn find_by_merchant_id_dispute_id(
conn: &PgPooledConn,
merchant_id: &common_utils::id_type::MerchantId,
dispute_id: &str,
) -> StorageResult<Self> {
generics::generic_find_one::<<Self as HasTable>::Table, _, _>(
conn,
dsl::merchant_id
.eq(merchant_id.to_owned())
.and(dsl::dispute_id.eq(dispute_id.to_owned())),
)
.await
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "Dispute",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "find_by_merchant_id_dispute_id",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_Dispute_find_by_merchant_id_payment_id | clm | method | // hyperswitch/crates/diesel_models/src/query/dispute.rs
// impl for Dispute
pub async fn find_by_merchant_id_payment_id(
conn: &PgPooledConn,
merchant_id: &common_utils::id_type::MerchantId,
payment_id: &common_utils::id_type::PaymentId,
) -> StorageResult<Vec<Self>> {
generics::generic_filter::<
<Self as HasTable>::Table,
_,
<<Self as HasTable>::Table as Table>::PrimaryKey,
_,
>(
conn,
dsl::merchant_id
.eq(merchant_id.to_owned())
.and(dsl::payment_id.eq(payment_id.to_owned())),
None,
None,
None,
)
.await
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "Dispute",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "find_by_merchant_id_payment_id",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_Dispute_update | clm | method | // hyperswitch/crates/diesel_models/src/query/dispute.rs
// impl for Dispute
pub async fn update(self, conn: &PgPooledConn, dispute: DisputeUpdate) -> StorageResult<Self> {
match generics::generic_update_with_unique_predicate_get_result::<
<Self as HasTable>::Table,
_,
_,
_,
>(
conn,
dsl::dispute_id.eq(self.dispute_id.to_owned()),
DisputeUpdateInternal::from(dispute),
)
.await
{
Err(error) => match error.current_context() {
errors::DatabaseError::NoFieldsToUpdate => Ok(self),
_ => Err(error),
},
result => result,
}
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "Dispute",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "update",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_CallbackMapper_insert | clm | method | // hyperswitch/crates/diesel_models/src/query/callback_mapper.rs
// impl for CallbackMapper
pub async fn insert(self, conn: &PgPooledConn) -> StorageResult<Self> {
generics::generic_insert(conn, self).await
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "CallbackMapper",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "insert",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_CallbackMapper_find_by_id | clm | method | // hyperswitch/crates/diesel_models/src/query/callback_mapper.rs
// impl for CallbackMapper
pub async fn find_by_id(conn: &PgPooledConn, id: &str) -> StorageResult<Self> {
generics::generic_find_one::<<Self as HasTable>::Table, _, _>(
conn,
dsl::id.eq(id.to_owned()),
)
.await
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "CallbackMapper",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "find_by_id",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_RoleNew_insert | clm | method | // hyperswitch/crates/diesel_models/src/query/role.rs
// impl for RoleNew
pub async fn insert(self, conn: &PgPooledConn) -> StorageResult<Role> {
generics::generic_insert(conn, self).await
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "RoleNew",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "insert",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_Role_get_entity_list | clm | method | // hyperswitch/crates/diesel_models/src/query/role.rs
// impl for Role
fn get_entity_list(
current_entity: EntityType,
is_lineage_data_required: bool,
) -> Vec<EntityType> {
is_lineage_data_required
.then(|| {
EntityType::iter()
.filter(|variant| *variant <= current_entity)
.collect()
})
.unwrap_or(vec![current_entity])
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "Role",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "get_entity_list",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_Role_find_by_role_id | clm | method | // hyperswitch/crates/diesel_models/src/query/role.rs
// impl for Role
pub async fn find_by_role_id(conn: &PgPooledConn, role_id: &str) -> StorageResult<Self> {
generics::generic_find_one::<<Self as HasTable>::Table, _, _>(
conn,
dsl::role_id.eq(role_id.to_owned()),
)
.await
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "Role",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "find_by_role_id",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_Role_find_by_role_id_in_lineage | clm | method | // hyperswitch/crates/diesel_models/src/query/role.rs
// impl for Role
pub async fn find_by_role_id_in_lineage(
conn: &PgPooledConn,
role_id: &str,
merchant_id: &id_type::MerchantId,
org_id: &id_type::OrganizationId,
profile_id: &id_type::ProfileId,
tenant_id: &id_type::TenantId,
) -> StorageResult<Self> {
generics::generic_find_one::<<Self as HasTable>::Table, _, _>(
conn,
dsl::role_id
.eq(role_id.to_owned())
.and(dsl::tenant_id.eq(tenant_id.to_owned()))
.and(dsl::org_id.eq(org_id.to_owned()))
.and(
dsl::scope
.eq(RoleScope::Organization)
.or(dsl::merchant_id
.eq(merchant_id.to_owned())
.and(dsl::scope.eq(RoleScope::Merchant)))
.or(dsl::profile_id
.eq(profile_id.to_owned())
.and(dsl::scope.eq(RoleScope::Profile))),
),
)
.await
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "Role",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "find_by_role_id_in_lineage",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_Role_find_by_role_id_org_id_tenant_id | clm | method | // hyperswitch/crates/diesel_models/src/query/role.rs
// impl for Role
pub async fn find_by_role_id_org_id_tenant_id(
conn: &PgPooledConn,
role_id: &str,
org_id: &id_type::OrganizationId,
tenant_id: &id_type::TenantId,
) -> StorageResult<Self> {
generics::generic_find_one::<<Self as HasTable>::Table, _, _>(
conn,
dsl::role_id
.eq(role_id.to_owned())
.and(dsl::tenant_id.eq(tenant_id.to_owned()))
.and(dsl::org_id.eq(org_id.to_owned())),
)
.await
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "Role",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "find_by_role_id_org_id_tenant_id",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_Role_update_by_role_id | clm | method | // hyperswitch/crates/diesel_models/src/query/role.rs
// impl for Role
pub async fn update_by_role_id(
conn: &PgPooledConn,
role_id: &str,
role_update: RoleUpdate,
) -> StorageResult<Self> {
generics::generic_update_with_unique_predicate_get_result::<
<Self as HasTable>::Table,
_,
_,
_,
>(
conn,
dsl::role_id.eq(role_id.to_owned()),
RoleUpdateInternal::from(role_update),
)
.await
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "Role",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "update_by_role_id",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_Role_delete_by_role_id | clm | method | // hyperswitch/crates/diesel_models/src/query/role.rs
// impl for Role
pub async fn delete_by_role_id(conn: &PgPooledConn, role_id: &str) -> StorageResult<Self> {
generics::generic_delete_one_with_result::<<Self as HasTable>::Table, _, _>(
conn,
dsl::role_id.eq(role_id.to_owned()),
)
.await
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "Role",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "delete_by_role_id",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_Role_generic_roles_list_for_org | clm | method | // hyperswitch/crates/diesel_models/src/query/role.rs
// impl for Role
pub async fn generic_roles_list_for_org(
conn: &PgPooledConn,
tenant_id: id_type::TenantId,
org_id: id_type::OrganizationId,
merchant_id: Option<id_type::MerchantId>,
entity_type: Option<EntityType>,
limit: Option<u32>,
) -> StorageResult<Vec<Self>> {
let mut query = <Self as HasTable>::table()
.filter(dsl::tenant_id.eq(tenant_id).and(dsl::org_id.eq(org_id)))
.into_boxed();
if let Some(merchant_id) = merchant_id {
query = query.filter(
(dsl::merchant_id
.eq(merchant_id)
.and(dsl::scope.eq(RoleScope::Merchant)))
.or(dsl::scope.eq(RoleScope::Organization)),
);
}
if let Some(entity_type) = entity_type {
query = query.filter(dsl::entity_type.eq(entity_type))
}
if let Some(limit) = limit {
query = query.limit(limit.into());
}
router_env::logger::debug!(query = %debug_query::<Pg,_>(&query).to_string());
match generics::db_metrics::track_database_call::<Self, _, _>(
query.get_results_async(conn),
generics::db_metrics::DatabaseOperation::Filter,
)
.await
{
Ok(value) => Ok(value),
Err(err) => match err {
DieselError::NotFound => {
Err(report!(err)).change_context(errors::DatabaseError::NotFound)
}
_ => Err(report!(err)).change_context(errors::DatabaseError::Others),
},
}
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "Role",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "generic_roles_list_for_org",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_Role_generic_list_roles_by_entity_type | clm | method | // hyperswitch/crates/diesel_models/src/query/role.rs
// impl for Role
pub async fn generic_list_roles_by_entity_type(
conn: &PgPooledConn,
payload: ListRolesByEntityPayload,
is_lineage_data_required: bool,
tenant_id: id_type::TenantId,
org_id: id_type::OrganizationId,
) -> StorageResult<Vec<Self>> {
let mut query = <Self as HasTable>::table()
.into_boxed()
.filter(dsl::tenant_id.eq(tenant_id))
.filter(dsl::org_id.eq(org_id));
match payload {
ListRolesByEntityPayload::Organization => {
let entity_in_vec =
Self::get_entity_list(EntityType::Organization, is_lineage_data_required);
query = query.filter(dsl::entity_type.eq_any(entity_in_vec))
}
ListRolesByEntityPayload::Merchant(merchant_id) => {
let entity_in_vec =
Self::get_entity_list(EntityType::Merchant, is_lineage_data_required);
query = query
.filter(
dsl::scope
.eq(RoleScope::Organization)
.or(dsl::merchant_id.eq(merchant_id)),
)
.filter(dsl::entity_type.eq_any(entity_in_vec))
}
ListRolesByEntityPayload::Profile(merchant_id, profile_id) => {
let entity_in_vec =
Self::get_entity_list(EntityType::Profile, is_lineage_data_required);
query = query
.filter(
dsl::scope
.eq(RoleScope::Organization)
.or(dsl::scope
.eq(RoleScope::Merchant)
.and(dsl::merchant_id.eq(merchant_id.clone())))
.or(dsl::profile_id.eq(profile_id)),
)
.filter(dsl::entity_type.eq_any(entity_in_vec))
}
};
router_env::logger::debug!(query = %debug_query::<Pg,_>(&query).to_string());
match generics::db_metrics::track_database_call::<Self, _, _>(
query.get_results_async(conn),
generics::db_metrics::DatabaseOperation::Filter,
)
.await
{
Ok(value) => Ok(value),
Err(err) => Err(report!(err)).change_context(errors::DatabaseError::Others),
}
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "Role",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "generic_list_roles_by_entity_type",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_PaymentAttemptNew_insert | clm | method | // hyperswitch/crates/diesel_models/src/query/payment_attempt.rs
// impl for PaymentAttemptNew
pub async fn insert(self, conn: &PgPooledConn) -> StorageResult<PaymentAttempt> {
generics::generic_insert(conn, self).await
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "PaymentAttemptNew",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "insert",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_EventNew_insert | clm | method | // hyperswitch/crates/diesel_models/src/query/events.rs
// impl for EventNew
pub async fn insert(self, conn: &PgPooledConn) -> StorageResult<Event> {
generics::generic_insert(conn, self).await
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "EventNew",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "insert",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_Event_find_by_merchant_id_event_id | clm | method | // hyperswitch/crates/diesel_models/src/query/events.rs
// impl for Event
pub async fn find_by_merchant_id_event_id(
conn: &PgPooledConn,
merchant_id: &common_utils::id_type::MerchantId,
event_id: &str,
) -> StorageResult<Self> {
generics::generic_find_one::<<Self as HasTable>::Table, _, _>(
conn,
dsl::merchant_id
.eq(merchant_id.to_owned())
.and(dsl::event_id.eq(event_id.to_owned())),
)
.await
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "Event",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "find_by_merchant_id_event_id",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_Event_find_by_merchant_id_idempotent_event_id | clm | method | // hyperswitch/crates/diesel_models/src/query/events.rs
// impl for Event
pub async fn find_by_merchant_id_idempotent_event_id(
conn: &PgPooledConn,
merchant_id: &common_utils::id_type::MerchantId,
idempotent_event_id: &str,
) -> StorageResult<Self> {
generics::generic_find_one::<<Self as HasTable>::Table, _, _>(
conn,
dsl::merchant_id
.eq(merchant_id.to_owned())
.and(dsl::idempotent_event_id.eq(idempotent_event_id.to_owned())),
)
.await
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "Event",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "find_by_merchant_id_idempotent_event_id",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_Event_list_initial_attempts_by_merchant_id_primary_object_id | clm | method | // hyperswitch/crates/diesel_models/src/query/events.rs
// impl for Event
pub async fn list_initial_attempts_by_merchant_id_primary_object_id(
conn: &PgPooledConn,
merchant_id: &common_utils::id_type::MerchantId,
primary_object_id: &str,
) -> StorageResult<Vec<Self>> {
generics::generic_filter::<<Self as HasTable>::Table, _, _, _>(
conn,
dsl::event_id
.nullable()
.eq(dsl::initial_attempt_id) // Filter initial attempts only
.and(dsl::merchant_id.eq(merchant_id.to_owned()))
.and(dsl::primary_object_id.eq(primary_object_id.to_owned())),
None,
None,
Some(dsl::created_at.desc()),
)
.await
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "Event",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "list_initial_attempts_by_merchant_id_primary_object_id",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_Event_list_initial_attempts_by_merchant_id_constraints | clm | method | // hyperswitch/crates/diesel_models/src/query/events.rs
// impl for Event
pub async fn list_initial_attempts_by_merchant_id_constraints(
conn: &PgPooledConn,
merchant_id: &common_utils::id_type::MerchantId,
created_after: time::PrimitiveDateTime,
created_before: time::PrimitiveDateTime,
limit: Option<i64>,
offset: Option<i64>,
event_types: HashSet<common_enums::EventType>,
is_delivered: Option<bool>,
) -> StorageResult<Vec<Self>> {
use async_bb8_diesel::AsyncRunQueryDsl;
use diesel::{debug_query, pg::Pg, QueryDsl};
use error_stack::ResultExt;
use router_env::logger;
use super::generics::db_metrics::{track_database_call, DatabaseOperation};
use crate::errors::DatabaseError;
let mut query = Self::table()
.filter(
dsl::event_id
.nullable()
.eq(dsl::initial_attempt_id) // Filter initial attempts only
.and(dsl::merchant_id.eq(merchant_id.to_owned())),
)
.order(dsl::created_at.desc())
.into_boxed();
query = Self::apply_filters(
query,
None,
(dsl::created_at, created_after, created_before),
limit,
offset,
event_types,
is_delivered,
);
logger::debug!(query = %debug_query::<Pg, _>(&query).to_string());
track_database_call::<Self, _, _>(query.get_results_async(conn), DatabaseOperation::Filter)
.await
.change_context(DatabaseError::Others) // Query returns empty Vec when no records are found
.attach_printable("Error filtering events by constraints")
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "Event",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "list_initial_attempts_by_merchant_id_constraints",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_Event_list_by_merchant_id_initial_attempt_id | clm | method | // hyperswitch/crates/diesel_models/src/query/events.rs
// impl for Event
pub async fn list_by_merchant_id_initial_attempt_id(
conn: &PgPooledConn,
merchant_id: &common_utils::id_type::MerchantId,
initial_attempt_id: &str,
) -> StorageResult<Vec<Self>> {
generics::generic_filter::<<Self as HasTable>::Table, _, _, _>(
conn,
dsl::merchant_id
.eq(merchant_id.to_owned())
.and(dsl::initial_attempt_id.eq(initial_attempt_id.to_owned())),
None,
None,
Some(dsl::created_at.desc()),
)
.await
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "Event",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "list_by_merchant_id_initial_attempt_id",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_Event_list_initial_attempts_by_profile_id_primary_object_id | clm | method | // hyperswitch/crates/diesel_models/src/query/events.rs
// impl for Event
pub async fn list_initial_attempts_by_profile_id_primary_object_id(
conn: &PgPooledConn,
profile_id: &common_utils::id_type::ProfileId,
primary_object_id: &str,
) -> StorageResult<Vec<Self>> {
generics::generic_filter::<<Self as HasTable>::Table, _, _, _>(
conn,
dsl::event_id
.nullable()
.eq(dsl::initial_attempt_id) // Filter initial attempts only
.and(dsl::business_profile_id.eq(profile_id.to_owned()))
.and(dsl::primary_object_id.eq(primary_object_id.to_owned())),
None,
None,
Some(dsl::created_at.desc()),
)
.await
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "Event",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "list_initial_attempts_by_profile_id_primary_object_id",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_Event_list_initial_attempts_by_profile_id_constraints | clm | method | // hyperswitch/crates/diesel_models/src/query/events.rs
// impl for Event
pub async fn list_initial_attempts_by_profile_id_constraints(
conn: &PgPooledConn,
profile_id: &common_utils::id_type::ProfileId,
created_after: time::PrimitiveDateTime,
created_before: time::PrimitiveDateTime,
limit: Option<i64>,
offset: Option<i64>,
event_types: HashSet<common_enums::EventType>,
is_delivered: Option<bool>,
) -> StorageResult<Vec<Self>> {
use async_bb8_diesel::AsyncRunQueryDsl;
use diesel::{debug_query, pg::Pg, QueryDsl};
use error_stack::ResultExt;
use router_env::logger;
use super::generics::db_metrics::{track_database_call, DatabaseOperation};
use crate::errors::DatabaseError;
let mut query = Self::table()
.filter(
dsl::event_id
.nullable()
.eq(dsl::initial_attempt_id) // Filter initial attempts only
.and(dsl::business_profile_id.eq(profile_id.to_owned())),
)
.order(dsl::created_at.desc())
.into_boxed();
query = Self::apply_filters(
query,
None,
(dsl::created_at, created_after, created_before),
limit,
offset,
event_types,
is_delivered,
);
logger::debug!(query = %debug_query::<Pg, _>(&query).to_string());
track_database_call::<Self, _, _>(query.get_results_async(conn), DatabaseOperation::Filter)
.await
.change_context(DatabaseError::Others) // Query returns empty Vec when no records are found
.attach_printable("Error filtering events by constraints")
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "Event",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "list_initial_attempts_by_profile_id_constraints",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_Event_list_by_profile_id_initial_attempt_id | clm | method | // hyperswitch/crates/diesel_models/src/query/events.rs
// impl for Event
pub async fn list_by_profile_id_initial_attempt_id(
conn: &PgPooledConn,
profile_id: &common_utils::id_type::ProfileId,
initial_attempt_id: &str,
) -> StorageResult<Vec<Self>> {
generics::generic_filter::<<Self as HasTable>::Table, _, _, _>(
conn,
dsl::business_profile_id
.eq(profile_id.to_owned())
.and(dsl::initial_attempt_id.eq(initial_attempt_id.to_owned())),
None,
None,
Some(dsl::created_at.desc()),
)
.await
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "Event",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "list_by_profile_id_initial_attempt_id",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_Event_update_by_merchant_id_event_id | clm | method | // hyperswitch/crates/diesel_models/src/query/events.rs
// impl for Event
pub async fn update_by_merchant_id_event_id(
conn: &PgPooledConn,
merchant_id: &common_utils::id_type::MerchantId,
event_id: &str,
event: EventUpdateInternal,
) -> StorageResult<Self> {
generics::generic_update_with_unique_predicate_get_result::<
<Self as HasTable>::Table,
_,
_,
_,
>(
conn,
dsl::merchant_id
.eq(merchant_id.to_owned())
.and(dsl::event_id.eq(event_id.to_owned())),
event,
)
.await
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "Event",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "update_by_merchant_id_event_id",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_Event_apply_filters | clm | method | // hyperswitch/crates/diesel_models/src/query/events.rs
// impl for Event
fn apply_filters<T>(
mut query: T,
profile_id: Option<common_utils::id_type::ProfileId>,
(column, created_after, created_before): (
dsl::created_at,
time::PrimitiveDateTime,
time::PrimitiveDateTime,
),
limit: Option<i64>,
offset: Option<i64>,
event_types: HashSet<common_enums::EventType>,
is_delivered: Option<bool>,
) -> T
where
T: diesel::query_dsl::methods::LimitDsl<Output = T>
+ diesel::query_dsl::methods::OffsetDsl<Output = T>,
T: diesel::query_dsl::methods::FilterDsl<
diesel::dsl::GtEq<dsl::created_at, time::PrimitiveDateTime>,
Output = T,
>,
T: diesel::query_dsl::methods::FilterDsl<
diesel::dsl::LtEq<dsl::created_at, time::PrimitiveDateTime>,
Output = T,
>,
T: diesel::query_dsl::methods::FilterDsl<
diesel::dsl::Eq<dsl::business_profile_id, common_utils::id_type::ProfileId>,
Output = T,
>,
T: diesel::query_dsl::methods::FilterDsl<
diesel::dsl::EqAny<dsl::event_type, HashSet<common_enums::EventType>>,
Output = T,
>,
T: diesel::query_dsl::methods::FilterDsl<
diesel::dsl::Eq<dsl::is_overall_delivery_successful, bool>,
Output = T,
>,
{
if let Some(profile_id) = profile_id {
query = query.filter(dsl::business_profile_id.eq(profile_id));
}
query = query
.filter(column.ge(created_after))
.filter(column.le(created_before));
if let Some(limit) = limit {
query = query.limit(limit);
}
if let Some(offset) = offset {
query = query.offset(offset);
}
if !event_types.is_empty() {
query = query.filter(dsl::event_type.eq_any(event_types));
}
if let Some(is_delivered) = is_delivered {
query = query.filter(dsl::is_overall_delivery_successful.eq(is_delivered));
}
query
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "Event",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "apply_filters",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_Event_count_initial_attempts_by_constraints | clm | method | // hyperswitch/crates/diesel_models/src/query/events.rs
// impl for Event
pub async fn count_initial_attempts_by_constraints(
conn: &PgPooledConn,
merchant_id: &common_utils::id_type::MerchantId,
profile_id: Option<common_utils::id_type::ProfileId>,
created_after: time::PrimitiveDateTime,
created_before: time::PrimitiveDateTime,
event_types: HashSet<common_enums::EventType>,
is_delivered: Option<bool>,
) -> StorageResult<i64> {
use async_bb8_diesel::AsyncRunQueryDsl;
use diesel::{debug_query, pg::Pg, QueryDsl};
use error_stack::ResultExt;
use router_env::logger;
use super::generics::db_metrics::{track_database_call, DatabaseOperation};
use crate::errors::DatabaseError;
let mut query = Self::table()
.count()
.filter(
dsl::event_id
.nullable()
.eq(dsl::initial_attempt_id) // Filter initial attempts only
.and(dsl::merchant_id.eq(merchant_id.to_owned())),
)
.into_boxed();
query = Self::apply_filters(
query,
profile_id,
(dsl::created_at, created_after, created_before),
None,
None,
event_types,
is_delivered,
);
logger::debug!(query = %debug_query::<Pg, _>(&query).to_string());
track_database_call::<Self, _, _>(
query.get_result_async::<i64>(conn),
DatabaseOperation::Count,
)
.await
.change_context(DatabaseError::Others)
.attach_printable("Error counting events by constraints")
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "Event",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "count_initial_attempts_by_constraints",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_OrganizationNew_insert | clm | method | // hyperswitch/crates/diesel_models/src/query/organization.rs
// impl for OrganizationNew
pub async fn insert(self, conn: &PgPooledConn) -> StorageResult<Organization> {
generics::generic_insert(conn, self).await
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "OrganizationNew",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "insert",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_Organization_find_by_org_id | clm | method | // hyperswitch/crates/diesel_models/src/query/organization.rs
// impl for Organization
pub async fn find_by_org_id(
conn: &PgPooledConn,
org_id: id_type::OrganizationId,
) -> StorageResult<Self> {
generics::generic_find_one::<<Self as HasTable>::Table, _, _>(
conn,
dsl_identifier.eq(org_id),
)
.await
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "Organization",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "find_by_org_id",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_Organization_update_by_org_id | clm | method | // hyperswitch/crates/diesel_models/src/query/organization.rs
// impl for Organization
pub async fn update_by_org_id(
conn: &PgPooledConn,
org_id: id_type::OrganizationId,
update: OrganizationUpdate,
) -> StorageResult<Self> {
generics::generic_update_with_unique_predicate_get_result::<
<Self as HasTable>::Table,
_,
_,
_,
>(
conn,
dsl_identifier.eq(org_id),
OrganizationUpdateInternal::from(update),
)
.await
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "Organization",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "update_by_org_id",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_MerchantAccountNew_insert | clm | method | // hyperswitch/crates/diesel_models/src/query/merchant_account.rs
// impl for MerchantAccountNew
pub async fn insert(self, conn: &PgPooledConn) -> StorageResult<MerchantAccount> {
generics::generic_insert(conn, self).await
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "MerchantAccountNew",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "insert",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_MerchantAccount_update | clm | method | // hyperswitch/crates/diesel_models/src/query/merchant_account.rs
// impl for MerchantAccount
pub async fn update(
self,
conn: &PgPooledConn,
merchant_account: MerchantAccountUpdateInternal,
) -> StorageResult<Self> {
match generics::generic_update_by_id::<<Self as HasTable>::Table, _, _, _>(
conn,
self.get_id().to_owned(),
merchant_account,
)
.await
{
Err(error) => match error.current_context() {
errors::DatabaseError::NoFieldsToUpdate => Ok(self),
_ => Err(error),
},
result => result,
}
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "MerchantAccount",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "update",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_MerchantAccount_update_with_specific_fields | clm | method | // hyperswitch/crates/diesel_models/src/query/merchant_account.rs
// impl for MerchantAccount
pub async fn update_with_specific_fields(
conn: &PgPooledConn,
identifier: &common_utils::id_type::MerchantId,
merchant_account: MerchantAccountUpdateInternal,
) -> StorageResult<Self> {
generics::generic_update_with_unique_predicate_get_result::<
<Self as HasTable>::Table,
_,
_,
_,
>(conn, dsl::id.eq(identifier.to_owned()), merchant_account)
.await
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "MerchantAccount",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "update_with_specific_fields",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_MerchantAccount_delete_by_merchant_id | clm | method | // hyperswitch/crates/diesel_models/src/query/merchant_account.rs
// impl for MerchantAccount
pub async fn delete_by_merchant_id(
conn: &PgPooledConn,
identifier: &common_utils::id_type::MerchantId,
) -> StorageResult<bool> {
generics::generic_delete::<<Self as HasTable>::Table, _>(
conn,
dsl::id.eq(identifier.to_owned()),
)
.await
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "MerchantAccount",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "delete_by_merchant_id",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_MerchantAccount_find_by_merchant_id | clm | method | // hyperswitch/crates/diesel_models/src/query/merchant_account.rs
// impl for MerchantAccount
pub async fn find_by_merchant_id(
conn: &PgPooledConn,
identifier: &common_utils::id_type::MerchantId,
) -> StorageResult<Self> {
generics::generic_find_one::<<Self as HasTable>::Table, _, _>(
conn,
dsl::id.eq(identifier.to_owned()),
)
.await
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "MerchantAccount",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "find_by_merchant_id",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_MerchantAccount_find_by_publishable_key | clm | method | // hyperswitch/crates/diesel_models/src/query/merchant_account.rs
// impl for MerchantAccount
pub async fn find_by_publishable_key(
conn: &PgPooledConn,
publishable_key: &str,
) -> StorageResult<Self> {
generics::generic_find_one::<<Self as HasTable>::Table, _, _>(
conn,
dsl::publishable_key.eq(publishable_key.to_owned()),
)
.await
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "MerchantAccount",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "find_by_publishable_key",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_MerchantAccount_list_by_organization_id | clm | method | // hyperswitch/crates/diesel_models/src/query/merchant_account.rs
// impl for MerchantAccount
pub async fn list_by_organization_id(
conn: &PgPooledConn,
organization_id: &common_utils::id_type::OrganizationId,
) -> StorageResult<Vec<Self>> {
generics::generic_filter::<
<Self as HasTable>::Table,
_,
<<Self as HasTable>::Table as Table>::PrimaryKey,
_,
>(
conn,
dsl::organization_id.eq(organization_id.to_owned()),
None,
None,
None,
)
.await
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "MerchantAccount",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "list_by_organization_id",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_MerchantAccount_list_multiple_merchant_accounts | clm | method | // hyperswitch/crates/diesel_models/src/query/merchant_account.rs
// impl for MerchantAccount
pub async fn list_multiple_merchant_accounts(
conn: &PgPooledConn,
merchant_ids: Vec<common_utils::id_type::MerchantId>,
) -> StorageResult<Vec<Self>> {
generics::generic_filter::<
<Self as HasTable>::Table,
_,
<<Self as HasTable>::Table as Table>::PrimaryKey,
_,
>(conn, dsl::id.eq_any(merchant_ids), None, None, None)
.await
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "MerchantAccount",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "list_multiple_merchant_accounts",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_MerchantAccount_list_all_merchant_accounts | clm | method | // hyperswitch/crates/diesel_models/src/query/merchant_account.rs
// impl for MerchantAccount
pub async fn list_all_merchant_accounts(
conn: &PgPooledConn,
limit: u32,
offset: Option<u32>,
) -> StorageResult<Vec<Self>> {
generics::generic_filter::<
<Self as HasTable>::Table,
_,
<<Self as HasTable>::Table as Table>::PrimaryKey,
_,
>(
conn,
dsl::id.ne_all(vec![""]),
Some(i64::from(limit)),
offset.map(i64::from),
None,
)
.await
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "MerchantAccount",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "list_all_merchant_accounts",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_MerchantAccount_update_all_merchant_accounts | clm | method | // hyperswitch/crates/diesel_models/src/query/merchant_account.rs
// impl for MerchantAccount
pub async fn update_all_merchant_accounts(
conn: &PgPooledConn,
merchant_account: MerchantAccountUpdateInternal,
) -> StorageResult<Vec<Self>> {
generics::generic_update_with_results::<<Self as HasTable>::Table, _, _, _>(
conn,
dsl::id.ne_all(vec![""]),
merchant_account,
)
.await
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "MerchantAccount",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "update_all_merchant_accounts",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_MerchantAccount_update | clm | method | // hyperswitch/crates/diesel_models/src/query/merchant_account.rs
// impl for MerchantAccount
pub async fn update(
self,
conn: &PgPooledConn,
merchant_account: MerchantAccountUpdateInternal,
) -> StorageResult<Self> {
match generics::generic_update_by_id::<<Self as HasTable>::Table, _, _, _>(
conn,
self.get_id().to_owned(),
merchant_account,
)
.await
{
Err(error) => match error.current_context() {
errors::DatabaseError::NoFieldsToUpdate => Ok(self),
_ => Err(error),
},
result => result,
}
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "MerchantAccount",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "update",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_MerchantAccount_update_with_specific_fields | clm | method | // hyperswitch/crates/diesel_models/src/query/merchant_account.rs
// impl for MerchantAccount
pub async fn update_with_specific_fields(
conn: &PgPooledConn,
identifier: &common_utils::id_type::MerchantId,
merchant_account: MerchantAccountUpdateInternal,
) -> StorageResult<Self> {
generics::generic_update_with_unique_predicate_get_result::<
<Self as HasTable>::Table,
_,
_,
_,
>(conn, dsl::id.eq(identifier.to_owned()), merchant_account)
.await
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "MerchantAccount",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "update_with_specific_fields",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_MerchantAccount_delete_by_merchant_id | clm | method | // hyperswitch/crates/diesel_models/src/query/merchant_account.rs
// impl for MerchantAccount
pub async fn delete_by_merchant_id(
conn: &PgPooledConn,
identifier: &common_utils::id_type::MerchantId,
) -> StorageResult<bool> {
generics::generic_delete::<<Self as HasTable>::Table, _>(
conn,
dsl::id.eq(identifier.to_owned()),
)
.await
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "MerchantAccount",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "delete_by_merchant_id",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_MerchantAccount_find_by_merchant_id | clm | method | // hyperswitch/crates/diesel_models/src/query/merchant_account.rs
// impl for MerchantAccount
pub async fn find_by_merchant_id(
conn: &PgPooledConn,
identifier: &common_utils::id_type::MerchantId,
) -> StorageResult<Self> {
generics::generic_find_one::<<Self as HasTable>::Table, _, _>(
conn,
dsl::id.eq(identifier.to_owned()),
)
.await
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "MerchantAccount",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "find_by_merchant_id",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_MerchantAccount_find_by_publishable_key | clm | method | // hyperswitch/crates/diesel_models/src/query/merchant_account.rs
// impl for MerchantAccount
pub async fn find_by_publishable_key(
conn: &PgPooledConn,
publishable_key: &str,
) -> StorageResult<Self> {
generics::generic_find_one::<<Self as HasTable>::Table, _, _>(
conn,
dsl::publishable_key.eq(publishable_key.to_owned()),
)
.await
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "MerchantAccount",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "find_by_publishable_key",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_MerchantAccount_list_by_organization_id | clm | method | // hyperswitch/crates/diesel_models/src/query/merchant_account.rs
// impl for MerchantAccount
pub async fn list_by_organization_id(
conn: &PgPooledConn,
organization_id: &common_utils::id_type::OrganizationId,
) -> StorageResult<Vec<Self>> {
generics::generic_filter::<
<Self as HasTable>::Table,
_,
<<Self as HasTable>::Table as Table>::PrimaryKey,
_,
>(
conn,
dsl::organization_id.eq(organization_id.to_owned()),
None,
None,
None,
)
.await
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "MerchantAccount",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "list_by_organization_id",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_MerchantAccount_list_multiple_merchant_accounts | clm | method | // hyperswitch/crates/diesel_models/src/query/merchant_account.rs
// impl for MerchantAccount
pub async fn list_multiple_merchant_accounts(
conn: &PgPooledConn,
merchant_ids: Vec<common_utils::id_type::MerchantId>,
) -> StorageResult<Vec<Self>> {
generics::generic_filter::<
<Self as HasTable>::Table,
_,
<<Self as HasTable>::Table as Table>::PrimaryKey,
_,
>(conn, dsl::id.eq_any(merchant_ids), None, None, None)
.await
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "MerchantAccount",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "list_multiple_merchant_accounts",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_MerchantAccount_list_all_merchant_accounts | clm | method | // hyperswitch/crates/diesel_models/src/query/merchant_account.rs
// impl for MerchantAccount
pub async fn list_all_merchant_accounts(
conn: &PgPooledConn,
limit: u32,
offset: Option<u32>,
) -> StorageResult<Vec<Self>> {
generics::generic_filter::<
<Self as HasTable>::Table,
_,
<<Self as HasTable>::Table as Table>::PrimaryKey,
_,
>(
conn,
dsl::id.ne_all(vec![""]),
Some(i64::from(limit)),
offset.map(i64::from),
None,
)
.await
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "MerchantAccount",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "list_all_merchant_accounts",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_MerchantAccount_update_all_merchant_accounts | clm | method | // hyperswitch/crates/diesel_models/src/query/merchant_account.rs
// impl for MerchantAccount
pub async fn update_all_merchant_accounts(
conn: &PgPooledConn,
merchant_account: MerchantAccountUpdateInternal,
) -> StorageResult<Vec<Self>> {
generics::generic_update_with_results::<<Self as HasTable>::Table, _, _, _>(
conn,
dsl::id.ne_all(vec![""]),
merchant_account,
)
.await
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "MerchantAccount",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "update_all_merchant_accounts",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_PayoutsNew_insert | clm | method | // hyperswitch/crates/diesel_models/src/query/payouts.rs
// impl for PayoutsNew
pub async fn insert(self, conn: &PgPooledConn) -> StorageResult<Payouts> {
generics::generic_insert(conn, self).await
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "PayoutsNew",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "insert",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_Payouts_update | clm | method | // hyperswitch/crates/diesel_models/src/query/payouts.rs
// impl for Payouts
pub async fn update(
self,
conn: &PgPooledConn,
payout_update: PayoutsUpdate,
) -> StorageResult<Self> {
match generics::generic_update_with_results::<<Self as HasTable>::Table, _, _, _>(
conn,
dsl::payout_id
.eq(self.payout_id.to_owned())
.and(dsl::merchant_id.eq(self.merchant_id.to_owned())),
PayoutsUpdateInternal::from(payout_update),
)
.await
{
Err(error) => match error.current_context() {
errors::DatabaseError::NoFieldsToUpdate => Ok(self),
_ => Err(error),
},
Ok(mut payouts) => payouts
.pop()
.ok_or(error_stack::report!(errors::DatabaseError::NotFound)),
}
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "Payouts",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "update",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_Payouts_find_by_merchant_id_payout_id | clm | method | // hyperswitch/crates/diesel_models/src/query/payouts.rs
// impl for Payouts
pub async fn find_by_merchant_id_payout_id(
conn: &PgPooledConn,
merchant_id: &common_utils::id_type::MerchantId,
payout_id: &common_utils::id_type::PayoutId,
) -> StorageResult<Self> {
generics::generic_find_one::<<Self as HasTable>::Table, _, _>(
conn,
dsl::merchant_id
.eq(merchant_id.to_owned())
.and(dsl::payout_id.eq(payout_id.to_owned())),
)
.await
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "Payouts",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "find_by_merchant_id_payout_id",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_Payouts_update_by_merchant_id_payout_id | clm | method | // hyperswitch/crates/diesel_models/src/query/payouts.rs
// impl for Payouts
pub async fn update_by_merchant_id_payout_id(
conn: &PgPooledConn,
merchant_id: &common_utils::id_type::MerchantId,
payout_id: &common_utils::id_type::PayoutId,
payout: PayoutsUpdate,
) -> StorageResult<Self> {
generics::generic_update_with_results::<<Self as HasTable>::Table, _, _, _>(
conn,
dsl::merchant_id
.eq(merchant_id.to_owned())
.and(dsl::payout_id.eq(payout_id.to_owned())),
PayoutsUpdateInternal::from(payout),
)
.await?
.first()
.cloned()
.ok_or_else(|| {
report!(errors::DatabaseError::NotFound).attach_printable("Error while updating payout")
})
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "Payouts",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "update_by_merchant_id_payout_id",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_Payouts_find_optional_by_merchant_id_payout_id | clm | method | // hyperswitch/crates/diesel_models/src/query/payouts.rs
// impl for Payouts
pub async fn find_optional_by_merchant_id_payout_id(
conn: &PgPooledConn,
merchant_id: &common_utils::id_type::MerchantId,
payout_id: &common_utils::id_type::PayoutId,
) -> StorageResult<Option<Self>> {
generics::generic_find_one_optional::<<Self as HasTable>::Table, _, _>(
conn,
dsl::merchant_id
.eq(merchant_id.to_owned())
.and(dsl::payout_id.eq(payout_id.to_owned())),
)
.await
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "Payouts",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "find_optional_by_merchant_id_payout_id",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_Payouts_get_total_count_of_payouts | clm | method | // hyperswitch/crates/diesel_models/src/query/payouts.rs
// impl for Payouts
pub async fn get_total_count_of_payouts(
conn: &PgPooledConn,
merchant_id: &common_utils::id_type::MerchantId,
active_payout_ids: &[common_utils::id_type::PayoutId],
connector: Option<Vec<String>>,
currency: Option<Vec<enums::Currency>>,
status: Option<Vec<enums::PayoutStatus>>,
payout_type: Option<Vec<enums::PayoutType>>,
) -> StorageResult<i64> {
let mut filter = <Self as HasTable>::table()
.inner_join(payout_attempt::table.on(payout_attempt::dsl::payout_id.eq(dsl::payout_id)))
.count()
.filter(dsl::merchant_id.eq(merchant_id.to_owned()))
.filter(dsl::payout_id.eq_any(active_payout_ids.to_vec()))
.into_boxed();
if let Some(connector) = connector {
filter = filter.filter(payout_attempt::dsl::connector.eq_any(connector));
}
if let Some(currency) = currency {
filter = filter.filter(dsl::destination_currency.eq_any(currency));
}
if let Some(status) = status {
filter = filter.filter(dsl::status.eq_any(status));
}
if let Some(payout_type) = payout_type {
filter = filter.filter(dsl::payout_type.eq_any(payout_type));
}
router_env::logger::debug!(query = %debug_query::<Pg, _>(&filter).to_string());
db_metrics::track_database_call::<<Self as HasTable>::Table, _, _>(
filter.get_result_async::<i64>(conn),
db_metrics::DatabaseOperation::Filter,
)
.await
.change_context(errors::DatabaseError::Others)
.attach_printable("Error filtering count of payouts")
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "Payouts",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "get_total_count_of_payouts",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_FraudCheckNew_insert | clm | method | // hyperswitch/crates/diesel_models/src/query/fraud_check.rs
// impl for FraudCheckNew
pub async fn insert(self, conn: &PgPooledConn) -> StorageResult<FraudCheck> {
generics::generic_insert(conn, self).await
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "FraudCheckNew",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "insert",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_FraudCheck_update_with_attempt_id | clm | method | // hyperswitch/crates/diesel_models/src/query/fraud_check.rs
// impl for FraudCheck
pub async fn update_with_attempt_id(
self,
conn: &PgPooledConn,
fraud_check: FraudCheckUpdate,
) -> StorageResult<Self> {
match generics::generic_update_with_unique_predicate_get_result::<
<Self as HasTable>::Table,
_,
_,
_,
>(
conn,
dsl::attempt_id
.eq(self.attempt_id.to_owned())
.and(dsl::merchant_id.eq(self.merchant_id.to_owned())),
FraudCheckUpdateInternal::from(fraud_check),
)
.await
{
Err(error) => match error.current_context() {
errors::DatabaseError::NoFieldsToUpdate => Ok(self),
_ => Err(error),
},
result => result,
}
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "FraudCheck",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "update_with_attempt_id",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_FraudCheck_get_with_payment_id | clm | method | // hyperswitch/crates/diesel_models/src/query/fraud_check.rs
// impl for FraudCheck
pub async fn get_with_payment_id(
conn: &PgPooledConn,
payment_id: common_utils::id_type::PaymentId,
merchant_id: common_utils::id_type::MerchantId,
) -> StorageResult<Self> {
generics::generic_find_one::<<Self as HasTable>::Table, _, _>(
conn,
dsl::payment_id
.eq(payment_id)
.and(dsl::merchant_id.eq(merchant_id)),
)
.await
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "FraudCheck",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "get_with_payment_id",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_FraudCheck_get_with_payment_id_if_present | clm | method | // hyperswitch/crates/diesel_models/src/query/fraud_check.rs
// impl for FraudCheck
pub async fn get_with_payment_id_if_present(
conn: &PgPooledConn,
payment_id: common_utils::id_type::PaymentId,
merchant_id: common_utils::id_type::MerchantId,
) -> StorageResult<Option<Self>> {
generics::generic_find_one_optional::<<Self as HasTable>::Table, _, _>(
conn,
dsl::payment_id
.eq(payment_id)
.and(dsl::merchant_id.eq(merchant_id)),
)
.await
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "FraudCheck",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "get_with_payment_id_if_present",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_CardInfo_find_by_iin | clm | method | // hyperswitch/crates/diesel_models/src/query/cards_info.rs
// impl for CardInfo
pub async fn find_by_iin(conn: &PgPooledConn, card_iin: &str) -> StorageResult<Option<Self>> {
generics::generic_find_by_id_optional::<<Self as HasTable>::Table, _, _>(
conn,
card_iin.to_owned(),
)
.await
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "CardInfo",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "find_by_iin",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_CardInfo_insert | clm | method | // hyperswitch/crates/diesel_models/src/query/cards_info.rs
// impl for CardInfo
pub async fn insert(self, conn: &PgPooledConn) -> StorageResult<Self> {
generics::generic_insert(conn, self).await
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "CardInfo",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "insert",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_CardInfo_update | clm | method | // hyperswitch/crates/diesel_models/src/query/cards_info.rs
// impl for CardInfo
pub async fn update(
conn: &PgPooledConn,
card_iin: String,
data: UpdateCardInfo,
) -> StorageResult<Self> {
generics::generic_update_with_results::<<Self as HasTable>::Table, UpdateCardInfo, _, _>(
conn,
dsl::card_iin.eq(card_iin),
data,
)
.await?
.first()
.cloned()
.ok_or_else(|| {
report!(errors::DatabaseError::NotFound)
.attach_printable("Error while updating card_info entry")
})
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "CardInfo",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "update",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_PaymentMethodNew_insert | clm | method | // hyperswitch/crates/diesel_models/src/query/payment_method.rs
// impl for PaymentMethodNew
pub async fn insert(self, conn: &PgPooledConn) -> StorageResult<PaymentMethod> {
generics::generic_insert(conn, self).await
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "PaymentMethodNew",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "insert",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_PaymentMethod_delete_by_payment_method_id | clm | method | // hyperswitch/crates/diesel_models/src/query/payment_method.rs
// impl for PaymentMethod
pub async fn delete_by_payment_method_id(
conn: &PgPooledConn,
payment_method_id: String,
) -> StorageResult<Self> {
generics::generic_delete_one_with_result::<<Self as HasTable>::Table, _, Self>(
conn,
dsl::payment_method_id.eq(payment_method_id),
)
.await
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "PaymentMethod",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "delete_by_payment_method_id",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_PaymentMethod_delete_by_merchant_id_payment_method_id | clm | method | // hyperswitch/crates/diesel_models/src/query/payment_method.rs
// impl for PaymentMethod
pub async fn delete_by_merchant_id_payment_method_id(
conn: &PgPooledConn,
merchant_id: &common_utils::id_type::MerchantId,
payment_method_id: &str,
) -> StorageResult<Self> {
generics::generic_delete_one_with_result::<<Self as HasTable>::Table, _, Self>(
conn,
dsl::merchant_id
.eq(merchant_id.to_owned())
.and(dsl::payment_method_id.eq(payment_method_id.to_owned())),
)
.await
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "PaymentMethod",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "delete_by_merchant_id_payment_method_id",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_PaymentMethod_find_by_locker_id | clm | method | // hyperswitch/crates/diesel_models/src/query/payment_method.rs
// impl for PaymentMethod
pub async fn find_by_locker_id(conn: &PgPooledConn, locker_id: &str) -> StorageResult<Self> {
generics::generic_find_one::<<Self as HasTable>::Table, _, _>(
conn,
dsl::locker_id.eq(locker_id.to_owned()),
)
.await
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "PaymentMethod",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "find_by_locker_id",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_PaymentMethod_find_by_payment_method_id | clm | method | // hyperswitch/crates/diesel_models/src/query/payment_method.rs
// impl for PaymentMethod
pub async fn find_by_payment_method_id(
conn: &PgPooledConn,
payment_method_id: &str,
) -> StorageResult<Self> {
generics::generic_find_one::<<Self as HasTable>::Table, _, _>(
conn,
dsl::payment_method_id.eq(payment_method_id.to_owned()),
)
.await
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "PaymentMethod",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "find_by_payment_method_id",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_PaymentMethod_find_by_merchant_id | clm | method | // hyperswitch/crates/diesel_models/src/query/payment_method.rs
// impl for PaymentMethod
pub async fn find_by_merchant_id(
conn: &PgPooledConn,
merchant_id: &common_utils::id_type::MerchantId,
) -> StorageResult<Vec<Self>> {
generics::generic_filter::<
<Self as HasTable>::Table,
_,
<<Self as HasTable>::Table as Table>::PrimaryKey,
_,
>(
conn,
dsl::merchant_id.eq(merchant_id.to_owned()),
None,
None,
None,
)
.await
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "PaymentMethod",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "find_by_merchant_id",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_PaymentMethod_find_by_customer_id_merchant_id | clm | method | // hyperswitch/crates/diesel_models/src/query/payment_method.rs
// impl for PaymentMethod
pub async fn find_by_customer_id_merchant_id(
conn: &PgPooledConn,
customer_id: &common_utils::id_type::CustomerId,
merchant_id: &common_utils::id_type::MerchantId,
limit: Option<i64>,
) -> StorageResult<Vec<Self>> {
generics::generic_filter::<<Self as HasTable>::Table, _, _, _>(
conn,
dsl::customer_id
.eq(customer_id.to_owned())
.and(dsl::merchant_id.eq(merchant_id.to_owned())),
limit,
None,
Some(dsl::last_used_at.desc()),
)
.await
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "PaymentMethod",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "find_by_customer_id_merchant_id",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_PaymentMethod_get_count_by_customer_id_merchant_id_status | clm | method | // hyperswitch/crates/diesel_models/src/query/payment_method.rs
// impl for PaymentMethod
pub async fn get_count_by_customer_id_merchant_id_status(
conn: &PgPooledConn,
customer_id: &common_utils::id_type::CustomerId,
merchant_id: &common_utils::id_type::MerchantId,
status: common_enums::PaymentMethodStatus,
) -> StorageResult<i64> {
let filter = <Self as HasTable>::table()
.count()
.filter(
dsl::customer_id
.eq(customer_id.to_owned())
.and(dsl::merchant_id.eq(merchant_id.to_owned()))
.and(dsl::status.eq(status.to_owned())),
)
.into_boxed();
router_env::logger::debug!(query = %debug_query::<Pg, _>(&filter).to_string());
generics::db_metrics::track_database_call::<<Self as HasTable>::Table, _, _>(
filter.get_result_async::<i64>(conn),
generics::db_metrics::DatabaseOperation::Count,
)
.await
.change_context(errors::DatabaseError::Others)
.attach_printable("Failed to get a count of payment methods")
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "PaymentMethod",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "get_count_by_customer_id_merchant_id_status",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_PaymentMethod_get_count_by_merchant_id_status | clm | method | // hyperswitch/crates/diesel_models/src/query/payment_method.rs
// impl for PaymentMethod
pub async fn get_count_by_merchant_id_status(
conn: &PgPooledConn,
merchant_id: &common_utils::id_type::MerchantId,
status: common_enums::PaymentMethodStatus,
) -> StorageResult<i64> {
let query = <Self as HasTable>::table().count().filter(
dsl::merchant_id
.eq(merchant_id.to_owned())
.and(dsl::status.eq(status.to_owned())),
);
router_env::logger::debug!(query = %debug_query::<Pg, _>(&query).to_string());
generics::db_metrics::track_database_call::<<Self as HasTable>::Table, _, _>(
query.get_result_async::<i64>(conn),
generics::db_metrics::DatabaseOperation::Count,
)
.await
.change_context(errors::DatabaseError::Others)
.attach_printable("Failed to get a count of payment methods")
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "PaymentMethod",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "get_count_by_merchant_id_status",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_PaymentMethod_find_by_customer_id_merchant_id_status | clm | method | // hyperswitch/crates/diesel_models/src/query/payment_method.rs
// impl for PaymentMethod
pub async fn find_by_customer_id_merchant_id_status(
conn: &PgPooledConn,
customer_id: &common_utils::id_type::CustomerId,
merchant_id: &common_utils::id_type::MerchantId,
status: storage_enums::PaymentMethodStatus,
limit: Option<i64>,
) -> StorageResult<Vec<Self>> {
generics::generic_filter::<<Self as HasTable>::Table, _, _, _>(
conn,
dsl::customer_id
.eq(customer_id.to_owned())
.and(dsl::merchant_id.eq(merchant_id.to_owned()))
.and(dsl::status.eq(status)),
limit,
None,
Some(dsl::last_used_at.desc()),
)
.await
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "PaymentMethod",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "find_by_customer_id_merchant_id_status",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_PaymentMethod_update_with_payment_method_id | clm | method | // hyperswitch/crates/diesel_models/src/query/payment_method.rs
// impl for PaymentMethod
pub async fn update_with_payment_method_id(
self,
conn: &PgPooledConn,
payment_method: payment_method::PaymentMethodUpdateInternal,
) -> StorageResult<Self> {
match generics::generic_update_with_unique_predicate_get_result::<
<Self as HasTable>::Table,
_,
_,
_,
>(
conn,
dsl::payment_method_id.eq(self.payment_method_id.to_owned()),
payment_method,
)
.await
{
Err(error) => match error.current_context() {
errors::DatabaseError::NoFieldsToUpdate => Ok(self),
_ => Err(error),
},
result => result,
}
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "PaymentMethod",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "update_with_payment_method_id",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_PaymentMethod_get_count_by_merchant_id_status | clm | method | // hyperswitch/crates/diesel_models/src/query/payment_method.rs
// impl for PaymentMethod
pub async fn get_count_by_merchant_id_status(
conn: &PgPooledConn,
merchant_id: &common_utils::id_type::MerchantId,
status: common_enums::PaymentMethodStatus,
) -> StorageResult<i64> {
let query = <Self as HasTable>::table().count().filter(
dsl::merchant_id
.eq(merchant_id.to_owned())
.and(dsl::status.eq(status.to_owned())),
);
router_env::logger::debug!(query = %debug_query::<Pg, _>(&query).to_string());
generics::db_metrics::track_database_call::<<Self as HasTable>::Table, _, _>(
query.get_result_async::<i64>(conn),
generics::db_metrics::DatabaseOperation::Count,
)
.await
.change_context(errors::DatabaseError::Others)
.attach_printable("Failed to get a count of payment methods")
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "PaymentMethod",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "get_count_by_merchant_id_status",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"start_line": null,
"struct_name": null,
"total_crates": null,
"trait_name": null
} |
hyperswitch_method_diesel_models_PaymentMethod_find_by_id | clm | method | // hyperswitch/crates/diesel_models/src/query/payment_method.rs
// impl for PaymentMethod
pub async fn find_by_id(
conn: &PgPooledConn,
id: &common_utils::id_type::GlobalPaymentMethodId,
) -> StorageResult<Self> {
generics::generic_find_one::<<Self as HasTable>::Table, _, _>(conn, pm_id.eq(id.to_owned()))
.await
}
| {
"chunk": null,
"crate": "diesel_models",
"enum_name": null,
"file_size": null,
"for_type": "PaymentMethod",
"function_name": null,
"is_async": null,
"is_pub": null,
"lines": null,
"method_name": "find_by_id",
"num_enums": null,
"num_items": null,
"num_structs": null,
"repo": "hyperswitch",
"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.