Exemplo n.º 1
0
        public string GetCcavenueEncryptedChargeRequest(ICcavenueCharge ccavenueCharge, string merchantId, string workingKey, string returnUrl)
        {
            StringBuilder ccavenueRequest = new StringBuilder();
            CCACrypto     ccaCrypto       = new CCACrypto();

            ccavenueRequest.Append($"merchant_id={merchantId}&order_id={ccavenueCharge.TransactionId}&amount={ccavenueCharge.Amount}&currency={ccavenueCharge.Currency.ToUpper()}&redirect_url={returnUrl}&cancel_url={returnUrl}&");

            ccavenueRequest.Append($"billing_name={ccavenueCharge.BillingAddress.FirstName} {ccavenueCharge.BillingAddress.LastName}&billing_address={ccavenueCharge.BillingAddress.AddressLine1}&billing_city={ccavenueCharge.BillingAddress.City}&billing_state={ccavenueCharge.BillingAddress.State}&billing_zip={ccavenueCharge.BillingAddress.Zipcode}&billing_country={ccavenueCharge.BillingAddress.Country}&billing_tel={ccavenueCharge.BillingAddress.PhoneCode}{ccavenueCharge.BillingAddress.PhoneNumber}&billing_email={ccavenueCharge.BillingAddress.Email}&");

            ccavenueRequest.Append($"delivery_name={ccavenueCharge.BillingAddress.FirstName} {ccavenueCharge.BillingAddress.LastName}&delivery_address={ccavenueCharge.BillingAddress.AddressLine1}&delivery_city={ccavenueCharge.BillingAddress.City}&delivery_state={ccavenueCharge.BillingAddress.State}&delivery_zip={ccavenueCharge.BillingAddress.Zipcode}&delivery_country={ccavenueCharge.BillingAddress.Country}&delivery_tel={ccavenueCharge.BillingAddress.PhoneCode}{ccavenueCharge.BillingAddress.PhoneNumber}&");

            var paymentOption = GetCcavenuePaymentOptions(ccavenueCharge.PaymentOption);

            ccavenueRequest.Append($"payment_option={paymentOption.Item1}&card_type={paymentOption.Item2}&");
            if (ccavenueCharge.PaymentOption == PaymentOptions.NetBanking)
            {
                var bankName = _netBankingBankDetailRepository.GetByAltId(ccavenueCharge.BankAltId).BankName;
                ccavenueRequest.Append($"card_name={bankName}&");
            }
            else if (ccavenueCharge.PaymentOption == PaymentOptions.CashCard)
            {
                var cardName = _cashCardDetailRepository.GetByAltId(ccavenueCharge.CardAltId).CardName;
                ccavenueRequest.Append($"card_name={cardName}&");
            }
            else
            {
                ccavenueRequest.Append($"card_number={ccavenueCharge.PaymentCard.CardNumber}&expiry_month={ccavenueCharge.PaymentCard.ExpiryMonth}&expiry_year={ccavenueCharge.PaymentCard.ExpiryYear}&cvv_number={ccavenueCharge.PaymentCard.Cvv}&");
            }
            ccavenueRequest.Append($"data_accept=N&");

            return(ccaCrypto.Encrypt(ccavenueRequest.ToString(), workingKey));
        }
        public string strAccessCode = "AVCR83GC95AY39RCYA";//"AVCR83GC95AY39RCYA";// put the access key in the quotes provided here.
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Request.QueryString["DATA"] != null && Request.QueryString["DATA"].Length > 0)
                {
                    ccaRequest = ccaCrypto.Decrypt(Request.QueryString["DATA"], workingKey);
                }
                else
                {
                    foreach (string name in Request.Form)
                    {
                        if (name != null)
                        {
                            if (!name.StartsWith("_"))
                            {
                                ccaRequest = ccaRequest + name + "=" + Request.Form[name] + "&";

                                /* Response.Write(name + "=" + Request.Form[name]);
                                 * Response.Write("</br>");*/
                            }
                        }
                    }
                }
                strEncRequest = ccaCrypto.Encrypt(ccaRequest, workingKey);
            }
        }
Exemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            float cost = 0;

            lectureURL = ConfigurationManager.AppSettings["LectureURL"].ToString();

            if (!IsPostBack)
            {
                if (Request["id"] != null)
                {
                    workingKey  = ConfigurationManager.AppSettings["WorkingKey"].ToString(); // "580B9D14C245D159DD3AEF9FBAC35360"
                    accessCode  = ConfigurationManager.AppSettings["AccessCode"].ToString(); // "AVBP67DI15CE97PBEC"
                    redirectUrl = ConfigurationManager.AppSettings["CCAvenueRedirectUrl"].ToString();
                    cancelUrl   = ConfigurationManager.AppSettings["CCAvenueCancelUrl"].ToString();
                    serviceTax  = float.Parse(ConfigurationManager.AppSettings["ServiceTax"].ToString());

                    string guid = Request["id"].ToString();

                    BusinessLayer businessLayer = new BusinessLayer();
                    float         costValue     = (float)businessLayer.GetTotalCourseCost(guid);

                    if (costValue > 0)
                    {
                        cost = float.Parse(costValue.ToString());
                    }

                    if (cost > 0)
                    {
                        if (serviceTax > 0)
                        {
                            cost = cost + (float)Math.Round(((cost * serviceTax) / 100), 2);
                        }

                        ccaRequest = ccaRequest + "merchant_id=110743&";
                        ccaRequest = ccaRequest + "order_id=" + guid + "&";
                        ccaRequest = ccaRequest + "amount=" + cost + "&";
                        ccaRequest = ccaRequest + "currency=INR&";
                        ccaRequest = ccaRequest + "access_code=" + accessCode + "&";
                        ccaRequest = ccaRequest + "redirect_url=" + redirectUrl + "&";
                        ccaRequest = ccaRequest + "cancel_url=" + cancelUrl + "&";
                        //ccaRequest = ccaRequest + "order_id=123&";
                        //ccaRequest = ccaRequest + "amount=1.0&";
                        //ccaRequest = ccaRequest + "currency=INR&";
                        //ccaRequest = ccaRequest + "access_code=AVBP67DI15CE97PBEC&";
                        //ccaRequest = ccaRequest + "redirect_url=http://www.gynac.org/ValidatePayment.aspx&";
                        //ccaRequest = ccaRequest + "cancel_url=http://www.gynac.org/WebForm_Failure.aspx&";
                        ccaRequest = ccaRequest + "language=EN&";

                        strEncRequest = ccaCrypto.Encrypt(ccaRequest, workingKey);
                    }
                }
                //else
                //{
                //    Response.Redirect(lectureURL);
                //}
            }
        }
