Skip to main content

ferrox_integrations/
lib.rs

1use async_trait::async_trait;
2use ferrox_errors::AppError;
3
4/// An abstraction for any Payment Gateway (Stripe, PayPal, Adyen, etc.)
5#[async_trait]
6pub trait PaymentProvider: Send + Sync {
7    /// Charge a customer. Returns the external transaction ID.
8    async fn charge(&self, amount: i64, currency: &str, source_id: &str) -> Result<String, AppError>;
9    
10    /// Refund a previously executed transaction.
11    async fn refund(&self, transaction_id: &str) -> Result<(), AppError>;
12}
13
14/// An abstraction for any Notification delivery service (SendGrid, Slack, Twilio, etc.)
15#[async_trait]
16pub trait NotificationProvider: Send + Sync {
17    /// Send an email
18    async fn send_email(&self, to: &str, subject: &str, body: &str) -> Result<(), AppError>;
19    
20    /// Send a Chat Message (Slack/Teams/Discord)
21    async fn send_chat(&self, channel_id: &str, message: &str) -> Result<(), AppError>;
22}
23
24pub fn setup() {
25    println!("ferrox-integrations initialized: Third-Party API abstractions ready.");
26}