fix: Pedido pago fora do site no longer offers Faturado, and a 422 names its field (DTF-WEB-E)
All checks were successful
Build and deploy / Validate source (push) Successful in 6s
Build and deploy / Integration suite on a real stack (push) Successful in 7m16s
Build and deploy / Secret scan and release gate (push) Successful in 6s
Build and deploy / Publish images (push) Successful in 1m16s
All checks were successful
Build and deploy / Validate source (push) Successful in 6s
Build and deploy / Integration suite on a real stack (push) Successful in 7m16s
Build and deploy / Secret scan and release gate (push) Successful in 6s
Build and deploy / Publish images (push) Successful in 1m16s
The register dialog offered Faturado, which the API refuses there: an invoiced sale goes through the montador's Venda (front 7a.3). The choices are now Pix, Cartão, Dinheiro and Crédito do cliente, as the API accepts. A validation error in the Kanban now shows its first field and message instead of the bare "Confira os campos (422)". Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -235,7 +235,9 @@ function callout(d,title,text,tone=''){
|
||||
// An order paid outside the site (Dropstar's rule D-35): the team builds the
|
||||
// cart on the Site, as a customer would, and registers it here. Origin and
|
||||
// payment start unchosen: a default would become the answer to everything.
|
||||
const PAID_OUTSIDE={pix:'Pix',card:'Cartão',cash:'Dinheiro',credit:'Crédito do cliente',faturado:'Faturado'};
|
||||
// Faturado is not one of them: an invoiced sale goes through the montador's
|
||||
// Venda (front 7a.3), and the API refuses it here (Sentry DTF-WEB-E).
|
||||
const PAID_OUTSIDE={pix:'Pix',card:'Cartão',cash:'Dinheiro',credit:'Crédito do cliente'};
|
||||
function registerDialog(quote){
|
||||
const group=(name,label,options)=>{
|
||||
const g=node('div',undefined,'fgroup2');g.setAttribute('role','radiogroup');g.setAttribute('aria-label',label);
|
||||
|
||||
@@ -231,7 +231,12 @@ async function api(path,body){
|
||||
const r=await fetch('/api/operator'+path,{headers:{'Content-Type':'application/json'},...(body===undefined?{}:{method:'POST',body:JSON.stringify(body)})});
|
||||
const d=await r.json();
|
||||
if(!r.ok){
|
||||
const error=new Error(typeof d.detail==='string'?d.detail:'Confira os campos ('+r.status+').');
|
||||
// A validation error is a list: name its first field and what was wrong
|
||||
// instead of the bare status (Sentry DTF-WEB-E).
|
||||
const first=Array.isArray(d.detail)?d.detail.find(e=>e&&e.msg):null;
|
||||
const field=first?.loc?.filter(part=>typeof part==='string'&&part!=='body').join('.');
|
||||
const error=new Error(typeof d.detail==='string'?d.detail:
|
||||
'Confira os campos ('+r.status+')'+(first?': '+(field?field+', ':'')+first.msg:'.'));
|
||||
error.status=r.status;
|
||||
window.dtfObservability?.apiError?.(path,r.status,error.message,d.detail);
|
||||
throw error;
|
||||
|
||||
Reference in New Issue
Block a user