Ejemplo n.º 1
0
        private void TrackSubscription()
        {
            var price         = Command.GetFirstParameterValue("revenue");
            var currency      = Command.GetFirstParameterValue("currency");
            var sku           = Command.GetFirstParameterValue("productId");
            var signature     = Command.GetFirstParameterValue("receipt");
            var purchaseToken = Command.GetFirstParameterValue("purchaseToken");
            var orderId       = Command.GetFirstParameterValue("transactionId");
            var purchaseTime  = Command.GetFirstParameterValue("transactionDate");

            AdjustPlayStoreSubscription subscription = new AdjustPlayStoreSubscription(
                long.Parse(price),
                currency,
                sku,
                orderId,
                signature,
                purchaseToken);

            subscription.SetPurchaseTime(long.Parse(purchaseTime));

            if (Command.ContainsParameter("callbackParams"))
            {
                var callbackParams = Command.Parameters["callbackParams"];
                for (var i = 0; i < callbackParams.Count; i = i + 2)
                {
                    var key   = callbackParams[i];
                    var value = callbackParams[i + 1];
                    subscription.AddCallbackParameter(key, value);
                }
            }

            if (Command.ContainsParameter("partnerParams"))
            {
                var partnerParams = Command.Parameters["partnerParams"];
                for (var i = 0; i < partnerParams.Count; i = i + 2)
                {
                    var key   = partnerParams[i];
                    var value = partnerParams[i + 1];
                    subscription.AddPartnerParameter(key, value);
                }
            }

            Adjust.TrackPlayStoreSubscription(subscription);
        }