public ActionResult PostBackFromPayment() { ViewBag.Message = "Your application description page."; TransVerifyVM vm = new TransVerifyVM(); gHelper = new GenaralHelpers(Session); vm.TxnUUID = (Session["ipay_out__txn_uuid"] != null)? Session["ipay_out__txn_uuid"].ToString(): ""; //Get this from session vm.Action = "saleTxnVerify"; vm.MerRefID = (Session["ipay_in__mer_ref_id"] != null)? Session["ipay_in__mer_ref_id"].ToString():""; var backVM = gHelper.DoApiSaleTransactionVerify(vm); return(View(backVM)); }
public ActionResult IndexPost() { gHelper = new GenaralHelpers(Session); try { ViewBag.Message = "Your application description page."; PostingVM vm = new PostingVM(); string sAmount = "10.00"; string Mer_ref = GenaralHelpers.GetRandomNumber().ToString(); Session["ipay_in__mer_ref_id"] = Mer_ref; //Set session Data vm.TxnAmount = sAmount; vm.Action = SalesTransactionType; vm.CurrencyCode = "LKR"; vm.LanguageCode = "eng"; vm.MerRefID = Mer_ref; vm.ItemList = ""; vm.ReturnURL = Return_Url; vm.MerVar1 = ""; vm.MerVar2 = ""; vm.MerVar3 = ""; vm.MerVar4 = ""; string autoHtml = ""; switch (SalesTransactionType) { case "SaleTxn": autoHtml = gHelper.DoApiSaleTransaction(SalesTransactionType, vm, API_URL_Pay); break; case "saleTxnGroup": autoHtml = gHelper.DoApiSaleTransaction(SalesTransactionType, vm, API_URL_Pay); break; } return(Content(autoHtml)); } catch (Exception ex) { //Need to include your error handling code here. just for demostration purpose we direct the full error message to view var errorMessage = ex.Message; ViewBag.Error = errorMessage; return(View()); } }
public ActionResult IndexPost() { string autoHtml = ""; string UUID = ""; var API_URL_Pay = "https://testipg.nationsdev.com/ipg/servlet_exppay"; string SessionXML = "3c7265713e3c6d65725f69643e544553544c4b52313c2f6d65725f69643e3c6d65725f74786e5f69643e31333434373c2f6d65725f74786e5f69643e3c616374696f6e3e53616c6554786e3c2f616374696f6e3e3c74786e5f616d743e3830302e30303c2f74786e5f616d743e3c6375723e4c4b523c2f6375723e3c6c616e673e656e673c2f6c616e673e3c7265745f75726c3e68747470733a2f2f3230322e3132342e3137322e3134313a3434332f5052494d4534544553542f526573706f6e73652e6a73703c2f7265745f75726c3e3c2f7265713e"; APIHandler handler = new APIHandler(); var returnData = handler.PearToPear(SessionXML, false, "SaleTxn"); UUID = returnData["txn_uuid"]; //Add the UUID to the session so it can be used when trns verifying Session["ipay_out__txn_uuid"] = UUID; //Commence AutoRedirect autoHtml = GenaralHelpers.GenarateBrowserRedirectionHTML(API_URL_Pay, UUID); return(Content(autoHtml)); }
public ActionResult IndexPost(IndexViewModel Model) { string UUID = ""; string autoHtml = ""; var _Configuration = System.Configuration.ConfigurationManager.AppSettings; var SalesTransactionType = (_Configuration["SalesFunction"] != null) ? _Configuration["SalesFunction"] : "SaleTxn"; string Return_Url = (_Configuration["ipay_in__ret_url"] != null) ? _Configuration["ipay_in__ret_url"] : ""; string API_URL_Pay = (_Configuration["API_URL_Pay"] != null) ? _Configuration["API_URL_Pay"] : ""; //Set session Data Session["ipay_in__txn_amt"] = GenaralHelpers.GetRoundWithDecimalPrecision(Model.ToSu1.ToString()).ToString() + ".00"; Session["ipay_in__action"] = SalesTransactionType; Session["ipay_in__cur"] = "LKR"; Session["ipay_in__lang"] = "eng"; Session["ipay_in__mer_ref_id"] = GenaralHelpers.GetRandomNumber().ToString(); Session["ipay_in__item_list"] = ""; Session["ipay_in__ret_url"] = Return_Url; Session["ipay_in__mer_var1"] = ""; Session["ipay_in__mer_var2"] = ""; Session["ipay_in__mer_var3"] = ""; Session["ipay_in__mer_var4"] = ""; //Create Api Helper Instance. Don't use static methods inside ApiHelper or use them anywhere ApiHelper apiCaller = new ApiHelper(Session); switch (SalesTransactionType) { case "SaleTxn": //Calling the api caller Sale Transaction initiate with data var returnData = apiCaller.saleTxn(); if (returnData.ContainsKey("ERROR_CODE")) { //**************************THIS MEAN AN ERROR ON RESPONSE********************* //NEED TO HANDLE THIS ********************************************************* } else { UUID = returnData["txn_uuid"]; //Add the UUID to the session so it can be used when trns verifying Session["ipay_out__txn_uuid"] = UUID; //Commence AutoRedirect autoHtml = GenaralHelpers.GenarateBrowserRedirectionHTML(API_URL_Pay, UUID); } break; case "saleTxnGroup": //Calling the api caller Sale Transaction initiate with data var returnDataVerify = apiCaller.saleTxn(); if (returnDataVerify.ContainsKey("ERROR_CODE")) { //**************************THIS MEAN AN ERROR ON RESPONSE********************* //NEED TO HANDLE THIS ********************************************************* } else { //Get UUID from the Return data UUID = returnDataVerify["ipay_out__txn_uuid"]; //Add the UUID to the session so it can be used when trns verifying Session["ipay_out__txn_uuid"] = UUID; //Commence AutoRedirect autoHtml = GenaralHelpers.GenarateBrowserRedirectionHTML(API_URL_Pay, UUID); } break; } return(Content(autoHtml)); }