void Product::ParseJSON(const org_json_JSONObject::JSONObject& jsonObject) { Init(); std::string field; field = "currencyCode"; if (jsonObject.has(field)) { CurrencyCode = jsonObject.getString(field); } field = "identifier"; if (jsonObject.has(field)) { Identifier = jsonObject.getString(field); } field = "name"; if (jsonObject.has(field)) { Name = jsonObject.getString(field); } field = "productVersionToBundle"; if (jsonObject.has(field)) { ProductVersionToBundle = jsonObject.getInt(field); } field = "localPrice"; if (jsonObject.has(field)) { LocalPrice = jsonObject.getDouble(field); } field = "priceInCents"; if (jsonObject.has(field)) { PriceInCents = jsonObject.getInt(field); } }
void Receipt::ParseJSON(const org_json_JSONObject::JSONObject& jsonObject) { Init(); #if ENABLE_VERBOSE_LOGGING __android_log_print(ANDROID_LOG_VERBOSE, LOG_TAG, "jsonData=%s", jsonObject.toString().c_str()); #endif std::string field; #if ENABLE_VERBOSE_LOGGING __android_log_print(ANDROID_LOG_VERBOSE, LOG_TAG, "Parse currency"); #endif field = "currency"; if (jsonObject.has(field)) { Currency = jsonObject.getString(field); } #if ENABLE_VERBOSE_LOGGING __android_log_print(ANDROID_LOG_VERBOSE, LOG_TAG, "Parse gamerUuid"); #endif field = "gamerUuid"; if (jsonObject.has(field)) { GamerUuid = jsonObject.getString(field); } #if ENABLE_VERBOSE_LOGGING __android_log_print(ANDROID_LOG_VERBOSE, LOG_TAG, "Parse generatedDate"); #endif field = "generatedDate"; if (jsonObject.has(field)) { GeneratedDate = jsonObject.getString(field); } #if ENABLE_VERBOSE_LOGGING __android_log_print(ANDROID_LOG_VERBOSE, LOG_TAG, "Parse identifier"); #endif field = "identifier"; if (jsonObject.has(field)) { Identifier = jsonObject.getString(field); } #if ENABLE_VERBOSE_LOGGING __android_log_print(ANDROID_LOG_VERBOSE, LOG_TAG, "Parse localPrice"); #endif field = "localPrice"; if (jsonObject.has(field)) { LocalPrice = (float)jsonObject.getDouble(field); } #if ENABLE_VERBOSE_LOGGING __android_log_print(ANDROID_LOG_VERBOSE, LOG_TAG, "Parse priceInCents"); #endif field = "priceInCents"; if (jsonObject.has(field)) { PriceInCents = jsonObject.getInt(field); } #if ENABLE_VERBOSE_LOGGING __android_log_print(ANDROID_LOG_VERBOSE, LOG_TAG, "Parse purchaseDate"); #endif field = "purchaseDate"; if (jsonObject.has(field)) { PurchaseDate = jsonObject.getString(field); } #if ENABLE_VERBOSE_LOGGING __android_log_print(ANDROID_LOG_VERBOSE, LOG_TAG, "Parse uuid"); #endif field = "uuid"; if (jsonObject.has(field)) { Uuid = jsonObject.getString(field); } #if ENABLE_VERBOSE_LOGGING __android_log_print(ANDROID_LOG_VERBOSE, LOG_TAG, "Currency: %s", Currency.c_str()); __android_log_print(ANDROID_LOG_VERBOSE, LOG_TAG, "GamerUuid: %s", GamerUuid.c_str()); __android_log_print(ANDROID_LOG_VERBOSE, LOG_TAG, "GeneratedDate: %s", GeneratedDate.c_str()); __android_log_print(ANDROID_LOG_VERBOSE, LOG_TAG, "Identifier: %s", Identifier.c_str()); __android_log_print(ANDROID_LOG_VERBOSE, LOG_TAG, "LocalPrice: %f", LocalPrice); __android_log_print(ANDROID_LOG_VERBOSE, LOG_TAG, "PriceInCents: %d", PriceInCents); __android_log_print(ANDROID_LOG_VERBOSE, LOG_TAG, "PurchaseDate: %s", PurchaseDate.c_str()); __android_log_print(ANDROID_LOG_VERBOSE, LOG_TAG, "Uuid: %s", Uuid.c_str()); #endif }