Skip to main content

SubscriptionOfferStore

Trait SubscriptionOfferStore 

Source
pub trait SubscriptionOfferStore: Send + Sync {
    // Required method
    fn lock_current_offer<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        connection: &'life1 mut PgConnection,
        billing_scope_id: BillingScopeId,
        plan_key: &'life2 PlanKey,
    ) -> Pin<Box<dyn Future<Output = Result<Option<SubscriptionOffer>, Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;

    // Provided method
    fn lock_enrollment_offer<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        connection: &'life1 mut PgConnection,
        context: SubscriptionEnrollmentOfferContext<'life2>,
    ) -> Pin<Box<dyn Future<Output = Result<Option<SubscriptionOffer>, Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
}

Required Methods§

Source

fn lock_current_offer<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, connection: &'life1 mut PgConnection, billing_scope_id: BillingScopeId, plan_key: &'life2 PlanKey, ) -> Pin<Box<dyn Future<Output = Result<Option<SubscriptionOffer>, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Locks the host-owned row for this exact scope and plan on connection.

Implementations must not acquire another connection. The returned row must remain protected against host price updates until the caller’s transaction ends.

Provided Methods§

Source

fn lock_enrollment_offer<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, connection: &'life1 mut PgConnection, context: SubscriptionEnrollmentOfferContext<'life2>, ) -> Pin<Box<dyn Future<Output = Result<Option<SubscriptionOffer>, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Locks the subscriber-aware offer used for enrollment admission.

Overrides must lock any host trial-eligibility state on the supplied connection and must not acquire a second connection. Enrollment calls this hook at both SubscriptionEnrollmentOfferStage values for the same reservation. Attempt-history eligibility queries must exclude SubscriptionEnrollmentOfferContext::attempt_id; the result may change only because locked host policy or eligibility state external to that in-flight attempt changed. The subscriber/plan aggregate lock serializes reservation and admission before this callback. Implementations must not acquire Syrup Rail payment-attempt ledger locks independently; doing so would invert admission’s aggregate -> attempt -> offer order.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§