Exemplo n.º 4
0
        public ActionResult Payment(string invoiceNumber)
        {
            string amount         = "500";
            var    queryParameter = new CCACrypto();

            //CCACrypto is the dll you get when you download the ASP.NET 3.5 integration kit from //ccavenue account.

            return(View("CcAvenue", new CcAvenueViewModel(queryParameter.Encrypt
                                                              (BuildCcAvenueRequestParameters(invoiceNumber, amount), WorkingKey), AccessCode, CheckoutUrl)));
        }
Exemplo n.º 5
0
        private string PreparePOSTForm(string url, System.Collections.Hashtable data, ref string inputRequest)      // post form
        {
            //Set a name for the form
            string formID = "PostForm";
            //Build the form using the specified data to be posted.
            StringBuilder strForm = new StringBuilder();

            strForm.Append("<form id=\"" + formID + "\" name=\"" +
                           formID + "\" action=\"" + url +
                           "\" method=\"POST\">");

            string strEncRequest = "";

            foreach (System.Collections.DictionaryEntry key in data)
            {
                inputRequest = inputRequest + key.Key + "=" + key.Value + "&";

                /* Response.Write(name + "=" + Request.Form[name]);
                 * Response.Write("</br>");*/
            }

            int i = inputRequest.LastIndexOf("&");

            inputRequest = inputRequest.Remove(i, 1);
            CCACrypto ccaCrypto = new CCACrypto();

            strEncRequest = ccaCrypto.Encrypt(inputRequest, ConfigurationConstants.CCAVENUE_WORKING_KEY);

            strForm.Append("<input type=\"hidden\" name=\"encRequest\" value=\"" + strEncRequest + "\">");
            strForm.Append("<input type=\"hidden\" name=\"access_code\" value=\"" + ConfigurationConstants.CCAVENUE_ACCESS_CODE + "\">");

            strForm.Append("</form>");
            //Build the JavaScript which will do the Posting operation.
            StringBuilder strScript = new StringBuilder();

            strScript.Append("<script language='javascript'>");
            strScript.Append("var v" + formID + " = document." +
                             formID + ";");
            strScript.Append("v" + formID + ".submit();");
            strScript.Append("</script>");
            //Return the form and the script concatenated.
            //(The order is important, Form then JavaScript)
            return(strForm.ToString() + strScript.ToString());
        }
        public string strAccessCode = "AVPV84GD47AJ71VPJA";// Production
        //public string strAccessCode = "AVPV84GD47AJ71VPJA";// Testing

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //foreach (string name in Request.Form)
                // {
                //     if (name != null)
                //     {
                //         if (!name.StartsWith("_"))
                //         {
                //             ccaRequest = ccaRequest + name + "=" + Request.Form[name] + "&";
                //           /* Response.Write(name + "=" + Request.Form[name]);
                //             Response.Write("</br>");*/
                //         }
                //     }
                // }
                strEncRequest = ccaCrypto.Encrypt(Request.QueryString.ToString(), workingKey);
            }
        }
Exemplo n.º 7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string planId = Request.QueryString["pid"].ToString();
            Session["planId"] = planId;
            string tid = string.Empty, merchant_id = string.Empty, order_id = string.Empty, amount = string.Empty, currency = string.Empty, redirect_url = string.Empty, cancel_url = string.Empty;

            merchant_id   = ConfigurationManager.AppSettings["merchant_id"];
            redirect_url  = ConfigurationManager.AppSettings["redirect_url"];
            workingKey    = ConfigurationManager.AppSettings["workingKey"];
            strAccessCode = ConfigurationManager.AppSettings["strAccessCode"];

            tid            = DateTime.Now.ToString("yyMMddhhmmssMs");
            Session["tid"] = tid;
            tid            = "tid=" + tid;
            merchant_id    = "&merchant_id=" + merchant_id;
            order_id       = "&order_id=" + "IMSBIZZ" + DateTime.Now.ToString("yyMMddhhmmssMs");
            amount         = "&amount=" + GetPriceByPlaneId().ToString();
            currency       = "&currency=" + "INR";
            redirect_url   = "&redirect_url=" + redirect_url;
            cancel_url     = "&cancel_url=" + "ccavResponseHandler.php";


            ccaRequest = tid + merchant_id + order_id + amount + currency + redirect_url + cancel_url;

            //foreach (string name in Request.Form)
            //{
            //    if (name != null)
            //    {
            //        if (!name.StartsWith("_"))
            //        {
            //            ccaRequest = ccaRequest + name + "=" + Request.Form[name] + "&";
            //            /* Response.Write(name + "=" + Request.Form[name]);
            //              Response.Write("</br>");*/
            //        }
            //    }
            //}

            strEncRequest = ccaCrypto.Encrypt(ccaRequest, workingKey);
        }
    }
