Can anyone explain clearly how the OrderPaidEvent is handled..
Which class implements (IConsumer) is used to handle that OrderPaidEvent ?
namespace Nop.Plugin.Misc.QESynchronization
{
public partial class SynchronizationPlugin : BasePlugin, IMiscPlugin,
IConsumer<OrderPaidEvent>,
{
#region Fields
private readonly ISettingService _settingService;
private readonly ILogger _logger;
private readonly IWorkflowMessageServiceQE _workflowMessageServiceQE;
#endregion
#region Ctor
public SynchronizationPlugin(
ISettingService settingService,
ILogger logger,
IWorkflowMessageServiceQE workflowMessageServiceQE,
)
{
this._settingService = settingService;
this._logger = logger;
this._workflowMessageServiceQE = workflowMessageServiceQE;
}
#endregion
/// <summary>
/// Handles the event.
/// </summary>
/// <param name="eventMessage">The event message.</param>
public void HandleEvent(OrderPaidEvent eventMessage)
{
try
{
var order = eventMessage.Order;
if (order == null)
throw new ArgumentNullException("Order is null");
var qeSynchronizationSettings = _settingService.LoadSetting<QESynchronizationSettings>(order.StoreId);
if (qeSynchronizationSettings.SendOrderPaidCustomerNotification)
{
_workflowMessageServiceQE.SendOrderPaidCustomerNotification(order, order.CustomerLanguageId);
}
}
catch (Exception ex)
{
_logger.Error(ex.Message, ex);
}
}