flamingo.me/flamingo-commerce/v3@v3.11.0/checkout/domain/placeorder/states/new.go (about) 1 package states 2 3 import ( 4 "context" 5 6 "flamingo.me/flamingo-commerce/v3/checkout/domain/placeorder/process" 7 "go.opencensus.io/trace" 8 ) 9 10 type ( 11 // New state 12 New struct { 13 } 14 ) 15 16 var _ process.State = New{} 17 18 // Name get state name 19 func (New) Name() string { 20 return "New" 21 } 22 23 // Run the state operations 24 func (n New) Run(ctx context.Context, p *process.Process) process.RunResult { 25 _, span := trace.StartSpan(ctx, "placeorder/state/New/Run") 26 defer span.End() 27 28 p.UpdateState(PrepareCart{}.Name(), nil) 29 30 return process.RunResult{} 31 } 32 33 // Rollback the state operations 34 func (n New) Rollback(ctx context.Context, _ process.RollbackData) error { 35 return nil 36 } 37 38 // IsFinal if state is a final state 39 func (n New) IsFinal() bool { 40 return false 41 }