diff --git a/web/checkout.js b/web/checkout.js index ab1cd56..001e145 100644 --- a/web/checkout.js +++ b/web/checkout.js @@ -573,7 +573,7 @@ if (naPagina() && !actions.children.length) esqueletoPagamento(); try { await ready; - const quote=await api('/quotes/'+shownId); + const quote=await api('/quotes/'+shownId,undefined,{expected:[404]}); if(version!==refreshVersion || draftId!==shownId) return; // Asked to pay a cart identical to one already paid (the same test // repeated): that is a new order, never the paid one shown again. The @@ -628,6 +628,15 @@ } } catch(error) { if(version!==refreshVersion || draftId!==shownId) return; + // The quote this browser remembers is not this session's any more (the + // session changed, or it is gone): an old reference, not an error + // (Sentry DTF-WEB-1Y). The cart is still here to send again. + if(error.status===404){ + clearDraft(); + message('Este pagamento não está mais disponível nesta sessão. Seu carrinho continua aqui: envie de novo para pagar.','warn'); + button('Voltar ao carrinho',()=>vaiPara(CARRINHO)); + return; + } message(error.message,'error'); actions.replaceChildren(); button('Limpar referência e tentar de novo',clearDraft);