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 @@ -59,6 +59,8 @@ public async Task ProcessSaleTransactionRequestHandler_Handle_RequestIsHandled()
It.IsAny<Decimal>(),
It.IsAny<String>(),
It.IsAny<String>(),
It.IsAny<Guid>(),
It.IsAny<Guid>(),
It.IsAny<CancellationToken>())).ReturnsAsync(TestData.ProcessSaleTransactionResponse);

ProcessSaleTransactionRequestHandler requestHandler = new ProcessSaleTransactionRequestHandler(applicationService.Object);
Expand Down
6 changes: 5 additions & 1 deletion TransactionProcessorACL.BusinessLogic.Tests/RequestTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ public void ProcessSaleTransactionRequest_CanBeCreated_IsCreated()
TestData.OperatorIdentifier,
TestData.SaleAmount,
TestData.CustomerAccountNumber,
TestData.CustomerEmailAddress);
TestData.CustomerEmailAddress,
TestData.ContractId,
TestData.ProductId);

request.EstateId.ShouldBe(TestData.EstateId);
request.MerchantId.ShouldBe(TestData.MerchantId);
Expand All @@ -55,6 +57,8 @@ public void ProcessSaleTransactionRequest_CanBeCreated_IsCreated()
request.Amount.ShouldBe(TestData.SaleAmount);
request.CustomerAccountNumber.ShouldBe(TestData.CustomerAccountNumber);
request.CustomerEmailAddress.ShouldBe(TestData.CustomerEmailAddress);
request.ContractId.ShouldBe(TestData.ContractId);
request.ProductId.ShouldBe(TestData.ProductId);
}

#endregion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ public async Task TransactionProcessorACLApplicationService_ProcessSaleTransacti
TestData.SaleAmount,
TestData.CustomerAccountNumber,
TestData.CustomerEmailAddress,
TestData.ContractId,
TestData.ProductId,
CancellationToken.None);

saleResponse.ShouldNotBeNull();
Expand Down Expand Up @@ -145,6 +147,8 @@ public async Task TransactionProcessorACLApplicationService_ProcessSaleTransacti
TestData.SaleAmount,
TestData.CustomerAccountNumber,
TestData.CustomerEmailAddress,
TestData.ContractId,
TestData.ProductId,
CancellationToken.None);