Exemplo n.º 8
0
        public static void CCAvenue_Confirm_Order(string pPaymentRef,
                                                  string pAmount)
        {
            CCAvanueConfiguration lCCAvanueConfiguration = PaymentClass.Get_CCAvenue_Configuration();
            CCACrypto             ccaCrypto = new CCACrypto();
            string lJsonData     = "{\"order_List\": [ {\"reference_no\":\"" + pPaymentRef + "\",\"amount\":\"" + pAmount + "\"} ] }";
            string strEncRequest = ccaCrypto.Encrypt(lJsonData, lCCAvanueConfiguration.Working_Key);

            RestClient lRestClient = new RestClient("https://login.ccavenue.com/apis/servlet/DoWebTrans");

            lJsonData = "{\"request_type\":\"JSON\",\"Command\":\"confirmOrder\",\"access_code\":\"" + lCCAvanueConfiguration.Access_Code + "\",\"response_type\":\"JSON\"}";

            RestRequest lRestRequest = new RestRequest(Method.POST);

            lRestRequest.AddQueryParameter("command", "confirmOrder");
            lRestRequest.AddQueryParameter("request_type", "JSON");
            lRestRequest.AddQueryParameter("access_code", lCCAvanueConfiguration.Access_Code);
            lRestRequest.AddQueryParameter("response_type", "JSON");
            lRestRequest.AddQueryParameter("enc_request", strEncRequest);
            IRestResponse lRestResponse = lRestClient.Execute(lRestRequest);

            //HttpContext.Current.Response.Write(lRestResponse.Content);
        }
Exemplo n.º 9
0
        public string cancelUrl     = System.Configuration.ConfigurationManager.AppSettings["CancelUrl"].ToString();   // put the access key in the quotes provided here.



        protected void Page_Load(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(ApplicationSession.Current.user.Email) && Request.QueryString.Keys.Count > 0)
            {
                if (!string.IsNullOrEmpty(ApplicationSession.Current.user.Email))
                {
                    string planPrice = string.Empty;
                    string planId    = Request.QueryString.GetValues(0)[0].ToString();
                    ApplicationSession.Current.user.UserPricingPlan.PlanId = planId;

                    if (planId == "1")
                    {
                        planPrice = "499";
                    }
                    else if (planId == "2")
                    {
                        planPrice = "799";
                    }
                    else if (planId == "3")
                    {
                        planPrice = "1299";
                    }
                    //string tid = DateTime.Now.ToString();
                    string orderId = GenerateRandomNumber(15);

                    Dictionary <string, PricingData> pricingInfo = new Dictionary <string, PricingData>();

                    //PricingData pr1 = new PricingData("tid", tid);
                    PricingData pr2 = new PricingData("merchant_id", merchantId);
                    PricingData pr3 = new PricingData("order_id", orderId);
                    PricingData pr4 = new PricingData("currency", currency);
                    PricingData pr5 = new PricingData("amount", planPrice);
                    PricingData pr6 = new PricingData("redirect_url", redirectUrl);
                    PricingData pr7 = new PricingData("cancel_url", cancelUrl);
                    PricingData pr8 = new PricingData("language", language);
                    PricingData pr9 = new PricingData("customer_identifier", ApplicationSession.Current.user.Email);
                    //pricingInfo.Add(pr1.pricingId, pr1);
                    pricingInfo.Add(pr2.pricingId, pr2);
                    pricingInfo.Add(pr3.pricingId, pr3);
                    pricingInfo.Add(pr4.pricingId, pr4);
                    pricingInfo.Add(pr5.pricingId, pr5);
                    pricingInfo.Add(pr6.pricingId, pr6);
                    pricingInfo.Add(pr7.pricingId, pr7);
                    pricingInfo.Add(pr8.pricingId, pr8);
                    pricingInfo.Add(pr9.pricingId, pr9);
                    if (!IsPostBack)
                    {
                        foreach (KeyValuePair <string, PricingData> entry in pricingInfo)
                        {
                            ccaRequest = ccaRequest + entry.Key + "=" + entry.Value.pricingValue + "&";
                        }
                        strEncRequest = ccaCrypto.Encrypt(ccaRequest, workingKey);
                    }
                }
                else
                {
                    Response.Redirect("~/register-with-us");
                }
            }
            else
            {
                Response.Redirect("~/register-with-us");
            }
        }
