Skip to content

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

fix(core): Add payment_link_data in PaymentData for Psync (#7137)

Debarati Ghatak8917235b4c1c
diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs
index 33540cf0b4..dce89107af 100644
--- a/crates/router/src/core/payments.rs
+++ b/crates/router/src/core/payments.rs
@@ -4843,6 +4843,24 @@ impl CustomerDetailsExt for CustomerDetails {
}
}
+pub async fn get_payment_link_response_from_id(
+ state: &SessionState,
+ payment_link_id: &str,
+) -> CustomResult<api_models::payments::PaymentLinkResponse, errors::ApiErrorResponse> {
+ 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 dd28043ba2..44f0c9172f 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,