public async Task WhenSubmissionFailedEventForILRSubmittedAtArrives(string p0)
        {
            var submissionFailedEvent = new SubmissionFailedEvent
            {
                AcademicYear          = 1,
                CollectionPeriod      = 1,
                Ukprn                 = TestSession.Ukprn,
                IlrSubmissionDateTime = DateTime.Parse(p0)
            };

            await MessageSession.Send(submissionFailedEvent).ConfigureAwait(false);
        }
        public async Task ProcessSubmissionFailedEvent(SubmissionFailedEvent submissionFailedEvent)
        {
            // flush audit service cache first
            await batchService.StorePayments(CancellationToken.None).ConfigureAwait(false);

            await dataLockEventRepository.DeleteEventsOfSubmission(
                submissionFailedEvent.Ukprn,
                submissionFailedEvent.AcademicYear,
                submissionFailedEvent.CollectionPeriod,
                submissionFailedEvent.IlrSubmissionDateTime
                ).ConfigureAwait(false);
        }
        public void SetUp()
        {
            _proxyFactory = new Mock <IActorProxyFactory>();
            _levyFundingSourceRepository = new Mock <ILevyFundingSourceRepository>();
            _levyMessageRoutingService   = new Mock <ILevyMessageRoutingService>();

            var executionContext = new ESFA.DC.Logging.ExecutionContext();

            _eventHandler = new TestSubmissionEventHandler(_proxyFactory.Object, _levyFundingSourceRepository.Object, Mock.Of <IPaymentLogger>(), executionContext, _levyMessageRoutingService.Object);

            _event = new SubmissionFailedEvent {
                Ukprn = 12344325
            };
        }
Esempio n. 4
0
        public async Task RemoveCurrentSubmission(SubmissionFailedEvent message)
        {
            paymentLogger.LogVerbose($"Handling ProcessCurrentSubmissionDeletionCommand for {Id}, Job: {message.JobId}");
            try
            {
                using (var operation = telemetry.StartOperation())
                {
                    await fundingSourceService.RemoveCurrentSubmission(message.JobId, message.CollectionPeriod, message.AcademicYear, message.IlrSubmissionDateTime, message.Ukprn);

                    telemetry.StopOperation(operation);
                }
            }
            catch (Exception ex)
            {
                paymentLogger.LogError($"Failed to remove current submission required payments. Error: {ex.Message}", ex);
                throw;
            }
        }
Esempio n. 5
0
        public async Task TestCacheFlushedAndEventsDeletedOnFailure()
        {
            var submissionFailedEvent = new SubmissionFailedEvent
            {
                AcademicYear          = 1,
                CollectionPeriod      = 2,
                JobId                 = 3,
                Ukprn                 = 4,
                IlrSubmissionDateTime = DateTime.Now
            };

            batchService.Setup(b => b.StorePayments(It.IsAny <CancellationToken>()))
            .Returns(Task.CompletedTask)
            .Verifiable();

            repositoryMock.Setup(r => r.DeleteEventsOfSubmission(4, 1, 2, submissionFailedEvent.IlrSubmissionDateTime))
            .Returns(Task.CompletedTask)
            .Verifiable();

            await processor.ProcessSubmissionFailedEvent(submissionFailedEvent).ConfigureAwait(false);
        }