feat: the customer's proof only on orders above 10 m (Dropstar, 2026-10-28)
All checks were successful
Build and deploy / Secret scan and release gate (push) Successful in 7s
Build and deploy / Publish images (push) Successful in 1m13s
Build and deploy / Validate source (push) Successful in 10s
Build and deploy / Integration suite on a real stack (push) Successful in 4m6s

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 <noreply@anthropic.com>
This commit is contained in:
Cauê Faleiros
2026-10-28 14:12:59 -03:00
parent 8257ac24ab
commit 636c27ee88
5 changed files with 26 additions and 5 deletions

View File

@@ -3,9 +3,10 @@
An order above 10 m prints a proof before the rest, checked by the print room 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 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 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 three proofs per order, never billed. On an order above 10 m the customer
checkout, for any length: that order waits for them, marked "Aguardando may also ask for a proof at checkout (below 10 m there is none, Dropstar
contato", until they approve the photo sent by WhatsApp. Either way the room 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 marks "Prova OK" once the proof is checked, and without it the order does not
reach Finalizado. reach Finalizado.
""" """

View File

@@ -20,6 +20,7 @@ from fastapi import HTTPException
from psycopg.types.json import Jsonb from psycopg.types.json import Jsonb
from . import payments from . import payments
from .proof import PROOF_ABOVE_METRES
from .core.models import PRODUCTION_VERSIONS from .core.models import PRODUCTION_VERSIONS
from .core.pricing import is_manual, manual_extra_cents, price from .core.pricing import is_manual, manual_extra_cents, price
from .runtime import freight, upload_row from .runtime import freight, upload_row
@@ -83,7 +84,8 @@ def approve(c, row, items, reviewer):
raise HTTPException(422, str(exc)) raise HTTPException(422, str(exc))
approved = {'customer': draft['customer'], 'items': priced, 'freight': quoted_freight, approved = {'customer': draft['customer'], 'items': priced, 'freight': quoted_freight,
'destination': draft.get('destination'), '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']} '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', c.execute('UPDATE dtf_local.quotes SET approved=%s, reviewed_by=%s, approved_at=now() WHERE id=%s',
(Jsonb(approved), reviewer, row['id'])) (Jsonb(approved), reviewer, row['id']))

View File

@@ -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 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): 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 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, 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 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 product; a PDF over 150 MB is flagged before payment; any non-square piece is

View File

@@ -193,6 +193,20 @@ def run():
assert batch['id'] + ':cancelled:tiny' in events, events assert batch['id'] + ':cancelled:tiny' in events, events
print('PASS: an order paid outside is registered with its origin and payment, Dropflow ones included') 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 # 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 # paid order keeps them for its 30 days; a payment never starts for files
# that are gone. # that are gone.

View File

@@ -70,6 +70,9 @@ function pintaPedido(){
$('bPagarTx').textContent = n>1 $('bPagarTx').textContent = n>1
? 'Pagar os '+n+' itens de uma vez' ? 'Pagar os '+n+' itens de uma vez'
: 'Ir para o pagamento'; : '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(); $('bPagar').disabled = !cartPodeEnviar() || !entrega.cotado || !clienteOk() || !enderecoOk();
if(pedido.length || itemAtual) $('carr').classList.add('on'); if(pedido.length || itemAtual) $('carr').classList.add('on');
if($('cartN')){ $('cartN').textContent=noCarrinho>99?'99+':noCarrinho; $('cartN').hidden=!noCarrinho; if($('cartN')){ $('cartN').textContent=noCarrinho>99?'99+':noCarrinho; $('cartN').hidden=!noCarrinho;