diff --git a/android/common/src/main/java/com/revenuecat/purchases/common/mappers.kt b/android/common/src/main/java/com/revenuecat/purchases/common/mappers.kt index 6bd5f1d7..57d33422 100644 --- a/android/common/src/main/java/com/revenuecat/purchases/common/mappers.kt +++ b/android/common/src/main/java/com/revenuecat/purchases/common/mappers.kt @@ -124,10 +124,8 @@ private fun SkuDetails.mapIntroPriceDeprecated(): Map { "intro_price" to null, "intro_price_string" to null, "intro_price_period" to null, - "intro_price_cycles" to null, - "intro_price_period_unit" to null, - "intro_price_period_number_of_units" to null - ) + "intro_price_cycles" to null + ) + introductoryPricePeriod.mapPeriodDeprecated() } } @@ -163,10 +161,8 @@ private fun SkuDetails.mapIntroPrice(): Map { "price" to null, "priceString" to null, "period" to null, - "cycles" to null, - "periodUnit" to null, - "periodNumberOfUnits" to null - ) + "cycles" to null + ) + introductoryPricePeriod.mapPeriod() } } @@ -258,6 +254,15 @@ fun List<*>.convertToJsonArray(): JSONArray { return writableArray } +fun JSONObject.convertToMap(): Map = + this.keys().asSequence().associate { key -> + if (this.isNull(key)) { + key to null + } else { + key to this.getString(key) + } + } + private fun Date.toMillis(): Double = this.time.div(1000.0) private fun Date.toIso8601(): String = Iso8601Utils.format(this) \ No newline at end of file