// TODO - GenerateCreditCardPayment().
        public object GenerateCreditCardPayment(
            Models.Customer loggedInCustomer,
            ShippingInformation shippingInfo,
            Models.Address customerAddress,
            List <CartItem> cartItems,
            CreditCard creditCart)
        {
            try
            {
                SetKeys();

                decimal totalPrice = CalculateTotalPrice(cartItems, shippingInfo);

                Transaction transaction = new Transaction()
                {
                    Amount   = PriceConverter.ConvertDecimalPriceToPriceInCents(totalPrice),
                    Billing  = BillingFactory(loggedInCustomer, customerAddress),
                    Card     = CardFactory(creditCart),
                    Customer = CustomerFactory(loggedInCustomer),
                    Item     = ItemArrayFactory(cartItems),
                    Shipping = ShippingFactory(loggedInCustomer, shippingInfo, customerAddress)
                };

                transaction.Save();

                return(new { TransactionId = transaction.Id });
            }
            catch (Exception e)
            {
                return(new { Error = e.Message });
            }
        }
Ejemplo n.º 2
0
        public static ItemRoot SageStockItemToMTItem(SageStockItem sagestockitem)
        {
            ItemRoot itemroot = new ItemRoot();
            Item     item     = new Item();

            item.id     = "";
            item.active = sagestockitem.StockItemStatus == Sage.Accounting.Stock.StockItemStatusEnum.EnumStockItemStatusTypeActive ? true : false;

            item.externalId = sagestockitem.PrimaryKey.DbValue.ToString();
            item.name       = sagestockitem.Name;
            item.type       = "INVENTORY";       // ???

            Cost cost = new Cost()
            {
                amount    = PriceConverter.FromDecimal(sagestockitem.PriceBands[0].StockItemPrices[0].Price, 2),
                precision = 2
            };

            item.cost = cost;

            Residual residual = new Residual()
            {
                amount = 0                 // ???
            };

            item.residual = residual;

            itemroot.item = item;
            return(itemroot);
        }
        private void SyncByCompany(string url, Company company, IList <Price> prices)
        {
            var data = CsvImporter.GetCsv(url);

            data.RemoveAt(0);
            if (!data.Any())
            {
                Logger.Warn($"No data available for company {company.Code}");
            }
            using (var priceRepository = _priceRepositoryFactory.CreateInstance())
            {
                var inserted = false;
                // ReSharper disable once LoopCanBePartlyConvertedToQuery
                foreach (var row in data)
                {
                    var currentDate = DateTime.Parse(row[0]);
                    // ReSharper disable once InvertIf
                    if (!prices.Any(item => item.CompanyId == company.Id && item.Date == currentDate))
                    {
                        priceRepository.Insert(PriceConverter.Convert(row, company));
                        inserted = true;
                    }
                }
                if (inserted)
                {
                    priceRepository.Save();
                }
            }
        }
Ejemplo n.º 4
0
        /*
         * public static TermRoot SagePaymentTermsToMTTerms(Tuple<decimal, int, int> terms)
         * {
         *      TermRoot termroot = new TermRoot();
         *      Term term = new Term();
         *
         *      term.id = "";
         *      term.subsidiaries = null;
         *      term.discountPercent = terms.Item1;
         *      term.discountDays = terms.Item2;
         *      term.dueDays = terms.Item3;
         *      term.externalId = string.Format("{0}-{1}-{2}", terms.Item1, terms.Item2, terms.Item3);
         *      term.name = string.Format("Due Days: {0}", terms.Item3);
         *      term.active = true;
         *
         *      termroot.term = term;
         *      return termroot;
         * }
         */

        #endregion

        #region BANK ACCOUNT / PAYMENT METHOD

        public static PaymentMethodRoot SageBankAccountToMTPaymentMethod(Bank bank)
        {
            PaymentMethodRoot methodroot = new PaymentMethodRoot();
            PaymentMethod     method     = new PaymentMethod();

            method.id         = "";
            method.type       = "ACH";
            method.externalId = bank.PrimaryKey.DbValue.ToString();
            method.active     = true;         // NO MATCHING FIELD IN SAGE

            BankAccount bankaccount = new BankAccount()
            {
                name           = bank.Name,
                accountNumber  = bank.BankAccount.BankAccountNumber,
                accountBalance = new AccountBalance()
                {
                    availableBalance = new AvailableBalance()
                    {
                        amount = PriceConverter.FromDecimal(bank.BankAccount.BaseCurrencyBalance, 2)
                    }
                }
            };

            method.bankAccount = bankaccount;

            methodroot.paymentMethod = method;
            return(methodroot);
        }
