| | |
| | | |
| | | if (null == cpmMap || 0 == cpmMap.size()) { |
| | | // TODO: 2023/4/16 |
| | | throw new YamiShopBindException("支付方式不存在"); |
| | | throw new YamiShopBindException("Payment method does not exist"); |
| | | } |
| | | List<String> cpmList = new ArrayList<String>(); |
| | | for (String key : cpmMap.keySet()) { |
| | |
| | | |
| | | private String verif(String direction, String nationality, String currency, String payment_method_id, String coin_amount, String img) { |
| | | if (StringUtils.isEmptyString(direction) || !Arrays.asList("recharge", "withdraw").contains(direction)) { |
| | | return "充值或提现不正确"; |
| | | return "Invalid recharge or withdrawal type"; |
| | | } |
| | | Map<String, String> currencyMap = this.c2cPaymentMethodService.getCurrencyMap(); |
| | | if (StringUtils.isEmptyString(currency) || null == currencyMap || (null != currencyMap && !currencyMap.containsKey(currency))) { |
| | | return "支付币种不正确"; |
| | | return "Invalid payment currency"; |
| | | } |
| | | if (StringUtils.isEmptyString(payment_method_id)) { |
| | | return "支付方式不正确"; |
| | | return "Invalid payment method"; |
| | | } |
| | | if (StringUtils.isEmptyString(coin_amount) || !StringUtils.isDouble(coin_amount) || Double.valueOf(coin_amount).doubleValue() <= 0) { |
| | | return "交易数量不正确"; |
| | | return "Invalid transaction amount"; |
| | | } |
| | | if ("recharge".equals(direction)) { |
| | | if (StringUtils.isEmptyString(nationality)) { |
| | | return "国家/地区不正确"; |
| | | return "Invalid country or region"; |
| | | } |
| | | // 银行卡充值是否强制需要上传图片,需要true,不需要false |
| | | boolean bank_card_recharge_must_need_img = this.sysparaService.find("bank_card_recharge_must_need_img").getBoolean(); |
| | | if (bank_card_recharge_must_need_img) { |
| | | if (StringUtils.isEmptyString(img)) { |
| | | return "请上传图片"; |
| | | return "Please upload an image"; |
| | | } |
| | | } |
| | | } |
| | |
| | | Object object = this.sessionTokenService.cacheGet(session_token); |
| | | this.sessionTokenService.del(session_token); |
| | | if (null == object || !userId.equals((String) object)) { |
| | | throw new YamiShopBindException("请稍后再试"); |
| | | throw new YamiShopBindException("Please try again later"); |
| | | } |
| | | String partyId = SecurityUtils.getUser().getUserId(); |
| | | if (null == partyId) { |
| | | throw new YamiShopBindException("请重新登录"); |
| | | throw new YamiShopBindException("Please log in again"); |
| | | } |
| | | User party = userService.getById(partyId); |
| | | if (Constants.SECURITY_ROLE_TEST.equals(party.getRoleName())) { |
| | | throw new YamiShopBindException("无权限"); |
| | | throw new YamiShopBindException("Permission denied"); |
| | | } |
| | | if (!party.isEnabled()) { |
| | | throw new YamiShopBindException("User is locked"); |
| | |
| | | party_kyc=new RealNameAuthRecord(); |
| | | } |
| | | if (!(party_kyc.getStatus() == 2) && "true".equals(this.sysparaService.find("withdraw_by_kyc").getSvalue())) { |
| | | throw new YamiShopBindException("无权限"); |
| | | throw new YamiShopBindException("Permission denied"); |
| | | } |
| | | HighLevelAuthRecord party_kycHighLevel = highLevelAuthRecordService.findByUserId(partyId); |
| | | if (party_kycHighLevel==null){ |
| | |
| | | } |
| | | double withdraw_by_high_kyc = Double.valueOf(this.sysparaService.find("withdraw_by_high_kyc").getSvalue()); |
| | | if (withdraw_by_high_kyc > 0 && coin_amount_double > withdraw_by_high_kyc && !(party_kycHighLevel.getStatus() == 2)) { |
| | | throw new YamiShopBindException("请先通过高级认证"); |
| | | throw new YamiShopBindException("Advanced verification required"); |
| | | } |
| | | // if (!party.getWithdraw_authority()) { |
| | | // throw new BusinessException(1, "无权限"); |
| | |
| | | // 流水小于限额 |
| | | if (userdata_turnover < party_withdraw) { |
| | | fact_withdraw_amount = Arith.sub(party_withdraw, userdata_turnover); |
| | | throw new YamiShopBindException("流水小于限额"); |
| | | throw new YamiShopBindException("Transaction volume below minimum limit"); |
| | | } |
| | | } |
| | | if ("2".equals(withdraw_limit_open_use_type)) { |
| | |
| | | Object obj1 = this.sysparaService.find("bank_card_order_cancel_day_times"); |
| | | if (null != obj1) { |
| | | if (orderCancelDayTimes >= Integer.valueOf(this.sysparaService.find("bank_card_order_cancel_day_times").getSvalue()).intValue()) { |
| | | throw new YamiShopBindException("今日取消订单次数太多了,请明日再试"); |
| | | throw new YamiShopBindException("Too many cancellations today, try again tomorrow"); |
| | | } |
| | | } |
| | | DecimalFormat df = new DecimalFormat("#.########"); |
| | | ExchangeRate ex = this.exchangeRateService.findBy(Constants.OUT_OR_IN_DEFAULT, currency.toUpperCase()); |
| | | if (null == ex) { |
| | | throw new YamiShopBindException("支付币种不正确"); |
| | | throw new YamiShopBindException("Invalid payment currency"); |
| | | } |
| | | C2cOrder c2cOrder = new C2cOrder(); |
| | | c2cOrder.setPartyId(party.getUserId()); |
| | |
| | | public Result orderCancel(String order_no, String remark) { |
| | | User party = userService.getById(SecurityUtils.getUser().getUserId()); |
| | | if (Constants.SECURITY_ROLE_TEST.equals(party.getRoleName())) { |
| | | throw new YamiShopBindException("无权限"); |
| | | throw new YamiShopBindException("Permission denied"); |
| | | } |
| | | if (!party.isEnabled()) { |
| | | throw new YamiShopBindException("User is locked"); |
| | | } |
| | | C2cOrder order = this.c2cOrderService.get(order_no); |
| | | if (null == order || !order.getPartyId().equals(SecurityUtils.getUser().getUserId())) { |
| | | throw new YamiShopBindException("订单不存在"); |
| | | throw new YamiShopBindException("Order does not exist"); |
| | | } |
| | | order.setRemark(remark); |
| | | // 用户不能取消提现 |
| | | if (SecurityUtils.getUser().getUserId().equals(order.getPartyId())) { |
| | | if ("withdraw".equals(order.getDirection())) { |
| | | throw new YamiShopBindException("用户不能取消提现"); |
| | | throw new YamiShopBindException("Withdrawal cannot be cancelled"); |
| | | } |
| | | this.c2cOrderService.saveOrderCancel(order, "user"); |
| | | } |
| | |
| | | public Result get(@RequestParam String order_no, @RequestParam String language) { |
| | | C2cOrder c2cOrder = this.c2cOrderService.get(order_no); |
| | | if (null == c2cOrder) { |
| | | throw new YamiShopBindException("订单不存在"); |
| | | throw new YamiShopBindException("Order does not exist"); |
| | | } |
| | | List<String> nos = new ArrayList<String>(); |
| | | nos.add(c2cOrder.getOrderNo()); |
| | |
| | | public Result list(String page_no, String direction, String state) { |
| | | String partyId = SecurityUtils.getUser().getUserId(); |
| | | if (null == partyId) { |
| | | throw new YamiShopBindException("请重新登录"); |
| | | throw new YamiShopBindException("Please log in again"); |
| | | } |
| | | if (StringUtils.isNullOrEmpty(page_no)) { |
| | | page_no = "1"; |
| | | } |
| | | if (!StringUtils.isInteger(page_no)) { |
| | | throw new YamiShopBindException("页码不是整数"); |
| | | throw new YamiShopBindException("Page number must be an integer"); |
| | | } |
| | | if (Integer.valueOf(page_no).intValue() <= 0) { |
| | | throw new YamiShopBindException("页码不能小于等于0"); |
| | | throw new YamiShopBindException("Page number must be greater than 0"); |
| | | } |
| | | int page_no_int = Integer.valueOf(page_no).intValue(); |
| | | if (StringUtils.isNotEmpty(direction) && !Arrays.asList("recharge", "withdraw").contains(direction)) { |
| | | throw new YamiShopBindException("充值或提现不正确"); |
| | | throw new YamiShopBindException("Invalid deposit or withdrawal type"); |
| | | } |
| | | if (StringUtils.isNotEmpty(state) && !Arrays.asList("0", "3", "4").contains(state)) { |
| | | throw new YamiShopBindException("订单状态不正确"); |
| | | throw new YamiShopBindException("Invalid order status"); |
| | | } |
| | | Page page = this.c2cOrderService.pagedQuery(page_no_int, 20, direction, state, partyId); |
| | | if (null == page) { |