Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wechat-client-sdk
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
go
wechat-client-sdk
Commits
7f2c922b
Commit
7f2c922b
authored
Oct 31, 2022
by
yemin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no message
parent
e1b52624
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
18 deletions
+18
-18
Client.go
partnerpay/Client.go
+17
-18
partnerpayclient_test.go
test/partnerpayclient_test.go
+1
-0
No files found.
partnerpay/Client.go
View file @
7f2c922b
...
...
@@ -43,24 +43,23 @@ func (s *WechatPartnerPayClient) WxJsApiOrder(p *PaymentJsApiParam) *PaymentJsAp
if
!
b
{
panic
(
errors
.
New
(
"金额错误请检查,请检查"
))
}
resp
,
_
,
err
:=
svc
.
Prepay
(
context
.
Background
(),
jsapi
.
PrepayRequest
{
SpAppid
:
s
.
AppId
,
SpMchid
:
s
.
SpMchId
,
SubMchid
:
s
.
MchId
,
Description
:
p
.
Title
,
OutTradeNo
:
p
.
OutTradeNo
,
NotifyUrl
:
p
.
CallBackUrl
,
TimeExpire
:
core
.
Time
(
getTimeExpire
(
p
.
TimeExpire
)),
Amount
:
&
jsapi
.
Amount
{
Total
:
core
.
Int64
(
money
.
Int64
()),
},
Payer
:
&
jsapi
.
Payer
{
SpOpenid
:
p
.
OpenId
,
},
Attach
:
p
.
Attach
,
pr
:=
jsapi
.
PrepayRequest
{
SpAppid
:
s
.
AppId
,
SpMchid
:
s
.
SpMchId
,
SubMchid
:
s
.
MchId
,
Description
:
p
.
Title
,
OutTradeNo
:
p
.
OutTradeNo
,
NotifyUrl
:
p
.
CallBackUrl
,
TimeExpire
:
core
.
Time
(
getTimeExpire
(
p
.
TimeExpire
)),
Amount
:
&
jsapi
.
Amount
{
Total
:
core
.
Int64
(
money
.
Int64
()),
},
)
Payer
:
&
jsapi
.
Payer
{
SpOpenid
:
p
.
OpenId
,
},
Attach
:
p
.
Attach
,
}
resp
,
_
,
err
:=
svc
.
Prepay
(
context
.
Background
(),
pr
)
if
err
!=
nil
{
panic
(
errors
.
New
(
getErrMessage
(
err
.
Error
())))
}
...
...
@@ -85,7 +84,7 @@ func (s *WechatPartnerPayClient) getWxPayClient() *core.Client {
// 使用商户私钥等初始化 client,并使它具有自动定时获取微信支付平台证书的能力
opts
:=
[]
core
.
ClientOption
{
option
.
WithWechatPayAutoAuthCipher
(
*
s
.
MchId
,
*
s
.
MchSerialNo
,
mchPrivateKey
,
*
s
.
ApiKey
),
option
.
WithWechatPayAutoAuthCipher
(
*
s
.
Sp
MchId
,
*
s
.
MchSerialNo
,
mchPrivateKey
,
*
s
.
ApiKey
),
}
wc
,
err
:=
core
.
NewClient
(
context
.
Background
(),
opts
...
)
if
err
!=
nil
{
...
...
test/partnerpayclient_test.go
0 → 100644
View file @
7f2c922b
package
test
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment