pub struct Gate { /* private fields */ }server only.Expand description
HTTP payment gate.
Implementations§
Source§impl Gate
impl Gate
Sourcepub fn error_response(&self, err: GateError) -> Response
pub fn error_response(&self, err: GateError) -> Response
Converts a GateError into an HTTP response.
Source§impl Gate
impl Gate
Sourcepub const fn resource_server(&self) -> &ResourceServer
pub const fn resource_server(&self) -> &ResourceServer
Resource server (facilitator + schemes).
Sourcepub const fn resource(&self) -> &ResourceInfo
pub const fn resource(&self) -> &ResourceInfo
Resource metadata on 402 bodies.
Sourcepub const fn payment_required(&self) -> Option<&PaymentRequired>
pub const fn payment_required(&self) -> Option<&PaymentRequired>
Built 402 body, if Self::build_payment_required ran.
Sourcepub async fn require_schemes(&self) -> Result<(), GateError>
pub async fn require_schemes(&self) -> Result<(), GateError>
Requires a registered scheme for every accept. Escrow needs settle_on_cancel.
§Errors
GateError::MissingScheme, GateError::MissingSettleOnCancel, or flow errors.
Sourcepub fn assert_mode_compatible(
&self,
mode: SettlementMode,
) -> Result<(), GateError>
pub fn assert_mode_compatible( &self, mode: SettlementMode, ) -> Result<(), GateError>
Concurrent/Background are illegal when any resolved accept is upfront or escrow.
§Errors
GateError::IncompatibleSettlementMode or flow-resolution errors.
Sourcepub async fn handle_request<S>(
&self,
inner: S,
req: Request,
) -> Result<Response, GateError>
pub async fn handle_request<S>( &self, inner: S, req: Request, ) -> Result<Response, GateError>
Sourcepub async fn handle_request_concurrent<S>(
&self,
inner: S,
req: Request,
) -> Result<Response, GateError>
pub async fn handle_request_concurrent<S>( &self, inner: S, req: Request, ) -> Result<Response, GateError>
Concurrent: steps 1–5, then wrap 4xx/overrides as Err, then run JoinSettle.
§Errors
GateError for verify/settle/header failures. Overrides → 402
GateError::SettlementAborted.
Source§impl Gate
impl Gate
Sourcepub async fn build_payment_required(&mut self) -> Result<(), GateError>
pub async fn build_payment_required(&mut self) -> Result<(), GateError>
Fetches /supported and builds the shared 402 body.
§Errors
GateError::Transport when /supported fails.
GateError::FacilitatorSupport when this accept list has no matching
kind or advertised extra is unusable.
GateError::PaymentRequiredBuild when 402 construction fails.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Gate
impl !UnwindSafe for Gate
impl Freeze for Gate
impl Send for Gate
impl Sync for Gate
impl Unpin for Gate
impl UnsafeUnpin for Gate
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> ⓘ
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> ⓘ
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