记得上下班打卡 | git大法好,push需谨慎
Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
liquidnet-bus-v1
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
董敬伟
liquidnet-bus-v1
Commits
4baa6e7d
Commit
4baa6e7d
authored
Nov 24, 2021
by
zhengfuxin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改银联app查询接口。
parent
d61f0bac
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
96 additions
and
8 deletions
+96
-8
liquidnet-service-dragon-dev.yml
...-config/liquidnet-config/liquidnet-service-dragon-dev.yml
+2
-0
UnionpayBiz.java
...dnet/service/dragon/channel/unionpay/biz/UnionpayBiz.java
+57
-5
UnionpayStrategyAppImpl.java
...annel/unionpay/strategy/impl/UnionpayStrategyAppImpl.java
+36
-2
UnionpayStrategyWapImpl.java
...annel/unionpay/strategy/impl/UnionpayStrategyWapImpl.java
+1
-1
No files found.
liquidnet-bus-config/liquidnet-config/liquidnet-service-dragon-dev.yml
View file @
4baa6e7d
...
@@ -47,6 +47,8 @@ acpsdk:
...
@@ -47,6 +47,8 @@ acpsdk:
appTransUrl
:
${liquidnet.dragon.unionpay.gateway-url}/gateway/api/appTransReq.do
appTransUrl
:
${liquidnet.dragon.unionpay.gateway-url}/gateway/api/appTransReq.do
## 交易状态查询
## 交易状态查询
backTransUrl
:
${liquidnet.dragon.unionpay.gateway-url}/gateway/api/backTransReq.do
backTransUrl
:
${liquidnet.dragon.unionpay.gateway-url}/gateway/api/backTransReq.do
## 交易状态查询:app用的路径
singleQueryUrl
:
${liquidnet.dragon.unionpay.gateway-url}/gateway/api/queryTrans.do
## 退款路径 (https://gateway.95516.com/gateway/api/backTransReq.do)
## 退款路径 (https://gateway.95516.com/gateway/api/backTransReq.do)
refundUrl
:
https://101.231.204.80:5000/gateway/api/backTransReq.do
refundUrl
:
https://101.231.204.80:5000/gateway/api/backTransReq.do
########################################################################
########################################################################
...
...
liquidnet-bus-service/liquidnet-service-dragon/liquidnet-service-dragon-impl/src/main/java/com/liquidnet/service/dragon/channel/unionpay/biz/UnionpayBiz.java
View file @
4baa6e7d
...
@@ -190,11 +190,8 @@ public class UnionpayBiz {
...
@@ -190,11 +190,8 @@ public class UnionpayBiz {
/**
/**
* wap 银联订单查询
* wap 银联订单查询
*
* @return
*/
*/
public
Map
<
String
,
String
>
tradeQuery
(
String
outTradeNo
)
{
public
Map
<
String
,
String
>
tradeQuery
(
String
outTradeNo
)
{
log
.
info
(
"UnionpayBiz.tradeQuery-->> "
);
String
txnTime
=
DateUtil
.
format
(
LocalDateTime
.
now
(),
DateUtil
.
Formatter
.
yyyyMMddHHmmssTrim
);
String
txnTime
=
DateUtil
.
format
(
LocalDateTime
.
now
(),
DateUtil
.
Formatter
.
yyyyMMddHHmmssTrim
);
Map
<
String
,
String
>
data
=
new
HashMap
<
String
,
String
>();
Map
<
String
,
String
>
data
=
new
HashMap
<
String
,
String
>();
/***银联全渠道系统,产品参数,除了encoding自行选择外其他不需修改***/
/***银联全渠道系统,产品参数,除了encoding自行选择外其他不需修改***/
...
@@ -254,11 +251,66 @@ public class UnionpayBiz {
...
@@ -254,11 +251,66 @@ public class UnionpayBiz {
}
}
/**
/**
* @author zhangfuxin
* @author zhangfuxin
* @Description: 银联
* @Description: 银联
app 查询
* @date 2021/11/24 上午11:32
* @date 2021/11/24 上午11:32
*/
*/
public
Map
<
String
,
String
>
tradeQueryApp
(
String
outTradeNo
){
public
Map
<
String
,
String
>
tradeQueryApp
(
String
outTradeNo
){
return
null
;
String
txnTime
=
DateUtil
.
format
(
LocalDateTime
.
now
(),
DateUtil
.
Formatter
.
yyyyMMddHHmmssTrim
);
Map
<
String
,
String
>
data
=
new
HashMap
<
String
,
String
>();
/***银联全渠道系统,产品参数,除了encoding自行选择外其他不需修改***/
data
.
put
(
"version"
,
sdkConfig
.
getVersion
());
//版本号
data
.
put
(
"encoding"
,
UnionpayConstant
.
encoding
);
//字符集编码 可以使用UTF-8,GBK两种方式
data
.
put
(
"signMethod"
,
sdkConfig
.
getSignMethod
());
//签名方法
data
.
put
(
"txnType"
,
"00"
);
//交易类型 00-默认
data
.
put
(
"txnSubType"
,
"00"
);
//交易子类型 默认00
data
.
put
(
"bizType"
,
"000201"
);
//业务类型
/***商户接入参数***/
data
.
put
(
"merId"
,
merchantId
);
//商户号码,请改成自己申请的商户号或者open上注册得来的777商户号测试
data
.
put
(
"accessType"
,
"0"
);
//接入类型,商户接入固定填0,不需修改
/***要调通交易以下字段必须修改***/
data
.
put
(
"orderId"
,
outTradeNo
);
//****商户订单号,每次发交易测试需修改为被查询的交易的订单号
data
.
put
(
"txnTime"
,
txnTime
);
//****订单发送时间,每次发交易测试需修改为被查询的交易的订单发送时间
/**请求参数设置完毕,以下对请求参数进行签名并发送http post请求,接收同步应答报文------------->**/
Map
<
String
,
String
>
reqData
=
acpService
.
sign
(
data
,
UnionpayConstant
.
encoding
);
//报文中certId,signature的值是在signData方法中获取并自动赋值的,只要证书配置正确即可。
String
url
=
sdkConfig
.
getSingleQueryUrl
();
//交易请求url从配置文件读取对应属性文件acp_sdk.properties中的 acpsdk.singleQueryUrl
Map
<
String
,
String
>
rspData
=
acpService
.
post
(
reqData
,
url
,
UnionpayConstant
.
encoding
);
//发送请求报文并接受同步应答(默认连接超时时间30秒,读取返回结果超时时间30秒);这里调用signData之后,调用submitUrl之前不能对submitFromData中的键值对做任何修改,如果修改会导致验签不通过
/**对应答码的处理,请根据您的业务逻辑来编写程序,以下应答码处理逻辑仅供参考------------->**/
//应答码规范参考open.unionpay.com帮助中心 下载 产品接口规范 《平台接入接口规范-第5部分-附录》
if
(!
rspData
.
isEmpty
()){
if
(
acpService
.
validate
(
rspData
,
UnionpayConstant
.
encoding
)){
/* if(("00").equals(rspData.get("respCode"))){//如果查询交易成功
String origRespCode = rspData.get("origRespCode");
if(("00").equals(origRespCode)){
//交易成功,更新商户订单状态
//TODO
}else if(("03").equals(origRespCode)||
("04").equals(origRespCode)||
("05").equals(origRespCode)){
//订单处理中或交易状态未明,需稍后发起交易状态查询交易 【如果最终尚未确定交易是否成功请以对账文件为准】
//TODO
}else{
//其他应答码为交易失败
//TODO
}
}else if(("34").equals(rspData.get("respCode"))){
//订单不存在,可认为交易状态未明,需要稍后发起交易状态查询,或依据对账结果为准
}else{//查询交易本身失败,如应答码10/11检查查询报文是否正确
//TODO
}*/
}
else
{
log
.
error
(
"wap 银联订单查询,验证签名失败"
);
throw
new
LiquidnetServiceException
(
DragonErrorCodeEnum
.
TRADE_UNIONPAY_SIGN_ERROR
.
TRADE_ALIPAY_QUERY_ERROR
.
getCode
(),
DragonErrorCodeEnum
.
TRADE_UNIONPAY_SIGN_ERROR
.
getMessage
());
}
}
else
{
//未返回正确的http状态
log
.
error
(
"wap 银联订单查询,未获取到返回报文或返回http状态码非200"
);
}
/*String reqMessage = this.genHtmlResult(reqData);
String rspMessage = this.genHtmlResult(rspData);
log.info("请求报文:<br/>"+reqMessage+"<br/>");
log.info("应答报文:</br>"+rspMessage+"");*/
return
rspData
;
}
}
public
Map
<
String
,
Object
>
appSingleRefund
()
public
Map
<
String
,
Object
>
appSingleRefund
()
throws
ServletException
,
IOException
{
throws
ServletException
,
IOException
{
...
...
liquidnet-bus-service/liquidnet-service-dragon/liquidnet-service-dragon-impl/src/main/java/com/liquidnet/service/dragon/channel/unionpay/strategy/impl/UnionpayStrategyAppImpl.java
View file @
4baa6e7d
package
com
.
liquidnet
.
service
.
dragon
.
channel
.
unionpay
.
strategy
.
impl
;
package
com
.
liquidnet
.
service
.
dragon
.
channel
.
unionpay
.
strategy
.
impl
;
import
com.liquidnet.common.exception.LiquidnetServiceException
;
import
com.liquidnet.commons.lang.util.JsonUtils
;
import
com.liquidnet.commons.lang.util.JsonUtils
;
import
com.liquidnet.commons.lang.util.StringUtil
;
import
com.liquidnet.commons.lang.util.StringUtil
;
import
com.liquidnet.service.dragon.channel.strategy.biz.DragonPayBiz
;
import
com.liquidnet.service.dragon.channel.unionpay.biz.UnionpayBiz
;
import
com.liquidnet.service.dragon.channel.unionpay.biz.UnionpayBiz
;
import
com.liquidnet.service.dragon.channel.unionpay.constant.UnionpayConstant
;
import
com.liquidnet.service.dragon.channel.unionpay.req.UnionpayTradePayReq
;
import
com.liquidnet.service.dragon.channel.unionpay.req.UnionpayTradePayReq
;
import
com.liquidnet.service.dragon.channel.unionpay.sdk.SDKConfig
;
import
com.liquidnet.service.dragon.channel.unionpay.sdk.SDKConfig
;
import
com.liquidnet.service.dragon.channel.unionpay.strategy.annotation.StrategyUnionpayHandler
;
import
com.liquidnet.service.dragon.channel.unionpay.strategy.annotation.StrategyUnionpayHandler
;
import
com.liquidnet.service.dragon.constant.DragonConstant
;
import
com.liquidnet.service.dragon.constant.DragonConstant
;
import
com.liquidnet.service.dragon.constant.DragonErrorCodeEnum
;
import
com.liquidnet.service.dragon.dto.DragonOrdersDto
;
import
com.liquidnet.service.dragon.dto.DragonPayBaseReqDto
;
import
com.liquidnet.service.dragon.dto.DragonPayBaseReqDto
;
import
com.liquidnet.service.dragon.dto.DragonPayBaseRespDto
;
import
com.liquidnet.service.dragon.dto.DragonPayBaseRespDto
;
import
com.liquidnet.service.dragon.dto.DragonPayOrderQueryRespDto
;
import
com.liquidnet.service.dragon.dto.DragonPayOrderQueryRespDto
;
import
com.liquidnet.service.dragon.utils.DataUtils
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
...
@@ -42,6 +48,10 @@ public class UnionpayStrategyAppImpl extends AbstractUnionPayStrategy {
...
@@ -42,6 +48,10 @@ public class UnionpayStrategyAppImpl extends AbstractUnionPayStrategy {
@Autowired
@Autowired
private
SDKConfig
sdkConfig
;
private
SDKConfig
sdkConfig
;
@Autowired
private
DragonPayBiz
dragonPayBiz
;
@Autowired
private
DataUtils
dataUtils
;
@Override
@Override
protected
Map
<
String
,
String
>
executePay
(
UnionpayTradePayReq
payReq
)
{
protected
Map
<
String
,
String
>
executePay
(
UnionpayTradePayReq
payReq
)
{
...
@@ -66,8 +76,32 @@ public class UnionpayStrategyAppImpl extends AbstractUnionPayStrategy {
...
@@ -66,8 +76,32 @@ public class UnionpayStrategyAppImpl extends AbstractUnionPayStrategy {
*/
*/
@Override
@Override
public
DragonPayOrderQueryRespDto
checkOrderStatus
(
String
code
)
{
public
DragonPayOrderQueryRespDto
checkOrderStatus
(
String
code
)
{
DragonOrdersDto
ordersDto
=
dataUtils
.
getPayOrderByCode
(
code
);
return
null
;
if
(
null
==
ordersDto
){
throw
new
LiquidnetServiceException
(
DragonErrorCodeEnum
.
TRADE_UNIONPAY_QUERY_ERROR
.
getCode
(),
DragonErrorCodeEnum
.
TRADE_UNIONPAY_QUERY_ERROR
.
getMessage
());
}
DragonPayOrderQueryRespDto
respDto
=
dragonPayBiz
.
buildPayOrderQueryRespDto
(
ordersDto
);
//wap类型查询订单
Map
<
String
,
String
>
resultMap
=
unionpayBiz
.
tradeQueryApp
(
code
);
if
((
"00"
).
equals
(
resultMap
.
get
(
"respCode"
))){
//如果查询交易成功
String
origRespCode
=
resultMap
.
get
(
"origRespCode"
);
if
((
UnionpayConstant
.
UnionTradeStateEnum
.
TRADE_SUCCESS
).
equals
(
origRespCode
)||
UnionpayConstant
.
UnionTradeStateEnum
.
TRADE_DEFECTIVENESS_SUCCESS
.
equals
(
origRespCode
)){
//交易成功
respDto
.
setStatus
(
Integer
.
valueOf
(
DragonConstant
.
PayStatusEnum
.
STATUS_PAID
.
getCode
()));
}
else
if
((
"03"
).
equals
(
origRespCode
)||
(
"04"
).
equals
(
origRespCode
)||
(
"05"
).
equals
(
origRespCode
)){
//订单处理中或交易状态未明,需稍后发起交易状态查询交易 【如果最终尚未确定交易是否成功请以对账文件为准】
respDto
.
setStatus
(
Integer
.
valueOf
(
DragonConstant
.
PayStatusEnum
.
STATUS_UNPAID
.
getCode
()));
}
else
{
//其他应答码为交易失败
//TODO
respDto
.
setStatus
(
Integer
.
valueOf
(
DragonConstant
.
PayStatusEnum
.
STATUS_PAY_FAIL
.
getCode
()));
}
}
return
respDto
;
}
}
@Override
@Override
...
...
liquidnet-bus-service/liquidnet-service-dragon/liquidnet-service-dragon-impl/src/main/java/com/liquidnet/service/dragon/channel/unionpay/strategy/impl/UnionpayStrategyWapImpl.java
View file @
4baa6e7d
...
@@ -102,7 +102,7 @@ public class UnionpayStrategyWapImpl extends AbstractUnionPayStrategy {
...
@@ -102,7 +102,7 @@ public class UnionpayStrategyWapImpl extends AbstractUnionPayStrategy {
}
}
return
null
;
return
respDto
;
}
}
@Override
@Override
...
...
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