Exemplo n.º 1
0
 /// <summary>
 /// This will be called when a purchase completes.
 /// </summary>
 private void onPurchased(PurchaseEvent e)
 {
     Debug.Log("Purchase OK: " + e.PurchasedItem.Id);
     Debug.Log(string.Format("{0} has now been purchased {1} times.",
                             e.PurchasedItem.name,
                             Unibiller.GetPurchaseCount(e.PurchasedItem)));
 }
Exemplo n.º 2
0
 public PurchaseViewModel(PurchaseEvent purchaseEvent)
 {
     Id        = purchaseEvent.Id;
     ProductId = purchaseEvent.ProductId;
     ClientId  = purchaseEvent.ClientId;
     Date      = purchaseEvent.EventDate;
 }
Exemplo n.º 3
0
        public void DeletePurchaseEvent()
        {
            int clientId  = clientService.GetLastlyAddedClient()._id;
            int productId = productService.GetLastlyAddedProduct()._id;

            PurchaseEvent e = new PurchaseEvent()
            {
                ClientId  = clientId,
                ProductId = productId,
                EventDate = DateTime.Now.ToLongDateString()
            };

            purchaseService.AddPurchaseEvent(e);

            PurchaseEvent last = purchaseService.GetLastClientPurchaseOfProduct(clientId, productId);

            if (last != null)
            {
                Assert.IsTrue(purchaseService.DeletePurchaseEvent(last.Id));

                foreach (var purchase in purchaseService.GetAllPurchases())
                {
                    Assert.AreNotEqual(purchase.Id, last.Id);
                }
            }
        }
Exemplo n.º 4
0
        public void FetchClientPurchases()
        {
            if (productService.GetAllProducts().Count > 0 && clientService.GetAllClients().Count > 0)
            {
                int clientId  = clientService.GetLastlyAddedClient()._id;
                int productId = productService.GetLastlyAddedProduct()._id;

                PurchaseEvent e = new PurchaseEvent()
                {
                    ClientId  = clientId,
                    ProductId = productId,
                    EventDate = DateTime.Now.ToLongDateString()
                };

                purchaseService.AddPurchaseEvent(e);

                foreach (var purchase in purchaseService.GetAllClientPurchases(clientId))
                {
                    Assert.AreEqual(purchase.ClientId, clientId);
                }

                PurchaseEvent last = purchaseService.GetMostRecentPurchase();

                Assert.AreEqual(last.ClientId, clientId);
                Assert.AreEqual(last.ProductId, productId);
            }
        }
Exemplo n.º 5
0
        public void AddReturn()
        {
            int clientId = clientService.GetLastlyAddedClient()._id;

            List <PurchaseEvent> purchases = purchaseService.GetAllClientPurchases(clientId);

            if (purchases.Count > 0)
            {
                PurchaseEvent purchaseEvent = purchases[purchases.Count - 1];

                ReturnEvent returnEvent = new ReturnEvent()
                {
                    ClientId  = purchaseEvent.ClientId,
                    ProductId = purchaseEvent.ProductId,
                    EventDate = DateTime.Now.ToLongDateString()
                };

                Assert.IsTrue(returnService.AddReturnEvent(returnEvent));

                foreach (var purchase in purchaseService.GetAllClientPurchases(clientId))
                {
                    Assert.AreNotEqual(purchase.Id, purchaseEvent.Id);
                }
            }
        }
Exemplo n.º 6
0
        public void GetMostRecentPurchaseEvent()
        {
            List <PurchaseEvent> evs = eventRepository.GetAllPurchaseEvents();

            PurchaseEvent recent = eventRepository.GetMostRecentPurchase();

            Assert.AreEqual(evs.Last().Id, recent.Id);
        }
Exemplo n.º 7
0
 private void onPurchased(PurchaseEvent e)
 {
     Debug.Log("Purchase OK: " + e.PurchasedItem.Id);
     Debug.Log ("Receipt: " + e.Receipt);
     Debug.Log(string.Format ("{0} has now been purchased {1} times.",
                              e.PurchasedItem.name,
                              Unibiller.GetPurchaseCount(e.PurchasedItem)));
 }
Exemplo n.º 8
0
 private void onSucceeded(PurchaseEvent e)
 {
     if (restoreInProgress)
     {
         // We don't send notifications of restorations.
         return;
     }
     onEvent(EventType.purchase_succeeded, e.PurchasedItem, e.Receipt);
 }
 void purchaseSuccessful( PurchaseEvent e )
 {
     if(e != null)
     {
         byte[] receipt =  GetBytes(e.Receipt);
         FuseLog(e.PurchasedItem.description + " " + e.PurchasedItem.localizedPriceString);
         FuseSDK.RegisterUnibillPurchase(e.PurchasedItem.Id, receipt);
     }
 }
Exemplo n.º 10
0
 void purchaseSuccessful(PurchaseEvent e)
 {
     if (e != null)
     {
         byte[] receipt = GetBytes(e.Receipt);
         FuseLog(e.PurchasedItem.description + " " + e.PurchasedItem.localizedPriceString);
         FuseSDK.RegisterUnibillPurchase(e.PurchasedItem.Id, receipt);
     }
 }
        public static void OnEvent(JAnalytics.Event e)
        {
            int type = e.getType();

            switch (type)
            {
            case JAnalytics.Event.BrowseEventType:
                BrowseEvent browseEven     = (BrowseEvent)e;
                string      browseId       = browseEven.getBrowseId();
                string      browseName     = browseEven.getBrowseName();
                string      browseType     = browseEven.getBrowseType();
                long        browseDuration = browseEven.getBrowseDuration();
                OnBrowseEvent(browseId, browseName, browseType, browseDuration,
                              browseEven.getExtraDic());
                break;

            case JAnalytics.Event.CalculateEventType:
                CalculateEvent calculateEvent = (CalculateEvent)e;
                string         eventId        = calculateEvent.getEventId();
                double         eventValues    = calculateEvent.getEventValued();
                OnCalculateEvent(eventId, eventValues,
                                 calculateEvent.getExtraDic());
                break;

            case JAnalytics.Event.CountEventType:
                CountEvent countEvent = (CountEvent)e;
                OnCountEvent(countEvent.getEventId(),
                             countEvent.getExtraDic());
                break;

            case JAnalytics.Event.LoginEventType:
                LoginEvent loginEvent = (LoginEvent)e;
                OnLoginEvent(loginEvent.getLoginMethod(), loginEvent.geLoginSuccess(),
                             loginEvent.getExtraDic());
                break;

            case JAnalytics.Event.PurchaseEventType:
                PurchaseEvent purchaseEvent         = (PurchaseEvent)e;
                string        purchaseGoodsid       = purchaseEvent.getPurchaseGoodsid();
                string        purchaseGoodsName     = purchaseEvent.getPurchaseGoodsName();
                double        purchasePrice         = purchaseEvent.getPurchasePrice();
                bool          purchaseSuccess       = purchaseEvent.getPurchaseSuccess();
                int           purchaseCurrencyUnity = purchaseEvent.getPurchaseCurrencyInt();
                string        purchaseGoodsType     = purchaseEvent.getPurchaseGoodsType();
                int           purchaseGoodsCount    = purchaseEvent.getPurchaseGoodsCount();
                OnPurchaseEvent(purchaseGoodsid, purchaseGoodsName, purchasePrice,
                                purchaseSuccess, purchaseCurrencyUnity, purchaseGoodsType, purchaseGoodsCount,
                                purchaseEvent.getExtraDic());
                break;

            case JAnalytics.Event.RegisterEventType:
                RegisterEvent registerEvent = (RegisterEvent)e;
                OnRegisterEvent(registerEvent.getRegisterMethod(), registerEvent.getRegisterSuccess(), registerEvent.getExtraDic());
                break;
            }
        }
