feat: add private key
This commit is contained in:
47
backend/providers/wechat/config.go
Normal file
47
backend/providers/wechat/config.go
Normal file
@@ -0,0 +1,47 @@
|
||||
package wechat
|
||||
|
||||
import (
|
||||
"go.ipao.vip/atom/container"
|
||||
"go.ipao.vip/atom/opt"
|
||||
)
|
||||
|
||||
func Provide(opts ...opt.Option) error {
|
||||
o := opt.New(opts...)
|
||||
var config Config
|
||||
if err := o.UnmarshalConfig(&config); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return container.Container.Provide(func() (*Config, error) {
|
||||
return &config, nil
|
||||
}, o.DiOptions()...)
|
||||
}
|
||||
|
||||
const DefaultPrefix = "WeChat"
|
||||
|
||||
func DefaultProvider() container.ProviderContainer {
|
||||
return container.ProviderContainer{
|
||||
Provider: Provide,
|
||||
Options: []opt.Option{
|
||||
opt.Prefix(DefaultPrefix),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
type Config struct {
|
||||
AppID string
|
||||
AppSecret string
|
||||
Token string
|
||||
EncodingAESKey string
|
||||
DevMode bool
|
||||
Pay *Pay
|
||||
}
|
||||
|
||||
type Pay struct {
|
||||
MchID string
|
||||
SerialNo string
|
||||
MechName string
|
||||
NotifyURL string
|
||||
ApiV3Key string
|
||||
PrivateKey string
|
||||
}
|
||||
Reference in New Issue
Block a user