Skip to content

Commit a7fffb5

Browse files
Merge pull request #58 from StuartFerguson/task/#57_productinfoinsalesrequest
Updated request to take in Product Details
2 parents 4dfc01c + a92a88f commit a7fffb5

File tree

22 files changed

+1067
-308
lines changed

22 files changed

+1067
-308
lines changed

TransactionProcessorACL.BusinessLogic.Tests/RequestHandlerTests.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ public async Task ProcessSaleTransactionRequestHandler_Handle_RequestIsHandled()
5959
It.IsAny<Decimal>(),
6060
It.IsAny<String>(),
6161
It.IsAny<String>(),
62+
It.IsAny<Guid>(),
63+
It.IsAny<Guid>(),
6264
It.IsAny<CancellationToken>())).ReturnsAsync(TestData.ProcessSaleTransactionResponse);
6365

6466
ProcessSaleTransactionRequestHandler requestHandler = new ProcessSaleTransactionRequestHandler(applicationService.Object);

TransactionProcessorACL.BusinessLogic.Tests/RequestTests.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ public void ProcessSaleTransactionRequest_CanBeCreated_IsCreated()
4444
TestData.OperatorIdentifier,
4545
TestData.SaleAmount,
4646
TestData.CustomerAccountNumber,
47-
TestData.CustomerEmailAddress);
47+
TestData.CustomerEmailAddress,
48+
TestData.ContractId,
49+
TestData.ProductId);
4850

4951
request.EstateId.ShouldBe(TestData.EstateId);
5052
request.MerchantId.ShouldBe(TestData.MerchantId);
@@ -55,6 +57,8 @@ public void ProcessSaleTransactionRequest_CanBeCreated_IsCreated()
5557
request.Amount.ShouldBe(TestData.SaleAmount);
5658
request.CustomerAccountNumber.ShouldBe(TestData.CustomerAccountNumber);
5759
request.CustomerEmailAddress.ShouldBe(TestData.CustomerEmailAddress);
60+
request.ContractId.ShouldBe(TestData.ContractId);
61+
request.ProductId.ShouldBe(TestData.ProductId);
5862
}
5963

6064
#endregion

TransactionProcessorACL.BusinessLogic.Tests/TransactionProcessorACLApplicationServiceTests.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ public async Task TransactionProcessorACLApplicationService_ProcessSaleTransacti
114114
TestData.SaleAmount,
115115
TestData.CustomerAccountNumber,
116116
TestData.CustomerEmailAddress,
117+
TestData.ContractId,
118+
TestData.ProductId,
117119
CancellationToken.None);
118120

119121
saleResponse.ShouldNotBeNull();
@@ -145,6 +147,8 @@ public async Task TransactionProcessorACLApplicationService_ProcessSaleTransacti
145147
TestData.SaleAmount,
146148
TestData.CustomerAccountNumber,
147149
TestData.CustomerEmailAddress,
150+
TestData.ContractId,
151+
TestData.ProductId,
148152
CancellationToken.None);
149153

150154
saleResponse.ShouldNotBeNull();

TransactionProcessorACL.BusinessLogic/RequestHandlers/ProcessSaleTransactionRequestHandler.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ public async Task<ProcessSaleTransactionResponse> Handle(ProcessSaleTransactionR
5353
request.Amount,
5454
request.CustomerAccountNumber,
5555
request.CustomerEmailAddress,
56+
request.ContractId,
57+
request.ProductId,
5658
cancellationToken);
5759
}
5860

TransactionProcessorACL.BusinessLogic/Requests/ProcessSaleTransactionRequest.cs

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ public ProcessSaleTransactionRequest()
3030
/// <param name="amount">The amount.</param>
3131
/// <param name="customerAccountNumber">The customer account number.</param>
3232
/// <param name="customerEmailAddress">The customer email address.</param>
33+
/// <param name="contractId">The contract identifier.</param>
34+
/// <param name="productId">The product identifier.</param>
35+
/// <param name="">The .</param>
3336
private ProcessSaleTransactionRequest(Guid estateId,
3437
Guid merchantId,
3538
DateTime transactionDateTime,
@@ -38,7 +41,9 @@ private ProcessSaleTransactionRequest(Guid estateId,
3841
String operatorIdentifier,
3942
Decimal amount,
4043
String customerAccountNumber,
41-
String customerEmailAddress)
44+
String customerEmailAddress,
45+
Guid contractId,
46+
Guid productId)
4247
{
4348
this.EstateId = estateId;
4449
this.MerchantId = merchantId;
@@ -47,10 +52,12 @@ private ProcessSaleTransactionRequest(Guid estateId,
4752
this.Amount = amount;
4853
this.CustomerAccountNumber = customerAccountNumber;
4954
this.CustomerEmailAddress = customerEmailAddress;
55+
this.ContractId = contractId;
56+
this.ProductId = productId;
5057
this.TransactionDateTime = transactionDateTime;
5158
this.TransactionNumber = transactionNumber;
5259
}
53-
60+
5461
#endregion
5562

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

89+
/// <summary>
90+
/// Gets the contract identifier.
91+
/// </summary>
92+
/// <value>
93+
/// The contract identifier.
94+
/// </value>
95+
public Guid ContractId { get; }
96+
97+
/// <summary>
98+
/// Gets the product identifier.
99+
/// </summary>
100+
/// <value>
101+
/// The product identifier.
102+
/// </value>
103+
public Guid ProductId { get; }
104+
82105
/// <summary>
83106
/// Gets the device identifier.
84107
/// </summary>
@@ -143,6 +166,8 @@ private ProcessSaleTransactionRequest(Guid estateId,
143166
/// <param name="amount">The amount.</param>
144167
/// <param name="customerAccountNumber">The customer account number.</param>
145168
/// <param name="customerEmailAddress">The customer email address.</param>
169+
/// <param name="contractId">The contract identifier.</param>
170+
/// <param name="productId">The product identifier.</param>
146171
/// <returns></returns>
147172
public static ProcessSaleTransactionRequest Create(Guid estateId,
148173
Guid merchantId,
@@ -152,7 +177,9 @@ public static ProcessSaleTransactionRequest Create(Guid estateId,
152177
String operatorIdentifier,
153178
Decimal amount,
154179
String customerAccountNumber,
155-
String customerEmailAddress)
180+
String customerEmailAddress,
181+
Guid contractId,
182+
Guid productId)
156183
{
157184
return new ProcessSaleTransactionRequest(estateId,
158185
merchantId,
@@ -162,7 +189,9 @@ public static ProcessSaleTransactionRequest Create(Guid estateId,
162189
operatorIdentifier,
163190
amount,
164191
customerAccountNumber,
165-
customerEmailAddress);
192+
customerEmailAddress,
193+
contractId,
194+
productId);
166195
}
167196

168197
#endregion

TransactionProcessorACL.BusinessLogic/Services/ITransactionProcessorACLApplicationService.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ Task<ProcessLogonTransactionResponse> ProcessLogonTransaction(Guid estateId,
4040
/// <param name="amount">The amount.</param>
4141
/// <param name="customerAccountNumber">The customer account number.</param>
4242
/// <param name="customerEmailAddress">The customer email address.</param>
43+
/// <param name="contractId">The contract identifier.</param>
44+
/// <param name="productId">The product identifier.</param>
4345
/// <param name="cancellationToken">The cancellation token.</param>
4446
/// <returns></returns>
4547
Task<ProcessSaleTransactionResponse> ProcessSaleTransaction(Guid estateId,
@@ -51,6 +53,8 @@ Task<ProcessSaleTransactionResponse> ProcessSaleTransaction(Guid estateId,
5153
Decimal amount,
5254
String customerAccountNumber,
5355
String customerEmailAddress,
56+
Guid contractId,
57+
Guid productId,
5458
CancellationToken cancellationToken);
5559
}
5660
}

TransactionProcessorACL.BusinessLogic/Services/TransactionProcessorACLApplicationService.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,8 @@ public async Task<ProcessLogonTransactionResponse> ProcessLogonTransaction(Guid
135135
/// <param name="amount">The amount.</param>
136136
/// <param name="customerAccountNumber">The customer account number.</param>
137137
/// <param name="customerEmailAddress">The customer email address.</param>
138+
/// <param name="contractId">The contract identifier.</param>
139+
/// <param name="productId">The product identifier.</param>
138140
/// <param name="cancellationToken">The cancellation token.</param>
139141
/// <returns></returns>
140142
public async Task<ProcessSaleTransactionResponse> ProcessSaleTransaction(Guid estateId,
@@ -146,6 +148,8 @@ public async Task<ProcessSaleTransactionResponse> ProcessSaleTransaction(Guid es
146148
Decimal amount,
147149
String customerAccountNumber,
148150
String customerEmailAddress,
151+
Guid contractId,
152+
Guid productId,
149153
CancellationToken cancellationToken)
150154
{
151155
// Get a client token to call the Transaction Processor
@@ -162,6 +166,10 @@ public async Task<ProcessSaleTransactionResponse> ProcessSaleTransaction(Guid es
162166
saleTransactionRequest.OperatorIdentifier = operatorIdentifier;
163167
saleTransactionRequest.CustomerEmailAddress = customerEmailAddress;
164168

169+
// Set the product information
170+
saleTransactionRequest.ContractId = contractId;
171+
saleTransactionRequest.ProductId = productId;
172+
165173
// Build up the metadata
166174
saleTransactionRequest.AdditionalTransactionMetadata = new Dictionary<String, String>();
167175
saleTransactionRequest.AdditionalTransactionMetadata.Add("Amount", amount.ToString());

TransactionProcessorACL.BusinessLogic/TransactionProcessorACL.BusinessLogic.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<PackageReference Include="MediatR" Version="8.0.2" />
99
<PackageReference Include="SecurityService.Client" Version="1.0.0" />
1010
<PackageReference Include="Shared" Version="0.0.15.7" />
11-
<PackageReference Include="TransactionProcessor.Client" Version="1.0.1.1" />
11+
<PackageReference Include="TransactionProcessor.Client" Version="1.0.2-build16" />
1212
</ItemGroup>
1313

1414
<ItemGroup>

TransactionProcessorACL.DataTransferObjects/Requests/SaleTransactionRequestMessage.cs

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@ public class SaleTransactionRequestMessage : TransactionRequestMessage
2020
/// </value>
2121
public Decimal Amount { get; set; }
2222

23+
/// <summary>
24+
/// Gets or sets the contract identifier.
25+
/// </summary>
26+
/// <value>
27+
/// The contract identifier.
28+
/// </value>
29+
public Guid ContractId { get; set; }
30+
2331
/// <summary>
2432
/// Gets or sets the customer account number.
2533
/// </summary>
@@ -28,6 +36,14 @@ public class SaleTransactionRequestMessage : TransactionRequestMessage
2836
/// </value>
2937
public String CustomerAccountNumber { get; set; }
3038

39+
/// <summary>
40+
/// Gets or sets the customer email address.
41+
/// </summary>
42+
/// <value>
43+
/// The customer email address.
44+
/// </value>
45+
public String CustomerEmailAddress { get; set; }
46+
3147
/// <summary>
3248
/// Gets or sets the operator identifier.
3349
/// </summary>
@@ -37,12 +53,12 @@ public class SaleTransactionRequestMessage : TransactionRequestMessage
3753
public String OperatorIdentifier { get; set; }
3854

3955
/// <summary>
40-
/// Gets or sets the customer email address.
56+
/// Gets or sets the product identifier.
4157
/// </summary>
4258
/// <value>
43-
/// The customer email address.
59+
/// The product identifier.
4460
/// </value>
45-
public String CustomerEmailAddress { get; set; }
61+
public Guid ProductId { get; set; }
4662

4763
#endregion
4864
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
namespace TransactionProcessor.IntegrationTests.Common
2+
{
3+
using System;
4+
5+
public class ClientDetails
6+
{
7+
public String ClientId { get; private set; }
8+
public String ClientSecret { get; private set; }
9+
public String GrantType { get; private set; }
10+
11+
private ClientDetails(String clientId,
12+
String clientSecret,
13+
String grantType)
14+
{
15+
this.ClientId = clientId;
16+
this.ClientSecret = clientSecret;
17+
this.GrantType = grantType;
18+
}
19+
20+
public static ClientDetails Create(String clientId,
21+
String clientSecret,
22+
String grantType)
23+
{
24+
return new ClientDetails(clientId, clientSecret, grantType);
25+
}
26+
}
27+
}

0 commit comments

Comments
 (0)