| | |
| | | SybPayService service = new SybPayService(); |
| | | |
| | | Map<String,String> params = service.query(orderId, up.getTransactionId()); |
| | | String retcode = params.get("retcode"); |
| | | if(!"SUCCESS".equals(retcode)){ |
| | | throw new ValidationException("查询订单交易状态失败: " + params.get("retmsg")); |
| | | } |
| | | String trxstatus = params.get("trxstatus");//支付状态 |
| | | |
| | | if("1001".equals(trxstatus) || "3088".equals(trxstatus)){ |
| | |
| | | Map<String,String> map = service.close(trxid, orderId); |
| | | log.info("======关闭订单结果" + toJSONString(map)); |
| | | |
| | | String retcode = map.get("retcode"); |
| | | retcode = map.get("retcode"); |
| | | if(!"SUCCESS".equals(retcode)){ |
| | | throw new ValidationException("取消订单失败: " + map.get("retmsg")); |
| | | throw new ValidationException("调用通联关闭订单失败: " + map.get("retmsg")); |
| | | } |
| | | trxstatus = map.get("trxstatus"); |
| | | if(!"0000".equals(trxstatus)){ |
| | | throw new ValidationException("取消订单失败: " + map.get("errmsg")); |
| | | } |
| | | |
| | | } else { |
| | | throw new ValidationException("订单不可取消"); |
| | | } |
| | |
| | | Map<String,String> map = service.cancel(trxamt, reqsn, oldtrxid, oldreqsn); |
| | | String retcode = map.get("retcode"); |
| | | if(!"SUCCESS".equals(retcode)){ |
| | | throw new ValidationException("订单退款失败: " + map.get("retmsg")); |
| | | throw new ValidationException("调用通联撤销接口失败: " + map.get("retmsg")); |
| | | } |
| | | |
| | | //这个不是订单状态,是通用的,如果是支付查询,代表就是订单状态,如果是退款代表的是退款状态 |
| | | String trxstatus = map.get("trxstatus"); |
| | | if(!"0000".equals(trxstatus)){ |
| | | log.error("通联撤销交易失败:" + map.get("errmsg")); |
| | | throw new ValidationException("订单退款交易失败:" + map.get("errmsg")); |
| | | } |
| | | |
| | | updateOrderRefund(orderId, oldtrxid); |
| | |
| | | Map<String,String> map = service.refund(trxamt, reqsn, oldtrxid, oldreqsn); |
| | | String retcode = map.get("retcode"); |
| | | if(!"SUCCESS".equals(retcode)){ |
| | | throw new ValidationException("订单退款失败: " + map.get("retmsg")); |
| | | throw new ValidationException("调用通联退款失败: " + map.get("retmsg")); |
| | | } |
| | | |
| | | //这个不是订单状态,是通用的,如果是支付查询,代表就是订单状态,如果是退款代表的是退款状态 |
| | | String trxstatus = map.get("trxstatus"); |
| | | if(!"0000".equals(trxstatus)){ |
| | | throw new ValidationException("订单退款交易失败:" + map.get("errmsg")); |
| | | } |
| | | |
| | | updateOrderRefund(orderId, oldtrxid); |
| | |
| | | Map<String,String> map = service.refund(trxamt, reqsn, oldtrxid, oldreqsn); |
| | | String retcode = map.get("retcode"); |
| | | if(!"SUCCESS".equals(retcode)){ |
| | | throw new ValidationException("订单退款失败: " + map.get("retmsg")); |
| | | throw new ValidationException("调用通联退款失败: " + map.get("retmsg")); |
| | | } |
| | | |
| | | //这个不是订单状态,是通用的,如果是支付查询,代表就是订单状态,如果是退款代表的是退款状态 |
| | | String trxstatus = map.get("trxstatus"); |
| | | if(!"0000".equals(trxstatus)){ |
| | | throw new ValidationException("订单退款交易失败:" + map.get("errmsg")); |
| | | } |
| | | |
| | | re.setRequest(toJSONString(map)); |