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 @@ -41,7 +41,7 @@ static async Task Main(string[] args){
baseAddressFunc = (apiName) => {
String ipaddress = "192.168.1.163";

if (apiName == "SecurityService"){
if (apiName == "SecurityService"){
return $"https://{ipaddress}:5001";
}

Expand All @@ -51,11 +51,11 @@ static async Task Main(string[] args){
//return $"http://127.0.0.1:5002";
}

if (apiName == "FileProcessorApi"){
if (apiName == "FileProcessorApi"){
return $"http://{ipaddress}:5009";
}

if (apiName == "TestHostApi"){
if (apiName == "TestHostApi"){
return $"http://{ipaddress}:9000";
}

Expand Down Expand Up @@ -89,7 +89,7 @@ static async Task Main(string[] args){
await Program.GenerateTransactions(g, estateId, cancellationToken);
//await Program.GenerateStatements(g, estateId, cancellationToken);

Console.WriteLine($"Process Complete");
Console.WriteLine("Process Complete");
}

private static async Task GenerateStatements(ITransactionDataGeneratorService g, Guid estateId, CancellationToken cancellationToken){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
private readonly String TransactionProcessorApi;
private readonly String FileProcessorApi;

public TransactionDataGeneratorService(ISecurityServiceClient securityServiceClient,

Check warning on line 25 in TransactionProcessing.SchedulerService/TransactionProcessing.SchedulerService.DataGenerator/TransactionDataGeneratorService.cs

View workflow job for this annotation

GitHub Actions / Build and Test Pull Requests

Non-nullable field 'ClientToken' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the field as nullable.

Check warning on line 25 in TransactionProcessing.SchedulerService/TransactionProcessing.SchedulerService.DataGenerator/TransactionDataGeneratorService.cs

View workflow job for this annotation

GitHub Actions / Build and Test Pull Requests

Non-nullable field 'TokenResponse' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the field as nullable.
ITransactionProcessorClient transactionProcessorClient,
String transactionProcessorApi,
String fileProcessorApi,
Expand Down Expand Up @@ -211,7 +211,7 @@

// Step 2: Decide how many total transactions to generate in this run
numberOfSales = this.r.Next(1, 6); // e.g. 1–5 transactions per run
List<(SaleTransactionRequest request, Decimal amount)> saleRequests = null;

Check warning on line 214 in TransactionProcessing.SchedulerService/TransactionProcessing.SchedulerService.DataGenerator/TransactionDataGeneratorService.cs

View workflow job for this annotation

GitHub Actions / Build and Test Pull Requests

Converting null literal or possible null value to non-nullable type.
for (int i = 0; i < numberOfSales; i++) {
ContractProduct? contractProduct = contract.Products[this.r.Next(contract.Products.Count)];

Expand Down Expand Up @@ -348,7 +348,7 @@
};

request.Headers.Authorization = new AuthenticationHeaderValue("bearer", tokenResult.Data);
HttpResponseMessage response = null;

Check warning on line 351 in TransactionProcessing.SchedulerService/TransactionProcessing.SchedulerService.DataGenerator/TransactionDataGeneratorService.cs

View workflow job for this annotation

GitHub Actions / Build and Test Pull Requests

Converting null literal or possible null value to non-nullable type.

try
{
Expand All @@ -369,7 +369,7 @@
}
}

private static async Task<Guid> GetFileProfileIdFromOperator(String operatorName, CancellationToken cancellationToken)

Check warning on line 372 in TransactionProcessing.SchedulerService/TransactionProcessing.SchedulerService.DataGenerator/TransactionDataGeneratorService.cs

View workflow job for this annotation

GitHub Actions / Build and Test Pull Requests

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.
{
// TODO: get this profile list from API

Expand Down Expand Up @@ -471,7 +471,7 @@

private String TestHostApi;

public static Decimal GetAmount(Random r, ContractProduct product = null)

Check warning on line 474 in TransactionProcessing.SchedulerService/TransactionProcessing.SchedulerService.DataGenerator/TransactionDataGeneratorService.cs

View workflow job for this annotation

GitHub Actions / Build and Test Pull Requests

Cannot convert null literal to non-nullable reference type.
{
return product switch
{
Expand Down Expand Up @@ -637,7 +637,7 @@
return result;
}

this.WriteTrace($"Merchant retrieved successfully");
this.WriteTrace("Merchant retrieved successfully");

return result;
}
Expand Down Expand Up @@ -709,15 +709,15 @@
Result<String> tokenResult = await this.GetAuthToken(cancellationToken);
if (tokenResult.IsFailed)
return ResultHelpers.CreateFailure(tokenResult);
this.WriteTrace($"About to Float Credit Request");
this.WriteTrace("About to Float Credit Request");
Result? result = await this.TransactionProcessorClient.RecordFloatCreditPurchase(tokenResult.Data, estateId, request, cancellationToken);
if (result.IsFailed) {
this.WriteError($"Error Float Credit Request");
this.WriteError("Error Float Credit Request");
this.WriteError(result.Message);
return result;
}

this.WriteTrace($"Float Credit Request sent");
this.WriteTrace("Float Credit Request sent");

return Result.Success();
}
Expand Down Expand Up @@ -751,7 +751,7 @@
return ResultHelpers.CreateFailure(tokenResult);

SerialisedMessage requestSerialisedMessage = request.CreateSerialisedMessage();
SerialisedMessage responseSerialisedMessage = null;

Check warning on line 754 in TransactionProcessing.SchedulerService/TransactionProcessing.SchedulerService.DataGenerator/TransactionDataGeneratorService.cs

View workflow job for this annotation

GitHub Actions / Build and Test Pull Requests

Converting null literal or possible null value to non-nullable type.

this.WriteTrace($"About to Send sale for Merchant [{merchant.MerchantName}]");
Result<SerialisedMessage> result = new Result<SerialisedMessage>();
Expand Down Expand Up @@ -782,10 +782,10 @@
private readonly String ClientToken;

private async Task<Result<String>> GetAuthToken(CancellationToken cancellationToken) {
this.WriteTrace($"About to get auth token");
this.WriteTrace("About to get auth token");

if (this.TokenResponse == null) {
this.WriteTrace($"TokenResponse was null");
this.WriteTrace("TokenResponse was null");
Result<TokenResponse> tokenResult = await this.SecurityServiceClient.GetToken(this.ClientId, this.ClientSecret, cancellationToken);

if (tokenResult.IsFailed)
Expand All @@ -794,14 +794,14 @@
}

if (this.TokenResponse.Expires.UtcDateTime.Subtract(DateTime.UtcNow) < TimeSpan.FromMinutes(2)) {
this.WriteTrace($"TokenResponse was expired");
this.WriteTrace("TokenResponse was expired");
Result<TokenResponse> tokenResult = await this.SecurityServiceClient.GetToken(this.ClientId, this.ClientSecret, cancellationToken);
if (tokenResult.IsFailed)
return ResultHelpers.CreateFailure(tokenResult);
this.TokenResponse = tokenResult.Data;
}

this.WriteTrace($"Auth token retrieved");
this.WriteTrace("Auth token retrieved");

return Result.Success<String>(this.TokenResponse.AccessToken);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public static async Task<Result> GenerateFloatCredits(ITransactionDataGeneratorS
// Get all the contracts up front
Result<List<ContractResponse>> contractsResult = await t.GetEstateContracts(config.EstateId, cancellationToken);
if (contractsResult.IsFailed) {
results.Add($"Error getting Contract List");
results.Add("Error getting Contract List");
return Result.Failure($"Error making float credits for [{string.Join(",", results)}]");
}

Expand Down
Loading