Beispiel #1
0
        //stock transfer for Vinaphone mobile users
        //ChungNN 3/2009
        public OutputInfo stock_transfer(string UserName, string Session_ID, string Request_ID, string MerchantID, string targetMsIsdn, Int32 amount)
        {
            //targetMsIsdn: so thue bao dai ly can nap tien (vd: 0912368466)
            //amount:       so tien can nap (vd: 10000)

            Security   secObj = new Security();
            OutputInfo retObj = new OutputInfo();

            EPaySoap.TransferProcess proObj = new EPaySoap.TransferProcess();

            string strUserName = UserName.Trim();
            string strSession_ID = Session_ID.Trim();
            string strRequest_ID = Request_ID.Trim();
            string strMerchantID = MerchantID.Trim();
            string strtargetMsIsdn = targetMsIsdn.Trim();
            string strProviderCode = string.Empty;
            string strRequest_Time, strResponse_Time;

            retObj = secObj.CheckValid(strUserName, strSession_ID, strRequest_ID, strMerchantID, strtargetMsIsdn, amount, ref strProviderCode);

            //if login failure (status in(1,2,3,4,5))
            if (retObj.status != "0")
            {
                return(retObj);
            }
            else if (strProviderCode != "01")
            {
                retObj.message = "Invalid service provider, only support for Vinaphone.";
                return(retObj);
            }
            //If login successfull
            else
            {
                //log pending status before load
                strRequest_Time = DateTime.Now.ToString();
                proObj.WriteLog_Load(strUserName, strSession_ID, strRequest_ID, strMerchantID, HttpContext.Current.Request.UserHostAddress, "2", "", "0x200", strtargetMsIsdn, amount, "", "", strRequest_Time, strRequest_Time, "00", "log before load", strProviderCode);

                try
                {
                    //process stock transfer for VinaPhone e-load system
                    strRequest_Time = DateTime.Now.ToString();
                    retObj          = proObj.VinaStockTransfer(strMerchantID, strtargetMsIsdn, amount);
                    //Thread.Sleep(AppConfiguration.VinaPhoneTimeout);

                    //log stock transfer result
                    strResponse_Time = DateTime.Now.ToString();
                    proObj.WriteLog_Load(strUserName, strSession_ID, strRequest_ID, strMerchantID, HttpContext.Current.Request.UserHostAddress, retObj.status, retObj.trans_id, "0x200", strtargetMsIsdn, amount, "", "", strRequest_Time, strResponse_Time, "00", "message=" + retObj.message, strProviderCode);
                }
                catch (Exception ex)
                {
                    strResponse_Time = DateTime.Now.ToString();
                    retObj.status    = "6";
                    retObj.message   = "Fail, occur an exception.";
                    proObj.WriteLog("stock transfer on VinaPhone ( targetMsIsdn=" + targetMsIsdn + ", amount = " + amount.ToString() + " ) failure." + Environment.NewLine + "Exception=" + ex.ToString());
                    proObj.WriteLog_Load(strUserName, strSession_ID, strRequest_ID, strMerchantID, HttpContext.Current.Request.UserHostAddress, "1", retObj.trans_id, "0x200", strtargetMsIsdn, amount, "", "", strRequest_Time, strResponse_Time, "01", "Fail, occur an exception.", strProviderCode);
                }
            }

            return(retObj);
        }
