pub struct PostingService { /* private fields */ }Expand description
The GL-posting service. Depends on the PostingRepository port (+ an event sink).
Implementations§
Source§impl PostingService
impl PostingService
pub fn new(repo: Arc<dyn PostingRepository>) -> Self
Sourcepub fn with_sink(
repo: Arc<dyn PostingRepository>,
sink: Arc<dyn PostingEventSink>,
) -> Self
pub fn with_sink( repo: Arc<dyn PostingRepository>, sink: Arc<dyn PostingEventSink>, ) -> Self
Construct with a custom event sink (real bus adapter or a test recorder).
Sourcepub fn with_budget_control_if_set(
self,
port: Option<Arc<dyn BudgetControlPort>>,
) -> Self
pub fn with_budget_control_if_set( self, port: Option<Arc<dyn BudgetControlPort>>, ) -> Self
Arm the budget-control consult on an already-built service (consuming
builder; None leaves it unarmed — the fail-open default for hosts
without a budget module).
Sourcepub async fn post(
&self,
req: PostingRequest,
posted_by: Option<Uuid>,
) -> Result<PostingResult, PostingError>
pub async fn post( &self, req: PostingRequest, posted_by: Option<Uuid>, ) -> Result<PostingResult, PostingError>
Record a balanced posting. Idempotent on (company, source_type, source_id, posting_type)
— or on idempotency_key when the producer sets one.
Sourcepub async fn post_journal(
&self,
journal_id: Uuid,
company_id: Uuid,
posted_by: Option<Uuid>,
) -> Result<PostingResult, PostingError>
pub async fn post_journal( &self, journal_id: Uuid, company_id: Uuid, posted_by: Option<Uuid>, ) -> Result<PostingResult, PostingError>
Post an existing approved manual journal to the ledger. Idempotent: a journal already
posted returns its existing post. Used by the journal approval workflow (approve → post).
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for PostingService
impl !UnwindSafe for PostingService
impl Freeze for PostingService
impl Send for PostingService
impl Sync for PostingService
impl Unpin for PostingService
impl UnsafeUnpin for PostingService
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more