コード例 #1
0
  /**
   * 账户支付重试(暂时只对分销商来的订单有效)
   *
   * @param orderInfo
   * @return
   * @throws TrxOrderException
   * @throws AccountException
   * @throws PaymentException
   * @throws TrxorderGoodsException
   * @throws RuleException
   */
  public OrderInfo processReTry(OrderInfo orderInfo) {

    TrxOrder trxOrder = orderInfo.getTrxOrder();
    Long trxId = trxOrder.getId();
    // Long userId=trxOrder.getUserId();
    String requestId = trxOrder.getReqIp();
    String extendInfo = trxOrder.getExtendInfo();
    orderInfo.setExtendInfo(extendInfo + "-" + trxId); // 重新赋值扩展信息,供日志使用

    orderInfo.setPayRequestId("");
    orderInfo.setTrxId(trxId);
    orderInfo.setRequestId(requestId); // 余额支付时响应给用户订单号
    orderInfo.setActPayFlag(true); // 余额支付标志位
    orderInfo.setNeedPayAamount(0.0);
    orderInfo.setPayGoodsName("");
    orderInfo.setGoodsName("");

    // List<Account> accountList = accountService.findByUserId(userId);//用户帐户列表(分销商不走帐,暂时不需要账户列表)
    PaymentService actPaymentService =
        bizPaymentServiceFacroty.getPaymentService(
            PaymentType.ACTVC); // 分销商只有VC支付。暂时只有ACTVC的payment
    List<Payment> paymentList = actPaymentService.preQryPayment(String.valueOf(trxId));
    orderInfo.setPaymentList(paymentList); // 支付记录列表
    // orderInfo.setAccountList(accountList);//账户列表

    return orderInfo;
  }
コード例 #2
0
  @Override
  public OrderInfo processPost(OrderInfo orderInfoResult)
      throws TrxOrderException, PaymentException, TrxorderGoodsException, AccountException,
          VoucherException, RuleException, StaleObjectStateException, ProcessServiceException,
          RebateException, OrderCreateException, CouponException {

    try {
      orderInfoResult.setGoodsName(
          URLDecoder.decode(orderInfoResult.getGoodsName(), "utf-8")); // 对商品名称做decode转码
    } catch (UnsupportedEncodingException e) {
      e.printStackTrace();
    }
    // 如果是账户支付,则直接出帐。并响应支付结果
    if (orderInfoResult.isActPayFlag()) {
      orderInfoResult.setBizType("act trigger"); // 账户余额触发
      TrxDataInfo trxDataInfo = trxOrderService.comleteByBalance(orderInfoResult);
      orderInfoResult.setTgList(trxDataInfo.getAllTgList()); // 售出的商品订单列表
      orderInfoResult.setSaleCountmap(trxDataInfo.getSaleCountmap()); // 销售量Map

      orderInfoResult.setSingleOverRunTgList(trxDataInfo.getSingleOverRunTgList()); // 个人限购商品列表
      orderInfoResult.setUnSingleOverRunTgList(trxDataInfo.getUnSingleOverRunTgList()); // 非个人限购商品列表

      orderInfoResult.setPayResult("SUCCESS");
    } else {
      // 2.返回支付结果或者组合支付串
      // 2.1检查支付通道在网关是否开通
      String providerType = orderInfoResult.getProviderType(); // 支付机构
      String providerChannel = orderInfoResult.getProviderChannel(); // 支付通道
      String payRequestId = orderInfoResult.getPayRequestId();

      // 支付网关支持的通道检查(千品余额支付默认开启,无开闭开关)
      Map<String, String> chanelMap = TrxConstant.checkChannelMap(providerType, providerChannel);

      logger.info(
          "++payRequestId:"
              + payRequestId
              + "+++++PayProviderType:"
              + providerType
              + "++++providerChannel:"
              + providerChannel
              + "+++");
      if (chanelMap.isEmpty()) { // 如果不支持此通道或通道未开通
        logger.debug("++payRequestId:" + payRequestId + "+++++CHANNEL_STATUS_INVALID+++");
        throw new OrderCreateException(BaseException.CHANNEL_STATUS_INVALID);
      }

      PaymentInfoGeneratorService paymentInfoGeneratorServcie =
          paymentInfoGeneratorFactory.getPaymentInfoGeneratorService(orderInfoResult);
      String payLinkInfo = paymentInfoGeneratorServcie.getReqDataForPayment(orderInfoResult);
      orderInfoResult.setPayResult("NEEDPAY");
      orderInfoResult.setPayLinkInfo(payLinkInfo);
      logger.info(
          "+++++payRequestId:"
              + payRequestId
              + "++++payLinkInfo:"
              + payLinkInfo
              + "+++++++++++++++");
    }

    return orderInfoResult;
  }