| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * FIUU 回调接口 |
| | | * @param request |
| | | */ |
| | | @PostMapping("/notify") |
| | | public void handlePaymentNotification(HttpServletRequest request) { |
| | | // 1. 从POST请求中获取参数 |
| | |
| | | ValidateEntityUtils.ensureEqual(mallOrderInfo.getAmount().toString(), amount, "订单金额异常"); |
| | | // 更新订单状态 |
| | | if ("00".equals(status)) { |
| | | mallOrderInfo.setPayMethod("FIUU支付"); |
| | | mallOrderInfo.setStatus(OrderStatusEnum.WAIT_SHIPPING.getValue()); |
| | | mallOrderInfo.setPayResult("1"); |
| | | mallOrderInfo.setPayTime(DateUtil.parseDateTime(paydate)); |
| | |
| | | } |
| | | } |
| | | |
| | | // Java 回调接口 |
| | | // Java 通知接口 暂时停止使用 |
| | | @PostMapping("/callback") |
| | | public FebsResponse handlePaymentCallback(@RequestParam Map<String, String> params) { |
| | | String secretKey = "59c709fc18978a6a83b87f05d37cecbf"; |
| | |
| | | // 计算 skey 验证 |
| | | String preSkey = DigestUtils.md5Hex(tranID + orderId + status + domain + amount + currency); |
| | | String calculatedSkey = DigestUtils.md5Hex(paydate + domain + preSkey + secretKey); |
| | | MallOrderInfo mallOrderInfo = ValidateEntityUtils.ensureColumnReturnEntity(orderId, MallOrderInfo::getId, mallOrderInfoMapper::selectOne, "订单不存在"); |
| | | |
| | | if("1".equals(mallOrderInfo.getPayResult())){ |
| | | return new FebsResponse().success().data("/pages/order/pay/paySuccess?amount="+ amount +"&type=3"); |
| | | } |
| | | |
| | | if (!calculatedSkey.equals(skey)) { |
| | | throw new FebsException("订单回调失败,---"+orderId); |
| | | } |
| | | |
| | | updateOrderStatus(orderId, status, amount, paydate, tranID); |
| | | return new FebsResponse().success().data("/pages/order/pay/paySuccess?amount="+ amount +"&type=3"); |
| | | if ("00".equals(status)) { |
| | | return new FebsResponse().success().data("/pages/order/pay/paySuccess?amount="+ amount +"&type=3"); |
| | | }else{ |
| | | return new FebsResponse().fail().message("支付失败"); |
| | | } |
| | | } |
| | | |
| | | /** |