Exemplo n.º 12
0
        public bool AddPurchaseEvent(PurchaseEvent ev)
        {
            if (ev == null || InvalidEventData(ev))
            {
                return(false);
            }

            purchaseRepository.AddPurchaseEvent(ev);
            return(true);
        }
Exemplo n.º 13
0
    private static void _onPurchaseComplete(PurchaseEvent e)
    {
        if (null != onPurchaseComplete)
        {
            onPurchaseComplete(e.PurchasedItem);
        }

        if (null != onPurchaseCompleteEvent)
        {
            onPurchaseCompleteEvent(e);
        }
    }
Exemplo n.º 14
0
        public void AddInvalidPurchase()
        {
            PurchaseEvent e = new PurchaseEvent()
            {
                ClientId  = 0,
                ProductId = 0,
                EventDate = DateTime.Now.ToLongDateString()
            };

            Assert.IsFalse(purchaseService.AddPurchaseEvent(e));
            Assert.IsFalse(purchaseService.AddPurchaseEvent(null));
        }
Exemplo n.º 15
0
        public void EventAdditionTest()
        {
            DataContext    context = new DataContext();
            DataRepository data    = new DataRepository(context);
            Logic          logic   = new Logic(data);

            Data.PurchaseEvent new_event = new PurchaseEvent(1, new Data.Customer("Jon", "Smith", 1), DateTime.Now, new Product("milk"), new State(20, true), 4);

            data.Add_Event(new_event);

            Assert.AreEqual(1, new_event.Get_ID());
        }
Exemplo n.º 16
0
        async Task Purchased(PurchaseEvent purchaseEvent)
        {
            IsBusy = false;

            if (purchaseEvent.Response.TransactionResult == TransactionResultTypes.Ok)
            {
                await MessageAsync("Success");
                await Navigation.PopAsync();
            }
            else
            {
                await ErrorTextAsync(purchaseEvent.Response.GetErrorMessage());
            }
        }
Exemplo n.º 17
0
        public void SendPurchase(PurchaseEvent purchase)
        {
            var serializedString = JsonConvert.SerializeObject(purchase);

            var data = new EventData(Encoding.UTF8.GetBytes(serializedString))
            {
                PartitionKey = purchase.ProductId.ToString()
            };

            // Set user properties if needed
            data.Properties.Add("Type", "Telemetry_" + DateTime.UtcNow.ToLongTimeString());

            _eventHubs.PurchaseClient.Send(data);
        }
Exemplo n.º 18
0
        public void ValidateReceiptAndReport(PurchaseEvent purchaseEvent)
        {
            PurchasableItem item = purchaseEvent.PurchasedItem;

            if (item != null)
            {
                try {
                    if (item.localizedPriceString == null)
                    {
                        Debug.LogError("item.localizedPriceString is null");
                    }
                    else
                    {
                        Debug.LogWarning(item.localizedPriceString);
                    }
                    string onlyNumbers = new System.String(item.localizedPriceString.Where(itemc => System.Char.IsDigit(itemc) || itemc == '.').ToArray());
                    string token       = null;
                    object jsonObject  = Json.Deserialize(purchaseEvent.Receipt);
                    if (jsonObject != null && jsonObject.GetType() == typeof(Dictionary <string, object>))
                    {
                        Dictionary <string, object> jsonDict = jsonObject as Dictionary <string, object>;
                        object innerJsonObject = null;
                        if (jsonDict.TryGetValue("json", out innerJsonObject))
                        {
                            if (innerJsonObject != null && innerJsonObject.GetType() == typeof(string))
                            {
                                object innerJsonDecodedObject = Json.Deserialize(innerJsonObject as string);
                                if (innerJsonDecodedObject != null && innerJsonDecodedObject.GetType() == typeof(Dictionary <string, object>))
                                {
                                    Dictionary <string, object> innerJsonDict = innerJsonDecodedObject as Dictionary <string, object>;
                                    object tokenObject = null;
                                    if (innerJsonDict.TryGetValue("purchaseToken", out tokenObject))
                                    {
                                        if (tokenObject != null && tokenObject.GetType() == typeof(string))
                                        {
                                            token = tokenObject as string;
                                        }
                                    }
                                }
                            }
                        }
                    }
                    ValidateReceiptAndReport(token, onlyNumbers, item.isoCurrencySymbol, item.Id);
                } catch (System.Exception e) {
                    Debug.LogException(e);
                }
            }
        }
