Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Z
zhichan
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
蒋勇
zhichan
Commits
2caaa803
Commit
2caaa803
authored
Feb 16, 2020
by
宋毅
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tj
parent
dcce743d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
57 additions
and
74 deletions
+57
-74
center-app/app/base/api/impl/payment/paymentApi.js
+36
-52
center-app/app/base/service/impl/utilsSve/utilstlbankSve.js
+21
-22
No files found.
center-app/app/base/api/impl/payment/paymentApi.js
View file @
2caaa803
...
...
@@ -5,58 +5,43 @@ class PaymentAPI extends APIBase {
super
();
this
.
utilstlbankSve
=
system
.
getObject
(
"service.utilsSve.utilstlbankSve"
);
}
async
test
(
pobj
,
query
,
req
)
{
// var tmp = await this.orderSve.createLicense(pobj.action_body);
return
system
.
getResultSuccess
({
req
:
"ok"
});
}
async
h5payment
(
p
,
o
,
r
){
var
a
=
await
this
.
utilstlbankSve
.
getH5Url
(
o
.
app_id
,
o
.
order_num
,
o
.
total_fee
,
null
,
o
.
body_desc
,
null
,
o
.
opType
);
return
a
;
}
async
getQrCode
(
pobj
,
o
,
r
){
var
rtn
=
await
this
.
utilstlbankSve
.
getQrCode
(
pobj
.
actionBody
.
uapp_id
,
pobj
.
actionBody
.
order_num
,
pobj
.
actionBody
.
total_fee
,
pobj
.
actionBody
.
body_desc
,
pobj
.
actionBody
.
opType
);
/**
* 接口跳转-POST请求
* action_process 执行的流程
* action_type 执行的类型
* action_body 执行的参数
*/
async
springBoard
(
pobj
,
qobj
,
req
)
{
if
(
!
pobj
.
actionType
)
{
return
system
.
getResult
(
null
,
"actionType参数不能为空"
);
}
var
result
=
await
this
.
opActionProcess
(
pobj
,
pobj
.
actionType
,
req
);
return
result
;
}
async
opActionProcess
(
pobj
,
action_type
,
req
)
{
var
opResult
=
null
;
switch
(
action_type
)
{
case
"getH5PayUrl"
:
opResult
=
await
this
.
utilstlbankSve
.
getH5PayUrl
(
pobj
,
pobj
.
actionBody
);
break
;
case
"getQrCode"
:
case
"getOrderQrCode"
:
opResult
=
await
this
.
utilstlbankSve
.
getQrCode
(
pobj
.
appInfo
.
uapp_id
,
pobj
.
actionBody
.
order_num
,
pobj
.
actionBody
.
total_fee
,
pobj
.
actionBody
.
body_desc
,
pobj
.
actionBody
.
op_type
);
break
;
case
"queryOrder"
:
case
"queryOrderStatus"
:
opResult
=
await
this
.
utilstlbankSve
.
queryOrder
(
pobj
.
appInfo
.
uapp_id
,
pobj
.
actionBody
.
trxid
);
break
;
default
:
opResult
=
system
.
getResult
(
null
,
"action_type参数错误"
);
break
;
}
return
opResult
;
}
//支付成功后通知
async
receiveCallBackNotify
(
pobj
,
query
,
req
)
{
var
rtn
=
await
this
.
utilstlbankSve
.
receiveCallBackNotify
(
pobj
.
actionBody
.
parmas
,
pobj
.
client_ip
);
return
rtn
;
}
async
queryOrder
(
pobj
,
o
,
r
){
var
rtn
=
await
this
.
utilstlbankSve
.
queryOrder
(
pobj
.
actionBody
.
uapp_id
,
pobj
.
actionBody
.
trxid
);
return
rtn
;
}
async
receiveCallBackNotify
(
pobj
,
o
,
r
){
var
rtn
=
await
this
.
utilstlbankSve
.
receiveCallBackNotify
(
pobj
.
actionBody
.
parmas
,
pobj
.
client_ip
);
return
rtn
;
}
exam
()
{
return
""
;
}
classDesc
()
{
return
{
groupName
:
""
,
groupDesc
:
""
,
name
:
""
,
desc
:
""
,
exam
:
""
,
};
}
methodDescs
()
{
return
[
{
methodDesc
:
""
,
methodName
:
""
,
paramdescs
:
[
{
paramDesc
:
""
,
paramName
:
""
,
paramType
:
""
,
defaultValue
:
""
,
}
],
rtnTypeDesc
:
""
,
rtnType
:
""
}
];
}
}
module
.
exports
=
PaymentAPI
;
\ No newline at end of file
center-app/app/base/service/impl/utilsSve/utilstlbankSve.js
View file @
2caaa803
...
...
@@ -48,28 +48,27 @@ class utilsTlBankSve {
* @param {*} order_no 订单号
* @param {*} returl 支付成功后返回的url
*/
async
getH5Url
(
app_id
,
pay_title
,
total_sum
,
order_no
,
returl
)
{
// appid:00000003,商户号(mch_id):990440148166000,md5key(pay_key):a0ea3fa20dbd7bb4d5abf1d59d63bae8
// var payParam = await this.companypayparamDao.getOneByCompanyId(company_id, 1);
var
payParam
=
await
this
.
getpaymentinfo
(
app_id
);
async
getH5PayUrl
(
pobj
,
actionBody
)
{
// pobj.actionBody.body_desc, pobj.actionBody.total_fee, pobj.actionBody.order_num, pobj.actionBody.returl
var
payParam
=
await
this
.
getpaymentinfo
(
pobj
.
appInfo
.
uapp_id
);
if
(
!
payParam
)
{
return
{
status
:
-
210
,
msg
:
"
公司
没有对应的支付凭证"
}
return
{
status
:
-
210
,
msg
:
"
应用
没有对应的支付凭证"
}
}
var
timestamp
=
Date
.
now
();
var
jsonObj
=
{
appid
:
payParam
.
pay_appid
,
cusid
:
payParam
.
mch_id
,
version
:
12
,
trxamt
:
total_sum
,
//单位为分
reqsn
:
order_no
,
//order_num + "_" + company
_id.toString(),
trxamt
:
pobj
.
actionBody
.
total_fee
,
//单位为分
reqsn
:
pobj
.
actionBody
.
order_num
,
// "qft" + order_num + "_" + uapp
_id.toString(),
charset
:
"UTF-8"
,
returl
:
returl
,
notify_url
:
this
.
notifyU
rl
,
body
:
p
ay_title
,
returl
:
pobj
.
actionBody
.
returl
,
notify_url
:
pobj
.
actionBody
.
retu
rl
,
body
:
p
obj
.
actionBody
.
body_desc
,
remark
:
"h5paypagesywdy"
,
randomstr
:
timestamp
.
toString
()
//随机字符串,不长于32位
}
var
param_result
=
await
this
.
getReqBeforeParam
(
jsonObj
,
"1352105537612345789"
);
var
param_result
=
await
this
.
getReqBeforeParam
(
jsonObj
,
payParam
.
pay_key
);
if
(
param_result
.
status
!=
0
)
{
return
param_result
;
}
...
...
@@ -96,7 +95,7 @@ class utilsTlBankSve {
opType:操作类型,1微信、2支付宝
返回错误码:成功为1
返回错误码:成功为1
-210:
公司
没有对应的支付凭证
-210:
应用
没有对应的支付凭证
-230:请求参数信息为空
-250:请求组装签名参数信息为空
-280:请求结算接口返回失败
...
...
@@ -113,7 +112,7 @@ class utilsTlBankSve {
// var payParam = await this.companypayparamDao.getOneByCompanyId(company_id, 1);
var
payParam
=
await
this
.
getpaymentinfo
(
app_id
);
if
(
!
payParam
)
{
return
{
status
:
-
210
,
msg
:
"
公司
没有对应的支付凭证"
}
return
{
status
:
-
210
,
msg
:
"
应用
没有对应的支付凭证"
}
}
var
reqMethod
=
this
.
wxMethod
;
if
(
opType
==
"alipay"
)
{
...
...
@@ -256,7 +255,7 @@ class utilsTlBankSve {
order_num:订单号、
opType:操作类型,1微信、2支付宝
返回错误码:成功为1
-210:
公司
没有对应的支付凭证
-210:
应用
没有对应的支付凭证
-230:请求参数信息为空
-250:请求组装签名参数信息为空
-280:请求结算接口返回失败
...
...
@@ -272,7 +271,7 @@ class utilsTlBankSve {
async
queryOrder
(
uapp_id
,
trxid
)
{
//查询订单支付状态
var
payParam
=
await
this
.
getpaymentinfo
(
uapp_id
);
if
(
!
payParam
)
{
return
{
status
:
-
210
,
msg
:
"
公司
没有对应的支付凭证"
}
return
{
status
:
-
210
,
msg
:
"
应用
没有对应的支付凭证"
}
}
var
timestamp
=
Date
.
now
();
var
jsonObj
=
{
...
...
@@ -316,7 +315,7 @@ class utilsTlBankSve {
async
receiveCallBackNotify
(
parmas
,
client_ip
)
{
//收到通联回调通知---post请求
var
result
=
{
status
:
-
1
,
msg
:
""
};
var
result
=
{
status
:
-
1
,
msg
:
""
};
try
{
if
(
!
parmas
)
{
result
.
msg
=
"回调parmas中参数信息为空"
;
...
...
@@ -342,12 +341,12 @@ class utilsTlBankSve {
var
payParam
=
await
this
.
getpaymentinfo
(
uappid
);
if
(
!
payParam
)
{
result
.
msg
=
"回调
公司
没有对应的支付凭证"
;
result
.
msg
=
"回调
应用
没有对应的支付凭证"
;
return
result
;
}
var
appinfo
=
await
this
.
getappinfo
(
uappid
);
if
(
!
appinfo
)
{
result
.
msg
=
"回调
公司
没有对应的支付凭证"
;
result
.
msg
=
"回调
应用
没有对应的支付凭证"
;
return
result
;
}
var
signResult
=
await
this
.
resultSign
(
parmas
,
payParam
.
pay_key
);
...
...
@@ -355,18 +354,18 @@ class utilsTlBankSve {
result
.
msg
=
signResult
.
msg
;
return
result
;
}
//解析支付参数
parmas
.
out_trade_no
=
attachList
[
0
].
substr
(
3
);
parmas
.
uappid
=
attachList
.
length
==
2
?
attachList
[
1
]
:
attachList
[
2
];
//重写新签名
var
newparmas
=
await
this
.
getReqBeforeParam
(
parmas
,
appinfo
.
uapp_secret
);
var
backResult
=
await
this
.
execReqInfo
(
null
,
payParam
.
notify_url
,
newparmas
.
req_param
);
var
backResult
=
await
this
.
execReqInfo
(
null
,
payParam
.
notify_url
,
newparmas
.
req_param
);
if
(
backResult
.
status
!=
0
)
{
result
.
msg
=
backResult
.
msg
;
return
result
;
}
result
.
status
=
0
;
result
.
status
=
0
;
return
result
;
}
catch
(
e
)
{
result
.
msg
=
"回调业务处理---error异常"
;
...
...
@@ -390,7 +389,7 @@ class utilsTlBankSve {
return
""
;
}
async
opBackNotify
(
getParams
,
opDesc
)
{
//操作回调业务逻辑
async
opBackNotify
(
getParams
,
opDesc
)
{
//操作回调业务逻辑
__暂时没有用到
try
{
//日志记录
logCtl
.
info
({
...
...
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