pub struct PaymentMethodUseCases { /* private fields */ }Implementations§
Source§impl PaymentMethodUseCases
impl PaymentMethodUseCases
pub fn new(payment_method_repository: Arc<dyn PaymentMethodRepository>) -> Self
Sourcepub async fn create_payment_method(
&self,
organization_id: Uuid,
request: CreatePaymentMethodRequest,
) -> Result<PaymentMethodResponse, String>
pub async fn create_payment_method( &self, organization_id: Uuid, request: CreatePaymentMethodRequest, ) -> Result<PaymentMethodResponse, String>
Create a new payment method
If is_default is true, automatically unsets other default payment methods for the owner.
Sourcepub async fn get_payment_method(
&self,
id: Uuid,
) -> Result<Option<PaymentMethodResponse>, String>
pub async fn get_payment_method( &self, id: Uuid, ) -> Result<Option<PaymentMethodResponse>, String>
Get payment method by ID
Sourcepub async fn get_payment_method_by_stripe_id(
&self,
stripe_payment_method_id: &str,
) -> Result<Option<PaymentMethodResponse>, String>
pub async fn get_payment_method_by_stripe_id( &self, stripe_payment_method_id: &str, ) -> Result<Option<PaymentMethodResponse>, String>
Get payment method by Stripe payment method ID
Sourcepub async fn list_owner_payment_methods(
&self,
owner_id: Uuid,
) -> Result<Vec<PaymentMethodResponse>, String>
pub async fn list_owner_payment_methods( &self, owner_id: Uuid, ) -> Result<Vec<PaymentMethodResponse>, String>
List payment methods for an owner
Sourcepub async fn list_active_owner_payment_methods(
&self,
owner_id: Uuid,
) -> Result<Vec<PaymentMethodResponse>, String>
pub async fn list_active_owner_payment_methods( &self, owner_id: Uuid, ) -> Result<Vec<PaymentMethodResponse>, String>
List active payment methods for an owner
Sourcepub async fn get_default_payment_method(
&self,
owner_id: Uuid,
) -> Result<Option<PaymentMethodResponse>, String>
pub async fn get_default_payment_method( &self, owner_id: Uuid, ) -> Result<Option<PaymentMethodResponse>, String>
Get default payment method for an owner
Sourcepub async fn list_organization_payment_methods(
&self,
organization_id: Uuid,
) -> Result<Vec<PaymentMethodResponse>, String>
pub async fn list_organization_payment_methods( &self, organization_id: Uuid, ) -> Result<Vec<PaymentMethodResponse>, String>
List payment methods for an organization
Sourcepub async fn list_payment_methods_by_type(
&self,
owner_id: Uuid,
method_type: PaymentMethodType,
) -> Result<Vec<PaymentMethodResponse>, String>
pub async fn list_payment_methods_by_type( &self, owner_id: Uuid, method_type: PaymentMethodType, ) -> Result<Vec<PaymentMethodResponse>, String>
List payment methods by owner and type
Sourcepub async fn update_payment_method(
&self,
id: Uuid,
request: UpdatePaymentMethodRequest,
) -> Result<PaymentMethodResponse, String>
pub async fn update_payment_method( &self, id: Uuid, request: UpdatePaymentMethodRequest, ) -> Result<PaymentMethodResponse, String>
Update payment method
Sourcepub async fn set_as_default(
&self,
id: Uuid,
owner_id: Uuid,
) -> Result<PaymentMethodResponse, String>
pub async fn set_as_default( &self, id: Uuid, owner_id: Uuid, ) -> Result<PaymentMethodResponse, String>
Set payment method as default
Sourcepub async fn deactivate_payment_method(
&self,
id: Uuid,
) -> Result<PaymentMethodResponse, String>
pub async fn deactivate_payment_method( &self, id: Uuid, ) -> Result<PaymentMethodResponse, String>
Deactivate payment method
Sourcepub async fn reactivate_payment_method(
&self,
id: Uuid,
) -> Result<PaymentMethodResponse, String>
pub async fn reactivate_payment_method( &self, id: Uuid, ) -> Result<PaymentMethodResponse, String>
Reactivate payment method
Sourcepub async fn delete_payment_method(&self, id: Uuid) -> Result<bool, String>
pub async fn delete_payment_method(&self, id: Uuid) -> Result<bool, String>
Delete payment method
Auto Trait Implementations§
impl Freeze for PaymentMethodUseCases
impl !RefUnwindSafe for PaymentMethodUseCases
impl Send for PaymentMethodUseCases
impl Sync for PaymentMethodUseCases
impl Unpin for PaymentMethodUseCases
impl !UnwindSafe for PaymentMethodUseCases
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
§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>
Converts
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>
Converts
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 moreCreates a shared type from an unshared type.