Ejemplo n.º 5
0
        /// <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);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Get the Supplies converting the Price into AUD given the exchange rate
        /// </summary>
        /// <returns></returns>
        public IEnumerable <Supply> GetPriceInAUD()
        {
            // Check if the file exists before perfoming any operation
            if (!File.Exists(_filePath))
            {
                return(new List <Supply>());
            }

            // Read the file from the provided path
            var suppliesFromSource = FetchFromSource();

            // Check if there is a conversion required
            var requiresConversion = _currencyType != CurrencyType.AUD;

            if (requiresConversion)
            {
                // You cant perform Calculation on an IEnumerable (properties are Readonly)
                // pull it in memory only if there is a conversion required.
                suppliesFromSource = suppliesFromSource.ToList();

                foreach (var supply in suppliesFromSource)
                {
                    supply.PriceInAUD = PriceConverter.GetConvertedPrice(supply.PriceInDollar, _conversionRate);
                }
            }

            return(suppliesFromSource);
        }
Ejemplo n.º 7
0
 private static void CalculateTotalForInvoices(List <Invoice> invoices)
 {
     foreach (var invoice in invoices)
     {
         var totalPriceWithoutTax = invoice.Lines.Sum(x => x.TotalPrice);
         var totalPriceWithTax    = (totalPriceWithoutTax).ToString("0.00");
         invoice.Header.TotalAmountIncludingTaxes          = totalPriceWithTax;
         invoice.Header.TotalAmountIncludingTaxesWithWords = PriceConverter.ConvertToPriceString(totalPriceWithTax);
     }
 }
Ejemplo n.º 8
0
        public void Is_Valid_Conversion()
        {
            // Arrage
            var price          = 200;
            var exchangeRate   = 0.7m;
            var expectedOutput = 140.0m;
            // Act
            var converterValue = PriceConverter.GetConvertedPrice(price, exchangeRate);

            // Assert
            Assert.AreEqual(converterValue, expectedOutput);
        }
Ejemplo n.º 9
0
        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);
        }
