feat: Site orders reach Tiny filled in as the store's own
All checks were successful
Build and deploy / Validate source (push) Successful in 5s
Build and deploy / Integration suite on a real stack (push) Successful in 3m6s
Build and deploy / Secret scan and release gate (push) Successful in 8s
Build and deploy / Publish images (push) Successful in 58s

Read from two of Dropstar's store orders: a paid order now carries its
forma de recebimento (Pix or credit card) with one parcel on the day, the
carrier with freight paid by the sender (Correios with the contract's PAC or
SEDEX, Jadlog's .PACKAGE, or the DropStar carrier with "Retirar
pessoalmente" and "Retirar em loja" for pickup), and the expected date in
working days. Formas de envio and de frete are looked up by name and code;
the two formas de recebimento and the carrier, which the app may not list,
are Dropstar's ids. Category, seller and tag wait for Dropstar's answer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Cauê Faleiros
2026-10-19 13:34:41 -03:00
parent 7f7b684dbd
commit b2e718449b
4 changed files with 128 additions and 30 deletions

View File

@@ -100,9 +100,13 @@ def create_order(c, quote, payment):
if is_test(order):
return order, True
mail.order_paid(c, order, PUBLIC_ORIGIN)
# How it was paid, for the order's payment in Tiny.
paid = c.execute('''SELECT method FROM dtf_local.payment_intents WHERE quote_id=%s AND status='approved'
ORDER BY created_at DESC LIMIT 1''', (quote['id'],)).fetchone()
enqueue(c, f"{order['id']}:paid:tiny", 'tiny',
{'order_id': str(order['id']), 'number': order['number'],
'event': 'payment_approved', 'order': approved})
'event': 'payment_approved', 'order': approved,
'payment': {'method': paid['method']} if paid else {}})
mail.alert(c, f"Pedido #{order['number']} pago · {mail.money(approved['total_cents'])}",
['Um pedido novo foi pago e está em Arte recebida.', '', *mail.summary(approved)], '/')
return order, True