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
92b92866
Commit
92b92866
authored
Jul 31, 2023
by
wangp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
拉卡拉
parent
92a30b7e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
242 additions
and
113 deletions
+242
-113
config.yaml
conf/dev/config.yaml
+51
-20
config.yaml
conf/prod/config.yaml
+48
-35
pay.go
repository/pay/pay.go
+97
-39
setting.go
setting/setting.go
+46
-19
No files found.
conf/dev/config.yaml
View file @
92b92866
...
@@ -47,36 +47,67 @@ payurl:
...
@@ -47,36 +47,67 @@ payurl:
# 拉卡拉支付
# 拉卡拉支付
lakala
:
lakala
:
#通用
#谛宝多多自营 - start
version
:
'
3.0'
#商户-谛宝诚网络科技(北京)有限公司
appid
:
'
OP00000003'
dbc_version
:
'
3.0'
serial_no
:
'
00dfba8194c41b84cf'
dbc_appid
:
'
OP00000003'
#谛宝多多自营
dbc_serial_no
:
'
00dfba8194c41b84cf'
#谛宝多多自营
#1.聚合收银台(微信H5、支付宝H5、快捷支付(银行卡))
#1.聚合收银台(微信H5、支付宝H5)
merchant_no1
:
'
8222900701107M5'
dbc_merchant_no1
:
'
8222900701107M5'
term_no1
:
'
'
#2.聚合收银台(微信扫码、支付宝扫码)
#2.聚合收银台(微信扫码、支付宝扫码)
merchant_no2
:
'
8221210594300JY'
dbc_merchant_no2
:
'
8221210594300JY'
term_no2
:
'
'
#3.聚合主扫(微信JSAPI、微信小程序)
#3.聚合主扫(微信JSAPI、微信小程序)
merchant_no3
:
'
8222900581201QB'
dbc_
merchant_no3
:
'
8222900581201QB'
term_no3
:
'
D0027598'
dbc_
term_no3
:
'
D0027598'
sub_appid3
:
'
wxc3e4d1682da3053c'
#
sub_appid3: 'wxc3e4d1682da3053c'
user_id3
:
'
oLvoQ5deygCMj2WrDjPVPvV1L1t8'
#
user_id3: 'oLvoQ5deygCMj2WrDjPVPvV1L1t8'
#4.聚合被扫(扫码枪)
#4.聚合被扫(扫码枪)
merchant_no4
:
'
822290070111135'
#结算商户号
dbc_merchant_no4
:
'
822290070111135'
#结算商户号
term_no4
:
'
29034705'
#结算终端号
dbc_term_no4
:
'
29034705'
#结算终端号
#配置项
#配置项
#谛宝多多自营
dbc_path_private_key
:
'
./cert/dev/OP00000003_private_key.pem'
#私钥
dbc_path_private_key
:
'
./cert/dev/OP00000003_private_key.pem'
#私钥
dbc_path_cert
:
'
./cert/dev/lkl-apigw-v2.cer'
#证书
dbc_path_cert
:
'
./cert/dev/lkl-apigw-v2.cer'
#证书
#必康自营
#谛宝多多自营 - end
#必康自营 - start
#商户-羿律必康(天津)网络科技有限公司
bk_version
:
'
3.0'
bk_appid
:
'
OP00000003'
#必康自营
bk_serial_no
:
'
00dfba8194c41b84cf'
#必康自营 双击「api_cert.cer」文件,在详情里查看「serial_no」
#1.聚合收银台(微信H5、支付宝H5)
bk_merchant_no1
:
'
8222900701107M5'
#2.聚合收银台(微信扫码、支付宝扫码)
bk_merchant_no2
:
'
8221210594300JY'
#3.聚合主扫(微信JSAPI、微信小程序)
bk_merchant_no3
:
'
8222900581201QB'
bk_term_no3
:
'
D0027598'
#4.聚合被扫(扫码枪)
bk_merchant_no4
:
'
822290070111135'
#结算商户号
bk_term_no4
:
'
29034705'
#结算终端号
#配置项
bk_path_private_key
:
'
./cert/dev/OP00000003_private_key.pem'
#私钥
bk_path_private_key
:
'
./cert/dev/OP00000003_private_key.pem'
#私钥
bk_path_cert
:
'
./cert/dev/lkl-apigw-v2.cer'
#证书
bk_path_cert
:
'
./cert/dev/lkl-apigw-v2.cer'
#证书
#必康医生
#必康自营 - end
#必康医生 - start
#机构-羿律必康(天津)网络科技有限公司
saas_version
:
'
3.0'
saas_appid
:
'
OP00000003'
#必康医生
saas_serial_no
:
'
00dfba8194c41b84cf'
#必康医生
#1.聚合收银台(微信H5、支付宝H5)
saas_merchant_no1
:
'
8222900701107M5'
#2.聚合收银台(微信扫码、支付宝扫码)
saas_merchant_no2
:
'
8221210594300JY'
#3.聚合主扫(微信JSAPI、微信小程序)
saas_merchant_no3
:
'
8222900581201QB'
saas_term_no3
:
'
D0027598'
#4.聚合被扫(扫码枪)
saas_merchant_no4
:
'
822290070111135'
#结算商户号
saas_term_no4
:
'
29034705'
#结算终端号
#配置项
saas_path_private_key
:
'
./cert/dev/OP00000003_private_key.pem'
#私钥
saas_path_private_key
:
'
./cert/dev/OP00000003_private_key.pem'
#私钥
saas_path_cert
:
'
./cert/dev/lkl-apigw-v2.cer'
#证书
saas_path_cert
:
'
./cert/dev/lkl-apigw-v2.cer'
#证书
#必康医生 - end
#拉卡拉接口地址
#拉卡拉接口地址
url_create
:
'
https://test.wsmsd.cn/sit/api/v3/ccss/counter/order/create'
#聚合收银台(微信H5、支付宝H5、微信扫码、支付宝扫码)
url_create
:
'
https://test.wsmsd.cn/sit/api/v3/ccss/counter/order/create'
#聚合收银台(微信H5、支付宝H5、微信扫码、支付宝扫码)
...
...
conf/prod/config.yaml
View file @
92b92866
...
@@ -49,55 +49,68 @@ payurl:
...
@@ -49,55 +49,68 @@ payurl:
# 拉卡拉支付
# 拉卡拉支付
lakala
:
lakala
:
#通用
#谛宝多多自营 - start
version
:
'
1.0'
dbc_version
:
'
1.0'
dbc_appid
:
'
OP00000859'
#谛宝多多自营
dbc_appid名称
:
'
商户-谛宝诚网络科技(北京)有限公司'
#谛宝多多自营
# appid: 'OP00000859' #谛宝多多自营
dbc_serial_no
:
'
01896250fd68'
#谛宝多多自营
# appid名称: '商户-谛宝诚网络科技(北京)有限公司' #谛宝多多自营
# serial_no: '01896250fd68' #谛宝多多自营
# 'APPLET_APPID' =>'wx6ff40a576e2f4ca0', //谛宝多多小程序
# merchant_no=822100058221000599501K999501K9 ?
appid
:
'
OP00000886'
#必康自营
appid名称
:
'
商户-羿律必康(天津)网络科技有限公司'
#必康自营
serial_no
:
'
01896253d115'
#必康自营 双击「api_cert.cer」文件
# appid: 'OP00000836' #必康医生
# appid名称: '机构-羿律必康(天津)网络科技有限公司' #必康医生
# serial_no: '0188b7d3d751' #必康医生
#谛宝多多自营
#1.聚合收银台(微信H5、支付宝H5)
#1.聚合收银台(微信H5、支付宝H5)
merchant_no1
:
'
8221100899900E0'
dbc_merchant_no1
:
'
8221000599501K9'
term_no1
:
'
'
#2.聚合收银台(微信扫码、支付宝扫码)
#2.聚合收银台(微信扫码、支付宝扫码)
merchant_no2
:
'
8221100899900E0'
dbc_merchant_no2
:
'
8221000599501K9'
term_no2
:
'
'
#3.聚合主扫(微信JSAPI、微信小程序)
#3.聚合主扫(微信JSAPI、微信小程序)
merchant_no3
:
'
8221100899900E0'
dbc_merchant_no3
:
'
8221000599501K9'
term_no3
:
'
688354520242'
dbc_term_no3
:
'
'
# sub_appid3: 'wxc3e4d1682da3053c' #子商户公众账号ID
# user_id3: 'oLvoQ5deygCMj2WrDjPVPvV1L1t8' #用户标识(sub_openid)
#4.聚合被扫(扫码枪)
#4.聚合被扫(扫码枪)
#8221000599501K9
dbc_merchant_no4
:
'
8221000599501K9'
#结算商户号
merchant_no4
:
'
8221100899900E0'
#结算商户号
dbc_term_no4
:
'
'
#结算终端号
term_no4
:
'
677902880958'
#结算终端号
#配置项
#配置项
#谛宝多多自营
dbc_path_private_key
:
'
./cert/prod/dbc/api_private_key.pem'
#私钥
dbc_path_private_key
:
'
./cert/prod/dbc/api_private_key.pem'
#私钥
dbc_path_cert
:
'
./cert/prod/dbc/lkl-apigw-v1.cer'
#证书
dbc_path_cert
:
'
./cert/prod/dbc/lkl-apigw-v1.cer'
#证书
#必康自营
#谛宝多多自营 - end
#必康自营 - start
bk_version
:
'
1.0'
bk_appid
:
'
OP00000886'
#必康自营
bk_appid名称
:
'
商户-羿律必康(天津)网络科技有限公司'
#必康自营
bk_serial_no
:
'
01896253d115'
#必康自营 双击「api_cert.cer」文件,在详情里查看「serial_no」
#1.聚合收银台(微信H5、支付宝H5)
bk_merchant_no1
:
'
8221100899900E0'
#2.聚合收银台(微信扫码、支付宝扫码)
bk_merchant_no2
:
'
8221100899900E0'
#3.聚合主扫(微信JSAPI、微信小程序)
bk_merchant_no3
:
'
8221100899900E0'
bk_term_no3
:
'
F4902290'
#4.聚合被扫(扫码枪)
bk_merchant_no4
:
'
8221100899900E0'
#结算商户号
bk_term_no4
:
'
F4902290'
#结算终端号
#配置项
bk_path_private_key
:
'
./cert/prod/bk/api_private_key.pem'
#私钥
bk_path_private_key
:
'
./cert/prod/bk/api_private_key.pem'
#私钥
bk_path_cert
:
'
./cert/prod/bk/lkl-apigw-v1.cer'
#证书
bk_path_cert
:
'
./cert/prod/bk/lkl-apigw-v1.cer'
#证书
#必康医生
#必康自营 - end
#必康医生 - start
saas_version
:
'
1.0'
saas_appid
:
'
OP00000836'
#必康医生
saas_appid名称
:
'
机构-羿律必康(天津)网络科技有限公司'
#必康医生
saas_serial_no
:
'
0188b7d3d751'
#必康医生
#1.聚合收银台(微信H5、支付宝H5)
saas_merchant_no1
:
'
'
#2.聚合收银台(微信扫码、支付宝扫码)
saas_merchant_no2
:
'
'
#3.聚合主扫(微信JSAPI、微信小程序)
saas_merchant_no3
:
'
'
saas_term_no3
:
'
'
#4.聚合被扫(扫码枪)
saas_merchant_no4
:
'
'
#结算商户号
saas_term_no4
:
'
'
#结算终端号
#配置项
saas_path_private_key
:
'
./cert/prod/saas/api_private_key.pem'
#私钥
saas_path_private_key
:
'
./cert/prod/saas/api_private_key.pem'
#私钥
saas_path_cert
:
'
./cert/prod/saas/lkl-apigw-v1.cer'
#证书
saas_path_cert
:
'
./cert/prod/saas/lkl-apigw-v1.cer'
#证书
#必康医生 - end
#拉卡拉接口地址
#拉卡拉接口地址
url_create
:
'
https://s2.lakala.com/api/v3/ccss/counter/order/create'
#聚合收银台(微信H5、支付宝H5、微信扫码、支付宝扫码)
url_create
:
'
https://s2.lakala.com/api/v3/ccss/counter/order/create'
#聚合收银台(微信H5、支付宝H5、微信扫码、支付宝扫码)
url_preorder
:
'
https://s2.lakala.com/api/v3/labs/trans/preorder'
#聚合主扫(微信JSAPI、微信小程序)
url_preorder
:
'
https://s2.lakala.com/api/v3/labs/trans/preorder'
#聚合主扫(微信JSAPI、微信小程序)
url_micropay
:
'
https://s2.lakala.com/api/v3/labs/trans/micropay'
#聚合被扫(扫码枪)
url_micropay
:
'
https://s2.lakala.com/api/v3/labs/trans/micropay'
#聚合被扫(扫码枪)
url_refund
:
'
https://s2.lakala.com/api/v3/labs/relation/refund'
#聚合扫码-退款交易
url_refund
:
'
https://s2.lakala.com/api/v3/labs/relation/refund'
#聚合扫码-退款交易
repository/pay/pay.go
View file @
92b92866
...
@@ -68,16 +68,40 @@ func UnifiedOrder(input *models.PlaceAnOrderParamInput, ip string) (interface{},
...
@@ -68,16 +68,40 @@ func UnifiedOrder(input *models.PlaceAnOrderParamInput, ip string) (interface{},
now
.
Add
(
time
.
Minute
*
60
)
now
.
Add
(
time
.
Minute
*
60
)
date_time1
:=
now
.
Format
(
"20060102150405"
)
date_time1
:=
now
.
Format
(
"20060102150405"
)
date_time2
:=
now
.
Add
(
time
.
Minute
*
60
)
.
Format
(
"20060102150405"
)
date_time2
:=
now
.
Add
(
time
.
Minute
*
60
)
.
Format
(
"20060102150405"
)
version
:=
setting
.
Conf
.
Lakala
.
Version
out_org_code
:=
setting
.
Conf
.
Lakala
.
Appid
var
version
,
out_org_code
,
merchant_no1
,
merchant_no2
,
merchant_no3
,
term_no3
,
merchant_no4
,
term_no4
string
merchant_no1
:=
setting
.
Conf
.
Lakala
.
MerchantNo1
//平台类型 1:saas 2:shop 3:shop mobile 4:收银台 6:bk_shop 7:bk_shop_mobile
merchant_no2
:=
setting
.
Conf
.
Lakala
.
MerchantNo2
if
input
.
PlatformType
==
2
||
input
.
PlatformType
==
3
{
merchant_no3
:=
setting
.
Conf
.
Lakala
.
MerchantNo3
// 谛宝多多自营
term_no3
:=
setting
.
Conf
.
Lakala
.
TermNo3
version
=
setting
.
Conf
.
Lakala
.
DbcVersion
//sub_appid3 := setting.Conf.Lakala.SubAppid3
out_org_code
=
setting
.
Conf
.
Lakala
.
DbcAppid
//user_id3 := setting.Conf.Lakala.UserId3
merchant_no1
=
setting
.
Conf
.
Lakala
.
DbcMerchantNo1
merchant_no4
:=
setting
.
Conf
.
Lakala
.
MerchantNo4
merchant_no2
=
setting
.
Conf
.
Lakala
.
DbcMerchantNo2
term_no4
:=
setting
.
Conf
.
Lakala
.
TermNo4
merchant_no3
=
setting
.
Conf
.
Lakala
.
DbcMerchantNo3
term_no3
=
setting
.
Conf
.
Lakala
.
DbcTermNo3
merchant_no4
=
setting
.
Conf
.
Lakala
.
DbcMerchantNo4
term_no4
=
setting
.
Conf
.
Lakala
.
DbcTermNo4
}
else
if
input
.
PlatformType
==
6
||
input
.
PlatformType
==
7
{
// 必康自营
version
=
setting
.
Conf
.
Lakala
.
BkVersion
out_org_code
=
setting
.
Conf
.
Lakala
.
BkAppid
merchant_no1
=
setting
.
Conf
.
Lakala
.
BkMerchantNo1
merchant_no2
=
setting
.
Conf
.
Lakala
.
BkMerchantNo2
merchant_no3
=
setting
.
Conf
.
Lakala
.
BkMerchantNo3
term_no3
=
setting
.
Conf
.
Lakala
.
BkTermNo3
merchant_no4
=
setting
.
Conf
.
Lakala
.
BkMerchantNo4
term_no4
=
setting
.
Conf
.
Lakala
.
BkTermNo4
}
else
{
// 必康医生
version
=
setting
.
Conf
.
Lakala
.
SaasVersion
out_org_code
=
setting
.
Conf
.
Lakala
.
SaasAppid
merchant_no1
=
setting
.
Conf
.
Lakala
.
SaasMerchantNo1
merchant_no2
=
setting
.
Conf
.
Lakala
.
SaasMerchantNo2
merchant_no3
=
setting
.
Conf
.
Lakala
.
SaasMerchantNo3
term_no3
=
setting
.
Conf
.
Lakala
.
SaasTermNo3
merchant_no4
=
setting
.
Conf
.
Lakala
.
SaasMerchantNo4
term_no4
=
setting
.
Conf
.
Lakala
.
SaasTermNo4
}
var
url
string
var
url
string
data
:=
make
(
map
[
string
]
interface
{})
//数据结构
data
:=
make
(
map
[
string
]
interface
{})
//数据结构
...
@@ -167,7 +191,7 @@ func UnifiedOrder(input *models.PlaceAnOrderParamInput, ip string) (interface{},
...
@@ -167,7 +191,7 @@ func UnifiedOrder(input *models.PlaceAnOrderParamInput, ip string) (interface{},
//地址位置信息
//地址位置信息
data4
:=
make
(
map
[
string
]
interface
{})
data4
:=
make
(
map
[
string
]
interface
{})
data4
[
"sub_appid"
]
=
input
.
AppID
//子商户公众账号ID
data4
[
"sub_appid"
]
=
input
.
AppID
//子商户公众账号ID
data4
[
"user_id"
]
=
input
.
OpenID
//用户标识
data4
[
"user_id"
]
=
input
.
OpenID
//用户标识
(sub_openid)
data2
[
"acc_busi_fields"
]
=
make
(
map
[
string
]
interface
{})
data2
[
"acc_busi_fields"
]
=
make
(
map
[
string
]
interface
{})
data2
[
"acc_busi_fields"
]
=
data4
data2
[
"acc_busi_fields"
]
=
data4
...
@@ -331,26 +355,32 @@ func lakala_post(input *models.PlaceAnOrderParamInput, url string, data_json []b
...
@@ -331,26 +355,32 @@ func lakala_post(input *models.PlaceAnOrderParamInput, url string, data_json []b
}
}
func
getAuthorization
(
platform_type
uint8
,
body
string
)
(
string
,
error
)
{
func
getAuthorization
(
platform_type
uint8
,
body
string
)
(
string
,
error
)
{
appid
:=
setting
.
Conf
.
Lakala
.
Appid
mchSerialNo
:=
setting
.
Conf
.
Lakala
.
SerialNo
nonceStr
:=
RandomString
(
32
)
// 构造随机数
var
path_private_key
,
appid
,
mchSerialNo
string
//私钥文件地址
timestamp
:=
strconv
.
FormatInt
(
time
.
Now
()
.
Unix
(),
10
)
message
:=
appid
+
"
\n
"
+
mchSerialNo
+
"
\n
"
+
timestamp
+
"
\n
"
+
nonceStr
+
"
\n
"
+
body
+
"
\n
"
;
var
path_private_key
string
//私钥文件地址
//平台类型 1:saas 2:shop 3:shop mobile 4:收银台 6:bk_shop 7:bk_shop_mobile
//平台类型 1:saas 2:shop 3:shop mobile 4:收银台 6:bk_shop 7:bk_shop_mobile
if
platform_type
==
2
||
platform_type
==
3
{
if
platform_type
==
2
||
platform_type
==
3
{
// 谛宝多多自营
// 谛宝多多自营
appid
=
setting
.
Conf
.
Lakala
.
DbcAppid
mchSerialNo
=
setting
.
Conf
.
Lakala
.
DbcSerialNo
path_private_key
=
setting
.
Conf
.
Lakala
.
DbcPathPrivateKey
path_private_key
=
setting
.
Conf
.
Lakala
.
DbcPathPrivateKey
}
else
if
platform_type
==
6
||
platform_type
==
7
{
}
else
if
platform_type
==
6
||
platform_type
==
7
{
// 必康自营
// 必康自营
appid
=
setting
.
Conf
.
Lakala
.
BkAppid
mchSerialNo
=
setting
.
Conf
.
Lakala
.
BkSerialNo
path_private_key
=
setting
.
Conf
.
Lakala
.
BkPathPrivateKey
path_private_key
=
setting
.
Conf
.
Lakala
.
BkPathPrivateKey
}
else
{
}
else
{
// 必康医生
// 必康医生
appid
=
setting
.
Conf
.
Lakala
.
SaasAppid
mchSerialNo
=
setting
.
Conf
.
Lakala
.
SaasSerialNo
path_private_key
=
setting
.
Conf
.
Lakala
.
SaasPathPrivateKey
path_private_key
=
setting
.
Conf
.
Lakala
.
SaasPathPrivateKey
}
}
nonceStr
:=
RandomString
(
32
)
// 构造随机数
timestamp
:=
strconv
.
FormatInt
(
time
.
Now
()
.
Unix
(),
10
)
message
:=
appid
+
"
\n
"
+
mchSerialNo
+
"
\n
"
+
timestamp
+
"
\n
"
+
nonceStr
+
"
\n
"
+
body
+
"
\n
"
;
//todo 退款时,证书???
//todo 退款时,证书???
//return "", errors.New("输入项「平台类型(platform_type)」数据错误")
//return "", errors.New("输入项「平台类型(platform_type)」数据错误")
...
@@ -539,7 +569,7 @@ func UnifiedRefund(input *models.RefundParamInput, ip string) (interface{}, erro
...
@@ -539,7 +569,7 @@ func UnifiedRefund(input *models.RefundParamInput, ip string) (interface{}, erro
defer
mysql
.
CloseTx
(
tx
,
err
)
defer
mysql
.
CloseTx
(
tx
,
err
)
//退款订单存在check
//退款订单存在check
log_no
,
trans_term_no
,
source_code
,
err
:=
selectRefundBill
(
tx
,
input
)
log_no
,
trans_term_no
,
source_code
,
platform_type
,
err
:=
selectRefundBill
(
tx
,
input
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
...
@@ -553,14 +583,41 @@ func UnifiedRefund(input *models.RefundParamInput, ip string) (interface{}, erro
...
@@ -553,14 +583,41 @@ func UnifiedRefund(input *models.RefundParamInput, ip string) (interface{}, erro
now
:=
time
.
Now
()
now
:=
time
.
Now
()
now
.
Add
(
time
.
Minute
*
60
)
now
.
Add
(
time
.
Minute
*
60
)
date_time1
:=
now
.
Format
(
"20060102150405"
)
date_time1
:=
now
.
Format
(
"20060102150405"
)
version
:=
setting
.
Conf
.
Lakala
.
Version
out_org_code
:=
setting
.
Conf
.
Lakala
.
Appid
var
version
,
out_org_code
,
merchant_no1
,
merchant_no2
,
merchant_no3
,
term_no3
,
merchant_no4
,
term_no4
string
merchant_no1
:=
setting
.
Conf
.
Lakala
.
MerchantNo1
merchant_no2
:=
setting
.
Conf
.
Lakala
.
MerchantNo2
//平台类型 1:saas 2:shop 3:shop mobile 4:收银台 6:bk_shop 7:bk_shop_mobile
merchant_no3
:=
setting
.
Conf
.
Lakala
.
MerchantNo3
if
platform_type
==
2
||
platform_type
==
3
{
term_no3
:=
setting
.
Conf
.
Lakala
.
TermNo3
// 谛宝多多自营
merchant_no4
:=
setting
.
Conf
.
Lakala
.
MerchantNo4
version
=
setting
.
Conf
.
Lakala
.
DbcVersion
term_no4
:=
setting
.
Conf
.
Lakala
.
TermNo4
out_org_code
=
setting
.
Conf
.
Lakala
.
DbcAppid
merchant_no1
=
setting
.
Conf
.
Lakala
.
DbcMerchantNo1
merchant_no2
=
setting
.
Conf
.
Lakala
.
DbcMerchantNo2
merchant_no3
=
setting
.
Conf
.
Lakala
.
DbcMerchantNo3
term_no3
=
setting
.
Conf
.
Lakala
.
DbcTermNo3
merchant_no4
=
setting
.
Conf
.
Lakala
.
DbcMerchantNo4
term_no4
=
setting
.
Conf
.
Lakala
.
DbcTermNo4
}
else
if
platform_type
==
6
||
platform_type
==
7
{
// 必康自营
version
=
setting
.
Conf
.
Lakala
.
BkVersion
out_org_code
=
setting
.
Conf
.
Lakala
.
BkAppid
merchant_no1
=
setting
.
Conf
.
Lakala
.
BkMerchantNo1
merchant_no2
=
setting
.
Conf
.
Lakala
.
BkMerchantNo2
merchant_no3
=
setting
.
Conf
.
Lakala
.
BkMerchantNo3
term_no3
=
setting
.
Conf
.
Lakala
.
BkTermNo3
merchant_no4
=
setting
.
Conf
.
Lakala
.
BkMerchantNo4
term_no4
=
setting
.
Conf
.
Lakala
.
BkTermNo4
}
else
{
// 必康医生
version
=
setting
.
Conf
.
Lakala
.
SaasVersion
out_org_code
=
setting
.
Conf
.
Lakala
.
SaasAppid
merchant_no1
=
setting
.
Conf
.
Lakala
.
SaasMerchantNo1
merchant_no2
=
setting
.
Conf
.
Lakala
.
SaasMerchantNo2
merchant_no3
=
setting
.
Conf
.
Lakala
.
SaasMerchantNo3
term_no3
=
setting
.
Conf
.
Lakala
.
SaasTermNo3
merchant_no4
=
setting
.
Conf
.
Lakala
.
SaasMerchantNo4
term_no4
=
setting
.
Conf
.
Lakala
.
SaasTermNo4
}
var
url
string
var
url
string
data
:=
make
(
map
[
string
]
interface
{})
data
:=
make
(
map
[
string
]
interface
{})
...
@@ -671,25 +728,26 @@ func UnifiedRefund(input *models.RefundParamInput, ip string) (interface{}, erro
...
@@ -671,25 +728,26 @@ func UnifiedRefund(input *models.RefundParamInput, ip string) (interface{}, erro
}
}
//退款订单存在check
//退款订单存在check
func
selectRefundBill
(
tx
*
sql
.
Tx
,
input
*
models
.
RefundParamInput
)
(
string
,
string
,
uint8
,
error
)
{
func
selectRefundBill
(
tx
*
sql
.
Tx
,
input
*
models
.
RefundParamInput
)
(
string
,
string
,
uint8
,
uint8
,
error
)
{
var
billID
int64
var
billID
int64
var
status
uint
var
status
uint
var
platform_type
uint8
var
source_code
uint8
var
source_code
uint8
var
notice_request
models
.
WxNoticeInput
var
notice_request
models
.
WxNoticeInput
var
notice_request2
[]
byte
var
notice_request2
[]
byte
//payment_order_code, paymoney
//payment_order_code, paymoney
selectRefundBillSQL
:=
`select b.id, b.result_code, b.source_code, bd.notice_request_body
selectRefundBillSQL
:=
`select b.id, b.result_code, b.source_code, b
.platform_type, b
d.notice_request_body
from system_pay_bill b
from system_pay_bill b
left join system_pay_bill_detail bd on b.id=bd.pay_bill_id
left join system_pay_bill_detail bd on b.id=bd.pay_bill_id
where b._type=0 and b.payment_order_code=?`
where b._type=0 and b.payment_order_code=?`
err
:=
tx
.
QueryRow
(
selectRefundBillSQL
,
input
.
RefundNo
)
.
Scan
(
&
billID
,
&
status
,
&
source_code
,
&
notice_request2
)
err
:=
tx
.
QueryRow
(
selectRefundBillSQL
,
input
.
RefundNo
)
.
Scan
(
&
billID
,
&
status
,
&
source_code
,
&
platform_type
,
&
notice_request2
)
if
err
!=
nil
{
if
err
!=
nil
{
return
""
,
""
,
0
,
err
return
""
,
""
,
0
,
0
,
err
}
}
if
err
:=
json
.
Unmarshal
(
notice_request2
,
&
notice_request
);
err
!=
nil
{
if
err
:=
json
.
Unmarshal
(
notice_request2
,
&
notice_request
);
err
!=
nil
{
return
""
,
""
,
0
,
err
return
""
,
""
,
0
,
0
,
err
}
}
//fmt.Println(notice_request2)
//fmt.Println(notice_request2)
...
@@ -697,30 +755,30 @@ func selectRefundBill(tx *sql.Tx, input *models.RefundParamInput) (string, strin
...
@@ -697,30 +755,30 @@ func selectRefundBill(tx *sql.Tx, input *models.RefundParamInput) (string, strin
// 订单不存在
// 订单不存在
if
billID
<=
0
{
if
billID
<=
0
{
return
""
,
""
,
0
,
errors
.
New
(
"订单不存在2"
)
return
""
,
""
,
0
,
0
,
errors
.
New
(
"订单不存在2"
)
}
}
// 订单未结算
// 订单未结算
if
status
!=
1
{
if
status
!=
1
{
return
""
,
""
,
0
,
errors
.
New
(
"订单未结算"
)
return
""
,
""
,
0
,
0
,
errors
.
New
(
"订单未结算"
)
}
}
if
source_code
==
0
{
if
source_code
==
0
{
return
""
,
""
,
0
,
errors
.
New
(
"「source_code」错误,有效值为[1-6,9,15]"
)
return
""
,
""
,
0
,
0
,
errors
.
New
(
"「source_code」错误,有效值为[1-6,9,15]"
)
}
}
// 获取「对账单流水号」和「交易终端号」,退款用
// 获取「对账单流水号」和「交易终端号」,退款用
// 针对有的支付,不需要传「交易终端号」时,需要用支付返回的「交易终端号」进行退款
// 针对有的支付,不需要传「交易终端号」时,需要用支付返回的「交易终端号」进行退款
log_no
:=
notice_request
.
OrderTradeInfo
.
(
map
[
string
]
interface
{})[
"log_no"
]
.
(
string
)
log_no
:=
notice_request
.
OrderTradeInfo
.
(
map
[
string
]
interface
{})[
"log_no"
]
.
(
string
)
if
log_no
==
""
{
if
log_no
==
""
{
return
""
,
""
,
0
,
errors
.
New
(
"「对账单流水号」未取得错误"
)
return
""
,
""
,
0
,
0
,
errors
.
New
(
"「对账单流水号」未取得错误"
)
}
}
if
notice_request
.
TransTermNo
==
""
{
if
notice_request
.
TransTermNo
==
""
{
//todo
//todo
return
""
,
""
,
0
,
errors
.
New
(
"「交易终端号」未取得错误"
)
return
""
,
""
,
0
,
0
,
errors
.
New
(
"「交易终端号」未取得错误"
)
}
}
return
log_no
,
notice_request
.
TransTermNo
,
source_code
,
nil
return
log_no
,
notice_request
.
TransTermNo
,
source_code
,
platform_type
,
nil
}
}
//InsertRefundBill is 插入 支付订单表中
//InsertRefundBill is 插入 支付订单表中
...
...
setting/setting.go
View file @
92b92866
...
@@ -57,36 +57,63 @@ type PayUrlDetail struct {
...
@@ -57,36 +57,63 @@ type PayUrlDetail struct {
// 拉卡拉支付
// 拉卡拉支付
type
Lakala
struct
{
type
Lakala
struct
{
// 通用
// 谛宝多多自营 - start
Version
string
`mapstructure:"version"`
DbcVersion
string
`mapstructure:"dbc_version"`
Appid
string
`mapstructure:"appid"`
DbcAppid
string
`mapstructure:"dbc_appid"`
SerialNo
string
`mapstructure:"serial_no"`
DbcSerialNo
string
`mapstructure:"dbc_serial_no"`
// 1.聚合收银台(微信H5、支付宝H5)
// 1.聚合收银台(微信H5、支付宝H5)
MerchantNo1
string
`mapstructure:"merchant_no1"`
DbcMerchantNo1
string
`mapstructure:"dbc_merchant_no1"`
TermNo1
string
`mapstructure:"term_no1"`
// 2.聚合收银台(微信扫码、支付宝扫码)
// 2.聚合收银台(微信扫码、支付宝扫码)
MerchantNo2
string
`mapstructure:"merchant_no2"`
DbcMerchantNo2
string
`mapstructure:"dbc_merchant_no2"`
TermNo2
string
`mapstructure:"term_no2"`
// 3.聚合主扫(微信JSAPI、微信小程序)
// 3.聚合主扫(微信JSAPI、微信小程序)
MerchantNo3
string
`mapstructure:"merchant_no3"`
DbcMerchantNo3
string
`mapstructure:"dbc_merchant_no3"`
TermNo3
string
`mapstructure:"term_no3"`
DbcTermNo3
string
`mapstructure:"dbc_term_no3"`
SubAppid3
string
`mapstructure:"sub_appid3"`
UserId3
string
`mapstructure:"user_id3"`
// 4.扫码枪
// 4.扫码枪
MerchantNo4
string
`mapstructure:"merchant_no4"`
DbcMerchantNo4
string
`mapstructure:"dbc_merchant_no4"`
TermNo4
string
`mapstructure:"term_no4"`
DbcTermNo4
string
`mapstructure:"dbc_term_no4"`
// 配置项
// 配置项
// 谛宝多多自营
DbcPathPrivateKey
string
`mapstructure:"dbc_path_private_key"`
//私钥
DbcPathPrivateKey
string
`mapstructure:"dbc_path_private_key"`
//私钥
DbcPathCert
string
`mapstructure:"dbc_path_cert"`
//证书
DbcPathCert
string
`mapstructure:"dbc_path_cert"`
//证书
// 必康自营
// 谛宝多多自营 - end
// 必康自营 - start
BkVersion
string
`mapstructure:"bk_version"`
BkAppid
string
`mapstructure:"bk_appid"`
BkSerialNo
string
`mapstructure:"bk_serial_no"`
// 1.聚合收银台(微信H5、支付宝H5)
BkMerchantNo1
string
`mapstructure:"bk_merchant_no1"`
// 2.聚合收银台(微信扫码、支付宝扫码)
BkMerchantNo2
string
`mapstructure:"bk_merchant_no2"`
// 3.聚合主扫(微信JSAPI、微信小程序)
BkMerchantNo3
string
`mapstructure:"bk_merchant_no3"`
BkTermNo3
string
`mapstructure:"bk_term_no3"`
// 4.扫码枪
BkMerchantNo4
string
`mapstructure:"bk_merchant_no4"`
BkTermNo4
string
`mapstructure:"bk_term_no4"`
// 配置项
BkPathPrivateKey
string
`mapstructure:"bk_path_private_key"`
//私钥
BkPathPrivateKey
string
`mapstructure:"bk_path_private_key"`
//私钥
BkPathCert
string
`mapstructure:"bk_path_cert"`
//证书
BkPathCert
string
`mapstructure:"bk_path_cert"`
//证书
// 必康医生
// 必康自营 - end
// 必康医生 - start
SaasVersion
string
`mapstructure:"saas_version"`
SaasAppid
string
`mapstructure:"saas_appid"`
SaasSerialNo
string
`mapstructure:"saas_serial_no"`
// 1.聚合收银台(微信H5、支付宝H5)
SaasMerchantNo1
string
`mapstructure:"saas_merchant_no1"`
// 2.聚合收银台(微信扫码、支付宝扫码)
SaasMerchantNo2
string
`mapstructure:"saas_merchant_no2"`
// 3.聚合主扫(微信JSAPI、微信小程序)
SaasMerchantNo3
string
`mapstructure:"saas_merchant_no3"`
SaasTermNo3
string
`mapstructure:"saas_term_no3"`
// 4.扫码枪
SaasMerchantNo4
string
`mapstructure:"saas_merchant_no4"`
SaasTermNo4
string
`mapstructure:"saas_term_no4"`
// 配置项
SaasPathPrivateKey
string
`mapstructure:"saas_path_private_key"`
//私钥
SaasPathPrivateKey
string
`mapstructure:"saas_path_private_key"`
//私钥
SaasPathCert
string
`mapstructure:"saas_path_cert"`
//证书
SaasPathCert
string
`mapstructure:"saas_path_cert"`
//证书
// 必康医生 - end
// 拉卡拉接口地址
// 拉卡拉接口地址
UrlCreate
string
`mapstructure:"url_create"`
//聚合收银台(微信H5、支付宝H5、微信扫码、支付宝扫码)
UrlCreate
string
`mapstructure:"url_create"`
//聚合收银台(微信H5、支付宝H5、微信扫码、支付宝扫码)
UrlPreorder
string
`mapstructure:"url_preorder"`
//聚合主扫(微信JSAPI、微信小程序)
UrlPreorder
string
`mapstructure:"url_preorder"`
//聚合主扫(微信JSAPI、微信小程序)
...
...
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