|
|
@@ -24,8 +24,9 @@ import com.fs.pay.pay.domain.OrderCallback;
|
|
|
import com.fs.pay.pay.domain.OrderResult;
|
|
|
import com.fs.pay.pay.dto.OrderQueryDTO;
|
|
|
import com.fs.pay.pay.service.PayService;
|
|
|
-import com.fs.pay.pay.util.PayUtil;
|
|
|
+import com.fs.pay.service.IPayNotifyVerifyService;
|
|
|
import com.fs.pay.service.dto.PayNotifyDTO;
|
|
|
+import com.alibaba.fastjson.TypeReference;
|
|
|
import com.fs.pay.service.dto.RefundNotifyDTO;
|
|
|
import com.fs.pay.service.dto.TradeOrder;
|
|
|
import com.fs.store.domain.FsStorePayment;
|
|
|
@@ -107,14 +108,19 @@ public class PayController {
|
|
|
@Autowired
|
|
|
private LiveOrderPaymentMapper liveOrderPaymentMapper;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IPayNotifyVerifyService payNotifyVerifyService;
|
|
|
+
|
|
|
|
|
|
@ApiOperation("台州银行第三方支付回调")
|
|
|
@PostMapping(value="/tzBkPayNotify")
|
|
|
public String tzBkPayNotify( @RequestBody String decryptForm ) throws Exception {
|
|
|
|
|
|
- TzConfigInfoDTO tzConfigInfoDTO = TzConfigUtils.getConfig();
|
|
|
-
|
|
|
- String decrypt = CallBackUtil.decrypt( tzConfigInfoDTO.getAppSecret(),decryptForm);
|
|
|
+ String decrypt = payNotifyVerifyService.decryptTzBankCallback(decryptForm);
|
|
|
+ if (StringUtils.isBlank(decrypt)) {
|
|
|
+ logger.warn("台州银行支付回调验签失败");
|
|
|
+ return "fail";
|
|
|
+ }
|
|
|
logger.info("台州银行第三方支付回调接口被调用,请求参数: {}", decrypt);
|
|
|
|
|
|
String filteredString = decrypt.replaceAll("[^\\x20-\\x7E]", "");
|
|
|
@@ -134,9 +140,11 @@ public class PayController {
|
|
|
@ApiOperation("台州银行第三方退款回调")
|
|
|
@PostMapping(value="/tzRefundNotify")
|
|
|
public String tzRefundNotify(@RequestBody String decryptForm) throws Exception {
|
|
|
- TzConfigInfoDTO tzConfigInfoDTO = TzConfigUtils.getConfig();
|
|
|
-
|
|
|
- String decrypt = CallBackUtil.decrypt( tzConfigInfoDTO.getAppSecret(),decryptForm);
|
|
|
+ String decrypt = payNotifyVerifyService.decryptTzBankCallback(decryptForm);
|
|
|
+ if (StringUtils.isBlank(decrypt)) {
|
|
|
+ logger.warn("台州银行退款回调验签失败");
|
|
|
+ return "fail";
|
|
|
+ }
|
|
|
logger.info("台州银行第三方退款回调,请求参数: {}", JSON.toJSONString(decrypt));
|
|
|
|
|
|
// if(dto.getRefundOrdStatus().equals("90")){
|
|
|
@@ -153,9 +161,14 @@ public class PayController {
|
|
|
|
|
|
@ApiOperation("易宝第三方支付回调")
|
|
|
@PostMapping(value="/ybPayNotify")
|
|
|
- public String ybPayNotify(@RequestBody OrderCallback o) throws Exception {
|
|
|
- logger.info("易宝支付回调: {} ",o);
|
|
|
- //验证
|
|
|
+ public String ybPayNotify(@RequestBody String body) throws Exception {
|
|
|
+ Map<String, String> params = JSON.parseObject(body, new TypeReference<Map<String, String>>() {});
|
|
|
+ if (!payNotifyVerifyService.verifyYibaoCallback(params)) {
|
|
|
+ logger.warn("易宝支付回调签名校验失败");
|
|
|
+ return "fail";
|
|
|
+ }
|
|
|
+ OrderCallback o = JSON.parseObject(body, OrderCallback.class);
|
|
|
+ logger.info("易宝支付回调: {} ", o);
|
|
|
if(o.getState().equals("0")){
|
|
|
OrderQueryDTO orderQueryDTO = new OrderQueryDTO();
|
|
|
orderQueryDTO.setLowOrderId(o.getLowOrderId());
|
|
|
@@ -178,7 +191,10 @@ public class PayController {
|
|
|
@ApiOperation("汇付第三方支付回调")
|
|
|
@PostMapping(value="/hfPayNotify")
|
|
|
public String hfPayNotify(@RequestParam String resp_desc, @RequestParam String resp_code, @RequestParam String sign, @RequestParam String resp_data) throws Exception {
|
|
|
- //验证
|
|
|
+ if (!payNotifyVerifyService.verifyHuifuCallback(resp_data, sign)) {
|
|
|
+ logger.warn("汇付支付回调签名校验失败");
|
|
|
+ return "fail";
|
|
|
+ }
|
|
|
HuiFuResult o = JSON.parseObject(resp_data, HuiFuResult.class);
|
|
|
logger.info("汇付支付回调:"+o);
|
|
|
if(o.getResp_code().equals("00000000")){
|
|
|
@@ -200,25 +216,42 @@ public class PayController {
|
|
|
|
|
|
@RequestMapping("/payOnlineNotifyUrl")
|
|
|
public String asyncHuFuOnlinePay(@RequestParam String resp_desc,@RequestParam String resp_code,@RequestParam String sign,@RequestParam String resp_data) {
|
|
|
+ if (!payNotifyVerifyService.verifyHuifuCallback(resp_data, sign)) {
|
|
|
+ logger.warn("汇付在线支付回调签名校验失败");
|
|
|
+ return "fail";
|
|
|
+ }
|
|
|
HuiFuOnlinePay huFuResult = JSON.parseObject(resp_data, HuiFuOnlinePay.class);
|
|
|
return "ok";
|
|
|
}
|
|
|
@RequestMapping("/onlineRefund")
|
|
|
public String onlineRefund(@RequestParam String resp_desc,@RequestParam String resp_code,@RequestParam String sign,@RequestParam String resp_data) {
|
|
|
+ if (!payNotifyVerifyService.verifyHuifuCallback(resp_data, sign)) {
|
|
|
+ logger.warn("汇付在线退款回调签名校验失败");
|
|
|
+ return "fail";
|
|
|
+ }
|
|
|
HuiFuOnlineRefund huFuResult = JSON.parseObject(resp_data, HuiFuOnlineRefund.class);
|
|
|
return "ok";
|
|
|
}
|
|
|
|
|
|
@RequestMapping("/refundNotifyUrl")
|
|
|
public String refundMessage(@RequestParam String resp_desc,@RequestParam String resp_code,@RequestParam String sign,@RequestParam String resp_data) {
|
|
|
- System.out.println(resp_data);
|
|
|
+ if (!payNotifyVerifyService.verifyHuifuCallback(resp_data, sign)) {
|
|
|
+ logger.warn("汇付退款消息回调签名校验失败");
|
|
|
+ return "fail";
|
|
|
+ }
|
|
|
+ logger.info("汇付退款消息回调: {}", resp_data);
|
|
|
return "ok";
|
|
|
}
|
|
|
|
|
|
|
|
|
@ApiOperation("小雨点第三方支付回调")
|
|
|
@PostMapping(value="/payNotify")
|
|
|
- public String payNotify(HttpServletRequest request,PayNotifyDTO dto) throws Exception {
|
|
|
+ public String payNotify(@RequestBody String body) throws Exception {
|
|
|
+ if (!payNotifyVerifyService.verifyHcPayCallback(body)) {
|
|
|
+ logger.warn("小雨点支付回调签名校验失败");
|
|
|
+ return "fail";
|
|
|
+ }
|
|
|
+ PayNotifyDTO dto = JSON.parseObject(body, PayNotifyDTO.class);
|
|
|
if("SUCCESS".equals(dto.getOrderStatus())) {
|
|
|
//订单号
|
|
|
String tradeNo = dto.getMerchOrderNo();
|
|
|
@@ -247,7 +280,12 @@ public class PayController {
|
|
|
|
|
|
@ApiOperation("小雨点第三方退款回调")
|
|
|
@PostMapping(value="/refundNotify")
|
|
|
- public String refundNotify(HttpServletRequest request, RefundNotifyDTO dto) throws Exception {
|
|
|
+ public String refundNotify(@RequestBody String body) throws Exception {
|
|
|
+ if (!payNotifyVerifyService.verifyHcPayCallback(body)) {
|
|
|
+ logger.warn("小雨点退款回调签名校验失败");
|
|
|
+ return "fail";
|
|
|
+ }
|
|
|
+ RefundNotifyDTO dto = JSON.parseObject(body, RefundNotifyDTO.class);
|
|
|
if("SUCCESS".equals(dto.getOrderStatus())) {
|
|
|
String[] orderIds=dto.getOrigMerchOrderNo().split("-");
|
|
|
FsStorePayment storePayment=null;
|