| | |
| | | @Autowired |
| | | private TUserBankService userBankService; |
| | | |
| | | @Autowired |
| | | private ITPriceService priceService; |
| | | |
| | | |
| | | @ApiOperation(value = "用户端-invocie",notes="用户端-invocie") |
| | | @ApiImplicitParams({ |
| | |
| | | BigDecimal all = new BigDecimal(0); |
| | | ArrayList<TGoods> goods = new ArrayList<>(); |
| | | for (TOrder order : orders) { |
| | | BigDecimal allTotal = order.getAllTotal(); |
| | | BigDecimal allTotal = priceService.selectList(new EntityWrapper<TPrice>().eq("order_id", order.getId())).stream().map(TPrice::getPrice).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | BigDecimal paid = order.getPaid(); |
| | | BigDecimal subtract = allTotal.subtract(paid); |
| | | all = all.add(subtract); |
| | |
| | | // 总金额 |
| | | BigDecimal bigDecimal = new BigDecimal(0); |
| | | for (TOrder order : orders) { |
| | | bigDecimal = bigDecimal.add(order.getAllTotal()); |
| | | List<TPrice> prices = priceService.selectList(new EntityWrapper<TPrice>().eq("order_id", order.getId())); |
| | | bigDecimal = bigDecimal.add(prices.stream().map(TPrice::getPrice).reduce(BigDecimal.ZERO,BigDecimal::add)); |
| | | } |
| | | if (type == 1) { |
| | | // 可用额度 |
| | |
| | | // String method = PaymentProcessor.getMethod(tUser.getUserNumber()); |
| | | // JSONObject jsonObject = JSON.parseObject(method); |
| | | // Object id1 = jsonObject.get("id"); |
| | | long l = bigDecimal.multiply(new BigDecimal(100)).longValue(); |
| | | Boolean pay = PaymentProcessor.pay(tUser.getUserNumber(), cardToken, l); |
| | | Boolean pay = StripePayUtils.charge(tUser.getUserNumber(), bigDecimal, "","Continental Cargo Association, Inc."); |
| | | if (pay) { |
| | | orders.forEach(e -> { |
| | | e.setStatus("2"); |
| | |
| | | TQuote quote = tQuoteService.selectOne(new EntityWrapper<TQuote>().eq("order_id", s)); |
| | | quote.setState(4); |
| | | tQuotes.add(quote); |
| | | BigDecimal allTotal = order.getAllTotal(); |
| | | // BigDecimal allTotal = order.getAllTotal(); |
| | | List<TPrice> prices = priceService.selectList(new EntityWrapper<TPrice>().eq("order_id", order.getId())); |
| | | BigDecimal allTotal = prices.stream().map(TPrice::getPrice).reduce(BigDecimal.ZERO,BigDecimal::add); |
| | | BigDecimal paid = order.getPaid(); |
| | | BigDecimal subtract = allTotal.subtract(paid); |
| | | all = all.add(subtract); |
| | |
| | | JSONObject jsonObject = JSON.parseObject(method); |
| | | Object id1 = jsonObject.get("id"); |
| | | long l = all.multiply(new BigDecimal(100)).longValue(); |
| | | Boolean pay = PaymentProcessor.pay(tUser.getUserNumber(), id1.toString(), l); |
| | | Boolean pay = StripePayUtils.charge(tUser.getUserNumber(), all, "","Continental Cargo Association, Inc."); |
| | | if (pay) { |
| | | orders.forEach(e -> { |
| | | e.setStatus("2"); |
| | |
| | | orderService.updateBatchById(orders); |
| | | List<TQuote> collect = tQuotes.stream().collect(Collectors.toList()); |
| | | tQuoteService.updateBatchById(collect); |
| | | }else { |
| | | return new ErrorTip(5010, "payment failure"); |
| | | } |
| | | |
| | | } |
| | | return new SuccessTip(); |
| | | } catch (Exception e) { |