iosMain.com.revenuecat.purchases.kmp.mappings.Transaction.ios.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of purchases-kmp-mappings Show documentation
Show all versions of purchases-kmp-mappings Show documentation
Mobile subscriptions in hours, not months.
The newest version!
package com.revenuecat.purchases.kmp.mappings
import com.revenuecat.purchases.kmp.mappings.ktx.toEpochMilliseconds
import com.revenuecat.purchases.kmp.models.Transaction
import platform.Foundation.NSDate
internal fun Map.toTransaction(): Transaction {
// TODO: This is a workaround for the fact that PHC does not expose
// the NonSubscriptionTransaction type
return Transaction(
transactionIdentifier = get("transactionIdentifier") as String,
productIdentifier = get("productIdentifier") as String,
purchaseDateMillis = (get("purchaseDate") as NSDate).toEpochMilliseconds()
)
}