54 lines
1.6 KiB
C#

using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using AAIntegration.SimmonsBank.API.Configs;
using AAIntegration.SimmonsBank.API.Entities;
using AAIntegration.SimmonsBank.API.Models.Transactions;
using AAIntegration.SimmonsBank.API.Services;
using Internal;
using Microsoft.Extensions.Options;
namespace AAIntegration.SimmonsBank.API.Processes;
public class PuppeteerProcess : IPuppeteerProcess
{
private readonly EnvelopeFundConfig _config;
private readonly ILogger<PuppeteerProcess> _logger;
public PuppeteerProcess(
IOptions<EnvelopeFundConfig> config,
ILogger<PuppeteerProcess> logger)
{
_config = config.Value;
_logger = logger;
}
public async Task FundEnvelopes()
{
_logger.LogInformation($"Starting envelope funding...");
// Grab envelopes
/*List<Envelope> envelopes = envelopeService.GetAll().ToList();
bool anyTriggered = false;
foreach (Envelope env in envelopes)
{
// Check if needs triggering
if (env.Enabled && !envelopeService.HasBeenFundedThisMonth(env.Id))
{
_logger.LogInformation($"Envelope '{env.Name}' (id={env.Id}) needs funding - Has now been triggered.");
anyTriggered = true;
// Fund Envelope
envelopeService.FundEnvelopeForThisMonth(env.Id);
}
}*/
if (false)
_logger.LogInformation($"No action taken.");
else
_logger.LogInformation($"Envelope funding complete.");
}
}