Ejemplo n.º 1
0
    private void queryInventorySucceededEvent(Inventory inventory)
    {
        if (inventory != null)
        {
            _inventory = inventory;
            Purchase mPurchase = inventory.GetPurchase(SKU);

            string rsaXml = B64X.Decrypt((Resources.Load("RSA") as TextAsset).text, "myRSA!!!xml");
            bool   check  = GooglePlayPurchaseGuard.Verify(mPurchase.OriginalJson, mPurchase.Signature, rsaXml);

            if (!check)
            {
                print("incorrect");
            }

            bool payed = (mPurchase != null && VerifyDeveloperPayload(mPurchase.DeveloperPayload) && check && mPurchase.PurchaseState == 0);

            string key = B64X.GetNewKey();
            menuManager.payed = B64X.Encrypt(payed.ToString(), key);
            menuManager.key2  = key;
        }
        else
        {
            print("Debil!");
        }
    }
Ejemplo n.º 2
0
        // Handlers

        private void Purchased(Purchase purchase)
        {
            #if UNITY_IPHONE || UNITY_WEBPLAYER
            var verified = true;
            #elif UNITY_ANDROID
            var verified = GooglePlayPurchaseGuard.Verify(purchase.OriginalJson, purchase.Signature, PlanformDependedSettings.StorePublicKeyXml);
            #endif

            if (purchase.Sku == SkuCredits)
            {
                _openIabClient.ConsumeProduct(purchase, true);
            }

            if (verified)
            {
                Purchased(purchase.Sku);
            }
        }