|
|
@@ -984,4 +984,92 @@ public class OrderPayService {
|
|
|
BalanceRecord record = userBalanceService.balancePay(order.getUserId(), order.getPrice(), orderId, "元域名叫价");
|
|
|
domainAskService.notifyOrder(orderId, PayMethod.BALANCE, record.getId().toString());
|
|
|
}
|
|
|
+
|
|
|
+ @Cacheable(value = "payOrder", key = "'ask#'+#orderId")
|
|
|
+ public String payAskOrder(Long orderId) {
|
|
|
+ DomainAsk order = domainAskRepo.findById(orderId).orElseThrow(new BusinessException("订单不存在"));
|
|
|
+ if (order.getStatus() != DomainAskStatus.NOT_PAID) {
|
|
|
+ throw new BusinessException("订单状态错误");
|
|
|
+ }
|
|
|
+ switch (PAY_CHANNEL) {
|
|
|
+ case Constants.PayChannel.SAND:
|
|
|
+ return sandPayService.pay(orderId + "", "域名:" + order.getName(), order.getPrice(),
|
|
|
+ order.getCreatedAt().plusMinutes(3), Constants.OrderNotifyType.ASK);
|
|
|
+ case Constants.PayChannel.HM:
|
|
|
+ return hmPayService.requestAlipay(orderId + "", order.getPrice(),
|
|
|
+ "域名:" + order.getName(), HMPayService.getTimeout(order.getCreatedAt(), 180),
|
|
|
+ Constants.OrderNotifyType.ASK, generalProperties
|
|
|
+ .resolveFrontUrl(getCompanyId(), "/domainname"));
|
|
|
+ }
|
|
|
+ throw new BusinessException("绿洲宇宙冷却系统已启动,请稍后支付");
|
|
|
+ }
|
|
|
+
|
|
|
+ @Cacheable(value = "payOrder", key = "'ask#'+#orderId")
|
|
|
+ public String payAskAli(Long orderId) {
|
|
|
+ DomainAsk order = domainAskRepo.findById(orderId).orElseThrow(new BusinessException("订单不存在"));
|
|
|
+ if (order.getStatus() != DomainAskStatus.NOT_PAID) {
|
|
|
+ throw new BusinessException("订单状态错误");
|
|
|
+ }
|
|
|
+ String qrCode = aliRequest(orderId, order.getPrice(), "域名:" + order
|
|
|
+ .getName(), Constants.OrderNotifyType.ASK);
|
|
|
+
|
|
|
+ String ua = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()
|
|
|
+ .getHeader("User-Agent");
|
|
|
+ if (ua.toLowerCase().contains("micromessenger")) {
|
|
|
+ return "/static/wx_alipay_bridge.html?payUrl=" + URLEncoder
|
|
|
+ .encode(Constants.ALIPAY_URL_SCHEME + qrCode, StandardCharsets.UTF_8)
|
|
|
+ + "&orderId=" + orderId + "&type=domain&returnUrl="
|
|
|
+ + URLEncoder
|
|
|
+ .encode(generalProperties
|
|
|
+ .resolveFrontUrl(getCompanyId(), "/domainname"), StandardCharsets.UTF_8);
|
|
|
+ } else {
|
|
|
+ return Constants.ALIPAY_URL_SCHEME + qrCode;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Cacheable(value = "payOrder", key = "'ask#'+#orderId")
|
|
|
+ public String payAskQuick(Long orderId) {
|
|
|
+ DomainAsk order = domainAskRepo.findById(orderId).orElseThrow(new BusinessException("订单不存在"));
|
|
|
+ if (order.getStatus() != DomainAskStatus.NOT_PAID) {
|
|
|
+ throw new BusinessException("订单状态错误");
|
|
|
+ }
|
|
|
+ IdentityAuth identityAuth = identityAuthRepo
|
|
|
+ .findFirstByUserIdAndStatusAndDelFalseOrderByCreatedAtDesc(order.getUserId(), AuthStatus.SUCCESS)
|
|
|
+ .orElseThrow(new BusinessException("请先完成实名认证"));
|
|
|
+ return sandPayService.payQuick(orderId + "", "叫价:" + order.getName(),
|
|
|
+ order.getPrice(), order.getCreatedAt().plusMinutes(3), Constants.OrderNotifyType.ASK,
|
|
|
+ generalProperties.resolveFrontUrl(getCompanyId(), "/domainname"));
|
|
|
+ }
|
|
|
+
|
|
|
+ @Cacheable(value = "payOrder", key = "'ask#'+#orderId")
|
|
|
+ public String payAskQuickBind(Long orderId) {
|
|
|
+ DomainAsk order = domainAskRepo.findById(orderId).orElseThrow(new BusinessException("订单不存在"));
|
|
|
+ if (order.getStatus() != DomainAskStatus.NOT_PAID) {
|
|
|
+ throw new BusinessException("订单状态错误");
|
|
|
+ }
|
|
|
+ IdentityAuth identityAuth = identityAuthRepo
|
|
|
+ .findFirstByUserIdAndStatusAndDelFalseOrderByCreatedAtDesc(order.getUserId(), AuthStatus.SUCCESS)
|
|
|
+ .orElseThrow(new BusinessException("请先完成实名认证"));
|
|
|
+ return sandPayService.payQuickBind(orderId + "", "叫价:" + order.getName(),
|
|
|
+ order.getPrice(), order.getCreatedAt().plusMinutes(3), Constants.OrderNotifyType.ASK,
|
|
|
+ generalProperties.resolveFrontUrl(getCompanyId(), "/domainname"),
|
|
|
+ order.getUserId(), identityAuth.getRealName(), identityAuth.getIdNo());
|
|
|
+ }
|
|
|
+
|
|
|
+ @Cacheable(value = "payOrder", key = "'ask#'+#orderId")
|
|
|
+ public Map<String, Object> payAskOrderAgreement(Long orderId, String bindCardId) {
|
|
|
+ DomainAsk order = domainAskRepo.findById(orderId).orElseThrow(new BusinessException("订单不存在"));
|
|
|
+ if (order.getStatus() != DomainAskStatus.NOT_PAID) {
|
|
|
+ throw new BusinessException("订单状态错误");
|
|
|
+ }
|
|
|
+ if (StringUtils.isEmpty(bindCardId)) {
|
|
|
+ bindCardId = userBankCardRepo.findByUserId(order.getUserId())
|
|
|
+ .stream().map(UserBankCard::getBindCardId).findFirst().orElse(null);
|
|
|
+ }
|
|
|
+ if (StringUtils.isEmpty(bindCardId)) {
|
|
|
+ throw new BusinessException("请先绑定银行卡");
|
|
|
+ }
|
|
|
+ return payEaseService.pay("叫价:" + order.getName(), orderId.toString(), order.getPrice(),
|
|
|
+ order.getUserId().toString(), bindCardId, Constants.OrderNotifyType.ASK);
|
|
|
+ }
|
|
|
}
|