package payment import ( "cls/internal/domain/payment" "time" ) // PaymentResponse 支付订单响应 type PaymentResponse struct { ID uint64 `json:"id"` // 支付ID OrderNo string `json:"orderNo"` // 订单编号 TransactionID string `json:"transactionId"` // 第三方交易号 UserID uint64 `json:"userId"` // 用户ID TargetID uint64 `json:"targetId"` // 商品ID Type payment.PaymentType `json:"type"` // 支付类型 Amount int64 `json:"amount"` // 支付金额 Status payment.PaymentStatus `json:"status"` // 支付状态 Description string `json:"description"` // 支付描述 NotifyData string `json:"notifyData"` // 支付回调数据 CreatedAt time.Time `json:"createdAt"` // 创建时间 UpdatedAt time.Time `json:"updatedAt"` // 更新时间 } // FromEntity 从实体转换为响应 func FromEntity(e *payment.Payment) *PaymentResponse { return &PaymentResponse{ ID: e.ID, OrderNo: e.OrderNo, TransactionID: e.TransactionID, UserID: e.UserID, TargetID: e.TargetID, Type: e.Type, Amount: e.Amount, Status: e.Status, Description: e.Description, NotifyData: e.NotifyData, CreatedAt: e.CreatedAt, UpdatedAt: e.UpdatedAt, } }