本文整理汇总了C#中NopSolutions.NopCommerce.BusinessLogic.Orders.Order类的典型用法代码示例。如果您正苦于以下问题:C# Order类的具体用法?C# Order怎么用?C# Order使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Order类属于NopSolutions.NopCommerce.BusinessLogic.Orders命名空间,在下文中一共展示了Order类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BuildPostForm
protected override void BuildPostForm(Order order, IndividualOrderCollection indOrders, decimal price, decimal shipping, Customer customer)
{
var remotePostHelper = new RemotePost { FormName = "AssistForm", Url = GetPaymentServiceUrl() };
remotePostHelper.Add("Merchant_ID", "706403");
remotePostHelper.Add("OrderNumber", order.OrderID.ToString());
remotePostHelper.Add("OrderAmount", Math.Round(price + shipping).ToString());
remotePostHelper.Add("OrderCurrency", ConvertToUsd ? "USD" : CurrencyId);
remotePostHelper.Add("TestMode", IsTestMode? "1": "0");
if (!String.IsNullOrEmpty(customer.BillingAddress.LastName))
{
remotePostHelper.Add("Lastname", customer.BillingAddress.LastName);
}
if (!String.IsNullOrEmpty(customer.BillingAddress.FirstName))
{
remotePostHelper.Add("Firstname", customer.BillingAddress.FirstName);
}
if (!String.IsNullOrEmpty(customer.BillingAddress.Email))
{
remotePostHelper.Add("Email", customer.BillingAddress.Email);
}
remotePostHelper.Add("URL_RETURN_OK", SettingManager.GetSettingValue("PaymentMethod.Assist.OkUrl"));
remotePostHelper.Add("URL_RETURN_NO", SettingManager.GetSettingValue("PaymentMethod.Assist.NoUrl"));
remotePostHelper.Post();
}
示例2: CancelRecurringPayment
/// <summary>
/// Cancels recurring payment
/// </summary>
/// <param name="order">Order</param>
/// <param name="cancelPaymentResult">Cancel payment result</param>
public static void CancelRecurringPayment(Order order, ref CancelPaymentResult cancelPaymentResult)
{
var paymentMethod = PaymentMethodManager.GetPaymentMethodById(order.PaymentMethodId);
if (paymentMethod == null)
throw new NopException("Payment method couldn't be loaded");
var iPaymentMethod = Activator.CreateInstance(Type.GetType(paymentMethod.ClassName)) as IPaymentMethod;
iPaymentMethod.CancelRecurringPayment(order, ref cancelPaymentResult);
}
示例3: PostProcessPayment
/// <summary>
/// Post process payment (payment gateways that require redirecting)
/// </summary>
/// <param name="order">Order</param>
/// <returns>The error status, or String.Empty if no errors</returns>
public static string PostProcessPayment(Order order)
{
//already paid or order.OrderTotal == decimal.Zero
if (order.PaymentStatus == PaymentStatusEnum.Paid)
return string.Empty;
PaymentMethod paymentMethod = PaymentMethodManager.GetPaymentMethodByID(order.PaymentMethodID);
if (paymentMethod == null)
throw new NopException("Payment method couldn't be loaded");
IPaymentMethod iPaymentMethod = Activator.CreateInstance(Type.GetType(paymentMethod.ClassName)) as IPaymentMethod;
return iPaymentMethod.PostProcessPayment(order);
}
示例4: CalculateTotalOrderServiceFee
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;
}
示例5: PostProcessPayment
/// <summary>
/// Post process payment (payment gateways that require redirecting)
/// </summary>
/// <param name="order">Order</param>
/// <returns>The error status, or String.Empty if no errors</returns>
public string PostProcessPayment(Order order)
{
RemotePost remotePostHelper = new RemotePost();
remotePostHelper.FormName = "MoneybookersForm";
remotePostHelper.Url = GetMoneybookersUrl();
remotePostHelper.Add("pay_to_email", payToEmail);
remotePostHelper.Add("recipient_description", SettingManager.StoreName);
remotePostHelper.Add("transaction_id", order.OrderID.ToString());
remotePostHelper.Add("cancel_url", CommonHelper.GetStoreLocation(false) + "Default.aspx");
remotePostHelper.Add("status_url", CommonHelper.GetStoreLocation(false) + "MoneybookersReturn.aspx");
//supported moneybookers languages (EN, DE, ES, FR, IT, PL, GR, RO, RU, TR, CN, CZ or NL)
//TODO Check if customer working language is supported by Moneybookers.
remotePostHelper.Add("language", "EN");
remotePostHelper.Add("amount", order.OrderTotal.ToString(new CultureInfo("en-US", false).NumberFormat));
//TODO Primary store currency should be set to USD now (3-letter codes)
remotePostHelper.Add("currency", CurrencyManager.PrimaryStoreCurrency.CurrencyCode);
remotePostHelper.Add("detail1_description", "Order ID:");
remotePostHelper.Add("detail1_text", order.OrderID.ToString());
remotePostHelper.Add("firstname", order.BillingFirstName);
remotePostHelper.Add("lastname", order.BillingLastName);
remotePostHelper.Add("address", order.BillingAddress1);
remotePostHelper.Add("phone_number", order.BillingPhoneNumber);
remotePostHelper.Add("postal_code", order.BillingZipPostalCode);
remotePostHelper.Add("city", order.BillingCity);
StateProvince billingStateProvince = StateProvinceManager.GetStateProvinceByID(order.BillingStateProvinceID);
if (billingStateProvince != null)
remotePostHelper.Add("state", billingStateProvince.Abbreviation);
else
remotePostHelper.Add("state", order.BillingStateProvince);
Country billingCountry = CountryManager.GetCountryByID(order.BillingCountryID);
if (billingCountry != null)
remotePostHelper.Add("country", billingCountry.ThreeLetterISOCode);
else
remotePostHelper.Add("country", order.BillingCountry);
remotePostHelper.Post();
return string.Empty;
}
示例6: PostProcessPayment
/// <summary>
/// Post process payment (payment gateways that require redirecting)
/// </summary>
/// <param name="order">Order</param>
/// <returns>The error status, or String.Empty if no errors</returns>
public string PostProcessPayment(Order order)
{
return string.Empty;
}
示例7: CancelRecurringPayment
/// <summary>
/// Cancels recurring payment
/// </summary>
/// <param name="order">Order</param>
/// <param name="cancelPaymentResult">Cancel payment result</param>
public void CancelRecurringPayment(Order order, ref CancelPaymentResult cancelPaymentResult)
{
}
示例8: ReplaceMessageTemplateTokens
/// <summary>
/// Replaces a message template tokens
/// </summary>
/// <param name="order">Order instance</param>
/// <param name="template">Template</param>
/// <param name="languageId">Language identifier</param>
/// <returns>New template</returns>
public string ReplaceMessageTemplateTokens(Order order,
string template, int languageId)
{
var tokens = new NameValueCollection();
tokens.Add("Store.Name", IoC.Resolve<ISettingManager>().StoreName);
tokens.Add("Store.URL", IoC.Resolve<ISettingManager>().StoreUrl);
tokens.Add("Store.Email", this.DefaultEmailAccount.Email);
tokens.Add("Order.OrderNumber", order.OrderId.ToString());
tokens.Add("Order.CustomerFullName", HttpUtility.HtmlEncode(order.BillingFullName));
tokens.Add("Order.CustomerEmail", HttpUtility.HtmlEncode(order.BillingEmail));
tokens.Add("Order.BillingFirstName", HttpUtility.HtmlEncode(order.BillingFirstName));
tokens.Add("Order.BillingLastName", HttpUtility.HtmlEncode(order.BillingLastName));
tokens.Add("Order.BillingPhoneNumber", HttpUtility.HtmlEncode(order.BillingPhoneNumber));
tokens.Add("Order.BillingEmail", HttpUtility.HtmlEncode(order.BillingEmail));
tokens.Add("Order.BillingFaxNumber", HttpUtility.HtmlEncode(order.BillingFaxNumber));
tokens.Add("Order.BillingCompany", HttpUtility.HtmlEncode(order.BillingCompany));
tokens.Add("Order.BillingAddress1", HttpUtility.HtmlEncode(order.BillingAddress1));
tokens.Add("Order.BillingAddress2", HttpUtility.HtmlEncode(order.BillingAddress2));
tokens.Add("Order.BillingCity", HttpUtility.HtmlEncode(order.BillingCity));
tokens.Add("Order.BillingStateProvince", HttpUtility.HtmlEncode(order.BillingStateProvince));
tokens.Add("Order.BillingZipPostalCode", HttpUtility.HtmlEncode(order.BillingZipPostalCode));
tokens.Add("Order.BillingCountry", HttpUtility.HtmlEncode(order.BillingCountry));
tokens.Add("Order.ShippingMethod", HttpUtility.HtmlEncode(order.ShippingMethod));
tokens.Add("Order.ShippingFirstName", HttpUtility.HtmlEncode(order.ShippingFirstName));
tokens.Add("Order.ShippingLastName", HttpUtility.HtmlEncode(order.ShippingLastName));
tokens.Add("Order.ShippingPhoneNumber", HttpUtility.HtmlEncode(order.ShippingPhoneNumber));
tokens.Add("Order.ShippingEmail", HttpUtility.HtmlEncode(order.ShippingEmail));
tokens.Add("Order.ShippingFaxNumber", HttpUtility.HtmlEncode(order.ShippingFaxNumber));
tokens.Add("Order.ShippingCompany", HttpUtility.HtmlEncode(order.ShippingCompany));
tokens.Add("Order.ShippingAddress1", HttpUtility.HtmlEncode(order.ShippingAddress1));
tokens.Add("Order.ShippingAddress2", HttpUtility.HtmlEncode(order.ShippingAddress2));
tokens.Add("Order.ShippingCity", HttpUtility.HtmlEncode(order.ShippingCity));
tokens.Add("Order.ShippingStateProvince", HttpUtility.HtmlEncode(order.ShippingStateProvince));
tokens.Add("Order.ShippingZipPostalCode", HttpUtility.HtmlEncode(order.ShippingZipPostalCode));
tokens.Add("Order.ShippingCountry", HttpUtility.HtmlEncode(order.ShippingCountry));
tokens.Add("Order.TrackingNumber", HttpUtility.HtmlEncode(order.TrackingNumber));
tokens.Add("Order.VatNumber", HttpUtility.HtmlEncode(order.VatNumber));
tokens.Add("Order.Product(s)", ProductListToHtmlTable(order, languageId));
var language = IoC.Resolve<ILanguageService>().GetLanguageById(languageId);
if (language != null && !String.IsNullOrEmpty(language.LanguageCulture))
{
DateTime createdOn = DateTimeHelper.ConvertToUserTime(order.CreatedOn, TimeZoneInfo.Utc, DateTimeHelper.GetCustomerTimeZone(order.Customer));
tokens.Add("Order.CreatedOn", createdOn.ToString("D", new CultureInfo(language.LanguageCulture)));
}
else
{
tokens.Add("Order.CreatedOn", order.CreatedOn.ToString("D"));
}
tokens.Add("Order.OrderURLForCustomer", string.Format("{0}orderdetails.aspx?orderid={1}", IoC.Resolve<ISettingManager>().StoreUrl, order.OrderId));
foreach (string token in tokens.Keys)
{
template = Replace(template, String.Format(@"%{0}%", token), tokens[token]);
}
return template;
}
示例9: SendOrderShippedCustomerNotification
/// <summary>
/// Sends an order shipped notification to a customer
/// </summary>
/// <param name="order">Order instance</param>
/// <param name="languageId">Message language identifier</param>
/// <returns>Queued email identifier</returns>
public int SendOrderShippedCustomerNotification(Order order, int languageId)
{
if (order == null)
throw new ArgumentNullException("order");
string templateName = "OrderShipped.CustomerNotification";
LocalizedMessageTemplate localizedMessageTemplate = this.GetLocalizedMessageTemplate(templateName, languageId);
if(localizedMessageTemplate == null || !localizedMessageTemplate.IsActive)
return 0;
var emailAccount = localizedMessageTemplate.EmailAccount;
string subject = ReplaceMessageTemplateTokens(order, localizedMessageTemplate.Subject, languageId);
string body = ReplaceMessageTemplateTokens(order, localizedMessageTemplate.Body, languageId);
string bcc = localizedMessageTemplate.BccEmailAddresses;
var from = new MailAddress(emailAccount.Email, emailAccount.DisplayName);
var to = new MailAddress(order.BillingEmail, order.BillingFullName);
var queuedEmail = InsertQueuedEmail(5, from, to, string.Empty, bcc, subject, body,
DateTime.UtcNow, 0, null, emailAccount.EmailAccountId);
return queuedEmail.QueuedEmailId;
}
示例10: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
if (NopContext.Current.User == null)
{
string loginURL = SEOHelper.GetLoginPageUrl(true);
Response.Redirect(loginURL);
}
order = OrderManager.GetOrderById(this.OrderId);
if (order == null || order.Deleted || NopContext.Current.User.CustomerId != order.CustomerId)
{
string loginURL = SEOHelper.GetLoginPageUrl(true);
Response.Redirect(loginURL);
}
if (!Page.IsPostBack)
{
this.BindData();
}
//buttons
lbPDFInvoice.Visible = SettingManager.GetSettingValueBoolean("Features.SupportPDF");
}
示例11: AreDownloadsAllowed
/// <summary>
/// Gets a value indicating whether downloads are allowed
/// </summary>
/// <param name="order">Order to check</param>
/// <returns>True if downloads are allowed; otherwise, false.</returns>
public static bool AreDownloadsAllowed(Order order)
{
if (order == null)
return false;
if (order.OrderStatus == OrderStatusEnum.Pending || order.OrderStatus == OrderStatusEnum.Cancelled)
return false;
if (order.PaymentStatus == PaymentStatusEnum.Paid)
return true;
return false;
}
示例12: CanDeliver
/// <summary>
/// Gets a value indicating whether order is delivered
/// </summary>
/// <param name="order">Order</param>
/// <returns>A value indicating whether shipping is delivered</returns>
public bool CanDeliver(Order order)
{
if (order == null)
return false;
if (order.OrderStatus == OrderStatusEnum.Cancelled)
return false;
if (order.ShippingStatus == ShippingStatusEnum.Shipped)
return true;
return false;
}
示例13: SetOrderStatus
/// <summary>
/// Sets an order status
/// </summary>
/// <param name="order">Order</param>
/// <param name="os">New order status</param>
/// <param name="notifyCustomer">True to notify customer</param>
protected void SetOrderStatus(Order order,
OrderStatusEnum os, bool notifyCustomer)
{
if (order == null)
throw new ArgumentNullException("order");
OrderStatusEnum prevOrderStatus = order.OrderStatus;
if (prevOrderStatus == os)
return;
//set and save new order status
order.OrderStatusId = (int)os;
UpdateOrder(order);
//order notes, notifications
InsertOrderNote(order.OrderId, string.Format("Order status has been changed to {0}", os.ToString()), false, DateTime.UtcNow);
if (prevOrderStatus != OrderStatusEnum.Complete &&
os == OrderStatusEnum.Complete
&& notifyCustomer)
{
int orderCompletedCustomerNotificationQueuedEmailId = IoC.Resolve<IMessageService>().SendOrderCompletedCustomerNotification(order, order.CustomerLanguageId);
if (orderCompletedCustomerNotificationQueuedEmailId > 0)
{
InsertOrderNote(order.OrderId, string.Format("\"Order completed\" email (to customer) has been queued. Queued email identifier: {0}.", orderCompletedCustomerNotificationQueuedEmailId), false, DateTime.UtcNow);
}
}
if (prevOrderStatus != OrderStatusEnum.Cancelled &&
os == OrderStatusEnum.Cancelled
&& notifyCustomer)
{
int orderCancelledCustomerNotificationQueuedEmailId = IoC.Resolve<IMessageService>().SendOrderCancelledCustomerNotification(order, order.CustomerLanguageId);
if (orderCancelledCustomerNotificationQueuedEmailId > 0)
{
InsertOrderNote(order.OrderId, string.Format("\"Order cancelled\" email (to customer) has been queued. Queued email identifier: {0}.", orderCancelledCustomerNotificationQueuedEmailId), false, DateTime.UtcNow);
}
}
//reward points
if (this.RewardPointsEnabled)
{
if (this.RewardPointsForPurchases_Amount > decimal.Zero)
{
//Ensure that reward points are applied only to registered users
if (order.Customer != null && !order.Customer.IsGuest)
{
int points = (int)Math.Truncate(order.OrderTotal / this.RewardPointsForPurchases_Amount * this.RewardPointsForPurchases_Points);
if (points != 0)
{
if (this.RewardPointsForPurchases_Awarded == order.OrderStatus)
{
InsertRewardPointsHistory(order.CustomerId,
0, points, decimal.Zero,
decimal.Zero, string.Empty,
string.Format(IoC.Resolve<ILocalizationManager>().GetLocaleResourceString("RewardPoints.Message.EarnedForOrder"), order.OrderId),
DateTime.UtcNow);
}
if (this.RewardPointsForPurchases_Canceled == order.OrderStatus)
{
InsertRewardPointsHistory(order.CustomerId,
0, -points, decimal.Zero,
decimal.Zero, string.Empty,
string.Format(IoC.Resolve<ILocalizationManager>().GetLocaleResourceString("RewardPoints.Message.ReducedForOrder"), order.OrderId),
DateTime.UtcNow);
}
}
}
}
}
//gift cards activation
if (this.GiftCards_Activated.HasValue &&
this.GiftCards_Activated.Value == order.OrderStatus)
{
var giftCards = GetAllGiftCards(order.OrderId, null, null, null, null, null, null, false, string.Empty);
foreach (var gc in giftCards)
{
bool isRecipientNotified = gc.IsRecipientNotified;
switch (gc.PurchasedOrderProductVariant.ProductVariant.GiftCardType)
{
case (int)GiftCardTypeEnum.Virtual:
{
//send email for virtual gift card
if (!String.IsNullOrEmpty(gc.RecipientEmail) &&
!String.IsNullOrEmpty(gc.SenderEmail))
{
Language customerLang = IoC.Resolve<ILanguageService>().GetLanguageById(order.CustomerLanguageId);
if (customerLang == null)
customerLang = NopContext.Current.WorkingLanguage;
int queuedEmailId = IoC.Resolve<IMessageService>().SendGiftCardNotification(gc, customerLang.LanguageId);
if (queuedEmailId > 0)
{
//.........这里部分代码省略.........
示例14: UpdateOrder
/// <summary>
/// Updates the order
/// </summary>
/// <param name="order">The order</param>
public void UpdateOrder(Order order)
{
if (order == null)
throw new ArgumentNullException("order");
order.TaxRates = CommonHelper.EnsureNotNull(order.TaxRates);
order.TaxRatesInCustomerCurrency = CommonHelper.EnsureNotNull(order.TaxRatesInCustomerCurrency);
order.CustomerIP = CommonHelper.EnsureNotNull(order.CustomerIP);
order.CheckoutAttributeDescription = CommonHelper.EnsureNotNull(order.CheckoutAttributeDescription);
order.CheckoutAttributesXml = CommonHelper.EnsureNotNull(order.CheckoutAttributesXml);
order.CardType = CommonHelper.EnsureNotNull(order.CardType);
order.CardName = CommonHelper.EnsureNotNull(order.CardName);
order.CardNumber = CommonHelper.EnsureNotNull(order.CardNumber);
order.MaskedCreditCardNumber = CommonHelper.EnsureNotNull(order.MaskedCreditCardNumber);
order.CardCvv2 = CommonHelper.EnsureNotNull(order.CardCvv2);
order.CardExpirationMonth = CommonHelper.EnsureNotNull(order.CardExpirationMonth);
order.CardExpirationYear = CommonHelper.EnsureNotNull(order.CardExpirationYear);
order.PaymentMethodName = CommonHelper.EnsureNotNull(order.PaymentMethodName);
order.AuthorizationTransactionId = CommonHelper.EnsureNotNull(order.AuthorizationTransactionId);
order.AuthorizationTransactionCode = CommonHelper.EnsureNotNull(order.AuthorizationTransactionCode);
order.AuthorizationTransactionResult = CommonHelper.EnsureNotNull(order.AuthorizationTransactionResult);
order.CaptureTransactionId = CommonHelper.EnsureNotNull(order.CaptureTransactionId);
order.CaptureTransactionResult = CommonHelper.EnsureNotNull(order.CaptureTransactionResult);
order.SubscriptionTransactionId = CommonHelper.EnsureNotNull(order.SubscriptionTransactionId);
order.PurchaseOrderNumber = CommonHelper.EnsureNotNull(order.PurchaseOrderNumber);
order.BillingFirstName = CommonHelper.EnsureNotNull(order.BillingFirstName);
order.BillingLastName = CommonHelper.EnsureNotNull(order.BillingLastName);
order.BillingPhoneNumber = CommonHelper.EnsureNotNull(order.BillingPhoneNumber);
order.BillingEmail = CommonHelper.EnsureNotNull(order.BillingEmail);
order.BillingFaxNumber = CommonHelper.EnsureNotNull(order.BillingFaxNumber);
order.BillingCompany = CommonHelper.EnsureNotNull(order.BillingCompany);
order.BillingAddress1 = CommonHelper.EnsureNotNull(order.BillingAddress1);
order.BillingAddress2 = CommonHelper.EnsureNotNull(order.BillingAddress2);
order.BillingCity = CommonHelper.EnsureNotNull(order.BillingCity);
order.BillingStateProvince = CommonHelper.EnsureNotNull(order.BillingStateProvince);
order.BillingZipPostalCode = CommonHelper.EnsureNotNull(order.BillingZipPostalCode);
order.BillingCountry = CommonHelper.EnsureNotNull(order.BillingCountry);
order.ShippingFirstName = CommonHelper.EnsureNotNull(order.ShippingFirstName);
order.ShippingLastName = CommonHelper.EnsureNotNull(order.ShippingLastName);
order.ShippingPhoneNumber = CommonHelper.EnsureNotNull(order.ShippingPhoneNumber);
order.ShippingEmail = CommonHelper.EnsureNotNull(order.ShippingEmail);
order.ShippingFaxNumber = CommonHelper.EnsureNotNull(order.ShippingFaxNumber);
order.ShippingCompany = CommonHelper.EnsureNotNull(order.ShippingCompany);
order.ShippingAddress1 = CommonHelper.EnsureNotNull(order.ShippingAddress1);
order.ShippingAddress2 = CommonHelper.EnsureNotNull(order.ShippingAddress2);
order.ShippingCity = CommonHelper.EnsureNotNull(order.ShippingCity);
order.ShippingStateProvince = CommonHelper.EnsureNotNull(order.ShippingStateProvince);
order.ShippingZipPostalCode = CommonHelper.EnsureNotNull(order.ShippingZipPostalCode);
order.ShippingCountry = CommonHelper.EnsureNotNull(order.ShippingCountry);
order.ShippingMethod = CommonHelper.EnsureNotNull(order.ShippingMethod);
order.TrackingNumber = CommonHelper.EnsureNotNull(order.TrackingNumber);
order.VatNumber = CommonHelper.EnsureNotNull(order.VatNumber);
order.BillingEmail = order.BillingEmail.Trim();
order.ShippingEmail = order.ShippingEmail.Trim();
order.TaxRates = CommonHelper.EnsureMaximumLength(order.TaxRates, 4000);
order.TaxRatesInCustomerCurrency = CommonHelper.EnsureMaximumLength(order.TaxRatesInCustomerCurrency, 4000);
order.CustomerIP = CommonHelper.EnsureMaximumLength(order.CustomerIP, 50);
order.CardType = CommonHelper.EnsureMaximumLength(order.CardType, 100);
order.CardName = CommonHelper.EnsureMaximumLength(order.CardName, 1000);
order.CardNumber = CommonHelper.EnsureMaximumLength(order.CardNumber, 100);
order.MaskedCreditCardNumber = CommonHelper.EnsureMaximumLength(order.MaskedCreditCardNumber, 100);
order.CardCvv2 = CommonHelper.EnsureMaximumLength(order.CardCvv2, 100);
order.CardExpirationMonth = CommonHelper.EnsureMaximumLength(order.CardExpirationMonth, 100);
order.CardExpirationYear = CommonHelper.EnsureMaximumLength(order.CardExpirationYear, 100);
order.PaymentMethodName = CommonHelper.EnsureMaximumLength(order.PaymentMethodName, 100);
order.AuthorizationTransactionId = CommonHelper.EnsureMaximumLength(order.AuthorizationTransactionId, 4000);
order.AuthorizationTransactionCode = CommonHelper.EnsureMaximumLength(order.AuthorizationTransactionCode, 4000);
order.AuthorizationTransactionResult = CommonHelper.EnsureMaximumLength(order.AuthorizationTransactionResult, 4000);
order.CaptureTransactionId = CommonHelper.EnsureMaximumLength(order.CaptureTransactionId, 4000);
order.CaptureTransactionResult = CommonHelper.EnsureMaximumLength(order.CaptureTransactionResult, 4000);
order.SubscriptionTransactionId = CommonHelper.EnsureMaximumLength(order.SubscriptionTransactionId, 4000);
order.PurchaseOrderNumber = CommonHelper.EnsureMaximumLength(order.PurchaseOrderNumber, 100);
order.BillingFirstName = CommonHelper.EnsureMaximumLength(order.BillingFirstName, 100);
order.BillingLastName = CommonHelper.EnsureMaximumLength(order.BillingLastName, 100);
order.BillingPhoneNumber = CommonHelper.EnsureMaximumLength(order.BillingPhoneNumber, 50);
order.BillingEmail = CommonHelper.EnsureMaximumLength(order.BillingEmail, 255);
order.BillingFaxNumber = CommonHelper.EnsureMaximumLength(order.BillingFaxNumber, 50);
order.BillingCompany = CommonHelper.EnsureMaximumLength(order.BillingCompany, 100);
order.BillingAddress1 = CommonHelper.EnsureMaximumLength(order.BillingAddress1, 100);
order.BillingAddress2 = CommonHelper.EnsureMaximumLength(order.BillingAddress2, 100);
order.BillingCity = CommonHelper.EnsureMaximumLength(order.BillingCity, 100);
order.BillingStateProvince = CommonHelper.EnsureMaximumLength(order.BillingStateProvince, 100);
order.BillingZipPostalCode = CommonHelper.EnsureMaximumLength(order.BillingZipPostalCode, 30);
order.BillingCountry = CommonHelper.EnsureMaximumLength(order.BillingCountry, 100);
order.ShippingFirstName = CommonHelper.EnsureMaximumLength(order.ShippingFirstName, 100);
order.ShippingLastName = CommonHelper.EnsureMaximumLength(order.ShippingLastName, 100);
order.ShippingPhoneNumber = CommonHelper.EnsureMaximumLength(order.ShippingPhoneNumber, 50);
order.ShippingEmail = CommonHelper.EnsureMaximumLength(order.ShippingEmail, 255);
order.ShippingFaxNumber = CommonHelper.EnsureMaximumLength(order.ShippingFaxNumber, 50);
order.ShippingCompany = CommonHelper.EnsureMaximumLength(order.ShippingCompany, 100);
order.ShippingAddress1 = CommonHelper.EnsureMaximumLength(order.ShippingAddress1, 100);
order.ShippingAddress2 = CommonHelper.EnsureMaximumLength(order.ShippingAddress2, 100);
order.ShippingCity = CommonHelper.EnsureMaximumLength(order.ShippingCity, 100);
order.ShippingStateProvince = CommonHelper.EnsureMaximumLength(order.ShippingStateProvince, 100);
//.........这里部分代码省略.........
示例15: CanCapture
/// <summary>
/// Gets a value indicating whether capture from admin panel is allowed
/// </summary>
/// <param name="order">Order</param>
/// <returns>A value indicating whether capture from admin panel is allowed</returns>
public bool CanCapture(Order order)
{
if (order == null)
return false;
if (order.OrderStatus == OrderStatusEnum.Cancelled ||
order.OrderStatus == OrderStatusEnum.Pending)
return false;
if (order.PaymentStatus == PaymentStatusEnum.Authorized &&
IoC.Resolve<IPaymentService>().CanCapture(order.PaymentMethodId))
return true;
return false;
}