Commit 7f2c922b by yemin

no message

parent e1b52624
...@@ -43,24 +43,23 @@ func (s *WechatPartnerPayClient) WxJsApiOrder(p *PaymentJsApiParam) *PaymentJsAp ...@@ -43,24 +43,23 @@ func (s *WechatPartnerPayClient) WxJsApiOrder(p *PaymentJsApiParam) *PaymentJsAp
if !b { if !b {
panic(errors.New("金额错误请检查,请检查")) panic(errors.New("金额错误请检查,请检查"))
} }
resp, _, err := svc.Prepay(context.Background(), pr := jsapi.PrepayRequest{
jsapi.PrepayRequest{ SpAppid: s.AppId,
SpAppid: s.AppId, SpMchid: s.SpMchId,
SpMchid: s.SpMchId, SubMchid: s.MchId,
SubMchid: s.MchId, Description: p.Title,
Description: p.Title, OutTradeNo: p.OutTradeNo,
OutTradeNo: p.OutTradeNo, NotifyUrl: p.CallBackUrl,
NotifyUrl: p.CallBackUrl, TimeExpire: core.Time(getTimeExpire(p.TimeExpire)),
TimeExpire: core.Time(getTimeExpire(p.TimeExpire)), Amount: &jsapi.Amount{
Amount: &jsapi.Amount{ Total: core.Int64(money.Int64()),
Total: core.Int64(money.Int64()),
},
Payer: &jsapi.Payer{
SpOpenid: p.OpenId,
},
Attach: p.Attach,
}, },
) Payer: &jsapi.Payer{
SpOpenid: p.OpenId,
},
Attach: p.Attach,
}
resp, _, err := svc.Prepay(context.Background(), pr)
if err != nil { if err != nil {
panic(errors.New(getErrMessage(err.Error()))) panic(errors.New(getErrMessage(err.Error())))
} }
...@@ -85,7 +84,7 @@ func (s *WechatPartnerPayClient) getWxPayClient() *core.Client { ...@@ -85,7 +84,7 @@ func (s *WechatPartnerPayClient) getWxPayClient() *core.Client {
// 使用商户私钥等初始化 client,并使它具有自动定时获取微信支付平台证书的能力 // 使用商户私钥等初始化 client,并使它具有自动定时获取微信支付平台证书的能力
opts := []core.ClientOption{ opts := []core.ClientOption{
option.WithWechatPayAutoAuthCipher(*s.MchId, *s.MchSerialNo, mchPrivateKey, *s.ApiKey), option.WithWechatPayAutoAuthCipher(*s.SpMchId, *s.MchSerialNo, mchPrivateKey, *s.ApiKey),
} }
wc, err := core.NewClient(context.Background(), opts...) wc, err := core.NewClient(context.Background(), opts...)
if err != nil { if err != nil {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment