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
//! Cash-basis (on_payment) tax deferral lookup port.
//!
//! When a partial reconciliation lands on a receivable/payable line whose
//! document carried cash-basis tax, the deferred portion becomes exigible and
//! must flip pro-rata from the tax transition account to the real tax account.
//! Accounting owns the flip machinery but cannot know where the deferrals
//! live: the tax engine records the posture at compute time and the producing
//! module (billing, on its invoice tax lines) persists the marker. The
//! deployed app sees both modules and implements this port against its own
//! schema — a host-side ACL, not a module edge.
//!
//! The port rides the caller's connection so a flip journal commits atomically
//! with the partial that triggered it. `None` (unwired) simply means no flips:
//! accounting keeps working for hosts without a cash-basis tax module.
//!
//! Tenancy (ADR-0029): the `company_id` parameter is the legacy twin — accounting carries
//! no tenancy of its own and forwards the company id that rode in with the reconciled
//! document; the host adapter scopes its own tax-table reads by it.
use async_trait;
use Decimal;
use Uuid;
/// One deferred tax amount waiting on a payment event.