// Check that there is amount can be authorized, create a token // return token and routing info public EFTBindingInfo AuthorizeFundsTransfer(int acctID, decimal amount) { // To allow server to work until client header authentication/encryption added if (authInfo == null) { authInfo = tempAuthInfo; } System.Data.SqlClient.SqlDataAdapter adapter; System.Data.SqlClient.SqlCommand cmd; System.Data.SqlClient.SqlConnection conn; string connString = (string)ConfigurationSettings.AppSettings["connectStringWoodgrove"]; string transID; conn = new System.Data.SqlClient.SqlConnection(); adapter = new System.Data.SqlClient.SqlDataAdapter(); cmd = new System.Data.SqlClient.SqlCommand(); // // cmd // // _EFTAuthorize(@userID AS nvarchar(50), @password AS nvarchar(50), @acctID as int, @amt as money, @token as nvarchar(50) output) cmd.CommandText = "_EFTAuthorize"; cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.Connection = conn; cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@RETURN_VALUE", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.ReturnValue, true, ((System.Byte)(10)), ((System.Byte)(0)), "", System.Data.DataRowVersion.Current, null)); cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@userID", System.Data.SqlDbType.NVarChar, 16, System.Data.ParameterDirection.Input, true, ((System.Byte)(10)), ((System.Byte)(0)), "", System.Data.DataRowVersion.Current, authInfo.Username)); cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@password", System.Data.SqlDbType.NVarChar, 16, System.Data.ParameterDirection.Input, true, ((System.Byte)(10)), ((System.Byte)(0)), "", System.Data.DataRowVersion.Current, authInfo.Password)); cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@acctID", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, true, ((System.Byte)(10)), ((System.Byte)(0)), "", System.Data.DataRowVersion.Current, acctID)); cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@amt", System.Data.SqlDbType.Money, 8, System.Data.ParameterDirection.Input, true, ((System.Byte)(0)), ((System.Byte)(0)), "", System.Data.DataRowVersion.Current, amount)); cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@EFTTransactionID", System.Data.SqlDbType.NVarChar, 50, System.Data.ParameterDirection.Output, true, ((System.Byte)(0)), ((System.Byte)(0)), "", System.Data.DataRowVersion.Current, null)); // // conn // conn.ConnectionString = connString; try { // Open connection, execute, close connection conn.Open(); cmd.ExecuteNonQuery(); conn.Close(); transID = cmd.Parameters["@EFTTransactionID"].Value.ToString(); } catch (SqlException se) { Trace.WriteLine(se.Message); throw new SoapException(se.Message, null); } // Create and set binding info EFTBindingInfo info = new EFTBindingInfo(); // Calculate expire date and format token DateTime expires = DateTime.Now.AddMinutes(5); info.token = string.Format("<eft><transactionID>{0}</transactionID><acct>{1}</acct><amt>{2}</amt><expires>{3}</expires></eft>", transID, acctID, amount, expires); info.endPoint = string.Format("http://{0}/Woodgrove/Bank.asmx", Environment.MachineName); Context.Trace.Write(string.Format("Endpoint: {0} AuthorizeFundsTransfer Acct:{1} Amt:{2}", info.endPoint, acctID, amount)); return(info); }
// Check that there is amount can be authorized, create a token // return token and routing info public EFTBindingInfo AuthorizeFundsTransfer(int acctID, decimal amount) { // To allow server to work until client header authentication/encryption added if (authInfo == null) authInfo = tempAuthInfo; System.Data.SqlClient.SqlDataAdapter adapter; System.Data.SqlClient.SqlCommand cmd; System.Data.SqlClient.SqlConnection conn; string connString = (string)ConfigurationSettings.AppSettings["connectStringWoodgrove"]; string transID; conn = new System.Data.SqlClient.SqlConnection(); adapter = new System.Data.SqlClient.SqlDataAdapter(); cmd = new System.Data.SqlClient.SqlCommand(); // // cmd // // _EFTAuthorize(@userID AS nvarchar(50), @password AS nvarchar(50), @acctID as int, @amt as money, @token as nvarchar(50) output) cmd.CommandText = "_EFTAuthorize"; cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.Connection = conn; cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@RETURN_VALUE", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.ReturnValue, true, ((System.Byte)(10)), ((System.Byte)(0)), "", System.Data.DataRowVersion.Current, null)); cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@userID", System.Data.SqlDbType.NVarChar, 16, System.Data.ParameterDirection.Input, true, ((System.Byte)(10)), ((System.Byte)(0)), "", System.Data.DataRowVersion.Current, authInfo.Username)); cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@password", System.Data.SqlDbType.NVarChar, 16, System.Data.ParameterDirection.Input, true, ((System.Byte)(10)), ((System.Byte)(0)), "", System.Data.DataRowVersion.Current, authInfo.Password)); cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@acctID", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, true, ((System.Byte)(10)), ((System.Byte)(0)), "", System.Data.DataRowVersion.Current, acctID)); cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@amt", System.Data.SqlDbType.Money, 8, System.Data.ParameterDirection.Input, true, ((System.Byte)(0)), ((System.Byte)(0)), "", System.Data.DataRowVersion.Current, amount)); cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@EFTTransactionID", System.Data.SqlDbType.NVarChar, 50, System.Data.ParameterDirection.Output, true, ((System.Byte)(0)), ((System.Byte)(0)), "", System.Data.DataRowVersion.Current, null)); // // conn // conn.ConnectionString = connString; try { // Open connection, execute, close connection conn.Open(); cmd.ExecuteNonQuery(); conn.Close(); transID = cmd.Parameters["@EFTTransactionID"].Value.ToString(); } catch (SqlException se) { Trace.WriteLine(se.Message); throw new SoapException(se.Message, null); } // Create and set binding info EFTBindingInfo info = new EFTBindingInfo(); // Calculate expire date and format token DateTime expires = DateTime.Now.AddMinutes(5); info.token = string.Format("<eft><transactionID>{0}</transactionID><acct>{1}</acct><amt>{2}</amt><expires>{3}</expires></eft>", transID, acctID, amount, expires); info.endPoint = string.Format("http://{0}/Woodgrove/Bank.asmx",Environment.MachineName); Context.Trace.Write(string.Format("Endpoint: {0} AuthorizeFundsTransfer Acct:{1} Amt:{2}", info.endPoint,acctID,amount)); return info; }