Exemplo n.º 10
0
        public static void Initiate_CCAvenue_Order(string pOrderId,
                                                   string pTransactionAmount,
                                                   string pEmail,
                                                   string pMobileNumber,
                                                   string pAddressId,
                                                   MySqlConnection dbconn)
        {
            UserAddress lUserAddress = UserClass.Get_User_Address(pAddressId,
                                                                  dbconn);

            CCAvanueConfiguration lCCAvanueConfiguration = PaymentClass.Get_CCAvenue_Configuration();
            string    lMobileNumber = pMobileNumber;
            CCACrypto ccaCrypto     = new CCACrypto();
            string    ccaRequest    = "";
            var       lCallBackUrl  = "http://" + HttpContext.Current.Request.ServerVariables["HTTP_HOST"] + "/CC_Order_Response.aspx"; //This parameter is not mandatory. Use this to pass the callback url dynamically.

            if (CommonClass.Is_Production())
            {
                lCallBackUrl = lCallBackUrl.Replace("http://", "https://");
            }
            ccaRequest += "merchant_id=" + HttpUtility.UrlEncode(lCCAvanueConfiguration.Merchant_Key) + "&";
            ccaRequest += "order_id=" + HttpUtility.UrlEncode(pOrderId) + "&";
            ccaRequest += "currency=" + HttpUtility.UrlEncode("INR") + "&";
            ccaRequest += "amount=" + HttpUtility.UrlEncode(pTransactionAmount) + "&";
            ccaRequest += "redirect_url=" + HttpUtility.UrlEncode(lCallBackUrl) + "&";
            ccaRequest += "cancel_url=" + HttpUtility.UrlEncode(lCallBackUrl) + "&";
            ccaRequest += "language=" + HttpUtility.UrlEncode("en") + "&";
            ccaRequest += "billing_name=" + HttpUtility.UrlEncode(lUserAddress.User_Name) + "&";
            ccaRequest += "billing_address=" + HttpUtility.UrlEncode(lUserAddress.Address) + "&";
            ccaRequest += "billing_city=" + HttpUtility.UrlEncode(lUserAddress.City) + "&";
            ccaRequest += "billing_state=" + HttpUtility.UrlEncode(lUserAddress.State) + "&";
            ccaRequest += "billing_zip=" + HttpUtility.UrlEncode(lUserAddress.Pin_Code) + "&";
            ccaRequest += "billing_country=" + HttpUtility.UrlEncode("India") + "&";
            ccaRequest += "billing_tel=" + HttpUtility.UrlEncode(lUserAddress.Mobile_Number) + "&";
            ccaRequest += "billing_email=" + HttpUtility.UrlEncode(pEmail) + "&";
            ccaRequest += "delivery_name=" + HttpUtility.UrlEncode(lUserAddress.User_Name) + "&";
            ccaRequest += "delivery_address=" + HttpUtility.UrlEncode(lUserAddress.Address) + "&";
            ccaRequest += "delivery_city=" + HttpUtility.UrlEncode(lUserAddress.City) + "&";
            ccaRequest += "delivery_state=" + HttpUtility.UrlEncode(lUserAddress.State) + "&";
            ccaRequest += "delivery_zip=" + HttpUtility.UrlEncode(lUserAddress.Pin_Code) + "&";
            ccaRequest += "delivery_country=" + HttpUtility.UrlEncode("India") + "&";
            ccaRequest += "delivery_tel=" + HttpUtility.UrlEncode(lUserAddress.Mobile_Number) + "&";

            string strEncRequest = ccaCrypto.Encrypt(ccaRequest, lCCAvanueConfiguration.Working_Key);

            //Dictionary<string, string> parameters = new Dictionary<string, string>();
            ////string lOrderId = lRecords[0];
            //parameters.Add("REQUEST_TYPE", "DEFAULT");
            //parameters.Add("MID", lPayTmConfiguration.MID);
            //parameters.Add("CHANNEL_ID", lPayTmConfiguration.Channel_Id);
            //parameters.Add("INDUSTRY_TYPE_ID", lPayTmConfiguration.Industry_Type);
            //parameters.Add("WEBSITE", lPayTmConfiguration.Website_Name);
            //parameters.Add("EMAIL", pEmail);
            //parameters.Add("MOBILE_NO", lMobileNumber);
            //parameters.Add("CUST_ID", ClaimsPrincipal.Current.FindFirst("user_id").Value);
            //parameters.Add("ORDER_ID", pOrderId);
            //parameters.Add("TXN_AMOUNT", pTransactionAmount);
            //var lCallBackUrl = "http://" + HttpContext.Current.Request.ServerVariables["HTTP_HOST"] + "/Order_Response.aspx"; //This parameter is not mandatory. Use this to pass the callback url dynamically.
            //if (CommonClass.Is_Production())
            //{
            //    lCallBackUrl = lCallBackUrl.Replace("http://", "https://");
            //}
            //parameters.Add("CALLBACK_URL", lCallBackUrl);
            //string paytmURL = lPayTmConfiguration.Payment_Url;

            //string checksum = CheckSum.generateCheckSum(lPayTmConfiguration.Merchant_Key, parameters);
            string outputHTML = "<html>";

            outputHTML += "<head>";
            outputHTML += "<title>CCAvenue Merchant Check Out Page</title>";
            outputHTML += "</head>";
            outputHTML += "<body>";
            outputHTML += "<center><h1>Please do not refresh this page...</h1></center>";
            outputHTML += "<form method='post' action='" + lCCAvanueConfiguration.Payment_Url + "' name='f1'>";
            outputHTML += "<table border='1'>";
            outputHTML += "<tbody>";
            outputHTML += "<input type='hidden' name='encRequest' value='" + strEncRequest + "'>";
            outputHTML += "<input type='hidden' name='access_code' value='" + lCCAvanueConfiguration.Access_Code + "'>";
            outputHTML += "</tbody>";
            outputHTML += "</table>";
            outputHTML += "<script type='text/javascript'>";
            outputHTML += "document.f1.submit();";
            outputHTML += "</script>";
            outputHTML += "</form>";
            outputHTML += "</body>";
            outputHTML += "</html>";
            HttpContext.Current.Response.Write(outputHTML);
        }
