public ActionResult Index() { EndModel end = new EndModel(); try { //Request.Headers["referer"] perform referer check CCACrypto ccaCrypto = new CCACrypto(); string encResponse = ccaCrypto.Decrypt(Request.Form["encResp"], ConfigurationConstants.CCAVENUE_WORKING_KEY); NameValueCollection Params = new NameValueCollection(); string[] segments = encResponse.Split('&'); foreach (string seg in segments) { string[] parts = seg.Split('='); if (parts.Length > 0) { string Key = parts[0].Trim(); string Value = parts[1].Trim(); Params.Add(Key, Value); } } var entitiesInfo = new ThbLoginContextEntity(null).ThbEntities; string txnId = Params["merchant_param1"]; var record = entitiesInfo.PaymentInfoes.FirstOrDefault(cc => cc.TxnId.Equals(txnId) && cc.Status.Equals("Initiated")); if (record == null) { end.Result = "Invalid Transaction"; return(View(end)); } end.TransactionNumber = txnId; record.Response = "Decrypted Response " + encResponse + " " + Request.Form.ToString(); record.ResponseTime = DateTime.Now; if (Params["order_status"] == "Success") { { record.Status = "Success"; end.Result = "Successfully performed payment"; //Hash value did not matched } } else { record.Status = "Failure"; end.Result = "Bank Payment Failure"; // osc_redirect(osc_href_link(FILENAME_CHECKOUT, 'payment' , 'SSL', null, null,true)); } entitiesInfo.SaveChanges(); SendEmail(record, Params); } catch (Exception ex) { Response.Write("<span style='color:red'>" + ex.Message + "</span>"); } return(View(end)); }
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}¤cy={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)); }
protected void Page_Load(object sender, EventArgs e) { string workingKey = "7D433FB0149712F58126D2E2CB59CC9C";//put in the 32bit alpha numeric key in the quotes provided here CCACrypto ccaCrypto = new CCACrypto(); string encResponse = ccaCrypto.Decrypt(Request.Form["encResp"], workingKey); NameValueCollection Params = new NameValueCollection(); string[] segments = encResponse.Split('&'); foreach (string seg in segments) { string[] parts = seg.Split('='); if (parts.Length > 0) { string Key = parts[0].Trim(); string Value = parts[1].Trim(); Params.Add(Key, Value); } } string constr = ConfigurationManager.ConnectionStrings["DB"].ConnectionString; SqlConnection cn = new SqlConnection(constr); cn.Open(); var ordID = Params["order_id"].ToString(); var trkID = Params["tracking_id"].ToString(); var bakRefno = Params["bank_ref_no"].ToString(); var ordstus = Params["order_status"].ToString(); var failmsg = Params["failure_message"].ToString(); var Pmod = Params["payment_mode"].ToString(); var Cname = Params["card_name"].ToString(); var stusCode = Params["status_code"].ToString(); var stsMsg = Params["status_message"].ToString(); var ResCode = Params["response_code"].ToString(); var Amount = Params["amount"].ToString(); var UserID = Params["merchant_param1"].ToString(); SqlCommand cmd = new SqlCommand("insert into UserOrderPaymenttbl(Orderid,TrackingId ,BankRefNo,OrderStatus,FailureMessage,PaymentMod,CardName,StatusCode,StatusMessage,ResponseCode,PaymentDate,Amount,UserId) values (@Orderid,@TrackingId ,@BankRefNo,@OrderStatus,@FailureMessage,@PaymentMod,@CardName,@StatusCode,@StatusMessage,@ResponseCode,@PaymentDate,@Amount,@UserId)", cn); cmd.Parameters.AddWithValue("@Orderid", ordID); cmd.Parameters.AddWithValue("@TrackingId", trkID); cmd.Parameters.AddWithValue("@BankRefNo", bakRefno); cmd.Parameters.AddWithValue("@OrderStatus", ordstus); cmd.Parameters.AddWithValue("@FailureMessage", failmsg); cmd.Parameters.AddWithValue("@PaymentMod", Pmod); cmd.Parameters.AddWithValue("@CardName", Cname); cmd.Parameters.AddWithValue("@StatusCode", stusCode); cmd.Parameters.AddWithValue("@StatusMessage", stsMsg); cmd.Parameters.AddWithValue("@ResponseCode", ResCode); cmd.Parameters.AddWithValue("@PaymentDate", System.DateTime.Now); cmd.Parameters.AddWithValue("@Amount", Amount); cmd.Parameters.AddWithValue("@UserId", UserID); cn.Open(); cn.Close(); }
protected void Page_Load(object sender, EventArgs e) { string workingKey = "79226183BBAE50766E8383CEA3FF089D";//put in the 32bit alpha numeric key in the quotes provided here CCACrypto ccaCrypto = new CCACrypto(); string encResponse = ccaCrypto.Decrypt(Request.Form["encResp"], workingKey); NameValueCollection Params = new NameValueCollection(); string[] segments = encResponse.Split('&'); foreach (string seg in segments) { string[] parts = seg.Split('='); if (parts.Length > 0) { string Key = parts[0].Trim(); string Value = parts[1].Trim(); Params.Add(Key, Value); } } for (int i = 0; i < Params.Count; i++) { //Response.Write(Params.Keys[i] + " = " + Params[i] + "<br>"); //Bank Transaction ViewState["order_id "] = Params[0].ToString(); ViewState["tracking_id"] = Params[1].ToString(); ViewState["bank_ref_no"] = Params[2].ToString(); ViewState["order_status"] = Params[3].ToString(); ViewState["failure_status"] = Params[4].ToString(); ViewState["payment_mode"] = Params[5].ToString(); ViewState["card_name"] = Params[6].ToString(); ViewState["status_code"] = Params[7].ToString(); ViewState["status_message"] = Params[8].ToString(); ViewState["currency"] = Params[9].ToString(); ViewState["amount"] = Params[10].ToString(); ////Billing Information ViewState["billing_name"] = Params[11].ToString(); ViewState["billing_address"] = Params[12].ToString(); ViewState["billing_city"] = Params[13].ToString(); ViewState["billing_state"] = Params[14].ToString(); ViewState["billing_zip"] = Params[15].ToString(); ViewState["billing_country"] = Params[16].ToString(); ViewState["billing_tel"] = Params[17].ToString(); ViewState["billing_email"] = Params[18].ToString(); //MessageBox(ViewState["card_name"].ToString().Trim()); PaymentSuccess(); Session["Ticket"] = "goTicket"; BindBankTransaction(); //Response.Redirect("Ticket.aspx"); Redirect(); } }
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))); }
public IPaymentResponse CcavenueResponseHandler(IGatewayCharge gatewayResponse) { //NameValueCollection nvcResponseQueryString = HttpUtility.ParseQueryString(gatewayResponse.QueryString); try { CCACrypto ccaCrypto = new CCACrypto(); NameValueCollection nvcEncResponse = HttpUtility.ParseQueryString(gatewayResponse.QueryString); var encResponseValue = nvcEncResponse["encResp"]; string encResponse = ccaCrypto.Decrypt(encResponseValue, _settings.GetConfigSetting <string>(SettingKeys.PaymentGateway.Ccavenue.WorkingKey)); NameValueCollection nvcResponseQueryString = new NameValueCollection(); string[] segments = encResponse.Split('&'); foreach (string seg in segments) { string[] parts = seg.Split('='); if (parts.Length > 0) { string Key = parts[0].Trim(); string Value = parts[1].Trim(); nvcResponseQueryString.Add(Key, Value); } } var orderId = nvcResponseQueryString["order_id"]; var paymentConfirmationNumber = nvcResponseQueryString["tracking_id"]; var orderStatus = nvcResponseQueryString["order_status"]; var statusMessage = nvcResponseQueryString["status_message"]; var amount = nvcResponseQueryString["amount"]; var paymentMode = nvcResponseQueryString["payment_mode"]; bool payStatus = orderStatus.ToUpper().Equals("SUCCESS") && !paymentConfirmationNumber.ToUpper().Equals("FAIL") && !string.IsNullOrWhiteSpace(paymentConfirmationNumber); if (payStatus) { _transactionStatusUpdater.UpdateTranscationStatus(Convert.ToInt64(orderId)); } _transactionPaymentDetailRepository.Save(new TransactionPaymentDetail { TransactionId = Convert.ToInt64(orderId), PaymentOptionId = paymentMode == "Net Banking" ? PaymentOptions.NetBanking : PaymentOptions.CashCard, PaymentGatewayId = PaymentGateway.CCAvenue, RequestType = "Charge Recieved", Amount = amount != null ? amount.ToString() : "", PayConfNumber = paymentConfirmationNumber, PaymentDetail = "{\"Response\":" + Newtonsoft.Json.JsonConvert.SerializeObject(nvcResponseQueryString.AllKeys.ToDictionary(k => k, k => nvcResponseQueryString[k])) + ",\"encRepsonse\":" + encResponseValue + "}", }); return(GetPaymentResponse(payStatus, payStatus ? PaymentGatewayError.None : GetPaymentGatewayErrorCode(string.IsNullOrWhiteSpace(statusMessage) ? "Transaction declined" : statusMessage))); } catch (Exception ex) { _logger.Log(LogCategory.Error, new Exception("Failed to process transaction", ex)); return(GetPaymentResponse(false, GetPaymentGatewayErrorCode(ex.Message))); } }
public CCAvenuePaymentProcessor(CCAvenuePaymentSettings ccAvenuePaymentSettings, ISettingService settingService, ICurrencyService currencyService, CurrencySettings currencySettings, IWebHelper webHelper) { this._ccAvenuePaymentSettings = ccAvenuePaymentSettings; this._settingService = settingService; this._currencyService = currencyService; this._currencySettings = currencySettings; this._webHelper = webHelper; this._ccaCrypto = new CCACrypto(); }
protected void Page_Load(object sender, EventArgs e) { string workingKey = "990827E4ED2713286AB108526ABB8B5B";//production //string workingKey = "990827E4ED2713286AB108526ABB8B5B";//testing CCACrypto ccaCrypto = new CCACrypto(); encResponse = ccaCrypto.Decrypt(Request.Form["encResp"], workingKey); NameValueCollection Params = new NameValueCollection(); string[] segments = encResponse.Split('&'); foreach (string seg in segments) { string[] parts = seg.Split('='); if (parts.Length > 0) { string Key = parts[0].Trim(); string Value = parts[1].Trim(); Params.Add(Key, Value); } } for (int i = 0; i < Params.Count; i++) { Response.Write(Params.Keys[i] + " = " + Params[i] + "<br>"); } if (Params.Get("merchant_param1") == "Restaurateur Payment") { string URI = "http://ellamey.online/"; string myParameters = string.Format("api/UpdateRestaurantOrderResponse/{0}/{1}/{2}/{3}", Params.Get("order_id"), Params.Get("tracking_id"), Params.Get("bank_ref_no"), Params.Get("order_status")); using (HttpClient client = new HttpClient()) { client.BaseAddress = new Uri(URI); var response = client.PutAsync(myParameters, null).Result; Response.Write(response); } } else if (Params.Get("merchant_param1") == "Grocer Payment") { string URI = "http://ellamey.online/"; string myParameters = string.Format("api/UpdateGroceryOrderResponse/{0}/{1}/{2}/{3}", Params.Get("order_id"), Params.Get("tracking_id"), Params.Get("bank_ref_no"), Params.Get("order_status")); using (HttpClient client = new HttpClient()) { client.BaseAddress = new Uri(URI); var response = client.PutAsync(myParameters, null).Result; Response.Write(response); } } }
protected void Page_Load(object sender, EventArgs e) { string workingKey = "450273C40E328E5C121E04A20281F3E7";//put in the 32bit alpha numeric key in the quotes provided here CCACrypto ccaCrypto = new CCACrypto(); string res = "0dc0792dac490e63e124ae9d786087dfa3bee306b0b1448b8e7155c66c77b44c60f192a4f5f135208ef3ad261d2c7ca1d32fff366467f40761798c84e2aa1a54ce8820ccb6a047cfd771878374546831da73454e9a03b8bff857f4a9fa9b8999359b576dcda801dcb1e6085288cf9631c2b17a86b9b1f6f537e05374b3d3855fe726cb2d92c07d743f3a0ddc3ff971b1a0ec37489f5397ea2d82023dfbe5cfbb7552643ae9189ad6b1b06915851432897b6698b6e613e0f818bfb0217a406e6cb412fce68ef9de912d9f7ff3c1e8b4975ae30f2ad4ef35c29ca925284297d6e802dbfdaf37b7740b0935ef158985e64cfa40c591ea1ffbaa30927eb2bfb6d2318f753e250c5cff0ec142017cc48a9f09db966d92f7fd3d13c2acbb090d0177212e57ed871dc714fbc0fd26efae80d7f24e1a2a0c7d356d0cbbbe1e219b7e5e9dd4102be6a261d54d9d3a4718578dde3e44195c3732782dddc51bf4b39d91806a90804313d14e60f01640788d4916f304c6d02b05b816c97502065732ff680e05fafffa74f27c891f9bfbadf29414cac6a89e2314dcb1176bd9697e01a4672f24b5695f1926329e6285a9e74fc665bcdde1970b6e5ac03f8735d999cd409608bbd5a859580d57edab3989b8767d5dc267518464cd68a933859ea8e3188b79e41c7f7d5366ccdb6b8212d67073fcdcd31f78f8e9fe1c2eea5b3100a75b2daf0f05cbedd0df694751682ee7f9ed22f5f83673d93bc1140451fd4a540c92f9c4b5451efb36a0b79d64d4f83d33f398950e009f1991198c1750cfe6c434d9cac9221d489fabf5daef97851844a166fd8ccacc0f7035cae15bf67b95de13e0b30ee345fd94d5535bfbf445595b35728c007ca176df964e0c76f9dc612f00a229483b42d2ac537f8289834593811baea58a9def51796883c03e6550463b8a55f09d8873a52c22616edb0cb05a8a54c4d079f17949430204e6770349a5359f3ec318474ef06abb534efa7856318595a4f7dda3a3"; string encResponse = ccaCrypto.Decrypt(res, workingKey); //string encResponse = ccaCrypto.Decrypt(Request.Form["encResp"],workingKey); NameValueCollection Params = new NameValueCollection(); string[] segments = encResponse.Split('&'); foreach (string seg in segments) { string[] parts = seg.Split('='); if (parts.Length > 0) { string Key = parts[0].Trim(); string Value = parts[1].Trim(); Params.Add(Key, Value); } } //My Code start if (Params.Count > 0) { string orderid = Params["order_id"]; int paymentStatus = GetStatusNo(Params["order_status"].ToUpper()); int paymentMethod = GetPaymentMethodID(Params["payment_mode"].ToUpper()); string bankrefno = Params["bank_ref_no"]; string card_name = Params["card_name"]; string biling_name = Params["billing_name"]; OrderManagement.SavePayemt(Convert.ToInt32(orderid), paymentStatus, paymentMethod, card_name, bankrefno, biling_name); var paymentResponse = new PaymentResponse { RequestId = orderid, PaymentDone = paymentStatus.ToString(), PaymentMethod = paymentMethod.ToString(), customerId = Params["customer_id"] }; Session["PaymentResponse"] = paymentResponse; DBAccess.CreateSession(Params["billing_email"]); Response.Redirect("ConfirmationPage.aspx"); } //My Code end //for (int i = 0; i < Params.Count; i++) //{ // Response.Write(Params.Keys[i] + " = " + Params[i] + "<br>"); //} }
protected void Page_Load(object sender, EventArgs e) { string workingKey = "9237F8E78FF96C00C023857A825C0056";//put in the 32bit alpha numeric key in the quotes provided here CCACrypto ccaCrypto = new CCACrypto(); string encResponse = ccaCrypto.Decrypt(Request.Form["encResp"], workingKey); NameValueCollection Params = new NameValueCollection(); string[] segments = encResponse.Split('&'); foreach (string seg in segments) { string[] parts = seg.Split('='); if (parts.Length > 0) { string Key = parts[0].Trim(); string Value = parts[1].Trim(); Params.Add(Key, Value); } } String temp = Session["ItemsSelected"].ToString(); Dictionary<String, int> items = new Dictionary<string, int>(); foreach (String s in temp.Split(',')) { string[] parts = s.Split('='); if (parts.Length > 0) { string Key = parts[0].Trim(); string Value = parts[1].Trim(); items.Add(Key, int.Parse(Value)); } } String res = Params["order_status"].ToString(); if(res=="Success") orderstatus.InnerText = "Congratulation Your Order has successfully been received!"; else if(res=="Failure") orderstatus.InnerText = "Order Failed ! Retry"; else orderstatus.InnerText = "Invalid Order !"; if (res == "Success") { Response.Write("<table>"); for (int i = 0; i < Params.Count; i++) { // Response.Write(Params.Keys[i] + " = " + Params[i] + "<br>"); } Response.Write("</table>"); } }
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 ActionResult PaymentSuccessful(string encResp) { var decryption = new CCACrypto(); var decryptedParameters = decryption.Decrypt(encResp, WorkingKey); var keyValuePairs = decryptedParameters.Split('&'); var splittedKeyValuePairs = new Dictionary <string, string>(); foreach (var value in keyValuePairs) { var keyValuePair = value.Split('='); splittedKeyValuePairs.Add(keyValuePair[0], keyValuePair[1]); } //Here you can check the consistency of data i.e what you send is what you get back, //Make sure its not corrupted.... //After that Save the details of the transaction into a db if you want to... //I am just returning the data I got back... return(View(splittedKeyValuePairs)); }
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); }
protected void Page_Load(object sender, EventArgs e) { string workingKey = "";//put in the 32bit alpha numeric key in the quotes provided here CCACrypto ccaCrypto = new CCACrypto(); string encResponse = ccaCrypto.Decrypt(Request.Form["encResp"], workingKey); NameValueCollection Params = new NameValueCollection(); string[] segments = encResponse.Split('&'); foreach (string seg in segments) { string[] parts = seg.Split('='); if (parts.Length > 0) { string Key = parts[0].Trim(); string Value = parts[1].Trim(); Params.Add(Key, Value); } } for (int i = 0; i < Params.Count; i++) { Response.Write(Params.Keys[i] + " = " + Params[i] + "<br>"); } }
protected void Page_Load(object sender, EventArgs e) { CCAvanueConfiguration lCCAvanueConfiguration = PaymentClass.Get_CCAvenue_Configuration(); CCACrypto ccaCrypto = new CCACrypto(); string encResponse = ccaCrypto.Decrypt(Request.Form["encResp"], lCCAvanueConfiguration.Working_Key); Dictionary <string, string> parameters = new Dictionary <string, string>(); //NameValueCollection Params = new NameValueCollection(); string[] segments = encResponse.Split('&'); foreach (string seg in segments) { string[] parts = seg.Split('='); if (parts.Length > 0) { string Key = parts[0].Trim(); string Value = parts[1].Trim(); parameters.Add(Key, Value); } } Create_CC_Payment(parameters); }
protected void Page_Load(object sender, EventArgs e) { string workingKey = "9237F8E78FF96C00C023857A825C0056";//put in the 32bit alpha numeric key in the quotes provided here CCACrypto ccaCrypto = new CCACrypto(); string encResponse = ccaCrypto.Decrypt(Request.Form["encResp"],workingKey); NameValueCollection Params = new NameValueCollection(); string[] segments = encResponse.Split('&'); String orderstatus = ""; foreach (string seg in segments) { string[] parts = seg.Split('='); if (parts.Length > 0) { string Key = parts[0].Trim(); string Value = parts[1].Trim(); if (Key == "order_status") orderstatus = Key; Params.Add(Key, Value); } } // order id tracking id failure msg payment mode name on card // delivary add // billing add // if(orderstatus.ToLower() == "success") // SUCCESSFUL ORDER { String orderid = "", contactno = "", paymentmode = "", name = "", currency = "", amount = "", month, year, date; int tracker = -1; ; StringBuilder billingaddress, delivaryaddress, otherdetails; StringBuilder responseObj, items; responseObj = new StringBuilder(); billingaddress = new StringBuilder(); delivaryaddress = new StringBuilder(); otherdetails = new StringBuilder(); // Processing Response month = DateTime.Now.Month.ToString(); date = DateTime.Now.Date.ToString(); year = DateTime.Now.Year.ToString(); for (int i = 0; i < Params.Count; i++) { //Response.Write(Params.Keys[i] + " = " + Params[i] + "<br>"); responseObj.Append("[" + Params.Keys[i] + "]:[" + Params[i] + "]"); responseObj.Append(","); if (Params.Keys[i].Contains("billing")) { if (Params.Keys[i].Contains("name")) name = Params[i]; else if (Params.Keys[i].Contains("tel")) contactno = Params[i]; else billingaddress.Append(Params[i] + ","); } else if (Params.Keys[i].Contains("billing")) { billingaddress.Append(Params[i] + ","); } else { if (Params.Keys[i] == "order_id") orderid = Params[i]; else if (Params.Keys[i] == "tracking_id") tracker = int.Parse(Params[i]); else if (Params.Keys[i] == "currency") currency = Params[i]; else if (Params.Keys[i] == "amount") amount = Params[i]; else if (Params.Keys[i] == "payment_mode") paymentmode = Params[i]; else { otherdetails.Append(Params.Keys[i] + ":" + Params[i]); } } } DataTable itemsoncart = (DataTable)Session["CurrentCart"]; // Processing items // name , qty , final-uc items = new StringBuilder(); String q = "Insert into OrderedProductList (OrderId,ProductName,Quantity,UnitPrice) Values(@a,@b,@c,@d)"; SqlConnection c = new SqlConnection(new ProjectUtilities().cons()); SqlCommand com = new SqlCommand(q, c); com.Parameters.AddWithValue("@a", orderid); try { c.Open(); foreach (DataRow r in itemsoncart.Rows) { String names = r.Field<String>(1); items.Append(names); items.Append(","); com.Parameters.AddWithValue("@b", names); names = r.Field<double>(2).ToString("N2"); com.Parameters.AddWithValue("@d", names); names = r.Field<int>(3).ToString(); com.Parameters.AddWithValue("@c", names); int b = com.ExecuteNonQuery(); if (b == 0) { // issue throw new Exception(); } } } catch (Exception expc) { // sends email of the entire transaction as a proof ProjectUtilities o = new ProjectUtilities(); o.sendError(expc); o.sendMail(encResponse); } finally { c.Close(); } // add to order table SqlCommand c2 = new SqlCommand(q, c); q = @"INSERT INTO Orders (OrderId,BillingAddress,DeliveryAddress,ContactNo,Payment_Mode,Name,Currency,Amount,Tracking_Id,Response,Month,Year,Items) VALUES (@a, @b, @c, @d, @e, @f, @g, @h ,@i, @j, @k, @l, @m)"; c2.Parameters.AddWithValue("@a", orderid); c2.Parameters.AddWithValue("@b", billingaddress.ToString()); c2.Parameters.AddWithValue("@c", delivaryaddress.ToString()); c2.Parameters.AddWithValue("@d", contactno); c2.Parameters.AddWithValue("@e", paymentmode); c2.Parameters.AddWithValue("@f", name); c2.Parameters.AddWithValue("@g", currency); c2.Parameters.AddWithValue("@h", amount); c2.Parameters.AddWithValue("@i", tracker.ToString()); c2.Parameters.AddWithValue("@j", encResponse); c2.Parameters.AddWithValue("@k", month); c2.Parameters.AddWithValue("@l", year); c2.Parameters.AddWithValue("@m", items.ToString()); int added = c2.ExecuteNonQuery(); if(added == 0) { new ProjectUtilities().sendMail("Data Not recorderd ! "+encResponse); } else { new ProjectUtilities().sendMail("New Order : "+encResponse); } } else if(orderstatus.ToLower() == "failure") { new ProjectUtilities().sendMail(encResponse); Response.Redirect("Failed.aspx"); } else if(orderstatus.ToLower() == "aborted") { new ProjectUtilities().sendMail(encResponse); Response.Redirect("Index.aspx"); } else { new ProjectUtilities().sendMail(encResponse); Response.Redirect("Index.aspx"); } }
public TransactionProvider Get(string queryString) { TransactionProvider transactionProvider = new TransactionProvider(); try { var nvcResponseQueryString = HttpUtility.ParseQueryString(queryString); // Custom redirects if (nvcResponseQueryString.AllKeys.Contains("gateway")) { var isValid = Enum.TryParse <PaymentGateway>(nvcResponseQueryString["gateway"], out PaymentGateway gateway); if (isValid) { if (gateway == PaymentGateway.Stripe) { var orderId = nvcResponseQueryString["orderId"]; transactionProvider.TransactionId = !string.IsNullOrWhiteSpace(orderId) ? Convert.ToInt64(orderId) : 0; transactionProvider.PaymentGateway = PaymentGateway.Stripe; transactionProvider.Token = nvcResponseQueryString["source"]; return(transactionProvider); } } } // NAB Transact if (nvcResponseQueryString.AllKeys.Contains("refid")) { string orderId = nvcResponseQueryString["refid"]; transactionProvider.TransactionId = !string.IsNullOrWhiteSpace(orderId) ? Convert.ToInt64(orderId) : 0; transactionProvider.PaymentGateway = PaymentGateway.NabTransact; return(transactionProvider); } // CCAvenue if (nvcResponseQueryString.AllKeys.Contains("encResp")) { CCACrypto ccaCrypto = new CCACrypto(); var encResponseValue = nvcResponseQueryString["encResp"]; string encResponse = ccaCrypto.Decrypt(encResponseValue, _settings.GetConfigSetting <string>(SettingKeys.PaymentGateway.Ccavenue.WorkingKey)); NameValueCollection nvcQueryString = new NameValueCollection(); string[] segments = encResponse.Split('&'); foreach (string seg in segments) { string[] parts = seg.Split('='); if (parts.Length > 0) { string Key = parts[0].Trim(); string Value = parts[1].Trim(); nvcQueryString.Add(Key, Value); } } string orderId = nvcQueryString["order_id"]; transactionProvider.TransactionId = !string.IsNullOrWhiteSpace(orderId) ? Convert.ToInt64(orderId) : 0; transactionProvider.PaymentGateway = PaymentGateway.CCAvenue; return(transactionProvider); } // HDFC if (nvcResponseQueryString.AllKeys.Contains("PaRes")) { var paymentId = nvcResponseQueryString["MD"]; var paymentAuthenticationResponse = nvcResponseQueryString["PaRes"]; var response = HdfcChargerHelper.HttpWebRequestHandler(_settings.GetConfigSetting <string>(SettingKeys.PaymentGateway.Hdfc.PayerAuthenticationUrl), GetHdfcEnrolledRequest(paymentId, paymentAuthenticationResponse)); var orderId = HdfcChargerHelper.GetResultField(response, "trackid"); return(new TransactionProvider { TransactionId = !string.IsNullOrWhiteSpace(orderId) ? Convert.ToInt64(orderId) : 0, Response = response, PaymentGateway = PaymentGateway.HDFC }); } if (transactionProvider.TransactionId == 0) { _logger.Log(Logging.Enums.LogCategory.Warn, "Payment method not found.", new Dictionary <string, object> { ["QueryString"] = queryString }); } } catch (Exception ex) { _logger.Log(Logging.Enums.LogCategory.Error, ex); } return(new TransactionProvider()); }
protected void Page_Load(object sender, EventArgs e) { try { CCACrypto ccaCrypto; lectureURL = ConfigurationManager.AppSettings["LectureURL"].ToString(); if (Request.Form["encResp"] != null) { ccaCrypto = new CCACrypto(); workingKey = ConfigurationManager.AppSettings["WorkingKey"].ToString(); //"580B9D14C245D159DD3AEF9FBAC35360";//put in the 32bit alpha numeric key in the quotes provided here success_order_Status = ConfigurationManager.AppSettings["SuccessOrderStatus"].ToString(); //Label3.Text = Request.Form["encResp"].ToString(); encResponse = ccaCrypto.Decrypt(Request.Form["encResp"], workingKey); NameValueCollection Params = new NameValueCollection(); string[] segments = encResponse.Split('&'); foreach (string seg in segments) { string[] parts = seg.Split('='); if (parts.Length > 0) { string Key = parts[0].Trim(); string Value = parts[1].Trim(); Params.Add(Key, Value); } } string res = string.Empty; for (int i = 0; i < Params.Count; i++) { res += Params.Keys[i] + " = " + Params[i] + "===##==="; if (Params.Keys[i].ToString().Trim().ToLower().Equals("order_id")) { //Label3.Text = "Tracking Id: " + Params[i].ToString(); guid = Params[i].ToString(); } if (Params.Keys[i].ToString().Trim().ToLower().Equals("tracking_id")) { //Label3.Text = "Tracking Id: " + Params[i].ToString(); transaction_Id = Params[i].ToString(); } if (Params.Keys[i].ToString().Trim().ToLower().Equals("status_message")) { //Label1.Text = "Status Message: " + Params[i].ToString(); transaction_Status = Params[i].ToString(); } if (Params.Keys[i].ToString().Trim().ToLower().Equals("order_status")) { //Label1.Text = "Status Message: " + Params[i].ToString(); order_Status = Params[i].ToString(); } } if (!String.IsNullOrWhiteSpace(guid) && !String.IsNullOrWhiteSpace(transaction_Id) && !String.IsNullOrWhiteSpace(transaction_Status) && !String.IsNullOrWhiteSpace(order_Status)) { if (order_Status.Trim().ToLower().Equals(success_order_Status.ToLower())) { // Update column Is_Active to true in User_Course BusinessLayer businessLayer = new BusinessLayer(); noOfActivatedCourse = businessLayer.ActivateUserCourse(guid, transaction_Id, transaction_Status, order_Status); if (noOfActivatedCourse > 0) { lectureURL = lectureURL + "success/" + guid; Response.Redirect(lectureURL, true); } } else { //lectureURL += "fail" + "/1/guid:" + guid + "###/### transaction_Id:" + transaction_Id + "###/### transaction_Status:" + transaction_Status + "###/### order_Status:" + order_Status; lectureURL = lectureURL + "fail/" + guid; Response.Redirect(lectureURL, true); } } else { lectureURL = lectureURL + "fail/" + guid; Response.Redirect(lectureURL, true); } } else { lectureURL = lectureURL + "fail/" + guid; Response.Redirect(lectureURL, true); } } catch (Exception ex) { lectureURL = lectureURL + "fail/" + guid; //Response.Redirect(lectureURL, true); } }
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); }
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 + "¤cy=" + 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) { } }
public ActionResult Return() { var processor = _paymentService.LoadPaymentMethodBySystemName("Payments.CCAvenue") as CCAvenuePaymentProcessor; if (processor == null || !processor.IsPaymentMethodActive(_paymentSettings) || !processor.PluginDescriptor.Installed) { throw new NopException("CCAvenue module cannot be loaded"); } //assign following values to send it to verifychecksum function. if (string.IsNullOrWhiteSpace(_ccAvenuePaymentSettings.Key)) { throw new NopException("CCAvenue key is not set"); } var workingKey = _ccAvenuePaymentSettings.Key; var ccaCrypto = new CCACrypto(); var encResponse = ccaCrypto.Decrypt(Request.Form["encResp"], workingKey); var paramList = new NameValueCollection(); var segments = encResponse.Split('&'); foreach (var seg in segments) { var parts = seg.Split('='); if (parts.Length <= 0) { continue; } paramList.Add(parts[0].Trim(), parts[1].Trim()); } for (var i = 0; i < paramList.Count; i++) { var data = Encoding.UTF8.GetBytes(paramList.Keys[i] + " = " + paramList[i] + "<br>"); Response.Body.Write(data, 0, data.Length); } var orderId = paramList["Order_Id"]; var authDesc = paramList["order_status"]; //var merchantId = Params["Merchant_Id"]; //var Amount = Params["Amount"]; //var myUtility = new CCAvenueHelper(); //var checksum = myUtility.verifychecksum(merchantId, orderId, Amount, AuthDesc, _ccAvenuePaymentSettings.Key, checksum); switch (authDesc) { case "Success": //here you need to put in the routines for a successful transaction such as sending an email to customer, //setting database status, informing logistics etc etc var order = _orderService.GetOrderById(Convert.ToInt32(orderId)); if (_orderProcessingService.CanMarkOrderAsPaid(order)) { _orderProcessingService.MarkOrderAsPaid(order); } //thank you for shopping with us. Your credit card has been charged and your transaction is successful return(RedirectToRoute("CheckoutCompleted", new { orderId = order.Id })); case "Failure": //here you need to put in the routines for a failed transaction such as sending an email to customer //setting database status etc etc return(Content("Thank you for shopping with us. However, the transaction has been declined")); } //Commented this block as their is no Batch Processing in New CCAvenue API //if ((checksum == "true") && (AuthDesc == "B")) //{ // //here you need to put in the routines/e-mail for a "Batch Processing" order. // //This is only if payment for this transaction has been made by an American Express Card // //since American Express authorisation status is available only after 5-6 hours by mail from ccavenue and at the "View Pending Orders" // return Content("Thank you for shopping with us. We will keep you posted regarding the status of your order through e-mail"); //} //else //{ // //here you need to simply ignore this and dont need to perform any operation in this condition // return Content("Security Error. Illegal access detected"); //} return(Content("Security Error. Illegal access detected")); }
protected void CCAvenueTransation() { try { 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_Working_key"); string CCAvenue_Working_key = dsSettings.Tables[0].Rows[0]["value"].ToString().Trim(); string Working_key = CCAvenue_Working_key; CCACrypto ccaCrypto = new CCACrypto(); string encResponse = ccaCrypto.Decrypt(Request.Form["encResp"], Working_key); NameValueCollection Params = new NameValueCollection(); string[] segments = encResponse.Split('&'); foreach (string seg in segments) { string[] parts = seg.Split('='); if (parts.Length > 0) { string Key = parts[0].Trim(); string Value = parts[1].Trim(); Params.Add(Key, Value); } } string order_id = Params["order_id"]; string tracking_id = Params["tracking_id"]; string bank_ref_no = Params["bank_ref_no"]; string order_status = Params["order_status"]; string failure_message = Params["failure_message"]; string payment_mode = Params["payment_mode"]; string card_name = Params["card_name"]; string status_code = Params["status_code"]; string status_message = Params["status_message"]; string currency = Params["currency"]; string amount = Params["amount"]; string billing_name = Params["billing_name"]; string billing_address = Params["billing_address"]; string billing_city = Params["billing_city"]; string billing_state = Params["billing_state"]; string billing_zip = Params["billing_zip"]; string billing_country = Params["billing_country"]; string billing_tel = Params["billing_tel"]; string billing_email = Params["billing_email"]; string delivery_name = Params["delivery_name"]; string delivery_address = Params["delivery_address"]; string delivery_city = Params["delivery_city"]; string delivery_state = Params["delivery_state"]; string delivery_zip = Params["delivery_zip"]; string delivery_country = Params["delivery_country"]; string delivery_tel = Params["delivery_tel"]; string merchant_param1 = Params["merchant_param1"]; string merchant_param2 = Params["merchant_param2"]; string merchant_param3 = Params["merchant_param3"]; string merchant_param4 = Params["merchant_param4"]; string merchant_param5 = Params["merchant_param5"]; string vault = Params["vault"]; string offer_type = Params["offer_type"]; string offer_code = Params["offer_code"]; string discount_value = Params["discount_value"]; string mer_amount = Params["mer_amount"]; string eci_value = Params["eci_value"]; string retry = Params["retry"]; string response_code = Params["response_code"]; PPackage = new Package(); PPackage.TransactionID = order_id; PPackage.PaymentGateway = "CCAvenue"; PPackage.PaymentMode = payment_mode; PPackage.CardName = card_name; PPackage.CCAvenueStatusCode = status_code; PPackage.Currency = currency; PPackage.Country = billing_country; PPackage.Vault = vault; PPackage.OfferType = offer_type; PPackage.OfferCode = offer_code; PPackage.Discount = Convert.ToDecimal(discount_value); PPackage.MerchantAmount = Convert.ToDecimal(mer_amount); PPackage.ECIValue = eci_value; PPackage.Retry = retry; PPackage.ResponseCode = response_code; if (order_status.ToUpper().Trim() != "FAILURE" && order_status.ToUpper().Trim() != "ABORTED") { lblthankyou.Text = " Thank You "; lblthankyou.ForeColor = System.Drawing.Color.Black; lblmessage1.Text = " Your Transaction is successfull Please note down your Transaction number for further use. "; lbltransactionnumber.Text = "Your Transaction Number is: " + order_id; order_id = Session["TransactionID"].ToString(); Blogic_Package = new Package_BLogic(); PPackage = new Package(); DataTable dt = (DataTable)(Session["SelectedPackage"]); for (int i = 0; i < dt.Rows.Count; i++) { PPackage.PackageFD_ID = Convert.ToInt64(dt.Rows[i]["PackageID"].ToString()); PPackage.StudentID = AppSessions.StudentID; PPackage.PackageActivationDate = Convert.ToDateTime(dt.Rows[i]["ActivateOn"].ToString()); PPackage.EndDate = Convert.ToDateTime(dt.Rows[i]["ExpiryDate"].ToString()); PPackage.TransactionID = order_id.ToString(); Blogic_Package.BAL_Student_Package_Insert(PPackage); } PPackage = new Package(); PPackage.TransactionID = order_id; PPackage.Status = order_status; PPackage.InvoiceID = GetInvoiceID(); Blogic_Package.BAL_Student_Package_Update_TransactionMaster(PPackage, "Transaction is successfull", tracking_id, "CCAvenue", "", bank_ref_no, delivery_name, billing_email, billing_tel, billing_address, "", "", ""); SendTransactionDetails(BuildEmailBody("Epathshala", delivery_name, billing_tel, billing_email, Convert.ToDecimal(amount), card_name, DateTime.Now.ToString("dd-MMM-yyyy hh:mm:ss"), order_status.ToString(), order_id, tracking_id)); Response.AddHeader("REFRESH", "10;URL=../Report/StudentPackageReport.aspx"); } else if (order_status.ToUpper().Trim() == "ABORTED") { lblthankyou.ForeColor = System.Drawing.Color.Black; lblmessage1.Text = " You have cancelled transaction."; Blogic_Package = new Package_BLogic(); PPackage.Status = order_status; Blogic_Package.BAL_Student_Package_Update_TransactionMaster(PPackage, "Transaction cancelled by user.", tracking_id, "CCAvenue", "", bank_ref_no, delivery_name, billing_email, billing_tel, billing_address, "", "", ""); SendTransactionDetails(BuildEmailBody("Epathshala", AppSessions.UserName, Session["MobileNumber"].ToString(), AppSessions.LoginID, Convert.ToDecimal(amount), card_name, DateTime.Now.ToString("dd-MMM-yyyy hh:mm:ss"), "Transaction cancelled by user.", order_id, tracking_id)); RedirectPage(); //Response.AddHeader("REFRESH", "10;URL=../Dashboard/StudentDashboard.aspx"); } else { lblthankyou.Text = " Sorry for inconvenience "; lblthankyou.ForeColor = System.Drawing.Color.Red; lblmessage1.Text = "Transaction is not successful please try again...."; lblmessage1.ForeColor = System.Drawing.Color.Red; Blogic_Package = new Package_BLogic(); PPackage.TransactionID = order_id; PPackage.Status = order_status; //PPackage.InvoiceID = GetInvoiceID(); Blogic_Package.BAL_Student_Package_Update_TransactionMaster(PPackage, "Transaction is not successful", tracking_id, "CCAvenue", "", bank_ref_no, delivery_name, billing_email, billing_tel, billing_address, "", "", ""); SendTransactionDetails(BuildEmailBody("Epathshala", delivery_name, billing_tel, billing_email, Convert.ToDecimal(amount), card_name, DateTime.Now.ToString("dd-MMM-yyyy hh:mm:ss"), "Fail", order_id, tracking_id)); RedirectPage(); //Response.AddHeader("REFRESH", "10;URL=SelectPackage.aspx"); } } catch (Exception ex) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "msg", "alert(" + ex.Message.ToString() + ")", true); } }
protected void Page_Load(object sender, EventArgs e) { //string workingKey = "";//put in the 32bit alpha numeric key in the quotes provided here //CCACrypto ccaCrypto = new CCACrypto(); //string encResponse = ccaCrypto.Decrypt(Request.Form["encResp"], workingKey); //NameValueCollection Params = new NameValueCollection(); //string[] segments = encResponse.Split('&'); //foreach (string seg in segments) //{ // string[] parts = seg.Split('='); // if (parts.Length > 0) // { // string Key = parts[0].Trim(); // string Value = parts[1].Trim(); // Params.Add(Key, Value); // } //} //for (int i = 0; i < Params.Count; i++) //{ // Response.Write(Params.Keys[i] + " = " + Params[i] + "<br>"); //} if (!IsPostBack) { string WorkingKey = ConfigurationManager.AppSettings["WorkingKey"]; // PROVIDED BY ccAvenue CCACrypto func = new CCACrypto(); string encResponse = Request.Form.ToString(); string[] segments = encResponse.Split('&'); List <string> Response_values = new List <string>((func.Decrypt(segments[0].Split('=')[1], WorkingKey).Split('&')).ToList()); Response_values.Add(segments[1]); NameValueCollection Params = new NameValueCollection(); foreach (string seg in Response_values) { string[] parts = seg.Split('='); if (parts.Length > 0) { string Key = parts[0].Trim(); string Value = parts[1].Trim(); Params.Add(Key, Value); } } //for (int i = 0; i < Params.Count; i++) //{ // Response.Write(Params.Keys[i] + " = " + Params[i] + "<br>"); //} try { //Verify with ccAvenue //string strVerify = func.verifychecksum(Params["order_id"].ToString(), Params["tracking_id"].ToString(), Params["amount"].ToString(), Params["order_status"].ToString(),Params["payment_mode"].ToString(), Params["vault"].ToString()); //if (strVerify.ToUpper() == "TRUE") // { if (Session["TotalAmount"].ToString() != null) { // UPDATE THE PAYMENT STATUS IN DB //Update the Payment Status in DB if (Params["order_status"].ToString() == "Success") { Response.Redirect("http://palshoes.com/order-complete.aspx", false); } else { Response.Redirect("http://palshoes.com/404.html", false); } // REDIRECT TO SUCCESS PAGE OR SHOW THE PAYMENT RESPONSE ON SAME PAGE } else { Response.Redirect("http://palshoes.com/404.html", false); // PAYMENT IS FAIL // REDIRECT TO ERROR PAGE } //} //else //{ // Response.Redirect("http://palshoes.com/404.html", false); // PAYMENT VERIFICATION IS FAILED // REDIRECT TO ERROR PAGE // } } catch (Exception ex) { // ERROR IN PROCESSING // REDIRECT TO ERROR PAGE Response.Write("<script>alert('" + ex.Message + "')</script>"); } } }
protected void Page_Load(object sender, EventArgs e) { string workingKey = "25A25E7436C1EFEDD8557D5D7DFE3E08";//put in the 32bit alpha numeric key in the quotes provided here CCACrypto ccaCrypto = new CCACrypto(); string encResponse = ccaCrypto.Decrypt(Request.Form["encResp"], workingKey); NameValueCollection Params = new NameValueCollection(); string[] segments = encResponse.Split('&'); foreach (string seg in segments) { string[] parts = seg.Split('='); if (parts.Length > 0) { string Key = parts[0].Trim(); string Value = parts[1].Trim(); Params.Add(Key, Value); } } for (int i = 0; i < Params.Count; i++) { //ViewState["order_id "] = Params[0].ToString(); //ViewState["tracking_id"] = Params[1].ToString(); //ViewState["bank_ref_no"] = Params[2].ToString(); //ViewState["order_status"] = Params[3].ToString(); //ViewState["failure_status"] = Params[4].ToString(); //ViewState["payment_mode"] = Params[5].ToString(); //ViewState["card_name"] = Params[6].ToString(); //ViewState["status_code"] = Params[7].ToString(); //ViewState["status_message"] = Params[8].ToString(); //ViewState["currency"] = Params[9].ToString(); //ViewState["amount"] = Params[10].ToString(); //////Billing Information //ViewState["billing_name"] = Params[11].ToString(); //ViewState["billing_address"] = Params[12].ToString(); //ViewState["billing_city"] = Params[13].ToString(); //ViewState["billing_state"] = Params[14].ToString(); //ViewState["billing_zip"] = Params[15].ToString(); //ViewState["billing_country"] = Params[16].ToString(); //ViewState["billing_tel"] = Params[17].ToString(); //ViewState["billing_email"] = Params[18].ToString(); string order_id = Params[0].ToString(); string tracking_id = Params[1].ToString(); string bank_ref_no = Params[2].ToString(); string order_status = Params[3].ToString(); string failure_status = Params[4].ToString(); string payment_mode = Params[5].ToString(); string card_name = Params[6].ToString(); string status_code = Params[7].ToString(); string status_message = Params[8].ToString(); string currency = Params[9].ToString(); string amount = Params[10].ToString(); ////Billing Information string billing_name = Params[11].ToString(); string billing_address = Params[12].ToString(); string billing_city = Params[13].ToString(); string billing_state = Params[14].ToString(); string billing_zip = Params[15].ToString(); string billing_country = Params[16].ToString(); string billing_tel = Params[17].ToString(); string billing_email = Params[18].ToString(); if (order_status == "Success") { FillBankTransaction(order_id, tracking_id, bank_ref_no, order_status, failure_status, payment_mode, card_name, status_code, status_message, currency, amount, billing_address, billing_address, billing_city, billing_state, billing_zip, billing_country, billing_tel, billing_email); hd.Value = billing_email; PaymentSuccess(); } else { Response.Redirect("CancelledPage.aspx"); } } Redirect(Params[18].ToString()); }
private int getPaymentGatewayTransactionsCoreEntity(string EncryptedString, ref PaymentGatewayTransactionsCoreEntity objPaymentGatewayTransactionsCoreEntity) { NameValueCollection Params = new NameValueCollection(); try { string DecryptedValue = string.Empty; string workingKey = Constants.ccAvenueworkingKeyTest; //put in the 32bit alpha numeric key in the quotes provided here CCACrypto objccaCrypto = new CCACrypto(); using (objccaCrypto as IDisposable) { DecryptedValue = objccaCrypto.Decrypt(EncryptedString, workingKey); } objccaCrypto = null; string[] segments = DecryptedValue.Split('&'); foreach (string seg in segments) { string[] parts = seg.Split('='); if (parts.Length > 0) { string Key = parts[0].Trim(); string Value = parts[1].Trim(); Params.Add(Key, Value); } } objPaymentGatewayTransactionsCoreEntity.TransactionID = Helpers.primaryKey; objPaymentGatewayTransactionsCoreEntity.CreatedDate = DateTime.Now; objPaymentGatewayTransactionsCoreEntity.CreatedBy = _objLoggedInUser.LoginID; objPaymentGatewayTransactionsCoreEntity.TranDate = DateTime.Now; objPaymentGatewayTransactionsCoreEntity.EncryptedText = EncryptedString; objPaymentGatewayTransactionsCoreEntity.DecryptedText = DecryptedValue; for (int i = 0; i < Params.Count; i++) { //Helpers.LogMessageInFlatFile(Params.Keys[i] + " = " + Params[i] + "<br>"); switch (Params.Keys[i]) { case "order_id": objPaymentGatewayTransactionsCoreEntity.OrderID = Params[i]; break; case "tracking_id": objPaymentGatewayTransactionsCoreEntity.TrackingID = Params[i]; break; case "bank_ref_no": objPaymentGatewayTransactionsCoreEntity.BankRefNo = Params[i]; break; case "order_status": objPaymentGatewayTransactionsCoreEntity.OrderStatus = Params[i]; break; case "failure_message": objPaymentGatewayTransactionsCoreEntity.FailureMessage = Params[i]; break; case "payment_mode": objPaymentGatewayTransactionsCoreEntity.PaymentMode = Params[i]; break; case "card_name": objPaymentGatewayTransactionsCoreEntity.CardName = Params[i]; break; case "status_code": objPaymentGatewayTransactionsCoreEntity.StatusCode = Params[i]; break; case "status_message": objPaymentGatewayTransactionsCoreEntity.StatusMessage = Params[i]; break; case "currency": objPaymentGatewayTransactionsCoreEntity.Currency = Params[i]; break; case "amount": { decimal amount = 0; if (!string.IsNullOrEmpty(Params[i])) { amount = Convert.ToDecimal(Params[i]); } objPaymentGatewayTransactionsCoreEntity.Amount = amount; } break; case "billing_name": objPaymentGatewayTransactionsCoreEntity.BillingName = Params[i]; break; case "billing_address": objPaymentGatewayTransactionsCoreEntity.BillingAddress = Params[i]; break; case "billing_city": objPaymentGatewayTransactionsCoreEntity.BillingCity = Params[i]; break; case "billing_state": objPaymentGatewayTransactionsCoreEntity.BillingState = Params[i]; break; case "billing_zip": objPaymentGatewayTransactionsCoreEntity.BillingZip = Params[i]; break; case "billing_country": objPaymentGatewayTransactionsCoreEntity.BillingCountry = Params[i]; break; case "billing_tel": objPaymentGatewayTransactionsCoreEntity.BillingTel = Params[i]; break; case "billing_email": objPaymentGatewayTransactionsCoreEntity.BillingEmail = Params[i]; break; case "delivery_name": objPaymentGatewayTransactionsCoreEntity.DeliveryName = Params[i]; break; case "delivery_address": objPaymentGatewayTransactionsCoreEntity.DeliveryAddress = Params[i]; break; case "delivery_city": objPaymentGatewayTransactionsCoreEntity.DeliveryCity = Params[i]; break; case "delivery_state": objPaymentGatewayTransactionsCoreEntity.DeliveryState = Params[i]; break; case "delivery_zip": objPaymentGatewayTransactionsCoreEntity.DeliveryZip = Params[i]; break; case "delivery_country": objPaymentGatewayTransactionsCoreEntity.DeliveryCountry = Params[i]; break; case "delivery_tel": objPaymentGatewayTransactionsCoreEntity.DeliveryTel = Params[i]; break; case "mer_amount": { decimal merAmount = 0; if (!string.IsNullOrEmpty(Params[i])) { merAmount = Convert.ToDecimal(Params[i]); } objPaymentGatewayTransactionsCoreEntity.MerAmount = merAmount; } break; case "merchant_param1": objPaymentGatewayTransactionsCoreEntity.MerchantParam1 = Params[i]; break; case "merchant_param2": objPaymentGatewayTransactionsCoreEntity.MerchantParam2 = Params[i]; break; case "merchant_param3": objPaymentGatewayTransactionsCoreEntity.MerchantParam3 = Params[i]; break; case "merchant_param4": objPaymentGatewayTransactionsCoreEntity.MerchantParam4 = Params[i]; break; case "merchant_param5": objPaymentGatewayTransactionsCoreEntity.MerchantParam5 = Params[i]; break; case "vault": objPaymentGatewayTransactionsCoreEntity.Vault = Params[i]; break; case "OfferType": objPaymentGatewayTransactionsCoreEntity.OfferType = Params[i]; break; case "OfferCode": objPaymentGatewayTransactionsCoreEntity.OfferCode = Params[i]; break; case "discount_value": objPaymentGatewayTransactionsCoreEntity.DiscountValue = Params[i]; break; case "ECIValue": objPaymentGatewayTransactionsCoreEntity.ECIValue = Params[i]; break; case "retry": objPaymentGatewayTransactionsCoreEntity.Retry = Params[i]; break; case "response_code": objPaymentGatewayTransactionsCoreEntity.ResponseCode = Params[i]; break; case "billing_notes": objPaymentGatewayTransactionsCoreEntity.BillingNotes = Params[i]; break; /* case "trans_date": * { * DateTime dtTarnsdate; * if (!string.IsNullOrEmpty(Params[i])) * { * dtTarnsdate = Convert.ToDateTime(Params[i]); * objPaymentGatewayTransactionsCoreEntity.TranDate = dtTarnsdate; * } * //objPaymentGatewayTransactionsCoreEntity.TranDate = Params[i]; * } * break;*/ case "bin_country": objPaymentGatewayTransactionsCoreEntity.BillingCountry = Params[i]; break; } } } catch (Exception objEx) { Helpers.LogExceptionInFlatFile(objEx); } finally { if (Params != null) { Params = null; } // ((IDisposable)Params).Dispose(); } return(0); }
public ActionResult Return(IpnModel model) { var processor = _paymentPluginManager.LoadPluginBySystemName("Payments.CCAvenue") as CCAvenuePaymentProcessor; if (processor == null || !_paymentPluginManager.IsPluginActive(processor) || !processor.PluginDescriptor.Installed) { throw new NopException("CCAvenue module cannot be loaded"); } //assign following values to send it to verifychecksum function. if (string.IsNullOrWhiteSpace(_ccAvenuePaymentSettings.Key)) { throw new NopException("CCAvenue key is not set"); } var workingKey = _ccAvenuePaymentSettings.Key; var ccaCrypto = new CCACrypto(); var encResponse = ccaCrypto.Decrypt(model.Form["encResp"], workingKey); var paramList = new NameValueCollection(); var segments = encResponse.Split('&'); foreach (var seg in segments) { var parts = seg.Split('='); if (parts.Length <= 0) { continue; } paramList.Add(parts[0].Trim(), parts[1].Trim()); } var sb = new StringBuilder(); sb.AppendLine("CCAvenue:"); for (var i = 0; i < paramList.Count; i++) { sb.AppendLine(paramList.Keys[i] + " = " + paramList[i]); } var orderId = paramList["Order_Id"]; var authDesc = paramList["order_status"]; var order = _orderService.GetOrderById(Convert.ToInt32(orderId)); if (order == null) { return(RedirectToAction("Index", "Home", new { area = string.Empty })); } order.OrderNotes.Add(new OrderNote { Note = sb.ToString(), DisplayToCustomer = false, CreatedOnUtc = DateTime.UtcNow }); //var merchantId = Params["Merchant_Id"]; //var Amount = Params["Amount"]; //var myUtility = new CCAvenueHelper(); //var checksum = myUtility.verifychecksum(merchantId, orderId, Amount, AuthDesc, _ccAvenuePaymentSettings.Key, checksum); if (!authDesc.Equals("Success", StringComparison.InvariantCultureIgnoreCase)) { return(RedirectToRoute("OrderDetails", new { orderId = order.Id })); } //here you need to put in the routines for a successful transaction such as sending an email to customer, //setting database status, informing logistics etc etc if (_orderProcessingService.CanMarkOrderAsPaid(order)) { _orderProcessingService.MarkOrderAsPaid(order); } //thank you for shopping with us. Your credit card has been charged and your transaction is successful return(RedirectToRoute("CheckoutCompleted", new { orderId = order.Id })); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { CheckSession(); SetUpPageContent(ref metaDescription, ref metaKeywords); objCommon = new clsCommon(); try { string strOrderId = ""; string strTransactionId = ""; string order_id = ""; string tracking_id = ""; string bank_ref_no = ""; string order_status = ""; string payment_mode = ""; string card_name = ""; string currency = ""; bool IsSuccess = false; if (Session[appFunctions.Session.PaymetnOrderId.ToString()] != null) { if (Session[appFunctions.Session.PaymetnOrderId.ToString()].ToString() != "") { strOrderId = Session[appFunctions.Session.PaymetnOrderId.ToString()].ToString(); Session[appFunctions.Session.PaymetnOrderId.ToString()] = ""; Session[appFunctions.Session.PaymetnOrderId.ToString()] = null; } } if (Session[appFunctions.Session.PaymentTransactionId.ToString()] != null) { if (Session[appFunctions.Session.PaymentTransactionId.ToString()].ToString() != "") { strTransactionId = Session[appFunctions.Session.PaymentTransactionId.ToString()].ToString(); Session[appFunctions.Session.PaymentTransactionId.ToString()] = ""; Session[appFunctions.Session.PaymentTransactionId.ToString()] = null; } } CCACrypto ccaCrypto = new CCACrypto(); string encResponse = ccaCrypto.Decrypt(Request.Form["encResp"], appFunctions.strCCAvenueworkingKey); NameValueCollection Params = new NameValueCollection(); string[] segments = encResponse.Split('&'); foreach (string seg in segments) { string[] parts = seg.Split('='); if (parts.Length > 0) { string Key = parts[0].Trim(); string Value = parts[1].Trim(); Params.Add(Key, Value); } } for (int i = 0; i < Params.Count; i++) { if (Params.Keys[i].ToString().ToLower() == "order_id") { order_id = Params[i].ToString().ToLower(); } else if (Params.Keys[i].ToString().ToLower() == "tracking_id") { tracking_id = Params[i].ToString().ToLower(); } else if (Params.Keys[i].ToString().ToLower() == "bank_ref_no") { bank_ref_no = Params[i].ToString().ToLower(); } else if (Params.Keys[i].ToString().ToLower() == "order_status") { order_status = Params[i].ToString().ToLower(); } else if (Params.Keys[i].ToString().ToLower() == "payment_mode") { payment_mode = Params[i].ToString().ToLower(); } else if (Params.Keys[i].ToString().ToLower() == "card_name") { card_name = Params[i].ToString().ToLower(); } else if (Params.Keys[i].ToString().ToLower() == "currency") { currency = Params[i].ToString().ToLower(); } //Response.Write(Params.Keys[i] + " = " + Params[i] + "<br>"); } //Response.Write("order_id : " + order_id + "<br>"); //Response.Write("tracking_id : " + tracking_id + "<br>"); //Response.Write("bank_ref_no : " + bank_ref_no + "<br>"); //Response.Write("order_status : " + order_status + "<br>"); //Response.Write("payment_mode : " + payment_mode + "<br>"); //Response.Write("card_name : " + card_name + "<br>"); //Response.Write("currency : " + currency + "<br>"); if (order_status == "success") { IsSuccess = true; //DInfo.ShowMessage("You Successfull Pay for order.", BusinessLayer.Enums.MessageType.Successfull); } else { //DInfo.ShowMessage("Your online payment Failure.", BusinessLayer.Enums.MessageType.Error); } if (strOrderId != "") { tblOrder objOrder = new tblOrder(); if (objOrder.LoadByPrimaryKey(Convert.ToInt32(strOrderId))) { objOrder.s_AppTransactionID = order_id; objOrder.s_AppBankRefNo = bank_ref_no; objOrder.s_AppPaymentType = payment_mode; objOrder.s_AppCardName = card_name; objOrder.s_AppCurrency = currency; if (IsSuccess) { objOrder.AppPaymentStatus = Convert.ToInt32(Enums.Enums_PaymentStatus.success); string strDefaultOrderStatusID = ""; tblOrderStatus objStatus = new tblOrderStatus(); objStatus.Where.AppIsDefault.Value = true; objStatus.Query.Load(); if (objStatus.RowCount > 0) { strDefaultOrderStatusID = objStatus.s_AppOrderStatusID; } objStatus = null; objOrder.s_AppOrderStatusID = strDefaultOrderStatusID; tblSubOrder objSubOrder = new tblSubOrder(); objSubOrder.SetOrderStatus(Convert.ToInt32(strDefaultOrderStatusID), strOrderId, GetCurrentDateTime().ToString(), Convert.ToInt32(Enums.Enums_OrderStatus.PaymentFail).ToString()); objSubOrder = null; } else { objOrder.AppPaymentStatus = Convert.ToInt32(Enums.Enums_PaymentStatus.Failure); objOrder.AppOrderStatusID = Convert.ToInt32(Enums.Enums_OrderStatus.PaymentFail); tblSubOrder objSubOrder = new tblSubOrder(); objSubOrder.SetOrderStatus(Convert.ToInt32(Enums.Enums_OrderStatus.PaymentFail), strOrderId, GetCurrentDateTime().ToString(), Convert.ToInt32(Enums.Enums_OrderStatus.PaymentFail).ToString()); objSubOrder = null; } objOrder.Save(); SendMail(objOrder.s_AppOrderNo, objOrder.s_AppReceiverName, objOrder.s_AppReceiverContactNo1, objOrder.s_AppRecevierEmail, IsSuccess, objOrder.s_AppTransactionID, objOrder.s_AppBankRefNo); objOrder = null; objOrder = new tblOrder(); objDataTable = objOrder.LoadMyOrderList(Session[appFunctions.Session.ClientUserID.ToString()].ToString(), "", strOrderId); DataListMyOrder.DataSource = null; DataListMyOrder.DataBind(); if (objDataTable.Rows.Count > 0) { DataListMyOrder.DataSource = objDataTable; DataListMyOrder.DataBind(); } } objOrder = null; } } catch (Exception ex) { } objCommon = null; } }