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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user