fix: rate limiting
fix: wait longer for invoice
This commit is contained in:
parent
797231946a
commit
aca1a8236c
4 changed files with 21 additions and 5 deletions
|
@ -70,8 +70,8 @@ pub async fn stripe_webhook(
|
|||
|
||||
let customer_id = invoice.customer.unwrap().id();
|
||||
|
||||
// allow 10s for everything to finalize
|
||||
tokio::time::sleep(Duration::from_secs(10)).await;
|
||||
// allow 30s for everything to finalize
|
||||
tokio::time::sleep(Duration::from_secs(30)).await;
|
||||
|
||||
// pull user and update role
|
||||
let user = match data.get_user_by_stripe_id(customer_id.as_str()).await {
|
||||
|
@ -79,6 +79,14 @@ pub async fn stripe_webhook(
|
|||
Err(e) => return Json(e.into()),
|
||||
};
|
||||
|
||||
if user.permissions.check(FinePermission::SUPPORTER) {
|
||||
return Json(ApiReturn {
|
||||
ok: true,
|
||||
message: "Already applied".to_string(),
|
||||
payload: (),
|
||||
});
|
||||
}
|
||||
|
||||
tracing::info!("invoice {} (stripe: {})", user.id, customer_id);
|
||||
let new_user_permissions = user.permissions | FinePermission::SUPPORTER;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue