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
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public async Task TransactionAggregateManager_AuthoriseTransaction_TransactionAu

await transactionAggregateManager.AuthoriseTransaction(TestData.EstateId,
TestData.TransactionId,
TestData.OperatorIdentifier1,
TestData.OperatorResponse,
TestData.TransactionResponseCodeSuccess,
TestData.ResponseMessage,
Expand Down Expand Up @@ -62,6 +63,7 @@ public async Task TransactionAggregateManager_DeclineTransaction_TransactionDecl

await transactionAggregateManager.DeclineTransaction(TestData.EstateId,
TestData.TransactionId,
TestData.OperatorIdentifier1,
TestData.OperatorResponse,
TestData.TransactionResponseCodeDeclinedByOperator,
TestData.ResponseMessage,
Expand Down Expand Up @@ -110,6 +112,7 @@ public async Task TransactionAggregateManager_RecordAdditionalRequestData_Additi

await transactionAggregateManager.RecordAdditionalRequestData(TestData.EstateId,
TestData.TransactionId,
TestData.OperatorIdentifier1,
TestData.AdditionalTransactionMetaData,
CancellationToken.None);
}
Expand All @@ -125,6 +128,7 @@ public async Task TransactionAggregateManager_RecordAdditionalRequestData_NullAd

await transactionAggregateManager.RecordAdditionalRequestData(TestData.EstateId,
TestData.TransactionId,
TestData.OperatorIdentifier1,
TestData.NullAdditionalTransactionMetaData,
CancellationToken.None);
}
Expand All @@ -140,6 +144,7 @@ public async Task TransactionAggregateManager_RecordAdditionalRequestData_EmptyA

await transactionAggregateManager.RecordAdditionalRequestData(TestData.EstateId,
TestData.TransactionId,
TestData.OperatorIdentifier1,
TestData.EmptyAdditionalTransactionMetaData,
CancellationToken.None);
}
Expand All @@ -155,6 +160,7 @@ public async Task TransactionAggregateManager_RecordAdditionalResponseData_Addit

await transactionAggregateManager.RecordAdditionalResponseData(TestData.EstateId,
TestData.TransactionId,
TestData.OperatorIdentifier1,
TestData.AdditionalTransactionMetaData,
CancellationToken.None);
}
Expand All @@ -170,6 +176,7 @@ public async Task TransactionAggregateManager_RecordAdditionalResponseData_NullA

await transactionAggregateManager.RecordAdditionalResponseData(TestData.EstateId,
TestData.TransactionId,
TestData.OperatorIdentifier1,
TestData.NullAdditionalTransactionMetaData,
CancellationToken.None);
}
Expand All @@ -185,6 +192,7 @@ public async Task TransactionAggregateManager_RecordAdditionalResponseData_Empty

