engineadapter

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 13, 2026 License: AGPL-3.0, AGPL-3.0-or-later Imports: 22 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	BillingCapabilityName     contract.CapabilityName = "billing.invoice"
	BillingCreateOperation    string                  = "create_obligation@1"
	BillingReconcileOperation string                  = "reconcile_obligation@1"
)
View Source
const (
	BillingStateAccepted = "accepted"
	BillingStateIssued   = "issued"
	BillingStatePending  = "pending"
	BillingStateUnknown  = "unknown"
	BillingStateNotFound = "not_found"
)
View Source
const JobType scheduler.JobType = "subscription_invoice"

Variables

This section is empty.

Functions

func BillingCapabilityLeaseID

func BillingCapabilityLeaseID(scope contract.BusinessScope, binding plugin.ResolvedBinding, operation string) (string, error)

BillingCapabilityLeaseID returns the stable ID used to provision the scheduler grant through the tenant's existing capability lease store.

func ScheduledJobHandlers

func ScheduledJobHandlers(runtime engine.TenantJobRuntime) map[scheduler.JobType]scheduler.JobHandler

ScheduledJobHandlers registers the job for the subscription package while leaving billing capability availability to the application composition.

func ScheduledJobHandlersWithBilling

func ScheduledJobHandlersWithBilling(runtime engine.TenantJobRuntime, provider BillingProvider) map[scheduler.JobType]scheduler.JobHandler

func ScheduledJobHandlersWithModuleBilling

func ScheduledJobHandlersWithModuleBilling(runtime engine.TenantJobRuntime) map[scheduler.JobType]scheduler.JobHandler

ScheduledJobHandlersWithModuleBilling adapts the tenant's selected provider binding into the subscription billing port for this scheduler generation.

Types

type BillingLine

type BillingLine struct {
	Description string `json:"description"`
	Quantity    string `json:"quantityDecimal"`
	UnitPrice   string `json:"unitPriceDecimal"`
}

type BillingObligation

type BillingObligation struct {
	Source         contract.BusinessRef `json:"source"`
	BillingPeriod  BillingPeriod        `json:"billingPeriod"`
	Customer       contract.BusinessRef `json:"customer"`
	Currency       string               `json:"currency"`
	Lines          []BillingLine        `json:"lines"`
	IdempotencyKey string               `json:"idempotencyKey"`
}

func (BillingObligation) Validate

func (o BillingObligation) Validate() error

type BillingOwnerCommands

type BillingOwnerCommands interface {
	CreateObligation(context.Context, policy.Execution, contract.ScopeContext, BillingObligation) (BillingResult, error)
	ReconcileObligation(context.Context, policy.Execution, contract.ScopeContext, string) (BillingResult, error)
}

BillingOwnerCommands is the owner module's command boundary for internal billing. The adapter carries no invoice tables or accounting rules; owner commands must enforce durable uniqueness on the tenant-scoped idempotency key and expose authoritative reconciliation for that key.

type BillingPeriod

type BillingPeriod struct {
	Start string `json:"start"`
	End   string `json:"end"`
}

type BillingProvider

type BillingProvider interface {
	// CreateObligation must durably deduplicate by obligation.IdempotencyKey.
	// Repeating the same key must return the same obligation identity and must
	// never create a second business effect.
	CreateObligation(context.Context, policy.Execution, contract.ScopeContext, BillingObligation) (BillingResult, error)
	// ReconcileObligation may return not_found only when no effect for key can
	// still commit. pending/unknown must remain unresolved until authoritative.
	ReconcileObligation(context.Context, policy.Execution, contract.ScopeContext, string) (BillingResult, error)
}

type BillingResult

type BillingResult struct {
	Obligation        contract.BusinessRef `json:"obligation"`
	State             string               `json:"state"`
	ExternalReference string               `json:"externalReference,omitempty"`
}

type CapabilityBillingAdapter

type CapabilityBillingAdapter struct {
	Plan       plugin.BindingPlan
	Caller     contract.ModuleID
	Scope      contract.BusinessScope
	LeaseStore plugin.CapabilityLeaseReader
	Create     contract.CapabilityLease
	Reconcile  contract.CapabilityLease
}

CapabilityBillingAdapter invokes the provider selected in the tenant's immutable module BindingPlan. Its durable leases fence each effect attempt.

func NewCapabilityBillingAdapter

func NewCapabilityBillingAdapter(runtime engine.TenantJobRuntime) (*CapabilityBillingAdapter, error)

func (*CapabilityBillingAdapter) CreateObligation

func (a *CapabilityBillingAdapter) CreateObligation(ctx context.Context, execution policy.Execution, scope contract.ScopeContext, obligation BillingObligation) (BillingResult, error)

func (*CapabilityBillingAdapter) ReconcileObligation

func (a *CapabilityBillingAdapter) ReconcileObligation(ctx context.Context, execution policy.Execution, scope contract.ScopeContext, key string) (BillingResult, error)

type InternalBillingAdapter

type InternalBillingAdapter struct{ Commands BillingOwnerCommands }

func (InternalBillingAdapter) CreateObligation

func (a InternalBillingAdapter) CreateObligation(ctx context.Context, execution policy.Execution, scope contract.ScopeContext, obligation BillingObligation) (BillingResult, error)

func (InternalBillingAdapter) ReconcileObligation

func (a InternalBillingAdapter) ReconcileObligation(ctx context.Context, execution policy.Execution, scope contract.ScopeContext, key string) (BillingResult, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL