Skip to content
This repository was archived by the owner on Oct 17, 2025. It is now read-only.

Commit 094c6c3

Browse files
committed
chore(deps): openiap-gql v1.0.11
1 parent c0d224a commit 094c6c3

File tree

3 files changed

+34
-51
lines changed

3 files changed

+34
-51
lines changed

openiap-versions.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"google": "1.2.10",
3-
"gql": "1.0.10"
3+
"gql": "1.0.11"
44
}

openiap/src/main/java/dev/hyo/openiap/Types.kt

Lines changed: 32 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,13 @@ public interface ProductCommon {
368368
}
369369

370370
public interface PurchaseCommon {
371+
/**
372+
* The current plan identifier. This is:
373+
* - On Android: the basePlanId (e.g., "premium", "premium-year")
374+
* - On iOS: the productId (e.g., "com.example.premium_monthly", "com.example.premium_yearly")
375+
* This provides a unified way to identify which specific plan/tier the user is subscribed to.
376+
*/
377+
val currentPlanId: String?
371378
val id: String
372379
val ids: List<String>?
373380
val isAutoRenewing: Boolean
@@ -386,12 +393,24 @@ public interface PurchaseCommon {
386393

387394
public data class ActiveSubscription(
388395
val autoRenewingAndroid: Boolean? = null,
396+
val basePlanIdAndroid: String? = null,
397+
/**
398+
* The current plan identifier. This is:
399+
* - On Android: the basePlanId (e.g., "premium", "premium-year")
400+
* - On iOS: the productId (e.g., "com.example.premium_monthly", "com.example.premium_yearly")
401+
* This provides a unified way to identify which specific plan/tier the user is subscribed to.
402+
*/
403+
val currentPlanId: String? = null,
389404
val daysUntilExpirationIOS: Double? = null,
390405
val environmentIOS: String? = null,
391406
val expirationDateIOS: Double? = null,
392407
val isActive: Boolean,
393408
val productId: String,
394409
val purchaseToken: String? = null,
410+
/**
411+
* Required for subscription upgrade/downgrade on Android
412+
*/
413+
val purchaseTokenAndroid: String? = null,
395414
val transactionDate: Double,
396415
val transactionId: String,
397416
val willExpireSoon: Boolean? = null
@@ -401,12 +420,15 @@ public data class ActiveSubscription(
401420
fun fromJson(json: Map<String, Any?>): ActiveSubscription {
402421
return ActiveSubscription(
403422
autoRenewingAndroid = json["autoRenewingAndroid"] as Boolean?,
423+
basePlanIdAndroid = json["basePlanIdAndroid"] as String?,
424+
currentPlanId = json["currentPlanId"] as String?,
404425
daysUntilExpirationIOS = (json["daysUntilExpirationIOS"] as Number?)?.toDouble(),
405426
environmentIOS = json["environmentIOS"] as String?,
406427
expirationDateIOS = (json["expirationDateIOS"] as Number?)?.toDouble(),
407428
isActive = json["isActive"] as Boolean,
408429
productId = json["productId"] as String,
409430
purchaseToken = json["purchaseToken"] as String?,
431+
purchaseTokenAndroid = json["purchaseTokenAndroid"] as String?,
410432
transactionDate = (json["transactionDate"] as Number).toDouble(),
411433
transactionId = json["transactionId"] as String,
412434
willExpireSoon = json["willExpireSoon"] as Boolean?,
@@ -417,12 +439,15 @@ public data class ActiveSubscription(
417439
fun toJson(): Map<String, Any?> = mapOf(
418440
"__typename" to "ActiveSubscription",
419441
"autoRenewingAndroid" to autoRenewingAndroid,
442+
"basePlanIdAndroid" to basePlanIdAndroid,
443+
"currentPlanId" to currentPlanId,
420444
"daysUntilExpirationIOS" to daysUntilExpirationIOS,
421445
"environmentIOS" to environmentIOS,
422446
"expirationDateIOS" to expirationDateIOS,
423447
"isActive" to isActive,
424448
"productId" to productId,
425449
"purchaseToken" to purchaseToken,
450+
"purchaseTokenAndroid" to purchaseTokenAndroid,
426451
"transactionDate" to transactionDate,
427452
"transactionId" to transactionId,
428453
"willExpireSoon" to willExpireSoon,
@@ -956,6 +981,7 @@ public data class ProductSubscriptionIOS(
956981

957982
public data class PurchaseAndroid(
958983
val autoRenewingAndroid: Boolean? = null,
984+
override val currentPlanId: String? = null,
959985
val dataAndroid: String? = null,
960986
val developerPayloadAndroid: String? = null,
961987
override val id: String,
@@ -979,6 +1005,7 @@ public data class PurchaseAndroid(
9791005
fun fromJson(json: Map<String, Any?>): PurchaseAndroid {
9801006
return PurchaseAndroid(
9811007
autoRenewingAndroid = json["autoRenewingAndroid"] as Boolean?,
1008+
currentPlanId = json["currentPlanId"] as String?,
9821009
dataAndroid = json["dataAndroid"] as String?,
9831010
developerPayloadAndroid = json["developerPayloadAndroid"] as String?,
9841011
id = json["id"] as String,
@@ -1003,6 +1030,7 @@ public data class PurchaseAndroid(
10031030
override fun toJson(): Map<String, Any?> = mapOf(
10041031
"__typename" to "PurchaseAndroid",
10051032
"autoRenewingAndroid" to autoRenewingAndroid,
1033+
"currentPlanId" to currentPlanId,
10061034
"dataAndroid" to dataAndroid,
10071035
"developerPayloadAndroid" to developerPayloadAndroid,
10081036
"id" to id,
@@ -1053,6 +1081,7 @@ public data class PurchaseIOS(
10531081
val countryCodeIOS: String? = null,
10541082
val currencyCodeIOS: String? = null,
10551083
val currencySymbolIOS: String? = null,
1084+
override val currentPlanId: String? = null,
10561085
val environmentIOS: String? = null,
10571086
val expirationDateIOS: Double? = null,
10581087
override val id: String,
@@ -1089,6 +1118,7 @@ public data class PurchaseIOS(
10891118
countryCodeIOS = json["countryCodeIOS"] as String?,
10901119
currencyCodeIOS = json["currencyCodeIOS"] as String?,
10911120
currencySymbolIOS = json["currencySymbolIOS"] as String?,
1121+
currentPlanId = json["currentPlanId"] as String?,
10921122
environmentIOS = json["environmentIOS"] as String?,
10931123
expirationDateIOS = (json["expirationDateIOS"] as Number?)?.toDouble(),
10941124
id = json["id"] as String,
@@ -1126,6 +1156,7 @@ public data class PurchaseIOS(
11261156
"countryCodeIOS" to countryCodeIOS,
11271157
"currencyCodeIOS" to currencyCodeIOS,
11281158
"currencySymbolIOS" to currencySymbolIOS,
1159+
"currentPlanId" to currentPlanId,
11291160
"environmentIOS" to environmentIOS,
11301161
"expirationDateIOS" to expirationDateIOS,
11311162
"id" to id,
@@ -1582,45 +1613,7 @@ public data class ProductRequest(
15821613
)
15831614
}
15841615

1585-
public data class PurchaseInput(
1586-
val id: String,
1587-
val ids: List<String>? = null,
1588-
val isAutoRenewing: Boolean,
1589-
val platform: IapPlatform,
1590-
val productId: String,
1591-
val purchaseState: PurchaseState,
1592-
val purchaseToken: String? = null,
1593-
val quantity: Int,
1594-
val transactionDate: Double
1595-
) {
1596-
companion object {
1597-
fun fromJson(json: Map<String, Any?>): PurchaseInput {
1598-
return PurchaseInput(
1599-
id = json["id"] as String,
1600-
ids = (json["ids"] as List<*>?)?.map { it as String },
1601-
isAutoRenewing = json["isAutoRenewing"] as Boolean,
1602-
platform = IapPlatform.fromJson(json["platform"] as String),
1603-
productId = json["productId"] as String,
1604-
purchaseState = PurchaseState.fromJson(json["purchaseState"] as String),
1605-
purchaseToken = json["purchaseToken"] as String?,
1606-
quantity = (json["quantity"] as Number).toInt(),
1607-
transactionDate = (json["transactionDate"] as Number).toDouble(),
1608-
)
1609-
}
1610-
}
1611-
1612-
fun toJson(): Map<String, Any?> = mapOf(
1613-
"id" to id,
1614-
"ids" to ids?.map { it },
1615-
"isAutoRenewing" to isAutoRenewing,
1616-
"platform" to platform.toJson(),
1617-
"productId" to productId,
1618-
"purchaseState" to purchaseState.toJson(),
1619-
"purchaseToken" to purchaseToken,
1620-
"quantity" to quantity,
1621-
"transactionDate" to transactionDate,
1622-
)
1623-
}
1616+
public typealias PurchaseInput = Purchase
16241617

16251618
public data class PurchaseOptions(
16261619
/**

openiap/src/main/java/dev/hyo/openiap/utils/BillingConverters.kt

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -155,14 +155,4 @@ fun ProductSubscriptionAndroid.toProduct(): Product = ProductAndroid(
155155
type = type
156156
)
157157

158-
fun Purchase.toPurchaseInput(): PurchaseInput = PurchaseInput(
159-
id = id,
160-
ids = ids,
161-
isAutoRenewing = isAutoRenewing,
162-
platform = platform,
163-
productId = productId,
164-
purchaseState = purchaseState,
165-
purchaseToken = purchaseToken,
166-
quantity = quantity,
167-
transactionDate = transactionDate
168-
)
158+
fun Purchase.toPurchaseInput(): PurchaseInput = this

0 commit comments

Comments
 (0)