public void makePay(Accept acc) { string ipaddress; ipaddress = Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; if (ipaddress == "" || ipaddress == null) { ipaddress = Request.ServerVariables["REMOTE_ADDR"]; } string SECURE_SECRET = "0C1D637C06AC75FDE9D7B4B550A3A641"; // Khoi tao lop thu vien va gan gia tri cac tham so gui sang cong thanh toan VPCRequest conn = new VPCRequest("https://onepay.vn/onecomm-pay/vpc.op"); conn.SetSecureSecret(SECURE_SECRET); // Add the Digital Order Fields for the functionality you wish to use // Core Transaction Fields conn.AddDigitalOrderField("Title", "Mibo.vn - Cong thanh toan OnePay"); conn.AddDigitalOrderField("vpc_Locale", "vn");//Chon ngon ngu hien thi tren cong thanh toan (vn/en) conn.AddDigitalOrderField("vpc_Version", "2"); conn.AddDigitalOrderField("vpc_Command", "pay"); conn.AddDigitalOrderField("vpc_Merchant", "NGUYENPHONG"); conn.AddDigitalOrderField("vpc_AccessCode", "GWJBCBJX"); conn.AddDigitalOrderField("vpc_MerchTxnRef", genId); conn.AddDigitalOrderField("vpc_OrderInfo", "Tin Hoc Nguyen Phong - Mibo.vn"); conn.AddDigitalOrderField("vpc_Amount", acc.TotalAmt.ToString()+"00"); conn.AddDigitalOrderField("vpc_Currency", "VND"); conn.AddDigitalOrderField("vpc_ReturnURL", "http://mibo.vn/pay-process.aspx"); // Dia chi IP cua khach hang conn.AddDigitalOrderField("vpc_TicketNo", ipaddress); // Chuyen huong trinh duyet sang cong thanh toan String url = conn.Create3PartyQueryString(); Page.Response.Redirect(url); }
partial void DeleteAccept(Accept instance);
partial void InsertAccept(Accept instance);
partial void UpdateAccept(Accept instance);
private void setCheckoutRequestModel() { CheckoutRequestModel request = new CheckoutRequestModel(); DateTime dateNow = DateTime.Now; Accept accept = new Accept(); if (Session["payMethod"].ToString().Equals("1")) { accept.ClientCd = txtClientCd.Value.ToString(); } else { accept.ClientCd = email.Text.Trim().ToString(); } accept.AcceptDate = DateTime.Now; accept.ClientName = clientName.Text.Trim(); accept.ClientAddress = clientAddress.Text.Trim(); accept.ClientTel = clientTell.Text.Trim(); accept.ClientCityCd = DropDownList1.SelectedValue; accept.DeliveryName = deliveryName.Text.Trim(); accept.DeliveryAddress = deliveryAddress.Text; accept.DeliveryTel = deliveryTell.Text; accept.DeliveryCityCd = DropDownList2.SelectedValue; if (RadioButton1.Checked == true) { accept.DeliveryName = accept.ClientName; accept.DeliveryAddress = accept.ClientAddress; accept.DeliveryTel = accept.ClientTel; accept.DeliveryCityCd = accept.ClientCityCd; } accept.Notes = note.Text.ToString(); accept.CreateDate = dateNow; accept.UpdateDate = dateNow; accept.DeleteFlag = false; if (pay1.Checked) { accept.PaymentMethods = "01"; accept.SlipStatus = "01"; } else if (pay2.Checked) { accept.PaymentMethods = "02"; accept.SlipStatus = "03"; } else if (pay3.Checked) { accept.SlipStatus = "03"; } else { accept.SlipStatus = "04"; } accept.Notes = note.Text; accept.CreateUser = accept.ClientCd; accept.UpdateUser = accept.ClientCd; request.Accept = accept; request.Cart = Session["Cart"]; if (Session["GiftCd"] != null) { accept.UseGiftCd = Session["GiftCd"].ToString(); } Session["CheckoutRequestModel"] = request; }