Exemple #1
0
        public IHttpActionResult getEncrypt(dynamic data)
        {
            dynamic objenc = new ExpandoObject();

            try
            {
                string json = JsonConvert.SerializeObject(data);

                string iv  = CryptLib.GenerateRandomIV(16);
                string key = CryptLib.getHashSha256("GSWS TEST", 32);

                string encrypttext = EncryptDecryptAlgoritham.EncryptStringAES(json, key, iv);

                objenc.Status      = 100;
                objenc.encrypttext = encrypttext;
                objenc.key         = iv;
                objenc.Reason      = "";
                return(Ok(objenc));
            }
            catch (Exception ex)
            {
                objenc.Status = 102;
                objenc.Reason = ex.Message.ToString();
                return(Ok(objenc));
            }
        }
Exemple #2
0
        public dynamic authenticatedUserDetails(userAuthenticationModel obj)
        {
            dynamic objdata = new ExpandoObject();

            //string json = JsonConvert.SerializeObject(obj);

            //string iv = CryptLib.GenerateRandomIV(16);
            //string key = CryptLib.getHashSha256(obj.DeptCode, 31);

            //string encrypttext = new CryptLib().encrypt(json, key, iv);


            try
            {
                string decrypted_text = string.Empty;
                if (string.IsNullOrEmpty(obj.ENCRYPTED_DATA) || string.IsNullOrEmpty(obj.KEY) || string.IsNullOrEmpty(obj.IV))
                {
                    objdata.status = 400;
                    objdata.result = null;
                }
                else
                {
                    decrypted_text = EncryptDecryptAlgoritham.DecryptStringAES(obj.ENCRYPTED_DATA, obj.KEY, obj.IV);                    //new CryptLib().decrypt(obj.ENCRYPTED_DATA, obj.KEY, obj.IV);
                    objdata.status = 200;
                    objdata.result = decrypted_text;
                }
            }
            catch (Exception ex)
            {
                objdata.status = 500;
                objdata.result = ex;
            }

            return(objdata);
        }
Exemple #3
0
        public IHttpActionResult walletpay(dynamic data)
        {
            string           serialized_data = JsonConvert.SerializeObject(data);
            MakePaymentModel rootobj         = JsonConvert.DeserializeObject <MakePaymentModel>(serialized_data);

            Decryptdatamodel decryptModel = new Decryptdatamodel();

            decryptModel.encryprtext = rootobj.encryptedData;
            decryptModel.key         = "3fee5395f01bee349feed65629bd442a";
            decryptModel.Ivval       = rootobj.iv;


            string mappath   = HttpContext.Current.Server.MapPath("MakePayment");
            Task   WriteTask = Task.Factory.StartNew(() => new Logdatafile().Write_ReportLog_Exception(mappath, JsonConvert.SerializeObject(rootobj)));

            string       result = EncryptDecryptAlgoritham.DecryptStringAES(decryptModel.encryprtext, decryptModel.key, decryptModel.Ivval);
            paymentModel obj    = JsonConvert.DeserializeObject <paymentModel>(result);

            if (rootobj.type == "TA")
            {
                return(Ok(_Hel.TAWalletMakePayment(obj, rootobj.otp)));
            }
            else if (rootobj.type == "WONE")
            {
                return(Ok(_Hel.walletOnemakePayment(obj)));
            }
            else
            {
                return(Ok("WONE"));
            }
        }
