1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
//! Stable integration surface for composing services.
//!
//! This module is the **deliberate, published API** a consumer depends on. It re-exports exactly
//! the types and functions a composing service (e.g. `serpa-posman-service`) needs to mount POS,
//! implement the outbound ports, and drive recognition — gathered under one namespace so that the
//! crate's internal DDD layer tree (`application::service::...`, `presentation::http::...`) is free
//! to move on regeneration without breaking consumers.
//!
//! **Consumers should depend only on `backbone_pos::integration::{...}`.** The deep paths are
//! internal; reaching into them couples you to the layer structure (council 2026-07-26, Contract
//! Seat — `docs/council/2026-07-26-module-backbone-pos-maturity.md`).
//!
//! ## Stability promise
//! - **Additive** changes (new re-exports, new items) are non-breaking.
//! - **Removals or renames** of items already exported here require a semver bump.
//! - The internals behind these aliases are NOT promised stable — they may change anytime.
//!
//! ## What a consumer wires
//! ```ignore
//! use backbone_pos::integration::*;
//!
//! let pos = PosModule::builder().with_database(pool.clone()).build()?;
//! // implement the outbound ports over your real tax/billing/payment/inventory
//! let tax: Arc<dyn PosTaxComputePort> = /* your adapter over the tax module */;
//! let billing: Arc<dyn BillingPort> = /* your adapter */;
//! let payment: Arc<dyn PaymentPort> = /* your adapter */;
//! let variance: Arc<dyn PosCashVariancePort> = /* your adapter over accounting */;
//! let inventory: Option<Arc<dyn InventoryPort>> = /* your adapter */;
//! // subscribe to tenders → drive recognition exactly once
//! let sink = RecognitionSink::new(pool.clone(), billing, payment, inventory);
//! // mount the guarded surface — bare of auth; wrap it in YOUR org scope middleware
//! // (org_auth + the tenant router) so the request-dedicated connection fences it
//! let router = create_guarded_pos_routes_with_outbox(
//! &pos, pool, sink, tax, variance, billing, payment, schema,
//! );
//! ```
// --- The module + builder -----------------------------------------------------
pub use cratePosModule;
pub use cratePosModuleBuilder;
// --- Guarded HTTP surface (route composers) -----------------------------------
// Read + validated writes; the production surface. NO generic CRUD (that's `PosModule::all_crud_routes`).
pub use crate;
// --- Tenant / company auth re-exports -------------------------------------------
// The guarded surface itself ships bare and reads `OrgContext` (ADR-0029 org-composed shape); these
// re-exports stay for composing services that still run their own company lane on module routes.
// `Company*` are the canonical names (ADR-0005). `Tenant*` are deprecated aliases kept for back-compat.
pub use crate;
pub use crate;
// --- Outbound ports: the wire contract a consumer implements ------------------
// POS posts no GL — it drives billing (revenue) + payment (settlement) + inventory (stock issue)
// through these traits. The shipped library has ZERO normal Cargo edges to those modules.
pub use crate;
pub use crate;
// --- Document-grade tax + session-close variance ports -------------------------
// `PosTaxComputePort` resolves per-line tax for EVERY ring (implement over the tax module's
// `calculate_document`); `PosCashVariancePort` books the GL correction when a close counts a drawer
// difference (idempotent on `opening_entry_id` — a session closes exactly once).
pub use crate;
// --- Server-authoritative cart pricing (promo) port ---------------------------
pub use crate;
// --- The write service: open / ring / sync / tender / recognize / return / drawer / pins
pub use cratePosWriteService;
// Vocabulary a consumer passes in / receives (kept here so callers don't reach into the service tree).
pub use crate;
// Offline replay (`sync_from_ui`): identity by `client_uuid`, client totals discarded, server
// recomputes; a refund replay is privileged (manager PIN verified server-side).
pub use crate;
// Manager-PIN credentials: argon2-hashed server-side; the raw PIN never leaves the request.
pub use crateSetPin;
// --- Events + the sink a consumer subscribes to drive recognition -------------
// `PosTenderCompleted` is the recognition trigger: a composing service subscribes and calls
// `PosWriteService::recognize_sale` on it. The library does NOT call recognize internally.
pub use crate;
pub use cratePosTenderCompleted;