void HandleBillingFlowResult(GoogleBillingResult billingResult, AndroidJavaObject sku) { if (billingResult.responseCode != BillingClientResponseEnum.OK()) { m_GooglePurchaseCallback.OnPurchaseFailed( new PurchaseFailureDescription( sku.Call <string>("getSku"), PurchaseFailureReason.PurchasingUnavailable, billingResult.debugMessage ) ); } }
void onBillingSetupFinished(AndroidJavaObject billingResult) { GoogleBillingResult result = new GoogleBillingResult(billingResult); if (result.responseCode == BillingClientResponseEnum.OK()) { m_OnConnected(); } else { m_Disconnect(); } }
void ConsolidateOnSkuDetailsReceived(AndroidJavaObject javaBillingResult, AndroidJavaObject skuDetails, Action <List <AndroidJavaObject> > onSkuDetailsResponse) { m_NumberReceivedCallbacks++; GoogleBillingResult billingResult = new GoogleBillingResult(javaBillingResult); if (billingResult.responseCode == BillingClientResponseEnum.OK()) { AddToQueriedSkuDetails(skuDetails); } if (m_NumberReceivedCallbacks >= k_RequiredNumberOfCallbacks) { m_GoogleCachedQuerySkuDetailsService.AddCachedQueriedSkus(m_QueriedSkuDetails); onSkuDetailsResponse(m_QueriedSkuDetails); Clear(); } }
/// <summary> /// Implementation of com.android.billingclient.api.PurchasesUpdatedListener#onPurchasesUpdated /// </summary> /// <param name="billingResult"></param> /// <param name="purchasesList"></param> void onPurchasesUpdated(AndroidJavaObject billingResult, AndroidJavaObject purchasesList) { GoogleBillingResult result = new GoogleBillingResult(billingResult); if (result.responseCode == BillingClientResponseEnum.OK() && purchasesList != null) { ApplyOnPurchases(purchasesList, OnPurchaseOk); } else if (result.responseCode == BillingClientResponseEnum.USER_CANCELED() && purchasesList != null) { ApplyOnPurchases(purchasesList, OnPurchaseCanceled); } else if (result.responseCode == BillingClientResponseEnum.ITEM_ALREADY_OWNED() && purchasesList != null) { ApplyOnPurchases(purchasesList, OnPurchaseAlreadyOwned); } else { HandleErrorCases(result, purchasesList); } }
void HandleErrorCases(GoogleBillingResult billingResult, AndroidJavaObject purchasesList) { if (purchasesList == null) { if (billingResult.responseCode == BillingClientResponseEnum.ITEM_ALREADY_OWNED()) { m_GooglePurchaseCallback.OnPurchaseFailed( new PurchaseFailureDescription( m_LastKnownProductService.GetLastKnownProductId(), PurchaseFailureReason.DuplicateTransaction, billingResult.debugMessage ) ); } else if (billingResult.responseCode == BillingClientResponseEnum.USER_CANCELED()) { m_GooglePurchaseCallback.OnPurchaseFailed( new PurchaseFailureDescription( m_LastKnownProductService.GetLastKnownProductId(), PurchaseFailureReason.UserCancelled, billingResult.debugMessage ) ); } else { m_GooglePurchaseCallback.OnPurchaseFailed( new PurchaseFailureDescription( m_LastKnownProductService.GetLastKnownProductId(), PurchaseFailureReason.Unknown, billingResult.debugMessage + " {M: GPUL.HEC}" ) ); } } else { ApplyOnPurchases(purchasesList, billingResult, OnPurchaseFailed); } }
void HandleGooglePurchaseResult(GooglePurchaseResult purchaseResult, Action <List <GooglePurchase> > onPurchaseResult) { onPurchaseResult(purchaseResult.m_ResponseCode == BillingClientResponseEnum.OK() ? purchaseResult.m_Purchases : new List <GooglePurchase>()); }