|
|
@@ -2,10 +2,12 @@ package com.etotem.cfc.controller;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.etotem.cfc.common.Result;
|
|
|
import com.etotem.cfc.service.VirtualPayService;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
@@ -107,10 +109,26 @@ public class VirtualPayController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 前端虚拟支付失败上报(诊断用)。
|
|
|
+ * wx.requestVirtualPayment fail 时前端 fire-and-forget 上报错误码/订单号,
|
|
|
+ * 让支付失败原因在后端日志可见(正式版小程序前端 console 无法远程查看)。
|
|
|
+ * /api/internal/ 前缀已在 JwtInterceptor.PUBLIC_PATHS 公开,无需登录态。
|
|
|
+ */
|
|
|
+ @PostMapping("/error-report")
|
|
|
+ public Result<Boolean> errorReport(@RequestBody Map<String, Object> body) {
|
|
|
+ String outTradeNo = body.get("outTradeNo") != null ? String.valueOf(body.get("outTradeNo")) : "";
|
|
|
+ String scene = body.get("scene") != null ? String.valueOf(body.get("scene")) : "";
|
|
|
+ Object errCode = body.get("errCode");
|
|
|
+ String errMsg = body.get("errMsg") != null ? String.valueOf(body.get("errMsg")) : "";
|
|
|
+ log.error("前端虚拟支付失败上报: scene={}, outTradeNo={}, errCode={}, errMsg={}",
|
|
|
+ scene, outTradeNo, errCode, errMsg);
|
|
|
+ return Result.success(true);
|
|
|
+ }
|
|
|
+
|
|
|
/** iOS App Store 退款问询应答(3秒内应答;3次未应答默认"不确定"交Apple裁决) */
|
|
|
@PostMapping("/ios-refund-query")
|
|
|
- public Map<String, Object> iosRefundQuery(HttpServletRequest request) {
|
|
|
- try {
|
|
|
+ public Map<String, Object> iosRefundQuery(HttpServletRequest request) { try {
|
|
|
BufferedReader reader = request.getReader();
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
String line;
|