Package com.jada.jpa.entity

Examples of com.jada.jpa.entity.OrderHeader


    if (shoppingCart.getOrderNum() != null) {
      orderHeader = OrderHeaderDAO.load(siteId, shoppingCart.getOrderNum());
      isNew = false;
    }
    else {
      orderHeader = new OrderHeader();
    }
   
    Customer customer = shoppingCart.getCustomer();
    if (customer != null) {
      OrderAddress custAddress = null;
View Full Code Here


    }
    return total;
  }
 
  public OrderHeader clone(OrderHeader header) {
    OrderHeader orderHeader = new OrderHeader();
    orderHeader.setOrderHeaderId(header.getOrderHeaderId());
    orderHeader.setOrderNum(header.getOrderNum());
    orderHeader.setCustEmail(header.getCustEmail());
    orderHeader.setShippingTotal(header.getShippingTotal());
    orderHeader.setShippingDiscountTotal(header.getShippingDiscountTotal());
    orderHeader.setOrderTotal(header.getOrderTotal());
    orderHeader.setPaymentGatewayProvider(header.getPaymentGatewayProvider());
    orderHeader.setCreditCardDesc(header.getCreditCardDesc());
    orderHeader.setCustCreditCardNum(header.getCustCreditCardNum());
    orderHeader.setShippingMethodName(header.getShippingMethodName());
    orderHeader.setOrderStatus(header.getOrderStatus());
    orderHeader.setOrderDate(header.getOrderDate());
    orderHeader.setRecUpdateBy(header.getRecUpdateBy());
    orderHeader.setRecUpdateDatetime(header.getRecUpdateDatetime());
    orderHeader.setRecCreateBy(header.getRecCreateBy());
    orderHeader.setRecCreateDatetime(header.getRecCreateDatetime());
    orderHeader.setSiteDomain(header.getSiteDomain());
    orderHeader.setSiteProfile(header.getSiteProfile());
    orderHeader.setSiteCurrency(header.getSiteCurrency());
   
    return orderHeader;
   
  }
View Full Code Here

public class OrderHeaderDAO extends OrderHeader {
  private static final long serialVersionUID = 774703970007313602L;

  public static OrderHeader load(String siteId, Long orderHeaderId) throws SecurityException, Exception {
      EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();
    OrderHeader orderheader = (OrderHeader) em.find(OrderHeader.class, orderHeaderId);
    if (!orderheader.getSiteDomain().getSite().getSiteId().equals(siteId)) {
      throw new SecurityException();
    }
    return orderheader;
  }
View Full Code Here

      Query query = em.createQuery("from OrderHeader orderHeader where orderHeader.siteDomain.site.siteId = :siteId and orderNum = :orderNum");
      query.setParameter("siteId", siteId);
      query.setParameter("orderNum", orderNum);
      Iterator<?> iterator = query.getResultList().iterator();
      if (iterator.hasNext()) {
        OrderHeader orderHeader = (OrderHeader) iterator.next();
        return orderHeader;
      }
      return null;
  }
