Examples of PaymentTran


Examples of com.jada.jpa.entity.PaymentTran

    nvp += "&METHOD=DoVoid";
    nvp += "&USER=" + URLEncoder.encode(apiUserName, Constants.SYSTEM_ENCODING);
    nvp += "&PWD=" + URLEncoder.encode(apiPassword, Constants.SYSTEM_ENCODING);
    nvp += "&SIGNATURE=" + URLEncoder.encode(signature, Constants.SYSTEM_ENCODING);
   
    PaymentTran payment = invoiceHeader.getOrderHeader().getPaymentTran();
    nvp += "&AUTHORIZATIONID=" + payment.getAuthCode();

    if (ApplicationGlobal.isLocalTesting()) {
      logger.error(nvp);
    }
    String response = sendTransmission(nvp);
View Full Code Here

Examples of com.jada.jpa.entity.PaymentTran

    nvp += "&METHOD=DoCapture";
    nvp += "&USER=" + URLEncoder.encode(apiUserName, Constants.SYSTEM_ENCODING);
    nvp += "&PWD=" + URLEncoder.encode(apiPassword, Constants.SYSTEM_ENCODING);
    nvp += "&SIGNATURE=" + URLEncoder.encode(signature, Constants.SYSTEM_ENCODING);
   
    PaymentTran payment = invoiceHeader.getOrderHeader().getPaymentTran();
    nvp += "&COMPLETETYPE=NOTCOMPLETE";
    nvp += "&AUTHORIZATIONID=" + payment.getAuthCode();
    nvp += "&AMT=" + URLEncoder.encode(Format.getSimpleFloat(invoiceHeader.getInvoiceTotal()), Constants.SYSTEM_ENCODING);

    if (ApplicationGlobal.isLocalTesting()) {
      logger.error(nvp);
    }
View Full Code Here

Examples of com.jada.jpa.entity.PaymentTran

    nvp += "&USER=" + URLEncoder.encode(apiUserName, Constants.SYSTEM_ENCODING);
    nvp += "&PWD=" + URLEncoder.encode(apiPassword, Constants.SYSTEM_ENCODING);
    nvp += "&SIGNATURE=" + URLEncoder.encode(signature, Constants.SYSTEM_ENCODING);
   
    InvoiceHeader invoiceHeader = creditHeader.getInvoiceHeader();
    PaymentTran payment = invoiceHeader.getPaymentTran();
    nvp += "&REFUNDTYPE=Partial";
    nvp += "&TRANSACTIONID=" + payment.getAuthCode();
    nvp += "&AMT=" + URLEncoder.encode(Format.getSimpleFloat(creditHeader.getCreditTotal()), Constants.SYSTEM_ENCODING);

    if (ApplicationGlobal.isLocalTesting()) {
      logger.error(nvp);
    }
View Full Code Here

