Skip to content

Commit 6217e11

Browse files
committed
format
1 parent 397930e commit 6217e11

3 files changed

Lines changed: 103 additions & 50 deletions

File tree

src/Modules/OrchardCore.Commerce.Payment/Services/DummyPaymentProvider.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#pragma warning disable IDE0055
21
using Microsoft.AspNetCore.Http;
32
using Microsoft.AspNetCore.Mvc.Localization;
43
using OrchardCore.Commerce.Abstractions.Abstractions;
@@ -95,4 +94,3 @@ public async Task<PaymentOperationStatusViewModel> UpdateAndRedirectToFinishedOr
9594
}
9695
}
9796
}
98-
#pragma warning restore IDE0055

src/Modules/OrchardCore.Commerce/Models/UserAddressesPart.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,16 @@ public class UserAddressesPart : ContentPart
1515
[SuppressMessage(
1616
"Design",
1717
"CA1024:Use properties where appropriate",
18-
Justification = "It's not appropriate for it's counterpart for billing so this should remain a method for parity")]
18+
Justification = "It's not appropriate for it's counterpart for billing so this should remain a method for parity"
19+
)]
1920
public Address GetSafeShippingAddress() =>
2021
// If BillingAndShippingAddressesMatch is ticked, we return the billing address for the shipping address as well.
21-
BillingAndShippingAddressesMatch.Value ? BillingAddress.Address : ShippingAddress.Address;
22+
BillingAndShippingAddressesMatch.Value
23+
? BillingAddress.Address
24+
: ShippingAddress.Address;
2225

2326
public Address GetSafeBillingAddress() =>
24-
string.IsNullOrWhiteSpace(BillingAddress.Address.Name) ? ShippingAddress.Address : BillingAddress.Address;
27+
string.IsNullOrWhiteSpace(BillingAddress.Address.Name)
28+
? ShippingAddress.Address
29+
: BillingAddress.Address;
2530
}

src/Modules/OrchardCore.Commerce/Startup.cs

Lines changed: 95 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,10 @@ public override void ConfigureServices(IServiceCollection services)
6767
services.AddOrchardServices();
6868
services.AddScoped<IDataMigration, MvcTitleMigrations>();
6969
services.AddTagHelpers<MvcTitleTagHelper>();
70-
services.AddTransient<IConfigureOptions<ResourceManagementOptions>, ResourceManagementOptionsConfiguration>();
70+
services.AddTransient<
71+
IConfigureOptions<ResourceManagementOptions>,
72+
ResourceManagementOptionsConfiguration
73+
>();
7174
services.AddScoped<IUserService, UserService>();
7275
services.AddScoped<IResourceFilterProvider, ResourceFilters>();
7376

@@ -78,37 +81,55 @@ public override void ConfigureServices(IServiceCollection services)
7881
services.AddScoped<IProductService, ProductService>();
7982
services.AddScoped<IProductInventoryProvider, LocalInventoryProvider>();
8083

81-
services.AddContentPart<ProductPart>()
84+
services
85+
.AddContentPart<ProductPart>()
8286
.UseDisplayDriver<ProductPartDisplayDriver>()
8387
.AddHandler<SkuValidationHandler>();
8488

8589
// Attributes
86-
services.AddContentField<BooleanProductAttributeField>()
90+
services
91+
.AddContentField<BooleanProductAttributeField>()
8792
.UseDisplayDriver<BooleanProductAttributeFieldDriver>();
88-
services.AddScoped<IContentPartFieldDefinitionDisplayDriver, BooleanProductAttributeFieldSettingsDriver>();
93+
services.AddScoped<
94+
IContentPartFieldDefinitionDisplayDriver,
95+
BooleanProductAttributeFieldSettingsDriver
96+
>();
8997

90-
services.AddContentField<NumericProductAttributeField>()
98+
services
99+
.AddContentField<NumericProductAttributeField>()
91100
.UseDisplayDriver<NumericProductAttributeFieldDriver>();
92-
services.AddScoped<IContentPartFieldDefinitionDisplayDriver, NumericProductAttributeFieldSettingsDriver>();
101+
services.AddScoped<
102+
IContentPartFieldDefinitionDisplayDriver,
103+
NumericProductAttributeFieldSettingsDriver
104+
>();
93105

94-
services.AddContentField<TextProductAttributeField>()
106+
services
107+
.AddContentField<TextProductAttributeField>()
95108
.UseDisplayDriver<TextProductAttributeFieldDriver>();
96-
services.AddScoped<IContentPartFieldDefinitionDisplayDriver, TextProductAttributeFieldSettingsDriver>();
109+
services.AddScoped<
110+
IContentPartFieldDefinitionDisplayDriver,
111+
TextProductAttributeFieldSettingsDriver
112+
>();
97113

