Validate (billing/stdinvoicestate.go)

openmeter · openmeter/billing/stdinvoicestate.go · go · Apache-2.0
payments

Defines invoice state triggers and validates operations, used in billing state machine.

// Source: https://github.com/openmeterio/openmeter | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
package billing

import (
	"fmt"
	"slices"

	"github.com/qmuntal/stateless"
)

type InvoiceTrigger = stateless.Trigger

var (
	// TriggerRetry is used to retry a state transition that failed, used by the end user to invoke it manually
	TriggerRetry InvoiceTrigger = "trigger_retry"
	// TriggerApprove is used to approve a state manually
	TriggerApprove InvoiceTrigger = "trigger_approve"
	// TriggerNext is used to advance the invoice to the next state if automatically possible
	TriggerNext InvoiceTrigger = "trigger_next"
	// TriggerFailed is used to trigger the failure state transition

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key