await transactionAggregateManager.RecordAdditionalResponseData(TestData.EstateId,
TestData.TransactionId,
TestData.OperatorIdentifier1,
TestData.EmptyAdditionalTransactionMetaData,
CancellationToken.None);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@ public interface ITransactionAggregateManager
/// </summary>
/// <param name="estateId">The estate identifier.</param>
/// <param name="transactionId">The transaction identifier.</param>
/// <param name="operatorIdentifier">The operator identifier.</param>
/// <param name="operatorResponse">The operator response.</param>
/// <param name="transactionResponseCode">The transaction response code.</param>
/// <param name="responseMessage">The response message.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns></returns>
Task AuthoriseTransaction(Guid estateId,
Guid transactionId,
String operatorIdentifier,
OperatorResponse operatorResponse,
TransactionResponseCode transactionResponseCode,
String responseMessage,
Expand Down Expand Up @@ -63,13 +65,15 @@ Task CompleteTransaction(Guid estateId,
/// </summary>
/// <param name="estateId">The estate identifier.</param>
/// <param name="transactionId">The transaction identifier.</param>
/// <param name="operatorIdentifier">The operator identifier.</param>
/// <param name="operatorResponse">The operator response.</param>
/// <param name="transactionResponseCode">The transaction response code.</param>
/// <param name="responseMessage">The response message.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns></returns>
Task DeclineTransaction(Guid estateId,
Guid transactionId,
String operatorIdentifier,
OperatorResponse operatorResponse,
TransactionResponseCode transactionResponseCode,
String responseMessage,
Expand Down Expand Up @@ -104,11 +108,13 @@ Task<TransactionAggregate> GetAggregate(Guid estateId,
/// </summary>
/// <param name="estateId">The estate identifier.</param>
/// <param name="transactionId">The transaction identifier.</param>
/// <param name="operatorIdentifier">The operator identifier.</param>
/// <param name="additionalTransactionRequestMetadata">The additional transaction request metadata.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns></returns>
Task RecordAdditionalRequestData(Guid estateId,
Guid transactionId,
String operatorIdentifier,
Dictionary<String, String> additionalTransactionRequestMetadata,
CancellationToken cancellationToken);

Expand All @@ -117,11 +123,13 @@ Task RecordAdditionalRequestData(Guid estateId,
/// </summary>
/// <param name="estateId">The estate identifier.</param>
/// <param name="transactionId">The transaction identifier.</param>
/// <param name="operatorIdentifier">The operator identifier.</param>
/// <param name="additionalTransactionResponseMetadata">The additional transaction response metadata.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns></returns>
Task RecordAdditionalResponseData(Guid estateId,
Guid transactionId,
String operatorIdentifier,
Dictionary<String, String> additionalTransactionResponseMetadata,
CancellationToken cancellationToken);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,15 @@ public TransactionAggregateManager(IAggregateRepositoryManager aggregateReposito
/// </summary>
/// <param name="estateId">The estate identifier.</param>
/// <param name="transactionId">The transaction identifier.</param>
/// <param name="operatorIdentifier">The operator identifier.</param>
/// <param name="operatorResponse">The operator response.</param>
/// <param name="transactionResponseCode">The transaction response code.</param>
/// <param name="responseMessage">The response message.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns></returns>
public async Task AuthoriseTransaction(Guid estateId,
Guid transactionId,
String operatorIdentifier,
OperatorResponse operatorResponse,
TransactionResponseCode transactionResponseCode,
String responseMessage,
Expand All @@ -62,7 +65,8 @@ public async Task AuthoriseTransaction(Guid estateId,

TransactionAggregate transactionAggregate = await transactionAggregateRepository.GetLatestVersion(transactionId, cancellationToken);

transactionAggregate.AuthoriseTransaction(operatorResponse.AuthorisationCode,
transactionAggregate.AuthoriseTransaction(operatorIdentifier,
operatorResponse.AuthorisationCode,
operatorResponse.ResponseCode,
operatorResponse.ResponseMessage,
operatorResponse.TransactionId,
Expand Down Expand Up @@ -129,6 +133,7 @@ public async Task CompleteTransaction(Guid estateId,
/// <param name="cancellationToken">The cancellation token.</param>
public async Task DeclineTransaction(Guid estateId,
Guid transactionId,
String operatorIdentifier,
OperatorResponse operatorResponse,
TransactionResponseCode transactionResponseCode,
String responseMessage,
Expand All @@ -139,7 +144,8 @@ public async Task DeclineTransaction(Guid estateId,

TransactionAggregate transactionAggregate = await transactionAggregateRepository.GetLatestVersion(transactionId, cancellationToken);

transactionAggregate.DeclineTransaction(operatorResponse.ResponseCode,
transactionAggregate.DeclineTransaction(operatorIdentifier,
operatorResponse.ResponseCode,
operatorResponse.ResponseMessage,
((Int32)transactionResponseCode).ToString().PadLeft(4, '0'),
responseMessage);
Expand Down Expand Up @@ -192,10 +198,12 @@ public async Task<TransactionAggregate> GetAggregate(Guid estateId,
/// </summary>
/// <param name="estateId">The estate identifier.</param>
/// <param name="transactionId">The transaction identifier.</param>
/// <param name="operatorIdentifier">The operator identifier.</param>
/// <param name="additionalTransactionRequestMetadata">The additional transaction request metadata.</param>
/// <param name="cancellationToken">The cancellation token.</param>
public async Task RecordAdditionalRequestData(Guid estateId,
Guid transactionId,
String operatorIdentifier,
Dictionary<String, String> additionalTransactionRequestMetadata,
CancellationToken cancellationToken)
{
Expand All @@ -206,7 +214,7 @@ public async Task RecordAdditionalRequestData(Guid estateId,

TransactionAggregate transactionAggregate = await transactionAggregateRepository.GetLatestVersion(transactionId, cancellationToken);

transactionAggregate.RecordAdditionalRequestData(additionalTransactionRequestMetadata);
transactionAggregate.RecordAdditionalRequestData(operatorIdentifier, additionalTransactionRequestMetadata);

await transactionAggregateRepository.SaveChanges(transactionAggregate, cancellationToken);
}
Expand All @@ -221,6 +229,7 @@ public async Task RecordAdditionalRequestData(Guid estateId,
/// <param name="cancellationToken">The cancellation token.</param>
public async Task RecordAdditionalResponseData(Guid estateId,
Guid transactionId,
String operatorIdentifier,
Dictionary<String, String> additionalTransactionResponseMetadata,
CancellationToken cancellationToken)
{
Expand All @@ -231,7 +240,7 @@ public async Task RecordAdditionalResponseData(Guid estateId,

TransactionAggregate transactionAggregate = await transactionAggregateRepository.GetLatestVersion(transactionId, cancellationToken);

transactionAggregate.RecordAdditionalResponseData(additionalTransactionResponseMetadata);
transactionAggregate.RecordAdditionalResponseData(operatorIdentifier, additionalTransactionResponseMetadata);

await transactionAggregateRepository.SaveChanges(transactionAggregate, cancellationToken);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ await this.TransactionAggregateManager.StartTransaction(transactionId,
if (validationResult.responseCode == TransactionResponseCode.Success)
{
// Record any additional request metadata
await this.TransactionAggregateManager.RecordAdditionalRequestData(estateId, transactionId, additionalTransactionMetadata, cancellationToken);
await this.TransactionAggregateManager.RecordAdditionalRequestData(estateId, transactionId, operatorIdentifier, additionalTransactionMetadata, cancellationToken);

// Do the online processing with the operator here
MerchantResponse merchant = await this.GetMerchant(estateId, merchantId, cancellationToken);
Expand All @@ -202,6 +202,7 @@ await this.TransactionAggregateManager.StartTransaction(transactionId,

await this.TransactionAggregateManager.AuthoriseTransaction(estateId,
transactionId,
operatorIdentifier,
operatorResponse,
transactionResponseCode,
responseMessage,
Expand All @@ -214,14 +215,15 @@ await this.TransactionAggregateManager.AuthoriseTransaction(estateId,

await this.TransactionAggregateManager.DeclineTransaction(estateId,
transactionId,
operatorIdentifier,
operatorResponse,
transactionResponseCode,
responseMessage,
cancellationToken);
}

// Record any additional operator response metadata
await this.TransactionAggregateManager.RecordAdditionalResponseData(estateId, transactionId, operatorResponse.AdditionalTransactionResponseMetadata, cancellationToken);
await this.TransactionAggregateManager.RecordAdditionalResponseData(estateId, transactionId, operatorIdentifier, operatorResponse.AdditionalTransactionResponseMetadata, cancellationToken);

}
else
Expand Down
5 changes: 3 additions & 2 deletions TransactionProcessor.Testing/TestData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -444,10 +444,11 @@ public static TransactionAggregate GetDeclinedTransactionAggregate(TransactionRe
TestData.MerchantId,
TestData.DeviceIdentifier);

transactionAggregate.DeclineTransaction(TestData.DeclinedOperatorResponseCode,
transactionAggregate.DeclineTransaction(TestData.OperatorIdentifier1,
TestData.DeclinedOperatorResponseCode,
TestData.DeclinedOperatorResponseMessage,
TestData.GetResponseCodeAsString(transactionResponseCode),
TestData.GetResponseCodeMessage(transactionResponseCode));
TestData.GetResponseCodeMessage(transactionResponseCode));

return transactionAggregate;
}
Expand Down
Loading