public void restorePurchases()
    {
        if (!_IsStoreLoaded)
        {
            IOSStoreKitError e = new IOSStoreKitError();
            e.code        = IOSTransactionErrorCode.SKErrorPaymentServiceNotInitialized;
            e.description = "Store Kit Initilizations required";

            IOSStoreKitRestoreResponce r = new IOSStoreKitRestoreResponce(false, e);
            OnRestoreComplete(r);
            dispatch(RESTORE_TRANSACTION_FAILED, r);
            return;
        }

                #if !UNITY_EDITOR
        IOSNativeMarketBridge.restorePurchases();
                #else
        if (IOSNativeSettings.Instance.SendFakeEventsInEditor)
        {
            foreach (string productId in _productsIds)
            {
                Debug.Log("Restored: " + productId);
                FireProductBoughtEvent(productId, "", "", true);
            }
            FireRestoreCompleteEvent();
        }
                #endif
    }
    public void buyProduct(string productId)
    {
                #if !UNITY_EDITOR
        if (!_IsStoreLoaded)
        {
            Debug.LogWarning("buyProduct shouldn't be called before store kit initialized");
            SendTransactionFailEvent(productId, "Store kit not yet initialized");

            return;
        }
        else
        {
            if (!_IsInAppPurchasesEnabled)
            {
                SendTransactionFailEvent(productId, "In App Purchases Disabled");
            }
        }

        IOSNativeMarketBridge.buyProduct(productId);
                #else
        if (IOSNativeSettings.Instance.SendFakeEventsInEditor)
        {
            FireProductBoughtEvent(productId, "", false);
        }
                #endif
    }
Esempio n. 3
0
    public void RestorePurchases()
    {
        if (!_IsStoreLoaded)
        {
            SA.Common.Models.Error e = new SA.Common.Models.Error((int)IOSTransactionErrorCode.SKErrorPaymentServiceNotInitialized, "Store Kit Initilizations required");

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

        OnRestoreStarted();

                #if !UNITY_EDITOR
        IOSNativeMarketBridge.restorePurchases();
                #else
        if (IOSNativeSettings.Instance.SendFakeEventsInEditor)
        {
            foreach (IOSProductTemplate product in Products)
            {
                if (product.ProductType == ISN_InAppType.NonConsumable)
                {
                    ISN_Logger.Log("Restored: " + product.Id);
                    FireProductBoughtEvent(product.Id, "", "", "", true);
                }
            }

            FireRestoreCompleteEvent();
        }
                #endif
    }
Esempio n. 4
0
    //--------------------------------------
    //  PUBLIC METHODS
    //--------------------------------------

    public void loadStore()
    {
        if (_IsWaitingLoadResult || _IsStoreLoaded)
        {
            return;
        }

        _IsWaitingLoadResult = true;

        foreach (string pid in IOSNativeSettings.Instance.InAppProducts)
        {
            addProductId(pid);
        }

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

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

            ids += _productsIds[i];
        }

        IOSNativeMarketBridge.loadStore(ids);
    }
