//-------------------------------------- // UM_iInAppClient //-------------------------------------- public void AddPayment(string productId) { var transactionsList = GetTransactionsList(); if (transactionsList.productIds.Contains(productId)) { UM_DialogsUtility.ShowMessage("Restored", "Product with id " + productId + " has been already purchased."); var transaction = new UM_EditorTransaction(productId, UM_TransactionState.Purchased); UpdateTransaction(transaction); return; } AddPendingTransaction(productId); UM_EditorAPIEmulator.WaitForNetwork(() => { UM_iTransaction transaction; if (productId.Equals(UM_InAppService.TEST_ITEM_UNAVAILABLE)) { transaction = new UM_EditorTransaction(productId, UM_TransactionState.Failed); } else { transaction = new UM_EditorTransaction(productId, UM_TransactionState.Purchased); } UpdateTransaction(transaction); }); }
public void RestoreCompletedTransactions() { if (UM_Settings.Instance.TestRestoreProducts.Count > 0) { foreach (var productsId in UM_Settings.Instance.TestRestoreProducts) { var product = GetProductById(productsId); if (product != null && product.Type == UM_ProductType.NonConsumable) { var transaction = new UM_EditorTransaction(product.Id, UM_TransactionState.Restored); UpdateTransaction(transaction); } } } else { foreach (var product in Products) { if (product.Type == UM_ProductType.NonConsumable) { var transaction = new UM_EditorTransaction(product.Id, UM_TransactionState.Restored); UpdateTransaction(transaction); } } } }
protected override void ObserveTransactions() { var transactionsList = GetTransactionsList(); foreach (var productId in transactionsList.productIds) { UM_EditorAPIEmulator.WaitForNetwork(() => { var transaction = new UM_EditorTransaction(productId, UM_TransactionState.Purchased); UpdateTransaction(transaction); }); } }
//-------------------------------------- // UM_iInAppClient //-------------------------------------- public void AddPayment(string productId) { UM_EditorAPIEmulator.WaitForNetwork(() => { UM_iTransaction transaction; if (productId.Equals(UM_InAppService.TEST_ITEM_UNAVAILABLE)) { transaction = new UM_EditorTransaction(productId, UM_TransactionState.Failed); } else { transaction = new UM_EditorTransaction(productId, UM_TransactionState.Purchased); } UpdateTransaction(transaction); }); }