Examples of DoExpressCheckoutPaymentRequestType


Examples of PayPalAPI.api.ebay.DoExpressCheckoutPaymentRequestType

        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);
    }
    else if (_request instanceof BillUserRequestType) {
      BillUserRequestType buReq = (BillUserRequestType) _request;
      if (buReq.getMerchantPullPaymentDetails() == null) {
        buReq.setMerchantPullPaymentDetails(new MerchantPullPaymentType());
View Full Code Here

Examples of PayPalAPI.api.ebay.DoExpressCheckoutPaymentRequestType

   * @throws RemoteException
   * @throws ServiceException
   * @throws SOAPException
   */
  public static final DoExpressCheckoutPaymentResponseType doExpressCheckoutPayment(DoExpressCheckoutPaymentRequestDetailsType _requestDetails, APICredential _credentials) throws RemoteException {
    DoExpressCheckoutPaymentRequestType request = new DoExpressCheckoutPaymentRequestType(_requestDetails);
    request.setVersion(CURRENT_VERSION);
    return doExpressCheckoutPayment(request, _credentials);
  }
View Full Code Here

Examples of com.paypal.soap.api.DoExpressCheckoutPaymentRequestType

    CallerServices caller = new CallerServices();
      caller.setAPIProfile(createProfile());
      String currencyCode = orderHeader.getSiteCurrency().getSiteCurrencyClass().getCurrency().getCurrencyCode();
      OrderEngine orderEngine = new OrderEngine(orderHeader, null);

      DoExpressCheckoutPaymentRequestType request = new DoExpressCheckoutPaymentRequestType();
     
      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();
        PaymentDetailsItemType paymentItem = new PaymentDetailsItemType();
        Item item = orderItemDetail.getItem();
        String itemDesc = orderItemDetail.getItemOrderQty()  + " x " + item.getItemShortDesc();
        if (item.getItemShortDesc1().length() > 0) {
          itemDesc += ", " + item.getItemShortDesc1();
        }
        paymentItem.setName(itemDesc);
        paymentItem.setNumber(item.getItemNum());
        paymentItem.setQuantity(BigInteger.valueOf((long) 1));
       
        BasicAmountType itemPriceTotal = new BasicAmountType();
        itemPriceTotal.setCurrencyID(CurrencyCodeType.fromString(currencyCode));
        itemPriceTotal.set_value(Format.getFloatObj(orderItemDetail.getItemDetailAmount() - orderItemDetail.getItemDetailDiscountAmount()));
        paymentItem.setAmount(itemPriceTotal);

        Iterator<?> taxIterator<?> = orderItemDetail.getOrderDetailTaxes().iterator();
        float taxAmount = 0;
        while (taxIterator.hasNext()) {
          OrderDetailTax orderItemTax = (OrderDetailTax) taxIterator.next();
          taxAmount += orderItemTax.getTaxAmount();
        }
        BasicAmountType itemTaxTotal = new BasicAmountType();
        itemTaxTotal.setCurrencyID(CurrencyCodeType.fromString(currencyCode));
        itemTaxTotal.set_value(Format.getFloat(taxAmount));
        paymentItem.setTax(itemTaxTotal);
        paymentItems.add(paymentItem);
      }
      float shippingAmount = orderHeader.getShippingTotal() - orderHeader.getShippingDiscountTotal();
      if (shippingAmount > 0) {
        PaymentDetailsItemType paymentItem = new PaymentDetailsItemType();
        paymentItem.setName("Shipping");
        paymentItem.setNumber("");
        paymentItem.setQuantity(BigInteger.valueOf((long) 1));
       
        BasicAmountType itemPriceTotal = new BasicAmountType();
        itemPriceTotal.setCurrencyID(CurrencyCodeType.fromString(currencyCode));
        itemPriceTotal.set_value(Format.getFloatObj(shippingAmount));
        paymentItem.setAmount(itemPriceTotal);

        Iterator<?> taxIterator<?> = orderHeader.getOrderTaxes().iterator();
        float taxAmount = 0;
        while (taxIterator.hasNext()) {
          OrderDetailTax orderItemTax = (OrderDetailTax) taxIterator.next();
          if (orderItemTax.getOrderItemDetail() != null) {
            continue;
          }
          taxAmount += orderItemTax.getTaxAmount();
        }
        BasicAmountType itemTaxTotal = new BasicAmountType();
        itemTaxTotal.setCurrencyID(CurrencyCodeType.fromString(currencyCode));
        itemTaxTotal.set_value(Format.getFloat(taxAmount));
        paymentItem.setTax(itemTaxTotal);
        paymentItems.add(paymentItem);
      }
     
      PaymentDetailsItemType paymentDetailsItemTypes[] = new PaymentDetailsItemType[paymentItems.size()];
      paymentItems.copyInto(paymentDetailsItemTypes);
*/
//      paymentDetail.setPaymentDetailsItem(paymentDetailsItemTypes);
     
      detail.setPaymentDetails(0, paymentDetail);
//      detail.setPaymentDetails(paymentDetail);

      request.setDoExpressCheckoutPaymentRequestDetails(detail);
     
      DoExpressCheckoutPaymentResponseType response = (DoExpressCheckoutPaymentResponseType) caller.call("DoExpressCheckoutPayment", request);
    if (!response.getAck().equals(AckCodeType.Success)) {
      throw new PaymentException(formatErrorMessage(response));
    }
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.