Package com.google.api.ads.dfp.v201308

Examples of com.google.api.ads.dfp.v201308.Money


      lineItem.setStartDateTimeType(StartDateTimeType.IMMEDIATELY);
      lineItem.setEndDateTime(DateTimeUtils.fromString("2013-09-01T00:00:00"));

      // Set the cost per day to $1.
      lineItem.setCostType(CostType.CPD);
      lineItem.setCostPerUnit(new Money("USD", 1000000L));

      // Set the percentage to be 100%.
      lineItem.setUnitsBought(100L);

      // Create the line item on the server.
View Full Code Here


      lineItem.setStartDateTimeType(StartDateTimeType.IMMEDIATELY);
      lineItem.setEndDateTime(DateTimeUtils.fromString("2012-09-01T00:00:00"));

      // Set the cost per unit to $2.
      lineItem.setCostType(CostType.CPM);
      lineItem.setCostPerUnit(new Money("USD", 2000000L));

      // Set the number of units bought to 500,000 so that the budget is
      // $1,000.
      lineItem.setUnitsBought(500000L);
      lineItem.setUnitType(UnitType.IMPRESSIONS);
View Full Code Here

   * @param amount Numeric amount to charge the customer.
   * @param currency 3-letter ISO-4217 currency code: USD, JPY, GBP
   */
  public Document chargeOrder(String orderNumber, float amount, String currency)
      throws ProtocolException {
    Money money = createMoney(amount, currency);
    ChargeOrderRequest chargeReq = _objectFact.createChargeOrderRequest();
    chargeReq.setGoogleOrderNumber(orderNumber);
    chargeReq.setAmount(money);
    JAXBElement<ChargeOrderRequest> elem
        = _objectFact.createChargeOrder(chargeReq);
View Full Code Here

   
    RefundOrderRequest refundRequest = _objectFact.createRefundOrderRequest();
    refundRequest.setGoogleOrderNumber(orderNumber);
    refundRequest.setReason(reason);
    if (amount > 0.0F && !StringUtil.isEmpty(currency)) {
      Money refundAmount = createMoney(amount, currency);
      refundRequest.setAmount(refundAmount);
    }
   
    JAXBElement<RefundOrderRequest> refundOrder
        = _objectFact.createRefundOrder(refundRequest);
View Full Code Here

   */
  public Item createShoppingItem(String itemName, String itemDesc,
      int quantity, float unitPrice, String currency,
      String taxTableSelector, Element privateItemData)
      throws ProtocolException {
    Money money = createMoney(unitPrice, currency);
    Item item = _objectFact.createItem();
    item.setItemName(itemName);
    item.setItemDescription(itemDesc);
    item.setQuantity(quantity);
    item.setUnitPrice(money);
View Full Code Here

      throws ProtocolException {
    if (price < 0.0d) {
      throw new ProtocolException("price cannot be negative");
    }
   
    Money money = _objectFact.createMoney();
    BigDecimal bigNum = new BigDecimal(price);
    bigNum = bigNum.setScale(2, RoundingMode.HALF_EVEN);
    money.setValue(bigNum);
    if (!StringUtil.isEmpty(currency)) {
      money.setCurrency(currency);
    } else {
      money.setCurrency("USD");
    }
    return money;
  }
View Full Code Here

      int quantity, float unitPrice, String currency,
      String taxTableSelector, Element privateItemData)
      throws ProtocolException {
   
    try {
      Money money = createMoney(unitPrice, currency);
      Item item = _objectFact.createItem();
      item.setItemName(itemName);
      item.setItemDescription(itemDesc);
      item.setQuantity(quantity);
      item.setUnitPrice(money);
View Full Code Here

    if (price < 0.0d) {
      throw new ProtocolException("price cannot be negative");
    }
   
    try {
      Money money = _objectFact.createMoney();
      BigDecimal bigNum = new BigDecimal(price);
      bigNum = bigNum.setScale(2, BigDecimal.ROUND_HALF_EVEN);
      money.setValue(bigNum);
      if (!StringUtil.isEmpty(currency)) {
        money.setCurrency(currency);
      } else {
        money.setCurrency("USD");
      }
      return money;
    } catch (JAXBException jaxbEx) {
      throw new ProtocolException(jaxbEx.getMessage());
    }
View Full Code Here

   * @param currency 3-letter ISO-4217 currency code: USD, JPY, GBP
   */
  public Document chargeOrder(String orderNumber, float amount, String currency)
      throws ProtocolException {
    try {
      Money money = createMoney(amount, currency);
      ChargeOrderElement chargeReq = _objectFact.createChargeOrderElement();
      chargeReq.setGoogleOrderNumber(orderNumber);
      chargeReq.setAmount(money);
      return convertToDOM(chargeReq);
    } catch (JAXBException jaxbEx) {
View Full Code Here

    try {
      RefundOrderElement refundRequest = _objectFact.createRefundOrderElement();
      refundRequest.setGoogleOrderNumber(orderNumber);
      refundRequest.setReason(reason);
      if (amount > 0.0F && !StringUtil.isEmpty(currency)) {
        Money refundAmount = createMoney(amount, currency);
        refundRequest.setAmount(refundAmount);
      }
      return convertToDOM(refundRequest);
    } catch (JAXBException jaxbEx) {
      throw new ProtocolException(jaxbEx.getMessage());
View Full Code Here

TOP

Related Classes of com.google.api.ads.dfp.v201308.Money

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.