Package com.jada.jpa.entity

Examples of com.jada.jpa.entity.CustomerCreditCard


      init(request, form);
      ActionForward actionForward = actionMapping.findForward("success");
      Customer customer = getCustomer(request);
    String siteId = getContentBean(request).getContentSessionKey().getSiteId();

    CustomerCreditCard custCreditCard = null;
      customer = CustomerDAO.load(siteId, customer.getCustId());
      Iterator<?> iterator = customer.getCustCreditCards().iterator();
      if (iterator.hasNext()) {
        custCreditCard = (CustomerCreditCard) iterator.next();
      }
     
      if (custCreditCard != null) {
        form.setCustCreditCardFullName(custCreditCard.getCustCreditCardFullName());
        form.setCustCreditCardExpiryMonth(custCreditCard.getCustCreditCardExpiryMonth());
        form.setCustCreditCardExpiryYear(custCreditCard.getCustCreditCardExpiryYear());
        form.setCustCreditCardNum(AESEncoder.getInstance().decode(custCreditCard.getCustCreditCardNum()));
        form.setCustCreditCardVerNum(custCreditCard.getCustCreditCardVerNum());
        CreditCard creditCard = custCreditCard.getCreditCard();
        if (creditCard != null) {
          form.setCreditCardId(creditCard.getCreditCardId().toString());
        }
      }
      initSearchInfo(form, siteId);
View Full Code Here


            return actionForward;
      }
     
    EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();
    Customer customer = CustomerDAO.load(siteId, getCustomer(request).getCustId());
    CustomerCreditCard customerCreditCard = null;
      Iterator<?> iterator = customer.getCustCreditCards().iterator();
    boolean found = false;
    if (iterator.hasNext()) {
      found = true;
      customerCreditCard = (CustomerCreditCard) iterator.next();
      customerCreditCard.setRecCreateBy(Constants.USERNAME_SYSTEM);
      customerCreditCard.setRecCreateDatetime(new Date(System.currentTimeMillis()));
    }
    else {
      customerCreditCard = new CustomerCreditCard();
      customerCreditCard.setRecUpdateBy(Constants.USERNAME_SYSTEM);
      customerCreditCard.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
      customerCreditCard.setRecCreateBy(Constants.USERNAME_SYSTEM);
      customerCreditCard.setRecCreateDatetime(new Date(System.currentTimeMillis()));
    }
    customerCreditCard.setCustCreditCardFullName(form.getCustCreditCardFullName());
    customerCreditCard.setCustCreditCardNum(AESEncoder.getInstance().encode(form.getCustCreditCardNum()));
    customerCreditCard.setCustCreditCardExpiryMonth(form.getCustCreditCardExpiryMonth());
    customerCreditCard.setCustCreditCardExpiryYear(form.getCustCreditCardExpiryYear());
    customerCreditCard.setCustCreditCardVerNum(form.getCustCreditCardVerNum());
    String creditCardId = form.getCreditCardId();
    CreditCard creditCard = (CreditCard) em.find(CreditCard.class, Format.getLong(creditCardId));
    customerCreditCard.setCreditCard(creditCard);
    if (customerCreditCard.getCustCreditCardId() == null) {
      em.persist(customerCreditCard);
    }
    if (!found) {
      customer.getCustCreditCards().add(customerCreditCard);
    }
View Full Code Here

    else {
      customer.setCustomerClass(null);
    }
    em.persist(customer);
   
    CustomerCreditCard customerCreditCard = null;
    Iterator<?> iterator = customer.getCustCreditCards().iterator();
    if (iterator.hasNext()) {
      customerCreditCard = (CustomerCreditCard) iterator.next();
    }
    if (customerCreditCard == null) {
      customerCreditCard = new CustomerCreditCard();
      customerCreditCard.setRecCreateBy(adminBean.getUser().getUserId());
      customerCreditCard.setRecCreateDatetime(new Date(System.currentTimeMillis()));
    }
    customerCreditCard.setCustCreditCardFullName(form.getCustCreditCardFullName());
    customerCreditCard.setCustCreditCardNum(AESEncoder.getInstance().encode(form.getCustCreditCardNum()));
    customerCreditCard.setCustCreditCardExpiryMonth(form.getCustCreditCardExpiryMonth());
    customerCreditCard.setCustCreditCardExpiryYear(form.getCustCreditCardExpiryYear());
    customerCreditCard.setCustCreditCardVerNum(form.getCustCreditCardVerNum());
    customerCreditCard.setRecUpdateBy(adminBean.getUser().getUserId());
    customerCreditCard.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
    CreditCard creditCard = CreditCardDAO.load(site.getSiteId(), Long.valueOf(form.getCreditCardId()));
    customerCreditCard.setCreditCard(creditCard);
    customer.getCustCreditCards().add(customerCreditCard);
    em.persist(customerCreditCard);

   
        initSearchInfo(request, form, site.getSiteId(), customer);
