service/library/payclients/wxpaycli/client.go

25 lines
534 B
Go
Raw Normal View History

2023-12-21 22:17:40 +08:00
package wxpaycli
import (
wxpay "github.com/go-pay/gopay/wechat/v3"
"service/bizcommon/util"
"service/library/configcenter"
"service/library/logger"
)
type WxpayClient struct {
*wxpay.ClientV3
}
func NewWxpayClient(cfg *configcenter.WxpayClientConfig) (cli *WxpayClient, err error) {
wxPayCli, err := wxpay.NewClientV3(cfg.MchId, cfg.SerialNo, cfg.ApiV3Key, cfg.PrivateKey)
if err != nil {
logger.Error("NewClientV3 fail, cfg: %v, err: %v", util.ToJson(cfg), err)
return
}
cli = &WxpayClient{
wxPayCli,
}
return
}