feat: the team registers an order paid outside the site, choosing its origin and payment (Dropstar's rule D-35)
Some checks failed
Build and deploy / Integration suite on a real stack (push) Failing after 3m26s
Build and deploy / Secret scan and release gate (push) Successful in 7s
Build and deploy / Publish images (push) Has been skipped
Build and deploy / Validate source (push) Successful in 6s
Some checks failed
Build and deploy / Integration suite on a real stack (push) Failing after 3m26s
Build and deploy / Secret scan and release gate (push) Successful in 7s
Build and deploy / Publish images (push) Has been skipped
Build and deploy / Validate source (push) Successful in 6s
On an approved quote in Cotacoes, Administrador, Gestao and Vendedor pick the origin (Site, Dropflow, Atendimento) and how it was paid (Pix, cartao, dinheiro, credito do cliente), neither preselected, with an optional note. The price is the quote's, the Site's table price. The order is marked paid outside, counts in Numeros, and goes to Tiny like a Site order with the payment named in its internal note; a Dropflow order stays out of Tiny, status updates and cancelling included, until its revenue category exists. Auto-refresh waits while a register form on screen is half filled in. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -166,6 +166,30 @@ def run():
|
||||
assert queued == 0 and jobs == 1, (queued, jobs)
|
||||
print('PASS: an operator test order reaches the board and the print queue, never Tiny')
|
||||
|
||||
# An order paid outside the system, registered by the team from its Site
|
||||
# quote (D-35): origin and payment are chosen, never assumed.
|
||||
_, counter_quote, counter_total = reviewed_quote()
|
||||
register = lambda qid, body, expected=200: board.call('/operator/quotes/' + qid + '/register', body,
|
||||
operator=True, expected=expected)
|
||||
for body in ({'method': 'pix'}, {'origin': 'atendimento'}, {'origin': 'whatsapp', 'method': 'pix'},
|
||||
{'origin': 'atendimento', 'method': 'boleto'}):
|
||||
register(counter_quote, body, expected=422)
|
||||
order = register(counter_quote, {'origin': 'atendimento', 'method': 'cash', 'note': 'Balcão'})
|
||||
assert (order['origin'], order['state'], order['payment']['provider'], order['payment']['method'],
|
||||
order['payment']['total_cents']) == ('atendimento', 'rec', 'manual', 'cash', counter_total), order
|
||||
register(counter_quote, {'origin': 'atendimento', 'method': 'cash'}, expected=409)
|
||||
with db.connect() as c:
|
||||
sent = c.execute("SELECT payload FROM dtf_local.outbox WHERE event_key=%s", (order['id'] + ':paid:tiny',)).fetchone()
|
||||
assert sent and sent['payload']['origin'] == 'atendimento' and sent['payload']['payment'] == {'method': 'cash', 'outside': True}, sent
|
||||
# A Dropflow batch stays out of Tiny until its revenue category exists, cancelled or not.
|
||||
_, batch_quote, _ = reviewed_quote()
|
||||
batch = register(batch_quote, {'origin': 'dropflow', 'method': 'credit'})
|
||||
board.call('/operator/orders/' + batch['id'] + '/cancel', {'note': 'Lote refeito'}, operator=True)
|
||||
with db.connect() as c:
|
||||
held = c.execute("SELECT count(*) AS n FROM dtf_local.outbox WHERE event_key LIKE %s", (batch['id'] + ':%',)).fetchone()['n']
|
||||
assert batch['origin'] == 'dropflow' and held == 0, (batch, held)
|
||||
print('PASS: an order paid outside is registered with its origin and payment; Dropflow stays out of Tiny')
|
||||
|
||||
# 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.
|
||||
|
||||
Reference in New Issue
Block a user