Exemplo n.º 11
0
        /// <summary>
        /// Post process payment (used by payment gateways that require redirecting to a third-party URL)
        /// </summary>
        /// <param name="postProcessPaymentRequest">Payment info required for an order processing</param>
        public void PostProcessPayment(PostProcessPaymentRequest postProcessPaymentRequest)
        {
            var remotePostHelperData = new Dictionary <string, string>();
            var remotePostHelper     = new RemotePost
            {
                FormName = "CCAvenueForm",
                Url      = _ccAvenuePaymentSettings.PayUri
            };

            //use TLS 1.2
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

            remotePostHelperData.Add("Merchant_Id", _ccAvenuePaymentSettings.MerchantId);
            remotePostHelperData.Add("Amount", postProcessPaymentRequest.Order.OrderTotal.ToString(new CultureInfo("en-US", false).NumberFormat));
            remotePostHelperData.Add("Currency", _currencyService.GetCurrencyById(_currencySettings.PrimaryStoreCurrencyId).CurrencyCode);
            remotePostHelperData.Add("Order_Id", postProcessPaymentRequest.Order.Id.ToString());
            remotePostHelperData.Add("Redirect_Url", _webHelper.GetStoreLocation(false) + "Plugins/PaymentCCAvenue/Return");

            remotePostHelperData.Add("cancel_url", _webHelper.GetStoreLocation(false) + "Plugins/PaymentCCAvenue/Return");
            remotePostHelperData.Add("language", "EN");

            //var myUtility = new CCAvenueHelper();
            //remotePostHelperData.Add("Checksum", myUtility.getchecksum(_ccAvenuePaymentSettings.MerchantId.ToString(), postProcessPaymentRequest.Order.Id.ToString(), postProcessPaymentRequest.Order.OrderTotal.ToString(), _webHelper.GetStoreLocation(false) + "Plugins/PaymentCCAvenue/Return", _ccAvenuePaymentSettings.Key));

            //Billing details
            remotePostHelperData.Add("billing_name", postProcessPaymentRequest.Order.BillingAddress.FirstName);
            //remotePostHelperData.Add("billing_address", postProcessPaymentRequest.Order.BillingAddress.Address1 + " " + postProcessPaymentRequest.Order.BillingAddress.Address2);

            remotePostHelperData.Add("billing_address", postProcessPaymentRequest.Order.BillingAddress.Address1);
            remotePostHelperData.Add("billing_tel", postProcessPaymentRequest.Order.BillingAddress.PhoneNumber);
            remotePostHelperData.Add("billing_email", postProcessPaymentRequest.Order.BillingAddress.Email);

            remotePostHelperData.Add("billing_city", postProcessPaymentRequest.Order.BillingAddress.City);
            var billingStateProvince = postProcessPaymentRequest.Order.BillingAddress.StateProvince;

            remotePostHelperData.Add("billing_state", billingStateProvince != null ? billingStateProvince.Abbreviation : string.Empty);
            remotePostHelperData.Add("billing_zip", postProcessPaymentRequest.Order.BillingAddress.ZipPostalCode);
            var billingCountry = postProcessPaymentRequest.Order.BillingAddress.Country;

            remotePostHelperData.Add("billing_country", billingCountry != null ? billingCountry.Name : string.Empty);

            //Delivery details

            if (postProcessPaymentRequest.Order.ShippingStatus != ShippingStatus.ShippingNotRequired)
            {
                remotePostHelperData.Add("delivery_name", postProcessPaymentRequest.Order.ShippingAddress.FirstName);
                //remotePostHelperData.Add("delivery_address", postProcessPaymentRequest.Order.ShippingAddress.Address1 + " " + postProcessPaymentRequest.Order.ShippingAddress.Address2);
                remotePostHelperData.Add("delivery_address", postProcessPaymentRequest.Order.ShippingAddress.Address1);
                //   remotePostHelper.Add("delivery_cust_notes", string.Empty);
                remotePostHelperData.Add("delivery_tel", postProcessPaymentRequest.Order.ShippingAddress.PhoneNumber);
                remotePostHelperData.Add("delivery_city", postProcessPaymentRequest.Order.ShippingAddress.City);
                var deliveryStateProvince = postProcessPaymentRequest.Order.ShippingAddress.StateProvince;
                remotePostHelperData.Add("delivery_state", deliveryStateProvince != null ? deliveryStateProvince.Abbreviation : string.Empty);
                remotePostHelperData.Add("delivery_zip", postProcessPaymentRequest.Order.ShippingAddress.ZipPostalCode);
                var deliveryCountry = postProcessPaymentRequest.Order.ShippingAddress.Country;
                remotePostHelperData.Add("delivery_country", deliveryCountry != null ? deliveryCountry.Name : string.Empty);
            }

            remotePostHelperData.Add("Merchant_Param", _ccAvenuePaymentSettings.MerchantParam);

            var strPOSTData = string.Empty;

            foreach (var item in remotePostHelperData)
            {
                //strPOSTData = strPOSTData +  item.Key.ToLower() + "=" + item.Value.ToLower() + "&";
                strPOSTData = strPOSTData + item.Key.ToLower() + "=" + item.Value + "&";
            }

            try
            {
                var strEncPOSTData = _ccaCrypto.Encrypt(strPOSTData, _ccAvenuePaymentSettings.Key);
                remotePostHelper.Add("encRequest", strEncPOSTData);
                remotePostHelper.Add("access_code", _ccAvenuePaymentSettings.AccessCode);

                remotePostHelper.Post();
            }
            catch (Exception ep)
            {
                throw new Exception(ep.Message);
            }
        }
