diff --git a/TransactionProcessor.Aggregates.Tests/MerchantScheduleAggregateTests.cs b/TransactionProcessor.Aggregates.Tests/MerchantScheduleAggregateTests.cs new file mode 100644 index 00000000..bda41f38 --- /dev/null +++ b/TransactionProcessor.Aggregates.Tests/MerchantScheduleAggregateTests.cs @@ -0,0 +1,140 @@ +using Shared.DomainDrivenDesign.EventSourcing; +using Shouldly; +using SimpleResults; +using System.Reflection; +using TransactionProcessor.DomainEvents; +using TransactionProcessor.Models.MerchantSchedule; + +namespace TransactionProcessor.Aggregates.Tests +{ + public class MerchantScheduleAggregateTests + { + private static readonly Guid MerchantScheduleId = Guid.Parse("11111111-1111-1111-1111-111111111111"); + private static readonly Guid EstateId = Guid.Parse("22222222-2222-2222-2222-222222222222"); + private static readonly Guid MerchantId = Guid.Parse("33333333-3333-3333-3333-333333333333"); + + [Fact] + public void MerchantScheduleAggregate_CanBeCreated_IsCreated() + { + MerchantScheduleAggregate aggregate = MerchantScheduleAggregate.Create(MerchantScheduleId); + + aggregate.AggregateId.ShouldBe(MerchantScheduleId); + aggregate.IsCreated.ShouldBeFalse(); + } + + [Fact] + public void MerchantScheduleAggregate_Create_WithInitialMonths_IsCreated() + { + MerchantScheduleAggregate aggregate = MerchantScheduleAggregate.Create(MerchantScheduleId); + + Result result = aggregate.Create(EstateId, + MerchantId, + 2026, + [ + new MerchantScheduleMonth + { + Month = 1, + ClosedDays = [1, 26] + } + ]); + + result.IsSuccess.ShouldBeTrue(); + aggregate.IsCreated.ShouldBeTrue(); + aggregate.EstateId.ShouldBe(EstateId); + aggregate.MerchantId.ShouldBe(MerchantId); + aggregate.Year.ShouldBe(2026); + + MerchantSchedule model = aggregate.GetSchedule(); + model.Months.ShouldHaveSingleItem(); + model.Months.Single().Month.ShouldBe(1); + model.Months.Single().ClosedDays.ShouldBe([1, 26]); + } + + [Fact] + public void MerchantScheduleAggregate_Create_InvalidYear_ErrorReturned() + { + MerchantScheduleAggregate aggregate = MerchantScheduleAggregate.Create(MerchantScheduleId); + + Result result = aggregate.Create(EstateId, MerchantId, 1899, []); + + result.IsFailed.ShouldBeTrue(); + result.Status.ShouldBe(ResultStatus.Invalid); + result.Message.ShouldBe("A valid year must be provided when creating a merchant schedule"); + } + + [Fact] + public void MerchantScheduleAggregate_SetMonthSchedule_WhenChanged_EmitsMonthEvent() + { + MerchantScheduleAggregate aggregate = MerchantScheduleAggregate.Create(MerchantScheduleId); + aggregate.Create(EstateId, MerchantId, 2026, []); + + Result result = aggregate.SetMonthSchedule(12, [25, 26]); + + result.IsSuccess.ShouldBeTrue(); + + List pendingEvents = GetPendingEvents(aggregate); + pendingEvents.Last().ShouldBeOfType(); + + MerchantScheduleDomainEvents.MerchantScheduleMonthUpdatedEvent updatedEvent = + (MerchantScheduleDomainEvents.MerchantScheduleMonthUpdatedEvent)pendingEvents.Last(); + updatedEvent.Month.ShouldBe(12); + updatedEvent.ClosedDays.ShouldBe([25, 26]); + } + + [Fact] + public void MerchantScheduleAggregate_SetMonthSchedule_SameValue_NoAdditionalEventRaised() + { + MerchantScheduleAggregate aggregate = MerchantScheduleAggregate.Create(MerchantScheduleId); + aggregate.Create(EstateId, MerchantId, 2026, []); + aggregate.SetMonthSchedule(5, [1, 2]); + + List pendingEvents = GetPendingEvents(aggregate); + Int32 originalEventCount = pendingEvents.Count; + + Result result = aggregate.SetMonthSchedule(5, [2, 1]); + + result.IsSuccess.ShouldBeTrue(); + pendingEvents.Count.ShouldBe(originalEventCount); + } + + [Fact] + public void MerchantScheduleAggregate_SetMonthSchedule_InvalidDay_ErrorReturned() + { + MerchantScheduleAggregate aggregate = MerchantScheduleAggregate.Create(MerchantScheduleId); + aggregate.Create(EstateId, MerchantId, 2025, []); + + Result result = aggregate.SetMonthSchedule(2, [29]); + + result.IsFailed.ShouldBeTrue(); + result.Status.ShouldBe(ResultStatus.Invalid); + result.Message.ShouldBe("Only days between 1 and 28 can be supplied for 2025-02"); + } + + [Fact] + public void MerchantScheduleAggregate_UpdateSchedule_DuplicateMonth_ErrorReturned() + { + MerchantScheduleAggregate aggregate = MerchantScheduleAggregate.Create(MerchantScheduleId); + aggregate.Create(EstateId, MerchantId, 2026, []); + + Result result = aggregate.UpdateSchedule([ + new MerchantScheduleMonth { Month = 6, ClosedDays = [1] }, + new MerchantScheduleMonth { Month = 6, ClosedDays = [2] } + ]); + + result.IsFailed.ShouldBeTrue(); + result.Status.ShouldBe(ResultStatus.Invalid); + result.Message.ShouldBe("Each month can only be provided once when updating a merchant schedule"); + } + + private static List GetPendingEvents(MerchantScheduleAggregate aggregate) + { + PropertyInfo property = aggregate.GetType().GetProperty("PendingEvents", BindingFlags.Instance | BindingFlags.NonPublic); + property.ShouldNotBeNull(); + + Object value = property.GetValue(aggregate); + value.ShouldNotBeNull(); + + return (List)value; + } + } +} diff --git a/TransactionProcessor.Aggregates/MerchantScheduleAggregate.cs b/TransactionProcessor.Aggregates/MerchantScheduleAggregate.cs new file mode 100644 index 00000000..39544f90 --- /dev/null +++ b/TransactionProcessor.Aggregates/MerchantScheduleAggregate.cs @@ -0,0 +1,219 @@ +using Shared.DomainDrivenDesign.EventSourcing; +using Shared.EventStore.Aggregate; +using SimpleResults; +using System.Diagnostics.CodeAnalysis; +using TransactionProcessor.DomainEvents; +using MerchantScheduleModel = TransactionProcessor.Models.MerchantSchedule.MerchantSchedule; +using MerchantScheduleMonthModel = TransactionProcessor.Models.MerchantSchedule.MerchantScheduleMonth; + +namespace TransactionProcessor.Aggregates +{ + public static class MerchantScheduleAggregateExtensions + { + public static Result Create(this MerchantScheduleAggregate aggregate, + Guid estateId, + Guid merchantId, + Int32 year, + IEnumerable? months) + { + Result result = ValidateCreateArguments(aggregate, estateId, merchantId, year); + if (result.IsFailed) + return result; + + if (aggregate.IsCreated) + return Result.Success(); + + MerchantScheduleDomainEvents.MerchantScheduleCreatedEvent merchantScheduleCreatedEvent = + new(aggregate.AggregateId, estateId, merchantId, year); + + aggregate.ApplyAndAppend(merchantScheduleCreatedEvent); + + return aggregate.UpdateSchedule(months ?? []); + } + + public static Result UpdateSchedule(this MerchantScheduleAggregate aggregate, + IEnumerable months) + { + Result result = aggregate.EnsureScheduleHasBeenCreated(); + if (result.IsFailed) + return result; + + List monthList = months?.ToList() ?? []; + if (monthList.GroupBy(m => m.Month).Any(g => g.Count() > 1)) + return Result.Invalid("Each month can only be provided once when updating a merchant schedule"); + + foreach (MerchantScheduleMonthModel month in monthList.OrderBy(m => m.Month)) + { + Result monthResult = aggregate.SetMonthSchedule(month.Month, month.ClosedDays); + if (monthResult.IsFailed) + return monthResult; + } + + return Result.Success(); + } + + public static Result SetMonthSchedule(this MerchantScheduleAggregate aggregate, + Int32 month, + IEnumerable? closedDays) + { + Result result = aggregate.EnsureScheduleHasBeenCreated(); + if (result.IsFailed) + return result; + + result = ValidateMonth(aggregate.Year, month, closedDays); + if (result.IsFailed) + return result; + + Int32[] normalisedClosedDays = NormaliseDays(closedDays); + + if (aggregate.Months.TryGetValue(month, out MerchantScheduleMonthModel? existingMonth)) + { + if (existingMonth.ClosedDays.SequenceEqual(normalisedClosedDays)) + return Result.Success(); + } + + MerchantScheduleDomainEvents.MerchantScheduleMonthUpdatedEvent merchantScheduleMonthUpdatedEvent = + new(aggregate.AggregateId, aggregate.EstateId, aggregate.MerchantId, aggregate.Year, month, normalisedClosedDays); + + aggregate.ApplyAndAppend(merchantScheduleMonthUpdatedEvent); + + return Result.Success(); + } + + public static MerchantScheduleModel GetSchedule(this MerchantScheduleAggregate aggregate) + { + MerchantScheduleModel model = new() + { + MerchantScheduleId = aggregate.AggregateId, + EstateId = aggregate.EstateId, + MerchantId = aggregate.MerchantId, + Year = aggregate.Year, + Months = [] + }; + + foreach (MerchantScheduleMonthModel month in aggregate.Months.Values.OrderBy(m => m.Month)) + { + model.Months.Add(new MerchantScheduleMonthModel + { + Month = month.Month, + ClosedDays = [.. month.ClosedDays] + }); + } + + return model; + } + + public static void PlayEvent(this MerchantScheduleAggregate aggregate, + MerchantScheduleDomainEvents.MerchantScheduleCreatedEvent domainEvent) + { + aggregate.EstateId = domainEvent.EstateId; + aggregate.MerchantId = domainEvent.MerchantId; + aggregate.Year = domainEvent.Year; + aggregate.IsCreated = true; + } + + public static void PlayEvent(this MerchantScheduleAggregate aggregate, + MerchantScheduleDomainEvents.MerchantScheduleMonthUpdatedEvent domainEvent) + { + aggregate.Months[domainEvent.Month] = new MerchantScheduleMonthModel + { + Month = domainEvent.Month, + ClosedDays = [.. domainEvent.ClosedDays] + }; + } + + private static Result EnsureScheduleHasBeenCreated(this MerchantScheduleAggregate aggregate) + { + if (aggregate.IsCreated == false) + return Result.Invalid("Merchant schedule has not been created"); + + return Result.Success(); + } + + private static Result ValidateCreateArguments(MerchantScheduleAggregate aggregate, + Guid estateId, + Guid merchantId, + Int32 year) + { + if (aggregate.AggregateId == Guid.Empty) + return Result.Invalid("Merchant schedule id must be provided"); + + if (estateId == Guid.Empty) + return Result.Invalid("Estate id must be provided when creating a merchant schedule"); + + if (merchantId == Guid.Empty) + return Result.Invalid("Merchant id must be provided when creating a merchant schedule"); + + if (year < 1900) + return Result.Invalid("A valid year must be provided when creating a merchant schedule"); + + return Result.Success(); + } + + private static Result ValidateMonth(Int32 year, + Int32 month, + IEnumerable? closedDays) + { + if (month is < 1 or > 12) + return Result.Invalid("A valid month must be provided when updating a merchant schedule"); + + Int32 daysInMonth = DateTime.DaysInMonth(year, month); + Int32[] normalisedClosedDays = NormaliseDays(closedDays); + + if (normalisedClosedDays.Any(day => day < 1 || day > daysInMonth)) + return Result.Invalid($"Only days between 1 and {daysInMonth} can be supplied for {year}-{month:D2}"); + + return Result.Success(); + } + + private static Int32[] NormaliseDays(IEnumerable? days) => + (days ?? []).Distinct().OrderBy(day => day).ToArray(); + } + + public record MerchantScheduleAggregate : Aggregate + { + internal readonly Dictionary Months; + + [ExcludeFromCodeCoverage] + public MerchantScheduleAggregate() + { + this.Months = new Dictionary(); + } + + private MerchantScheduleAggregate(Guid aggregateId) + { + if (aggregateId == Guid.Empty) + throw new ArgumentException("Value cannot be empty.", nameof(aggregateId)); + + this.AggregateId = aggregateId; + this.Months = new Dictionary(); + } + + public Guid EstateId { get; internal set; } + + public Guid MerchantId { get; internal set; } + + public Int32 Year { get; internal set; } + + public Boolean IsCreated { get; internal set; } + + public static MerchantScheduleAggregate Create(Guid aggregateId) + { + return new MerchantScheduleAggregate(aggregateId); + } + + public override void PlayEvent(IDomainEvent domainEvent) => MerchantScheduleAggregateExtensions.PlayEvent(this, (dynamic)domainEvent); + + [ExcludeFromCodeCoverage] + protected override Object GetMetadata() + { + return new + { + MerchantScheduleId = this.AggregateId, + this.EstateId, + this.MerchantId, + this.Year + }; + } + } +} diff --git a/TransactionProcessor.BusinessLogic.Tests/DomainEventHandlers/MerchantScheduleDomainEventHandlerTests.cs b/TransactionProcessor.BusinessLogic.Tests/DomainEventHandlers/MerchantScheduleDomainEventHandlerTests.cs new file mode 100644 index 00000000..17486649 --- /dev/null +++ b/TransactionProcessor.BusinessLogic.Tests/DomainEventHandlers/MerchantScheduleDomainEventHandlerTests.cs @@ -0,0 +1,54 @@ +using System.Threading; +using System.Threading.Tasks; +using Moq; +using Shared.Logger; +using Shouldly; +using SimpleResults; +using TransactionProcessor.BusinessLogic.EventHandling; +using TransactionProcessor.DomainEvents; +using TransactionProcessor.Repository; +using TransactionProcessor.Testing; +using Xunit; + +namespace TransactionProcessor.BusinessLogic.Tests.DomainEventHandlers; + +public class MerchantScheduleDomainEventHandlerTests +{ + private readonly Mock EstateReportingRepository; + private readonly ReadModelDomainEventHandler DomainEventHandler; + + public MerchantScheduleDomainEventHandlerTests() + { + Logger.Initialise(NullLogger.Instance); + this.EstateReportingRepository = new Mock(); + this.DomainEventHandler = new ReadModelDomainEventHandler(this.EstateReportingRepository.Object); + } + + [Fact] + public async Task MerchantScheduleDomainEventHandler_MerchantScheduleCreatedEvent_EventIsHandled() + { + MerchantScheduleDomainEvents.MerchantScheduleCreatedEvent domainEvent = TestData.DomainEvents.MerchantScheduleCreatedEvent; + this.EstateReportingRepository + .Setup(r => r.AddMerchantSchedule(domainEvent, It.IsAny())) + .ReturnsAsync(Result.Success); + + Result result = await this.DomainEventHandler.Handle(domainEvent, CancellationToken.None); + + result.IsSuccess.ShouldBeTrue(); + this.EstateReportingRepository.Verify(r => r.AddMerchantSchedule(domainEvent, It.IsAny()), Times.Once); + } + + [Fact] + public async Task MerchantScheduleDomainEventHandler_MerchantScheduleMonthUpdatedEvent_EventIsHandled() + { + MerchantScheduleDomainEvents.MerchantScheduleMonthUpdatedEvent domainEvent = TestData.DomainEvents.MerchantScheduleMonthUpdatedEvent; + this.EstateReportingRepository + .Setup(r => r.UpdateMerchantSchedule(domainEvent, It.IsAny())) + .ReturnsAsync(Result.Success); + + Result result = await this.DomainEventHandler.Handle(domainEvent, CancellationToken.None); + + result.IsSuccess.ShouldBeTrue(); + this.EstateReportingRepository.Verify(r => r.UpdateMerchantSchedule(domainEvent, It.IsAny()), Times.Once); + } +} diff --git a/TransactionProcessor.BusinessLogic.Tests/Manager/TransactionProcessorManagerTests.cs b/TransactionProcessor.BusinessLogic.Tests/Manager/TransactionProcessorManagerTests.cs index be8af6de..aa537b09 100644 --- a/TransactionProcessor.BusinessLogic.Tests/Manager/TransactionProcessorManagerTests.cs +++ b/TransactionProcessor.BusinessLogic.Tests/Manager/TransactionProcessorManagerTests.cs @@ -14,6 +14,7 @@ using TransactionProcessor.Models.Contract; using TransactionProcessor.Models.Estate; using TransactionProcessor.Models.Merchant; +using MerchantScheduleModel = TransactionProcessor.Models.MerchantSchedule.MerchantSchedule; using TransactionProcessor.Repository; using TransactionProcessor.Testing; using Xunit; @@ -352,6 +353,66 @@ public async Task TransactionProcessorManager_GetMerchant_GetLatestFails_ErrorTh result.IsFailed.ShouldBeTrue(); } + [Fact] + public async Task TransactionProcessorManager_GetMerchantSchedule_MerchantScheduleIsReturned() + { + MerchantScheduleAggregate merchantScheduleAggregate = TestData.Aggregates.CreatedMerchantScheduleAggregate(); + merchantScheduleAggregate.UpdateSchedule(TestData.MerchantModelWithAddressesContactsDevicesAndOperatorsAndContracts().Schedules.Single().Months); + + this.AggregateService + .Setup(m => m.GetLatest(It.IsAny(), It.IsAny())) + .ReturnsAsync(Result.Success(merchantScheduleAggregate)); + + Result result = await this.TransactionProcessorManager.GetMerchantSchedule(TestData.EstateId, TestData.MerchantId, TestData.MerchantScheduleYear, CancellationToken.None); + + result.IsSuccess.ShouldBeTrue(); + result.Data.Year.ShouldBe(TestData.MerchantScheduleYear); + result.Data.Months.ShouldHaveSingleItem(); + result.Data.Months.Single().Month.ShouldBe(1); + result.Data.Months.Single().ClosedDays.ShouldBe([1, 26]); + } + + [Fact] + public async Task TransactionProcessorManager_GetMerchantSchedule_MerchantScheduleNotCreated_ReturnsFailure() + { + this.AggregateService + .Setup(m => m.GetLatest(It.IsAny(), It.IsAny())) + .ReturnsAsync(Result.Success(TestData.Aggregates.EmptyMerchantScheduleAggregate())); + + Result result = await this.TransactionProcessorManager.GetMerchantSchedule(TestData.EstateId, TestData.MerchantId, TestData.MerchantScheduleYear, CancellationToken.None); + + result.IsFailed.ShouldBeTrue(); + } + + [Fact] + public async Task TransactionProcessorManager_GetMerchantScheduleFromReadModel_MerchantScheduleIsReturned() + { + MerchantScheduleModel expectedSchedule = TestData.MerchantModelWithAddressesContactsDevicesAndOperatorsAndContracts().Schedules.Single(); + this.TransactionProcessorReadModelRepository + .Setup(m => m.GetMerchantSchedule(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny())) + .ReturnsAsync(Result.Success(expectedSchedule)); + + Result result = await this.TransactionProcessorManager.GetMerchantScheduleFromReadModel(TestData.EstateId, TestData.MerchantId, TestData.MerchantScheduleYear, CancellationToken.None); + + result.IsSuccess.ShouldBeTrue(); + result.Data.Year.ShouldBe(TestData.MerchantScheduleYear); + result.Data.Months.ShouldHaveSingleItem(); + result.Data.Months.Single().Month.ShouldBe(1); + result.Data.Months.Single().ClosedDays.ShouldBe([1, 26]); + } + + [Fact] + public async Task TransactionProcessorManager_GetMerchantScheduleFromReadModel_MerchantScheduleNotFound_ReturnsFailure() + { + this.TransactionProcessorReadModelRepository + .Setup(m => m.GetMerchantSchedule(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny())) + .ReturnsAsync(Result.Failure()); + + Result result = await this.TransactionProcessorManager.GetMerchantScheduleFromReadModel(TestData.EstateId, TestData.MerchantId, TestData.MerchantScheduleYear, CancellationToken.None); + + result.IsFailed.ShouldBeTrue(); + } + [Fact] public async Task TransactionProcessorManager_GetMerchantContracts_MerchantContractsReturned() { diff --git a/TransactionProcessor.BusinessLogic.Tests/Mediator/DummyEstateManagementManager.cs b/TransactionProcessor.BusinessLogic.Tests/Mediator/DummyEstateManagementManager.cs index 291281ab..4be0f8b8 100644 --- a/TransactionProcessor.BusinessLogic.Tests/Mediator/DummyEstateManagementManager.cs +++ b/TransactionProcessor.BusinessLogic.Tests/Mediator/DummyEstateManagementManager.cs @@ -6,6 +6,7 @@ using TransactionProcessor.BusinessLogic.Manager; using TransactionProcessor.Models.Contract; using TransactionProcessor.Models.Merchant; +using MerchantScheduleModel = TransactionProcessor.Models.MerchantSchedule.MerchantSchedule; using TransactionProcessor.Models.Settlement; using Contract = TransactionProcessor.Models.Contract.Contract; @@ -45,6 +46,20 @@ public async Task> GetMerchant(Guid estateId, return new Result(); } + public async Task> GetMerchantSchedule(Guid estateId, + Guid merchantId, + Int32 year, + CancellationToken cancellationToken) { + return Result.Success(new MerchantScheduleModel()); + } + + public async Task> GetMerchantScheduleFromReadModel(Guid estateId, + Guid merchantId, + Int32 year, + CancellationToken cancellationToken) { + return Result.Success(new MerchantScheduleModel()); + } + public async Task>> GetMerchants(Guid estateId, CancellationToken cancellationToken) { return Result.Success(new List()); @@ -90,4 +105,4 @@ public async Task> GetPendingSettlement(Guid esta CancellationToken cancellationToken) { return Result.Success(new PendingSettlementModel()); } -} \ No newline at end of file +} diff --git a/TransactionProcessor.BusinessLogic.Tests/Mediator/MediatorTests.cs b/TransactionProcessor.BusinessLogic.Tests/Mediator/MediatorTests.cs index 4aac7f83..47766d23 100644 --- a/TransactionProcessor.BusinessLogic.Tests/Mediator/MediatorTests.cs +++ b/TransactionProcessor.BusinessLogic.Tests/Mediator/MediatorTests.cs @@ -87,6 +87,8 @@ public MediatorTests() this.Requests.Add(TestData.Commands.RemoveOperatorFromMerchantCommand); this.Requests.Add(TestData.Commands.RemoveMerchantContractCommand); this.Requests.Add(TestData.Commands.UpdateMerchantOpeningHoursCommand); + this.Requests.Add(TestData.Commands.CreateMerchantScheduleCommand); + this.Requests.Add(TestData.Commands.UpdateMerchantScheduleCommand); this.Requests.Add(TestData.Queries.GetMerchantsQuery); this.Requests.Add(TestData.Queries.GetMerchantQuery); this.Requests.Add(TestData.Queries.GetMerchantContractsQuery); diff --git a/TransactionProcessor.BusinessLogic.Tests/Services/MerchantDomainServiceTests.cs b/TransactionProcessor.BusinessLogic.Tests/Services/MerchantDomainServiceTests.cs index e4deb3c0..abdea891 100644 --- a/TransactionProcessor.BusinessLogic.Tests/Services/MerchantDomainServiceTests.cs +++ b/TransactionProcessor.BusinessLogic.Tests/Services/MerchantDomainServiceTests.cs @@ -13,6 +13,7 @@ using SimpleResults; using System; using System.Collections.Generic; +using System.Linq; using System.Threading; using System.Threading.Tasks; using TransactionProcessor.Aggregates; @@ -635,6 +636,190 @@ public async Task MerchantDomainService_UpdateMerchantOpeningHours_EstateNotCrea result.IsFailed.ShouldBeTrue(); } + [Fact] + public async Task MerchantDomainService_CreateMerchantSchedule_Success() + { + this.AggregateService.Setup(e => e.Get(It.IsAny(), It.IsAny())) + .ReturnsAsync(TestData.Aggregates.CreatedEstateAggregate()); + + this.AggregateService.Setup(m => m.GetLatest(It.IsAny(), It.IsAny())) + .ReturnsAsync(Result.Success(TestData.Aggregates.CreatedMerchantAggregate())); + + this.AggregateService.Setup(m => m.GetLatest(It.IsAny(), It.IsAny())) + .ReturnsAsync(Result.Success(TestData.Aggregates.EmptyMerchantScheduleAggregate())); + + this.AggregateService + .Setup(m => m.Save(It.IsAny(), It.IsAny())) + .ReturnsAsync(Result.Success); + + var result = await this.DomainService.CreateMerchantSchedule(TestData.Commands.CreateMerchantScheduleCommand, CancellationToken.None); + + result.IsSuccess.ShouldBeTrue(); + this.AggregateService.Verify(m => m.Save(It.Is(aggregate => + aggregate.IsCreated && + aggregate.Year == TestData.MerchantScheduleYear && + aggregate.GetSchedule().Months.Single().Month == 1 && + aggregate.GetSchedule().Months.Single().ClosedDays.SequenceEqual(new[] { 1, 26 })), It.IsAny()), Times.Once); + } + + [Fact] + public async Task MerchantDomainService_CreateMerchantSchedule_GetEstateFailed_ResultIsFailed() + { + this.AggregateService.Setup(e => e.Get(It.IsAny(), It.IsAny())) + .ReturnsAsync(Result.Failure()); + + var result = await this.DomainService.CreateMerchantSchedule(TestData.Commands.CreateMerchantScheduleCommand, CancellationToken.None); + + result.IsFailed.ShouldBeTrue(); + } + + [Fact] + public async Task MerchantDomainService_CreateMerchantSchedule_GetMerchantFailed_ResultIsFailed() + { + this.AggregateService.Setup(e => e.Get(It.IsAny(), It.IsAny())) + .ReturnsAsync(TestData.Aggregates.CreatedEstateAggregate()); + this.AggregateService.Setup(m => m.GetLatest(It.IsAny(), It.IsAny())) + .ReturnsAsync(Result.Failure()); + + var result = await this.DomainService.CreateMerchantSchedule(TestData.Commands.CreateMerchantScheduleCommand, CancellationToken.None); + + result.IsFailed.ShouldBeTrue(); + } + + [Fact] + public async Task MerchantDomainService_CreateMerchantSchedule_GetScheduleFailed_ResultIsFailed() + { + this.AggregateService.Setup(e => e.Get(It.IsAny(), It.IsAny())) + .ReturnsAsync(TestData.Aggregates.CreatedEstateAggregate()); + this.AggregateService.Setup(m => m.GetLatest(It.IsAny(), It.IsAny())) + .ReturnsAsync(Result.Success(TestData.Aggregates.CreatedMerchantAggregate())); + this.AggregateService.Setup(m => m.GetLatest(It.IsAny(), It.IsAny())) + .ReturnsAsync(Result.Failure()); + + var result = await this.DomainService.CreateMerchantSchedule(TestData.Commands.CreateMerchantScheduleCommand, CancellationToken.None); + + result.IsFailed.ShouldBeTrue(); + } + + [Fact] + public async Task MerchantDomainService_CreateMerchantSchedule_SaveFailed_ResultIsFailed() + { + this.AggregateService.Setup(e => e.Get(It.IsAny(), It.IsAny())) + .ReturnsAsync(TestData.Aggregates.CreatedEstateAggregate()); + + this.AggregateService.Setup(m => m.GetLatest(It.IsAny(), It.IsAny())) + .ReturnsAsync(Result.Success(TestData.Aggregates.CreatedMerchantAggregate())); + + this.AggregateService.Setup(m => m.GetLatest(It.IsAny(), It.IsAny())) + .ReturnsAsync(Result.Success(TestData.Aggregates.EmptyMerchantScheduleAggregate())); + + this.AggregateService + .Setup(m => m.Save(It.IsAny(), It.IsAny())) + .ReturnsAsync(Result.Failure()); + + var result = await this.DomainService.CreateMerchantSchedule(TestData.Commands.CreateMerchantScheduleCommand, CancellationToken.None); + + result.IsFailed.ShouldBeTrue(); + } + + [Fact] + public async Task MerchantDomainService_UpdateMerchantSchedule_Success() + { + this.AggregateService.Setup(e => e.Get(It.IsAny(), It.IsAny())) + .ReturnsAsync(TestData.Aggregates.CreatedEstateAggregate()); + + this.AggregateService.Setup(m => m.GetLatest(It.IsAny(), It.IsAny())) + .ReturnsAsync(Result.Success(TestData.Aggregates.CreatedMerchantAggregate())); + + this.AggregateService.Setup(m => m.GetLatest(It.IsAny(), It.IsAny())) + .ReturnsAsync(Result.Success(TestData.Aggregates.CreatedMerchantScheduleAggregate())); + + this.AggregateService + .Setup(m => m.Save(It.IsAny(), It.IsAny())) + .ReturnsAsync(Result.Success); + + var result = await this.DomainService.UpdateMerchantSchedule(TestData.Commands.UpdateMerchantScheduleCommand, CancellationToken.None); + + result.IsSuccess.ShouldBeTrue(); + this.AggregateService.Verify(m => m.Save(It.Is(aggregate => + aggregate.GetSchedule().Months.Any(month => month.Month == 2 && month.ClosedDays.SequenceEqual(new[] { 14 }))), It.IsAny()), Times.Once); + } + + [Fact] + public async Task MerchantDomainService_UpdateMerchantSchedule_GetEstateFailed_ResultIsFailed() + { + this.AggregateService.Setup(e => e.Get(It.IsAny(), It.IsAny())) + .ReturnsAsync(Result.Failure()); + + var result = await this.DomainService.UpdateMerchantSchedule(TestData.Commands.UpdateMerchantScheduleCommand, CancellationToken.None); + + result.IsFailed.ShouldBeTrue(); + } + + [Fact] + public async Task MerchantDomainService_UpdateMerchantSchedule_GetMerchantFailed_ResultIsFailed() + { + this.AggregateService.Setup(e => e.Get(It.IsAny(), It.IsAny())) + .ReturnsAsync(TestData.Aggregates.CreatedEstateAggregate()); + this.AggregateService.Setup(m => m.GetLatest(It.IsAny(), It.IsAny())) + .ReturnsAsync(Result.Failure()); + + var result = await this.DomainService.UpdateMerchantSchedule(TestData.Commands.UpdateMerchantScheduleCommand, CancellationToken.None); + + result.IsFailed.ShouldBeTrue(); + } + + [Fact] + public async Task MerchantDomainService_UpdateMerchantSchedule_GetScheduleFailed_ResultIsFailed() + { + this.AggregateService.Setup(e => e.Get(It.IsAny(), It.IsAny())) + .ReturnsAsync(TestData.Aggregates.CreatedEstateAggregate()); + this.AggregateService.Setup(m => m.GetLatest(It.IsAny(), It.IsAny())) + .ReturnsAsync(Result.Success(TestData.Aggregates.CreatedMerchantAggregate())); + this.AggregateService.Setup(m => m.GetLatest(It.IsAny(), It.IsAny())) + .ReturnsAsync(Result.Failure()); + + var result = await this.DomainService.UpdateMerchantSchedule(TestData.Commands.UpdateMerchantScheduleCommand, CancellationToken.None); + + result.IsFailed.ShouldBeTrue(); + } + + [Fact] + public async Task MerchantDomainService_UpdateMerchantSchedule_ScheduleNotCreated_ResultIsFailed() + { + this.AggregateService.Setup(e => e.Get(It.IsAny(), It.IsAny())) + .ReturnsAsync(TestData.Aggregates.CreatedEstateAggregate()); + this.AggregateService.Setup(m => m.GetLatest(It.IsAny(), It.IsAny())) + .ReturnsAsync(Result.Success(TestData.Aggregates.CreatedMerchantAggregate())); + this.AggregateService.Setup(m => m.GetLatest(It.IsAny(), It.IsAny())) + .ReturnsAsync(Result.Success(TestData.Aggregates.EmptyMerchantScheduleAggregate())); + + var result = await this.DomainService.UpdateMerchantSchedule(TestData.Commands.UpdateMerchantScheduleCommand, CancellationToken.None); + + result.IsFailed.ShouldBeTrue(); + } + + [Fact] + public async Task MerchantDomainService_UpdateMerchantSchedule_SaveFailed_ResultIsFailed() + { + this.AggregateService.Setup(e => e.Get(It.IsAny(), It.IsAny())) + .ReturnsAsync(TestData.Aggregates.CreatedEstateAggregate()); + + this.AggregateService.Setup(m => m.GetLatest(It.IsAny(), It.IsAny())) + .ReturnsAsync(Result.Success(TestData.Aggregates.CreatedMerchantAggregate())); + + this.AggregateService.Setup(m => m.GetLatest(It.IsAny(), It.IsAny())) + .ReturnsAsync(Result.Success(TestData.Aggregates.CreatedMerchantScheduleAggregate())); + + this.AggregateService + .Setup(m => m.Save(It.IsAny(), It.IsAny())) + .ReturnsAsync(Result.Failure()); + + var result = await this.DomainService.UpdateMerchantSchedule(TestData.Commands.UpdateMerchantScheduleCommand, CancellationToken.None); + + result.IsFailed.ShouldBeTrue(); + } + [Fact] public async Task MerchantDomainService_MakeMerchantWithdrawal_WithdrawalIsMade() { this.AggregateService.Setup(e => e.Get(It.IsAny(), It.IsAny())) diff --git a/TransactionProcessor.BusinessLogic/EventHandling/ReadModelDomainEventHandler.cs b/TransactionProcessor.BusinessLogic/EventHandling/ReadModelDomainEventHandler.cs index 3017e364..d821e53e 100644 --- a/TransactionProcessor.BusinessLogic/EventHandling/ReadModelDomainEventHandler.cs +++ b/TransactionProcessor.BusinessLogic/EventHandling/ReadModelDomainEventHandler.cs @@ -63,6 +63,8 @@ public async Task Handle(IDomainEvent domainEvent, MerchantDomainEvents.MerchantContactEmailAddressUpdatedEvent de => this.EstateReportingRepository.UpdateMerchantContact(de, cancellationToken), MerchantDomainEvents.MerchantContactPhoneNumberUpdatedEvent de => this.EstateReportingRepository.UpdateMerchantContact(de, cancellationToken), MerchantDomainEvents.MerchantOpeningHoursUpdatedEvent de => this.EstateReportingRepository.UpdateMerchantOpeningHours(de, cancellationToken), + MerchantScheduleDomainEvents.MerchantScheduleCreatedEvent de => this.EstateReportingRepository.AddMerchantSchedule(de, cancellationToken), + MerchantScheduleDomainEvents.MerchantScheduleMonthUpdatedEvent de => this.EstateReportingRepository.UpdateMerchantSchedule(de, cancellationToken), TransactionDomainEvents.TransactionHasStartedEvent de => this.EstateReportingRepository.StartTransaction(de, cancellationToken), TransactionDomainEvents.AdditionalRequestDataRecordedEvent de => this.HandleSpecificDomainEvent(de, cancellationToken), diff --git a/TransactionProcessor.BusinessLogic/Manager/ITransactionProcessorManager.cs b/TransactionProcessor.BusinessLogic/Manager/ITransactionProcessorManager.cs index a9048660..e89d9f15 100644 --- a/TransactionProcessor.BusinessLogic/Manager/ITransactionProcessorManager.cs +++ b/TransactionProcessor.BusinessLogic/Manager/ITransactionProcessorManager.cs @@ -5,6 +5,7 @@ using SimpleResults; using TransactionProcessor.Models.Contract; using TransactionProcessor.Models.Merchant; +using MerchantScheduleModel = TransactionProcessor.Models.MerchantSchedule.MerchantSchedule; using TransactionProcessor.Models.Settlement; using Contract = TransactionProcessor.Models.Contract.Contract; @@ -32,7 +33,17 @@ Task> GetContract(Guid estateId, CancellationToken cancellationToken); Task> GetMerchant(Guid estateId, Guid merchantId, - CancellationToken cancellationToken); + CancellationToken cancellationToken); + + Task> GetMerchantSchedule(Guid estateId, + Guid merchantId, + Int32 year, + CancellationToken cancellationToken); + + Task> GetMerchantScheduleFromReadModel(Guid estateId, + Guid merchantId, + Int32 year, + CancellationToken cancellationToken); Task>> GetMerchants(Guid estateId, CancellationToken cancellationToken); @@ -64,4 +75,4 @@ Task> GetPendingSettlement(Guid estateId, #endregion } -} \ No newline at end of file +} diff --git a/TransactionProcessor.BusinessLogic/Manager/TransactionProcessorManager.cs b/TransactionProcessor.BusinessLogic/Manager/TransactionProcessorManager.cs index 6b7851f4..d8a1785e 100644 --- a/TransactionProcessor.BusinessLogic/Manager/TransactionProcessorManager.cs +++ b/TransactionProcessor.BusinessLogic/Manager/TransactionProcessorManager.cs @@ -12,6 +12,7 @@ using TransactionProcessor.BusinessLogic.Services; using TransactionProcessor.Models.Contract; using TransactionProcessor.Models.Merchant; +using MerchantScheduleModel = TransactionProcessor.Models.MerchantSchedule.MerchantSchedule; using TransactionProcessor.Models.Settlement; using TransactionProcessor.Repository; using static TransactionProcessor.BusinessLogic.Requests.SettlementQueries; @@ -154,9 +155,44 @@ public async Task> GetMerchant(Guid estateId, return Result.Success(merchantModel); } + public async Task> GetMerchantSchedule(Guid estateId, + Guid merchantId, + Int32 year, + CancellationToken cancellationToken) + { + return await AsyncExecutor.ExecuteSafeAsync(async ct => { + Guid merchantScheduleId = IdGenerationService.GenerateMerchantScheduleAggregateId(estateId, merchantId, year); + Result getMerchantScheduleResult = await this.AggregateService.GetLatest(merchantScheduleId, ct); + if (getMerchantScheduleResult.IsFailed) + return ResultHelpers.CreateFailure(getMerchantScheduleResult); + + MerchantScheduleAggregate merchantScheduleAggregate = getMerchantScheduleResult.Data; + if (merchantScheduleAggregate.IsCreated == false) + return Result.NotFound($"No merchant schedule found for Merchant [{merchantId}] in Year [{year}]"); + + MerchantScheduleModel merchantScheduleModel = merchantScheduleAggregate.GetSchedule(); + + return Result.Success(merchantScheduleModel); + }, cancellationToken); + } + + public async Task> GetMerchantScheduleFromReadModel(Guid estateId, + Guid merchantId, + Int32 year, + CancellationToken cancellationToken) + { + return await AsyncExecutor.ExecuteSafeAsync(async ct => { + Result getMerchantScheduleResult = await this.TransactionProcessorReadModelRepository.GetMerchantSchedule(estateId, merchantId, year, ct); + if (getMerchantScheduleResult.IsFailed) + return ResultHelpers.CreateFailure(getMerchantScheduleResult); + + return Result.Success(getMerchantScheduleResult.Data); + }, cancellationToken); + } + public async Task>> GetMerchantContracts(Guid estateId, - Guid merchantId, - CancellationToken cancellationToken) + Guid merchantId, + CancellationToken cancellationToken) { return await AsyncExecutor.ExecuteSafeAsync(async ct => { Result> getMerchantContractsResult = await this.TransactionProcessorReadModelRepository.GetMerchantContracts(estateId, merchantId, ct); @@ -291,4 +327,4 @@ public async Task> GetPendingSettlement(Guid esta #endregion } -} \ No newline at end of file +} diff --git a/TransactionProcessor.BusinessLogic/RequestHandlers/MerchantRequestHandler.cs b/TransactionProcessor.BusinessLogic/RequestHandlers/MerchantRequestHandler.cs index 620f2ca4..a7337110 100644 --- a/TransactionProcessor.BusinessLogic/RequestHandlers/MerchantRequestHandler.cs +++ b/TransactionProcessor.BusinessLogic/RequestHandlers/MerchantRequestHandler.cs @@ -14,6 +14,7 @@ using TransactionProcessor.ProjectionEngine.Repository; using TransactionProcessor.ProjectionEngine.State; using Merchant = TransactionProcessor.Models.Merchant.Merchant; +using MerchantScheduleModel = TransactionProcessor.Models.MerchantSchedule.MerchantSchedule; namespace TransactionProcessor.BusinessLogic.RequestHandlers; @@ -29,6 +30,8 @@ public class MerchantRequestHandler : IRequestHandler, IRequestHandler, IRequestHandler>, + IRequestHandler>, + IRequestHandler>, IRequestHandler>>, IRequestHandler>>, IRequestHandler>>, @@ -36,10 +39,12 @@ public class MerchantRequestHandler : IRequestHandler, IRequestHandler, IRequestHandler, - IRequestHandler, - IRequestHandler, - IRequestHandler, - IRequestHandler + IRequestHandler, + IRequestHandler, + IRequestHandler, + IRequestHandler, + IRequestHandler, + IRequestHandler { private readonly IProjectionStateRepository MerchantBalanceStateRepository; private readonly IEventStoreContext EventStoreContext; @@ -133,6 +138,16 @@ public async Task Handle(MerchantCommands.CreateMerchantCommand command, return await this.TransactionProcessorManager.GetMerchant(query.EstateId, query.MerchantId, cancellationToken); } + public async Task> Handle(MerchantQueries.GetMerchantScheduleQuery query, CancellationToken cancellationToken) + { + return await this.TransactionProcessorManager.GetMerchantSchedule(query.EstateId, query.MerchantId, query.Year, cancellationToken); + } + + public async Task> Handle(MerchantQueries.GetMerchantScheduleFromReadModelQuery query, CancellationToken cancellationToken) + { + return await this.TransactionProcessorManager.GetMerchantScheduleFromReadModel(query.EstateId, query.MerchantId, query.Year, cancellationToken); + } + public async Task>> Handle(MerchantQueries.GetMerchantContractsQuery query, CancellationToken cancellationToken) { return await this.TransactionProcessorManager.GetMerchantContracts(query.EstateId, query.MerchantId, cancellationToken); @@ -184,7 +199,17 @@ public async Task Handle(MerchantCommands.RemoveMerchantContractCommand } public async Task Handle(MerchantCommands.UpdateMerchantOpeningHoursCommand command, - CancellationToken cancellationToken) { + CancellationToken cancellationToken) { return await this.MerchantDomainService.UpdateMerchantOpeningHours(command, cancellationToken); } -} \ No newline at end of file + + public async Task Handle(MerchantCommands.CreateMerchantScheduleCommand command, + CancellationToken cancellationToken) { + return await this.MerchantDomainService.CreateMerchantSchedule(command, cancellationToken); + } + + public async Task Handle(MerchantCommands.UpdateMerchantScheduleCommand command, + CancellationToken cancellationToken) { + return await this.MerchantDomainService.UpdateMerchantSchedule(command, cancellationToken); + } +} diff --git a/TransactionProcessor.BusinessLogic/Requests/MerchantCommands.cs b/TransactionProcessor.BusinessLogic/Requests/MerchantCommands.cs index dc87959c..47d24890 100644 --- a/TransactionProcessor.BusinessLogic/Requests/MerchantCommands.cs +++ b/TransactionProcessor.BusinessLogic/Requests/MerchantCommands.cs @@ -3,6 +3,7 @@ using MediatR; using SimpleResults; using TransactionProcessor.DataTransferObjects.Requests.Merchant; +using TransactionProcessor.DataTransferObjects.Requests.MerchantSchedule; namespace TransactionProcessor.BusinessLogic.Requests { @@ -41,7 +42,11 @@ public record AddMerchantContactCommand(Guid EstateId, Guid MerchantId, Contact public record UpdateMerchantContactCommand(Guid EstateId, Guid MerchantId, Guid ContactId, Contact RequestDto) : IRequest; public record UpdateMerchantOpeningHoursCommand(Guid EstateId, Guid MerchantId, MerchantOpeningRequest RequestDto) : IRequest; + + public record CreateMerchantScheduleCommand(Guid EstateId, Guid MerchantId, CreateMerchantScheduleRequest RequestDto) : IRequest; + + public record UpdateMerchantScheduleCommand(Guid EstateId, Guid MerchantId, Int32 Year, UpdateMerchantScheduleRequest RequestDto) : IRequest; } -} \ No newline at end of file +} diff --git a/TransactionProcessor.BusinessLogic/Requests/MerchantQueries.cs b/TransactionProcessor.BusinessLogic/Requests/MerchantQueries.cs index cca79389..c63d37fc 100644 --- a/TransactionProcessor.BusinessLogic/Requests/MerchantQueries.cs +++ b/TransactionProcessor.BusinessLogic/Requests/MerchantQueries.cs @@ -4,6 +4,7 @@ using MediatR; using SimpleResults; using TransactionProcessor.Models.Contract; +using MerchantScheduleModel = TransactionProcessor.Models.MerchantSchedule.MerchantSchedule; using TransactionProcessor.ProjectionEngine.Models; using TransactionProcessor.ProjectionEngine.State; @@ -19,10 +20,14 @@ public record GetMerchantBalanceHistoryQuery(Guid EstateId, Guid MerchantId, Dat public record GetMerchantQuery(Guid EstateId, Guid MerchantId) : IRequest>; + public record GetMerchantScheduleQuery(Guid EstateId, Guid MerchantId, Int32 Year) : IRequest>; + + public record GetMerchantScheduleFromReadModelQuery(Guid EstateId, Guid MerchantId, Int32 Year) : IRequest>; + public record GetMerchantContractsQuery(Guid EstateId, Guid MerchantId) : IRequest>>; public record GetMerchantsQuery(Guid EstateId) : IRequest>>; public record GetTransactionFeesForProductQuery(Guid EstateId, Guid MerchantId, Guid ContractId, Guid ProductId) : IRequest>>; -} \ No newline at end of file +} diff --git a/TransactionProcessor.BusinessLogic/Services/IdGenerationService.cs b/TransactionProcessor.BusinessLogic/Services/IdGenerationService.cs index 43c8d261..5689705d 100644 --- a/TransactionProcessor.BusinessLogic/Services/IdGenerationService.cs +++ b/TransactionProcessor.BusinessLogic/Services/IdGenerationService.cs @@ -69,5 +69,13 @@ public static Guid GenerateMerchantStatementAggregateId(Guid estateId, Guid merc merchantId, nextStatementDate = nextStatementDateTime.Date }); + + public static Guid GenerateMerchantScheduleAggregateId(Guid estateId, Guid merchantId, Int32 year) => + IdGenerationService.GenerateUniqueId(new + { + estateId, + merchantId, + year + }); } } diff --git a/TransactionProcessor.BusinessLogic/Services/MerchantDomainService.cs b/TransactionProcessor.BusinessLogic/Services/MerchantDomainService.cs index 05af9ff7..5b3f03f2 100644 --- a/TransactionProcessor.BusinessLogic/Services/MerchantDomainService.cs +++ b/TransactionProcessor.BusinessLogic/Services/MerchantDomainService.cs @@ -20,8 +20,10 @@ using TransactionProcessor.Database.Entities; using TransactionProcessor.Models.Estate; using TransactionProcessor.Models.Merchant; +using TransactionProcessor.Models.MerchantSchedule; using TransactionProcessor.ProjectionEngine.State; using Estate = TransactionProcessor.Models.Estate.Estate; +using MerchantScheduleMonth = TransactionProcessor.Models.MerchantSchedule.MerchantScheduleMonth; namespace TransactionProcessor.BusinessLogic.Services { @@ -44,6 +46,8 @@ public interface IMerchantDomainService Task RemoveOperatorFromMerchant(MerchantCommands.RemoveOperatorFromMerchantCommand command, CancellationToken cancellationToken); Task RemoveContractFromMerchant(MerchantCommands.RemoveMerchantContractCommand command, CancellationToken cancellationToken); Task UpdateMerchantOpeningHours(MerchantCommands.UpdateMerchantOpeningHoursCommand command, CancellationToken cancellationToken); + Task CreateMerchantSchedule(MerchantCommands.CreateMerchantScheduleCommand command, CancellationToken cancellationToken); + Task UpdateMerchantSchedule(MerchantCommands.UpdateMerchantScheduleCommand command, CancellationToken cancellationToken); #endregion } @@ -707,7 +711,7 @@ public async Task RemoveContractFromMerchant(MerchantCommands.RemoveMerc } public async Task UpdateMerchantOpeningHours(MerchantCommands.UpdateMerchantOpeningHoursCommand command, - CancellationToken cancellationToken) { + CancellationToken cancellationToken) { try { Result estateResult = await DomainServiceHelper.GetAggregateOrFailure(ct => this.AggregateService.Get(command.EstateId, ct), command.EstateId, cancellationToken); @@ -754,6 +758,85 @@ public async Task UpdateMerchantOpeningHours(MerchantCommands.UpdateMerc } } + public async Task CreateMerchantSchedule(MerchantCommands.CreateMerchantScheduleCommand command, + CancellationToken cancellationToken) { + try { + Result estateResult = await DomainServiceHelper.GetAggregateOrFailure(ct => this.AggregateService.Get(command.EstateId, ct), command.EstateId, cancellationToken); + if (estateResult.IsFailed) + return ResultHelpers.CreateFailure(estateResult); + + Result merchantResult = await DomainServiceHelper.GetAggregateOrFailure(ct => this.AggregateService.GetLatest(command.MerchantId, ct), command.MerchantId, cancellationToken); + if (merchantResult.IsFailed) + return ResultHelpers.CreateFailure(merchantResult); + + EstateAggregate estateAggregate = estateResult.Data; + MerchantAggregate merchantAggregate = merchantResult.Data; + + Result result = this.ValidateEstateAndMerchant(estateAggregate, merchantAggregate); + if (result.IsFailed) + return ResultHelpers.CreateFailure(result); + + Guid merchantScheduleId = IdGenerationService.GenerateMerchantScheduleAggregateId(command.EstateId, command.MerchantId, command.RequestDto.Year); + Result merchantScheduleResult = await DomainServiceHelper.GetAggregateOrFailure(ct => this.AggregateService.GetLatest(merchantScheduleId, ct), merchantScheduleId, cancellationToken, false); + if (merchantScheduleResult.IsFailed) + return ResultHelpers.CreateFailure(merchantScheduleResult); + + MerchantScheduleAggregate merchantScheduleAggregate = merchantScheduleResult.Data; + Result stateResult = merchantScheduleAggregate.Create(command.EstateId, command.MerchantId, command.RequestDto.Year, ConvertScheduleMonths(command.RequestDto.Months)); + if (stateResult.IsFailed) + return stateResult; + + Result saveResult = await this.AggregateService.Save(merchantScheduleAggregate, cancellationToken); + if (saveResult.IsFailed) + return ResultHelpers.CreateFailure(saveResult); + + return saveResult; + } + catch (Exception ex) { + return Result.Failure(ex.GetExceptionMessages()); + } + } + + public async Task UpdateMerchantSchedule(MerchantCommands.UpdateMerchantScheduleCommand command, + CancellationToken cancellationToken) { + try { + Result estateResult = await DomainServiceHelper.GetAggregateOrFailure(ct => this.AggregateService.Get(command.EstateId, ct), command.EstateId, cancellationToken); + if (estateResult.IsFailed) + return ResultHelpers.CreateFailure(estateResult); + + Result merchantResult = await DomainServiceHelper.GetAggregateOrFailure(ct => this.AggregateService.GetLatest(command.MerchantId, ct), command.MerchantId, cancellationToken); + if (merchantResult.IsFailed) + return ResultHelpers.CreateFailure(merchantResult); + + EstateAggregate estateAggregate = estateResult.Data; + MerchantAggregate merchantAggregate = merchantResult.Data; + + Result result = this.ValidateEstateAndMerchant(estateAggregate, merchantAggregate); + if (result.IsFailed) + return ResultHelpers.CreateFailure(result); + + Guid merchantScheduleId = IdGenerationService.GenerateMerchantScheduleAggregateId(command.EstateId, command.MerchantId, command.Year); + Result merchantScheduleResult = await DomainServiceHelper.GetAggregateOrFailure(ct => this.AggregateService.GetLatest(merchantScheduleId, ct), merchantScheduleId, cancellationToken, false); + if (merchantScheduleResult.IsFailed) + return ResultHelpers.CreateFailure(merchantScheduleResult); + + MerchantScheduleAggregate merchantScheduleAggregate = merchantScheduleResult.Data; + + Result stateResult = merchantScheduleAggregate.UpdateSchedule(ConvertScheduleMonths(command.RequestDto.Months)); + if (stateResult.IsFailed) + return stateResult; + + Result saveResult = await this.AggregateService.Save(merchantScheduleAggregate, cancellationToken); + if (saveResult.IsFailed) + return ResultHelpers.CreateFailure(saveResult); + + return saveResult; + } + catch (Exception ex) { + return Result.Failure(ex.GetExceptionMessages()); + } + } + private Result ApplyOpeningHoursIfPresent(MerchantAggregate merchantAggregate, DayOfWeek day, TransactionProcessor.DataTransferObjects.Requests.Merchant.OpeningHours hours) { if (hours == null) @@ -778,8 +861,15 @@ private Result ValidateEstateAndMerchant(EstateAggregate estateAggregate, return Result.Success(); } + private static List ConvertScheduleMonths(IEnumerable months) => + months?.Select(month => new MerchantScheduleMonth + { + Month = month.Month, + ClosedDays = month.ClosedDays ?? [] + }).ToList() ?? []; + private async Task> GetCreatedContract(Guid contractId, - CancellationToken cancellationToken) + CancellationToken cancellationToken) { Result contractResult = await this.AggregateService.Get(contractId, cancellationToken); if (contractResult.IsFailed) diff --git a/TransactionProcessor.Client/ITransactionProcessorClient.cs b/TransactionProcessor.Client/ITransactionProcessorClient.cs index 56bbfdbf..4cea6fd8 100644 --- a/TransactionProcessor.Client/ITransactionProcessorClient.cs +++ b/TransactionProcessor.Client/ITransactionProcessorClient.cs @@ -1,7 +1,8 @@ -using SimpleResults; +using SimpleResults; using TransactionProcessor.DataTransferObjects.Requests.Contract; using TransactionProcessor.DataTransferObjects.Requests.Estate; using TransactionProcessor.DataTransferObjects.Requests.Merchant; +using TransactionProcessor.DataTransferObjects.Requests.MerchantSchedule; using TransactionProcessor.DataTransferObjects.Requests.Operator; using TransactionProcessor.DataTransferObjects.Responses.Contract; using TransactionProcessor.DataTransferObjects.Responses.Estate; @@ -106,11 +107,29 @@ Task CreateMerchant(String accessToken, CreateMerchantRequest createMerchantRequest, CancellationToken cancellationToken); + Task CreateMerchantSchedule(String accessToken, + Guid estateId, + Guid merchantId, + CreateMerchantScheduleRequest createMerchantScheduleRequest, + CancellationToken cancellationToken); + Task> GetMerchant(String accessToken, Guid estateId, Guid merchantId, CancellationToken cancellationToken); + Task> GetMerchantSchedule(String accessToken, + Guid estateId, + Guid merchantId, + Int32 year, + CancellationToken cancellationToken); + + Task> GetMerchantScheduleFromReadModel(String accessToken, + Guid estateId, + Guid merchantId, + Int32 year, + CancellationToken cancellationToken); + Task AssignOperatorToMerchant(String accessToken, Guid estateId, Guid merchantId, @@ -299,4 +318,4 @@ Task AddMerchantAddress(String accessToken, CancellationToken cancellationToken); #endregion } -} \ No newline at end of file +} diff --git a/TransactionProcessor.Client/TransactionProcessorClient.cs b/TransactionProcessor.Client/TransactionProcessorClient.cs index 6c8dcd84..863c3ef7 100644 --- a/TransactionProcessor.Client/TransactionProcessorClient.cs +++ b/TransactionProcessor.Client/TransactionProcessorClient.cs @@ -1,7 +1,8 @@ -using SimpleResults; +using SimpleResults; using TransactionProcessor.DataTransferObjects.Requests.Contract; using TransactionProcessor.DataTransferObjects.Requests.Estate; using TransactionProcessor.DataTransferObjects.Requests.Merchant; +using TransactionProcessor.DataTransferObjects.Requests.MerchantSchedule; using TransactionProcessor.DataTransferObjects.Requests.Operator; using TransactionProcessor.DataTransferObjects.Responses.Contract; using TransactionProcessor.DataTransferObjects.Responses.Estate; @@ -745,6 +746,72 @@ public async Task CreateMerchant(String accessToken, } } + public async Task CreateMerchantSchedule(String accessToken, + Guid estateId, + Guid merchantId, + CreateMerchantScheduleRequest createMerchantScheduleRequest, + CancellationToken cancellationToken) { + String requestUri = this.BuildRequestUrl($"/api/estates/{estateId}/merchants/{merchantId}/schedules"); + + try { + var result = await this.SendHttpPostRequest(requestUri, createMerchantScheduleRequest, accessToken, cancellationToken); + + if (result.IsFailed) + return ResultHelpers.CreateFailure(result); + + return Result.Success(); + } + catch (Exception ex) { + Exception exception = new($"Error creating merchant schedule for merchant {merchantId} for estate {estateId}.", ex); + + throw exception; + } + } + + public async Task> GetMerchantSchedule(String accessToken, + Guid estateId, + Guid merchantId, + Int32 year, + CancellationToken cancellationToken) { + String requestUri = this.BuildRequestUrl($"/api/estates/{estateId}/merchants/{merchantId}/schedules/{year}"); + + try { + Result result = await this.SendHttpGetRequest(requestUri, accessToken, cancellationToken); + + if (result.IsFailed) + return ResultHelpers.CreateFailure(result); + + return result; + } + catch (Exception ex) { + Exception exception = new($"Error getting merchant schedule for merchant {merchantId} for estate {estateId} in year {year}.", ex); + + throw exception; + } + } + + public async Task> GetMerchantScheduleFromReadModel(String accessToken, + Guid estateId, + Guid merchantId, + Int32 year, + CancellationToken cancellationToken) { + String requestUri = this.BuildRequestUrl($"/api/estates/{estateId}/merchants/{merchantId}/schedules/{year}/readmodel"); + + try { + Result result = await this.SendHttpGetRequest(requestUri, accessToken, cancellationToken); + + if (result.IsFailed) + return ResultHelpers.CreateFailure(result); + + return result; + } + catch (Exception ex) { + Exception exception = new($"Error getting merchant schedule from read model for merchant {merchantId} for estate {estateId} in year {year}.", ex); + + throw exception; + } + } + public async Task CreateMerchantUser(String accessToken, Guid estateId, Guid merchantId, @@ -1222,4 +1289,4 @@ public async Task>> GetOperators(String accessToke throw exception; } } -} \ No newline at end of file +} diff --git a/TransactionProcessor.DataTransferObjects/Requests/MerchantSchedule/CreateMerchantScheduleRequest.cs b/TransactionProcessor.DataTransferObjects/Requests/MerchantSchedule/CreateMerchantScheduleRequest.cs new file mode 100644 index 00000000..9933e629 --- /dev/null +++ b/TransactionProcessor.DataTransferObjects/Requests/MerchantSchedule/CreateMerchantScheduleRequest.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using Newtonsoft.Json; + +namespace TransactionProcessor.DataTransferObjects.Requests.MerchantSchedule +{ + [ExcludeFromCodeCoverage] + public class CreateMerchantScheduleRequest + { + [JsonProperty("year")] + public Int32 Year { get; set; } + + [JsonProperty("months")] + public System.Collections.Generic.List Months { get; set; } = []; + } + + [ExcludeFromCodeCoverage] + public class UpdateMerchantScheduleRequest + { + [JsonProperty("months")] + public List Months { get; set; } = []; + } + + [ExcludeFromCodeCoverage] + public class MerchantScheduleMonthRequest + { + [JsonProperty("month")] + public Int32 Month { get; set; } + + [JsonProperty("closed_days")] + public List ClosedDays { get; set; } = []; + } +} diff --git a/TransactionProcessor.DataTransferObjects/Responses/Merchant/MerchantResponse.cs b/TransactionProcessor.DataTransferObjects/Responses/Merchant/MerchantResponse.cs index 46ce0362..36c8639b 100644 --- a/TransactionProcessor.DataTransferObjects/Responses/Merchant/MerchantResponse.cs +++ b/TransactionProcessor.DataTransferObjects/Responses/Merchant/MerchantResponse.cs @@ -115,6 +115,9 @@ public class MerchantResponse [JsonProperty("opening_hours")] public Dictionary OpeningHours { get; set; } + [JsonProperty("schedules")] + public List Schedules { get; set; } + #endregion } -} \ No newline at end of file +} diff --git a/TransactionProcessor.DataTransferObjects/Responses/Merchant/MerchantScheduleResponse.cs b/TransactionProcessor.DataTransferObjects/Responses/Merchant/MerchantScheduleResponse.cs new file mode 100644 index 00000000..2c532188 --- /dev/null +++ b/TransactionProcessor.DataTransferObjects/Responses/Merchant/MerchantScheduleResponse.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using Newtonsoft.Json; + +namespace TransactionProcessor.DataTransferObjects.Responses.Merchant; + +public class MerchantScheduleResponse +{ + [JsonProperty("year")] + public Int32 Year { get; set; } + + [JsonProperty("months")] + public List Months { get; set; } = []; +} + +public class MerchantScheduleMonthResponse +{ + [JsonProperty("month")] + public Int32 Month { get; set; } + + [JsonProperty("closed_days")] + public List ClosedDays { get; set; } = []; +} diff --git a/TransactionProcessor.Database/Contexts/EstateManagementGenericContext.cs b/TransactionProcessor.Database/Contexts/EstateManagementGenericContext.cs index 8fc7186d..8db346c0 100644 --- a/TransactionProcessor.Database/Contexts/EstateManagementGenericContext.cs +++ b/TransactionProcessor.Database/Contexts/EstateManagementGenericContext.cs @@ -79,6 +79,10 @@ public EstateManagementContext(DbContextOptions dbContextOptions) : base(dbConte public DbSet MerchantDevices { get; set; } + public DbSet MerchantSchedules { get; set; } + + public DbSet MerchantScheduleMonths { get; set; } + public DbSet MerchantOperators { get; set; } public DbSet Merchants { get; set; } @@ -320,6 +324,8 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) .SetupTodaysTransactions() .SetupTransactionTimings() .SetupEstateOperator() + .SetupMerchantSchedule() + .SetupMerchantScheduleMonth() .SetupMerchantOpeningHours(); modelBuilder.SetupViewEntities(); @@ -532,6 +538,33 @@ public static async Task> LoadMerchantOpeningHours( }; } + public static async Task> LoadMerchantSchedule(this EstateManagementContext context, IDomainEvent domainEvent, CancellationToken cancellationToken) + { + Guid merchantScheduleId = DomainEventHelper.GetMerchantScheduleId(domainEvent); + + IQueryable query = context.MerchantSchedules.Where(e => e.MerchantScheduleId == merchantScheduleId); + Result merchantScheduleResult = await DbQueryHelpers.ExecuteQuerySafeSingleOrDefault(query, cancellationToken, $"Error getting merchant schedule {merchantScheduleId}"); + return merchantScheduleResult.Status switch + { + ResultStatus.NotFound => Result.NotFound($"Merchant Schedule not found for merchant schedule Id {merchantScheduleId}"), + _ => merchantScheduleResult + }; + } + + public static async Task> LoadMerchantScheduleMonth(this EstateManagementContext context, IDomainEvent domainEvent, CancellationToken cancellationToken) + { + Guid merchantScheduleId = DomainEventHelper.GetMerchantScheduleId(domainEvent); + Int32 month = DomainEventHelper.GetMonth(domainEvent); + + IQueryable query = context.MerchantScheduleMonths.Where(e => e.MerchantScheduleId == merchantScheduleId && e.Month == month); + Result merchantScheduleMonthResult = await DbQueryHelpers.ExecuteQuerySafeSingleOrDefault(query, cancellationToken, $"Error getting merchant schedule month {month} for merchant schedule {merchantScheduleId}"); + return merchantScheduleMonthResult.Status switch + { + ResultStatus.NotFound => Result.NotFound($"Merchant Schedule Month {month} not found for merchant schedule Id {merchantScheduleId}"), + _ => merchantScheduleMonthResult + }; + } + public static async Task> LoadReconcilation(this EstateManagementContext context, IDomainEvent domainEvent, CancellationToken cancellationToken) { Guid transactionId = DomainEventHelper.GetTransactionId(domainEvent); @@ -636,6 +669,7 @@ public static class DomainEventHelper public static Guid GetOriginalDeviceId(IDomainEvent domainEvent) => DomainEventHelper.GetProperty(domainEvent, "OriginalDeviceId"); public static Guid GetDeviceId(IDomainEvent domainEvent) => DomainEventHelper.GetProperty(domainEvent, "DeviceId"); public static Guid GetMerchantId(IDomainEvent domainEvent) => DomainEventHelper.GetProperty(domainEvent, "MerchantId"); + public static Guid GetMerchantScheduleId(IDomainEvent domainEvent) => DomainEventHelper.GetProperty(domainEvent, "MerchantScheduleId"); public static Guid GetAddressId(IDomainEvent domainEvent) => DomainEventHelper.GetProperty(domainEvent, "AddressId"); public static Guid GetContactId(IDomainEvent domainEvent) => DomainEventHelper.GetProperty(domainEvent, "ContactId"); @@ -688,6 +722,8 @@ public static T GetPropertyIgnoreCase(IDomainEvent domainEvent, String proper public static Guid GetTransactionId(IDomainEvent domainEvent) => DomainEventHelper.GetProperty(domainEvent, "TransactionId"); + public static Int32 GetMonth(IDomainEvent domainEvent) => DomainEventHelper.GetProperty(domainEvent, "Month"); + public static Guid GetVoucherId(IDomainEvent domainEvent) => DomainEventHelper.GetProperty(domainEvent, "VoucherId"); public static Boolean HasProperty(IDomainEvent domainEvent, @@ -701,4 +737,4 @@ public static Boolean HasProperty(IDomainEvent domainEvent, } #endregion -} \ No newline at end of file +} diff --git a/TransactionProcessor.Database/Contexts/Extensions.cs b/TransactionProcessor.Database/Contexts/Extensions.cs index 4d9b108a..2b687b52 100644 --- a/TransactionProcessor.Database/Contexts/Extensions.cs +++ b/TransactionProcessor.Database/Contexts/Extensions.cs @@ -192,6 +192,28 @@ public static ModelBuilder SetupMerchant(this ModelBuilder modelBuilder){ return modelBuilder; } + + public static ModelBuilder SetupMerchantSchedule(this ModelBuilder modelBuilder) + { + modelBuilder.Entity().HasKey(t => t.MerchantScheduleId); + modelBuilder.Entity() + .HasIndex(t => new { + t.MerchantId, + t.Year + }).IsUnique(); + + return modelBuilder; + } + + public static ModelBuilder SetupMerchantScheduleMonth(this ModelBuilder modelBuilder) + { + modelBuilder.Entity().HasKey(t => new { + t.MerchantScheduleId, + t.Month + }); + + return modelBuilder; + } public static ModelBuilder SetupMerchantAddress(this ModelBuilder modelBuilder){ modelBuilder.Entity().HasKey(t => new { @@ -548,4 +570,4 @@ public static async Task> ExecuteQuerySafeSingleOrDefault(IQueryabl return Result.Failure(msg); } } -} \ No newline at end of file +} diff --git a/TransactionProcessor.Database/Entities/MerchantSchedule.cs b/TransactionProcessor.Database/Entities/MerchantSchedule.cs new file mode 100644 index 00000000..dbc63131 --- /dev/null +++ b/TransactionProcessor.Database/Entities/MerchantSchedule.cs @@ -0,0 +1,16 @@ +using System; +using System.ComponentModel.DataAnnotations.Schema; + +namespace TransactionProcessor.Database.Entities; + +[Table("merchantschedule")] +public class MerchantSchedule +{ + public Guid MerchantScheduleId { get; set; } + + public Guid EstateId { get; set; } + + public Guid MerchantId { get; set; } + + public Int32 Year { get; set; } +} diff --git a/TransactionProcessor.Database/Entities/MerchantScheduleMonth.cs b/TransactionProcessor.Database/Entities/MerchantScheduleMonth.cs new file mode 100644 index 00000000..b25150a5 --- /dev/null +++ b/TransactionProcessor.Database/Entities/MerchantScheduleMonth.cs @@ -0,0 +1,14 @@ +using System; +using System.ComponentModel.DataAnnotations.Schema; + +namespace TransactionProcessor.Database.Entities; + +[Table("merchantschedulemonth")] +public class MerchantScheduleMonth +{ + public Guid MerchantScheduleId { get; set; } + + public Int32 Month { get; set; } + + public String ClosedDays { get; set; } = String.Empty; +} diff --git a/TransactionProcessor.Database/Migrations/SqlServer/20260316091500_merchant_schedule_read_model.Designer.cs b/TransactionProcessor.Database/Migrations/SqlServer/20260316091500_merchant_schedule_read_model.Designer.cs new file mode 100644 index 00000000..9811d084 --- /dev/null +++ b/TransactionProcessor.Database/Migrations/SqlServer/20260316091500_merchant_schedule_read_model.Designer.cs @@ -0,0 +1,1638 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using TransactionProcessor.Database.Contexts; + +#nullable disable + +namespace TransactionProcessor.Database.Migrations.SqlServer +{ + [DbContext(typeof(EstateManagementContext))] + [Migration("20260316091500_merchant_schedule_read_model")] + partial class merchant_schedule_read_model + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "10.0.3") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("TransactionProcessor.Database.Entities.Calendar", b => + { + b.Property("Date") + .HasColumnType("datetime2"); + + b.Property("DayOfWeek") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("DayOfWeekNumber") + .HasColumnType("int"); + + b.Property("DayOfWeekShort") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("MonthNameLong") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("MonthNameShort") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("MonthNumber") + .HasColumnType("int"); + + b.Property("WeekNumber") + .HasColumnType("int"); + + b.Property("WeekNumberString") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Year") + .HasColumnType("int"); + + b.Property("YearWeekNumber") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Date"); + + b.ToTable("calendar"); + }); + + modelBuilder.Entity("TransactionProcessor.Database.Entities.Contract", b => + { + b.Property("EstateId") + .HasColumnType("uniqueidentifier"); + + b.Property("OperatorId") + .HasColumnType("uniqueidentifier"); + + b.Property("ContractId") + .HasColumnType("uniqueidentifier"); + + b.Property("ContractReportingId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ContractReportingId")); + + b.Property("Description") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("EstateId", "OperatorId", "ContractId"); + + b.ToTable("contract"); + }); + + modelBuilder.Entity("TransactionProcessor.Database.Entities.ContractProduct", b => + { + b.Property("ContractProductReportingId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ContractProductReportingId")); + + b.Property("ContractId") + .HasColumnType("uniqueidentifier"); + + b.Property("ContractProductId") + .HasColumnType("uniqueidentifier"); + + b.Property("DisplayText") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ProductName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ProductType") + .HasColumnType("int"); + + b.Property("Value") + .HasColumnType("decimal(18,2)"); + + b.HasKey("ContractProductReportingId"); + + b.HasIndex("ContractProductId", "ContractId") + .IsUnique(); + + b.ToTable("contractproduct"); + }); + + modelBuilder.Entity("TransactionProcessor.Database.Entities.ContractProductTransactionFee", b => + { + b.Property("ContractProductTransactionFeeReportingId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ContractProductTransactionFeeReportingId")); + + b.Property("CalculationType") + .HasColumnType("int"); + + b.Property("ContractProductId") + .HasColumnType("uniqueidentifier"); + + b.Property("ContractProductTransactionFeeId") + .HasColumnType("uniqueidentifier"); + + b.Property("Description") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("FeeType") + .HasColumnType("int"); + + b.Property("IsEnabled") + .HasColumnType("bit"); + + b.Property("Value") + .HasColumnType("decimal(18,4)"); + + b.HasKey("ContractProductTransactionFeeReportingId"); + + b.HasIndex("ContractProductTransactionFeeId", "ContractProductId") + .IsUnique(); + + b.ToTable("contractproducttransactionfee"); + }); + + modelBuilder.Entity("TransactionProcessor.Database.Entities.Estate", b => + { + b.Property("EstateReportingId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("EstateReportingId")); + + b.Property("CreatedDateTime") + .HasColumnType("datetime2"); + + b.Property("EstateId") + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Reference") + .HasColumnType("nvarchar(max)"); + + b.HasKey("EstateReportingId"); + + b.HasIndex("EstateId") + .IsUnique(); + + b.ToTable("estate"); + }); + + modelBuilder.Entity("TransactionProcessor.Database.Entities.EstateOperator", b => + { + b.Property("EstateId") + .HasColumnType("uniqueidentifier"); + + b.Property("OperatorId") + .HasColumnType("uniqueidentifier"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.HasKey("EstateId", "OperatorId"); + + b.ToTable("estateoperator"); + }); + + modelBuilder.Entity("TransactionProcessor.Database.Entities.EstateSecurityUser", b => + { + b.Property("SecurityUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("EstateId") + .HasColumnType("uniqueidentifier"); + + b.Property("CreatedDateTime") + .HasColumnType("datetime2"); + + b.Property("EmailAddress") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("SecurityUserId", "EstateId"); + + b.ToTable("estatesecurityuser"); + }); + + modelBuilder.Entity("TransactionProcessor.Database.Entities.File", b => + { + b.Property("FileReportingId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("FileReportingId")); + + b.Property("EstateId") + .HasColumnType("uniqueidentifier"); + + b.Property("FileId") + .HasColumnType("uniqueidentifier"); + + b.Property("FileImportLogId") + .HasColumnType("uniqueidentifier"); + + b.Property("FileLocation") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("FileProfileId") + .HasColumnType("uniqueidentifier"); + + b.Property("FileReceivedDate") + .HasColumnType("date"); + + b.Property("FileReceivedDateTime") + .HasColumnType("datetime2"); + + b.Property("IsCompleted") + .HasColumnType("bit"); + + b.Property("MerchantId") + .HasColumnType("uniqueidentifier"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("FileReportingId"); + + b.HasIndex("FileId") + .IsUnique(); + + b.ToTable("file"); + }); + + modelBuilder.Entity("TransactionProcessor.Database.Entities.FileImportLog", b => + { + b.Property("EstateId") + .HasColumnType("uniqueidentifier"); + + b.Property("FileImportLogReportingId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("FileImportLogReportingId")); + + b.Property("FileImportLogId") + .HasColumnType("uniqueidentifier"); + + b.Property("ImportLogDate") + .HasColumnType("date"); + + b.Property("ImportLogDateTime") + .HasColumnType("datetime2"); + + b.HasKey("EstateId", "FileImportLogReportingId"); + + b.HasIndex("EstateId", "FileImportLogId") + .IsUnique(); + + b.ToTable("fileimportlog"); + }); + + modelBuilder.Entity("TransactionProcessor.Database.Entities.FileImportLogFile", b => + { + b.Property("FileImportLogId") + .HasColumnType("uniqueidentifier"); + + b.Property("FileId") + .HasColumnType("uniqueidentifier"); + + b.Property("FilePath") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("FileProfileId") + .HasColumnType("uniqueidentifier"); + + b.Property("FileUploadedDate") + .HasColumnType("date"); + + b.Property("FileUploadedDateTime") + .HasColumnType("datetime2"); + + b.Property("MerchantId") + .HasColumnType("uniqueidentifier"); + + b.Property("OriginalFileName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("FileImportLogId", "FileId"); + + b.ToTable("fileimportlogfile"); + }); + + modelBuilder.Entity("TransactionProcessor.Database.Entities.FileLine", b => + { + b.Property("FileId") + .HasColumnType("uniqueidentifier"); + + b.Property("LineNumber") + .HasColumnType("int"); + + b.Property("FileLineData") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Status") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("TransactionId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("FileId", "LineNumber"); + + SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("FileId", "LineNumber")); + + b.ToTable("fileline"); + }); + + modelBuilder.Entity("TransactionProcessor.Database.Entities.Float", b => + { + b.Property("FloatId") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ContractId") + .HasColumnType("uniqueidentifier"); + + b.Property("CreatedDate") + .HasColumnType("date"); + + b.Property("CreatedDateTime") + .HasColumnType("datetime2"); + + b.Property("EstateId") + .HasColumnType("uniqueidentifier"); + + b.Property("ProductId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("FloatId"); + + SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("FloatId"), false); + + b.HasIndex("CreatedDate"); + + SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("CreatedDate")); + + b.ToTable("Floats"); + }); + + modelBuilder.Entity("TransactionProcessor.Database.Entities.FloatActivity", b => + { + b.Property("EventId") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ActivityDate") + .HasColumnType("date"); + + b.Property("ActivityDateTime") + .HasColumnType("datetime2"); + + b.Property("Amount") + .HasColumnType("decimal(18,2)"); + + b.Property("CostPrice") + .HasColumnType("decimal(18,2)"); + + b.Property("CreditOrDebit") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("FloatId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("EventId"); + + SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("EventId"), false); + + b.HasIndex("ActivityDate"); + + SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ActivityDate")); + + b.ToTable("FloatActivity"); + }); + + modelBuilder.Entity("TransactionProcessor.Database.Entities.Merchant", b => + { + b.Property("MerchantReportingId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("MerchantReportingId")); + + b.Property("CreatedDateTime") + .HasColumnType("datetime2"); + + b.Property("EstateId") + .HasColumnType("uniqueidentifier"); + + b.Property("LastSaleDate") + .HasColumnType("date"); + + b.Property("LastSaleDateTime") + .HasColumnType("datetime2"); + + b.Property("LastStatementGenerated") + .HasColumnType("datetime2"); + + b.Property("MerchantId") + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Reference") + .HasColumnType("nvarchar(max)"); + + b.Property("SettlementSchedule") + .HasColumnType("int"); + + b.HasKey("MerchantReportingId"); + + b.HasIndex("EstateId", "MerchantId") + .IsUnique(); + + b.ToTable("merchant"); + }); + + modelBuilder.Entity("TransactionProcessor.Database.Entities.MerchantAddress", b => + { + b.Property("MerchantId") + .HasColumnType("uniqueidentifier"); + + b.Property("AddressId") + .HasColumnType("uniqueidentifier"); + + b.Property("AddressLine1") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("AddressLine2") + .HasColumnType("nvarchar(max)"); + + b.Property("AddressLine3") + .HasColumnType("nvarchar(max)"); + + b.Property("AddressLine4") + .HasColumnType("nvarchar(max)"); + + b.Property("Country") + .HasColumnType("nvarchar(max)"); + + b.Property("CreatedDateTime") + .HasColumnType("datetime2"); + + b.Property("PostalCode") + .HasColumnType("nvarchar(max)"); + + b.Property("Region") + .HasColumnType("nvarchar(max)"); + + b.Property("Town") + .HasColumnType("nvarchar(max)"); + + b.HasKey("MerchantId", "AddressId"); + + b.ToTable("merchantaddress"); + }); + + modelBuilder.Entity("TransactionProcessor.Database.Entities.MerchantContact", b => + { + b.Property("MerchantId") + .HasColumnType("uniqueidentifier"); + + b.Property("ContactId") + .HasColumnType("uniqueidentifier"); + + b.Property("CreatedDateTime") + .HasColumnType("datetime2"); + + b.Property("EmailAddress") + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("PhoneNumber") + .HasColumnType("nvarchar(max)"); + + b.HasKey("MerchantId", "ContactId"); + + b.ToTable("merchantcontact"); + }); + + modelBuilder.Entity("TransactionProcessor.Database.Entities.MerchantContract", b => + { + b.Property("MerchantId") + .HasColumnType("uniqueidentifier"); + + b.Property("ContractId") + .HasColumnType("uniqueidentifier"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.HasKey("MerchantId", "ContractId"); + + b.ToTable("MerchantContracts"); + }); + + modelBuilder.Entity("TransactionProcessor.Database.Entities.MerchantDevice", b => + { + b.Property("MerchantId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeviceId") + .HasColumnType("uniqueidentifier"); + + b.Property("CreatedDateTime") + .HasColumnType("datetime2"); + + b.Property("DeviceIdentifier") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("IsEnabled") + .HasColumnType("bit"); + + b.HasKey("MerchantId", "DeviceId"); + + b.ToTable("merchantdevice"); + }); + + modelBuilder.Entity("TransactionProcessor.Database.Entities.MerchantOpeningHours", b => + { + b.Property("MerchantId") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("FridayClosing") + .HasColumnType("nvarchar(max)"); + + b.Property("FridayOpening") + .HasColumnType("nvarchar(max)"); + + b.Property("MondayClosing") + .HasColumnType("nvarchar(max)"); + + b.Property("MondayOpening") + .HasColumnType("nvarchar(max)"); + + b.Property("SaturdayClosing") + .HasColumnType("nvarchar(max)"); + + b.Property("SaturdayOpening") + .HasColumnType("nvarchar(max)"); + + b.Property("SundayClosing") + .HasColumnType("nvarchar(max)"); + + b.Property("SundayOpening") + .HasColumnType("nvarchar(max)"); + + b.Property("ThursdayClosing") + .HasColumnType("nvarchar(max)"); + + b.Property("ThursdayOpening") + .HasColumnType("nvarchar(max)"); + + b.Property("TuesdayClosing") + .HasColumnType("nvarchar(max)"); + + b.Property("TuesdayOpening") + .HasColumnType("nvarchar(max)"); + + b.Property("WednesdayClosing") + .HasColumnType("nvarchar(max)"); + + b.Property("WednesdayOpening") + .HasColumnType("nvarchar(max)"); + + b.HasKey("MerchantId"); + + b.ToTable("merchantopeninghours"); + }); + + modelBuilder.Entity("TransactionProcessor.Database.Entities.MerchantSchedule", b => + { + b.Property("MerchantScheduleId") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("EstateId") + .HasColumnType("uniqueidentifier"); + + b.Property("MerchantId") + .HasColumnType("uniqueidentifier"); + + b.Property("Year") + .HasColumnType("int"); + + b.HasKey("MerchantScheduleId"); + + b.HasIndex("MerchantId", "Year") + .IsUnique(); + + b.ToTable("merchantschedule"); + }); + + modelBuilder.Entity("TransactionProcessor.Database.Entities.MerchantScheduleMonth", b => + { + b.Property("MerchantScheduleId") + .HasColumnType("uniqueidentifier"); + + b.Property("Month") + .HasColumnType("int"); + + b.Property("ClosedDays") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("MerchantScheduleId", "Month"); + + b.ToTable("merchantschedulemonth"); + }); + + modelBuilder.Entity("TransactionProcessor.Database.Entities.MerchantOperator", b => + { + b.Property("MerchantId") + .HasColumnType("uniqueidentifier"); + + b.Property("OperatorId") + .HasColumnType("uniqueidentifier"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("MerchantNumber") + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("TerminalNumber") + .HasColumnType("nvarchar(max)"); + + b.HasKey("MerchantId", "OperatorId"); + + b.ToTable("merchantoperator"); + }); + + modelBuilder.Entity("TransactionProcessor.Database.Entities.MerchantSecurityUser", b => + { + b.Property("MerchantId") + .HasColumnType("uniqueidentifier"); + + b.Property("SecurityUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("CreatedDateTime") + .HasColumnType("datetime2"); + + b.Property("EmailAddress") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("MerchantId", "SecurityUserId"); + + b.ToTable("merchantsecurityuser"); + }); + + modelBuilder.Entity("TransactionProcessor.Database.Entities.MerchantSettlementFee", b => + { + b.Property("SettlementId") + .HasColumnType("uniqueidentifier"); + + b.Property("TransactionId") + .HasColumnType("uniqueidentifier"); + + b.Property("ContractProductTransactionFeeId") + .HasColumnType("uniqueidentifier"); + + b.Property("CalculatedValue") + .HasColumnType("decimal(18,2)"); + + b.Property("FeeCalculatedDateTime") + .HasColumnType("datetime2"); + + b.Property("FeeValue") + .HasColumnType("decimal(18,2)"); + + b.Property("IsSettled") + .HasColumnType("bit"); + + b.Property("MerchantId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("SettlementId", "TransactionId", "ContractProductTransactionFeeId"); + + b.ToTable("merchantsettlementfee"); + }); + + modelBuilder.Entity("TransactionProcessor.Database.Entities.Operator", b => + { + b.Property("OperatorReportingId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("OperatorReportingId")); + + b.Property("EstateId") + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("OperatorId") + .HasColumnType("uniqueidentifier"); + + b.Property("RequireCustomMerchantNumber") + .HasColumnType("bit"); + + b.Property("RequireCustomTerminalNumber") + .HasColumnType("bit"); + + b.HasKey("OperatorReportingId"); + + b.HasIndex("OperatorId") + .IsUnique(); + + b.ToTable("operator"); + }); + + modelBuilder.Entity("TransactionProcessor.Database.Entities.Reconciliation", b => + { + b.Property("TransactionReportingId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("TransactionReportingId")); + + b.Property("DeviceIdentifier") + .HasColumnType("nvarchar(max)"); + + b.Property("IsAuthorised") + .HasColumnType("bit"); + + b.Property("IsCompleted") + .HasColumnType("bit"); + + b.Property("MerchantId") + .HasColumnType("uniqueidentifier"); + + b.Property("ResponseCode") + .HasColumnType("nvarchar(max)"); + + b.Property("ResponseMessage") + .HasColumnType("nvarchar(max)"); + + b.Property("TransactionCount") + .HasColumnType("int"); + + b.Property("TransactionDate") + .HasColumnType("date"); + + b.Property("TransactionDateTime") + .HasColumnType("datetime2"); + + b.Property("TransactionId") + .HasColumnType("uniqueidentifier"); + + b.Property("TransactionTime") + .HasColumnType("time"); + + b.Property("TransactionValue") + .HasColumnType("decimal(18,2)"); + + b.HasKey("TransactionReportingId"); + + SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("TransactionReportingId"), false); + + b.HasIndex("TransactionDate"); + + SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("TransactionDate")); + + b.HasIndex("TransactionId", "MerchantId") + .IsUnique(); + + SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("TransactionId", "MerchantId"), false); + + b.ToTable("reconciliation"); + }); + + modelBuilder.Entity("TransactionProcessor.Database.Entities.ResponseCodes", b => + { + b.Property("ResponseCode") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ResponseCode")); + + b.Property("Description") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("ResponseCode"); + + b.ToTable("responsecodes"); + }); + + modelBuilder.Entity("TransactionProcessor.Database.Entities.Settlement", b => + { + b.Property("SettlementReportingId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("SettlementReportingId")); + + b.Property("EstateId") + .HasColumnType("uniqueidentifier"); + + b.Property("IsCompleted") + .HasColumnType("bit"); + + b.Property("MerchantId") + .HasColumnType("uniqueidentifier"); + + b.Property("ProcessingStarted") + .HasColumnType("bit"); + + b.Property("ProcessingStartedDateTIme") + .HasColumnType("datetime2"); + + b.Property("SettlementDate") + .HasColumnType("date"); + + b.Property("SettlementId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("SettlementReportingId"); + + SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("SettlementReportingId"), false); + + b.HasIndex("SettlementDate"); + + SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("SettlementDate")); + + b.HasIndex("EstateId", "SettlementId") + .IsUnique(); + + SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("EstateId", "SettlementId"), false); + + b.ToTable("settlement"); + }); + + modelBuilder.Entity("TransactionProcessor.Database.Entities.StatementHeader", b => + { + b.Property("MerchantId") + .HasColumnType("uniqueidentifier"); + + b.Property("StatementId") + .HasColumnType("uniqueidentifier"); + + b.Property("StatementCreatedDate") + .HasColumnType("date"); + + b.Property("StatementCreatedDateTime") + .HasColumnType("datetime2"); + + b.Property("StatementGeneratedDate") + .HasColumnType("date"); + + b.Property("StatementGeneratedDateTime") + .HasColumnType("datetime2"); + + b.Property("StatementReportingId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("StatementReportingId")); + + b.HasKey("MerchantId", "StatementId"); + + SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("MerchantId", "StatementId"), false); + + b.HasIndex("StatementGeneratedDate"); + + SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("StatementGeneratedDate")); + + b.ToTable("statementheader"); + }); + + modelBuilder.Entity("TransactionProcessor.Database.Entities.StatementLine", b => + { + b.Property("StatementId") + .HasColumnType("uniqueidentifier"); + + b.Property("TransactionId") + .HasColumnType("uniqueidentifier"); + + b.Property("ActivityDateTime") + .HasColumnType("datetime2"); + + b.Property("ActivityType") + .HasColumnType("int"); + + b.Property("ActivityDate") + .HasColumnType("date"); + + b.Property("ActivityDescription") + .HasColumnType("nvarchar(max)"); + + b.Property("InAmount") + .HasColumnType("decimal(18,2)"); + + b.Property("OutAmount") + .HasColumnType("decimal(18,2)"); + + b.HasKey("StatementId", "TransactionId", "ActivityDateTime", "ActivityType"); + + b.ToTable("statementline"); + }); + + modelBuilder.Entity("TransactionProcessor.Database.Entities.Summary.SettlementSummary", b => + { + b.Property("ContractProductReportingId") + .HasColumnType("int"); + + b.Property("FeeCount") + .HasColumnType("int"); + + b.Property("FeeValue") + .HasColumnType("decimal(18,2)"); + + b.Property("IsCompleted") + .HasColumnType("bit"); + + b.Property("IsSettled") + .HasColumnType("bit"); + + b.Property("MerchantReportingId") + .HasColumnType("int"); + + b.Property("OperatorReportingId") + .HasColumnType("int"); + + b.Property("SalesCount") + .HasColumnType("int"); + + b.Property("SalesValue") + .HasColumnType("decimal(18,2)"); + + b.Property("SettlementDate") + .HasColumnType("date"); + + b.HasIndex("SettlementDate"); + + SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("SettlementDate")); + + b.HasIndex("SettlementDate", "MerchantReportingId", "OperatorReportingId", "ContractProductReportingId", "IsCompleted", "IsSettled") + .IsUnique(); + + b.ToTable("SettlementSummary"); + }); + + modelBuilder.Entity("TransactionProcessor.Database.Entities.Summary.TodayTransaction", b => + { + b.Property("AuthorisationCode") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ContractProductReportingId") + .HasColumnType("int"); + + b.Property("ContractReportingId") + .HasColumnType("int"); + + b.Property("DeviceIdentifier") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Hour") + .HasColumnType("int"); + + b.Property("IsAuthorised") + .HasColumnType("bit"); + + b.Property("IsCompleted") + .HasColumnType("bit"); + + b.Property("MerchantReportingId") + .HasColumnType("int"); + + b.Property("OperatorReportingId") + .HasColumnType("int"); + + b.Property("ResponseCode") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ResponseMessage") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("TransactionAmount") + .HasColumnType("decimal(18,2)"); + + b.Property("TransactionDate") + .HasColumnType("date"); + + b.Property("TransactionDateTime") + .HasColumnType("datetime2"); + + b.Property("TransactionId") + .HasColumnType("uniqueidentifier"); + + b.Property("TransactionNumber") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("TransactionReference") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("TransactionReportingId") + .HasColumnType("int"); + + b.Property("TransactionSource") + .HasColumnType("int"); + + b.Property("TransactionTime") + .HasColumnType("time"); + + b.Property("TransactionType") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasIndex("TransactionDate"); + + SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("TransactionDate")); + + b.HasIndex("TransactionId") + .IsUnique(); + + b.ToTable("TodayTransactions"); + }); + + modelBuilder.Entity("TransactionProcessor.Database.Entities.Summary.TransactionHistory", b => + { + b.Property("AuthorisationCode") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ContractProductReportingId") + .HasColumnType("int"); + + b.Property("ContractReportingId") + .HasColumnType("int"); + + b.Property("DeviceIdentifier") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Hour") + .HasColumnType("int"); + + b.Property("IsAuthorised") + .HasColumnType("bit"); + + b.Property("IsCompleted") + .HasColumnType("bit"); + + b.Property("MerchantReportingId") + .HasColumnType("int"); + + b.Property("OperatorReportingId") + .HasColumnType("int"); + + b.Property("ResponseCode") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ResponseMessage") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("TransactionAmount") + .HasColumnType("decimal(18,2)"); + + b.Property("TransactionDate") + .HasColumnType("date"); + + b.Property("TransactionDateTime") + .HasColumnType("datetime2"); + + b.Property("TransactionId") + .HasColumnType("uniqueidentifier"); + + b.Property("TransactionNumber") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("TransactionReference") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("TransactionReportingId") + .HasColumnType("int"); + + b.Property("TransactionSource") + .HasColumnType("int"); + + b.Property("TransactionTime") + .HasColumnType("time"); + + b.Property("TransactionType") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasIndex("TransactionDate"); + + SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("TransactionDate")); + + b.HasIndex("TransactionId") + .IsUnique(); + + b.ToTable("TransactionHistory"); + }); + + modelBuilder.Entity("TransactionProcessor.Database.Entities.Transaction", b => + { + b.Property("TransactionReportingId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("TransactionReportingId")); + + b.Property("AuthorisationCode") + .HasColumnType("nvarchar(max)"); + + b.Property("ContractId") + .HasColumnType("uniqueidentifier"); + + b.Property("ContractProductId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeviceIdentifier") + .HasColumnType("nvarchar(max)"); + + b.Property("IsAuthorised") + .HasColumnType("bit"); + + b.Property("IsCompleted") + .HasColumnType("bit"); + + b.Property("MerchantId") + .HasColumnType("uniqueidentifier"); + + b.Property("OperatorId") + .HasColumnType("uniqueidentifier"); + + b.Property("ResponseCode") + .HasColumnType("nvarchar(max)"); + + b.Property("ResponseMessage") + .HasColumnType("nvarchar(max)"); + + b.Property("TransactionAmount") + .HasColumnType("decimal(18,2)"); + + b.Property("TransactionDate") + .HasColumnType("date"); + + b.Property("TransactionDateTime") + .HasColumnType("datetime2"); + + b.Property("TransactionId") + .HasColumnType("uniqueidentifier"); + + b.Property("TransactionNumber") + .HasColumnType("nvarchar(max)"); + + b.Property("TransactionReference") + .HasColumnType("nvarchar(max)"); + + b.Property("TransactionSource") + .HasColumnType("int"); + + b.Property("TransactionTime") + .HasColumnType("time"); + + b.Property("TransactionType") + .HasColumnType("nvarchar(max)"); + + b.HasKey("TransactionReportingId"); + + SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("TransactionReportingId"), false); + + b.HasIndex("TransactionDate"); + + SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("TransactionDate")); + + b.HasIndex("TransactionId") + .IsUnique(); + + SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("TransactionId"), false); + + b.ToTable("transaction"); + }); + + modelBuilder.Entity("TransactionProcessor.Database.Entities.TransactionAdditionalRequestData", b => + { + b.Property("TransactionId") + .HasColumnType("uniqueidentifier"); + + b.Property("Amount") + .HasColumnType("nvarchar(max)"); + + b.Property("CustomerAccountNumber") + .HasColumnType("nvarchar(max)"); + + b.HasKey("TransactionId"); + + b.ToTable("transactionadditionalrequestdata"); + }); + + modelBuilder.Entity("TransactionProcessor.Database.Entities.TransactionAdditionalResponseData", b => + { + b.Property("TransactionId") + .HasColumnType("uniqueidentifier"); + + b.Property("TransactionReportingId") + .HasColumnType("int"); + + b.HasKey("TransactionId"); + + b.ToTable("transactionadditionalresponsedata"); + }); + + modelBuilder.Entity("TransactionProcessor.Database.Entities.TransactionTimings", b => + { + b.Property("TransactionId") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("OperatorCommunicationsCompletedDateTime") + .HasColumnType("datetime2"); + + b.Property("OperatorCommunicationsDurationInMilliseconds") + .HasColumnType("float"); + + b.Property("OperatorCommunicationsStartedDateTime") + .HasColumnType("datetime2"); + + b.Property("TotalTransactionInMilliseconds") + .HasColumnType("float"); + + b.Property("TransactionCompletedDateTime") + .HasColumnType("datetime2"); + + b.Property("TransactionProcessingDurationInMilliseconds") + .HasColumnType("float"); + + b.Property("TransactionStartedDateTime") + .HasColumnType("datetime2"); + + b.HasKey("TransactionId"); + + SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("TransactionId"), false); + + b.ToTable("transactiontimings"); + }); + + modelBuilder.Entity("TransactionProcessor.Database.Entities.VoucherProjectionState", b => + { + b.Property("VoucherId") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Barcode") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("EstateId") + .HasColumnType("uniqueidentifier"); + + b.Property("ExpiryDate") + .HasColumnType("date"); + + b.Property("ExpiryDateTime") + .HasColumnType("datetime2"); + + b.Property("GenerateDate") + .HasColumnType("date"); + + b.Property("GenerateDateTime") + .HasColumnType("datetime2"); + + b.Property("IsGenerated") + .HasColumnType("bit"); + + b.Property("IsIssued") + .HasColumnType("bit"); + + b.Property("IsRedeemed") + .HasColumnType("bit"); + + b.Property("IssuedDate") + .HasColumnType("date"); + + b.Property("IssuedDateTime") + .HasColumnType("datetime2"); + + b.Property("OperatorIdentifier") + .HasColumnType("nvarchar(max)"); + + b.Property("RecipientEmail") + .HasColumnType("nvarchar(max)"); + + b.Property("RecipientMobile") + .HasColumnType("nvarchar(max)"); + + b.Property("RedeemedDate") + .HasColumnType("datetime2"); + + b.Property("RedeemedDateTime") + .HasColumnType("datetime2"); + + b.Property("Timestamp") + .IsConcurrencyToken() + .IsRequired() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("rowversion"); + + b.Property("TransactionId") + .HasColumnType("uniqueidentifier"); + + b.Property("Value") + .HasColumnType("decimal(18,2)"); + + b.Property("VoucherCode") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.HasKey("VoucherId"); + + b.HasIndex("TransactionId"); + + b.HasIndex("VoucherCode"); + + b.ToTable("voucherprojectionstate"); + }); + + modelBuilder.Entity("TransactionProcessor.Database.ViewEntities.SettlementView", b => + { + b.Property("Amount") + .HasColumnType("decimal(18,2)"); + + b.Property("CalculatedValue") + .HasColumnType("decimal(18,2)"); + + b.Property("DayOfWeek") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("EstateId") + .HasColumnType("uniqueidentifier"); + + b.Property("FeeDescription") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("IsCompleted") + .HasColumnType("bit"); + + b.Property("IsSettled") + .HasColumnType("bit"); + + b.Property("MerchantId") + .HasColumnType("uniqueidentifier"); + + b.Property("MerchantName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Month") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("MonthNumber") + .HasColumnType("int"); + + b.Property("OperatorIdentifier") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("SettlementDate") + .HasColumnType("datetime2"); + + b.Property("SettlementId") + .HasColumnType("uniqueidentifier"); + + b.Property("TransactionId") + .HasColumnType("uniqueidentifier"); + + b.Property("WeekNumber") + .HasColumnType("int"); + + b.Property("YearNumber") + .HasColumnType("int"); + + b.ToTable((string)null); + + b.ToView("uvwSettlements", (string)null); + }); + + modelBuilder.Entity("TransactionProcessor.ProjectionEngine.Database.Database.Entities.Event", b => + { + b.Property("EventId") + .HasColumnType("uniqueidentifier"); + + b.Property("Type") + .HasColumnType("nvarchar(450)"); + + b.Property("Date") + .HasColumnType("date"); + + b.HasKey("EventId", "Type"); + + SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("EventId", "Type")); + + b.ToTable("Events"); + }); + + modelBuilder.Entity("TransactionProcessor.ProjectionEngine.Database.Database.Entities.MerchantBalanceChangedEntry", b => + { + b.Property("AggregateId") + .HasColumnType("uniqueidentifier"); + + b.Property("OriginalEventId") + .HasColumnType("uniqueidentifier"); + + b.Property("CauseOfChangeId") + .HasColumnType("uniqueidentifier"); + + b.Property("ChangeAmount") + .HasColumnType("decimal(18,2)"); + + b.Property("DateTime") + .HasColumnType("datetime2"); + + b.Property("DebitOrCredit") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("EstateId") + .HasColumnType("uniqueidentifier"); + + b.Property("MerchantId") + .HasColumnType("uniqueidentifier"); + + b.Property("Reference") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("AggregateId", "OriginalEventId"); + + b.ToTable("MerchantBalanceChangedEntry"); + }); + + modelBuilder.Entity("TransactionProcessor.ProjectionEngine.Database.Database.Entities.MerchantBalanceProjectionState", b => + { + b.Property("EstateId") + .HasColumnType("uniqueidentifier"); + + b.Property("MerchantId") + .HasColumnType("uniqueidentifier"); + + b.Property("AuthorisedSales") + .HasColumnType("decimal(18,2)"); + + b.Property("AvailableBalance") + .HasColumnType("decimal(18,2)"); + + b.Property("Balance") + .HasColumnType("decimal(18,2)"); + + b.Property("CompletedTransactionCount") + .HasColumnType("int"); + + b.Property("DeclinedSales") + .HasColumnType("decimal(18,2)"); + + b.Property("DepositCount") + .HasColumnType("int"); + + b.Property("FeeCount") + .HasColumnType("int"); + + b.Property("LastDeposit") + .HasColumnType("datetime2"); + + b.Property("LastFee") + .HasColumnType("datetime2"); + + b.Property("LastSale") + .HasColumnType("datetime2"); + + b.Property("LastWithdrawal") + .HasColumnType("datetime2"); + + b.Property("MerchantName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("SaleCount") + .HasColumnType("int"); + + b.Property("StartedTransactionCount") + .HasColumnType("int"); + + b.Property("Timestamp") + .IsConcurrencyToken() + .IsRequired() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("rowversion"); + + b.Property("TotalDeposited") + .HasColumnType("decimal(18,2)"); + + b.Property("TotalWithdrawn") + .HasColumnType("decimal(18,2)"); + + b.Property("ValueOfFees") + .HasColumnType("decimal(18,2)"); + + b.Property("WithdrawalCount") + .HasColumnType("int"); + + b.HasKey("EstateId", "MerchantId"); + + b.ToTable("MerchantBalanceProjectionState"); + }); + + modelBuilder.Entity("TransactionProcessor.ProjectionEngine.Database.Database.ViewEntities.MerchantBalanceHistoryViewEntry", b => + { + b.Property("Balance") + .HasColumnType("decimal(18,2)"); + + b.Property("ChangeAmount") + .HasColumnType("decimal(18,2)"); + + b.Property("DebitOrCredit") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("EntryDateTime") + .HasColumnType("datetime2"); + + b.Property("MerchantId") + .HasColumnType("uniqueidentifier"); + + b.Property("OriginalEventId") + .HasColumnType("uniqueidentifier"); + + b.Property("Reference") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.ToTable((string)null); + + b.ToView("uvwMerchantBalanceHistory", (string)null); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/TransactionProcessor.Database/Migrations/SqlServer/20260316091500_merchant_schedule_read_model.cs b/TransactionProcessor.Database/Migrations/SqlServer/20260316091500_merchant_schedule_read_model.cs new file mode 100644 index 00000000..f754f7bb --- /dev/null +++ b/TransactionProcessor.Database/Migrations/SqlServer/20260316091500_merchant_schedule_read_model.cs @@ -0,0 +1,56 @@ +using System; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using TransactionProcessor.Database.Contexts; + +#nullable disable + +namespace TransactionProcessor.Database.Migrations.SqlServer; + +public partial class merchant_schedule_read_model : Migration +{ + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "merchantschedule", + columns: table => new + { + MerchantScheduleId = table.Column(type: "uniqueidentifier", nullable: false), + EstateId = table.Column(type: "uniqueidentifier", nullable: false), + MerchantId = table.Column(type: "uniqueidentifier", nullable: false), + Year = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_merchantschedule", x => x.MerchantScheduleId); + }); + + migrationBuilder.CreateTable( + name: "merchantschedulemonth", + columns: table => new + { + MerchantScheduleId = table.Column(type: "uniqueidentifier", nullable: false), + Month = table.Column(type: "int", nullable: false), + ClosedDays = table.Column(type: "nvarchar(max)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_merchantschedulemonth", x => new { x.MerchantScheduleId, x.Month }); + }); + + migrationBuilder.CreateIndex( + name: "IX_merchantschedule_MerchantId_Year", + table: "merchantschedule", + columns: new[] { "MerchantId", "Year" }, + unique: true); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "merchantschedulemonth"); + + migrationBuilder.DropTable( + name: "merchantschedule"); + } +} diff --git a/TransactionProcessor.Database/Migrations/SqlServer/EstateManagementSqlServerContextModelSnapshot.cs b/TransactionProcessor.Database/Migrations/SqlServer/EstateManagementSqlServerContextModelSnapshot.cs index ae312449..497b3654 100644 --- a/TransactionProcessor.Database/Migrations/SqlServer/EstateManagementSqlServerContextModelSnapshot.cs +++ b/TransactionProcessor.Database/Migrations/SqlServer/EstateManagementSqlServerContextModelSnapshot.cs @@ -641,6 +641,46 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("merchantopeninghours"); }); + modelBuilder.Entity("TransactionProcessor.Database.Entities.MerchantSchedule", b => + { + b.Property("MerchantScheduleId") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("EstateId") + .HasColumnType("uniqueidentifier"); + + b.Property("MerchantId") + .HasColumnType("uniqueidentifier"); + + b.Property("Year") + .HasColumnType("int"); + + b.HasKey("MerchantScheduleId"); + + b.HasIndex("MerchantId", "Year") + .IsUnique(); + + b.ToTable("merchantschedule"); + }); + + modelBuilder.Entity("TransactionProcessor.Database.Entities.MerchantScheduleMonth", b => + { + b.Property("MerchantScheduleId") + .HasColumnType("uniqueidentifier"); + + b.Property("Month") + .HasColumnType("int"); + + b.Property("ClosedDays") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("MerchantScheduleId", "Month"); + + b.ToTable("merchantschedulemonth"); + }); + modelBuilder.Entity("TransactionProcessor.Database.Entities.MerchantOperator", b => { b.Property("MerchantId") diff --git a/TransactionProcessor.DomainEvents/MerchantScheduleDomainEvents.cs b/TransactionProcessor.DomainEvents/MerchantScheduleDomainEvents.cs new file mode 100644 index 00000000..d72b674c --- /dev/null +++ b/TransactionProcessor.DomainEvents/MerchantScheduleDomainEvents.cs @@ -0,0 +1,19 @@ +using System.Diagnostics.CodeAnalysis; +using Shared.DomainDrivenDesign.EventSourcing; + +namespace TransactionProcessor.DomainEvents; + +[ExcludeFromCodeCoverage] +public class MerchantScheduleDomainEvents { + public record MerchantScheduleCreatedEvent(Guid MerchantScheduleId, + Guid EstateId, + Guid MerchantId, + Int32 Year) : DomainEvent(MerchantScheduleId, Guid.NewGuid()); + + public record MerchantScheduleMonthUpdatedEvent(Guid MerchantScheduleId, + Guid EstateId, + Guid MerchantId, + Int32 Year, + Int32 Month, + Int32[] ClosedDays) : DomainEvent(MerchantScheduleId, Guid.NewGuid()); +} diff --git a/TransactionProcessor.IntegrationTesting.Helpers/SpecflowExtensions.cs b/TransactionProcessor.IntegrationTesting.Helpers/SpecflowExtensions.cs index 4d55aecf..3b114867 100644 --- a/TransactionProcessor.IntegrationTesting.Helpers/SpecflowExtensions.cs +++ b/TransactionProcessor.IntegrationTesting.Helpers/SpecflowExtensions.cs @@ -1,8 +1,9 @@ -using Shared.Extensions; +using Shared.Extensions; using Shouldly; using TransactionProcessor.DataTransferObjects.Requests.Contract; using TransactionProcessor.DataTransferObjects.Requests.Estate; using TransactionProcessor.DataTransferObjects.Requests.Merchant; +using TransactionProcessor.DataTransferObjects.Requests.MerchantSchedule; using TransactionProcessor.DataTransferObjects.Requests.Operator; using TransactionProcessor.DataTransferObjects.Responses.Contract; using TransactionProcessor.DataTransferObjects.Responses.Merchant; @@ -1252,6 +1253,39 @@ public static List ToEstateDetails(this DataTableRows tableRows) return requests; } + public static List<(EstateDetails estate, Guid merchantId, CreateMerchantScheduleRequest request)> ToCreateMerchantScheduleRequests(this DataTableRows tableRows, + List estateDetailsList) + { + return tableRows.GroupBy(row => new + { + EstateName = ReqnrollTableHelper.GetStringRowValue(row, "EstateName"), + MerchantName = ReqnrollTableHelper.GetStringRowValue(row, "MerchantName"), + Year = ReqnrollTableHelper.GetIntValue(row, "Year") + }) + .Select(group => + { + EstateDetails estateDetails = estateDetailsList.SingleOrDefault(e => e.EstateName == group.Key.EstateName); + estateDetails.ShouldNotBeNull(); + + Guid merchantId = estateDetails.GetMerchant(group.Key.MerchantName).MerchantId; + + CreateMerchantScheduleRequest request = new() + { + Year = group.Key.Year, + Months = group.Select(row => new MerchantScheduleMonthRequest + { + Month = ReqnrollTableHelper.GetIntValue(row, "Month"), + ClosedDays = ReqnrollTableHelper.GetStringRowValue(row, "ClosedDays") + .Split(',', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries) + .Select(Int32.Parse) + .ToList() + }).ToList() + }; + + return (estateDetails, merchantId, request); + }).ToList(); + } + public static List<(EstateDetails, Guid, AddMerchantDeviceRequest)> ToAddMerchantDeviceRequests(this DataTableRows tableRows, List estateDetailsList) { List<(EstateDetails, Guid, AddMerchantDeviceRequest)> result = new List<(EstateDetails, Guid, AddMerchantDeviceRequest)>(); @@ -1393,4 +1427,4 @@ public static List ToSecurityUsersDetails(this DataTableRows tableRows) return results; } -} \ No newline at end of file +} diff --git a/TransactionProcessor.IntegrationTesting.Helpers/SubscriptionsHelper.cs b/TransactionProcessor.IntegrationTesting.Helpers/SubscriptionsHelper.cs index aaaaea7e..8eae9b0f 100644 --- a/TransactionProcessor.IntegrationTesting.Helpers/SubscriptionsHelper.cs +++ b/TransactionProcessor.IntegrationTesting.Helpers/SubscriptionsHelper.cs @@ -13,6 +13,7 @@ public static class SubscriptionsHelper ("$ce-FileImportLogAggregate", "Transaction Processor", 0), ("$ce-FloatAggregate", "Transaction Processor", 0), ("$ce-MerchantAggregate", "Transaction Processor", 0), + ("$ce-MerchantScheduleAggregate", "Transaction Processor", 0), ("$ce-MerchantStatementAggregate", "Transaction Processor", 0), ("$ce-OperatorAggregate", "Transaction Processor", 0), ("$ce-ReconciliationAggregate", "Transaction Processor", 0), diff --git a/TransactionProcessor.IntegrationTesting.Helpers/TransactionProcessorSteps.cs b/TransactionProcessor.IntegrationTesting.Helpers/TransactionProcessorSteps.cs index 3245d971..91bc1557 100644 --- a/TransactionProcessor.IntegrationTesting.Helpers/TransactionProcessorSteps.cs +++ b/TransactionProcessor.IntegrationTesting.Helpers/TransactionProcessorSteps.cs @@ -3,6 +3,7 @@ using TransactionProcessor.DataTransferObjects.Requests.Contract; using TransactionProcessor.DataTransferObjects.Requests.Estate; using TransactionProcessor.DataTransferObjects.Requests.Merchant; +using TransactionProcessor.DataTransferObjects.Requests.MerchantSchedule; using TransactionProcessor.DataTransferObjects.Requests.Operator; using TransactionProcessor.DataTransferObjects.Responses.Contract; using TransactionProcessor.DataTransferObjects.Responses.Estate; @@ -186,6 +187,42 @@ await this.TransactionProcessorClient.SetMerchantSettlementSchedule(accessToken, } } + public async Task WhenICreateTheFollowingMerchantSchedules(String accessToken, + List<(EstateDetails estate, Guid merchantId, CreateMerchantScheduleRequest request)> requests) + { + foreach ((EstateDetails estate, Guid merchantId, CreateMerchantScheduleRequest request) scheduleRequest in requests) + { + Result result = await this.TransactionProcessorClient.CreateMerchantSchedule(accessToken, + scheduleRequest.estate.EstateId, + scheduleRequest.merchantId, + scheduleRequest.request, + CancellationToken.None); + + result.IsSuccess.ShouldBeTrue(); + + await Retry.For(async () => { + Result getMerchantScheduleResult = await this.TransactionProcessorClient.GetMerchantScheduleFromReadModel(accessToken, + scheduleRequest.estate.EstateId, + scheduleRequest.merchantId, + scheduleRequest.request.Year, + CancellationToken.None); + + getMerchantScheduleResult.IsSuccess.ShouldBeTrue(); + MerchantScheduleResponse merchantSchedule = getMerchantScheduleResult.Data; + merchantSchedule.ShouldNotBeNull(); + + merchantSchedule.Year.ShouldBe(scheduleRequest.request.Year); + merchantSchedule.Months.Count.ShouldBe(scheduleRequest.request.Months.Count); + + foreach (MerchantScheduleMonthRequest expectedMonth in scheduleRequest.request.Months.OrderBy(m => m.Month)) + { + MerchantScheduleMonthResponse actualMonth = merchantSchedule.Months.Single(m => m.Month == expectedMonth.Month); + actualMonth.ClosedDays.OrderBy(day => day).ToList().ShouldBe(expectedMonth.ClosedDays.OrderBy(day => day).ToList()); + } + }); + } + } + public async Task WhenISwapTheMerchantDeviceTheDeviceIsSwapped(String accessToken, List<(EstateDetails, Guid, String, SwapMerchantDeviceRequest)> requests) { foreach ((EstateDetails, Guid, String, SwapMerchantDeviceRequest) request in requests) @@ -1326,4 +1363,4 @@ await Retry.For(async () => { }); } -} \ No newline at end of file +} diff --git a/TransactionProcessor.IntegrationTests/Features/LogonTransaction.feature.cs b/TransactionProcessor.IntegrationTests/Features/LogonTransaction.feature.cs index cd71fc62..c6455e27 100644 --- a/TransactionProcessor.IntegrationTests/Features/LogonTransaction.feature.cs +++ b/TransactionProcessor.IntegrationTests/Features/LogonTransaction.feature.cs @@ -111,95 +111,95 @@ public void ScenarioInitialize(global::Reqnroll.ScenarioInfo scenarioInfo, globa { #line 4 #line hidden - global::Reqnroll.Table table25 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table41 = new global::Reqnroll.Table(new string[] { "Name", "DisplayName", "Description"}); - table25.AddRow(new string[] { + table41.AddRow(new string[] { "estateManagement", "Estate Managememt REST Scope", "A scope for Estate Managememt REST"}); - table25.AddRow(new string[] { + table41.AddRow(new string[] { "transactionProcessor", "Transaction Processor REST Scope", "A scope for Transaction Processor REST"}); #line 6 - await testRunner.GivenAsync("I create the following api scopes", ((string)(null)), table25, "Given "); + await testRunner.GivenAsync("I create the following api scopes", ((string)(null)), table41, "Given "); #line hidden - global::Reqnroll.Table table26 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table42 = new global::Reqnroll.Table(new string[] { "Name", "DisplayName", "Secret", "Scopes", "UserClaims"}); - table26.AddRow(new string[] { + table42.AddRow(new string[] { "estateManagement", "Estate Managememt REST", "Secret1", "estateManagement", "MerchantId, EstateId, role"}); - table26.AddRow(new string[] { + table42.AddRow(new string[] { "transactionProcessor", "Transaction Processor REST", "Secret1", "transactionProcessor", ""}); #line 11 - await testRunner.GivenAsync("the following api resources exist", ((string)(null)), table26, "Given "); + await testRunner.GivenAsync("the following api resources exist", ((string)(null)), table42, "Given "); #line hidden - global::Reqnroll.Table table27 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table43 = new global::Reqnroll.Table(new string[] { "ClientId", "ClientName", "Secret", "Scopes", "GrantTypes"}); - table27.AddRow(new string[] { + table43.AddRow(new string[] { "serviceClient", "Service Client", "Secret1", "estateManagement,transactionProcessor", "client_credentials"}); #line 16 - await testRunner.GivenAsync("the following clients exist", ((string)(null)), table27, "Given "); + await testRunner.GivenAsync("the following clients exist", ((string)(null)), table43, "Given "); #line hidden - global::Reqnroll.Table table28 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table44 = new global::Reqnroll.Table(new string[] { "ClientId"}); - table28.AddRow(new string[] { + table44.AddRow(new string[] { "serviceClient"}); #line 20 await testRunner.GivenAsync("I have a token to access the estate management and transaction processor resource" + - "s", ((string)(null)), table28, "Given "); + "s", ((string)(null)), table44, "Given "); #line hidden - global::Reqnroll.Table table29 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table45 = new global::Reqnroll.Table(new string[] { "EstateName"}); - table29.AddRow(new string[] { + table45.AddRow(new string[] { "Test Estate 1"}); #line 24 - await testRunner.GivenAsync("I have created the following estates", ((string)(null)), table29, "Given "); + await testRunner.GivenAsync("I have created the following estates", ((string)(null)), table45, "Given "); #line hidden - global::Reqnroll.Table table30 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table46 = new global::Reqnroll.Table(new string[] { "EstateName", "OperatorName", "RequireCustomMerchantNumber", "RequireCustomTerminalNumber"}); - table30.AddRow(new string[] { + table46.AddRow(new string[] { "Test Estate 1", "Test Operator 1", "False", "False"}); #line 28 - await testRunner.GivenAsync("I have created the following operators", ((string)(null)), table30, "Given "); + await testRunner.GivenAsync("I have created the following operators", ((string)(null)), table46, "Given "); #line hidden - global::Reqnroll.Table table31 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table47 = new global::Reqnroll.Table(new string[] { "EstateName", "OperatorName"}); - table31.AddRow(new string[] { + table47.AddRow(new string[] { "Test Estate 1", "Test Operator 1"}); #line 32 - await testRunner.AndAsync("I have assigned the following operators to the estates", ((string)(null)), table31, "And "); + await testRunner.AndAsync("I have assigned the following operators to the estates", ((string)(null)), table47, "And "); #line hidden - global::Reqnroll.Table table32 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table48 = new global::Reqnroll.Table(new string[] { "MerchantName", "AddressLine1", "Town", @@ -209,7 +209,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "ContactName", "EmailAddress", "EstateName"}); - table32.AddRow(new string[] { + table48.AddRow(new string[] { "Test Merchant 1", "Address Line 1", "TestTown", @@ -219,7 +219,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "Test Contact 1", "testcontact1@merchant1.co.uk", "Test Estate 1"}); - table32.AddRow(new string[] { + table48.AddRow(new string[] { "Test Merchant 2", "Address Line 1", "TestTown", @@ -229,7 +229,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "Test Contact 2", "testcontact2@merchant2.co.uk", "Test Estate 1"}); - table32.AddRow(new string[] { + table48.AddRow(new string[] { "Test Merchant 3", "Address Line 1", "TestTown", @@ -239,7 +239,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "Test Contact 3", "testcontact3@merchant2.co.uk", "Test Estate 1"}); - table32.AddRow(new string[] { + table48.AddRow(new string[] { "Test Merchant 4", "Address Line 1", "TestTown", @@ -249,7 +249,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "Test Contact 4", "testcontact4@merchant2.co.uk", "Test Estate 1"}); - table32.AddRow(new string[] { + table48.AddRow(new string[] { "Test Merchant 5", "Address Line 1", "TestTown", @@ -259,7 +259,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "Test Contact 5", "testcontact5@merchant2.co.uk", "Test Estate 1"}); - table32.AddRow(new string[] { + table48.AddRow(new string[] { "Test Merchant 6", "Address Line 1", "TestTown", @@ -269,7 +269,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "Test Contact 6", "testcontact6@merchant2.co.uk", "Test Estate 1"}); - table32.AddRow(new string[] { + table48.AddRow(new string[] { "Test Merchant 7", "Address Line 1", "TestTown", @@ -280,58 +280,58 @@ await testRunner.GivenAsync("I have a token to access the estate management and "testcontact7@merchant2.co.uk", "Test Estate 1"}); #line 36 - await testRunner.GivenAsync("I create the following merchants", ((string)(null)), table32, "Given "); + await testRunner.GivenAsync("I create the following merchants", ((string)(null)), table48, "Given "); #line hidden - global::Reqnroll.Table table33 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table49 = new global::Reqnroll.Table(new string[] { "OperatorName", "MerchantName", "MerchantNumber", "TerminalNumber", "EstateName"}); - table33.AddRow(new string[] { + table49.AddRow(new string[] { "Test Operator 1", "Test Merchant 1", "00000001", "10000001", "Test Estate 1"}); - table33.AddRow(new string[] { + table49.AddRow(new string[] { "Test Operator 1", "Test Merchant 2", "00000001", "10000001", "Test Estate 1"}); - table33.AddRow(new string[] { + table49.AddRow(new string[] { "Test Operator 1", "Test Merchant 3", "00000001", "10000001", "Test Estate 1"}); - table33.AddRow(new string[] { + table49.AddRow(new string[] { "Test Operator 1", "Test Merchant 4", "00000001", "10000001", "Test Estate 1"}); - table33.AddRow(new string[] { + table49.AddRow(new string[] { "Test Operator 1", "Test Merchant 5", "00000001", "10000001", "Test Estate 1"}); - table33.AddRow(new string[] { + table49.AddRow(new string[] { "Test Operator 1", "Test Merchant 6", "00000001", "10000001", "Test Estate 1"}); - table33.AddRow(new string[] { + table49.AddRow(new string[] { "Test Operator 1", "Test Merchant 7", "00000001", "10000001", "Test Estate 1"}); #line 46 - await testRunner.GivenAsync("I have assigned the following operator to the merchants", ((string)(null)), table33, "Given "); + await testRunner.GivenAsync("I have assigned the following operator to the merchants", ((string)(null)), table49, "Given "); #line hidden } @@ -365,28 +365,28 @@ await testRunner.GivenAsync("I have a token to access the estate management and #line 4 await this.FeatureBackgroundAsync(); #line hidden - global::Reqnroll.Table table34 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table50 = new global::Reqnroll.Table(new string[] { "DateTime", "TransactionNumber", "TransactionType", "MerchantName", "DeviceIdentifier", "EstateName"}); - table34.AddRow(new string[] { + table50.AddRow(new string[] { "Today", "1", "Logon", "Test Merchant 1", "123456780", "Test Estate 1"}); - table34.AddRow(new string[] { + table50.AddRow(new string[] { "Today", "2", "Logon", "Test Merchant 2", "123456781", "Test Estate 1"}); - table34.AddRow(new string[] { + table50.AddRow(new string[] { "Today", "3", "Logon", @@ -394,56 +394,56 @@ await testRunner.GivenAsync("I have a token to access the estate management and "123456782", "Test Estate 1"}); #line 59 - await testRunner.WhenAsync("I perform the following transactions", ((string)(null)), table34, "When "); + await testRunner.WhenAsync("I perform the following transactions", ((string)(null)), table50, "When "); #line hidden - global::Reqnroll.Table table35 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table51 = new global::Reqnroll.Table(new string[] { "EstateName", "MerchantName", "TransactionNumber", "ResponseCode", "ResponseMessage"}); - table35.AddRow(new string[] { + table51.AddRow(new string[] { "Test Estate 1", "Test Merchant 1", "1", "0001", "SUCCESS"}); - table35.AddRow(new string[] { + table51.AddRow(new string[] { "Test Estate 1", "Test Merchant 2", "2", "0001", "SUCCESS"}); - table35.AddRow(new string[] { + table51.AddRow(new string[] { "Test Estate 1", "Test Merchant 3", "3", "0001", "SUCCESS"}); #line 65 - await testRunner.ThenAsync("transaction response should contain the following information", ((string)(null)), table35, "Then "); + await testRunner.ThenAsync("transaction response should contain the following information", ((string)(null)), table51, "Then "); #line hidden - global::Reqnroll.Table table36 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table52 = new global::Reqnroll.Table(new string[] { "DeviceIdentifier", "MerchantName", "MerchantNumber", "EstateName"}); - table36.AddRow(new string[] { + table52.AddRow(new string[] { "123456783", "Test Merchant 4", "00000001", "Test Estate 1"}); #line 71 - await testRunner.GivenAsync("I have assigned the following devices to the merchants", ((string)(null)), table36, "Given "); + await testRunner.GivenAsync("I have assigned the following devices to the merchants", ((string)(null)), table52, "Given "); #line hidden - global::Reqnroll.Table table37 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table53 = new global::Reqnroll.Table(new string[] { "DateTime", "TransactionNumber", "TransactionType", "MerchantName", "DeviceIdentifier", "EstateName"}); - table37.AddRow(new string[] { + table53.AddRow(new string[] { "Today", "4", "Logon", @@ -451,31 +451,31 @@ await testRunner.GivenAsync("I have a token to access the estate management and "123456783", "Test Estate 1"}); #line 75 - await testRunner.WhenAsync("I perform the following transactions", ((string)(null)), table37, "When "); + await testRunner.WhenAsync("I perform the following transactions", ((string)(null)), table53, "When "); #line hidden - global::Reqnroll.Table table38 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table54 = new global::Reqnroll.Table(new string[] { "EstateName", "MerchantName", "TransactionNumber", "ResponseCode", "ResponseMessage"}); - table38.AddRow(new string[] { + table54.AddRow(new string[] { "Test Estate 1", "Test Merchant 4", "4", "0000", "SUCCESS"}); #line 79 - await testRunner.ThenAsync("transaction response should contain the following information", ((string)(null)), table38, "Then "); + await testRunner.ThenAsync("transaction response should contain the following information", ((string)(null)), table54, "Then "); #line hidden - global::Reqnroll.Table table39 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table55 = new global::Reqnroll.Table(new string[] { "DateTime", "TransactionNumber", "TransactionType", "MerchantName", "DeviceIdentifier", "EstateName"}); - table39.AddRow(new string[] { + table55.AddRow(new string[] { "Today", "5", "Logon", @@ -483,31 +483,31 @@ await testRunner.GivenAsync("I have a token to access the estate management and "13579135", "Test Estate 1"}); #line 83 - await testRunner.WhenAsync("I perform the following transactions", ((string)(null)), table39, "When "); + await testRunner.WhenAsync("I perform the following transactions", ((string)(null)), table55, "When "); #line hidden - global::Reqnroll.Table table40 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table56 = new global::Reqnroll.Table(new string[] { "EstateName", "MerchantName", "TransactionNumber", "ResponseCode", "ResponseMessage"}); - table40.AddRow(new string[] { + table56.AddRow(new string[] { "Test Estate 1", "Test Merchant 1", "5", "1000", "Device Identifier 13579135 not valid for Merchant Test Merchant 1"}); #line 87 - await testRunner.ThenAsync("transaction response should contain the following information", ((string)(null)), table40, "Then "); + await testRunner.ThenAsync("transaction response should contain the following information", ((string)(null)), table56, "Then "); #line hidden - global::Reqnroll.Table table41 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table57 = new global::Reqnroll.Table(new string[] { "DateTime", "TransactionNumber", "TransactionType", "MerchantName", "DeviceIdentifier", "EstateName"}); - table41.AddRow(new string[] { + table57.AddRow(new string[] { "Today", "6", "Logon", @@ -515,31 +515,31 @@ await testRunner.GivenAsync("I have a token to access the estate management and "123456785", "InvalidEstate"}); #line 91 - await testRunner.WhenAsync("I perform the following transactions", ((string)(null)), table41, "When "); + await testRunner.WhenAsync("I perform the following transactions", ((string)(null)), table57, "When "); #line hidden - global::Reqnroll.Table table42 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table58 = new global::Reqnroll.Table(new string[] { "EstateName", "MerchantName", "TransactionNumber", "ResponseCode", "ResponseMessage"}); - table42.AddRow(new string[] { + table58.AddRow(new string[] { "InvalidEstate", "Test Merchant 1", "6", "1001", "Estate Id [79902550-64df-4491-b0c1-4e78943928a3] is not a valid estate"}); #line 95 - await testRunner.ThenAsync("transaction response should contain the following information", ((string)(null)), table42, "Then "); + await testRunner.ThenAsync("transaction response should contain the following information", ((string)(null)), table58, "Then "); #line hidden - global::Reqnroll.Table table43 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table59 = new global::Reqnroll.Table(new string[] { "DateTime", "TransactionNumber", "TransactionType", "MerchantName", "DeviceIdentifier", "EstateName"}); - table43.AddRow(new string[] { + table59.AddRow(new string[] { "Today", "7", "Logon", @@ -547,15 +547,15 @@ await testRunner.GivenAsync("I have a token to access the estate management and "123456786", "Test Estate 1"}); #line 99 - await testRunner.WhenAsync("I perform the following transactions", ((string)(null)), table43, "When "); + await testRunner.WhenAsync("I perform the following transactions", ((string)(null)), table59, "When "); #line hidden - global::Reqnroll.Table table44 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table60 = new global::Reqnroll.Table(new string[] { "EstateName", "MerchantName", "TransactionNumber", "ResponseCode", "ResponseMessage"}); - table44.AddRow(new string[] { + table60.AddRow(new string[] { "Test Estate 1", "InvalidMerchant", "7", @@ -563,7 +563,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "Merchant Id [d59320fa-4c3e-4900-a999-483f6a10c69a] is not a valid merchant for es" + "tate [Test Estate 1]"}); #line 103 - await testRunner.ThenAsync("transaction response should contain the following information", ((string)(null)), table44, "Then "); + await testRunner.ThenAsync("transaction response should contain the following information", ((string)(null)), table60, "Then "); #line hidden } await this.ScenarioCleanupAsync(); diff --git a/TransactionProcessor.IntegrationTests/Features/Merchant.feature b/TransactionProcessor.IntegrationTests/Features/Merchant.feature index b3123f88..eae3564c 100644 --- a/TransactionProcessor.IntegrationTests/Features/Merchant.feature +++ b/TransactionProcessor.IntegrationTests/Features/Merchant.feature @@ -59,6 +59,10 @@ Scenario: Create Merchant When I set the following opening hours | MerchantName | MondayOpening | MondayClosing | TuesdayOpening | TuesdayClosing | WednesdayOpening | WednesdayClosing | ThursdayOpening | ThursdayClosing | FridayOpening | FridayClosing | SaturdayOpening | SaturdayClosing | SundayOpening | SundayClosing | EstateName | | Test Merchant 1 | 0800 | 1700 | 0800 | 1700 | 0800 | 1700 | 0800 | 1700 | 0800 | 1700 | 0800 | 1700 | 0800 | 1700 | Test Estate 1 | + When I create the following merchant schedules + | MerchantName | EstateName | Year | Month | ClosedDays | + | Test Merchant 1 | Test Estate 1 | 2026 | 1 | 1 | + | Test Merchant 1 | Test Estate 1 | 2026 | 12 | 25,26 | When I assign the following operator to the merchants | OperatorName | MerchantName | MerchantNumber | TerminalNumber | EstateName | | Test Operator 1 | Test Merchant 1 | 00000001 | 10000001 | Test Estate 1 | @@ -186,4 +190,3 @@ Scenario: Update Merchant | TestDevice1 | TestDevice2 | Test Merchant 1 | Test Estate 1 | When I remove the contract 'Safaricom Contract' from merchant 'Test Merchant 1' on 'Test Estate 1' the contract is removed When I remove the operator 'Test Operator 1' from merchant 'Test Merchant 1' on 'Test Estate 1' the operator is removed - diff --git a/TransactionProcessor.IntegrationTests/Features/Merchant.feature.cs b/TransactionProcessor.IntegrationTests/Features/Merchant.feature.cs index 291e0e99..911c5485 100644 --- a/TransactionProcessor.IntegrationTests/Features/Merchant.feature.cs +++ b/TransactionProcessor.IntegrationTests/Features/Merchant.feature.cs @@ -111,139 +111,139 @@ public void ScenarioInitialize(global::Reqnroll.ScenarioInfo scenarioInfo, globa { #line 4 #line hidden - global::Reqnroll.Table table1 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table61 = new global::Reqnroll.Table(new string[] { "Role Name"}); - table1.AddRow(new string[] { + table61.AddRow(new string[] { "Estate"}); - table1.AddRow(new string[] { + table61.AddRow(new string[] { "Merchant"}); #line 6 - await testRunner.GivenAsync("the following security roles exist", ((string)(null)), table1, "Given "); + await testRunner.GivenAsync("the following security roles exist", ((string)(null)), table61, "Given "); #line hidden - global::Reqnroll.Table table2 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table62 = new global::Reqnroll.Table(new string[] { "Name", "DisplayName", "Description"}); - table2.AddRow(new string[] { + table62.AddRow(new string[] { "estateManagement", "Estate Managememt REST Scope", "A scope for Estate Managememt REST"}); #line 11 - await testRunner.GivenAsync("I create the following api scopes", ((string)(null)), table2, "Given "); + await testRunner.GivenAsync("I create the following api scopes", ((string)(null)), table62, "Given "); #line hidden - global::Reqnroll.Table table3 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table63 = new global::Reqnroll.Table(new string[] { "Name", "DisplayName", "Secret", "Scopes", "UserClaims"}); - table3.AddRow(new string[] { + table63.AddRow(new string[] { "estateManagement", "Estate Managememt REST", "Secret1", "estateManagement", "merchantId, estateId, role"}); #line 15 - await testRunner.GivenAsync("the following api resources exist", ((string)(null)), table3, "Given "); + await testRunner.GivenAsync("the following api resources exist", ((string)(null)), table63, "Given "); #line hidden - global::Reqnroll.Table table4 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table64 = new global::Reqnroll.Table(new string[] { "ClientId", "ClientName", "Secret", "Scopes", "GrantTypes"}); - table4.AddRow(new string[] { + table64.AddRow(new string[] { "serviceClient", "Service Client", "Secret1", "estateManagement", "client_credentials"}); - table4.AddRow(new string[] { + table64.AddRow(new string[] { "estateClient", "Estate Client", "Secret1", "estateManagement", "password"}); #line 19 - await testRunner.GivenAsync("the following clients exist", ((string)(null)), table4, "Given "); + await testRunner.GivenAsync("the following clients exist", ((string)(null)), table64, "Given "); #line hidden - global::Reqnroll.Table table5 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table65 = new global::Reqnroll.Table(new string[] { "ClientId"}); - table5.AddRow(new string[] { + table65.AddRow(new string[] { "serviceClient"}); #line 24 - await testRunner.GivenAsync("I have a token to access the estate management resource", ((string)(null)), table5, "Given "); + await testRunner.GivenAsync("I have a token to access the estate management resource", ((string)(null)), table65, "Given "); #line hidden - global::Reqnroll.Table table6 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table66 = new global::Reqnroll.Table(new string[] { "EstateName"}); - table6.AddRow(new string[] { + table66.AddRow(new string[] { "Test Estate 1"}); - table6.AddRow(new string[] { + table66.AddRow(new string[] { "Test Estate 2"}); #line 28 - await testRunner.GivenAsync("I have created the following estates", ((string)(null)), table6, "Given "); + await testRunner.GivenAsync("I have created the following estates", ((string)(null)), table66, "Given "); #line hidden - global::Reqnroll.Table table7 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table67 = new global::Reqnroll.Table(new string[] { "EstateName", "OperatorName", "RequireCustomMerchantNumber", "RequireCustomTerminalNumber"}); - table7.AddRow(new string[] { + table67.AddRow(new string[] { "Test Estate 1", "Test Operator 1", "False", "False"}); - table7.AddRow(new string[] { + table67.AddRow(new string[] { "Test Estate 2", "Test Operator 1", "False", "False"}); #line 33 - await testRunner.GivenAsync("I have created the following operators", ((string)(null)), table7, "Given "); + await testRunner.GivenAsync("I have created the following operators", ((string)(null)), table67, "Given "); #line hidden - global::Reqnroll.Table table8 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table68 = new global::Reqnroll.Table(new string[] { "EstateName", "OperatorName"}); - table8.AddRow(new string[] { + table68.AddRow(new string[] { "Test Estate 1", "Test Operator 1"}); - table8.AddRow(new string[] { + table68.AddRow(new string[] { "Test Estate 2", "Test Operator 1"}); #line 38 - await testRunner.AndAsync("I have assigned the following operators to the estates", ((string)(null)), table8, "And "); + await testRunner.AndAsync("I have assigned the following operators to the estates", ((string)(null)), table68, "And "); #line hidden - global::Reqnroll.Table table9 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table69 = new global::Reqnroll.Table(new string[] { "EstateName", "OperatorName", "ContractDescription"}); - table9.AddRow(new string[] { + table69.AddRow(new string[] { "Test Estate 1", "Test Operator 1", "Safaricom Contract"}); #line 43 - await testRunner.GivenAsync("I create a contract with the following values", ((string)(null)), table9, "Given "); + await testRunner.GivenAsync("I create a contract with the following values", ((string)(null)), table69, "Given "); #line hidden - global::Reqnroll.Table table10 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table70 = new global::Reqnroll.Table(new string[] { "EmailAddress", "Password", "GivenName", "FamilyName", "EstateName"}); - table10.AddRow(new string[] { + table70.AddRow(new string[] { "estateuser1@testestate1.co.uk", "123456", "TestEstate", "User1", "Test Estate 1"}); - table10.AddRow(new string[] { + table70.AddRow(new string[] { "estateuser1@testestate2.co.uk", "123456", "TestEstate", "User1", "Test Estate 2"}); #line 47 - await testRunner.GivenAsync("I have created the following security users", ((string)(null)), table10, "Given "); + await testRunner.GivenAsync("I have created the following security users", ((string)(null)), table70, "Given "); #line hidden } @@ -306,7 +306,7 @@ public void ScenarioInitialize(global::Reqnroll.ScenarioInfo scenarioInfo, globa #line 4 await this.FeatureBackgroundAsync(); #line hidden - global::Reqnroll.Table table11 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table71 = new global::Reqnroll.Table(new string[] { "MerchantName", "AddressLine1", "Town", @@ -317,7 +317,7 @@ public void ScenarioInitialize(global::Reqnroll.ScenarioInfo scenarioInfo, globa "EmailAddress", "EstateName", "SettlementSchedule"}); - table11.AddRow(new string[] { + table71.AddRow(new string[] { "Test Merchant 1", "Address Line 1", "TestTown", @@ -329,9 +329,9 @@ public void ScenarioInitialize(global::Reqnroll.ScenarioInfo scenarioInfo, globa "Test Estate 1", "Weekly"}); #line 56 - await testRunner.WhenAsync("I create the following merchants", ((string)(null)), table11, "When "); + await testRunner.WhenAsync("I create the following merchants", ((string)(null)), table71, "When "); #line hidden - global::Reqnroll.Table table12 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table72 = new global::Reqnroll.Table(new string[] { "MerchantName", "MondayOpening", "MondayClosing", @@ -348,7 +348,7 @@ public void ScenarioInitialize(global::Reqnroll.ScenarioInfo scenarioInfo, globa "SundayOpening", "SundayClosing", "EstateName"}); - table12.AddRow(new string[] { + table72.AddRow(new string[] { "Test Merchant 1", "0800", "1700", @@ -366,191 +366,212 @@ public void ScenarioInitialize(global::Reqnroll.ScenarioInfo scenarioInfo, globa "1700", "Test Estate 1"}); #line 59 - await testRunner.WhenAsync("I set the following opening hours", ((string)(null)), table12, "When "); + await testRunner.WhenAsync("I set the following opening hours", ((string)(null)), table72, "When "); #line hidden - global::Reqnroll.Table table13 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table73 = new global::Reqnroll.Table(new string[] { + "MerchantName", + "EstateName", + "Year", + "Month", + "ClosedDays"}); + table73.AddRow(new string[] { + "Test Merchant 1", + "Test Estate 1", + "2026", + "1", + "1"}); + table73.AddRow(new string[] { + "Test Merchant 1", + "Test Estate 1", + "2026", + "12", + "25,26"}); +#line 62 + await testRunner.WhenAsync("I create the following merchant schedules", ((string)(null)), table73, "When "); +#line hidden + global::Reqnroll.Table table74 = new global::Reqnroll.Table(new string[] { "OperatorName", "MerchantName", "MerchantNumber", "TerminalNumber", "EstateName"}); - table13.AddRow(new string[] { + table74.AddRow(new string[] { "Test Operator 1", "Test Merchant 1", "00000001", "10000001", "Test Estate 1"}); -#line 62 - await testRunner.WhenAsync("I assign the following operator to the merchants", ((string)(null)), table13, "When "); +#line 66 + await testRunner.WhenAsync("I assign the following operator to the merchants", ((string)(null)), table74, "When "); #line hidden - global::Reqnroll.Table table14 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table75 = new global::Reqnroll.Table(new string[] { "EmailAddress", "Password", "GivenName", "FamilyName", "MerchantName", "EstateName"}); - table14.AddRow(new string[] { + table75.AddRow(new string[] { "merchantuser1@testmerchant1.co.uk", "123456", "TestMerchant", "User1", "Test Merchant 1", "Test Estate 1"}); -#line 65 - await testRunner.WhenAsync("I create the following security users", ((string)(null)), table14, "When "); +#line 69 + await testRunner.WhenAsync("I create the following security users", ((string)(null)), table75, "When "); #line hidden - global::Reqnroll.Table table15 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table76 = new global::Reqnroll.Table(new string[] { "DeviceIdentifier", "MerchantName", "EstateName"}); - table15.AddRow(new string[] { + table76.AddRow(new string[] { "TestDevice1", "Test Merchant 1", "Test Estate 1"}); -#line 68 - await testRunner.WhenAsync("I add the following devices to the merchant", ((string)(null)), table15, "When "); +#line 72 + await testRunner.WhenAsync("I add the following devices to the merchant", ((string)(null)), table76, "When "); #line hidden - global::Reqnroll.Table table16 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table77 = new global::Reqnroll.Table(new string[] { "OriginalDeviceIdentifier", "NewDeviceIdentifier", "MerchantName", "EstateName"}); - table16.AddRow(new string[] { + table77.AddRow(new string[] { "TestDevice1", "TestDevice2", "Test Merchant 1", "Test Estate 1"}); -#line 71 - await testRunner.WhenAsync("I swap the merchant device the device is swapped", ((string)(null)), table16, "When "); +#line 75 + await testRunner.WhenAsync("I swap the merchant device the device is swapped", ((string)(null)), table77, "When "); #line hidden - global::Reqnroll.Table table17 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table78 = new global::Reqnroll.Table(new string[] { "Reference", "Amount", "DateTime", "MerchantName", "EstateName"}); - table17.AddRow(new string[] { + table78.AddRow(new string[] { "Deposit1", "500.00", "LastMonth", "Test Merchant 1", "Test Estate 1"}); - table17.AddRow(new string[] { + table78.AddRow(new string[] { "Deposit2", "1000.00", "LastWeek", "Test Merchant 1", "Test Estate 1"}); - table17.AddRow(new string[] { + table78.AddRow(new string[] { "Deposit3", "1000.00", "Yesterday", "Test Merchant 1", "Test Estate 1"}); - table17.AddRow(new string[] { + table78.AddRow(new string[] { "Deposit4", "400.00", "Today", "Test Merchant 1", "Test Estate 1"}); -#line 74 - await testRunner.WhenAsync("I make the following manual merchant deposits", ((string)(null)), table17, "When "); +#line 78 + await testRunner.WhenAsync("I make the following manual merchant deposits", ((string)(null)), table78, "When "); #line hidden - global::Reqnroll.Table table18 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table79 = new global::Reqnroll.Table(new string[] { "Amount", "DateTime", "MerchantName", "EstateName"}); - table18.AddRow(new string[] { + table79.AddRow(new string[] { "400.00", "LastMonth", "Test Merchant 1", "Test Estate 1"}); -#line 81 - await testRunner.WhenAsync("I make the following merchant withdrawals", ((string)(null)), table18, "When "); +#line 85 + await testRunner.WhenAsync("I make the following merchant withdrawals", ((string)(null)), table79, "When "); #line hidden - global::Reqnroll.Table table19 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table80 = new global::Reqnroll.Table(new string[] { "Amount", "DateTime", "MerchantName", "EstateName"}); - table19.AddRow(new string[] { + table80.AddRow(new string[] { "500.00", "LastMonth", "Test Merchant 1", "Test Estate 1"}); - table19.AddRow(new string[] { + table80.AddRow(new string[] { "1000.00", "LastWeek", "Test Merchant 1", "Test Estate 1"}); - table19.AddRow(new string[] { + table80.AddRow(new string[] { "1000.00", "Yesterday", "Test Merchant 1", "Test Estate 1"}); - table19.AddRow(new string[] { + table80.AddRow(new string[] { "400.00", "Today", "Test Merchant 1", "Test Estate 1"}); -#line 85 - await testRunner.WhenAsync("I make the following automatic merchant deposits", ((string)(null)), table19, "When "); +#line 89 + await testRunner.WhenAsync("I make the following automatic merchant deposits", ((string)(null)), table80, "When "); #line hidden - global::Reqnroll.Table table20 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table81 = new global::Reqnroll.Table(new string[] { "Amount", "DateTime", "MerchantName", "EstateName"}); - table20.AddRow(new string[] { + table81.AddRow(new string[] { "0", "LastMonth", "Test Merchant 1", "Test Estate 1"}); -#line 92 - await testRunner.WhenAsync("I make the following manual merchant deposits the deposit is rejected", ((string)(null)), table20, "When "); +#line 96 + await testRunner.WhenAsync("I make the following manual merchant deposits the deposit is rejected", ((string)(null)), table81, "When "); #line hidden - global::Reqnroll.Table table21 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table82 = new global::Reqnroll.Table(new string[] { "Amount", "DateTime", "MerchantName", "EstateName"}); - table21.AddRow(new string[] { + table82.AddRow(new string[] { "-100", "LastMonth", "Test Merchant 1", "Test Estate 1"}); -#line 96 - await testRunner.WhenAsync("I make the following manual merchant deposits the deposit is rejected", ((string)(null)), table21, "When "); +#line 100 + await testRunner.WhenAsync("I make the following manual merchant deposits the deposit is rejected", ((string)(null)), table82, "When "); #line hidden - global::Reqnroll.Table table22 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table83 = new global::Reqnroll.Table(new string[] { "Amount", "DateTime", "MerchantName", "EstateName"}); - table22.AddRow(new string[] { + table83.AddRow(new string[] { "0", "LastMonth", "Test Merchant 1", "Test Estate 1"}); -#line 100 - await testRunner.WhenAsync("I make the following automatic merchant deposits the deposit is rejected", ((string)(null)), table22, "When "); +#line 104 + await testRunner.WhenAsync("I make the following automatic merchant deposits the deposit is rejected", ((string)(null)), table83, "When "); #line hidden - global::Reqnroll.Table table23 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table84 = new global::Reqnroll.Table(new string[] { "Amount", "DateTime", "MerchantName", "EstateName"}); - table23.AddRow(new string[] { + table84.AddRow(new string[] { "-100", "LastMonth", "Test Merchant 1", "Test Estate 1"}); -#line 104 - await testRunner.WhenAsync("I make the following automatic merchant deposits the deposit is rejected", ((string)(null)), table23, "When "); +#line 108 + await testRunner.WhenAsync("I make the following automatic merchant deposits the deposit is rejected", ((string)(null)), table84, "When "); #line hidden - global::Reqnroll.Table table24 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table85 = new global::Reqnroll.Table(new string[] { "MerchantName", "AddressLine1", "Town", @@ -560,7 +581,7 @@ public void ScenarioInitialize(global::Reqnroll.ScenarioInfo scenarioInfo, globa "ContactName", "EmailAddress", "EstateName"}); - table24.AddRow(new string[] { + table85.AddRow(new string[] { "Test Merchant 2", "Address Line 1", "TestTown", @@ -570,7 +591,7 @@ public void ScenarioInitialize(global::Reqnroll.ScenarioInfo scenarioInfo, globa "Test Contact 1", "testcontact1@merchant1.co.uk", "Test Estate 1"}); - table24.AddRow(new string[] { + table85.AddRow(new string[] { "Test Merchant 3", "Address Line 1", "TestTown", @@ -580,7 +601,7 @@ public void ScenarioInitialize(global::Reqnroll.ScenarioInfo scenarioInfo, globa "Test Contact 1", "testcontact1@merchant1.co.uk", "Test Estate 1"}); - table24.AddRow(new string[] { + table85.AddRow(new string[] { "Test Merchant 4", "Address Line 1", "TestTown", @@ -590,27 +611,27 @@ public void ScenarioInitialize(global::Reqnroll.ScenarioInfo scenarioInfo, globa "Test Contact 1", "testcontact1@merchant1.co.uk", "Test Estate 1"}); -#line 108 - await testRunner.GivenAsync("I create the following merchants", ((string)(null)), table24, "Given "); +#line 112 + await testRunner.GivenAsync("I create the following merchants", ((string)(null)), table85, "Given "); #line hidden - global::Reqnroll.Table table25 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table86 = new global::Reqnroll.Table(new string[] { "MerchantName", "EstateName", "SettlementSchedule"}); - table25.AddRow(new string[] { + table86.AddRow(new string[] { "Test Merchant 2", "Test Estate 1", "Immediate"}); - table25.AddRow(new string[] { + table86.AddRow(new string[] { "Test Merchant 3", "Test Estate 1", "Weekly"}); - table25.AddRow(new string[] { + table86.AddRow(new string[] { "Test Merchant 4", "Test Estate 1", "Monthly"}); -#line 114 - await testRunner.WhenAsync("I set the merchants settlement schedule", ((string)(null)), table25, "When "); +#line 118 + await testRunner.WhenAsync("I set the merchants settlement schedule", ((string)(null)), table86, "When "); #line hidden } await this.ScenarioCleanupAsync(); @@ -628,7 +649,7 @@ public void ScenarioInitialize(global::Reqnroll.ScenarioInfo scenarioInfo, globa global::Reqnroll.ScenarioInfo scenarioInfo = new global::Reqnroll.ScenarioInfo("Get Merchants for Estate", null, tagsOfScenario, argumentsOfScenario, featureTags, pickleIndex); string[] tagsOfRule = ((string[])(null)); global::Reqnroll.RuleInfo ruleInfo = null; -#line 121 +#line 125 this.ScenarioInitialize(scenarioInfo, ruleInfo); #line hidden if ((global::Reqnroll.TagHelper.ContainsIgnoreTag(scenarioInfo.CombinedTags) || global::Reqnroll.TagHelper.ContainsIgnoreTag(featureTags))) @@ -641,7 +662,7 @@ public void ScenarioInitialize(global::Reqnroll.ScenarioInfo scenarioInfo, globa #line 4 await this.FeatureBackgroundAsync(); #line hidden - global::Reqnroll.Table table26 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table87 = new global::Reqnroll.Table(new string[] { "MerchantName", "AddressLine1", "Town", @@ -651,7 +672,7 @@ public void ScenarioInitialize(global::Reqnroll.ScenarioInfo scenarioInfo, globa "ContactName", "EmailAddress", "EstateName"}); - table26.AddRow(new string[] { + table87.AddRow(new string[] { "Test Merchant 1", "Address Line 1", "TestTown", @@ -661,7 +682,7 @@ public void ScenarioInitialize(global::Reqnroll.ScenarioInfo scenarioInfo, globa "Test Contact 1", "testcontact1@merchant1.co.uk", "Test Estate 1"}); - table26.AddRow(new string[] { + table87.AddRow(new string[] { "Test Merchant 2", "Address Line 1", "TestTown", @@ -671,7 +692,7 @@ public void ScenarioInitialize(global::Reqnroll.ScenarioInfo scenarioInfo, globa "Test Contact 1", "testcontact1@merchant2.co.uk", "Test Estate 1"}); - table26.AddRow(new string[] { + table87.AddRow(new string[] { "Test Merchant 3", "Address Line 1", "TestTown", @@ -681,7 +702,7 @@ public void ScenarioInitialize(global::Reqnroll.ScenarioInfo scenarioInfo, globa "Test Contact 1", "testcontact1@merchant3.co.uk", "Test Estate 1"}); - table26.AddRow(new string[] { + table87.AddRow(new string[] { "Test Merchant 4", "Address Line 1", "TestTown", @@ -691,7 +712,7 @@ public void ScenarioInitialize(global::Reqnroll.ScenarioInfo scenarioInfo, globa "Test Contact 1", "testcontact1@merchant4.co.uk", "Test Estate 2"}); - table26.AddRow(new string[] { + table87.AddRow(new string[] { "Test Merchant 5", "Address Line 1", "TestTown", @@ -701,124 +722,124 @@ public void ScenarioInitialize(global::Reqnroll.ScenarioInfo scenarioInfo, globa "Test Contact 1", "testcontact1@merchant5.co.uk", "Test Estate 2"}); -#line 122 - await testRunner.GivenAsync("I create the following merchants", ((string)(null)), table26, "Given "); +#line 126 + await testRunner.GivenAsync("I create the following merchants", ((string)(null)), table87, "Given "); #line hidden - global::Reqnroll.Table table27 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table88 = new global::Reqnroll.Table(new string[] { "OperatorName", "MerchantName", "MerchantNumber", "TerminalNumber", "EstateName"}); - table27.AddRow(new string[] { + table88.AddRow(new string[] { "Test Operator 1", "Test Merchant 1", "00000001", "10000001", "Test Estate 1"}); - table27.AddRow(new string[] { + table88.AddRow(new string[] { "Test Operator 1", "Test Merchant 2", "00000001", "10000001", "Test Estate 1"}); - table27.AddRow(new string[] { + table88.AddRow(new string[] { "Test Operator 1", "Test Merchant 3", "00000001", "10000001", "Test Estate 1"}); - table27.AddRow(new string[] { + table88.AddRow(new string[] { "Test Operator 1", "Test Merchant 4", "00000001", "10000001", "Test Estate 2"}); - table27.AddRow(new string[] { + table88.AddRow(new string[] { "Test Operator 1", "Test Merchant 5", "00000001", "10000001", "Test Estate 2"}); -#line 130 - await testRunner.WhenAsync("I assign the following operator to the merchants", ((string)(null)), table27, "When "); +#line 134 + await testRunner.WhenAsync("I assign the following operator to the merchants", ((string)(null)), table88, "When "); #line hidden - global::Reqnroll.Table table28 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table89 = new global::Reqnroll.Table(new string[] { "DeviceIdentifier", "MerchantName", "EstateName"}); - table28.AddRow(new string[] { + table89.AddRow(new string[] { "TestDevice1", "Test Merchant 1", "Test Estate 1"}); - table28.AddRow(new string[] { + table89.AddRow(new string[] { "TestDevice2", "Test Merchant 2", "Test Estate 1"}); - table28.AddRow(new string[] { + table89.AddRow(new string[] { "TestDevice3", "Test Merchant 3", "Test Estate 1"}); - table28.AddRow(new string[] { + table89.AddRow(new string[] { "TestDevice4", "Test Merchant 4", "Test Estate 2"}); - table28.AddRow(new string[] { + table89.AddRow(new string[] { "TestDevice5", "Test Merchant 5", "Test Estate 2"}); -#line 138 - await testRunner.WhenAsync("I add the following devices to the merchant", ((string)(null)), table28, "When "); +#line 142 + await testRunner.WhenAsync("I add the following devices to the merchant", ((string)(null)), table89, "When "); #line hidden - global::Reqnroll.Table table29 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table90 = new global::Reqnroll.Table(new string[] { "EmailAddress", "Password", "GivenName", "FamilyName", "MerchantName", "EstateName"}); - table29.AddRow(new string[] { + table90.AddRow(new string[] { "merchantuser1@testmerchant1.co.uk", "123456", "TestMerchant", "User1", "Test Merchant 1", "Test Estate 1"}); - table29.AddRow(new string[] { + table90.AddRow(new string[] { "merchantuser1@testmerchant2.co.uk", "123456", "TestMerchant", "User1", "Test Merchant 2", "Test Estate 1"}); - table29.AddRow(new string[] { + table90.AddRow(new string[] { "merchantuser1@testmerchant3.co.uk", "123456", "TestMerchant", "User1", "Test Merchant 3", "Test Estate 1"}); - table29.AddRow(new string[] { + table90.AddRow(new string[] { "merchantuser1@testmerchant4.co.uk", "123456", "TestMerchant", "User1", "Test Merchant 4", "Test Estate 2"}); - table29.AddRow(new string[] { + table90.AddRow(new string[] { "merchantuser1@testmerchant5.co.uk", "123456", "TestMerchant", "User1", "Test Merchant 5", "Test Estate 2"}); -#line 146 - await testRunner.WhenAsync("I create the following security users", ((string)(null)), table29, "When "); +#line 150 + await testRunner.WhenAsync("I create the following security users", ((string)(null)), table90, "When "); #line hidden -#line 154 +#line 158 await testRunner.WhenAsync("I get the merchants for \'Test Estate 1\' then 3 merchants will be returned", ((string)(null)), ((global::Reqnroll.Table)(null)), "When "); #line hidden -#line 156 +#line 160 await testRunner.WhenAsync("I get the merchants for \'Test Estate 2\' then 2 merchants will be returned", ((string)(null)), ((global::Reqnroll.Table)(null)), "When "); #line hidden } @@ -837,7 +858,7 @@ public void ScenarioInitialize(global::Reqnroll.ScenarioInfo scenarioInfo, globa global::Reqnroll.ScenarioInfo scenarioInfo = new global::Reqnroll.ScenarioInfo("Update Merchant", null, tagsOfScenario, argumentsOfScenario, featureTags, pickleIndex); string[] tagsOfRule = ((string[])(null)); global::Reqnroll.RuleInfo ruleInfo = null; -#line 159 +#line 163 this.ScenarioInitialize(scenarioInfo, ruleInfo); #line hidden if ((global::Reqnroll.TagHelper.ContainsIgnoreTag(scenarioInfo.CombinedTags) || global::Reqnroll.TagHelper.ContainsIgnoreTag(featureTags))) @@ -850,7 +871,7 @@ public void ScenarioInitialize(global::Reqnroll.ScenarioInfo scenarioInfo, globa #line 4 await this.FeatureBackgroundAsync(); #line hidden - global::Reqnroll.Table table30 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table91 = new global::Reqnroll.Table(new string[] { "MerchantName", "AddressLine1", "Town", @@ -861,7 +882,7 @@ public void ScenarioInitialize(global::Reqnroll.ScenarioInfo scenarioInfo, globa "EmailAddress", "EstateName", "SettlementSchedule"}); - table30.AddRow(new string[] { + table91.AddRow(new string[] { "Test Merchant 1", "Address Line 1", "TestTown", @@ -872,77 +893,77 @@ public void ScenarioInitialize(global::Reqnroll.ScenarioInfo scenarioInfo, globa "testcontact1@merchant1.co.uk", "Test Estate 1", "Weekly"}); -#line 160 - await testRunner.WhenAsync("I create the following merchants", ((string)(null)), table30, "When "); +#line 164 + await testRunner.WhenAsync("I create the following merchants", ((string)(null)), table91, "When "); #line hidden - global::Reqnroll.Table table31 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table92 = new global::Reqnroll.Table(new string[] { "OperatorName", "MerchantName", "MerchantNumber", "TerminalNumber", "EstateName"}); - table31.AddRow(new string[] { + table92.AddRow(new string[] { "Test Operator 1", "Test Merchant 1", "00000001", "10000001", "Test Estate 1"}); -#line 163 - await testRunner.WhenAsync("I assign the following operator to the merchants", ((string)(null)), table31, "When "); +#line 167 + await testRunner.WhenAsync("I assign the following operator to the merchants", ((string)(null)), table92, "When "); #line hidden - global::Reqnroll.Table table32 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table93 = new global::Reqnroll.Table(new string[] { "EmailAddress", "Password", "GivenName", "FamilyName", "MerchantName", "EstateName"}); - table32.AddRow(new string[] { + table93.AddRow(new string[] { "merchantuser1@testmerchant1.co.uk", "123456", "TestMerchant", "User1", "Test Merchant 1", "Test Estate 1"}); -#line 166 - await testRunner.WhenAsync("I create the following security users", ((string)(null)), table32, "When "); +#line 170 + await testRunner.WhenAsync("I create the following security users", ((string)(null)), table93, "When "); #line hidden - global::Reqnroll.Table table33 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table94 = new global::Reqnroll.Table(new string[] { "DeviceIdentifier", "MerchantName", "EstateName"}); - table33.AddRow(new string[] { + table94.AddRow(new string[] { "TestDevice1", "Test Merchant 1", "Test Estate 1"}); -#line 169 - await testRunner.WhenAsync("I add the following devices to the merchant", ((string)(null)), table33, "When "); +#line 173 + await testRunner.WhenAsync("I add the following devices to the merchant", ((string)(null)), table94, "When "); #line hidden - global::Reqnroll.Table table34 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table95 = new global::Reqnroll.Table(new string[] { "EstateName", "MerchantName", "ContractDescription"}); - table34.AddRow(new string[] { + table95.AddRow(new string[] { "Test Estate 1", "Test Merchant 1", "Safaricom Contract"}); -#line 172 - await testRunner.WhenAsync("I add the following contracts to the following merchants", ((string)(null)), table34, "When "); +#line 176 + await testRunner.WhenAsync("I add the following contracts to the following merchants", ((string)(null)), table95, "When "); #line hidden - global::Reqnroll.Table table35 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table96 = new global::Reqnroll.Table(new string[] { "UpdateMerchantName", "SettlementSchedule", "EstateName", "MerchantName"}); - table35.AddRow(new string[] { + table96.AddRow(new string[] { "Update Merchant 1", "Monthly", "Test Estate 1", "Test Merchant 1"}); -#line 175 - await testRunner.WhenAsync("I update the merchants with the following details", ((string)(null)), table35, "When "); +#line 179 + await testRunner.WhenAsync("I update the merchants with the following details", ((string)(null)), table96, "When "); #line hidden - global::Reqnroll.Table table36 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table97 = new global::Reqnroll.Table(new string[] { "AddressLine1", "AddressLine2", "AddressLine3", @@ -953,7 +974,7 @@ public void ScenarioInitialize(global::Reqnroll.ScenarioInfo scenarioInfo, globa "Country", "EstateName", "MerchantName"}); - table36.AddRow(new string[] { + table97.AddRow(new string[] { "Address Line 1U", "Address Line 2", "Address Line 3", @@ -964,42 +985,42 @@ public void ScenarioInitialize(global::Reqnroll.ScenarioInfo scenarioInfo, globa "United KingdomU", "Test Estate 1", "Test Merchant 1"}); -#line 178 - await testRunner.WhenAsync("I update the merchants address with the following details", ((string)(null)), table36, "When "); +#line 182 + await testRunner.WhenAsync("I update the merchants address with the following details", ((string)(null)), table97, "When "); #line hidden - global::Reqnroll.Table table37 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table98 = new global::Reqnroll.Table(new string[] { "ContactName", "EmailAddress", "PhoneNumber", "EstateName", "MerchantName"}); - table37.AddRow(new string[] { + table98.AddRow(new string[] { "Test Contact 1U", "testcontact1update@merchant1.co.uk", "12345678", "Test Estate 1", "Test Merchant 1"}); -#line 181 - await testRunner.WhenAsync("I update the merchants contact with the following details", ((string)(null)), table37, "When "); +#line 185 + await testRunner.WhenAsync("I update the merchants contact with the following details", ((string)(null)), table98, "When "); #line hidden - global::Reqnroll.Table table38 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table99 = new global::Reqnroll.Table(new string[] { "OriginalDeviceIdentifier", "NewDeviceIdentifier", "MerchantName", "EstateName"}); - table38.AddRow(new string[] { + table99.AddRow(new string[] { "TestDevice1", "TestDevice2", "Test Merchant 1", "Test Estate 1"}); -#line 184 - await testRunner.WhenAsync("I swap the merchant device the device is swapped", ((string)(null)), table38, "When "); +#line 188 + await testRunner.WhenAsync("I swap the merchant device the device is swapped", ((string)(null)), table99, "When "); #line hidden -#line 187 +#line 191 await testRunner.WhenAsync("I remove the contract \'Safaricom Contract\' from merchant \'Test Merchant 1\' on \'Te" + "st Estate 1\' the contract is removed", ((string)(null)), ((global::Reqnroll.Table)(null)), "When "); #line hidden -#line 188 +#line 192 await testRunner.WhenAsync("I remove the operator \'Test Operator 1\' from merchant \'Test Merchant 1\' on \'Test " + "Estate 1\' the operator is removed", ((string)(null)), ((global::Reqnroll.Table)(null)), "When "); #line hidden diff --git a/TransactionProcessor.IntegrationTests/Features/Operator.feature.cs b/TransactionProcessor.IntegrationTests/Features/Operator.feature.cs index 428bbf43..6d8b41f1 100644 --- a/TransactionProcessor.IntegrationTests/Features/Operator.feature.cs +++ b/TransactionProcessor.IntegrationTests/Features/Operator.feature.cs @@ -111,73 +111,73 @@ public void ScenarioInitialize(global::Reqnroll.ScenarioInfo scenarioInfo, globa { #line 4 #line hidden - global::Reqnroll.Table table98 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table100 = new global::Reqnroll.Table(new string[] { "Role Name"}); - table98.AddRow(new string[] { + table100.AddRow(new string[] { "Estate"}); #line 5 - await testRunner.GivenAsync("the following security roles exist", ((string)(null)), table98, "Given "); + await testRunner.GivenAsync("the following security roles exist", ((string)(null)), table100, "Given "); #line hidden - global::Reqnroll.Table table99 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table101 = new global::Reqnroll.Table(new string[] { "Name", "DisplayName", "Description"}); - table99.AddRow(new string[] { + table101.AddRow(new string[] { "estateManagement", "Estate Managememt REST Scope", "A scope for Estate Managememt REST"}); #line 9 - await testRunner.GivenAsync("I create the following api scopes", ((string)(null)), table99, "Given "); + await testRunner.GivenAsync("I create the following api scopes", ((string)(null)), table101, "Given "); #line hidden - global::Reqnroll.Table table100 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table102 = new global::Reqnroll.Table(new string[] { "Name", "DisplayName", "Secret", "Scopes", "UserClaims"}); - table100.AddRow(new string[] { + table102.AddRow(new string[] { "estateManagement", "Estate Managememt REST", "Secret1", "estateManagement", "merchantId, estateId, role"}); #line 13 - await testRunner.GivenAsync("the following api resources exist", ((string)(null)), table100, "Given "); + await testRunner.GivenAsync("the following api resources exist", ((string)(null)), table102, "Given "); #line hidden - global::Reqnroll.Table table101 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table103 = new global::Reqnroll.Table(new string[] { "ClientId", "ClientName", "Secret", "Scopes", "GrantTypes"}); - table101.AddRow(new string[] { + table103.AddRow(new string[] { "serviceClient", "Service Client", "Secret1", "estateManagement", "client_credentials"}); - table101.AddRow(new string[] { + table103.AddRow(new string[] { "estateClient", "Estate Client", "Secret1", "estateManagement", "password"}); #line 17 - await testRunner.GivenAsync("the following clients exist", ((string)(null)), table101, "Given "); + await testRunner.GivenAsync("the following clients exist", ((string)(null)), table103, "Given "); #line hidden - global::Reqnroll.Table table102 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table104 = new global::Reqnroll.Table(new string[] { "ClientId"}); - table102.AddRow(new string[] { + table104.AddRow(new string[] { "serviceClient"}); #line 22 - await testRunner.GivenAsync("I have a token to access the estate management resource", ((string)(null)), table102, "Given "); + await testRunner.GivenAsync("I have a token to access the estate management resource", ((string)(null)), table104, "Given "); #line hidden - global::Reqnroll.Table table103 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table105 = new global::Reqnroll.Table(new string[] { "EstateName"}); - table103.AddRow(new string[] { + table105.AddRow(new string[] { "Test Estate 1"}); #line 26 - await testRunner.GivenAsync("I have created the following estates", ((string)(null)), table103, "Given "); + await testRunner.GivenAsync("I have created the following estates", ((string)(null)), table105, "Given "); #line hidden } @@ -211,59 +211,59 @@ public void ScenarioInitialize(global::Reqnroll.ScenarioInfo scenarioInfo, globa #line 4 await this.FeatureBackgroundAsync(); #line hidden - global::Reqnroll.Table table104 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table106 = new global::Reqnroll.Table(new string[] { "EstateName", "OperatorName", "RequireCustomMerchantNumber", "RequireCustomTerminalNumber", "OperatorId"}); - table104.AddRow(new string[] { + table106.AddRow(new string[] { "Test Estate 1", "Test Operator 1", "True", "True", "27C722F6-208F-4F78-9A2F-993F8A8F24A3"}); - table104.AddRow(new string[] { + table106.AddRow(new string[] { "Test Estate 1", "Test Operator 2", "True", "True", "00000000-0000-0000-0000-000000000000"}); #line 33 - await testRunner.GivenAsync("I have created the following operators", ((string)(null)), table104, "Given "); + await testRunner.GivenAsync("I have created the following operators", ((string)(null)), table106, "Given "); #line hidden - global::Reqnroll.Table table105 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table107 = new global::Reqnroll.Table(new string[] { "UpdateOperatorName", "RequireCustomMerchantNumber", "RequireCustomTerminalNumber", "EstateName", "OperatorName"}); - table105.AddRow(new string[] { + table107.AddRow(new string[] { "Update Operator 1", "False", "False", "Test Estate 1", "Test Operator 1"}); #line 38 - await testRunner.WhenAsync("I update the operators with the following details", ((string)(null)), table105, "When "); + await testRunner.WhenAsync("I update the operators with the following details", ((string)(null)), table107, "When "); #line hidden - global::Reqnroll.Table table106 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table108 = new global::Reqnroll.Table(new string[] { "EstateName", "OperatorName", "RequireCustomMerchantNumber", "RequireCustomTerminalNumber"}); - table106.AddRow(new string[] { + table108.AddRow(new string[] { "Test Estate 1", "Update Operator 1", "False", "False"}); - table106.AddRow(new string[] { + table108.AddRow(new string[] { "Test Estate 1", "Test Operator 2", "True", "True"}); #line 42 - await testRunner.WhenAsync("I get all the operators the following details are returned", ((string)(null)), table106, "When "); + await testRunner.WhenAsync("I get all the operators the following details are returned", ((string)(null)), table108, "When "); #line hidden } await this.ScenarioCleanupAsync(); diff --git a/TransactionProcessor.IntegrationTests/Features/ReconciliationFeature.feature.cs b/TransactionProcessor.IntegrationTests/Features/ReconciliationFeature.feature.cs index 6d9027a8..dcc62f7a 100644 --- a/TransactionProcessor.IntegrationTests/Features/ReconciliationFeature.feature.cs +++ b/TransactionProcessor.IntegrationTests/Features/ReconciliationFeature.feature.cs @@ -111,120 +111,120 @@ public void ScenarioInitialize(global::Reqnroll.ScenarioInfo scenarioInfo, globa { #line 4 #line hidden - global::Reqnroll.Table table82 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table109 = new global::Reqnroll.Table(new string[] { "Name", "DisplayName", "Description"}); - table82.AddRow(new string[] { + table109.AddRow(new string[] { "estateManagement", "Estate Managememt REST Scope", "A scope for Estate Managememt REST"}); - table82.AddRow(new string[] { + table109.AddRow(new string[] { "transactionProcessor", "Transaction Processor REST Scope", "A scope for Transaction Processor REST"}); #line 6 - await testRunner.GivenAsync("I create the following api scopes", ((string)(null)), table82, "Given "); + await testRunner.GivenAsync("I create the following api scopes", ((string)(null)), table109, "Given "); #line hidden - global::Reqnroll.Table table83 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table110 = new global::Reqnroll.Table(new string[] { "Name", "DisplayName", "Secret", "Scopes", "UserClaims"}); - table83.AddRow(new string[] { + table110.AddRow(new string[] { "estateManagement", "Estate Managememt REST", "Secret1", "estateManagement", "MerchantId, EstateId, role"}); - table83.AddRow(new string[] { + table110.AddRow(new string[] { "transactionProcessor", "Transaction Processor REST", "Secret1", "transactionProcessor", ""}); #line 11 - await testRunner.GivenAsync("the following api resources exist", ((string)(null)), table83, "Given "); + await testRunner.GivenAsync("the following api resources exist", ((string)(null)), table110, "Given "); #line hidden - global::Reqnroll.Table table84 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table111 = new global::Reqnroll.Table(new string[] { "ClientId", "ClientName", "Secret", "Scopes", "GrantTypes"}); - table84.AddRow(new string[] { + table111.AddRow(new string[] { "serviceClient", "Service Client", "Secret1", "estateManagement,transactionProcessor", "client_credentials"}); #line 16 - await testRunner.GivenAsync("the following clients exist", ((string)(null)), table84, "Given "); + await testRunner.GivenAsync("the following clients exist", ((string)(null)), table111, "Given "); #line hidden - global::Reqnroll.Table table85 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table112 = new global::Reqnroll.Table(new string[] { "ClientId"}); - table85.AddRow(new string[] { + table112.AddRow(new string[] { "serviceClient"}); #line 20 await testRunner.GivenAsync("I have a token to access the estate management and transaction processor resource" + - "s", ((string)(null)), table85, "Given "); + "s", ((string)(null)), table112, "Given "); #line hidden - global::Reqnroll.Table table86 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table113 = new global::Reqnroll.Table(new string[] { "EstateName"}); - table86.AddRow(new string[] { + table113.AddRow(new string[] { "Test Estate 1"}); - table86.AddRow(new string[] { + table113.AddRow(new string[] { "Test Estate 2"}); #line 24 - await testRunner.GivenAsync("I have created the following estates", ((string)(null)), table86, "Given "); + await testRunner.GivenAsync("I have created the following estates", ((string)(null)), table113, "Given "); #line hidden - global::Reqnroll.Table table87 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table114 = new global::Reqnroll.Table(new string[] { "EstateName", "OperatorName", "RequireCustomMerchantNumber", "RequireCustomTerminalNumber"}); - table87.AddRow(new string[] { + table114.AddRow(new string[] { "Test Estate 1", "Safaricom", "False", "False"}); - table87.AddRow(new string[] { + table114.AddRow(new string[] { "Test Estate 2", "Safaricom", "False", "False"}); #line 29 - await testRunner.GivenAsync("I have created the following operators", ((string)(null)), table87, "Given "); + await testRunner.GivenAsync("I have created the following operators", ((string)(null)), table114, "Given "); #line hidden - global::Reqnroll.Table table88 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table115 = new global::Reqnroll.Table(new string[] { "EstateName", "OperatorName"}); - table88.AddRow(new string[] { + table115.AddRow(new string[] { "Test Estate 1", "Safaricom"}); - table88.AddRow(new string[] { + table115.AddRow(new string[] { "Test Estate 2", "Safaricom"}); #line 34 - await testRunner.AndAsync("I have assigned the following operators to the estates", ((string)(null)), table88, "And "); + await testRunner.AndAsync("I have assigned the following operators to the estates", ((string)(null)), table115, "And "); #line hidden - global::Reqnroll.Table table89 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table116 = new global::Reqnroll.Table(new string[] { "EstateName", "OperatorName", "ContractDescription"}); - table89.AddRow(new string[] { + table116.AddRow(new string[] { "Test Estate 1", "Safaricom", "Safaricom Contract"}); - table89.AddRow(new string[] { + table116.AddRow(new string[] { "Test Estate 2", "Safaricom", "Safaricom Contract"}); #line 39 - await testRunner.GivenAsync("I create a contract with the following values", ((string)(null)), table89, "Given "); + await testRunner.GivenAsync("I create a contract with the following values", ((string)(null)), table116, "Given "); #line hidden - global::Reqnroll.Table table90 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table117 = new global::Reqnroll.Table(new string[] { "EstateName", "OperatorName", "ContractDescription", @@ -232,7 +232,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "DisplayText", "Value", "ProductType"}); - table90.AddRow(new string[] { + table117.AddRow(new string[] { "Test Estate 1", "Safaricom", "Safaricom Contract", @@ -240,7 +240,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "Custom", "", "MobileTopup"}); - table90.AddRow(new string[] { + table117.AddRow(new string[] { "Test Estate 2", "Safaricom", "Safaricom Contract", @@ -249,9 +249,9 @@ await testRunner.GivenAsync("I have a token to access the estate management and "", "MobileTopup"}); #line 44 - await testRunner.WhenAsync("I create the following Products", ((string)(null)), table90, "When "); + await testRunner.WhenAsync("I create the following Products", ((string)(null)), table117, "When "); #line hidden - global::Reqnroll.Table table91 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table118 = new global::Reqnroll.Table(new string[] { "EstateName", "OperatorName", "ContractDescription", @@ -259,7 +259,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "CalculationType", "FeeDescription", "Value"}); - table91.AddRow(new string[] { + table118.AddRow(new string[] { "Test Estate 1", "Safaricom", "Safaricom Contract", @@ -267,7 +267,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "Fixed", "Merchant Commission", "2.50"}); - table91.AddRow(new string[] { + table118.AddRow(new string[] { "Test Estate 2", "Safaricom", "Safaricom Contract", @@ -276,9 +276,9 @@ await testRunner.GivenAsync("I have a token to access the estate management and "Merchant Commission", "0.85"}); #line 49 - await testRunner.WhenAsync("I add the following Transaction Fees", ((string)(null)), table91, "When "); + await testRunner.WhenAsync("I add the following Transaction Fees", ((string)(null)), table118, "When "); #line hidden - global::Reqnroll.Table table92 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table119 = new global::Reqnroll.Table(new string[] { "MerchantName", "AddressLine1", "Town", @@ -288,7 +288,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "ContactName", "EmailAddress", "EstateName"}); - table92.AddRow(new string[] { + table119.AddRow(new string[] { "Test Merchant 1", "Address Line 1", "TestTown", @@ -298,7 +298,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "Test Contact 1", "testcontact1@merchant1.co.uk", "Test Estate 1"}); - table92.AddRow(new string[] { + table119.AddRow(new string[] { "Test Merchant 2", "Address Line 1", "TestTown", @@ -308,7 +308,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "Test Contact 2", "testcontact2@merchant2.co.uk", "Test Estate 1"}); - table92.AddRow(new string[] { + table119.AddRow(new string[] { "Test Merchant 3", "Address Line 1", "TestTown", @@ -319,80 +319,80 @@ await testRunner.GivenAsync("I have a token to access the estate management and "testcontact3@merchant2.co.uk", "Test Estate 2"}); #line 54 - await testRunner.GivenAsync("I create the following merchants", ((string)(null)), table92, "Given "); + await testRunner.GivenAsync("I create the following merchants", ((string)(null)), table119, "Given "); #line hidden - global::Reqnroll.Table table93 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table120 = new global::Reqnroll.Table(new string[] { "OperatorName", "MerchantName", "MerchantNumber", "TerminalNumber", "EstateName"}); - table93.AddRow(new string[] { + table120.AddRow(new string[] { "Safaricom", "Test Merchant 1", "00000001", "10000001", "Test Estate 1"}); - table93.AddRow(new string[] { + table120.AddRow(new string[] { "Safaricom", "Test Merchant 2", "00000002", "10000002", "Test Estate 1"}); - table93.AddRow(new string[] { + table120.AddRow(new string[] { "Safaricom", "Test Merchant 3", "00000003", "10000003", "Test Estate 2"}); #line 60 - await testRunner.GivenAsync("I have assigned the following operator to the merchants", ((string)(null)), table93, "Given "); + await testRunner.GivenAsync("I have assigned the following operator to the merchants", ((string)(null)), table120, "Given "); #line hidden - global::Reqnroll.Table table94 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table121 = new global::Reqnroll.Table(new string[] { "DeviceIdentifier", "MerchantName", "EstateName"}); - table94.AddRow(new string[] { + table121.AddRow(new string[] { "123456780", "Test Merchant 1", "Test Estate 1"}); - table94.AddRow(new string[] { + table121.AddRow(new string[] { "123456781", "Test Merchant 2", "Test Estate 1"}); - table94.AddRow(new string[] { + table121.AddRow(new string[] { "123456782", "Test Merchant 3", "Test Estate 2"}); #line 66 - await testRunner.GivenAsync("I have assigned the following devices to the merchants", ((string)(null)), table94, "Given "); + await testRunner.GivenAsync("I have assigned the following devices to the merchants", ((string)(null)), table121, "Given "); #line hidden - global::Reqnroll.Table table95 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table122 = new global::Reqnroll.Table(new string[] { "Reference", "Amount", "DateTime", "MerchantName", "EstateName"}); - table95.AddRow(new string[] { + table122.AddRow(new string[] { "Deposit1", "200.00", "Today", "Test Merchant 1", "Test Estate 1"}); - table95.AddRow(new string[] { + table122.AddRow(new string[] { "Deposit1", "100.00", "Today", "Test Merchant 2", "Test Estate 1"}); - table95.AddRow(new string[] { + table122.AddRow(new string[] { "Deposit1", "100.00", "Today", "Test Merchant 3", "Test Estate 2"}); #line 72 - await testRunner.GivenAsync("I make the following manual merchant deposits", ((string)(null)), table95, "Given "); + await testRunner.GivenAsync("I make the following manual merchant deposits", ((string)(null)), table122, "Given "); #line hidden } @@ -426,7 +426,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and #line 4 await this.FeatureBackgroundAsync(); #line hidden - global::Reqnroll.Table table96 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table123 = new global::Reqnroll.Table(new string[] { "DateTime", "MerchantName", "DeviceIdentifier", @@ -434,7 +434,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "TransactionCount", "TransactionValue", "TransactionType"}); - table96.AddRow(new string[] { + table123.AddRow(new string[] { "Today", "Test Merchant 1", "123456780", @@ -442,7 +442,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "1", "100.00", "Reconciliation"}); - table96.AddRow(new string[] { + table123.AddRow(new string[] { "Today", "Test Merchant 2", "123456781", @@ -450,7 +450,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "2", "200.00", "Reconciliation"}); - table96.AddRow(new string[] { + table123.AddRow(new string[] { "Today", "Test Merchant 3", "123456782", @@ -459,30 +459,30 @@ await testRunner.GivenAsync("I have a token to access the estate management and "300.00", "Reconciliation"}); #line 81 - await testRunner.WhenAsync("I perform the following reconciliations", ((string)(null)), table96, "When "); + await testRunner.WhenAsync("I perform the following reconciliations", ((string)(null)), table123, "When "); #line hidden - global::Reqnroll.Table table97 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table124 = new global::Reqnroll.Table(new string[] { "EstateName", "MerchantName", "ResponseCode", "ResponseMessage"}); - table97.AddRow(new string[] { + table124.AddRow(new string[] { "Test Estate 1", "Test Merchant 1", "0000", "SUCCESS"}); - table97.AddRow(new string[] { + table124.AddRow(new string[] { "Test Estate 1", "Test Merchant 2", "0000", "SUCCESS"}); - table97.AddRow(new string[] { + table124.AddRow(new string[] { "Test Estate 2", "Test Merchant 3", "0000", "SUCCESS"}); #line 87 - await testRunner.ThenAsync("reconciliation response should contain the following information", ((string)(null)), table97, "Then "); + await testRunner.ThenAsync("reconciliation response should contain the following information", ((string)(null)), table124, "Then "); #line hidden } await this.ScenarioCleanupAsync(); diff --git a/TransactionProcessor.IntegrationTests/Features/RedeemVoucher.feature.cs b/TransactionProcessor.IntegrationTests/Features/RedeemVoucher.feature.cs index 3c07ae85..421652fc 100644 --- a/TransactionProcessor.IntegrationTests/Features/RedeemVoucher.feature.cs +++ b/TransactionProcessor.IntegrationTests/Features/RedeemVoucher.feature.cs @@ -111,108 +111,108 @@ public void ScenarioInitialize(global::Reqnroll.ScenarioInfo scenarioInfo, globa { #line 5 #line hidden - global::Reqnroll.Table table98 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table125 = new global::Reqnroll.Table(new string[] { "Name", "DisplayName", "Description"}); - table98.AddRow(new string[] { + table125.AddRow(new string[] { "estateManagement", "Estate Managememt REST Scope", "A scope for Estate Managememt REST"}); - table98.AddRow(new string[] { + table125.AddRow(new string[] { "voucherManagement", "Voucher Management REST Scope", "A scope for Voucher Management REST"}); #line 7 - await testRunner.GivenAsync("I create the following api scopes", ((string)(null)), table98, "Given "); + await testRunner.GivenAsync("I create the following api scopes", ((string)(null)), table125, "Given "); #line hidden - global::Reqnroll.Table table99 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table126 = new global::Reqnroll.Table(new string[] { "Name", "DisplayName", "Secret", "Scopes", "UserClaims"}); - table99.AddRow(new string[] { + table126.AddRow(new string[] { "estateManagement", "Estate Managememt REST", "Secret1", "estateManagement", "MerchantId, EstateId, role"}); - table99.AddRow(new string[] { + table126.AddRow(new string[] { "voucherManagement", "Voucher Management REST", "Secret1", "voucherManagement", ""}); #line 12 - await testRunner.GivenAsync("the following api resources exist", ((string)(null)), table99, "Given "); + await testRunner.GivenAsync("the following api resources exist", ((string)(null)), table126, "Given "); #line hidden - global::Reqnroll.Table table100 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table127 = new global::Reqnroll.Table(new string[] { "ClientId", "ClientName", "Secret", "Scopes", "GrantTypes"}); - table100.AddRow(new string[] { + table127.AddRow(new string[] { "serviceClient", "Service Client", "Secret1", "estateManagement,voucherManagement", "client_credentials"}); #line 17 - await testRunner.GivenAsync("the following clients exist", ((string)(null)), table100, "Given "); + await testRunner.GivenAsync("the following clients exist", ((string)(null)), table127, "Given "); #line hidden - global::Reqnroll.Table table101 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table128 = new global::Reqnroll.Table(new string[] { "ClientId"}); - table101.AddRow(new string[] { + table128.AddRow(new string[] { "serviceClient"}); #line 21 await testRunner.GivenAsync("I have a token to access the estate management and transaction processor resource" + - "s", ((string)(null)), table101, "Given "); + "s", ((string)(null)), table128, "Given "); #line hidden - global::Reqnroll.Table table102 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table129 = new global::Reqnroll.Table(new string[] { "EstateName"}); - table102.AddRow(new string[] { + table129.AddRow(new string[] { "Test Estate 1"}); - table102.AddRow(new string[] { + table129.AddRow(new string[] { "Test Estate 2"}); #line 25 - await testRunner.GivenAsync("I have created the following estates", ((string)(null)), table102, "Given "); + await testRunner.GivenAsync("I have created the following estates", ((string)(null)), table129, "Given "); #line hidden - global::Reqnroll.Table table103 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table130 = new global::Reqnroll.Table(new string[] { "EstateName", "OperatorName", "RequireCustomMerchantNumber", "RequireCustomTerminalNumber"}); - table103.AddRow(new string[] { + table130.AddRow(new string[] { "Test Estate 1", "Voucher", "False", "False"}); #line 30 - await testRunner.GivenAsync("I have created the following operators", ((string)(null)), table103, "Given "); + await testRunner.GivenAsync("I have created the following operators", ((string)(null)), table130, "Given "); #line hidden - global::Reqnroll.Table table104 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table131 = new global::Reqnroll.Table(new string[] { "EstateName", "OperatorName"}); - table104.AddRow(new string[] { + table131.AddRow(new string[] { "Test Estate 1", "Voucher"}); #line 34 - await testRunner.AndAsync("I have assigned the following operators to the estates", ((string)(null)), table104, "And "); + await testRunner.AndAsync("I have assigned the following operators to the estates", ((string)(null)), table131, "And "); #line hidden - global::Reqnroll.Table table105 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table132 = new global::Reqnroll.Table(new string[] { "EstateName", "OperatorName", "ContractDescription"}); - table105.AddRow(new string[] { + table132.AddRow(new string[] { "Test Estate 1", "Voucher", "Hospital 1 Contract"}); #line 38 - await testRunner.GivenAsync("I create a contract with the following values", ((string)(null)), table105, "Given "); + await testRunner.GivenAsync("I create a contract with the following values", ((string)(null)), table132, "Given "); #line hidden - global::Reqnroll.Table table106 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table133 = new global::Reqnroll.Table(new string[] { "EstateName", "OperatorName", "ContractDescription", @@ -220,7 +220,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "DisplayText", "Value", "ProductType"}); - table106.AddRow(new string[] { + table133.AddRow(new string[] { "Test Estate 1", "Voucher", "Hospital 1 Contract", @@ -229,9 +229,9 @@ await testRunner.GivenAsync("I have a token to access the estate management and "", "Voucher"}); #line 42 - await testRunner.WhenAsync("I create the following Products", ((string)(null)), table106, "When "); + await testRunner.WhenAsync("I create the following Products", ((string)(null)), table133, "When "); #line hidden - global::Reqnroll.Table table107 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table134 = new global::Reqnroll.Table(new string[] { "MerchantName", "AddressLine1", "Town", @@ -241,7 +241,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "ContactName", "EmailAddress", "EstateName"}); - table107.AddRow(new string[] { + table134.AddRow(new string[] { "Test Merchant 1", "Address Line 1", "TestTown", @@ -252,61 +252,61 @@ await testRunner.GivenAsync("I have a token to access the estate management and "testcontact1@merchant1.co.uk", "Test Estate 1"}); #line 46 - await testRunner.GivenAsync("I create the following merchants", ((string)(null)), table107, "Given "); + await testRunner.GivenAsync("I create the following merchants", ((string)(null)), table134, "Given "); #line hidden - global::Reqnroll.Table table108 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table135 = new global::Reqnroll.Table(new string[] { "OperatorName", "MerchantName", "MerchantNumber", "TerminalNumber", "EstateName"}); - table108.AddRow(new string[] { + table135.AddRow(new string[] { "Voucher", "Test Merchant 1", "00000001", "10000001", "Test Estate 1"}); #line 50 - await testRunner.GivenAsync("I have assigned the following operator to the merchants", ((string)(null)), table108, "Given "); + await testRunner.GivenAsync("I have assigned the following operator to the merchants", ((string)(null)), table135, "Given "); #line hidden - global::Reqnroll.Table table109 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table136 = new global::Reqnroll.Table(new string[] { "DeviceIdentifier", "MerchantName", "EstateName"}); - table109.AddRow(new string[] { + table136.AddRow(new string[] { "123456780", "Test Merchant 1", "Test Estate 1"}); #line 54 - await testRunner.GivenAsync("I have assigned the following devices to the merchants", ((string)(null)), table109, "Given "); + await testRunner.GivenAsync("I have assigned the following devices to the merchants", ((string)(null)), table136, "Given "); #line hidden - global::Reqnroll.Table table110 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table137 = new global::Reqnroll.Table(new string[] { "Reference", "Amount", "DateTime", "MerchantName", "EstateName"}); - table110.AddRow(new string[] { + table137.AddRow(new string[] { "Deposit1", "20.00", "Today", "Test Merchant 1", "Test Estate 1"}); #line 58 - await testRunner.GivenAsync("I make the following manual merchant deposits", ((string)(null)), table110, "Given "); + await testRunner.GivenAsync("I make the following manual merchant deposits", ((string)(null)), table137, "Given "); #line hidden - global::Reqnroll.Table table111 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table138 = new global::Reqnroll.Table(new string[] { "EstateName", "MerchantName", "ContractDescription"}); - table111.AddRow(new string[] { + table138.AddRow(new string[] { "Test Estate 1", "Test Merchant 1", "Hospital 1 Contract"}); #line 62 - await testRunner.WhenAsync("I add the following contracts to the following merchants", ((string)(null)), table111, "When "); + await testRunner.WhenAsync("I add the following contracts to the following merchants", ((string)(null)), table138, "When "); #line hidden - global::Reqnroll.Table table112 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table139 = new global::Reqnroll.Table(new string[] { "DateTime", "TransactionNumber", "TransactionType", @@ -325,7 +325,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "MessageType", "AccountNumber", "CustomerName"}); - table112.AddRow(new string[] { + table139.AddRow(new string[] { "Today", "1", "Sale", @@ -345,7 +345,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "", ""}); #line 66 - await testRunner.WhenAsync("I perform the following transactions", ((string)(null)), table112, "When "); + await testRunner.WhenAsync("I perform the following transactions", ((string)(null)), table139, "When "); #line hidden } diff --git a/TransactionProcessor.IntegrationTests/Features/SaleTransactionFeature.feature.cs b/TransactionProcessor.IntegrationTests/Features/SaleTransactionFeature.feature.cs index 1e8e7d14..37148a85 100644 --- a/TransactionProcessor.IntegrationTests/Features/SaleTransactionFeature.feature.cs +++ b/TransactionProcessor.IntegrationTests/Features/SaleTransactionFeature.feature.cs @@ -111,199 +111,199 @@ public void ScenarioInitialize(global::Reqnroll.ScenarioInfo scenarioInfo, globa { #line 4 #line hidden - global::Reqnroll.Table table113 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table140 = new global::Reqnroll.Table(new string[] { "Name", "DisplayName", "Description"}); - table113.AddRow(new string[] { + table140.AddRow(new string[] { "estateManagement", "Estate Managememt REST Scope", "A scope for Estate Managememt REST"}); - table113.AddRow(new string[] { + table140.AddRow(new string[] { "transactionProcessor", "Transaction Processor REST Scope", "A scope for Transaction Processor REST"}); - table113.AddRow(new string[] { + table140.AddRow(new string[] { "voucherManagement", "Voucher Management REST Scope", "A scope for Voucher Management REST"}); - table113.AddRow(new string[] { + table140.AddRow(new string[] { "messagingService", "Scope for Messaging REST", "Scope for Messaging REST"}); #line 6 - await testRunner.GivenAsync("I create the following api scopes", ((string)(null)), table113, "Given "); + await testRunner.GivenAsync("I create the following api scopes", ((string)(null)), table140, "Given "); #line hidden - global::Reqnroll.Table table114 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table141 = new global::Reqnroll.Table(new string[] { "Name", "DisplayName", "Secret", "Scopes", "UserClaims"}); - table114.AddRow(new string[] { + table141.AddRow(new string[] { "estateManagement", "Estate Managememt REST", "Secret1", "estateManagement", "MerchantId, EstateId, role"}); - table114.AddRow(new string[] { + table141.AddRow(new string[] { "transactionProcessor", "Transaction Processor REST", "Secret1", "transactionProcessor", ""}); - table114.AddRow(new string[] { + table141.AddRow(new string[] { "voucherManagement", "Voucher Management REST", "Secret1", "voucherManagement", ""}); - table114.AddRow(new string[] { + table141.AddRow(new string[] { "messagingService", "Messaging REST", "Secret", "messagingService", ""}); #line 13 - await testRunner.GivenAsync("the following api resources exist", ((string)(null)), table114, "Given "); + await testRunner.GivenAsync("the following api resources exist", ((string)(null)), table141, "Given "); #line hidden - global::Reqnroll.Table table115 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table142 = new global::Reqnroll.Table(new string[] { "ClientId", "ClientName", "Secret", "Scopes", "GrantTypes"}); - table115.AddRow(new string[] { + table142.AddRow(new string[] { "serviceClient", "Service Client", "Secret1", "estateManagement,transactionProcessor,voucherManagement,messagingService", "client_credentials"}); #line 20 - await testRunner.GivenAsync("the following clients exist", ((string)(null)), table115, "Given "); + await testRunner.GivenAsync("the following clients exist", ((string)(null)), table142, "Given "); #line hidden - global::Reqnroll.Table table116 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table143 = new global::Reqnroll.Table(new string[] { "ClientId"}); - table116.AddRow(new string[] { + table143.AddRow(new string[] { "serviceClient"}); #line 24 await testRunner.GivenAsync("I have a token to access the estate management and transaction processor resource" + - "s", ((string)(null)), table116, "Given "); + "s", ((string)(null)), table143, "Given "); #line hidden - global::Reqnroll.Table table117 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table144 = new global::Reqnroll.Table(new string[] { "AccountNumber", "AccountName", "DueDate", "Amount"}); - table117.AddRow(new string[] { + table144.AddRow(new string[] { "12345678", "Test Account 1", "Today", "100.00"}); #line 28 - await testRunner.GivenAsync("the following bills are available at the PataPawa PostPaid Host", ((string)(null)), table117, "Given "); + await testRunner.GivenAsync("the following bills are available at the PataPawa PostPaid Host", ((string)(null)), table144, "Given "); #line hidden - global::Reqnroll.Table table118 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table145 = new global::Reqnroll.Table(new string[] { "Username", "Password"}); - table118.AddRow(new string[] { + table145.AddRow(new string[] { "operatora", "1234567898"}); #line 32 - await testRunner.GivenAsync("the following users are available at the PataPawa PrePay Host", ((string)(null)), table118, "Given "); + await testRunner.GivenAsync("the following users are available at the PataPawa PrePay Host", ((string)(null)), table145, "Given "); #line hidden - global::Reqnroll.Table table119 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table146 = new global::Reqnroll.Table(new string[] { "MeterNumber", "CustomerName"}); - table119.AddRow(new string[] { + table146.AddRow(new string[] { "00000001", "Customer 1"}); - table119.AddRow(new string[] { + table146.AddRow(new string[] { "00000002", "Customer 2"}); - table119.AddRow(new string[] { + table146.AddRow(new string[] { "00000003", "Customer 3"}); #line 36 - await testRunner.GivenAsync("the following meters are available at the PataPawa PrePay Host", ((string)(null)), table119, "Given "); + await testRunner.GivenAsync("the following meters are available at the PataPawa PrePay Host", ((string)(null)), table146, "Given "); #line hidden - global::Reqnroll.Table table120 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table147 = new global::Reqnroll.Table(new string[] { "EstateName"}); - table120.AddRow(new string[] { + table147.AddRow(new string[] { "Test Estate 1"}); #line 42 - await testRunner.GivenAsync("I have created the following estates", ((string)(null)), table120, "Given "); + await testRunner.GivenAsync("I have created the following estates", ((string)(null)), table147, "Given "); #line hidden - global::Reqnroll.Table table121 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table148 = new global::Reqnroll.Table(new string[] { "EstateName", "OperatorName", "RequireCustomMerchantNumber", "RequireCustomTerminalNumber"}); - table121.AddRow(new string[] { + table148.AddRow(new string[] { "Test Estate 1", "Safaricom", "False", "False"}); - table121.AddRow(new string[] { + table148.AddRow(new string[] { "Test Estate 1", "Voucher", "False", "False"}); - table121.AddRow(new string[] { + table148.AddRow(new string[] { "Test Estate 1", "PataPawa PostPay", "False", "False"}); - table121.AddRow(new string[] { + table148.AddRow(new string[] { "Test Estate 1", "PataPawa PrePay", "False", "False"}); #line 46 - await testRunner.GivenAsync("I have created the following operators", ((string)(null)), table121, "Given "); + await testRunner.GivenAsync("I have created the following operators", ((string)(null)), table148, "Given "); #line hidden - global::Reqnroll.Table table122 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table149 = new global::Reqnroll.Table(new string[] { "EstateName", "OperatorName"}); - table122.AddRow(new string[] { + table149.AddRow(new string[] { "Test Estate 1", "Safaricom"}); - table122.AddRow(new string[] { + table149.AddRow(new string[] { "Test Estate 1", "Voucher"}); - table122.AddRow(new string[] { + table149.AddRow(new string[] { "Test Estate 1", "PataPawa PostPay"}); - table122.AddRow(new string[] { + table149.AddRow(new string[] { "Test Estate 1", "PataPawa PrePay"}); #line 53 - await testRunner.AndAsync("I have assigned the following operators to the estates", ((string)(null)), table122, "And "); + await testRunner.AndAsync("I have assigned the following operators to the estates", ((string)(null)), table149, "And "); #line hidden - global::Reqnroll.Table table123 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table150 = new global::Reqnroll.Table(new string[] { "EstateName", "OperatorName", "ContractDescription"}); - table123.AddRow(new string[] { + table150.AddRow(new string[] { "Test Estate 1", "Safaricom", "Safaricom Contract"}); - table123.AddRow(new string[] { + table150.AddRow(new string[] { "Test Estate 1", "Voucher", "Hospital 1 Contract"}); - table123.AddRow(new string[] { + table150.AddRow(new string[] { "Test Estate 1", "PataPawa PostPay", "PataPawa PostPay Contract"}); - table123.AddRow(new string[] { + table150.AddRow(new string[] { "Test Estate 1", "PataPawa PrePay", "PataPawa PrePay Contract"}); #line 60 - await testRunner.GivenAsync("I create a contract with the following values", ((string)(null)), table123, "Given "); + await testRunner.GivenAsync("I create a contract with the following values", ((string)(null)), table150, "Given "); #line hidden - global::Reqnroll.Table table124 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table151 = new global::Reqnroll.Table(new string[] { "EstateName", "OperatorName", "ContractDescription", @@ -311,7 +311,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "DisplayText", "Value", "ProductType"}); - table124.AddRow(new string[] { + table151.AddRow(new string[] { "Test Estate 1", "Safaricom", "Safaricom Contract", @@ -319,7 +319,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "Custom", "", "MobileTopup"}); - table124.AddRow(new string[] { + table151.AddRow(new string[] { "Test Estate 1", "Voucher", "Hospital 1 Contract", @@ -327,7 +327,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "10 KES", "", "Voucher"}); - table124.AddRow(new string[] { + table151.AddRow(new string[] { "Test Estate 1", "PataPawa PostPay", "PataPawa PostPay Contract", @@ -335,7 +335,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "Bill Pay (Post)", "", "BillPayment"}); - table124.AddRow(new string[] { + table151.AddRow(new string[] { "Test Estate 1", "PataPawa PrePay", "PataPawa PrePay Contract", @@ -344,9 +344,9 @@ await testRunner.GivenAsync("I have a token to access the estate management and "", "BillPayment"}); #line 67 - await testRunner.WhenAsync("I create the following Products", ((string)(null)), table124, "When "); + await testRunner.WhenAsync("I create the following Products", ((string)(null)), table151, "When "); #line hidden - global::Reqnroll.Table table125 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table152 = new global::Reqnroll.Table(new string[] { "EstateName", "OperatorName", "ContractDescription", @@ -354,7 +354,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "CalculationType", "FeeDescription", "Value"}); - table125.AddRow(new string[] { + table152.AddRow(new string[] { "Test Estate 1", "Safaricom", "Safaricom Contract", @@ -362,7 +362,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "Percentage", "Merchant Commission", "0.50"}); - table125.AddRow(new string[] { + table152.AddRow(new string[] { "Test Estate 1", "PataPawa PostPay", "PataPawa PostPay Contract", @@ -370,7 +370,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "Percentage", "Merchant Commission", "0.50"}); - table125.AddRow(new string[] { + table152.AddRow(new string[] { "Test Estate 1", "PataPawa PrePay", "PataPawa PrePay Contract", @@ -379,9 +379,9 @@ await testRunner.GivenAsync("I have a token to access the estate management and "Merchant Commission", "0.50"}); #line 74 - await testRunner.WhenAsync("I add the following Transaction Fees", ((string)(null)), table125, "When "); + await testRunner.WhenAsync("I add the following Transaction Fees", ((string)(null)), table152, "When "); #line hidden - global::Reqnroll.Table table126 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table153 = new global::Reqnroll.Table(new string[] { "MerchantName", "AddressLine1", "Town", @@ -391,7 +391,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "ContactName", "EmailAddress", "EstateName"}); - table126.AddRow(new string[] { + table153.AddRow(new string[] { "Test Merchant 1", "Address Line 1", "TestTown", @@ -401,7 +401,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "Test Contact 1", "testcontact1@merchant1.co.uk", "Test Estate 1"}); - table126.AddRow(new string[] { + table153.AddRow(new string[] { "Test Merchant 2", "Address Line 1", "TestTown", @@ -411,7 +411,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "Test Contact 2", "testcontact2@merchant2.co.uk", "Test Estate 1"}); - table126.AddRow(new string[] { + table153.AddRow(new string[] { "Test Merchant 3", "Address Line 1", "TestTown", @@ -421,7 +421,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "Test Contact 3", "testcontact3@merchant3.co.uk", "Test Estate 1"}); - table126.AddRow(new string[] { + table153.AddRow(new string[] { "Test Merchant 4", "Address Line 1", "TestTown", @@ -432,239 +432,239 @@ await testRunner.GivenAsync("I have a token to access the estate management and "testcontact4@merchant4.co.uk", "Test Estate 1"}); #line 80 - await testRunner.GivenAsync("I create the following merchants", ((string)(null)), table126, "Given "); + await testRunner.GivenAsync("I create the following merchants", ((string)(null)), table153, "Given "); #line hidden - global::Reqnroll.Table table127 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table154 = new global::Reqnroll.Table(new string[] { "OperatorName", "MerchantName", "MerchantNumber", "TerminalNumber", "EstateName"}); - table127.AddRow(new string[] { + table154.AddRow(new string[] { "Safaricom", "Test Merchant 1", "00000001", "10000001", "Test Estate 1"}); - table127.AddRow(new string[] { + table154.AddRow(new string[] { "Voucher", "Test Merchant 1", "00000001", "10000001", "Test Estate 1"}); - table127.AddRow(new string[] { + table154.AddRow(new string[] { "PataPawa PostPay", "Test Merchant 1", "00000001", "10000001", "Test Estate 1"}); - table127.AddRow(new string[] { + table154.AddRow(new string[] { "PataPawa PrePay", "Test Merchant 1", "00000001", "10000001", "Test Estate 1"}); - table127.AddRow(new string[] { + table154.AddRow(new string[] { "Safaricom", "Test Merchant 2", "00000002", "10000002", "Test Estate 1"}); - table127.AddRow(new string[] { + table154.AddRow(new string[] { "Voucher", "Test Merchant 2", "00000002", "10000002", "Test Estate 1"}); - table127.AddRow(new string[] { + table154.AddRow(new string[] { "PataPawa PostPay", "Test Merchant 2", "00000002", "10000002", "Test Estate 1"}); - table127.AddRow(new string[] { + table154.AddRow(new string[] { "PataPawa PrePay", "Test Merchant 2", "00000001", "10000001", "Test Estate 1"}); - table127.AddRow(new string[] { + table154.AddRow(new string[] { "Safaricom", "Test Merchant 3", "00000003", "10000003", "Test Estate 1"}); - table127.AddRow(new string[] { + table154.AddRow(new string[] { "Voucher", "Test Merchant 3", "00000003", "10000003", "Test Estate 1"}); - table127.AddRow(new string[] { + table154.AddRow(new string[] { "PataPawa PostPay", "Test Merchant 3", "00000003", "10000003", "Test Estate 1"}); - table127.AddRow(new string[] { + table154.AddRow(new string[] { "PataPawa PrePay", "Test Merchant 3", "00000001", "10000001", "Test Estate 1"}); - table127.AddRow(new string[] { + table154.AddRow(new string[] { "Safaricom", "Test Merchant 4", "00000004", "10000004", "Test Estate 1"}); - table127.AddRow(new string[] { + table154.AddRow(new string[] { "Voucher", "Test Merchant 4", "00000004", "10000004", "Test Estate 1"}); - table127.AddRow(new string[] { + table154.AddRow(new string[] { "PataPawa PostPay", "Test Merchant 4", "00000004", "10000004", "Test Estate 1"}); - table127.AddRow(new string[] { + table154.AddRow(new string[] { "PataPawa PrePay", "Test Merchant 4", "00000001", "10000001", "Test Estate 1"}); #line 87 - await testRunner.GivenAsync("I have assigned the following operator to the merchants", ((string)(null)), table127, "Given "); + await testRunner.GivenAsync("I have assigned the following operator to the merchants", ((string)(null)), table154, "Given "); #line hidden - global::Reqnroll.Table table128 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table155 = new global::Reqnroll.Table(new string[] { "DeviceIdentifier", "MerchantName", "EstateName"}); - table128.AddRow(new string[] { + table155.AddRow(new string[] { "123456780", "Test Merchant 1", "Test Estate 1"}); - table128.AddRow(new string[] { + table155.AddRow(new string[] { "123456781", "Test Merchant 2", "Test Estate 1"}); - table128.AddRow(new string[] { + table155.AddRow(new string[] { "123456782", "Test Merchant 3", "Test Estate 1"}); - table128.AddRow(new string[] { + table155.AddRow(new string[] { "123456783", "Test Merchant 4", "Test Estate 1"}); #line 106 - await testRunner.GivenAsync("I have assigned the following devices to the merchants", ((string)(null)), table128, "Given "); + await testRunner.GivenAsync("I have assigned the following devices to the merchants", ((string)(null)), table155, "Given "); #line hidden - global::Reqnroll.Table table129 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table156 = new global::Reqnroll.Table(new string[] { "Reference", "Amount", "DateTime", "MerchantName", "EstateName"}); - table129.AddRow(new string[] { + table156.AddRow(new string[] { "Deposit1", "265.00", "Today", "Test Merchant 1", "Test Estate 1"}); - table129.AddRow(new string[] { + table156.AddRow(new string[] { "Deposit1", "110.00", "Today", "Test Merchant 2", "Test Estate 1"}); - table129.AddRow(new string[] { + table156.AddRow(new string[] { "Deposit1", "110.00", "Today", "Test Merchant 3", "Test Estate 1"}); - table129.AddRow(new string[] { + table156.AddRow(new string[] { "Deposit1", "100.00", "Today", "Test Merchant 4", "Test Estate 1"}); #line 113 - await testRunner.GivenAsync("I make the following manual merchant deposits", ((string)(null)), table129, "Given "); + await testRunner.GivenAsync("I make the following manual merchant deposits", ((string)(null)), table156, "Given "); #line hidden - global::Reqnroll.Table table130 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table157 = new global::Reqnroll.Table(new string[] { "EstateName", "MerchantName", "ContractDescription"}); - table130.AddRow(new string[] { + table157.AddRow(new string[] { "Test Estate 1", "Test Merchant 1", "Safaricom Contract"}); - table130.AddRow(new string[] { + table157.AddRow(new string[] { "Test Estate 1", "Test Merchant 1", "Hospital 1 Contract"}); - table130.AddRow(new string[] { + table157.AddRow(new string[] { "Test Estate 1", "Test Merchant 1", "PataPawa PostPay Contract"}); - table130.AddRow(new string[] { + table157.AddRow(new string[] { "Test Estate 1", "Test Merchant 1", "PataPawa PrePay Contract"}); - table130.AddRow(new string[] { + table157.AddRow(new string[] { "Test Estate 1", "Test Merchant 2", "Safaricom Contract"}); - table130.AddRow(new string[] { + table157.AddRow(new string[] { "Test Estate 1", "Test Merchant 2", "Hospital 1 Contract"}); - table130.AddRow(new string[] { + table157.AddRow(new string[] { "Test Estate 1", "Test Merchant 2", "PataPawa PostPay Contract"}); - table130.AddRow(new string[] { + table157.AddRow(new string[] { "Test Estate 1", "Test Merchant 2", "PataPawa PrePay Contract"}); - table130.AddRow(new string[] { + table157.AddRow(new string[] { "Test Estate 1", "Test Merchant 3", "Safaricom Contract"}); - table130.AddRow(new string[] { + table157.AddRow(new string[] { "Test Estate 1", "Test Merchant 3", "Hospital 1 Contract"}); - table130.AddRow(new string[] { + table157.AddRow(new string[] { "Test Estate 1", "Test Merchant 3", "PataPawa PostPay Contract"}); - table130.AddRow(new string[] { + table157.AddRow(new string[] { "Test Estate 1", "Test Merchant 3", "PataPawa PrePay Contract"}); - table130.AddRow(new string[] { + table157.AddRow(new string[] { "Test Estate 1", "Test Merchant 4", "Safaricom Contract"}); - table130.AddRow(new string[] { + table157.AddRow(new string[] { "Test Estate 1", "Test Merchant 4", "Hospital 1 Contract"}); - table130.AddRow(new string[] { + table157.AddRow(new string[] { "Test Estate 1", "Test Merchant 4", "PataPawa PostPay Contract"}); - table130.AddRow(new string[] { + table157.AddRow(new string[] { "Test Estate 1", "Test Merchant 4", "PataPawa PrePay Contract"}); #line 120 - await testRunner.WhenAsync("I add the following contracts to the following merchants", ((string)(null)), table130, "When "); + await testRunner.WhenAsync("I add the following contracts to the following merchants", ((string)(null)), table157, "When "); #line hidden } @@ -698,7 +698,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and #line 4 await this.FeatureBackgroundAsync(); #line hidden - global::Reqnroll.Table table131 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table158 = new global::Reqnroll.Table(new string[] { "DateTime", "TransactionNumber", "TransactionType", @@ -718,7 +718,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "AccountNumber", "CustomerName", "MeterNumber"}); - table131.AddRow(new string[] { + table158.AddRow(new string[] { "Today", "1", "Sale", @@ -738,7 +738,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "", "", ""}); - table131.AddRow(new string[] { + table158.AddRow(new string[] { "Today", "2", "Sale", @@ -758,7 +758,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "", "", ""}); - table131.AddRow(new string[] { + table158.AddRow(new string[] { "Today", "3", "Sale", @@ -778,7 +778,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "", "", ""}); - table131.AddRow(new string[] { + table158.AddRow(new string[] { "Today", "4", "Sale", @@ -798,7 +798,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "", "", ""}); - table131.AddRow(new string[] { + table158.AddRow(new string[] { "Today", "5", "Sale", @@ -818,7 +818,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "", "", ""}); - table131.AddRow(new string[] { + table158.AddRow(new string[] { "Today", "6", "Sale", @@ -838,7 +838,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "", "", ""}); - table131.AddRow(new string[] { + table158.AddRow(new string[] { "Today", "7", "Sale", @@ -858,7 +858,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "", "", ""}); - table131.AddRow(new string[] { + table158.AddRow(new string[] { "Today", "8", "Sale", @@ -878,7 +878,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "12345678", "", ""}); - table131.AddRow(new string[] { + table158.AddRow(new string[] { "Today", "9", "Sale", @@ -898,7 +898,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "12345678", "Mr Test Customer", ""}); - table131.AddRow(new string[] { + table158.AddRow(new string[] { "Today", "10", "Sale", @@ -918,7 +918,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "", "", "00000001"}); - table131.AddRow(new string[] { + table158.AddRow(new string[] { "Today", "11", "Sale", @@ -939,84 +939,84 @@ await testRunner.GivenAsync("I have a token to access the estate management and "Customer 1", "00000001"}); #line 142 - await testRunner.WhenAsync("I perform the following transactions", ((string)(null)), table131, "When "); + await testRunner.WhenAsync("I perform the following transactions", ((string)(null)), table158, "When "); #line hidden - global::Reqnroll.Table table132 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table159 = new global::Reqnroll.Table(new string[] { "EstateName", "MerchantName", "TransactionNumber", "ResponseCode", "ResponseMessage"}); - table132.AddRow(new string[] { + table159.AddRow(new string[] { "Test Estate 1", "Test Merchant 1", "1", "0000", "SUCCESS"}); - table132.AddRow(new string[] { + table159.AddRow(new string[] { "Test Estate 1", "Test Merchant 2", "2", "0000", "SUCCESS"}); - table132.AddRow(new string[] { + table159.AddRow(new string[] { "Test Estate 1", "Test Merchant 3", "3", "0000", "SUCCESS"}); - table132.AddRow(new string[] { + table159.AddRow(new string[] { "Test Estate 1", "Test Merchant 1", "4", "0000", "SUCCESS"}); - table132.AddRow(new string[] { + table159.AddRow(new string[] { "Test Estate 1", "Test Merchant 1", "5", "0000", "SUCCESS"}); - table132.AddRow(new string[] { + table159.AddRow(new string[] { "Test Estate 1", "Test Merchant 2", "6", "0000", "SUCCESS"}); - table132.AddRow(new string[] { + table159.AddRow(new string[] { "Test Estate 1", "Test Merchant 3", "7", "0000", "SUCCESS"}); - table132.AddRow(new string[] { + table159.AddRow(new string[] { "Test Estate 1", "Test Merchant 1", "8", "0000", "SUCCESS"}); - table132.AddRow(new string[] { + table159.AddRow(new string[] { "Test Estate 1", "Test Merchant 1", "9", "0000", "SUCCESS"}); - table132.AddRow(new string[] { + table159.AddRow(new string[] { "Test Estate 1", "Test Merchant 1", "10", "0000", "SUCCESS"}); - table132.AddRow(new string[] { + table159.AddRow(new string[] { "Test Estate 1", "Test Merchant 1", "11", "0000", "SUCCESS"}); #line 156 - await testRunner.ThenAsync("transaction response should contain the following information", ((string)(null)), table132, "Then "); + await testRunner.ThenAsync("transaction response should contain the following information", ((string)(null)), table159, "Then "); #line hidden - global::Reqnroll.Table table133 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table160 = new global::Reqnroll.Table(new string[] { "DateTime", "Reference", "EntryType", @@ -1024,7 +1024,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "Out", "ChangeAmount", "Balance"}); - table133.AddRow(new string[] { + table160.AddRow(new string[] { "Today", "Merchant Deposit", "C", @@ -1032,7 +1032,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "0.00", "265.00", "230.00"}); - table133.AddRow(new string[] { + table160.AddRow(new string[] { "Today", "Transaction Completed", "D", @@ -1040,7 +1040,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "110.00", "110.00", "130.00"}); - table133.AddRow(new string[] { + table160.AddRow(new string[] { "Today", "Transaction Completed", "D", @@ -1048,7 +1048,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "90.00", "90.00", "30.00"}); - table133.AddRow(new string[] { + table160.AddRow(new string[] { "Today", "Transaction Completed", "D", @@ -1056,7 +1056,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "10.00", "10.00", "20.00"}); - table133.AddRow(new string[] { + table160.AddRow(new string[] { "Today", "Transaction Completed", "D", @@ -1064,7 +1064,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "20.00", "20.00", "20.00"}); - table133.AddRow(new string[] { + table160.AddRow(new string[] { "Today", "Transaction Completed", "D", @@ -1072,7 +1072,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "20.00", "25.00", "20.00"}); - table133.AddRow(new string[] { + table160.AddRow(new string[] { "Today", "Transaction Fee Processed", "C", @@ -1080,7 +1080,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "0.55", "0.55", "20.00"}); - table133.AddRow(new string[] { + table160.AddRow(new string[] { "Today", "Transaction Fee Processed", "C", @@ -1088,7 +1088,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "0.45", "0.45", "20.00"}); - table133.AddRow(new string[] { + table160.AddRow(new string[] { "Today", "Transaction Fee Processed", "C", @@ -1096,7 +1096,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "0.01", "0.10", "20.00"}); - table133.AddRow(new string[] { + table160.AddRow(new string[] { "Today", "Transaction Fee Processed", "C", @@ -1104,7 +1104,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "0.01", "0.10", "20.00"}); - table133.AddRow(new string[] { + table160.AddRow(new string[] { "Today", "Opening Balance", "C", @@ -1114,9 +1114,9 @@ await testRunner.GivenAsync("I have a token to access the estate management and "20.00"}); #line 170 await testRunner.ThenAsync("the following entries appear in the merchants balance history for estate \'Test Es" + - "tate 1\' and merchant \'Test Merchant 1\'", ((string)(null)), table133, "Then "); + "tate 1\' and merchant \'Test Merchant 1\'", ((string)(null)), table160, "Then "); #line hidden - global::Reqnroll.Table table134 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table161 = new global::Reqnroll.Table(new string[] { "DateTime", "Reference", "EntryType", @@ -1124,7 +1124,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "Out", "ChangeAmount", "Balance"}); - table134.AddRow(new string[] { + table161.AddRow(new string[] { "Today", "Merchant Deposit", "C", @@ -1132,7 +1132,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "0.00", "110.00", "230.00"}); - table134.AddRow(new string[] { + table161.AddRow(new string[] { "Today", "Transaction Completed", "D", @@ -1140,7 +1140,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "100.00", "100.00", "130.00"}); - table134.AddRow(new string[] { + table161.AddRow(new string[] { "Today", "Transaction Completed", "D", @@ -1148,7 +1148,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "10.00", "10.00", "30.00"}); - table134.AddRow(new string[] { + table161.AddRow(new string[] { "Today", "Transaction Fee Processed", "C", @@ -1156,7 +1156,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "0.50", "0.50", "20.00"}); - table134.AddRow(new string[] { + table161.AddRow(new string[] { "Today", "Opening Balance", "C", @@ -1166,9 +1166,9 @@ await testRunner.GivenAsync("I have a token to access the estate management and "20.00"}); #line 184 await testRunner.ThenAsync("the following entries appear in the merchants balance history for estate \'Test Es" + - "tate 1\' and merchant \'Test Merchant 2\'", ((string)(null)), table134, "Then "); + "tate 1\' and merchant \'Test Merchant 2\'", ((string)(null)), table161, "Then "); #line hidden - global::Reqnroll.Table table135 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table162 = new global::Reqnroll.Table(new string[] { "DateTime", "Reference", "EntryType", @@ -1176,7 +1176,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "Out", "ChangeAmount", "Balance"}); - table135.AddRow(new string[] { + table162.AddRow(new string[] { "Today", "Merchant Deposit", "C", @@ -1184,7 +1184,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "0.00", "110.00", "230.00"}); - table135.AddRow(new string[] { + table162.AddRow(new string[] { "Today", "Transaction Completed", "D", @@ -1192,7 +1192,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "100.00", "100.00", "130.00"}); - table135.AddRow(new string[] { + table162.AddRow(new string[] { "Today", "Transaction Completed", "D", @@ -1200,7 +1200,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "10.00", "10.00", "30.00"}); - table135.AddRow(new string[] { + table162.AddRow(new string[] { "Today", "Transaction Fee Processed", "C", @@ -1208,7 +1208,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "0.85", "0.50", "20.00"}); - table135.AddRow(new string[] { + table162.AddRow(new string[] { "Today", "Opening Balance", "C", @@ -1218,20 +1218,20 @@ await testRunner.GivenAsync("I have a token to access the estate management and "20.00"}); #line 192 await testRunner.ThenAsync("the following entries appear in the merchants balance history for estate \'Test Es" + - "tate 1\' and merchant \'Test Merchant 3\'", ((string)(null)), table135, "Then "); + "tate 1\' and merchant \'Test Merchant 3\'", ((string)(null)), table162, "Then "); #line hidden - global::Reqnroll.Table table136 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table163 = new global::Reqnroll.Table(new string[] { "EstateName", "MerchantName", "TransactionNumber"}); - table136.AddRow(new string[] { + table163.AddRow(new string[] { "Test Estate 1", "Test Merchant 1", "1"}); #line 200 - await testRunner.WhenAsync("I request the receipt is resent", ((string)(null)), table136, "When "); + await testRunner.WhenAsync("I request the receipt is resent", ((string)(null)), table163, "When "); #line hidden - global::Reqnroll.Table table137 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table164 = new global::Reqnroll.Table(new string[] { "DateTime", "TransactionNumber", "TransactionType", @@ -1245,7 +1245,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "CustomerEmailAddress", "ContractDescription", "ProductName"}); - table137.AddRow(new string[] { + table164.AddRow(new string[] { "Today", "12", "Sale", @@ -1260,24 +1260,24 @@ await testRunner.GivenAsync("I have a token to access the estate management and "Safaricom Contract", "Variable Topup"}); #line 204 - await testRunner.WhenAsync("I perform the following transactions", ((string)(null)), table137, "When "); + await testRunner.WhenAsync("I perform the following transactions", ((string)(null)), table164, "When "); #line hidden - global::Reqnroll.Table table138 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table165 = new global::Reqnroll.Table(new string[] { "EstateName", "MerchantName", "TransactionNumber", "ResponseCode", "ResponseMessage"}); - table138.AddRow(new string[] { + table165.AddRow(new string[] { "Test Estate 1", "Test Merchant 1", "12", "1000", "Device Identifier 123456781 not valid for Merchant Test Merchant 1"}); #line 208 - await testRunner.ThenAsync("transaction response should contain the following information", ((string)(null)), table138, "Then "); + await testRunner.ThenAsync("transaction response should contain the following information", ((string)(null)), table165, "Then "); #line hidden - global::Reqnroll.Table table139 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table166 = new global::Reqnroll.Table(new string[] { "DateTime", "TransactionNumber", "TransactionType", @@ -1291,7 +1291,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "CustomerEmailAddress", "ContractDescription", "ProductName"}); - table139.AddRow(new string[] { + table166.AddRow(new string[] { "Today", "13", "Sale", @@ -1306,24 +1306,24 @@ await testRunner.GivenAsync("I have a token to access the estate management and "Safaricom Contract", "Variable Topup"}); #line 212 - await testRunner.WhenAsync("I perform the following transactions", ((string)(null)), table139, "When "); + await testRunner.WhenAsync("I perform the following transactions", ((string)(null)), table166, "When "); #line hidden - global::Reqnroll.Table table140 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table167 = new global::Reqnroll.Table(new string[] { "EstateName", "MerchantName", "TransactionNumber", "ResponseCode", "ResponseMessage"}); - table140.AddRow(new string[] { + table167.AddRow(new string[] { "InvalidEstate", "Test Merchant 1", "13", "1001", "Estate Id [79902550-64df-4491-b0c1-4e78943928a3] is not a valid estate"}); #line 216 - await testRunner.ThenAsync("transaction response should contain the following information", ((string)(null)), table140, "Then "); + await testRunner.ThenAsync("transaction response should contain the following information", ((string)(null)), table167, "Then "); #line hidden - global::Reqnroll.Table table141 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table168 = new global::Reqnroll.Table(new string[] { "DateTime", "TransactionNumber", "TransactionType", @@ -1337,7 +1337,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "CustomerEmailAddress", "ContractDescription", "ProductName"}); - table141.AddRow(new string[] { + table168.AddRow(new string[] { "Today", "14", "Sale", @@ -1352,15 +1352,15 @@ await testRunner.GivenAsync("I have a token to access the estate management and "Safaricom Contract", "Variable Topup"}); #line 220 - await testRunner.WhenAsync("I perform the following transactions", ((string)(null)), table141, "When "); + await testRunner.WhenAsync("I perform the following transactions", ((string)(null)), table168, "When "); #line hidden - global::Reqnroll.Table table142 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table169 = new global::Reqnroll.Table(new string[] { "EstateName", "MerchantName", "TransactionNumber", "ResponseCode", "ResponseMessage"}); - table142.AddRow(new string[] { + table169.AddRow(new string[] { "Test Estate 1", "InvalidMerchant", "14", @@ -1368,9 +1368,9 @@ await testRunner.GivenAsync("I have a token to access the estate management and "Merchant Id [d59320fa-4c3e-4900-a999-483f6a10c69a] is not a valid merchant for es" + "tate [Test Estate 1]"}); #line 224 - await testRunner.ThenAsync("transaction response should contain the following information", ((string)(null)), table142, "Then "); + await testRunner.ThenAsync("transaction response should contain the following information", ((string)(null)), table169, "Then "); #line hidden - global::Reqnroll.Table table143 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table170 = new global::Reqnroll.Table(new string[] { "DateTime", "TransactionNumber", "TransactionType", @@ -1384,7 +1384,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "CustomerEmailAddress", "ContractDescription", "ProductName"}); - table143.AddRow(new string[] { + table170.AddRow(new string[] { "Today", "15", "Sale", @@ -1399,15 +1399,15 @@ await testRunner.GivenAsync("I have a token to access the estate management and "EmptyContract", "Variable Topup"}); #line 228 - await testRunner.WhenAsync("I perform the following transactions", ((string)(null)), table143, "When "); + await testRunner.WhenAsync("I perform the following transactions", ((string)(null)), table170, "When "); #line hidden - global::Reqnroll.Table table144 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table171 = new global::Reqnroll.Table(new string[] { "EstateName", "MerchantName", "TransactionNumber", "ResponseCode", "ResponseMessage"}); - table144.AddRow(new string[] { + table171.AddRow(new string[] { "Test Estate 1", "Test Merchant 1", "15", @@ -1415,9 +1415,9 @@ await testRunner.GivenAsync("I have a token to access the estate management and "Contract Id [00000000-0000-0000-0000-000000000000] must be set for a sale transac" + "tion"}); #line 232 - await testRunner.ThenAsync("transaction response should contain the following information", ((string)(null)), table144, "Then "); + await testRunner.ThenAsync("transaction response should contain the following information", ((string)(null)), table171, "Then "); #line hidden - global::Reqnroll.Table table145 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table172 = new global::Reqnroll.Table(new string[] { "DateTime", "TransactionNumber", "TransactionType", @@ -1431,7 +1431,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "CustomerEmailAddress", "ContractDescription", "ProductName"}); - table145.AddRow(new string[] { + table172.AddRow(new string[] { "Today", "16", "Sale", @@ -1446,15 +1446,15 @@ await testRunner.GivenAsync("I have a token to access the estate management and "InvalidContract", "Variable Topup"}); #line 236 - await testRunner.WhenAsync("I perform the following transactions", ((string)(null)), table145, "When "); + await testRunner.WhenAsync("I perform the following transactions", ((string)(null)), table172, "When "); #line hidden - global::Reqnroll.Table table146 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table173 = new global::Reqnroll.Table(new string[] { "EstateName", "MerchantName", "TransactionNumber", "ResponseCode", "ResponseMessage"}); - table146.AddRow(new string[] { + table173.AddRow(new string[] { "Test Estate 1", "Test Merchant 1", "16", @@ -1462,9 +1462,9 @@ await testRunner.GivenAsync("I have a token to access the estate management and "Contract Id [934d8164-f36a-448e-b27b-4d671d41d180] not valid for Merchant [Test M" + "erchant 1]"}); #line 240 - await testRunner.ThenAsync("transaction response should contain the following information", ((string)(null)), table146, "Then "); + await testRunner.ThenAsync("transaction response should contain the following information", ((string)(null)), table173, "Then "); #line hidden - global::Reqnroll.Table table147 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table174 = new global::Reqnroll.Table(new string[] { "DateTime", "TransactionNumber", "TransactionType", @@ -1478,7 +1478,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "CustomerEmailAddress", "ContractDescription", "ProductName"}); - table147.AddRow(new string[] { + table174.AddRow(new string[] { "Today", "17", "Sale", @@ -1493,15 +1493,15 @@ await testRunner.GivenAsync("I have a token to access the estate management and "Safaricom Contract", "EmptyProduct"}); #line 244 - await testRunner.WhenAsync("I perform the following transactions", ((string)(null)), table147, "When "); + await testRunner.WhenAsync("I perform the following transactions", ((string)(null)), table174, "When "); #line hidden - global::Reqnroll.Table table148 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table175 = new global::Reqnroll.Table(new string[] { "EstateName", "MerchantName", "TransactionNumber", "ResponseCode", "ResponseMessage"}); - table148.AddRow(new string[] { + table175.AddRow(new string[] { "Test Estate 1", "Test Merchant 1", "17", @@ -1509,9 +1509,9 @@ await testRunner.GivenAsync("I have a token to access the estate management and "Product Id [00000000-0000-0000-0000-000000000000] must be set for a sale transact" + "ion"}); #line 248 - await testRunner.ThenAsync("transaction response should contain the following information", ((string)(null)), table148, "Then "); + await testRunner.ThenAsync("transaction response should contain the following information", ((string)(null)), table175, "Then "); #line hidden - global::Reqnroll.Table table149 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table176 = new global::Reqnroll.Table(new string[] { "DateTime", "TransactionNumber", "TransactionType", @@ -1525,7 +1525,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "CustomerEmailAddress", "ContractDescription", "ProductName"}); - table149.AddRow(new string[] { + table176.AddRow(new string[] { "Today", "18", "Sale", @@ -1540,15 +1540,15 @@ await testRunner.GivenAsync("I have a token to access the estate management and "Safaricom Contract", "InvalidProduct"}); #line 252 - await testRunner.WhenAsync("I perform the following transactions", ((string)(null)), table149, "When "); + await testRunner.WhenAsync("I perform the following transactions", ((string)(null)), table176, "When "); #line hidden - global::Reqnroll.Table table150 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table177 = new global::Reqnroll.Table(new string[] { "EstateName", "MerchantName", "TransactionNumber", "ResponseCode", "ResponseMessage"}); - table150.AddRow(new string[] { + table177.AddRow(new string[] { "Test Estate 1", "Test Merchant 1", "18", @@ -1556,9 +1556,9 @@ await testRunner.GivenAsync("I have a token to access the estate management and "Product Id [934d8164-f36a-448e-b27b-4d671d41d180] not valid for Merchant [Test Me" + "rchant 1]"}); #line 256 - await testRunner.ThenAsync("transaction response should contain the following information", ((string)(null)), table150, "Then "); + await testRunner.ThenAsync("transaction response should contain the following information", ((string)(null)), table177, "Then "); #line hidden - global::Reqnroll.Table table151 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table178 = new global::Reqnroll.Table(new string[] { "DateTime", "TransactionNumber", "TransactionType", @@ -1572,7 +1572,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "CustomerEmailAddress", "ContractDescription", "ProductName"}); - table151.AddRow(new string[] { + table178.AddRow(new string[] { "Today", "19", "Sale", @@ -1587,15 +1587,15 @@ await testRunner.GivenAsync("I have a token to access the estate management and "Safaricom Contract", "Variable Topup"}); #line 260 - await testRunner.WhenAsync("I perform the following transactions", ((string)(null)), table151, "When "); + await testRunner.WhenAsync("I perform the following transactions", ((string)(null)), table178, "When "); #line hidden - global::Reqnroll.Table table152 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table179 = new global::Reqnroll.Table(new string[] { "EstateName", "MerchantName", "TransactionNumber", "ResponseCode", "ResponseMessage"}); - table152.AddRow(new string[] { + table179.AddRow(new string[] { "Test Estate 1", "Test Merchant 4", "19", @@ -1603,7 +1603,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "Merchant [Test Merchant 4] does not have enough credit available [100.00] to perf" + "orm transaction amount [300.00]"}); #line 264 - await testRunner.ThenAsync("transaction response should contain the following information", ((string)(null)), table152, "Then "); + await testRunner.ThenAsync("transaction response should contain the following information", ((string)(null)), table179, "Then "); #line hidden } await this.ScenarioCleanupAsync(); diff --git a/TransactionProcessor.IntegrationTests/Features/Settlement.feature.cs b/TransactionProcessor.IntegrationTests/Features/Settlement.feature.cs index 8188767d..430b498c 100644 --- a/TransactionProcessor.IntegrationTests/Features/Settlement.feature.cs +++ b/TransactionProcessor.IntegrationTests/Features/Settlement.feature.cs @@ -111,128 +111,128 @@ public void ScenarioInitialize(global::Reqnroll.ScenarioInfo scenarioInfo, globa { #line 4 #line hidden - global::Reqnroll.Table table153 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table180 = new global::Reqnroll.Table(new string[] { "Name", "DisplayName", "Description"}); - table153.AddRow(new string[] { + table180.AddRow(new string[] { "estateManagement", "Estate Managememt REST Scope", "A scope for Estate Managememt REST"}); - table153.AddRow(new string[] { + table180.AddRow(new string[] { "transactionProcessor", "Transaction Processor REST Scope", "A scope for Transaction Processor REST"}); - table153.AddRow(new string[] { + table180.AddRow(new string[] { "voucherManagement", "Voucher Management REST Scope", "A scope for Voucher Management REST"}); #line 6 - await testRunner.GivenAsync("I create the following api scopes", ((string)(null)), table153, "Given "); + await testRunner.GivenAsync("I create the following api scopes", ((string)(null)), table180, "Given "); #line hidden - global::Reqnroll.Table table154 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table181 = new global::Reqnroll.Table(new string[] { "Name", "DisplayName", "Secret", "Scopes", "UserClaims"}); - table154.AddRow(new string[] { + table181.AddRow(new string[] { "estateManagement", "Estate Managememt REST", "Secret1", "estateManagement", "MerchantId, EstateId, role"}); - table154.AddRow(new string[] { + table181.AddRow(new string[] { "transactionProcessor", "Transaction Processor REST", "Secret1", "transactionProcessor", ""}); - table154.AddRow(new string[] { + table181.AddRow(new string[] { "voucherManagement", "Voucher Management REST", "Secret1", "voucherManagement", ""}); #line 12 - await testRunner.GivenAsync("the following api resources exist", ((string)(null)), table154, "Given "); + await testRunner.GivenAsync("the following api resources exist", ((string)(null)), table181, "Given "); #line hidden - global::Reqnroll.Table table155 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table182 = new global::Reqnroll.Table(new string[] { "ClientId", "ClientName", "Secret", "Scopes", "GrantTypes"}); - table155.AddRow(new string[] { + table182.AddRow(new string[] { "serviceClient", "Service Client", "Secret1", "estateManagement,transactionProcessor,voucherManagement", "client_credentials"}); #line 18 - await testRunner.GivenAsync("the following clients exist", ((string)(null)), table155, "Given "); + await testRunner.GivenAsync("the following clients exist", ((string)(null)), table182, "Given "); #line hidden - global::Reqnroll.Table table156 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table183 = new global::Reqnroll.Table(new string[] { "ClientId"}); - table156.AddRow(new string[] { + table183.AddRow(new string[] { "serviceClient"}); #line 22 await testRunner.GivenAsync("I have a token to access the estate management and transaction processor resource" + - "s", ((string)(null)), table156, "Given "); + "s", ((string)(null)), table183, "Given "); #line hidden - global::Reqnroll.Table table157 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table184 = new global::Reqnroll.Table(new string[] { "EstateName"}); - table157.AddRow(new string[] { + table184.AddRow(new string[] { "Test Estate 1"}); #line 26 - await testRunner.GivenAsync("I have created the following estates", ((string)(null)), table157, "Given "); + await testRunner.GivenAsync("I have created the following estates", ((string)(null)), table184, "Given "); #line hidden - global::Reqnroll.Table table158 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table185 = new global::Reqnroll.Table(new string[] { "EstateName", "OperatorName", "RequireCustomMerchantNumber", "RequireCustomTerminalNumber"}); - table158.AddRow(new string[] { + table185.AddRow(new string[] { "Test Estate 1", "Safaricom", "False", "False"}); - table158.AddRow(new string[] { + table185.AddRow(new string[] { "Test Estate 1", "Voucher", "False", "False"}); #line 30 - await testRunner.GivenAsync("I have created the following operators", ((string)(null)), table158, "Given "); + await testRunner.GivenAsync("I have created the following operators", ((string)(null)), table185, "Given "); #line hidden - global::Reqnroll.Table table159 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table186 = new global::Reqnroll.Table(new string[] { "EstateName", "OperatorName"}); - table159.AddRow(new string[] { + table186.AddRow(new string[] { "Test Estate 1", "Safaricom"}); - table159.AddRow(new string[] { + table186.AddRow(new string[] { "Test Estate 1", "Voucher"}); #line 35 - await testRunner.AndAsync("I have assigned the following operators to the estates", ((string)(null)), table159, "And "); + await testRunner.AndAsync("I have assigned the following operators to the estates", ((string)(null)), table186, "And "); #line hidden - global::Reqnroll.Table table160 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table187 = new global::Reqnroll.Table(new string[] { "EstateName", "OperatorName", "ContractDescription"}); - table160.AddRow(new string[] { + table187.AddRow(new string[] { "Test Estate 1", "Safaricom", "Safaricom Contract"}); - table160.AddRow(new string[] { + table187.AddRow(new string[] { "Test Estate 1", "Voucher", "Hospital 1 Contract"}); #line 40 - await testRunner.GivenAsync("I create a contract with the following values", ((string)(null)), table160, "Given "); + await testRunner.GivenAsync("I create a contract with the following values", ((string)(null)), table187, "Given "); #line hidden - global::Reqnroll.Table table161 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table188 = new global::Reqnroll.Table(new string[] { "EstateName", "OperatorName", "ContractDescription", @@ -240,7 +240,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "DisplayText", "Value", "ProductType"}); - table161.AddRow(new string[] { + table188.AddRow(new string[] { "Test Estate 1", "Safaricom", "Safaricom Contract", @@ -248,7 +248,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "Custom", "", "MobileTopup"}); - table161.AddRow(new string[] { + table188.AddRow(new string[] { "Test Estate 1", "Voucher", "Hospital 1 Contract", @@ -257,9 +257,9 @@ await testRunner.GivenAsync("I have a token to access the estate management and "", "Voucher"}); #line 45 - await testRunner.WhenAsync("I create the following Products", ((string)(null)), table161, "When "); + await testRunner.WhenAsync("I create the following Products", ((string)(null)), table188, "When "); #line hidden - global::Reqnroll.Table table162 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table189 = new global::Reqnroll.Table(new string[] { "EstateName", "OperatorName", "ContractDescription", @@ -267,7 +267,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "CalculationType", "FeeDescription", "Value"}); - table162.AddRow(new string[] { + table189.AddRow(new string[] { "Test Estate 1", "Safaricom", "Safaricom Contract", @@ -276,7 +276,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "Merchant Commission", "2.50"}); #line 50 - await testRunner.WhenAsync("I add the following Transaction Fees", ((string)(null)), table162, "When "); + await testRunner.WhenAsync("I add the following Transaction Fees", ((string)(null)), table189, "When "); #line hidden } @@ -308,7 +308,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and #line 4 await this.FeatureBackgroundAsync(); #line hidden - global::Reqnroll.Table table163 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table190 = new global::Reqnroll.Table(new string[] { "MerchantName", "AddressLine1", "Town", @@ -319,7 +319,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "EmailAddress", "EstateName", "SettlementSchedule"}); - table163.AddRow(new string[] { + table190.AddRow(new string[] { "Test Merchant 1", "Address Line 1", "TestTown", @@ -330,7 +330,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "testcontact1@merchant1.co.uk", "Test Estate 1", "Immediate"}); - table163.AddRow(new string[] { + table190.AddRow(new string[] { "Test Merchant 2", "Address Line 1", "TestTown", @@ -341,7 +341,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "testcontact2@merchant2.co.uk", "Test Estate 1", "Weekly"}); - table163.AddRow(new string[] { + table190.AddRow(new string[] { "Test Merchant 3", "Address Line 1", "TestTown", @@ -353,131 +353,131 @@ await testRunner.GivenAsync("I have a token to access the estate management and "Test Estate 1", "Monthly"}); #line 55 - await testRunner.GivenAsync("I create the following merchants", ((string)(null)), table163, "Given "); + await testRunner.GivenAsync("I create the following merchants", ((string)(null)), table190, "Given "); #line hidden - global::Reqnroll.Table table164 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table191 = new global::Reqnroll.Table(new string[] { "OperatorName", "MerchantName", "MerchantNumber", "TerminalNumber", "EstateName"}); - table164.AddRow(new string[] { + table191.AddRow(new string[] { "Safaricom", "Test Merchant 1", "00000001", "10000001", "Test Estate 1"}); - table164.AddRow(new string[] { + table191.AddRow(new string[] { "Voucher", "Test Merchant 1", "00000001", "10000001", "Test Estate 1"}); - table164.AddRow(new string[] { + table191.AddRow(new string[] { "Safaricom", "Test Merchant 2", "00000002", "10000002", "Test Estate 1"}); - table164.AddRow(new string[] { + table191.AddRow(new string[] { "Voucher", "Test Merchant 2", "00000002", "10000002", "Test Estate 1"}); - table164.AddRow(new string[] { + table191.AddRow(new string[] { "Safaricom", "Test Merchant 3", "00000003", "10000003", "Test Estate 1"}); - table164.AddRow(new string[] { + table191.AddRow(new string[] { "Voucher", "Test Merchant 3", "00000003", "10000003", "Test Estate 1"}); #line 61 - await testRunner.GivenAsync("I have assigned the following operator to the merchants", ((string)(null)), table164, "Given "); + await testRunner.GivenAsync("I have assigned the following operator to the merchants", ((string)(null)), table191, "Given "); #line hidden - global::Reqnroll.Table table165 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table192 = new global::Reqnroll.Table(new string[] { "DeviceIdentifier", "MerchantName", "EstateName"}); - table165.AddRow(new string[] { + table192.AddRow(new string[] { "123456780", "Test Merchant 1", "Test Estate 1"}); - table165.AddRow(new string[] { + table192.AddRow(new string[] { "123456781", "Test Merchant 2", "Test Estate 1"}); - table165.AddRow(new string[] { + table192.AddRow(new string[] { "123456782", "Test Merchant 3", "Test Estate 1"}); #line 70 - await testRunner.GivenAsync("I have assigned the following devices to the merchants", ((string)(null)), table165, "Given "); + await testRunner.GivenAsync("I have assigned the following devices to the merchants", ((string)(null)), table192, "Given "); #line hidden - global::Reqnroll.Table table166 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table193 = new global::Reqnroll.Table(new string[] { "Reference", "Amount", "DateTime", "MerchantName", "EstateName"}); - table166.AddRow(new string[] { + table193.AddRow(new string[] { "Deposit1", "210.00", "Today", "Test Merchant 1", "Test Estate 1"}); - table166.AddRow(new string[] { + table193.AddRow(new string[] { "Deposit1", "110.00", "Today", "Test Merchant 2", "Test Estate 1"}); - table166.AddRow(new string[] { + table193.AddRow(new string[] { "Deposit1", "120.00", "Today", "Test Merchant 3", "Test Estate 1"}); #line 76 - await testRunner.GivenAsync("I make the following manual merchant deposits", ((string)(null)), table166, "Given "); + await testRunner.GivenAsync("I make the following manual merchant deposits", ((string)(null)), table193, "Given "); #line hidden - global::Reqnroll.Table table167 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table194 = new global::Reqnroll.Table(new string[] { "EstateName", "MerchantName", "ContractDescription"}); - table167.AddRow(new string[] { + table194.AddRow(new string[] { "Test Estate 1", "Test Merchant 1", "Safaricom Contract"}); - table167.AddRow(new string[] { + table194.AddRow(new string[] { "Test Estate 1", "Test Merchant 1", "Hospital 1 Contract"}); - table167.AddRow(new string[] { + table194.AddRow(new string[] { "Test Estate 1", "Test Merchant 2", "Safaricom Contract"}); - table167.AddRow(new string[] { + table194.AddRow(new string[] { "Test Estate 1", "Test Merchant 2", "Hospital 1 Contract"}); - table167.AddRow(new string[] { + table194.AddRow(new string[] { "Test Estate 1", "Test Merchant 3", "Safaricom Contract"}); - table167.AddRow(new string[] { + table194.AddRow(new string[] { "Test Estate 1", "Test Merchant 3", "Hospital 1 Contract"}); #line 82 - await testRunner.WhenAsync("I add the following contracts to the following merchants", ((string)(null)), table167, "When "); + await testRunner.WhenAsync("I add the following contracts to the following merchants", ((string)(null)), table194, "When "); #line hidden - global::Reqnroll.Table table168 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table195 = new global::Reqnroll.Table(new string[] { "DateTime", "TransactionNumber", "TransactionType", @@ -493,7 +493,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "ProductName", "RecipientEmail", "RecipientMobile"}); - table168.AddRow(new string[] { + table195.AddRow(new string[] { "2022-01-06", "1", "Sale", @@ -509,7 +509,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "Variable Topup", "", ""}); - table168.AddRow(new string[] { + table195.AddRow(new string[] { "2022-01-06", "2", "Sale", @@ -525,7 +525,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "Variable Topup", "", ""}); - table168.AddRow(new string[] { + table195.AddRow(new string[] { "2022-01-06", "3", "Sale", @@ -541,7 +541,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "Variable Topup", "", ""}); - table168.AddRow(new string[] { + table195.AddRow(new string[] { "2022-01-06", "4", "Sale", @@ -557,7 +557,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "Variable Topup", "", ""}); - table168.AddRow(new string[] { + table195.AddRow(new string[] { "2022-01-06", "5", "Sale", @@ -573,7 +573,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "10 KES", "test@recipient.co.uk", ""}); - table168.AddRow(new string[] { + table195.AddRow(new string[] { "2022-01-06", "6", "Sale", @@ -589,7 +589,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "10 KES", "", "123456789"}); - table168.AddRow(new string[] { + table195.AddRow(new string[] { "2022-01-06", "7", "Sale", @@ -605,7 +605,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "10 KES", "test@recipient.co.uk", ""}); - table168.AddRow(new string[] { + table195.AddRow(new string[] { "2022-01-06", "8", "Sale", @@ -622,95 +622,95 @@ await testRunner.GivenAsync("I have a token to access the estate management and "test@recipient.co.uk", ""}); #line 91 - await testRunner.WhenAsync("I perform the following transactions", ((string)(null)), table168, "When "); + await testRunner.WhenAsync("I perform the following transactions", ((string)(null)), table195, "When "); #line hidden - global::Reqnroll.Table table169 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table196 = new global::Reqnroll.Table(new string[] { "EstateName", "MerchantName", "TransactionNumber", "ResponseCode", "ResponseMessage"}); - table169.AddRow(new string[] { + table196.AddRow(new string[] { "Test Estate 1", "Test Merchant 1", "1", "0000", "SUCCESS"}); - table169.AddRow(new string[] { + table196.AddRow(new string[] { "Test Estate 1", "Test Merchant 2", "2", "0000", "SUCCESS"}); - table169.AddRow(new string[] { + table196.AddRow(new string[] { "Test Estate 1", "Test Merchant 3", "3", "0000", "SUCCESS"}); - table169.AddRow(new string[] { + table196.AddRow(new string[] { "Test Estate 1", "Test Merchant 1", "4", "0000", "SUCCESS"}); - table169.AddRow(new string[] { + table196.AddRow(new string[] { "Test Estate 1", "Test Merchant 1", "5", "0000", "SUCCESS"}); - table169.AddRow(new string[] { + table196.AddRow(new string[] { "Test Estate 1", "Test Merchant 2", "6", "0000", "SUCCESS"}); - table169.AddRow(new string[] { + table196.AddRow(new string[] { "Test Estate 1", "Test Merchant 3", "7", "0000", "SUCCESS"}); - table169.AddRow(new string[] { + table196.AddRow(new string[] { "Test Estate 1", "Test Merchant 3", "8", "0000", "SUCCESS"}); #line 102 - await testRunner.ThenAsync("transaction response should contain the following information", ((string)(null)), table169, "Then "); + await testRunner.ThenAsync("transaction response should contain the following information", ((string)(null)), table196, "Then "); #line hidden - global::Reqnroll.Table table170 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table197 = new global::Reqnroll.Table(new string[] { "SettlementDate", "EstateName", "MerchantName", "NumberOfFees"}); - table170.AddRow(new string[] { + table197.AddRow(new string[] { "2022-01-13", "Test Estate 1", "Test Merchant 2", "1"}); - table170.AddRow(new string[] { + table197.AddRow(new string[] { "2022-02-06", "Test Estate 1", "Test Merchant 3", "1"}); #line 113 - await testRunner.WhenAsync("I get the pending settlements the following information should be returned", ((string)(null)), table170, "When "); + await testRunner.WhenAsync("I get the pending settlements the following information should be returned", ((string)(null)), table197, "When "); #line hidden - global::Reqnroll.Table table171 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table198 = new global::Reqnroll.Table(new string[] { "SettlementDate", "EstateName", "MerchantName", "NumberOfFees"}); - table171.AddRow(new string[] { + table198.AddRow(new string[] { "2022-01-06", "Test Estate 1", "Test Merchant 1", "2"}); #line 118 - await testRunner.WhenAsync("I get the completed settlements the following information should be returned", ((string)(null)), table171, "When "); + await testRunner.WhenAsync("I get the completed settlements the following information should be returned", ((string)(null)), table198, "When "); #line hidden } await this.ScenarioCleanupAsync(); @@ -741,7 +741,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and #line 4 await this.FeatureBackgroundAsync(); #line hidden - global::Reqnroll.Table table172 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table199 = new global::Reqnroll.Table(new string[] { "MerchantName", "AddressLine1", "Town", @@ -752,7 +752,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "EmailAddress", "EstateName", "SettlementSchedule"}); - table172.AddRow(new string[] { + table199.AddRow(new string[] { "Test Merchant 1", "Address Line 1", "TestTown", @@ -763,7 +763,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "testcontact1@merchant1.co.uk", "Test Estate 1", "Immediate"}); - table172.AddRow(new string[] { + table199.AddRow(new string[] { "Test Merchant 2", "Address Line 1", "TestTown", @@ -775,101 +775,101 @@ await testRunner.GivenAsync("I have a token to access the estate management and "Test Estate 1", "Weekly"}); #line 124 - await testRunner.GivenAsync("I create the following merchants", ((string)(null)), table172, "Given "); + await testRunner.GivenAsync("I create the following merchants", ((string)(null)), table199, "Given "); #line hidden - global::Reqnroll.Table table173 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table200 = new global::Reqnroll.Table(new string[] { "OperatorName", "MerchantName", "MerchantNumber", "TerminalNumber", "EstateName"}); - table173.AddRow(new string[] { + table200.AddRow(new string[] { "Safaricom", "Test Merchant 1", "00000001", "10000001", "Test Estate 1"}); - table173.AddRow(new string[] { + table200.AddRow(new string[] { "Voucher", "Test Merchant 1", "00000001", "10000001", "Test Estate 1"}); - table173.AddRow(new string[] { + table200.AddRow(new string[] { "Safaricom", "Test Merchant 2", "00000002", "10000002", "Test Estate 1"}); - table173.AddRow(new string[] { + table200.AddRow(new string[] { "Voucher", "Test Merchant 2", "00000002", "10000002", "Test Estate 1"}); #line 129 - await testRunner.GivenAsync("I have assigned the following operator to the merchants", ((string)(null)), table173, "Given "); + await testRunner.GivenAsync("I have assigned the following operator to the merchants", ((string)(null)), table200, "Given "); #line hidden - global::Reqnroll.Table table174 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table201 = new global::Reqnroll.Table(new string[] { "DeviceIdentifier", "MerchantName", "EstateName"}); - table174.AddRow(new string[] { + table201.AddRow(new string[] { "123456780", "Test Merchant 1", "Test Estate 1"}); - table174.AddRow(new string[] { + table201.AddRow(new string[] { "123456781", "Test Merchant 2", "Test Estate 1"}); #line 136 - await testRunner.GivenAsync("I have assigned the following devices to the merchants", ((string)(null)), table174, "Given "); + await testRunner.GivenAsync("I have assigned the following devices to the merchants", ((string)(null)), table201, "Given "); #line hidden - global::Reqnroll.Table table175 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table202 = new global::Reqnroll.Table(new string[] { "EstateName", "MerchantName", "ContractDescription"}); - table175.AddRow(new string[] { + table202.AddRow(new string[] { "Test Estate 1", "Test Merchant 1", "Safaricom Contract"}); - table175.AddRow(new string[] { + table202.AddRow(new string[] { "Test Estate 1", "Test Merchant 1", "Hospital 1 Contract"}); - table175.AddRow(new string[] { + table202.AddRow(new string[] { "Test Estate 1", "Test Merchant 2", "Safaricom Contract"}); - table175.AddRow(new string[] { + table202.AddRow(new string[] { "Test Estate 1", "Test Merchant 2", "Hospital 1 Contract"}); #line 141 - await testRunner.WhenAsync("I add the following contracts to the following merchants", ((string)(null)), table175, "When "); + await testRunner.WhenAsync("I add the following contracts to the following merchants", ((string)(null)), table202, "When "); #line hidden - global::Reqnroll.Table table176 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table203 = new global::Reqnroll.Table(new string[] { "Reference", "Amount", "DateTime", "MerchantName", "EstateName"}); - table176.AddRow(new string[] { + table203.AddRow(new string[] { "Deposit1", "210.00", "Today", "Test Merchant 1", "Test Estate 1"}); - table176.AddRow(new string[] { + table203.AddRow(new string[] { "Deposit1", "110.00", "Today", "Test Merchant 2", "Test Estate 1"}); #line 148 - await testRunner.GivenAsync("I make the following manual merchant deposits", ((string)(null)), table176, "Given "); + await testRunner.GivenAsync("I make the following manual merchant deposits", ((string)(null)), table203, "Given "); #line hidden - global::Reqnroll.Table table177 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table204 = new global::Reqnroll.Table(new string[] { "DateTime", "TransactionNumber", "TransactionType", @@ -885,7 +885,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "ProductName", "RecipientEmail", "RecipientMobile"}); - table177.AddRow(new string[] { + table204.AddRow(new string[] { "2022-01-06", "1", "Sale", @@ -901,7 +901,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "Variable Topup", "", ""}); - table177.AddRow(new string[] { + table204.AddRow(new string[] { "2022-01-06", "2", "Sale", @@ -917,7 +917,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "Variable Topup", "", ""}); - table177.AddRow(new string[] { + table204.AddRow(new string[] { "2022-01-06", "4", "Sale", @@ -933,7 +933,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "Variable Topup", "", ""}); - table177.AddRow(new string[] { + table204.AddRow(new string[] { "2022-01-06", "5", "Sale", @@ -949,7 +949,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "10 KES", "test@recipient.co.uk", ""}); - table177.AddRow(new string[] { + table204.AddRow(new string[] { "2022-01-06", "6", "Sale", @@ -966,59 +966,59 @@ await testRunner.GivenAsync("I have a token to access the estate management and "", "123456789"}); #line 153 - await testRunner.WhenAsync("I perform the following transactions", ((string)(null)), table177, "When "); + await testRunner.WhenAsync("I perform the following transactions", ((string)(null)), table204, "When "); #line hidden - global::Reqnroll.Table table178 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table205 = new global::Reqnroll.Table(new string[] { "EstateName", "MerchantName", "TransactionNumber", "ResponseCode", "ResponseMessage"}); - table178.AddRow(new string[] { + table205.AddRow(new string[] { "Test Estate 1", "Test Merchant 1", "1", "0000", "SUCCESS"}); - table178.AddRow(new string[] { + table205.AddRow(new string[] { "Test Estate 1", "Test Merchant 2", "2", "0000", "SUCCESS"}); - table178.AddRow(new string[] { + table205.AddRow(new string[] { "Test Estate 1", "Test Merchant 1", "4", "0000", "SUCCESS"}); - table178.AddRow(new string[] { + table205.AddRow(new string[] { "Test Estate 1", "Test Merchant 1", "5", "0000", "SUCCESS"}); - table178.AddRow(new string[] { + table205.AddRow(new string[] { "Test Estate 1", "Test Merchant 2", "6", "0000", "SUCCESS"}); #line 161 - await testRunner.ThenAsync("transaction response should contain the following information", ((string)(null)), table178, "Then "); + await testRunner.ThenAsync("transaction response should contain the following information", ((string)(null)), table205, "Then "); #line hidden - global::Reqnroll.Table table179 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table206 = new global::Reqnroll.Table(new string[] { "SettlementDate", "EstateName", "MerchantName", "NumberOfFees"}); - table179.AddRow(new string[] { + table206.AddRow(new string[] { "2022-01-13", "Test Estate 1", "Test Merchant 2", "1"}); #line 169 - await testRunner.WhenAsync("I get the pending settlements the following information should be returned", ((string)(null)), table179, "When "); + await testRunner.WhenAsync("I get the pending settlements the following information should be returned", ((string)(null)), table206, "When "); #line hidden #line 173 await testRunner.WhenAsync("I process the settlement for \'2022-01-13\' on Estate \'Test Estate 1\' for Merchant " + diff --git a/TransactionProcessor.IntegrationTests/Features/SettlementReporting.feature.cs b/TransactionProcessor.IntegrationTests/Features/SettlementReporting.feature.cs index 9cbd1e62..36d19dfa 100644 --- a/TransactionProcessor.IntegrationTests/Features/SettlementReporting.feature.cs +++ b/TransactionProcessor.IntegrationTests/Features/SettlementReporting.feature.cs @@ -111,120 +111,120 @@ public void ScenarioInitialize(global::Reqnroll.ScenarioInfo scenarioInfo, globa { #line 4 #line hidden - global::Reqnroll.Table table180 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table207 = new global::Reqnroll.Table(new string[] { "Name", "DisplayName", "Description"}); - table180.AddRow(new string[] { + table207.AddRow(new string[] { "estateManagement", "Estate Managememt REST Scope", "A scope for Estate Managememt REST"}); - table180.AddRow(new string[] { + table207.AddRow(new string[] { "transactionProcessor", "Transaction Processor REST Scope", "A scope for Transaction Processor REST"}); #line 6 - await testRunner.GivenAsync("I create the following api scopes", ((string)(null)), table180, "Given "); + await testRunner.GivenAsync("I create the following api scopes", ((string)(null)), table207, "Given "); #line hidden - global::Reqnroll.Table table181 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table208 = new global::Reqnroll.Table(new string[] { "Name", "DisplayName", "Secret", "Scopes", "UserClaims"}); - table181.AddRow(new string[] { + table208.AddRow(new string[] { "estateManagement", "Estate Managememt REST", "Secret1", "estateManagement", "MerchantId, EstateId, role"}); - table181.AddRow(new string[] { + table208.AddRow(new string[] { "transactionProcessor", "Transaction Processor REST", "Secret1", "transactionProcessor", ""}); #line 11 - await testRunner.GivenAsync("the following api resources exist", ((string)(null)), table181, "Given "); + await testRunner.GivenAsync("the following api resources exist", ((string)(null)), table208, "Given "); #line hidden - global::Reqnroll.Table table182 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table209 = new global::Reqnroll.Table(new string[] { "ClientId", "ClientName", "Secret", "Scopes", "GrantTypes"}); - table182.AddRow(new string[] { + table209.AddRow(new string[] { "serviceClient", "Service Client", "Secret1", "estateManagement,transactionProcessor", "client_credentials"}); #line 16 - await testRunner.GivenAsync("the following clients exist", ((string)(null)), table182, "Given "); + await testRunner.GivenAsync("the following clients exist", ((string)(null)), table209, "Given "); #line hidden - global::Reqnroll.Table table183 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table210 = new global::Reqnroll.Table(new string[] { "ClientId"}); - table183.AddRow(new string[] { + table210.AddRow(new string[] { "serviceClient"}); #line 20 await testRunner.GivenAsync("I have a token to access the estate management and transaction processor resource" + - "s", ((string)(null)), table183, "Given "); + "s", ((string)(null)), table210, "Given "); #line hidden - global::Reqnroll.Table table184 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table211 = new global::Reqnroll.Table(new string[] { "EstateName"}); - table184.AddRow(new string[] { + table211.AddRow(new string[] { "Test Estate 1"}); - table184.AddRow(new string[] { + table211.AddRow(new string[] { "Test Estate 2"}); #line 24 - await testRunner.GivenAsync("I have created the following estates", ((string)(null)), table184, "Given "); + await testRunner.GivenAsync("I have created the following estates", ((string)(null)), table211, "Given "); #line hidden - global::Reqnroll.Table table185 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table212 = new global::Reqnroll.Table(new string[] { "EstateName", "OperatorName", "RequireCustomMerchantNumber", "RequireCustomTerminalNumber"}); - table185.AddRow(new string[] { + table212.AddRow(new string[] { "Test Estate 1", "Safaricom", "False", "False"}); - table185.AddRow(new string[] { + table212.AddRow(new string[] { "Test Estate 2", "Safaricom", "False", "False"}); #line 29 - await testRunner.GivenAsync("I have created the following operators", ((string)(null)), table185, "Given "); + await testRunner.GivenAsync("I have created the following operators", ((string)(null)), table212, "Given "); #line hidden - global::Reqnroll.Table table186 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table213 = new global::Reqnroll.Table(new string[] { "EstateName", "OperatorName"}); - table186.AddRow(new string[] { + table213.AddRow(new string[] { "Test Estate 1", "Safaricom"}); - table186.AddRow(new string[] { + table213.AddRow(new string[] { "Test Estate 2", "Safaricom"}); #line 34 - await testRunner.AndAsync("I have assigned the following operators to the estates", ((string)(null)), table186, "And "); + await testRunner.AndAsync("I have assigned the following operators to the estates", ((string)(null)), table213, "And "); #line hidden - global::Reqnroll.Table table187 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table214 = new global::Reqnroll.Table(new string[] { "EstateName", "OperatorName", "ContractDescription"}); - table187.AddRow(new string[] { + table214.AddRow(new string[] { "Test Estate 1", "Safaricom", "Safaricom Contract"}); - table187.AddRow(new string[] { + table214.AddRow(new string[] { "Test Estate 2", "Safaricom", "Safaricom Contract"}); #line 39 - await testRunner.GivenAsync("I create a contract with the following values", ((string)(null)), table187, "Given "); + await testRunner.GivenAsync("I create a contract with the following values", ((string)(null)), table214, "Given "); #line hidden - global::Reqnroll.Table table188 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table215 = new global::Reqnroll.Table(new string[] { "EstateName", "OperatorName", "ContractDescription", @@ -232,7 +232,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "DisplayText", "Value", "ProductType"}); - table188.AddRow(new string[] { + table215.AddRow(new string[] { "Test Estate 1", "Safaricom", "Safaricom Contract", @@ -240,7 +240,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "Custom", "", "MobileTopup"}); - table188.AddRow(new string[] { + table215.AddRow(new string[] { "Test Estate 2", "Safaricom", "Safaricom Contract", @@ -249,9 +249,9 @@ await testRunner.GivenAsync("I have a token to access the estate management and "", "MobileTopup"}); #line 44 - await testRunner.WhenAsync("I create the following Products", ((string)(null)), table188, "When "); + await testRunner.WhenAsync("I create the following Products", ((string)(null)), table215, "When "); #line hidden - global::Reqnroll.Table table189 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table216 = new global::Reqnroll.Table(new string[] { "EstateName", "OperatorName", "ContractDescription", @@ -260,7 +260,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "FeeDescription", "Value", "FeeType"}); - table189.AddRow(new string[] { + table216.AddRow(new string[] { "Test Estate 1", "Safaricom", "Safaricom Contract", @@ -269,7 +269,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "Merchant Commission", "0.50", "Merchant"}); - table189.AddRow(new string[] { + table216.AddRow(new string[] { "Test Estate 2", "Safaricom", "Safaricom Contract", @@ -279,9 +279,9 @@ await testRunner.GivenAsync("I have a token to access the estate management and "0.85", "Merchant"}); #line 49 - await testRunner.WhenAsync("I add the following Transaction Fees", ((string)(null)), table189, "When "); + await testRunner.WhenAsync("I add the following Transaction Fees", ((string)(null)), table216, "When "); #line hidden - global::Reqnroll.Table table190 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table217 = new global::Reqnroll.Table(new string[] { "MerchantName", "AddressLine1", "Town", @@ -292,7 +292,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "EmailAddress", "EstateName", "SettlementSchedule"}); - table190.AddRow(new string[] { + table217.AddRow(new string[] { "Test Merchant 1", "Address Line 1", "TestTown", @@ -303,7 +303,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "testcontact1@merchant1.co.uk", "Test Estate 1", "Weekly"}); - table190.AddRow(new string[] { + table217.AddRow(new string[] { "Test Merchant 2", "Address Line 1", "TestTown", @@ -314,7 +314,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "testcontact2@merchant2.co.uk", "Test Estate 1", "Weekly"}); - table190.AddRow(new string[] { + table217.AddRow(new string[] { "Test Merchant 3", "Address Line 1", "TestTown", @@ -326,101 +326,101 @@ await testRunner.GivenAsync("I have a token to access the estate management and "Test Estate 2", "Monthly"}); #line 54 - await testRunner.GivenAsync("I create the following merchants", ((string)(null)), table190, "Given "); + await testRunner.GivenAsync("I create the following merchants", ((string)(null)), table217, "Given "); #line hidden - global::Reqnroll.Table table191 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table218 = new global::Reqnroll.Table(new string[] { "OperatorName", "MerchantName", "MerchantNumber", "TerminalNumber", "EstateName"}); - table191.AddRow(new string[] { + table218.AddRow(new string[] { "Safaricom", "Test Merchant 1", "00000001", "10000001", "Test Estate 1"}); - table191.AddRow(new string[] { + table218.AddRow(new string[] { "Safaricom", "Test Merchant 2", "00000002", "10000002", "Test Estate 1"}); - table191.AddRow(new string[] { + table218.AddRow(new string[] { "Safaricom", "Test Merchant 3", "00000003", "10000003", "Test Estate 2"}); #line 60 - await testRunner.GivenAsync("I have assigned the following operator to the merchants", ((string)(null)), table191, "Given "); + await testRunner.GivenAsync("I have assigned the following operator to the merchants", ((string)(null)), table218, "Given "); #line hidden - global::Reqnroll.Table table192 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table219 = new global::Reqnroll.Table(new string[] { "DeviceIdentifier", "MerchantName", "EstateName"}); - table192.AddRow(new string[] { + table219.AddRow(new string[] { "123456780", "Test Merchant 1", "Test Estate 1"}); - table192.AddRow(new string[] { + table219.AddRow(new string[] { "123456781", "Test Merchant 2", "Test Estate 1"}); - table192.AddRow(new string[] { + table219.AddRow(new string[] { "123456782", "Test Merchant 3", "Test Estate 2"}); #line 66 - await testRunner.GivenAsync("I have assigned the following devices to the merchants", ((string)(null)), table192, "Given "); + await testRunner.GivenAsync("I have assigned the following devices to the merchants", ((string)(null)), table219, "Given "); #line hidden - global::Reqnroll.Table table193 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table220 = new global::Reqnroll.Table(new string[] { "EstateName", "MerchantName", "ContractDescription"}); - table193.AddRow(new string[] { + table220.AddRow(new string[] { "Test Estate 1", "Test Merchant 1", "Safaricom Contract"}); - table193.AddRow(new string[] { + table220.AddRow(new string[] { "Test Estate 1", "Test Merchant 2", "Safaricom Contract"}); - table193.AddRow(new string[] { + table220.AddRow(new string[] { "Test Estate 2", "Test Merchant 3", "Safaricom Contract"}); #line 72 - await testRunner.WhenAsync("I add the following contracts to the following merchants", ((string)(null)), table193, "When "); + await testRunner.WhenAsync("I add the following contracts to the following merchants", ((string)(null)), table220, "When "); #line hidden - global::Reqnroll.Table table194 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table221 = new global::Reqnroll.Table(new string[] { "Reference", "Amount", "DateTime", "MerchantName", "EstateName"}); - table194.AddRow(new string[] { + table221.AddRow(new string[] { "Deposit1", "50000.00", "Today", "Test Merchant 1", "Test Estate 1"}); - table194.AddRow(new string[] { + table221.AddRow(new string[] { "Deposit1", "50000.00", "Today", "Test Merchant 2", "Test Estate 1"}); - table194.AddRow(new string[] { + table221.AddRow(new string[] { "Deposit1", "50000.00", "Today", "Test Merchant 3", "Test Estate 2"}); #line 78 - await testRunner.GivenAsync("I make the following manual merchant deposits", ((string)(null)), table194, "Given "); + await testRunner.GivenAsync("I make the following manual merchant deposits", ((string)(null)), table221, "Given "); #line hidden - global::Reqnroll.Table table195 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table222 = new global::Reqnroll.Table(new string[] { "DateTime", "TransactionNumber", "TransactionType", @@ -434,7 +434,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "CustomerEmailAddress", "ContractDescription", "ProductName"}); - table195.AddRow(new string[] { + table222.AddRow(new string[] { "2022-01-06", "1", "Sale", @@ -448,7 +448,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "", "Safaricom Contract", "Variable Topup"}); - table195.AddRow(new string[] { + table222.AddRow(new string[] { "2022-01-06", "2", "Sale", @@ -462,7 +462,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "", "Safaricom Contract", "Variable Topup"}); - table195.AddRow(new string[] { + table222.AddRow(new string[] { "2022-01-06", "3", "Sale", @@ -476,7 +476,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "", "Safaricom Contract", "Variable Topup"}); - table195.AddRow(new string[] { + table222.AddRow(new string[] { "2022-01-06", "4", "Sale", @@ -490,7 +490,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "", "Safaricom Contract", "Variable Topup"}); - table195.AddRow(new string[] { + table222.AddRow(new string[] { "2022-01-06", "5", "Sale", @@ -504,7 +504,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "", "Safaricom Contract", "Variable Topup"}); - table195.AddRow(new string[] { + table222.AddRow(new string[] { "2022-01-06", "6", "Sale", @@ -518,7 +518,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "", "Safaricom Contract", "Variable Topup"}); - table195.AddRow(new string[] { + table222.AddRow(new string[] { "2022-01-06", "7", "Sale", @@ -532,7 +532,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "", "Safaricom Contract", "Variable Topup"}); - table195.AddRow(new string[] { + table222.AddRow(new string[] { "2022-01-06", "8", "Sale", @@ -546,7 +546,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "", "Safaricom Contract", "Variable Topup"}); - table195.AddRow(new string[] { + table222.AddRow(new string[] { "2022-01-06", "1", "Sale", @@ -560,7 +560,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "", "Safaricom Contract", "Variable Topup"}); - table195.AddRow(new string[] { + table222.AddRow(new string[] { "2022-01-06", "2", "Sale", @@ -574,7 +574,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "", "Safaricom Contract", "Variable Topup"}); - table195.AddRow(new string[] { + table222.AddRow(new string[] { "2022-01-06", "3", "Sale", @@ -588,7 +588,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "", "Safaricom Contract", "Variable Topup"}); - table195.AddRow(new string[] { + table222.AddRow(new string[] { "2022-01-06", "4", "Sale", @@ -602,7 +602,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "", "Safaricom Contract", "Variable Topup"}); - table195.AddRow(new string[] { + table222.AddRow(new string[] { "2022-01-06", "1", "Sale", @@ -617,112 +617,112 @@ await testRunner.GivenAsync("I have a token to access the estate management and "Safaricom Contract", "Variable Topup"}); #line 84 - await testRunner.WhenAsync("I perform the following transactions", ((string)(null)), table195, "When "); + await testRunner.WhenAsync("I perform the following transactions", ((string)(null)), table222, "When "); #line hidden - global::Reqnroll.Table table196 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table223 = new global::Reqnroll.Table(new string[] { "EstateName", "MerchantName", "TransactionNumber", "ResponseCode", "ResponseMessage"}); - table196.AddRow(new string[] { + table223.AddRow(new string[] { "Test Estate 1", "Test Merchant 1", "1", "0000", "SUCCESS"}); - table196.AddRow(new string[] { + table223.AddRow(new string[] { "Test Estate 1", "Test Merchant 1", "2", "1008", "DECLINED BY OPERATOR"}); - table196.AddRow(new string[] { + table223.AddRow(new string[] { "Test Estate 1", "Test Merchant 1", "3", "0000", "SUCCESS"}); - table196.AddRow(new string[] { + table223.AddRow(new string[] { "Test Estate 1", "Test Merchant 1", "4", "0000", "SUCCESS"}); - table196.AddRow(new string[] { + table223.AddRow(new string[] { "Test Estate 1", "Test Merchant 1", "5", "1008", "DECLINED BY OPERATOR"}); - table196.AddRow(new string[] { + table223.AddRow(new string[] { "Test Estate 1", "Test Merchant 1", "6", "0000", "SUCCESS"}); - table196.AddRow(new string[] { + table223.AddRow(new string[] { "Test Estate 1", "Test Merchant 1", "7", "0000", "SUCCESS"}); - table196.AddRow(new string[] { + table223.AddRow(new string[] { "Test Estate 1", "Test Merchant 1", "8", "0000", "SUCCESS"}); - table196.AddRow(new string[] { + table223.AddRow(new string[] { "Test Estate 1", "Test Merchant 2", "1", "0000", "SUCCESS"}); - table196.AddRow(new string[] { + table223.AddRow(new string[] { "Test Estate 1", "Test Merchant 2", "2", "1008", "DECLINED BY OPERATOR"}); - table196.AddRow(new string[] { + table223.AddRow(new string[] { "Test Estate 1", "Test Merchant 2", "3", "0000", "SUCCESS"}); - table196.AddRow(new string[] { + table223.AddRow(new string[] { "Test Estate 1", "Test Merchant 2", "4", "0000", "SUCCESS"}); - table196.AddRow(new string[] { + table223.AddRow(new string[] { "Test Estate 2", "Test Merchant 3", "1", "0000", "SUCCESS"}); #line 102 - await testRunner.ThenAsync("transaction response should contain the following information", ((string)(null)), table196, "Then "); + await testRunner.ThenAsync("transaction response should contain the following information", ((string)(null)), table223, "Then "); #line hidden - global::Reqnroll.Table table197 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table224 = new global::Reqnroll.Table(new string[] { "SettlementDate", "EstateName", "MerchantName", "NumberOfFees"}); - table197.AddRow(new string[] { + table224.AddRow(new string[] { "2022-01-13", "Test Estate 1", "Test Merchant 1", "6"}); - table197.AddRow(new string[] { + table224.AddRow(new string[] { "2022-01-13", "Test Estate 1", "Test Merchant 2", "3"}); #line 120 - await testRunner.WhenAsync("I get the pending settlements the following information should be returned", ((string)(null)), table197, "When "); + await testRunner.WhenAsync("I get the pending settlements the following information should be returned", ((string)(null)), table224, "When "); #line hidden #line 125 await testRunner.WhenAsync("I process the settlement for \'2022-01-13\' on Estate \'Test Estate 1\' for Merchant " + @@ -734,18 +734,18 @@ await testRunner.GivenAsync("I have a token to access the estate management and "\'Test Merchant 2\' then 3 fees are marked as settled and the settlement is comple" + "ted", ((string)(null)), ((global::Reqnroll.Table)(null)), "When "); #line hidden - global::Reqnroll.Table table198 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table225 = new global::Reqnroll.Table(new string[] { "SettlementDate", "EstateName", "MerchantName", "NumberOfFees"}); - table198.AddRow(new string[] { + table225.AddRow(new string[] { "2022-02-06", "Test Estate 2", "Test Merchant 3", "1"}); #line 129 - await testRunner.WhenAsync("I get the pending settlements the following information should be returned", ((string)(null)), table198, "When "); + await testRunner.WhenAsync("I get the pending settlements the following information should be returned", ((string)(null)), table225, "When "); #line hidden #line 133 await testRunner.WhenAsync("I process the settlement for \'2022-02-06\' on Estate \'Test Estate 2\' for Merchant " + @@ -786,12 +786,12 @@ await testRunner.GivenAsync("I have a token to access the estate management and #line 4 await this.FeatureBackgroundAsync(); #line hidden - global::Reqnroll.Table table199 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table226 = new global::Reqnroll.Table(new string[] { "SettlementDate", "NumberOfFeesSettled", "ValueOfFeesSettled", "IsCompleted"}); - table199.AddRow(new string[] { + table226.AddRow(new string[] { "2022-01-13", "6", "2.39", @@ -799,14 +799,14 @@ await testRunner.GivenAsync("I have a token to access the estate management and #line 138 await testRunner.WhenAsync("I get the Estate Settlement Report for Estate \'Test Estate 1\' for Merchant \'Test " + "Merchant 1\' with the Start Date \'2022-01-13\' and the End Date \'2022-02-06\' the f" + - "ollowing data is returned", ((string)(null)), table199, "When "); + "ollowing data is returned", ((string)(null)), table226, "When "); #line hidden - global::Reqnroll.Table table200 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table227 = new global::Reqnroll.Table(new string[] { "SettlementDate", "NumberOfFeesSettled", "ValueOfFeesSettled", "IsCompleted"}); - table200.AddRow(new string[] { + table227.AddRow(new string[] { "2022-01-13", "3", "0.71", @@ -814,14 +814,14 @@ await testRunner.GivenAsync("I have a token to access the estate management and #line 142 await testRunner.WhenAsync("I get the Estate Settlement Report for Estate \'Test Estate 1\' for Merchant \'Test " + "Merchant 2\' with the Start Date \'2022-01-13\' and the End Date \'2022-02-06\' the f" + - "ollowing data is returned", ((string)(null)), table200, "When "); + "ollowing data is returned", ((string)(null)), table227, "When "); #line hidden - global::Reqnroll.Table table201 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table228 = new global::Reqnroll.Table(new string[] { "SettlementDate", "NumberOfFeesSettled", "ValueOfFeesSettled", "IsCompleted"}); - table201.AddRow(new string[] { + table228.AddRow(new string[] { "2022-02-06", "1", "0.85", @@ -829,84 +829,84 @@ await testRunner.GivenAsync("I have a token to access the estate management and #line 146 await testRunner.WhenAsync("I get the Estate Settlement Report for Estate \'Test Estate 2\' for Merchant \'Test " + "Merchant 3\' with the Start Date \'2022-01-13\' and the End Date \'2022-02-06\' the f" + - "ollowing data is returned", ((string)(null)), table201, "When "); + "ollowing data is returned", ((string)(null)), table228, "When "); #line hidden - global::Reqnroll.Table table202 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table229 = new global::Reqnroll.Table(new string[] { "FeeDescription", "IsSettled", "Operator", "CalculatedValue"}); - table202.AddRow(new string[] { + table229.AddRow(new string[] { "Merchant Commission", "True", "Safaricom", "0.50"}); - table202.AddRow(new string[] { + table229.AddRow(new string[] { "Merchant Commission", "True", "Safaricom", "0.13"}); - table202.AddRow(new string[] { + table229.AddRow(new string[] { "Merchant Commission", "True", "Safaricom", "0.75"}); - table202.AddRow(new string[] { + table229.AddRow(new string[] { "Merchant Commission", "True", "Safaricom", "0.20"}); - table202.AddRow(new string[] { + table229.AddRow(new string[] { "Merchant Commission", "True", "Safaricom", "0.30"}); - table202.AddRow(new string[] { + table229.AddRow(new string[] { "Merchant Commission", "True", "Safaricom", "0.51"}); #line 150 await testRunner.WhenAsync("I get the Estate Settlement Report for Estate \'Test Estate 1\' for Merchant \'Test " + - "Merchant 1\' with the Date \'2022-01-13\' the following fees are settled", ((string)(null)), table202, "When "); + "Merchant 1\' with the Date \'2022-01-13\' the following fees are settled", ((string)(null)), table229, "When "); #line hidden - global::Reqnroll.Table table203 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table230 = new global::Reqnroll.Table(new string[] { "FeeDescription", "IsSettled", "Operator", "CalculatedValue"}); - table203.AddRow(new string[] { + table230.AddRow(new string[] { "Merchant Commission", "True", "Safaricom", "0.50"}); - table203.AddRow(new string[] { + table230.AddRow(new string[] { "Merchant Commission", "True", "Safaricom", "0.13"}); - table203.AddRow(new string[] { + table230.AddRow(new string[] { "Merchant Commission", "True", "Safaricom", "0.08"}); #line 159 await testRunner.WhenAsync("I get the Estate Settlement Report for Estate \'Test Estate 1\' for Merchant \'Test " + - "Merchant 2\' with the Date \'2022-01-13\' the following fees are settled", ((string)(null)), table203, "When "); + "Merchant 2\' with the Date \'2022-01-13\' the following fees are settled", ((string)(null)), table230, "When "); #line hidden - global::Reqnroll.Table table204 = new global::Reqnroll.Table(new string[] { + global::Reqnroll.Table table231 = new global::Reqnroll.Table(new string[] { "FeeDescription", "IsSettled", "Operator", "CalculatedValue"}); - table204.AddRow(new string[] { + table231.AddRow(new string[] { "Merchant Commission", "True", "Safaricom", "0.85"}); #line 165 await testRunner.WhenAsync("I get the Estate Settlement Report for Estate \'Test Estate 2\' for Merchant \'Test " + - "Merchant 3\' with the Date \'2022-02-06\' the following fees are settled", ((string)(null)), table204, "When "); + "Merchant 3\' with the Date \'2022-02-06\' the following fees are settled", ((string)(null)), table231, "When "); #line hidden } await this.ScenarioCleanupAsync(); diff --git a/TransactionProcessor.IntegrationTests/Shared/SharedSteps.cs b/TransactionProcessor.IntegrationTests/Shared/SharedSteps.cs index e220a4f2..d66c783d 100644 --- a/TransactionProcessor.IntegrationTests/Shared/SharedSteps.cs +++ b/TransactionProcessor.IntegrationTests/Shared/SharedSteps.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using TransactionProcessor.DataTransferObjects.Requests.Contract; using TransactionProcessor.DataTransferObjects.Requests.Merchant; +using TransactionProcessor.DataTransferObjects.Requests.MerchantSchedule; using TransactionProcessor.DataTransferObjects.Requests.Operator; using TransactionProcessor.DataTransferObjects.Responses.Contract; using TransactionProcessor.DataTransferObjects.Responses.Merchant; @@ -259,6 +260,15 @@ public async Task WhenISetTheMerchantsSettlementSchedule(DataTable table) await this.TransactionProcessorSteps.WhenISetTheMerchantsSettlementSchedule(this.TestingContext.AccessToken, requests); } + [When(@"I create the following merchant schedules")] + public async Task WhenICreateTheFollowingMerchantSchedules(DataTable table) + { + List<(EstateDetails estate, Guid merchantId, CreateMerchantScheduleRequest request)> requests = + table.Rows.ToCreateMerchantScheduleRequests(this.TestingContext.Estates); + + await this.TransactionProcessorSteps.WhenICreateTheFollowingMerchantSchedules(this.TestingContext.AccessToken, requests); + } + [Given(@"I make the following manual merchant deposits")] [When(@"I make the following manual merchant deposits")] public async Task WhenIMakeTheFollowingManualMerchantDeposits(DataTable table) diff --git a/TransactionProcessor.Models/Merchant/Merchant.cs b/TransactionProcessor.Models/Merchant/Merchant.cs index 42f6e323..6b81c7d3 100644 --- a/TransactionProcessor.Models/Merchant/Merchant.cs +++ b/TransactionProcessor.Models/Merchant/Merchant.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using TransactionProcessor.Models.MerchantSchedule; namespace TransactionProcessor.Models.Merchant { @@ -39,6 +40,8 @@ public class Merchant public Dictionary OpeningHours { get; set; } + public List Schedules { get; set; } + #endregion } @@ -47,4 +50,4 @@ public class OpeningHours public string Opening { get; set; } public string Closing { get; set; } } -} \ No newline at end of file +} diff --git a/TransactionProcessor.Models/MerchantSchedule/MerchantSchedule.cs b/TransactionProcessor.Models/MerchantSchedule/MerchantSchedule.cs new file mode 100644 index 00000000..8871fc1a --- /dev/null +++ b/TransactionProcessor.Models/MerchantSchedule/MerchantSchedule.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; + +namespace TransactionProcessor.Models.MerchantSchedule +{ + public class MerchantSchedule + { + public Guid MerchantScheduleId { get; set; } + + public Guid EstateId { get; set; } + + public Guid MerchantId { get; set; } + + public Int32 Year { get; set; } + + public List Months { get; set; } = []; + } + + public class MerchantScheduleMonth + { + public Int32 Month { get; set; } + + public List ClosedDays { get; set; } = []; + } +} diff --git a/TransactionProcessor.Repository/ITransactionProcessorReadModelRepository.cs b/TransactionProcessor.Repository/ITransactionProcessorReadModelRepository.cs index 8e1a2602..ceb7d9c5 100644 --- a/TransactionProcessor.Repository/ITransactionProcessorReadModelRepository.cs +++ b/TransactionProcessor.Repository/ITransactionProcessorReadModelRepository.cs @@ -15,6 +15,7 @@ using TransactionProcessor.Models.Contract; using TransactionProcessor.Models.Estate; using TransactionProcessor.Models.Settlement; +using MerchantScheduleModel = TransactionProcessor.Models.MerchantSchedule.MerchantSchedule; using static TransactionProcessor.DomainEvents.MerchantDomainEvents; using static TransactionProcessor.DomainEvents.MerchantStatementDomainEvents; using Contract = TransactionProcessor.Database.Entities.Contract; @@ -77,7 +78,10 @@ Task AddFileToImportLog(FileAddedToImportLogEvent domainEvent, CancellationToken cancellationToken); Task AddMerchant(MerchantDomainEvents.MerchantCreatedEvent domainEvent, - CancellationToken cancellationToken); + CancellationToken cancellationToken); + + Task AddMerchantSchedule(MerchantScheduleDomainEvents.MerchantScheduleCreatedEvent domainEvent, + CancellationToken cancellationToken); Task UpdateMerchant(MerchantDomainEvents.MerchantNameUpdatedEvent domainEvent, CancellationToken cancellationToken); @@ -260,7 +264,10 @@ Task UpdateMerchantContact(MerchantDomainEvents.MerchantContactPhoneNumb CancellationToken cancellationToken); Task UpdateMerchantOpeningHours(MerchantDomainEvents.MerchantOpeningHoursUpdatedEvent domainEvent, - CancellationToken cancellationToken); + CancellationToken cancellationToken); + + Task UpdateMerchantSchedule(MerchantScheduleDomainEvents.MerchantScheduleMonthUpdatedEvent domainEvent, + CancellationToken cancellationToken); Task> GetEstate(Guid estateId, CancellationToken cancellationToken); @@ -275,7 +282,12 @@ Task>> GetMerchantContracts(Guid estateId, CancellationToken cancellationToken); Task>> GetMerchants(Guid estateId, - CancellationToken cancellationToken); + CancellationToken cancellationToken); + + Task> GetMerchantSchedule(Guid estateId, + Guid merchantId, + Int32 year, + CancellationToken cancellationToken); Task> GetSettlement(Guid estateId, Guid merchantId, @@ -342,7 +354,7 @@ public async Task> GetMerchantFromReference(Guid estateId, if (merchant == null) return Result.NotFound($"No merchant found with reference {reference}"); - return Result.Success(ModelFactory.ConvertFrom(estateId, merchant, null, null, null, null, null)); + return Result.Success(ModelFactory.ConvertFrom(estateId, merchant, null, null, null, null, null, null, null)); } public async Task AddMerchant(MerchantDomainEvents.MerchantCreatedEvent domainEvent, @@ -365,6 +377,24 @@ public async Task AddMerchant(MerchantDomainEvents.MerchantCreatedEvent return await context.SaveChangesWithDuplicateHandling(cancellationToken); } + public async Task AddMerchantSchedule(MerchantScheduleDomainEvents.MerchantScheduleCreatedEvent domainEvent, + CancellationToken cancellationToken) + { + EstateManagementContext context = await this.GetContext(domainEvent.EstateId); + + MerchantSchedule merchantSchedule = new() + { + MerchantScheduleId = domainEvent.MerchantScheduleId, + EstateId = domainEvent.EstateId, + MerchantId = domainEvent.MerchantId, + Year = domainEvent.Year + }; + + await context.MerchantSchedules.AddAsync(merchantSchedule, cancellationToken); + + return await context.SaveChangesWithDuplicateHandling(cancellationToken); + } + public async Task UpdateMerchant(MerchantNameUpdatedEvent domainEvent, CancellationToken cancellationToken) { EstateManagementContext context = await this.GetContext(domainEvent.EstateId); @@ -752,6 +782,40 @@ public async Task UpdateMerchantOpeningHours(MerchantOpeningHoursUpdated return await context.SaveChangesAsync(cancellationToken); } + public async Task UpdateMerchantSchedule(MerchantScheduleDomainEvents.MerchantScheduleMonthUpdatedEvent domainEvent, + CancellationToken cancellationToken) + { + EstateManagementContext context = await this.GetContext(domainEvent.EstateId); + + Result merchantScheduleResult = await context.LoadMerchantSchedule(domainEvent, cancellationToken); + if (merchantScheduleResult.IsFailed) + return ResultHelpers.CreateFailure(merchantScheduleResult); + + Result merchantScheduleMonthResult = await context.LoadMerchantScheduleMonth(domainEvent, cancellationToken); + if (merchantScheduleMonthResult.IsFailed && merchantScheduleMonthResult.Status != ResultStatus.NotFound) + return ResultHelpers.CreateFailure(merchantScheduleMonthResult); + + String closedDays = String.Join(",", domainEvent.ClosedDays.OrderBy(day => day)); + + if (merchantScheduleMonthResult.Status == ResultStatus.NotFound) + { + MerchantScheduleMonth merchantScheduleMonth = new() + { + MerchantScheduleId = merchantScheduleResult.Data.MerchantScheduleId, + Month = domainEvent.Month, + ClosedDays = closedDays + }; + + await context.MerchantScheduleMonths.AddAsync(merchantScheduleMonth, cancellationToken); + } + else + { + merchantScheduleMonthResult.Data.ClosedDays = closedDays; + } + + return await context.SaveChangesAsync(cancellationToken); + } + static readonly Dictionary> setOpeningHours = new() { @@ -792,7 +856,7 @@ public async Task UpdateMerchant(MerchantReferenceAllocatedEvent domainE } public async Task>> GetMerchants(Guid estateId, - CancellationToken cancellationToken) + CancellationToken cancellationToken) { EstateManagementContext context = await this.GetContext(estateId); @@ -802,6 +866,10 @@ public async Task>> GetMerchants(Guid estateId, List merchantOperators = await (from o in context.MerchantOperators where merchants.Select(m => m.MerchantId).Contains(o.MerchantId) select o).ToListAsync(cancellationToken); List merchantSecurityUsers = await (from u in context.MerchantSecurityUsers where merchants.Select(m => m.MerchantId).Contains(u.MerchantId) select u).ToListAsync(cancellationToken); List merchantDevices = await (from d in context.MerchantDevices where merchants.Select(m => m.MerchantId).Contains(d.MerchantId) select d).ToListAsync(cancellationToken); + List merchantSchedules = await (from s in context.MerchantSchedules where merchants.Select(m => m.MerchantId).Contains(s.MerchantId) select s).ToListAsync(cancellationToken); + List merchantScheduleMonths = await (from sm in context.MerchantScheduleMonths + where merchantSchedules.Select(s => s.MerchantScheduleId).Contains(sm.MerchantScheduleId) + select sm).ToListAsync(cancellationToken); if (merchants.Any() == false) { @@ -817,13 +885,58 @@ public async Task>> GetMerchants(Guid estateId, List o = merchantOperators.Where(mo => mo.MerchantId == m.MerchantId).ToList(); List u = merchantSecurityUsers.Where(msu => msu.MerchantId == m.MerchantId).ToList(); List d = merchantDevices.Where(ma => ma.MerchantId == m.MerchantId).ToList(); + List s = merchantSchedules.Where(ms => ms.MerchantId == m.MerchantId).ToList(); - models.Add(ModelFactory.ConvertFrom(estateId, m, a, c, o, d, u)); + models.Add(ModelFactory.ConvertFrom(estateId, m, a, c, o, d, u, s, merchantScheduleMonths)); } return Result.Success(models); } + public async Task> GetMerchantSchedule(Guid estateId, + Guid merchantId, + Int32 year, + CancellationToken cancellationToken) + { + EstateManagementContext context = await this.GetContext(estateId); + + MerchantSchedule merchantSchedule = await (from s in context.MerchantSchedules + where s.EstateId == estateId && + s.MerchantId == merchantId && + s.Year == year + select s).SingleOrDefaultAsync(cancellationToken); + + if (merchantSchedule == null) + { + return Result.NotFound($"No merchant schedule found for Merchant [{merchantId}] in Year [{year}]"); + } + + List merchantScheduleMonths = await (from sm in context.MerchantScheduleMonths + where sm.MerchantScheduleId == merchantSchedule.MerchantScheduleId + orderby sm.Month + select sm).ToListAsync(cancellationToken); + + MerchantScheduleModel schedule = new() + { + MerchantScheduleId = merchantSchedule.MerchantScheduleId, + EstateId = merchantSchedule.EstateId, + MerchantId = merchantSchedule.MerchantId, + Year = merchantSchedule.Year, + Months = merchantScheduleMonths.Select(month => new TransactionProcessor.Models.MerchantSchedule.MerchantScheduleMonth + { + Month = month.Month, + ClosedDays = month.ClosedDays + .Split(',', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries) + .Select(day => Int32.TryParse(day, out Int32 parsedDay) ? (Int32?)parsedDay : null) + .Where(day => day.HasValue) + .Select(day => day.Value) + .ToList() + }).ToList() + }; + + return Result.Success(schedule); + } + public async Task>> GetMerchantContracts(Guid estateId, Guid merchantId, CancellationToken cancellationToken) @@ -2255,4 +2368,4 @@ public static async Task ExecuteSafeAsync(Func merchantContacts, List merchantOperators, List merchantDevices, - List merchantSecurityUsers) + List merchantSecurityUsers, + List merchantSchedules, + List merchantScheduleMonths) { MerchantModel merchantModel = ModelFactory.ConvertFrom(estateId, merchant); @@ -87,6 +93,7 @@ public static MerchantModel ConvertFrom(Guid estateId, merchantModel.Operators = ConvertFrom(merchantOperators); merchantModel.Devices = ConvertFrom(merchantDevices); merchantModel.SecurityUsers = ConvertFrom(merchantSecurityUsers); + merchantModel.Schedules = ConvertFrom(merchantSchedules, merchantScheduleMonths); return merchantModel; } @@ -143,5 +150,47 @@ private static List ConvertFrom(List ConvertFrom(List merchantSchedules, + List merchantScheduleMonths) + { + List schedules = []; + merchantScheduleMonths ??= []; + + if (merchantSchedules == null || merchantSchedules.Any() == false) + { + return schedules; + } + + foreach (MerchantScheduleEntity merchantSchedule in merchantSchedules.OrderBy(s => s.Year)) + { + MerchantScheduleModel schedule = new() + { + MerchantScheduleId = merchantSchedule.MerchantScheduleId, + EstateId = merchantSchedule.EstateId, + MerchantId = merchantSchedule.MerchantId, + Year = merchantSchedule.Year, + Months = [] + }; + + foreach (MerchantScheduleMonthEntity merchantScheduleMonth in merchantScheduleMonths + .Where(m => m.MerchantScheduleId == merchantSchedule.MerchantScheduleId) + .OrderBy(m => m.Month)) + { + schedule.Months.Add(new MerchantScheduleMonthModel + { + Month = merchantScheduleMonth.Month, + ClosedDays = merchantScheduleMonth.ClosedDays + .Split(',', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries) + .Select(Int32.Parse) + .ToList() + }); + } + + schedules.Add(schedule); + } + + return schedules; + } } } diff --git a/TransactionProcessor.Testing/TestData.cs b/TransactionProcessor.Testing/TestData.cs index 6d2d495d..946e3004 100644 --- a/TransactionProcessor.Testing/TestData.cs +++ b/TransactionProcessor.Testing/TestData.cs @@ -6,9 +6,11 @@ using Shared.ValueObjects; using TransactionProcessor.Aggregates; using TransactionProcessor.BusinessLogic.Events; +using TransactionProcessor.BusinessLogic.Services; using TransactionProcessor.DataTransferObjects.Requests.Contract; using TransactionProcessor.DataTransferObjects.Requests.Estate; using TransactionProcessor.DataTransferObjects.Requests.Merchant; +using TransactionProcessor.DataTransferObjects.Requests.MerchantSchedule; using TransactionProcessor.DataTransferObjects.Requests.Operator; using TransactionProcessor.DataTransferObjects.Responses.Estate; using TransactionProcessor.DataTransferObjects.Responses.Merchant; @@ -250,6 +252,8 @@ public class TestData public static Models.Merchant.MerchantDepositSource MerchantDepositSourceManual = Models.Merchant.MerchantDepositSource.Manual; public static Models.Merchant.MerchantDepositSource MerchantDepositSourceAutomatic = Models.Merchant.MerchantDepositSource.Automatic; public static DataTransferObjects.Responses.Merchant.SettlementSchedule SettlementScheduleDTO = DataTransferObjects.Responses.Merchant.SettlementSchedule.Monthly; + public static Int32 MerchantScheduleYear = 2026; + public static Guid MerchantScheduleId = IdGenerationService.GenerateMerchantScheduleAggregateId(TestData.EstateId, TestData.MerchantId, TestData.MerchantScheduleYear); public static CreateMerchantRequest CreateMerchantRequest => new CreateMerchantRequest { @@ -276,6 +280,33 @@ public class TestData SettlementSchedule = TestData.SettlementScheduleDTO }; + public static CreateMerchantScheduleRequest CreateMerchantScheduleRequest => + new CreateMerchantScheduleRequest + { + Year = TestData.MerchantScheduleYear, + Months = + [ + new MerchantScheduleMonthRequest + { + Month = 1, + ClosedDays = [1, 26] + } + ] + }; + + public static UpdateMerchantScheduleRequest UpdateMerchantScheduleRequest => + new UpdateMerchantScheduleRequest + { + Months = + [ + new MerchantScheduleMonthRequest + { + Month = 2, + ClosedDays = [14] + } + ] + }; + public static String MerchantAddressLine1 = "Address Line 1"; public static String MerchantAddressLine1Update = "Address Line 1 Update"; @@ -2144,6 +2175,10 @@ public static class Commands { Sunday = new OpeningHours { Opening = "0800", Closing = "1300" } }); + public static MerchantCommands.CreateMerchantScheduleCommand CreateMerchantScheduleCommand => new(TestData.EstateId, TestData.MerchantId, TestData.CreateMerchantScheduleRequest); + + public static MerchantCommands.UpdateMerchantScheduleCommand UpdateMerchantScheduleCommand => new(TestData.EstateId, TestData.MerchantId, TestData.MerchantScheduleYear, TestData.UpdateMerchantScheduleRequest); + public static TransactionCommands.ProcessSaleTransactionCommand ProcessSaleTransactionCommand => new(TestData.TransactionId, TestData.EstateId, TestData.MerchantId, @@ -2443,6 +2478,21 @@ public static MerchantAggregate EmptyMerchantAggregate() return merchantAggregate; } + + public static MerchantScheduleAggregate EmptyMerchantScheduleAggregate() + { + Guid merchantScheduleId = IdGenerationService.GenerateMerchantScheduleAggregateId(TestData.EstateId, TestData.MerchantId, TestData.MerchantScheduleYear); + + return MerchantScheduleAggregate.Create(merchantScheduleId); + } + + public static MerchantScheduleAggregate CreatedMerchantScheduleAggregate() + { + MerchantScheduleAggregate merchantScheduleAggregate = EmptyMerchantScheduleAggregate(); + merchantScheduleAggregate.Create(TestData.EstateId, TestData.MerchantId, TestData.MerchantScheduleYear, []); + + return merchantScheduleAggregate; + } public static OperatorAggregate EmptyOperatorAggregate() { OperatorAggregate operatorAggregate = OperatorAggregate.Create(TestData.OperatorId); @@ -2609,6 +2659,24 @@ public static Models.Merchant.Merchant MerchantModelWithAddressesContactsDevices MerchantId = TestData.MerchantId, MerchantName = TestData.MerchantName, SettlementSchedule = settlementSchedule, + Schedules = new List + { + new() + { + MerchantScheduleId = MerchantScheduleId, + EstateId = EstateId, + MerchantId = MerchantId, + Year = MerchantScheduleYear, + Months = + [ + new Models.MerchantSchedule.MerchantScheduleMonth + { + Month = 1, + ClosedDays = [1, 26] + } + ] + } + }, Addresses = new List{ TestData.AddressModel }, @@ -2730,6 +2798,8 @@ public static class DomainEvents { public static MerchantDomainEvents.SecurityUserAddedToMerchantEvent MerchantSecurityUserAddedEvent => new MerchantDomainEvents.SecurityUserAddedToMerchantEvent(TestData.MerchantId, TestData.EstateId, TestData.MerchantSecurityUserId, TestData.EmailAddress); public static MerchantDomainEvents.SettlementScheduleChangedEvent SettlementScheduleChangedEvent => new MerchantDomainEvents.SettlementScheduleChangedEvent(TestData.MerchantId, TestData.EstateId, (Int32)TestData.SettlementSchedule, TestData.NextSettlementDate); + public static MerchantScheduleDomainEvents.MerchantScheduleCreatedEvent MerchantScheduleCreatedEvent => new(TestData.MerchantScheduleId, TestData.EstateId, TestData.MerchantId, TestData.MerchantScheduleYear); + public static MerchantScheduleDomainEvents.MerchantScheduleMonthUpdatedEvent MerchantScheduleMonthUpdatedEvent => new(TestData.MerchantScheduleId, TestData.EstateId, TestData.MerchantId, TestData.MerchantScheduleYear, 12, [25, 26]); //public static StatementGeneratedEvent StatementGeneratedEvent => new StatementGeneratedEvent(TestData.MerchantStatementId, TestData.EstateId, TestData.MerchantId, TestData.StatementGeneratedDate); public static MerchantDomainEvents.MerchantNameUpdatedEvent MerchantNameUpdatedEvent => new MerchantDomainEvents.MerchantNameUpdatedEvent(TestData.MerchantId, TestData.EstateId, TestData.MerchantNameUpdated); public static MerchantDomainEvents.DeviceSwappedForMerchantEvent DeviceSwappedForMerchantEvent => @@ -2798,4 +2868,4 @@ public static class DomainEvents { } -} \ No newline at end of file +} diff --git a/TransactionProcessor.Tests/Factories/ModelFactoryTests.cs b/TransactionProcessor.Tests/Factories/ModelFactoryTests.cs index edb92859..9da9dfae 100644 --- a/TransactionProcessor.Tests/Factories/ModelFactoryTests.cs +++ b/TransactionProcessor.Tests/Factories/ModelFactoryTests.cs @@ -498,6 +498,12 @@ public void ModelFactory_Merchant_IsConverted(Models.Merchant.SettlementSchedule contactResponse.ContactEmailAddress.ShouldBe(merchantModel.Contacts.Single().ContactEmailAddress); contactResponse.ContactName.ShouldBe(merchantModel.Contacts.Single().ContactName); contactResponse.ContactPhoneNumber.ShouldBe(merchantModel.Contacts.Single().ContactPhoneNumber); + + merchantResponse.Schedules.ShouldHaveSingleItem(); + merchantResponse.Schedules.Single().Year.ShouldBe(TestData.MerchantScheduleYear); + merchantResponse.Schedules.Single().Months.ShouldHaveSingleItem(); + merchantResponse.Schedules.Single().Months.Single().Month.ShouldBe(1); + merchantResponse.Schedules.Single().Months.Single().ClosedDays.ShouldBe(new List { 1, 26 }); } [Fact] diff --git a/TransactionProcessor/Bootstrapper/RepositoryRegistry.cs b/TransactionProcessor/Bootstrapper/RepositoryRegistry.cs index 30198b25..cd967bdc 100644 --- a/TransactionProcessor/Bootstrapper/RepositoryRegistry.cs +++ b/TransactionProcessor/Bootstrapper/RepositoryRegistry.cs @@ -89,6 +89,7 @@ private void RegisterAggregateRepositories() { this.AddSingleton, AggregateRepository>(); this.AddSingleton, AggregateRepository>(); this.AddSingleton, AggregateRepository>(); + this.AddSingleton, AggregateRepository>(); } private void RegisterAggregateCachingFunc() { diff --git a/TransactionProcessor/Endpoints/MerchantEndpoints.cs b/TransactionProcessor/Endpoints/MerchantEndpoints.cs index 5ecb7828..eed8e18d 100644 --- a/TransactionProcessor/Endpoints/MerchantEndpoints.cs +++ b/TransactionProcessor/Endpoints/MerchantEndpoints.cs @@ -26,6 +26,8 @@ public static IEndpointRouteBuilder MapMerchantEndpoints(this IEndpointRouteBuil merchantGroup.MapGet("/", MerchantHandlers.GetMerchants).WithName("GetMerchants"); merchantGroup.MapGet("/{merchantId:guid}", MerchantHandlers.GetMerchant).WithName("GetMerchant"); merchantGroup.MapGet("/{merchantId:guid}/contracts", MerchantHandlers.GetMerchantContracts).WithName("GetMerchantContracts"); + merchantGroup.MapGet("/{merchantId:guid}/schedules/{year:int}", MerchantHandlers.GetMerchantSchedule).WithName("GetMerchantSchedule"); + merchantGroup.MapGet("/{merchantId:guid}/schedules/{year:int}/readmodel", MerchantHandlers.GetMerchantScheduleFromReadModel).WithName("GetMerchantScheduleFromReadModel"); merchantGroup.MapGet("/{merchantId:guid}/contracts/{contractId:guid}/products/{productId:guid}/transactionFees", MerchantHandlers.GetTransactionFeesForProduct).WithName("GetTransactionFeesForProduct"); @@ -56,7 +58,9 @@ public static IEndpointRouteBuilder MapMerchantEndpoints(this IEndpointRouteBuil merchantGroup.MapPatch("/{merchantId:guid}", MerchantHandlers.UpdateMerchant).WithName("UpdateMerchant"); merchantGroup.MapPatch("/{merchantId:guid}/opening", MerchantHandlers.UpdateMerchantOpening).WithName("UpdateMerchantOpening"); + merchantGroup.MapPost("/{merchantId:guid}/schedules", MerchantHandlers.CreateMerchantSchedule).WithName("CreateMerchantSchedule"); + merchantGroup.MapPatch("/{merchantId:guid}/schedules/{year:int}", MerchantHandlers.UpdateMerchantSchedule).WithName("UpdateMerchantSchedule"); return endpoints; } -} \ No newline at end of file +} diff --git a/TransactionProcessor/Factories/ModelFactory.cs b/TransactionProcessor/Factories/ModelFactory.cs index a2d74f82..22dc0397 100644 --- a/TransactionProcessor/Factories/ModelFactory.cs +++ b/TransactionProcessor/Factories/ModelFactory.cs @@ -499,8 +499,35 @@ public static MerchantResponse ConvertFrom(Models.Merchant.Merchant merchant) Opening = oh.Value.Opening, Closing = oh.Value.Closing }); + merchantResponse.Schedules = merchant.Schedules?.Select(schedule => new MerchantScheduleResponse + { + Year = schedule.Year, + Months = schedule.Months.Select(month => new MerchantScheduleMonthResponse + { + Month = month.Month, + ClosedDays = [.. month.ClosedDays] + }).ToList() + }).ToList(); return merchantResponse; } + + public static MerchantScheduleResponse ConvertFrom(TransactionProcessor.Models.MerchantSchedule.MerchantSchedule merchantSchedule) + { + if (merchantSchedule == null) + { + return null; + } + + return new MerchantScheduleResponse + { + Year = merchantSchedule.Year, + Months = merchantSchedule.Months.Select(month => new MerchantScheduleMonthResponse + { + Month = month.Month, + ClosedDays = [.. month.ClosedDays] + }).ToList() + }; + } } -} \ No newline at end of file +} diff --git a/TransactionProcessor/Handlers/MerchantHandlers.cs b/TransactionProcessor/Handlers/MerchantHandlers.cs index e62c4ffa..4decfd1d 100644 --- a/TransactionProcessor/Handlers/MerchantHandlers.cs +++ b/TransactionProcessor/Handlers/MerchantHandlers.cs @@ -9,6 +9,7 @@ using TransactionProcessor.BusinessLogic.Requests; using TransactionProcessor.DataTransferObjects; using TransactionProcessor.DataTransferObjects.Requests.Merchant; +using TransactionProcessor.DataTransferObjects.Requests.MerchantSchedule; using TransactionProcessor.Factories; using TransactionProcessor.Models.Contract; using TransactionProcessor.ProjectionEngine.Models; @@ -243,8 +244,8 @@ public static async Task UpdateMerchant(IMediator mediator, } public static async Task UpdateMerchantOpening(IMediator mediator, - HttpContext ctx, - Guid estateId, + HttpContext ctx, + Guid estateId, Guid merchantId, MerchantOpeningRequest merchantOpeningRequest, CancellationToken cancellationToken) @@ -256,9 +257,58 @@ public static async Task UpdateMerchantOpening(IMediator mediator, } + public static async Task CreateMerchantSchedule(IMediator mediator, + HttpContext ctx, + Guid estateId, + Guid merchantId, + CreateMerchantScheduleRequest createMerchantScheduleRequest, + CancellationToken cancellationToken) { + MerchantCommands.CreateMerchantScheduleCommand command = new(estateId, merchantId, createMerchantScheduleRequest); + Result result = await mediator.Send(command, cancellationToken); + + return ResponseFactory.FromResult(result); + } + + public static async Task GetMerchantSchedule(IMediator mediator, + HttpContext ctx, + Guid estateId, + Guid merchantId, + Int32 year, + CancellationToken cancellationToken) { + MerchantQueries.GetMerchantScheduleQuery query = new(estateId, merchantId, year); + Result result = await mediator.Send(query, cancellationToken); + + return ResponseFactory.FromResult(result, ModelFactory.ConvertFrom); + } + + public static async Task GetMerchantScheduleFromReadModel(IMediator mediator, + HttpContext ctx, + Guid estateId, + Guid merchantId, + Int32 year, + CancellationToken cancellationToken) { + MerchantQueries.GetMerchantScheduleFromReadModelQuery query = new(estateId, merchantId, year); + Result result = await mediator.Send(query, cancellationToken); + + return ResponseFactory.FromResult(result, ModelFactory.ConvertFrom); + } + + public static async Task UpdateMerchantSchedule(IMediator mediator, + HttpContext ctx, + Guid estateId, + Guid merchantId, + Int32 year, + UpdateMerchantScheduleRequest updateMerchantScheduleRequest, + CancellationToken cancellationToken) { + MerchantCommands.UpdateMerchantScheduleCommand command = new(estateId, merchantId, year, updateMerchantScheduleRequest); + Result result = await mediator.Send(command, cancellationToken); + + return ResponseFactory.FromResult(result); + } + public static async Task AddMerchantAddress(IMediator mediator, - HttpContext ctx, - Guid estateId, + HttpContext ctx, + Guid estateId, Guid merchantId, TransactionProcessor.DataTransferObjects.Requests.Merchant.Address addAddressRequest, CancellationToken cancellationToken) { @@ -317,4 +367,4 @@ public static async Task GenerateMerchantStatement(IMediator mediator, return ResponseFactory.FromResult(result); } -} \ No newline at end of file +} diff --git a/TransactionProcessor/appsettings.json b/TransactionProcessor/appsettings.json index 1db20801..b327a7b9 100644 --- a/TransactionProcessor/appsettings.json +++ b/TransactionProcessor/appsettings.json @@ -92,7 +92,9 @@ "FileLineProcessingFailedEvent", "FileLineProcessingIgnoredEvent", "FileProcessingCompletedEvent", - "MerchantOpeningHoursUpdatedEvent" + "MerchantOpeningHoursUpdatedEvent", + "MerchantScheduleCreatedEvent", + "MerchantScheduleMonthUpdatedEvent" ] }, "EventHandlerConfigurationDomain": {