OrchardCMS/OrchardCore.Commerce

decouple the service layer from front end layer (OCC-282)

infofromca opened this issue · 0 comments

Is your feature request related to a problem? Please describe

There are too tight couple between Controller and the services:

 Task<IActionResult> UpdateAndRedirectToFinishedOrderAsync(
     Controller controller,
     ContentItem order,
     string? shoppingCartId); 

on interface IPaymentProvider .
and

public static async Task<IActionResult> UpdateAndRedirectToFinishedOrderAsync(
    this IPaymentService service,
    Controller controller,
    ContentItem order,
    string? shoppingCartId,
    string? paymentProviderName = null,
    Func<OrderPart, IEnumerable<IPayment>?>? getCharges = null)

at static class PaymentServiceExtensions

Describe the solution you'd like

Return bool:

Task<bool> UpdateAndRedirectToFinishedOrderAsync(
    ContentItem order,
    string? shoppingCartId,
    string? paymentProviderName = null,
    Func<OrderPart, IEnumerable<IPayment>?>? getCharges = null);

Describe alternatives you've considered

or return enum, then add the logic for controller based on result or exception.

Jira issue