PaymentRepository

Trait PaymentRepository 

Source
pub trait PaymentRepository: Send + Sync {
Show 19 methods // Required methods fn create<'life0, 'life1, 'async_trait>( &'life0 self, payment: &'life1 Payment, ) -> Pin<Box<dyn Future<Output = Result<Payment, String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn find_by_id<'life0, 'async_trait>( &'life0 self, id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<Option<Payment>, String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn find_by_stripe_payment_intent_id<'life0, 'life1, 'async_trait>( &'life0 self, stripe_payment_intent_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<Payment>, String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn find_by_idempotency_key<'life0, 'life1, 'async_trait>( &'life0 self, organization_id: Uuid, idempotency_key: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<Payment>, String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn find_by_owner<'life0, 'async_trait>( &'life0 self, owner_id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<Vec<Payment>, String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn find_by_building<'life0, 'async_trait>( &'life0 self, building_id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<Vec<Payment>, String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn find_by_expense<'life0, 'async_trait>( &'life0 self, expense_id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<Vec<Payment>, String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn find_by_organization<'life0, 'async_trait>( &'life0 self, organization_id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<Vec<Payment>, String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn find_by_status<'life0, 'async_trait>( &'life0 self, organization_id: Uuid, status: TransactionStatus, ) -> Pin<Box<dyn Future<Output = Result<Vec<Payment>, String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn find_by_building_and_status<'life0, 'async_trait>( &'life0 self, building_id: Uuid, status: TransactionStatus, ) -> Pin<Box<dyn Future<Output = Result<Vec<Payment>, String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn find_pending<'life0, 'async_trait>( &'life0 self, organization_id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<Vec<Payment>, String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn find_failed<'life0, 'async_trait>( &'life0 self, organization_id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<Vec<Payment>, String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn update<'life0, 'life1, 'async_trait>( &'life0 self, payment: &'life1 Payment, ) -> Pin<Box<dyn Future<Output = Result<Payment, String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn delete<'life0, 'async_trait>( &'life0 self, id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<bool, String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn get_total_paid_for_expense<'life0, 'async_trait>( &'life0 self, expense_id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<i64, String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn get_total_paid_by_owner<'life0, 'async_trait>( &'life0 self, owner_id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<i64, String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn get_total_paid_for_building<'life0, 'async_trait>( &'life0 self, building_id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<i64, String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn get_owner_payment_stats<'life0, 'async_trait>( &'life0 self, owner_id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<PaymentStats, String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn get_building_payment_stats<'life0, 'async_trait>( &'life0 self, building_id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<PaymentStats, String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait;
}

Required Methods§

Source

fn create<'life0, 'life1, 'async_trait>( &'life0 self, payment: &'life1 Payment, ) -> Pin<Box<dyn Future<Output = Result<Payment, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Create a new payment

Source

fn find_by_id<'life0, 'async_trait>( &'life0 self, id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<Option<Payment>, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Find payment by ID

Source

fn find_by_stripe_payment_intent_id<'life0, 'life1, 'async_trait>( &'life0 self, stripe_payment_intent_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<Payment>, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Find payment by Stripe payment intent ID

Source

fn find_by_idempotency_key<'life0, 'life1, 'async_trait>( &'life0 self, organization_id: Uuid, idempotency_key: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<Payment>, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Find payment by idempotency key (prevents duplicate charges)

Source

fn find_by_owner<'life0, 'async_trait>( &'life0 self, owner_id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<Vec<Payment>, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Find all payments for an owner

Source

fn find_by_building<'life0, 'async_trait>( &'life0 self, building_id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<Vec<Payment>, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Find all payments for a building

Source

fn find_by_expense<'life0, 'async_trait>( &'life0 self, expense_id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<Vec<Payment>, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Find all payments for an expense

Source

fn find_by_organization<'life0, 'async_trait>( &'life0 self, organization_id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<Vec<Payment>, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Find all payments for an organization

Source

fn find_by_status<'life0, 'async_trait>( &'life0 self, organization_id: Uuid, status: TransactionStatus, ) -> Pin<Box<dyn Future<Output = Result<Vec<Payment>, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Find payments by status

Source

fn find_by_building_and_status<'life0, 'async_trait>( &'life0 self, building_id: Uuid, status: TransactionStatus, ) -> Pin<Box<dyn Future<Output = Result<Vec<Payment>, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Find payments by status and building

Source

fn find_pending<'life0, 'async_trait>( &'life0 self, organization_id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<Vec<Payment>, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Find pending payments (for background processing)

Source

fn find_failed<'life0, 'async_trait>( &'life0 self, organization_id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<Vec<Payment>, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Find failed payments (for retry or analysis)

Source

fn update<'life0, 'life1, 'async_trait>( &'life0 self, payment: &'life1 Payment, ) -> Pin<Box<dyn Future<Output = Result<Payment, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Update payment

Source

fn delete<'life0, 'async_trait>( &'life0 self, id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<bool, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Delete payment (soft delete recommended in production)

Source

fn get_total_paid_for_expense<'life0, 'async_trait>( &'life0 self, expense_id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<i64, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get total amount paid for an expense (sum of succeeded payments)

Source

fn get_total_paid_by_owner<'life0, 'async_trait>( &'life0 self, owner_id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<i64, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get total amount paid by owner (sum of succeeded payments)

Source

fn get_total_paid_for_building<'life0, 'async_trait>( &'life0 self, building_id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<i64, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get total amount paid for building (sum of succeeded payments)

Source

fn get_owner_payment_stats<'life0, 'async_trait>( &'life0 self, owner_id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<PaymentStats, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get payment statistics for owner

Source

fn get_building_payment_stats<'life0, 'async_trait>( &'life0 self, building_id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<PaymentStats, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get payment statistics for building

Implementors§