View Full Code Here

      form.setShippingCustZipCode(address.getCustZipCode());
      form.setShippingCustPhoneNum(address.getCustPhoneNum());
      form.setShippingCustFaxNum(address.getCustFaxNum());
    }

    CustomerCreditCard customerCreditCard = null;
    Iterator<?> iterator = customer.getCustCreditCards().iterator();
    if (iterator.hasNext()) {
      customerCreditCard = (CustomerCreditCard) iterator.next();
    }
    if (customerCreditCard != null) {
      form.setCreditCardId(String.valueOf(customerCreditCard.getCreditCard().getCreditCardId()));
      form.setCustCreditCardFullName(customerCreditCard.getCustCreditCardFullName());
      form.setCustCreditCardNum(AESEncoder.getInstance().decode(customerCreditCard.getCustCreditCardNum()));
      form.setCustCreditCardExpiryMonth(customerCreditCard.getCustCreditCardExpiryMonth());
      form.setCustCreditCardExpiryYear(customerCreditCard.getCustCreditCardExpiryYear());
      form.setCustCreditCardVerNum(customerCreditCard.getCustCreditCardVerNum());
    }
   
    CustomerClass customerClass = customer.getCustomerClass();
    form.setCustClassId("");
    if (customerClass != null) {
View Full Code Here

      }
      form.setCrossSellItems(crossSellItems);
    }
   
    protected void initCreditCardInfo(ShoppingCartActionForm form, Site site, ShoppingCart shoppingCart, HttpServletRequest request, ActionMessages messages) throws Exception {
      CustomerCreditCard customerCreditCard = shoppingCart.getCustomerCreditCard();
      if (customerCreditCard != null) {
      form.setCustCreditCardFullName(customerCreditCard.getCustCreditCardFullName());
      form.setCustCreditCardNum(AESEncoder.getInstance().decode(customerCreditCard.getCustCreditCardNum()));
      form.setCustCreditCardExpiryMonth(customerCreditCard.getCustCreditCardExpiryMonth());
      form.setCustCreditCardExpiryYear(customerCreditCard.getCustCreditCardExpiryYear());
      form.setCustCreditCardVerNum(customerCreditCard.getCustCreditCardVerNum());
      CreditCard creditCard = customerCreditCard.getCreditCard();
      if (creditCard != null) {
        form.setCreditCardId(creditCard.getCreditCardId().toString());
      }
      }
    }