Exemple #4
0
        public IHttpActionResult OrderDetails(dynamic data)
        {
            dynamic objdata = new ExpandoObject();

            try
            {
                //    byte[] dataArray = Convert.FromBase64String(data);
                //    string decodedString = Encoding.UTF8.GetString(dataArray);
                string           serialized_data = JsonConvert.SerializeObject(data);
                MakePaymentModel rootobj         = JsonConvert.DeserializeObject <MakePaymentModel>(serialized_data);

                //     encryptedData = encryptedData.Replace(' ', '+');
                Decryptdatamodel decryptModel = new Decryptdatamodel();
                decryptModel.encryprtext = rootobj.encryptedData;
                decryptModel.key         = "3fee5395f01bee349feed65629bd442a";
                decryptModel.Ivval       = rootobj.iv;

                string mappath   = HttpContext.Current.Server.MapPath("OrderDetails");
                Task   WriteTask = Task.Factory.StartNew(() => new Logdatafile().Write_ReportLog_Exception(mappath, JsonConvert.SerializeObject(decryptModel)));

                string       result = EncryptDecryptAlgoritham.DecryptStringAES(decryptModel.encryprtext, decryptModel.key, decryptModel.Ivval);
                paymentModel obj    = JsonConvert.DeserializeObject <paymentModel>(result);

                return(Ok(_Hel.OrderDetails(obj)));
            }
            catch (Exception ex)
            {
                objdata.status = 500;
                objdata.result = ex.Message.ToString();
            }
            return(Ok(objdata));
        }
Exemple #5
0
        public dynamic initiateSpandanaTransaction(transactionModel obj)
        {
            dynamic objdata = new ExpandoObject();

            try
            {
                obj.TYPE       = "1";
                obj.IP_ADDRESS = HttpContext.Current.Request.UserHostAddress;
                obj.SYS_NAME   = System.Environment.MachineName;
                obj.TXN_ID     = obj.SECRETRAINT_CODE + DateTime.Now.ToString("yymmddHHmm") + new Random().Next(1000, 9999);
                DataTable dt = transactionInsertion(obj);

                if (dt != null && dt.Rows.Count > 0)
                {
                    string encrypttext = "";
                    string iv          = "";

                    iv = CryptLib.GenerateRandomIV(16);
                    string key  = CryptLib.getHashSha256("GSWS TEST", 32);
                    string obj2 = GetInputJsonFormat(obj);
                    encrypttext = EncryptDecryptAlgoritham.EncryptStringAES(obj2, key, iv);

                    objdata.status = 200;
                    if (obj.URL_ID == "340200101")
                    {
                        objdata.URL = "https://www.spandana.ap.gov.in/gsws/servicegrievance_registration?accessToken=" + Token() + "&Volunteerid=2255667788&AadhaarNo=" + obj.UID + "&vvstype=VVS2&DistId=" + obj.Sdistcode + "&MandalId=" + obj.Smcode + "&GpId=" + obj.Svtcode + "&GpFlag=" + obj.SRuflag + "&encryptId=" + encrypttext + "&KEY=" + key + "&IV=" + iv;
                    }
                    else
                    {
                        objdata.URL = "https://www.spandana.ap.gov.in/gsws/servicerequest_registration?HodId=" + obj.SERVICE_CODE + "&accessToken= " + Token() + "&Volunteerid=2255667788&AadhaarNo=" + obj.UID + "&vvstype=VVS2&DistId=" + obj.Sdistcode + "&MandalId=" + obj.Smcode + "&GpId=" + obj.Svtcode + "&GpFlag=" + obj.SRuflag + "&encryptId=" + encrypttext + "&KEY=" + key + "&IV=" + iv;
                    }


                    objdata.Reason = "Record Inserted Successfully !!!";
                }
                else
                {
                    objdata.status = 400;
                    objdata.Reason = "Failed to Insert Record, Please Try Again !!! ";
                }
            }
            catch (Exception ex)
            {
                objdata.status = 500;
                objdata.Reason = "Something Went Wrong.Please Try Again";                //ex.Message.ToString();
            }

            return(objdata);
        }
