From 0dc432eef857952fb88da1562edb255a03e8d06a Mon Sep 17 00:00:00 2001 From: Basil Kotov Date: Tue, 19 Dec 2023 09:57:07 +0100 Subject: [PATCH] PT-14487: load payment and shipment types when raise event (#392) --- .../Services/CustomerOrderService.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/VirtoCommerce.OrdersModule.Data/Services/CustomerOrderService.cs b/src/VirtoCommerce.OrdersModule.Data/Services/CustomerOrderService.cs index 9dc0a9b6..225c04a4 100644 --- a/src/VirtoCommerce.OrdersModule.Data/Services/CustomerOrderService.cs +++ b/src/VirtoCommerce.OrdersModule.Data/Services/CustomerOrderService.cs @@ -85,6 +85,7 @@ public override async Task SaveChangesAsync(IList models) repository.PatchRowVersion(originalEntity, modifiedOrder.RowVersion); var oldModel = originalEntity.ToModel(AbstractTypeFactory.TryCreateInstance()); + await LoadOrderDependenciesAsync(oldModel); _totalsCalculator.CalculateTotals(oldModel); // Workaround to trigger update of auditable fields when only updating navigation properties. @@ -147,6 +148,7 @@ public override async Task SaveChangesAsync(IList models) // We need to CalculateTotals for the new Order, because it is empty after entity.ToModel creation _totalsCalculator.CalculateTotals(changedModel); + await LoadOrderDependenciesAsync(changedModel); changedEntry.NewEntry = changedModel; }