feat: montador Interno and Venda, Tiny customers, brand per stamp (front 7a.3, Marcus 10/11)

Interno: the Expedição assembles the marketplace's own sales on the fixed
internal customer Gestão fills in once; no Tiny order, no paid e-mail,
marked interno, it stays in house. Venda: a Vendedor or Gestão picks the
customer from the Tiny base and the order goes to Tiny like an approved
quote, faturado (Boleto from TINY_RECEIPT_BOLETO when set), pickup or
'junto com o pedido de roupa nº X'. Números counts both at table price,
apart from cash (and the average ticket over cash orders only). Each stamp
can carry a brand and a public flag for the future catalogue.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Cauê Faleiros
2026-11-11 11:01:44 -03:00
parent e6197d6e40
commit b5a51137fb
15 changed files with 710 additions and 97 deletions

View File

@@ -133,6 +133,22 @@ def tiny_status(c=None):
return {'configured': True, 'orders_enabled': os.environ.get('TINY_ADAPTER') == 'tiny',
**tiny.TinyAuth().status(c)}
@router.get('/api/operator/tiny/contacts')
def tiny_contacts(q: str = Query(min_length=1, max_length=120), user=Depends(can('assemble'))):
"""The Tiny contacts a Venda customer is picked from (Fase 2, front
7a.3): by name, or by CPF/CNPJ when only digits were typed. The fake
adapter answers with two fixed contacts on the local stack and in CI."""
if os.environ.get('TINY_ADAPTER') != 'tiny':
from ...adapters import FakeTiny
return FakeTiny().search_contacts(q)
if not tiny.configured():
raise HTTPException(409, 'O Tiny não está conectado.')
try:
return tiny.search_contacts(tiny.TinyOrders(), q)
except tiny.TinyNotConnected:
raise HTTPException(409, 'O Tiny não está conectado.')
@router.post('/api/operator/tiny/connect')
def tiny_connect(user=Depends(can('integrations'))):
"""Start the one-time authorisation of this system in the client's Tiny."""