public string GetPostData(string transactionId, decimal toChargeAmount, string productInfo, Account userAccount, Address contactAddress, string voucherCode) { string url = _providerDetails.PostUrl; const string method = "post"; const string formName = "form1"; string returnUrl = ConfigSettings.PaymentReturnUrl; //key|txnid|amount|productinfo|firstname|email|udf1|udf2|udf3|udf4|udf5||||||<SALT> string input = _providerDetails.MerchantId + "|" + transactionId + "|" + toChargeAmount + "|" + productInfo + "|" + userAccount.FirstName + "|" + userAccount.Email + "|" + _providerDetails.Name + "||||||||||" + _providerDetails.AdditionalInfo["SALT"]; var response = new StringBuilder(); string secureHash = Generatehash512(input); var formFields = new NameValueCollection { {"key", _providerDetails.MerchantId}, {"txnid", transactionId}, {"amount", toChargeAmount.ToString()}, {"productinfo", productInfo}, {"Firstname", userAccount.FirstName}, {"Lastname", userAccount.LastName}, {"address1", contactAddress.AddressLine1}, {"address2", contactAddress.AddressLine2}, {"City", contactAddress.City}, {"State", contactAddress.State}, {"Country", contactAddress.Country}, {"Zipcode", contactAddress.ZipCode}, {"Email", userAccount.Email}, {"phone", userAccount.Mobile}, {"udf1", _providerDetails.Name}, {"surl", returnUrl}, {"furl", returnUrl}, {"curl", returnUrl}, {"Hash", secureHash}, {"Pg", "CC"}, }; response.Append("<html><head>"); response.Append(string.Format("</head><body onload=\"document.{0}.submit()\">", formName)); response.Append(string.Format("<form name=\"{0}\" method=\"{1}\" action=\"{2}\" >", formName, method, url)); for (int i = 0; i < formFields.Keys.Count; i++) { response.Append(string.Format("<input name=\"{0}\" type=\"hidden\" value=\"{1}\">", formFields.Keys[i], formFields[formFields.Keys[i]])); } response.Append("</form>"); response.Append("</body></html>"); return response.ToString(); }
public string GetPostData(string transactionId, decimal toChargeAmount, string productInfo, Account userAccount, Address contactAddress, string voucherCode) { string url = _providerDetails.PostUrl; const string method = "post"; const string formName = "form1"; string returnUrl = ConfigSettings.PaymentReturnUrl + "?DR={DR}"; string input = _providerDetails.MerchantSecretKey + "|" + _providerDetails.MerchantId + "|" + toChargeAmount + "|" + transactionId + "|" + returnUrl + "|" + _providerDetails.Mode; var response = new StringBuilder(); var md5 = MD5.Create(); byte[] inputBytes = Encoding.ASCII.GetBytes(input); byte[] hashBytes = md5.ComputeHash(inputBytes); var sb = new StringBuilder(); for (int i = 0; i < hashBytes.Length; i++) { sb.Append(hashBytes[i].ToString("X2")); } string secureHash = sb.ToString(); var formFields = new NameValueCollection { {"account_id", _providerDetails.MerchantId}, {"reference_no", transactionId}, {"amount", toChargeAmount.ToString()}, {"description", productInfo}, {"name", userAccount.FirstName + " " + userAccount.LastName}, {"address", contactAddress.AddressLine1}, {"city", contactAddress.City}, {"state", contactAddress.State}, {"postal_code", contactAddress.ZipCode}, {"country", contactAddress.Country}, {"email", userAccount.Email}, {"phone", userAccount.Mobile}, {"ship_name", userAccount.FirstName + " " + userAccount.LastName}, {"ship_address", contactAddress.AddressLine1}, {"ship_city", contactAddress.City}, {"ship_state", contactAddress.State}, {"ship_postal_code", contactAddress.ZipCode}, {"ship_country", contactAddress.Country}, {"ship_phone", userAccount.Mobile}, {"return_url", returnUrl}, {"mode", _providerDetails.Mode}, {"secure_hash", secureHash} }; response.Append("<html><head>"); response.Append(string.Format("</head><body onload=\"document.{0}.submit()\">", formName)); response.Append(string.Format("<form name=\"{0}\" method=\"{1}\" action=\"{2}\" >", formName, method, url)); for (int i = 0; i < formFields.Keys.Count; i++) { response.Append(string.Format("<input name=\"{0}\" type=\"hidden\" value=\"{1}\">", formFields.Keys[i], formFields[formFields.Keys[i]])); } response.Append("</form>"); response.Append("</body></html>"); return response.ToString(); }
public string GetPostData(string transactionId, decimal toChargeAmount, string productInfo, Account userAccount, Address contactAddress, string voucherCode) { return string.Empty; }
internal static MySqlCommand BuildUpdateAddressCommand(MySqlConnection connection, Address address) { var cmd = new MySqlCommand("spSaveOrUpdateAddress", connection) { CommandType = CommandType.StoredProcedure }; cmd.Parameters.Add(new MySqlParameter("inAddressid", address.Id)); cmd.Parameters.Add(new MySqlParameter("inAddressLine1", address.AddressLine1)); cmd.Parameters.Add(new MySqlParameter("inAddressLine2", address.AddressLine2)); cmd.Parameters.Add(new MySqlParameter("inCityName", address.City)); cmd.Parameters.Add(new MySqlParameter("inState", address.State)); cmd.Parameters.Add(new MySqlParameter("inCountryCode", address.Country)); cmd.Parameters.Add(new MySqlParameter("inZipCode", address.ZipCode)); cmd.Parameters.Add(new MySqlParameter("outAddressid", MySqlDbType.Int32)); cmd.Parameters["outAddressid"].Direction = ParameterDirection.Output; return cmd; }
private static Address GetAddress(int addressId) { var db = new MySqlDatabase(DbConfiguration.DatabaseRead); DataSet dataSet = db.ExecuteQuery(CommandBuilder.BuildGetAddressCommand(addressId, db.Connection)); if (dataSet != null && dataSet.Tables.Count > 0) { if (dataSet.Tables[0].Rows != null && dataSet.Tables[0].Rows.Count == 1) { DataRow row = dataSet.Tables[0].Rows[0]; if (Convert.IsDBNull(row["AddressId"])) return null; var address = new Address { Id = addressId, AddressLine1 = row["AddressLine1"].GetString(), AddressLine2 = row["AddressLine2"].GetString(), City = row["CityName"].GetString(), Country = row["CountryCode"].GetString(), State = row["State"].GetString(), ZipCode = row["ZipCode"].GetString(), AddressType = row["AddressType"].GetEnum(AddressType.Billing), }; return address; } } return null; }