Skip to main content

SqliteSubscriptionRepository

Struct SqliteSubscriptionRepository 

Source
pub struct SqliteSubscriptionRepository { /* private fields */ }
Available on crate feature sqlite only.

Implementations§

Source§

impl SqliteSubscriptionRepository

Source

pub const fn new(pool: Pool<SqliteConnectionManager>) -> Self

Source

pub fn create_plan( &self, input: CreateSubscriptionPlan, ) -> Result<SubscriptionPlan>

Source

pub fn get_plan(&self, id: Uuid) -> Result<Option<SubscriptionPlan>>

Source

pub fn get_plan_by_code(&self, code: &str) -> Result<Option<SubscriptionPlan>>

Source

pub fn list_plans( &self, filter: SubscriptionPlanFilter, ) -> Result<Vec<SubscriptionPlan>>

Source

pub fn update_plan( &self, id: Uuid, input: UpdateSubscriptionPlan, ) -> Result<SubscriptionPlan>

Source

pub fn activate_plan(&self, id: Uuid) -> Result<SubscriptionPlan>

Source

pub fn archive_plan(&self, id: Uuid) -> Result<SubscriptionPlan>

Source

pub fn create_subscription( &self, input: CreateSubscription, ) -> Result<Subscription>

Source

pub fn get_subscription( &self, id: SubscriptionId, ) -> Result<Option<Subscription>>

Source

pub fn get_subscription_by_number( &self, number: &str, ) -> Result<Option<Subscription>>

Source

pub fn list_subscriptions( &self, filter: SubscriptionFilter, ) -> Result<Vec<Subscription>>

Source

pub fn update_subscription( &self, id: SubscriptionId, input: UpdateSubscription, ) -> Result<Subscription>

Source

pub fn pause_subscription( &self, id: SubscriptionId, input: PauseSubscription, ) -> Result<Subscription>

Source

pub fn resume_subscription(&self, id: SubscriptionId) -> Result<Subscription>

Source

pub fn cancel_subscription( &self, id: SubscriptionId, input: CancelSubscription, ) -> Result<Subscription>

Source

pub fn skip_billing_cycle( &self, id: SubscriptionId, input: SkipBillingCycle, ) -> Result<Subscription>

Source

pub fn create_billing_cycle( &self, input: CreateBillingCycle, ) -> Result<BillingCycle>

Source

pub fn get_billing_cycle(&self, id: Uuid) -> Result<Option<BillingCycle>>

Source

pub fn list_billing_cycles( &self, filter: BillingCycleFilter, ) -> Result<Vec<BillingCycle>>

Source

pub fn update_billing_cycle_status( &self, id: Uuid, status: BillingCycleStatus, payment_id: Option<String>, failure_reason: Option<String>, ) -> Result<BillingCycle>

Source

pub fn record_event( &self, subscription_id: SubscriptionId, event_type: SubscriptionEventType, description: &str, data: Option<Value>, triggered_by: Option<&str>, ) -> Result<SubscriptionEvent>

Source

pub fn get_subscription_events( &self, subscription_id: SubscriptionId, limit: Option<u32>, ) -> Result<Vec<SubscriptionEvent>>

Trait Implementations§

Source§

impl Debug for SqliteSubscriptionRepository

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl SubscriptionRepository for SqliteSubscriptionRepository

Source§

fn create_plan(&self, input: CreateSubscriptionPlan) -> Result<SubscriptionPlan>

Create a subscription plan
Source§

fn get_plan(&self, id: Uuid) -> Result<Option<SubscriptionPlan>>

Get a subscription plan by ID
Source§

fn get_plan_by_code(&self, code: &str) -> Result<Option<SubscriptionPlan>>

Get a subscription plan by code
Source§

fn list_plans( &self, filter: SubscriptionPlanFilter, ) -> Result<Vec<SubscriptionPlan>>

List subscription plans matching a filter
Source§

fn update_plan( &self, id: Uuid, input: UpdateSubscriptionPlan, ) -> Result<SubscriptionPlan>

Update a subscription plan
Source§

fn activate_plan(&self, id: Uuid) -> Result<SubscriptionPlan>

Activate a subscription plan
Source§

fn archive_plan(&self, id: Uuid) -> Result<SubscriptionPlan>

Archive a subscription plan
Source§

fn create_subscription(&self, input: CreateSubscription) -> Result<Subscription>

Create a subscription
Source§

fn get_subscription(&self, id: SubscriptionId) -> Result<Option<Subscription>>

Get a subscription by ID
Source§

fn get_subscription_by_number( &self, number: &str, ) -> Result<Option<Subscription>>

Get a subscription by number
Source§

fn list_subscriptions( &self, filter: SubscriptionFilter, ) -> Result<Vec<Subscription>>

List subscriptions matching a filter
Source§

fn update_subscription( &self, id: SubscriptionId, input: UpdateSubscription, ) -> Result<Subscription>

Update a subscription
Source§

fn cancel_subscription( &self, id: SubscriptionId, input: CancelSubscription, ) -> Result<Subscription>

Cancel a subscription
Source§

fn pause_subscription( &self, id: SubscriptionId, input: PauseSubscription, ) -> Result<Subscription>

Pause a subscription
Source§

fn resume_subscription(&self, id: SubscriptionId) -> Result<Subscription>

Resume a paused subscription
Source§

fn create_billing_cycle( &self, input: CreateBillingCycle, ) -> Result<BillingCycle>

Create a billing cycle
Source§

fn get_billing_cycle(&self, id: Uuid) -> Result<Option<BillingCycle>>

Get a billing cycle by ID
Source§

fn list_billing_cycles( &self, filter: BillingCycleFilter, ) -> Result<Vec<BillingCycle>>

List billing cycles matching a filter
Source§

fn update_billing_cycle_status( &self, id: Uuid, status: BillingCycleStatus, ) -> Result<BillingCycle>

Update the status of a billing cycle
Source§

fn skip_billing_cycle( &self, id: SubscriptionId, input: SkipBillingCycle, ) -> Result<Subscription>

Skip a billing cycle
Source§

fn record_event( &self, subscription_id: SubscriptionId, event_type: SubscriptionEventType, notes: Option<String>, ) -> Result<SubscriptionEvent>

Record a subscription event
Source§

fn get_subscription_events( &self, subscription_id: SubscriptionId, ) -> Result<Vec<SubscriptionEvent>>

Get all events for a subscription

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more