package order import ( "hfb_sys/backend/internal/modules/chat" "gorm.io/gorm" ) // RefundFunc 由 payment 模块注入,避免 order 与 payment 形成循环依赖。 type RefundFunc func(orderID uint64, refundAmountCent int64, bizType string, remark string) (status string, err error) type refundAction struct { OrderID uint64 RefundAmountCent int64 BizType string Remark string } type Repository struct { db *gorm.DB chatRepo *chat.Repository refundFunc RefundFunc } const defaultPendingPaymentTimeoutMinutes = 15 func NewRepository(db *gorm.DB) *Repository { return &Repository{db: db} } func (r *Repository) SetChatRepo(cr *chat.Repository) { r.chatRepo = cr } func (r *Repository) SetRefundFunc(fn RefundFunc) { r.refundFunc = fn }