Ejemplo n.º 10
0
        public static BillCreditRoot SageCreditNoteToMTBillCredit(string companyid, PostedPurchaseAccountEntry creditnote, string sessiontoken)
        {
            BillCreditRoot billcreditroot = new BillCreditRoot();
            BillCredit     billcredit     = new BillCredit();

            billcredit.transactionDate = creditnote.InstrumentDate.ToString("yyyy-MM-dd");

            billcredit.amountApplied = new Amount()
            {
                amount    = PriceConverter.FromDecimal(Math.Abs(creditnote.DocumentGrossValue), 2),
                precision = 2
            };

            billcreditroot.billCredit = billcredit;
            return(billcreditroot);
        }
        private PagarMe.Shipping ShippingFactory(Models.Customer customer, ShippingInformation shippingInfo, Models.Address address)
        {
            string deliveryDate =
                DateTime.Now
                .AddDays(shippingInfo.EstimatedTimeOfArrivalInDays)
                .ToString("yyyy-MM-dd");

            return(new PagarMe.Shipping
            {
                Name = customer.Name,
                Fee = PriceConverter.ConvertDoublePriceToPriceInCents(shippingInfo.Price),
                DeliveryDate = deliveryDate,
                Expedited = false,
                Address = AddressFactory(address)
            });
        }
        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);
        }
        public static IndividualOrder InsertIndividualOrder(Guid userGuid, long Price, String OrderText)
        {
            if (userGuid == null || Price == null)
            {
                return(null);
            }

            if (HttpContext.Current.Request.Cookies["Currency"] != null && HttpContext.Current.Request.Cookies["Currency"].Value == "USD")
            {
                Price = PriceConverter.ToBYR(Price);
            }

            DBIndividualOrder dbItem = null;

            dbItem = DBProviderManager <DBIndividualOrderProvider> .Provider.InsertIndividualOrder(userGuid, Price, OrderText);

            IndividualOrder indOrder = DBMapping(dbItem);

            return(indOrder);
        }
        private PagarMe.Item[] ItemArrayFactory(List <CartItem> cartItems)
        {
            Item[] itemArray = new Item[cartItems.Count];

            for (int i = 0; i < cartItems.Count; i++)
            {
                CartItem currentCartItem = cartItems[i];

                itemArray[i] = new Item()
                {
                    Id        = currentCartItem.Id.ToString(),
                    Title     = currentCartItem.Product.Name,
                    Quantity  = currentCartItem.Amount,
                    Tangible  = true,
                    UnitPrice = PriceConverter.ConvertDecimalPriceToPriceInCents(currentCartItem.Product.UnitPrice)
                };
            }

            return(itemArray);
        }
        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 void fastOrderShCart_Click(object sender, EventArgs e)
        {
            String message = GetMessage(false);

            if (NopContext.Current.Session == null)
            {
                return;
            }

            Guid CustomerSessionGUID = NopContext.Current.Session.CustomerSessionGUID;
            long price = 0;

            Int64.TryParse(this.Price.Text, out price);
            if (Request.Cookies["Currency"] != null && Request.Cookies["Currency"].Value == "USD")
            {
                price = PriceConverter.ToBYR(price);
            }

            IndividualOrderManager.InsertIndividualOrder(CustomerSessionGUID, price, message);
            Response.Redirect("~/ShoppingCart.aspx");
        }
Ejemplo n.º 17
0
        public static CreditRoot SageCreditNoteToMTCredit(string companyid, PostedPurchaseAccountEntry creditnote, string sessiontoken)
        {
            CreditRoot creditroot = new CreditRoot();
            Credit     credit     = new Credit();

            credit.id              = "";
            credit.externalId      = creditnote.PrimaryKey.DbValue.ToString();
            credit.creditNumber    = creditnote.SecondReferenceNo;          // THIS WILL BE THE INVOICE NUMBER
            credit.transactionDate = creditnote.InstrumentDate.ToString("yyyy-MM-dd");

            // GET THE VENDOR ID FROM MINERAL TREE
            Vendor vendor = MTApi.GetVendorByExternalID(companyid, sessiontoken, creditnote.Supplier.PrimaryKey.DbValue.ToString());

            if (vendor == null)
            {
                return(null);
            }
            credit.vendor = new ObjID()
            {
                id = vendor.id
            };

            credit.amount = new Amount()
            {
                amount    = PriceConverter.FromDecimal(Math.Abs(creditnote.DocumentGrossValue), 2),
                precision = 2
            };
            credit.status = "Open";
            if (creditnote.MemoNotes.Count > 0)
            {
                credit.memo = creditnote.MemoNotes[0].Note;                 // JUST USE THE FIRST MEMO
            }
            else
            {
                credit.memo = "";
            }

            creditroot.credit = credit;
            return(creditroot);
        }
        public object GenerateBoleto(Models.Customer loggedInCustomer, decimal totalPrice)
        {
            try
            {
                SetKeys();

                Transaction transaction = new Transaction()
                {
                    Amount        = PriceConverter.ConvertDecimalPriceToPriceInCents(totalPrice),
                    PaymentMethod = PaymentMethod.Boleto,
                    Customer      = CustomerFactory(loggedInCustomer)
                };

                transaction.Save();

                return(new { BoletoUrl = transaction.BoletoUrl, ExpirationDate = transaction.BoletoExpirationDate });
            }
            catch (Exception e)
            {
                return(new { Error = e.Message });
            }
        }
