use crate::registrations::AppState;
use axum::{body::Bytes, extract::State, http::HeaderMap, response::Response, routing::any};
use forklaunch_ecommerce_stripe::http::{EcommerceHttp, Handler};
pub fn handle_stripe_webhook(state: &AppState) -> Handler {
any(stripe).with_state(state.ecommerce.clone())
}
async fn stripe(State(ecommerce): State<EcommerceHttp>, headers: HeaderMap, body: Bytes) -> Response {
ecommerce.stripe_webhook(&headers, &body).await
}
pub fn handle_paypal_webhook(state: &AppState) -> Handler {
any(paypal).with_state(state.ecommerce.clone())
}
async fn paypal(State(ecommerce): State<EcommerceHttp>, headers: HeaderMap, body: Bytes) -> Response {
ecommerce.paypal_webhook(&headers, &body).await
}