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:
11
app/tiny.py
11
app/tiny.py
@@ -102,10 +102,13 @@ RECEIPT_METHODS = {'pix': 919478952, 'card': 977460722}
|
|||||||
PICKUP_CARRIER = 761565838
|
PICKUP_CARRIER = 761565838
|
||||||
# Dropstar's answers (2026-10-21): the store's financial category "DUPLICADO
|
# 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
|
# 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
|
# Tiny), and the marcador, added after the order is created: POST /pedidos
|
||||||
# /pedidos does not take marcadores.
|
# 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
|
CATEGORY = 965775137
|
||||||
TAG = 'KANBANDTF'
|
TAG = 'SITE DTF'
|
||||||
# Freight is the sender's (CIF), as on the store's orders.
|
# Freight is the sender's (CIF), as on the store's orders.
|
||||||
FREIGHT_PAID_BY = 'R'
|
FREIGHT_PAID_BY = 'R'
|
||||||
# The forma de envio each delivery service uses, by name; a Correios service
|
# The forma de envio each delivery service uses, by name; a Correios service
|
||||||
@@ -698,7 +701,7 @@ class TinyOrders:
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
def tag(self, tiny_id, known=False):
|
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."""
|
order already created checks first, since POST adds another."""
|
||||||
if known:
|
if known:
|
||||||
have = self.request('GET', f'/pedidos/{tiny_id}/marcadores')
|
have = self.request('GET', f'/pedidos/{tiny_id}/marcadores')
|
||||||
|
|||||||
@@ -368,13 +368,13 @@ class TinyStatusTests(FakeTinyCase):
|
|||||||
|
|
||||||
def test_the_order_is_tagged_kanbandtf_once(self):
|
def test_the_order_is_tagged_kanbandtf_once(self):
|
||||||
first = self.tiny.deliver('k1', PAID)
|
first = self.tiny.deliver('k1', PAID)
|
||||||
self.assertEqual(first['marcador'], 'KANBANDTF')
|
self.assertEqual(first['marcador'], 'SITE DTF')
|
||||||
tiny_id = self.orders[0]['id']
|
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.
|
# A second delivery finds the order and its tag, and adds nothing.
|
||||||
self.tiny.deliver('k1', PAID)
|
self.tiny.deliver('k1', PAID)
|
||||||
self.assertEqual(len(self.orders), 1)
|
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):
|
def test_a_failed_tag_is_retried_without_a_second_order(self):
|
||||||
self.refuse_tag = 1
|
self.refuse_tag = 1
|
||||||
@@ -382,9 +382,9 @@ class TinyStatusTests(FakeTinyCase):
|
|||||||
self.tiny.deliver('k1', PAID)
|
self.tiny.deliver('k1', PAID)
|
||||||
self.assertEqual(len(self.orders), 1)
|
self.assertEqual(len(self.orders), 1)
|
||||||
retry = self.tiny.deliver('k1', PAID)
|
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(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):
|
def test_pickup_forma_de_envio_is_found_by_name(self):
|
||||||
from app.tiny import check, find_pickup
|
from app.tiny import check, find_pickup
|
||||||
@@ -594,7 +594,7 @@ class TinyProbeTests(FakeTinyCase):
|
|||||||
self.assertIn('"numeroOrdemCompra": "DTF-TESTE-', text)
|
self.assertIn('"numeroOrdemCompra": "DTF-TESTE-', text)
|
||||||
self.assertIn('Nada foi criado', text)
|
self.assertIn('Nada foi criado', text)
|
||||||
self.assertIn('"categoria": {', text)
|
self.assertIn('"categoria": {', text)
|
||||||
self.assertIn('Marcador: KANBANDTF', text)
|
self.assertIn('Marcador: SITE DTF', text)
|
||||||
self.assertEqual(self.orders, [])
|
self.assertEqual(self.orders, [])
|
||||||
self.assertTrue(all(method == 'GET' for method, _ in self.calls))
|
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.
|
# Then cancelled through the API, and read back: it does not stay open.
|
||||||
self.assertEqual(self.orders[0]['situacao'], 2)
|
self.assertEqual(self.orders[0]['situacao'], 2)
|
||||||
self.assertIn(f"Pedido nº {self.orders[0]['numeroPedido']} cancelado no Tiny.", text)
|
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):
|
def test_cancelar_touches_only_test_orders(self):
|
||||||
self.tiny.deliver('k1', PAID)
|
self.tiny.deliver('k1', PAID)
|
||||||
|
|||||||
Reference in New Issue
Block a user