Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
IJPay
提交
2fb9871f
I
IJPay
项目概览
int
/
IJPay
9 个月 前同步成功
通知
4
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
I
IJPay
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
2fb9871f
编写于
7月 26, 2019
作者:
J
Javen205
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
✨
添加扫码模式一生成二维码链接
上级
c0555009
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
63 addition
and
1 deletion
+63
-1
IJPay-WxPay/src/main/java/com/ijpay/wxpay/kit/WxPayKit.java
IJPay-WxPay/src/main/java/com/ijpay/wxpay/kit/WxPayKit.java
+63
-1
未找到文件。
IJPay-WxPay/src/main/java/com/ijpay/wxpay/kit/WxPayKit.java
浏览文件 @
2fb9871f
...
...
@@ -138,7 +138,6 @@ public class WxPayKit {
if
(
signType
==
null
)
{
signType
=
SignType
.
MD5
;
}
params
.
put
(
"nonce_str"
,
WxPayKit
.
generateStr
());
params
.
put
(
FIELD_SIGN_TYPE
,
signType
.
getType
());
String
sign
=
createSign
(
params
,
partnerKey
,
signType
);
params
.
put
(
FIELD_SIGN
,
sign
);
...
...
@@ -179,6 +178,69 @@ public class WxPayKit {
return
xmlHelper
.
toMap
();
}
/**
* 生成二维码链接 <br/>
* 原生支付接口模式一(扫码模式一) <br/>
*
* @param sign 签名
* @param appId 公众账号ID
* @param mchId 商户号
* @param productId 商品ID
* @param timeStamp 时间戳
* @param nonceStr 随机字符串
* @return
*/
public
static
String
bizPayUrl
(
String
sign
,
String
appId
,
String
mchId
,
String
productId
,
String
timeStamp
,
String
nonceStr
)
{
String
rules
=
"weixin://wxpay/bizpayurl?sign=Temp&appid=Temp&mch_id=Temp&product_id=Temp&time_stamp=Temp&nonce_str=Temp"
;
return
replace
(
rules
,
"Temp"
,
sign
,
appId
,
mchId
,
productId
,
timeStamp
,
nonceStr
);
}
/**
* 生成二维码链接 <br/>
* 原生支付接口模式一(扫码模式一) <br/>
*
* @param partnerKey 密钥
* @param appId 公众账号ID
* @param mchId 商户号
* @param productId 商品ID
* @param timeStamp 时间戳
* @param nonceStr 随机字符串
* @param signType 签名类型
* @return
*/
public
static
String
bizPayUrl
(
String
partnerKey
,
String
appId
,
String
mchId
,
String
productId
,
String
timeStamp
,
String
nonceStr
,
SignType
signType
)
{
HashMap
<
String
,
String
>
map
=
new
HashMap
<
String
,
String
>();
map
.
put
(
"appid"
,
appId
);
map
.
put
(
"mch_id"
,
mchId
);
map
.
put
(
"time_stamp"
,
StrUtil
.
isEmpty
(
timeStamp
)
?
Long
.
toString
(
System
.
currentTimeMillis
()
/
1000
)
:
timeStamp
);
map
.
put
(
"nonce_str"
,
StrUtil
.
isEmpty
(
nonceStr
)
?
WxPayKit
.
generateStr
()
:
nonceStr
);
map
.
put
(
"product_id"
,
productId
);
return
bizPayUrl
(
createSign
(
map
,
partnerKey
,
signType
),
appId
,
mchId
,
productId
,
timeStamp
,
nonceStr
);
}
/**
* 生成二维码链接 <br/>
* 原生支付接口模式一(扫码模式一) <br/>
*
* @param partnerKey 密钥
* @param appId 公众账号ID
* @param mchId 商户号
* @param productId 商品ID
* @return
*/
public
static
String
bizPayUrl
(
String
partnerKey
,
String
appId
,
String
mchId
,
String
productId
)
{
String
timeStamp
=
Long
.
toString
(
System
.
currentTimeMillis
()
/
1000
);
String
nonceStr
=
WxPayKit
.
generateStr
();
HashMap
<
String
,
String
>
map
=
new
HashMap
<
String
,
String
>();
map
.
put
(
"appid"
,
appId
);
map
.
put
(
"mch_id"
,
mchId
);
map
.
put
(
"time_stamp"
,
timeStamp
);
map
.
put
(
"nonce_str"
,
nonceStr
);
map
.
put
(
"product_id"
,
productId
);
return
bizPayUrl
(
createSign
(
map
,
partnerKey
,
null
),
appId
,
mchId
,
productId
,
timeStamp
,
nonceStr
);
}
/**
* 替换url中的参数
*
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录