Exemple #6
0
        public dynamic initiateTransaction(transactionModel obj)
        {
            dynamic objdata = new ExpandoObject();

            try
            {
                obj.TYPE       = "1";
                obj.IP_ADDRESS = HttpContext.Current.Request.UserHostAddress;
                obj.SYS_NAME   = System.Environment.MachineName;
                obj.TXN_ID     = obj.SECRETRAINT_CODE + DateTime.Now.ToString("yyMMddHHmm") + new Random().Next(1000, 9999);
                DataTable dt = transactionInsertion(obj);

                if (dt != null && dt.Rows.Count > 0)
                {
                    string encrypttext = "";
                    string iv          = "";
                    if (obj.TYPE_OF_SERVICE == "1")
                    {
                        iv = CryptLib.GenerateRandomIV(16);
                        string key  = CryptLib.getHashSha256("GSWS TEST", 32);
                        string obj2 = GetInputJsonFormat(obj);
                        encrypttext = EncryptDecryptAlgoritham.EncryptStringAES(obj2, key, iv);
                    }
                    else if (obj.URL_ID == "110401301" || obj.URL_ID == "110102501" || obj.URL_ID == "110102601" || obj.URL_ID == "310300104")
                    {
                        iv = CryptLib.GenerateRandomIV(16);
                        string key  = CryptLib.getHashSha256("GSWS TEST", 32);
                        string obj2 = GetInputJsonFormat(obj);
                        encrypttext = EncryptDecryptAlgoritham.EncryptStringAES(obj2, key, iv);
                    }
                    else if (obj.URL_ID == "200301401" || obj.URL_ID == "360201701" || obj.URL_ID == "360201401" || obj.URL_ID == "130101101" || obj.URL_ID == "280101201" || obj.URL_ID == "280101401" || obj.URL_ID == "280101301" || obj.URL_ID == "360201801" || obj.URL_ID == "3602018501" || obj.URL_ID == "170100102" || obj.URL_ID == "130101401" || obj.URL_ID == "130101501" || obj.URL_ID == "240200101")
                    {
                        iv = CryptLib.GenerateRandomIV(16);
                        string key  = CryptLib.getHashSha256("GSWS TEST", 32);
                        string obj2 = GetInputJsonFormat(obj);
                        encrypttext = EncryptDecryptAlgoritham.EncryptStringAES(obj2, key, iv);
                    }
                    else
                    {
                    }
                    objdata.status = 200;
                    //objdata.Translist = dt;
                    objdata.encrypttext = encrypttext;
                    objdata.key         = iv;
                    objdata.TransId     = obj.TXN_ID;
                    objdata.Reason      = "Record Inserted Successfully !!!";
                }
                else
                {
                    objdata.status = 400;
                    objdata.Reason = "Failed to Insert Record, Please Try Again !!! ";
                }
            }
            catch (Exception ex)
            {
                objdata.status = 500;
                objdata.Reason = "Something Went Wrong.Please Try Again";                //ex.Message.ToString();
            }

            return(objdata);
        }
