예제 #1
0
        public JsonResult RefundAmount(Guid OrderID)
        {
            string Cart = "VP" + "_" + "1.0" + "_" + "0.00";

            DataTable dt = BLObj.GetTransactionID(OrderID);

            string MerchantTxnRefNumber = (dt.Rows[0]["UniquTxnRefNo"]).ToString();
            string TPSLTxnID = (dt.Rows[0]["TPSLTxnID"]).ToString();

            RequestURL objRequestURL = new RequestURL();

            String response = objRequestURL.SendRequest("R", "T5041", MerchantTxnRefNumber, "NA", "1.00", "INR", "NA", "NA", "NA",
                TPSLTxnID, Cart, DateTime.Now.ToString("dd-MM-yyyy"), "", "", "", "", @"D:\DotnetIntegrationKit\PropertyFile\Merchant.property");

            // String strResponse = response.ToUpper();

            if (response.ToUpper().Contains("SUCCESS"))
            {
                BLObj.UpdateOrderAfterRefund(MerchantTxnRefNumber);
                bool result = true;
                return Json(new { result }, JsonRequestBehavior.AllowGet);
            }
            else
            {
                bool result = false;
                return Json(new { result }, JsonRequestBehavior.AllowGet);
            }

            //return Json(new { }, JsonRequestBehavior.AllowGet);
        }
예제 #2
0
        public ActionResult RequestForPayment(int PackageID, int amount, string request)
        {
            string getError = "";
            try
            {
                TempData["RequestInfo"] = request.ToString() + " " + PackageID.ToString() + " " + amount;
                TempData["PaymentInformationforPackage"] = PackageID.ToString() + " " + amount.ToString();

                string commition = "0.00";

                var host = Request.Url.Host.ToLower();
                var port = Request.Url.Port.ToString();

                //RequestForPayment rp = new Models.RequestForPayment();

                Guid OrderID = Guid.NewGuid();
                Guid TransactionID = Guid.NewGuid();
                int UserId = Convert.ToInt32(Common.GetUserId(HttpContext.User.Identity.Name));
                RequestURL objRequestURL = new RequestURL();

                string Requesttype = "T";

                string MerchantCode = "L5041";//"T5041";

                string MTRN = Guid.NewGuid().ToString("N").Substring(0, 10);

                string ITC = "NA";

                double Amount = Convert.ToDouble(amount);//Convert.ToDouble(amo);

                string CurrencyCode = "INR";

                string UCI = "NA";

                string RL = "http://" + host + ":" + port + "/Home/PaymentDone";//?PackageID=" + PackageID + "&amount=" + amo;

                string ReturnURL = "NA";

                string TranID = "NA";//"151180865";

                string Cart = "VP" + "_" + Amount + "_" + commition;

                string TxnDate = Convert.ToString(DateTime.Now.ToString("dd-MM-yyyy").Split(' ')[0]);

                string Email = "";

                string Mobile = "";

                string BankCode = "";//Convert.ToString(rp.BankCode);

                string CustomerName = "";

                string PropertyPath = @"D:\DotnetIntegrationKit\PropertyFile\Merchant.property";

                String response = objRequestURL.SendRequest(Requesttype, MerchantCode, MTRN, ITC, Convert.ToString(Amount), CurrencyCode, UCI, RL, ReturnURL,
                TranID, Cart, TxnDate, Email, Mobile, BankCode, CustomerName, PropertyPath);

                String strResponse = response.ToUpper();

                if (strResponse.StartsWith("ERROR"))
                {
                    getError = "Error 6";
                    ViewBag.ResultMessage = response;
                }
                else
                {
                    getError = "Error 7";
                    BLObj.CreatNewOrder(OrderID, TransactionID, request, PackageID, MTRN, UserId);
                    getError = "Error 8";
                    TempData["OrderID"] = OrderID.ToString();
                    getError = "Error 9";

                    Response.Write("<form name='s1_2' id='s1_2' action='" + response + "' method='post'> ");

                    Response.Write("<script type='text/javascript' language='javascript' >document.getElementById('s1_2').submit();");

                    Response.Write("</script>");
                    Response.Write("<script language='javascript' >");
                    Response.Write("</script>");
                    Response.Write("</form> ");

                }
            }
            catch (Exception ex)
            {
                ViewBag.ResultMessage = ex.Message;
            }
            return View();

            //return View(rp);

            //  return RedirectToAction("PaymentDone", "Home");
        }