From b18f6e131264d16d1e5e9e679474fafc9e206372 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cau=C3=AA=20Faleiros?= Date: Tue, 1 Dec 2026 10:49:35 -0300 Subject: [PATCH] fix: card goes back to forma de recebimento 977460722, which Tiny accepts; 919478945 is not enabled there (DTF-API-C) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Tiny refused a paid Site order with "Forma de recebimento não está habilitada" after card moved to 919478945. The order waits in the outbox and goes through on its next try. The MERCADO PAGO account stays. Co-Authored-By: Claude Opus 5.5 --- app/tiny.py | 7 ++++--- tests/test_tiny.py | 5 +++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/app/tiny.py b/app/tiny.py index c6b9ea2..5cf27f9 100644 --- a/app/tiny.py +++ b/app/tiny.py @@ -144,10 +144,11 @@ PICKUP_EXACT = 'retirar pessoalmente' # "CORREÇÃO DTF", used for it before, is for correction orders only. "Boleto" is # for a montador Venda order (front 7a.3); no id is known yet, and while # TINY_RECEIPT_BOLETO is empty the order goes without a forma de recebimento. -# Cartão de crédito is 919478945 (Marcus, 2026-12-01; 977460722, read from a -# store order on 2026-10-19, was not the forma he names). +# Cartão de crédito stays 977460722, read from a store order on 2026-10-19: +# the 919478945 Marcus named on 2026-12-01 is not enabled in Tiny ("Forma de +# recebimento não está habilitada", DTF-API-C), so it waits for his answer. _BOLETO = os.environ.get('TINY_RECEIPT_BOLETO', '').strip() -RECEIPT_METHODS = {'pix': 919478952, 'card': 919478945, 'cash': 919478944, 'credit': 987762591, +RECEIPT_METHODS = {'pix': 919478952, 'card': 977460722, 'cash': 919478944, 'credit': 987762591, **({'faturado': int(_BOLETO)} if _BOLETO.isdigit() else {})} # The account ("meio de pagamento") a Site payment lands in: MERCADO PAGO, the # one the store's orders use (Marcus, 2026-12-01; not "MERCADO PAGO - NÃO diff --git a/tests/test_tiny.py b/tests/test_tiny.py index 30235eb..fbd40e3 100644 --- a/tests/test_tiny.py +++ b/tests/test_tiny.py @@ -485,9 +485,10 @@ class TinyStatusTests(FakeTinyCase): 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}}]}) - # The forma de recebimento ids Marcus listed on 2026-12-01. + # 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']), - (919478952, 919478945, 987762591)) + (919478952, 977460722, 987762591)) # Delivery: the Correios contract's PAC or SEDEX, or Jadlog; the date in working days. for service, method, frete in (('pac', 78, 781), ('sedex', 78, 782), ('jadlog', 80, 801)): order = {**PAID['order'], 'freight': {'service': service, 'total_cents': 1500, 'days': 6}}