Example #1
0
        public void OnPurchaseSucceeded(string productId, string receipt)
        {
            if (!remapper.canMapProductSpecificId(productId))
            {
                logger.LogError("Purchased unknown product: {0}. Ignoring!", productId);
                return;
            }
            var details = remapper.getPurchasableItemFromPlatformSpecificId(productId);

            switch (details.PurchaseType)
            {
            case PurchaseType.Consumable:
                callback.onPurchaseSucceeded(productId, receipt);
                break;

            case PurchaseType.NonConsumable:
            case PurchaseType.Subscription:
                var item = remapper.getPurchasableItemFromPlatformSpecificId(productId);
                // We should only provision non consumables if they're not owned.
                if (0 == tDb.getPurchaseHistory(item))
                {
                    callback.onPurchaseSucceeded(productId, receipt);
                }
                break;
            }
        }
Example #2
0
        public void OnPurchaseSucceeded(string productId, string receipt, string tranId)
        {
            util.RunOnMainThread(() => {
                // Our implementations don't currently set the transaction Id,
                // so we extract it from the receipt.
                tranId = readTransactionIdFromReceipt(receipt);
                if (!remapper.canMapProductSpecificId(productId))
                {
                    logger.LogError("Purchased unknown product: {0}. Ignoring!", productId);
                    return;
                }
                var details = remapper.getPurchasableItemFromPlatformSpecificId(productId);
                switch (details.PurchaseType)
                {
                case PurchaseType.Consumable:
                    callback.onPurchaseSucceeded(productId, receipt, tranId);
                    break;

                case PurchaseType.NonConsumable:
                case PurchaseType.Subscription:
                    var item = remapper.getPurchasableItemFromPlatformSpecificId(productId);
                    // We should only provision non consumables if they're not owned.
                    if (0 == tDb.getPurchaseHistory(item))
                    {
                        callback.onPurchaseSucceeded(productId, receipt, tranId);
                    }
                    break;
                }
            });
        }
Example #3
0
        public void OnPurchaseSucceeded(string productId, string receipt)
        {
            #if UNITY_METRO
            UnityEngine.WSA.Application.InvokeOnAppThread(() => {
                logger.LogError("PURCHASE SUCCEEDED!:{0}", count++);
                if (!remapper.canMapProductSpecificId(productId))
                {
                    logger.LogError("Purchased unknown product: {0}. Ignoring!", productId);
                    return;
                }
                var details = remapper.getPurchasableItemFromPlatformSpecificId(productId);
                switch (details.PurchaseType)
                {
                case PurchaseType.Consumable:
                    callback.onPurchaseSucceeded(productId, receipt);
                    break;

                case PurchaseType.NonConsumable:
                case PurchaseType.Subscription:
                    var item = remapper.getPurchasableItemFromPlatformSpecificId(productId);
                    // We should only provision non consumables if they're not owned.
                    if (0 == tDb.getPurchaseHistory(item))
                    {
                        callback.onPurchaseSucceeded(productId, receipt);
                    }
                    break;
                }
            }, false);
            #endif
        }
Example #4
0
        public void onPurchaseSucceeded(string json)
        {
            Dictionary <string, object> response = (Dictionary <string, object>)Unibill.Impl.MiniJSON.jsonDecode(json);

            string productId = (string)response ["productId"];
            string token     = (string)response ["purchaseToken"];

            callback.onPurchaseSucceeded(productId, token);
        }
        public void onPurchaseSucceeded(string data, string receipt)
        {
            Dictionary <string, object> response = (Dictionary <string, object>)Unibill.Impl.MiniJSON.jsonDecode(data);

            var productId     = (string)response ["productId"];
            var transactionId = response.getString("transactionIdentifier");

            // If we're restoring, make sure it isn't a consumable.
            if (restoreInProgress)
            {
                if (remapper.canMapProductSpecificId(productId))
                {
                    if (remapper.getPurchasableItemFromPlatformSpecificId(productId).PurchaseType == PurchaseType.Consumable)
                    {
                        // Silently ignore this consumable.
                        logger.Log("Ignoring restore of consumable: " + productId);
                        // We must close the transaction or storekit will keep sending it to us.
                        storekit.finishTransaction(transactionId);
                        return;
                    }
                }
            }

            biller.onPurchaseSucceeded(productId, receipt, transactionId);
        }
Example #6
0
        public void onPurchaseSucceeded(string data)
        {
            Dictionary <string, object> response = (Dictionary <string, object>)Unibill.Impl.MiniJSON.jsonDecode(data);
            var latestReceipt = (string)response ["receipt"];

            if (!string.IsNullOrEmpty(latestReceipt))
            {
                this.appReceipt = latestReceipt;
            }
            var productId = (string)response ["productId"];

            // If we're restoring, make sure it isn't a consumable.
            if (restoreInProgress)
            {
                if (remapper.canMapProductSpecificId(productId))
                {
                    if (remapper.getPurchasableItemFromPlatformSpecificId(productId).PurchaseType == PurchaseType.Consumable)
                    {
                        // Silently ignore this consumable.
                        logger.Log("Ignoring restore of consumable: " + productId);
                        return;
                    }
                }
            }
            biller.onPurchaseSucceeded(productId, appReceipt);
        }
Example #7
0
 public void restoreTransactions()
 {
     restoreCalled = true;
     foreach (var item in purchasedItems)
     {
         biller.onPurchaseSucceeded(item, "{ \"this\" : \"is a fake receipt\" }");
     }
     this.biller.onTransactionsRestoredSuccess();
 }
        public void onPurchaseSucceeded(string json)
        {
            Dictionary <string, object> response = (Dictionary <string, object>)Unibill.Impl.MiniJSON.jsonDecode(json);
            var signature = (string)response ["signature"];
            var productId = (string)response ["productId"];

            if (!verifyReceipt(signature))
            {
                logger.Log("Signature is invalid!");
                onPurchaseFailed(productId);
            }
            callback.onPurchaseSucceeded(productId, signature);
        }
        public void onPurchaseSucceeded(string json)
        {
            Dictionary <string, object> response = (Dictionary <string, object>)Unibill.Impl.MiniJSON.jsonDecode(json);
            var signature     = (string)response ["signature"];
            var productId     = (string)response ["productId"];
            var transactionId = (string)response ["transactionId"];

            if (!verifyReceipt(signature))
            {
                logger.Log("Signature is invalid!");
                callback.onPurchaseFailedEvent(new PurchaseFailureDescription(productId, PurchaseFailureReason.SIGNATURE_INVALID, "mono"));
                return;
            }
            callback.onPurchaseSucceeded(productId, signature, transactionId);
        }
Example #10
0
        public void onPurchaseSucceeded(string json)
        {
            Dictionary <string, object> response = (Dictionary <string, object>)Unibill.Impl.MiniJSON.jsonDecode(json);

            callback.onPurchaseSucceeded((string)response["productId"], (string)response ["signature"]);
        }
        public void onPurchaseSucceeded(string data)
        {
            Dictionary <string, object> response = (Dictionary <string, object>)Unibill.Impl.MiniJSON.jsonDecode(data);

            biller.onPurchaseSucceeded((string)response["productId"], (string)response["receipt"]);
        }