Skip to main content

ResourceServerHooks

Trait ResourceServerHooks 

Source
pub trait ResourceServerHooks: Send + Sync {
    // Provided methods
    fn before_verify<'a>(
        &'a self,
        _ctx: &'a PaymentHookContext,
    ) -> impl Future<Output = BeforeOpDecision<VerifyResponse>> + Send + 'a { ... }
    fn after_verify<'a>(
        &'a self,
        _ctx: &'a VerifyResultContext,
    ) -> impl Future<Output = AfterVerifyDecision> + Send + 'a { ... }
    fn on_verify_failure<'a>(
        &'a self,
        _ctx: &'a PaymentHookContext,
        _error: &'a FacilitatorError,
    ) -> impl Future<Output = FailureRecovery<VerifyResponse>> + Send + 'a { ... }
    fn before_settle<'a>(
        &'a self,
        _ctx: &'a SettleContext,
    ) -> impl Future<Output = BeforeOpDecision<SettleResponse>> + Send + 'a { ... }
    fn after_settle<'a>(
        &'a self,
        _ctx: &'a SettleResultContext,
    ) -> impl Future<Output = ()> + Send + 'a { ... }
    fn on_settle_failure<'a>(
        &'a self,
        _ctx: &'a SettleContext,
        _error: &'a FacilitatorError,
    ) -> impl Future<Output = FailureRecovery<SettleResponse>> + Send + 'a { ... }
    fn on_verified_payment_canceled<'a>(
        &'a self,
        _ctx: &'a VerifiedPaymentCanceledContext,
    ) -> impl Future<Output = ()> + Send + 'a { ... }
}
Expand description

Lifecycle hooks for the resource server (transport-agnostic).

All methods default to no-ops. Override only what you need.

Provided Methods§

Source

fn before_verify<'a>( &'a self, _ctx: &'a PaymentHookContext, ) -> impl Future<Output = BeforeOpDecision<VerifyResponse>> + Send + 'a

Runs before facilitator verify.

Source

fn after_verify<'a>( &'a self, _ctx: &'a VerifyResultContext, ) -> impl Future<Output = AfterVerifyDecision> + Send + 'a

Runs after a successful verify (including skip / failure recovery).

Source

fn on_verify_failure<'a>( &'a self, _ctx: &'a PaymentHookContext, _error: &'a FacilitatorError, ) -> impl Future<Output = FailureRecovery<VerifyResponse>> + Send + 'a

Runs when facilitator verify returns an error.

Source

fn before_settle<'a>( &'a self, _ctx: &'a SettleContext, ) -> impl Future<Output = BeforeOpDecision<SettleResponse>> + Send + 'a

Runs before facilitator settle.

Source

fn after_settle<'a>( &'a self, _ctx: &'a SettleResultContext, ) -> impl Future<Output = ()> + Send + 'a

Runs after a successful settle (including skip / failure recovery).

Source

fn on_settle_failure<'a>( &'a self, _ctx: &'a SettleContext, _error: &'a FacilitatorError, ) -> impl Future<Output = FailureRecovery<SettleResponse>> + Send + 'a

Runs when facilitator settle returns an error.

Source

fn on_verified_payment_canceled<'a>( &'a self, _ctx: &'a VerifiedPaymentCanceledContext, ) -> impl Future<Output = ()> + Send + 'a

Runs when a verified payment will not be settled.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§