Search in sources :

Example 1 with StoreSalesTransaction

use of com.google.api.ads.adwords.axis.v201809.rm.StoreSalesTransaction 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)

Aggregations

Money (com.google.api.ads.adwords.axis.v201809.cm.Money)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