1
0
mirror of synced 2025-12-27 21:48:01 +08:00

🎨 #2985【企业微信】增加会话存档常量类型支持

This commit is contained in:
0katekate0
2023-04-22 15:51:15 +08:00
committed by GitHub
parent e2e4d345b0
commit 9e190fef36
6 changed files with 104 additions and 21 deletions

View File

@@ -779,7 +779,7 @@ public class BaseWxPayServiceImplTest {
* @throws Exception the exception
*/
@Test
public void testParseOrderNotifyV3Result(HttpServletRequest request, HttpServletResponse response) throws Exception {
public String testParseOrderNotifyV3Result(HttpServletRequest request, HttpServletResponse response) throws Exception {
String timestamp = request.getHeader("Wechatpay-Timestamp");
Optional.ofNullable(timestamp).orElseThrow(() -> new RuntimeException("时间戳不能为空"));
@@ -799,6 +799,8 @@ public class BaseWxPayServiceImplTest {
final WxPayOrderNotifyV3Result wxPayOrderNotifyV3Result = this.payService.parseOrderNotifyV3Result(RequestUtils.readData(request),
new SignatureHeader(timestamp, nonce, signature, serialNo));
log.info(GSON.toJson(wxPayOrderNotifyV3Result));
return WxPayNotifyV3Response.success("成功");
}
/**
@@ -808,7 +810,7 @@ public class BaseWxPayServiceImplTest {
* @throws Exception the exception
*/
@Test
public void testParseRefundNotifyV3Result(HttpServletRequest request, HttpServletResponse response) throws Exception {
public String testParseRefundNotifyV3Result(HttpServletRequest request, HttpServletResponse response) throws Exception {
String timestamp = request.getHeader("Wechatpay-Timestamp");
Optional.ofNullable(timestamp).orElseThrow(() -> new RuntimeException("时间戳不能为空"));
@@ -827,6 +829,21 @@ public class BaseWxPayServiceImplTest {
final WxPayRefundNotifyV3Result wxPayRefundNotifyV3Result = this.payService.parseRefundNotifyV3Result(RequestUtils.readData(request),
new SignatureHeader(timestamp, nonce, signature, serialNo));
log.info(GSON.toJson(wxPayRefundNotifyV3Result));
// 退款金额
final WxPayRefundNotifyV3Result.DecryptNotifyResult result = wxPayRefundNotifyV3Result.getResult();
final BigDecimal total = BaseWxPayRequest.fen2Yuan(BigDecimal.valueOf(result.getAmount().getTotal()));
final BigDecimal payerRefund = BaseWxPayRequest.fen2Yuan(BigDecimal.valueOf(result.getAmount().getPayerRefund()));
// 处理业务逻辑 ...
return WxPayNotifyV3Response.success("成功");
}
@Test
public void testWxPayNotifyV3Response() {
System.out.println(WxPayNotifyV3Response.success("success"));
System.out.println(WxPayNotifyV3Response.fail("fail"));
}
@Test

View File

@@ -1,12 +1,14 @@
<xml>
<appId>公众号appid</appId>
<mchId>微信商户平台ID</mchId>
<!---
以下为官网文档所提供样例参数,仅供部分接口测试使用
<appId>wxd930ea5d5a258f4f</appId>
<mchId>10000100</mchId>
<mchKey>192006250b4c09247ec02edce69f6a2d</mchKey>
-->
<appId>appid</appId>
<mchId>微信商户平台ID</mchId>
<!-- v2版本 -->
<mchKey>商户平台设置的API密钥</mchKey>
<keyPath>商户平台的证书文件地址</keyPath>