Skip to content

Commit

Permalink
NEST-463: Fixing 'ContentOrchardHelperExtensions.GetItemDisplayUrlAsy…
Browse files Browse the repository at this point in the history
…nc(IOrchardHelper, ContentItem)' is obsolete: 'Use GetItemDisplayUrl instead as this method does not need to be async.' (#316)

* Fixing 'ContentOrchardHelperExtensions.GetItemDisplayUrlAsync(IOrchardHelper, ContentItem)' is obsolete: 'Use GetItemDisplayUrl instead as this method does not need to be async.'

* Updating HL reference

* Consolidating packages

* Fixing values if the orderPart is null

* Fixing email sending during testing
  • Loading branch information
DemeSzabolcs authored Jul 19, 2023
1 parent 30aa1eb commit 0133185
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
<ProjectReference Include="$(LombiqHelpfulLibrariesPath)" />
</ItemGroup>
<ItemGroup Condition="!Exists($(LombiqHelpfulLibrariesPath))">
<PackageReference Include="Lombiq.HelpfulLibraries.OrchardCore" Version="6.0.0" />
<PackageReference Include="Lombiq.HelpfulLibraries.OrchardCore" Version="6.0.1-alpha.0.gov-15" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<ProjectReference Include="$(LombiqHelpfulLibrariesPath)" />
</ItemGroup>
<ItemGroup Condition="!Exists($(LombiqHelpfulLibrariesPath))">
<PackageReference Include="Lombiq.HelpfulLibraries.OrchardCore" Version="6.0.0" />
<PackageReference Include="Lombiq.HelpfulLibraries.OrchardCore" Version="6.0.1-alpha.0.gov-15" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -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() &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
var attributes = (IList<(IProductAttributeValue Value, string Type, int Index)>)Model.ProductAttributes;
}

<a href="@await Orchard.GetItemDisplayUrlAsync(line.Product.ContentItem)" class="link-primary">@line.ProductName</a>
<a href="@Orchard.GetItemDisplayUrl(line.Product.ContentItem)" class="link-primary">@line.ProductName</a>
@if (line.Attributes?.Any() == true)
{
<ul class="cart-product-attributes list-inline">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;

Expand All @@ -25,17 +28,20 @@ public class OrderController : Controller
private readonly IShoppingCartPersistence _shoppingCartPersistence;
private readonly IContentManager _contentManager;
private readonly IStripePaymentService _stripePaymentService;
private readonly IEnumerable<IWorkflowManager> _workflowManagers;

public OrderController(
IPaymentService paymentService,
IShoppingCartPersistence shoppingCartPersistence,
IContentManager contentManager,
IStripePaymentService stripePaymentService)
IStripePaymentService stripePaymentService,
IEnumerable<IWorkflowManager> workflowManagers)
{
_paymentService = paymentService;
_shoppingCartPersistence = shoppingCartPersistence;
_contentManager = contentManager;
_stripePaymentService = stripePaymentService;
_workflowManagers = workflowManagers;
}

[AllowAnonymous]
Expand Down Expand Up @@ -91,6 +97,12 @@ public async Task<IActionResult> 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(),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">
<Project Sdk="Microsoft.NET.Sdk.Razor">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
Expand Down Expand Up @@ -29,7 +29,7 @@
<ProjectReference Include="$(LombiqHelpfulLibrariesPath)" />
</ItemGroup>
<ItemGroup Condition="!Exists($(LombiqHelpfulLibrariesPath))">
<PackageReference Include="Lombiq.HelpfulLibraries.OrchardCore" Version="6.0.0" />
<PackageReference Include="Lombiq.HelpfulLibraries.OrchardCore" Version="6.0.1-alpha.0.gov-15" />
</ItemGroup>

</Project>

0 comments on commit 0133185

Please sign in to comment.