feat: order action per status change
This commit is contained in:
21
app/actions/orderStatusActions/pending.go
Normal file
21
app/actions/orderStatusActions/pending.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package orderStatusActions
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"git.ma-al.com/goc_daniel/b2b/app/model/enums"
|
||||
)
|
||||
|
||||
func init() {
|
||||
var sendNewOrderEmail = WithID("send_new_order_email", func(actionCtx ActionContext) ActionResult {
|
||||
|
||||
if actionCtx.EmailService == nil {
|
||||
return ActionResult{Err: fmt.Errorf("emailService not provided")}
|
||||
}
|
||||
return ActionResult{Err: actionCtx.EmailService.SendNewOrderPlacedNotification(*actionCtx.UserId)}
|
||||
})
|
||||
|
||||
GlobalRegistry.Register(enums.OrderStatusPending, ActionChain{
|
||||
sendNewOrderEmail,
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user