From 289151214b1536f22cd9138358fd4ae9d2b8a4d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cau=C3=AA=20Faleiros?= Date: Thu, 22 Oct 2026 16:23:41 -0300 Subject: [PATCH] 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 --- app/tiny.py | 11 +++++++---- tests/test_tiny.py | 14 +++++++------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/app/tiny.py b/app/tiny.py index 6f8dd53..496bc62 100644 --- a/app/tiny.py +++ b/app/tiny.py @@ -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') diff --git a/tests/test_tiny.py b/tests/test_tiny.py index e9a818e..3ec4f30 100644 --- a/tests/test_tiny.py +++ b/tests/test_tiny.py @@ -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)