Beispiel #1
0
        private void button3_Click(object sender, EventArgs e)
        {
            string url = "http://121.199.42.125:6001/DevPayTest.ashx?";
            CreateOrderParameters para = new CreateOrderParameters()
            {
                AppOrderAmount = QCodeAmount,
                AppOrderDesc   = "测试",
                AppOrderID     = Guid.NewGuid().ToString("N"),
                AppOrderTime   = DateTime.Now.ToJITFormatString(),
                PayChannelID   = 4,
                MobileNO       = "18626336617",
            };
            TradeRequest request1 = new TradeRequest()
            {
                AppID      = 1,
                ClientID   = "27",
                Parameters = para,
                UserID     = "1111"
            };
            string parameter = string.Format("action=CreateOrder&request={0}", request1.ToJSON());
            var    data      = Encoding.GetEncoding("utf-8").GetBytes(parameter);
            var    res       = GetResponseStr(url, data);
            var    response  = res.DeserializeJSONTo <TradeResponse>();
            var    imageurl  = response.Datas.ToJSON().DeserializeJSONTo <CreateOrderResponse>().QrCodeUrl;

            //using (var stream = GetResponseStream(imageurl, new byte[] { }))
            //{
            //    using (Bitmap bm = new Bitmap(stream))
            //    {
            //        this.pictureBox1.Image = bm;
            //    }
            //}
            this.webBrowser1.DocumentText = string.Format("<img src='{0}' style='width:120px;height:120px;' />", imageurl);
        }
Beispiel #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            //CreateAndPayRequest request = new CreateAndPayRequest()
            //{
            //    SellerID = AliPayConfig.Partner_SoundWave,
            //    Subject = "测试",
            //    TotalFee = "0.01",
            //    Partner = AliPayConfig.Partner_SoundWave,
            //    OutTradeNo = Guid.NewGuid().ToString().Replace("-", ""),
            //    DynamicIDType = "soundwave",
            //    DynamicID = this.txtWaveDynamicID.Text
            //};
            //var t = AliPayOffLineGeteway.OfflineCreateAndPay(request);

            //string url = "http://121.199.42.125:6001/DevPayTest.ashx?";
            string url = "http://localhost:1266/Gateway.ashx?";
            CreateOrderParameters para = new CreateOrderParameters()
            {
                AppOrderAmount = 1,
                AppOrderDesc   = "测试",
                AppOrderID     = Guid.NewGuid().ToString("N"),
                AppOrderTime   = DateTime.Now.ToJITFormatString(),
                PayChannelID   = 4,
                MobileNO       = "18626336617",
                DynamicIDType  = "soundwave",
                DynamicID      = this.txtWaveDynamicID.Text
            };
            TradeRequest request1 = new TradeRequest()
            {
                AppID      = 1,
                ClientID   = "27",
                Parameters = para,
                UserID     = "1111"
            };
            string parameter = string.Format("action=CreateOrder&request={0}", request1.ToJSON());
            var    data      = Encoding.GetEncoding("utf-8").GetBytes(parameter);
            var    res       = GetResponseStr(url, data);

            MessageBox.Show(res);
        }
Beispiel #3
0
        private void button2_Click(object sender, EventArgs e)
        {
            Form frm = new Form();

            frm.Width           = 200;
            frm.Height          = 30;
            frm.StartPosition   = FormStartPosition.CenterParent;
            frm.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
            TextBox txtbox = new TextBox();

            txtbox.Multiline = true;
            txtbox.Height    = frm.Height;
            txtbox.Dock      = DockStyle.Fill;
            frm.Controls.Add(txtbox);
            frm.KeyPreview   = true;
            txtbox.KeyPress += (s, t) =>
            {
                TextBox tt = s as TextBox;
                if (t.KeyChar == (char)Keys.Enter)
                {
                    ((Form)tt.Parent).Close();
                }
            };
            frm.ShowDialog();
            //CreateAndPayRequest request = new CreateAndPayRequest()
            //{
            //    SellerID = AliPayConfig.Partner_SoundWave,
            //    Subject = "测试",
            //    TotalFee = "0.01",
            //    Partner = AliPayConfig.Partner_SoundWave,
            //    OutTradeNo = Guid.NewGuid().ToString().Replace("-", ""),
            //    DynamicIDType = "soundwave",
            //    DynamicID = this.txtWaveDynamicID.Text
            //};
            //var t = AliPayOffLineGeteway.OfflineCreateAndPay(request);

            string url = "http://121.199.42.125:6001/DevPayTest.ashx?";

            CreateOrderParameters para = new CreateOrderParameters()
            {
                AppOrderAmount = 1,
                AppOrderDesc   = "测试",
                AppOrderID     = Guid.NewGuid().ToString("N"),
                AppOrderTime   = DateTime.Now.ToJITFormatString(),
                PayChannelID   = 4,
                MobileNO       = "18626336617",
                DynamicIDType  = this.radioButton1.Checked ? "barcode" : "qrcode",
                DynamicID      = txtbox.Text
            };
            TradeRequest request1 = new TradeRequest()
            {
                AppID      = 1,
                ClientID   = "27",
                Parameters = para,
                UserID     = "1111"
            };
            string parameter = string.Format("action=CreateOrder&request={0}", request1.ToJSON());
            var    data      = Encoding.GetEncoding("utf-8").GetBytes(parameter);
            var    res       = GetResponseStr(url, data);

            this.richTextBox1.Text += res.ToJSON();
        }