public static string paypal_pay(Transection tr) { //Converting String Money Value Into Decimal decimal price = tr.transection_ammount + 60 + (tr.transection_ammount * 5 / 100); double x = double.Parse(price.ToString()); double x1 = x / 75; string s = string.Format("{0:F}", x1); decimal d = decimal.Parse(s); //declaring empty String string returnURL = ""; returnURL += "https://www.paypal.com/xclick/business=KDG32QWYAZ9PY"; //PassingItem Name as dynamic returnURL += "&item_name=" + tr.mo_number; //Passing Amount as Dynamic returnURL += "&amount=" + d; //Passing Currency as your returnURL += "¤cy=USD"; //return Url if Customer wants To return to Previous Page returnURL += "&return=http://www.bgdtech.com/Home/Thank_You"; //return Url if Customer Wants To Cancel the Transaction returnURL += "&cancel_return=http://www.bgdtech.com"; //BIlling information prefilled //AssigningName as Statically to Parameter returnURL += "&first_name=" + "FirstName(optional)"; returnURL += "&last_name=" + "LastName(optional)"; returnURL += "&address1=" + "Optional"; returnURL += "&address2=" + "Optional"; returnURL += "&city=" + "Optional"; returnURL += "&state=" + "Optional"; returnURL += "&zip=" + "12345"; returnURL += "&night_phone_a=" + "88"; returnURL += "&night_phone_b=" + "01721234567"; return(returnURL); }
public static string paypal_wallet_pay(Transection tr) { //Converting String Money Value Into Decimal decimal price = tr.transection_ammount + 300 + (tr.transection_ammount * 5 / 100); double x = double.Parse(price.ToString()); double x1 = x / 75; string s = string.Format("{0:F}", x1); decimal d = decimal.Parse(s); //declaring empty String string returnURL = ""; returnURL += "https://www.paypal.com/xclick/business=KDG32QWYAZ9PY"; //PassingItem Name as dynamic returnURL += "&item_name=" + tr.mo_number; //Passing Amount as Dynamic returnURL += "&amount=" + d; //Passing Currency as your returnURL += "¤cy=USD"; //retturn Url if Customer wants To return to Previous Page returnURL += "&return=http://www.bgdtech.com/Home/Thank_You"; //retturn Url if Customer Wants To Cancel the Transaction returnURL += "&cancel_return=http://www.bgdtech.com"; //BIlling information prefilled //AssigningName as Statically to Parameter returnURL += "&first_name=" + "First name printed on card"; returnURL += "&last_name=" + "Last name printed on card"; returnURL += "&address1=" + "Optional"; returnURL += "&address2=" + "Optional"; returnURL += "&city=" + "Optional"; returnURL += "&state=" + "Optional"; returnURL += "&zip=" + "12345"; returnURL += "&night_phone_a=" + "88"; returnURL += "&night_phone_b=" + "01721234567"; returnURL += "&email=" + "*****@*****.**"; return returnURL; }
public ActionResult wallet_refill_bangla(Transection tr) { if (ModelState.IsValid) { var z = db.refil_history.ToList(); if (z.Count() > 0) { foreach (var i1 in z) { db.refil_history.Remove(i1); } } var v = db.wallet_deposit_temp.Where(r => r.username == tr.username).ToList(); if (v.Count() > 0) { var v1 = v.ToArray(); //wallet_deposit_temp wdt = new wallet_deposit_temp(); v1[0].deposit_ammount = tr.transection_ammount; //wdt.deposit_ammount = tr.transection_ammount; db.Entry(v1[0]).State = EntityState.Modified; db.SaveChanges(); string url = paypal_wallet.paypal_wallet_pay(tr); string email = db.userprofiles. Where(r => r.username == User.Identity.Name).Select(r => r.e_mail).FirstOrDefault(); url += "&email=" + email; Response.Redirect(url); //return RedirectToAction("Thank_You"); } else { wallet_deposit_temp wdt = new wallet_deposit_temp(); wdt.username = tr.username; wdt.deposit_date = tr.transection_date; wdt.deposit_ammount = tr.transection_ammount; db.wallet_deposit_temp.Add(wdt); db.SaveChanges(); string url = paypal_wallet.paypal_wallet_pay(tr); string email = db.userprofiles. Where(r => r.username == User.Identity.Name).Select(r => r.e_mail).FirstOrDefault(); url += "&email=" + email; Response.Redirect(url); //return RedirectToAction("Thank_You"); } /*user_deposit_history udh = new user_deposit_history(); udh.username = tr.username; udh.deposit_date = tr.transection_date; udh.deposit_ammount = tr.transection_ammount; udh.deposit_status = "Approved"; db.deposit_history.Add(udh); var d = db.userprofiles .Where(r => r.username == tr.username).FirstOrDefault(); d.wallet_money = d.wallet_money + udh.deposit_ammount; db.Entry(d).State = EntityState.Modified;*/ //db.SaveChanges(); //string url = paypal_wallet.paypal_wallet_pay(tr); //Response.Redirect(url); //return RedirectToAction("Thank_You"); } else { ModelState.AddModelError(" ", "Please provide valid data"); } return PartialView(tr); }
public ActionResult refill_by_wallet_bangla(Transection tr) { if (ModelState.IsValid) { //updating wallet money info var x = db.userprofiles.Where(r => r.username == tr.username).FirstOrDefault(); x.wallet_money = x.wallet_money - tr.transection_ammount; db.Entry(x).State = EntityState.Modified; db.SaveChanges(); //updating refill history transection_final tf = new transection_final(); //User_refill_history r_h = new User_refill_history(); tf.ammount = tr.transection_ammount; tf.send_to = tr.mo_number; tf.sent_date = tr.transection_date; tf.status = "Pending"; tf.username = tr.username; db.transection_finals.Add(tf); db.SaveChanges(); //send mail MailMessage message = new MailMessage(); var fromAddress = "*****@*****.**"; var toAddress = "*****@*****.**"; const string fromPassword = "******"; string subject = "Wallet refill-bangla"; string body = string.Format("{0} has sent {1} to {2}", User.Identity.Name, tr.transection_ammount, tr.mo_number); SmtpClient smtp = new SmtpClient { Host = "mail.paymobd.com", Port = 587, EnableSsl = false, Credentials = new NetworkCredential(fromAddress, fromPassword) }; smtp.Send(fromAddress, toAddress, subject, body); Thread.Sleep(2000); return RedirectToAction("order_confirm_bangla"); } else { ModelState.AddModelError(" ", "Please provide valid data"); } return PartialView(tr); }
public ActionResult Instant_refill_bangla(Transection tr) { if (ModelState.IsValid) { var z = db.wallet_deposit_temp.ToList(); if (z.Count() > 0) { foreach (var i in z) { db.wallet_deposit_temp.Remove(i); } } var v = db.refil_history.Where(r => r.username == tr.username).ToList(); if (v.Count() > 0) { var v1 = v.ToArray(); //User_refill_history rh = new User_refill_history(); v1[0].ammount = tr.transection_ammount; //rh.ammount = tr.transection_ammount; db.Entry(v1[0]).State = EntityState.Modified; db.SaveChanges(); string url = paypal.paypal_pay(tr); if (Request.IsAuthenticated) { string email = db.userprofiles. Where(r => r.username == User.Identity.Name).Select(r => r.e_mail).FirstOrDefault(); url += "&email=" + email; Response.Redirect(url); } else { url += "&email=" + "*****@*****.**"; Response.Redirect(url); } } else { User_refill_history rh = new User_refill_history(); rh.username = tr.username; rh.send_to = tr.mo_number; rh.sent_date = tr.transection_date; rh.status = "Pending"; rh.ammount = tr.transection_ammount; db.refil_history.Add(rh); //db.transections.Add(tr); db.SaveChanges(); string url = paypal.paypal_pay(tr); Response.Redirect(url); //return RedirectToAction("Thank_You"); } //if (Request.IsAuthenticated) //{ // return RedirectToAction("myprofile"); //} //else //{ // return RedirectToAction("Index"); //} //} } else { ModelState.AddModelError("", "Please provide valid data."); } return PartialView(tr); }
public ActionResult wallet_refill() { List<decimal> li1 = new List<decimal> { 2000, 3000, 4000, 5000 }; ViewBag.ammount = li1; Transection tr = new Transection(); tr.username = User.Identity.Name; tr.mo_number = "walletrefil"; tr.ConfirmNumber = "walletrefil"; tr.transection_date = DateTime.Now; return PartialView(tr); }
public ActionResult refill_by_wallet(Transection tr) { if (ModelState.IsValid) { //updating wallet money info var x = db.userprofiles.Where(r => r.username == tr.username).FirstOrDefault(); x.wallet_money = x.wallet_money - tr.transection_ammount; db.Entry(x).State = EntityState.Modified; db.SaveChanges(); //updating refill history transection_final tf = new transection_final(); //User_refill_history r_h = new User_refill_history(); tf.ammount = tr.transection_ammount; tf.send_to = tr.mo_number; tf.sent_date = tr.transection_date; tf.status = "Pending"; tf.username = tr.username; db.transection_finals.Add(tf); db.SaveChanges(); return RedirectToAction("myprofile"); } else { ModelState.AddModelError(" ", "Please provide valid data"); } return PartialView(tr); }