Exemplo n.º 12
0
        protected void btnSub_Click(object sender, EventArgs e)
        {
            Thread.Sleep(7000);

            if (DataAccess.DBAccess.CheckAddressForRequestNo(requestId) == 0)
            {
                return;
            }

            if (!string.IsNullOrEmpty(Request.QueryString["method"]) && Request.QueryString["method"] != "11" && Request.QueryString["method"] != "12" && Request.QueryString["method"] != "13" && Request.QueryString["method"] != "14")  //It is for online only - should not be called in offline. 11 means offf line
            {
                //It is for online only - should not be called in offline.
                foreach (var name in Request.Form.AllKeys)
                {
                    if (name != null)
                    {
                        if (!name.Contains("btnProcC") && !name.Contains("bll") && !name.Contains("txtLandMark") && !name.Contains("txtCompanyName") && !name.Contains("txtExistingUserName") && !name.Contains("txtFlat") && !name.Contains("txtStreet") && !name.Contains("txtBuilding") && !name.Contains("txtLocation") && !name.Contains("hdnEmail") && !name.Contains("btnSub"))
                        {
                            if (!name.Replace("ctl00$ContentPlaceHolder1$", "").StartsWith("_"))
                            {
                                ccaRequest = ccaRequest + name.Replace("ctl00$ContentPlaceHolder1$", "") + "=" + Request.Form[name] + "&";

                                /* Response.Write(name + "=" + Request.Form[name]);
                                 * Response.Write("</br>");*/
                            }
                        }
                    }
                }


                //if ( Request.QueryString["method"] == "11")//Off line
                //{
                //    Response.Redirect("ConfirmationPage.aspx?method=" + Request.QueryString["method"]+"&requestId"+Request.QueryString["requestId"]);
                //}
                //else
                //{
                //Online
                if (CommanAction.GetSession() != null)
                {
                    if (hdnEmail.Value != "")
                    {
                        ccaRequest = ccaRequest + "billing_email=" + hdnEmail.Value + "&"; //Note : last name is using like email id //((User)Session["USER"]).email + "&";
                    }
                    else
                    {
                        ccaRequest = ccaRequest + "billing_email=" + txtLastName.Value + "&"; //Note : last name is using like email id //((User)Session["USER"]).email + "&";
                    }
                }


                ccaRequest = ccaRequest + "billing_country=India&";
                ccaRequest = ccaRequest + "delivery_country=India&";

                strEncRequest = ccaCrypto.Encrypt(ccaRequest, workingKey);


                DBAccess.setPaymentAsFailed(requestId); //Online payment Mark it as failed

                Session.Remove("OrderList");
                //Deleting cookies
                if (Request.Cookies["ORDERLIST"] != null)
                {
                    HttpCookie myCookie = new HttpCookie("ORDERLIST");
                    myCookie.Expires = DateTime.Now.AddDays(-1d);
                    Response.Cookies.Add(myCookie);
                }
                if (Convert.ToInt32(ConfigurationManager.AppSettings["GoToPaymentGateway"]) == 1)
                {
                    Response.Redirect("ccavRequestHandler.aspx?ED=" + strEncRequest);
                }
                else
                {
                    Response.Redirect("Stub.aspx?requestId=" + requestId);
                    //window.location.href = "Stub.aspx?requestId=" + requestId;
                }

                // Response.Redirect("ccavRequestHandler.aspx?ED=" + strEncRequest);
                //window.location.href = "Stub.aspx?requestId=" + requestId;
                //}
            }
            else
            {
                Response.Redirect("ConfirmationPage.aspx?method=" + method + "&referanceNo=123&PaymentDone=0&requestId=" + requestId);

                //window.location = "ConfirmationPage.aspx?method=" + method + "&referanceNo=123&PaymentDone=0&requestId=" + requestId;

                //
            }
        }
