Exemple #1
0
 public override System.Collections.Generic.IEnumerator <byte> OnTransaction(string eventName, string productId, decimal price, string currency, string receipt, string signature)
 {
                 #if APPSFLYER_ANALYTICS_API
     AppsFlyer.setCurrencyCode(currency);
     AppsFlyer.trackRichEvent(AFInAppEvents.PURCHASE, new Dictionary <string, string>()
     {
         { AFInAppEvents.CURRENCY, currency },
         { AFInAppEvents.REVENUE, price.ToString() },
         { AFInAppEvents.QUANTITY, "1" },
         { AFInAppEvents.CONTENT_ID, productId },
         { "Event", eventName },
         { "CustomParameter", User.instance.customParameter },
     });
                 #endif
     yield return(0);
 }
 public static bool TrackPurchase(Product product, VerifyResponse response, GlobalVars.PurchaseType purchaseType, string receipt, Purchase purchase)
 {
     lock (AnalyticsManager.lockObj)
     {
         string id       = (string)product.id;
         string currency = (string)product.currency;
         double price    = (double)product.price;
         if (!AnalyticsManager.Validate(id) || !AnalyticsManager.Validate(currency) || price <= 0.0)
         {
             return(false);
         }
         string eventName;
         // ISSUE: explicit reference operation
         // ISSUE: cast to a reference type
         // ISSUE: explicit reference operation
         if ((^ (GACCTError&)@ ((Allocator <MetaVerify, Verify>)response).get_Meta().error).isError == null)
         {
             if (!PlayerPrefs.HasKey("FIRST_PURCHASE"))
             {
                 PlayerPrefs.SetInt("FIRST_PURCHASE", 1);
                 AnalyticsManager.RecordCustomEvent("user.paying.first", (Dictionary <string, object>)null);
                 AnalyticsManager.RecordCustomEvent("revenue.paying.first", (Dictionary <string, object>)null);
             }
             AnalyticsManager.TrackCurrencyObtain(AnalyticsManager.CurrencyType.Gem, AnalyticsManager.CurrencySubType.PAID, (long)((Allocator <MetaVerify, Verify>)response).get_Meta().AdditionalPaidCoin, "IAP Purchase", (Dictionary <string, object>)null);
             AnalyticsManager.TrackCurrencyObtain(AnalyticsManager.CurrencyType.Gem, AnalyticsManager.CurrencySubType.FREE, (long)((Allocator <MetaVerify, Verify>)response).get_Meta().AdditionalFreeCoin, "IAP Purchase", (Dictionary <string, object>)null);
             AppsFlyer.setCurrencyCode("USD");
             AppsFlyer.trackRichEvent(nameof(purchase), new Dictionary <string, string>()
             {
                 {
                     "product_id",
                     id
                 },
                 {
                     "af_currency",
                     (string)product.currency
                 },
                 {
                     "af_revenue",
                     price.ToString()
                 }
             });
             string inAppPurchaseData = "{\"orderID\":" + (object)purchase.orderId + "\",\"packageName\":\" " + AnalyticsManager.mBundleID + "\",\"productId\":\"" + id + "\",\"purchaseTime\":" + (object)Network.GetServerTime() + ",\"purchaseState\":0,\"developerPayload\":\"paymentPayload\",\"purchaseToken\":\"" + (object)purchase.data + "\"}";
             Upsight.recordGooglePlayPurchase(1, currency, price, price, id, 0, inAppPurchaseData, receipt, (Dictionary <string, object>)null);
             eventName = "purchase.success.";
         }