98114
services.AddScoped<IProductAttributeProvider, ProductAttributeProvider>();
99115
services.AddScoped<IProductAttributeProvider, TextProductAttributeProvider>();
100116
services.AddScoped<IProductAttributeProvider, BooleanProductAttributeProvider>();
101117
services.AddScoped<IProductAttributeProvider, NumericProductAttributeProvider>();
102118
services.AddScoped<IProductAttributeService, ProductAttributeService>();
103-
services.AddScoped<IPredefinedValuesProductAttributeService, PredefinedValuesProductAttributeService>();
119+
services.AddScoped<
120+
IPredefinedValuesProductAttributeService,
121+
PredefinedValuesProductAttributeService
122+
>();
104123

105124
// Price
106125
services.AddScoped<IDataMigration, PriceMigrations>();
107126
services.AddSingleton<IIndexProvider, PriceIndexProvider>();
108127

109-
services.AddContentPart<PricePart>()
110-
.AddHandler<PricePartHandler>();
111-
services.AddScoped<IContentTypePartDefinitionDisplayDriver, PricePartSettingsDisplayDriver>();
128+
services.AddContentPart<PricePart>().AddHandler<PricePartHandler>();
129+
services.AddScoped<
130+
IContentTypePartDefinitionDisplayDriver,
131+
PricePartSettingsDisplayDriver
132+
>();
112133

113134
services.AddScoped<IPriceProvider, PriceProvider>();
114135
services.AddScoped<IPriceService, PriceService>();
@@ -117,7 +138,8 @@ public override void ConfigureServices(IServiceCollection services)
117138
// Price Variants
118139
services.AddScoped<IDataMigration, PriceVariantsMigrations>();
119140

120-
services.AddContentPart<PriceVariantsPart>()
141+
services
142+
.AddContentPart<PriceVariantsPart>()
121143
.UseDisplayDriver<PriceVariantsPartDisplayDriver>()
122144
.AddHandler<PriceVariantsPartHandler>();
123145

@@ -126,7 +148,8 @@ public override void ConfigureServices(IServiceCollection services)
126148
// Tiered Prices
127149
services.AddScoped<IDataMigration, TieredPriceMigrations>();
128150

129-
services.AddContentPart<TieredPricePart>()
151+
services
152+
.AddContentPart<TieredPricePart>()
130153
.UseDisplayDriver<TieredPricePartDisplayDriver>()
131154
.AddHandler<TieredPricePartHandler>();
132155

@@ -139,13 +162,15 @@ public override void ConfigureServices(IServiceCollection services)
139162
// Shopping cart
140163
services.AddScoped<IShoppingCartHelpers, ShoppingCartHelpers>();
141164
services.AddScoped<IShoppingCartSerializer, ShoppingCartSerializer>();
142-
services.AddContentPart<ShoppingCartWidgetPart>()
165+
services
166+
.AddContentPart<ShoppingCartWidgetPart>()
143167
.UseDisplayDriver<ShoppingCartWidgetPartDisplayDriver>()
144168
.WithMigration<ShoppingCartWidgetMigrations>();
145169
services.AddScoped<IShoppingCartEvents, TaxShoppingCartEvents>();
146170

147171
// Orders
148-
services.AddContentPart<OrderPart>()
172+
services
173+
.AddContentPart<OrderPart>()
149174
.UseDisplayDriver<OrderPartDisplayDriver>()
150175
.AddHandler<OrderPartHandler>();
151176

@@ -155,7 +180,10 @@ public override void ConfigureServices(IServiceCollection services)
155180
services.AddScoped<IAddressFormatterProvider, AddressFormatterProvider>();
156181
services.AddScoped<IOrderLineItemService, OrderLineItemService>();
157182

158-
services.AddScoped<IContentTypeDefinitionDisplayDriver, OrderContentTypeDefinitionDisplayDriver>();
183+
services.AddScoped<
184+
IContentTypeDefinitionDisplayDriver,
185+
OrderContentTypeDefinitionDisplayDriver
186+
>();
159187

160188
// Region
161189
services.AddScoped<IRegionService, RegionService>();
@@ -173,7 +201,8 @@ public override void ConfigureServices(IServiceCollection services)
173201
services.AddScoped<IDataMigration, PageMigrations>();
174202

