{{#stripe}}use crate::registrations::AppState;
use axum::{
body::Bytes,
extract::{Path, State},
http::HeaderMap,
response::Response,
routing::any,
};
use forklaunch_billing_stripe::http::{BillingHttp, Handler};
pub fn handle_webhook_event(state: &AppState) -> Handler {
any(stripe).with_state(state.billing.clone())
}
async fn stripe(State(billing): State<BillingHttp>, headers: HeaderMap, body: Bytes) -> Response {
billing.stripe_webhook(headers, body).await
}
pub fn receive_platform_event(state: &AppState) -> Handler {
any(platform).with_state(state.billing.clone())
}
async fn platform(
State(billing): State<BillingHttp>,
Path(feature): Path<String>,
headers: HeaderMap,
body: Bytes,
) -> Response {
billing.platform_event(feature, headers, body).await
}
{{/stripe}}