コード例 #1
0
        public async Task ShouldCreateNewCareCharge()
        {
            var package = TestDataHelper.CreateCarePackage(packageType: PackageType.ResidentialCare,
                                                           status: PackageStatus.Approved);

            package.Settings = TestDataHelper.CreateCarePackageSettings(carePackageId: package.Id, isS117Client: false);
            package.Details.Add(
                TestDataHelper.CreateCarePackageDetail(package.Id, type: PackageDetailType.CoreCost, cost: 100M));

            package = _generator.CreateCarePackage(package);

            var request = new CareChargesCreationRequest()
            {
                CareCharges = new List <CareChargeReclaimCreationRequest>()
                {
                    new CareChargeReclaimCreationRequest()
                    {
                        Cost           = 12.34m,
                        ClaimCollector = ClaimCollector.Hackney,
                        SubType        = ReclaimSubType.CareCharge1To12Weeks,
                        StartDate      = package.Details.First().StartDate,
                        EndDate        = package.Details.First().StartDate.AddDays(83),
                        Description    = "test",
                        ClaimReason    = "test",
                        CarePackageId  = package.Id
                    }
                }
            };

            var response = await _fixture.RestClient
                           .PutAsync <object>($"api/v1/care-packages/{package.Id}/reclaims/care-charges", request);

            var reclaims = _fixture.DatabaseContext.CarePackageReclaims
                           .Where(r => r.CarePackageId == package.Id).ToList();

            response.Message.StatusCode.Should().Be(HttpStatusCode.OK);
            reclaims.Count.Should().Be(1);
            //reclaims.Should().ContainSingle(r => r.Cost == request.Cost);
        }
コード例 #2
0
 public static CareChargesCreateDomain ToeDomain(this CareChargesCreationRequest input)
 {
     return(_mapper.Map <CareChargesCreateDomain>(input));
 }
        public async Task <ActionResult> UpdateCareChargeReclaims([FromBody] CareChargesCreationRequest careChargesCreationRequest, Guid carePackageId)
        {
            await _upsertCareChargesUseCase.ExecuteAsync(carePackageId, careChargesCreationRequest.ToeDomain());

            return(Ok());
        }