Exemplo n.º 19
0
        public void LogPurchase(decimal itemPrice, string currency, bool purchaseSucceeded, string itemName, string itemType, string itemId, Dictionary <string, object> customAttributes = null)
        {
            var answersEvent = new PurchaseEvent();

            answersEvent.PutItemPrice(new BigDecimal(itemPrice.ToString(CultureInfo.InvariantCulture)));
            answersEvent.PutSuccess(purchaseSucceeded);
            answersEvent.PutItemName(itemName);
            answersEvent.PutItemType(itemType);
            answersEvent.PutItemId(itemId);
            answersEvent.PutCustomAttributes(customAttributes);
            if (currency != string.Empty)
            {
                answersEvent.PutCurrency(Currency.GetInstance(currency));
            }
            Bindings.AnswersKit.Answers.Instance.LogPurchase(answersEvent);
        }
Exemplo n.º 20
0
        public void BuyTest()
        {
            DataContext    context = new DataContext();
            DataRepository data    = new DataRepository(context);
            Logic          logic   = new Logic(data);

            Data.Customer new_customer = new Data.Customer("Jon", "Smith", 1);

            data.Add_Product("milk", 5);
            data.Add_State(100, true);

            PurchaseEvent new_event = new PurchaseEvent(1, new_customer, DateTime.Now, new Product("milk"), new State(100, true), 2);

            data.Add_Event(new_event);

            Assert.AreEqual(50, logic.Buy("milk", 10, 5));
        }
Exemplo n.º 21
0
        public void AddPurchaseEvent()
        {
            PurchaseEvent e = GetEvent();

            int initialCount = eventRepository.GetAllPurchaseEvents().Count;

            eventRepository.AddPurchaseEvent(e);
            int actualCount = eventRepository.GetAllPurchaseEvents().Count;

            PurchaseEvent addedEvent = eventRepository.GetPurchaseEventById(e.Id);

            Assert.AreEqual(addedEvent.Id, e.Id);
            Assert.AreEqual(addedEvent.ClientId, e.ClientId);
            Assert.AreEqual(addedEvent.ProductId, e.ProductId);

            Assert.AreEqual(initialCount, actualCount - 1);
        }
Exemplo n.º 22
0
        public void AddPurchase()
        {
            if (productService.GetAllProducts().Count > 0 && clientService.GetAllClients().Count > 0)
            {
                int clientId  = clientService.GetLastlyAddedClient()._id;
                int productId = productService.GetLastlyAddedProduct()._id;

                PurchaseEvent e = new PurchaseEvent()
                {
                    ClientId  = clientId,
                    ProductId = productId,
                    EventDate = DateTime.Now.ToLongDateString()
                };

                Assert.IsTrue(purchaseService.AddPurchaseEvent(e));
            }
        }
Exemplo n.º 23
0
        public bool AddReturnEvent(ReturnEvent ev)
        {
            if (ev == null || InvalidEventData(ev))
            {
                return(false);
            }

            PurchaseEvent recentPurchase = GetClientRecentPurchaseOfSuchProduct(ev);

            if (recentPurchase == null)
            {
                return(false);
            }

            returnRepository.AddReturnEvent(ev);
            purchaseRepository.DeletePurchaseEvent(recentPurchase.Id);
            return(true);
        }
