Example #1
0
 void transactionUpdated(string json)
 {
     if (transactionUpdatedEvent != null)
     {
         transactionUpdatedEvent(StoreKitTransaction.transactionFromJson(json));
     }
 }
Example #2
0
 void productPurchased(string json)
 {
     if (purchaseSuccessfulEvent != null)
     {
         purchaseSuccessfulEvent(StoreKitTransaction.transactionFromJson(json));
     }
 }
	    public static StoreKitTransaction transactionFromDictionary( Dictionary<string,object> dict )
	    {
	        var transaction = new StoreKitTransaction();
	
			if( dict.ContainsKey( "productIdentifier" ) )
	        	transaction.productIdentifier = dict["productIdentifier"].ToString();
	
			if( dict.ContainsKey( "transactionIdentifier" ) )
	        	transaction.transactionIdentifier = dict["transactionIdentifier"].ToString();
	
			if( dict.ContainsKey( "base64EncodedReceipt" ) )
	        	transaction.base64EncodedTransactionReceipt = dict["base64EncodedReceipt"].ToString();
			
			if( dict.ContainsKey( "applicationUsername" ) )
				transaction.applicationUsername = dict["applicationUsername"].ToString();
	
			if( dict.ContainsKey( "quantity" ) )
	        	transaction.quantity = int.Parse( dict["quantity"].ToString() );
	
			if( dict.ContainsKey( "transactionState" ) )
				transaction.transactionState = (StoreKitTransactionState)int.Parse( dict["transactionState"].ToString() );
	
			if( dict.ContainsKey( "downloads" ) )
				transaction.downloads = int.Parse( dict["downloads"].ToString() );
	
	        return transaction;
	    }
        // Returns a list of all the transactions that occured on this device.  They are stored in the Document directory.
        public static List <StoreKitTransaction> getAllSavedTransactions()
        {
            if (Application.platform == RuntimePlatform.IPhonePlayer)
            {
                // Grab the transactions and parse them out
                var json = _storeKitGetAllSavedTransactions();
                return(StoreKitTransaction.transactionsFromJson(json));
            }

            return(new List <StoreKitTransaction>());
        }
Example #5
0
        void productPurchaseAwaitingConfirmation(string json)
        {
            if (productPurchaseAwaitingConfirmationEvent != null)
            {
                productPurchaseAwaitingConfirmationEvent(StoreKitTransaction.transactionFromJson(json));
            }

            if (autoConfirmTransactions)
            {
                StoreKitBinding.finishPendingTransactions();
            }
        }
        public static StoreKitDownload downloadFromDictionary(Dictionary <string, object> dict)
        {
            var download = new StoreKitDownload();

            if (dict.ContainsKey("downloadState"))
            {
                download.downloadState = (StoreKitDownloadState)int.Parse(dict["downloadState"].ToString());
            }

            if (dict.ContainsKey("contentLength"))
            {
                download.contentLength = double.Parse(dict["contentLength"].ToString());
            }

            if (dict.ContainsKey("contentIdentifier"))
            {
                download.contentIdentifier = dict["contentIdentifier"].ToString();
            }

            if (dict.ContainsKey("contentURL"))
            {
                download.contentURL = dict["contentURL"].ToString();
            }

            if (dict.ContainsKey("contentVersion"))
            {
                download.contentVersion = dict["contentVersion"].ToString();
            }

            if (dict.ContainsKey("error"))
            {
                download.error = dict["error"].ToString();
            }

            if (dict.ContainsKey("progress"))
            {
                download.progress = float.Parse(dict["progress"].ToString());
            }

            if (dict.ContainsKey("timeRemaining"))
            {
                download.timeRemaining = double.Parse(dict["timeRemaining"].ToString());
            }

            if (dict.ContainsKey("transaction"))
            {
                download.transaction = StoreKitTransaction.transactionFromDictionary(dict["transaction"] as Dictionary <string, object>);
            }

            return(download);
        }
