Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
liuxu0511
jeepay
提交
708aa64b
jeepay
项目概览
liuxu0511
/
jeepay
与 Fork 源项目一致
Fork自
计全科技 / jeepay
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
jeepay
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
708aa64b
编写于
4月 13, 2018
作者:
D
dingzhiwei
提交者:
GitHub
4月 13, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #8 from cbwleft/feature/application_json
Feature/application json
上级
8a195cab
e187c590
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
33 addition
and
18 deletion
+33
-18
.gitignore
.gitignore
+2
-1
xxpay-common/src/main/java/org/xxpay/common/util/PayDigestUtil.java
...on/src/main/java/org/xxpay/common/util/PayDigestUtil.java
+2
-2
xxpay4spring-boot/src/main/java/org/xxpay/boot/ctrl/PayOrderController.java
...src/main/java/org/xxpay/boot/ctrl/PayOrderController.java
+10
-3
xxpay4spring-boot/src/main/java/org/xxpay/boot/ctrl/QueryPayOrderController.java
...ain/java/org/xxpay/boot/ctrl/QueryPayOrderController.java
+13
-6
xxpay4spring-boot/src/main/java/org/xxpay/boot/service/impl/PayChannel4WxServiceImpl.java
...org/xxpay/boot/service/impl/PayChannel4WxServiceImpl.java
+6
-6
未找到文件。
.gitignore
浏览文件 @
708aa64b
/.idea/
*.iml
/log/
target/
\ No newline at end of file
target/
*.project
xxpay-common/src/main/java/org/xxpay/common/util/PayDigestUtil.java
浏览文件 @
708aa64b
...
...
@@ -142,7 +142,7 @@ public class PayDigestUtil {
Field
[]
fields
=
cls
.
getDeclaredFields
();
for
(
Field
f
:
fields
)
{
f
.
setAccessible
(
true
);
if
(
f
.
get
(
o
)
!=
null
&&
f
.
get
(
o
)
!=
""
)
{
if
(
f
.
get
(
o
)
!=
null
&&
!
""
.
equals
(
f
.
get
(
o
))
)
{
list
.
add
(
f
.
getName
()
+
"="
+
f
.
get
(
o
)
+
"&"
);
}
}
...
...
@@ -164,7 +164,7 @@ public class PayDigestUtil {
public
static
String
getSign
(
Map
<
String
,
Object
>
map
,
String
key
){
ArrayList
<
String
>
list
=
new
ArrayList
<
String
>();
for
(
Map
.
Entry
<
String
,
Object
>
entry:
map
.
entrySet
()){
if
(!
""
.
equals
(
entry
.
getValue
())){
if
(!
""
.
equals
(
entry
.
getValue
())
&&
null
!=
entry
.
getValue
()
){
list
.
add
(
entry
.
getKey
()
+
"="
+
entry
.
getValue
()
+
"&"
);
}
}
...
...
xxpay4spring-boot/src/main/java/org/xxpay/boot/ctrl/PayOrderController.java
浏览文件 @
708aa64b
...
...
@@ -5,6 +5,8 @@ import com.alibaba.fastjson.JSONObject;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.math.NumberUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.MediaType
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
...
...
@@ -48,14 +50,19 @@ public class PayOrderController {
*/
@RequestMapping
(
value
=
"/api/pay/create_order"
)
public
String
payOrder
(
@RequestParam
String
params
)
{
_log
.
info
(
"###### 开始接收商户统一下单请求 ######"
);
JSONObject
po
=
JSONObject
.
parseObject
(
params
);
return
payOrder
(
po
);
}
@RequestMapping
(
value
=
"/api/pay/create_order"
,
consumes
=
MediaType
.
APPLICATION_JSON_VALUE
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
String
payOrder
(
@RequestBody
JSONObject
params
)
{
_log
.
info
(
"###### 开始接收商户统一下单请求 ######"
);
String
logPrefix
=
"【商户统一下单】"
;
try
{
JSONObject
po
=
JSONObject
.
parseObject
(
params
);
JSONObject
payContext
=
new
JSONObject
();
JSONObject
payOrder
=
null
;
// 验证参数有效性
Object
object
=
validateParams
(
p
o
,
payContext
);
Object
object
=
validateParams
(
p
arams
,
payContext
);
if
(
object
instanceof
String
)
{
_log
.
info
(
"{}参数校验不通过:{}"
,
logPrefix
,
object
);
return
XXPayUtil
.
makeRetFail
(
XXPayUtil
.
makeRetMap
(
PayConstant
.
RETURN_VALUE_FAIL
,
object
.
toString
(),
null
,
null
));
...
...
xxpay4spring-boot/src/main/java/org/xxpay/boot/ctrl/QueryPayOrderController.java
浏览文件 @
708aa64b
...
...
@@ -3,6 +3,8 @@ package org.xxpay.boot.ctrl;
import
com.alibaba.fastjson.JSONObject
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.MediaType
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
...
...
@@ -42,22 +44,27 @@ public class QueryPayOrderController {
*/
@RequestMapping
(
value
=
"/api/pay/query_order"
)
public
String
queryPayOrder
(
@RequestParam
String
params
)
{
JSONObject
po
=
JSONObject
.
parseObject
(
params
);
return
queryPayOrder
(
po
);
}
@RequestMapping
(
value
=
"/api/pay/query_order"
,
consumes
=
MediaType
.
APPLICATION_JSON_VALUE
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
String
queryPayOrder
(
@RequestBody
JSONObject
params
)
{
_log
.
info
(
"###### 开始接收商户查询支付订单请求 ######"
);
String
logPrefix
=
"【商户支付订单查询】"
;
try
{
JSONObject
po
=
JSONObject
.
parseObject
(
params
);
JSONObject
payContext
=
new
JSONObject
();
// 验证参数有效性
String
errorMessage
=
validateParams
(
p
o
,
payContext
);
String
errorMessage
=
validateParams
(
p
arams
,
payContext
);
if
(!
"success"
.
equalsIgnoreCase
(
errorMessage
))
{
_log
.
warn
(
errorMessage
);
return
XXPayUtil
.
makeRetFail
(
XXPayUtil
.
makeRetMap
(
PayConstant
.
RETURN_VALUE_FAIL
,
errorMessage
,
null
,
null
));
}
_log
.
debug
(
"请求参数及签名校验通过"
);
String
mchId
=
p
o
.
getString
(
"mchId"
);
// 商户ID
String
mchOrderNo
=
p
o
.
getString
(
"mchOrderNo"
);
// 商户订单号
String
payOrderId
=
p
o
.
getString
(
"payOrderId"
);
// 支付订单号
String
executeNotify
=
p
o
.
getString
(
"executeNotify"
);
// 是否执行回调
String
mchId
=
p
arams
.
getString
(
"mchId"
);
// 商户ID
String
mchOrderNo
=
p
arams
.
getString
(
"mchOrderNo"
);
// 商户订单号
String
payOrderId
=
p
arams
.
getString
(
"payOrderId"
);
// 支付订单号
String
executeNotify
=
p
arams
.
getString
(
"executeNotify"
);
// 是否执行回调
JSONObject
payOrder
=
payOrderService
.
queryPayOrder
(
mchId
,
payOrderId
,
mchOrderNo
,
executeNotify
);
_log
.
info
(
"{}查询支付订单,结果:{}"
,
logPrefix
,
payOrder
);
if
(
payOrder
==
null
)
{
...
...
xxpay4spring-boot/src/main/java/org/xxpay/boot/service/impl/PayChannel4WxServiceImpl.java
浏览文件 @
708aa64b
...
...
@@ -97,12 +97,12 @@ public class PayChannel4WxServiceImpl extends BaseService implements IPayChannel
configMap
.
put
(
"appid"
,
appId
);
// 此map用于客户端与微信服务器交互
payInfo
.
put
(
"sign"
,
SignUtils
.
createSign
(
configMap
,
wxPayConfig
.
getMchKey
(),
null
));
payInfo
.
put
(
"prepay
I
d"
,
wxPayUnifiedOrderResult
.
getPrepayId
());
payInfo
.
put
(
"partner
I
d"
,
partnerId
);
payInfo
.
put
(
"app
I
d"
,
appId
);
payInfo
.
put
(
"package
Value
"
,
packageValue
);
payInfo
.
put
(
"time
S
tamp"
,
timestamp
);
payInfo
.
put
(
"nonce
S
tr"
,
nonceStr
);
payInfo
.
put
(
"prepay
i
d"
,
wxPayUnifiedOrderResult
.
getPrepayId
());
payInfo
.
put
(
"partner
i
d"
,
partnerId
);
payInfo
.
put
(
"app
i
d"
,
appId
);
payInfo
.
put
(
"package"
,
packageValue
);
payInfo
.
put
(
"time
s
tamp"
,
timestamp
);
payInfo
.
put
(
"nonce
s
tr"
,
nonceStr
);
map
.
put
(
"payParams"
,
payInfo
);
break
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录