wasmcloud_examples_payments

Trait Payments

Source
pub trait Payments {
    // Required methods
    fn authorize_payment<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        ctx: &'life1 Context,
        arg: &'life2 AuthorizePaymentRequest,
    ) -> Pin<Box<dyn Future<Output = RpcResult<AuthorizePaymentResponse>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn complete_payment<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        ctx: &'life1 Context,
        arg: &'life2 CompletePaymentRequest,
    ) -> Pin<Box<dyn Future<Output = RpcResult<CompletePaymentResponse>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn get_payment_methods<'life0, 'life1, 'async_trait>(
        &'life0 self,
        ctx: &'life1 Context,
    ) -> Pin<Box<dyn Future<Output = RpcResult<PaymentMethods>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided method
    fn contract_id() -> &'static str { ... }
}
Expand description

wasmbus.contractId: wasmcloud:example:payments wasmbus.providerReceive

Required Methods§

Source

fn authorize_payment<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, ctx: &'life1 Context, arg: &'life2 AuthorizePaymentRequest, ) -> Pin<Box<dyn Future<Output = RpcResult<AuthorizePaymentResponse>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

AuthorizePayment - Validates that a potential payment transaction can go through. If this succeeds then we should assume it is safe to complete a payment. Payments cannot be completed without getting a validation code (in other words, all payments have to be pre-authorized).

Source

fn complete_payment<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, ctx: &'life1 Context, arg: &'life2 CompletePaymentRequest, ) -> Pin<Box<dyn Future<Output = RpcResult<CompletePaymentResponse>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Completes a previously authorized payment. This operation requires the “authorization code” from a successful authorization operation.

Source

fn get_payment_methods<'life0, 'life1, 'async_trait>( &'life0 self, ctx: &'life1 Context, ) -> Pin<Box<dyn Future<Output = RpcResult<PaymentMethods>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

GetPaymentMethods - Retrieves an opaque list of payment methods, which is a list of customer-facing method names and the tokens belonging to that payment method. You could think of this list as a previously saved list of payment methods stored in a “wallet”. A payment method token is required to authorize and subsequently complete a payment transaction. A customer could have previously supplied their credit card and user-friendly labels for those methods like “personal” and “work”, etc.

Provided Methods§

Source

fn contract_id() -> &'static str

returns the capability contract id for this interface

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§