feat: an order paid on the Site says how: "pago com Pix" or "pago com cartão" on its paid line
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 8m35s
Build and deploy / Secret scan and release gate (push) Successful in 6s
Build and deploy / Publish images (push) Successful in 1m16s

The board carries paid_with, the method of the quote's approved payment
attempt (the one Tiny is told about). Until now a paid Site order only said
"pago em", so a Tiny refusal (DTF-API-C, #196) could not be traced to Pix
or card from the Kanban.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Cauê Faleiros
2026-12-01 10:58:31 -03:00
parent b18f6e1312
commit fc9e6d2681
4 changed files with 25 additions and 1 deletions

View File

@@ -235,6 +235,11 @@ def with_print_files(c, orders):
WHERE parent_id=ANY(%s) AND cancelled_at IS NULL ORDER BY parent_id, created_at DESC''', (ids,)).fetchall()}
parents = {r['id']: r for r in c.execute('SELECT id,number,state FROM dtf_local.orders WHERE id=ANY(%s)',
([o['parent_id'] for o in orders if o.get('parent_id')],)).fetchall()}
# How each Site order was paid, Pix or card: its quote's approved attempt,
# the one Tiny is told about too (app/payments.py).
paid_with = {r['quote_id']: r['method'] for r in c.execute('''SELECT DISTINCT ON (quote_id) quote_id,method
FROM dtf_local.payment_intents WHERE quote_id=ANY(%s) AND status='approved' ORDER BY quote_id,created_at DESC''',
([o['quote_id'] for o in orders if o.get('quote_id')],)).fetchall()}
# Every order's review photos and videos, in one query like the print files.
review_rows = reviews.by_order(c, ids)
# The proof card's go on its order too: an answered card leaves the board,
@@ -244,6 +249,7 @@ def with_print_files(c, orders):
for order in orders:
order['hot'] = hot.get(order['id'])
order['hot_parts'] = hot_parts.get(order['id'], [])
order['paid_with'] = paid_with.get(order.get('quote_id'))
order['reviews'] = review_rows.get(str(order['id']), [])
child = children.get(order['id'])
# Its machine: an order prints where its approved proof did (Dropstar, 2026-11-05).