-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathConfigureSitecore.cs
89 lines (71 loc) · 3.65 KB
/
ConfigureSitecore.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="ConfigureSitecore.cs" company="Sitecore Corporation">
// Copyright (c) Sitecore Corporation 1999-2017
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
using System.Reflection;
using Microsoft.Extensions.DependencyInjection;
using Plugin.LoyaltyPoints.Pipelines;
using Plugin.LoyaltyPoints.Pipelines.Blocks;
using Plugin.LoyaltyPoints.Pipelines.Interfaces;
using Sitecore.Commerce.Core;
using Sitecore.Commerce.EntityViews;
using Sitecore.Commerce.Plugin.Carts;
using Sitecore.Commerce.Plugin.Catalog;
using Sitecore.Commerce.Plugin.Customers;
using Sitecore.Framework.Configuration;
using Sitecore.Framework.Pipelines.Definitions.Extensions;
namespace Plugin.LoyaltyPoints
{
public class ConfigureSitecore : IConfigureSitecore
{
public void ConfigureServices(IServiceCollection services)
{
var assembly = Assembly.GetExecutingAssembly();
services.RegisterAllPipelineBlocks(assembly);
services.Sitecore().Pipelines(config => config
.AddPipeline<IAddToProductPipeline, AddToProductPipeline>(
configure =>
{
configure
.Add<AddToProductBlock>()
.Add<PersistSellableItemBlock>();
})
.AddPipeline<IGetBasisPricePipeline, GetBasisPricePipeline>(
configure => { configure.Add<GetListPriceAmountBlock>(); })
.AddPipeline<IMakeComponentPipeline, MakeComponentPipeline>(
configure => { configure.Add<MakeComponentBlock>(); })
.AddPipeline<ICreateCouponsPipeline, CreateCouponsPipeline>(
configure => { configure.Add<CreateCouponsBlock>(); })
.AddPipeline<IProcessCustomerPipeline, ProcessCustomerPipeline>(
configure => { configure.Add<ProcessCustomerBlock>(); })
.AddPipeline<IProcessOrderPipeline, ProcessOrderPipeline>(
configure => { configure.Add<ProcessOrderBlock>(); })
.AddPipeline<IIssueCouponPipeline, IssueCouponPipeline>(
configure =>
{
configure
.Add<IssueCouponBlock>()
.Add<RegisterXConnectEventBlock>();
})
.ConfigurePipeline<IAddCartLinePipeline>(
configure => configure
.Add<AddCartLineLoyaltyBlock>()
.After<AddCartLineBlock>())
.ConfigurePipeline<IGetEntityViewPipeline>(
configure => configure
.Add<GetSellableItemLoyaltyPointsViewBlock>()
.After<GetSellableItemEditBlock>())
.ConfigurePipeline<IGetEntityViewPipeline>(
configure => configure
.Add<GetCustomerLoyaltyCouponsViewBlock>())
.ConfigurePipeline<IDoActionPipeline>(
configure => configure
.Add<DoActionEditLoyaltyPointsViewBlock>()
.After<DoActionEditSellableItemBlock>())
.ConfigurePipeline<IConfigureServiceApiPipeline>(
configure => configure.Add<ConfigureServiceApiBlock>()));
services.RegisterAllCommands(assembly);
}
}
}