fix: Skip already completed org onboarding, as webhook request can come when invoice is paid again next month (#20984)

* there is nothing to do for repeat invoice payment

* there is nothing to do for repeat invoice payment
This commit is contained in:
Hariom Balhara
2025-04-28 18:36:14 +05:30
committed by GitHub
parent 1d8bc6ca49
commit 26051833cf
@@ -78,6 +78,16 @@ const handler = async (data: SWHMap["invoice.paid"]["data"]) => {
stripeSubscriptionId: organizationOnboarding.stripeSubscriptionId,
})
);
if (organizationOnboarding.isComplete) {
// If the organization is already complete, there is nothing to do
// Repeat requests can come for recurring payments
return {
success: true,
message: "Onboarding already completed, skipping",
};
}
const { organization } = await createOrganizationFromOnboarding({
organizationOnboarding,
paymentSubscriptionId,