diff --git a/src/Modules/OrchardCore.Commerce.ContentFields/OrchardCore.Commerce.ContentFields.csproj b/src/Modules/OrchardCore.Commerce.ContentFields/OrchardCore.Commerce.ContentFields.csproj
index 6425607b1..dc1ce5ef9 100644
--- a/src/Modules/OrchardCore.Commerce.ContentFields/OrchardCore.Commerce.ContentFields.csproj
+++ b/src/Modules/OrchardCore.Commerce.ContentFields/OrchardCore.Commerce.ContentFields.csproj
@@ -44,7 +44,7 @@
-
+
diff --git a/src/Modules/OrchardCore.Commerce.Inventory/OrchardCore.Commerce.Inventory.csproj b/src/Modules/OrchardCore.Commerce.Inventory/OrchardCore.Commerce.Inventory.csproj
index 33eb4fddb..27098a2e3 100644
--- a/src/Modules/OrchardCore.Commerce.Inventory/OrchardCore.Commerce.Inventory.csproj
+++ b/src/Modules/OrchardCore.Commerce.Inventory/OrchardCore.Commerce.Inventory.csproj
@@ -41,7 +41,7 @@
-
+
diff --git a/src/Modules/OrchardCore.Commerce/Services/OrderLineItemService.cs b/src/Modules/OrchardCore.Commerce/Services/OrderLineItemService.cs
index e0e7d365d..07c8979c7 100644
--- a/src/Modules/OrchardCore.Commerce/Services/OrderLineItemService.cs
+++ b/src/Modules/OrchardCore.Commerce/Services/OrderLineItemService.cs
@@ -81,9 +81,9 @@ public OrderLineItemService(
shipping,
billing,
orderPart?.ContentItem?.PublishedUtc ?? _clock.UtcNow,
- VatNumber: orderPart.VatNumber.Text,
+ VatNumber: orderPart?.VatNumber.Text,
Stored: true,
- IsCorporation: orderPart.IsCorporation.Value);
+ IsCorporation: orderPart?.IsCorporation.Value ?? false);
var changed = false;
if (_taxProviders.Any() &&
diff --git a/src/Modules/OrchardCore.Commerce/Views/ShoppingCartCell_Product.cshtml b/src/Modules/OrchardCore.Commerce/Views/ShoppingCartCell_Product.cshtml
index bde473bd1..09d7c7f67 100644
--- a/src/Modules/OrchardCore.Commerce/Views/ShoppingCartCell_Product.cshtml
+++ b/src/Modules/OrchardCore.Commerce/Views/ShoppingCartCell_Product.cshtml
@@ -7,7 +7,7 @@
var attributes = (IList<(IProductAttributeValue Value, string Type, int Index)>)Model.ProductAttributes;
}
-@line.ProductName
+@line.ProductName
@if (line.Attributes?.Any() == true)
{
diff --git a/test/OrchardCore.Commerce.Tests.UI.Shortcuts/Controllers/OrderController.cs b/test/OrchardCore.Commerce.Tests.UI.Shortcuts/Controllers/OrderController.cs
index 0c8f7e485..fc91c5f81 100644
--- a/test/OrchardCore.Commerce.Tests.UI.Shortcuts/Controllers/OrderController.cs
+++ b/test/OrchardCore.Commerce.Tests.UI.Shortcuts/Controllers/OrderController.cs
@@ -2,6 +2,7 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using OrchardCore.Commerce.Abstractions;
+using OrchardCore.Commerce.Activities;
using OrchardCore.Commerce.AddressDataType;
using OrchardCore.Commerce.Constants;
using OrchardCore.Commerce.Controllers;
@@ -11,8 +12,10 @@
using OrchardCore.ContentManagement;
using OrchardCore.ContentManagement.Utilities;
using OrchardCore.Mvc.Core.Utilities;
+using OrchardCore.Workflows.Services;
using System;
using System.Collections.Generic;
+using System.Linq;
using System.Threading.Tasks;
using static OrchardCore.Commerce.Constants.ContentTypes;
@@ -25,17 +28,20 @@ public class OrderController : Controller
private readonly IShoppingCartPersistence _shoppingCartPersistence;
private readonly IContentManager _contentManager;
private readonly IStripePaymentService _stripePaymentService;
+ private readonly IEnumerable _workflowManagers;
public OrderController(
IPaymentService paymentService,
IShoppingCartPersistence shoppingCartPersistence,
IContentManager contentManager,
- IStripePaymentService stripePaymentService)
+ IStripePaymentService stripePaymentService,
+ IEnumerable workflowManagers)
{
_paymentService = paymentService;
_shoppingCartPersistence = shoppingCartPersistence;
_contentManager = contentManager;
_stripePaymentService = stripePaymentService;
+ _workflowManagers = workflowManagers;
}
[AllowAnonymous]
@@ -91,6 +97,12 @@ public async Task CreateOrderWithSuccessfulPayment(long dateTimeT
await _paymentService.FinalModificationOfOrderAsync(order);
+ // Since the event trigger is tied to "UpdateOrderToOrderedAsync()" we also need to call it here.
+ if (_workflowManagers.FirstOrDefault() is { } workflowManager)
+ {
+ await workflowManager.TriggerEventAsync(nameof(OrderCreatedEvent), order, "Order-" + order.ContentItemId);
+ }
+
return RedirectToAction(
nameof(PaymentController.Success),
typeof(PaymentController).ControllerName(),
diff --git a/test/OrchardCore.Commerce.Tests.UI.Shortcuts/OrchardCore.Commerce.Tests.UI.Shortcuts.csproj b/test/OrchardCore.Commerce.Tests.UI.Shortcuts/OrchardCore.Commerce.Tests.UI.Shortcuts.csproj
index 4f33ebf95..7c32b7b33 100644
--- a/test/OrchardCore.Commerce.Tests.UI.Shortcuts/OrchardCore.Commerce.Tests.UI.Shortcuts.csproj
+++ b/test/OrchardCore.Commerce.Tests.UI.Shortcuts/OrchardCore.Commerce.Tests.UI.Shortcuts.csproj
@@ -1,4 +1,4 @@
-
+
net6.0
@@ -29,7 +29,7 @@
-
+