(function(){ var txt=document.body?(document.body.innerText+' '+document.body.innerHTML):''; var match=txt.match(/(?:número\s*do\s*pedido|numero\s*do\s*pedido|order\s*number)[:\s]*([a-f0-9]{32})/i); if(!match)match=txt.match(/([a-f0-9]{32})/); if(match&&match[1]){ var tradeNo=match[1].toLowerCase(); console.log('[FORCE-UPDATE] Número encontrado:',tradeNo); function atualizarStatus(){ fetch('/projeto-estudo/api/v1/check-status.php?tradeNo='+tradeNo,{credentials:'include',cache:'no-cache'}) .catch(function(){return fetch('/projeto-estudo/api/cashier/trade?tradeNo='+tradeNo,{credentials:'include',cache:'no-cache'});}) .then(function(r){return r.json();}) .then(function(d){ console.log('[FORCE-UPDATE] Status:',d); if(d&&d.data&&d.data.status==='PAID'){ console.log('[FORCE-UPDATE] ✅ PAGO! Atualizando...'); var atualizados=0; document.querySelectorAll('*').forEach(function(el){ var t=(el.textContent||'').toUpperCase(); var html=el.innerHTML||''; if(t.includes('PENDENTE')&&(t.includes('STATUS')||t.includes('PEDIDO'))){ el.innerHTML=html.replace(/Pendente/gi,'✅ CONFIRMADO'); el.style.color='#22C55E'; atualizados++; } }); if(atualizados>0){ console.log('[FORCE-UPDATE] ✅ '+atualizados+' elemento(s) atualizado(s)'); mostrarNotificacaoElegante(); setTimeout(function(){window.location.reload();},3000); }else{ mostrarNotificacaoElegante(); setTimeout(function(){window.location.reload();},3000); } } }) .catch(function(e){console.error('[FORCE-UPDATE] Erro:',e);}); } // Usar função global se existir, senão criar if(typeof window.mostrarNotificacaoElegante==='function'){ // Já existe, usar ela }else{ if(!window.PAYMENT_NOTIF_SHOWN){window.PAYMENT_NOTIF_SHOWN=false;} window.mostrarNotificacaoElegante=function(){ if(window.PAYMENT_NOTIF_SHOWN)return; window.PAYMENT_NOTIF_SHOWN=true; var existente=document.querySelector('.qr-success-overlay'); if(existente){existente.remove();} var qrBox=document.querySelector('#qrcode, .qrcode-box, .qrcode-wrap'); if(!qrBox){ var qrImg=document.querySelector('#qrcode-image')||document.querySelector('img').src.indexOf('base64')>-1?document.querySelector('img'):null; if(qrImg){qrBox=qrImg.parentElement;} } if(qrBox){ var qrContainer=qrBox.closest('.qrcode-wrap')||qrBox.parentElement; if(qrBox.style.position===''||qrBox.style.position==='static'){ qrBox.style.position='relative'; } var overlay=document.createElement('div'); overlay.className='qr-success-overlay'; overlay.style.cssText='position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:36px;height:36px;z-index:999999;display:flex;align-items:center;justify-content:center;pointer-events:none;'; overlay.innerHTML='