Examples of com.jada.jpa.entity.PaymentTran

    orderHeaderDisplayForm.setOrderStatus(resources.getMessage("order.status." + orderHeader.getOrderStatus()));
    orderHeaderDisplayForm.setOrderDate(Format.getFullDate(orderHeader.getOrderDate()));
    form.setOrderHeader(orderHeaderDisplayForm);
   
    if (orderHeader.getPaymentTran() != null) {
      PaymentTran paymentTran = orderHeader.getPaymentTran();
      PaymentTranDisplayForm paymentForm = new PaymentTranDisplayForm();
      paymentForm.setAuthCode(paymentTran.getAuthCode());
      paymentForm.setPaymentReference1(paymentTran.getPaymentReference1());
      paymentForm.setPaymentReference2(paymentTran.getPaymentReference2());
      paymentForm.setPaymentReference3(paymentTran.getPaymentReference3());
      paymentForm.setPaymentReference4(paymentTran.getPaymentReference4());
      paymentForm.setPaymentReference5(paymentTran.getPaymentReference5());
      orderHeaderDisplayForm.setPaymentTran(paymentForm);
    }
    if (orderHeader.getVoidPaymentTran() != null) {
      PaymentTran paymentTran = orderHeader.getVoidPaymentTran();
      PaymentTranDisplayForm paymentForm = new PaymentTranDisplayForm();
      paymentForm.setAuthCode(paymentTran.getAuthCode());
      paymentForm.setPaymentReference1(paymentTran.getPaymentReference1());
      paymentForm.setPaymentReference2(paymentTran.getPaymentReference2());
      paymentForm.setPaymentReference3(paymentTran.getPaymentReference3());
      paymentForm.setPaymentReference4(paymentTran.getPaymentReference4());
      paymentForm.setPaymentReference5(paymentTran.getPaymentReference5());
      orderHeaderDisplayForm.setVoidPaymentTran(paymentForm);
    }
   
    OrderAddress custAddress = orderHeader.getCustAddress();
    CustomerAddressDisplayForm addressForm = new CustomerAddressDisplayForm();
    addressForm.setCustUseAddress(custAddress.getCustUseAddress());
    addressForm.setOrderAddressId(custAddress.getOrderAddressId().toString());
    addressForm.setCustPrefix(custAddress.getCustPrefix());
    addressForm.setCustFirstName(custAddress.getCustFirstName());
    addressForm.setCustMiddleName(custAddress.getCustMiddleName());
    addressForm.setCustLastName(custAddress.getCustLastName());
    addressForm.setCustSuffix(custAddress.getCustSuffix());
    addressForm.setCustAddressLine1(custAddress.getCustAddressLine1());
    addressForm.setCustAddressLine2(custAddress.getCustAddressLine2());
    addressForm.setCustCityName(custAddress.getCustCityName());
    Country country = custAddress.getCountry();
    State state = custAddress.getState();
    if (state != null) {
      addressForm.setCustStateName(state.getStateName());
      addressForm.setCustStateCode(state.getStateCode());
    }
    addressForm.setCustCountryName(country.getCountryName());
    addressForm.setCustCountryCode(country.getCountryCode());
    addressForm.setCustZipCode(custAddress.getCustZipCode());
    addressForm.setCustPhoneNum(custAddress.getCustPhoneNum());
    addressForm.setCustFaxNum(custAddress.getCustFaxNum());
    form.setCustAddress(addressForm);
   
    OrderAddress billingAddress = orderHeader.getBillingAddress();
    addressForm = new CustomerAddressDisplayForm();
    addressForm.setCustUseAddress(billingAddress.getCustUseAddress());
    if (billingAddress.getCustUseAddress().equals(Constants.CUST_ADDRESS_USE_OWN)) {
      addressForm.setOrderAddressId(billingAddress.getOrderAddressId().toString());
      addressForm.setCustPrefix(billingAddress.getCustPrefix());
      addressForm.setCustFirstName(billingAddress.getCustFirstName());
      addressForm.setCustMiddleName(billingAddress.getCustMiddleName());
      addressForm.setCustLastName(billingAddress.getCustLastName());
      addressForm.setCustSuffix(billingAddress.getCustSuffix());
      addressForm.setCustAddressLine1(billingAddress.getCustAddressLine1());
      addressForm.setCustAddressLine2(billingAddress.getCustAddressLine2());
      country = billingAddress.getCountry();
      state = billingAddress.getState();
      addressForm.setCustCityName(billingAddress.getCustCityName());
      if (state != null) {
        addressForm.setCustStateName(state.getStateName());
        addressForm.setCustStateCode(state.getStateCode());
      }
      addressForm.setCustCountryName(country.getCountryName());
      addressForm.setCustCountryCode(country.getCountryCode());
      addressForm.setCustZipCode(billingAddress.getCustZipCode());
      addressForm.setCustPhoneNum(billingAddress.getCustPhoneNum());
      addressForm.setCustFaxNum(billingAddress.getCustFaxNum());
    }
    form.setBillingAddress(addressForm);
   
    OrderAddress shippingAddress = orderHeader.getShippingAddress();
    addressForm = new CustomerAddressDisplayForm();
    addressForm.setCustUseAddress(shippingAddress.getCustUseAddress());
    if (shippingAddress.getCustUseAddress().equals(Constants.CUST_ADDRESS_USE_OWN)) {
      addressForm.setOrderAddressId(shippingAddress.getOrderAddressId().toString());
      addressForm.setCustPrefix(shippingAddress.getCustPrefix());
      addressForm.setCustFirstName(shippingAddress.getCustFirstName());
      addressForm.setCustMiddleName(shippingAddress.getCustMiddleName());
      addressForm.setCustLastName(shippingAddress.getCustLastName());
      addressForm.setCustSuffix(shippingAddress.getCustSuffix());
      addressForm.setCustAddressLine1(shippingAddress.getCustAddressLine1());
      addressForm.setCustAddressLine2(shippingAddress.getCustAddressLine2());
      addressForm.setCustCityName(shippingAddress.getCustCityName());
      country = shippingAddress.getCountry();
      state = shippingAddress.getState();
      if (state != null) {
        addressForm.setCustStateName(state.getStateName());
        addressForm.setCustStateCode(state.getStateCode());
      }
      addressForm.setCustCountryName(country.getCountryName());
      addressForm.setCustCountryCode(country.getCountryCode());
      addressForm.setCustZipCode(shippingAddress.getCustZipCode());
      addressForm.setCustPhoneNum(shippingAddress.getCustPhoneNum());
      addressForm.setCustFaxNum(shippingAddress.getCustFaxNum());
    }
    form.setShippingAddress(addressForm);
   
    Vector<OrderItemDetailDisplayForm> orderItemDetails = new Vector<OrderItemDetailDisplayForm>();
    Iterator<?> iterator = null;
    iterator = orderHeader.getOrderItemDetails().iterator();
    int itemOrderTotal = 0;
    int itemInvoiceTotal = 0;
    int itemCreditTotal = 0;
    int itemShipTotal = 0;
    float itemDetailAmount = 0;
    float itemDetailDiscountAmount = 0;
    float itemDetailSubTotal = 0;
    while (iterator.hasNext()) {
      OrderItemDetail orderItemDetail = (OrderItemDetail) iterator.next();
      OrderItemDetailDisplayForm itemDisplay = new OrderItemDetailDisplayForm();
      itemDisplay.setOrderItemDetailId(orderItemDetail.getOrderItemDetailId().toString());
      Item item = orderItemDetail.getItem();
      itemDisplay.setItemId("");
      itemDisplay.setItemNum(orderItemDetail.getItemNum());
      itemDisplay.setItemSkuCd(orderItemDetail.getItemSkuCd());
      itemDisplay.setItemShortDesc(orderItemDetail.getItemShortDesc());
      itemDisplay.setItemTierQty(Format.getInt(orderItemDetail.getItemTierQty()));
      itemDisplay.setItemTierPrice(Format.getFloat(orderItemDetail.getItemTierPrice()));
      itemDisplay.setItemOrderQty(Format.getInt(orderItemDetail.getItemOrderQty()));
      itemDisplay.setItemDetailAmount(Format.getFloat(orderItemDetail.getItemDetailAmount()));
      itemDisplay.setItemDetailDiscountAmount(Format.getFloat(orderItemDetail.getItemDetailDiscountAmount()));
      float total = orderItemDetail.getItemDetailAmount() - orderItemDetail.getItemDetailDiscountAmount();
      itemDisplay.setItemDetailSubTotal(Format.getFloat(total));
     
      if (item != null) {
        itemDisplay.setItemId(item.getItemId().toString());
        itemDisplay.setItemShortDesc(orderItemDetail.getItem().getItemLanguage().getItemShortDesc());
      }
     
      Vector<OrderItemAttributeBean> orderItemAttributes = new Vector<OrderItemAttributeBean>();
      if (item != null && 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;
            }
            OrderItemAttributeBean orderItemAttributeBean = new OrderItemAttributeBean();
            orderItemAttributeBean.setCustomAttribDesc(customAttribute.getCustomAttributeLanguage().getCustomAttribDesc());
              CustomAttributeOption customAttributeOption = itemAttributeDetail.getCustomAttributeOption();
              orderItemAttributeBean.setCustomAttribValue(customAttributeOption.getCustomAttributeOptionLanguage().getCustomAttribValue());
              orderItemAttributes.add(orderItemAttributeBean);
          }
      }
        for (OrderAttributeDetail orderAttributeDetail : orderItemDetail.getOrderAttributeDetails()) {
          OrderItemAttributeBean orderItemAttributeBean = new OrderItemAttributeBean();
          CustomAttribute customAttribute = orderAttributeDetail.getCustomAttributeDetail().getCustomAttribute();
          orderItemAttributeBean.setCustomAttribDesc(customAttribute.getCustomAttributeLanguage().getCustomAttribDesc());
           
            if (customAttribute.getCustomAttribTypeCode() == Constants.CUSTOM_ATTRIBUTE_TYPE_CUST_INPUT) {
              orderItemAttributeBean.setCustomAttribValue(orderAttributeDetail.getOrderAttribValue());
            }
            else {
              CustomAttributeOption customAttributeOption = orderAttributeDetail.getCustomAttributeOption();
              orderItemAttributeBean.setCustomAttribValue(customAttributeOption.getCustomAttributeOptionLanguage().getCustomAttribValue());
            }
            orderItemAttributes.add(orderItemAttributeBean);
        }
      itemDisplay.setOrderItemAttributes(orderItemAttributes);
     
      Iterator<?> invoiceIterator = orderItemDetail.getInvoiceDetails().iterator();
      int itemInvoiceQty = 0;
      while (invoiceIterator.hasNext()) {
        InvoiceDetail invoiceDetail = (InvoiceDetail) invoiceIterator.next();
        InvoiceHeader iHeader = invoiceDetail.getInvoiceHeader();
        if (iHeader.getInvoiceHeaderId() == null) {
          continue;
        }
        if (invoiceHeader != null) {
          if (iHeader.getInvoiceHeaderId().equals(invoiceHeader.getInvoiceHeaderId())) {
            continue;
          }
        }
        String status = iHeader.getInvoiceStatus();
        if (status.equals(Constants.ORDERSTATUS_CANCELLED) || status.equals(Constants.ORDERSTATUS_VOIDED)) {
          continue;
        }
        itemInvoiceQty += invoiceDetail.getItemInvoiceQty();
        itemInvoiceTotal += invoiceDetail.getItemInvoiceQty();
      }
      itemDisplay.setItemInvoiceQty(Format.getInt(itemInvoiceQty));

      Iterator<?> creditIterator = orderItemDetail.getCreditDetails().iterator();
      int itemCreditQty = 0;
      while (creditIterator.hasNext()) {
        CreditDetail creditDetail = (CreditDetail) creditIterator.next();
        CreditHeader cHeader = creditDetail.getCreditHeader();
        if (cHeader.getCreditHeaderId() == null) {
          continue;
        }
        if (creditHeader != null) {
          if (cHeader.getCreditHeaderId().equals(creditHeader.getCreditHeaderId())) {
            continue;
          }
        }
        String status = cHeader.getCreditStatus();
        if (status.equals(Constants.ORDERSTATUS_CANCELLED) || status.equals(Constants.ORDERSTATUS_VOIDED)) {
          continue;
        }

        itemCreditQty += creditDetail.getItemCreditQty();
        itemCreditTotal += creditDetail.getItemCreditQty();
      }
      itemDisplay.setItemCreditQty(Format.getInt(itemCreditQty));

      Iterator<?> shipIterator = orderItemDetail.getShipDetails().iterator();
      int itemShipQty = 0;
      while (shipIterator.hasNext()) {
        ShipDetail shipDetail = (ShipDetail) shipIterator.next();
        ShipHeader sHeader = shipDetail.getShipHeader();
        if (sHeader.getShipHeaderId() == null) {
          continue;
        }
        if (shipHeader != null) {
          if (sHeader.getShipHeaderId().equals(shipHeader.getShipHeaderId())) {
            continue;
          }
        }
        String status = sHeader.getShipStatus();
        if (status.equals(Constants.ORDERSTATUS_CANCELLED) || status.equals(Constants.ORDERSTATUS_VOIDED)) {
          continue;
        }
        itemShipQty += shipDetail.getItemShipQty();
        itemShipTotal += shipDetail.getItemShipQty();
      }
      itemDisplay.setItemShipQty(Format.getInt(itemShipQty));

      itemOrderTotal += orderItemDetail.getItemOrderQty();
      itemDetailAmount += orderItemDetail.getItemDetailAmount();
      itemDetailDiscountAmount += orderItemDetail.getItemDetailDiscountAmount();
      itemDetailSubTotal += total;
     
      int itemSuggestInvoiceQty = orderItemDetail.getItemOrderQty() - itemInvoiceQty + itemCreditQty;
      int itemSuggestShipQty = orderItemDetail.getItemOrderQty() - itemShipQty;
      int itemSuggestCreditQty = itemInvoiceQty - itemCreditQty;
      itemDisplay.setItemSuggestInvoiceQty(itemSuggestInvoiceQty);
      itemDisplay.setItemSuggestShipQty(itemSuggestShipQty);
      itemDisplay.setItemSuggestCreditQty(itemSuggestCreditQty);
     
      orderItemDetails.add(itemDisplay);
    }
    form.setOrderItemDetails(orderItemDetails);

    orderHeaderDisplayForm.setItemOrderQty(Format.getInt(itemOrderTotal));
    orderHeaderDisplayForm.setItemInvoiceQty(Format.getInt(itemInvoiceTotal));
    orderHeaderDisplayForm.setItemCreditQty(Format.getInt(itemCreditTotal));
    orderHeaderDisplayForm.setItemShipQty(Format.getInt(itemShipTotal));
    orderHeaderDisplayForm.setItemDetailAmount(Format.getFloat(itemDetailAmount));
    orderHeaderDisplayForm.setItemDetailDiscountAmount(Format.getFloat(itemDetailDiscountAmount));
    orderHeaderDisplayForm.setItemDetailSubTotal(Format.getFloat(itemDetailSubTotal));
   
    form.setAllowCredit(false);
    form.setAllowInvoice(false);
    form.setAllowShip(false);
    form.setAllowCancel(false);
    // TODO should move the following logic into OrderHeaderDAO
    if (!orderHeader.getOrderStatus().equals(Constants.ORDERSTATUS_CANCELLED) && itemInvoiceTotal < itemOrderTotal) {
      form.setAllowInvoice(true);
    }
    if (!orderHeader.getOrderStatus().equals(Constants.ORDERSTATUS_CANCELLED) && itemShipTotal < itemOrderTotal) {
      form.setAllowShip(true);
    }
    if (OrderHeaderDAO.isAllowCancel(orderHeader)) {
      form.setAllowCancel(true);
    }
   
    if (invoiceHeader != null) {
      float creditTotal = 0;
      for (CreditHeader cHeader : invoiceHeader.getCreditHeaders()) {
        creditTotal += cHeader.getCreditTotal();
      }
      if (!orderHeader.getOrderStatus().equals(Constants.ORDERSTATUS_CANCELLED) && creditTotal < invoiceHeader.getInvoiceTotal()) {
        if (orderHeader.getPaymentGatewayProvider() == null || !orderHeader.getPaymentGatewayProvider().equals(PayPalEngine.class.getSimpleName())) {
          form.setAllowCredit(true);
        }
      }
    }

    Vector<OrderOtherDetailDisplayForm> orderOtherDetails = new Vector<OrderOtherDetailDisplayForm>();
    iterator = orderHeader.getOrderOtherDetails().iterator();
    float orderOtherDetailAmount = 0;
    while (iterator.hasNext()) {
      OrderOtherDetail orderOtherDetail = (OrderOtherDetail) iterator.next();
      OrderOtherDetailDisplayForm otherDisplay = new OrderOtherDetailDisplayForm();
      otherDisplay.setOrderOtherDetailId(orderOtherDetail.getOrderOtherDetailId().toString());
      otherDisplay.setOrderOtherDetailNum(orderOtherDetail.getOrderOtherDetailNum());
      otherDisplay.setOrderOtherDetailDesc(orderOtherDetail.getOrderOtherDetailDesc());
      otherDisplay.setOrderOtherDetailAmount(Format.getFloat(orderOtherDetail.getOrderOtherDetailAmount()));
      orderOtherDetailAmount += orderOtherDetail.getOrderOtherDetailAmount();
      orderOtherDetails.add(otherDisplay);
    }
    form.setOrderOtherDetails(orderOtherDetails);
    orderHeaderDisplayForm.setOrderOtherDetailAmount(Format.getFloat(orderOtherDetailAmount));
   
    iterator = orderEngine.getOrderTaxes().iterator();
    Vector<OrderTax> orderTaxes = new Vector<OrderTax>();
    while (iterator.hasNext()) {
      OrderDetailTax orderDetailTax = (OrderDetailTax) iterator.next();
      OrderTax orderTax = new OrderTax();
      orderTax.setTaxName(orderDetailTax.getTax().getTaxLanguage().getTaxName());
      orderTax.setTaxAmount(Format.getFloat(orderDetailTax.getTaxAmount()));
      orderTaxes.add(orderTax);
    }
    form.setOrderTaxes(orderTaxes);
   
    iterator = orderHeader.getOrderTrackings().iterator();
    Vector<OrderTrackingDisplayForm> orderTrackings = new Vector<OrderTrackingDisplayForm>();
    while (iterator.hasNext()) {
      OrderTracking orderTracking = (OrderTracking) iterator.next();
      if (orderTracking.getCreditHeader() != null) {
        continue;
      }
      if (orderTracking.getInvoiceHeader() != null) {
        continue;
      }
      OrderTrackingDisplayForm orderTrackingDisplayForm = new OrderTrackingDisplayForm();
      orderTrackingDisplayForm.setOrderTrackingId(orderTracking.getOrderTrackingId().toString());
      orderTrackingDisplayForm.setOrderTrackingMessage(orderTracking.getOrderTrackingMessage());
      orderTrackingDisplayForm.setOrderTrackingInternal(false);
      if (orderTracking.getOrderTrackingInternal().equals(String.valueOf(Constants.VALUE_YES))) {
        orderTrackingDisplayForm.setOrderTrackingInternal(true);
      }
      orderTrackingDisplayForm.setRecUpdateDatetime(Format.getFullDatetime(orderTracking.getRecUpdateDatetime()));
      orderTrackings.add(orderTrackingDisplayForm);
    }
    orderHeaderDisplayForm.setOrderTrackings(orderTrackings);
   
    Vector<InvoiceHeaderDisplayForm> invoiceHeaders = new Vector<InvoiceHeaderDisplayForm>();
    iterator = orderHeader.getInvoiceHeaders().iterator();
    while (iterator.hasNext()) {
      InvoiceHeader iHeader = (InvoiceHeader) iterator.next();
      // invoiceHeader might have been updated. eg.capture
      if (invoiceHeader != null) {
        if (iHeader.getInvoiceHeaderId().equals(invoiceHeader.getInvoiceHeaderId())) {
          iHeader = invoiceHeader;
        }
      }
      InvoiceHeaderDisplayForm invoiceHeaderDisplayForm = new InvoiceHeaderDisplayForm();
      if (iHeader.getInvoiceHeaderId() != null) {
        invoiceHeaderDisplayForm.setInvoiceHeaderId(iHeader.getInvoiceHeaderId().toString());
      }
      invoiceHeaderDisplayForm.setInvoiceNum(iHeader.getInvoiceNum());
      invoiceHeaderDisplayForm.setShippingTotal(Format.getFloat(iHeader.getShippingTotal()));
      invoiceHeaderDisplayForm.setInvoiceTotal(Format.getFloat(iHeader.getInvoiceTotal()));
      invoiceHeaderDisplayForm.setInvoiceStatus(resources.getMessage("order.status." + iHeader.getInvoiceStatus()));
      invoiceHeaderDisplayForm.setInvoiceDate(Format.getFullDate(iHeader.getInvoiceDate()));
     
      Iterator<?> trackingIterator = iHeader.getInvoiceTrackings().iterator();
      Vector<OrderTrackingDisplayForm> invoiceTrackings = new Vector<OrderTrackingDisplayForm>();
      while (trackingIterator.hasNext()) {
        OrderTracking orderTracking = (OrderTracking) trackingIterator.next();
        OrderTrackingDisplayForm orderTrackingDisplayForm = new OrderTrackingDisplayForm();
        orderTrackingDisplayForm.setOrderTrackingId(orderTracking.getOrderTrackingId().toString());
        orderTrackingDisplayForm.setOrderTrackingMessage(orderTracking.getOrderTrackingMessage());
        orderTrackingDisplayForm.setOrderTrackingInternal(false);
        if (orderTracking.getOrderTrackingInternal().equals(String.valueOf(Constants.VALUE_YES))) {
          orderTrackingDisplayForm.setOrderTrackingInternal(true);
        }
        orderTrackingDisplayForm.setRecUpdateDatetime(Format.getFullDatetime(orderTracking.getRecUpdateDatetime()));
        invoiceTrackings.add(orderTrackingDisplayForm);
      }
      invoiceHeaderDisplayForm.setOrderTrackings(invoiceTrackings);

     
      if (iHeader.getPaymentTran() != null) {
        PaymentTran paymentTran = iHeader.getPaymentTran();
        PaymentTranDisplayForm paymentForm = new PaymentTranDisplayForm();
        paymentForm.setAuthCode(paymentTran.getAuthCode());
        paymentForm.setPaymentReference1(paymentTran.getPaymentReference1());
        paymentForm.setPaymentReference2(paymentTran.getPaymentReference2());
        paymentForm.setPaymentReference3(paymentTran.getPaymentReference3());
        paymentForm.setPaymentReference4(paymentTran.getPaymentReference4());
        paymentForm.setPaymentReference5(paymentTran.getPaymentReference5());
        invoiceHeaderDisplayForm.setPaymentTran(paymentForm);
      }
      if (iHeader.getVoidPaymentTran() != null) {
        PaymentTran paymentTran = iHeader.getVoidPaymentTran();
        PaymentTranDisplayForm paymentForm = new PaymentTranDisplayForm();
        paymentForm.setAuthCode(paymentTran.getAuthCode());
        paymentForm.setPaymentReference1(paymentTran.getPaymentReference1());
        paymentForm.setPaymentReference2(paymentTran.getPaymentReference2());
        paymentForm.setPaymentReference3(paymentTran.getPaymentReference3());
        paymentForm.setPaymentReference4(paymentTran.getPaymentReference4());
        paymentForm.setPaymentReference5(paymentTran.getPaymentReference5());
        invoiceHeaderDisplayForm.setVoidPaymentTran(paymentForm);
      }
      invoiceHeaders.add(invoiceHeaderDisplayForm);
    }
    form.setInvoiceHeaders(invoiceHeaders);
   
    Vector<CreditHeaderDisplayForm> creditHeaders = new Vector<CreditHeaderDisplayForm>();
    iterator = orderHeader.getCreditHeaders().iterator();
    while (iterator.hasNext()) {
      CreditHeader iHeader = (CreditHeader) iterator.next();
      // creditHeader might have been updated. eg.capture
      if (creditHeader != null) {
        if (iHeader.getCreditHeaderId().equals(creditHeader.getCreditHeaderId())) {
          iHeader = creditHeader;
        }
      }
      CreditHeaderDisplayForm creditHeaderDisplayForm = new CreditHeaderDisplayForm();
      if (iHeader.getCreditHeaderId() != null) {
        creditHeaderDisplayForm.setCreditHeaderId(iHeader.getCreditHeaderId().toString());
      }
      creditHeaderDisplayForm.setCreditNum(iHeader.getCreditNum());
      creditHeaderDisplayForm.setUpdateInventory(false);
      if (iHeader.getUpdateInventory().equals(String.valueOf(Constants.VALUE_YES))) {
        creditHeaderDisplayForm.setUpdateInventory(true);
      }
      creditHeaderDisplayForm.setShippingTotal(Format.getFloat(iHeader.getShippingTotal()));
      creditHeaderDisplayForm.setCreditTotal(Format.getFloat(iHeader.getCreditTotal()));
      creditHeaderDisplayForm.setCreditStatus(resources.getMessage("order.status." + iHeader.getCreditStatus()));
      creditHeaderDisplayForm.setCreditDate(Format.getFullDate(iHeader.getCreditDate()));
     
      Iterator<?> trackingIterator = iHeader.getCreditTrackings().iterator();
      Vector<OrderTrackingDisplayForm> creditTrackings = new Vector<OrderTrackingDisplayForm>();
      while (trackingIterator.hasNext()) {
        OrderTracking orderTracking = (OrderTracking) trackingIterator.next();
        OrderTrackingDisplayForm orderTrackingDisplayForm = new OrderTrackingDisplayForm();
        orderTrackingDisplayForm.setOrderTrackingId(orderTracking.getOrderTrackingId().toString());
        orderTrackingDisplayForm.setOrderTrackingMessage(orderTracking.getOrderTrackingMessage());
        orderTrackingDisplayForm.setOrderTrackingInternal(false);
        if (orderTracking.getOrderTrackingInternal().equals(String.valueOf(Constants.VALUE_YES))) {
          orderTrackingDisplayForm.setOrderTrackingInternal(true);
        }
        orderTrackingDisplayForm.setRecUpdateDatetime(Format.getFullDatetime(orderTracking.getRecUpdateDatetime()));
        creditTrackings.add(orderTrackingDisplayForm);
      }
      creditHeaderDisplayForm.setOrderTrackings(creditTrackings);

     
      if (iHeader.getPaymentTran() != null) {
        PaymentTran paymentTran = iHeader.getPaymentTran();
        PaymentTranDisplayForm paymentForm = new PaymentTranDisplayForm();
        paymentForm.setAuthCode(paymentTran.getAuthCode());
        paymentForm.setPaymentReference1(paymentTran.getPaymentReference1());
        paymentForm.setPaymentReference2(paymentTran.getPaymentReference2());
        paymentForm.setPaymentReference3(paymentTran.getPaymentReference3());
        paymentForm.setPaymentReference4(paymentTran.getPaymentReference4());
        paymentForm.setPaymentReference5(paymentTran.getPaymentReference5());
        creditHeaderDisplayForm.setPaymentTran(paymentForm);
      }
      if (iHeader.getVoidPaymentTran() != null) {
        PaymentTran paymentTran = iHeader.getVoidPaymentTran();
        PaymentTranDisplayForm paymentForm = new PaymentTranDisplayForm();
        paymentForm.setAuthCode(paymentTran.getAuthCode());
        paymentForm.setPaymentReference1(paymentTran.getPaymentReference1());
        paymentForm.setPaymentReference2(paymentTran.getPaymentReference2());
        paymentForm.setPaymentReference3(paymentTran.getPaymentReference3());
        paymentForm.setPaymentReference4(paymentTran.getPaymentReference4());
        paymentForm.setPaymentReference5(paymentTran.getPaymentReference5());
        creditHeaderDisplayForm.setVoidPaymentTran(paymentForm);
      }
      creditHeaders.add(creditHeaderDisplayForm);
    }
    form.setCreditHeaders(creditHeaders);
