コード例 #1
0
        public ActionResult LoadBalanceIndex(LoadBalanceModel balance)
        {
            LoadBalanceCommon ld = new LoadBalanceCommon();

            balance.action_user    = Session["UserName"].ToString();
            balance.action_ip      = ApplicationUtilities.GetIP();
            balance.action_browser = HttpContext.Request.Browser.ToString();

            ld = balance.MapObject <LoadBalanceCommon>();

            string           redirectUrl = "";
            CommonDbResponse dbResponse  = _iLoad.LoadBalance(ld);

            if (dbResponse.Code == ResponseCode.Success)
            {
                var modeleResponse = MakeHttpRequest.InvokeGetProcessId("1", "anujApi", dbResponse.Extra1, balance.amount, "", "anujApi", "Anuj@123", "AnujSecert");
                if (modeleResponse.code == "0")
                {
                    ProcessResponse             midddlewareModel = ApplicationUtilities.MapObject <ProcessResponse>(modeleResponse.data);
                    Dictionary <String, string> formParams       = new Dictionary <string, string>();
                    formParams.Add("MerchantId", midddlewareModel.MerchantId);
                    formParams.Add("MerchantTxnId", midddlewareModel.MerchantTxnId);
                    formParams.Add("ProcessId", midddlewareModel.ProcessId);
                    formParams.Add("Amount", midddlewareModel.Amount.ToString());
                    formParams.Add("TransactionRemarks", balance.remarks);
                    formParams.Add("MerchantName", "anujApi");

                    var responseObj = ApplicationUtilities.FormBuilder("gateway", midddlewareModel.GatewayFormMethod, midddlewareModel.GatewayUrl, formParams);
                    Response.Write(responseObj);
                    Response.End();
                }
            }
            return(View(balance));
        }
コード例 #2
0
        public ActionResult ReceivePaymentNotification(string MerchantTxnId, string GatewayTxnId)
        {
            //check MerchantTxnId in our db first
            var dbRes = _iLoad.CheckTrnasactionExistence(MerchantTxnId, GatewayTxnId);

            if (dbRes.Code == ResponseCode.Success)
            {
                string apiusername  = ApplicationUtilities.GetAppConfigValue("apiusername");
                string apipasssword = ApplicationUtilities.GetAppConfigValue("apipasssword");
                string apisecretkey = ApplicationUtilities.GetAppConfigValue("apisecretkey");
                string merchantname = ApplicationUtilities.GetAppConfigValue("merchantname");
                string merchantid   = ApplicationUtilities.GetAppConfigValue("merchantid");
                try
                {
                    MiddleServiceRequest serviceCall = new MiddleServiceRequest("cgpay", apiusername, apipasssword, apisecretkey);
                    var resp = serviceCall.GetTransactionDetail(merchantid, merchantname, MerchantTxnId);

                    if (resp.code == "0")
                    {
                        var transactionModel       = ApplicationUtilities.MapObject <CheckTransactionResponse>(resp.data);
                        LoadBalanceCommon lBalance = new LoadBalanceCommon()
                        {
                            pmt_gateway_id     = "",
                            pmt_gateway_txn_id = GatewayTxnId,
                            gateway_status     = transactionModel.Status,
                            gateway_process_id = "",
                            action_user        = "******",
                            action_ip          = ApplicationUtilities.GetIP(),
                            bank_name          = transactionModel.Institution,
                            payment_mode       = transactionModel.Instrument,
                            pmt_txn_id         = MerchantTxnId,
                            amount             = transactionModel.Amount,
                            service_charge     = transactionModel.ServiceCharge
                        };
                        _iLoad.UpdateTransaction(lBalance);
                    }
                }
                catch (Exception ex)
                {
                    string msg = ex.Message;
                    throw;
                }
            }
            Response.Write("Received");
            Response.End();
            return(View());



            // then check if transaction is already updated by merchanttxnid and gatewaytxnid



            //if transaction exists or already received or txn not found
            //return "Received";
            //
        }
