Files
pay/internal/model/merchant.go
T
wangjia 6da6964451 初始提交:岩美 pay 收款服务(支付宝当面付 + 多商户多渠道架构)
- Go/Gin/GORM + 纯 Go SQLite(无 cgo)
- Channel 多渠道接口:支付宝当面付(precreate)/电脑网站支付(page.pay) 已实现,微信占位
- 多商户 merchants 表,回调验签+金额核对+幂等+查单兜底
- 收款页/结果页/二维码端点;docs/ 设计文档与部署 Runbook
- 密钥走环境变量/Bitwarden,不入库

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-25 07:21:48 +08:00

25 lines
1.2 KiB
Go

package model
// Merchant 一个「业务 × 渠道」的收款凭证。
// 多业务、多支付宝账户、以后加微信,都是往这张表加行 —— 主流程不变。
type Merchant struct {
Base
Code string `gorm:"uniqueIndex;size:64" json:"code"` // 业务标识:yanmei / jiu ...
Name string `gorm:"size:128" json:"name"` // 展示名
Channel string `gorm:"index;size:16" json:"channel"` // alipay | wechat
Production bool `json:"production"` // false=沙箱
Enabled bool `gorm:"default:true" json:"enabled"`
// —— 支付宝 ——(app_id 用于异步回调反查商户)
AppID string `gorm:"index;size:64" json:"app_id"`
AppPrivateKey string `gorm:"type:text" json:"-"` // 应用私钥,绝不下发
AlipayPublicKey string `gorm:"type:text" json:"-"` // 支付宝公钥(验签用)
// —— 微信 ——(预留,渠道尚未实现)
MchID string `gorm:"size:64" json:"mch_id,omitempty"`
WxAppID string `gorm:"size:64" json:"wx_app_id,omitempty"`
APIv3Key string `gorm:"type:text" json:"-"`
CertSerial string `gorm:"size:128" json:"-"`
WxPrivateKey string `gorm:"type:text" json:"-"`
}