Ejemplo n.º 19
0
        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));
        }
Ejemplo n.º 20
0
        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);
        }
Ejemplo n.º 21
0
        public static BillRoot SageInvoiceToMTBill(string companyid, PostedPurchaseAccountEntry invoice, string sessiontoken)
        {
            BillRoot billroot = new BillRoot();
            Bill     bill     = new Bill();

            bill.id         = "";
            bill.externalId = invoice.PrimaryKey.DbValue.ToString();

            bill.dueDate         = invoice.DueDate.ToString("yyyy-MM-dd");
            bill.transactionDate = invoice.InstrumentDate.ToString("yyyy-MM-dd"); //??
            bill.invoiceNumber   = invoice.InstrumentNo;                          // THIS IS REFERENCE IN SAGE UI (INVOICE SCREEN)

            bill.amount = new Amount()
            {
                amount    = PriceConverter.FromDecimal(invoice.CoreDocumentGrossValue, 2),
                precision = 2
            };

            bill.balance = new Amount()
            {
                amount = 0
            };                                                      // ???

            bill.totalTaxAmount = new Amount()
            {
                amount    = PriceConverter.FromDecimal(invoice.CoreDocumentTaxValue, 2),
                precision = 2
            };

            // NOT POSSIBLE TO ADD LINE ITEMS BECAUSE SAGE SPLITS TRANSACTIONS INTO 2, VAT AND GLCODE/GOODSAMOUNT AND THEY ARE NOT RELATED
            // NOMINAL ANALYSIS

            /*
             * bill.items = new List<CompanyItem>();
             *
             * int count = invoice.TradingTransactionDrillDown.NominalEntries.Count();
             * foreach (Sage.Accounting.NominalLedger.NominalAccountEntryView view in invoice.TradingTransactionDrillDown.NominalEntries)
             * {
             *      CompanyItem ci = new CompanyItem();
             *      ci.glAccount = MTReferenceData.FindGlAccountByAccountNumber(view.AccountNumber);
             *      ci.netAmount = new Amount() { amount = PriceConverter.FromDecimal(view.GoodsValueInBaseCurrency, 2), precision = 2 };
             *      ci.taxAmount = new Amount() { amount = 0, precision = 2 };
             *
             *      bill.items.Add(ci);
             *
             *      // CREATE THE NOMINAL ANALYSIS
             *
             *      //NominalCode nominalcode = SageApi.GetNominalCodeByPrimaryKey(lineitem.GLAccountID);
             *      //nominal.NominalSpecification = nominalcode.NominalSpecification;
             *      //nominal.Narrative = lineitem.Description;
             *      //nominal.Amount = lineitem.NetAmount;
             *
             *      // CREATE THE VAT ANALYSIS
             *      //TaxCode taxcode = SageApi.GetVatRateByPrimaryKey(lineitem.ClassificationID);
             *      //tax.TaxCode = taxcode;
             *      //tax.Goods = lineitem.NetAmount;
             *      //tax.TaxAmount = lineitem.TaxAmount;
             * }
             *
             * // TAX/VAT ANALYSIS
             * /*
             * foreach (Sage.Accounting.TaxModule.Views.TaxAccountEntryView view in invoice.TradingTransactionDrillDown.TaxEntries)
             * {
             *      CompanyItem ci = new CompanyItem();
             *      //view.GoodsAmount;
             *      //view.TaxAmount;
             *      //view.TaxRate;
             *      //view.
             * }
             * //
             */
            if (invoice.MemoNotes.Count > 0)
            {
                bill.memo = invoice.MemoNotes[0].Note;                 // JUST USE THE FIRST MEMO
            }
            else
            {
                bill.memo = "";
            }
            bill.poNumber = "";             // ??
            bill.state    = EnumMapper.SageDocumentStatusEnumToMTState(invoice.DocumentStatus);

            // GET THE VENDOR ID FROM MINERAL TREE
            Vendor vendor = MTApi.GetVendorByExternalID(companyid, sessiontoken, invoice.Supplier.PrimaryKey.DbValue.ToString());

            if (vendor == null)
            {
                return(null);
            }
            bill.vendor = new ObjID()
            {
                id = vendor.id
            };

            bill.expenses = null;
            bill.items    = null;

            billroot.bill = bill;
            return(billroot);
        }
