Merge remote-tracking branch 'origin/test' into test
# Conflicts: # cash-api/order-server/src/main/java/com/czg/controller/NotifyController.java # cash-sdk/aggregation-pay/src/main/java/com/czg/PayManager.java
This commit is contained in:
@@ -3,9 +3,13 @@ package com.czg.controller;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.io.IoUtil;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.czg.PolyPayUtils;
|
||||
import com.czg.CzgPayUtils;
|
||||
import com.czg.PayCst;
|
||||
import com.czg.constants.PayTypeConstants;
|
||||
import com.czg.entity.PolyBaseResp;
|
||||
import com.czg.dto.req.WechatNotifyReqDto;
|
||||
import com.czg.dto.req.WechatPayNotifyDataDto;
|
||||
import com.czg.entity.CzgBaseRespParams;
|
||||
import com.czg.exception.CzgException;
|
||||
import com.czg.market.entity.MkShopConsumeDiscountRecord;
|
||||
import com.czg.market.service.MkDistributionUserService;
|
||||
import com.czg.market.service.MkShopConsumeDiscountRecordService;
|
||||
@@ -15,15 +19,13 @@ import com.czg.order.entity.OrderPayment;
|
||||
import com.czg.order.service.OrderInfoCustomService;
|
||||
import com.czg.order.service.OrderPaymentService;
|
||||
import com.czg.service.market.service.impl.AppWxServiceImpl;
|
||||
import com.czg.third.wechat.WechatReqUtils;
|
||||
import com.czg.utils.AssertUtil;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@@ -59,10 +61,52 @@ public class NotifyController {
|
||||
return "success";
|
||||
}
|
||||
|
||||
/**
|
||||
* 原生支付回调
|
||||
*/
|
||||
@RequestMapping("/native/pay/{platform}")
|
||||
public String pay(@PathVariable String platform, @RequestBody JSONObject json) {
|
||||
if (PayCst.Platform.WECHAT.equalsIgnoreCase(platform)) {
|
||||
// 微信
|
||||
WechatNotifyReqDto reqDto = JSONObject.parseObject(json.toJSONString(), WechatNotifyReqDto.class);
|
||||
log.info("【微信支付回调】收到微信支付回调 data: {}", JSONObject.toJSONString(reqDto));
|
||||
|
||||
String decrypted = WechatReqUtils.decryptRespParam(null, reqDto);
|
||||
log.info("【微信支付回调】解密数据 {}", decrypted);
|
||||
|
||||
WechatPayNotifyDataDto dataDto = JSONObject.parseObject(decrypted, WechatPayNotifyDataDto.class);
|
||||
return "success";
|
||||
} else if (PayCst.Platform.ALIPAY.equalsIgnoreCase(platform)) {
|
||||
// 支付宝
|
||||
return "success";
|
||||
}
|
||||
throw new CzgException("不支持的支付平台");
|
||||
}
|
||||
|
||||
/**
|
||||
* 原生退款回调
|
||||
*/
|
||||
@RequestMapping("/native/refund/{platform}")
|
||||
public String refund(@PathVariable String platform, @RequestBody JSONObject json) {
|
||||
if (PayCst.Platform.WECHAT.equalsIgnoreCase(platform)) {
|
||||
// 微信
|
||||
WechatNotifyReqDto reqDto = JSONObject.parseObject(json.toJSONString(), WechatNotifyReqDto.class);
|
||||
log.info("【微信退款回调】收到微信退款回调 data: {}", JSONObject.toJSONString(reqDto));
|
||||
String decrypted = WechatReqUtils.decryptRespParam(null, reqDto);
|
||||
log.info("【微信退款回调】解密数据 {}", decrypted);
|
||||
|
||||
return "success";
|
||||
} else if (PayCst.Platform.ALIPAY.equalsIgnoreCase(platform)) {
|
||||
// 支付宝
|
||||
return "success";
|
||||
}
|
||||
throw new CzgException("不支持的支付平台");
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping("/payCallBack")
|
||||
public String notifyCallBack(@RequestBody PolyBaseResp respParams) {
|
||||
JSONObject czg = PolyPayUtils.getCzg(respParams);
|
||||
public String notifyCallBack(@RequestBody CzgBaseRespParams respParams) {
|
||||
JSONObject czg = CzgPayUtils.getCzg(respParams);
|
||||
AssertUtil.isNull(czg, "支付回调数据为空");
|
||||
log.info("支付回调数据为:{}", czg);
|
||||
orderInfoCustomService.payCallBackOrder(czg.getString("mchOrderNo"), czg, 0);
|
||||
@@ -89,10 +133,10 @@ public class NotifyController {
|
||||
|
||||
@RequestMapping("/native/wx/pay/distributionRecharge")
|
||||
public String nativeNotify(HttpServletRequest request) throws IOException {
|
||||
// String timestamp = request.getHeader("Wechatpay-Timestamp");
|
||||
// String nonce = request.getHeader("Wechatpay-Nonce");
|
||||
// String serialNo = request.getHeader("Wechatpay-Serial");
|
||||
// String signature = request.getHeader("Wechatpay-Signature");
|
||||
String timestamp = request.getHeader("Wechatpay-Timestamp");
|
||||
String nonce = request.getHeader("Wechatpay-Nonce");
|
||||
String serialNo = request.getHeader("Wechatpay-Serial");
|
||||
String signature = request.getHeader("Wechatpay-Signature");
|
||||
String result = IoUtil.readUtf8(request.getInputStream());
|
||||
JSONObject jsonObject = JSONObject.parseObject(result);
|
||||
JSONObject resource = jsonObject.getJSONObject("resource");
|
||||
@@ -127,8 +171,8 @@ public class NotifyController {
|
||||
|
||||
|
||||
@RequestMapping("/refundCallBack")
|
||||
public String refundCallBack(@RequestBody PolyBaseResp respParams) {
|
||||
JSONObject czg = PolyPayUtils.getCzg(respParams);
|
||||
public String refundCallBack(@RequestBody CzgBaseRespParams respParams) {
|
||||
JSONObject czg = CzgPayUtils.getCzg(respParams);
|
||||
AssertUtil.isNull(czg, "退款回调数据为空");
|
||||
log.info("退款回调数据为:{}", czg);
|
||||
orderInfoCustomService.refundCallBackOrder(czg.getString("mchOrderNo"), czg);
|
||||
|
||||
Reference in New Issue
Block a user