Class ControlProcessorServiceClient
Concrete class that implement HTTP calls on Control Processor Microservice.
Implements
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ToString()
System.Object.ReferenceEquals(System.Object, System.Object)
Namespace: StoneCo.IC.Service.Visa.Host.Client
Assembly: cs.temp.dll.dll
Syntax
public class ControlProcessorServiceClient : InterchangeServiceVisaServiceClientBase, IControlProcessorServiceClient
Constructors
ControlProcessorServiceClient(IOptionsSnapshot<InterchangeServiceVisaServiceClientOptions>, IHttpRestServiceClient)
Default constructor to set options and HttpRestServiceClient.
Declaration
public ControlProcessorServiceClient(IOptionsSnapshot<InterchangeServiceVisaServiceClientOptions> options, IHttpRestServiceClient httpRestServiceClient)
Parameters
Type | Name | Description |
---|---|---|
IOptionsSnapshot<InterchangeServiceVisaServiceClientOptions> | options | The options design pattern used in InterchangeServiceVisaServiceClient. |
IHttpRestServiceClient | httpRestServiceClient | Interface with the default methods and properties to be used for all HTTP Rest calls. |
Examples
Create a options configuration on class with name AppSettingsOptionsConfigurations on folder Configurations.
public static class AppSettingsOptionsConfigurations
{
private static string AppSettingsInterchangeServiceVisaServiceClient => "Clients:InterchangeServiceVisaServiceClient";
public static void ConfigureAppSettingsOptions(this IServiceCollection services, IConfiguration configuration)
{
services.AddOptions();
services.Configure<InterchangeServiceVisaServiceClientOptions>(options =>
configuration.GetSection(AppSettingsInterchangeServiceVisaServiceClient).Bind(options));
}
}
Representation on appsettings.json file.
{
"Clients": {
"InterchangeServiceVisaServiceClient": {
"Name": "InterchangeServiceVisaServiceClient",
"AuthorizationToken": "50953e76f47d4be8b0c0072b1b876ab7",
"BaseAddress": "https://domain-of-api.com/"
}
}
}
Dependency injection on application.
public class DIFactory
{
public static void ConfigureDI(IServiceCollection services, IConfiguration configuration)
{
services.AddScoped<IControlProcessorServiceClient, ControlProcessorServiceClient>(configuration.GetValue<string>("Clients:InterchangeServiceVisaServiceClient:Name"), configuration.GetValue<string>("Clients:InterchangeServiceVisaServiceClient:BaseAddress"));
}
}
Finally, follow the example of how to use the client.
public class Bar
{
private IControlProcessorServiceClient ControlProcessorServiceClient { get; }
public Bar(IControlProcessorServiceClient controlProcessorServiceClient) => ControlProcessorServiceClient = controlProcessorServiceClient;
public async Task ImportVisaSaleDraftIdAsync(...)
{
var request = new ImportVisaSaleDraftIdRequestMessage();
//(...)
ResultResponseMessage result = await IControlProcessorServiceClient.GetPendingVisaInstallmentsAsync(request);
//(...)
}
}
Methods
ImportVisaSaleDraftIdAsync(ImportConfirmedTransactionIdRequestMessage)
Asynchronous call to make control processor.
Declaration
public Task<ResultResponseMessage> ImportVisaSaleDraftIdAsync(ImportConfirmedTransactionIdRequestMessage request)
Parameters
Type | Name | Description |
---|---|---|
ImportConfirmedTransactionIdRequestMessage | request | Request with parameters to make control processor. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<ResultResponseMessage> | Result of operations. |