From 636c27ee88f8de725b81434a1bc86427109bbea7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cau=C3=AA=20Faleiros?= Date: Wed, 28 Oct 2026 14:12:59 -0300 Subject: [PATCH] feat: the customer's proof only on orders above 10 m (Dropstar, 2026-10-28) The checkout's "Quero aprovar uma prova" box shows only when the cart is above 10 m, and the server keeps the request only then. Below 10 m there is no proof; above it the room's own proof stays automatic. Co-Authored-By: Claude Opus 5.5 --- app/proof.py | 7 ++++--- app/quote_review.py | 4 +++- docs/CONTEXT.md | 3 ++- tests/payment_test.py | 14 ++++++++++++++ web/site-cart.js | 3 +++ 5 files changed, 26 insertions(+), 5 deletions(-) diff --git a/app/proof.py b/app/proof.py index 3d7bc0e..3ef3b45 100644 --- a/app/proof.py +++ b/app/proof.py @@ -3,9 +3,10 @@ An order above 10 m prints a proof before the rest, checked by the print room without stopping the order. Dropstar's rule (2026-10-23): up to 30 cm, from the part with the thinnest lines, a piece of each different artwork, at most -three proofs per order, never billed. A customer may also ask for a proof at -checkout, for any length: that order waits for them, marked "Aguardando -contato", until they approve the photo sent by WhatsApp. Either way the room +three proofs per order, never billed. On an order above 10 m the customer +may also ask for a proof at checkout (below 10 m there is none, Dropstar +2026-10-28): that order waits for them, marked "Aguardando contato", until +they approve the photo sent by WhatsApp. Either way the room marks "Prova OK" once the proof is checked, and without it the order does not reach Finalizado. """ diff --git a/app/quote_review.py b/app/quote_review.py index 9fab3de..235fb6a 100644 --- a/app/quote_review.py +++ b/app/quote_review.py @@ -20,6 +20,7 @@ from fastapi import HTTPException from psycopg.types.json import Jsonb from . import payments +from .proof import PROOF_ABOVE_METRES from .core.models import PRODUCTION_VERSIONS from .core.pricing import is_manual, manual_extra_cents, price from .runtime import freight, upload_row @@ -83,7 +84,8 @@ def approve(c, row, items, reviewer): raise HTTPException(422, str(exc)) approved = {'customer': draft['customer'], 'items': priced, 'freight': quoted_freight, 'destination': draft.get('destination'), - **({'proof': True} if draft.get('proof') else {}), + # The customer's proof only above 10 m (Dropstar, 2026-10-28). + **({'proof': True} if draft.get('proof') and metres > PROOF_ABOVE_METRES else {}), 'total_cents': sum(i['total_cents'] for i in priced) + quoted_freight['total_cents']} c.execute('UPDATE dtf_local.quotes SET approved=%s, reviewed_by=%s, approved_at=now() WHERE id=%s', (Jsonb(approved), reviewer, row['id'])) diff --git a/docs/CONTEXT.md b/docs/CONTEXT.md index a65cdd5..5f1014b 100644 --- a/docs/CONTEXT.md +++ b/docs/CONTEXT.md @@ -412,7 +412,8 @@ checks files, showed a 12,8 m sheet as 18,9 x 425 cm. PRINT_PAGE_SCALE=true in the stack goes back to /UserUnit, for a RIP that refuses pages over 5,08 m. An original used whole as its own print file (over 300 MB) has no footer. The print proof (app/proof.py): an order above 10 m, or one whose customer ticked "quero aprovar uma prova" at -checkout (that one arrives marked Aguardando contato), cannot reach Finalizado +checkout (that one arrives marked Aguardando contato; the box shows, and the +server keeps it, only above 10 m since 2026-10-28), cannot reach Finalizado before the print room marks Prova OK; the proof is not billed (up to 30 cm, at most 3 per order). Dropstar's answers of 2026-10-23: JPG is refused in every product; a PDF over 150 MB is flagged before payment; any non-square piece is diff --git a/tests/payment_test.py b/tests/payment_test.py index 268ac24..6cacfa3 100644 --- a/tests/payment_test.py +++ b/tests/payment_test.py @@ -193,6 +193,20 @@ def run(): assert batch['id'] + ':cancelled:tiny' in events, events print('PASS: an order paid outside is registered with its origin and payment, Dropflow ones included') + # The customer's proof only above 10 m (Dropstar, 2026-10-28): asked for on a + # shorter order, the server leaves it out. + for metres, kept in (('1.01', False), ('12', True)): + asker = Client() + asker.call('/session') + art = upload_bytes(asker, b'PROOF ' + metres.encode()) + spec = item_spec('file', metres, 0, art) + profile = {'cnpj': '11222333000181', 'zap': '11999999999', 'mail': 'proof-' + uuid4().hex[:8] + '@example.test'} + asked = asker.call('/quotes', {'request_key': str(uuid4()), 'customer': profile, 'items': [spec], + 'freight': {'service': 'pickup'}, 'proof': True}) + approved = approved_quote(asker, asked, [spec]) + assert bool(approved.get('proof')) is kept, (metres, approved.get('proof')) + print('PASS: a proof asked for at checkout is kept only above 10 m') + # Files are uploaded before payment. An unpaid cart keeps them briefly; a # paid order keeps them for its 30 days; a payment never starts for files # that are gone. diff --git a/web/site-cart.js b/web/site-cart.js index 6a4ef88..930078c 100644 --- a/web/site-cart.js +++ b/web/site-cart.js @@ -70,6 +70,9 @@ function pintaPedido(){ $('bPagarTx').textContent = n>1 ? 'Pagar os '+n+' itens de uma vez' : 'Ir para o pagamento'; + // The proof is only for orders above 10 m (Dropstar, 2026-10-28): below it the box is gone. + const prova=$('fProva'); + if(prova){ const longo=aPagar.reduce((t,it)=>t+(it.cob||0),0)>10; prova.closest('.cxE').hidden=!longo; if(!longo) prova.checked=false; } $('bPagar').disabled = !cartPodeEnviar() || !entrega.cotado || !clienteOk() || !enderecoOk(); if(pedido.length || itemAtual) $('carr').classList.add('on'); if($('cartN')){ $('cartN').textContent=noCarrinho>99?'99+':noCarrinho; $('cartN').hidden=!noCarrinho;