コード例 #3
0
        public CommonDbResponse UpdateTransaction(LoadBalanceCommon balance)
        {
            CommonDbResponse dbRes      = new CommonDbResponse();
            string           sqlCommand = "Execute sproc_payment_gateway_transaction @flag = 'u'";

            sqlCommand += ",@pmt_txn_id = " + DAO.FilterString(balance.pmt_txn_id);
            sqlCommand += ",@service_charge = " + DAO.FilterString(balance.service_charge);
            sqlCommand += ",@amount = " + DAO.FilterString(balance.amount);
            sqlCommand += ",@card_no = " + DAO.FilterString(balance.card_no);
            sqlCommand += ",@remarks = " + DAO.FilterString(balance.remarks);
            sqlCommand += ",@user_id = " + DAO.FilterString(balance.user_id);
            sqlCommand += ",@gateway_status = " + DAO.FilterString(balance.gateway_status);
            sqlCommand += ",@pmt_gateway_id = " + DAO.FilterString(balance.pmt_gateway_id);
            sqlCommand += ",@action_user = "******",@action_browser = " + DAO.FilterString(balance.action_browser);
            sqlCommand += ",@error_code = " + DAO.FilterString(balance.error_code);
            sqlCommand += ",@action_ip = " + DAO.FilterString(balance.action_ip);
            sqlCommand += ",@pmt_gateway_txn_id = " + DAO.FilterString(balance.pmt_gateway_txn_id);
            sqlCommand += ",@gateway_process_id = " + DAO.FilterString(balance.gateway_process_id);
            sqlCommand += ",@pmt_gateway_name = " + DAO.FilterString(balance.bank_name);
            sqlCommand += ",@txn_type = " + DAO.FilterString(balance.payment_mode);
            var dbResponse = DAO.ExecuteDataRow(sqlCommand);

            if (dbResponse != null)
            {
                string code     = dbResponse["Code"].ToString();
                string messasge = dbResponse["message"].ToString();
                string id       = dbResponse["id"].ToString();
                if ((code ?? "1") == "0")
                {
                    dbRes.Code    = ResponseCode.Success;
                    dbRes.Message = messasge;
                    dbRes.Extra1  = id;
                }
                else
                {
                    dbRes.Code    = ResponseCode.Failed;
                    dbRes.Message = messasge;
                    dbRes.Extra1  = id;
                }
                return(dbRes);
            }
            else
            {
                dbRes.Code    = ResponseCode.Failed;
                dbRes.Message = "Something Went Wrong";
            }
            return(dbRes);
        }
コード例 #4
0
        public ActionResult ReceivePaymentNotification(string MerchantTxnId, string GatewayTxnId)
        {
            //check MerchantTxnId in our db first
            var dbRes = _iLoad.CheckTrnasactionExistence(MerchantTxnId, GatewayTxnId);

            if (dbRes.Code == 0)
            {
                ewallet.application.Models.OnePG.CommonResponse resp = MakeHttpRequest.InvokeCheckTransactionStatus("1", "anujApi", MerchantTxnId, "anujApi", "Anuj@123", "AnujSecert");
                if (resp.code == "0")
                {
                    var transactionModel       = ApplicationUtilities.MapObject <CheckTransactionResponse>(resp.data);
                    LoadBalanceCommon lBalance = new LoadBalanceCommon()
                    {
                        pmt_gateway_id     = "",
                        pmt_gateway_txn_id = GatewayTxnId,
                        gateway_status     = transactionModel.Status,
                        gateway_process_id = "",
                        action_user        = "******",
                        action_ip          = ApplicationUtilities.GetIP(),
                        bank_name          = transactionModel.Institution,
                        payment_mode       = transactionModel.Instrument,
                        pmt_txn_id         = MerchantTxnId
                    };
                    _iLoad.UpdateTransaction(lBalance);
                }
            }

            // then check if transaction is already updated by merchanttxnid and gatewaytxnid

            //if transaction exists or already received or txn not found
            //return "Received";


            //
            Response.Write("Received");
            Response.End();
            return(View());
        }
コード例 #5
0
 public CommonDbResponse UpdateTransaction(LoadBalanceCommon balance)
 {
     return(_repo.UpdateTransaction(balance));
 }
