Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
计全科技
jeepay
提交
61ac241b
jeepay
项目概览
计全科技
/
jeepay
通知
10
Star
3
Fork
2
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
6
Wiki
分析
仓库
DevOps
项目成员
Pages
jeepay
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
6
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
61ac241b
编写于
6月 18, 2021
作者:
X
xiaoyu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
微信V3接口退款
上级
072aa10c
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
19 addition
and
8 deletion
+19
-8
jeepay-payment/src/main/java/com/jeequan/jeepay/pay/channel/wxpay/WxpayRefundService.java
.../jeequan/jeepay/pay/channel/wxpay/WxpayRefundService.java
+13
-8
jeepay-payment/src/main/java/com/jeequan/jeepay/pay/channel/wxpay/kits/WxpayV3Util.java
...om/jeequan/jeepay/pay/channel/wxpay/kits/WxpayV3Util.java
+6
-0
未找到文件。
jeepay-payment/src/main/java/com/jeequan/jeepay/pay/channel/wxpay/WxpayRefundService.java
浏览文件 @
61ac241b
...
...
@@ -95,19 +95,13 @@ public class WxpayRefundService extends AbstractRefundService {
amountJson
.
put
(
"refund"
,
refundOrder
.
getRefundAmount
());
// 退款金额
amountJson
.
put
(
"total"
,
payOrder
.
getAmount
());
// 订单总金额
amountJson
.
put
(
"currency"
,
"CNY"
);
// 币种
reqJSON
.
put
(
"amount"
,
amountJson
.
toJSONString
()
);
reqJSON
.
put
(
"amount"
,
amountJson
);
WxPayService
wxPayService
=
mchAppConfigContext
.
getWxServiceWrapper
().
getWxPayService
();
setCretPath
(
mchAppConfigContext
,
wxPayService
);
// 证书路径
if
(
mchAppConfigContext
.
isIsvsubMch
()){
// 特约商户
WxpayIsvsubMchParams
isvsubMchParams
=
mchAppConfigContext
.
getIsvsubMchParamsByIfCode
(
getIfCode
(),
WxpayIsvsubMchParams
.
class
);
reqJSON
.
put
(
"sp_appid"
,
wxPayService
.
getConfig
().
getAppId
());
reqJSON
.
put
(
"sp_mchid"
,
wxPayService
.
getConfig
().
getMchId
());
reqJSON
.
put
(
"sub_mchid"
,
isvsubMchParams
.
getSubMchId
());
reqJSON
.
put
(
"sub_appid"
,
isvsubMchParams
.
getSubMchAppId
());
}
else
{
// 普通商户
reqJSON
.
put
(
"appid"
,
wxPayService
.
getConfig
().
getAppId
());
reqJSON
.
put
(
"mchid"
,
wxPayService
.
getConfig
().
getMchId
());
}
JSONObject
resultJSON
=
WxpayV3Util
.
refundV3
(
reqJSON
,
mchAppConfigContext
.
getWxServiceWrapper
().
getWxPayService
().
getConfig
());
...
...
@@ -116,6 +110,10 @@ public class WxpayRefundService extends AbstractRefundService {
String
refundId
=
resultJSON
.
getString
(
"refund_id"
);
channelRetMsg
.
setChannelState
(
ChannelRetMsg
.
ChannelState
.
CONFIRM_SUCCESS
);
channelRetMsg
.
setChannelOrderId
(
refundId
);
}
else
if
(
"PROCESSING"
.
equals
(
status
)){
// 退款处理中
String
refundId
=
resultJSON
.
getString
(
"refund_id"
);
channelRetMsg
.
setChannelState
(
ChannelRetMsg
.
ChannelState
.
WAITING
);
channelRetMsg
.
setChannelOrderId
(
refundId
);
}
else
{
channelRetMsg
.
setChannelState
(
ChannelRetMsg
.
ChannelState
.
CONFIRM_FAIL
);
channelRetMsg
.
setChannelErrMsg
(
status
);
...
...
@@ -157,7 +155,14 @@ public class WxpayRefundService extends AbstractRefundService {
}
else
if
(
CS
.
PAY_IF_VERSION
.
WX_V3
.
equals
(
mchAppConfigContext
.
getWxServiceWrapper
().
getApiVersion
()))
{
//V3
WxPayService
wxPayService
=
mchAppConfigContext
.
getWxServiceWrapper
().
getWxPayService
();
setCretPath
(
mchAppConfigContext
,
wxPayService
);
// 证书路径
JSONObject
resultJSON
=
WxpayV3Util
.
refundQueryV3
(
refundOrder
.
getRefundOrderId
(),
wxPayService
.
getConfig
());
JSONObject
resultJSON
=
null
;
if
(
mchAppConfigContext
.
isIsvsubMch
())
{
WxpayIsvsubMchParams
isvsubMchParams
=
mchAppConfigContext
.
getIsvsubMchParamsByIfCode
(
getIfCode
(),
WxpayIsvsubMchParams
.
class
);
wxPayService
.
getConfig
().
setSubMchId
(
isvsubMchParams
.
getSubMchId
());
resultJSON
=
WxpayV3Util
.
refundQueryV3Isv
(
refundOrder
.
getRefundOrderId
(),
wxPayService
.
getConfig
());
}
else
{
resultJSON
=
WxpayV3Util
.
refundQueryV3
(
refundOrder
.
getRefundOrderId
(),
wxPayService
.
getConfig
());
}
String
status
=
resultJSON
.
getString
(
"status"
);
if
(
"SUCCESS"
.
equals
(
status
)){
// 退款成功
channelRetMsg
.
setChannelState
(
ChannelRetMsg
.
ChannelState
.
CONFIRM_SUCCESS
);
...
...
jeepay-payment/src/main/java/com/jeequan/jeepay/pay/channel/wxpay/kits/WxpayV3Util.java
浏览文件 @
61ac241b
...
...
@@ -94,6 +94,12 @@ public class WxpayV3Util {
return
JSON
.
parseObject
(
response
);
}
public
static
JSONObject
refundQueryV3Isv
(
String
refundOrderId
,
WxPayConfig
wxPayConfig
)
throws
WxPayException
{
String
url
=
String
.
format
(
"%s/v3/refund/domestic/refunds/%s?sub_mchid=%s"
,
PAY_BASE_URL
,
refundOrderId
,
wxPayConfig
.
getSubMchId
());
String
response
=
getV3
(
url
,
wxPayConfig
);
return
JSON
.
parseObject
(
response
);
}
public
static
String
postV3
(
String
url
,
String
requestStr
,
WxPayConfig
wxPayConfig
)
throws
WxPayException
{
CloseableHttpClient
httpClient
=
createApiV3HttpClient
(
wxPayConfig
);
HttpPost
httpPost
=
createHttpPost
(
url
,
requestStr
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录