fix: InvoicePaymentFailed event

This commit is contained in:
trisua 2025-07-13 12:42:28 -04:00
parent ea13526515
commit 2be2409d66

View file

@ -262,12 +262,12 @@ pub async fn stripe_webhook(
}
EventType::InvoicePaymentFailed => {
// payment failed
let subscription = match req.data.object {
EventObject::Subscription(c) => c,
let invoice = match req.data.object {
EventObject::Invoice(i) => i,
_ => unreachable!("cannot be this"),
};
let customer_id = subscription.customer.id();
let customer_id = invoice.customer.expect("TETRATTO_STRIPE_NO_CUSTOMER").id();
let user = match data.get_user_by_stripe_id(customer_id.as_str()).await {
Ok(ua) => ua,