Example #7
0
        public static StoreKitTransaction transactionFromDictionary(Dictionary <string, object> dict)
        {
            var transaction = new StoreKitTransaction();

            if (dict.ContainsKey("productIdentifier"))
            {
                transaction.productIdentifier = dict["productIdentifier"].ToString();
            }

            if (dict.ContainsKey("transactionIdentifier"))
            {
                transaction.transactionIdentifier = dict["transactionIdentifier"].ToString();
            }

            if (dict.ContainsKey("applicationUsername"))
            {
                transaction.applicationUsername = dict["applicationUsername"].ToString();
            }

            if (dict.ContainsKey("quantity"))
            {
                transaction.quantity = int.Parse(dict["quantity"].ToString());
            }

            if (dict.ContainsKey("transactionState"))
            {
                transaction.transactionState = (StoreKitTransactionState)int.Parse(dict["transactionState"].ToString());
            }

            if (dict.ContainsKey("downloads"))
            {
                transaction.downloads = int.Parse(dict["downloads"].ToString());
            }

            if (dict.ContainsKey("originalTransaction"))
            {
                var tempTransaction = dict["originalTransaction"];
                if (tempTransaction != null && tempTransaction is Dictionary <string, object> )
                {
                    transaction.originalTransaction = StoreKitTransaction.transactionFromDictionary(tempTransaction as Dictionary <string, object>);
                }
            }

            return(transaction);
        }
Example #8
0
        public static StoreKitTransaction transactionFromDictionary(Dictionary <string, object> dict)
        {
            var transaction = new StoreKitTransaction();

            if (dict.ContainsKey("productIdentifier"))
            {
                transaction.productIdentifier = dict["productIdentifier"].ToString();
            }

            if (dict.ContainsKey("transactionIdentifier"))
            {
                transaction.transactionIdentifier = dict["transactionIdentifier"].ToString();
            }

            if (dict.ContainsKey("base64EncodedReceipt"))
            {
                transaction.base64EncodedTransactionReceipt = dict["base64EncodedReceipt"].ToString();
            }

            if (dict.ContainsKey("applicationUsername"))
            {
                transaction.applicationUsername = dict["applicationUsername"].ToString();
            }

            if (dict.ContainsKey("quantity"))
            {
                transaction.quantity = int.Parse(dict["quantity"].ToString());
            }

            if (dict.ContainsKey("transactionState"))
            {
                transaction.transactionState = (StoreKitTransactionState)int.Parse(dict["transactionState"].ToString());
            }

            if (dict.ContainsKey("downloads"))
            {
                transaction.downloads = int.Parse(dict["downloads"].ToString());
            }

            return(transaction);
        }
Example #9
0
 void transactionUpdatedEvent(StoreKitTransaction transaction)
 {
     Debug.Log("transactionUpdatedEvent: " + transaction);
 }
Example #10
0
 void purchaseSuccessfulEvent(StoreKitTransaction transaction)
 {
     Debug.Log("purchaseSuccessfulEvent");
     Utils.logObject(transaction);
 }
		void productPurchaseAwaitingConfirmationEvent( StoreKitTransaction transaction )
		{
			Debug.Log( "productPurchaseAwaitingConfirmationEvent: " + transaction );
		}
		void transactionUpdatedEvent( StoreKitTransaction transaction )
		{
			Debug.Log( "transactionUpdatedEvent: " + transaction );
		}
		void purchaseSuccessfulEvent( StoreKitTransaction transaction )
		{
			Debug.Log( "purchaseSuccessfulEvent: " + transaction );
		}
Example #14
0
        // fired when a purchase succeeds, iOS version.
        // also fired for each transaction when restoring transactions
        // Optionally: verify new product transaction online
        private void PurchaseSucceeded(StoreKitTransaction prod)
        {
            string id = GetIAPIdentifier(prod.productIdentifier);

            if ((verificationType == VerificationType.onPurchase || verificationType == VerificationType.both)
                && !string.IsNullOrEmpty(serverUrl))
            {
                MakeRequest(prod);
                return;
            }

            PurchaseVerified(id);
        }
Example #15
0
 void productPurchaseAwaitingConfirmationEvent(StoreKitTransaction transaction)
 {
     Debug.Log("productPurchaseAwaitingConfirmationEvent: " + transaction);
 }
Example #16
0
 void purchaseSuccessfulEvent(StoreKitTransaction transaction)
 {
     Debug.Log("purchaseSuccessfulEvent: " + transaction);
 }
Example #17
0
 // online verification request (iOS version)
 // here we build the POST request to our external server,
 // that will forward the request to Apple's servers
 private void MakeRequest(StoreKitTransaction prod)
 {
     Dictionary<string, string> dic = new Dictionary<string, string>();
     dic.Add("store", "IOS");
     dic.Add("pid", prod.productIdentifier);
     dic.Add("rec", prod.base64EncodedTransactionReceipt);
     StartCoroutine(WaitForRequest(dic));
 }