View Full Code Here

Examples of com.jada.jpa.entity.PaymentTran

          orderDisplay.setTaxTotal("");
          orderDisplay.setOrderTotal(contentBean.getFormatter().formatCurrency(orderHeader.getOrderTotal()));
          String orderStatus = Languages.getLangTranValue(contentBean.getContentSessionKey().getLangId(), "content.text.order.status." + orderHeader.getOrderStatus());
          orderDisplay.setOrderStatus(orderStatus);
          orderDisplay.setOrderDatetime(Format.getDate(orderHeader.getOrderDate()));
          PaymentTran payment = orderHeader.getPaymentTran();
          if (payment != null) {
            orderDisplay.setPaymentReference1(payment.getPaymentReference1());
          }
          for (ShipHeader shipHeader : orderHeader.getShipHeaders()) {
            orderDisplay.setShipDatetime(Format.getDate(shipHeader.getShipDate()));
          }
            vector.add(orderDisplay);
View Full Code Here

Examples of com.jada.jpa.entity.PaymentTran

        shippingAddressForm.setCustFaxNum(shippingAddress.getCustFaxNum());
        form.setShippingAddress(shippingAddressForm);
    }
      form.setCustEmail(orderHeader.getCustEmail());
      form.setShippingMethodName(orderHeader.getShippingMethodName());
      PaymentTran payment = orderHeader.getPaymentTran();
      if (payment == null) {
        for (InvoiceHeader invoiceHeader : orderHeader.getInvoiceHeaders()) {
          payment = invoiceHeader.getPaymentTran();
        }
      }
      if (payment != null) {
        form.setPaymentGatewayProvider(orderHeader.getPaymentGatewayProvider());
        if (orderHeader.getPaymentGatewayProvider().equals(PayPalEngine.class.getSimpleName())) {
            form.setPayPal(true);
            form.setAuthCode(payment.getAuthCode());
        }
        else {
          form.setPayPal(false);
          form.setCreditCardDesc(orderHeader.getCreditCardDesc());
          String custCreditCardNum = AESEncoder.getInstance().decode(orderHeader.getCustCreditCardNum());
          custCreditCardNum = Utility.maskCreditCardNumber(custCreditCardNum);
          form.setCustCreditCardNum(custCreditCardNum);
          form.setAuthCode(payment.getAuthCode());
        }
      }
      else {
        form.setCashPaymentOrder(true);
      }
      form.setOrderNum(orderNum);
      form.setOrderDatetime(formatter.formatFullDate(orderHeader.getOrderDate()));
      PaymentGateway paymentGateway = null;
      if (paymentGateway != null) {
        if (orderHeader.getPaymentGatewayProvider().equals(PayPalEngine.class.getSimpleName())) {
          form.setPayPal(true);
        }
        PaymentTran paymentTran = orderHeader.getPaymentTran();
        if (paymentTran == null) {
          Iterator<?> invoiceIterator = orderHeader.getInvoiceHeaders().iterator();
          if (invoiceIterator.hasNext()) {
            InvoiceHeader invoiceHeader = (InvoiceHeader) invoiceIterator.next();
            paymentTran = invoiceHeader.getPaymentTran();
          }
        }
      if (paymentTran != null) {
        form.setAuthCode(paymentTran.getAuthCode());
      }
      }
     
      Long siteProfileId = contentBean.getContentSessionBean().getSiteProfile().getSiteProfileId();
      SiteDomainLanguage siteDomainLanguage = contentBean.getContentSessionBean().getSiteDomain().getSiteDomainLanguage();
