feat: the print proof: Prova OK before Finalizado, and a proof the customer can ask for
Some checks failed
Some checks failed
Dropstar's items 15 and 16 (2026-10-21). - an order above 10 m prints 20 cm of proof first; the room checks it and marks "Prova OK", without stopping the order, and without that mark the order cannot reach Finalizado - at checkout, "Quero aprovar uma prova antes de imprimir", for any length: the paid order arrives marked "Aguardando contato" with what to do, and waits for the customer's word on the photo sent by WhatsApp - the card shows Prova / Prova OK, the panel gives the next step, and "Prova a conferir" is a board filter; the designer cannot mark it - the proof is not billed, as Dropstar leans; rounds and which part of the sheet wait for their answer Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -9,6 +9,7 @@ from uuid import uuid4
|
||||
from psycopg.types.json import Jsonb
|
||||
|
||||
from app import machines as routing
|
||||
from app import payments, proof
|
||||
from app.core import db
|
||||
from tests.smoke_test import Client
|
||||
|
||||
@@ -161,6 +162,41 @@ def run():
|
||||
designer.call('/operator/queue/finals', expected=403)
|
||||
designer.call('/operator/users', expected=403)
|
||||
|
||||
# The print proof (Dropstar, 2026-10-21): above 10 m, no Finalizado before
|
||||
# "Prova OK", which the print room marks and the designer cannot.
|
||||
with db.connect() as c:
|
||||
long_q, long_o = order_fixture(c, owner, 'file', metres='12')
|
||||
made.append((long_q, long_o))
|
||||
c.execute("UPDATE dtf_local.orders SET state='imp' WHERE id=%s", (long_o,))
|
||||
version = next(o for o in su.call('/operator/board', operator=True)['orders'] if o['id'] == str(long_o))['version']
|
||||
su.call(f'/operator/orders/{long_o}/move', {'state': 'fin', 'version': version, 'reason': ''},
|
||||
operator=True, expected=409)
|
||||
designer.call(f'/operator/orders/{long_o}/proof', {}, expected=403)
|
||||
seller.call(f'/operator/orders/{long_o}/proof', {}, expected=403)
|
||||
version = su.call(f'/operator/orders/{long_o}/proof', {}, operator=True)['version']
|
||||
board = {o['id']: o for o in su.call('/operator/board', operator=True)['orders']}
|
||||
assert board[str(long_o)]['proof_ok_at'] and board[str(long_o)]['proof_ok_by']
|
||||
su.call(f'/operator/orders/{long_o}/move', {'state': 'fin', 'version': version, 'reason': ''}, operator=True)
|
||||
# Up to 10 m, nothing to wait for.
|
||||
with db.connect() as c:
|
||||
short_q, short_o = order_fixture(c, owner, 'file', metres='10')
|
||||
made.append((short_q, short_o))
|
||||
c.execute("UPDATE dtf_local.orders SET state='imp' WHERE id=%s", (short_o,))
|
||||
version = next(o for o in su.call('/operator/board', operator=True)['orders'] if o['id'] == str(short_o))['version']
|
||||
su.call(f'/operator/orders/{short_o}/move', {'state': 'fin', 'version': version, 'reason': ''}, operator=True)
|
||||
# Asked for at checkout: the paid order arrives waiting for the customer's word.
|
||||
with db.connect() as c:
|
||||
asked = uuid4()
|
||||
content = {'customer': {'mail': 'm@example.test', 'cnpj': '11222333000181', 'zap': '16999999999'},
|
||||
'items': [{'mode': 'file', 'grade': 100, 'billed_metres': '1', 'unit_cents': 1490, 'uploads': []}],
|
||||
'freight': {'service': 'pickup'}, 'total_cents': 1490, 'proof': True}
|
||||
c.execute('''INSERT INTO dtf_local.quotes(id,owner,request_key,request_hash,draft,approved,approved_at)
|
||||
VALUES(%s,%s,%s,'users-fixture',%s,%s,now())''', (asked, owner, uuid4(), Jsonb(content), Jsonb(content)))
|
||||
quote = c.execute('SELECT * FROM dtf_local.quotes WHERE id=%s', (asked,)).fetchone()
|
||||
order, created = payments.create_order(c, quote, {'provider': 'teste', 'id': f'proof-{tag}'})
|
||||
made.append((asked, order['id']))
|
||||
assert created and order['contact_since'] and order['contact_note'] == proof.CUSTOMER_NOTE, order
|
||||
|
||||
# Their own password: the current one is asked for.
|
||||
seller.call('/operator/me/password', {'current': 'errada', 'new': 'outra-senha-de-teste'}, expected=403)
|
||||
# Eight characters or more.
|
||||
|
||||
Reference in New Issue
Block a user