dodil/erp-brick-pos
DODIL ERP brick: point of sale
src/brick_pos/domain/events.py
"""Domain events: one per workflow transition, named for what happened. An aggregate records them in `.events`; nothing
publishes them: a neighbour is told through a pending outbox row written in the same transaction (domain/outbox.py)."""
from dataclasses import dataclass
from decimal import Decimal
@dataclass(frozen=True)
class SessionOpened:
session_id: str
by: str = ""
@dataclass(frozen=True)
class CashMoved:
session_id: str
cash_move_id: str
kind: str
amount: Decimal
by: str = ""
@dataclass(frozen=True)
class SessionCounted:
session_id: str
counted: Decimal
expected: Decimal
difference: Decimal
closed_at_once: bool
by: str = ""
@dataclass(frozen=True)
class SessionClosed:
session_id: str
difference: Decimal
by: str = ""
@dataclass(frozen=True)
class ReceiptRung:
receipt_id: str
gross: Decimal
by: str = ""
@dataclass(frozen=True)
class PaymentTaken:
receipt_id: str
pay_no: int
method: str
amount: Decimal
tip: Decimal
by: str = ""
@dataclass(frozen=True)
class ReceiptFinalised:
receipt_id: str
gross: Decimal
by: str = ""
@dataclass(frozen=True)
class SessionForceClosed:
session_id: str
gap_from: object
gap_to: object
difference: Decimal
by: str = ""
@dataclass(frozen=True)
class SessionPosted:
session_id: str
journal_id: str
@dataclass(frozen=True)
class ReceiptVoided:
receipt_id: str
reason: str
by: str = ""
@dataclass(frozen=True)
class ReceiptRefunded:
receipt_id: str
original_receipt_id: str
gross: Decimal
reason: str
by: str = ""