diff --git a/TransactionProcessor.Aggregates.Tests/EstateAggregateTests.cs b/TransactionProcessor.Aggregates.Tests/EstateAggregateTests.cs index 7584e562..e725fa46 100644 --- a/TransactionProcessor.Aggregates.Tests/EstateAggregateTests.cs +++ b/TransactionProcessor.Aggregates.Tests/EstateAggregateTests.cs @@ -1,5 +1,5 @@ using Shouldly; -using TransactionProcessor.Models; +using TransactionProcessor.Models.Estate; using TransactionProcessor.Testing; namespace TransactionProcessor.Aggregates.Tests @@ -72,7 +72,7 @@ public void EstateAggregate_GetEstate_NoOperators_EstateIsReturned() EstateAggregate aggregate = EstateAggregate.Create(TestData.EstateId); aggregate.Create(TestData.EstateName); aggregate.GenerateReference(); - TransactionProcessor.Models.Estate model = aggregate.GetEstate(); + TransactionProcessor.Models.Estate.Estate model = aggregate.GetEstate(); model.EstateId.ShouldBe(TestData.EstateId); model.Name.ShouldBe(TestData.EstateName); @@ -88,14 +88,14 @@ public void EstateAggregate_GetEstate_WithAnOperator_EstateIsReturned() aggregate.GenerateReference(); aggregate.AddOperator(TestData.OperatorId); - TransactionProcessor.Models.Estate model = aggregate.GetEstate(); + TransactionProcessor.Models.Estate.Estate model = aggregate.GetEstate(); model.EstateId.ShouldBe(TestData.EstateId); model.Name.ShouldBe(TestData.EstateName); model.Reference.ShouldBe(TestData.EstateReference); model.Operators.ShouldHaveSingleItem(); - EstateOperator? @operator =model.Operators.Single(); + Models.Estate.Operator? @operator =model.Operators.Single(); @operator.OperatorId.ShouldBe(TestData.OperatorId); } @@ -105,7 +105,7 @@ public void EstateAggregate_GetEstate_NoSecurityUsers_EstateIsReturned() EstateAggregate aggregate = EstateAggregate.Create(TestData.EstateId); aggregate.Create(TestData.EstateName); aggregate.GenerateReference(); - TransactionProcessor.Models.Estate model = aggregate.GetEstate(); + TransactionProcessor.Models.Estate.Estate model = aggregate.GetEstate(); model.EstateId.ShouldBe(TestData.EstateId); model.Name.ShouldBe(TestData.EstateName); @@ -122,14 +122,14 @@ public void EstateAggregate_GetEstate_WithASecurityUser_EstateIsReturned() aggregate.GenerateReference(); aggregate.AddSecurityUser(TestData.SecurityUserId,TestData.EstateUserEmailAddress); - TransactionProcessor.Models.Estate model = aggregate.GetEstate(); + TransactionProcessor.Models.Estate.Estate model = aggregate.GetEstate(); model.EstateId.ShouldBe(TestData.EstateId); model.Name.ShouldBe(TestData.EstateName); model.Reference.ShouldBe(TestData.EstateReference); model.SecurityUsers.ShouldHaveSingleItem(); - SecurityUser securityUser = model.SecurityUsers.Single(); + SecurityUser? securityUser = model.SecurityUsers.Single(); securityUser.SecurityUserId.ShouldBe(TestData.SecurityUserId); securityUser.EmailAddress.ShouldBe(TestData.EstateUserEmailAddress); } @@ -142,7 +142,7 @@ public void EstateAggregate_AddOperatorToEstate_OperatorIsAdded() aggregate.AddOperator(TestData.OperatorId); - TransactionProcessor.Models.Estate estate = aggregate.GetEstate(); + TransactionProcessor.Models.Estate.Estate estate = aggregate.GetEstate(); estate.Operators.ShouldHaveSingleItem(); estate.Operators.Single().OperatorId.ShouldBe(TestData.OperatorId); estate.Operators.Single().IsDeleted.ShouldBeFalse(); @@ -183,7 +183,7 @@ public void EstateAggregate_AddSecurityUserToEstate_SecurityUserIsAdded() aggregate.Create(TestData.EstateName); aggregate.AddSecurityUser(TestData.SecurityUserId, TestData.EstateUserEmailAddress); - TransactionProcessor.Models.Estate estate = aggregate.GetEstate(); + TransactionProcessor.Models.Estate.Estate estate = aggregate.GetEstate(); estate.SecurityUsers.ShouldHaveSingleItem(); estate.SecurityUsers.Single().EmailAddress.ShouldBe(TestData.EstateUserEmailAddress); } @@ -210,7 +210,7 @@ public void EstateAggregate_RemoveOperatorFromEstate_OperatorIsAdded() aggregate.RemoveOperator(TestData.OperatorId); - TransactionProcessor.Models.Estate estate = aggregate.GetEstate(); + TransactionProcessor.Models.Estate.Estate estate = aggregate.GetEstate(); estate.Operators.ShouldHaveSingleItem(); estate.Operators.Single().IsDeleted.ShouldBeTrue(); } diff --git a/TransactionProcessor.Aggregates.Tests/OperatorAggregateTests.cs b/TransactionProcessor.Aggregates.Tests/OperatorAggregateTests.cs new file mode 100644 index 00000000..bac3a978 --- /dev/null +++ b/TransactionProcessor.Aggregates.Tests/OperatorAggregateTests.cs @@ -0,0 +1,70 @@ +using Shouldly; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using TransactionProcessor.Testing; + +namespace TransactionProcessor.Aggregates.Tests +{ + public class OperatorAggregateTests + { + [Fact] + public void OperatorAggregate_Create_OperatorIsCreated() + { + + } + + [Fact] + public void OperatorAggregate_CanBeCreated_IsCreated() + { + OperatorAggregate aggregate = OperatorAggregate.Create(TestData.OperatorId); + + aggregate.AggregateId.ShouldBe(TestData.OperatorId); + } + + [Fact] + public void OperatorAggregate_Create_IsCreated() + { + OperatorAggregate aggregate = OperatorAggregate.Create(TestData.OperatorId); + aggregate.Create(TestData.EstateId, TestData.OperatorName, TestData.RequireCustomMerchantNumber, TestData.RequireCustomTerminalNumber); + + aggregate.AggregateId.ShouldBe(TestData.OperatorId); + aggregate.Name.ShouldBe(TestData.OperatorName); + aggregate.IsCreated.ShouldBeTrue(); + aggregate.EstateId.ShouldBe(TestData.EstateId); + aggregate.RequireCustomTerminalNumber.ShouldBe(TestData.RequireCustomTerminalNumber); + aggregate.RequireCustomMerchantNumber.ShouldBe(TestData.RequireCustomMerchantNumber); + } + + [Fact] + public void OperatorAggregate_GetOperator_OperatorIsReturned() + { + OperatorAggregate aggregate = OperatorAggregate.Create(TestData.OperatorId); + aggregate.Create(TestData.EstateId, TestData.OperatorName, TestData.RequireCustomMerchantNumber, TestData.RequireCustomTerminalNumber); + Models.Operator.Operator @operator = aggregate.GetOperator(); + @operator.OperatorId.ShouldBe(TestData.OperatorId); + @operator.Name.ShouldBe(TestData.OperatorName); + @operator.RequireCustomTerminalNumber.ShouldBe(TestData.RequireCustomTerminalNumber); + @operator.RequireCustomMerchantNumber.ShouldBe(TestData.RequireCustomMerchantNumber); + } + + [Fact] + public void OperatorAggregate_UpdateOperator_IsUpdated() + { + OperatorAggregate aggregate = OperatorAggregate.Create(TestData.OperatorId); + aggregate.Create(TestData.EstateId, TestData.OperatorName, TestData.RequireCustomMerchantNumberFalse, TestData.RequireCustomTerminalNumberFalse); + + aggregate.Name.ShouldBe(TestData.OperatorName); + aggregate.RequireCustomTerminalNumber.ShouldBe(TestData.RequireCustomMerchantNumberFalse); + aggregate.RequireCustomMerchantNumber.ShouldBe(TestData.RequireCustomTerminalNumberFalse); + + aggregate.UpdateOperator(TestData.OperatorName2, TestData.RequireCustomMerchantNumberTrue, TestData.RequireCustomTerminalNumberTrue); + + aggregate.Name.ShouldBe(TestData.OperatorName2); + aggregate.RequireCustomTerminalNumber.ShouldBe(TestData.RequireCustomMerchantNumberTrue); + aggregate.RequireCustomMerchantNumber.ShouldBe(TestData.RequireCustomTerminalNumberTrue); + } + } +} diff --git a/TransactionProcessor.Aggregates.Tests/TransactionProcessor.Aggregates.Tests.csproj b/TransactionProcessor.Aggregates.Tests/TransactionProcessor.Aggregates.Tests.csproj index 7a2dc8a6..9ddfb280 100644 --- a/TransactionProcessor.Aggregates.Tests/TransactionProcessor.Aggregates.Tests.csproj +++ b/TransactionProcessor.Aggregates.Tests/TransactionProcessor.Aggregates.Tests.csproj @@ -4,13 +4,16 @@ net8.0 enable enable - + None false true - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/TransactionProcessor.Aggregates/EstateAggregate.cs b/TransactionProcessor.Aggregates/EstateAggregate.cs index 770a94dc..4f13f1be 100644 --- a/TransactionProcessor.Aggregates/EstateAggregate.cs +++ b/TransactionProcessor.Aggregates/EstateAggregate.cs @@ -2,8 +2,8 @@ using Shared.DomainDrivenDesign.EventSourcing; using Shared.EventStore.Aggregate; using Shared.General; -using TransactionProcessor.Aggregates.Models; using TransactionProcessor.Estate.DomainEvents; +using TransactionProcessor.Models.Estate; namespace TransactionProcessor.Aggregates{ public static class EstateAggregateExtensions{ @@ -70,18 +70,18 @@ public static void GenerateReference(this EstateAggregate aggregate){ aggregate.ApplyAndAppend(estateReferenceAllocatedEvent); } - public static TransactionProcessor.Models.Estate GetEstate(this EstateAggregate aggregate){ - TransactionProcessor.Models.Estate estateModel = new TransactionProcessor.Models.Estate(); + public static TransactionProcessor.Models.Estate.Estate GetEstate(this EstateAggregate aggregate){ + TransactionProcessor.Models.Estate.Estate estateModel = new TransactionProcessor.Models.Estate.Estate(); estateModel.EstateId = aggregate.AggregateId; estateModel.Name = aggregate.EstateName; estateModel.Reference = aggregate.EstateReference; - estateModel.Operators = new List(); + estateModel.Operators = new List(); if (aggregate.Operators.Any()){ - foreach (KeyValuePair @operator in aggregate.Operators){ - estateModel.Operators.Add(new TransactionProcessor.Models.EstateOperator + foreach (KeyValuePair @operator in aggregate.Operators){ + estateModel.Operators.Add(new TransactionProcessor.Models.Estate.Operator { OperatorId = @operator.Key, IsDeleted = @operator.Value.IsDeleted, @@ -89,11 +89,11 @@ public static TransactionProcessor.Models.Estate GetEstate(this EstateAggregate } } - estateModel.SecurityUsers = new List(); + estateModel.SecurityUsers = new List(); if (aggregate.SecurityUsers.Any()){ - foreach (KeyValuePair securityUser in aggregate.SecurityUsers){ - estateModel.SecurityUsers.Add(new TransactionProcessor.Models.SecurityUser + foreach (KeyValuePair securityUser in aggregate.SecurityUsers){ + estateModel.SecurityUsers.Add(new TransactionProcessor.Models.Estate.SecurityUser { EmailAddress = securityUser.Value.EmailAddress, SecurityUserId = securityUser.Key @@ -104,8 +104,8 @@ public static TransactionProcessor.Models.Estate GetEstate(this EstateAggregate return estateModel; } - public static void PlayEvent(this EstateAggregate aggregate, SecurityUserAddedToEstateEvent domainEvent){ - SecurityUser securityUser = new (domainEvent.EmailAddress); + public static void PlayEvent(this EstateAggregate aggregate, SecurityUserAddedToEstateEvent domainEvent) { + SecurityUser securityUser = new() { EmailAddress = domainEvent.EmailAddress, SecurityUserId = domainEvent.SecurityUserId }; aggregate.SecurityUsers.Add(domainEvent.SecurityUserId,securityUser); } @@ -124,16 +124,17 @@ public static void PlayEvent(this EstateAggregate aggregate, EstateReferenceAllo /// /// The domain event. public static void PlayEvent(this EstateAggregate aggregate, OperatorAddedToEstateEvent domainEvent){ - Operator @operator = new (); + TransactionProcessor.Models.Estate.Operator @operator = new() { + IsDeleted = false, + OperatorId = domainEvent.OperatorId + }; aggregate.Operators.Add(domainEvent.OperatorId, @operator); } public static void PlayEvent(this EstateAggregate aggregate, OperatorRemovedFromEstateEvent domainEvent){ - KeyValuePair @operator = aggregate.Operators.Single(o => o.Key == domainEvent.OperatorId); - aggregate.Operators[domainEvent.OperatorId] = @operator.Value with{ - IsDeleted = true - }; + KeyValuePair @operator = aggregate.Operators.Single(o => o.Key == domainEvent.OperatorId); + aggregate.Operators[domainEvent.OperatorId].IsDeleted = true; } private static void CheckEstateHasBeenCreated(this EstateAggregate aggregate){ @@ -168,9 +169,9 @@ private static void CheckOperatorHasBeenAdded(this EstateAggregate aggregate, public record EstateAggregate : Aggregate{ #region Fields - internal readonly Dictionary Operators; + internal readonly Dictionary Operators; - internal readonly Dictionary SecurityUsers; + internal readonly Dictionary SecurityUsers; #endregion @@ -179,7 +180,7 @@ public record EstateAggregate : Aggregate{ [ExcludeFromCodeCoverage] public EstateAggregate(){ // Nothing here - this.Operators = new Dictionary(); + this.Operators = new Dictionary(); this.SecurityUsers = new Dictionary(); } @@ -187,7 +188,7 @@ private EstateAggregate(Guid aggregateId){ Guard.ThrowIfInvalidGuid(aggregateId, "Aggregate Id cannot be an Empty Guid"); this.AggregateId = aggregateId; - this.Operators = new Dictionary(); + this.Operators = new Dictionary(); this.SecurityUsers = new Dictionary(); } diff --git a/TransactionProcessor.Aggregates/Models/Operator.cs b/TransactionProcessor.Aggregates/Models/Operator.cs deleted file mode 100644 index 89cf6580..00000000 --- a/TransactionProcessor.Aggregates/Models/Operator.cs +++ /dev/null @@ -1,6 +0,0 @@ -using System; - -namespace TransactionProcessor.Aggregates.Models -{ - internal record Operator(bool IsDeleted = false); -} \ No newline at end of file diff --git a/TransactionProcessor.Aggregates/Models/SecurityUser.cs b/TransactionProcessor.Aggregates/Models/SecurityUser.cs deleted file mode 100644 index 98f63da7..00000000 --- a/TransactionProcessor.Aggregates/Models/SecurityUser.cs +++ /dev/null @@ -1,6 +0,0 @@ -using System; - -namespace TransactionProcessor.Aggregates.Models -{ - internal record SecurityUser(string EmailAddress); -} diff --git a/TransactionProcessor.Aggregates/OperatorAggregate.cs b/TransactionProcessor.Aggregates/OperatorAggregate.cs new file mode 100644 index 00000000..734289f9 --- /dev/null +++ b/TransactionProcessor.Aggregates/OperatorAggregate.cs @@ -0,0 +1,126 @@ +using Shared.DomainDrivenDesign.EventSourcing; +using Shared.EventStore.Aggregate; +using Shared.General; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using TransactionProcessor.Operator.DomainEvents; + +namespace TransactionProcessor.Aggregates +{ + public static class OperatorAggregateExtensions + { + public static Models.Operator.Operator GetOperator(this OperatorAggregate aggregate) { + return new Models.Operator.Operator() { Name = aggregate.Name, OperatorId = aggregate.AggregateId, RequireCustomMerchantNumber = aggregate.RequireCustomMerchantNumber, RequireCustomTerminalNumber = aggregate.RequireCustomTerminalNumber }; + } + + public static void PlayEvent(this OperatorAggregate aggregate, OperatorCreatedEvent domainEvent) + { + aggregate.IsCreated = true; + aggregate.Name = domainEvent.Name; + aggregate.RequireCustomMerchantNumber = domainEvent.RequireCustomMerchantNumber; + aggregate.RequireCustomTerminalNumber = domainEvent.RequireCustomTerminalNumber; + aggregate.EstateId = domainEvent.EstateId; + } + + public static void PlayEvent(this OperatorAggregate aggregate, OperatorNameUpdatedEvent domainEvent) + { + aggregate.Name = domainEvent.Name; + } + + public static void PlayEvent(this OperatorAggregate aggregate, OperatorRequireCustomMerchantNumberChangedEvent domainEvent) + { + aggregate.RequireCustomMerchantNumber = domainEvent.RequireCustomMerchantNumber; + } + + public static void PlayEvent(this OperatorAggregate aggregate, OperatorRequireCustomTerminalNumberChangedEvent domainEvent) + { + aggregate.IsCreated = true; + aggregate.RequireCustomTerminalNumber = domainEvent.RequireCustomTerminalNumber; + } + + public static void Create(this OperatorAggregate aggregate, + Guid estateId, + String name, + Boolean requireCustomMerchantNumber, + Boolean requireCustomTerminalNumber) + { + Guard.ThrowIfInvalidGuid(estateId, typeof(ArgumentNullException), "Estate Id must not be an empty Guid"); + Guard.ThrowIfNullOrEmpty(name, typeof(ArgumentNullException), "Operator name must not be null or empty"); + + OperatorCreatedEvent operatorCreatedEvent = new(aggregate.AggregateId, estateId, name, requireCustomMerchantNumber, requireCustomTerminalNumber); + + aggregate.ApplyAndAppend(operatorCreatedEvent); + } + + public static void UpdateOperator(this OperatorAggregate aggregate, + String name, + Boolean requireCustomMerchantNumber, + Boolean requireCustomTerminalNumber) + { + if (String.Compare(name, aggregate.Name, StringComparison.InvariantCultureIgnoreCase) != 0 && + String.IsNullOrEmpty(name) == false) + { + OperatorNameUpdatedEvent operatorNameUpdatedEvent = new(aggregate.AggregateId, aggregate.EstateId, name); + aggregate.ApplyAndAppend(operatorNameUpdatedEvent); + } + + if (requireCustomMerchantNumber != aggregate.RequireCustomMerchantNumber) + { + OperatorRequireCustomMerchantNumberChangedEvent operatorRequireCustomMerchantNumberChangedEvent = new(aggregate.AggregateId, aggregate.EstateId, requireCustomMerchantNumber); + aggregate.ApplyAndAppend(operatorRequireCustomMerchantNumberChangedEvent); + } + + if (requireCustomTerminalNumber != aggregate.RequireCustomTerminalNumber) + { + OperatorRequireCustomTerminalNumberChangedEvent operatorRequireCustomTerminalNumberChangedEvent = new(aggregate.AggregateId, aggregate.EstateId, requireCustomTerminalNumber); + aggregate.ApplyAndAppend(operatorRequireCustomTerminalNumberChangedEvent); + } + } + } + + public record OperatorAggregate : Aggregate + { + public Boolean IsCreated { get; internal set; } + public Guid EstateId { get; internal set; } + + public String Name { get; internal set; } + public Boolean RequireCustomMerchantNumber { get; internal set; } + public Boolean RequireCustomTerminalNumber { get; internal set; } + + public static OperatorAggregate Create(Guid aggregateId) + { + return new OperatorAggregate(aggregateId); + } + + #region Constructors + + [ExcludeFromCodeCoverage] + public OperatorAggregate() + { + } + + private OperatorAggregate(Guid aggregateId) + { + Guard.ThrowIfInvalidGuid(aggregateId, "Aggregate Id cannot be an Empty Guid"); + + this.AggregateId = aggregateId; + } + + #endregion + + public override void PlayEvent(IDomainEvent domainEvent) => OperatorAggregateExtensions.PlayEvent(this, (dynamic)domainEvent); + + [ExcludeFromCodeCoverage] + protected override Object GetMetadata() + { + return new + { + EstateId = Guid.NewGuid() // TODO: Populate + }; + } + } +} diff --git a/TransactionProcessor.Aggregates/TransactionProcessor.Aggregates.csproj b/TransactionProcessor.Aggregates/TransactionProcessor.Aggregates.csproj index c7073642..1f1191e3 100644 --- a/TransactionProcessor.Aggregates/TransactionProcessor.Aggregates.csproj +++ b/TransactionProcessor.Aggregates/TransactionProcessor.Aggregates.csproj @@ -14,6 +14,7 @@ + diff --git a/TransactionProcessor.BusinessLogic.Tests/DomainEventHandlers/EstateDomainEventHandlerTests.cs b/TransactionProcessor.BusinessLogic.Tests/DomainEventHandlers/EstateDomainEventHandlerTests.cs new file mode 100644 index 00000000..170372bd --- /dev/null +++ b/TransactionProcessor.BusinessLogic.Tests/DomainEventHandlers/EstateDomainEventHandlerTests.cs @@ -0,0 +1,70 @@ +using System.Threading; +using System.Threading.Tasks; +using Moq; +using Shared.Logger; +using Shouldly; +using SimpleResults; +using TransactionProcessor.BusinessLogic.EventHandling; +using TransactionProcessor.Estate.DomainEvents; +using TransactionProcessor.Repository; +using TransactionProcessor.Testing; +using Xunit; + +namespace TransactionProcessor.BusinessLogic.Tests.DomainEventHandlers; + +public class EstateDomainEventHandlerTests +{ + #region Methods + + private Mock EstateReportingRepository; + + private EstateDomainEventHandler DomainEventHandler; + + public EstateDomainEventHandlerTests() + { + Logger.Initialise(NullLogger.Instance); + this.EstateReportingRepository = new Mock(); + + this.DomainEventHandler = new EstateDomainEventHandler(this.EstateReportingRepository.Object); + } + [Fact] + public void EstateDomainEventHandler_EstateCreatedEvent_EventIsHandled() + { + EstateCreatedEvent estateCreatedEvent = TestData.DomainEvents.EstateCreatedEvent; + this.EstateReportingRepository + .Setup(r => r.CreateReadModel(It.IsAny(), It.IsAny())) + .ReturnsAsync(Result.Success); + + Should.NotThrow(async () => { await this.DomainEventHandler.Handle(estateCreatedEvent, CancellationToken.None); }); + } + + [Fact] + public async Task EstateDomainEventHandler_EstateCreatedEvent_CreateReadModelFailed_EventIsHandled() + { + EstateCreatedEvent estateCreatedEvent = TestData.DomainEvents.EstateCreatedEvent; + this.EstateReportingRepository + .Setup(r => r.CreateReadModel(It.IsAny(), It.IsAny())) + .ReturnsAsync(Result.Failure); + + var result = await this.DomainEventHandler.Handle(estateCreatedEvent, CancellationToken.None); + result.IsFailed.ShouldBeTrue(); + } + + [Fact] + public void EstateDomainEventHandler_EstateReferenceAllocatedEvent_EventIsHandled() + { + EstateReferenceAllocatedEvent estateReferenceAllocatedEvent = TestData.DomainEvents.EstateReferenceAllocatedEvent; + + Should.NotThrow(async () => { await this.DomainEventHandler.Handle(estateReferenceAllocatedEvent, CancellationToken.None); }); + } + + [Fact] + public void EstateDomainEventHandler_SecurityUserAddedEvent_EventIsHandled() + { + SecurityUserAddedToEstateEvent securityUserAddedEvent = TestData.DomainEvents.EstateSecurityUserAddedEvent; + + Should.NotThrow(async () => { await this.DomainEventHandler.Handle(securityUserAddedEvent, CancellationToken.None); }); + } + + #endregion +} \ No newline at end of file diff --git a/TransactionProcessor.BusinessLogic.Tests/DomainEventHandlers/OperatorDomainEventHandlerTests.cs b/TransactionProcessor.BusinessLogic.Tests/DomainEventHandlers/OperatorDomainEventHandlerTests.cs new file mode 100644 index 00000000..f70d716c --- /dev/null +++ b/TransactionProcessor.BusinessLogic.Tests/DomainEventHandlers/OperatorDomainEventHandlerTests.cs @@ -0,0 +1,65 @@ +using System.Threading; +using Moq; +using Shared.Logger; +using Shouldly; +using TransactionProcessor.BusinessLogic.EventHandling; +using TransactionProcessor.Estate.DomainEvents; +using TransactionProcessor.Operator.DomainEvents; +using TransactionProcessor.Repository; +using TransactionProcessor.Testing; +using Xunit; + +namespace TransactionProcessor.BusinessLogic.Tests.DomainEventHandlers; + +public class OperatorDomainEventHandlerTests +{ + private Mock EstateReportingRepository; + private OperatorDomainEventHandler DomainEventHandler; + + public OperatorDomainEventHandlerTests() + { + Logger.Initialise(NullLogger.Instance); + this.EstateReportingRepository = new Mock(); + this.DomainEventHandler = new OperatorDomainEventHandler(this.EstateReportingRepository.Object); + } + + [Fact] + public void OperatorDomainEventHandler_OperatorCreatedEvent_EventIsHandled() + { + OperatorCreatedEvent operatorCreatedEvent = TestData.DomainEvents.OperatorCreatedEvent; + + Should.NotThrow(async () => { await this.DomainEventHandler.Handle(operatorCreatedEvent, CancellationToken.None); }); + } + + [Fact] + public void OperatorDomainEventHandler_OperatorNameUpdatedEvent_EventIsHandled() + { + OperatorNameUpdatedEvent operatorCreatedEvent = TestData.DomainEvents.OperatorNameUpdatedEvent; + + Should.NotThrow(async () => { await this.DomainEventHandler.Handle(operatorCreatedEvent, CancellationToken.None); }); + } + + [Fact] + public void OperatorDomainEventHandler_OperatorRequireCustomMerchantNumberChangedEvent_EventIsHandled() + { + OperatorRequireCustomMerchantNumberChangedEvent operatorCreatedEvent = TestData.DomainEvents.OperatorRequireCustomMerchantNumberChangedEvent; + + Should.NotThrow(async () => { await this.DomainEventHandler.Handle(operatorCreatedEvent, CancellationToken.None); }); + } + + [Fact] + public void OperatorDomainEventHandler_OperatorRequireCustomTerminalNumberChangedEvent_EventIsHandled() + { + OperatorRequireCustomTerminalNumberChangedEvent operatorCreatedEvent = TestData.DomainEvents.OperatorRequireCustomTerminalNumberChangedEvent; + + Should.NotThrow(async () => { await this.DomainEventHandler.Handle(operatorCreatedEvent, CancellationToken.None); }); + } + + [Fact] + public void OperatorDomainEventHandler_EstateCreatedEvent_EventIsHandled() + { + EstateCreatedEvent domainEvent = TestData.DomainEvents.EstateCreatedEvent; + + Should.NotThrow(async () => { await this.DomainEventHandler.Handle(domainEvent, CancellationToken.None); }); + } +} \ No newline at end of file diff --git a/TransactionProcessor.BusinessLogic.Tests/Manager/EstateManagementManagerTests.cs b/TransactionProcessor.BusinessLogic.Tests/Manager/EstateManagementManagerTests.cs index dd0e1a86..93a01365 100644 --- a/TransactionProcessor.BusinessLogic.Tests/Manager/EstateManagementManagerTests.cs +++ b/TransactionProcessor.BusinessLogic.Tests/Manager/EstateManagementManagerTests.cs @@ -25,7 +25,7 @@ public class EstateManagementManagerTests private readonly Mock> EstateAggregateRepository; //private readonly Mock> ContractAggregateRepository; //private readonly Mock> MerchantAggregateRepository; - //private readonly Mock> OperatorAggregateRepository; + private readonly Mock> OperatorAggregateRepository; private readonly EstateManagementManager EstateManagementManager; @@ -36,12 +36,12 @@ public EstateManagementManagerTests() this.EstateAggregateRepository = new Mock>(); //this.ContractAggregateRepository = new Mock>(); //this.MerchantAggregateRepository = new Mock>(); - //this.OperatorAggregateRepository = new Mock>(); + this.OperatorAggregateRepository = new Mock>(); - this.EstateManagementManager = new EstateManagementManager(this.EstateManagementRepository.Object, this.EstateAggregateRepository.Object); //, + this.EstateManagementManager = new EstateManagementManager(this.EstateManagementRepository.Object, this.EstateAggregateRepository.Object, //this.ContractAggregateRepository.Object, //this.MerchantAggregateRepository.Object, - //this.OperatorAggregateRepository.Object); + this.OperatorAggregateRepository.Object); } [Fact] diff --git a/TransactionProcessor.BusinessLogic.Tests/Mediator/DummyEstateManagementManager.cs b/TransactionProcessor.BusinessLogic.Tests/Mediator/DummyEstateManagementManager.cs new file mode 100644 index 00000000..edec0ce2 --- /dev/null +++ b/TransactionProcessor.BusinessLogic.Tests/Mediator/DummyEstateManagementManager.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using SimpleResults; +using TransactionProcessor.BusinessLogic.Manager; + +namespace TransactionProcessor.BusinessLogic.Tests.Mediator; + +public class DummyEstateManagementManager : IEstateManagementManager { + public async Task> GetEstate(Guid estateId, + CancellationToken cancellationToken) { + return Result.Success(new Models.Estate.Estate()); + } + + public async Task>> GetEstates(Guid estateId, + CancellationToken cancellationToken) { + return Result.Success(new List()); + } + + public async Task> GetOperator(Guid estateId, + Guid operatorId, + CancellationToken cancellationToken) { + return Result.Success(new Models.Operator.Operator()); + } + + public async Task>> GetOperators(Guid estateId, + CancellationToken cancellationToken) { + return Result.Success(new List()); + } +} \ No newline at end of file diff --git a/TransactionProcessor.BusinessLogic.Tests/Mediator/DummyOperatorDomainService.cs b/TransactionProcessor.BusinessLogic.Tests/Mediator/DummyOperatorDomainService.cs new file mode 100644 index 00000000..dc425da6 --- /dev/null +++ b/TransactionProcessor.BusinessLogic.Tests/Mediator/DummyOperatorDomainService.cs @@ -0,0 +1,14 @@ +using System.Threading; +using System.Threading.Tasks; +using SimpleResults; +using TransactionProcessor.BusinessLogic.Requests; +using TransactionProcessor.BusinessLogic.Services; + +namespace TransactionProcessor.BusinessLogic.Tests.Mediator; + +public class DummyOperatorDomainService : IOperatorDomainService +{ + public async Task CreateOperator(OperatorCommands.CreateOperatorCommand command, CancellationToken cancellationToken) => Result.Success(); + + public async Task UpdateOperator(OperatorCommands.UpdateOperatorCommand command, CancellationToken cancellationToken) => Result.Success(); +} \ No newline at end of file diff --git a/TransactionProcessor.BusinessLogic.Tests/Mediator/DummySettlementDomainService.cs b/TransactionProcessor.BusinessLogic.Tests/Mediator/DummySettlementDomainService.cs index a43f598a..e6426da6 100644 --- a/TransactionProcessor.BusinessLogic.Tests/Mediator/DummySettlementDomainService.cs +++ b/TransactionProcessor.BusinessLogic.Tests/Mediator/DummySettlementDomainService.cs @@ -1,5 +1,4 @@ -using System.Collections.Generic; -using SimpleResults; +using SimpleResults; using TransactionProcessor.BusinessLogic.Requests; namespace TransactionProcessor.BusinessLogic.Tests.Mediator; @@ -9,7 +8,6 @@ namespace TransactionProcessor.BusinessLogic.Tests.Mediator; using System.Threading.Tasks; using BusinessLogic.Services; using Models; -using TransactionProcessor.BusinessLogic.Manager; public class DummySettlementDomainService : ISettlementDomainService { @@ -25,16 +23,4 @@ public async Task AddMerchantFeePendingSettlement( public async Task AddSettledFeeToSettlement(SettlementCommands.AddSettledFeeToSettlementCommand command, CancellationToken cancellationToken) => Result.Success(); -} - -public class DummyEstateManagementManager : IEstateManagementManager { - public async Task> GetEstate(Guid estateId, - CancellationToken cancellationToken) { - return Result.Success(new Estate()); - } - - public async Task>> GetEstates(Guid estateId, - CancellationToken cancellationToken) { - return Result.Success(new List()); - } } \ No newline at end of file diff --git a/TransactionProcessor.BusinessLogic.Tests/Mediator/MediatorTests.cs b/TransactionProcessor.BusinessLogic.Tests/Mediator/MediatorTests.cs index 257c85b6..d8139576 100644 --- a/TransactionProcessor.BusinessLogic.Tests/Mediator/MediatorTests.cs +++ b/TransactionProcessor.BusinessLogic.Tests/Mediator/MediatorTests.cs @@ -46,11 +46,19 @@ public MediatorTests() //this.Requests.Add(TestData.GetVoucherByVoucherCodeQuery); //this.Requests.Add(TestData.GetVoucherByTransactionIdQuery); + // Estate Commands and Queries this.Requests.Add(TestData.Commands.CreateEstateCommand); this.Requests.Add(TestData.Commands.CreateEstateUserCommand); this.Requests.Add(TestData.Commands.AddOperatorToEstateCommand); + this.Requests.Add(TestData.Commands.RemoveOperatorFromEstateCommand); this.Requests.Add(TestData.Queries.GetEstateQuery); this.Requests.Add(TestData.Queries.GetEstatesQuery); + + // Operator Commands and Queries + this.Requests.Add(TestData.Commands.CreateOperatorCommand); + this.Requests.Add(TestData.Commands.UpdateOperatorCommand); + this.Requests.Add(TestData.Queries.GetOperatorQuery); + this.Requests.Add(TestData.Queries.GetOperatorsQuery); } [Fact] @@ -120,6 +128,7 @@ private void AddTestRegistrations(ServiceRegistry services, s.AddSingleton(); s.AddSingleton(); s.AddSingleton(); + s.AddSingleton(); s.AddSingleton(); }); } diff --git a/TransactionProcessor.BusinessLogic/EventHandling/EstateDomainEventHandler.cs b/TransactionProcessor.BusinessLogic/EventHandling/EstateDomainEventHandler.cs index e245b9fe..ea3735c0 100644 --- a/TransactionProcessor.BusinessLogic/EventHandling/EstateDomainEventHandler.cs +++ b/TransactionProcessor.BusinessLogic/EventHandling/EstateDomainEventHandler.cs @@ -42,7 +42,15 @@ public EstateDomainEventHandler(ITransactionProcessorReadModelRepository estateR public async Task Handle(IDomainEvent domainEvent, CancellationToken cancellationToken) { - return await this.HandleSpecificDomainEvent((dynamic)domainEvent, cancellationToken); + Task task = domainEvent switch + { + EstateCreatedEvent estateCreatedEvent => this.HandleSpecificDomainEvent(estateCreatedEvent, cancellationToken), + SecurityUserAddedToEstateEvent securityUserAddedToEstateEvent => this.HandleSpecificDomainEvent(securityUserAddedToEstateEvent, cancellationToken), + EstateReferenceAllocatedEvent estateReferenceAllocatedEvent => this.HandleSpecificDomainEvent(estateReferenceAllocatedEvent, cancellationToken), + _ => Task.FromResult(Result.Success()) + }; + + return await task; } /// diff --git a/TransactionProcessor.BusinessLogic/EventHandling/OperatorDomainEventHandler.cs b/TransactionProcessor.BusinessLogic/EventHandling/OperatorDomainEventHandler.cs new file mode 100644 index 00000000..a0c9c7bd --- /dev/null +++ b/TransactionProcessor.BusinessLogic/EventHandling/OperatorDomainEventHandler.cs @@ -0,0 +1,58 @@ +using Shared.DomainDrivenDesign.EventSourcing; +using Shared.EventStore.EventHandling; +using SimpleResults; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using TransactionProcessor.Operator.DomainEvents; +using TransactionProcessor.Repository; + +namespace TransactionProcessor.BusinessLogic.EventHandling +{ + public class OperatorDomainEventHandler : IDomainEventHandler + { + #region Fields + + private readonly ITransactionProcessorReadModelRepository EstateReportingRepository; + + #endregion + + #region Constructors + + public OperatorDomainEventHandler(ITransactionProcessorReadModelRepository estateReportingRepository) + { + this.EstateReportingRepository = estateReportingRepository; + } + + #endregion + + #region Methods + + /// + /// Handles the specified domain event. + /// + /// The domain event. + /// The cancellation token. + public async Task Handle(IDomainEvent domainEvent, + CancellationToken cancellationToken) + { + Task t = domainEvent switch + { + OperatorCreatedEvent oce => this.EstateReportingRepository.AddOperator(oce, cancellationToken), + OperatorNameUpdatedEvent onue => this.EstateReportingRepository.UpdateOperator(onue, cancellationToken), + OperatorRequireCustomMerchantNumberChangedEvent oprcmnce => this.EstateReportingRepository.UpdateOperator(oprcmnce, cancellationToken), + OperatorRequireCustomTerminalNumberChangedEvent oprctnce => this.EstateReportingRepository.UpdateOperator(oprctnce, cancellationToken), + _ => null + }; + if (t != null) + return await t; + + return Result.Success(); + } + + #endregion + } +} diff --git a/TransactionProcessor.BusinessLogic/Manager/EstateManagementManager.cs b/TransactionProcessor.BusinessLogic/Manager/EstateManagementManager.cs index e40702b3..9f040ad5 100644 --- a/TransactionProcessor.BusinessLogic/Manager/EstateManagementManager.cs +++ b/TransactionProcessor.BusinessLogic/Manager/EstateManagementManager.cs @@ -8,7 +8,6 @@ using Shared.Results; using SimpleResults; using TransactionProcessor.Aggregates; -using TransactionProcessor.Models; using TransactionProcessor.ProjectionEngine.Repository; using TransactionProcessor.Repository; @@ -30,7 +29,7 @@ public class EstateManagementManager : IEstateManagementManager //private readonly IAggregateRepository MerchantAggregateRepository; - //private readonly IAggregateRepository OperatorAggregateRepository; + private readonly IAggregateRepository OperatorAggregateRepository; //private readonly IModelFactory ModelFactory; @@ -39,17 +38,17 @@ public class EstateManagementManager : IEstateManagementManager #region Constructors public EstateManagementManager(ITransactionProcessorReadModelRepository estateManagementRepository, - IAggregateRepository estateAggregateRepository) + IAggregateRepository estateAggregateRepository, //IAggregateRepository contractAggregateRepository, //IAggregateRepository merchantAggregateRepository, //IModelFactory modelFactory, - //IAggregateRepository operatorAggregateRepository) + IAggregateRepository operatorAggregateRepository) { this.EstateManagementRepository = estateManagementRepository; this.EstateAggregateRepository = estateAggregateRepository; //this.ContractAggregateRepository = contractAggregateRepository; //this.MerchantAggregateRepository = merchantAggregateRepository; - //this.OperatorAggregateRepository = operatorAggregateRepository; + this.OperatorAggregateRepository = operatorAggregateRepository; //this.ModelFactory = modelFactory; } @@ -85,7 +84,7 @@ public EstateManagementManager(ITransactionProcessorReadModelRepository estateMa // return Result.Success(contractModel); //} - public async Task> GetEstate(Guid estateId, + public async Task> GetEstate(Guid estateId, CancellationToken cancellationToken){ Result getEstateResult = await this.EstateAggregateRepository.GetLatestVersion(estateId, cancellationToken); @@ -97,7 +96,7 @@ public EstateManagementManager(ITransactionProcessorReadModelRepository estateMa return Result.NotFound($"No estate found with Id [{estateId}]"); } - Models.Estate estateModel = estateAggregate.GetEstate(); + Models.Estate.Estate estateModel = estateAggregate.GetEstate(); //if (estateModel.Operators != null){ // foreach (Operator @operator in estateModel.Operators){ @@ -109,13 +108,13 @@ public EstateManagementManager(ITransactionProcessorReadModelRepository estateMa return Result.Success(estateModel); } - public async Task>> GetEstates(Guid estateId, + public async Task>> GetEstates(Guid estateId, CancellationToken cancellationToken){ - Result getEstateResult= await this.EstateManagementRepository.GetEstate(estateId, cancellationToken); + Result getEstateResult= await this.EstateManagementRepository.GetEstate(estateId, cancellationToken); if (getEstateResult.IsFailed) return Result.NotFound($"No estate found with Id [{estateId}]"); - return Result.Success(new List(){ + return Result.Success(new List(){ getEstateResult.Data }); } @@ -145,7 +144,7 @@ public EstateManagementManager(ITransactionProcessorReadModelRepository estateMa // return Result.Success(merchantModel); //} - + //public async Task>> GetMerchantContracts(Guid estateId, // Guid merchantId, // CancellationToken cancellationToken) @@ -175,7 +174,7 @@ public EstateManagementManager(ITransactionProcessorReadModelRepository estateMa // return Result.Success(merchants); //} - + //public async Task>> GetTransactionFeesForProduct(Guid estateId, // Guid merchantId, // Guid contractId, @@ -212,27 +211,30 @@ public EstateManagementManager(ITransactionProcessorReadModelRepository estateMa // return Result.Success(getFileDetailsResult.Data); //} - //public async Task> GetOperator(Guid estateId, Guid operatorId, CancellationToken cancellationToken){ - // var getOperatorResult = await this.OperatorAggregateRepository.GetLatestVersion(operatorId, cancellationToken); - // if (getOperatorResult.IsFailed) - // return ResultHelpers.CreateFailure(getOperatorResult); - // var operatorAggregate = getOperatorResult.Data; - // if (operatorAggregate.IsCreated == false){ - // return Result.NotFound($"No operator found with Id [{operatorId}]"); - // } + public async Task> GetOperator(Guid estateId, Guid operatorId, CancellationToken cancellationToken) + { + var getOperatorResult = await this.OperatorAggregateRepository.GetLatestVersion(operatorId, cancellationToken); + if (getOperatorResult.IsFailed) + return ResultHelpers.CreateFailure(getOperatorResult); + var operatorAggregate = getOperatorResult.Data; + if (operatorAggregate.IsCreated == false) + { + return Result.NotFound($"No operator found with Id [{operatorId}]"); + } - // Models.Operator.Operator @operator = operatorAggregate.GetOperator(); + Models.Operator.Operator @operator = operatorAggregate.GetOperator(); - // return Result.Success(@operator); - //} + return Result.Success(@operator); + } - //public async Task>> GetOperators(Guid estateId, CancellationToken cancellationToken){ - // Result> getOperatorsResult = await this.EstateManagementRepository.GetOperators(estateId, cancellationToken); - // if (getOperatorsResult.IsFailed) - // return ResultHelpers.CreateFailure(getOperatorsResult); + public async Task>> GetOperators(Guid estateId, CancellationToken cancellationToken) + { + Result> getOperatorsResult = await this.EstateManagementRepository.GetOperators(estateId, cancellationToken); + if (getOperatorsResult.IsFailed) + return ResultHelpers.CreateFailure(getOperatorsResult); - // return Result.Success(getOperatorsResult.Data); - //} + return Result.Success(getOperatorsResult.Data); + } #endregion } diff --git a/TransactionProcessor.BusinessLogic/Manager/IEstateManagementManager.cs b/TransactionProcessor.BusinessLogic/Manager/IEstateManagementManager.cs index 507ff45b..9ae8f4f8 100644 --- a/TransactionProcessor.BusinessLogic/Manager/IEstateManagementManager.cs +++ b/TransactionProcessor.BusinessLogic/Manager/IEstateManagementManager.cs @@ -21,10 +21,10 @@ public interface IEstateManagementManager // Guid contractId, // CancellationToken cancellationToken); - Task> GetEstate(Guid estateId, + Task> GetEstate(Guid estateId, CancellationToken cancellationToken); - Task>> GetEstates(Guid estateId, + Task>> GetEstates(Guid estateId, CancellationToken cancellationToken); //Task> GetMerchant(Guid estateId, Guid merchantId, @@ -40,10 +40,10 @@ public interface IEstateManagementManager //Task> GetFileDetails(Guid estateId, Guid fileId, CancellationToken cancellationToken); - //Task> GetOperator(Guid estateId,Guid operatorId, - // CancellationToken cancellationToken); + Task> GetOperator(Guid estateId, Guid operatorId, + CancellationToken cancellationToken); - //Task>> GetOperators(Guid estateId, CancellationToken cancellationToken); + Task>> GetOperators(Guid estateId, CancellationToken cancellationToken); #endregion } diff --git a/TransactionProcessor.BusinessLogic/RequestHandlers/EstateRequestHandler.cs b/TransactionProcessor.BusinessLogic/RequestHandlers/EstateRequestHandler.cs index ce1c0a71..83ab528e 100644 --- a/TransactionProcessor.BusinessLogic/RequestHandlers/EstateRequestHandler.cs +++ b/TransactionProcessor.BusinessLogic/RequestHandlers/EstateRequestHandler.cs @@ -16,8 +16,8 @@ public class EstateRequestHandler : IRequestHandler, IRequestHandler, IRequestHandler, - IRequestHandler>, - IRequestHandler>> + IRequestHandler>, + IRequestHandler>> { #region Fields @@ -59,12 +59,12 @@ public async Task Handle(EstateCommands.RemoveOperatorFromEstateCommand return await this.EstateDomainService.RemoveOperatorFromEstate(command, cancellationToken); } - public async Task> Handle(EstateQueries.GetEstateQuery query, CancellationToken cancellationToken) + public async Task> Handle(EstateQueries.GetEstateQuery query, CancellationToken cancellationToken) { return await this.EstateManagementManager.GetEstate(query.EstateId, cancellationToken); } - public async Task>> Handle(EstateQueries.GetEstatesQuery query, CancellationToken cancellationToken) + public async Task>> Handle(EstateQueries.GetEstatesQuery query, CancellationToken cancellationToken) { return await this.EstateManagementManager.GetEstates(query.EstateId, cancellationToken); } diff --git a/TransactionProcessor.BusinessLogic/RequestHandlers/OperatorRequestHandler.cs b/TransactionProcessor.BusinessLogic/RequestHandlers/OperatorRequestHandler.cs new file mode 100644 index 00000000..8b96b121 --- /dev/null +++ b/TransactionProcessor.BusinessLogic/RequestHandlers/OperatorRequestHandler.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using MediatR; +using SimpleResults; +using TransactionProcessor.BusinessLogic.Manager; +using TransactionProcessor.BusinessLogic.Requests; +using TransactionProcessor.BusinessLogic.Services; + +namespace TransactionProcessor.BusinessLogic.RequestHandlers +{ + public class OperatorRequestHandler : IRequestHandler, + IRequestHandler>, + IRequestHandler>>, + IRequestHandler + { + private readonly IOperatorDomainService OperatorDomainService; + + private readonly IEstateManagementManager EstateManagementManager; + + public OperatorRequestHandler(IOperatorDomainService operatorDomainService, IEstateManagementManager estateManagementManager) + { + this.OperatorDomainService = operatorDomainService; + this.EstateManagementManager = estateManagementManager; + } + public async Task Handle(OperatorCommands.CreateOperatorCommand command, CancellationToken cancellationToken) + { + return await this.OperatorDomainService.CreateOperator(command, cancellationToken); + } + + public async Task> Handle(OperatorQueries.GetOperatorQuery query, CancellationToken cancellationToken) + { + return await this.EstateManagementManager.GetOperator(query.EstateId, query.OperatorId, cancellationToken); + } + + public async Task>> Handle(OperatorQueries.GetOperatorsQuery query, CancellationToken cancellationToken) + { + return await this.EstateManagementManager.GetOperators(query.EstateId, cancellationToken); + } + + public async Task Handle(OperatorCommands.UpdateOperatorCommand command, CancellationToken cancellationToken) + { + return await this.OperatorDomainService.UpdateOperator(command, cancellationToken); + } + } +} diff --git a/TransactionProcessor.BusinessLogic/Requests/EstateQueries.cs b/TransactionProcessor.BusinessLogic/Requests/EstateQueries.cs index 38fa5252..d43da129 100644 --- a/TransactionProcessor.BusinessLogic/Requests/EstateQueries.cs +++ b/TransactionProcessor.BusinessLogic/Requests/EstateQueries.cs @@ -9,7 +9,7 @@ namespace TransactionProcessor.BusinessLogic.Requests [ExcludeFromCodeCoverage] public class EstateQueries { - public record GetEstateQuery(Guid EstateId) : IRequest>; - public record GetEstatesQuery(Guid EstateId) : IRequest>>; + public record GetEstateQuery(Guid EstateId) : IRequest>; + public record GetEstatesQuery(Guid EstateId) : IRequest>>; } } diff --git a/TransactionProcessor.BusinessLogic/Requests/OperatorCommands.cs b/TransactionProcessor.BusinessLogic/Requests/OperatorCommands.cs new file mode 100644 index 00000000..8cf77294 --- /dev/null +++ b/TransactionProcessor.BusinessLogic/Requests/OperatorCommands.cs @@ -0,0 +1,19 @@ +using MediatR; +using SimpleResults; +using System; +using System.Diagnostics.CodeAnalysis; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using TransactionProcessor.DataTransferObjects.Requests.Operator; + +namespace TransactionProcessor.BusinessLogic.Requests +{ + [ExcludeFromCodeCoverage] + public class OperatorCommands + { + public record CreateOperatorCommand(Guid EstateId, CreateOperatorRequest RequestDto) : IRequest; + + public record UpdateOperatorCommand(Guid EstateId, Guid OperatorId, UpdateOperatorRequest RequestDto) : IRequest; + } +} \ No newline at end of file diff --git a/TransactionProcessor.BusinessLogic/Requests/OperatorQueries.cs b/TransactionProcessor.BusinessLogic/Requests/OperatorQueries.cs new file mode 100644 index 00000000..15bdf7ae --- /dev/null +++ b/TransactionProcessor.BusinessLogic/Requests/OperatorQueries.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using MediatR; +using SimpleResults; +using TransactionProcessor.Models.Operator; + +[ExcludeFromCodeCoverage] +public class OperatorQueries +{ + public record GetOperatorQuery(Guid EstateId, Guid OperatorId) : IRequest>; + + public record GetOperatorsQuery(Guid EstateId) : IRequest>>; +} \ No newline at end of file diff --git a/TransactionProcessor.BusinessLogic/Services/OperatorDomainService.cs b/TransactionProcessor.BusinessLogic/Services/OperatorDomainService.cs new file mode 100644 index 00000000..18fd3fa8 --- /dev/null +++ b/TransactionProcessor.BusinessLogic/Services/OperatorDomainService.cs @@ -0,0 +1,105 @@ +using Shared.DomainDrivenDesign.EventSourcing; +using Shared.EventStore.Aggregate; +using Shared.Results; +using SimpleResults; +using System.Threading.Tasks; +using System.Threading; +using System; +using Shared.Exceptions; +using TransactionProcessor.Aggregates; +using TransactionProcessor.BusinessLogic.Requests; + +namespace TransactionProcessor.BusinessLogic.Services +{ + public interface IOperatorDomainService + { + Task CreateOperator(OperatorCommands.CreateOperatorCommand command, CancellationToken cancellationToken); + + Task UpdateOperator(OperatorCommands.UpdateOperatorCommand command, CancellationToken cancellationToken); + } + + public class OperatorDomainService : IOperatorDomainService + { + private readonly IAggregateRepository EstateAggregateRepository; + + private readonly IAggregateRepository OperatorAggregateRepository; + + public OperatorDomainService(IAggregateRepository estateAggregateRepository, + IAggregateRepository operatorAggregateRepository) + { + this.EstateAggregateRepository = estateAggregateRepository; + this.OperatorAggregateRepository = operatorAggregateRepository; + } + + private async Task ApplyUpdates(Func<(EstateAggregate, OperatorAggregate), Result> action, Guid estateId, Guid operatorId, CancellationToken cancellationToken, Boolean isNotFoundError = true) + { + try + { + Result getEstateResult = await this.EstateAggregateRepository.GetLatestVersion(estateId, cancellationToken); + if (getEstateResult.IsFailed) + return ResultHelpers.CreateFailure(getEstateResult); + EstateAggregate estateAggregate = getEstateResult.Data; + + Result getOperatorResult = await this.OperatorAggregateRepository.GetLatestVersion(operatorId, cancellationToken); + Result operatorAggregateResult = + DomainServiceHelper.HandleGetAggregateResult(getOperatorResult, operatorId, isNotFoundError); + if (operatorAggregateResult.IsFailed) + return ResultHelpers.CreateFailure(operatorAggregateResult); + + OperatorAggregate operatorAggregate = operatorAggregateResult.Data; + + Result result = action((estateAggregate, operatorAggregate)); + if (result.IsFailed) + return ResultHelpers.CreateFailure(result); + + Result saveResult = await this.OperatorAggregateRepository.SaveChanges(operatorAggregate, cancellationToken); + if (saveResult.IsFailed) + return ResultHelpers.CreateFailure(saveResult); + + return Result.Success(); + } + catch (Exception ex) + { + return Result.Failure(ex.GetExceptionMessages()); + } + } + + public async Task CreateOperator(OperatorCommands.CreateOperatorCommand command, CancellationToken cancellationToken) + { + Result result = await ApplyUpdates(((EstateAggregate estateAggregate, OperatorAggregate operatorAggregate) aggregates) => { + if (aggregates.estateAggregate.IsCreated == false) + { + return Result.Forbidden($"Estate with Id {command.EstateId} not created"); + } + + if (aggregates.operatorAggregate.IsCreated) + { + return Result.Forbidden($"Operator with Id {command.RequestDto.OperatorId} already created"); + } + + aggregates.operatorAggregate.Create(command.EstateId, command.RequestDto.Name, + command.RequestDto.RequireCustomMerchantNumber.GetValueOrDefault(), + command.RequestDto.RequireCustomTerminalNumber.GetValueOrDefault()); + + return Result.Success(); + + }, command.EstateId, command.RequestDto.OperatorId, cancellationToken, isNotFoundError: false); + + return result; + } + + public async Task UpdateOperator(OperatorCommands.UpdateOperatorCommand command, CancellationToken cancellationToken) + { + Result result = await ApplyUpdates(((EstateAggregate estateAggregate, OperatorAggregate operatorAggregate) aggregates) => { + aggregates.operatorAggregate.UpdateOperator(command.RequestDto.Name, + command.RequestDto.RequireCustomMerchantNumber.GetValueOrDefault(), + command.RequestDto.RequireCustomTerminalNumber.GetValueOrDefault()); + + return Result.Success(); + + }, command.EstateId, command.OperatorId, cancellationToken); + + return result; + } + } +} diff --git a/TransactionProcessor.BusinessLogic/Services/TransactionValidationService.cs b/TransactionProcessor.BusinessLogic/Services/TransactionValidationService.cs index c4e568b5..72935da7 100644 --- a/TransactionProcessor.BusinessLogic/Services/TransactionValidationService.cs +++ b/TransactionProcessor.BusinessLogic/Services/TransactionValidationService.cs @@ -231,14 +231,14 @@ private async Task>> Validat } private Result ValidateEstateOperator(EstateAggregate estate, Guid operatorId) { - List estateOperators = estate.GetEstate().Operators; + List estateOperators = estate.GetEstate().Operators; if (estateOperators == null || estateOperators.Any() == false) { return CreateFailedResult(new TransactionValidationResult(TransactionResponseCode.NoEstateOperators, $"Estate {estate.EstateName} has no operators defined")); } - EstateOperator estateOperatorRecord = estateOperators.SingleOrDefault(o => o.OperatorId == operatorId); + Models.Estate.Operator estateOperatorRecord = estateOperators.SingleOrDefault(o => o.OperatorId == operatorId); Result result = estateOperatorRecord switch { null => CreateFailedResult(new TransactionValidationResult(TransactionResponseCode.OperatorNotValidForEstate, $"Operator {operatorId} not configured for Estate [{estate.EstateName}]")), diff --git a/TransactionProcessor.Database/TransactionProcessor.Database.csproj b/TransactionProcessor.Database/TransactionProcessor.Database.csproj index ebce4b7d..0d81e93a 100644 --- a/TransactionProcessor.Database/TransactionProcessor.Database.csproj +++ b/TransactionProcessor.Database/TransactionProcessor.Database.csproj @@ -4,6 +4,7 @@ net8.0 enable enable + None diff --git a/TransactionProcessor.Estate.DomainEvents/EstateDomainEvents.cs b/TransactionProcessor.Estate.DomainEvents/EstateDomainEvents.cs index e9b9758e..d0ba830e 100644 --- a/TransactionProcessor.Estate.DomainEvents/EstateDomainEvents.cs +++ b/TransactionProcessor.Estate.DomainEvents/EstateDomainEvents.cs @@ -1,17 +1,23 @@ using Shared.DomainDrivenDesign.EventSourcing; +using System.Diagnostics.CodeAnalysis; namespace TransactionProcessor.Estate.DomainEvents{ + [ExcludeFromCodeCoverage] public record EstateCreatedEvent(Guid EstateId, String EstateName) : DomainEvent(EstateId, Guid.NewGuid()); + [ExcludeFromCodeCoverage] public record EstateReferenceAllocatedEvent(Guid EstateId, String EstateReference) : DomainEvent(EstateId, Guid.NewGuid()); + [ExcludeFromCodeCoverage] public record OperatorAddedToEstateEvent(Guid EstateId, Guid OperatorId) : DomainEvent(EstateId, Guid.NewGuid()); + [ExcludeFromCodeCoverage] public record OperatorRemovedFromEstateEvent(Guid EstateId, Guid OperatorId) : DomainEvent(EstateId, Guid.NewGuid()); - + + [ExcludeFromCodeCoverage] public record SecurityUserAddedToEstateEvent(Guid EstateId, Guid SecurityUserId, String EmailAddress) : DomainEvent(EstateId, Guid.NewGuid()); diff --git a/TransactionProcessor.IntegrationTesting.Helpers/SpecflowExtensions.cs b/TransactionProcessor.IntegrationTesting.Helpers/SpecflowExtensions.cs index 2a7ec1c7..93701d67 100644 --- a/TransactionProcessor.IntegrationTesting.Helpers/SpecflowExtensions.cs +++ b/TransactionProcessor.IntegrationTesting.Helpers/SpecflowExtensions.cs @@ -5,6 +5,7 @@ using TransactionProcessor.DataTransferObjects.Requests.Operator; using TransactionProcessor.DataTransferObjects.Responses.Contract; using TransactionProcessor.DataTransferObjects.Responses.Merchant; +using TransactionProcessor.DataTransferObjects.Responses.Operator; namespace TransactionProcessor.IntegrationTesting.Helpers; @@ -97,6 +98,68 @@ public static T GetEnumValue(DataTableRow row, } public static class ReqnrollExtensions{ + + public static List<(EstateDetails, Guid, OperatorResponse)> ToOperatorResponses(this DataTableRows tableRows, List estateDetailsList) + { + List<(EstateDetails, Guid, OperatorResponse)> result = new(); + + foreach (DataTableRow tableRow in tableRows) + { + String estateName = ReqnrollTableHelper.GetStringRowValue(tableRow, "EstateName"); + EstateDetails estateDetails = estateDetailsList.SingleOrDefault(e => e.EstateName == estateName); + estateDetails.ShouldNotBeNull(); + + String operatorName = ReqnrollTableHelper.GetStringRowValue(tableRow, "OperatorName"); + Boolean requireCustomMerchantNumber = ReqnrollTableHelper.GetBooleanValue(tableRow, "RequireCustomMerchantNumber"); + Boolean requireCustomTerminalNumber = ReqnrollTableHelper.GetBooleanValue(tableRow, "RequireCustomTerminalNumber"); + Guid operatorId = estateDetails.GetOperatorId(operatorName); + + + OperatorResponse operatorResponse = new() + { + RequireCustomTerminalNumber = requireCustomTerminalNumber, + RequireCustomMerchantNumber = requireCustomMerchantNumber, + Name = operatorName, + OperatorId = operatorId + }; + + result.Add((estateDetails, operatorId, operatorResponse)); + } + + return result; + } + + public static List<(EstateDetails, Guid, UpdateOperatorRequest)> ToUpdateOperatorRequests(this DataTableRows tableRows, List estateDetailsList) + { + List<(EstateDetails, Guid, UpdateOperatorRequest)> result = new(); + + foreach (DataTableRow tableRow in tableRows) + { + String estateName = ReqnrollTableHelper.GetStringRowValue(tableRow, "EstateName"); + EstateDetails estateDetails = estateDetailsList.SingleOrDefault(e => e.EstateName == estateName); + estateDetails.ShouldNotBeNull(); + + String merchantName = ReqnrollTableHelper.GetStringRowValue(tableRow, "OperatorName"); + Guid operatorId = estateDetails.GetOperatorId(merchantName); + + String updateOperatorName = ReqnrollTableHelper.GetStringRowValue(tableRow, "UpdateOperatorName"); + Boolean requireCustomMerchantNumber = ReqnrollTableHelper.GetBooleanValue(tableRow, "RequireCustomMerchantNumber"); + Boolean requireCustomTerminalNumber = ReqnrollTableHelper.GetBooleanValue(tableRow, "RequireCustomTerminalNumber"); + + + UpdateOperatorRequest updateOperatorRequest = new UpdateOperatorRequest + { + RequireCustomTerminalNumber = requireCustomTerminalNumber, + RequireCustomMerchantNumber = requireCustomMerchantNumber, + Name = updateOperatorName + }; + + result.Add((estateDetails, operatorId, updateOperatorRequest)); + } + + return result; + } + public static List<(EstateDetails, Guid, DateTime, Int32)> ToPendingSettlementRequests(this DataTableRows tableRows, List estateDetailsList){ List<(EstateDetails, Guid, DateTime, Int32)> results = new List<(EstateDetails, Guid, DateTime, Int32)>(); foreach (DataTableRow tableRow in tableRows){ diff --git a/TransactionProcessor.IntegrationTesting.Helpers/SubscriptionsHelper.cs b/TransactionProcessor.IntegrationTesting.Helpers/SubscriptionsHelper.cs index 8106dcb5..f0996b69 100644 --- a/TransactionProcessor.IntegrationTesting.Helpers/SubscriptionsHelper.cs +++ b/TransactionProcessor.IntegrationTesting.Helpers/SubscriptionsHelper.cs @@ -5,30 +5,34 @@ public static class SubscriptionsHelper public static List<(String streamName, String groupName, Int32 maxRetries)> GetSubscriptions() { List<(String streamName, String groupName, Int32 maxRetries)> subscriptions = new(){ + // Main ("$ce-EstateAggregate", "Transaction Processor", 2), + ("$ce-SettlementAggregate", "Transaction Processor", 0), + ("$ce-TransactionAggregate", "Transaction Processor", 0), + ("$ce-OperatorAggregate", "Transaction Processor", 0), ("$ce-VoucherAggregate", "Transaction Processor", 0), + + // Ordered ("$ce-EstateAggregate", "Transaction Processor - Ordered", 2), ("$ce-MerchantAggregate", "Transaction Processor - Ordered", 2), ("$ce-MerchantDepositListAggregate", "Transaction Processor - Ordered", 2), - ("$ce-SettlementAggregate", "Transaction Processor", 0), - ("$ce-TransactionAggregate", "Transaction Processor", 0), ("$ce-TransactionAggregate", "Transaction Processor - Ordered", 2), - ("$ce-VoucherAggregate", "Transaction Processor", 0), ("$ce-VoucherAggregate", "Transaction Processor - Ordered", 2), + // Estate Management Main ("$ce-CallbackMessageAggregate", "Estate Management", 0), ("$ce-ContractAggregate", "Estate Management", 0), ("$ce-FileAggregate", "Estate Management", 0), ("$ce-FloatAggregate", "Estate Management", 0), ("$ce-MerchantAggregate", "Estate Management", 0), ("$ce-MerchantStatementAggregate", "Estate Management", 0), - ("$ce-MerchantStatementAggregate", "Estate Management - Ordered", 0), ("$ce-ReconciliationAggregate", "Estate Management", 0), ("$ce-SettlementAggregate", "Estate Management", 0), ("$ce-TransactionAggregate", "Estate Management", 0), - ("$ce-TransactionAggregate", "Estate Management - Ordered", 0), ("$ce-VoucherAggregate", "Estate Management", 0), - ("$ce-OperatorAggregate", "Estate Management", 0), - + + // Estate Management Ordered + ("$ce-MerchantStatementAggregate", "Estate Management - Ordered", 0), + ("$ce-TransactionAggregate", "Estate Management - Ordered", 0), }; return subscriptions; diff --git a/TransactionProcessor.IntegrationTesting.Helpers/TransactionProcessorSteps.cs b/TransactionProcessor.IntegrationTesting.Helpers/TransactionProcessorSteps.cs index 1c1706c8..19f17e20 100644 --- a/TransactionProcessor.IntegrationTesting.Helpers/TransactionProcessorSteps.cs +++ b/TransactionProcessor.IntegrationTesting.Helpers/TransactionProcessorSteps.cs @@ -657,6 +657,26 @@ public async Task WhenIGetTheEstateTheEstateDetailsAreReturnedAsFollows(String a estate.EstateName.ShouldBe(expectedEstateDetails.Single()); } + public async Task WhenIGetAllTheOperatorsTheFollowingDetailsAreReturned(String accessToken, List<(EstateDetails, Guid, OperatorResponse)> expectedOperatorResponses) + { + IEnumerable distinctEstates = expectedOperatorResponses.Select(e => e.Item1).DistinctBy(e => e.EstateId).Select(e => e.EstateId); + + foreach (Guid estateId in distinctEstates) + { + await Retry.For(async () => { + List? operatorList = await this.TransactionProcessorClient.GetOperators(accessToken, estateId, CancellationToken.None); + + foreach (OperatorResponse operatorResponse in operatorList) + { + OperatorResponse? expectedOperator = expectedOperatorResponses.SingleOrDefault(s => s.Item3.OperatorId == operatorResponse.OperatorId).Item3; + expectedOperator.ShouldNotBeNull(); + operatorResponse.RequireCustomMerchantNumber.ShouldBe(expectedOperator.RequireCustomMerchantNumber); + operatorResponse.RequireCustomTerminalNumber.ShouldBe(expectedOperator.RequireCustomTerminalNumber); + operatorResponse.Name.ShouldBe(expectedOperator.Name); + } + }); + } + } public async Task WhenIGetTheEstateTheEstateOperatorDetailsAreReturnedAsFollows(String accessToken, String estateName, List estateDetailsList, List expectedOperators) { Guid estateId = Guid.NewGuid(); @@ -734,4 +754,31 @@ await Retry.For(async () => { operatorResponse.IsDeleted.ShouldBeTrue(); }); } + + public async Task> WhenIUpdateTheOperatorsWithTheFollowingDetails(string accessToken, List<(EstateDetails estate, Guid operatorId, UpdateOperatorRequest request)> requests) + { + List responses = new List(); + + foreach ((EstateDetails estate, Guid operatorId, UpdateOperatorRequest request) request in requests) + { + await this.TransactionProcessorClient.UpdateOperator(accessToken, request.estate.EstateId, request.operatorId, request.request, CancellationToken.None).ConfigureAwait(false); + } + + foreach ((EstateDetails estate, Guid operatorId, UpdateOperatorRequest request) request in requests) + { + await Retry.For(async () => { + OperatorResponse? operatorResponse = await this.TransactionProcessorClient + .GetOperator(accessToken, request.estate.EstateId, request.operatorId, CancellationToken.None) + .ConfigureAwait(false); + + operatorResponse.Name.ShouldBe(request.request.Name); + operatorResponse.RequireCustomTerminalNumber.ShouldBe(request.request.RequireCustomTerminalNumber.Value); + operatorResponse.RequireCustomMerchantNumber.ShouldBe(request.request.RequireCustomMerchantNumber.Value); + responses.Add(operatorResponse); + }); + request.estate.UpdateOperator(request.operatorId, request.request.Name); + } + + return responses; + } } \ No newline at end of file diff --git a/TransactionProcessor.IntegrationTests/Features/Operator.feature b/TransactionProcessor.IntegrationTests/Features/Operator.feature new file mode 100644 index 00000000..c916a5ec --- /dev/null +++ b/TransactionProcessor.IntegrationTests/Features/Operator.feature @@ -0,0 +1,43 @@ +@base @shared +Feature: Operator + +Background: + Given the following security roles exist + | Role Name | + | Estate | + + Given I create the following api scopes + | Name | DisplayName | Description | + | estateManagement | Estate Managememt REST Scope | A scope for Estate Managememt REST | + + Given the following api resources exist + | Name | DisplayName | Secret | Scopes | UserClaims | + | estateManagement | Estate Managememt REST | Secret1 | estateManagement | merchantId, estateId, role | + + Given the following clients exist + | ClientId | ClientName | Secret | Scopes | GrantTypes | + | serviceClient | Service Client | Secret1 | estateManagement | client_credentials | + | estateClient | Estate Client | Secret1 | estateManagement | password | + + Given I have a token to access the estate management resource + | ClientId | + | serviceClient | + + Given I have created the following estates + | EstateName | + | Test Estate 1 | + +@PRTest +Scenario: Update Operator + + Given I have created the following operators + | EstateName | OperatorName | RequireCustomMerchantNumber | RequireCustomTerminalNumber | + | Test Estate 1 | Test Operator 1 | True | True | + + When I update the operators with the following details + | UpdateOperatorName | RequireCustomMerchantNumber | RequireCustomTerminalNumber | EstateName | OperatorName | + | Update Operator 1 | False | False | Test Estate 1 | Test Operator 1 | + + When I get all the operators the following details are returned + | EstateName | OperatorName | RequireCustomMerchantNumber | RequireCustomTerminalNumber | + | Test Estate 1 | Update Operator 1 | False | False | diff --git a/TransactionProcessor.IntegrationTests/Features/Operator.feature.cs b/TransactionProcessor.IntegrationTests/Features/Operator.feature.cs new file mode 100644 index 00000000..ba124acc --- /dev/null +++ b/TransactionProcessor.IntegrationTests/Features/Operator.feature.cs @@ -0,0 +1,223 @@ +// ------------------------------------------------------------------------------ +// +// This code was generated by Reqnroll (https://www.reqnroll.net/). +// Reqnroll Version:1.0.0.0 +// Reqnroll Generator Version:1.0.0.0 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +// ------------------------------------------------------------------------------ +#region Designer generated code +#pragma warning disable +namespace TransactionProcessor.IntegrationTests.Features +{ + using Reqnroll; + using System; + using System.Linq; + + + [System.CodeDom.Compiler.GeneratedCodeAttribute("Reqnroll", "1.0.0.0")] + [System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [NUnit.Framework.TestFixtureAttribute()] + [NUnit.Framework.DescriptionAttribute("Operator")] + [NUnit.Framework.CategoryAttribute("base")] + [NUnit.Framework.CategoryAttribute("shared")] + public partial class OperatorFeature + { + + private Reqnroll.ITestRunner testRunner; + + private static string[] featureTags = new string[] { + "base", + "shared"}; + +#line 1 "Operator.feature" +#line hidden + + [NUnit.Framework.OneTimeSetUpAttribute()] + public virtual async System.Threading.Tasks.Task FeatureSetupAsync() + { + testRunner = Reqnroll.TestRunnerManager.GetTestRunnerForAssembly(null, NUnit.Framework.TestContext.CurrentContext.WorkerId); + Reqnroll.FeatureInfo featureInfo = new Reqnroll.FeatureInfo(new System.Globalization.CultureInfo("en-US"), "Features", "Operator", null, ProgrammingLanguage.CSharp, featureTags); + await testRunner.OnFeatureStartAsync(featureInfo); + } + + [NUnit.Framework.OneTimeTearDownAttribute()] + public virtual async System.Threading.Tasks.Task FeatureTearDownAsync() + { + await testRunner.OnFeatureEndAsync(); + testRunner = null; + } + + [NUnit.Framework.SetUpAttribute()] + public async System.Threading.Tasks.Task TestInitializeAsync() + { + } + + [NUnit.Framework.TearDownAttribute()] + public async System.Threading.Tasks.Task TestTearDownAsync() + { + await testRunner.OnScenarioEndAsync(); + } + + public void ScenarioInitialize(Reqnroll.ScenarioInfo scenarioInfo) + { + testRunner.OnScenarioInitialize(scenarioInfo); + testRunner.ScenarioContext.ScenarioContainer.RegisterInstanceAs(NUnit.Framework.TestContext.CurrentContext); + } + + public async System.Threading.Tasks.Task ScenarioStartAsync() + { + await testRunner.OnScenarioStartAsync(); + } + + public async System.Threading.Tasks.Task ScenarioCleanupAsync() + { + await testRunner.CollectScenarioErrorsAsync(); + } + + public virtual async System.Threading.Tasks.Task FeatureBackgroundAsync() + { +#line 4 +#line hidden + Reqnroll.Table table40 = new Reqnroll.Table(new string[] { + "Role Name"}); + table40.AddRow(new string[] { + "Estate"}); +#line 5 + await testRunner.GivenAsync("the following security roles exist", ((string)(null)), table40, "Given "); +#line hidden + Reqnroll.Table table41 = new Reqnroll.Table(new string[] { + "Name", + "DisplayName", + "Description"}); + table41.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)), table41, "Given "); +#line hidden + Reqnroll.Table table42 = new Reqnroll.Table(new string[] { + "Name", + "DisplayName", + "Secret", + "Scopes", + "UserClaims"}); + table42.AddRow(new string[] { + "estateManagement", + "Estate Managememt REST", + "Secret1", + "estateManagement", + "merchantId, estateId, role"}); +#line 13 + await testRunner.GivenAsync("the following api resources exist", ((string)(null)), table42, "Given "); +#line hidden + Reqnroll.Table table43 = new Reqnroll.Table(new string[] { + "ClientId", + "ClientName", + "Secret", + "Scopes", + "GrantTypes"}); + table43.AddRow(new string[] { + "serviceClient", + "Service Client", + "Secret1", + "estateManagement", + "client_credentials"}); + table43.AddRow(new string[] { + "estateClient", + "Estate Client", + "Secret1", + "estateManagement", + "password"}); +#line 17 + await testRunner.GivenAsync("the following clients exist", ((string)(null)), table43, "Given "); +#line hidden + Reqnroll.Table table44 = new Reqnroll.Table(new string[] { + "ClientId"}); + table44.AddRow(new string[] { + "serviceClient"}); +#line 22 + await testRunner.GivenAsync("I have a token to access the estate management resource", ((string)(null)), table44, "Given "); +#line hidden + Reqnroll.Table table45 = new Reqnroll.Table(new string[] { + "EstateName"}); + table45.AddRow(new string[] { + "Test Estate 1"}); +#line 26 + await testRunner.GivenAsync("I have created the following estates", ((string)(null)), table45, "Given "); +#line hidden + } + + [NUnit.Framework.TestAttribute()] + [NUnit.Framework.DescriptionAttribute("Update Operator")] + [NUnit.Framework.CategoryAttribute("PRTest")] + public async System.Threading.Tasks.Task UpdateOperator() + { + string[] tagsOfScenario = new string[] { + "PRTest"}; + System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new System.Collections.Specialized.OrderedDictionary(); + Reqnroll.ScenarioInfo scenarioInfo = new Reqnroll.ScenarioInfo("Update Operator", null, tagsOfScenario, argumentsOfScenario, featureTags); +#line 31 +this.ScenarioInitialize(scenarioInfo); +#line hidden + if ((TagHelper.ContainsIgnoreTag(tagsOfScenario) || TagHelper.ContainsIgnoreTag(featureTags))) + { + testRunner.SkipScenario(); + } + else + { + await this.ScenarioStartAsync(); +#line 4 +await this.FeatureBackgroundAsync(); +#line hidden + Reqnroll.Table table46 = new Reqnroll.Table(new string[] { + "EstateName", + "OperatorName", + "RequireCustomMerchantNumber", + "RequireCustomTerminalNumber"}); + table46.AddRow(new string[] { + "Test Estate 1", + "Test Operator 1", + "True", + "True"}); +#line 33 + await testRunner.GivenAsync("I have created the following operators", ((string)(null)), table46, "Given "); +#line hidden + Reqnroll.Table table47 = new Reqnroll.Table(new string[] { + "UpdateOperatorName", + "RequireCustomMerchantNumber", + "RequireCustomTerminalNumber", + "EstateName", + "OperatorName"}); + table47.AddRow(new string[] { + "Update Operator 1", + "False", + "False", + "Test Estate 1", + "Test Operator 1"}); +#line 37 + await testRunner.WhenAsync("I update the operators with the following details", ((string)(null)), table47, "When "); +#line hidden + Reqnroll.Table table48 = new Reqnroll.Table(new string[] { + "EstateName", + "OperatorName", + "RequireCustomMerchantNumber", + "RequireCustomTerminalNumber"}); + table48.AddRow(new string[] { + "Test Estate 1", + "Update Operator 1", + "False", + "False"}); +#line 41 + await testRunner.WhenAsync("I get all the operators the following details are returned", ((string)(null)), table48, "When "); +#line hidden + } + await this.ScenarioCleanupAsync(); + } + } +} +#pragma warning restore +#endregion diff --git a/TransactionProcessor.IntegrationTests/Features/ReconciliationFeature.feature.cs b/TransactionProcessor.IntegrationTests/Features/ReconciliationFeature.feature.cs index d7199c79..ebd49b91 100644 --- a/TransactionProcessor.IntegrationTests/Features/ReconciliationFeature.feature.cs +++ b/TransactionProcessor.IntegrationTests/Features/ReconciliationFeature.feature.cs @@ -81,120 +81,120 @@ public virtual async System.Threading.Tasks.Task FeatureBackgroundAsync() { #line 4 #line hidden - Reqnroll.Table table40 = new Reqnroll.Table(new string[] { + Reqnroll.Table table49 = new Reqnroll.Table(new string[] { "Name", "DisplayName", "Description"}); - table40.AddRow(new string[] { + table49.AddRow(new string[] { "estateManagement", "Estate Managememt REST Scope", "A scope for Estate Managememt REST"}); - table40.AddRow(new string[] { + table49.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)), table40, "Given "); + await testRunner.GivenAsync("I create the following api scopes", ((string)(null)), table49, "Given "); #line hidden - Reqnroll.Table table41 = new Reqnroll.Table(new string[] { + Reqnroll.Table table50 = new Reqnroll.Table(new string[] { "Name", "DisplayName", "Secret", "Scopes", "UserClaims"}); - table41.AddRow(new string[] { + table50.AddRow(new string[] { "estateManagement", "Estate Managememt REST", "Secret1", "estateManagement", "MerchantId, EstateId, role"}); - table41.AddRow(new string[] { + table50.AddRow(new string[] { "transactionProcessor", "Transaction Processor REST", "Secret1", "transactionProcessor", ""}); #line 11 - await testRunner.GivenAsync("the following api resources exist", ((string)(null)), table41, "Given "); + await testRunner.GivenAsync("the following api resources exist", ((string)(null)), table50, "Given "); #line hidden - Reqnroll.Table table42 = new Reqnroll.Table(new string[] { + Reqnroll.Table table51 = new Reqnroll.Table(new string[] { "ClientId", "ClientName", "Secret", "Scopes", "GrantTypes"}); - table42.AddRow(new string[] { + table51.AddRow(new string[] { "serviceClient", "Service Client", "Secret1", "estateManagement,transactionProcessor", "client_credentials"}); #line 16 - await testRunner.GivenAsync("the following clients exist", ((string)(null)), table42, "Given "); + await testRunner.GivenAsync("the following clients exist", ((string)(null)), table51, "Given "); #line hidden - Reqnroll.Table table43 = new Reqnroll.Table(new string[] { + Reqnroll.Table table52 = new Reqnroll.Table(new string[] { "ClientId"}); - table43.AddRow(new string[] { + table52.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)), table43, "Given "); + "s", ((string)(null)), table52, "Given "); #line hidden - Reqnroll.Table table44 = new Reqnroll.Table(new string[] { + Reqnroll.Table table53 = new Reqnroll.Table(new string[] { "EstateName"}); - table44.AddRow(new string[] { + table53.AddRow(new string[] { "Test Estate 1"}); - table44.AddRow(new string[] { + table53.AddRow(new string[] { "Test Estate 2"}); #line 24 - await testRunner.GivenAsync("I have created the following estates", ((string)(null)), table44, "Given "); + await testRunner.GivenAsync("I have created the following estates", ((string)(null)), table53, "Given "); #line hidden - Reqnroll.Table table45 = new Reqnroll.Table(new string[] { + Reqnroll.Table table54 = new Reqnroll.Table(new string[] { "EstateName", "OperatorName", "RequireCustomMerchantNumber", "RequireCustomTerminalNumber"}); - table45.AddRow(new string[] { + table54.AddRow(new string[] { "Test Estate 1", "Safaricom", "True", "True"}); - table45.AddRow(new string[] { + table54.AddRow(new string[] { "Test Estate 2", "Safaricom", "True", "True"}); #line 29 - await testRunner.GivenAsync("I have created the following operators", ((string)(null)), table45, "Given "); + await testRunner.GivenAsync("I have created the following operators", ((string)(null)), table54, "Given "); #line hidden - Reqnroll.Table table46 = new Reqnroll.Table(new string[] { + Reqnroll.Table table55 = new Reqnroll.Table(new string[] { "EstateName", "OperatorName"}); - table46.AddRow(new string[] { + table55.AddRow(new string[] { "Test Estate 1", "Safaricom"}); - table46.AddRow(new string[] { + table55.AddRow(new string[] { "Test Estate 2", "Safaricom"}); #line 34 - await testRunner.AndAsync("I have assigned the following operators to the estates", ((string)(null)), table46, "And "); + await testRunner.AndAsync("I have assigned the following operators to the estates", ((string)(null)), table55, "And "); #line hidden - Reqnroll.Table table47 = new Reqnroll.Table(new string[] { + Reqnroll.Table table56 = new Reqnroll.Table(new string[] { "EstateName", "OperatorName", "ContractDescription"}); - table47.AddRow(new string[] { + table56.AddRow(new string[] { "Test Estate 1", "Safaricom", "Safaricom Contract"}); - table47.AddRow(new string[] { + table56.AddRow(new string[] { "Test Estate 2", "Safaricom", "Safaricom Contract"}); #line 39 - await testRunner.GivenAsync("I create a contract with the following values", ((string)(null)), table47, "Given "); + await testRunner.GivenAsync("I create a contract with the following values", ((string)(null)), table56, "Given "); #line hidden - Reqnroll.Table table48 = new Reqnroll.Table(new string[] { + Reqnroll.Table table57 = new Reqnroll.Table(new string[] { "EstateName", "OperatorName", "ContractDescription", @@ -202,7 +202,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "DisplayText", "Value", "ProductType"}); - table48.AddRow(new string[] { + table57.AddRow(new string[] { "Test Estate 1", "Safaricom", "Safaricom Contract", @@ -210,7 +210,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "Custom", "", "MobileTopup"}); - table48.AddRow(new string[] { + table57.AddRow(new string[] { "Test Estate 2", "Safaricom", "Safaricom Contract", @@ -219,9 +219,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)), table48, "When "); + await testRunner.WhenAsync("I create the following Products", ((string)(null)), table57, "When "); #line hidden - Reqnroll.Table table49 = new Reqnroll.Table(new string[] { + Reqnroll.Table table58 = new Reqnroll.Table(new string[] { "EstateName", "OperatorName", "ContractDescription", @@ -229,7 +229,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "CalculationType", "FeeDescription", "Value"}); - table49.AddRow(new string[] { + table58.AddRow(new string[] { "Test Estate 1", "Safaricom", "Safaricom Contract", @@ -237,7 +237,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "Fixed", "Merchant Commission", "2.50"}); - table49.AddRow(new string[] { + table58.AddRow(new string[] { "Test Estate 2", "Safaricom", "Safaricom Contract", @@ -246,9 +246,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)), table49, "When "); + await testRunner.WhenAsync("I add the following Transaction Fees", ((string)(null)), table58, "When "); #line hidden - Reqnroll.Table table50 = new Reqnroll.Table(new string[] { + Reqnroll.Table table59 = new Reqnroll.Table(new string[] { "MerchantName", "AddressLine1", "Town", @@ -257,7 +257,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "ContactName", "EmailAddress", "EstateName"}); - table50.AddRow(new string[] { + table59.AddRow(new string[] { "Test Merchant 1", "Address Line 1", "TestTown", @@ -266,7 +266,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "Test Contact 1", "testcontact1@merchant1.co.uk", "Test Estate 1"}); - table50.AddRow(new string[] { + table59.AddRow(new string[] { "Test Merchant 2", "Address Line 1", "TestTown", @@ -275,7 +275,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "Test Contact 2", "testcontact2@merchant2.co.uk", "Test Estate 1"}); - table50.AddRow(new string[] { + table59.AddRow(new string[] { "Test Merchant 3", "Address Line 1", "TestTown", @@ -285,80 +285,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)), table50, "Given "); + await testRunner.GivenAsync("I create the following merchants", ((string)(null)), table59, "Given "); #line hidden - Reqnroll.Table table51 = new Reqnroll.Table(new string[] { + Reqnroll.Table table60 = new Reqnroll.Table(new string[] { "OperatorName", "MerchantName", "MerchantNumber", "TerminalNumber", "EstateName"}); - table51.AddRow(new string[] { + table60.AddRow(new string[] { "Safaricom", "Test Merchant 1", "00000001", "10000001", "Test Estate 1"}); - table51.AddRow(new string[] { + table60.AddRow(new string[] { "Safaricom", "Test Merchant 2", "00000002", "10000002", "Test Estate 1"}); - table51.AddRow(new string[] { + table60.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)), table51, "Given "); + await testRunner.GivenAsync("I have assigned the following operator to the merchants", ((string)(null)), table60, "Given "); #line hidden - Reqnroll.Table table52 = new Reqnroll.Table(new string[] { + Reqnroll.Table table61 = new Reqnroll.Table(new string[] { "DeviceIdentifier", "MerchantName", "EstateName"}); - table52.AddRow(new string[] { + table61.AddRow(new string[] { "123456780", "Test Merchant 1", "Test Estate 1"}); - table52.AddRow(new string[] { + table61.AddRow(new string[] { "123456781", "Test Merchant 2", "Test Estate 1"}); - table52.AddRow(new string[] { + table61.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)), table52, "Given "); + await testRunner.GivenAsync("I have assigned the following devices to the merchants", ((string)(null)), table61, "Given "); #line hidden - Reqnroll.Table table53 = new Reqnroll.Table(new string[] { + Reqnroll.Table table62 = new Reqnroll.Table(new string[] { "Reference", "Amount", "DateTime", "MerchantName", "EstateName"}); - table53.AddRow(new string[] { + table62.AddRow(new string[] { "Deposit1", "200.00", "Today", "Test Merchant 1", "Test Estate 1"}); - table53.AddRow(new string[] { + table62.AddRow(new string[] { "Deposit1", "100.00", "Today", "Test Merchant 2", "Test Estate 1"}); - table53.AddRow(new string[] { + table62.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)), table53, "Given "); + await testRunner.GivenAsync("I make the following manual merchant deposits", ((string)(null)), table62, "Given "); #line hidden } @@ -384,7 +384,7 @@ public async System.Threading.Tasks.Task ReconciliationTransactions() #line 4 await this.FeatureBackgroundAsync(); #line hidden - Reqnroll.Table table54 = new Reqnroll.Table(new string[] { + Reqnroll.Table table63 = new Reqnroll.Table(new string[] { "DateTime", "MerchantName", "DeviceIdentifier", @@ -392,7 +392,7 @@ public async System.Threading.Tasks.Task ReconciliationTransactions() "TransactionCount", "TransactionValue", "TransactionType"}); - table54.AddRow(new string[] { + table63.AddRow(new string[] { "Today", "Test Merchant 1", "123456780", @@ -400,7 +400,7 @@ public async System.Threading.Tasks.Task ReconciliationTransactions() "1", "100.00", "Reconciliation"}); - table54.AddRow(new string[] { + table63.AddRow(new string[] { "Today", "Test Merchant 2", "123456781", @@ -408,7 +408,7 @@ public async System.Threading.Tasks.Task ReconciliationTransactions() "2", "200.00", "Reconciliation"}); - table54.AddRow(new string[] { + table63.AddRow(new string[] { "Today", "Test Merchant 3", "123456782", @@ -417,30 +417,30 @@ public async System.Threading.Tasks.Task ReconciliationTransactions() "300.00", "Reconciliation"}); #line 81 - await testRunner.WhenAsync("I perform the following reconciliations", ((string)(null)), table54, "When "); + await testRunner.WhenAsync("I perform the following reconciliations", ((string)(null)), table63, "When "); #line hidden - Reqnroll.Table table55 = new Reqnroll.Table(new string[] { + Reqnroll.Table table64 = new Reqnroll.Table(new string[] { "EstateName", "MerchantName", "ResponseCode", "ResponseMessage"}); - table55.AddRow(new string[] { + table64.AddRow(new string[] { "Test Estate 1", "Test Merchant 1", "0000", "SUCCESS"}); - table55.AddRow(new string[] { + table64.AddRow(new string[] { "Test Estate 1", "Test Merchant 2", "0000", "SUCCESS"}); - table55.AddRow(new string[] { + table64.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)), table55, "Then "); + await testRunner.ThenAsync("reconciliation response should contain the following information", ((string)(null)), table64, "Then "); #line hidden } await this.ScenarioCleanupAsync(); diff --git a/TransactionProcessor.IntegrationTests/Features/RedeemVoucher.feature.cs b/TransactionProcessor.IntegrationTests/Features/RedeemVoucher.feature.cs index f79673f8..ba813976 100644 --- a/TransactionProcessor.IntegrationTests/Features/RedeemVoucher.feature.cs +++ b/TransactionProcessor.IntegrationTests/Features/RedeemVoucher.feature.cs @@ -81,108 +81,108 @@ public virtual async System.Threading.Tasks.Task FeatureBackgroundAsync() { #line 5 #line hidden - Reqnroll.Table table56 = new Reqnroll.Table(new string[] { + Reqnroll.Table table65 = new Reqnroll.Table(new string[] { "Name", "DisplayName", "Description"}); - table56.AddRow(new string[] { + table65.AddRow(new string[] { "estateManagement", "Estate Managememt REST Scope", "A scope for Estate Managememt REST"}); - table56.AddRow(new string[] { + table65.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)), table56, "Given "); + await testRunner.GivenAsync("I create the following api scopes", ((string)(null)), table65, "Given "); #line hidden - Reqnroll.Table table57 = new Reqnroll.Table(new string[] { + Reqnroll.Table table66 = new Reqnroll.Table(new string[] { "Name", "DisplayName", "Secret", "Scopes", "UserClaims"}); - table57.AddRow(new string[] { + table66.AddRow(new string[] { "estateManagement", "Estate Managememt REST", "Secret1", "estateManagement", "MerchantId, EstateId, role"}); - table57.AddRow(new string[] { + table66.AddRow(new string[] { "voucherManagement", "Voucher Management REST", "Secret1", "voucherManagement", ""}); #line 12 - await testRunner.GivenAsync("the following api resources exist", ((string)(null)), table57, "Given "); + await testRunner.GivenAsync("the following api resources exist", ((string)(null)), table66, "Given "); #line hidden - Reqnroll.Table table58 = new Reqnroll.Table(new string[] { + Reqnroll.Table table67 = new Reqnroll.Table(new string[] { "ClientId", "ClientName", "Secret", "Scopes", "GrantTypes"}); - table58.AddRow(new string[] { + table67.AddRow(new string[] { "serviceClient", "Service Client", "Secret1", "estateManagement,voucherManagement", "client_credentials"}); #line 17 - await testRunner.GivenAsync("the following clients exist", ((string)(null)), table58, "Given "); + await testRunner.GivenAsync("the following clients exist", ((string)(null)), table67, "Given "); #line hidden - Reqnroll.Table table59 = new Reqnroll.Table(new string[] { + Reqnroll.Table table68 = new Reqnroll.Table(new string[] { "ClientId"}); - table59.AddRow(new string[] { + table68.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)), table59, "Given "); + "s", ((string)(null)), table68, "Given "); #line hidden - Reqnroll.Table table60 = new Reqnroll.Table(new string[] { + Reqnroll.Table table69 = new Reqnroll.Table(new string[] { "EstateName"}); - table60.AddRow(new string[] { + table69.AddRow(new string[] { "Test Estate 1"}); - table60.AddRow(new string[] { + table69.AddRow(new string[] { "Test Estate 2"}); #line 25 - await testRunner.GivenAsync("I have created the following estates", ((string)(null)), table60, "Given "); + await testRunner.GivenAsync("I have created the following estates", ((string)(null)), table69, "Given "); #line hidden - Reqnroll.Table table61 = new Reqnroll.Table(new string[] { + Reqnroll.Table table70 = new Reqnroll.Table(new string[] { "EstateName", "OperatorName", "RequireCustomMerchantNumber", "RequireCustomTerminalNumber"}); - table61.AddRow(new string[] { + table70.AddRow(new string[] { "Test Estate 1", "Voucher", "True", "True"}); #line 30 - await testRunner.GivenAsync("I have created the following operators", ((string)(null)), table61, "Given "); + await testRunner.GivenAsync("I have created the following operators", ((string)(null)), table70, "Given "); #line hidden - Reqnroll.Table table62 = new Reqnroll.Table(new string[] { + Reqnroll.Table table71 = new Reqnroll.Table(new string[] { "EstateName", "OperatorName"}); - table62.AddRow(new string[] { + table71.AddRow(new string[] { "Test Estate 1", "Voucher"}); #line 34 - await testRunner.AndAsync("I have assigned the following operators to the estates", ((string)(null)), table62, "And "); + await testRunner.AndAsync("I have assigned the following operators to the estates", ((string)(null)), table71, "And "); #line hidden - Reqnroll.Table table63 = new Reqnroll.Table(new string[] { + Reqnroll.Table table72 = new Reqnroll.Table(new string[] { "EstateName", "OperatorName", "ContractDescription"}); - table63.AddRow(new string[] { + table72.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)), table63, "Given "); + await testRunner.GivenAsync("I create a contract with the following values", ((string)(null)), table72, "Given "); #line hidden - Reqnroll.Table table64 = new Reqnroll.Table(new string[] { + Reqnroll.Table table73 = new Reqnroll.Table(new string[] { "EstateName", "OperatorName", "ContractDescription", @@ -190,7 +190,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "DisplayText", "Value", "ProductType"}); - table64.AddRow(new string[] { + table73.AddRow(new string[] { "Test Estate 1", "Voucher", "Hospital 1 Contract", @@ -199,9 +199,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)), table64, "When "); + await testRunner.WhenAsync("I create the following Products", ((string)(null)), table73, "When "); #line hidden - Reqnroll.Table table65 = new Reqnroll.Table(new string[] { + Reqnroll.Table table74 = new Reqnroll.Table(new string[] { "MerchantName", "AddressLine1", "Town", @@ -210,7 +210,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "ContactName", "EmailAddress", "EstateName"}); - table65.AddRow(new string[] { + table74.AddRow(new string[] { "Test Merchant 1", "Address Line 1", "TestTown", @@ -220,61 +220,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)), table65, "Given "); + await testRunner.GivenAsync("I create the following merchants", ((string)(null)), table74, "Given "); #line hidden - Reqnroll.Table table66 = new Reqnroll.Table(new string[] { + Reqnroll.Table table75 = new Reqnroll.Table(new string[] { "OperatorName", "MerchantName", "MerchantNumber", "TerminalNumber", "EstateName"}); - table66.AddRow(new string[] { + table75.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)), table66, "Given "); + await testRunner.GivenAsync("I have assigned the following operator to the merchants", ((string)(null)), table75, "Given "); #line hidden - Reqnroll.Table table67 = new Reqnroll.Table(new string[] { + Reqnroll.Table table76 = new Reqnroll.Table(new string[] { "DeviceIdentifier", "MerchantName", "EstateName"}); - table67.AddRow(new string[] { + table76.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)), table67, "Given "); + await testRunner.GivenAsync("I have assigned the following devices to the merchants", ((string)(null)), table76, "Given "); #line hidden - Reqnroll.Table table68 = new Reqnroll.Table(new string[] { + Reqnroll.Table table77 = new Reqnroll.Table(new string[] { "Reference", "Amount", "DateTime", "MerchantName", "EstateName"}); - table68.AddRow(new string[] { + table77.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)), table68, "Given "); + await testRunner.GivenAsync("I make the following manual merchant deposits", ((string)(null)), table77, "Given "); #line hidden - Reqnroll.Table table69 = new Reqnroll.Table(new string[] { + Reqnroll.Table table78 = new Reqnroll.Table(new string[] { "EstateName", "MerchantName", "ContractDescription"}); - table69.AddRow(new string[] { + table78.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)), table69, "When "); + await testRunner.WhenAsync("I add the following contracts to the following merchants", ((string)(null)), table78, "When "); #line hidden - Reqnroll.Table table70 = new Reqnroll.Table(new string[] { + Reqnroll.Table table79 = new Reqnroll.Table(new string[] { "DateTime", "TransactionNumber", "TransactionType", @@ -293,7 +293,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "MessageType", "AccountNumber", "CustomerName"}); - table70.AddRow(new string[] { + table79.AddRow(new string[] { "Today", "1", "Sale", @@ -313,7 +313,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)), table70, "When "); + await testRunner.WhenAsync("I perform the following transactions", ((string)(null)), table79, "When "); #line hidden } diff --git a/TransactionProcessor.IntegrationTests/Features/SaleTransactionFeature.feature.cs b/TransactionProcessor.IntegrationTests/Features/SaleTransactionFeature.feature.cs index 7382faae..9923bf96 100644 --- a/TransactionProcessor.IntegrationTests/Features/SaleTransactionFeature.feature.cs +++ b/TransactionProcessor.IntegrationTests/Features/SaleTransactionFeature.feature.cs @@ -81,199 +81,199 @@ public virtual async System.Threading.Tasks.Task FeatureBackgroundAsync() { #line 4 #line hidden - Reqnroll.Table table71 = new Reqnroll.Table(new string[] { + Reqnroll.Table table80 = new Reqnroll.Table(new string[] { "Name", "DisplayName", "Description"}); - table71.AddRow(new string[] { + table80.AddRow(new string[] { "estateManagement", "Estate Managememt REST Scope", "A scope for Estate Managememt REST"}); - table71.AddRow(new string[] { + table80.AddRow(new string[] { "transactionProcessor", "Transaction Processor REST Scope", "A scope for Transaction Processor REST"}); - table71.AddRow(new string[] { + table80.AddRow(new string[] { "voucherManagement", "Voucher Management REST Scope", "A scope for Voucher Management REST"}); - table71.AddRow(new string[] { + table80.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)), table71, "Given "); + await testRunner.GivenAsync("I create the following api scopes", ((string)(null)), table80, "Given "); #line hidden - Reqnroll.Table table72 = new Reqnroll.Table(new string[] { + Reqnroll.Table table81 = new Reqnroll.Table(new string[] { "Name", "DisplayName", "Secret", "Scopes", "UserClaims"}); - table72.AddRow(new string[] { + table81.AddRow(new string[] { "estateManagement", "Estate Managememt REST", "Secret1", "estateManagement", "MerchantId, EstateId, role"}); - table72.AddRow(new string[] { + table81.AddRow(new string[] { "transactionProcessor", "Transaction Processor REST", "Secret1", "transactionProcessor", ""}); - table72.AddRow(new string[] { + table81.AddRow(new string[] { "voucherManagement", "Voucher Management REST", "Secret1", "voucherManagement", ""}); - table72.AddRow(new string[] { + table81.AddRow(new string[] { "messagingService", "Messaging REST", "Secret", "messagingService", ""}); #line 13 - await testRunner.GivenAsync("the following api resources exist", ((string)(null)), table72, "Given "); + await testRunner.GivenAsync("the following api resources exist", ((string)(null)), table81, "Given "); #line hidden - Reqnroll.Table table73 = new Reqnroll.Table(new string[] { + Reqnroll.Table table82 = new Reqnroll.Table(new string[] { "ClientId", "ClientName", "Secret", "Scopes", "GrantTypes"}); - table73.AddRow(new string[] { + table82.AddRow(new string[] { "serviceClient", "Service Client", "Secret1", "estateManagement,transactionProcessor,voucherManagement,messagingService", "client_credentials"}); #line 20 - await testRunner.GivenAsync("the following clients exist", ((string)(null)), table73, "Given "); + await testRunner.GivenAsync("the following clients exist", ((string)(null)), table82, "Given "); #line hidden - Reqnroll.Table table74 = new Reqnroll.Table(new string[] { + Reqnroll.Table table83 = new Reqnroll.Table(new string[] { "ClientId"}); - table74.AddRow(new string[] { + table83.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)), table74, "Given "); + "s", ((string)(null)), table83, "Given "); #line hidden - Reqnroll.Table table75 = new Reqnroll.Table(new string[] { + Reqnroll.Table table84 = new Reqnroll.Table(new string[] { "AccountNumber", "AccountName", "DueDate", "Amount"}); - table75.AddRow(new string[] { + table84.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)), table75, "Given "); + await testRunner.GivenAsync("the following bills are available at the PataPawa PostPaid Host", ((string)(null)), table84, "Given "); #line hidden - Reqnroll.Table table76 = new Reqnroll.Table(new string[] { + Reqnroll.Table table85 = new Reqnroll.Table(new string[] { "Username", "Password"}); - table76.AddRow(new string[] { + table85.AddRow(new string[] { "operatora", "1234567898"}); #line 32 - await testRunner.GivenAsync("the following users are available at the PataPawa PrePay Host", ((string)(null)), table76, "Given "); + await testRunner.GivenAsync("the following users are available at the PataPawa PrePay Host", ((string)(null)), table85, "Given "); #line hidden - Reqnroll.Table table77 = new Reqnroll.Table(new string[] { + Reqnroll.Table table86 = new Reqnroll.Table(new string[] { "MeterNumber", "CustomerName"}); - table77.AddRow(new string[] { + table86.AddRow(new string[] { "00000001", "Customer 1"}); - table77.AddRow(new string[] { + table86.AddRow(new string[] { "00000002", "Customer 2"}); - table77.AddRow(new string[] { + table86.AddRow(new string[] { "00000003", "Customer 3"}); #line 36 - await testRunner.GivenAsync("the following meters are available at the PataPawa PrePay Host", ((string)(null)), table77, "Given "); + await testRunner.GivenAsync("the following meters are available at the PataPawa PrePay Host", ((string)(null)), table86, "Given "); #line hidden - Reqnroll.Table table78 = new Reqnroll.Table(new string[] { + Reqnroll.Table table87 = new Reqnroll.Table(new string[] { "EstateName"}); - table78.AddRow(new string[] { + table87.AddRow(new string[] { "Test Estate 1"}); #line 42 - await testRunner.GivenAsync("I have created the following estates", ((string)(null)), table78, "Given "); + await testRunner.GivenAsync("I have created the following estates", ((string)(null)), table87, "Given "); #line hidden - Reqnroll.Table table79 = new Reqnroll.Table(new string[] { + Reqnroll.Table table88 = new Reqnroll.Table(new string[] { "EstateName", "OperatorName", "RequireCustomMerchantNumber", "RequireCustomTerminalNumber"}); - table79.AddRow(new string[] { + table88.AddRow(new string[] { "Test Estate 1", "Safaricom", "True", "True"}); - table79.AddRow(new string[] { + table88.AddRow(new string[] { "Test Estate 1", "Voucher", "True", "True"}); - table79.AddRow(new string[] { + table88.AddRow(new string[] { "Test Estate 1", "PataPawa PostPay", "True", "True"}); - table79.AddRow(new string[] { + table88.AddRow(new string[] { "Test Estate 1", "PataPawa PrePay", "True", "True"}); #line 46 - await testRunner.GivenAsync("I have created the following operators", ((string)(null)), table79, "Given "); + await testRunner.GivenAsync("I have created the following operators", ((string)(null)), table88, "Given "); #line hidden - Reqnroll.Table table80 = new Reqnroll.Table(new string[] { + Reqnroll.Table table89 = new Reqnroll.Table(new string[] { "EstateName", "OperatorName"}); - table80.AddRow(new string[] { + table89.AddRow(new string[] { "Test Estate 1", "Safaricom"}); - table80.AddRow(new string[] { + table89.AddRow(new string[] { "Test Estate 1", "Voucher"}); - table80.AddRow(new string[] { + table89.AddRow(new string[] { "Test Estate 1", "PataPawa PostPay"}); - table80.AddRow(new string[] { + table89.AddRow(new string[] { "Test Estate 1", "PataPawa PrePay"}); #line 53 - await testRunner.AndAsync("I have assigned the following operators to the estates", ((string)(null)), table80, "And "); + await testRunner.AndAsync("I have assigned the following operators to the estates", ((string)(null)), table89, "And "); #line hidden - Reqnroll.Table table81 = new Reqnroll.Table(new string[] { + Reqnroll.Table table90 = new Reqnroll.Table(new string[] { "EstateName", "OperatorName", "ContractDescription"}); - table81.AddRow(new string[] { + table90.AddRow(new string[] { "Test Estate 1", "Safaricom", "Safaricom Contract"}); - table81.AddRow(new string[] { + table90.AddRow(new string[] { "Test Estate 1", "Voucher", "Hospital 1 Contract"}); - table81.AddRow(new string[] { + table90.AddRow(new string[] { "Test Estate 1", "PataPawa PostPay", "PataPawa PostPay Contract"}); - table81.AddRow(new string[] { + table90.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)), table81, "Given "); + await testRunner.GivenAsync("I create a contract with the following values", ((string)(null)), table90, "Given "); #line hidden - Reqnroll.Table table82 = new Reqnroll.Table(new string[] { + Reqnroll.Table table91 = new Reqnroll.Table(new string[] { "EstateName", "OperatorName", "ContractDescription", @@ -281,7 +281,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "DisplayText", "Value", "ProductType"}); - table82.AddRow(new string[] { + table91.AddRow(new string[] { "Test Estate 1", "Safaricom", "Safaricom Contract", @@ -289,7 +289,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "Custom", "", "MobileTopup"}); - table82.AddRow(new string[] { + table91.AddRow(new string[] { "Test Estate 1", "Voucher", "Hospital 1 Contract", @@ -297,7 +297,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "10 KES", "", "Voucher"}); - table82.AddRow(new string[] { + table91.AddRow(new string[] { "Test Estate 1", "PataPawa PostPay", "PataPawa PostPay Contract", @@ -305,7 +305,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "Bill Pay (Post)", "", "BillPayment"}); - table82.AddRow(new string[] { + table91.AddRow(new string[] { "Test Estate 1", "PataPawa PrePay", "PataPawa PrePay Contract", @@ -314,9 +314,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)), table82, "When "); + await testRunner.WhenAsync("I create the following Products", ((string)(null)), table91, "When "); #line hidden - Reqnroll.Table table83 = new Reqnroll.Table(new string[] { + Reqnroll.Table table92 = new Reqnroll.Table(new string[] { "EstateName", "OperatorName", "ContractDescription", @@ -324,7 +324,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "CalculationType", "FeeDescription", "Value"}); - table83.AddRow(new string[] { + table92.AddRow(new string[] { "Test Estate 1", "Safaricom", "Safaricom Contract", @@ -332,7 +332,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "Percentage", "Merchant Commission", "0.50"}); - table83.AddRow(new string[] { + table92.AddRow(new string[] { "Test Estate 1", "PataPawa PostPay", "PataPawa PostPay Contract", @@ -340,7 +340,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "Percentage", "Merchant Commission", "0.50"}); - table83.AddRow(new string[] { + table92.AddRow(new string[] { "Test Estate 1", "PataPawa PrePay", "PataPawa PrePay Contract", @@ -349,9 +349,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)), table83, "When "); + await testRunner.WhenAsync("I add the following Transaction Fees", ((string)(null)), table92, "When "); #line hidden - Reqnroll.Table table84 = new Reqnroll.Table(new string[] { + Reqnroll.Table table93 = new Reqnroll.Table(new string[] { "MerchantName", "AddressLine1", "Town", @@ -360,7 +360,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "ContactName", "EmailAddress", "EstateName"}); - table84.AddRow(new string[] { + table93.AddRow(new string[] { "Test Merchant 1", "Address Line 1", "TestTown", @@ -369,7 +369,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "Test Contact 1", "testcontact1@merchant1.co.uk", "Test Estate 1"}); - table84.AddRow(new string[] { + table93.AddRow(new string[] { "Test Merchant 2", "Address Line 1", "TestTown", @@ -378,7 +378,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "Test Contact 2", "testcontact2@merchant2.co.uk", "Test Estate 1"}); - table84.AddRow(new string[] { + table93.AddRow(new string[] { "Test Merchant 3", "Address Line 1", "TestTown", @@ -387,7 +387,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "Test Contact 3", "testcontact3@merchant3.co.uk", "Test Estate 1"}); - table84.AddRow(new string[] { + table93.AddRow(new string[] { "Test Merchant 4", "Address Line 1", "TestTown", @@ -397,239 +397,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)), table84, "Given "); + await testRunner.GivenAsync("I create the following merchants", ((string)(null)), table93, "Given "); #line hidden - Reqnroll.Table table85 = new Reqnroll.Table(new string[] { + Reqnroll.Table table94 = new Reqnroll.Table(new string[] { "OperatorName", "MerchantName", "MerchantNumber", "TerminalNumber", "EstateName"}); - table85.AddRow(new string[] { + table94.AddRow(new string[] { "Safaricom", "Test Merchant 1", "00000001", "10000001", "Test Estate 1"}); - table85.AddRow(new string[] { + table94.AddRow(new string[] { "Voucher", "Test Merchant 1", "00000001", "10000001", "Test Estate 1"}); - table85.AddRow(new string[] { + table94.AddRow(new string[] { "PataPawa PostPay", "Test Merchant 1", "00000001", "10000001", "Test Estate 1"}); - table85.AddRow(new string[] { + table94.AddRow(new string[] { "PataPawa PrePay", "Test Merchant 1", "00000001", "10000001", "Test Estate 1"}); - table85.AddRow(new string[] { + table94.AddRow(new string[] { "Safaricom", "Test Merchant 2", "00000002", "10000002", "Test Estate 1"}); - table85.AddRow(new string[] { + table94.AddRow(new string[] { "Voucher", "Test Merchant 2", "00000002", "10000002", "Test Estate 1"}); - table85.AddRow(new string[] { + table94.AddRow(new string[] { "PataPawa PostPay", "Test Merchant 2", "00000002", "10000002", "Test Estate 1"}); - table85.AddRow(new string[] { + table94.AddRow(new string[] { "PataPawa PrePay", "Test Merchant 2", "00000001", "10000001", "Test Estate 1"}); - table85.AddRow(new string[] { + table94.AddRow(new string[] { "Safaricom", "Test Merchant 3", "00000003", "10000003", "Test Estate 1"}); - table85.AddRow(new string[] { + table94.AddRow(new string[] { "Voucher", "Test Merchant 3", "00000003", "10000003", "Test Estate 1"}); - table85.AddRow(new string[] { + table94.AddRow(new string[] { "PataPawa PostPay", "Test Merchant 3", "00000003", "10000003", "Test Estate 1"}); - table85.AddRow(new string[] { + table94.AddRow(new string[] { "PataPawa PrePay", "Test Merchant 3", "00000001", "10000001", "Test Estate 1"}); - table85.AddRow(new string[] { + table94.AddRow(new string[] { "Safaricom", "Test Merchant 4", "00000004", "10000004", "Test Estate 1"}); - table85.AddRow(new string[] { + table94.AddRow(new string[] { "Voucher", "Test Merchant 4", "00000004", "10000004", "Test Estate 1"}); - table85.AddRow(new string[] { + table94.AddRow(new string[] { "PataPawa PostPay", "Test Merchant 4", "00000004", "10000004", "Test Estate 1"}); - table85.AddRow(new string[] { + table94.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)), table85, "Given "); + await testRunner.GivenAsync("I have assigned the following operator to the merchants", ((string)(null)), table94, "Given "); #line hidden - Reqnroll.Table table86 = new Reqnroll.Table(new string[] { + Reqnroll.Table table95 = new Reqnroll.Table(new string[] { "DeviceIdentifier", "MerchantName", "EstateName"}); - table86.AddRow(new string[] { + table95.AddRow(new string[] { "123456780", "Test Merchant 1", "Test Estate 1"}); - table86.AddRow(new string[] { + table95.AddRow(new string[] { "123456781", "Test Merchant 2", "Test Estate 1"}); - table86.AddRow(new string[] { + table95.AddRow(new string[] { "123456782", "Test Merchant 3", "Test Estate 1"}); - table86.AddRow(new string[] { + table95.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)), table86, "Given "); + await testRunner.GivenAsync("I have assigned the following devices to the merchants", ((string)(null)), table95, "Given "); #line hidden - Reqnroll.Table table87 = new Reqnroll.Table(new string[] { + Reqnroll.Table table96 = new Reqnroll.Table(new string[] { "Reference", "Amount", "DateTime", "MerchantName", "EstateName"}); - table87.AddRow(new string[] { + table96.AddRow(new string[] { "Deposit1", "265.00", "Today", "Test Merchant 1", "Test Estate 1"}); - table87.AddRow(new string[] { + table96.AddRow(new string[] { "Deposit1", "110.00", "Today", "Test Merchant 2", "Test Estate 1"}); - table87.AddRow(new string[] { + table96.AddRow(new string[] { "Deposit1", "110.00", "Today", "Test Merchant 3", "Test Estate 1"}); - table87.AddRow(new string[] { + table96.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)), table87, "Given "); + await testRunner.GivenAsync("I make the following manual merchant deposits", ((string)(null)), table96, "Given "); #line hidden - Reqnroll.Table table88 = new Reqnroll.Table(new string[] { + Reqnroll.Table table97 = new Reqnroll.Table(new string[] { "EstateName", "MerchantName", "ContractDescription"}); - table88.AddRow(new string[] { + table97.AddRow(new string[] { "Test Estate 1", "Test Merchant 1", "Safaricom Contract"}); - table88.AddRow(new string[] { + table97.AddRow(new string[] { "Test Estate 1", "Test Merchant 1", "Hospital 1 Contract"}); - table88.AddRow(new string[] { + table97.AddRow(new string[] { "Test Estate 1", "Test Merchant 1", "PataPawa PostPay Contract"}); - table88.AddRow(new string[] { + table97.AddRow(new string[] { "Test Estate 1", "Test Merchant 1", "PataPawa PrePay Contract"}); - table88.AddRow(new string[] { + table97.AddRow(new string[] { "Test Estate 1", "Test Merchant 2", "Safaricom Contract"}); - table88.AddRow(new string[] { + table97.AddRow(new string[] { "Test Estate 1", "Test Merchant 2", "Hospital 1 Contract"}); - table88.AddRow(new string[] { + table97.AddRow(new string[] { "Test Estate 1", "Test Merchant 2", "PataPawa PostPay Contract"}); - table88.AddRow(new string[] { + table97.AddRow(new string[] { "Test Estate 1", "Test Merchant 2", "PataPawa PrePay Contract"}); - table88.AddRow(new string[] { + table97.AddRow(new string[] { "Test Estate 1", "Test Merchant 3", "Safaricom Contract"}); - table88.AddRow(new string[] { + table97.AddRow(new string[] { "Test Estate 1", "Test Merchant 3", "Hospital 1 Contract"}); - table88.AddRow(new string[] { + table97.AddRow(new string[] { "Test Estate 1", "Test Merchant 3", "PataPawa PostPay Contract"}); - table88.AddRow(new string[] { + table97.AddRow(new string[] { "Test Estate 1", "Test Merchant 3", "PataPawa PrePay Contract"}); - table88.AddRow(new string[] { + table97.AddRow(new string[] { "Test Estate 1", "Test Merchant 4", "Safaricom Contract"}); - table88.AddRow(new string[] { + table97.AddRow(new string[] { "Test Estate 1", "Test Merchant 4", "Hospital 1 Contract"}); - table88.AddRow(new string[] { + table97.AddRow(new string[] { "Test Estate 1", "Test Merchant 4", "PataPawa PostPay Contract"}); - table88.AddRow(new string[] { + table97.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)), table88, "When "); + await testRunner.WhenAsync("I add the following contracts to the following merchants", ((string)(null)), table97, "When "); #line hidden } @@ -655,7 +655,7 @@ public async System.Threading.Tasks.Task SaleTransactions() #line 4 await this.FeatureBackgroundAsync(); #line hidden - Reqnroll.Table table89 = new Reqnroll.Table(new string[] { + Reqnroll.Table table98 = new Reqnroll.Table(new string[] { "DateTime", "TransactionNumber", "TransactionType", @@ -675,7 +675,7 @@ public async System.Threading.Tasks.Task SaleTransactions() "AccountNumber", "CustomerName", "MeterNumber"}); - table89.AddRow(new string[] { + table98.AddRow(new string[] { "Today", "1", "Sale", @@ -695,7 +695,7 @@ public async System.Threading.Tasks.Task SaleTransactions() "", "", ""}); - table89.AddRow(new string[] { + table98.AddRow(new string[] { "Today", "2", "Sale", @@ -715,7 +715,7 @@ public async System.Threading.Tasks.Task SaleTransactions() "", "", ""}); - table89.AddRow(new string[] { + table98.AddRow(new string[] { "Today", "3", "Sale", @@ -735,7 +735,7 @@ public async System.Threading.Tasks.Task SaleTransactions() "", "", ""}); - table89.AddRow(new string[] { + table98.AddRow(new string[] { "Today", "4", "Sale", @@ -755,7 +755,7 @@ public async System.Threading.Tasks.Task SaleTransactions() "", "", ""}); - table89.AddRow(new string[] { + table98.AddRow(new string[] { "Today", "5", "Sale", @@ -775,7 +775,7 @@ public async System.Threading.Tasks.Task SaleTransactions() "", "", ""}); - table89.AddRow(new string[] { + table98.AddRow(new string[] { "Today", "6", "Sale", @@ -795,7 +795,7 @@ public async System.Threading.Tasks.Task SaleTransactions() "", "", ""}); - table89.AddRow(new string[] { + table98.AddRow(new string[] { "Today", "7", "Sale", @@ -815,7 +815,7 @@ public async System.Threading.Tasks.Task SaleTransactions() "", "", ""}); - table89.AddRow(new string[] { + table98.AddRow(new string[] { "Today", "8", "Sale", @@ -835,7 +835,7 @@ public async System.Threading.Tasks.Task SaleTransactions() "12345678", "", ""}); - table89.AddRow(new string[] { + table98.AddRow(new string[] { "Today", "9", "Sale", @@ -855,7 +855,7 @@ public async System.Threading.Tasks.Task SaleTransactions() "12345678", "Mr Test Customer", ""}); - table89.AddRow(new string[] { + table98.AddRow(new string[] { "Today", "10", "Sale", @@ -875,7 +875,7 @@ public async System.Threading.Tasks.Task SaleTransactions() "", "", "00000001"}); - table89.AddRow(new string[] { + table98.AddRow(new string[] { "Today", "11", "Sale", @@ -896,84 +896,84 @@ public async System.Threading.Tasks.Task SaleTransactions() "Customer 1", "00000001"}); #line 142 - await testRunner.WhenAsync("I perform the following transactions", ((string)(null)), table89, "When "); + await testRunner.WhenAsync("I perform the following transactions", ((string)(null)), table98, "When "); #line hidden - Reqnroll.Table table90 = new Reqnroll.Table(new string[] { + Reqnroll.Table table99 = new Reqnroll.Table(new string[] { "EstateName", "MerchantName", "TransactionNumber", "ResponseCode", "ResponseMessage"}); - table90.AddRow(new string[] { + table99.AddRow(new string[] { "Test Estate 1", "Test Merchant 1", "1", "0000", "SUCCESS"}); - table90.AddRow(new string[] { + table99.AddRow(new string[] { "Test Estate 1", "Test Merchant 2", "2", "0000", "SUCCESS"}); - table90.AddRow(new string[] { + table99.AddRow(new string[] { "Test Estate 1", "Test Merchant 3", "3", "0000", "SUCCESS"}); - table90.AddRow(new string[] { + table99.AddRow(new string[] { "Test Estate 1", "Test Merchant 1", "4", "0000", "SUCCESS"}); - table90.AddRow(new string[] { + table99.AddRow(new string[] { "Test Estate 1", "Test Merchant 1", "5", "0000", "SUCCESS"}); - table90.AddRow(new string[] { + table99.AddRow(new string[] { "Test Estate 1", "Test Merchant 2", "6", "0000", "SUCCESS"}); - table90.AddRow(new string[] { + table99.AddRow(new string[] { "Test Estate 1", "Test Merchant 3", "7", "0000", "SUCCESS"}); - table90.AddRow(new string[] { + table99.AddRow(new string[] { "Test Estate 1", "Test Merchant 1", "8", "0000", "SUCCESS"}); - table90.AddRow(new string[] { + table99.AddRow(new string[] { "Test Estate 1", "Test Merchant 1", "9", "0000", "SUCCESS"}); - table90.AddRow(new string[] { + table99.AddRow(new string[] { "Test Estate 1", "Test Merchant 1", "10", "0000", "SUCCESS"}); - table90.AddRow(new string[] { + table99.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)), table90, "Then "); + await testRunner.ThenAsync("transaction response should contain the following information", ((string)(null)), table99, "Then "); #line hidden - Reqnroll.Table table91 = new Reqnroll.Table(new string[] { + Reqnroll.Table table100 = new Reqnroll.Table(new string[] { "DateTime", "Reference", "EntryType", @@ -981,7 +981,7 @@ public async System.Threading.Tasks.Task SaleTransactions() "Out", "ChangeAmount", "Balance"}); - table91.AddRow(new string[] { + table100.AddRow(new string[] { "Today", "Merchant Deposit", "C", @@ -989,7 +989,7 @@ public async System.Threading.Tasks.Task SaleTransactions() "0.00", "265.00", "230.00"}); - table91.AddRow(new string[] { + table100.AddRow(new string[] { "Today", "Transaction Completed", "D", @@ -997,7 +997,7 @@ public async System.Threading.Tasks.Task SaleTransactions() "110.00", "110.00", "130.00"}); - table91.AddRow(new string[] { + table100.AddRow(new string[] { "Today", "Transaction Completed", "D", @@ -1005,7 +1005,7 @@ public async System.Threading.Tasks.Task SaleTransactions() "90.00", "90.00", "30.00"}); - table91.AddRow(new string[] { + table100.AddRow(new string[] { "Today", "Transaction Completed", "D", @@ -1013,7 +1013,7 @@ public async System.Threading.Tasks.Task SaleTransactions() "10.00", "10.00", "20.00"}); - table91.AddRow(new string[] { + table100.AddRow(new string[] { "Today", "Transaction Completed", "D", @@ -1021,7 +1021,7 @@ public async System.Threading.Tasks.Task SaleTransactions() "20.00", "20.00", "20.00"}); - table91.AddRow(new string[] { + table100.AddRow(new string[] { "Today", "Transaction Completed", "D", @@ -1029,7 +1029,7 @@ public async System.Threading.Tasks.Task SaleTransactions() "20.00", "25.00", "20.00"}); - table91.AddRow(new string[] { + table100.AddRow(new string[] { "Today", "Transaction Fee Processed", "C", @@ -1037,7 +1037,7 @@ public async System.Threading.Tasks.Task SaleTransactions() "0.55", "0.55", "20.00"}); - table91.AddRow(new string[] { + table100.AddRow(new string[] { "Today", "Transaction Fee Processed", "C", @@ -1045,7 +1045,7 @@ public async System.Threading.Tasks.Task SaleTransactions() "0.45", "0.45", "20.00"}); - table91.AddRow(new string[] { + table100.AddRow(new string[] { "Today", "Transaction Fee Processed", "C", @@ -1053,7 +1053,7 @@ public async System.Threading.Tasks.Task SaleTransactions() "0.01", "0.10", "20.00"}); - table91.AddRow(new string[] { + table100.AddRow(new string[] { "Today", "Transaction Fee Processed", "C", @@ -1061,7 +1061,7 @@ public async System.Threading.Tasks.Task SaleTransactions() "0.01", "0.10", "20.00"}); - table91.AddRow(new string[] { + table100.AddRow(new string[] { "Today", "Opening Balance", "C", @@ -1071,9 +1071,9 @@ public async System.Threading.Tasks.Task SaleTransactions() "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)), table91, "Then "); + "tate 1\' and merchant \'Test Merchant 1\'", ((string)(null)), table100, "Then "); #line hidden - Reqnroll.Table table92 = new Reqnroll.Table(new string[] { + Reqnroll.Table table101 = new Reqnroll.Table(new string[] { "DateTime", "Reference", "EntryType", @@ -1081,7 +1081,7 @@ public async System.Threading.Tasks.Task SaleTransactions() "Out", "ChangeAmount", "Balance"}); - table92.AddRow(new string[] { + table101.AddRow(new string[] { "Today", "Merchant Deposit", "C", @@ -1089,7 +1089,7 @@ public async System.Threading.Tasks.Task SaleTransactions() "0.00", "110.00", "230.00"}); - table92.AddRow(new string[] { + table101.AddRow(new string[] { "Today", "Transaction Completed", "D", @@ -1097,7 +1097,7 @@ public async System.Threading.Tasks.Task SaleTransactions() "100.00", "100.00", "130.00"}); - table92.AddRow(new string[] { + table101.AddRow(new string[] { "Today", "Transaction Completed", "D", @@ -1105,7 +1105,7 @@ public async System.Threading.Tasks.Task SaleTransactions() "10.00", "10.00", "30.00"}); - table92.AddRow(new string[] { + table101.AddRow(new string[] { "Today", "Transaction Fee Processed", "C", @@ -1113,7 +1113,7 @@ public async System.Threading.Tasks.Task SaleTransactions() "0.50", "0.50", "20.00"}); - table92.AddRow(new string[] { + table101.AddRow(new string[] { "Today", "Opening Balance", "C", @@ -1123,9 +1123,9 @@ public async System.Threading.Tasks.Task SaleTransactions() "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)), table92, "Then "); + "tate 1\' and merchant \'Test Merchant 2\'", ((string)(null)), table101, "Then "); #line hidden - Reqnroll.Table table93 = new Reqnroll.Table(new string[] { + Reqnroll.Table table102 = new Reqnroll.Table(new string[] { "DateTime", "Reference", "EntryType", @@ -1133,7 +1133,7 @@ public async System.Threading.Tasks.Task SaleTransactions() "Out", "ChangeAmount", "Balance"}); - table93.AddRow(new string[] { + table102.AddRow(new string[] { "Today", "Merchant Deposit", "C", @@ -1141,7 +1141,7 @@ public async System.Threading.Tasks.Task SaleTransactions() "0.00", "110.00", "230.00"}); - table93.AddRow(new string[] { + table102.AddRow(new string[] { "Today", "Transaction Completed", "D", @@ -1149,7 +1149,7 @@ public async System.Threading.Tasks.Task SaleTransactions() "100.00", "100.00", "130.00"}); - table93.AddRow(new string[] { + table102.AddRow(new string[] { "Today", "Transaction Completed", "D", @@ -1157,7 +1157,7 @@ public async System.Threading.Tasks.Task SaleTransactions() "10.00", "10.00", "30.00"}); - table93.AddRow(new string[] { + table102.AddRow(new string[] { "Today", "Transaction Fee Processed", "C", @@ -1165,7 +1165,7 @@ public async System.Threading.Tasks.Task SaleTransactions() "0.85", "0.50", "20.00"}); - table93.AddRow(new string[] { + table102.AddRow(new string[] { "Today", "Opening Balance", "C", @@ -1175,20 +1175,20 @@ public async System.Threading.Tasks.Task SaleTransactions() "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)), table93, "Then "); + "tate 1\' and merchant \'Test Merchant 3\'", ((string)(null)), table102, "Then "); #line hidden - Reqnroll.Table table94 = new Reqnroll.Table(new string[] { + Reqnroll.Table table103 = new Reqnroll.Table(new string[] { "EstateName", "MerchantName", "TransactionNumber"}); - table94.AddRow(new string[] { + table103.AddRow(new string[] { "Test Estate 1", "Test Merchant 1", "1"}); #line 200 - await testRunner.WhenAsync("I request the receipt is resent", ((string)(null)), table94, "When "); + await testRunner.WhenAsync("I request the receipt is resent", ((string)(null)), table103, "When "); #line hidden - Reqnroll.Table table95 = new Reqnroll.Table(new string[] { + Reqnroll.Table table104 = new Reqnroll.Table(new string[] { "DateTime", "TransactionNumber", "TransactionType", @@ -1202,7 +1202,7 @@ public async System.Threading.Tasks.Task SaleTransactions() "CustomerEmailAddress", "ContractDescription", "ProductName"}); - table95.AddRow(new string[] { + table104.AddRow(new string[] { "Today", "12", "Sale", @@ -1217,24 +1217,24 @@ public async System.Threading.Tasks.Task SaleTransactions() "Safaricom Contract", "Variable Topup"}); #line 204 - await testRunner.WhenAsync("I perform the following transactions", ((string)(null)), table95, "When "); + await testRunner.WhenAsync("I perform the following transactions", ((string)(null)), table104, "When "); #line hidden - Reqnroll.Table table96 = new Reqnroll.Table(new string[] { + Reqnroll.Table table105 = new Reqnroll.Table(new string[] { "EstateName", "MerchantName", "TransactionNumber", "ResponseCode", "ResponseMessage"}); - table96.AddRow(new string[] { + table105.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)), table96, "Then "); + await testRunner.ThenAsync("transaction response should contain the following information", ((string)(null)), table105, "Then "); #line hidden - Reqnroll.Table table97 = new Reqnroll.Table(new string[] { + Reqnroll.Table table106 = new Reqnroll.Table(new string[] { "DateTime", "TransactionNumber", "TransactionType", @@ -1248,7 +1248,7 @@ public async System.Threading.Tasks.Task SaleTransactions() "CustomerEmailAddress", "ContractDescription", "ProductName"}); - table97.AddRow(new string[] { + table106.AddRow(new string[] { "Today", "13", "Sale", @@ -1263,24 +1263,24 @@ public async System.Threading.Tasks.Task SaleTransactions() "Safaricom Contract", "Variable Topup"}); #line 212 - await testRunner.WhenAsync("I perform the following transactions", ((string)(null)), table97, "When "); + await testRunner.WhenAsync("I perform the following transactions", ((string)(null)), table106, "When "); #line hidden - Reqnroll.Table table98 = new Reqnroll.Table(new string[] { + Reqnroll.Table table107 = new Reqnroll.Table(new string[] { "EstateName", "MerchantName", "TransactionNumber", "ResponseCode", "ResponseMessage"}); - table98.AddRow(new string[] { + table107.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)), table98, "Then "); + await testRunner.ThenAsync("transaction response should contain the following information", ((string)(null)), table107, "Then "); #line hidden - Reqnroll.Table table99 = new Reqnroll.Table(new string[] { + Reqnroll.Table table108 = new Reqnroll.Table(new string[] { "DateTime", "TransactionNumber", "TransactionType", @@ -1294,7 +1294,7 @@ public async System.Threading.Tasks.Task SaleTransactions() "CustomerEmailAddress", "ContractDescription", "ProductName"}); - table99.AddRow(new string[] { + table108.AddRow(new string[] { "Today", "14", "Sale", @@ -1309,15 +1309,15 @@ public async System.Threading.Tasks.Task SaleTransactions() "Safaricom Contract", "Variable Topup"}); #line 220 - await testRunner.WhenAsync("I perform the following transactions", ((string)(null)), table99, "When "); + await testRunner.WhenAsync("I perform the following transactions", ((string)(null)), table108, "When "); #line hidden - Reqnroll.Table table100 = new Reqnroll.Table(new string[] { + Reqnroll.Table table109 = new Reqnroll.Table(new string[] { "EstateName", "MerchantName", "TransactionNumber", "ResponseCode", "ResponseMessage"}); - table100.AddRow(new string[] { + table109.AddRow(new string[] { "Test Estate 1", "InvalidMerchant", "14", @@ -1325,9 +1325,9 @@ public async System.Threading.Tasks.Task SaleTransactions() "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)), table100, "Then "); + await testRunner.ThenAsync("transaction response should contain the following information", ((string)(null)), table109, "Then "); #line hidden - Reqnroll.Table table101 = new Reqnroll.Table(new string[] { + Reqnroll.Table table110 = new Reqnroll.Table(new string[] { "DateTime", "TransactionNumber", "TransactionType", @@ -1341,7 +1341,7 @@ public async System.Threading.Tasks.Task SaleTransactions() "CustomerEmailAddress", "ContractDescription", "ProductName"}); - table101.AddRow(new string[] { + table110.AddRow(new string[] { "Today", "15", "Sale", @@ -1356,15 +1356,15 @@ public async System.Threading.Tasks.Task SaleTransactions() "EmptyContract", "Variable Topup"}); #line 228 - await testRunner.WhenAsync("I perform the following transactions", ((string)(null)), table101, "When "); + await testRunner.WhenAsync("I perform the following transactions", ((string)(null)), table110, "When "); #line hidden - Reqnroll.Table table102 = new Reqnroll.Table(new string[] { + Reqnroll.Table table111 = new Reqnroll.Table(new string[] { "EstateName", "MerchantName", "TransactionNumber", "ResponseCode", "ResponseMessage"}); - table102.AddRow(new string[] { + table111.AddRow(new string[] { "Test Estate 1", "Test Merchant 1", "15", @@ -1372,9 +1372,9 @@ public async System.Threading.Tasks.Task SaleTransactions() "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)), table102, "Then "); + await testRunner.ThenAsync("transaction response should contain the following information", ((string)(null)), table111, "Then "); #line hidden - Reqnroll.Table table103 = new Reqnroll.Table(new string[] { + Reqnroll.Table table112 = new Reqnroll.Table(new string[] { "DateTime", "TransactionNumber", "TransactionType", @@ -1388,7 +1388,7 @@ public async System.Threading.Tasks.Task SaleTransactions() "CustomerEmailAddress", "ContractDescription", "ProductName"}); - table103.AddRow(new string[] { + table112.AddRow(new string[] { "Today", "16", "Sale", @@ -1403,15 +1403,15 @@ public async System.Threading.Tasks.Task SaleTransactions() "InvalidContract", "Variable Topup"}); #line 236 - await testRunner.WhenAsync("I perform the following transactions", ((string)(null)), table103, "When "); + await testRunner.WhenAsync("I perform the following transactions", ((string)(null)), table112, "When "); #line hidden - Reqnroll.Table table104 = new Reqnroll.Table(new string[] { + Reqnroll.Table table113 = new Reqnroll.Table(new string[] { "EstateName", "MerchantName", "TransactionNumber", "ResponseCode", "ResponseMessage"}); - table104.AddRow(new string[] { + table113.AddRow(new string[] { "Test Estate 1", "Test Merchant 1", "16", @@ -1419,9 +1419,9 @@ public async System.Threading.Tasks.Task SaleTransactions() "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)), table104, "Then "); + await testRunner.ThenAsync("transaction response should contain the following information", ((string)(null)), table113, "Then "); #line hidden - Reqnroll.Table table105 = new Reqnroll.Table(new string[] { + Reqnroll.Table table114 = new Reqnroll.Table(new string[] { "DateTime", "TransactionNumber", "TransactionType", @@ -1435,7 +1435,7 @@ public async System.Threading.Tasks.Task SaleTransactions() "CustomerEmailAddress", "ContractDescription", "ProductName"}); - table105.AddRow(new string[] { + table114.AddRow(new string[] { "Today", "17", "Sale", @@ -1450,15 +1450,15 @@ public async System.Threading.Tasks.Task SaleTransactions() "Safaricom Contract", "EmptyProduct"}); #line 244 - await testRunner.WhenAsync("I perform the following transactions", ((string)(null)), table105, "When "); + await testRunner.WhenAsync("I perform the following transactions", ((string)(null)), table114, "When "); #line hidden - Reqnroll.Table table106 = new Reqnroll.Table(new string[] { + Reqnroll.Table table115 = new Reqnroll.Table(new string[] { "EstateName", "MerchantName", "TransactionNumber", "ResponseCode", "ResponseMessage"}); - table106.AddRow(new string[] { + table115.AddRow(new string[] { "Test Estate 1", "Test Merchant 1", "17", @@ -1466,9 +1466,9 @@ public async System.Threading.Tasks.Task SaleTransactions() "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)), table106, "Then "); + await testRunner.ThenAsync("transaction response should contain the following information", ((string)(null)), table115, "Then "); #line hidden - Reqnroll.Table table107 = new Reqnroll.Table(new string[] { + Reqnroll.Table table116 = new Reqnroll.Table(new string[] { "DateTime", "TransactionNumber", "TransactionType", @@ -1482,7 +1482,7 @@ public async System.Threading.Tasks.Task SaleTransactions() "CustomerEmailAddress", "ContractDescription", "ProductName"}); - table107.AddRow(new string[] { + table116.AddRow(new string[] { "Today", "18", "Sale", @@ -1497,15 +1497,15 @@ public async System.Threading.Tasks.Task SaleTransactions() "Safaricom Contract", "InvalidProduct"}); #line 252 - await testRunner.WhenAsync("I perform the following transactions", ((string)(null)), table107, "When "); + await testRunner.WhenAsync("I perform the following transactions", ((string)(null)), table116, "When "); #line hidden - Reqnroll.Table table108 = new Reqnroll.Table(new string[] { + Reqnroll.Table table117 = new Reqnroll.Table(new string[] { "EstateName", "MerchantName", "TransactionNumber", "ResponseCode", "ResponseMessage"}); - table108.AddRow(new string[] { + table117.AddRow(new string[] { "Test Estate 1", "Test Merchant 1", "18", @@ -1513,9 +1513,9 @@ public async System.Threading.Tasks.Task SaleTransactions() "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)), table108, "Then "); + await testRunner.ThenAsync("transaction response should contain the following information", ((string)(null)), table117, "Then "); #line hidden - Reqnroll.Table table109 = new Reqnroll.Table(new string[] { + Reqnroll.Table table118 = new Reqnroll.Table(new string[] { "DateTime", "TransactionNumber", "TransactionType", @@ -1529,7 +1529,7 @@ public async System.Threading.Tasks.Task SaleTransactions() "CustomerEmailAddress", "ContractDescription", "ProductName"}); - table109.AddRow(new string[] { + table118.AddRow(new string[] { "Today", "19", "Sale", @@ -1544,15 +1544,15 @@ public async System.Threading.Tasks.Task SaleTransactions() "Safaricom Contract", "Variable Topup"}); #line 260 - await testRunner.WhenAsync("I perform the following transactions", ((string)(null)), table109, "When "); + await testRunner.WhenAsync("I perform the following transactions", ((string)(null)), table118, "When "); #line hidden - Reqnroll.Table table110 = new Reqnroll.Table(new string[] { + Reqnroll.Table table119 = new Reqnroll.Table(new string[] { "EstateName", "MerchantName", "TransactionNumber", "ResponseCode", "ResponseMessage"}); - table110.AddRow(new string[] { + table119.AddRow(new string[] { "Test Estate 1", "Test Merchant 4", "19", @@ -1560,7 +1560,7 @@ public async System.Threading.Tasks.Task SaleTransactions() "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)), table110, "Then "); + await testRunner.ThenAsync("transaction response should contain the following information", ((string)(null)), table119, "Then "); #line hidden } await this.ScenarioCleanupAsync(); diff --git a/TransactionProcessor.IntegrationTests/Features/Settlement.feature.cs b/TransactionProcessor.IntegrationTests/Features/Settlement.feature.cs index 6b432020..42f00781 100644 --- a/TransactionProcessor.IntegrationTests/Features/Settlement.feature.cs +++ b/TransactionProcessor.IntegrationTests/Features/Settlement.feature.cs @@ -81,128 +81,128 @@ public virtual async System.Threading.Tasks.Task FeatureBackgroundAsync() { #line 4 #line hidden - Reqnroll.Table table111 = new Reqnroll.Table(new string[] { + Reqnroll.Table table120 = new Reqnroll.Table(new string[] { "Name", "DisplayName", "Description"}); - table111.AddRow(new string[] { + table120.AddRow(new string[] { "estateManagement", "Estate Managememt REST Scope", "A scope for Estate Managememt REST"}); - table111.AddRow(new string[] { + table120.AddRow(new string[] { "transactionProcessor", "Transaction Processor REST Scope", "A scope for Transaction Processor REST"}); - table111.AddRow(new string[] { + table120.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)), table111, "Given "); + await testRunner.GivenAsync("I create the following api scopes", ((string)(null)), table120, "Given "); #line hidden - Reqnroll.Table table112 = new Reqnroll.Table(new string[] { + Reqnroll.Table table121 = new Reqnroll.Table(new string[] { "Name", "DisplayName", "Secret", "Scopes", "UserClaims"}); - table112.AddRow(new string[] { + table121.AddRow(new string[] { "estateManagement", "Estate Managememt REST", "Secret1", "estateManagement", "MerchantId, EstateId, role"}); - table112.AddRow(new string[] { + table121.AddRow(new string[] { "transactionProcessor", "Transaction Processor REST", "Secret1", "transactionProcessor", ""}); - table112.AddRow(new string[] { + table121.AddRow(new string[] { "voucherManagement", "Voucher Management REST", "Secret1", "voucherManagement", ""}); #line 12 - await testRunner.GivenAsync("the following api resources exist", ((string)(null)), table112, "Given "); + await testRunner.GivenAsync("the following api resources exist", ((string)(null)), table121, "Given "); #line hidden - Reqnroll.Table table113 = new Reqnroll.Table(new string[] { + Reqnroll.Table table122 = new Reqnroll.Table(new string[] { "ClientId", "ClientName", "Secret", "Scopes", "GrantTypes"}); - table113.AddRow(new string[] { + table122.AddRow(new string[] { "serviceClient", "Service Client", "Secret1", "estateManagement,transactionProcessor,voucherManagement", "client_credentials"}); #line 18 - await testRunner.GivenAsync("the following clients exist", ((string)(null)), table113, "Given "); + await testRunner.GivenAsync("the following clients exist", ((string)(null)), table122, "Given "); #line hidden - Reqnroll.Table table114 = new Reqnroll.Table(new string[] { + Reqnroll.Table table123 = new Reqnroll.Table(new string[] { "ClientId"}); - table114.AddRow(new string[] { + table123.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)), table114, "Given "); + "s", ((string)(null)), table123, "Given "); #line hidden - Reqnroll.Table table115 = new Reqnroll.Table(new string[] { + Reqnroll.Table table124 = new Reqnroll.Table(new string[] { "EstateName"}); - table115.AddRow(new string[] { + table124.AddRow(new string[] { "Test Estate 1"}); #line 26 - await testRunner.GivenAsync("I have created the following estates", ((string)(null)), table115, "Given "); + await testRunner.GivenAsync("I have created the following estates", ((string)(null)), table124, "Given "); #line hidden - Reqnroll.Table table116 = new Reqnroll.Table(new string[] { + Reqnroll.Table table125 = new Reqnroll.Table(new string[] { "EstateName", "OperatorName", "RequireCustomMerchantNumber", "RequireCustomTerminalNumber"}); - table116.AddRow(new string[] { + table125.AddRow(new string[] { "Test Estate 1", "Safaricom", "True", "True"}); - table116.AddRow(new string[] { + table125.AddRow(new string[] { "Test Estate 1", "Voucher", "True", "True"}); #line 30 - await testRunner.GivenAsync("I have created the following operators", ((string)(null)), table116, "Given "); + await testRunner.GivenAsync("I have created the following operators", ((string)(null)), table125, "Given "); #line hidden - Reqnroll.Table table117 = new Reqnroll.Table(new string[] { + Reqnroll.Table table126 = new Reqnroll.Table(new string[] { "EstateName", "OperatorName"}); - table117.AddRow(new string[] { + table126.AddRow(new string[] { "Test Estate 1", "Safaricom"}); - table117.AddRow(new string[] { + table126.AddRow(new string[] { "Test Estate 1", "Voucher"}); #line 35 - await testRunner.AndAsync("I have assigned the following operators to the estates", ((string)(null)), table117, "And "); + await testRunner.AndAsync("I have assigned the following operators to the estates", ((string)(null)), table126, "And "); #line hidden - Reqnroll.Table table118 = new Reqnroll.Table(new string[] { + Reqnroll.Table table127 = new Reqnroll.Table(new string[] { "EstateName", "OperatorName", "ContractDescription"}); - table118.AddRow(new string[] { + table127.AddRow(new string[] { "Test Estate 1", "Safaricom", "Safaricom Contract"}); - table118.AddRow(new string[] { + table127.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)), table118, "Given "); + await testRunner.GivenAsync("I create a contract with the following values", ((string)(null)), table127, "Given "); #line hidden - Reqnroll.Table table119 = new Reqnroll.Table(new string[] { + Reqnroll.Table table128 = new Reqnroll.Table(new string[] { "EstateName", "OperatorName", "ContractDescription", @@ -210,7 +210,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "DisplayText", "Value", "ProductType"}); - table119.AddRow(new string[] { + table128.AddRow(new string[] { "Test Estate 1", "Safaricom", "Safaricom Contract", @@ -218,7 +218,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "Custom", "", "MobileTopup"}); - table119.AddRow(new string[] { + table128.AddRow(new string[] { "Test Estate 1", "Voucher", "Hospital 1 Contract", @@ -227,9 +227,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)), table119, "When "); + await testRunner.WhenAsync("I create the following Products", ((string)(null)), table128, "When "); #line hidden - Reqnroll.Table table120 = new Reqnroll.Table(new string[] { + Reqnroll.Table table129 = new Reqnroll.Table(new string[] { "EstateName", "OperatorName", "ContractDescription", @@ -237,7 +237,7 @@ await testRunner.GivenAsync("I have a token to access the estate management and "CalculationType", "FeeDescription", "Value"}); - table120.AddRow(new string[] { + table129.AddRow(new string[] { "Test Estate 1", "Safaricom", "Safaricom Contract", @@ -246,7 +246,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)), table120, "When "); + await testRunner.WhenAsync("I add the following Transaction Fees", ((string)(null)), table129, "When "); #line hidden } @@ -270,7 +270,7 @@ public async System.Threading.Tasks.Task GetPendingSettlement() #line 4 await this.FeatureBackgroundAsync(); #line hidden - Reqnroll.Table table121 = new Reqnroll.Table(new string[] { + Reqnroll.Table table130 = new Reqnroll.Table(new string[] { "MerchantName", "AddressLine1", "Town", @@ -280,7 +280,7 @@ public async System.Threading.Tasks.Task GetPendingSettlement() "EmailAddress", "EstateName", "SettlementSchedule"}); - table121.AddRow(new string[] { + table130.AddRow(new string[] { "Test Merchant 1", "Address Line 1", "TestTown", @@ -290,7 +290,7 @@ public async System.Threading.Tasks.Task GetPendingSettlement() "testcontact1@merchant1.co.uk", "Test Estate 1", "Immediate"}); - table121.AddRow(new string[] { + table130.AddRow(new string[] { "Test Merchant 2", "Address Line 1", "TestTown", @@ -300,7 +300,7 @@ public async System.Threading.Tasks.Task GetPendingSettlement() "testcontact2@merchant2.co.uk", "Test Estate 1", "Weekly"}); - table121.AddRow(new string[] { + table130.AddRow(new string[] { "Test Merchant 3", "Address Line 1", "TestTown", @@ -311,131 +311,131 @@ public async System.Threading.Tasks.Task GetPendingSettlement() "Test Estate 1", "Monthly"}); #line 55 - await testRunner.GivenAsync("I create the following merchants", ((string)(null)), table121, "Given "); + await testRunner.GivenAsync("I create the following merchants", ((string)(null)), table130, "Given "); #line hidden - Reqnroll.Table table122 = new Reqnroll.Table(new string[] { + Reqnroll.Table table131 = new Reqnroll.Table(new string[] { "OperatorName", "MerchantName", "MerchantNumber", "TerminalNumber", "EstateName"}); - table122.AddRow(new string[] { + table131.AddRow(new string[] { "Safaricom", "Test Merchant 1", "00000001", "10000001", "Test Estate 1"}); - table122.AddRow(new string[] { + table131.AddRow(new string[] { "Voucher", "Test Merchant 1", "00000001", "10000001", "Test Estate 1"}); - table122.AddRow(new string[] { + table131.AddRow(new string[] { "Safaricom", "Test Merchant 2", "00000002", "10000002", "Test Estate 1"}); - table122.AddRow(new string[] { + table131.AddRow(new string[] { "Voucher", "Test Merchant 2", "00000002", "10000002", "Test Estate 1"}); - table122.AddRow(new string[] { + table131.AddRow(new string[] { "Safaricom", "Test Merchant 3", "00000003", "10000003", "Test Estate 1"}); - table122.AddRow(new string[] { + table131.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)), table122, "Given "); + await testRunner.GivenAsync("I have assigned the following operator to the merchants", ((string)(null)), table131, "Given "); #line hidden - Reqnroll.Table table123 = new Reqnroll.Table(new string[] { + Reqnroll.Table table132 = new Reqnroll.Table(new string[] { "DeviceIdentifier", "MerchantName", "EstateName"}); - table123.AddRow(new string[] { + table132.AddRow(new string[] { "123456780", "Test Merchant 1", "Test Estate 1"}); - table123.AddRow(new string[] { + table132.AddRow(new string[] { "123456781", "Test Merchant 2", "Test Estate 1"}); - table123.AddRow(new string[] { + table132.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)), table123, "Given "); + await testRunner.GivenAsync("I have assigned the following devices to the merchants", ((string)(null)), table132, "Given "); #line hidden - Reqnroll.Table table124 = new Reqnroll.Table(new string[] { + Reqnroll.Table table133 = new Reqnroll.Table(new string[] { "Reference", "Amount", "DateTime", "MerchantName", "EstateName"}); - table124.AddRow(new string[] { + table133.AddRow(new string[] { "Deposit1", "210.00", "Today", "Test Merchant 1", "Test Estate 1"}); - table124.AddRow(new string[] { + table133.AddRow(new string[] { "Deposit1", "110.00", "Today", "Test Merchant 2", "Test Estate 1"}); - table124.AddRow(new string[] { + table133.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)), table124, "Given "); + await testRunner.GivenAsync("I make the following manual merchant deposits", ((string)(null)), table133, "Given "); #line hidden - Reqnroll.Table table125 = new Reqnroll.Table(new string[] { + Reqnroll.Table table134 = new Reqnroll.Table(new string[] { "EstateName", "MerchantName", "ContractDescription"}); - table125.AddRow(new string[] { + table134.AddRow(new string[] { "Test Estate 1", "Test Merchant 1", "Safaricom Contract"}); - table125.AddRow(new string[] { + table134.AddRow(new string[] { "Test Estate 1", "Test Merchant 1", "Hospital 1 Contract"}); - table125.AddRow(new string[] { + table134.AddRow(new string[] { "Test Estate 1", "Test Merchant 2", "Safaricom Contract"}); - table125.AddRow(new string[] { + table134.AddRow(new string[] { "Test Estate 1", "Test Merchant 2", "Hospital 1 Contract"}); - table125.AddRow(new string[] { + table134.AddRow(new string[] { "Test Estate 1", "Test Merchant 3", "Safaricom Contract"}); - table125.AddRow(new string[] { + table134.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)), table125, "When "); + await testRunner.WhenAsync("I add the following contracts to the following merchants", ((string)(null)), table134, "When "); #line hidden - Reqnroll.Table table126 = new Reqnroll.Table(new string[] { + Reqnroll.Table table135 = new Reqnroll.Table(new string[] { "DateTime", "TransactionNumber", "TransactionType", @@ -451,7 +451,7 @@ public async System.Threading.Tasks.Task GetPendingSettlement() "ProductName", "RecipientEmail", "RecipientMobile"}); - table126.AddRow(new string[] { + table135.AddRow(new string[] { "2022-01-06", "1", "Sale", @@ -467,7 +467,7 @@ public async System.Threading.Tasks.Task GetPendingSettlement() "Variable Topup", "", ""}); - table126.AddRow(new string[] { + table135.AddRow(new string[] { "2022-01-06", "2", "Sale", @@ -483,7 +483,7 @@ public async System.Threading.Tasks.Task GetPendingSettlement() "Variable Topup", "", ""}); - table126.AddRow(new string[] { + table135.AddRow(new string[] { "2022-01-06", "3", "Sale", @@ -499,7 +499,7 @@ public async System.Threading.Tasks.Task GetPendingSettlement() "Variable Topup", "", ""}); - table126.AddRow(new string[] { + table135.AddRow(new string[] { "2022-01-06", "4", "Sale", @@ -515,7 +515,7 @@ public async System.Threading.Tasks.Task GetPendingSettlement() "Variable Topup", "", ""}); - table126.AddRow(new string[] { + table135.AddRow(new string[] { "2022-01-06", "5", "Sale", @@ -531,7 +531,7 @@ public async System.Threading.Tasks.Task GetPendingSettlement() "10 KES", "test@recipient.co.uk", ""}); - table126.AddRow(new string[] { + table135.AddRow(new string[] { "2022-01-06", "6", "Sale", @@ -547,7 +547,7 @@ public async System.Threading.Tasks.Task GetPendingSettlement() "10 KES", "", "123456789"}); - table126.AddRow(new string[] { + table135.AddRow(new string[] { "2022-01-06", "7", "Sale", @@ -563,7 +563,7 @@ public async System.Threading.Tasks.Task GetPendingSettlement() "10 KES", "test@recipient.co.uk", ""}); - table126.AddRow(new string[] { + table135.AddRow(new string[] { "2022-01-06", "8", "Sale", @@ -580,95 +580,95 @@ public async System.Threading.Tasks.Task GetPendingSettlement() "test@recipient.co.uk", ""}); #line 91 - await testRunner.WhenAsync("I perform the following transactions", ((string)(null)), table126, "When "); + await testRunner.WhenAsync("I perform the following transactions", ((string)(null)), table135, "When "); #line hidden - Reqnroll.Table table127 = new Reqnroll.Table(new string[] { + Reqnroll.Table table136 = new Reqnroll.Table(new string[] { "EstateName", "MerchantName", "TransactionNumber", "ResponseCode", "ResponseMessage"}); - table127.AddRow(new string[] { + table136.AddRow(new string[] { "Test Estate 1", "Test Merchant 1", "1", "0000", "SUCCESS"}); - table127.AddRow(new string[] { + table136.AddRow(new string[] { "Test Estate 1", "Test Merchant 2", "2", "0000", "SUCCESS"}); - table127.AddRow(new string[] { + table136.AddRow(new string[] { "Test Estate 1", "Test Merchant 3", "3", "0000", "SUCCESS"}); - table127.AddRow(new string[] { + table136.AddRow(new string[] { "Test Estate 1", "Test Merchant 1", "4", "0000", "SUCCESS"}); - table127.AddRow(new string[] { + table136.AddRow(new string[] { "Test Estate 1", "Test Merchant 1", "5", "0000", "SUCCESS"}); - table127.AddRow(new string[] { + table136.AddRow(new string[] { "Test Estate 1", "Test Merchant 2", "6", "0000", "SUCCESS"}); - table127.AddRow(new string[] { + table136.AddRow(new string[] { "Test Estate 1", "Test Merchant 3", "7", "0000", "SUCCESS"}); - table127.AddRow(new string[] { + table136.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)), table127, "Then "); + await testRunner.ThenAsync("transaction response should contain the following information", ((string)(null)), table136, "Then "); #line hidden - Reqnroll.Table table128 = new Reqnroll.Table(new string[] { + Reqnroll.Table table137 = new Reqnroll.Table(new string[] { "SettlementDate", "EstateName", "MerchantName", "NumberOfFees"}); - table128.AddRow(new string[] { + table137.AddRow(new string[] { "2022-01-13", "Test Estate 1", "Test Merchant 2", "1"}); - table128.AddRow(new string[] { + table137.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)), table128, "When "); + await testRunner.WhenAsync("I get the pending settlements the following information should be returned", ((string)(null)), table137, "When "); #line hidden - Reqnroll.Table table129 = new Reqnroll.Table(new string[] { + Reqnroll.Table table138 = new Reqnroll.Table(new string[] { "SettlementDate", "EstateName", "MerchantName", "NumberOfFees"}); - table129.AddRow(new string[] { + table138.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)), table129, "When "); + await testRunner.WhenAsync("I get the completed settlements the following information should be returned", ((string)(null)), table138, "When "); #line hidden } await this.ScenarioCleanupAsync(); @@ -696,7 +696,7 @@ public async System.Threading.Tasks.Task ProcessSettlement() #line 4 await this.FeatureBackgroundAsync(); #line hidden - Reqnroll.Table table130 = new Reqnroll.Table(new string[] { + Reqnroll.Table table139 = new Reqnroll.Table(new string[] { "MerchantName", "AddressLine1", "Town", @@ -706,7 +706,7 @@ public async System.Threading.Tasks.Task ProcessSettlement() "EmailAddress", "EstateName", "SettlementSchedule"}); - table130.AddRow(new string[] { + table139.AddRow(new string[] { "Test Merchant 1", "Address Line 1", "TestTown", @@ -716,7 +716,7 @@ public async System.Threading.Tasks.Task ProcessSettlement() "testcontact1@merchant1.co.uk", "Test Estate 1", "Immediate"}); - table130.AddRow(new string[] { + table139.AddRow(new string[] { "Test Merchant 2", "Address Line 1", "TestTown", @@ -727,101 +727,101 @@ public async System.Threading.Tasks.Task ProcessSettlement() "Test Estate 1", "Weekly"}); #line 124 - await testRunner.GivenAsync("I create the following merchants", ((string)(null)), table130, "Given "); + await testRunner.GivenAsync("I create the following merchants", ((string)(null)), table139, "Given "); #line hidden - Reqnroll.Table table131 = new Reqnroll.Table(new string[] { + Reqnroll.Table table140 = new Reqnroll.Table(new string[] { "OperatorName", "MerchantName", "MerchantNumber", "TerminalNumber", "EstateName"}); - table131.AddRow(new string[] { + table140.AddRow(new string[] { "Safaricom", "Test Merchant 1", "00000001", "10000001", "Test Estate 1"}); - table131.AddRow(new string[] { + table140.AddRow(new string[] { "Voucher", "Test Merchant 1", "00000001", "10000001", "Test Estate 1"}); - table131.AddRow(new string[] { + table140.AddRow(new string[] { "Safaricom", "Test Merchant 2", "00000002", "10000002", "Test Estate 1"}); - table131.AddRow(new string[] { + table140.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)), table131, "Given "); + await testRunner.GivenAsync("I have assigned the following operator to the merchants", ((string)(null)), table140, "Given "); #line hidden - Reqnroll.Table table132 = new Reqnroll.Table(new string[] { + Reqnroll.Table table141 = new Reqnroll.Table(new string[] { "DeviceIdentifier", "MerchantName", "EstateName"}); - table132.AddRow(new string[] { + table141.AddRow(new string[] { "123456780", "Test Merchant 1", "Test Estate 1"}); - table132.AddRow(new string[] { + table141.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)), table132, "Given "); + await testRunner.GivenAsync("I have assigned the following devices to the merchants", ((string)(null)), table141, "Given "); #line hidden - Reqnroll.Table table133 = new Reqnroll.Table(new string[] { + Reqnroll.Table table142 = new Reqnroll.Table(new string[] { "EstateName", "MerchantName", "ContractDescription"}); - table133.AddRow(new string[] { + table142.AddRow(new string[] { "Test Estate 1", "Test Merchant 1", "Safaricom Contract"}); - table133.AddRow(new string[] { + table142.AddRow(new string[] { "Test Estate 1", "Test Merchant 1", "Hospital 1 Contract"}); - table133.AddRow(new string[] { + table142.AddRow(new string[] { "Test Estate 1", "Test Merchant 2", "Safaricom Contract"}); - table133.AddRow(new string[] { + table142.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)), table133, "When "); + await testRunner.WhenAsync("I add the following contracts to the following merchants", ((string)(null)), table142, "When "); #line hidden - Reqnroll.Table table134 = new Reqnroll.Table(new string[] { + Reqnroll.Table table143 = new Reqnroll.Table(new string[] { "Reference", "Amount", "DateTime", "MerchantName", "EstateName"}); - table134.AddRow(new string[] { + table143.AddRow(new string[] { "Deposit1", "210.00", "Today", "Test Merchant 1", "Test Estate 1"}); - table134.AddRow(new string[] { + table143.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)), table134, "Given "); + await testRunner.GivenAsync("I make the following manual merchant deposits", ((string)(null)), table143, "Given "); #line hidden - Reqnroll.Table table135 = new Reqnroll.Table(new string[] { + Reqnroll.Table table144 = new Reqnroll.Table(new string[] { "DateTime", "TransactionNumber", "TransactionType", @@ -837,7 +837,7 @@ public async System.Threading.Tasks.Task ProcessSettlement() "ProductName", "RecipientEmail", "RecipientMobile"}); - table135.AddRow(new string[] { + table144.AddRow(new string[] { "2022-01-06", "1", "Sale", @@ -853,7 +853,7 @@ public async System.Threading.Tasks.Task ProcessSettlement() "Variable Topup", "", ""}); - table135.AddRow(new string[] { + table144.AddRow(new string[] { "2022-01-06", "2", "Sale", @@ -869,7 +869,7 @@ public async System.Threading.Tasks.Task ProcessSettlement() "Variable Topup", "", ""}); - table135.AddRow(new string[] { + table144.AddRow(new string[] { "2022-01-06", "4", "Sale", @@ -885,7 +885,7 @@ public async System.Threading.Tasks.Task ProcessSettlement() "Variable Topup", "", ""}); - table135.AddRow(new string[] { + table144.AddRow(new string[] { "2022-01-06", "5", "Sale", @@ -901,7 +901,7 @@ public async System.Threading.Tasks.Task ProcessSettlement() "10 KES", "test@recipient.co.uk", ""}); - table135.AddRow(new string[] { + table144.AddRow(new string[] { "2022-01-06", "6", "Sale", @@ -918,59 +918,59 @@ public async System.Threading.Tasks.Task ProcessSettlement() "", "123456789"}); #line 153 - await testRunner.WhenAsync("I perform the following transactions", ((string)(null)), table135, "When "); + await testRunner.WhenAsync("I perform the following transactions", ((string)(null)), table144, "When "); #line hidden - Reqnroll.Table table136 = new Reqnroll.Table(new string[] { + Reqnroll.Table table145 = new Reqnroll.Table(new string[] { "EstateName", "MerchantName", "TransactionNumber", "ResponseCode", "ResponseMessage"}); - table136.AddRow(new string[] { + table145.AddRow(new string[] { "Test Estate 1", "Test Merchant 1", "1", "0000", "SUCCESS"}); - table136.AddRow(new string[] { + table145.AddRow(new string[] { "Test Estate 1", "Test Merchant 2", "2", "0000", "SUCCESS"}); - table136.AddRow(new string[] { + table145.AddRow(new string[] { "Test Estate 1", "Test Merchant 1", "4", "0000", "SUCCESS"}); - table136.AddRow(new string[] { + table145.AddRow(new string[] { "Test Estate 1", "Test Merchant 1", "5", "0000", "SUCCESS"}); - table136.AddRow(new string[] { + table145.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)), table136, "Then "); + await testRunner.ThenAsync("transaction response should contain the following information", ((string)(null)), table145, "Then "); #line hidden - Reqnroll.Table table137 = new Reqnroll.Table(new string[] { + Reqnroll.Table table146 = new Reqnroll.Table(new string[] { "SettlementDate", "EstateName", "MerchantName", "NumberOfFees"}); - table137.AddRow(new string[] { + table146.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)), table137, "When "); + await testRunner.WhenAsync("I get the pending settlements the following information should be returned", ((string)(null)), table146, "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/Shared/SharedSteps.cs b/TransactionProcessor.IntegrationTests/Shared/SharedSteps.cs index 877890e8..ae2b8981 100644 --- a/TransactionProcessor.IntegrationTests/Shared/SharedSteps.cs +++ b/TransactionProcessor.IntegrationTests/Shared/SharedSteps.cs @@ -2,7 +2,9 @@ using System.Collections.Generic; using TransactionProcessor.DataTransferObjects.Requests.Contract; using TransactionProcessor.DataTransferObjects.Requests.Merchant; +using TransactionProcessor.DataTransferObjects.Requests.Operator; using TransactionProcessor.DataTransferObjects.Responses.Contract; +using TransactionProcessor.DataTransferObjects.Responses.Operator; namespace TransactionProcessor.IntegrationTests.Shared { @@ -438,5 +440,26 @@ await this.TransactionProcessorSteps.WhenIRemoveTheOperatorFromEstateTheOperator estateName, operatorName); } + + [When("I update the operators with the following details")] + public async Task WhenIUpdateTheOperatorsWithTheFollowingDetails(DataTable table) + { + List<(EstateDetails, Guid, UpdateOperatorRequest)> requests = table.Rows.ToUpdateOperatorRequests(this.TestingContext.Estates); + + List verifiedOperators = await this.TransactionProcessorSteps.WhenIUpdateTheOperatorsWithTheFollowingDetails(this.TestingContext.AccessToken, requests); + + foreach (OperatorResponse verifiedOperator in verifiedOperators) + { + this.TestingContext.Logger.LogInformation($"Operator {verifiedOperator.Name} updated"); + } + } + + [When("I get all the operators the following details are returned")] + public async Task WhenIGetAllTheOperatorsTheFollowingDetailsAreReturned(DataTable dataTable) + { + List<(EstateDetails, Guid, OperatorResponse)> expectedOperatorResponses = dataTable.Rows.ToOperatorResponses(this.TestingContext.Estates); + + await this.TransactionProcessorSteps.WhenIGetAllTheOperatorsTheFollowingDetailsAreReturned(this.TestingContext.AccessToken, expectedOperatorResponses); + } } } diff --git a/TransactionProcessor.Models/Estate.cs b/TransactionProcessor.Models/Estate/Estate.cs similarity index 60% rename from TransactionProcessor.Models/Estate.cs rename to TransactionProcessor.Models/Estate/Estate.cs index e1bbaace..fa8ff41c 100644 --- a/TransactionProcessor.Models/Estate.cs +++ b/TransactionProcessor.Models/Estate/Estate.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; -namespace TransactionProcessor.Models +namespace TransactionProcessor.Models.Estate { /// /// @@ -12,15 +12,15 @@ public class Estate { #region Properties - public Int32 EstateReportingId { get; set; } + public int EstateReportingId { get; set; } public Guid EstateId { get; set; } - public String Name { get; set; } + public string Name { get; set; } - public String Reference { get; set; } + public string Reference { get; set; } - public List Operators { get; set; } + public List Operators { get; set; } public List SecurityUsers { get; set; } diff --git a/TransactionProcessor.Models/Estate/Operator.cs b/TransactionProcessor.Models/Estate/Operator.cs new file mode 100644 index 00000000..13181554 --- /dev/null +++ b/TransactionProcessor.Models/Estate/Operator.cs @@ -0,0 +1,10 @@ +using System; + +namespace TransactionProcessor.Models.Estate +{ + public class Operator() { + public Guid OperatorId { get; set; } + public String Name { get; set; } + public Boolean IsDeleted { get; set; } + } +} \ No newline at end of file diff --git a/TransactionProcessor.Models/Estate/SecurityUser.cs b/TransactionProcessor.Models/Estate/SecurityUser.cs new file mode 100644 index 00000000..58a0872d --- /dev/null +++ b/TransactionProcessor.Models/Estate/SecurityUser.cs @@ -0,0 +1,9 @@ +using System; + +namespace TransactionProcessor.Models.Estate +{ + public class SecurityUser() { + public string EmailAddress { get; set; } + public Guid SecurityUserId { get; set; } + } +} diff --git a/TransactionProcessor.Models/Operator.cs b/TransactionProcessor.Models/Operator.cs deleted file mode 100644 index e1cd7398..00000000 --- a/TransactionProcessor.Models/Operator.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; -using System.Diagnostics.CodeAnalysis; - -namespace TransactionProcessor.Models -{ - [ExcludeFromCodeCoverage] - public class EstateOperator - { - #region Properties - - /// - /// Gets the operator identifier. - /// - /// - /// The operator identifier. - /// - public Guid OperatorId { get; set; } - public Boolean IsDeleted { get; set; } - public String Name{ get; set; } - - #endregion - } -} diff --git a/TransactionProcessor.Models/Operator/Operator.cs b/TransactionProcessor.Models/Operator/Operator.cs new file mode 100644 index 00000000..11b60e0d --- /dev/null +++ b/TransactionProcessor.Models/Operator/Operator.cs @@ -0,0 +1,10 @@ +using System; + +namespace TransactionProcessor.Models.Operator { + public record Operator() { + public Guid OperatorId { get; set; } + public String Name { get; set; } + public Boolean RequireCustomMerchantNumber { get; set; } + public Boolean RequireCustomTerminalNumber { get; set; } + } +} diff --git a/TransactionProcessor.Models/SecurityUser.cs b/TransactionProcessor.Models/SecurityUser.cs deleted file mode 100644 index d131f37d..00000000 --- a/TransactionProcessor.Models/SecurityUser.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System; -using System.Diagnostics.CodeAnalysis; - -namespace TransactionProcessor.Models -{ - [ExcludeFromCodeCoverage] - public class SecurityUser - { - #region Properties - - /// - /// Gets or sets the email address. - /// - /// - /// The email address. - /// - public String EmailAddress { get; set; } - - /// - /// Gets or sets the security user identifier. - /// - /// - /// The security user identifier. - /// - public Guid SecurityUserId { get; set; } - - #endregion - } -} \ No newline at end of file diff --git a/TransactionProcessor.Operator.DomainEvents/OperatorDomainEvents.cs b/TransactionProcessor.Operator.DomainEvents/OperatorDomainEvents.cs new file mode 100644 index 00000000..8bf367d8 --- /dev/null +++ b/TransactionProcessor.Operator.DomainEvents/OperatorDomainEvents.cs @@ -0,0 +1,27 @@ +using System.Diagnostics.CodeAnalysis; +using Shared.DomainDrivenDesign.EventSourcing; + +namespace TransactionProcessor.Operator.DomainEvents +{ + [ExcludeFromCodeCoverage] + public record OperatorCreatedEvent(Guid OperatorId, + Guid EstateId, + String Name, + Boolean RequireCustomMerchantNumber, + Boolean RequireCustomTerminalNumber) : DomainEvent(OperatorId, Guid.NewGuid()); + + [ExcludeFromCodeCoverage] + public record OperatorNameUpdatedEvent(Guid OperatorId, + Guid EstateId, + String Name) : DomainEvent(OperatorId, Guid.NewGuid()); + + [ExcludeFromCodeCoverage] + public record OperatorRequireCustomMerchantNumberChangedEvent(Guid OperatorId, + Guid EstateId, + Boolean RequireCustomMerchantNumber) : DomainEvent(OperatorId, Guid.NewGuid()); + + [ExcludeFromCodeCoverage] + public record OperatorRequireCustomTerminalNumberChangedEvent(Guid OperatorId, + Guid EstateId, + Boolean RequireCustomTerminalNumber) : DomainEvent(OperatorId, Guid.NewGuid()); +} diff --git a/TransactionProcessor.Operator.DomainEvents/TransactionProcessor.Operator.DomainEvents.csproj b/TransactionProcessor.Operator.DomainEvents/TransactionProcessor.Operator.DomainEvents.csproj new file mode 100644 index 00000000..ab0e3f83 --- /dev/null +++ b/TransactionProcessor.Operator.DomainEvents/TransactionProcessor.Operator.DomainEvents.csproj @@ -0,0 +1,13 @@ + + + + net8.0 + enable + enable + + + + + + + diff --git a/TransactionProcessor.Repository/ITransactionProcessorReadModelRepository.cs b/TransactionProcessor.Repository/ITransactionProcessorReadModelRepository.cs index 47ede255..4ec60d2e 100644 --- a/TransactionProcessor.Repository/ITransactionProcessorReadModelRepository.cs +++ b/TransactionProcessor.Repository/ITransactionProcessorReadModelRepository.cs @@ -2,6 +2,7 @@ using SimpleResults; using System; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -18,21 +19,22 @@ using Shared.Results; using Microsoft.EntityFrameworkCore; using System.Reflection; +using TransactionProcessor.Operator.DomainEvents; namespace TransactionProcessor.Repository { public interface ITransactionProcessorReadModelRepository { - //Task UpdateOperator(OperatorNameUpdatedEvent domainEvent, - // CancellationToken cancellationToken); + Task UpdateOperator(OperatorNameUpdatedEvent domainEvent, + CancellationToken cancellationToken); - //Task UpdateOperator(OperatorRequireCustomMerchantNumberChangedEvent domainEvent, - // CancellationToken cancellationToken); + Task UpdateOperator(OperatorRequireCustomMerchantNumberChangedEvent domainEvent, + CancellationToken cancellationToken); - //Task UpdateOperator(OperatorRequireCustomTerminalNumberChangedEvent domainEvent, - // CancellationToken cancellationToken); + Task UpdateOperator(OperatorRequireCustomTerminalNumberChangedEvent domainEvent, + CancellationToken cancellationToken); - //Task AddOperator(OperatorCreatedEvent domainEvent, - // CancellationToken cancellationToken); + Task AddOperator(OperatorCreatedEvent domainEvent, + CancellationToken cancellationToken); //Task AddContract(ContractCreatedEvent domainEvent, // CancellationToken cancellationToken); @@ -259,10 +261,14 @@ Task UpdateVoucherRedemptionDetails(VoucherFullyRedeemedEvent domainEven //Task UpdateMerchantContact(MerchantContactPhoneNumberUpdatedEvent domainEvent, // CancellationToken cancellationToken); - Task> GetEstate(Guid estateId, + Task> GetEstate(Guid estateId, CancellationToken cancellationToken); + + Task>> GetOperators(Guid estateId, + CancellationToken cancellationToken); } + [ExcludeFromCodeCoverage] public class TransactionProcessorReadModelRepository : ITransactionProcessorReadModelRepository { private readonly Shared.EntityFramework.IDbContextFactory DbContextFactory; @@ -273,7 +279,7 @@ public TransactionProcessorReadModelRepository(Shared.EntityFramework.IDbContext } - public async Task> GetEstate(Guid estateId, + public async Task> GetEstate(Guid estateId, CancellationToken cancellationToken) { EstateManagementGenericContext context = await this.DbContextFactory.GetContext(estateId, ConnectionStringIdentifier, cancellationToken); @@ -286,7 +292,7 @@ public TransactionProcessorReadModelRepository(Shared.EntityFramework.IDbContext } List estateSecurityUsers = await context.EstateSecurityUsers.Where(esu => esu.EstateId == estate.EstateId).ToListAsync(cancellationToken); - List operators = await context.Operators.Where(eo => eo.EstateId == estate.EstateId).ToListAsync(cancellationToken); + List operators = await context.Operators.Where(eo => eo.EstateId == estate.EstateId).ToListAsync(cancellationToken); return Result.Success(ModelFactory.ConvertFrom(estate, estateSecurityUsers, operators)); } @@ -887,5 +893,87 @@ public async Task UpdateVoucherRedemptionDetails(VoucherFullyRedeemedEve return await context.SaveChangesAsync(cancellationToken); } + + public async Task>> GetOperators(Guid estateId, CancellationToken cancellationToken) + { + EstateManagementGenericContext context = await this.DbContextFactory.GetContext(estateId, ConnectionStringIdentifier, cancellationToken); + + Database.Entities.Estate estate = await context.Estates.SingleOrDefaultAsync(e => e.EstateId == estateId, cancellationToken: cancellationToken); + List operators = await (from o in context.Operators where o.EstateId == estate.EstateId select o).ToListAsync(cancellationToken); + + List models = new(); + + foreach (Database.Entities.Operator @operator in operators) + { + models.Add(new Models.Operator.Operator + { + OperatorId = @operator.OperatorId, + RequireCustomTerminalNumber = @operator.RequireCustomTerminalNumber, + RequireCustomMerchantNumber = @operator.RequireCustomMerchantNumber, + Name = @operator.Name, + }); + } + + return Result.Success(models); + } + + public async Task UpdateOperator(OperatorNameUpdatedEvent domainEvent, CancellationToken cancellationToken) + { + EstateManagementGenericContext context = await this.GetContextFromDomainEvent(domainEvent, cancellationToken); + + Result operatorResult = await context.LoadOperator(domainEvent, cancellationToken); + if (operatorResult.IsFailed) + return ResultHelpers.CreateFailure(operatorResult); + Database.Entities.Operator @operator = operatorResult.Data; + @operator.Name = domainEvent.Name; + + return await context.SaveChangesAsync(cancellationToken); + } + + public async Task UpdateOperator(OperatorRequireCustomMerchantNumberChangedEvent domainEvent, CancellationToken cancellationToken) + { + EstateManagementGenericContext context = await this.GetContextFromDomainEvent(domainEvent, cancellationToken); + + Result operatorResult = await context.LoadOperator(domainEvent, cancellationToken); + if (operatorResult.IsFailed) + return ResultHelpers.CreateFailure(operatorResult); + Database.Entities.Operator @operator = operatorResult.Data; + + @operator.RequireCustomMerchantNumber = domainEvent.RequireCustomMerchantNumber; + + return await context.SaveChangesAsync(cancellationToken); + } + + public async Task UpdateOperator(OperatorRequireCustomTerminalNumberChangedEvent domainEvent, CancellationToken cancellationToken) + { + EstateManagementGenericContext context = await this.GetContextFromDomainEvent(domainEvent, cancellationToken); + + Result operatorResult = await context.LoadOperator(domainEvent, cancellationToken); + if (operatorResult.IsFailed) + return ResultHelpers.CreateFailure(operatorResult); + Database.Entities.Operator @operator = operatorResult.Data; + + @operator.RequireCustomTerminalNumber = domainEvent.RequireCustomTerminalNumber; + + return await context.SaveChangesAsync(cancellationToken); + } + + public async Task AddOperator(OperatorCreatedEvent domainEvent, CancellationToken cancellationToken) + { + EstateManagementGenericContext context = await this.GetContextFromDomainEvent(domainEvent, cancellationToken); + + Database.Entities.Operator @operator = new Database.Entities.Operator + { + RequireCustomTerminalNumber = domainEvent.RequireCustomTerminalNumber, + OperatorId = domainEvent.OperatorId, + Name = domainEvent.Name, + RequireCustomMerchantNumber = domainEvent.RequireCustomMerchantNumber, + EstateId = domainEvent.EstateId + }; + + await context.Operators.AddAsync(@operator, cancellationToken); + + return await context.SaveChangesAsync(cancellationToken); + } } } diff --git a/TransactionProcessor.Repository/ModelFactory.cs b/TransactionProcessor.Repository/ModelFactory.cs index ea1a120c..338bd40d 100644 --- a/TransactionProcessor.Repository/ModelFactory.cs +++ b/TransactionProcessor.Repository/ModelFactory.cs @@ -1,11 +1,11 @@ -using TransactionProcessor.Models; +using TransactionProcessor.Models.Estate; namespace TransactionProcessor.Repository { - using EstateModel = Models.Estate; + using EstateModel = Models.Estate.Estate; using EstateEntity = Database.Entities.Estate; using EstateSecurityUserEntity = Database.Entities.EstateSecurityUser; - using EstateOperatorModel = Models.EstateOperator; + using EstateOperatorModel = Models.Estate.Operator; using SecurityUserModel = SecurityUser; using OperatorEntity = Database.Entities.Operator; diff --git a/TransactionProcessor.Repository/TransactionProcessor.Repository.csproj b/TransactionProcessor.Repository/TransactionProcessor.Repository.csproj index 2b3ddb4b..766d0d17 100644 --- a/TransactionProcessor.Repository/TransactionProcessor.Repository.csproj +++ b/TransactionProcessor.Repository/TransactionProcessor.Repository.csproj @@ -20,6 +20,7 @@ + diff --git a/TransactionProcessor.Testing/TestData.cs b/TransactionProcessor.Testing/TestData.cs index 1b6d3075..d03091ef 100644 --- a/TransactionProcessor.Testing/TestData.cs +++ b/TransactionProcessor.Testing/TestData.cs @@ -1,5 +1,7 @@ using TransactionProcessor.Aggregates; using TransactionProcessor.Database.Entities; +using TransactionProcessor.DataTransferObjects.Requests.Operator; +using TransactionProcessor.Operator.DomainEvents; namespace TransactionProcessor.Testing { @@ -24,6 +26,8 @@ namespace TransactionProcessor.Testing using CalculationType = Models.CalculationType; using FeeType = Models.FeeType; using EstateManagement.DataTransferObjects.Requests.Estate; + using TransactionProcessor.Models.Estate; + using TransactionProcessor.Estate.DomainEvents; public class TestData { @@ -79,11 +83,19 @@ public class TestData public static String OperatorName2 = "Test Operator Name 2"; public static String CustomerEmailAddress = "testcustomer1@customer.co.uk"; - + public static Boolean RequireCustomMerchantNumber = true; + public static Boolean RequireCustomMerchantNumberFalse = false; + + public static Boolean RequireCustomMerchantNumberTrue = true; + public static Boolean RequireCustomTerminalNumber = true; + public static Boolean RequireCustomTerminalNumberFalse = false; + + public static Boolean RequireCustomTerminalNumberTrue = true; + public static String ResponseCode = "0000"; public static String ResponseMessage = "SUCCESS"; @@ -147,6 +159,8 @@ public class TestData #endregion + public static String EmailAddress = "testuser1@testestate1.co.uk"; + #region Properties /// @@ -1540,8 +1554,8 @@ public static VoucherAggregate GetVoucherAggregateWithRecipientMobile() public static String EstateUserPassword = "123456"; - public static Models.Estate EstateModel => - new Models.Estate + public static Estate EstateModel => + new Models.Estate.Estate() { EstateId = TestData.EstateId, Name = TestData.EstateName, @@ -1549,26 +1563,26 @@ public static VoucherAggregate GetVoucherAggregateWithRecipientMobile() SecurityUsers = null }; - public static Models.Estate EstateModelWithOperators => - new Models.Estate + public static Estate EstateModelWithOperators => + new Models.Estate.Estate() { EstateId = TestData.EstateId, Name = TestData.EstateName, - Operators = new List{ - new EstateOperator{ + Operators = new List{ + new Models.Estate.Operator{ OperatorId = TestData.OperatorId } }, SecurityUsers = null }; - public static Models.Estate EstateModelWithOperatorsAndSecurityUsers => - new Models.Estate + public static Estate EstateModelWithOperatorsAndSecurityUsers => + new Models.Estate.Estate() { EstateId = TestData.EstateId, Name = TestData.EstateName, - Operators = new List{ - new EstateOperator{ + Operators = new List{ + new Models.Estate.Operator{ OperatorId = TestData.OperatorId } }, @@ -1580,8 +1594,8 @@ public static VoucherAggregate GetVoucherAggregateWithRecipientMobile() } }; - public static Models.Estate EstateModelWithSecurityUsers => - new Models.Estate + public static Estate EstateModelWithSecurityUsers => + new Models.Estate.Estate() { EstateId = TestData.EstateId, Name = TestData.EstateName, @@ -1594,6 +1608,23 @@ public static VoucherAggregate GetVoucherAggregateWithRecipientMobile() } }; + public static CreateOperatorRequest CreateOperatorRequest => + new CreateOperatorRequest() + { + OperatorId = TestData.OperatorId, + RequireCustomTerminalNumber = TestData.RequireCustomTerminalNumber, + RequireCustomMerchantNumber = TestData.RequireCustomMerchantNumber, + Name = TestData.OperatorName + }; + + public static UpdateOperatorRequest UpdateOperatorRequest => + new UpdateOperatorRequest() + { + RequireCustomTerminalNumber = TestData.RequireCustomTerminalNumber, + RequireCustomMerchantNumber = TestData.RequireCustomMerchantNumber, + Name = TestData.OperatorName + }; + #endregion public static class Commands { @@ -1601,11 +1632,19 @@ public static class Commands { public static EstateCommands.AddOperatorToEstateCommand AddOperatorToEstateCommand => new EstateCommands.AddOperatorToEstateCommand(TestData.EstateId, TestData.AssignOperatorRequestToEstate); public static EstateCommands.CreateEstateCommand CreateEstateCommand => new EstateCommands.CreateEstateCommand(TestData.CreateEstateRequest); public static EstateCommands.RemoveOperatorFromEstateCommand RemoveOperatorFromEstateCommand => new(TestData.EstateId, TestData.OperatorId); + + public static OperatorCommands.CreateOperatorCommand CreateOperatorCommand => new(TestData.EstateId, TestData.CreateOperatorRequest); + + public static OperatorCommands.UpdateOperatorCommand UpdateOperatorCommand => new(TestData.EstateId, TestData.OperatorId, TestData.UpdateOperatorRequest); + } public static class Queries { public static EstateQueries.GetEstateQuery GetEstateQuery => new(TestData.EstateId); public static EstateQueries.GetEstatesQuery GetEstatesQuery => new(TestData.EstateId); + + public static OperatorQueries.GetOperatorQuery GetOperatorQuery => new(TestData.EstateId, TestData.OperatorId); + public static OperatorQueries.GetOperatorsQuery GetOperatorsQuery => new(TestData.EstateId); } public static class Aggregates { @@ -1639,6 +1678,24 @@ public static EstateAggregate EstateAggregateWithOperatorDeleted() return estateAggregate; } } + + public static class DomainEvents { + public static EstateCreatedEvent EstateCreatedEvent => new EstateCreatedEvent(TestData.EstateId, TestData.EstateName); + public static EstateReferenceAllocatedEvent EstateReferenceAllocatedEvent => new EstateReferenceAllocatedEvent(TestData.EstateId, TestData.EstateReference); + + public static SecurityUserAddedToEstateEvent EstateSecurityUserAddedEvent = + new SecurityUserAddedToEstateEvent(TestData.EstateId, TestData.EstateSecurityUserId, TestData.EmailAddress); + + public static OperatorCreatedEvent OperatorCreatedEvent = new OperatorCreatedEvent(TestData.OperatorId, + TestData.EstateId, + TestData.OperatorName, + TestData.RequireCustomMerchantNumber, + TestData.RequireCustomTerminalNumber); + + public static OperatorNameUpdatedEvent OperatorNameUpdatedEvent => new(TestData.OperatorId, TestData.EstateId, TestData.OperatorName2); + public static OperatorRequireCustomMerchantNumberChangedEvent OperatorRequireCustomMerchantNumberChangedEvent => new(TestData.OperatorId, TestData.EstateId, TestData.RequireCustomMerchantNumberFalse); + public static OperatorRequireCustomTerminalNumberChangedEvent OperatorRequireCustomTerminalNumberChangedEvent => new(TestData.OperatorId, TestData.EstateId, TestData.RequireCustomTerminalNumberFalse); + } } diff --git a/TransactionProcessor.sln b/TransactionProcessor.sln index b7cd544b..42912457 100644 --- a/TransactionProcessor.sln +++ b/TransactionProcessor.sln @@ -53,6 +53,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TransactionProcessor.Databa EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TransactionProcessor.Repository", "TransactionProcessor.Repository\TransactionProcessor.Repository.csproj", "{0696B63D-2807-40F9-BEEA-87D0415EC929}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TransactionProcessor.Operator.DomainEvents", "TransactionProcessor.Operator.DomainEvents\TransactionProcessor.Operator.DomainEvents.csproj", "{A6789FD5-3E34-4105-9A49-4DDECD438B12}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -151,6 +153,10 @@ Global {0696B63D-2807-40F9-BEEA-87D0415EC929}.Debug|Any CPU.Build.0 = Debug|Any CPU {0696B63D-2807-40F9-BEEA-87D0415EC929}.Release|Any CPU.ActiveCfg = Release|Any CPU {0696B63D-2807-40F9-BEEA-87D0415EC929}.Release|Any CPU.Build.0 = Release|Any CPU + {A6789FD5-3E34-4105-9A49-4DDECD438B12}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A6789FD5-3E34-4105-9A49-4DDECD438B12}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A6789FD5-3E34-4105-9A49-4DDECD438B12}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A6789FD5-3E34-4105-9A49-4DDECD438B12}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -179,6 +185,7 @@ Global {5A4FD1FE-2D82-4D9A-A498-8047F0E05E23} = {71B30DC4-AB27-4D30-8481-B4C326D074CB} {812BE19F-0494-43C3-95CE-4684ECAC3CB3} = {749ADE74-A6F0-4469-A638-8FD7E82A8667} {0696B63D-2807-40F9-BEEA-87D0415EC929} = {749ADE74-A6F0-4469-A638-8FD7E82A8667} + {A6789FD5-3E34-4105-9A49-4DDECD438B12} = {749ADE74-A6F0-4469-A638-8FD7E82A8667} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {193D13DE-424B-4D50-B674-01F9E4CC2CA9} diff --git a/TransactionProcessor/Bootstrapper/DomainEventHandlerRegistry.cs b/TransactionProcessor/Bootstrapper/DomainEventHandlerRegistry.cs index 70a37b5c..f4ade6a5 100644 --- a/TransactionProcessor/Bootstrapper/DomainEventHandlerRegistry.cs +++ b/TransactionProcessor/Bootstrapper/DomainEventHandlerRegistry.cs @@ -76,6 +76,7 @@ public DomainEventHandlerRegistry() this.AddSingleton(); this.AddSingleton(); this.AddSingleton(); + this.AddSingleton(); this.AddSingleton>(); this.AddSingleton>(); diff --git a/TransactionProcessor/Bootstrapper/DomainServiceRegistry.cs b/TransactionProcessor/Bootstrapper/DomainServiceRegistry.cs index 31777be1..d344e898 100644 --- a/TransactionProcessor/Bootstrapper/DomainServiceRegistry.cs +++ b/TransactionProcessor/Bootstrapper/DomainServiceRegistry.cs @@ -25,6 +25,7 @@ public DomainServiceRegistry() this.AddSingleton(); this.AddSingleton(); this.AddSingleton(); + this.AddSingleton(); } #endregion diff --git a/TransactionProcessor/Bootstrapper/MediatorRegistry.cs b/TransactionProcessor/Bootstrapper/MediatorRegistry.cs index eabbf54e..f9f31cb2 100644 --- a/TransactionProcessor/Bootstrapper/MediatorRegistry.cs +++ b/TransactionProcessor/Bootstrapper/MediatorRegistry.cs @@ -39,6 +39,7 @@ public MediatorRegistry() this.RegisterTransactionRequestHandler(); this.RegisterSettlementRequestHandler(); this.RegisterEstateRequestHandler(); + this.RegisterOperatorRequestHandler(); } #endregion @@ -68,8 +69,8 @@ private void RegisterEstateRequestHandler() { this.AddSingleton, EstateRequestHandler>(); this.AddSingleton, EstateRequestHandler>(); this.AddSingleton, EstateRequestHandler>(); - this.AddSingleton>, EstateRequestHandler>(); - this.AddSingleton>>, EstateRequestHandler>(); + this.AddSingleton>, EstateRequestHandler>(); + this.AddSingleton>>, EstateRequestHandler>(); } private void RegisterSettlementRequestHandler() { @@ -87,5 +88,13 @@ private void RegisterTransactionRequestHandler() { this.AddSingleton, TransactionRequestHandler>(); this.AddSingleton, TransactionRequestHandler>(); } + + private void RegisterOperatorRequestHandler() + { + this.AddSingleton, OperatorRequestHandler>(); + this.AddSingleton, OperatorRequestHandler>(); + this.AddSingleton>, OperatorRequestHandler>(); + this.AddSingleton>>, OperatorRequestHandler>(); + } } } \ No newline at end of file diff --git a/TransactionProcessor/Bootstrapper/RepositoryRegistry.cs b/TransactionProcessor/Bootstrapper/RepositoryRegistry.cs index 8d4b8fb4..d2cac2e0 100644 --- a/TransactionProcessor/Bootstrapper/RepositoryRegistry.cs +++ b/TransactionProcessor/Bootstrapper/RepositoryRegistry.cs @@ -75,7 +75,8 @@ public RepositoryRegistry() this.AddSingleton, AggregateRepository>(); this.AddSingleton, AggregateRepository>(); this.AddSingleton, AggregateRepository>(); - + this.AddSingleton, AggregateRepository>(); + this.AddSingleton, MerchantBalanceStateRepository>(); this.AddSingleton, VoucherStateRepository>(); this.AddSingleton(); diff --git a/TransactionProcessor/Controllers/ContractController.cs b/TransactionProcessor/Controllers/ContractController.cs index 42be03f4..a0043572 100644 --- a/TransactionProcessor/Controllers/ContractController.cs +++ b/TransactionProcessor/Controllers/ContractController.cs @@ -1,9 +1,7 @@ -using MediatR; -using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Shared.General; using SimpleResults; -using Swashbuckle.AspNetCore.Annotations; using Swashbuckle.AspNetCore.Filters; using System.Collections.Generic; using System.Security.Claims; @@ -29,11 +27,9 @@ using CreateContractRequest = TransactionProcessor.DataTransferObjects.Requests.Contract.CreateContractRequest; using Microsoft.AspNetCore.Authorization; using System.Diagnostics.CodeAnalysis; -using EstateManagement.DataTransferObjects.Responses.Operator; using TransactionProcessor.BusinessLogic.Manager; using TransactionProcessor.BusinessLogic.Requests; using TransactionProcessor.Database.Entities; -using TransactionProcessor.DataTransferObjects.Requests.Operator; using Microsoft.CodeAnalysis.Editing; namespace TransactionProcessor.Controllers { @@ -321,147 +317,4 @@ public async Task CreateContract([FromRoute] Guid estateId, #endregion } - - [ExcludeFromCodeCoverage] - [Route(ControllerRoute)] - [ApiController] - public class OperatorController : ControllerBase - { - private readonly IEstateClient EstateClient; - private readonly ISecurityServiceClient SecurityServiceClient; - - /// - /// The mediator - /// - private readonly IMediator Mediator; - - /// - /// Initializes a new instance of the class. - /// - /// The mediator. - public OperatorController(IEstateClient estateClient, ISecurityServiceClient securityServiceClient) { - this.EstateClient = estateClient; - this.SecurityServiceClient = securityServiceClient; - } - private TokenResponse TokenResponse; - private ClaimsPrincipal UserOverride; - internal void SetContextOverride(HttpContext ctx) - { - UserOverride = ctx.User; - } - - internal ClaimsPrincipal GetUser() - { - return UserOverride switch - { - null => HttpContext.User, - _ => UserOverride - }; - } - - /// - /// Creates the operator. - /// - /// The estate identifier. - /// The create operator request. - /// The cancellation token. - /// - [HttpPost] - [Route("")] - public async Task CreateOperator([FromRoute] Guid estateId, [FromBody] CreateOperatorRequest createOperatorRequest, CancellationToken cancellationToken) - { - this.TokenResponse = await Helpers.GetToken(this.TokenResponse, this.SecurityServiceClient, cancellationToken); - - var estateClientRequest = new EstateManagement.DataTransferObjects.Requests.Operator.CreateOperatorRequest() { - Name = createOperatorRequest.Name, - OperatorId = createOperatorRequest.OperatorId, - RequireCustomMerchantNumber = createOperatorRequest.RequireCustomMerchantNumber, - RequireCustomTerminalNumber = createOperatorRequest.RequireCustomTerminalNumber - }; - - var result = await this.EstateClient.CreateOperator(this.TokenResponse.AccessToken, estateId, estateClientRequest, cancellationToken); - - // return the result - return result.ToActionResultX(); - } - - [HttpPost] - [Route("{operatorId}")] - [SwaggerResponse(200, "OK")] - public async Task UpdateOperator([FromRoute] Guid estateId, [FromRoute] Guid operatorId, [FromBody] UpdateOperatorRequest updateOperatorRequest, CancellationToken cancellationToken) - { - this.TokenResponse = await Helpers.GetToken(this.TokenResponse, this.SecurityServiceClient, cancellationToken); - - var estateClientRequest = new EstateManagement.DataTransferObjects.Requests.Operator.UpdateOperatorRequest() - { - Name = updateOperatorRequest.Name, - RequireCustomMerchantNumber = updateOperatorRequest.RequireCustomMerchantNumber, - RequireCustomTerminalNumber = updateOperatorRequest.RequireCustomTerminalNumber - }; - - var result = await this.EstateClient.UpdateOperator(this.TokenResponse.AccessToken, estateId, operatorId, estateClientRequest, cancellationToken); - - // return the result - return result.ToActionResultX(); - } - - - [HttpGet] - [Route("{operatorId}")] - public async Task GetOperator([FromRoute] Guid estateId, - [FromRoute] Guid operatorId, - CancellationToken cancellationToken) - { - this.TokenResponse = await Helpers.GetToken(this.TokenResponse, this.SecurityServiceClient, cancellationToken); - - var result = await this.EstateClient.GetOperator(this.TokenResponse.AccessToken, estateId, operatorId, cancellationToken); - - if (result.IsFailed) - { - return result.ToActionResultX(); - } - - DataTransferObjects.Responses.Operator.OperatorResponse response = new() { OperatorId = result.Data.OperatorId, Name = result.Data.Name, RequireCustomMerchantNumber = result.Data.RequireCustomMerchantNumber, RequireCustomTerminalNumber = result.Data.RequireCustomTerminalNumber }; - - return Result.Success(response).ToActionResultX(); - } - - [HttpGet] - [Route("")] - public async Task GetOperators([FromRoute] Guid estateId, - CancellationToken cancellationToken) - { - this.TokenResponse = await Helpers.GetToken(this.TokenResponse, this.SecurityServiceClient, cancellationToken); - - var result = await this.EstateClient.GetOperators(this.TokenResponse.AccessToken, estateId, cancellationToken); - - if (result.IsFailed) - { - return result.ToActionResultX(); - } - - List responses = new(); - foreach (OperatorResponse operatorResponse in result.Data) { - - - responses.Add(new() { OperatorId = operatorResponse.OperatorId, Name = operatorResponse.Name, RequireCustomMerchantNumber = operatorResponse.RequireCustomMerchantNumber, RequireCustomTerminalNumber = operatorResponse.RequireCustomTerminalNumber }); - } - - return Result.Success(responses).ToActionResultX(); - } - - #region Others - - /// - /// The controller name - /// - public const string ControllerName = "operators"; - - /// - /// The controller route - /// - private const string ControllerRoute = "api/estates/{estateid}/" + ControllerName; - - #endregion - } } diff --git a/TransactionProcessor/Controllers/EstateController.cs b/TransactionProcessor/Controllers/EstateController.cs index 6fe5321f..8c9be713 100644 --- a/TransactionProcessor/Controllers/EstateController.cs +++ b/TransactionProcessor/Controllers/EstateController.cs @@ -116,7 +116,7 @@ public async Task GetEstate([FromRoute] Guid estateId, EstateQueries.GetEstateQuery query = new(estateId); - Result result = await Mediator.Send(query, cancellationToken); + Result result = await Mediator.Send(query, cancellationToken); if (result.IsFailed) { return result.ToActionResultX(); @@ -146,7 +146,7 @@ public async Task GetEstates([FromRoute] Guid estateId, EstateQueries.GetEstatesQuery query = new(estateId); - Result> result = await Mediator.Send(query, cancellationToken); + Result> result = await Mediator.Send(query, cancellationToken); if (result.IsFailed) { return result.ToActionResultX(); diff --git a/TransactionProcessor/Controllers/OperatorController.cs b/TransactionProcessor/Controllers/OperatorController.cs new file mode 100644 index 00000000..7f44d2c8 --- /dev/null +++ b/TransactionProcessor/Controllers/OperatorController.cs @@ -0,0 +1,136 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Security.Claims; +using System.Threading; +using System.Threading.Tasks; +using EstateManagement.Client; +using EstateManagement.DataTransferObjects.Responses.Operator; +using MediatR; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using SecurityService.Client; +using SecurityService.DataTransferObjects.Responses; +using Shared.Results; +using SimpleResults; +using Swashbuckle.AspNetCore.Annotations; +using TransactionProcessor.BusinessLogic.Common; +using TransactionProcessor.BusinessLogic.Requests; +using TransactionProcessor.DataTransferObjects.Requests.Operator; +using TransactionProcessor.Factories; + +namespace TransactionProcessor.Controllers; + +[ExcludeFromCodeCoverage] +[Route(ControllerRoute)] +[ApiController] +public class OperatorController : ControllerBase +{ + /// + /// The mediator + /// + private readonly IMediator Mediator; + + /// + /// Initializes a new instance of the class. + /// + /// The mediator. + public OperatorController(IMediator mediator) { + this.Mediator = mediator; + } + private TokenResponse TokenResponse; + private ClaimsPrincipal UserOverride; + internal void SetContextOverride(HttpContext ctx) + { + this.UserOverride = ctx.User; + } + + internal ClaimsPrincipal GetUser() + { + return this.UserOverride switch + { + null => this.HttpContext.User, + _ => this.UserOverride + }; + } + + /// + /// Creates the operator. + /// + /// The estate identifier. + /// The create operator request. + /// The cancellation token. + /// + [HttpPost] + [Route("")] + public async Task CreateOperator([FromRoute] Guid estateId, [FromBody] CreateOperatorRequest createOperatorRequest, CancellationToken cancellationToken) + { + // Create the command + OperatorCommands.CreateOperatorCommand command = new OperatorCommands.CreateOperatorCommand(estateId, createOperatorRequest); + + // Route the command + Result result = await Mediator.Send(command, cancellationToken); + + // return the result + return result.ToActionResultX(); + } + + [HttpPost] + [Route("{operatorId}")] + [SwaggerResponse(200, "OK")] + public async Task UpdateOperator([FromRoute] Guid estateId, [FromRoute] Guid operatorId, [FromBody] UpdateOperatorRequest updateOperatorRequest, CancellationToken cancellationToken) + { + // Create the command + OperatorCommands.UpdateOperatorCommand command = new OperatorCommands.UpdateOperatorCommand(estateId, operatorId, updateOperatorRequest); + + // Route the command + Result result = await Mediator.Send(command, cancellationToken); + + // return the result + return result.ToActionResultX(); + } + + + [HttpGet] + [Route("{operatorId}")] + public async Task GetOperator([FromRoute] Guid estateId, + [FromRoute] Guid operatorId, + CancellationToken cancellationToken) + { + // Create the command + OperatorQueries.GetOperatorQuery query = new(estateId, operatorId); + + // Route the command + Models.Operator.Operator @operator = await Mediator.Send(query, cancellationToken); + + return ModelFactory.ConvertFrom(@operator).ToActionResultX(); + } + + [HttpGet] + [Route("")] + public async Task GetOperators([FromRoute] Guid estateId, + CancellationToken cancellationToken) + { + // Create the command + OperatorQueries.GetOperatorsQuery query = new(estateId); + + // Route the command + List @operatorList = await Mediator.Send(query, cancellationToken); + + return ModelFactory.ConvertFrom(@operatorList).ToActionResultX(); + } + + #region Others + + /// + /// The controller name + /// + public const string ControllerName = "operators"; + + /// + /// The controller route + /// + private const string ControllerRoute = "api/estates/{estateid}/" + ControllerName; + + #endregion +} \ No newline at end of file diff --git a/TransactionProcessor/Factories/ModelFactory.cs b/TransactionProcessor/Factories/ModelFactory.cs index 500b779d..f454d8b0 100644 --- a/TransactionProcessor/Factories/ModelFactory.cs +++ b/TransactionProcessor/Factories/ModelFactory.cs @@ -1,6 +1,7 @@ using System.Linq; using EstateManagement.DataTransferObjects.Responses.Contract; using SimpleResults; +using TransactionProcessor.DataTransferObjects.Responses.Operator; namespace TransactionProcessor.Factories { @@ -11,6 +12,7 @@ namespace TransactionProcessor.Factories using EstateManagement.DataTransferObjects.Responses.Estate; using Models; using Newtonsoft.Json; + using TransactionProcessor.Models.Estate; using IssueVoucherResponse = DataTransferObjects.IssueVoucherResponse; using RedeemVoucherResponse = DataTransferObjects.RedeemVoucherResponse; @@ -22,6 +24,39 @@ public static class ModelFactory { #region Methods + public static Result ConvertFrom(Models.Operator.Operator @operator) + { + if (@operator == null) + { + return Result.Invalid("operator cannot be null"); + } + + OperatorResponse response = new(); + response.OperatorId = @operator.OperatorId; + response.RequireCustomTerminalNumber = @operator.RequireCustomTerminalNumber; + response.RequireCustomMerchantNumber = @operator.RequireCustomMerchantNumber; + response.Name = @operator.Name; + + return Result.Success(response); + } + + public static Result> ConvertFrom(List @operators) + { + if (@operators == null || @operators.Any() == false) + { + return Result.Success(new List()); + } + + List> result = new(); + + @operators.ForEach(c => result.Add(ModelFactory.ConvertFrom(c))); + + if (result.Any(c => c.IsFailed)) + return Result.Failure("Failed converting operators"); + + return Result.Success(result.Select(r => r.Data).ToList()); + } + public static Result ConvertFrom(ProcessLogonTransactionResponse processLogonTransactionResponse) { if (processLogonTransactionResponse == null) @@ -172,7 +207,7 @@ public static Result ConvertFrom(Models.RedeemVoucherResp return Result.Success(response); } - public static Result> ConvertFrom(List estates) + public static Result> ConvertFrom(List estates) { List> result = new(); @@ -185,7 +220,7 @@ public static Result ConvertFrom(Models.RedeemVoucherResp } - public static Result ConvertFrom(Models.Estate estate) + public static Result ConvertFrom(Estate estate) { if (estate == null) { diff --git a/TransactionProcessor/appsettings.json b/TransactionProcessor/appsettings.json index d8b4ab30..005862e5 100644 --- a/TransactionProcessor/appsettings.json +++ b/TransactionProcessor/appsettings.json @@ -41,6 +41,19 @@ ], "EstateReferenceAllocatedEvent": [ "TransactionProcessor.BusinessLogic.EventHandling.EstateDomainEventHandler, TransactionProcessor.BusinessLogic" + ], + // Opaerator Domain Event Handler + "OperatorCreatedEvent": [ + "TransactionProcessor.BusinessLogic.EventHandling.OperatorDomainEventHandler, TransactionProcessor.BusinessLogic" + ], + "OperatorNameUpdatedEvent": [ + "TransactionProcessor.BusinessLogic.EventHandling.OperatorDomainEventHandler, TransactionProcessor.BusinessLogic" + ], + "OperatorRequireCustomMerchantNumberChangedEvent": [ + "TransactionProcessor.BusinessLogic.EventHandling.OperatorDomainEventHandler, TransactionProcessor.BusinessLogic" + ], + "OperatorRequireCustomTerminalNumberChangedEvent": [ + "TransactionProcessor.BusinessLogic.EventHandling.OperatorDomainEventHandler, TransactionProcessor.BusinessLogic" ] }, "EventHandlerConfigurationOrdered": {