Exemplo n.º 24
0
    /// <summary>
    /// This will be called when a purchase completes.
    /// </summary>
    private void onPurchased(PurchaseEvent e)
    {
        Debug.Log("Purchase OK: " + e.PurchasedItem.Id);
        Debug.Log("Receipt: " + e.Receipt);
        Debug.Log(string.Format("{0} has now been purchased {1} times.",
                                e.PurchasedItem.name, Unibiller.GetPurchaseCount(e.PurchasedItem)));


        try
        {
#if UNITY_ANDROID
            var jsonNode = JSON.Parse(e.Receipt);
            jsonNode = JSON.Parse(jsonNode[0].Value);

            string purchaseState = jsonNode["purchaseState"].Value;
            string productId     = jsonNode["productId"].Value;
            string purchaseToken = jsonNode["purchaseToken"].Value;

            if (purchaseState == "0")
            {
                if (OnResponseUniBill != null)
                {
                    OnResponseUniBill.Invoke(productId, purchaseToken);
                    OnResponseUniBill -= OnResponseUniBill;
                }
            }
#elif UNITY_IOS
            if (OnResponseUniBill != null)
            {
                OnResponseUniBill.Invoke(e.PurchasedItem.Id, e.Receipt);
                OnResponseUniBill -= OnResponseUniBill;
            }
#endif
        }
        catch
        {
            if (OnResponseUniBill != null)
            {
                OnResponseUniBill.Invoke("", "");
                OnResponseUniBill -= OnResponseUniBill;
            }
        }
    }
Exemplo n.º 25
0
        public void PurchaseCopyTest()
        {
            repo        = new DataRepository(new ContextFiller());
            dataService = new DataService(repo);

            DateTimeOffset testDate = new DateTimeOffset(2019, 10, 19, 22, 0, 0, new TimeSpan(2, 0, 0));

            bool PurchaseEventRised = false;

            dataService.PurchaseHappened += PurchaseEventMethod;
            void PurchaseEventMethod(object sender, EventArgs e)
            {
                if (PurchaseEventRised == true)
                {
                    Assert.Fail("Event rised multiple times");
                }
                else
                {
                    PurchaseEventRised = true;
                }
            }

            Assert.AreEqual(false, repo.ContainsCopy(101));

            dataService.PurchaseCopy(101, 1, CopyCondition.Mint, testDate, "TestDistrib");

            PurchaseEvent purchaseEvent = (PurchaseEvent)repo.GetAllEvents().Last();

            Assert.AreEqual(true, PurchaseEventRised);

            Assert.AreEqual(true, repo.ContainsCopy(101));
            Assert.AreEqual(CopyCondition.Mint, repo.GetCopy(101).Condition);
            Assert.AreEqual(repo.GetBook(1), repo.GetCopy(101).Book);
            Assert.AreEqual("Wydra", repo.GetCopy(101).Book.Title);
            Assert.AreEqual("Jan Lasica", repo.GetCopy(101).Book.Author);

            Assert.AreEqual(101, purchaseEvent.Copy.CopyId);
            Assert.AreEqual(repo.GetCopy(101), purchaseEvent.Copy);
            Assert.AreEqual("TestDistrib", purchaseEvent.Distributor);
            Assert.AreEqual(testDate, purchaseEvent.EventDate);
        }
        public ActionResult Buy(int id)
        {
            var customer  = _customerRepository.GetCustomerByName(User.Identity.Name);
            var product   = _productsRepository.GetProduct(id);
            var promotion = _promotionsRepository.GetPromotion(customer.CustomerId, product.Id);

            var purchaseEvent = new PurchaseEvent
            {
                CustomerId   = customer.CustomerId,
                ProductId    = id,
                Price        = promotion != null ? promotion.NewPrice : product.Price,
                PurchaseTime = DateTime.Now,
                OrderId      = Guid.NewGuid()
            };

            _telemetryRepository.SendPurchase(purchaseEvent);

            Thread.Sleep(TimeSpan.FromSeconds(5));

            return(new HttpStatusCodeResult(HttpStatusCode.OK));
        }
