Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
system_pay
Project
Project
Details
Activity
Releases
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
王沛
system_pay
Commits
a218b29b
Commit
a218b29b
authored
Jul 19, 2023
by
wangp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
notify回调签名验证成功
parent
4018801a
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
220 additions
and
185 deletions
+220
-185
PROD.Dockerfile
PROD.Dockerfile
+8
-1
config.yaml
conf/prod/config.yaml
+9
-8
notice.go
controller/api/v1/pay/notice.go
+159
-131
notice.go
repository/pay/notice.go
+0
-1
pay.go
repository/pay/pay.go
+4
-4
setting.go
setting/setting.go
+1
-1
cert.go
utils/cert.go
+39
-39
No files found.
PROD.Dockerfile
View file @
a218b29b
...
...
@@ -34,8 +34,8 @@ WORKDIR /go/src/system_pay
COPY --from=0 /go/src/system_pay/server ./
# 拷贝配置文件到当前工作目录
#COPY --from=0 /go/src/system_pay/conf/dev ./conf
COPY --from=0 /go/src/system_pay/conf/prod ./conf
COPY --from=0 /go/src/system_pay/conf/consts.go ./conf
# 拷贝国际化文件夹到当前工作目录
COPY --from=0 /go/src/system_pay/i18n ./i18n
...
...
@@ -43,5 +43,12 @@ COPY --from=0 /go/src/system_pay/i18n ./i18n
# 拷贝国际化文件夹到当前工作目录
COPY --from=0 /go/src/system_pay/docs ./docs
# 拷贝私钥、公钥和证书文件夹到当前工作目录
COPY --from=0 /go/src/system_pay/cert ./cert
COPY --from=0 /go/src/system_pay/cert/dev ./cert/dev
COPY --from=0 /go/src/system_pay/cert/prod ./cert/prod
COPY --from=0 /go/src/system_pay/cert/prod/bk ./cert/prod/bk
COPY --from=0 /go/src/system_pay/cert/prod/dbc ./cert/prod/dbc
# 运行打包好的二进制
ENTRYPOINT ./server
\ No newline at end of file
conf/prod/config.yaml
View file @
a218b29b
...
...
@@ -87,20 +87,21 @@ lakala:
# appid名称: ''
# serial_no: '1689571807509'
#谛宝多多自营
#1.聚合收银台(微信H5、支付宝H5)
merchant_no1
:
'
822
2900701107M5
'
merchant_no1
:
'
822
1000599501K9
'
term_no1
:
'
'
#2.聚合收银台(微信扫码、支付宝扫码)
merchant_no2
:
'
8221
210594300JY
'
merchant_no2
:
'
8221
000599501K9
'
term_no2
:
'
'
#3.聚合主扫(微信JSAPI、微信小程序)
merchant_no3
:
'
822
2900581201QB
'
term_no3
:
'
D0027598
'
sub_appid3
:
'
wxc3e4d1682da3053c'
#子商户公众账号ID
user_id3
:
'
oLvoQ5deygCMj2WrDjPVPvV1L1t8'
#用户标识(sub_openid)
merchant_no3
:
'
822
1000599501K9
'
term_no3
:
'
688354520242
'
#
sub_appid3: 'wxc3e4d1682da3053c' #子商户公众账号ID
#
user_id3: 'oLvoQ5deygCMj2WrDjPVPvV1L1t8' #用户标识(sub_openid)
#4.聚合被扫(扫码枪)
merchant_no4
:
'
822
290070111135
'
#结算商户号
term_no4
:
'
29034705'
#结算终端号
merchant_no4
:
'
822
1000599501K9
'
#结算商户号
term_no4
:
'
677902880958'
#结算终端号
#配置项
#谛宝多多自营
...
...
controller/api/v1/pay/notice.go
View file @
a218b29b
This diff is collapsed.
Click to expand it.
repository/pay/notice.go
View file @
a218b29b
...
...
@@ -53,7 +53,6 @@ func WxNotice(input *models.WxNoticeInput) (*base.ResponseDataWxNotice, error) {
fmt
.
Println
(
"222"
)
//if noticeRequest.ReturnCode == "SUCCESS" {
// 把订单状态置为 结算成功
err
=
BillPayStateSuccess
(
tx
,
billID
)
if
err
!=
nil
{
...
...
repository/pay/pay.go
View file @
a218b29b
...
...
@@ -80,8 +80,8 @@ func UnifiedOrder(input *models.PlaceAnOrderParamInput, ip string) (interface{},
merchant_no2
:=
setting
.
Conf
.
Lakala
.
MerchantNo2
merchant_no3
:=
setting
.
Conf
.
Lakala
.
MerchantNo3
term_no3
:=
setting
.
Conf
.
Lakala
.
TermNo3
sub_appid3
:=
setting
.
Conf
.
Lakala
.
SubAppid3
user_id3
:=
setting
.
Conf
.
Lakala
.
UserId3
//
sub_appid3 := setting.Conf.Lakala.SubAppid3
//
user_id3 := setting.Conf.Lakala.UserId3
merchant_no4
:=
setting
.
Conf
.
Lakala
.
MerchantNo4
term_no4
:=
setting
.
Conf
.
Lakala
.
TermNo4
...
...
@@ -193,8 +193,8 @@ func UnifiedOrder(input *models.PlaceAnOrderParamInput, ip string) (interface{},
data4
:=
make
(
map
[
string
]
interface
{})
//data4["open_id"] = input.OpenID //此参数 支付类型是 JS API 的时候 必传
data4
[
"sub_appid"
]
=
sub_appid3
data4
[
"user_id"
]
=
user_id3
data4
[
"sub_appid"
]
=
input
.
AppID
//子商户公众账号ID
data4
[
"user_id"
]
=
input
.
OpenID
//用户标识
data2
[
"acc_busi_fields"
]
=
make
(
map
[
string
]
interface
{})
data2
[
"acc_busi_fields"
]
=
data4
...
...
setting/setting.go
View file @
a218b29b
...
...
@@ -185,7 +185,7 @@ type Esign struct {
// Init 支持热修改的viper设置
func
Init
()
error
{
viper
.
SetConfigFile
(
"conf/
dev/
config.yaml"
)
// 指定配置文件路径
viper
.
SetConfigFile
(
"conf/config.yaml"
)
// 指定配置文件路径
err
:=
viper
.
ReadInConfig
()
// 读取配置信息
if
err
!=
nil
{
// 读取配置信息失败
fmt
.
Printf
(
"viper.ReadInConfig failed, new_error:%v
\n
"
,
err
)
...
...
utils/cert.go
View file @
a218b29b
...
...
@@ -202,42 +202,42 @@ func RsaVerySignWithSha1Base64(originalData, signData, pubKey string) error{
//}
//func VerifyDerCert(der_cert []byte, der_signing_cert []byte) (bool, error) {
func
VerifyDerCert
(
der_cert
[]
byte
,
filename
string
)
(
bool
,
error
)
{
// 1、读取私钥文件,获取私钥字节
der_signing_cert
,
err
:=
ioutil
.
ReadFile
(
filename
)
if
err
!=
nil
{
return
false
,
err
}
roots
:=
x509
.
NewCertPool
()
opts
:=
x509
.
VerifyOptions
{
Roots
:
roots
,
}
// Verify key
policy_cert
,
err
:=
x509
.
ParseCertificate
(
der_signing_cert
)
if
err
!=
nil
{
return
false
,
errors
.
New
(
"Signing ParseCertificate fails"
)
}
roots
.
AddCert
(
policy_cert
)
fmt
.
Printf
(
"Root cert: %x
\n
"
,
der_signing_cert
)
// Verify key
cert
,
err
:=
x509
.
ParseCertificate
(
der_cert
)
if
err
!=
nil
{
return
false
,
errors
.
New
(
"Cert ParseCertificate fails"
)
}
roots
.
AddCert
(
policy_cert
)
opts
.
Roots
=
roots
chains
,
err
:=
cert
.
Verify
(
opts
)
if
err
!=
nil
{
return
false
,
errors
.
New
(
"Verify fails"
)
}
if
chains
!=
nil
{
return
true
,
nil
}
else
{
return
false
,
nil
}
}
\ No newline at end of file
//func VerifyDerCert(der_cert []byte, filename string) (bool, error) {
// // 1、读取私钥文件,获取私钥字节
// der_signing_cert, err := ioutil.ReadFile(filename)
// if err != nil {
// return false, err
// }
//
// roots := x509.NewCertPool()
// opts := x509.VerifyOptions{
// Roots: roots,
// }
//
// // Verify key
// policy_cert, err := x509.ParseCertificate(der_signing_cert)
// if err != nil {
// return false, errors.New("Signing ParseCertificate fails")
// }
// roots.AddCert(policy_cert)
// fmt.Printf("Root cert: %x\n", der_signing_cert)
//
// // Verify key
// cert, err := x509.ParseCertificate(der_cert)
// if err != nil {
// return false, errors.New("Cert ParseCertificate fails")
// }
//
// roots.AddCert(policy_cert)
// opts.Roots = roots
// chains, err := cert.Verify(opts)
// if err != nil {
// return false, errors.New("Verify fails")
// }
// if chains != nil {
// return true, nil
// } else {
// return false, nil
// }
//
//}
\ No newline at end of file
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