-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy pathModuleConstants.cs
More file actions
339 lines (305 loc) · 14.7 KB
/
ModuleConstants.cs
File metadata and controls
339 lines (305 loc) · 14.7 KB
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using VirtoCommerce.OrdersModule.Core.Model;
using VirtoCommerce.Platform.Core.Settings;
namespace VirtoCommerce.OrdersModule.Core
{
[ExcludeFromCodeCoverage]
public class ModuleConstants
{
public const string OrderIndexDocumentTypeConstant = nameof(CustomerOrder);
public static string OrderIndexDocumentType { get; } = OrderIndexDocumentTypeConstant;
public const string PurchasedProductDocumentPrefix = "__purchased_by_user";
public static class Security
{
public static class Permissions
{
public const string Read = "order:read";
public const string Create = "order:create";
public const string Update = "order:update";
public const string Access = "order:access";
public const string Delete = "order:delete";
public const string ReadPrices = "order:read_prices";
public const string UpdateShipments = "order:update_shipments";
public const string CapturePayment = "order:capture_payment";
public const string RefundPayment = "order:refund";
public const string ViewDashboardStatistics = "order:dashboardstatistics:view";
public static string[] AllPermissions { get; } = {
Read,
Create,
Update,
Access,
Delete,
ReadPrices,
UpdateShipments,
CapturePayment,
RefundPayment,
ViewDashboardStatistics,
};
}
}
public static class CustomerOrderStatus
{
public const string New = "New";
public const string NotPayed = "Not payed";
public const string Pending = "Pending";
public const string Processing = "Processing";
public const string ReadyToSend = "Ready to send";
public const string Cancelled = "Cancelled";
public const string PartiallySent = "Partially sent";
public const string Completed = "Completed";
}
public static class Settings
{
public static class General
{
public static SettingDescriptor OrderStatus = new SettingDescriptor
{
Name = "Order.Status",
ValueType = SettingValueType.ShortText,
GroupName = "Orders|General",
IsDictionary = true,
IsLocalizable = true,
AllowedValues = new object[]
{
CustomerOrderStatus.New,
CustomerOrderStatus.NotPayed,
CustomerOrderStatus.Pending,
CustomerOrderStatus.Processing,
CustomerOrderStatus.ReadyToSend,
CustomerOrderStatus.Cancelled,
CustomerOrderStatus.PartiallySent,
CustomerOrderStatus.Completed,
}
};
public static SettingDescriptor OrderInitialStatus { get; } = new()
{
Name = "Order.InitialStatus",
ValueType = SettingValueType.ShortText,
GroupName = "Orders|General",
DefaultValue = CustomerOrderStatus.New,
};
public static SettingDescriptor OrderInitialProcessingStatus { get; } = new()
{
Name = "Order.InitialProcessingStatus",
ValueType = SettingValueType.ShortText,
GroupName = "Orders|General",
DefaultValue = CustomerOrderStatus.Processing,
};
public static SettingDescriptor OrderLineItemStatuses { get; } = new()
{
Name = "OrderLineItem.Statuses",
ValueType = SettingValueType.ShortText,
GroupName = "Orders|General",
IsDictionary = true,
IsLocalizable = true,
AllowedValues = new object[] { "Pending", "InProgress", "Shipped", "Delivered", "Cancelled" },
};
public static SettingDescriptor OrderLineItemInitialStatus { get; } = new()
{
Name = "OrderLineItem.InitialStatus",
ValueType = SettingValueType.ShortText,
GroupName = "Orders|General",
};
public static SettingDescriptor ShipmentStatus = new SettingDescriptor
{
Name = "Shipment.Status",
ValueType = SettingValueType.ShortText,
GroupName = "Orders|General",
IsDictionary = true,
IsLocalizable = true,
DefaultValue = "New",
AllowedValues = new object[] { "New", "PickPack", "Cancelled", "ReadyToSend", "Sent" }
};
public static SettingDescriptor PaymentInStatus = new SettingDescriptor
{
Name = "PaymentIn.Status",
ValueType = SettingValueType.ShortText,
GroupName = "Orders|General",
IsDictionary = true,
IsLocalizable = true,
DefaultValue = "New",
AllowedValues = new object[] { "New", "Pending", "Authorized", "Paid", "PartiallyRefunded", "Refunded", "Voided", "Custom", "Cancelled" }
};
public static SettingDescriptor RefundStatus { get; } = new SettingDescriptor
{
Name = "Refund.Status",
ValueType = SettingValueType.ShortText,
GroupName = "Orders|General",
IsDictionary = true,
IsLocalizable = true,
DefaultValue = "Pending",
AllowedValues = new object[] { "Pending", "Rejected", "Processed" }
};
public static SettingDescriptor OrderCustomerOrderNewNumberTemplate = new SettingDescriptor
{
Name = "Order.CustomerOrderNewNumberTemplate",
ValueType = SettingValueType.ShortText,
GroupName = "Orders|Orders",
DefaultValue = "CO{0:yyMMdd}-{1:D5}"
};
public static SettingDescriptor OrderShipmentNewNumberTemplate = new SettingDescriptor
{
Name = "Order.ShipmentNewNumberTemplate",
ValueType = SettingValueType.ShortText,
GroupName = "Orders|Orders",
DefaultValue = "SH{0:yyMMdd}-{1:D5}"
};
public static SettingDescriptor OrderPaymentInNewNumberTemplate = new SettingDescriptor
{
Name = "Order.PaymentInNewNumberTemplate",
ValueType = SettingValueType.ShortText,
GroupName = "Orders|Orders",
DefaultValue = "PI{0:yyMMdd}-{1:D5}"
};
public static SettingDescriptor RefundNewNumberTemplate { get; } = new SettingDescriptor
{
Name = "Order.RefundNewNumberTemplate",
ValueType = SettingValueType.ShortText,
GroupName = "Orders|Orders",
DefaultValue = "RE{0:yyMMdd}-{1:D5}"
};
public static SettingDescriptor CaptureNewNumberTemplate { get; } = new SettingDescriptor
{
Name = "Order.CaptureNewNumberTemplate",
ValueType = SettingValueType.ShortText,
GroupName = "Orders|Orders",
DefaultValue = "CA{0:yyMMdd}-{1:D5}"
};
public static SettingDescriptor SendOrderNotifications = new SettingDescriptor
{
Name = "Order.SendOrderNotifications",
GroupName = "Orders|General",
ValueType = SettingValueType.Boolean,
DefaultValue = true,
};
public static SettingDescriptor OrderAdjustInventory = new SettingDescriptor
{
Name = "Order.AdjustInventory",
GroupName = "Orders|General",
ValueType = SettingValueType.Boolean,
DefaultValue = true,
};
public static SettingDescriptor LogOrderChanges { get; } = new SettingDescriptor
{
Name = "Order.LogOrderChanges",
GroupName = "Orders|General",
ValueType = SettingValueType.Boolean,
DefaultValue = true,
};
public static SettingDescriptor EventBasedIndexation { get; } = new SettingDescriptor
{
Name = "Order.Search.EventBasedIndexation.Enable",
GroupName = "Orders|General",
ValueType = SettingValueType.Boolean,
DefaultValue = true,
};
public static SettingDescriptor CustomerOrderIndexationDate { get; } = new SettingDescriptor
{
Name = "VirtoCommerce.Search.IndexingJobs.IndexationDate.CustomerOrder",
GroupName = "Orders|General",
ValueType = SettingValueType.DateTime,
DefaultValue = default(DateTime),
};
public static SettingDescriptor CustomerOrderValidation { get; } = new SettingDescriptor
{
Name = "Order.Validation.Enable",
GroupName = "Orders|General",
ValueType = SettingValueType.Boolean,
DefaultValue = true
};
public static SettingDescriptor OrderPaidAndOrderSentNotifications { get; } = new SettingDescriptor
{
Name = "Order.OrderPaidAndOrderSentNotifications.Enable",
GroupName = "Orders|Notification",
ValueType = SettingValueType.Boolean,
DefaultValue = true,
};
public static SettingDescriptor PaymentShipmentStatusChangedNotifications { get; } = new SettingDescriptor
{
Name = "Order.PaymentShipmentStatusChangedNotifications.Enable",
GroupName = "Orders|Notification",
ValueType = SettingValueType.Boolean,
DefaultValue = false,
};
public static SettingDescriptor PurchasedProductIndexation { get; } = new SettingDescriptor
{
Name = "Order.PurchasedProductIndexation.Enable",
GroupName = "Orders|Products",
ValueType = SettingValueType.Boolean,
DefaultValue = false,
};
public static SettingDescriptor EventBasedPurchasedProductIndexation { get; } = new SettingDescriptor
{
Name = "Order.EventBasedPurchasedProductIndexation.Enable",
GroupName = "Orders|Products",
ValueType = SettingValueType.Boolean,
DefaultValue = true
};
public static SettingDescriptor PurchasedProductStoreFilter { get; } = new SettingDescriptor
{
Name = "Order.PurchasedProductStoreFilter.Enable",
GroupName = "Orders|Products",
ValueType = SettingValueType.Boolean,
DefaultValue = false,
IsPublic = true,
};
public static SettingDescriptor MaxOrderDocumentCount { get; } = new SettingDescriptor
{
Name = "Order.MaxOrderDocumentCount",
GroupName = "Orders|General",
ValueType = SettingValueType.Integer,
DefaultValue = 20,
};
public static IEnumerable<SettingDescriptor> AllSettings
{
get
{
yield return OrderStatus;
yield return OrderInitialStatus;
yield return OrderInitialProcessingStatus;
yield return OrderLineItemStatuses;
yield return OrderLineItemInitialStatus;
yield return ShipmentStatus;
yield return PaymentInStatus;
yield return RefundStatus;
yield return OrderCustomerOrderNewNumberTemplate;
yield return OrderShipmentNewNumberTemplate;
yield return OrderPaymentInNewNumberTemplate;
yield return RefundNewNumberTemplate;
yield return SendOrderNotifications;
yield return OrderAdjustInventory;
yield return LogOrderChanges;
yield return CustomerOrderValidation;
yield return OrderPaidAndOrderSentNotifications;
yield return PaymentShipmentStatusChangedNotifications;
yield return PurchasedProductIndexation;
yield return EventBasedPurchasedProductIndexation;
yield return PurchasedProductStoreFilter;
yield return MaxOrderDocumentCount;
}
}
}
public static IEnumerable<SettingDescriptor> StoreLevelSettings
{
get
{
yield return General.OrderCustomerOrderNewNumberTemplate;
yield return General.OrderPaymentInNewNumberTemplate;
yield return General.OrderShipmentNewNumberTemplate;
yield return General.RefundNewNumberTemplate;
yield return General.PurchasedProductStoreFilter;
}
}
public static IEnumerable<SettingDescriptor> IndexationSettings
{
get
{
yield return General.EventBasedIndexation;
yield return General.CustomerOrderIndexationDate;
}
}
}
}
}