| | |
| | | } |
| | | } |
| | | |
| | | return !"1001".equals(trxstatus); |
| | | return !("1001".equals(trxstatus) || StringUtils.isEmpty(trxstatus) |
| | | || "2008".equals(trxstatus) |
| | | || "2000".equals(trxstatus)); |
| | | } |
| | | |
| | | public boolean checkOrderStatusRefund(String outTradeNo) throws Exception { |
| | |
| | | VSP502:微信支付撤销 |
| | | VSP503:微信支付退款 |
| | | */ |
| | | if ("VSP502".equals(trxcode)|| "VSP503".equals(trxcode)){ |
| | | if ("VSP502".equals(trxcode) || "VSP503".equals(trxcode)){ |
| | | String trxid = params.get("trxid"); |
| | | updateOrderRefund(outTradeNo, trxid); |
| | | |
| | |
| | | } |
| | | |
| | | SybPayService service = new SybPayService(); |
| | | Map<String,String> map = service.close(null, orderId); |
| | | log.info("======关闭订单结果" + toJSONString(map)); |
| | | |
| | | String retcode = map.get("retcode"); |
| | | if(!"SUCCESS".equals(retcode)){ |
| | | throw new ValidationException("取消订单失败: " + map.get("retmsg")); |
| | | Map<String,String> params = service.query(orderId, up.getTransactionId()); |
| | | String trxstatus = params.get("trxstatus");//支付状态 |
| | | |
| | | if("1001".equals(trxstatus) || "3088".equals(trxstatus)){ |
| | | //3088-交易未支付(在查询时间区间内未成功支付,如已影响资金24小时内会做差错退款处理) |
| | | //1001:交易不存在 |
| | | //直接取消 |
| | | } else if (StringUtils.isEmpty(trxstatus) |
| | | || "2008".equals(trxstatus) |
| | | || "2000".equals(trxstatus)) { |
| | | String trxid = params.get("trxid"); |
| | | //2008或者2000 : 交易处理中,请查询交易,如果是实时交易(例如刷卡支付,交易撤销,退货),建议每隔一段时间(10秒)查询交易 |
| | | Map<String,String> map = service.close(trxid, orderId); |
| | | log.info("======关闭订单结果" + toJSONString(map)); |
| | | |
| | | String retcode = map.get("retcode"); |
| | | if(!"SUCCESS".equals(retcode)){ |
| | | throw new ValidationException("取消订单失败: " + map.get("retmsg")); |
| | | } |
| | | } else { |
| | | throw new ValidationException("订单不可取消"); |
| | | } |
| | | |
| | | Order order = orderMapper.selectById(orderId); |
| | |
| | | long trxamt = up.getPaymentAmount().longValue(); |
| | | String reqsn = orderId; |
| | | String oldtrxid = up.getTransactionId(); |
| | | String oldreqsn = null; |
| | | String oldreqsn = orderId; |
| | | |
| | | SybPayService service = new SybPayService(); |
| | | Map<String,String> map = service.cancel(trxamt, reqsn, oldtrxid, oldreqsn); |
| | |
| | | long trxamt = up.getPaymentAmount().longValue(); |
| | | String reqsn = orderId; |
| | | String oldtrxid = up.getTransactionId(); |
| | | String oldreqsn = null; |
| | | String oldreqsn = orderId; |
| | | |
| | | SybPayService service = new SybPayService(); |
| | | Map<String,String> map = service.refund(trxamt, reqsn, oldtrxid, oldreqsn); |