Exemple #7
0
        public dynamic OrderDetails(paymentModel obj)
        {
            dynamic objdata = new ExpandoObject();

            try
            {
                obj.orderId = "80120201019362644";

                orderDetailsModel rootobj = new orderDetailsModel();
                rootobj.Amount       = obj.Amount;
                rootobj.Description  = obj.Description;
                rootobj.mobileNumber = obj.mobileNumber;
                rootobj.orderId      = obj.orderId;
                rootobj.totalAmount  = obj.totalAmount;
                rootobj.TxnDate      = obj.TxnDate;
                rootobj.userCharges  = obj.userCharges;
                rootobj.userName     = obj.userName;
                rootobj.walletType   = "";


                DataTable dt1 = gswsPaymentRequestProc(obj, "4", "");
                obj.gswsCode    = dt1.Rows[0][0].ToString();
                obj.UniqueTxnId = obj.merchantId + obj.mobileNumber + DateTime.Now.ToString("yyyyMMddhhmmssmm");

                string json = JsonConvert.SerializeObject(obj);

                string iv  = CryptLib.GenerateRandomIV(16);
                string key = CryptLib.getHashSha256("GSWS TEST", 32);

                string encrypttext = EncryptDecryptAlgoritham.EncryptStringAES(json, key, iv);

                obj.encrypttext = encrypttext;
                obj.iv          = iv;

                rootobj.encrypttext = obj.encrypttext;
                rootobj.iv          = obj.iv;


                if (obj.gswsCode == "10690589" || obj.gswsCode == "10690588" || obj.gswsCode == "10690590" || obj.gswsCode == "21073101")
                {
                    rootobj.walletType = "TA";
                }
                else if (obj.gswsCode == "10690567" || obj.gswsCode == "10690568" || obj.gswsCode == "21073097" || obj.gswsCode == "21073098" || obj.gswsCode == "21073099")
                {
                    rootobj.walletType = "WONE";
                }

                else if (obj.gswsCode == "10690581" || obj.gswsCode == "10690561" || obj.gswsCode == "10690574" || obj.gswsCode == "10690572" || obj.gswsCode == "10690573" || obj.gswsCode == "10690582" || obj.gswsCode == "21073095" || obj.gswsCode == "21073096" || obj.gswsCode == "21073082" || obj.gswsCode == "21073083" || obj.gswsCode == "21073085" || obj.gswsCode == "21073088")
                {
                    rootobj.walletType = "APW";
                }


                DataTable dt = gswsPaymentRequestProc(obj, "1", "");
                if (dt != null && dt.Rows.Count > 0)
                {
                    token_gen.initialize();
                    token_gen.expiry_minutes = 60;
                    token_gen.addClaim("admin");
                    token_gen.PRIMARY_MACHINE_KEY   = "10101010101010101010101010101010";
                    token_gen.SECONDARY_MACHINE_KEY = "1010101010101010";
                    token_gen.addResponse("status", "200");
                    token_gen.addResponse("result", JsonConvert.SerializeObject(rootobj));
                    return(token_gen.generate_token());
                }
                else
                {
                    objdata.status = 400;
                    objdata.result = "Invalid Input";
                    string mappath   = HttpContext.Current.Server.MapPath("gswsPaymentRequestProc.");
                    Task   WriteTask = Task.Factory.StartNew(() => new Logdatafile().Write_ReportLog_Exception(mappath, JsonConvert.SerializeObject(obj)));
                }
            }
            catch (Exception ex)
            {
                objdata.status = 500;
                objdata.result = ex.Message.ToString();
            }
            return(objdata);
        }
Exemple #8
0
        public static dynamic paymentOrderDetails(rbkPaymentsModel obj)
        {
            dynamic objdata = new ExpandoObject();

            try
            {
                obj.encrypted_data = obj.encrypted_data.Replace(" ", "+");
                string decrypted_text = EncryptDecryptAlgoritham.DecryptStringAES(obj.encrypted_data, "3fee5395f01bee349feed65629bd442a", obj.iv);

                var input = new
                {
                    id = obj.orderId
                };
                string   input_data = JsonConvert.SerializeObject(input);
                decModel decData    = JsonConvert.DeserializeObject <decModel>(decrypted_text);
                decData.PS_TXN_ID = decData.PS_TXN_ID;                //DateTime.Now.ToString("yyyymmddhhmmssfff");
                string url      = "https://hub.rbk.apagros.ap.gov.in/v1/gew/orderDetails";
                string response = POST_RequestAsync(url, input_data);
                orderDerailsRespModel rootobj = JsonConvert.DeserializeObject <orderDerailsRespModel>(response);

                if (rootobj.Status == 200)
                {
                    resProcModel objRes = new resProcModel();
                    objRes.type          = "7";
                    objRes.txnId         = decData.PS_TXN_ID;
                    objRes.orderId       = obj.orderId;
                    objRes.deptId        = "11";
                    objRes.statusCode    = rootobj.Status.ToString();
                    objRes.remarks       = rootobj.Message;
                    objRes.serviceId     = "110102601";
                    objRes.amount        = rootobj.Data.Amount.ToString();
                    objRes.serviceCharge = "0";                     //rootobj.Data.Amount.ToString();
                    objRes.totalAmount   = (0 + rootobj.Data.Amount).ToString();

                    DataTable dt = resProc(objRes);
                    if (dt != null && dt.Rows.Count > 0 && dt.Rows[0][0].ToString() == "1")
                    {
                        rootobj.Data.gswsTxnId = decData.PS_TXN_ID;
                        objdata.status         = true;
                        objdata.result         = rootobj.Data;
                    }
                    else if (dt != null && dt.Rows.Count > 0 && dt.Rows[0][0].ToString() == "2")
                    {
                        objdata.status = false;
                        objdata.result = "These transaction id is already used please login and try again !!!";
                    }
                    else
                    {
                        objdata.status = false;
                        objdata.result = "Failed to Fetch Record";
                    }
                }
                else
                {
                    objdata.status = false;
                    objdata.result = rootobj.Message;
                }
            }
            catch (Exception ex)
            {
                objdata.status = false;
                objdata.result = ex.Message.ToString();
            }
            return(objdata);
        }
        public static dynamic pensionAppSub(pensionAppSubModel obj)
        {
            dynamic objdata = new ExpandoObject();

            try
            {
                if (obj.pensionType == "3" && string.IsNullOrEmpty(obj.disabilityId))
                {
                    objdata.status = false;
                    objdata.result = "Please Enter SADAREM ID";
                    return(objdata);
                }

                obj.encrypted_data = obj.encrypted_data.Replace(" ", "+");
                string   decrypted_text = EncryptDecryptAlgoritham.DecryptStringAES(obj.encrypted_data, "3fee5395f01bee349feed65629bd442a", obj.iv);
                decModel decData        = JsonConvert.DeserializeObject <decModel>(decrypted_text);

                tokenModel objToken = new tokenModel();
                objToken.username   = "******";
                objToken.password   = "******";
                objToken.wdsLoginId = decData.USERNAME;

                string tokenResponse = string.Empty;
                try
                {
                    tokenResponse = POST_RequestAsync(tokenrUrl, JsonConvert.SerializeObject(objToken));
                }
                catch (Exception ex)
                {
                    objdata.status = false;
                    objdata.result = "RESPONSE FROM PENSION DEPT : " + ex.Message.ToString();
                    return(objdata);
                }

                tokenResponseModel tokenRespObj = JsonConvert.DeserializeObject <tokenResponseModel>(tokenResponse);
                if (string.IsNullOrEmpty(tokenRespObj.Token))
                {
                    objdata.status = false;
                    objdata.result = "No Response from pension department token service !!!, Please try after some time";
                    return(objdata);
                }

                obj.loginId       = decData.USERNAME;
                obj.userName      = "******";
                obj.password      = "******";
                obj.token         = tokenRespObj.Token;
                obj.transactionId = decData.PS_TXN_ID;
                obj.systemIp      = HttpContext.Current.Request.UserHostAddress;

                string subResponse = string.Empty;
                try
                {
                    subResponse = POST_RequestAsync_sub(subrUrl, obj);
                }
                catch (Exception ex)
                {
                    objdata.status = false;
                    objdata.result = "RESPONSE FROM PENSION DEPT : " + ex.Message.ToString();
                    return(objdata);
                }
                subRespModel subResp = JsonConvert.DeserializeObject <subRespModel>(subResponse);

                if (subResp.Response != null && subResp.Response.status_Code == "101")
                {
                    transactionModel objTrans = new transactionModel();
                    objTrans.TYPE        = "2";
                    objTrans.TXN_ID      = decData.PS_TXN_ID;
                    objTrans.DEPT_ID     = "31";
                    objTrans.DEPT_TXN_ID = subResp.Response.BenTransId;
                    objTrans.BEN_ID      = obj.aadharNumber;
                    objTrans.STATUS_CODE = subResp.Response.status_Code;
                    objTrans.REMARKS     = subResp.Response.remarks;

                    transactionHelper transHel = new transactionHelper();
                    DataTable         dt       = transHel.transactionInsertion(objTrans);
                    if (dt != null && dt.Rows.Count > 0 && dt.Rows[0][0].ToString() == "1")
                    {
                        objdata.status = true;
                        objdata.result = subResp.Response.remarks + ", YOUR Grievance ID IS : " + subResp.Response.BenTransId;
                    }
                    else
                    {
                        objdata.status = false;
                        objdata.result = "Failed to submit Details, Please try again !!!";
                    }
                }
                else
                {
                    objdata.status = false;
                    objdata.result = "RESPONSE FROM PENSION DEPT : " + subResp.Response.remarks;
                }
            }
            catch (Exception ex)
            {
                objdata.status = false;
                objdata.result = ex.Message.ToString();
            }
            return(objdata);
        }
Exemple #10
0
        public static dynamic paymentOrderDetails(seedPaymentModel obj)
        {
            dynamic objdata = new ExpandoObject();

            try
            {
                obj.encrypted_data = obj.encrypted_data.Replace(" ", "+");
                string decrypted_text = EncryptDecryptAlgoritham.DecryptStringAES(obj.encrypted_data, "3fee5395f01bee349feed65629bd442a", obj.iv);
                var    input          = new
                {
                    vscode = "11190157",
                    otpid  = obj.orderId
                };
                var mualinput = new
                {
                    deptId        = "1234",
                    deptName      = "Agriculture",
                    serviceName   = "ReceivePayment",
                    serviceType   = "REST",
                    method        = "POST",
                    simulatorFlag = "false",
                    application   = "GWS",
                    username      = "******",
                    data          = input
                };

                string   input_data = JsonConvert.SerializeObject(mualinput);
                decModel decData    = JsonConvert.DeserializeObject <decModel>(decrypted_text);
                //   decData.PS_TXN_ID = DateTime.Now.ToString("yyyymmddhhmmssfff");
                string url = ConfigurationManager.AppSettings["AgricultureApiBaseAddress"].ToString() + "Agriculture/v1/api/v1/agriculture";
                // string url = "https://eseed.ap.gov.in/eseed/RestFul/VSServices/ReceivePayment";
                string response = POST_RequestAsync(url, input_data);
                orderDetailesRespModel rootobj = JsonConvert.DeserializeObject <orderDetailesRespModel>(response);

                if (rootobj.response.status == "1" || rootobj.response.status == "2")
                {
                    resProcModel objRes = new resProcModel();
                    objRes.type          = "1";
                    objRes.txnId         = decData.PS_TXN_ID;
                    objRes.orderId       = obj.orderId;
                    objRes.deptId        = "11";
                    objRes.statusCode    = rootobj.response.status.ToString();
                    objRes.remarks       = rootobj.response.msg;
                    objRes.serviceId     = "1101025";
                    objRes.userCharge    = rootobj.response.amountTobePaid.ToString();
                    objRes.serviceCharge = "0";
                    objRes.totalAmount   = (float.Parse(objRes.userCharge, CultureInfo.InvariantCulture.NumberFormat) + float.Parse(objRes.serviceCharge, CultureInfo.InvariantCulture.NumberFormat)).ToString();

                    DataTable dt = resProc(objRes);
                    if (dt != null && dt.Rows.Count > 0 && dt.Rows[0][0].ToString() == "1")
                    {
                        rootobj.response.gswsTxnId = decData.PS_TXN_ID;
                        objdata.status             = true;
                        objdata.result             = rootobj.response;
                    }
                    else if (dt != null && dt.Rows.Count > 0 && dt.Rows[0][0].ToString() == "2")
                    {
                        objdata.status = false;
                        objdata.result = "These transaction id is already used please login and try again !!!";
                    }
                    else
                    {
                        objdata.status = false;
                        objdata.result = "Failed to Fetch Record";
                    }
                }
                else
                {
                    objdata.status = false;
                    objdata.result = rootobj.response.msg;
                }
            }
            catch (Exception ex)
            {
                objdata.status = false;
                objdata.result = ex.Message.ToString();
            }
            return(objdata);
        }