Пример #1
0
        public void RestorePurchases()
        {
            if (!_IsStoreLoaded)
            {
                SA.Common.Models.Error e = new SA.Common.Models.Error((int)TransactionErrorCode.SKErrorPaymentServiceNotInitialized, "Store Kit Initilizations required");

                RestoreResult r = new RestoreResult(e);
                OnRestoreComplete(r);
                return;
            }

            OnRestoreStarted();

            if (!Application.isEditor)
            {
                BillingNativeBridge.RestorePurchases();
            }
            else
            {
                if (IOSNativeSettings.Instance.InAppsEditorTesting)
                {
                    foreach (Product product in Products)
                    {
                        if (product.Type == ProductType.NonConsumable)
                        {
                            ISN_Logger.Log("Restored: " + product.Id);
                            FireProductBoughtEvent(product.Id, "", "", "", true);
                        }
                    }

                    FireRestoreCompleteEvent();
                }
            }
        }
Пример #2
0
        //--------------------------------------
        //  PUBLIC METHODS
        //--------------------------------------


        /// <summary>
        /// Initializes the Store Kit with the set of perviostly defined product
        /// </summary>
        public void LoadStore(bool forceLoad = false)
        {
            if (_IsStoreLoaded)
            {
                if (!forceLoad)
                {
                    Invoke("FireSuccessInitEvent", 1f);
                    return;
                }
            }

            if (_IsWaitingLoadResult)
            {
                return;
            }

            _IsWaitingLoadResult = true;

            string ids = "";
            int    len = Products.Count;

            for (int i = 0; i < len; i++)
            {
                if (i != 0)
                {
                    ids += ",";
                }

                ids += Products[i].Id;
            }

            ISN_SoomlaGrow.Init();

            if (!Application.isEditor)
            {
                BillingNativeBridge.LoadStore(ids);

                if (IOSNativeSettings.Instance.TransactionsHandlingMode == TransactionsHandlingMode.Manual)
                {
                    BillingNativeBridge.EnableManulaTransactionsMode();
                }

                if (!IOSNativeSettings.Instance.PromotedPurchaseSupport)
                {
                    BillingNativeBridge.DisablePromotedPurchases();
                }
            }
            else
            {
                if (IOSNativeSettings.Instance.InAppsEditorTesting)
                {
                    Invoke("EditorFakeInitEvent", 1f);
                }
            }
        }
Пример #3
0
        public void BuyProduct(string productId)
        {
            if (!Application.isEditor)
            {
                OnTransactionStarted(productId);
                if (!_IsStoreLoaded)
                {
                    ISN_Logger.Log("buyProduct shouldn't be called before StoreKit is initialized");
                    var error = new SA.Common.Models.Error((int)TransactionErrorCode.SKErrorPaymentNotAllowed, "StoreKit not yet initialized");
                    SendTransactionFailEvent(productId, error);

                    return;
                }

                BillingNativeBridge.BuyProduct(productId);
            }
            else
            {
                if (IOSNativeSettings.Instance.InAppsEditorTesting)
                {
                    FireProductBoughtEvent(productId, "", "", "", false);
                }
            }
        }
Пример #4
0
 public void VerifyLastPurchase(string url)
 {
     BillingNativeBridge.VerifyLastPurchase(url);
 }
Пример #5
0
 public void FinishTransaction(string productId)
 {
     BillingNativeBridge.FinishTransaction(productId);
 }