pub struct SqliteCreditRepository { /* private fields */ }Available on crate feature
sqlite only.Implementations§
Source§impl SqliteCreditRepository
impl SqliteCreditRepository
pub const fn new(pool: Pool<SqliteConnectionManager>) -> Self
Trait Implementations§
Source§impl CreditRepository for SqliteCreditRepository
impl CreditRepository for SqliteCreditRepository
Source§fn create_credit_account(
&self,
input: CreateCreditAccount,
) -> Result<CreditAccount>
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>>
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>>
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>
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>>
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>
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>
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>
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>
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>
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>
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>
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>
fn place_hold(&self, input: PlaceCreditHold) -> Result<CreditHold>
Place a credit hold
Source§fn list_holds(&self, filter: CreditHoldFilter) -> Result<Vec<CreditHold>>
fn list_holds(&self, filter: CreditHoldFilter) -> Result<Vec<CreditHold>>
List credit holds
Source§fn release_hold(&self, input: ReleaseCreditHold) -> Result<CreditHold>
fn release_hold(&self, input: ReleaseCreditHold) -> Result<CreditHold>
Release a credit hold
Source§fn get_active_holds(&self, customer_id: CustomerId) -> Result<Vec<CreditHold>>
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>>
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>
fn submit_application( &self, input: SubmitCreditApplication, ) -> Result<CreditApplication>
Submit a credit application
Source§fn get_application(&self, id: Uuid) -> Result<Option<CreditApplication>>
fn get_application(&self, id: Uuid) -> Result<Option<CreditApplication>>
Get credit application by ID
Source§fn list_applications(
&self,
filter: CreditApplicationFilter,
) -> Result<Vec<CreditApplication>>
fn list_applications( &self, filter: CreditApplicationFilter, ) -> Result<Vec<CreditApplication>>
List credit applications
Source§fn review_application(
&self,
input: ReviewCreditApplication,
) -> Result<CreditApplication>
fn review_application( &self, input: ReviewCreditApplication, ) -> Result<CreditApplication>
Review credit application
Source§fn withdraw_application(&self, id: Uuid) -> Result<CreditApplication>
fn withdraw_application(&self, id: Uuid) -> Result<CreditApplication>
Withdraw credit application
Source§fn record_transaction(
&self,
input: RecordCreditTransaction,
) -> Result<CreditTransaction>
fn record_transaction( &self, input: RecordCreditTransaction, ) -> Result<CreditTransaction>
Record a credit transaction
Source§fn list_transactions(
&self,
filter: CreditTransactionFilter,
) -> Result<Vec<CreditTransaction>>
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>
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>>
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)>>
fn get_aging_report(&self) -> Result<Vec<(CustomerId, CreditAgingBucket)>>
Get credit aging buckets
Source§fn get_over_limit_customers(&self) -> Result<Vec<CreditAccount>>
fn get_over_limit_customers(&self) -> Result<Vec<CreditAccount>>
Get customers over credit limit
Auto Trait Implementations§
impl !RefUnwindSafe for SqliteCreditRepository
impl !UnwindSafe for SqliteCreditRepository
impl Freeze for SqliteCreditRepository
impl Send for SqliteCreditRepository
impl Sync for SqliteCreditRepository
impl Unpin for SqliteCreditRepository
impl UnsafeUnpin for SqliteCreditRepository
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more