service/library/payclients/wxpaycli/client.go

25 lines
534 B
Go

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
}