175203
// Exposing models to liquid templates
176-
services.Configure<TemplateOptions>(option =>
204+
services
205+
.Configure<TemplateOptions>(option =>
177206
{
178207
option.MemberAccessStrategy.Register<ShoppingCartViewModel>();
179208
option.MemberAccessStrategy.Register<ShoppingCartCellViewModel>();
@@ -194,7 +223,9 @@ public override void ConfigureServices(IServiceCollection services)
194223
// then retrieve the corresponding content item.
195224
.AddLiquidFilter<ProductFilter>("product")
196225
// Liquid filter to create AddressFieldEditorViewModel.
197-
.AddLiquidFilter<AddressFieldEditorViewModelConverterFilter>("address_field_editor_view_model")
226+
.AddLiquidFilter<AddressFieldEditorViewModelConverterFilter>(
227+
"address_field_editor_view_model"
228+
)
198229
// Liquid filter to create OrderLineItemViewModels and additional data.
199230
.AddLiquidFilter<OrderPartToOrderSummaryLiquidFilter>("order_part_to_order_summary")
200231
// Liquid filter to convert Amount, its JSON representation, or a number into Amount.ToString() including correct formatting and currency.
@@ -204,19 +235,26 @@ public override void ConfigureServices(IServiceCollection services)
204235
services.AddScoped<IProductListService, ProductListService>();
205236
services.AddProductListFilterProvider<ProductListTitleFilterProvider>();
206237
services.AddProductListFilterProvider<BasePriceFilterProvider>();
207-
services.AddScoped<IAppliedProductListFilterParametersProvider, QueryStringAppliedProductListFilterParametersProvider>();
238+
services.AddScoped<
239+
IAppliedProductListFilterParametersProvider,
240+
QueryStringAppliedProductListFilterParametersProvider
241+
>();
208242
services.AddScoped<IDataMigration, ProductListMigrations>();
209-
services.AddContentPart<ProductListPart>()
210-
.UseDisplayDriver<ProductListPartDisplayDriver>();
243+
services.AddContentPart<ProductListPart>().UseDisplayDriver<ProductListPartDisplayDriver>();
211244
IProductAttributeDeserializer.AddSerializers(
212245
new TextProductAttributeDeserializer(),
213246
new BooleanProductAttributeDeserializer(),
214-
new NumericProductAttributeDeserializer());
247+
new NumericProductAttributeDeserializer()
248+
);
215249

216250
services.AddCommerceApiServices();
217251
}
218252

219-
public override void Configure(IApplicationBuilder app, IEndpointRouteBuilder routes, IServiceProvider serviceProvider)
253+
public override void Configure(
254+
IApplicationBuilder app,
255+
IEndpointRouteBuilder routes,
256+
IServiceProvider serviceProvider
257+
)
220258
{
221259
app.UseResourceFilters();
222260
routes.AddShoppingCartApiEndpoints();
@@ -254,7 +292,10 @@ public class DeploymentStartup : StartupBase
254292
{
255293
public override void ConfigureServices(IServiceCollection services)
256294
{
257-
services.AddDeployment<SiteSettingsPropertyDeploymentSource<RegionSettings>, SiteSettingsPropertyDeploymentStep<RegionSettings>>();
295+
services.AddDeployment<
296+
SiteSettingsPropertyDeploymentSource<RegionSettings>,
297+
SiteSettingsPropertyDeploymentStep<RegionSettings>
298+
>();
258299
services.AddScoped(ImplementationFactory);
259300
}
260301

@@ -264,7 +305,8 @@ private IDisplayDriver<DeploymentStep> ImplementationFactory(IServiceProvider se
264305

265306
return new SiteSettingsPropertyDeploymentStepDriver<RegionSettings>(
266307
localizer["Region settings"],
267-
localizer["Exports the region settings."]);
308+
localizer["Exports the region settings."]
309+
);
268310
}
269311
}
270312

@@ -285,15 +327,20 @@ public override void ConfigureServices(IServiceCollection services)
285327
services.AddScoped<IShoppingCartPersistence, SessionShoppingCartPersistence>();
286328
}
287329

288-
public override void Configure(IApplicationBuilder app, IEndpointRouteBuilder routes, IServiceProvider serviceProvider)
330+
public override void Configure(
331+
IApplicationBuilder app,
332+
IEndpointRouteBuilder routes,
333+
IServiceProvider serviceProvider
334+
)
289335
{
290336
base.Configure(app, routes, serviceProvider);
291337
app.UseSession();
292338
routes.MapAreaControllerRoute(
293339
name: "ShoppingCart",
294340
areaName: "OrchardCore.Commerce",
295341
pattern: "shoppingcart/{action}",
296-
defaults: new { controller = "ShoppingCart", action = "Index" });
342+
defaults: new { controller = "ShoppingCart", action = "Index" }
343+
);
297344
}
298345
}
299346

