fix(pay): 修复 fiuu 支付回调和退款查询相关问题
- 添加支付回调日志,便于调试和排查问题
- 修复退款查询接口返回数据解析错误
- 优化 RefundStatus 模型,增加 ReasonMsg 字段
| | |
| | | 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, "订单不存在"); |
| | | |
| | | log.info("callback payResult: {}", mallOrderInfo.getPayResult()); |
| | | if("1".equals(mallOrderInfo.getPayResult())){ |
| | | return new FebsResponse().success().data("/pages/order/pay/paySuccess?amount="+ amount +"&type=3"); |
| | | } |
| | | |
| | | log.info("callback skey: {}", preSkey); |
| | | log.info("callback calculatedSkey: {}", calculatedSkey); |
| | | |
| | | if (!calculatedSkey.equals(skey)) { |
| | | throw new FebsException("订单回调失败,---"+orderId); |
| | | } |
| | |
| | | private String RefundID; |
| | | private String Status; |
| | | private String LastUpdate; |
| | | private String ReasonMsg; |
| | | private String FPXTxnID; |
| | | } |
| | |
| | | import org.apache.http.util.EntityUtils; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | import java.util.concurrent.*; |
| | | |
| | | @Service(value="FiuuRefundUtil") |
| | |
| | | HttpGet request = new HttpGet(url); |
| | | try (CloseableHttpClient client = HttpClients.createDefault()) { |
| | | String response = EntityUtils.toString(client.execute(request).getEntity()); |
| | | return objectMapper.readValue(response, RefundStatus.class); |
| | | List<RefundStatus> refundStatusList = objectMapper.readValue( |
| | | response, |
| | | objectMapper.getTypeFactory().constructCollectionType(List.class, RefundStatus.class)); |
| | | return refundStatusList.get(0); |
| | | } |
| | | } |
| | | |