public IParseble Parse(JSONNode pricepointsNode)
        {
            var listNode = pricepointsNode ["list"];
            var pricepointsEnumerator = listNode.Childs.GetEnumerator();

            while (pricepointsEnumerator.MoveNext())
            {
                AddItem(new XsollaPricepoint().Parse(pricepointsEnumerator.Current) as XsollaPricepoint);
            }

            JSONNode formParamsNode = pricepointsNode ["formParams"];

            formParams = new Dictionary <string, object> (formParamsNode.Count);
            IEnumerator <JSONNode> formParamsEnumerator = formParamsNode.Childs.GetEnumerator();

            while (formParamsEnumerator.MoveNext())
            {
                JSONNode current = formParamsEnumerator.Current;
                formParams.Add(current["name"], current["value"]);
            }

            projectCurrency = pricepointsNode ["projectCurrency"];

            api = new XsollaApi().Parse(pricepointsNode [XsollaApiConst.R_API]) as XsollaApi;

            return(this);
        }
 public IParseble Parse(JSONNode rootNode)
 {
     mFinance          = new XsollaItemFinance().Parse(rootNode["finance"]) as XsollaItemFinance;
     mPurchase         = new XsollaItemPurchase().Parse(rootNode["purchase"]) as XsollaItemPurchase;
     mSkipConfirmation = rootNode["skip_confirmation"].AsBool;
     mApi = new XsollaApi().Parse(rootNode["api"]) as XsollaApi;
     return(this);
 }
        public IParseble Parse(JSONNode rootNode)
        {
            _couponCode  = rootNode["coupon_code"];
            _operationId = rootNode["operation_id"].AsInt;
            JSONNode node = rootNode["errors"].AsArray[0];

            _error = node["message"];
            _api   = new XsollaApi().Parse(rootNode[XsollaApiConst.R_API]) as XsollaApi;
            return(this);
        }
예제 #4
0
        public IParseble Parse(JSONNode utilsNode)
        {
            user         = new XsollaUser().Parse(utilsNode [XsollaApiConst.R_USER]) as XsollaUser;
            project      = new XsollaProject().Parse(utilsNode [XsollaApiConst.R_PROJECT]) as XsollaProject;
            purchase     = new XsollaPurchase().Parse(utilsNode [XsollaApiConst.R_PURCHASE]) as XsollaPurchase;
            settings     = new XsollaSettings().Parse(utilsNode [XsollaApiConst.R_SETTINGS]) as XsollaSettings;
            translations = new XsollaTranslations().Parse(utilsNode [XsollaApiConst.R_TRANSLATIONS]) as XsollaTranslations;
            api          = new XsollaApi().Parse(utilsNode [XsollaApiConst.R_API]) as XsollaApi;

            return(this);
        }
        public IParseble Parse(JSONNode paymentListNode)
        {
            IEnumerator <JSONNode> paymentListEnumerator = paymentListNode["list"].Childs.GetEnumerator();

            while (paymentListEnumerator.MoveNext())
            {
                XsollaSavedPaymentMethod method = new XsollaSavedPaymentMethod().Parse(paymentListEnumerator.Current) as XsollaSavedPaymentMethod;
                AddItem(method);
            }
            api = new XsollaApi().Parse(paymentListNode["api"]) as XsollaApi;
            return(this);
        }
예제 #6
0
        public IParseble Parse(SimpleJSON.JSONNode rootNode)
        {
            api = new XsollaApi().Parse(rootNode["api"]) as XsollaApi;

            var enumerator = rootNode.Childs.GetEnumerator();

            while (enumerator.MoveNext())
            {
                AddItem(new XsollaManagerSubscription().Parse(enumerator.Current) as XsollaManagerSubscription);
            }

            return(this);
        }
예제 #7
0
        public IParseble Parse(JSONNode utilsNode)
        {
            accessToken  = utilsNode [XsollaApiConst.ACCESS_TOKEN].Value;
            user         = new XsollaUser().Parse(utilsNode [XsollaApiConst.R_USER]) as XsollaUser;
            project      = new XsollaProject().Parse(utilsNode [XsollaApiConst.R_PROJECT]) as XsollaProject;
            purchase     = new XsollaPurchase().Parse(utilsNode [XsollaApiConst.R_PURCHASE]) as XsollaPurchase;
            settings     = new XsollaSettings().Parse(utilsNode [XsollaApiConst.R_SETTINGS]) as XsollaSettings;
            translations = new XsollaTranslations().Parse(utilsNode [XsollaApiConst.R_TRANSLATIONS]) as XsollaTranslations;
            api          = new XsollaApi().Parse(utilsNode [XsollaApiConst.R_API]) as XsollaApi;
            mBonus       = new XsollaBonus().Parse(utilsNode["bonus"]) as XsollaBonus;

            return(this);
        }
        public IParseble Parse(JSONNode quickPaymentsNode)
        {
            //var paymentListEnumerator =  quickPaymentsNode["instances"].Childs.GetEnumerator();
            var paymentListEnumerator = quickPaymentsNode["quick_instances"].Childs.GetEnumerator();

            while (paymentListEnumerator.MoveNext())
            {
                var method = new XsollaPaymentMethod().Parse(paymentListEnumerator.Current) as XsollaPaymentMethod;
                if (method.id != 64 && method.id != 1738)
                {
                    AddItem(method);
                }
            }
            api = new XsollaApi().Parse(quickPaymentsNode[XsollaApiConst.R_API]) as XsollaApi;
            return(this);
        }
