public void PopulatePayment(IElectronicPayment payment, IBasket order, ITextTranslator translator) {

			BasketDecorator basket = new BasketDecorator(order);

			payment.LocalRequestReference = basket.OrderHeader.OrderHeaderID.ToString();
			payment.Description = string.Format(translator.GetText("web_store_purchase{0}"), payment.LocalRequestReference);
			payment.PaymentAmount = basket.GrandTotal;
			payment.PaymentDate = DateTime.Now;

            IUserDetails userDetails = (order.UserDetails != null) ? new UserDecorator(order.UserDetails) : order.AltUserDetails;

            //payment.UserInfo.UserDetails. = userDetails.FirstName + " " + userDetails.LastName; -- Is this needed?
            if(payment.UserInfo.UserDetails == null){
                payment.UserInfo.UserDetails = userDetails;
            }

			IAddress invoiceAddress = basket.OrderHeader.InvoiceAddress; 

			payment.UserInfo.UserAddress = invoiceAddress;

			if (invoiceAddress.AddressLine3 != null && invoiceAddress.AddressLine3.Length > 0) {
				payment.UserInfo.UserAddress.AddressLine2 = invoiceAddress.AddressLine2 + ", " + invoiceAddress.AddressLine3;
			} else {
				payment.UserInfo.UserAddress.AddressLine2 = invoiceAddress.AddressLine2;
			}

			payment.UserInfo.UserAddress.City = invoiceAddress.City;
			payment.UserInfo.UserAddress.Region = invoiceAddress.Region;
			payment.UserInfo.UserAddress.Postcode = invoiceAddress.Postcode;
			
			ITextTranslator ccTrans = TranslatorUtils.GetTextTranslator(typeof(CountryCode), translator.CultureCode);
			payment.UserInfo.UserAddress.CountryCode = invoiceAddress.CountryCode;
		}
		public static string FormatMoney(Money money, string cultureCode, IBasketRules rules, ITextTranslator translator) {

			if (rules.ShowPrices(WebStoreContext.Current.CurrentUser)) {
				return FormatMoney(money, cultureCode);
			}

			return translator.GetText("no_price_shown");
		}
		protected virtual void SendEmail(Hashtable data, ITextTranslator translator, string templateName, string senderEmail, string toEmail, string subjectTag, bool isHtml) {

			//Apply configured defaults, possibly
			senderEmail = GetOptimalValue(senderEmail, SenderEmail);
			toEmail = GetOptimalValue(toEmail, ToEmail);

			string[] ccEmailArray = (!string.IsNullOrEmpty(CcEmail)) ? new string[] {CcEmail} : new string[] {};
            string[] bccEmailArray = (!string.IsNullOrEmpty(BccEmail)) ? new string[] { BccEmail } : new string[] { };

			templateName = GetOptimalValue(templateName, TemplateName);
			subjectTag = GetOptimalValue(subjectTag, SubjectTag);
			if (_isHtmlSet) isHtml = IsHtml;

			AddTranslatorData(translator, data, isHtml);
			
			string text = _templateEngine.GetTemplateText(templateName, data);

            _transport.Send(senderEmail, toEmail, translator.GetText(subjectTag), text, ccEmailArray, bccEmailArray);
		}
        protected virtual bool SendEmail(IDictionary context, ITextTranslator translator, string templateName, string senderEmail, string toEmail, string subjectTag, bool isHtml) {

            //Apply configured defaults, possibly
            senderEmail = GetOptimalValue(senderEmail, SenderEmail);
            toEmail = GetOptimalValue(toEmail, ToEmail);

            templateName = GetOptimalValue(templateName, TemplateName);
            subjectTag = GetOptimalValue(subjectTag, SubjectTag);
            if (_isHtmlSet) isHtml = IsHtml;

            AddTranslatorData(translator, context, isHtml);

            StringWriter sw = new StringWriter();

            try {
                _templateEngine.Process(context, templateName, sw);

                MailMessage message = MailHelper.CreateMessage(senderEmail, toEmail, CcEmail, BccEmail, translator.GetText(subjectTag), sw.ToString(), isHtml);
                _transport.Send(message);
            } catch (Exception f) {
                LogManager.GetLogger(GetType()).Error(f);
                return false;
            }
            return true;
        }