Exemplo n.º 1
0
  public PaymentInvoice getPaymentInvoice(int transId) throws CustomerException {
    if (id <= 0) {
      throw new CustomerException("Invalid Customer...Id cannot be <= 0");
    }
    if (transId == 0) {
      throw new PaymentException("Please specify a transaction to look up an invoice against");
    }
    Session session = HibernateUtil.getSessionFactory().getCurrentSession();
    session.beginTransaction();

    PaymentInvoice paymentInvoice = new PaymentInvoice();

    Query q = session.getNamedQuery("fetch_pmt_invoice");
    q.setParameter("in_cust_id", getId());
    q.setParameter("in_trans_id", transId);
    List<PaymentInvoice> paymentInvoiceList = q.list();
    if (paymentInvoiceList != null && paymentInvoiceList.size() > 0) {
      for (PaymentInvoice tempPaymentInvoice : paymentInvoiceList) {
        paymentInvoice = tempPaymentInvoice;
      }
    }
    session.getTransaction().commit();
    // session.close();
    return paymentInvoice;
  }
Exemplo n.º 2
0
  public List<DeviceAssociation> retrieveDeviceAssociationList(int inDeviceId) {
    Session session = HibernateUtil.getSessionFactory().getCurrentSession();
    session.beginTransaction();

    Query q = session.getNamedQuery("fetch_device_assoc_map");
    q.setParameter("in_cust_id", getId());
    q.setParameter("in_device_id", inDeviceId);
    List<DeviceAssociation> deviceAssociationList = q.list();

    session.getTransaction().rollback();
    return deviceAssociationList;
  }
Exemplo n.º 3
0
 public List<DeviceInfo> retrieveDeviceList(int deviceId, int accountNo) {
   Session session = HibernateUtil.getSessionFactory().getCurrentSession();
   session.beginTransaction();
   Query q = session.getNamedQuery("fetch_device_info");
   q.setParameter("in_cust_id", getId());
   q.setParameter("in_device_id", deviceId);
   q.setParameter("in_account_no", accountNo);
   List<DeviceInfo> deviceInfoList = q.list();
   setDeviceList(deviceInfoList);
   session.getTransaction().rollback();
   return getDeviceList();
 }
Exemplo n.º 4
0
  public List<CustPmtMap> getCustpmttypes(int pmt_id) {
    Session session = HibernateUtil.getSessionFactory().getCurrentSession();
    session.beginTransaction();

    Query q = session.getNamedQuery("fetch_cust_pmt_map");
    q.setParameter("in_cust_id", id);
    q.setParameter("in_pmt_id", pmt_id);
    custpmttypes = q.list();

    session.getTransaction().commit();
    return custpmttypes;
  }
Exemplo n.º 5
0
  public List<UsageDetail> getChargeHistory(int accountNo, String mdn) {
    Session session = HibernateUtil.getSessionFactory().getCurrentSession();
    session.beginTransaction();

    Query q = session.getNamedQuery("sp_fetch_charge_history");
    q.setParameter("in_account_no", accountNo);
    q.setParameter("in_external_id", mdn);

    List<UsageDetail> usageDetailList = q.list();

    session.getTransaction().rollback();
    return usageDetailList;
  }
Exemplo n.º 6
0
  public List<CustAcctMapDAO> getCustaccts() {
    if (custaccts == null) {
      Session session = HibernateUtil.getSessionFactory().getCurrentSession();
      session.beginTransaction();

      Query q = session.getNamedQuery("fetch_cust_acct_map");
      q.setParameter("in_cust_id", getId());

      custaccts = q.list();

      session.getTransaction().commit();
    }
    return custaccts;
  }
Exemplo n.º 7
0
  public List<CustAddress> getCustAddressList(int addressId) {
    Session session = HibernateUtil.getSessionFactory().getCurrentSession();

    session.beginTransaction();

    Query q = session.getNamedQuery("fetch_cust_address");
    q.setParameter("in_cust_id", getId());
    q.setParameter("in_address_id", addressId);

    List<CustAddress> custAddressList = q.list();

    session.getTransaction().rollback();
    return custAddressList;
  }
Exemplo n.º 8
0
  public List<PaymentRecord> getPaymentHistory() throws CustomerException {
    if (id <= 0) {
      throw new CustomerException("Invalid Customer Id " + id);
    }
    Session session = HibernateUtil.getSessionFactory().getCurrentSession();
    session.beginTransaction();

    Query q = session.getNamedQuery("fetch_cust_pmt_trans");
    q.setParameter("in_cust_id", id);
    List<PaymentRecord> paymentRecordList = q.list();

    session.getTransaction().commit();
    return paymentRecordList;
  }
