diff --git "a/diffs/pr_10091/5310ef5/diff.json" "b/diffs/pr_10091/5310ef5/diff.json" new file mode 100644--- /dev/null +++ "b/diffs/pr_10091/5310ef5/diff.json" @@ -0,0 +1,1079 @@ +{ + "commit_sha": "5310ef5a4f9f5c89dda02707ea641fc7dde2f184", + "pr_number": 10091, + "rust_files": [ + "crates/hyperswitch_domain_models/src/router_request_types.rs", + "crates/router/src/core/payments/flows/complete_authorize_flow.rs", + "crates/router/src/core/payments/transformers.rs", + "crates/router/src/core/payments/types.rs", + "crates/router/src/core/unified_connector_service/transformers.rs" + ], + "diffs": [ + { + "id": "crates/router/src/core/unified_connector_service/transformers.rs::payments_grpc::AuthenticationData::function::foreign_try_from", + "file": "crates/router/src/core/unified_connector_service/transformers.rs", + "kind": "function_item", + "status": "modified", + "code_changed": true, + "imports_changed": true, + "before_code": "fn foreign_try_from(authentication_data: AuthenticationData) -> Result {\n let cavv = if authentication_data.cavv.peek().is_empty() {\n None\n } else {\n Some(authentication_data.cavv.expose().to_string())\n };\n Ok(Self {\n eci: authentication_data.eci,\n cavv,\n threeds_server_transaction_id: authentication_data.threeds_server_transaction_id.map(\n |id| Identifier {\n id_type: Some(payments_grpc::identifier::IdType::Id(id)),\n },\n ),\n message_version: authentication_data\n .message_version\n .map(|message_version| message_version.to_string()),\n ds_transaction_id: authentication_data.ds_trans_id,\n trans_status: authentication_data\n .trans_status\n .map(payments_grpc::TransactionStatus::foreign_from)\n .map(i32::from),\n acs_transaction_id: authentication_data.acs_trans_id,\n transaction_id: authentication_data.transaction_id,\n ucaf_collection_indicator: authentication_data.ucaf_collection_indicator,\n })\n }", + "after_code": "fn foreign_try_from(\n authentication_data: router_request_types::UcsAuthenticationData,\n ) -> Result {\n Ok(Self {\n eci: authentication_data.eci,\n cavv: authentication_data.cavv.map(ExposeInterface::expose),\n threeds_server_transaction_id: authentication_data.threeds_server_transaction_id.map(\n |id| Identifier {\n id_type: Some(payments_grpc::identifier::IdType::Id(id)),\n },\n ),\n message_version: authentication_data\n .message_version\n .map(|message_version| message_version.to_string()),\n ds_transaction_id: authentication_data.ds_trans_id,\n trans_status: authentication_data\n .trans_status\n .map(payments_grpc::TransactionStatus::foreign_from)\n .map(i32::from),\n acs_transaction_id: authentication_data.acs_trans_id,\n transaction_id: authentication_data.transaction_id,\n ucaf_collection_indicator: authentication_data.ucaf_collection_indicator,\n })\n }", + "diff_span": { + "before": "fn foreign_try_from(authentication_data: AuthenticationData) -> Result {\n let cavv = if authentication_data.cavv.peek().is_empty() {\n None\n } else {\n Some(authentication_data.cavv.expose().to_string())\n };\n Ok(Self {\n eci: authentication_data.eci,\n cavv,\n threeds_server_transaction_id: authentication_data.threeds_server_transaction_id.map(\n |id| Identifier {", + "after": "fn foreign_try_from(\n authentication_data: router_request_types::UcsAuthenticationData,\n ) -> Result {\n Ok(Self {\n eci: authentication_data.eci,\n cavv: authentication_data.cavv.map(ExposeInterface::expose),\n threeds_server_transaction_id: authentication_data.threeds_server_transaction_id.map(\n |id| Identifier {" + }, + "commit_sha": "5310ef5a4f9f5c89dda02707ea641fc7dde2f184", + "before_imports": [ + "use unified_connector_service_client::payments::{\n self as payments_grpc, ConnectorState, Identifier, PaymentServiceTransformRequest,\n PaymentServiceTransformResponse,\n};", + "use hyperswitch_domain_models::{\n router_data::{AccessToken, ErrorResponse, RouterData},\n router_flow_types::{\n payments::{Authorize, Capture, PSync, SetupMandate},\n refunds::{Execute, RSync},\n unified_authentication_service as uas_flows, ExternalVaultProxy,\n },\n router_request_types::{\n self, AuthenticationData, ExternalVaultProxyPaymentsData, PaymentsAuthorizeData,\n PaymentsCancelData, PaymentsCaptureData, PaymentsSyncData, RefundsData,\n SetupMandateRequestData,\n },\n router_response_types::{PaymentsResponseData, RedirectForm, RefundsResponseData},\n};", + "use crate::{\n core::{errors, unified_connector_service},\n types::{\n api,\n transformers::{self, ForeignFrom},\n },\n};" + ], + "after_imports": [ + "use masking::{ExposeInterface, PeekInterface};", + "use crate::{\n core::{errors, unified_connector_service},\n types::{\n api,\n transformers::{self, ForeignFrom},\n },\n};", + "use hyperswitch_domain_models::{\n router_data::{AccessToken, ErrorResponse, RouterData},\n router_flow_types::{\n payments::{Authorize, Capture, PSync, SetupMandate},\n refunds::{Execute, RSync},\n unified_authentication_service as uas_flows, ExternalVaultProxy,\n },\n router_request_types::{\n self, AuthenticationData, ExternalVaultProxyPaymentsData, PaymentsAuthorizeData,\n PaymentsCancelData, PaymentsCaptureData, PaymentsSyncData, RefundsData,\n SetupMandateRequestData,\n },\n router_response_types::{PaymentsResponseData, RedirectForm, RefundsResponseData},\n};", + "use unified_connector_service_client::payments::{\n self as payments_grpc, ConnectorState, Identifier, PaymentServiceTransformRequest,\n PaymentServiceTransformResponse,\n};" + ] + }, + { + "id": "crates/router/src/core/payments/flows/complete_authorize_flow.rs::function::call_unified_connector_service_post_authenticate", + "file": "crates/router/src/core/payments/flows/complete_authorize_flow.rs", + "kind": "function_item", + "status": "modified", + "code_changed": true, + "imports_changed": false, + "before_code": "async fn call_unified_connector_service_post_authenticate(\n router_data: &mut types::RouterData<\n api::PostAuthenticate,\n types::PaymentsPostAuthenticateData,\n types::PaymentsResponseData,\n >,\n state: &SessionState,\n header_payload: &hyperswitch_domain_models::payments::HeaderPayload,\n lineage_ids: grpc_client::LineageIds,\n #[cfg(feature = \"v1\")] merchant_connector_account: helpers::MerchantConnectorAccountType,\n #[cfg(feature = \"v2\")] merchant_connector_account: domain::MerchantConnectorAccountTypeDetails,\n merchant_context: &domain::MerchantContext,\n unified_connector_service_execution_mode: common_enums::ExecutionMode,\n merchant_order_reference_id: Option,\n) -> RouterResult> {\n let client = state\n .grpc_client\n .unified_connector_service_client\n .clone()\n .ok_or(ApiErrorResponse::InternalServerError)\n .attach_printable(\"Failed to fetch Unified Connector Service client\")?;\n\n let payment_post_authenticate_request =\n payments_grpc::PaymentServicePostAuthenticateRequest::foreign_try_from(&*router_data)\n .change_context(ApiErrorResponse::InternalServerError)\n .attach_printable(\"Failed to construct Payment Authorize Request\")?;\n\n let connector_auth_metadata = ucs_core::build_unified_connector_service_auth_metadata(\n merchant_connector_account,\n merchant_context,\n )\n .change_context(ApiErrorResponse::InternalServerError)\n .attach_printable(\"Failed to construct request metadata\")?;\n let merchant_reference_id = header_payload\n .x_reference_id\n .clone()\n .or(merchant_order_reference_id)\n .map(|id| id_type::PaymentReferenceId::from_str(id.as_str()))\n .transpose()\n .inspect_err(|err| logger::warn!(error=?err, \"Invalid Merchant ReferenceId found\"))\n .ok()\n .flatten()\n .map(ucs_types::UcsReferenceId::Payment);\n let headers_builder = state\n .get_grpc_headers_ucs(unified_connector_service_execution_mode)\n .external_vault_proxy_metadata(None)\n .merchant_reference_id(merchant_reference_id)\n .lineage_ids(lineage_ids);\n let (updated_router_data, authentication_data) = Box::pin(ucs_core::ucs_logging_wrapper(\n router_data.clone(),\n state,\n payment_post_authenticate_request,\n headers_builder,\n |mut router_data, payment_post_authenticate_request, grpc_headers| async move {\n let response = client\n .payment_post_authenticate(\n payment_post_authenticate_request,\n connector_auth_metadata,\n grpc_headers,\n )\n .await\n .change_context(ApiErrorResponse::InternalServerError)\n .attach_printable(\"Failed to authorize payment\")?;\n\n let payment_post_authenticate_response = response.into_inner();\n\n let (router_data_response, status_code) =\n ucs_core::handle_unified_connector_service_response_for_payment_post_authenticate(\n payment_post_authenticate_response.clone(),\n )\n .change_context(ApiErrorResponse::InternalServerError)\n .attach_printable(\"Failed to deserialize UCS response\")?;\n\n let router_data_response = router_data_response.map(|(response, status)| {\n router_data.status = status;\n response\n });\n router_data.response = router_data_response;\n router_data.raw_connector_response = payment_post_authenticate_response\n .raw_connector_response\n .clone()\n .map(|raw_connector_response| raw_connector_response.expose().into());\n router_data.connector_http_status_code = Some(status_code);\n\n let domain_authentication_data = payment_post_authenticate_response\n .authentication_data\n .clone()\n .map(|grpc_authentication_data| {\n router_request_types::AuthenticationData::foreign_try_from(\n grpc_authentication_data,\n )\n })\n .transpose()\n .change_context(ApiErrorResponse::InternalServerError)\n .attach_printable(\"Failed to Convert to domain AuthenticationData\")?;\n\n Ok((\n router_data,\n domain_authentication_data,\n payment_post_authenticate_response,\n ))\n },\n ))\n .await?;\n\n // Copy back the updated data\n *router_data = updated_router_data;\n Ok(authentication_data)\n}", + "after_code": "async fn call_unified_connector_service_post_authenticate(\n router_data: &mut types::RouterData<\n api::PostAuthenticate,\n types::PaymentsPostAuthenticateData,\n types::PaymentsResponseData,\n >,\n state: &SessionState,\n header_payload: &hyperswitch_domain_models::payments::HeaderPayload,\n lineage_ids: grpc_client::LineageIds,\n #[cfg(feature = \"v1\")] merchant_connector_account: helpers::MerchantConnectorAccountType,\n #[cfg(feature = \"v2\")] merchant_connector_account: domain::MerchantConnectorAccountTypeDetails,\n merchant_context: &domain::MerchantContext,\n unified_connector_service_execution_mode: common_enums::ExecutionMode,\n merchant_order_reference_id: Option,\n) -> RouterResult> {\n let client = state\n .grpc_client\n .unified_connector_service_client\n .clone()\n .ok_or(ApiErrorResponse::InternalServerError)\n .attach_printable(\"Failed to fetch Unified Connector Service client\")?;\n\n let payment_post_authenticate_request =\n payments_grpc::PaymentServicePostAuthenticateRequest::foreign_try_from(&*router_data)\n .change_context(ApiErrorResponse::InternalServerError)\n .attach_printable(\"Failed to construct Payment Authorize Request\")?;\n\n let connector_auth_metadata = ucs_core::build_unified_connector_service_auth_metadata(\n merchant_connector_account,\n merchant_context,\n )\n .change_context(ApiErrorResponse::InternalServerError)\n .attach_printable(\"Failed to construct request metadata\")?;\n let merchant_reference_id = header_payload\n .x_reference_id\n .clone()\n .or(merchant_order_reference_id)\n .map(|id| id_type::PaymentReferenceId::from_str(id.as_str()))\n .transpose()\n .inspect_err(|err| logger::warn!(error=?err, \"Invalid Merchant ReferenceId found\"))\n .ok()\n .flatten()\n .map(ucs_types::UcsReferenceId::Payment);\n let headers_builder = state\n .get_grpc_headers_ucs(unified_connector_service_execution_mode)\n .external_vault_proxy_metadata(None)\n .merchant_reference_id(merchant_reference_id)\n .lineage_ids(lineage_ids);\n let (updated_router_data, authentication_data) = Box::pin(ucs_core::ucs_logging_wrapper(\n router_data.clone(),\n state,\n payment_post_authenticate_request,\n headers_builder,\n |mut router_data, payment_post_authenticate_request, grpc_headers| async move {\n let response = client\n .payment_post_authenticate(\n payment_post_authenticate_request,\n connector_auth_metadata,\n grpc_headers,\n )\n .await\n .change_context(ApiErrorResponse::InternalServerError)\n .attach_printable(\"Failed to authorize payment\")?;\n\n let payment_post_authenticate_response = response.into_inner();\n\n let (router_data_response, status_code) =\n ucs_core::handle_unified_connector_service_response_for_payment_post_authenticate(\n payment_post_authenticate_response.clone(),\n )\n .change_context(ApiErrorResponse::InternalServerError)\n .attach_printable(\"Failed to deserialize UCS response\")?;\n\n let router_data_response = router_data_response.map(|(response, status)| {\n router_data.status = status;\n response\n });\n router_data.response = router_data_response;\n router_data.raw_connector_response = payment_post_authenticate_response\n .raw_connector_response\n .clone()\n .map(|raw_connector_response| raw_connector_response.expose().into());\n router_data.connector_http_status_code = Some(status_code);\n\n let domain_authentication_data = payment_post_authenticate_response\n .authentication_data\n .clone()\n .map(|grpc_authentication_data| {\n router_request_types::UcsAuthenticationData::foreign_try_from(\n grpc_authentication_data,\n )\n })\n .transpose()\n .change_context(ApiErrorResponse::InternalServerError)\n .attach_printable(\"Failed to Convert to domain AuthenticationData\")?;\n\n Ok((\n router_data,\n domain_authentication_data,\n payment_post_authenticate_response,\n ))\n },\n ))\n .await?;\n\n // Copy back the updated data\n *router_data = updated_router_data;\n Ok(authentication_data)\n}", + "diff_span": { + "before": " unified_connector_service_execution_mode: common_enums::ExecutionMode,\n merchant_order_reference_id: Option,\n) -> RouterResult> {\n let client = state\n .grpc_client\n .unified_connector_service_client\n .clone()\n .ok_or(ApiErrorResponse::InternalServerError)\n .attach_printable(\"Failed to fetch Unified Connector Service client\")?;\n\n let payment_post_authenticate_request =\n payments_grpc::PaymentServicePostAuthenticateRequest::foreign_try_from(&*router_data)\n .change_context(ApiErrorResponse::InternalServerError)\n .attach_printable(\"Failed to construct Payment Authorize Request\")?;\n\n let connector_auth_metadata = ucs_core::build_unified_connector_service_auth_metadata(\n merchant_connector_account,\n merchant_context,\n )\n .change_context(ApiErrorResponse::InternalServerError)\n .attach_printable(\"Failed to construct request metadata\")?;\n let merchant_reference_id = header_payload\n .x_reference_id\n .clone()\n .or(merchant_order_reference_id)\n .map(|id| id_type::PaymentReferenceId::from_str(id.as_str()))\n .transpose()\n .inspect_err(|err| logger::warn!(error=?err, \"Invalid Merchant ReferenceId found\"))\n .ok()\n .flatten()\n .map(ucs_types::UcsReferenceId::Payment);\n let headers_builder = state\n .get_grpc_headers_ucs(unified_connector_service_execution_mode)\n .external_vault_proxy_metadata(None)\n .merchant_reference_id(merchant_reference_id)\n .lineage_ids(lineage_ids);\n let (updated_router_data, authentication_data) = Box::pin(ucs_core::ucs_logging_wrapper(\n router_data.clone(),\n state,\n payment_post_authenticate_request,\n headers_builder,\n |mut router_data, payment_post_authenticate_request, grpc_headers| async move {\n let response = client\n .payment_post_authenticate(\n payment_post_authenticate_request,\n connector_auth_metadata,\n grpc_headers,\n )\n .await\n .change_context(ApiErrorResponse::InternalServerError)\n .attach_printable(\"Failed to authorize payment\")?;\n\n let payment_post_authenticate_response = response.into_inner();\n\n let (router_data_response, status_code) =\n ucs_core::handle_unified_connector_service_response_for_payment_post_authenticate(\n payment_post_authenticate_response.clone(),\n )\n .change_context(ApiErrorResponse::InternalServerError)\n .attach_printable(\"Failed to deserialize UCS response\")?;\n\n let router_data_response = router_data_response.map(|(response, status)| {\n router_data.status = status;\n response\n });\n router_data.response = router_data_response;\n router_data.raw_connector_response = payment_post_authenticate_response\n .raw_connector_response\n .clone()\n .map(|raw_connector_response| raw_connector_response.expose().into());\n router_data.connector_http_status_code = Some(status_code);\n\n let domain_authentication_data = payment_post_authenticate_response\n .authentication_data\n .clone()\n .map(|grpc_authentication_data| {\n router_request_types::AuthenticationData::foreign_try_from(\n grpc_authentication_data,\n )", + "after": " unified_connector_service_execution_mode: common_enums::ExecutionMode,\n merchant_order_reference_id: Option,\n) -> RouterResult> {\n let client = state\n .grpc_client\n .unified_connector_service_client\n .clone()\n .ok_or(ApiErrorResponse::InternalServerError)\n .attach_printable(\"Failed to fetch Unified Connector Service client\")?;\n\n let payment_post_authenticate_request =\n payments_grpc::PaymentServicePostAuthenticateRequest::foreign_try_from(&*router_data)\n .change_context(ApiErrorResponse::InternalServerError)\n .attach_printable(\"Failed to construct Payment Authorize Request\")?;\n\n let connector_auth_metadata = ucs_core::build_unified_connector_service_auth_metadata(\n merchant_connector_account,\n merchant_context,\n )\n .change_context(ApiErrorResponse::InternalServerError)\n .attach_printable(\"Failed to construct request metadata\")?;\n let merchant_reference_id = header_payload\n .x_reference_id\n .clone()\n .or(merchant_order_reference_id)\n .map(|id| id_type::PaymentReferenceId::from_str(id.as_str()))\n .transpose()\n .inspect_err(|err| logger::warn!(error=?err, \"Invalid Merchant ReferenceId found\"))\n .ok()\n .flatten()\n .map(ucs_types::UcsReferenceId::Payment);\n let headers_builder = state\n .get_grpc_headers_ucs(unified_connector_service_execution_mode)\n .external_vault_proxy_metadata(None)\n .merchant_reference_id(merchant_reference_id)\n .lineage_ids(lineage_ids);\n let (updated_router_data, authentication_data) = Box::pin(ucs_core::ucs_logging_wrapper(\n router_data.clone(),\n state,\n payment_post_authenticate_request,\n headers_builder,\n |mut router_data, payment_post_authenticate_request, grpc_headers| async move {\n let response = client\n .payment_post_authenticate(\n payment_post_authenticate_request,\n connector_auth_metadata,\n grpc_headers,\n )\n .await\n .change_context(ApiErrorResponse::InternalServerError)\n .attach_printable(\"Failed to authorize payment\")?;\n\n let payment_post_authenticate_response = response.into_inner();\n\n let (router_data_response, status_code) =\n ucs_core::handle_unified_connector_service_response_for_payment_post_authenticate(\n payment_post_authenticate_response.clone(),\n )\n .change_context(ApiErrorResponse::InternalServerError)\n .attach_printable(\"Failed to deserialize UCS response\")?;\n\n let router_data_response = router_data_response.map(|(response, status)| {\n router_data.status = status;\n response\n });\n router_data.response = router_data_response;\n router_data.raw_connector_response = payment_post_authenticate_response\n .raw_connector_response\n .clone()\n .map(|raw_connector_response| raw_connector_response.expose().into());\n router_data.connector_http_status_code = Some(status_code);\n\n let domain_authentication_data = payment_post_authenticate_response\n .authentication_data\n .clone()\n .map(|grpc_authentication_data| {\n router_request_types::UcsAuthenticationData::foreign_try_from(\n grpc_authentication_data,\n )" + }, + "commit_sha": "5310ef5a4f9f5c89dda02707ea641fc7dde2f184" + }, + { + "id": "crates/router/src/core/payments/types.rs::MultipleCaptureData::function::get_pending_captures", + "file": "crates/router/src/core/payments/types.rs", + "kind": "function_item", + "status": "modified", + "code_changed": false, + "imports_changed": true, + "before_code": "pub fn get_pending_captures(&self) -> Vec<&storage::Capture> {\n self.all_captures\n .iter()\n .filter(|capture| capture.1.status == storage_enums::CaptureStatus::Pending)\n .map(|key_value| key_value.1)\n .collect()\n }", + "after_code": "pub fn get_pending_captures(&self) -> Vec<&storage::Capture> {\n self.all_captures\n .iter()\n .filter(|capture| capture.1.status == storage_enums::CaptureStatus::Pending)\n .map(|key_value| key_value.1)\n .collect()\n }", + "diff_span": { + "before": "", + "after": "" + }, + "commit_sha": "5310ef5a4f9f5c89dda02707ea641fc7dde2f184", + "before_imports": [ + "use common_utils::{\n errors::CustomResult,\n ext_traits::{Encode, OptionExt},\n types::{self as common_types, ConnectorTransactionIdTrait},\n};", + "pub use hyperswitch_domain_models::router_request_types::{\n AuthenticationData, SplitRefundsRequest, StripeSplitRefund, SurchargeDetails,\n};" + ], + "after_imports": [ + "use common_utils::{\n errors::CustomResult,\n ext_traits::{Encode, OptionExt},\n types::{self as common_types, ConnectorTransactionIdTrait},\n};", + "pub use hyperswitch_domain_models::router_request_types::{\n self, AuthenticationData, SplitRefundsRequest, StripeSplitRefund, SurchargeDetails,\n};" + ] + }, + { + "id": "crates/router/src/core/payments/types.rs::impl::MultipleCaptureData", + "file": "crates/router/src/core/payments/types.rs", + "kind": "impl_item", + "status": "modified", + "code_changed": false, + "imports_changed": true, + "before_code": "impl MultipleCaptureData {\n pub fn new_for_sync(\n captures: Vec,\n expand_captures: Option,\n ) -> RouterResult {\n let latest_capture = captures\n .last()\n .ok_or(errors::ApiErrorResponse::InternalServerError)\n .attach_printable(\"Cannot create MultipleCaptureData with empty captures list\")?\n .clone();\n let multiple_capture_data = Self {\n all_captures: captures\n .into_iter()\n .map(|capture| (capture.capture_id.clone(), capture))\n .collect(),\n latest_capture,\n _private: Private {},\n expand_captures,\n };\n Ok(multiple_capture_data)\n }\n\n pub fn new_for_create(\n mut previous_captures: Vec,\n new_capture: storage::Capture,\n ) -> Self {\n previous_captures.push(new_capture.clone());\n Self {\n all_captures: previous_captures\n .into_iter()\n .map(|capture| (capture.capture_id.clone(), capture))\n .collect(),\n latest_capture: new_capture,\n _private: Private {},\n expand_captures: None,\n }\n }\n\n pub fn update_capture(&mut self, updated_capture: storage::Capture) {\n let capture_id = &updated_capture.capture_id;\n if self.all_captures.contains_key(capture_id) {\n self.all_captures\n .entry(capture_id.into())\n .and_modify(|capture| *capture = updated_capture.clone());\n }\n }\n pub fn get_total_blocked_amount(&self) -> common_types::MinorUnit {\n self.all_captures\n .iter()\n .fold(common_types::MinorUnit::new(0), |accumulator, capture| {\n accumulator\n + match capture.1.status {\n storage_enums::CaptureStatus::Charged\n | storage_enums::CaptureStatus::Pending => capture.1.amount,\n storage_enums::CaptureStatus::Started\n | storage_enums::CaptureStatus::Failed => common_types::MinorUnit::new(0),\n }\n })\n }\n pub fn get_total_charged_amount(&self) -> common_types::MinorUnit {\n self.all_captures\n .iter()\n .fold(common_types::MinorUnit::new(0), |accumulator, capture| {\n accumulator\n + match capture.1.status {\n storage_enums::CaptureStatus::Charged => capture.1.amount,\n storage_enums::CaptureStatus::Pending\n | storage_enums::CaptureStatus::Started\n | storage_enums::CaptureStatus::Failed => common_types::MinorUnit::new(0),\n }\n })\n }\n pub fn get_captures_count(&self) -> RouterResult {\n i16::try_from(self.all_captures.len())\n .change_context(errors::ApiErrorResponse::InternalServerError)\n .attach_printable(\"Error while converting from usize to i16\")\n }\n pub fn get_status_count(&self) -> HashMap {\n let mut hash_map: HashMap = HashMap::new();\n hash_map.insert(storage_enums::CaptureStatus::Charged, 0);\n hash_map.insert(storage_enums::CaptureStatus::Pending, 0);\n hash_map.insert(storage_enums::CaptureStatus::Started, 0);\n hash_map.insert(storage_enums::CaptureStatus::Failed, 0);\n self.all_captures\n .iter()\n .fold(hash_map, |mut accumulator, capture| {\n let current_capture_status = capture.1.status;\n accumulator\n .entry(current_capture_status)\n .and_modify(|count| *count += 1);\n accumulator\n })\n }\n pub fn get_attempt_status(\n &self,\n authorized_amount: common_types::MinorUnit,\n ) -> storage_enums::AttemptStatus {\n let total_captured_amount = self.get_total_charged_amount();\n if authorized_amount == total_captured_amount {\n return storage_enums::AttemptStatus::Charged;\n }\n let status_count_map = self.get_status_count();\n if status_count_map.get(&storage_enums::CaptureStatus::Charged) > Some(&0) {\n storage_enums::AttemptStatus::PartialChargedAndChargeable\n } else {\n storage_enums::AttemptStatus::CaptureInitiated\n }\n }\n pub fn get_pending_captures(&self) -> Vec<&storage::Capture> {\n self.all_captures\n .iter()\n .filter(|capture| capture.1.status == storage_enums::CaptureStatus::Pending)\n .map(|key_value| key_value.1)\n .collect()\n }\n pub fn get_all_captures(&self) -> Vec<&storage::Capture> {\n self.all_captures\n .iter()\n .map(|key_value| key_value.1)\n .collect()\n }\n pub fn get_capture_by_capture_id(&self, capture_id: String) -> Option<&storage::Capture> {\n self.all_captures.get(&capture_id)\n }\n pub fn get_capture_by_connector_capture_id(\n &self,\n connector_capture_id: &String,\n ) -> Option<&storage::Capture> {\n self.all_captures\n .iter()\n .find(|(_, capture)| {\n capture.get_optional_connector_transaction_id() == Some(connector_capture_id)\n })\n .map(|(_, capture)| capture)\n }\n pub fn get_latest_capture(&self) -> &storage::Capture {\n &self.latest_capture\n }\n pub fn get_pending_connector_capture_ids(&self) -> Vec {\n let pending_connector_capture_ids = self\n .get_pending_captures()\n .into_iter()\n .filter_map(|capture| capture.get_optional_connector_transaction_id().cloned())\n .collect();\n pending_connector_capture_ids\n }\n pub fn get_pending_captures_without_connector_capture_id(&self) -> Vec<&storage::Capture> {\n self.get_pending_captures()\n .into_iter()\n .filter(|capture| capture.get_optional_connector_transaction_id().is_none())\n .collect()\n }\n}", + "after_code": "impl MultipleCaptureData {\n pub fn new_for_sync(\n captures: Vec,\n expand_captures: Option,\n ) -> RouterResult {\n let latest_capture = captures\n .last()\n .ok_or(errors::ApiErrorResponse::InternalServerError)\n .attach_printable(\"Cannot create MultipleCaptureData with empty captures list\")?\n .clone();\n let multiple_capture_data = Self {\n all_captures: captures\n .into_iter()\n .map(|capture| (capture.capture_id.clone(), capture))\n .collect(),\n latest_capture,\n _private: Private {},\n expand_captures,\n };\n Ok(multiple_capture_data)\n }\n\n pub fn new_for_create(\n mut previous_captures: Vec,\n new_capture: storage::Capture,\n ) -> Self {\n previous_captures.push(new_capture.clone());\n Self {\n all_captures: previous_captures\n .into_iter()\n .map(|capture| (capture.capture_id.clone(), capture))\n .collect(),\n latest_capture: new_capture,\n _private: Private {},\n expand_captures: None,\n }\n }\n\n pub fn update_capture(&mut self, updated_capture: storage::Capture) {\n let capture_id = &updated_capture.capture_id;\n if self.all_captures.contains_key(capture_id) {\n self.all_captures\n .entry(capture_id.into())\n .and_modify(|capture| *capture = updated_capture.clone());\n }\n }\n pub fn get_total_blocked_amount(&self) -> common_types::MinorUnit {\n self.all_captures\n .iter()\n .fold(common_types::MinorUnit::new(0), |accumulator, capture| {\n accumulator\n + match capture.1.status {\n storage_enums::CaptureStatus::Charged\n | storage_enums::CaptureStatus::Pending => capture.1.amount,\n storage_enums::CaptureStatus::Started\n | storage_enums::CaptureStatus::Failed => common_types::MinorUnit::new(0),\n }\n })\n }\n pub fn get_total_charged_amount(&self) -> common_types::MinorUnit {\n self.all_captures\n .iter()\n .fold(common_types::MinorUnit::new(0), |accumulator, capture| {\n accumulator\n + match capture.1.status {\n storage_enums::CaptureStatus::Charged => capture.1.amount,\n storage_enums::CaptureStatus::Pending\n | storage_enums::CaptureStatus::Started\n | storage_enums::CaptureStatus::Failed => common_types::MinorUnit::new(0),\n }\n })\n }\n pub fn get_captures_count(&self) -> RouterResult {\n i16::try_from(self.all_captures.len())\n .change_context(errors::ApiErrorResponse::InternalServerError)\n .attach_printable(\"Error while converting from usize to i16\")\n }\n pub fn get_status_count(&self) -> HashMap {\n let mut hash_map: HashMap = HashMap::new();\n hash_map.insert(storage_enums::CaptureStatus::Charged, 0);\n hash_map.insert(storage_enums::CaptureStatus::Pending, 0);\n hash_map.insert(storage_enums::CaptureStatus::Started, 0);\n hash_map.insert(storage_enums::CaptureStatus::Failed, 0);\n self.all_captures\n .iter()\n .fold(hash_map, |mut accumulator, capture| {\n let current_capture_status = capture.1.status;\n accumulator\n .entry(current_capture_status)\n .and_modify(|count| *count += 1);\n accumulator\n })\n }\n pub fn get_attempt_status(\n &self,\n authorized_amount: common_types::MinorUnit,\n ) -> storage_enums::AttemptStatus {\n let total_captured_amount = self.get_total_charged_amount();\n if authorized_amount == total_captured_amount {\n return storage_enums::AttemptStatus::Charged;\n }\n let status_count_map = self.get_status_count();\n if status_count_map.get(&storage_enums::CaptureStatus::Charged) > Some(&0) {\n storage_enums::AttemptStatus::PartialChargedAndChargeable\n } else {\n storage_enums::AttemptStatus::CaptureInitiated\n }\n }\n pub fn get_pending_captures(&self) -> Vec<&storage::Capture> {\n self.all_captures\n .iter()\n .filter(|capture| capture.1.status == storage_enums::CaptureStatus::Pending)\n .map(|key_value| key_value.1)\n .collect()\n }\n pub fn get_all_captures(&self) -> Vec<&storage::Capture> {\n self.all_captures\n .iter()\n .map(|key_value| key_value.1)\n .collect()\n }\n pub fn get_capture_by_capture_id(&self, capture_id: String) -> Option<&storage::Capture> {\n self.all_captures.get(&capture_id)\n }\n pub fn get_capture_by_connector_capture_id(\n &self,\n connector_capture_id: &String,\n ) -> Option<&storage::Capture> {\n self.all_captures\n .iter()\n .find(|(_, capture)| {\n capture.get_optional_connector_transaction_id() == Some(connector_capture_id)\n })\n .map(|(_, capture)| capture)\n }\n pub fn get_latest_capture(&self) -> &storage::Capture {\n &self.latest_capture\n }\n pub fn get_pending_connector_capture_ids(&self) -> Vec {\n let pending_connector_capture_ids = self\n .get_pending_captures()\n .into_iter()\n .filter_map(|capture| capture.get_optional_connector_transaction_id().cloned())\n .collect();\n pending_connector_capture_ids\n }\n pub fn get_pending_captures_without_connector_capture_id(&self) -> Vec<&storage::Capture> {\n self.get_pending_captures()\n .into_iter()\n .filter(|capture| capture.get_optional_connector_transaction_id().is_none())\n .collect()\n }\n}", + "diff_span": { + "before": "", + "after": "" + }, + "commit_sha": "5310ef5a4f9f5c89dda02707ea641fc7dde2f184", + "before_imports": [ + "use common_utils::{\n errors::CustomResult,\n ext_traits::{Encode, OptionExt},\n types::{self as common_types, ConnectorTransactionIdTrait},\n};", + "pub use hyperswitch_domain_models::router_request_types::{\n AuthenticationData, SplitRefundsRequest, StripeSplitRefund, SurchargeDetails,\n};" + ], + "after_imports": [ + "use common_utils::{\n errors::CustomResult,\n ext_traits::{Encode, OptionExt},\n types::{self as common_types, ConnectorTransactionIdTrait},\n};", + "pub use hyperswitch_domain_models::router_request_types::{\n self, AuthenticationData, SplitRefundsRequest, StripeSplitRefund, SurchargeDetails,\n};" + ] + }, + { + "id": "crates/router/src/core/payments/types.rs::SurchargeMetadata::function::is_empty_result", + "file": "crates/router/src/core/payments/types.rs", + "kind": "function_item", + "status": "modified", + "code_changed": false, + "imports_changed": true, + "before_code": "pub fn is_empty_result(&self) -> bool {\n self.surcharge_results.is_empty()\n }", + "after_code": "pub fn is_empty_result(&self) -> bool {\n self.surcharge_results.is_empty()\n }", + "diff_span": { + "before": "", + "after": "" + }, + "commit_sha": "5310ef5a4f9f5c89dda02707ea641fc7dde2f184", + "before_imports": [ + "use common_utils::{\n errors::CustomResult,\n ext_traits::{Encode, OptionExt},\n types::{self as common_types, ConnectorTransactionIdTrait},\n};", + "pub use hyperswitch_domain_models::router_request_types::{\n AuthenticationData, SplitRefundsRequest, StripeSplitRefund, SurchargeDetails,\n};" + ], + "after_imports": [ + "use common_utils::{\n errors::CustomResult,\n ext_traits::{Encode, OptionExt},\n types::{self as common_types, ConnectorTransactionIdTrait},\n};", + "pub use hyperswitch_domain_models::router_request_types::{\n self, AuthenticationData, SplitRefundsRequest, StripeSplitRefund, SurchargeDetails,\n};" + ] + }, + { + "id": "crates/router/src/core/payments/types.rs::SurchargeMetadata::function::get_individual_surcharge_detail_from_redis", + "file": "crates/router/src/core/payments/types.rs", + "kind": "function_item", + "status": "modified", + "code_changed": false, + "imports_changed": true, + "before_code": "pub async fn get_individual_surcharge_detail_from_redis(\n state: &SessionState,\n surcharge_key: SurchargeKey,\n payment_attempt_id: &str,\n ) -> CustomResult {\n let redis_conn = state\n .store\n .get_redis_conn()\n .attach_printable(\"Failed to get redis connection\")?;\n let redis_key = Self::get_surcharge_metadata_redis_key(payment_attempt_id);\n let value_key = Self::get_surcharge_details_redis_hashset_key(&surcharge_key);\n let result = redis_conn\n .get_hash_field_and_deserialize(\n &redis_key.as_str().into(),\n &value_key,\n \"SurchargeDetails\",\n )\n .await;\n logger::debug!(\n \"Surcharge result fetched from redis with key = {} and {}\",\n redis_key,\n value_key\n );\n result\n }", + "after_code": "pub async fn get_individual_surcharge_detail_from_redis(\n state: &SessionState,\n surcharge_key: SurchargeKey,\n payment_attempt_id: &str,\n ) -> CustomResult {\n let redis_conn = state\n .store\n .get_redis_conn()\n .attach_printable(\"Failed to get redis connection\")?;\n let redis_key = Self::get_surcharge_metadata_redis_key(payment_attempt_id);\n let value_key = Self::get_surcharge_details_redis_hashset_key(&surcharge_key);\n let result = redis_conn\n .get_hash_field_and_deserialize(\n &redis_key.as_str().into(),\n &value_key,\n \"SurchargeDetails\",\n )\n .await;\n logger::debug!(\n \"Surcharge result fetched from redis with key = {} and {}\",\n redis_key,\n value_key\n );\n result\n }", + "diff_span": { + "before": "", + "after": "" + }, + "commit_sha": "5310ef5a4f9f5c89dda02707ea641fc7dde2f184", + "before_imports": [ + "use common_utils::{\n errors::CustomResult,\n ext_traits::{Encode, OptionExt},\n types::{self as common_types, ConnectorTransactionIdTrait},\n};", + "use redis_interface::errors::RedisError;", + "pub use hyperswitch_domain_models::router_request_types::{\n AuthenticationData, SplitRefundsRequest, StripeSplitRefund, SurchargeDetails,\n};", + "use router_env::{instrument, logger, tracing};" + ], + "after_imports": [ + "use common_utils::{\n errors::CustomResult,\n ext_traits::{Encode, OptionExt},\n types::{self as common_types, ConnectorTransactionIdTrait},\n};", + "use router_env::{instrument, logger, tracing};", + "pub use hyperswitch_domain_models::router_request_types::{\n self, AuthenticationData, SplitRefundsRequest, StripeSplitRefund, SurchargeDetails,\n};", + "use redis_interface::errors::RedisError;" + ] + }, + { + "id": "crates/router/src/core/payments/types.rs::MultipleCaptureData::function::get_total_blocked_amount", + "file": "crates/router/src/core/payments/types.rs", + "kind": "function_item", + "status": "modified", + "code_changed": false, + "imports_changed": true, + "before_code": "pub fn get_total_blocked_amount(&self) -> common_types::MinorUnit {\n self.all_captures\n .iter()\n .fold(common_types::MinorUnit::new(0), |accumulator, capture| {\n accumulator\n + match capture.1.status {\n storage_enums::CaptureStatus::Charged\n | storage_enums::CaptureStatus::Pending => capture.1.amount,\n storage_enums::CaptureStatus::Started\n | storage_enums::CaptureStatus::Failed => common_types::MinorUnit::new(0),\n }\n })\n }", + "after_code": "pub fn get_total_blocked_amount(&self) -> common_types::MinorUnit {\n self.all_captures\n .iter()\n .fold(common_types::MinorUnit::new(0), |accumulator, capture| {\n accumulator\n + match capture.1.status {\n storage_enums::CaptureStatus::Charged\n | storage_enums::CaptureStatus::Pending => capture.1.amount,\n storage_enums::CaptureStatus::Started\n | storage_enums::CaptureStatus::Failed => common_types::MinorUnit::new(0),\n }\n })\n }", + "diff_span": { + "before": "", + "after": "" + }, + "commit_sha": "5310ef5a4f9f5c89dda02707ea641fc7dde2f184", + "before_imports": [ + "use common_utils::{\n errors::CustomResult,\n ext_traits::{Encode, OptionExt},\n types::{self as common_types, ConnectorTransactionIdTrait},\n};", + "pub use hyperswitch_domain_models::router_request_types::{\n AuthenticationData, SplitRefundsRequest, StripeSplitRefund, SurchargeDetails,\n};" + ], + "after_imports": [ + "use common_utils::{\n errors::CustomResult,\n ext_traits::{Encode, OptionExt},\n types::{self as common_types, ConnectorTransactionIdTrait},\n};", + "pub use hyperswitch_domain_models::router_request_types::{\n self, AuthenticationData, SplitRefundsRequest, StripeSplitRefund, SurchargeDetails,\n};" + ] + }, + { + "id": "crates/router/src/core/payments/types.rs::SurchargeMetadata::function::get_surcharge_details", + "file": "crates/router/src/core/payments/types.rs", + "kind": "function_item", + "status": "modified", + "code_changed": false, + "imports_changed": true, + "before_code": "pub fn get_surcharge_details(&self, surcharge_key: SurchargeKey) -> Option<&SurchargeDetails> {\n self.surcharge_results.get(&surcharge_key)\n }", + "after_code": "pub fn get_surcharge_details(&self, surcharge_key: SurchargeKey) -> Option<&SurchargeDetails> {\n self.surcharge_results.get(&surcharge_key)\n }", + "diff_span": { + "before": "", + "after": "" + }, + "commit_sha": "5310ef5a4f9f5c89dda02707ea641fc7dde2f184", + "before_imports": [ + "use common_utils::{\n errors::CustomResult,\n ext_traits::{Encode, OptionExt},\n types::{self as common_types, ConnectorTransactionIdTrait},\n};", + "pub use hyperswitch_domain_models::router_request_types::{\n AuthenticationData, SplitRefundsRequest, StripeSplitRefund, SurchargeDetails,\n};" + ], + "after_imports": [ + "use common_utils::{\n errors::CustomResult,\n ext_traits::{Encode, OptionExt},\n types::{self as common_types, ConnectorTransactionIdTrait},\n};", + "pub use hyperswitch_domain_models::router_request_types::{\n self, AuthenticationData, SplitRefundsRequest, StripeSplitRefund, SurchargeDetails,\n};" + ] + }, + { + "id": "crates/router/src/core/payments/types.rs::enum::SurchargeKey", + "file": "crates/router/src/core/payments/types.rs", + "kind": "enum_item", + "status": "modified", + "code_changed": false, + "imports_changed": true, + "before_code": "pub enum SurchargeKey {\n Token(String),\n PaymentMethodData(\n common_enums::PaymentMethod,\n common_enums::PaymentMethodType,\n Option,\n ),\n}", + "after_code": "pub enum SurchargeKey {\n Token(String),\n PaymentMethodData(\n common_enums::PaymentMethod,\n common_enums::PaymentMethodType,\n Option,\n ),\n}", + "diff_span": { + "before": "", + "after": "" + }, + "commit_sha": "5310ef5a4f9f5c89dda02707ea641fc7dde2f184", + "before_imports": [ + "use common_utils::{\n errors::CustomResult,\n ext_traits::{Encode, OptionExt},\n types::{self as common_types, ConnectorTransactionIdTrait},\n};", + "pub use hyperswitch_domain_models::router_request_types::{\n AuthenticationData, SplitRefundsRequest, StripeSplitRefund, SurchargeDetails,\n};" + ], + "after_imports": [ + "use common_utils::{\n errors::CustomResult,\n ext_traits::{Encode, OptionExt},\n types::{self as common_types, ConnectorTransactionIdTrait},\n};", + "pub use hyperswitch_domain_models::router_request_types::{\n self, AuthenticationData, SplitRefundsRequest, StripeSplitRefund, SurchargeDetails,\n};" + ] + }, + { + "id": "crates/router/src/core/payments/types.rs::AuthenticationData::type::Error", + "file": "crates/router/src/core/payments/types.rs", + "kind": "type_item", + "status": "modified", + "code_changed": false, + "imports_changed": true, + "before_code": "type Error = error_stack::Report;", + "after_code": "type Error = error_stack::Report;", + "diff_span": { + "before": "", + "after": "" + }, + "commit_sha": "5310ef5a4f9f5c89dda02707ea641fc7dde2f184", + "before_imports": [ + "use common_utils::{\n errors::CustomResult,\n ext_traits::{Encode, OptionExt},\n types::{self as common_types, ConnectorTransactionIdTrait},\n};", + "pub use hyperswitch_domain_models::router_request_types::{\n AuthenticationData, SplitRefundsRequest, StripeSplitRefund, SurchargeDetails,\n};" + ], + "after_imports": [ + "use common_utils::{\n errors::CustomResult,\n ext_traits::{Encode, OptionExt},\n types::{self as common_types, ConnectorTransactionIdTrait},\n};", + "pub use hyperswitch_domain_models::router_request_types::{\n self, AuthenticationData, SplitRefundsRequest, StripeSplitRefund, SurchargeDetails,\n};" + ] + }, + { + "id": "crates/router/src/core/payments/types.rs::SurchargeMetadata::function::persist_individual_surcharge_details_in_redis", + "file": "crates/router/src/core/payments/types.rs", + "kind": "function_item", + "status": "modified", + "code_changed": false, + "imports_changed": true, + "before_code": "pub async fn persist_individual_surcharge_details_in_redis(\n &self,\n state: &SessionState,\n business_profile: &Profile,\n ) -> RouterResult<()> {\n if !self.is_empty_result() {\n let redis_conn = state\n .store\n .get_redis_conn()\n .change_context(errors::ApiErrorResponse::InternalServerError)\n .attach_printable(\"Failed to get redis connection\")?;\n let redis_key = Self::get_surcharge_metadata_redis_key(&self.payment_attempt_id);\n\n let mut value_list = Vec::with_capacity(self.get_surcharge_results_size());\n for (key, value) in self.get_individual_surcharge_key_value_pairs().into_iter() {\n value_list.push((\n key,\n value\n .encode_to_string_of_json()\n .change_context(errors::ApiErrorResponse::InternalServerError)\n .attach_printable(\"Failed to encode to string of json\")?,\n ));\n }\n let intent_fulfillment_time = business_profile\n .get_order_fulfillment_time()\n .unwrap_or(router_consts::DEFAULT_FULFILLMENT_TIME);\n redis_conn\n .set_hash_fields(\n &redis_key.as_str().into(),\n value_list,\n Some(intent_fulfillment_time),\n )\n .await\n .change_context(errors::ApiErrorResponse::InternalServerError)\n .attach_printable(\"Failed to write to redis\")?;\n logger::debug!(\"Surcharge results stored in redis with key = {}\", redis_key);\n }\n Ok(())\n }", + "after_code": "pub async fn persist_individual_surcharge_details_in_redis(\n &self,\n state: &SessionState,\n business_profile: &Profile,\n ) -> RouterResult<()> {\n if !self.is_empty_result() {\n let redis_conn = state\n .store\n .get_redis_conn()\n .change_context(errors::ApiErrorResponse::InternalServerError)\n .attach_printable(\"Failed to get redis connection\")?;\n let redis_key = Self::get_surcharge_metadata_redis_key(&self.payment_attempt_id);\n\n let mut value_list = Vec::with_capacity(self.get_surcharge_results_size());\n for (key, value) in self.get_individual_surcharge_key_value_pairs().into_iter() {\n value_list.push((\n key,\n value\n .encode_to_string_of_json()\n .change_context(errors::ApiErrorResponse::InternalServerError)\n .attach_printable(\"Failed to encode to string of json\")?,\n ));\n }\n let intent_fulfillment_time = business_profile\n .get_order_fulfillment_time()\n .unwrap_or(router_consts::DEFAULT_FULFILLMENT_TIME);\n redis_conn\n .set_hash_fields(\n &redis_key.as_str().into(),\n value_list,\n Some(intent_fulfillment_time),\n )\n .await\n .change_context(errors::ApiErrorResponse::InternalServerError)\n .attach_printable(\"Failed to write to redis\")?;\n logger::debug!(\"Surcharge results stored in redis with key = {}\", redis_key);\n }\n Ok(())\n }", + "diff_span": { + "before": "", + "after": "" + }, + "commit_sha": "5310ef5a4f9f5c89dda02707ea641fc7dde2f184", + "before_imports": [ + "use common_utils::{\n errors::CustomResult,\n ext_traits::{Encode, OptionExt},\n types::{self as common_types, ConnectorTransactionIdTrait},\n};", + "use router_env::{instrument, logger, tracing};", + "pub use hyperswitch_domain_models::router_request_types::{\n AuthenticationData, SplitRefundsRequest, StripeSplitRefund, SurchargeDetails,\n};" + ], + "after_imports": [ + "use common_utils::{\n errors::CustomResult,\n ext_traits::{Encode, OptionExt},\n types::{self as common_types, ConnectorTransactionIdTrait},\n};", + "use router_env::{instrument, logger, tracing};", + "pub use hyperswitch_domain_models::router_request_types::{\n self, AuthenticationData, SplitRefundsRequest, StripeSplitRefund, SurchargeDetails,\n};" + ] + }, + { + "id": "crates/router/src/core/payments/types.rs::struct::SurchargeMetadata", + "file": "crates/router/src/core/payments/types.rs", + "kind": "struct_item", + "status": "modified", + "code_changed": false, + "imports_changed": true, + "before_code": "pub struct SurchargeMetadata {\n surcharge_results: HashMap,\n pub payment_attempt_id: String,\n}", + "after_code": "pub struct SurchargeMetadata {\n surcharge_results: HashMap,\n pub payment_attempt_id: String,\n}", + "diff_span": { + "before": "", + "after": "" + }, + "commit_sha": "5310ef5a4f9f5c89dda02707ea641fc7dde2f184", + "before_imports": [ + "use common_utils::{\n errors::CustomResult,\n ext_traits::{Encode, OptionExt},\n types::{self as common_types, ConnectorTransactionIdTrait},\n};", + "pub use hyperswitch_domain_models::router_request_types::{\n AuthenticationData, SplitRefundsRequest, StripeSplitRefund, SurchargeDetails,\n};" + ], + "after_imports": [ + "use common_utils::{\n errors::CustomResult,\n ext_traits::{Encode, OptionExt},\n types::{self as common_types, ConnectorTransactionIdTrait},\n};", + "pub use hyperswitch_domain_models::router_request_types::{\n self, AuthenticationData, SplitRefundsRequest, StripeSplitRefund, SurchargeDetails,\n};" + ] + }, + { + "id": "crates/router/src/core/payments/types.rs::MultipleCaptureData::function::get_pending_captures_without_connector_capture_id", + "file": "crates/router/src/core/payments/types.rs", + "kind": "function_item", + "status": "modified", + "code_changed": false, + "imports_changed": true, + "before_code": "pub fn get_pending_captures_without_connector_capture_id(&self) -> Vec<&storage::Capture> {\n self.get_pending_captures()\n .into_iter()\n .filter(|capture| capture.get_optional_connector_transaction_id().is_none())\n .collect()\n }", + "after_code": "pub fn get_pending_captures_without_connector_capture_id(&self) -> Vec<&storage::Capture> {\n self.get_pending_captures()\n .into_iter()\n .filter(|capture| capture.get_optional_connector_transaction_id().is_none())\n .collect()\n }", + "diff_span": { + "before": "", + "after": "" + }, + "commit_sha": "5310ef5a4f9f5c89dda02707ea641fc7dde2f184", + "before_imports": [ + "use common_utils::{\n errors::CustomResult,\n ext_traits::{Encode, OptionExt},\n types::{self as common_types, ConnectorTransactionIdTrait},\n};", + "pub use hyperswitch_domain_models::router_request_types::{\n AuthenticationData, SplitRefundsRequest, StripeSplitRefund, SurchargeDetails,\n};" + ], + "after_imports": [ + "use common_utils::{\n errors::CustomResult,\n ext_traits::{Encode, OptionExt},\n types::{self as common_types, ConnectorTransactionIdTrait},\n};", + "pub use hyperswitch_domain_models::router_request_types::{\n self, AuthenticationData, SplitRefundsRequest, StripeSplitRefund, SurchargeDetails,\n};" + ] + }, + { + "id": "crates/hyperswitch_domain_models/src/router_request_types.rs::struct::CompleteAuthorizeData", + "file": "crates/hyperswitch_domain_models/src/router_request_types.rs", + "kind": "struct_item", + "status": "modified", + "code_changed": true, + "imports_changed": false, + "before_code": "pub struct CompleteAuthorizeData {\n pub payment_method_data: Option,\n pub amount: i64,\n pub email: Option,\n pub currency: storage_enums::Currency,\n pub confirm: bool,\n pub statement_descriptor_suffix: Option,\n pub capture_method: Option,\n // Mandates\n pub setup_future_usage: Option,\n pub mandate_id: Option,\n pub off_session: Option,\n pub setup_mandate_details: Option,\n pub redirect_response: Option,\n pub browser_info: Option,\n pub connector_transaction_id: Option,\n pub connector_meta: Option,\n pub complete_authorize_url: Option,\n pub metadata: Option,\n pub customer_acceptance: Option,\n pub authentication_data: Option,\n pub payment_method_type: Option,\n // New amount for amount frame work\n pub minor_amount: MinorUnit,\n pub merchant_account_id: Option>,\n pub merchant_config_currency: Option,\n pub threeds_method_comp_ind: Option,\n pub is_stored_credential: Option,\n}", + "after_code": "pub struct CompleteAuthorizeData {\n pub payment_method_data: Option,\n pub amount: i64,\n pub email: Option,\n pub currency: storage_enums::Currency,\n pub confirm: bool,\n pub statement_descriptor_suffix: Option,\n pub capture_method: Option,\n // Mandates\n pub setup_future_usage: Option,\n pub mandate_id: Option,\n pub off_session: Option,\n pub setup_mandate_details: Option,\n pub redirect_response: Option,\n pub browser_info: Option,\n pub connector_transaction_id: Option,\n pub connector_meta: Option,\n pub complete_authorize_url: Option,\n pub metadata: Option,\n pub customer_acceptance: Option,\n pub authentication_data: Option,\n pub payment_method_type: Option,\n // New amount for amount frame work\n pub minor_amount: MinorUnit,\n pub merchant_account_id: Option>,\n pub merchant_config_currency: Option,\n pub threeds_method_comp_ind: Option,\n pub is_stored_credential: Option,\n}", + "diff_span": { + "before": " pub metadata: Option,\n pub customer_acceptance: Option,\n pub authentication_data: Option,\n pub payment_method_type: Option,\n // New amount for amount frame work", + "after": " pub metadata: Option,\n pub customer_acceptance: Option,\n pub authentication_data: Option,\n pub payment_method_type: Option,\n // New amount for amount frame work" + }, + "commit_sha": "5310ef5a4f9f5c89dda02707ea641fc7dde2f184" + }, + { + "id": "crates/router/src/core/payments/types.rs::struct::Private", + "file": "crates/router/src/core/payments/types.rs", + "kind": "struct_item", + "status": "modified", + "code_changed": false, + "imports_changed": true, + "before_code": "struct Private {}", + "after_code": "struct Private {}", + "diff_span": { + "before": "", + "after": "" + }, + "commit_sha": "5310ef5a4f9f5c89dda02707ea641fc7dde2f184", + "before_imports": [ + "use common_utils::{\n errors::CustomResult,\n ext_traits::{Encode, OptionExt},\n types::{self as common_types, ConnectorTransactionIdTrait},\n};", + "pub use hyperswitch_domain_models::router_request_types::{\n AuthenticationData, SplitRefundsRequest, StripeSplitRefund, SurchargeDetails,\n};" + ], + "after_imports": [ + "use common_utils::{\n errors::CustomResult,\n ext_traits::{Encode, OptionExt},\n types::{self as common_types, ConnectorTransactionIdTrait},\n};", + "pub use hyperswitch_domain_models::router_request_types::{\n self, AuthenticationData, SplitRefundsRequest, StripeSplitRefund, SurchargeDetails,\n};" + ] + }, + { + "id": "crates/router/src/core/payments/types.rs::SurchargeMetadata::function::new", + "file": "crates/router/src/core/payments/types.rs", + "kind": "function_item", + "status": "modified", + "code_changed": false, + "imports_changed": true, + "before_code": "pub fn new(payment_attempt_id: String) -> Self {\n Self {\n surcharge_results: HashMap::new(),\n payment_attempt_id,\n }\n }", + "after_code": "pub fn new(payment_attempt_id: String) -> Self {\n Self {\n surcharge_results: HashMap::new(),\n payment_attempt_id,\n }\n }", + "diff_span": { + "before": "", + "after": "" + }, + "commit_sha": "5310ef5a4f9f5c89dda02707ea641fc7dde2f184", + "before_imports": [ + "use common_utils::{\n errors::CustomResult,\n ext_traits::{Encode, OptionExt},\n types::{self as common_types, ConnectorTransactionIdTrait},\n};", + "pub use hyperswitch_domain_models::router_request_types::{\n AuthenticationData, SplitRefundsRequest, StripeSplitRefund, SurchargeDetails,\n};" + ], + "after_imports": [ + "use common_utils::{\n errors::CustomResult,\n ext_traits::{Encode, OptionExt},\n types::{self as common_types, ConnectorTransactionIdTrait},\n};", + "pub use hyperswitch_domain_models::router_request_types::{\n self, AuthenticationData, SplitRefundsRequest, StripeSplitRefund, SurchargeDetails,\n};" + ] + }, + { + "id": "crates/router/src/core/payments/types.rs::SurchargeMetadata::function::get_individual_surcharge_key_value_pairs", + "file": "crates/router/src/core/payments/types.rs", + "kind": "function_item", + "status": "modified", + "code_changed": false, + "imports_changed": true, + "before_code": "pub fn get_individual_surcharge_key_value_pairs(&self) -> Vec<(String, SurchargeDetails)> {\n self.surcharge_results\n .iter()\n .map(|(surcharge_key, surcharge_details)| {\n let key = Self::get_surcharge_details_redis_hashset_key(surcharge_key);\n (key, surcharge_details.to_owned())\n })\n .collect()\n }", + "after_code": "pub fn get_individual_surcharge_key_value_pairs(&self) -> Vec<(String, SurchargeDetails)> {\n self.surcharge_results\n .iter()\n .map(|(surcharge_key, surcharge_details)| {\n let key = Self::get_surcharge_details_redis_hashset_key(surcharge_key);\n (key, surcharge_details.to_owned())\n })\n .collect()\n }", + "diff_span": { + "before": "", + "after": "" + }, + "commit_sha": "5310ef5a4f9f5c89dda02707ea641fc7dde2f184", + "before_imports": [ + "use common_utils::{\n errors::CustomResult,\n ext_traits::{Encode, OptionExt},\n types::{self as common_types, ConnectorTransactionIdTrait},\n};", + "pub use hyperswitch_domain_models::router_request_types::{\n AuthenticationData, SplitRefundsRequest, StripeSplitRefund, SurchargeDetails,\n};" + ], + "after_imports": [ + "use common_utils::{\n errors::CustomResult,\n ext_traits::{Encode, OptionExt},\n types::{self as common_types, ConnectorTransactionIdTrait},\n};", + "pub use hyperswitch_domain_models::router_request_types::{\n self, AuthenticationData, SplitRefundsRequest, StripeSplitRefund, SurchargeDetails,\n};" + ] + }, + { + "id": "crates/router/src/core/payments/types.rs::MultipleCaptureData::function::update_capture", + "file": "crates/router/src/core/payments/types.rs", + "kind": "function_item", + "status": "modified", + "code_changed": false, + "imports_changed": true, + "before_code": "pub fn update_capture(&mut self, updated_capture: storage::Capture) {\n let capture_id = &updated_capture.capture_id;\n if self.all_captures.contains_key(capture_id) {\n self.all_captures\n .entry(capture_id.into())\n .and_modify(|capture| *capture = updated_capture.clone());\n }\n }", + "after_code": "pub fn update_capture(&mut self, updated_capture: storage::Capture) {\n let capture_id = &updated_capture.capture_id;\n if self.all_captures.contains_key(capture_id) {\n self.all_captures\n .entry(capture_id.into())\n .and_modify(|capture| *capture = updated_capture.clone());\n }\n }", + "diff_span": { + "before": "", + "after": "" + }, + "commit_sha": "5310ef5a4f9f5c89dda02707ea641fc7dde2f184", + "before_imports": [ + "use common_utils::{\n errors::CustomResult,\n ext_traits::{Encode, OptionExt},\n types::{self as common_types, ConnectorTransactionIdTrait},\n};", + "pub use hyperswitch_domain_models::router_request_types::{\n AuthenticationData, SplitRefundsRequest, StripeSplitRefund, SurchargeDetails,\n};" + ], + "after_imports": [ + "use common_utils::{\n errors::CustomResult,\n ext_traits::{Encode, OptionExt},\n types::{self as common_types, ConnectorTransactionIdTrait},\n};", + "pub use hyperswitch_domain_models::router_request_types::{\n self, AuthenticationData, SplitRefundsRequest, StripeSplitRefund, SurchargeDetails,\n};" + ] + }, + { + "id": "crates/router/src/core/payments/types.rs::impl::SurchargeMetadata", + "file": "crates/router/src/core/payments/types.rs", + "kind": "impl_item", + "status": "modified", + "code_changed": false, + "imports_changed": true, + "before_code": "impl SurchargeMetadata {\n pub fn new(payment_attempt_id: String) -> Self {\n Self {\n surcharge_results: HashMap::new(),\n payment_attempt_id,\n }\n }\n pub fn is_empty_result(&self) -> bool {\n self.surcharge_results.is_empty()\n }\n pub fn get_surcharge_results_size(&self) -> usize {\n self.surcharge_results.len()\n }\n pub fn insert_surcharge_details(\n &mut self,\n surcharge_key: SurchargeKey,\n surcharge_details: SurchargeDetails,\n ) {\n self.surcharge_results\n .insert(surcharge_key, surcharge_details);\n }\n pub fn get_surcharge_details(&self, surcharge_key: SurchargeKey) -> Option<&SurchargeDetails> {\n self.surcharge_results.get(&surcharge_key)\n }\n pub fn get_surcharge_metadata_redis_key(payment_attempt_id: &str) -> String {\n format!(\"surcharge_metadata_{payment_attempt_id}\")\n }\n pub fn get_individual_surcharge_key_value_pairs(&self) -> Vec<(String, SurchargeDetails)> {\n self.surcharge_results\n .iter()\n .map(|(surcharge_key, surcharge_details)| {\n let key = Self::get_surcharge_details_redis_hashset_key(surcharge_key);\n (key, surcharge_details.to_owned())\n })\n .collect()\n }\n pub fn get_surcharge_details_redis_hashset_key(surcharge_key: &SurchargeKey) -> String {\n match surcharge_key {\n SurchargeKey::Token(token) => {\n format!(\"token_{token}\")\n }\n SurchargeKey::PaymentMethodData(payment_method, payment_method_type, card_network) => {\n if let Some(card_network) = card_network {\n format!(\"{payment_method}_{payment_method_type}_{card_network}\")\n } else {\n format!(\"{payment_method}_{payment_method_type}\")\n }\n }\n }\n }\n #[instrument(skip_all)]\n pub async fn persist_individual_surcharge_details_in_redis(\n &self,\n state: &SessionState,\n business_profile: &Profile,\n ) -> RouterResult<()> {\n if !self.is_empty_result() {\n let redis_conn = state\n .store\n .get_redis_conn()\n .change_context(errors::ApiErrorResponse::InternalServerError)\n .attach_printable(\"Failed to get redis connection\")?;\n let redis_key = Self::get_surcharge_metadata_redis_key(&self.payment_attempt_id);\n\n let mut value_list = Vec::with_capacity(self.get_surcharge_results_size());\n for (key, value) in self.get_individual_surcharge_key_value_pairs().into_iter() {\n value_list.push((\n key,\n value\n .encode_to_string_of_json()\n .change_context(errors::ApiErrorResponse::InternalServerError)\n .attach_printable(\"Failed to encode to string of json\")?,\n ));\n }\n let intent_fulfillment_time = business_profile\n .get_order_fulfillment_time()\n .unwrap_or(router_consts::DEFAULT_FULFILLMENT_TIME);\n redis_conn\n .set_hash_fields(\n &redis_key.as_str().into(),\n value_list,\n Some(intent_fulfillment_time),\n )\n .await\n .change_context(errors::ApiErrorResponse::InternalServerError)\n .attach_printable(\"Failed to write to redis\")?;\n logger::debug!(\"Surcharge results stored in redis with key = {}\", redis_key);\n }\n Ok(())\n }\n\n #[instrument(skip_all)]\n pub async fn get_individual_surcharge_detail_from_redis(\n state: &SessionState,\n surcharge_key: SurchargeKey,\n payment_attempt_id: &str,\n ) -> CustomResult {\n let redis_conn = state\n .store\n .get_redis_conn()\n .attach_printable(\"Failed to get redis connection\")?;\n let redis_key = Self::get_surcharge_metadata_redis_key(payment_attempt_id);\n let value_key = Self::get_surcharge_details_redis_hashset_key(&surcharge_key);\n let result = redis_conn\n .get_hash_field_and_deserialize(\n &redis_key.as_str().into(),\n &value_key,\n \"SurchargeDetails\",\n )\n .await;\n logger::debug!(\n \"Surcharge result fetched from redis with key = {} and {}\",\n redis_key,\n value_key\n );\n result\n }\n}", + "after_code": "impl SurchargeMetadata {\n pub fn new(payment_attempt_id: String) -> Self {\n Self {\n surcharge_results: HashMap::new(),\n payment_attempt_id,\n }\n }\n pub fn is_empty_result(&self) -> bool {\n self.surcharge_results.is_empty()\n }\n pub fn get_surcharge_results_size(&self) -> usize {\n self.surcharge_results.len()\n }\n pub fn insert_surcharge_details(\n &mut self,\n surcharge_key: SurchargeKey,\n surcharge_details: SurchargeDetails,\n ) {\n self.surcharge_results\n .insert(surcharge_key, surcharge_details);\n }\n pub fn get_surcharge_details(&self, surcharge_key: SurchargeKey) -> Option<&SurchargeDetails> {\n self.surcharge_results.get(&surcharge_key)\n }\n pub fn get_surcharge_metadata_redis_key(payment_attempt_id: &str) -> String {\n format!(\"surcharge_metadata_{payment_attempt_id}\")\n }\n pub fn get_individual_surcharge_key_value_pairs(&self) -> Vec<(String, SurchargeDetails)> {\n self.surcharge_results\n .iter()\n .map(|(surcharge_key, surcharge_details)| {\n let key = Self::get_surcharge_details_redis_hashset_key(surcharge_key);\n (key, surcharge_details.to_owned())\n })\n .collect()\n }\n pub fn get_surcharge_details_redis_hashset_key(surcharge_key: &SurchargeKey) -> String {\n match surcharge_key {\n SurchargeKey::Token(token) => {\n format!(\"token_{token}\")\n }\n SurchargeKey::PaymentMethodData(payment_method, payment_method_type, card_network) => {\n if let Some(card_network) = card_network {\n format!(\"{payment_method}_{payment_method_type}_{card_network}\")\n } else {\n format!(\"{payment_method}_{payment_method_type}\")\n }\n }\n }\n }\n #[instrument(skip_all)]\n pub async fn persist_individual_surcharge_details_in_redis(\n &self,\n state: &SessionState,\n business_profile: &Profile,\n ) -> RouterResult<()> {\n if !self.is_empty_result() {\n let redis_conn = state\n .store\n .get_redis_conn()\n .change_context(errors::ApiErrorResponse::InternalServerError)\n .attach_printable(\"Failed to get redis connection\")?;\n let redis_key = Self::get_surcharge_metadata_redis_key(&self.payment_attempt_id);\n\n let mut value_list = Vec::with_capacity(self.get_surcharge_results_size());\n for (key, value) in self.get_individual_surcharge_key_value_pairs().into_iter() {\n value_list.push((\n key,\n value\n .encode_to_string_of_json()\n .change_context(errors::ApiErrorResponse::InternalServerError)\n .attach_printable(\"Failed to encode to string of json\")?,\n ));\n }\n let intent_fulfillment_time = business_profile\n .get_order_fulfillment_time()\n .unwrap_or(router_consts::DEFAULT_FULFILLMENT_TIME);\n redis_conn\n .set_hash_fields(\n &redis_key.as_str().into(),\n value_list,\n Some(intent_fulfillment_time),\n )\n .await\n .change_context(errors::ApiErrorResponse::InternalServerError)\n .attach_printable(\"Failed to write to redis\")?;\n logger::debug!(\"Surcharge results stored in redis with key = {}\", redis_key);\n }\n Ok(())\n }\n\n #[instrument(skip_all)]\n pub async fn get_individual_surcharge_detail_from_redis(\n state: &SessionState,\n surcharge_key: SurchargeKey,\n payment_attempt_id: &str,\n ) -> CustomResult {\n let redis_conn = state\n .store\n .get_redis_conn()\n .attach_printable(\"Failed to get redis connection\")?;\n let redis_key = Self::get_surcharge_metadata_redis_key(payment_attempt_id);\n let value_key = Self::get_surcharge_details_redis_hashset_key(&surcharge_key);\n let result = redis_conn\n .get_hash_field_and_deserialize(\n &redis_key.as_str().into(),\n &value_key,\n \"SurchargeDetails\",\n )\n .await;\n logger::debug!(\n \"Surcharge result fetched from redis with key = {} and {}\",\n redis_key,\n value_key\n );\n result\n }\n}", + "diff_span": { + "before": "", + "after": "" + }, + "commit_sha": "5310ef5a4f9f5c89dda02707ea641fc7dde2f184", + "before_imports": [ + "use common_utils::{\n errors::CustomResult,\n ext_traits::{Encode, OptionExt},\n types::{self as common_types, ConnectorTransactionIdTrait},\n};", + "use redis_interface::errors::RedisError;", + "pub use hyperswitch_domain_models::router_request_types::{\n AuthenticationData, SplitRefundsRequest, StripeSplitRefund, SurchargeDetails,\n};", + "use router_env::{instrument, logger, tracing};" + ], + "after_imports": [ + "use common_utils::{\n errors::CustomResult,\n ext_traits::{Encode, OptionExt},\n types::{self as common_types, ConnectorTransactionIdTrait},\n};", + "use router_env::{instrument, logger, tracing};", + "pub use hyperswitch_domain_models::router_request_types::{\n self, AuthenticationData, SplitRefundsRequest, StripeSplitRefund, SurchargeDetails,\n};", + "use redis_interface::errors::RedisError;" + ] + }, + { + "id": "crates/router/src/core/payments/types.rs::struct::MultipleCaptureData", + "file": "crates/router/src/core/payments/types.rs", + "kind": "struct_item", + "status": "modified", + "code_changed": false, + "imports_changed": true, + "before_code": "pub struct MultipleCaptureData {\n // key -> capture_id, value -> Capture\n all_captures: HashMap,\n latest_capture: storage::Capture,\n pub expand_captures: Option,\n _private: Private, // to restrict direct construction of MultipleCaptureData\n}", + "after_code": "pub struct MultipleCaptureData {\n // key -> capture_id, value -> Capture\n all_captures: HashMap,\n latest_capture: storage::Capture,\n pub expand_captures: Option,\n _private: Private, // to restrict direct construction of MultipleCaptureData\n}", + "diff_span": { + "before": "", + "after": "" + }, + "commit_sha": "5310ef5a4f9f5c89dda02707ea641fc7dde2f184", + "before_imports": [ + "use common_utils::{\n errors::CustomResult,\n ext_traits::{Encode, OptionExt},\n types::{self as common_types, ConnectorTransactionIdTrait},\n};", + "pub use hyperswitch_domain_models::router_request_types::{\n AuthenticationData, SplitRefundsRequest, StripeSplitRefund, SurchargeDetails,\n};" + ], + "after_imports": [ + "use common_utils::{\n errors::CustomResult,\n ext_traits::{Encode, OptionExt},\n types::{self as common_types, ConnectorTransactionIdTrait},\n};", + "pub use hyperswitch_domain_models::router_request_types::{\n self, AuthenticationData, SplitRefundsRequest, StripeSplitRefund, SurchargeDetails,\n};" + ] + }, + { + "id": "crates/router/src/core/payments/types.rs::impl::SurchargeDetailsResponse", + "file": "crates/router/src/core/payments/types.rs", + "kind": "impl_item", + "status": "modified", + "code_changed": false, + "imports_changed": true, + "before_code": "impl ForeignTryFrom<(&SurchargeDetails, &PaymentAttempt)> for SurchargeDetailsResponse {\n type Error = TryFromIntError;\n fn foreign_try_from(\n (surcharge_details, payment_attempt): (&SurchargeDetails, &PaymentAttempt),\n ) -> Result {\n let currency = payment_attempt.currency.unwrap_or_default();\n let display_surcharge_amount = currency\n .to_currency_base_unit_asf64(surcharge_details.surcharge_amount.get_amount_as_i64())?;\n let display_tax_on_surcharge_amount = currency.to_currency_base_unit_asf64(\n surcharge_details\n .tax_on_surcharge_amount\n .get_amount_as_i64(),\n )?;\n let display_total_surcharge_amount = currency.to_currency_base_unit_asf64(\n (surcharge_details.surcharge_amount + surcharge_details.tax_on_surcharge_amount)\n .get_amount_as_i64(),\n )?;\n Ok(Self {\n surcharge: surcharge_details.surcharge.clone().into(),\n tax_on_surcharge: surcharge_details.tax_on_surcharge.clone().map(Into::into),\n display_surcharge_amount,\n display_tax_on_surcharge_amount,\n display_total_surcharge_amount,\n })\n }\n}", + "after_code": "impl ForeignTryFrom<(&SurchargeDetails, &PaymentAttempt)> for SurchargeDetailsResponse {\n type Error = TryFromIntError;\n fn foreign_try_from(\n (surcharge_details, payment_attempt): (&SurchargeDetails, &PaymentAttempt),\n ) -> Result {\n let currency = payment_attempt.currency.unwrap_or_default();\n let display_surcharge_amount = currency\n .to_currency_base_unit_asf64(surcharge_details.surcharge_amount.get_amount_as_i64())?;\n let display_tax_on_surcharge_amount = currency.to_currency_base_unit_asf64(\n surcharge_details\n .tax_on_surcharge_amount\n .get_amount_as_i64(),\n )?;\n let display_total_surcharge_amount = currency.to_currency_base_unit_asf64(\n (surcharge_details.surcharge_amount + surcharge_details.tax_on_surcharge_amount)\n .get_amount_as_i64(),\n )?;\n Ok(Self {\n surcharge: surcharge_details.surcharge.clone().into(),\n tax_on_surcharge: surcharge_details.tax_on_surcharge.clone().map(Into::into),\n display_surcharge_amount,\n display_tax_on_surcharge_amount,\n display_total_surcharge_amount,\n })\n }\n}", + "diff_span": { + "before": "", + "after": "" + }, + "commit_sha": "5310ef5a4f9f5c89dda02707ea641fc7dde2f184", + "before_imports": [ + "use common_utils::{\n errors::CustomResult,\n ext_traits::{Encode, OptionExt},\n types::{self as common_types, ConnectorTransactionIdTrait},\n};", + "use hyperswitch_domain_models::payments::payment_attempt::PaymentAttempt;", + "use api_models::payment_methods::SurchargeDetailsResponse;", + "pub use hyperswitch_domain_models::router_request_types::{\n AuthenticationData, SplitRefundsRequest, StripeSplitRefund, SurchargeDetails,\n};" + ], + "after_imports": [ + "use common_utils::{\n errors::CustomResult,\n ext_traits::{Encode, OptionExt},\n types::{self as common_types, ConnectorTransactionIdTrait},\n};", + "pub use hyperswitch_domain_models::router_request_types::{\n self, AuthenticationData, SplitRefundsRequest, StripeSplitRefund, SurchargeDetails,\n};", + "use hyperswitch_domain_models::payments::payment_attempt::PaymentAttempt;", + "use api_models::payment_methods::SurchargeDetailsResponse;" + ] + }, + { + "id": "crates/router/src/core/unified_connector_service/transformers.rs::impl::payments_grpc::AuthenticationData", + "file": "crates/router/src/core/unified_connector_service/transformers.rs", + "kind": "impl_item", + "status": "modified", + "code_changed": true, + "imports_changed": true, + "before_code": "impl transformers::ForeignTryFrom for payments_grpc::AuthenticationData {\n type Error = error_stack::Report;\n\n fn foreign_try_from(authentication_data: AuthenticationData) -> Result {\n let cavv = if authentication_data.cavv.peek().is_empty() {\n None\n } else {\n Some(authentication_data.cavv.expose().to_string())\n };\n Ok(Self {\n eci: authentication_data.eci,\n cavv,\n threeds_server_transaction_id: authentication_data.threeds_server_transaction_id.map(\n |id| Identifier {\n id_type: Some(payments_grpc::identifier::IdType::Id(id)),\n },\n ),\n message_version: authentication_data\n .message_version\n .map(|message_version| message_version.to_string()),\n ds_transaction_id: authentication_data.ds_trans_id,\n trans_status: authentication_data\n .trans_status\n .map(payments_grpc::TransactionStatus::foreign_from)\n .map(i32::from),\n acs_transaction_id: authentication_data.acs_trans_id,\n transaction_id: authentication_data.transaction_id,\n ucaf_collection_indicator: authentication_data.ucaf_collection_indicator,\n })\n }\n}", + "after_code": "impl transformers::ForeignTryFrom\n for payments_grpc::AuthenticationData\n{\n type Error = error_stack::Report;\n\n fn foreign_try_from(\n authentication_data: router_request_types::UcsAuthenticationData,\n ) -> Result {\n Ok(Self {\n eci: authentication_data.eci,\n cavv: authentication_data.cavv.map(ExposeInterface::expose),\n threeds_server_transaction_id: authentication_data.threeds_server_transaction_id.map(\n |id| Identifier {\n id_type: Some(payments_grpc::identifier::IdType::Id(id)),\n },\n ),\n message_version: authentication_data\n .message_version\n .map(|message_version| message_version.to_string()),\n ds_transaction_id: authentication_data.ds_trans_id,\n trans_status: authentication_data\n .trans_status\n .map(payments_grpc::TransactionStatus::foreign_from)\n .map(i32::from),\n acs_transaction_id: authentication_data.acs_trans_id,\n transaction_id: authentication_data.transaction_id,\n ucaf_collection_indicator: authentication_data.ucaf_collection_indicator,\n })\n }\n}", + "diff_span": { + "before": "impl transformers::ForeignTryFrom for payments_grpc::AuthenticationData {\n type Error = error_stack::Report;\n\n fn foreign_try_from(authentication_data: AuthenticationData) -> Result {\n let cavv = if authentication_data.cavv.peek().is_empty() {\n None\n } else {\n Some(authentication_data.cavv.expose().to_string())\n };\n Ok(Self {\n eci: authentication_data.eci,\n cavv,\n threeds_server_transaction_id: authentication_data.threeds_server_transaction_id.map(\n |id| Identifier {", + "after": "impl transformers::ForeignTryFrom\n for payments_grpc::AuthenticationData\n{\n type Error = error_stack::Report;\n\n fn foreign_try_from(\n authentication_data: router_request_types::UcsAuthenticationData,\n ) -> Result {\n Ok(Self {\n eci: authentication_data.eci,\n cavv: authentication_data.cavv.map(ExposeInterface::expose),\n threeds_server_transaction_id: authentication_data.threeds_server_transaction_id.map(\n |id| Identifier {" + }, + "commit_sha": "5310ef5a4f9f5c89dda02707ea641fc7dde2f184", + "before_imports": [ + "use hyperswitch_domain_models::{\n router_data::{AccessToken, ErrorResponse, RouterData},\n router_flow_types::{\n payments::{Authorize, Capture, PSync, SetupMandate},\n refunds::{Execute, RSync},\n unified_authentication_service as uas_flows, ExternalVaultProxy,\n },\n router_request_types::{\n self, AuthenticationData, ExternalVaultProxyPaymentsData, PaymentsAuthorizeData,\n PaymentsCancelData, PaymentsCaptureData, PaymentsSyncData, RefundsData,\n SetupMandateRequestData,\n },\n router_response_types::{PaymentsResponseData, RedirectForm, RefundsResponseData},\n};", + "use unified_connector_service_client::payments::{\n self as payments_grpc, ConnectorState, Identifier, PaymentServiceTransformRequest,\n PaymentServiceTransformResponse,\n};", + "use external_services::grpc_client::unified_connector_service::UnifiedConnectorServiceError;", + "use crate::{\n core::{errors, unified_connector_service},\n types::{\n api,\n transformers::{self, ForeignFrom},\n },\n};" + ], + "after_imports": [ + "use external_services::grpc_client::unified_connector_service::UnifiedConnectorServiceError;", + "use masking::{ExposeInterface, PeekInterface};", + "use unified_connector_service_client::payments::{\n self as payments_grpc, ConnectorState, Identifier, PaymentServiceTransformRequest,\n PaymentServiceTransformResponse,\n};", + "use hyperswitch_domain_models::{\n router_data::{AccessToken, ErrorResponse, RouterData},\n router_flow_types::{\n payments::{Authorize, Capture, PSync, SetupMandate},\n refunds::{Execute, RSync},\n unified_authentication_service as uas_flows, ExternalVaultProxy,\n },\n router_request_types::{\n self, AuthenticationData, ExternalVaultProxyPaymentsData, PaymentsAuthorizeData,\n PaymentsCancelData, PaymentsCaptureData, PaymentsSyncData, RefundsData,\n SetupMandateRequestData,\n },\n router_response_types::{PaymentsResponseData, RedirectForm, RefundsResponseData},\n};", + "use crate::{\n core::{errors, unified_connector_service},\n types::{\n api,\n transformers::{self, ForeignFrom},\n },\n};" + ] + }, + { + "id": "crates/router/src/core/payments/types.rs::AuthenticationData::function::foreign_try_from", + "file": "crates/router/src/core/payments/types.rs", + "kind": "function_item", + "status": "modified", + "code_changed": true, + "imports_changed": true, + "before_code": "fn foreign_try_from(\n authentication_store: &hyperswitch_domain_models::router_request_types::authentication::AuthenticationStore,\n ) -> Result {\n let authentication = &authentication_store.authentication;\n if authentication.authentication_status == common_enums::AuthenticationStatus::Success {\n let threeds_server_transaction_id =\n authentication.threeds_server_transaction_id.clone();\n let message_version = authentication.message_version.clone();\n let cavv = authentication_store\n .cavv\n .clone()\n .get_required_value(\"cavv\")\n .change_context(errors::ApiErrorResponse::InternalServerError)\n .attach_printable(\"cavv must not be null when authentication_status is success\")?;\n Ok(Self {\n trans_status: authentication.trans_status.clone(),\n eci: authentication.eci.clone(),\n created_at: authentication.created_at,\n cavv,\n threeds_server_transaction_id,\n message_version,\n ds_trans_id: authentication.ds_trans_id.clone(),\n authentication_type: authentication.authentication_type,\n challenge_code: authentication.challenge_code.clone(),\n challenge_cancel: authentication.challenge_cancel.clone(),\n challenge_code_reason: authentication.challenge_code_reason.clone(),\n message_extension: authentication.message_extension.clone(),\n acs_trans_id: authentication.acs_trans_id.clone(),\n transaction_id: authentication.connector_authentication_id.clone(),\n ucaf_collection_indicator: None,\n })\n } else {\n Err(errors::ApiErrorResponse::PaymentAuthenticationFailed { data: None }.into())\n }\n }", + "after_code": "fn foreign_try_from(\n authentication_store: &router_request_types::authentication::AuthenticationStore,\n ) -> Result {\n let authentication = &authentication_store.authentication;\n if authentication.authentication_status == common_enums::AuthenticationStatus::Success {\n let threeds_server_transaction_id =\n authentication.threeds_server_transaction_id.clone();\n let message_version = authentication.message_version.clone();\n let cavv = authentication_store\n .cavv\n .clone()\n .get_required_value(\"cavv\")\n .change_context(errors::ApiErrorResponse::InternalServerError)\n .attach_printable(\"cavv must not be null when authentication_status is success\")?;\n Ok(Self {\n trans_status: authentication.trans_status.clone(),\n eci: authentication.eci.clone(),\n created_at: authentication.created_at,\n cavv,\n threeds_server_transaction_id,\n message_version,\n ds_trans_id: authentication.ds_trans_id.clone(),\n authentication_type: authentication.authentication_type,\n challenge_code: authentication.challenge_code.clone(),\n challenge_cancel: authentication.challenge_cancel.clone(),\n challenge_code_reason: authentication.challenge_code_reason.clone(),\n message_extension: authentication.message_extension.clone(),\n acs_trans_id: authentication.acs_trans_id.clone(),\n transaction_id: authentication.connector_authentication_id.clone(),\n ucaf_collection_indicator: None,\n })\n } else {\n Err(errors::ApiErrorResponse::PaymentAuthenticationFailed { data: None }.into())\n }\n }", + "diff_span": { + "before": "fn foreign_try_from(\n authentication_store: &hyperswitch_domain_models::router_request_types::authentication::AuthenticationStore,\n ) -> Result {\n let authentication = &authentication_store.authentication;", + "after": "fn foreign_try_from(\n authentication_store: &router_request_types::authentication::AuthenticationStore,\n ) -> Result {\n let authentication = &authentication_store.authentication;" + }, + "commit_sha": "5310ef5a4f9f5c89dda02707ea641fc7dde2f184", + "before_imports": [ + "use common_utils::{\n errors::CustomResult,\n ext_traits::{Encode, OptionExt},\n types::{self as common_types, ConnectorTransactionIdTrait},\n};", + "pub use hyperswitch_domain_models::router_request_types::{\n AuthenticationData, SplitRefundsRequest, StripeSplitRefund, SurchargeDetails,\n};" + ], + "after_imports": [ + "use common_utils::{\n errors::CustomResult,\n ext_traits::{Encode, OptionExt},\n types::{self as common_types, ConnectorTransactionIdTrait},\n};", + "pub use hyperswitch_domain_models::router_request_types::{\n self, AuthenticationData, SplitRefundsRequest, StripeSplitRefund, SurchargeDetails,\n};" + ] + }, + { + "id": "crates/router/src/core/payments/types.rs::MultipleCaptureData::function::get_all_captures", + "file": "crates/router/src/core/payments/types.rs", + "kind": "function_item", + "status": "modified", + "code_changed": false, + "imports_changed": true, + "before_code": "pub fn get_all_captures(&self) -> Vec<&storage::Capture> {\n self.all_captures\n .iter()\n .map(|key_value| key_value.1)\n .collect()\n }", + "after_code": "pub fn get_all_captures(&self) -> Vec<&storage::Capture> {\n self.all_captures\n .iter()\n .map(|key_value| key_value.1)\n .collect()\n }", + "diff_span": { + "before": "", + "after": "" + }, + "commit_sha": "5310ef5a4f9f5c89dda02707ea641fc7dde2f184", + "before_imports": [ + "use common_utils::{\n errors::CustomResult,\n ext_traits::{Encode, OptionExt},\n types::{self as common_types, ConnectorTransactionIdTrait},\n};", + "pub use hyperswitch_domain_models::router_request_types::{\n AuthenticationData, SplitRefundsRequest, StripeSplitRefund, SurchargeDetails,\n};" + ], + "after_imports": [ + "use common_utils::{\n errors::CustomResult,\n ext_traits::{Encode, OptionExt},\n types::{self as common_types, ConnectorTransactionIdTrait},\n};", + "pub use hyperswitch_domain_models::router_request_types::{\n self, AuthenticationData, SplitRefundsRequest, StripeSplitRefund, SurchargeDetails,\n};" + ] + }, + { + "id": "crates/router/src/core/payments/types.rs::MultipleCaptureData::function::get_latest_capture", + "file": "crates/router/src/core/payments/types.rs", + "kind": "function_item", + "status": "modified", + "code_changed": false, + "imports_changed": true, + "before_code": "pub fn get_latest_capture(&self) -> &storage::Capture {\n &self.latest_capture\n }", + "after_code": "pub fn get_latest_capture(&self) -> &storage::Capture {\n &self.latest_capture\n }", + "diff_span": { + "before": "", + "after": "" + }, + "commit_sha": "5310ef5a4f9f5c89dda02707ea641fc7dde2f184", + "before_imports": [ + "use common_utils::{\n errors::CustomResult,\n ext_traits::{Encode, OptionExt},\n types::{self as common_types, ConnectorTransactionIdTrait},\n};", + "pub use hyperswitch_domain_models::router_request_types::{\n AuthenticationData, SplitRefundsRequest, StripeSplitRefund, SurchargeDetails,\n};" + ], + "after_imports": [ + "use common_utils::{\n errors::CustomResult,\n ext_traits::{Encode, OptionExt},\n types::{self as common_types, ConnectorTransactionIdTrait},\n};", + "pub use hyperswitch_domain_models::router_request_types::{\n self, AuthenticationData, SplitRefundsRequest, StripeSplitRefund, SurchargeDetails,\n};" + ] + }, + { + "id": "crates/router/src/core/payments/types.rs::SurchargeMetadata::function::get_surcharge_details_redis_hashset_key", + "file": "crates/router/src/core/payments/types.rs", + "kind": "function_item", + "status": "modified", + "code_changed": false, + "imports_changed": true, + "before_code": "pub fn get_surcharge_details_redis_hashset_key(surcharge_key: &SurchargeKey) -> String {\n match surcharge_key {\n SurchargeKey::Token(token) => {\n format!(\"token_{token}\")\n }\n SurchargeKey::PaymentMethodData(payment_method, payment_method_type, card_network) => {\n if let Some(card_network) = card_network {\n format!(\"{payment_method}_{payment_method_type}_{card_network}\")\n } else {\n format!(\"{payment_method}_{payment_method_type}\")\n }\n }\n }\n }", + "after_code": "pub fn get_surcharge_details_redis_hashset_key(surcharge_key: &SurchargeKey) -> String {\n match surcharge_key {\n SurchargeKey::Token(token) => {\n format!(\"token_{token}\")\n }\n SurchargeKey::PaymentMethodData(payment_method, payment_method_type, card_network) => {\n if let Some(card_network) = card_network {\n format!(\"{payment_method}_{payment_method_type}_{card_network}\")\n } else {\n format!(\"{payment_method}_{payment_method_type}\")\n }\n }\n }\n }", + "diff_span": { + "before": "", + "after": "" + }, + "commit_sha": "5310ef5a4f9f5c89dda02707ea641fc7dde2f184", + "before_imports": [ + "use common_utils::{\n errors::CustomResult,\n ext_traits::{Encode, OptionExt},\n types::{self as common_types, ConnectorTransactionIdTrait},\n};", + "pub use hyperswitch_domain_models::router_request_types::{\n AuthenticationData, SplitRefundsRequest, StripeSplitRefund, SurchargeDetails,\n};" + ], + "after_imports": [ + "use common_utils::{\n errors::CustomResult,\n ext_traits::{Encode, OptionExt},\n types::{self as common_types, ConnectorTransactionIdTrait},\n};", + "pub use hyperswitch_domain_models::router_request_types::{\n self, AuthenticationData, SplitRefundsRequest, StripeSplitRefund, SurchargeDetails,\n};" + ] + }, + { + "id": "crates/router/src/core/payments/types.rs::SurchargeDetailsResponse::function::foreign_try_from", + "file": "crates/router/src/core/payments/types.rs", + "kind": "function_item", + "status": "modified", + "code_changed": false, + "imports_changed": true, + "before_code": "fn foreign_try_from(\n (surcharge_details, payment_attempt): (&SurchargeDetails, &PaymentAttempt),\n ) -> Result {\n let currency = payment_attempt.currency.unwrap_or_default();\n let display_surcharge_amount = currency\n .to_currency_base_unit_asf64(surcharge_details.surcharge_amount.get_amount_as_i64())?;\n let display_tax_on_surcharge_amount = currency.to_currency_base_unit_asf64(\n surcharge_details\n .tax_on_surcharge_amount\n .get_amount_as_i64(),\n )?;\n let display_total_surcharge_amount = currency.to_currency_base_unit_asf64(\n (surcharge_details.surcharge_amount + surcharge_details.tax_on_surcharge_amount)\n .get_amount_as_i64(),\n )?;\n Ok(Self {\n surcharge: surcharge_details.surcharge.clone().into(),\n tax_on_surcharge: surcharge_details.tax_on_surcharge.clone().map(Into::into),\n display_surcharge_amount,\n display_tax_on_surcharge_amount,\n display_total_surcharge_amount,\n })\n }", + "after_code": "fn foreign_try_from(\n (surcharge_details, payment_attempt): (&SurchargeDetails, &PaymentAttempt),\n ) -> Result {\n let currency = payment_attempt.currency.unwrap_or_default();\n let display_surcharge_amount = currency\n .to_currency_base_unit_asf64(surcharge_details.surcharge_amount.get_amount_as_i64())?;\n let display_tax_on_surcharge_amount = currency.to_currency_base_unit_asf64(\n surcharge_details\n .tax_on_surcharge_amount\n .get_amount_as_i64(),\n )?;\n let display_total_surcharge_amount = currency.to_currency_base_unit_asf64(\n (surcharge_details.surcharge_amount + surcharge_details.tax_on_surcharge_amount)\n .get_amount_as_i64(),\n )?;\n Ok(Self {\n surcharge: surcharge_details.surcharge.clone().into(),\n tax_on_surcharge: surcharge_details.tax_on_surcharge.clone().map(Into::into),\n display_surcharge_amount,\n display_tax_on_surcharge_amount,\n display_total_surcharge_amount,\n })\n }", + "diff_span": { + "before": "", + "after": "" + }, + "commit_sha": "5310ef5a4f9f5c89dda02707ea641fc7dde2f184", + "before_imports": [ + "use common_utils::{\n errors::CustomResult,\n ext_traits::{Encode, OptionExt},\n types::{self as common_types, ConnectorTransactionIdTrait},\n};", + "use hyperswitch_domain_models::payments::payment_attempt::PaymentAttempt;", + "pub use hyperswitch_domain_models::router_request_types::{\n AuthenticationData, SplitRefundsRequest, StripeSplitRefund, SurchargeDetails,\n};" + ], + "after_imports": [ + "use common_utils::{\n errors::CustomResult,\n ext_traits::{Encode, OptionExt},\n types::{self as common_types, ConnectorTransactionIdTrait},\n};", + "pub use hyperswitch_domain_models::router_request_types::{\n self, AuthenticationData, SplitRefundsRequest, StripeSplitRefund, SurchargeDetails,\n};", + "use hyperswitch_domain_models::payments::payment_attempt::PaymentAttempt;" + ] + }, + { + "id": "crates/router/src/core/payments/types.rs::SurchargeMetadata::function::get_surcharge_results_size", + "file": "crates/router/src/core/payments/types.rs", + "kind": "function_item", + "status": "modified", + "code_changed": false, + "imports_changed": true, + "before_code": "pub fn get_surcharge_results_size(&self) -> usize {\n self.surcharge_results.len()\n }", + "after_code": "pub fn get_surcharge_results_size(&self) -> usize {\n self.surcharge_results.len()\n }", + "diff_span": { + "before": "", + "after": "" + }, + "commit_sha": "5310ef5a4f9f5c89dda02707ea641fc7dde2f184", + "before_imports": [ + "use common_utils::{\n errors::CustomResult,\n ext_traits::{Encode, OptionExt},\n types::{self as common_types, ConnectorTransactionIdTrait},\n};", + "pub use hyperswitch_domain_models::router_request_types::{\n AuthenticationData, SplitRefundsRequest, StripeSplitRefund, SurchargeDetails,\n};" + ], + "after_imports": [ + "use common_utils::{\n errors::CustomResult,\n ext_traits::{Encode, OptionExt},\n types::{self as common_types, ConnectorTransactionIdTrait},\n};", + "pub use hyperswitch_domain_models::router_request_types::{\n self, AuthenticationData, SplitRefundsRequest, StripeSplitRefund, SurchargeDetails,\n};" + ] + }, + { + "id": "crates/router/src/core/payments/types.rs::MultipleCaptureData::function::get_capture_by_connector_capture_id", + "file": "crates/router/src/core/payments/types.rs", + "kind": "function_item", + "status": "modified", + "code_changed": false, + "imports_changed": true, + "before_code": "pub fn get_capture_by_connector_capture_id(\n &self,\n connector_capture_id: &String,\n ) -> Option<&storage::Capture> {\n self.all_captures\n .iter()\n .find(|(_, capture)| {\n capture.get_optional_connector_transaction_id() == Some(connector_capture_id)\n })\n .map(|(_, capture)| capture)\n }", + "after_code": "pub fn get_capture_by_connector_capture_id(\n &self,\n connector_capture_id: &String,\n ) -> Option<&storage::Capture> {\n self.all_captures\n .iter()\n .find(|(_, capture)| {\n capture.get_optional_connector_transaction_id() == Some(connector_capture_id)\n })\n .map(|(_, capture)| capture)\n }", + "diff_span": { + "before": "", + "after": "" + }, + "commit_sha": "5310ef5a4f9f5c89dda02707ea641fc7dde2f184", + "before_imports": [ + "use common_utils::{\n errors::CustomResult,\n ext_traits::{Encode, OptionExt},\n types::{self as common_types, ConnectorTransactionIdTrait},\n};", + "pub use hyperswitch_domain_models::router_request_types::{\n AuthenticationData, SplitRefundsRequest, StripeSplitRefund, SurchargeDetails,\n};" + ], + "after_imports": [ + "use common_utils::{\n errors::CustomResult,\n ext_traits::{Encode, OptionExt},\n types::{self as common_types, ConnectorTransactionIdTrait},\n};", + "pub use hyperswitch_domain_models::router_request_types::{\n self, AuthenticationData, SplitRefundsRequest, StripeSplitRefund, SurchargeDetails,\n};" + ] + }, + { + "id": "crates/router/src/core/payments/types.rs::SurchargeDetailsResponse::type::Error", + "file": "crates/router/src/core/payments/types.rs", + "kind": "type_item", + "status": "modified", + "code_changed": false, + "imports_changed": true, + "before_code": "type Error = TryFromIntError;", + "after_code": "type Error = TryFromIntError;", + "diff_span": { + "before": "", + "after": "" + }, + "commit_sha": "5310ef5a4f9f5c89dda02707ea641fc7dde2f184", + "before_imports": [ + "use common_utils::{\n errors::CustomResult,\n ext_traits::{Encode, OptionExt},\n types::{self as common_types, ConnectorTransactionIdTrait},\n};", + "pub use hyperswitch_domain_models::router_request_types::{\n AuthenticationData, SplitRefundsRequest, StripeSplitRefund, SurchargeDetails,\n};" + ], + "after_imports": [ + "use common_utils::{\n errors::CustomResult,\n ext_traits::{Encode, OptionExt},\n types::{self as common_types, ConnectorTransactionIdTrait},\n};", + "pub use hyperswitch_domain_models::router_request_types::{\n self, AuthenticationData, SplitRefundsRequest, StripeSplitRefund, SurchargeDetails,\n};" + ] + }, + { + "id": "crates/router/src/core/payments/types.rs::SurchargeMetadata::function::insert_surcharge_details", + "file": "crates/router/src/core/payments/types.rs", + "kind": "function_item", + "status": "modified", + "code_changed": false, + "imports_changed": true, + "before_code": "pub fn insert_surcharge_details(\n &mut self,\n surcharge_key: SurchargeKey,\n surcharge_details: SurchargeDetails,\n ) {\n self.surcharge_results\n .insert(surcharge_key, surcharge_details);\n }", + "after_code": "pub fn insert_surcharge_details(\n &mut self,\n surcharge_key: SurchargeKey,\n surcharge_details: SurchargeDetails,\n ) {\n self.surcharge_results\n .insert(surcharge_key, surcharge_details);\n }", + "diff_span": { + "before": "", + "after": "" + }, + "commit_sha": "5310ef5a4f9f5c89dda02707ea641fc7dde2f184", + "before_imports": [ + "use common_utils::{\n errors::CustomResult,\n ext_traits::{Encode, OptionExt},\n types::{self as common_types, ConnectorTransactionIdTrait},\n};", + "pub use hyperswitch_domain_models::router_request_types::{\n AuthenticationData, SplitRefundsRequest, StripeSplitRefund, SurchargeDetails,\n};" + ], + "after_imports": [ + "use common_utils::{\n errors::CustomResult,\n ext_traits::{Encode, OptionExt},\n types::{self as common_types, ConnectorTransactionIdTrait},\n};", + "pub use hyperswitch_domain_models::router_request_types::{\n self, AuthenticationData, SplitRefundsRequest, StripeSplitRefund, SurchargeDetails,\n};" + ] + }, + { + "id": "crates/router/src/core/payments/types.rs::MultipleCaptureData::function::get_captures_count", + "file": "crates/router/src/core/payments/types.rs", + "kind": "function_item", + "status": "modified", + "code_changed": false, + "imports_changed": true, + "before_code": "pub fn get_captures_count(&self) -> RouterResult {\n i16::try_from(self.all_captures.len())\n .change_context(errors::ApiErrorResponse::InternalServerError)\n .attach_printable(\"Error while converting from usize to i16\")\n }", + "after_code": "pub fn get_captures_count(&self) -> RouterResult {\n i16::try_from(self.all_captures.len())\n .change_context(errors::ApiErrorResponse::InternalServerError)\n .attach_printable(\"Error while converting from usize to i16\")\n }", + "diff_span": { + "before": "", + "after": "" + }, + "commit_sha": "5310ef5a4f9f5c89dda02707ea641fc7dde2f184", + "before_imports": [ + "use common_utils::{\n errors::CustomResult,\n ext_traits::{Encode, OptionExt},\n types::{self as common_types, ConnectorTransactionIdTrait},\n};", + "pub use hyperswitch_domain_models::router_request_types::{\n AuthenticationData, SplitRefundsRequest, StripeSplitRefund, SurchargeDetails,\n};" + ], + "after_imports": [ + "use common_utils::{\n errors::CustomResult,\n ext_traits::{Encode, OptionExt},\n types::{self as common_types, ConnectorTransactionIdTrait},\n};", + "pub use hyperswitch_domain_models::router_request_types::{\n self, AuthenticationData, SplitRefundsRequest, StripeSplitRefund, SurchargeDetails,\n};" + ] + }, + { + "id": "crates/router/src/core/payments/types.rs::SurchargeMetadata::function::get_surcharge_metadata_redis_key", + "file": "crates/router/src/core/payments/types.rs", + "kind": "function_item", + "status": "modified", + "code_changed": false, + "imports_changed": true, + "before_code": "pub fn get_surcharge_metadata_redis_key(payment_attempt_id: &str) -> String {\n format!(\"surcharge_metadata_{payment_attempt_id}\")\n }", + "after_code": "pub fn get_surcharge_metadata_redis_key(payment_attempt_id: &str) -> String {\n format!(\"surcharge_metadata_{payment_attempt_id}\")\n }", + "diff_span": { + "before": "", + "after": "" + }, + "commit_sha": "5310ef5a4f9f5c89dda02707ea641fc7dde2f184", + "before_imports": [ + "use common_utils::{\n errors::CustomResult,\n ext_traits::{Encode, OptionExt},\n types::{self as common_types, ConnectorTransactionIdTrait},\n};", + "pub use hyperswitch_domain_models::router_request_types::{\n AuthenticationData, SplitRefundsRequest, StripeSplitRefund, SurchargeDetails,\n};" + ], + "after_imports": [ + "use common_utils::{\n errors::CustomResult,\n ext_traits::{Encode, OptionExt},\n types::{self as common_types, ConnectorTransactionIdTrait},\n};", + "pub use hyperswitch_domain_models::router_request_types::{\n self, AuthenticationData, SplitRefundsRequest, StripeSplitRefund, SurchargeDetails,\n};" + ] + }, + { + "id": "crates/router/src/core/payments/types.rs::MultipleCaptureData::function::new_for_sync", + "file": "crates/router/src/core/payments/types.rs", + "kind": "function_item", + "status": "modified", + "code_changed": false, + "imports_changed": true, + "before_code": "pub fn new_for_sync(\n captures: Vec,\n expand_captures: Option,\n ) -> RouterResult {\n let latest_capture = captures\n .last()\n .ok_or(errors::ApiErrorResponse::InternalServerError)\n .attach_printable(\"Cannot create MultipleCaptureData with empty captures list\")?\n .clone();\n let multiple_capture_data = Self {\n all_captures: captures\n .into_iter()\n .map(|capture| (capture.capture_id.clone(), capture))\n .collect(),\n latest_capture,\n _private: Private {},\n expand_captures,\n };\n Ok(multiple_capture_data)\n }", + "after_code": "pub fn new_for_sync(\n captures: Vec,\n expand_captures: Option,\n ) -> RouterResult {\n let latest_capture = captures\n .last()\n .ok_or(errors::ApiErrorResponse::InternalServerError)\n .attach_printable(\"Cannot create MultipleCaptureData with empty captures list\")?\n .clone();\n let multiple_capture_data = Self {\n all_captures: captures\n .into_iter()\n .map(|capture| (capture.capture_id.clone(), capture))\n .collect(),\n latest_capture,\n _private: Private {},\n expand_captures,\n };\n Ok(multiple_capture_data)\n }", + "diff_span": { + "before": "", + "after": "" + }, + "commit_sha": "5310ef5a4f9f5c89dda02707ea641fc7dde2f184", + "before_imports": [ + "use common_utils::{\n errors::CustomResult,\n ext_traits::{Encode, OptionExt},\n types::{self as common_types, ConnectorTransactionIdTrait},\n};", + "pub use hyperswitch_domain_models::router_request_types::{\n AuthenticationData, SplitRefundsRequest, StripeSplitRefund, SurchargeDetails,\n};" + ], + "after_imports": [ + "use common_utils::{\n errors::CustomResult,\n ext_traits::{Encode, OptionExt},\n types::{self as common_types, ConnectorTransactionIdTrait},\n};", + "pub use hyperswitch_domain_models::router_request_types::{\n self, AuthenticationData, SplitRefundsRequest, StripeSplitRefund, SurchargeDetails,\n};" + ] + }, + { + "id": "crates/router/src/core/payments/flows/complete_authorize_flow.rs::function::call_unified_connector_service_authenticate", + "file": "crates/router/src/core/payments/flows/complete_authorize_flow.rs", + "kind": "function_item", + "status": "modified", + "code_changed": true, + "imports_changed": false, + "before_code": "async fn call_unified_connector_service_authenticate(\n router_data: &mut types::RouterData<\n api::Authenticate,\n types::PaymentsAuthenticateData,\n types::PaymentsResponseData,\n >,\n state: &SessionState,\n header_payload: &hyperswitch_domain_models::payments::HeaderPayload,\n lineage_ids: grpc_client::LineageIds,\n #[cfg(feature = \"v1\")] merchant_connector_account: helpers::MerchantConnectorAccountType,\n #[cfg(feature = \"v2\")] merchant_connector_account: domain::MerchantConnectorAccountTypeDetails,\n merchant_context: &domain::MerchantContext,\n connector: connector_enums::Connector,\n unified_connector_service_execution_mode: common_enums::ExecutionMode,\n merchant_order_reference_id: Option,\n) -> RouterResult> {\n let client = state\n .grpc_client\n .unified_connector_service_client\n .clone()\n .ok_or(ApiErrorResponse::InternalServerError)\n .attach_printable(\"Failed to fetch Unified Connector Service client\")?;\n\n let payment_authenticate_request =\n payments_grpc::PaymentServiceAuthenticateRequest::foreign_try_from(&*router_data)\n .change_context(ApiErrorResponse::InternalServerError)\n .attach_printable(\"Failed to construct Payment Authorize Request\")?;\n\n let connector_auth_metadata = ucs_core::build_unified_connector_service_auth_metadata(\n merchant_connector_account,\n merchant_context,\n )\n .change_context(ApiErrorResponse::InternalServerError)\n .attach_printable(\"Failed to construct request metadata\")?;\n let merchant_reference_id = header_payload\n .x_reference_id\n .clone()\n .or(merchant_order_reference_id)\n .map(|id| id_type::PaymentReferenceId::from_str(id.as_str()))\n .transpose()\n .inspect_err(|err| logger::warn!(error=?err, \"Invalid Merchant ReferenceId found\"))\n .ok()\n .flatten()\n .map(ucs_types::UcsReferenceId::Payment);\n let headers_builder = state\n .get_grpc_headers_ucs(unified_connector_service_execution_mode)\n .external_vault_proxy_metadata(None)\n .merchant_reference_id(merchant_reference_id)\n .lineage_ids(lineage_ids);\n let (updated_router_data, authentication_data) = Box::pin(ucs_core::ucs_logging_wrapper(\n router_data.clone(),\n state,\n payment_authenticate_request,\n headers_builder,\n |mut router_data, payment_authenticate_request, grpc_headers| async move {\n let response = client\n .payment_authenticate(\n payment_authenticate_request,\n connector_auth_metadata,\n grpc_headers,\n )\n .await\n .change_context(ApiErrorResponse::InternalServerError)\n .attach_printable(\"Failed to authorize payment\")?;\n\n let payment_authenticate_response = response.into_inner();\n\n let (router_data_response, status_code) =\n ucs_core::handle_unified_connector_service_response_for_payment_authenticate(\n payment_authenticate_response.clone(),\n )\n .change_context(ApiErrorResponse::InternalServerError)\n .attach_printable(\"Failed to deserialize UCS response\")?;\n\n let router_data_response = router_data_response.map(|(response, status)| {\n router_data.status = status;\n response\n });\n let router_data_response = match router_data_response {\n Ok(response) => Ok(transform_response_for_authenticate_flow(\n connector, response,\n )?),\n Err(err) => Err(err),\n };\n router_data.response = router_data_response;\n router_data.raw_connector_response = payment_authenticate_response\n .raw_connector_response\n .clone()\n .map(|raw_connector_response| raw_connector_response.expose().into());\n router_data.connector_http_status_code = Some(status_code);\n\n let domain_authentication_data = payment_authenticate_response\n .authentication_data\n .clone()\n .map(|grpc_authentication_data| {\n router_request_types::AuthenticationData::foreign_try_from(\n grpc_authentication_data,\n )\n })\n .transpose()\n .change_context(ApiErrorResponse::InternalServerError)\n .attach_printable(\"Failed to Convert to domain AuthenticationData\")?;\n\n Ok((\n router_data,\n domain_authentication_data,\n payment_authenticate_response,\n ))\n },\n ))\n .await?;\n\n // Copy back the updated data\n *router_data = updated_router_data;\n Ok(authentication_data)\n}", + "after_code": "async fn call_unified_connector_service_authenticate(\n router_data: &mut types::RouterData<\n api::Authenticate,\n types::PaymentsAuthenticateData,\n types::PaymentsResponseData,\n >,\n state: &SessionState,\n header_payload: &hyperswitch_domain_models::payments::HeaderPayload,\n lineage_ids: grpc_client::LineageIds,\n #[cfg(feature = \"v1\")] merchant_connector_account: helpers::MerchantConnectorAccountType,\n #[cfg(feature = \"v2\")] merchant_connector_account: domain::MerchantConnectorAccountTypeDetails,\n merchant_context: &domain::MerchantContext,\n connector: connector_enums::Connector,\n unified_connector_service_execution_mode: common_enums::ExecutionMode,\n merchant_order_reference_id: Option,\n) -> RouterResult> {\n let client = state\n .grpc_client\n .unified_connector_service_client\n .clone()\n .ok_or(ApiErrorResponse::InternalServerError)\n .attach_printable(\"Failed to fetch Unified Connector Service client\")?;\n\n let payment_authenticate_request =\n payments_grpc::PaymentServiceAuthenticateRequest::foreign_try_from(&*router_data)\n .change_context(ApiErrorResponse::InternalServerError)\n .attach_printable(\"Failed to construct Payment Authorize Request\")?;\n\n let connector_auth_metadata = ucs_core::build_unified_connector_service_auth_metadata(\n merchant_connector_account,\n merchant_context,\n )\n .change_context(ApiErrorResponse::InternalServerError)\n .attach_printable(\"Failed to construct request metadata\")?;\n let merchant_reference_id = header_payload\n .x_reference_id\n .clone()\n .or(merchant_order_reference_id)\n .map(|id| id_type::PaymentReferenceId::from_str(id.as_str()))\n .transpose()\n .inspect_err(|err| logger::warn!(error=?err, \"Invalid Merchant ReferenceId found\"))\n .ok()\n .flatten()\n .map(ucs_types::UcsReferenceId::Payment);\n let headers_builder = state\n .get_grpc_headers_ucs(unified_connector_service_execution_mode)\n .external_vault_proxy_metadata(None)\n .merchant_reference_id(merchant_reference_id)\n .lineage_ids(lineage_ids);\n let (updated_router_data, authentication_data) = Box::pin(ucs_core::ucs_logging_wrapper(\n router_data.clone(),\n state,\n payment_authenticate_request,\n headers_builder,\n |mut router_data, payment_authenticate_request, grpc_headers| async move {\n let response = client\n .payment_authenticate(\n payment_authenticate_request,\n connector_auth_metadata,\n grpc_headers,\n )\n .await\n .change_context(ApiErrorResponse::InternalServerError)\n .attach_printable(\"Failed to authorize payment\")?;\n\n let payment_authenticate_response = response.into_inner();\n\n let (router_data_response, status_code) =\n ucs_core::handle_unified_connector_service_response_for_payment_authenticate(\n payment_authenticate_response.clone(),\n )\n .change_context(ApiErrorResponse::InternalServerError)\n .attach_printable(\"Failed to deserialize UCS response\")?;\n\n let router_data_response = router_data_response.map(|(response, status)| {\n router_data.status = status;\n response\n });\n let router_data_response = match router_data_response {\n Ok(response) => Ok(transform_response_for_authenticate_flow(\n connector, response,\n )?),\n Err(err) => Err(err),\n };\n router_data.response = router_data_response;\n router_data.raw_connector_response = payment_authenticate_response\n .raw_connector_response\n .clone()\n .map(|raw_connector_response| raw_connector_response.expose().into());\n router_data.connector_http_status_code = Some(status_code);\n\n let domain_authentication_data = payment_authenticate_response\n .authentication_data\n .clone()\n .map(|grpc_authentication_data| {\n router_request_types::UcsAuthenticationData::foreign_try_from(\n grpc_authentication_data,\n )\n })\n .transpose()\n .change_context(ApiErrorResponse::InternalServerError)\n .attach_printable(\"Failed to Convert to domain AuthenticationData\")?;\n\n Ok((\n router_data,\n domain_authentication_data,\n payment_authenticate_response,\n ))\n },\n ))\n .await?;\n\n // Copy back the updated data\n *router_data = updated_router_data;\n Ok(authentication_data)\n}", + "diff_span": { + "before": " unified_connector_service_execution_mode: common_enums::ExecutionMode,\n merchant_order_reference_id: Option,\n) -> RouterResult> {\n let client = state\n .grpc_client\n .unified_connector_service_client\n .clone()\n .ok_or(ApiErrorResponse::InternalServerError)\n .attach_printable(\"Failed to fetch Unified Connector Service client\")?;\n\n let payment_authenticate_request =\n payments_grpc::PaymentServiceAuthenticateRequest::foreign_try_from(&*router_data)\n .change_context(ApiErrorResponse::InternalServerError)\n .attach_printable(\"Failed to construct Payment Authorize Request\")?;\n\n let connector_auth_metadata = ucs_core::build_unified_connector_service_auth_metadata(\n merchant_connector_account,\n merchant_context,\n )\n .change_context(ApiErrorResponse::InternalServerError)\n .attach_printable(\"Failed to construct request metadata\")?;\n let merchant_reference_id = header_payload\n .x_reference_id\n .clone()\n .or(merchant_order_reference_id)\n .map(|id| id_type::PaymentReferenceId::from_str(id.as_str()))\n .transpose()\n .inspect_err(|err| logger::warn!(error=?err, \"Invalid Merchant ReferenceId found\"))\n .ok()\n .flatten()\n .map(ucs_types::UcsReferenceId::Payment);\n let headers_builder = state\n .get_grpc_headers_ucs(unified_connector_service_execution_mode)\n .external_vault_proxy_metadata(None)\n .merchant_reference_id(merchant_reference_id)\n .lineage_ids(lineage_ids);\n let (updated_router_data, authentication_data) = Box::pin(ucs_core::ucs_logging_wrapper(\n router_data.clone(),\n state,\n payment_authenticate_request,\n headers_builder,\n |mut router_data, payment_authenticate_request, grpc_headers| async move {\n let response = client\n .payment_authenticate(\n payment_authenticate_request,\n connector_auth_metadata,\n grpc_headers,\n )\n .await\n .change_context(ApiErrorResponse::InternalServerError)\n .attach_printable(\"Failed to authorize payment\")?;\n\n let payment_authenticate_response = response.into_inner();\n\n let (router_data_response, status_code) =\n ucs_core::handle_unified_connector_service_response_for_payment_authenticate(\n payment_authenticate_response.clone(),\n )\n .change_context(ApiErrorResponse::InternalServerError)\n .attach_printable(\"Failed to deserialize UCS response\")?;\n\n let router_data_response = router_data_response.map(|(response, status)| {\n router_data.status = status;\n response\n });\n let router_data_response = match router_data_response {\n Ok(response) => Ok(transform_response_for_authenticate_flow(\n connector, response,\n )?),\n Err(err) => Err(err),\n };\n router_data.response = router_data_response;\n router_data.raw_connector_response = payment_authenticate_response\n .raw_connector_response\n .clone()\n .map(|raw_connector_response| raw_connector_response.expose().into());\n router_data.connector_http_status_code = Some(status_code);\n\n let domain_authentication_data = payment_authenticate_response\n .authentication_data\n .clone()\n .map(|grpc_authentication_data| {\n router_request_types::AuthenticationData::foreign_try_from(\n grpc_authentication_data,\n )", + "after": " unified_connector_service_execution_mode: common_enums::ExecutionMode,\n merchant_order_reference_id: Option,\n) -> RouterResult> {\n let client = state\n .grpc_client\n .unified_connector_service_client\n .clone()\n .ok_or(ApiErrorResponse::InternalServerError)\n .attach_printable(\"Failed to fetch Unified Connector Service client\")?;\n\n let payment_authenticate_request =\n payments_grpc::PaymentServiceAuthenticateRequest::foreign_try_from(&*router_data)\n .change_context(ApiErrorResponse::InternalServerError)\n .attach_printable(\"Failed to construct Payment Authorize Request\")?;\n\n let connector_auth_metadata = ucs_core::build_unified_connector_service_auth_metadata(\n merchant_connector_account,\n merchant_context,\n )\n .change_context(ApiErrorResponse::InternalServerError)\n .attach_printable(\"Failed to construct request metadata\")?;\n let merchant_reference_id = header_payload\n .x_reference_id\n .clone()\n .or(merchant_order_reference_id)\n .map(|id| id_type::PaymentReferenceId::from_str(id.as_str()))\n .transpose()\n .inspect_err(|err| logger::warn!(error=?err, \"Invalid Merchant ReferenceId found\"))\n .ok()\n .flatten()\n .map(ucs_types::UcsReferenceId::Payment);\n let headers_builder = state\n .get_grpc_headers_ucs(unified_connector_service_execution_mode)\n .external_vault_proxy_metadata(None)\n .merchant_reference_id(merchant_reference_id)\n .lineage_ids(lineage_ids);\n let (updated_router_data, authentication_data) = Box::pin(ucs_core::ucs_logging_wrapper(\n router_data.clone(),\n state,\n payment_authenticate_request,\n headers_builder,\n |mut router_data, payment_authenticate_request, grpc_headers| async move {\n let response = client\n .payment_authenticate(\n payment_authenticate_request,\n connector_auth_metadata,\n grpc_headers,\n )\n .await\n .change_context(ApiErrorResponse::InternalServerError)\n .attach_printable(\"Failed to authorize payment\")?;\n\n let payment_authenticate_response = response.into_inner();\n\n let (router_data_response, status_code) =\n ucs_core::handle_unified_connector_service_response_for_payment_authenticate(\n payment_authenticate_response.clone(),\n )\n .change_context(ApiErrorResponse::InternalServerError)\n .attach_printable(\"Failed to deserialize UCS response\")?;\n\n let router_data_response = router_data_response.map(|(response, status)| {\n router_data.status = status;\n response\n });\n let router_data_response = match router_data_response {\n Ok(response) => Ok(transform_response_for_authenticate_flow(\n connector, response,\n )?),\n Err(err) => Err(err),\n };\n router_data.response = router_data_response;\n router_data.raw_connector_response = payment_authenticate_response\n .raw_connector_response\n .clone()\n .map(|raw_connector_response| raw_connector_response.expose().into());\n router_data.connector_http_status_code = Some(status_code);\n\n let domain_authentication_data = payment_authenticate_response\n .authentication_data\n .clone()\n .map(|grpc_authentication_data| {\n router_request_types::UcsAuthenticationData::foreign_try_from(\n grpc_authentication_data,\n )" + }, + "commit_sha": "5310ef5a4f9f5c89dda02707ea641fc7dde2f184" + }, + { + "id": "crates/router/src/core/payments/types.rs::MultipleCaptureData::function::get_capture_by_capture_id", + "file": "crates/router/src/core/payments/types.rs", + "kind": "function_item", + "status": "modified", + "code_changed": false, + "imports_changed": true, + "before_code": "pub fn get_capture_by_capture_id(&self, capture_id: String) -> Option<&storage::Capture> {\n self.all_captures.get(&capture_id)\n }", + "after_code": "pub fn get_capture_by_capture_id(&self, capture_id: String) -> Option<&storage::Capture> {\n self.all_captures.get(&capture_id)\n }", + "diff_span": { + "before": "", + "after": "" + }, + "commit_sha": "5310ef5a4f9f5c89dda02707ea641fc7dde2f184", + "before_imports": [ + "use common_utils::{\n errors::CustomResult,\n ext_traits::{Encode, OptionExt},\n types::{self as common_types, ConnectorTransactionIdTrait},\n};", + "pub use hyperswitch_domain_models::router_request_types::{\n AuthenticationData, SplitRefundsRequest, StripeSplitRefund, SurchargeDetails,\n};" + ], + "after_imports": [ + "use common_utils::{\n errors::CustomResult,\n ext_traits::{Encode, OptionExt},\n types::{self as common_types, ConnectorTransactionIdTrait},\n};", + "pub use hyperswitch_domain_models::router_request_types::{\n self, AuthenticationData, SplitRefundsRequest, StripeSplitRefund, SurchargeDetails,\n};" + ] + }, + { + "id": "crates/router/src/core/payments/types.rs::MultipleCaptureData::function::get_status_count", + "file": "crates/router/src/core/payments/types.rs", + "kind": "function_item", + "status": "modified", + "code_changed": false, + "imports_changed": true, + "before_code": "pub fn get_status_count(&self) -> HashMap {\n let mut hash_map: HashMap = HashMap::new();\n hash_map.insert(storage_enums::CaptureStatus::Charged, 0);\n hash_map.insert(storage_enums::CaptureStatus::Pending, 0);\n hash_map.insert(storage_enums::CaptureStatus::Started, 0);\n hash_map.insert(storage_enums::CaptureStatus::Failed, 0);\n self.all_captures\n .iter()\n .fold(hash_map, |mut accumulator, capture| {\n let current_capture_status = capture.1.status;\n accumulator\n .entry(current_capture_status)\n .and_modify(|count| *count += 1);\n accumulator\n })\n }", + "after_code": "pub fn get_status_count(&self) -> HashMap {\n let mut hash_map: HashMap = HashMap::new();\n hash_map.insert(storage_enums::CaptureStatus::Charged, 0);\n hash_map.insert(storage_enums::CaptureStatus::Pending, 0);\n hash_map.insert(storage_enums::CaptureStatus::Started, 0);\n hash_map.insert(storage_enums::CaptureStatus::Failed, 0);\n self.all_captures\n .iter()\n .fold(hash_map, |mut accumulator, capture| {\n let current_capture_status = capture.1.status;\n accumulator\n .entry(current_capture_status)\n .and_modify(|count| *count += 1);\n accumulator\n })\n }", + "diff_span": { + "before": "", + "after": "" + }, + "commit_sha": "5310ef5a4f9f5c89dda02707ea641fc7dde2f184", + "before_imports": [ + "use common_utils::{\n errors::CustomResult,\n ext_traits::{Encode, OptionExt},\n types::{self as common_types, ConnectorTransactionIdTrait},\n};", + "pub use hyperswitch_domain_models::router_request_types::{\n AuthenticationData, SplitRefundsRequest, StripeSplitRefund, SurchargeDetails,\n};" + ], + "after_imports": [ + "use common_utils::{\n errors::CustomResult,\n ext_traits::{Encode, OptionExt},\n types::{self as common_types, ConnectorTransactionIdTrait},\n};", + "pub use hyperswitch_domain_models::router_request_types::{\n self, AuthenticationData, SplitRefundsRequest, StripeSplitRefund, SurchargeDetails,\n};" + ] + }, + { + "id": "crates/router/src/core/payments/types.rs::MultipleCaptureData::function::get_attempt_status", + "file": "crates/router/src/core/payments/types.rs", + "kind": "function_item", + "status": "modified", + "code_changed": false, + "imports_changed": true, + "before_code": "pub fn get_attempt_status(\n &self,\n authorized_amount: common_types::MinorUnit,\n ) -> storage_enums::AttemptStatus {\n let total_captured_amount = self.get_total_charged_amount();\n if authorized_amount == total_captured_amount {\n return storage_enums::AttemptStatus::Charged;\n }\n let status_count_map = self.get_status_count();\n if status_count_map.get(&storage_enums::CaptureStatus::Charged) > Some(&0) {\n storage_enums::AttemptStatus::PartialChargedAndChargeable\n } else {\n storage_enums::AttemptStatus::CaptureInitiated\n }\n }", + "after_code": "pub fn get_attempt_status(\n &self,\n authorized_amount: common_types::MinorUnit,\n ) -> storage_enums::AttemptStatus {\n let total_captured_amount = self.get_total_charged_amount();\n if authorized_amount == total_captured_amount {\n return storage_enums::AttemptStatus::Charged;\n }\n let status_count_map = self.get_status_count();\n if status_count_map.get(&storage_enums::CaptureStatus::Charged) > Some(&0) {\n storage_enums::AttemptStatus::PartialChargedAndChargeable\n } else {\n storage_enums::AttemptStatus::CaptureInitiated\n }\n }", + "diff_span": { + "before": "", + "after": "" + }, + "commit_sha": "5310ef5a4f9f5c89dda02707ea641fc7dde2f184", + "before_imports": [ + "use common_utils::{\n errors::CustomResult,\n ext_traits::{Encode, OptionExt},\n types::{self as common_types, ConnectorTransactionIdTrait},\n};", + "pub use hyperswitch_domain_models::router_request_types::{\n AuthenticationData, SplitRefundsRequest, StripeSplitRefund, SurchargeDetails,\n};" + ], + "after_imports": [ + "use common_utils::{\n errors::CustomResult,\n ext_traits::{Encode, OptionExt},\n types::{self as common_types, ConnectorTransactionIdTrait},\n};", + "pub use hyperswitch_domain_models::router_request_types::{\n self, AuthenticationData, SplitRefundsRequest, StripeSplitRefund, SurchargeDetails,\n};" + ] + }, + { + "id": "crates/router/src/core/payments/types.rs::MultipleCaptureData::function::get_total_charged_amount", + "file": "crates/router/src/core/payments/types.rs", + "kind": "function_item", + "status": "modified", + "code_changed": false, + "imports_changed": true, + "before_code": "pub fn get_total_charged_amount(&self) -> common_types::MinorUnit {\n self.all_captures\n .iter()\n .fold(common_types::MinorUnit::new(0), |accumulator, capture| {\n accumulator\n + match capture.1.status {\n storage_enums::CaptureStatus::Charged => capture.1.amount,\n storage_enums::CaptureStatus::Pending\n | storage_enums::CaptureStatus::Started\n | storage_enums::CaptureStatus::Failed => common_types::MinorUnit::new(0),\n }\n })\n }", + "after_code": "pub fn get_total_charged_amount(&self) -> common_types::MinorUnit {\n self.all_captures\n .iter()\n .fold(common_types::MinorUnit::new(0), |accumulator, capture| {\n accumulator\n + match capture.1.status {\n storage_enums::CaptureStatus::Charged => capture.1.amount,\n storage_enums::CaptureStatus::Pending\n | storage_enums::CaptureStatus::Started\n | storage_enums::CaptureStatus::Failed => common_types::MinorUnit::new(0),\n }\n })\n }", + "diff_span": { + "before": "", + "after": "" + }, + "commit_sha": "5310ef5a4f9f5c89dda02707ea641fc7dde2f184", + "before_imports": [ + "use common_utils::{\n errors::CustomResult,\n ext_traits::{Encode, OptionExt},\n types::{self as common_types, ConnectorTransactionIdTrait},\n};", + "pub use hyperswitch_domain_models::router_request_types::{\n AuthenticationData, SplitRefundsRequest, StripeSplitRefund, SurchargeDetails,\n};" + ], + "after_imports": [ + "use common_utils::{\n errors::CustomResult,\n ext_traits::{Encode, OptionExt},\n types::{self as common_types, ConnectorTransactionIdTrait},\n};", + "pub use hyperswitch_domain_models::router_request_types::{\n self, AuthenticationData, SplitRefundsRequest, StripeSplitRefund, SurchargeDetails,\n};" + ] + }, + { + "id": "crates/router/src/core/payments/types.rs::MultipleCaptureData::function::new_for_create", + "file": "crates/router/src/core/payments/types.rs", + "kind": "function_item", + "status": "modified", + "code_changed": false, + "imports_changed": true, + "before_code": "pub fn new_for_create(\n mut previous_captures: Vec,\n new_capture: storage::Capture,\n ) -> Self {\n previous_captures.push(new_capture.clone());\n Self {\n all_captures: previous_captures\n .into_iter()\n .map(|capture| (capture.capture_id.clone(), capture))\n .collect(),\n latest_capture: new_capture,\n _private: Private {},\n expand_captures: None,\n }\n }", + "after_code": "pub fn new_for_create(\n mut previous_captures: Vec,\n new_capture: storage::Capture,\n ) -> Self {\n previous_captures.push(new_capture.clone());\n Self {\n all_captures: previous_captures\n .into_iter()\n .map(|capture| (capture.capture_id.clone(), capture))\n .collect(),\n latest_capture: new_capture,\n _private: Private {},\n expand_captures: None,\n }\n }", + "diff_span": { + "before": "", + "after": "" + }, + "commit_sha": "5310ef5a4f9f5c89dda02707ea641fc7dde2f184", + "before_imports": [ + "use common_utils::{\n errors::CustomResult,\n ext_traits::{Encode, OptionExt},\n types::{self as common_types, ConnectorTransactionIdTrait},\n};", + "pub use hyperswitch_domain_models::router_request_types::{\n AuthenticationData, SplitRefundsRequest, StripeSplitRefund, SurchargeDetails,\n};" + ], + "after_imports": [ + "use common_utils::{\n errors::CustomResult,\n ext_traits::{Encode, OptionExt},\n types::{self as common_types, ConnectorTransactionIdTrait},\n};", + "pub use hyperswitch_domain_models::router_request_types::{\n self, AuthenticationData, SplitRefundsRequest, StripeSplitRefund, SurchargeDetails,\n};" + ] + }, + { + "id": "crates/router/src/core/payments/types.rs::impl::AuthenticationData", + "file": "crates/router/src/core/payments/types.rs", + "kind": "impl_item", + "status": "modified", + "code_changed": true, + "imports_changed": true, + "before_code": "impl\n ForeignTryFrom<\n &hyperswitch_domain_models::router_request_types::authentication::AuthenticationStore,\n > for AuthenticationData\n{\n type Error = error_stack::Report;\n fn foreign_try_from(\n authentication_store: &hyperswitch_domain_models::router_request_types::authentication::AuthenticationStore,\n ) -> Result {\n let authentication = &authentication_store.authentication;\n if authentication.authentication_status == common_enums::AuthenticationStatus::Success {\n let threeds_server_transaction_id =\n authentication.threeds_server_transaction_id.clone();\n let message_version = authentication.message_version.clone();\n let cavv = authentication_store\n .cavv\n .clone()\n .get_required_value(\"cavv\")\n .change_context(errors::ApiErrorResponse::InternalServerError)\n .attach_printable(\"cavv must not be null when authentication_status is success\")?;\n Ok(Self {\n trans_status: authentication.trans_status.clone(),\n eci: authentication.eci.clone(),\n created_at: authentication.created_at,\n cavv,\n threeds_server_transaction_id,\n message_version,\n ds_trans_id: authentication.ds_trans_id.clone(),\n authentication_type: authentication.authentication_type,\n challenge_code: authentication.challenge_code.clone(),\n challenge_cancel: authentication.challenge_cancel.clone(),\n challenge_code_reason: authentication.challenge_code_reason.clone(),\n message_extension: authentication.message_extension.clone(),\n acs_trans_id: authentication.acs_trans_id.clone(),\n transaction_id: authentication.connector_authentication_id.clone(),\n ucaf_collection_indicator: None,\n })\n } else {\n Err(errors::ApiErrorResponse::PaymentAuthenticationFailed { data: None }.into())\n }\n }\n}", + "after_code": "impl ForeignTryFrom<&router_request_types::authentication::AuthenticationStore>\n for AuthenticationData\n{\n type Error = error_stack::Report;\n fn foreign_try_from(\n authentication_store: &router_request_types::authentication::AuthenticationStore,\n ) -> Result {\n let authentication = &authentication_store.authentication;\n if authentication.authentication_status == common_enums::AuthenticationStatus::Success {\n let threeds_server_transaction_id =\n authentication.threeds_server_transaction_id.clone();\n let message_version = authentication.message_version.clone();\n let cavv = authentication_store\n .cavv\n .clone()\n .get_required_value(\"cavv\")\n .change_context(errors::ApiErrorResponse::InternalServerError)\n .attach_printable(\"cavv must not be null when authentication_status is success\")?;\n Ok(Self {\n trans_status: authentication.trans_status.clone(),\n eci: authentication.eci.clone(),\n created_at: authentication.created_at,\n cavv,\n threeds_server_transaction_id,\n message_version,\n ds_trans_id: authentication.ds_trans_id.clone(),\n authentication_type: authentication.authentication_type,\n challenge_code: authentication.challenge_code.clone(),\n challenge_cancel: authentication.challenge_cancel.clone(),\n challenge_code_reason: authentication.challenge_code_reason.clone(),\n message_extension: authentication.message_extension.clone(),\n acs_trans_id: authentication.acs_trans_id.clone(),\n transaction_id: authentication.connector_authentication_id.clone(),\n ucaf_collection_indicator: None,\n })\n } else {\n Err(errors::ApiErrorResponse::PaymentAuthenticationFailed { data: None }.into())\n }\n }\n}", + "diff_span": { + "before": "impl\n ForeignTryFrom<\n &hyperswitch_domain_models::router_request_types::authentication::AuthenticationStore,\n > for AuthenticationData\n{\n type Error = error_stack::Report;\n fn foreign_try_from(\n authentication_store: &hyperswitch_domain_models::router_request_types::authentication::AuthenticationStore,\n ) -> Result {\n let authentication = &authentication_store.authentication;", + "after": "impl ForeignTryFrom<&router_request_types::authentication::AuthenticationStore>\n for AuthenticationData\n{\n type Error = error_stack::Report;\n fn foreign_try_from(\n authentication_store: &router_request_types::authentication::AuthenticationStore,\n ) -> Result {\n let authentication = &authentication_store.authentication;" + }, + "commit_sha": "5310ef5a4f9f5c89dda02707ea641fc7dde2f184", + "before_imports": [ + "use common_utils::{\n errors::CustomResult,\n ext_traits::{Encode, OptionExt},\n types::{self as common_types, ConnectorTransactionIdTrait},\n};", + "pub use hyperswitch_domain_models::router_request_types::{\n AuthenticationData, SplitRefundsRequest, StripeSplitRefund, SurchargeDetails,\n};" + ], + "after_imports": [ + "use common_utils::{\n errors::CustomResult,\n ext_traits::{Encode, OptionExt},\n types::{self as common_types, ConnectorTransactionIdTrait},\n};", + "pub use hyperswitch_domain_models::router_request_types::{\n self, AuthenticationData, SplitRefundsRequest, StripeSplitRefund, SurchargeDetails,\n};" + ] + }, + { + "id": "crates/router/src/core/payments/types.rs::MultipleCaptureData::function::get_pending_connector_capture_ids", + "file": "crates/router/src/core/payments/types.rs", + "kind": "function_item", + "status": "modified", + "code_changed": false, + "imports_changed": true, + "before_code": "pub fn get_pending_connector_capture_ids(&self) -> Vec {\n let pending_connector_capture_ids = self\n .get_pending_captures()\n .into_iter()\n .filter_map(|capture| capture.get_optional_connector_transaction_id().cloned())\n .collect();\n pending_connector_capture_ids\n }", + "after_code": "pub fn get_pending_connector_capture_ids(&self) -> Vec {\n let pending_connector_capture_ids = self\n .get_pending_captures()\n .into_iter()\n .filter_map(|capture| capture.get_optional_connector_transaction_id().cloned())\n .collect();\n pending_connector_capture_ids\n }", + "diff_span": { + "before": "", + "after": "" + }, + "commit_sha": "5310ef5a4f9f5c89dda02707ea641fc7dde2f184", + "before_imports": [ + "use common_utils::{\n errors::CustomResult,\n ext_traits::{Encode, OptionExt},\n types::{self as common_types, ConnectorTransactionIdTrait},\n};", + "pub use hyperswitch_domain_models::router_request_types::{\n AuthenticationData, SplitRefundsRequest, StripeSplitRefund, SurchargeDetails,\n};" + ], + "after_imports": [ + "use common_utils::{\n errors::CustomResult,\n ext_traits::{Encode, OptionExt},\n types::{self as common_types, ConnectorTransactionIdTrait},\n};", + "pub use hyperswitch_domain_models::router_request_types::{\n self, AuthenticationData, SplitRefundsRequest, StripeSplitRefund, SurchargeDetails,\n};" + ] + }, + { + "id": "crates/router/src/core/payments/types.rs::impl::router_request_types::UcsAuthenticationData", + "file": "crates/router/src/core/payments/types.rs", + "kind": "impl_item", + "status": "added", + "before_code": null, + "after_code": "impl ForeignTryFrom<&router_request_types::authentication::AuthenticationStore>\n for router_request_types::UcsAuthenticationData\n{\n type Error = error_stack::Report;\n fn foreign_try_from(\n authentication_store: &router_request_types::authentication::AuthenticationStore,\n ) -> Result {\n let authentication = &authentication_store.authentication;\n if authentication.authentication_status == common_enums::AuthenticationStatus::Success {\n let threeds_server_transaction_id =\n authentication.threeds_server_transaction_id.clone();\n let message_version = authentication.message_version.clone();\n let cavv = authentication_store\n .cavv\n .clone()\n .get_required_value(\"cavv\")\n .change_context(errors::ApiErrorResponse::InternalServerError)\n .attach_printable(\"cavv must not be null when authentication_status is success\")?;\n Ok(Self {\n trans_status: authentication.trans_status.clone(),\n eci: authentication.eci.clone(),\n cavv: Some(cavv),\n threeds_server_transaction_id,\n message_version,\n ds_trans_id: authentication.ds_trans_id.clone(),\n acs_trans_id: authentication.acs_trans_id.clone(),\n transaction_id: authentication.connector_authentication_id.clone(),\n ucaf_collection_indicator: None,\n })\n } else {\n Err(errors::ApiErrorResponse::PaymentAuthenticationFailed { data: None }.into())\n }\n }\n}", + "diff_span": null, + "commit_sha": "5310ef5a4f9f5c89dda02707ea641fc7dde2f184" + }, + { + "id": "crates/hyperswitch_domain_models/src/router_request_types.rs::struct::UcsAuthenticationData", + "file": "crates/hyperswitch_domain_models/src/router_request_types.rs", + "kind": "struct_item", + "status": "added", + "before_code": null, + "after_code": "pub struct UcsAuthenticationData {\n pub eci: Option,\n pub cavv: Option>,\n pub threeds_server_transaction_id: Option,\n pub message_version: Option,\n pub ds_trans_id: Option,\n pub acs_trans_id: Option,\n pub trans_status: Option,\n pub transaction_id: Option,\n pub ucaf_collection_indicator: Option,\n}", + "diff_span": null, + "commit_sha": "5310ef5a4f9f5c89dda02707ea641fc7dde2f184" + }, + { + "id": "crates/router/src/core/payments/types.rs::router_request_types::UcsAuthenticationData::type::Error", + "file": "crates/router/src/core/payments/types.rs", + "kind": "type_item", + "status": "added", + "before_code": null, + "after_code": "type Error = error_stack::Report;", + "diff_span": null, + "commit_sha": "5310ef5a4f9f5c89dda02707ea641fc7dde2f184" + }, + { + "id": "crates/router/src/core/payments/types.rs::router_request_types::UcsAuthenticationData::function::foreign_try_from", + "file": "crates/router/src/core/payments/types.rs", + "kind": "function_item", + "status": "added", + "before_code": null, + "after_code": "fn foreign_try_from(\n authentication_store: &router_request_types::authentication::AuthenticationStore,\n ) -> Result {\n let authentication = &authentication_store.authentication;\n if authentication.authentication_status == common_enums::AuthenticationStatus::Success {\n let threeds_server_transaction_id =\n authentication.threeds_server_transaction_id.clone();\n let message_version = authentication.message_version.clone();\n let cavv = authentication_store\n .cavv\n .clone()\n .get_required_value(\"cavv\")\n .change_context(errors::ApiErrorResponse::InternalServerError)\n .attach_printable(\"cavv must not be null when authentication_status is success\")?;\n Ok(Self {\n trans_status: authentication.trans_status.clone(),\n eci: authentication.eci.clone(),\n cavv: Some(cavv),\n threeds_server_transaction_id,\n message_version,\n ds_trans_id: authentication.ds_trans_id.clone(),\n acs_trans_id: authentication.acs_trans_id.clone(),\n transaction_id: authentication.connector_authentication_id.clone(),\n ucaf_collection_indicator: None,\n })\n } else {\n Err(errors::ApiErrorResponse::PaymentAuthenticationFailed { data: None }.into())\n }\n }", + "diff_span": null, + "commit_sha": "5310ef5a4f9f5c89dda02707ea641fc7dde2f184" + }, + { + "id": "crates/router/src/core/unified_connector_service/transformers.rs::impl::router_request_types::UcsAuthenticationData", + "file": "crates/router/src/core/unified_connector_service/transformers.rs", + "kind": "impl_item", + "status": "added", + "before_code": null, + "after_code": "impl transformers::ForeignTryFrom\n for router_request_types::UcsAuthenticationData\n{\n type Error = error_stack::Report;\n fn foreign_try_from(response: payments_grpc::AuthenticationData) -> Result {\n let payments_grpc::AuthenticationData {\n eci,\n cavv,\n threeds_server_transaction_id,\n message_version,\n ds_transaction_id,\n trans_status,\n acs_transaction_id,\n transaction_id,\n ucaf_collection_indicator,\n } = response;\n let trans_status = trans_status\n .map(payments_grpc::TransactionStatus::try_from)\n .transpose()\n .change_context(UnifiedConnectorServiceError::ResponseDeserializationFailed)\n .attach_printable(\"Failed to convert TransactionStatus from grpc to domain\")?\n .map(ForeignFrom::foreign_from);\n Ok(Self {\n trans_status,\n eci,\n cavv: cavv.map(masking::Secret::new),\n threeds_server_transaction_id: threeds_server_transaction_id\n .and_then(|id| id.id_type)\n .and_then(|id_type| match id_type {\n payments_grpc::identifier::IdType::Id(id) => Some(id),\n payments_grpc::identifier::IdType::EncodedData(encoded_data) => {\n Some(encoded_data)\n }\n payments_grpc::identifier::IdType::NoResponseIdMarker(_) => None,\n }),\n message_version: message_version\n .map(|message_version_str| {\n types::SemanticVersion::from_str(message_version_str.as_ref())\n .change_context(UnifiedConnectorServiceError::ResponseDeserializationFailed)\n .attach_printable(\"Failed to Deserialize message_version\")\n })\n .transpose()?,\n ds_trans_id: ds_transaction_id,\n acs_trans_id: acs_transaction_id,\n transaction_id,\n ucaf_collection_indicator,\n })\n }\n}", + "diff_span": null, + "commit_sha": "5310ef5a4f9f5c89dda02707ea641fc7dde2f184" + }, + { + "id": "crates/router/src/core/unified_connector_service/transformers.rs::router_request_types::UcsAuthenticationData::function::foreign_try_from", + "file": "crates/router/src/core/unified_connector_service/transformers.rs", + "kind": "function_item", + "status": "added", + "before_code": null, + "after_code": "fn foreign_try_from(response: payments_grpc::AuthenticationData) -> Result {\n let payments_grpc::AuthenticationData {\n eci,\n cavv,\n threeds_server_transaction_id,\n message_version,\n ds_transaction_id,\n trans_status,\n acs_transaction_id,\n transaction_id,\n ucaf_collection_indicator,\n } = response;\n let trans_status = trans_status\n .map(payments_grpc::TransactionStatus::try_from)\n .transpose()\n .change_context(UnifiedConnectorServiceError::ResponseDeserializationFailed)\n .attach_printable(\"Failed to convert TransactionStatus from grpc to domain\")?\n .map(ForeignFrom::foreign_from);\n Ok(Self {\n trans_status,\n eci,\n cavv: cavv.map(masking::Secret::new),\n threeds_server_transaction_id: threeds_server_transaction_id\n .and_then(|id| id.id_type)\n .and_then(|id_type| match id_type {\n payments_grpc::identifier::IdType::Id(id) => Some(id),\n payments_grpc::identifier::IdType::EncodedData(encoded_data) => {\n Some(encoded_data)\n }\n payments_grpc::identifier::IdType::NoResponseIdMarker(_) => None,\n }),\n message_version: message_version\n .map(|message_version_str| {\n types::SemanticVersion::from_str(message_version_str.as_ref())\n .change_context(UnifiedConnectorServiceError::ResponseDeserializationFailed)\n .attach_printable(\"Failed to Deserialize message_version\")\n })\n .transpose()?,\n ds_trans_id: ds_transaction_id,\n acs_trans_id: acs_transaction_id,\n transaction_id,\n ucaf_collection_indicator,\n })\n }", + "diff_span": null, + "commit_sha": "5310ef5a4f9f5c89dda02707ea641fc7dde2f184" + }, + { + "id": "crates/router/src/core/unified_connector_service/transformers.rs::router_request_types::UcsAuthenticationData::type::Error", + "file": "crates/router/src/core/unified_connector_service/transformers.rs", + "kind": "type_item", + "status": "added", + "before_code": null, + "after_code": "type Error = error_stack::Report;", + "diff_span": null, + "commit_sha": "5310ef5a4f9f5c89dda02707ea641fc7dde2f184" + }, + { + "id": "crates/router/src/core/unified_connector_service/transformers.rs::impl::AuthenticationData", + "file": "crates/router/src/core/unified_connector_service/transformers.rs", + "kind": "impl_item", + "status": "removed", + "before_code": "impl transformers::ForeignTryFrom for AuthenticationData {\n type Error = error_stack::Report;\n fn foreign_try_from(response: payments_grpc::AuthenticationData) -> Result {\n let payments_grpc::AuthenticationData {\n eci,\n cavv,\n threeds_server_transaction_id,\n message_version,\n ds_transaction_id,\n trans_status,\n acs_transaction_id,\n transaction_id,\n ucaf_collection_indicator,\n } = response;\n let trans_status = trans_status\n .map(payments_grpc::TransactionStatus::try_from)\n .transpose()\n .change_context(UnifiedConnectorServiceError::ResponseDeserializationFailed)\n .attach_printable(\"Failed to convert TransactionStatus from grpc to domain\")?\n .map(ForeignFrom::foreign_from);\n Ok(Self {\n trans_status,\n eci,\n cavv: cavv.map(masking::Secret::new).unwrap_or_default(),\n threeds_server_transaction_id: threeds_server_transaction_id\n .and_then(|id| id.id_type)\n .and_then(|id_type| match id_type {\n payments_grpc::identifier::IdType::Id(id) => Some(id),\n payments_grpc::identifier::IdType::EncodedData(encoded_data) => {\n Some(encoded_data)\n }\n payments_grpc::identifier::IdType::NoResponseIdMarker(_) => None,\n }),\n message_version: message_version\n .map(|message_version_str| {\n types::SemanticVersion::from_str(message_version_str.as_ref())\n .change_context(UnifiedConnectorServiceError::ResponseDeserializationFailed)\n .attach_printable(\"Failed to Deserialize message_version\")\n })\n .transpose()?,\n ds_trans_id: ds_transaction_id,\n created_at: time::PrimitiveDateTime::MIN,\n challenge_code: None,\n challenge_cancel: None,\n challenge_code_reason: None,\n message_extension: None,\n acs_trans_id: acs_transaction_id,\n authentication_type: None,\n transaction_id,\n ucaf_collection_indicator,\n })\n }\n}", + "after_code": null, + "diff_span": null, + "commit_sha": "5310ef5a4f9f5c89dda02707ea641fc7dde2f184" + }, + { + "id": "crates/router/src/core/unified_connector_service/transformers.rs::AuthenticationData::type::Error", + "file": "crates/router/src/core/unified_connector_service/transformers.rs", + "kind": "type_item", + "status": "removed", + "before_code": "type Error = error_stack::Report;", + "after_code": null, + "diff_span": null, + "commit_sha": "5310ef5a4f9f5c89dda02707ea641fc7dde2f184" + }, + { + "id": "crates/router/src/core/unified_connector_service/transformers.rs::AuthenticationData::function::foreign_try_from", + "file": "crates/router/src/core/unified_connector_service/transformers.rs", + "kind": "function_item", + "status": "removed", + "before_code": "fn foreign_try_from(response: payments_grpc::AuthenticationData) -> Result {\n let payments_grpc::AuthenticationData {\n eci,\n cavv,\n threeds_server_transaction_id,\n message_version,\n ds_transaction_id,\n trans_status,\n acs_transaction_id,\n transaction_id,\n ucaf_collection_indicator,\n } = response;\n let trans_status = trans_status\n .map(payments_grpc::TransactionStatus::try_from)\n .transpose()\n .change_context(UnifiedConnectorServiceError::ResponseDeserializationFailed)\n .attach_printable(\"Failed to convert TransactionStatus from grpc to domain\")?\n .map(ForeignFrom::foreign_from);\n Ok(Self {\n trans_status,\n eci,\n cavv: cavv.map(masking::Secret::new).unwrap_or_default(),\n threeds_server_transaction_id: threeds_server_transaction_id\n .and_then(|id| id.id_type)\n .and_then(|id_type| match id_type {\n payments_grpc::identifier::IdType::Id(id) => Some(id),\n payments_grpc::identifier::IdType::EncodedData(encoded_data) => {\n Some(encoded_data)\n }\n payments_grpc::identifier::IdType::NoResponseIdMarker(_) => None,\n }),\n message_version: message_version\n .map(|message_version_str| {\n types::SemanticVersion::from_str(message_version_str.as_ref())\n .change_context(UnifiedConnectorServiceError::ResponseDeserializationFailed)\n .attach_printable(\"Failed to Deserialize message_version\")\n })\n .transpose()?,\n ds_trans_id: ds_transaction_id,\n created_at: time::PrimitiveDateTime::MIN,\n challenge_code: None,\n challenge_cancel: None,\n challenge_code_reason: None,\n message_extension: None,\n acs_trans_id: acs_transaction_id,\n authentication_type: None,\n transaction_id,\n ucaf_collection_indicator,\n })\n }", + "after_code": null, + "diff_span": null, + "commit_sha": "5310ef5a4f9f5c89dda02707ea641fc7dde2f184" + } + ] +} \ No newline at end of file