Beispiel #2
0
        //direct topup progress
        //ChungNN 26/11/2008
        public OutputInfo load(string UserName, string Session_ID, string Request_ID, string MerchantID, string targetMsIsdn, Int32 amount)
        {
            //targetMsIsdn: so thue bao can nap tien (vd: 0912368466)
            //amount:       so tien can nap (vd: 10000)

            Security   secObj = new Security();
            OutputInfo retObj = new OutputInfo();

            EPaySoap.TransferProcess proObj = new EPaySoap.TransferProcess();

            string strUserName = UserName.Trim();
            string strSession_ID = Session_ID.Trim();
            string strRequest_ID = Request_ID.Trim();
            string strMerchantID = MerchantID.Trim();
            string strtargetMsIsdn = targetMsIsdn.Trim();
            string strProviderCode = string.Empty;
            string strRequest_Time, strResponse_Time;

            retObj = secObj.CheckValid(strUserName, strSession_ID, strRequest_ID, strMerchantID, strtargetMsIsdn, amount, ref strProviderCode);

            //if login failure (status in(1,2,3,4,5))
            if (retObj.status != "0")
            {
                return(retObj);
            }

            //If login successfull
            else
            {
                //log pending status before load
                strRequest_Time = DateTime.Now.ToString();
                proObj.WriteLog_Load(strUserName, strSession_ID, strRequest_ID, strMerchantID, HttpContext.Current.Request.UserHostAddress, "2", "", "0x200", strtargetMsIsdn, amount, "", "", strRequest_Time, strRequest_Time, "00", "log before load", strProviderCode);

                switch (strProviderCode)
                {
                    #region Vinaphone
                case "01":
                    try
                    {
                        //process transfer for VinaPhone e-load system
                        strRequest_Time = DateTime.Now.ToString();
                        retObj          = proObj.VinaLoad(strMerchantID, strtargetMsIsdn, amount);
                        //Thread.Sleep(AppConfiguration.VinaPhoneTimeout);

                        //log load result
                        strResponse_Time = DateTime.Now.ToString();
                        proObj.WriteLog_Load(strUserName, strSession_ID, strRequest_ID, strMerchantID, HttpContext.Current.Request.UserHostAddress, retObj.status, retObj.trans_id, "0x200", strtargetMsIsdn, amount, "", "", strRequest_Time, strResponse_Time, "00", "message=" + retObj.message, strProviderCode);
                    }
                    catch (Exception ex)
                    {
                        strResponse_Time = DateTime.Now.ToString();
                        retObj.status    = "6";
                        retObj.message   = "Fail, occur an exception.";
                        proObj.WriteLog("load on VinaPhone ( targetMsIsdn=" + targetMsIsdn + ", amount = " + amount.ToString() + " ) failure." + Environment.NewLine + "Exception=" + ex.ToString());
                        proObj.WriteLog_Load(strUserName, strSession_ID, strRequest_ID, strMerchantID, HttpContext.Current.Request.UserHostAddress, "1", retObj.trans_id, "0x200", strtargetMsIsdn, amount, "", "", strRequest_Time, strResponse_Time, "01", "Fail, occur an exception.", strProviderCode);
                    }
                    break;
                    #endregion

                    #region Viettel
                case "02":
                    try
                    {
                        //add "84" prefix if Viettel
                        if (strtargetMsIsdn.Substring(0, 1) != "84")
                        {
                            strtargetMsIsdn = "84" + strtargetMsIsdn.Substring(1, strtargetMsIsdn.Length - 2);
                        }

                        //process transfer for Viettel topup system
                        OutputVTload OutputVTObj = new OutputVTload();
                        retObj = proObj.ViettelLoad(strMerchantID, strtargetMsIsdn, amount, OutputVTObj);
                        //Thread.Sleep(AppConfiguration.VinaPhoneTimeout);

                        //log load result
                        proObj.WriteLog_Load(strUserName, strSession_ID, strRequest_ID, strMerchantID, HttpContext.Current.Request.UserHostAddress, retObj.status, retObj.trans_id, "0x200", strtargetMsIsdn, amount, AppConfiguration.ViettelClientID, "", OutputVTObj.request_transaction_time, OutputVTObj.response_transaction_time, OutputVTObj.response_code, "message=" + retObj.message, strProviderCode);
                    }
                    catch (Exception ex)
                    {
                        strResponse_Time = DateTime.Now.ToString();
                        retObj.status    = "6";
                        retObj.message   = "Fail, occur an exception.";
                        proObj.WriteLog("load on Viettel ( targetMsIsdn=" + targetMsIsdn + ", amount = " + amount.ToString() + " ) failure." + Environment.NewLine + "Exception=" + ex.ToString());
                        proObj.WriteLog_Load(strUserName, strSession_ID, strRequest_ID, strMerchantID, HttpContext.Current.Request.UserHostAddress, "1", retObj.trans_id, "0x200", strtargetMsIsdn, amount, "", "", strRequest_Time, strResponse_Time, "01", "Fail, occur an exception.", strProviderCode);
                    }
                    break;
                    #endregion

                    #region Mobifone
                case "03":
                    try
                    {
                        //process transfer for Viettel MobiEz system
                        strRequest_Time = DateTime.Now.ToString();
                        retObj          = proObj.MobiLoad(strMerchantID, targetMsIsdn, (decimal)amount);

                        //log load result
                        strResponse_Time = DateTime.Now.ToString();
                        proObj.WriteLog_Load(strUserName, strSession_ID, strRequest_ID, strMerchantID, HttpContext.Current.Request.UserHostAddress, retObj.status, retObj.trans_id, "0x200", strtargetMsIsdn, amount, "", "", strRequest_Time, strResponse_Time, "00", "message=" + retObj.message, strProviderCode);
                    }
                    catch (Exception ex)
                    {
                        strResponse_Time = DateTime.Now.ToString();
                        retObj.status    = "6";
                        retObj.message   = "Fail, occur an exception.";
                        proObj.WriteLog("load on Mobifone ( targetMsIsdn=" + targetMsIsdn + ", amount = " + amount.ToString() + " ) failure." + Environment.NewLine + "Exception=" + ex.ToString());
                        proObj.WriteLog_Load(strUserName, strSession_ID, strRequest_ID, strMerchantID, HttpContext.Current.Request.UserHostAddress, "1", retObj.trans_id, "0x200", strtargetMsIsdn, amount, "", "", strRequest_Time, strResponse_Time, "01", "Fail, occur an exception.", strProviderCode);
                    }
                    break;
                    #endregion

                default:
                    retObj.status  = "1";
                    retObj.message = "invalid provider.";
                    break;
                }
            }

            return(retObj);
        }