Examples of PaymentDetailsType


Examples of com.paypal.soap.api.PaymentDetailsType

      DoExpressCheckoutPaymentRequestDetailsType detail = new DoExpressCheckoutPaymentRequestDetailsType();
      detail.setPayerID(payerId);
      detail.setToken(token);
      detail.setPaymentAction(PaymentActionCodeType.fromString("Sale"));
   
      PaymentDetailsType paymentDetail = new PaymentDetailsType();
      BasicAmountType orderTotal = new BasicAmountType();
      orderTotal.setCurrencyID(CurrencyCodeType.fromString(currencyCode));
      orderTotal.set_value(Format.getSimpleFloat(orderHeader.getOrderTotal()));
      paymentDetail.setOrderTotal(orderTotal);

      BasicAmountType priceTotal = new BasicAmountType();
      priceTotal.setCurrencyID(CurrencyCodeType.fromString(currencyCode));
      priceTotal.set_value(Format.getSimpleFloat(orderEngine.getOrderPriceTotal() - orderEngine.getOrderPriceDiscountTotal()));
      paymentDetail.setItemTotal(priceTotal);

      BasicAmountType taxTotal = new BasicAmountType();
      taxTotal.setCurrencyID(CurrencyCodeType.fromString(currencyCode));
      taxTotal.set_value(Format.getSimpleFloat(orderEngine.getOrderTaxTotal()));
      paymentDetail.setTaxTotal(taxTotal);

      float total = orderHeader.getShippingTotal() - orderHeader.getShippingDiscountTotal();
      BasicAmountType shippingTotal = new BasicAmountType();
      shippingTotal.setCurrencyID(CurrencyCodeType.fromString(currencyCode));
      shippingTotal.set_value(Format.getSimpleFloat(total));
      paymentDetail.setShippingTotal(shippingTotal);
