Ejemplo n.º 1
0
 internal static Payment New(
     Guid id,
     Account account,
     Guid apprenticeshipIncentiveId,
     Guid pendingPaymentId,
     decimal amount,
     DateTime calculatedDate,
     short paymentYear,
     byte paymentPeriod,
     SubnominalCode subnominalCode
     )
 {
     return(new Payment(new PaymentModel
     {
         Id = id,
         Account = account,
         ApprenticeshipIncentiveId = apprenticeshipIncentiveId,
         PendingPaymentId = pendingPaymentId,
         Amount = amount,
         CalculatedDate = calculatedDate,
         PaymentYear = paymentYear,
         PaymentPeriod = paymentPeriod,
         SubnominalCode = subnominalCode
     },
                        true));
 }
Ejemplo n.º 2
0
 internal static ClawbackPayment New(
     Guid id,
     Account account,
     Guid apprenticeshipIncentiveId,
     Guid pendingPaymentId,
     decimal amount,
     DateTime createdDate,
     SubnominalCode subnominalCode,
     Guid paymentId,
     string vrfVendorId
     )
 {
     return(new ClawbackPayment(new ClawbackPaymentModel
     {
         Id = id,
         Account = account,
         ApprenticeshipIncentiveId = apprenticeshipIncentiveId,
         PendingPaymentId = pendingPaymentId,
         Amount = amount,
         CreatedDate = createdDate,
         SubnominalCode = subnominalCode,
         PaymentId = paymentId,
         VrfVendorId = vrfVendorId
     },
                                true));
 }
Ejemplo n.º 3
0
        public void Then_the_SubnominalCodes_are_mapped_to_ActivityCode(SubnominalCode subnominalCode, string expectedActivityCode)
        {
            var payment = _fixture.Build <PaymentDto>().With(x => x.SubnominalCode, subnominalCode).Create();

            var paymentRequest = payment.Map(false);

            paymentRequest.ActivityCode.Should().Be(expectedActivityCode);
        }
        public void Then_the_SubnominalCodes_are_mapped_to_AccountCode(SubnominalCode subnominalCode, string expectedAccountCode)
        {
            var payment = _fixture.Build <PaymentDto>().With(x => x.SubnominalCode, subnominalCode).Create();

            var paymentRequest = _sut.MapToBusinessCentralPaymentRequest(payment);

            paymentRequest.AccountCode.Should().Be(expectedAccountCode);
        }
Ejemplo n.º 5
0
 private static string MapToActivityCode(SubnominalCode subnominalCode)
 {
     return(subnominalCode switch
     {
         SubnominalCode.Levy16To18 => "100339",
         SubnominalCode.Levy19Plus => "100388",
         SubnominalCode.NonLevy16To18 => "100349",
         SubnominalCode.NonLevy19Plus => "100397",
         _ => throw new InvalidIncentiveException($"No mapping found for SubnominalCode {subnominalCode}")
     });
Ejemplo n.º 6
0
        public void Then_the_payment_is_created(DateTime dob, DateTime plannedStartDate, ApprenticeshipEmployerType employerType, SubnominalCode expectedSubnominalCode)
        {
            // arrange
            var apprenticeship = new Apprenticeship(_fixture.Create <long>(), _fixture.Create <string>(),
                                                    _fixture.Create <string>(), dob, _fixture.Create <long>(), employerType, _fixture.Create <string>(), _fixture.Create <DateTime>());

            _sutModel = _fixture.Build <ApprenticeshipIncentiveModel>()
                        .With(x => x.StartDate, plannedStartDate)
                        .With(x => x.Apprenticeship, apprenticeship)
                        .With(x => x.PaymentModels, new List <PaymentModel>()).Create();

            _sut = Sut(_sutModel);

            var pendingPayment = _sut.PendingPayments.First();

            // act
            _sut.CreatePayment(pendingPayment.Id, _collectionPeriod);

            // assert
            _sut.Payments.Count.Should().Be(1);
            var actualPayment = _sut.Payments.First();

            actualPayment.SubnominalCode.Should().Be(expectedSubnominalCode);
        }