Skip to main content

PosError

Enum PosError 

Source
pub enum PosError {
Show 43 variants EmptyDocument, NegativeAmount, SessionNotOpen, SessionRegisterMismatch, NotDraft, NotFullyTendered { rounded_total: Decimal, paid_total: Decimal, }, NotReturnable(String), MissingAccount(&'static str), DuplicateNumber(String), ProfileNotFound(Uuid), InvoiceNotFound(Uuid), SessionNotFound(Uuid), BillingRejected { code: String, message: String, }, PaymentRejected { code: String, message: String, }, PricingRejected { code: String, message: String, }, InventoryRejected { code: String, message: String, }, InvalidCashMovement(&'static str), PartialReturnsNotImplemented, ProfileTaxTemplatesMissing(Uuid), TaxRejected { code: String, message: String, }, SessionClosedRescueRequired(Uuid), SyncPartnerMismatch, SyncSessionMismatch, RefundParentNotFound(Uuid), RefundLineageConflict, InvalidTenderMethod(String), DuplicateClientUuid(Uuid), SessionHasDraftOrders(i64), SessionHasUnpostedInvoices(i64), SessionAlreadyOpen, VarianceRejected { code: String, message: String, }, ManagerAuthRequired, PinNotFound, PinInvalid, PinLocked { until: DateTime<Utc>, }, PinThrottled, WeakPin(&'static str), TableNotFound(Uuid), TableOccupied { pos_table_id: Uuid, draft_invoice_id: Uuid, }, DiscountNotFound(Uuid), DiscountNotAllowed, DiscountInvalid(&'static str), Db(Error),
}

Variants§

§

EmptyDocument

§

NegativeAmount

§

SessionNotOpen

§

SessionRegisterMismatch

The open session belongs to a different register than the ticket names — a ticket must settle on its own register’s drawer; pairing one register’s config with another’s till would misattribute cash between registers.

§

NotDraft

§

NotFullyTendered

Fields

§rounded_total: Decimal
§paid_total: Decimal
§

NotReturnable(String)

§

MissingAccount(&'static str)

§

DuplicateNumber(String)

§

ProfileNotFound(Uuid)

§

InvoiceNotFound(Uuid)

§

SessionNotFound(Uuid)

§

BillingRejected

Fields

§code: String
§message: String
§

PaymentRejected

Fields

§code: String
§message: String
§

PricingRejected

Fields

§code: String
§message: String
§

InventoryRejected

Fields

§code: String
§message: String
§

InvalidCashMovement(&'static str)

§

PartialReturnsNotImplemented

Forward-compatible seam (council 2026-07-26, #5): return_sale accepts an optional PartialCredit, but partial-return behavior is not yet implemented — it lands when backbone-billing’s credit note honors a line subset (ADR-001 park; gate: merchant demand).

§

ProfileTaxTemplatesMissing(Uuid)

The register carries no tax templates — a ticket cannot be priced. Configure at least one template on the profile (zero-rated included for a non-PKP register).

§

TaxRejected

The tax compute port refused the request (propagates the seam’s code + message).

Fields

§code: String
§message: String
§

SessionClosedRescueRequired(Uuid)

The session the client rang under has since closed and no open rescue session was offered.

§

SyncPartnerMismatch

The replay would reassign the ticket to a different customer than it was first synced with.

§

SyncSessionMismatch

The replay names a session the ticket does not belong to (and the original is still open).

§

RefundParentNotFound(Uuid)

A refund replay’s parent uuid does not resolve to a live ticket of this company.

§

RefundLineageConflict

A refund ticket already recorded against a different parent refuses to be re-pointed.

§

InvalidTenderMethod(String)

A tender replay carries a method the payment-method enum does not know.

§

DuplicateClientUuid(Uuid)

The client uuid is already held by another live ticket (the sync identity namespaces inside the acting unit’s scope once composed; a collision is a client bug or a replay of someone else’s uuid).

§

SessionHasDraftOrders(i64)

The session still holds DRAFT tickets — post or void them before closing.

§

SessionHasUnpostedInvoices(i64)

The session holds invoiced tickets whose posting did not complete (billing linked, ticket not paid) — retry recognition before closing.

§

SessionAlreadyOpen

A second session is already open on this register (enforced by the one-open-session unique).

§

VarianceRejected

The variance seam refused the booking (propagates the seam’s code + message). Nothing has been written when this surfaces — the close rolls back entirely.

Fields

§code: String
§message: String
§

ManagerAuthRequired

A privileged mutation was attempted without manager authorization.

§

PinNotFound

No live PIN is set for that manager.

§

PinInvalid

The presented PIN does not match the stored hash.

§

PinLocked

The manager’s PIN is locked: too many consecutive failures. Carries the unlock instant.

Fields

§until: DateTime<Utc>
§

PinThrottled

Too many verification attempts from one source address inside the throttle window.

§

WeakPin(&'static str)

The chosen PIN does not satisfy the policy (digits + length window).

§

TableNotFound(Uuid)

The named dining table does not exist (in this tenant).

§

TableOccupied

The named dining table already holds a live DRAFT ticket — one draft per table; resume, settle, or move that ticket before opening a second one on the table. Carries the occupying ticket so the client can jump to it. (The DB partial unique is the backstop; this is the friendly typed refusal.)

Fields

§pos_table_id: Uuid
§draft_invoice_id: Uuid
§

DiscountNotFound(Uuid)

The named discount master row does not exist (in this tenant) or is retired.

§

DiscountNotAllowed

The register is configured discount-off (allow_discount = false) — a ring naming a discount master is refused.

§

DiscountInvalid(&'static str)

The discount master’s stored percentage is unusable (over 100%). The master row is misconfigured; nothing was rung.

§

Db(Error)

Implementations§

Source§

impl PosError

Source

pub fn code(&self) -> String

Source

pub fn http_status(&self) -> u16

Trait Implementations§

Source§

impl Debug for PosError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for PosError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for PosError

1.30.0 · Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<Error> for PosError

Source§

fn from(e: Error) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more