View Full Code Here

Examples of com.jada.jpa.entity.PaymentTran

      throw new PaymentException("Order is not open");
    }
    if (!shoppingCart.isCashPaymentOrder()) {
      paymentEngine.setCreditCardInfo(creditCardInfo);
      shoppingCart.getPaymentEngine().authorizePayment(orderHeader, request);
      PaymentTran paymentTran = new PaymentTran();
      paymentTran.setAuthCode(paymentEngine.getAuthCode());
      paymentTran.setPaymentReference1(paymentEngine.getPaymentReference1());
      paymentTran.setPaymentReference2(paymentEngine.getPaymentReference2());
      paymentTran.setPaymentReference3(paymentEngine.getPaymentReference3());
      paymentTran.setPaymentReference4(paymentEngine.getPaymentReference4());
      paymentTran.setPaymentReference5(paymentEngine.getPaymentReference5());
      paymentTran.setTranDatetime(new Date());
      orderHeader.setPaymentTran(paymentTran);
      orderHeader.setPaymentGatewayProvider(paymentEngine.getClass().getSimpleName());
    }
    orderHeader.setOrderStatus(calcStatus(orderHeader));
  }
View Full Code Here

Examples of com.jada.jpa.entity.PaymentTran

          em.persist(orderOtherDetail);
        }
      }
    }
   
    PaymentTran paymentTran = orderHeader.getPaymentTran();
    if (paymentTran != null) {
      if (paymentTran.getRecUpdateDatetime() == null) {
        paymentTran.setRecCreateBy(userId);
        paymentTran.setRecCreateDatetime(current);
        paymentTran.setRecUpdateBy(userId);
        paymentTran.setRecUpdateDatetime(current);
        if (paymentTran.getPaymentTranId() == null) {
          em.persist(paymentTran);
        }
      }
    }
    paymentTran = orderHeader.getVoidPaymentTran();
    if (paymentTran != null) {
      if (paymentTran.getRecUpdateDatetime() == null) {
        paymentTran.setRecCreateBy(userId);
        paymentTran.setRecCreateDatetime(current);
        paymentTran.setRecUpdateBy(userId);
        paymentTran.setRecUpdateDatetime(current);
        if (paymentTran.getPaymentTranId() == null) {
          em.persist(paymentTran);
        }
      }
    }
   
