Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
baa-pay-server
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
贺超
baa-pay-server
Commits
e6978bd5
Commit
e6978bd5
authored
Sep 09, 2021
by
刘李鹏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
删除测试代码
parent
a98df19f
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
0 additions
and
712 deletions
+0
-712
pom.xml
baa-pay-server/pom.xml
+0
-10
AlipayController.java
...src/main/java/cn/quant/baa/pay/rest/AlipayController.java
+0
-170
WxpayController.java
.../src/main/java/cn/quant/baa/pay/rest/WxpayController.java
+0
-532
No files found.
baa-pay-server/pom.xml
View file @
e6978bd5
...
@@ -67,16 +67,6 @@
...
@@ -67,16 +67,6 @@
<artifactId>
junit
</artifactId>
<artifactId>
junit
</artifactId>
<scope>
test
</scope>
<scope>
test
</scope>
</dependency>
</dependency>
<dependency>
<groupId>
com.alipay.sdk
</groupId>
<artifactId>
alipay-sdk-java
</artifactId>
<version>
4.16.21.ALL
</version>
</dependency>
<dependency>
<groupId>
com.github.wechatpay-apiv3
</groupId>
<artifactId>
wechatpay-apache-httpclient
</artifactId>
<version>
0.2.2
</version>
</dependency>
</dependencies>
</dependencies>
<build>
<build>
...
...
baa-pay-server/src/main/java/cn/quant/baa/pay/rest/AlipayController.java
deleted
100644 → 0
View file @
a98df19f
package
cn
.
quant
.
baa
.
pay
.
rest
;
import
cn.quant.baa.pay.annotation.BusinessMapping
;
import
cn.quant.baa.pay.context.TransactionSession
;
import
cn.quant.spring.rest.AbstractController
;
import
com.alipay.api.AlipayClient
;
import
com.alipay.api.CertAlipayRequest
;
import
com.alipay.api.DefaultAlipayClient
;
import
com.alipay.api.domain.AlipayTradeAppPayModel
;
import
com.alipay.api.domain.AlipayTradePagePayModel
;
import
com.alipay.api.domain.AlipayTradeWapPayModel
;
import
com.alipay.api.request.AlipayTradeAppPayRequest
;
import
com.alipay.api.request.AlipayTradePagePayRequest
;
import
com.alipay.api.request.AlipayTradeWapPayRequest
;
import
com.alipay.api.response.AlipayTradePagePayResponse
;
import
com.alipay.api.response.AlipayTradeWapPayResponse
;
import
org.springframework.web.bind.annotation.*
;
import
javax.crypto.Cipher
;
import
javax.crypto.spec.GCMParameterSpec
;
import
javax.crypto.spec.SecretKeySpec
;
import
java.nio.charset.Charset
;
import
java.util.UUID
;
/**
* Created with IntelliJ IDEA.
* Author: Lipeng Liu
* Date: 2021/8/31
* Time: 上午10:36
* Description: No Description
*/
@RestController
@RequestMapping
(
"alipay"
)
public
class
AlipayController
extends
AbstractController
{
@ResponseBody
@GetMapping
(
"/h5"
)
public
String
h5
()
{
try
{
// 1. 创建AlipayClient实例
AlipayClient
alipayClient
=
new
DefaultAlipayClient
(
getClientParams
());
// 2. 创建使用的Open API对应的Request请求对象
AlipayTradeWapPayRequest
request
=
getRequestH5
();
// 3. 发起请求并处理响应
AlipayTradeWapPayResponse
response
=
alipayClient
.
pageExecute
(
request
);
if
(
response
.
isSuccess
())
{
System
.
out
.
println
(
"调用成功。"
);
return
response
.
getBody
();
}
else
{
System
.
out
.
println
(
"调用失败,原因:"
+
response
.
getMsg
()
+
","
+
response
.
getSubMsg
());
}
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
"调用遭遇异常,原因:"
+
e
.
getMessage
());
throw
new
RuntimeException
(
e
.
getMessage
(),
e
);
}
return
null
;
}
@ResponseBody
@GetMapping
(
"/web"
)
public
String
web
()
{
try
{
// 1. 创建AlipayClient实例
AlipayClient
alipayClient
=
new
DefaultAlipayClient
(
getClientParams
());
// 2. 创建使用的Open API对应的Request请求对象
AlipayTradePagePayRequest
request
=
getRequestWeb
();
// 3. 发起请求并处理响应
AlipayTradePagePayResponse
response
=
alipayClient
.
pageExecute
(
request
);
if
(
response
.
isSuccess
())
{
System
.
out
.
println
(
"调用成功。"
);
return
response
.
getBody
();
}
else
{
System
.
out
.
println
(
"调用失败,原因:"
+
response
.
getMsg
()
+
","
+
response
.
getSubMsg
());
}
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
"调用遭遇异常,原因:"
+
e
.
getMessage
());
throw
new
RuntimeException
(
e
.
getMessage
(),
e
);
}
return
null
;
}
@ResponseBody
@GetMapping
(
"/app"
)
public
String
app
()
{
try
{
// 1. 创建AlipayClient实例
AlipayClient
alipayClient
=
new
DefaultAlipayClient
(
getClientParams
());
// 2. 创建使用的Open API对应的Request请求对象
AlipayTradePagePayRequest
request
=
getRequestWeb
();
// 3. 发起请求并处理响应
AlipayTradePagePayResponse
response
=
alipayClient
.
sdkExecute
(
request
);
if
(
response
.
isSuccess
())
{
System
.
out
.
println
(
"调用成功。"
);
return
response
.
getBody
();
}
else
{
System
.
out
.
println
(
"调用失败,原因:"
+
response
.
getMsg
()
+
","
+
response
.
getSubMsg
());
}
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
"调用遭遇异常,原因:"
+
e
.
getMessage
());
throw
new
RuntimeException
(
e
.
getMessage
(),
e
);
}
return
null
;
}
private
static
CertAlipayRequest
getClientParams
()
{
CertAlipayRequest
certParams
=
new
CertAlipayRequest
();
certParams
.
setServerUrl
(
"https://openapi.alipay.com/gateway.do"
);
//请更换为您的AppId
certParams
.
setAppId
(
"2021002106644714"
);
//请更换为您的PKCS8格式的应用私钥
certParams
.
setPrivateKey
(
"MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQC3rgHa/x67gaY08RJoeVWLghAiQooLG/dOojW+639RAuirhxLyeuawbcch291uj/90MPTQy86n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lrq7kxKqgLwR72FHmqrebD7Gd3f/m2T25Tq3sMBZf0FqNwAjP1Gw5GdF4gZr9EAQQKBgQCQrWgxxTUMlOAd1hru3+kxzIBIl67sq5a0HjTmbPbMSwrO5EQE0B09J8NalX198bFDhqqn+utH6kG8e9FSoyiWJ8yZj9OB8OPffGa5PUhwWNaxXOo7ZoNIbnp9H7na6aBmTIY2ZaPMGwcA9t4u1rnrhGmu2gq176RQ4FdDLRk/BQKBgQDU+Oab3jL2MoDMtGk4ZGYQUcTMB/ILtG4O1bx8BhJZ/Rula3Rt7dYPrRng3uZ0sTVh7/QRSn02hLY72UoItge3POZMEbNQLb+gzhIuU4v4hLT3H6WK2MSaLftsb9mPyW9LX76xQS4ayf5xZqeKK2jOtIZCsiLmC/ALvIytcr2DHA=="
);
//请更换为您使用的字符集编码,推荐采用utf-8
certParams
.
setCharset
(
"utf-8"
);
certParams
.
setFormat
(
"json"
);
certParams
.
setSignType
(
"RSA2"
);
//请更换为您的应用公钥证书文件路径
certParams
.
setCertPath
(
"/Users/liulipeng/Web/lianghuapai/baa-pay/baa-pay-server/src/main/resources/alipay/appCertPublicKey_2021002106644714.crt"
);
//请更换您的支付宝公钥证书文件路径
certParams
.
setAlipayPublicCertPath
(
"/Users/liulipeng/Web/lianghuapai/baa-pay/baa-pay-server/src/main/resources/alipay/alipayCertPublicKey_RSA2.crt"
);
//更换为支付宝根证书文件路径
certParams
.
setRootCertPath
(
"/Users/liulipeng/Web/lianghuapai/baa-pay/baa-pay-server/src/main/resources/alipay/alipayRootCert.crt"
);
return
certParams
;
}
private
static
AlipayTradeWapPayRequest
getRequestH5
()
{
// 初始化Request,并填充Model属性。实际调用时请替换为您想要使用的API对应的Request对象。
AlipayTradeWapPayRequest
request
=
new
AlipayTradeWapPayRequest
();
AlipayTradeWapPayModel
model
=
new
AlipayTradeWapPayModel
();
model
.
setOutTradeNo
(
UUID
.
randomUUID
().
toString
().
replace
(
"-"
,
""
));
model
.
setProductCode
(
"QUICK_WAP_WAY"
);
model
.
setTotalAmount
(
"0.01"
);
model
.
setSubject
(
"这是订单标题"
);
model
.
setBody
(
"这是订单描述"
);
request
.
setBizModel
(
model
);
request
.
setNotifyUrl
(
""
);
request
.
setReturnUrl
(
""
);
return
request
;
}
private
static
AlipayTradePagePayRequest
getRequestWeb
()
{
// 初始化Request,并填充Model属性。实际调用时请替换为您想要使用的API对应的Request对象。
AlipayTradePagePayRequest
request
=
new
AlipayTradePagePayRequest
();
AlipayTradePagePayModel
model
=
new
AlipayTradePagePayModel
();
model
.
setOutTradeNo
(
UUID
.
randomUUID
().
toString
().
replace
(
"-"
,
""
));
model
.
setProductCode
(
"FAST_INSTANT_TRADE_PAY"
);
model
.
setTotalAmount
(
"0.01"
);
model
.
setSubject
(
"这是订单标题"
);
model
.
setBody
(
"这是订单描述"
);
request
.
setBizModel
(
model
);
request
.
setNotifyUrl
(
""
);
request
.
setReturnUrl
(
""
);
return
request
;
}
private
static
AlipayTradeAppPayRequest
getRequestApp
()
{
// 初始化Request,并填充Model属性。实际调用时请替换为您想要使用的API对应的Request对象。
AlipayTradeAppPayRequest
request
=
new
AlipayTradeAppPayRequest
();
AlipayTradeAppPayModel
model
=
new
AlipayTradeAppPayModel
();
model
.
setOutTradeNo
(
UUID
.
randomUUID
().
toString
().
replace
(
"-"
,
""
));
model
.
setProductCode
(
"QUICK_MSECURITY_PAY"
);
model
.
setTotalAmount
(
"0.01"
);
model
.
setSubject
(
"这是订单标题"
);
model
.
setBody
(
"这是订单描述"
);
request
.
setBizModel
(
model
);
request
.
setNotifyUrl
(
""
);
request
.
setReturnUrl
(
""
);
return
request
;
}
}
baa-pay-server/src/main/java/cn/quant/baa/pay/rest/WxpayController.java
deleted
100644 → 0
View file @
a98df19f
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
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