示例#1
0
        public void onPurchaseSucceeded(string id, string receipt)
        {
            if (!verifyPlatformId(id))
            {
                return;
            }
            if (null != receipt)
            {
                this.onPurchaseReceiptRetrieved(id, receipt);
            }

            PurchasableItem item = remapper.getPurchasableItemFromPlatformSpecificId(id);

            if (item.PurchaseType == PurchaseType.NonConsumable)
            {
                if (transactionDatabase.getPurchaseHistory(item) > 0)
                {
                    logger.Log("Ignoring multi purchase of non consumable");
                    return;
                }
            }

            logger.Log("onPurchaseSucceeded({0})", item.Id);
            transactionDatabase.onPurchase(item);
            currencyManager.OnPurchased(item.Id);
            if (null != onPurchaseComplete)
            {
                onPurchaseComplete(new PurchaseEvent(item, receipt));
            }
        }
示例#2
0
 public void purchase(string item)
 {
     purchaseCalled = true;
     // Our billing systems should only keep track of non consumables.
     if (remapper.getPurchasableItemFromPlatformSpecificId(item).PurchaseType == PurchaseType.NonConsumable)
     {
         purchasedItems.Add(item);
     }
     this.biller.onPurchaseSucceeded(item, "{ \"this\" : \"is a fake receipt\" }");
 }
示例#3
0
 public void purchase(string item, string developerPayload)
 {
     purchaseCalled = true;
     // Our billing systems should only keep track of non consumables.
     if (remapper.getPurchasableItemFromPlatformSpecificId(item).PurchaseType == PurchaseType.NonConsumable)
     {
         purchasedItems.Add(item);
     }
     biller.onPurchaseReceiptRetrieved(item, "fake receipt");
     this.biller.onPurchaseSucceeded(item, "{ \"this\" : \"is a fake receipt\" }", Guid.NewGuid().ToString());
 }
示例#4
0
文件: Biller.cs 项目: vcan/CapsUnity
        public void onPurchaseSucceeded(string id, string receipt)
        {
            if (!verifyPlatformId(id))
            {
                return;
            }
            PurchasableItem item = remapper.getPurchasableItemFromPlatformSpecificId(id);

            if (receipt != null && receipt.Length > 0)
            {
                // Take a note of the receipt.

                if (!receiptMap.ContainsKey(item))
                {
                    receiptMap.Add(item, new List <string> ());
                }

                receiptMap [item].Add(receipt);
            }

            if (item.PurchaseType != PurchaseType.Consumable)
            {
                if (transactionDatabase.getPurchaseHistory(item) > 0)
                {
                    logger.Log("Ignoring multi purchase of non consumable");
                    return;
                }
            }

            logger.Log("onPurchaseSucceeded({0})", item.Id);
            transactionDatabase.onPurchase(item);
            currencyManager.OnPurchased(item.Id);
            if (null != onPurchaseComplete)
            {
                onPurchaseComplete(new PurchaseEvent(item, receipt));
            }
        }
        private void onPurchaseSucceeded(string id, bool isNewPurchase, string receipt, string transactionId)
        {
            if (!verifyPlatformId(id))
            {
                // We still need to close the transaction.
                billingSubsystem.finishTransaction(null, transactionId);
                return;
            }
            if (null != receipt)
            {
                this.onPurchaseReceiptRetrieved(id, receipt);
            }

            PurchasableItem item = remapper.getPurchasableItemFromPlatformSpecificId(id);

            if (item.PurchaseType == PurchaseType.NonConsumable)
            {
                if (transactionDatabase.getPurchaseHistory(item) > 0)
                {
                    logger.Log("Ignoring multi purchase of non consumable " + item.Id);
                    billingSubsystem.finishTransaction(item, transactionId);
                    return;
                }
            }

            if (transactionDatabase.recordPurchase(item, transactionId))
            {
                currencyManager.OnPurchased(item.Id);
                if (null != onPurchaseComplete)
                {
                    logger.Log("onPurchaseSucceeded {0} {1})", item.Id, transactionId);
                    onPurchaseComplete(new PurchaseEvent(item, isNewPurchase, receipt, transactionId));
                }
            }

            // We don't put this in a try finally since we want any
            // exceptions to prevent the transaction closing.
            billingSubsystem.finishTransaction(item, transactionId);
        }