fix: a Site order names no Mercado Pago account in Tiny again; Tiny did not find 977344550 (DTF-API-C)
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 8m9s
Build and deploy / Secret scan and release gate (push) Successful in 5s
Build and deploy / Publish images (push) Successful in 1m5s

Tiny refused #196 (card) and #198 (Pix) with "Meio de pagamento não
encontrado" on parcelas[0].meioPagamento.id. The payload is now the same as
before 2026-12-01's Tiny change; both orders go through on their next try.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Cauê Faleiros
2026-12-01 11:20:29 -03:00
parent fc9e6d2681
commit 2c0dd72098
2 changed files with 10 additions and 17 deletions

View File

@@ -215,11 +215,11 @@ class TinyTests(FakeTinyCase):
mock.patch.dict(tiny_module.RECEIPT_METHODS, {'faturado': 919478947}):
pedido = order_payload({**PAID, 'payment': {'method': 'faturado'}}, 777, date(2026, 9, 24))
self.assertNotIn('meioPagamento', pedido['pagamento']['parcelas'][0])
# A pix order never gets the boleto account: paid on the Site, it is
# the MERCADO PAGO one (Marcus, 2026-12-01).
# A pix order never gets the boleto account, nor any other: Tiny did
# not find MERCADO PAGO, 977344550 (DTF-API-C, 2026-12-01).
with mock.patch.dict(os.environ, {'TINY_BOLETO_ACCOUNT': '977344551'}):
pedido = order_payload({**PAID, 'payment': {'method': 'pix'}}, 777, date(2026, 9, 24))
self.assertEqual(pedido['pagamento']['parcelas'][0]['meioPagamento'], {'id': 977344550})
self.assertNotIn('meioPagamento', pedido['pagamento']['parcelas'][0])
def test_the_check_lists_ajuste_fino_by_its_sku(self):
from app.tiny import check
@@ -481,10 +481,9 @@ class TinyStatusTests(FakeTinyCase):
self.assertEqual(pickup['transportador'], {'fretePorConta': 'R', 'id': PICKUP_CARRIER,
'formaEnvio': {'id': 77}, 'formaFrete': {'id': 771}})
self.assertEqual(pickup['dataPrevista'], '2026-09-25')
# Paid on the Site: the parcel lands in the MERCADO PAGO account (Marcus, 2026-12-01).
# Paid on the Site: the parcel names no account (DTF-API-C, 2026-12-01).
self.assertEqual(pickup['pagamento'], {'categoria': {'id': CATEGORY}, 'formaRecebimento': {'id': RECEIPT_METHODS['pix']},
'parcelas': [{'dias': 0, 'data': '2026-09-24', 'valor': 84.72, 'formaRecebimento': {'id': RECEIPT_METHODS['pix']},
'meioPagamento': {'id': 977344550}}]})
'parcelas': [{'dias': 0, 'data': '2026-09-24', 'valor': 84.72, 'formaRecebimento': {'id': RECEIPT_METHODS['pix']}}]})
# The forma de recebimento ids: card stays the one Tiny accepts, 977460722;
# 919478945, which Marcus named on 2026-12-01, is not enabled (DTF-API-C).
self.assertEqual((RECEIPT_METHODS['pix'], RECEIPT_METHODS['card'], RECEIPT_METHODS['credit']),
@@ -498,7 +497,7 @@ class TinyStatusTests(FakeTinyCase):
'formaFrete': {'id': frete}}, service)
self.assertEqual(sent['dataPrevista'], '2026-10-02')
self.assertEqual(sent['pagamento']['formaRecebimento'], {'id': RECEIPT_METHODS['card']})
self.assertEqual(sent['pagamento']['parcelas'][0]['meioPagamento'], {'id': 977344550})
self.assertNotIn('meioPagamento', sent['pagamento']['parcelas'][0])
# Looked up once per service.
self.assertEqual(self.calls.count(('GET', '/formas-envio/78')), 2)
# A test order, or a carrier Tiny does not have: the order still goes, without them,
@@ -519,7 +518,7 @@ class TinyStatusTests(FakeTinyCase):
1, thursday, shipping=self.tiny.shipping)
self.assertEqual(pix['pagamento']['formaRecebimento'], {'id': RECEIPT_METHODS['pix']})
self.assertEqual(pix['pagamento']['categoria'], {'id': CATEGORY})
# Paid outside the site: not through Mercado Pago, so no account.
# Paid outside the site: no account either.
self.assertNotIn('meioPagamento', pix['pagamento']['parcelas'][0])
self.assertNotIn('meioPagamento', counter['pagamento']['parcelas'][0])
# Dinheiro (Marcus, 2026-10-27) and the customer's credit, CREDITO