Skip to main content

SqliteCreditRepository

Struct SqliteCreditRepository 

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

Implementations§

Trait Implementations§

Source§

impl CreditRepository for SqliteCreditRepository

Source§

fn create_credit_account( &self, input: CreateCreditAccount, ) -> Result<CreditAccount>

Create a credit account for a customer
Source§

fn get_credit_account(&self, id: CreditId) -> Result<Option<CreditAccount>>

Get credit account by ID
Source§

fn get_credit_account_by_customer( &self, customer_id: CustomerId, ) -> Result<Option<CreditAccount>>

Get credit account by customer ID
Source§

fn update_credit_account( &self, id: CreditId, input: UpdateCreditAccount, ) -> Result<CreditAccount>

Update credit account
Source§

fn list_credit_accounts( &self, filter: CreditAccountFilter, ) -> Result<Vec<CreditAccount>>

List credit accounts
Source§

fn adjust_credit_limit( &self, customer_id: CustomerId, new_limit: Decimal, reason: &str, ) -> Result<CreditAccount>

Adjust credit limit
Source§

fn suspend_credit_account( &self, customer_id: CustomerId, reason: &str, ) -> Result<CreditAccount>

Suspend credit account
Source§

fn reactivate_credit_account( &self, customer_id: CustomerId, ) -> Result<CreditAccount>

Reactivate credit account
Source§

fn check_credit( &self, customer_id: CustomerId, order_amount: Decimal, ) -> Result<CreditCheckResult>

Check credit for an order
Source§

fn reserve_credit( &self, customer_id: CustomerId, order_id: OrderId, amount: Decimal, ) -> Result<CreditAccount>

Reserve credit for an order
Source§

fn release_credit_reservation( &self, customer_id: CustomerId, order_id: OrderId, ) -> Result<CreditAccount>

Release credit reservation
Source§

fn charge_credit( &self, customer_id: CustomerId, order_id: OrderId, amount: Decimal, ) -> Result<CreditAccount>

Charge credit (convert reservation to balance)
Source§

fn place_hold(&self, input: PlaceCreditHold) -> Result<CreditHold>

Place a credit hold
Source§

fn get_hold(&self, id: Uuid) -> Result<Option<CreditHold>>

Get credit hold by ID
Source§

fn list_holds(&self, filter: CreditHoldFilter) -> Result<Vec<CreditHold>>

List credit holds
Source§

fn release_hold(&self, input: ReleaseCreditHold) -> Result<CreditHold>

Release a credit hold
Source§

fn get_active_holds(&self, customer_id: CustomerId) -> Result<Vec<CreditHold>>

Get active holds for customer
Source§

fn get_holds_for_order(&self, order_id: OrderId) -> Result<Vec<CreditHold>>

Get active holds for order
Source§

fn submit_application( &self, input: SubmitCreditApplication, ) -> Result<CreditApplication>

Submit a credit application
Source§

fn get_application(&self, id: Uuid) -> Result<Option<CreditApplication>>

Get credit application by ID
Source§

fn list_applications( &self, filter: CreditApplicationFilter, ) -> Result<Vec<CreditApplication>>

List credit applications
Source§

fn review_application( &self, input: ReviewCreditApplication, ) -> Result<CreditApplication>

Review credit application
Source§

fn withdraw_application(&self, id: Uuid) -> Result<CreditApplication>

Withdraw credit application
Source§

fn record_transaction( &self, input: RecordCreditTransaction, ) -> Result<CreditTransaction>

Record a credit transaction
Source§

fn list_transactions( &self, filter: CreditTransactionFilter, ) -> Result<Vec<CreditTransaction>>

List credit transactions
Source§

fn apply_payment( &self, customer_id: CustomerId, amount: Decimal, reference_id: Option<Uuid>, ) -> Result<CreditAccount>

Apply payment to balance
Source§

fn get_customer_summary( &self, customer_id: CustomerId, ) -> Result<Option<CustomerCreditSummary>>

Get customer credit summary
Source§

fn get_aging_report(&self) -> Result<Vec<(CustomerId, CreditAgingBucket)>>

Get credit aging buckets
Source§

fn get_over_limit_customers(&self) -> Result<Vec<CreditAccount>>

Get customers over credit limit
Source§

impl Debug for SqliteCreditRepository

Source§

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

Formats the value using the given formatter. Read more

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