Beispiel #1
0
 public ActionResult CashInRequest(string Id)
 {
     if (String.IsNullOrEmpty(Id))
     {
         return(View());
     }
     eWallet.Data.DynamicObj transaction = (eWallet.Data.DynamicObj)Helper.DataHelper.Get("operation_request", Query.EQ("_id", Id));
     ViewBag.Title = "Chi tiết yêu cầu";
     return(View("~/Views/Report/Detail.cshtml", transaction));
 }
Beispiel #2
0
 public JsonResult CashIn_ATM(string amount, string bank)
 {
     bank = ProxyController.GetBankCode(bank);
     string request = @"{system:'web_frontend', module:'transaction',type:'two_way', function:'CASHIN',request:{channel:'WEB', profile:"
          + ((dynamic)Session["user_profile"])._id
         + ",service:'GNCP', provider:'BANKNET', payment_provider:'BANKNET', amount: " + amount +
     ", note: '" + "CASH IN ACCOUNT " + ((dynamic)Session["user_profile"])._id + ", AMOUNT " + amount +
     "', bank:'" + bank +
     "'}}";
     dynamic response = new eWallet.Data.DynamicObj(Helper.RequestToServer(request));
     return Json(new { error_code = response.error_code, error_message = response.error_message, url_redirect = response.response.url_redirect }, JsonRequestBehavior.AllowGet);
 }
Beispiel #3
0
 public JsonResult CashOut_Bank(string account_id, string amount, string note)
 {
     dynamic account = Helper.DataHelper.Get("cashout_bank_account",
         Query.EQ("_id", account_id));
     string request = @"{system:'web_frontend', module:'transaction',type:'two_way', function:'CASHOUT',request:{channel:'WEB', profile:"
        + ((dynamic)Session["user_profile"])._id + ",service:'GNCP', provider:'BANK',payment_provider:'GNCA',amount: " + amount +
      ", note: '" + note +
      "', receiver:{account_bank:'" + account.bank +
      "', account_branch:'" + account.branch + "',account_number:'" + account.number +
      "',account_name:'" + account.name + "'}}}";
     dynamic response = new eWallet.Data.DynamicObj(Helper.RequestToServer(request));
     if (response.error_code == "00")
         return Json(new { error_code = response.error_code, error_message = response.error_message, url_redirect = response.response.url_redirect, trans_id = response.response.trans_id, amount = response.response.amount }, JsonRequestBehavior.AllowGet);
     else
         return Json(new { error_code = response.error_code, error_message = response.error_message}, JsonRequestBehavior.AllowGet);
 }
Beispiel #4
0
 public void LoginUser(string user_id, string name, string email, string picture, string access_token)
 {
     if (Session["user_id"] == null)
     {
         dynamic profile = Helper.Data.Get("profile", Query.EQ("_id", user_id));
         Session["user_id"] = user_id;
         Session["access_token"] = access_token;
         if (profile == null)
         {
             profile = new eWallet.Data.DynamicObj();
             profile._id = user_id;
             profile.email = email;
             profile.name = name;
             profile.picture = picture;
             Helper.Data.Insert("profile", profile);
         }
     }
     ///Logic
     /// Check xem user ton tai ko
     /// - Neu ko, dang ky
     /// - Neu roi, by pass
     ///
 }
Beispiel #5
0
 public string Process(string Request)
 {
     try
      {
          dynamic _dynamicRequest = new eWallet.Data.DynamicObj(Request);
          _dynamicRequest._id = Guid.NewGuid().ToString();
          _dynamicRequest.status = "NEW";
          _data.Insert("core_request", _dynamicRequest);
          string module = _dynamicRequest.module.ToString();
          if (_dynamicRequest.type == "two_way")
          {
              return Business.BusinessFactory.GetBusiness(module).GetResponse(_dynamicRequest._id).ToString();
          }
          else {
              _dynamicRequest.error_code = "00";
              _dynamicRequest.error_message = "Success";
              return _dynamicRequest;
          }
      }
      catch
      {
          return String.Empty;
      }
 }
        //public ActionResult ListBillinginfo()
        //{
        //    return View("~/Views/Box/Billing_info.cshtml");
        //}

        public ActionResult ViewBillinginfo(string Id)
        {
            eWallet.Data.DynamicObj transaction = (eWallet.Data.DynamicObj)Helper.DataHelper.Get("billing_info", Query.EQ("_id", long.Parse(Id)));
            ViewBag.Title = "Chi tiết Billinginfo";
            return(View("~/Views/Report/Detail.cshtml", transaction));
        }
Beispiel #7
0
 public JsonResult PostLogin(string email, string password, bool is_remember)
 {
     string _srequest = @"{system:'web_frontend', module:'security',type:'two_way', function:'login',request:{id:'" + email + "', password:'******'}}";
     dynamic result = new eWallet.Data.DynamicObj(Helper.RequestToServer(_srequest));
     if (result.error_code.ToString() == "00")
     {
         FormsAuthentication.SetAuthCookie(email, false);
         Session["user_profile"] = result.response;
         //if (!String.IsNullOrEmpty(ReturnUrl)) return Redirect(ReturnUrl);
         //return RedirectToAction("Index", "Home");
     }
     else
     {
         //ModelState.AddModelError("login_error", result.error_message.ToString());
         //return View();
     }
     return Json(new { error_code = result.error_code.ToString(), error_message = result.error_message.ToString() }, JsonRequestBehavior.AllowGet);
 }
