@@ -222,6 +222,33 @@ public enum class PaymentModeIOS(val rawValue: String) {
222222 fun toJson (): String = rawValue
223223}
224224
225+ public enum class ProductDetailType (val rawValue : String ) {
226+ Consumable (" consumable" ),
227+ NonConsumable (" non-consumable" ),
228+ AutoRenewableSubscription (" auto-renewable-subscription" ),
229+ NonRenewingSubscription (" non-renewing-subscription" )
230+
231+ companion object {
232+ fun fromJson (value : String ): ProductDetailType = when (value) {
233+ " consumable" -> ProductDetailType .Consumable
234+ " CONSUMABLE" -> ProductDetailType .Consumable
235+ " Consumable" -> ProductDetailType .Consumable
236+ " non-consumable" -> ProductDetailType .NonConsumable
237+ " NON_CONSUMABLE" -> ProductDetailType .NonConsumable
238+ " NonConsumable" -> ProductDetailType .NonConsumable
239+ " auto-renewable-subscription" -> ProductDetailType .AutoRenewableSubscription
240+ " AUTO_RENEWABLE_SUBSCRIPTION" -> ProductDetailType .AutoRenewableSubscription
241+ " AutoRenewableSubscription" -> ProductDetailType .AutoRenewableSubscription
242+ " non-renewing-subscription" -> ProductDetailType .NonRenewingSubscription
243+ " NON_RENEWING_SUBSCRIPTION" -> ProductDetailType .NonRenewingSubscription
244+ " NonRenewingSubscription" -> ProductDetailType .NonRenewingSubscription
245+ else -> throw IllegalArgumentException (" Unknown ProductDetailType value: $value " )
246+ }
247+ }
248+
249+ fun toJson (): String = rawValue
250+ }
251+
225252public enum class ProductQueryType (val rawValue : String ) {
226253 InApp (" in-app" ),
227254 Subs (" subs" ),
@@ -389,6 +416,7 @@ public interface ProductCommon {
389416 val price: Double?
390417 val title: String
391418 val type: ProductType
419+ val typeDetails: ProductDetailType
392420}
393421
394422public interface PurchaseCommon {
@@ -685,7 +713,8 @@ public data class ProductAndroid(
685713 val price : Double? = null ,
686714 val subscriptionOfferDetailsAndroid : List <ProductSubscriptionAndroidOfferDetails >? = null ,
687715 val title : String ,
688- val type : ProductType
716+ val type : ProductType ,
717+ val typeDetails : ProductDetailType
689718) : ProductCommon, Product {
690719
691720 companion object {
@@ -704,6 +733,7 @@ public data class ProductAndroid(
704733 subscriptionOfferDetailsAndroid = (json[" subscriptionOfferDetailsAndroid" ] as List <* >? )?.map { ProductSubscriptionAndroidOfferDetails .fromJson((it as Map <String , Any ?>)) },
705734 title = json[" title" ] as String ,
706735 type = ProductType .fromJson(json[" type" ] as String ),
736+ typeDetails = ProductDetailType .fromJson(json[" typeDetails" ] as String ),
707737 )
708738 }
709739 }
@@ -723,6 +753,7 @@ public data class ProductAndroid(
723753 " subscriptionOfferDetailsAndroid" to subscriptionOfferDetailsAndroid?.map { it.toJson() },
724754 " title" to title,
725755 " type" to type.toJson(),
756+ " typeDetails" to typeDetails.toJson(),
726757 )
727758}
728759
@@ -765,6 +796,7 @@ public data class ProductIOS(
765796 val subscriptionInfoIOS : SubscriptionInfoIOS ? = null ,
766797 val title : String ,
767798 val type : ProductType ,
799+ val typeDetails : ProductDetailType ,
768800 val typeIOS : ProductTypeIOS
769801) : ProductCommon, Product {
770802
@@ -785,6 +817,7 @@ public data class ProductIOS(
785817 subscriptionInfoIOS = (json[" subscriptionInfoIOS" ] as Map <String , Any ?>? )?.let { SubscriptionInfoIOS .fromJson(it) },
786818 title = json[" title" ] as String ,
787819 type = ProductType .fromJson(json[" type" ] as String ),
820+ typeDetails = ProductDetailType .fromJson(json[" typeDetails" ] as String ),
788821 typeIOS = ProductTypeIOS .fromJson(json[" typeIOS" ] as String ),
789822 )
790823 }
@@ -806,6 +839,7 @@ public data class ProductIOS(
806839 " subscriptionInfoIOS" to subscriptionInfoIOS?.toJson(),
807840 " title" to title,
808841 " type" to type.toJson(),
842+ " typeDetails" to typeDetails.toJson(),
809843 " typeIOS" to typeIOS.toJson(),
810844 )
811845}
@@ -823,7 +857,8 @@ public data class ProductSubscriptionAndroid(
823857 val price : Double? = null ,
824858 val subscriptionOfferDetailsAndroid : List <ProductSubscriptionAndroidOfferDetails >,
825859 val title : String ,
826- val type : ProductType
860+ val type : ProductType ,
861+ val typeDetails : ProductDetailType
827862) : ProductCommon, ProductSubscription {
828863
829864 companion object {
@@ -842,6 +877,7 @@ public data class ProductSubscriptionAndroid(
842877 subscriptionOfferDetailsAndroid = (json[" subscriptionOfferDetailsAndroid" ] as List <* >).map { ProductSubscriptionAndroidOfferDetails .fromJson((it as Map <String , Any ?>)) },
843878 title = json[" title" ] as String ,
844879 type = ProductType .fromJson(json[" type" ] as String ),
880+ typeDetails = ProductDetailType .fromJson(json[" typeDetails" ] as String ),
845881 )
846882 }
847883 }
@@ -861,6 +897,7 @@ public data class ProductSubscriptionAndroid(
861897 " subscriptionOfferDetailsAndroid" to subscriptionOfferDetailsAndroid.map { it.toJson() },
862898 " title" to title,
863899 " type" to type.toJson(),
900+ " typeDetails" to typeDetails.toJson(),
864901 )
865902}
866903
@@ -917,6 +954,7 @@ public data class ProductSubscriptionIOS(
917954 val subscriptionPeriodUnitIOS : SubscriptionPeriodIOS ? = null ,
918955 val title : String ,
919956 val type : ProductType ,
957+ val typeDetails : ProductDetailType ,
920958 val typeIOS : ProductTypeIOS
921959) : ProductCommon, ProductSubscription {
922960
@@ -945,6 +983,7 @@ public data class ProductSubscriptionIOS(
945983 subscriptionPeriodUnitIOS = (json[" subscriptionPeriodUnitIOS" ] as String? )?.let { SubscriptionPeriodIOS .fromJson(it) },
946984 title = json[" title" ] as String ,
947985 type = ProductType .fromJson(json[" type" ] as String ),
986+ typeDetails = ProductDetailType .fromJson(json[" typeDetails" ] as String ),
948987 typeIOS = ProductTypeIOS .fromJson(json[" typeIOS" ] as String ),
949988 )
950989 }
@@ -974,6 +1013,7 @@ public data class ProductSubscriptionIOS(
9741013 " subscriptionPeriodUnitIOS" to subscriptionPeriodUnitIOS?.toJson(),
9751014 " title" to title,
9761015 " type" to type.toJson(),
1016+ " typeDetails" to typeDetails.toJson(),
9771017 " typeIOS" to typeIOS.toJson(),
9781018 )
9791019}
0 commit comments