Files
member-console/internal/workflows/billing/sweep_workflow.go
T
cgalo5758 88db730fcc Add dual licensing and SPDX headers
Introduce a commercial license option alongside AGPL-3.0-only, require a
CLA for contributors, and document the terms in COMMERCIAL.md and
NOTICE. Add a script to stamp SPDX headers on Go files and apply it
across the tree.
2026-09-06 02:29:42 -05:00

29 lines
1.1 KiB
Go

// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
// SPDX-FileCopyrightText: 2025-2026 Christian Galo
package billing
import (
"git.coopcloud.tech/wiki-cafe/member-console/internal/workflows/common"
"go.temporal.io/sdk/workflow"
)
// SweepScheduledChangesWorkflow fires due subscription scheduled changes. It runs
// on a recurring schedule as the backstop to the webhook-primary firing path:
// a period-end cancellation normally fires via Stripe's customer.subscription
// .deleted webhook, but the sweep catches missed webhooks and term-boundary
// ('block'-deferred) changes that Stripe does not fire on its own.
func SweepScheduledChangesWorkflow(ctx workflow.Context) error {
logger := workflow.GetLogger(ctx)
ctx = workflow.WithActivityOptions(ctx, common.DefaultActivityOptions())
var activities *Activities
var out SweepScheduledChangesOutput
if err := workflow.ExecuteActivity(ctx, activities.SweepScheduledChangesActivity).Get(ctx, &out); err != nil {
logger.Error("SweepScheduledChangesActivity failed", "error", err)
return err
}
logger.Info("SweepScheduledChangesWorkflow completed", "fired", out.Fired)
return nil
}