View Full Code Here

Examples of com.jada.jpa.entity.PaymentTran

    creditHeader.setRecCreateDatetime(header.getRecCreateDatetime());
    creditHeader.setOrderHeader(header.getOrderHeader());
    creditHeader.setInvoiceHeader(header.getInvoiceHeader());
   
    if (header.getPaymentTran() != null) {
      PaymentTran pt = header.getPaymentTran();
      PaymentTran paymentTran = new PaymentTran();
      PropertyUtils.copyProperties(paymentTran, pt);
      creditHeader.setPaymentTran(paymentTran);
    }
    if (header.getVoidPaymentTran() != null) {
      PaymentTran pt = header.getVoidPaymentTran();
      PaymentTran paymentTran = new PaymentTran();
      PropertyUtils.copyProperties(paymentTran, pt);
      creditHeader.setVoidPaymentTran(paymentTran);
    }
   
    Iterator<?> iterator = header.getCreditDetails().iterator();
View Full Code Here

Examples of com.jada.jpa.entity.PaymentTran

      throw new OrderStateException("Order is already voided");
    }
    if (paymentEngine != null) {
      paymentEngine.creditPayment(creditHeader);
     
      PaymentTran paymentTran = new PaymentTran();
      paymentTran.setAuthCode(paymentEngine.getAuthCode());
      paymentTran.setPaymentReference1(paymentEngine.getPaymentReference1());
      paymentTran.setPaymentReference2(paymentEngine.getPaymentReference2());
      paymentTran.setPaymentReference3(paymentEngine.getPaymentReference3());
      paymentTran.setPaymentReference4(paymentEngine.getPaymentReference4());
      paymentTran.setPaymentReference5(paymentEngine.getPaymentReference5());
      paymentTran.setTranDatetime(new Date());
      paymentTran.setRecUpdateBy(user.getUserId());
      paymentTran.setRecUpdateDatetime(new Date());
      paymentTran.setRecCreateBy(user.getUserId());
      paymentTran.setRecCreateDatetime(new Date());
      creditHeader.setPaymentTran(paymentTran);
    }
    creditHeader.setCreditStatus(Constants.ORDERSTATUS_COMPLETED);
    creditHeader.setRecUpdateBy(user.getUserId());
    creditHeader.setRecUpdateDatetime(new Date());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.