Search in sources :

Example 1 with MoneyWithCurrency

use of com.google.api.ads.adwords.axis.v201809.cm.MoneyWithCurrency in project googleads-java-lib by googleads.

the class UploadOfflineData method createOfflineData.

/**
 * Returns a new offline data object with the specified values.
 */
private static OfflineData createOfflineData(DateTime transactionTime, long transactionMicroAmount, String transactionCurrency, String conversionName, List<UserIdentifier> userIdentifiers) {
    StoreSalesTransaction storeSalesTransaction = new StoreSalesTransaction();
    // For times use the format yyyyMMdd HHmmss [tz].
    // For details, see
    // https://developers.google.com/adwords/api/docs/appendix/codes-formats#date-and-time-formats
    storeSalesTransaction.setTransactionTime(transactionTime.toString("yyyyMMdd HHmmss ZZZ"));
    storeSalesTransaction.setConversionName(conversionName);
    storeSalesTransaction.setUserIdentifiers(userIdentifiers.toArray(new UserIdentifier[userIdentifiers.size()]));
    Money money = new Money();
    money.setMicroAmount(transactionMicroAmount);
    MoneyWithCurrency moneyWithCurrency = new MoneyWithCurrency();
    moneyWithCurrency.setMoney(money);
    moneyWithCurrency.setCurrencyCode(transactionCurrency);
    storeSalesTransaction.setTransactionAmount(moneyWithCurrency);
    OfflineData offlineData = new OfflineData();
    offlineData.setStoreSalesTransaction(storeSalesTransaction);
    return offlineData;
}
Also used : Money(com.google.api.ads.adwords.axis.v201809.cm.Money) OfflineData(com.google.api.ads.adwords.axis.v201809.rm.OfflineData) StoreSalesTransaction(com.google.api.ads.adwords.axis.v201809.rm.StoreSalesTransaction) MoneyWithCurrency(com.google.api.ads.adwords.axis.v201809.rm.MoneyWithCurrency) UserIdentifier(com.google.api.ads.adwords.axis.v201809.rm.UserIdentifier)

Example 2 with MoneyWithCurrency

use of com.google.api.ads.adwords.axis.v201809.cm.MoneyWithCurrency in project googleads-java-lib by googleads.

the class AddPrices method createPriceTableRow.

/**
 * Creates a new {@link PriceTableRow} with the specified attributes.
 *
 * @param header the header for the row
 * @param description the description for the row
 * @param finalUrl the final URL for the row
 * @param finalMobileUrl the final mobile URL for the row, or null if this field should not be set
 * @param priceInMicros the price for the row, in micros
 * @param currencyCode the currency for the row
 * @param priceUnit the price unit for the row
 * @return a new {@link PriceTableRow}
 */
private static PriceTableRow createPriceTableRow(String header, String description, String finalUrl, String finalMobileUrl, long priceInMicros, String currencyCode, PriceExtensionPriceUnit priceUnit) {
    PriceTableRow priceTableRow = new PriceTableRow();
    priceTableRow.setHeader(header);
    priceTableRow.setDescription(description);
    UrlList finalUrls = new UrlList();
    finalUrls.setUrls(new String[] { finalUrl });
    priceTableRow.setFinalUrls(finalUrls);
    if (finalMobileUrl != null) {
        UrlList finalMobileUrls = new UrlList();
        finalMobileUrls.setUrls(new String[] { finalMobileUrl });
        priceTableRow.setFinalMobileUrls(finalMobileUrls);
    }
    MoneyWithCurrency price = new MoneyWithCurrency();
    Money priceMoney = new Money();
    price.setCurrencyCode(currencyCode);
    priceMoney.setMicroAmount(priceInMicros);
    price.setMoney(priceMoney);
    priceTableRow.setPrice(price);
    priceTableRow.setPriceUnit(priceUnit);
    return priceTableRow;
}
Also used : Money(com.google.api.ads.adwords.axis.v201809.cm.Money) MoneyWithCurrency(com.google.api.ads.adwords.axis.v201809.cm.MoneyWithCurrency) PriceTableRow(com.google.api.ads.adwords.axis.v201809.cm.PriceTableRow) UrlList(com.google.api.ads.adwords.axis.v201809.cm.UrlList)

Aggregations

Money (com.google.api.ads.adwords.axis.v201809.cm.Money)2 MoneyWithCurrency (com.google.api.ads.adwords.axis.v201809.cm.MoneyWithCurrency)1 PriceTableRow (com.google.api.ads.adwords.axis.v201809.cm.PriceTableRow)1 UrlList (com.google.api.ads.adwords.axis.v201809.cm.UrlList)1 MoneyWithCurrency (com.google.api.ads.adwords.axis.v201809.rm.MoneyWithCurrency)1 OfflineData (com.google.api.ads.adwords.axis.v201809.rm.OfflineData)1 StoreSalesTransaction (com.google.api.ads.adwords.axis.v201809.rm.StoreSalesTransaction)1 UserIdentifier (com.google.api.ads.adwords.axis.v201809.rm.UserIdentifier)1