Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions TransactionProcessor.DataTransferObjects/MetadataContants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ public static class MetadataContants
#region Others

/// <summary>
/// The key name estate identifier
/// The estate identifier metadata name
/// </summary>
public static readonly String KeyNameEstateId = "estate_id";
public static readonly String EstateIdMetadataName = "estate_id";

/// <summary>
/// The key name merchant identifier
/// The merchant identifier metadata name
/// </summary>
public static readonly String KeyNameMerchantId = "merchant_id";
public static readonly String MerchantIdMetadataName = "merchant_id";

#endregion
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -605,8 +605,8 @@ public static List<String> 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));
}
Expand Down
24 changes: 12 additions & 12 deletions TransactionProcessor.Tests/Factories/ModelFactoryTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand All @@ -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());
}
Expand All @@ -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());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,8 @@ private static SerialisedMessage CreateSerialisedMessage(Object request)
{
Metadata = new Dictionary<String, String>
{
{ MetadataContants.KeyNameEstateId, TestData.EstateId.ToString() },
{ MetadataContants.KeyNameMerchantId, TestData.MerchantId.ToString() }
{ MetadataContants.EstateIdMetadataName, TestData.EstateId.ToString() },
{ MetadataContants.MerchantIdMetadataName, TestData.MerchantId.ToString() }
},
SerialisedData = JsonConvert.SerializeObject(request)
};
Expand Down
12 changes: 6 additions & 6 deletions TransactionProcessor/Factories/ModelFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@ public static SerialisedMessage ConvertFrom(ProcessLogonTransactionResponse proc
{
Metadata = new Dictionary<String, String>()
{
{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
{
Expand Down Expand Up @@ -182,8 +182,8 @@ public static SerialisedMessage ConvertFrom(ProcessSaleTransactionResponse proce
{
Metadata = new Dictionary<String, String>()
{
{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
{
Expand Down Expand Up @@ -212,8 +212,8 @@ public static SerialisedMessage ConvertFrom(ProcessReconciliationTransactionResp
{
Metadata = new Dictionary<String, String>()
{
{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
{
Expand Down
4 changes: 2 additions & 2 deletions TransactionProcessor/Handlers/TransactionHandlers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ public static async Task<IResult> 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<DataTransferObject> deserialiseResult = DeserializeTransactionRequest(transactionRequest.SerialisedData);
if (deserialiseResult.IsFailed || deserialiseResult.Data == null)
Expand Down
Loading