| | |
| | | request.setNotifyUrl(callbackPath + "/order/app/notify/wechatPaymentCallback"); |
| | | |
| | | R<com.alibaba.fastjson.JSONObject> r = HuiFuTianXiaUtil.weixinPayment(outTradeNo, description, payMoney.doubleValue(), openid, request.getNotifyUrl()); |
| | | if(r.getCode() != 200){ |
| | | throw new ServiceException(r.getMsg()); |
| | | } |
| | | com.alibaba.fastjson.JSONObject data = r.getData(); |
| | | String mainMchId = WxPayConfiguration.getPlatformTyMacId(); |
| | | // 支付相关信息返回 |
| | |
| | | // 分账完成 |
| | | request.setFinish(true); |
| | | |
| | | NumberFormat numberFormat = NumberFormat.getInstance(); |
| | | numberFormat.setMaximumFractionDigits(2); |
| | | //分账对象 |
| | | JSONArray acctInfos = new JSONArray(); |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("div_amt", numberFormat.format(multiply.doubleValue())); |
| | | jsonObject.put("div_amt", String.format("%.2f", multiply.doubleValue())); |
| | | jsonObject.put("huifu_id", vo.getHuifuId()); |
| | | //平台商户 |
| | | double pt_amount = orderMoney.subtract(multiply).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); |
| | | JSONObject jsonObject1 = new JSONObject(); |
| | | jsonObject1.put("div_amt", numberFormat.format(pt_amount)); |
| | | jsonObject1.put("huifu_id", HuiFuTianXiaUtil.huifu_id); |
| | | jsonObject1.put("div_amt", String.format("%.2f", pt_amount)); |
| | | jsonObject1.put("huifu_id", "6666000141216769"); |
| | | acctInfos.add(jsonObject1); |
| | | R<PaymentDelaytransHFTXVo> hftxVoR = HuiFuTianXiaUtil.paymentDelaytrans(request.getOutOrderNo(), outTradeNo, acctInfos); |
| | | if(hftxVoR.getCode() != 200){ |
| | |
| | | // 更新订单状态 outTradeNo |
| | | String outTradeNo = transaction.getOutTradeNo(); |
| | | Order order = this.getByOutTradeNo(outTradeNo); |
| | | if(order.getOrderStatus() != 1){ |
| | | return; |
| | | } |
| | | String orderId = order.getOrderId(); |
| | | order.setOrderStatus(2); |
| | | order.setPayTime(new Date()); |
| | |
| | | log.info("调用微信退款---发起退款"); |
| | | |
| | | String subMchId = orderPayment.getSubMchId(); |
| | | WxPayConfig config = wxService.getConfig(); |
| | | // WxPayConfig config = wxService.getConfig(); |
| | | |
| | | RefundsRequest request = new RefundsRequest(); |
| | | request.setSpAppid(config.getAppId()); |
| | | // request.setSpAppid(config.getAppId()); |
| | | request.setSubMchid(subMchId); |
| | | request.setTransactionId(orderPayment.getTransactionId()); |
| | | request.setOutRefundNo(outRefundNo); |
| | |
| | | request.setAmount(amount); |
| | | request.setNotifyUrl(callbackPath + "/order/app/notify/wechatPaymentRefundCallback"); |
| | | |
| | | RefundsResult result = wxService.getEcommerceService().refunds(request); |
| | | // RefundsResult result = wxService.getEcommerceService().refunds(request); |
| | | |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); |
| | | String org_req_date = sdf.format(orderPayment.getCreateTime()); |
| | |
| | | Gson gson = new Gson(); |
| | | String refundRequestJson = gson.toJson(request); |
| | | // 返回参数 |
| | | String refundResponseJson = gson.toJson(result); |
| | | // String refundResponseJson = gson.toJson(result); |
| | | |
| | | log.info("调用微信退款返回参数---{}", refundResponseJson); |
| | | // log.info("调用微信退款返回参数---{}", refundResponseJson); |
| | | |
| | | // 保存支付订单统一下单日志 |
| | | paymentMessageService.savePaymentMessage("3", orderId, refundRequestJson, refundResponseJson); |
| | | // paymentMessageService.savePaymentMessage("3", orderId, refundRequestJson, refundResponseJson); |
| | | |
| | | } catch (WxPayException e) { |
| | | } catch (Exception e) { |
| | | throw new ServiceException(e.getMessage()); |
| | | } |
| | | } |