Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
IJPay
提交
eaedbf72
I
IJPay
项目概览
int
/
IJPay
12 个月 前同步成功
通知
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,发现更多精彩内容 >>
提交
eaedbf72
编写于
9月 18, 2022
作者:
J
Javen205
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
✨
优化示例
上级
918dd6e9
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
54 addition
and
52 deletion
+54
-52
IJPay-Demo-SpringBoot/src/main/java/com/ijpay/demo/controller/alipay/AliPayController.java
...va/com/ijpay/demo/controller/alipay/AliPayController.java
+26
-49
IJPay-Demo-SpringBoot/src/main/java/com/ijpay/demo/controller/wxpay/WxPayV3Controller.java
...va/com/ijpay/demo/controller/wxpay/WxPayV3Controller.java
+28
-3
未找到文件。
IJPay-Demo-SpringBoot/src/main/java/com/ijpay/demo/controller/alipay/AliPayController.java
浏览文件 @
eaedbf72
package
com.ijpay.demo.controller.alipay
;
package
com.ijpay.demo.controller.alipay
;
import
cn.hutool.core.date.DateUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alipay.api.AlipayApiException
;
import
com.alipay.api.AlipayApiException
;
import
com.alipay.api.domain.*
;
import
com.alipay.api.domain.AlipayCommerceCityfacilitatorVoucherGenerateModel
;
import
com.alipay.api.domain.AlipayDataDataserviceBillDownloadurlQueryModel
;
import
com.alipay.api.domain.AlipayFundAccountQueryModel
;
import
com.alipay.api.domain.AlipayFundAuthOrderFreezeModel
;
import
com.alipay.api.domain.AlipayFundCouponOrderAgreementPayModel
;
import
com.alipay.api.domain.AlipayFundTransCommonQueryModel
;
import
com.alipay.api.domain.AlipayFundTransOrderQueryModel
;
import
com.alipay.api.domain.AlipayFundTransToaccountTransferModel
;
import
com.alipay.api.domain.AlipayFundTransUniTransferModel
;
import
com.alipay.api.domain.AlipayOpenAuthTokenAppModel
;
import
com.alipay.api.domain.AlipayOpenAuthTokenAppQueryModel
;
import
com.alipay.api.domain.AlipayTradeAppPayModel
;
import
com.alipay.api.domain.AlipayTradeCancelModel
;
import
com.alipay.api.domain.AlipayTradeCloseModel
;
import
com.alipay.api.domain.AlipayTradeCreateModel
;
import
com.alipay.api.domain.AlipayTradeOrderSettleModel
;
import
com.alipay.api.domain.AlipayTradePagePayModel
;
import
com.alipay.api.domain.AlipayTradePayModel
;
import
com.alipay.api.domain.AlipayTradePrecreateModel
;
import
com.alipay.api.domain.AlipayTradeQueryModel
;
import
com.alipay.api.domain.AlipayTradeRefundModel
;
import
com.alipay.api.domain.AlipayTradeWapPayModel
;
import
com.alipay.api.domain.Participant
;
import
com.alipay.api.internal.util.AlipaySignature
;
import
com.alipay.api.internal.util.AlipaySignature
;
import
com.alipay.api.response.AlipayFundAuthOrderFreezeResponse
;
import
com.alipay.api.response.AlipayFundAuthOrderFreezeResponse
;
import
com.alipay.api.response.AlipayFundCouponOrderAgreementPayResponse
;
import
com.alipay.api.response.AlipayFundCouponOrderAgreementPayResponse
;
...
@@ -12,8 +32,6 @@ import com.alipay.api.response.AlipayTradeCreateResponse;
...
@@ -12,8 +32,6 @@ import com.alipay.api.response.AlipayTradeCreateResponse;
import
com.ijpay.alipay.AliPayApi
;
import
com.ijpay.alipay.AliPayApi
;
import
com.ijpay.alipay.AliPayApiConfig
;
import
com.ijpay.alipay.AliPayApiConfig
;
import
com.ijpay.alipay.AliPayApiConfigKit
;
import
com.ijpay.alipay.AliPayApiConfigKit
;
import
com.ijpay.core.kit.PayKit
;
import
com.ijpay.core.kit.RsaKit
;
import
com.ijpay.demo.entity.AliPayBean
;
import
com.ijpay.demo.entity.AliPayBean
;
import
com.ijpay.demo.utils.StringUtils
;
import
com.ijpay.demo.utils.StringUtils
;
import
com.ijpay.demo.vo.AjaxResult
;
import
com.ijpay.demo.vo.AjaxResult
;
...
@@ -27,7 +45,6 @@ import org.springframework.web.bind.annotation.ResponseBody;
...
@@ -27,7 +45,6 @@ import org.springframework.web.bind.annotation.ResponseBody;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -130,49 +147,6 @@ public class AliPayController extends AbstractAliPayApiController {
...
@@ -130,49 +147,6 @@ public class AliPayController extends AbstractAliPayApiController {
return
result
;
return
result
;
}
}
@RequestMapping
(
value
=
"/wapPayNoSdk"
)
@ResponseBody
public
void
wapPayNoSdk
(
HttpServletResponse
response
)
{
try
{
AliPayApiConfig
aliPayApiConfig
=
AliPayApiConfigKit
.
getAliPayApiConfig
();
Map
<
String
,
String
>
paramsMap
=
new
HashMap
<>();
paramsMap
.
put
(
"app_id"
,
aliPayApiConfig
.
getAppId
());
paramsMap
.
put
(
"method"
,
"alipay.trade.wap.pay"
);
paramsMap
.
put
(
"return_url"
,
aliPayBean
.
getDomain
()
+
RETURN_URL
);
paramsMap
.
put
(
"charset"
,
aliPayApiConfig
.
getCharset
());
paramsMap
.
put
(
"sign_type"
,
aliPayApiConfig
.
getSignType
());
paramsMap
.
put
(
"timestamp"
,
DateUtil
.
format
(
new
Date
(),
"yyyy-MM-dd HH:mm:ss"
));
paramsMap
.
put
(
"version"
,
"1.0"
);
paramsMap
.
put
(
"notify_url"
,
aliPayBean
.
getDomain
()
+
NOTIFY_URL
);
Map
<
String
,
String
>
bizMap
=
new
HashMap
<>();
bizMap
.
put
(
"body"
,
"IJPay 聚合支付-H5"
);
bizMap
.
put
(
"subject"
,
"IJPay 让支付触手可及"
);
bizMap
.
put
(
"out_trade_no"
,
StringUtils
.
getOutTradeNo
());
bizMap
.
put
(
"total_amount"
,
"6.66"
);
bizMap
.
put
(
"product_code"
,
"QUICK_WAP_WAY"
);
paramsMap
.
put
(
"biz_content"
,
JSON
.
toJSONString
(
bizMap
));
String
content
=
PayKit
.
createLinkString
(
paramsMap
);
System
.
out
.
println
(
content
);
String
encrypt
=
RsaKit
.
encryptByPrivateKey
(
content
,
aliPayApiConfig
.
getPrivateKey
());
System
.
out
.
println
(
encrypt
);
// encrypt = AlipaySignature.rsaSign(content,aliPayApiConfig.getPrivateKey(), "UTF-8","RSA2");
// System.out.println(encrypt);
paramsMap
.
put
(
"sign"
,
encrypt
);
String
url
=
aliPayApiConfig
.
getServiceUrl
()
+
"?"
+
PayKit
.
createLinkString
(
paramsMap
,
true
);
System
.
out
.
println
(
url
);
response
.
sendRedirect
(
url
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
@RequestMapping
(
value
=
"/wapPay"
)
@RequestMapping
(
value
=
"/wapPay"
)
@ResponseBody
@ResponseBody
public
void
wapPay
(
HttpServletResponse
response
)
{
public
void
wapPay
(
HttpServletResponse
response
)
{
...
@@ -233,6 +207,9 @@ public class AliPayController extends AbstractAliPayApiController {
...
@@ -233,6 +207,9 @@ public class AliPayController extends AbstractAliPayApiController {
// model.setExtendParams(extendParams);
// model.setExtendParams(extendParams);
AliPayApi
.
tradePage
(
response
,
model
,
notifyUrl
,
returnUrl
);
AliPayApi
.
tradePage
(
response
,
model
,
notifyUrl
,
returnUrl
);
// https://opensupport.alipay.com/support/helpcenter/192/201602488772?ant_source=antsupport
// Alipay Easy SDK(新版)目前只支持输出form表单,不支持打印出url链接。
// AliPayApi.tradePage(response, "GET", model, notifyUrl, returnUrl);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
...
...
IJPay-Demo-SpringBoot/src/main/java/com/ijpay/demo/controller/wxpay/WxPayV3Controller.java
浏览文件 @
eaedbf72
...
@@ -20,7 +20,12 @@ import com.ijpay.demo.entity.WxPayV3Bean;
...
@@ -20,7 +20,12 @@ import com.ijpay.demo.entity.WxPayV3Bean;
import
com.ijpay.wxpay.WxPayApi
;
import
com.ijpay.wxpay.WxPayApi
;
import
com.ijpay.wxpay.enums.WxApiType
;
import
com.ijpay.wxpay.enums.WxApiType
;
import
com.ijpay.wxpay.enums.WxDomain
;
import
com.ijpay.wxpay.enums.WxDomain
;
import
com.ijpay.wxpay.model.v3.*
;
import
com.ijpay.wxpay.model.v3.Amount
;
import
com.ijpay.wxpay.model.v3.Payer
;
import
com.ijpay.wxpay.model.v3.RefundAmount
;
import
com.ijpay.wxpay.model.v3.RefundGoodsDetail
;
import
com.ijpay.wxpay.model.v3.RefundModel
;
import
com.ijpay.wxpay.model.v3.UnifiedOrderModel
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.stereotype.Controller
;
...
@@ -32,11 +37,18 @@ import javax.annotation.Resource;
...
@@ -32,11 +37,18 @@ import javax.annotation.Resource;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.ByteArrayInputStream
;
import
java.io.ByteArrayInputStream
;
import
java.io.ByteArrayOutputStream
;
import
java.io.File
;
import
java.io.File
;
import
java.io.InputStream
;
import
java.nio.charset.StandardCharsets
;
import
java.nio.charset.StandardCharsets
;
import
java.security.PrivateKey
;
import
java.security.PrivateKey
;
import
java.security.cert.X509Certificate
;
import
java.security.cert.X509Certificate
;
import
java.util.*
;
import
java.util.ArrayList
;
import
java.util.Calendar
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
/**
* <p>IJPay 让支付触手可及,封装了微信支付、支付宝支付、银联支付常用的支付方式以及各种常用的接口。</p>
* <p>IJPay 让支付触手可及,封装了微信支付、支付宝支付、银联支付常用的支付方式以及各种常用的接口。</p>
...
@@ -69,8 +81,21 @@ public class WxPayV3Controller {
...
@@ -69,8 +81,21 @@ public class WxPayV3Controller {
public
String
index
()
{
public
String
index
()
{
log
.
info
(
wxPayV3Bean
.
toString
());
log
.
info
(
wxPayV3Bean
.
toString
());
try
{
try
{
String
absolutePath
=
PayKit
.
getAbsolutePath
(
"classpath:/dev/apiclient_cert.p12"
);
String
classPath
=
"classpath:/dev/apiclient_cert.p12"
;
String
v3
=
"classpath:/dev/wxpay_v3.properties"
;
String
absolutePath
=
PayKit
.
getAbsolutePath
(
classPath
);
log
.
info
(
"absolutePath:{}"
,
absolutePath
);
log
.
info
(
"absolutePath:{}"
,
absolutePath
);
InputStream
inputStream
=
PayKit
.
getCertFileInputStream
(
v3
);
if
(
null
!=
inputStream
)
{
ByteArrayOutputStream
result
=
new
ByteArrayOutputStream
();
byte
[]
buffer
=
new
byte
[
1024
];
int
length
;
while
((
length
=
inputStream
.
read
(
buffer
))
!=
-
1
)
{
result
.
write
(
buffer
,
0
,
length
);
}
String
str
=
result
.
toString
();
log
.
info
(
"file content:{}"
,
str
);
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"文件不存在"
,
e
);
log
.
error
(
"文件不存在"
,
e
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录