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;
}
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;
}
Aggregations