Webiant Logo Webiant Logo
  1. No results found.

    Try your search with a different keyword or use * as a wildcard.

ZettleSyncTask.cs

using Nop.Services.ScheduleTasks;

namespace Nop.Plugin.Misc.Zettle.Services;

/// 
/// Represents a schedule task to synchronize products
/// 
public class ZettleSyncTask : IScheduleTask
{
    #region Fields

    protected readonly ZettleService _zettleService;
    protected readonly ZettleSettings _zettleSettings;

    #endregion

    #region Ctor

    public ZettleSyncTask(ZettleService zettleService,
        ZettleSettings zettleSettings)
    {
        _zettleService = zettleService;
        _zettleSettings = zettleSettings;
    }

    #endregion

    #region Methods

    /// 
    /// Execute task
    /// 
    /// A task that represents the asynchronous operation
    public async Task ExecuteAsync()
    {
        if (ZettleService.IsConfigured(_zettleSettings))
            await _zettleService.ImportAsync();
    }

    #endregion
}