Exemplo n.º 27
0
    void Awake()
    {
        DontDestroyOnLoad(this.gameObject);

        onInitializeSuccess = new UnityEvent();
        onInitializeFailed  = new UnityEvent();

        onPurchaseSuccess = new PurchaseEvent();
        onPurchaseFailed  = new PurchaseEvent();

        _builder = new AppcoinsConfigurationBuilder();

        _appcoinsPurchasing = gameObject.AddComponent <AppcoinsPurchasing>();

        _versionReporter = gameObject.AddComponent <BDSVersionReporter>();
        if (_versionReporter == null)
        {
            //Debug.LogError("Failed initializing! Plugin prefab is missing BDS VersionReporter. Please use the unmodified version of the prefab.");
            Debug.LogError("Failed initializing! Plugin prefab is missing BDS VersionReporter. Please use the unmodified version of the prefab.");
            return;
        }
    }
Exemplo n.º 28
0
 private void onCancelled(PurchaseEvent e)
 {
     onEvent(EventType.purchase_cancelled, e.PurchasedItem, null);
 }
Exemplo n.º 29
0
 private bool InvalidEventData(PurchaseEvent ev)
 {
     return(PurchaseExists(ev.Id) || !ClientExists(ev.ClientId) || !ProductExists(ev.ProductId));
 }
