/// <summary> /// 充值成功后续处理 /// </summary> /// <param name="total_fee">总金额</param> /// <param name="out_trade_no">系统订单号(标识)</param> /// <param name="time_end">支付完成时间</param> /// <param name="trade_no">支付宝/微信交易号</param> /// <returns></returns> public static string UpdateRecharge(string total_fee, string out_trade_no, string time_end, string trade_no) { /* * 1、充值成功,更新充值记录信息 */ //更新充值记录 OWZX.Model.RechargeModel rech = new OWZX.Model.RechargeModel { Out_trade_no = out_trade_no, Paytime = time_end, Total_fee = decimal.Parse(total_fee), Trade_no = trade_no }; bool recres = Recharge.UpdateRechargeForPay(rech); if (recres) { //string type = string.Empty;(1:充话费 2:升级充值) List <RechargeModel> rchlist = Recharge.GetRechargeList(1, 1, " where out_trade_no='" + out_trade_no + "'"); if (rchlist.Count == 0) { return("fail"); } RechargeModel rch = rchlist[0]; return("success"); } else { Logs.Write("更新充值记录失败!"); return("error"); } }
public ActionResult Index(FormCollection forms) { string phone = forms["phone"]; string product = forms["Operators"]; string amount = forms["amount"]; string ProductId = forms["ProductId"]; if (phone == "" || amount == "" || product == "") { List <TB_Operator> Operators = entities.TB_Operator.ToList <TB_Operator>(); ViewBag.OperatorsList = new SelectList(Operators, "OperatorId", "OperatorName"); ViewBag.Error = "Please enter required details !"; return(View()); } else { RechargeModel model = new RechargeModel(); model.phone = phone; model.amount = amount; model.Operators = product; model.ProductId = ProductId; int prdId = Convert.ToInt32(ProductId); model.Operator = entities.TB_Product.Where(x => x.ProductId == prdId).FirstOrDefault().Product_Name; Session["recharge"] = model; return(RedirectToAction("Checkout")); } }
/// <summary> /// 支付 /// </summary> public ActionResult Pay() { string result = WebHelper.GetPostStr(); NameValueCollection parmas = WebHelper.GetParmList(result); //服务器异步通知页面路径,需http://格式的完整路径,不能加?id=123这类自定义参数 string notifyUrl = string.Format("{0}/appalipay/notify", BSPConfig.ShopConfig.SiteUrl); //付款金额 string totalFee = decimal.Parse(parmas["totalfee"]).ToString(); //记录充值信息 RechargeModel rech = new RechargeModel { Out_trade_no = parmas["outtradeno"], Account = parmas["account"], SuiteId = parmas["vossuiteid"], PlatForm = "支付宝", Type = int.Parse(parmas["type"]), Role = int.Parse(parmas["role"]) }; bool addres = Recharge.AddRecharge(rech); if (!addres) { return(AjaxResult("error", "记录充值信息失败")); } return(AjaxResult("success", "验证成功")); }
public ActionResult RedirectFromPaypal(int id) { ServiceReference1.ClientAPIServiceSoapClient s = new ServiceReference1.ClientAPIServiceSoapClient(); string clientId = ConfigurationManager.AppSettings["ClientId"]; string clientPwd = ConfigurationManager.AppSettings["ClientPwd"]; string responseid = ""; string status = ""; string balances = ""; TB_Transaction tx = entities.TB_Transaction.Where(x => x.TransactionId == id).FirstOrDefault(); bool result = s.RequestInput(clientId, clientPwd, tx.TransactionNumber, tx.ProductId.ToString(), Convert.ToDecimal(tx.Denomination), tx.Phone, ref responseid, ref status, ref balances); RechargeModel model = new RechargeModel(); model.phone = tx.Phone; model.amount = tx.Denomination; model.Operator = entities.TB_Product.Where(x => x.ProductId == tx.ProductId).FirstOrDefault().Product_Name; tx.Status = status; tx.ResponseId = responseid; repo.updateTrasnaction(tx); if (status == "SUBMIT_SUCCESS") { repo.DeductMoneyFromWallet(tx.UserId ?? 0, Convert.ToDecimal(tx.Denomination)); ViewBag.Message = "Recharge Succesful ! Transaction Number is :" + tx.TransactionNumber; ViewBag.MessageDesc = ""; } else { ViewBag.Message = "Recharge was UnSuccesful ! Transaction Number is :" + tx.TransactionNumber + ""; ViewBag.MessageDesc = "Some issue occured in the backend. We haven't deducted money from your wallet. Please try again later. Please note down transaction number for refund process."; } return(View(model)); }
public ActionResult Index() { RechargeModel model = new RechargeModel(); List <TB_Operator> Operators = entities.TB_Operator.ToList <TB_Operator>(); ViewBag.OperatorsList = new SelectList(Operators, "OperatorId", "OperatorName"); return(View(model)); }
/// <summary> /// 充值成功更新充值记录 /// </summary> /// <param name="rech"></param> /// <returns></returns> public static bool UpdateRechargeForPay(RechargeModel rech) { string result = OWZX.Data.Recharge.UpdateRechargeForPay(rech); if (result.EndsWith("成功")) { return(true); } return(false); }
/// <summary> /// 添加充值记录 /// </summary> /// <param name="rech"></param> /// <returns></returns> public static bool AddRecharge(RechargeModel rech) { string result = OWZX.Data.Recharge.AddRecharge(rech); if (result.EndsWith("成功")) { return(true); } return(false); }
public ActionResult Checkout() { RechargeModel model = (RechargeModel)Session["recharge"]; if (model == null) { return(RedirectToAction("Index")); } return(View(model)); }
public ActionResult RechargeStatus(FormCollection forms) { string txn = forms["txn"]; ServiceReference1.ClientAPIServiceSoapClient s = new ServiceReference1.ClientAPIServiceSoapClient(); string clientId = ConfigurationManager.AppSettings["ClientId"]; string clientPwd = ConfigurationManager.AppSettings["ClientPwd"]; string responseid = ""; string resstatus = ""; string txnstatus = ""; string errorcode = ""; string SMTMsg = ""; TB_Transaction tx = entities.TB_Transaction.Where(x => x.TransactionNumber == txn).FirstOrDefault(); if (tx != null) { RechargeModel model = new RechargeModel(); model.phone = tx.Phone; model.amount = tx.Denomination; int prdId = Convert.ToInt32(tx.ProductId); model.Operator = entities.TB_Product.Where(x => x.ProductId == prdId).FirstOrDefault().Product_Name; if (tx.Status != null) { if (txnstatus == "SUBMIT_SUCCESS") { ViewBag.Message = "Recharge was successful"; } else { ViewBag.Message = "Recharge was un-successful"; } } else { s.CheckTransactionStatus(clientId, clientPwd, txn, ref txnstatus, ref errorcode, ref SMTMsg, ref responseid, ref resstatus); if (txnstatus == "SUBMIT_SUCCESS") { ViewBag.Message = "Recharge was successful"; } else { ViewBag.Message = "Recharge was un-successful"; } } return(View("RechargeStatusResult", model)); } else { ViewBag.Message = "Invalid Transaction Number !"; return(View()); } }
public static ItemExchange Create(RechargeModel model, Transform parent) { GameObject go = (GameObject)GameObject.Instantiate(Resources.Load("Prefabs/HeaderMenu/Recharge/Item Exchange")); go.transform.parent = parent; go.transform.localPosition = Vector3.zero; go.transform.localScale = Vector3.one; ItemExchange item = go.GetComponent <ItemExchange>(); item.SetData(model); return(item); }
public static itemConvertMoney Create(RechargeModel model, Transform parent) { GameObject obj = (GameObject)GameObject.Instantiate(Resources.Load("Prefabs/HeaderMenu/itemRecharPrefab")); obj.name = model.Code; obj.transform.parent = parent; obj.transform.localPosition = new Vector3(0f, 0f, -1f); obj.transform.localScale = Vector3.one; itemConvertMoney convert = obj.GetComponent <itemConvertMoney>(); convert.SetData(model); return(convert); }
public void SetData(RechargeModel model) { this.model = model; if (model.Type == "mobile_card") { numberPrefix.text = "Thẻ cào " + Utility.Convert.Chip(model.CodeValue); } else { numberPrefix.text = "Tin nhắn đến " + model.Code; } chip.text = Utility.Convert.Chip(model.Value) + " chips"; }
public static SMSRechargeView Create(RechargeModel model, Transform parent) { GameObject obj = (GameObject)GameObject.Instantiate(Resources.Load("Prefabs/HeaderMenu/Recharge/SMSRechargeView")); obj.name = "sms " + model.Value; obj.transform.parent = parent; obj.transform.localPosition = new Vector3(0f, 0f, -1f); obj.transform.localScale = Vector3.one; SMSRechargeView sms = obj.GetComponent <SMSRechargeView>(); sms.SetData(model); return(sms); }
public ActionResult PayUsingWallet() { RechargeModel model = (RechargeModel)Session["recharge"]; EWallet wallet = null; if (Session["user"] != null) { TB_User user = (TB_User)Session["user"]; wallet = user.EWallets.FirstOrDefault(); if (Convert.ToDecimal(model.amount) < wallet.Amount) { ServiceReference1.ClientAPIServiceSoapClient s = new ServiceReference1.ClientAPIServiceSoapClient(); string clientId = ConfigurationManager.AppSettings["ClientId"]; string clientPwd = ConfigurationManager.AppSettings["ClientPwd"]; string responseid = ""; string status = ""; string balances = ""; string number = Guid.NewGuid().ToString().Substring(0, 6); TB_Transaction tx = repo.createTransaction(number, model.amount, wallet.UserID ?? 0, Convert.ToInt32(model.ProductId), model.phone); bool result = s.RequestInput(clientId, clientPwd, number, model.Operators, Convert.ToDecimal(model.amount), model.phone, ref responseid, ref status, ref balances); tx.Status = status; tx.ResponseId = responseid; repo.updateTrasnaction(tx); if (status == "SUBMIT_SUCCESS") { TB_Transaction txu = entities.TB_Transaction.Where(x => x.TransactionId == tx.TransactionId).FirstOrDefault(); txu.PaymentStatus = "Payment Recieved."; entities.SaveChanges(); repo.DeductMoneyFromWallet(((TB_User)Session["user"]).UserId, Convert.ToDecimal(model.amount)); TB_Paypal paypal = new TB_Paypal(); paypal.Amount = Convert.ToDecimal(model.amount); paypal.date = DateTime.Now; paypal.EWalletID = wallet.EWalletID; paypal.Type = "Mobile Recharge"; paypal.UserID = user.UserId; paypal.TransactionID = txu.TransactionId; entities.TB_Paypal.Add(paypal); entities.SaveChanges(); ViewBag.Message = "Recharge Succesful !"; } else { ViewBag.Message = "Recharge was UnSuccesful !"; ViewBag.MessageDesc = "Some issue occured in the backend. We haven't deducted money from your wallet. Please try again later"; } } } return(View(model)); }
public ActionResult ValidateCommand() { string url = ConfigurationManager.AppSettings["redirect"]; string email = ConfigurationManager.AppSettings["business"]; string returnurl = ConfigurationManager.AppSettings["return"]; string cancel_return = ConfigurationManager.AppSettings["cancel_return"]; Models.HttpRequest hr = new Models.HttpRequest(); RechargeModel model = (RechargeModel)Session["recharge"]; string number = Guid.NewGuid().ToString().Substring(0, 6); TB_User user = (TB_User)Session["user"]; TB_Transaction tx = null; if (user != null) { tx = repo.createTransaction(number, model.amount, user.UserId, Convert.ToInt32(model.ProductId), model.phone); } else { tx = repo.createTransaction(number, model.amount, null, Convert.ToInt32(model.ProductId), model.phone); } //Dictionary<string, string> post = new Dictionary<string, string>(); //post.Add("version", "2.0"); //post.Add("action", "pay"); //post.Add("merchant", email); //post.Add("ref_id", tx.TransactionId.ToString()); //post.Add("item_name_1", model.phone+ " Mobile Recharge" ); //post.Add("item_description_1", "Mobile Recharge"); //post.Add("item_quantity_1", "1"); //post.Add("item_amount_1", model.amount); //post.Add("currency", "SGD"); //post.Add("total_amount", model.amount); //post.Add("success_url", returnurl); //post.Add("cancel_url", cancel_return); //hr.HttpPostRequest(url, post); bool useSandbox = Convert.ToBoolean(ConfigurationManager.AppSettings["IsSandbox"]); var paypal = new PayPalModel(useSandbox, tx.TransactionId, false, Convert.ToInt32(model.amount)); paypal.item_name = model.phone; paypal.amount = model.amount; return(View(paypal)); }
IEnumerator DoRequestRecharge() { string reRequest = null; WWWForm form = new WWWForm(); form.AddField(ServerWeb.PARAM_CONFIG_CODE_GAME, GameManager.GAME.ToString()); form.AddField(ServerWeb.PARAM_CONFIG_CODE_PLATFORM, PlatformSetting.GetPlatform.ToString()); form.AddField(ServerWeb.PARAM_CONFIG_CORE_VERSION, GameSettings.Instance.CORE_VERSION); form.AddField(ServerWeb.PARAM_CONFIG_BUILD_VERSION, GameSettings.Instance.BUILD_VERSION); form.AddField(ServerWeb.PARAM_CONFIG_CODE_REVISION, GameSettings.Instance.CODE_VERSION_BUILD); form.AddField(ServerWeb.PARAM_PARTNER_ID, GameSettings.Instance.ParnerCodeIdentifier); ServerWeb.StartThreadHttp(ServerWeb.URL_GET_RECHARGE, form, delegate(bool isDone, WWW response, IDictionary json) { if (isDone) { if (string.IsNullOrEmpty(response.error)) { reRequest = "0"; if (json["code"].ToString() == "1") { ArrayList items = (ArrayList)json["items"]; foreach (Hashtable obj in items) { RechargeModel model = new RechargeModel(obj); GameManager.Instance.ListRechargeModel.Add(model); } } } else { reRequest = "1"; } } }, null); while (string.IsNullOrEmpty(reRequest)) { yield return(new WaitForEndOfFrame()); } if (reRequest == "1") { yield return(new WaitForSeconds(2f)); GameManager.Instance.StartCoroutine(DoRequestRecharge()); } }
public void SetData(RechargeModel model) { this.model = model; this.chip.text = Utility.Convert.Chip(model.Value) + " chips"; new AvatarCacheOrDownload(model.ImagesUrl, delegate(Texture _avatarTexture) { if (_avatarTexture != null) { _avatarTexture.filterMode = FilterMode.Point; _avatarTexture.anisoLevel = 0; _avatarTexture.wrapMode = TextureWrapMode.Clamp; backgroundTexture.mainTexture = _avatarTexture; backgroundTexture.MakePixelPerfect(); } else { title.gameObject.SetActive(true); chip.color = Color.black; } }, true); }
public void SetData(List <RechargeModel> models) { this.models = models; RechargeModel model = models[0]; new AvatarCacheOrDownload(model.ImagesUrl, delegate(Texture avatar) { if (avatar != null) { avatar.filterMode = FilterMode.Point; avatar.anisoLevel = 0; avatar.wrapMode = TextureWrapMode.Clamp; backgroundTexture.mainTexture = avatar; backgroundTexture.MakePixelPerfect(); } else { textAlt.gameObject.SetActive(true); textAlt.text = model.Provider; } }, true); //backgroundSprite.spriteName = model.Provider; }
public ActionResult MakePayment() { PaymentViewModel vm = new PaymentViewModel(); RechargeModel model = (RechargeModel)Session["recharge"]; EWallet wallet = null; if (model == null) { return(RedirectToAction("Index")); } vm.recharge = model; if (Session["user"] != null) { wallet = ((TB_User)Session["user"]).EWallets.FirstOrDefault(); vm.eWallet = wallet; } ViewBag.rechargeModel = model; return(View(vm)); }
public ActionResult AdminRechargeHistory() { RechargeModel model = new RechargeModel(); var query = from h in db.RechargeHistory join u in db.User on h.UserId equals u.UserId join rt in db.RechargeReward on h.RechargeRewardTypeId equals rt.RechargeRewardId into rewardObj from r in rewardObj.DefaultIfEmpty() join uc in db.User on h.CreateUserId equals uc.UserId select new RechargeHistoryList { RechargeHistoryId = h.RechargeHistoryId, Details = h.Details, CreateAt = h.CreateAt, RechargeCash = h.RechargeCash, ToAccountName = u.AccountName, OperatorName = uc.AccountName, RechargeRewardName = r.RewardValue.ToString() }; model.List = query.ToList(); return(View(model)); }
/// <summary> /// 支付 /// </summary> public ActionResult Pay() { string result = WebHelper.GetPostStr(); NameValueCollection parmas = WebHelper.GetParmList(result); //支付类型,必填,不能修改 string paymentType = "1"; //服务器异步通知页面路径,需http://格式的完整路径,不能加?id=123这类自定义参数 string notifyUrl = string.Format("{0}/appalipay/notify", BSPConfig.ShopConfig.SiteUrl); //收款支付宝帐户 string sellerEmail = AlipayConfig.Seller; //合作者身份ID string partner = AlipayConfig.Partner; //交易安全检验码 string key = AlipayConfig.Key; //商户订单号 string outTradeNo = "hmk" + DateTime.Now.ToString("yyMMdd") + Randoms.CreateRandomValue(6, true); //订单名称 string subject = BSPConfig.ShopConfig.SiteTitle; //付款金额 string totalFee = double.Parse(parmas["totalFee"]).ToString(); //订单描述 string body = "话费套餐"; Encoding e = Encoding.GetEncoding(AlipayConfig.AppInputCharset); //把请求参数打包成数组 SortedDictionary <string, string> parms = new SortedDictionary <string, string>(); parms.Add("app_id", "2016092001932731"); parms.Add("method", "alipay.trade.app.pay"); parms.Add("charset", AlipayConfig.AppInputCharset); parms.Add("timestamp", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); parms.Add("version", "1.0"); parms.Add("notify_url", notifyUrl); Dictionary <string, string> dic = new Dictionary <string, string>(); dic.Add("partner", partner); dic.Add("seller_id", sellerEmail); dic.Add("out_trade_no", outTradeNo); dic.Add("subject", subject); dic.Add("body", body); dic["total_amount"] = totalFee; dic["product_code"] = "QUICK_MSECURITY_PAY"; dic["timeout_express"] = "30m"; parms.Add("biz_content", JsonHelper.StringDicToJson(dic)); parms.Add("sign_type", AlipayConfig.AppSignType); string sign = AlipayRSAFromPkcs8.sign(AlipayCore.CreateLinkString(AlipayCore.FilterPara(parms)), AlipayConfig.PrivateKey, AlipayConfig.AppInputCharset); parms.Add("sign", sign); //parms.Add("sign", HttpUtility.UrlEncode(sign, e)); //parms.Remove("biz_content"); Dictionary <string, string> dicArray = new Dictionary <string, string>(); foreach (KeyValuePair <string, string> temp in parms) { dicArray.Add(temp.Key, temp.Value); } //记录充值信息 RechargeModel rech = new RechargeModel { Out_trade_no = outTradeNo, Account = parmas["account"], SuiteId = parmas["vossuiteid"], PlatForm = "支付宝", Type = int.Parse(parmas["type"]), Role = int.Parse(parmas["role"]) }; bool addres = Recharge.AddRecharge(rech); if (!addres) { return(AjaxResult("error", "记录充值信息失败")); } //string content = JsonHelper.StringDicToJson(dicArray); //content = content.Substring(0, content.Length - 1) + ",\"biz_content\":" + JsonHelper.StringDicToJson(dic) + "}"; string content = AlipayCore.CreateLinkStringUrlencode(AlipayCore.FilterAllPara(parms), Encoding.UTF8); return(AjaxResult("success", content)); }
/// <summary> /// 支付 /// </summary> public ActionResult Pay() { string result = WebHelper.GetPostStr(); NameValueCollection parmas = WebHelper.GetParmList(result); //if (parmas.Keys.Count < 5) //{ // return Content("缺少请求参数"); //} //支付类型,必填,不能修改 string paymentType = "1"; //服务器异步通知页面路径,需http://格式的完整路径,不能加?id=123这类自定义参数 string notifyUrl = string.Format("{0}/appalipay/notify", BSPConfig.ShopConfig.SiteUrl); //收款支付宝帐户 string sellerEmail = AlipayConfig.Seller; //合作者身份ID string partner = AlipayConfig.Partner; //交易安全检验码 string key = AlipayConfig.Key; //商户订单号 string outTradeNo = "hmk" + DateTime.Now.ToString("yyMMdd") + Randoms.CreateRandomValue(6, true); //订单名称 string subject = BSPConfig.ShopConfig.SiteTitle; //付款金额 string totalFee = double.Parse(parmas["totalFee"]).ToString(); //订单描述 string body = "话费套餐"; Encoding e = Encoding.GetEncoding(AlipayConfig.AppInputCharset); //把请求参数打包成数组 SortedDictionary <string, string> parms = new SortedDictionary <string, string>(); parms.Add("service", "mobile.securitypay.pay"); parms["partner"] = partner; parms.Add("_input_charset", AlipayConfig.AppInputCharset); parms["seller_id"] = sellerEmail; parms["out_trade_no"] = parmas["outtradeno"]; parms["subject"] = subject; parms["body"] = body; parms["total_fee"] = totalFee; parms.Add("notify_url", notifyUrl); parms.Add("payment_type", paymentType); parms.Add("it_b_pay", "30m"); string sign = AlipayRSAFromPkcs8.sign(AlipayCore.CreateLinkString(AlipayCore.FilterPara(parms)), AlipayConfig.PrivateKey, AlipayConfig.AppInputCharset); parms.Add("sign", HttpUtility.UrlEncode(sign, e)); parms.Add("sign_type", AlipayConfig.AppSignType); Dictionary <string, string> dicArray = new Dictionary <string, string>(); foreach (KeyValuePair <string, string> temp in parms) { dicArray.Add(temp.Key, temp.Value); } //记录充值信息 RechargeModel rech = new RechargeModel { Out_trade_no = outTradeNo, Account = parmas["account"], SuiteId = parmas["vossuiteid"], PlatForm = "支付宝", Type = int.Parse(parmas["type"]), Role = int.Parse(parmas["role"]) }; bool addres = Recharge.AddRecharge(rech); if (!addres) { return(AjaxResult("error", "记录充值信息失败")); } string content = JsonHelper.StringDicToJson(dicArray); return(AjaxResult("success", content, true)); }
public void SetData(RechargeModel item) { lblvnd.text = "Thẻ " + Utility.Convert.Chip(item.CodeValue) + " VND"; lblchip.text = Utility.Convert.Chip(item.Value) + " Chip"; }
public static void ShowRechargeCard(RechargeModel model) { Instance.Init(TypeRechargePopup.Card); Instance.panelRechargeCard.Model = model; }
public static void ShowNotSupport(RechargeModel model) { Instance.Init(TypeRechargePopup.NotSupport); Instance.panelNotSupport.Model = model; }
/// <summary> /// 充值成功更新充值记录 /// </summary> /// <param name="rech"></param> /// <returns></returns> public static string UpdateRechargeForPay(RechargeModel rech) { return(BSPData.RDBS.UpdateRechargeForPay(rech)); }
/// <summary> /// 添加充值记录 /// </summary> /// <param name="rech"></param> /// <returns></returns> public static string AddRecharge(RechargeModel rech) { return(BSPData.RDBS.AddRecharge(rech)); }