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));
 }
示例#2
0
 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;
 }
示例#3
0
        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));
 }
示例#5
0
 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;
 }
示例#6
0
        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;
        }
示例#7
0
 public LearnerDetailsModel(IPaymentsDataContext context) =>
 this.context = context;
示例#8
0
 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;
 }
示例#10
0
 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);
        }
示例#13
0
        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);
        }
示例#14
0
        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);
        }
示例#15
0
 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;
 }
示例#20
0
 public ProviderPaymentsRepository(IPaymentsDataContext paymentsDataContext)
 {
     this.paymentsDataContext = paymentsDataContext;
 }
 public PaymentsLearnerModel(IPaymentsDataContext context) =>
 this.context = context;
示例#22
0
 public ApprenticeshipRepository(IPaymentsDataContext dataContext)
 {
     this.dataContext = dataContext;
 }
示例#23
0
 public StartModel(IPaymentsDataContext context) =>
 public DataLockFailureRepository(IPaymentsDataContext paymentsDataContext, IPaymentLogger logger)
 {
     this.paymentsDataContext = paymentsDataContext;
     this.logger = logger;
 }
示例#25
0
 public DataLockService(IPaymentsDataContext context) =>
 this.context = context;