|
|
@@ -216,7 +216,7 @@ public class WxPayServiceImpl implements WxPayService {
|
|
|
}
|
|
|
|
|
|
@SneakyThrows
|
|
|
- Object[] handleWxNotify2(HttpServletRequest request,String body) {
|
|
|
+ Object[] handleWxNotify2(HttpServletRequest request, String body) {
|
|
|
var no = RandomUtil.randomInt(1000, 9999);
|
|
|
var signature = request.getHeader("Wechatpay-Signature");
|
|
|
var serial = request.getHeader("Wechatpay-Serial");
|
|
|
@@ -232,6 +232,8 @@ public class WxPayServiceImpl implements WxPayService {
|
|
|
for (int lenght; (lenght = inputStream.read(buffer)) != -1; ) {
|
|
|
result.write(buffer, 0, lenght);
|
|
|
}
|
|
|
+ LOGGER.info("【body1】:{}",request);
|
|
|
+ LOGGER.info("【body2】:{}",body);
|
|
|
|
|
|
|
|
|
LOGGER.info("微信支付回调{}:\nBody数据:\n{}", no, result);
|
|
|
@@ -699,17 +701,14 @@ public class WxPayServiceImpl implements WxPayService {
|
|
|
* event_type为FAPIAO.USER_APPLIED
|
|
|
*
|
|
|
* @param notifyRes
|
|
|
- * @param body
|
|
|
*/
|
|
|
@Override
|
|
|
public void titleWriteNotice(Object[] notifyRes) {
|
|
|
try {
|
|
|
-// TitleWriteNotification titleWriteNotification = ((NotificationParser) notifyRes[1]).parse((RequestParam) notifyRes[0], TitleWriteNotification.class);
|
|
|
- Map<String,Object> titleWriteNotification = ((NotificationParser) notifyRes[1]).parse((RequestParam) notifyRes[0], Map.class);
|
|
|
+ TitleWriteNotification titleWriteNotification = ((NotificationParser) notifyRes[1]).parse((RequestParam) notifyRes[0], TitleWriteNotification.class);
|
|
|
|
|
|
// 查询用户填写的抬头信息
|
|
|
-// var applyId = titleWriteNotification.getFapiaoApplyId();
|
|
|
- var applyId = titleWriteNotification.get("fapiao_apply_id").toString();
|
|
|
+ var applyId = titleWriteNotification.getFapiaoApplyId();
|
|
|
LOGGER.info("回调成功,applyId:{}", applyId);
|
|
|
var buyerInformation = userTitle(applyId);
|
|
|
|
|
|
@@ -757,17 +756,11 @@ public class WxPayServiceImpl implements WxPayService {
|
|
|
* @param applyId
|
|
|
* @return
|
|
|
*/
|
|
|
+ @Override
|
|
|
public FaPiao.BuyerInformation userTitle(String applyId) {
|
|
|
var headers = new HttpHeaders();
|
|
|
headers.addHeader("Accept", "application/json");
|
|
|
- var params = """
|
|
|
- {
|
|
|
- "fapiao_apply_id" : %s,
|
|
|
- "scene" : %s
|
|
|
- }
|
|
|
- """.stripIndent().formatted(applyId, "WITHOUT_WECHATPAY"); // 非微信支付场景
|
|
|
- var requestBody = new JsonRequestBody.Builder().body(params).build();
|
|
|
- var res = wxHttpClient.patch(headers, fapiaoConfig.getDevConfig(), requestBody, FaPiao.BuyerInformation.class);
|
|
|
+ var res = wxHttpClient.get(headers, fapiaoConfig.getUserTitle().formatted(applyId), FaPiao.BuyerInformation.class);
|
|
|
LOGGER.info("用户发票申请applyId:{},抬头信息:{}", applyId, res);
|
|
|
return res.getServiceResponse();
|
|
|
}
|
|
|
@@ -882,7 +875,7 @@ public class WxPayServiceImpl implements WxPayService {
|
|
|
*/
|
|
|
@Override
|
|
|
public void invoiceNotify(HttpServletRequest request, String body) {
|
|
|
- var notifyRes = handleWxNotify2(request,body);
|
|
|
+ var notifyRes = handleWxNotify2(request, body);
|
|
|
var requestParam = (RequestParam) notifyRes[0];
|
|
|
Notification notification = JSONObject.parseObject(requestParam.getBody(), Notification.class);
|
|
|
switch (notification.getEventType()) {
|