feat: montador Interno and Venda, Tiny customers, brand per stamp (front 7a.3, Marcus 10/11)
Interno: the Expedição assembles the marketplace's own sales on the fixed internal customer Gestão fills in once; no Tiny order, no paid e-mail, marked interno, it stays in house. Venda: a Vendedor or Gestão picks the customer from the Tiny base and the order goes to Tiny like an approved quote, faturado (Boleto from TINY_RECEIPT_BOLETO when set), pickup or 'junto com o pedido de roupa nº X'. Números counts both at table price, apart from cash (and the average ticket over cash orders only). Each stamp can carry a brand and a public flag for the future catalogue. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
"""Who moves which card on the Kanban: Dropstar's flow of 2026-10-23."""
|
||||
import os
|
||||
import unittest
|
||||
from unittest import mock
|
||||
|
||||
from app import payments
|
||||
from app import payments, tiny
|
||||
from app.core import auth
|
||||
from app.core.auth import CAPABILITIES, ROLES, may_move, may_reorder
|
||||
from app.runtime import BACK, STATES, TRANSITIONS
|
||||
@@ -78,14 +79,31 @@ class CanAnyTest(unittest.TestCase):
|
||||
route(None)
|
||||
|
||||
|
||||
class InvoicedOrderTest(unittest.TestCase):
|
||||
def test_an_invoiced_montador_order_is_held_out_of_tiny(self):
|
||||
class MontadorPaymentTest(unittest.TestCase):
|
||||
def test_a_faturado_order_goes_to_tiny_and_an_internal_one_does_not(self):
|
||||
self.assertEqual(payments.INVOICED_METHOD, 'faturado')
|
||||
# It is not one of the Cotações "registrar" methods.
|
||||
self.assertEqual(payments.INTERNAL_METHOD, 'interno')
|
||||
# Neither is one of the Cotações "registrar" methods.
|
||||
self.assertNotIn(payments.INVOICED_METHOD, payments.OUTSIDE_METHODS)
|
||||
self.assertFalse(payments.in_tiny({'payment': {'provider': 'manual', 'method': 'faturado'}}))
|
||||
self.assertNotIn(payments.INTERNAL_METHOD, payments.OUTSIDE_METHODS)
|
||||
self.assertTrue(payments.in_tiny({'payment': {'provider': 'manual', 'method': 'faturado'}}))
|
||||
self.assertFalse(payments.in_tiny({'payment': {'provider': 'manual', 'method': 'interno'}}))
|
||||
self.assertTrue(payments.in_tiny({'payment': {'provider': 'manual', 'method': 'pix'}}))
|
||||
|
||||
|
||||
class InternalNoteTest(unittest.TestCase):
|
||||
payload = {'order_id': 'b6f1c0de-0000-4000-8000-000000000001', 'number': 42,
|
||||
'origin': 'atendimento', 'payment': {'method': 'faturado', 'outside': True},
|
||||
'order': {'with_order': 4321}}
|
||||
|
||||
def test_an_invoiced_order_says_how_it_is_received(self):
|
||||
with mock.patch.dict(os.environ, {'TINY_RECEIPT_BOLETO': ''}):
|
||||
note = tiny.internal_note(self.payload)
|
||||
self.assertIn('faturado: forma de recebimento a definir', note)
|
||||
self.assertIn('junto com o pedido de roupa nº 4321', note)
|
||||
with mock.patch.dict(os.environ, {'TINY_RECEIPT_BOLETO': '123456'}):
|
||||
self.assertIn('faturado (Boleto)', tiny.internal_note(self.payload))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user