void consumePurchaseSucceededEvent(BazaarPurchase purchase) { Debug.Log("cafebazaar: consumePurchaseSucceededEvent: " + purchase); UpdateConsumedList(ConvertToBillingPurches(purchase)); setBillingProgress(BillingProgress.DONE); }
BillingPurchase ConvertToBillingPurches(BazaarPurchase purch) { BillingPurchase itemPurched = new BillingPurchase(); itemPurched.ProductId = purch.ProductId; itemPurched.OrderId = purch.OrderId; itemPurched.DeveloperPayload = purch.DeveloperPayload; itemPurched.PackageName = purch.PackageName; itemPurched.Type = purch.Type; itemPurched.PurchaseTime = purch.PurchaseTime; itemPurched.PurchaseToken = purch.PurchaseToken; switch (purch.PurchaseState) { case BazaarPurchase.BazaarPurchaseState.Purchased: itemPurched.PurchaseState = BillingPurchase.BillingPurchaseState.Purchased; break; case BazaarPurchase.BazaarPurchaseState.Canceled: itemPurched.PurchaseState = BillingPurchase.BillingPurchaseState.Canceled; break; case BazaarPurchase.BazaarPurchaseState.Refunded: itemPurched.PurchaseState = BillingPurchase.BillingPurchaseState.Refunded; break; } itemPurched.Signature = purch.Signature; itemPurched.OriginalJson = purch.OriginalJson; return(itemPurched); }
void purchaseSucceededEvent(BazaarPurchase purchase) { Debug.Log("cafebazaar: purchaseSucceededEvent: " + purchase); LoadingBarActive(true); if (string.IsNullOrEmpty(InProgressDeveloperPayload)) { if (string.IsNullOrEmpty(purchase.DeveloperPayload)) { UpdatePurchasedList(purchase); } else { Debug.LogError("purchase ignore, developerPayload must be null or empty!"); } } else { if (InProgressDeveloperPayload == purchase.DeveloperPayload) { UpdatePurchasedList(purchase); } else { Debug.LogError(string.Format("purchase ignore, developerPayload must be:{0} null or empty!", InProgressDeveloperPayload)); } } }
private void ConsumePurchaseSucceededEventHandler(BazaarPurchase purchase) { if (null != OnConsumeSucceeded) { OnConsumeSucceeded(this, new PurchaseEventArgs( purchase.DeveloperPayload , purchase.PackageName , purchase.ProductId , purchase.PurchaseToken , ConvertProductType(purchase.Type) )); } }
void UpdatePurchasedList(BazaarPurchase newPurched) { BillingPurchase beforePurched = purchasedList.Find(purched => { if (purched.OrderId == newPurched.OrderId && purched.ProductId == newPurched.ProductId && //sku purched.PurchaseToken == newPurched.PurchaseToken && purched.Signature == newPurched.Signature) { return(true); } return(false); }); if (beforePurched == null) { BillingPurchase itemPurched = ConvertToBillingPurches(newPurched); purchasedList.Add(itemPurched); Debug.Log("new purched added to list:" + newPurched.ToString()); } else { Debug.Log("new purched ignore because already exist in list:" + newPurched.ToString()); } }
private void purchaseSucceededEvent(BazaarPurchase purchase) { BazaarIAB.consumeProduct(products[productIndex].Id); PlayerPrefs.SetInt("Coin", PlayerPrefs.GetInt("Coin") + products[productIndex].Coin); CoinTxt.text = PlayerPrefs.GetInt("Coin").ToString(); }
private void NewMethod(BazaarPurchase BP) { Debug.Log(BP.ProductId); }
void consumePurchaseSucceededEvent(BazaarPurchase purchase) { Debug.Log("consumePurchaseSucceededEvent: " + purchase); }
void purchaseSucceededEvent(BazaarPurchase purchase) { Debug.Log("purchaseSucceededEvent: " + purchase); }
private void OnPurchased(BazaarPurchase obj) { string productId = obj.ProductId; OnPurchase(productId, true); }