diff --git a/TransactionProcessor.DataTransferObjects/MetadataContants.cs b/TransactionProcessor.DataTransferObjects/MetadataContants.cs index 910bfec2..7cec284c 100644 --- a/TransactionProcessor.DataTransferObjects/MetadataContants.cs +++ b/TransactionProcessor.DataTransferObjects/MetadataContants.cs @@ -12,14 +12,14 @@ public static class MetadataContants #region Others /// - /// The key name estate identifier + /// The estate identifier metadata name /// - public static readonly String KeyNameEstateId = "estate_id"; + public static readonly String EstateIdMetadataName = "estate_id"; /// - /// The key name merchant identifier + /// The merchant identifier metadata name /// - public static readonly String KeyNameMerchantId = "merchant_id"; + public static readonly String MerchantIdMetadataName = "merchant_id"; #endregion } diff --git a/TransactionProcessor.IntegrationTesting.Helpers/SpecflowExtensions.cs b/TransactionProcessor.IntegrationTesting.Helpers/SpecflowExtensions.cs index 3b114867..06d76906 100644 --- a/TransactionProcessor.IntegrationTesting.Helpers/SpecflowExtensions.cs +++ b/TransactionProcessor.IntegrationTesting.Helpers/SpecflowExtensions.cs @@ -605,8 +605,8 @@ public static List ToAutomaticDepositRequests(this DataTableRows tableRo } SerialisedMessage serialisedMessage = new SerialisedMessage(); - serialisedMessage.Metadata.Add(MetadataContants.KeyNameEstateId, estateDetails.EstateId.ToString()); - serialisedMessage.Metadata.Add(MetadataContants.KeyNameMerchantId, merchantId.ToString()); + serialisedMessage.Metadata.Add(MetadataContants.EstateIdMetadataName, estateDetails.EstateId.ToString()); + serialisedMessage.Metadata.Add(MetadataContants.MerchantIdMetadataName, merchantId.ToString()); serialisedMessage.SerialisedData = serialisedData; messages.Add((estateDetails, merchantId, transactionNumber, serialisedMessage)); } diff --git a/TransactionProcessor.Tests/Factories/ModelFactoryTests.cs b/TransactionProcessor.Tests/Factories/ModelFactoryTests.cs index 9da9dfae..dc590b70 100644 --- a/TransactionProcessor.Tests/Factories/ModelFactoryTests.cs +++ b/TransactionProcessor.Tests/Factories/ModelFactoryTests.cs @@ -187,10 +187,10 @@ public void ModelFactory_ProcessLogonTransactionResponseModel_IsConverted() SerialisedMessage logonTransactionResponse = ModelFactory.ConvertFrom(processLogonTransactionResponseModel); logonTransactionResponse.ShouldNotBeNull(); - logonTransactionResponse.Metadata.ShouldContainKey(MetadataContants.KeyNameEstateId); - logonTransactionResponse.Metadata.ShouldContainKey(MetadataContants.KeyNameMerchantId); - String estateId = logonTransactionResponse.Metadata[MetadataContants.KeyNameEstateId]; - String merchantId = logonTransactionResponse.Metadata[MetadataContants.KeyNameMerchantId]; + logonTransactionResponse.Metadata.ShouldContainKey(MetadataContants.EstateIdMetadataName); + logonTransactionResponse.Metadata.ShouldContainKey(MetadataContants.MerchantIdMetadataName); + String estateId = logonTransactionResponse.Metadata[MetadataContants.EstateIdMetadataName]; + String merchantId = logonTransactionResponse.Metadata[MetadataContants.MerchantIdMetadataName]; estateId.ShouldBe(TestData.ProcessLogonTransactionResponseModel.EstateId.ToString()); merchantId.ShouldBe(TestData.ProcessLogonTransactionResponseModel.MerchantId.ToString()); } @@ -212,10 +212,10 @@ public void ModelFactory_ProcessSaleTransactionResponseModel_IsConverted() SerialisedMessage saleTransactionResponse = ModelFactory.ConvertFrom(processSaleTransactionResponseModel); saleTransactionResponse.ShouldNotBeNull(); - saleTransactionResponse.Metadata.ShouldContainKey(MetadataContants.KeyNameEstateId); - saleTransactionResponse.Metadata.ShouldContainKey(MetadataContants.KeyNameMerchantId); - String estateId = saleTransactionResponse.Metadata[MetadataContants.KeyNameEstateId]; - String merchantId = saleTransactionResponse.Metadata[MetadataContants.KeyNameMerchantId]; + saleTransactionResponse.Metadata.ShouldContainKey(MetadataContants.EstateIdMetadataName); + saleTransactionResponse.Metadata.ShouldContainKey(MetadataContants.MerchantIdMetadataName); + String estateId = saleTransactionResponse.Metadata[MetadataContants.EstateIdMetadataName]; + String merchantId = saleTransactionResponse.Metadata[MetadataContants.MerchantIdMetadataName]; estateId.ShouldBe(TestData.ProcessSaleTransactionResponseModel.EstateId.ToString()); merchantId.ShouldBe(TestData.ProcessSaleTransactionResponseModel.MerchantId.ToString()); } @@ -237,10 +237,10 @@ public void ModelFactory_ProcessReconciliationTransactionResponse_IsConverted() SerialisedMessage processReconciliationTransactionResponse = ModelFactory.ConvertFrom(processReconciliationTransactionResponseModel); processReconciliationTransactionResponse.ShouldNotBeNull(); - processReconciliationTransactionResponse.Metadata.ShouldContainKey(MetadataContants.KeyNameEstateId); - processReconciliationTransactionResponse.Metadata.ShouldContainKey(MetadataContants.KeyNameMerchantId); - String estateId = processReconciliationTransactionResponse.Metadata[MetadataContants.KeyNameEstateId]; - String merchantId = processReconciliationTransactionResponse.Metadata[MetadataContants.KeyNameMerchantId]; + processReconciliationTransactionResponse.Metadata.ShouldContainKey(MetadataContants.EstateIdMetadataName); + processReconciliationTransactionResponse.Metadata.ShouldContainKey(MetadataContants.MerchantIdMetadataName); + String estateId = processReconciliationTransactionResponse.Metadata[MetadataContants.EstateIdMetadataName]; + String merchantId = processReconciliationTransactionResponse.Metadata[MetadataContants.MerchantIdMetadataName]; estateId.ShouldBe(TestData.ProcessSaleTransactionResponseModel.EstateId.ToString()); merchantId.ShouldBe(TestData.ProcessSaleTransactionResponseModel.MerchantId.ToString()); } diff --git a/TransactionProcessor.Tests/HandlerTests/TransactionHandlersTests.cs b/TransactionProcessor.Tests/HandlerTests/TransactionHandlersTests.cs index 4a77b885..1b8000e0 100644 --- a/TransactionProcessor.Tests/HandlerTests/TransactionHandlersTests.cs +++ b/TransactionProcessor.Tests/HandlerTests/TransactionHandlersTests.cs @@ -170,8 +170,8 @@ private static SerialisedMessage CreateSerialisedMessage(Object request) { Metadata = new Dictionary { - { MetadataContants.KeyNameEstateId, TestData.EstateId.ToString() }, - { MetadataContants.KeyNameMerchantId, TestData.MerchantId.ToString() } + { MetadataContants.EstateIdMetadataName, TestData.EstateId.ToString() }, + { MetadataContants.MerchantIdMetadataName, TestData.MerchantId.ToString() } }, SerialisedData = JsonConvert.SerializeObject(request) }; diff --git a/TransactionProcessor/Factories/ModelFactory.cs b/TransactionProcessor/Factories/ModelFactory.cs index 22dc0397..05c730ac 100644 --- a/TransactionProcessor/Factories/ModelFactory.cs +++ b/TransactionProcessor/Factories/ModelFactory.cs @@ -151,8 +151,8 @@ public static SerialisedMessage ConvertFrom(ProcessLogonTransactionResponse proc { Metadata = new Dictionary() { - {MetadataContants.KeyNameEstateId, logonTransactionResponse.EstateId.ToString()}, - {MetadataContants.KeyNameMerchantId, logonTransactionResponse.MerchantId.ToString()} + {MetadataContants.EstateIdMetadataName, logonTransactionResponse.EstateId.ToString()}, + {MetadataContants.MerchantIdMetadataName, logonTransactionResponse.MerchantId.ToString()} }, SerialisedData = JsonConvert.SerializeObject(logonTransactionResponse, new JsonSerializerSettings { @@ -182,8 +182,8 @@ public static SerialisedMessage ConvertFrom(ProcessSaleTransactionResponse proce { Metadata = new Dictionary() { - {MetadataContants.KeyNameEstateId, processSaleTransactionResponse.EstateId.ToString()}, - {MetadataContants.KeyNameMerchantId, processSaleTransactionResponse.MerchantId.ToString()} + {MetadataContants.EstateIdMetadataName, processSaleTransactionResponse.EstateId.ToString()}, + {MetadataContants.MerchantIdMetadataName, processSaleTransactionResponse.MerchantId.ToString()} }, SerialisedData = JsonConvert.SerializeObject(saleTransactionResponse, new JsonSerializerSettings { @@ -212,8 +212,8 @@ public static SerialisedMessage ConvertFrom(ProcessReconciliationTransactionResp { Metadata = new Dictionary() { - {MetadataContants.KeyNameEstateId, processReconciliationTransactionResponse.EstateId.ToString()}, - {MetadataContants.KeyNameMerchantId, processReconciliationTransactionResponse.MerchantId.ToString()} + {MetadataContants.EstateIdMetadataName, processReconciliationTransactionResponse.EstateId.ToString()}, + {MetadataContants.MerchantIdMetadataName, processReconciliationTransactionResponse.MerchantId.ToString()} }, SerialisedData = JsonConvert.SerializeObject(reconciliationTransactionResponse, new JsonSerializerSettings { diff --git a/TransactionProcessor/Handlers/TransactionHandlers.cs b/TransactionProcessor/Handlers/TransactionHandlers.cs index cac6e7b6..9470a35d 100644 --- a/TransactionProcessor/Handlers/TransactionHandlers.cs +++ b/TransactionProcessor/Handlers/TransactionHandlers.cs @@ -23,8 +23,8 @@ public static async Task PerformTransaction(IMediator mediator, HttpCon { DateTime transactionReceivedDateTime = DateTime.Now; - Guid estateId = Guid.Parse(transactionRequest.Metadata[MetadataContants.KeyNameEstateId]); - Guid merchantId = Guid.Parse(transactionRequest.Metadata[MetadataContants.KeyNameMerchantId]); + Guid estateId = Guid.Parse(transactionRequest.Metadata[MetadataContants.EstateIdMetadataName]); + Guid merchantId = Guid.Parse(transactionRequest.Metadata[MetadataContants.MerchantIdMetadataName]); Result deserialiseResult = DeserializeTransactionRequest(transactionRequest.SerialisedData); if (deserialiseResult.IsFailed || deserialiseResult.Data == null)