Przeglądaj źródła

获取支付参数异常信息外抛

codingliang 1 rok temu
rodzic
commit
a2e259c31a

+ 6 - 1
src/main/java/com/sqx/modules/pay/service/impl/NewPayServiceImpl.java

@@ -104,10 +104,15 @@ public class NewPayServiceImpl implements NewPayService {
         WechatTransactionsParamVO wechatPayParamVO;
         try {
             QrcodeOpenPayResponseBean response = qrcodePay.openPay(openRequest);
-            JSONObject barCodeJson = JSONUtil.parseObj(response.getBarCode());
+            String barCode = response.getBarCode();
+            if (StrUtil.isBlank(barCode)) {
+                throw new SqxException(response.getMessage());
+            }
+            JSONObject barCodeJson = JSONUtil.parseObj(barCode);
             wechatPayParamVO = barCodeJson.toBean(WechatTransactionsParamVO.class);
             wechatPayParamVO.setPackageStr(barCodeJson.getStr("package"));
         } catch (Exception e) {
+            e.printStackTrace();
             throw new SqxException("获取支付参数失败:" + e.getMessage());
         }