fix: Site orders reach Tiny tagged SITE DTF

Dropstar's corrections of 2026-10-21 replace the KANBANDTF marcador with
SITE DTF, the string Kondado reads for Power BI. The new category and
seller still wait for their ids.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Cauê Faleiros
2026-10-22 16:23:41 -03:00
parent 9849ae5c14
commit 289151214b
2 changed files with 14 additions and 11 deletions

View File

@@ -102,10 +102,13 @@ RECEIPT_METHODS = {'pix': 919478952, 'card': 977460722}
PICKUP_CARRIER = 761565838
# Dropstar's answers (2026-10-21): the store's financial category "DUPLICADO
# DROP" (it goes in pagamento.categoria), no seller (the team links one in
# Tiny), and the marcador KANBANDTF, added after the order is created: POST
# /pedidos does not take marcadores.
# Tiny), and the marcador, added after the order is created: POST /pedidos
# does not take marcadores. Their corrections of the same day replace the
# category and the seller with new ones (DTF SITE, SITE DTF), sent by id once
# Dropstar creates them, and the marcador with SITE DTF: capitals, no accent,
# no extra space, the string Kondado reads for Power BI.
CATEGORY = 965775137
TAG = 'KANBANDTF'
TAG = 'SITE DTF'
# Freight is the sender's (CIF), as on the store's orders.
FREIGHT_PAID_BY = 'R'
# The forma de envio each delivery service uses, by name; a Correios service
@@ -698,7 +701,7 @@ class TinyOrders:
return None
def tag(self, tiny_id, known=False):
"""The KANBANDTF marcador on the order, once. A retry that finds the
"""The SITE DTF marcador on the order, once. A retry that finds the
order already created checks first, since POST adds another."""
if known:
have = self.request('GET', f'/pedidos/{tiny_id}/marcadores')

View File

@@ -368,13 +368,13 @@ class TinyStatusTests(FakeTinyCase):
def test_the_order_is_tagged_kanbandtf_once(self):
first = self.tiny.deliver('k1', PAID)
self.assertEqual(first['marcador'], 'KANBANDTF')
self.assertEqual(first['marcador'], 'SITE DTF')
tiny_id = self.orders[0]['id']
self.assertEqual(self.tags[tiny_id], [{'descricao': 'KANBANDTF'}])
self.assertEqual(self.tags[tiny_id], [{'descricao': 'SITE DTF'}])
# A second delivery finds the order and its tag, and adds nothing.
self.tiny.deliver('k1', PAID)
self.assertEqual(len(self.orders), 1)
self.assertEqual(self.tags[tiny_id], [{'descricao': 'KANBANDTF'}])
self.assertEqual(self.tags[tiny_id], [{'descricao': 'SITE DTF'}])
def test_a_failed_tag_is_retried_without_a_second_order(self):
self.refuse_tag = 1
@@ -382,9 +382,9 @@ class TinyStatusTests(FakeTinyCase):
self.tiny.deliver('k1', PAID)
self.assertEqual(len(self.orders), 1)
retry = self.tiny.deliver('k1', PAID)
self.assertEqual((retry['status'], retry['marcador']), ('already-created', 'KANBANDTF'))
self.assertEqual((retry['status'], retry['marcador']), ('already-created', 'SITE DTF'))
self.assertEqual(len(self.orders), 1)
self.assertEqual(self.tags[self.orders[0]['id']], [{'descricao': 'KANBANDTF'}])
self.assertEqual(self.tags[self.orders[0]['id']], [{'descricao': 'SITE DTF'}])
def test_pickup_forma_de_envio_is_found_by_name(self):
from app.tiny import check, find_pickup
@@ -594,7 +594,7 @@ class TinyProbeTests(FakeTinyCase):
self.assertIn('"numeroOrdemCompra": "DTF-TESTE-', text)
self.assertIn('Nada foi criado', text)
self.assertIn('"categoria": {', text)
self.assertIn('Marcador: KANBANDTF', text)
self.assertIn('Marcador: SITE DTF', text)
self.assertEqual(self.orders, [])
self.assertTrue(all(method == 'GET' for method, _ in self.calls))
@@ -616,7 +616,7 @@ class TinyProbeTests(FakeTinyCase):
# Then cancelled through the API, and read back: it does not stay open.
self.assertEqual(self.orders[0]['situacao'], 2)
self.assertIn(f"Pedido nº {self.orders[0]['numeroPedido']} cancelado no Tiny.", text)
self.assertEqual(self.tags[self.orders[0]['id']], [{'descricao': 'KANBANDTF'}])
self.assertEqual(self.tags[self.orders[0]['id']], [{'descricao': 'SITE DTF'}])
def test_cancelar_touches_only_test_orders(self):
self.tiny.deliver('k1', PAID)