Documentation
¶
Overview ¶
Package order hosts the queue shell of the paid-order activation saga. The domain stages live behind the module facades — identity guest-account glue and notification dispatch stay here as orchestration concerns (ADR-001 step 6 preparation):
guest account (identity tx + order bind) -> subscription.FulfillPaidOrder -> billing.SettleOrderCommission -> billing.FinalizeOrder -> notify
Index ¶
Constants ¶
const ( OrderTypeSubscribe = 1 OrderTypeRenewal = 2 OrderTypeResetTraffic = 3 OrderTypeRecharge = 4 OrderStatusPending = 1 OrderStatusPaid = 2 OrderStatusClose = 3 OrderStatusFailed = 4 OrderStatusFinished = 5 )
Order type and status constants for the shell's dispatch decisions.
Variables ¶
var ( ErrInvalidOrderStatus = fmt.Errorf("invalid order status") ErrInvalidOrderType = fmt.Errorf("invalid order type") )
Functions ¶
This section is empty.
Types ¶
type ActivateOrderLogic ¶
type ActivateOrderLogic struct {
// contains filtered or unexported fields
}
ActivateOrderLogic sequences the activation saga stages.
func NewActivateOrderLogic ¶
func NewActivateOrderLogic(deps Dependencies) *ActivateOrderLogic
func (*ActivateOrderLogic) ProcessTask ¶
type CleanupOrderEventsLogic ¶ added in v1.14.19
type CleanupOrderEventsLogic struct {
// contains filtered or unexported fields
}
CleanupOrderEventsLogic removes only events that have already reached Redis and are older than the replay contract. Unpublished events are never deleted, even if an outage lasts longer than the normal retention period.
func NewCleanupOrderEventsLogic ¶ added in v1.14.19
func NewCleanupOrderEventsLogic(deps Dependencies) *CleanupOrderEventsLogic
func (*CleanupOrderEventsLogic) ProcessTask ¶ added in v1.14.19
type DailyOrderReportLogic ¶ added in v1.15.16
type DailyOrderReportLogic struct {
// contains filtered or unexported fields
}
DailyOrderReportLogic posts the previous day's settlement summary into the admin group's notification topic. It reports yesterday because it runs after midnight, when the day it summarises is complete.
func NewDailyOrderReportLogic ¶ added in v1.15.16
func NewDailyOrderReportLogic(deps Dependencies) *DailyOrderReportLogic
func (*DailyOrderReportLogic) ProcessTask ¶ added in v1.15.16
type DeferCloseOrderLogic ¶
type DeferCloseOrderLogic struct {
// contains filtered or unexported fields
}
func NewDeferCloseOrderLogic ¶
func NewDeferCloseOrderLogic(deps Dependencies) *DeferCloseOrderLogic
func (*DeferCloseOrderLogic) ProcessTask ¶
type Dependencies ¶ added in v1.19.0
type PublishOrderEventsLogic ¶ added in v1.14.19
type PublishOrderEventsLogic struct {
// contains filtered or unexported fields
}
PublishOrderEventsLogic drains the durable order event outbox. Publishing is intentionally separate from writing the event: a Redis outage may delay a notification but can never roll back a committed payment state.
func NewPublishOrderEventsLogic ¶ added in v1.14.19
func NewPublishOrderEventsLogic(deps Dependencies) *PublishOrderEventsLogic
func (*PublishOrderEventsLogic) ProcessTask ¶ added in v1.14.19
type ReconcilePaidOrdersLogic ¶ added in v1.14.0
type ReconcilePaidOrdersLogic struct {
// contains filtered or unexported fields
}
ReconcilePaidOrdersLogic treats the durable Paid state as an activation outbox. It repairs the database/Redis gap if a callback committed payment but Redis was unavailable before the activation task could be inserted.
func NewReconcilePaidOrdersLogic ¶ added in v1.14.0
func NewReconcilePaidOrdersLogic(deps Dependencies) *ReconcilePaidOrdersLogic
func (*ReconcilePaidOrdersLogic) ProcessTask ¶ added in v1.14.0
type ReconcilePendingOrdersLogic ¶ added in v1.14.16
type ReconcilePendingOrdersLogic struct {
// contains filtered or unexported fields
}
ReconcilePendingOrdersLogic is a durable fallback for deferred close tasks. State transitions in CloseOrder remain conditional, so a late callback can safely race this scan without turning a paid order back into a close order.
func NewReconcilePendingOrdersLogic ¶ added in v1.14.16
func NewReconcilePendingOrdersLogic(deps Dependencies) *ReconcilePendingOrdersLogic