protected void Page_Load(object sender, EventArgs e) { _TaxGatewayId = TaxGatewayDataSource.GetTaxGatewayIdByClassId(Misc.GetClassId(typeof(TaxCloudProvider))); if (_TaxGatewayId > 0) { _TaxGateway = TaxGatewayDataSource.Load(_TaxGatewayId); } if (_TaxGateway != null) { _TaxProvider = _TaxGateway.GetProviderInstance() as TaxCloudProvider; } if (_TaxProvider == null) { _TaxProvider = new TaxCloudProvider(); } if (_TaxGateway == null) { _TaxGateway = new TaxGateway(); _TaxGateway.ClassId = Misc.GetClassId(typeof(TaxCloudProvider)); _TaxGateway.Name = _TaxProvider.Name; _TaxGateway.Store = AbleContext.Current.Store; } if (!Page.IsPostBack) { EnableTaxCloud.Checked = _TaxProvider.EnableTaxCloud; ApiId.Text = _TaxProvider.ApiId; ApiKey.Text = _TaxProvider.ApiKey; DefaultTIC.Text = _TaxProvider.DefaultTIC; ShippingTIC.Text = _TaxProvider.ShippingTIC; HandlingTIC.Text = _TaxProvider.HandlingTIC; GiftwrapTIC.Text = _TaxProvider.GiftwrapTIC; USPSUserId.Text = _TaxProvider.USPSUserId; TaxServiceUrl.Text = _TaxProvider.TaxServiceUrl; DebugMode.Checked = _TaxProvider.UseDebugMode; EnableAddressValidation.Checked = _TaxProvider.EnableAddressValidation; TaxName.Text = _TaxProvider.TaxName; UseTaxExemption.Checked = _TaxProvider.UseTaxExemption; TaxReportMode_Summary.Checked = !_TaxProvider.RecordTaxBreakdown; TaxReportMode_Breakdown.Checked = !TaxReportMode_Summary.Checked; SummaryTaxName.Text = _TaxProvider.SummaryTaxName; } }
protected void Page_Load(object sender, EventArgs e) { _TaxGatewayId = TaxGatewayDataSource.GetTaxGatewayIdByClassId(Misc.GetClassId(typeof(AvaTaxProvider))); if (_TaxGatewayId > 0) { _TaxGateway = TaxGatewayDataSource.Load(_TaxGatewayId); } if (_TaxGateway != null) { _TaxProvider = _TaxGateway.GetProviderInstance() as AvaTaxProvider; } if (_TaxProvider == null) { _TaxProvider = new AvaTaxProvider(); } if (_TaxGateway == null) { _TaxGateway = new TaxGateway(); _TaxGateway.ClassId = Misc.GetClassId(typeof(AvaTaxProvider)); _TaxGateway.Name = _TaxProvider.Name; _TaxGateway.Store = AbleContext.Current.Store; } if (!Page.IsPostBack) { AccountNumber.Text = _TaxProvider.AccountNumber; CompanyCode.Text = _TaxProvider.CompanyCode; TaxServiceUrl.Text = _TaxProvider.TaxServiceUrl; EnableTaxCalculation.Checked = _TaxProvider.EnableTaxCalculation; TaxableProvinces.Text = _TaxProvider.TaxableProvinces; AddressServiceUrl.Text = _TaxProvider.AddressServiceUrl; EnableAddressValidation.Checked = _TaxProvider.EnableAddressValidation; AddressValidationCountries.Text = _TaxProvider.AddressValidationCountries; TaxReportMode_Breakdown.Checked = _TaxProvider.RecordTaxBreakdown; TaxReportMode_Summary.Checked = !_TaxProvider.RecordTaxBreakdown; SummaryTaxName.Text = _TaxProvider.SummaryTaxName; DebugMode.Checked = _TaxProvider.UseDebugMode; } }
/// <summary> /// Locates a configured address validator service /// </summary> /// <returns>A configured address validator service, if available. Null is returned if no /// address validators are configured.</returns> public static IAddressValidatorService Locate() { // RIGHT NOW ONLY AVATAX HAS ADDRESS SERVICES, SO SEE IF IT IS CONFIGURED TaxGateway avaTaxGateway = LocateAvaTaxGateway(); if (avaTaxGateway != null) { // MAKE SURE THE EXISTING SERVICE SUPPORTS THE ADDRESS VALIDATION INTERFACE object avaTaxProviderInstance = avaTaxGateway.GetProviderInstance(); IAddressValidatorService addressValidatorService = avaTaxProviderInstance as IAddressValidatorService; return(addressValidatorService); } return(null); }
protected void Page_Load(object sender, EventArgs e) { _TaxGatewayId = TaxGatewayDataSource.GetTaxGatewayIdByClassId(Misc.GetClassId(typeof(WATaxProvider))); if (_TaxGatewayId > 0) { _TaxGateway = TaxGatewayDataSource.Load(_TaxGatewayId); } if (_TaxGateway != null) { _TaxProvider = _TaxGateway.GetProviderInstance() as WATaxProvider; } if (_TaxProvider == null) { _TaxProvider = new WATaxProvider(); } if (_TaxGateway == null) { _TaxGateway = new TaxGateway(); _TaxGateway.ClassId = Misc.GetClassId(typeof(WATaxProvider)); _TaxGateway.Name = _TaxProvider.Name; _TaxGateway.Store = AbleContext.Current.Store; } if (!Page.IsPostBack) { TaxName.Text = _TaxProvider.TaxName; DebugMode.Checked = _TaxProvider.UseDebugMode; // INITIALIZE TAX CODES LIST IList <TaxCode> taxCodes = TaxCodeDataSource.LoadAll(); TaxCodes.DataSource = taxCodes; TaxCodes.DataBind(); // SELECT THE CONFIGURED TAX CODES foreach (ListItem taxCodeItem in this.TaxCodes.Items) { taxCodeItem.Selected = (_TaxProvider.TaxCodes.Contains(AlwaysConvert.ToInt(taxCodeItem.Value))); } } }
protected void Page_Init(object sender, EventArgs e) { _OrderId = AbleCommerce.Code.PageHelper.GetOrderId(); _Order = OrderDataSource.Load(_OrderId); if (_Order == null) { Response.Redirect("Default.aspx"); } string suffix = "?OrderNumber=" + _Order.OrderNumber; AddProductLink.NavigateUrl += suffix; AddOtherItemLink.NavigateUrl += suffix; RecalculateTaxesButton.Visible = TaxHelper.IsATaxProviderEnabled(); BindGrids(); TaxExemptionMessagePanel.Visible = !string.IsNullOrEmpty(this._Order.TaxExemptionReference); if (TaxExemptionMessagePanel.Visible) { TaxExemptionMessage.Text = string.Format(TaxExemptionMessage.Text, this._Order.TaxExemptionReference); } // WE DON'T SUPPORT TAX CLOUD TAX RECALCULATION TaxGateway taxGateway = null; TaxCloudProvider taxProvider = null; int taxGatewayId = TaxGatewayDataSource.GetTaxGatewayIdByClassId(Misc.GetClassId(typeof(TaxCloudProvider))); if (taxGatewayId > 0) { taxGateway = TaxGatewayDataSource.Load(taxGatewayId); } if (taxGateway != null) { taxProvider = taxGateway.GetProviderInstance() as TaxCloudProvider; } if (taxProvider != null && taxProvider.EnableTaxCloud) { TaxCloudWarningMessagePanel.Visible = true; TaxCloudReclaculationMessage.Text = string.Format(TaxCloudReclaculationMessage.Text, _Order.OrderNumber); } }
protected void Page_Load(object sender, EventArgs e) { string certID = Request["certificateID"]; TaxGateway taxGateway = null; TaxCloudProvider taxProvider = null; int taxGatewayId = TaxGatewayDataSource.GetTaxGatewayIdByClassId(Misc.GetClassId(typeof(TaxCloudProvider))); if (taxGatewayId > 0) { taxGateway = TaxGatewayDataSource.Load(taxGatewayId); } if (taxGateway != null) { taxProvider = taxGateway.GetProviderInstance() as TaxCloudProvider; } if (taxProvider != null) { taxProvider.RemoveExemptionCert(certID); } }
private void InitializeBasketContents() { decimal productsTotal = 0; decimal subtotal = 0; decimal shipping = 0; decimal handling = 0; Dictionary <string, decimal> taxes = new Dictionary <string, decimal>(); decimal totalTaxAmount = 0; decimal total = 0; int numberOfProducts = 0; decimal giftCodes = 0; Basket basket = AbleContext.Current.User.Basket; if (!_Recalculated) { IBasketService preCheckoutService = AbleContext.Resolve <IBasketService>(); preCheckoutService.Recalculate(basket); preCheckoutService.Combine(basket); _Recalculated = true; } foreach (BasketItem item in basket.Items) { decimal extendedPrice = AbleCommerce.Code.InvoiceHelper.GetInvoiceExtendedPrice(item); switch (item.OrderItemType) { case OrderItemType.Product: bool countItem = !item.IsChildItem; if (!countItem) { BasketItem parentItem = item.GetParentItem(false); if (parentItem != null) { countItem = parentItem.Product.IsKit && parentItem.Product.Kit.ItemizeDisplay; } } if (countItem) { productsTotal += extendedPrice; subtotal += extendedPrice; numberOfProducts += item.Quantity; } else { // zero out the ext price - it is included with the parent extendedPrice = 0; } break; case OrderItemType.Shipping: shipping += extendedPrice; break; case OrderItemType.Handling: BasketShipment shipment = item.Shipment; if (shipment != null && shipment.ShipMethod != null && shipment.ShipMethod.SurchargeIsVisible) { handling += extendedPrice; } else { shipping += extendedPrice; } break; case OrderItemType.Tax: TaxInvoiceDisplay taxDisplay = TaxHelper.GetEffectiveInvoiceDisplay(AbleContext.Current.User); if (taxDisplay == TaxInvoiceDisplay.Summary) { if (taxes.ContainsKey(item.Name)) { taxes[item.Name] += extendedPrice; } else { taxes[item.Name] = extendedPrice; } } else if (taxDisplay != TaxInvoiceDisplay.Included) { subtotal += extendedPrice; } totalTaxAmount += extendedPrice; break; case OrderItemType.GiftCertificatePayment: giftCodes += extendedPrice; break; default: subtotal += extendedPrice; break; } total += extendedPrice; } Subtotal.Text = subtotal.LSCurrencyFormat("ulc"); TaxInvoiceDisplay taxInvoiceDisplay = TaxHelper.GetEffectiveInvoiceDisplay(AbleContext.Current.User); if (AbleContext.Current.User.PrimaryAddress.IsValid && taxInvoiceDisplay == TaxInvoiceDisplay.Summary) { TaxesBreakdownRepeater.DataSource = taxes; TaxesBreakdownRepeater.DataBind(); if (ShowTaxBreakdown) { TaxesBreakdownRepeater.Visible = true; trTax.Visible = false; } else { TaxesLabel.Text = totalTaxAmount.LSCurrencyFormat("ulc"); TaxesBreakdownRepeater.Visible = false; trTax.Visible = true; } } else { // TAXES ARE NOT DISPLAYED, REMOVE ANY TAX FROM THE TOTAL if (taxInvoiceDisplay == TaxInvoiceDisplay.Included) { total -= totalTaxAmount; } TaxesBreakdownRepeater.Visible = false; trTax.Visible = false; } // SHIPPING SHOULD NOT BE VISIBLE WHEN USER BILLING ADDRESS IS NOT SELECTED Shipping.Text = shipping.LSCurrencyFormat("ulc"); if (!basket.User.PrimaryAddress.IsValid) { trShipping.Visible = false; } else if (shipping > 0) { trShipping.Visible = true; } else { trShipping.Visible = ShowShipping; } if (handling > 0) { trHandling.Visible = trShipping.Visible; Handling.Text = handling.LSCurrencyFormat("ulc"); } else { trHandling.Visible = false; } if (giftCodes != 0) { trGifCodes.Visible = true; GifCodes.Text = giftCodes.LSCurrencyFormat("ulc"); } else { trGifCodes.Visible = false; } trCouponsDivider.Visible = trGifCodes.Visible; Total.Text = total.LSCurrencyFormat("ulc"); TotalPendingMessagePanel.Visible = this.ShowMessage; // ENABLE THE TAXCLOUD Exemption link only if taxcloud is configured and there are tax line items TaxGateway taxGateway = null; TaxCloudProvider taxProvider = null; int taxGatewayId = TaxGatewayDataSource.GetTaxGatewayIdByClassId(Misc.GetClassId(typeof(TaxCloudProvider))); if (taxGatewayId > 0) { taxGateway = TaxGatewayDataSource.Load(taxGatewayId); } if (taxGateway != null) { taxProvider = taxGateway.GetProviderInstance() as TaxCloudProvider; } if (taxProvider == null || !taxProvider.EnableTaxCloud || taxes.Count == 0) { TaxCloudTaxExemptionCert1.Visible = false; } }
protected void Page_Load(object sender, EventArgs e) { string exemptState = Request["ExemptState"]; string singlePurchaseOrderNumber = Request["SinglePurchaseOrderNumber"]; string blanketPurchase = Request["BlanketPurchase"]; string purchaserFirstName = Request["PurchaserFirstName"]; string purchaserLastName = Request["PurchaserLastName"]; string purchaserAddress1 = Request["PurchaserAddress1"]; string purchaserCity = Request["PurchaserCity"]; string purchaserState = Request["PurchaserState"]; // string purchaserZip = Request["PurchaserZip"]; string taxType = Request["TaxType"]; // string idNumber = Request["IDNumber"]; string stateOfIssue = Request["StateOfIssue"]; // string countryOfIssue = Request["CountryOfIssue"]; // string purchaserBusinessType = Request["PurchaserBusinessType"]; // // string purchaserBusinessTypeOtherValue = Request["PurchaserBusinessTypeOtherValue"]; //optional string purchaserExemptionReason = Request["PurchaserExemptionReason"]; // string purchaserExemptionReasonValue = Request["PurchaserExemptionReasonValue"]; if (purchaserFirstName.Contains(" ")) { string[] nameparts = purchaserFirstName.Split(' '); purchaserFirstName = nameparts[0]; purchaserLastName = nameparts[1]; } if (!isset(exemptState) || !isset(blanketPurchase) || !isset(purchaserFirstName) || !isset(purchaserAddress1) || !isset(purchaserCity) || !isset(purchaserState) || !isset(purchaserZip) || !isset(taxType) || !isset(idNumber) || !isset(stateOfIssue) || !isset(countryOfIssue) || !isset(purchaserBusinessType) || !isset(purchaserExemptionReason) || !isset(purchaserExemptionReasonValue)) { return; } else { TaxGateway taxGateway = null; TaxCloudProvider taxProvider = null; int taxGatewayId = TaxGatewayDataSource.GetTaxGatewayIdByClassId(Misc.GetClassId(typeof(TaxCloudProvider))); if (taxGatewayId > 0) { taxGateway = TaxGatewayDataSource.Load(taxGatewayId); } if (taxGateway != null) { taxProvider = taxGateway.GetProviderInstance() as TaxCloudProvider; } if (taxProvider == null) { return; } taxProvider.SetExemptionCert(AbleContext.Current.User, exemptState, AlwaysConvert.ToBool(blanketPurchase, false), singlePurchaseOrderNumber, purchaserFirstName, purchaserLastName, purchaserAddress1, purchaserCity, purchaserState, purchaserZip, taxType, idNumber, stateOfIssue, countryOfIssue, purchaserBusinessType, purchaserExemptionReason, purchaserExemptionReasonValue); // recalculate the current user basket Basket basket = AbleContext.Current.User.Basket; basket.ContentHash = string.Empty; IBasketService preCheckoutService = AbleContext.Resolve <IBasketService>(); preCheckoutService.Recalculate(basket); } }
protected void Page_Load(object sender, EventArgs e) { int taxGatewayId = TaxGatewayDataSource.GetTaxGatewayIdByClassId(Misc.GetClassId(typeof(AbleCommerceTax))); if (taxGatewayId > 0) { _TaxGateway = TaxGatewayDataSource.Load(taxGatewayId); } if (_TaxGateway != null) { _TaxProvider = _TaxGateway.GetProviderInstance() as AbleCommerceTax; } if (_TaxGateway == null) { _TaxGateway = new TaxGateway(); } if (_TaxProvider == null) { _TaxProvider = new AbleCommerceTax(); } SavedMessage.Visible = false; if (!Page.IsPostBack) { EnabledCheckBox.Checked = _TaxProvider.Activated ? true : false; switch (_TaxProvider.ShoppingDisplay) { case TaxShoppingDisplay.Hide: ShoppingDisplay.SelectedValue = "Hide"; break; case TaxShoppingDisplay.Included: case TaxShoppingDisplay.IncludedRegistered: ShoppingDisplay.SelectedValue = "Included"; break; case TaxShoppingDisplay.LineItem: case TaxShoppingDisplay.LineItemRegistered: ShoppingDisplay.SelectedValue = "LineItem"; break; } IncludeAnon.Checked = (_TaxProvider.ShoppingDisplay == TaxShoppingDisplay.Included) || (_TaxProvider.ShoppingDisplay == TaxShoppingDisplay.LineItem); switch (_TaxProvider.InvoiceDisplay) { case TaxInvoiceDisplay.Summary: InvoiceDisplay.SelectedValue = "Summary"; break; case TaxInvoiceDisplay.Included: InvoiceDisplay.SelectedValue = "Included"; break; case TaxInvoiceDisplay.LineItem: InvoiceDisplay.SelectedValue = "LineItem"; break; } ShowTaxColumn.Checked = _TaxProvider.ShowTaxColumn; TaxColumnHeader.Text = _TaxProvider.TaxColumnHeader; } ToggleConfig(); }