diff --git a/site/public/order/fcc-compliance/index.html b/site/public/order/fcc-compliance/index.html index 087bb5c..91ffcf6 100644 --- a/site/public/order/fcc-compliance/index.html +++ b/site/public/order/fcc-compliance/index.html @@ -194,6 +194,9 @@ var listEl=document.getElementById("pw-svc-list"); var entityBar=document.getElementById("pw-entity-bar"); var bundleTip=document.getElementById("pw-bundle-tip"); +// Fetch promo code info from API if present +if(promoFromUrl){fetch(API+"/api/v1/discount/"+encodeURIComponent(promoFromUrl)).then(function(r){return r.json()}).then(function(d){if(d.valid){window._promoInfo=d;var cb=document.querySelector(".svc-cb:checked");if(cb)cb.dispatchEvent(new Event("change",{bubbles:true}));}}).catch(function(){});} + if(frn){ fetch(API+"/api/v1/fcc/lookup?frn="+frn+"&quick=1").then(function(r){return r.json()}).then(function(d){ if(d.entity_name){ @@ -331,13 +334,14 @@ function renderServices() { var hasPromo=!!promoFromUrl; var hasDisc=!hasPromo && discountableSlugs.length>=2; var disc=hasDisc?Math.round(discountableTotal*0.15):0; - var promoDisc=hasPromo?Math.round(discountableTotal*0.25):0; + var promoDisc=0; + if(hasPromo&&window._promoInfo){var pi=window._promoInfo;if(pi.discount_type==="percent")promoDisc=Math.round(discountableTotal*pi.discount_value/100);else promoDisc=Math.min(pi.discount_value,discountableTotal);} var summary=document.createElement("div"); summary.className="mt-4 p-4 bg-gray-50 border border-gray-200 rounded-lg"; var rows='