/// <summary> /// Generate new Bitcoin address /// </summary> /// <param name="label"> /// Friendly name of your address. /// </param> /// /// <param name="addressType"> /// Please, do not use if you don't know what are you doing. Read bitcoin.org. /// </param> /// <returns></returns> public Result GetNewAddress(string label = "", AddressTypes addressType = AddressTypes.legacy) { string addressTypeString = ""; if (addressType == AddressTypes.p2shsegwit) { addressTypeString = "p2sh-segwit"; } else { addressTypeString = addressType.ToString(); } IRestRequest req = GenerateStandardRequest(); JArray parameter = new JArray(); parameter.Add(label); parameter.Add(addressTypeString); JObject obj = BodySkeleton("getnewaddress", parameter); req.AddJsonBody(obj.ToString()); var response = client.Execute(req); ValidateResponse(response); Result result = JsonConvert.DeserializeObject <Result>(response.Content); return(result); }
protected void Page_Load(object sender, System.EventArgs e) { Response.CacheControl = "private"; Response.Expires = 0; Response.AddHeader("pragma", "no-cache"); RequireSecurePage(); Checkout = CommonLogic.QueryStringBool("checkout"); AddressTypes ats = DetermineAddressType(CommonLogic.QueryStringCanBeDangerousContent("AddressType").ToLowerInvariant()); String AddressTypeString = ats.ToString(); AddressID = CommonLogic.QueryStringUSInt("AddressID"); theAddress.LoadFromDB(AddressID); Prompt = CommonLogic.QueryStringCanBeDangerousContent("Prompt"); if (CommonLogic.QueryStringCanBeDangerousContent("RETURNURL") != "") { ViewState["RETURNURL"] = CommonLogic.QueryStringCanBeDangerousContent("RETURNURL"); } if (!ThisCustomer.OwnsThisAddress(AddressID)) { Response.Redirect("default.aspx"); } AppLogic.CheckForScriptTag(AddressTypeString); SectionTitle = "<a href=\"selectaddress.aspx?checkout=" + Checkout.ToString() + "&AddressType=" + AddressTypeString + "\">" + String.Format(AppLogic.GetString("selectaddress.aspx.1", SkinID, ThisCustomer.LocaleSetting), AddressTypeString) + "</a> → "; SectionTitle += AppLogic.GetString("editaddress.aspx.1", SkinID, ThisCustomer.LocaleSetting); AddressType = DetermineAddressType(AddressTypeString); CanDelete = (0 == DB.GetSqlN(String.Format("select count(0) as N from ShoppingCart with (NOLOCK) where (ShippingAddressID={0} or BillingAddressID={0}) and CartType={1}", AddressID, (int)CartTypeEnum.RecurringCart))); if (!IsPostBack) { InitializePageContent(); } }
private void InitializePageContent() { pnlCheckoutImage.Visible = checkOutMode; CheckoutImage.ImageUrl = AppLogic.LocateImageURL("skins/skin_" + SkinID.ToString() + "/images/step_2.gif"); pnlAddressList.Visible = (custAddresses.Count > 0 || addMode); pnlAddressListMain.Visible = (!addMode); pnlNewAddress.Visible = (addMode); lnkAddAddress.Text = AppLogic.GetString("selectaddress.aspx.3", SkinID, ThisCustomer.LocaleSetting); lnkAddAddress.NavigateUrl = "selectaddress.aspx?add=true&checkout=" + checkOutMode.ToString() + "&addressType=" + AddressType.ToString() + "&returnURL=" + Server.UrlEncode(ReturnURL); lnkAddAddress.Visible = (!addMode); liAdd.Visible = (!addMode); if (addMode) { pnlSaveAddress.Visible = true; string addressType = CommonLogic.QueryStringCanBeDangerousContent("AddressType"); if (addressType.ToLower() != "shipping") { AddressControl.showResidenceTypes = false; } else { AddressControl.showResidenceTypes = true; } } }
protected void Page_Load(object sender, System.EventArgs e) { MobileHelper.RedirectPageWhenMobileIsDisabled("~/address.aspx", ThisCustomer); Response.CacheControl = "private"; Response.Expires = 0; Response.AddHeader("pragma", "no-cache"); RequireSecurePage(); ThisCustomer.RequireCustomerRecord(); if (!ThisCustomer.IsRegistered) { Response.Redirect("mobilecreateaccount.aspx?" + BuildRedirectQuerystring()); } SectionTitle = AppLogic.GetString("createaccount.aspx.1", SkinID, ThisCustomer.LocaleSetting); Checkout = CommonLogic.QueryStringBool("checkout"); SkipRegistration = CommonLogic.QueryStringBool("skipreg"); checkouttype = CommonLogic.QueryStringCanBeDangerousContent("checkouttype"); if (CommonLogic.QueryStringCanBeDangerousContent("addresstype").ToLower() == "shipping") { AddType = AddressTypes.Shipping; } MPAddressHeader.Text = AddType.ToString() + " Info"; switch (AddType) { case AddressTypes.Shipping: btnUseForBothAddressTypes.Visible = false; btnUseForOneAddress.Text = AppLogic.GetString("Mobile.GetAddress.ShipTo", ThisCustomer.SkinID, ThisCustomer.LocaleSetting); btnUseForOneAddress.CssClass = "fullwidthshortgreen action"; break; default: btnUseForBothAddressTypes.Text = AppLogic.GetString("Mobile.GetAddress.Both", ThisCustomer.SkinID, ThisCustomer.LocaleSetting); btnUseForOneAddress.Text = AppLogic.GetString("Mobile.GetAddress.NewShip", ThisCustomer.SkinID, ThisCustomer.LocaleSetting); break; } if (Checkout) { SectionTitle = AppLogic.GetString("createaccount.aspx.2", SkinID, ThisCustomer.LocaleSetting) + SectionTitle; ShoppingCart cart = new ShoppingCart(SkinID, ThisCustomer, CartTypeEnum.ShoppingCart, 0, false); cart.ValidProceedCheckout(); } AllowShipToDifferentThanBillTo = AppLogic.AppConfigBool("AllowShipToDifferentThanBillTo") && !AppLogic.AppConfigBool("SkipShippingOnCheckout"); ReturnURL = CommonLogic.QueryStringCanBeDangerousContent("ReturnURL"); AppLogic.CheckForScriptTag(ReturnURL); ErrorMsgLabel.Text = ""; if (!IsPostBack) { AddAddress.LoadByCustomer(ThisCustomer.CustomerID, ThisCustomer.PrimaryBillingAddressID, AddressTypes.Billing); InitializePageContent(); } #region vortx init xmlpackage CheckoutHeader.Text = Vortx.MobileFramework.MobileXSLTExtensionBase.GetCheckoutHeader("address"); #endregion }
private void ProcessForm(bool UseValidationService, int AddressID) { ThisCustomer.RequireCustomerRecord(); string ResidenceType = ddlResidenceType.SelectedValue; bool valid = true; string errormsg = string.Empty; // Payment method validations if (AddressType == AddressTypes.Billing) { string paymentMethodLastUsed = AppLogic.CleanPaymentMethod(CommonLogic.FormCanBeDangerousContent("PaymentMethod")); if (paymentMethodLastUsed == AppLogic.ro_PMECheck && ShowEcheck) { if (string.IsNullOrEmpty(CommonLogic.FormCanBeDangerousContent("ECheckBankABACode"))) { valid = false; errormsg += "•Bank ABA Code is required"; } if (string.IsNullOrEmpty(CommonLogic.FormCanBeDangerousContent("ECheckBankAccountNumber"))) { valid = false; errormsg += "•Bank Account Number is required"; } if (string.IsNullOrEmpty(CommonLogic.FormCanBeDangerousContent("ECheckBankName"))) { valid = false; errormsg += "•Bank Account Name is required"; } if (string.IsNullOrEmpty(CommonLogic.FormCanBeDangerousContent("ECheckBankAccountName"))) { valid = false; errormsg += "•Bank Account Name is required"; } } if (paymentMethodLastUsed == AppLogic.ro_PMCreditCard) { if (string.IsNullOrEmpty(CommonLogic.FormCanBeDangerousContent("CardName"))) { valid = false; errormsg += "•Card Name is required"; } if (string.IsNullOrEmpty(CommonLogic.FormCanBeDangerousContent("CardType"))) { valid = false; errormsg += "•Card Type is required"; } if (string.IsNullOrEmpty(CommonLogic.FormCanBeDangerousContent("CardNumber"))) { valid = false; errormsg += "•Card Number is required"; } int iexpMonth = 0; int iexpYear = 0; string expMonth = CommonLogic.FormCanBeDangerousContent("CardExpirationMonth"); string expYear = CommonLogic.FormCanBeDangerousContent("CardExpirationYear"); if (string.IsNullOrEmpty(expMonth) || !int.TryParse(expMonth, out iexpMonth) || !(iexpMonth > 0)) { valid = false; errormsg += "•Please select the Card Expiration Month"; } if (string.IsNullOrEmpty(expYear) || !int.TryParse(expYear, out iexpYear) || !(iexpYear > 0)) { valid = false; errormsg += "•Please select the Card Expiration Year"; } } } if (!Page.IsValid || !valid) { ErrorMsgLabel.Text = "" + AppLogic.GetString("editaddress.aspx.15", SkinID, ThisCustomer.LocaleSetting) + ""; foreach (IValidator aValidator in this.Validators) { if (!aValidator.IsValid) { ErrorMsgLabel.Text += "• " + aValidator.ErrorMessage + ""; } } ErrorMsgLabel.Text += ""; ErrorMsgLabel.Text += errormsg; InitializePageContent(); return; } theAddress.AddressType = AddressType; theAddress.NickName = txtAddressNickName.Text; theAddress.FirstName = txtFirstName.Text; theAddress.LastName = txtLastName.Text; theAddress.Company = txtCompany.Text; theAddress.Address1 = txtAddress1.Text; theAddress.Address2 = txtAddress2.Text; theAddress.Suite = txtSuite.Text; theAddress.City = txtCity.Text; theAddress.State = ddlState.SelectedValue; theAddress.Zip = txtZip.Text; theAddress.Country = ddlCountry.SelectedValue; theAddress.Phone = txtPhone.Text; if (ResidenceType == "2") { theAddress.ResidenceType = ResidenceTypes.Commercial; } else if (ResidenceType == "1") { theAddress.ResidenceType = ResidenceTypes.Residential; } else { theAddress.ResidenceType = ResidenceTypes.Unknown; } if (theAddress.AddressType == AddressTypes.Billing) { theAddress.PaymentMethodLastUsed = AppLogic.CleanPaymentMethod(CommonLogic.FormCanBeDangerousContent("PaymentMethod")); if (theAddress.PaymentMethodLastUsed == AppLogic.ro_PMECheck && ShowEcheck) { string eCheckABACode = CommonLogic.FormCanBeDangerousContent("ECheckBankABACode"); if (!eCheckABACode.StartsWith("*")) { theAddress.ECheckBankABACode = CommonLogic.FormCanBeDangerousContent("ECheckBankABACode"); } string eCheckBankAccountNumber = CommonLogic.FormCanBeDangerousContent("ECheckBankAccountNumber"); if (!eCheckBankAccountNumber.StartsWith("*")) { theAddress.ECheckBankAccountNumber = CommonLogic.FormCanBeDangerousContent("ECheckBankAccountNumber"); } theAddress.ECheckBankName = CommonLogic.FormCanBeDangerousContent("ECheckBankName"); theAddress.ECheckBankAccountName = CommonLogic.FormCanBeDangerousContent("ECheckBankAccountName"); theAddress.ECheckBankAccountType = CommonLogic.FormCanBeDangerousContent("ECheckBankAccountType"); } if (theAddress.PaymentMethodLastUsed == AppLogic.ro_PMCreditCard) { theAddress.CardName = CommonLogic.FormCanBeDangerousContent("CardName"); theAddress.CardType = CommonLogic.FormCanBeDangerousContent("CardType"); string tmpS = CommonLogic.FormCanBeDangerousContent("CardNumber"); if (!tmpS.StartsWith("*")) { theAddress.CardNumber = tmpS; } theAddress.CardExpirationMonth = CommonLogic.FormCanBeDangerousContent("CardExpirationMonth"); theAddress.CardExpirationYear = CommonLogic.FormCanBeDangerousContent("CardExpirationYear"); } } theAddress.UpdateDB(); string RETURNURL = ""; if (ViewState["RETURNURL"] != null) { RETURNURL = "&ReturnUrl=" + ViewState["RETURNURL"].ToString(); } if (UseValidationService) { Address StandardizedAddress = new Address(); String validateResult = AddressValidation.RunValidate(theAddress, out StandardizedAddress); theAddress = StandardizedAddress; theAddress.UpdateDB(); if (validateResult != AppLogic.ro_OK) { validateResult = "address.validation.errormsg".StringResource() + validateResult; Session["ErrorMsgLabelText"] = System.Web.HttpUtility.HtmlEncode(validateResult); Response.Redirect("editaddress.aspx?Checkout=" + Checkout.ToString() + "&AddressType=" + AddressType.ToString() + "&AddressID=" + AddressID.ToString() + RETURNURL); } } Response.Redirect(String.Format("selectaddress.aspx?Checkout={0}&AddressType={1}" + RETURNURL, Checkout.ToString(), AddressType)); }
protected void Page_Load(object sender, System.EventArgs e) { Response.CacheControl = "private"; Response.Expires = 0; Response.AddHeader("pragma", "no-cache"); Customer ThisCustomer = ((InterpriseSuiteEcommercePrincipal)Context.User).ThisCustomer; ThisCustomer.RequireCustomerRecord(); bool Checkout = CommonLogic.QueryStringBool("checkout"); String AddressID = CommonLogic.QueryStringCanBeDangerousContent("AddressID"); String AddressTypeString = CommonLogic.QueryStringCanBeDangerousContent("AddressType"); if (AddressTypeString.IndexOf("<script>", StringComparison.InvariantCultureIgnoreCase) != -1) { throw new ArgumentException("SECURITY EXCEPTION"); } AddressTypes AddressType = (AddressTypes)Enum.Parse(typeof(AddressTypes), AddressTypeString, true); int OriginalRecurringOrderNumber = CommonLogic.QueryStringUSInt("OriginalRecurringOrderNumber"); String ReturnURL = Server.UrlDecode(CommonLogic.QueryStringCanBeDangerousContent("ReturnURL")); if (ReturnURL.IndexOf("<script>", StringComparison.InvariantCultureIgnoreCase) != -1) { throw new ArgumentException("SECURITY EXCEPTION"); } bool AllowShipToDifferentThanBillTo = AppLogic.AppConfigBool("AllowShipToDifferentThanBillTo"); if (AddressID != String.Empty && !ThisCustomer.OwnsThisAddress(AddressID)) { throw new ArgumentException("That action is not allowed!"); } if (!AllowShipToDifferentThanBillTo) { //Shipping and Billing address nust be the same so save both AddressType = AddressTypes.Billing | AddressTypes.Shipping; } Address thisAddress = new Address(); if (AddressID != String.Empty) //Users Selected an ID from the Address Grid { if (OriginalRecurringOrderNumber == 0) { if (AddressType == AddressTypes.Shipping) { String sql = String.Format("update shoppingcart set ShippingAddressID={0} where ShippingAddressID={1} and CartType={2} and CustomerID={3}", AddressID.ToString(), ThisCustomer.PrimaryShippingAddressID.ToString(), ((int)CartTypeEnum.ShoppingCart).ToString(), ThisCustomer.CustomerCode.ToString()); DB.ExecuteSQL(sql); } thisAddress.LoadByCustomer(ThisCustomer, AddressType, AddressID); } } else //Entered a new address to add { thisAddress.CustomerCode = ThisCustomer.CustomerCode; thisAddress.NickName = CommonLogic.FormCanBeDangerousContent("AddressNickName"); thisAddress.FirstName = CommonLogic.FormCanBeDangerousContent("AddressFirstName"); thisAddress.LastName = CommonLogic.FormCanBeDangerousContent("AddressLastName"); thisAddress.Company = CommonLogic.FormCanBeDangerousContent("AddressCompany"); thisAddress.Address1 = CommonLogic.FormCanBeDangerousContent("AddressAddress1"); thisAddress.Suite = CommonLogic.FormCanBeDangerousContent("AddressSuite"); thisAddress.City = CommonLogic.FormCanBeDangerousContent("AddressCity"); thisAddress.State = CommonLogic.FormCanBeDangerousContent("AddressState"); thisAddress.PostalCode = CommonLogic.FormCanBeDangerousContent("AddressZip"); thisAddress.Country = CommonLogic.FormCanBeDangerousContent("AddressCountry"); thisAddress.Phone = CommonLogic.FormCanBeDangerousContent("AddressPhone"); AddressID = thisAddress.AddressID; ReturnURL = "selectaddress.aspx?Checkout=" + Checkout.ToString() + "&addressType=" + AddressType.ToString() + "&returnURL=" + Server.UrlEncode("account.aspx?" + Checkout.ToString()); } if (OriginalRecurringOrderNumber != 0) { //put it in the ShoppingCart record string sql = String.Empty; if ((AddressType & AddressTypes.Billing) != 0) { sql = String.Format("BillingAddressID={0}", AddressID); } if ((AddressType & AddressTypes.Shipping) != 0) { if (sql.Length != 0) { sql += ","; } sql += String.Format("ShippingAddressID={0}", AddressID); } sql = String.Format("update ShoppingCart set " + sql + " where OriginalRecurringOrderNumber={0}", OriginalRecurringOrderNumber.ToString()); DB.ExecuteSQL(sql); } if (OriginalRecurringOrderNumber == 0) { thisAddress.LoadByCustomer(ThisCustomer, AddressTypes.Billing, ThisCustomer.PrimaryBillingAddressID); if (thisAddress.AddressID == String.Empty) { Response.Redirect(String.Format("selectaddress.aspx?Checkout={0}&AddressType=Billing&ReturnURL={1}", Checkout.ToString(), Server.UrlEncode(ReturnURL))); } thisAddress.LoadByCustomer(ThisCustomer, AddressTypes.Shipping, ThisCustomer.PrimaryShippingAddressID); if (thisAddress.AddressID == String.Empty) { Response.Redirect(String.Format("selectaddress.aspx?Checkout={0}&AddressType=Shipping&ReturnURL={1}", Checkout.ToString(), Server.UrlEncode(ReturnURL))); } if (ReturnURL.Length != 0) { Response.Redirect(ReturnURL); } else { Response.Redirect("account.aspx?checkout=" + Checkout.ToString()); } } else { Response.Redirect("account.aspx?checkout=" + Checkout.ToString()); } }
private void InitializePageContent() { pnlAddressList.Visible = (custAddresses.Count > 0 || CommonLogic.QueryStringCanBeDangerousContent("add").Length != 0); tblAddressList.Attributes.Add("style", "border-style: solid; border-width: 0px; border-color: #" + AppLogic.AppConfig("HeaderBGColor")); tblAddressListBox.Attributes.Add("style", AppLogic.AppConfig("BoxFrameStyle")); lnkAddAddress.Text = AppLogic.GetString("selectaddress.aspx.6", SkinID, ThisCustomer.LocaleSetting); lnkAddAddress.NavigateUrl = "selectaddress.aspx?add=true&checkout=" + Checkout.ToString() + "&addressType=" + AddressType.ToString() + "&returnURL=" + Server.UrlEncode(ReturnURL); lnkAddAddress.Visible = (CommonLogic.QueryStringCanBeDangerousContent("add").Length == 0); if (CommonLogic.QueryStringCanBeDangerousContent("add").Length != 0) { pnlNewAddress.Visible = true; Address newAddress = new Address(); newAddress.AddressType = AddressType; litNewAddressForm.Text = newAddress.InputHTML(); litNewAddressForm.Visible = true; btnNewAddress.Text = AppLogic.GetString("selectaddress.aspx.5", SkinID, ThisCustomer.LocaleSetting); AppLogic.GetButtonDisable(btnNewAddress); } addressbook_gif.ImageUrl = AppLogic.LocateImageURL("App_Themes/skin_" + SkinID.ToString() + "/images/addressbook.gif", ThisCustomer.LocaleSetting); string sql = String.Empty; if (AddressType == AddressTypes.Shipping) { sql = "select a.*, isnull(City + ', ', '') + isnull(State,'') + isnull(' ' + ZIP, '') CityStateZip, case when c.customerid is null then 0 else 1 end PrimaryAddress from Address a left join Customer c on a.AddressID = c.ShippingAddressID where a.customerid = " + ThisCustomer.CustomerID.ToString(); } else { sql = "select a.*, isnull(City + ', ', '') + isnull(State,'') + isnull(' ' + ZIP, '') CityStateZip, case when c.customerid is null then 0 else 1 end PrimaryAddress from Address a left join Customer c on a.AddressID = c.BillingAddressID where a.customerid = " + ThisCustomer.CustomerID.ToString(); } using (SqlConnection dbconn = new SqlConnection(DB.GetDBConn())) { dbconn.Open(); using (IDataReader dr = DB.GetRS(sql, dbconn)) { AddressList.DataSource = dr; AddressList.DataBind(); } } btnReturn.Text = AppLogic.GetString("account.aspx.61", SkinID, ThisCustomer.LocaleSetting); btnReturn.OnClientClick = "self.location='account.aspx?checkout=" + Checkout.ToString() + "';return false"; btnCheckOut.Visible = Checkout; btnCheckOut.Text = AppLogic.GetString("account.aspx.60", SkinID, ThisCustomer.LocaleSetting); btnCheckOut.OnClientClick = "self.location='checkoutshipping.aspx';return false;"; }
private void InitializePageContent() { pnlCheckoutImage.Visible = checkOutMode; CheckoutImage.ImageUrl = AppLogic.LocateImageURL("skins/skin_" + SkinID.ToString() + "/images/step_2.gif"); pnlAddressList.Visible = (custAddresses.Count > 0 || addMode); pnlAddressListMain.Visible = (!addMode); pnlNewAddress.Visible = (addMode); lnkAddAddress.Text = AppLogic.GetString("selectaddress.aspx.3", SkinID, ThisCustomer.LocaleSetting); lnkAddAddress.NavigateUrl = "selectaddress.aspx?add=true&checkout=" + checkOutMode.ToString() + "&addressType=" + AddressType.ToString() + "&returnURL=" + Server.UrlEncode(ReturnURL); lnkAddAddress.Visible = (!addMode); //removed mobile changes //liAdd.Visible = (!addMode); if (addMode) { ctrlAddress.Visible = true; btnNewAddress.Text = AppLogic.GetString("selectaddress.aspx.2", SkinID, ThisCustomer.LocaleSetting); } }