Exemplo n.º 13
0
    public string strAccessCode = ConfigurationManager.AppSettings["AccessCode"];// put the access key in the quotes provided here.

    protected void Page_Load(object sender, EventArgs e)
    {
        //if (!IsPostBack)
        //{
        //    BindData();

        //    foreach (string name in Request.Form)
        //    {
        //        if (name != null)
        //        {
        //            if (!name.StartsWith("_"))
        //            {
        //                ccaRequest = ccaRequest + name + "=" + Request.Form[name] + "&";
        //                /* Response.Write(name + "=" + Request.Form[name]);
        //                  Response.Write("</br>");*/
        //            }
        //        }
        //    }
        //    strEncRequest = ccaCrypto.Encrypt(ccaRequest, workingKey);

        //    lb_Message.Text = "Wait... Redirecting to Payment Gateway.";
        //}
        //else
        //{
        //    lb_Message.Text = "Error on Payment Gateway. Kindly try again.";
        //}

        if (!IsPostBack)
        {
            string ResponseUrl = HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority) +
                                 HttpContext.Current.Request.ApplicationPath + "payment/ccavResponseHandler.aspx";

            lbltid.Text          = Session["Tid"].ToString();
            lblMerchantId.Text   = Convert.ToString(Session["MerchantId"]);
            lblOrderId.Text      = Convert.ToString(Session["OrderId"]);
            lblAmount.Text       = Convert.ToString(Session["TotalAmount"]);
            lblcurrency.Text     = Session["currency"].ToString();
            lblRedirectUrl.Text  = Convert.ToString(Session["redirecturl"]);
            lblCancelUrl.Text    = Convert.ToString(Session["cancelurl"]);
            lblCustomerName.Text = Convert.ToString(Session["cutomername"]);
            lblCustAddr.Text     = Convert.ToString(Session["BillingAddress"]);
            lblCustCity.Text     = Convert.ToString(Session["shipcity"]);
            lblCustState.Text    = Convert.ToString(Session["shipstate"]);
            lblZipCode.Text      = Convert.ToString(Session["shippincode"]);
            lblCustCountry.Text  = "INDIA";
            lblCustPhone.Text    = Convert.ToString(Session["BillingMobile"]);
            lblCustEmail.Text    = Convert.ToString(Session["CustEmailid"]);

            string Res       = ccaCrypto.getchecksum(lblMerchantId.Text, lblOrderId.Text, lblAmount.Text, ResponseUrl, workingKey);
            string ToEncrypt = "order_id=" + lblOrderId.Text + "&currency=" + lblcurrency.Text + "&amount=" + lblAmount.Text + "&merchant_id=" + lblMerchantId.Text + "&redirect_url=" + ResponseUrl + "&cancel_url=" + lblCancelUrl.Text + "&language=en" + "&checksum=" + Res + "&billing_name=" + lblCustomerName.Text + "&billing_address=" + lblCustAddr.Text + "&billing_city=" + lblCustCity.Text + "&billing_state=" + lblCustState.Text + "&billing_zip=" + lblZipCode.Text + "&billing_country=" + lblCustCountry.Text + "&billing_tel=" + lblCustPhone.Text + "&billing_email=" + lblCustEmail.Text;

            strEncRequest = ccaCrypto.Encrypt(ToEncrypt, workingKey);

            encRequest.Value  = strEncRequest;
            access_code.Value = strAccessCode;

            lb_Message.Text = "Wait... Redirecting to Payment Gateway.";
        }
        else
        {
            lb_Message.Text = "Error on Payment Gateway. Kindly try again.";
        }
    }
    protected void btncontinue_Click(object sender, EventArgs e)
    {
        try
        {
            if (Session["country_name"].ToString().ToLower() == "india")
            {
                transactiontype = hftransactiontype.Value.ToString();
                if (transactiontype.ToString() != string.Empty)
                {
                    BuyPackage();
                }
                else
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "msg", "alert('Please select transaction type.')", true);
                }
            }
            else
            {
                DataSet dsSettings = new DataSet();
                Teacher_Dashboard_BLogic obj_BAL_Teacher_Dashboard = new Teacher_Dashboard_BLogic();

                dsSettings = obj_BAL_Teacher_Dashboard.BAL_Select_CoveredUncoverChapterTopic_Settings("CCAvenue_access_code");
                string CCAvenue_access_code = dsSettings.Tables[0].Rows[0]["value"].ToString().Trim();

                dsSettings = obj_BAL_Teacher_Dashboard.BAL_Select_CoveredUncoverChapterTopic_Settings("CCAvenue_Working_key");
                string CCAvenue_Working_key = dsSettings.Tables[0].Rows[0]["value"].ToString().Trim();

                dsSettings = obj_BAL_Teacher_Dashboard.BAL_Select_CoveredUncoverChapterTopic_Settings("CCAvenue_merchant_id");
                string CCAvenue_merchant_id = dsSettings.Tables[0].Rows[0]["value"].ToString().Trim();

                dsSettings = obj_BAL_Teacher_Dashboard.BAL_Select_CoveredUncoverChapterTopic_Settings("CCAvenue_URL");
                string CCAvenue_URL = dsSettings.Tables[0].Rows[0]["value"].ToString().Trim();

                string    merchant_id   = CCAvenue_merchant_id;    //"99522";
                string    access_code   = CCAvenue_access_code;    //"AVFW65DE39BV30WFVB";
                string    Working_key   = CCAvenue_Working_key;    //"E85FE1783919FA34A4758580E844135A";
                string    amount        = PackagePrice.ToString(); //"1";
                string    requesturl    = "";
                string    ccaRequest    = "";
                CCACrypto ccaCrypto     = new CCACrypto();
                string    strEncRequest = "";
                //string redirect_url = "http://*****:*****@epath.net.in&delivery_name=Disha&merchant_param1=additional Info.&merchant_param2=additional Info.&merchant_param3=additional Info.&merchant_param4=additional Info.&merchant_param5=additional Info.&integration_type=iframe_normal&promo_code=&customer_identifier=&";
                PackagePrice  = Convert.ToDecimal(Session["PackagePrice"].ToString().Trim());
                TransactionID = GetTransactionID("CCAvenue");
                ccaRequest    = "tid=" + TransactionID + "&merchant_id=" + merchant_id + "&order_id=" + TransactionID + "&amount=" + PackagePrice + "&currency=" + Session["CurrencyType"].ToString() + "&redirect_url=" + redirect_url + "&cancel_url=" + cancel_url;

                strEncRequest = ccaCrypto.Encrypt(ccaRequest, Working_key);
                //requesturl = "https://secure.ccavenue.com/transaction/transaction.do?command=initiateTransaction&encRequest=" + strEncRequest + "&access_code=" + access_code;
                requesturl = CCAvenue_URL + strEncRequest + "&access_code=" + access_code;
                InsertIntoTransactionMaster("CCAvenue");
                Response.Redirect(requesturl, false);
            }
        }
        catch (Exception)
        {
        }
    }
