Пример #1
0
        public async Task GetReturnData_GivenReturn_NonObligatedValuesShouldBeRetrieved()
        {
            var returnId = Guid.NewGuid();

            var result = await populatedReturn.GetReturnData(returnId, A.Dummy <bool>());

            A.CallTo(() => fetchNonObligatedWeeeDataAccess.FetchNonObligatedWeeeForReturn(returnId)).MustHaveHappened(Repeated.Exactly.Once);
        }
Пример #2
0
        public async Task <List <decimal?> > HandleAsync(Request message)
        {
            authorization.EnsureCanAccessExternalArea();
            authorization.EnsureOrganisationAccess(message.OrganisationsId);

            return(await dataAccess.FetchNonObligatedWeeeForReturn(message.ReturnId, message.Dcf));
        }
Пример #3
0
        public async Task <ReturnData> GetReturnData(Guid returnId, bool forSummary)
        {
            authorization.EnsureCanAccessExternalArea();

            var @return = await returnDataAccess.GetById(returnId);

            if (@return == null)
            {
                throw new ArgumentException($"No return found for return id {returnId}");
            }

            authorization.EnsureOrganisationAccess(@return.Organisation.Id);

            var annualQuarterWindow = await quarterWindowFactory.GetQuarterWindow(@return.Quarter);

            var returnNonObligatedValues = await nonObligatedDataAccess.FetchNonObligatedWeeeForReturn(returnId);

            var returnObligatedReceivedValues = await obligatedDataAccess.FetchObligatedWeeeReceivedForReturn(returnId);

            var returnObligatedReusedValues = await obligatedDataAccess.FetchObligatedWeeeReusedForReturn(returnId);

            List <Aatf> aatfs;

            if (forSummary && @return.ReturnStatus.Equals(EA.Weee.Domain.AatfReturn.ReturnStatus.Submitted))
            {
                aatfs = await aatfDataAccess.FetchAatfByReturnId(@return.Id);
            }
            else
            {
                aatfs = await aatfDataAccess.FetchAatfByReturnQuarterWindow(@return);
            }

            var sentOn = await obligatedDataAccess.FetchObligatedWeeeSentOnForReturnByReturn(returnId);

            var returnSchemeList = await returnSchemeDataAccess.GetSelectedSchemesByReturnId(returnId);

            var returnReportsOn = await genericDataAccess.GetManyByExpression(new ReturnReportOnByReturnIdSpecification(returnId));

            var currentDate    = SystemTime.Now;
            var systemSettings = await systemDataDataAccess.Get();

            if (systemSettings.UseFixedCurrentDate)
            {
                currentDate = systemSettings.FixedCurrentDate;
            }

            var returnQuarterWindow = new ReturnQuarterWindow(@return,
                                                              annualQuarterWindow,
                                                              aatfs,
                                                              returnNonObligatedValues,
                                                              returnObligatedReceivedValues,
                                                              returnObligatedReusedValues,
                                                              @return.Organisation,
                                                              sentOn,
                                                              returnSchemeList,
                                                              returnReportsOn,
                                                              currentDate);

            return(mapper.Map(returnQuarterWindow));
        }