public async Task HandleFulfillmentEventAsync(MFulfillment_FulfillableEvent eventData) { using var log = BeginFunction(nameof(FulfillmentEventMicroService), nameof(HandleFulfillmentEventAsync), eventData); try { using var ctx = CreateQuiltContext(); foreach (var fulfillmentEventItem in eventData.FulfillableEventItems) { if (fulfillmentEventItem.FulfillmentCompleteQuantity != 0) { if (TryParseOrderItemId.FromFulfillableItemReference(fulfillmentEventItem.FulfillmentItemReference, out var orderItemId)) { await OrderMicroService.SetFulfillmentCompleteAsync(orderItemId, fulfillmentEventItem.FulfillmentCompleteQuantity, eventData.UnitOfWork).ConfigureAwait(false); } } if (fulfillmentEventItem.FulfillmentReturnQuantity != 0) { if (TryParseOrderItemId.FromFulfillableItemReference(fulfillmentEventItem.FulfillmentItemReference, out var orderItemId)) { await OrderMicroService.SetFulfillmentReturnAsync(orderItemId, fulfillmentEventItem.FulfillmentReturnQuantity, eventData.UnitOfWork).ConfigureAwait(false); } } } } catch (Exception ex) { log.Exception(ex); throw; } }