Пример #1
0
        protected override NameValueCollection Values()
        {
            var collection = new NameValueCollection {
                { "format", "json" },
                { "username", Credentials.Username },
                { "password", Credentials.Password },
                { "set_user", Username }
            };

            if (Password != null)
            {
                collection.Add("pass", Password);
            }
            if (PasswordApi != null)
            {
                collection.Add("pass_api", PasswordApi);
            }
            if (Limit >= 0)
            {
                collection.Add("limit", Limit.ToString());
            }
            if (MonthLimit >= 0)
            {
                collection.Add("month_limit", MonthLimit.ToString());
            }
            if (Senders >= 0)
            {
                collection.Add("senders", Senders.ToString());
            }
            if (Phonebook >= 0)
            {
                collection.Add("phonebook", Phonebook.ToString());
            }
            if (Active >= 0)
            {
                collection.Add("active", Active > 0 ? "1" : "0");
            }
            if (Info != null)
            {
                collection.Add("info", Info);
            }
            if (WithoutPrefix)
            {
                collection.Add("without_prefix", "1");
            }

            return(collection);
        }
        protected override void BuildXmlBody(XmlRequestBuilder xmlRequestBuilder)
        {
            if (null == xmlRequestBuilder)
            {
                throw new ArgumentNullException(nameof(xmlRequestBuilder));
            }

            xmlRequestBuilder.WriteElement("lmi_payee_purse", StorePurse.ToString());
            xmlRequestBuilder.WriteElement("lmi_day_limit", DayLimit.ToString());
            xmlRequestBuilder.WriteElement("lmi_week_limit", WeekLimit.ToString());
            xmlRequestBuilder.WriteElement("lmi_month_limit", MonthLimit.ToString());
            xmlRequestBuilder.WriteElement("lmi_clientnumber", GetClientId());
            xmlRequestBuilder.WriteElement("lmi_clientnumber_type", ((int)ClientIdType).ToString(CultureInfo.InvariantCulture));
            xmlRequestBuilder.WriteElement("lmi_sms_type", ((int)ConfirmationType).ToString(CultureInfo.InvariantCulture));
            xmlRequestBuilder.WriteElement("lang", Culture.Name);
        }