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 IlrDcService(IMapper mapper, ITdgService tdgService, TestSession testSession, IJobService jobService, IAzureStorageKeyValuePersistenceServiceConfig storageServiceConfig, IStreamableKeyValuePersistenceService storageService, IPaymentsDataContext dataContext) { this.mapper = mapper; this.tdgService = tdgService; this.testSession = testSession; this.jobService = jobService; this.storageServiceConfig = storageServiceConfig; this.storageService = storageService; this.dataContext = dataContext; }
public void Setup() { var dbName = Guid.NewGuid().ToString(); var contextBuilder = new DbContextOptionsBuilder <PaymentsDataContext>() .UseInMemoryDatabase(databaseName: dbName) .Options; context = new PaymentsDataContext(contextBuilder); sut = new PaymentClawbackRepository(context); }
public LevyAccountValidationService( IDasLevyAccountApiWrapper dasLevyAccountApiWrapper, IPaymentsDataContext paymentsDataContext, IValidator <CombinedLevyAccountsDto> validator, IPaymentLogger paymentLogger) { this.dasLevyAccountApiWrapper = dasLevyAccountApiWrapper ?? throw new ArgumentNullException(nameof(dasLevyAccountApiWrapper)); this.paymentsDataContext = paymentsDataContext ?? throw new ArgumentNullException(nameof(paymentsDataContext)); this.validator = validator ?? throw new ArgumentNullException(nameof(validator)); this.paymentLogger = paymentLogger ?? throw new ArgumentNullException(nameof(paymentLogger)); }
public ProviderPaymentModelMatcher(Provider provider, IPaymentsDataContext dataContext, TestSession testSession, CollectionPeriod currentCollectionPeriod, List <ProviderPayment> expectedPaymentInfo = null, ContractType contractType = default(ContractType)) { this.provider = provider; this.dataContext = dataContext; this.testSession = testSession; this.currentCollectionPeriod = currentCollectionPeriod; this.expectedPaymentInfo = expectedPaymentInfo; this.contractType = contractType; }
public ProviderAdjustmentRepository( IBulkWriter <ProviderAdjustment> bulkWriter, IPaymentsDataContext dataContext, IPaymentLogger logger, IConfigurationHelper configHelper, IMapper mapper) { this.bulkWriter = bulkWriter; this.dataContext = dataContext; var certificateThumbprint = configHelper.GetSetting("EasCertificateThumbprint"); var handler = new HttpClientHandler(); handler.ClientCertificateOptions = ClientCertificateOption.Manual; handler.ServerCertificateCustomValidationCallback = (httpRequestMessage, certificate, cetChain, policyErrors) => { var thumbprintMatches = certificate.GetCertHashString()?.Equals(certificateThumbprint); if (thumbprintMatches.HasValue && thumbprintMatches.Value) { return(true); } if (policyErrors == SslPolicyErrors.None) { return(true); } return(false); }; client = new HttpClient(handler) { BaseAddress = new Uri(configHelper.GetSetting("EasApiEndpoint")) }; apiClientId = configHelper.GetSetting("EasApiClientId"); apiTenantId = configHelper.GetSetting("EasApiTenantId"); apiScope = configHelper.GetSetting("EasApiScope"); apiPassword = configHelper.GetSetting("EasApiPassword"); pageSize = configHelper.GetSettingOrDefault("EasPageSize", 10000); this.mapper = mapper; this.logger = logger; }
public LearnerDetailsModel(IPaymentsDataContext context) => this.context = context;
public PaymentHistoryRepository(IPaymentsDataContext dataContext) { this.dataContext = dataContext ?? throw new ArgumentNullException(nameof(dataContext)); }
public ApprenticeshipDataService(IPaymentsDataContext paymentsDataContext, ICommitmentsDataContext commitmentsDataContext, ITelemetry telemetry) { this.paymentsDataContext = paymentsDataContext; this.commitmentsDataContext = commitmentsDataContext; this.telemetry = telemetry; }
public ReceivedDataLockEventStore(IPaymentsDataContext context) { this.context = context; }
public LevyFundingSourceRepository(IPaymentsDataContext dataContext) { this.dataContext = dataContext; }
public static async Task UpdateApprenticeship(long apprenticeshipId, ApprenticeshipStatus status, List <ApprenticeshipPriceEpisodeModel> priceEpisodes, IPaymentsDataContext dataContext) { var apprenticeship = await dataContext.Apprenticeship .Include(a => a.ApprenticeshipPriceEpisodes) .FirstOrDefaultAsync(a => a.Id == apprenticeshipId) .ConfigureAwait(false); if (apprenticeship == null) { throw new InvalidOperationException($"Apprenticeship not found: {apprenticeshipId}"); } apprenticeship.Status = status; apprenticeship.ApprenticeshipPriceEpisodes.ForEach(priceEpisode => priceEpisode.Removed = true); apprenticeship.ApprenticeshipPriceEpisodes.AddRange(priceEpisodes); await dataContext.SaveChangesAsync().ConfigureAwait(false); }
public void SetUp() { telemetry = new Mock <ITelemetry>(); commitmentsDataContext = new CommitmentsDataContext(new DbContextOptionsBuilder <CommitmentsDataContext>() .UseInMemoryDatabase(Guid.NewGuid().ToString()) .Options); paymentsDataContext = new PaymentsDataContext(new DbContextOptionsBuilder <PaymentsDataContext>() .UseInMemoryDatabase(Guid.NewGuid().ToString()) .Options); var commitmentsDataContextFactory = new Mock <ICommitmentsDataContextFactory>(); commitmentsDataContextFactory.Setup(c => c.Create()) .Returns(commitmentsDataContext); var paymentsDataContextFactory = new Mock <IPaymentsDataContextFactory>(); paymentsDataContextFactory.Setup(c => c.Create()) .Returns(paymentsDataContext); var dasApprenticeships = new List <ApprenticeshipModel> { new ApprenticeshipModel { IsApproved = true, Commitment = new Commitment { EmployerAndProviderApprovedOn = DateTime.Now, Approvals = 3 } }, new ApprenticeshipModel { IsApproved = false, Commitment = new Commitment { EmployerAndProviderApprovedOn = DateTime.Now, Approvals = 3 } }, //assert we are using the correct new logic based on query in PV2-2215 new ApprenticeshipModel { IsApproved = true, Commitment = new Commitment { EmployerAndProviderApprovedOn = DateTime.Now, Approvals = 7 } }, //assert we include transfers new ApprenticeshipModel { PaymentStatus = PaymentStatus.Withdrawn, StopDate = DateTime.Now, Commitment = new Commitment { EmployerAndProviderApprovedOn = DateTime.Now } }, //expected in stopped count new ApprenticeshipModel { PaymentStatus = PaymentStatus.Withdrawn, StopDate = DateTime.Now, Commitment = new Commitment { EmployerAndProviderApprovedOn = DateTime.Now } }, //expected in stopped count new ApprenticeshipModel { PaymentStatus = PaymentStatus.Withdrawn, StopDate = DateTime.Now.AddDays(10), Commitment = new Commitment { EmployerAndProviderApprovedOn = DateTime.Now } }, //expected in stopped count new ApprenticeshipModel { PaymentStatus = PaymentStatus.Withdrawn, StopDate = DateTime.Now.AddDays(-31), Commitment = new Commitment { EmployerAndProviderApprovedOn = DateTime.Now } }, //not expected in stopped count (stop date too old) new ApprenticeshipModel { PaymentStatus = PaymentStatus.Withdrawn, Commitment = new Commitment { EmployerAndProviderApprovedOn = DateTime.Now } }, //not expected in stopped count (null stop date) new ApprenticeshipModel { PaymentStatus = PaymentStatus.Completed, StopDate = DateTime.Now, Commitment = new Commitment { EmployerAndProviderApprovedOn = DateTime.Now } }, //not expected in stopped count (wrong status even though stop date is now) new ApprenticeshipModel { PaymentStatus = PaymentStatus.Paused, IsApproved = true, PauseDate = DateTime.Now }, new ApprenticeshipModel { PaymentStatus = PaymentStatus.Withdrawn, IsApproved = true, PauseDate = DateTime.Now }, new ApprenticeshipModel { PaymentStatus = PaymentStatus.Paused, IsApproved = false, PauseDate = DateTime.Now }, new ApprenticeshipModel { PaymentStatus = PaymentStatus.Paused, IsApproved = true, PauseDate = DateTime.Now.AddDays(-31) }, }; var paymentsApprenticeships = new List <Model.Core.Entities.ApprenticeshipModel> { new Model.Core.Entities.ApprenticeshipModel { Status = ApprenticeshipStatus.Active, CreationDate = DateTime.Now }, new Model.Core.Entities.ApprenticeshipModel { Status = ApprenticeshipStatus.Active, CreationDate = DateTime.Now }, new Model.Core.Entities.ApprenticeshipModel { CreationDate = DateTime.Now }, //status doesn't matter anymore, assert query mirrors this new Model.Core.Entities.ApprenticeshipModel { Status = ApprenticeshipStatus.Active, CreationDate = DateTime.Now.AddDays(-31) }, new Model.Core.Entities.ApprenticeshipModel { Status = ApprenticeshipStatus.Stopped, StopDate = DateTime.Now }, new Model.Core.Entities.ApprenticeshipModel { Status = ApprenticeshipStatus.Stopped, StopDate = DateTime.Now.AddDays(-31) }, new Model.Core.Entities.ApprenticeshipModel { StopDate = DateTime.Now.AddDays(-31) }, new Model.Core.Entities.ApprenticeshipModel { Status = ApprenticeshipStatus.Paused, ApprenticeshipPauses = new List <ApprenticeshipPauseModel> { new ApprenticeshipPauseModel { PauseDate = DateTime.Now, ResumeDate = null } } }, new Model.Core.Entities.ApprenticeshipModel { Status = ApprenticeshipStatus.Paused, ApprenticeshipPauses = new List <ApprenticeshipPauseModel> { new ApprenticeshipPauseModel { PauseDate = DateTime.Now, ResumeDate = null } } }, new Model.Core.Entities.ApprenticeshipModel { Status = ApprenticeshipStatus.Paused, ApprenticeshipPauses = new List <ApprenticeshipPauseModel> { new ApprenticeshipPauseModel { PauseDate = DateTime.Now, ResumeDate = null } } }, new Model.Core.Entities.ApprenticeshipModel { Status = ApprenticeshipStatus.Paused, CreationDate = DateTime.Now }, new Model.Core.Entities.ApprenticeshipModel { Status = ApprenticeshipStatus.Paused, ApprenticeshipPauses = new List <ApprenticeshipPauseModel> { new ApprenticeshipPauseModel { PauseDate = DateTime.Now, ResumeDate = DateTime.Now } } }, new Model.Core.Entities.ApprenticeshipModel { Status = ApprenticeshipStatus.Paused, ApprenticeshipPauses = new List <ApprenticeshipPauseModel> { new ApprenticeshipPauseModel { PauseDate = DateTime.Now.AddDays(-31), ResumeDate = null } } }, new Model.Core.Entities.ApprenticeshipModel { Status = ApprenticeshipStatus.Inactive, ApprenticeshipPauses = new List <ApprenticeshipPauseModel> { new ApprenticeshipPauseModel { PauseDate = DateTime.Now, ResumeDate = null } } } }; commitmentsDataContext.Apprenticeship.AddRange(dasApprenticeships); commitmentsDataContext.SaveChanges(); paymentsDataContext.Apprenticeship.AddRange(paymentsApprenticeships); paymentsDataContext.SaveChanges(); service = new ApprenticeshipDataService(paymentsDataContextFactory.Object, commitmentsDataContextFactory.Object, telemetry.Object); }
public void SetUp() { telemetry = new Mock <ITelemetry>(); commitmentsDataContext = new CommitmentsDataContext(new DbContextOptionsBuilder <CommitmentsDataContext>() .UseInMemoryDatabase(Guid.NewGuid().ToString()) .Options); paymentsDataContext = new PaymentsDataContext(new DbContextOptionsBuilder <PaymentsDataContext>() .UseInMemoryDatabase(Guid.NewGuid().ToString()) .Options); var dasApprenticeships = new List <ApprenticeshipModel> { new ApprenticeshipModel { IsApproved = true }, new ApprenticeshipModel { PaymentStatus = PaymentStatus.Withdrawn }, new ApprenticeshipModel { PaymentStatus = PaymentStatus.Withdrawn }, new ApprenticeshipModel { PaymentStatus = PaymentStatus.Withdrawn }, new ApprenticeshipModel { PaymentStatus = PaymentStatus.Paused }, new ApprenticeshipModel { PaymentStatus = PaymentStatus.Paused }, }; var paymentsApprenticeships = new List <Model.Core.Entities.ApprenticeshipModel> { new Model.Core.Entities.ApprenticeshipModel { Status = ApprenticeshipStatus.Active }, new Model.Core.Entities.ApprenticeshipModel { Status = ApprenticeshipStatus.Active }, new Model.Core.Entities.ApprenticeshipModel { Status = ApprenticeshipStatus.Active }, new Model.Core.Entities.ApprenticeshipModel { Status = ApprenticeshipStatus.Stopped }, new Model.Core.Entities.ApprenticeshipModel { Status = ApprenticeshipStatus.Paused }, new Model.Core.Entities.ApprenticeshipModel { Status = ApprenticeshipStatus.Paused }, new Model.Core.Entities.ApprenticeshipModel { Status = ApprenticeshipStatus.Paused }, new Model.Core.Entities.ApprenticeshipModel { Status = ApprenticeshipStatus.Paused } }; commitmentsDataContext.Apprenticeship.AddRange(dasApprenticeships); commitmentsDataContext.SaveChanges(); paymentsDataContext.Apprenticeship.AddRange(paymentsApprenticeships); paymentsDataContext.SaveChanges(); service = new ApprenticeshipDataService(paymentsDataContext, commitmentsDataContext, telemetry.Object); }
public DataLockEventRepository(IPaymentsDataContext dataContext) { this.dataContext = dataContext; }
public static async Task AddApprenticeshipDuplicate(ApprenticeshipDuplicateModel apprenticeshipDuplicate, IPaymentsDataContext dataContext) { await dataContext.ApprenticeshipDuplicate.AddAsync(apprenticeshipDuplicate).ConfigureAwait(false); await dataContext.SaveChangesAsync().ConfigureAwait(false); }
public SubmittedLearnerAimRepository(IPaymentsDataContext paymentsDataContext) { this.paymentsDataContext = paymentsDataContext; }
public static async Task AddApprenticeship(ApprenticeshipModel apprenticeship, IPaymentsDataContext dataContext) { await dataContext.Apprenticeship.AddAsync(apprenticeship).ConfigureAwait(false); }
public CurrentPriceEpisodeForJobStore(IPaymentsDataContext paymentsDataContext) { this.paymentsDataContext = paymentsDataContext; }
public ProviderPaymentsRepository(IPaymentsDataContext paymentsDataContext) { this.paymentsDataContext = paymentsDataContext; }
public PaymentsLearnerModel(IPaymentsDataContext context) => this.context = context;
public ApprenticeshipRepository(IPaymentsDataContext dataContext) { this.dataContext = dataContext; }
public StartModel(IPaymentsDataContext context) =>
public DataLockFailureRepository(IPaymentsDataContext paymentsDataContext, IPaymentLogger logger) { this.paymentsDataContext = paymentsDataContext; this.logger = logger; }
public DataLockService(IPaymentsDataContext context) => this.context = context;