Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation
Rust adyenbeginner-friendlyfeaturedfinancefintechhacktoberfesthigh-performanceopen-sourceorchestrationpaymentpayment-gatewaypayment-integrationpayment-processingpaymentspayments-platformrestful-apirustsdkstripeworks-with-react
fix(ucs): Handling Unspecified Payment status from UCS (#11057)
Yashasvi Kapil00f0b71e1b7f
diff --git a/crates/hyperswitch_interfaces/src/unified_connector_service.rs b/crates/hyperswitch_interfaces/src/unified_connector_service.rsindex 0547bd9980..fe241bf433 100644--- a/crates/hyperswitch_interfaces/src/unified_connector_service.rs+++ b/crates/hyperswitch_interfaces/src/unified_connector_service.rs@@ -27,11 +27,15 @@ type UnifiedConnectorServiceResult = CustomResult<#[allow(missing_docs)]pub fn handle_unified_connector_service_response_for_payment_get(response: payments_grpc::PaymentServiceGetResponse,+ prev_status: AttemptStatus,) -> UnifiedConnectorServiceResult {let status_code = transformers::convert_connector_service_status_code(response.status_code)?;let router_data_response =- Result::<(PaymentsResponseData, AttemptStatus), ErrorResponse>::foreign_try_from(response)?;+ Result::<(PaymentsResponseData, AttemptStatus), ErrorResponse>::foreign_try_from((+ response,+ prev_status,+ ))?;Ok((router_data_response, status_code))}diff --git a/crates/hyperswitch_interfaces/src/unified_connector_service/transformers.rs b/crates/hyperswitch_interfaces/src/unified_connector_service/transformers.rsindex 1da534fc69..68ba76ba42 100644--- a/crates/hyperswitch_interfaces/src/unified_connector_service/transformers.rs+++ b/crates/hyperswitch_interfaces/src/unified_connector_service/transformers.rs@@ -179,13 +179,13 @@ pub struct WebhookTransformData {pub webhook_transformation_status: WebhookTransformationStatus,}-impl ForeignTryFrom<payments_grpc::PaymentServiceGetResponse>+impl ForeignTryFrom<(payments_grpc::PaymentServiceGetResponse, AttemptStatus)>for Result<(PaymentsResponseData, AttemptStatus), ErrorResponse>{type Error = error_stack::Report<UnifiedConnectorServiceError>;fn foreign_try_from(- response: payments_grpc::PaymentServiceGetResponse,+ (response, prev_status): (payments_grpc::PaymentServiceGetResponse, AttemptStatus),) -> Result<Self, Self::Error> {let connector_response_reference_id =response.response_ref_id.as_ref().and_then(|identifier| {@@ -212,7 +212,10 @@ impl ForeignTryFrom<payments_grpc::PaymentServiceGetResponse>let response = if response.error_code.is_some() {let attempt_status = match response.status() {payments_grpc::PaymentStatus::AttemptStatusUnspecified => None,- _ => Some(AttemptStatus::foreign_try_from(response.status())?),+ _ => Some(AttemptStatus::foreign_try_from((+ response.status(),+ prev_status,+ ))?),};Err(ErrorResponse {@@ -229,7 +232,7 @@ impl ForeignTryFrom<payments_grpc::PaymentServiceGetResponse>connector_metadata: None,})} else {- let status = AttemptStatus::foreign_try_from(response.status())?;+ let status = AttemptStatus::foreign_try_from((response.status(), prev_status))?;Ok((PaymentsResponseData::TransactionResponse {@@ -258,10 +261,12 @@ impl ForeignTryFrom<payments_grpc::PaymentServiceGetResponse>}}-impl ForeignTryFrom<payments_grpc::PaymentStatus> for AttemptStatus {+impl ForeignTryFrom<(payments_grpc::PaymentStatus, Self)> for AttemptStatus {type Error = error_stack::Report<UnifiedConnectorServiceError>;- fn foreign_try_from(grpc_status: payments_grpc::PaymentStatus) -> Result<Self, Self::Error> {+ fn foreign_try_from(+ (grpc_status, prev_status): (payments_grpc::PaymentStatus, Self),+ ) -> Result<Self, Self::Error> {match grpc_status {payments_grpc::PaymentStatus::Started => Ok(Self::Started),payments_grpc::PaymentStatus::AuthenticationFailed => Ok(Self::AuthenticationFailed),@@ -294,7 +299,7 @@ impl ForeignTryFrom<payments_grpc::PaymentStatus> for AttemptStatus {Ok(Self::DeviceDataCollectionPending)}payments_grpc::PaymentStatus::VoidedPostCapture => Ok(Self::Voided),- payments_grpc::PaymentStatus::AttemptStatusUnspecified => Ok(Self::Unresolved),+ payments_grpc::PaymentStatus::AttemptStatusUnspecified => Ok(prev_status),payments_grpc::PaymentStatus::PartiallyAuthorized => Ok(Self::PartiallyAuthorized),payments_grpc::PaymentStatus::Expired => Ok(Self::Expired),}diff --git a/crates/router/src/core/payments/flows/authorize_flow.rs b/crates/router/src/core/payments/flows/authorize_flow.rsindex 7f1887c236..4b5512a8aa 100644--- a/crates/router/src/core/payments/flows/authorize_flow.rs+++ b/crates/router/src/core/payments/flows/authorize_flow.rs@@ -1235,6 +1235,7 @@ pub async fn call_unified_connector_service_pre_authenticate(let (router_data_response, status_code) =unified_connector_service::handle_unified_connector_service_response_for_payment_pre_authenticate(payment_pre_authenticate_response.clone(),+ router_data.status,).attach_printable("Failed to deserialize UCS response")?;diff --git a/crates/router/src/core/payments/flows/complete_authorize_flow.rs b/crates/router/src/core/payments/flows/complete_authorize_flow.rsindex 03d2e96bf3..840b1a7026 100644--- a/crates/router/src/core/payments/flows/complete_authorize_flow.rs+++ b/crates/router/src/core/payments/flows/complete_authorize_flow.rs@@ -686,6 +686,7 @@ pub async fn call_unified_connector_service_authenticate(let (router_data_response, status_code) =ucs_core::handle_unified_connector_service_response_for_payment_authenticate(payment_authenticate_response.clone(),+ router_data.status,).attach_printable("Failed to deserialize UCS response")?;@@ -792,6 +793,7 @@ pub async fn call_unified_connector_service_post_authenticate(let (router_data_response, status_code) =ucs_core::handle_unified_connector_service_response_for_payment_post_authenticate(payment_post_authenticate_response.clone(),+ router_data.status,).attach_printable("Failed to deserialize UCS response")?;diff --git a/crates/router/src/core/payments/flows/external_proxy_flow.rs b/crates/router/src/core/payments/flows/external_proxy_flow.rsindex 9b76136655..e6a78c7549 100644--- a/crates/router/src/core/payments/flows/external_proxy_flow.rs+++ b/crates/router/src/core/payments/flows/external_proxy_flow.rs@@ -423,6 +423,7 @@ impl Feature<api::ExternalVaultProxy, types::ExternalVaultProxyPaymentsData>let ucs_data =unified_connector_service::handle_unified_connector_service_response_for_payment_authorize(payment_authorize_response.clone(),+ router_data.status,).change_context(ApiErrorResponse::InternalServerError).attach_printable("Failed to deserialize UCS response")?;diff --git a/crates/router/src/core/payments/gateway/authorize_gateway.rs b/crates/router/src/core/payments/gateway/authorize_gateway.rsindex c6aa559731..0b2cc00bb7 100644--- a/crates/router/src/core/payments/gateway/authorize_gateway.rs+++ b/crates/router/src/core/payments/gateway/authorize_gateway.rs@@ -141,6 +141,7 @@ wherelet ucs_data = handle_unified_connector_service_response_for_payment_repeat(payment_repeat_response.clone(),+ router_data.status,).attach_printable("Failed to deserialize UCS response")?;@@ -211,6 +212,7 @@ wherelet ucs_data = handle_unified_connector_service_response_for_payment_authorize(payment_authorize_response.clone(),+ router_data.status,).attach_printable("Failed to deserialize UCS response")?;diff --git a/crates/router/src/core/payments/gateway/cancel_gateway.rs b/crates/router/src/core/payments/gateway/cancel_gateway.rsindex 25124bce24..7d170180af 100644--- a/crates/router/src/core/payments/gateway/cancel_gateway.rs+++ b/crates/router/src/core/payments/gateway/cancel_gateway.rs@@ -119,6 +119,7 @@ wherelet (router_data_response, status_code) =unified_connector_service::handle_unified_connector_service_response_for_payment_cancel(payment_void_response.clone(),+ router_data.status,).attach_printable("Failed to deserialize UCS response")?;diff --git a/crates/router/src/core/payments/gateway/capture_gateway.rs b/crates/router/src/core/payments/gateway/capture_gateway.rsindex 25df563df8..21802e8d82 100644--- a/crates/router/src/core/payments/gateway/capture_gateway.rs+++ b/crates/router/src/core/payments/gateway/capture_gateway.rs@@ -120,6 +120,7 @@ wherelet (router_data_response, status_code) =unified_connector_service::handle_unified_connector_service_response_for_payment_capture(payment_capture_response.clone(),+ router_data.status,).attach_printable("Failed to deserialize UCS response")?;diff --git a/crates/router/src/core/payments/gateway/complete_authorize_gateway.rs b/crates/router/src/core/payments/gateway/complete_authorize_gateway.rsindex b4cc05c85c..feb41aad29 100644--- a/crates/router/src/core/payments/gateway/complete_authorize_gateway.rs+++ b/crates/router/src/core/payments/gateway/complete_authorize_gateway.rs@@ -125,6 +125,7 @@ wherelet ucs_data = handle_unified_connector_service_response_for_payment_authorize(payment_authorize_response.clone(),+ router_data.status,).attach_printable("Failed to deserialize UCS response")?;diff --git a/crates/router/src/core/payments/gateway/psync_gateway.rs b/crates/router/src/core/payments/gateway/psync_gateway.rsindex 924da4d143..499f2742aa 100644--- a/crates/router/src/core/payments/gateway/psync_gateway.rs+++ b/crates/router/src/core/payments/gateway/psync_gateway.rs@@ -148,6 +148,7 @@ wherelet (router_data_response, status_code) =handle_unified_connector_service_response_for_payment_get(payment_get_response.clone(),+ router_data.status,).attach_printable("Failed to deserialize UCS response")?;diff --git a/crates/router/src/core/payments/gateway/setup_mandate.rs b/crates/router/src/core/payments/gateway/setup_mandate.rsindex 36bd5a5992..37c04673b0 100644--- a/crates/router/src/core/payments/gateway/setup_mandate.rs+++ b/crates/router/src/core/payments/gateway/setup_mandate.rs@@ -121,6 +121,7 @@ wherelet ucs_data = handle_unified_connector_service_response_for_payment_register(setup_mandate_response.clone(),+ router_data.status,).attach_printable("Failed to deserialize UCS response")?;diff --git a/crates/router/src/core/unified_connector_service.rs b/crates/router/src/core/unified_connector_service.rsindex 470bbb816d..80a7488694 100644--- a/crates/router/src/core/unified_connector_service.rs+++ b/crates/router/src/core/unified_connector_service.rs@@ -1395,13 +1395,15 @@ pub fn build_unified_connector_service_external_vault_proxy_metadata(pub fn handle_unified_connector_service_response_for_payment_authorize(response: PaymentServiceAuthorizeResponse,+ prev_status: AttemptStatus,) -> CustomResult<UcsAuthorizeResponseData, UnifiedConnectorServiceError> {let status_code = transformers::convert_connector_service_status_code(response.status_code)?;let router_data_response =- Result::<(PaymentsResponseData, AttemptStatus), ErrorResponse>::foreign_try_from(+ Result::<(PaymentsResponseData, AttemptStatus), ErrorResponse>::foreign_try_from((response.clone(),- )?;+ prev_status,+ ))?;let connector_customer_id =extract_connector_customer_id_from_ucs_state(response.state.as_ref());@@ -1442,11 +1444,15 @@ pub fn handle_unified_connector_service_response_for_create_order(pub fn handle_unified_connector_service_response_for_payment_post_authenticate(response: payments_grpc::PaymentServicePostAuthenticateResponse,+ prev_status: AttemptStatus,) -> UnifiedConnectorServiceResult {let status_code = transformers::convert_connector_service_status_code(response.status_code)?;let router_data_response =- Result::<(PaymentsResponseData, AttemptStatus), ErrorResponse>::foreign_try_from(response)?;+ Result::<(PaymentsResponseData, AttemptStatus), ErrorResponse>::foreign_try_from((+ response,+ prev_status,+ ))?;Ok((router_data_response, status_code))}@@ -1489,46 +1495,60 @@ pub fn handle_unified_connector_service_response_for_incremental_authorization(pub fn handle_unified_connector_service_response_for_payment_authenticate(response: payments_grpc::PaymentServiceAuthenticateResponse,+ prev_status: AttemptStatus,) -> UnifiedConnectorServiceResult {let status_code = transformers::convert_connector_service_status_code(response.status_code)?;let router_data_response =- Result::<(PaymentsResponseData, AttemptStatus), ErrorResponse>::foreign_try_from(response)?;+ Result::<(PaymentsResponseData, AttemptStatus), ErrorResponse>::foreign_try_from((+ response,+ prev_status,+ ))?;Ok((router_data_response, status_code))}pub fn handle_unified_connector_service_response_for_payment_pre_authenticate(response: payments_grpc::PaymentServicePreAuthenticateResponse,+ prev_status: AttemptStatus,) -> UnifiedConnectorServiceResult {let status_code = transformers::convert_connector_service_status_code(response.status_code)?;let router_data_response =- Result::<(PaymentsResponseData, AttemptStatus), ErrorResponse>::foreign_try_from(response)?;+ Result::<(PaymentsResponseData, AttemptStatus), ErrorResponse>::foreign_try_from((+ response,+ prev_status,+ ))?;Ok((router_data_response, status_code))}pub fn handle_unified_connector_service_response_for_payment_capture(response: payments_grpc::PaymentServiceCaptureResponse,+ prev_status: AttemptStatus,) -> UnifiedConnectorServiceResult {let status_code = transformers::convert_connector_service_status_code(response.status_code)?;let router_data_response =- Result::<(PaymentsResponseData, AttemptStatus), ErrorResponse>::foreign_try_from(response)?;+ Result::<(PaymentsResponseData, AttemptStatus), ErrorResponse>::foreign_try_from((+ response,+ prev_status,+ ))?;Ok((router_data_response, status_code))}pub fn handle_unified_connector_service_response_for_payment_register(response: payments_grpc::PaymentServiceRegisterResponse,+ prev_status: AttemptStatus,) -> CustomResult<UcsSetupMandateResponseData, UnifiedConnectorServiceError> {let status_code = transformers::convert_connector_service_status_code(response.status_code)?;let router_data_response =- Result::<(PaymentsResponseData, AttemptStatus), ErrorResponse>::foreign_try_from(+ Result::<(PaymentsResponseData, AttemptStatus), ErrorResponse>::foreign_try_from((response.clone(),- )?;+ prev_status,+ ))?;let connector_customer_id =extract_connector_customer_id_from_ucs_state(response.state.as_ref());@@ -1557,13 +1577,15 @@ pub fn handle_unified_connector_service_response_for_session_token_create(pub fn handle_unified_connector_service_response_for_payment_repeat(response: payments_grpc::PaymentServiceRepeatEverythingResponse,+ prev_status: AttemptStatus,) -> CustomResult<UcsRepeatPaymentResponseData, UnifiedConnectorServiceError> {let status_code = transformers::convert_connector_service_status_code(response.status_code)?;let router_data_response =- Result::<(PaymentsResponseData, AttemptStatus), ErrorResponse>::foreign_try_from(+ Result::<(PaymentsResponseData, AttemptStatus), ErrorResponse>::foreign_try_from((response.clone(),- )?;+ prev_status,+ ))?;let connector_customer_id =extract_connector_customer_id_from_ucs_state(response.state.as_ref());@@ -1631,11 +1653,15 @@ pub fn handle_unified_connector_service_response_for_refund_sync(pub fn handle_unified_connector_service_response_for_payment_cancel(response: payments_grpc::PaymentServiceVoidResponse,+ prev_status: AttemptStatus,) -> UnifiedConnectorServiceResult {let status_code = transformers::convert_connector_service_status_code(response.status_code)?;let router_data_response =- Result::<(PaymentsResponseData, AttemptStatus), ErrorResponse>::foreign_try_from(response)?;+ Result::<(PaymentsResponseData, AttemptStatus), ErrorResponse>::foreign_try_from((+ response,+ prev_status,+ ))?;Ok((router_data_response, status_code))}diff --git a/crates/router/src/core/unified_connector_service/transformers.rs b/crates/router/src/core/unified_connector_service/transformers.rsindex 3dd7ea3ebc..bc83a72744 100644--- a/crates/router/src/core/unified_connector_service/transformers.rs+++ b/crates/router/src/core/unified_connector_service/transformers.rs@@ -2111,12 +2111,18 @@ impl}}-impl transformers::ForeignTryFrom<payments_grpc::PaymentServicePreAuthenticateResponse>- for Result<(PaymentsResponseData, AttemptStatus), ErrorResponse>+impl+ transformers::ForeignTryFrom<(+ payments_grpc::PaymentServicePreAuthenticateResponse,+ AttemptStatus,+ )> for Result<(PaymentsResponseData, AttemptStatus), ErrorResponse>{type Error = error_stack::Report<UnifiedConnectorServiceError>;fn foreign_try_from(- response: payments_grpc::PaymentServicePreAuthenticateResponse,+ (response, prev_status): (+ payments_grpc::PaymentServicePreAuthenticateResponse,+ AttemptStatus,+ ),) -> Result<Self, Self::Error> {let connector_response_reference_id =response.response_ref_id.as_ref().and_then(|identifier| {@@ -2159,7 +2165,10 @@ impl transformers::ForeignTryFrom<payments_grpc::PaymentServicePreAuthenticateRelet response = if response.error_code.is_some() {let attempt_status = match response.status() {payments_grpc::PaymentStatus::AttemptStatusUnspecified => None,- _ => Some(AttemptStatus::foreign_try_from(response.status())?),+ _ => Some(AttemptStatus::foreign_try_from((+ response.status(),+ prev_status,+ ))?),};Err(ErrorResponse {@@ -2176,7 +2185,7 @@ impl transformers::ForeignTryFrom<payments_grpc::PaymentServicePreAuthenticateReconnector_metadata: None,})} else {- let status = AttemptStatus::foreign_try_from(response.status())?;+ let status = AttemptStatus::foreign_try_from((response.status(), prev_status))?;Ok((PaymentsResponseData::TransactionResponse {@@ -2198,13 +2207,19 @@ impl transformers::ForeignTryFrom<payments_grpc::PaymentServicePreAuthenticateRe}}-impl transformers::ForeignTryFrom<payments_grpc::PaymentServiceAuthorizeResponse>- for Result<(PaymentsResponseData, AttemptStatus), ErrorResponse>+impl+ transformers::ForeignTryFrom<(+ payments_grpc::PaymentServiceAuthorizeResponse,+ AttemptStatus,+ )> for Result<(PaymentsResponseData, AttemptStatus), ErrorResponse>{type Error = error_stack::Report<UnifiedConnectorServiceError>;fn foreign_try_from(- response: payments_grpc::PaymentServiceAuthorizeResponse,+ (response, prev_status): (+ payments_grpc::PaymentServiceAuthorizeResponse,+ AttemptStatus,+ ),) -> Result<Self, Self::Error> {let connector_response_reference_id =response.response_ref_id.as_ref().and_then(|identifier| {@@ -2332,7 +2347,10 @@ impl transformers::ForeignTryFrom<payments_grpc::PaymentServiceAuthorizeResponselet response = if response.error_code.is_some() {let attempt_status = match response.status() {payments_grpc::PaymentStatus::AttemptStatusUnspecified => None,- _ => Some(AttemptStatus::foreign_try_from(response.status())?),+ _ => Some(AttemptStatus::foreign_try_from((+ response.status(),+ prev_status,+ ))?),};Err(ErrorResponse {@@ -2349,7 +2367,7 @@ impl transformers::ForeignTryFrom<payments_grpc::PaymentServiceAuthorizeResponseconnector_metadata: None,})} else {- let status = AttemptStatus::foreign_try_from(response.status())?;+ let status = AttemptStatus::foreign_try_from((response.status(), prev_status))?;Ok((PaymentsResponseData::TransactionResponse {@@ -2379,13 +2397,13 @@ impl transformers::ForeignTryFrom<payments_grpc::PaymentServiceAuthorizeResponse}}-impl transformers::ForeignTryFrom<payments_grpc::PaymentServiceCaptureResponse>+impl transformers::ForeignTryFrom<(payments_grpc::PaymentServiceCaptureResponse, AttemptStatus)>for Result<(PaymentsResponseData, AttemptStatus), ErrorResponse>{type Error = error_stack::Report<UnifiedConnectorServiceError>;fn foreign_try_from(- response: payments_grpc::PaymentServiceCaptureResponse,+ (response, prev_status): (payments_grpc::PaymentServiceCaptureResponse, AttemptStatus),) -> Result<Self, Self::Error> {let connector_response_reference_id =response.response_ref_id.as_ref().and_then(|identifier| {@@ -2437,7 +2455,10 @@ impl transformers::ForeignTryFrom<payments_grpc::PaymentServiceCaptureResponse>let response = if response.error_code.is_some() {let attempt_status = match response.status() {payments_grpc::PaymentStatus::AttemptStatusUnspecified => None,- _ => Some(AttemptStatus::foreign_try_from(response.status())?),+ _ => Some(AttemptStatus::foreign_try_from((+ response.status(),+ prev_status,+ ))?),};Err(ErrorResponse {code: response.error_code().to_owned(),@@ -2453,7 +2474,7 @@ impl transformers::ForeignTryFrom<payments_grpc::PaymentServiceCaptureResponse>connector_metadata: None,})} else {- let status = AttemptStatus::foreign_try_from(response.status())?;+ let status = AttemptStatus::foreign_try_from((response.status(), prev_status))?;Ok((PaymentsResponseData::TransactionResponse {resource_id,@@ -2523,13 +2544,13 @@ impl transformers::ForeignTryFrom<payments_grpc::PaymentServiceCreateConnectorCu}}-impl transformers::ForeignTryFrom<payments_grpc::PaymentServiceRegisterResponse>+impl transformers::ForeignTryFrom<(payments_grpc::PaymentServiceRegisterResponse, AttemptStatus)>for Result<(PaymentsResponseData, AttemptStatus), ErrorResponse>{type Error = error_stack::Report<UnifiedConnectorServiceError>;fn foreign_try_from(- response: payments_grpc::PaymentServiceRegisterResponse,+ (response, prev_status): (payments_grpc::PaymentServiceRegisterResponse, AttemptStatus),) -> Result<Self, Self::Error> {let connector_response_reference_id =response.response_ref_id.as_ref().and_then(|identifier| {@@ -2566,7 +2587,10 @@ impl transformers::ForeignTryFrom<payments_grpc::PaymentServiceRegisterResponse>let response = if response.error_code.is_some() {let attempt_status = match response.status() {payments_grpc::PaymentStatus::AttemptStatusUnspecified => None,- _ => Some(AttemptStatus::foreign_try_from(response.status())?),+ _ => Some(AttemptStatus::foreign_try_from((+ response.status(),+ prev_status,+ ))?),};Err(ErrorResponse {code: response.error_code().to_owned(),@@ -2582,7 +2606,7 @@ impl transformers::ForeignTryFrom<payments_grpc::PaymentServiceRegisterResponse>connector_metadata: None,})} else {- let status = AttemptStatus::foreign_try_from(response.status())?;+ let status = AttemptStatus::foreign_try_from((response.status(), prev_status))?;// Extract connector_metadata from response if presentlet connector_metadata = response.connector_metadata.clone().and_then(|secret| {@@ -2633,13 +2657,19 @@ impl transformers::ForeignTryFrom<payments_grpc::PaymentServiceRegisterResponse>}}-impl transformers::ForeignTryFrom<payments_grpc::PaymentServiceRepeatEverythingResponse>- for Result<(PaymentsResponseData, AttemptStatus), ErrorResponse>+impl+ transformers::ForeignTryFrom<(+ payments_grpc::PaymentServiceRepeatEverythingResponse,+ AttemptStatus,+ )> for Result<(PaymentsResponseData, AttemptStatus), ErrorResponse>{type Error = error_stack::Report<UnifiedConnectorServiceError>;fn foreign_try_from(- response: payments_grpc::PaymentServiceRepeatEverythingResponse,+ (response, prev_status): (+ payments_grpc::PaymentServiceRepeatEverythingResponse,+ AttemptStatus,+ ),) -> Result<Self, Self::Error> {let connector_response_reference_id =response.response_ref_id.as_ref().and_then(|identifier| {@@ -2691,7 +2721,10 @@ impl transformers::ForeignTryFrom<payments_grpc::PaymentServiceRepeatEverythingRlet response = if response.error_code.is_some() {let attempt_status = match response.status() {payments_grpc::PaymentStatus::AttemptStatusUnspecified => None,- _ => Some(AttemptStatus::foreign_try_from(response.status())?),+ _ => Some(AttemptStatus::foreign_try_from((+ response.status(),+ prev_status,+ ))?),};Err(ErrorResponse {code: response.error_code().to_owned(),@@ -2707,7 +2740,7 @@ impl transformers::ForeignTryFrom<payments_grpc::PaymentServiceRepeatEverythingRconnector_metadata: None,})} else {- let status = AttemptStatus::foreign_try_from(response.status())?;+ let status = AttemptStatus::foreign_try_from((response.status(), prev_status))?;Ok((PaymentsResponseData::TransactionResponse {@@ -3720,12 +3753,18 @@ impl transformers::ForeignTryFrom<storage_enums::FutureUsage> for payments_grpc:}}-impl transformers::ForeignTryFrom<payments_grpc::PaymentServicePostAuthenticateResponse>- for Result<(PaymentsResponseData, AttemptStatus), ErrorResponse>+impl+ transformers::ForeignTryFrom<(+ payments_grpc::PaymentServicePostAuthenticateResponse,+ AttemptStatus,+ )> for Result<(PaymentsResponseData, AttemptStatus), ErrorResponse>{type Error = error_stack::Report<UnifiedConnectorServiceError>;fn foreign_try_from(- response: payments_grpc::PaymentServicePostAuthenticateResponse,+ (response, prev_status): (+ payments_grpc::PaymentServicePostAuthenticateResponse,+ AttemptStatus,+ ),) -> Result<Self, Self::Error> {let connector_response_reference_id =response.response_ref_id.as_ref().and_then(|identifier| {@@ -3798,7 +3837,10 @@ impl transformers::ForeignTryFrom<payments_grpc::PaymentServicePostAuthenticateRlet response = if response.error_code.is_some() {let attempt_status = match response.status() {payments_grpc::PaymentStatus::AttemptStatusUnspecified => None,- _ => Some(AttemptStatus::foreign_try_from(response.status())?),+ _ => Some(AttemptStatus::foreign_try_from((+ response.status(),+ prev_status,+ ))?),};Err(ErrorResponse {@@ -3815,7 +3857,7 @@ impl transformers::ForeignTryFrom<payments_grpc::PaymentServicePostAuthenticateRconnector_metadata: None,})} else {- let status = AttemptStatus::foreign_try_from(response.status())?;+ let status = AttemptStatus::foreign_try_from((response.status(), prev_status))?;Ok((PaymentsResponseData::TransactionResponse {@@ -4707,12 +4749,18 @@ impl transformers::ForeignTryFrom<payments_grpc::GpayTransactionInfo> for GpayTr}}-impl transformers::ForeignTryFrom<payments_grpc::PaymentServiceAuthenticateResponse>- for Result<(PaymentsResponseData, AttemptStatus), ErrorResponse>+impl+ transformers::ForeignTryFrom<(+ payments_grpc::PaymentServiceAuthenticateResponse,+ AttemptStatus,+ )> for Result<(PaymentsResponseData, AttemptStatus), ErrorResponse>{type Error = error_stack::Report<UnifiedConnectorServiceError>;fn foreign_try_from(- response: payments_grpc::PaymentServiceAuthenticateResponse,+ (response, prev_status): (+ payments_grpc::PaymentServiceAuthenticateResponse,+ AttemptStatus,+ ),) -> Result<Self, Self::Error> {let connector_response_reference_id =response.response_ref_id.as_ref().and_then(|identifier| {@@ -4784,7 +4832,10 @@ impl transformers::ForeignTryFrom<payments_grpc::PaymentServiceAuthenticateRespolet response = if response.error_code.is_some() {let attempt_status = match response.status() {payments_grpc::PaymentStatus::AttemptStatusUnspecified => None,- _ => Some(AttemptStatus::foreign_try_from(response.status())?),+ _ => Some(AttemptStatus::foreign_try_from((+ response.status(),+ prev_status,+ ))?),};Err(ErrorResponse {@@ -4801,7 +4852,7 @@ impl transformers::ForeignTryFrom<payments_grpc::PaymentServiceAuthenticateRespoconnector_metadata: None,})} else {- let status = AttemptStatus::foreign_try_from(response.status())?;+ let status = AttemptStatus::foreign_try_from((response.status(), prev_status))?;Ok((PaymentsResponseData::TransactionResponse {@@ -5431,13 +5482,13 @@ impl transformers::ForeignTryFrom<payments_grpc::RefundStatus> for RefundStatus}}-impl transformers::ForeignTryFrom<payments_grpc::PaymentServiceVoidResponse>+impl transformers::ForeignTryFrom<(payments_grpc::PaymentServiceVoidResponse, AttemptStatus)>for Result<(PaymentsResponseData, AttemptStatus), ErrorResponse>{type Error = error_stack::Report<UnifiedConnectorServiceError>;fn foreign_try_from(- response: payments_grpc::PaymentServiceVoidResponse,+ (response, prev_status): (payments_grpc::PaymentServiceVoidResponse, AttemptStatus),) -> Result<Self, Self::Error> {let connector_response_reference_id =response.response_ref_id.as_ref().and_then(|identifier| {@@ -5489,7 +5540,10 @@ impl transformers::ForeignTryFrom<payments_grpc::PaymentServiceVoidResponse>let response = if response.error_code.is_some() {let attempt_status = match response.status() {payments_grpc::PaymentStatus::AttemptStatusUnspecified => None,- _ => Some(AttemptStatus::foreign_try_from(response.status())?),+ _ => Some(AttemptStatus::foreign_try_from((+ response.status(),+ prev_status,+ ))?),};Err(ErrorResponse {@@ -5506,7 +5560,7 @@ impl transformers::ForeignTryFrom<payments_grpc::PaymentServiceVoidResponse>connector_metadata: None,})} else {- let status = AttemptStatus::foreign_try_from(response.status())?;+ let status = AttemptStatus::foreign_try_from((response.status(), prev_status))?;Ok((PaymentsResponseData::TransactionResponse {