|
|
@ -3,6 +3,7 @@ package pay
|
|
|
|
import (
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"context"
|
|
|
|
"errors"
|
|
|
|
"errors"
|
|
|
|
|
|
|
|
"fmt"
|
|
|
|
"git.oa00.com/go/rsa"
|
|
|
|
"git.oa00.com/go/rsa"
|
|
|
|
"github.com/wechatpay-apiv3/wechatpay-go/core"
|
|
|
|
"github.com/wechatpay-apiv3/wechatpay-go/core"
|
|
|
|
"github.com/wechatpay-apiv3/wechatpay-go/core/auth/verifiers"
|
|
|
|
"github.com/wechatpay-apiv3/wechatpay-go/core/auth/verifiers"
|
|
|
@ -38,7 +39,7 @@ func InitWxpay(config WxpayConfig) error {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// 使用商户私钥等初始化 client,并使它具有自动定时获取微信支付平台证书的能力
|
|
|
|
// 使用商户私钥等初始化 client,并使它具有自动定时获取微信支付平台证书的能力
|
|
|
|
opts := []core.ClientOption{
|
|
|
|
opts := []core.ClientOption{
|
|
|
|
option.WithWechatPayAutoAuthCipher(config.MchID, certificate.SerialNumber.String(), privateKey, config.MchAPIv3Key),
|
|
|
|
option.WithWechatPayAutoAuthCipher(config.MchID, fmt.Sprintf("%x", certificate.SerialNumber), privateKey, config.MchAPIv3Key),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Wxpay.Client, err = core.NewClient(context.Background(), opts...)
|
|
|
|
Wxpay.Client, err = core.NewClient(context.Background(), opts...)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|