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(payments): add retries using retry_token (#13499)
Kashif9b8b89dc378b
diff --git a/crates/common_enums/src/enums.rs b/crates/common_enums/src/enums.rsindex 51ea144163..53541c5793 100644--- a/crates/common_enums/src/enums.rs+++ b/crates/common_enums/src/enums.rs@@ -248,6 +248,17 @@ impl AttemptStatus {matches!(self, Self::Charged | Self::PartialCharged)}+ pub fn is_authorization_success(self) -> bool {+ matches!(+ self,+ Self::Authorized+ | Self::PartiallyAuthorized+ | Self::Charged+ | Self::PartialCharged+ | Self::PartialChargedAndChargeable+ )+ }+pub fn should_update_payment_method(self) -> bool {match self {Self::Charged@@ -2132,6 +2143,10 @@ pub enum IntentStatus {}impl IntentStatus {+ pub fn is_eligible_for_manual_retry(self) -> bool {+ matches!(self, Self::Failed)+ }+/// Indicates whether the payment intent is in terminal state or notpub fn is_in_terminal_state(self) -> bool {match self {diff --git a/crates/diesel_models/src/business_profile.rs b/crates/diesel_models/src/business_profile.rsindex 8dd6dbbfb1..997a920ecf 100644--- a/crates/diesel_models/src/business_profile.rs+++ b/crates/diesel_models/src/business_profile.rs@@ -97,6 +97,7 @@ pub struct Profile {pub payment_method_blocking: Option<PaymentMethodBlockingConfig>,pub default_fallback_routing: Option<pii::SecretSerdeValue>,pub surcharge_connector_details: Option<SurchargeConnectorDetails>,+ pub order_fulfillment_time: Option<i64>,}#[cfg(feature = "v1")]@@ -164,6 +165,7 @@ pub struct ProfileNew {pub payment_method_blocking: Option<PaymentMethodBlockingConfig>,pub default_fallback_routing: Option<pii::SecretSerdeValue>,pub surcharge_connector_details: Option<SurchargeConnectorDetails>,+ pub order_fulfillment_time: Option<i64>,}#[cfg(feature = "v1")]@@ -233,6 +235,7 @@ pub struct ProfileUpdateInternal {pub payment_method_blocking: Option<PaymentMethodBlockingConfig>,pub default_fallback_routing: Option<pii::SecretSerdeValue>,pub surcharge_connector_details: Option<SurchargeConnectorDetails>,+ pub order_fulfillment_time: Option<i64>,}/// Note: The order of fields in the struct is important.@@ -314,8 +317,8 @@ pub struct Profile {pub payment_method_blocking: Option<PaymentMethodBlockingConfig>,pub default_fallback_routing: Option<pii::SecretSerdeValue>,pub surcharge_connector_details: Option<SurchargeConnectorDetails>,- pub routing_algorithm_id: Option<common_utils::id_type::RoutingId>,pub order_fulfillment_time: Option<i64>,+ pub routing_algorithm_id: Option<common_utils::id_type::RoutingId>,pub order_fulfillment_time_origin: Option<common_enums::OrderFulfillmentTimeOrigin>,pub frm_routing_algorithm_id: Option<String>,pub payout_routing_algorithm_id: Option<common_utils::id_type::RoutingId>,diff --git a/crates/diesel_models/src/schema.rs b/crates/diesel_models/src/schema.rsindex 7ab84fe862..8ef402be0d 100644--- a/crates/diesel_models/src/schema.rs+++ b/crates/diesel_models/src/schema.rs@@ -328,6 +328,7 @@ diesel::table! {payment_method_blocking -> Nullable<Jsonb>,default_fallback_routing -> Nullable<Jsonb>,surcharge_connector_details -> Nullable<Jsonb>,+ order_fulfillment_time -> Nullable<Int8>,}}diff --git a/crates/diesel_models/src/schema_v2.rs b/crates/diesel_models/src/schema_v2.rsindex 1d35bd1ed5..ae2cc256a4 100644--- a/crates/diesel_models/src/schema_v2.rs+++ b/crates/diesel_models/src/schema_v2.rs@@ -323,9 +323,9 @@ diesel::table! {payment_method_blocking -> Nullable<Jsonb>,default_fallback_routing -> Nullable<Jsonb>,surcharge_connector_details -> Nullable<Jsonb>,+ order_fulfillment_time -> Nullable<Int8>,#[max_length = 64]routing_algorithm_id -> Nullable<Varchar>,- order_fulfillment_time -> Nullable<Int8>,order_fulfillment_time_origin -> Nullable<OrderFulfillmentTimeOrigin>,#[max_length = 64]frm_routing_algorithm_id -> Nullable<Varchar>,diff --git a/crates/hyperswitch_domain_models/src/business_profile.rs b/crates/hyperswitch_domain_models/src/business_profile.rsindex c1ea33bcfe..6e991f9af0 100644--- a/crates/hyperswitch_domain_models/src/business_profile.rs+++ b/crates/hyperswitch_domain_models/src/business_profile.rs@@ -649,6 +649,7 @@ pub struct Profile {pub merchant_category_code: Option<api_enums::MerchantCategoryCode>,pub merchant_country_code: Option<common_types::payments::MerchantCountryCode>,pub split_txns_enabled: common_enums::SplitTxnsEnabled,+ pub is_manual_retry_enabled: Option<bool>,pub billing_processor_id: Option<common_utils::id_type::MerchantConnectorAccountId>,pub surcharge_connector_details: Option<SurchargeConnectorDetails>,}@@ -774,6 +775,7 @@ impl From<ProfileSetter> for Profile {merchant_category_code: value.merchant_category_code,merchant_country_code: value.merchant_country_code,split_txns_enabled: value.split_txns_enabled,+ is_manual_retry_enabled: None,billing_processor_id: value.billing_processor_id,surcharge_connector_details: value.surcharge_connector_details,}@@ -837,6 +839,7 @@ pub struct ProfileDbBuilder {pub merchant_category_code: Option<api_enums::MerchantCategoryCode>,pub merchant_country_code: Option<common_types::payments::MerchantCountryCode>,pub split_txns_enabled: common_enums::SplitTxnsEnabled,+ pub is_manual_retry_enabled: Option<bool>,pub billing_processor_id: Option<common_utils::id_type::MerchantConnectorAccountId>,pub surcharge_connector_details: Option<SurchargeConnectorDetails>,}@@ -902,6 +905,7 @@ impl From<ProfileDbBuilder> for Profile {merchant_category_code: value.merchant_category_code,merchant_country_code: value.merchant_country_code,split_txns_enabled: value.split_txns_enabled,+ is_manual_retry_enabled: value.is_manual_retry_enabled,billing_processor_id: value.billing_processor_id,surcharge_connector_details: value.surcharge_connector_details,}@@ -935,6 +939,12 @@ impl Profile {self.order_fulfillment_time}+ #[cfg(feature = "v2")]+ pub fn get_order_fulfillment_time_or_default(&self) -> i64 {+ self.get_order_fulfillment_time()+ .unwrap_or(common_utils::consts::DEFAULT_INTENT_FULFILLMENT_TIME)+ }+pub fn get_webhook_url_from_profile(&self) -> CustomResult<String, ValidationError> {self.webhook_details.clone()diff --git a/crates/router/src/core/payment_methods.rs b/crates/router/src/core/payment_methods.rsindex 44343bf782..cdda5b5fed 100644--- a/crates/router/src/core/payment_methods.rs+++ b/crates/router/src/core/payment_methods.rs@@ -2782,14 +2782,12 @@ impl PaymentMethodResolver {let cvc_expiry_details = if let Some(cvc) = card_cvc {logger::debug!("Inserting CVC for payment method {:?}", existing_pm.id);- let intent_fulfillment_time =- common_utils::consts::DEFAULT_INTENT_FULFILLMENT_TIME;Some(vault::insert_cvc_using_payment_token(state,existing_pm.id.get_string_repr(),cvc,- intent_fulfillment_time,+ profile.get_order_fulfillment_time_or_default(),platform.get_provider().get_key_store(),).await?,@@ -3037,8 +3035,6 @@ async fn execute_payment_method_create(.change_context(errors::ApiErrorResponse::InternalServerError).attach_printable("Failed to update payment method in db")?;- let intent_fulfillment_time = common_utils::consts::DEFAULT_INTENT_FULFILLMENT_TIME;-let card_cvc = req.payment_method_data.get_card()@@ -3050,7 +3046,7 @@ async fn execute_payment_method_create(state,payment_method.id.get_string_repr(),cvc,- intent_fulfillment_time,+ profile.get_order_fulfillment_time_or_default(),platform.get_provider().get_key_store(),)})@@ -3212,8 +3208,6 @@ pub async fn create_generic_volatile_payment_method(.change_context(errors::ApiErrorResponse::InternalServerError).attach_printable("failed to convert payment method")?;- let intent_fulfillment_time = common_utils::consts::DEFAULT_INTENT_FULFILLMENT_TIME;-let card_cvc = req.payment_method_data.get_card()@@ -3225,7 +3219,7 @@ pub async fn create_generic_volatile_payment_method(state,domain_payment_method.id.get_string_repr(),cvc,- intent_fulfillment_time,+ profile.get_order_fulfillment_time_or_default(),platform.get_provider().get_key_store(),)})@@ -5794,6 +5788,12 @@ pub async fn retrieve_payment_method(.attach_printable("Failed to retrieve cvc from redis").ok();+ let cvc_read_mode = get_cvc_read_mode(+ api_key_type,+ profile.is_manual_retry_enabled,+ profile.get_order_fulfillment_time(),+ );+let raw_payment_method_data =Box::pin(raw_payment_method_fetch_access.get_raw_payment_method_data(&state,@@ -5801,6 +5801,7 @@ pub async fn retrieve_payment_method(&profile,&payment_method,storage_type,+ cvc_read_mode,)).await.attach_printable("Failed to get raw payment method data")?;@@ -6073,6 +6074,22 @@ pub enum RawPaymentMethodFetchAccess {Denied,}+#[cfg(feature = "v2")]+fn get_cvc_read_mode(+ api_key_type: enums::ApiKeyType,+ is_manual_retry_enabled: Option<bool>,+ intent_fulfillment_time: Option<i64>,+) -> vault::CvcReadMode {+ if api_key_type == enums::ApiKeyType::Internal+ && is_manual_retry_enabled == Some(true)+ && intent_fulfillment_time.is_some()+ {+ vault::CvcReadMode::ReadOnly+ } else {+ vault::CvcReadMode::ReadAndDelete+ }+}+#[cfg(feature = "v2")]impl RawPaymentMethodFetchAccess {pub async fn get_raw_payment_method_data(@@ -6082,6 +6099,7 @@ impl RawPaymentMethodFetchAccess {profile: &domain::Profile,payment_method: &domain::PaymentMethod,storage_type: common_enums::StorageType,+ cvc_read_mode: vault::CvcReadMode,) -> RouterResult<Option<payment_methods::RawPaymentMethodData>> {match self {Self::Denied => {@@ -6142,6 +6160,7 @@ impl RawPaymentMethodFetchAccess {profile,payment_method,storage_type,+ Some(cvc_read_mode),)).await.change_context(errors::ApiErrorResponse::InternalServerError)@@ -6204,6 +6223,7 @@ impl RawPaymentMethodFetchAccess {profile,&network_token_payment_method,storage_type,+ None,)).await.change_context(errors::ApiErrorResponse::InternalServerError)@@ -6927,7 +6947,7 @@ pub async fn payment_methods_session_retrieve(/// Stores `card_cvc` as an encrypted CVC under `pm_token_{token}_hyperswitch_cvc` — the same/// `_hyperswitch_cvc` mechanism used by the first-time flow — so CVC retrieval (router-side-/// `retrieve_and_delete_cvc_from_payment_token`) resolves it consistently. The card holder name is+/// `retrieve_cvc_from_payment_token`) resolves it consistently. The card holder name is/// not vaulted with the CVC token; it is carried by the saved payment method itself.#[cfg(feature = "v2")]async fn store_cvc_and_card_holder_name_as_payment_token_in_redis(@@ -6935,6 +6955,7 @@ async fn store_cvc_and_card_holder_name_as_payment_token_in_redis(token: &str,card_cvc: Option<Secret<String>>,_card_holder_name: Option<Secret<String>>,+ intent_fulfillment_time: i64,key_store: &domain::MerchantKeyStore,) -> RouterResult<()> {if let Some(card_cvc) = card_cvc {@@ -6942,7 +6963,7 @@ async fn store_cvc_and_card_holder_name_as_payment_token_in_redis(state,token,card_cvc,- common_utils::consts::DEFAULT_INTENT_FULFILLMENT_TIME,+ intent_fulfillment_time,key_store,).await?;@@ -7056,6 +7077,7 @@ pub async fn payment_methods_session_update_payment_method(&parent_payment_method_token,card_cvc,card_holder_name,+ profile.get_order_fulfillment_time_or_default(),platform.get_provider().get_key_store(),).await?;@@ -7118,6 +7140,7 @@ pub async fn payment_methods_session_update_payment_method(&pm_token,card_cvc,card_holder_name,+ profile.get_order_fulfillment_time_or_default(),platform.get_provider().get_key_store(),).await?;@@ -7359,9 +7382,12 @@ pub async fn payment_methods_session_confirm(// insert the token data into redisif let Some(token_data) = token_data {- let intent_fulfillment_time = common_utils::consts::DEFAULT_INTENT_FULFILLMENT_TIME;pm_routes::ParentPaymentMethodToken::create_key_for_token(&parent_payment_method_token)- .insert(intent_fulfillment_time, token_data, &state)+ .insert(+ profile.get_order_fulfillment_time_or_default(),+ token_data,+ &state,+ ).await?;};@@ -7762,7 +7788,7 @@ impl<'a> pm_types::PaymentMethodUpdateHandler<'a> {self.state,self.payment_method.get_id().get_string_repr(),cvc,- common_utils::consts::DEFAULT_INTENT_FULFILLMENT_TIME,+ self.profile.get_order_fulfillment_time_or_default(),self.platform.get_provider().get_key_store(),)})diff --git a/crates/router/src/core/payment_methods/transformers.rs b/crates/router/src/core/payment_methods/transformers.rsindex 15aa6de031..8ddb7accd5 100644--- a/crates/router/src/core/payment_methods/transformers.rs+++ b/crates/router/src/core/payment_methods/transformers.rs@@ -65,6 +65,7 @@ use crate::{consts, types::payment_methods as pm_types};#[cfg(feature = "v1")]#[derive(Default)]pub struct PaymentMethodFetchData {+ pub payment_intent: Option<storage::PaymentIntent>,pub payment_method_info: Option<domain::PaymentMethod>,pub payment_method_with_raw_data: Option<PaymentMethodWithRawData>,pub token_data: Option<storage::PaymentTokenData>,@@ -74,6 +75,7 @@ pub struct PaymentMethodFetchData {impl PaymentMethodFetchData {pub fn from_modular(payment_method_with_raw_data: PaymentMethodWithRawData) -> Self {Self {+ payment_intent: None,payment_method_info: Some(payment_method_with_raw_data.payment_method.clone()),payment_method_with_raw_data: Some(payment_method_with_raw_data),token_data: None,@@ -85,6 +87,7 @@ impl PaymentMethodFetchData {token_data: Option<storage::PaymentTokenData>,) -> Self {Self {+ payment_intent: None,payment_method_info: Some(payment_method_info),payment_method_with_raw_data: None,token_data,diff --git a/crates/router/src/core/payment_methods/vault.rs b/crates/router/src/core/payment_methods/vault.rsindex 13e1fac765..4783447530 100644--- a/crates/router/src/core/payment_methods/vault.rs+++ b/crates/router/src/core/payment_methods/vault.rs@@ -44,7 +44,7 @@ use crate::{utils::{ConnectorResponseExt, StringExt},};// `pm_cards` and `OptionExt` are imported for v2 via the larger v2-only `use` block below; the v1-// build needs them for `retrieve_and_delete_cvc_from_payment_token` (self-hosted vault CVC retrieval).+// build needs them for self-hosted vault CVC retrieval.#[cfg(feature = "v1")]use crate::{core::payment_methods::cards as pm_cards, utils::ext_traits::OptionExt};#[cfg(feature = "v2")]@@ -2431,15 +2431,22 @@ pub struct TemporaryVaultCvc {card_cvc: hyperswitch_masking::Secret<String>,}-#[cfg(feature = "v2")]+/// Controls whether reading a CVC also removes it from Redis.+#[derive(Clone, Copy, Debug, Eq, PartialEq)]+pub enum CvcReadMode {+ ReadAndDelete,+ ReadOnly,+}+#[instrument(skip_all)]-pub async fn insert_cvc_using_payment_token(+/// Stores an encrypted CVC under a payment method ID or short-lived CVC token.+pub async fn store_cvc_in_redis(state: &routes::SessionState,token: &str,card_cvc: hyperswitch_masking::Secret<String>,fulfillment_time: i64,key_store: &domain::MerchantKeyStore,-) -> RouterResult<api_models::payment_methods::CardCVCTokenStorageDetails> {+) -> RouterResult<()> {let redis_conn = state.store.get_redis_conn()@@ -2451,7 +2458,7 @@ pub async fn insert_cvc_using_payment_token(let payload_to_be_encrypted = TemporaryVaultCvc { card_cvc };// Encrypt the CVC and store it in Redis- let encrypted_payload: Encryption = create_encrypted_data(+ let encrypted_payload: Encryption = core_utils::create_encrypted_data(&(state.into()),key_store,payload_to_be_encrypted.clone(),@@ -2473,6 +2480,21 @@ pub async fn insert_cvc_using_payment_token(.change_context(errors::ApiErrorResponse::InternalServerError).attach_printable("Failed to add encrypted cvc to redis")?;+ Ok(())+}++#[cfg(feature = "v2")]+#[instrument(skip_all)]+/// Stores a client-supplied CVC under its generated short-lived token and returns its expiry.+pub async fn insert_cvc_using_payment_token(+ state: &routes::SessionState,+ token: &str,+ card_cvc: hyperswitch_masking::Secret<String>,+ fulfillment_time: i64,+ key_store: &domain::MerchantKeyStore,+) -> RouterResult<api_models::payment_methods::CardCVCTokenStorageDetails> {+ store_cvc_in_redis(state, token, card_cvc, fulfillment_time, key_store).await?;+let card_token_cvc_storage =api_models::payment_methods::CardCVCTokenStorageDetails::generate_expiry_timestamp(fulfillment_time,@@ -2481,12 +2503,12 @@ pub async fn insert_cvc_using_payment_token(Ok(card_token_cvc_storage)}-#[cfg(any(feature = "v1", feature = "v2"))]#[instrument(skip_all)]-pub async fn retrieve_and_delete_cvc_from_payment_token(+pub async fn retrieve_cvc_from_payment_token(state: &routes::SessionState,payment_method_id: &String,key_store: &domain::MerchantKeyStore,+ read_mode: CvcReadMode,) -> RouterResult<hyperswitch_masking::Secret<String>> {let redis_conn = state.store@@ -2499,6 +2521,11 @@ pub async fn retrieve_and_delete_cvc_from_payment_token(let resp: Encryption = redis_conn.get_and_deserialize_key::<Encryption>(&key.clone().into(), "Vec<u8>").await+ .inspect_err(|_| {+ if read_mode == CvcReadMode::ReadOnly {+ metrics::MANUAL_RETRY_CVC_LOOKUP_MISS.add(1, &[]);+ }+ }).change_context(errors::ApiErrorResponse::InternalServerError)?;let cvc_data: TemporaryVaultCvc = pm_cards::decrypt_generic_data(state, Some(resp), key_store)@@ -2509,19 +2536,49 @@ pub async fn retrieve_and_delete_cvc_from_payment_token(.change_context(errors::ApiErrorResponse::InternalServerError).attach_printable("Failed to get required decrypted volatile payment method vault data")?;- logger::info!(- "CVC retrieved successfully from redis for payment method id: {}",- payment_method_id- );+ logger::info!("CVC retrieved successfully from redis");- // delete key after retrieving the cvc- let _ = redis_conn.delete_key(&key.into()).await.map_err(|err| {- logger::error!("Failed to delete token from redis: {:?}", err);- });+ match read_mode {+ CvcReadMode::ReadAndDelete => {+ let _ = redis_conn.delete_key(&key.into()).await.map_err(|err| {+ logger::error!("Failed to delete CVC from redis: {:?}", err);+ });+ }+ CvcReadMode::ReadOnly => {+ metrics::CVC_READ_ONLY_RETRIEVAL.add(1, &[]);+ }+ }Ok(cvc_data.card_cvc)}+#[instrument(skip_all)]+pub async fn delete_cvc_from_payment_token(+ state: &routes::SessionState,+ payment_method_id: &str,+) -> RouterResult<()> {+ let redis_conn = state+ .store+ .get_redis_conn()+ .change_context(errors::ApiErrorResponse::InternalServerError)+ .attach_printable("Failed to get redis connection")?;++ let key = format!("pm_token_{payment_method_id}_hyperswitch_cvc");++ redis_conn+ .delete_key(&key.into())+ .await+ .map(|_| {+ metrics::CVC_DELETED_AFTER_SUCCESS.add(1, &[]);+ })+ .inspect_err(|_| {+ metrics::CVC_DELETION_FAILURE.add(1, &[]);+ })+ .map_err(Into::<errors::StorageError>::into)+ .change_context(errors::ApiErrorResponse::InternalServerError)+ .attach_printable("Failed to delete CVC from redis")+}+#[cfg(feature = "v2")]#[instrument(skip_all)]pub async fn retrieve_key_and_ttl_for_cvc_from_payment_method_id(@@ -2583,6 +2640,7 @@ pub async fn retrieve_payment_method_data_from_storage(profile: &domain::Profile,pm: &domain::PaymentMethod,storage_type: enums::StorageType,+ cvc_read_mode: Option<CvcReadMode>,) -> RouterResult<pm_types::VaultRetrieveResponse> {let mut payment_method_data = match storage_type {enums::StorageType::Persistent => {@@ -2601,21 +2659,21 @@ pub async fn retrieve_payment_method_data_from_storage(}};- let card_cvc = retrieve_and_delete_cvc_from_payment_token(- state,- &pm.id.get_string_repr().to_string(),- platform.get_provider().get_key_store(),- )- .await- .inspect_err(|err| {- logger::warn!(- "Failed to retrieve CVC for payment method {}",- pm.id.get_string_repr()- );- });+ if let Some(read_mode) = cvc_read_mode {+ let card_cvc = retrieve_cvc_from_payment_token(+ state,+ &pm.id.get_string_repr().to_string(),+ platform.get_provider().get_key_store(),+ read_mode,+ )+ .await+ .inspect_err(|_| {+ logger::warn!("Failed to retrieve CVC for payment method");+ });- if let Ok(card_cvc) = card_cvc {- payment_method_data.data.set_card_cvc(card_cvc);+ if let Ok(card_cvc) = card_cvc {+ payment_method_data.data.set_card_cvc(card_cvc);+ }}Ok(payment_method_data)diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rsindex 0ee9ef16e1..3f6abbb181 100644--- a/crates/router/src/core/payments.rs+++ b/crates/router/src/core/payments.rs@@ -1491,6 +1491,15 @@ where}let payment_intent_status = payment_data.get_payment_intent().status;+ let retain_payment_method_token_for_retry = payment_intent_status+ .is_eligible_for_manual_retry()+ && business_profile.is_manual_retry_enabled == Some(true)+ && business_profile.intent_fulfillment_time.is_some()+ && payment_data+ .get_payment_method_info()+ .is_some_and(|payment_method| {+ payment_method.version == common_enums::ApiVersion::V2+ });payment_data.get_payment_attempt()@@ -1501,6 +1510,7 @@ where.async_map(|key_for_hyperswitch_token| async move {if key_for_hyperswitch_token.should_delete_payment_method_token(payment_intent_status)+ && !retain_payment_method_token_for_retry{let _ = key_for_hyperswitch_token.delete(state).await;}diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rsindex b23baa5d6b..926165cf49 100644--- a/crates/router/src/core/payments/helpers.rs+++ b/crates/router/src/core/payments/helpers.rs@@ -3670,7 +3670,6 @@ pub async fn make_pm_data<'a, F: Clone, R, D>(use crate::core::payments::OperationSessionGetters;let request = payment_data.payment_method_data.clone();-let mut card_token_data = payment_data.payment_method_data.clone()@@ -5420,6 +5419,8 @@ pub fn get_attempt_type(payment_intent: &PaymentIntent,payment_attempt: &PaymentAttempt,is_manual_retry_enabled: Option<bool>,+ intent_fulfillment_time: Option<i64>,+ is_token_based_retry: bool,action: &str,) -> RouterResult<AttemptType> {match payment_intent.status {@@ -5430,6 +5431,8 @@ pub fn get_attempt_type(!validate_manual_retry_cutoff(payment_intent.created_at,payment_intent.session_expiry,+ intent_fulfillment_time,+ is_token_based_retry,),|| {Err(report!(errors::ApiErrorResponse::PreconditionFailed {@@ -5550,19 +5553,22 @@ pub fn get_attempt_type(fn validate_manual_retry_cutoff(created_at: time::PrimitiveDateTime,session_expiry: Option<time::PrimitiveDateTime>,+ intent_fulfillment_time: Option<i64>,+ is_token_based_retry: bool,) -> bool {let utc_current_time = time::OffsetDateTime::now_utc();let primitive_utc_current_time =time::PrimitiveDateTime::new(utc_current_time.date(), utc_current_time.time());let time_difference_from_creation = primitive_utc_current_time - created_at;- // cutoff time is 50% of session duration- let cutoff_limit = match session_expiry {- Some(session_expiry) => {- let duration = session_expiry - created_at;- duration.whole_seconds() / 2- }- None => consts::DEFAULT_SESSION_EXPIRY / 2,+ // Token based retries (S2S) use the fulfillment window;+ // Raw data based retries (client) retain the half-session cutoff.+ let cutoff_limit = if is_token_based_retry {+ intent_fulfillment_time.unwrap_or(common_utils::consts::DEFAULT_INTENT_FULFILLMENT_TIME)+ } else {+ session_expiry+ .map(|session_expiry| (session_expiry - created_at).whole_seconds() / 2)+ .unwrap_or(consts::DEFAULT_SESSION_EXPIRY / 2)};time_difference_from_creation.whole_seconds() <= cutoff_limit@@ -5576,17 +5582,37 @@ pub enum AttemptType {impl AttemptType {#[cfg(feature = "v1")]- // The function creates a new payment_attempt from the previous payment attempt but doesn't populate fields like payment_method, error_code etc.- // Logic to override the fields with data provided in the request should be done after this if required.- // In case if fields are not overridden by the request then they contain the same data that was in the previous attempt provided it is populated in this function.+ // A retry request carrying a payment token can reuse and override the previous attempt's fields.+ // Other retries keep the existing reset and inheritance behavior.#[inline(always)]fn make_new_manual_retry_payment_attempt(- payment_method_data: Option<&api_models::payments::PaymentMethodData>,+ request: &api_models::payments::PaymentsRequest,old_payment_attempt: PaymentAttempt,new_attempt_count: i16,storage_scheme: enums::MerchantStorageScheme,) -> PaymentAttempt {let created_at @ modified_at @ last_synced = common_utils::date_time::now();+ let is_token_based_retry = request.payment_token.is_some();+ let (payment_method, browser_info, payment_method_type, setup_future_usage_applied) =+ if is_token_based_retry {+ (+ request+ .payment_method+ .or(old_payment_attempt.payment_method),+ request+ .browser_info+ .clone()+ .or(old_payment_attempt.browser_info),+ request+ .payment_method_type+ .or(old_payment_attempt.payment_method_type),+ request+ .setup_future_usage+ .or(old_payment_attempt.setup_future_usage_applied),+ )+ } else {+ (None, None, None, None)+ };PaymentAttempt {attempt_id: old_payment_attempt@@ -5596,7 +5622,15 @@ impl AttemptType {merchant_id: old_payment_attempt.merchant_id,// A new payment attempt is getting created so, used the same function which is used to populate status in PaymentCreate Flow.- status: payment_attempt_status_fsm(payment_method_data, Some(true)),+ status: payment_attempt_status_fsm(+ request+ .payment_method_data+ .as_ref()+ .and_then(|payment_method_data| {+ payment_method_data.payment_method_data.as_ref()+ }),+ Some(true),+ ),currency: old_payment_attempt.currency,save_to_locker: old_payment_attempt.save_to_locker,@@ -5606,7 +5640,7 @@ impl AttemptType {error_message: None,offer_amount: old_payment_attempt.offer_amount,payment_method_id: None,- payment_method: None,+ payment_method,capture_method: old_payment_attempt.capture_method,capture_on: old_payment_attempt.capture_on,confirm: old_payment_attempt.confirm,@@ -5621,14 +5655,14 @@ impl AttemptType {// Since mandate_id is a contract between merchant and customer to debit customers amount adding it to newly created attemptmandate_id: old_payment_attempt.mandate_id,- // The payment could be done from a different browser or same browser, it would probably be overridden by request data.- browser_info: None,+ // Token-based retries can override reusable fields from the previous attempt.+ browser_info,error_code: None,payment_token: None,connector_metadata: None,payment_experience: None,- payment_method_type: None,+ payment_method_type,payment_method_data: None,// In case it is passed in create and not in confirm,@@ -5671,7 +5705,7 @@ impl AttemptType {card_discovery: None,processor_merchant_id: old_payment_attempt.processor_merchant_id,created_by: old_payment_attempt.created_by,- setup_future_usage_applied: None,+ setup_future_usage_applied,routing_approach: old_payment_attempt.routing_approach,connector_request_reference_id: None,network_transaction_id: None,@@ -5728,12 +5762,7 @@ impl AttemptType {let db = &*state.store;let new_attempt_count = fetched_payment_intent.attempt_count + 1;let new_payment_attempt_to_insert = Self::make_new_manual_retry_payment_attempt(- request- .payment_method_data- .as_ref()- .and_then(|request_payment_method_data| {- request_payment_method_data.payment_method_data.as_ref()- }),+ request,fetched_payment_attempt,new_attempt_count,storage_scheme,diff --git a/crates/router/src/core/payments/operations/payment_confirm.rs b/crates/router/src/core/payments/operations/payment_confirm.rsindex b02bb47baf..0333c62a77 100644--- a/crates/router/src/core/payments/operations/payment_confirm.rs+++ b/crates/router/src/core/payments/operations/payment_confirm.rs@@ -17,7 +17,6 @@ use hyperswitch_domain_models::{mandates,mandates::{ConnectorMandateReferenceId, MandateTransactionType},payment_method_data::RecurringDetails as domain_recurring_details,- payment_methods::PaymentMethodWithRawData,payments::{self as domain_payments, payment_intent::PaymentIntentUpdateFields},router_request_types::unified_authentication_service,};@@ -42,7 +41,7 @@ use crate::{errors::{self, CustomResult, RouterResult, StorageErrorExt},mandate::helpers as m_helpers,metrics, offer_engine,- payment_methods::transformers as pm_transformers,+ payment_methods::{transformers as pm_transformers, vault},payments::{self, helpers, operations, populate_installment_details, CustomerDetails,OperationSessionGetters, OperationSessionSetters, PaymentAddress, PaymentData,@@ -91,6 +90,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>) -> RouterResult<operations::GetTrackerResponse<'a, F, api::PaymentsRequest, PaymentData<F>>>{let operations::PaymentMethodFetchData {+ payment_intent: prefetched_payment_intent,payment_method_info: prefetched_payment_method_info,payment_method_with_raw_data,token_data: prefetched_token_data,@@ -108,15 +108,18 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>let m_merchant_id = processor_merchant_id.clone();// Parallel calls - level 0- let mut payment_intent = store- .find_payment_intent_by_payment_id_processor_merchant_id(- &payment_id,- &m_merchant_id,- platform.get_processor().get_key_store(),- storage_scheme,- )- .await- .to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;+ let mut payment_intent = match prefetched_payment_intent {+ Some(payment_intent) => payment_intent,+ None => store+ .find_payment_intent_by_payment_id_processor_merchant_id(+ &payment_id,+ &m_merchant_id,+ platform.get_processor().get_key_store(),+ storage_scheme,+ )+ .await+ .to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?,+ };// TODO (#7195): Add platform merchant account validation once client_secret auth is solved@@ -351,6 +354,8 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>&payment_intent,&payment_attempt,business_profile.is_manual_retry_enabled,+ business_profile.get_order_fulfillment_time(),+ request.payment_token.is_some(),"confirm",)?;@@ -1266,7 +1271,30 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsRequest, PaymentData<F>> forplatform: &domain::Platform,feature_config: &core_utils::FeatureConfig,) -> RouterResult<operations::PaymentMethodFetchData> {- let payment_method_fetch_data = if feature_config.is_payment_method_modular_allowed {+ let payment_id = req+ .payment_id+ .as_ref()+ .get_required_value("payment_id")?+ .get_payment_intent_id()+ .change_context(errors::ApiErrorResponse::PaymentNotFound)?;+ let payment_intent = state+ .store+ .find_payment_intent_by_payment_id_processor_merchant_id(+ &payment_id,+ platform.get_processor().get_account().get_id(),+ platform.get_processor().get_key_store(),+ platform.get_processor().get_account().storage_scheme,+ )+ .await+ .to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)?;+ let profile_id = payment_intent+ .profile_id+ .as_ref()+ .get_required_value("profile_id")+ .change_context(errors::ApiErrorResponse::InternalServerError)+ .attach_printable("'profile_id' not set in payment intent")?;++ let mut payment_method_fetch_data = if feature_config.is_payment_method_modular_allowed {utils::when(req.off_session == Some(true) && req.recurring_details.is_none(),|| {@@ -1318,16 +1346,14 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsRequest, PaymentData<F>> forlogger::debug!("Organization is enabled for modular service, fetching payment method from PM Modular Service");- let pm_info = self- .fetch_payment_method_from_modular_service(- state,- req,- platform,- &payment_method_ref_to_use,- )- .await?;-- operations::PaymentMethodFetchData::from_modular(pm_info)+ self.fetch_payment_method_from_modular_service(+ state,+ req,+ platform,+ profile_id,+ &payment_method_ref_to_use,+ )+ .await?} else {operations::PaymentMethodFetchData::default()}@@ -1379,23 +1405,21 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsRequest, PaymentData<F>> forlogger::debug!("Payment method version is V2, fetching payment method from PM Modular Service");- let payment_method_id = payment_method.get_id().to_owned();- let pm_info = self- .fetch_payment_method_from_modular_service(- state,- req,- platform,- &payment_method_id,- )- .await?;-- operations::PaymentMethodFetchData::from_modular(pm_info)+ self.fetch_payment_method_from_modular_service(+ state,+ req,+ platform,+ profile_id,+ payment_method.get_id(),+ )+ .await?}Some(payment_method) => {logger::info!("Organization is not eligible for PM Modular Service, skipping fetch payment method.");operations::PaymentMethodFetchData::from_legacy(payment_method, token_data)}None => operations::PaymentMethodFetchData {+ payment_intent: None,payment_method_info: None,payment_method_with_raw_data: None,token_data,@@ -1403,6 +1427,8 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsRequest, PaymentData<F>> for}};+ payment_method_fetch_data.payment_intent = Some(payment_intent);+Ok(payment_method_fetch_data)}@@ -2442,18 +2468,9 @@ impl PaymentConfirm {state: &SessionState,req: &api::PaymentsRequest,platform: &domain::Platform,+ profile_id: &common_utils::id_type::ProfileId,payment_method_ref: &str,- ) -> RouterResult<PaymentMethodWithRawData> {- let profile_id = req- .profile_id- .clone()- .or(platform- .get_processor()- .get_account()- .get_default_profile()- .clone())- .get_required_value("profile_id")?;-+ ) -> RouterResult<operations::PaymentMethodFetchData> {let pmd = req.payment_method_data.clone()@@ -2470,13 +2487,22 @@ impl PaymentConfirm {// token so it is not carried any further.if let Some(token) = card_token_data.as_mut() {if let Some(card_cvc_token) = token.card_cvc_token.take() {- let resolved_cvc =- crate::core::payment_methods::vault::retrieve_and_delete_cvc_from_payment_token(- state,- card_cvc_token.peek(),- platform.get_provider().get_key_store(),- )- .await?;+ utils::when(+ req.retry_action == Some(api_models::enums::RetryAction::ManualRetry),+ || {+ Err(errors::ApiErrorResponse::PreconditionFailed {+ message: "Manual retry is not supported with card_cvc_token"+ .to_string(),+ })+ },+ )?;+ let resolved_cvc = vault::retrieve_cvc_from_payment_token(+ state,+ card_cvc_token.peek(),+ platform.get_provider().get_key_store(),+ vault::CvcReadMode::ReadAndDelete,+ )+ .await?;token.card_cvc = Some(resolved_cvc);}}@@ -2495,7 +2521,7 @@ impl PaymentConfirm {let pm_info = pm_transformers::fetch_payment_method_from_modular_service(state,platform,- &profile_id,+ profile_id,payment_method_ref,card_token_data,true, // fetch raw card detail from the internal vault@@ -2515,7 +2541,7 @@ impl PaymentConfirm {},)?;- Ok(pm_info)+ Ok(operations::PaymentMethodFetchData::from_modular(pm_info))}fn get_payment_method_reference(self, req: &api::PaymentsRequest) -> Option<&str> {diff --git a/crates/router/src/core/payments/operations/payment_confirm_intent.rs b/crates/router/src/core/payments/operations/payment_confirm_intent.rsindex 8ae786842d..b501ac6444 100644--- a/crates/router/src/core/payments/operations/payment_confirm_intent.rs+++ b/crates/router/src/core/payments/operations/payment_confirm_intent.rs@@ -583,15 +583,14 @@ impl<F: Clone + Send + Sync> Domain<F, PaymentsConfirmIntentRequest, PaymentConf.ok_or(errors::ApiErrorResponse::InvalidDataValue {field_name: "card_cvc",})- .or(- payment_methods::vault::retrieve_and_delete_cvc_from_payment_token(- state,- &payment_method.get_id().get_string_repr().to_string(),- platform.get_processor().get_key_store(),- )- .boxed()- .await,+ .or(payment_methods::vault::retrieve_cvc_from_payment_token(+ state,+ &payment_method.get_id().get_string_repr().to_string(),+ platform.get_processor().get_key_store(),+ payment_methods::vault::CvcReadMode::ReadAndDelete,)+ .boxed()+ .await).attach_printable("card_cvc not provided")?,card_token.card_holder_name.clone(),)diff --git a/crates/router/src/core/payments/operations/payment_response.rs b/crates/router/src/core/payments/operations/payment_response.rsindex 401b85667d..ede178d0e2 100644--- a/crates/router/src/core/payments/operations/payment_response.rs+++ b/crates/router/src/core/payments/operations/payment_response.rs@@ -3083,6 +3083,20 @@ async fn payment_response_update_tracker<F: Clone, T: types::Capturable>(.await;}+ if payment_data.payment_attempt.payment_method == Some(enums::PaymentMethod::Card) {+ delete_cvc_after_success(+ state,+ payment_data.payment_attempt.status,+ payment_data.payment_method_info.as_ref(),+ payment_data.card_cvc.is_some()+ || payment_data+ .payment_method_data+ .as_ref()+ .is_some_and(has_card_cvc),+ )+ .await;+ }+match router_data.integrity_check {Ok(()) => Ok(payment_data),Err(err) => {@@ -3120,6 +3134,44 @@ async fn payment_response_update_tracker<F: Clone, T: types::Capturable>(}}+#[cfg(feature = "v1")]+fn has_card_cvc(payment_method_data: &domain::PaymentMethodData) -> bool {+ match payment_method_data {+ domain::PaymentMethodData::Card(_) => true,+ domain::PaymentMethodData::CardToken(card) => card.card_cvc.is_some(),+ domain::PaymentMethodData::CardWithOptionalCVC(card) => card.card_cvc.is_some(),+ domain::PaymentMethodData::CardWithNetworkTokenDetails(card) => {+ card.card_details.card_cvc.is_some()+ }+ _ => false,+ }+}++#[cfg(feature = "v1")]+async fn delete_cvc_after_success(+ state: &SessionState,+ attempt_status: enums::AttemptStatus,+ payment_method_info: Option<&domain::PaymentMethod>,+ card_cvc_used: bool,+) {+ let card_payment_method_id = payment_method_info+ .filter(|payment_method| {+ card_cvc_used && payment_method.version == common_enums::ApiVersion::V2+ })+ .map(|payment_method| payment_method.get_id());++ if attempt_status.is_authorization_success() {+ if let Some(payment_method_id) = card_payment_method_id {+ payment_methods::vault::delete_cvc_from_payment_token(state, payment_method_id)+ .await+ .inspect_err(|error| {+ logger::error!(?error, "Failed to delete retained CVC after authorization");+ })+ .ok();+ }+ }+}+#[cfg(feature = "v1")]fn get_payment_intent_update_data<F: Clone, T: types::Capturable>(payment_data: PaymentData<F>,diff --git a/crates/router/src/core/proxy/utils.rs b/crates/router/src/core/proxy/utils.rsindex dcfd02d62c..cba4decdc4 100644--- a/crates/router/src/core/proxy/utils.rs+++ b/crates/router/src/core/proxy/utils.rs@@ -248,10 +248,11 @@ impl ProxyRecord {payment_method.get_id().get_string_repr().to_string();let key_store = platform.get_provider().get_key_store();- match vault::retrieve_and_delete_cvc_from_payment_token(+ match vault::retrieve_cvc_from_payment_token(state,&payment_method_id_str,key_store,+ vault::CvcReadMode::ReadAndDelete,).await{@@ -326,10 +327,11 @@ impl ProxyRecord {payment_method.get_id().get_string_repr().to_string();let key_store = platform.get_provider().get_key_store();- match vault::retrieve_and_delete_cvc_from_payment_token(+ match vault::retrieve_cvc_from_payment_token(state,&payment_method_id_str,key_store,+ vault::CvcReadMode::ReadAndDelete,).await{diff --git a/crates/router/src/routes/metrics.rs b/crates/router/src/routes/metrics.rsindex 9dfcc2605f..30176e21fe 100644--- a/crates/router/src/routes/metrics.rs+++ b/crates/router/src/routes/metrics.rs@@ -38,6 +38,10 @@ counter_metric!(SUBSEQUENT_MANDATE_PAYMENT, GLOBAL_METER);counter_metric!(MANUAL_RETRY_REQUEST_COUNT, GLOBAL_METER);counter_metric!(MANUAL_RETRY_COUNT, GLOBAL_METER);counter_metric!(MANUAL_RETRY_VALIDATION_FAILED, GLOBAL_METER);+counter_metric!(CVC_READ_ONLY_RETRIEVAL, GLOBAL_METER);+counter_metric!(CVC_DELETED_AFTER_SUCCESS, GLOBAL_METER);+counter_metric!(CVC_DELETION_FAILURE, GLOBAL_METER);+counter_metric!(MANUAL_RETRY_CVC_LOOKUP_MISS, GLOBAL_METER);counter_metric!(STORED_TO_LOCKER, GLOBAL_METER);counter_metric!(GET_FROM_LOCKER, GLOBAL_METER);diff --git a/crates/router/src/routes/payments.rs b/crates/router/src/routes/payments.rsindex f929ce5f53..421ee42371 100644--- a/crates/router/src/routes/payments.rs+++ b/crates/router/src/routes/payments.rs@@ -1115,8 +1115,10 @@ pub async fn payments_confirm(}};- if let Err(err) = helpers::populate_browser_info(&req, &mut payload, &header_payload) {- return api::log_and_return_error_response(err);+ if payload.retry_action != Some(api_enums::RetryAction::ManualRetry) {+ if let Err(err) = helpers::populate_browser_info(&req, &mut payload, &header_payload) {+ return api::log_and_return_error_response(err);+ }}let payment_id = path.into_inner();diff --git a/crates/storage_impl/src/business_profile.rs b/crates/storage_impl/src/business_profile.rsindex ab8f3c519f..78c838c759 100644--- a/crates/storage_impl/src/business_profile.rs+++ b/crates/storage_impl/src/business_profile.rs@@ -674,6 +674,7 @@ impl ForeignFrom<domain::ProfileUpdate> for ProfileUpdateInternal {metadata,routing_algorithm,intent_fulfillment_time,+ order_fulfillment_time: intent_fulfillment_time,frm_routing_algorithm,payout_routing_algorithm,is_recon_enabled: None,@@ -742,6 +743,7 @@ impl ForeignFrom<domain::ProfileUpdate> for ProfileUpdateInternal {metadata: None,routing_algorithm,intent_fulfillment_time: None,+ order_fulfillment_time: None,frm_routing_algorithm: None,payout_routing_algorithm,is_recon_enabled: None,@@ -805,6 +807,7 @@ impl ForeignFrom<domain::ProfileUpdate> for ProfileUpdateInternal {metadata: None,routing_algorithm: None,intent_fulfillment_time: None,+ order_fulfillment_time: None,frm_routing_algorithm: None,payout_routing_algorithm: None,is_recon_enabled: None,@@ -868,6 +871,7 @@ impl ForeignFrom<domain::ProfileUpdate> for ProfileUpdateInternal {metadata: None,routing_algorithm: None,intent_fulfillment_time: None,+ order_fulfillment_time: None,frm_routing_algorithm: None,payout_routing_algorithm: None,is_recon_enabled: None,@@ -931,6 +935,7 @@ impl ForeignFrom<domain::ProfileUpdate> for ProfileUpdateInternal {metadata: None,routing_algorithm: None,intent_fulfillment_time: None,+ order_fulfillment_time: None,frm_routing_algorithm: None,payout_routing_algorithm: None,is_recon_enabled: None,@@ -995,6 +1000,7 @@ impl ForeignFrom<domain::ProfileUpdate> for ProfileUpdateInternal {metadata: None,routing_algorithm: None,intent_fulfillment_time: None,+ order_fulfillment_time: None,frm_routing_algorithm: None,payout_routing_algorithm: None,is_recon_enabled: None,@@ -1059,6 +1065,7 @@ impl ForeignFrom<domain::ProfileUpdate> for ProfileUpdateInternal {metadata: None,routing_algorithm: None,intent_fulfillment_time: None,+ order_fulfillment_time: None,frm_routing_algorithm: None,payout_routing_algorithm: None,is_recon_enabled: None,@@ -1122,6 +1129,7 @@ impl ForeignFrom<domain::ProfileUpdate> for ProfileUpdateInternal {metadata: None,routing_algorithm: None,intent_fulfillment_time: None,+ order_fulfillment_time: None,frm_routing_algorithm: None,payout_routing_algorithm: None,is_recon_enabled: None,@@ -1186,6 +1194,7 @@ impl ForeignFrom<domain::ProfileUpdate> for ProfileUpdateInternal {metadata: None,routing_algorithm: None,intent_fulfillment_time: None,+ order_fulfillment_time: None,frm_routing_algorithm: None,payout_routing_algorithm: None,is_recon_enabled: None,@@ -1265,6 +1274,7 @@ impl Conversion for domain::Profile {metadata: self.metadata,routing_algorithm: self.routing_algorithm,intent_fulfillment_time: self.intent_fulfillment_time,+ order_fulfillment_time: self.intent_fulfillment_time,frm_routing_algorithm: self.frm_routing_algorithm,payout_routing_algorithm: self.payout_routing_algorithm,is_recon_enabled: self.is_recon_enabled,@@ -1499,6 +1509,7 @@ impl Conversion for domain::Profile {metadata: self.metadata,routing_algorithm: self.routing_algorithm,intent_fulfillment_time: self.intent_fulfillment_time,+ order_fulfillment_time: self.intent_fulfillment_time,frm_routing_algorithm: self.frm_routing_algorithm,payout_routing_algorithm: self.payout_routing_algorithm,is_recon_enabled: self.is_recon_enabled,@@ -2372,6 +2383,7 @@ impl Conversion for domain::Profile {merchant_category_code: item.merchant_category_code,merchant_country_code: item.merchant_country_code,split_txns_enabled: item.split_txns_enabled.unwrap_or_default(),+ is_manual_retry_enabled: item.is_manual_retry_enabled,billing_processor_id: item.billing_processor_id,surcharge_connector_details: item.surcharge_connector_details,}diff --git a/migrations/2026-07-29-182134-0000_add_order_fulfillment_time_to_business_profile/down.sql b/migrations/2026-07-29-182134-0000_add_order_fulfillment_time_to_business_profile/down.sqlnew file mode 100644index 0000000000..0328052530--- /dev/null+++ b/migrations/2026-07-29-182134-0000_add_order_fulfillment_time_to_business_profile/down.sql@@ -0,0 +1,2 @@+ALTER TABLE business_profile+DROP COLUMN IF EXISTS order_fulfillment_time;diff --git a/migrations/2026-07-29-182134-0000_add_order_fulfillment_time_to_business_profile/up.sql b/migrations/2026-07-29-182134-0000_add_order_fulfillment_time_to_business_profile/up.sqlnew file mode 100644index 0000000000..63f5cb1595--- /dev/null+++ b/migrations/2026-07-29-182134-0000_add_order_fulfillment_time_to_business_profile/up.sql@@ -0,0 +1,2 @@+ALTER TABLE business_profile+ADD COLUMN IF NOT EXISTS order_fulfillment_time BIGINT;diff --git a/v2_compatible_migrations/2024-08-28-081721_add_v2_columns/down.sql b/v2_compatible_migrations/2024-08-28-081721_add_v2_columns/down.sqlindex 7786eba1a0..a1fd835979 100644--- a/v2_compatible_migrations/2024-08-28-081721_add_v2_columns/down.sql+++ b/v2_compatible_migrations/2024-08-28-081721_add_v2_columns/down.sql@@ -6,7 +6,6 @@ ALTER TABLE customers DROP COLUMN IF EXISTS merchant_reference_id,DROP COLUMN IF EXISTS status;ALTER TABLE business_profile DROP COLUMN routing_algorithm_id,- DROP COLUMN order_fulfillment_time,DROP COLUMN order_fulfillment_time_origin,DROP COLUMN frm_routing_algorithm_id,DROP COLUMN payout_routing_algorithm_id,@@ -56,4 +55,4 @@ ALTER TABLE payment_methodsALTER TABLE refundDROP COLUMN IF EXISTS id,DROP COLUMN IF EXISTS merchant_reference_id,- DROP COLUMN IF EXISTS connector_id;\ No newline at end of file+ DROP COLUMN IF EXISTS connector_id;diff --git a/v2_compatible_migrations/2024-08-28-081721_add_v2_columns/up.sql b/v2_compatible_migrations/2024-08-28-081721_add_v2_columns/up.sqlindex 1aacd8ffc1..ad3ac2203f 100644--- a/v2_compatible_migrations/2024-08-28-081721_add_v2_columns/up.sql+++ b/v2_compatible_migrations/2024-08-28-081721_add_v2_columns/up.sql@@ -10,7 +10,6 @@ CREATE TYPE "OrderFulfillmentTimeOrigin" AS ENUM ('create', 'confirm');ALTER TABLE business_profileADD COLUMN routing_algorithm_id VARCHAR(64) DEFAULT NULL,- ADD COLUMN order_fulfillment_time BIGINT DEFAULT NULL,ADD COLUMN order_fulfillment_time_origin "OrderFulfillmentTimeOrigin" DEFAULT NULL,ADD COLUMN frm_routing_algorithm_id VARCHAR(64) DEFAULT NULL,ADD COLUMN payout_routing_algorithm_id VARCHAR(64) DEFAULT NULL,@@ -66,4 +65,4 @@ ALTER TABLE payment_methodsALTER TABLE refundADD COLUMN IF NOT EXISTS id VARCHAR(64),ADD COLUMN IF NOT EXISTS merchant_reference_id VARCHAR(64),- ADD COLUMN IF NOT EXISTS connector_id VARCHAR(64);\ No newline at end of file+ ADD COLUMN IF NOT EXISTS connector_id VARCHAR(64);