Skip to content

Open-source eCommerce platform for C# and ASP.NET Core 10 with MongoDB. Build multi-store shops and multi-vendor marketplaces with B2B/B2C, REST API, plugins, Vue 3 and Docker.

Extend order entity about recurring info

KrzysztofPajak6dcab35df47f
diff --git a/src/Business/Grand.Business.Checkout/Commands/Handlers/Orders/PlaceOrderCommandHandler.cs b/src/Business/Grand.Business.Checkout/Commands/Handlers/Orders/PlaceOrderCommandHandler.cs
index f173a7cc3..54a6dff54 100644
--- a/src/Business/Grand.Business.Checkout/Commands/Handlers/Orders/PlaceOrderCommandHandler.cs
+++ b/src/Business/Grand.Business.Checkout/Commands/Handlers/Orders/PlaceOrderCommandHandler.cs
@@ -491,6 +491,13 @@ namespace Grand.Business.Checkout.Commands.Handlers.Orders
}
throw new GrandException(warningsSb.ToString());
}
+ if (product.IsRecurring)
+ {
+ details.IsRecurring = true;
+ details.RecurringCycleLength = product.RecurringCycleLength;
+ details.RecurringCyclePeriodId = product.RecurringCyclePeriodId;
+ details.RecurringTotalCycles = product.RecurringTotalCycles;
+ }
}
//min totals validation
@@ -1029,6 +1036,10 @@ namespace Grand.Business.Checkout.Commands.Handlers.Orders
RedeemedLoyaltyPoints = details.RedeemedLoyaltyPoints,
RedeemedLoyaltyPointsAmount = details.RedeemedLoyaltyPointsAmount,
LoyaltyPointsWereAdded = details.RedeemedLoyaltyPoints > 0,
+ IsRecurring = details.IsRecurring,
+ RecurringCycleLength = details.RecurringCycleLength,
+ RecurringCyclePeriodId = details.RecurringCyclePeriodId,
+ RecurringTotalCycles = details.RecurringTotalCycles,
CreatedOnUtc = DateTime.UtcNow,
};
diff --git a/src/Business/Grand.Business.Checkout/Utilities/PlaceOrderContainter.cs b/src/Business/Grand.Business.Checkout/Utilities/PlaceOrderContainter.cs
index 9f93ea3f5..3b8848595 100644
--- a/src/Business/Grand.Business.Checkout/Utilities/PlaceOrderContainter.cs
+++ b/src/Business/Grand.Business.Checkout/Utilities/PlaceOrderContainter.cs
@@ -1,4 +1,5 @@
using Grand.Business.Catalog.Utilities;
+using Grand.Domain.Catalog;
using Grand.Domain.Common;
using Grand.Domain.Customers;
using Grand.Domain.Directory;
@@ -36,17 +37,16 @@ namespace Grand.Business.Checkout.Utilities
public string ShippingRateProviderSystemName { get; set; }
public bool PickUpInStore { get; set; }
public PickupPoint PickupPoint { get; set; }
-
public string CheckoutAttributeDescription { get; set; }
-
public IList<CustomAttribute> CheckoutAttributes { get; set; }
-
public IList<ShoppingCartItem> Cart { get; set; }
public IList<OrderTax> Taxes { get; set; }
-
public List<ApplyDiscount> AppliedDiscounts { get; set; }
public List<AppliedGiftVoucher> AppliedGiftVouchers { get; set; }
-
+ public bool IsRecurring { get; set; }
+ public int RecurringCycleLength { get; set; }
+ public RecurringCyclePeriod RecurringCyclePeriodId { get; set; }
+ public int RecurringTotalCycles { get; set; }
public double OrderSubTotalInclTax { get; set; }
public double OrderSubTotalExclTax { get; set; }
public double OrderSubTotalDiscountInclTax { get; set; }
diff --git a/src/Core/Grand.Domain/Orders/Order.cs b/src/Core/Grand.Domain/Orders/Order.cs
index cb434ff0e..1b2b67caa 100644
--- a/src/Core/Grand.Domain/Orders/Order.cs
+++ b/src/Core/Grand.Domain/Orders/Order.cs
@@ -1,3 +1,4 @@
+using Grand.Domain.Catalog;
using Grand.Domain.Common;
using Grand.Domain.Payments;
using Grand.Domain.Shipping;
@@ -264,6 +265,27 @@ namespace Grand.Domain.Orders
/// </summary>
public bool Imported { get; set; }
+ /// <summary>
+ /// Gets or sets a value indicating whether the order is recurring
+ /// </summary>
+ public bool IsRecurring { get; set; }
+ /// <summary>
+ /// Gets or sets the cycle length
+ /// </summary>
+ public int RecurringCycleLength { get; set; }
+ /// <summary>
+ /// Gets or sets the cycle period
+ /// </summary>
+ public RecurringCyclePeriod RecurringCyclePeriodId { get; set; }
+ /// <summary>
+ /// Gets or sets the total cycles
+ /// </summary>
+ public int RecurringTotalCycles { get; set; }
+ /// <summary>
+ /// Gets or sets the total cycles
+ /// </summary>
+ public int RecurringUseCycles { get; set; }
+
/// <summary>
/// Gets or sets a value indicating whether the url referrer exists
/// </summary>