View Full Code Here

    taxCalculator = new TaxCalculator(getEffectiveShippingAddress(), customerClass, contentBean);
    this.activeCart = true;
  }
 
  public OrderHeader locateAbundentOrder() throws Exception {
    OrderHeader orderHeader = null;
        EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();
    String sql = "from   OrderHeader orderHeader " +
           "where  orderHeader.siteDomain.site.siteId = :siteId " +
           "and    orderHeader.customer.custId = :custId " +
           "and    orderHeader.orderStatus = '" + Constants.ORDERSTATUS_OPEN + "' " +
View Full Code Here

    }
    return orderHeader;
  }
 
  public void mergeOrder(Long orderHeaderId, ContentBean contentBean) throws SecurityException, Exception {
    OrderHeader orderHeader = OrderHeaderDAO.load(siteDomain.getSite().getSiteId(), orderHeaderId);
   
    if (orderHeader.getShippingValidUntil() != null) {
      this.shippingQuoteLock = true;
      this.shippingOrderTotal = orderHeader.getShippingTotal();
      this.getShoppingCartItems().clear();
      this.getShoppingCartCoupons().clear();
    }
   
    for (OrderItemDetail orderItemDetail : orderHeader.getOrderItemDetails()) {
      Item item = orderItemDetail.getItem();
      // Do not merge order when using external data
      if (item == null) {
        continue;
      }
      Vector<ItemAttributeInfo> itemAttributeInfos = new Vector<ItemAttributeInfo>();
      for (OrderAttributeDetail orderAttributeDetail : orderItemDetail.getOrderAttributeDetails()) {
        ItemAttributeInfo itemAttributeInfo = new ItemAttributeInfo();
        itemAttributeInfo.setCustomAttribTypeCode(String.valueOf(orderAttributeDetail.getCustomAttributeDetail().getCustomAttribute().getCustomAttribTypeCode()));
        if (orderAttributeDetail.getCustomAttributeDetail() != null) {
          if (orderAttributeDetail.getCustomAttributeOption() != null) {
            itemAttributeInfo.setCustomAttribOptionId(orderAttributeDetail.getCustomAttributeOption().getCustomAttribOptionId());
          }
          for (ItemAttributeDetail itemAttributeDetail : item.getItemAttributeDetails()) {
            if (itemAttributeDetail.getCustomAttributeDetail().getCustomAttribDetailId().equals(orderAttributeDetail.getCustomAttributeDetail().getCustomAttribDetailId())) {
              itemAttributeInfo.setItemAttribDetailId(itemAttributeDetail.getItemAttribDetailId());
              itemAttributeInfo.setItemAttribDetailValue(orderAttributeDetail.getOrderAttribValue());
              break;
            }
          }
        }
        itemAttributeInfos.add(itemAttributeInfo);
      }
      if (item.getItemTypeCd().equals(Constants.ITEM_TYPE_SKU)) {
        for (ItemAttributeDetail itemAttributeDetail : item.getItemAttributeDetails()) {
            CustomAttribute customAttribute = itemAttributeDetail.getCustomAttributeDetail().getCustomAttribute();
            if (customAttribute.getCustomAttribTypeCode() != Constants.CUSTOM_ATTRIBUTE_TYPE_SKU_MAKEUP) {
              continue;
            }
            ItemAttributeInfo itemAttributeInfo = new ItemAttributeInfo();
            itemAttributeInfo.setCustomAttribTypeCode(String.valueOf(customAttribute.getCustomAttribTypeCode()));
            itemAttributeInfo.setCustomAttribOptionId(itemAttributeDetail.getCustomAttributeOption().getCustomAttribOptionId());
            itemAttributeInfo.setItemAttribDetailId(itemAttributeDetail.getItemAttribDetailId());
            itemAttributeInfos.add(itemAttributeInfo);
        }
      }
      if (!isExist(orderItemDetail.getItem())) {
        this.setItemQty(orderItemDetail.getItem(), orderItemDetail.getItemOrderQty(), itemAttributeInfos, contentBean, false);
      }
    }
    this.orderNum = orderHeader.getOrderNum();
   
    if (!cashPaymentOrder && paymentEngine == null) {
      if (orderHeader.getPaymentGatewayProvider() == null) {
        cashPayment = true;
      }
      else {
        this.paymentEngine = PaymentManager.getPaymentEngine(orderHeader.getPaymentGatewayProvider(), orderHeader.getSiteCurrency());
      }
    }
  }
