mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-02 04:04:43 +08:00
refactor(payment_link): logs payment links logs coverage (#4918)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
@ -10,6 +10,7 @@ use common_utils::{
|
||||
use error_stack::ResultExt;
|
||||
use futures::future;
|
||||
use masking::{PeekInterface, Secret};
|
||||
use router_env::logger;
|
||||
use time::PrimitiveDateTime;
|
||||
|
||||
use super::errors::{self, RouterResult, StorageErrorExt};
|
||||
@ -161,12 +162,17 @@ pub async fn initiate_payment_link_flow(
|
||||
{
|
||||
let status = match payment_link_status {
|
||||
api_models::payments::PaymentLinkStatus::Active => {
|
||||
logger::info!("displaying status page as the requested payment link has reached terminal state with payment status as {:?}", payment_intent.status);
|
||||
PaymentLinkStatusWrap::IntentStatus(payment_intent.status)
|
||||
}
|
||||
api_models::payments::PaymentLinkStatus::Expired => {
|
||||
if is_terminal_state {
|
||||
logger::info!("displaying status page as the requested payment link has reached terminal state with payment status as {:?}", payment_intent.status);
|
||||
PaymentLinkStatusWrap::IntentStatus(payment_intent.status)
|
||||
} else {
|
||||
logger::info!(
|
||||
"displaying status page as the requested payment link has expired"
|
||||
);
|
||||
PaymentLinkStatusWrap::PaymentLinkStatus(
|
||||
api_models::payments::PaymentLinkStatus::Expired,
|
||||
)
|
||||
@ -198,6 +204,11 @@ pub async fn initiate_payment_link_flow(
|
||||
theme: payment_link_config.theme.clone(),
|
||||
return_url: return_url.clone(),
|
||||
};
|
||||
|
||||
logger::info!(
|
||||
"payment link data, for building payment link status page {:?}",
|
||||
payment_details
|
||||
);
|
||||
let js_script = get_js_script(
|
||||
&api_models::payments::PaymentLinkData::PaymentLinkStatusDetails(payment_details),
|
||||
)?;
|
||||
@ -241,6 +252,11 @@ pub async fn initiate_payment_link_flow(
|
||||
css_script,
|
||||
html_meta_tags,
|
||||
};
|
||||
|
||||
logger::info!(
|
||||
"payment link data, for building payment link {:?}",
|
||||
payment_link_data
|
||||
);
|
||||
Ok(services::ApplicationResponse::PaymentLinkForm(Box::new(
|
||||
services::api::PaymentLinkAction::PaymentLinkFormData(payment_link_data),
|
||||
)))
|
||||
@ -407,6 +423,10 @@ pub fn get_payment_link_config_based_on_priority(
|
||||
field_name: "payment_link_config",
|
||||
})
|
||||
.attach_printable("Invalid payment_link_config given in business config")?;
|
||||
logger::info!(
|
||||
"domain name set to custom domain https://{:?}",
|
||||
extracted_value.domain_name
|
||||
);
|
||||
|
||||
(
|
||||
extracted_value
|
||||
|
||||
@ -324,6 +324,7 @@
|
||||
</div>
|
||||
<script>
|
||||
{{rendered_js}}
|
||||
{{logging_template}}
|
||||
</script>
|
||||
{{ hyperloader_sdk_link }}
|
||||
</body>
|
||||
|
||||
@ -12,6 +12,7 @@
|
||||
/>
|
||||
<script>
|
||||
{{ rendered_js }}
|
||||
{{logging_template}}
|
||||
</script>
|
||||
</head>
|
||||
<body onload="boot()">
|
||||
|
||||
@ -1936,6 +1936,10 @@ pub fn build_payment_link_html(
|
||||
}
|
||||
};
|
||||
|
||||
// Logging template
|
||||
let logging_template =
|
||||
include_str!("redirection/assets/redirect_error_logs_push.js").to_string();
|
||||
|
||||
// Modify Html template with rendered js and rendered css files
|
||||
let html_template =
|
||||
include_str!("../core/payment_link/payment_link_initiate/payment_link.html").to_string();
|
||||
@ -1961,6 +1965,8 @@ pub fn build_payment_link_html(
|
||||
context.insert("rendered_css", &rendered_css);
|
||||
context.insert("rendered_js", &rendered_js);
|
||||
|
||||
context.insert("logging_template", &logging_template);
|
||||
|
||||
match tera.render("payment_link", &context) {
|
||||
Ok(rendered_html) => Ok(rendered_html),
|
||||
Err(tera_error) => {
|
||||
@ -2002,6 +2008,10 @@ pub fn get_payment_link_status(
|
||||
}
|
||||
};
|
||||
|
||||
// Logging template
|
||||
let logging_template =
|
||||
include_str!("redirection/assets/redirect_error_logs_push.js").to_string();
|
||||
|
||||
// Add modification to js template with dynamic data
|
||||
let js_template =
|
||||
include_str!("../core/payment_link/payment_link_status/status.js").to_string();
|
||||
@ -2024,6 +2034,7 @@ pub fn get_payment_link_status(
|
||||
context.insert("rendered_css", &rendered_css);
|
||||
|
||||
context.insert("rendered_js", &rendered_js);
|
||||
context.insert("logging_template", &logging_template);
|
||||
|
||||
match tera.render("payment_link_status", &context) {
|
||||
Ok(rendered_html) => Ok(rendered_html),
|
||||
|
||||
Reference in New Issue
Block a user