| | |
| | | return new FebsResponse().success().message(payResult); |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse cancelOrder(Long id) { |
| | | MallOrderInfo orderInfo = mallOrderInfoMapper.selectById(id); |
| | | if (orderInfo == null || AppContants.DEL_FLAG_Y == orderInfo.getDelFlag()) { |
| | | throw new FebsException("订单不存在"); |
| | | } |
| | | |
| | | if (OrderStatusEnum.WAIT_PAY.getValue() != orderInfo.getStatus()) { |
| | | throw new FebsException("订单不是待付款, 无法取消"); |
| | | } |
| | | |
| | | orderInfo.setStatus(OrderStatusEnum.CANCEL.getValue()); |
| | | orderInfo.setCancelType(MallOrderInfo.CANCEL_BY_SELF); |
| | | mallOrderInfoMapper.updateById(orderInfo); |
| | | return new FebsResponse().success().message("取消成功"); |
| | | } |
| | | |
| | | public String generateAsaToken(String token) { |
| | | RSA rsa = new RSA(null, AppContants.PUBLIC_KEY); |
| | | return rsa.encryptBase64(token + "_" + System.currentTimeMillis(), KeyType.PublicKey); |