Esempio n. 5
0
    public void restorePurchases()
    {
        if (!_IsStoreLoaded)
        {
            ISN_Error e = new ISN_Error((int)IOSTransactionErrorCode.SKErrorPaymentServiceNotInitialized, "Store Kit Initilizations required");

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

                #if !UNITY_EDITOR
        IOSNativeMarketBridge.restorePurchases();
                #else
        if (IOSNativeSettings.Instance.SendFakeEventsInEditor)
        {
            foreach (string productId in _productsIds)
            {
                Debug.Log("Restored: " + productId);
                FireProductBoughtEvent(productId, "", "", "", true);
            }
            FireRestoreCompleteEvent();
        }
                #endif
    }
Esempio n. 6
0
    public void restorePurchases()
    {
        if (!_IsStoreLoaded || !_IsInAppPurchasesEnabled)
        {
            dispatch(RESTORE_TRANSACTION_FAILED);
            return;
        }

        IOSNativeMarketBridge.restorePurchases();
    }
    //--------------------------------------
    //  PUBLIC METHODS
    //--------------------------------------

    public void loadStore()
    {
        if (_IsStoreLoaded)
        {
            Invoke("FireSuccsesInitEvent", 1f);
            return;
        }

        if (_IsWaitingLoadResult)
        {
            return;
        }

        _IsWaitingLoadResult = true;

        foreach (string pid in IOSNativeSettings.Instance.InAppProducts)
        {
            addProductId(pid);
        }

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

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

            ids += _productsIds[i];
        }


                #if !UNITY_EDITOR
        IOSNativeMarketBridge.loadStore(ids);
                #else
        if (IOSNativeSettings.Instance.SendFakeEventsInEditor)
        {
            Invoke("FireSuccsesInitEvent", 1f);
        }
                #endif
    }
Esempio n. 8
0
    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 !UNITY_EDITOR
        IOSNativeMarketBridge.loadStore(ids);
                #else
        if (IOSNativeSettings.Instance.SendFakeEventsInEditor)
        {
            Invoke("EditorFakeInitEvent", 1f);
        }
                #endif
    }
Esempio n. 9
0
    public void buyProduct(string productId)
    {
        if (!_IsStoreLoaded)
        {
            Debug.LogWarning("buyProduct shouldn't be called before store kit initialized");
            SendTransactionFailEvent(productId, "Store kit not yet initialized");

            return;
        }
        else
        {
            if (!_IsInAppPurchasesEnabled)
            {
                SendTransactionFailEvent(productId, "In App Purchases Disabled");
            }
        }

        IOSNativeMarketBridge.buyProduct(productId);
    }
    public void restorePurchases()
    {
        if (!_IsStoreLoaded || !_IsInAppPurchasesEnabled)
        {
            dispatch(RESTORE_TRANSACTION_FAILED);
            OnRestoreComplete(new ISN_Result(false));
            return;
        }

                #if !UNITY_EDITOR
        IOSNativeMarketBridge.restorePurchases();
                #else
        if (IOSNativeSettings.Instance.SendFakeEventsInEditor)
        {
            foreach (string productId in _productsIds)
            {
                FireProductBoughtEvent(productId, "", true);
            }
            FireRestoreCompleteEvent();
        }
                #endif
    }
    public void buyProduct(string productId)
    {
                #if !UNITY_EDITOR
        if (!_IsStoreLoaded)
        {
            if (!IOSNativeSettings.Instance.DisablePluginLogs)
            {
                Debug.LogWarning("buyProduct shouldn't be called before StoreKit is initialized");
            }
            SendTransactionFailEvent(productId, "StoreKit not yet initialized", IOSTransactionErrorCode.SKErrorPaymentNotAllowed);

            return;
        }

        IOSNativeMarketBridge.buyProduct(productId);
                #else
        if (IOSNativeSettings.Instance.SendFakeEventsInEditor)
        {
            FireProductBoughtEvent(productId, "", "", false);
        }
                #endif
    }
 public void verifyLastPurchase(string url)
 {
     IOSNativeMarketBridge.verifyLastPurchase(url);
 }
 public void RequestInAppSettingState()
 {
     IOSNativeMarketBridge.ISN_RequestInAppSettingState();
 }
Esempio n. 14
0
 public void RequestStorefrontIdentifier()
 {
     IOSNativeMarketBridge.CloudService_RequestStorefrontIdentifier();
 }
Esempio n. 15
0
 public void RequestCapabilities()
 {
     IOSNativeMarketBridge.CloudService_RequestCapabilities();
 }
Esempio n. 16
0
    //--------------------------------------
    //  Public Methods
    //--------------------------------------

    public void RequestAuthorization()
    {
        IOSNativeMarketBridge.CloudService_RequestAuthorization();
    }