Fix missing edge case where team is paid but needs to be updated (#7988)
parent
5fceee27fe
commit
6e856b3bd1
|
@ -23,7 +23,7 @@ export const checkIfTeamPaymentRequired = async ({ teamId = -1 }) => {
|
||||||
if (!metadata?.paymentId) return { url: null };
|
if (!metadata?.paymentId) return { url: null };
|
||||||
const checkoutSession = await stripe.checkout.sessions.retrieve(metadata.paymentId);
|
const checkoutSession = await stripe.checkout.sessions.retrieve(metadata.paymentId);
|
||||||
/** If there's a pending session but it isn't paid, we need to pay this team */
|
/** If there's a pending session but it isn't paid, we need to pay this team */
|
||||||
if (checkoutSession.payment_status === "paid") return { url: null };
|
if (checkoutSession.payment_status !== "paid") return { url: null };
|
||||||
/** If the session is already paid we return the upgrade URL so team is updated. */
|
/** If the session is already paid we return the upgrade URL so team is updated. */
|
||||||
return { url: `${WEBAPP_URL}/api/teams/${teamId}/upgrade?session_id=${metadata.paymentId}` };
|
return { url: `${WEBAPP_URL}/api/teams/${teamId}/upgrade?session_id=${metadata.paymentId}` };
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue