public string CreateVirtualWallet([FromBody] AccountHolderInformation accountHolderInformation, int merchantAccountID, String apiKey) { VirtualWalletTestAPI wallet = new VirtualWalletTestAPI(); myDBCommand.Parameters.Clear(); myDBCommand.CommandType = CommandType.StoredProcedure; myDBCommand.CommandText = "tp_CheckForAPIKeyAndMerchantAccountID"; myDBCommand.Parameters.AddWithValue("@theAPIKey", apiKey); myDBCommand.Parameters.AddWithValue("@theMerchantAccountID", merchantAccountID); DataSet selectedAPIKey = myDBConnect.GetDataSetUsingCmdObj(myDBCommand); //check if APIKey exists if (selectedAPIKey != null && selectedAPIKey.Tables.Count > 0 && selectedAPIKey.Tables[0].Rows.Count > 0) { myDBCommand.CommandType = CommandType.StoredProcedure; myDBCommand.Parameters.Clear(); myDBCommand.CommandText = "tp_CreateVirtualWallet"; myDBCommand.Parameters.AddWithValue("@theEmail", accountHolderInformation.Email); myDBCommand.Parameters.AddWithValue("@theCardType", accountHolderInformation.CardType); myDBCommand.Parameters.AddWithValue("@theAccountNumber", accountHolderInformation.AccountNumber); //SqlParameter outputParameter = new SqlParameter("@theVirtualWalletID", 0); myDBCommand.Parameters.Add("@theVirtualWalletID", SqlDbType.Int).Direction = ParameterDirection.Output; //outputParameter.Direction = ParameterDirection.Output; //myDBCommand.Parameters.Add(outputParameter); myDBConnect.DoUpdateUsingCmdObj(myDBCommand); int id = Convert.ToInt32(myDBCommand.Parameters["@theVirtualWalletID"].Value); return("true"); } return("API Key and Merchant Account ID do not match"); }
public int CreateVirtualWallet(String name, String bankAccountType, String bankAccountNumber, int merchantAccountID, String apiKey) { VirtualWalletTestAPI wallet = new VirtualWalletTestAPI(); wallet.Name = name; wallet.Balance = 0.0; wallet.BankAccountNumber = bankAccountType; wallet.BankAccountNumber = bankAccountNumber; myDBCommand.Parameters.Clear(); myDBCommand.CommandType = CommandType.StoredProcedure; myDBCommand.CommandText = "tp_CheckForAPIKey"; myDBCommand.Parameters.AddWithValue("@theAPIKey", apiKey); DataSet selectedAPIKey = myDBConnect.GetDataSetUsingCmdObj(myDBCommand); //check if APIKey exists if (selectedAPIKey.Tables.Count > 0 && selectedAPIKey != null) { myDBCommand.Parameters.Clear(); myDBCommand.CommandType = CommandType.StoredProcedure; myDBCommand.CommandText = "tp_CheckForMerchantAccountID"; myDBCommand.Parameters.AddWithValue("@theMerchantAccountID", merchantAccountID); DataSet selectedVirtualWalletID = myDBConnect.GetDataSetUsingCmdObj(myDBCommand); //check if merchant account exists if (selectedVirtualWalletID.Tables.Count > 0 && selectedVirtualWalletID != null) { myDBCommand.Parameters.Clear(); myDBCommand.CommandType = CommandType.StoredProcedure; myDBCommand.CommandText = "tp_CreateVirtualWallet"; myDBCommand.Parameters.AddWithValue("@theName", name); myDBCommand.Parameters.AddWithValue("@theBankAccountType", bankAccountType); myDBCommand.Parameters.AddWithValue("@theBankAccountNumber", bankAccountNumber); SqlParameter outputParameter = new SqlParameter("@theVirtualWalletID", 0); outputParameter.Direction = ParameterDirection.Output; myDBCommand.Parameters.Add(outputParameter); myDBConnect.DoUpdateUsingCmdObj(myDBCommand); int id; id = int.Parse(myDBCommand.Parameters["@theVirtualWalletID"].Value.ToString()); return(id); } } return(null); }
public String CreateVirtualWallet(String name, String bankAccountType, String bankAccountNumber, int merchantAccountID, String apiKey) { VirtualWalletTestAPI wallet = new VirtualWalletTestAPI(); wallet.Name = name; wallet.Balance = 0.0; wallet.BankAccountNumber = bankAccountType; wallet.BankAccountNumber = bankAccountNumber; myDBCommand.Parameters.Clear(); myDBCommand.CommandType = CommandType.StoredProcedure; myDBCommand.CommandText = "tp_CheckForAPIKey"; myDBCommand.Parameters.AddWithValue("@theAPIKey", apiKey); DataSet selectedAPIKey = myDBConnect.GetDataSetUsingCmdObj(myDBCommand); //check if APIKey exists if (selectedAPIKey.Tables.Count > 0 && selectedAPIKey != null) { myDBCommand.Parameters.Clear(); myDBCommand.CommandType = CommandType.StoredProcedure; myDBCommand.CommandText = "tp_CheckForMerchantAccountID"; myDBCommand.Parameters.AddWithValue("@theMerchantAccountID", merchantAccountID); DataSet selectedVirtualWalletID = myDBConnect.GetDataSetUsingCmdObj(myDBCommand); //check if merchant account exists if (selectedVirtualWalletID.Tables.Count > 0 && selectedVirtualWalletID != null) { myDBCommand.Parameters.Clear(); myDBCommand.CommandType = CommandType.StoredProcedure; myDBCommand.CommandText = "tp_CreateVirtualWallet"; myDBCommand.Parameters.AddWithValue("@theName", name); myDBCommand.Parameters.AddWithValue("@theBankAccountType", bankAccountType); myDBCommand.Parameters.AddWithValue("@theBankAccountNumber", bankAccountNumber); myDBConnect.DoUpdateUsingCmdObj(myDBCommand); return "" } } return("try again"); }