View Full Code Here

        ContentLookupDispatchAction.setCustId(request, customer.getCustId());
        shoppingCart.initCustomer(customer, contentBean);
        shoppingCart.setShippingPickUp(shoppingCart.isEstimatePickUp());
        shoppingCart.setShippingMethod(null);
       
        OrderHeader orderHeader = shoppingCart.locateAbundentOrder();
        if (orderHeader != null) {
          shoppingCart.mergeOrder(orderHeader.getOrderHeaderId(), contentBean);
        }
       
        ActionForward actionForward = new ActionForward();
        if (shoppingCart.isShippingQuoteLock()) {
          actionForward = actionMapping.findForward("quote");
View Full Code Here

    }
    else {
      connector.setGatewayUrlCVN(SERVICE_URL_SANDBOX);
    }
   
    OrderHeader orderHeader = invoiceHeader.getOrderHeader();
    OrderAddress billingAddress = orderHeader.getBillingAddress();
    if (billingAddress.getCustUseAddress().equals(Constants.CUST_ADDRESS_USE_CUST)) {
      billingAddress = orderHeader.getCustAddress();
    }
    OrderAddress shippingAddress = orderHeader.getBillingAddress();
    if (shippingAddress.getCustUseAddress().equals(Constants.CUST_ADDRESS_USE_BILL)) {
      shippingAddress = billingAddress;
    }
    if (shippingAddress.getCustUseAddress().equals(Constants.CUST_ADDRESS_USE_CUST)) {
      shippingAddress = orderHeader.getCustAddress();
    }
   
    GatewayRequest gwr = new GatewayRequest(mode);
      gwr.setCustomerID(customerId);
   
      gwr.setCardExpiryMonth(creditCardInfo.getCreditCardExpiryMonth());
      gwr.setCardExpiryYear(creditCardInfo.getCreditCardExpiryYear());
      gwr.setCardHoldersName(creditCardInfo.getCreditCardNum());
      gwr.setCardNumber(creditCardInfo.getCreditCardNum());
      String customerAddress = billingAddress.getCustAddressLine1();
      if (Format.isNullOrEmpty(billingAddress.getCustAddressLine2())) {
        customerAddress += billingAddress.getCustAddressLine2();
      }
      gwr.setCustomerAddress(customerAddress);
      gwr.setCustomerBillingCountry(billingAddress.getCustCountryCode());
      gwr.setCustomerEmailAddress(orderHeader.getCustEmail());
      gwr.setCustomerFirstName(billingAddress.getCustFirstName());
      gwr.setCustomerInvoiceRef(orderHeader.getOrderNum());
     
    String remoteAddress = request.getRemoteAddr();
    if (remoteAddress.split(":").length > 4) {
      logger.error("Remote address " + remoteAddress + " seems to be a IPv6 address.");
    }
   
      gwr.setCustomerIPAddress(remoteAddress);
      gwr.setCustomerLastName(billingAddress.getCustLastName());
      gwr.setCustomerPostcode(billingAddress.getCustZipCode());
      gwr.setCVN(creditCardInfo.getCreditCardVerNum());
      gwr.setTotalAmount((int) (orderHeader.getOrderTotal() * 100));
      //gwr.setTotalAmount(1000);
      GatewayResponse response = connector.sendRequest(gwr);
    if (!response.getTrxnStatus()) {
      logger.error("request = Not able to process credit card authorization for " + orderHeader.getCustAddress().getCustFirstName() + " " + orderHeader.getCustAddress().getCustLastName());
      logger.error("response = " + response.getTrxnError());
      paymentMessage = response.getTrxnError();
      throw new AuthorizationException(response.getTrxnError());
    }
    authCode = response.getAuthCode();
View Full Code Here

    return result;
  }
 
  public void creditPayment(CreditHeader creditHeader)
      throws PaymentException, Exception {
      OrderHeader orderHeader = creditHeader.getOrderHeader();
    GatewayConnector connector = new GatewayConnector();
    int mode = GatewayRequest.REQUEST_METHOD_CVN;
    if (isProduction()) {
      connector.setGatewayUrlCVN(SERVICE_URL_PRODUCTION);
    }
    else {
      connector.setGatewayUrlCVN(SERVICE_URL_SANDBOX);
    }
   
    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()) {
      logger.error("request = Not able to process credit card authorization for " + orderHeader.getCustAddress().getCustFirstName() + " " + orderHeader.getCustAddress().getCustLastName());
      logger.error("response = " + response.getTrxnError());
      paymentMessage = response.getTrxnError();
      throw new AuthorizationException(response.getTrxnError());
    }
    authCode = response.getAuthCode();
View Full Code Here

   
    return;
  }
 
  public void creditPayment(CreditHeader creditHeader) throws PaymentException, Exception {
      OrderHeader orderHeader = creditHeader.getOrderHeader();
    String custCreditCardNum = AESEncoder.getInstance().decode(orderHeader.getCustCreditCardNum());
 
    StringBuffer sb = new StringBuffer();
    sb.append("x_login=" + loginId + "&");
    sb.append("x_tran_key=" + tranKey + "&");
    sb.append("x_version=3.1&");
    sb.append("x_method=CC&");
    sb.append("x_type=" + CARDACTION_CREDIT + "&");
    sb.append("x_delim_data=TRUE&");
    sb.append("x_delim_char=|&");
    sb.append("x_relay_response=FALSE&");
   
    PaymentTran payment = orderHeader.getPaymentTran();
    if (payment == null) {
      for (InvoiceHeader invoiceHeader : orderHeader.getInvoiceHeaders()) {
        payment = invoiceHeader.getPaymentTran();
      }
    }
      sb.append("x_trans_id=" + payment.getPaymentReference1() + "&");
      sb.append("x_card_num=" + custCreditCardNum.substring(custCreditCardNum.length() - 4) + "&");
View Full Code Here

TOP

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

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.