记得上下班打卡 | 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
5ee91521
Commit
5ee91521
authored
Mar 11, 2022
by
胡佳晨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交 退款逻辑
parent
83069919
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
80 additions
and
75 deletions
+80
-75
DragonOrderRefundsServiceImpl.java
...ce/dragon/service/impl/DragonOrderRefundsServiceImpl.java
+80
-75
No files found.
liquidnet-bus-service/liquidnet-service-dragon/liquidnet-service-dragon-impl/src/main/java/com/liquidnet/service/dragon/service/impl/DragonOrderRefundsServiceImpl.java
View file @
5ee91521
...
...
@@ -73,6 +73,7 @@ public class DragonOrderRefundsServiceImpl implements IDragonOrderRefundsService
private
String
unionMerchantId
;
@Autowired
private
UnionpayBiz
unionpayBiz
;
@Override
public
ResponseDto
<
DragonRefundAppDto
>
dragonRefund
(
String
orderCode
,
String
code
,
String
orderRefundCode
,
String
reason
,
String
notifyUrl
,
BigDecimal
price
,
String
paymentType
,
String
paymentId
,
BigDecimal
priceTotal
)
{
try
{
...
...
@@ -88,7 +89,7 @@ public class DragonOrderRefundsServiceImpl implements IDragonOrderRefundsService
DragonRefundChannelDto
dto
=
null
;
String
localWePayCallBackUrl
=
url
+
"/refund/callBack/wepay"
;
String
localDouYinCallBackUrl
=
url
+
"/refund/callBack/douyinpay"
;
String
localUnionPayCallBackUrl
=
url
+
"/refund/callBack/union"
;
String
localUnionPayCallBackUrl
=
url
+
"/refund/callBack/union"
;
if
(
insertResult
)
{
switch
(
paymentType
)
{
case
DragonConstant
.
REFUND_TYPE_APP_ALIPAY
:
...
...
@@ -122,16 +123,16 @@ public class DragonOrderRefundsServiceImpl implements IDragonOrderRefundsService
dto
=
weyPayRefund
(
code
,
orderRefundCode
,
code
,
reason
,
price
,
priceTotal
,
paymentId
,
paymentType
,
localWePayCallBackUrl
,
nowTime
);
break
;
case
DragonConstant
.
REFUND_TYPE_APPLET_DOUYIN
:
dataUtils
.
setOrderCode
(
orderRefundCode
,
orderCode
);
dataUtils
.
setOrderCode
(
orderRefundCode
,
orderCode
);
dto
=
douYinRefund
(
code
,
orderRefundCode
,
code
,
reason
,
price
,
priceTotal
,
paymentId
,
paymentType
,
localDouYinCallBackUrl
,
nowTime
);
break
;
case
DragonConstant
.
REFUND_TYPE_WAP_UNION
:
dataUtils
.
setOrderCode
(
orderRefundCode
,
orderCode
);
dto
=
UnionWapPayRefund
(
code
,
orderRefundCode
,
code
,
reason
,
price
,
priceTotal
,
paymentId
,
paymentType
,
localUnionPayCallBackUrl
,
nowTime
);
dataUtils
.
setOrderCode
(
orderRefundCode
,
orderCode
);
dto
=
UnionWapPayRefund
(
code
,
orderRefundCode
,
code
,
reason
,
price
,
priceTotal
,
paymentId
,
paymentType
,
localUnionPayCallBackUrl
,
nowTime
);
break
;
case
DragonConstant
.
REFUND_TYPE_APP_UNION
:
dataUtils
.
setOrderCode
(
orderRefundCode
,
orderCode
);
dto
=
UnionWapPayRefund
(
code
,
orderRefundCode
,
code
,
reason
,
price
,
priceTotal
,
paymentId
,
paymentType
,
localUnionPayCallBackUrl
,
nowTime
);
case
DragonConstant
.
REFUND_TYPE_APP_UNION
:
dataUtils
.
setOrderCode
(
orderRefundCode
,
orderCode
);
dto
=
UnionWapPayRefund
(
code
,
orderRefundCode
,
code
,
reason
,
price
,
priceTotal
,
paymentId
,
paymentType
,
localUnionPayCallBackUrl
,
nowTime
);
break
;
}
...
...
@@ -164,6 +165,7 @@ public class DragonOrderRefundsServiceImpl implements IDragonOrderRefundsService
return
ResponseDto
.
failure
(
"退款失败:"
+
e
.
getMessage
());
}
}
/**
* @author zhangfuxin
* @Description: 抖音退款接口
...
...
@@ -175,18 +177,18 @@ public class DragonOrderRefundsServiceImpl implements IDragonOrderRefundsService
DragonRefundChannelDto
channelDto
=
new
DragonRefundChannelDto
();
RefundContentDto
contentDto
=
new
RefundContentDto
();
SortedMap
<
String
,
Object
>
parameters
=
new
TreeMap
<>();
parameters
.
put
(
"app_id"
,
PayDouYinpayUtils
.
getInstance
().
getAPP_ID
());
parameters
.
put
(
"out_order_no"
,
code
);
parameters
.
put
(
"out_refund_no"
,
refundCode
);
parameters
.
put
(
"refund_amount"
,
(
int
)
(
price
.
doubleValue
()
*
100
)
);
parameters
.
put
(
"reason"
,
reason
);
parameters
.
put
(
"notify_url"
,
notifyUrl
);
parameters
.
put
(
"app_id"
,
PayDouYinpayUtils
.
getInstance
().
getAPP_ID
());
parameters
.
put
(
"out_order_no"
,
code
);
parameters
.
put
(
"out_refund_no"
,
refundCode
);
parameters
.
put
(
"refund_amount"
,
price
.
multiply
(
new
BigDecimal
(
100
)).
intValue
()+
""
);
parameters
.
put
(
"reason"
,
reason
);
parameters
.
put
(
"notify_url"
,
notifyUrl
);
String
sign
=
PayDouYinpayUtils
.
getInstance
().
createSign
(
parameters
);
parameters
.
put
(
"sign"
,
sign
);
parameters
.
put
(
"sign"
,
sign
);
String
data
=
JSON
.
toJSONString
(
parameters
);
String
refundError
=
""
;
try
{
log
.
info
(
"调用抖音退款:{}"
,
data
);
log
.
info
(
"调用抖音退款:{}"
,
data
);
HttpPost
httpost
=
new
HttpPost
(
"https://developer.toutiao.com/api/apps/ecpay/v1/create_refund"
);
httpost
.
setEntity
(
new
StringEntity
(
data
,
"UTF-8"
));
CloseableHttpResponse
response
=
PayDouYinpayUtils
.
getInstance
().
getHttpClient
().
execute
(
httpost
);
...
...
@@ -195,9 +197,9 @@ public class DragonOrderRefundsServiceImpl implements IDragonOrderRefundsService
entity
.
getContent
();
String
jsonStr
=
EntityUtils
.
toString
(
entity
,
"UTF-8"
);
log
.
info
(
"douYinRefund 返参{}"
,
jsonStr
);
Map
result
=
JSON
.
parseObject
(
jsonStr
,
HashMap
.
class
);
Map
result
=
JSON
.
parseObject
(
jsonStr
,
HashMap
.
class
);
//
if
(!
result
.
get
(
"err_no"
).
toString
().
equals
(
"0"
))
{
if
(!
result
.
get
(
"err_no"
).
toString
().
equals
(
"0"
))
{
try
{
refundStatus
=
DragonConstant
.
RefundStatusEnum
.
STATUS_ERROR
.
getCode
();
refundError
=
result
.
get
(
"err_tips"
).
toString
();
...
...
@@ -263,19 +265,20 @@ public class DragonOrderRefundsServiceImpl implements IDragonOrderRefundsService
}
finally
{
// PayWepayUtils.getInstance().getHttpClient().close();
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
log
.
error
(
"退款发生错误"
,
e
);
log
.
error
(
"退款发生错误"
,
e
);
return
null
;
}
}
//银联退款
public
DragonRefundChannelDto
UnionWapPayRefund
(
String
orderRefundId
,
String
refundCode
,
String
code
,
String
reason
,
BigDecimal
price
,
BigDecimal
priceTotal
,
String
paymentId
,
String
paymentType
,
String
notifyUrl
,
LocalDateTime
nowTime
)
{
try
{
RefundContentDto
contentDto
=
new
RefundContentDto
();
DragonRefundChannelDto
channelDto
=
new
DragonRefundChannelDto
();
String
txnTime
=
DateUtil
.
format
(
LocalDateTime
.
now
(),
DateUtil
.
Formatter
.
yyyyMMddHHmmssTrim
);
Map
<
String
,
String
>
data
=
ObjectUtil
.
cloneHashMapStringAndString
();
String
txnTime
=
DateUtil
.
format
(
LocalDateTime
.
now
(),
DateUtil
.
Formatter
.
yyyyMMddHHmmssTrim
);
Map
<
String
,
String
>
data
=
ObjectUtil
.
cloneHashMapStringAndString
();
/***银联全渠道系统,产品参数,除了encoding自行选择外其他不需修改***/
data
.
put
(
"version"
,
sdkConfig
.
getVersion
());
//版本号
data
.
put
(
"encoding"
,
UnionpayConstant
.
encoding
);
//字符集编码 可以使用UTF-8,GBK两种方式
...
...
@@ -290,7 +293,7 @@ public class DragonOrderRefundsServiceImpl implements IDragonOrderRefundsService
data
.
put
(
"orderId"
,
refundCode
);
//商户订单号,8-40位数字字母,不能含“-”或“_”,可以自行定制规则,重新产生,不同于原消费
data
.
put
(
"txnTime"
,
txnTime
);
//订单发送时间,格式为yyyyMMddHHmmss,必须取当前时间,否则会报txnTime无效
data
.
put
(
"currencyCode"
,
"156"
);
//交易币种(境内商户一般是156 人民币)
data
.
put
(
"txnAmt"
,
price
.
multiply
(
BigDecimal
.
valueOf
(
100L
)).
intValue
()
+
""
);
//交易金额 单位为分
data
.
put
(
"txnAmt"
,
price
.
multiply
(
BigDecimal
.
valueOf
(
100L
)).
intValue
()
+
""
);
//交易金额 单位为分
data
.
put
(
"backUrl"
,
notifyUrl
);
//后台通知地址,后台通知参数详见open.unionpay.com帮助中心 下载 产品接口规范 网关支付产品接口规范 退货交易 商户通知,其他说明同消费交易的后台通知
/***要调通交易以下字段必须修改***/
data
.
put
(
"origQryId"
,
paymentId
);
//****原消费交易返回的的queryId,可以从消费交易后台通知接口中或者交易状态查询接口中获取
...
...
@@ -306,16 +309,16 @@ public class DragonOrderRefundsServiceImpl implements IDragonOrderRefundsService
// 查询、通知等接口解析时使用new String(Base64.decodeBase64(reqReserved), UnionpayConstant.encoding);解base64后再对数据做后续解析。
// data.put("reqReserved", Base64.encodeBase64String("任意格式的信息都可以".toString().getBytes(UnionpayConstant.encoding)));
/**请求参数设置完毕,以下对请求参数进行签名并发送http post请求,接收同步应答报文------------->**/
Map
<
String
,
String
>
reqData
=
acpService
.
sign
(
data
,
UnionpayConstant
.
encoding
);
//报文中certId,signature的值是在signData方法中获取并自动赋值的,只要证书配置正确即可。
Map
<
String
,
String
>
rspData
=
acpService
.
post
(
reqData
,
sdkConfig
.
getBackTransUrl
(),
UnionpayConstant
.
encoding
);
//这里调用signData之后,调用submitUrl之前不能对submitFromData中的键值对做任何修改,如果修改会导致验签不通过
Map
<
String
,
String
>
reqData
=
acpService
.
sign
(
data
,
UnionpayConstant
.
encoding
);
//报文中certId,signature的值是在signData方法中获取并自动赋值的,只要证书配置正确即可。
Map
<
String
,
String
>
rspData
=
acpService
.
post
(
reqData
,
sdkConfig
.
getBackTransUrl
(),
UnionpayConstant
.
encoding
);
//这里调用signData之后,调用submitUrl之前不能对submitFromData中的键值对做任何修改,如果修改会导致验签不通过
String
refundError
=
""
;
/**对应答码的处理,请根据您的业务逻辑来编写程序,以下应答码处理逻辑仅供参考------------->**/
//应答码规范参考open.unionpay.com帮助中心 下载 产品接口规范 《平台接入接口规范-第5部分-附录》
if
(!
rspData
.
isEmpty
())
{
if
(
acpService
.
validate
(
rspData
,
UnionpayConstant
.
encoding
))
{
if
(!
rspData
.
isEmpty
())
{
if
(
acpService
.
validate
(
rspData
,
UnionpayConstant
.
encoding
))
{
log
.
info
(
"验证签名成功"
);
String
respCode
=
rspData
.
get
(
"respCode"
)
;
if
((
"00"
).
equals
(
respCode
))
{
String
respCode
=
rspData
.
get
(
"respCode"
);
if
((
"00"
).
equals
(
respCode
))
{
//交易已受理(不代表交易已成功),等待接收后台通知更新订单状态,也可以主动发起 查询交易确定交易状态。
// 创建退款日志
mqHandleUtil
.
sendMySqlRedis
(
...
...
@@ -331,7 +334,7 @@ public class DragonOrderRefundsServiceImpl implements IDragonOrderRefundsService
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
log
.
error
(
"异常信息"
,
e
);
log
.
error
(
"异常信息"
,
e
);
channelDto
.
setResult
(
"exception"
);
channelDto
.
setMessage
(
"update order refund with db error: "
+
e
.
getMessage
());
contentDto
.
setRequest
(
JSON
.
toJSONString
(
reqData
));
...
...
@@ -339,14 +342,14 @@ public class DragonOrderRefundsServiceImpl implements IDragonOrderRefundsService
channelDto
.
setContent
(
contentDto
);
return
channelDto
;
}
}
else
{
}
else
{
//其他应答码为失败请排查原因
try
{
String
refundStatus
=
DragonConstant
.
RefundStatusEnum
.
STATUS_ERROR
.
getCode
();
if
((
"03"
).
equals
(
respCode
)||
(
"04"
).
equals
(
respCode
)||
(
"05"
).
equals
(
respCode
))
{
refundError
=
"银联返回状态"
+
respCode
+
"请稍后确认。"
;
}
else
{
refundError
=
rspData
.
get
(
"respMsg"
)==
null
?
"退款失败,原因未知"
:
rspData
.
get
(
"respMsg"
).
toString
();
String
refundStatus
=
DragonConstant
.
RefundStatusEnum
.
STATUS_ERROR
.
getCode
();
if
((
"03"
).
equals
(
respCode
)
||
(
"04"
).
equals
(
respCode
)
||
(
"05"
).
equals
(
respCode
))
{
refundError
=
"银联返回状态"
+
respCode
+
"请稍后确认。"
;
}
else
{
refundError
=
rspData
.
get
(
"respMsg"
)
==
null
?
"退款失败,原因未知"
:
rspData
.
get
(
"respMsg"
).
toString
();
}
// 修改退款订单
mqHandleUtil
.
sendMySqlRedis
(
...
...
@@ -372,11 +375,11 @@ public class DragonOrderRefundsServiceImpl implements IDragonOrderRefundsService
channelDto
.
setContent
(
contentDto
);
return
channelDto
;
}
}
else
{
}
else
{
log
.
error
(
"银联退款,验证签名失败"
);
return
null
;
}
}
else
{
}
else
{
//未返回正确的http状态
log
.
error
(
"银联退款,未获取到返回报文或返回http状态码非200"
);
return
null
;
...
...
@@ -387,9 +390,9 @@ public class DragonOrderRefundsServiceImpl implements IDragonOrderRefundsService
contentDto
.
setResponse
(
JSON
.
toJSONString
(
rspData
));
channelDto
.
setContent
(
contentDto
);
return
channelDto
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
log
.
error
(
"异常信息"
,
e
);
log
.
error
(
"异常信息"
,
e
);
return
null
;
}
}
...
...
@@ -417,8 +420,8 @@ public class DragonOrderRefundsServiceImpl implements IDragonOrderRefundsService
parameters
.
put
(
"nonce_str"
,
nonceStr
);
parameters
.
put
(
"out_refund_no"
,
refundCode
);
parameters
.
put
(
"out_trade_no"
,
code
);
parameters
.
put
(
"refund_fee"
,
(
int
)
(
price
.
doubleValue
()
*
100
)
+
""
);
parameters
.
put
(
"total_fee"
,
(
int
)
(
priceTotal
.
doubleValue
()
*
100
)
+
""
);
parameters
.
put
(
"refund_fee"
,
(
price
.
multiply
(
new
BigDecimal
(
100
)).
intValue
())+
""
);
parameters
.
put
(
"total_fee"
,
(
priceTotal
.
multiply
(
new
BigDecimal
(
100
)).
intValue
())+
""
);
parameters
.
put
(
"notify_url"
,
notifyUrl
);
parameters
.
put
(
"refund_desc"
,
reason
);
parameters
.
put
(
"refund_account"
,
"REFUND_SOURCE_RECHARGE_FUNDS"
);
...
...
@@ -610,28 +613,29 @@ public class DragonOrderRefundsServiceImpl implements IDragonOrderRefundsService
return
null
;
}
}
/**
* @author zhangfuxin
* @Description: 抖音退款回调
* @date 2021/11/11 上午10:55
*/
public
String
douYinPayRefundCallBack
(
HttpServletRequest
request
,
HttpServletResponse
response
){
public
String
douYinPayRefundCallBack
(
HttpServletRequest
request
,
HttpServletResponse
response
)
{
try
{
LocalDateTime
nowTime
=
LocalDateTime
.
now
();
JSONObject
jsonObject
=
PayDouYinpayUtils
.
getJsonObject
(
request
);
log
.
info
(
"接收到的抖音退款回调请求参数{}"
,
JSON
.
toJSONString
(
jsonObject
));
JSONObject
jsonObject
=
PayDouYinpayUtils
.
getJsonObject
(
request
);
log
.
info
(
"接收到的抖音退款回调请求参数{}"
,
JSON
.
toJSONString
(
jsonObject
));
//再次验证是退款的回调
if
(!
jsonObject
.
getString
(
"type"
).
equals
(
"refund"
))
{
throw
new
LiquidnetServiceException
(
DragonErrorCodeEnum
.
TRADE_PARAM_ERROR
.
getCode
(),
DragonErrorCodeEnum
.
TRADE_PARAM_ERROR
.
getMessage
());
if
(!
jsonObject
.
getString
(
"type"
).
equals
(
"refund"
))
{
throw
new
LiquidnetServiceException
(
DragonErrorCodeEnum
.
TRADE_PARAM_ERROR
.
getCode
(),
DragonErrorCodeEnum
.
TRADE_PARAM_ERROR
.
getMessage
());
}
JSONObject
msg
=
jsonObject
.
getJSONObject
(
"msg"
);
JSONObject
msg
=
jsonObject
.
getJSONObject
(
"msg"
);
NotifyUrlDto
dto
=
new
NotifyUrlDto
();
// 验签
if
(
PayDouYinpayUtils
.
getInstance
().
notifySign
(
jsonObject
.
get
(
"msg_signature"
).
toString
(),
jsonObject
))
{
// 根据配置信息验证签名
if
(
PayDouYinpayUtils
.
getInstance
().
notifySign
(
jsonObject
.
get
(
"msg_signature"
).
toString
(),
jsonObject
))
{
// 根据配置信息验证签名
//查看退款状态 (退款状态 PROCESSING-处理中|SUCCESS-成功|FAIL-失败)
if
(
msg
.
getString
(
"status"
).
equals
(
"SUCCESS"
))
{
if
(
msg
.
getString
(
"status"
).
equals
(
"SUCCESS"
))
{
dto
.
setStatus
(
1
);
}
else
{
}
else
{
dto
.
setStatus
(
0
);
}
//开发者自定义的退款单号
...
...
@@ -639,7 +643,7 @@ public class DragonOrderRefundsServiceImpl implements IDragonOrderRefundsService
// 没有订单号 从redids里面查
dto
.
setRefundCode
(
dataUtils
.
getOrderCode
(
msg
.
getString
(
"cp_refundno"
)));
dto
.
setRefundPrice
(
msg
.
getBigDecimal
(
"refund_amount"
).
divide
(
BigDecimal
.
valueOf
(
100
)).
toString
());
// SimpleDateFormat sdf = new SimpleDateFormat( " yyyy年MM月dd日 " );
// SimpleDateFormat sdf = new SimpleDateFormat( " yyyy年MM月dd日 " );
// 抖音没有传回时间
dto
.
setRefundAt
(
DateUtil
.
Formatter
.
yyyyMMddHHmmss
.
format
(
LocalDateTime
.
now
()));
//抖音回调没有写错误原因
...
...
@@ -660,9 +664,9 @@ public class DragonOrderRefundsServiceImpl implements IDragonOrderRefundsService
);
return
"{\"err_no\": 0, \"err_tips\": \"success\"}"
;
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
log
.
error
(
"退款回调失败"
,
e
);
log
.
error
(
"退款回调失败"
,
e
);
}
return
""
;
...
...
@@ -670,21 +674,21 @@ public class DragonOrderRefundsServiceImpl implements IDragonOrderRefundsService
/**
* @author zhangfuxin
* @Description:
查询退款
* @Description: 查询退款
* @date 2021/11/11 下午3:21
*/
@Override
public
String
douYinPayRefundCodeStatus
(
String
outRefundNo
)
{
try
{
//1、组织数据
Map
<
String
,
Object
>
map
=
CollectionUtil
.
mapStringObject
();
map
.
put
(
"app_id"
,
PayDouYinpayUtils
.
getInstance
().
getAPP_ID
());
map
.
put
(
"out_refund_no"
,
outRefundNo
);
Map
<
String
,
Object
>
map
=
CollectionUtil
.
mapStringObject
();
map
.
put
(
"app_id"
,
PayDouYinpayUtils
.
getInstance
().
getAPP_ID
());
map
.
put
(
"out_refund_no"
,
outRefundNo
);
//2、加密
map
.
put
(
"sign"
,
PayDouYinpayUtils
.
getInstance
().
createSign
(
map
));
map
.
put
(
"sign"
,
PayDouYinpayUtils
.
getInstance
().
createSign
(
map
));
//3、请求
String
data
=
JSON
.
toJSONString
(
map
);
log
.
info
(
"查询退款请求抖音参数:{}"
,
data
);
log
.
info
(
"查询退款请求抖音参数:{}"
,
data
);
HttpPost
httpost
=
new
HttpPost
(
"https://developer.toutiao.com/api/apps/ecpay/v1/query_refund"
);
httpost
.
setEntity
(
new
StringEntity
(
data
,
"UTF-8"
));
CloseableHttpClient
httpClient
=
PayDouYinpayUtils
.
getInstance
().
getHttpClient
();
...
...
@@ -693,16 +697,16 @@ public class DragonOrderRefundsServiceImpl implements IDragonOrderRefundsService
//接受到返回信息
String
json
=
EntityUtils
.
toString
(
response
.
getEntity
(),
"UTF-8"
);
EntityUtils
.
consume
(
entity
);
log
.
info
(
"查询抖音退款查询返回值:{}"
,
json
);
log
.
info
(
"查询抖音退款查询返回值:{}"
,
json
);
//解析、如果成功,则更新
LocalDateTime
nowTime
=
LocalDateTime
.
now
();
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
json
);
if
(
jsonObject
.
getInteger
(
"err_no"
)==
0
)
{
JSONObject
refundInfo
=
jsonObject
.
getJSONObject
(
"refundInfo"
);
if
(
jsonObject
.
getInteger
(
"err_no"
)
==
0
)
{
JSONObject
refundInfo
=
jsonObject
.
getJSONObject
(
"refundInfo"
);
NotifyUrlDto
dto
=
new
NotifyUrlDto
();
if
(
refundInfo
.
getString
(
"refund_status"
).
equals
(
"SUCCESS"
))
{
if
(
refundInfo
.
getString
(
"refund_status"
).
equals
(
"SUCCESS"
))
{
dto
.
setStatus
(
1
);
}
else
{
}
else
{
dto
.
setStatus
(
0
);
}
//开发者自定义的退款单号
...
...
@@ -728,12 +732,12 @@ public class DragonOrderRefundsServiceImpl implements IDragonOrderRefundsService
new
Object
[]{
nowTime
,
dto
.
getRefundAt
(),
DragonConstant
.
RefundStatusEnum
.
STATUS_REFUNDED
.
getCode
(),
refundInfo
.
getString
(
"refund_no"
)},
DragonConstant
.
MysqlRedisQueueEnum
.
DRAGON_REFUND_KEY
.
getCode
()
);
}
else
{
throw
new
LiquidnetServiceException
(
DragonErrorCodeEnum
.
TRADE_DOUYINPAY_QUERY_ERROR
.
getCode
(),
DragonErrorCodeEnum
.
TRADE_DOUYINPAY_QUERY_ERROR
.
getMessage
());
}
else
{
throw
new
LiquidnetServiceException
(
DragonErrorCodeEnum
.
TRADE_DOUYINPAY_QUERY_ERROR
.
getCode
(),
DragonErrorCodeEnum
.
TRADE_DOUYINPAY_QUERY_ERROR
.
getMessage
());
}
return
json
;
}
catch
(
Exception
e
)
{
log
.
info
(
"查询退款报错:{}"
,
e
);
}
catch
(
Exception
e
)
{
log
.
info
(
"查询退款报错:{}"
,
e
);
}
return
""
;
...
...
@@ -748,19 +752,19 @@ public class DragonOrderRefundsServiceImpl implements IDragonOrderRefundsService
try
{
LocalDateTime
nowTime
=
LocalDateTime
.
now
();
String
encoding
=
request
.
getParameter
(
SDKConstants
.
param_encoding
);
Map
<
String
,
String
>
notifyMap
=
unionpayBiz
.
parseNotifyMsg
(
request
);
log
.
info
(
"银联退款回调{}"
,
JSON
.
toJSONString
(
notifyMap
));
Map
<
String
,
String
>
notifyMap
=
unionpayBiz
.
parseNotifyMsg
(
request
);
log
.
info
(
"银联退款回调{}"
,
JSON
.
toJSONString
(
notifyMap
));
if
(!
acpService
.
validate
(
notifyMap
,
encoding
))
{
//验签失败,需解决验签问题
log
.
error
(
"银联回调,验签失败。{}"
,
JSON
.
toJSONString
(
notifyMap
));
log
.
error
(
"银联回调,验签失败。{}"
,
JSON
.
toJSONString
(
notifyMap
));
}
else
{
String
orderId
=
notifyMap
.
get
(
"orderId"
);
//获取后台通知的数据,其他字段也可用类似方式获取
String
orderId
=
notifyMap
.
get
(
"orderId"
);
//获取后台通知的数据,其他字段也可用类似方式获取
String
respCode
=
notifyMap
.
get
(
"respCode"
);
NotifyUrlDto
dto
=
new
NotifyUrlDto
();
//成功
if
(
respCode
.
equals
(
"00"
)||
respCode
.
equals
(
"A6"
))
{
if
(
respCode
.
equals
(
"00"
)
||
respCode
.
equals
(
"A6"
))
{
dto
.
setStatus
(
1
);
}
else
{
}
else
{
dto
.
setStatus
(
0
);
}
//商户订单号 商户退款单号
...
...
@@ -784,11 +788,12 @@ public class DragonOrderRefundsServiceImpl implements IDragonOrderRefundsService
DragonConstant
.
MysqlRedisQueueEnum
.
DRAGON_REFUND_KEY
.
getCode
()
);
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
"ok"
;
}
@Override
public
String
wePayRefundCallBack
(
HttpServletRequest
request
,
HttpServletResponse
response
)
{
InputStream
inStream
;
...
...
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