pub struct PaymentUseCases { /* private fields */ }Implementations§
Source§impl PaymentUseCases
impl PaymentUseCases
pub fn new( payment_repository: Arc<dyn PaymentRepository>, payment_method_repository: Arc<dyn PaymentMethodRepository>, ) -> Self
Sourcepub async fn create_payment(
&self,
organization_id: Uuid,
request: CreatePaymentRequest,
) -> Result<PaymentResponse, String>
pub async fn create_payment( &self, organization_id: Uuid, request: CreatePaymentRequest, ) -> Result<PaymentResponse, String>
Create a new payment
Generates a unique idempotency key to prevent duplicate charges. Checks for existing payment with same idempotency key (prevents retries from creating duplicates).
Sourcepub async fn get_payment(
&self,
id: Uuid,
) -> Result<Option<PaymentResponse>, String>
pub async fn get_payment( &self, id: Uuid, ) -> Result<Option<PaymentResponse>, String>
Get payment by ID
Sourcepub async fn get_payment_by_stripe_intent(
&self,
stripe_payment_intent_id: &str,
) -> Result<Option<PaymentResponse>, String>
pub async fn get_payment_by_stripe_intent( &self, stripe_payment_intent_id: &str, ) -> Result<Option<PaymentResponse>, String>
Get payment by Stripe payment intent ID
Sourcepub async fn list_owner_payments(
&self,
owner_id: Uuid,
) -> Result<Vec<PaymentResponse>, String>
pub async fn list_owner_payments( &self, owner_id: Uuid, ) -> Result<Vec<PaymentResponse>, String>
List payments for an owner
Sourcepub async fn list_building_payments(
&self,
building_id: Uuid,
) -> Result<Vec<PaymentResponse>, String>
pub async fn list_building_payments( &self, building_id: Uuid, ) -> Result<Vec<PaymentResponse>, String>
List payments for a building
Sourcepub async fn list_expense_payments(
&self,
expense_id: Uuid,
) -> Result<Vec<PaymentResponse>, String>
pub async fn list_expense_payments( &self, expense_id: Uuid, ) -> Result<Vec<PaymentResponse>, String>
List payments for an expense
Sourcepub async fn list_organization_payments(
&self,
organization_id: Uuid,
) -> Result<Vec<PaymentResponse>, String>
pub async fn list_organization_payments( &self, organization_id: Uuid, ) -> Result<Vec<PaymentResponse>, String>
List payments for an organization
Sourcepub async fn list_payments_by_status(
&self,
organization_id: Uuid,
status: TransactionStatus,
) -> Result<Vec<PaymentResponse>, String>
pub async fn list_payments_by_status( &self, organization_id: Uuid, status: TransactionStatus, ) -> Result<Vec<PaymentResponse>, String>
List payments by status
Sourcepub async fn list_pending_payments(
&self,
organization_id: Uuid,
) -> Result<Vec<PaymentResponse>, String>
pub async fn list_pending_payments( &self, organization_id: Uuid, ) -> Result<Vec<PaymentResponse>, String>
List pending payments (for background processing)
Sourcepub async fn list_failed_payments(
&self,
organization_id: Uuid,
) -> Result<Vec<PaymentResponse>, String>
pub async fn list_failed_payments( &self, organization_id: Uuid, ) -> Result<Vec<PaymentResponse>, String>
List failed payments (for retry or analysis)
Sourcepub async fn mark_processing(&self, id: Uuid) -> Result<PaymentResponse, String>
pub async fn mark_processing(&self, id: Uuid) -> Result<PaymentResponse, String>
Mark payment as processing
Sourcepub async fn mark_requires_action(
&self,
id: Uuid,
) -> Result<PaymentResponse, String>
pub async fn mark_requires_action( &self, id: Uuid, ) -> Result<PaymentResponse, String>
Mark payment as requiring action (e.g., 3D Secure)
Sourcepub async fn mark_succeeded(&self, id: Uuid) -> Result<PaymentResponse, String>
pub async fn mark_succeeded(&self, id: Uuid) -> Result<PaymentResponse, String>
Mark payment as succeeded
Sourcepub async fn mark_failed(
&self,
id: Uuid,
reason: String,
) -> Result<PaymentResponse, String>
pub async fn mark_failed( &self, id: Uuid, reason: String, ) -> Result<PaymentResponse, String>
Mark payment as failed
Sourcepub async fn mark_cancelled(&self, id: Uuid) -> Result<PaymentResponse, String>
pub async fn mark_cancelled(&self, id: Uuid) -> Result<PaymentResponse, String>
Mark payment as cancelled
Sourcepub async fn refund_payment(
&self,
id: Uuid,
request: RefundPaymentRequest,
) -> Result<PaymentResponse, String>
pub async fn refund_payment( &self, id: Uuid, request: RefundPaymentRequest, ) -> Result<PaymentResponse, String>
Refund payment (partial or full)
Sourcepub async fn set_stripe_payment_intent_id(
&self,
id: Uuid,
stripe_payment_intent_id: String,
) -> Result<PaymentResponse, String>
pub async fn set_stripe_payment_intent_id( &self, id: Uuid, stripe_payment_intent_id: String, ) -> Result<PaymentResponse, String>
Set Stripe payment intent ID
Sourcepub async fn set_stripe_customer_id(
&self,
id: Uuid,
stripe_customer_id: String,
) -> Result<PaymentResponse, String>
pub async fn set_stripe_customer_id( &self, id: Uuid, stripe_customer_id: String, ) -> Result<PaymentResponse, String>
Set Stripe customer ID
Sourcepub async fn set_payment_method_id(
&self,
id: Uuid,
payment_method_id: Uuid,
) -> Result<PaymentResponse, String>
pub async fn set_payment_method_id( &self, id: Uuid, payment_method_id: Uuid, ) -> Result<PaymentResponse, String>
Set payment method ID
Sourcepub async fn get_total_paid_for_expense(
&self,
expense_id: Uuid,
) -> Result<i64, String>
pub async fn get_total_paid_for_expense( &self, expense_id: Uuid, ) -> Result<i64, String>
Get total paid for expense
Sourcepub async fn get_total_paid_by_owner(
&self,
owner_id: Uuid,
) -> Result<i64, String>
pub async fn get_total_paid_by_owner( &self, owner_id: Uuid, ) -> Result<i64, String>
Get total paid by owner
Sourcepub async fn get_total_paid_for_building(
&self,
building_id: Uuid,
) -> Result<i64, String>
pub async fn get_total_paid_for_building( &self, building_id: Uuid, ) -> Result<i64, String>
Get total paid for building
Sourcepub async fn get_owner_payment_stats(
&self,
owner_id: Uuid,
) -> Result<PaymentStatsResponse, String>
pub async fn get_owner_payment_stats( &self, owner_id: Uuid, ) -> Result<PaymentStatsResponse, String>
Get payment statistics for owner
Sourcepub async fn get_building_payment_stats(
&self,
building_id: Uuid,
) -> Result<PaymentStatsResponse, String>
pub async fn get_building_payment_stats( &self, building_id: Uuid, ) -> Result<PaymentStatsResponse, String>
Get payment statistics for building
Auto Trait Implementations§
impl Freeze for PaymentUseCases
impl !RefUnwindSafe for PaymentUseCases
impl Send for PaymentUseCases
impl Sync for PaymentUseCases
impl Unpin for PaymentUseCases
impl !UnwindSafe for PaymentUseCases
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
§impl<T> Chain<T> for T
impl<T> Chain<T> for T
§impl<T> Fake for T
impl<T> Fake for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more