Merge test-order quote message (DTF-WEB-D)
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 6m35s
Build and deploy / Secret scan and release gate (push) Successful in 6s
Build and deploy / Publish images (push) Successful in 1m22s

This commit is contained in:
Cauê Faleiros
2026-11-16 11:52:36 -03:00
3 changed files with 12 additions and 1 deletions

View File

@@ -136,6 +136,11 @@ def register_order(uid: UUID, body: PaidOutside, user=Depends(can('enter'))):
'status': 'paid', 'total_cents': quote['approved']['total_cents'], 'operator': user}
order, created = payments.create_order(c, quote, receipt, body.origin)
if not created:
# A test order holds the quote too (orders.quote_id is unique): say so,
# and how to free it (Sentry DTF-WEB-D).
if payments.is_test(order):
raise HTTPException(409, f"Esta cotação já virou o pedido de teste #{order['number']}. "
'Exclua o pedido de teste para registrar o pagamento.')
raise HTTPException(409, f"Esta cotação já virou o pedido #{order['number']}.")
audit('manual_order_registered', order=str(order['id']), origin=body.origin, operator=user)
return order

View File

@@ -151,6 +151,10 @@ def run():
order = tester.call('/operator/quotes/' + test_quote + '/test-order', {}, operator=True)
assert order['payment']['provider'] == 'teste' and order['state'] == 'rec', order
assert tester.call('/operator/quotes/' + test_quote + '/test-order', {}, operator=True)['id'] == order['id']
# The quote is that test order's now: registering it names the test order (Sentry DTF-WEB-D).
refused = tester.call('/operator/quotes/' + test_quote + '/register', {'origin': 'atendimento', 'method': 'cash'},
operator=True, expected=409)
assert 'pedido de teste #' + str(order['number']) in refused['detail'], refused
version = order['version']
# Arte conferida, the print queue, takes the order once its final is approved.
from tests.smoke_test import final_png_bytes

View File

@@ -196,7 +196,9 @@ function review(quote){
const test=button('Criar pedido de teste',async()=>{
if(!await ask('Criar um pedido de teste?','Ele entra em Arte recebida sem cobrar nada e não vai para o Tiny.','Criar pedido de teste'))return;
const order=await api('/quotes/'+quote.id+'/test-order',{});
say('Pedido de teste #'+order.number+' criado em Arte recebida.');await load();
// The quote is now that test order's: it leaves the list, and its
// panel closes so nobody registers it again (Sentry DTF-WEB-D).
currentQuote=null;say('Pedido de teste #'+order.number+' criado em Arte recebida.');await load();
},'btn');
foot.append(test);
if(chat)foot.append(chat);