Exemplo n.º 1
0
        public async Task RemovePreviousSubmissions_CallsDeletePreviousSubmissionsOnDbContextUsingCorrectParameters()
        {
            var commandJobId          = 10001;
            var collectionPeriod      = (byte)1;
            var academicYear          = (short)1920;
            var commandSubmissionDate = DateTime.Now;
            var ukprn = 10000001L;


            await submissionCleanUpService.RemovePreviousSubmissions(commandJobId, collectionPeriod, academicYear, commandSubmissionDate, ukprn);

            fundingSourceDataContext.Verify(x => x.DeletePreviousSubmissions(commandJobId, collectionPeriod, academicYear, commandSubmissionDate, ukprn));
        }
        public async Task RemovePreviousSubmissions(SubmissionJobSucceeded message)
        {
            paymentLogger.LogVerbose($"Handling ProcessSubmissionDeletion for {Id}, Job: {message.JobId}");
            try
            {
                using (var operation = telemetry.StartOperation())
                {
                    await submissionCleanUpService.RemovePreviousSubmissions(message.JobId, message.CollectionPeriod,
                                                                             message.AcademicYear, message.IlrSubmissionDateTime, message.Ukprn);

                    telemetry.StopOperation(operation);
                }
            }
            catch (Exception ex)
            {
                paymentLogger.LogError($"Failed to remove previous submission required payments. Error: {ex.Message}",
                                       ex);
                throw;
            }
        }