saleResponse.ShouldNotBeNull();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ public async Task<ProcessSaleTransactionResponse> Handle(ProcessSaleTransactionR
request.Amount,
request.CustomerAccountNumber,
request.CustomerEmailAddress,
request.ContractId,
request.ProductId,
cancellationToken);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ public ProcessSaleTransactionRequest()
/// <param name="amount">The amount.</param>
/// <param name="customerAccountNumber">The customer account number.</param>
/// <param name="customerEmailAddress">The customer email address.</param>
/// <param name="contractId">The contract identifier.</param>
/// <param name="productId">The product identifier.</param>
/// <param name="">The .</param>
private ProcessSaleTransactionRequest(Guid estateId,
Guid merchantId,
DateTime transactionDateTime,
Expand All @@ -38,7 +41,9 @@ private ProcessSaleTransactionRequest(Guid estateId,
String operatorIdentifier,
Decimal amount,
String customerAccountNumber,
String customerEmailAddress)
String customerEmailAddress,
Guid contractId,
Guid productId)
{
this.EstateId = estateId;
this.MerchantId = merchantId;
Expand All @@ -47,10 +52,12 @@ private ProcessSaleTransactionRequest(Guid estateId,
this.Amount = amount;
this.CustomerAccountNumber = customerAccountNumber;
this.CustomerEmailAddress = customerEmailAddress;
this.ContractId = contractId;
this.ProductId = productId;
this.TransactionDateTime = transactionDateTime;
this.TransactionNumber = transactionNumber;
}

#endregion

#region Properties
Expand Down Expand Up @@ -79,6 +86,22 @@ private ProcessSaleTransactionRequest(Guid estateId,
/// </value>
public String CustomerEmailAddress { get; private set; }

/// <summary>
/// Gets the contract identifier.
/// </summary>
/// <value>
/// The contract identifier.
/// </value>
public Guid ContractId { get; }

/// <summary>
/// Gets the product identifier.
/// </summary>
/// <value>
/// The product identifier.
/// </value>
public Guid ProductId { get; }

/// <summary>
/// Gets the device identifier.
/// </summary>
Expand Down Expand Up @@ -143,6 +166,8 @@ private ProcessSaleTransactionRequest(Guid estateId,
/// <param name="amount">The amount.</param>
/// <param name="customerAccountNumber">The customer account number.</param>
/// <param name="customerEmailAddress">The customer email address.</param>
/// <param name="contractId">The contract identifier.</param>
/// <param name="productId">The product identifier.</param>
/// <returns></returns>
public static ProcessSaleTransactionRequest Create(Guid estateId,
Guid merchantId,
Expand All @@ -152,7 +177,9 @@ public static ProcessSaleTransactionRequest Create(Guid estateId,
String operatorIdentifier,
Decimal amount,
String customerAccountNumber,
String customerEmailAddress)
String customerEmailAddress,
Guid contractId,
Guid productId)
{
return new ProcessSaleTransactionRequest(estateId,
merchantId,
Expand All @@ -162,7 +189,9 @@ public static ProcessSaleTransactionRequest Create(Guid estateId,
operatorIdentifier,
amount,
customerAccountNumber,
customerEmailAddress);
customerEmailAddress,
contractId,
productId);
}

#endregion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ Task<ProcessLogonTransactionResponse> ProcessLogonTransaction(Guid estateId,
/// <param name="amount">The amount.</param>
/// <param name="customerAccountNumber">The customer account number.</param>
/// <param name="customerEmailAddress">The customer email address.</param>
/// <param name="contractId">The contract identifier.</param>
/// <param name="productId">The product identifier.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns></returns>
Task<ProcessSaleTransactionResponse> ProcessSaleTransaction(Guid estateId,
Expand All @@ -51,6 +53,8 @@ Task<ProcessSaleTransactionResponse> ProcessSaleTransaction(Guid estateId,
Decimal amount,
String customerAccountNumber,
String customerEmailAddress,
Guid contractId,
Guid productId,
CancellationToken cancellationToken);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ public async Task<ProcessLogonTransactionResponse> ProcessLogonTransaction(Guid
/// <param name="amount">The amount.</param>
/// <param name="customerAccountNumber">The customer account number.</param>
/// <param name="customerEmailAddress">The customer email address.</param>
/// <param name="contractId">The contract identifier.</param>
/// <param name="productId">The product identifier.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns></returns>
public async Task<ProcessSaleTransactionResponse> ProcessSaleTransaction(Guid estateId,
Expand All @@ -146,6 +148,8 @@ public async Task<ProcessSaleTransactionResponse> ProcessSaleTransaction(Guid es
Decimal amount,
String customerAccountNumber,
String customerEmailAddress,
Guid contractId,
Guid productId,
CancellationToken cancellationToken)
{
// Get a client token to call the Transaction Processor
Expand All @@ -162,6 +166,10 @@ public async Task<ProcessSaleTransactionResponse> ProcessSaleTransaction(Guid es
saleTransactionRequest.OperatorIdentifier = operatorIdentifier;
saleTransactionRequest.CustomerEmailAddress = customerEmailAddress;

// Set the product information
saleTransactionRequest.ContractId = contractId;
saleTransactionRequest.ProductId = productId;

// Build up the metadata
saleTransactionRequest.AdditionalTransactionMetadata = new Dictionary<String, String>();
saleTransactionRequest.AdditionalTransactionMetadata.Add("Amount", amount.ToString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<PackageReference Include="MediatR" Version="8.0.2" />
<PackageReference Include="SecurityService.Client" Version="1.0.0" />
<PackageReference Include="Shared" Version="0.0.15.7" />
<PackageReference Include="TransactionProcessor.Client" Version="1.0.1.1" />
<PackageReference Include="TransactionProcessor.Client" Version="1.0.2-build16" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ public class SaleTransactionRequestMessage : TransactionRequestMessage
/// </value>
public Decimal Amount { get; set; }

/// <summary>
/// Gets or sets the contract identifier.
/// </summary>
/// <value>
/// The contract identifier.
/// </value>
public Guid ContractId { get; set; }

/// <summary>
/// Gets or sets the customer account number.
/// </summary>
Expand All @@ -28,6 +36,14 @@ public class SaleTransactionRequestMessage : TransactionRequestMessage
/// </value>
public String CustomerAccountNumber { get; set; }

/// <summary>
/// Gets or sets the customer email address.
/// </summary>
/// <value>
/// The customer email address.
/// </value>
public String CustomerEmailAddress { get; set; }

/// <summary>
/// Gets or sets the operator identifier.
/// </summary>
Expand All @@ -37,12 +53,12 @@ public class SaleTransactionRequestMessage : TransactionRequestMessage
public String OperatorIdentifier { get; set; }

/// <summary>
/// Gets or sets the customer email address.
/// Gets or sets the product identifier.
/// </summary>
/// <value>
/// The customer email address.
/// The product identifier.
/// </value>
public String CustomerEmailAddress { get; set; }
public Guid ProductId { get; set; }

#endregion
}
Expand Down
27 changes: 27 additions & 0 deletions TransactionProcessorACL.IntegrationTests/Common/ClientDetails.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
namespace TransactionProcessor.IntegrationTests.Common
{
using System;

public class ClientDetails
{
public String ClientId { get; private set; }
public String ClientSecret { get; private set; }
public String GrantType { get; private set; }

private ClientDetails(String clientId,
String clientSecret,
String grantType)
{
this.ClientId = clientId;
this.ClientSecret = clientSecret;
this.GrantType = grantType;
}

public static ClientDetails Create(String clientId,
String clientSecret,
String grantType)
{
return new ClientDetails(clientId, clientSecret, grantType);
}
}
}
97 changes: 97 additions & 0 deletions TransactionProcessorACL.IntegrationTests/Common/Contract.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
namespace TransactionProcessor.IntegrationTests.Common
{
using System;
using System.Collections.Generic;
using System.Linq;

public class Contract
{
#region Properties

/// <summary>
/// Gets or sets the contract identifier.
/// </summary>
/// <value>
/// The contract identifier.
/// </value>
public Guid ContractId { get; set; }

/// <summary>
/// Gets or sets the description.
/// </summary>
/// <value>
/// The description.
/// </value>
public String Description { get; set; }

/// <summary>
/// Gets or sets the operator identifier.
/// </summary>
/// <value>
/// The operator identifier.
/// </value>
public Guid OperatorId { get; set; }

/// <summary>
/// Gets or sets the products.
/// </summary>
/// <value>
/// The products.
/// </value>
public List<Product> Products { get; set; }

#endregion

#region Methods

/// <summary>
/// Adds the product.
/// </summary>
/// <param name="productId">The product identifier.</param>
/// <param name="name">The name.</param>
/// <param name="displayText">The display text.</param>
/// <param name="value">The value.</param>
public void AddProduct(Guid productId,
String name,
String displayText,
Decimal? value = null)
{
Product product = new Product
{
ProductId = productId,
DisplayText = displayText,
Name = name,
Value = value
};

if (this.Products == null)
{
this.Products = new List<Product>();
}

this.Products.Add(product);
}

/// <summary>
/// Gets the product.
/// </summary>
/// <param name="productId">The product identifier.</param>
/// <returns></returns>
public Product GetProduct(Guid productId)
{
return this.Products.SingleOrDefault(p => p.ProductId == productId);
}

/// <summary>
/// Gets the product.
/// </summary>
/// <param name="name">The name.</param>
/// <returns></returns>
public Product GetProduct(String name)
{
return this.Products.SingleOrDefault(p => p.Name == name);
}

#endregion
}
}
Loading