View Full Code Here

    }
   
    protected void saveCreditCard(ShoppingCartActionForm form, Site site, ShoppingCart shoppingCart, ContentBean contentBean) throws Exception {
      EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();
      Customer customer = shoppingCart.getCustomer();
    CustomerCreditCard customerCreditCard = null;
    Iterator<?> iterator = customer.getCustCreditCards().iterator();
    boolean found = false;
    if (iterator.hasNext()) {
      found = true;
      customerCreditCard = (CustomerCreditCard) iterator.next();
      customerCreditCard.setRecCreateBy(Constants.USERNAME_SYSTEM);
      customerCreditCard.setRecCreateDatetime(new Date(System.currentTimeMillis()));
    }
    else {
      customerCreditCard = new CustomerCreditCard();
      customerCreditCard.setRecUpdateBy(Constants.USERNAME_SYSTEM);
      customerCreditCard.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
      customerCreditCard.setRecCreateBy(Constants.USERNAME_SYSTEM);
      customerCreditCard.setRecCreateDatetime(new Date(System.currentTimeMillis()));
    }
    customerCreditCard.setCustCreditCardFullName(form.getCustCreditCardFullName());
    customerCreditCard.setCustCreditCardNum(AESEncoder.getInstance().encode(form.getCustCreditCardNum()));
    customerCreditCard.setCustCreditCardExpiryMonth(form.getCustCreditCardExpiryMonth());
    customerCreditCard.setCustCreditCardExpiryYear(form.getCustCreditCardExpiryYear());
    customerCreditCard.setCustCreditCardVerNum(form.getCustCreditCardVerNum());
    String creditCardId = form.getCreditCardId();
    CreditCard creditCard = (CreditCard) em.find(CreditCard.class, Format.getLong(creditCardId));
    customerCreditCard.setCreditCard(creditCard);
    if (customerCreditCard.getCustCreditCardId() == null) {
      em.persist(customerCreditCard);
    }
    if (!found) {
      customer.getCustCreditCards().add(customerCreditCard);
    }
View Full Code Here

    if (!shoppingCart.isCashPaymentOrder()) {
      if (shoppingCart.getPaymentEngine() != null) {
        orderHeader.setPaymentGatewayProvider(shoppingCart.getPaymentEngine().getClass().getSimpleName());
      }
    }
    CustomerCreditCard custCreditCard = shoppingCart.getCustCreditCard();
    if (!shoppingCart.isCashPaymentOrder() && custCreditCard != null) {
      orderHeader.setCreditCardDesc(custCreditCard.getCreditCard().getCreditCardDesc());
      orderHeader.setCustCreditCardNum(custCreditCard.getCustCreditCardNum());
      creditCardInfo = new CreditCardInfo();
      creditCardInfo.setCreditCardNum(AESEncoder.getInstance().decode(custCreditCard.getCustCreditCardNum()));
      creditCardInfo.setCreditCardFullName(custCreditCard.getCustCreditCardFullName());
      creditCardInfo.setCreditCardVerNum(custCreditCard.getCustCreditCardVerNum());
      creditCardInfo.setCreditCardExpiryMonth(custCreditCard.getCustCreditCardExpiryMonth());
      creditCardInfo.setCreditCardExpiryYear(custCreditCard.getCustCreditCardExpiryYear());
    }
   
    if (shoppingCart.getShippingMethod() != null) {
      orderHeader.setShippingMethodName(shoppingCart.getShippingMethod().getShippingMethodLanguage().getShippingMethodName());
      if (!contentSessionKey.isSiteProfileClassDefault()) {
View Full Code Here

  public String custCreditCardVerNum;
  public CreditCardDAO creditCard;
 
  public static CustomerCreditCard load(String siteId, Long custCreditCardId) throws SecurityException, Exception {
      EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();
    CustomerCreditCard customercreditcard = (CustomerCreditCard) em.find(CustomerCreditCard.class, custCreditCardId);
/*
    if (!customercreditcard.getSiteId().equals(siteId)) {
      throw new SecurityException();
    }
*/
 
View Full Code Here

    }
   
    GatewayRequest gwr = new GatewayRequest(mode);
      gwr.setCustomerID(customerId);
     
      CustomerCreditCard custCreditCard = null;
      Iterator<?> iterator = orderHeader.getCustomer().getCustCreditCards().iterator();
      while (iterator.hasNext()) {
        custCreditCard = (CustomerCreditCard) iterator.next();
        break;
      }
      if (custCreditCard == null) {
        paymentMessage = "Unable to locate customer credit card to refund";
        throw new AuthorizationException("Unable to locate customer credit card to refund");
      }

      gwr.setCardExpiryMonth(custCreditCard.getCustCreditCardExpiryMonth());
      gwr.setCardExpiryYear(custCreditCard.getCustCreditCardExpiryYear());
      gwr.setCardHoldersName(custCreditCard.getCustCreditCardNum());
      gwr.setCardNumber(AESEncoder.getInstance().decode(custCreditCard.getCustCreditCardNum()));
      gwr.setCustomerInvoiceRef(orderHeader.getOrderNum());
     
      PaymentTran payment = orderHeader.getPaymentTran();
    if (payment == null) {
      for (InvoiceHeader invoiceHeader : orderHeader.getInvoiceHeaders()) {
        payment = invoiceHeader.getPaymentTran();
      }
    }
      gwr.setTrxnNumber(payment.getPaymentReference1());

      gwr.setCVN(custCreditCard.getCustCreditCardVerNum());
      gwr.setTotalAmount((int)(creditHeader.getCreditTotal() * 100));
      //gwr.setTotalAmount(1000);
   
      GatewayResponse response = connector.sendRequest(gwr);
    if (!response.getTrxnStatus()) {
View Full Code Here

TOP

Related Classes of com.jada.jpa.entity.CustomerCreditCard

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.