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
Rust adyenbeginner-friendlyfeaturedfinancefintechhacktoberfesthigh-performanceopen-sourceorchestrationpaymentpayment-gatewaypayment-integrationpayment-processingpaymentspayments-platformrestful-apirustsdkstripeworks-with-react
fix(payment_link): remove dynamic section if no fields are present (#5579)
Sakil Mostak78d9906ebbed
diff --git a/crates/router/src/core/payment_link/payment_link_initiate/payment_link.js b/crates/router/src/core/payment_link/payment_link_initiate/payment_link.jsindex 0d1b8c64d3..db6a1d7176 100644--- a/crates/router/src/core/payment_link/payment_link_initiate/payment_link.js+++ b/crates/router/src/core/payment_link/payment_link_initiate/payment_link.js@@ -617,29 +617,37 @@ function renderDynamicMerchantDetails(paymentDetails) {}function appendMerchantDetails(paymentDetails, merchantDynamicDetails) {- if (Object.keys(paymentDetails.transaction_details).length === 0) {+ if (!(typeof paymentDetails.transaction_details === "string" && paymentDetails.transaction_details.length > 0)) {return;}- // render a horizontal line above dynamic merchant details- let horizontalLineContainer = document.getElementById("hyper-checkout-payment-horizontal-line-container");- let horizontalLine = document.createElement("hr");- horizontalLine.className = "hyper-checkout-payment-horizontal-line";- horizontalLineContainer.append(horizontalLine);+ try {+ let merchantDetailsObject = JSON.parse(paymentDetails.transaction_details);- // max number of items to show in the merchant details- let maxItemsInDetails = 5;- let merchantDetailsObject = JSON.parse(paymentDetails.transaction_details);- for(const key in merchantDetailsObject) {- var merchantData = document.createElement("div");- merchantData.className = "hyper-checkout-payment-merchant-dynamic-data";- merchantData.innerHTML = key+": "+merchantDetailsObject[key].bold();+ if (Object.keys(merchantDetailsObject).length > 0) {+ // render a horizontal line above dynamic merchant details+ var horizontalLineContainer = document.getElementById("hyper-checkout-payment-horizontal-line-container");+ var horizontalLine = document.createElement("hr");+ horizontalLine.className = "hyper-checkout-payment-horizontal-line";+ horizontalLineContainer.append(horizontalLine);- merchantDynamicDetails.append(merchantData);- if(--maxItemsInDetails === 0) {- break;+ // max number of items to show in the merchant details+ let maxItemsInDetails = 5;+ for (var key in merchantDetailsObject) {+ var merchantData = document.createElement("div");+ merchantData.className = "hyper-checkout-payment-merchant-dynamic-data";+ merchantData.innerHTML = key+": "+merchantDetailsObject[key].bold();++ merchantDynamicDetails.append(merchantData);+ if (--maxItemsInDetails === 0) {+ break;+ }+ }}}+ catch (error) {+ console.error("Error parsing merchant details", error);+ }}/**