Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Feb 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions crates/router/src/core/payments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4515,6 +4515,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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
Loading