Beispiel #1
0
        public override async Task <Order> Run(Order order, CommercePipelineExecutionContext context)
        {
            Condition.Requires(order).IsNotNull($"{Name}: The argument can not be null");

            var orderPlacedPolicy = context.GetPolicy <ServiceBusOrderPlacedPolicy>();

            order.GetComponent <TransientListMembershipsComponent>();
            if (!orderPlacedPolicy.Enabled)
            {
                context.Logger.LogInformation("Feature.Order.ServiceBus: Plugin is disabled - Order not added to send list.");
                return(order);
            }

            try
            {
                await _removeListEntitiesPipeline.Run(new ListEntitiesArgument(new[] { order.Id }, orderPlacedPolicy.OrderPlacedListName), context);
            }
            catch (Exception ex)
            {
                context.Logger.LogError($"Feature.Order.ServiceBus: {ex.Message} {ex.StackTrace}");
            }

            await _eventRegistry.ListItemUpdated().Send(order, Name);

            return(order);
        }
Beispiel #2
0
        public override async Task <Order> Run(Order arg, CommercePipelineExecutionContext context)
        {
            KnownOrderStatusPolicy policy = context.GetPolicy <KnownOrderStatusPolicy>();

            arg.Status = policy.Released;

            KnownOrderListsPolicy listPolicy = context.GetPolicy <KnownOrderListsPolicy>();

            arg.GetComponent <TransientListMembershipsComponent>().Memberships.Add(listPolicy.ReleasedOrders);

            await removeListEntitiesPipeline.Run(new ListEntitiesArgument(new string[1]
            {
                arg.Id
            }, "WaitingForPaymentOrders"), context);

            await persistEntityPipeline.Run(new PersistEntityArgument(arg), context).ConfigureAwait(false);

            await eventRegistry.ListItemUpdated().Send(arg, Name);

            return(arg);
        }