@@ -309,9 +356,7 @@ public class TaxStartup : StartupBase
309356
{
310357
public override void ConfigureServices(IServiceCollection services)
311358
{
312-
services
313-
.AddContentPart<PricePart>()
314-
.AddHandler<TaxPartAndPricePartHandler>();
359+
services.AddContentPart<PricePart>().AddHandler<TaxPartAndPricePartHandler>();
315360

316361
services.AddScoped<ITaxProvider, LocalTaxProvider>();
317362
}
@@ -346,9 +391,7 @@ public class TaxRateStartup : StartupBase
346391
{
347392
public override void ConfigureServices(IServiceCollection services)
348393
{
349-
services
350-
.AddContentPart<TaxPart>()
351-
.UseDisplayDriver<TaxRateTaxPartDisplayDriver>();
394+
services.AddContentPart<TaxPart>().UseDisplayDriver<TaxRateTaxPartDisplayDriver>();
352395

353396
services.AddScoped<ITaxProvider, TaxRateTaxProvider>();
354397
services.AddScoped<TaxRateTaxProvider>();
@@ -360,28 +403,29 @@ public class UserSettingsStartup : StartupBase
360403
{
361404
public override void ConfigureServices(IServiceCollection services)
362405
{
363-
services
364-
.AddContentPart<UserAddressesPart>()
365-
.WithMigration<UserAddressesMigrations>();
406+
services.AddContentPart<UserAddressesPart>().WithMigration<UserAddressesMigrations>();
366407

367-
services
368-
.AddContentPart<UserDetailsPart>()
369-
.WithMigration<UserDetailsMigrations>();
408+
services.AddContentPart<UserDetailsPart>().WithMigration<UserDetailsMigrations>();
370409

371410
services.AddScoped<IAddressFieldEvents, UserAddressFieldEvents>();
372411
services.AddScoped<IDisplayDriver<User>, UserAddressesUserDisplayDriver>();
373412
services.AddScoped<IOrderEvents, UserSettingsOrderEvents>();
374413
services.AddScoped<ICheckoutEvents, UserSettingsCheckoutEvents>();
375414
}
376415

377-
public override void Configure(IApplicationBuilder app, IEndpointRouteBuilder routes, IServiceProvider serviceProvider)
416+
public override void Configure(
417+
IApplicationBuilder app,
418+
IEndpointRouteBuilder routes,
419+
IServiceProvider serviceProvider
420+
)
378421
{
379422
base.Configure(app, routes, serviceProvider);
380423
routes.MapAreaControllerRoute(
381424
name: nameof(UserController),
382425
areaName: "OrchardCore.Commerce",
383426
pattern: "user/{action}",
384-
defaults: new { controller = typeof(UserController).ControllerName(), action = "Index" });
427+
defaults: new { controller = typeof(UserController).ControllerName(), action = "Index" }
428+
);
385429
}
386430
}
387431

@@ -390,7 +434,10 @@ public class InventoryStartup : StartupBase
390434
{
391435
public override void ConfigureServices(IServiceCollection services)
392436
{
393-
services.AddScoped<IProductEstimationContextUpdater, InventoryProductEstimationContextUpdater>();
437+
services.AddScoped<
438+
IProductEstimationContextUpdater,
439+
InventoryProductEstimationContextUpdater
440+
>();
394441
services.AddScoped<IOrderEvents, InventoryOrderEvents>();
395442
services.AddScoped<IProductInventoryService, ProductInventoryService>();
396443
services.AddScoped<ICheckoutEvents, InventoryCheckoutEvents>();
@@ -411,8 +458,11 @@ public override void ConfigureServices(IServiceCollection services)
411458
services.AddScoped<IProductService, ContentLocalizationProductService>();
412459
}
413460

414-
public override void Configure(IApplicationBuilder app, IEndpointRouteBuilder routes, IServiceProvider serviceProvider) =>
415-
app.UseMiddleware<LocalizationCurrencyRedirectMiddleware>();
461+
public override void Configure(
462+
IApplicationBuilder app,
463+
IEndpointRouteBuilder routes,
464+
IServiceProvider serviceProvider
465+
) => app.UseMiddleware<LocalizationCurrencyRedirectMiddleware>();
416466
}
417467

418468
[RequireFeatures(CommerceConstants.Features.Subscription)]

0 commit comments

Comments
 (0)