/// <summary> /// Gets the final price /// </summary> /// <param name="productVariant">Product variant</param> /// <param name="customer">The customer</param> /// <param name="AdditionalCharge">Additional charge</param> /// <param name="includeDiscounts">A value indicating whether include discounts or not for final price computation</param> /// <returns>Final price</returns> public static decimal GetFinalPrice(ProductVariant productVariant, Customer customer, decimal AdditionalCharge, bool includeDiscounts) { decimal result = decimal.Zero; if (includeDiscounts) { decimal discountAmount = GetDiscountAmount(productVariant, customer, AdditionalCharge); result = productVariant.Price + AdditionalCharge - discountAmount; } else { result = productVariant.Price + AdditionalCharge; } if (result < decimal.Zero) { result = decimal.Zero; } if (HttpContext.Current.Request.Cookies["Currency"] != null && HttpContext.Current.Request.Cookies["Currency"].Value == "USD") { result = Math.Round(PriceConverter.ToUsd(result)); } return(result); }
private decimal CalculateTotalServiceFee(IEnumerable <OrderProductVariant> orderProducts, IEnumerable <ProductVariant> prodVars, Order order, bool convvertToUsd, out decimal shippingPrice) { decimal retVal = convvertToUsd ? prodVars.Sum(prodVar => (Math.Round(PriceConverter.ToUsd(AddServiceFee(prodVar.Price, convvertToUsd))) * orderProducts.First(op => op.ProductVariantID == prodVar.ProductVariantID).Quantity)) : prodVars.Sum(prodVar => (AddServiceFee(prodVar.Price, convvertToUsd) * orderProducts.First(op => op.ProductVariantID == prodVar.ProductVariantID).Quantity)); shippingPrice = retVal > freeShippingBorder ? 0 : shippingRate; if (convvertToUsd) { shippingPrice = Math.Round(PriceConverter.ToUsd(shippingPrice)); } retVal += AddServiceFee(shippingPrice, convvertToUsd); return(retVal); }
public String GetIndividualOrderPriceString(orders.IndividualOrder indOrder) { String price = String.Empty; if (indOrder != null) { if (Request.Cookies["Currency"] != null && Request.Cookies["Currency"].Value == "USD") { price = Math.Round(PriceConverter.ToUsd(indOrder.Price)).ToString() + "$"; } else { price = indOrder.Price.ToString(); } } return(price); }
protected override decimal CalculateTotalOrderServiceFee(OrderProductVariantCollection orderProducts, List <ProductVariant> prodVars, Order order, out object shippingPrice) { decimal retVal = ConvertToUsd ? prodVars.Sum(prodVar => (Math.Round(PriceConverter.ToUsd(AddServiceFee(prodVar.Price, ConvertToUsd))) * orderProducts.First(op => op.ProductVariantID == prodVar.ProductVariantID).Quantity)) : prodVars.Sum(prodVar => (AddServiceFee(prodVar.Price, ConvertToUsd) * orderProducts.First(op => op.ProductVariantID == prodVar.ProductVariantID).Quantity)); if (ShoppingCartRequiresShipping) { decimal shippingBlr = AddServiceFee(((FreeShippingEnabled && retVal > FreeShippingBorder) ? 0 : ShippingRate), ConvertToUsd); shippingPrice = ConvertToUsd ? Math.Round(PriceConverter.ToUsd(shippingBlr)) : shippingBlr; } else { shippingPrice = (decimal)0; } return(retVal); }
protected string GetShoppingCartSum() { ShoppingCart cart = ShoppingCartManager.GetCurrentShoppingCart(ShoppingCartTypeEnum.ShoppingCart); bool isUsd = Request.Cookies["Currency"] != null && Request.Cookies["Currency"].Value == "USD"; decimal indOrderTotal = 0; IndividualOrderCollection indOrders = new IndividualOrderCollection(); if (NopContext.Current.Session != null) { Guid customerSessionGuid = NopContext.Current.Session.CustomerSessionGUID; indOrders = IndividualOrderManager.GetIndividualOrderByCurrentUserSessionGuid(customerSessionGuid); indOrderTotal = IndividualOrderManager.GetTotalPriceIndOrders(indOrders); if (isUsd) { indOrderTotal = Math.Round(PriceConverter.ToUsd(indOrderTotal)); } } if (cart.Count > 0 || indOrders.Count > 0) { //subtotal string subTotalError = string.Empty; decimal shoppingCartSubTotalDiscountBase; decimal shoppingCartSubTotalBase = ShoppingCartManager.GetShoppingCartSubTotal(cart, NopContext.Current.User, out shoppingCartSubTotalDiscountBase, ref subTotalError); if (String.IsNullOrEmpty(subTotalError)) { decimal shoppingCartSubTotal = CurrencyManager.ConvertCurrency(shoppingCartSubTotalBase, CurrencyManager.PrimaryStoreCurrency, NopContext.Current.WorkingCurrency); shoppingCartSubTotal += indOrderTotal; return(AddCurrency(PriceHelper.FormatPrice(shoppingCartSubTotal), isUsd)); } } return(AddCurrency("0", isUsd)); }
protected void btnNextStep_Click(object sender, EventArgs e) { if (Page.IsValid) { try { PaymentInfo paymentInfo = this.PaymentInfo; //if (paymentInfo == null) // Response.Redirect("~/CheckoutPaymentInfo.aspx"); paymentInfo.BillingAddress = NopContext.Current.User.BillingAddress; paymentInfo.ShippingAddress = NopContext.Current.User.ShippingAddress; paymentInfo.CustomerLanguage = NopContext.Current.WorkingLanguage; paymentInfo.CustomerCurrency = NopContext.Current.WorkingCurrency; int orderId = 0; string result = ""; if (Request["OrderId"] == null) { result = OrderManager.PlaceOrder(paymentInfo, NopContext.Current.User, out orderId); } else { orderId = int.Parse(Request["OrderId"]); } this.PaymentInfo = null; Order order = OrderManager.GetOrderByID(orderId); if (!String.IsNullOrEmpty(result)) { lError.Text = Server.HtmlEncode(result); return; } if (Request["OrderId"] != null) { order.PaymentMethodID = paymentInfo.PaymentMethodID; order.PaymentMethodName = PaymentMethodManager.GetPaymentMethodByID(paymentInfo.PaymentMethodID).Name; } Guid customerSessionGUID = NopContext.Current.Session.CustomerSessionGUID; IndividualOrderCollection indOrders = IndividualOrderManager.GetIndividualOrderByCurrentUserSessionGuid(customerSessionGUID); string subj = "Заказ в магазине Voobrazi.by"; StringBuilder body = new StringBuilder(); body.AppendFormat("Доставка: {0}<br /><br />", ((bool)Session["Delivery"]) ? "Курьером" : "Самовывоз").AppendLine(); body.AppendFormat("<b>Заказчик</b><br />").AppendLine(); body.AppendFormat("ФИО: {0} {1}<br />", paymentInfo.BillingAddress.FirstName, paymentInfo.BillingAddress.LastName).AppendLine(); body.AppendFormat("Телефоны: {0} {1}<br />", paymentInfo.BillingAddress.PhoneNumber, !string.IsNullOrEmpty(paymentInfo.BillingAddress.FaxNumber) ? ", " + paymentInfo.BillingAddress.FaxNumber : "").AppendLine(); body.AppendFormat("Адрес: {0} {1}<br />", paymentInfo.BillingAddress.City, paymentInfo.BillingAddress.Address1).AppendLine(); body.AppendFormat("Email: {0}<br /><br />", !string.IsNullOrEmpty(NopContext.Current.User.BillingAddress.Email) ? NopContext.Current.User.BillingAddress.Email : NopContext.Current.User.Email).AppendLine(); body.AppendFormat("Комментарии: {0}<br /><br />", tbComments.Text).AppendLine(); PaymentMethod pm = PaymentMethodManager.GetPaymentMethodByID(order.PaymentMethodID); if (pm != null) { body.AppendFormat("Способ оплаты: {0}<br /><br />", pm.Name).AppendLine(); } decimal total = 0; decimal indOrderTotal = IndividualOrderManager.GetTotalPriceIndOrders(indOrders); if (Request.Cookies["Currency"] != null && Request.Cookies["Currency"].Value == "USD") { indOrderTotal = Math.Round(PriceConverter.ToUsd(indOrderTotal)); } total += indOrderTotal; body.AppendFormat("Индивидуальные заказы:<br />"); foreach (var indOrder in indOrders) { body.Append(indOrder.OrderText + "<br />"); } if (Session["fn"] != null) { body.AppendLine(); body.Append("<b>Получатель не заказчик</b><br />").AppendLine(); body.AppendFormat("ФИО: {0} {1}<br />", Session["fn"], Session["ln"]).AppendLine(); body.AppendFormat("Телефон: {0}<br />", Session["pn"]).AppendLine(); body.AppendFormat("Адрес: {0}<br />", Session["address"]).AppendLine(); body.AppendFormat("Дополнительная информация: {0}<br />", Session["ai"]).AppendLine(); } body.AppendFormat("Уведомление о доставке: {0} | {1}<br />", chbByMail.Checked ? "Письмом на Email" : "", chbSMS.Checked ? "СМС сообщение" : "").AppendLine(); body.AppendFormat("<br /><br /> Заказано:<br />"); foreach (OrderProductVariant variant in order.OrderProductVariants) { body.AppendFormat(" - {0} ({1}) x {2}шт. -- {3}; <br />", variant.ProductVariant.Product.Name, PriceHelper.FormatShippingPrice(variant.ProductVariant.Price, true), variant.Quantity, PriceHelper.FormatShippingPrice(variant.ProductVariant.Price * variant.Quantity, true)); total += variant.ProductVariant.Price * variant.Quantity; } string shipping = GetLocaleResourceString("ShoppingCart.ShippingNotRequired"); bool shoppingCartRequiresShipping = ShippingManager.ShoppingCartRequiresShipping(Cart) && Session["SelfOrder"] == null; if (shoppingCartRequiresShipping) { decimal?shoppingCartShippingBase = ShippingManager.GetShoppingCartShippingTotal(Cart, NopContext.Current.User); if (shoppingCartShippingBase.HasValue) { decimal shoppingCartShipping = CurrencyManager.ConvertCurrency(shoppingCartShippingBase.Value, CurrencyManager.PrimaryStoreCurrency, NopContext.Current.WorkingCurrency); shipping = PriceHelper.FormatShippingPrice(shoppingCartShipping, true); total += shoppingCartShipping; } } body.AppendFormat("Доставка: {0}<br />", shipping).AppendLine(); body.AppendFormat("<b>Итого:</b> {0}<br />", total).AppendLine(); body.AppendFormat("<br />Дополнительная информация: {0}<br />", Session["ai"]).AppendLine(); MessageManager.SendEmail(subj, body.ToString(), MessageManager.AdminEmailAddress, MessageManager.AdminEmailAddress); StartPaymentMethod(indOrders, order); Session.Remove("SelfOrder"); Response.Redirect("~/CheckoutCompleted.aspx"); } catch (Exception exc) { Session.Remove("SelfOrder"); LogManager.InsertLog(LogTypeEnum.OrderError, exc.Message, exc); lError.Text = Server.HtmlEncode("Во время обработки заказа произошла ошибка. Для выполнения заказа, пожалуйста, свяжитесь с администратором. Контактную информацию можно найти на странице Контакты."); } } }
/// <summary> /// Gets shopping cart shipping total /// </summary> /// <param name="Cart">Cart</param> /// <param name="customer">Customer</param> /// <param name="includingTax">A value indicating whether calculated price should include tax</param> /// <param name="Error">Error</param> /// <returns>Shipping total</returns> public static decimal?GetShoppingCartShippingTotal(ShoppingCart Cart, Customer customer, bool includingTax, ref string Error) { decimal?shippingTotal = null; bool isFreeShipping = IsFreeShipping(Cart, customer); if (isFreeShipping) { return(Decimal.Zero); } ShippingOption lastShippingOption = null; if (customer != null) { lastShippingOption = customer.LastShippingOption; } if (lastShippingOption != null) { //use last shipping option (get from cache) shippingTotal = TaxManager.GetShippingPrice(lastShippingOption.Rate, includingTax, customer, ref Error); } else { //use fixed rate (if possible) Address shippingAddress = null; if (customer != null) { shippingAddress = customer.ShippingAddress; } ShipmentPackage ShipmentPackage = CreateShipmentPackage(Cart, customer, shippingAddress); ShippingRateComputationMethod activeShippingRateComputationMethod = ActiveShippingRateComputationMethod; if (activeShippingRateComputationMethod == null) { throw new NopException("Shipping rate computation method could not be loaded"); } IShippingRateComputationMethod iShippingRateComputationMethod = Activator.CreateInstance(Type.GetType(activeShippingRateComputationMethod.ClassName)) as IShippingRateComputationMethod; decimal?fixedRate = iShippingRateComputationMethod.GetFixedRate(ShipmentPackage); if (fixedRate.HasValue) { decimal additionalShippingCharge = GetShoppingCartAdditionalShippingCharge(Cart, customer); shippingTotal = TaxManager.GetShippingPrice(fixedRate.Value + additionalShippingCharge, includingTax, customer, ref Error); } } if (!shippingTotal.HasValue) { Error = "Shipping total could not be calculated"; } else { if (HttpContext.Current.Request.Cookies["Currency"] != null && HttpContext.Current.Request.Cookies["Currency"].Value == "USD") { shippingTotal = Math.Round(PriceConverter.ToUsd(shippingTotal.Value)); } else { shippingTotal = Math.Round(shippingTotal.Value, 2); } } return(shippingTotal); }
public string PostProcessPayment(Order order, IndividualOrderCollection indOrders) { bool convertToUsd = HttpContext.Current.Request.Cookies["Currency"] != null && HttpContext.Current.Request.Cookies["Currency"].Value == "USD"; shippingRate = SettingManager.GetSettingValueDecimalNative("ShippingRateComputationMethod.FixedRate.Rate"); freeShippingBorder = SettingManager.GetSettingValueDecimalNative("Shipping.FreeShippingOverX.Value"); if (convertToUsd) { freeShippingBorder = Math.Round(PriceConverter.ToUsd(freeShippingBorder)); } var prodVars = new List <ProductVariant>(); foreach (var opv in order.OrderProductVariants) { prodVars.Add(ProductManager.GetProductVariantByID(opv.ProductVariantID)); } decimal totalWithFee = (int)CalculateTotalServiceFee(order.OrderProductVariants, prodVars, order, convertToUsd, out shippingPrice); totalWithFee += AddServiceFee(IndividualOrderManager.GetTotalPriceIndOrders(indOrders), convertToUsd); var remotePostHelper = new RemotePost { FormName = "WebPeyForm", Url = GetWebPayUrl() }; OrderManager.UpdateOrder(order.OrderID, order.OrderGUID, order.CustomerID, order.CustomerLanguageID, order.CustomerTaxDisplayType, order.OrderSubtotalInclTax, order.OrderSubtotalExclTax, order.OrderShippingInclTax, order.OrderShippingExclTax, order.PaymentMethodAdditionalFeeInclTax, order.PaymentMethodAdditionalFeeExclTax, order.OrderTax, order.OrderTotal, order.OrderDiscount, order.OrderSubtotalInclTaxInCustomerCurrency, order.OrderShippingExclTaxInCustomerCurrency, order.OrderShippingInclTaxInCustomerCurrency, order.OrderShippingExclTaxInCustomerCurrency, order.PaymentMethodAdditionalFeeInclTaxInCustomerCurrency, order.PaymentMethodAdditionalFeeExclTaxInCustomerCurrency, order.OrderTaxInCustomerCurrency, order.OrderTotalInCustomerCurrency, order.CustomerCurrencyCode, order.OrderWeight, order.AffiliateID, order.OrderStatus, order.AllowStoringCreditCardNumber, order.CardType, order.CardName, order.CardNumber, order.MaskedCreditCardNumber, order.CardCVV2, order.CardExpirationMonth, order.CardExpirationYear, order.PaymentMethodID, order.PaymentMethodName, order.AuthorizationTransactionID, order.AuthorizationTransactionCode, order.AuthorizationTransactionResult, order.CaptureTransactionID, order.CaptureTransactionResult, order.PurchaseOrderNumber, order.PaymentStatus, order.BillingFirstName, order.BillingLastName, order.BillingPhoneNumber, order.BillingEmail, order.BillingFaxNumber, order.BillingCompany, order.BillingAddress1, order.BillingAddress2, order.BillingCity, order.BillingStateProvince, order.BillingStateProvinceID, order.BillingZipPostalCode, order.BillingCountry, order.BillingCountryID, order.ShippingStatus, order.ShippingFirstName, order.ShippingLastName, order.ShippingPhoneNumber, order.ShippingEmail, order.ShippingFaxNumber, order.ShippingCompany, order.ShippingAddress1, order.ShippingAddress2, order.ShippingCity, order.ShippingStateProvince, order.ShippingStateProvinceID, order.ShippingZipPostalCode, order.ShippingCountry, order.ShippingCountryID, order.ShippingMethod, order.ShippingRateComputationMethodID, order.ShippedDate, order.Deleted, order.CreatedOn); remotePostHelper.Add("*scart", ""); remotePostHelper.Add("wsb_storeid", StoreId); remotePostHelper.Add("wsb_store", "voobrazi.by"); remotePostHelper.Add("wsb_order_num", order.OrderID.ToString()); remotePostHelper.Add("wsb_currency_id", convertToUsd ? "USD" : CurrencyId); remotePostHelper.Add("wsb_version", "2"); remotePostHelper.Add("wsb_language_id", "russian"); string seed = ((int)(DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0)).TotalSeconds).ToString(); remotePostHelper.Add("wsb_seed", seed); var signatureBulder = new StringBuilder(seed); signatureBulder.Append(StoreId); signatureBulder.Append(order.OrderID); signatureBulder.Append(UseSandBox ? "1" : "0"); signatureBulder.Append(convertToUsd ? "USD" : CurrencyId); signatureBulder.Append(totalWithFee.ToString()); signatureBulder.Append(Sk); byte[] buffer = Encoding.Default.GetBytes(signatureBulder.ToString()); var sha1 = new SHA1CryptoServiceProvider(); string signature = BitConverter.ToString(sha1.ComputeHash(buffer)).Replace("-", "").ToLower(); remotePostHelper.Add("wsb_signature", signature); remotePostHelper.Add("wsb_return_url", string.Format(SettingManager.GetSettingValue("PaymentMethod.WebPay.ReturnUrl"), order.OrderID)); remotePostHelper.Add("wsb_cancel_return_url", string.Format(SettingManager.GetSettingValue("PaymentMethod.WebPay.CancelUrl"), order.OrderID)); remotePostHelper.Add("wsb_notify_url", string.Format(SettingManager.GetSettingValue("PaymentMethod.WebPay.NotifyUrl"), order.OrderID)); remotePostHelper.Add("wsb_test", UseSandBox ? "1" : "0"); for (int i = 0; i < order.OrderProductVariants.Count; i++) { var opv = order.OrderProductVariants[i]; remotePostHelper.Add(string.Format("wsb_invoice_item_name[{0}]", i), opv.ProductVariant.Product.Name); remotePostHelper.Add(string.Format("wsb_invoice_item_quantity[{0}]", i), opv.Quantity.ToString()); var prodVar = ProductManager.GetProductVariantByID(opv.ProductVariantID); decimal prodPrice = !convertToUsd ? prodVar.Price : Math.Round(PriceConverter.ToUsd(prodVar.Price)); remotePostHelper.Add(string.Format("wsb_invoice_item_price[{0}]", i), AddServiceFee(prodPrice, convertToUsd).ToString()); } int cartCount = order.OrderProductVariants.Count; for (int i = order.OrderProductVariants.Count; i < indOrders.Count + cartCount; i++) { var opv = indOrders[i - cartCount]; remotePostHelper.Add(string.Format("wsb_invoice_item_name[{0}]", i), "Индивидуальный заказ"); remotePostHelper.Add(string.Format("wsb_invoice_item_quantity[{0}]", i), "1"); decimal prodPrice = !convertToUsd ? opv.Price : Math.Round(PriceConverter.ToUsd(opv.Price)); remotePostHelper.Add(string.Format("wsb_invoice_item_price[{0}]", i), AddServiceFee(prodPrice, convertToUsd).ToString()); } remotePostHelper.Add("wsb_tax", "0"); remotePostHelper.Add("wsb_shipping_name", "Доставка курьером"); remotePostHelper.Add("wsb_shipping_price", AddServiceFee(shippingPrice, convertToUsd).ToString()); remotePostHelper.Add("wsb_total", totalWithFee.ToString()); if (!string.IsNullOrEmpty(order.ShippingEmail)) { remotePostHelper.Add("wsb_email", order.ShippingEmail); } remotePostHelper.Add("wsb_phone", order.ShippingPhoneNumber); remotePostHelper.Post(); return(string.Empty); }
public void BindData() { ShoppingCart Cart = ShoppingCartManager.GetCurrentShoppingCart(ShoppingCartTypeEnum.ShoppingCart); decimal indOrderTotal = 0; IndividualOrderCollection indOrders = new IndividualOrderCollection(); if (NopContext.Current.Session != null) { Guid CustomerSessionGUID = NopContext.Current.Session.CustomerSessionGUID; indOrders = IndividualOrderManager.GetIndividualOrderByCurrentUserSessionGuid(CustomerSessionGUID); indOrderTotal = IndividualOrderManager.GetTotalPriceIndOrders(indOrders); if (Request.Cookies["Currency"] != null && Request.Cookies["Currency"].Value == "USD") { indOrderTotal = Math.Round(PriceConverter.ToUsd(indOrderTotal)); } } if (Cart.Count > 0 || indOrders.Count > 0) { //payment method (if already selected) int paymentMethodID = 0; if (NopContext.Current.User != null) { paymentMethodID = NopContext.Current.User.LastPaymentMethodID; } //subtotal string SubTotalError = string.Empty; decimal shoppingCartSubTotalDiscountBase; decimal shoppingCartSubTotalBase = ShoppingCartManager.GetShoppingCartSubTotal(Cart, NopContext.Current.User, out shoppingCartSubTotalDiscountBase, ref SubTotalError); if (String.IsNullOrEmpty(SubTotalError)) { decimal shoppingCartSubTotal = CurrencyManager.ConvertCurrency(shoppingCartSubTotalBase, CurrencyManager.PrimaryStoreCurrency, NopContext.Current.WorkingCurrency); shoppingCartSubTotal += indOrderTotal; lblSubTotalAmount.Text = PriceHelper.FormatPrice(shoppingCartSubTotal); if (Request.Cookies["Currency"] != null && Request.Cookies["Currency"].Value == "USD") { lblSubTotalAmount.Text += "$"; } lblSubTotalAmount.CssClass = "productPrice"; if (shoppingCartSubTotalDiscountBase > decimal.Zero) { decimal shoppingCartSubTotalDiscount = CurrencyManager.ConvertCurrency(shoppingCartSubTotalDiscountBase, CurrencyManager.PrimaryStoreCurrency, NopContext.Current.WorkingCurrency); lblSubTotalDiscountAmount.Text = PriceHelper.FormatPrice(shoppingCartSubTotalDiscount, true, false); phSubTotalDiscount.Visible = true; } else { phSubTotalDiscount.Visible = false; } } else { lblSubTotalAmount.Text = GetLocaleResourceString("ShoppingCart.CalculatedDuringCheckout"); lblSubTotalAmount.CssClass = string.Empty; } //shipping info bool shoppingCartRequiresShipping = ShippingManager.ShoppingCartRequiresShipping(Cart) && Session["SelfOrder"] == null; if (shoppingCartRequiresShipping) { decimal?shoppingCartShippingBase = ShippingManager.GetShoppingCartShippingTotal(Cart, NopContext.Current.User); if (shoppingCartShippingBase.HasValue) { decimal shoppingCartShipping = CurrencyManager.ConvertCurrency(shoppingCartShippingBase.Value, CurrencyManager.PrimaryStoreCurrency, NopContext.Current.WorkingCurrency); lblShippingAmount.Text = PriceHelper.FormatShippingPrice(shoppingCartShipping, true); if (Request.Cookies["Currency"] != null && Request.Cookies["Currency"].Value == "USD") { lblShippingAmount.Text += "$"; } lblShippingAmount.CssClass = "productPrice"; } else { lblShippingAmount.Text = GetLocaleResourceString("ShoppingCart.CalculatedDuringCheckout"); lblShippingAmount.CssClass = string.Empty; } } else { lblShippingAmount.Text = GetLocaleResourceString("ShoppingCart.ShippingNotRequired"); lblShippingAmount.CssClass = string.Empty; } //payment method fee bool displayPaymentMethodFee = true; decimal paymentMethodAdditionalFee = PaymentManager.GetAdditionalHandlingFee(paymentMethodID); decimal paymentMethodAdditionalFeeWithTaxBase = TaxManager.GetPaymentMethodAdditionalFee(paymentMethodAdditionalFee, NopContext.Current.User); if (paymentMethodAdditionalFeeWithTaxBase > decimal.Zero) { decimal paymentMethodAdditionalFeeWithTax = CurrencyManager.ConvertCurrency(paymentMethodAdditionalFeeWithTaxBase, CurrencyManager.PrimaryStoreCurrency, NopContext.Current.WorkingCurrency); lblPaymentMethodAdditionalFee.Text = PriceHelper.FormatPaymentMethodAdditionalFee(paymentMethodAdditionalFeeWithTax, true); } else { displayPaymentMethodFee = false; } phPaymentMethodAdditionalFee.Visible = displayPaymentMethodFee; //tax bool displayTax = true; if (TaxManager.HideTaxInOrderSummary && NopContext.Current.TaxDisplayType == TaxDisplayTypeEnum.IncludingTax) { displayTax = false; } else { string TaxError = string.Empty; decimal shoppingCartTaxBase = TaxManager.GetTaxTotal(Cart, paymentMethodID, NopContext.Current.User, ref TaxError); decimal shoppingCartTax = CurrencyManager.ConvertCurrency(shoppingCartTaxBase, CurrencyManager.PrimaryStoreCurrency, NopContext.Current.WorkingCurrency); //if (String.IsNullOrEmpty(TaxError)) //{ // if (shoppingCartTaxBase == 0 && TaxManager.HideZeroTax) // { // displayTax = false; // } // else // { // lblTaxAmount.Text = PriceHelper.FormatPrice(shoppingCartTax, true, false); // lblTaxAmount.CssClass = "productPrice"; // } //} //else //{ // lblTaxAmount.Text = GetLocaleResourceString("ShoppingCart.CalculatedDuringCheckout"); // lblTaxAmount.CssClass = string.Empty; //} } phTaxTotal.Visible = false;// displayTax; //total decimal?shoppingCartTotalBase = ShoppingCartManager.GetShoppingCartTotal(Cart, paymentMethodID, NopContext.Current.User); if (shoppingCartTotalBase.HasValue) { decimal shoppingCartTotal = CurrencyManager.ConvertCurrency(shoppingCartTotalBase.Value, CurrencyManager.PrimaryStoreCurrency, NopContext.Current.WorkingCurrency); if (Session["SelfOrder"] != null) { shoppingCartTotal -= ShippingManager.GetShoppingCartShippingTotal(Cart).Value; } shoppingCartTotal += indOrderTotal; lblTotalAmount.Text = PriceHelper.FormatPrice(shoppingCartTotal); if (Request.Cookies["Currency"] != null && Request.Cookies["Currency"].Value == "USD") { lblTotalAmount.Text += "$"; } lblTotalAmount.CssClass = "productPrice"; } else { lblTotalAmount.Text = GetLocaleResourceString("ShoppingCart.CalculatedDuringCheckout"); lblTotalAmount.CssClass = string.Empty; } } else { this.Visible = false; } }