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
8 changes: 4 additions & 4 deletions .github/workflows/pullrequest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ jobs:
dotnet test "TransactionProcessor.Tests\TransactionProcessor.Tests.csproj"
dotnet test "TransactionProcessor.DatabaseTests\TransactionProcessor.DatabaseTests.csproj"

# - name: Build Docker Image
# run: docker build . --file TransactionProcessor/Dockerfile --tag transactionprocessor:latest
- name: Build Docker Image
run: docker build . --file TransactionProcessor/Dockerfile --tag transactionprocessor:latest

# - name: Run Integration Tests
# run: dotnet test "TransactionProcessor.IntegrationTests\TransactionProcessor.IntegrationTests.csproj" --filter Category=PRTest --logger "trx;LogFileName=test-results.trx"
- name: Run Integration Tests
run: dotnet test "TransactionProcessor.IntegrationTests\TransactionProcessor.IntegrationTests.csproj" --filter Category=PRTest --logger "trx;LogFileName=test-results.trx"

- uses: actions/upload-artifact@v4.4.0
if: ${{ failure() }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public async Task<Result<TransactionValidationResult>> ValidateLogonTransaction(

// Validate Merchant
var merchantValidationResult = await ValidateMerchant(estateValidationResult.Data.additionalData.EstateName, merchantId, cancellationToken);
if (merchantValidationResult.IsFailed) return CreateFailedResult(merchantValidationResult.Data.validationResult); ;
if (merchantValidationResult.IsFailed) return CreateFailedResult(merchantValidationResult.Data.validationResult);

Models.Merchant.Merchant merchant = merchantValidationResult.Data.additionalData.GetMerchant();

Expand Down
24 changes: 21 additions & 3 deletions TransactionProcessor.Client/TransactionProcessorClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,25 @@
return Result.Success<String>(result.Data);
}

private async Task<Result<String>> SendPutRequest(String uri, String accessToken, String content, CancellationToken cancellationToken)
{

HttpRequestMessage requestMessage = new HttpRequestMessage(HttpMethod.Put, uri);
requestMessage.Headers.Authorization = new AuthenticationHeaderValue(AuthenticationSchemes.Bearer, accessToken);
requestMessage.Content = new StringContent(content, Encoding.UTF8, "application/json");

// Make the Http Call here
HttpResponseMessage httpResponse = await this.HttpClient.SendAsync(requestMessage, cancellationToken);

// Process the response
Result<String> result = await this.HandleResponseX(httpResponse, cancellationToken);

if (result.IsFailed)
return ResultHelpers.CreateFailure(result);

return Result.Success<String>(result.Data);
}

public static class AuthenticationSchemes
{
public static readonly String Bearer = "Bearer";
Expand Down Expand Up @@ -306,8 +325,7 @@
catch (Exception ex) {
// An exception has occurred, add some additional information to the message
Exception exception = new("Error getting voucher by code.", ex);
;


throw exception;
}
}
Expand Down Expand Up @@ -422,7 +440,7 @@
try {
String requestSerialised = JsonConvert.SerializeObject(redeemVoucherRequest);

Result<String> result = await this.SendPostRequest(requestUri, accessToken, requestSerialised, cancellationToken);
Result<String> result = await this.SendPutRequest(requestUri, accessToken, requestSerialised, cancellationToken);

if (result.IsFailed)
return ResultHelpers.CreateFailure(result);
Expand Down Expand Up @@ -1011,7 +1029,7 @@

return Result.Success(responseData.Data);
}
catch (Exception ex) {

Check warning on line 1032 in TransactionProcessor.Client/TransactionProcessorClient.cs

View workflow job for this annotation

GitHub Actions / Build and Test Pull Requests

The variable 'ex' is declared but never used
// An exception has occurred, add some additional information to the message
Exception exception = new($"Error getting settlement id {settlementId} for estate [{estateId}]");

Expand All @@ -1037,7 +1055,7 @@

return Result.Success(responseData.Data);
}
catch (Exception ex) {

Check warning on line 1058 in TransactionProcessor.Client/TransactionProcessorClient.cs

View workflow job for this annotation

GitHub Actions / Build and Test Pull Requests

The variable 'ex' is declared but never used
// An exception has occurred, add some additional information to the message
Exception exception = new($"Error getting settlements for estate [{estateId}]");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1340,7 +1340,7 @@ public async Task<Result> StartReconciliation(ReconciliationDomainEvents.Reconci

await context.Reconciliations.AddAsync(reconciliation, cancellationToken);

return await context.SaveChangesAsync(cancellationToken); ;
return await context.SaveChangesAsync(cancellationToken);
}

public async Task<Result> StartTransaction(TransactionDomainEvents.TransactionHasStartedEvent domainEvent,
Expand Down
Loading