feat: complete wechat pay
This commit is contained in:
@@ -48,10 +48,12 @@ type Config struct {
|
||||
}
|
||||
|
||||
type Pay struct {
|
||||
MchID string
|
||||
SerialNo string
|
||||
MechName string
|
||||
NotifyURL string
|
||||
ApiV3Key string
|
||||
PrivateKey string
|
||||
MchID string
|
||||
SerialNo string
|
||||
MechName string
|
||||
NotifyURL string
|
||||
ApiV3Key string
|
||||
PrivateKey string
|
||||
PublicKeyID string
|
||||
PublicKey string
|
||||
}
|
||||
|
||||
@@ -4,13 +4,13 @@ import (
|
||||
"context"
|
||||
"crypto/rsa"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"time"
|
||||
|
||||
w "quyun/providers/wechat"
|
||||
|
||||
"github.com/go-pay/gopay"
|
||||
"github.com/go-pay/gopay/wechat/v3"
|
||||
"github.com/pkg/errors"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"go.ipao.vip/atom/container"
|
||||
"go.ipao.vip/atom/opt"
|
||||
@@ -40,6 +40,11 @@ func Provide(opts ...opt.Option) error {
|
||||
client.DebugSwitch = gopay.DebugOn
|
||||
}
|
||||
|
||||
err = client.AutoVerifySignByPublicKey([]byte(wechatConfig.Pay.PublicKey), wechatConfig.Pay.PublicKeyID)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "AutoVerifySignByPublicKey")
|
||||
}
|
||||
|
||||
return &Client{
|
||||
payClient: client,
|
||||
config: wechatConfig,
|
||||
|
||||
Reference in New Issue
Block a user