Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
Jeepay
Commits
5ae84c42
Commit
5ae84c42
authored
Nov 09, 2021
by
dingzhiwei
Browse files
优化支付工具类
parent
6e569971
Changes
2
Hide whitespace changes
Inline
Side-by-side
jeepay-core/src/main/java/com/jeequan/jeepay/core/utils/JeepayKit.java
View file @
5ae84c42
...
...
@@ -22,6 +22,7 @@ import lombok.extern.slf4j.Slf4j;
import
org.apache.commons.lang3.StringUtils
;
import
java.io.UnsupportedEncodingException
;
import
java.net.URLEncoder
;
import
java.security.MessageDigest
;
import
java.security.NoSuchAlgorithmException
;
import
java.util.ArrayList
;
...
...
@@ -133,7 +134,7 @@ public class JeepayKit {
Set
<
String
>
keySet
=
paraMap
.
keySet
();
int
i
=
0
;
for
(
String
key:
keySet
)
{
urlParam
.
append
(
key
).
append
(
"="
).
append
(
paraMap
.
get
(
key
)
==
null
?
""
:
paraMap
.
get
(
key
)
);
urlParam
.
append
(
key
).
append
(
"="
).
append
(
paraMap
.
get
(
key
)
==
null
?
""
:
doEncode
(
paraMap
.
get
(
key
)
.
toString
())
);
if
(++
i
==
keySet
.
size
())
{
break
;
}
...
...
@@ -142,6 +143,13 @@ public class JeepayKit {
return
urlParam
.
toString
();
}
static
String
doEncode
(
String
str
)
{
if
(
str
.
contains
(
"+"
))
{
return
URLEncoder
.
encode
(
str
);
}
return
str
;
}
/** 校验微信/支付宝二维码是否符合规范, 并根据支付类型返回对应的支付方式 **/
public
static
String
getPayWayCodeByBarCode
(
String
barCode
){
...
...
jeepay-payment/src/main/java/com/jeequan/jeepay/pay/channel/xxpay/XxpayKit.java
View file @
5ae84c42
package
com.jeequan.jeepay.pay.channel.xxpay
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
java.io.UnsupportedEncodingException
;
...
...
@@ -16,6 +17,7 @@ import java.util.Map;
* @site https://www.jeequan.com
* @date 2021/9/20 10:09
*/
@Slf4j
public
class
XxpayKit
{
private
static
String
encodingCharset
=
"UTF-8"
;
...
...
@@ -42,6 +44,7 @@ public class XxpayKit {
}
String
result
=
sb
.
toString
();
result
+=
"key="
+
key
;
log
.
info
(
"signStr:{}"
,
result
);
result
=
md5
(
result
,
encodingCharset
).
toUpperCase
();
return
result
;
}
...
...
Write
Preview
Supports
Markdown
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