Ejemplo n.º 1
0
        private void GetTicket_Click(object sender, EventArgs e)
        {
            try
            {
                richTextBox1.Clear();

                var NMP = Helper.Proxy();

                if (NMP.Length > 0)
                {
                    var proxyClient = HttpProxyClient.Parse(NMP);
                    req.Proxy = proxyClient;
                }

                req.AddHeader("Accept", "application/json");
                req.AddHeader(Name, "application/json");
                req.AddHeader("Authorization", string.Format("Bearer {0}", Helper.token(MyStrings.AutoLogin, Form1.token)));
                string text = req.Get("https://edge.qiwi.com/payment-history/v2/persons/" + PNum.Text + "/payments?rows=10", null).ToString();
                req.Close();

                myjs.RootObject newQiwi = JsonConvert.DeserializeObject <myjs.RootObject>(text);

                richTextBox1.Text = "<Чеки>" + Environment.NewLine;
                foreach (var ck in newQiwi.data)
                {
                    richTextBox1.Text += "ID операции:" + ck.trmTxnId + "\r\nСтатус:" + ck.statusText + "\r\nСумма:" + ck.sum.amount + " " + ck.sum.MSC() + "\r\nТип: " + ck.MS() + ck.mcomment() + "\r\n----------------------" + Environment.NewLine;
                }
            }
            catch (Exception ex)
            {
                File.WriteAllText(MyStrings.MFolder + "Log " + DateTime.Now + ".txt", ex.ToString());
            }
        }
Ejemplo n.º 2
0
        private void SaveTicket_Click(object sender, EventArgs e)
        {
            try
            {
                string cont;
                richTextBox1.Clear();

                var NMP = Helper.Proxy();

                if (NMP.Length > 0)
                {
                    var proxyClient = ProxyClient.Parse(ProxyType.Http, NMP);
                    req.Proxy = proxyClient;
                }

                req.AddHeader("Accept", "application/json");
                req.AddHeader("Authorization", string.Format("Bearer {0}", Helper.token(MyStrings.AutoLogin, Form1.token)));
                string text = req.Get("https://edge.qiwi.com/payment-history/v2/persons/" + PNum.Text + "/payments?rows=10", null).ToString();
                req.Close();

                myjs.RootObject newQiwi = JsonConvert.DeserializeObject <myjs.RootObject>(text);

                cont = "<Чеки>" + Environment.NewLine;
                foreach (var ck in newQiwi.data)
                {
                    cont += "ID операции: " + ck.trmTxnId + "\r\nСтатус: " + ck.statusText + "\r\nСумма: " + ck.sum.amount + " " + ck.sum.MSC() + "\r\nТип: " + ck.MS() + ck.mcomment() + "\r\n----------------------" + Environment.NewLine;
                }
                File.WriteAllText(Path.Combine(Application.StartupPath.ToString(), MyStrings.checks), cont);
                MessageBox.Show("Чеки были сохранены в папке с программой!");
            }
            catch (Exception ex)
            {
                File.WriteAllText(MyStrings.MFolder + "LogError.txt", ex.ToString());
            }
        }