コード例 #6
0
 public CommonDbResponse LoadBalance(LoadBalanceCommon balance)
 {
     return(_repo.LoadBalance(balance));
 }
コード例 #7
0
        public ActionResult LoadBalanceIndex(LoadBalanceModel balance)
        {
            CommonDbResponse dbResponse = new CommonDbResponse();
            var dbLimits = _iLoad.GetTransactionLimit(Session["AgentId"].ToString());
            var limits   = dbLimits.Data.MapObject <LoadBalanceModel>();

            if (Convert.ToInt32(balance.amount) < 10 || Convert.ToInt32(balance.amount) > 100000)
            {
                return(View(limits));
            }

            //if (
            //    int.Parse(balance.amount) > limits.transactiondailylimitmax
            //    || int.Parse(balance.amount) > limits.transactionmonthlylimitmax
            //    )
            //{
            //    dbResponse.Code = ResponseCode.Failed;
            //    dbResponse.Message = "Amount Exceeded Transaction Limit";
            //    dbResponse.SetMessageInTempData(this);
            //    return View(limits);
            //}
            if (int.Parse(balance.amount) > limits.transactiondailylimitmax && int.Parse(balance.amount) <= limits.transactionmonthlylimitmax)
            {
                dbResponse.Code    = ResponseCode.Failed;
                dbResponse.Message = "Amount Exceeded Daily Transaction Limit";
                dbResponse.SetMessageInTempData(this);
                return(View(limits));
            }
            if (int.Parse(balance.amount) > limits.transactionmonthlylimitmax)
            {
                dbResponse.Code    = ResponseCode.Failed;
                dbResponse.Message = "Amount Exceeded Monthly Transaction Limit";
                dbResponse.SetMessageInTempData(this);
                return(View(limits));
            }


            LoadBalanceCommon ld = new LoadBalanceCommon();

            if (ModelState.IsValid)
            {
                balance.action_user    = Session["UserName"].ToString();
                balance.action_ip      = ApplicationUtilities.GetIP();
                balance.action_browser = HttpContext.Request.Browser.ToString();



                ld         = balance.MapObject <LoadBalanceCommon>();
                dbResponse = _iLoad.LoadBalance(ld);
                if (dbResponse.Code == ResponseCode.Success)
                {
                    string apiusername  = ApplicationUtilities.GetAppConfigValue("apiusername");
                    string apipasssword = ApplicationUtilities.GetAppConfigValue("apipasssword");
                    string apisecretkey = ApplicationUtilities.GetAppConfigValue("apisecretkey");
                    string merchantname = ApplicationUtilities.GetAppConfigValue("merchantname");
                    string merchantid   = ApplicationUtilities.GetAppConfigValue("merchantid");

                    try
                    {
                        MiddleServiceRequest middlewareCall = new MiddleServiceRequest("cgpay", apiusername, apipasssword, apisecretkey, Session["UserName"].ToString());
                        var response = middlewareCall.GetFormObject(merchantid, merchantname, dbResponse.Extra1, balance.amount, dbResponse.Extra2, balance.instrument_code);
                        if (response != null && response.code == "0")
                        {
                            var formString = ApplicationUtilities.MapObject <MiddlewareResponse.FormDataObject>(response.data);
                            Response.Write(formString.FormData);
                            Response.End();
                        }
                        else if (response != null && response.code == "1")
                        {
                            dbResponse.Code    = ResponseCode.Failed;
                            dbResponse.Message = response.message;
                            // dbResponse.SetMessageInTempData(this);
                            return(View(limits));
                        }
                        else
                        {
                            dbResponse.Code    = ResponseCode.Failed;
                            dbResponse.Message = "Service Call Failed";
                            //dbResponse.SetMessageInTempData(this);
                            return(View(limits));
                        }
                    }
                    catch (Exception)
                    {
                        dbResponse.Code    = ResponseCode.Failed;
                        dbResponse.Message = "Service Call Failed";
                        // dbResponse.SetMessageInTempData(this);
                        return(View(limits));
                    }
                }
                //dbResponse.SetMessageInTempData(this);
                return(View(limits));
            }

            return(View(limits));
        }