diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs index e9d3c013789..06beee6da22 100644 --- a/crates/router/src/core/payments.rs +++ b/crates/router/src/core/payments.rs @@ -4515,6 +4515,24 @@ impl CustomerDetailsExt for CustomerDetails { } } +pub async fn get_payment_link_response_from_id( + state: &SessionState, + payment_link_id: &str, +) -> CustomResult { + let db = &*state.store; + + let payment_link_object = db + .find_payment_link_by_payment_link_id(payment_link_id) + .await + .to_not_found_response(errors::ApiErrorResponse::PaymentLinkNotFound)?; + + Ok(api_models::payments::PaymentLinkResponse { + link: payment_link_object.link_to_pay.clone(), + secure_link: payment_link_object.secure_link, + payment_link_id: payment_link_object.payment_link_id, + }) +} + #[cfg(feature = "v1")] pub fn if_not_create_change_operation<'a, Op, F>( status: storage_enums::IntentStatus, diff --git a/crates/router/src/core/payments/operations/payment_status.rs b/crates/router/src/core/payments/operations/payment_status.rs index dd28043ba2b..44f0c9172f9 100644 --- a/crates/router/src/core/payments/operations/payment_status.rs +++ b/crates/router/src/core/payments/operations/payment_status.rs @@ -467,6 +467,13 @@ async fn get_tracker_for_sync< }).await .transpose()?; + let payment_link_data = payment_intent + .payment_link_id + .as_ref() + .async_map(|id| crate::core::payments::get_payment_link_response_from_id(state, id)) + .await + .transpose()?; + let payment_data = PaymentData { flow: PhantomData, payment_intent, @@ -512,7 +519,7 @@ async fn get_tracker_for_sync< ephemeral_key: None, multiple_capture_data, redirect_response: None, - payment_link_data: None, + payment_link_data, surcharge_details: None, frm_message: frm_response, incremental_authorization_details: None,