public AuditDataCleanUpService(IScheduledJobsConfiguration config, IPaymentsDataContext dataContext, IEndpointInstanceFactory endpointInstanceFactory, IPaymentLogger paymentLogger) { this.dataContext = dataContext ?? throw new ArgumentNullException(nameof(dataContext)); this.endpointInstanceFactory = endpointInstanceFactory ?? throw new ArgumentNullException(nameof(endpointInstanceFactory)); this.config = config ?? throw new ArgumentNullException(nameof(config)); this.paymentLogger = paymentLogger ?? throw new ArgumentNullException(nameof(paymentLogger)); }
public static async Task HttpLevyAccountImport([HttpTrigger(AuthorizationLevel.Function, "get", Route = null)] HttpRequest req, [Inject] IEndpointInstanceFactory endpointInstanceFactory, [Inject] IScheduledJobsConfiguration config, [Inject] IPaymentLogger log) { await RunLevyAccountImport(endpointInstanceFactory, config, log); }
private static async Task RunLevyAccountImport(IEndpointInstanceFactory endpointInstanceFactory, IScheduledJobsConfiguration config, IPaymentLogger log) { try { var command = new ImportEmployerAccounts(); var endpointInstance = await endpointInstanceFactory.GetEndpointInstance().ConfigureAwait(false); await endpointInstance.Send(config.LevyAccountBalanceEndpoint, command).ConfigureAwait(false); } catch (Exception e) { log.LogError("Error in LevyAccountImport", e); throw; } }
public static async Task Run([TimerTrigger("%LevyAccountSchedule%", RunOnStartup = false)] TimerInfo myTimer, [Inject] IEndpointInstanceFactory endpointInstanceFactory, [Inject] IScheduledJobsConfiguration config, [Inject] IPaymentLogger log) { await RunLevyAccountImport(endpointInstanceFactory, config, log); }