Skip to main content

Crate backbone_gl_posting

Crate backbone_gl_posting 

Source
Expand description

§backbone-gl-posting

The GL-posting wire contract shared across Backbone producers — the serialized envelope a producer (payment, payment-gateway, selling, inventory, billing, …) emits, and the sink port the composition layer implements over accounting’s PostingService. This crate owns the contract so each producer stops carrying its own structurally-identical copy (ADR-001 §6’s deferred cleanup).

  • A producer builds an AccountingPostEnvelope (balanced Dr … · Cr … lines) and reaches accounting ONLY through a GlPostSink — zero normal Cargo edge into backbone-accounting.
  • A composition ACL implements GlPostSink and maps the envelope into accounting’s PostingRequest (injecting the accounting-owned cost_center/project/department the envelope deliberately omits).
  • Idempotency: accounting dedups on source_id (the producer document id, opaque to accounting).

This crate is framework plumbing: it depends on serde + primitives only, never on a domain module or accounting itself.

The companion seam is the reconciliation contract (ReconcileSink): producers settle and clear through reconciliation edges on accounting’s journal lines via the same zero-edge posture — a locator-based, connection-taking port implemented by the composition layer.

Structs§

AccountingPostEnvelope
The serialized GL-post envelope a producer emits. source_type discriminates the producer (“payment”, “gateway_fee”, “sales”, …); source_id is the producer document id accounting dedups on.
GlPostAck
Accounting’s ack: the resulting post + journal, and whether the idempotency key short-circuited.
GlPostLine
One debit/credit line of a GL post.
GlPostRejected
Why accounting rejected a post (e.g. a closed period). The producer leaves the document retryable.
ReconcileEdgeAck
The resulting edge. applied is the post-clamp amount actually reconciled.
ReconcileLine
Locates one side of a reconciliation edge by producer identity. Resolves to exactly one posted journal line on account_id — the reconcilable control account BOTH sides must share.
ReconcilePairRequest
Create (or grow) the debit↔credit edge between two located lines.
ReconcileRejected
Why the sink refused (guard violation, unresolvable locator, unconfigured FX account …).
UnreconcilePairRequest
Unlink every partial between the located pair (side-effecting — see the module docs).

Enums§

ReconcileOrigin
What created the edge — stamped on the partial for traceability.

Traits§

GlPostSink
The GL-posting seam. A composing service implements this over accounting’s PostingService; tests record. Producers never depend on backbone-accounting — they reach it only through this port.
ReconcileSink
The reconciliation seam. A composing service implements this over accounting’s reconciliation write service; producers never depend on backbone-accounting — they reach the graph only through this port, exactly as they reach posting through crate::GlPostSink.