新增收款商户、商户池轮询、微信授权配置独立管理;三类新支付 (C端套餐购买、C端资产钱包充值、代理在线预存款充值)无条件 经商户池选择并冻结路由,无旧综合配置回退。merchant_id 为空 历史支付继续按 payment_config_id 双读。凭证版本化加载与 ID+版本缓存保证轮换一致性。删除商户池新支付创建开关及全部 引用。
This commit is contained in:
124
internal/model/dto/payment_merchant_dto.go
Normal file
124
internal/model/dto/payment_merchant_dto.go
Normal file
@@ -0,0 +1,124 @@
|
||||
package dto
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/break/junhong_cmp_fiber/internal/model"
|
||||
)
|
||||
|
||||
// PaymentMerchantRequest 是受控商户管理写入请求。
|
||||
type PaymentMerchantRequest struct {
|
||||
Name string `json:"name" validate:"required,min=1,max=100" description:"商户名称"`
|
||||
PaymentMethod string `json:"payment_method" validate:"required,oneof=wechat alipay" enum:"wechat,alipay" description:"支付方式:wechat=微信支付,alipay=支付宝支付"`
|
||||
ProviderType string `json:"provider_type" validate:"required,max=30" description:"服务商类型:微信仅支持 wechat、wechat_v2、fuiou;支付宝为 alipay"`
|
||||
MerchantIdentity string `json:"merchant_identity" validate:"required,max=100" description:"商户号或应用标识"`
|
||||
Credentials model.JSONB `json:"credentials" description:"商户受控凭证,仅专用管理接口传输"`
|
||||
Enabled bool `json:"enabled" description:"是否启用"`
|
||||
Remark string `json:"remark" validate:"max=1000" description:"备注"`
|
||||
}
|
||||
|
||||
// PaymentMerchantUpdateRequest 是受控商户管理更新请求。
|
||||
type PaymentMerchantUpdateRequest struct {
|
||||
Name *string `json:"name" description:"商户名称"`
|
||||
PaymentMethod *string `json:"payment_method" enum:"wechat,alipay" description:"支付方式:wechat=微信支付,alipay=支付宝支付"`
|
||||
ProviderType *string `json:"provider_type" description:"服务商类型:微信仅支持 wechat、wechat_v2、fuiou;支付宝为 alipay"`
|
||||
MerchantIdentity *string `json:"merchant_identity" description:"商户号或应用标识"`
|
||||
Credentials *model.JSONB `json:"credentials" description:"商户受控凭证"`
|
||||
Enabled *bool `json:"enabled" description:"是否启用"`
|
||||
Remark *string `json:"remark" description:"备注"`
|
||||
}
|
||||
|
||||
// PaymentMerchantDeleteRequest 是受控商户删除二次确认请求。
|
||||
type PaymentMerchantDeleteRequest struct {
|
||||
Confirm bool `json:"confirm" validate:"required" description:"确认删除,必须为true"`
|
||||
}
|
||||
|
||||
// PaymentMerchantListRequest 是支付商户分页查询条件。
|
||||
type PaymentMerchantListRequest struct {
|
||||
Page int `query:"page" description:"页码"`
|
||||
PageSize int `query:"page_size" description:"每页数量"`
|
||||
PaymentMethod *string `query:"payment_method" enum:"wechat,alipay" description:"支付方式:wechat=微信支付,alipay=支付宝支付"`
|
||||
Enabled *bool `query:"enabled" description:"是否启用"`
|
||||
}
|
||||
|
||||
// PaymentMerchantResponse 是受控商户管理响应。
|
||||
type PaymentMerchantResponse struct {
|
||||
ID uint `json:"id" description:"商户ID"`
|
||||
Name string `json:"name" description:"商户名称"`
|
||||
PaymentMethod string `json:"payment_method" enum:"wechat,alipay" description:"支付方式:wechat=微信支付,alipay=支付宝支付"`
|
||||
ProviderType string `json:"provider_type" description:"服务商类型"`
|
||||
MerchantIdentity string `json:"merchant_identity" description:"商户号或应用标识"`
|
||||
Credentials model.JSONB `json:"credentials" description:"商户受控凭证,仅专用管理接口返回"`
|
||||
CredentialVersion int64 `json:"credential_version" description:"凭证版本"`
|
||||
Enabled bool `json:"enabled" description:"是否启用"`
|
||||
Remark string `json:"remark" description:"备注"`
|
||||
CreatedAt time.Time `json:"created_at" description:"创建时间"`
|
||||
UpdatedAt time.Time `json:"updated_at" description:"更新时间"`
|
||||
}
|
||||
|
||||
// PaymentMerchantPoolRequest 是商户池创建或更新请求。
|
||||
type PaymentMerchantPoolRequest struct {
|
||||
Name string `json:"name" validate:"required,min=1,max=100" description:"商户池名称"`
|
||||
PaymentMethod string `json:"payment_method" validate:"required,oneof=wechat alipay" enum:"wechat,alipay" description:"支付方式:wechat=微信支付,alipay=支付宝支付"`
|
||||
Enabled bool `json:"enabled" description:"是否启用"`
|
||||
Strategy string `json:"strategy" validate:"required,oneof=amount count time" enum:"amount,count,time" description:"轮询策略:amount=金额阈值,count=笔数阈值,time=按时间段轮换"`
|
||||
ThresholdAmount *int64 `json:"threshold_amount" description:"金额轮询阈值,单位分;仅 amount 策略"`
|
||||
ThresholdCount *int64 `json:"threshold_count" description:"笔数轮询阈值;仅 count 策略"`
|
||||
StatisticCycle *string `json:"statistic_cycle" enum:"round,day,month" description:"金额/笔数统计周期:round=每轮,day=自然日,month=自然月"`
|
||||
TimePeriodValue *int64 `json:"time_period_value" description:"时间轮询周期数值;仅 time 策略,最小 1"`
|
||||
TimePeriodUnit *string `json:"time_period_unit" enum:"minute,hour,day" description:"时间轮询单位:minute=分钟,hour=小时,day=天"`
|
||||
TimePeriodStartedAt *time.Time `json:"time_period_started_at" description:"时间轮询起始时间;仅 time 策略"`
|
||||
MemberIDs []uint `json:"member_ids" validate:"required,min=1" description:"有序商户ID列表"`
|
||||
Remark string `json:"remark" description:"备注"`
|
||||
}
|
||||
|
||||
// PaymentMerchantPoolListRequest 是商户池分页查询条件。
|
||||
type PaymentMerchantPoolListRequest struct {
|
||||
Page int `query:"page" description:"页码"`
|
||||
PageSize int `query:"page_size" description:"每页数量"`
|
||||
}
|
||||
|
||||
// PaymentMerchantPoolResponse 是商户池管理响应。
|
||||
type PaymentMerchantPoolResponse struct {
|
||||
ID uint `json:"id" description:"商户池ID"`
|
||||
Name string `json:"name" description:"商户池名称"`
|
||||
PaymentMethod string `json:"payment_method" enum:"wechat,alipay" description:"支付方式:wechat=微信支付,alipay=支付宝支付"`
|
||||
Enabled bool `json:"enabled" description:"是否启用"`
|
||||
Strategy string `json:"strategy" enum:"amount,count,time" description:"轮询策略:amount=金额阈值,count=笔数阈值,time=按时间段轮换"`
|
||||
ThresholdAmount *int64 `json:"threshold_amount,omitempty" description:"金额阈值,分"`
|
||||
ThresholdCount *int64 `json:"threshold_count,omitempty" description:"笔数阈值"`
|
||||
StatisticCycle *string `json:"statistic_cycle,omitempty" enum:"round,day,month" description:"统计周期:round=每轮,day=自然日,month=自然月"`
|
||||
TimePeriodValue *int64 `json:"time_period_value,omitempty" description:"时间周期数值"`
|
||||
TimePeriodUnit *string `json:"time_period_unit,omitempty" enum:"minute,hour,day" description:"时间单位:minute=分钟,hour=小时,day=天"`
|
||||
TimePeriodStartedAt *time.Time `json:"time_period_started_at,omitempty" description:"时间轮询起始时间"`
|
||||
RoutingEpoch int64 `json:"routing_epoch" description:"当前路由统计世代"`
|
||||
MemberIDs []uint `json:"member_ids" description:"有序商户ID列表"`
|
||||
Remark string `json:"remark" description:"备注"`
|
||||
}
|
||||
|
||||
// WechatAuthorizationRequest 是微信授权配置管理写入请求。
|
||||
type WechatAuthorizationRequest struct {
|
||||
OaAppID string `json:"oa_app_id" description:"公众号AppID"`
|
||||
OaAppSecret string `json:"oa_app_secret" description:"公众号AppSecret"`
|
||||
OaToken string `json:"oa_token" description:"公众号Token"`
|
||||
OaAesKey string `json:"oa_aes_key" description:"公众号AES密钥"`
|
||||
OaOAuthRedirectURL string `json:"oa_oauth_redirect_url" description:"公众号OAuth回调地址"`
|
||||
MiniappAppID string `json:"miniapp_app_id" description:"小程序AppID"`
|
||||
MiniappAppSecret string `json:"miniapp_app_secret" description:"小程序AppSecret"`
|
||||
Enabled bool `json:"enabled" description:"是否启用"`
|
||||
}
|
||||
|
||||
// WechatAuthorizationResponse 是微信授权配置管理响应。
|
||||
type WechatAuthorizationResponse struct {
|
||||
ID uint `json:"id" description:"授权配置ID"`
|
||||
OaAppID string `json:"oa_app_id" description:"公众号AppID"`
|
||||
OaAppSecret string `json:"oa_app_secret" description:"公众号AppSecret,仅专用管理接口返回"`
|
||||
OaToken string `json:"oa_token" description:"公众号Token,仅专用管理接口返回"`
|
||||
OaAesKey string `json:"oa_aes_key" description:"公众号AES密钥,仅专用管理接口返回"`
|
||||
OaOAuthRedirectURL string `json:"oa_oauth_redirect_url" description:"公众号OAuth回调地址"`
|
||||
MiniappAppID string `json:"miniapp_app_id" description:"小程序AppID"`
|
||||
MiniappAppSecret string `json:"miniapp_app_secret" description:"小程序AppSecret,仅专用管理接口返回"`
|
||||
CredentialVersion int64 `json:"credential_version" description:"凭证版本"`
|
||||
Enabled bool `json:"enabled" description:"是否启用"`
|
||||
UpdatedAt time.Time `json:"updated_at" description:"更新时间"`
|
||||
}
|
||||
Reference in New Issue
Block a user