Exemplo n.º 15
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            Message.Show = false;
            FeesXml      = "<NewDataSet>";

            foreach (GridViewRow gvr in dgvMemberOutstanding.Rows)
            {
                if (gvr.RowType == DataControlRowType.DataRow)
                {
                    FeesXml += "<Row";
                    FeesXml += "  FeesHeadId = \"" + dgvMemberOutstanding.DataKeys[gvr.RowIndex].Values["FeesHeadId"].ToString() + "\"";
                    FeesXml += "  FeesPaymentAmount = \"" + (string.IsNullOrEmpty(((TextBox)gvr.FindControl("txtFeesPaymentAmount")).Text.Trim()) ? "0" : ((TextBox)gvr.FindControl("txtFeesPaymentAmount")).Text.Trim()) + "\"";
                    FeesXml += "  TaxPaymentAmount = \"" + (string.IsNullOrEmpty(((TextBox)gvr.FindControl("txtTaxPaymentAmount")).Text.Trim()) ? "0" : ((TextBox)gvr.FindControl("txtTaxPaymentAmount")).Text.Trim()) + "\"";
                    FeesXml += " />";
                }
            }

            FeesXml += "</NewDataSet>";

            BusinessLayer.Common.MemberPayment objMemberPayment = new BusinessLayer.Common.MemberPayment();
            Entity.Common.MemberPayment        payment          = new Entity.Common.MemberPayment();
            payment.PaymentId   = PaymentId;
            payment.MemberId    = Convert.ToInt32(ddlMember.SelectedValue);
            payment.PaymentMode = ddlPaymentMode.SelectedValue;
            payment.PaymentDate = Convert.ToDateTime(txtPaymentDate.Text.Split('/')[2] + "-" + txtPaymentDate.Text.Split('/')[1] + "-" + txtPaymentDate.Text.Split('/')[0]);
            //if (Session["UserType"].ToString().Equals("Member")) { payment.PaymentAmount = PaymentAmount; }//PaymentAmount; }
            //else
            //{
            payment.PaymentAmount = Convert.ToDecimal(hdnAmount.Value.Trim());
            //}
            payment.Narration         = txtNarration.Text.Trim();
            payment.CreatedBy         = Convert.ToInt32(Session["UserId"].ToString());
            payment.CreatedByUserType = Session["UserType"].ToString();
            payment.CashBankLedgerId  = Convert.ToInt32(ddlCashBankLedger.SelectedValue);
            payment.FeesXml           = FeesXml;
            payment.IsExcelUpload     = false;

            if (Session["UserType"].ToString().Equals("Admin") || Session["UserType"].ToString().Equals("Agent"))
            {
                payment.IsApproved   = true;
                payment.ApprovedBy   = Convert.ToInt32(Session["UserId"].ToString());
                payment.ApprovedDate = DateTime.Now;
            }
            else
            {
                payment.IsApproved   = null;
                payment.ApprovedBy   = null;
                payment.ApprovedDate = null;
            }

            string strPaymentNo = objMemberPayment.Save(payment);

            PaymentId         = 0;
            txtPaymentNo.Text = strPaymentNo;

            LoadMemberOutstandingList();

            txtPaymentAmount.Text  = "0.00";
            txtPaymentDate.Enabled = true;
            txtNarration.Text      = "";
            LoadLedgerOpeningBalance();
            btnPrint.Visible  = true;
            Message.IsSuccess = true;
            Message.Text      = "Payment detail saved successfully";
            Message.Show      = true;

            if (Session["UserType"].ToString().Equals("Member") && ddlPaymentMode.SelectedItem.Text.ToUpper().Equals("ONLINE PAYMENT"))
            {
                //Response.Redirect(@"https://www.onlinesbi.com/prelogin/icollecthome.htm?corpid=649959");
                BusinessLayer.Common.MemberPayment ObjPayment  = new BusinessLayer.Common.MemberPayment();
                Entity.Common.PaymentGateway       paymentGate = new Entity.Common.PaymentGateway();
                paymentGate.PaymentId     = payment.PaymentId;
                paymentGate.MemberId      = payment.MemberId;
                paymentGate.MemberType    = "Member";
                paymentGate.OrderId       = GetAutoTransactionId();
                paymentGate.PaymentAmount = payment.PaymentAmount;
                paymentGate.Currency      = "INR";
                paymentGate.CreatedBy     = payment.CreatedBy;
                ObjPayment.PaymentResponseSave(paymentGate);//&tid=76023071
                string ccaRequest = "merchant_id=211354&order_id=" + paymentGate.OrderId + "&amount=" + payment.PaymentAmount + "&currency=INR&"
                                    + "redirect_url=http://accounts.wbpoultryfederation.org/ccavResponseHandler.aspx&cancel_url=http://accounts.wbpoultryfederation.org/MemberDefault.aspx&";
                //+ "redirect_url=http://localhost:1044/ccavResponseHandler.aspx&cancel_url=http://localhost:1044/ccavResponseHandler.aspx&";
                ccaRequest += "billing_name=" + ddlMember.SelectedItem.Text +
                              "&billing_address=46C, Chowringhee Road, 11th Floor, Room No - C&billing_city=Kolkata&billing_state=West Bengal&billing_zip=700071&billing_country=India&billing_tel=03365229085&[email protected]&"
                              + "delivery_name=" + ddlMember.SelectedItem.Text + "&delivery_address=46C, Chowringhee Road, 11th Floor, Room No - C&delivery_city=Kolkata&delivery_state=West Bengal&delivery_zip=700071&delivery_country=India&delivery_tel=03365229085"
                              + "&merchant_param1=" + payment.PaymentId + "&merchant_param2=" + payment.MemberId + "&merchant_param3=Member";
                string strEncRequest = ccaCrypto.Encrypt(ccaRequest, workingKey);
                Response.Redirect("../ccavRequestHandler.aspx?DATA=" + strEncRequest);
            }
            //ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "VariableRegisteration", "window.open('renewal-bill.aspx?PaymentNo=" + strPaymentNo + "','','height=600,width=1000')", true);
        }