package entity import ( "go.mongodb.org/mongo-driver/bson/primitive" ) // PaymentConfig 支付配置 // 每个租户有独立的支付配置 // 支持微信支付和支付宝支付 type PaymentConfig struct { ID primitive.ObjectID `bson:"_id,omitempty" json:"id"` TenantID string `bson:"tenant_id" json:"tenant_id"` // 租户ID PayMethod string `bson:"pay_method" json:"pay_method"` // 支付方式:wechat/alipay ConfigName string `bson:"config_name" json:"config_name"` // 配置名称 Description string `bson:"description" json:"description"` // 配置描述 Enabled bool `bson:"enabled" json:"enabled"` // 是否启用 // 通用配置 AppID string `bson:"app_id" json:"app_id"` // 应用ID MchID string `bson:"mch_id" json:"mch_id"` // 商户号 APIKey string `bson:"api_key" json:"api_key"` // API密钥 NotifyURL string `bson:"notify_url" json:"notify_url"` // 回调地址 ReturnURL string `bson:"return_url" json:"return_url"` // 返回地址 // 证书配置(微信支付) CertPath string `bson:"cert_path,omitempty" json:"cert_path"` // 证书路径 KeyPath string `bson:"key_path,omitempty" json:"key_path"` // 密钥路径 // 支付宝特有配置 AppPrivateKey string `bson:"app_private_key,omitempty" json:"app_private_key"` // 应用私钥 AlipayPublicKey string `bson:"alipay_public_key,omitempty" json:"alipay_public_key"` // 支付宝公钥 // 环境配置 Sandbox bool `bson:"sandbox" json:"sandbox"` // 是否沙箱环境 GatewayURL string `bson:"gateway_url" json:"gateway_url"` // 网关地址 // 支持的支付类型 SupportNative bool `bson:"support_native" json:"support_native"` // 支持扫码支付 SupportJSAPI bool `bson:"support_jsapi" json:"support_jsapi"` // 支持JSAPI支付 SupportAPP bool `bson:"support_app" json:"support_app"` // 支持APP支付 SupportH5 bool `bson:"support_h5" json:"support_h5"` // 支持H5支付 } // PaymentRecord 支付记录 // 记录每次支付操作的结果 type PaymentRecord struct { ID primitive.ObjectID `bson:"_id,omitempty" json:"id"` TenantID string `bson:"tenant_id" json:"tenant_id"` // 租户ID OrderID primitive.ObjectID `bson:"order_id" json:"order_id"` // 订单ID OrderNo string `bson:"order_no" json:"order_no"` // 订单号 PayMethod string `bson:"pay_method" json:"pay_method"` // 支付方式 PayType string `bson:"pay_type" json:"pay_type"` // 支付类型 Amount int64 `bson:"amount" json:"amount"` // 支付金额(分) TransactionID string `bson:"transaction_id" json:"transaction_id"` // 支付平台交易号 OutTradeNo string `bson:"out_trade_no" json:"out_trade_no"` // 商户订单号 TradeNo string `bson:"trade_no" json:"trade_no"` // 交易号 PrepayID string `bson:"prepay_id,omitempty" json:"prepay_id"` // 预支付ID Status string `bson:"status" json:"status"` // 支付状态:success/failed ErrorMsg string `bson:"error_msg,omitempty" json:"error_msg"` // 错误信息 CreatedAt int64 `bson:"created_at" json:"created_at"` // 创建时间 UpdatedAt int64 `bson:"updated_at" json:"updated_at"` // 更新时间 } // RefundRecord 退款记录 // 记录每次退款操作的结果 type RefundRecord struct { ID primitive.ObjectID `bson:"_id,omitempty" json:"id"` TenantID string `bson:"tenant_id" json:"tenant_id"` // 租户ID OrderID primitive.ObjectID `bson:"order_id" json:"order_id"` // 订单ID OrderNo string `bson:"order_no" json:"order_no"` // 订单号 RefundNo string `bson:"refund_no" json:"refund_no"` // 退款单号 RefundID string `bson:"refund_id" json:"refund_id"` // 退款ID RefundAmount int64 `bson:"refund_amount" json:"refund_amount"` // 退款金额(分) Reason string `bson:"reason" json:"reason"` // 退款原因 Status string `bson:"status" json:"status"` // 退款状态:success/failed ErrorMsg string `bson:"error_msg,omitempty" json:"error_msg"` // 错误信息 CreatedAt int64 `bson:"created_at" json:"created_at"` // 创建时间 UpdatedAt int64 `bson:"updated_at" json:"updated_at"` // 更新时间 }