package com.android.billingclient.api; import android.text.TextUtils; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import java.util.ArrayList; import java.util.List; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; /* compiled from: com.android.billingclient:billing@@4.0.0 */ public class Purchase { public final String a; public final String b; /* renamed from: c reason: collision with root package name */ public final JSONObject f1581c; /* compiled from: com.android.billingclient:billing@@4.0.0 */ public static class a { @Nullable public final List a; public final BillingResult b; public a(@NonNull BillingResult billingResult, @Nullable List list) { this.a = list; this.b = billingResult; } } public Purchase(@NonNull String str, @NonNull String str2) throws JSONException { this.a = str; this.b = str2; this.f1581c = new JSONObject(str); } @NonNull public String a() { JSONObject jSONObject = this.f1581c; return jSONObject.optString("token", jSONObject.optString("purchaseToken")); } @NonNull public ArrayList b() { ArrayList arrayList = new ArrayList<>(); if (this.f1581c.has("productIds")) { JSONArray optJSONArray = this.f1581c.optJSONArray("productIds"); if (optJSONArray != null) { for (int i = 0; i < optJSONArray.length(); i++) { arrayList.add(optJSONArray.optString(i)); } } } else if (this.f1581c.has("productId")) { arrayList.add(this.f1581c.optString("productId")); } return arrayList; } public boolean c() { return this.f1581c.optBoolean("acknowledged", true); } public boolean equals(@Nullable Object obj) { if (this == obj) { return true; } if (!(obj instanceof Purchase)) { return false; } Purchase purchase = (Purchase) obj; return TextUtils.equals(this.a, purchase.a) && TextUtils.equals(this.b, purchase.b); } public int hashCode() { return this.a.hashCode(); } @NonNull public String toString() { String valueOf = String.valueOf(this.a); return valueOf.length() != 0 ? "Purchase. Json: ".concat(valueOf) : new String("Purchase. Json: "); } }