/*
      Vector<PaymentDetailsItemType> paymentItems = new Vector<PaymentDetailsItemType>();
      Iterator<?> iterator = orderHeader.getOrderItemDetails().iterator();
      while (iterator.hasNext()) {
        OrderItemDetail orderItemDetail = (OrderItemDetail) iterator.next();
View Full Code Here

Examples of eBLBaseComponents.apis.ebay.PaymentDetailsType

      DoDirectPaymentRequestType dpReq = (DoDirectPaymentRequestType) _request;
      if (dpReq.getDoDirectPaymentRequestDetails() == null) {
        dpReq.setDoDirectPaymentRequestDetails(new DoDirectPaymentRequestDetailsType());
      }
      if (dpReq.getDoDirectPaymentRequestDetails().getPaymentDetails() == null) {
        dpReq.getDoDirectPaymentRequestDetails().setPaymentDetails(new PaymentDetailsType());
      }
      if (LOG.isDebugEnabled()) {
        LOG.debug("Setting ButtonSource to [" + JavaCommerce.VERSION + "]");
      }
      dpReq.getDoDirectPaymentRequestDetails().getPaymentDetails().setButtonSource(JavaCommerce.VERSION);
    }
    else if (_request instanceof DoExpressCheckoutPaymentRequestType) {
      DoExpressCheckoutPaymentRequestType ecReq = (DoExpressCheckoutPaymentRequestType) _request;
      if (ecReq.getDoExpressCheckoutPaymentRequestDetails() == null) {
        ecReq.setDoExpressCheckoutPaymentRequestDetails(new DoExpressCheckoutPaymentRequestDetailsType());
      }
      if (ecReq.getDoExpressCheckoutPaymentRequestDetails().getPaymentDetails() == null) {
        ecReq.getDoExpressCheckoutPaymentRequestDetails().setPaymentDetails(new PaymentDetailsType());
      }
      if (LOG.isDebugEnabled()) {
        LOG.debug("Setting ButtonSource to [" + JavaCommerce.VERSION + "]");
      }
      ecReq.getDoExpressCheckoutPaymentRequestDetails().getPaymentDetails().setButtonSource(JavaCommerce.VERSION);
View Full Code Here

Examples of eBLBaseComponents.apis.ebay.PaymentDetailsType

  }

  public static final DoExpressCheckoutPaymentRequestDetailsType buildDoExpressCheckoutPaymentDetailsRequest(
      HttpServletRequest _request) {
    DoExpressCheckoutPaymentRequestDetailsType request = new DoExpressCheckoutPaymentRequestDetailsType();
    PaymentDetailsType details = buildPaymentDetails(_request);
    request.setPaymentDetails(details);
   
    if (_request.getParameter("payerID") != null) {
      request.setPayerID(_request.getParameter("payerID"));
    }
View Full Code Here

Examples of eBLBaseComponents.apis.ebay.PaymentDetailsType

  /**
   * @param _request
   * @return
   */
  private static final PaymentDetailsType buildPaymentDetails(HttpServletRequest _request) {
    PaymentDetailsType details = new PaymentDetailsType();
    if (_request.getParameter(PARAM_CUSTOM) != null) {
      details.setCustom(_request.getParameter(PARAM_CUSTOM));
    }
    if (_request.getParameter(PARAM_HANDLING_TOTAL) != null) {
      BasicAmountType handlingTotal = new BasicAmountType();
      handlingTotal.set_value(_request.getParameter(PARAM_HANDLING_TOTAL));
      if (_request.getParameter(PARAM_HANDLING_TOTAL_CURRENCY_ID) != null) {
        handlingTotal.setCurrencyID(CurrencyCodeType.fromString(_request.getParameter(PARAM_HANDLING_TOTAL_CURRENCY_ID)));
      }
      else {
        handlingTotal.setCurrencyID(CurrencyCodeType.USD);
      }
      details.setHandlingTotal(handlingTotal);
    }
    if (_request.getParameter(PARAM_INVOICE_ID) != null) {
      details.setInvoiceID(_request.getParameter(PARAM_INVOICE_ID));
    }
    if (_request.getParameter(PARAM_ITEM_TOTAL) != null) {
      BasicAmountType itemTotal = new BasicAmountType();
      itemTotal.set_value(_request.getParameter(PARAM_ITEM_TOTAL));
      if (_request.getParameter(PARAM_ITEM_TOTAL_CURRENCY_ID) != null) {
        itemTotal.setCurrencyID(CurrencyCodeType.fromString(_request.getParameter(PARAM_ITEM_TOTAL_CURRENCY_ID)));
      }
      else {
        itemTotal.setCurrencyID(CurrencyCodeType.USD);
      }
      details.setItemTotal(itemTotal);
    }
    if (_request.getParameter(PARAM_NOTIFY_URL) != null) {
      details.setNotifyURL(_request.getParameter(PARAM_NOTIFY_URL));
    }
    if (_request.getParameter(PARAM_ORDER_DESCRIPTION) != null) {
      details.setOrderDescription(_request
          .getParameter(PARAM_ORDER_DESCRIPTION));
    }
    if (_request.getParameter(PARAM_ORDER_TOTAL) != null) {
      BasicAmountType orderTotal = new BasicAmountType();
      orderTotal.set_value(_request.getParameter(PARAM_ORDER_TOTAL));
      if (_request.getParameter(PARAM_ORDER_TOTAL_CURRENCY_ID) != null) {
        orderTotal.setCurrencyID(CurrencyCodeType.fromString(_request
            .getParameter(PARAM_ORDER_TOTAL_CURRENCY_ID)));
      }
      details.setOrderTotal(orderTotal);
    }
    // Loop through line items
    int lineNum = 0;
    if (_request.getParameter(PARAM_ITEM + lineNum + DOT_AMOUNT) != null &&
        _request.getParameter(PARAM_ITEM + lineNum + DOT_NAME) != null &&
        _request.getParameter(PARAM_ITEM + lineNum + DOT_NUMBER) != null &&
        _request.getParameter(PARAM_ITEM + lineNum + DOT_QUANTITY) != null &&
        _request.getParameter(PARAM_ITEM + lineNum + DOT_TAX) != null) {
      ArrayList<PaymentDetailsItemType> items = new ArrayList<PaymentDetailsItemType>();
      while (_request.getParameter(PARAM_ITEM + lineNum + DOT_AMOUNT) != null &&
          _request.getParameter(PARAM_ITEM + lineNum + DOT_NAME) != null &&
          _request.getParameter(PARAM_ITEM + lineNum + DOT_NUMBER) != null &&
          _request.getParameter(PARAM_ITEM + lineNum + DOT_QUANTITY) != null &&
          _request.getParameter(PARAM_ITEM + lineNum + DOT_TAX) != null) {
        PaymentDetailsItemType item = new PaymentDetailsItemType();
        BasicAmountType amount = new BasicAmountType();
        amount.set_value(_request.getParameter(PARAM_ITEM + lineNum + DOT_AMOUNT));
        if (_request.getParameter(PARAM_ITEM + lineNum + DOT_AMOUNT_CURRENCY_ID) != null) {
          amount.setCurrencyID(CurrencyCodeType.fromString(_request.getParameter(PARAM_ITEM + lineNum + DOT_AMOUNT_CURRENCY_ID)));
        }
        else {
          amount.setCurrencyID(CurrencyCodeType.USD);
        }
        item.setAmount(amount);
        item.setName(_request.getParameter(PARAM_ITEM + lineNum + DOT_NAME));
        item.setNumber(_request.getParameter(PARAM_ITEM + lineNum + DOT_NUMBER));
        item.setQuantity(new BigInteger(_request.getParameter(PARAM_ITEM + lineNum + DOT_QUANTITY)));
        BasicAmountType tax = new BasicAmountType();
        tax.set_value(_request.getParameter(PARAM_ITEM + lineNum + DOT_TAX));
        if (_request.getParameter(PARAM_ITEM + lineNum + DOT_TAX_CURRENCY_ID) != null) {
          tax.setCurrencyID(CurrencyCodeType.fromString(_request.getParameter(PARAM_ITEM + lineNum + DOT_TAX_CURRENCY_ID)));
        }
        else {
          tax.setCurrencyID(CurrencyCodeType.USD);
        }
        item.setTax(tax);
        items.add(item);
        lineNum++;
      }
      details.setPaymentDetailsItem((PaymentDetailsItemType[]) items.toArray(new PaymentDetailsItemType[items.size()]));
    }
    if (_request.getParameter(PARAM_SHIPPING_TOTAL) != null) {
      BasicAmountType shippingTotal = new BasicAmountType();
      shippingTotal.set_value(_request.getParameter(PARAM_SHIPPING_TOTAL));
      if (_request.getParameter(PARAM_SHIPPING_TOTAL_CURRENCY_ID) != null) {
        shippingTotal.setCurrencyID(CurrencyCodeType.fromString(_request
            .getParameter(PARAM_SHIPPING_TOTAL_CURRENCY_ID)));
      }
      else {
        shippingTotal.setCurrencyID(CurrencyCodeType.USD);
      }
      details.setShippingTotal(shippingTotal);
    }
    if (_request.getParameter(PARAM_ADDRESS_CITY_NAME) != null &&
        _request.getParameter(PARAM_ADDRESS_COUNTRY) != null &&
        _request.getParameter(PARAM_ADDRESS_NAME) != null &&
        _request.getParameter(PARAM_ADDRESS_PHONE) != null &&
        _request.getParameter(PARAM_ADDRESS_POSTAL_CODE) != null &&
        _request.getParameter(PARAM_ADDRESS_STATE_OR_PROVINCE) != null &&
        _request.getParameter(PARAM_ADDRESS_STREET1) != null) {
      details.setShipToAddress(buildAddress(_request));
    }
    if (_request.getParameter(PARAM_TAX_TOTAL) != null) {
      BasicAmountType taxTotal = new BasicAmountType();
      taxTotal.set_value(_request.getParameter(PARAM_TAX_TOTAL));
      if (_request.getParameter(PARAM_TAX_TOTAL_CURRENCY_ID) != null) {
        taxTotal.setCurrencyID(CurrencyCodeType.fromString(_request
            .getParameter(PARAM_TAX_TOTAL_CURRENCY_ID)));
      }
      else {
        taxTotal.setCurrencyID(CurrencyCodeType.USD);
      }
      details.setTaxTotal(taxTotal);
    }
    return details;
  }
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.