This commit is contained in:
2023-12-20 15:25:52 +08:00
parent c5ad64c474
commit 6c6e99bcee
3 changed files with 57 additions and 20 deletions
+10 -3
View File
@@ -23,13 +23,20 @@ type RefundRequest struct {
// Refund 退款
func (r RefundRequest) Refund(orderType int) (*refunddomestic.Refund, error) {
mchId := ""
mchCertificateSerialNumber := ""
v3ApiSecret := ""
if orderType == 1 {
// 问诊
mchId = "1659662936"
mchId = config.C.Wechat.Pay1659662936.MchId
mchCertificateSerialNumber = config.C.Wechat.Pay1659662936.MchCertificateSerialNumber
v3ApiSecret = config.C.Wechat.Pay1659662936.V3ApiSecret
} else if orderType == 2 || orderType == 3 {
// 药品/检测
mchId = "1636644248"
mchId = config.C.Wechat.Pay1636644248.MchId
mchCertificateSerialNumber = config.C.Wechat.Pay1636644248.MchCertificateSerialNumber
v3ApiSecret = config.C.Wechat.Pay1636644248.V3ApiSecret
}
if mchId == "" {
@@ -49,7 +56,7 @@ func (r RefundRequest) Refund(orderType int) (*refunddomestic.Refund, error) {
ctx := context.Background()
// 使用商户私钥等初始化 client,并使它具有自动定时获取微信支付平台证书的能力
opts := []core.ClientOption{
option.WithWechatPayAutoAuthCipher(config.C.Wechat.MchId, config.C.Wechat.MchCertificateSerialNumber, mchPrivateKey, config.C.Wechat.V3ApiSecret),
option.WithWechatPayAutoAuthCipher(mchId, mchCertificateSerialNumber, mchPrivateKey, v3ApiSecret),
}
client, err := core.NewClient(ctx, opts...)