Exemplo n.º 9
0
  public List<PaymentInformation> getPaymentinformation() {
    Session session = HibernateUtil.getSessionFactory().getCurrentSession();
    session.beginTransaction();

    Query q = session.getNamedQuery("fetch_cust_pmt_map");
    q.setParameter("in_cust_id", getId());
    q.setParameter("in_pmt_id", 0);
    custpmttypes = q.list();
    for (CustPmtMap custpmt : custpmttypes) {
      if (custpmt.getPaymentalias().equals(PaymentType.CreditCard.toString())) {
        q = session.getNamedQuery("fetch_pmt_cc_info");
        q.setParameter("in_pmt_id", custpmt.getPaymentid());
        List<CreditCard> creditcard = q.list();
        if (creditcard != null) {
          paymentinformation.add(creditcard.get(0));
        }
      }
    }

    session.getTransaction().rollback();

    return paymentinformation;
  }
Exemplo n.º 10
0
  public CustAcctMapDAO getCustAcctMapDAOfromAccount(int accountno) {
    Session session = HibernateUtil.getSessionFactory().getCurrentSession();
    session.beginTransaction();

    Query q = session.getNamedQuery("fetch_cust_from_acct");
    q.setParameter("in_account_no", accountno);
    List<CustAcctMapDAO> custAcctMapList = q.list();
    CustAcctMapDAO retValue = new CustAcctMapDAO();
    for (CustAcctMapDAO custAcctMap : custAcctMapList) {
      retValue = custAcctMap;
    }

    session.getTransaction().commit();
    return retValue;
  }
Exemplo n.º 11
0
  public void deleteCustAccts(Account account) throws CustomerException {
    if (getId() <= 0) {
      throw new CustomerException(
          "addCustAccts", "Please specify a customer to add an account mapping.");
    }
    if (account == null || account.getAccountno() <= 0) {
      throw new CustomerException(
          "addCustAccts", "Please specify an account to add to customer " + getId());
    }

    Session session = HibernateUtil.getSessionFactory().getCurrentSession();
    session.beginTransaction();

    CustAcctMapDAO custacctmap = new CustAcctMapDAO();
    custacctmap.setCust_id(getId());
    custacctmap.setAccount_no(account.getAccountno());
    Query q = session.getNamedQuery("del_cust_acct_map");
    q.setParameter("cust_id", custacctmap.getCust_id());
    q.setParameter("account_no", custacctmap.getAccount_no());
    List<GeneralSPResponse> spresponse = q.list();

    if (spresponse != null) {
      for (GeneralSPResponse response : spresponse) {
        System.out.println(
            "STATUS :: "
                + response.getStatus()
                + " :: MVNEMSGCODE :: "
                + response.getMvnemsgcode()
                + " :: MVNEMSG :: "
                + response.getMvnemsg());
        if (!response.getStatus().equals("Y")) {
          throw new CustomerException(
              "addCustAccts",
              "Error deleting Customer Acct Map:: "
                  + response.getMvnemsgcode()
                  + "::"
                  + response.getMvnemsg());
        }
      }
    } else {
      throw new CustomerException(
          "addCustAccts", "No response returned from the db when calling ins_cust_acct_map");
    }

    session.getTransaction().commit();
  }
Exemplo n.º 12
0
  public CustInfo getCustInfo() {
    CustInfo custInfo = null;
    Session session = HibernateUtil.getSessionFactory().getCurrentSession();

    session.beginTransaction();

    Query q = session.getNamedQuery("fetch_cust_info");
    q.setParameter("in_cust_id", getId());

    List<CustInfo> custInfoList = q.list();

    if (custInfoList != null && custInfoList.size() > 0) {
      custInfo = custInfoList.get(0);
    }

    session.getTransaction().commit();

    return custInfo;
  }
Exemplo n.º 13
0
  public PaymentUnitResponse submitPayment(PaymentTransaction transaction, int paymentId)
      throws PaymentException {
    PaymentUnitResponse retValue = null;
    Session session = HibernateUtil.getSessionFactory().getCurrentSession();
    session.beginTransaction();
    System.out.println("Payment Amount " + transaction.getPaymentAmount());
    Query q = session.getNamedQuery("sbt_pmt_info");
    q.setParameter("in_cust_id", getId());
    q.setParameter("in_pmt_id", paymentId);
    q.setParameter("in_pymntamt", transaction.getPaymentAmount());

    List<PaymentUnitResponse> responseList = q.list();
    for (PaymentUnitResponse response : responseList) {
      retValue = response;
    }

    session.getTransaction().commit();
    return retValue;
  }
Exemplo n.º 14
0
  public CustTopUp getTopupAmount(Account account) throws CustomerException {
    if (getId() == 0) {
      throw new CustomerException("getTopupAmount", "Customer.id must be set...");
    }
    Session session = HibernateUtil.getSessionFactory().getCurrentSession();
    session.beginTransaction();

    String query = "fetch_cust_topup_amt";

    Query q = session.getNamedQuery(query);
    q.setParameter("in_cust_id", getId());
    q.setParameter("in_account_no", account.getAccountno());
    CustTopUp topupAmount = new CustTopUp();
    List<CustTopUp> topupAmountList = q.list();
    for (CustTopUp custTopUp : topupAmountList) {
      topupAmount = custTopUp;
    }
    session.getTransaction().commit();
    return topupAmount;
  }