Skip to content

Commit 64786f1

Browse files
Try using IDocumentNavigationQueryService
1 parent 35a090e commit 64786f1

File tree

1 file changed

+13
-16
lines changed

1 file changed

+13
-16
lines changed

src/Umbraco.Commerce.Checkout/Events/SyncZeroValuePaymentProviderContinueUrl.cs

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,17 @@ namespace Umbraco.Commerce.Checkout.Events
2121
public class SyncZeroValuePaymentProviderContinueUrl : INotificationAsyncHandler<ContentCacheRefresherNotification>
2222
{
2323
private readonly IUmbracoCommerceApi _commerceApi;
24-
private readonly INavigationQueryService _navigationQueryService;
25-
private readonly IPublishedContentCache _publishedContentCacheService;
26-
private readonly IPublishedContentTypeCache _publishedContentTypeCacheService;
24+
private readonly IDocumentNavigationQueryService _documentNavigationQueryService;
25+
private readonly IPublishedContentCache _publishedContentCache;
2726

2827
public SyncZeroValuePaymentProviderContinueUrl(
2928
IUmbracoCommerceApi commerceApi,
30-
INavigationQueryService navigationQueryService,
31-
IPublishedContentCache publishedContentCacheService,
32-
IPublishedContentTypeCache publishedContentTypeCacheService)
29+
IDocumentNavigationQueryService documentNavigationQueryService,
30+
IPublishedContentCache publishedContentCache)
3331
{
3432
_commerceApi = commerceApi;
35-
_navigationQueryService = navigationQueryService;
36-
_publishedContentCacheService = publishedContentCacheService;
37-
_publishedContentTypeCacheService = publishedContentTypeCacheService;
33+
_documentNavigationQueryService = documentNavigationQueryService;
34+
_publishedContentCache = publishedContentCache;
3835
}
3936

4037
public async Task HandleAsync(ContentCacheRefresherNotification notification, CancellationToken cancellationToken)
@@ -56,7 +53,7 @@ public async Task HandleAsync(ContentCacheRefresherNotification notification, Ca
5653
if (payload.ChangeTypes.HasType(TreeChangeTypes.RefreshNode))
5754
{
5855
// Single node refresh
59-
IPublishedContent? node = _publishedContentCacheService.GetById(payload.Id);
56+
IPublishedContent? node = _publishedContentCache.GetById(payload.Id);
6057
if (node != null && IsConfirmationPageType(node))
6158
{
6259
await DoSyncZeroValuePaymentProviderContinueUrlAsync(node);
@@ -65,12 +62,12 @@ public async Task HandleAsync(ContentCacheRefresherNotification notification, Ca
6562
else if (payload.ChangeTypes.HasType(TreeChangeTypes.RefreshBranch))
6663
{
6764
// Branch refresh
68-
IPublishedContent? rootNode = _publishedContentCacheService.GetById(payload.Id);
69-
if (rootNode != null && _navigationQueryService.TryGetDescendantsKeysOfType(rootNode.Key, UmbracoCommerceCheckoutConstants.ContentTypes.Aliases.CheckoutStepPage, out IEnumerable<Guid> keys))
65+
IPublishedContent? rootNode = _publishedContentCache.GetById(payload.Id);
66+
if (rootNode != null && _documentNavigationQueryService.TryGetDescendantsKeysOfType(rootNode.Key, UmbracoCommerceCheckoutConstants.ContentTypes.Aliases.CheckoutStepPage, out IEnumerable<Guid> keys))
7067
{
7168
foreach (Guid key in keys)
7269
{
73-
IPublishedContent? node = _publishedContentCacheService.GetById(key);
70+
IPublishedContent? node = _publishedContentCache.GetById(key);
7471
if (node != null && IsConfirmationPageType(node))
7572
{
7673
await DoSyncZeroValuePaymentProviderContinueUrlAsync(node);
@@ -80,15 +77,15 @@ public async Task HandleAsync(ContentCacheRefresherNotification notification, Ca
8077
}
8178
else if (payload.ChangeTypes.HasType(TreeChangeTypes.RefreshAll))
8279
{
83-
if (_navigationQueryService.TryGetRootKeys(out IEnumerable<Guid> rootKeys))
80+
if (_documentNavigationQueryService.TryGetRootKeys(out IEnumerable<Guid> rootKeys))
8481
{
8582
foreach (Guid rootKey in rootKeys)
8683
{
87-
if (_navigationQueryService.TryGetDescendantsKeysOfType(rootKey, UmbracoCommerceCheckoutConstants.ContentTypes.Aliases.CheckoutStepPage, out IEnumerable<Guid> keys))
84+
if (_documentNavigationQueryService.TryGetDescendantsKeysOfType(rootKey, UmbracoCommerceCheckoutConstants.ContentTypes.Aliases.CheckoutStepPage, out IEnumerable<Guid> keys))
8885
{
8986
foreach (Guid key in keys)
9087
{
91-
IPublishedContent? node = _publishedContentCacheService.GetById(key);
88+
IPublishedContent? node = _publishedContentCache.GetById(key);
9289
if (node != null && IsConfirmationPageType(node))
9390
{
9491
await DoSyncZeroValuePaymentProviderContinueUrlAsync(node);

0 commit comments

Comments
 (0)