Exemplo n.º 30
0
 void OnPurchased(PurchaseEvent e)      //购买成功
 {
     GlobalVars.PurchaseSuc = true;
 }
    void purchaseSuccessful(PurchaseEvent e)
    {
        if (e != null)
        {
            //The Recipt is a json with the contents we need to pass in, parse it here
            JSONObject jObj   = new JSONObject(e.Receipt);
            JSONObject json   = new JSONObject(jObj.GetField("json").ToString().Replace("\\\"", "\"").Trim('"'));
            JSONObject sig    = jObj.GetField("signature");
            string     sigstr = sig.ToString();


            FuseLog("json = " + json.Print(true));
            FuseLog("sig = " + sigstr);

            int    purchaseState = 0;
            string purchaseToken = "";
            string productId     = "";
            string orderId       = "";
            double purchaseTime  = 0;

            json.GetField(ref purchaseState, "purchaseState");
            json.GetField(ref purchaseToken, "purchaseToken");
            json.GetField(ref orderId, "orderId");
            json.GetField(ref productId, "productId");
            json.GetField(ref purchaseTime, "purchaseTime");

            double price = 0;
            try
            {
                price = double.Parse(e.PurchasedItem.localizedPriceString, NumberStyles.Currency);
            }
            catch
            {
                var re    = new System.Text.RegularExpressions.Regex(@"\D*(?<num>[\d\s\.,]+?)(?<dec>([\.,]\s*\d?\d?)?)\D*$");
                var match = re.Match(e.PurchasedItem.localizedPriceString);
                if (match.Success)
                {
                    string stripped = "";
                    try
                    {
                        var dec = System.Text.RegularExpressions.Regex.Replace(match.Groups["dec"].Value, @"\s", "");
                        stripped = System.Text.RegularExpressions.Regex.Replace(match.Groups["num"].Value, @"[^\d]", "") + dec;
                        price    = double.Parse(stripped, NumberStyles.Currency);

                        //Just in case the culture info is broken and double.Parse can't parse the decimal part properly
                        if (price % 1 == 0 && dec.Length > 1)
                        {
                            price /= 100;
                        }
                    }
                    catch
                    {
                        Debug.LogError("Fuse Unibill Tracking: Error parsing " + e.PurchasedItem.localizedPriceString + " >> Unable to parse " + stripped);
                    }
                }
                else
                {
                    Debug.LogError("Fuse Unibill Tracking: Error parsing " + e.PurchasedItem.localizedPriceString + " >> String did not match regex");
                }
            }

            FuseSDK.RegisterAndroidInAppPurchase((FuseMisc.IAPState)purchaseState, purchaseToken,
                                                 productId, orderId, (long)purchaseTime,
                                                 sigstr, price, null);
        }
    }
    void purchaseSuccessful( PurchaseEvent e )
    {
        if(e != null)
        {
            //The Recipt is a json with the contents we need to pass in, parse it here
            JSONObject jObj = new JSONObject(e.Receipt);
            JSONObject json = new JSONObject(jObj.GetField("json").ToString().Replace("\\\"","\"").Trim('"'));
            JSONObject sig = jObj.GetField("signature");
            string sigstr = sig.ToString();

            FuseLog("json = " + json.Print(true));
            FuseLog("sig = " + sigstr);

            int purchaseState = 0;
            string purchaseToken = "";
            string productId = "";
            string orderId = "";
            double purchaseTime = 0;

            json.GetField(ref purchaseState,"purchaseState");
            json.GetField(ref purchaseToken,"purchaseToken");
            json.GetField(ref orderId,"orderId");
            json.GetField(ref productId,"productId");
            json.GetField(ref purchaseTime,"purchaseTime");

            double price = 0;
            try
            {
                price = double.Parse(e.PurchasedItem.localizedPriceString, NumberStyles.Currency);
            }
            catch
            {
                var re = new System.Text.RegularExpressions.Regex(@"\D*(?<num>[\d\s\.,]+?)(?<dec>([\.,]\s*\d?\d?)?)\D*$");
                var match = re.Match(e.PurchasedItem.localizedPriceString);
                if(match.Success)
                {
                    string stripped = "";
                    try
                    {
                        var dec = System.Text.RegularExpressions.Regex.Replace(match.Groups["dec"].Value, @"\s", "");
                        stripped = System.Text.RegularExpressions.Regex.Replace(match.Groups["num"].Value, @"[^\d]", "") + dec;
                        price = double.Parse(stripped, NumberStyles.Currency);

                        //Just in case the culture info is broken and double.Parse can't parse the decimal part properly
                        if(price % 1 == 0 && dec.Length > 1)
                        {
                            price /= 100;
                        }
                    }
                    catch
                    {
                        Debug.LogError("Fuse Unibill Tracking: Error parsing " + e.PurchasedItem.localizedPriceString + " >> Unable to parse " + stripped);
                    }
                }
                else
                {
                    Debug.LogError("Fuse Unibill Tracking: Error parsing " + e.PurchasedItem.localizedPriceString + " >> String did not match regex");
                }
            }

            FuseSDK.RegisterAndroidInAppPurchase((FuseMisc.IAPState)purchaseState,purchaseToken,
                                          productId, orderId, (long)purchaseTime,
                                          sigstr, price , null);

        }
    }
Exemplo n.º 33
0
 private void onCancelled(PurchaseEvent e)
 {
     onEvent (EventType.purchase_cancelled, e.PurchasedItem, null);
 }
Exemplo n.º 34
0
 void OnPurchased(PurchaseEvent e)      //购买成功
 {
     GlobalVars.PurchaseSuc = true;
 }
Exemplo n.º 35
0
    private static void _onPurchaseComplete(PurchaseEvent e)
    {
        if (null != onPurchaseComplete) {
            onPurchaseComplete (e.PurchasedItem);
        }

        if (null != onPurchaseCompleteEvent) {
            onPurchaseCompleteEvent (e);
        }
    }
Exemplo n.º 36
0
 private void onSucceeded(PurchaseEvent e)
 {
     if (restoreInProgress) {
         // We don't send notifications of restorations.
         return;
     }
     onEvent (EventType.purchase_succeeded, e.PurchasedItem, e.Receipt);
 }
Exemplo n.º 37
0
        public void GetPurchaseEventsByProductId()
        {
            PurchaseEvent ev = GetEvent();

            Assert.IsTrue(eventRepository.GetPurchaseEventsByProductId(ev.ProductId).Count >= 1);
        }