Skip to content

Commit 8194a21

Browse files
Ensure collections are sorted
1 parent 71b0a71 commit 8194a21

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

src/Umbraco.Commerce.Deploy/Connectors/ServiceConnectors/UmbracoCommercePaymentMethodServiceConnector.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
using Umbraco.Cms.Core;
1111
using Umbraco.Cms.Core.Deploy;
1212
using Umbraco.Commerce.Extensions;
13-
13+
using Umbraco.Extensions;
1414
using StringExtensions = Umbraco.Commerce.Extensions.StringExtensions;
1515

1616
namespace Umbraco.Commerce.Deploy.Connectors.ServiceConnectors
@@ -94,7 +94,7 @@ public override IAsyncEnumerable<PaymentMethodReadOnly> GetEntitiesAsync(Guid st
9494
{
9595
var servicesPrices = new List<ServicePriceArtifact>();
9696

97-
foreach (var price in entity.Prices.OrderBy(x => x.CountryId).ThenBy(x => x.RegionId).ThenBy(x => x.CurrencyId))
97+
foreach (var price in entity.Prices.OrderBy(x => x.CurrencyId).ThenBy(x => x.CountryId).ThenBy(x => x.RegionId))
9898
{
9999
var spArtifact = new ServicePriceArtifact { Value = price.Value };
100100

@@ -139,7 +139,7 @@ public override IAsyncEnumerable<PaymentMethodReadOnly> GetEntitiesAsync(Guid st
139139
{
140140
var allowedCountryRegions = new List<AllowedCountryRegionArtifact>();
141141

142-
foreach (var acr in entity.AllowedCountryRegions)
142+
foreach (var acr in entity.AllowedCountryRegions.OrderBy(x => x.CountryId).ThenBy(x => x.RegionId))
143143
{
144144
var acrArtifact = new AllowedCountryRegionArtifact();
145145

src/Umbraco.Commerce.Deploy/Connectors/ServiceConnectors/UmbracoCommerceProductAttributePresetServiceConnector.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public override IAsyncEnumerable<ProductAttributePresetReadOnly> GetEntitiesAsyn
6363

6464
var allowedAttributes = new List<AllowedProductAttributeArtifact>();
6565

66-
foreach (AllowedProductAttribute? allowedAttr in entity.AllowedAttributes)
66+
foreach (AllowedProductAttribute? allowedAttr in entity.AllowedAttributes.OrderBy(x => x.ProductAttributeAlias))
6767
{
6868
// Get product attribute ID
6969
ProductAttributeReadOnly? attr = await _umbracoCommerceApi.GetProductAttributeAsync(entity.StoreId, allowedAttr.ProductAttributeAlias);
@@ -76,7 +76,7 @@ public override IAsyncEnumerable<ProductAttributePresetReadOnly> GetEntitiesAsyn
7676
allowedAttributes.Add(new AllowedProductAttributeArtifact
7777
{
7878
ProductAttributeUdi = attrUdi,
79-
AllowedValueAliases = allowedAttr.AllowedValueAliases
79+
AllowedValueAliases = allowedAttr.AllowedValueAliases.Order().ToList()
8080
});
8181
}
8282

src/Umbraco.Commerce.Deploy/Connectors/ServiceConnectors/UmbracoCommerceProductAttributeServiceConnector.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public override IAsyncEnumerable<ProductAttributeReadOnly> GetEntitiesAsync(Guid
6969
DefaultValue = entity.Name.GetDefaultValue()
7070
},
7171
Code = entity.Alias,
72-
Values = entity.Values.Select(x => new ProductAttributeValueArtifact
72+
Values = entity.Values.OrderBy(x => x.Alias).Select(x => new ProductAttributeValueArtifact
7373
{
7474
Alias = x.Alias,
7575
Name = new TranslatedValueArtifact<string>

src/Umbraco.Commerce.Deploy/Connectors/ServiceConnectors/UmbracoCommerceShippingMethodServiceConnector.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public override IAsyncEnumerable<ShippingMethodReadOnly> GetEntitiesAsync(Guid s
102102
{
103103
var servicesPrices = new List<ServicePriceArtifact>();
104104

105-
foreach (ServicePrice? price in calcConfig.Prices)
105+
foreach (ServicePrice? price in calcConfig.Prices.OrderBy(x => x.CurrencyId).ThenBy(x => x.CountryId).ThenBy(x => x.RegionId))
106106
{
107107
var spArtifact = new ServicePriceArtifact { Value = price.Value };
108108

0 commit comments

Comments
 (0)