From b692296045fe1b83c7d834c1bad62048db322f10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1vid=20El-Saig?= Date: Sun, 30 Jul 2023 22:41:31 +0200 Subject: [PATCH] Some small fixes. --- .../OrchardCore.Commerce/Services/PaymentService.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Modules/OrchardCore.Commerce/Services/PaymentService.cs b/src/Modules/OrchardCore.Commerce/Services/PaymentService.cs index 992e31615..aabcaf62f 100644 --- a/src/Modules/OrchardCore.Commerce/Services/PaymentService.cs +++ b/src/Modules/OrchardCore.Commerce/Services/PaymentService.cs @@ -7,7 +7,6 @@ using OrchardCore.Commerce.Extensions; using OrchardCore.Commerce.Models; using OrchardCore.Commerce.MoneyDataType; -using OrchardCore.Commerce.MoneyDataType.Extensions; using OrchardCore.Commerce.Promotion.Extensions; using OrchardCore.Commerce.Tax.Extensions; using OrchardCore.Commerce.ViewModels; @@ -170,8 +169,8 @@ public async Task FinalModificationOfOrderAsync(ContentItem order) await userService.AlterUserSettingAsync(user, UserAddresses, contentItem => { - var part = contentItem.ContainsKey(nameof(UserAddressesPart)) - ? contentItem[nameof(UserAddressesPart)].ToObject()! + var part = contentItem.TryGetValue(nameof(UserAddressesPart), out var partJson) + ? partJson.ToObject()! : new UserAddressesPart(); part.BillingAndShippingAddressesMatch.Value = isSame; @@ -207,7 +206,7 @@ public async Task CreateNoPaymentOrderFromShoppingCartAsync() order.As().ShippingAddress.Address, order.As().BillingAddress.Address); - if (!cartViewModel.Totals.Any() || cartViewModel.Totals.Sum().Value != 0) + if (!cartViewModel.Totals.Any() || cartViewModel.Totals.Any(total => total.Value > 0)) { return null; }