Beispiel #8
0
        public ActionResult Me()
        {
            if (Session["user_profile"] == null)
                return RedirectToAction("Login", "Home");
            string _request = @"{system:'web_frontend', module:'finance', type:'two_way', function:'list_account_profile', request:{profile_id:"
            + ((dynamic)Session["user_profile"])._id +
            "}}";

            dynamic result = new eWallet.Data.DynamicObj(Helper.RequestToServer(_request));
            ViewBag.accounts = result.response;
            return View();
        }
Beispiel #9
0
 public JsonResult Payment_PayBill(string service, string provider, string bill_code, long amount, string payment_provider, string bank)
 {
     string request = @"{system:'web_frontend', module:'transaction',type:'two_way', function:'payment',request:{channel:'web', profile:"
         + ((dynamic)Session["user_profile"])._id
        + ", product_code: '" + bill_code
        + "', service: '" + service
        + "', provider: '" + provider
        + "', amount: " + amount
        + ", payment_provider: '" + payment_provider
        + "', bank: '" + bank +
        "'}}";
     dynamic response = new eWallet.Data.DynamicObj(Helper.RequestToServer(request));
     return Json(new { error_code = response.error_code, error_message = response.error_message, url_redirect = response.response.url_redirect, trans_id = response.response.trans_id, amount = response.response.amount }, JsonRequestBehavior.AllowGet);
 }
 public ActionResult ViewTransaction(string Id)
 {
     eWallet.Data.DynamicObj transaction = (eWallet.Data.DynamicObj)Helper.DataHelper.Get("finance_transaction", Query.EQ("_id", Id));
     ViewBag.Title = "Chi tiết giao dịch";
     return(View("~/Views/Report/Detail.cshtml", transaction));
 }
 public ActionResult ViewAccount(string Id)
 {
     eWallet.Data.DynamicObj transaction = (eWallet.Data.DynamicObj)Helper.DataHelper.Get("finance_account", Query.EQ("_id", long.Parse(Id)));
     ViewBag.Title = "Chi tiết tài khoản";
     return(View("~/Views/Report/Detail.cshtml", transaction));
 }
Beispiel #12
0
        public JsonResult Send(string receiver, long amount, string message, string pass_code, string bank)
        {
            string trans_id = Helper.Data.GetNextSquence("trans_" + DateTime.Today.ToString("YYMMDD")).ToString().PadLeft(6, '0');
            JArray array = JArray.Parse(receiver);
            List<eWallet.Data.DynamicObj> list_receiver = new List<eWallet.Data.DynamicObj>();
            foreach (dynamic arr in array)
                list_receiver.Add(new eWallet.Data.DynamicObj(arr.ToString()));

            dynamic response = new eWallet.Data.DynamicObj();
            dynamic tran_info = new eWallet.Data.DynamicObj();

            tran_info._id = Guid.NewGuid().ToString();
            tran_info.trans_id = trans_id;
            tran_info.type = "SEND_MONEY";
            tran_info.profile = Session["user_id"];
            tran_info.per_amount = amount;
            tran_info.total_amount = amount * list_receiver.Count;
            tran_info.message = message;
            //dynamic list = JObject.Parse(receiver);
            tran_info.receiver = list_receiver.ToArray();
            //foreach(var item in array)
            //{
            //    tran_info.receiver.pus
            //}
            tran_info.is_split = false;

            tran_info.pass_code = pass_code;
            tran_info.is_split_with_me = false;
            tran_info.source_account = new eWallet.Data.DynamicObj();
            tran_info.source_account.type = "ATM";
            tran_info.source_account.bank_code = bank;
            string url_confirm = "transaction_type=cashtosend&trans_id=" + tran_info._id + "&amount=" + tran_info.total_amount;

            string bank_net_result = SendOrder(
                "CASHTOSEND",
                trans_id,
                "moneynow",
                tran_info.total_amount.ToString(),
                "0",
                "0",
                bank,
                url_confirm
                );
            tran_info.partner_return = bank_net_result;

            string[] url_params = bank_net_result.Split('|');
            if (url_params[0] == "010")
            {
                url_params[2] = url_params[2].Substring(0, int.Parse(url_params[1]));
                response.url_redirect = url_params[2].Substring(0, int.Parse(url_params[1]));
                response.error_code = "00";
                response.error_message = "Khoi tao giao dich thanh cong";
                tran_info.status = "CASHIN";
                tran_info.partner_trans_id = response.url_redirect.Split('=')[1];
                tran_info.partner_confirm_return = ConfirmOrder(trans_id, tran_info.partner_trans_id);
                Helper.Data.Insert("transactions", tran_info);

                return Json(new { error_code = response.error_code, error_message = response.error_message, url_redirect = response.url_redirect }, JsonRequestBehavior.AllowGet);
            }
            else
            {
                return Json(new { error_code = "96", error_message = "Có lỗi trong quá trình xử lý. Vui lòng thử lại sau", url_redirect = "" }, JsonRequestBehavior.AllowGet);
            }
        }
Beispiel #13
0
        private void SentMessage(dynamic msg, string channel, string mobilePhone, string errorCode, string errorMessage)
        {
            //DataHelper.SendMessage(msg.Id, msg.SendContent, errorCode);
            dynamic message = _data.Get("sms_message", Query.EQ("_id", msg._id));
            message.Status = errorCode;
            message.SendContent = msg.SendContent;
            message.SendTime = DateTime.Now;
            _data.Save("sms_message", message);
            dynamic log = new eWallet.Data.DynamicObj();
            log.ErrorCode = errorCode;
            log.ErrorMessage = errorMessage;
            log.LogTime = DateTime.Now;
            log.MessageId = msg.Id;
            log.ReceiverPhone = mobilePhone;
            log.SendContent = msg.SendContent;

            _data.Save("sms_log", log);
        }