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
60 changes: 48 additions & 12 deletions TransactionProcessing.SchedulerService/JobTestDriver/Program.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
namespace JobTestDriver
{
using EstateManagement.Client;
using MessagingService.Client;
using SecurityService.Client;
using TransactionProcessing.DataGeneration;
using TransactionProcessing.SchedulerService.Jobs;
using TransactionProcessor.Client;

internal class Program{
static async Task Main(string[] args){
Expand All @@ -14,18 +18,50 @@ static async Task Main(string[] args){
//foreach ((Guid, String, DateTime, String) incompleteFile in incompleteFiles){
// Console.WriteLine($"FileId: {incompleteFile.Item1} Location: {incompleteFile.Item2} Rcvd: {incompleteFile.Item3} Merchant: {incompleteFile.Item4}");
//}
HttpClient client = new HttpClient();
IMessagingServiceClient messagingServiceClient = new MessagingServiceClient(delegate(String s){ return "http://127.0.0.1:5006";}, client);
String accessToken = "eyJhbGciOiJSUzI1NiIsImtpZCI6IjQzOUMxRDk5MDUwQTYyMDhEM0U5M0JFMjlBQUJBNzI5IiwidHlwIjoiYXQrand0In0.eyJpc3MiOiJodHRwczovLzEyNy4wLjAuMTo1MDAxIiwibmJmIjoxNjgzMTA2NDE2LCJpYXQiOjE2ODMxMDY0MTYsImV4cCI6MTY4MzExMDAxNiwiYXVkIjpbImVzdGF0ZU1hbmFnZW1lbnQiLCJlc3RhdGVSZXBvcnRpbmciLCJmaWxlUHJvY2Vzc29yIiwibWVzc2FnaW5nU2VydmljZSIsInRyYW5zYWN0aW9uUHJvY2Vzc29yIiwidHJhbnNhY3Rpb25Qcm9jZXNzb3JBQ0wiLCJ2b3VjaGVyTWFuYWdlbWVudCIsImh0dHBzOi8vMTI3LjAuMC4xOjUwMDEvcmVzb3VyY2VzIl0sInNjb3BlIjpbImVzdGF0ZU1hbmFnZW1lbnQiLCJlc3RhdGVSZXBvcnRpbmciLCJmaWxlUHJvY2Vzc29yIiwibWVzc2FnaW5nU2VydmljZSIsInRyYW5zYWN0aW9uUHJvY2Vzc29yIiwidHJhbnNhY3Rpb25Qcm9jZXNzb3JBQ0wiLCJ2b3VjaGVyTWFuYWdlbWVudCJdLCJjbGllbnRfaWQiOiJzZXJ2aWNlQ2xpZW50IiwianRpIjoiMDZBMUI4NzYyRjFGNDJGNkIwMzM5RTYwRTk2MkVDQkUifQ.G5pFWRJF430ZZxnGO_yIxEC6Zj81LRr3HNq6d8V9EV4Pswp5YO7hZ867Ln4mjnrYag4lGI4cpT5S6646r9KNdZMiLOsdQs2LEJPuUjEdVADIwm8rcdqT8OX-sC6uGA6VL0bMmYWQXw1E8d4kax444I6jeNquLjpoWVD1BDp9L1zzC6e_k9W7Fc9MQOogOqO82TXrBl9nkpBbmJQ0HDiub2yVUTUKLwkCeRfBDlyeU8tyNE7kH6IGdHIL_WYUtiiRYjBJ2PNLzTtrXQk4rqw6GB-25K2qcgP5FO0MI675tAkuPKI0DaySXHnAjYssW8wZYy0tkaJL0OIlmOUe-9jM6g";
await Jobs.SendSupportEmail(DateTime.Now,
accessToken,
"esdb://admin:changeit@192.168.0.133:2113?tls=false&tlsVerifyCert=false",
"server=192.168.0.133;user id=sa;password=Sc0tland;database=EstateReportingReadModel<estateid>;Encrypt=True;TrustServerCertificate=True",
new List<String>{
"435613ac-a468-47a3-ac4f-649d89764c22"
},
messagingServiceClient,
CancellationToken.None);
//HttpClient client = new HttpClient();
//IMessagingServiceClient messagingServiceClient = new MessagingServiceClient(delegate(String s){ return "http://127.0.0.1:5006";}, client);
//String accessToken = "eyJhbGciOiJSUzI1NiIsImtpZCI6IjQzOUMxRDk5MDUwQTYyMDhEM0U5M0JFMjlBQUJBNzI5IiwidHlwIjoiYXQrand0In0.eyJpc3MiOiJodHRwczovLzEyNy4wLjAuMTo1MDAxIiwibmJmIjoxNjgzMTA2NDE2LCJpYXQiOjE2ODMxMDY0MTYsImV4cCI6MTY4MzExMDAxNiwiYXVkIjpbImVzdGF0ZU1hbmFnZW1lbnQiLCJlc3RhdGVSZXBvcnRpbmciLCJmaWxlUHJvY2Vzc29yIiwibWVzc2FnaW5nU2VydmljZSIsInRyYW5zYWN0aW9uUHJvY2Vzc29yIiwidHJhbnNhY3Rpb25Qcm9jZXNzb3JBQ0wiLCJ2b3VjaGVyTWFuYWdlbWVudCIsImh0dHBzOi8vMTI3LjAuMC4xOjUwMDEvcmVzb3VyY2VzIl0sInNjb3BlIjpbImVzdGF0ZU1hbmFnZW1lbnQiLCJlc3RhdGVSZXBvcnRpbmciLCJmaWxlUHJvY2Vzc29yIiwibWVzc2FnaW5nU2VydmljZSIsInRyYW5zYWN0aW9uUHJvY2Vzc29yIiwidHJhbnNhY3Rpb25Qcm9jZXNzb3JBQ0wiLCJ2b3VjaGVyTWFuYWdlbWVudCJdLCJjbGllbnRfaWQiOiJzZXJ2aWNlQ2xpZW50IiwianRpIjoiMDZBMUI4NzYyRjFGNDJGNkIwMzM5RTYwRTk2MkVDQkUifQ.G5pFWRJF430ZZxnGO_yIxEC6Zj81LRr3HNq6d8V9EV4Pswp5YO7hZ867Ln4mjnrYag4lGI4cpT5S6646r9KNdZMiLOsdQs2LEJPuUjEdVADIwm8rcdqT8OX-sC6uGA6VL0bMmYWQXw1E8d4kax444I6jeNquLjpoWVD1BDp9L1zzC6e_k9W7Fc9MQOogOqO82TXrBl9nkpBbmJQ0HDiub2yVUTUKLwkCeRfBDlyeU8tyNE7kH6IGdHIL_WYUtiiRYjBJ2PNLzTtrXQk4rqw6GB-25K2qcgP5FO0MI675tAkuPKI0DaySXHnAjYssW8wZYy0tkaJL0OIlmOUe-9jM6g";
//await Jobs.SendSupportEmail(DateTime.Now,
// accessToken,
// "esdb://admin:changeit@192.168.0.133:2113?tls=false&tlsVerifyCert=false",
// "server=192.168.0.133;user id=sa;password=Sc0tland;database=EstateReportingReadModel<estateid>;Encrypt=True;TrustServerCertificate=True",
// new List<String>{
// "435613ac-a468-47a3-ac4f-649d89764c22"
// },
// messagingServiceClient,
// CancellationToken.None);

HttpClientHandler handler = new HttpClientHandler
{
ServerCertificateCustomValidationCallback = (message,
cert,
chain,
errors) => {
return true;
}
};
HttpClient client = new HttpClient(handler);
ISecurityServiceClient securityServiceClient = new SecurityServiceClient(delegate(String s){ return "https://192.168.0.133:5001"; },client);
IEstateClient estateClient = new EstateClient(delegate (String s) { return "http://192.168.0.133:5000"; }, client);
ITransactionProcessorClient transactionProcessorClient = new TransactionProcessorClient(delegate (String s) { return "http://192.168.0.133:5002"; }, client);
String estateManagementApi = "http://192.168.0.133:5000";
String fileProcessorApi = "http://192.168.0.133:5009";
String testHostApi = "http://192.168.0.133:9000";
String clientId = "serviceClient";
String clientSecret = "d192cbc46d834d0da90e8a9d50ded543";

ITransactionDataGenerator t = new TransactionDataGenerator(securityServiceClient,
estateClient,
transactionProcessorClient,
estateManagementApi,
fileProcessorApi,
testHostApi,
clientId,
clientSecret,
RunningMode.Live);
Guid estateId = Guid.Parse("435613ac-a468-47a3-ac4f-649d89764c22");
Guid merchantId = Guid.Parse("ab1c99fb-1c6c-4694-9a32-b71be5d1da33");
await Jobs.GenerateTransactions(t, estateId, merchantId, false, CancellationToken.None);

}
}
Expand Down
64 changes: 44 additions & 20 deletions TransactionProcessor.DataGenerator/DataGenerator/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,42 +101,66 @@ private static async Task GenerateStatements(ITransactionDataGenerator g, Guid e

private static async Task GenerateTransactions(ITransactionDataGenerator g, Guid estateId, CancellationToken cancellationToken){
// Set the date range
DateTime startDate = new DateTime(2023, 6, 8); //27/7
DateTime endDate = new DateTime(2023, 6, 8); // This is the date of the last generated transaction
DateTime startDate = new DateTime(2023, 6, 16); //27/7
DateTime endDate = new DateTime(2023, 6, 16); // This is the date of the last generated transaction

List<DateTime> dateRange = g.GenerateDateRange(startDate, endDate);

List<MerchantResponse> merchants = await g.GetMerchants(estateId, cancellationToken);

Boolean sendLogons = false;
Boolean sendSales = true;
Boolean sendFiles = false;
Boolean sendSettlement = false;

foreach (DateTime dateTime in dateRange){
foreach (MerchantResponse merchant in merchants)
{
// Send a logon transaction
await g.PerformMerchantLogon(dateTime, merchant, cancellationToken);
var d = DateTime.Now;
if (sendLogons){
foreach (MerchantResponse merchant in merchants){

// Get the merchants contracts
List<ContractResponse> contracts = await g.GetMerchantContracts(merchant, cancellationToken);
// Send a logon transaction
await g.PerformMerchantLogon(dateTime, merchant, cancellationToken);
}
}

foreach (ContractResponse contract in contracts)
{
// Generate and send some sales
await g.SendSales(dateTime, merchant, contract, 0, cancellationToken);
if (sendSales){
foreach (MerchantResponse merchant in merchants){
// Get the merchants contracts
List<ContractResponse> contracts = await g.GetMerchantContracts(merchant, cancellationToken);

await Task.Delay(TimeSpan.FromSeconds(10), cancellationToken);
foreach (ContractResponse contract in contracts){
// Generate and send some sales
await g.SendSales(d, merchant, contract, 0, cancellationToken);

// Generate a file and upload
await g.SendUploadFile(dateTime, contract, merchant, cancellationToken);
//await Task.Delay(TimeSpan.FromSeconds(10), cancellationToken);
}

await Task.Delay(TimeSpan.FromSeconds(10));
//await Task.Delay(TimeSpan.FromSeconds(30), cancellationToken);
}
}

await Task.Delay(TimeSpan.FromSeconds(30), cancellationToken);
if (sendFiles){
foreach (MerchantResponse merchant in merchants){
// Get the merchants contracts
List<ContractResponse> contracts = await g.GetMerchantContracts(merchant, cancellationToken);

foreach (ContractResponse contract in contracts){
// Generate a file and upload
await g.SendUploadFile(dateTime, contract, merchant, cancellationToken);

await Task.Delay(TimeSpan.FromSeconds(10), cancellationToken);
}

await Task.Delay(TimeSpan.FromSeconds(30), cancellationToken);
}
}

// Settlement
await g.PerformSettlement(dateTime, estateId, cancellationToken);

await Task.Delay(TimeSpan.FromSeconds(30), cancellationToken);
if (sendSettlement){
await g.PerformSettlement(dateTime, estateId, cancellationToken);

await Task.Delay(TimeSpan.FromSeconds(30), cancellationToken);
}
}
}
}
Expand Down
Loading