- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
98 lines
2.7 KiB
Java
98 lines
2.7 KiB
Java
package com.android.billingclient.api;
|
|
|
|
import android.text.TextUtils;
|
|
import com.facebook.gamingservices.cloudgaming.internal.SDKConstants;
|
|
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 class Purchase {
|
|
public final String zza;
|
|
public final String zzb;
|
|
public final JSONObject zzc;
|
|
|
|
public Purchase(String str, String str2) {
|
|
this.zza = str;
|
|
this.zzb = str2;
|
|
this.zzc = new JSONObject(str);
|
|
}
|
|
|
|
public boolean equals(Object obj) {
|
|
if (this == obj) {
|
|
return true;
|
|
}
|
|
if (!(obj instanceof Purchase)) {
|
|
return false;
|
|
}
|
|
Purchase purchase = (Purchase) obj;
|
|
return TextUtils.equals(this.zza, purchase.getOriginalJson()) && TextUtils.equals(this.zzb, purchase.getSignature());
|
|
}
|
|
|
|
public String getDeveloperPayload() {
|
|
return this.zzc.optString(SDKConstants.PARAM_DEVELOPER_PAYLOAD);
|
|
}
|
|
|
|
public String getOrderId() {
|
|
String optString = this.zzc.optString("orderId");
|
|
if (TextUtils.isEmpty(optString)) {
|
|
return null;
|
|
}
|
|
return optString;
|
|
}
|
|
|
|
public String getOriginalJson() {
|
|
return this.zza;
|
|
}
|
|
|
|
public List getProducts() {
|
|
return zza();
|
|
}
|
|
|
|
public int getPurchaseState() {
|
|
return this.zzc.optInt("purchaseState", 1) != 4 ? 1 : 2;
|
|
}
|
|
|
|
public long getPurchaseTime() {
|
|
return this.zzc.optLong("purchaseTime");
|
|
}
|
|
|
|
public String getPurchaseToken() {
|
|
JSONObject jSONObject = this.zzc;
|
|
return jSONObject.optString("token", jSONObject.optString(SDKConstants.PARAM_PURCHASE_TOKEN));
|
|
}
|
|
|
|
public String getSignature() {
|
|
return this.zzb;
|
|
}
|
|
|
|
public int hashCode() {
|
|
return this.zza.hashCode();
|
|
}
|
|
|
|
public boolean isAcknowledged() {
|
|
return this.zzc.optBoolean("acknowledged", true);
|
|
}
|
|
|
|
public String toString() {
|
|
return "Purchase. Json: ".concat(String.valueOf(this.zza));
|
|
}
|
|
|
|
public final ArrayList zza() {
|
|
ArrayList arrayList = new ArrayList();
|
|
if (this.zzc.has("productIds")) {
|
|
JSONArray optJSONArray = this.zzc.optJSONArray("productIds");
|
|
if (optJSONArray != null) {
|
|
for (int i = 0; i < optJSONArray.length(); i++) {
|
|
arrayList.add(optJSONArray.optString(i));
|
|
}
|
|
}
|
|
} else if (this.zzc.has(InAppPurchaseMetaData.KEY_PRODUCT_ID)) {
|
|
arrayList.add(this.zzc.optString(InAppPurchaseMetaData.KEY_PRODUCT_ID));
|
|
}
|
|
return arrayList;
|
|
}
|
|
}
|