pub trait PaymentProvider: Send + Sync {
// Required methods
fn charge<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
amount: i64,
currency: &'life1 str,
source_id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<String, AppError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn refund<'life0, 'life1, 'async_trait>(
&'life0 self,
transaction_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), AppError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}Expand description
An abstraction for any Payment Gateway (Stripe, PayPal, Adyen, etc.)
Required Methods§
Sourcefn charge<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
amount: i64,
currency: &'life1 str,
source_id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<String, AppError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn charge<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
amount: i64,
currency: &'life1 str,
source_id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<String, AppError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Charge a customer. Returns the external transaction ID.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".