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
feat(connector): [Adyen] receive incoming webhooks for pix expiry (#8720)
Kashif4587564824df
diff --git a/api-reference/v1/openapi_spec_v1.json b/api-reference/v1/openapi_spec_v1.jsonindex 13e93cc88f..cdfa214a3c 100644--- a/api-reference/v1/openapi_spec_v1.json+++ b/api-reference/v1/openapi_spec_v1.json@@ -7670,7 +7670,8 @@"payment_method_awaited","confirmation_awaited","device_data_collection_pending",- "integrity_failure"+ "integrity_failure",+ "expired"]},"AuthenticationConnectorDetails": {@@ -14155,6 +14156,7 @@"payment_cancelled","payment_authorized","payment_captured",+ "payment_expired","action_required","refund_succeeded","refund_failed",@@ -15941,7 +15943,8 @@"requires_capture","partially_captured","partially_captured_and_capturable",- "conflicted"+ "conflicted",+ "expired"]},"IssuerData": {diff --git a/api-reference/v2/openapi_spec_v2.json b/api-reference/v2/openapi_spec_v2.jsonindex 80bef99675..a8bacd04ad 100644--- a/api-reference/v2/openapi_spec_v2.json+++ b/api-reference/v2/openapi_spec_v2.json@@ -4847,7 +4847,8 @@"payment_method_awaited","confirmation_awaited","device_data_collection_pending",- "integrity_failure"+ "integrity_failure",+ "expired"]},"AuthenticationConnectorDetails": {@@ -10682,6 +10683,7 @@"payment_cancelled","payment_authorized","payment_captured",+ "payment_expired","action_required","refund_succeeded","refund_failed",@@ -12580,7 +12582,8 @@"requires_capture","partially_captured","partially_captured_and_capturable",- "conflicted"+ "conflicted",+ "expired"]},"JCSVoucherData": {diff --git a/crates/api_models/src/webhooks.rs b/crates/api_models/src/webhooks.rsindex 75af0b19cf..fcab9461a0 100644--- a/crates/api_models/src/webhooks.rs+++ b/crates/api_models/src/webhooks.rs@@ -22,6 +22,7 @@ pub enum IncomingWebhookEvent {PaymentIntentAuthorizationFailure,PaymentIntentCaptureSuccess,PaymentIntentCaptureFailure,+ PaymentIntentExpired,PaymentActionRequired,EventNotSupported,SourceChargeable,@@ -199,7 +200,8 @@ impl From<IncomingWebhookEvent> for WebhookFlow {| IncomingWebhookEvent::PaymentIntentAuthorizationSuccess| IncomingWebhookEvent::PaymentIntentAuthorizationFailure| IncomingWebhookEvent::PaymentIntentCaptureSuccess- | IncomingWebhookEvent::PaymentIntentCaptureFailure => Self::Payment,+ | IncomingWebhookEvent::PaymentIntentCaptureFailure+ | IncomingWebhookEvent::PaymentIntentExpired => Self::Payment,IncomingWebhookEvent::EventNotSupported => Self::ReturnResponse,IncomingWebhookEvent::RefundSuccess | IncomingWebhookEvent::RefundFailure => {Self::Refunddiff --git a/crates/common_enums/src/enums.rs b/crates/common_enums/src/enums.rsindex 12f1fe5581..a2912e73c4 100644--- a/crates/common_enums/src/enums.rs+++ b/crates/common_enums/src/enums.rs@@ -156,6 +156,7 @@ pub enum AttemptStatus {ConfirmationAwaited,DeviceDataCollectionPending,IntegrityFailure,+ Expired,}impl AttemptStatus {@@ -168,7 +169,8 @@ impl AttemptStatus {| Self::VoidFailed| Self::CaptureFailed| Self::Failure- | Self::PartialCharged => true,+ | Self::PartialCharged+ | Self::Expired => true,Self::Started| Self::AuthenticationFailed| Self::AuthenticationPending@@ -1461,6 +1463,7 @@ impl EventClass {EventType::PaymentCancelled,EventType::PaymentAuthorized,EventType::PaymentCaptured,+ EventType::PaymentExpired,EventType::ActionRequired,]),Self::Refunds => HashSet::from([EventType::RefundSucceeded, EventType::RefundFailed]),@@ -1514,6 +1517,7 @@ pub enum EventType {PaymentCancelled,PaymentAuthorized,PaymentCaptured,+ PaymentExpired,ActionRequired,RefundSucceeded,RefundFailed,@@ -1635,13 +1639,19 @@ pub enum IntentStatus {PartiallyCapturedAndCapturable,/// There has been a discrepancy between the amount/currency sent in the request and the amount/currency received by the processorConflicted,+ /// The payment expired before it could be captured.+ Expired,}impl IntentStatus {/// Indicates whether the payment intent is in terminal state or notpub fn is_in_terminal_state(self) -> bool {match self {- Self::Succeeded | Self::Failed | Self::Cancelled | Self::PartiallyCaptured => true,+ Self::Succeeded+ | Self::Failed+ | Self::Cancelled+ | Self::PartiallyCaptured+ | Self::Expired => true,Self::Processing| Self::RequiresCustomerAction| Self::RequiresMerchantAction@@ -1664,7 +1674,7 @@ impl IntentStatus {| Self::Failed| Self::Cancelled| Self::PartiallyCaptured- | Self::RequiresCapture | Self::Conflicted => false,+ | Self::RequiresCapture | Self::Conflicted | Self::Expired=> false,Self::Processing| Self::RequiresCustomerAction| Self::RequiresMerchantAction@@ -1796,7 +1806,8 @@ impl From<AttemptStatus> for PaymentMethodStatus {| AttemptStatus::PartialChargedAndChargeable| AttemptStatus::ConfirmationAwaited| AttemptStatus::DeviceDataCollectionPending- | AttemptStatus::IntegrityFailure => Self::Inactive,+ | AttemptStatus::IntegrityFailure+ | AttemptStatus::Expired => Self::Inactive,AttemptStatus::Charged | AttemptStatus::Authorized => Self::Active,}}diff --git a/crates/common_enums/src/transformers.rs b/crates/common_enums/src/transformers.rsindex 0dcef36ac9..549be0e0dc 100644--- a/crates/common_enums/src/transformers.rs+++ b/crates/common_enums/src/transformers.rs@@ -2121,6 +2121,7 @@ impl From<AttemptStatus> for IntentStatus {| AttemptStatus::CaptureFailed| AttemptStatus::Failure => Self::Failed,AttemptStatus::Voided => Self::Cancelled,+ AttemptStatus::Expired => Self::Expired,}}}@@ -2135,6 +2136,7 @@ impl From<IntentStatus> for Option<EventType> {| IntentStatus::RequiresCustomerAction| IntentStatus::Conflicted => Some(EventType::ActionRequired),IntentStatus::Cancelled => Some(EventType::PaymentCancelled),+ IntentStatus::Expired => Some(EventType::PaymentExpired),IntentStatus::PartiallyCaptured | IntentStatus::PartiallyCapturedAndCapturable => {Some(EventType::PaymentCaptured)}diff --git a/crates/hyperswitch_connectors/src/connectors/adyen/transformers.rs b/crates/hyperswitch_connectors/src/connectors/adyen/transformers.rsindex 6a0cc9c461..5b424ec5d4 100644--- a/crates/hyperswitch_connectors/src/connectors/adyen/transformers.rs+++ b/crates/hyperswitch_connectors/src/connectors/adyen/transformers.rs@@ -428,6 +428,7 @@ impl ForeignTryFrom<(bool, AdyenWebhookStatus)> for storage_enums::AttemptStatusAdyenWebhookStatus::CancelFailed => Ok(Self::VoidFailed),AdyenWebhookStatus::Captured => Ok(Self::Charged),AdyenWebhookStatus::CaptureFailed => Ok(Self::CaptureFailed),+ AdyenWebhookStatus::Expired => Ok(Self::Expired),//If Unexpected Event is received, need to understand how it reached this point//Webhooks with Payment Events only should try to conume this resource object.AdyenWebhookStatus::UnexpectedEvent | AdyenWebhookStatus::Reversed => {@@ -513,6 +514,7 @@ pub enum AdyenWebhookStatus {CaptureFailed,Reversed,UnexpectedEvent,+ Expired,}//Creating custom struct which can be consumed in Psync Handler triggered from Webhooks@@ -4798,6 +4800,7 @@ pub enum WebhookEventCode {SecondChargeback,PrearbitrationWon,PrearbitrationLost,+ OfferClosed,#[cfg(feature = "payouts")]PayoutThirdparty,#[cfg(feature = "payouts")]@@ -4811,7 +4814,10 @@ pub enum WebhookEventCode {}pub fn is_transaction_event(event_code: &WebhookEventCode) -> bool {- matches!(event_code, WebhookEventCode::Authorisation)+ matches!(+ event_code,+ WebhookEventCode::Authorisation | WebhookEventCode::OfferClosed+ )}pub fn is_capture_or_cancel_event(event_code: &WebhookEventCode) -> bool {@@ -4928,6 +4934,9 @@ pub(crate) fn get_adyen_webhook_event(WebhookEventCode::CaptureFailed => {api_models::webhooks::IncomingWebhookEvent::PaymentIntentCaptureFailure}+ WebhookEventCode::OfferClosed => {+ api_models::webhooks::IncomingWebhookEvent::PaymentIntentExpired+ }#[cfg(feature = "payouts")]WebhookEventCode::PayoutThirdparty => {api_models::webhooks::IncomingWebhookEvent::PayoutCreated@@ -5015,6 +5024,7 @@ impl From<AdyenNotificationRequestItemWH> for AdyenWebhookResponse {AdyenWebhookStatus::CancelFailed}}+ WebhookEventCode::OfferClosed => AdyenWebhookStatus::Expired,WebhookEventCode::Capture => {if is_success_scenario(notif.success) {AdyenWebhookStatus::Captureddiff --git a/crates/hyperswitch_connectors/src/connectors/chargebee/transformers.rs b/crates/hyperswitch_connectors/src/connectors/chargebee/transformers.rsindex 5a3ec2f96f..6bb4cf345f 100644--- a/crates/hyperswitch_connectors/src/connectors/chargebee/transformers.rs+++ b/crates/hyperswitch_connectors/src/connectors/chargebee/transformers.rs@@ -706,7 +706,8 @@ impl TryFrom<enums::AttemptStatus> for ChargebeeRecordStatus {| enums::AttemptStatus::PaymentMethodAwaited| enums::AttemptStatus::ConfirmationAwaited| enums::AttemptStatus::DeviceDataCollectionPending- | enums::AttemptStatus::IntegrityFailure => Err(errors::ConnectorError::NotSupported {+ | enums::AttemptStatus::IntegrityFailure+ | enums::AttemptStatus::Expired => Err(errors::ConnectorError::NotSupported {message: "Record back flow is only supported for terminal status".to_string(),connector: "chargebee",}diff --git a/crates/hyperswitch_connectors/src/connectors/paypal/transformers.rs b/crates/hyperswitch_connectors/src/connectors/paypal/transformers.rsindex 289fee48d9..9ffc5a0c13 100644--- a/crates/hyperswitch_connectors/src/connectors/paypal/transformers.rs+++ b/crates/hyperswitch_connectors/src/connectors/paypal/transformers.rs@@ -2701,7 +2701,8 @@ impl TryFrom<PaymentsCaptureResponseRouterData<PaypalCaptureResponse>>| storage_enums::AttemptStatus::PaymentMethodAwaited| storage_enums::AttemptStatus::ConfirmationAwaited| storage_enums::AttemptStatus::DeviceDataCollectionPending- | storage_enums::AttemptStatus::Voided => 0,+ | storage_enums::AttemptStatus::Voided+ | storage_enums::AttemptStatus::Expired => 0,storage_enums::AttemptStatus::Charged| storage_enums::AttemptStatus::PartialCharged| storage_enums::AttemptStatus::PartialChargedAndChargeablediff --git a/crates/hyperswitch_connectors/src/connectors/recurly/transformers.rs b/crates/hyperswitch_connectors/src/connectors/recurly/transformers.rsindex b7f7d3d39d..4aef739b97 100644--- a/crates/hyperswitch_connectors/src/connectors/recurly/transformers.rs+++ b/crates/hyperswitch_connectors/src/connectors/recurly/transformers.rs@@ -278,7 +278,8 @@ impl TryFrom<enums::AttemptStatus> for RecurlyRecordStatus {| enums::AttemptStatus::PaymentMethodAwaited| enums::AttemptStatus::ConfirmationAwaited| enums::AttemptStatus::DeviceDataCollectionPending- | enums::AttemptStatus::IntegrityFailure => Err(errors::ConnectorError::NotSupported {+ | enums::AttemptStatus::IntegrityFailure+ | enums::AttemptStatus::Expired => Err(errors::ConnectorError::NotSupported {message: "Record back flow is only supported for terminal status".to_string(),connector: "recurly",}diff --git a/crates/hyperswitch_connectors/src/utils.rs b/crates/hyperswitch_connectors/src/utils.rsindex 90a650a2b1..7b9b314ce5 100644--- a/crates/hyperswitch_connectors/src/utils.rs+++ b/crates/hyperswitch_connectors/src/utils.rs@@ -425,7 +425,8 @@ pub(crate) fn is_payment_failure(status: AttemptStatus) -> bool {| AttemptStatus::AuthorizationFailed| AttemptStatus::CaptureFailed| AttemptStatus::VoidFailed- | AttemptStatus::Failure => true,+ | AttemptStatus::Failure+ | AttemptStatus::Expired => true,AttemptStatus::Started| AttemptStatus::RouterDeclined| AttemptStatus::AuthenticationPending@@ -6295,7 +6296,8 @@ impl FrmTransactionRouterDataRequest for FrmTransactionRouterData {| AttemptStatus::Voided| AttemptStatus::CaptureFailed| AttemptStatus::Failure- | AttemptStatus::AutoRefunded => Some(false),+ | AttemptStatus::AutoRefunded+ | AttemptStatus::Expired => Some(false),AttemptStatus::AuthenticationSuccessful| AttemptStatus::PartialChargedAndChargeablediff --git a/crates/hyperswitch_domain_models/src/revenue_recovery.rs b/crates/hyperswitch_domain_models/src/revenue_recovery.rsindex 6481a81d53..f9506e2ed3 100644--- a/crates/hyperswitch_domain_models/src/revenue_recovery.rs+++ b/crates/hyperswitch_domain_models/src/revenue_recovery.rs@@ -150,6 +150,7 @@ impl RecoveryAction {| webhooks::IncomingWebhookEvent::PaymentIntentAuthorizationFailure| webhooks::IncomingWebhookEvent::PaymentIntentCaptureSuccess| webhooks::IncomingWebhookEvent::PaymentIntentCaptureFailure+ | webhooks::IncomingWebhookEvent::PaymentIntentExpired| webhooks::IncomingWebhookEvent::PaymentActionRequired| webhooks::IncomingWebhookEvent::EventNotSupported| webhooks::IncomingWebhookEvent::SourceChargeablediff --git a/crates/hyperswitch_domain_models/src/router_data.rs b/crates/hyperswitch_domain_models/src/router_data.rsindex 259f280d49..8cdcfe7e45 100644--- a/crates/hyperswitch_domain_models/src/router_data.rs+++ b/crates/hyperswitch_domain_models/src/router_data.rs@@ -702,7 +702,8 @@ implcommon_enums::IntentStatus::Succeeded| common_enums::IntentStatus::Failed| common_enums::IntentStatus::Cancelled- | common_enums::IntentStatus::Conflicted => Some(MinorUnit::zero()),+ | common_enums::IntentStatus::Conflicted+ | common_enums::IntentStatus::Expired => Some(MinorUnit::zero()),// For these statuses, update the capturable amount when it reaches terminal / capturable statecommon_enums::IntentStatus::RequiresCustomerAction| common_enums::IntentStatus::RequiresMerchantAction@@ -737,9 +738,9 @@ implSome(total_amount)}// No amount is captured- common_enums::IntentStatus::Cancelled | common_enums::IntentStatus::Failed => {- Some(MinorUnit::zero())- }+ common_enums::IntentStatus::Cancelled+ | common_enums::IntentStatus::Failed+ | common_enums::IntentStatus::Expired => Some(MinorUnit::zero()),// For these statuses, update the amount captured when it reaches terminal statecommon_enums::IntentStatus::RequiresCustomerAction| common_enums::IntentStatus::RequiresMerchantAction@@ -913,7 +914,8 @@ implcommon_enums::IntentStatus::Succeeded| common_enums::IntentStatus::Failed| common_enums::IntentStatus::Cancelled- | common_enums::IntentStatus::Conflicted => Some(MinorUnit::zero()),+ | common_enums::IntentStatus::Conflicted+ | common_enums::IntentStatus::Expired => Some(MinorUnit::zero()),// For these statuses, update the capturable amount when it reaches terminal / capturable statecommon_enums::IntentStatus::RequiresCustomerAction| common_enums::IntentStatus::RequiresMerchantAction@@ -951,9 +953,9 @@ implSome(amount_captured)}// No amount is captured- common_enums::IntentStatus::Cancelled | common_enums::IntentStatus::Failed => {- Some(MinorUnit::zero())- }+ common_enums::IntentStatus::Cancelled+ | common_enums::IntentStatus::Failed+ | common_enums::IntentStatus::Expired => Some(MinorUnit::zero()),common_enums::IntentStatus::RequiresCapture => {let total_amount = payment_data.payment_attempt.amount_details.get_net_amount();Some(total_amount)@@ -1149,7 +1151,8 @@ implcommon_enums::IntentStatus::Succeeded| common_enums::IntentStatus::Failed| common_enums::IntentStatus::Cancelled- | common_enums::IntentStatus::Conflicted => Some(MinorUnit::zero()),+ | common_enums::IntentStatus::Conflicted+ | common_enums::IntentStatus::Expired => Some(MinorUnit::zero()),// For these statuses, update the capturable amount when it reaches terminal / capturable statecommon_enums::IntentStatus::RequiresCustomerAction| common_enums::IntentStatus::RequiresMerchantAction@@ -1186,9 +1189,9 @@ implSome(amount_captured)}// No amount is captured- common_enums::IntentStatus::Cancelled | common_enums::IntentStatus::Failed => {- Some(MinorUnit::zero())- }+ common_enums::IntentStatus::Cancelled+ | common_enums::IntentStatus::Failed+ | common_enums::IntentStatus::Expired => Some(MinorUnit::zero()),// For these statuses, update the amount captured when it reaches terminal statecommon_enums::IntentStatus::RequiresCustomerAction| common_enums::IntentStatus::RequiresMerchantAction@@ -1382,7 +1385,8 @@ implcommon_enums::IntentStatus::Succeeded| common_enums::IntentStatus::Failed| common_enums::IntentStatus::Cancelled- | common_enums::IntentStatus::Conflicted => Some(MinorUnit::zero()),+ | common_enums::IntentStatus::Conflicted+ | common_enums::IntentStatus::Expired => Some(MinorUnit::zero()),// For these statuses, update the capturable amount when it reaches terminal / capturable statecommon_enums::IntentStatus::RequiresCustomerAction| common_enums::IntentStatus::RequiresMerchantAction@@ -1417,9 +1421,9 @@ implSome(total_amount)}// No amount is captured- common_enums::IntentStatus::Cancelled | common_enums::IntentStatus::Failed => {- Some(MinorUnit::zero())- }+ common_enums::IntentStatus::Cancelled+ | common_enums::IntentStatus::Failed+ | common_enums::IntentStatus::Expired => Some(MinorUnit::zero()),// For these statuses, update the amount captured when it reaches terminal statecommon_enums::IntentStatus::RequiresCustomerAction| common_enums::IntentStatus::RequiresMerchantActiondiff --git a/crates/router/src/compatibility/stripe/payment_intents/types.rs b/crates/router/src/compatibility/stripe/payment_intents/types.rsindex e8813fad68..acf2f5e03a 100644--- a/crates/router/src/compatibility/stripe/payment_intents/types.rs+++ b/crates/router/src/compatibility/stripe/payment_intents/types.rs@@ -421,7 +421,7 @@ impl From<api_enums::IntentStatus> for StripePaymentStatus {api_enums::IntentStatus::Succeeded | api_enums::IntentStatus::PartiallyCaptured => {Self::Succeeded}- api_enums::IntentStatus::Failed => Self::Canceled,+ api_enums::IntentStatus::Failed | api_enums::IntentStatus::Expired => Self::Canceled,api_enums::IntentStatus::Processing => Self::Processing,api_enums::IntentStatus::RequiresCustomerAction| api_enums::IntentStatus::RequiresMerchantActiondiff --git a/crates/router/src/compatibility/stripe/setup_intents/types.rs b/crates/router/src/compatibility/stripe/setup_intents/types.rsindex 3cf996685c..90df416ec7 100644--- a/crates/router/src/compatibility/stripe/setup_intents/types.rs+++ b/crates/router/src/compatibility/stripe/setup_intents/types.rs@@ -312,7 +312,7 @@ impl From<api_enums::IntentStatus> for StripeSetupStatus {api_enums::IntentStatus::Succeeded | api_enums::IntentStatus::PartiallyCaptured => {Self::Succeeded}- api_enums::IntentStatus::Failed => Self::Canceled,+ api_enums::IntentStatus::Failed | api_enums::IntentStatus::Expired => Self::Canceled,api_enums::IntentStatus::Processing => Self::Processing,api_enums::IntentStatus::RequiresCustomerAction => Self::RequiresAction,api_enums::IntentStatus::RequiresMerchantActiondiff --git a/crates/router/src/compatibility/stripe/webhooks.rs b/crates/router/src/compatibility/stripe/webhooks.rsindex 3bd0f83b7d..5dad60120e 100644--- a/crates/router/src/compatibility/stripe/webhooks.rs+++ b/crates/router/src/compatibility/stripe/webhooks.rs@@ -270,7 +270,8 @@ fn get_stripe_event_type(event_type: api_models::enums::EventType) -> &'static sapi_models::enums::EventType::PaymentSucceeded => "payment_intent.succeeded",api_models::enums::EventType::PaymentFailed => "payment_intent.payment_failed",api_models::enums::EventType::PaymentProcessing => "payment_intent.processing",- api_models::enums::EventType::PaymentCancelled => "payment_intent.canceled",+ api_models::enums::EventType::PaymentCancelled+ | api_models::enums::EventType::PaymentExpired => "payment_intent.canceled",// the below are not really stripe compatible because stripe doesn't provide thisapi_models::enums::EventType::ActionRequired => "action.required",diff --git a/crates/router/src/connector/utils.rs b/crates/router/src/connector/utils.rsindex 525a9d678a..02839ee8d7 100644--- a/crates/router/src/connector/utils.rs+++ b/crates/router/src/connector/utils.rs@@ -2195,7 +2195,8 @@ impl FrmTransactionRouterDataRequest for fraud_check::FrmTransactionRouterData {| storage_enums::AttemptStatus::Voided| storage_enums::AttemptStatus::CaptureFailed| storage_enums::AttemptStatus::Failure- | storage_enums::AttemptStatus::AutoRefunded => Some(false),+ | storage_enums::AttemptStatus::AutoRefunded+ | storage_enums::AttemptStatus::Expired => Some(false),storage_enums::AttemptStatus::AuthenticationSuccessful| storage_enums::AttemptStatus::PartialChargedAndChargeable@@ -2226,7 +2227,8 @@ pub fn is_payment_failure(status: enums::AttemptStatus) -> bool {| common_enums::AttemptStatus::AuthorizationFailed| common_enums::AttemptStatus::CaptureFailed| common_enums::AttemptStatus::VoidFailed- | common_enums::AttemptStatus::Failure => true,+ | common_enums::AttemptStatus::Failure+ | common_enums::AttemptStatus::Expired => true,common_enums::AttemptStatus::Started| common_enums::AttemptStatus::RouterDeclined| common_enums::AttemptStatus::AuthenticationPendingdiff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rsindex fd8615ff8a..5651dae946 100644--- a/crates/router/src/core/payments.rs+++ b/crates/router/src/core/payments.rs@@ -3143,7 +3143,8 @@ impl ValidateStatusForOperation for &PaymentRedirectSync {| common_enums::IntentStatus::RequiresCapture| common_enums::IntentStatus::PartiallyCaptured| common_enums::IntentStatus::RequiresConfirmation- | common_enums::IntentStatus::PartiallyCapturedAndCapturable => {+ | common_enums::IntentStatus::PartiallyCapturedAndCapturable+ | common_enums::IntentStatus::Expired => {Err(errors::ApiErrorResponse::PaymentUnexpectedState {current_flow: format!("{self:?}"),field_name: "status".to_string(),diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rsindex 280da8b46e..e5f7384708 100644--- a/crates/router/src/core/payments/helpers.rs+++ b/crates/router/src/core/payments/helpers.rs@@ -4281,7 +4281,8 @@ pub fn get_attempt_type(| enums::AttemptStatus::AutoRefunded| enums::AttemptStatus::PaymentMethodAwaited| enums::AttemptStatus::DeviceDataCollectionPending- | enums::AttemptStatus::IntegrityFailure => {+ | enums::AttemptStatus::IntegrityFailure+ | enums::AttemptStatus::Expired => {metrics::MANUAL_RETRY_VALIDATION_FAILED.add(1,router_env::metric_attributes!((@@ -4337,7 +4338,8 @@ pub fn get_attempt_type(| enums::IntentStatus::PartiallyCapturedAndCapturable| enums::IntentStatus::Processing| enums::IntentStatus::Succeeded- | enums::IntentStatus::Conflicted => {+ | enums::IntentStatus::Conflicted+ | enums::IntentStatus::Expired => {Err(report!(errors::ApiErrorResponse::PreconditionFailed {message: format!("You cannot {action} this payment because it has status {}",@@ -4584,18 +4586,19 @@ pub fn is_manual_retry_allowed(| enums::AttemptStatus::AutoRefunded| enums::AttemptStatus::PaymentMethodAwaited| enums::AttemptStatus::DeviceDataCollectionPending- | storage_enums::AttemptStatus::IntegrityFailure => {+ | enums::AttemptStatus::IntegrityFailure+ | enums::AttemptStatus::Expired => {logger::error!("Payment Attempt should not be in this state because Attempt to Intent status mapping doesn't allow it");None}- storage_enums::AttemptStatus::VoidFailed- | storage_enums::AttemptStatus::RouterDeclined- | storage_enums::AttemptStatus::CaptureFailed => Some(false),+ enums::AttemptStatus::VoidFailed+ | enums::AttemptStatus::RouterDeclined+ | enums::AttemptStatus::CaptureFailed => Some(false),- storage_enums::AttemptStatus::AuthenticationFailed- | storage_enums::AttemptStatus::AuthorizationFailed- | storage_enums::AttemptStatus::Failure => Some(true),+ enums::AttemptStatus::AuthenticationFailed+ | enums::AttemptStatus::AuthorizationFailed+ | enums::AttemptStatus::Failure => Some(true),},enums::IntentStatus::Cancelled| enums::IntentStatus::RequiresCapture@@ -4603,7 +4606,8 @@ pub fn is_manual_retry_allowed(| enums::IntentStatus::PartiallyCapturedAndCapturable| enums::IntentStatus::Processing| enums::IntentStatus::Succeeded- | enums::IntentStatus::Conflicted => Some(false),+ | enums::IntentStatus::Conflicted+ | enums::IntentStatus::Expired => Some(false),enums::IntentStatus::RequiresCustomerAction| enums::IntentStatus::RequiresMerchantActiondiff --git a/crates/router/src/core/payments/operations/payment_attempt_record.rs b/crates/router/src/core/payments/operations/payment_attempt_record.rsindex b2834f0bfa..3c5259b6bf 100644--- a/crates/router/src/core/payments/operations/payment_attempt_record.rs+++ b/crates/router/src/core/payments/operations/payment_attempt_record.rs@@ -87,7 +87,8 @@ impl ValidateStatusForOperation for PaymentAttemptRecord {| common_enums::IntentStatus::RequiresCapture| common_enums::IntentStatus::PartiallyCaptured| common_enums::IntentStatus::RequiresConfirmation- | common_enums::IntentStatus::PartiallyCapturedAndCapturable => {+ | common_enums::IntentStatus::PartiallyCapturedAndCapturable+ | common_enums::IntentStatus::Expired => {Err(errors::ApiErrorResponse::PaymentUnexpectedState {current_flow: format!("{self:?}"),field_name: "status".to_string(),diff --git a/crates/router/src/core/payments/operations/payment_capture_v2.rs b/crates/router/src/core/payments/operations/payment_capture_v2.rsindex 1b46cb85d4..13100e7762 100644--- a/crates/router/src/core/payments/operations/payment_capture_v2.rs+++ b/crates/router/src/core/payments/operations/payment_capture_v2.rs@@ -43,7 +43,8 @@ impl ValidateStatusForOperation for PaymentsCapture {| common_enums::IntentStatus::RequiresMerchantAction| common_enums::IntentStatus::RequiresPaymentMethod| common_enums::IntentStatus::PartiallyCaptured- | common_enums::IntentStatus::RequiresConfirmation => {+ | common_enums::IntentStatus::RequiresConfirmation+ | common_enums::IntentStatus::Expired => {Err(errors::ApiErrorResponse::PaymentUnexpectedState {current_flow: format!("{self:?}"),field_name: "status".to_string(),diff --git a/crates/router/src/core/payments/operations/payment_confirm_intent.rs b/crates/router/src/core/payments/operations/payment_confirm_intent.rsindex 143d6f7d34..a3b81afb4f 100644--- a/crates/router/src/core/payments/operations/payment_confirm_intent.rs+++ b/crates/router/src/core/payments/operations/payment_confirm_intent.rs@@ -53,7 +53,8 @@ impl ValidateStatusForOperation for PaymentIntentConfirm {| common_enums::IntentStatus::RequiresCapture| common_enums::IntentStatus::PartiallyCaptured| common_enums::IntentStatus::RequiresConfirmation- | common_enums::IntentStatus::PartiallyCapturedAndCapturable => {+ | common_enums::IntentStatus::PartiallyCapturedAndCapturable+ | common_enums::IntentStatus::Expired => {Err(errors::ApiErrorResponse::PaymentUnexpectedState {current_flow: format!("{self:?}"),field_name: "status".to_string(),diff --git a/crates/router/src/core/payments/operations/payment_get.rs b/crates/router/src/core/payments/operations/payment_get.rsindex 402c11e2f8..621a6e71a7 100644--- a/crates/router/src/core/payments/operations/payment_get.rs+++ b/crates/router/src/core/payments/operations/payment_get.rs@@ -42,7 +42,8 @@ impl ValidateStatusForOperation for PaymentGet {| common_enums::IntentStatus::PartiallyCapturedAndCapturable| common_enums::IntentStatus::PartiallyCaptured| common_enums::IntentStatus::Cancelled- | common_enums::IntentStatus::Conflicted => Ok(()),+ | common_enums::IntentStatus::Conflicted+ | common_enums::IntentStatus::Expired => Ok(()),// These statuses are not valid for this operationcommon_enums::IntentStatus::RequiresConfirmation| common_enums::IntentStatus::RequiresPaymentMethod => {diff --git a/crates/router/src/core/payments/operations/payment_response.rs b/crates/router/src/core/payments/operations/payment_response.rsindex 7fa8a4858f..425173d444 100644--- a/crates/router/src/core/payments/operations/payment_response.rs+++ b/crates/router/src/core/payments/operations/payment_response.rs@@ -2565,7 +2565,8 @@ impl<F: Clone> PostUpdateTracker<F, PaymentConfirmData<F>, types::PaymentsAuthor| common_enums::AttemptStatus::AutoRefunded| common_enums::AttemptStatus::Unresolved| common_enums::AttemptStatus::Pending- | common_enums::AttemptStatus::Failure => (),+ | common_enums::AttemptStatus::Failure+ | common_enums::AttemptStatus::Expired => (),common_enums::AttemptStatus::Started| common_enums::AttemptStatus::AuthenticationPendingdiff --git a/crates/router/src/core/payments/operations/payment_session_intent.rs b/crates/router/src/core/payments/operations/payment_session_intent.rsindex 8ae5d2cd19..d713c5175b 100644--- a/crates/router/src/core/payments/operations/payment_session_intent.rs+++ b/crates/router/src/core/payments/operations/payment_session_intent.rs@@ -41,7 +41,7 @@ impl ValidateStatusForOperation for PaymentSessionIntent {| common_enums::IntentStatus::RequiresConfirmation| common_enums::IntentStatus::PartiallyCapturedAndCapturable| common_enums::IntentStatus::Succeeded- | common_enums::IntentStatus::Failed | common_enums::IntentStatus::Conflicted => {+ | common_enums::IntentStatus::Failed | common_enums::IntentStatus::Conflicted | common_enums::IntentStatus::Expired => {Err(errors::ApiErrorResponse::PreconditionFailed {message: format!("You cannot create session token for this payment because it has status {intent_status}. Expected status is requires_payment_method.",diff --git a/crates/router/src/core/payments/operations/payment_update_intent.rs b/crates/router/src/core/payments/operations/payment_update_intent.rsindex 2c7b2ea4e8..6e500e3eb0 100644--- a/crates/router/src/core/payments/operations/payment_update_intent.rs+++ b/crates/router/src/core/payments/operations/payment_update_intent.rs@@ -59,7 +59,8 @@ impl ValidateStatusForOperation for PaymentUpdateIntent {| common_enums::IntentStatus::RequiresCapture| common_enums::IntentStatus::PartiallyCaptured| common_enums::IntentStatus::RequiresConfirmation- | common_enums::IntentStatus::PartiallyCapturedAndCapturable => {+ | common_enums::IntentStatus::PartiallyCapturedAndCapturable+ | common_enums::IntentStatus::Expired => {Err(errors::ApiErrorResponse::PaymentUnexpectedState {current_flow: format!("{self:?}"),field_name: "status".to_string(),diff --git a/crates/router/src/core/payments/operations/proxy_payments_intent.rs b/crates/router/src/core/payments/operations/proxy_payments_intent.rsindex 30ea6913c6..3994fd8ef0 100644--- a/crates/router/src/core/payments/operations/proxy_payments_intent.rs+++ b/crates/router/src/core/payments/operations/proxy_payments_intent.rs@@ -54,7 +54,8 @@ impl ValidateStatusForOperation for PaymentProxyIntent {| common_enums::IntentStatus::RequiresCapture| common_enums::IntentStatus::PartiallyCaptured| common_enums::IntentStatus::RequiresConfirmation- | common_enums::IntentStatus::PartiallyCapturedAndCapturable => {+ | common_enums::IntentStatus::PartiallyCapturedAndCapturable+ | common_enums::IntentStatus::Expired => {Err(errors::ApiErrorResponse::PaymentUnexpectedState {current_flow: format!("{self:?}"),field_name: "status".to_string(),diff --git a/crates/router/src/core/payments/payment_methods.rs b/crates/router/src/core/payments/payment_methods.rsindex e21b3b9610..9bf9d3cc92 100644--- a/crates/router/src/core/payments/payment_methods.rs+++ b/crates/router/src/core/payments/payment_methods.rs@@ -370,7 +370,8 @@ fn validate_payment_status_for_payment_method_list(| common_enums::IntentStatus::RequiresCapture| common_enums::IntentStatus::PartiallyCaptured| common_enums::IntentStatus::RequiresConfirmation- | common_enums::IntentStatus::PartiallyCapturedAndCapturable => {+ | common_enums::IntentStatus::PartiallyCapturedAndCapturable+ | common_enums::IntentStatus::Expired => {Err(errors::ApiErrorResponse::PaymentUnexpectedState {current_flow: "list_payment_methods".to_string(),field_name: "status".to_string(),diff --git a/crates/router/src/core/payments/retry.rs b/crates/router/src/core/payments/retry.rsindex 8fe9c565e0..aafe25aea6 100644--- a/crates/router/src/core/payments/retry.rs+++ b/crates/router/src/core/payments/retry.rs@@ -808,7 +808,8 @@ impl<F: Send + Clone + Sync, FData: Send + Sync>| storage_enums::AttemptStatus::ConfirmationAwaited| storage_enums::AttemptStatus::Unresolved| storage_enums::AttemptStatus::DeviceDataCollectionPending- | storage_enums::AttemptStatus::IntegrityFailure => false,+ | storage_enums::AttemptStatus::IntegrityFailure+ | storage_enums::AttemptStatus::Expired => false,storage_enums::AttemptStatus::AuthenticationFailed| storage_enums::AttemptStatus::AuthorizationFaileddiff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rsindex 6f5689ed1c..0cb84fc75c 100644--- a/crates/router/src/core/payments/transformers.rs+++ b/crates/router/src/core/payments/transformers.rs@@ -1943,17 +1943,21 @@ wherelet next_action_containing_wait_screen =wait_screen_next_steps_check(payment_attempt.clone())?;- let next_action = payment_attempt- .redirection_data- .as_ref()- .map(|_| api_models::payments::NextActionData::RedirectToUrl { redirect_to_url })- .or(next_action_containing_wait_screen.map(|wait_screen_data| {- api_models::payments::NextActionData::WaitScreenInformation {- display_from_timestamp: wait_screen_data.display_from_timestamp,- display_to_timestamp: wait_screen_data.display_to_timestamp,- poll_config: wait_screen_data.poll_config,- }- }));+ let next_action = if payment_intent.status.is_in_terminal_state() {+ None+ } else {+ payment_attempt+ .redirection_data+ .as_ref()+ .map(|_| api_models::payments::NextActionData::RedirectToUrl { redirect_to_url })+ .or(next_action_containing_wait_screen.map(|wait_screen_data| {+ api_models::payments::NextActionData::WaitScreenInformation {+ display_from_timestamp: wait_screen_data.display_from_timestamp,+ display_to_timestamp: wait_screen_data.display_to_timestamp,+ poll_config: wait_screen_data.poll_config,+ }+ }))+ };let connector_token_details = payment_attempt.connector_token_details@@ -2641,136 +2645,142 @@ where} else {let mut next_action_response = None;- let bank_transfer_next_steps = bank_transfer_next_steps_check(payment_attempt.clone())?;+ // Early exit for terminal payment statuses - don't evaluate next_action at all+ if payment_intent.status.is_in_terminal_state() {+ next_action_response = None;+ } else {+ let bank_transfer_next_steps = bank_transfer_next_steps_check(payment_attempt.clone())?;- let next_action_voucher = voucher_next_steps_check(payment_attempt.clone())?;+ let next_action_voucher = voucher_next_steps_check(payment_attempt.clone())?;- let next_action_mobile_payment = mobile_payment_next_steps_check(&payment_attempt)?;+ let next_action_mobile_payment = mobile_payment_next_steps_check(&payment_attempt)?;- let next_action_containing_qr_code_url = qr_code_next_steps_check(payment_attempt.clone())?;+ let next_action_containing_qr_code_url =+ qr_code_next_steps_check(payment_attempt.clone())?;- let papal_sdk_next_action = paypal_sdk_next_steps_check(payment_attempt.clone())?;+ let papal_sdk_next_action = paypal_sdk_next_steps_check(payment_attempt.clone())?;- let next_action_containing_fetch_qr_code_url =- fetch_qr_code_url_next_steps_check(payment_attempt.clone())?;+ let next_action_containing_fetch_qr_code_url =+ fetch_qr_code_url_next_steps_check(payment_attempt.clone())?;- let next_action_containing_wait_screen =- wait_screen_next_steps_check(payment_attempt.clone())?;+ let next_action_containing_wait_screen =+ wait_screen_next_steps_check(payment_attempt.clone())?;- let next_action_invoke_hidden_frame = next_action_invoke_hidden_frame(&payment_attempt)?;+ let next_action_invoke_hidden_frame =+ next_action_invoke_hidden_frame(&payment_attempt)?;- if payment_intent.status == enums::IntentStatus::RequiresCustomerAction- || bank_transfer_next_steps.is_some()- || next_action_voucher.is_some()- || next_action_containing_qr_code_url.is_some()- || next_action_containing_wait_screen.is_some()- || papal_sdk_next_action.is_some()- || next_action_containing_fetch_qr_code_url.is_some()- || payment_data.get_authentication().is_some()- {- next_action_response = bank_transfer_next_steps- .map(|bank_transfer| {- api_models::payments::NextActionData::DisplayBankTransferInformation {- bank_transfer_steps_and_charges_details: bank_transfer,- }- })- .or(next_action_voucher.map(|voucher_data| {- api_models::payments::NextActionData::DisplayVoucherInformation {- voucher_details: voucher_data,- }- }))- .or(next_action_mobile_payment.map(|mobile_payment_data| {- api_models::payments::NextActionData::CollectOtp {- consent_data_required: mobile_payment_data.consent_data_required,- }- }))- .or(next_action_containing_qr_code_url.map(|qr_code_data| {- api_models::payments::NextActionData::foreign_from(qr_code_data)- }))- .or(next_action_containing_fetch_qr_code_url.map(|fetch_qr_code_data| {- api_models::payments::NextActionData::FetchQrCodeInformation {- qr_code_fetch_url: fetch_qr_code_data.qr_code_fetch_url- }- }))- .or(papal_sdk_next_action.map(|paypal_next_action_data| {- api_models::payments::NextActionData::InvokeSdkClient{- next_action_data: paypal_next_action_data- }- }))- .or(next_action_containing_wait_screen.map(|wait_screen_data| {- api_models::payments::NextActionData::WaitScreenInformation {- display_from_timestamp: wait_screen_data.display_from_timestamp,- display_to_timestamp: wait_screen_data.display_to_timestamp,- poll_config: wait_screen_data.poll_config,- }- }))- .or(payment_attempt.authentication_data.as_ref().map(|_| {- // Check if iframe redirection is enabled in the business profile- let redirect_url = helpers::create_startpay_url(- base_url,- &payment_attempt,- &payment_intent,- );- // Check if redirection inside popup is enabled in the payment intent- if payment_intent.is_iframe_redirection_enabled.unwrap_or(false) {- api_models::payments::NextActionData::RedirectInsidePopup {- popup_url: redirect_url,- redirect_response_url:router_return_url+ if payment_intent.status == enums::IntentStatus::RequiresCustomerAction+ || bank_transfer_next_steps.is_some()+ || next_action_voucher.is_some()+ || next_action_containing_qr_code_url.is_some()+ || next_action_containing_wait_screen.is_some()+ || papal_sdk_next_action.is_some()+ || next_action_containing_fetch_qr_code_url.is_some()+ || payment_data.get_authentication().is_some()+ {+ next_action_response = bank_transfer_next_steps+ .map(|bank_transfer| {+ api_models::payments::NextActionData::DisplayBankTransferInformation {+ bank_transfer_steps_and_charges_details: bank_transfer,}- } else {- api_models::payments::NextActionData::RedirectToUrl {- redirect_to_url: redirect_url,+ })+ .or(next_action_voucher.map(|voucher_data| {+ api_models::payments::NextActionData::DisplayVoucherInformation {+ voucher_details: voucher_data,}- }- }))- .or(match payment_data.get_authentication(){- Some(authentication_store) => {- let authentication = &authentication_store.authentication;- if payment_intent.status == common_enums::IntentStatus::RequiresCustomerAction && authentication_store.cavv.is_none() && authentication.is_separate_authn_required(){- // if preAuthn and separate authentication needed.- let poll_config = payment_data.get_poll_config().unwrap_or_default();- let request_poll_id = core_utils::get_external_authentication_request_poll_id(&payment_intent.payment_id);- let payment_connector_name = payment_attempt.connector- .as_ref()- .get_required_value("connector")?;- Some(api_models::payments::NextActionData::ThreeDsInvoke {- three_ds_data: api_models::payments::ThreeDsData {- three_ds_authentication_url: helpers::create_authentication_url(base_url, &payment_attempt),- three_ds_authorize_url: helpers::create_authorize_url(- base_url,- &payment_attempt,- payment_connector_name,- ),- three_ds_method_details: authentication.three_ds_method_url.as_ref().zip(authentication.three_ds_method_data.as_ref()).map(|(three_ds_method_url,three_ds_method_data )|{- api_models::payments::ThreeDsMethodData::AcsThreeDsMethodData {- three_ds_method_data_submission: true,- three_ds_method_data: Some(three_ds_method_data.clone()),- three_ds_method_url: Some(three_ds_method_url.to_owned()),- }- }).unwrap_or(api_models::payments::ThreeDsMethodData::AcsThreeDsMethodData {- three_ds_method_data_submission: false,- three_ds_method_data: None,- three_ds_method_url: None,- }),- poll_config: api_models::payments::PollConfigResponse {poll_id: request_poll_id, delay_in_secs: poll_config.delay_in_secs, frequency: poll_config.frequency},- message_version: authentication.message_version.as_ref()- .map(|version| version.to_string()),- directory_server_id: authentication.directory_server_id.clone(),- },- })- }else{- None+ }))+ .or(next_action_mobile_payment.map(|mobile_payment_data| {+ api_models::payments::NextActionData::CollectOtp {+ consent_data_required: mobile_payment_data.consent_data_required,}- },- None => None- })- .or(match next_action_invoke_hidden_frame{- Some(threeds_invoke_data) => Some(construct_connector_invoke_hidden_frame(- threeds_invoke_data,- )?),- None => None-- });+ }))+ .or(next_action_containing_qr_code_url.map(|qr_code_data| {+ api_models::payments::NextActionData::foreign_from(qr_code_data)+ }))+ .or(next_action_containing_fetch_qr_code_url.map(|fetch_qr_code_data| {+ api_models::payments::NextActionData::FetchQrCodeInformation {+ qr_code_fetch_url: fetch_qr_code_data.qr_code_fetch_url+ }+ }))+ .or(papal_sdk_next_action.map(|paypal_next_action_data| {+ api_models::payments::NextActionData::InvokeSdkClient{+ next_action_data: paypal_next_action_data+ }+ }))+ .or(next_action_containing_wait_screen.map(|wait_screen_data| {+ api_models::payments::NextActionData::WaitScreenInformation {+ display_from_timestamp: wait_screen_data.display_from_timestamp,+ display_to_timestamp: wait_screen_data.display_to_timestamp,+ poll_config: wait_screen_data.poll_config,+ }+ }))+ .or(payment_attempt.authentication_data.as_ref().map(|_| {+ // Check if iframe redirection is enabled in the business profile+ let redirect_url = helpers::create_startpay_url(+ base_url,+ &payment_attempt,+ &payment_intent,+ );+ // Check if redirection inside popup is enabled in the payment intent+ if payment_intent.is_iframe_redirection_enabled.unwrap_or(false) {+ api_models::payments::NextActionData::RedirectInsidePopup {+ popup_url: redirect_url,+ redirect_response_url:router_return_url+ }+ } else {+ api_models::payments::NextActionData::RedirectToUrl {+ redirect_to_url: redirect_url,+ }+ }+ }))+ .or(match payment_data.get_authentication(){+ Some(authentication_store) => {+ let authentication = &authentication_store.authentication;+ if payment_intent.status == common_enums::IntentStatus::RequiresCustomerAction && authentication_store.cavv.is_none() && authentication.is_separate_authn_required(){+ // if preAuthn and separate authentication needed.+ let poll_config = payment_data.get_poll_config().unwrap_or_default();+ let request_poll_id = core_utils::get_external_authentication_request_poll_id(&payment_intent.payment_id);+ let payment_connector_name = payment_attempt.connector+ .as_ref()+ .get_required_value("connector")?;+ Some(api_models::payments::NextActionData::ThreeDsInvoke {+ three_ds_data: api_models::payments::ThreeDsData {+ three_ds_authentication_url: helpers::create_authentication_url(base_url, &payment_attempt),+ three_ds_authorize_url: helpers::create_authorize_url(+ base_url,+ &payment_attempt,+ payment_connector_name,+ ),+ three_ds_method_details: authentication.three_ds_method_url.as_ref().zip(authentication.three_ds_method_data.as_ref()).map(|(three_ds_method_url,three_ds_method_data )|{+ api_models::payments::ThreeDsMethodData::AcsThreeDsMethodData {+ three_ds_method_data_submission: true,+ three_ds_method_data: Some(three_ds_method_data.clone()),+ three_ds_method_url: Some(three_ds_method_url.to_owned()),+ }+ }).unwrap_or(api_models::payments::ThreeDsMethodData::AcsThreeDsMethodData {+ three_ds_method_data_submission: false,+ three_ds_method_data: None,+ three_ds_method_url: None,+ }),+ poll_config: api_models::payments::PollConfigResponse {poll_id: request_poll_id, delay_in_secs: poll_config.delay_in_secs, frequency: poll_config.frequency},+ message_version: authentication.message_version.as_ref()+ .map(|version| version.to_string()),+ directory_server_id: authentication.directory_server_id.clone(),+ },+ })+ }else{+ None+ }+ },+ None => None+ })+ .or(match next_action_invoke_hidden_frame{+ Some(threeds_invoke_data) => Some(construct_connector_invoke_hidden_frame(+ threeds_invoke_data,+ )?),+ None => None+ });+ }};// next action check for third party sdk session (for ex: Apple pay through trustpay has third party sdk session response)diff --git a/crates/router/src/core/revenue_recovery/transformers.rs b/crates/router/src/core/revenue_recovery/transformers.rsindex a4e40c69b7..76f987673d 100644--- a/crates/router/src/core/revenue_recovery/transformers.rs+++ b/crates/router/src/core/revenue_recovery/transformers.rs@@ -35,7 +35,8 @@ impl ForeignFrom<AttemptStatus> for RevenueRecoveryPaymentsAttemptStatus {| AttemptStatus::AuthenticationPending| AttemptStatus::DeviceDataCollectionPending| AttemptStatus::Unresolved- | AttemptStatus::IntegrityFailure => Self::InvalidStatus(s.to_string()),+ | AttemptStatus::IntegrityFailure+ | AttemptStatus::Expired => Self::InvalidStatus(s.to_string()),}}}diff --git a/crates/router/src/core/routing/helpers.rs b/crates/router/src/core/routing/helpers.rsindex 32a7b56056..5d5a16912e 100644--- a/crates/router/src/core/routing/helpers.rs+++ b/crates/router/src/core/routing/helpers.rs@@ -1714,9 +1714,8 @@ fn get_desired_payment_status_for_dynamic_routing_metrics(| common_enums::AttemptStatus::IntegrityFailure| common_enums::AttemptStatus::PaymentMethodAwaited| common_enums::AttemptStatus::ConfirmationAwaited- | common_enums::AttemptStatus::DeviceDataCollectionPending => {- common_enums::AttemptStatus::Pending- }+ | common_enums::AttemptStatus::DeviceDataCollectionPending+ | common_enums::AttemptStatus::Expired => common_enums::AttemptStatus::Pending,}}@@ -1734,7 +1733,9 @@ impl ForeignFrom<common_enums::AttemptStatus> for open_router::TxnStatus {common_enums::AttemptStatus::Charged => Self::Charged,common_enums::AttemptStatus::Authorizing => Self::Authorizing,common_enums::AttemptStatus::CodInitiated => Self::CODInitiated,- common_enums::AttemptStatus::Voided => Self::Voided,+ common_enums::AttemptStatus::Voided | common_enums::AttemptStatus::Expired => {+ Self::Voided+ }common_enums::AttemptStatus::VoidInitiated => Self::VoidInitiated,common_enums::AttemptStatus::CaptureInitiated => Self::CaptureInitiated,common_enums::AttemptStatus::CaptureFailed => Self::CaptureFailed,diff --git a/crates/router/src/types.rs b/crates/router/src/types.rsindex 717140cc0e..4887a80f31 100644--- a/crates/router/src/types.rs+++ b/crates/router/src/types.rs@@ -296,12 +296,15 @@ impl Capturable for PaymentsAuthorizeData {{match payment_data.get_capture_method().unwrap_or_default(){- common_enums::CaptureMethod::Automatic|common_enums::CaptureMethod::SequentialAutomatic => {+ common_enums::CaptureMethod::Automatic+ | common_enums::CaptureMethod::SequentialAutomatic => {let intent_status = common_enums::IntentStatus::foreign_from(attempt_status);match intent_status {common_enums::IntentStatus::Succeeded| common_enums::IntentStatus::Failed- | common_enums::IntentStatus::Processing | common_enums::IntentStatus::Conflicted => Some(0),+ | common_enums::IntentStatus::Processing+ | common_enums::IntentStatus::Conflicted+ | common_enums::IntentStatus::Expired => Some(0),common_enums::IntentStatus::Cancelled| common_enums::IntentStatus::PartiallyCaptured| common_enums::IntentStatus::RequiresCustomerAction@@ -341,7 +344,8 @@ impl Capturable for PaymentsCaptureData {match intent_status {common_enums::IntentStatus::Succeeded| common_enums::IntentStatus::PartiallyCaptured- | common_enums::IntentStatus::Conflicted => Some(0),+ | common_enums::IntentStatus::Conflicted+ | common_enums::IntentStatus::Expired => Some(0),common_enums::IntentStatus::Processing| common_enums::IntentStatus::Cancelled| common_enums::IntentStatus::Failed@@ -383,9 +387,11 @@ impl Capturable for CompleteAuthorizeData {common_enums::CaptureMethod::Automatic | common_enums::CaptureMethod::SequentialAutomatic => {let intent_status = common_enums::IntentStatus::foreign_from(attempt_status);match intent_status {- common_enums::IntentStatus::Succeeded|- common_enums::IntentStatus::Failed|- common_enums::IntentStatus::Processing | common_enums::IntentStatus::Conflicted => Some(0),+ common_enums::IntentStatus::Succeeded+ | common_enums::IntentStatus::Failed+ | common_enums::IntentStatus::Processing+ | common_enums::IntentStatus::Conflicted+ | common_enums::IntentStatus::Expired => Some(0),common_enums::IntentStatus::Cancelled | common_enums::IntentStatus::PartiallyCaptured| common_enums::IntentStatus::RequiresCustomerAction| common_enums::IntentStatus::RequiresMerchantAction@@ -433,7 +439,8 @@ impl Capturable for PaymentsCancelData {common_enums::IntentStatus::Cancelled| common_enums::IntentStatus::Processing| common_enums::IntentStatus::PartiallyCaptured- | common_enums::IntentStatus::Conflicted => Some(0),+ | common_enums::IntentStatus::Conflicted+ | common_enums::IntentStatus::Expired => Some(0),common_enums::IntentStatus::Succeeded| common_enums::IntentStatus::Failed| common_enums::IntentStatus::RequiresCustomerActiondiff --git a/crates/router/src/types/transformers.rs b/crates/router/src/types/transformers.rsindex 5cd1c3d3bd..daf630e689 100644--- a/crates/router/src/types/transformers.rs+++ b/crates/router/src/types/transformers.rs@@ -168,7 +168,7 @@ impl ForeignTryFrom<storage_enums::AttemptStatus> for storage_enums::CaptureStat| storage_enums::AttemptStatus::PaymentMethodAwaited| storage_enums::AttemptStatus::ConfirmationAwaited| storage_enums::AttemptStatus::DeviceDataCollectionPending- | storage_enums::AttemptStatus::PartialChargedAndChargeable => {+ | storage_enums::AttemptStatus::PartialChargedAndChargeable | storage_enums::AttemptStatus::Expired => {Err(errors::ApiErrorResponse::PreconditionFailed {message: "AttemptStatus must be one of these for multiple partial captures [Charged, PartialCharged, Pending, CaptureInitiated, Failure, CaptureFailed]".into(),}.into())diff --git a/migrations/2025-07-24-214849_add_expired_to_intent_and_attempt_status_and_event/down.sql b/migrations/2025-07-24-214849_add_expired_to_intent_and_attempt_status_and_event/down.sqlnew file mode 100644index 0000000000..e0ac49d1ec--- /dev/null+++ b/migrations/2025-07-24-214849_add_expired_to_intent_and_attempt_status_and_event/down.sql@@ -0,0 +1 @@+SELECT 1;diff --git a/migrations/2025-07-24-214849_add_expired_to_intent_and_attempt_status_and_event/up.sql b/migrations/2025-07-24-214849_add_expired_to_intent_and_attempt_status_and_event/up.sqlnew file mode 100644index 0000000000..ae322e833e--- /dev/null+++ b/migrations/2025-07-24-214849_add_expired_to_intent_and_attempt_status_and_event/up.sql@@ -0,0 +1,5 @@+ALTER TYPE "IntentStatus" ADD VALUE IF NOT EXISTS 'expired';++ALTER TYPE "AttemptStatus" ADD VALUE IF NOT EXISTS 'expired';++ALTER TYPE "EventType" ADD VALUE IF NOT EXISTS 'payment_expired';\ No newline at end of file