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
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
73 deletions
+56
-73
center-app/app/base/api/impl/payment/paymentApi.js
+36
-52
center-app/app/base/service/impl/utilsSve/utilstlbankSve.js
+20
-21
No files found.
center-app/app/base/api/impl/payment/paymentApi.js
View file @
2caaa803
...
@@ -5,58 +5,43 @@ class PaymentAPI extends APIBase {
...
@@ -5,58 +5,43 @@ class PaymentAPI extends APIBase {
super
();
super
();
this
.
utilstlbankSve
=
system
.
getObject
(
"service.utilsSve.utilstlbankSve"
);
this
.
utilstlbankSve
=
system
.
getObject
(
"service.utilsSve.utilstlbankSve"
);
}
}
async
test
(
pobj
,
query
,
req
)
{
/**
// var tmp = await this.orderSve.createLicense(pobj.action_body);
* 接口跳转-POST请求
return
system
.
getResultSuccess
({
req
:
"ok"
});
* action_process 执行的流程
}
* action_type 执行的类型
async
h5payment
(
p
,
o
,
r
){
* action_body 执行的参数
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
springBoard
(
pobj
,
qobj
,
req
)
{
}
if
(
!
pobj
.
actionType
)
{
async
getQrCode
(
pobj
,
o
,
r
){
return
system
.
getResult
(
null
,
"actionType参数不能为空"
);
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
);
}
return
rtn
;
var
result
=
await
this
.
opActionProcess
(
pobj
,
pobj
.
actionType
,
req
);
}
return
result
;
async
queryOrder
(
pobj
,
o
,
r
){
}
var
rtn
=
await
this
.
utilstlbankSve
.
queryOrder
(
pobj
.
actionBody
.
uapp_id
,
pobj
.
actionBody
.
trxid
);
async
opActionProcess
(
pobj
,
action_type
,
req
)
{
return
rtn
;
var
opResult
=
null
;
}
switch
(
action_type
)
{
async
receiveCallBackNotify
(
pobj
,
o
,
r
){
case
"getH5PayUrl"
:
var
rtn
=
await
this
.
utilstlbankSve
.
receiveCallBackNotify
(
pobj
.
actionBody
.
parmas
,
pobj
.
client_ip
);
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
;
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
;
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 {
...
@@ -48,28 +48,27 @@ class utilsTlBankSve {
* @param {*} order_no 订单号
* @param {*} order_no 订单号
* @param {*} returl 支付成功后返回的url
* @param {*} returl 支付成功后返回的url
*/
*/
async
getH5Url
(
app_id
,
pay_title
,
total_sum
,
order_no
,
returl
)
{
async
getH5PayUrl
(
pobj
,
actionBody
)
{
// appid:00000003,商户号(mch_id):990440148166000,md5key(pay_key):a0ea3fa20dbd7bb4d5abf1d59d63bae8
// pobj.actionBody.body_desc, pobj.actionBody.total_fee, pobj.actionBody.order_num, pobj.actionBody.returl
// var payParam = await this.companypayparamDao.getOneByCompanyId(company_id, 1);
var
payParam
=
await
this
.
getpaymentinfo
(
pobj
.
appInfo
.
uapp_id
);
var
payParam
=
await
this
.
getpaymentinfo
(
app_id
);
if
(
!
payParam
)
{
if
(
!
payParam
)
{
return
{
status
:
-
210
,
msg
:
"
公司
没有对应的支付凭证"
}
return
{
status
:
-
210
,
msg
:
"
应用
没有对应的支付凭证"
}
}
}
var
timestamp
=
Date
.
now
();
var
timestamp
=
Date
.
now
();
var
jsonObj
=
{
var
jsonObj
=
{
appid
:
payParam
.
pay_appid
,
appid
:
payParam
.
pay_appid
,
cusid
:
payParam
.
mch_id
,
cusid
:
payParam
.
mch_id
,
version
:
12
,
version
:
12
,
trxamt
:
total_sum
,
//单位为分
trxamt
:
pobj
.
actionBody
.
total_fee
,
//单位为分
reqsn
:
order_no
,
//order_num + "_" + company
_id.toString(),
reqsn
:
pobj
.
actionBody
.
order_num
,
// "qft" + order_num + "_" + uapp
_id.toString(),
charset
:
"UTF-8"
,
charset
:
"UTF-8"
,
returl
:
returl
,
returl
:
pobj
.
actionBody
.
returl
,
notify_url
:
this
.
notifyU
rl
,
notify_url
:
pobj
.
actionBody
.
retu
rl
,
body
:
p
ay_title
,
body
:
p
obj
.
actionBody
.
body_desc
,
remark
:
"h5paypagesywdy"
,
remark
:
"h5paypagesywdy"
,
randomstr
:
timestamp
.
toString
()
//随机字符串,不长于32位
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
)
{
if
(
param_result
.
status
!=
0
)
{
return
param_result
;
return
param_result
;
}
}
...
@@ -96,7 +95,7 @@ class utilsTlBankSve {
...
@@ -96,7 +95,7 @@ class utilsTlBankSve {
opType:操作类型,1微信、2支付宝
opType:操作类型,1微信、2支付宝
返回错误码:成功为1
返回错误码:成功为1
返回错误码:成功为1
返回错误码:成功为1
-210:
公司
没有对应的支付凭证
-210:
应用
没有对应的支付凭证
-230:请求参数信息为空
-230:请求参数信息为空
-250:请求组装签名参数信息为空
-250:请求组装签名参数信息为空
-280:请求结算接口返回失败
-280:请求结算接口返回失败
...
@@ -113,7 +112,7 @@ class utilsTlBankSve {
...
@@ -113,7 +112,7 @@ class utilsTlBankSve {
// var payParam = await this.companypayparamDao.getOneByCompanyId(company_id, 1);
// var payParam = await this.companypayparamDao.getOneByCompanyId(company_id, 1);
var
payParam
=
await
this
.
getpaymentinfo
(
app_id
);
var
payParam
=
await
this
.
getpaymentinfo
(
app_id
);
if
(
!
payParam
)
{
if
(
!
payParam
)
{
return
{
status
:
-
210
,
msg
:
"
公司
没有对应的支付凭证"
}
return
{
status
:
-
210
,
msg
:
"
应用
没有对应的支付凭证"
}
}
}
var
reqMethod
=
this
.
wxMethod
;
var
reqMethod
=
this
.
wxMethod
;
if
(
opType
==
"alipay"
)
{
if
(
opType
==
"alipay"
)
{
...
@@ -256,7 +255,7 @@ class utilsTlBankSve {
...
@@ -256,7 +255,7 @@ class utilsTlBankSve {
order_num:订单号、
order_num:订单号、
opType:操作类型,1微信、2支付宝
opType:操作类型,1微信、2支付宝
返回错误码:成功为1
返回错误码:成功为1
-210:
公司
没有对应的支付凭证
-210:
应用
没有对应的支付凭证
-230:请求参数信息为空
-230:请求参数信息为空
-250:请求组装签名参数信息为空
-250:请求组装签名参数信息为空
-280:请求结算接口返回失败
-280:请求结算接口返回失败
...
@@ -272,7 +271,7 @@ class utilsTlBankSve {
...
@@ -272,7 +271,7 @@ class utilsTlBankSve {
async
queryOrder
(
uapp_id
,
trxid
)
{
//查询订单支付状态
async
queryOrder
(
uapp_id
,
trxid
)
{
//查询订单支付状态
var
payParam
=
await
this
.
getpaymentinfo
(
uapp_id
);
var
payParam
=
await
this
.
getpaymentinfo
(
uapp_id
);
if
(
!
payParam
)
{
if
(
!
payParam
)
{
return
{
status
:
-
210
,
msg
:
"
公司
没有对应的支付凭证"
}
return
{
status
:
-
210
,
msg
:
"
应用
没有对应的支付凭证"
}
}
}
var
timestamp
=
Date
.
now
();
var
timestamp
=
Date
.
now
();
var
jsonObj
=
{
var
jsonObj
=
{
...
@@ -316,7 +315,7 @@ class utilsTlBankSve {
...
@@ -316,7 +315,7 @@ class utilsTlBankSve {
async
receiveCallBackNotify
(
parmas
,
client_ip
)
{
//收到通联回调通知---post请求
async
receiveCallBackNotify
(
parmas
,
client_ip
)
{
//收到通联回调通知---post请求
var
result
=
{
status
:
-
1
,
msg
:
""
};
var
result
=
{
status
:
-
1
,
msg
:
""
};
try
{
try
{
if
(
!
parmas
)
{
if
(
!
parmas
)
{
result
.
msg
=
"回调parmas中参数信息为空"
;
result
.
msg
=
"回调parmas中参数信息为空"
;
...
@@ -342,12 +341,12 @@ class utilsTlBankSve {
...
@@ -342,12 +341,12 @@ class utilsTlBankSve {
var
payParam
=
await
this
.
getpaymentinfo
(
uappid
);
var
payParam
=
await
this
.
getpaymentinfo
(
uappid
);
if
(
!
payParam
)
{
if
(
!
payParam
)
{
result
.
msg
=
"回调
公司
没有对应的支付凭证"
;
result
.
msg
=
"回调
应用
没有对应的支付凭证"
;
return
result
;
return
result
;
}
}
var
appinfo
=
await
this
.
getappinfo
(
uappid
);
var
appinfo
=
await
this
.
getappinfo
(
uappid
);
if
(
!
appinfo
)
{
if
(
!
appinfo
)
{
result
.
msg
=
"回调
公司
没有对应的支付凭证"
;
result
.
msg
=
"回调
应用
没有对应的支付凭证"
;
return
result
;
return
result
;
}
}
var
signResult
=
await
this
.
resultSign
(
parmas
,
payParam
.
pay_key
);
var
signResult
=
await
this
.
resultSign
(
parmas
,
payParam
.
pay_key
);
...
@@ -361,12 +360,12 @@ class utilsTlBankSve {
...
@@ -361,12 +360,12 @@ class utilsTlBankSve {
parmas
.
uappid
=
attachList
.
length
==
2
?
attachList
[
1
]
:
attachList
[
2
];
parmas
.
uappid
=
attachList
.
length
==
2
?
attachList
[
1
]
:
attachList
[
2
];
//重写新签名
//重写新签名
var
newparmas
=
await
this
.
getReqBeforeParam
(
parmas
,
appinfo
.
uapp_secret
);
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
)
{
if
(
backResult
.
status
!=
0
)
{
result
.
msg
=
backResult
.
msg
;
result
.
msg
=
backResult
.
msg
;
return
result
;
return
result
;
}
}
result
.
status
=
0
;
result
.
status
=
0
;
return
result
;
return
result
;
}
catch
(
e
)
{
}
catch
(
e
)
{
result
.
msg
=
"回调业务处理---error异常"
;
result
.
msg
=
"回调业务处理---error异常"
;
...
@@ -390,7 +389,7 @@ class utilsTlBankSve {
...
@@ -390,7 +389,7 @@ class utilsTlBankSve {
return
""
;
return
""
;
}
}
async
opBackNotify
(
getParams
,
opDesc
)
{
//操作回调业务逻辑
async
opBackNotify
(
getParams
,
opDesc
)
{
//操作回调业务逻辑
__暂时没有用到
try
{
try
{
//日志记录
//日志记录
logCtl
.
info
({
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