| @@ -208,7 +208,7 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { | |||||
| wxpaystatus = payServiceFactory.getPayAdapterService(oldRecord.getPayVendor(),payAccount.getPayVersion()).queryPayStatus(queryResult, oldRecord.getPayOrderNo()); | wxpaystatus = payServiceFactory.getPayAdapterService(oldRecord.getPayVendor(),payAccount.getPayVersion()).queryPayStatus(queryResult, oldRecord.getPayOrderNo()); | ||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| logger.error("pay order service handleWxOrderQuery error: " ,e); | logger.error("pay order service handleWxOrderQuery error: " ,e); | ||||
| throw new MallinkException(ErrorCode.PAY_ORDER_ERROR); | |||||
| throw new MallinkException(ErrorCode.PAY_ORDER_ERROR.getCode(),e.getMessage()); | |||||
| } | } | ||||
| if (EnumPayStatus.PAY_STATUS_SUCCESS.getCode()==wxpaystatus) { | if (EnumPayStatus.PAY_STATUS_SUCCESS.getCode()==wxpaystatus) { | ||||
| @@ -14,6 +14,7 @@ import org.springframework.stereotype.Service; | |||||
| import com.alibaba.fastjson.JSON; | import com.alibaba.fastjson.JSON; | ||||
| import com.alibaba.fastjson.JSONArray; | import com.alibaba.fastjson.JSONArray; | ||||
| import com.alibaba.fastjson.JSONObject; | import com.alibaba.fastjson.JSONObject; | ||||
| import com.github.binarywang.wxpay.exception.WxPayException; | |||||
| import com.github.binarywang.wxpay.service.WxPayService; | import com.github.binarywang.wxpay.service.WxPayService; | ||||
| import com.iformall.common.ErrorCode; | import com.iformall.common.ErrorCode; | ||||
| import com.iformall.common.Result; | import com.iformall.common.Result; | ||||
| @@ -169,9 +170,13 @@ public class WxMiniAppPaySFTAdapterService extends BaseWxPaySFTAdapterService i | |||||
| */ | */ | ||||
| if (childOrders.size() == 1) { | if (childOrders.size() == 1) { | ||||
| SFTPayCommonMiniAppReq payReq = generatePayCommonRequest(payAccount,composeOrder,productName,record,openId,appInfo,currentDate); | SFTPayCommonMiniAppReq payReq = generatePayCommonRequest(payAccount,composeOrder,productName,record,openId,appInfo,currentDate); | ||||
| String response = WxPayV3SFT.payCommonWithMiniApp(payService, payReq); | |||||
| log.info("pay order v3, " + payReq.toString() + ", response: " + response.toString()); | |||||
| return getOrderPResult(response,record); | |||||
| try { | |||||
| String response = WxPayV3SFT.payCommonWithMiniApp(payService, payReq); | |||||
| return getOrderPResult(response,record); | |||||
| }catch(WxPayException e) { | |||||
| log.error("weixin sft pay error.",e); | |||||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),e.getCustomErrorMsg()); | |||||
| } | |||||
| } else { | } else { | ||||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"因电商收付通合单查询无法处理,暂时不支持合单支付"); | throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"因电商收付通合单查询无法处理,暂时不支持合单支付"); | ||||
| //合单支付/小程序支付 | //合单支付/小程序支付 | ||||
| @@ -226,12 +231,17 @@ public class WxMiniAppPaySFTAdapterService extends BaseWxPaySFTAdapterService i | |||||
| req.setSp_mchid(payAccount.getMchId()); | req.setSp_mchid(payAccount.getMchId()); | ||||
| req.setSub_mchid(oldRecord.getSingleChildOrderShare().getMerchantUid()); | req.setSub_mchid(oldRecord.getSingleChildOrderShare().getMerchantUid()); | ||||
| req.setOut_trade_no(String.valueOf(oldRecord.getId())); | req.setOut_trade_no(String.valueOf(oldRecord.getId())); | ||||
| String response = WxPayV3SFT.payCommonQuery(payService, req); | |||||
| if (StringUtils.isBlank(response)){ | |||||
| log.error("pay common sft query response is null."+JSON.toJSONString(req)); | |||||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"pay common sft query response is null."+JSON.toJSONString(req)); | |||||
| try { | |||||
| String response = WxPayV3SFT.payCommonQuery(payService, req); | |||||
| if (StringUtils.isBlank(response)){ | |||||
| log.error("pay common sft query response is null."+JSON.toJSONString(req)); | |||||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"pay common sft query response is null."+JSON.toJSONString(req)); | |||||
| } | |||||
| return getPayCommonQueryResult(response); | |||||
| }catch(WxPayException e) { | |||||
| log.error("weixin sft pay query error.",e); | |||||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),e.getCustomErrorMsg()); | |||||
| } | } | ||||
| return getPayCommonQueryResult(response); | |||||
| }else { | }else { | ||||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"因电商收付通合单查询无法处理,暂时不支持合单支付查询"); | throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"因电商收付通合单查询无法处理,暂时不支持合单支付查询"); | ||||
| // req.setOut_trade_no(String.valueOf(oldRecord.getId())); | // req.setOut_trade_no(String.valueOf(oldRecord.getId())); | ||||
| @@ -262,9 +272,14 @@ public class WxMiniAppPaySFTAdapterService extends BaseWxPaySFTAdapterService i | |||||
| SFTPayQueryReq req = new SFTPayQueryReq(); | SFTPayQueryReq req = new SFTPayQueryReq(); | ||||
| req.setSp_mchid(payAccount.getMchId()); | req.setSp_mchid(payAccount.getMchId()); | ||||
| req.setSub_mchid(record.getSingleChildOrderShare().getMerchantUid()); | req.setSub_mchid(record.getSingleChildOrderShare().getMerchantUid()); | ||||
| req.setOut_trade_no(String.valueOf(record.getId())); | |||||
| WxPayV3SFT.payCommonClose(payService, req); | |||||
| return new PayAdapterResult(true, "close success", req, null); | |||||
| req.setOut_trade_no(String.valueOf(record.getId())); | |||||
| try { | |||||
| WxPayV3SFT.payCommonClose(payService, req); | |||||
| return new PayAdapterResult(true, "close success", req, null); | |||||
| }catch(WxPayException e) { | |||||
| log.error("weixin sft order close error.",e); | |||||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),e.getCustomErrorMsg()); | |||||
| } | |||||
| }else { | }else { | ||||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"因电商收付通合单查询无法处理,暂时不支持合单支付关闭"); | throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"因电商收付通合单查询无法处理,暂时不支持合单支付关闭"); | ||||
| @@ -14,6 +14,7 @@ import org.springframework.stereotype.Service; | |||||
| import com.alibaba.fastjson.JSON; | import com.alibaba.fastjson.JSON; | ||||
| import com.alibaba.fastjson.JSONArray; | import com.alibaba.fastjson.JSONArray; | ||||
| import com.alibaba.fastjson.JSONObject; | import com.alibaba.fastjson.JSONObject; | ||||
| import com.github.binarywang.wxpay.exception.WxPayException; | |||||
| import com.github.binarywang.wxpay.service.WxPayService; | import com.github.binarywang.wxpay.service.WxPayService; | ||||
| import com.iformall.common.ErrorCode; | import com.iformall.common.ErrorCode; | ||||
| import com.iformall.common.Result; | import com.iformall.common.Result; | ||||
| @@ -182,9 +183,13 @@ public class WxMiniAppPayV3AdapterService extends BaseWxPayV3AdapterService impl | |||||
| */ | */ | ||||
| if (childOrders.size() == 1) { | if (childOrders.size() == 1) { | ||||
| V3PayCommonMiniAppReq payReq = generatePayCommonRequest(payAccount,composeOrder,productName,record,openId,appInfo,currentDate); | V3PayCommonMiniAppReq payReq = generatePayCommonRequest(payAccount,composeOrder,productName,record,openId,appInfo,currentDate); | ||||
| String response = WxPayV3.payCommonWithMiniApp(payService, payReq); | |||||
| log.info("pay order v3, " + payReq.toString() + ", response: " + response.toString()); | |||||
| return getOrderPResult(response,record); | |||||
| try { | |||||
| String response = WxPayV3.payCommonWithMiniApp(payService, payReq); | |||||
| return getOrderPResult(response,record); | |||||
| }catch(WxPayException e) { | |||||
| log.error("wexin pay v3 error",e); | |||||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),e.getCustomErrorMsg()); | |||||
| } | |||||
| } else { | } else { | ||||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"合单查询无法处理,暂时不支持合单支付"); | throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"合单查询无法处理,暂时不支持合单支付"); | ||||
| //合单支付/小程序支付 | //合单支付/小程序支付 | ||||
| @@ -244,12 +249,18 @@ public class WxMiniAppPayV3AdapterService extends BaseWxPayV3AdapterService impl | |||||
| req.setSub_mchid(oldRecord.getSingleChildOrderShare().getMerchantUid()); | req.setSub_mchid(oldRecord.getSingleChildOrderShare().getMerchantUid()); | ||||
| } | } | ||||
| req.setOut_trade_no(oldRecord.getPayOrderNo()); | req.setOut_trade_no(oldRecord.getPayOrderNo()); | ||||
| String response = WxPayV3.payCommonQuery(payService, req); | |||||
| if (StringUtils.isBlank(response)){ | |||||
| log.error("pay common v3 query response is null."+JSON.toJSONString(req)); | |||||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"pay common v3 query response is null."+JSON.toJSONString(req)); | |||||
| try { | |||||
| String response = WxPayV3.payCommonQuery(payService, req); | |||||
| if (StringUtils.isBlank(response)){ | |||||
| log.error("pay common v3 query response is null."+JSON.toJSONString(req)); | |||||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"pay common v3 query response is null."+JSON.toJSONString(req)); | |||||
| } | |||||
| return getPayCommonQueryResult(response); | |||||
| }catch(WxPayException e) { | |||||
| log.error("pay common v3 query response error",e); | |||||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),e.getCustomErrorMsg()); | |||||
| } | } | ||||
| return getPayCommonQueryResult(response); | |||||
| }else { | }else { | ||||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"合单查询无法处理,暂时不支持合单支付查询"); | throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"合单查询无法处理,暂时不支持合单支付查询"); | ||||
| // req.setOut_trade_no(String.valueOf(oldRecord.getId())); | // req.setOut_trade_no(String.valueOf(oldRecord.getId())); | ||||
| @@ -286,8 +297,13 @@ public class WxMiniAppPayV3AdapterService extends BaseWxPayV3AdapterService impl | |||||
| req.setSub_mchid(record.getSingleChildOrderShare().getMerchantUid()); | req.setSub_mchid(record.getSingleChildOrderShare().getMerchantUid()); | ||||
| } | } | ||||
| req.setOut_trade_no(record.getPayOrderNo()); | req.setOut_trade_no(record.getPayOrderNo()); | ||||
| WxPayV3SFT.payCommonClose(payService, req); | |||||
| return new PayAdapterResult(true, "close success", req, null); | |||||
| try { | |||||
| WxPayV3.payCommonClose(payService, req); | |||||
| return new PayAdapterResult(true, "close success", req, null); | |||||
| }catch(WxPayException e) { | |||||
| log.error("wexin pay v3 close error.",e); | |||||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),e.getCustomErrorMsg()); | |||||
| } | |||||
| }else { | }else { | ||||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"因合单查询无法处理,暂时不支持合单支付关闭"); | throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"因合单查询无法处理,暂时不支持合单支付关闭"); | ||||
| @@ -13,6 +13,7 @@ import org.springframework.stereotype.Service; | |||||
| import com.alibaba.fastjson.JSON; | import com.alibaba.fastjson.JSON; | ||||
| import com.alibaba.fastjson.JSONObject; | import com.alibaba.fastjson.JSONObject; | ||||
| import com.github.binarywang.wxpay.exception.WxPayException; | |||||
| import com.github.binarywang.wxpay.service.WxPayService; | import com.github.binarywang.wxpay.service.WxPayService; | ||||
| import com.iformall.common.ErrorCode; | import com.iformall.common.ErrorCode; | ||||
| import com.iformall.common.Result; | import com.iformall.common.Result; | ||||
| @@ -121,9 +122,19 @@ public class WxRefundV3AdapterService implements RefundPayAdapterService{ | |||||
| try { | try { | ||||
| //合单和普通一样 | //合单和普通一样 | ||||
| if (!payOrder.isMulity()) { | if (!payOrder.isMulity()) { | ||||
| response = WxPayV3.payCommonRefund(payService, getReq(payAccount, appInfo, record, payOrder,orderId, payType)); | |||||
| try { | |||||
| response = WxPayV3.payCommonRefund(payService, getReq(payAccount, appInfo, record, payOrder,orderId, payType)); | |||||
| }catch(WxPayException e) { | |||||
| log.error("weixin pay v3 refund error. " ,e); | |||||
| throw new MallinkException(ErrorCode.REFUND_ORDER_ERROR.getCode(), e.getCustomErrorMsg()); | |||||
| } | |||||
| }else { | }else { | ||||
| response = WxPayV3.payCommonRefund(payService, getReq(payAccount, appInfo, record, payOrder,orderId, payType)); | |||||
| try { | |||||
| response = WxPayV3.payCommonRefund(payService, getReq(payAccount, appInfo, record, payOrder,orderId, payType)); | |||||
| }catch(WxPayException e) { | |||||
| log.error("weixin pay v3 refund error. " ,e); | |||||
| throw new MallinkException(ErrorCode.REFUND_ORDER_ERROR.getCode(), e.getCustomErrorMsg()); | |||||
| } | |||||
| } | } | ||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| log.error("退款异常: " + e.getMessage()); | log.error("退款异常: " + e.getMessage()); | ||||
| @@ -138,7 +149,12 @@ public class WxRefundV3AdapterService implements RefundPayAdapterService{ | |||||
| WxPayService payService = maUtil.getWxPayService(appInfo, payAccount); | WxPayService payService = maUtil.getWxPayService(appInfo, payAccount); | ||||
| String response = null; | String response = null; | ||||
| try { | try { | ||||
| response = WxPayV3.payCommonRefundQuery(payService, String.valueOf(record.getId())); | |||||
| try { | |||||
| response = WxPayV3.payCommonRefundQuery(payService, String.valueOf(record.getId())); | |||||
| }catch(WxPayException e) { | |||||
| log.error("weixin pay v3 query refund error " ,e); | |||||
| throw new MallinkException(ErrorCode.REFUND_ORDER_ERROR.getCode(), e.getCustomErrorMsg()); | |||||
| } | |||||
| JSONObject result = JSON.parseObject(response); | JSONObject result = JSON.parseObject(response); | ||||
| String refund_status_0 = result.getString("status"); | String refund_status_0 = result.getString("status"); | ||||
| if("SUCCESS".equals(refund_status_0)){ | if("SUCCESS".equals(refund_status_0)){ | ||||
| @@ -153,7 +153,7 @@ public class WxPayShareV3Service extends PayShareBaseAdapterService{ | |||||
| } | } | ||||
| } catch (WxPayException e) { | } catch (WxPayException e) { | ||||
| log.error("wx v3 noreciver share error:",e); | log.error("wx v3 noreciver share error:",e); | ||||
| return new PayShareResult(false, EnumProfitSharingOrderStatus.PROFIT_SHARING_REQ_FAILED.getCode(),ErrorCode.PROFIT_SHARING_REQUEST_FAILED.getMessage()+":"+e.getMessage(), null,null); | |||||
| return new PayShareResult(false, EnumProfitSharingOrderStatus.PROFIT_SHARING_REQ_FAILED.getCode(),ErrorCode.PROFIT_SHARING_REQUEST_FAILED.getMessage()+":"+e.getCustomErrorMsg(), null,null); | |||||
| } | } | ||||
| JSONObject result = JSON.parseObject(response); | JSONObject result = JSON.parseObject(response); | ||||
| @@ -182,9 +182,9 @@ public class WxPayShareV3Service extends PayShareBaseAdapterService{ | |||||
| if (StringUtils.isBlank(response)) { | if (StringUtils.isBlank(response)) { | ||||
| return new PayShareResult(false, EnumProfitSharingOrderStatus.PROFIT_SHARING_REQ_FAILED.getCode(),"分账请求失败.返回值为空", null,null); | return new PayShareResult(false, EnumProfitSharingOrderStatus.PROFIT_SHARING_REQ_FAILED.getCode(),"分账请求失败.返回值为空", null,null); | ||||
| } | } | ||||
| } catch (Exception e) { | |||||
| } catch (WxPayException e) { | |||||
| log.error("wx v3 recivers share error:",e); | log.error("wx v3 recivers share error:",e); | ||||
| return new PayShareResult(false, EnumProfitSharingOrderStatus.PROFIT_SHARING_REQ_FAILED.getCode(), ErrorCode.PROFIT_SHARING_REQUEST_FAILED.getMessage()+":"+e.getMessage(), null, null); | |||||
| return new PayShareResult(false, EnumProfitSharingOrderStatus.PROFIT_SHARING_REQ_FAILED.getCode(), ErrorCode.PROFIT_SHARING_REQUEST_FAILED.getMessage()+":"+e.getCustomErrorMsg(), null, null); | |||||
| } | } | ||||
| JSONObject result = JSON.parseObject(response); | JSONObject result = JSON.parseObject(response); | ||||
| @@ -211,8 +211,9 @@ public class WxPayShareV3Service extends PayShareBaseAdapterService{ | |||||
| if (StringUtils.isBlank(response)) { | if (StringUtils.isBlank(response)) { | ||||
| throw new MallinkException(EnumProfitSharingOrderStatus.PROFIT_SHARING_REQ_FAILED.getCode(),"分账请求失败.返回值为空"); | throw new MallinkException(EnumProfitSharingOrderStatus.PROFIT_SHARING_REQ_FAILED.getCode(),"分账请求失败.返回值为空"); | ||||
| } | } | ||||
| }catch (Exception e){ | |||||
| throw new MallinkException(ErrorCode.PROFIT_SHARING_QUERY_REQUEST_FAILED.getCode(), ErrorCode.PROFIT_SHARING_QUERY_REQUEST_FAILED.getMessage()+e.getMessage()); | |||||
| } catch (WxPayException e) { | |||||
| log.error("weixin pay v3 share error.",e); | |||||
| throw new MallinkException(ErrorCode.PROFIT_SHARING_QUERY_REQUEST_FAILED.getCode(), ErrorCode.PROFIT_SHARING_QUERY_REQUEST_FAILED.getMessage()+e.getCustomErrorMsg()); | |||||
| } | } | ||||
| JSONObject result = JSON.parseObject(response); | JSONObject result = JSON.parseObject(response); | ||||
| String return_code = result.getString("state"); | String return_code = result.getString("state"); | ||||