支付回调
This commit is contained in:
@@ -0,0 +1,31 @@
|
|||||||
|
package com.czg.controller;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
|
import com.czg.CzgPayUtils;
|
||||||
|
import com.czg.entity.CzgBaseRespParams;
|
||||||
|
import com.czg.entity.notify.CzgPayNotifyDTO;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author ww
|
||||||
|
* @description
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@RequestMapping("notify")
|
||||||
|
public class NotifyController {
|
||||||
|
private static final String SUCCESS = "SUCCESS";
|
||||||
|
|
||||||
|
// @Resource
|
||||||
|
// private PayService payService;
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("payCallBack")
|
||||||
|
public String notifyfstCallBack(CzgBaseRespParams respParams) {
|
||||||
|
CzgPayNotifyDTO czg = CzgPayUtils.getCzg(respParams, CzgPayNotifyDTO.class);
|
||||||
|
log.info("支付回调数据为"+ JSONObject.toJSONString(czg));
|
||||||
|
return SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -29,7 +29,7 @@ public class PayController {
|
|||||||
* h5支付
|
* h5支付
|
||||||
*/
|
*/
|
||||||
@PostMapping("h5Pay")
|
@PostMapping("h5Pay")
|
||||||
CzgResult<CzgH5PayResp> h5PayOrder(HttpServletRequest request, @Validated @RequestBody OrderPayParamDTO payParam) {
|
public CzgResult<CzgH5PayResp> h5PayOrder(HttpServletRequest request, @Validated @RequestBody OrderPayParamDTO payParam) {
|
||||||
return payService.h5PayOrder(ServletUtil.getClientIPByHeader(request), payParam);
|
return payService.h5PayOrder(ServletUtil.getClientIPByHeader(request), payParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -40,7 +40,7 @@ public class PayController {
|
|||||||
* openId 必填
|
* openId 必填
|
||||||
*/
|
*/
|
||||||
@PostMapping("jsPay")
|
@PostMapping("jsPay")
|
||||||
CzgResult<CzgJsPayResp> jsPayOrder(HttpServletRequest request, @Validated @RequestBody OrderPayParamDTO payParam) {
|
public CzgResult<CzgJsPayResp> jsPayOrder(HttpServletRequest request, @Validated @RequestBody OrderPayParamDTO payParam) {
|
||||||
return payService.jsPayOrder(ServletUtil.getClientIPByHeader(request), payParam);
|
return payService.jsPayOrder(ServletUtil.getClientIPByHeader(request), payParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -50,7 +50,7 @@ public class PayController {
|
|||||||
* openId 必填
|
* openId 必填
|
||||||
*/
|
*/
|
||||||
@PostMapping("ltPayOrder")
|
@PostMapping("ltPayOrder")
|
||||||
CzgResult<CzgLtPayResp> ltPayOrder(HttpServletRequest request, @Validated @RequestBody OrderPayParamDTO payParam) {
|
public CzgResult<CzgLtPayResp> ltPayOrder(HttpServletRequest request, @Validated @RequestBody OrderPayParamDTO payParam) {
|
||||||
return payService.ltPayOrder(ServletUtil.getClientIPByHeader(request), payParam);
|
return payService.ltPayOrder(ServletUtil.getClientIPByHeader(request), payParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -58,7 +58,7 @@ public class PayController {
|
|||||||
* 正扫
|
* 正扫
|
||||||
*/
|
*/
|
||||||
@PostMapping("scanPay")
|
@PostMapping("scanPay")
|
||||||
CzgResult<CzgScanPayResp> scanPayOrder(HttpServletRequest request, @Validated @RequestBody OrderPayParamDTO payParam) {
|
public CzgResult<CzgScanPayResp> scanPayOrder(HttpServletRequest request, @Validated @RequestBody OrderPayParamDTO payParam) {
|
||||||
return payService.scanPayOrder(ServletUtil.getClientIPByHeader(request), payParam);
|
return payService.scanPayOrder(ServletUtil.getClientIPByHeader(request), payParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,7 +67,7 @@ public class PayController {
|
|||||||
* authCode 必填 扫描码
|
* authCode 必填 扫描码
|
||||||
*/
|
*/
|
||||||
@PostMapping("microPay")
|
@PostMapping("microPay")
|
||||||
CzgResult<CzgMicroPayResp> microPayOrder(@Validated @RequestBody OrderPayParamDTO payParam) {
|
public CzgResult<CzgMicroPayResp> microPayOrder(@Validated @RequestBody OrderPayParamDTO payParam) {
|
||||||
return payService.microPayOrder(payParam);
|
return payService.microPayOrder(payParam);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("admin/order")
|
@RequestMapping("admin/order")
|
||||||
public class OrderController {
|
public class AdminOrderController {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private OrderInfoService orderInfoService;
|
private OrderInfoService orderInfoService;
|
||||||
@@ -18,7 +18,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/user/order")
|
@RequestMapping("/user/order")
|
||||||
public class OrderController {
|
public class UserOrderController {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private OrderInfoService orderInfoService;
|
private OrderInfoService orderInfoService;
|
||||||
@@ -155,6 +155,23 @@ public class CzgPayUtils {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static <T> T getCzg(CzgBaseRespParams respParams, Class<T> clazz) {
|
||||||
|
AssertUtil.isNull(respParams, "超掌柜交易 回调数据为空");
|
||||||
|
// CzgBaseRespParams respParams = JSONObject.parseObject(dataJsonStr, CzgBaseRespParams.class);
|
||||||
|
log.info("超掌柜交易请求响应,{}", respParams);
|
||||||
|
if (!"000000".equals(respParams.getCode())) {
|
||||||
|
log.error("超掌柜回调响应失败,{}", respParams);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (StrUtil.isNotBlank(respParams.getSign())) {
|
||||||
|
if (validateSign(respParams.getSign(), respParams.getBizData())) {
|
||||||
|
log.error("超掌柜回调 验签失败,{}", respParams);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return JSONObject.parseObject(respParams.getBizData(), clazz);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 默认Post
|
* 默认Post
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user