package com.android.billingclient.api; import android.text.TextUtils; import com.google.android.gms.internal.play_billing.zzai; import com.unity3d.ads.metadata.InAppPurchaseMetaData; import java.util.ArrayList; import java.util.List; import org.json.JSONArray; import org.json.JSONObject; /* loaded from: classes.dex */ public final class f { /* renamed from: a, reason: collision with root package name */ private final String f3974a; /* renamed from: b, reason: collision with root package name */ private final JSONObject f3975b; /* renamed from: c, reason: collision with root package name */ private final String f3976c; /* renamed from: d, reason: collision with root package name */ private final String f3977d; /* renamed from: e, reason: collision with root package name */ private final String f3978e; /* renamed from: f, reason: collision with root package name */ private final String f3979f; /* renamed from: g, reason: collision with root package name */ private final String f3980g; /* renamed from: h, reason: collision with root package name */ private final String f3981h; /* renamed from: i, reason: collision with root package name */ private final String f3982i; /* renamed from: j, reason: collision with root package name */ private final String f3983j; /* renamed from: k, reason: collision with root package name */ private final String f3984k; /* renamed from: l, reason: collision with root package name */ private final List f3985l; /* renamed from: m, reason: collision with root package name */ private final List f3986m; public static final class a { /* renamed from: a, reason: collision with root package name */ private final int f3987a; /* renamed from: b, reason: collision with root package name */ private final int f3988b; a(JSONObject jSONObject) { this.f3987a = jSONObject.getInt("commitmentPaymentsCount"); this.f3988b = jSONObject.optInt("subsequentCommitmentPaymentsCount"); } } public static final class b { /* renamed from: a, reason: collision with root package name */ private final String f3989a; /* renamed from: b, reason: collision with root package name */ private final long f3990b; /* renamed from: c, reason: collision with root package name */ private final String f3991c; /* renamed from: d, reason: collision with root package name */ private final String f3992d; /* renamed from: e, reason: collision with root package name */ private final String f3993e; /* renamed from: f, reason: collision with root package name */ private final String f3994f; /* renamed from: g, reason: collision with root package name */ private final zzai f3995g; /* renamed from: h, reason: collision with root package name */ private final Long f3996h; /* renamed from: i, reason: collision with root package name */ private final x f3997i; /* renamed from: j, reason: collision with root package name */ private final b0 f3998j; /* renamed from: k, reason: collision with root package name */ private final y f3999k; /* renamed from: l, reason: collision with root package name */ private final z f4000l; /* renamed from: m, reason: collision with root package name */ private final a0 f4001m; b(JSONObject jSONObject) { this.f3989a = jSONObject.optString("formattedPrice"); this.f3990b = jSONObject.optLong("priceAmountMicros"); this.f3991c = jSONObject.optString("priceCurrencyCode"); String optString = jSONObject.optString("offerIdToken"); this.f3992d = true == optString.isEmpty() ? null : optString; String optString2 = jSONObject.optString("offerId"); this.f3993e = true == optString2.isEmpty() ? null : optString2; String optString3 = jSONObject.optString("purchaseOptionId"); this.f3994f = true == optString3.isEmpty() ? null : optString3; jSONObject.optInt("offerType"); JSONArray optJSONArray = jSONObject.optJSONArray("offerTags"); ArrayList arrayList = new ArrayList(); if (optJSONArray != null) { for (int i10 = 0; i10 < optJSONArray.length(); i10++) { arrayList.add(optJSONArray.getString(i10)); } } this.f3995g = zzai.zzj(arrayList); this.f3996h = jSONObject.has("fullPriceMicros") ? Long.valueOf(jSONObject.optLong("fullPriceMicros")) : null; JSONObject optJSONObject = jSONObject.optJSONObject("discountDisplayInfo"); this.f3997i = optJSONObject == null ? null : new x(optJSONObject); JSONObject optJSONObject2 = jSONObject.optJSONObject("validTimeWindow"); this.f3998j = optJSONObject2 == null ? null : new b0(optJSONObject2); JSONObject optJSONObject3 = jSONObject.optJSONObject("limitedQuantityInfo"); this.f3999k = optJSONObject3 == null ? null : new y(optJSONObject3); JSONObject optJSONObject4 = jSONObject.optJSONObject("preorderDetails"); this.f4000l = optJSONObject4 == null ? null : new z(optJSONObject4); JSONObject optJSONObject5 = jSONObject.optJSONObject("rentalDetails"); this.f4001m = optJSONObject5 != null ? new a0(optJSONObject5) : null; } public String a() { return this.f3989a; } public final String b() { return this.f3992d; } } public static final class c { /* renamed from: a, reason: collision with root package name */ private final String f4002a; /* renamed from: b, reason: collision with root package name */ private final long f4003b; /* renamed from: c, reason: collision with root package name */ private final String f4004c; /* renamed from: d, reason: collision with root package name */ private final String f4005d; /* renamed from: e, reason: collision with root package name */ private final int f4006e; /* renamed from: f, reason: collision with root package name */ private final int f4007f; c(JSONObject jSONObject) { this.f4005d = jSONObject.optString("billingPeriod"); this.f4004c = jSONObject.optString("priceCurrencyCode"); this.f4002a = jSONObject.optString("formattedPrice"); this.f4003b = jSONObject.optLong("priceAmountMicros"); this.f4007f = jSONObject.optInt("recurrenceMode"); this.f4006e = jSONObject.optInt("billingCycleCount"); } public String a() { return this.f4002a; } } public static class d { /* renamed from: a, reason: collision with root package name */ private final List f4008a; d(JSONArray jSONArray) { ArrayList arrayList = new ArrayList(); if (jSONArray != null) { for (int i10 = 0; i10 < jSONArray.length(); i10++) { JSONObject optJSONObject = jSONArray.optJSONObject(i10); if (optJSONObject != null) { arrayList.add(new c(optJSONObject)); } } } this.f4008a = arrayList; } public List a() { return this.f4008a; } } public static final class e { /* renamed from: a, reason: collision with root package name */ private final String f4009a; /* renamed from: b, reason: collision with root package name */ private final String f4010b; /* renamed from: c, reason: collision with root package name */ private final String f4011c; /* renamed from: d, reason: collision with root package name */ private final d f4012d; /* renamed from: e, reason: collision with root package name */ private final List f4013e; /* renamed from: f, reason: collision with root package name */ private final a f4014f; /* renamed from: g, reason: collision with root package name */ private final c0 f4015g; e(JSONObject jSONObject) { this.f4009a = jSONObject.optString("basePlanId"); String optString = jSONObject.optString("offerId"); this.f4010b = true == optString.isEmpty() ? null : optString; this.f4011c = jSONObject.getString("offerIdToken"); this.f4012d = new d(jSONObject.getJSONArray("pricingPhases")); JSONObject optJSONObject = jSONObject.optJSONObject("installmentPlanDetails"); this.f4014f = optJSONObject == null ? null : new a(optJSONObject); JSONObject optJSONObject2 = jSONObject.optJSONObject("transitionPlanDetails"); this.f4015g = optJSONObject2 != null ? new c0(optJSONObject2) : null; ArrayList arrayList = new ArrayList(); JSONArray optJSONArray = jSONObject.optJSONArray("offerTags"); if (optJSONArray != null) { for (int i10 = 0; i10 < optJSONArray.length(); i10++) { arrayList.add(optJSONArray.getString(i10)); } } this.f4013e = arrayList; } public String a() { return this.f4011c; } public d b() { return this.f4012d; } } f(String str) { this.f3974a = str; JSONObject jSONObject = new JSONObject(str); this.f3975b = jSONObject; String optString = jSONObject.optString(InAppPurchaseMetaData.KEY_PRODUCT_ID); this.f3976c = optString; String optString2 = jSONObject.optString("type"); this.f3977d = optString2; if (TextUtils.isEmpty(optString)) { throw new IllegalArgumentException("Product id cannot be empty."); } if (TextUtils.isEmpty(optString2)) { throw new IllegalArgumentException("Product type cannot be empty."); } this.f3978e = jSONObject.optString("title"); this.f3979f = jSONObject.optString("name"); this.f3980g = jSONObject.optString("description"); this.f3982i = jSONObject.optString("packageDisplayName"); this.f3983j = jSONObject.optString("iconUrl"); this.f3981h = jSONObject.optString("skuDetailsToken"); this.f3984k = jSONObject.optString("serializedDocid"); JSONArray optJSONArray = jSONObject.optJSONArray("subscriptionOfferDetails"); if (optJSONArray != null) { ArrayList arrayList = new ArrayList(); for (int i10 = 0; i10 < optJSONArray.length(); i10++) { arrayList.add(new e(optJSONArray.getJSONObject(i10))); } this.f3985l = arrayList; } else { this.f3985l = (optString2.equals("subs") || optString2.equals("play_pass_subs")) ? new ArrayList() : null; } JSONObject optJSONObject = this.f3975b.optJSONObject("oneTimePurchaseOfferDetails"); JSONArray optJSONArray2 = this.f3975b.optJSONArray("oneTimePurchaseOfferDetailsList"); ArrayList arrayList2 = new ArrayList(); if (optJSONArray2 != null) { for (int i11 = 0; i11 < optJSONArray2.length(); i11++) { arrayList2.add(new b(optJSONArray2.getJSONObject(i11))); } this.f3986m = arrayList2; return; } if (optJSONObject == null) { this.f3986m = null; } else { arrayList2.add(new b(optJSONObject)); this.f3986m = arrayList2; } } public String a() { return this.f3980g; } public String b() { return this.f3979f; } public b c() { List list = this.f3986m; if (list == null || list.isEmpty()) { return null; } return (b) this.f3986m.get(0); } public String d() { return this.f3976c; } public String e() { return this.f3977d; } public boolean equals(Object obj) { if (this == obj) { return true; } if (obj instanceof f) { return TextUtils.equals(this.f3974a, ((f) obj).f3974a); } return false; } public List f() { return this.f3985l; } public String g() { return this.f3978e; } public final String h() { return this.f3975b.optString("packageName"); } public int hashCode() { return this.f3974a.hashCode(); } final String i() { return this.f3981h; } public String j() { return this.f3984k; } public String toString() { List list = this.f3985l; return "ProductDetails{jsonString='" + this.f3974a + "', parsedJson=" + this.f3975b.toString() + ", productId='" + this.f3976c + "', productType='" + this.f3977d + "', title='" + this.f3978e + "', productDetailsToken='" + this.f3981h + "', subscriptionOfferDetails=" + String.valueOf(list) + "}"; } }