package com.ea.nimble.mtx.googleplay; import com.ea.nimble.Error; import com.ea.nimble.Log; import com.ea.nimble.Utility; import com.ea.nimble.mtx.INimbleMTX; import com.ea.nimble.mtx.NimbleCatalogItem; import com.ea.nimble.mtx.NimbleMTX; import com.ea.nimble.mtx.NimbleMTXTransaction; import com.ea.nimble.mtx.catalog.synergy.SynergyCatalog; import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.io.Serializable; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; /* loaded from: classes2.dex */ public class GooglePlayTransaction implements NimbleMTXTransaction, Externalizable { String mTransactionId = ""; String mReceipt = ""; String mItemSku = ""; float mPriceDecimal = 0.0f; Date mTimeStamp = null; String mNonce = ""; Exception mError = null; GooglePlayCatalogItem mCatalogItem = null; GooglePlayTransactionState mGooglePlayTransactionState = GooglePlayTransactionState.UNDEFINED; GooglePlayTransactionState mFailedState = null; INimbleMTX.PurchaseTransactionCallback mPurchaseCallback = null; INimbleMTX.FinalizeTransactionCallback mFinalizeCallback = null; INimbleMTX.ItemGrantedCallback mItemGrantedCallback = null; NimbleMTXTransaction.TransactionType mTransactionType = NimbleMTXTransaction.TransactionType.PURCHASE; String mDeveloperPayload = ""; boolean mIsRecorded = false; Map mAdditionalInfo = new HashMap(); public enum GooglePlayTransactionState { UNDEFINED, WAITING_FOR_PREPURCHASE_INFO, WAITING_FOR_NONCE, WAITING_FOR_GOOGLEPLAY_ACTIVITY_RESPONSE, WAITING_FOR_SYNERGY_VERIFICATION, WAITING_FOR_GAME_TO_CONFIRM_ITEM_GRANT, WAITING_FOR_GOOGLEPLAY_CONSUMPTION, COMPLETE } @Override // com.ea.nimble.mtx.NimbleMTXTransaction public String getTransactionId() { Log.Helper.LOGPUBLICFUNC(this); return this.mTransactionId; } @Override // com.ea.nimble.mtx.NimbleMTXTransaction public String getItemSku() { Log.Helper.LOGPUBLICFUNC(this); return this.mItemSku; } /* renamed from: com.ea.nimble.mtx.googleplay.GooglePlayTransaction$1, reason: invalid class name */ public static /* synthetic */ class AnonymousClass1 { static final /* synthetic */ int[] $SwitchMap$com$ea$nimble$mtx$googleplay$GooglePlayTransaction$GooglePlayTransactionState; static { int[] iArr = new int[GooglePlayTransactionState.values().length]; $SwitchMap$com$ea$nimble$mtx$googleplay$GooglePlayTransaction$GooglePlayTransactionState = iArr; try { iArr[GooglePlayTransactionState.WAITING_FOR_PREPURCHASE_INFO.ordinal()] = 1; } catch (NoSuchFieldError unused) { } try { $SwitchMap$com$ea$nimble$mtx$googleplay$GooglePlayTransaction$GooglePlayTransactionState[GooglePlayTransactionState.WAITING_FOR_GOOGLEPLAY_ACTIVITY_RESPONSE.ordinal()] = 2; } catch (NoSuchFieldError unused2) { } try { $SwitchMap$com$ea$nimble$mtx$googleplay$GooglePlayTransaction$GooglePlayTransactionState[GooglePlayTransactionState.WAITING_FOR_NONCE.ordinal()] = 3; } catch (NoSuchFieldError unused3) { } try { $SwitchMap$com$ea$nimble$mtx$googleplay$GooglePlayTransaction$GooglePlayTransactionState[GooglePlayTransactionState.WAITING_FOR_SYNERGY_VERIFICATION.ordinal()] = 4; } catch (NoSuchFieldError unused4) { } try { $SwitchMap$com$ea$nimble$mtx$googleplay$GooglePlayTransaction$GooglePlayTransactionState[GooglePlayTransactionState.WAITING_FOR_GAME_TO_CONFIRM_ITEM_GRANT.ordinal()] = 5; } catch (NoSuchFieldError unused5) { } try { $SwitchMap$com$ea$nimble$mtx$googleplay$GooglePlayTransaction$GooglePlayTransactionState[GooglePlayTransactionState.WAITING_FOR_GOOGLEPLAY_CONSUMPTION.ordinal()] = 6; } catch (NoSuchFieldError unused6) { } try { $SwitchMap$com$ea$nimble$mtx$googleplay$GooglePlayTransaction$GooglePlayTransactionState[GooglePlayTransactionState.COMPLETE.ordinal()] = 7; } catch (NoSuchFieldError unused7) { } try { $SwitchMap$com$ea$nimble$mtx$googleplay$GooglePlayTransaction$GooglePlayTransactionState[GooglePlayTransactionState.UNDEFINED.ordinal()] = 8; } catch (NoSuchFieldError unused8) { } } } @Override // com.ea.nimble.mtx.NimbleMTXTransaction public NimbleMTXTransaction.TransactionState getTransactionState() { Log.Helper.LOGPUBLICFUNC(this); switch (AnonymousClass1.$SwitchMap$com$ea$nimble$mtx$googleplay$GooglePlayTransaction$GooglePlayTransactionState[this.mGooglePlayTransactionState.ordinal()]) { } return NimbleMTXTransaction.TransactionState.UNDEFINED; } @Override // com.ea.nimble.mtx.NimbleMTXTransaction public NimbleMTXTransaction.TransactionType getTransactionType() { Log.Helper.LOGPUBLICFUNC(this); NimbleMTXTransaction.TransactionType transactionType = this.mTransactionType; return transactionType == null ? NimbleMTXTransaction.TransactionType.PURCHASE : transactionType; } @Override // com.ea.nimble.mtx.NimbleMTXTransaction public float getPriceDecimal() { Log.Helper.LOGPUBLICFUNC(this); return this.mPriceDecimal; } @Override // com.ea.nimble.mtx.NimbleMTXTransaction public String getItemSellId() { Log.Helper.LOGPUBLICFUNC(this); List availableCatalogItems = NimbleMTX.getComponent().getAvailableCatalogItems(); String itemSku = getItemSku(); if (availableCatalogItems != null) { for (NimbleCatalogItem nimbleCatalogItem : availableCatalogItems) { if (nimbleCatalogItem.getSku().equals(itemSku)) { String sellId = nimbleCatalogItem.getSellId(); if (Utility.validString(sellId)) { return sellId; } } } } if (this.mAdditionalInfo.containsKey(SynergyCatalog.MTX_INFO_KEY_SELLID)) { return this.mAdditionalInfo.get(SynergyCatalog.MTX_INFO_KEY_SELLID).toString(); } Log.Helper.LOGW(this, "getItemSellId(): Unable to acquire sell id for transaction with SKU: " + itemSku, new Object[0]); return ""; } @Override // com.ea.nimble.mtx.NimbleMTXTransaction public Date getTimeStamp() { Log.Helper.LOGPUBLICFUNC(this); return this.mTimeStamp; } @Override // com.ea.nimble.mtx.NimbleMTXTransaction public String getReceipt() { Log.Helper.LOGPUBLICFUNC(this); return this.mReceipt; } @Override // com.ea.nimble.mtx.NimbleMTXTransaction public Map getAdditionalInfo() { Log.Helper.LOGPUBLICFUNC(this); return new HashMap(this.mAdditionalInfo); } public String getNonce() { Log.Helper.LOGPUBLICFUNC(this); return this.mNonce; } public String getDeveloperPayload() { Log.Helper.LOGPUBLICFUNC(this); return this.mDeveloperPayload; } @Override // com.ea.nimble.mtx.NimbleMTXTransaction public Exception getError() { Log.Helper.LOGPUBLICFUNC(this); return this.mError; } public GooglePlayCatalogItem getCatalogItem() { Log.Helper.LOGPUBLICFUNC(this); return this.mCatalogItem; } public String toString() { StringBuilder sb = new StringBuilder(); sb.append("GooglePlayTransaction: SKU("); sb.append(getItemSku()); sb.append(") State("); GooglePlayTransactionState googlePlayTransactionState = this.mGooglePlayTransactionState; sb.append(googlePlayTransactionState == null ? "null" : googlePlayTransactionState.toString()); sb.append(") Receipt("); sb.append(getReceipt()); sb.append(") TimeStamp("); sb.append(getTimeStamp()); sb.append(")"); return sb.toString(); } @Override // java.io.Externalizable public void writeExternal(ObjectOutput objectOutput) throws IOException { Log.Helper.LOGPUBLICFUNC(this); objectOutput.writeUTF(Utility.safeString(this.mTransactionId)); objectOutput.writeUTF(Utility.safeString(this.mItemSku)); objectOutput.writeObject(this.mGooglePlayTransactionState); objectOutput.writeObject(this.mTransactionType); objectOutput.writeFloat(this.mPriceDecimal); objectOutput.writeObject(this.mTimeStamp); objectOutput.writeUTF(Utility.safeString(this.mReceipt)); objectOutput.writeUTF(Utility.safeString(this.mNonce)); objectOutput.writeObject(this.mError); objectOutput.writeObject(this.mCatalogItem); objectOutput.writeObject(this.mAdditionalInfo); objectOutput.writeUTF(Utility.safeString(this.mDeveloperPayload)); objectOutput.writeObject(this.mFailedState); objectOutput.writeBoolean(this.mIsRecorded); } @Override // java.io.Externalizable public void readExternal(ObjectInput objectInput) throws IOException, ClassNotFoundException { Log.Helper.LOGPUBLICFUNC(this); this.mTransactionId = objectInput.readUTF(); this.mItemSku = objectInput.readUTF(); this.mGooglePlayTransactionState = (GooglePlayTransactionState) objectInput.readObject(); this.mTransactionType = (NimbleMTXTransaction.TransactionType) objectInput.readObject(); this.mPriceDecimal = objectInput.readFloat(); this.mTimeStamp = (Date) objectInput.readObject(); this.mReceipt = objectInput.readUTF(); this.mNonce = objectInput.readUTF(); this.mError = (Error) objectInput.readObject(); this.mCatalogItem = (GooglePlayCatalogItem) objectInput.readObject(); this.mAdditionalInfo = (Map) objectInput.readObject(); this.mDeveloperPayload = objectInput.readUTF(); try { this.mFailedState = (GooglePlayTransactionState) objectInput.readObject(); this.mIsRecorded = objectInput.readBoolean(); } catch (IOException unused) { } } }