diff --git a/crates/diesel_models/src/payment_attempt.rs b/crates/diesel_models/src/payment_attempt.rs index 29c65d549bf..f072e7d475e 100644 --- a/crates/diesel_models/src/payment_attempt.rs +++ b/crates/diesel_models/src/payment_attempt.rs @@ -484,6 +484,8 @@ pub enum PaymentAttemptUpdate { encoded_data: Option, unified_code: Option>, unified_message: Option>, + capture_before: Option, + extended_authorization_applied: Option, payment_method_data: Option, charge_id: Option, connector_mandate_detail: Option, @@ -860,6 +862,8 @@ pub struct PaymentAttemptUpdateInternal { pub client_version: Option, pub customer_acceptance: Option, pub card_network: Option, + pub capture_before: Option, + pub extended_authorization_applied: Option, pub shipping_cost: Option, pub order_tax_amount: Option, pub connector_transaction_data: Option, @@ -1047,6 +1051,8 @@ impl PaymentAttemptUpdate { order_tax_amount, connector_transaction_data, connector_mandate_detail, + capture_before, + extended_authorization_applied, } = PaymentAttemptUpdateInternal::from(self).populate_derived_fields(&source); PaymentAttempt { amount: amount.unwrap_or(source.amount), @@ -1105,6 +1111,9 @@ impl PaymentAttemptUpdate { connector_transaction_data: connector_transaction_data .or(source.connector_transaction_data), connector_mandate_detail: connector_mandate_detail.or(source.connector_mandate_detail), + capture_before: capture_before.or(source.capture_before), + extended_authorization_applied: extended_authorization_applied + .or(source.extended_authorization_applied), ..source } } @@ -2154,6 +2163,8 @@ impl From for PaymentAttemptUpdateInternal { customer_acceptance: None, card_network: None, shipping_cost: None, + capture_before: None, + extended_authorization_applied: None, order_tax_amount: None, connector_transaction_data: None, connector_mandate_detail: None, @@ -2211,6 +2222,8 @@ impl From for PaymentAttemptUpdateInternal { card_network: None, shipping_cost: None, order_tax_amount: None, + capture_before: None, + extended_authorization_applied: None, connector_transaction_data: None, connector_mandate_detail: None, }, @@ -2298,6 +2311,8 @@ impl From for PaymentAttemptUpdateInternal { card_network: None, shipping_cost, order_tax_amount, + capture_before: None, + extended_authorization_applied: None, connector_transaction_data: None, connector_mandate_detail, }, @@ -2355,6 +2370,8 @@ impl From for PaymentAttemptUpdateInternal { card_network: None, shipping_cost: None, order_tax_amount: None, + capture_before: None, + extended_authorization_applied: None, connector_transaction_data: None, connector_mandate_detail: None, }, @@ -2413,6 +2430,8 @@ impl From for PaymentAttemptUpdateInternal { card_network: None, shipping_cost: None, order_tax_amount: None, + capture_before: None, + extended_authorization_applied: None, connector_transaction_data: None, connector_mandate_detail: None, }, @@ -2471,6 +2490,8 @@ impl From for PaymentAttemptUpdateInternal { card_network: None, shipping_cost: None, order_tax_amount: None, + capture_before: None, + extended_authorization_applied: None, connector_transaction_data: None, connector_mandate_detail: None, }, @@ -2527,6 +2548,8 @@ impl From for PaymentAttemptUpdateInternal { card_network: None, shipping_cost: None, order_tax_amount: None, + capture_before: None, + extended_authorization_applied: None, connector_transaction_data: None, connector_mandate_detail, }, @@ -2583,6 +2606,8 @@ impl From for PaymentAttemptUpdateInternal { card_network: None, shipping_cost: None, order_tax_amount: None, + capture_before: None, + extended_authorization_applied: None, connector_transaction_data: None, connector_mandate_detail: None, }, @@ -2605,6 +2630,8 @@ impl From for PaymentAttemptUpdateInternal { encoded_data, unified_code, unified_message, + capture_before, + extended_authorization_applied, payment_method_data, charge_id, connector_mandate_detail, @@ -2663,6 +2690,8 @@ impl From for PaymentAttemptUpdateInternal { client_version: None, customer_acceptance: None, card_network: None, + capture_before, + extended_authorization_applied, shipping_cost: None, order_tax_amount: None, connector_mandate_detail, @@ -2736,6 +2765,8 @@ impl From for PaymentAttemptUpdateInternal { client_version: None, customer_acceptance: None, card_network: None, + capture_before: None, + extended_authorization_applied: None, shipping_cost: None, order_tax_amount: None, connector_mandate_detail: None, @@ -2790,6 +2821,8 @@ impl From for PaymentAttemptUpdateInternal { customer_acceptance: None, card_network: None, shipping_cost: None, + capture_before: None, + extended_authorization_applied: None, order_tax_amount: None, connector_transaction_data: None, connector_mandate_detail: None, @@ -2852,6 +2885,8 @@ impl From for PaymentAttemptUpdateInternal { customer_acceptance: None, card_network: None, shipping_cost: None, + capture_before: None, + extended_authorization_applied: None, order_tax_amount: None, connector_transaction_data: None, connector_mandate_detail: None, @@ -2922,6 +2957,8 @@ impl From for PaymentAttemptUpdateInternal { customer_acceptance: None, card_network: None, shipping_cost: None, + capture_before: None, + extended_authorization_applied: None, order_tax_amount: None, connector_mandate_detail: None, } @@ -2989,6 +3026,8 @@ impl From for PaymentAttemptUpdateInternal { client_version: None, customer_acceptance: None, card_network: None, + capture_before: None, + extended_authorization_applied: None, shipping_cost: None, order_tax_amount: None, connector_mandate_detail: None, @@ -3048,6 +3087,8 @@ impl From for PaymentAttemptUpdateInternal { card_network: None, shipping_cost: None, order_tax_amount: None, + capture_before: None, + extended_authorization_applied: None, connector_transaction_data: None, connector_mandate_detail: None, }, @@ -3104,6 +3145,8 @@ impl From for PaymentAttemptUpdateInternal { customer_acceptance: None, card_network: None, shipping_cost: None, + capture_before: None, + extended_authorization_applied: None, order_tax_amount: None, connector_transaction_data: None, connector_mandate_detail: None, @@ -3171,6 +3214,8 @@ impl From for PaymentAttemptUpdateInternal { customer_acceptance: None, card_network: None, shipping_cost: None, + capture_before: None, + extended_authorization_applied: None, order_tax_amount: None, connector_mandate_detail: None, } @@ -3228,6 +3273,8 @@ impl From for PaymentAttemptUpdateInternal { card_network: None, shipping_cost: None, order_tax_amount: None, + capture_before: None, + extended_authorization_applied: None, connector_transaction_data: None, connector_mandate_detail: None, }, @@ -3287,6 +3334,8 @@ impl From for PaymentAttemptUpdateInternal { card_network: None, shipping_cost: None, order_tax_amount: None, + capture_before: None, + extended_authorization_applied: None, connector_transaction_data: None, connector_mandate_detail: None, }, @@ -3355,6 +3404,8 @@ impl From for PaymentAttemptUpdateInternal { customer_acceptance: None, card_network: None, shipping_cost: None, + capture_before: None, + extended_authorization_applied: None, order_tax_amount: None, connector_mandate_detail: None, } @@ -3412,6 +3463,8 @@ impl From for PaymentAttemptUpdateInternal { card_network: None, shipping_cost: None, order_tax_amount: None, + capture_before: None, + extended_authorization_applied: None, connector_transaction_data: None, connector_mandate_detail: None, }, diff --git a/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs b/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs index 63681497cdd..7c45fa78937 100644 --- a/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs +++ b/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs @@ -871,6 +871,8 @@ pub enum PaymentAttemptUpdate { encoded_data: Option, unified_code: Option>, unified_message: Option>, + capture_before: Option, + extended_authorization_applied: Option, payment_method_data: Option, charge_id: Option, connector_mandate_detail: Option, @@ -1141,6 +1143,8 @@ impl PaymentAttemptUpdate { encoded_data, unified_code, unified_message, + capture_before, + extended_authorization_applied, payment_method_data, charge_id, connector_mandate_detail, @@ -1163,6 +1167,8 @@ impl PaymentAttemptUpdate { encoded_data, unified_code, unified_message, + capture_before, + extended_authorization_applied, payment_method_data, charge_id, connector_mandate_detail, diff --git a/crates/router/src/core/payments/operations/payment_response.rs b/crates/router/src/core/payments/operations/payment_response.rs index d77236c8a2b..ac26e594584 100644 --- a/crates/router/src/core/payments/operations/payment_response.rs +++ b/crates/router/src/core/payments/operations/payment_response.rs @@ -1667,6 +1667,19 @@ async fn payment_response_update_tracker( payment_data.payment_attempt.connector.clone(), payment_data.payment_attempt.merchant_id.clone(), ); + let (capture_before, extended_authorization_applied) = router_data + .connector_response + .as_ref() + .and_then(|connector_response| { + connector_response.get_extended_authorization_response_data() + }) + .and_then(|extended_auth_resp| { + Some(( + extended_auth_resp.capture_before, + extended_auth_resp.extended_authentication_applied, + )) + }) + .unwrap_or((None, None)); let (capture_updates, payment_attempt_update) = match payment_data .multiple_capture_data { @@ -1728,6 +1741,8 @@ async fn payment_response_update_tracker( authentication_data, encoded_data, payment_method_data: additional_payment_method_data, + capture_before, + extended_authorization_applied, charge_id, connector_mandate_detail: payment_data .payment_attempt diff --git a/crates/router/src/core/payments/retry.rs b/crates/router/src/core/payments/retry.rs index 60ba609828a..7e9222d19ee 100644 --- a/crates/router/src/core/payments/retry.rs +++ b/crates/router/src/core/payments/retry.rs @@ -464,6 +464,8 @@ where encoded_data, unified_code: None, unified_message: None, + capture_before: None, + extended_authorization_applied: None, payment_method_data: additional_payment_method_data, charge_id, connector_mandate_detail: None,