예제 #9
0
        public IParseble Parse(JSONNode subscriptionsNode)
        {
            var packagesNode = subscriptionsNode ["packages"];
            var enumerator   = packagesNode.Childs.GetEnumerator();

            while (enumerator.MoveNext())
            {
                AddItem(new XsollaSubscription().Parse(enumerator.Current) as XsollaSubscription);
            }

            if (subscriptionsNode["active_user_package"].AsObject != null)
            {
                activeUserPackage = new XsollaActivePackage().Parse(subscriptionsNode["active_user_package"]) as XsollaActivePackage;
            }

            api = new XsollaApi().Parse(subscriptionsNode["api"]) as XsollaApi;
            return(this);
        }
예제 #10
0
        public IParseble Parse(SimpleJSON.JSONNode rootNode)
        {
            mApi = new XsollaApi().Parse(rootNode["api"]) as XsollaApi;

            mCharges = new List <XsollaSubDetailCharge>();
            var listCharges = rootNode["charges"].Childs.GetEnumerator();

            while (listCharges.MoveNext())
            {
                mCharges.Add(new XsollaSubDetailCharge().Parse(listCharges.Current) as XsollaSubDetailCharge);
            }

            JSONNode subsNode = rootNode["subscription"];

            mCharge               = new XsollaSubCharge().Parse(subsNode["charge"]) as XsollaSubCharge;
            mDateCreate           = DateTime.Parse(subsNode["date_create"].Value);
            mDateNextCharge       = DateTime.Parse(subsNode["date_next_charge"].Value);
            mDesc                 = subsNode["description"].Value;
            mHoldDates            = new XsollaSubHoldDates().Parse(subsNode["hold_dates"]) as XsollaSubHoldDates;
            mId                   = subsNode["id"].AsInt;
            mIdExternal           = subsNode["id_external"].Value;
            mIsCancelPossible     = subsNode["is_cancel_possible"].AsBool;
            mIsChangePlanAllowed  = subsNode["is_change_plan_allowed"].AsBool;
            mIsHoldPossible       = subsNode["is_hold_possible"].AsBool;
            mIsRenewPossible      = subsNode["is_renew_possible"].AsBool;
            mIsSheduledHoldExist  = subsNode["is_scheduled_hold_exist"].AsBool;
            mLimitHoldPeriod      = new XsollaSubLimitHoldPeriod().Parse(subsNode["limit_hold_period"]) as XsollaSubLimitHoldPeriod;
            mName                 = subsNode["name"].Value;
            mNextCharge           = new XsollaSubCharge().Parse(subsNode["next_charge"]) as XsollaSubCharge;
            mNextPeriodPlanChange = new XsollaSubNextPeriodPlanChange().Parse(subsNode["next_period_plan_change"]) as XsollaSubNextPeriodPlanChange;
            mPaymentAccount       = new XsollaSubDetailPaymentAcc().Parse(subsNode["payment_account"]) as XsollaSubDetailPaymentAcc;
            mPaymentIcoSrc        = subsNode["payment_icon_src"].Value;
            mPaymentMethodName    = subsNode["payment_method"].Value;
            mPaymentMethodType    = subsNode["payment_type"].Value;
            mPaymentMethodVisName = subsNode["payment_visible_name"].Value;
            mPeriod               = new XsollaSubDetailPeriod().Parse(subsNode["period"]) as XsollaSubDetailPeriod;
            mSheduledHoldDates    = new XsollaSubHoldDates().Parse(subsNode["scheduled_hold_dates"]) as XsollaSubHoldDates;
            mStatus               = subsNode["status"].Value;

            return(this);
        }
        public IParseble Parse(JSONNode paymentListNode)
        {
            // fetch all quick methods
            IEnumerator <JSONNode> paymentListEnumerator = paymentListNode["quick_instances"].Childs.GetEnumerator();

            while (paymentListEnumerator.MoveNext())
            {
                XsollaPaymentMethod method = new XsollaPaymentMethod().Parse(paymentListEnumerator.Current) as XsollaPaymentMethod;
                // if count quick methods 3 then add to regular
                if (this.GetCount() <= 2)
                {
                    method.SetType(XsollaPaymentMethod.TypePayment.QUICK);
                }
                else
                {
                    method.SetType(XsollaPaymentMethod.TypePayment.REGULAR);
                }

                if (method.id != 64 && method.id != 1738)
                {
                    AddItem(method);
                }
            }

            // fetch all regular methods
            paymentListEnumerator = paymentListNode["regular_instances"].Childs.GetEnumerator();
            while (paymentListEnumerator.MoveNext())
            {
                XsollaPaymentMethod method = new XsollaPaymentMethod().Parse(paymentListEnumerator.Current) as XsollaPaymentMethod;
                method.SetType(XsollaPaymentMethod.TypePayment.REGULAR);
                if (method.id != 64 && method.id != 1738)
                {
                    AddItem(method);
                }
            }

            lastPayment = null;
            api         = new XsollaApi().Parse(paymentListNode["api"]) as XsollaApi;
            return(this);
        }