Skip to main content

TariffProvider

Trait TariffProvider 

Source
pub trait TariffProvider: Send + Sync {
    // Required methods
    fn quote<'life0, 'async_trait>(
        &'life0 self,
        req: TariffRequest,
    ) -> Pin<Box<dyn Future<Output = Result<TariffQuote, PayError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn resolve_unit<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        issuer_did: &'life1 str,
        resource_class: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<UnitRef, PayError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
}
Expand description

The tariff-provider contract: resource → priced quote.

The server owns the price, catalog, and maximum quantum. A client cannot set the amount, price, or ceiling — those are derived server-side from the resource class, catalog version, and subject tier.

Required Methods§

Source

fn quote<'life0, 'async_trait>( &'life0 self, req: TariffRequest, ) -> Pin<Box<dyn Future<Output = Result<TariffQuote, PayError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get a priced quote for a resource quantity. The quote has a finite expiry and a server-imposed maximum quantum.

Source

fn resolve_unit<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, issuer_did: &'life1 str, resource_class: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<UnitRef, PayError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Resolve a unit reference for cross-cell federation (map an issuer DID + resource class to the canonical UnitRef).

Implementors§