Example #1
0
        public async Task RemoveCurrentSubmission_CallsDeleteCurrentSubmissionsOnDbContextUsingCorrectParameters()
        {
            var commandJobId     = 10001;
            var collectionPeriod = (byte)1;
            var academicYear     = (short)1920;
            var ukprn            = 10000001L;

            await submissionCleanUpService.RemoveCurrentSubmission(commandJobId, collectionPeriod, academicYear, ukprn);

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

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