You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
1.5 KiB
Go
41 lines
1.5 KiB
Go
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,
|
|
}
|
|
}
|