Ejemplo n.º 1
0
  public Map<Object, Object> getFailedTransactionsAndTotalCount(
      int start, ListFilterCriteria filterCriteria, Date fromDate, Date toDate) {
    String subQuery =
        "from PaymentTransaction o where o.createdAt BETWEEN :fromDate AND :toDate"
            + " and paymentTransactionStatus = 'FAILURE' and o.";
    String transactionListQueryString =
        "select o "
            + subQuery
            + filterCriteria.getColumn()
            + " like '%"
            + filterCriteria.getValueToSearch()
            + "%' order by o."
            + filterCriteria.getSortBy()
            + " "
            + filterCriteria.getSortOrder();

    Query transactionListQuery =
        getEntityManagerForActiveEntities().createQuery(transactionListQueryString);
    transactionListQuery.setParameter("fromDate", fromDate);
    transactionListQuery.setParameter("toDate", toDate);
    transactionListQuery.setFirstResult(start);
    transactionListQuery.setMaxResults(filterCriteria.getItemsPerPage());

    List<PaymentTransaction> transactionList = transactionListQuery.getResultList();
    Map<Object, Object> transactionDetails = new HashMap<Object, Object>();

    transactionDetails.put("list", transactionList);
    transactionDetails.put("totalCount", getTotalCount(filterCriteria, fromDate, toDate));
    return transactionDetails;
  }
Ejemplo n.º 2
0
  public Map<Object, Object> getDetails(
      ListFilterCriteria filterCriteria, Date fromDate, Date toDate) {
    log.debug(
        "FailedTransactions.getDetails(): Date Range = [{}] - [{}]",
        DateTimeUtil.formatDate(fromDate),
        DateTimeUtil.formatDate(toDate));

    int startingFrom = (filterCriteria.getP() - 1) * filterCriteria.getItemsPerPage();
    Map<Object, Object> orderListAndTotalCount =
        paymentDao.getFailedTransactionsAndTotalCount(
            startingFrom, filterCriteria, fromDate, toDate);
    List<Order> ordersList = (List<Order>) orderListAndTotalCount.get("list");
    Map<Object, Object> dataForView =
        PaginationUtil.generateDataForView(
            orderListAndTotalCount,
            filterCriteria.getItemsPerPage(),
            filterCriteria.getP(),
            startingFrom,
            BASE_URL_FOR_PAGINATION,
            ordersList.size());
    Map<String, String> searchFieldMap = new HashMap<String, String>();
    searchFieldMap.put("Transaction Id", "bluestoneTxnId");
    searchFieldMap.put("Payment Gateway", "paymentGateway");
    searchFieldMap.put("Customer Name", "subPayment.masterPayment.cart.customer.userName");
    searchFieldMap.put("Customer Email", "subPayment.masterPayment.cart.customer.email");

    dataForView.put("searchFieldMap", searchFieldMap);

    return dataForView;
  }
Ejemplo n.º 3
0
 private int getTotalCount(ListFilterCriteria filterCriteria, Date fromDate, Date toDate) {
   Query transactionCountQuery =
       getEntityManagerForActiveEntities()
           .createQuery(
               "select count(o.id) from PaymentTransaction o where "
                   + "o.createdAt BETWEEN :fromDate AND :toDate "
                   + "and paymentTransactionStatus = 'FAILURE' and o."
                   + filterCriteria.getColumn()
                   + " like '%"
                   + filterCriteria.getValueToSearch()
                   + "%'");
   transactionCountQuery.setParameter("fromDate", fromDate);
   transactionCountQuery.setParameter("toDate", toDate);
   return ((Long) transactionCountQuery.getSingleResult()).intValue();
 }
Ejemplo n.º 4
0
  public Map<Object, Object> getBannerListAndTotalCount(
      int start, ListFilterCriteria filterCriteria) {
    log.debug("BannerDao.getBannerListAndTotalCount() ");
    EntityManager entityManager = getEntityManagerForActiveEntities();
    Query bannerCountQuery =
        entityManager.createNativeQuery(
            "select count(*) from banner b where b."
                + filterCriteria.getColumn()
                + " like '%"
                + filterCriteria.getValueToSearch()
                + "%'");

    Query bannerListQuery =
        entityManager.createQuery(
            "select b from Banner b where b."
                + filterCriteria.getColumn()
                + " like '%"
                + filterCriteria.getValueToSearch()
                + "%' order by "
                + filterCriteria.getSortBy()
                + " "
                + filterCriteria.getSortOrder());
    bannerListQuery.setFirstResult(start);
    bannerListQuery.setMaxResults(filterCriteria.getItemsPerPage());

    List<Banner> bannersList = bannerListQuery.getResultList();
    Map<Object, Object> bannerDetails = new HashMap<Object, Object>();

    bannerDetails.put("list", bannersList);
    bannerDetails.put("totalCount", ((BigInteger) bannerCountQuery.getSingleResult()).intValue());
    return bannerDetails;
  }
Ejemplo n.º 5
0
  public Map<Object, Object> getVouhersAndTotalCount(
      int start, ListFilterCriteria filterCriteria, boolean forActive) {

    EntityManager entityManager =
        forActive == true
            ? getEntityManagerForActiveEntities()
            : getEntityManagerForNonActiveEntities();
    Query voucherCountQuery =
        entityManager.createQuery(
            "select count(v.id) from DiscountVoucher v where v."
                + filterCriteria.getColumn()
                + " like '%"
                + filterCriteria.getValueToSearch()
                + "%' "
                + "order by "
                + filterCriteria.getSortBy()
                + " "
                + filterCriteria.getSortOrder());

    Query voucherListQuery =
        entityManager.createQuery(
            "select v from DiscountVoucher v where v."
                + filterCriteria.getColumn()
                + " like '%"
                + filterCriteria.getValueToSearch()
                + "%' order by "
                + filterCriteria.getSortBy()
                + " "
                + filterCriteria.getSortOrder());
    voucherListQuery.setFirstResult(start);
    voucherListQuery.setMaxResults(filterCriteria.getItemsPerPage());

    List<DiscountVoucher> vouchersList = voucherListQuery.getResultList();
    Map<Object, Object> voucherDetails = new HashMap<Object, Object>();

    voucherDetails.put("list", vouchersList);
    voucherDetails.put("totalCount", ((Long) voucherCountQuery.getSingleResult()).intValue());
    return voucherDetails;
  }