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
7 changes: 4 additions & 3 deletions .github/workflows/sonarcloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ jobs:
name: Build and analyze
runs-on: windows-latest
steps:
- name: Set up JDK 11
uses: actions/setup-java@v1
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: 1.11
distribution: 'zulu'
java-version: 17
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
Expand Down
10 changes: 10 additions & 0 deletions TransactionProcessor.Client/ITransactionProcessorClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,16 @@ Task<RedeemVoucherResponse> RedeemVoucher(String accessToken,
RedeemVoucherRequest redeemVoucherRequest,
CancellationToken cancellationToken);

Task<CreateFloatForContractProductResponse> CreateFloatForContractProduct(String accessToken,
Guid estateId,
CreateFloatForContractProductRequest createFloatForContractProductRequest,
CancellationToken cancellationToken);

Task RecordFloatCreditPurchase(String accessToken,
Guid estateId,
RecordFloatCreditPurchaseRequest recordFloatCreditPurchaseRequest,
CancellationToken cancellationToken);

#endregion
}
}
63 changes: 63 additions & 0 deletions TransactionProcessor.Client/TransactionProcessorClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,69 @@ public async Task<RedeemVoucherResponse> RedeemVoucher(String accessToken,
return response;
}

public async Task<CreateFloatForContractProductResponse> CreateFloatForContractProduct(String accessToken, Guid estateId, CreateFloatForContractProductRequest createFloatForContractProductRequest, CancellationToken cancellationToken){
CreateFloatForContractProductResponse response = null;

String requestUri = $"{this.BaseAddress}/api/estates/{estateId}/floats";

try
{
String requestSerialised = JsonConvert.SerializeObject(createFloatForContractProductRequest);

StringContent httpContent = new StringContent(requestSerialised, Encoding.UTF8, "application/json");

// Add the access token to the client headers
this.HttpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", accessToken);

// Make the Http Call here
HttpResponseMessage httpResponse = await this.HttpClient.PostAsync(requestUri, httpContent, cancellationToken);

// Process the response
String content = await this.HandleResponse(httpResponse, cancellationToken);

// call was successful so now deserialise the body to the response object
response = JsonConvert.DeserializeObject<CreateFloatForContractProductResponse>(content);
}
catch (Exception ex)
{
// An exception has occurred, add some additional information to the message
Exception exception = new Exception("Error creating contract product float.", ex);

throw exception;
}

return response;
}

public async Task RecordFloatCreditPurchase(String accessToken, Guid estateId, RecordFloatCreditPurchaseRequest recordFloatCreditPurchaseRequest, CancellationToken cancellationToken){
String requestUri = $"{this.BaseAddress}/api/estates/{estateId}/floats";

try
{
String requestSerialised = JsonConvert.SerializeObject(recordFloatCreditPurchaseRequest);

StringContent httpContent = new StringContent(requestSerialised, Encoding.UTF8, "application/json");

// Add the access token to the client headers
this.HttpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", accessToken);


// Make the Http Call here
HttpResponseMessage httpResponse = await this.HttpClient.PutAsync(requestUri, httpContent, cancellationToken);

// Process the response
await this.HandleResponse(httpResponse, cancellationToken);

}
catch (Exception ex)
{
// An exception has occurred, add some additional information to the message
Exception exception = new Exception("Error crediting contract product float.", ex);

throw exception;
}
}

#endregion
}
}