Skip to main content

SchemeNetworkServer

Trait SchemeNetworkServer 

Source
pub trait SchemeNetworkServer: Send + Sync {
    // Required methods
    fn scheme(&self) -> &str;
    fn default_asset_transfer_method(&self) -> &str;
    fn payment_flows(&self) -> &HashMap<String, PaymentFlowConfig>;

    // Provided methods
    fn dynamic_extra_fields(&self) -> &[&str] { ... }
    fn enrich_payment_required_response<'a>(
        &'a self,
        _ctx: &'a SchemePaymentRequiredContext<'a>,
    ) -> impl Future<Output = Option<Vec<PaymentRequirements>>> + Send + 'a { ... }
    fn enrich_settlement_payload<'a>(
        &'a self,
        _ctx: &'a SettleContext,
    ) -> impl Future<Output = Result<Option<Map<String, Value>>, FacilitatorError>> + Send + 'a { ... }
    fn enrich_settlement_response<'a>(
        &'a self,
        _ctx: &'a SettleResultContext,
    ) -> impl Future<Output = Option<Map<String, Value>>> + Send + 'a { ... }
    fn settle_on_cancel<'a>(
        &'a self,
        _ctx: &'a VerifiedPaymentCanceledContext,
    ) -> impl Future<Output = Option<PaymentRequirements>> + Send + 'a { ... }
    fn settles_on_cancel(&self) -> bool { ... }
    fn validate_facilitator_support(
        &self,
        network: &ChainId,
        kind: &SupportedPaymentKind,
        facilitator_extensions: &[CompactString],
    ) -> Result<(), FacilitatorSupportError> { ... }
}
Available on crate feature server only.
Expand description

Scheme/network adapter registered on crate::ResourceServer.

Enrich hooks are AFIT async. Defaults are no-ops.

Required Methods§

Source

fn scheme(&self) -> &str

Wire scheme name (e.g. "exact").

Source

fn default_asset_transfer_method(&self) -> &str

ATM used when requirements.extra.assetTransferMethod is absent.

Source

fn payment_flows(&self) -> &HashMap<String, PaymentFlowConfig>

Payment flows supported per asset-transfer method.

Provided Methods§

Source

fn dynamic_extra_fields(&self) -> &[&str]

Extra keys omitted from requirement matching.

Source

fn enrich_payment_required_response<'a>( &'a self, _ctx: &'a SchemePaymentRequiredContext<'a>, ) -> impl Future<Output = Option<Vec<PaymentRequirements>>> + Send + 'a

Optional 402 accept enrichment. None leaves accepts unchanged.

Source

fn enrich_settlement_payload<'a>( &'a self, _ctx: &'a SettleContext, ) -> impl Future<Output = Result<Option<Map<String, Value>>, FacilitatorError>> + Send + 'a

Optional additive settle-payload enrichment.

Ok(None) leaves the client payload unchanged. Ok(Some(map)) is merged additively. Err fails the settle.

Source

fn enrich_settlement_response<'a>( &'a self, _ctx: &'a SettleResultContext, ) -> impl Future<Output = Option<Map<String, Value>>> + Send + 'a

Optional additive settle-response enrichment.

Source

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

Requirements to settle when a verified payment is canceled.

None skips cancel settle.

Source

fn settles_on_cancel(&self) -> bool

true iff Self::settle_on_cancel can return Some.

HTTP construct cannot await Self::settle_on_cancel. Default false.

Source

fn validate_facilitator_support( &self, network: &ChainId, kind: &SupportedPaymentKind, facilitator_extensions: &[CompactString], ) -> Result<(), FacilitatorSupportError>

Advertised /supported kind extra for this scheme. Default Ok(()).

§Errors

FacilitatorSupportError when the advertised kind cannot serve this scheme.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§