package com.android.billingclient.api;

import android.text.TextUtils;
import com.bytedance.covode.number.Covode;
import org.json.JSONObject;

public class Purchase {
    public final String LIZ;
    public final String LIZIZ;
    public final JSONObject LIZJ;

    static {
        Covode.recordClassIndex(2317);
    }

    public int hashCode() {
        return this.LIZ.hashCode();
    }

    public final String LIZ() {
        return this.LIZJ.optString("orderId");
    }

    public final String LIZIZ() {
        return this.LIZJ.optString("productId");
    }

    public final String LIZJ() {
        JSONObject jSONObject = this.LIZJ;
        return jSONObject.optString("token", jSONObject.optString("purchaseToken"));
    }

    public final int LIZLLL() {
        if (this.LIZJ.optInt("purchaseState", 1) != 4) {
            return 1;
        }
        return 2;
    }

    public final boolean LJ() {
        return this.LIZJ.optBoolean("acknowledged", true);
    }

    public String toString() {
        String valueOf = String.valueOf(this.LIZ);
        if (valueOf.length() != 0) {
            return "Purchase. Json: ".concat(valueOf);
        }
        return new String("Purchase. Json: ");
    }

    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (!(obj instanceof Purchase)) {
            return false;
        }
        Purchase purchase = (Purchase) obj;
        if (!TextUtils.equals(this.LIZ, purchase.LIZ) || !TextUtils.equals(this.LIZIZ, purchase.LIZIZ)) {
            return false;
        }
        return true;
    }

    public Purchase(String str, String str2) {
        this.LIZ = str;
        this.LIZIZ = str2;
        this.LIZJ = new JSONObject(str);
    }
}