Ejemplo n.º 22
0
        public static PurchaseOrderRoot SagePurchaseOrderToMTPurchaseOrder(string companyid, POPOrder poporder, string sessiontoken)
        {
            PurchaseOrderRoot purchaseorderroot = new PurchaseOrderRoot();
            PurchaseOrder     purchaseorder     = new PurchaseOrder();

            purchaseorder.id         = "";
            purchaseorder.externalId = poporder.PrimaryKey.DbValue.ToString();

            // GET THE VENDOR ID FROM MINERAL TREE
            Vendor vendor = MTApi.GetVendorByExternalID(companyid, sessiontoken, poporder.Supplier.PrimaryKey.DbValue.ToString());

            if (vendor == null)
            {
                return(null);
            }
            purchaseorder.vendor = new ObjID()
            {
                id = vendor.id
            };

            purchaseorder.dueDate  = poporder.DocumentDate.ToString("yyyy-MM-dd");
            purchaseorder.poNumber = poporder.DocumentNo;
            purchaseorder.memo     = "";
            purchaseorder.state    = "PendingBilling";
            purchaseorder.poType   = "Standard";

            // PURCHASE ORDER ITEMS
            List <PurchaseOrderItem> items = new List <PurchaseOrderItem>();
            int linenumber = 1;

            foreach (Sage.Accounting.POP.POPOrderReturnLine line in poporder.Lines)
            {
                PurchaseOrderItem item = new PurchaseOrderItem();

                //
                // FIGURE OUT THE MT ID OF THE LINE ITEM
                SageStockItem ssi = Sage200Api.GetStockItemByCode(line.ItemCode);
                if (ssi != null)
                {
                    Item mtitem = MTApi.GetItemByExternalID(companyid, sessiontoken, ssi.PrimaryKey.DbValue.ToString());
                    if (mtitem != null)
                    {
                        item.companyItem = new ObjID()
                        {
                            id = mtitem.id
                        };
                    }
                }
                //

                item.name     = line.LineDescription;
                item.quantity = new Quantity()
                {
                    value = PriceConverter.FromDecimal(line.LineQuantity, 2), precision = 2
                };
                item.quantityReceived = new Quantity()
                {
                    value = 1, precision = 0
                };                                                                                   // no value in sage
                item.billedQuantity = new Quantity()
                {
                    value = PriceConverter.FromDecimal(line.LineQuantity, 2), precision = 2
                };

                item.cost = new Cost()
                {
                    amount    = PriceConverter.FromDecimal(line.UnitBuyingPrice, 2),
                    precision = 2
                };

                item.amountDue = new Amount()
                {
                    amount    = PriceConverter.FromDecimal(line.LineTotalValue, 2),
                    precision = 2
                };

                item.lineNumber   = linenumber;      // no value in sage
                item.closed       = false;           // no value in sage
                item.description  = line.ItemDescription;
                item.poItemStatus = "New";

                items.Add(item);
                linenumber++;
            }

            purchaseorder.items = items;

            purchaseorderroot.purchaseOrder = purchaseorder;
            return(purchaseorderroot);
        }
Ejemplo n.º 23
0
        /// <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);
        }
        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("Во время обработки заказа произошла ошибка. Для выполнения заказа, пожалуйста, свяжитесь с администратором. Контактную информацию можно найти на странице Контакты.");
                }
            }
        }
Ejemplo n.º 25
0
 public CustomLabelFormatter(PriceConverter pFormatter)
     : base()
 {
     this.formatter = pFormatter;
 }
Ejemplo n.º 26
0
 public void Initialize()
 {
     _priceConverter = new PriceConverter(9999999);
     _target         = new PrivateObject(_priceConverter);
 }
Ejemplo n.º 27
0
        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;
            }
        }