1
0
mirror of synced 2025-12-25 20:17:56 +08:00

🆕 #2022 【微信支付】增加智慧商圈相关接口和解析支付营销代金券核销回调消息的方法

* 增加解析支付营销代金券核销回调消息解析

* 增加微信支付智慧商圈接口和回调解析

Co-authored-by: 黄星 <huang.xing@aquilaflycloud.com>
This commit is contained in:
thinsstar
2021-03-09 16:12:11 +08:00
committed by GitHub
parent e46c6c1995
commit 30155b316b
25 changed files with 1226 additions and 56 deletions

View File

@@ -0,0 +1,79 @@
package com.github.binarywang.wxpay.service.impl;
import com.github.binarywang.wxpay.bean.businesscircle.BusinessCircleNotifyData;
import com.github.binarywang.wxpay.bean.businesscircle.PaidResult;
import com.github.binarywang.wxpay.bean.businesscircle.PointsNotifyRequest;
import com.github.binarywang.wxpay.bean.businesscircle.RefundResult;
import com.github.binarywang.wxpay.bean.ecommerce.SignatureHeader;
import com.github.binarywang.wxpay.exception.WxPayException;
import com.github.binarywang.wxpay.service.WxPayService;
import com.github.binarywang.wxpay.testbase.ApiTestModule;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.inject.Inject;
import lombok.extern.slf4j.Slf4j;
import org.testng.annotations.Guice;
import org.testng.annotations.Test;
/**
* <pre>
* 智慧商圈测试类
* </pre>
*
* @author thinsstar
*/
@Slf4j
@Test
@Guice(modules = ApiTestModule.class)
public class BusinessCircleServiceImplTest {
@Inject
private WxPayService wxPayService;
private static final Gson GSON = new GsonBuilder().create();
@Test
public void testNotifyPointsV3() throws WxPayException {
PointsNotifyRequest request = new PointsNotifyRequest();
String subMchid = "商圈商户ID";
String transactionId = "微信订单号";
String appId = "公众号id";
String openId = "微信openid";
request.setSubMchid(subMchid);
request.setTransactionId(transactionId);
request.setAppid(appId);
request.setOpenid(openId);
request.setEarnPoints(true);
request.setIncreasedPoints(10);
request.setPointsUpdateTime("2021-03-03T13:29:35.120+08:00");
wxPayService.getBusinessCircleService().notifyPoints(request);
}
@Test
public void testDecryptPaidNotifyDataResource() throws WxPayException {
SignatureHeader header = new SignatureHeader();
header.setSerialNo("Wechatpay-Serial");
header.setTimeStamp("Wechatpay-Timestamp");
header.setNonce("Wechatpay-Nonce");
header.setSigned("Wechatpay-Signature");
String data = "body";
BusinessCircleNotifyData notifyData = wxPayService.getBusinessCircleService().parseNotifyData(data, header);
PaidResult result = wxPayService.getBusinessCircleService().decryptPaidNotifyDataResource(notifyData);
log.info("result: {}", GSON.toJson(result));
}
@Test
public void testDecryptRefundNotifyDataResource() throws WxPayException {
SignatureHeader header = new SignatureHeader();
header.setSerialNo("Wechatpay-Serial");
header.setTimeStamp("Wechatpay-Timestamp");
header.setNonce("Wechatpay-Nonce");
header.setSigned("Wechatpay-Signature");
String data = "body";
BusinessCircleNotifyData notifyData = wxPayService.getBusinessCircleService().parseNotifyData(data, header);
RefundResult result = wxPayService.getBusinessCircleService().decryptRefundNotifyDataResource(notifyData);
log.info("result: {}", GSON.toJson(result));
}
}